hypothesis 1.1114.0 → 1.1115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";function s(s){s.setAttribute("data-hypothesis-asset","")}function t(t,e){var n=t.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,s(n),t.head.appendChild(n)}function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,a=n.forceReload,i=void 0!==a&&a,l=t.createElement("script");o&&(l.type="module"),i&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,s(l),t.head.appendChild(l)}function n(t,e,n,r){var o=t.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),s(o),t.head.appendChild(o)}function r(t,e,n){var r=t.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),s(r),t.head.appendChild(r)}function o(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function i(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function l(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=i(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}var c={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?b010ae","styles/annotator.css":"styles/annotator.css?ee3462","styles/annotator.css.map":"styles/annotator.css.map?82cd76","styles/highlights.css":"styles/highlights.css?5dd56a","styles/highlights.css.map":"styles/highlights.css.map?5d963f","styles/katex.min.css":"styles/katex.min.css?817f75","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?f81607","styles/sidebar.css.map":"styles/sidebar.css.map?8234f5","styles/ui-playground.css.map":"styles/ui-playground.css.map?f09223","styles/ui-playground.css":"styles/ui-playground.css?0d14bc","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?f7e62d","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?4e9c56","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?527358","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?afc149","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?5c6e03"};if(function(){var s=[function(){return Promise.resolve()},function(){return new Map},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=l(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1115.0/");if(document.querySelector("hypothesis-app")){!function(s,n){r(s,"fetch",n.apiUrl),r(s,"fetch",n.apiUrl+"links");for(var a=0,i=["scripts/sidebar.bundle.js"];a<i.length;a++)e(s,o(n,i[a]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,o(n,c[l]))}(document,{assetRoot:u,manifest:c,apiUrl:p.apiUrl})}else{var d=p,h=l(d.notebookAppUrl||"https://hypothes.is/notebook"),y=l(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,a){if(!s.querySelector('link[type="application/annotator+html"]')){n(s,"sidebar","html",a.sidebarAppUrl),n(s,"notebook","html",a.notebookAppUrl),r(s,"style",o(a,"styles/annotator.css")),n(s,"hypothesis-client","javascript",a.assetRoot+"build/boot.js");for(var i=0,l=["scripts/annotator.bundle.js"];i<l.length;i++)e(s,o(a,l[i]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)t(s,o(a,u[p]))}}(document,{assetRoot:u,manifest:c,notebookAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?b010ae",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?ee3462",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?82cd76",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?5dd56a",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
|
|
11
11
|
"styles/sidebar.css": "styles/sidebar.css?f81607",
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?8234f5",
|
|
13
|
-
"styles/ui-playground.css": "styles/ui-playground.css?0d14bc",
|
|
14
13
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?f09223",
|
|
14
|
+
"styles/ui-playground.css": "styles/ui-playground.css?0d14bc",
|
|
15
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?f7e62d",
|
|
15
16
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?4e9c56",
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?01e498",
|
|
17
17
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?527358",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?afc149",
|
|
19
19
|
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?5c6e03"
|
|
@@ -107,7 +107,7 @@ const[t,e]=await Promise.all([this._integration.uri(),this._integration.getMetad
|
|
|
107
107
|
destroy(){this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),function(t){Ie(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{const e=ji(t);if(!e)return;const n=Me(e);n.forEach((e=>{e._annotation=t.annotation})),t.highlights=n,this._hoveredAnnotations.has(t.annotation.$tag)&&Be(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 i=await this._integration.anchor(this.element,e.selector),o=Ee.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(let t of n)e(t)
|
|
108
108
|
;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&&Ie(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){this.anchors=t,e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,$highlight:t,$tag:"a:"+Ct(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Xi(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(let e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);Be(e.highlights,n)}
|
|
109
109
|
this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){const n=function(t,e){let n=null,i=0;for(let r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=He(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){if(!this._integration.canAnnotate(t))return void this._onClearSelection();const e=document.getSelection(),n=Ne(e),i=Le(e);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Wi(),this._isAdderVisible=!0,this._adder.show(i,n)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){
|
|
110
|
-
e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Zt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Zi(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Gi(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
110
|
+
e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Zt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Zi(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Gi(t,e){var n;const i={};for(let[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1115.0";const o=new URL(window.location.href)
|
|
111
111
|
;if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function Ki({config:t,groupId:e}){return lt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Zi(t.notebookAppUrl,{...Gi(t.notebookAppUrl,t),group:e})})}function Qi({eventBus:t,config:e}){const[n,i]=G(0),[o,r]=G(!0),[s,a]=G(null),l=J(""),h=J(null);K((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),K((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),K((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),h.current=e,()=>{e.destroy()}}),[t])
|
|
112
112
|
;return null===s?null:lt("div",{className:c("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:lt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[lt("div",{className:"absolute right-0 text-xl m-3",children:lt(pt,{icon:"cancel",title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=h.current)||void 0===t||t.publish("closeNotebook")},variant:"dark"})}),lt(Ki,{config:e,groupId:s},n)]})})}class Ji{constructor(t,e,n){this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this.shadowRoot=ve(this._outerContainer),I(lt(Qi,{eventBus:e,config:n}),this.shadowRoot)}destroy(){I(null,this.shadowRoot),this._outerContainer.remove()}}var to={exports:{}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l=Math.round,c=Math.abs,h=Date.now;function u(t,e,n){return setTimeout(v(t,n),e)}function d(t,e,n){
|
|
113
113
|
return!!Array.isArray(t)&&(f(t,n[e],n),!0)}function f(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==o)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function p(t,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=e.console&&(e.console.warn||e.console.log);return r&&r.call(e.console,o,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(t){if(t===o||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==o&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var g=p((function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===o)&&(t[i[r]]=e[i[r]]),r++;return t
|
|
@@ -581,7 +581,7 @@ function Hf({onLogin:e,onSignUp:t}){return ss().isLoggedIn()?null:Vr(Ff,{icon:"r
|
|
|
581
581
|
r.selectTab(e)},u="annotation"===i&&0===a&&!l,h="note"===i&&0===o;return Vr("div",{className:qn("space-y-3 pb-[9px]"),children:[Vr("div",{className:"flex gap-x-6 theme-clean:ml-[15px]",role:"tablist",children:[Vr(Uf,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===i,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),Vr(Uf,{count:o,isWaitingToAnchor:l,isSelected:"note"===i,label:"Page notes",onSelect:()=>c("note"),children:"Page Notes"}),s>0&&Vr(Uf,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===i,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===i&&n.enableExperimentalNewNoteButton&&Vr("div",{className:"flex justify-end",children:Vr(Qr,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:Oi(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&Vr(ni,{classes:"text-center",children:Vr("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&Vr(ni,{
|
|
582
582
|
classes:"text-center",children:Vr("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",Vr("br",{}),"Create one by selecting some text and clicking the"," ",Vr(hi,{classes:"inline m-0.5 -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var qf=Di((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:i}){const o=Ds(),a=ss(),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?As(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,_=!(c||!h)&&!d,b=a.directLinkedGroupFetchFailed(),y=_||b,w=!y,x=!y&&!l,k=h&&!u&&!_&&!c,S=Or(s);zr((()=>{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})
|
|
583
583
|
}),[a,r,s,g,m]),zr((()=>{v?(e.hoverAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return zr((()=>{C&&(f||u)&&i.connect({applyUpdatesImmediately:!1})}),[C,u,f,i]),Vr("div",{children:[Vr("h2",{className:"sr-only",children:"Annotations"}),w&&Vr(Mf,{}),Vr(Hf,{onLogin:t,onSignUp:n}),_&&Vr(Af,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),b&&Vr(Af,{errorType:"group",onLoginRequest:t}),x&&Vr(jf,{isLoading:c}),Vr(Ef,{threads:o.children}),k&&Vr(Lf,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var $f=Di((function({api:e,toastMessenger:t}){const n=ss(),r=n.routeParams().q,i=Dr((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...ys(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return zr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),i(r).catch((e=>{
|
|
584
|
-
t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,i,n,t]),Vr(Ef,{threads:Ds().children})}),["api","toastMessenger"]);class Gf{constructor(e,t,n=window){var r,i,o;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.
|
|
584
|
+
t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,i,n,t]),Vr(Ef,{threads:Ds().children})}),["api","toastMessenger"]);class Gf{constructor(e,t,n=window){var r,i,o;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1115.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(i=t[0])||void 0===i||null===(o=i.metadata)||void 0===o?void 0:o.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 Vf(e){const n=t(e);return!(null==n||!n.authority)&&n.authority!==e.authDomain}function Yf({commandName:e,iconName:t}){return Vr("span",{className:"whitespace-nowrap",children:[Vr(hi,{name:t,
|
|
585
585
|
classes:qn("mx-1 -mt-1","text-color-text-light inline")}),Vr("em",{children:e})]})}var Wf=Di((function({settings:e}){const t=!Vf(e);return Vr("ol",{className:"list-decimal pl-10 space-y-2",children:[Vr("li",{children:["To create an annotation, select text and then select the"," ",Vr(Yf,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),Vr("li",{children:["To create a highlight (",Vr(di,{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"," ",Vr(Yf,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&Vr("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"," ",Vr(di,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),Vr("li",{
|
|
586
586
|
children:["To reply to an annotation, select the"," ",Vr(Yf,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);function Kf({label:e,children:t,classes:n}){return Vr(Xn,{children:[Vr("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Vr("dd",{className:qn("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})}var Xf=Di((function({toastMessenger:e,versionData:t}){return Vr("div",{className:"space-y-4",children:[Vr("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Vr(Kf,{label:"Version",children:t.version}),Vr(Kf,{label:"User Agent",children:t.userAgent}),Vr(Kf,{classes:qn("break-all"),label:"URL",children:t.urls}),Vr(Kf,{label:"Fingerprint",children:t.fingerprint}),Vr(Kf,{label:"Account",children:t.account}),Vr(Kf,{label:"Date",children:t.timestamp})]}),Vr("div",{className:"flex items-center justify-center",children:Vr(Qr,{onClick:()=>{try{ll(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){
|
|
587
587
|
e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Zf({children:e,onClick:t}){return Vr(ei,{classes:"leading-none text-brand",onClick:t,children:[e,Vr(hi,{classes:"ml-1",name:"arrow-right"})]})}function Jf({linkText:e,url:t}){return Vr("div",{className:"flex-1 border-r last-of-type:border-r-0",children:Vr(di,{href:t,classes:"flex items-center justify-center space-x-2 text-color-text-light text-lg font-medium",target:"_blank",children:[Vr("span",{children:e})," ",Vr(hi,{name:"external",classes:"w-3 h-3"})]})})}var Qf=Di((function({auth:e,session:t}){const n=ss(),r=n.frames(),i=n.mainFrame(),o=!!n.profile().preferences.show_sidebar_tutorial,[a,s]=Mr("tutorial"),l=Ir((()=>{const t=e||{status:"logged-out"},n=[...r].sort(((e,t)=>e===i?-1:t===i?1:0));return new Gf(t,n)}),[e,r,i]),c=`https://web.hypothes.is/get-help/?sys_info=${l.asEncodedURLString()}`,u=(e,t)=>{e.preventDefault(),s(t)};return Vr(Ff,{title:"Help",panelName:"help",
|
|
@@ -611,7 +611,7 @@ const c=!Vf(s),u=Oi(["accentColor"],s),h=ss(),d=h.filterQuery(),p=h.pendingUpdat
|
|
|
611
611
|
;return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?rl(e.user):il(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),i=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const o=i.userid;if(!o)throw new Error("Cannot create annotation when logged out");const s=i.user_info,l="s:"+a(8),c=Object.assign({created:t.toISOString(),group:r,permissions:ol(o,r,n),tags:[],text:"",updated:t.toISOString(),user:o,user_info:s,$tag:l,hidden:!1,links:{},document:{title:""}},e);return Co(c)&&(c.permissions=rl(o)),c}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Co(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!wo(n)}),Ao(n)?this._store.selectTab("note"):To(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){
|
|
612
612
|
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._activity.reportActivity("delete",e),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._activity.reportActivity("flag",e),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:wo(e)?il(t,e.group):rl(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t,n;const r=this._applyDraftChanges(e);let i;bo(e)?(t=this._api.annotation.update({id:e.id},r),n="update"):(t=this._api.annotation.create({},r),n="create"),this._store.annotationSaveStarted(e);try{i=await t,this._activity.reportActivity(n,i)}finally{this._store.annotationSaveFinished(e)}for(let[t,n]of Object.entries(e))if(t.startsWith("$")){i[t]=n}
|
|
613
613
|
return this._store.removeDraft(e),this._store.addAnnotations([i]),i}}zg.$inject=["annotationActivity","api","store"];class Rg{constructor(e){this._rpc=e.rpc,this._reportConfig=e.reportActivity}reportActivity(e,t){if(!this._rpc||!this._reportConfig)return;let n;switch(e){case"create":n=new Date(t.created).toISOString();break;case"update":n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id,isShared:al(t.permissions)}};this._reportConfig.events.includes(e)&&function(e,t,n,r=[]){const i={jsonrpc:"2.0",method:n,params:r};e.postMessage(i,t)}(this._rpc.targetFrame,this._rpc.origin,this._reportConfig.method,[e,r])}}Rg.$inject=["settings"];class Og 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 Ig(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Og(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){
|
|
614
|
-
throw new Og(e,n,"Failed to parse response")}var i;if(!n.ok)throw new Og(e,n,null===(i=r)||void 0===i?void 0:i.reason);return r}function Dg(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function Pg(e){return"url"in e}function Bg(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:i,onRequestFinished:o}){return async(a,s)=>{i();try{const[i,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const i=n[t];if(!i||Pg(i)){if(i&&e===r.length-1)return i;break}n=i}return null}(i,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
614
|
+
throw new Og(e,n,"Failed to parse response")}var i;if(!n.ok)throw new Og(e,n,null===(i=r)||void 0===i?void 0:i.reason);return r}function Dg(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function Pg(e){return"url"in e}function Bg(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:i,onRequestFinished:o}){return async(a,s)=>{i();try{const[i,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const i=n[t];if(!i||Pg(i)){if(i&&e===r.length-1)return i;break}n=i}return null}(i,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1115.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Ra(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 Ig(m.toString(),{body:s?JSON.stringify(Dg(s)):null,headers:u,
|
|
615
615
|
method:c.method})}finally{o()}}}class Fg{constructor(e,t,n){const r=e.routes();this._clientId=null;const i=()=>this._clientId,o=e=>Bg(r,e,{getAccessToken:t.getAccessToken,getClientId:i,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=o("search"),this.annotation={create:o("annotation.create"),delete:o("annotation.delete"),get:o("annotation.read"),update:o("annotation.update"),flag:o("annotation.flag"),hide:o("annotation.hide"),unhide:o("annotation.unhide")},this.group={member:{delete:o("group.member.delete")},read:o("group.read")},this.groups={list:o("groups.read")},this.profile={groups:{read:o("profile.groups.read")},read:o("profile.read"),update:o("profile.update")}}setClientId(e){this._clientId=e}}Fg.$inject=["apiRoutes","auth","store"];var Hg={exports:{}},Ug={};function jg(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,
|
|
616
616
|
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 qg=jg;jg.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},jg.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},jg.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();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++,
|
|
617
617
|
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},jg.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)},jg.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},jg.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},jg.prototype.start=jg.prototype.try,jg.prototype.errors=function(){return this._errors},jg.prototype.attempts=function(){return this._attempts},jg.prototype.mainError=function(){if(0===this._errors.length)return null
|
|
@@ -645,8 +645,8 @@ n=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetc
|
|
|
645
645
|
nv(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}bv.$inject=["store","apiRoutes","auth","groups","session"];class yv{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject("hypothesis.user.tags.list")||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const i=n.split(/\W+/),o=new RegExp(`^${p(e)}`,"i");return!(!i.some((e=>e.match(o)))&&!n.match(o))&&(++r,!0)}))}store(e){const t=this._storage.getObject("hypothesis.user.tags.map")||{};e.forEach((e=>{t[e]?(t[e].count+=1,t[e].updated=Date.now()):t[e]={text:e,count:1,updated:Date.now()}})),this._storage.setObject("hypothesis.user.tags.map",t);const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject("hypothesis.user.tags.list",n)}}yv.$inject=["localStorage"];class wv{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),
|
|
646
646
|
e.visible||this._store.setForcedVisible(e.id,!0)}}wv.$inject=["store"];class xv{constructor(e){this._store=e}dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r="",visuallyHidden:i=!1}={}){if(this._store.hasToastMessage(e,t))return;const o=a(10),s={type:e,id:o,message:t,moreInfoURL:r,visuallyHidden:i};this._store.addToastMessage({isDismissed:!1,...s}),n&&setTimeout((()=>{this.dismiss(o)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}xv.$inject=["store"];class kv{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),
|
|
647
647
|
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){const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let i;if(t.class)i=new t.class(...n);else{i=(0,t.factory)(...n)}return this._instances.set(e,i),i}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 Sv=function(e){
|
|
648
|
-
for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var i=void 0;try{i=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}Object.assign(t,i)}return t}(document),Cv=function(t){const{version:n,origin:r}=e(t.location.href);return"1.
|
|
649
|
-
}(),r=n?[n]:void 0;Ln({dsn:t.dsn,environment:t.environment,allowUrls:r,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
648
|
+
for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var i=void 0;try{i=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}Object.assign(t,i)}return t}(document),Cv=function(t){const{version:n,origin:r}=e(t.location.href);return"1.1115.0"!==n?(console.warn(`The Hypothesis sidebar is using a different version (1.1115.0) than the host page (${n}). It may not work.`),!1):"null"===t.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):t.origin===r||(console.warn(`The Hypothesis sidebar is running in a different origin (${t.origin}) than expected (${r}). It may not work.`),!1)}(window);function Ev(e,t){e.setClientId(t.clientId)}function Av(e,t,n){e.load(),t.load(),n.sync()}function Tv(e,t,n){e.init(),t.init(),n.init()}function Nv(e,t){"sidebar"===t.route()&&e.connect()}Sv.sentry&&Cv&&function(t){const n=function(){let e=import.meta.url;return e?new URL(e).origin:null
|
|
649
|
+
}(),r=n?[n]:void 0;Ln({dsn:t.dsn,environment:t.environment,allowUrls:r,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1115.0",beforeSend:(e,t)=>{if(On>=5)return u("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++On;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch(e){}return e}});try{mt("host_config",e(window.location.href))}catch(e){}mt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Rn(((e,t)=>{pt(e,{tags:{context:t}})}))}(Sv.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),Ev.$inject=["api","streamer"],Av.$inject=["groups","session","router"],Tv.$inject=["autosaveService","persistedDefaults","serviceURL"],
|
|
650
650
|
Nv.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&Yr.clear();for(let[t,n]of Object.entries(e))Yr.set(t,n)}(Ti);const Mv=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",v)}(),async function(o,a=window){const c=function(t){const o=e(t.location.href),a=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],s={openSidebar:n,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:i(t.origin),ancestorLevel:r(t.ancestorLevel)}}},l={};for(let[e,t]of Object.entries(o))a.includes(e)&&null!==t&&(s[e]?l[e]=s[e](t):l[e]=t);return l}(window),u=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null
|
|
651
651
|
;if("number"!=typeof n.ancestorLevel||"string"!=typeof n.origin)throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified");return{targetFrame:l(n.ancestorLevel,t),origin:n.origin}}(c,a);let h;if(u){const e=await async function(e,t){return{...await s(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(c,u);h=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=s(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,u)}else h=c;const d={...o,...h};return u&&(d.rpc=u),d.apiUrl=function(e){const n=t(e);if(n){if(n.apiUrl)return n.apiUrl;throw new Error("Service should contain an apiUrl value.")}return e.apiUrl}(d),d}(Sv).then((e=>{!function(e,t){const n=new kv
|
|
652
652
|
;n.register("annotationsService",zg).register("annotationActivity",Rg).register("api",Fg).register("apiRoutes",Yg).register("auth",Xg).register("autosaveService",Zg).register("frameSync",ov).register("groups",lv).register("loadAnnotationsService",cv).register("localStorage",hv).register("persistedDefaults",pv).register("router",mv).register("serviceURL",fv).register("session",gv).register("streamer",bv).register("streamFilter",vv).register("tags",yv).register("threadsService",wv).register("toastMessenger",xv).register("store",{factory:as}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Tv),n.run(Ev),n.run(Av),n.run(g),n.run(Nv),gr(Vr(Ii.Provider,{value:n,children:Vr(Mg,{})}),t)}(e,Mv)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),gr(Vr(Lg,{error:e}),t)}(e,Mv)));
|