hypothesis 1.1196.0 → 1.1197.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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?3754b0","styles/annotator.css":"styles/annotator.css?06256b","styles/annotator.css.map":"styles/annotator.css.map?fc23a9","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e9b69c","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?4d73b9","styles/sidebar.css.map":"styles/sidebar.css.map?ed8195","styles/ui-playground.css":"styles/ui-playground.css?9d243f","styles/ui-playground.css.map":"styles/ui-playground.css.map?564f8e","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?4a158b","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?99ff43","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?38e79a","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?cfed99","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?989096"};if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=l(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1197.0/");if(document.querySelector("hypothesis-app")){!function(s,n){r(s,"fetch",n.apiUrl),r(s,"fetch",n.apiUrl+"links");for(var a=0,i=["scripts/sidebar.bundle.js"];a<i.length;a++)e(s,o(n,i[a]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,o(n,c[l]))}(document,{assetRoot:u,manifest:c,apiUrl:p.apiUrl})}else{var d=p,h=l(d.notebookAppUrl||"https://hypothes.is/notebook"),y=l(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,a){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",a.sidebarAppUrl),n(s,"notebook","html",a.notebookAppUrl),r(s,"style",o(a,"styles/annotator.css")),n(s,"hypothesis-client","javascript",a.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)e(s,o(a,l[i]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)t(s,o(a,u[p]))}}(document,{assetRoot:u,manifest:c,notebookAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?3754b0",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?06256b",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?fc23a9",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?ed8195",
|
|
13
13
|
"styles/ui-playground.css": "styles/ui-playground.css?9d243f",
|
|
14
14
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?564f8e",
|
|
15
|
-
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?e3fc83",
|
|
15
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?4a158b",
|
|
17
16
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?99ff43",
|
|
17
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?38e79a",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?cfed99",
|
|
19
19
|
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?989096"
|
|
20
20
|
}
|
|
@@ -11,8 +11,8 @@ h=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++N<25);u.state
|
|
|
11
11
|
;t=r?document.createElementNS("http://www.w3.org/2000/svg",m):document.createElement(m,p.is&&p),s=null,l=!1}if(null===m)f===p||l&&t.data===p||(t.data=p);else{if(s=s&&o.call(t.childNodes),h=(f=n.props||u).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!l){if(null!=s)for(f={},_=0;_<t.attributes.length;_++)f[t.attributes[_].name]=t.attributes[_].value;(d||h)&&(d&&(h&&d.__html==h.__html||d.__html===t.innerHTML)||(t.innerHTML=d&&d.__html||""))}if(function(t,e,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in e||k(t,r,null,n[r],i);for(r in e)o&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||k(t,r,e[r],n[r],i)}(t,p,f,r,l),d)e.__k=[];else if(_=e.props.children,x(t,Array.isArray(_)?_:[_],e,n,i,r&&"foreignObject"!==m,s,a,s?s[0]:n.__k&&y(n,0),l),null!=s)for(_=s.length;_--;)null!=s[_]&&g(s[_]);l||("value"in p&&void 0!==(_=p.value)&&(_!==t.value||"progress"===m&&!_||"option"===m&&_!==f.value)&&k(t,"value",_,f.value,!1),
|
|
12
12
|
"checked"in p&&void 0!==(_=p.checked)&&_!==t.checked&&k(t,"checked",_,f.checked,!1))}return t}function O(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){r.__e(t,n)}}function M(t,e,n){var i,o;if(r.unmount&&r.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||O(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){r.__e(t,e)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(o=0;o<i.length;o++)i[o]&&M(i[o],e,n||"function"!=typeof t.type);n||null==t.__e||g(t.__e),t.__=t.__e=t.__d=void 0}function I(t,e,n){return this.constructor(t,n)}function B(t,e,n){var i,s,a;r.__&&r.__(t,e),s=(i="function"==typeof n)?null:n&&n.__k||e.__k,a=[],R(e,t=(!i&&n||e).__k=function(t,e,n){var i,r,s,a={};for(s in e)"key"==s?i=e[s]:"ref"==s?r=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?o.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return m(t,a,i,r,null)
|
|
13
13
|
}(_,null,[t]),s||u,u,void 0!==e.ownerSVGElement,!i&&n?[n]:s?null:e.firstChild?o.call(e.childNodes):null,a,!i&&n?n:s?s.__e:e.firstChild,i),L(a,t)}function F(t,e){var n={__c:e="__cC"+c++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some(w)},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}o=d.slice,r={__e:function(t,e,n,i){for(var o,r,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(t)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),s=o.__d),s)return o.__E=o}catch(e){t=e}throw t}},s=0,v.prototype.setState=function(t,e){var n
|
|
14
|
-
;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=p({},this.state),"function"==typeof t&&(t=t(p({},n),this.props)),t&&p(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),w(this))},v.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),w(this))},v.prototype.render=_,a=[],C.__r=0,c=0;var D,H,V,q,U=0,z=[],W=[]
|
|
15
|
-
;t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(s=!0)}})),!(!s&&i.__c.props===t)&&(!o||o.call(this,t,e,n))}}return i.__N||i.__}(lt,t)}function Q(t,e){var n=G(D++,3);!r.__s&&at(n.__H,e)&&(n.__=t,n.i=e,H.__H.__h.push(n))}function J(t,e){var n=G(D++,4);!r.__s&&at(n.__H,e)&&(n.__=t,n.i=e,H.__h.push(n))}function tt(t){return U=5,et((function(){return{current:t}}),[])}function et(t,e){var n=G(D++,7);return at(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function nt(){for(var t;t=z.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(rt),t.__H.__h.forEach(st),t.__H.__h=[]}catch(e){t.__H.__h=[],r.__e(e,t.__v)}}r.__b=function(t){H=null
|
|
14
|
+
;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=p({},this.state),"function"==typeof t&&(t=t(p({},n),this.props)),t&&p(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),w(this))},v.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),w(this))},v.prototype.render=_,a=[],C.__r=0,c=0;var D,H,V,q,U=0,z=[],W=[],j=r.__b,$=r.__r,X=r.diffed,Y=r.__c,Z=r.unmount;function G(t,e){r.__h&&r.__h(H,t,U||e),U=0;var n=H.__H||(H.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:W}),n.__[t]}function K(t){return U=1,function(t,e,n){var i=G(D++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):lt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=H,!H.u)){H.u=!0;var o=H.shouldComponentUpdate;H.shouldComponentUpdate=function(t,e,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(t){return t.__c}));if(r.every((function(t){return!t.__N})))return!o||o.call(this,t,e,n);var s=!1;return r.forEach((function(t){if(t.__N){var e=t.__[0]
|
|
15
|
+
;t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(s=!0)}})),!(!s&&i.__c.props===t)&&(!o||o.call(this,t,e,n))}}return i.__N||i.__}(lt,t)}function Q(t,e){var n=G(D++,3);!r.__s&&at(n.__H,e)&&(n.__=t,n.i=e,H.__H.__h.push(n))}function J(t,e){var n=G(D++,4);!r.__s&&at(n.__H,e)&&(n.__=t,n.i=e,H.__h.push(n))}function tt(t){return U=5,et((function(){return{current:t}}),[])}function et(t,e){var n=G(D++,7);return at(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function nt(){for(var t;t=z.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(rt),t.__H.__h.forEach(st),t.__H.__h=[]}catch(e){t.__H.__h=[],r.__e(e,t.__v)}}r.__b=function(t){H=null,j&&j(t)},r.__r=function(t){$&&$(t),D=0;var e=(H=t.__c).__H;e&&(V===H?(e.__h=[],H.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=W,t.__N=t.i=void 0}))):(e.__h.forEach(rt),e.__h.forEach(st),e.__h=[])),V=H},r.diffed=function(t){X&&X(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==z.push(e)&&q===r.requestAnimationFrame||((q=r.requestAnimationFrame)||ot)(nt)),e.__H.__.forEach((function(t){
|
|
16
16
|
t.i&&(t.__H=t.i),t.__V!==W&&(t.__=t.__V),t.i=void 0,t.__V=W}))),V=H=null},r.__c=function(t,e){e.some((function(t){try{t.__h.forEach(rt),t.__h=t.__h.filter((function(t){return!t.__||st(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],r.__e(n,t.__v)}})),Y&&Y(t,e)},r.unmount=function(t){Z&&Z(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{rt(t)}catch(t){e=t}})),n.__H=void 0,e&&r.__e(e,n.__v))};var it="function"==typeof requestAnimationFrame;function ot(t){var e,n=function(){clearTimeout(i),it&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);it&&(e=requestAnimationFrame(n))}function rt(t){var e=H,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),H=e}function st(t){var e=H;t.__c=t.__(),H=e}function at(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function lt(t,e){return"function"==typeof e?e(t):e}var ct=0;function ht(t,e,n,i,o){var s,a,l={};for(a in e)"ref"==a?s=e[a]:l[a]=e[a];var c={type:t,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,
|
|
17
17
|
__d:void 0,__c:null,__h:null,constructor:void 0,__v:--ct,__source:o,__self:i};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return r.vnode&&r.vnode(c),c}const ut=new Map;function dt({name:t,className:e="",inline:n=!1,title:i=""}){const o=ut.get(t);if(!o)throw new Error(`Icon "${t.toString()}" is not registered`);const r=tt();J((()=>{const t=r.current.querySelector("svg");t&&t.setAttribute("class",e)}),[e,o]);const s={};return i&&(s.title=i),ht("span",{className:h("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":n}),dangerouslySetInnerHTML:{__html:o},ref:r,...s},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function ft(t,e){const n="string"==typeof t?Symbol(t):t;return ut.set(n,e),n}var pt="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js"
|
|
18
18
|
;function gt({buttonRef:t,classes:e,className:n,icon:i,iconPosition:o="left",size:r="medium",variant:s="normal",expanded:a,pressed:l,type:c="button",...u}){var d;const f=null!==(d=null==u?void 0:u.role)&&void 0!==d?d:"button",p={"aria-label":u.title};return"tab"===f?p["aria-selected"]=l:(p["aria-pressed"]=l,p["aria-expanded"]=a),ht("button",{ref:t,className:h(n,`${n}--${r}`,`${n}--${s}`,{[`${n}--icon-${o}`]:i},e),type:c,...p,...u},void 0,!1,{fileName:pt,lineNumber:84,columnNumber:5})}function mt({className:t="Hyp-IconButton",...e}){const{icon:n}=e;return ht(gt,{className:t,...e,children:ht(dt,{name:n},void 0,!1,{fileName:pt,lineNumber:112,columnNumber:7})},void 0,!1,{fileName:pt,lineNumber:111,columnNumber:5})}function _t({children:t,className:e="Hyp-LabeledButton",...n}){const{icon:i,iconPosition:o="left"}=n;return ht(gt,{className:e,...n,children:[i&&"left"===o&&ht(dt,{name:i},void 0,!1,{fileName:pt,lineNumber:131,columnNumber:43}),t,i&&"right"===o&&ht(dt,{name:i},void 0,!1,{fileName:pt,lineNumber:133,
|
|
@@ -34,12 +34,12 @@ this._source=e,this._sourceId=n,this._listeners=new xt}destroy(){this._listeners
|
|
|
34
34
|
this._hypothesisAppsOrigin=t,this._emitter=new Pt,this._handledRequests=new Set,this._sidebarHostChannel=new MessageChannel,this._listeners=new xt,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=>{e.has(n)||(e.add(n),It(new Error(n),t))};var i,o;this._listeners.add(window,"message",(i=t=>{const{data:e,origin:i,source:o}=t;if(!Nt(e)||"request"!==e.type)return;const{frame1:r,frame2:s,requestId:a,sourceId:l}=e,c=`${r}-${s}`;if(!function(t){return!(null===t||t instanceof MessagePort||window.ServiceWorker&&t instanceof ServiceWorker)}(o))return void n(`Ignored port request for channel ${c} from non-Window source`)
|
|
35
35
|
;if(void 0===this._allowedMessages.find((({allowedOrigin:t,...n})=>this._messageMatches({allowedMessage:n,allowedOrigin:t,data:e,origin:i}))))return void n(`Ignored invalid port request for channel ${c} from ${i}`);if(this._handledRequests.has(a))return;this._handledRequests.add(a);const h="sidebar-host"===c?this._sidebarHostChannel:new MessageChannel,u={frame1:r,frame2:s,type:"offer",requestId:a,sourceId:l},d="null"===i?"*":i;o.postMessage(u,d,[h.port1]),"sidebar"===s?this._sidebarHostChannel.port2.postMessage(u,[h.port2]):"host"===s&&this._emitter.emit("frameConnected",r,h.port2)},o=t,(...t)=>{try{return i(...t)}catch(t){throw It(t,o),t}}))}_messageMatches({allowedMessage:t,allowedOrigin:e,data:n,origin:i}){return("*"===e||i===e)&&kt(n,t)}on(t,e){this._emitter.on(t,e)}destroy(){this._listeners.removeAll()}}const Dt="1.0.0",Ht="frame-rpc";function Vt(t,e,n=[],i=-1){t.postMessage({protocol:Ht,version:Dt,arguments:n,method:e,sequence:i})}function qt(t){const e=t.match(/\bAppleWebKit\/([0-9]+)\b/)
|
|
36
36
|
;if(!e)return!1;return!(parseInt(e[1])<=537)}class Ut{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 xt,this._listeners.add(e,"unload",(()=>{this._port&&(Vt(this._port,"close"),e!==e.parent&&qt(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,this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),Vt(t,"connect");for(let[t,e]of this._pendingCalls)this.call(t,...e);this._pendingCalls=[]}destroy(){this._port&&(Vt(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++,i=e[e.length-1]
|
|
37
|
-
;"function"==typeof i&&(this._callbacks.set(n,i),e=e.slice(0,-1)),Vt(this._port,t,e,n)}_parseMessage({data:t}){return t&&"object"==typeof t?t.protocol!==Ht||t.version!==Dt?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 i=(...t)=>{const i={arguments:t,protocol:Ht,response:e.sequence,version:Dt};n.postMessage(i)};t(...e.arguments,i)}else if("response"in e){const t=this._callbacks.get(e.response);this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Wt(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}Object.assign(e,o)}return e}function
|
|
38
|
-
if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function
|
|
39
|
-
const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return
|
|
40
|
-
allowInBrowserExt:!1,getValue:Zt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentInfoBanner:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce
|
|
37
|
+
;"function"==typeof i&&(this._callbacks.set(n,i),e=e.slice(0,-1)),Vt(this._port,t,e,n)}_parseMessage({data:t}){return t&&"object"==typeof t?t.protocol!==Ht||t.version!==Dt?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 i=(...t)=>{const i={arguments:t,protocol:Ht,response:e.sequence,version:Dt};n.postMessage(i)};t(...e.arguments,i)}else if("response"in e){const t=this._callbacks.get(e.response);this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Wt(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}Object.assign(e,o)}return e}function jt(t){
|
|
38
|
+
if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function $t(t,e,n){const i=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return i.href}function Xt(t){return"string"==typeof t?t:null}function Yt(t){const e=function(t){if(!zt(t,"hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t);let n;function i(t){return zt(e,t)?e[t]:zt(n,t)?n[t]:void 0}return n=jt(e.ignoreOtherConfiguration)?{}:Wt(t.document),{get annotations(){return Xt(n.annotations)||function(){
|
|
39
|
+
const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return $t(t,"hypothesis-client","javascript")},get group(){return Xt(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return $t(t,"notebook","html")},get showHighlights(){return function(){const t=i("showHighlights");switch(t){case"always":case"never":case"whenSidebarOpen":return t;case!0:return"always";case!1:return"never";default:return"always"}}()},get sidebarAppUrl(){return $t(t,"sidebar","html")},get query(){return Xt(n.query)||function(){const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:i}}function Zt(t,e){return t.hostPageSetting(e)}const Gt={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:Zt},branding:{defaultValue:null,
|
|
40
|
+
allowInBrowserExt:!1,getValue:Zt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentInfoBanner:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:jt,getValue:Zt},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},services:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,
|
|
41
41
|
getValue:t=>t.notebookAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:Zt},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:Zt}};function Kt(t,e=window){const n=Yt(e),i={};for(let r of function(t){const e={annotator:["clientUrl","contentInfoBanner","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t)){
|
|
42
|
-
const t=Gt[r],s=void 0!==t.defaultValue,a=!((o
|
|
42
|
+
const t=Gt[r],s=void 0!==t.defaultValue,a=!((o=$t(e,"sidebar","html")).startsWith("http://")||o.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(i[r]=t.defaultValue);continue}const l=t.getValue(n,r);void 0!==l?i[r]=t.coerce?t.coerce(l):l:s&&(i[r]=t.defaultValue)}var o;return i}const Qt={alt:1,ctrl:2,meta:4,shift:8};function Jt(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let i=0,o=null;for(const t of n){const e=Qt[t];if(e)i|=e;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=t}}if(!o)throw new Error(`Invalid shortcut: ${e}`);return((t.ctrlKey?Qt.ctrl:0)|(t.metaKey?Qt.meta:0)|(t.altKey?Qt.alt:0)|(t.shiftKey?Qt.shift:0))===i&&t.key.toLowerCase()===o}function te(t,e,{rootElement:n}={}){Q((()=>{if(t)return function(t,e,{rootElement:n=document.documentElement}={}){const i=n=>{Jt(n,t)&&e(n)};return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}(t,e,{rootElement:n})}),[t,e,n])}
|
|
43
43
|
var ee="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Annotate.js";function ne(t){return ht("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",...t,children:ht("path",{fill:"currentColor",
|
|
44
44
|
d:"M15 0c.27 0 .505.099.703.297A.961.961 0 0 1 16 1v15l-4-3H1a.974.974 0 0 1-.703-.29A.953.953 0 0 1 0 12V1A.96.96 0 0 1 .29.29.966.966 0 0 1 1 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 0 1 .008.11l-.002.074-.006.066a1.447 1.447 0 0 0 .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 0 0 5.5 6a1.467 1.467 0 0 0-.422.062c.177-1.03.542-1.632 1.094-1.804L7 4V3zm5 0-.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 0 1 .008.11l-.002.074-.006.066a1.447 1.447 0 0 0 .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 0 0 10.5 6a1.467 1.467 0 0 0-.422.062c.177-1.03.542-1.632 1.094-1.804L12 4V3z"},void 0,!1,{fileName:ee,lineNumber:17,columnNumber:7})},void 0,!1,{fileName:ee,lineNumber:10,columnNumber:5})}
|
|
45
45
|
var ie="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Cancel.js";function oe(t){return ht("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",...t,children:ht("g",{"fill-rule":"evenodd",fill:"none",children:[ht("path",{d:"M0 0h16v16H0z"},void 0,!1,{fileName:ie,lineNumber:19,columnNumber:9}),ht("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8 3.536-3.536L8 8 4.464 4.464 8 8zm0 0-3.536 3.536L8 8l3.536 3.536L8 8z"},void 0,!1,{fileName:ie,lineNumber:20,columnNumber:9})]},void 0,!0,{fileName:ie,lineNumber:18,columnNumber:7})},void 0,!1,{fileName:ie,lineNumber:10,columnNumber:5})}var re="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretDown.js";function se(t){return ht("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",...t,children:ht("g",{"fill-rule":"evenodd",fill:"none",children:[ht("path",{
|
|
@@ -58,10 +58,10 @@ const Me=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function Ie(t){co
|
|
|
58
58
|
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()}get annotationsForSelection(){return this._annotationsForSelection}set annotationsForSelection(t){this._annotationsForSelection=t,this._render()}hide(){this._isVisible=!1,this._render(),Object.assign(this._outerContainer.style,{top:0,left:0})}destroy(){B(null,this._shadowRoot),this._outerContainer.remove()}show(t,e){const{left:n,top:i,arrowDirection:o}=this._calculateTarget(t,e);this._showAt(n,i),this._isVisible=!0,this._arrowDirection=2===o?"up":"down",this._render()}_calculateTarget(t,e){let n,i,o;n=e&&!Me()?1:2;const r=Math.min(20,t.width),s=this._width(),a=Me()?10:0,l=this._height();return o=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-l<0&&1===n?n=2:t.top+l>this._view.innerHeight&&(n=1),i=2===n?t.top+t.height+10+a:t.top-l-10,
|
|
59
59
|
o=Math.max(o,0),o=Math.min(o,this._view.innerWidth-s),i=Math.max(i,0),i=Math.min(i,this._view.innerHeight-l),{top:i,left:o,arrowDirection:n}}_findZindex(t,e){if(void 0===document.elementsFromPoint)return 32768;const n=this._width(),i=this._height(),o=[...new Set([...document.elementsFromPoint(t,e),...document.elementsFromPoint(t,e+i),...document.elementsFromPoint(t+n/2,e+i/2),...document.elementsFromPoint(t+n,e),...document.elementsFromPoint(t+n,e+i)])].map((t=>+getComputedStyle(t).zIndex)).filter(Number.isInteger);return o.push(0),Math.max(...o)+1}_showAt(t,e){const n=function(t){let e=t.parentElement;for(;e.parentElement&&"static"===getComputedStyle(e).position;)e=e.parentElement;return e}(this._outerContainer).getBoundingClientRect(),i=this._findZindex(t,e);Object.assign(this._outerContainer.style,{left:Be(t-n.left),top:Be(e-n.top),zIndex:i})}_render(){B(ht(Oe,{isVisible:this._isVisible,arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this._onAnnotate(),this.hide();break
|
|
60
60
|
;case"highlight":this._onHighlight(),this.hide();break;case"show":this._onShowAnnotations(this.annotationsForSelection);break;case"hide":this.hide()}},annotationCount:this.annotationsForSelection.length}),this._shadowRoot)}}var De;function He(t,e,n){const i=n===De.Forwards?e:e-1;if(""!==t.charAt(i).trim())return e;let o,r;if(n===De.Backwards?(o=t.substring(0,e),r=o.trimEnd()):(o=t.substring(e),r=o.trimStart()),!r.length)return-1;const s=o.length-r.length;return n===De.Backwards?e-s:e+s}function Ve(t,e){const n=t.commonAncestorContainer.ownerDocument.createNodeIterator(t.commonAncestorContainer,NodeFilter.SHOW_TEXT),i=e===De.Forwards?t.startContainer:t.endContainer,o=e===De.Forwards?t.endContainer:t.startContainer;let r=n.nextNode();for(;r&&r!==i;)r=n.nextNode();e===De.Backwards&&(r=n.previousNode());let s=-1;const a=()=>{if(r=e===De.Forwards?n.nextNode():n.previousNode(),r){const t=r.textContent,n=e===De.Forwards?0:t.length;s=He(t,n,e)}};for(;r&&-1===s&&r!==o;)a();if(r&&s>=0)return{node:r,offset:s}
|
|
61
|
-
;throw new RangeError("No text nodes with non-whitespace text found in range")}function qe(t){var e,n;switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return null!==(e=null===(n=t.textContent)||void 0===n?void 0:n.length)&&void 0!==e?e:0;default:return 0}}function Ue(t){let e=t.previousSibling,n=0;for(;e;)n+=qe(e),e=e.previousSibling;return n}function ze(t,...e){let n=e.shift();const i=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),o=[];let r,s=i.nextNode(),a=0;for(;void 0!==n&&s;)r=s,a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}let We;!function(t){t[t.Forwards=1]="Forwards",t[t.Backwards=2]="Backwards"}(De||(De={})),function(t){t[t.FORWARDS=1]="FORWARDS",t[t.BACKWARDS=2]="BACKWARDS"}(We||(We={}));class
|
|
62
|
-
e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,n=this.offset;for(;e!==t;)n+=Ue(e),e=e.parentElement;return new
|
|
63
|
-
;const n=Ue(t)+e;return new
|
|
64
|
-
return function(t){if(!t.toString().trim().length)throw new RangeError("Range contains no non-whitespace text");if(t.startContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range startContainer is not a text node");if(t.endContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range endContainer is not a text node");const e=t.cloneRange();let n=!1,i=!1;const o={start:He(t.startContainer.textContent,t.startOffset,De.Forwards),end:He(t.endContainer.textContent,t.endOffset,De.Backwards)};if(o.start>=0&&(e.setStart(t.startContainer,o.start),n=!0),o.end>0&&(e.setEnd(t.endContainer,o.end),i=!0),n&&i)return e;if(!n){const{node:t,offset:n}=Ve(e,De.Forwards);t&&n>=0&&e.setStart(t,n)}if(!i){const{node:t,offset:n}=Ve(e,De.Backwards);t&&n>0&&e.setEnd(t,n)}return e}(
|
|
61
|
+
;throw new RangeError("No text nodes with non-whitespace text found in range")}function qe(t){var e,n;switch(t.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return null!==(e=null===(n=t.textContent)||void 0===n?void 0:n.length)&&void 0!==e?e:0;default:return 0}}function Ue(t){let e=t.previousSibling,n=0;for(;e;)n+=qe(e),e=e.previousSibling;return n}function ze(t,...e){let n=e.shift();const i=t.ownerDocument.createNodeIterator(t,NodeFilter.SHOW_TEXT),o=[];let r,s=i.nextNode(),a=0;for(;void 0!==n&&s;)r=s,a+r.data.length>n?(o.push({node:r,offset:n-a}),n=e.shift()):(s=i.nextNode(),a+=r.data.length);for(;void 0!==n&&r&&a===n;)o.push({node:r,offset:r.data.length}),n=e.shift();if(void 0!==n)throw new RangeError("Offset exceeds text length");return o}let We;!function(t){t[t.Forwards=1]="Forwards",t[t.Backwards=2]="Backwards"}(De||(De={})),function(t){t[t.FORWARDS=1]="FORWARDS",t[t.BACKWARDS=2]="BACKWARDS"}(We||(We={}));class je{constructor(t,e){if(Ct(this,"element",void 0),Ct(this,"offset",void 0),
|
|
62
|
+
e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,n=this.offset;for(;e!==t;)n+=Ue(e),e=e.parentElement;return new je(e,n)}resolve(t={}){try{return ze(this.element,this.offset)[0]}catch(e){if(0===this.offset&&void 0!==t.direction){const n=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);n.currentNode=this.element;const i=t.direction===We.FORWARDS,o=i?n.nextNode():n.previousNode();if(!o)throw e;return{node:o,offset:i?0:o.data.length}}throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return je.fromPoint(t,e);case Node.ELEMENT_NODE:return new je(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")
|
|
63
|
+
;const n=Ue(t)+e;return new je(t.parentElement,n)}case Node.ELEMENT_NODE:{if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let n=0;for(let i=0;i<e;i++)n+=qe(t.childNodes[i]);return new je(t,n)}default:throw new Error("Point is not in an element or text node")}}}class $e{constructor(t,e){Ct(this,"start",void 0),Ct(this,"end",void 0),this.start=t,this.end=e}relativeTo(t){return new $e(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]=ze(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:We.FORWARDS}),e=this.end.resolve({direction:We.BACKWARDS}));const n=new Range;return n.setStart(t.node,t.offset),n.setEnd(e.node,e.offset),n}static fromRange(t){const e=je.fromPoint(t.startContainer,t.startOffset),n=je.fromPoint(t.endContainer,t.endOffset);return new $e(e,n)}static fromOffsets(t,e,n){return new $e(new je(t,e),new je(t,n))}static trimmedRange(t){
|
|
64
|
+
return function(t){if(!t.toString().trim().length)throw new RangeError("Range contains no non-whitespace text");if(t.startContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range startContainer is not a text node");if(t.endContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range endContainer is not a text node");const e=t.cloneRange();let n=!1,i=!1;const o={start:He(t.startContainer.textContent,t.startOffset,De.Forwards),end:He(t.endContainer.textContent,t.endOffset,De.Backwards)};if(o.start>=0&&(e.setStart(t.startContainer,o.start),n=!0),o.end>0&&(e.setEnd(t.endContainer,o.end),i=!0),n&&i)return e;if(!n){const{node:t,offset:n}=Ve(e,De.Forwards);t&&n>=0&&e.setStart(t,n)}if(!i){const{node:t,offset:n}=Ve(e,De.Backwards);t&&n>0&&e.setEnd(t,n)}return e}($e.fromRange(t).toRange())}}const Xe=".annotator-placeholder";function Ye(t){return!!t.parentElement&&null!==t.parentElement.closest(Xe)}function Ze(t){if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset
|
|
65
65
|
;return t.getRangeAt(0).startContainer===t.focusNode}function Ge(t,e){try{var n,i;const o=null!==(n=null===(i=e.nodeValue)||void 0===i?void 0:i.length)&&void 0!==n?n:e.childNodes.length;return t.comparePoint(e,0)<=0&&t.comparePoint(e,o)>=0}catch(t){return!1}}function Ke(t,e){const n=t.commonAncestorContainer,i=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let o;for(;o=i.nextNode();)Ge(t,o)&&e(o)}function Qe(t){if(t.isCollapsed)return null;const e=function(t){const e=/^\s*$/,n=[];Ke(t,(t=>{t.nodeType!==Node.TEXT_NODE||t.textContent.match(e)||n.push(t)}));let i=[];return n.forEach((e=>{const n=e.ownerDocument.createRange();if(n.selectNodeContents(e),e===t.startContainer&&n.setStart(e,t.startOffset),e===t.endContainer&&n.setEnd(e,t.endOffset),n.collapsed)return;const o=Array.from(n.getClientRects());n.detach(),i=i.concat(o)})),i}(t.getRangeAt(0));return 0===e.length?null:Ze(t)?e[0]:e[e.length-1]}const Je="http://www.w3.org/2000/svg",tn=["user-annotations","user-highlights","other-content"]
|
|
66
66
|
;function en(t,e){const n=function(t){if(t.collapsed)return[];let e=t.commonAncestorContainer;if(e&&e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentElement),!e)return[];const n=[],i=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let o;for(;o=i.nextNode();){if(!Ge(t,o))continue;const e=o;e===t.startContainer&&t.startOffset>0?e.splitText(t.startOffset):(e===t.endContainer&&t.endOffset<e.data.length&&e.splitText(t.endOffset),n.push(e))}return n}(t),i=n.length>0&&Ye(n[0]);let o=[],r=null,s=null;n.forEach((t=>{r&&r.nextSibling===t?s.push(t):(s=[t],o.push(s)),r=t}));const a=/^\s*$/;o=o.filter((t=>t.some((t=>!a.test(t.data)))));const l=[];return o.forEach((t=>{const n=document.createElement("hypothesis-highlight");n.className=h("hypothesis-highlight",e);t[0].parentNode.replaceChild(n,t[0]),t.forEach((t=>n.appendChild(t))),l.push(n)})),i||function(t,e){if(0===t.length)return;const n=function(t){const e=t.closest(".page");return e&&e.querySelector(".canvasWrapper > canvas")||null}(t[0])
|
|
67
67
|
;if(!n||!n.parentElement)return;let i=n.parentElement.querySelector(".hypothesis-highlight-layer");if(!i){i=document.createElementNS(Je,"svg"),i.setAttribute("class","hypothesis-highlight-layer"),n.parentElement.appendChild(i),n.parentElement.style.position="relative";const t=i.style;t.position="absolute",t.left="0",t.top="0",t.width="100%",t.height="100%",t.mixBlendMode="multiply"}const o=n.getBoundingClientRect(),r=t.map((t=>{const n=t.getBoundingClientRect(),i=document.createElementNS(Je,"rect");return i.setAttribute("x",(n.left-o.left).toString()),i.setAttribute("y",(n.top-o.top).toString()),i.setAttribute("width",n.width.toString()),i.setAttribute("height",n.height.toString()),i.setAttribute("class",h("hypothesis-svg-highlight",e)),t.classList.add("is-transparent"),t.svgHighlight=i,i}));i.append(...r)}(l,e),l}function nn(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function on(t){rn(t,!1);for(const e of t){if(e.parentNode){nn(e,Array.from(e.childNodes))}
|
|
@@ -76,40 +76,40 @@ Object.assign(this._outerContainer.style,{position:"fixed",top:`${this._element.
|
|
|
76
76
|
function Sn(t,e,n,i){let o=t.P[n],r=t.M[n];const s=i>>>31,a=e[n]|s,l=a|r,c=(a&o)+o^o|a;let h=r|~(c|o),u=o&c;const d=xn(h&t.lastRowMask[n])-xn(u&t.lastRowMask[n]);return h<<=1,u<<=1,u|=s,h|=xn(i)-s,o=u|~(l|h),r=h&l,t.P[n]=o,t.M[n]=r,d}function En(t,e,n){if(0===e.length)return[];n=Math.min(n,e.length);const i=[],o=32,r=Math.ceil(e.length/o)-1,s={P:new Uint32Array(r+1),M:new Uint32Array(r+1),lastRowMask:new Uint32Array(r+1)};s.lastRowMask.fill(1<<31),s.lastRowMask[r]=1<<(e.length-1)%o;const a=new Uint32Array(r+1),l=new Map,c=[];for(let t=0;t<256;t++)c.push(a);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(l.has(n))continue;const i=new Uint32Array(r+1);l.set(n,i),n<c.length&&(c[n]=i);for(let t=0;t<=r;t+=1){i[t]=0;for(let r=0;r<o;r+=1){const s=t*o+r;if(s>=e.length)continue;e.charCodeAt(s)===n&&(i[t]|=1<<r)}}}let h=Math.max(0,Math.ceil(n/o)-1);const u=new Uint32Array(r+1);for(let t=0;t<=h;t+=1)u[t]=(t+1)*o;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){
|
|
77
77
|
const f=t.charCodeAt(d);let p;f<c.length?p=c[f]:(p=l.get(f),void 0===p&&(p=a));let g=0;for(let t=0;t<=h;t+=1)g=Sn(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%o;t=0===n?o:n}else t=o;u[h]=u[h-1]+t-g+Sn(s,p,h,g)}else for(;h>0&&u[h]>=n+o;)h-=1;h===r&&u[h]<=n&&(u[h]<n&&i.splice(0,i.length),i.push({start:-1,end:d+1,errors:u[h]}),n=u[h])}return i}function Nn(t,e,n){return function(t,e,n){const i=Cn(e);return n.map((n=>{const o=Math.max(0,n.end-e.length-n.errors);return{start:En(Cn(t.slice(o,n.end)),i,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,En(t,e,n))}function kn(t,e,n){let i=0,o=[];for(;-1!==i;)i=t.indexOf(e,i),-1!==i&&(o.push({start:i,end:i+e.length,errors:0}),i+=1);return o.length>0?o:Nn(t,e,n)}function An(t,e){if(0===e.length||0===t.length)return 0;return 1-kn(t,e,e.length)[0].errors/e.length}function Tn(t,e,n={}){if(0===e.length)return null;const i=Math.min(256,e.length/2),o=kn(t,e,i)
|
|
78
78
|
;if(0===o.length)return null;const r=i=>{const o=1-i.errors/e.length,r=n.prefix?An(t.slice(Math.max(0,i.start-n.prefix.length),i.start),n.prefix):1,s=n.suffix?An(t.slice(i.end,i.end+n.suffix.length),n.suffix):1;let a=1;if("number"==typeof n.hint){a=1-Math.abs(i.start-n.hint)/t.length}return(50*o+20*r+20*s+2*a)/92},s=o.map((t=>({start:t.start,end:t.end,score:r(t)})));return s.sort(((t,e)=>e.score-t.score)),s[0]}function Rn(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 Ln(t,e){let n="",i=t;for(;i!==e;){if(!i)throw new Error("Node is not a descendant of root");n=Rn(i)+"/"+n,i=i.parentNode}return n="/"+n,n=n.replace(/\/$/,""),n}function Pn(t,e,n){e=e.toUpperCase();let i=-1;for(let o=0;o<t.children.length;o++){const r=t.children[o];if(r.nodeName.toUpperCase()===e&&(++i,i===n))return r}return null}function On(t,e=document.body){try{
|
|
79
|
-
return function(t,e){if(null===t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+\])?)+$/))throw new Error("Expression is not a simple XPath");const n=t.split("/");let i=e;n.shift();for(let t of n){let e,n;const o=t.indexOf("[");if(-1!==o){e=t.slice(0,o);const i=t.slice(o+1,t.indexOf("]"));if(n=parseInt(i)-1,n<0)return null}else e=t,n=0;const r=Pn(i,e,n);if(!r)return null;i=r}return i}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class Mn{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new Mn(t,e)}static fromSelector(t,e){const n=On(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const i=On(e.endContainer,t);if(!i)throw new Error("Failed to resolve endContainer XPath");const o
|
|
80
|
-
const t
|
|
79
|
+
return function(t,e){if(null===t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+\])?)+$/))throw new Error("Expression is not a simple XPath");const n=t.split("/");let i=e;n.shift();for(let t of n){let e,n;const o=t.indexOf("[");if(-1!==o){e=t.slice(0,o);const i=t.slice(o+1,t.indexOf("]"));if(n=parseInt(i)-1,n<0)return null}else e=t,n=0;const r=Pn(i,e,n);if(!r)return null;i=r}return i}(t,e)}catch(n){return document.evaluate("."+t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}}class Mn{constructor(t,e){this.root=t,this.range=e}static fromRange(t,e){return new Mn(t,e)}static fromSelector(t,e){const n=On(e.startContainer,t);if(!n)throw new Error("Failed to resolve startContainer XPath");const i=On(e.endContainer,t);if(!i)throw new Error("Failed to resolve endContainer XPath");const o=je.fromCharOffset(n,e.startOffset),r=je.fromCharOffset(i,e.endOffset),s=new $e(o,r).toRange();return new Mn(t,s)}toRange(){return this.range}toSelector(){
|
|
80
|
+
const t=$e.fromRange(this.range).toRange(),e=$e.fromRange(t),n=Ln(e.start.element,this.root),i=Ln(e.end.element,this.root);return{type:"RangeSelector",startContainer:n,startOffset:e.start.offset,endContainer:i,endOffset:e.end.offset}}}class In{constructor(t,e,n){this.root=t,this.start=e,this.end=n}static fromRange(t,e){const n=$e.fromRange(e).relativeTo(t);return new In(t,n.start.offset,n.end.offset)}static fromSelector(t,e){return new In(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return $e.fromOffsets(this.root,this.start,this.end).toRange()}}class Bn{constructor(t,e,n={}){this.root=t,this.exact=e,this.context=n}static fromRange(t,e){const n=t.textContent,i=$e.fromRange(e).relativeTo(t),o=i.start.offset,r=i.end.offset;return new Bn(t,n.slice(o,r),{prefix:n.slice(Math.max(0,o-32),o),suffix:n.slice(r,Math.min(n.length,r+32))})}static fromSelector(t,e){const{prefix:n,suffix:i}=e;return new Bn(t,e.exact,{prefix:n,suffix:i})}toSelector(){return{
|
|
81
81
|
type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(t={}){return this.toPositionAnchor(t).toRange()}toPositionAnchor(t={}){const e=Tn(this.root.textContent,this.exact,{...this.context,hint:t.hint});if(!e)throw new Error("Quote not found");return new In(this.root,e.start,e.end)}}async function Fn(t,e={}){return t.toRange(e)}function Dn(t,e,n={}){let i=null,o=null,r=null;for(let t of e)switch(t.type){case"TextPositionSelector":i=t,n.hint=i.start;break;case"TextQuoteSelector":o=t;break;case"RangeSelector":r=t}const s=t=>{var e;if(null!==(e=o)&&void 0!==e&&e.exact&&t.toString()!==o.exact)throw new Error("quote mismatch");return t};let a=Promise.reject("unable to anchor");if(r){const e=r;a=a.catch((()=>Fn(Mn.fromSelector(t,e),n).then(s)))}if(i){const e=i;a=a.catch((()=>Fn(In.fromSelector(t,e),n).then(s)))}if(o){const e=o;a=a.catch((()=>Fn(Bn.fromSelector(t,e),n)))}return a}function Hn(t,e){const n=[Mn,In,Bn],i=[];for(let o of n)try{const n=o.fromRange(t,e)
|
|
82
82
|
;i.push(n.toSelector())}catch(t){continue}return i}function Vn(t,e=document.baseURI){return new URL(t,e).href.toString().replace(/#.*/,"")}class qn{constructor(t={}){this.document=t.document||document}uri(){let t=decodeURIComponent(this._getDocumentHref());const e=this._getLinks();for(let n of e)"canonical"===n.rel&&(t=n.href);return t}getDocumentMetadata(){const t={title:document.title,link:[],dc:this._getMetaTags("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 i of Array.from(this.document.querySelectorAll("meta"))){const o=i.getAttribute(t),{content:r}=i;if(o&&r){
|
|
83
83
|
const t=o.match(RegExp(`^${e}(.+)$`,"i"));if(t){const e=t[1].toLowerCase();n[e]?n[e].push(r):n[e]=[r]}}}return n}_getTitle(t){return t.highwire.title?t.highwire.title[0]:t.eprints.title?t.eprints.title[0]:t.prism.title?t.prism.title[0]:t.facebook.title?t.facebook.title[0]:t.twitter.title?t.twitter.title[0]:t.dc.title?t.dc.title[0]:this.document.title}_getLinks(t={dc:{},highwire:{}}){const e=[{href:this._getDocumentHref()}],n=Array.from(this.document.querySelectorAll("link"));for(let t of n)if(["alternate","canonical","bookmark","shortlink"].includes(t.rel)){if("alternate"===t.rel){if(t.type&&t.type.match(/^application\/(rss|atom)\+xml/))continue;if(t.hreflang)continue}try{const n=this._absoluteUrl(t.href);e.push({href:n,rel:t.rel,type:t.type})}catch(t){}}for(let n of Object.keys(t.highwire)){const i=t.highwire[n];if("pdf_url"===n)for(let t of i)try{e.push({href:this._absoluteUrl(t),type:"application/pdf"})}catch(t){}if("doi"===n)for(let t of i)"doi:"!==t.slice(0,4)&&(t=`doi:${t}`),e.push({href:t})}
|
|
84
|
-
for(let n of Object.keys(t.dc)){const i=t.dc[n];if("identifier"===n)for(let t of i)"doi:"===t.slice(0,4)&&e.push({href:t})}const i=t.dc["relation.ispartof"],o=t.dc.identifier;if(i&&o){const t=i[i.length-1],n=o[o.length-1],r="urn:x-dc:"+encodeURIComponent(t)+"/"+encodeURIComponent(n);e.push({href:r})}return e}_getFavicon(){let t=null;for(let e of Array.from(this.document.querySelectorAll("link")))if(["shortcut icon","icon"].includes(e.rel))try{t=this._absoluteUrl(e.href)}catch(t){}return t}_absoluteUrl(t){return Vn(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 Un(t){return t.width<=0||t.height<=0}function zn(t,e,n,i){return Math.max(t,n)<Math.min(e,i)}function Wn(t,e){return!Un(t)&&!Un(e)&&(zn(t.left,t.right,e.left,e.right)&&zn(t.top,t.bottom,e.top,e.bottom))}function
|
|
85
|
-
return zn(t.top,t.bottom,e.top,e.bottom)}function
|
|
84
|
+
for(let n of Object.keys(t.dc)){const i=t.dc[n];if("identifier"===n)for(let t of i)"doi:"===t.slice(0,4)&&e.push({href:t})}const i=t.dc["relation.ispartof"],o=t.dc.identifier;if(i&&o){const t=i[i.length-1],n=o[o.length-1],r="urn:x-dc:"+encodeURIComponent(t)+"/"+encodeURIComponent(n);e.push({href:r})}return e}_getFavicon(){let t=null;for(let e of Array.from(this.document.querySelectorAll("link")))if(["shortcut icon","icon"].includes(e.rel))try{t=this._absoluteUrl(e.href)}catch(t){}return t}_absoluteUrl(t){return Vn(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 Un(t){return t.width<=0||t.height<=0}function zn(t,e,n,i){return Math.max(t,n)<Math.min(e,i)}function Wn(t,e){return!Un(t)&&!Un(e)&&(zn(t.left,t.right,e.left,e.right)&&zn(t.top,t.bottom,e.top,e.bottom))}function jn(t,e){
|
|
85
|
+
return zn(t.top,t.bottom,e.top,e.bottom)}function $n(t,e){return zn(t.left,t.right,e.left,e.right)}function Xn(t,e){if(Un(t))return e;if(Un(e))return t;const n=Math.min(t.left,e.left),i=Math.min(t.top,e.top),o=Math.max(t.right,e.right),r=Math.max(t.bottom,e.bottom);return new DOMRect(n,i,o-n,r-i)}function Yn(t){return new DOMPoint((t.left+t.right)/2,(t.top+t.bottom)/2)}const Zn=["p",".para"];let Gn;function Kn(t,e=0,n=t.data.length){return Gn||(Gn=document.createRange()),Gn.setStart(t,e),Gn.setEnd(t,n),Gn.getBoundingClientRect()}function Qn(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*Jn(t,e,n=(()=>!0)){let i=t.firstChild;for(;i;){if(i.nodeType===Node.ELEMENT_NODE){const t=i,o=Wn(Qn(t),e);n(t)&&o&&(yield*Jn(t,e,n))}else if(i.nodeType===Node.TEXT_NODE){const t=i;Wn(Kn(t),e)&&(yield t)}i=i.nextSibling}}function ti(t,e){let n=null;const i=t=>!function(t){
|
|
86
86
|
switch(getComputedStyle(t).position){case"fixed":case"sticky":return!0;default:return!1}}(t);t:for(let s of Jn(t,e,i)){let t=0;for(let i of s.data.split(/\b/)){if(/\S/.test(i)){const a=t,l=t+i.length,c=Kn(s,a,l);if(r=c,!Un(o=e)&&!Un(r)&&r.left>=o.left&&r.right<=o.right&&r.top>=o.top&&r.bottom<=o.bottom){n=document.createRange(),n.setStart(s,a),n.setEnd(s,l);break t}}t+=i.length}}var o,r;return n}function ei(t,e=document.documentElement,n=new DOMRect(0,0,window.innerWidth,window.innerHeight)){const i=ti(e,n);if(!i)return t(),0;const o=i.getBoundingClientRect().top;t();const r=i.getBoundingClientRect().top-o;return e.scrollTop+=r,r}function ni(t,e,n){const i=t[e];if("function"!=typeof i)throw new Error("Can only intercept functions");return t[e]=(...e)=>{const o=i.call(t,...e);return n(...e),o},()=>{t[e]=i}}function ii(t){return t.replace(/#.*/,"")}class oi{constructor(t,e=(()=>location.href)){this._listeners=new xt;let n=e();const i=(i=e())=>{ii(n)!==ii(i)&&(n=i,t(i))},o=window.navigation
|
|
87
87
|
;if(o)this._listeners.add(o,"navigatesuccess",(()=>i()));else{const t=[ni(window.history,"pushState",(()=>i())),ni(window.history,"replaceState",(()=>i()))];this._unpatchHistory=()=>t.forEach((t=>t())),this._listeners.add(window,"popstate",(()=>i()))}}disconnect(){var t;null===(t=this._unpatchHistory)||void 0===t||t.call(this),this._listeners.removeAll()}}var ri="complete",si="canceled";function ai(t,e,n){t.self===t?t.scrollTo(e,n):(t.scrollLeft=e,t.scrollTop=n)}function li(t){var e=t._scrollSettings;if(e){var n=e.maxSynchronousAlignments,i=function(t,e){var n,i,o,r,s,a,l,c=t.align,h=t.target.getBoundingClientRect(),u=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,f=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,g=u,m=d;if(t.isWindow(e))a=Math.min(h.width,e.innerWidth),l=Math.min(h.height,e.innerHeight),i=h.left+e.pageXOffset-e.innerWidth*g+a*g,o=h.top+e.pageYOffset-e.innerHeight*m+l*m,i-=f,o-=p,i=t.align.lockX?e.pageXOffset:i,o=t.align.lockY?e.pageYOffset:o,r=i-e.pageXOffset,
|
|
88
88
|
s=o-e.pageYOffset;else{a=h.width,l=h.height,n=e.getBoundingClientRect();var _=h.left-(n.left-e.scrollLeft),v=h.top-(n.top-e.scrollTop);i=_+a*g-e.clientWidth*g,o=v+l*m-e.clientHeight*m,i-=f,o-=p,i=Math.max(Math.min(i,e.scrollWidth-e.clientWidth),0),o=Math.max(Math.min(o,e.scrollHeight-e.clientHeight),0),i=t.align.lockX?e.scrollLeft:i,o=t.align.lockY?e.scrollTop:o,r=i-e.scrollLeft,s=o-e.scrollTop}return{x:i,y:o,differenceX:r,differenceY:s}}(e,t),o=Date.now()-e.startTime,r=Math.min(1/e.time*o,1);if(e.endIterations>=n)return ai(t,i.x,i.y),t._scrollSettings=null,e.end(ri);var s=1-e.ease(r);if(ai(t,i.x-i.differenceX*s,i.y-i.differenceY*s),o>=e.time)return e.endIterations++,e.scrollAncestor&&li(e.scrollAncestor),void li(t);!function(t){if("requestAnimationFrame"in window)return window.requestAnimationFrame(t);setTimeout(t,16)}(li.bind(null,t))}}function ci(t){return t.self===t}function hi(t){
|
|
89
89
|
return"pageXOffset"in t||(t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth)&&"hidden"!==getComputedStyle(t).overflow}function ui(){return!0}function di(t){if(t.assignedSlot)return di(t.assignedSlot);if(t.parentElement)return"body"===t.parentElement.tagName.toLowerCase()?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 fi=function(t,e,n){if(t){"function"==typeof e&&(n=e,e=null),e||(e={}),e.time=isNaN(e.time)?1e3:e.time,e.ease=e.ease||function(t){return 1-Math.pow(1-t,t/2)},e.align=e.align||{};var i=di(t),o=1,r=e.validTarget||ui,s=e.isScrollable;e.debug&&(console.log("About to scroll to",t),i||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var a=[];i;)if(e.debug&&console.log("Scrolling parent node",i),r(i,o)&&(s?s(i,hi):hi(i))&&(o++,a.push(i)),!(i=di(i))){l(ri);break}return a.reduce(((n,i,o)=>function(t,e,n,i,o){
|
|
90
90
|
var r,s=!e._scrollSettings,a=e._scrollSettings,l=Date.now(),c={passive:!0};function h(t){e._scrollSettings=null,e.parentElement&&e.parentElement._scrollSettings&&e.parentElement._scrollSettings.end(t),n.debug&&console.log("Scrolling ended with type",t,"for",e),o(t),r&&(e.removeEventListener("touchstart",r,c),e.removeEventListener("wheel",r,c))}a&&a.end(si);var u=n.maxSynchronousAlignments;return null==u&&(u=3),e._scrollSettings={startTime:l,endIterations:0,target:t,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||ci,maxSynchronousAlignments:u,end:h,scrollAncestor:i},"cancellable"in n&&!n.cancellable||(r=h.bind(null,si),e.addEventListener("touchstart",r,c),e.addEventListener("wheel",r,c)),s&&li(e),r}(t,i,e,a[o+1],l)),null)}function l(t){--o||n&&n(t)}};function pi(t,e,n){return t+n*(e-t)}async function gi(t,e,{maxDuration:n=500}={}){const i=t.scrollTop,o=e,r=Date.now(),s=Math.min(Math.abs(o-i)/3,n);let a=0;for(;a<1;)await new Promise((t=>{requestAnimationFrame(t)})),a=Math.min(1,(Date.now()-r)/s),
|
|
91
|
-
t.scrollTop=pi(i,o,a)}class mi extends Pt{constructor({features:t,container:e=document.body}){super(),this.features=t,this.container=e,this.anchor=Dn,this.describe=Hn,this._htmlMeta=new qn,this._prevURI=this._htmlMeta.uri(),this._sideBySideEnabled=this.features.flagEnabled("html_side_by_side"),this._sideBySideActive=!1,this._lastLayout=null,this._navObserver=new oi((()=>this._checkForURIChange())),this._metaObserver=new MutationObserver((()=>this._checkForURIChange())),this._metaObserver.observe(document.head,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["rel","href","name","content"]}),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)}_checkForURIChange(){const t=this._htmlMeta.uri();t!==this._prevURI&&(this._prevURI=t,this.emit("uriChanged",t))}getAnnotatableRange(t){try{return
|
|
91
|
+
t.scrollTop=pi(i,o,a)}class mi extends Pt{constructor({features:t,container:e=document.body}){super(),this.features=t,this.container=e,this.anchor=Dn,this.describe=Hn,this._htmlMeta=new qn,this._prevURI=this._htmlMeta.uri(),this._sideBySideEnabled=this.features.flagEnabled("html_side_by_side"),this._sideBySideActive=!1,this._lastLayout=null,this._navObserver=new oi((()=>this._checkForURIChange())),this._metaObserver=new MutationObserver((()=>this._checkForURIChange())),this._metaObserver.observe(document.head,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["rel","href","name","content"]}),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)}_checkForURIChange(){const t=this._htmlMeta.uri();t!==this._prevURI&&(this._prevURI=t,this.emit("uriChanged",t))}getAnnotatableRange(t){try{return $e.trimmedRange(t)}catch(t){
|
|
92
92
|
if(t instanceof RangeError)return null;throw t}}canStyleClusteredHighlights(){return!0}destroy(){this._navObserver.disconnect(),this._metaObserver.disconnect(),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);ei((()=>{document.body.style.marginLeft="",document.body.style.marginRight="";const t=n(document.body);document.body.style.marginRight=`${e}px`;const i=function(t){const e=new Map,n=new Map,i=Zn.join(","),o=Array.from(t.querySelectorAll(i)).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)
|
|
93
93
|
;if(o.forEach((({rect:t})=>{var i,o;let r=null!==(i=e.get(t.left))&&void 0!==i?i:0;r+=1,e.set(t.left,r);let s=null!==(o=n.get(t.right))&&void 0!==o?o: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],[l]=s[0];return{left:a,right:l}}(document.body);if(i){const o=Math.max(0,window.innerWidth-e-i.right);if(o>0){const t=Math.max(0,e-o);document.body.style.marginRight=`${t}px`}n(document.body)>t&&(document.body.style.marginLeft=`${t}px`),i.left<12&&(document.body.style.marginLeft="12px")}else document.body.style.marginLeft="",document.body.style.marginRight=""}))}_deactivateSideBySide(){ei((()=>{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]
|
|
94
94
|
;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=>fi(t,{time:e},n)))}(n)}}var _i=/^\s+|\s+$/g,vi=/^[-+]0x[0-9a-f]+$/i,yi=/^0b[01]+$/i,bi=/^0o[0-7]+$/i,wi=parseInt,Ci="object"==typeof t&&t&&t.Object===Object&&t,xi="object"==typeof self&&self&&self.Object===Object&&self,Si=Ci||xi||Function("return this")(),Ei=Object.prototype.toString,Ni=Math.max,ki=Math.min,Ai=function(){return Si.Date.now()};function Ti(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Ri(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==Ei.call(t)}(t))return NaN;if(Ti(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ti(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(_i,"");var n=yi.test(t);return n||bi.test(t)?wi(t.slice(2),n?2:8):vi.test(t)?NaN:+t}var Li=function(t,e,n){
|
|
95
95
|
var i,o,r,s,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=i,r=o;return i=o=void 0,c=e,s=t.apply(r,n)}function p(t){return c=t,a=setTimeout(m,e),h?f(t):s}function g(t){var n=t-l;return void 0===l||n>=e||n<0||u&&t-c>=r}function m(){var t=Ai();if(g(t))return _(t);a=setTimeout(m,function(t){var n=e-(t-l);return u?ki(n,r-(t-c)):n}(t))}function _(t){return a=void 0,d&&i?f(t):(i=o=void 0,s)}function v(){var t=Ai(),n=g(t);if(i=arguments,o=this,l=t,n){if(void 0===a)return p(l);if(u)return a=setTimeout(m,e),f(l)}return void 0===a&&(a=setTimeout(m,e)),s}return e=Ri(e)||0,Ti(n)&&(h=!!n.leading,r=(u="maxWait"in n)?Ni(Ri(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=o=a=void 0},v.flush=function(){return void 0===a?s:_(Ai())},v};function Pi(t,e,n,i=0){let o=i;for(;o<t.length&&e>0;)n(t[o])&&--e,++o;return o}function Oi(t,e,n,i){let o=0;for(let r=n;r<i;r++)e(t[r])&&++o;return o}function Mi(t,e,n,i,o){
|
|
96
96
|
const r=Oi(t,o,0,n),s=Oi(t,o,n,i);let a=Pi(e,r,o);for(;a<e.length&&!o(e[a]);)++a;return[a,Pi(e,s,o,a)]}const Ii=0,Bi=3,Fi=new Map,Di=new Map;function Hi(t,e){return`${t}:${e}`}function Vi(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 qi(){return PDFViewerApplication.pdfViewer}async function Ui(t){const e=qi();let n=e.getPageView(t);return n&&n.pdfPage||(n=await new Promise((n=>{const i=()=>{e.eventBus?e.eventBus.off("pagesloaded",i):document.removeEventListener("pagesloaded",i),n(e.getPageView(t))};e.eventBus?e.eventBus.on("pagesloaded",i):document.addEventListener("pagesloaded",i)}))),n}function zi(t){const e=Fi.get(t);if(e)return e;const n=(async()=>{const e=await Ui(t);return(await e.pdfPage.getTextContent({normalizeWhitespace:!0})).items.map((t=>t.str)).join("")})();return Fi.set(t,n),n}async function Wi(t){const e=qi();let n=0,i=0,o="";for(let r=0;r<e.pagesCount;r++)if(o=await zi(r),n=i,i+=o.length,i>=t)return{
|
|
97
|
-
index:r,offset:n,text:o};return{index:e.pagesCount-1,offset:n,text:o}}function
|
|
98
|
-
;if(!n)throw new Error("No quote selector found");const i=e.find((t=>"TextPositionSelector"===t.type));if(i){try{const{index:t,offset:e,text:o}=await Wi(i.start),r=i.start-e,s=i.end-e,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await Xi(t,r,s)}catch{}try{const t=Hi(n.exact,i.start),e=Di.get(t);if(e){const{pageIndex:t,anchor:n}=e;return await Xi(t,n.start,n.end)}}catch{}}return async function(t,e){const n=qi().pagesCount,i=Array(n).fill(0).map(((t,e)=>e));let o,r;if(e){const{index:t,offset:n}=await Wi(e);o=t,r=e-n,i.sort(((e,n)=>Math.abs(e-t)-Math.abs(n-t)))}const s=void 0!==t.prefix?Yi(t.prefix):void 0,a=void 0!==t.suffix?Yi(t.suffix):void 0,l=Yi(t.exact);let c;for(let t of i){const e=await zi(t),n=Yi(e);let i;void 0!==o&&void 0!==r&&(t<o?i=n.length:t===o?[i]=Mi(e,n,r,r
|
|
99
|
-
;const r=n.slice(h.start,h.end)===l,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(c){const{page:n,match:i}=c;if(e){const o=Hi(t.exact,e);Di.set(o,{pageIndex:n,anchor:i})}return Xi(n,i.start,i.end)}throw new Error("Quote not found")}(n,null==i?void 0:i.start)}function Gi(t){try{t
|
|
100
|
-
;for(let n=0;n<t;n++)e+=(await zi(n)).length;return e}(s);return[{type:"TextPositionSelector",start:a+o.offset,end:a+r.offset},Bn.fromRange(t,n).toSelector()]}function Qi({children:t}){return ht("div",{className:"flex flex-col",children:t})}function Ji({info:t}){let e=t.item.title;return t.item.subtitle&&(e+=`: ${t.item.subtitle}`),ht("div",{className:h("h-10 bg-white px-4 text-slate-7 text-annotator-base border-b","grid items-center","grid-cols-[100px_minmax(0,auto)]","2xl:grid-cols-[100px_minmax(0,auto)_minmax(0,auto)] 2xl:gap-x-3"),children:[ht("div",{"data-testid":"content-logo",children:t.logo&&ht(Ae,{href:t.logo.link,target:"_blank","data-testid":"logo-link",children:ht("img",{alt:t.logo.title,src:t.logo.logo,"data-testid":"logo-image"})})}),ht("div",{className:h("hidden","2xl:block 2xl:whitespace-nowrap 2xl:overflow-hidden 2xl:text-ellipsis","font-semibold"),
|
|
101
|
-
className:h("flex justify-center items-center gap-x-2"),"data-testid":"content-item-info",children:[ht("div",{className:h("hidden","2xl:block 2xl:grow")}),t.links.previousItem&&ht(_,{children:[ht(Ae,{classes:"flex gap-x-1 items-center text-annotator-sm whitespace-nowrap",title:"Open previous item",href:t.links.previousItem,underline:"always",target:"_blank","data-testid":"content-previous-link",children:[ht(le,{className:"w-em h-em"}),ht("span",{children:"Previous"})]}),ht("div",{className:"text-annotator-sm",children:"|"})]}),ht("div",{className:h("min-w-0 whitespace-nowrap overflow-hidden text-ellipsis shrink font-medium"),children:ht(ke,{title:e,href:t.links.currentItem,"data-testid":"content-item-link",target:"_blank",unstyled:!0,children:e})}),t.links.nextItem&&ht(_,{children:[ht("div",{className:"text-annotator-sm",children:"|"}),ht(Ae,{title:"Open next item",
|
|
102
|
-
"data-testid":"content-next-link",children:[ht("span",{children:"Next"}),ht(he,{className:"w-em h-em"})]})]})]})]})}function to(){return ht("div",{className:"bg-white",role:"alert",children:ht("div",{className:h("flex items-center gap-x-2","border border-yellow-notice bg-yellow-notice/10 text-annotator-base"),children:[ht("div",{className:"bg-yellow-notice text-white p-2",children:ht(yt,{name:"caution",classes:"text-annotator-xl"})}),ht("div",{children:[ht("strong",{children:"This PDF does not contain selectable text:"})," ",ht(bt,{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 eo{constructor(t){this._loaded=function(t){return t.initializedPromise?t.initializedPromise:t.initialized?Promise.resolve():new Promise((e=>{const n=setInterval((()=>{
|
|
103
|
-
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=oo(t);return e||(e=io(no(t))),e}))}async getMetadata(){const t=await this._loaded,{info:e,contentDispositionFilename:n,metadata:i}=await t.pdfDocument.getMetadata(),o=no(t),r=oo(t);let s;s=null!=i&&i.has("dc:title")&&"Untitled"!==i.get("dc:title")?i.get("dc:title"):null!=e&&e.Title?e.Title:n||(r?function(t){const e=new URL(t).pathname.split("/");return e[e.length-1]}(r):"");const a=[{href:io(o)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:o}}}function no(t){return Array.isArray(t.pdfDocument.fingerprints)?t.pdfDocument.fingerprints[0]:t.pdfDocument.fingerprint}function io(t){
|
|
104
|
-
function ro(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];return n&&Ye(n)}function so(t){return new Promise((e=>setTimeout(e,t)))}class ao extends Pt{constructor(t,e={}){var n,i,o;super(),this.annotator=t;const r=window,s=r.PDFViewerApplication;this.pdfViewer=s.pdfViewer,this.pdfViewer.viewer.classList.add("has-transparent-text-layer"),this.pdfContainer=null!==(n=null===(i=s.appConfig)||void 0===i?void 0:i.appContainer)&&void 0!==n?n:document.body,this.pdfMetadata=new eo(s),this.observer=new MutationObserver(Li((()=>this._update()),100)),this.observer.observe(this.pdfViewer.viewer,{attributes:!0,attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=null!==(o=e.reanchoringMaxWait)&&void 0!==o?o:3e3,this._banner=null,this._bannerState={contentInfo:null,noTextWarning:!1},this._updateBannerState(this._bannerState),this._checkForSelectableText(),
|
|
105
|
-
;this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new xt,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()}showContentInfo(t){this._updateBannerState({contentInfo:t})}anchor(t,e){return Zi(0,e)}getAnnotatableRange(t){try{const e
|
|
106
|
-
;for(let n=0;n<t.pagesCount;n++)if((await zi(n)).trim().length>0){e=!0;break}return e}();this._updateBannerState({noTextWarning:!t})}catch(t){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.contentInfo||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),Ie(this._banner)),B(ht(Qi,{children:[this._bannerState.contentInfo&&ht(Ji,{info:this._bannerState.contentInfo}),this._bannerState.noTextWarning&&ht(to,{})]}),this._banner.shadowRoot);const i=this._banner.getBoundingClientRect().height;e.style.height=`calc(100% - ${i}px)`}_update(){const t=[],e=this.pdfViewer.pagesCount;for(let t=0;t<e;t++){var n;const e=this.pdfViewer.getPageView(t)
|
|
97
|
+
index:r,offset:n,text:o};return{index:e.pagesCount-1,offset:n,text:o}}function ji(t){switch(t){case" ":case"\f":case"\n":case"\r":case"\t":case"\v":case" ":return!0;default:return!1}}const $i=t=>!ji(t);async function Xi(t,e,n){const[i,o]=await Promise.all([Ui(t),zi(t)]);if(i.renderingState===Bi&&i.textLayer&&i.textLayer.renderingDone){var r;const t=null!==(r=i.textLayer.textLayerDiv)&&void 0!==r?r:i.textLayer.div;if(!t)throw new Error("Unable to find PDF.js text layer root");const s=t.textContent,[a,l]=Mi(o,s,e,n,$i);Yi(s.slice(a,l))!==Yi(o.slice(e,n))&&yn("Text layer text does not match page text. Highlights will be mis-aligned.");const c=new je(t,a),h=new je(t,l);return new $e(c,h).toRange()}const s=function(t){let e=t.querySelector(Xe);return e||(e=document.createElement("span"),e.classList.add("annotator-placeholder"),e.textContent="Loading annotations...",t.appendChild(e),e)}(i.div),a=document.createRange();return a.setStartBefore(s),a.setEndAfter(s),a}function Yi(t){let e="";for(let n=0;n<t.length;n++){
|
|
98
|
+
const i=t[n];ji(i)||(e+=i)}return e}async function Zi(t,e){const n=e.find((t=>"TextQuoteSelector"===t.type));if(!n)throw new Error("No quote selector found");const i=e.find((t=>"TextPositionSelector"===t.type));if(i){try{const{index:t,offset:e,text:o}=await Wi(i.start),r=i.start-e,s=i.end-e,a=o.substring(r,s);if(n.exact!==a)throw new Error("quote mismatch");return await Xi(t,r,s)}catch{}try{const t=Hi(n.exact,i.start),e=Di.get(t);if(e){const{pageIndex:t,anchor:n}=e;return await Xi(t,n.start,n.end)}}catch{}}return async function(t,e){const n=qi().pagesCount,i=Array(n).fill(0).map(((t,e)=>e));let o,r;if(e){const{index:t,offset:n}=await Wi(e);o=t,r=e-n,i.sort(((e,n)=>Math.abs(e-t)-Math.abs(n-t)))}const s=void 0!==t.prefix?Yi(t.prefix):void 0,a=void 0!==t.suffix?Yi(t.suffix):void 0,l=Yi(t.exact);let c;for(let t of i){const e=await zi(t),n=Yi(e);let i;void 0!==o&&void 0!==r&&(t<o?i=n.length:t===o?[i]=Mi(e,n,r,r,$i):i=0);const h=Tn(n,l,{prefix:s,suffix:a,hint:i});if(h&&(!c||h.score>c.match.score)){
|
|
99
|
+
const[i,o]=Mi(n,e,h.start,h.end,$i);c={page:t,match:{start:i,end:o,score:h.score}};const r=n.slice(h.start,h.end)===l,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(c){const{page:n,match:i}=c;if(e){const o=Hi(t.exact,e);Di.set(o,{pageIndex:n,anchor:i})}return Xi(n,i.start,i.end)}throw new Error("Quote not found")}(n,null==i?void 0:i.start)}function Gi(t){try{t=$e.fromRange(t).toRange()}catch{throw new Error("Selection does not contain text")}const e=Vi(t.startContainer),n=Vi(t.endContainer);if(!e||!n)throw new Error("Selection is outside page text");if(e!==n)throw new Error("Selecting across page breaks is not supported");return[t,e]}async function Ki(t,e){const[n,i]=Gi(e),o=je.fromPoint(n.startContainer,n.startOffset).relativeTo(i),r=je.fromPoint(n.endContainer,n.endOffset).relativeTo(i),s=function(t){let e=0;for(;t.previousSibling;)++e,t=t.previousSibling;return e
|
|
100
|
+
}(i.parentNode),a=await async function(t){if(t>=qi().pagesCount)throw new Error("Invalid page index");let e=0;for(let n=0;n<t;n++)e+=(await zi(n)).length;return e}(s);return[{type:"TextPositionSelector",start:a+o.offset,end:a+r.offset},Bn.fromRange(t,n).toSelector()]}function Qi({children:t}){return ht("div",{className:"flex flex-col",children:t})}function Ji({info:t}){let e=t.item.title;return t.item.subtitle&&(e+=`: ${t.item.subtitle}`),ht("div",{className:h("h-10 bg-white px-4 text-slate-7 text-annotator-base border-b","grid items-center","grid-cols-[100px_minmax(0,auto)]","2xl:grid-cols-[100px_minmax(0,auto)_minmax(0,auto)] 2xl:gap-x-3"),children:[ht("div",{"data-testid":"content-logo",children:t.logo&&ht(Ae,{href:t.logo.link,target:"_blank","data-testid":"logo-link",children:ht("img",{alt:t.logo.title,src:t.logo.logo,"data-testid":"logo-image"})})}),ht("div",{className:h("hidden","2xl:block 2xl:whitespace-nowrap 2xl:overflow-hidden 2xl:text-ellipsis","font-semibold"),
|
|
101
|
+
"data-testid":"content-container-info",title:t.container.title,children:t.container.title}),ht("div",{className:h("flex justify-center items-center gap-x-2"),"data-testid":"content-item-info",children:[ht("div",{className:h("hidden","2xl:block 2xl:grow")}),t.links.previousItem&&ht(_,{children:[ht(Ae,{classes:"flex gap-x-1 items-center text-annotator-sm whitespace-nowrap",title:"Open previous item",href:t.links.previousItem,underline:"always",target:"_blank","data-testid":"content-previous-link",children:[ht(le,{className:"w-em h-em"}),ht("span",{children:"Previous"})]}),ht("div",{className:"text-annotator-sm",children:"|"})]}),ht("div",{className:h("min-w-0 whitespace-nowrap overflow-hidden text-ellipsis shrink font-medium"),children:ht(ke,{title:e,href:t.links.currentItem,"data-testid":"content-item-link",target:"_blank",unstyled:!0,children:e})}),t.links.nextItem&&ht(_,{children:[ht("div",{className:"text-annotator-sm",children:"|"}),ht(Ae,{title:"Open next item",
|
|
102
|
+
classes:"flex gap-x-1 items-center text-annotator-sm whitespace-nowrap",href:t.links.nextItem,underline:"always",target:"_blank","data-testid":"content-next-link",children:[ht("span",{children:"Next"}),ht(he,{className:"w-em h-em"})]})]})]})]})}function to(){return ht("div",{className:"bg-white",role:"alert",children:ht("div",{className:h("flex items-center gap-x-2","border border-yellow-notice bg-yellow-notice/10 text-annotator-base"),children:[ht("div",{className:"bg-yellow-notice text-white p-2",children:ht(yt,{name:"caution",classes:"text-annotator-xl"})}),ht("div",{children:[ht("strong",{children:"This PDF does not contain selectable text:"})," ",ht(bt,{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 eo{constructor(t){this._loaded=function(t){return t.initializedPromise?t.initializedPromise:t.initialized?Promise.resolve():new Promise((e=>{const n=setInterval((()=>{
|
|
103
|
+
t.initialized&&(clearTimeout(n),e())}),5)}))}(t).then((()=>t.downloadComplete?t:new Promise((e=>{const n=()=>{t.eventBus?(t.eventBus.off("documentload",n),t.eventBus.off("documentloaded",n)):window.removeEventListener("documentload",n),e(t)};t.eventBus?(t.eventBus.on("documentloaded",n),t.eventBus.on("documentload",n)):window.addEventListener("documentload",n)}))))}getUri(){return this._loaded.then((t=>{let e=oo(t);return e||(e=io(no(t))),e}))}async getMetadata(){const t=await this._loaded,{info:e,contentDispositionFilename:n,metadata:i}=await t.pdfDocument.getMetadata(),o=no(t),r=oo(t);let s;s=null!=i&&i.has("dc:title")&&"Untitled"!==i.get("dc:title")?i.get("dc:title"):null!=e&&e.Title?e.Title:n||(r?function(t){const e=new URL(t).pathname.split("/");return e[e.length-1]}(r):"");const a=[{href:io(o)}];return r&&a.push({href:r}),{title:s,link:a,documentFingerprint:o}}}function no(t){return Array.isArray(t.pdfDocument.fingerprints)?t.pdfDocument.fingerprints[0]:t.pdfDocument.fingerprint}function io(t){
|
|
104
|
+
return`urn:x-pdf:${t}`}function oo(t){if(!t.url)return null;const e=Vn(t.url);return 0!==e.indexOf("file://")?e:null}function ro(t){var e;const n=null===(e=t.highlights)||void 0===e?void 0:e[0];return n&&Ye(n)}function so(t){return new Promise((e=>setTimeout(e,t)))}class ao extends Pt{constructor(t,e={}){var n,i,o;super(),this.annotator=t;const r=window,s=r.PDFViewerApplication;this.pdfViewer=s.pdfViewer,this.pdfViewer.viewer.classList.add("has-transparent-text-layer"),this.pdfContainer=null!==(n=null===(i=s.appConfig)||void 0===i?void 0:i.appContainer)&&void 0!==n?n:document.body,this.pdfMetadata=new eo(s),this.observer=new MutationObserver(Li((()=>this._update()),100)),this.observer.observe(this.pdfViewer.viewer,{attributes:!0,attributeFilter:["data-loaded"],childList:!0,subtree:!0}),this._reanchoringMaxWait=null!==(o=e.reanchoringMaxWait)&&void 0!==o?o:3e3,this._banner=null,this._bannerState={contentInfo:null,noTextWarning:!1},this._updateBannerState(this._bannerState),this._checkForSelectableText(),
|
|
105
|
+
this._updateAnnotationLayerVisibility=()=>{const t=r.getSelection();this.pdfViewer.viewer.classList.toggle("is-selecting",!t.isCollapsed)},this._listeners=new xt,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()}showContentInfo(t){this._updateBannerState({contentInfo:t})}anchor(t,e){return Zi(0,e)}getAnnotatableRange(t){try{const e=$e.trimmedRange(t);if(function(t){try{return Gi(t),!0}catch{return!1}}(e))return e}catch(t){if(!(t instanceof RangeError))throw t}return null}canStyleClusteredHighlights(){return!0}describe(t,e){return Ki(t,e)}async _checkForSelectableText(){try{await this.uri()}catch(t){return}if(!this._destroyed)try{const t=await async function(){
|
|
106
|
+
const t=qi();let e=!1;for(let n=0;n<t.pagesCount;n++)if((await zi(n)).trim().length>0){e=!0;break}return e}();this._updateBannerState({noTextWarning:!t})}catch(t){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.contentInfo||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),Ie(this._banner)),B(ht(Qi,{children:[this._bannerState.contentInfo&&ht(Ji,{info:this._bannerState.contentInfo}),this._bannerState.noTextWarning&&ht(to,{})]}),this._banner.shadowRoot);const i=this._banner.getBoundingClientRect().height;e.style.height=`calc(100% - ${i}px)`}_update(){const t=[],e=this.pdfViewer.pagesCount;for(let t=0;t<e;t++){var n;const e=this.pdfViewer.getPageView(t)
|
|
107
107
|
;if(null!=e&&null!==(n=e.textLayer)&&void 0!==n&&n.renderingDone)switch(e.renderingState){case Ii:e.textLayer=null;break;case Bi:i=e.div,o=void 0,null===(o=i.querySelector(Xe))||void 0===o||o.remove()}}var i,o;for(let e of this.annotator.anchors)if(e.highlights){if(t.includes(e.annotation))continue;for(let n=0;n<e.highlights.length;n++){const i=e.highlights[n];if(!document.body.contains(i)){e.highlights.splice(n,1),delete e.range,t.push(e.annotation);break}}}t.map((t=>this.annotator.anchor(t)))}contentContainer(){return document.querySelector("#viewerContainer")}fitSideBySide(t){const e=window.innerWidth-t.width,n=t.expanded&&e>=680,i=n?t.width:t.toolbarWidth;this.pdfContainer.style.width=`calc(100% - ${i}px)`;const o=this.pdfViewer.currentScaleValue;return"auto"!==o&&"page-fit"!==o&&"page-width"!==o||(this.pdfViewer.currentScaleValue=o),this.pdfViewer.update(),n}async scrollToAnchor(t){const e=t.annotation,n=ro(t),i=this._anchorOffset(t);if(null!==i&&(await gi(this.contentContainer(),i),n)){
|
|
108
108
|
const t=await this._waitForAnnotationToBeAnchored(e,this._reanchoringMaxWait);if(!t)return;const n=this._anchorOffset(t);if(null===n)return;await gi(this.contentContainer(),n)}}async _waitForAnnotationToBeAnchored(t,e){var n;const i=Date.now();let o;do{o=this.annotator.anchors.find((e=>e.annotation===t)),o&&!ro(o)||(o=null,await so(20))}while(!o&&Date.now()-i<e);return null!==(n=o)&&void 0!==n?n:null}_anchorOffset(t){if(!t.highlights)return null;return function(t,e){let n=0;for(;t!==e&&e.contains(t);)n+=t.offsetTop,t=t.offsetParent;return n}(t.highlights[0],this.contentContainer())}}function lo(t){const e=function(t){if(!t.includes("["))return t;let e="",n=!1,i=!1;for(const o of t)n||"^"!==o?(n||"["!==o?!n&&i&&"]"===o?i=!1:i||(e+=o):i=!0,n=!1):n=!0;return e}(t),n=e.indexOf("!");return-1===n?e:e.slice(0,n)}class co{constructor(t,e,n){this._element=t,this._onFrameAdded=e,this._onFrameRemoved=n,this._annotatableFrames=new Set,this._isDisconnected=!1,this._mutationObserver=new MutationObserver(Li((()=>{
|
|
109
109
|
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 ho(t),this._isDisconnected)return;t.contentWindow.addEventListener("unload",(()=>{this._removeFrame(t)})),this._onFrameAdded(t)}catch(e){console.warn(`Unable to inject the Hypothesis client (from '${document.location.href}' into a cross-origin frame '${t.src}')`)}}_removeFrame(t){this._annotatableFrames.delete(t),this._onFrameRemoved(t)}_discoverFrames(){const t=new Set(this._element.querySelectorAll("iframe[enable-annotation]"));for(let e of t)this._annotatableFrames.has(e)||this._addFrame(e);for(let e of this._annotatableFrames)t.has(e)||this._removeFrame(e)}}function ho(t){return new Promise(((e,n)=>{const i=uo(t,((t,o)=>{i(),o?e(o):n(t)}))}))}function uo(t,e,{pollInterval:n=10}={}){let i,o
|
|
110
110
|
;const r=new WeakSet,s=()=>{clearTimeout(i),i=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)){"interactive"===n.readyState||"complete"===n.readyState?e(null,n):n.addEventListener("DOMContentLoaded",(()=>e(null,n)))}var i;t.contentDocument&&(null===(i=t.contentWindow)||void 0===i||i.addEventListener("unload",o))}}else{s();const n=t.isConnected?"Frame is cross-origin":"Frame is disconnected";e(new Error(n))}};let l=!1;o=()=>{s(),l||(i=setInterval(a,n))},t.addEventListener("load",a);const c=setTimeout(a,0);return()=>{l=!0,clearTimeout(c),s(),t.removeEventListener("load",a)}}class fo{constructor(t,e,n){if(Ct(this,"container",void 0),Ct(this,"_imageSizeObserver",void 0),Ct(this,"_listeners",void 0),Ct(this,"_updateTextLayerSize",void 0),e.length!==n.length)throw new Error("Char boxes length does not match text length")
|
|
111
|
-
;const i=t.parentNode,o=document.createElement("hypothesis-text-layer");i.insertBefore(o,t.nextSibling),i.style.position="relative",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.color="transparent",o.style.textAlign="left",o.style.mixBlendMode="multiply";const r="sans-serif";o.style.fontSize="16px",o.style.fontFamily=r;const s=document.createElement("canvas").getContext("2d");s.font="16px sans-serif";const a=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,l=function(t,e){const n=[];let i={text:"",rect:new DOMRect};const o=()=>{i.text.length>0&&(n.push(i),i={text:"",rect:new DOMRect})};for(const[n,r]of t.entries()){const t=e[n],s=/\s/.test(t);i.text.length>0
|
|
112
|
-
s.rect=Xn(s.rect,t.rect)}a();const l=[];let c={lines:[],rect:new DOMRect};const h=()=>{c.lines.length>0&&(l.push(c),c={lines:[],rect:new DOMRect})};for(const t of r){const e=c.lines[c.lines.length-1];if(e){const n=Yn(e.rect),i=Yn(t.rect).y-n.y;(
|
|
111
|
+
;const i=t.parentNode,o=document.createElement("hypothesis-text-layer");i.insertBefore(o,t.nextSibling),i.style.position="relative",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.color="transparent",o.style.textAlign="left",o.style.mixBlendMode="multiply";const r="sans-serif";o.style.fontSize="16px",o.style.fontFamily=r;const s=document.createElement("canvas").getContext("2d");s.font="16px sans-serif";const a=(t,e,n="px")=>`calc(var(--${t}-scale) * ${e}${n})`,l=function(t,e){const n=[];let i={text:"",rect:new DOMRect};const o=()=>{i.text.length>0&&(n.push(i),i={text:"",rect:new DOMRect})};for(const[n,r]of t.entries()){const t=e[n],s=/\s/.test(t);i.text.length>0&&!jn(i.rect,r)&&o(),i.rect=Xn(i.rect,r),i.text+=s?" ":t,s&&o()}o();const r=[];let s={words:[],rect:new DOMRect};const a=()=>{s.words.length>0&&(r.push(s),s={words:[],rect:new DOMRect})};for(const t of n){const e=s.words[s.words.length-1];if(e){const n=Yn(e.rect),i=Yn(t.rect).x-n.x;(!jn(e.rect,t.rect)||i<0)&&a()}s.words.push(t),
|
|
112
|
+
s.rect=Xn(s.rect,t.rect)}a();const l=[];let c={lines:[],rect:new DOMRect};const h=()=>{c.lines.length>0&&(l.push(c),c={lines:[],rect:new DOMRect})};for(const t of r){const e=c.lines[c.lines.length-1];if(e){const n=Yn(e.rect),i=Yn(t.rect).y-n.y;(!$n(e.rect,t.rect)||jn(e.rect,t.rect)||i<0||i>4*t.rect.height)&&h()}c.lines.push(t),c.rect=Xn(c.rect,t.rect)}return h(),l}(e,n);for(const t of l){const e=document.createElement("hypothesis-text-column");e.style.display="block",e.style.position="absolute",e.style.left=a("x",t.rect.left),e.style.top=a("y",t.rect.top);let n=null;for(const i of t.lines){const o=document.createElement("hypothesis-text-line");o.style.display="block",o.style.marginLeft=a("x",i.rect.left-t.rect.left),o.style.height=a("y",i.rect.height),n&&(o.style.marginTop=a("y",i.rect.top-n.rect.bottom)),n=i,o.style.whiteSpace="nowrap";let r=null;for(const t of i.words){const e=document.createElement("hypothesis-text-word");e.style.display="inline-block",e.style.transformOrigin="top left",
|
|
113
113
|
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),i=a("x",t.rect.width/n.width,""),l=a("y",t.rect.height/16,"");e.style.transform=`scale(${i}, ${l})`,o.append(e)}e.append(o)}o.append(e)}const c=()=>{const{width:e,height:n}=t.getBoundingClientRect();o.style.width=e+"px",o.style.height=n+"px",o.style.setProperty("--x-scale",`${e}`),o.style.setProperty("--y-scale",`${n}`)};c(),this.container=o,this._updateTextLayerSize=Li(c,{maxWait:50}),this._listeners=new xt,"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(),
|
|
114
114
|
null===(t=this._imageSizeObserver)||void 0===t||t.disconnect()}}class po{constructor(t,e){this._config=e,this._frameObserver=new co(t,(t=>go(t,e)),(()=>{}))}destroy(){this._frameObserver.disconnect()}}async function go(t,e,n){if(null!==t.contentDocument.querySelector("script.js-hypothesis-config"))return;await ho(t);const{assetRoot:i,notebookAppUrl:o,sidebarAppUrl:r}=Wt(document),s={...e,assetRoot:i,notebookAppUrl:o,sidebarAppUrl:r,subFrameIdentifier:null!=n?n:Et(10)},a=document.createElement("script");a.className="js-hypothesis-config",a.setAttribute("data-remove-on-unload",""),a.type="application/json",a.innerText=JSON.stringify(s);const l=document.createElement("script");l.async=!0,l.src=e.clientUrl;const c=t.contentDocument;c.body.appendChild(a),c.body.appendChild(l)}function mo(t=document){return t.querySelector("mosaic-book")}function _o(t=window){var e;if(mo(t.document))return"container";const n=null===(e=t.frameElement)||void 0===e?void 0:e.ownerDocument;return n&&mo(n)?"content":null}class vo{
|
|
115
115
|
constructor(t){Ct(this,"_frameObserver",void 0);const e=mo();if(!e)throw new Error("Book container element not found");const n=new WeakSet,i=e.shadowRoot,o=()=>{const e=i.querySelector("iframe");e&&!n.has(e)&&(n.add(e),uo(e,((n,i)=>{if(n)return;const o=i.body;o&&!o.querySelector("#page-content")&&go(e,t,"vitalsource-content")})))};o(),this._frameObserver=new MutationObserver(o),this._frameObserver.observe(i,{childList:!0,subtree:!0})}destroy(){this._frameObserver.disconnect()}}function yo(){return document.querySelector("img#pbk-page")}class bo extends Pt{constructor(t=document.body,e){var n;super(),Ct(this,"_bookElement",void 0),Ct(this,"_features",void 0),Ct(this,"_htmlIntegration",void 0),Ct(this,"_listeners",void 0),Ct(this,"_textLayer",void 0),this._features=e.features;const i=null!==(n=e.bookElement)&&void 0!==n?n:mo(window.parent.document);if(!i)throw new Error("Failed to find <mosaic-book> element in container frame");this._bookElement=i,this._features.on("flagsChanged",(()=>{this.emit("uriChanged")
|
|
@@ -124,17 +124,17 @@ this._sideBySideActive=!1,this._listeners=new xt,this._setupElementEvents(),this
|
|
|
124
124
|
;const[r,s,a]=await Promise.all([this._integration.uri(),this._integration.getMetadata(),null===(t=(e=this._integration).segmentInfo)||void 0===t?void 0:t.call(e)]);return{uri:Vn(r),metadata:s,segmentInfo:a,persistent:null!==(n=null===(i=(o=this._integration).persistFrame)||void 0===i?void 0:i.call(o))&&void 0!==n&&n}}async _sendDocumentInfo(){var t,e;null!==(t=(e=this._integration).waitForFeatureFlags)&&void 0!==t&&t.call(e)&&await this._featureFlagsReceived;const n=await this.getDocumentInfo();this._sidebarRPC.call("documentInfoChanged",n)}_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",(()=>{Co(document)&&(this._informHostOnNextSelectionClear=!1,ko())})),this._hostRPC.on("createAnnotation",(()=>this.createAnnotation())),this._hostRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),
|
|
125
125
|
this._hostRPC.on("scrollToClosestOffScreenAnchor",((t,e)=>this._scrollToClosestOffScreenAnchor(t,e))),this._hostRPC.on("selectAnnotations",((t,e)=>this.selectAnnotations(t,{toggle:e}))),this._hostRPC.on("sidebarLayoutChanged",(e=>{var n,i;((n=window)===(i=t)||n.parent===i&&n.frameElement&&n.frameElement.getBoundingClientRect().width/n.parent.innerWidth>=.8)&&this.fitSideBySide(e)})),this._hostRPC.on("close",(()=>this.emit("hostDisconnected")));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("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._sidebarRPC.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=No(e);if(!n)return;const i=new CustomEvent("scrolltorange",{bubbles:!0,cancelable:!0,detail:n});this.element.dispatchEvent(i)&&this._integration.scrollToAnchor(e)})),
|
|
126
126
|
this._sidebarRPC.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t,!1)})),this._sidebarRPC.on("deleteAnnotation",(t=>this.detach(t))),this._sidebarRPC.on("loadAnnotations",(t=>t.forEach((t=>this.anchor(t))))),this._sidebarRPC.on("showContentInfo",(t=>{var e,n;return null===(e=(n=this._integration).showContentInfo)||void 0===e?void 0:e.call(n,t)})),this._sidebarRPC.on("navigateToSegment",(t=>{var e,n;return null===(e=(n=this._integration).navigateToSegment)||void 0===e?void 0:e.call(n,t)})),this._portFinder.discover("sidebar").then((t=>{this._sidebarRPC.connect(t)})),this._sendDocumentInfo()}destroy(){var t;this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),function(t){on(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{var e
|
|
127
|
-
;const n=No(t);if(!n)return;const i=en(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&rn(i,!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 i=await this._integration.anchor(this.element,e.selector),o
|
|
127
|
+
;const n=No(t);if(!n)return;const i=en(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&rn(i,!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 i=await this._integration.anchor(this.element,e.selector),o=$e.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const 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(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&on(e.highlights);this._updateAnchors(n,e)}
|
|
128
128
|
_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+Et(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),ko(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);rn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue
|
|
129
129
|
;const t=sn(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Ze(n),o=Qe(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=So(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){
|
|
130
|
-
t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Jt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function To(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Ro(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
130
|
+
t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Jt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function To(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Ro(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1197.0";const o=new URL(window.location.href);if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0]
|
|
131
131
|
;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 i}function Lo({config:t,groupId:e}){return ht("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:To(t.notebookAppUrl,{...Ro(t.notebookAppUrl,t),group:e})})}function Po({eventBus:t,config:e}){const[n,i]=K(0),[o,r]=K(!0),[s,a]=K(null),l=tt(""),c=tt(null);Q((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),Q((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),Q((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:ht("div",{className:h("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",
|
|
132
132
|
children:ht("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[ht("div",{className:"absolute right-0 m-3",children:ht(Se,{title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",children:ht(oe,{className:"w-4 h-4"})})}),ht(Lo,{config:e,groupId:s},n)]})})}class Oo{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=Ie(this._outerContainer),B(ht(Po,{eventBus:e,config:n}),this.shadowRoot)}destroy(){B(null,this.shadowRoot),this._outerContainer.remove()}}var Mo={},Io={get exports(){return Mo},set exports(t){Mo=t}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i
|
|
133
133
|
;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)
|
|
134
134
|
}),"merge","Use `assign`.");function _(t,e,n){var i,o=e.prototype;(i=t.prototype=Object.create(o)).constructor=t,i._super=o,n&&r(i,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||o,e):t}function b(t,e){return t===o?e:t}function w(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 N(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function k(t){return Array.prototype.slice.call(t,0)}function A(t,e,n){for(var i=[],o=[],r=0;r<t.length;){var s=e?t[r][e]:t[r];N(o,s)<0&&i.push(t[r]),o[r]=s,r++}return n&&(i=e?i.sort((function(t,n){return t[e]>n[e]})):i.sort()),i}function T(t,e){
|
|
135
135
|
for(var n,i,r=e[0].toUpperCase()+e.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+r:e)in t)return i;a++}return o}var R=1;function L(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var P="ontouchstart"in e,O=T(e,"PointerEvent")!==o,M=P&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),I="touch",B="mouse",F=24,D=["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 i=n.pointers.length,r=n.changedPointers.length,s=1&e&&i-r==0,a=12&e&&i-r==0;n.isFirst=!!s,n.isFinal=!!a,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=U(e));r>1&&!n.firstMultiple?n.firstMultiple=U(e):1===r&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,l=a?a.center:s.center,u=e.center=z(i);e.timeStamp=h(),e.deltaTime=e.timeStamp-s.timeStamp,
|
|
136
|
-
e.angle=X(l,u),e.distance
|
|
137
|
-
e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var f,p;var g=t.element;x(e.srcEvent.target,g)&&(g=e.srcEvent.target);e.target=g}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:e,center:z(e),deltaX:t.deltaX,deltaY:t.deltaY}}function z(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,o=0;o<e;)n+=t[o].clientX,i+=t[o].clientY,o++;return{x:l(n/e),y:l(i/e)}}function W(t,e,n){return{x:e/t||0,y:n/t||0}}function
|
|
136
|
+
e.angle=X(l,u),e.distance=$(l,u),function(t,e){var n=e.center,i=t.offsetDelta||{},o=t.prevDelta||{},r=t.prevInput||{};1!==e.eventType&&4!==r.eventType||(o=t.prevDelta={x:r.deltaX||0,y:r.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y});e.deltaX=o.x+(n.x-i.x),e.deltaY=o.y+(n.y-i.y)}(n,e),e.offsetDirection=j(e.deltaX,e.deltaY);var d=W(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=c(d.x)>c(d.y)?d.x:d.y,e.scale=a?(f=a.pointers,p=i,$(p[0],p[1],H)/$(f[0],f[1],H)):1,e.rotation=a?function(t,e){return X(e[1],e[0],H)+X(t[1],t[0],H)}(a.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,a=t.lastInterval||e,l=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(l>25||a.velocity===o)){var h=e.deltaX-a.deltaX,u=e.deltaY-a.deltaY,d=W(l,h,u);i=d.x,r=d.y,n=c(d.x)>c(d.y)?d.x:d.y,s=j(h,u),t.lastInterval=e}else n=a.velocity,i=a.velocityX,r=a.velocityY,s=a.direction;e.velocity=n,
|
|
137
|
+
e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var f,p;var g=t.element;x(e.srcEvent.target,g)&&(g=e.srcEvent.target);e.target=g}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:h(),pointers:e,center:z(e),deltaX:t.deltaX,deltaY:t.deltaY}}function z(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,o=0;o<e;)n+=t[o].clientX,i+=t[o].clientY,o++;return{x:l(n/e),y:l(i/e)}}function W(t,e,n){return{x:e/t||0,y:n/t||0}}function j(t,e){return t===e?1:c(t)>=c(e)?t<0?2:4:e<0?8:16}function $(t,e,n){n||(n=D);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return Math.sqrt(i*i+o*o)}function X(t,e,n){n||(n=D);var i=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return 180*Math.atan2(o,i)/Math.PI}V.prototype={handler:function(){},init:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),
|
|
138
138
|
this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(L(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&C(this.element,this.evEl,this.domHandler),this.evTarget&&C(this.target,this.evTarget,this.domHandler),this.evWin&&C(L(this.element),this.evWin,this.domHandler)}};var Y={mousedown:1,mousemove:2,mouseup:4},Z="mousedown",G="mousemove mouseup";function K(){this.evEl=Z,this.evWin=G,this.pressed=!1,V.apply(this,arguments)}_(K,V,{handler:function(t){var e=Y[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:B,srcEvent:t}))}});var Q={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:I,3:"pen",4:B,5:"kinect"},tt="pointerdown",et="pointermove pointerup pointercancel";function nt(){this.evEl=tt,this.evWin=et,V.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}
|
|
139
139
|
e.MSPointerEvent&&!e.PointerEvent&&(tt="MSPointerDown",et="MSPointerMove MSPointerUp MSPointerCancel"),_(nt,V,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),o=Q[i],r=J[t.pointerType]||t.pointerType,s=r==I,a=N(e,t.pointerId,"pointerId");1&o&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):12&o&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:r,srcEvent:t}),n&&e.splice(a,1))}});var it={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ot="touchstart",rt="touchstart touchmove touchend touchcancel";function st(){this.evTarget=ot,this.evWin=rt,this.started=!1,V.apply(this,arguments)}function at(t,e){var n=k(t.touches),i=k(t.changedTouches);return 12&e&&(n=A(n.concat(i),"identifier",!0)),[n,i]}_(st,V,{handler:function(t){var e=it[t.type];if(1===e&&(this.started=!0),this.started){var n=at.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,
|
|
140
140
|
srcEvent:t})}}});var lt={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ct="touchstart touchmove touchend touchcancel";function ht(){this.evTarget=ct,this.targetIds={},V.apply(this,arguments)}function ut(t,e){var n=k(t.touches),i=this.targetIds;if(3&e&&1===n.length)return i[n[0].identifier]=!0,[n,n];var o,r,s=k(t.changedTouches),a=[],l=this.target;if(r=n.filter((function(t){return x(t.target,l)})),1===e)for(o=0;o<r.length;)i[r[o].identifier]=!0,o++;for(o=0;o<s.length;)i[s[o].identifier]&&a.push(s[o]),12&e&&delete i[s[o].identifier],o++;return a.length?[A(r.concat(a),"identifier",!0),a]:void 0}_(ht,V,{handler:function(t){var e=lt[t.type],n=ut.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:I,srcEvent:t})}});function dt(){V.apply(this,arguments);var t=v(this.handler,this);this.touch=new ht(this.manager,t),this.mouse=new K(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function ft(t,e){1&t?(this.primaryTouch=e.changedPointers[0].identifier,
|
|
@@ -145,7 +145,7 @@ this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){
|
|
|
145
145
|
if(this.canEmit())return this.emit(t);this.state=Nt},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},recognize:function(t){var e=r({},t);if(!y(this.options.enable,[this,e]))return this.reset(),void(this.state=Nt);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},_(Lt,kt,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=6&e,o=this.attrTest(t);return i&&(8&n||!o)?16|e:i||o?4&n?8|e:2&e?4|e:2:Nt}}),_(Pt,Lt,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var t=this.options.direction,e=[];return 6&t&&e.push(xt),t&F&&e.push(Ct),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,o=t.direction,r=t.deltaX,s=t.deltaY;return o&e.direction||(6&e.direction?(o=0===r?1:r<0?2:4,
|
|
146
146
|
n=r!=this.pX,i=Math.abs(t.deltaX)):(o=0===s?1:s<0?8:16,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=o,n&&i>e.threshold&&o&e.direction},attrTest:function(t){return Lt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Tt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),_(Ot,Lt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[wt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),_(Mt,kt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[yt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,
|
|
147
147
|
!i||!n||12&t.eventType&&!o)this.reset();else if(1&t.eventType)this.reset(),this._timer=u((function(){this.state=8,this.tryEmit()}),e.time,this);else if(4&t.eventType)return 8;return Nt},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=h(),this.manager.emit(this.options.event,this._input)))}}),_(It,Lt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[wt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),_(Bt,Lt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Pt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:n&F&&(e=t.overallVelocityY),
|
|
148
|
-
this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=Tt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Ft,kt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[bt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(i&&o&&n){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter
|
|
148
|
+
this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&c(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=Tt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),_(Ft,kt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[bt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),1&t.eventType&&0===this.count)return this.failTimeout();if(i&&o&&n){if(4!=t.eventType)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||$(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,s&&r?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=u((function(){this.state=8,this.tryEmit()}),e.interval,this),
|
|
149
149
|
2):8}return Nt},failTimeout:function(){return this._timer=u((function(){this.state=Nt}),this.options.interval,this),Nt},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Dt.VERSION="2.0.7",Dt.defaults={domEvents:!1,touchAction:vt,enable:!0,inputTarget:null,inputClass:null,preset:[[It,{enable:!1}],[Ot,{enable:!1},["rotate"]],[Bt,{direction:6}],[Pt,{direction:6},["swipe"]],[Ft],[Ft,{event:"doubletap",taps:2},["tap"]],[Mt]],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({},Dt.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(O?nt:M?ht:P?dt:K))(n,q),this.touchAction=new Et(this,this.options.touchAction),Vt(this,!0),
|
|
150
150
|
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,i=t.element;i.style&&(f(t.options.cssProps,(function(o,r){n=T(i.style,r),e?(t.oldCssProps[n]=i.style[n],i.style[n]=o):i.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 i=this.recognizers,o=e.curRecognizer;(!o||o&&8&o.state)&&(o=e.curRecognizer=null);for(var r=0;r<i.length;)n=i[r],2===e.stopped||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(t),!o&&14&n.state&&(o=e.curRecognizer=n),r++}},get:function(t){if(t instanceof kt)return t
|
|
151
151
|
;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(d(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(d(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=N(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==o&&e!==o){var n=this.handlers;return f(E(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==o){var n=this.handlers;return f(E(t),(function(t){e?n[t]&&n[t].splice(N(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var i=n.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<i.length;)i[o](e),o++}},destroy:function(){
|
|
@@ -155,7 +155,7 @@ function Fo({children:t,topPosition:e}){return ht("li",{className:h("absolute ri
|
|
|
155
155
|
;if(!o)return void(o=r(t));const s=t.top>o.top&&t.bottom<o.bottom;if(t.top-o.bottom>60&&!s)i.push(o),o=r(t);else{const e=t.bottom>o.bottom?t.bottom:o.bottom,n=e-o.top;o.tags.add(t.tag),o.bottom=e,o.position=o.top+n/2}})),o&&i.push(o),{above:{tags:e,position:137},below:{tags:n,position:window.innerHeight-22},buckets:i}}(t);B(ht(Do,{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 Vo({...t}){const{icon:e,title:n,...i}=t;return ht(mt,{className:h("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,...i})}function qo({highlightsVisible:t}){return ht("div",{className:"sr-only",role:"status","data-testid":"toolbar-status",children:t?"Highlights visible":"Highlights hidden"})}
|
|
156
156
|
function Uo({closeSidebar:t,createAnnotation:e,isSidebarOpen:n,newAnnotationType:i,showHighlights:o,toggleHighlights:r,toggleSidebar:s,toggleSidebarRef:a,useMinimalControls:l=!1}){return ht("div",{className:h("absolute left-[-33px] w-[33px] z-2","text-px-base leading-none"),children:[l&&n&&ht(mt,{className:h("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}),!l&&ht(_,{children:[ht(mt,{className:h("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}),ht("div",{className:"space-y-px-1.5 mt-px-2",children:[ht(Vo,{title:"Show highlights",icon:o?"show":"hide",selected:o,onClick:r}),ht(Vo,{title:"note"===i?"New page note":"New annotation",icon:"note"===i?"note":"annotate",onClick:e})]}),ht(qo,{
|
|
157
157
|
highlightsVisible:o})]})]})}class zo{constructor(t,e){const{createAnnotation:n,setSidebarOpen:i,setHighlightsVisible:o}=e;this._container=t,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._closeSidebar=()=>i(!1),this._toggleSidebar=()=>i(!this._sidebarOpen),this._toggleHighlights=()=>o(!this._highlightsVisible),this._createAnnotation=()=>{n(),i(!0)},this._sidebarToggleButton={current:null},this.render()}getWidth(){return this._container.firstChild.getBoundingClientRect().width}set useMinimalControls(t){this._useMinimalControls=t,this.render()}get useMinimalControls(){return this._useMinimalControls}set sidebarOpen(t){this._sidebarOpen=t,this.render()}get sidebarOpen(){return this._sidebarOpen}set newAnnotationType(t){this._newAnnotationType=t,this.render()}get newAnnotationType(){return this._newAnnotationType}set highlightsVisible(t){this._highlightsVisible=t,this.render()}get highlightsVisible(){return this._highlightsVisible}
|
|
158
|
-
get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){B(ht(Uo,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const Wo=280;class
|
|
158
|
+
get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){B(ht(Uo,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const Wo=280;class jo{constructor(t,e,n){if(this._emitter=e.createEmitter(),this._guestWithSelection=null,this._guestRPC=[],this._sidebarRPC=new Ut,this.iframe=function(t){const e=t.sidebarAppUrl,n=To(e,Ro(e,t)),i=document.createElement("iframe");return i.setAttribute("allowfullscreen",""),i.src=n,i.title="Hypothesis annotation viewer",i.className="sidebar-frame",i}(n),this._config=n,this.bucketBar=null,this.features=new wn,n.externalContainerSelector){var i;this.externalFrame=null!==(i=document.querySelector(n.externalContainerSelector))&&void 0!==i?i:t,
|
|
159
159
|
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 Ho(this.iframeContainer,{onFocusAnnotations:t=>this._guestRPC.forEach((e=>e.call("hoverAnnotations",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");Ie(this.hypothesisSidebar).appendChild(this.iframeContainer),t.appendChild(this.hypothesisSidebar)}this.iframe.contentWindow&&Bt(this.iframe.contentWindow),this._listeners=new xt;const o=document.createElement("div");this.toolbar=new zo(o,{createAnnotation:()=>{var t;if(0===this._guestRPC.length)return
|
|
160
160
|
;(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,this.iframeContainer?(this.iframeContainer.prepend(o),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(),
|
|
161
161
|
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(),Bt(null)}onFrameConnected(t,e){switch(t){case"guest":this._connectGuest(e);break;case"sidebar":this._sidebarRPC.connect(e)}}_connectGuest(t){const e=new Ut;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")))})),e.on("highlightsVisibleChanged",(t=>{this.setHighlightsVisible(t)}));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),
|
|
@@ -163,7 +163,7 @@ this._guestRPC=this._guestRPC.filter((t=>t!==e))})),e.connect(t),this._guestRPC.
|
|
|
163
163
|
this._sidebarRPC.on("openSidebar",(()=>this.open())),this._sidebarRPC.on("closeSidebar",(()=>this.close())),this._sidebarRPC.on("openNotebook",(t=>{this.hide(),this._emitter.publish("openNotebook",t)})),this._emitter.subscribe("closeNotebook",(()=>{this.show()}));[["loginRequested",this.onLoginRequest],["logoutRequested",this.onLogoutRequest],["signupRequested",this.onSignupRequest],["profileRequested",this.onProfileRequest],["helpRequested",this.onHelpRequest]].forEach((([t,e])=>{e&&this._sidebarRPC.on(t,(()=>e()))}))}_resetGestureState(){this._gestureState={initial:null,final:null}}_setupGestures(){const t=this.toolbar.sidebarToggleButton;t&&(this._hammerManager=new Mo.Manager(t),this._hammerManager.on("panstart panend panleft panright",(t=>this._onPan(t))),this._hammerManager.add(new Mo.Pan({direction:Mo.DIRECTION_HORIZONTAL})))}_updateLayout(){this.renderFrame||(this.renderFrame=requestAnimationFrame((()=>{if(this.renderFrame=null,
|
|
164
164
|
this._gestureState.final!==this._gestureState.initial&&this.iframeContainer){const t=this._gestureState.final,e=-t;this.iframeContainer.style.marginLeft=`${t}px`,e>=Wo&&(this.iframeContainer.style.width=`${e}px`),this._updateLayoutState()}})))}_updateLayoutState(t){var e;const n=this.iframeContainer&&this.toolbar.getWidth()||0,i=null!==(e=this.iframeContainer)&&void 0!==e?e:this.externalFrame,o=i.getBoundingClientRect(),r=window.getComputedStyle(i),s=parseInt(r.width),a=parseInt(r.marginLeft);let l=n;"boolean"==typeof t?t&&(l+=s):(a<Wo?l-=a:l+=s,t=l>n);const c={expanded:t,width:t?l:n,height:o.height,toolbarWidth:n};this._layoutState=c,this.onLayoutChange&&this.onLayoutChange(c),this._guestRPC.forEach((t=>t.call("sidebarLayoutChanged",c)))}_onResize(){!0===this.toolbar.sidebarOpen&&(window.innerWidth<Wo?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",
|
|
165
165
|
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;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,
|
|
166
|
-
"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!1),this._updateLayoutState(!1)}setHighlightsVisible(t){this.toolbar.highlightsVisible=t,this._sidebarRPC.call("setHighlightsVisible",t)}show(){this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}class
|
|
167
|
-
;new Promise((t=>{"loading"!==document.readyState&&t(),document.addEventListener("readystatechange",(()=>t()))})).then((function(){const t=Kt("annotator");let e=()=>{};const n=new Promise((t=>{e=t}));Yo.addEventListener("destroy",e);const i=t.subFrameIdentifier?window.parent:window,o=[];if(i===window){const t=function(t=navigator.userAgent){if(!qt(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];Vt(e,"close"),e.close()}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}();o.push({destroy:t});const e=Kt("sidebar"),n=new URL(e.sidebarAppUrl).origin,i=new Ft(n),r=new Xo,s=new
|
|
166
|
+
"whenSidebarOpen"===this._config.showHighlights&&this.setHighlightsVisible(!1),this._updateLayoutState(!1)}setHighlightsVisible(t){this.toolbar.highlightsVisible=t,this._sidebarRPC.call("setHighlightsVisible",t)}show(){this.iframeContainer&&this.iframeContainer.classList.remove("is-hidden")}hide(){this.iframeContainer&&this.iframeContainer.classList.add("is-hidden")}}class $o{constructor(t){this._emitter=t,this._subscriptions=[]}publish(t,...e){this._emitter.emit(t,...e)}subscribe(t,e){this._emitter.on(t,e),this._subscriptions.push([t,e])}unsubscribe(t,e){this._emitter.off(t,e),this._subscriptions=this._subscriptions.filter((([n,i])=>n!==t||i!==e))}destroy(){for(let[t,e]of this._subscriptions)this._emitter.off(t,e);this._subscriptions=[]}}class Xo{constructor(){this._emitter=new Pt}createEmitter(){return new $o(this._emitter)}}!function(t,{reset:e=!1}={}){e&&ut.clear();for(let[e,n]of Object.entries(t))ut.set(e,n)}(wt);const Yo=document.querySelector('link[type="application/annotator+html"][rel="sidebar"]')
|
|
167
|
+
;new Promise((t=>{"loading"!==document.readyState&&t(),document.addEventListener("readystatechange",(()=>t()))})).then((function(){const t=Kt("annotator");let e=()=>{};const n=new Promise((t=>{e=t}));Yo.addEventListener("destroy",e);const i=t.subFrameIdentifier?window.parent:window,o=[];if(i===window){const t=function(t=navigator.userAgent){if(!qt(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];Vt(e,"close"),e.close()}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}();o.push({destroy:t});const e=Kt("sidebar"),n=new URL(e.sidebarAppUrl).origin,i=new Ft(n),r=new Xo,s=new jo(document.body,r,e),a=new Oo(document.body,r,Kt("notebook"));i.on("frameConnected",((t,e)=>s.onFrameConnected(t,e))),o.push(i,s,a)}if("container"===_o()){const e=new vo(t);o.push(e)}else{const n=new po(document.body,t),r=new Ao(document.body,t,i);r.on("hostDisconnected",e),o.push(n,r)}n.then((()=>{
|
|
168
168
|
o.forEach((t=>t.destroy()));document.querySelectorAll("[data-hypothesis-asset]").forEach((t=>t.remove())),function(t=document){Array.from(t.querySelectorAll("script.js-hypothesis-config[data-remove-on-unload]")).forEach((t=>t.remove()))}()}))}))}();
|
|
169
169
|
//# sourceMappingURL=annotator.bundle.js.map
|