hypothesis 1.1150.0 → 1.1152.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?151c40","styles/annotator.css":"styles/annotator.css?c10c10","styles/highlights.css":"styles/highlights.css?1f4e8c","styles/highlights.css.map":"styles/highlights.css.map?dffcfd","styles/annotator.css.map":"styles/annotator.css.map?02fa76","styles/katex.min.css":"styles/katex.min.css?776307","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?95c934","styles/sidebar.css.map":"styles/sidebar.css.map?84a574","styles/ui-playground.css":"styles/ui-playground.css?becd14","styles/ui-playground.css.map":"styles/ui-playground.css.map?dbeded","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3b0574","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?a069a8","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?14e7d4","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?9e7ded","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?828b5d"};if(function(){var s=[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 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.1150.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/.")}();
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?7cdcc2","styles/annotator.css":"styles/annotator.css?c10c10","styles/annotator.css.map":"styles/annotator.css.map?02fa76","styles/highlights.css":"styles/highlights.css?1f4e8c","styles/highlights.css.map":"styles/highlights.css.map?dffcfd","styles/katex.min.css":"styles/katex.min.css?776307","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?95c934","styles/sidebar.css.map":"styles/sidebar.css.map?84a574","styles/ui-playground.css":"styles/ui-playground.css?becd14","styles/ui-playground.css.map":"styles/ui-playground.css.map?dbeded","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?141757","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?aa38a3","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?14e7d4","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?9e7ded","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?159386"};if(function(){var s=[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 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.1152.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/.")}();
@@ -1,9 +1,9 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?151c40",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?7cdcc2",
3
3
  "styles/annotator.css": "styles/annotator.css?c10c10",
4
+ "styles/annotator.css.map": "styles/annotator.css.map?02fa76",
4
5
  "styles/highlights.css": "styles/highlights.css?1f4e8c",
5
6
  "styles/highlights.css.map": "styles/highlights.css.map?dffcfd",
6
- "styles/annotator.css.map": "styles/annotator.css.map?02fa76",
7
7
  "styles/katex.min.css": "styles/katex.min.css?776307",
8
8
  "styles/katex.min.css.map": "styles/katex.min.css.map?42d80c",
9
9
  "styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
@@ -12,9 +12,9 @@
12
12
  "styles/sidebar.css.map": "styles/sidebar.css.map?84a574",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?becd14",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?dbeded",
15
- "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?3b0574",
16
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a069a8",
15
+ "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?141757",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?aa38a3",
17
17
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?14e7d4",
18
18
  "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?9e7ded",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?828b5d"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?159386"
20
20
  }
