hypothesis 1.1019.0 → 1.1022.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/boot.js +1 -1
- package/build/manifest.json +11 -11
- package/build/scripts/annotator.bundle.js +3 -3
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +376 -376
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css +32 -7
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +50 -27
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +32 -7
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function
|
|
1
|
+
!function(){"use strict";function t(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function e(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.every((function(e){return"function"==typeof t[e]}))}var n={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var i=["es2017","es2018"];function l(t){t.setAttribute("data-hypothesis-asset","")}function c(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,l(n),t.head.appendChild(n)}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,s=void 0===r||r,o=n.forceReload,a=void 0!==o&&o,i=t.createElement("script");s&&(i.type="module"),a&&(e+="#ts=".concat(Date.now())),i.src=e,i.async=!1,l(i),t.head.appendChild(i)}function p(t,e,n,r){var s=t.createElement("link");s.rel=e,s.href=r,s.type="application/annotator+".concat(n),l(s),t.head.appendChild(s)}function d(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),l(r),t.head.appendChild(r)}function f(t,e){return t.assetRoot+"build/"+t.manifest[e]}function h(t){return function(t){return t.filter((function(t){var e=n[t];if(!e)throw new Error('Unknown polyfill set "'.concat(t,'"'));return e()}))}(t).map((function(t){return"scripts/polyfills-".concat(t,".bundle.js")}))}function y(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?y(e.src):null}function m(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===t.indexOf("{"))return t;var n=b(e);if(!n)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",n.hostname)).replace("{current_scheme}",n.protocol)}var v={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?14cbe4","styles/annotator.css":"styles/annotator.css?b7677c","styles/annotator.css.map":"styles/annotator.css.map?1c0084","styles/highlights.css":"styles/highlights.css?c308d0","styles/highlights.css.map":"styles/highlights.css.map?5be890","styles/katex.min.css":"styles/katex.min.css?ac2365","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?ed2cb3","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?13b830","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?0d185a","styles/sidebar.css":"styles/sidebar.css?a1796a","styles/sidebar.css.map":"styles/sidebar.css.map?b1ba58","styles/ui-playground.css.map":"styles/ui-playground.css.map?583d6c","styles/ui-playground.css":"styles/ui-playground.css?4b82d8","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?2cbb43","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?577b12","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?6c77bf","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?65b751"};if(function(){var t=[function(){return Promise.resolve()},function(){return new Map},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 t.every((function(t){return t()}))}catch(t){return!1}}()){var g=function(e){for(var n={},r=e.querySelectorAll("script.js-hypothesis-config"),s=0;s<r.length;s++){var o=void 0;try{o=JSON.parse(r[s].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(n,o)}return n}(document),j=m(g.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1022.0/");if(document.querySelector("hypothesis-app")){!function(t,e){d(t,"fetch",e.apiUrl),d(t,"fetch",e.apiUrl+"links");var n,o=h(i),a=r([].concat(s(o),["scripts/sidebar.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!0})}catch(t){a.e(t)}finally{a.f()}for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)c(t,f(e,p[l]))}(document,{assetRoot:j,manifest:v,apiUrl:g.apiUrl})}else{var w=g,A=m(w.notebookAppUrl||"https://hypothes.is/notebook"),k=m(w.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){p(t,"sidebar","html",e.sidebarAppUrl),p(t,"notebook","html",e.notebookAppUrl),d(t,"style",f(e,"styles/annotator.css")),p(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var n,o=h(i),a=r([].concat(s(o),["scripts/annotator.bundle.js"]));try{for(a.s();!(n=a.n()).done;)u(t,f(e,n.value),{esModule:!1})}catch(t){a.e(t)}finally{a.f()}var l=[];void 0!==window.PDFViewerApplication&&l.push("styles/pdfjs-overrides.css"),l.push("styles/highlights.css");for(var y=0,b=l;y<b.length;y++)c(t,f(e,b[y]))}}(document,{assetRoot:j,manifest:v,notebookAppUrl:A,sidebarAppUrl:k})}}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,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
3
|
-
"
|
|
4
|
-
"styles/annotator.css": "styles/annotator.css?
|
|
5
|
-
"styles/annotator.css.map": "styles/annotator.css.map?3da421",
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?14cbe4",
|
|
3
|
+
"styles/annotator.css": "styles/annotator.css?b7677c",
|
|
4
|
+
"styles/annotator.css.map": "styles/annotator.css.map?1c0084",
|
|
6
5
|
"styles/highlights.css": "styles/highlights.css?c308d0",
|
|
7
6
|
"styles/highlights.css.map": "styles/highlights.css.map?5be890",
|
|
8
7
|
"styles/katex.min.css": "styles/katex.min.css?ac2365",
|
|
9
8
|
"styles/katex.min.css.map": "styles/katex.min.css.map?4daef7",
|
|
10
9
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?ed2cb3",
|
|
11
10
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?13b830",
|
|
12
|
-
"
|
|
13
|
-
"styles/sidebar.css
|
|
11
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?0d185a",
|
|
12
|
+
"styles/sidebar.css": "styles/sidebar.css?a1796a",
|
|
13
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?b1ba58",
|
|
14
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?583d6c",
|
|
15
|
+
"styles/ui-playground.css": "styles/ui-playground.css?4b82d8",
|
|
14
16
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?2cbb43",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"scripts/
|
|
18
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a95e02",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?6dad8f"
|
|
17
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?577b12",
|
|
18
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?6c77bf",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?65b751"
|
|
20
20
|
}
|
|
@@ -45,8 +45,8 @@ this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),zt(t,"connect");
|
|
|
45
45
|
const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t);let n;function o(t){return e.hasOwnProperty(t)?e[t]:n.hasOwnProperty(t)?n[t]:void 0}return n=Gt(e.ignoreOtherConfiguration)?{}:Yt(t.document),{get annotations(){return Kt(n.annotations)||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return Zt(t,"hypothesis-client","javascript")},get group(){return Kt(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return Zt(t,"notebook","html")},get showHighlights(){return function(){const t=o("showHighlights");switch(t){case"always":case"never":case"whenSidebarOpen":return t;default:return"always";case!1:return"never"}}()},get sidebarAppUrl(){return Zt(t,"sidebar","html")},get query(){return Kt(n.query)||function(){
|
|
46
46
|
const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:o}}function Qt(t,e){return t.hostPageSetting(e)}const te={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:Qt},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:Qt},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentPartner:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:Gt,getValue:Qt
|
|
47
47
|
},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},services:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.notebookAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:Qt},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:Qt}};function ee(t="annotator",e=window){const n=Jt(e),o={};let i=function(t){const e={annotator:["clientUrl","contentPartner","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],
|
|
48
|
-
notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t);return i.forEach((t=>{const i=te[t],r=void 0!==i.defaultValue,s=!((a=Zt(e,"sidebar","html")).startsWith("http://")||a.startsWith("https://"));var a;if(!i.allowInBrowserExt&&s)return void(r&&(o[t]=i.defaultValue));const c=i.getValue(n,t);void 0!==c?o[t]=i.coerce?i.coerce(c):c:r&&(o[t]=i.defaultValue)})),o}const ne={alt:1,ctrl:2,meta:4,shift:8};function oe(t,e,{rootElement:n=document.
|
|
49
|
-
;return((t.ctrlKey?ne.ctrl:0)|(t.metaKey?ne.meta:0)|(t.altKey?ne.alt:0)|(t.shiftKey?ne.shift:0))===o&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===i})(n,t)&&e(n)};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)}function ie(t,e,{rootElement:n
|
|
48
|
+
notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"all":return[...e.annotator,...e.sidebar,...e.notebook];default:throw new Error(`Invalid application context used: "${t}"`)}}(t);return i.forEach((t=>{const i=te[t],r=void 0!==i.defaultValue,s=!((a=Zt(e,"sidebar","html")).startsWith("http://")||a.startsWith("https://"));var a;if(!i.allowInBrowserExt&&s)return void(r&&(o[t]=i.defaultValue));const c=i.getValue(n,t);void 0!==c?o[t]=i.coerce?i.coerce(c):c:r&&(o[t]=i.defaultValue)})),o}const ne={alt:1,ctrl:2,meta:4,shift:8};function oe(t,e,{rootElement:n=document.documentElement}={}){const o=n=>{(function(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let o=0,i=null;for(let t of n){const e=ne[t];if(e)o|=e;else{if(null!==i)throw new Error("Multiple non-modifier keys specified");i=t}}if(!i)throw new Error(`Invalid shortcut: ${e}`)
|
|
49
|
+
;return((t.ctrlKey?ne.ctrl:0)|(t.metaKey?ne.meta:0)|(t.altKey?ne.alt:0)|(t.shiftKey?ne.shift:0))===o&&function(t){const e={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",Spacebar:" ",Del:"Delete"};return e[t]?e[t]:t}(t.key).toLowerCase()===i})(n,t)&&e(n)};return n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)}function ie(t,e,{rootElement:n}={}){st((()=>{if(t)return oe(t,e,{rootElement:n})}),[t,e,n])}function re({badgeCount:t}){return mt("span",{className:Z("rounded px-1 py-0.5","text-color-text-inverted font-bold bg-grey-7","dim-bg"),children:t})}function se({arrowDirection:t}){return mt(Et,{name:"pointer",classes:Z("absolute left-1/2 -translate-x-1/2","h-auto w-auto z-2","text-grey-3 fill-white",{"rotate-180":"down"===t,"top-0 -translate-y-full":"up"===t})})}function ae({badgeCount:t,icon:e,label:n,onClick:o,shortcut:i}){ie(i,o);const r=i?`${n} (${i})`:n;return mt(xt,{
|
|
50
50
|
className:Z("flex flex-col gap-y-1 items-center py-2.5 px-2","text-annotator-sm leading-none text-grey-7","transition-colors duration-200","dim-item"),onClick:o,title:r,children:[e&&mt(Et,{classes:"text-annotator-lg",name:e,title:r}),"number"==typeof t&&mt(re,{badgeCount:t}),mt("span",{className:"font-normal",children:n})]})}function ce({arrowDirection:t,isVisible:e,onCommand:n,annotationCount:o=0}){const i=e?"a":null,r=e?"h":null,s=e?"s":null;return ie(e?"Escape":null,(()=>n("hide"))),mt("div",{className:Z("AdderToolbar","absolute select-none bg-white rounded shadow-adderToolbar","border border-solid border-grey-3","opacity-5",{"animate-adderPopUp":"up"===t&&e,"animate-adderPopDown":"down"===t&&e}),dir:"ltr",style:{visibility:e?"visible":"hidden"},children:[mt("div",{className:"flex dim-items-on-hover",children:[mt(ae,{icon:"annotate",onClick:()=>n("annotate"),label:"Annotate",shortcut:i}),mt(ae,{icon:"highlight",onClick:()=>n("highlight"),label:"Highlight",shortcut:r}),o>0&&mt(f,{children:[mt("div",{
|
|
51
51
|
className:Z("m-1.5 border-r border-grey-4 border-solid")}),mt(ae,{badgeCount:o,onClick:()=>n("show"),label:"Show",shortcut:s})]})]}),mt(se,{arrowDirection:t})]})}const le=(t=window)=>t.matchMedia("(pointer: coarse)").matches;function he(t){const e=t.attachShadow({mode:"open"});!function(t){var e;const n=null===(e=document.querySelector('link[rel="preload"][href*="/build/styles/annotator.css"]'))||void 0===e?void 0:e.href;if(!n)return;const o=document.createElement("link");o.rel="stylesheet",o.href=n,t.appendChild(o)}(e);const n=window.applyFocusVisiblePolyfill;var o;return n&&n(e),(o=e).addEventListener("mouseup",(t=>t.stopPropagation())),o.addEventListener("mousedown",(t=>t.stopPropagation())),o.addEventListener("touchstart",(t=>t.stopPropagation()),{passive:!0}),e}function ue(t){return t.toString()+"px"}class de{constructor(t,e){this._outerContainer=document.createElement("hypothesis-adder"),t.appendChild(this._outerContainer),this._shadowRoot=he(this._outerContainer),
|
|
52
52
|
Object.assign(this._outerContainer.style,{position:"absolute",top:0,left:0}),this._view=t.ownerDocument.defaultView,this._width=()=>this._shadowRoot.firstChild.getBoundingClientRect().width,this._height=()=>this._shadowRoot.firstChild.getBoundingClientRect().height,this._isVisible=!1,this._arrowDirection="up",this._onAnnotate=e.onAnnotate,this._onHighlight=e.onHighlight,this._onShowAnnotations=e.onShowAnnotations,this.annotationsForSelection=[],this._render()}hide(){this._isVisible=!1,this._render(),Object.assign(this._outerContainer.style,{top:0,left:0})}destroy(){M(null,this._shadowRoot),this._outerContainer.remove()}show(t,e){const{left:n,top:o,arrowDirection:i}=this._calculateTarget(t,e);this._showAt(n,o),this._isVisible=!0,this._arrowDirection=2===i?"up":"down",this._render()}_calculateTarget(t,e){let n,o,i;n=e&&!le()?1:2;const r=Math.min(20,t.width),s=this._width(),a=le()?10:0,c=this._height();return i=e?t.left-s/2+r:t.left+t.width-s/2-r,t.top-c<0&&1===n?n=2:t.top+c>this._view.innerHeight&&(n=1),
|
|
@@ -104,7 +104,7 @@ cancelable:!0,detail:n});this.element.dispatchEvent(o)&&this._integration.scroll
|
|
|
104
104
|
this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const o=await this._integration.anchor(this.element,e.selector),i=_e.fromRange(o);n={annotation:t,target:e,range:i}}catch(o){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(let t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(let e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&Ae(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[]
|
|
105
105
|
;const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Pt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Po(),r}_focusAnnotations(t){this._focusedAnnotations.clear(),t.forEach((t=>this._focusedAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ke(e.highlights,n)}this._sidebarRPC.call("focusAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,o=0;for(let r of t){var i;if(null===(i=r.highlights)||void 0===i||!i.length)continue;const t=Re(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>o||"down"===e&&t<o)&&(n=r,o=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){
|
|
106
106
|
if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=we(e),o=xe(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Ao(),this._isAdderVisible=!0,this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,e=!1){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function Mo(t,e){
|
|
107
|
-
const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function No(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.
|
|
107
|
+
const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function No(t,e){var n;const o={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(o[t]=n);o.origin=new URL(t).origin,o.version="1.1022.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),Array.isArray(o.services)&&(null===(n=o.services)||void 0===n?void 0:n.length)>0){const t=o.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return o}function Oo({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Mo(t.notebookAppUrl,{...No(t.notebookAppUrl,t),group:e})})}function Io({eventBus:t,config:e}){
|
|
108
108
|
const[n,o]=rt(0),[i,r]=rt(!0),[s,a]=rt(null),c=ct(""),l=ct(null);st((()=>(c.current=document.body.style.overflow,()=>{document.body.style.overflow=c.current})),[]),st((()=>{document.body.style.overflow=i?c.current:"hidden"}),[i]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),l.current=e,()=>{e.destroy()}}),[t]);return null===s?null:mt("div",{className:Z("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:i}),"data-testid":"notebook-outer",children:mt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[mt("div",{className:"absolute right-0 text-xl m-3",children:mt(Ct,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=l.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),mt(Oo,{config:e,groupId:s},n)]})})}class Do{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),
|
|
109
109
|
this.shadowRoot=he(this._outerContainer),M(mt(Io,{eventBus:e,config:n}),this.shadowRoot)}destroy(){M(null,this.shadowRoot),this._outerContainer.remove()}}var Bo={exports:{}};!function(t){!function(e,n,o,i){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),c=Math.round,l=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var o;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(o=0;o<t.length;)e.call(n,t[o],o,t),o++;else for(o in t)t.hasOwnProperty(o)&&e.call(n,t[o],o,t)}function p(t,n,o){var i="DEPRECATED METHOD: "+n+"\n"+o+" AT \n";return function(){var n=new Error("get-stack-trace"),o=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,i,o),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){
|
|
110
110
|
if(t===i||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(o!==i&&null!==o)for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var o=Object.keys(e),r=0;r<o.length;)(!n||n&&t[o[r]]===i)&&(t[o[r]]=e[o[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function _(t,e,n){var o,i=e.prototype;(o=t.prototype=Object.create(i)).constructor=t,o._super=i,n&&r(o,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){return"function"==typeof t?t.apply(e&&e[0]||i,e):t}function w(t,e){return t===i?e:t}function b(t,e,n){f(E(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(E(e),(function(e){t.removeEventListener(e,n,!1)}))}function x(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function S(t,e){return t.indexOf(e)>-1}function E(t){return t.trim().split(/\s+/g)}
|