hypothesis 1.1470.0 → 1.1471.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 +9 -9
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/sidebar.bundle.js +6 -6
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/sidebar.css +21 -2
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +21 -2
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
package/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?c967bf","styles/annotator.css":"styles/annotator.css?ec72d0","styles/annotator.css.map":"styles/annotator.css.map?de3818","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","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?a62dca","styles/sidebar.css.map":"styles/sidebar.css.map?eeb154","styles/ui-playground.css.map":"styles/ui-playground.css.map?dc82be","styles/ui-playground.css":"styles/ui-playground.css?ee796c","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?59270c","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?4da4a8","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?0663e4","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?0ad0cd","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?26a060"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(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)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=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),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1471.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,u=a(d.notebookAppUrl||"https://hypothes.is/notebook"),h=a(d.profileAppUrl||"https://hypothes.is/user-profile"),y=a(d.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,d=c;p<d.length;p++)e(s,i(t,d[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:u,profileAppUrl: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?c967bf",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?ec72d0",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?de3818",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"styles/katex.min.css.map": "styles/katex.min.css.map?cd8c0e",
|
|
9
9
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
|
|
10
10
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
|
|
11
|
-
"styles/sidebar.css": "styles/sidebar.css?
|
|
12
|
-
"styles/sidebar.css.map": "styles/sidebar.css.map?
|
|
13
|
-
"styles/ui-playground.css": "styles/ui-playground.css?
|
|
14
|
-
"styles/ui-playground.css
|
|
15
|
-
"scripts/
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?dc6285",
|
|
11
|
+
"styles/sidebar.css": "styles/sidebar.css?a62dca",
|
|
12
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?eeb154",
|
|
13
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?dc82be",
|
|
14
|
+
"styles/ui-playground.css": "styles/ui-playground.css?ee796c",
|
|
15
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?59270c",
|
|
17
16
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?4da4a8",
|
|
18
|
-
"scripts/
|
|
19
|
-
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?0ad0cd"
|
|
17
|
+
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?0663e4",
|
|
18
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?0ad0cd",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?26a060"
|
|
20
20
|
}
|
|
@@ -140,7 +140,7 @@ this._sidebarRPC.on("scrollToAnnotation",(t=>{this._scrollToAnnotation(t)})),thi
|
|
|
140
140
|
this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),null===(e=this._outsideAssignmentNotice)||void 0===e||e.destroy(),function(t){ti(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){this._contentReady&&(await this._contentReady,this._contentReady=void 0);const e=t=>{var e;const n=vr(t);if(!n)return;const i=Qn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&ei(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Un.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={
|
|
141
141
|
annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&ti(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+s(8)};return this._sidebarRPC.call("createAnnotation",r),
|
|
142
142
|
this.anchor(r),br(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ei(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=jn(n),o=Gn(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=gr(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}
|
|
143
|
-
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._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){le(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(t){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new fr(this.element)),this._outsideAssignmentNotice.setVisible(t)}}function xr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Cr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
143
|
+
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._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){le(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(t){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new fr(this.element)),this._outsideAssignmentNotice.setVisible(t)}}function xr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Cr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1471.0";const o=new URL(window.location.href);if(o.hash="",
|
|
144
144
|
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 Sr({closed:t,onClose:e,children:n,"data-testid":i,"aria-label":o}){const r=Kt(null);return Yt((()=>{var e,n;t?null===(e=r.current)||void 0===e||e.close():null===(n=r.current)||void 0===n||n.showModal()}),[t]),Yt((()=>{const t=r.current;return null==t||t.addEventListener("cancel",e),()=>{null==t||t.removeEventListener("cancel",e)}}),[e]),we("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":i,"aria-label":o,children:n})}function Nr({closed:t,children:e,...n}){return we("div",{...n,className:be("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:t}),children:we("div",{
|
|
145
145
|
className:"relative w-full h-full",children:e})})}function Er({document_:t=document,...e}){return we(Zt((()=>function(t){return"function"==typeof t.createElement("dialog").showModal}(t)?Sr:Nr),[t]),{...e})}function Ar({config:t,groupId:e}){return we("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:xr(t.notebookAppUrl,{...Cr(t.notebookAppUrl,t),group:e})})}function Tr({eventBus:t,config:e}){const[n,i]=Xt(0),[o,r]=Xt(!0),[s,a]=Xt(null),l=Kt(""),c=Kt(null);Yt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),Yt((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),Yt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);const h=Qt((()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")}),[]);return null===s?null:we(Er,{closed:o,onClose:h,"data-testid":"notebook-outer",
|
|
146
146
|
"aria-label":"Hypothesis notebook",children:[we("div",{className:"absolute right-0 m-3",children:we(an,{title:"Close notebook",onClick:h,variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:we(ke,{className:"w-4 h-4"})})}),we(Ar,{config:e,groupId:s},n)]})}class kr{constructor(t,e,n){i(this,"_container",void 0),this._container=new kn("notebook",(()=>we(Tr,{eventBus:e,config:n}))),t.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Rr({eventBus:t,config:e}){const[n,i]=Xt(!0),o=Kt(null);Yt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);const r=()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")};return n?null:we(Er,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[we("div",{className:"absolute right-0 m-3",children:we(an,{title:"Close profile dialog",onClick:r,
|
|
@@ -552,7 +552,7 @@ matches:(e,t)=>uf(e,t)===lf.Overlap,normalize:e=>e.trim()},since:{fieldValues:e=
|
|
|
552
552
|
;t[i]?t[i].push(o):t[i]=[o]}return t}function kf(e){return qo(e)?"orphan":Go(e)?"note":"annotation"}function Nf(e){return rs([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function Sf(e){return rs([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}const Af={Newest:(e,t)=>{const n=Nf(e),r=Nf(t);return n>r?-1:n<r?1:0},Oldest:(e,t)=>{const n=Sf(e),r=Sf(t);return n<r?-1:n>r?1:0},Location:(e,t)=>{var n,r;if(!e.annotation||!t.annotation)return function(e,t){return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const o=Yo(e.annotation),i=Yo(t.annotation);if(o.cfi&&i.cfi){const e=of(o.cfi,i.cfi);if(0!==e)return Math.sign(e)}else{if(o.cfi)return-1;if(i.cfi)return 1}const a=null!==(n=o.position)&&void 0!==n?n:Number.MAX_SAFE_INTEGER,s=null!==(r=i.position)&&void 0!==r?r:Number.MAX_SAFE_INTEGER;return Math.sign(a-s)}};const Ef=function(e){if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){
|
|
553
553
|
const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,sortCompareFn:Af[t.sortKey]};if(!!t.filterQuery||Object.keys(t.filters).length>0){const e=function(e,t={}){const n=e=>{const n=t[e];return"string"==typeof n?[n]:[]},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=wf(e,vf);for(const e of h){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and"},cfi:{terms:r,operator:"or"},quote:{terms:i,operator:"and"},page:{terms:o,operator:"or"},since:{
|
|
554
554
|
terms:d,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=(e,t)=>new mf(t,gf[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new pf("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new pf(t.operator,r)})),o=new pf("and",r);return e.filter((e=>e.id&&o.matches(e))).map((e=>e.id))}([t],e).length>0}const r=tf(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(!e.annotation)return!1;if(jo(e.annotation))return!1;const n=kf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Tf(){const e=Ia(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=de((()=>{const e={...o,filterQuery:n,filters:i};return{
|
|
555
|
-
annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return Ef(s)}var Cf=Qr((function({loadAnnotationsService:e,onLogin:t}){var n;const r=Ia(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",{rootThread:i}=Tf(),a=r.profile().userid,[s,l]=ae(!1);return le((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),De(v,{children:[s&&De(za,{errorType:"annotation",onLoginRequest:t}),De(Gp,{threads:i.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){var r,o,i;H(this,"version",void 0),H(this,"userAgent",void 0),H(this,"urls",void 0),H(this,"fingerprint",void 0),H(this,"account",void 0),H(this,"timestamp",void 0),H(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.
|
|
555
|
+
annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return Ef(s)}var Cf=Qr((function({loadAnnotationsService:e,onLogin:t}){var n;const r=Ia(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",{rootThread:i}=Tf(),a=r.profile().userid,[s,l]=ae(!1);return le((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),De(v,{children:[s&&De(za,{errorType:"annotation",onLoginRequest:t}),De(Gp,{threads:i.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){var r,o,i;H(this,"version",void 0),H(this,"userAgent",void 0),H(this,"urls",void 0),H(this,"fingerprint",void 0),H(this,"account",void 0),H(this,"timestamp",void 0),H(this,"segment",void 0);const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.1471.0",this.userAgent=n.navigator.userAgent,
|
|
556
556
|
this.urls=t.map((e=>e.uri)).join(", ")||a,this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(o=o.metadata)||void 0===o?void 0:o.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString();const l=null===(i=t[0])||void 0===i?void 0:i.segment;if(l){const e=[];if(l.cfi&&e.push(["CFI",l.cfi]),l.pages){const t=`${l.pages.start}-${l.pages.end}`;e.push(["Pages",t])}l.url&&e.push(["URL",l.url]),this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}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())}}var If="complete",zf="canceled";function Lf(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function Of(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){
|
|
557
557
|
var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,m=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h;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-=m,o-=p,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),b=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=b+l*g-t.clientHeight*g,r-=m,o-=p,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 Lf(e,r.x,r.y),
|
|
558
558
|
e._scrollSettings=null,t.end(If);var a=1-t.ease(i);if(Lf(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&Of(t.scrollAncestor),void Of(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(Of.bind(null,e))}}function Rf(e){return e.self===e}function Pf(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Df(){return!0}function Ff(e){if(e.assignedSlot)return Ff(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?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 Bf=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||{}
|
|
@@ -570,9 +570,9 @@ onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by us
|
|
|
570
570
|
function ag({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),n.blur()};return De("div",{className:"flex items-center text-md","data-testid":"pagination-navigation",children:[De("div",{className:"w-28 h-10",children:o&&De(ig,{title:"Go to previous page",onClick:t=>a(e-1,t.target),children:[De(Qe,{}),"prev"]})}),De("ul",{className:Oe("hidden","md:flex md:items-center md:justify-center md:gap-x-2","md:grow"),children:i.map(((t,n)=>De("li",{children:null===t?De("div",{"data-testid":"pagination-gap",children:"..."}):De(ig,{title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),children:t.toString()},`page-${n}`)},n)))}),De("div",{className:Oe("w-28 h-10 flex justify-end","grow md:grow-0"),children:r&&De(ig,{
|
|
571
571
|
title:"Go to next page",onClick:t=>a(e+1,t.target),children:["next",De(tt,{})]})})]})}function sg({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=de((()=>{const t=r.filter((e=>ns(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 De(v,{children:[De(Gp,{threads:i}),!t&&De(ag,{currentPage:e,onChangePage:n,totalPages:a})]})}const lg={alt:1,ctrl:2,meta:4,shift:8};function cg(e,t,{rootElement:n=(e=>null!==(e=document.documentElement)&&void 0!==e?e:void 0)()}={}){const r=n=>{(function(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let r=0,o=null;for(const e of n){const t=lg[e];if(t)r|=t;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=e}}if(!o)throw new Error(`Invalid shortcut: ${t}`);return((e.ctrlKey?lg.ctrl:0)|(e.metaKey?lg.meta:0)|(e.altKey?lg.alt:0)|(e.shiftKey?lg.shift:0))===r&&e.key.toLowerCase()===o})(n,e)&&t(n)}
|
|
572
572
|
;return n?(n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r)):()=>{}}function ug(e,t,{rootElement:n}={}){le((()=>{if(e)return cg(e,t,{rootElement:n})}),[e,t,n])}var dg=Qr((function({streamer:e,toastMessenger:t}){const n=Ia(),r=n.pendingUpdateCount(),o=n.hasPendingUpdates(),i=he((()=>e.applyPendingUpdates()),[e]);return ug("l",(()=>o&&i())),le((()=>{o&&(t.notice("New annotations are available.",{visuallyHidden:!0}),t.notice('Press "l" to load new annotations.',{visuallyHidden:!0,delayed:!0}))}),[o,t]),o?De(rr,{icon:zn,onClick:i,size:"xs",variant:"primary",title:`Show ${r} new/updated ${1===r?"annotation":"annotations"}`}):null}),["streamer","toastMessenger"]);var hg=Qr((function({streamer:e,setTimeout_:t=setTimeout,clearTimeout_:n=clearTimeout}){const r=Ia(),o=r.pendingUpdateCount(),i=r.hasPendingUpdatesOrDeletions(),a=he((()=>e.applyPendingUpdates()),[e]),[s,l]=ae(!1),c=ue(null);return ug("l",(()=>i&&a())),le((()=>(i?c.current=t((()=>{l(!0),c.current=null}),5e3):l(!1),
|
|
573
|
-
()=>c.current&&n(c.current))),[n,i,t]),i?De("div",{role:"status",className:"animate-
|
|
573
|
+
()=>c.current&&n(c.current))),[n,i,t]),i?De("div",{role:"status",className:"absolute right-0 animate-updates-notification-slide-in",children:De(Zn,{onClick:a,unstyled:!0,classes:Oe("flex gap-1.5 items-center py-1 px-2","rounded shadow-lg bg-gray-900 text-white"),onMouseEnter:()=>l(!1),onFocus:()=>l(!1),onMouseLeave:()=>!c.current&&l(!0),onBlur:()=>!c.current&&l(!0),children:[De(zn,{}),!s&&De("span",{"data-testid":"full-notification",className:"whitespace-nowrap",children:["Load ",De("span",{className:"font-bold",children:o})," updates"," ",De("span",{className:"sr-only",children:"by pressing l"})]}),s&&De("span",{"data-testid":"collapsed-notification",className:"font-bold",children:o})]})}):null}),["streamer"]);var mg=Qr((function({loadAnnotationsService:e,streamer:t}){var n
|
|
574
574
|
;const r=Ia(),o=r.getFilterValues(),i=r.focusedGroup(),a=r.forcedVisibleThreads().length,s=r.hasAppliedFilter(),l=r.isLoading(),c=r.annotationResultCount(),u=r.isFeatureEnabled("pending_updates_notification"),{rootThread:d}=Tf(),h=null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"…",m=(null==i?void 0:i.id)||r.directLinkedGroupId(),p=ue(1),[f,g]=ae(1),[v,b]=ae(!1),_=e=>{e instanceof Qf&&b(!0)},y=r.hasFetchedProfile();le((()=>{y&&t.connect({applyUpdatesImmediately:!1})}),[y,t]),le((()=>{r.setSortKey("Newest"),m&&e.load({groupId:m,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:_,streamFilterBy:"group"})}),[e,m,r]);const w=e=>{g(e)};le((()=>{w(1)}),[o,i]);const x=ue(null);return ce((()=>{f!==p.current&&(x.current&&Hf(x.current),p.current=f)}),[f]),De("div",{className:"grid gap-2 lg:grid-cols-2","data-testid":"notebook-container",children:[De("header",{className:"leading-none lg:col-span-2",ref:x,children:De("h1",{className:"text-xl font-bold","data-testid":"notebook-group-name",children:h})}),De("div",{
|
|
575
|
-
className:"absolute w-full z-5 left-0 top-
|
|
575
|
+
className:"absolute w-full z-5 left-0 lg:top-8 top-5",children:De("div",{className:Oe("container flex flex-row-reverse relative","right-[4rem]"),children:u&&De(hg,{})})}),De("div",{className:"justify-self-start",children:De(rg,{})}),De("div",{className:"flex items-center lg:justify-self-end text-md font-medium",children:[!u&&De(dg,{}),De(og,{forcedVisibleCount:a,isFiltered:s,isLoading:l,resultCount:null!=c?c:0})]}),De("div",{className:"lg:col-span-2",children:[v&&De("div",{className:"py-4","data-testid":"notebook-messages",children:De(dr,{title:"Too many results to show",children:[De("p",{children:["This preview of the Notebook can show"," ",De("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."]}),De("p",{children:[De(Fr,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"
|
|
576
576
|
})," ","if you would like to be notified when support for more annotations is available."]})]})}),De(sg,{currentPage:f,isLoading:l,onChangePage:w,threads:d.children})]})]})}),["loadAnnotationsService","streamer"]);function pg({classes:e,children:t,onClose:n=(()=>{}),...r}){return De("div",{className:Oe("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[De(ft,{className:"text-green-success w-em h-em p-[0.125em]"}),De("div",{className:"text-sm",children:t})]})}function fg(){const e=Ia(),[t,n]=ae(!1),[r,o]=ae(0);if(le((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),!e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return De(Ge,{"data-testid":"profile-container",classes:"overflow-hidden",children:[De("div",{className:Oe("h-12","px-3 border-b flex items-center"),children:[De("div",{className:"grow",children:De("h1",{className:"text-xl text-slate-7 font-normal",
|
|
577
577
|
children:"Notifications"})}),De("ul",{className:"sr-only","aria-live":"polite",children:i&&De("li",{children:"Notification preferences saved"},r)}),r>0&&De(pg,{onClose:()=>o(0),children:"Saved"},r)]}),De(Ue,{children:De(Ke,{size:"lg",children:De(Er,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?Yn:void 0,icon:t?Yn:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function gg({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&Po(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()];return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function vg(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function bg({documentMetadata:e,groupName:t,date:n=new Date}){const r=[vg(n)];return null!=e&&e.title?r.push(function(e,t){const n=Array.from(e)
|
|
578
578
|
;return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}function _g(){return De("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",children:De(_r,{size:"md"})})}function yg({userAnnotations:e}){return De("div",{className:"flex gap-x-2",children:[e.displayName,De("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const wg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"html",title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"}];var xg=Qr((function({annotationsExporter:e,toastMessenger:t}){var n
|
|
@@ -642,7 +642,7 @@ const n=Jo(e),r=Ko(e),o=[`Created at: ${Ep(new Date(e.created))}`,`Author: ${c(e
|
|
|
642
642
|
}(De("html",{lang:"en",children:[De("head",{children:[De("title",{children:`Annotations on "${a}"`}),De("meta",{charSet:"UTF-8"})]}),De("body",{children:[De("section",{children:[De("h1",{children:"Summary"}),De("p",{children:De("time",{dateTime:o.toISOString(),children:Ep(o)})}),De("p",{children:De("strong",{children:a})}),De("p",{children:De("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),De("table",{children:De("tbody",{style:{verticalAlign:"top"},children:[De("tr",{children:[De("td",{children:"Group:"}),De("td",{children:t})]}),De("tr",{children:[De("td",{children:"Total users:"}),De("td",{children:s.length})]}),De("tr",{children:[De("td",{children:"Users:"}),De("td",{children:s.join(", ")})]}),De("tr",{children:[De("td",{children:"Total annotations:"}),De("td",{children:e.length})]}),De("tr",{children:[De("td",{children:"Total replies:"}),De("td",{children:l.length})]})]})})]}),De("hr",{}),De("section",{children:[De("h1",{children:"Annotations"}),e.map(((e,t)=>{
|
|
643
643
|
const n=Jo(e),r=Ko(e),o=Lm(e.text),i=o===`<p>${e.text}</p>`?e.text:o;return De("article",{children:[De("h2",{children:["Annotation ",t+1,":"]}),De("table",{children:De("tbody",{style:{verticalAlign:"top"},children:[De("tr",{children:[De("td",{children:"Created at:"}),De("td",{children:De("time",{dateTime:e.created,children:Ep(new Date(e.created))})})]}),De("tr",{children:[De("td",{children:"Author:"}),De("td",{children:c(e)})]}),n&&De("tr",{children:[De("td",{children:"Page:"}),De("td",{children:n})]}),De("tr",{children:[De("td",{children:"Type:"}),De("td",{children:Wo(e)})]}),r&&De("tr",{children:[De("td",{children:"Quote:"}),De("td",{children:De("blockquote",{style:{margin:0},children:r})})]}),De("tr",{children:[De("td",{children:"Comment:"}),De("td",{dangerouslySetInnerHTML:{__html:i}})]}),e.tags.length>0&&De("tr",{children:[De("td",{children:"Tags:"}),De("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
|
|
644
644
|
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>ss(e,n,t),{uri:i,title:a}=zo(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Po(e))),extractUsername:o}}}kb.$inject=[];class Nb extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),H(this,"url",void 0),H(this,"response",void 0),H(this,"reason",void 0),this.url=e,this.response=t,this.reason=n}}async function Sb(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Nb(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Nb(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Nb(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}class Ab{constructor(e,t,n){H(this,"_clientId",void 0),H(this,"search",void 0),H(this,"annotation",void 0),H(this,"group",void 0),H(this,"groups",void 0),H(this,"profile",void 0),
|
|
645
|
-
this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,i]=await Promise.all([e,n()]),l=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
645
|
+
this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,i]=await Promise.all([e,n()]),l=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!l)throw new Error(`Missing API route: ${t}`);const c={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1471.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=ra(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await Sb(m.toString(),{body:s?JSON.stringify(_b(s)):null,headers:c,method:l.method})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished})
|
|
646
646
|
;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={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}}Ab.$inject=["apiRoutes","auth","store"];var Eb={};function Tb(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 Cb=Tb;Tb.prototype.reset=function(){this._attempts=1,
|
|
647
647
|
this._timeouts=this._originalTimeouts.slice(0)},Tb.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Tb.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++,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},Tb.prototype.attempt=function(e,t){this._fn=e,
|
|
648
648
|
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)},Tb.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Tb.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Tb.prototype.start=Tb.prototype.try,Tb.prototype.errors=function(){return this._errors},Tb.prototype.attempts=function(){return this._attempts},Tb.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=Cb;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})},
|
|
@@ -757,8 +757,8 @@ case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e
|
|
|
757
757
|
const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new jk(r);o.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(o)})),o.on("disconnect",(()=>{if(++this._reconnectionAttempts,this._reconnectionAttempts<10){const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,Yb(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}$k.$inject=["store","apiRoutes","auth","groups","session"]
|
|
758
758
|
;const Uk="hypothesis.user.tags.list",qk="hypothesis.user.tags.map";class Gk{constructor(e){H(this,"_storage",void 0),this._storage=e}filter(e,t=null){const n=this._storage.getObject(Uk)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${gv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(qk)||{};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(qk,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(Uk,n)}}Gk.$inject=["localStorage"];class Vk{constructor(e){H(this,"_store",void 0),this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}Vk.$inject=["store"];class Wk extends Zf{constructor(e,t){super(),H(this,"_store",void 0),H(this,"_window",void 0),
|
|
759
759
|
H(this,"_delayedMessageQueue",void 0),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:sv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}Wk.$inject=["store","$window"];const Yk=function(e){
|
|
760
|
-
for(var t={},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(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),Kk=function(e){const{version:t,origin:n}=cv(e.location.href);return"1.
|
|
761
|
-
autoDismiss:!1})}))}Yk.sentry&&Kk&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Ek({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
760
|
+
for(var t={},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(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),Kk=function(e){const{version:t,origin:n}=cv(e.location.href);return"1.1471.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1471.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 Xk(e,t){e.setClientId(t.clientId)}function Jk(e,t,n){e.load(),t.load(),n.sync()}function Zk(e,t,n){e.init(),t.init(),n.init()}function Qk(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{
|
|
761
|
+
autoDismiss:!1})}))}Yk.sentry&&Kk&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Ek({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1471.0",beforeSend:(e,t)=>{if(Tk>=5)return fv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Tk;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{Tw("host_config",cv(window.location.href))}catch(e){}Tw("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),jb(((e,t)=>{Ck(e,t)}))}(Yk.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")}))}(document.body),Xk.$inject=["api","streamer"],
|
|
762
762
|
Jk.$inject=["groups","session","router"],Zk.$inject=["autosaveService","persistedDefaults","serviceURL"],Qk.$inject=["frameSync","store","toastMessenger"];const eN=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",wv)}(),async function(e,t=window){const n=function(e){const t=cv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:uv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:hv(t.origin),ancestorLevel:dv(t.ancestorLevel)}}},o={};for(const[e,i]of Object.entries(t))n.includes(e)&&null!==i&&(r[e]?o[e]=r[e](i):o[e]=i);return o}(window),r=function(e,t){const n=e.requestConfigFromFrame;if(!n)return null
|
|
763
763
|
;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:mv(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await lv(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=lv(t.targetFrame,t.origin,"requestGroups",[n],0).catch((()=>{throw new Error("Unable to fetch groups")})))})),e):e}(e,r)}else o=n;const i={...e,...o};return r&&(i.rpc=r),i.apiUrl=function(e){const t=Yr(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(Yk).then((e=>{!function(e,t){const n=new q
|
|
764
764
|
;n.register("annotationsExporter",kb).register("annotationsService",kv).register("annotationActivity",xv).register("api",Ab).register("apiRoutes",Lb).register("auth",Pb).register("autosaveService",Db).register("frameSync",Jb).register("groups",e_).register("importAnnotationsService",Ik).register("loadAnnotationsService",zk).register("localStorage",Ok).register("persistedDefaults",Pk).register("router",Dk).register("serviceURL",Fk).register("session",Bk).register("streamer",$k).register("streamFilter",Hk).register("tags",Gk).register("threadsService",Vk).register("toastMessenger",Wk).register("store",{factory:Ma}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Zk),n.run(Xk),n.run(Jk),n.run(yv),n.run(Qk),D(De(Zr.Provider,{value:n,children:De(ov,{})}),t)}(e,eN)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),D(De(iv,{error:e}),t)}(e,eN)));
|