@@ -58,8 +58,8 @@ arrowDirection:this._arrowDirection,onCommand:t=>{switch(t){case"annotate":this.
58
58
  ;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+=Pe(e),e=e.parentElement;return new Oe(e,n)}resolve(t={}){try{return Me(this.element,this.offset)[0]}catch(e){if(0===this.offset&&void 0!==t.direction){const n=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);n.currentNode=this.element;const i=1===t.direction,o=i?n.nextNode():n.previousNode();if(!o)throw e;return{node:o,offset:i?0:o.data.length}}throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return Oe.fromPoint(t,e);case Node.ELEMENT_NODE:return new Oe(t,e);default:throw new Error("Node is not an element or text node")}}static fromPoint(t,e){switch(t.nodeType){case Node.TEXT_NODE:{if(e<0||e>t.data.length)throw new Error("Text node offset is out of range");if(!t.parentElement)throw new Error("Text node has no parent");const n=Pe(t)+e;return new Oe(t.parentElement,n)}
59
59
  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+=Le(t.childNodes[i]);return new Oe(t,n)}default:throw new Error("Point is not in an element or text node")}}}class Ie{constructor(t,e){this.start=t,this.end=e}relativeTo(t){return new Ie(this.start.relativeTo(t),this.end.relativeTo(t))}toRange(){let t,e;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[t,e]=Me(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:1}),e=this.end.resolve({direction:2}));const n=new Range;return n.setStart(t.node,t.offset),n.setEnd(e.node,e.offset),n}static fromRange(t){const e=Oe.fromPoint(t.startContainer,t.startOffset),n=Oe.fromPoint(t.endContainer,t.endOffset);return new Ie(e,n)}static fromOffsets(t,e,n){return new Ie(new Oe(t,e),new Oe(t,n))}}const Be=".annotator-placeholder";function Fe(t){return!!t.parentElement&&null!==t.parentElement.closest(Be)}function He(t){
60
60
  if(t.focusNode===t.anchorNode)return t.focusOffset<t.anchorOffset;return t.getRangeAt(0).startContainer===t.focusNode}function De(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 Ve(t,e){const n=t.commonAncestorContainer,i=n.ownerDocument.createNodeIterator(n,NodeFilter.SHOW_ALL);let o;for(;o=i.nextNode();)De(t,o)&&e(o)}function qe(t){if(t.isCollapsed)return null;const e=function(t){const e=/^\s*$/,n=[];Ve(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:He(t)?e[0]:e[e.length-1]}const Ue="http://www.w3.org/2000/svg"
61
- ;function ze(t,e){const n=function(t){if(t.collapsed)return[];let e=t.commonAncestorContainer;if(e.nodeType!==Node.ELEMENT_NODE&&(e=e.parentElement),!e)return[];const n=[],i=e.ownerDocument.createNodeIterator(e,NodeFilter.SHOW_TEXT);let o;for(;o=i.nextNode();){if(!De(t,o))continue;let e=o;e===t.startContainer&&t.startOffset>0?e.splitText(t.startOffset):(e===t.endContainer&&t.endOffset<e.data.length&&e.splitText(t.endOffset),n.push(e))}return n}(t),i=n.length>0&&Fe(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=c("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])
62
- ;if(!n||!n.parentElement)return;let i=n.parentElement.querySelector(".hypothesis-highlight-layer");if(!i){i=document.createElementNS(Ue,"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(Ue,"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",c("hypothesis-svg-highlight",e)),t.classList.add("is-transparent"),t.svgHighlight=i,i}));i.append(...r)}(l,e),l}function $e(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function We(t){for(let e of t){if(e.parentNode){$e(e,Array.from(e.childNodes))}
61
+ ;function ze(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(!De(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&&Fe(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=c("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])
62
+ ;if(!n||!n.parentElement)return;let i=n.parentElement.querySelector(".hypothesis-highlight-layer");if(!i){i=document.createElementNS(Ue,"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(Ue,"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",c("hypothesis-svg-highlight",e)),t.classList.add("is-transparent"),t.svgHighlight=i,i}));i.append(...r)}(l,e),l}function $e(t,e){const n=t.parentNode;e.forEach((e=>n.insertBefore(e,t))),t.remove()}function We(t){for(const e of t){if(e.parentNode){$e(e,Array.from(e.childNodes))}
63
63
  e.svgHighlight&&e.svgHighlight.remove()}}function je(t,e){t.forEach((t=>{if(t.svgHighlight){if(t.svgHighlight.classList.toggle("is-focused",e),e){t.svgHighlight.parentNode.append(t.svgHighlight)}}else t.classList.toggle("hypothesis-highlight-focused",e)}))}function Xe(t){const e=t.map((t=>t.getBoundingClientRect()));return e.reduce(((t,e)=>({top:Math.min(t.top,e.top),left:Math.min(t.left,e.left),bottom:Math.max(t.bottom,e.bottom),right:Math.max(t.right,e.right)})))}class Ye{constructor({contentContainer:t,hostRPC:e}){this._hostRPC=e,this._updatePending=!1,this._anchors=[],this._listeners=new Ct,this._listeners.add(window,"resize",(()=>this.update())),this._listeners.add(window,"scroll",(()=>this.update())),this._listeners.add(t,"scroll",(()=>this.update()))}destroy(){this._listeners.removeAll()}update(t){t&&(this._anchors=t),this._updatePending||(this._updatePending=!0,requestAnimationFrame((()=>{const t=function(t){const e=[];return t.forEach((({annotation:t,highlights:n})=>{if(null==n||!n.length)return
64
64
  ;const{top:i,bottom:o}=Xe(n);i>=o||e.push({tag:t.$tag,top:i,bottom:o})})),e.sort(((t,e)=>t.top-e.top)),e}(this._anchors);this._hostRPC.call("anchorsChanged",t),this._updatePending=!1})))}}function Ze({cluster:t,label:e,onChange:n,currentStyles:i,highlightStyles:o}){const r=i[t],s="hidden"===r;return ct("div",{className:"space-y-2",children:[ct("div",{className:"flex items-center gap-x-2 text-annotator-base",children:ct("div",{className:"grow text-color-text px-2 py-1 rounded",style:{backgroundColor:o[r].color},children:e})}),ct("div",{className:"flex items-center gap-x-2",children:Object.keys(o).map((e=>ct("div",{className:"relative",children:[ct("input",{className:c("absolute w-6 h-6","opacity-[.00001]","cursor-pointer"),name:t,id:`hypothesis-${t}-${e}`,checked:r===e,onChange:n,type:"radio",value:e}),ct("label",{className:"block",htmlFor:`${t}-${e}`,children:[ct("div",{style:{backgroundColor:o[e].color,textDecoration:o[e].decoration},className:c("block w-6 h-6 rounded-full flex items-center justify-center",{
65
65
  "border-2 border-slate-0":r!==e,"border-2 border-slate-3":r===e}),children:"hidden"===e&&ct(le,{className:c("w-3 h-3",{"text-slate-3":!s,"text-slate-7":s})})}),ct("span",{className:"sr-only",children:e})]})]},`${t}-${e}`)))})]})}function Ge({active:t,availableStyles:e,currentStyles:n,onStyleChange:i}){const o=function(t,e){return q=8,tt((function(){return t}),e)}((t=>{const e=t.target,n=e.name,o=e.value;i(n,o)}),[i]),[r,s]=G(!1);return t?ct(ve,{children:ct("div",{className:"flex flex-col text-annotator-base text-color-text",children:[ct(_e,{"data-testid":"control-toggle-button",onClick:()=>s(!r),title:r?"Hide highlight settings":"Show highlight settings",children:ct(m,r?{children:[ct(ne,{}),ct("span",{children:"Highlight Appearance"})]}:{children:[ct(se,{}),ct(he,{})]})}),r&&ct(ye,{"data-testid":"cluster-style-controls",size:"sm",children:[ct(Ze,{highlightStyles:e,label:"My annotations",cluster:"user-annotations",onChange:o,currentStyles:n}),ct(Ze,{highlightStyles:e,label:"My highlights",
@@ -119,7 +119,7 @@ persistent:null!==(n=null===(i=(o=this._integration).persistFrame)||void 0===i?v
119
119
  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=Ie.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&&We(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=[]
120
120
  ;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:"+St(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),lo(),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);je(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;const t=Xe(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){
121
121
  if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=He(e),i=qe(e);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=ro(),this._isAdderVisible=!0,this._adder.show(i,n)):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){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)}
122
- get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Kt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function ho(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function uo(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.1150.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];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 fo({config:t,groupId:e}){return ct("iframe",{
122
+ get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Kt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function ho(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function uo(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.1152.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];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 fo({config:t,groupId:e}){return ct("iframe",{
123
123
  title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:ho(t.notebookAppUrl,{...uo(t.notebookAppUrl,t),group:e})})}function po({eventBus:t,config:e}){const[n,i]=G(0),[o,r]=G(!0),[s,a]=G(null),l=J(""),h=J(null);K((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),K((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),K((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),h.current=e,()=>{e.destroy()}}),[t]);return null===s?null:ct("div",{className:c("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:ct("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[ct("div",{className:"absolute right-0 text-xl m-3",children:ct(gt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=h.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),ct(fo,{config:e,
124
124
  groupId:s},n)]})})}class go{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=Ae(this._outerContainer),I(ct(po,{eventBus:e,config:n}),this.shadowRoot)}destroy(){I(null,this.shadowRoot),this._outerContainer.remove()}}var mo={exports:{}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){
125
125
  var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[r]]),r++;return t}),"extend","Use `assign`."),m=p((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function _(t,e,n){var i,o=e.prototype;(i=t.prototype=Object.create(o)).constructor=t,i._super=o,n&&r(i,n)}function v(t,e){return function(){return t.apply(e,arguments)}}function y(t,e){