hypothesis 1.910.0 → 1.911.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(){function t(t){var e=!0,n=!1,i=null,o={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function r(t){return!!(t&&t!==document&&"HTML"!==t.nodeName&&"BODY"!==t.nodeName&&"classList"in t&&"contains"in t.classList)}function s(t){var e=t.type,n=t.tagName;return!("INPUT"!==n||!o[e]||t.readOnly)||"TEXTAREA"===n&&!t.readOnly||!!t.isContentEditable}function a(t){t.classList.contains("focus-visible")||(t.classList.add("focus-visible"),t.setAttribute("data-focus-visible-added",""))}function l(t){t.hasAttribute("data-focus-visible-added")&&(t.classList.remove("focus-visible"),t.removeAttribute("data-focus-visible-added"))}function c(n){n.metaKey||n.altKey||n.ctrlKey||(r(t.activeElement)&&a(t.activeElement),e=!0)}function h(t){e=!1}function u(t){r(t.target)&&(e||s(t.target))&&a(t.target)}function d(t){r(t.target)&&(t.target.classList.contains("focus-visible")||t.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(i),i=window.setTimeout((function(){n=!1}),100),l(t.target))}function f(t){"hidden"===document.visibilityState&&(n&&(e=!0),p())}function p(){document.addEventListener("mousemove",m),document.addEventListener("mousedown",m),document.addEventListener("mouseup",m),document.addEventListener("pointermove",m),document.addEventListener("pointerdown",m),document.addEventListener("pointerup",m),document.addEventListener("touchmove",m),document.addEventListener("touchstart",m),document.addEventListener("touchend",m)}function g(){document.removeEventListener("mousemove",m),document.removeEventListener("mousedown",m),document.removeEventListener("mouseup",m),document.removeEventListener("pointermove",m),document.removeEventListener("pointerdown",m),document.removeEventListener("pointerup",m),document.removeEventListener("touchmove",m),document.removeEventListener("touchstart",m),document.removeEventListener("touchend",m)}function m(t){t.target.nodeName&&"html"===t.target.nodeName.toLowerCase()||(e=!1,g())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",h,!0),document.addEventListener("pointerdown",h,!0),document.addEventListener("touchstart",h,!0),document.addEventListener("visibilitychange",f,!0),p(),t.addEventListener("focus",u,!0),t.addEventListener("blur",d,!0),t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host?t.host.setAttribute("data-js-focus-visible",""):t.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var e;window.applyFocusVisiblePolyfill=t;try{e=new CustomEvent("focus-visible-polyfill-ready")}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(e)}"undefined"!=typeof document&&t(document)}();var e,n,i,o,r={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function l(t,e){for(var n in e)t[n]=e[n];return t}function c(t){var e=t.parentNode;e&&e.removeChild(t)}function h(t,n,i,o,r){var s={type:t,props:n,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++e.__v:r};return null!=e.vnode&&e.vnode(s),s}function u(t){return t.children}function d(t,e){this.props=t,this.context=e}function f(t,e){if(null==e)return t.__?f(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?f(t):null}function p(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return p(t)}}function g(t){(!t.__d&&(t.__d=!0)&&n.push(t)&&!m.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||i)(m)}function m(){for(var t;m.__r=n.length;)t=n.sort((function(t,e){return t.__v.__b-e.__v.__b})),n=[],t.some((function(t){var e,n,i,o,r,s;t.__d&&(r=(o=(e=t).__v).__e,(s=e.__P)&&(n=[],(i=l({},o)).__v=o.__v+1,T(s,o,i,e.__n,void 0!==s.ownerSVGElement,null!=o.__h?[r]:null,n,null==r?f(o):r,o.__h),S(n,o),o.__e!=r&&p(o)))}))}function _(t,e,n,i,o,a,l,c,d,p){var g,m,_,w,b,C,E,S=i&&i.__k||s,x=S.length;for(n.__k=[],g=0;g<e.length;g++)if(null!=(w=n.__k[g]=null==(w=e[g])||"boolean"==typeof w?null:"string"==typeof w||"number"==typeof w||"bigint"==typeof w?h(null,w,null,null,w):Array.isArray(w)?h(u,{children:w},null,null,null):w.__b>0?h(w.type,w.props,w.key,null,w.__v):w)){if(w.__=n,w.__b=n.__b+1,null===(_=S[g])||_&&w.key==_.key&&w.type===_.type)S[g]=void 0;else for(m=0;m<x;m++){if((_=S[m])&&w.key==_.key&&w.type===_.type){S[m]=void 0;break}_=null}T(t,w,_=_||r,o,a,l,c,d,p),b=w.__e,(m=w.ref)&&_.ref!=m&&(E||(E=[]),_.ref&&E.push(_.ref,null,w),E.push(m,w.__c||b,w)),null!=b?(null==C&&(C=b),"function"==typeof w.type&&null!=w.__k&&w.__k===_.__k?w.__d=d=v(w,d,t):d=y(t,w,_,S,b,d),p||"option"!==n.type?"function"==typeof n.type&&(n.__d=d):t.value=""):d&&_.__e==d&&d.parentNode!=t&&(d=f(_))}for(n.__e=C,g=x;g--;)null!=S[g]&&("function"==typeof n.type&&null!=S[g].__e&&S[g].__e==n.__d&&(n.__d=f(i,g+1)),k(S[g],S[g]));if(E)for(g=0;g<E.length;g++)A(E[g],E[++g],E[++g])}function v(t,e,n){var i,o;for(i=0;i<t.__k.length;i++)(o=t.__k[i])&&(o.__=t,e="function"==typeof o.type?v(o,e,n):y(n,o,o,t.__k,o.__e,e));return e}function y(t,e,n,i,o,r){var s,a,l;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==n||o!=r||null==o.parentNode)t:if(null==r||r.parentNode!==t)t.appendChild(o),s=null;else{for(a=r,l=0;(a=a.nextSibling)&&l<i.length;l+=2)if(a==o)break t;t.insertBefore(o,r),s=r}return void 0!==s?s:o.nextSibling}function w(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||a.test(e)?n:n+"px"}function b(t,e,n,i,o){var r;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||w(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||w(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?i||t.addEventListener(e,r?E:C,r):t.removeEventListener(e,r?E:C,r);else if("dangerouslySetInnerHTML"!==e){if(o)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function C(t){this.l[t.type+!1](e.event?e.event(t):t)}function E(t){this.l[t.type+!0](e.event?e.event(t):t)}function T(t,n,i,o,r,s,a,c,h){var f,p,g,m,v,y,w,b,C,E,T,S=n.type;if(void 0!==n.constructor)return null;null!=i.__h&&(h=i.__h,c=n.__e=i.__e,n.__h=null,s=[c]),(f=e.__b)&&f(n);try{t:if("function"==typeof S){if(b=n.props,C=(f=S.contextType)&&o[f.__c],E=f?C?C.props.value:f.__:o,i.__c?w=(p=n.__c=i.__c).__=p.__E:("prototype"in S&&S.prototype.render?n.__c=p=new S(b,E):(n.__c=p=new d(b,E),p.constructor=S,p.render=L),C&&C.sub(p),p.props=b,p.state||(p.state={}),p.context=E,p.__n=o,g=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=S.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=l({},p.__s)),l(p.__s,S.getDerivedStateFromProps(b,p.__s))),m=p.props,v=p.state,g)null==S.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==S.getDerivedStateFromProps&&b!==m&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(b,E),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(b,p.__s,E)||n.__v===i.__v){p.props=b,p.state=p.__s,n.__v!==i.__v&&(p.__d=!1),p.__v=n,n.__e=i.__e,n.__k=i.__k,n.__k.forEach((function(t){t&&(t.__=n)})),p.__h.length&&a.push(p);break t}null!=p.componentWillUpdate&&p.componentWillUpdate(b,p.__s,E),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(m,v,y)}))}p.context=E,p.props=b,p.state=p.__s,(f=e.__r)&&f(n),p.__d=!1,p.__v=n,p.__P=t,f=p.render(p.props,p.state,p.context),p.state=p.__s,null!=p.getChildContext&&(o=l(l({},o),p.getChildContext())),g||null==p.getSnapshotBeforeUpdate||(y=p.getSnapshotBeforeUpdate(m,v)),T=null!=f&&f.type===u&&null==f.key?f.props.children:f,_(t,Array.isArray(T)?T:[T],n,i,o,r,s,a,c,h),p.base=n.__e,n.__h=null,p.__h.length&&a.push(p),w&&(p.__E=p.__=null),p.__e=!1}else null==s&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=x(i.__e,n,i,o,r,s,a,h);(f=e.diffed)&&f(n)}catch(t){n.__v=null,(h||null!=s)&&(n.__e=c,n.__h=!!h,s[s.indexOf(c)]=null),e.__e(t,n,i)}}function S(t,n){e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function x(t,e,n,i,o,a,l,h){var u,d,f,p,g=n.props,m=e.props,v=e.type,y=0;if("svg"===v&&(o=!0),null!=a)for(;y<a.length;y++)if((u=a[y])&&(u===t||(v?u.localName==v:3==u.nodeType))){t=u,a[y]=null;break}if(null==t){if(null===v)return document.createTextNode(m);t=o?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,m.is&&m),a=null,h=!1}if(null===v)g===m||h&&t.data===m||(t.data=m);else{if(a=a&&s.slice.call(t.childNodes),d=(g=n.props||r).dangerouslySetInnerHTML,f=m.dangerouslySetInnerHTML,!h){if(null!=a)for(g={},p=0;p<t.attributes.length;p++)g[t.attributes[p].name]=t.attributes[p].value;(f||d)&&(f&&(d&&f.__html==d.__html||f.__html===t.innerHTML)||(t.innerHTML=f&&f.__html||""))}if(function(t,e,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in e||b(t,r,null,n[r],i);for(r in e)o&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||b(t,r,e[r],n[r],i)}(t,m,g,o,h),f)e.__k=[];else if(y=e.props.children,_(t,Array.isArray(y)?y:[y],e,n,i,o&&"foreignObject"!==v,a,l,t.firstChild,h),null!=a)for(y=a.length;y--;)null!=a[y]&&c(a[y]);h||("value"in m&&void 0!==(y=m.value)&&(y!==t.value||"progress"===v&&!y)&&b(t,"value",y,g.value,!1),"checked"in m&&void 0!==(y=m.checked)&&y!==t.checked&&b(t,"checked",y,g.checked,!1))}return t}function A(t,n,i){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,i)}}function k(t,n,i){var o,r,s;if(e.unmount&&e.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||A(o,null,n)),i||"function"==typeof t.type||(i=null!=(r=t.__e)),t.__e=t.__d=void 0,null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){e.__e(t,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&k(o[s],n,i);null!=r&&c(r)}function L(t,e,n){return this.constructor(t,n)}function N(t,n,i){var o,a,l;e.__&&e.__(t,n),a=(o="function"==typeof i)?null:i&&i.__k||n.__k,l=[],T(n,t=(!o&&i||n).__k=function(t,e,n){var i,o,r,s=arguments,a={};for(r in e)"key"==r?i=e[r]:"ref"==r?o=e[r]:a[r]=e[r];if(arguments.length>3)for(n=[n],r=3;r<arguments.length;r++)n.push(s[r]);if(null!=n&&(a.children=n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===a[r]&&(a[r]=t.defaultProps[r]);return h(t,a,i,o,null)}(u,null,[t]),a||r,r,void 0!==n.ownerSVGElement,!o&&i?[i]:a?null:n.firstChild?s.slice.call(n.childNodes):null,l,!o&&i?i:a?a.__e:n.firstChild,o),S(l,t)}e={__e:function(t,e){for(var n,i,o;e=e.__;)if((n=e.__c)&&!n.__)try{if((i=n.constructor)&&null!=i.getDerivedStateFromError&&(n.setState(i.getDerivedStateFromError(t)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(t),o=n.__d),o)return n.__E=n}catch(e){t=e}throw t},__v:0},d.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=l({},this.state),"function"==typeof t&&(t=t(l({},n),this.props)),t&&l(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),g(this))},d.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),g(this))},d.prototype.render=u,n=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,m.__r=0,"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.5.13",e,{Fragment:u,Component:d});var R={};function M(t){return t.type===u?"Fragment":"function"==typeof t.type?t.type.displayName||t.type.name:"string"==typeof t.type?t.type:"#text"}var O=[],P=[];function I(){return O.length>0?O[O.length-1]:null}var D=!1;function V(t){return"function"==typeof t.type&&t.type!=u}function H(t){for(var e=[t],n=t;null!=n.__o;)e.push(n.__o),n=n.__o;return e.reduce((function(t,e){t+=" in "+M(e);var n=e.__source;return n?t+=" (at "+n.fileName+":"+n.lineNumber+")":D||(D=!0,console.warn("Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.")),t+"\n"}),"")}var F="function"==typeof WeakMap,B=d.prototype.setState;d.prototype.setState=function(t,e){return null==this.__v?null==this.state&&console.warn('Calling "this.setState" inside the constructor of a component is a no-op and might be a bug in your application. Instead, set "this.state = {}" directly.\n\n'+H(I())):null==this.__P&&console.warn('Can\'t call "this.setState" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+H(this.__v)),B.call(this,t,e)};var U=d.prototype.forceUpdate;function q(t){var e=t.props,n=M(t),i="";for(var o in e)if(e.hasOwnProperty(o)&&"children"!==o){var r=e[o];"function"==typeof r&&(r="function "+(r.displayName||r.name)+"() {}"),r=Object(r)!==r||r.toString?r+"":Object.prototype.toString.call(r),i+=" "+o+"="+JSON.stringify(r)}var s=e.children;return"<"+n+i+(s&&s.length?">..</"+n+">":" />")}d.prototype.forceUpdate=function(t){return null==this.__v?console.warn('Calling "this.forceUpdate" inside the constructor of a component is a no-op and might be a bug in your application.\n\n'+H(I())):null==this.__P&&console.warn('Can\'t call "this.forceUpdate" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+H(this.__v)),U.call(this,t)},function(){!function(){var t=e.__b,n=e.diffed,i=e.__,o=e.vnode,r=e.__r;e.diffed=function(t){V(t)&&P.pop(),O.pop(),n&&n(t)},e.__b=function(e){V(e)&&O.push(e),t&&t(e)},e.__=function(t,e){P=[],i&&i(t,e)},e.vnode=function(t){t.__o=P.length>0?P[P.length-1]:null,o&&o(t)},e.__r=function(t){V(t)&&P.push(t),r&&r(t)}}();var t=!1,n=e.__b,i=e.diffed,o=e.vnode,r=e.__e,s=e.__,a=e.__h,l=F?{useEffect:new WeakMap,useLayoutEffect:new WeakMap,lazyPropTypes:new WeakMap}:null,c=[];e.__e=function(t,e,n){if(e&&e.__c&&"function"==typeof t.then){var i=t;t=new Error("Missing Suspense. The throwing component was: "+M(e));for(var o=e;o;o=o.__)if(o.__c&&o.__c.__c){t=i;break}if(t instanceof Error)throw t}try{r(t,e,n),"function"!=typeof t.then&&setTimeout((function(){throw t}))}catch(t){throw t}},e.__=function(t,e){if(!e)throw new Error("Undefined parent passed to render(), this is the second argument.\nCheck if the element is available in the DOM/has the correct id.");var n;switch(e.nodeType){case 1:case 11:case 9:n=!0;break;default:n=!1}if(!n){var i=M(t);throw new Error("Expected a valid HTML node as a second argument to render.\tReceived "+e+" instead: render(<"+i+" />, "+e+");")}s&&s(t,e)},e.__b=function(e){var i=e.type,o=function t(e){return e?"function"==typeof e.type?t(e.__):e:{}}(e.__);if(t=!0,void 0===i)throw new Error("Undefined component passed to createElement()\n\nYou likely forgot to export your component or might have mixed up default and named imports"+q(e)+"\n\n"+H(e));if(null!=i&&"object"==typeof i){if(void 0!==i.__k&&void 0!==i.__e)throw new Error("Invalid type passed to createElement(): "+i+"\n\nDid you accidentally pass a JSX literal as JSX twice?\n\n let My"+M(e)+" = "+q(i)+";\n let vnode = <My"+M(e)+" />;\n\nThis usually happens when you export a JSX literal and not the component.\n\n"+H(e));throw new Error("Invalid type passed to createElement(): "+(Array.isArray(i)?"array":i))}if("thead"!==i&&"tfoot"!==i&&"tbody"!==i||"table"===o.type?"tr"===i&&"thead"!==o.type&&"tfoot"!==o.type&&"tbody"!==o.type&&"table"!==o.type?console.error("Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot/table> parent."+q(e)+"\n\n"+H(e)):"td"===i&&"tr"!==o.type?console.error("Improper nesting of table. Your <td> should have a <tr> parent."+q(e)+"\n\n"+H(e)):"th"===i&&"tr"!==o.type&&console.error("Improper nesting of table. Your <th> should have a <tr>."+q(e)+"\n\n"+H(e)):console.error("Improper nesting of table. Your <thead/tbody/tfoot> should have a <table> parent."+q(e)+"\n\n"+H(e)),void 0!==e.ref&&"function"!=typeof e.ref&&"object"!=typeof e.ref&&!("$$typeof"in e))throw new Error('Component\'s "ref" property should be a function, or an object created by createRef(), but got ['+typeof e.ref+"] instead\n"+q(e)+"\n\n"+H(e));if("string"==typeof e.type)for(var r in e.props)if("o"===r[0]&&"n"===r[1]&&"function"!=typeof e.props[r]&&null!=e.props[r])throw new Error("Component's \""+r+'" property should be a function, but got ['+typeof e.props[r]+"] instead\n"+q(e)+"\n\n"+H(e));if("function"==typeof e.type&&e.type.propTypes){if("Lazy"===e.type.displayName&&l&&!l.lazyPropTypes.has(e.type)){var s="PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ";try{var a=e.type();l.lazyPropTypes.set(e.type,!0),console.warn(s+"Component wrapped in lazy() is "+M(a))}catch(e){console.warn(s+"We will log the wrapped component's name once it is loaded.")}}var c=e.props;e.type.__f&&delete(c=function(t,e){for(var n in e)t[n]=e[n];return t}({},c)).ref,function(t,e,n,i,o){Object.keys(t).forEach((function(n){var r;try{r=t[n](e,n,i,"prop",null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){r=t}!r||r.message in R||(R[r.message]=!0,console.error("Failed prop type: "+r.message+(o&&"\n"+o()||"")))}))}(e.type.propTypes,c,0,M(e),(function(){return H(e)}))}n&&n(e)},e.__h=function(e,n,i){if(!e||!t)throw new Error("Hook can only be invoked from render methods.");a&&a(e,n,i)};var h=function(t,e){return{get:function(){var n="get"+t+e;c&&c.indexOf(n)<0&&(c.push(n),console.warn("getting vnode."+t+" is deprecated, "+e))},set:function(){var n="set"+t+e;c&&c.indexOf(n)<0&&(c.push(n),console.warn("setting vnode."+t+" is not allowed, "+e))}}},u={nodeName:h("nodeName","use vnode.type"),attributes:h("attributes","use vnode.props"),children:h("children","use vnode.props.children")},d=Object.create({},u);e.vnode=function(t){var e=t.props;if(null!==t.type&&null!=e&&("__source"in e||"__self"in e)){var n=t.props={};for(var i in e){var r=e[i];"__source"===i?t.__source=r:"__self"===i?t.__self=r:n[i]=r}}t.__proto__=d,o&&o(t)},e.diffed=function(e){if(e.__k&&e.__k.forEach((function(t){if(t&&void 0===t.type){delete t.__,delete t.__b;var n=Object.keys(t).join(",");throw new Error("Objects are not valid as a child. Encountered an object with the keys {"+n+"}.\n\n"+H(e))}})),t=!1,i&&i(e),null!=e.__k)for(var n=[],o=0;o<e.__k.length;o++){var r=e.__k[o];if(r&&null!=r.key){var s=r.key;if(-1!==n.indexOf(s)){console.error('Following component has two or more children with the same key attribute: "'+s+'". This may cause glitches and misbehavior in rendering process. Component: \n\n'+q(e)+"\n\n"+H(e));break}n.push(s)}}}}();var W,j={exports:{}};
1
+ var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(){function t(t){var e=!0,n=!1,i=null,o={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function r(t){return!!(t&&t!==document&&"HTML"!==t.nodeName&&"BODY"!==t.nodeName&&"classList"in t&&"contains"in t.classList)}function s(t){var e=t.type,n=t.tagName;return!("INPUT"!==n||!o[e]||t.readOnly)||"TEXTAREA"===n&&!t.readOnly||!!t.isContentEditable}function a(t){t.classList.contains("focus-visible")||(t.classList.add("focus-visible"),t.setAttribute("data-focus-visible-added",""))}function l(t){t.hasAttribute("data-focus-visible-added")&&(t.classList.remove("focus-visible"),t.removeAttribute("data-focus-visible-added"))}function c(n){n.metaKey||n.altKey||n.ctrlKey||(r(t.activeElement)&&a(t.activeElement),e=!0)}function h(t){e=!1}function u(t){r(t.target)&&(e||s(t.target))&&a(t.target)}function d(t){r(t.target)&&(t.target.classList.contains("focus-visible")||t.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(i),i=window.setTimeout((function(){n=!1}),100),l(t.target))}function f(t){"hidden"===document.visibilityState&&(n&&(e=!0),p())}function p(){document.addEventListener("mousemove",m),document.addEventListener("mousedown",m),document.addEventListener("mouseup",m),document.addEventListener("pointermove",m),document.addEventListener("pointerdown",m),document.addEventListener("pointerup",m),document.addEventListener("touchmove",m),document.addEventListener("touchstart",m),document.addEventListener("touchend",m)}function g(){document.removeEventListener("mousemove",m),document.removeEventListener("mousedown",m),document.removeEventListener("mouseup",m),document.removeEventListener("pointermove",m),document.removeEventListener("pointerdown",m),document.removeEventListener("pointerup",m),document.removeEventListener("touchmove",m),document.removeEventListener("touchstart",m),document.removeEventListener("touchend",m)}function m(t){t.target.nodeName&&"html"===t.target.nodeName.toLowerCase()||(e=!1,g())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",h,!0),document.addEventListener("pointerdown",h,!0),document.addEventListener("touchstart",h,!0),document.addEventListener("visibilitychange",f,!0),p(),t.addEventListener("focus",u,!0),t.addEventListener("blur",d,!0),t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host?t.host.setAttribute("data-js-focus-visible",""):t.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var e;window.applyFocusVisiblePolyfill=t;try{e=new CustomEvent("focus-visible-polyfill-ready")}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(e)}"undefined"!=typeof document&&t(document)}();var e,n,i,o,r,s,a={},l=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function d(t,e,o,r,s){var a={type:t,props:e,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++i:s};return null==s&&null!=n.vnode&&n.vnode(a),a}function f(t){return t.children}function p(t,e){this.props=t,this.context=e}function g(t,e){if(null==e)return t.__?g(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?g(t):null}function m(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return m(t)}}function _(t){(!t.__d&&(t.__d=!0)&&o.push(t)&&!v.__r++||s!==n.debounceRendering)&&((s=n.debounceRendering)||r)(v)}function v(){for(var t;v.__r=o.length;)t=o.sort((function(t,e){return t.__v.__b-e.__v.__b})),o=[],t.some((function(t){var e,n,i,o,r,s;t.__d&&(r=(o=(e=t).__v).__e,(s=e.__P)&&(n=[],(i=h({},o)).__v=o.__v+1,x(s,o,i,e.__n,void 0!==s.ownerSVGElement,null!=o.__h?[r]:null,n,null==r?g(o):r,o.__h),A(n,o),o.__e!=r&&m(o)))}))}function y(t,e,n,i,o,r,s,c,h,u){var p,m,_,v,y,C,E,T=i&&i.__k||l,S=T.length;for(n.__k=[],p=0;p<e.length;p++)if(null!=(v=n.__k[p]=null==(v=e[p])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?d(null,v,null,null,v):Array.isArray(v)?d(f,{children:v},null,null,null):v.__b>0?d(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(_=T[p])||_&&v.key==_.key&&v.type===_.type)T[p]=void 0;else for(m=0;m<S;m++){if((_=T[m])&&v.key==_.key&&v.type===_.type){T[m]=void 0;break}_=null}x(t,v,_=_||a,o,r,s,c,h,u),y=v.__e,(m=v.ref)&&_.ref!=m&&(E||(E=[]),_.ref&&E.push(_.ref,null,v),E.push(m,v.__c||y,v)),null!=y?(null==C&&(C=y),"function"==typeof v.type&&v.__k===_.__k?v.__d=h=w(v,h,t):h=b(t,v,_,T,y,h),"function"==typeof n.type&&(n.__d=h)):h&&_.__e==h&&h.parentNode!=t&&(h=g(_))}for(n.__e=C,p=S;p--;)null!=T[p]&&("function"==typeof n.type&&null!=T[p].__e&&T[p].__e==n.__d&&(n.__d=g(i,p+1)),N(T[p],T[p]));if(E)for(p=0;p<E.length;p++)L(E[p],E[++p],E[++p])}function w(t,e,n){for(var i,o=t.__k,r=0;o&&r<o.length;r++)(i=o[r])&&(i.__=t,e="function"==typeof i.type?w(i,e,n):b(n,i,i,o,i.__e,e));return e}function b(t,e,n,i,o,r){var s,a,l;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==n||o!=r||null==o.parentNode)t:if(null==r||r.parentNode!==t)t.appendChild(o),s=null;else{for(a=r,l=0;(a=a.nextSibling)&&l<i.length;l+=2)if(a==o)break t;t.insertBefore(o,r),s=r}return void 0!==s?s:o.nextSibling}function C(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||c.test(e)?n:n+"px"}function E(t,e,n,i,o){var r;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||C(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||C(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?i||t.addEventListener(e,r?S:T,r):t.removeEventListener(e,r?S:T,r);else if("dangerouslySetInnerHTML"!==e){if(o)e=e.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function T(t){this.l[t.type+!1](n.event?n.event(t):t)}function S(t){this.l[t.type+!0](n.event?n.event(t):t)}function x(t,e,i,o,r,s,a,l,c){var u,d,g,m,_,v,w,b,C,E,T,S=e.type;if(void 0!==e.constructor)return null;null!=i.__h&&(c=i.__h,l=e.__e=i.__e,e.__h=null,s=[l]),(u=n.__b)&&u(e);try{t:if("function"==typeof S){if(b=e.props,C=(u=S.contextType)&&o[u.__c],E=u?C?C.props.value:u.__:o,i.__c?w=(d=e.__c=i.__c).__=d.__E:("prototype"in S&&S.prototype.render?e.__c=d=new S(b,E):(e.__c=d=new p(b,E),d.constructor=S,d.render=R),C&&C.sub(d),d.props=b,d.state||(d.state={}),d.context=E,d.__n=o,g=d.__d=!0,d.__h=[]),null==d.__s&&(d.__s=d.state),null!=S.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=h({},d.__s)),h(d.__s,S.getDerivedStateFromProps(b,d.__s))),m=d.props,_=d.state,g)null==S.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==S.getDerivedStateFromProps&&b!==m&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(b,E),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(b,d.__s,E)||e.__v===i.__v){d.props=b,d.state=d.__s,e.__v!==i.__v&&(d.__d=!1),d.__v=e,e.__e=i.__e,e.__k=i.__k,e.__k.forEach((function(t){t&&(t.__=e)})),d.__h.length&&a.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(b,d.__s,E),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(m,_,v)}))}d.context=E,d.props=b,d.state=d.__s,(u=n.__r)&&u(e),d.__d=!1,d.__v=e,d.__P=t,u=d.render(d.props,d.state,d.context),d.state=d.__s,null!=d.getChildContext&&(o=h(h({},o),d.getChildContext())),g||null==d.getSnapshotBeforeUpdate||(v=d.getSnapshotBeforeUpdate(m,_)),T=null!=u&&u.type===f&&null==u.key?u.props.children:u,y(t,Array.isArray(T)?T:[T],e,i,o,r,s,a,l,c),d.base=e.__e,e.__h=null,d.__h.length&&a.push(d),w&&(d.__E=d.__=null),d.__e=!1}else null==s&&e.__v===i.__v?(e.__k=i.__k,e.__e=i.__e):e.__e=k(i.__e,e,i,o,r,s,a,c);(u=n.diffed)&&u(e)}catch(t){e.__v=null,(c||null!=s)&&(e.__e=l,e.__h=!!c,s[s.indexOf(l)]=null),n.__e(t,e,i)}}function A(t,e){n.__c&&n.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){n.__e(t,e.__v)}}))}function k(t,n,i,o,r,s,l,c){var h,d,f,p=i.props,m=n.props,_=n.type,v=0;if("svg"===_&&(r=!0),null!=s)for(;v<s.length;v++)if((h=s[v])&&(h===t||(_?h.localName==_:3==h.nodeType))){t=h,s[v]=null;break}if(null==t){if(null===_)return document.createTextNode(m);t=r?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,m.is&&m),s=null,c=!1}if(null===_)p===m||c&&t.data===m||(t.data=m);else{if(s=s&&e.call(t.childNodes),d=(p=i.props||a).dangerouslySetInnerHTML,f=m.dangerouslySetInnerHTML,!c){if(null!=s)for(p={},v=0;v<t.attributes.length;v++)p[t.attributes[v].name]=t.attributes[v].value;(f||d)&&(f&&(d&&f.__html==d.__html||f.__html===t.innerHTML)||(t.innerHTML=f&&f.__html||""))}if(function(t,e,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in e||E(t,r,null,n[r],i);for(r in e)o&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||E(t,r,e[r],n[r],i)}(t,m,p,r,c),f)n.__k=[];else if(v=n.props.children,y(t,Array.isArray(v)?v:[v],n,i,o,r&&"foreignObject"!==_,s,l,s?s[0]:i.__k&&g(i,0),c),null!=s)for(v=s.length;v--;)null!=s[v]&&u(s[v]);c||("value"in m&&void 0!==(v=m.value)&&(v!==t.value||"progress"===_&&!v)&&E(t,"value",v,p.value,!1),"checked"in m&&void 0!==(v=m.checked)&&v!==t.checked&&E(t,"checked",v,p.checked,!1))}return t}function L(t,e,i){try{"function"==typeof t?t(e):t.current=e}catch(t){n.__e(t,i)}}function N(t,e,i){var o,r;if(n.unmount&&n.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||L(o,null,e)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){n.__e(t,e)}o.base=o.__P=null}if(o=t.__k)for(r=0;r<o.length;r++)o[r]&&N(o[r],e,"function"!=typeof t.type);i||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function R(t,e,n){return this.constructor(t,n)}function M(t,i,o){var r,s,l;n.__&&n.__(t,i),s=(r="function"==typeof o)?null:o&&o.__k||i.__k,l=[],x(i,t=(!r&&o||i).__k=function(t,n,i){var o,r,s,a={};for(s in n)"key"==s?o=n[s]:"ref"==s?r=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return d(t,a,o,r,null)}(f,null,[t]),s||a,a,void 0!==i.ownerSVGElement,!r&&o?[o]:s?null:i.firstChild?e.call(i.childNodes):null,l,!r&&o?o:s?s.__e:i.firstChild,r),A(l,t)}e=l.slice,n={__e:function(t,e){for(var n,i,o;e=e.__;)if((n=e.__c)&&!n.__)try{if((i=n.constructor)&&null!=i.getDerivedStateFromError&&(n.setState(i.getDerivedStateFromError(t)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(t),o=n.__d),o)return n.__E=n}catch(e){t=e}throw t}},i=0,p.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof t&&(t=t(h({},n),this.props)),t&&h(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),_(this))},p.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),_(this))},p.prototype.render=f,o=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,v.__r=0,"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.5.15",n,{Fragment:f,Component:p});var O={};function P(t){return t.type===f?"Fragment":"function"==typeof t.type?t.type.displayName||t.type.name:"string"==typeof t.type?t.type:"#text"}var I=[],D=[];function V(){return I.length>0?I[I.length-1]:null}var H=!1;function F(t){return"function"==typeof t.type&&t.type!=f}function B(t){for(var e=[t],n=t;null!=n.__o;)e.push(n.__o),n=n.__o;return e.reduce((function(t,e){t+=" in "+P(e);var n=e.__source;return n?t+=" (at "+n.fileName+":"+n.lineNumber+")":H||(H=!0,console.warn("Add @babel/plugin-transform-react-jsx-source to get a more detailed component stack. Note that you should not add it to production builds of your App for bundle size reasons.")),t+"\n"}),"")}var U="function"==typeof WeakMap,q=p.prototype.setState;p.prototype.setState=function(t,e){return null==this.__v?null==this.state&&console.warn('Calling "this.setState" inside the constructor of a component is a no-op and might be a bug in your application. Instead, set "this.state = {}" directly.\n\n'+B(V())):null==this.__P&&console.warn('Can\'t call "this.setState" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+B(this.__v)),q.call(this,t,e)};var W=p.prototype.forceUpdate;function j(t){var e=t.props,n=P(t),i="";for(var o in e)if(e.hasOwnProperty(o)&&"children"!==o){var r=e[o];"function"==typeof r&&(r="function "+(r.displayName||r.name)+"() {}"),r=Object(r)!==r||r.toString?r+"":Object.prototype.toString.call(r),i+=" "+o+"="+JSON.stringify(r)}var s=e.children;return"<"+n+i+(s&&s.length?">..</"+n+">":" />")}p.prototype.forceUpdate=function(t){return null==this.__v?console.warn('Calling "this.forceUpdate" inside the constructor of a component is a no-op and might be a bug in your application.\n\n'+B(V())):null==this.__P&&console.warn('Can\'t call "this.forceUpdate" on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.\n\n'+B(this.__v)),W.call(this,t)},function(){!function(){var t=n.__b,e=n.diffed,i=n.__,o=n.vnode,r=n.__r;n.diffed=function(t){F(t)&&D.pop(),I.pop(),e&&e(t)},n.__b=function(e){F(e)&&I.push(e),t&&t(e)},n.__=function(t,e){D=[],i&&i(t,e)},n.vnode=function(t){t.__o=D.length>0?D[D.length-1]:null,o&&o(t)},n.__r=function(t){F(t)&&D.push(t),r&&r(t)}}();var t=!1,e=n.__b,i=n.diffed,o=n.vnode,r=n.__e,s=n.__,a=n.__h,l=U?{useEffect:new WeakMap,useLayoutEffect:new WeakMap,lazyPropTypes:new WeakMap}:null,c=[];n.__e=function(t,e,n){if(e&&e.__c&&"function"==typeof t.then){var i=t;t=new Error("Missing Suspense. The throwing component was: "+P(e));for(var o=e;o;o=o.__)if(o.__c&&o.__c.__c){t=i;break}if(t instanceof Error)throw t}try{r(t,e,n),"function"!=typeof t.then&&setTimeout((function(){throw t}))}catch(t){throw t}},n.__=function(t,e){if(!e)throw new Error("Undefined parent passed to render(), this is the second argument.\nCheck if the element is available in the DOM/has the correct id.");var n;switch(e.nodeType){case 1:case 11:case 9:n=!0;break;default:n=!1}if(!n){var i=P(t);throw new Error("Expected a valid HTML node as a second argument to render.\tReceived "+e+" instead: render(<"+i+" />, "+e+");")}s&&s(t,e)},n.__b=function(n){var i=n.type,o=function t(e){return e?"function"==typeof e.type?t(e.__):e:{}}(n.__);if(t=!0,void 0===i)throw new Error("Undefined component passed to createElement()\n\nYou likely forgot to export your component or might have mixed up default and named imports"+j(n)+"\n\n"+B(n));if(null!=i&&"object"==typeof i){if(void 0!==i.__k&&void 0!==i.__e)throw new Error("Invalid type passed to createElement(): "+i+"\n\nDid you accidentally pass a JSX literal as JSX twice?\n\n let My"+P(n)+" = "+j(i)+";\n let vnode = <My"+P(n)+" />;\n\nThis usually happens when you export a JSX literal and not the component.\n\n"+B(n));throw new Error("Invalid type passed to createElement(): "+(Array.isArray(i)?"array":i))}if("thead"!==i&&"tfoot"!==i&&"tbody"!==i||"table"===o.type?"tr"===i&&"thead"!==o.type&&"tfoot"!==o.type&&"tbody"!==o.type&&"table"!==o.type?console.error("Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot/table> parent."+j(n)+"\n\n"+B(n)):"td"===i&&"tr"!==o.type?console.error("Improper nesting of table. Your <td> should have a <tr> parent."+j(n)+"\n\n"+B(n)):"th"===i&&"tr"!==o.type&&console.error("Improper nesting of table. Your <th> should have a <tr>."+j(n)+"\n\n"+B(n)):console.error("Improper nesting of table. Your <thead/tbody/tfoot> should have a <table> parent."+j(n)+"\n\n"+B(n)),void 0!==n.ref&&"function"!=typeof n.ref&&"object"!=typeof n.ref&&!("$$typeof"in n))throw new Error('Component\'s "ref" property should be a function, or an object created by createRef(), but got ['+typeof n.ref+"] instead\n"+j(n)+"\n\n"+B(n));if("string"==typeof n.type)for(var r in n.props)if("o"===r[0]&&"n"===r[1]&&"function"!=typeof n.props[r]&&null!=n.props[r])throw new Error("Component's \""+r+'" property should be a function, but got ['+typeof n.props[r]+"] instead\n"+j(n)+"\n\n"+B(n));if("function"==typeof n.type&&n.type.propTypes){if("Lazy"===n.type.displayName&&l&&!l.lazyPropTypes.has(n.type)){var s="PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ";try{var a=n.type();l.lazyPropTypes.set(n.type,!0),console.warn(s+"Component wrapped in lazy() is "+P(a))}catch(n){console.warn(s+"We will log the wrapped component's name once it is loaded.")}}var c=n.props;n.type.__f&&delete(c=function(t,e){for(var n in e)t[n]=e[n];return t}({},c)).ref,function(t,e,n,i,o){Object.keys(t).forEach((function(n){var r;try{r=t[n](e,n,i,"prop",null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){r=t}!r||r.message in O||(O[r.message]=!0,console.error("Failed prop type: "+r.message+(o&&"\n"+o()||"")))}))}(n.type.propTypes,c,0,P(n),(function(){return B(n)}))}e&&e(n)},n.__h=function(e,n,i){if(!e||!t)throw new Error("Hook can only be invoked from render methods.");a&&a(e,n,i)};var h=function(t,e){return{get:function(){var n="get"+t+e;c&&c.indexOf(n)<0&&(c.push(n),console.warn("getting vnode."+t+" is deprecated, "+e))},set:function(){var n="set"+t+e;c&&c.indexOf(n)<0&&(c.push(n),console.warn("setting vnode."+t+" is not allowed, "+e))}}},u={nodeName:h("nodeName","use vnode.type"),attributes:h("attributes","use vnode.props"),children:h("children","use vnode.props.children")},d=Object.create({},u);n.vnode=function(t){var e=t.props;if(null!==t.type&&null!=e&&("__source"in e||"__self"in e)){var n=t.props={};for(var i in e){var r=e[i];"__source"===i?t.__source=r:"__self"===i?t.__self=r:n[i]=r}}t.__proto__=d,o&&o(t)},n.diffed=function(e){if(e.__k&&e.__k.forEach((function(t){if(t&&void 0===t.type){delete t.__,delete t.__b;var n=Object.keys(t).join(",");throw new Error("Objects are not valid as a child. Encountered an object with the keys {"+n+"}.\n\n"+B(e))}})),t=!1,i&&i(e),null!=e.__k)for(var n=[],o=0;o<e.__k.length;o++){var r=e.__k[o];if(r&&null!=r.key){var s=r.key;if(-1!==n.indexOf(s)){console.error('Following component has two or more children with the same key attribute: "'+s+'". This may cause glitches and misbehavior in rendering process. Component: \n\n'+j(e)+"\n\n"+B(e));break}n.push(s)}}}}();var $,z={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
- */W=j,function(){var t={}.hasOwnProperty;function e(){for(var n=[],i=0;i<arguments.length;i++){var o=arguments[i];if(o){var r=typeof o;if("string"===r||"number"===r)n.push(o);else if(Array.isArray(o)){if(o.length){var s=e.apply(null,o);s&&n.push(s)}}else if("object"===r)if(o.toString===Object.prototype.toString)for(var a in o)t.call(o,a)&&o[a]&&n.push(a);else n.push(o.toString())}}return n.join(" ")}W.exports?(e.default=e,W.exports=e):window.classNames=e}();var $,z,X,Y=j.exports,G=0,Z=[],K=e.__b,J=e.__r,Q=e.diffed,tt=e.__c,et=e.unmount;function nt(t,n){e.__h&&e.__h(z,t,G||n),G=0;var i=z.__H||(z.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function it(t){return G=1,function(t,e,n){var i=nt($++,2);return i.t=t,i.__c||(i.__=[n?n(e):ut(void 0,e),function(t){var e=i.t(i.__[0],t);i.__[0]!==e&&(i.__=[e,i.__[1]],i.__c.setState({}))}],i.__c=z),i.__}(ut,t)}function ot(t,n){var i=nt($++,3);!e.__s&&ht(i.__H,n)&&(i.__=t,i.__H=n,z.__H.__h.push(i))}function rt(t){return G=5,function(t,e){var n=nt($++,7);return ht(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}((function(){return{current:t}}),[])}function st(){Z.forEach((function(t){if(t.__P)try{t.__H.__h.forEach(lt),t.__H.__h.forEach(ct),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}})),Z=[]}e.__b=function(t){z=null,K&&K(t)},e.__r=function(t){J&&J(t),$=0;var e=(z=t.__c).__H;e&&(e.__h.forEach(lt),e.__h.forEach(ct),e.__h=[])},e.diffed=function(t){Q&&Q(t);var n=t.__c;n&&n.__H&&n.__H.__h.length&&(1!==Z.push(n)&&X===e.requestAnimationFrame||((X=e.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),at&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);at&&(e=requestAnimationFrame(n))})(st)),z=void 0},e.__c=function(t,n){n.some((function(t){try{t.__h.forEach(lt),t.__h=t.__h.filter((function(t){return!t.__||ct(t)}))}catch(i){n.some((function(t){t.__h&&(t.__h=[])})),n=[],e.__e(i,t.__v)}})),tt&&tt(t,n)},e.unmount=function(t){et&&et(t);var n=t.__c;if(n&&n.__H)try{n.__H.__.forEach(lt)}catch(t){e.__e(t,n.__v)}};var at="function"==typeof requestAnimationFrame;function lt(t){var e=z;"function"==typeof t.__c&&t.__c(),z=e}function ct(t){var e=z;t.__c=t.__(),z=e}function ht(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function ut(t,e){return"function"==typeof e?e(t):e}function dt(t,n,i,o,r){var s={};for(var a in n)"ref"!=a&&(s[a]=n[a]);var l,c,h={type:t,props:s,key:i,ref:n&&n.ref,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:++e.__v,__source:o,__self:r};if("function"==typeof t&&(l=t.defaultProps))for(c in l)void 0===s[c]&&(s[c]=l[c]);return e.vnode&&e.vnode(h),h}const ft=new Map;function pt({name:t,className:n="",inline:i=!1,title:o=""}){const r=ft.get(t);if(!r)throw new Error(`Icon "${t.toString()}" is not registered`);const s=rt();!function(t,n){var i=nt($++,4);!e.__s&&ht(i.__H,n)&&(i.__=t,i.__H=n,z.__h.push(i))}((()=>{const t=s.current.querySelector("svg");t&&t.setAttribute("class",n)}),[n,r]);const a={};return o&&(a.title=o),dt("span",{className:Y("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":i}),dangerouslySetInnerHTML:{__html:r},ref:s,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function gt(t,e){const n="string"==typeof t?Symbol(t):t;return ft.set(n,e),n}var mt="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js";function _t({buttonRef:t,classes:e,className:n,icon:i,iconPosition:o="left",size:r="medium",variant:s="normal",expanded:a,pressed:l,type:c="button",...h}){var u;const d=null!==(u=null==h?void 0:h.role)&&void 0!==u?u:"button",f={"aria-label":h.title};return"tab"===d?f["aria-selected"]=l:(f["aria-pressed"]=l,f["aria-expanded"]=a),dt("button",{ref:t,className:Y(n,`${n}--${r}`,`${n}--${s}`,{[`${n}--icon-${o}`]:i},e),type:c,...f,...h},void 0,!1,{fileName:mt,lineNumber:82,columnNumber:5})}function vt({className:t="Hyp-IconButton",...e}){const{icon:n}=e;return dt(_t,{className:t,...e,children:dt(pt,{name:n},void 0,!1,{fileName:mt,lineNumber:109,columnNumber:7})},void 0,!1,{fileName:mt,lineNumber:108,columnNumber:5})}gt("checkbox",' <svg\n width="32"\n height="32"\n viewBox="-4 -4 39 39"\n aria-hidden="true"\n focusable="false"\n >\n <rect\n class="hyp-svg-checkbox--background"\n width="35"\n height="35"\n x="-2"\n y="-2"\n stroke="currentColor"\n fill="none"\n stroke-width="3"\n rx="5"\n ry="5"\n />\n <polyline\n class="hyp-svg-checkbox--checkmark"\n points="4,14 12,23 28,5"\n stroke="transparent"\n stroke-width="5"\n fill="none"\n />\n</svg>');var yt='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l3.536-3.536L8 8 4.464 4.464 8 8zm0 0l-3.536 3.536L8 8l3.536 3.536L8 8z"></path></g></svg>\n';gt("cancel",yt),gt("cancel",yt);gt("spinner",'<svg viewBox="0 0 64 64">\n <g stroke-width="6" stroke="currentColor" stroke-linecap="round">\n <line y1="16" y2="28" transform="translate(32,32) rotate(180)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(225)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".15;0;1;.8;.65;.45;.3;.15" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(270)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".3;.15;0;1;.8;.65;.45;.3" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(315)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".45;.3;.15;0;1;.85;.65;.45" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(0)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".65;.45;.3;.15;0;1;.8;.65;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(45)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".8;.65;.45;.3;.15;0;1;.8" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(90)">\n <animate attributeName="stroke-opacity" dur="750ms" values="1;.85;.6;.45;.3;.15;0;1;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(135)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n </g>\n</svg>');var wt={annotate:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="nonzero" d="M15 0c.27 0 .505.099.703.297A.961.961 0 0116 1v15l-4-3H1a.974.974 0 01-.703-.29A.953.953 0 010 12V1C0 .719.096.482.29.29A.966.966 0 011 0h14zM7 3l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C4.156 5.229 4 6 4 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188C4.729 8.854 5.082 9 5.5 9c.417 0 .77-.146 1.063-.438C6.854 8.271 7 7.918 7 7.5c0-.417-.146-.77-.438-1.063A1.447 1.447 0 005.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L7 4V3zm5 0l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C9.156 5.229 9 6 9 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188c.291.291.645.437 1.062.437.417 0 .77-.146 1.063-.438.291-.291.437-.645.437-1.062 0-.417-.146-.77-.438-1.063A1.447 1.447 0 0010.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L12 4V3z"/>\n</svg>\n',cancel:yt,caution:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',"caret-left":'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 12L6 8l4-4"></path></g></svg>',"caret-right":'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4l4 4-4 4"></path></g></svg>',hide:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M1.61289944,0.209704612 L1.70710678,0.292893219 L15.7071068,14.2928932 C16.0976311,14.6834175 16.0976311,15.3165825 15.7071068,15.7071068 C15.3466228,16.0675907 14.7793918,16.0953203 14.3871006,15.7902954 L14.2928932,15.7071068 L0.292893219,1.70710678 C-0.0976310729,1.31658249 -0.0976310729,0.683417511 0.292893219,0.292893219 C0.65337718,-0.0675907428 1.22060824,-0.0953202783 1.61289944,0.209704612 Z M2.19604887,5.05494269 C2.65878442,5.35642943 2.78950241,5.97595401 2.48801567,6.43868956 C2.16488794,6.93464068 2,7.46139686 2,8 C2,10.1228856 4.62796016,12 8,12 C8.22060643,12 8.4396701,11.9919023 8.65660209,11.9758355 C9.20737829,11.9350431 9.68693944,12.3484666 9.72773191,12.8992428 C9.76852437,13.450019 9.35510087,13.9295801 8.80432467,13.9703726 C8.53822524,13.9900809 8.26988704,14 8,14 C3.64005335,14 0,11.3999619 0,8 C0,7.06308249 0.28281658,6.15958778 0.812302005,5.34690949 C1.11378875,4.88417394 1.73331332,4.75345595 2.19604887,5.05494269 Z M8,2 C12.3599467,2 16,4.6000381 16,8 C16,8.93691751 15.7171834,9.84041222 15.187698,10.6530905 C14.8862113,11.1158261 14.2666867,11.246544 13.8039511,10.9450573 C13.3412156,10.6435706 13.2104976,10.024046 13.5119843,9.56131044 C13.8351121,9.06535932 14,8.53860314 14,8 C14,5.8771144 11.3720398,4 8,4 C7.77939357,4 7.5603299,4.00809769 7.34339791,4.02416445 C6.79262171,4.06495692 6.31306056,3.65153342 6.27226809,3.10075722 C6.23147563,2.54998102 6.64489913,2.07041987 7.19567533,2.02962741 C7.46177476,2.00991913 7.73011296,2 8,2 Z"></path></svg>',highlight:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15H1h11zm-.5-6v2l-1 1v-2l1-1zm.5-7v6h-2V2h2zm0-1h-2 2zm0 8h-2 2z"></path></g></svg>',note:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M14,0 C15.0543618,0 15.9181651,0.815877791 15.9945143,1.85073766 L16,2 L16,9 C16,9.27541264 15.8865388,9.53676152 15.6894833,9.7243131 L15.6,9.8 L7.6,15.8 C7.46152306,15.9038577 7.29908616,15.9695431 7.12886893,15.9916629 L7,16 L2,16 C0.945638205,16 0.0818348781,15.1841222 0.00548573643,14.1492623 L0,14 L0,2 C0,0.945638205 0.815877791,0.0818348781 1.85073766,0.00548573643 L2,0 L14,0 Z M14,2 L2,2 L2,14 L6,14 L6,9 C6,8.48716416 6.38604019,8.06449284 6.88337887,8.00672773 L7,8 L14,8 L14,2 Z M12,10 L8,10 L8,13 L12,10 Z"></path></svg>',pointer:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="8" viewBox="0 0 15 8" aria-hidden="true" focusable="false"><path d="M0 8 L7 0 L15 8" stroke="currentColor" strokeWidth="2" /></svg>\n',show:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M8,2 C12.3599467,2 16,4.6000381 16,8 C16,11.3999619 12.3599467,14 8,14 C3.64005335,14 0,11.3999619 0,8 C0,4.6000381 3.64005335,2 8,2 Z M8,4 C4.62796016,4 2,5.8771144 2,8 C2,10.1228856 4.62796016,12 8,12 C11.3720398,12 14,10.1228856 14,8 C14,5.8771144 11.3720398,4 8,4 Z M8,6 C9.1045695,6 10,6.8954305 10,8 C10,9.1045695 9.1045695,10 8,10 C6.8954305,10 6,9.1045695 6,8 C6,6.8954305 6.8954305,6 8,6 Z"></path></svg>'};function bt(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ct(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}bt(e,o)}return e}function Et(t){if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function Tt(t,e,n){const i=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return i.href}function St(t){const e=function(t){if(!t.hasOwnProperty("hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t);let n;function i(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=Et(e.ignoreOtherConfiguration)?{}:Ct(t.document),{get annotations(){return n.annotations||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return Tt(t,"hypothesis-client","javascript")},get group(){return n.group||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return Tt(t,"notebook","html")},get showHighlights(){return function(){let t=i("showHighlights");return void 0===t&&(t="always"),"boolean"==typeof t?t?"always":"never":t}()},get sidebarAppUrl(){return Tt(t,"sidebar","html")},get query(){return n.query||function(){const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:i}}function xt(t,e){return t.hostPageSetting(e)}const At={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:xt},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:xt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:Et,getValue:xt},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},services:{allowInBrowserExt:!1,defaultValue:null,getValue:xt},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.notebookAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:xt},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:xt}};function kt(t="annotator",e=window){const n=St(e),i={};let o=function(t){const e={annotator:["clientUrl","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t);return o.forEach((t=>{const o=At[t],r=void 0!==o.defaultValue,s=!((a=Tt(e,"sidebar","html")).startsWith("http://")||a.startsWith("https://"));var a;if(!o.allowInBrowserExt&&s)return void(r&&(i[t]=o.defaultValue));const l=o.getValue(n,t);void 0!==l?i[t]=o.coerce?o.coerce(l):l:r&&(i[t]=o.defaultValue)})),i}class Lt{constructor(){this._listeners=[]}add(t,e,n,i){t.addEventListener(e,n,i),this._listeners.push({eventTarget:t,eventType:e,listener:n})}removeAll(){this._listeners.forEach((({eventTarget:t,eventType:e,listener:n})=>{t.removeEventListener(e,n)})),this._listeners=[]}}class Nt{constructor(t,e){this._port=t,this._methods=e,this._sequence=0,this._callbacks={},this._destroyed=!1,this._listeners=new Lt,this._listeners.add(this._port,"message",(t=>this._handle(t))),this._port.start()}destroy(){this._destroyed=!0,this._listeners.removeAll(),this._port.close()}call(t,...e){if(this._destroyed)return;const n=this._sequence++,i=e[e.length-1];"function"==typeof i&&(this._callbacks[n]=i,e=e.slice(0,-1));const o={arguments:e,method:t,protocol:"frame-rpc",sequence:n,version:"1.0.0"};this._port.postMessage(o)}_parseMessage({data:t}){return t&&"object"==typeof t?"frame-rpc"!==t.protocol||"1.0.0"!==t.version?null:Array.isArray(t.arguments)?t:null:null}_handle(t){const e=this._parseMessage(t);if(null!==e)if("method"in e){if(!this._methods.hasOwnProperty(e.method))return;const t=(...t)=>{const n={arguments:t,protocol:"frame-rpc",response:e.sequence,version:"1.0.0"};this._port.postMessage(n)};this._methods[e.method](...e.arguments,t)}else if("response"in e){const t=this._callbacks[e.response];delete this._callbacks[e.response],t&&t(...e.arguments)}}}class Rt{constructor(){this.links=[],this.channelListeners={},this.onConnectListeners=[],this.on("connect",(t=>t()))}destroy(){this.links.forEach((t=>t.destroy())),this.links=[]}createChannel(t){const e=new Nt(t,this.channelListeners);let n=!1;return e.call("connect",(()=>{n||(n=!0,this.onConnectListeners.forEach((t=>t(e))))})),this.links.push(e),e}call(t,...e){let n;const i=e[e.length-1];"function"==typeof i&&(n=i,e=e.slice(0,-1));const o=t=>e=>{throw t.destroy(),this.links=this.links.filter((e=>e!==t)),e},r=this.links.map((n=>new Promise(((i,o)=>{const r=setTimeout((()=>i(null)),1e3);try{n.call(t,...e,((t,e)=>{clearTimeout(r),t?o(t):i(e)}))}catch(t){o(t)}})).catch(o(n))));let s=Promise.all(r);return n&&(s=s.then((t=>n(null,t))).catch((t=>n(t)))),s}on(t,e){if(this.links.length>0)throw new Error(`Listener '${t}' can't be registered because a channel has already been created`);if(this.channelListeners[t])throw new Error(`Listener '${t}' already bound in Bridge`);return this.channelListeners[t]=e,this}onConnect(t){return this.onConnectListeners.push(t),this}}const Mt={alt:1,ctrl:2,meta:4,shift:8};function Ot(t,e,{rootElement:n=document.body}={}){const i=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let i=0,o=null;for(let t of n){const e=Mt[t];if(e)i|=e;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=t}}if(!o)throw new Error(`Invalid shortcut: ${e}`);return((t.ctrlKey?Mt.ctrl:0)|(t.metaKey?Mt.meta:0)|(t.altKey?Mt.alt:0)|(t.shiftKey?Mt.shift:0))===i&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===o})(n,t)&&e(n)};return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}function Pt(t,e,{rootElement:n=document.body}={}){ot((()=>{if(t)return Ot(t,e,{rootElement:n})}),[t,e,n])}function It({badgeCount:t,icon:e,label:n,onClick:i,shortcut:o}){Pt(o,i);const r=o?`${n} (${o})`:n;return dt("button",{className:"AdderToolbar__button",onClick:i,"aria-label":r,title:r,children:[e&&dt(pt,{name:e,className:"AdderToolbar__icon"}),"number"==typeof t&&dt("span",{className:"AdderToolbar__badge",children:t}),dt("span",{className:"AdderToolbar__label",children:n})]})}function Dt({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:i=0}){const o=e?"a":null,r=e?"h":null,s=e?"s":null;return Pt(e?"Escape":null,(()=>n("hide"))),dt("div",{className:Y("AdderToolbar",{"AdderToolbar--down":"up"===t,"AdderToolbar--up":"down"===t,"is-active":e}),style:{visibility:e?"visible":"hidden"},children:[dt("div",{className:"AdderToolbar__actions",children:[dt(It,{icon:"annotate",onClick:()=>n("annotate"),label:"Annotate",shortcut:o}),dt(It,{icon:"highlight",onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),i>0&&dt("div",{className:"AdderToolbar__separator"}),i>0&&dt(It,{badgeCount:i,onClick:()=>n("show"),label:"Show",shortcut:s})]}),dt(pt,{name:"pointer",inline:!0,className:Y("AdderToolbar__arrow",{"AdderToolbar__arrow--down":"down"===t,"AdderToolbar__arrow--up":"up"===t})})]})}const Vt=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function Ht(t){if(!t.attachShadow)return Ft(t),t;const e=t.attachShadow({mode:"open"});!function(t){var e;const n=null===(e=document.querySelector('link[rel="stylesheet"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const i=document.createElement("link");i.rel="stylesheet",i.href=n,t.appendChild(i)}(e);const n=window.applyFocusVisiblePolyfill;return n&&n(e),Ft(e),e}function Ft(t){t.addEventListener("mouseup",(t=>t.stopPropagation())),t.addEventListener("mousedown",(t=>t.stopPropagation())),t.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0})}function Bt(t){return t.toString()+"px"}class Ut{constructor(t,e){this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),this._shadowRoot=Ht(this._outerContainer),Object.assign(this._outerContainer.style,{position:"absolute",top:0,left:0}),this._view=t.ownerDocument.defaultView,this._width=()=>this._shadowRoot.firstChild.getBoundingClientRect().width,this._height=()=>this._shadowRoot.firstChild.getBoundingClientRect().height,this._isVisible=!1,this._arrowDirection="up",this._onAnnotate=e.onAnnotate,this._onHighlight=e.onHighlight,this._onShowAnnotations=e.onShowAnnotations,this.annotationsForSelection=[],this._render()}hide(){this._isVisible=!1,this._render(),Object.assign(this._outerContainer.style,{top:0,left:0})}destroy(){N(null,this._shadowRoot),this._outerContainer.remove()}show(t,e){const{left:n,top:i,arrowDirection:o}=this._calculateTarget(t,e);this._showAt(n,i),this._isVisible=!0,this._arrowDirection=2===o?"up":"down",this._render()}_calculateTarget(t,e){let n,i,o;n=e&&!Vt()?1:2;const r=Math.min(20,t.width),s=this._width(),a=Vt()?10:0,l=this._height();return o=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-l<0&&1===n?n=2:t.top+l>this._view.innerHeight&&(n=1),i=2===n?t.top+t.height+10+a:t.top-l-10,o=Math.max(o,0),o=Math.min(o,this._view.innerWidth-s),i=Math.max(i,0),i=Math.min(i,this._view.innerHeight-l),{top:i,left:o,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),i=this._height(),o=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+i),...document.elementsFromPoint(t+n/2,e+i/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+i)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return o.push(0),Math.max(...o)+1}_showAt(t,e){const n=function(t){let e=t.parentElement;for(;e.parentElement&&"static"===getComputedStyle(e).position;)e=e.parentElement;return e}(this._outerContainer).getBoundingClientRect(),i=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:Bt(t-n.left),top:Bt(e-n.top),zIndex:i})}_render(){N(dt(Dt,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this._onAnnotate(),this.hide();break;case"highlight":this._onHighlight(),this.hide();break;case"show":this._onShowAnnotations(this.annotationsForSelection);break;case"hide":this.hide()}},annotationCount:this.annotationsForSelection.length}),this._shadowRoot)}}class qt{constructor(t,e){this._emitter=t.createEmitter(),this._sidebar=e,this.cache={},this.destroyed=!1,this._sidebar.on("deleteAnnotation",((t,e)=>{if(this.destroyed)return void e(null);const n=this._parse(t);delete this.cache[n.$tag],this._emitter.publish("annotationDeleted",n),this._format(n),e(null)})),this._sidebar.on("loadAnnotations",((t,e)=>{if(this.destroyed)return void e(null);const n=t.map((t=>this._parse(t)));this._emitter.publish("annotationsLoaded",n),e(null)})),this._emitter.subscribe("beforeAnnotationCreated",(t=>{t.$tag||this._sidebar.call("createAnnotation",this._format(t))}))}sync(t){this.destroyed||this._sidebar.call("syncAnchoringStatus",t.map((t=>this._format(t))))}_tag(t,e){return t.$tag||(e=e||window.btoa(Math.random().toString()),Object.defineProperty(t,"$tag",{value:e}),this.cache[e]=t),t}_parse(t){const e=Object.assign(this.cache[t.tag]||{},t.msg);return this._tag(e,t.tag)}_format(t){return this._tag(t),{tag:t.$tag,msg:t}}destroy(){this.destroyed=!0,this._emitter.destroy()}}function Wt(t){switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return t.textContent.length;default:return 0}}function jt(t){let e=t.previousSibling,n=0;for(;e;)n+=Wt(e),e=e.previousSibling;return n}function $t(t,...e){let n=e.shift();const i=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),o=[];let r,s=i.nextNode(),a=0;for(;void 0!==n&&s;)r=s,a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}class zt{constructor(t,e){if(e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,n=this.offset;for(;e!==t;)n+=jt(e),e=e.parentElement;return new zt(e,n)}resolve(t={}){try{return $t(this.element,this.offset)[0]}catch(e){if(0===this.offset&&void 0!==t.direction){const n=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);n.currentNode=this.element;const i=1===t.direction,o=i?n.nextNode():n.previousNode();if(!o)throw e;return{node:o,offset:i?0:o.data.length}}throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return zt.fromPoint(t,e);case Node.ELEMENT_NODE:return new zt(t,e);default:throw new Error("Node is not an element or text node")}}static fromPoint(t,e){switch(t.nodeType){case Node.TEXT_NODE:{if(e<0||e>t.data.length)throw new Error("Text node offset is out of range");if(!t.parentElement)throw new Error("Text node has no parent");const n=jt(t)+e;return new zt(t.parentElement,n)}case Node.ELEMENT_NODE:{if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let i=0;i<e;i++)n+=Wt(t.childNodes[i]);return new zt(t,n)}default:throw new Error("Point is not in an element or text node")}}}class Xt{constructor(t,e){this.start=t,this.end=e}relativeTo(t){return new Xt(this.start.relativeTo(t),this.end.relativeTo(t))}toRange(){let t,e;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[t,e]=$t(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:1}),e=this.end.resolve({direction:2}));const n=new Range;return n.setStart(t.node,t.offset),n.setEnd(e.node,e.offset),n}static fromRange(t){const e=zt.fromPoint(t.startContainer,t.startOffset),n=zt.fromPoint(t.endContainer,t.endOffset);return new Xt(e,n)}static fromOffsets(t,e,n){return new Xt(new zt(t,e),new zt(t,n))}}function Yt(t){return!!t.parentElement&&null!==t.parentElement.closest(".annotator-placeholder")}function Gt(t){if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function Zt(t,e){try{var n,i;const o=null!==(n=null===(i=e.nodeValue)||void 0===i?void 0:i.length)&&void 0!==n?n:e.childNodes.length;return t.comparePoint(e,0)<=0&&t.comparePoint(e,o)>=0}catch(t){return!1}}function Kt(t,e){const n=t.commonAncestorContainer,i=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let o;for(;o=i.nextNode();)Zt(t,o)&&e(o)}function Jt(t){if(t.isCollapsed)return null;const e=function(t){const e=/^\s*$/,n=[];Kt(t,(t=>{t.nodeType!==Node.TEXT_NODE||t.textContent.match(e)||n.push(t)}));let i=[];return n.forEach((e=>{const n=e.ownerDocument.createRange();if(n.selectNodeContents(e),e===t.startContainer&&n.setStart(e,t.startOffset),e===t.endContainer&&n.setEnd(e,t.endOffset),n.collapsed)return;const o=Array.from(n.getClientRects());n.detach(),i=i.concat(o)})),i}(t.getRangeAt(0));return 0===e.length?null:Gt(t)?e[0]:e[e.length-1]}function Qt(t,e="hypothesis-highlight"){const n=function(t){if(t.collapsed)return[];let e=t.commonAncestorContainer;if(e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentElement),!e)return[];const n=[],i=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let o;for(;o=i.nextNode();){if(!Zt(t,o))continue;let e=o;e===t.startContainer&&t.startOffset>0?e.splitText(t.startOffset):(e===t.endContainer&&t.endOffset<e.data.length&&e.splitText(t.endOffset),n.push(e))}return n}(t),i=n.length>0&&Yt(n[0]);let o=[],r=null,s=null;n.forEach((t=>{r&&r.nextSibling===t?s.push(t):(s=[t],o.push(s)),r=t}));const a=/^\s*$/;o=o.filter((t=>t.some((t=>!a.test(t.nodeValue)))));const l=[];return o.forEach((t=>{const n=document.createElement("hypothesis-highlight");n.className=e,t[0].parentNode.replaceChild(n,t[0]),t.forEach((t=>n.appendChild(t))),l.push(n)})),i||function(t){if(0===t.length)return;const e=function(t){const e=t.closest(".page");return e&&e.querySelector(".canvasWrapper > canvas")||null}(t[0]);if(!e||!e.parentElement)return;let n=e.parentElement.querySelector(".hypothesis-highlight-layer");const i=CSS.supports("mix-blend-mode","multiply");if(!n){n=document.createElementNS("http://www.w3.org/2000/svg","svg"),n.setAttribute("class","hypothesis-highlight-layer"),e.parentElement.appendChild(n),e.parentElement.style.position="relative";const t=n.style;t.position="absolute",t.left="0",t.top="0",t.width="100%",t.height="100%",i?t.mixBlendMode="multiply":t.opacity="0.3"}const o=e.getBoundingClientRect(),r=t.map((t=>{const e=t.getBoundingClientRect(),n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute("x",(e.left-o.left).toString()),n.setAttribute("y",(e.top-o.top).toString()),n.setAttribute("width",e.width.toString()),n.setAttribute("height",e.height.toString()),i?n.setAttribute("class","hypothesis-svg-highlight"):n.setAttribute("class","hypothesis-svg-highlight is-opaque"),t.classList.add("is-transparent"),t.svgHighlight=n,n}));n.append(...r)}(l),l}function te(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function ee(t){for(let e of t){if(e.parentNode){te(e,Array.from(e.childNodes))}e.svgHighlight&&e.svgHighlight.remove()}}function ne(t,e){t.forEach((t=>{if(t.svgHighlight){if(t.svgHighlight.classList.toggle("is-focused",e),e){t.svgHighlight.parentNode.append(t.svgHighlight)}}else t.classList.toggle("hypothesis-highlight-focused",e)}))}function ie(t){const e=t.map((t=>t.getBoundingClientRect()));return e.reduce(((t,e)=>({top:Math.min(t.top,e.top),left:Math.min(t.left,e.left),bottom:Math.max(t.bottom,e.bottom),right:Math.max(t.right,e.right)})))}var oe=/^\s+|\s+$/g,re=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ae=/^0o[0-7]+$/i,le=parseInt,ce="object"==typeof t&&t&&t.Object===Object&&t,he="object"==typeof self&&self&&self.Object===Object&&self,ue=ce||he||Function("return this")(),de=Object.prototype.toString,fe=Math.max,pe=Math.min,ge=function(){return ue.Date.now()};function me(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function _e(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==de.call(t)}(t))return NaN;if(me(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=me(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(oe,"");var n=se.test(t);return n||ae.test(t)?le(t.slice(2),n?2:8):re.test(t)?NaN:+t}var ve=function(t,e,n){var i,o,r,s,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=i,r=o;return i=o=void 0,c=e,s=t.apply(r,n)}function p(t){return c=t,a=setTimeout(m,e),h?f(t):s}function g(t){var n=t-l;return void 0===l||n>=e||n<0||u&&t-c>=r}function m(){var t=ge();if(g(t))return _(t);a=setTimeout(m,function(t){var n=e-(t-l);return u?pe(n,r-(t-c)):n}(t))}function _(t){return a=void 0,d&&i?f(t):(i=o=void 0,s)}function v(){var t=ge(),n=g(t);if(i=arguments,o=this,l=t,n){if(void 0===a)return p(l);if(u)return a=setTimeout(m,e),f(l)}return void 0===a&&(a=setTimeout(m,e)),s}return e=_e(e)||0,me(n)&&(h=!!n.leading,r=(u="maxWait"in n)?fe(_e(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=o=a=void 0},v.flush=function(){return void 0===a?s:_(ge())},v};class ye{constructor(t,e,n){this._element=t,this._onFrameAdded=e,this._onFrameRemoved=n,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(ve((()=>{this._discoverFrames()}),40)),this._discoverFrames(),this._mutationObserver.observe(this._element,{childList:!0,subtree:!0,attributeFilter:["enable-annotation"]})}disconnect(){this._isDisconnected=!0,this._mutationObserver.disconnect()}async _addFrame(t){this._annotatableFrames.add(t);try{if(await we(t),this._isDisconnected)return;t.contentWindow.addEventListener("unload",(()=>{this._removeFrame(t)})),this._onFrameAdded(t)}catch(e){console.warn(`Unable to inject the Hypothesis client (from '${document.location.href}' into a cross-origin frame '${t.src}')`)}}_removeFrame(t){this._annotatableFrames.delete(t),this._onFrameRemoved(t)}_discoverFrames(){const t=new Set(this._element.querySelectorAll("iframe[enable-annotation]"));for(let e of t)this._annotatableFrames.has(e)||this._addFrame(e);for(let e of this._annotatableFrames)t.has(e)||this._removeFrame(e)}}function we(t){return new Promise((e=>{const n=t.contentWindow.document,{readyState:i,location:o}=n;"about:blank"===o.href&&t.hasAttribute("src")&&"about:blank"!==t.src?t.addEventListener("load",(()=>{e()})):"loading"!==i?e():n.addEventListener("DOMContentLoaded",(()=>e()))}))}class be{constructor(t,e){this._config=e,this._frameObserver=new ye(t,(t=>this.injectClient(t)),(()=>{}))}destroy(){this._frameObserver.disconnect()}async injectClient(t){if("__hypothesis"in t.contentWindow)return;await we(t);const{assetRoot:e,notebookAppUrl:n,sidebarAppUrl:i}=Ct(document),o=Math.random().toString().replace(/\D/g,""),r={...this._config,assetRoot:e,notebookAppUrl:n,sidebarAppUrl:i,subFrameIdentifier:o},{clientUrl:s}=this._config;!function(t,e,n){const i=document.createElement("script");i.className="js-hypothesis-config",i.type="application/json",i.innerText=JSON.stringify(n);const o=document.createElement("script");o.async=!0,o.src=e;const r=t.contentDocument;r.body.appendChild(i),r.body.appendChild(o)}(t,s,r)}}function Ce(t,e,n){t.self===t?t.scrollTo(e,n):(t.scrollLeft=e,t.scrollTop=n)}function Ee(t){var e=t._scrollSettings;if(e){var n=e.maxSynchronousAlignments,i=function(t,e){var n,i,o,r,s,a,l,c=t.align,h=t.target.getBoundingClientRect(),u=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,f=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,g=u,m=d;if(t.isWindow(e))a=Math.min(h.width,e.innerWidth),l=Math.min(h.height,e.innerHeight),i=h.left+e.pageXOffset-e.innerWidth*g+a*g,o=h.top+e.pageYOffset-e.innerHeight*m+l*m,i-=f,o-=p,i=t.align.lockX?e.pageXOffset:i,o=t.align.lockY?e.pageYOffset:o,r=i-e.pageXOffset,s=o-e.pageYOffset;else{a=h.width,l=h.height,n=e.getBoundingClientRect();var _=h.left-(n.left-e.scrollLeft),v=h.top-(n.top-e.scrollTop);i=_+a*g-e.clientWidth*g,o=v+l*m-e.clientHeight*m,i-=f,o-=p,i=Math.max(Math.min(i,e.scrollWidth-e.clientWidth),0),o=Math.max(Math.min(o,e.scrollHeight-e.clientHeight),0),i=t.align.lockX?e.scrollLeft:i,o=t.align.lockY?e.scrollTop:o,r=i-e.scrollLeft,s=o-e.scrollTop}return{x:i,y:o,differenceX:r,differenceY:s}}(e,t),o=Date.now()-e.startTime,r=Math.min(1/e.time*o,1);if(e.endIterations>=n)return Ce(t,i.x,i.y),t._scrollSettings=null,e.end("complete");var s=1-e.ease(r);if(Ce(t,i.x-i.differenceX*s,i.y-i.differenceY*s),o>=e.time)return e.endIterations++,e.scrollAncestor&&Ee(e.scrollAncestor),void Ee(t);!function(t){if("requestAnimationFrame"in window)return window.requestAnimationFrame(t);setTimeout(t,16)}(Ee.bind(null,t))}}function Te(t){return t.self===t}function Se(t){return"pageXOffset"in t||(t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth)&&"hidden"!==getComputedStyle(t).overflow}function xe(){return!0}function Ae(t){if(t.assignedSlot)return Ae(t.assignedSlot);if(t.parentElement)return"BODY"===t.parentElement.tagName?t.parentElement.ownerDocument.defaultView||t.parentElement.ownerDocument.ownerWindow:t.parentElement;if(t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e.host}}var ke=function(t,e,n){if(t){"function"==typeof e&&(n=e,e=null),e||(e={}),e.time=isNaN(e.time)?1e3:e.time,e.ease=e.ease||function(t){return 1-Math.pow(1-t,t/2)},e.align=e.align||{};var i=Ae(t),o=1,r=e.validTarget||xe,s=e.isScrollable;e.debug&&(console.log("About to scroll to",t),i||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var a=[];i;)if(e.debug&&console.log("Scrolling parent node",i),r(i,o)&&(s?s(i,Se):Se(i))&&(o++,a.push(i)),!(i=Ae(i))){l("complete");break}return a.reduce(((n,i,o)=>function(t,e,n,i,o){var r,s=!e._scrollSettings,a=e._scrollSettings,l=Date.now(),c={passive:!0};function h(t){e._scrollSettings=null,e.parentElement&&e.parentElement._scrollSettings&&e.parentElement._scrollSettings.end(t),n.debug&&console.log("Scrolling ended with type",t,"for",e),o(t),r&&(e.removeEventListener("touchstart",r,c),e.removeEventListener("wheel",r,c))}a&&a.end("canceled");var u=n.maxSynchronousAlignments;return null==u&&(u=3),e._scrollSettings={startTime:l,endIterations:0,target:t,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||Te,maxSynchronousAlignments:u,end:h,scrollAncestor:i},"cancellable"in n&&!n.cancellable||(r=h.bind(null,"canceled"),e.addEventListener("touchstart",r,c),e.addEventListener("wheel",r,c)),s&&Ee(e),r}(t,i,e,a[o+1],l)),null)}function l(t){--o||n&&n(t)}},Le={};function Ne(t){return t.split("").reverse().join("")}function Re(t){return(t|-t)>>31&1}function Me(t,e,n,i){var o=t.P[n],r=t.M[n],s=i>>>31,a=e[n]|s,l=a|r,c=(a&o)+o^o|a,h=r|~(c|o),u=o&c,d=Re(h&t.lastRowMask[n])-Re(u&t.lastRowMask[n]);return h<<=1,u<<=1,o=(u|=s)|~(l|(h|=Re(i)-s)),r=h&l,t.P[n]=o,t.M[n]=r,d}function Oe(t,e,n){if(0===e.length)return[];n=Math.min(n,e.length);var i=[],o=32,r=Math.ceil(e.length/o)-1,s={P:new Uint32Array(r+1),M:new Uint32Array(r+1),lastRowMask:new Uint32Array(r+1)};s.lastRowMask.fill(1<<31),s.lastRowMask[r]=1<<(e.length-1)%o;for(var a=new Uint32Array(r+1),l=new Map,c=[],h=0;h<256;h++)c.push(a);for(var u=0;u<e.length;u+=1){var d=e.charCodeAt(u);if(!l.has(d)){var f=new Uint32Array(r+1);l.set(d,f),d<c.length&&(c[d]=f);for(var p=0;p<=r;p+=1){f[p]=0;for(var g=0;g<o;g+=1){var m=p*o+g;if(!(m>=e.length))e.charCodeAt(m)===d&&(f[p]|=1<<g)}}}}var _=Math.max(0,Math.ceil(n/o)-1),v=new Uint32Array(r+1);for(p=0;p<=_;p+=1)v[p]=(p+1)*o;v[r]=e.length;for(p=0;p<=_;p+=1)s.P[p]=-1,s.M[p]=0;for(var y=0;y<t.length;y+=1){var w=t.charCodeAt(y);f=void 0;w<c.length?f=c[w]:void 0===(f=l.get(w))&&(f=a);var b=0;for(p=0;p<=_;p+=1)b=Me(s,f,p,b),v[p]+=b;if(v[_]-b<=n&&_<r&&(1&f[_+1]||b<0)){_+=1,s.P[_]=-1,s.M[_]=0;var C=_===r?e.length%o:o;v[_]=v[_-1]+C-b+Me(s,f,_,b)}else for(;_>0&&v[_]>=n+o;)_-=1;_===r&&v[_]<=n&&(v[_]<n&&i.splice(0,i.length),i.push({start:-1,end:y+1,errors:v[_]}),n=v[_])}return i}Object.defineProperty(Le,"__esModule",{value:!0});var Pe=Le.default=function(t,e,n){return function(t,e,n){var i=Ne(e);return n.map((function(n){var o=Math.max(0,n.end-e.length-n.errors);return{start:Oe(Ne(t.slice(o,n.end)),i,n.errors).reduce((function(t,e){return n.end-e.end<t?n.end-e.end:t}),n.end),end:n.end,errors:n.errors}}))}(t,e,Oe(t,e,n))};function Ie(t,e,n){let i=0,o=[];for(;-1!==i;)i=t.indexOf(e,i),-1!==i&&(o.push({start:i,end:i+e.length,errors:0}),i+=1);return o.length>0?o:Pe(t,e,n)}function De(t,e){if(0===e.length||0===t.length)return 0;return 1-Ie(t,e,e.length)[0].errors/e.length}function Ve(t,e,n={}){if(0===e.length)return null;const i=Math.min(256,e.length/2),o=Ie(t,e,i);if(0===o.length)return null;const r=i=>{const o=1-i.errors/e.length,r=n.prefix?De(t.slice(Math.max(0,i.start-n.prefix.length),i.start),n.prefix):1,s=n.suffix?De(t.slice(i.end,i.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){a=1-Math.abs(i.start-n.hint)/t.length}return(50*o+20*r+20*s+2*a)/92},s=o.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function He(t){const e=function(t){const e=t.nodeName.toLowerCase();let n=e;return"#text"===e&&(n="text()"),n}(t),n=function(t){let e=0,n=t;for(;n;)n.nodeName===t.nodeName&&(e+=1),n=n.previousSibling;return e}(t);return`${e}[${n}]`}function Fe(t,e){let n="",i=t;for(;i!==e;){if(!i)throw new Error("Node is not a descendant of root");n=He(i)+"/"+n,i=i.parentNode}return n="/"+n,n=n.replace(/\/$/,""),n}function Be(t,e,n){e=e.toUpperCase();let i=-1;for(let o=0;o<t.children.length;o++){const r=t.children[o];if(r.nodeName.toUpperCase()===e&&(++i,i===n))return r}return null}function Ue(t,e=document.body){try{return function(t,e){if(null===t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+\])?)+$/))throw new Error("Expression is not a simple XPath");const n=t.split("/");let i=e;n.shift();for(let t of n){let e,n;const o=t.indexOf("[");if(-1!==o){e=t.slice(0,o);const i=t.slice(o+1,t.indexOf("]"));if(n=parseInt(i)-1,n<0)return null}else e=t,n=0;const r=Be(i,e,n);if(!r)return null;i=r}return i}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class qe{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new qe(t,e)}static fromSelector(t,e){const n=Ue(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const i=Ue(e.endContainer,t);if(!i)throw new Error("Failed to resolve endContainer XPath");const o=zt.fromCharOffset(n,e.startOffset),r=zt.fromCharOffset(i,e.endOffset),s=new Xt(o,r).toRange();return new qe(t,s)}toRange(){return this.range}toSelector(){const t=Xt.fromRange(this.range).toRange(),e=Xt.fromRange(t),n=Fe(e.start.element,this.root),i=Fe(e.end.element,this.root);return{type:"RangeSelector",startContainer:n,startOffset:e.start.offset,endContainer:i,endOffset:e.end.offset}}}class We{constructor(t,e,n){this.root=t,this.start=e,this.end=n}static fromRange(t,e){const n=Xt.fromRange(e).relativeTo(t);return new We(t,n.start.offset,n.end.offset)}static fromSelector(t,e){return new We(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return Xt.fromOffsets(this.root,this.start,this.end).toRange()}}class je{constructor(t,e,n={}){this.root=t,this.exact=e,this.context=n}static fromRange(t,e){const n=t.textContent,i=Xt.fromRange(e).relativeTo(t),o=i.start.offset,r=i.end.offset;return new je(t,n.slice(o,r),{prefix:n.slice(Math.max(0,o-32),o),suffix:n.slice(r,Math.min(n.length,r+32))})}static fromSelector(t,e){const{prefix:n,suffix:i}=e;return new je(t,e.exact,{prefix:n,suffix:i})}toSelector(){return{type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(t={}){return this.toPositionAnchor(t).toRange()}toPositionAnchor(t={}){const e=Ve(this.root.textContent,this.exact,{...this.context,hint:t.hint});if(!e)throw new Error("Quote not found");return new We(this.root,e.start,e.end)}}async function $e(t,e={}){return t.toRange(e)}function ze(t,e,n={}){let i=null,o=null,r=null;for(let t of e)switch(t.type){case"TextPositionSelector":i=t,n.hint=i.start;break;case"TextQuoteSelector":o=t;break;case"RangeSelector":r=t}const s=t=>{var e;if(null!==(e=o)&&void 0!==e&&e.exact&&t.toString()!==o.exact)throw new Error("quote mismatch");return t};let a=Promise.reject("unable to anchor");return r&&(a=a.catch((()=>$e(qe.fromSelector(t,r),n).then(s)))),i&&(a=a.catch((()=>$e(We.fromSelector(t,i),n).then(s)))),o&&(a=a.catch((()=>$e(je.fromSelector(t,o),n)))),a}function Xe(t,e){const n=[qe,We,je],i=[];for(let o of n)try{const n=o.fromRange(t,e);i.push(n.toSelector())}catch(t){continue}return i}function Ye(t,e=document.baseURI){return new URL(t,e).href.toString().replace(/#.*/,"")}class Ge{constructor(t={}){this.document=t.document||document}uri(){let t=decodeURIComponent(this._getDocumentHref());const e=this._getLinks();for(let n of e)"canonical"===n.rel&&(t=n.href);return t}getDocumentMetadata(){const t={title:document.title,link:[],dc:this._getMetaTags("dc","name","."),eprints:this._getMetaTags("eprints","name","."),facebook:this._getMetaTags("og","property",":"),highwire:this._getMetaTags("citation","name","_"),prism:this._getMetaTags("prism","name","."),twitter:this._getMetaTags("twitter","name",":")},e=this._getFavicon();e&&(t.favicon=e),t.title=this._getTitle(t),t.link=this._getLinks(t);const n=t.link.find((t=>t.href.startsWith("urn:x-dc")));return n&&(t.documentFingerprint=n.href),t}_getMetaTags(t,e,n){const i={};for(let o of Array.from(this.document.querySelectorAll("meta"))){const r=o.getAttribute(e),{content:s}=o;if(r){const e=r.match(RegExp(`^${t}${n}(.+)$`,"i"));if(e){const t=e[1];i[t]?i[t].push(s):i[t]=[s]}}}return i}_getTitle(t){return t.highwire.title?t.highwire.title[0]:t.eprints.title?t.eprints.title[0]:t.prism.title?t.prism.title[0]:t.facebook.title?t.facebook.title[0]:t.twitter.title?t.twitter.title[0]:t.dc.title?t.dc.title[0]:this.document.title}_getLinks(t={dc:{},highwire:{}}){const e=[{href:this._getDocumentHref()}],n=Array.from(this.document.querySelectorAll("link"));for(let t of n)if(["alternate","canonical","bookmark","shortlink"].includes(t.rel)){if("alternate"===t.rel){if(t.type&&t.type.match(/^application\/(rss|atom)\+xml/))continue;if(t.hreflang)continue}try{const n=this._absoluteUrl(t.href);e.push({href:n,rel:t.rel,type:t.type})}catch(t){}}for(let n of Object.keys(t.highwire)){const i=t.highwire[n];if("pdf_url"===n)for(let t of i)try{e.push({href:this._absoluteUrl(t),type:"application/pdf"})}catch(t){}if("doi"===n)for(let t of i)"doi:"!==t.slice(0,4)&&(t=`doi:${t}`),e.push({href:t})}for(let n of Object.keys(t.dc)){const i=t.dc[n];if("identifier"===n)for(let t of i)"doi:"===t.slice(0,4)&&e.push({href:t})}const i=t.dc["relation.ispartof"],o=t.dc.identifier;if(i&&o){const t=i[i.length-1],n=o[o.length-1],r="urn:x-dc:"+encodeURIComponent(t)+"/"+encodeURIComponent(n);e.push({href:r})}return e}_getFavicon(){let t=null;for(let e of Array.from(this.document.querySelectorAll("link")))if(["shortcut icon","icon"].includes(e.rel))try{t=this._absoluteUrl(e.href)}catch(t){}return t}_absoluteUrl(t){return Ye(t,this.document.baseURI)}_getDocumentHref(){const{href:t}=this.document.location,e=["http:","https:","file:"],n=new URL(t).protocol;return e.includes(n)?t:this.document.baseURI&&e.includes(new URL(this.document.baseURI).protocol)?this.document.baseURI:t}}class Ze{constructor(t=document.body){this.container=t,this.anchor=ze,this.describe=Xe,this._htmlMeta=new Ge}canAnnotate(){return!0}destroy(){}contentContainer(){return this.container}fitSideBySide(){return!1}async getMetadata(){return this._htmlMeta.getDocumentMetadata()}async uri(){return this._htmlMeta.uri()}scrollToAnchor(t){const e=t.highlights;return new Promise((t=>{ke(e[0],t)}))}}let Ke={};function Je(...t){const e=t.join();e in Ke||(console.warn(...t),Ke[e]=!0)}Je.reset=()=>{Ke={}};const Qe=0,tn=3,en=new Map,nn=new Map;function on(t,e){return`${t}:${e}`}function rn(t){var e;const n="closest"in t?t:t.parentElement;return null!==(e=null==n?void 0:n.closest(".textLayer"))&&void 0!==e?e:null}function sn(){return PDFViewerApplication.pdfViewer}async function an(t){const e=sn();let n=e.getPageView(t);return n&&n.pdfPage||(n=await new Promise((n=>{const i=()=>{e.eventBus?e.eventBus.off("pagesloaded",i):document.removeEventListener("pagesloaded",i),n(e.getPageView(t))};e.eventBus?e.eventBus.on("pagesloaded",i):document.addEventListener("pagesloaded",i)}))),n}function ln(t){const e=en.get(t);if(e)return e;const n=(async()=>{const e=await an(t);let n=(await e.pdfPage.getTextContent({normalizeWhitespace:!0})).items;return n.length>0&&!("hasEOL"in n[0])&&(n=n.filter((t=>/\S/.test(t.str)))),n.map((t=>t.str)).join("")})();return en.set(t,n),n}async function cn(t){const e=sn();let n=0,i=0,o="";for(let r=0;r<e.pagesCount;r++)if(o=await ln(r),n=i,i+=o.length,i>=t)return{index:r,offset:n,text:o};return{index:e.pagesCount-1,offset:n,text:o}}async function hn(t,e,n){const[i,o]=await Promise.all([an(t),ln(t)]);if(i.renderingState===tn&&i.textLayer&&i.textLayer.renderingDone){const t=i.textLayer.textLayerDiv;o!==t.textContent&&Je("PDF text layer content does not match page text. This will cause anchoring misalignment.");const r=new zt(t,e),s=new zt(t,n);return new Xt(r,s).toRange()}const r=function(t){let e=t.querySelector(".annotator-placeholder");return e||(e=document.createElement("span"),e.classList.add("annotator-placeholder"),e.textContent="Loading annotations...",t.appendChild(e),e)}(i.div),s=document.createRange();return s.setStartBefore(r),s.setEndAfter(r),s}function un(t){const e=[];let n="";for(let i=0;i<t.length;i++){const o=t[i];" "!==o&&"\t"!==o&&"\n"!==o&&(n+=o,e.push(i))}return[n,e]}async function dn(t,e){const n=e.find((t=>"TextQuoteSelector"===t.type));if(!n)throw new Error("No quote selector found");const i=e.find((t=>"TextPositionSelector"===t.type));if(i){try{const{index:t,offset:e,text:o}=await cn(i.start),r=i.start-e,s=i.end-e,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await hn(t,r,s)}catch{}try{const t=on(n.exact,i.start),e=nn.get(t);if(e){const{pageIndex:t,anchor:n}=e;return await hn(t,n.start,n.end)}}catch{}}return async function(t,e){const n=sn().pagesCount,i=Array(n).fill(0).map(((t,e)=>e));let o,r;if(e){const{index:t,offset:n}=await cn(e);o=t,r=e-n,i.sort(((e,n)=>Math.abs(e-t)-Math.abs(n-t)))}const[s]=void 0!==t.prefix?un(t.prefix):[],[a]=void 0!==t.suffix?un(t.suffix):[],[l]=un(t.exact);let c;for(let t of i){const e=await ln(t),[n,i]=un(e);let h;if(void 0!==o&&void 0!==r){let n;for(n=t<o?e.length:t===o?r:0,h=0;h<i.length&&i[h]<n;)++h}const u=Ve(n,l,{prefix:s,suffix:a,hint:h});if(u&&(!c||u.score>c.match.score)){c={page:t,match:{start:i[u.start],end:i[u.end-1]+1,score:u.score}};const e=n.slice(u.start,u.end)===l,o=void 0!==s&&n.slice(Math.max(0,u.start-s.length),u.start)===s,r=void 0!==a&&n.slice(u.end,a.length)===a,h=void 0!==s||void 0!==a;if(e&&(o||r||!h))break}}if(c){const{page:n,match:i}=c;if(e){const o=on(t.exact,e);nn.set(o,{pageIndex:n,anchor:i})}return hn(n,i.start,i.end)}throw new Error("Quote not found")}(n,null==i?void 0:i.start)}function fn(t){try{t=Xt.fromRange(t).toRange()}catch{throw new Error("Selection does not contain text")}const e=rn(t.startContainer),n=rn(t.endContainer);if(!e||!n)throw new Error("Selection is outside page text");if(e!==n)throw new Error("Selecting across page breaks is not supported");return[t,e]}async function pn(t,e){const[n,i]=fn(e),o=zt.fromPoint(n.startContainer,n.startOffset).relativeTo(i),r=zt.fromPoint(n.endContainer,n.endOffset).relativeTo(i),s=function(t){let e=0;for(;t.previousSibling;)++e,t=t.previousSibling;return e}(i.parentNode),a=await async function(t){if(t>=sn().pagesCount)throw new Error("Invalid page index");let e=0;for(let n=0;n<t;n++)e+=(await ln(n)).length;return e}(s);return[{type:"TextPositionSelector",start:a+o.offset,end:a+r.offset},je.fromRange(t,n).toSelector()]}function gn(){return dt("div",{className:"WarningBanner WarningBanner--notice",children:[dt("div",{className:"WarningBanner__type",children:dt(pt,{name:"caution",className:"WarningBanner__icon"})}),dt("div",{className:"WarningBanner__message",children:[dt("strong",{children:"This PDF does not contain selectable text:"})," ",dt("a",{target:"_blank",rel:"noreferrer",href:"https://web.hypothes.is/help/how-to-ocr-optimize-pdfs/",children:"Learn how to fix this"})," ","in order to annotate with Hypothesis."]})]})}function mn(t,e,n){return t+n*(e-t)}async function _n(t,e,{maxDuration:n=500}={}){const i=t.scrollTop,o=e,r=Date.now(),s=Math.min(Math.abs(o-i)/3,n);let a=0;for(;a<1;)await new Promise((t=>{requestAnimationFrame(t)})),a=Math.min(1,(Date.now()-r)/s),t.scrollTop=mn(i,o,a)}class vn{constructor(t){this._loaded=function(t){return t.initializedPromise?t.initializedPromise:t.initialized?Promise.resolve():new Promise((e=>{const n=setInterval((()=>{t.initialized&&(clearTimeout(n),e())}),5)}))}(t).then((()=>t.downloadComplete?t:new Promise((e=>{const n=()=>{t.eventBus?(t.eventBus.off("documentload",n),t.eventBus.off("documentloaded",n)):window.removeEventListener("documentload",n),e(t)};t.eventBus?(t.eventBus.on("documentloaded",n),t.eventBus.on("documentload",n)):window.addEventListener("documentload",n)}))))}getUri(){return this._loaded.then((t=>{let e=bn(t);return e||(e=wn(yn(t))),e}))}async getMetadata(){const t=await this._loaded,{info:e,contentDispositionFilename:n,metadata:i}=await t.pdfDocument.getMetadata(),o=yn(t),r=bn(t);let s;s=null!=i&&i.has("dc:title")&&"Untitled"!==i.get("dc:title")?i.get("dc:title"):null!=e&&e.Title?e.Title:n||(r?function(t){const e=new URL(t).pathname.split("/");return e[e.length-1]}(r):"");const a=[{href:wn(o)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:o}}}function yn(t){return Array.isArray(t.pdfDocument.fingerprints)?t.pdfDocument.fingerprints[0]:t.pdfDocument.fingerprint}function wn(t){return`urn:x-pdf:${t}`}function bn(t){if(!t.url)return null;const e=Ye(t.url);return 0!==e.indexOf("file://")?e:null}function Cn(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];return n&&Yt(n)}function En(t){return new Promise((e=>setTimeout(e,t)))}class Tn{constructor(t,e={}){var n,i,o;this.annotator=t;const r=window,s=r.PDFViewerApplication;this.pdfViewer=s.pdfViewer,this.pdfViewer.viewer.classList.add("has-transparent-text-layer"),this.pdfContainer=null!==(n=null===(i=s.appConfig)||void 0===i?void 0:i.appContainer)&&void 0!==n?n:document.body,this.pdfMetadata=new vn(s),this.observer=new MutationObserver(ve((()=>this._update()),100)),this.observer.observe(this.pdfViewer.viewer,{attributes:!0,attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=null!==(o=e.reanchoringMaxWait)&&void 0!==o?o:3e3,this._warningBanner=null,this._checkForSelectableText(),this._updateAnnotationLayerVisibility=()=>{const t=r.getSelection();this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new Lt,this._listeners.add(document,"selectionchange",this._updateAnnotationLayerVisibility),this._destroyed=!1}destroy(){this._listeners.removeAll(),this.pdfViewer.viewer.classList.remove("has-transparent-text-layer"),this.observer.disconnect(),this._destroyed=!0}uri(){return this.pdfMetadata.getUri()}getMetadata(){return this.pdfMetadata.getMetadata()}anchor(t,e){return dn(0,e)}canAnnotate(t){return function(t){try{return fn(t),!0}catch{return!1}}(t)}describe(t,e){return pn(t,e)}async _checkForSelectableText(){try{await this.uri()}catch(t){return}if(!this._destroyed)try{const t=await async function(){const t=sn();let e=!1;for(let n=0;n<t.pagesCount;n++)if((await ln(n)).trim().length>0){e=!0;break}return e}();this._toggleNoSelectableTextWarning(!t)}catch(t){console.warn("Unable to check for text in PDF:",t)}}_toggleNoSelectableTextWarning(t){const e=document.querySelector("#outerContainer");var n;if(!t)return null===(n=this._warningBanner)||void 0===n||n.remove(),this._warningBanner=null,void(e.style.height="");this._warningBanner=document.createElement("hypothesis-banner"),document.body.prepend(this._warningBanner);const i=Ht(this._warningBanner);N(dt(gn,{}),i);const o=this._warningBanner.getBoundingClientRect().height;e.style.height=`calc(100% - ${o}px)`}_update(){const t=[],e=this.pdfViewer.pagesCount;for(let t=0;t<e;t++){var n;const e=this.pdfViewer.getPageView(t);if(null!=e&&null!==(n=e.textLayer)&&void 0!==n&&n.renderingDone)switch(e.renderingState){case Qe:e.textLayer=null;break;case tn:i=e.div,o=void 0,null===(o=i.querySelector(".annotator-placeholder"))||void 0===o||o.remove()}}var i,o;for(let e of this.annotator.anchors)if(e.highlights){if(t.includes(e.annotation))continue;for(let n=0;n<e.highlights.length;n++){const i=e.highlights[n];if(!document.body.contains(i)){e.highlights.splice(n,1),delete e.range,t.push(e.annotation);break}}}t.map((t=>this.annotator.anchor(t)))}contentContainer(){return document.querySelector("#viewerContainer")}fitSideBySide(t){const e=window.innerWidth-t.width,n=t.expanded&&e>=680,i=n?t.width:t.toolbarWidth;this.pdfContainer.style.width=`calc(100% - ${i}px)`;const o=this.pdfViewer.currentScaleValue;return"auto"!==o&&"page-fit"!==o&&"page-width"!==o||(this.pdfViewer.currentScaleValue=o),this.pdfViewer.update(),n}async scrollToAnchor(t){const e=t.annotation,n=Cn(t),i=this._anchorOffset(t);if(null!==i&&(await _n(this.contentContainer(),i),n)){const t=await this._waitForAnnotationToBeAnchored(e,this._reanchoringMaxWait);if(!t)return;const n=this._anchorOffset(t);if(null===n)return;await _n(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(t,e){var n;const i=Date.now();let o;do{o=this.annotator.anchors.find((e=>e.annotation===t)),o&&!Cn(o)||(o=null,await En(20))}while(!o&&Date.now()-i<e);return null!==(n=o)&&void 0!==n?n:null}_anchorOffset(t){if(!t.highlights)return null;return function(t,e){let n=0;for(;t!==e&&e.contains(t);)n+=t.offsetTop,t=t.offsetParent;return n}(t.highlights[0],this.contentContainer())}}function Sn(t=document){return t.querySelector("mosaic-book")}class xn{constructor(t){const e=Sn();if(!e)throw new Error("Book container element not found");const n=e.shadowRoot,i=()=>{const e=n.querySelector("iframe");e&&t.injectClient(e)};i(),this._frameObserver=new MutationObserver(i),this._frameObserver.observe(n,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}canAnnotate(){return!1}async anchor(){return new Range}describe(){throw new Error("This frame cannot be annotated")}contentContainer(){return document.body}fitSideBySide(){return!1}async getMetadata(){return{title:"",link:[]}}async uri(){return document.location.href}async scrollToAnchor(){}}class An{constructor(t=document.body){this._htmlIntegration=new Ze(t),this._listeners=new Lt;const e=["mousedown","mouseup","mouseout"];for(let t of e)this._listeners.add(document.documentElement,t,(t=>{t.stopPropagation()}))}canAnnotate(){return!0}destroy(){this._listeners.removeAll(),this._htmlIntegration.destroy()}anchor(t,e){return this._htmlIntegration.anchor(t,e)}describe(t,e){return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(){return!1}async getMetadata(){return{title:document.title,link:[]}}async uri(){const t=new URL(document.location.href);return t.search="",t.toString()}async scrollToAnchor(t){return this._htmlIntegration.scrollToAnchor(t)}}function kn(t){if("undefined"!=typeof PDFViewerApplication)return new Tn(t);const e=function(t=window){var e;if(Sn(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&Sn(n)?"content":null}();return"container"===e?new xn(t):"content"===e?new An:new Ze}class Ln{constructor(t,e=document){let n=!1;this._pendingCallback=null;const i=(n=10)=>{this._pendingCallback=setTimeout((()=>{t(function(t){const e=t.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);return n.collapsed?null:n}(e))}),n)};this._eventHandler=t=>{if("mousedown"===t.type&&(n=!0),"mouseup"===t.type&&(n=!1),n)return;this._cancelPendingCallback();const e="mouseup"===t.type?10:100;i(e)},this._document=e,this._listeners=new Lt,this._events=["mousedown","mouseup","selectionchange"];for(let t of this._events)this._listeners.add(e,t,this._eventHandler);i(1)}disconnect(){this._listeners.removeAll(),this._cancelPendingCallback()}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}}function Nn(){const t=function(t,e){const n=new Set,i=new Set;return Kt(t,(t=>{let o=t;for(;o&&!n.has(o);){n.add(o);const t=e(o);t&&i.add(t),o=o.parentNode}})),[...i]}(window.getSelection().getRangeAt(0),(t=>t._annotation));return t}function Rn(t){const e=function(t){let e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;const n=[];for(;e;)e.classList.contains("hypothesis-highlight")&&n.push(e),e=e.parentElement;return n}(t).map((t=>t._annotation)).filter((t=>void 0!==t));return e}function Mn(t){if(!t.range)return null;try{return t.range.toRange()}catch{return null}}class On{constructor(t,e,n={},i=window){this.element=t,this._emitter=e.createEmitter(),this._highlightsVisible=!1,this._isAdderVisible=!1,this._adder=new Ut(this.element,{onAnnotate:async()=>{await this.createAnnotation(),document.getSelection().removeAllRanges()},onHighlight:async()=>{await this.createAnnotation({highlight:!0}),document.getSelection().removeAllRanges()},onShowAnnotations:t=>{this.selectAnnotations(t)}}),this._selectionObserver=new Ln((t=>{t?this._onSelection(t):this._onClearSelection()})),this.anchors=[],this._frameIdentifier=n.subFrameIdentifier||null,this._bridge=new Rt,this._connectSidebarEvents(),this._annotationSync=new qt(e,this._bridge),this._connectAnnotationSync(),this._hypothesisInjector=new be(this.element,n),this._integration=kn(this),this._sideBySideActive=!1,this._listeners=new Lt,this._setupElementEvents(),this._focusedAnnotations=new Set,this._hostFrame=i,this._listeners.add(window,"unload",(()=>this._notifyGuestUnload()))}_setupElementEvents(){const t=t=>{this._sideBySideActive||Rn(t).length||this._bridge.call("closeSidebar")};this._listeners.add(this.element,"mouseup",(t=>{const{target:e,metaKey:n,ctrlKey:i}=t,o=Rn(e);if(o.length&&this._highlightsVisible){const t=n||i;this.selectAnnotations(o,t)}})),this._listeners.add(this.element,"mousedown",(({target:e})=>{t(e)})),this._listeners.add(this.element,"touchstart",(({target:e})=>{t(e)})),this._listeners.add(this.element,"mouseover",(({target:t})=>{const e=Rn(t);e.length&&this._highlightsVisible&&this._focusAnnotations(e)})),this._listeners.add(this.element,"mouseout",(()=>{this._highlightsVisible&&this._focusAnnotations([])})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async injectClient(t){return this._hypothesisInjector.injectClient(t)}async getDocumentInfo(){const[t,e]=await Promise.all([this._integration.uri(),this._integration.getMetadata()]);return{uri:Ye(t),metadata:e,frameIdentifier:this._frameIdentifier}}_repositionAdder(){var t;if(!1===this._isAdderVisible)return;const e=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);e&&this._onSelection(e)}_connectAnnotationSync(){this._emitter.subscribe("annotationDeleted",(t=>{this.detach(t)})),this._emitter.subscribe("annotationsLoaded",(t=>{t.map((t=>this.anchor(t)))}))}_connectSidebarEvents(){this._bridge.on("focusAnnotations",((t=[])=>{this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ne(e.highlights,n)}})),this._bridge.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=Mn(e);if(!n)return;const i=new CustomEvent("scrolltorange",{bubbles:!0,cancelable:!0,detail:n});this.element.dispatchEvent(i)&&this._integration.scrollToAnchor(e)})),this._bridge.on("getDocumentInfo",(t=>{this.getDocumentInfo().then((e=>t(null,e))).catch((e=>t(e)))})),this._bridge.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t)}))}destroy(){this._notifyGuestUnload(),this._hypothesisInjector.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),function(t){ee(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy(),this._emitter.destroy(),this._annotationSync.destroy(),this._bridge.destroy()}_notifyGuestUnload(){const t={type:"hypothesisGuestUnloaded",frameIdentifier:this._frameIdentifier};this._hostFrame.postMessage(t,"*")}connectToSidebar(t,e){const n=new MessageChannel;t.postMessage({type:"hypothesisGuestReady"},e,[n.port2]),this._bridge.createChannel(n.port1)}async anchor(t){const e=t=>{const e=Mn(t);if(!e)return;const n=Qt(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&ne(n,!0)};this.detach(t,!1),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Xt.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));for(let t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._annotationSync.sync([t]),n}detach(t,e=!0){const n=[];for(let e of this.anchors)e.annotation!==t?n.push(e):e.highlights&&ee(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._emitter.publish("anchorsChanged",this.anchors)}async createAnnotation({highlight:t=!1}={}){var e;const n=null!==(e=this.selectedRanges)&&void 0!==e?e:[];this.selectedRanges=null;const i=await this.getDocumentInfo(),o=this.element,r=(await Promise.all(n.map((t=>this._integration.describe(o,t))))).map((t=>({source:i.uri,selector:t}))),s={uri:i.uri,document:i.metadata,target:r,$highlight:t,$tag:""};return this._emitter.publish("beforeAnnotationCreated",s),this.anchor(s),s}_focusAnnotations(t){const e=t.map((t=>t.$tag));this._bridge.call("focusAnnotations",e)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=Gt(e),i=Jt(e);i?(this.selectedRanges=[t],this._emitter.publish("hasSelectionChanged",!0),this._adder.annotationsForSelection=Nn(),this._isAdderVisible=!0,this._adder.show(i,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._emitter.publish("hasSelectionChanged",!1)}selectAnnotations(t,e=!1){const n=t.map((t=>t.$tag));e?this._bridge.call("toggleAnnotationSelection",n):this._bridge.call("showAnnotations",n),this._bridge.call("openSidebar")}scrollToAnchor(t){return this._integration.scrollToAnchor(t)}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}contentContainer(){return this._integration.contentContainer()}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Pn(t){var e;const n={...t};if((null===(e=n.services)||void 0===e?void 0:e.length)>0){const t=n.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return["notebookAppUrl","sidebarAppUrl"].forEach((t=>delete n[t])),n}function In({config:t,groupId:e}){const n=Pn(t);n.group=e;const i=encodeURIComponent(JSON.stringify(n));return dt("iframe",{title:"Hypothesis annotation notebook",className:"NotebookIframe",allowFullScreen:!0,src:`${t.notebookAppUrl}#config=${i}`})}function Dn({eventBus:t,config:e}){const[n,i]=it(0),[o,r]=it(!0),[s,a]=it(null),l=rt(""),c=rt(null);ot((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ot((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),ot((()=>(c.current=t.createEmitter(),c.current.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),()=>{c.current.destroy()})),[t]);return null===s?null:dt("div",{className:Y("NotebookModal__outer",{"is-hidden":o}),children:dt("div",{className:"NotebookModal__inner",children:[dt("div",{className:"NotebookModal__close-button-container",children:dt(vt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{r(!0),c.current.publish("closeNotebook")},variant:"dark"})}),dt(In,{config:e,groupId:s},n)]})})}class Vn{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=Ht(this._outerContainer),N(dt(Dn,{eventBus:e,config:n}),this.shadowRoot)}destroy(){N(null,this.shadowRoot),this._outerContainer.remove()}}var Hn={exports:{}};
6
+ */$=z,function(){var t={}.hasOwnProperty;function e(){for(var n=[],i=0;i<arguments.length;i++){var o=arguments[i];if(o){var r=typeof o;if("string"===r||"number"===r)n.push(o);else if(Array.isArray(o)){if(o.length){var s=e.apply(null,o);s&&n.push(s)}}else if("object"===r)if(o.toString===Object.prototype.toString)for(var a in o)t.call(o,a)&&o[a]&&n.push(a);else n.push(o.toString())}}return n.join(" ")}$.exports?(e.default=e,$.exports=e):window.classNames=e}();var X,Y,G,Z=z.exports,K=0,J=[],Q=n.__b,tt=n.__r,et=n.diffed,nt=n.__c,it=n.unmount;function ot(t,e){n.__h&&n.__h(Y,t,K||e),K=0;var i=Y.__H||(Y.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function rt(t){return K=1,function(t,e,n){var i=ot(X++,2);return i.t=t,i.__c||(i.__=[n?n(e):ft(void 0,e),function(t){var e=i.t(i.__[0],t);i.__[0]!==e&&(i.__=[e,i.__[1]],i.__c.setState({}))}],i.__c=Y),i.__}(ft,t)}function st(t,e){var i=ot(X++,3);!n.__s&&dt(i.__H,e)&&(i.__=t,i.__H=e,Y.__H.__h.push(i))}function at(t){return K=5,function(t,e){var n=ot(X++,7);return dt(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}((function(){return{current:t}}),[])}function lt(){J.forEach((function(t){if(t.__P)try{t.__H.__h.forEach(ht),t.__H.__h.forEach(ut),t.__H.__h=[]}catch(e){t.__H.__h=[],n.__e(e,t.__v)}})),J=[]}n.__b=function(t){Y=null,Q&&Q(t)},n.__r=function(t){tt&&tt(t),X=0;var e=(Y=t.__c).__H;e&&(e.__h.forEach(ht),e.__h.forEach(ut),e.__h=[])},n.diffed=function(t){et&&et(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(1!==J.push(e)&&G===n.requestAnimationFrame||((G=n.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),ct&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);ct&&(e=requestAnimationFrame(n))})(lt)),Y=null},n.__c=function(t,e){e.some((function(t){try{t.__h.forEach(ht),t.__h=t.__h.filter((function(t){return!t.__||ut(t)}))}catch(i){e.some((function(t){t.__h&&(t.__h=[])})),e=[],n.__e(i,t.__v)}})),nt&&nt(t,e)},n.unmount=function(t){it&&it(t);var e=t.__c;if(e&&e.__H)try{e.__H.__.forEach(ht)}catch(t){n.__e(t,e.__v)}};var ct="function"==typeof requestAnimationFrame;function ht(t){var e=Y;"function"==typeof t.__c&&t.__c(),Y=e}function ut(t){var e=Y;t.__c=t.__(),Y=e}function dt(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function ft(t,e){return"function"==typeof e?e(t):e}var pt=0;function gt(t,e,i,o,r){var s,a,l={};for(a in e)"ref"==a?s=e[a]:l[a]=e[a];var c={type:t,props:l,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--pt,__source:o,__self:r};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return n.vnode&&n.vnode(c),c}const mt=new Map;function _t({name:t,className:e="",inline:i=!1,title:o=""}){const r=mt.get(t);if(!r)throw new Error(`Icon "${t.toString()}" is not registered`);const s=at();!function(t,e){var i=ot(X++,4);!n.__s&&dt(i.__H,e)&&(i.__=t,i.__H=e,Y.__h.push(i))}((()=>{const t=s.current.querySelector("svg");t&&t.setAttribute("class",e)}),[e,r]);const a={};return o&&(a.title=o),gt("span",{className:Z("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":i}),dangerouslySetInnerHTML:{__html:r},ref:s,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function vt(t,e){const n="string"==typeof t?Symbol(t):t;return mt.set(n,e),n}var yt="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js";function wt({buttonRef:t,classes:e,className:n,icon:i,iconPosition:o="left",size:r="medium",variant:s="normal",expanded:a,pressed:l,type:c="button",...h}){var u;const d=null!==(u=null==h?void 0:h.role)&&void 0!==u?u:"button",f={"aria-label":h.title};return"tab"===d?f["aria-selected"]=l:(f["aria-pressed"]=l,f["aria-expanded"]=a),gt("button",{ref:t,className:Z(n,`${n}--${r}`,`${n}--${s}`,{[`${n}--icon-${o}`]:i},e),type:c,...f,...h},void 0,!1,{fileName:yt,lineNumber:82,columnNumber:5})}function bt({className:t="Hyp-IconButton",...e}){const{icon:n}=e;return gt(wt,{className:t,...e,children:gt(_t,{name:n},void 0,!1,{fileName:yt,lineNumber:109,columnNumber:7})},void 0,!1,{fileName:yt,lineNumber:108,columnNumber:5})}vt("checkbox",' <svg\n width="32"\n height="32"\n viewBox="-4 -4 39 39"\n aria-hidden="true"\n focusable="false"\n >\n <rect\n class="hyp-svg-checkbox--background"\n width="35"\n height="35"\n x="-2"\n y="-2"\n stroke="currentColor"\n fill="none"\n stroke-width="3"\n rx="5"\n ry="5"\n />\n <polyline\n class="hyp-svg-checkbox--checkmark"\n points="4,14 12,23 28,5"\n stroke="transparent"\n stroke-width="5"\n fill="none"\n />\n</svg>');var Ct='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l3.536-3.536L8 8 4.464 4.464 8 8zm0 0l-3.536 3.536L8 8l3.536 3.536L8 8z"></path></g></svg>\n';vt("cancel",Ct),vt("cancel",Ct);vt("spinner",'<svg viewBox="0 0 64 64">\n <g stroke-width="6" stroke="currentColor" stroke-linecap="round">\n <line y1="16" y2="28" transform="translate(32,32) rotate(180)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(225)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".15;0;1;.8;.65;.45;.3;.15" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(270)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".3;.15;0;1;.8;.65;.45;.3" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(315)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".45;.3;.15;0;1;.85;.65;.45" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(0)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".65;.45;.3;.15;0;1;.8;.65;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(45)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".8;.65;.45;.3;.15;0;1;.8" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(90)">\n <animate attributeName="stroke-opacity" dur="750ms" values="1;.85;.6;.45;.3;.15;0;1;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(135)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n </g>\n</svg>');var Et={annotate:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">\n <path fill="currentColor" fill-rule="nonzero" d="M15 0c.27 0 .505.099.703.297A.961.961 0 0116 1v15l-4-3H1a.974.974 0 01-.703-.29A.953.953 0 010 12V1C0 .719.096.482.29.29A.966.966 0 011 0h14zM7 3l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C4.156 5.229 4 6 4 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188C4.729 8.854 5.082 9 5.5 9c.417 0 .77-.146 1.063-.438C6.854 8.271 7 7.918 7 7.5c0-.417-.146-.77-.438-1.063A1.447 1.447 0 005.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L7 4V3zm5 0l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C9.156 5.229 9 6 9 7l.002.063.006.062a.896.896 0 01.008.11l-.002.074-.006.066a1.447 1.447 0 00.43 1.188c.291.291.645.437 1.062.437.417 0 .77-.146 1.063-.438.291-.291.437-.645.437-1.062 0-.417-.146-.77-.438-1.063A1.447 1.447 0 0010.5 6c-.073 0-.146.005-.219.016-.073.01-.14.026-.203.046.177-1.03.542-1.632 1.094-1.804L12 4V3z"/>\n</svg>\n',cancel:Ct,caution:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',"caret-left":'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 12L6 8l4-4"></path></g></svg>',"caret-right":'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4l4 4-4 4"></path></g></svg>',hide:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M1.61289944,0.209704612 L1.70710678,0.292893219 L15.7071068,14.2928932 C16.0976311,14.6834175 16.0976311,15.3165825 15.7071068,15.7071068 C15.3466228,16.0675907 14.7793918,16.0953203 14.3871006,15.7902954 L14.2928932,15.7071068 L0.292893219,1.70710678 C-0.0976310729,1.31658249 -0.0976310729,0.683417511 0.292893219,0.292893219 C0.65337718,-0.0675907428 1.22060824,-0.0953202783 1.61289944,0.209704612 Z M2.19604887,5.05494269 C2.65878442,5.35642943 2.78950241,5.97595401 2.48801567,6.43868956 C2.16488794,6.93464068 2,7.46139686 2,8 C2,10.1228856 4.62796016,12 8,12 C8.22060643,12 8.4396701,11.9919023 8.65660209,11.9758355 C9.20737829,11.9350431 9.68693944,12.3484666 9.72773191,12.8992428 C9.76852437,13.450019 9.35510087,13.9295801 8.80432467,13.9703726 C8.53822524,13.9900809 8.26988704,14 8,14 C3.64005335,14 0,11.3999619 0,8 C0,7.06308249 0.28281658,6.15958778 0.812302005,5.34690949 C1.11378875,4.88417394 1.73331332,4.75345595 2.19604887,5.05494269 Z M8,2 C12.3599467,2 16,4.6000381 16,8 C16,8.93691751 15.7171834,9.84041222 15.187698,10.6530905 C14.8862113,11.1158261 14.2666867,11.246544 13.8039511,10.9450573 C13.3412156,10.6435706 13.2104976,10.024046 13.5119843,9.56131044 C13.8351121,9.06535932 14,8.53860314 14,8 C14,5.8771144 11.3720398,4 8,4 C7.77939357,4 7.5603299,4.00809769 7.34339791,4.02416445 C6.79262171,4.06495692 6.31306056,3.65153342 6.27226809,3.10075722 C6.23147563,2.54998102 6.64489913,2.07041987 7.19567533,2.02962741 C7.46177476,2.00991913 7.73011296,2 8,2 Z"></path></svg>',highlight:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15H1h11zm-.5-6v2l-1 1v-2l1-1zm.5-7v6h-2V2h2zm0-1h-2 2zm0 8h-2 2z"></path></g></svg>',note:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M14,0 C15.0543618,0 15.9181651,0.815877791 15.9945143,1.85073766 L16,2 L16,9 C16,9.27541264 15.8865388,9.53676152 15.6894833,9.7243131 L15.6,9.8 L7.6,15.8 C7.46152306,15.9038577 7.29908616,15.9695431 7.12886893,15.9916629 L7,16 L2,16 C0.945638205,16 0.0818348781,15.1841222 0.00548573643,14.1492623 L0,14 L0,2 C0,0.945638205 0.815877791,0.0818348781 1.85073766,0.00548573643 L2,0 L14,0 Z M14,2 L2,2 L2,14 L6,14 L6,9 C6,8.48716416 6.38604019,8.06449284 6.88337887,8.00672773 L7,8 L14,8 L14,2 Z M12,10 L8,10 L8,13 L12,10 Z"></path></svg>',pointer:'<svg xmlns="http://www.w3.org/2000/svg" width="15" height="8" viewBox="0 0 15 8" aria-hidden="true" focusable="false"><path d="M0 8 L7 0 L15 8" stroke="currentColor" strokeWidth="2" /></svg>\n',show:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M8,2 C12.3599467,2 16,4.6000381 16,8 C16,11.3999619 12.3599467,14 8,14 C3.64005335,14 0,11.3999619 0,8 C0,4.6000381 3.64005335,2 8,2 Z M8,4 C4.62796016,4 2,5.8771144 2,8 C2,10.1228856 4.62796016,12 8,12 C11.3720398,12 14,10.1228856 14,8 C14,5.8771144 11.3720398,4 8,4 Z M8,6 C9.1045695,6 10,6.8954305 10,8 C10,9.1045695 9.1045695,10 8,10 C6.8954305,10 6,9.1045695 6,8 C6,6.8954305 6.8954305,6 8,6 Z"></path></svg>'};function Tt(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function St(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}Tt(e,o)}return e}function xt(t){if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function At(t,e,n){const i=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return i.href}function kt(t){const e=function(t){if(!t.hasOwnProperty("hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t);let n;function i(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=xt(e.ignoreOtherConfiguration)?{}:St(t.document),{get annotations(){return n.annotations||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return At(t,"hypothesis-client","javascript")},get group(){return n.group||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return At(t,"notebook","html")},get showHighlights(){return function(){let t=i("showHighlights");return void 0===t&&(t="always"),"boolean"==typeof t?t?"always":"never":t}()},get sidebarAppUrl(){return At(t,"sidebar","html")},get query(){return n.query||function(){const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:i}}function Lt(t,e){return t.hostPageSetting(e)}const Nt={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:Lt},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:Lt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:xt,getValue:Lt},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},services:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.notebookAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:Lt},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:Lt}};function Rt(t="annotator",e=window){const n=kt(e),i={};let o=function(t){const e={annotator:["clientUrl","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t);return o.forEach((t=>{const o=Nt[t],r=void 0!==o.defaultValue,s=!((a=At(e,"sidebar","html")).startsWith("http://")||a.startsWith("https://"));var a;if(!o.allowInBrowserExt&&s)return void(r&&(i[t]=o.defaultValue));const l=o.getValue(n,t);void 0!==l?i[t]=o.coerce?o.coerce(l):l:r&&(i[t]=o.defaultValue)})),i}class Mt{constructor(){this._listeners=[]}add(t,e,n,i){t.addEventListener(e,n,i),this._listeners.push({eventTarget:t,eventType:e,listener:n})}removeAll(){this._listeners.forEach((({eventTarget:t,eventType:e,listener:n})=>{t.removeEventListener(e,n)})),this._listeners=[]}}class Ot{constructor(t,e){this._port=t,this._methods=e,this._sequence=0,this._callbacks={},this._destroyed=!1,this._listeners=new Mt,this._listeners.add(this._port,"message",(t=>this._handle(t))),this._port.start()}destroy(){this._destroyed=!0,this._listeners.removeAll(),this._port.close()}call(t,...e){if(this._destroyed)return;const n=this._sequence++,i=e[e.length-1];"function"==typeof i&&(this._callbacks[n]=i,e=e.slice(0,-1));const o={arguments:e,method:t,protocol:"frame-rpc",sequence:n,version:"1.0.0"};this._port.postMessage(o)}_parseMessage({data:t}){return t&&"object"==typeof t?"frame-rpc"!==t.protocol||"1.0.0"!==t.version?null:Array.isArray(t.arguments)?t:null:null}_handle(t){const e=this._parseMessage(t);if(null!==e)if("method"in e){if(!this._methods.hasOwnProperty(e.method))return;const t=(...t)=>{const n={arguments:t,protocol:"frame-rpc",response:e.sequence,version:"1.0.0"};this._port.postMessage(n)};this._methods[e.method](...e.arguments,t)}else if("response"in e){const t=this._callbacks[e.response];delete this._callbacks[e.response],t&&t(...e.arguments)}}}class Pt{constructor(){this.links=[],this.channelListeners={},this.onConnectListeners=[],this.on("connect",(t=>t()))}destroy(){this.links.forEach((t=>t.destroy())),this.links=[]}createChannel(t){const e=new Ot(t,this.channelListeners);let n=!1;return e.call("connect",(()=>{n||(n=!0,this.onConnectListeners.forEach((t=>t(e))))})),this.links.push(e),e}call(t,...e){let n;const i=e[e.length-1];"function"==typeof i&&(n=i,e=e.slice(0,-1));const o=t=>e=>{throw t.destroy(),this.links=this.links.filter((e=>e!==t)),e},r=this.links.map((n=>new Promise(((i,o)=>{const r=setTimeout((()=>i(null)),1e3);try{n.call(t,...e,((t,e)=>{clearTimeout(r),t?o(t):i(e)}))}catch(t){o(t)}})).catch(o(n))));let s=Promise.all(r);return n&&(s=s.then((t=>n(null,t))).catch((t=>n(t)))),s}on(t,e){if(this.links.length>0)throw new Error(`Listener '${t}' can't be registered because a channel has already been created`);if(this.channelListeners[t])throw new Error(`Listener '${t}' already bound in Bridge`);return this.channelListeners[t]=e,this}onConnect(t){return this.onConnectListeners.push(t),this}}const It={alt:1,ctrl:2,meta:4,shift:8};function Dt(t,e,{rootElement:n=document.body}={}){const i=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let i=0,o=null;for(let t of n){const e=It[t];if(e)i|=e;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=t}}if(!o)throw new Error(`Invalid shortcut: ${e}`);return((t.ctrlKey?It.ctrl:0)|(t.metaKey?It.meta:0)|(t.altKey?It.alt:0)|(t.shiftKey?It.shift:0))===i&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===o})(n,t)&&e(n)};return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}function Vt(t,e,{rootElement:n=document.body}={}){st((()=>{if(t)return Dt(t,e,{rootElement:n})}),[t,e,n])}function Ht({badgeCount:t,icon:e,label:n,onClick:i,shortcut:o}){Vt(o,i);const r=o?`${n} (${o})`:n;return gt("button",{className:"AdderToolbar__button",onClick:i,"aria-label":r,title:r,children:[e&&gt(_t,{name:e,className:"AdderToolbar__icon"}),"number"==typeof t&&gt("span",{className:"AdderToolbar__badge",children:t}),gt("span",{className:"AdderToolbar__label",children:n})]})}function Ft({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:i=0}){const o=e?"a":null,r=e?"h":null,s=e?"s":null;return Vt(e?"Escape":null,(()=>n("hide"))),gt("div",{className:Z("AdderToolbar",{"AdderToolbar--down":"up"===t,"AdderToolbar--up":"down"===t,"is-active":e}),style:{visibility:e?"visible":"hidden"},children:[gt("div",{className:"AdderToolbar__actions",children:[gt(Ht,{icon:"annotate",onClick:()=>n("annotate"),label:"Annotate",shortcut:o}),gt(Ht,{icon:"highlight",onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),i>0&&gt("div",{className:"AdderToolbar__separator"}),i>0&&gt(Ht,{badgeCount:i,onClick:()=>n("show"),label:"Show",shortcut:s})]}),gt(_t,{name:"pointer",inline:!0,className:Z("AdderToolbar__arrow",{"AdderToolbar__arrow--down":"down"===t,"AdderToolbar__arrow--up":"up"===t})})]})}const Bt=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function Ut(t){if(!t.attachShadow)return qt(t),t;const e=t.attachShadow({mode:"open"});!function(t){var e;const n=null===(e=document.querySelector('link[rel="stylesheet"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const i=document.createElement("link");i.rel="stylesheet",i.href=n,t.appendChild(i)}(e);const n=window.applyFocusVisiblePolyfill;return n&&n(e),qt(e),e}function qt(t){t.addEventListener("mouseup",(t=>t.stopPropagation())),t.addEventListener("mousedown",(t=>t.stopPropagation())),t.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0})}function Wt(t){return t.toString()+"px"}class jt{constructor(t,e){this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),this._shadowRoot=Ut(this._outerContainer),Object.assign(this._outerContainer.style,{position:"absolute",top:0,left:0}),this._view=t.ownerDocument.defaultView,this._width=()=>this._shadowRoot.firstChild.getBoundingClientRect().width,this._height=()=>this._shadowRoot.firstChild.getBoundingClientRect().height,this._isVisible=!1,this._arrowDirection="up",this._onAnnotate=e.onAnnotate,this._onHighlight=e.onHighlight,this._onShowAnnotations=e.onShowAnnotations,this.annotationsForSelection=[],this._render()}hide(){this._isVisible=!1,this._render(),Object.assign(this._outerContainer.style,{top:0,left:0})}destroy(){M(null,this._shadowRoot),this._outerContainer.remove()}show(t,e){const{left:n,top:i,arrowDirection:o}=this._calculateTarget(t,e);this._showAt(n,i),this._isVisible=!0,this._arrowDirection=2===o?"up":"down",this._render()}_calculateTarget(t,e){let n,i,o;n=e&&!Bt()?1:2;const r=Math.min(20,t.width),s=this._width(),a=Bt()?10:0,l=this._height();return o=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-l<0&&1===n?n=2:t.top+l>this._view.innerHeight&&(n=1),i=2===n?t.top+t.height+10+a:t.top-l-10,o=Math.max(o,0),o=Math.min(o,this._view.innerWidth-s),i=Math.max(i,0),i=Math.min(i,this._view.innerHeight-l),{top:i,left:o,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),i=this._height(),o=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+i),...document.elementsFromPoint(t+n/2,e+i/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+i)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return o.push(0),Math.max(...o)+1}_showAt(t,e){const n=function(t){let e=t.parentElement;for(;e.parentElement&&"static"===getComputedStyle(e).position;)e=e.parentElement;return e}(this._outerContainer).getBoundingClientRect(),i=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:Wt(t-n.left),top:Wt(e-n.top),zIndex:i})}_render(){M(gt(Ft,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this._onAnnotate(),this.hide();break;case"highlight":this._onHighlight(),this.hide();break;case"show":this._onShowAnnotations(this.annotationsForSelection);break;case"hide":this.hide()}},annotationCount:this.annotationsForSelection.length}),this._shadowRoot)}}class $t{constructor(t,e){this._emitter=t.createEmitter(),this._sidebar=e,this.cache={},this.destroyed=!1,this._sidebar.on("deleteAnnotation",((t,e)=>{if(this.destroyed)return void e(null);const n=this._parse(t);delete this.cache[n.$tag],this._emitter.publish("annotationDeleted",n),this._format(n),e(null)})),this._sidebar.on("loadAnnotations",((t,e)=>{if(this.destroyed)return void e(null);const n=t.map((t=>this._parse(t)));this._emitter.publish("annotationsLoaded",n),e(null)})),this._emitter.subscribe("beforeAnnotationCreated",(t=>{t.$tag||this._sidebar.call("createAnnotation",this._format(t))}))}sync(t){this.destroyed||this._sidebar.call("syncAnchoringStatus",t.map((t=>this._format(t))))}_tag(t,e){return t.$tag||(e=e||window.btoa(Math.random().toString()),Object.defineProperty(t,"$tag",{value:e}),this.cache[e]=t),t}_parse(t){const e=Object.assign(this.cache[t.tag]||{},t.msg);return this._tag(e,t.tag)}_format(t){return this._tag(t),{tag:t.$tag,msg:t}}destroy(){this.destroyed=!0,this._emitter.destroy()}}function zt(t){switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return t.textContent.length;default:return 0}}function Xt(t){let e=t.previousSibling,n=0;for(;e;)n+=zt(e),e=e.previousSibling;return n}function Yt(t,...e){let n=e.shift();const i=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),o=[];let r,s=i.nextNode(),a=0;for(;void 0!==n&&s;)r=s,a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}class Gt{constructor(t,e){if(e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,n=this.offset;for(;e!==t;)n+=Xt(e),e=e.parentElement;return new Gt(e,n)}resolve(t={}){try{return Yt(this.element,this.offset)[0]}catch(e){if(0===this.offset&&void 0!==t.direction){const n=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);n.currentNode=this.element;const i=1===t.direction,o=i?n.nextNode():n.previousNode();if(!o)throw e;return{node:o,offset:i?0:o.data.length}}throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return Gt.fromPoint(t,e);case Node.ELEMENT_NODE:return new Gt(t,e);default:throw new Error("Node is not an element or text node")}}static fromPoint(t,e){switch(t.nodeType){case Node.TEXT_NODE:{if(e<0||e>t.data.length)throw new Error("Text node offset is out of range");if(!t.parentElement)throw new Error("Text node has no parent");const n=Xt(t)+e;return new Gt(t.parentElement,n)}case Node.ELEMENT_NODE:{if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let i=0;i<e;i++)n+=zt(t.childNodes[i]);return new Gt(t,n)}default:throw new Error("Point is not in an element or text node")}}}class Zt{constructor(t,e){this.start=t,this.end=e}relativeTo(t){return new Zt(this.start.relativeTo(t),this.end.relativeTo(t))}toRange(){let t,e;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[t,e]=Yt(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:1}),e=this.end.resolve({direction:2}));const n=new Range;return n.setStart(t.node,t.offset),n.setEnd(e.node,e.offset),n}static fromRange(t){const e=Gt.fromPoint(t.startContainer,t.startOffset),n=Gt.fromPoint(t.endContainer,t.endOffset);return new Zt(e,n)}static fromOffsets(t,e,n){return new Zt(new Gt(t,e),new Gt(t,n))}}function Kt(t){return!!t.parentElement&&null!==t.parentElement.closest(".annotator-placeholder")}function Jt(t){if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function Qt(t,e){try{var n,i;const o=null!==(n=null===(i=e.nodeValue)||void 0===i?void 0:i.length)&&void 0!==n?n:e.childNodes.length;return t.comparePoint(e,0)<=0&&t.comparePoint(e,o)>=0}catch(t){return!1}}function te(t,e){const n=t.commonAncestorContainer,i=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let o;for(;o=i.nextNode();)Qt(t,o)&&e(o)}function ee(t){if(t.isCollapsed)return null;const e=function(t){const e=/^\s*$/,n=[];te(t,(t=>{t.nodeType!==Node.TEXT_NODE||t.textContent.match(e)||n.push(t)}));let i=[];return n.forEach((e=>{const n=e.ownerDocument.createRange();if(n.selectNodeContents(e),e===t.startContainer&&n.setStart(e,t.startOffset),e===t.endContainer&&n.setEnd(e,t.endOffset),n.collapsed)return;const o=Array.from(n.getClientRects());n.detach(),i=i.concat(o)})),i}(t.getRangeAt(0));return 0===e.length?null:Jt(t)?e[0]:e[e.length-1]}function ne(t,e="hypothesis-highlight"){const n=function(t){if(t.collapsed)return[];let e=t.commonAncestorContainer;if(e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentElement),!e)return[];const n=[],i=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let o;for(;o=i.nextNode();){if(!Qt(t,o))continue;let e=o;e===t.startContainer&&t.startOffset>0?e.splitText(t.startOffset):(e===t.endContainer&&t.endOffset<e.data.length&&e.splitText(t.endOffset),n.push(e))}return n}(t),i=n.length>0&&Kt(n[0]);let o=[],r=null,s=null;n.forEach((t=>{r&&r.nextSibling===t?s.push(t):(s=[t],o.push(s)),r=t}));const a=/^\s*$/;o=o.filter((t=>t.some((t=>!a.test(t.nodeValue)))));const l=[];return o.forEach((t=>{const n=document.createElement("hypothesis-highlight");n.className=e,t[0].parentNode.replaceChild(n,t[0]),t.forEach((t=>n.appendChild(t))),l.push(n)})),i||function(t){if(0===t.length)return;const e=function(t){const e=t.closest(".page");return e&&e.querySelector(".canvasWrapper > canvas")||null}(t[0]);if(!e||!e.parentElement)return;let n=e.parentElement.querySelector(".hypothesis-highlight-layer");const i=CSS.supports("mix-blend-mode","multiply");if(!n){n=document.createElementNS("http://www.w3.org/2000/svg","svg"),n.setAttribute("class","hypothesis-highlight-layer"),e.parentElement.appendChild(n),e.parentElement.style.position="relative";const t=n.style;t.position="absolute",t.left="0",t.top="0",t.width="100%",t.height="100%",i?t.mixBlendMode="multiply":t.opacity="0.3"}const o=e.getBoundingClientRect(),r=t.map((t=>{const e=t.getBoundingClientRect(),n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute("x",(e.left-o.left).toString()),n.setAttribute("y",(e.top-o.top).toString()),n.setAttribute("width",e.width.toString()),n.setAttribute("height",e.height.toString()),i?n.setAttribute("class","hypothesis-svg-highlight"):n.setAttribute("class","hypothesis-svg-highlight is-opaque"),t.classList.add("is-transparent"),t.svgHighlight=n,n}));n.append(...r)}(l),l}function ie(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function oe(t){for(let e of t){if(e.parentNode){ie(e,Array.from(e.childNodes))}e.svgHighlight&&e.svgHighlight.remove()}}function re(t,e){t.forEach((t=>{if(t.svgHighlight){if(t.svgHighlight.classList.toggle("is-focused",e),e){t.svgHighlight.parentNode.append(t.svgHighlight)}}else t.classList.toggle("hypothesis-highlight-focused",e)}))}function se(t){const e=t.map((t=>t.getBoundingClientRect()));return e.reduce(((t,e)=>({top:Math.min(t.top,e.top),left:Math.min(t.left,e.left),bottom:Math.max(t.bottom,e.bottom),right:Math.max(t.right,e.right)})))}var ae=/^\s+|\s+$/g,le=/^[-+]0x[0-9a-f]+$/i,ce=/^0b[01]+$/i,he=/^0o[0-7]+$/i,ue=parseInt,de="object"==typeof t&&t&&t.Object===Object&&t,fe="object"==typeof self&&self&&self.Object===Object&&self,pe=de||fe||Function("return this")(),ge=Object.prototype.toString,me=Math.max,_e=Math.min,ve=function(){return pe.Date.now()};function ye(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function we(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==ge.call(t)}(t))return NaN;if(ye(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ye(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ae,"");var n=ce.test(t);return n||he.test(t)?ue(t.slice(2),n?2:8):le.test(t)?NaN:+t}var be=function(t,e,n){var i,o,r,s,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=i,r=o;return i=o=void 0,c=e,s=t.apply(r,n)}function p(t){return c=t,a=setTimeout(m,e),h?f(t):s}function g(t){var n=t-l;return void 0===l||n>=e||n<0||u&&t-c>=r}function m(){var t=ve();if(g(t))return _(t);a=setTimeout(m,function(t){var n=e-(t-l);return u?_e(n,r-(t-c)):n}(t))}function _(t){return a=void 0,d&&i?f(t):(i=o=void 0,s)}function v(){var t=ve(),n=g(t);if(i=arguments,o=this,l=t,n){if(void 0===a)return p(l);if(u)return a=setTimeout(m,e),f(l)}return void 0===a&&(a=setTimeout(m,e)),s}return e=we(e)||0,ye(n)&&(h=!!n.leading,r=(u="maxWait"in n)?me(we(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=o=a=void 0},v.flush=function(){return void 0===a?s:_(ve())},v};class Ce{constructor(t,e,n){this._element=t,this._onFrameAdded=e,this._onFrameRemoved=n,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(be((()=>{this._discoverFrames()}),40)),this._discoverFrames(),this._mutationObserver.observe(this._element,{childList:!0,subtree:!0,attributeFilter:["enable-annotation"]})}disconnect(){this._isDisconnected=!0,this._mutationObserver.disconnect()}async _addFrame(t){this._annotatableFrames.add(t);try{if(await Ee(t),this._isDisconnected)return;t.contentWindow.addEventListener("unload",(()=>{this._removeFrame(t)})),this._onFrameAdded(t)}catch(e){console.warn(`Unable to inject the Hypothesis client (from '${document.location.href}' into a cross-origin frame '${t.src}')`)}}_removeFrame(t){this._annotatableFrames.delete(t),this._onFrameRemoved(t)}_discoverFrames(){const t=new Set(this._element.querySelectorAll("iframe[enable-annotation]"));for(let e of t)this._annotatableFrames.has(e)||this._addFrame(e);for(let e of this._annotatableFrames)t.has(e)||this._removeFrame(e)}}function Ee(t){return new Promise((e=>{const n=t.contentWindow.document,{readyState:i,location:o}=n;"about:blank"===o.href&&t.hasAttribute("src")&&"about:blank"!==t.src?t.addEventListener("load",(()=>{e()})):"loading"!==i?e():n.addEventListener("DOMContentLoaded",(()=>e()))}))}class Te{constructor(t,e){this._config=e,this._frameObserver=new Ce(t,(t=>this.injectClient(t)),(()=>{}))}destroy(){this._frameObserver.disconnect()}async injectClient(t){if("__hypothesis"in t.contentWindow)return;await Ee(t);const{assetRoot:e,notebookAppUrl:n,sidebarAppUrl:i}=St(document),o=Math.random().toString().replace(/\D/g,""),r={...this._config,assetRoot:e,notebookAppUrl:n,sidebarAppUrl:i,subFrameIdentifier:o},{clientUrl:s}=this._config;!function(t,e,n){const i=document.createElement("script");i.className="js-hypothesis-config",i.type="application/json",i.innerText=JSON.stringify(n);const o=document.createElement("script");o.async=!0,o.src=e;const r=t.contentDocument;r.body.appendChild(i),r.body.appendChild(o)}(t,s,r)}}function Se(t,e,n){t.self===t?t.scrollTo(e,n):(t.scrollLeft=e,t.scrollTop=n)}function xe(t){var e=t._scrollSettings;if(e){var n=e.maxSynchronousAlignments,i=function(t,e){var n,i,o,r,s,a,l,c=t.align,h=t.target.getBoundingClientRect(),u=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,f=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,g=u,m=d;if(t.isWindow(e))a=Math.min(h.width,e.innerWidth),l=Math.min(h.height,e.innerHeight),i=h.left+e.pageXOffset-e.innerWidth*g+a*g,o=h.top+e.pageYOffset-e.innerHeight*m+l*m,i-=f,o-=p,i=t.align.lockX?e.pageXOffset:i,o=t.align.lockY?e.pageYOffset:o,r=i-e.pageXOffset,s=o-e.pageYOffset;else{a=h.width,l=h.height,n=e.getBoundingClientRect();var _=h.left-(n.left-e.scrollLeft),v=h.top-(n.top-e.scrollTop);i=_+a*g-e.clientWidth*g,o=v+l*m-e.clientHeight*m,i-=f,o-=p,i=Math.max(Math.min(i,e.scrollWidth-e.clientWidth),0),o=Math.max(Math.min(o,e.scrollHeight-e.clientHeight),0),i=t.align.lockX?e.scrollLeft:i,o=t.align.lockY?e.scrollTop:o,r=i-e.scrollLeft,s=o-e.scrollTop}return{x:i,y:o,differenceX:r,differenceY:s}}(e,t),o=Date.now()-e.startTime,r=Math.min(1/e.time*o,1);if(e.endIterations>=n)return Se(t,i.x,i.y),t._scrollSettings=null,e.end("complete");var s=1-e.ease(r);if(Se(t,i.x-i.differenceX*s,i.y-i.differenceY*s),o>=e.time)return e.endIterations++,e.scrollAncestor&&xe(e.scrollAncestor),void xe(t);!function(t){if("requestAnimationFrame"in window)return window.requestAnimationFrame(t);setTimeout(t,16)}(xe.bind(null,t))}}function Ae(t){return t.self===t}function ke(t){return"pageXOffset"in t||(t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth)&&"hidden"!==getComputedStyle(t).overflow}function Le(){return!0}function Ne(t){if(t.assignedSlot)return Ne(t.assignedSlot);if(t.parentElement)return"BODY"===t.parentElement.tagName?t.parentElement.ownerDocument.defaultView||t.parentElement.ownerDocument.ownerWindow:t.parentElement;if(t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e.host}}var Re=function(t,e,n){if(t){"function"==typeof e&&(n=e,e=null),e||(e={}),e.time=isNaN(e.time)?1e3:e.time,e.ease=e.ease||function(t){return 1-Math.pow(1-t,t/2)},e.align=e.align||{};var i=Ne(t),o=1,r=e.validTarget||Le,s=e.isScrollable;e.debug&&(console.log("About to scroll to",t),i||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var a=[];i;)if(e.debug&&console.log("Scrolling parent node",i),r(i,o)&&(s?s(i,ke):ke(i))&&(o++,a.push(i)),!(i=Ne(i))){l("complete");break}return a.reduce(((n,i,o)=>function(t,e,n,i,o){var r,s=!e._scrollSettings,a=e._scrollSettings,l=Date.now(),c={passive:!0};function h(t){e._scrollSettings=null,e.parentElement&&e.parentElement._scrollSettings&&e.parentElement._scrollSettings.end(t),n.debug&&console.log("Scrolling ended with type",t,"for",e),o(t),r&&(e.removeEventListener("touchstart",r,c),e.removeEventListener("wheel",r,c))}a&&a.end("canceled");var u=n.maxSynchronousAlignments;return null==u&&(u=3),e._scrollSettings={startTime:l,endIterations:0,target:t,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||Ae,maxSynchronousAlignments:u,end:h,scrollAncestor:i},"cancellable"in n&&!n.cancellable||(r=h.bind(null,"canceled"),e.addEventListener("touchstart",r,c),e.addEventListener("wheel",r,c)),s&&xe(e),r}(t,i,e,a[o+1],l)),null)}function l(t){--o||n&&n(t)}},Me={};function Oe(t){return t.split("").reverse().join("")}function Pe(t){return(t|-t)>>31&1}function Ie(t,e,n,i){var o=t.P[n],r=t.M[n],s=i>>>31,a=e[n]|s,l=a|r,c=(a&o)+o^o|a,h=r|~(c|o),u=o&c,d=Pe(h&t.lastRowMask[n])-Pe(u&t.lastRowMask[n]);return h<<=1,u<<=1,o=(u|=s)|~(l|(h|=Pe(i)-s)),r=h&l,t.P[n]=o,t.M[n]=r,d}function De(t,e,n){if(0===e.length)return[];n=Math.min(n,e.length);var i=[],o=32,r=Math.ceil(e.length/o)-1,s={P:new Uint32Array(r+1),M:new Uint32Array(r+1),lastRowMask:new Uint32Array(r+1)};s.lastRowMask.fill(1<<31),s.lastRowMask[r]=1<<(e.length-1)%o;for(var a=new Uint32Array(r+1),l=new Map,c=[],h=0;h<256;h++)c.push(a);for(var u=0;u<e.length;u+=1){var d=e.charCodeAt(u);if(!l.has(d)){var f=new Uint32Array(r+1);l.set(d,f),d<c.length&&(c[d]=f);for(var p=0;p<=r;p+=1){f[p]=0;for(var g=0;g<o;g+=1){var m=p*o+g;if(!(m>=e.length))e.charCodeAt(m)===d&&(f[p]|=1<<g)}}}}var _=Math.max(0,Math.ceil(n/o)-1),v=new Uint32Array(r+1);for(p=0;p<=_;p+=1)v[p]=(p+1)*o;v[r]=e.length;for(p=0;p<=_;p+=1)s.P[p]=-1,s.M[p]=0;for(var y=0;y<t.length;y+=1){var w=t.charCodeAt(y);f=void 0;w<c.length?f=c[w]:void 0===(f=l.get(w))&&(f=a);var b=0;for(p=0;p<=_;p+=1)b=Ie(s,f,p,b),v[p]+=b;if(v[_]-b<=n&&_<r&&(1&f[_+1]||b<0)){_+=1,s.P[_]=-1,s.M[_]=0;var C=_===r?e.length%o:o;v[_]=v[_-1]+C-b+Ie(s,f,_,b)}else for(;_>0&&v[_]>=n+o;)_-=1;_===r&&v[_]<=n&&(v[_]<n&&i.splice(0,i.length),i.push({start:-1,end:y+1,errors:v[_]}),n=v[_])}return i}Object.defineProperty(Me,"__esModule",{value:!0});var Ve=Me.default=function(t,e,n){return function(t,e,n){var i=Oe(e);return n.map((function(n){var o=Math.max(0,n.end-e.length-n.errors);return{start:De(Oe(t.slice(o,n.end)),i,n.errors).reduce((function(t,e){return n.end-e.end<t?n.end-e.end:t}),n.end),end:n.end,errors:n.errors}}))}(t,e,De(t,e,n))};function He(t,e,n){let i=0,o=[];for(;-1!==i;)i=t.indexOf(e,i),-1!==i&&(o.push({start:i,end:i+e.length,errors:0}),i+=1);return o.length>0?o:Ve(t,e,n)}function Fe(t,e){if(0===e.length||0===t.length)return 0;return 1-He(t,e,e.length)[0].errors/e.length}function Be(t,e,n={}){if(0===e.length)return null;const i=Math.min(256,e.length/2),o=He(t,e,i);if(0===o.length)return null;const r=i=>{const o=1-i.errors/e.length,r=n.prefix?Fe(t.slice(Math.max(0,i.start-n.prefix.length),i.start),n.prefix):1,s=n.suffix?Fe(t.slice(i.end,i.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){a=1-Math.abs(i.start-n.hint)/t.length}return(50*o+20*r+20*s+2*a)/92},s=o.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function Ue(t){const e=function(t){const e=t.nodeName.toLowerCase();let n=e;return"#text"===e&&(n="text()"),n}(t),n=function(t){let e=0,n=t;for(;n;)n.nodeName===t.nodeName&&(e+=1),n=n.previousSibling;return e}(t);return`${e}[${n}]`}function qe(t,e){let n="",i=t;for(;i!==e;){if(!i)throw new Error("Node is not a descendant of root");n=Ue(i)+"/"+n,i=i.parentNode}return n="/"+n,n=n.replace(/\/$/,""),n}function We(t,e,n){e=e.toUpperCase();let i=-1;for(let o=0;o<t.children.length;o++){const r=t.children[o];if(r.nodeName.toUpperCase()===e&&(++i,i===n))return r}return null}function je(t,e=document.body){try{return function(t,e){if(null===t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+\])?)+$/))throw new Error("Expression is not a simple XPath");const n=t.split("/");let i=e;n.shift();for(let t of n){let e,n;const o=t.indexOf("[");if(-1!==o){e=t.slice(0,o);const i=t.slice(o+1,t.indexOf("]"));if(n=parseInt(i)-1,n<0)return null}else e=t,n=0;const r=We(i,e,n);if(!r)return null;i=r}return i}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class $e{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new $e(t,e)}static fromSelector(t,e){const n=je(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const i=je(e.endContainer,t);if(!i)throw new Error("Failed to resolve endContainer XPath");const o=Gt.fromCharOffset(n,e.startOffset),r=Gt.fromCharOffset(i,e.endOffset),s=new Zt(o,r).toRange();return new $e(t,s)}toRange(){return this.range}toSelector(){const t=Zt.fromRange(this.range).toRange(),e=Zt.fromRange(t),n=qe(e.start.element,this.root),i=qe(e.end.element,this.root);return{type:"RangeSelector",startContainer:n,startOffset:e.start.offset,endContainer:i,endOffset:e.end.offset}}}class ze{constructor(t,e,n){this.root=t,this.start=e,this.end=n}static fromRange(t,e){const n=Zt.fromRange(e).relativeTo(t);return new ze(t,n.start.offset,n.end.offset)}static fromSelector(t,e){return new ze(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return Zt.fromOffsets(this.root,this.start,this.end).toRange()}}class Xe{constructor(t,e,n={}){this.root=t,this.exact=e,this.context=n}static fromRange(t,e){const n=t.textContent,i=Zt.fromRange(e).relativeTo(t),o=i.start.offset,r=i.end.offset;return new Xe(t,n.slice(o,r),{prefix:n.slice(Math.max(0,o-32),o),suffix:n.slice(r,Math.min(n.length,r+32))})}static fromSelector(t,e){const{prefix:n,suffix:i}=e;return new Xe(t,e.exact,{prefix:n,suffix:i})}toSelector(){return{type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(t={}){return this.toPositionAnchor(t).toRange()}toPositionAnchor(t={}){const e=Be(this.root.textContent,this.exact,{...this.context,hint:t.hint});if(!e)throw new Error("Quote not found");return new ze(this.root,e.start,e.end)}}async function Ye(t,e={}){return t.toRange(e)}function Ge(t,e,n={}){let i=null,o=null,r=null;for(let t of e)switch(t.type){case"TextPositionSelector":i=t,n.hint=i.start;break;case"TextQuoteSelector":o=t;break;case"RangeSelector":r=t}const s=t=>{var e;if(null!==(e=o)&&void 0!==e&&e.exact&&t.toString()!==o.exact)throw new Error("quote mismatch");return t};let a=Promise.reject("unable to anchor");return r&&(a=a.catch((()=>Ye($e.fromSelector(t,r),n).then(s)))),i&&(a=a.catch((()=>Ye(ze.fromSelector(t,i),n).then(s)))),o&&(a=a.catch((()=>Ye(Xe.fromSelector(t,o),n)))),a}function Ze(t,e){const n=[$e,ze,Xe],i=[];for(let o of n)try{const n=o.fromRange(t,e);i.push(n.toSelector())}catch(t){continue}return i}function Ke(t,e=document.baseURI){return new URL(t,e).href.toString().replace(/#.*/,"")}class Je{constructor(t={}){this.document=t.document||document}uri(){let t=decodeURIComponent(this._getDocumentHref());const e=this._getLinks();for(let n of e)"canonical"===n.rel&&(t=n.href);return t}getDocumentMetadata(){const t={title:document.title,link:[],dc:this._getMetaTags("dc","name","."),eprints:this._getMetaTags("eprints","name","."),facebook:this._getMetaTags("og","property",":"),highwire:this._getMetaTags("citation","name","_"),prism:this._getMetaTags("prism","name","."),twitter:this._getMetaTags("twitter","name",":")},e=this._getFavicon();e&&(t.favicon=e),t.title=this._getTitle(t),t.link=this._getLinks(t);const n=t.link.find((t=>t.href.startsWith("urn:x-dc")));return n&&(t.documentFingerprint=n.href),t}_getMetaTags(t,e,n){const i={};for(let o of Array.from(this.document.querySelectorAll("meta"))){const r=o.getAttribute(e),{content:s}=o;if(r){const e=r.match(RegExp(`^${t}${n}(.+)$`,"i"));if(e){const t=e[1];i[t]?i[t].push(s):i[t]=[s]}}}return i}_getTitle(t){return t.highwire.title?t.highwire.title[0]:t.eprints.title?t.eprints.title[0]:t.prism.title?t.prism.title[0]:t.facebook.title?t.facebook.title[0]:t.twitter.title?t.twitter.title[0]:t.dc.title?t.dc.title[0]:this.document.title}_getLinks(t={dc:{},highwire:{}}){const e=[{href:this._getDocumentHref()}],n=Array.from(this.document.querySelectorAll("link"));for(let t of n)if(["alternate","canonical","bookmark","shortlink"].includes(t.rel)){if("alternate"===t.rel){if(t.type&&t.type.match(/^application\/(rss|atom)\+xml/))continue;if(t.hreflang)continue}try{const n=this._absoluteUrl(t.href);e.push({href:n,rel:t.rel,type:t.type})}catch(t){}}for(let n of Object.keys(t.highwire)){const i=t.highwire[n];if("pdf_url"===n)for(let t of i)try{e.push({href:this._absoluteUrl(t),type:"application/pdf"})}catch(t){}if("doi"===n)for(let t of i)"doi:"!==t.slice(0,4)&&(t=`doi:${t}`),e.push({href:t})}for(let n of Object.keys(t.dc)){const i=t.dc[n];if("identifier"===n)for(let t of i)"doi:"===t.slice(0,4)&&e.push({href:t})}const i=t.dc["relation.ispartof"],o=t.dc.identifier;if(i&&o){const t=i[i.length-1],n=o[o.length-1],r="urn:x-dc:"+encodeURIComponent(t)+"/"+encodeURIComponent(n);e.push({href:r})}return e}_getFavicon(){let t=null;for(let e of Array.from(this.document.querySelectorAll("link")))if(["shortcut icon","icon"].includes(e.rel))try{t=this._absoluteUrl(e.href)}catch(t){}return t}_absoluteUrl(t){return Ke(t,this.document.baseURI)}_getDocumentHref(){const{href:t}=this.document.location,e=["http:","https:","file:"],n=new URL(t).protocol;return e.includes(n)?t:this.document.baseURI&&e.includes(new URL(this.document.baseURI).protocol)?this.document.baseURI:t}}class Qe{constructor(t=document.body){this.container=t,this.anchor=Ge,this.describe=Ze,this._htmlMeta=new Je}canAnnotate(){return!0}destroy(){}contentContainer(){return this.container}fitSideBySide(){return!1}async getMetadata(){return this._htmlMeta.getDocumentMetadata()}async uri(){return this._htmlMeta.uri()}scrollToAnchor(t){const e=t.highlights;return new Promise((t=>{Re(e[0],t)}))}}let tn={};function en(...t){const e=t.join();e in tn||(console.warn(...t),tn[e]=!0)}en.reset=()=>{tn={}};const nn=0,on=3,rn=new Map,sn=new Map;function an(t,e){return`${t}:${e}`}function ln(t){var e;const n="closest"in t?t:t.parentElement;return null!==(e=null==n?void 0:n.closest(".textLayer"))&&void 0!==e?e:null}function cn(){return PDFViewerApplication.pdfViewer}async function hn(t){const e=cn();let n=e.getPageView(t);return n&&n.pdfPage||(n=await new Promise((n=>{const i=()=>{e.eventBus?e.eventBus.off("pagesloaded",i):document.removeEventListener("pagesloaded",i),n(e.getPageView(t))};e.eventBus?e.eventBus.on("pagesloaded",i):document.addEventListener("pagesloaded",i)}))),n}function un(t){const e=rn.get(t);if(e)return e;const n=(async()=>{const e=await hn(t);let n=(await e.pdfPage.getTextContent({normalizeWhitespace:!0})).items;return n.length>0&&!("hasEOL"in n[0])&&(n=n.filter((t=>/\S/.test(t.str)))),n.map((t=>t.str)).join("")})();return rn.set(t,n),n}async function dn(t){const e=cn();let n=0,i=0,o="";for(let r=0;r<e.pagesCount;r++)if(o=await un(r),n=i,i+=o.length,i>=t)return{index:r,offset:n,text:o};return{index:e.pagesCount-1,offset:n,text:o}}async function fn(t,e,n){const[i,o]=await Promise.all([hn(t),un(t)]);if(i.renderingState===on&&i.textLayer&&i.textLayer.renderingDone){const t=i.textLayer.textLayerDiv;o!==t.textContent&&en("PDF text layer content does not match page text. This will cause anchoring misalignment.");const r=new Gt(t,e),s=new Gt(t,n);return new Zt(r,s).toRange()}const r=function(t){let e=t.querySelector(".annotator-placeholder");return e||(e=document.createElement("span"),e.classList.add("annotator-placeholder"),e.textContent="Loading annotations...",t.appendChild(e),e)}(i.div),s=document.createRange();return s.setStartBefore(r),s.setEndAfter(r),s}function pn(t){const e=[];let n="";for(let i=0;i<t.length;i++){const o=t[i];" "!==o&&"\t"!==o&&"\n"!==o&&(n+=o,e.push(i))}return[n,e]}async function gn(t,e){const n=e.find((t=>"TextQuoteSelector"===t.type));if(!n)throw new Error("No quote selector found");const i=e.find((t=>"TextPositionSelector"===t.type));if(i){try{const{index:t,offset:e,text:o}=await dn(i.start),r=i.start-e,s=i.end-e,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await fn(t,r,s)}catch{}try{const t=an(n.exact,i.start),e=sn.get(t);if(e){const{pageIndex:t,anchor:n}=e;return await fn(t,n.start,n.end)}}catch{}}return async function(t,e){const n=cn().pagesCount,i=Array(n).fill(0).map(((t,e)=>e));let o,r;if(e){const{index:t,offset:n}=await dn(e);o=t,r=e-n,i.sort(((e,n)=>Math.abs(e-t)-Math.abs(n-t)))}const[s]=void 0!==t.prefix?pn(t.prefix):[],[a]=void 0!==t.suffix?pn(t.suffix):[],[l]=pn(t.exact);let c;for(let t of i){const e=await un(t),[n,i]=pn(e);let h;if(void 0!==o&&void 0!==r){let n;for(n=t<o?e.length:t===o?r:0,h=0;h<i.length&&i[h]<n;)++h}const u=Be(n,l,{prefix:s,suffix:a,hint:h});if(u&&(!c||u.score>c.match.score)){c={page:t,match:{start:i[u.start],end:i[u.end-1]+1,score:u.score}};const e=n.slice(u.start,u.end)===l,o=void 0!==s&&n.slice(Math.max(0,u.start-s.length),u.start)===s,r=void 0!==a&&n.slice(u.end,a.length)===a,h=void 0!==s||void 0!==a;if(e&&(o||r||!h))break}}if(c){const{page:n,match:i}=c;if(e){const o=an(t.exact,e);sn.set(o,{pageIndex:n,anchor:i})}return fn(n,i.start,i.end)}throw new Error("Quote not found")}(n,null==i?void 0:i.start)}function mn(t){try{t=Zt.fromRange(t).toRange()}catch{throw new Error("Selection does not contain text")}const e=ln(t.startContainer),n=ln(t.endContainer);if(!e||!n)throw new Error("Selection is outside page text");if(e!==n)throw new Error("Selecting across page breaks is not supported");return[t,e]}async function _n(t,e){const[n,i]=mn(e),o=Gt.fromPoint(n.startContainer,n.startOffset).relativeTo(i),r=Gt.fromPoint(n.endContainer,n.endOffset).relativeTo(i),s=function(t){let e=0;for(;t.previousSibling;)++e,t=t.previousSibling;return e}(i.parentNode),a=await async function(t){if(t>=cn().pagesCount)throw new Error("Invalid page index");let e=0;for(let n=0;n<t;n++)e+=(await un(n)).length;return e}(s);return[{type:"TextPositionSelector",start:a+o.offset,end:a+r.offset},Xe.fromRange(t,n).toSelector()]}function vn(){return gt("div",{className:"WarningBanner WarningBanner--notice",children:[gt("div",{className:"WarningBanner__type",children:gt(_t,{name:"caution",className:"WarningBanner__icon"})}),gt("div",{className:"WarningBanner__message",children:[gt("strong",{children:"This PDF does not contain selectable text:"})," ",gt("a",{target:"_blank",rel:"noreferrer",href:"https://web.hypothes.is/help/how-to-ocr-optimize-pdfs/",children:"Learn how to fix this"})," ","in order to annotate with Hypothesis."]})]})}function yn(t,e,n){return t+n*(e-t)}async function wn(t,e,{maxDuration:n=500}={}){const i=t.scrollTop,o=e,r=Date.now(),s=Math.min(Math.abs(o-i)/3,n);let a=0;for(;a<1;)await new Promise((t=>{requestAnimationFrame(t)})),a=Math.min(1,(Date.now()-r)/s),t.scrollTop=yn(i,o,a)}class bn{constructor(t){this._loaded=function(t){return t.initializedPromise?t.initializedPromise:t.initialized?Promise.resolve():new Promise((e=>{const n=setInterval((()=>{t.initialized&&(clearTimeout(n),e())}),5)}))}(t).then((()=>t.downloadComplete?t:new Promise((e=>{const n=()=>{t.eventBus?(t.eventBus.off("documentload",n),t.eventBus.off("documentloaded",n)):window.removeEventListener("documentload",n),e(t)};t.eventBus?(t.eventBus.on("documentloaded",n),t.eventBus.on("documentload",n)):window.addEventListener("documentload",n)}))))}getUri(){return this._loaded.then((t=>{let e=Tn(t);return e||(e=En(Cn(t))),e}))}async getMetadata(){const t=await this._loaded,{info:e,contentDispositionFilename:n,metadata:i}=await t.pdfDocument.getMetadata(),o=Cn(t),r=Tn(t);let s;s=null!=i&&i.has("dc:title")&&"Untitled"!==i.get("dc:title")?i.get("dc:title"):null!=e&&e.Title?e.Title:n||(r?function(t){const e=new URL(t).pathname.split("/");return e[e.length-1]}(r):"");const a=[{href:En(o)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:o}}}function Cn(t){return Array.isArray(t.pdfDocument.fingerprints)?t.pdfDocument.fingerprints[0]:t.pdfDocument.fingerprint}function En(t){return`urn:x-pdf:${t}`}function Tn(t){if(!t.url)return null;const e=Ke(t.url);return 0!==e.indexOf("file://")?e:null}function Sn(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];return n&&Kt(n)}function xn(t){return new Promise((e=>setTimeout(e,t)))}class An{constructor(t,e={}){var n,i,o;this.annotator=t;const r=window,s=r.PDFViewerApplication;this.pdfViewer=s.pdfViewer,this.pdfViewer.viewer.classList.add("has-transparent-text-layer"),this.pdfContainer=null!==(n=null===(i=s.appConfig)||void 0===i?void 0:i.appContainer)&&void 0!==n?n:document.body,this.pdfMetadata=new bn(s),this.observer=new MutationObserver(be((()=>this._update()),100)),this.observer.observe(this.pdfViewer.viewer,{attributes:!0,attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=null!==(o=e.reanchoringMaxWait)&&void 0!==o?o:3e3,this._warningBanner=null,this._checkForSelectableText(),this._updateAnnotationLayerVisibility=()=>{const t=r.getSelection();this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new Mt,this._listeners.add(document,"selectionchange",this._updateAnnotationLayerVisibility),this._destroyed=!1}destroy(){this._listeners.removeAll(),this.pdfViewer.viewer.classList.remove("has-transparent-text-layer"),this.observer.disconnect(),this._destroyed=!0}uri(){return this.pdfMetadata.getUri()}getMetadata(){return this.pdfMetadata.getMetadata()}anchor(t,e){return gn(0,e)}canAnnotate(t){return function(t){try{return mn(t),!0}catch{return!1}}(t)}describe(t,e){return _n(t,e)}async _checkForSelectableText(){try{await this.uri()}catch(t){return}if(!this._destroyed)try{const t=await async function(){const t=cn();let e=!1;for(let n=0;n<t.pagesCount;n++)if((await un(n)).trim().length>0){e=!0;break}return e}();this._toggleNoSelectableTextWarning(!t)}catch(t){console.warn("Unable to check for text in PDF:",t)}}_toggleNoSelectableTextWarning(t){const e=document.querySelector("#outerContainer");var n;if(!t)return null===(n=this._warningBanner)||void 0===n||n.remove(),this._warningBanner=null,void(e.style.height="");this._warningBanner=document.createElement("hypothesis-banner"),document.body.prepend(this._warningBanner);const i=Ut(this._warningBanner);M(gt(vn,{}),i);const o=this._warningBanner.getBoundingClientRect().height;e.style.height=`calc(100% - ${o}px)`}_update(){const t=[],e=this.pdfViewer.pagesCount;for(let t=0;t<e;t++){var n;const e=this.pdfViewer.getPageView(t);if(null!=e&&null!==(n=e.textLayer)&&void 0!==n&&n.renderingDone)switch(e.renderingState){case nn:e.textLayer=null;break;case on:i=e.div,o=void 0,null===(o=i.querySelector(".annotator-placeholder"))||void 0===o||o.remove()}}var i,o;for(let e of this.annotator.anchors)if(e.highlights){if(t.includes(e.annotation))continue;for(let n=0;n<e.highlights.length;n++){const i=e.highlights[n];if(!document.body.contains(i)){e.highlights.splice(n,1),delete e.range,t.push(e.annotation);break}}}t.map((t=>this.annotator.anchor(t)))}contentContainer(){return document.querySelector("#viewerContainer")}fitSideBySide(t){const e=window.innerWidth-t.width,n=t.expanded&&e>=680,i=n?t.width:t.toolbarWidth;this.pdfContainer.style.width=`calc(100% - ${i}px)`;const o=this.pdfViewer.currentScaleValue;return"auto"!==o&&"page-fit"!==o&&"page-width"!==o||(this.pdfViewer.currentScaleValue=o),this.pdfViewer.update(),n}async scrollToAnchor(t){const e=t.annotation,n=Sn(t),i=this._anchorOffset(t);if(null!==i&&(await wn(this.contentContainer(),i),n)){const t=await this._waitForAnnotationToBeAnchored(e,this._reanchoringMaxWait);if(!t)return;const n=this._anchorOffset(t);if(null===n)return;await wn(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(t,e){var n;const i=Date.now();let o;do{o=this.annotator.anchors.find((e=>e.annotation===t)),o&&!Sn(o)||(o=null,await xn(20))}while(!o&&Date.now()-i<e);return null!==(n=o)&&void 0!==n?n:null}_anchorOffset(t){if(!t.highlights)return null;return function(t,e){let n=0;for(;t!==e&&e.contains(t);)n+=t.offsetTop,t=t.offsetParent;return n}(t.highlights[0],this.contentContainer())}}function kn(t=document){return t.querySelector("mosaic-book")}class Ln{constructor(t){const e=kn();if(!e)throw new Error("Book container element not found");const n=e.shadowRoot,i=()=>{const e=n.querySelector("iframe");e&&t.injectClient(e)};i(),this._frameObserver=new MutationObserver(i),this._frameObserver.observe(n,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}canAnnotate(){return!1}async anchor(){return new Range}describe(){throw new Error("This frame cannot be annotated")}contentContainer(){return document.body}fitSideBySide(){return!1}async getMetadata(){return{title:"",link:[]}}async uri(){return document.location.href}async scrollToAnchor(){}}class Nn{constructor(t=document.body){this._htmlIntegration=new Qe(t),this._listeners=new Mt;const e=["mousedown","mouseup","mouseout"];for(let t of e)this._listeners.add(document.documentElement,t,(t=>{t.stopPropagation()}))}canAnnotate(){return!0}destroy(){this._listeners.removeAll(),this._htmlIntegration.destroy()}anchor(t,e){return this._htmlIntegration.anchor(t,e)}describe(t,e){return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(){return!1}async getMetadata(){return{title:document.title,link:[]}}async uri(){const t=new URL(document.location.href);return t.search="",t.toString()}async scrollToAnchor(t){return this._htmlIntegration.scrollToAnchor(t)}}function Rn(t){if("undefined"!=typeof PDFViewerApplication)return new An(t);const e=function(t=window){var e;if(kn(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&kn(n)?"content":null}();return"container"===e?new Ln(t):"content"===e?new Nn:new Qe}class Mn{constructor(t,e=document){let n=!1;this._pendingCallback=null;const i=(n=10)=>{this._pendingCallback=setTimeout((()=>{t(function(t){const e=t.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);return n.collapsed?null:n}(e))}),n)};this._eventHandler=t=>{if("mousedown"===t.type&&(n=!0),"mouseup"===t.type&&(n=!1),n)return;this._cancelPendingCallback();const e="mouseup"===t.type?10:100;i(e)},this._document=e,this._listeners=new Mt,this._events=["mousedown","mouseup","selectionchange"];for(let t of this._events)this._listeners.add(e,t,this._eventHandler);i(1)}disconnect(){this._listeners.removeAll(),this._cancelPendingCallback()}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}}function On(){const t=function(t,e){const n=new Set,i=new Set;return te(t,(t=>{let o=t;for(;o&&!n.has(o);){n.add(o);const t=e(o);t&&i.add(t),o=o.parentNode}})),[...i]}(window.getSelection().getRangeAt(0),(t=>t._annotation));return t}function Pn(t){const e=function(t){let e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;const n=[];for(;e;)e.classList.contains("hypothesis-highlight")&&n.push(e),e=e.parentElement;return n}(t).map((t=>t._annotation)).filter((t=>void 0!==t));return e}function In(t){if(!t.range)return null;try{return t.range.toRange()}catch{return null}}class Dn{constructor(t,e,n={},i=window){this.element=t,this._emitter=e.createEmitter(),this._highlightsVisible=!1,this._isAdderVisible=!1,this._adder=new jt(this.element,{onAnnotate:async()=>{await this.createAnnotation(),document.getSelection().removeAllRanges()},onHighlight:async()=>{await this.createAnnotation({highlight:!0}),document.getSelection().removeAllRanges()},onShowAnnotations:t=>{this.selectAnnotations(t)}}),this._selectionObserver=new Mn((t=>{t?this._onSelection(t):this._onClearSelection()})),this.anchors=[],this._frameIdentifier=n.subFrameIdentifier||null,this._bridge=new Pt,this._connectSidebarEvents(),this._annotationSync=new $t(e,this._bridge),this._connectAnnotationSync(),this._hypothesisInjector=new Te(this.element,n),this._integration=Rn(this),this._sideBySideActive=!1,this._listeners=new Mt,this._setupElementEvents(),this._focusedAnnotations=new Set,this._hostFrame=i,this._listeners.add(window,"unload",(()=>this._notifyGuestUnload()))}_setupElementEvents(){const t=t=>{this._sideBySideActive||Pn(t).length||this._bridge.call("closeSidebar")};this._listeners.add(this.element,"mouseup",(t=>{const{target:e,metaKey:n,ctrlKey:i}=t,o=Pn(e);if(o.length&&this._highlightsVisible){const t=n||i;this.selectAnnotations(o,t)}})),this._listeners.add(this.element,"mousedown",(({target:e})=>{t(e)})),this._listeners.add(this.element,"touchstart",(({target:e})=>{t(e)})),this._listeners.add(this.element,"mouseover",(({target:t})=>{const e=Pn(t);e.length&&this._highlightsVisible&&this._focusAnnotations(e)})),this._listeners.add(this.element,"mouseout",(()=>{this._highlightsVisible&&this._focusAnnotations([])})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async injectClient(t){return this._hypothesisInjector.injectClient(t)}async getDocumentInfo(){const[t,e]=await Promise.all([this._integration.uri(),this._integration.getMetadata()]);return{uri:Ke(t),metadata:e,frameIdentifier:this._frameIdentifier}}_repositionAdder(){var t;if(!1===this._isAdderVisible)return;const e=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);e&&this._onSelection(e)}_connectAnnotationSync(){this._emitter.subscribe("annotationDeleted",(t=>{this.detach(t)})),this._emitter.subscribe("annotationsLoaded",(t=>{t.map((t=>this.anchor(t)))}))}_connectSidebarEvents(){this._bridge.on("focusAnnotations",((t=[])=>{this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);re(e.highlights,n)}})),this._bridge.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=In(e);if(!n)return;const i=new CustomEvent("scrolltorange",{bubbles:!0,cancelable:!0,detail:n});this.element.dispatchEvent(i)&&this._integration.scrollToAnchor(e)})),this._bridge.on("getDocumentInfo",(t=>{this.getDocumentInfo().then((e=>t(null,e))).catch((e=>t(e)))})),this._bridge.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t)}))}destroy(){this._notifyGuestUnload(),this._hypothesisInjector.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),function(t){oe(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy(),this._emitter.destroy(),this._annotationSync.destroy(),this._bridge.destroy()}_notifyGuestUnload(){const t={type:"hypothesisGuestUnloaded",frameIdentifier:this._frameIdentifier};this._hostFrame.postMessage(t,"*")}connectToSidebar(t,e){const n=new MessageChannel;t.postMessage({type:"hypothesisGuestReady"},e,[n.port2]),this._bridge.createChannel(n.port1)}async anchor(t){const e=t=>{const e=In(t);if(!e)return;const n=ne(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&re(n,!0)};this.detach(t,!1),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Zt.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));for(let t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._annotationSync.sync([t]),n}detach(t,e=!0){const n=[];for(let e of this.anchors)e.annotation!==t?n.push(e):e.highlights&&oe(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._emitter.publish("anchorsChanged",this.anchors)}async createAnnotation({highlight:t=!1}={}){var e;const n=null!==(e=this.selectedRanges)&&void 0!==e?e:[];this.selectedRanges=null;const i=await this.getDocumentInfo(),o=this.element,r=(await Promise.all(n.map((t=>this._integration.describe(o,t))))).map((t=>({source:i.uri,selector:t}))),s={uri:i.uri,document:i.metadata,target:r,$highlight:t,$tag:""};return this._emitter.publish("beforeAnnotationCreated",s),this.anchor(s),s}_focusAnnotations(t){const e=t.map((t=>t.$tag));this._bridge.call("focusAnnotations",e)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=Jt(e),i=ee(e);i?(this.selectedRanges=[t],this._emitter.publish("hasSelectionChanged",!0),this._adder.annotationsForSelection=On(),this._isAdderVisible=!0,this._adder.show(i,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._emitter.publish("hasSelectionChanged",!1)}selectAnnotations(t,e=!1){const n=t.map((t=>t.$tag));e?this._bridge.call("toggleAnnotationSelection",n):this._bridge.call("showAnnotations",n),this._bridge.call("openSidebar")}scrollToAnchor(t){return this._integration.scrollToAnchor(t)}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}contentContainer(){return this._integration.contentContainer()}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Vn(t){var e;const n={...t};if((null===(e=n.services)||void 0===e?void 0:e.length)>0){const t=n.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return["notebookAppUrl","sidebarAppUrl"].forEach((t=>delete n[t])),n}function Hn({config:t,groupId:e}){const n=Vn(t);n.group=e;const i=encodeURIComponent(JSON.stringify(n));return gt("iframe",{title:"Hypothesis annotation notebook",className:"NotebookIframe",allowFullScreen:!0,src:`${t.notebookAppUrl}#config=${i}`})}function Fn({eventBus:t,config:e}){const[n,i]=rt(0),[o,r]=rt(!0),[s,a]=rt(null),l=at(""),c=at(null);st((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),st((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:gt("div",{className:Z("NotebookModal__outer",{"is-hidden":o}),children:gt("div",{className:"NotebookModal__inner",children:[gt("div",{className:"NotebookModal__close-button-container",children:gt(bt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),gt(Hn,{config:e,groupId:s},n)]})})}class Bn{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=Ut(this._outerContainer),M(gt(Fn,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var Un={exports:{}};
7
7
  /*! Hammer.JS - v2.0.7 - 2016-04-22
8
8
  * http://hammerjs.github.io/
9
9
  *
10
10
  * Copyright (c) 2016 Jorik Tangelder;
11
- * Licensed under the MIT license */!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function _(t,e,n){var i,o=e.prototype;(i=t.prototype=Object.create(o)).constructor=t,i._super=o,n&&r(i,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||o,e):t}function w(t,e){return t===o?e:t}function b(t,e,n){f(S(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(S(e),(function(e){t.removeEventListener(e,n,!1)}))}function E(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function T(t,e){return t.indexOf(e)>-1}function S(t){return t.trim().split(/\s+/g)}function x(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function k(t,e,n){for(var i=[],o=[],r=0;r<t.length;){var s=e?t[r][e]:t[r];x(o,s)<0&&i.push(t[r]),o[r]=s,r++}return n&&(i=e?i.sort((function(t,n){return t[e]>n[e]})):i.sort()),i}function L(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:e)in t)return i;a++}return o}var N=1;function R(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var M="ontouchstart"in e,O=L(e,"PointerEvent")!==o,P=M&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),I="touch",D="mouse",V=24,H=["x","y"],F=["clientX","clientY"];function B(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){y(t.options.enable,[t])&&n.handler(e)},this.init()}function U(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,s=1&e&&i-r==0,a=12&e&&i-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=q(e));r>1&&!n.firstMultiple?n.firstMultiple=q(e):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,l=a?a.center:s.center,u=e.center=W(i);e.timeStamp=h(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=X(l,u),e.distance=z(l,u),function(t,e){var n=e.center,i=t.offsetDelta||{},o=t.prevDelta||{},r=t.prevInput||{};1!==e.eventType&&4!==r.eventType||(o=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y});e.deltaX=o.x+(n.x-i.x),e.deltaY=o.y+(n.y-i.y)}(n,e),e.offsetDirection=$(e.deltaX,e.deltaY);var d=j(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,e.scale=a?(f=a.pointers,p=i,z(p[0],p[1],F)/z(f[0],f[1],F)):1,e.rotation=a?function(t,e){return X(e[1],e[0],F)+X(t[1],t[0],F)}(a.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,a=t.lastInterval||e,l=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(l>25||a.velocity===o)){var h=e.deltaX-a.deltaX,u=e.deltaY-a.deltaY,d=j(l,h,u);i=d.x,r=d.y,n=c(d.x)>c(d.y)?d.x:d.y,s=$(h,u),t.lastInterval=e}else n=a.velocity,i=a.velocityX,r=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var f,p;var g=t.element;E(e.srcEvent.target,g)&&(g=e.srcEvent.target);e.target=g}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function q(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:e,center:W(e),deltaX:t.deltaX,deltaY:t.deltaY}}function W(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,o=0;o<e;)n+=t[o].clientX,i+=t[o].clientY,o++;return{x:l(n/e),y:l(i/e)}}function j(t,e,n){return{x:e/t||0,y:n/t||0}}function $(t,e){return t===e?1:c(t)>=c(e)?t<0?2:4:e<0?8:16}function z(t,e,n){n||(n=H);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return Math.sqrt(i*i+o*o)}function X(t,e,n){n||(n=H);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return 180*Math.atan2(o,i)/Math.PI}B.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(R(this.element),this.evWin,this.domHandler)}};var Y={mousedown:1,mousemove:2,mouseup:4},G="mousedown",Z="mousemove mouseup";function K(){this.evEl=G,this.evWin=Z,this.pressed=!1,B.apply(this,arguments)}_(K,B,{handler:function(t){var e=Y[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:D,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:I,3:"pen",4:D,5:"kinect"},tt="pointerdown",et="pointermove pointerup pointercancel";function nt(){this.evEl=tt,this.evWin=et,B.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(tt="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),_(nt,B,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),o=J[i],r=Q[t.pointerType]||t.pointerType,s=r==I,a=x(e,t.pointerId,"pointerId");1&o&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):12&o&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),n&&e.splice(a,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ot="touchstart",rt="touchstart touchmove touchend touchcancel";function st(){this.evTarget=ot,this.evWin=rt,this.started=!1,B.apply(this,arguments)}function at(t,e){var n=A(t.touches),i=A(t.changedTouches);return 12&e&&(n=k(n.concat(i),"identifier",!0)),[n,i]}_(st,B,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var n=at.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,srcEvent:t})}}});var lt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ct="touchstart touchmove touchend touchcancel";function ht(){this.evTarget=ct,this.targetIds={},B.apply(this,arguments)}function ut(t,e){var n=A(t.touches),i=this.targetIds;if(3&e&&1===n.length)return i[n[0].identifier]=!0,[n,n];var o,r,s=A(t.changedTouches),a=[],l=this.target;if(r=n.filter((function(t){return E(t.target,l)})),1===e)for(o=0;o<r.length;)i[r[o].identifier]=!0,o++;for(o=0;o<s.length;)i[s[o].identifier]&&a.push(s[o]),12&e&&delete i[s[o].identifier],o++;return a.length?[k(r.concat(a),"identifier",!0),a]:void 0}_(ht,B,{handler:function(t){var e=lt[t.type],n=ut.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,srcEvent:t})}});function dt(){B.apply(this,arguments);var t=v(this.handler,this);this.touch=new ht(this.manager,t),this.mouse=new K(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ft(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,pt.call(this,e)):12&t&&pt.call(this,e)}function pt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)}),2500)}}function gt(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var o=this.lastTouches[i],r=Math.abs(e-o.x),s=Math.abs(n-o.y);if(r<=25&&s<=25)return!0}return!1}_(dt,B,{handler:function(t,e,n){var i=n.pointerType==I,o=n.pointerType==D;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)ft.call(this,e,n);else if(o&&gt.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var mt=L(a.style,"touchAction"),_t=mt!==o,vt="compute",yt="auto",wt="manipulation",bt="none",Ct="pan-x",Et="pan-y",Tt=function(){if(!_t)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){t[i]=!n||e.CSS.supports("touch-action",i)})),t}();function St(t,e){this.manager=t,this.set(e)}St.prototype={set:function(t){t==vt&&(t=this.compute()),_t&&this.manager.element.style&&Tt[t]&&(this.manager.element.style[mt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return f(this.manager.recognizers,(function(e){y(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(T(t,bt))return bt;var e=T(t,Ct),n=T(t,Et);if(e&&n)return bt;if(e||n)return e?Ct:Et;if(T(t,wt))return wt;return yt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,o=T(i,bt)&&!Tt.none,r=T(i,Et)&&!Tt["pan-y"],s=T(i,Ct)&&!Tt["pan-x"];if(o){var a=1===t.pointers.length,l=t.distance<2,c=t.deltaTime<250;if(a&&l&&c)return}if(!s||!r)return o||r&&6&n||s&&n&V?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var xt=32;function At(t){this.options=r({},this.defaults,t||{}),this.id=N++,this.manager=null,this.options.enable=w(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function kt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function Lt(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function Nt(t,e){var n=e.manager;return n?n.get(t):t}function Rt(){At.apply(this,arguments)}function Mt(){Rt.apply(this,arguments),this.pX=null,this.pY=null}function Ot(){Rt.apply(this,arguments)}function Pt(){At.apply(this,arguments),this._timer=null,this._input=null}function It(){Rt.apply(this,arguments)}function Dt(){Rt.apply(this,arguments)}function Vt(){At.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ht(t,e){return(e=e||{}).recognizers=w(e.recognizers,Ht.defaults.preset),new Ft(t,e)}At.prototype={defaults:{},set:function(t){return r(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(d(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Nt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return d(t,"dropRecognizeWith",this)||(t=Nt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(d(t,"requireFailure",this))return this;var e=this.requireFail;return-1===x(e,t=Nt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(d(t,"dropRequireFailure",this))return this;t=Nt(t,this);var e=x(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function i(n){e.manager.emit(n,t)}n<8&&i(e.options.event+kt(n)),i(e.options.event),t.additionalEvent&&i(t.additionalEvent),n>=8&&i(e.options.event+kt(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=xt},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=r({},t);if(!y(this.options.enable,[this,e]))return this.reset(),void(this.state=xt);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},_(Rt,At,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=6&e,o=this.attrTest(t);return i&&(8&n||!o)?16|e:i||o?4&n?8|e:2&e?4|e:2:xt}}),_(Mt,Rt,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(Et),t&V&&e.push(Ct),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,o=t.direction,r=t.deltaX,s=t.deltaY;return o&e.direction||(6&e.direction?(o=0===r?1:r<0?2:4,n=r!=this.pX,i=Math.abs(t.deltaX)):(o=0===s?1:s<0?8:16,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=o,n&&i>e.threshold&&o&e.direction},attrTest:function(t){return Rt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Lt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(Ot,Rt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[bt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(Pt,At,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,!i||!n||12&t.eventType&&!o)this.reset();else if(1&t.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return xt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}}),_(It,Rt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[bt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Dt,Rt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Mt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:n&V&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=Lt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Vt,At,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[wt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(i&&o&&n){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||z(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,s&&r?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=u((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return xt},failTimeout:function(){return this._timer=u((function(){this.state=xt}),this.options.interval,this),xt},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ht.VERSION="2.0.7",Ht.defaults={domEvents:!1,touchAction:vt,enable:!0,inputTarget:null,inputClass:null,preset:[[It,{enable:!1}],[Ot,{enable:!1},["rotate"]],[Dt,{direction:6}],[Mt,{direction:6},["swipe"]],[Vt],[Vt,{event:"doubletap",taps:2},["tap"]],[Pt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ft(t,e){var n;this.options=r({},Ht.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(O?nt:P?ht:M?dt:K))(n,U),this.touchAction=new St(this,this.options.touchAction),Bt(this,!0),f(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Bt(t,e){var n,i=t.element;i.style&&(f(t.options.cssProps,(function(o,r){n=L(i.style,r),e?(t.oldCssProps[n]=i.style[n],i.style[n]=o):i.style[n]=t.oldCssProps[n]||""})),e||(t.oldCssProps={}))}Ft.prototype={set:function(t){return r(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,o=e.curRecognizer;(!o||o&&8&o.state)&&(o=e.curRecognizer=null);for(var r=0;r<i.length;)n=i[r],2===e.stopped||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(t),!o&&14&n.state&&(o=e.curRecognizer=n),r++}},get:function(t){if(t instanceof At)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(d(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(d(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=x(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==o&&e!==o){var n=this.handlers;return f(S(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==o){var n=this.handlers;return f(S(t),(function(t){e?n[t]&&n[t].splice(x(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var i=n.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<i.length;)i[o](e),o++}},destroy:function(){this.element&&Bt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ht,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:xt,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:V,DIRECTION_ALL:30,Manager:Ft,Input:B,TouchAction:St,TouchInput:ht,MouseInput:K,PointerEventInput:nt,TouchMouseInput:dt,SingleTouchInput:st,Recognizer:At,AttrRecognizer:Rt,Tap:Vt,Pan:Mt,Swipe:Dt,Pinch:Ot,Rotate:It,Press:Pt,on:b,off:C,each:f,merge:m,extend:g,assign:r,inherit:_,bindFn:v,prefixed:L}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Ht,t.exports?t.exports=Ht:e.Hammer=Ht}(window,document)}(Hn);var Fn=Hn.exports;function Bn(t){const e=function(t){const e=[];return t.forEach((t=>{var n;if(null===(n=t.highlights)||void 0===n||!n.length)return;const i=ie(t.highlights);i.top>=i.bottom||e.push({top:i.top,bottom:i.bottom,anchor:t})})),e.sort(((t,e)=>t.top<e.top?-1:1)),e}(t),n=new Set,i=new Set,o=[];let r=null;function s(t){const e=t.bottom-t.top,n=t.top+e/2;return{anchors:[t.anchor],top:t.top,bottom:t.bottom,position:n}}e.forEach((t=>{if(t.top<137)return void n.add(t.anchor);if(t.top>window.innerHeight-22)return void i.add(t.anchor);if(!r)return void(r=s(t));const e=t.top>r.top&&t.bottom<r.bottom;if(t.top-r.bottom>60&&!e)o.push(r),r=s(t);else{const e=t.bottom>r.bottom?t.bottom:r.bottom,n=e-r.top;r.anchors.push(t.anchor),r.bottom=e,r.position=r.top+n/2}})),r&&o.push(r);return{above:{anchors:Array.from(n),position:137},below:{anchors:Array.from(i),position:window.innerHeight-22},buckets:o}}function Un({bucket:t,onSelectAnnotations:e}){const n=t.anchors.map((t=>t.annotation)),i=`Select nearby annotations (${t.anchors.length})`;function o(e){t.anchors.forEach((t=>{ne(t.highlights||[],e)}))}return dt("button",{className:"Buckets__button Buckets__button--left",onClick:t=>function(t){e(n,t.metaKey||t.ctrlKey)}(t),onMouseMove:()=>o(!0),onMouseOut:()=>o(!1),onBlur:()=>o(!1),title:i,"aria-label":i,children:t.anchors.length})}function qn({bucket:t,direction:e,scrollToAnchor:n}){const i=`Go ${e} to next annotations (${t.anchors.length})`;return dt("button",{className:Y("Buckets__button",`Buckets__button--${e}`),onClick:function(){const i=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=ie(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(t.anchors,e);i&&n(i)},title:i,"aria-label":i,children:t.anchors.length})}function Wn({above:t,below:e,buckets:n,onSelectAnnotations:i,scrollToAnchor:o}){const r=t.anchors.length>0,s=e.anchors.length>0;return dt("ul",{className:"Buckets__list",children:[r&&dt("li",{className:"Buckets__bucket",style:{top:t.position},children:dt(qn,{bucket:t,direction:"up",scrollToAnchor:o})}),n.map(((t,e)=>dt("li",{className:"Buckets__bucket",style:{top:t.position},children:dt(Un,{bucket:t,onSelectAnnotations:i})},e))),s&&dt("li",{className:"Buckets__bucket",style:{top:e.position},children:dt(qn,{bucket:e,direction:"down",scrollToAnchor:o})})]})}class jn{constructor(t,e,{contentContainer:n=document.body}={}){this._contentContainer=n,this._bucketsContainer=document.createElement("div"),t.appendChild(this._bucketsContainer),this._guest=e,this._listeners=new Lt,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(n,"scroll",(()=>this.update())),this._update()}destroy(){this._listeners.removeAll(),this._bucketsContainer.remove()}update(){this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{this._update(),this._updatePending=!1})))}_update(){const t=Bn(this._guest.anchors);N(dt(Wn,{above:t.above,below:t.below,buckets:t.buckets,onSelectAnnotations:(t,e)=>this._guest.selectAnnotations(t,e),scrollToAnchor:t=>this._guest.scrollToAnchor(t)}),this._bucketsContainer)}}let $n={};const zn=t=>{$n=t||{}},Xn=function(t){t.on("featureFlagsUpdated",zn)};function Yn({buttonRef:t,expanded:e,className:n="Toolbar__button",label:i,icon:o,onClick:r,selected:s=!1}){return dt("button",{className:n,"aria-label":i,"aria-expanded":e,"aria-pressed":s,onClick:r,ref:t,title:i,children:dt(pt,{name:o})})}function Gn({closeSidebar:t,createAnnotation:e,isSidebarOpen:n,newAnnotationType:i,showHighlights:o,toggleHighlights:r,toggleSidebar:s,toggleSidebarRef:a,useMinimalControls:l=!1}){return dt("div",{className:"Toolbar",children:[l&&n&&dt(Yn,{className:"Toolbar__sidebar-close",label:"Close annotation sidebar",icon:"cancel",onClick:t}),!l&&dt(Yn,{className:"Toolbar__sidebar-toggle",buttonRef:a,label:"Annotation sidebar",icon:n?"caret-right":"caret-left",expanded:n,onClick:s}),!l&&dt("div",{className:"Toolbar__buttonbar",children:[dt(Yn,{label:"Show highlights",icon:o?"show":"hide",selected:o,onClick:r}),dt(Yn,{label:"note"===i?"New page note":"New annotation",icon:"note"===i?"note":"annotate",onClick:e})]})]})}class Zn{constructor(t,e){const{createAnnotation:n,setSidebarOpen:i,setHighlightsVisible:o}=e;this._container=t,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._closeSidebar=()=>i(!1),this._toggleSidebar=()=>i(!this._sidebarOpen),this._toggleHighlights=()=>o(!this._highlightsVisible),this._createAnnotation=()=>{n(),i(!0)},this._sidebarToggleButton={current:null},this.render()}getWidth(){return this._container.firstChild.getBoundingClientRect().width}set useMinimalControls(t){this._useMinimalControls=t,this.render()}get useMinimalControls(){return this._useMinimalControls}set sidebarOpen(t){this._sidebarOpen=t,this.render()}get sidebarOpen(){return this._sidebarOpen}set newAnnotationType(t){this._newAnnotationType=t,this.render()}get newAnnotationType(){return this._newAnnotationType}set highlightsVisible(t){this._highlightsVisible=t,this.render()}get highlightsVisible(){return this._highlightsVisible}get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){N(dt(Gn,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}class Kn{constructor(t,e,n,i={}){if(this._emitter=e.createEmitter(),this._sidebarRPC=new Rt,this.iframe=function(t){const e=Pn(t),n="config="+encodeURIComponent(JSON.stringify(e)),i=t.sidebarAppUrl+"#"+n,o=document.createElement("iframe");return o.setAttribute("allowfullscreen",""),o.src=i,o.title="Hypothesis annotation viewer",o.className="h-sidebar-iframe",o}(i),this.options=i,this.bucketBar=null,i.externalContainerSelector){var o;this.externalFrame=null!==(o=document.querySelector(i.externalContainerSelector))&&void 0!==o?o:t,this.externalFrame.appendChild(this.iframe)}else{if(this.iframeContainer=document.createElement("div"),this.iframeContainer.style.display="none",this.iframeContainer.className="annotator-frame","clean"===i.theme)this.iframeContainer.classList.add("annotator-frame--theme-clean");else{const t=new jn(this.iframeContainer,n,{contentContainer:n.contentContainer()});this._emitter.subscribe("anchorsChanged",(()=>t.update())),this.bucketBar=t}this.iframeContainer.appendChild(this.iframe),this.hypothesisSidebar=document.createElement("hypothesis-sidebar");Ht(this.hypothesisSidebar).appendChild(this.iframeContainer),t.appendChild(this.hypothesisSidebar)}this.guest=n,this._listeners=new Lt;const r=document.createElement("div");this.toolbar=new Zn(r,{createAnnotation:()=>n.createAnnotation(),setSidebarOpen:t=>t?this.open():this.close(),setHighlightsVisible:t=>this.setHighlightsVisible(t)}),"clean"===i.theme?this.toolbar.useMinimalControls=!0:this.toolbar.useMinimalControls=!1,this._emitter.subscribe("hasSelectionChanged",(t=>{this.toolbar.newAnnotationType=t?"annotation":"note"})),this.iframeContainer?(this.iframeContainer.prepend(r),this.toolbarWidth=this.toolbar.getWidth()):this.toolbarWidth=0,this._listeners.add(window,"resize",(()=>this._onResize())),this._gestureState={initial:null,final:null},this._setupGestures(),this.close();const[s]=i.services||[];s&&(this.onLoginRequest=s.onLoginRequest,this.onLogoutRequest=s.onLogoutRequest,this.onSignupRequest=s.onSignupRequest,this.onProfileRequest=s.onProfileRequest,this.onHelpRequest=s.onHelpRequest),this.onLayoutChange=i.onLayoutChange,this._notifyOfLayoutChange(!1),this._setupSidebarEvents(),this.ready=new Promise((t=>{this._listeners.add(window,"message",(e=>{const{data:n,ports:i}=e;"hypothesisSidebarReady"===(null==n?void 0:n.type)&&(this._sidebarRPC.createChannel(i[0]),t())}))})),this.ready.then((()=>{this.iframeContainer&&(this.iframeContainer.style.display="");const t="always"===i.showHighlights;this.setHighlightsVisible(t),(i.openSidebar||i.annotations||i.query||i.group)&&this.open()})),this._listeners.add(window,"message",(t=>{const{data:e}=t;"hypothesisGuestUnloaded"===(null==e?void 0:e.type)&&this._sidebarRPC.call("frameDestroyed",e.frameIdentifier)}))}destroy(){var t,e;null===(t=this.bucketBar)||void 0===t||t.destroy(),this._listeners.removeAll(),null===(e=this._hammerManager)||void 0===e||e.destroy(),this.hypothesisSidebar?this.hypothesisSidebar.remove():this.iframe.remove(),this._emitter.destroy()}_setupSidebarEvents(){var t;t=document.body,this._sidebarRPC.on("publicAnnotationCountChanged",(function(e){const n=t.querySelectorAll("[data-hypothesis-annotation-count]");Array.from(n).forEach((t=>{t.textContent=e}))})),function(t,e){const n=t.querySelectorAll("[data-hypothesis-trigger]");function i(t){e(),t.stopPropagation()}Array.from(n).forEach((t=>{t.addEventListener("click",i)}))}(document.body,(()=>this.open())),Xn(this._sidebarRPC),this._sidebarRPC.on("showHighlights",(()=>this.setHighlightsVisible(!0))),this._sidebarRPC.on("openSidebar",(()=>this.open())),this._sidebarRPC.on("closeSidebar",(()=>this.close())),this._sidebarRPC.on("openNotebook",(t=>{this.hide(),this._emitter.publish("openNotebook",t)})),this._emitter.subscribe("closeNotebook",(()=>{this.show()}));[["loginRequested",this.onLoginRequest],["logoutRequested",this.onLogoutRequest],["signupRequested",this.onSignupRequest],["profileRequested",this.onProfileRequest],["helpRequested",this.onHelpRequest]].forEach((([t,e])=>{e&&this._sidebarRPC.on(t,(()=>e()))}))}_resetGestureState(){this._gestureState={initial:null,final:null}}_setupGestures(){const t=this.toolbar.sidebarToggleButton;t&&(this._hammerManager=new Fn.Manager(t).on("panstart panend panleft panright",(t=>this._onPan(t))),this._hammerManager.add(new Fn.Pan({direction:Fn.DIRECTION_HORIZONTAL})))}_updateLayout(){this.renderFrame||(this.renderFrame=requestAnimationFrame((()=>{if(this.renderFrame=null,this._gestureState.final!==this._gestureState.initial&&this.iframeContainer){const t=this._gestureState.final,e=-t;this.iframeContainer.style.marginLeft=`${t}px`,e>=280&&(this.iframeContainer.style.width=`${e}px`),this._notifyOfLayoutChange()}})))}_notifyOfLayoutChange(t){var e;const n=this.iframeContainer&&this.toolbar.getWidth()||0,i=null!==(e=this.iframeContainer)&&void 0!==e?e:this.externalFrame,o=i.getBoundingClientRect(),r=window.getComputedStyle(i),s=parseInt(r.width),a=parseInt(r.marginLeft);let l=n;"boolean"==typeof t?t&&(l+=s):(a<280?l-=a:l+=s,t=l>n);const c={expanded:t,width:t?l:n,height:o.height,toolbarWidth:n};this.onLayoutChange&&this.onLayoutChange(c),this.guest.fitSideBySide(c),this._emitter.publish("sidebarLayoutChanged",c)}_onResize(){!0===this.toolbar.sidebarOpen&&(window.innerWidth<280?this.close():this.open())}_onPan(t){const e=this.iframeContainer;if(e)switch(t.type){case"panstart":this._resetGestureState(),e.classList.add("annotator-no-transition"),e.style.pointerEvents="none",this._gestureState.initial=parseInt(getComputedStyle(e).marginLeft);break;case"panend":e.classList.remove("annotator-no-transition"),e.style.pointerEvents="",null===this._gestureState.final||this._gestureState.final<=-280?this.open():this.close(),this._resetGestureState();break;case"panleft":case"panright":{if("number"!=typeof this._gestureState.initial)return;const e=this._gestureState.initial,n=t.deltaX;this._gestureState.final=Math.min(Math.round(e+n),0),this._updateLayout();break}}}open(){if(this._sidebarRPC.call("sidebarOpened"),this._emitter.publish("sidebarOpened"),this.iframeContainer){const t=this.iframeContainer.getBoundingClientRect().width;this.iframeContainer.style.marginLeft=-1*t+"px",this.iframeContainer.classList.remove("annotator-collapsed")}this.toolbar.sidebarOpen=!0,"whenSidebarOpen"===this.options.showHighlights&&this.setHighlightsVisible(!0),this._notifyOfLayoutChange(!0)}close(){this.iframeContainer&&(this.iframeContainer.style.marginLeft="",this.iframeContainer.classList.add("annotator-collapsed")),this.toolbar.sidebarOpen=!1,"whenSidebarOpen"===this.options.showHighlights&&this.setHighlightsVisible(!1),this._notifyOfLayoutChange(!1)}setHighlightsVisible(t){this.toolbar.highlightsVisible=t,this._sidebarRPC.call("setHighlightsVisible",t)}show(){this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}var Jn={exports:{}};function Qn(){}Qn.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function o(){i.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],o=[];if(i&&e)for(var r=0,s=i.length;r<s;r++)i[r].fn!==e&&i[r].fn._!==e&&o.push(i[r]);return o.length?n[t]=o:delete n[t],this}},Jn.exports=Qn;var ti=Jn.exports.TinyEmitter=Qn;class ei{constructor(t){this._emitter=t,this._subscriptions=[]}publish(t,...e){this._emitter.emit(t,...e)}subscribe(t,e){this._emitter.on(t,e),this._subscriptions.push([t,e])}unsubscribe(t,e){this._emitter.off(t,e),this._subscriptions=this._subscriptions.filter((([n,i])=>n!==t||i!==e))}destroy(){for(let[t,e]of this._subscriptions)this._emitter.off(t,e);this._subscriptions=[]}}class ni{constructor(){this._emitter=new ti}createEmitter(){return new ei(this._emitter)}}!function(t,{reset:e=!1}={}){e&&ft.clear();for(let[e,n]of Object.entries(t))ft.set(e,n)}(wt);const ii=window,oi=document.querySelector('link[type="application/annotator+html"][rel="sidebar"]');new Promise((t=>{"loading"!==document.readyState&&t(),document.addEventListener("readystatechange",(()=>t()))})).then((function(){ii.__hypothesis={};const t=kt("annotator"),e=t.subFrameIdentifier?window.parent:window,n=new ni,i=new On(document.body,n,t,e);let o;window===e&&(o=new Kn(document.body,n,i,kt("sidebar")),ii.__hypothesis.sidebarWindow=o.ready.then((()=>[o.iframe.contentWindow])));const r=new Vn(document.body,n,kt("notebook"));let s=ii.__hypothesis.sidebarWindow;try{var a;if(!s)s=null===(a=window.parent.__hypothesis)||void 0===a?void 0:a.sidebarWindow}catch{}if(s){const t=new URL(oi.href).origin;s.then((([e])=>i.connectToSidebar(e,t)))}else console.warn(`Hypothesis guest frame in ${location.origin} could not find a sidebar to connect to.\nGuest frames can only connect to sidebars in their same-origin parent frame.`);oi.addEventListener("destroy",(()=>{var t;delete ii.__hypothesis,null===(t=o)||void 0===t||t.destroy(),r.destroy(),i.destroy();document.querySelectorAll("[data-hypothesis-asset]").forEach((t=>t.remove()))}))}));
11
+ * Licensed under the MIT license */!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function _(t,e,n){var i,o=e.prototype;(i=t.prototype=Object.create(o)).constructor=t,i._super=o,n&&r(i,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||o,e):t}function w(t,e){return t===o?e:t}function b(t,e,n){f(S(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(S(e),(function(e){t.removeEventListener(e,n,!1)}))}function E(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function T(t,e){return t.indexOf(e)>-1}function S(t){return t.trim().split(/\s+/g)}function x(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function k(t,e,n){for(var i=[],o=[],r=0;r<t.length;){var s=e?t[r][e]:t[r];x(o,s)<0&&i.push(t[r]),o[r]=s,r++}return n&&(i=e?i.sort((function(t,n){return t[e]>n[e]})):i.sort()),i}function L(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:e)in t)return i;a++}return o}var N=1;function R(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var M="ontouchstart"in e,O=L(e,"PointerEvent")!==o,P=M&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),I="touch",D="mouse",V=24,H=["x","y"],F=["clientX","clientY"];function B(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){y(t.options.enable,[t])&&n.handler(e)},this.init()}function U(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,s=1&e&&i-r==0,a=12&e&&i-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=q(e));r>1&&!n.firstMultiple?n.firstMultiple=q(e):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,l=a?a.center:s.center,u=e.center=W(i);e.timeStamp=h(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=X(l,u),e.distance=z(l,u),function(t,e){var n=e.center,i=t.offsetDelta||{},o=t.prevDelta||{},r=t.prevInput||{};1!==e.eventType&&4!==r.eventType||(o=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y});e.deltaX=o.x+(n.x-i.x),e.deltaY=o.y+(n.y-i.y)}(n,e),e.offsetDirection=$(e.deltaX,e.deltaY);var d=j(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,e.scale=a?(f=a.pointers,p=i,z(p[0],p[1],F)/z(f[0],f[1],F)):1,e.rotation=a?function(t,e){return X(e[1],e[0],F)+X(t[1],t[0],F)}(a.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,a=t.lastInterval||e,l=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(l>25||a.velocity===o)){var h=e.deltaX-a.deltaX,u=e.deltaY-a.deltaY,d=j(l,h,u);i=d.x,r=d.y,n=c(d.x)>c(d.y)?d.x:d.y,s=$(h,u),t.lastInterval=e}else n=a.velocity,i=a.velocityX,r=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var f,p;var g=t.element;E(e.srcEvent.target,g)&&(g=e.srcEvent.target);e.target=g}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function q(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:e,center:W(e),deltaX:t.deltaX,deltaY:t.deltaY}}function W(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,o=0;o<e;)n+=t[o].clientX,i+=t[o].clientY,o++;return{x:l(n/e),y:l(i/e)}}function j(t,e,n){return{x:e/t||0,y:n/t||0}}function $(t,e){return t===e?1:c(t)>=c(e)?t<0?2:4:e<0?8:16}function z(t,e,n){n||(n=H);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return Math.sqrt(i*i+o*o)}function X(t,e,n){n||(n=H);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return 180*Math.atan2(o,i)/Math.PI}B.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(R(this.element),this.evWin,this.domHandler)}};var Y={mousedown:1,mousemove:2,mouseup:4},G="mousedown",Z="mousemove mouseup";function K(){this.evEl=G,this.evWin=Z,this.pressed=!1,B.apply(this,arguments)}_(K,B,{handler:function(t){var e=Y[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:D,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:I,3:"pen",4:D,5:"kinect"},tt="pointerdown",et="pointermove pointerup pointercancel";function nt(){this.evEl=tt,this.evWin=et,B.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(tt="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),_(nt,B,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),o=J[i],r=Q[t.pointerType]||t.pointerType,s=r==I,a=x(e,t.pointerId,"pointerId");1&o&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):12&o&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),n&&e.splice(a,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ot="touchstart",rt="touchstart touchmove touchend touchcancel";function st(){this.evTarget=ot,this.evWin=rt,this.started=!1,B.apply(this,arguments)}function at(t,e){var n=A(t.touches),i=A(t.changedTouches);return 12&e&&(n=k(n.concat(i),"identifier",!0)),[n,i]}_(st,B,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var n=at.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,srcEvent:t})}}});var lt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ct="touchstart touchmove touchend touchcancel";function ht(){this.evTarget=ct,this.targetIds={},B.apply(this,arguments)}function ut(t,e){var n=A(t.touches),i=this.targetIds;if(3&e&&1===n.length)return i[n[0].identifier]=!0,[n,n];var o,r,s=A(t.changedTouches),a=[],l=this.target;if(r=n.filter((function(t){return E(t.target,l)})),1===e)for(o=0;o<r.length;)i[r[o].identifier]=!0,o++;for(o=0;o<s.length;)i[s[o].identifier]&&a.push(s[o]),12&e&&delete i[s[o].identifier],o++;return a.length?[k(r.concat(a),"identifier",!0),a]:void 0}_(ht,B,{handler:function(t){var e=lt[t.type],n=ut.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,srcEvent:t})}});function dt(){B.apply(this,arguments);var t=v(this.handler,this);this.touch=new ht(this.manager,t),this.mouse=new K(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ft(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,pt.call(this,e)):12&t&&pt.call(this,e)}function pt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)}),2500)}}function gt(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var o=this.lastTouches[i],r=Math.abs(e-o.x),s=Math.abs(n-o.y);if(r<=25&&s<=25)return!0}return!1}_(dt,B,{handler:function(t,e,n){var i=n.pointerType==I,o=n.pointerType==D;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)ft.call(this,e,n);else if(o&&gt.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var mt=L(a.style,"touchAction"),_t=mt!==o,vt="compute",yt="auto",wt="manipulation",bt="none",Ct="pan-x",Et="pan-y",Tt=function(){if(!_t)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){t[i]=!n||e.CSS.supports("touch-action",i)})),t}();function St(t,e){this.manager=t,this.set(e)}St.prototype={set:function(t){t==vt&&(t=this.compute()),_t&&this.manager.element.style&&Tt[t]&&(this.manager.element.style[mt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return f(this.manager.recognizers,(function(e){y(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(T(t,bt))return bt;var e=T(t,Ct),n=T(t,Et);if(e&&n)return bt;if(e||n)return e?Ct:Et;if(T(t,wt))return wt;return yt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,o=T(i,bt)&&!Tt.none,r=T(i,Et)&&!Tt["pan-y"],s=T(i,Ct)&&!Tt["pan-x"];if(o){var a=1===t.pointers.length,l=t.distance<2,c=t.deltaTime<250;if(a&&l&&c)return}if(!s||!r)return o||r&&6&n||s&&n&V?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var xt=32;function At(t){this.options=r({},this.defaults,t||{}),this.id=N++,this.manager=null,this.options.enable=w(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function kt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function Lt(t){return 16==t?"down":8==t?"up":2==t?"left":4==t?"right":""}function Nt(t,e){var n=e.manager;return n?n.get(t):t}function Rt(){At.apply(this,arguments)}function Mt(){Rt.apply(this,arguments),this.pX=null,this.pY=null}function Ot(){Rt.apply(this,arguments)}function Pt(){At.apply(this,arguments),this._timer=null,this._input=null}function It(){Rt.apply(this,arguments)}function Dt(){Rt.apply(this,arguments)}function Vt(){At.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ht(t,e){return(e=e||{}).recognizers=w(e.recognizers,Ht.defaults.preset),new Ft(t,e)}At.prototype={defaults:{},set:function(t){return r(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(d(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Nt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return d(t,"dropRecognizeWith",this)||(t=Nt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(d(t,"requireFailure",this))return this;var e=this.requireFail;return-1===x(e,t=Nt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(d(t,"dropRequireFailure",this))return this;t=Nt(t,this);var e=x(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function i(n){e.manager.emit(n,t)}n<8&&i(e.options.event+kt(n)),i(e.options.event),t.additionalEvent&&i(t.additionalEvent),n>=8&&i(e.options.event+kt(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=xt},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=r({},t);if(!y(this.options.enable,[this,e]))return this.reset(),void(this.state=xt);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},_(Rt,At,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=6&e,o=this.attrTest(t);return i&&(8&n||!o)?16|e:i||o?4&n?8|e:2&e?4|e:2:xt}}),_(Mt,Rt,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(Et),t&V&&e.push(Ct),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,o=t.direction,r=t.deltaX,s=t.deltaY;return o&e.direction||(6&e.direction?(o=0===r?1:r<0?2:4,n=r!=this.pX,i=Math.abs(t.deltaX)):(o=0===s?1:s<0?8:16,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=o,n&&i>e.threshold&&o&e.direction},attrTest:function(t){return Rt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Lt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(Ot,Rt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[bt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(Pt,At,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,!i||!n||12&t.eventType&&!o)this.reset();else if(1&t.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return xt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}}),_(It,Rt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[bt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Dt,Rt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Mt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:n&V&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=Lt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Vt,At,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[wt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(i&&o&&n){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||z(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,s&&r?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=u((function(){this.state=8,this.tryEmit()}),e.interval,this),2):8}return xt},failTimeout:function(){return this._timer=u((function(){this.state=xt}),this.options.interval,this),xt},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ht.VERSION="2.0.7",Ht.defaults={domEvents:!1,touchAction:vt,enable:!0,inputTarget:null,inputClass:null,preset:[[It,{enable:!1}],[Ot,{enable:!1},["rotate"]],[Dt,{direction:6}],[Mt,{direction:6},["swipe"]],[Vt],[Vt,{event:"doubletap",taps:2},["tap"]],[Pt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ft(t,e){var n;this.options=r({},Ht.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(O?nt:P?ht:M?dt:K))(n,U),this.touchAction=new St(this,this.options.touchAction),Bt(this,!0),f(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function Bt(t,e){var n,i=t.element;i.style&&(f(t.options.cssProps,(function(o,r){n=L(i.style,r),e?(t.oldCssProps[n]=i.style[n],i.style[n]=o):i.style[n]=t.oldCssProps[n]||""})),e||(t.oldCssProps={}))}Ft.prototype={set:function(t){return r(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,o=e.curRecognizer;(!o||o&&8&o.state)&&(o=e.curRecognizer=null);for(var r=0;r<i.length;)n=i[r],2===e.stopped||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(t),!o&&14&n.state&&(o=e.curRecognizer=n),r++}},get:function(t){if(t instanceof At)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(d(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(d(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=x(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==o&&e!==o){var n=this.handlers;return f(S(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==o){var n=this.handlers;return f(S(t),(function(t){e?n[t]&&n[t].splice(x(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var i=n.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<i.length;)i[o](e),o++}},destroy:function(){this.element&&Bt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ht,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:xt,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:V,DIRECTION_ALL:30,Manager:Ft,Input:B,TouchAction:St,TouchInput:ht,MouseInput:K,PointerEventInput:nt,TouchMouseInput:dt,SingleTouchInput:st,Recognizer:At,AttrRecognizer:Rt,Tap:Vt,Pan:Mt,Swipe:Dt,Pinch:Ot,Rotate:It,Press:Pt,on:b,off:C,each:f,merge:m,extend:g,assign:r,inherit:_,bindFn:v,prefixed:L}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Ht,t.exports?t.exports=Ht:e.Hammer=Ht}(window,document)}(Un);var qn=Un.exports;function Wn(t){const e=function(t){const e=[];return t.forEach((t=>{var n;if(null===(n=t.highlights)||void 0===n||!n.length)return;const i=se(t.highlights);i.top>=i.bottom||e.push({top:i.top,bottom:i.bottom,anchor:t})})),e.sort(((t,e)=>t.top<e.top?-1:1)),e}(t),n=new Set,i=new Set,o=[];let r=null;function s(t){const e=t.bottom-t.top,n=t.top+e/2;return{anchors:[t.anchor],top:t.top,bottom:t.bottom,position:n}}e.forEach((t=>{if(t.top<137)return void n.add(t.anchor);if(t.top>window.innerHeight-22)return void i.add(t.anchor);if(!r)return void(r=s(t));const e=t.top>r.top&&t.bottom<r.bottom;if(t.top-r.bottom>60&&!e)o.push(r),r=s(t);else{const e=t.bottom>r.bottom?t.bottom:r.bottom,n=e-r.top;r.anchors.push(t.anchor),r.bottom=e,r.position=r.top+n/2}})),r&&o.push(r);return{above:{anchors:Array.from(n),position:137},below:{anchors:Array.from(i),position:window.innerHeight-22},buckets:o}}function jn({bucket:t,onSelectAnnotations:e}){const n=t.anchors.map((t=>t.annotation)),i=`Select nearby annotations (${t.anchors.length})`;function o(e){t.anchors.forEach((t=>{re(t.highlights||[],e)}))}return gt("button",{className:"Buckets__button Buckets__button--left",onClick:t=>function(t){e(n,t.metaKey||t.ctrlKey)}(t),onMouseMove:()=>o(!0),onMouseOut:()=>o(!1),onBlur:()=>o(!1),title:i,"aria-label":i,children:t.anchors.length})}function $n({bucket:t,direction:e,scrollToAnchor:n}){const i=`Go ${e} to next annotations (${t.anchors.length})`;return gt("button",{className:Z("Buckets__button",`Buckets__button--${e}`),onClick:function(){const i=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=se(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(t.anchors,e);i&&n(i)},title:i,"aria-label":i,children:t.anchors.length})}function zn({above:t,below:e,buckets:n,onSelectAnnotations:i,scrollToAnchor:o}){const r=t.anchors.length>0,s=e.anchors.length>0;return gt("ul",{className:"Buckets__list",children:[r&&gt("li",{className:"Buckets__bucket",style:{top:t.position},children:gt($n,{bucket:t,direction:"up",scrollToAnchor:o})}),n.map(((t,e)=>gt("li",{className:"Buckets__bucket",style:{top:t.position},children:gt(jn,{bucket:t,onSelectAnnotations:i})},e))),s&&gt("li",{className:"Buckets__bucket",style:{top:e.position},children:gt($n,{bucket:e,direction:"down",scrollToAnchor:o})})]})}class Xn{constructor(t,e,{contentContainer:n=document.body}={}){this._contentContainer=n,this._bucketsContainer=document.createElement("div"),t.appendChild(this._bucketsContainer),this._guest=e,this._listeners=new Mt,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(n,"scroll",(()=>this.update())),this._update()}destroy(){this._listeners.removeAll(),this._bucketsContainer.remove()}update(){this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{this._update(),this._updatePending=!1})))}_update(){const t=Wn(this._guest.anchors);M(gt(zn,{above:t.above,below:t.below,buckets:t.buckets,onSelectAnnotations:(t,e)=>this._guest.selectAnnotations(t,e),scrollToAnchor:t=>this._guest.scrollToAnchor(t)}),this._bucketsContainer)}}let Yn={};const Gn=t=>{Yn=t||{}},Zn=function(t){t.on("featureFlagsUpdated",Gn)};function Kn({buttonRef:t,expanded:e,className:n="Toolbar__button",label:i,icon:o,onClick:r,selected:s=!1}){return gt("button",{className:n,"aria-label":i,"aria-expanded":e,"aria-pressed":s,onClick:r,ref:t,title:i,children:gt(_t,{name:o})})}function Jn({closeSidebar:t,createAnnotation:e,isSidebarOpen:n,newAnnotationType:i,showHighlights:o,toggleHighlights:r,toggleSidebar:s,toggleSidebarRef:a,useMinimalControls:l=!1}){return gt("div",{className:"Toolbar",children:[l&&n&&gt(Kn,{className:"Toolbar__sidebar-close",label:"Close annotation sidebar",icon:"cancel",onClick:t}),!l&&gt(Kn,{className:"Toolbar__sidebar-toggle",buttonRef:a,label:"Annotation sidebar",icon:n?"caret-right":"caret-left",expanded:n,onClick:s}),!l&&gt("div",{className:"Toolbar__buttonbar",children:[gt(Kn,{label:"Show highlights",icon:o?"show":"hide",selected:o,onClick:r}),gt(Kn,{label:"note"===i?"New page note":"New annotation",icon:"note"===i?"note":"annotate",onClick:e})]})]})}class Qn{constructor(t,e){const{createAnnotation:n,setSidebarOpen:i,setHighlightsVisible:o}=e;this._container=t,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._closeSidebar=()=>i(!1),this._toggleSidebar=()=>i(!this._sidebarOpen),this._toggleHighlights=()=>o(!this._highlightsVisible),this._createAnnotation=()=>{n(),i(!0)},this._sidebarToggleButton={current:null},this.render()}getWidth(){return this._container.firstChild.getBoundingClientRect().width}set useMinimalControls(t){this._useMinimalControls=t,this.render()}get useMinimalControls(){return this._useMinimalControls}set sidebarOpen(t){this._sidebarOpen=t,this.render()}get sidebarOpen(){return this._sidebarOpen}set newAnnotationType(t){this._newAnnotationType=t,this.render()}get newAnnotationType(){return this._newAnnotationType}set highlightsVisible(t){this._highlightsVisible=t,this.render()}get highlightsVisible(){return this._highlightsVisible}get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){M(gt(Jn,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}class ti{constructor(t,e,n,i={}){if(this._emitter=e.createEmitter(),this._sidebarRPC=new Pt,this.iframe=function(t){const e=Vn(t),n="config="+encodeURIComponent(JSON.stringify(e)),i=t.sidebarAppUrl+"#"+n,o=document.createElement("iframe");return o.setAttribute("allowfullscreen",""),o.src=i,o.title="Hypothesis annotation viewer",o.className="h-sidebar-iframe",o}(i),this.options=i,this.bucketBar=null,i.externalContainerSelector){var o;this.externalFrame=null!==(o=document.querySelector(i.externalContainerSelector))&&void 0!==o?o:t,this.externalFrame.appendChild(this.iframe)}else{if(this.iframeContainer=document.createElement("div"),this.iframeContainer.style.display="none",this.iframeContainer.className="annotator-frame","clean"===i.theme)this.iframeContainer.classList.add("annotator-frame--theme-clean");else{const t=new Xn(this.iframeContainer,n,{contentContainer:n.contentContainer()});this._emitter.subscribe("anchorsChanged",(()=>t.update())),this.bucketBar=t}this.iframeContainer.appendChild(this.iframe),this.hypothesisSidebar=document.createElement("hypothesis-sidebar");Ut(this.hypothesisSidebar).appendChild(this.iframeContainer),t.appendChild(this.hypothesisSidebar)}this.guest=n,this._listeners=new Mt;const r=document.createElement("div");this.toolbar=new Qn(r,{createAnnotation:()=>n.createAnnotation(),setSidebarOpen:t=>t?this.open():this.close(),setHighlightsVisible:t=>this.setHighlightsVisible(t)}),"clean"===i.theme?this.toolbar.useMinimalControls=!0:this.toolbar.useMinimalControls=!1,this._emitter.subscribe("hasSelectionChanged",(t=>{this.toolbar.newAnnotationType=t?"annotation":"note"})),this.iframeContainer?(this.iframeContainer.prepend(r),this.toolbarWidth=this.toolbar.getWidth()):this.toolbarWidth=0,this._listeners.add(window,"resize",(()=>this._onResize())),this._gestureState={initial:null,final:null},this._setupGestures(),this.close();const[s]=i.services||[];s&&(this.onLoginRequest=s.onLoginRequest,this.onLogoutRequest=s.onLogoutRequest,this.onSignupRequest=s.onSignupRequest,this.onProfileRequest=s.onProfileRequest,this.onHelpRequest=s.onHelpRequest),this.onLayoutChange=i.onLayoutChange,this._notifyOfLayoutChange(!1),this._setupSidebarEvents(),this.ready=new Promise((t=>{this._listeners.add(window,"message",(e=>{const{data:n,ports:i}=e;"hypothesisSidebarReady"===(null==n?void 0:n.type)&&(this._sidebarRPC.createChannel(i[0]),t())}))})),this.ready.then((()=>{this.iframeContainer&&(this.iframeContainer.style.display="");const t="always"===i.showHighlights;this.setHighlightsVisible(t),(i.openSidebar||i.annotations||i.query||i.group)&&this.open()})),this._listeners.add(window,"message",(t=>{const{data:e}=t;"hypothesisGuestUnloaded"===(null==e?void 0:e.type)&&this._sidebarRPC.call("frameDestroyed",e.frameIdentifier)}))}destroy(){var t,e;null===(t=this.bucketBar)||void 0===t||t.destroy(),this._listeners.removeAll(),null===(e=this._hammerManager)||void 0===e||e.destroy(),this.hypothesisSidebar?this.hypothesisSidebar.remove():this.iframe.remove(),this._emitter.destroy()}_setupSidebarEvents(){var t;t=document.body,this._sidebarRPC.on("publicAnnotationCountChanged",(function(e){const n=t.querySelectorAll("[data-hypothesis-annotation-count]");Array.from(n).forEach((t=>{t.textContent=e}))})),function(t,e){const n=t.querySelectorAll("[data-hypothesis-trigger]");function i(t){e(),t.stopPropagation()}Array.from(n).forEach((t=>{t.addEventListener("click",i)}))}(document.body,(()=>this.open())),Zn(this._sidebarRPC),this._sidebarRPC.on("showHighlights",(()=>this.setHighlightsVisible(!0))),this._sidebarRPC.on("openSidebar",(()=>this.open())),this._sidebarRPC.on("closeSidebar",(()=>this.close())),this._sidebarRPC.on("openNotebook",(t=>{this.hide(),this._emitter.publish("openNotebook",t)})),this._emitter.subscribe("closeNotebook",(()=>{this.show()}));[["loginRequested",this.onLoginRequest],["logoutRequested",this.onLogoutRequest],["signupRequested",this.onSignupRequest],["profileRequested",this.onProfileRequest],["helpRequested",this.onHelpRequest]].forEach((([t,e])=>{e&&this._sidebarRPC.on(t,(()=>e()))}))}_resetGestureState(){this._gestureState={initial:null,final:null}}_setupGestures(){const t=this.toolbar.sidebarToggleButton;t&&(this._hammerManager=new qn.Manager(t).on("panstart panend panleft panright",(t=>this._onPan(t))),this._hammerManager.add(new qn.Pan({direction:qn.DIRECTION_HORIZONTAL})))}_updateLayout(){this.renderFrame||(this.renderFrame=requestAnimationFrame((()=>{if(this.renderFrame=null,this._gestureState.final!==this._gestureState.initial&&this.iframeContainer){const t=this._gestureState.final,e=-t;this.iframeContainer.style.marginLeft=`${t}px`,e>=280&&(this.iframeContainer.style.width=`${e}px`),this._notifyOfLayoutChange()}})))}_notifyOfLayoutChange(t){var e;const n=this.iframeContainer&&this.toolbar.getWidth()||0,i=null!==(e=this.iframeContainer)&&void 0!==e?e:this.externalFrame,o=i.getBoundingClientRect(),r=window.getComputedStyle(i),s=parseInt(r.width),a=parseInt(r.marginLeft);let l=n;"boolean"==typeof t?t&&(l+=s):(a<280?l-=a:l+=s,t=l>n);const c={expanded:t,width:t?l:n,height:o.height,toolbarWidth:n};this.onLayoutChange&&this.onLayoutChange(c),this.guest.fitSideBySide(c),this._emitter.publish("sidebarLayoutChanged",c)}_onResize(){!0===this.toolbar.sidebarOpen&&(window.innerWidth<280?this.close():this.open())}_onPan(t){const e=this.iframeContainer;if(e)switch(t.type){case"panstart":this._resetGestureState(),e.classList.add("annotator-no-transition"),e.style.pointerEvents="none",this._gestureState.initial=parseInt(getComputedStyle(e).marginLeft);break;case"panend":e.classList.remove("annotator-no-transition"),e.style.pointerEvents="",null===this._gestureState.final||this._gestureState.final<=-280?this.open():this.close(),this._resetGestureState();break;case"panleft":case"panright":{if("number"!=typeof this._gestureState.initial)return;const e=this._gestureState.initial,n=t.deltaX;this._gestureState.final=Math.min(Math.round(e+n),0),this._updateLayout();break}}}open(){if(this._sidebarRPC.call("sidebarOpened"),this._emitter.publish("sidebarOpened"),this.iframeContainer){const t=this.iframeContainer.getBoundingClientRect().width;this.iframeContainer.style.marginLeft=-1*t+"px",this.iframeContainer.classList.remove("annotator-collapsed")}this.toolbar.sidebarOpen=!0,"whenSidebarOpen"===this.options.showHighlights&&this.setHighlightsVisible(!0),this._notifyOfLayoutChange(!0)}close(){this.iframeContainer&&(this.iframeContainer.style.marginLeft="",this.iframeContainer.classList.add("annotator-collapsed")),this.toolbar.sidebarOpen=!1,"whenSidebarOpen"===this.options.showHighlights&&this.setHighlightsVisible(!1),this._notifyOfLayoutChange(!1)}setHighlightsVisible(t){this.toolbar.highlightsVisible=t,this._sidebarRPC.call("setHighlightsVisible",t)}show(){this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}var ei={exports:{}};function ni(){}ni.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function o(){i.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],o=[];if(i&&e)for(var r=0,s=i.length;r<s;r++)i[r].fn!==e&&i[r].fn._!==e&&o.push(i[r]);return o.length?n[t]=o:delete n[t],this}},ei.exports=ni;var ii=ei.exports.TinyEmitter=ni;class oi{constructor(t){this._emitter=t,this._subscriptions=[]}publish(t,...e){this._emitter.emit(t,...e)}subscribe(t,e){this._emitter.on(t,e),this._subscriptions.push([t,e])}unsubscribe(t,e){this._emitter.off(t,e),this._subscriptions=this._subscriptions.filter((([n,i])=>n!==t||i!==e))}destroy(){for(let[t,e]of this._subscriptions)this._emitter.off(t,e);this._subscriptions=[]}}class ri{constructor(){this._emitter=new ii}createEmitter(){return new oi(this._emitter)}}!function(t,{reset:e=!1}={}){e&&mt.clear();for(let[e,n]of Object.entries(t))mt.set(e,n)}(Et);const si=window,ai=document.querySelector('link[type="application/annotator+html"][rel="sidebar"]');new Promise((t=>{"loading"!==document.readyState&&t(),document.addEventListener("readystatechange",(()=>t()))})).then((function(){si.__hypothesis={};const t=Rt("annotator"),e=t.subFrameIdentifier?window.parent:window,n=new ri,i=new Dn(document.body,n,t,e);let o;window===e&&(o=new ti(document.body,n,i,Rt("sidebar")),si.__hypothesis.sidebarWindow=o.ready.then((()=>[o.iframe.contentWindow])));const r=new Bn(document.body,n,Rt("notebook"));let s=si.__hypothesis.sidebarWindow;try{var a;if(!s)s=null===(a=window.parent.__hypothesis)||void 0===a?void 0:a.sidebarWindow}catch{}if(s){const t=new URL(ai.href).origin;s.then((([e])=>i.connectToSidebar(e,t)))}else console.warn(`Hypothesis guest frame in ${location.origin} could not find a sidebar to connect to.\nGuest frames can only connect to sidebars in their same-origin parent frame.`);ai.addEventListener("destroy",(()=>{var t;delete si.__hypothesis,null===(t=o)||void 0===t||t.destroy(),r.destroy(),i.destroy();document.querySelectorAll("[data-hypothesis-asset]").forEach((t=>t.remove()))}))}));
12
12
  //# sourceMappingURL=annotator.bundle.js.map