hypothesis 1.1068.0 → 1.1069.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.
- package/build/boot.js +1 -1
- package/build/manifest.json +9 -9
- package/build/scripts/annotator.bundle.js +102 -102
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +465 -465
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/scripts/ui-playground.bundle.js +165 -165
- package/build/scripts/ui-playground.bundle.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,13 +4,13 @@ document.removeEventListener("touchmove",m),document.removeEventListener("touchs
|
|
|
4
4
|
(e=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(e)}"undefined"!=typeof document&&t(document)}();var e,n,o,i,r,s,a={},c=[],l=/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,i,r,s){var a={type:t,props:e,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++o: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)}}
|
|
5
5
|
function _(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!v.__r++||s!==n.debounceRendering)&&((s=n.debounceRendering)||r)(v)}function v(){for(var t;v.__r=i.length;)t=i.sort((function(t,e){return t.__v.__b-e.__v.__b})),i=[],t.some((function(t){var e,n,o,i,r,s;t.__d&&(r=(i=(e=t).__v).__e,(s=e.__P)&&(n=[],(o=h({},i)).__v=i.__v+1,T(s,i,o,e.__n,void 0!==s.ownerSVGElement,null!=i.__h?[r]:null,n,null==r?g(i):r,i.__h),A(n,i),i.__e!=r&&m(i)))}))}function y(t,e,n,o,i,r,s,l,h,u){var p,m,_,v,y,C,x,S=o&&o.__k||c,E=S.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===(_=S[p])||_&&v.key==_.key&&v.type===_.type)S[p]=void 0;else for(m=0;m<E;m++){if((_=S[m])&&v.key==_.key&&v.type===_.type){S[m]=void 0;break}_=null}T(t,v,_=_||a,i,r,s,l,h,u),y=v.__e,(m=v.ref)&&_.ref!=m&&(x||(x=[]),
|
|
6
6
|
_.ref&&x.push(_.ref,null,v),x.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,_,S,y,h),"function"==typeof n.type&&(n.__d=h)):h&&_.__e==h&&h.parentNode!=t&&(h=g(_))}for(n.__e=C,p=E;p--;)null!=S[p]&&("function"==typeof n.type&&null!=S[p].__e&&S[p].__e==n.__d&&(n.__d=g(o,p+1)),L(S[p],S[p]));if(x)for(p=0;p<x.length;p++)R(x[p],x[++p],x[++p])}function w(t,e,n){for(var o,i=t.__k,r=0;i&&r<i.length;r++)(o=i[r])&&(o.__=t,e="function"==typeof o.type?w(o,e,n):b(n,o,o,i,o.__e,e));return e}function b(t,e,n,o,i,r){var s,a,c;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==n||i!=r||null==i.parentNode)t:if(null==r||r.parentNode!==t)t.appendChild(i),s=null;else{for(a=r,c=0;(a=a.nextSibling)&&c<o.length;c+=2)if(a==i)break t;t.insertBefore(i,r),s=r}return void 0!==s?s:i.nextSibling}function C(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||l.test(e)?n:n+"px"}function x(t,e,n,o,i){var r
|
|
7
|
-
;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof o&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||C(t.style,e,"");if(n)for(e in n)o&&n[e]===o[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?o||t.addEventListener(e,r?E:S,r):t.removeEventListener(e,r?E:S,r);else if("dangerouslySetInnerHTML"!==e){if(i)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 S(t){this.l[t.type+!1](n.event?n.event(t):t)}function E(t){this.l[t.type+!0](n.event?n.event(t):t)}function T(t,e,o,i,r,s,a,c,l){var u,d,g,m,_,v,w,b,C,x,S,E=e.type;if(void 0!==e.constructor)return null;null!=o.__h&&(l=o.__h,c=e.__e=o.__e,e.__h=null,s=[c]),
|
|
8
|
-
;try{t:if("function"==typeof
|
|
9
|
-
null!=d.componentWillUpdate&&d.componentWillUpdate(b,d.__s,x),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(m,_,v)}))}d.context=x,d.props=b,d.
|
|
10
|
-
null!=s)for(;v<s.length;v++)if((h=s[v])&&"setAttribute"in h==!!_&&(_?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,l=!1}if(null===_)p===m||l&&t.data===m||(t.data=m);else{if(s=s&&e.call(t.childNodes),d=(p=o.props||a).dangerouslySetInnerHTML,f=m.dangerouslySetInnerHTML,!l){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,o,i){var r;for(r in n)"children"===r||"key"===r||r in e||x(t,r,null,n[r],o);for(r in e)i&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||x(t,r,e[r],n[r],o)}(t,m,p,r,l),f)n.__k=[];else if(v=n.props.children,
|
|
11
|
-
null!=s)for(v=s.length;v--;)null!=s[v]&&u(s[v]);l||("value"in m&&void 0!==(v=m.value)&&(v!==t.value||"progress"===_&&!v||"option"===_&&v!==p.value)&&x(t,"value",v,p.value,!1),"checked"in m&&void 0!==(v=m.checked)&&v!==t.checked&&x(t,"checked",v,p.checked,!1))}return t}function R(t,e,o){try{"function"==typeof t?t(e):t.current=e}catch(t){n.__e(t,o)}}function L(t,e,o){var i,r;if(n.unmount&&n.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||R(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){n.__e(t,e)}i.base=i.__P=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&L(i[r],e,"function"!=typeof t.type);o||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function P(t,e,n){return this.constructor(t,n)}function M(t,o,i){var r,s,c;n.__&&n.__(t,o),s=(r="function"==typeof i)?null:i&&i.__k||o.__k,c=[],T(o,t=(!r&&i||o).__k=function(t,n,o){var i,r,s,a={};for(s in n)"key"==s?i=n[s]:"ref"==s?r=n[s]:a[s]=n[s]
|
|
12
|
-
"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return d(t,a,i,r,null)}(f,null,[t]),s||a,a,void 0!==o.ownerSVGElement,!r&&i?[i]:s?null:o.firstChild?e.call(o.childNodes):null,c,!r&&i?i:s?s.__e:o.firstChild,r),A(c,t)}e=c.slice,n={__e:function(t,e,n,o){for(var i,r,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,o||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},o=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,i=[],
|
|
13
|
-
"undefined"!=typeof window&&window.__PREACT_DEVTOOLS__&&window.__PREACT_DEVTOOLS__.attachPreact("10.
|
|
7
|
+
;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof o&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||C(t.style,e,"");if(n)for(e in n)o&&n[e]===o[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?o||t.addEventListener(e,r?E:S,r):t.removeEventListener(e,r?E:S,r);else if("dangerouslySetInnerHTML"!==e){if(i)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 S(t){this.l[t.type+!1](n.event?n.event(t):t)}function E(t){this.l[t.type+!0](n.event?n.event(t):t)}function T(t,e,o,i,r,s,a,c,l){var u,d,g,m,_,v,w,b,C,x,S,E,T,A=e.type;if(void 0!==e.constructor)return null;null!=o.__h&&(l=o.__h,c=e.__e=o.__e,e.__h=null,s=[c]),
|
|
8
|
+
(u=n.__b)&&u(e);try{t:if("function"==typeof A){if(b=e.props,C=(u=A.contextType)&&i[u.__c],x=u?C?C.props.value:u.__:i,o.__c?w=(d=e.__c=o.__c).__=d.__E:("prototype"in A&&A.prototype.render?e.__c=d=new A(b,x):(e.__c=d=new p(b,x),d.constructor=A,d.render=P),C&&C.sub(d),d.props=b,d.state||(d.state={}),d.context=x,d.__n=i,g=d.__d=!0,d.__h=[]),null==d.__s&&(d.__s=d.state),null!=A.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=h({},d.__s)),h(d.__s,A.getDerivedStateFromProps(b,d.__s))),m=d.props,_=d.state,g)null==A.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==A.getDerivedStateFromProps&&b!==m&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(b,x),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(b,d.__s,x)||e.__v===o.__v){d.props=b,d.state=d.__s,e.__v!==o.__v&&(d.__d=!1),d.__v=e,e.__e=o.__e,e.__k=o.__k,e.__k.forEach((function(t){t&&(t.__=e)})),d.__h.length&&a.push(d);break t}
|
|
9
|
+
null!=d.componentWillUpdate&&d.componentWillUpdate(b,d.__s,x),null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(m,_,v)}))}if(d.context=x,d.props=b,d.__v=e,d.__P=t,S=n.__r,E=0,"prototype"in A&&A.prototype.render)d.state=d.__s,d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context);else do{d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++E<25);d.state=d.__s,null!=d.getChildContext&&(i=h(h({},i),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,o,i,r,s,a,c,l),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===o.__v?(e.__k=o.__k,e.__e=o.__e):e.__e=k(o.__e,e,o,i,r,s,a,l);(u=n.diffed)&&u(e)}catch(t){e.__v=null,(l||null!=s)&&(e.__e=c,e.__h=!!l,s[s.indexOf(c)]=null),n.__e(t,e,o)}}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)}))
|
|
10
|
+
}catch(t){n.__e(t,e.__v)}}))}function k(t,n,o,i,r,s,c,l){var h,d,f,p=o.props,m=n.props,_=n.type,v=0;if("svg"===_&&(r=!0),null!=s)for(;v<s.length;v++)if((h=s[v])&&"setAttribute"in h==!!_&&(_?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,l=!1}if(null===_)p===m||l&&t.data===m||(t.data=m);else{if(s=s&&e.call(t.childNodes),d=(p=o.props||a).dangerouslySetInnerHTML,f=m.dangerouslySetInnerHTML,!l){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,o,i){var r;for(r in n)"children"===r||"key"===r||r in e||x(t,r,null,n[r],o);for(r in e)i&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||x(t,r,e[r],n[r],o)}(t,m,p,r,l),f)n.__k=[];else if(v=n.props.children,
|
|
11
|
+
y(t,Array.isArray(v)?v:[v],n,o,i,r&&"foreignObject"!==_,s,c,s?s[0]:o.__k&&g(o,0),l),null!=s)for(v=s.length;v--;)null!=s[v]&&u(s[v]);l||("value"in m&&void 0!==(v=m.value)&&(v!==t.value||"progress"===_&&!v||"option"===_&&v!==p.value)&&x(t,"value",v,p.value,!1),"checked"in m&&void 0!==(v=m.checked)&&v!==t.checked&&x(t,"checked",v,p.checked,!1))}return t}function R(t,e,o){try{"function"==typeof t?t(e):t.current=e}catch(t){n.__e(t,o)}}function L(t,e,o){var i,r;if(n.unmount&&n.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||R(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){n.__e(t,e)}i.base=i.__P=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&L(i[r],e,"function"!=typeof t.type);o||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function P(t,e,n){return this.constructor(t,n)}function M(t,o,i){var r,s,c;n.__&&n.__(t,o),s=(r="function"==typeof i)?null:i&&i.__k||o.__k,c=[],T(o,t=(!r&&i||o).__k=function(t,n,o){var i,r,s,a={};for(s in n)"key"==s?i=n[s]:"ref"==s?r=n[s]:a[s]=n[s]
|
|
12
|
+
;if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return d(t,a,i,r,null)}(f,null,[t]),s||a,a,void 0!==o.ownerSVGElement,!r&&i?[i]:s?null:o.firstChild?e.call(o.childNodes):null,c,!r&&i?i:s?s.__e:o.firstChild,r),A(c,t)}e=c.slice,n={__e:function(t,e,n,o){for(var i,r,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(t)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(t,o||{}),s=i.__d),s)return i.__E=i}catch(e){t=e}throw t}},o=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,i=[],
|
|
13
|
+
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.8.1",n,{Fragment:f,Component:p});var N={};function O(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 B(){return I.length>0?I[I.length-1]:null}var F=!1;function H(t){return"function"==typeof t.type&&t.type!=f}function V(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 "+O(e);var n=e.__source;return n?t+=" (at "+n.fileName+":"+n.lineNumber+")":F||(F=!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 q="function"==typeof WeakMap,U=p.prototype.setState;p.prototype.setState=function(t,e){
|
|
14
14
|
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'+V(B())):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'+V(this.__v)),U.call(this,t,e)};var W=p.prototype.forceUpdate;function z(t){var e=t.props,n=O(t),o="";for(var i in e)if(e.hasOwnProperty(i)&&"children"!==i){var r=e[i];"function"==typeof r&&(r="function "+(r.displayName||r.name)+"() {}"),r=Object(r)!==r||r.toString?r+"":Object.prototype.toString.call(r),o+=" "+i+"="+JSON.stringify(r)}var s=e.children;return"<"+n+o+(s&&s.length?">..</"+n+">":" />")}p.prototype.forceUpdate=function(t){
|
|
15
15
|
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'+V(B())):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'+V(this.__v)),W.call(this,t)},function(){!function(){var t=n.__b,e=n.diffed,o=n.__,i=n.vnode,r=n.__r;n.diffed=function(t){H(t)&&D.pop(),I.pop(),e&&e(t)},n.__b=function(e){H(e)&&I.push(e),t&&t(e)},n.__=function(t,e){D=[],o&&o(t,e)},n.vnode=function(t){t.__o=D.length>0?D[D.length-1]:null,i&&i(t)},n.__r=function(t){H(t)&&D.push(t),r&&r(t)}}();var t=!1,e=n.__b,o=n.diffed,i=n.vnode,r=n.__e,s=n.__,a=n.__h,c=q?{useEffect:new WeakMap,useLayoutEffect:new WeakMap,lazyPropTypes:new WeakMap}:null,l=[];n.__e=function(t,e,n,o){if(e&&e.__c&&"function"==typeof t.then){var i=t
|
|
16
16
|
;t=new Error("Missing Suspense. The throwing component was: "+O(e));for(var s=e;s;s=s.__)if(s.__c&&s.__c.__c){t=i;break}if(t instanceof Error)throw t}try{(o=o||{}).componentStack=V(e),r(t,e,n,o),"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 o=O(t);throw new Error("Expected a valid HTML node as a second argument to render.\tReceived "+e+" instead: render(<"+o+" />, "+e+");")}s&&s(t,e)},n.__b=function(n){var o=n.type,i=function t(e){return e?"function"==typeof e.type?t(e.__):e:{}}(n.__);if(t=!0,void 0===o)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"+z(n)+"\n\n"+V(n));if(null!=o&&"object"==typeof o){
|
|
@@ -18,96 +18,96 @@ if(void 0!==o.__k&&void 0!==o.__e)throw new Error("Invalid type passed to create
|
|
|
18
18
|
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"+z(n)+"\n\n"+V(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"+z(n)+"\n\n"+V(n));if("function"==typeof n.type&&n.type.propTypes){if("Lazy"===n.type.displayName&&c&&!c.lazyPropTypes.has(n.type)){var s="PropTypes are not supported on lazy(). Use propTypes on the wrapped component itself. ";try{var a=n.type();c.lazyPropTypes.set(n.type,!0),console.warn(s+"Component wrapped in lazy() is "+O(a))}catch(n){console.warn(s+"We will log the wrapped component's name once it is loaded.")}}var l=n.props;n.type.__f&&delete(l=function(t,e){for(var n in e)t[n]=e[n];return t}({},l)).ref,function(t,e,n,o,i){
|
|
19
19
|
Object.keys(t).forEach((function(n){var r;try{r=t[n](e,n,o,"prop",null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){r=t}!r||r.message in N||(N[r.message]=!0,console.error("Failed prop type: "+r.message+(i&&"\n"+i()||"")))}))}(n.type.propTypes,l,0,O(n),(function(){return V(n)}))}e&&e(n)},n.__h=function(e,n,o){if(!e||!t)throw new Error("Hook can only be invoked from render methods.");a&&a(e,n,o)};var h=function(t,e){return{get:function(){var n="get"+t+e;l&&l.indexOf(n)<0&&(l.push(n),console.warn("getting vnode."+t+" is deprecated, "+e))},set:function(){var n="set"+t+e;l&&l.indexOf(n)<0&&(l.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 o in e){var r=e[o]
|
|
20
20
|
;"__source"===o?t.__source=r:"__self"===o?t.__self=r:n[o]=r}}t.__proto__=d,i&&i(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"+V(e))}})),t=!1,o&&o(e),null!=e.__k)for(var n=[],i=0;i<e.__k.length;i++){var r=e.__k[i];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'+z(e)+"\n\n"+V(e));break}n.push(s)}}}}();var $,j={exports:{}};$=j,function(){var t={}.hasOwnProperty;function e(){for(var n=[],o=0;o<arguments.length;o++){var i=arguments[o];if(i){var r=typeof i;if("string"===r||"number"===r)n.push(i);else if(Array.isArray(i)){if(i.length){var s=e.apply(null,i);s&&n.push(s)}
|
|
21
|
-
}else if("object"===r)if(i.toString===Object.prototype.toString)for(var a in i)t.call(i,a)&&i[a]&&n.push(a);else n.push(i.toString())}}return n.join(" ")}$.exports?(e.default=e,$.exports=e):window.classNames=e}();var X,Y,G,Z=j.exports,
|
|
22
|
-
t.__H.__h.forEach(
|
|
23
|
-
function ft(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function
|
|
24
|
-
function
|
|
25
|
-
children:[o&&"left"===i&&
|
|
26
|
-
;var
|
|
27
|
-
className:
|
|
28
|
-
;
|
|
29
|
-
;const
|
|
21
|
+
}else if("object"===r)if(i.toString===Object.prototype.toString)for(var a in i)t.call(i,a)&&i[a]&&n.push(a);else n.push(i.toString())}}return n.join(" ")}$.exports?(e.default=e,$.exports=e):window.classNames=e}();var X,Y,G,Z,K=j.exports,J=0,Q=[],tt=n.__b,et=n.__r,nt=n.diffed,ot=n.__c,it=n.unmount;function rt(t,e){n.__h&&n.__h(Y,t,J||e),J=0;var o=Y.__H||(Y.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function st(t){return J=1,function(t,e,n){var o=rt(X++,2);return o.t=t,o.__c||(o.__=[n?n(e):gt(void 0,e),function(t){var e=o.t(o.__[0],t);o.__[0]!==e&&(o.__=[e,o.__[1]],o.__c.setState({}))}],o.__c=Y),o.__}(gt,t)}function at(t,e){var o=rt(X++,3);!n.__s&&pt(o.__H,e)&&(o.__=t,o.u=e,Y.__H.__h.push(o))}function ct(t,e){var o=rt(X++,4);!n.__s&&pt(o.__H,e)&&(o.__=t,o.u=e,Y.__h.push(o))}function lt(t){return J=5,function(t,e){var n=rt(X++,7);return pt(n.__H,e)?(n.o=t(),n.u=e,n.__h=t,n.o):n.__}((function(){return{current:t}}),[])}function ht(){for(var t;t=Q.shift();)if(t.__P)try{t.__H.__h.forEach(dt),
|
|
22
|
+
t.__H.__h.forEach(ft),t.__H.__h=[]}catch(e){t.__H.__h=[],n.__e(e,t.__v)}}n.__b=function(t){Y=null,tt&&tt(t)},n.__r=function(t){et&&et(t),X=0;var e=(Y=t.__c).__H;e&&(G===Y?(e.__h=[],Y.__h=[],e.__.forEach((function(t){t.o=t.u=void 0}))):(e.__.forEach((function(t){t.u&&(t.__H=t.u),t.o&&(t.__=t.o),t.o=t.u=void 0})),e.__h.forEach(dt),e.__h.forEach(ft),e.__h=[])),G=Y},n.diffed=function(t){nt&&nt(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(1!==Q.push(e)&&Z===n.requestAnimationFrame||((Z=n.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(o),ut&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,100);ut&&(e=requestAnimationFrame(n))})(ht)),Y=null,G=null},n.__c=function(t,e){e.some((function(t){try{t.__H&&t.__H.__.forEach((function(t){t.u&&(t.__H=t.u),t.o&&(t.__=t.o),t.o=t.u=void 0})),t.__h.forEach(dt),t.__h=t.__h.filter((function(t){return!t.__||ft(t)}))}catch(o){e.some((function(t){t.__h&&(t.__h=[])})),e=[],n.__e(o,t.__v)}})),ot&&ot(t,e)},n.unmount=function(t){it&&it(t);var e,o=t.__c
|
|
23
|
+
;o&&o.__H&&(o.__H.__.forEach((function(t){try{dt(t)}catch(t){e=t}})),e&&n.__e(e,o.__v))};var ut="function"==typeof requestAnimationFrame;function dt(t){var e=Y,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),Y=e}function ft(t){var e=Y;t.__c=t.__(),Y=e}function pt(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function gt(t,e){return"function"==typeof e?e(t):e}var mt=0;function _t(t,e,o,i,r){var s,a,c={};for(a in e)"ref"==a?s=e[a]:c[a]=e[a];var l={type:t,props:c,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--mt,__source:r,__self:i};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===c[a]&&(c[a]=s[a]);return n.vnode&&n.vnode(l),l}const vt=new Map;function yt({name:t,className:e="",inline:n=!1,title:o=""}){const i=vt.get(t);if(!i)throw new Error(`Icon "${t.toString()}" is not registered`);const r=lt();ct((()=>{const t=r.current.querySelector("svg");t&&t.setAttribute("class",e)}),[e,i]);const s={};return o&&(s.title=o),
|
|
24
|
+
_t("span",{className:K("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":n}),dangerouslySetInnerHTML:{__html:i},ref:r,...s},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function wt(t,e){const n="string"==typeof t?Symbol(t):t;return vt.set(n,e),n}var bt="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js";function Ct({buttonRef:t,classes:e,className:n,icon:o,iconPosition:i="left",size:r="medium",variant:s="normal",expanded:a,pressed:c,type:l="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"]=c:(f["aria-pressed"]=c,f["aria-expanded"]=a),_t("button",{ref:t,className:K(n,`${n}--${r}`,`${n}--${s}`,{[`${n}--icon-${i}`]:o},e),type:l,...f,...h},void 0,!1,{fileName:bt,lineNumber:82,columnNumber:5})}function xt({className:t="Hyp-IconButton",...e}){const{icon:n}=e;return _t(Ct,{className:t,...e,children:_t(yt,{name:n},void 0,!1,{
|
|
25
|
+
fileName:bt,lineNumber:109,columnNumber:7})},void 0,!1,{fileName:bt,lineNumber:108,columnNumber:5})}function St({children:t,className:e="Hyp-LabeledButton",...n}){const{icon:o,iconPosition:i="left"}=n;return _t(Ct,{className:e,...n,children:[o&&"left"===i&&_t(yt,{name:o},void 0,!1,{fileName:bt,lineNumber:127,columnNumber:43}),t,o&&"right"===i&&_t(yt,{name:o},void 0,!1,{fileName:bt,lineNumber:129,columnNumber:44})]},void 0,!0,{fileName:bt,lineNumber:126,columnNumber:5})}wt("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>')
|
|
26
|
+
;var Et='<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';wt("cancel",Et);function Tt({name:t,classes:e="",containerClasses:n="",title:o=""}){const i=vt.get(t);if(!i)throw new Error(`Icon "${t.toString()}" is not registered`);const r=lt();ct((()=>{const t=r.current.querySelector("svg");t&&t.setAttribute("class",K("Hyp-Icon",e))}),[e,i]);const s={};return o&&(s.title=o),_t("span",{className:n,dangerouslySetInnerHTML:{__html:i},ref:r,...s},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Icon.js",lineNumber:60,columnNumber:5})}function At({children:t,classes:e="",linkRef:n,...o}){return _t("a",{
|
|
27
|
+
className:K("Hyp-Link",e),ref:n,rel:"noopener noreferrer",...o,children:t},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Link.js",lineNumber:24,columnNumber:5})}wt("cancel",Et)
|
|
28
|
+
;wt("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>')
|
|
29
|
+
;const kt={
|
|
30
30
|
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',
|
|
31
|
-
cancel:
|
|
31
|
+
cancel:Et,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>',
|
|
32
32
|
"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>',
|
|
33
33
|
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>',
|
|
34
34
|
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>',
|
|
35
35
|
jstor:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 970 250" xml:space="preserve" width="96" height="25">\n<style type="text/css">\n\t.st0{clip-path:url(#SVGID_2_);fill:#990000;}\n</style>\n<g>\n\t<path class="st0" d="M448,112.8c-17.1-11.5-33.3-22.4-33.3-43.7c0-12.6,7.6-26.1,28.8-26.1c18.3,0,29.7,9.2,33.2,26.7\n\t\tc0.1,0.4,0.4,0.7,0.8,0.7h1.4c0.2,0,0.4-0.1,0.6-0.3c0.2-0.2,0.2-0.4,0.2-0.6c-0.2-3.5-0.2-9.5-0.2-13c0-6,0.2-10.2,0.7-15.6\n\t\tc0-0.2-0.1-0.5-0.3-0.7c-0.2-0.2-0.5-0.2-0.7-0.2c-1.4,0.2-2.5,0.2-4,0.2c-4.2,0-8.3-0.8-12.7-1.6c-5.5-1-11.7-2.2-19.5-2.2\n\t\tc-26.9,0-45.7,17.9-45.7,43.4c0,26.9,19.3,39.8,37.9,52.2c17.9,11.9,34.9,23.2,34.9,46.1c0,21.6-16.2,31.3-32.2,31.3\n\t\tc-18.5,0-37.3-10-37.3-29.2c0-1.6,0.2-3.3,0.4-5.1l0.1-0.8c0-0.2-0.1-0.5-0.2-0.6c-0.2-0.2-0.4-0.3-0.6-0.3H399\n\t\tc-0.3,0-0.6,0.2-0.8,0.5c-2.8,6.1-3,13.3-3,15.3c0,3.1,0.3,5.9,0.6,8.7c0.3,2.6,0.6,5.1,0.6,7.8c0,2.1,0,4.9-0.2,6\n\t\tc-0.1,0.3,0,0.5,0.2,0.7c0.2,0.2,0.5,0.3,0.7,0.2c1.4-0.2,2.1-0.2,3.5-0.2c5.3,0,9.6,1,14.3,2c5.5,1.2,11.8,2.6,20.7,2.6\n\t\tc30.2,0,51.3-20.2,51.3-49.1C486.9,138.9,467.1,125.6,448,112.8"/>\n\t<path class="st0" d="M779.9,128.7c0,50-25.3,81.1-66,81.1c-40.3,0-64.3-30.9-64.3-82.6c0-38.6,16.8-83.8,64.3-83.8\n\t\tC744.3,43.5,779.9,65.8,779.9,128.7 M715.8,36.5c-56.8,0-90.8,46.5-90.8,91.4c0,43.8,33.2,89,88.8,89c50.6,0,90.3-39.4,90.3-89.7\n\t\tC804.1,76.4,765.4,36.5,715.8,36.5"/>\n\t<path class="st0" d="M903.2,89.3c0,27.6-14.4,40.5-45.3,40.5h-11.3V45.6c7.2-1.9,12-2.3,17.4-2.3C887.8,43.4,903.2,61.4,903.2,89.3\n\t\t M953.3,214c-14.7-5-31.8-34.9-44.3-56.7c-7.1-12.4-12.8-22.5-16.9-26.3c21.4-8.1,34.1-24.7,34.1-44.8c0-30.4-23.8-50-60.6-50\n\t\tc-2.6,0-6.8,0.1-11.3,0.2c-5.1,0.1-11,0.3-15.1,0.3c-11.1,0-15.7,0-24.3-0.5c-0.2,0-0.4,0.1-0.6,0.2c-0.2,0.2-0.3,0.4-0.3,0.6v1.2\n\t\tc0,0.4,0.3,0.7,0.7,0.8c8.6,1.3,11.5,4.6,11.5,21.6v132.1c0,19.7-3.3,20.2-12,21.6c-0.4,0.1-0.7,0.4-0.7,0.8v1.2\n\t\tc0,0.2,0.1,0.4,0.3,0.6c0.2,0.2,0.4,0.3,0.6,0.2c5.1-0.2,12.2-0.5,22-0.5c10.4,0,18.9,0.3,22,0.5c0.2,0,0.4-0.1,0.6-0.2\n\t\tc0.2-0.2,0.3-0.4,0.3-0.6V215c0-0.4-0.3-0.7-0.7-0.8c-8.7-1.4-12-1.9-12-21.6v-56H862c2.8,0,6.3-0.3,10.4-0.9\n\t\tc4.5,4.1,9.6,13.7,12.7,19.5c0.7,1.2,1.2,2.3,1.7,3.1c29.7,54.7,33,58,59.8,59c3.1,0,4.1,0,6.4-0.2c0.4,0,0.7-0.4,0.7-0.8v-1.5\n\t\tC953.8,214.4,953.6,214.1,953.3,214"/>\n\t<path class="st0" d="M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-0.5,0.5-0.7,0.9-0.9,1.2c-0.3,0.4-0.3,0.4-1,0.1c0,0-0.1,0-0.1-0.2c-0.5-1.3,1-5.7,2.8-8.9c1.5-2.5,3.1-4.3,5.3-6l0.6-0.5\n\t\tl-0.8,0.2c-7.5,1.7-15.1,4.6-19.7,7.7c-5.9,3.9-10.7,8.6-14.3,13.8c-0.7-0.4-1.2-0.7-2.8-1.4c-1-0.4-2.4-0.9-3.5-1\n\t\tc1.5-1.9,4-4.6,5-5.7l0.1-0.1c0.1-0.2,0.1-0.5-0.1-0.8c-0.2-0.2-0.5-0.3-0.8-0.2c-0.3,0.1-7,2.6-18.8-1.7C40.4,83.2,30.4,73,31,55\n\t\tC31.6,36.7,44.7,27.4,57.4,26.2 M16.2,240h234.2V10H16.2V240z"/>\n</g>\n</svg>\n',
|
|
36
36
|
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',
|
|
37
|
-
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>'};class
|
|
38
|
-
this._listeners.clear()}}function
|
|
39
|
-
},r=setInterval(i,250),s=setTimeout((()=>{clearInterval(r),o(new Error(`Unable to establish ${this._source}-${t} communication channel`))}),2e4),a=this._listeners.add(window,"message",(o=>{const{data:i,ports:c}=o;
|
|
40
|
-
return t instanceof Error?{message:t.message,stack:t.stack}:{message:String(t),stack:void 0}}function
|
|
41
|
-
e.has(n)||(e.add(n),
|
|
42
|
-
}catch(t){throw
|
|
43
|
-
this._listeners.add(t,"message",(t=>this._handle(t))),t.start()
|
|
44
|
-
;this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function
|
|
45
|
-
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 o(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=
|
|
46
|
-
const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:o}}function
|
|
47
|
-
},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:
|
|
48
|
-
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)){const t=
|
|
49
|
-
;return((t.ctrlKey?
|
|
50
|
-
className:
|
|
51
|
-
className:
|
|
52
|
-
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:o,arrowDirection:i}=this._calculateTarget(t,e);this._showAt(n,o),this._isVisible=!0,this._arrowDirection=2===i?"up":"down",this._render()}_calculateTarget(t,e){let n,o,i;n=e&&!
|
|
53
|
-
o=2===n?t.top+t.height+10+a:t.top-c-10,i=Math.max(i,0),i=Math.min(i,this._view.innerWidth-s),o=Math.max(o,0),o=Math.min(o,this._view.innerHeight-c),{top:o,left:i,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),o=this._height(),i=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+o),...document.elementsFromPoint(t+n/2,e+o/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+o)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return i.push(0),Math.max(...i)+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(),o=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:
|
|
54
|
-
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)}}function
|
|
55
|
-
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+=
|
|
56
|
-
if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let o=0;o<e;o++)n+=
|
|
57
|
-
if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function
|
|
58
|
-
;function
|
|
59
|
-
;let n=e.parentElement.querySelector(".hypothesis-highlight-layer");if(!n){n=document.createElementNS(
|
|
60
|
-
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
|
|
61
|
-
bottom:i})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}let
|
|
62
|
-
if(0===e.length)return[];n=Math.min(n,e.length);const o=[],i=32,r=Math.ceil(e.length/i)-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)%i;const a=new Uint32Array(r+1),c=new Map,l=[];for(let t=0;t<256;t++)l.push(a);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(c.has(n))continue;const o=new Uint32Array(r+1);c.set(n,o),n<l.length&&(l[n]=o);for(let t=0;t<=r;t+=1){o[t]=0;for(let r=0;r<i;r+=1){const s=t*i+r;if(s>=e.length)continue;e.charCodeAt(s)===n&&(o[t]|=1<<r)}}}let h=Math.max(0,Math.ceil(n/i)-1);const u=new Uint32Array(r+1);for(let t=0;t<=h;t+=1)u[t]=(t+1)*i;u[r]=e.length;for(let t=0;t<=h;t+=1)s.P[t]=-1,s.M[t]=0;for(let d=0;d<t.length;d+=1){const f=t.charCodeAt(d);let p;f<l.length?p=l[f]:(p=c.get(f),void 0===p&&(p=a));let g=0;for(let t=0;t<=h;t+=1)g=
|
|
63
|
-
;u[h]=u[h-1]+t-g+
|
|
64
|
-
a=1-Math.abs(o.start-n.hint)/t.length}return(50*i+20*r+20*s+2*a)/92},s=i.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function
|
|
65
|
-
;const o=t.slice(i+1,t.indexOf("]"));if(n=parseInt(o)-1,n<0)return null}else e=t,n=0;const r
|
|
66
|
-
static fromRange(t,e){const n=
|
|
67
|
-
;return new
|
|
37
|
+
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>'};class Rt{constructor(){this._listeners=new Map}add(t,e,n,o){t.addEventListener(e,n,o);const i=Symbol();return this._listeners.set(i,{eventTarget:t,eventType:e,listener:n}),i}remove(t){const e=this._listeners.get(t);if(e){const{eventTarget:n,eventType:o,listener:i}=e;n.removeEventListener(o,i),this._listeners.delete(t)}}removeAll(){this._listeners.forEach((({eventTarget:t,eventType:e,listener:n})=>{t.removeEventListener(e,n)})),
|
|
38
|
+
this._listeners.clear()}}function Lt(t){const e=t.toString(16);return 1===e.length?"0"+e:e}function Pt(t){const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e).map(Lt).join("")}function Mt(t){if(null===t||"object"!=typeof t)return!1;for(let e of["frame1","frame2","type","requestId"])if("string"!=typeof t[e])return!1;return!0}function Nt(t,e){return!!Mt(t)&&JSON.stringify(t,Object.keys(e).sort())===JSON.stringify(e,Object.keys(e).sort())}class Ot{constructor({hostFrame:t,source:e}){this._hostFrame=t,this._source=e,this._listeners=new Rt}destroy(){this._listeners.removeAll()}async discover(t){let e=!1;if(("guest"===this._source&&"host"===t||"guest"===this._source&&"sidebar"===t||"sidebar"===this._source&&"host"===t||"notebook"===this._source&&"sidebar"===t)&&(e=!0),!e)throw new Error("Invalid request of channel/port");const n=Pt(6);return new Promise(((e,o)=>{const i=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:t,type:"request",requestId:n},"*")
|
|
39
|
+
},r=setInterval(i,250),s=setTimeout((()=>{clearInterval(r),o(new Error(`Unable to establish ${this._source}-${t} communication channel`))}),2e4),a=this._listeners.add(window,"message",(o=>{const{data:i,ports:c}=o;Nt(i,{frame1:this._source,frame2:t,type:"offer",requestId:n})&&(clearInterval(r),clearTimeout(s),this._listeners.remove(a),e(c[0]))}));i()}))}}var It={exports:{}};function Dt(){}Dt.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function i(){o.off(t,i),e.apply(n,arguments)}return i._=e,this.on(t,i,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;o<i;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,s=o.length;r<s;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},It.exports=Dt;var Bt=It.exports.TinyEmitter=Dt;let Ft=null;function Ht(t){
|
|
40
|
+
return t instanceof Error?{message:t.message,stack:t.stack}:{message:String(t),stack:void 0}}function Vt(t,e){if(!Ft)return;const n={type:"hypothesis-error",error:t instanceof Error?t:Ht(t),context:e};try{try{Ft.postMessage(n,"*")}catch(t){if(!(t instanceof DOMException&&"DataCloneError"===t.name))throw t;n.error=Ht(n.error),Ft.postMessage(n,"*")}}catch(t){console.warn("Unable to report Hypothesis error",t)}}function qt(t){Ft=t}class Ut{constructor(t){this._hypothesisAppsOrigin=t,this._emitter=new Bt,this._handledRequests=new Set,this._sidebarHostChannel=new MessageChannel,this._listeners=new Rt,this._allowedMessages=[{allowedOrigin:"*",frame1:"guest",frame2:"host",type:"request"},{allowedOrigin:"*",frame1:"guest",frame2:"sidebar",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,frame1:"sidebar",frame2:"host",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,frame1:"notebook",frame2:"sidebar",type:"request"}],this._listen()}_listen(){const t="Handling port request",e=new Set,n=n=>{
|
|
41
|
+
e.has(n)||(e.add(n),Vt(new Error(n),t))};var o,i;this._listeners.add(window,"message",(o=t=>{const{data:e,origin:o,source:i}=t;if(!Mt(e)||"request"!==e.type)return;const{frame1:r,frame2:s,requestId:a}=e,c=`${r}-${s}`;if(!function(t){return!(null===t||t instanceof MessagePort||window.ServiceWorker&&t instanceof ServiceWorker)}(i))return void n(`Ignored port request for channel ${c} from non-Window source`);if(void 0===this._allowedMessages.find((({allowedOrigin:t,...n})=>this._messageMatches({allowedMessage:n,allowedOrigin:t,data:e,origin:o}))))return void n(`Ignored invalid port request for channel ${c} from ${o}`);if(this._handledRequests.has(a))return;this._handledRequests.add(a);const l="sidebar-host"===c?this._sidebarHostChannel:new MessageChannel,h={frame1:r,frame2:s,type:"offer",requestId:a},u="null"===o?"*":o;i.postMessage(h,u,[l.port1]),"sidebar"===s?this._sidebarHostChannel.port2.postMessage(h,[l.port2]):"host"===s&&this._emitter.emit("frameConnected",r,l.port2)},i=t,(...t)=>{try{return o(...t)
|
|
42
|
+
}catch(t){throw Vt(t,i),t}}))}_messageMatches({allowedMessage:t,allowedOrigin:e,data:n,origin:o}){return("*"===e||o===e)&&Nt(n,t)}on(t,e){this._emitter.on(t,e)}destroy(){this._listeners.removeAll()}}const Wt="1.0.0",zt="frame-rpc";function $t(t,e,n=[],o=-1){t.postMessage({protocol:zt,version:Wt,arguments:n,method:e,sequence:o})}function jt(t){const e=t.match(/\bAppleWebKit\/([0-9]+)\b/);if(!e)return!1;return!(parseInt(e[1])<=537)}class Xt{constructor({userAgent:t=navigator.userAgent,currentWindow:e=window}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new Rt,this._listeners.add(e,"unload",(()=>{this._port&&($t(this._port,"close"),e!==e.parent&&jt(t)&&e.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],this._receivedCloseEvent=!1}on(t,e){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(t,e)}connect(t){this._port=t,
|
|
43
|
+
this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),$t(t,"connect");for(let[t,e]of this._pendingCalls)this.call(t,...e);this._pendingCalls=[]}destroy(){this._port&&($t(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(t,...e){if(this._port||this._pendingCalls.push([t,e]),!this._port||this._destroyed)return;const n=this._sequence++,o=e[e.length-1];"function"==typeof o&&(this._callbacks.set(n,o),e=e.slice(0,-1)),$t(this._port,t,e,n)}_parseMessage({data:t}){return t&&"object"==typeof t?t.protocol!==zt||t.version!==Wt?null:Array.isArray(t.arguments)?t:null:null}_handle(t){const e=this._parseMessage(t),n=this._port;if(e&&n)if("method"in e){if("close"===e.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const t=this._methods.get(e.method);if(!t)return;const o=(...t)=>{const o={arguments:t,protocol:zt,response:e.sequence,version:Wt};n.postMessage(o)};t(...e.arguments,o)}else if("response"in e){const t=this._callbacks.get(e.response)
|
|
44
|
+
;this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function Yt(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Gt(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<n.length;o++){var i=void 0;try{i=JSON.parse(n[o].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),i={}}Yt(e,i)}return e}function Zt(t){if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function Kt(t,e,n){const o=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!o)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!o.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return o.href}function Jt(t){return"string"==typeof t?t:null}function Qt(t){const e=function(t){if(!t.hasOwnProperty("hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){
|
|
45
|
+
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 o(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=Zt(e.ignoreOtherConfiguration)?{}:Gt(t.document),{get annotations(){return Jt(n.annotations)||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return Kt(t,"hypothesis-client","javascript")},get group(){return Jt(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return Kt(t,"notebook","html")},get showHighlights(){return function(){const t=o("showHighlights");switch(t){case"always":case"never":case"whenSidebarOpen":return t;default:return"always";case!1:return"never"}}()},get sidebarAppUrl(){return Kt(t,"sidebar","html")},get query(){return Jt(n.query)||function(){
|
|
46
|
+
const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:o}}function te(t,e){return t.hostPageSetting(e)}const ee={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:te},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:te},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentPartner:{allowInBrowserExt:!1,defaultValue:null,getValue:te},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:te},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:te},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:te},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:te},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:te},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:Zt,getValue:te
|
|
47
|
+
},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:te},services:{allowInBrowserExt:!1,defaultValue:null,getValue:te},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:te},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:te}};function ne(t,e=window){const n=Qt(e),o={};for(let r of function(t){const e={annotator:["clientUrl","contentPartner","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],
|
|
48
|
+
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)){const t=ee[r],s=void 0!==t.defaultValue,a=!((i=Kt(e,"sidebar","html")).startsWith("http://")||i.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(o[r]=t.defaultValue);continue}const c=t.getValue(n,r);void 0!==c?o[r]=t.coerce?t.coerce(c):c:s&&(o[r]=t.defaultValue)}var i;return o}const oe={alt:1,ctrl:2,meta:4,shift:8};function ie(t,e,{rootElement:n=document.documentElement}={}){const o=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let o=0,i=null;for(let t of n){const e=oe[t];if(e)o|=e;else{if(null!==i)throw new Error("Multiple non-modifier keys specified");i=t}}if(!i)throw new Error(`Invalid shortcut: ${e}`)
|
|
49
|
+
;return((t.ctrlKey?oe.ctrl:0)|(t.metaKey?oe.meta:0)|(t.altKey?oe.alt:0)|(t.shiftKey?oe.shift:0))===o&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===i})(n,t)&&e(n)};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)}function re(t,e,{rootElement:n}={}){at((()=>{if(t)return ie(t,e,{rootElement:n})}),[t,e,n])}function se({badgeCount:t}){return _t("span",{className:K("rounded px-1 py-0.5","text-color-text-inverted font-bold bg-grey-7","dim-bg"),children:t})}function ae({arrowDirection:t}){return _t(Tt,{name:"pointer",classes:K("absolute left-1/2 -translate-x-1/2","h-auto w-auto z-2","text-grey-3 fill-white",{"rotate-180":"down"===t,"top-0 -translate-y-full":"up"===t})})}function ce({badgeCount:t,icon:e,label:n,onClick:o,shortcut:i}){re(i,o);const r=i?`${n} (${i})`:n;return _t(St,{
|
|
50
|
+
className:K("flex flex-col gap-y-1 items-center py-2.5 px-2","text-annotator-sm leading-none text-grey-7","transition-colors duration-200","dim-item"),onClick:o,title:r,children:[e&&_t(Tt,{classes:"text-annotator-lg",name:e,title:r}),"number"==typeof t&&_t(se,{badgeCount:t}),_t("span",{className:"font-normal",children:n})]})}function le({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:o=0}){const i=e?"a":null,r=e?"h":null,s=e?"s":null;return re(e?"Escape":null,(()=>n("hide"))),_t("div",{className:K("AdderToolbar","absolute select-none bg-white rounded shadow-adder-toolbar","border border-solid border-grey-3","opacity-5",{"animate-adder-pop-up":"up"===t&&e,"animate-adder-pop-down":"down"===t&&e}),dir:"ltr",style:{visibility:e?"visible":"hidden"},children:[_t("div",{className:"flex dim-items-on-hover",children:[_t(ce,{icon:"annotate",onClick:()=>n("annotate"),label:"Annotate",shortcut:i}),_t(ce,{icon:"highlight",onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),o>0&&_t(f,{children:[_t("div",{
|
|
51
|
+
className:K("m-1.5 border-r border-grey-4 border-solid")}),_t(ce,{badgeCount:o,onClick:()=>n("show"),label:"Show",shortcut:s})]})]}),_t(ae,{arrowDirection:t})]})}const he=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function ue(t){const e=t.attachShadow({mode:"open"});!function(t){var e;const n=null===(e=document.querySelector('link[rel="preload"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const o=document.createElement("link");o.rel="stylesheet",o.href=n,t.appendChild(o)}(e);const n=window.applyFocusVisiblePolyfill;var o;return n&&n(e),(o=e).addEventListener("mouseup",(t=>t.stopPropagation())),o.addEventListener("mousedown",(t=>t.stopPropagation())),o.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0}),e}function de(t){return t.toString()+"px"}class fe{constructor(t,e){this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),this._shadowRoot=ue(this._outerContainer),
|
|
52
|
+
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:o,arrowDirection:i}=this._calculateTarget(t,e);this._showAt(n,o),this._isVisible=!0,this._arrowDirection=2===i?"up":"down",this._render()}_calculateTarget(t,e){let n,o,i;n=e&&!he()?1:2;const r=Math.min(20,t.width),s=this._width(),a=he()?10:0,c=this._height();return i=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-c<0&&1===n?n=2:t.top+c>this._view.innerHeight&&(n=1),
|
|
53
|
+
o=2===n?t.top+t.height+10+a:t.top-c-10,i=Math.max(i,0),i=Math.min(i,this._view.innerWidth-s),o=Math.max(o,0),o=Math.min(o,this._view.innerHeight-c),{top:o,left:i,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),o=this._height(),i=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+o),...document.elementsFromPoint(t+n/2,e+o/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+o)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return i.push(0),Math.max(...i)+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(),o=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:de(t-n.left),top:de(e-n.top),zIndex:o})}_render(){M(_t(le,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":
|
|
54
|
+
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)}}function pe(t){switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return t.textContent.length;default:return 0}}function ge(t){let e=t.previousSibling,n=0;for(;e;)n+=pe(e),e=e.previousSibling;return n}function me(t,...e){let n=e.shift();const o=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),i=[];let r,s=o.nextNode(),a=0;for(;void 0!==n&&s;)r=s,a+r.data.length>n?(i.push({node:r,offset:n-a}),n=e.shift()):(s=o.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)i.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return i}class _e{constructor(t,e){if(e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){
|
|
55
|
+
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+=ge(e),e=e.parentElement;return new _e(e,n)}resolve(t={}){try{return me(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 o=1===t.direction,i=o?n.nextNode():n.previousNode();if(!i)throw e;return{node:i,offset:o?0:i.data.length}}throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return _e.fromPoint(t,e);case Node.ELEMENT_NODE:return new _e(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=ge(t)+e;return new _e(t.parentElement,n)}case Node.ELEMENT_NODE:{
|
|
56
|
+
if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let o=0;o<e;o++)n+=pe(t.childNodes[o]);return new _e(t,n)}default:throw new Error("Point is not in an element or text node")}}}class ve{constructor(t,e){this.start=t,this.end=e}relativeTo(t){return new ve(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]=me(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=_e.fromPoint(t.startContainer,t.startOffset),n=_e.fromPoint(t.endContainer,t.endOffset);return new ve(e,n)}static fromOffsets(t,e,n){return new ve(new _e(t,e),new _e(t,n))}}const ye=".annotator-placeholder";function we(t){return!!t.parentElement&&null!==t.parentElement.closest(ye)}function be(t){
|
|
57
|
+
if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function Ce(t,e){try{var n,o;const i=null!==(n=null===(o=e.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:e.childNodes.length;return t.comparePoint(e,0)<=0&&t.comparePoint(e,i)>=0}catch(t){return!1}}function xe(t,e){const n=t.commonAncestorContainer,o=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let i;for(;i=o.nextNode();)Ce(t,i)&&e(i)}function Se(t){if(t.isCollapsed)return null;const e=function(t){const e=/^\s*$/,n=[];xe(t,(t=>{t.nodeType!==Node.TEXT_NODE||t.textContent.match(e)||n.push(t)}));let o=[];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 i=Array.from(n.getClientRects());n.detach(),o=o.concat(i)})),o}(t.getRangeAt(0));return 0===e.length?null:be(t)?e[0]:e[e.length-1]}const Ee="http://www.w3.org/2000/svg"
|
|
58
|
+
;function Te(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=[],o=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let i;for(;i=o.nextNode();){if(!Ce(t,i))continue;let e=i;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),o=n.length>0&&we(n[0]);let i=[],r=null,s=null;n.forEach((t=>{r&&r.nextSibling===t?s.push(t):(s=[t],i.push(s)),r=t}));const a=/^\s*$/;i=i.filter((t=>t.some((t=>!a.test(t.data)))));const c=[];return i.forEach((t=>{const n=document.createElement("hypothesis-highlight");n.className=e;t[0].parentNode.replaceChild(n,t[0]),t.forEach((t=>n.appendChild(t))),c.push(n)})),o||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
|
|
59
|
+
;let n=e.parentElement.querySelector(".hypothesis-highlight-layer");if(!n){n=document.createElementNS(Ee,"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%",t.mixBlendMode="multiply"}const o=e.getBoundingClientRect(),i=t.map((t=>{const e=t.getBoundingClientRect(),n=document.createElementNS(Ee,"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()),n.setAttribute("class","hypothesis-svg-highlight"),t.classList.add("is-transparent"),t.svgHighlight=n,n}));n.append(...i)}(c),c}function Ae(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function ke(t){for(let e of t){if(e.parentNode){Ae(e,Array.from(e.childNodes))}e.svgHighlight&&e.svgHighlight.remove()}}function Re(t,e){
|
|
60
|
+
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 Le(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)})))}class Pe{constructor({contentContainer:t,hostRPC:e}){this._hostRPC=e,this._updatePending=!1,this._anchors=[],this._listeners=new Rt,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(t,"scroll",(()=>this.update()))}destroy(){this._listeners.removeAll()}update(t){t&&(this._anchors=t),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const t=function(t){const e=[];return t.forEach((({annotation:t,highlights:n})=>{if(null==n||!n.length)return;const{top:o,bottom:i}=Le(n);o>=i||e.push({tag:t.$tag,top:o,
|
|
61
|
+
bottom:i})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}let Me=new Set;function Ne(...t){const e=t.join();Me.has(e)||(console.warn(...t),Me.add(e))}Ne.reset=()=>{Me.clear()};const Oe=["html_side_by_side"];class Ie extends Bt{constructor(t=Oe){super(),this._flags=new Map,this._knownFlags=t}update(t){this._flags.clear();for(let[e,n]of Object.entries(t))this._flags.set(e,n);this.emit("flagsChanged")}flagEnabled(t){var e;return this._knownFlags.includes(t)?null!==(e=this._flags.get(t))&&void 0!==e&&e:(Ne("Looked up unknown feature",t),!1)}allFlags(){return Object.fromEntries(this._flags)}}function De(t){return t.split("").reverse().join("")}function Be(t){return(t|-t)>>31&1}function Fe(t,e,n,o){let i=t.P[n],r=t.M[n];const s=o>>>31,a=e[n]|s,c=a|r,l=(a&i)+i^i|a;let h=r|~(l|i),u=i&l;const d=Be(h&t.lastRowMask[n])-Be(u&t.lastRowMask[n]);return h<<=1,u<<=1,u|=s,h|=Be(o)-s,i=u|~(c|h),r=h&c,t.P[n]=i,t.M[n]=r,d}function He(t,e,n){
|
|
62
|
+
if(0===e.length)return[];n=Math.min(n,e.length);const o=[],i=32,r=Math.ceil(e.length/i)-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)%i;const a=new Uint32Array(r+1),c=new Map,l=[];for(let t=0;t<256;t++)l.push(a);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(c.has(n))continue;const o=new Uint32Array(r+1);c.set(n,o),n<l.length&&(l[n]=o);for(let t=0;t<=r;t+=1){o[t]=0;for(let r=0;r<i;r+=1){const s=t*i+r;if(s>=e.length)continue;e.charCodeAt(s)===n&&(o[t]|=1<<r)}}}let h=Math.max(0,Math.ceil(n/i)-1);const u=new Uint32Array(r+1);for(let t=0;t<=h;t+=1)u[t]=(t+1)*i;u[r]=e.length;for(let t=0;t<=h;t+=1)s.P[t]=-1,s.M[t]=0;for(let d=0;d<t.length;d+=1){const f=t.charCodeAt(d);let p;f<l.length?p=l[f]:(p=c.get(f),void 0===p&&(p=a));let g=0;for(let t=0;t<=h;t+=1)g=Fe(s,p,t,g),u[t]+=g;if(u[h]-g<=n&&h<r&&(1&p[h+1]||g<0)){let t;if(h+=1,s.P[h]=-1,s.M[h]=0,h===r){const n=e.length%i;t=0===n?i:n}else t=i
|
|
63
|
+
;u[h]=u[h-1]+t-g+Fe(s,p,h,g)}else for(;h>0&&u[h]>=n+i;)h-=1;h===r&&u[h]<=n&&(u[h]<n&&o.splice(0,o.length),o.push({start:-1,end:d+1,errors:u[h]}),n=u[h])}return o}function Ve(t,e,n){return function(t,e,n){const o=De(e);return n.map((n=>{const i=Math.max(0,n.end-e.length-n.errors);return{start:He(De(t.slice(i,n.end)),o,n.errors).reduce(((t,e)=>n.end-e.end<t?n.end-e.end:t),n.end),end:n.end,errors:n.errors}}))}(t,e,He(t,e,n))}function qe(t,e,n){let o=0,i=[];for(;-1!==o;)o=t.indexOf(e,o),-1!==o&&(i.push({start:o,end:o+e.length,errors:0}),o+=1);return i.length>0?i:Ve(t,e,n)}function Ue(t,e){if(0===e.length||0===t.length)return 0;return 1-qe(t,e,e.length)[0].errors/e.length}function We(t,e,n={}){if(0===e.length)return null;const o=Math.min(256,e.length/2),i=qe(t,e,o);if(0===i.length)return null;const r=o=>{const i=1-o.errors/e.length,r=n.prefix?Ue(t.slice(Math.max(0,o.start-n.prefix.length),o.start),n.prefix):1,s=n.suffix?Ue(t.slice(o.end,o.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){
|
|
64
|
+
a=1-Math.abs(o.start-n.hint)/t.length}return(50*i+20*r+20*s+2*a)/92},s=i.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function ze(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 $e(t,e){let n="",o=t;for(;o!==e;){if(!o)throw new Error("Node is not a descendant of root");n=ze(o)+"/"+n,o=o.parentNode}return n="/"+n,n=n.replace(/\/$/,""),n}function je(t,e,n){e=e.toUpperCase();let o=-1;for(let i=0;i<t.children.length;i++){const r=t.children[i];if(r.nodeName.toUpperCase()===e&&(++o,o===n))return r}return null}function Xe(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 o=e;n.shift();for(let t of n){let e,n;const i=t.indexOf("[");if(-1!==i){e=t.slice(0,i)
|
|
65
|
+
;const o=t.slice(i+1,t.indexOf("]"));if(n=parseInt(o)-1,n<0)return null}else e=t,n=0;const r=je(o,e,n);if(!r)return null;o=r}return o}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class Ye{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new Ye(t,e)}static fromSelector(t,e){const n=Xe(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const o=Xe(e.endContainer,t);if(!o)throw new Error("Failed to resolve endContainer XPath");const i=_e.fromCharOffset(n,e.startOffset),r=_e.fromCharOffset(o,e.endOffset),s=new ve(i,r).toRange();return new Ye(t,s)}toRange(){return this.range}toSelector(){const t=ve.fromRange(this.range).toRange(),e=ve.fromRange(t),n=$e(e.start.element,this.root),o=$e(e.end.element,this.root);return{type:"RangeSelector",startContainer:n,startOffset:e.start.offset,endContainer:o,endOffset:e.end.offset}}}class Ge{constructor(t,e,n){this.root=t,this.start=e,this.end=n}
|
|
66
|
+
static fromRange(t,e){const n=ve.fromRange(e).relativeTo(t);return new Ge(t,n.start.offset,n.end.offset)}static fromSelector(t,e){return new Ge(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return ve.fromOffsets(this.root,this.start,this.end).toRange()}}class Ze{constructor(t,e,n={}){this.root=t,this.exact=e,this.context=n}static fromRange(t,e){const n=t.textContent,o=ve.fromRange(e).relativeTo(t),i=o.start.offset,r=o.end.offset;return new Ze(t,n.slice(i,r),{prefix:n.slice(Math.max(0,i-32),i),suffix:n.slice(r,Math.min(n.length,r+32))})}static fromSelector(t,e){const{prefix:n,suffix:o}=e;return new Ze(t,e.exact,{prefix:n,suffix:o})}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=We(this.root.textContent,this.exact,{...this.context,hint:t.hint});if(!e)throw new Error("Quote not found")
|
|
67
|
+
;return new Ge(this.root,e.start,e.end)}}async function Ke(t,e={}){return t.toRange(e)}function Je(t,e,n={}){let o=null,i=null,r=null;for(let t of e)switch(t.type){case"TextPositionSelector":o=t,n.hint=o.start;break;case"TextQuoteSelector":i=t;break;case"RangeSelector":r=t}const s=t=>{var e;if(null!==(e=i)&&void 0!==e&&e.exact&&t.toString()!==i.exact)throw new Error("quote mismatch");return t};let a=Promise.reject("unable to anchor");if(r){const e=r;a=a.catch((()=>Ke(Ye.fromSelector(t,e),n).then(s)))}if(o){const e=o;a=a.catch((()=>Ke(Ge.fromSelector(t,e),n).then(s)))}if(i){const e=i;a=a.catch((()=>Ke(Ze.fromSelector(t,e),n)))}return a}function Qe(t,e){const n=[Ye,Ge,Ze],o=[];for(let i of n)try{const n=i.fromRange(t,e);o.push(n.toSelector())}catch(t){continue}return o}function tn(t,e=document.baseURI){return new URL(t,e).href.toString().replace(/#.*/,"")}class en{constructor(t={}){this.document=t.document||document}uri(){let t=decodeURIComponent(this._getDocumentHref());const e=this._getLinks()
|
|
68
68
|
;for(let n of e)"canonical"===n.rel&&(t=n.href);return t}getDocumentMetadata(){const t={title:document.title,link:[],dc:this._getMetaTags("name","dc."),eprints:this._getMetaTags("name","eprints."),facebook:this._getMetaTags("property","og:"),highwire:this._getMetaTags("name","citation_"),prism:this._getMetaTags("name","prism."),twitter:this._getMetaTags("name","twitter:")},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){const n={};for(let o of Array.from(this.document.querySelectorAll("meta"))){const i=o.getAttribute(t),{content:r}=o;if(i&&r){const t=i.match(RegExp(`^${e}(.+)$`,"i"));if(t){const e=t[1].toLowerCase();n[e]?n[e].push(r):n[e]=[r]}}}return n}_getTitle(t){
|
|
69
69
|
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 o=t.highwire[n];if("pdf_url"===n)for(let t of o)try{e.push({href:this._absoluteUrl(t),type:"application/pdf"})}catch(t){}if("doi"===n)for(let t of o)"doi:"!==t.slice(0,4)&&(t=`doi:${t}`),e.push({href:t})}for(let n of Object.keys(t.dc)){const o=t.dc[n];if("identifier"===n)for(let t of o)"doi:"===t.slice(0,4)&&e.push({href:t})}
|
|
70
|
-
const o=t.dc["relation.ispartof"],i=t.dc.identifier;if(o&&i){const t=o[o.length-1],n=i[i.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
|
|
71
|
-
;if(
|
|
72
|
-
if(/\S/.test(o)){const a=t,c=t+o.length,l=
|
|
73
|
-
i=h.top+e.pageYOffset-e.innerHeight*m+c*m,o-=f,i-=p,o=t.align.lockX?e.pageXOffset:o,i=t.align.lockY?e.pageYOffset:i,r=o-e.pageXOffset,s=i-e.pageYOffset;else{a=h.width,c=h.height,n=e.getBoundingClientRect();var _=h.left-(n.left-e.scrollLeft),v=h.top-(n.top-e.scrollTop);o=_+a*g-e.clientWidth*g,i=v+c*m-e.clientHeight*m,o-=f,i-=p,o=Math.max(Math.min(o,e.scrollWidth-e.clientWidth),0),i=Math.max(Math.min(i,e.scrollHeight-e.clientHeight),0),o=t.align.lockX?e.scrollLeft:o,i=t.align.lockY?e.scrollTop:i,r=o-e.scrollLeft,s=i-e.scrollTop}return{x:o,y:i,differenceX:r,differenceY:s}}(e,t),i=Date.now()-e.startTime,r=Math.min(1/e.time*i,1);if(e.endIterations>=n)return
|
|
74
|
-
function
|
|
75
|
-
var r,s=!e._scrollSettings,a=e._scrollSettings,c=Date.now(),l={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),i(t),r&&(e.removeEventListener("touchstart",r,l),e.removeEventListener("wheel",r,l))}a&&a.end(
|
|
76
|
-
t.scrollTop=
|
|
77
|
-
document.body.style.marginRight="";const t=n(document.body);document.body.style.marginRight=`${e}px`;const o=function(t){const e=new Map,n=new Map,o=
|
|
78
|
-
document.body.style.marginRight=""}))}_deactivateSideBySide(){
|
|
79
|
-
return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==
|
|
80
|
-
r=(u="maxWait"in n)?
|
|
81
|
-
;e.eventBus?e.eventBus.on("pagesloaded",o):document.addEventListener("pagesloaded",o)}))),n}function
|
|
82
|
-
const r=function(t){let e=t.querySelector(
|
|
83
|
-
const s=void 0!==t.prefix?
|
|
84
|
-
;if(e!==n)throw new Error("Selecting across page breaks is not supported");return[t,e]}async function
|
|
85
|
-
children:["Document hosted by ",
|
|
86
|
-
}(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=
|
|
87
|
-
if(!t.url)return null;const e=
|
|
88
|
-
this._updateAnnotationLayerVisibility=()=>{const t=s.getSelection();this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new
|
|
89
|
-
console.warn("Unable to check for text in PDF:",t)}}_updateBannerState(t){this._bannerState={...this._bannerState,...t};const e=document.querySelector("#outerContainer");var n;if(!(this._bannerState.contentPartner||this._bannerState.noTextWarning))return null===(n=this._banner)||void 0===n||n.remove(),this._banner=null,void(e.style.height="");this._banner||(this._banner=document.createElement("hypothesis-banner"),document.body.prepend(this._banner),
|
|
90
|
-
;break;case
|
|
91
|
-
;if(null===n)return;await
|
|
92
|
-
;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
|
|
93
|
-
"interactive"===n.readyState||"complete"===n.readyState?e(null,n):n.addEventListener("DOMContentLoaded",(()=>e(null,n)))}var o;t.contentDocument&&(null===(o=t.contentWindow)||void 0===o||o.addEventListener("unload",i))}}else e(new Error("Frame is cross-origin"))};let c=!1;i=()=>{s(),c||(o=setInterval(a,n))},t.addEventListener("load",a);const l=setTimeout(a,0);return()=>{c=!0,clearTimeout(l),s(),t.removeEventListener("load",a)}}class
|
|
94
|
-
;const a=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,c=function(t,e){const n=[];let o={text:"",rect:new DOMRect};const i=()=>{o.text.length>0&&(n.push(o),o={text:"",rect:new DOMRect})};for(let[n,r]of t.entries()){const t=e[n],s=/\s/.test(t);o.rect=
|
|
70
|
+
const o=t.dc["relation.ispartof"],i=t.dc.identifier;if(o&&i){const t=o[o.length-1],n=i[i.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 tn(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}}function nn(t){return t.width<=0||t.height<=0}function on(t,e,n,o){return Math.max(t,n)<Math.min(e,o)}function rn(t,e){return!nn(t)&&!nn(e)&&(on(t.left,t.right,e.left,e.right)&&on(t.top,t.bottom,e.top,e.bottom))}function sn(t,e){return on(t.top,t.bottom,e.top,e.bottom)}function an(t,e){return on(t.left,t.right,e.left,e.right)}function cn(t,e){if(nn(t))return e
|
|
71
|
+
;if(nn(e))return t;const n=Math.min(t.left,e.left),o=Math.min(t.top,e.top),i=Math.max(t.right,e.right),r=Math.max(t.bottom,e.bottom);return new DOMRect(n,o,i-n,r-o)}function ln(t){return new DOMPoint((t.left+t.right)/2,(t.top+t.bottom)/2)}const hn=["p",".para"];let un;function dn(t,e=0,n=t.data.length){return un||(un=document.createRange()),un.setStart(t,e),un.setEnd(t,n),un.getBoundingClientRect()}function fn(t){const e=t.getBoundingClientRect();return e.x-=t.scrollLeft,e.y-=t.scrollTop,e.height=Math.max(e.height,t.scrollHeight),e.width=Math.max(e.width,t.scrollWidth),e}function*pn(t,e,n=(()=>!0)){let o=t.firstChild;for(;o;){if(o.nodeType===Node.ELEMENT_NODE){const t=o,i=rn(fn(t),e);n(t)&&i&&(yield*pn(t,e,n))}else if(o.nodeType===Node.TEXT_NODE){const t=o;rn(dn(t),e)&&(yield t)}o=o.nextSibling}}function gn(t,e){let n=null;const o=t=>!function(t){switch(getComputedStyle(t).position){case"fixed":case"sticky":return!0;default:return!1}}(t);t:for(let s of pn(t,e,o)){let t=0;for(let o of s.data.split(/\b/)){
|
|
72
|
+
if(/\S/.test(o)){const a=t,c=t+o.length,l=dn(s,a,c);if(r=l,!nn(i=e)&&!nn(r)&&r.left>=i.left&&r.right<=i.right&&r.top>=i.top&&r.bottom<=i.bottom){n=document.createRange(),n.setStart(s,a),n.setEnd(s,c);break t}}t+=o.length}}var i,r;return n}function mn(t,e=document.documentElement,n=new DOMRect(0,0,window.innerWidth,window.innerHeight)){const o=gn(e,n);if(!o)return t(),0;const i=o.getBoundingClientRect().top;t();const r=o.getBoundingClientRect().top-i;return e.scrollTop+=r,r}var _n="complete",vn="canceled";function yn(t,e,n){t.self===t?t.scrollTo(e,n):(t.scrollLeft=e,t.scrollTop=n)}function wn(t){var e=t._scrollSettings;if(e){var n=e.maxSynchronousAlignments,o=function(t,e){var n,o,i,r,s,a,c,l=t.align,h=t.target.getBoundingClientRect(),u=l&&null!=l.left?l.left:.5,d=l&&null!=l.top?l.top:.5,f=l&&null!=l.leftOffset?l.leftOffset:0,p=l&&null!=l.topOffset?l.topOffset:0,g=u,m=d;if(t.isWindow(e))a=Math.min(h.width,e.innerWidth),c=Math.min(h.height,e.innerHeight),o=h.left+e.pageXOffset-e.innerWidth*g+a*g,
|
|
73
|
+
i=h.top+e.pageYOffset-e.innerHeight*m+c*m,o-=f,i-=p,o=t.align.lockX?e.pageXOffset:o,i=t.align.lockY?e.pageYOffset:i,r=o-e.pageXOffset,s=i-e.pageYOffset;else{a=h.width,c=h.height,n=e.getBoundingClientRect();var _=h.left-(n.left-e.scrollLeft),v=h.top-(n.top-e.scrollTop);o=_+a*g-e.clientWidth*g,i=v+c*m-e.clientHeight*m,o-=f,i-=p,o=Math.max(Math.min(o,e.scrollWidth-e.clientWidth),0),i=Math.max(Math.min(i,e.scrollHeight-e.clientHeight),0),o=t.align.lockX?e.scrollLeft:o,i=t.align.lockY?e.scrollTop:i,r=o-e.scrollLeft,s=i-e.scrollTop}return{x:o,y:i,differenceX:r,differenceY:s}}(e,t),i=Date.now()-e.startTime,r=Math.min(1/e.time*i,1);if(e.endIterations>=n)return yn(t,o.x,o.y),t._scrollSettings=null,e.end(_n);var s=1-e.ease(r);if(yn(t,o.x-o.differenceX*s,o.y-o.differenceY*s),i>=e.time)return e.endIterations++,e.scrollAncestor&&wn(e.scrollAncestor),void wn(t);!function(t){if("requestAnimationFrame"in window)return window.requestAnimationFrame(t);setTimeout(t,16)}(wn.bind(null,t))}}function bn(t){return t.self===t}
|
|
74
|
+
function Cn(t){return"pageXOffset"in t||(t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth)&&"hidden"!==getComputedStyle(t).overflow}function xn(){return!0}function Sn(t){if(t.assignedSlot)return Sn(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 En=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 o=Sn(t),i=1,r=e.validTarget||xn,s=e.isScrollable;e.debug&&(console.log("About to scroll to",t),o||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var a=[];o;)if(e.debug&&console.log("Scrolling parent node",o),r(o,i)&&(s?s(o,Cn):Cn(o))&&(i++,a.push(o)),!(o=Sn(o))){c(_n);break}return a.reduce(((n,o,i)=>function(t,e,n,o,i){
|
|
75
|
+
var r,s=!e._scrollSettings,a=e._scrollSettings,c=Date.now(),l={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),i(t),r&&(e.removeEventListener("touchstart",r,l),e.removeEventListener("wheel",r,l))}a&&a.end(vn);var u=n.maxSynchronousAlignments;return null==u&&(u=3),e._scrollSettings={startTime:c,endIterations:0,target:t,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||bn,maxSynchronousAlignments:u,end:h,scrollAncestor:o},"cancellable"in n&&!n.cancellable||(r=h.bind(null,vn),e.addEventListener("touchstart",r,l),e.addEventListener("wheel",r,l)),s&&wn(e),r}(t,o,e,a[i+1],c)),null)}function c(t){--i||n&&n(t)}};function Tn(t,e,n){return t+n*(e-t)}async function An(t,e,{maxDuration:n=500}={}){const o=t.scrollTop,i=e,r=Date.now(),s=Math.min(Math.abs(i-o)/3,n);let a=0;for(;a<1;)await new Promise((t=>{requestAnimationFrame(t)})),a=Math.min(1,(Date.now()-r)/s),
|
|
76
|
+
t.scrollTop=Tn(o,i,a)}class kn{constructor({features:t,container:e=document.body}){this.features=t,this.container=e,this.anchor=Je,this.describe=Qe,this._htmlMeta=new en,this._sideBySideEnabled=this.features.flagEnabled("html_side_by_side"),this._sideBySideActive=!1,this._lastLayout=null,this._flagsChanged=()=>{const e=t.flagEnabled("html_side_by_side");e!==this._sideBySideEnabled&&(this._sideBySideEnabled=e,this._lastLayout&&this.fitSideBySide(this._lastLayout))},this.features.on("flagsChanged",this._flagsChanged)}canAnnotate(){return!0}destroy(){this.features.off("flagsChanged",this._flagsChanged)}contentContainer(){return this.container}fitSideBySide(t){this._lastLayout=t;const e=window.innerWidth-t.width,n=this._sideBySideEnabled&&t.expanded&&e>=480;return n?this._activateSideBySide(t.width):this._sideBySideActive&&this._deactivateSideBySide(),this._sideBySideActive=n,n}_activateSideBySide(t){const e=t+12,n=t=>parseInt(window.getComputedStyle(t).marginLeft,10);mn((()=>{document.body.style.marginLeft="",
|
|
77
|
+
document.body.style.marginRight="";const t=n(document.body);document.body.style.marginRight=`${e}px`;const o=function(t){const e=new Map,n=new Map,o=hn.join(","),i=Array.from(t.querySelectorAll(o)).map((t=>({rect:t.getBoundingClientRect(),textLength:t.textContent.length}))).filter((({rect:t})=>t.width>0&&t.height>0)).sort(((t,e)=>e.textLength-t.textLength)).slice(0,15);if(i.forEach((({rect:t})=>{var o,i;let r=null!==(o=e.get(t.left))&&void 0!==o?o:0;r+=1,e.set(t.left,r);let s=null!==(i=n.get(t.right))&&void 0!==i?i:0;s+=1,n.set(t.right,s)})),0===e.size||0===n.size)return null;const r=[...e.entries()].sort(((t,e)=>e[1]-t[1])),s=[...n.entries()].sort(((t,e)=>e[1]-t[1])),[a]=r[0],[c]=s[0];return{left:a,right:c}}(document.body);if(o){const i=Math.max(0,window.innerWidth-e-o.right);if(i>0){const t=Math.max(0,e-i);document.body.style.marginRight=`${t}px`}n(document.body)>t&&(document.body.style.marginLeft=`${t}px`),o.left<12&&(document.body.style.marginLeft="12px")}else document.body.style.marginLeft="",
|
|
78
|
+
document.body.style.marginRight=""}))}_deactivateSideBySide(){mn((()=>{document.body.style.marginLeft="",document.body.style.marginRight=""}))}async getMetadata(){return this._htmlMeta.getDocumentMetadata()}async uri(){return this._htmlMeta.uri()}async scrollToAnchor(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];n&&await async function(t,{maxDuration:e=500}={}){const n=t.closest("body");n&&"BODY"!==n.tagName&&Object.defineProperty(n,"tagName",{value:"BODY",configurable:!0}),await new Promise((n=>En(t,{time:e},n)))}(n)}}var Rn=/^\s+|\s+$/g,Ln=/^[-+]0x[0-9a-f]+$/i,Pn=/^0b[01]+$/i,Mn=/^0o[0-7]+$/i,Nn=parseInt,On="object"==typeof t&&t&&t.Object===Object&&t,In="object"==typeof self&&self&&self.Object===Object&&self,Dn=On||In||Function("return this")(),Bn=Object.prototype.toString,Fn=Math.max,Hn=Math.min,Vn=function(){return Dn.Date.now()};function qn(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Un(t){if("number"==typeof t)return t;if(function(t){
|
|
79
|
+
return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Bn.call(t)}(t))return NaN;if(qn(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=qn(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Rn,"");var n=Pn.test(t);return n||Mn.test(t)?Nn(t.slice(2),n?2:8):Ln.test(t)?NaN:+t}var Wn=function(t,e,n){var o,i,r,s,a,c,l=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=o,r=i;return o=i=void 0,l=e,s=t.apply(r,n)}function p(t){return l=t,a=setTimeout(m,e),h?f(t):s}function g(t){var n=t-c;return void 0===c||n>=e||n<0||u&&t-l>=r}function m(){var t=Vn();if(g(t))return _(t);a=setTimeout(m,function(t){var n=e-(t-c);return u?Hn(n,r-(t-l)):n}(t))}function _(t){return a=void 0,d&&o?f(t):(o=i=void 0,s)}function v(){var t=Vn(),n=g(t);if(o=arguments,i=this,c=t,n){if(void 0===a)return p(c);if(u)return a=setTimeout(m,e),f(c)}return void 0===a&&(a=setTimeout(m,e)),s}return e=Un(e)||0,qn(n)&&(h=!!n.leading,
|
|
80
|
+
r=(u="maxWait"in n)?Fn(Un(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=i=a=void 0},v.flush=function(){return void 0===a?s:_(Vn())},v};function zn(t,e,n,o=0){let i=o;for(;i<t.length&&e>0;)n(t[i])&&--e,++i;return i}function $n(t,e,n,o){let i=0;for(let r=n;r<o;r++)e(t[r])&&++i;return i}function jn(t,e,n,o,i){const r=$n(t,i,0,n),s=$n(t,i,n,o);let a=zn(e,r,i);for(;a<e.length&&!i(e[a]);)++a;return[a,zn(e,s,i,a)]}const Xn=0,Yn=3,Gn=new Map,Zn=new Map;function Kn(t,e){return`${t}:${e}`}function Jn(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 Qn(){return PDFViewerApplication.pdfViewer}async function to(t){const e=Qn();let n=e.getPageView(t);return n&&n.pdfPage||(n=await new Promise((n=>{const o=()=>{e.eventBus?e.eventBus.off("pagesloaded",o):document.removeEventListener("pagesloaded",o),n(e.getPageView(t))}
|
|
81
|
+
;e.eventBus?e.eventBus.on("pagesloaded",o):document.addEventListener("pagesloaded",o)}))),n}function eo(t){const e=Gn.get(t);if(e)return e;const n=(async()=>{const e=await to(t);return(await e.pdfPage.getTextContent({normalizeWhitespace:!0})).items.map((t=>t.str)).join("")})();return Gn.set(t,n),n}async function no(t){const e=Qn();let n=0,o=0,i="";for(let r=0;r<e.pagesCount;r++)if(i=await eo(r),n=o,o+=i.length,o>=t)return{index:r,offset:n,text:i};return{index:e.pagesCount-1,offset:n,text:i}}function oo(t){switch(t){case" ":case"\f":case"\n":case"\r":case"\t":case"\v":case" ":return!0;default:return!1}}const io=t=>!oo(t);async function ro(t,e,n){const[o,i]=await Promise.all([to(t),eo(t)]);if(o.renderingState===Yn&&o.textLayer&&o.textLayer.renderingDone){const t=o.textLayer.textLayerDiv,r=t.textContent,[s,a]=jn(i,r,e,n,io);so(r.slice(s,a))!==so(i.slice(e,n))&&Ne("Text layer text does not match page text. Highlights will be mis-aligned.");const c=new _e(t,s),l=new _e(t,a);return new ve(c,l).toRange()}
|
|
82
|
+
const r=function(t){let e=t.querySelector(ye);return e||(e=document.createElement("span"),e.classList.add("annotator-placeholder"),e.textContent="Loading annotations...",t.appendChild(e),e)}(o.div),s=document.createRange();return s.setStartBefore(r),s.setEndAfter(r),s}function so(t){let e="";for(let n=0;n<t.length;n++){const o=t[n];oo(o)||(e+=o)}return e}async function ao(t,e){const n=e.find((t=>"TextQuoteSelector"===t.type));if(!n)throw new Error("No quote selector found");const o=e.find((t=>"TextPositionSelector"===t.type));if(o){try{const{index:t,offset:e,text:i}=await no(o.start),r=o.start-e,s=o.end-e,a=i.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await ro(t,r,s)}catch{}try{const t=Kn(n.exact,o.start),e=Zn.get(t);if(e){const{pageIndex:t,anchor:n}=e;return await ro(t,n.start,n.end)}}catch{}}return async function(t,e){const n=Qn().pagesCount,o=Array(n).fill(0).map(((t,e)=>e));let i,r;if(e){const{index:t,offset:n}=await no(e);i=t,r=e-n,o.sort(((e,n)=>Math.abs(e-t)-Math.abs(n-t)))}
|
|
83
|
+
const s=void 0!==t.prefix?so(t.prefix):void 0,a=void 0!==t.suffix?so(t.suffix):void 0,c=so(t.exact);let l;for(let t of o){const e=await eo(t),n=so(e);let o;void 0!==i&&void 0!==r&&(t<i?o=n.length:t===i?[o]=jn(e,n,r,r,io):o=0);const h=We(n,c,{prefix:s,suffix:a,hint:o});if(h&&(!l||h.score>l.match.score)){const[o,i]=jn(n,e,h.start,h.end,io);l={page:t,match:{start:o,end:i,score:h.score}};const r=n.slice(h.start,h.end)===c,u=void 0!==s&&n.slice(Math.max(0,h.start-s.length),h.start)===s,d=void 0!==a&&n.slice(h.end,a.length)===a,f=void 0!==s||void 0!==a;if(r&&(u||d||!f))break}}if(l){const{page:n,match:o}=l;if(e){const i=Kn(t.exact,e);Zn.set(i,{pageIndex:n,anchor:o})}return ro(n,o.start,o.end)}throw new Error("Quote not found")}(n,null==o?void 0:o.start)}function co(t){try{t=ve.fromRange(t).toRange()}catch{throw new Error("Selection does not contain text")}const e=Jn(t.startContainer),n=Jn(t.endContainer);if(!e||!n)throw new Error("Selection is outside page text")
|
|
84
|
+
;if(e!==n)throw new Error("Selecting across page breaks is not supported");return[t,e]}async function lo(t,e){const[n,o]=co(e),i=_e.fromPoint(n.startContainer,n.startOffset).relativeTo(o),r=_e.fromPoint(n.endContainer,n.endOffset).relativeTo(o),s=function(t){let e=0;for(;t.previousSibling;)++e,t=t.previousSibling;return e}(o.parentNode),a=await async function(t){if(t>=Qn().pagesCount)throw new Error("Invalid page index");let e=0;for(let n=0;n<t;n++)e+=(await eo(n)).length;return e}(s);return[{type:"TextPositionSelector",start:a+i.offset,end:a+r.offset},Ze.fromRange(t,n).toSelector()]}function ho({children:t}){return _t("div",{className:"flex flex-col",children:t})}function uo({provider:t,onClose:e}){return _t("div",{className:"flex items-center border-b gap-x-4 px-2 py-1 bg-white text-annotator-lg",children:["jstor"===t&&_t(f,{children:[_t(At,{href:"https://jstor.org",target:"_blank",children:_t(Tt,{classes:"w-[97px] h-[25px]",name:"jstor",title:"Document hosted by JSTOR"})}),_t("div",{className:"grow",
|
|
85
|
+
children:["Document hosted by ",_t("b",{children:"JSTOR"})]})]}),_t("div",{className:"text-annotator-base",children:_t(St,{onClick:e,"data-testid":"close-button",children:"Close"})})]})}function fo(){return _t("div",{className:"bg-white",children:_t("div",{className:K("flex items-center gap-x-2","border border-yellow-notice bg-yellow-notice/10 text-annotator-base"),children:[_t("div",{className:"bg-yellow-notice text-white p-2",children:_t(Tt,{name:"caution",classes:"text-annotator-xl"})}),_t("div",{children:[_t("strong",{children:"This PDF does not contain selectable text:"})," ",_t(At,{target:"_blank",href:"https://web.hypothes.is/help/how-to-ocr-optimize-pdfs/",children:"Learn how to fix this"})," ","in order to annotate with Hypothesis."]})]})})}class po{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)}))
|
|
86
|
+
}(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=_o(t);return e||(e=mo(go(t))),e}))}async getMetadata(){const t=await this._loaded,{info:e,contentDispositionFilename:n,metadata:o}=await t.pdfDocument.getMetadata(),i=go(t),r=_o(t);let s;s=null!=o&&o.has("dc:title")&&"Untitled"!==o.get("dc:title")?o.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:mo(i)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:i}}}function go(t){return Array.isArray(t.pdfDocument.fingerprints)?t.pdfDocument.fingerprints[0]:t.pdfDocument.fingerprint}function mo(t){return`urn:x-pdf:${t}`}function _o(t){
|
|
87
|
+
if(!t.url)return null;const e=tn(t.url);return 0!==e.indexOf("file://")?e:null}function vo(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];return n&&we(n)}function yo(t){return new Promise((e=>setTimeout(e,t)))}class wo{constructor(t,e={}){var n,o,i,r;this.annotator=t;const s=window,a=s.PDFViewerApplication;this.pdfViewer=a.pdfViewer,this.pdfViewer.viewer.classList.add("has-transparent-text-layer"),this.pdfContainer=null!==(n=null===(o=a.appConfig)||void 0===o?void 0:o.appContainer)&&void 0!==n?n:document.body,this.pdfMetadata=new po(a),this.observer=new MutationObserver(Wn((()=>this._update()),100)),this.observer.observe(this.pdfViewer.viewer,{attributes:!0,attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=null!==(i=e.reanchoringMaxWait)&&void 0!==i?i:3e3,this._banner=null,this._bannerState={contentPartner:null!==(r=e.contentPartner)&&void 0!==r?r:null,noTextWarning:!1},this._updateBannerState(this._bannerState),this._checkForSelectableText(),
|
|
88
|
+
this._updateAnnotationLayerVisibility=()=>{const t=s.getSelection();this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new Rt,this._listeners.add(document,"selectionchange",this._updateAnnotationLayerVisibility),this._destroyed=!1}destroy(){var t;this._listeners.removeAll(),this.pdfViewer.viewer.classList.remove("has-transparent-text-layer"),this.observer.disconnect(),null===(t=this._banner)||void 0===t||t.remove(),this._destroyed=!0}uri(){return this.pdfMetadata.getUri()}getMetadata(){return this.pdfMetadata.getMetadata()}anchor(t,e){return ao(0,e)}canAnnotate(t){return function(t){try{return co(t),!0}catch{return!1}}(t)}describe(t,e){return lo(t,e)}async _checkForSelectableText(){try{await this.uri()}catch(t){return}if(!this._destroyed)try{const t=await async function(){const t=Qn();let e=!1;for(let n=0;n<t.pagesCount;n++)if((await eo(n)).trim().length>0){e=!0;break}return e}();this._updateBannerState({noTextWarning:!t})}catch(t){
|
|
89
|
+
console.warn("Unable to check for text in PDF:",t)}}_updateBannerState(t){this._bannerState={...this._bannerState,...t};const e=document.querySelector("#outerContainer");var n;if(!(this._bannerState.contentPartner||this._bannerState.noTextWarning))return null===(n=this._banner)||void 0===n||n.remove(),this._banner=null,void(e.style.height="");this._banner||(this._banner=document.createElement("hypothesis-banner"),document.body.prepend(this._banner),ue(this._banner)),M(_t(ho,{children:[this._bannerState.contentPartner&&_t(uo,{provider:this._bannerState.contentPartner,onClose:()=>this._updateBannerState({contentPartner:null})}),this._bannerState.noTextWarning&&_t(fo,{})]}),this._banner.shadowRoot);const o=this._banner.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 Xn:e.textLayer=null
|
|
90
|
+
;break;case Yn:o=e.div,i=void 0,null===(i=o.querySelector(ye))||void 0===i||i.remove()}}var o,i;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 o=e.highlights[n];if(!document.body.contains(o)){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,o=n?t.width:t.toolbarWidth;this.pdfContainer.style.width=`calc(100% - ${o}px)`;const i=this.pdfViewer.currentScaleValue;return"auto"!==i&&"page-fit"!==i&&"page-width"!==i||(this.pdfViewer.currentScaleValue=i),this.pdfViewer.update(),n}async scrollToAnchor(t){const e=t.annotation,n=vo(t),o=this._anchorOffset(t);if(null!==o&&(await An(this.contentContainer(),o),n)){const t=await this._waitForAnnotationToBeAnchored(e,this._reanchoringMaxWait);if(!t)return;const n=this._anchorOffset(t)
|
|
91
|
+
;if(null===n)return;await An(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(t,e){var n;const o=Date.now();let i;do{i=this.annotator.anchors.find((e=>e.annotation===t)),i&&!vo(i)||(i=null,await yo(20))}while(!i&&Date.now()-o<e);return null!==(n=i)&&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())}}class bo{constructor(t,e,n){this._element=t,this._onFrameAdded=e,this._onFrameRemoved=n,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(Wn((()=>{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 Co(t),this._isDisconnected)return
|
|
92
|
+
;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 Co(t){return new Promise(((e,n)=>{const o=xo(t,((t,i)=>{o(),i?e(i):n(t)}))}))}function xo(t,e,{pollInterval:n=10}={}){let o,i;const r=new WeakSet,s=()=>{clearTimeout(o),o=void 0},a=()=>{const n=t.contentDocument;if(n){if(!r.has(n)){if(r.add(n),s(),!function(t){var e;return"about:blank"===(null===(e=t.contentDocument)||void 0===e?void 0:e.location.href)&&t.hasAttribute("src")&&"about:blank"!==t.src}(t)){
|
|
93
|
+
"interactive"===n.readyState||"complete"===n.readyState?e(null,n):n.addEventListener("DOMContentLoaded",(()=>e(null,n)))}var o;t.contentDocument&&(null===(o=t.contentWindow)||void 0===o||o.addEventListener("unload",i))}}else e(new Error("Frame is cross-origin"))};let c=!1;i=()=>{s(),c||(o=setInterval(a,n))},t.addEventListener("load",a);const l=setTimeout(a,0);return()=>{c=!0,clearTimeout(l),s(),t.removeEventListener("load",a)}}class So{constructor(t,e,n){if(e.length!==n.length)throw new Error("Char boxes length does not match text length");const o=t.parentNode,i=document.createElement("hypothesis-text-layer");o.insertBefore(i,t.nextSibling),o.style.position="relative",i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.color="transparent",i.style.textAlign="left",i.style.mixBlendMode="multiply";const r="sans-serif";i.style.fontSize="16px",i.style.fontFamily=r;const s=document.createElement("canvas").getContext("2d");s.font="16px sans-serif"
|
|
94
|
+
;const a=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,c=function(t,e){const n=[];let o={text:"",rect:new DOMRect};const i=()=>{o.text.length>0&&(n.push(o),o={text:"",rect:new DOMRect})};for(let[n,r]of t.entries()){const t=e[n],s=/\s/.test(t);o.rect=cn(o.rect,r),o.text+=s?" ":t,s&&i()}i();const r=[];let s={words:[],rect:new DOMRect};const a=()=>{s.words.length>0&&(r.push(s),s={words:[],rect:new DOMRect})};for(let t of n){const e=s.words[s.words.length-1];if(e){const n=ln(e.rect),o=ln(t.rect).x-n.x;(!sn(e.rect,t.rect)||o<0)&&a()}s.words.push(t),s.rect=cn(s.rect,t.rect)}a();const c=[];let l={lines:[],rect:new DOMRect};const h=()=>{l.lines.length>0&&(c.push(l),l={lines:[],rect:new DOMRect})};for(let t of r){const e=l.lines[l.lines.length-1];if(e){const n=ln(e.rect),o=ln(t.rect).y-n.y;(!an(e.rect,t.rect)||sn(e.rect,t.rect)||o<0||o>4*t.rect.height)&&h()}l.lines.push(t),l.rect=cn(l.rect,t.rect)}return h(),c}(e,n);for(let t of c){const e=document.createElement("hypothesis-text-column");e.style.display="block",
|
|
95
95
|
e.style.position="absolute",e.style.left=a("x",t.rect.left),e.style.top=a("y",t.rect.top);let n=null;for(let o of t.lines){const i=document.createElement("hypothesis-text-line");i.style.display="block",i.style.marginLeft=a("x",o.rect.left-t.rect.left),i.style.height=a("y",o.rect.height),n&&(i.style.marginTop=a("y",o.rect.top-n.rect.bottom)),n=o,i.style.whiteSpace="nowrap";let r=null;for(let t of o.words){const e=document.createElement("hypothesis-text-word");e.style.display="inline-block",e.style.transformOrigin="top left",e.textContent=t.text,r&&(e.style.marginLeft=a("x",t.rect.left-r.rect.right)),r=t,e.style.width=a("x",t.rect.width),e.style.height=a("y",t.rect.height),e.style.whiteSpace="pre";const n=s.measureText(t.text),o=a("x",t.rect.width/n.width,""),c=a("y",t.rect.height/16,"");e.style.transform=`scale(${o}, ${c})`,i.append(e)}e.append(i)}i.append(e)}const l=()=>{const{width:e,height:n}=t.getBoundingClientRect();i.style.width=e+"px",i.style.height=n+"px",i.style.setProperty("--x-scale",`${e}`),
|
|
96
|
-
i.style.setProperty("--y-scale",`${n}`)};l(),this.container=i,this._updateTextLayerSize=
|
|
97
|
-
;s.className="js-hypothesis-config",s.type="application/json",s.innerText=JSON.stringify(r);const a=document.createElement("script");a.async=!0,a.src=e.clientUrl;const c=t.contentDocument;c.body.appendChild(s),c.body.appendChild(a)}function
|
|
98
|
-
html_side_by_side:!0}),this._htmlIntegration=new
|
|
99
|
-
return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(t){const e=
|
|
100
|
-
;const o=(n=10)=>{this._pendingCallback=setTimeout((()=>{t(
|
|
101
|
-
;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)).map((t=>null==t?void 0:t.$tag));return e}function
|
|
102
|
-
contentPartner:e.contentPartner}),this._hostRPC=new
|
|
103
|
-
this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",[])})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async getDocumentInfo(){const[t,e]=await Promise.all([this._integration.uri(),this._integration.getMetadata()]);return{uri:
|
|
104
|
-
;((n=window)===(o=t)||n.parent===o&&n.frameElement&&n.frameElement.getBoundingClientRect().width/n.parent.innerWidth>=.8)&&this.fitSideBySide(e)}));const e=await this._portFinder.discover("host");this._hostRPC.connect(e)}async _connectSidebar(){this._sidebarRPC.on("featureFlagsUpdated",(t=>this.features.update(t))),this._sidebarRPC.on("focusAnnotations",(t=>this._focusAnnotations(t))),this._sidebarRPC.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=
|
|
105
|
-
this.getDocumentInfo().then((t=>this._sidebarRPC.call("documentInfoChanged",t)))}destroy(){this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),function(t){
|
|
106
|
-
;if(!this._annotations.has(t.$tag))return[];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._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(let e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&
|
|
107
|
-
const n=t.includes(e.annotation.$tag);
|
|
108
|
-
selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function
|
|
109
|
-
;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 o}function
|
|
110
|
-
children:
|
|
96
|
+
i.style.setProperty("--y-scale",`${n}`)};l(),this.container=i,this._updateTextLayerSize=Wn(l,{maxWait:50}),this._listeners=new Rt,"undefined"!=typeof ResizeObserver&&(this._imageSizeObserver=new ResizeObserver((()=>{this._updateTextLayerSize()})),this._imageSizeObserver.observe(t)),this._listeners.add(window,"resize",this._updateTextLayerSize)}updateSync(){this._updateTextLayerSize(),this._updateTextLayerSize.flush()}destroy(){var t;this.container.remove(),this._listeners.removeAll(),this._updateTextLayerSize.cancel(),null===(t=this._imageSizeObserver)||void 0===t||t.disconnect()}}class Eo{constructor(t,e){this._config=e,this._frameObserver=new bo(t,(t=>To(t,e)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function To(t,e){if(null!==t.contentDocument.querySelector("script.js-hypothesis-config"))return;await Co(t);const{assetRoot:n,notebookAppUrl:o,sidebarAppUrl:i}=Gt(document),r={...e,assetRoot:n,notebookAppUrl:o,sidebarAppUrl:i,subFrameIdentifier:Pt(10)},s=document.createElement("script")
|
|
97
|
+
;s.className="js-hypothesis-config",s.type="application/json",s.innerText=JSON.stringify(r);const a=document.createElement("script");a.async=!0,a.src=e.clientUrl;const c=t.contentDocument;c.body.appendChild(s),c.body.appendChild(a)}function Ao(t=document){return t.querySelector("mosaic-book")}function ko(t=window){var e;if(Ao(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&Ao(n)?"content":null}class Ro{constructor(t){const e=Ao();if(!e)throw new Error("Book container element not found");const n=new WeakSet,o=e.shadowRoot,i=()=>{const e=o.querySelector("iframe");e&&!n.has(e)&&(n.add(e),xo(e,((n,o)=>{const i=null==o?void 0:o.body;i&&!i.querySelector("#page-content")&&To(e,t)})))};i(),this._frameObserver=new MutationObserver(i),this._frameObserver.observe(o,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}}function Lo(){return document.querySelector("img#pbk-page")}class Po{constructor(t=document.body){const e=new Ie;e.update({
|
|
98
|
+
html_side_by_side:!0}),this._htmlIntegration=new kn({container:t,features:e}),this._listeners=new Rt;const n=["mouseup","mousedown","mouseout"];for(let t of n)this._listeners.add(document.documentElement,t,(t=>{t.stopPropagation()}));const o=window.frameElement;o&&function(t){if("no"!==t.getAttribute("scrolling"))return;const e=document.createElement("style");e.textContent="iframe { height: 100% !important; }",t.insertAdjacentElement("beforebegin",e);const n=()=>t.removeAttribute("scrolling");n(),new MutationObserver(n).observe(t,{attributes:!0})}(o);const i=Lo(),r=window.innerPageData;if(i&&r){const t=r.glyphs.glyphs.map((t=>{const e=t.l/100,n=t.r/100,o=t.t/100,i=t.b/100;return new DOMRect(e,o,n-e,i-o)}));this._textLayer=new So(i,t,r.words),this._textLayer.container.style.zIndex="100"}}canAnnotate(){return!0}destroy(){var t;null===(t=this._textLayer)||void 0===t||t.destroy(),this._listeners.removeAll(),this._htmlIntegration.destroy()}anchor(t,e){return this._htmlIntegration.anchor(t,e)}describe(t,e){
|
|
99
|
+
return this._htmlIntegration.describe(t,e)}contentContainer(){return this._htmlIntegration.contentContainer()}fitSideBySide(t){const e=Lo();if(e&&this._textLayer){const n=e.parentElement,o=this._textLayer,i=window.innerWidth-t.width;return mn((()=>{t.expanded&&i>480?(n.style.textAlign="left",e.style.width=`${i}px`):(n.style.textAlign="",e.style.width=""),o.updateSync()})),t.expanded}return this._htmlIntegration.fitSideBySide(t)}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 Mo(t,{contentPartner:e}={}){if("undefined"!=typeof PDFViewerApplication)return new wo(t,{contentPartner:e});return"content"===ko()?new Po:new kn({features:t.features})}function No(t){const e=t.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);return n.collapsed?null:n}class Oo{constructor(t,e=document){let n=!1;this._pendingCallback=null
|
|
100
|
+
;const o=(n=10)=>{this._pendingCallback=setTimeout((()=>{t(No(e))}),n)},i=t=>{if("mousedown"===t.type&&(n=!0),"mouseup"===t.type&&(n=!1),n)return;this._cancelPendingCallback();const e="mouseup"===t.type?10:100;o(e)};this._document=e,this._listeners=new Rt,this._listeners.add(e,"selectionchange",i),this._listeners.add(e.body,"mousedown",i),this._listeners.add(e.body,"mouseup",i),o(1)}disconnect(){this._listeners.removeAll(),this._cancelPendingCallback()}_cancelPendingCallback(){this._pendingCallback&&(clearTimeout(this._pendingCallback),this._pendingCallback=null)}}function Io(){const t=function(t,e){const n=new Set,o=new Set;return xe(t,(t=>{let i=t;for(;i&&!n.has(i);){n.add(i);const t=e(i);null!=t&&o.add(t),i=i.parentNode}})),[...o]}(window.getSelection().getRangeAt(0),(t=>{var e;return null===(e=t._annotation)||void 0===e?void 0:e.$tag}));return t}function Do(t){const e=function(t){let e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;const n=[]
|
|
101
|
+
;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)).map((t=>null==t?void 0:t.$tag));return e}function Bo(t){if(!t.range)return null;try{return t.range.toRange()}catch{return null}}function Fo(){var t;null===(t=document.getSelection())||void 0===t||t.removeAllRanges()}class Ho{constructor(t,e={},n=window){this.element=t,this._hostFrame=n,this._highlightsVisible=!1,this._isAdderVisible=!1,this._informHostOnNextSelectionClear=!0,this.selectedRanges=[],this._adder=new fe(this.element,{onAnnotate:()=>this.createAnnotation(),onHighlight:()=>this.createAnnotation({highlight:!0}),onShowAnnotations:t=>this.selectAnnotations(t)}),this._selectionObserver=new Oo((t=>{t?this._onSelection(t):this._onClearSelection()})),this.anchors=[],this._annotations=new Set,this._frameIdentifier=e.subFrameIdentifier||null,this._portFinder=new Ot({hostFrame:this._hostFrame,source:"guest"}),this.features=new Ie,this._integration=Mo(this,{
|
|
102
|
+
contentPartner:e.contentPartner}),this._hostRPC=new Xt,this._connectHost(n),this._sidebarRPC=new Xt,this._connectSidebar(),this._bucketBarClient=new Pe({contentContainer:this._integration.contentContainer(),hostRPC:this._hostRPC}),this._sideBySideActive=!1,this._listeners=new Rt,this._setupElementEvents(),this._focusedAnnotations=new Set}_setupElementEvents(){const t=t=>{this._sideBySideActive||Do(t).length||this._sidebarRPC.call("closeSidebar")};this._listeners.add(this.element,"mouseup",(t=>{const{target:e,metaKey:n,ctrlKey:o}=t,i=Do(e);if(i.length&&this._highlightsVisible){const t=n||o;this.selectAnnotations(i,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=Do(t);e.length&&this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",e)})),this._listeners.add(this.element,"mouseout",(()=>{
|
|
103
|
+
this._highlightsVisible&&this._sidebarRPC.call("focusAnnotations",[])})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async getDocumentInfo(){const[t,e]=await Promise.all([this._integration.uri(),this._integration.getMetadata()]);return{uri:tn(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)}async _connectHost(t){this._hostRPC.on("clearSelection",(()=>{No(document)&&(this._informHostOnNextSelectionClear=!1,Fo())})),this._hostRPC.on("createAnnotation",(()=>this.createAnnotation())),this._hostRPC.on("focusAnnotations",(t=>this._focusAnnotations(t))),this._hostRPC.on("scrollToClosestOffScreenAnchor",((t,e)=>this._scrollToClosestOffScreenAnchor(t,e))),this._hostRPC.on("selectAnnotations",((t,e)=>this.selectAnnotations(t,e))),this._hostRPC.on("sidebarLayoutChanged",(e=>{var n,o
|
|
104
|
+
;((n=window)===(o=t)||n.parent===o&&n.frameElement&&n.frameElement.getBoundingClientRect().width/n.parent.innerWidth>=.8)&&this.fitSideBySide(e)}));const e=await this._portFinder.discover("host");this._hostRPC.connect(e)}async _connectSidebar(){this._sidebarRPC.on("featureFlagsUpdated",(t=>this.features.update(t))),this._sidebarRPC.on("focusAnnotations",(t=>this._focusAnnotations(t))),this._sidebarRPC.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=Bo(e);if(!n)return;const o=new CustomEvent("scrolltorange",{bubbles:!0,cancelable:!0,detail:n});this.element.dispatchEvent(o)&&this._integration.scrollToAnchor(e)})),this._sidebarRPC.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t)})),this._sidebarRPC.on("deleteAnnotation",(t=>this.detach(t))),this._sidebarRPC.on("loadAnnotations",(t=>t.forEach((t=>this.anchor(t))))),this._portFinder.discover("sidebar").then((t=>{this._sidebarRPC.connect(t)})),
|
|
105
|
+
this.getDocumentInfo().then((t=>this._sidebarRPC.call("documentInfoChanged",t)))}destroy(){this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),function(t){ke(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{const e=Bo(t);if(!e)return;const n=Te(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&Re(n,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),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 o=await this._integration.anchor(this.element,e.selector),i=ve.fromRange(o);n={annotation:t,target:e,range:i}}catch(o){n={annotation:t,target:e}}return n})))
|
|
106
|
+
;if(!this._annotations.has(t.$tag))return[];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._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(let e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&ke(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Pt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Fo(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){
|
|
107
|
+
const n=t.includes(e.annotation.$tag);Re(e.highlights,n)}this._sidebarRPC.call("focusAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,o=0;for(let r of t){var i;if(null===(i=r.highlights)||void 0===i||!i.length)continue;const t=Le(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>o||"down"===e&&t<o)&&(n=r,o=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=be(e),o=Se(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Io(),this._isAdderVisible=!0,this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}
|
|
108
|
+
selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Vo(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function qo(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.1069.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),Array.isArray(o.services)&&(null===(n=o.services)||void 0===n?void 0:n.length)>0){const t=o.services[0]
|
|
109
|
+
;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 o}function Uo({config:t,groupId:e}){return _t("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Vo(t.notebookAppUrl,{...qo(t.notebookAppUrl,t),group:e})})}function Wo({eventBus:t,config:e}){const[n,o]=st(0),[i,r]=st(!0),[s,a]=st(null),c=lt(""),l=lt(null);at((()=>(c.current=document.body.style.overflow,()=>{document.body.style.overflow=c.current})),[]),at((()=>{document.body.style.overflow=i?c.current:"hidden"}),[i]),at((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),l.current=e,()=>{e.destroy()}}),[t]);return null===s?null:_t("div",{className:K("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:i}),"data-testid":"notebook-outer",
|
|
110
|
+
children:_t("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[_t("div",{className:"absolute right-0 text-xl m-3",children:_t(xt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=l.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),_t(Uo,{config:e,groupId:s},n)]})})}class zo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=ue(this._outerContainer),M(_t(Wo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var $o={exports:{}};!function(t){!function(e,n,o,i){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),c=Math.round,l=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 o;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(o=0;o<t.length;)e.call(n,t[o],o,t),
|
|
111
111
|
o++;else for(o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function p(t,n,o){var i="DEPRECATED METHOD: "+n+"\n"+o+" AT \n";return function(){var n=new Error("get-stack-trace"),o=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,i,o),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===i||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(o!==i&&null!==o)for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var o=Object.keys(e),r=0;r<o.length;)(!n||n&&t[o[r]]===i)&&(t[o[r]]=e[o[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 o,i=e.prototype;(o=t.prototype=Object.create(i)).constructor=t,
|
|
112
112
|
o._super=i,n&&r(o,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]||i,e):t}function w(t,e){return t===i?e:t}function b(t,e,n){f(E(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(E(e),(function(e){t.removeEventListener(e,n,!1)}))}function x(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function S(t,e){return t.indexOf(e)>-1}function E(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var o=0;o<t.length;){if(n&&t[o][n]==e||!n&&t[o]===e)return o;o++}return-1}function A(t){return Array.prototype.slice.call(t,0)}function k(t,e,n){for(var o=[],i=[],r=0;r<t.length;){var s=e?t[r][e]:t[r];T(i,s)<0&&o.push(t[r]),i[r]=s,r++}return n&&(o=e?o.sort((function(t,n){return t[e]>n[e]})):o.sort()),o}function R(t,e){for(var n,o,r=e[0].toUpperCase()+e.slice(1),a=0;a<s.length;){if((o=(n=s[a])?n+r:e)in t)return o;a++}return i}var L=1;function P(t){var n=t.ownerDocument||t
|
|
113
113
|
;return n.defaultView||n.parentWindow||e}var M="ontouchstart"in e,N=R(e,"PointerEvent")!==i,O=M&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),I="touch",D="mouse",B=24,F=["x","y"],H=["clientX","clientY"];function V(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 q(t,e,n){var o=n.pointers.length,r=n.changedPointers.length,s=1&e&&o-r==0,a=12&e&&o-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,o=e.pointers,r=o.length;n.firstInput||(n.firstInput=U(e));r>1&&!n.firstMultiple?n.firstMultiple=U(e):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,c=a?a.center:s.center,u=e.center=W(o);e.timeStamp=h(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=X(c,u),e.distance=j(c,u),function(t,e){var n=e.center,o=t.offsetDelta||{},i=t.prevDelta||{},r=t.prevInput||{}
|
|
@@ -127,20 +127,20 @@ this.manager.emit(this.options.event,t)}}),_(Bt,At,{defaults:{event:"tap",pointe
|
|
|
127
127
|
this.manager.emit(this.options.event,this._input))}}),Ft.VERSION="2.0.7",Ft.defaults={domEvents:!1,touchAction:vt,enable:!0,inputTarget:null,inputClass:null,preset:[[It,{enable:!1}],[Nt,{enable:!1},["rotate"]],[Dt,{direction:6}],[Mt,{direction:6},["swipe"]],[Bt],[Bt,{event:"doubletap",taps:2},["tap"]],[Ot]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ht(t,e){var n;this.options=r({},Ft.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||(N?nt:O?ht:M?dt:K))(n,q),this.touchAction=new Et(this,this.options.touchAction),Vt(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 Vt(t,e){var n,o=t.element;o.style&&(f(t.options.cssProps,(function(i,r){n=R(o.style,r),
|
|
128
128
|
e?(t.oldCssProps[n]=o.style[n],o.style[n]=i):o.style[n]=t.oldCssProps[n]||""})),e||(t.oldCssProps={}))}Ht.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 o=this.recognizers,i=e.curRecognizer;(!i||i&&8&i.state)&&(i=e.curRecognizer=null);for(var r=0;r<o.length;)n=o[r],2===e.stopped||i&&n!=i&&!n.canRecognizeWith(i)?n.reset():n.recognize(t),!i&&14&n.state&&(i=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){
|
|
129
129
|
if(d(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=T(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==i&&e!==i){var n=this.handlers;return f(E(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==i){var n=this.handlers;return f(E(t),(function(t){e?n[t]&&n[t].splice(T(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var o=n.createEvent("Event");o.initEvent(t,!0,!0),o.gesture=e,e.target.dispatchEvent(o)}(t,e);var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var i=0;i<o.length;)o[i](e),i++}},destroy:function(){this.element&&Vt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Ft,{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:Tt,
|
|
130
|
-
DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:B,DIRECTION_ALL:30,Manager:Ht,Input:V,TouchAction:Et,TouchInput:ht,MouseInput:K,PointerEventInput:nt,TouchMouseInput:dt,SingleTouchInput:st,Recognizer:At,AttrRecognizer:Pt,Tap:Bt,Pan:Mt,Swipe:Dt,Pinch:Nt,Rotate:It,Press:Ot,on:b,off:C,each:f,merge:m,extend:g,assign:r,inherit:_,bindFn:v,prefixed:R}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Ft,t.exports?t.exports=Ft:e.Hammer=Ft}(window,document)}(
|
|
131
|
-
;return
|
|
132
|
-
title:`Go up to next annotations (${e.tags.size})`,children:e.tags.size})})]})}class
|
|
133
|
-
position:window.innerHeight-22},buckets:o}}(t);M(
|
|
134
|
-
className:
|
|
135
|
-
this._toggleHighlights=()=>i(!this._highlightsVisible),this._createAnnotation=()=>{n(),o(!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(
|
|
136
|
-
toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const
|
|
137
|
-
onFocusAnnotations:t=>this._guestRPC.forEach((e=>e.call("focusAnnotations",t))),onScrollToClosestOffScreenAnchor:(t,e)=>this._guestRPC.forEach((n=>n.call("scrollToClosestOffScreenAnchor",t,e))),onSelectAnnotations:(t,e)=>this._guestRPC.forEach((n=>n.call("selectAnnotations",t,e)))}),this.iframeContainer.appendChild(this.iframe),this.hypothesisSidebar=document.createElement("hypothesis-sidebar");
|
|
138
|
-
this.iframeContainer?(this.iframeContainer.prepend(i),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[r]=n.services||[];r&&(this.onLoginRequest=r.onLoginRequest,this.onLogoutRequest=r.onLogoutRequest,this.onSignupRequest=r.onSignupRequest,this.onProfileRequest=r.onProfileRequest,this.onHelpRequest=r.onHelpRequest),this.onLayoutChange=n.onLayoutChange,this._layoutState={expanded:!1,width:0,toolbarWidth:0},this._updateLayoutState(!1),this._setupSidebarEvents()}destroy(){var t,e;this._guestRPC.forEach((t=>t.destroy())),this._sidebarRPC.destroy(),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(),
|
|
139
|
-
;break;case"sidebar":this._sidebarRPC.connect(e)}}_connectGuest(t){const e=new
|
|
130
|
+
DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:B,DIRECTION_ALL:30,Manager:Ht,Input:V,TouchAction:Et,TouchInput:ht,MouseInput:K,PointerEventInput:nt,TouchMouseInput:dt,SingleTouchInput:st,Recognizer:At,AttrRecognizer:Pt,Tap:Bt,Pan:Mt,Swipe:Dt,Pinch:Nt,Rotate:It,Press:Ot,on:b,off:C,each:f,merge:m,extend:g,assign:r,inherit:_,bindFn:v,prefixed:R}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Ft,t.exports?t.exports=Ft:e.Hammer=Ft}(window,document)}($o);function jo({children:t}){return _t("ul",{className:K("absolute w-[23px] left-[-22px] h-full","bg-grey-2 sidebar-collapsed:bg-black/[.08]","pointer-events-none"),children:t})}function Xo({children:t,topPosition:e}){return _t("li",{className:K("absolute right-0","pointer-events-auto"),style:{top:e},children:t})}function Yo({above:t,below:e,buckets:n,onFocusAnnotations:o,onScrollToClosestOffScreenAnchor:i,onSelectAnnotations:r}){const s=t.tags.size>0,a=e.tags.size>0
|
|
131
|
+
;return _t(jo,{children:[s&&_t(Xo,{topPosition:t.position,children:_t(St,{className:K("BucketButton UpBucketButton","right-0 mt-[-11px]"),"data-testid":"up-navigation-button",onClick:()=>i([...t.tags],"up"),onBlur:()=>o([]),onFocus:()=>o([...t.tags]),onMouseEnter:()=>o([...t.tags]),onMouseOut:()=>o([]),title:`Go up to next annotations (${t.tags.size})`,children:t.tags.size})}),n.map(((t,e)=>_t(Xo,{topPosition:t.position,children:_t(St,{className:K("BucketButton LeftBucketButton","right-0 mt-[-8px]"),onClick:e=>r([...t.tags],e.metaKey||e.ctrlKey),onBlur:()=>o([]),onFocus:()=>o([...t.tags]),onMouseEnter:()=>o([...t.tags]),onMouseOut:()=>o([]),title:`Select nearby annotations (${t.tags.size})`,children:t.tags.size})},e))),a&&_t(Xo,{topPosition:e.position,children:_t(St,{className:"BucketButton DownBucketButton right-0","data-testid":"down-navigation-button",onClick:()=>i([...e.tags],"down"),onBlur:()=>o([]),onFocus:()=>o([...e.tags]),onMouseEnter:()=>o([...e.tags]),onMouseOut:()=>o([]),
|
|
132
|
+
title:`Go up to next annotations (${e.tags.size})`,children:e.tags.size})})]})}class Go{constructor(t,{onFocusAnnotations:e,onScrollToClosestOffScreenAnchor:n,onSelectAnnotations:o}){this._bucketsContainer=document.createElement("div"),t.appendChild(this._bucketsContainer),this._onFocusAnnotations=e,this._onScrollToClosestOffScreenAnchor=n,this._onSelectAnnotations=o,this.update([])}destroy(){M(null,this._bucketsContainer),this._bucketsContainer.remove()}update(t){const e=function(t){const e=new Set,n=new Set,o=[];let i=null;function r({bottom:t,tag:e,top:n}){return{bottom:t,position:n+(t-n)/2,tags:new Set([e]),top:n}}return t.forEach((t=>{if(t.top<137)return void e.add(t.tag);if(t.top>window.innerHeight-22)return void n.add(t.tag);if(!i)return void(i=r(t));const s=t.top>i.top&&t.bottom<i.bottom;if(t.top-i.bottom>60&&!s)o.push(i),i=r(t);else{const e=t.bottom>i.bottom?t.bottom:i.bottom,n=e-i.top;i.tags.add(t.tag),i.bottom=e,i.position=i.top+n/2}})),i&&o.push(i),{above:{tags:e,position:137},below:{tags:n,
|
|
133
|
+
position:window.innerHeight-22},buckets:o}}(t);M(_t(Yo,{above:e.above,below:e.below,buckets:e.buckets,onFocusAnnotations:t=>this._onFocusAnnotations(t),onScrollToClosestOffScreenAnchor:(t,e)=>this._onScrollToClosestOffScreenAnchor(t,e),onSelectAnnotations:(t,e)=>this._onSelectAnnotations(t,e)}),this._bucketsContainer)}}function Zo({...t}){const{icon:e,title:n,...o}=t;return _t(xt,{className:K("w-[30px] h-[30px]","rounded-px","flex items-center justify-center","border bg-white text-grey-6 hover:text-grey-9","shadow transition-colors"),icon:e,title:n,...o})}function Ko({closeSidebar:t,createAnnotation:e,isSidebarOpen:n,newAnnotationType:o,showHighlights:i,toggleHighlights:r,toggleSidebar:s,toggleSidebarRef:a,useMinimalControls:c=!1}){return _t("div",{className:K("absolute left-[-33px] w-[33px] z-2","text-px-base leading-none"),children:[c&&n&&_t(xt,{
|
|
134
|
+
className:K("w-[27px] h-[27px] mt-[140px] ml-px-1.5","flex items-center justify-center bg-white border","text-grey-6 hover:text-grey-9 transition-colors","border-r-0","shadow-sidebar"),title:"Close annotation sidebar",icon:"cancel",onClick:t}),!c&&_t(f,{children:[_t(xt,{className:K("h-[40px] w-[33px] pl-px-1.5","bg-white text-grey-5 hover:text-grey-9","border-l border-b"),buttonRef:a,title:"Annotation sidebar",icon:n?"caret-right":"caret-left",expanded:n,pressed:n,onClick:s}),_t("div",{className:"space-y-px-1.5 mt-px-2",children:[_t(Zo,{title:"Show highlights",icon:i?"show":"hide",selected:i,onClick:r}),_t(Zo,{title:"note"===o?"New page note":"New annotation",icon:"note"===o?"note":"annotate",onClick:e})]})]})]})}class Jo{constructor(t,e){const{createAnnotation:n,setSidebarOpen:o,setHighlightsVisible:i}=e;this._container=t,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._closeSidebar=()=>o(!1),this._toggleSidebar=()=>o(!this._sidebarOpen),
|
|
135
|
+
this._toggleHighlights=()=>i(!this._highlightsVisible),this._createAnnotation=()=>{n(),o(!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(_t(Ko,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,
|
|
136
|
+
toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const Qo=280;class ti{constructor(t,e,n){if(this._emitter=e.createEmitter(),this._guestWithSelection=null,this._guestRPC=[],this._sidebarRPC=new Xt,this.iframe=function(t){const e=t.sidebarAppUrl,n=Vo(e,qo(e,t)),o=document.createElement("iframe");return o.setAttribute("allowfullscreen",""),o.src=n,o.title="Hypothesis annotation viewer",o.className="sidebar-frame",o}(n),this._config=n,this.bucketBar=null,this.features=new Ie,n.externalContainerSelector){var o;this.externalFrame=null!==(o=document.querySelector(n.externalContainerSelector))&&void 0!==o?o:t,this.externalFrame.appendChild(this.iframe)}else{this.iframeContainer=document.createElement("div"),this.iframeContainer.style.display="none",this.iframeContainer.className="sidebar-container","clean"===n.theme?this.iframeContainer.classList.add("theme-clean"):this.bucketBar=new Go(this.iframeContainer,{
|
|
137
|
+
onFocusAnnotations:t=>this._guestRPC.forEach((e=>e.call("focusAnnotations",t))),onScrollToClosestOffScreenAnchor:(t,e)=>this._guestRPC.forEach((n=>n.call("scrollToClosestOffScreenAnchor",t,e))),onSelectAnnotations:(t,e)=>this._guestRPC.forEach((n=>n.call("selectAnnotations",t,e)))}),this.iframeContainer.appendChild(this.iframe),this.hypothesisSidebar=document.createElement("hypothesis-sidebar");ue(this.hypothesisSidebar).appendChild(this.iframeContainer),t.appendChild(this.hypothesisSidebar)}this.iframe.contentWindow&&qt(this.iframe.contentWindow),this._listeners=new Rt;const i=document.createElement("div");this.toolbar=new Jo(i,{createAnnotation:()=>{var t;if(0===this._guestRPC.length)return;(null!==(t=this._guestWithSelection)&&void 0!==t?t:this._guestRPC[0]).call("createAnnotation")},setSidebarOpen:t=>t?this.open():this.close(),setHighlightsVisible:t=>this.setHighlightsVisible(t)}),"clean"===n.theme?this.toolbar.useMinimalControls=!0:this.toolbar.useMinimalControls=!1,
|
|
138
|
+
this.iframeContainer?(this.iframeContainer.prepend(i),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[r]=n.services||[];r&&(this.onLoginRequest=r.onLoginRequest,this.onLogoutRequest=r.onLogoutRequest,this.onSignupRequest=r.onSignupRequest,this.onProfileRequest=r.onProfileRequest,this.onHelpRequest=r.onHelpRequest),this.onLayoutChange=n.onLayoutChange,this._layoutState={expanded:!1,width:0,toolbarWidth:0},this._updateLayoutState(!1),this._setupSidebarEvents()}destroy(){var t,e;this._guestRPC.forEach((t=>t.destroy())),this._sidebarRPC.destroy(),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(),qt(null)}onFrameConnected(t,e){switch(t){case"guest":this._connectGuest(e)
|
|
139
|
+
;break;case"sidebar":this._sidebarRPC.connect(e)}}_connectGuest(t){const e=new Xt;e.on("textSelected",(()=>{this._guestWithSelection=e,this.toolbar.newAnnotationType="annotation",this._guestRPC.filter((t=>t!==e)).forEach((t=>t.call("clearSelection")))})),e.on("textUnselected",(()=>{this._guestWithSelection=null,this.toolbar.newAnnotationType="note",this._guestRPC.filter((t=>t!==e)).forEach((t=>t.call("clearSelection")))}));const n=this.bucketBar;n&&e.on("anchorsChanged",(t=>{0===this._guestRPC.indexOf(e)&&n.update(t)})),e.on("close",(()=>{e.destroy(),e===this._guestWithSelection&&(this._guestWithSelection=null),this._guestRPC=this._guestRPC.filter((t=>t!==e))})),e.connect(t),this._guestRPC.push(e),e.call("sidebarLayoutChanged",this._layoutState)}_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.toString()}))})),function(t,e){
|
|
140
140
|
const n=t.querySelectorAll("[data-hypothesis-trigger]");Array.from(n).forEach((t=>{t.addEventListener("click",(t=>{e(),t.stopPropagation()}))}))}(document.body,(()=>this.open())),this._sidebarRPC.on("featureFlagsUpdated",(t=>this.features.update(t))),this._sidebarRPC.on("connect",(()=>{this.iframeContainer&&(this.iframeContainer.style.display="");const t="always"===this._config.showHighlights;this.setHighlightsVisible(t),(this._config.openSidebar||this._config.annotations||this._config.query||this._config.group)&&this.open()})),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()}))
|
|
141
|
-
;[["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
|
|
142
|
-
;const n=this.iframeContainer&&this.toolbar.getWidth()||0,o=null!==(e=this.iframeContainer)&&void 0!==e?e:this.externalFrame,i=o.getBoundingClientRect(),r=window.getComputedStyle(o),s=parseInt(r.width),a=parseInt(r.marginLeft);let c=n;"boolean"==typeof t?t&&(c+=s):(a<
|
|
141
|
+
;[["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 $o.exports.Manager(t),this._hammerManager.on("panstart panend panleft panright",(t=>this._onPan(t))),this._hammerManager.add(new $o.exports.Pan({direction:$o.exports.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>=Qo&&(this.iframeContainer.style.width=`${e}px`),this._updateLayoutState()}})))}_updateLayoutState(t){var e
|
|
142
|
+
;const n=this.iframeContainer&&this.toolbar.getWidth()||0,o=null!==(e=this.iframeContainer)&&void 0!==e?e:this.externalFrame,i=o.getBoundingClientRect(),r=window.getComputedStyle(o),s=parseInt(r.width),a=parseInt(r.marginLeft);let c=n;"boolean"==typeof t?t&&(c+=s):(a<Qo?c-=a:c+=s,t=c>n);const l={expanded:t,width:t?c:n,height:i.height,toolbarWidth:n};this._layoutState=l,this.onLayoutChange&&this.onLayoutChange(l),this._guestRPC.forEach((t=>t.call("sidebarLayoutChanged",l)))}_onResize(){!0===this.toolbar.sidebarOpen&&(window.innerWidth<Qo?this.close():this.open())}_onPan(t){const e=this.iframeContainer;if(e)switch(t.type){case"panstart":this._resetGestureState(),e.classList.add("sidebar-no-transition"),e.style.pointerEvents="none",this._gestureState.initial=parseInt(getComputedStyle(e).marginLeft);break;case"panend":e.classList.remove("sidebar-no-transition"),e.style.pointerEvents="",null===this._gestureState.final||this._gestureState.final<=-280?this.open():this.close(),this._resetGestureState();break
|
|
143
143
|
;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.iframeContainer){const t=this.iframeContainer.getBoundingClientRect().width;this.iframeContainer.style.marginLeft=-1*t+"px",this.iframeContainer.classList.remove("sidebar-collapsed")}this.toolbar.sidebarOpen=!0,"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!0),this._updateLayoutState(!0)}close(){this.iframeContainer&&(this.iframeContainer.style.marginLeft="",this.iframeContainer.classList.add("sidebar-collapsed")),this.toolbar.sidebarOpen=!1,"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!1),this._updateLayoutState(!1)}setHighlightsVisible(t){this.toolbar.highlightsVisible=t,this._sidebarRPC.call("setHighlightsVisible",t)}show(){
|
|
144
|
-
this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}class
|
|
145
|
-
const t=function(t=navigator.userAgent){if(
|
|
144
|
+
this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}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,o])=>n!==t||o!==e))}destroy(){for(let[t,e]of this._subscriptions)this._emitter.off(t,e);this._subscriptions=[]}}class ni{constructor(){this._emitter=new Bt}createEmitter(){return new ei(this._emitter)}}!function(t,{reset:e=!1}={}){e&&vt.clear();for(let[e,n]of Object.entries(t))vt.set(e,n)}(kt);const oi=document.querySelector('link[type="application/annotator+html"][rel="sidebar"]');new Promise((t=>{"loading"!==document.readyState&&t(),document.addEventListener("readystatechange",(()=>t()))})).then((function(){const t=ne("annotator"),e=t.subFrameIdentifier?window.parent:window,n=[];if(e===window){
|
|
145
|
+
const t=function(t=navigator.userAgent){if(!jt(t))return()=>{};const e=t=>{var e;if("hypothesisPortClosed"===(null===(e=t.data)||void 0===e?void 0:e.type)&&t.ports[0]){const e=t.ports[0];$t(e,"close"),e.close()}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}();n.push({destroy:t});const e=ne("sidebar"),o=new URL(e.sidebarAppUrl).origin,i=new Ut(o),r=new ni,s=new ti(document.body,r,e),a=new zo(document.body,r,ne("notebook"));i.on("frameConnected",((t,e)=>s.onFrameConnected(t,e))),n.push(i,s,a)}if("container"===ko()){const e=new Ro(t);n.push(e)}else{const o=new Eo(document.body,t),i=new Ho(document.body,t,e);n.push(o,i)}oi.addEventListener("destroy",(()=>{n.forEach((t=>t.destroy()));document.querySelectorAll("[data-hypothesis-asset]").forEach((t=>t.remove()))}))}))}();
|
|
146
146
|
//# sourceMappingURL=annotator.bundle.js.map
|