hypothesis 1.1754.0 → 1.1755.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-template.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?b1b3a1","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?bf10cf","styles/annotator.css":"styles/annotator.css?3c602d","styles/annotator.css.map":"styles/annotator.css.map?070158","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?027dee","styles/katex.min.css.map":"styles/katex.min.css.map?f4f041","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?9518aa","styles/sidebar.css.map":"styles/sidebar.css.map?ad1682","styles/ui-playground.css":"styles/ui-playground.css?d4e402","styles/ui-playground.css.map":"styles/ui-playground.css.map?4fa6a1","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?7214e3","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3b6ee1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?659eb2","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?d3e7ea"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"__ASSET_ROOT__");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,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||"__NOTEBOOK_APP_URL__"),h=a(d.profileAppUrl||"__PROFILE_APP_URL__"),y=a(d.sidebarAppUrl||"__SIDEBAR_APP_URL__");!function(s,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,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++)t(s,i(e,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/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?b1b3a1","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?bf10cf","styles/annotator.css":"styles/annotator.css?3c602d","styles/annotator.css.map":"styles/annotator.css.map?070158","styles/highlights.css":"styles/highlights.css?ef86d1","styles/highlights.css.map":"styles/highlights.css.map?6ce8dd","styles/katex.min.css":"styles/katex.min.css?027dee","styles/katex.min.css.map":"styles/katex.min.css.map?f4f041","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?d58df4","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?5a12c5","styles/sidebar.css":"styles/sidebar.css?9518aa","styles/sidebar.css.map":"styles/sidebar.css.map?ad1682","styles/ui-playground.css":"styles/ui-playground.css?d4e402","styles/ui-playground.css.map":"styles/ui-playground.css.map?4fa6a1","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?7214e3","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?3b6ee1","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?659eb2","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?d3e7ea"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var r=s.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=t,e(r),s.head.appendChild(r)}function r(s,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.esModule,n=void 0===o||o,i=r.forceReload,a=void 0!==i&&i,l=s.createElement("script");n&&(l.type="module"),a&&(t+="#ts=".concat(Date.now())),l.src=t,l.async=!1,e(l),s.head.appendChild(l)}function o(s,t,r,o){var n=s.createElement("link");n.rel=t,n.href=o,n.type="application/annotator+".concat(r),e(n),s.head.appendChild(n)}function n(s,t,r){var o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).crossOrigin,n=s.createElement("link");n.rel="preload",n.as=t,n.href=r,(o||"fetch"===t)&&(n.crossOrigin="anonymous",n.removeAttribute=()=>{}),e(n),s.head.appendChild(n)}function i(s,e){return s.assetRoot+"build/"+s.manifest[e]}function a(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var t=function(){var s,e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return t?(s=t.src,(e=s.match(/(https?):\/\/([^:/]+)/))?{protocol:e[1],hostname:e[2]}:null):null}(e);if(!t)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",t.hostname)).replace("{current_scheme}",t.protocol)}if(function(){var s=[()=>Object.fromEntries([]),()=>new URL(document.location.href),()=>new Request("https://hypothes.is"),()=>Element.prototype.attachShadow,()=>CSS.supports("display: grid"),()=>(document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0)];try{return s.every((s=>s()))}catch(s){return!1}}()){var l=function(s){for(var e={},t=s.querySelectorAll("script.js-hypothesis-config"),r=0;r<t.length;r++){var o=void 0;try{o=JSON.parse(t[r].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),o={}}Object.assign(e,o)}return e}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1755.0/");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var o=0,a=["scripts/sidebar.bundle.js"];o<a.length;o++)r(s,i(e,a[o]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)t(s,i(e,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,e){if(!s.querySelector('link[type="application/annotator+html"]')){o(s,"sidebar","html",e.sidebarAppUrl),o(s,"notebook","html",e.notebookAppUrl),o(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css"),{crossOrigin:!0}),o(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)r(s,i(e,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++)t(s,i(e,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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?b1b3a1",
|
|
3
3
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?bf10cf",
|
|
4
4
|
"styles/annotator.css": "styles/annotator.css?3c602d",
|
|
5
|
-
"styles/highlights.css": "styles/highlights.css?ef86d1",
|
|
6
5
|
"styles/annotator.css.map": "styles/annotator.css.map?070158",
|
|
6
|
+
"styles/highlights.css": "styles/highlights.css?ef86d1",
|
|
7
7
|
"styles/highlights.css.map": "styles/highlights.css.map?6ce8dd",
|
|
8
8
|
"styles/katex.min.css": "styles/katex.min.css?027dee",
|
|
9
9
|
"styles/katex.min.css.map": "styles/katex.min.css.map?f4f041",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"styles/sidebar.css.map": "styles/sidebar.css.map?ad1682",
|
|
14
14
|
"styles/ui-playground.css": "styles/ui-playground.css?d4e402",
|
|
15
15
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?4fa6a1",
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?7214e3",
|
|
16
17
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?3b6ee1",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?e20db9",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?659eb2",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?d3e7ea"
|
|
20
20
|
}
|
|
@@ -167,7 +167,7 @@ const o=await this._integration.anchor(this.element,e.selector);if(o instanceof
|
|
|
167
167
|
;const e=this._pendingKeyboardMode;this._pendingKeyboardMode=void 0;const n=await this._drawTool.draw(t,e),o=await this.getDocumentInfo(),i=[{source:o.uri,selector:await this._integration.describe(this.element,n)}],r={uri:o.uri,document:o.metadata,target:i,$tag:"a:"+Ce(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),r}catch(t){if(t instanceof vo&&["canceled","restarted"].includes(t.kind))return e="restarted"===t.kind,null;throw t}finally{e||this._hostRPC.call("activeToolChanged",null)}}}_activateToolWithMoveMode(t){this._drawTool.getKeyboardModeState().keyboardActive?this._drawTool.setKeyboardMode("move"):(this._pendingKeyboardMode="move",this.createAnnotation(t).catch((()=>{this._pendingKeyboardMode=void 0})))}async createAnnotationFromSelection({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,
|
|
168
168
|
document:n.metadata,target:i,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+Ce(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),vr(),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);this._highlighter.setHighlightsFocused(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(),o=Kn(n),i=Gn(n);i?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._commentsMode||(this._adder.annotationsForSelection=br(),this._isAdderVisible=!0,this._adder.show(i,o))):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}
|
|
169
169
|
selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){this._highlighter.setHighlightsVisible(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){const e=yn().toggleHighlights;e&&un(t,e)&&this.setHighlightsVisible(!this._highlightsVisible&&!this._commentsMode)}_setOutsideAssignmentNoticeVisible(t){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new gr(this.element)),this._outsideAssignmentNotice.setVisible(t)}}function Sr(t,e){const n=new URL(t),o=new URLSearchParams;return o.append("config",JSON.stringify(e)),n.hash=o.toString(),n.toString()}function Ar(t,e){const n={}
|
|
170
|
-
;for(const[t,o]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=o&&(n[t]=o);n.origin=new URL(t).origin,n.version="1.
|
|
170
|
+
;for(const[t,o]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=o&&(n[t]=o);n.origin=new URL(t).origin,n.version="1.1755.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const t=n.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 n}function kr({closed:t,onClose:e,children:n,className:o,"data-testid":i,"aria-label":r}){const s=it(null);return nt((()=>{t?s.current?.close():s.current?.showModal()}),[t]),nt((()=>{const t=s.current;return t?.addEventListener("cancel",e),()=>{t?.removeEventListener("cancel",e)}}),[e]),St("dialog",{ref:s,className:Tt("relative m-5 w-full h-full backdrop:bg-black/50",o),"data-testid":i,"aria-label":r,children:n})}function Mr({closed:t,children:e,className:n,...o}){
|
|
171
171
|
return St("div",{...o,className:Tt("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:t}),children:St("div",{className:Tt("relative w-full h-full",n),children:e})})}function Rr({document_:t=document,...e}){return St(rt((()=>function(t){return"function"==typeof t.createElement("dialog").showModal}(t)?kr:Mr),[t]),{...e})}function Er({config:t,groupId:e}){return St("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:Sr(t.notebookAppUrl,{...Ar(t.notebookAppUrl,t),group:e})})}function Pr({eventBus:t,config:e}){const[n,o]=et(0),[i,r]=et(!0),[s,a]=et(null),l=it(""),c=it(null);nt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),nt((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),nt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),o((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);const h=st((()=>{r(!0),
|
|
172
172
|
c.current?.publish("closeNotebook")}),[]);return null===s?null:St(Rr,{closed:i,onClose:h,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[St("div",{className:"absolute right-0 m-3",children:St(oe,{title:"Close notebook",onClick:h,variant:"dark",classes:Tt("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:St(It,{className:"w-4 h-4"})})}),St(Er,{config:e,groupId:s},n)]})}class Tr{constructor(t,e,n){this._container=new Pn("notebook",(()=>St(Pr,{eventBus:e,config:n}))),t.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Nr({eventBus:t,config:e}){const[n,o]=et(!0),i=it(null);nt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{o(!1)})),i.current=e,()=>{e.destroy()}}),[t]);const r=()=>{o(!0),i.current?.publish("closeProfile")};return n?null:St(Rr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[St("div",{className:"absolute right-0 m-3",
|
|
173
173
|
children:St(oe,{title:"Close profile dialog",onClick:r,variant:"dark",classes:Tt("!bg-transparent enabled:hover:!bg-grey-3"),children:St(It,{className:"w-4 h-4"})})}),St("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})}class Lr{constructor(t,e,n){this._container=new Pn("profile",(()=>St(Nr,{eventBus:e,config:n}))),t.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Or({above:t,below:e,buckets:n,onFocusAnnotations:o,onScrollToAnnotation:i,onSelectAnnotations:r}){const s=t.anchors.length>0,a=e.anchors.length>0,l=t=>t.anchors.map((t=>t.tag));return St("ul",{className:"relative",children:[s&&St("li",{className:"absolute right-0 pointer-events-auto mt-[-11px]",style:{top:t.position},children:St(ve,{"data-testid":"up-navigation-button",direction:"up",onClick:()=>{const e=[...t.anchors].sort(((t,e)=>t.bottom-e.bottom)),n=e[e.length-1];i(n.tag)},onBlur:()=>o([]),onFocus:()=>o(l(t)),onMouseEnter:()=>o(l(t)),
|
|
@@ -581,7 +581,7 @@ const n=e.children.map((e=>Wm(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);r
|
|
|
581
581
|
const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function xf(e,t){return e===t?0:e<t?-1:1}function kf(e,t,n){switch(n.sortBy){case"newest":{const n=yf(e);return xf(yf(t),n)}case"oldest":return xf(_f(e),_f(t));case"location":return function(e,t){if(!e.annotation||!t.annotation)return function(e,t){return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Vr(e.annotation),r=Vr(t.annotation);if(n.cfi||r.cfi){const e="/0",t=Jm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=wf(n.pageIndex,r.pageIndex);if(0!==o)return o;const i=wf(n.top,r.top);if(0!==i)return i;const a=wf(n.charOffset,r.charOffset);if(0!==a)return a;return xf(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const Sf=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){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,
|
|
582
582
|
sortCompareFn:(e,n)=>kf(e,n,{sortBy: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=gf(e,hf);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",filterReplies:!0},cfi:{terms:r,operator:"or",filterReplies:!1},quote:{terms:i,operator:"and",filterReplies:!1},page:{terms:o,operator:"or",filterReplies:!1},since:{terms:d,
|
|
583
583
|
operator:"and",filterReplies:!0},tag:{terms:a,operator:"and",filterReplies:!0},text:{terms:s,operator:"and",filterReplies:!0},uri:{terms:l,operator:"or",filterReplies:!1},user:{terms:c,operator:"or",filterReplies:!0}}}(t.filterQuery||"",t.filters),r={},o={};for(const[t,n]of Object.entries(e))n.filterReplies?r[t]=n:o[t]=n;n.filterFn=e=>df([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&df([e.annotation],o).length>0)}const r=Xm(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(e.annotation&&Fr(e.annotation))return!1;const n=e.annotation?bf(e.annotation):"orphan";return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Af(){const e=Fi(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=ue((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[o,n,i,t,a]);return Sf(s)}
|
|
584
|
-
var Tf,Ef,Cf=er((function({loadAnnotationsService:e,onLogin:t}){const n=Fi(),r=n.routeParams().id??"",{rootThread:o}=Af(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(qi,{errorType:"annotation",onLoginRequest:t}),Ve(Fm,{threads:o.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.
|
|
584
|
+
var Tf,Ef,Cf=er((function({loadAnnotationsService:e,onLogin:t}){const n=Fi(),r=n.routeParams().id??"",{rootThread:o}=Af(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(qi,{errorType:"annotation",onLoginRequest:t}),Ve(Fm,{threads:o.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.1755.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||r,this.fingerprint=t[0]?.metadata?.documentFingerprint??r,this.account=o,this.timestamp=(new Date).toString();const i=t[0]?.segment;if(i){const e=[];if(i.cfi&&e.push(["CFI",i.cfi]),i.pages){const t=`${i.pages.start}-${i.pages.end}`;e.push(["Pages",t])}
|
|
585
585
|
i.url&&e.push(["URL",i.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 Nf=function(){if(Ef)return Tf;Ef=1;var e="complete",t="canceled";function n(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function r(t){var o=t._scrollSettings;if(o){var i=o.maxSynchronousAlignments,a=function(e,t){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,p=c&&null!=c.leftOffset?c.leftOffset:0,m=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-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,
|
|
586
586
|
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-=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}}(o,t),s=Date.now()-o.startTime,l=Math.min(1/o.time*s,1);if(o.endIterations>=i)return n(t,a.x,a.y),t._scrollSettings=null,o.end(e);var c=1-o.ease(l);if(n(t,a.x-a.differenceX*c,a.y-a.differenceY*c),s>=o.time)return o.endIterations++,o.scrollAncestor&&r(o.scrollAncestor),void r(t);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(r.bind(null,t))}}function o(e){return e.self===e}function i(e){
|
|
587
587
|
return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function a(){return!0}function s(e){if(e.assignedSlot)return s(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}}return Tf=function(n,l,c){if(n){"function"==typeof l&&(c=l,l=null),l||(l={}),l.time=isNaN(l.time)?1e3:l.time,l.ease=l.ease||function(e){return 1-Math.pow(1-e,e/2)},l.align=l.align||{};var u=s(n),d=1,h=l.validTarget||a,p=l.isScrollable;l.debug&&(console.log("About to scroll to",n),u||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var m=[];u;)if(l.debug&&console.log("Scrolling parent node",u),h(u,d)&&(p?p(u,i):i(u))&&(d++,m.push(u)),!(u=s(u))){f(e);break}return m.reduce(((e,i,a)=>function(e,n,i,a,s){
|
|
@@ -618,9 +618,9 @@ children:"Use this link to share these annotations with other group members:"}):
|
|
|
618
618
|
;function Ig({shareTab:e}){const t=Fi().focusedGroup(),n=t&&t.name||"...",r=`Share Annotations in ${n}`,o=e?"share":"export",[i,a]=ie(o),s=i===o;return Ve(Of,{label:"Share panel",panelName:"shareGroupAnnotations",children:[Ve(jf,{closeTitle:"Close share panel",children:[e&&Ve(Gn,{id:"share-panel-tab","aria-controls":"share-panel",variant:"tab",selected:"share"===i,onClick:()=>a("share"),textContent:"Share",children:"Share"}),Ve(Gn,{id:"export-panel-tab","aria-controls":"export-panel",variant:"tab",selected:"export"===i,onClick:()=>a("export"),textContent:"Export",children:"Export"}),Ve(Gn,{id:"import-panel-tab","aria-controls":"import-panel",variant:"tab",selected:"import"===i,onClick:()=>a("import"),textContent:"Import",children:"Import"})]}),Ve(it,{classes:Je({"rounded-tl-none":s}),children:[Ve(Hf,{id:"share-panel","data-testid":"share-panel",active:"share"===i,"aria-labelledby":"share-panel-tab",title:r,children:Ve(Ng,{})}),Ve(Hf,{id:"export-panel",active:"export"===i,"aria-labelledby":"export-panel-tab",
|
|
619
619
|
title:`Export from ${n}`,children:Ve(Sg,{})}),Ve(Hf,{id:"import-panel",active:"import"===i,"aria-labelledby":"import-panel-tab",title:`Import into ${n}`,children:Ve(Mg,{})})]})]})}function Og({onLogin:e}){const t=Fi();return Ve("div",{className:"flex flex-col items-center m-6 space-y-6",children:[Ve("span",{className:"text-center",children:["This is a public annotation created with Hypothesis. ",Ve("br",{}),"To reply or make your own annotations on this document,"," ",Ve($n,{variant:"text",href:t.getLink("signup"),target:"_blank",underline:"always",children:"create a free account"})," ","or"," ",Ve(Bn,{inline:!0,variant:"text",onClick:e,underline:"always",children:"log in"}),"."]}),Ve("div",{children:Ve($n,{href:"https://hypothes.is","aria-label":"Hypothesis homepage",target:"_blank",title:"Hypothesis homepage",underline:"none",variant:"custom",children:Ve(Vt,{className:"w-16 h-16 text-grey-7"})})})]})}var zg=er((function({onLogin:e,onSignUp:t,settings:n}){return Fi().isLoggedIn()?null:Ve(Of,{
|
|
620
620
|
label:"Login panel",panelName:"loginPrompt",children:Ve(it,{children:[Ve(vn,{children:[Ve(on,{className:"w-em h-em"}),Ve(gn,{children:"Login needed"})]}),Ve(st,{children:[Ve("p",{"data-testid":"main-text",children:["Please log in to"," ",n?.commentsMode?"write a comment":"create annotations or highlights","."]}),Ve(at,{children:[Ve(dn,{title:"Sign up",onClick:t,children:"Sign up"}),Ve(dn,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})]})})}),["settings"]);const Lg=e=>`${e}-tab`,Pg=e=>`${e}-panel`;function Rg({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i,name:a}){const s=()=>{r||i()},l=t>0?`${o} (${t} available)`:o;return Ve(Bn,{classes:Je("bg-transparent min-w-[5.25rem]",{"font-bold":r}),variant:"text",onClick:s,onMouseDown:s,pressed:!!r,role:"tab",id:Lg(a),"aria-controls":Pg(a),tabIndex:0,title:l,underline:"none",children:Ve(y,{children:[e,t>0&&!n&&Ve("span",{className:"relative bottom-[3px] left-[2px] text-[10px]",children:t})]})})}
|
|
621
|
-
var Dg=er((function({annotationsService:e,isLoading:t,settings:n}){const{rootThread:
|
|
622
|
-
label:n.commentsMode?"Comments":"Page notes",name:"note",onSelect:()=>
|
|
623
|
-
children:"There are no annotations in this group."}),Ve("p",{children:["Create one by selecting some text and clicking the"," ",Ve(lt,{className:"w-em h-em inline m-0.5 -mt-0.5",title:"Annotate"})," ","button."]})]})}),Ve(Fm,{threads:
|
|
621
|
+
var Dg=er((function({annotationsService:e,isLoading:t,settings:n,frameSync:r}){const{rootThread:o,tabCounts:i}=Af(),a=Fi(),s=a.selectedTab(),l=i.note,c=i.annotation,u=i.orphan,d=a.isWaitingToAnchorAnnotations(),h=e=>{a.selectTab(e)},p="annotation"===s&&0===c&&!d,m="note"===s&&0===l,f=[];if(c>0){const e=Xf(c,"annotation","annotations");f.push(`${c} ${e}`)}if(l>0){const e=Xf(l,"note","notes");f.push(`${l} ${e}`)}if(u>0){const e=Xf(l,"unanchored","unanchored");f.push(`${u} ${e}`)}const g=f.join(", "),v=de((async()=>{const{metadata:t}=await r.getDocumentInfo();e.createPageNote(t)}),[e,r]);return Ve(y,{children:[Ve("div",{"aria-live":"polite",role:"status",className:"sr-only",children:g}),Ve("div",{className:Je("space-y-3 pb-[9px]"),children:[Ve("div",{className:"flex gap-x-6 theme-clean:ml-[15px] mt-1",role:"tablist",children:[!n.commentsMode&&Ve(Rg,{count:c,isWaitingToAnchor:d,isSelected:"annotation"===s,label:"Annotations",name:"annotation",onSelect:()=>h("annotation"),children:"Annotations"}),Ve(Rg,{count:l,
|
|
622
|
+
isWaitingToAnchor:d,isSelected:"note"===s,label:n.commentsMode?"Comments":"Page notes",name:"note",onSelect:()=>h("note"),children:n.commentsMode?"Comments":"Page Notes"}),u>0&&Ve(Rg,{count:u,isWaitingToAnchor:d,isSelected:"orphan"===s,label:"Unanchored",name:"orphan",onSelect:()=>h("orphan"),children:"Unanchored"})]}),Ve("div",{className:"space-y-3",role:"tabpanel",id:Pg(s),"aria-labelledby":Lg(s),children:["note"===s&&n.enableExperimentalNewNoteButton&&Ve("div",{className:"flex justify-end",children:Ve(dn,{"data-testid":"new-note-button",onClick:v,variant:"primary",style:Qn(["ctaBackgroundColor"],n),children:[Ve(Zt,{}),n.commentsMode?"Add comment":"New note"]})}),!t&&m&&Ve(it,{"data-testid":"notes-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center",children:["There are no ",n.commentsMode?"comments":"page notes"," ","in this group."]})}),!t&&p&&Ve(it,{"data-testid":"annotations-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center !space-y-1",children:[Ve("p",{
|
|
623
|
+
children:"There are no annotations in this group."}),Ve("p",{children:["Create one by selecting some text and clicking the"," ",Ve(lt,{className:"w-em h-em inline m-0.5 -mt-0.5",title:"Annotate"})," ","button."]})]})}),Ve(Fm,{threads:o.children})]})]})]})}),["annotationsService","frameSync","settings"]);function jg({label:e,icon:t,description:n,active:r,disabled:o=!1,setActive:i,testId:a}){return Ve(dn,{"data-testid":a,classes:Je({"font-medium rounded-lg py-1":!0,"text-grey-7 bg-grey-2":!r,"text-grey-1 bg-grey-7":r,"opacity-50":o}),disabled:o,onClick:()=>i(!r),variant:"custom",title:n,children:[t&&Ve(t,{className:"w-em h-em"}),Ve("span",{className:"max-w-56 truncate",children:e}),Ve("div",{className:Je({"h-[2em] w-[1.5px] -mt-1 -mb-1":!0,"bg-grey-3":!r,"bg-grey-5":r})}),Ve(r?Xt:Zt,{className:"w-em h-em"})]})}function Hg({children:e}){return Ve("div",{className:"mb-3",children:Ve(it,{children:Ve(st,{children:e})})})}function Fg({withCardContainer:e=!1}){
|
|
624
624
|
const t=Fi(),n=t.selectedAnnotations().length,r=n>0,o=t.getFocusActive(),i=t.getFocusFilters(),a=Object.keys(i).length>0;if(!(r||a))return null;return Ve(e?Hg:y,{children:Ve("div",{className:"flex flex-row flex-wrap gap-2 items-center","data-testid":"filter-controls",children:[Ve("b",{children:"Filters"}),r&&Ve(jg,{label:`Clear filter: ${n} selected`,description:`Show only the ${n} selected annotations. Press to clear this filter and show all annotations.`,active:!0,setActive:()=>t.clearSelection(),testId:"selection-toggle"}),i.user&&Ve(jg,{icon:en,label:`Clear filter: by author ${i.user.display}`,description:`Show annotations by ${i.user.display}. Press to clear this filter.`,active:o.has("user"),disabled:r,setActive:()=>t.toggleFocusMode({key:"user"}),testId:"user-focus-toggle"}),i.page&&Ve(jg,{icon:Mt,label:`Clear filter: pages ${i.page.display}`,description:`Show annotations on pages ${i.page.display}. Press to clear this filter.`,active:o.has("page"),disabled:r,setActive:()=>t.toggleFocusMode({key:"page"
|
|
625
625
|
}),testId:"page-focus-toggle"}),i.cfi&&Ve(jg,{icon:Mt,label:"Clear filter: selected chapter",description:"Show annotations on selected book chapter(s). Press to clear this filter.",active:o.has("cfi"),disabled:r,setActive:()=>t.toggleFocusMode({key:"cfi"}),testId:"cfi-focus-toggle"})]})})}var $g=er((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){const i=Fi(),a=i.focusedGroupId(),s=i.isLoading(),l=i.isLoggedIn(),c=i.directLinkedAnnotationId(),u=c?i.findAnnotationByID(c):void 0,d=u?bf(u):"annotation",h=i.searchUris(),p=i.hasSidebarOpened(),m=i.profile().userid,f=!(s||!c)&&!u,g=i.directLinkedGroupFetchFailed(),v=f||g,b=i.isSidebarPanelOpen("searchAnnotations"),y=!v&&!b,_=c&&!l&&!f&&!s,w=ce(a);se((()=>{if(!w.current||w.current!==a){if(w.current){const e=i.focusState().active;i.clearSelection(),e&&i.toggleFocusMode({active:!0})}w.current=a}a&&h.length&&r.load({groupId:a,uris:h})}),[i,r,a,m,h]),se((()=>{u&&!1===u.$orphan?(e.hoverAnnotation(u),e.scrollToAnnotation(u),
|
|
626
626
|
i.selectTab(d)):u&&i.selectTab(d)}),[d,e,u,i]);const x=i.hasFetchedProfile();return se((()=>{x&&(p||l)&&o.connect({applyUpdatesImmediately:!1})}),[x,l,p,o]),Ve("div",{className:"relative",children:[Ve("h2",{className:"sr-only",children:"Annotations"}),Ve("div",{className:Je("fixed z-10","right-[9px] top-12"),children:Ve(mg,{})}),y&&Ve(Fg,{withCardContainer:!0}),Ve(zg,{onLogin:t,onSignUp:n}),f&&Ve(qi,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),g&&Ve(qi,{errorType:"group",onLoginRequest:t}),!v&&Ve(Dg,{isLoading:s}),_&&Ve(Og,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Bg=er((function({api:e,toastMessenger:t}){const n=Fi(),r=n.routeParams().q,o=de((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...vf(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);se((()=>{n.setSortKey("newest"),n.clearAnnotations(),o(r??"").catch((e=>{
|
|
@@ -679,7 +679,7 @@ client_version:r.version,annotations:e.map(Yb)}}buildTextExportContent(e,{groupN
|
|
|
679
679
|
${u.join("\n\n")}`}buildCSVExportContent(e,{groupName:t="",defaultAuthority:n="",displayNamesEnabled:r=!1,separator:o=","}={}){const{uri:i,extractUsername:a}=this._exportCommon(e,{displayNamesEnabled:r,defaultAuthority:n}),s=e=>[Xb(new Date(e.created)),a(e),Jr(e)??"",i,t,Gr(e,this._settings),Yr(e)??Xr(e)??"",e.text,e.tags.join(",")].map((e=>function(e,t){return new RegExp(`["\n\r${t}]`).test(e)?`"${e.replace(/"/g,'""')}"`:e}(e,o))).join(o);return`${["Created at","Author","Page","URL","Group","Type","Quote/description","Comment","Tags"].join(o)}\n${e.map((e=>s(e))).join("\n")}`}buildHTMLExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const{uri:i,title:a,uniqueUsers:s,replies:l,extractUsername:c}=this._exportCommon(e,{displayNamesEnabled:n,defaultAuthority:r});return function(e,t,n){var r=Object.assign({},Vb,n||{});return r.jsx||(r.attributeHook=null),yb(e,t,r)}(Ve("html",{lang:"en",children:[Ve("head",{children:[Ve("title",{
|
|
680
680
|
children:`Annotations on "${a}"`}),Ve("meta",{charSet:"UTF-8"})]}),Ve("body",{children:[Ve("section",{children:[Ve("h1",{children:"Summary"}),Ve("p",{children:Ve("time",{dateTime:o.toISOString(),children:Xb(o)})}),Ve("p",{children:Ve("strong",{children:a})}),Ve("p",{children:Ve("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Group:"}),Ve("td",{children:t})]}),Ve("tr",{children:[Ve("td",{children:"Total users:"}),Ve("td",{children:s.length})]}),Ve("tr",{children:[Ve("td",{children:"Users:"}),Ve("td",{children:s.join(", ")})]}),Ve("tr",{children:[Ve("td",{children:"Total annotations:"}),Ve("td",{children:e.length})]}),Ve("tr",{children:[Ve("td",{children:"Total replies:"}),Ve("td",{children:l.length})]})]})})]}),Ve("hr",{}),Ve("section",{children:[Ve("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Jr(e),r=Yr(e),o=Xr(e),i=tp(e.text),a=i===`<p>${e.text}</p>`?e.text:i
|
|
681
681
|
;return Ve("article",{children:[Ve("h2",{children:["Annotation ",t+1,":"]}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Created at:"}),Ve("td",{children:Ve("time",{dateTime:e.created,children:Xb(new Date(e.created))})})]}),Ve("tr",{children:[Ve("td",{children:"Author:"}),Ve("td",{children:c(e)})]}),n&&Ve("tr",{children:[Ve("td",{children:"Page:"}),Ve("td",{children:n})]}),Ve("tr",{children:[Ve("td",{children:"Type:"}),Ve("td",{children:Gr(e,this._settings)})]}),r&&Ve("tr",{children:[Ve("td",{children:"Quote:"}),Ve("td",{children:Ve("blockquote",{style:{margin:0},children:r})})]}),o&&Ve("tr",{children:[Ve("td",{children:"Description:"}),Ve("td",{children:o})]}),Ve("tr",{children:[Ve("td",{children:"Comment:"}),Ve("td",{dangerouslySetInnerHTML:{__html:a}})]}),e.tags.length>0&&Ve("tr",{children:[Ve("td",{children:"Tags:"}),Ve("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
|
|
682
|
-
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Qi(e,n,t),{uri:i,title:a}=Ji(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Rr(e))),extractUsername:o}}}Zb.$inject=["settings"];class Qb{constructor(e,t,n){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,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=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(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
682
|
+
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Qi(e,n,t),{uri:i,title:a}=Ji(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Rr(e))),extractUsername:o}}}Zb.$inject=["settings"];class Qb{constructor(e,t,n){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,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=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(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1755.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=ui(c.url,a),m=new URL(h);for(const[e,t]of Object.entries(p)){
|
|
683
683
|
const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await _p(m.toString(),{body:s?JSON.stringify(Yb(s)):null,headers:u,method:c.method,signal:l})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={read:i("annotation.read"),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"),moderate:i("annotation.moderate")},this.group={member:{delete:i("group.member.delete")},members:{read:i("group.members.read")},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")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}
|
|
684
684
|
Qb.$inject=["apiRoutes","auth","store"];var Jb,ey,ty,ny,ry,oy={};function iy(){return ty||(ty=1,e=oy,t=function(){if(ey)return Jb;function e(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))}return ey=1,Jb=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.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),
|
|
685
685
|
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},e.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)},e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){
|
|
@@ -798,8 +798,8 @@ this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t
|
|
|
798
798
|
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")})),r.on("error",(t=>this._handleSocketError(e,t))),r.on("message",(e=>this._handleSocketMessage(e))),this._socket=r,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,Ay(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}hA.$inject=["store","apiRoutes","auth","groups","session","$window"];const pA="hypothesis.user.tags.list",mA="hypothesis.user.tags.map";class fA{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(pA)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1
|
|
799
799
|
;const o=n.split(/\W+/),i=new RegExp(`^${Lv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(mA)||{};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(mA,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(pA,n)}}fA.$inject=["localStorage"];class gA{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}gA.$inject=["store"];class vA{#t=new Map;#n=30;#r;constructor(e){this.#r=e}get cacheSize(){return this.#n}set cacheSize(e){this.#n=e,this.#o()}#o(){for(const e of this.#t.keys()){const t=this.#t.get(e);if(t&&URL.revokeObjectURL(t.url),this.#t.delete(e),this.#t.size<=this.cacheSize)break}}async fetch(e,t={}){const n=this.get(e);if(n)return n;const r=await this.#r.requestThumbnail(e,t),o=await async function(e){
|
|
800
800
|
const t=new OffscreenCanvas(e.width,e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height);const n=await t.convertToBlob();return URL.createObjectURL(n)}(r),i={url:o,width:r.width,height:r.height};return this.#t.set(e,i),this.#t.size>this.cacheSize&&this.#o(),i}get(e){const t=this.#t.get(e);return t?(this.#t.delete(e),this.#t.set(e,t),t):null}cachedThumbnailTags(){return[...this.#t.keys()]}}vA.$inject=["frameSync"];class bA extends Bf{constructor(e,t){super(),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}
|
|
801
|
-
;return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:kv(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)}}bA.$inject=["store","$window"];const yA=function(e){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),_A=function(e){const{version:t,origin:n}=Av(e.location.href);return"1.
|
|
802
|
-
!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 wA(e,t){e.setClientId(t.clientId)}function xA(e){e.sync()}function kA(e,t){e.load(),t.load()}function SA(e,t,n){e.init(),t.init(),n.init()}function AA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}yA.sentry&&_A&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ZS({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
801
|
+
;return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:kv(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)}}bA.$inject=["store","$window"];const yA=function(e){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),_A=function(e){const{version:t,origin:n}=Av(e.location.href);return"1.1755.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1755.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."),
|
|
802
|
+
!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 wA(e,t){e.setClientId(t.clientId)}function xA(e){e.sync()}function kA(e,t){e.load(),t.load()}function SA(e,t,n){e.init(),t.init(),n.init()}function AA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}yA.sentry&&_A&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ZS({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1755.0",beforeSend:(e,t)=>{if(QS>=5)return Iv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++QS;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{}
|
|
803
803
|
return e}});try{zx("host_config",Av(window.location.href))}catch{}zx("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),by(((e,t)=>{JS(e,t)}))}(yA.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),wA.$inject=["api","streamer"],xA.$inject=["router"],kA.$inject=["groups","session"],SA.$inject=["autosaveService","persistedDefaults","serviceURL"],AA.$inject=["frameSync","store","toastMessenger"];const TA=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",$v)}(),async function(e,t=window){const n=function(e){const t=Av(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl","commentsMode","groupsAllowlist"],r={openSidebar:Tv,requestConfigFromFrame:e=>{
|
|
804
804
|
if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Cv(t.origin),ancestorLevel:Ev(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;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 Sv(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=Sv(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),
|
|
805
805
|
i.apiUrl=function(e){const t=Kn(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(yA).then((e=>{!function(e,t){const n=new U;n.register("analytics",Bv).register("annotationsExporter",Zb).register("annotationsService",Uv).register("annotationActivity",qv).register("api",Qb).register("apiRoutes",cy).register("auth",hy).register("autosaveService",py).register("dashboard",my).register("frameSync",Cy).register("groups",Iy).register("importAnnotationsService",tA).register("loadAnnotationsService",nA).register("localStorage",oA).register("persistedDefaults",aA).register("router",sA).register("serviceURL",lA).register("session",cA).register("streamer",hA).register("streamFilter",uA).register("tags",fA).register("threadsService",gA).register("thumbnailService",vA).register("toastMessenger",bA).register("store",{factory:Hi}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(xA),n.run(SA),n.run(wA),n.run(kA),n.run(Fv),n.run(AA),
|