hypothesis 1.972.0 → 1.973.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 +10 -10
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/sidebar.bundle.js +29 -29
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css +32 -1
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +32 -1
- package/build/styles/sidebar.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 s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(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 r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function f(t){return function(t){return t.filter((function(t){var e=s[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 h(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?h(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 s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function t(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function e(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return s.every((function(e){return"function"==typeof t[e]}))}var s={es2017:function(){return!e(Object,"entries","values")},es2018:function(){return"function"!=typeof Promise||!e(Promise.prototype,"finally")}};function n(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return r(t,e)}(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 r(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}var o=["es2017","es2018"];function a(t){t.setAttribute("data-hypothesis-asset","")}function i(t,e){var s=t.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=e,a(s),t.head.appendChild(s)}function c(t,e){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.createElement("script");n.type="module",s&&(e+="#ts=".concat(Date.now())),n.src=e,n.async=!1,a(n),t.head.appendChild(n)}function l(t,e,s,n){var r=t.createElement("link");r.rel=e,r.href=n,r.type="application/annotator+".concat(s),a(r),t.head.appendChild(r)}function u(t,e,s){var n=t.createElement("link");n.rel="preload",n.as=e,n.href=s,"fetch"===e&&(n.crossOrigin="anonymous"),a(n),t.head.appendChild(n)}function p(t,e){return t.assetRoot+"build/"+t.manifest[e]}function d(t,e,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.forceModuleReload;s.forEach((function(s){var n=p(e,s);n.match(/\.css/)?i(t,n):c(t,n,r)}))}function f(t){return function(t){return t.filter((function(t){var e=s[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 h(t){var e=t.match(/(https?):\/\/([^:/]+)/);return e?{protocol:e[1],hostname:e[2]}:null}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=t.currentScript;return e?h(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 s=y(e);if(!s)throw new Error("Could not process URL template because script origin is unknown");return t=(t=t.replace("{current_host}",s.hostname)).replace("{current_scheme}",s.protocol)}var b={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?101ff9","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?31366a","styles/annotator.css":"styles/annotator.css?843c20","styles/annotator.css.map":"styles/annotator.css.map?c8baf6","styles/highlights.css":"styles/highlights.css?c308d0","styles/highlights.css.map":"styles/highlights.css.map?5be890","styles/katex.min.css":"styles/katex.min.css?28919c","styles/katex.min.css.map":"styles/katex.min.css.map?4daef7","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?dd8179","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?bf5f6c","styles/sidebar.css":"styles/sidebar.css?86da34","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?ee2fe0","styles/sidebar.css.map":"styles/sidebar.css.map?ee04eb","styles/ui-playground.css.map":"styles/ui-playground.css.map?e9a64c","styles/ui-playground.css":"styles/ui-playground.css?9af4ea","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?a40da3","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?aadf45","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?0e2b7e"};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 v=function(e){for(var s={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}t(s,o)}return s}(document),g=m(v.assetRoot||"https://cdn.hypothes.is/hypothesis/1.973.0/");if(document.querySelector("hypothesis-app"))!function(t,e){u(t,"fetch",e.apiUrl),u(t,"fetch",e.apiUrl+"links");var s=f(o);d(t,e,[].concat(n(s),["scripts/sidebar.bundle.js","styles/katex.min.css","styles/sidebar.css"]))}(document,{assetRoot:g,manifest:b,apiUrl:v.apiUrl});else{var j=m(v.notebookAppUrl||"https://hypothes.is/notebook"),w=m(v.sidebarAppUrl||"https://hypothes.is/app.html");!function(t,e){if(!t.querySelector('link[type="application/annotator+html"]')){l(t,"sidebar","html",e.sidebarAppUrl),l(t,"notebook","html",e.notebookAppUrl),u(t,"style",p(e,"styles/annotator.css")),l(t,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");var s=f(o);d(t,e,[].concat(n(s),["scripts/annotator.bundle.js","styles/highlights.css","styles/pdfjs-overrides.css"]),{forceModuleReload:!0})}}(document,{assetRoot:g,manifest:b,notebookAppUrl:j,sidebarAppUrl:w})}}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
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?101ff9",
|
|
3
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?31366a",
|
|
4
|
+
"styles/annotator.css": "styles/annotator.css?843c20",
|
|
5
|
+
"styles/annotator.css.map": "styles/annotator.css.map?c8baf6",
|
|
5
6
|
"styles/highlights.css": "styles/highlights.css?c308d0",
|
|
6
7
|
"styles/highlights.css.map": "styles/highlights.css.map?5be890",
|
|
7
8
|
"styles/katex.min.css": "styles/katex.min.css?28919c",
|
|
8
|
-
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?31366a",
|
|
9
9
|
"styles/katex.min.css.map": "styles/katex.min.css.map?4daef7",
|
|
10
10
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?dd8179",
|
|
11
11
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?bf5f6c",
|
|
12
|
-
"styles/sidebar.css": "styles/sidebar.css?
|
|
13
|
-
"styles/sidebar.css.map": "styles/sidebar.css.map?a1e078",
|
|
14
|
-
"styles/ui-playground.css": "styles/ui-playground.css?9af4ea",
|
|
15
|
-
"styles/ui-playground.css.map": "styles/ui-playground.css.map?e9a64c",
|
|
12
|
+
"styles/sidebar.css": "styles/sidebar.css?86da34",
|
|
16
13
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?ee2fe0",
|
|
14
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?ee04eb",
|
|
15
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?e9a64c",
|
|
16
|
+
"styles/ui-playground.css": "styles/ui-playground.css?9af4ea",
|
|
17
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?a40da3",
|
|
18
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
18
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?aadf45",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?0e2b7e"
|
|
20
20
|
}
|
|
@@ -95,7 +95,7 @@ const{target:e,metaKey:n,ctrlKey:o}=t,i=Zn(e);if(i.length&&this._highlightsVisib
|
|
|
95
95
|
;const n=me(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._focusedAnnotations.has(t.annotation.$tag)&&ye(n,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const o=await this._integration.anchor(this.element,e.selector),i=ce.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&&ve(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;(this.anchors=t,
|
|
96
96
|
e)&&(null===(n=this._bucketBarClient)||void 0===n||n.update())}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(e.map((t=>this._integration.describe(o,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:t,$tag:"a:"+Gt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Jn(),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);ye(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=we(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
|
|
97
97
|
}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=de(e),o=ge(e);o?(this.selectedRanges=[t],this._hostRPC.call("textSelectedIn",this._frameIdentifier),this._adder.annotationsForSelection=Gn(),this._isAdderVisible=!0,this._adder.show(o,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselectedIn",this._frameIdentifier),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){
|
|
98
|
-
this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function to(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function eo(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.
|
|
98
|
+
this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get focusedAnnotationTags(){return this._focusedAnnotations}}function to(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function eo(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.973.0";const i=new URL(window.location.href);if(i.hash="",o.hostURL=i.toString(),(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 no({config:t,groupId:e}){return mt("iframe",{title:"Hypothesis annotation notebook",className:"NotebookIframe",
|
|
99
99
|
allowFullScreen:!0,src:to(t.notebookAppUrl,{...eo(t.notebookAppUrl,t),group:e})})}function oo({eventBus:t,config:e}){const[n,o]=rt(0),[i,r]=rt(!0),[s,a]=rt(null),l=lt(""),c=lt(null);st((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),st((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),st((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:mt("div",{className:Z("NotebookModal__outer",{"is-hidden":i}),children:mt("div",{className:"NotebookModal__inner",children:[mt("div",{className:"NotebookModal__close-button-container",children:mt(Ct,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),mt(no,{config:e,groupId:s},n)]})})}class io{constructor(t,e,n={}){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),
|
|
100
100
|
this.shadowRoot=ne(this._outerContainer),L(mt(oo,{eventBus:e,config:n}),this.shadowRoot)}destroy(){L(null,this.shadowRoot),this._outerContainer.remove()}}var ro={exports:{}};!function(t){!function(e,n,o,i){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 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){
|
|
101
101
|
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(x(e),(function(e){t.addEventListener(e,n,!1)}))}function C(t,e,n){f(x(e),(function(e){t.removeEventListener(e,n,!1)}))}function E(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function S(t,e){return t.indexOf(e)>-1}function x(t){return t.trim().split(/\s+/g)}
|
|
@@ -157,7 +157,7 @@ this._listeners.forEach((({eventTarget:e,eventType:t,listener:n})=>{e.removeEven
|
|
|
157
157
|
t.setSelectionRange(0,t.value.length),document.execCommand("copy")}finally{t.remove()}}function wa({label:e,iconName:t,uri:n}){return po("li",{className:"ShareLinks__link",children:po("a",{"aria-label":e,href:n,title:e,target:"_blank",rel:"noopener noreferrer",children:po(Mo,{name:t,classes:"ShareLinks__icon"})})})}function xa({shareURI:e}){const t=encodeURIComponent(e);return po("ul",{className:"ShareLinks",children:[po(wa,{iconName:"twitter",label:"Tweet share link",uri:`https://twitter.com/intent/tweet?url=${t}&hashtags=annotated`}),po(wa,{iconName:"facebook",label:"Share on Facebook",uri:`https://www.facebook.com/sharer/sharer.php?u=${t}`}),po(wa,{iconName:"email",label:"Share via email",uri:`mailto:?subject=${encodeURIComponent("Let's Annotate")}&body=${t}`})]})}function ka(){return((e=window.navigator,t="ontouchend"in document)=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e.platform)||e.userAgent.includes("Mac")&&t)()}
|
|
158
158
|
var Sa=ri((function({annotation:e,toastMessenger:t,group:n,shareUri:r}){const o=_a(e.permissions),i=ma(e.uri),a=to(null),s=to(null),[l,c]=Zr(!1),u=to(l);if(Ro(a,l,(()=>c(!1))),Qr((()=>{var e,t;u.current!==l&&(u.current=l,l&&!ka()&&(null===(e=s.current)||void 0===e||e.focus(),null===(t=s.current)||void 0===t||t.select()))}),[l]),!n)return null;const h=i,d="private"===n.type?po("span",{children:["Only members of the group ",po("em",{children:n.name})," may view this annotation."]}):po("span",{children:"Anyone using this link may view this annotation."}),p=o?po("span",{children:"Only you may view this annotation."}):d;return po("div",{className:"AnnotationShareControl",ref:a,children:[po(_o,{icon:"share",title:"Share",onClick:()=>c(!l),expanded:l}),l&&po("div",{className:"annotation-share-panel",children:[po("div",{className:"annotation-share-panel__header",children:po("div",{className:"annotation-share-panel__title",children:"Share this annotation"})}),po("div",{className:"annotation-share-panel__content",
|
|
159
159
|
children:[po("div",{className:"hyp-u-layout-row annotation-share-panel__inputs",children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share this annotation",type:"text",value:r,readOnly:!0,inputRef:s}),po(_o,{icon:"copy",title:"Copy share link to clipboard",onClick:()=>{try{ba(r),t.success("Copied share link to clipboard")}catch(e){t.error("Unable to copy link")}},variant:"dark"})]})}),po("div",i?{className:"annotation-share-panel__details",children:p}:{className:"annotation-share-panel__details",children:"This annotation cannot be shared in its original context because it was made on a document that is not available on the web. This link shares the annotation by itself."}),h&&po(xa,{shareURI:r})]}),po(Mo,{name:"pointer",classes:"annotation-share-panel__arrow"})]})]})}),["toastMessenger"]);var Ca=ri((function({annotation:e,annotationsService:t,onReply:n,settings:r,toastMessenger:o}){const i=ii(),a=i.profile(),s=i.getGroup(e.group),l=i.isLoggedIn(),c=t=>function(e,t,n){return-1!==e[t].indexOf(n||"")
|
|
160
|
-
}(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=P(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=P(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return ma(e.uri)?null!==(t=null!==(n=null===(r=e.links)||void 0===r?void 0:r.incontext)&&void 0!==n?n:null===(o=e.links)||void 0===o?void 0:o.html)&&void 0!==t?t:null:null!==(i=null===(a=e.links)||void 0===a?void 0:a.html)&&void 0!==i?i:null}(e);return po("div",{className:"AnnotationActionBar hyp-u-layout-row
|
|
160
|
+
}(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=P(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=P(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return ma(e.uri)?null!==(t=null!==(n=null===(r=e.links)||void 0===r?void 0:r.incontext)&&void 0!==n?n:null===(o=e.links)||void 0===o?void 0:o.html)&&void 0!==t?t:null:null!==(i=null===(a=e.links)||void 0===a?void 0:a.html)&&void 0!==i?i:null}(e);return po("div",{className:"AnnotationActionBar hyp-u-layout-row text-xl font-medium",children:[h&&po(_o,{icon:"edit",title:"Edit",onClick:()=>{i.createDraft(e,{tags:e.tags,text:e.text,isPrivate:_a(e.permissions)})}}),u&&po(_o,{icon:"trash",title:"Delete",onClick:async()=>{if(await Xo({title:"Delete annotation?",message:"Are you sure you want to delete this annotation?",confirmAction:"Delete"}))try{await t.delete(e)}catch(e){o.error(e.message)}}}),po(_o,{icon:"reply",title:"Reply",onClick:()=>{
|
|
161
161
|
l?n():i.openSidebarPanel("loginPrompt")}}),p&&po(Sa,{annotation:e,group:s,shareUri:p}),d&&!e.flagged&&po(_o,{icon:"flag",title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&po(_o,{pressed:!0,icon:"flag--active",title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function Aa({isCollapsed:e,setCollapsed:t,linkStyle:n={}}){return po("div",{className:"Excerpt__inline-controls",children:po("div",{className:"Excerpt__toggle-container",children:po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:()=>t(!e),expanded:!e,title:"Toggle visibility of full excerpt text",style:n,variant:"dark",children:e?"More":"Less"})})})}const Ea=()=>{};var Ta=ri((function({children:e,collapse:t=!1,collapsedHeight:n,inlineControls:r=!0,onCollapsibleChanged:o=Ea,onToggleCollapsed:i=Ea,overflowThreshold:a=0,settings:s={}}){const[l,c]=Zr(!0),u=to(),[h,d]=Zr(0),p=ro((()=>{
|
|
162
162
|
const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);eo((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new ha;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return po("div",{className:"Excerpt",style:g,children:[po("div",{className:"Excerpt__content",ref:u,children:e}),po("div",{role:"presentation",onClick:()=>v(!1),className:Ur({Excerpt__shadow:!0,"Excerpt__shadow--transparent":r,"is-hidden":!f}),title:"Show the full excerpt"}),m&&r&&po(Aa,{isCollapsed:l,setCollapsed:v,
|
|
163
163
|
linkStyle:ti(["selectionFontFamily"],s)})]})}),["settings"]);function Na(e,t=16/9){const n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";const n=document.createElement("div");return n.style.paddingBottom=1/t*100+"%",n.style.position="relative",n.appendChild(e),n}(n,t)}function La(e){const t=/(\d+)([hms]?)/g,n={h:3600,m:60,s:1};let r,o=0;for(;null!==(r=t.exec(e));)r[2]?o+=Number(r[1])*n[r[2]]:o+=+r[1];return o.toString()}function Ma(e,t){const n=function(e){const t=["end","start","t"],n=new URLSearchParams(e.search),r=new URLSearchParams;for(let[e,o]of n)t.includes(e)&&("t"===e?r.append("start",La(o)):r.append(e,o));r.sort();let o=r.toString();return o&&(o=`?${o}`),o}(t);return Na(`https://www.youtube.com/embed/${e}${n}`)}function za(e,t,n,{aspectRatio:r}={}){return o=>{if(o.hostname!==e)return null
|
|
@@ -518,57 +518,57 @@ const r=no((()=>e?yd(e):""),[e]),o=to();Qr((()=>{!function(e,{className:t}={}){c
|
|
|
518
518
|
;var wd=ri((function({annotation:e,settings:t}){var n,r;const[o,i]=Zr(!0),[a,s]=Zr(!1),l=ii().getDraft(e),c=o?"More":"Less",u=null!==(n=null==l?void 0:l.tags)&&void 0!==n?n:e.tags,h=null!==(r=null==l?void 0:l.text)&&void 0!==r?r:e.text,d=h.length>0,p=u.length>0,m=ti(["annotationFontFamily"],t);return po("div",{className:"hyp-u-vertical-spacing--2",children:[d&&po(Ta,{collapse:o,collapsedHeight:400,inlineControls:!1,onCollapsibleChanged:s,onToggleCollapsed:i,overflowThreshold:20,children:po(_d,{textStyle:m,markdown:h,textClass:{AnnotationBody__text:!0,"p-redacted-content":Ti(e)}})}),a&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{expanded:!o,onClick:()=>i(!o),title:`Toggle visibility of full annotation text: Show ${c}`,children:c})}),p&&po(bd,{annotation:e,tags:u})]})}),["settings"]);const xd=0,kd=1;function Sd(e,t,n,r){let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,
|
|
519
519
|
i+=r.length-n):i<=t||(o<=t&&i>=t+n?i+=r.length-n:o<t&&i<t+n?o=t:o<t+n&&i>t+n?i+=r.length-n:t<o&&t+n>i&&(o=t,i=t+n)),{text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Cd(e,t=xd){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===kd&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Sd(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://insert-your-link-here.com";return r=Sd(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Ad(e,t,n,r){void 0===n&&(n=t);const o=e.text.slice(e.selectionStart-t.length,e.selectionStart),i=e.text.slice(e.selectionEnd,e.selectionEnd+t.length);let a=e;return e.selectionStart===e.selectionEnd&&r&&(a=Sd(e,e.selectionStart,0,r),a.selectionStart=a.selectionEnd-r.length),
|
|
520
520
|
o===t&&i===n?(a=Sd(a,a.selectionStart-t.length,t.length,""),a=Sd(a,a.selectionEnd,n.length,"")):(a=Sd(a,a.selectionStart,0,t),a=Sd(a,a.selectionEnd,0,n)),a}function Ed(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Td(e,t,n,r){let o=function(e,t){const n=e.lastIndexOf("\n",t);return n<0?0:n+1}(e.text,t),i=Ed(e.text,t);for(;i<=Ed(e.text,n);){const t=i===e.text.length,a=i-o,s=Ed((e=r(e,o,i)).text,o)-o;if(n+=s-a,t)break;o=o+s+1,i=Ed(e.text,o)}return e}function Nd(e,t){const n=e.selectionStart,r=e.selectionEnd;let o=!0;return Td(e,n,r,((e,n)=>(e.text.slice(n,n+t.length)!==t&&(o=!1),e))),Td(e,n,r,o?(e,n)=>Sd(e,n,t.length,""):(e,n)=>e.text.slice(n,n+t.length)===t?e:Sd(e,n,0,t))}const Ld={bold:"b",italic:"i",link:"l",quote:"q",image:"g",numlist:"o",list:"u"};function Md({buttonRef:e,disabled:t=!1,iconName:n="",label:r,onClick:o,shortcutKey:i,tabIndex:a,title:s=""}){const l=no((()=>((e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0)()?"Cmd":"Ctrl"),[]);let c=s;i&&(c+=` (${l}-${i.toUpperCase()})`)
|
|
521
|
-
;const u={buttonRef:e,disabled:t,icon:n,onClick:o,tabIndex:a,title:c};return r?po(bo,{classes:"
|
|
522
|
-
|
|
523
|
-
className:"hyp-u-layout-row--center",children:po(zo,{href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",classes:"
|
|
524
|
-
n((e=>Ad(e,"*","*","Italic")));break;case"quote":n((e=>Nd(e,"> ")));break;case"link":n((e=>Cd(e)));break;case"image":n((e=>Cd(e,kd)));break;case"math":n(r);break;case"numlist":n((e=>Nd(e,"1. ")));break;case"list":n((e=>Nd(e,"* ")));break;default:throw new Error(`Unknown toolbar command "${e}"`)}}(e,a.current),t({text:a.current.value}))};return po("div",{className:"
|
|
521
|
+
;const u={buttonRef:e,disabled:t,icon:n,onClick:o,tabIndex:a,title:c};return r?po(bo,{classes:"font-normal TransparentButton",...u,children:r}):po(_o,{classes:"MarkdownEditor__toolbar-button",...u})}function zd({isPreviewing:e,onCommand:t,onTogglePreview:n}){const r=0,o=1,i=2,a=3,s=4,l=5,c=6,u=7,h=8,d=9,p=10,[m,f]=Zr(0),g=to([]).current;if(0===g.length)for(let e=0;e<=p;e++)g.push({current:null});const v=e=>m===e?0:-1;return po("div",{className:"hyp-u-layout-row hyp-u-border--left hyp-u-border--right hyp-u-border--top hyp-u-bg-color--white MarkdownEditor__toolbar",role:"toolbar","aria-label":"Markdown editor toolbar",onKeyDown:t=>{let n=0;const r=p-1;e&&(n=h);let o=null;switch(Oo(t.key)){case"ArrowLeft":o=m<=n?r:m-1;break;case"ArrowRight":o=m>=r?n:m+1;break;case"Home":o=n;break;case"End":o=r}var i;null!==o&&(f(i=o),g[i].current.focus(),t.preventDefault())},children:[po(Md,{disabled:e,iconName:"format-bold",onClick:()=>t("bold"),shortcutKey:Ld.bold,buttonRef:g[r],tabIndex:v(r),title:"Bold"}),po(Md,{disabled:e,
|
|
522
|
+
iconName:"format-italic",onClick:()=>t("italic"),shortcutKey:Ld.italic,buttonRef:g[o],tabIndex:v(o),title:"Italic"}),po(Md,{disabled:e,iconName:"format-quote",onClick:()=>t("quote"),shortcutKey:Ld.quote,buttonRef:g[i],tabIndex:v(i),title:"Quote"}),po(Md,{disabled:e,iconName:"link",onClick:()=>t("link"),shortcutKey:Ld.link,buttonRef:g[a],tabIndex:v(a),title:"Insert link"}),po(Md,{disabled:e,iconName:"image",onClick:()=>t("image"),shortcutKey:Ld.image,buttonRef:g[s],tabIndex:v(s),title:"Insert image"}),po(Md,{disabled:e,iconName:"format-functions",onClick:()=>t("math"),buttonRef:g[l],tabIndex:v(l),title:"Insert math (LaTeX is supported)"}),po(Md,{disabled:e,iconName:"format-list-numbered",onClick:()=>t("numlist"),shortcutKey:Ld.numlist,buttonRef:g[c],tabIndex:v(c),title:"Numbered list"}),po(Md,{disabled:e,iconName:"format-list-unordered",onClick:()=>t("list"),shortcutKey:Ld.list,buttonRef:g[u],tabIndex:v(u),title:"Bulleted list"}),po("span",{className:"hyp-u-stretch"}),po("div",{
|
|
523
|
+
className:"hyp-u-layout-row--center",children:po(zo,{href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",classes:"text-tiny IconOnlyLink",linkRef:g[h],tabIndex:v(h),title:"Formatting help","aria-label":"Formatting help",children:po(Mo,{name:"help"})})}),po(Md,{label:e?"Write":"Preview",onClick:n,buttonRef:g[d],tabIndex:v(d)})]})}function Od({label:e="",onEditText:t=(()=>{}),text:n="",textStyle:r={}}){const[o,i]=Zr(!1),a=to(null);Qr((()=>{var e;o||(null===(e=a.current)||void 0===e||e.focus())}),[o]);const s=e=>{a.current&&(!function(e,t){const n=e=>{const n=e({text:t.value,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd});t.value=n.text,t.selectionStart=n.selectionStart,t.selectionEnd=n.selectionEnd,t.focus()},r=e=>{const t=e.text.slice(0,e.selectionStart);return 0===t.length||"\n"===t.slice(-1)||"$$"===t.slice(-2)?Ad(e,"$$","$$","Insert LaTeX"):Ad(e,"\\(","\\)","Insert LaTeX")};switch(e){case"bold":n((e=>Ad(e,"**","**","Bold")));break;case"italic":
|
|
524
|
+
n((e=>Ad(e,"*","*","Italic")));break;case"quote":n((e=>Nd(e,"> ")));break;case"link":n((e=>Cd(e)));break;case"image":n((e=>Cd(e,kd)));break;case"math":n(r);break;case"numlist":n((e=>Nd(e,"1. ")));break;case"list":n((e=>Nd(e,"* ")));break;default:throw new Error(`Unknown toolbar command "${e}"`)}}(e,a.current),t({text:a.current.value}))};return po("div",{className:"leading-none",children:[po(zd,{onCommand:s,isPreviewing:o,onTogglePreview:()=>i(!o)}),o?po(_d,{markdown:n,textClass:{"hyp-u-border":!0,"hyp-u-bg-color--grey-1":!0,"hyp-u-padding":!0},textStyle:r}):po("textarea",{"aria-label":e,className:"MarkdownEditor__input",dir:"auto",ref:a,onClick:e=>e.stopPropagation(),onKeyDown:e=>{if(e.ctrlKey||e.metaKey)for(let[t,n]of Object.entries(Ld))n===Oo(e.key)&&(e.stopPropagation(),e.preventDefault(),s(t))},onInput:e=>{t({text:e.target.value})},value:n,style:r})]})}const Id=e=>e;function Rd({activeItem:e=-1,id:t,itemPrefixId:n,list:r,listFormatter:o=Id,onSelectItem:i,open:a=!1}){const s=no((()=>r.map(((t,r)=>{
|
|
525
525
|
const a=n?{id:`${n}${r}`}:{};return po("li",{role:"option","aria-selected":(e===r).toString(),className:Ur({"is-selected":e===r},"AutocompleteList__li"),onClick:()=>{i(t)},...a,children:o(t,r)},`AutocompleteList-${r}`)}))),[e,n,r,o,i]),l=t?{id:t}:{},c=0===r.length||!a;return po("div",{className:Ur({"is-hidden":c},"AutocompleteList"),children:po("ul",{className:"AutocompleteList__items",tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s})})}let Pd=0;var Dd=ri((function({onAddTag:e,onRemoveTag:t,onTagInput:n,tagList:r,tags:o}){const i=to(),[a,s]=Zr([]),[l,c]=Zr(-1),[u,h]=Zr(!1),[d]=Zr((()=>(++Pd,`TagEditor-${Pd}`))),p=to();Ro(p,u,(()=>{h(!1)}));const m=()=>i.current.value.trim(),f=()=>m()&&m().length>0,g=()=>{i.current.value="",null==n||n("")},v=t=>{e(t)&&(h(!1),c(-1),g(),i.current.focus())},y=e=>{let t=l+e;t<-1?t=a.length-1:t>=a.length&&(t=-1),c(t)},_=l>=0?`${d}-AutocompleteList-item-${l}`:"";return po("div",{className:"TagEditor",children:[po("ul",{className:"TagEditor__tags",
|
|
526
526
|
"aria-label":"Suggested tags for annotation",children:r.map((e=>po("li",{className:"TagEditor__item","aria-label":`Tag: ${e}`,children:[po("span",{lang:"",className:"TagEditor__edit",children:e}),po("button",{onClick:()=>{t(e)},"aria-label":`Remove Tag: ${e}`,title:`Remove Tag: ${e}`,className:"TagEditor__delete",children:po(Mo,{name:"cancel"})})]},`${e}`)))}),po("span",{id:d,className:"TagEditor__combobox-wrapper",ref:p,role:"combobox","aria-expanded":u.toString(),"aria-owns":`${d}-AutocompleteList`,"aria-haspopup":"listbox",children:[po("input",{onInput:()=>{null==n||n(m()),(()=>{if(f()){const e=o.filter(m());s(((e,t)=>{const n=[];return e.forEach((e=>{t.indexOf(e)<0&&n.push(e)})),n.sort()})(e,r)),h(e.length>0)}else h(!1);c(-1)})()},onKeyDown:e=>{switch(Oo(e.key)){case"ArrowUp":y(-1),e.preventDefault();break;case"ArrowDown":y(1),e.preventDefault();break;case"Escape":g(),e.preventDefault();break;case"Enter":case",":v(-1===l?m():a[l]),e.preventDefault();break;case"Tab":if(!f())break
|
|
527
|
-
;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&h(!0)},ref:i,placeholder:"Add new tags",className:"TagEditor__input",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":_,"aria-controls":`${d}-AutocompleteList`,dir:"auto"}),po(Rd,{id:`${d}-AutocompleteList`,list:a,listFormatter:e=>{const t=m().toLowerCase(),n=e.toLowerCase().indexOf(t);if(-1===n)return po("span",{children:e});const r=e.slice(0,n),o=e.slice(n,n+t.length),i=e.slice(n+t.length);return po("span",{children:[po("strong",{children:r}),o,po("strong",{children:i})]})},open:u,onSelectItem:e=>{e&&v(e)},itemPrefixId:`${d}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);function Bd(){return po("div",{className:"hyp-u-padding--top hyp-u-border--top
|
|
528
|
-
title:"View more information about the Creative Commons Public Domain dedication",children:[po(Mo,{name:"cc-std",classes:"
|
|
529
|
-
i
|
|
527
|
+
;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&h(!0)},ref:i,placeholder:"Add new tags",className:"TagEditor__input",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":_,"aria-controls":`${d}-AutocompleteList`,dir:"auto"}),po(Rd,{id:`${d}-AutocompleteList`,list:a,listFormatter:e=>{const t=m().toLowerCase(),n=e.toLowerCase().indexOf(t);if(-1===n)return po("span",{children:e});const r=e.slice(0,n),o=e.slice(n,n+t.length),i=e.slice(n+t.length);return po("span",{children:[po("strong",{children:r}),o,po("strong",{children:i})]})},open:u,onSelectItem:e=>{e&&v(e)},itemPrefixId:`${d}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);function Bd(){return po("div",{className:"hyp-u-padding--top hyp-u-border--top text-sm leading-none",children:po(zo,{classes:"hyp-u-layout-row--align-center p-link--muted",href:"http://creativecommons.org/publicdomain/zero/1.0/",target:"_blank",
|
|
528
|
+
title:"View more information about the Creative Commons Public Domain dedication",children:[po(Mo,{name:"cc-std",classes:"text-tiny"}),po(Mo,{name:"cc-zero",classes:"hyp-u-margin--left--1 text-tiny"}),po("div",{className:"hyp-u-margin--left--2",children:"Annotations can be freely reused by anyone for any purpose."})]})})}function Fd(e){return null!==e.offsetParent}function jd({className:e,closeMenu:t,children:n,visible:r}){const o=to();Qr((()=>{let e=null;return r&&(e=setTimeout((()=>{const e=o.current.querySelector('[role^="menuitem"]');e&&e.focus()}))),()=>{clearTimeout(e)}}),[r]);return po("div",{role:"menu",className:e,ref:o,onKeyDown:e=>{const n=Array.from(o.current.querySelectorAll('[role^="menuitem"]')).filter(Fd);let r=n.findIndex((e=>e.contains(document.activeElement))),i=!1;switch(Oo(e.key)){case"ArrowLeft":case"Escape":t&&(t(e),i=!0);break;case"ArrowUp":r-=1,r<0&&(r=n.length-1),i=!0;break;case"ArrowDown":r+=1,r===n.length&&(r=0),i=!0;break;case"Home":r=0,i=!0;break;case"End":r=n.length-1,i=!0}
|
|
529
|
+
i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}function Hd({className:e}){return po("svg",{className:Ur("Menu__arrow",e),width:15,height:8,children:po("path",{d:"M0 8 L7 0 L15 8",stroke:"currentColor",strokeWidth:"2"})})}let Ud=!1;const qd=()=>{};function $d({align:e="left",arrowClass:t="",children:n,containerPositioned:r=!0,contentClass:o,defaultOpen:i=!1,label:a,open:s,onOpenChanged:l,menuIndicator:c=!0,title:u}){let[h,d]=Zr(i);"boolean"==typeof s&&(h=s,d=l||qd);const p=to(h);Qr((()=>{"function"==typeof l&&p.current!==h&&(p.current=h,l(h))}),[h,l]);const f=e=>{if("mousedown"===e.type)Ud=!0;else if("click"===e.type&&Ud)return Ud=!1,e.stopPropagation(),void e.preventDefault();d(!h)},g=ro((()=>d(!1)),[d]),v=to();Ro(v,h,g);const y=e=>e.stopPropagation();return po("div",{className:"Menu",ref:v,style:{position:r?"relative":"static"},onClick:y,onMouseDown:y,children:[po("button",{"aria-expanded":h?"true":"false","aria-haspopup":!0,className:"Menu__toggle",onMouseDown:f,onClick:f,
|
|
530
530
|
"aria-label":u,title:u,children:po("span",{className:"Menu__toggle-wrapper",children:[a,c&&po("span",{className:Ur("Menu__toggle-arrow",h&&"is-open"),children:po(fo,{name:"expand-menu",className:"Menu__toggle-icon"})})]})}),h&&po(m,{children:[po(Hd,{className:t}),po("div",{className:Ur("Menu__content",`Menu__content--align-${e}`,o),role:"menu",tabIndex:-1,onClick:g,onKeyDown:e=>{const t=Oo(e.key);"Enter"!==t&&" "!==t||setTimeout((()=>{g()}))},children:po(jd,{visible:!0,children:n})})]})]})}function Gd({children:e,visible:t}){const n=to(),[r,o]=Zr(t?"auto":0),[i,a]=Zr(t);Qr((()=>{if(t===(0!==r))return;const e=n.current;t?(e.style.display="",a(!0),o(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),o(0))}),[r,t]);return po("div",{ontransitionend:ro((()=>{t?o("auto"):a(!1)}),[o,t]),ref:n,style:{display:i?"":"none",height:r,overflow:"auto"===r?"visible":"hidden",transition:"height 0.15s ease-in"},children:e})}
|
|
531
531
|
function Vd({href:e,icon:t,iconAlt:n,isDisabled:r,isExpanded:o,isSelected:i,isSubmenuItem:a,isSubmenuVisible:s,label:l,onClick:c,onToggleSubmenu:u,submenu:h}){const d=t&&-1!==t.indexOf("/"),p=t||a,f=t&&a,g=to();let v=null,y=null;t&&"blank"!==t&&(y=d?po("img",{className:"MenuItem__icon",alt:n,src:t}):po(fo,{name:t,className:"MenuItem__icon"}));const _=a?null:y,b=a?y:null;let w;const x="boolean"==typeof s,k="boolean"==typeof i;Qr((()=>()=>{clearTimeout(v)}),[]);const S=e=>{switch(Oo(e.key)){case"ArrowRight":u&&(e.stopPropagation(),e.preventDefault(),u(e));break;case"Enter":case" ":c&&c(e)}};return w=e?po("a",{ref:g,className:Ur("MenuItem",{"is-submenu":a,"is-disabled":r}),href:e,target:"_blank",tabIndex:-1,rel:"noopener noreferrer",role:"menuitem",onKeyDown:S,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b})]}):po("div",{ref:g,className:Ur("MenuItem",{"is-submenu":a,
|
|
532
532
|
"is-disabled":r,"is-expanded":o,"is-selected":i}),tabIndex:-1,onKeyDown:S,onClick:c,role:k?"menuitemradio":"menuitem","aria-checked":k?i:void 0,"aria-haspopup":x,"aria-expanded":x?s:void 0,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b}),x&&po("div",{role:"none",icon:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle",onClick:u,title:`Show actions for ${l}`,children:po(fo,{name:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle-icon"})})]}),po(m,{children:[w,x&&po(Gd,{visible:s,children:po(jd,{closeMenu:e=>{u&&u(e),v=setTimeout((()=>{g.current.focus()}))},visible:s,className:"MenuItem__submenu",children:h})})]})}var Wd=ri((function({annotation:e,isDisabled:t,onSave:n,settings:r}){const o=ii(),i=o.getDraft(e),a=o.getGroup(e.group);if(!a)return null;const s=i?i.isPrivate:!ya(e.permissions),l=s?"Only Me":a.name,c=t=>{o.createDraft(e,{...i,
|
|
533
|
-
isPrivate:"private"===t}),ki(e)||o.setDefault("annotationPrivacy",t)},u=ti(["ctaTextColor","ctaBackgroundColor"],r),h=po("div",{className:"annotation-publish-button__menu-label",style:u,children:po(Mo,{name:"expand-menu"
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
classes:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--muted p-link--hover-muted",href:t.links.html,target:"_blank",children:["open"===t.type?po(Mo,{classes:"
|
|
533
|
+
isPrivate:"private"===t}),ki(e)||o.setDefault("annotationPrivacy",t)},u=ti(["ctaTextColor","ctaBackgroundColor"],r),h=po("div",{className:"annotation-publish-button__menu-label",style:u,children:po(Mo,{name:"expand-menu"})});return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--4",children:[po("div",{className:"annotation-publish-button",children:[po(bo,{classes:"PublishControlButton","data-testid":"publish-control-button",style:u,onClick:n,disabled:t,size:"large",variant:"primary",children:["Post to ",l]}),po("div",{className:"annotation-publish-button__menu-wrapper",style:u,children:po($d,{arrowClass:"annotation-publish-button__menu-arrow",containerPositioned:!1,contentClass:"annotation-publish-button__menu-content",label:h,menuIndicator:!1,title:"Change annotation sharing setting",align:"left",children:[po(Vd,{icon:"open"===a.type?"public":"groups",label:a.name,isSelected:!s,onClick:()=>c("shared")}),po(Vd,{icon:"lock",label:"Only Me",isSelected:s,onClick:()=>c("private")})]})})]
|
|
534
|
+
}),po("div",{children:po(bo,{icon:"cancel",onClick:()=>{o.removeDraft(e),Si(e)&&o.removeAnnotations([e])},size:"large",children:"Cancel"})})]})}),["settings"]);var Yd=ri((function({annotation:e,annotationsService:t,settings:n,tags:r,toastMessenger:o}){const[i,a]=Zr(null),s=ii(),l=s.getDraft(e),c=s.getGroup(e.group);if(!l)return null;const u=!l.isPrivate&&c&&"private"!==c.type,h=l.tags,d=l.text,p=!d&&!h.length,m=({tags:e})=>{s.createDraft(l.annotation,{...l,tags:e})},f=e=>{if(!e||h.indexOf(e)>=0)return!1;const t=[...h,e];return r.store(t),m({tags:t}),!0},g=async()=>{i&&f(i);try{await t.save(e)}catch(e){o.error("Saving annotation failed")}};return po("div",{className:"hyp-u-vertical-spacing AnnotationEditor",onKeyDown:e=>{const t=Oo(e.key);p||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),g())},children:[po(Od,{textStyle:ti(["annotationFontFamily"],n),label:"Annotation body",text:d,onEditText:({text:e})=>{s.createDraft(l.annotation,{...l,text:e})}}),po(Dd,{onAddTag:f,
|
|
535
|
+
onRemoveTag:e=>{const t=[...h],n=t.indexOf(e);return n>=0&&(t.splice(n,1),m({tags:t}),!0)},onTagInput:a,tagList:h}),po("div",{className:"hyp-u-layout-row annotation__form-actions",children:po(Wd,{annotation:e,isDisabled:p,onSave:g})}),u&&po(Bd,{})]})}),["annotationsService","settings","tags","toastMessenger"]);function Kd(e,t,n){var r;return(n||t)&&null!==(r=e.user_info)&&void 0!==r&&r.display_name?e.user_info.display_name:Jo(e.user)}function Xd({domain:e,link:t,title:n}){return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--2",children:[po("div",{className:"text-color-text-light",children:['on "',t?po(zo,{href:t,target:"_blank",children:n}):po("span",{children:n}),'"']}),e&&po("span",{className:"text-color-text-light",children:["(",e,")"]})]})}function Zd({annotation:e}){const t=ii().getGroup(e.group),n=null==t?void 0:t.links.html,r=_a(e.permissions);return po("div",{className:"hyp-u-layout-row--align-baseline",children:[t&&n&&po(zo,{
|
|
536
|
+
classes:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--muted p-link--hover-muted",href:t.links.html,target:"_blank",children:["open"===t.type?po(Mo,{classes:"text-tiny",name:"public"}):po(Mo,{classes:"text-tiny",name:"groups"}),po("span",{children:t.name})]}),r&&!n&&po("span",{className:"hyp-u-layout-row--align-baseline text-color-text-light",children:po("span",{"data-testid":"private-info",children:"Only me"})})]})}let Jd={};function Qd(e,t){return t-e}function ep(e,t,n=window.Intl){const r=JSON.stringify(t);let o=Jd[r];return o||(o=Jd[r]=new n.DateTimeFormat(void 0,t)),o.format(e)}const tp=[{test:(e,t)=>Qd(e,t)<3e4,formatter:()=>"Just now",nextUpdate:1e3},{test:(e,t)=>Qd(e,t)<6e4,formatter:function(e,t){return`${Math.floor(Qd(e,t)/1e3)} secs ago`},nextUpdate:1e3},{test:(e,t)=>Qd(e,t)<36e5,formatter:function(e,t){const n=Math.floor(Qd(e,t)/6e4);return`${n} min${n>1?"s":""} ago`},nextUpdate:6e4},{test:(e,t)=>Qd(e,t)<864e5,formatter:function(e,t){const n=Math.floor(Qd(e,t)/36e5)
|
|
537
537
|
;return`${n} hr${n>1?"s":""} ago`},nextUpdate:36e5},{test:(e,t)=>e.getFullYear()===t.getFullYear(),formatter:function(e,t,n){return ep(e,{month:"short",day:"numeric"},n)},nextUpdate:null}],np={test:()=>!0,formatter:function(e,t,n){return ep(e,{day:"numeric",month:"short",year:"numeric"},n)},nextUpdate:null};function rp(e,t){for(let n of tp)if(n.test(e,t))return n;return np}function op(e){return!isNaN(e.valueOf())}function ip(e,t){let n;const r=new Date(e),o=()=>{const e=function(e,t){if(!e||!op(e)||!op(t))return null;let n=rp(e,t).nextUpdate;return null===n?null:(n=Math.max(n,5e3),n=Math.min(n,20736e5),n)}(r,new Date);if(null===e)return;n=setTimeout((()=>{t(),o()}),e+500)};return o(),()=>clearTimeout(n)}function ap(e,t,n){return e?rp(e,t).formatter(e,t,n):""}function sp(e,t){return ep(e,{year:"numeric",month:"short",day:"2-digit",weekday:"long",hour:"2-digit",minute:"2-digit"},t)}function lp({annotationCreated:e,annotationUpdated:t,annotationUrl:n,withEditedTimestamp:r}){
|
|
538
|
-
const[o,i]=Zr((()=>new Date)),a=no((()=>new Date(e)),[e]),s=no((()=>r&&new Date(t)),[t,r]),l=no((()=>({absolute:sp(a),relative:ap(a,o)})),[a,o]),c=no((()=>s?{absolute:sp(s),relative:ap(s,o)}:{}),[s,o]);Qr((()=>ip(s?t:e,(()=>i(new Date)))),[e,t,a,s,o]);const u=c&&c.relative!==l.relative?`edited ${c.relative}`:"edited";return po("div",{children:[r&&po("span",{className:"
|
|
539
|
-
;const a=ii(),s=a.defaultAuthority(),l=a.isFeatureEnabled("client_display_names"),c=Qo(e.user,s),u=Kd(e,c,l),h=(()=>{var t;return c?null!==(t=o.usernameUrl&&`${o.usernameUrl}${Jo(e.user)}`)&&void 0!==t?t:void 0:a.getLink("user",{user:e.user})})(),d=ki(e)&&r,p=_a(e.permissions),m=(null===(i=e.links)||void 0===i?void 0:i.html)||"",f=!t&&e.created,g=no((()=>function(e){if(!e.updated||!e.created||e.updated===e.created)return!1;const t=new Date(e.created).getTime(),n=new Date(e.updated).getTime();return!isNaN(t)&&!isNaN(n)&&n-t>2e3}(e)&&!d),[e,d]),v=`${n} ${n>1?"replies":"reply"}`,y=n>0&&d,_=!ki(e),b=function(e){return{domain:wi(e),titleText:xi(e),titleLink:bi(e)}}(e),w=m&&b.titleLink?b.titleLink:"",x="sidebar"!==a.route()&&b.titleText;return po("header",{children:[po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2
|
|
540
|
-
|
|
538
|
+
const[o,i]=Zr((()=>new Date)),a=no((()=>new Date(e)),[e]),s=no((()=>r&&new Date(t)),[t,r]),l=no((()=>({absolute:sp(a),relative:ap(a,o)})),[a,o]),c=no((()=>s?{absolute:sp(s),relative:ap(s,o)}:{}),[s,o]);Qr((()=>ip(s?t:e,(()=>i(new Date)))),[e,t,a,s,o]);const u=c&&c.relative!==l.relative?`edited ${c.relative}`:"edited";return po("div",{children:[r&&po("span",{className:"text-color-text-light text-sm italic","data-testid":"timestamp-edited",title:c.absolute,children:["(",u,")"," "]}),n?po(zo,{classes:"p-link--muted p-link--hover-muted",target:"_blank",title:l.absolute,href:n,children:l.relative}):po("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:l.absolute,children:l.relative})]})}function cp({authorLink:e,displayName:t}){const n=po("h3",{className:"text-color-text font-bold",children:t});return e?po(zo,{href:e,target:"_blank",children:n}):po("div",{children:n})}var up=ri((function({annotation:e,isEditing:t,replyCount:n,threadIsCollapsed:r,settings:o}){var i
|
|
539
|
+
;const a=ii(),s=a.defaultAuthority(),l=a.isFeatureEnabled("client_display_names"),c=Qo(e.user,s),u=Kd(e,c,l),h=(()=>{var t;return c?null!==(t=o.usernameUrl&&`${o.usernameUrl}${Jo(e.user)}`)&&void 0!==t?t:void 0:a.getLink("user",{user:e.user})})(),d=ki(e)&&r,p=_a(e.permissions),m=(null===(i=e.links)||void 0===i?void 0:i.html)||"",f=!t&&e.created,g=no((()=>function(e){if(!e.updated||!e.created||e.updated===e.created)return!1;const t=new Date(e.created).getTime(),n=new Date(e.updated).getTime();return!isNaN(t)&&!isNaN(n)&&n-t>2e3}(e)&&!d),[e,d]),v=`${n} ${n>1?"replies":"reply"}`,y=n>0&&d,_=!ki(e),b=function(e){return{domain:wi(e),titleText:xi(e),titleLink:bi(e)}}(e),w=m&&b.titleLink?b.titleLink:"",x="sidebar"!==a.route()&&b.titleText;return po("header",{children:[po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[p&&!t&&po(Mo,{classes:"text-tiny",name:"lock",title:"This annotation is visible only to you"}),po(cp,{authorLink:h,displayName:u}),y&&po(wo,{
|
|
540
|
+
onClick:()=>a.setExpanded(e.id,!0),title:"Expand replies",children:v}),f&&po("div",{className:"hyp-u-layout-row--justify-right hyp-u-stretch",children:po(lp,{annotationCreated:e.created,annotationUpdated:e.updated,annotationUrl:m,withEditedTimestamp:g})})]}),_&&po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[po(Zd,{annotation:e}),!t&&Ni(e)&&po(Mo,{name:"highlight",title:"This is a highlight. Click 'edit' to add a note or tag.",classes:"text-tiny text-color-text-light"}),x&&po(Xd,{domain:b.domain,link:w,title:b.titleText})]})]})}),["settings"]);var hp=ri((function({annotation:e,isFocused:t,settings:n={}}){return po("div",{className:Ur({"is-orphan":Li(e)}),children:po(Ta,{collapsedHeight:35,inlineControls:!0,overflowThreshold:20,children:po("blockquote",{className:Ur("p-quoted-text",{"is-focused":t,"p-redacted-content":Li(e)}),dir:"auto",lang:"",style:ti(["selectionFontFamily"],n),children:Ii(e)})})})}),["settings"])
|
|
541
541
|
;function dp({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return po(wo,{onClick:e,title:r,children:r})}var pp=ri((function({annotation:e,hasAppliedFilter:t,isReply:n,onToggleReplies:r,replyCount:o,threadIsCollapsed:i,annotationsService:a}){const s=n&&i,l=ii(),c=e&&!!Ii(e),u=e&&l.isAnnotationFocused(e.$tag),h=e&&l.isSavingAnnotation(e),d=e&&!!l.getDraft(e)&&!h,p=l.profile().userid,f=!h&&!d,g=!n&&!t&&o>0;return po("article",{className:Ur("hyp-u-vertical-spacing",{"is-collapsed":i,"is-focused":u}),children:[e&&po(m,{children:[po(up,{annotation:e,isEditing:d,replyCount:o,threadIsCollapsed:i}),c&&po(hp,{annotation:e,isFocused:u}),!s&&!d&&po(wd,{annotation:e}),d&&po(Yd,{annotation:e})]}),!e&&!s&&po("div",{children:po("em",{children:"Message not available."})}),!s&&po("footer",{children:po("div",{className:"hyp-u-layout-row",children:[g&&po(dp,{onToggleReplies:r,replyCount:o,threadIsCollapsed:i}),h&&po("div",{
|
|
542
542
|
className:"hyp-u-layout-row--justify-right hyp-u-stretch","data-testid":"saving-message",children:"Saving..."}),e&&f&&po(So,{classes:"hyp-u-stretch",children:po(Ca,{annotation:e,onReply:()=>a.reply(e,p)})})]})})]})}),["annotationsService"]);var mp=ri((function({annotation:e,api:t,toastMessenger:n}){const r=ii(),o=function(e){return e.moderation?e.moderation.flagCount:null}(e),i=null!==o&&(o>0||e.hidden),a=()=>{const o=e.id;t.annotation.hide({id:o}).then((()=>{r.hideAnnotation(o)})).catch((()=>{n.error("Failed to hide annotation")}))},s=()=>{const o=e.id;t.annotation.unhide({id:o}).then((()=>{r.unhideAnnotation(o)})).catch((()=>{n.error("Failed to unhide annotation")}))},l=(()=>{const t={};return e.hidden?(t.onClick=s,t.title="Make this annotation visible to everyone"):(t.onClick=a,t.title="Hide this annotation from non-moderators"),t["aria-label"]=t.title,t})(),c=Ur("ModerationBanner",{"is-flagged":null!==o&&o>0,"is-hidden":e.hidden,"is-reply":ki(e)});return i?po("div",{className:c,
|
|
543
543
|
children:[!!o&&!e.hidden&&po("span",{children:["Flagged for review x",o]}),e.hidden&&po("span",{children:["Hidden from users. Flagged x",o]}),po("span",{className:"hyp-u-stretch"}),po("button",{...l,children:e.hidden?"Unhide":"Hide"})]}):null}),["api","toastMessenger"]);function fp({annotation:e,...t}){const n=ii(),r=e&&n.isSavingAnnotation(e),o=e&&!!n.getDraft(e)&&!r;return e?po("div",{className:"Thread__top-annotation-header",children:po(up,{annotation:e,isEditing:o,...t})}):null}var gp=ri((function e({thread:t,threadsService:n}){const r=!t.collapsed,o=Ui(t)>0,i=!!t.parent,a=t.collapsed?"collapsed":"expand-menu",s=t.collapsed?"Expand replies":"Collapse replies",l=t.children.filter((e=>qi(e)>0)),c=ii(),u=c.hasAppliedFilter(),h=ro((()=>c.setExpanded(t.id,!!t.collapsed)),[c,t.id,t.collapsed]),d=no((()=>t.visible&&po(m,{children:[t.annotation&&po(mp,{annotation:t.annotation}),po(pp,{annotation:t.annotation,hasAppliedFilter:u,isReply:!!t.parent,onToggleReplies:h,replyCount:t.replyCount,
|
|
544
544
|
threadIsCollapsed:t.collapsed})]})),[u,h,t.annotation,t.parent,t.replyCount,t.collapsed,t.visible]);return po("section",{className:Ur("Thread",{"Thread--reply":t.depth>0,"is-collapsed":t.collapsed}),children:[i&&po("div",{className:"Thread__collapse",children:po("div",{className:"Thread__collapse-button-container",children:po(_o,{classes:"NonResponsiveIconButton",expanded:!t.collapsed,icon:a,title:s,onClick:h,size:"medium",variant:"light"})})}),po("div",{className:"Thread__content",children:[d,o&&po(m,{children:[!t.parent&&po(fp,{annotation:t.annotation,replyCount:t.replyCount,threadIsCollapsed:t.collapsed}),po("div",{className:"Thread__hidden-toggle-button-container",children:po(bo,{onClick:()=>n.forceVisible(t),children:["Show ",Ui(t)," more in conversation"]})})]}),r&&po("ul",{className:"Thread__children",children:l.map((t=>po("li",{children:po(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var vp=ri((function({frameSync:e,thread:t}){
|
|
545
545
|
const n=ii(),r=t.annotation&&t.annotation.$tag,o=r&&n.isAnnotationFocused(r),i=no((()=>ua((t=>{const n=t?[t]:[];e.focusAnnotations(n)}),10)),[e]),a=ro((t=>{e.scrollToAnnotation(t)}),[e]),s=no((()=>po(gp,{thread:t})),[t]);return po("div",{onClick:e=>{var t;(t=e.target).closest("button")||t.closest("a")||a(r)},onMouseEnter:()=>i(r),onMouseLeave:()=>i(null),className:Ur("ThreadCard",{"is-focused":o}),children:s},t.id)}),["frameSync"]);function yp(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function _p(e){return Math.max(e-e%50,0)}function bp({threads:e}){const[t,n]=Zr(0),[r,o]=Zr(0);eo((()=>{const e=new ha,t=yp();n(t.clientHeight),o(_p(t.scrollTop));const r=ua((()=>{n(t.clientHeight),o(_p(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}}),[])
|
|
546
546
|
;const[i,a]=Zr({}),[s,l]=Zr(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:h,visibleThreads:d}=no((()=>function(e,t,n,r,o=da){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,h=0;return e.forEach((e=>{const o=t[e.id]||i;c+o<n-a?u+=o:c<n+r+s?l.push(e):h+=o,c+=o})),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:h}}(c,i,r,t)),[c,i,r,t]),p=ii(),m=(()=>{const e=p.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();return Qr((()=>{m&&(p.setForcedVisible(m,!0),l(m))}),[p,m]),Qr((()=>{if(!s)return;const e=c.findIndex((e=>e.id===s));if(-1===e)return;l(null);const t=c.slice(0,e).reduce(((e,t)=>e+(e=>i[e.id]||da.defaultHeight)(t)),0);yp().scrollTop=t}),[s,c,i]),Qr((()=>{a((e=>{const t={};for(let{id:n}of d){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=pa(r);o!==e[n]&&(t[n]=o)}return 0===Object.keys(t).length?e:{...e,...t}}))}),[d]),po("div",{children:[po("div",{style:{height:h}
|
|
547
|
-
}),d.map((e=>po("div",{className:"ThreadList__card",id:e.id,children:po(vp,{thread:e})},e.id))),po("div",{style:{height:u}})]})}function wp({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=ii(),o=r.isLoggedIn();return po("div",{className:"
|
|
548
|
-
|
|
547
|
+
}),d.map((e=>po("div",{className:"ThreadList__card",id:e.id,children:po(vp,{thread:e})},e.id))),po("div",{style:{height:u}})]})}function wp({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=ii(),o=r.isLoggedIn();return po("div",{className:"mb-4",children:po(Ho,{icon:"restricted",title:"annotation"===e?"Annotation unavailable":"Group unavailable",children:[po("p",{children:o?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":"The current URL links to an annotation, but that annotation\n cannot be found, or you do not have permission to view it.":`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),po("div",{className:"hyp-u-layout-row--justify-right hyp-u-horizontal-spacing",children:[n&&po(bo,{variant:o?"primary":void 0,onClick:()=>r.clearSelection(),children:"Show all annotations"}),!o&&po(bo,{variant:"primary",onClick:t,
|
|
548
|
+
children:"Log in"})]})]})})}var xp=ri((function({loadAnnotationsService:e,onLogin:t}){const n=ii(),r=n.routeParams().id,o=Ki(),i=n.profile().userid,[a,s]=Zr(!1);return Qr((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),po(m,{children:[a&&po(wp,{errorType:"annotation",onLoginRequest:t}),po(bp,{threads:o.children})]})}),["loadAnnotationsService"]);function kp({actionButton:e,additionalCount:t=0,entitySingular:n="annotation",entityPlural:r="annotations",filterQuery:o,focusDisplayName:i,resultCount:a}){return po("div",{className:"FilterStatus",children:ii().isLoading()?po("div",{className:"hyp-u-layout-row--center",children:po(qo,{})}):po("div",{className:"hyp-u-layout-row--align-center",children:[po("div",{className:"FilterStatus__text",children:[a>0&&po("span",{children:"Showing "}),po("span",{className:"filter-facet",
|
|
549
549
|
children:[a>0?a:"No"," ",1===a?n:r]}),o&&po("span",{children:[" ","for"," ",po("span",{className:"filter-facet--pre",children:`'${o}'`})]}),i&&po("span",{children:[" ","by ",po("span",{className:"filter-facet",children:i})]}),t>0&&po("span",{className:"filter-facet--muted",children:[" ","(and ",t," more)"]})]}),po("div",{children:e})]})})}function Sp({filterState:e,rootThread:t}){const n=ii(),r=n.directLinkedAnnotationId(),o=n.annotationCount(),i=(t.children||[]).filter((e=>e.annotation&&e.visible)).length-e.selectedCount,a=!e.focusConfigured&&!r?`Show all (${o})`:"Show all",s=po(bo,{title:a,variant:"primary",onClick:()=>n.clearSelection(),icon:"cancel",children:a});return po(kp,{resultCount:e.selectedCount,additionalCount:i,actionButton:s})}function Cp({filterState:e,rootThread:t}){const n=ii(),r=qi(t)-e.forcedVisibleCount,o=po(bo,{icon:"cancel",variant:"primary",title:"Clear search",onClick:()=>n.clearSelection(),children:"Clear search"});return po(kp,{actionButton:o,additionalCount:e.forcedVisibleCount,
|
|
550
550
|
entitySingular:"result",entityPlural:"results",filterQuery:e.filterQuery,focusDisplayName:e.focusDisplayName,resultCount:r})}function Ap({filterState:e,rootThread:t}){const n=ii(),r=qi(t)-e.forcedVisibleCount,o={};e.forcedVisibleCount>0?(o.onClick=()=>n.clearSelection(),o.title="Reset filters"):(o.onClick=()=>n.toggleFocusMode(),o.title=e.focusActive?"Show all":`Show only ${e.focusDisplayName}`);const i=e.focusActive?e.focusDisplayName:"",a=po(bo,{variant:"primary",...o,children:o.title});return po(kp,{resultCount:r,actionButton:a,additionalCount:e.forcedVisibleCount,filterQuery:e.filterQuery,focusDisplayName:i})}function Ep(){const e=Ki(),t=ii(),n=t.focusState(),r=t.forcedVisibleThreads().length,o=t.filterQuery(),i=t.selectedAnnotations().length,a=no((()=>({filterQuery:o,focusActive:n.active,focusConfigured:n.configured,focusDisplayName:n.displayName,forcedVisibleCount:r,selectedCount:i})),[n,r,o,i]);return a.selectedCount>0?po(Sp,{filterState:a,rootThread:e}):a.filterQuery?po(Cp,{filterState:a,rootThread:e
|
|
551
|
-
}):a.focusConfigured?po(Ap,{filterState:a,rootThread:e}):null}function Tp({onLogin:e}){const t=ii();return po("div",{className:"LoggedOutMessage",children:[po("span",{children:["This is a public annotation created with Hypothesis. ",po("br",{}),"To reply or make your own annotations on this document,"," ",po("a",{className:"LoggedOutMessage__link",href:t.getLink("signup"),target:"_blank",rel:"noopener noreferrer",children:"create a free account"})," ","or"," ",po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:e,variant:"dark",children:"log in"}),"."]}),po("div",{className:"LoggedOutMessage__logo",children:po("a",{href:"https://hypothes.is","aria-label":"Hypothesis homepage",title:"Hypothesis homepage",children:po(Mo,{name:"logo",classes:"
|
|
551
|
+
}):a.focusConfigured?po(Ap,{filterState:a,rootThread:e}):null}function Tp({onLogin:e}){const t=ii();return po("div",{className:"LoggedOutMessage",children:[po("span",{children:["This is a public annotation created with Hypothesis. ",po("br",{}),"To reply or make your own annotations on this document,"," ",po("a",{className:"LoggedOutMessage__link",href:t.getLink("signup"),target:"_blank",rel:"noopener noreferrer",children:"create a free account"})," ","or"," ",po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:e,variant:"dark",children:"log in"}),"."]}),po("div",{className:"LoggedOutMessage__logo",children:po("a",{href:"https://hypothes.is","aria-label":"Hypothesis homepage",title:"Hypothesis homepage",children:po(Mo,{name:"logo",classes:"w-16 h-16 hyp-u-color--grey-7"})})})]})}function Np(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function Lp(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){
|
|
552
552
|
var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),h=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=h,g=d;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect();var v=u.left-(n.left-t.scrollLeft),y=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=y+l*g-t.clientHeight*g,r-=p,o-=m,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return Np(e,r.x,r.y),
|
|
553
553
|
e._scrollSettings=null,t.end("complete");var a=1-t.ease(i);if(Np(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&Lp(t.scrollAncestor),void Lp(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(Lp.bind(null,e))}}function Mp(e){return e.self===e}function zp(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Op(){return!0}function Ip(e){if(e.assignedSlot)return Ip(e.assignedSlot);if(e.parentElement)return"BODY"===e.parentElement.tagName?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var Rp=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{}
|
|
554
554
|
;var r=Ip(e),o=1,i=t.validTarget||Op,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var s=[];r;)if(t.debug&&console.log("Scrolling parent node",r),i(r,o)&&(a?a(r,zp):zp(r))&&(o++,s.push(r)),!(r=Ip(r))){l("complete");break}return s.reduce(((n,r,o)=>function(e,t,n,r,o){var i,a=!t._scrollSettings,s=t._scrollSettings,l=Date.now(),c={passive:!0};function u(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),n.debug&&console.log("Scrolling ended with type",e,"for",t),o(e),i&&(t.removeEventListener("touchstart",i,c),t.removeEventListener("wheel",i,c))}s&&s.end("canceled");var h=n.maxSynchronousAlignments;return null==h&&(h=3),t._scrollSettings={startTime:l,endIterations:0,target:e,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||Mp,maxSynchronousAlignments:h,end:u,scrollAncestor:r},"cancellable"in n&&!n.cancellable||(i=u.bind(null,"canceled"),
|
|
555
|
-
t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Lp(t),i}(e,r,t,s[o+1],l)),null)}function l(e){--o||n&&n(e)}};function Pp({children:e,icon:t="",panelName:n,title:r,onActiveChanged:o}){const i=ii(),a=i.isSidebarPanelOpen(n),s=to(null),l=to(a);Qr((()=>{l.current!==a&&(l.current=a,a&&Rp(s.current),"function"==typeof o&&o(a))}),[a,o]);const c=ro((()=>{i.toggleSidebarPanel(n,!1)}),[i,n]);return po(Gd,{visible:a,children:po("div",{ref:s,className:"
|
|
556
|
-
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:Ur("
|
|
557
|
-
children:"Page Notes"}),s>0&&po(Bp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"
|
|
558
|
-
|
|
559
|
-
|
|
555
|
+
t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Lp(t),i}(e,r,t,s[o+1],l)),null)}function l(e){--o||n&&n(e)}};function Pp({children:e,icon:t="",panelName:n,title:r,onActiveChanged:o}){const i=ii(),a=i.isSidebarPanelOpen(n),s=to(null),l=to(a);Qr((()=>{l.current!==a&&(l.current=a,a&&Rp(s.current),"function"==typeof o&&o(a))}),[a,o]);const c=ro((()=>{i.toggleSidebarPanel(n,!1)}),[i,n]);return po(Gd,{visible:a,children:po("div",{ref:s,className:"mb-4",children:po(Ho,{title:r,icon:t,onClose:c,children:e})})})}function Dp({onLogin:e,onSignUp:t}){return ii().isLoggedIn()?null:po(Pp,{icon:"restricted",title:"Login needed",panelName:"loginPrompt",children:[po("p",{children:"Please log in to create annotations or highlights."}),po(So,{children:[po(bo,{title:"Sign up",onClick:t,children:"Sign up"}),po(bo,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})}function Bp({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i}){const a=()=>{r||i()
|
|
556
|
+
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:Ur("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var Fp=ri((function({annotationsService:e,isLoading:t,settings:n}){const r=ii(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return po("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[po(Bp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),po(Bp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
|
|
557
|
+
children:"Page Notes"}),s>0&&po(Bp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",po("br",{}),"Create one by selecting some text and clicking the"," ",po(Mo,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var jp=ri((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
558
|
+
const i=Ki(),a=ii(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?ji(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=to(s);Qr((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Qr((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return Qr((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),po("div",{children:[po("h2",{className:"sr-only",children:"Annotations"}),w&&po(Ep,{}),po(Dp,{onLogin:t,onSignUp:n}),y&&po(wp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&po(wp,{
|
|
559
|
+
errorType:"group",onLoginRequest:t}),x&&po(Fp,{isLoading:c}),po(bp,{threads:i.children}),k&&po(Tp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Hp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(bp,{threads:Ki().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.973.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
560
560
|
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function qp(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function $p({commandName:e,iconName:t}){return po("span",{className:"whitespace-nowrap",children:[po(Mo,{name:t,classes:Ur("mx-1 -mt-1","text-color-text-light inline")}),po("em",{children:e})]})}var Gp=ri((function({settings:e}){const t=!qp(e);return po("ol",{className:"list-decimal pl-10 space-y-2",children:[po("li",{children:["To create an annotation, select text and then select the"," ",po($p,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),po("li",{
|
|
561
561
|
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po($p,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&po("li",{children:["To annotate in a private group, select the group from the groups dropdown. Don't see your group? Ask the group creator to send a"," ",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),po("li",{children:["To reply to an annotation, select the"," ",po($p,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var Vp=ri((function({toastMessenger:e,versionData:t}){return po("div",{className:"hyp-u-vertical-spacing",children:[po("dl",{className:"VersionInfo",children:[po("dt",{className:"VersionInfo__key",children:"Version"}),po("dd",{
|
|
562
562
|
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{ba(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Wp({children:e,onClick:t}){return po(wo,{
|
|
563
563
|
classes:"leading-none text-brand",onClick:t,children:[e,po(Mo,{classes:"ml-1",name:"arrow-right"})]})}function Yp({linkText:e,url:t}){return po("div",{className:"flex-1 border-r last-of-type:border-r-0",children:po(zo,{href:t,classes:"flex items-center justify-center space-x-2 text-color-text-light text-lg font-medium",target:"_blank",children:[po("span",{children:e})," ",po(Mo,{name:"external",classes:"w-3 h-3"})]})})}var Kp=ri((function({auth:e,session:t}){const n=ii(),r=n.frames(),o=n.mainFrame(),i=!!n.profile().preferences.show_sidebar_tutorial,[a,s]=Zr("tutorial"),l=no((()=>{const t=e||{status:"logged-out"},n=[...r].sort(((e,t)=>e===o?-1:t===o?1:0));return new Up(t,n)}),[e,r,o]),c=`https://web.hypothes.is/get-help/?sys_info=${l.asEncodedURLString()}`,u=(e,t)=>{e.preventDefault(),s(t)};return po(Pp,{title:"Help",panelName:"help",onActiveChanged:ro((e=>{!e&&i&&t.dismissSidebarTutorial()}),[t,i]),children:po("div",{className:"space-y-4",children:[po("div",{className:"flex items-center",children:[po("h3",{
|
|
564
564
|
className:"grow text-lg font-medium","data-testid":"subpanel-title",children:{tutorial:"Getting started",versionInfo:"About this version"}[a]}),"versionInfo"===a&&po(Wp,{onClick:e=>u(e,"tutorial"),children:"Getting started"}),"tutorial"===a&&po(Wp,{onClick:e=>u(e,"versionInfo"),children:"About this version"})]}),po("div",{className:"border-y py-4",children:["tutorial"===a&&po(Gp,{}),"versionInfo"===a&&po(Vp,{versionData:l})]}),po("div",{className:"flex items-center",children:[po(Yp,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),po(Yp,{linkText:"New support ticket",url:c})]})]})})}),["session"]),Xp={exports:{}};function Zp(){}Zp.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},
|
|
565
565
|
off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,a=r.length;i<a;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},Xp.exports=Zp;var Jp=Xp.exports.TinyEmitter=Zp;class Qp extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function em(e){return 0===e?50:200}class tm extends Jp{constructor(e,{getPageSize:t=em,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._results=[],this._resultCount=null}async _getPage(e,t,n=0){const r=this._getPageSize(n),o={limit:r,sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(o.search_after=t);try{const t=await this._searchFn(o);if(this._canceled)return;if(null===this._resultCount&&(this._resultCount=t.total,this.emit("resultCount",this._resultCount)),
|
|
566
|
-
this._maxResults&&t.total>this._maxResults)return this.emit("error",new Qp(this._maxResults)),void this.emit("end");const i=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",i):this._results=this._results.concat(i);const a=i.length===r,s=i.length>0?i[i.length-1][this._sortBy]:null;a&&s?this._getPage(e,s,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._results=[],this._resultCount=null,this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function nm({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=null!=o?o:e,l=po("span",{className:"FilterSelect__menu-label",children:[t&&po(Mo,{name:t,classes:"
|
|
566
|
+
this._maxResults&&t.total>this._maxResults)return this.emit("error",new Qp(this._maxResults)),void this.emit("end");const i=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",i):this._results=this._results.concat(i);const a=i.length===r,s=i.length>0?i[i.length-1][this._sortBy]:null;a&&s?this._getPage(e,s,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._results=[],this._resultCount=null,this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function nm({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=null!=o?o:e,l=po("span",{className:"FilterSelect__menu-label",children:[t&&po(Mo,{name:t,classes:"text-xl hyp-u-margin--right--3"}),s.display]});return po($d,{label:l,title:i,contentClass:"FilterSelect__menu",children:a.map((e=>po(Vd,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function rm(){
|
|
567
567
|
const e=ii(),t=e.getFilter("user"),n=function(){const e=ii(),t=e.allAnnotations(),n=e.defaultAuthority(),r=e.isFeatureEnabled("client_display_names"),o=e.getFocusFilters(),i=Jo(e.profile().userid);return no((()=>{const e={};if(t.forEach((t=>{const o=Jo(t.user);e[o]=Kd(t,Qo(t.user,n),r)})),o.user){const t=Jo(o.user.value)||o.user.value;e[t]=o.user.display}const a=Object.keys(e).map((t=>({display:t===i?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>i===e.value?-1:i===t.value?1:e.display.localeCompare(t.display))),a}),[t,i,n,r,o.user])}();return po(nm,{defaultOption:{value:"",display:"Everybody"},icon:"profile",onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function om({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const o=Ki(),i=n?r:qi(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return po("div",{className:"hyp-u-layout-row NotebookResultCount",children:[n&&po(qo,{size:"small"}),!n&&po("h2",{children:[!a&&po("strong",{
|
|
568
568
|
children:"No results"}),a&&t&&po("strong",{children:[l," ",1===l?"result":"results"]}),a&&!t&&po("strong",{children:[c," ",1===c?"thread":"threads"]})]}),s&&po("h3",{children:["(and ",e," more)"]}),!t&&a&&po("h3",{children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function im({currentPage:e,onChangePage:t,totalPages:n}){const r=e<n,o=e>1,i=function(e,t,n=5){if(t<=1)return[];const r=new Set([1,e,t]);let o=1;for(;r.size<Math.min(t,n);)e+o<=t&&r.add(e+o),e-o>=1&&r.add(e-o),++o;const i=[];return[...r].sort(((e,t)=>e-t)).forEach(((e,t,n)=>{t>0&&e-n[t-1]>1&&i.push(null),i.push(e)})),i}(e,n),a=(e,n)=>{t(e),null==n||n.blur()};return po("div",{className:"PaginationNavigation",children:[po("div",{className:"PaginationNavigation__relative PaginationNavigation__prev",children:o&&po(bo,{classes:"PaginationPageButton",icon:"arrow-left",title:"Go to previous page",onClick:t=>a(e-1,t.target),variant:"dark",children:"prev"})}),po("ul",{className:"PaginationNavigation__pages",children:i.map(((t,n)=>po("li",{
|
|
569
569
|
children:null===t?po("div",{className:"PaginationNavigation__gap",children:"..."}):po(bo,{classes:"PaginationPageButton",title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),variant:"dark",children:t.toString()},`page-${n}`)},n)))}),po("div",{className:"PaginationNavigation__relative PaginationNavigation__next",children:r&&po(bo,{classes:"PaginationPageButton",icon:"arrow-right",iconPosition:"right",title:"Go to next page",onClick:t=>a(e+1,t.target),variant:"dark",children:"next"})})]})}function am({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=no((()=>{const t=r.filter((e=>qi(e)>0)),n=(e-1)*o,i=n+o,a=Math.ceil(t.length/o);return{paginatedThreads:t.slice(n,i),totalPages:a}}),[r,e,o]);return po(m,{children:[po(bp,{threads:i}),!t&&po(im,{currentPage:e,onChangePage:n,totalPages:a})]})}var sm=ri((function({loadAnnotationsService:e,streamer:t}){var n
|
|
570
570
|
;const r=ii(),o=r.getFilterValues(),i=r.focusedGroup(),a=r.forcedVisibleThreads().length,s=r.hasAppliedFilter(),l=r.isLoading(),c=r.annotationResultCount(),u=r.pendingUpdateCount(),h=Ki(),d=null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"…",p=(null==i?void 0:i.id)||r.directLinkedGroupId(),m=to(1),[f,g]=Zr(1),[v,y]=Zr(!1),_=e=>{e instanceof Qp&&y(!0)},b=r.hasFetchedProfile();Qr((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),Qr((()=>{r.setSortKey("Newest"),p&&e.load({groupId:p,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:_,streamFilterBy:"group"})}),[e,p,r]);const w=e=>{g(e)};Qr((()=>{w(1)}),[o,i]);const x=to(null);eo((()=>{f!==m.current&&(Rp(x.current),m.current=f)}),[f]);const k=`Show ${u} new or updated ${u>1?"annotations":"annotation"}`;return po("div",{className:"NotebookView",children:[po("header",{className:"NotebookView__heading",ref:x,children:po("h1",{className:"NotebookView__group-name",children:d})}),po("div",{className:"NotebookView__filters",children:po(rm,{})}),po("div",{
|
|
571
|
-
className:"NotebookView__results hyp-u-layout-row--align-center
|
|
571
|
+
className:"NotebookView__results hyp-u-layout-row--align-center text-lg font-medium",children:[u>0&&!s&&po(_o,{icon:"refresh",onClick:()=>t.applyPendingUpdates(),variant:"primary",title:k}),po(om,{forcedVisibleCount:a,isFiltered:s,isLoading:l,resultCount:c})]}),po("div",{className:"NotebookView__items",children:[v&&po("div",{className:"NotebookView__messages",children:po(Ho,{title:"Too many results to show",children:["This preview of the Notebook can show"," ",po("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."," ",po("a",{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})}),po(am,{currentPage:f,isLoading:l,onChangePage:w,threads:h.children})]})]})}),["loadAnnotationsService","streamer"])
|
|
572
572
|
;var lm=ri((function({toastMessenger:e}){const t=ii(),n=t.mainFrame(),r=t.focusedGroup(),o=`Share Annotations in ${r&&r.name||"..."}`,i=r&&n,a=i&&(s=n.uri,l=r.id,ma(s)?`https://hyp.is/go?url=${encodeURIComponent(s)}&group=${l}`:null);var s,l;return po(Pp,{title:o,panelName:"shareGroupAnnotations",children:[!i&&po("div",{className:"flex flex-row items-center justify-center",children:po(qo,{})}),i&&po("div",{className:"text-color-text-light space-y-3",children:a?po(m,{children:[po("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?po("p",{children:"Use this link to share these annotations with other group members:"}):po("p",{children:"Use this link to share these annotations with anyone:"})}),po("div",{children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share these annotations",type:"text",value:a,readOnly:!0}),po(_o,{icon:"copy",onClick:()=>{try{ba(a),e.success("Copied share link to clipboard")}catch(t){e.error("Unable to copy link")}},
|
|
573
573
|
title:"Copy share link",variant:"dark"})]})}),po("p",{"data-testid":"sharing-details",children:["private"===r.type?po("span",{children:["Annotations in the private group"," ",po("em",{children:r.name})," are only visible to group members."]}):po("span",{children:["Anyone using this link may view the annotations in the group"," ",po("em",{children:r.name}),"."]})," ",po("span",{children:["Private (",po(Mo,{name:"lock",classes:"inline -mt-0.5"})," ",po("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),po(xa,{shareURI:a})]}):po("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})})]})}),["toastMessenger"]);function cm({message:e,onDismiss:t}){const n=e.type.charAt(0).toUpperCase()+e.type.slice(1),r="notice"===e.type?"cancel":e.type;return po("li",{className:Ur("toast-message-container",{"is-dismissed":e.isDismissed}),onClick:()=>t(e.id),children:po("div",{className:Ur("toast-message",`toast-message--${e.type}`),
|
|
574
574
|
children:[po("div",{className:"toast-message__type",children:po(Mo,{name:r,classes:"toast-message__icon"})}),po("div",{className:"toast-message__message",children:[po("strong",{children:[n,": "]}),e.message,e.moreInfoURL&&po("div",{className:"toast-message__link",children:po("a",{href:e.moreInfoURL,onClick:e=>e.stopPropagation(),target:"_new",children:"More info"})})]})]})})}var um=ri((function({toastMessenger:e}){return po("div",{children:po("ul",{"aria-live":"polite","aria-relevant":"additions",className:"ToastMessages",children:ii().getToastMessages().map((t=>po(cm,{message:t,onDismiss:t=>e.dismiss(t)},t.id)))})})}),["toastMessenger"]);function hm(e){return e.organization&&e.organization.name}function dm(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n="__default__"===(r=e.organization).id?"__default__":`${r.name.toLowerCase()}${r.id}`;var r;void 0===t[n]&&(t[n]=Object.assign({},e.organization),t[n].groups=[]),function(e,t){const n=Object.assign({},e),r=t.groups
|
|
@@ -577,14 +577,14 @@ onToggleSubmenu:h,submenu:po(m,{children:[po("ul",{children:[i&&po("li",{childre
|
|
|
577
577
|
const t=ii(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=no((()=>pm(o)),[o]),l=no((()=>pm(r)),[r]),c=no((()=>pm(n)),[n]),u=t.defaultAuthority(),h=a&&!Qo(a,u),d=t.getLink("groups.new"),[p,m]=Zr(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=hm(i)?hm(i):"";f=po("span",{className:"GroupList__menu-label",children:[t&&po("img",{className:"GroupList__menu-icon",src:t,alt:n}),i.name]})}else f=po("span",{children:"…"});return!!qp(e)&&n.length+r.length+o.length<2?f:po($d,{align:"left",contentClass:"GroupList__content",label:f,onOpenChanged:()=>m(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[c.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"Currently Viewing",groups:c}),l.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"Featured Groups",groups:l}),s.length>0&&po(gm,{expandedGroup:p,onExpandGroup:m,heading:"My Groups",groups:s
|
|
578
578
|
}),h&&po(Vd,{icon:"add",href:d,label:"New private group"})]})}),["settings"]);function ym({alwaysExpanded:e,query:t,onSearch:n}){const r=ii().isLoading(),o=to(),[i,a]=Zr(t),[s,l]=Zr(t);return t!==i&&(l(t),a(t)),po("form",{action:"#",className:"SearchInput__form",name:"searchForm",onSubmit:e=>{e.preventDefault(),(o.current.value||i)&&n(o.current.value)},children:[po("input",{"aria-label":"Search",className:Ur("SearchInput__input",{"is-expanded":e||t}),dir:"auto",type:"text",name:"query",placeholder:r?"Loading…":"Search…",disabled:r,ref:o,value:s||"",onInput:e=>l(e.target.value)}),!r&&po("div",{className:"SearchInput__button-container",children:po(_o,{icon:"search",onClick:()=>o.current.focus(),size:"small",title:"Search annotations"})}),r&&po("div",{style:"margin:0.5em 0",children:po(qo,{size:"small"})})]})}function _m(){const e=ii(),t=e.sortKey(),n=e.sortKeys().map((n=>po(Vd,{label:n,onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"sort",
|
|
579
579
|
classes:"TopBar__menu-icon"})});return po("div",{className:"SortMenu",children:po($d,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}var bm=ri((function({router:e}){return po(ym,{query:ii().routeParams().q,onSearch:t=>{e.navigate("stream",{q:t})},alwaysExpanded:!0})}),["router"]);var wm=ri((function({auth:e,frameSync:t,onLogout:n,settings:r}){const o=ii(),i=o.defaultAuthority(),a=Qo(e.userid,i),s=P(r),l=o.isFeatureEnabled("notebook_launch"),[c,u]=Zr(!1),h=e=>s&&!!s[e],d=!a||h("onProfileRequestProvided"),p=!a||h("onLogoutRequestProvided"),m=()=>{t.notifyHost("openNotebook",o.focusedGroupId())},f=()=>a&&t.notifyHost("profileRequested"),g=(()=>{const t={};return d&&(a||(t.href=o.getLink("user",{user:e.username})),t.onClick=f),t})(),v=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"profile",classes:"TopBar__menu-icon"})});return po("div",{className:"UserMenu",onKeyDown:e=>{"n"===e.key&&(m(),u(!1))},children:po($d,{label:v,title:e.displayName,align:"right",open:c,
|
|
580
|
-
onOpenChanged:u,children:[po(mm,{children:[po(Vd,{label:e.displayName,isDisabled:!d,...g}),!a&&po(Vd,{label:"Account settings",href:o.getLink("account.settings")}),l&&po(Vd,{label:"Open notebook",onClick:()=>m()})]}),p&&po(mm,{children:po(Vd,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var xm=ri((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!qp(a),c=ti(["accentColor"],a),u=ii(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations"),g=()=>{const e=P(a);e&&e.onHelpRequestProvided?t.notifyHost("helpRequested"):u.toggleSidebarPanel("help")},v=po(m,{children:["unknown"===e.status&&po("span",{className:"TopBar__login-links",children:"⋯"}),"logged-out"===e.status&&po("span",{className:"TopBar__login-links
|
|
581
|
-
}),po(wo,{classes:"InlineLinkButton",onClick:r,style:c,variant:"primary",children:"Log in"})]}),"logged-in"===e.status&&po(wm,{auth:e,onLogout:o})]});return po("div",{className:"TopBar",children:[!n&&po("div",{className:"TopBar__inner content",children:[po(bm,{}),po("div",{className:"hyp-u-stretch"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]}),n&&po("div",{className:"TopBar__inner content",children:[po(vm,{}),po("div",{className:"hyp-u-stretch"}),d>0&&po(_o,{icon:"refresh",onClick:()=>s.applyPendingUpdates(),size:"small",variant:"primary",title:`Show ${d} new/updated ${1===d?"annotation":"annotations"}`}),po(ym,{query:h||null,onSearch:u.setFilterQuery}),po(_m,{}),l&&po(_o,{icon:"share",expanded:f,onClick:()=>{u.toggleSidebarPanel("shareGroupAnnotations")},size:"small",title:"Share annotations on this page"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]})]})}),["frameSync","settings","streamer"])
|
|
580
|
+
onOpenChanged:u,children:[po(mm,{children:[po(Vd,{label:e.displayName,isDisabled:!d,...g}),!a&&po(Vd,{label:"Account settings",href:o.getLink("account.settings")}),l&&po(Vd,{label:"Open notebook",onClick:()=>m()})]}),p&&po(mm,{children:po(Vd,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var xm=ri((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!qp(a),c=ti(["accentColor"],a),u=ii(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations"),g=()=>{const e=P(a);e&&e.onHelpRequestProvided?t.notifyHost("helpRequested"):u.toggleSidebarPanel("help")},v=po(m,{children:["unknown"===e.status&&po("span",{className:"TopBar__login-links",children:"⋯"}),"logged-out"===e.status&&po("span",{className:"TopBar__login-links text-lg font-medium hyp-u-horizontal-spacing--2",children:[po(wo,{classes:"InlineLinkButton",onClick:i,style:c,variant:"primary",children:"Sign up"}),po("div",{
|
|
581
|
+
children:"/"}),po(wo,{classes:"InlineLinkButton",onClick:r,style:c,variant:"primary",children:"Log in"})]}),"logged-in"===e.status&&po(wm,{auth:e,onLogout:o})]});return po("div",{className:"TopBar",children:[!n&&po("div",{className:"TopBar__inner content",children:[po(bm,{}),po("div",{className:"hyp-u-stretch"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]}),n&&po("div",{className:"TopBar__inner content",children:[po(vm,{}),po("div",{className:"hyp-u-stretch"}),d>0&&po(_o,{icon:"refresh",onClick:()=>s.applyPendingUpdates(),size:"small",variant:"primary",title:`Show ${d} new/updated ${1===d?"annotation":"annotations"}`}),po(ym,{query:h||null,onSearch:u.setFilterQuery}),po(_m,{}),l&&po(_o,{icon:"share",expanded:f,onClick:()=>{u.toggleSidebarPanel("shareGroupAnnotations")},size:"small",title:"Share annotations on this page"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]})]})}),["frameSync","settings","streamer"])
|
|
582
582
|
;var km=ri((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=ii(),a=i.hasFetchedProfile(),s=i.profile(),l=i.route(),c=no((()=>a?function(e){const t=Zo(e.userid);if(t&&e.userid){let n=t.username;return e.user_info&&e.user_info.display_name&&(n=e.user_info.display_name),{status:"logged-in",displayName:n,userid:e.userid,username:t.username}}return{status:"logged-out"}}(s):{status:"unknown"}),[a,s]),u=no((()=>ti(["appBackgroundColor"],n)),[n]),h="clean"===n.theme,d="sidebar"===l;Qr((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=P(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,s,n)&&i.openSidebarPanel("help")}),[d,s,n,i]);const p=async()=>{if(P(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},m=()=>{P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return po("div",{
|
|
583
583
|
className:Ur("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"HypothesisApp--notebook":"notebook"===l}),style:u,children:["notebook"!==l&&po(xm,{auth:c,onLogin:p,onSignUp:m,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),Xo({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),P(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),po("div",{className:"HypothesisApp__content",children:[po(um,{}),po(Kp,{auth:"logged-in"===c.status?c:{}}),po(lm,{}),l&&po("main",{children:["annotation"===l&&po(xp,{onLogin:p}),"notebook"===l&&po(sm,{}),"stream"===l&&po(Hp,{}),"sidebar"===l&&po(jp,{onLogin:p,onSignUp:m})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"])
|
|
584
584
|
;function Sm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Cm{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?fa(e.user):ga(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+q(8),l=Object.assign({created:t.toISOString(),group:r,permissions:va(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Ni(l)&&(l.permissions=fa(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Ni(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Ci(n)}),
|
|
585
585
|
Mi(n)?this._store.selectTab("note"):zi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ci(e)?ga(t,e.group):fa(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Si(e)?this._api.annotation.create({},n):this._api.annotation.update({id:e.id},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
|
|
586
586
|
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Cm.$inject=["api","store"];class Am extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),this.url=e,this.response=t,this.reason=n}}async function Em(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Am(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Am(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Am(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Tm(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function Nm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Lm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
|
|
587
|
-
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
587
|
+
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.973.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Tm(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await Em(m.toString(),{body:s?JSON.stringify(Nm(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={
|
|
588
588
|
list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}Lm.$inject=["apiRoutes","auth","store"];var Mm={};function zm(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Om=zm;zm.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},zm.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},zm.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
|
|
589
589
|
;if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},zm.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},zm.prototype.try=function(e){
|
|
590
590
|
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},zm.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},zm.prototype.start=zm.prototype.try,zm.prototype.errors=function(){return this._errors},zm.prototype.attempts=function(){return this._attempts},zm.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=Om;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
|
|
@@ -647,7 +647,7 @@ setForcedVisible:function(e,t){return{type:iv.SET_FORCED_VISIBLE,id:e,visible:t}
|
|
|
647
647
|
panelName:e}},toggleSidebarPanel:function(e,t){return{type:gv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}});const yv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},_v=Xm(yv);var bv=Mf({messages:[]},{namespace:"toastMessages",reducers:yv,actionCreators:{addToastMessage:function(e){return{type:_v.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:_v.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:_v.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}});const wv={
|
|
648
648
|
SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},xv=Xm(wv);var kv=Mf({sidebarHasOpened:!1},{namespace:"viewer",reducers:wv,actionCreators:{setSidebarOpened:function(e){return{type:xv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function Sv(e){return Lf([Rf,sg,ug,pg,wg,Ng,Ig,Xg,Wg,ev,Vf,mv,Bg,vv,bv,kv],[e],[zf])}Sv.$inject=["settings"];class Cv{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){
|
|
649
649
|
const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const Av=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),Ev=function(e){const{version:t,origin:n}=R(e.location.href)
|
|
650
|
-
;return"1.
|
|
650
|
+
;return"1.973.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.973.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function Tv(e,t){e.setClientId(t.clientId)}function Nv(e,t,n){e.load(),t.load(),n.sync()}function Lv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Mv(e,t){"sidebar"===t.route()&&e.connect()}Av.sentry&&Ev&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.973.0",beforeSend:(e,t)=>{if(Sr>=5)return K("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Sr;try{
|
|
651
651
|
const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{Yt("host_config",R(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),kr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(Av.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),Tv.$inject=["api","streamer"],Nv.$inject=["groups","session","router"],Lv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],Mv.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&mo.clear()
|
|
652
652
|
;for(let[t,n]of Object.entries(e))mo.set(t,n)}(Ko);const zv=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",te)}(),async function(e,t=window){const n=H(window),r=n.requestConfigFromFrame;if(!r)return V(e,n);if("string"==typeof r)return await G(e,t);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(Av).then((e=>{!function(e,t){const n=new Cv
|
|
653
653
|
;n.register("annotationsService",Cm).register("api",Lm).register("apiRoutes",Dm).register("auth",jm).register("autosaveService",Hm).register("features",$m).register("frameSync",Km).register("groups",Qm).register("loadAnnotationsService",ef).register("localStorage",nf).register("persistedDefaults",of).register("router",af).register("serviceURL",sf).register("session",lf).register("streamer",hf).register("streamFilter",cf).register("tags",df).register("threadsService",pf).register("toastMessenger",mf).register("store",{factory:Sv}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Lv),n.run(Tv),n.run(Nv),n.run(ee),n.run(Mv),I(po(ni.Provider,{value:n,children:po(km,{})}),t)}(e,zv)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(po(Sm,{error:e}),t)}(e,zv)));
|