hypothesis 1.1591.0 → 1.1592.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/boot.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?a933e9","styles/annotator.css":"styles/annotator.css?427463","styles/annotator.css.map":"styles/annotator.css.map?94a857","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?d92c5a","styles/katex.min.css.map":"styles/katex.min.css.map?e7e03f","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?661aee","styles/sidebar.css.map":"styles/sidebar.css.map?9a27bf","styles/ui-playground.css":"styles/ui-playground.css?df98db","styles/ui-playground.css.map":"styles/ui-playground.css.map?0df86b","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?90e514","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?437f5f","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?4107fe","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?f2cbfd","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?f66fa1"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var o=s.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=t,e(o),s.head.appendChild(o)}function o(s,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=o.esModule,n=void 0===r||r,i=o.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 r(s,t,o,r){var n=s.createElement("link");n.rel=t,n.href=r,n.type="application/annotator+".concat(o),e(n),s.head.appendChild(n)}function n(s,t,o){var r=s.createElement("link");r.rel="preload",r.as=t,r.href=o,"fetch"===t&&(r.crossOrigin="anonymous"),e(r),s.head.appendChild(r)}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"),o=0;o<t.length;o++){var r=void 0;try{r=JSON.parse(t[o].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(e,r)}return e}(document),p=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1591.0/");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)o(s,i(e,a[r]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)t(s,i(e,p[l]))}(document,{assetRoot:p,manifest:s,apiUrl:l.apiUrl})}else{var c=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(c&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(c))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,h=a(d.notebookAppUrl||"https://hypothes.is/notebook"),u=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"]')){r(s,"sidebar","html",e.sidebarAppUrl),r(s,"notebook","html",e.notebookAppUrl),r(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css")),r(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)o(s,i(e,l[a]),{esModule:!1});var p=[];void 0!==window.PDFViewerApplication&&p.push("styles/pdfjs-overrides.css"),p.push("styles/highlights.css");for(var c=0,d=p;c<d.length;c++)t(s,i(e,d[c]))}}(document,{assetRoot:p,manifest:s,notebookAppUrl:h,profileAppUrl:u,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?a14502","styles/annotator.css":"styles/annotator.css?427463","styles/annotator.css.map":"styles/annotator.css.map?94a857","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?d92c5a","styles/katex.min.css.map":"styles/katex.min.css.map?e7e03f","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?df95e8","styles/sidebar.css.map":"styles/sidebar.css.map?9647b5","styles/ui-playground.css":"styles/ui-playground.css?8235fe","styles/ui-playground.css.map":"styles/ui-playground.css.map?866fb6","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?90e514","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?bf1c7a","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?4107fe","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?f66fa1","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?19c870"};function e(s){s.setAttribute("data-hypothesis-asset","")}function t(s,t){var o=s.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=t,e(o),s.head.appendChild(o)}function o(s,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=o.esModule,n=void 0===r||r,i=o.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 r(s,t,o,r){var n=s.createElement("link");n.rel=t,n.href=r,n.type="application/annotator+".concat(o),e(n),s.head.appendChild(n)}function n(s,t,o){var r=s.createElement("link");r.rel="preload",r.as=t,r.href=o,"fetch"===t&&(r.crossOrigin="anonymous"),e(r),s.head.appendChild(r)}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"),o=0;o<t.length;o++){var r=void 0;try{r=JSON.parse(t[o].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(e,r)}return e}(document),p=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1592.0/");if(document.querySelector("hypothesis-app")){!function(s,e){n(s,"fetch",e.apiUrl),n(s,"fetch",e.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)o(s,i(e,a[r]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)t(s,i(e,p[l]))}(document,{assetRoot:p,manifest:s,apiUrl:l.apiUrl})}else{var c=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(c&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(c))throw new Error("Could not start Hypothesis extension as configuration is missing");var d=l,h=a(d.notebookAppUrl||"https://hypothes.is/notebook"),u=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"]')){r(s,"sidebar","html",e.sidebarAppUrl),r(s,"notebook","html",e.notebookAppUrl),r(s,"profile","html",e.profileAppUrl),n(s,"style",i(e,"styles/annotator.css")),r(s,"hypothesis-client","javascript",e.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)o(s,i(e,l[a]),{esModule:!1});var p=[];void 0!==window.PDFViewerApplication&&p.push("styles/pdfjs-overrides.css"),p.push("styles/highlights.css");for(var c=0,d=p;c<d.length;c++)t(s,i(e,d[c]))}}(document,{assetRoot:p,manifest:s,notebookAppUrl:h,profileAppUrl:u,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
@@ -1,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?a933e9",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?a14502",
3
3
  "styles/annotator.css": "styles/annotator.css?427463",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?94a857",
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?e7e03f",
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?661aee",
12
- "styles/sidebar.css.map": "styles/sidebar.css.map?9a27bf",
13
- "styles/ui-playground.css": "styles/ui-playground.css?df98db",
14
- "styles/ui-playground.css.map": "styles/ui-playground.css.map?0df86b",
11
+ "styles/sidebar.css": "styles/sidebar.css?df95e8",
12
+ "styles/sidebar.css.map": "styles/sidebar.css.map?9647b5",
13
+ "styles/ui-playground.css": "styles/ui-playground.css?8235fe",
14
+ "styles/ui-playground.css.map": "styles/ui-playground.css.map?866fb6",
15
15
  "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?90e514",
16
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?437f5f",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?bf1c7a",
17
17
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?4107fe",
18
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?f2cbfd",
19
- "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?f66fa1"
18
+ "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?f66fa1",
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?19c870"
20
20
  }
@@ -147,7 +147,7 @@ this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?
147
147
  if(!t.selector||!t.selector.some((e=>"TextQuoteSelector"===e.type)))return{annotation:e,target:t};let n;try{const o=await this._integration.anchor(this.element,t.selector),i=ho.fromRange(o);n={annotation:e,target:t,range:i}}catch{n={annotation:e,target:t}}return n})));if(!this._annotations.has(e.$tag))return[];for(const e of n)t(e);return e.$orphan=n.length>0&&n.every((e=>e.target.selector&&!e.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",e),n}detach(e,t=!0){this._annotations.delete(e);const n=[];for(const t of this.anchors)t.annotation.$tag!==e?n.push(t):t.highlights&&So(t.highlights);this._updateAnchors(n,t)}_updateAnchors(e,t){this.anchors=e,this._clusterToolbar?.scheduleClusterUpdates(),t&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:e=!1}={}){const t=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),o=this.element,i=(await Promise.all(t.map((e=>this._integration.describe(o,e))))).map((e=>({
148
148
  source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+Zt(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Cr(),r}_hoverAnnotations(e){this._hoveredAnnotations.clear(),e.forEach((e=>this._hoveredAnnotations.add(e)));for(const t of this.anchors)if(t.highlights){const n=e.includes(t.annotation.$tag);Eo(t.highlights,n)}this._sidebarRPC.call("hoverAnnotations",e)}_onSelection(e){const t=this._integration.getAnnotatableRange(e);if(!t)return void this._onClearSelection();const n=document.getSelection(),o=_o(n),i=wo(n);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=yr(),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}
149
149
  selectAnnotations(e,{toggle:t=!1,focusInSidebar:n=!1}={}){t?this._sidebarRPC.call("toggleAnnotationSelection",e):this._sidebarRPC.call("showAnnotations",e,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(e,t=!0){!function(e,t){e.classList.toggle("hypothesis-highlights-always-on",t)}(this.element,e),this._highlightsVisible=e,t&&this._hostRPC.call("highlightsVisibleChanged",e)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(e){this._sidebarLayout=e,this._integration.fitSideBySide(e)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(e){zn(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new br(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function Ar(e,t){const n=new URL(e),o=new URLSearchParams;return o.append("config",JSON.stringify(t)),n.hash=o.toString(),n.toString()}function Rr(e,t){const n={}
150
- ;for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1591.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const e=n.services[0];e.onLoginRequest&&(e.onLoginRequestProvided=!0),e.onLogoutRequest&&(e.onLogoutRequestProvided=!0),e.onSignupRequest&&(e.onSignupRequestProvided=!0),e.onProfileRequest&&(e.onProfileRequestProvided=!0),e.onHelpRequest&&(e.onHelpRequestProvided=!0)}return n}function kr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=se(null);return ie((()=>{e?r.current?.close():r.current?.showModal()}),[e]),ie((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Te("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function Pr({closed:e,children:t,...n}){return Te("div",{...n,
150
+ ;for(const[e,o]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=o&&(n[e]=o);n.origin=new URL(e).origin,n.version="1.1592.0";const o=new URL(window.location.href);if(o.hash="",n.hostURL=o.toString(),Array.isArray(n.services)&&n.services?.length>0){const e=n.services[0];e.onLoginRequest&&(e.onLoginRequestProvided=!0),e.onLogoutRequest&&(e.onLogoutRequestProvided=!0),e.onSignupRequest&&(e.onSignupRequestProvided=!0),e.onProfileRequest&&(e.onProfileRequestProvided=!0),e.onHelpRequest&&(e.onHelpRequestProvided=!0)}return n}function kr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=se(null);return ie((()=>{e?r.current?.close():r.current?.showModal()}),[e]),ie((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Te("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function Pr({closed:e,children:t,...n}){return Te("div",{...n,
151
151
  className:ke("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Te("div",{className:"relative w-full h-full",children:t})})}function Tr({document_:e=document,...t}){return Te(ae((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?kr:Pr),[e]),{...t})}function Mr({config:e,groupId:t}){return Te("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:Ar(e.notebookAppUrl,{...Rr(e.notebookAppUrl,e),group:t})})}function Lr({eventBus:e,config:t}){const[n,o]=oe(0),[i,r]=oe(!0),[s,a]=oe(null),l=se(""),c=se(null);ie((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),ie((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),ie((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const u=le((()=>{r(!0),c.current?.publish("closeNotebook")}),[])
152
152
  ;return null===s?null:Te(Tr,{closed:i,onClose:u,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Te("div",{className:"absolute right-0 m-3",children:Te(Ct,{title:"Close notebook",onClick:u,variant:"dark",classes:ke("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Te(Fe,{className:"w-4 h-4"})})}),Te(Mr,{config:t,groupId:s},n)]})}class Or{constructor(e,t,n){this._container=new Zn("notebook",(()=>Te(Lr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Ir({eventBus:e,config:t}){const[n,o]=oe(!0),i=se(null);ie((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{o(!1)})),i.current=t,()=>{t.destroy()}}),[e]);const r=()=>{o(!0),i.current?.publish("closeProfile")};return n?null:Te(Tr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Te("div",{className:"absolute right-0 m-3",children:Te(Ct,{
153
153
  title:"Close profile dialog",onClick:r,variant:"dark",classes:ke("!bg-transparent enabled:hover:!bg-grey-3"),children:Te(Fe,{className:"w-4 h-4"})})}),Te("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Br{constructor(e,t,n){this._container=new Zn("profile",(()=>Te(Ir,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Hr({above:e,below:t,buckets:n,onFocusAnnotations:o,onScrollToAnnotation:i,onSelectAnnotations:r}){const s=e.anchors.length>0,a=t.anchors.length>0,l=e=>e.anchors.map((e=>e.tag));return Te("ul",{className:"relative",children:[s&&Te("li",{className:"absolute right-0 pointer-events-auto mt-[-11px]",style:{top:e.position},children:Te(Qt,{"data-testid":"up-navigation-button",direction:"up",onClick:()=>{const t=[...e.anchors].sort(((e,t)=>e.bottom-t.bottom)),n=t[t.length-1];i(n.tag)},onBlur:()=>o([]),onFocus:()=>o(l(e)),onMouseEnter:()=>o(l(e)),onMouseOut:()=>o([]),
@@ -541,7 +541,7 @@ className:"text-color-text-light cursor-default","aria-label":`Tag: ${n}`,lang:"
541
541
  const[n,r]=se(!0),[o,i]=se(!1),a=gs(),s=a.defaultAuthority(),l=a.getDraft(e),c=a.isFeatureEnabled("at_mentions"),u=l?.tags??e.tags,d=l?.text??e.text,h=d.length>0,m=u.length>0,p=Io(["annotationFontFamily"],t),f=he((()=>mi(e.user,s)),[e,s]),g=f?"display-name":"username",v=e=>a.getLink("search.tag",{tag:e});return et("div",{className:"space-y-4",children:[h&&et(Gs,{collapse:n,collapsedHeight:400,inlineControls:!1,onCollapsibleChanged:i,onToggleCollapsed:r,overflowThreshold:20,children:et(Ep,{markdown:d,classes:Ze({"p-redacted-text":Ni(e)}),style:p,mentions:e.mentions,mentionsEnabled:c,mentionMode:g})}),(o||m)&&et("div",{className:"flex flex-row gap-x-2",children:[et("div",{className:"grow",children:m&&et(Tp,{children:u.map((e=>et(Cp,{tag:e,href:f?void 0:v(e)},e)))})}),o&&et("div",{children:et(Mp,{classes:Ze("-mt-3"),collapsed:n,setCollapsed:r})})]})]})}),["settings"]);let zp,Lp=function(e){return e.ANCHOR_LINK="ANCHOR_LINK",e.IMAGE_LINK="IMAGE_LINK",e}({});function Op(e,t,n,r){
542
542
  let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,i+=r.length-n):i<=t||(o<=t&&i>=t+n?i+=r.length-n:o<t&&i<t+n?o=t:o<t+n&&i>t+n?i+=r.length-n:t<o&&t+n>i&&(o=t,i=t+n)),{text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Rp(e,t=Lp.ANCHOR_LINK){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===Lp.IMAGE_LINK&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Op(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://insert-your-link-here.com";return r=Op(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Pp(e,t,n,r){void 0===n&&(n=t);const o=e.text.slice(e.selectionStart-t.length,e.selectionStart),i=e.text.slice(e.selectionEnd,e.selectionEnd+t.length);let a=e;return e.selectionStart===e.selectionEnd&&r&&(a=Op(e,e.selectionStart,0,r),
543
543
  a.selectionStart=a.selectionEnd-r.length),o===t&&i===n?(a=Op(a,a.selectionStart-t.length,t.length,""),a=Op(a,a.selectionEnd,n.length,"")):(a=Op(a,a.selectionStart,0,t),a=Op(a,a.selectionEnd,0,n)),a}function Dp(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Fp(e,t,n,r){let o=function(e,t){const n=e.lastIndexOf("\n",t);return n<0?0:n+1}(e.text,t),i=Dp(e.text,t),a=0;for(;i<=Dp(e.text,n);){const t=i===e.text.length,s=i-o,l=Dp((e=r(e,o,i,a)).text,o)-o;if(n+=l-s,t)break;o=o+l+1,i=Dp(e.text,o),a+=1}return e}function Hp(e,t){const n=e.selectionStart,r=e.selectionEnd,o=e=>"function"==typeof t?t(e):t;let i=!0;return Fp(e,n,r,((e,t,n,r)=>{const a=o(r);return e.text.slice(t,t+a.length)!==a&&(i=!1),e})),Fp(e,n,r,i?(e,t,n,r)=>Op(e,t,o(r).length,""):(e,t,n,r)=>{const i=o(r);return e.text.slice(t,t+i.length)===i?e:Op(e,t,0,i)})}const Bp=!1;function $p({user:e,usersListboxId:t,highlighted:n,mentionMode:r,onSelect:o,onHighlight:i}){const a="username"===r;return et("li",{id:`${t}-${e.username}`,
544
- className:Ze("flex justify-between items-center gap-x-2 rounded p-2","leading-tight",{"bg-grey-2":n}),onClick:e=>{e.stopPropagation(),o()},onMouseMove:i,role:"option","aria-selected":n,children:[a&&et("span",{className:"truncate","data-testid":`username-${e.username}`,children:e.username}),et("span",{className:Ze({"text-color-text-light":a}),children:e.displayName})]},e.username)}function jp({loadingUsers:e,users:t,onSelectUser:n,highlightedSuggestion:r,onHighlightSuggestion:o,usersListboxId:i,mentionMode:a,...s}){return et(eo,{...s,classes:"p-1",children:et("ul",{className:"flex-col gap-y-0.5",role:"listbox","aria-orientation":"vertical",id:i,children:e?et("li",{className:"italic p-2","data-testid":"suggestions-loading-indicator",children:"Loading suggestions…"}):et(x,{children:[t.map(((e,t)=>et($p,{user:e,highlighted:r===t,mentionMode:a,usersListboxId:i,onSelect:()=>n(e),onHighlight:()=>o(t)},e.username))),0===t.length&&et("li",{className:"italic p-2","data-testid":"suggestions-fallback",
544
+ className:Ze("flex justify-between items-center gap-x-2 rounded p-2","leading-tight",{"bg-grey-2":n}),onClick:e=>{e.stopPropagation(),o()},onMouseMove:i,role:"option","aria-selected":n,children:[a&&et("span",{className:"truncate","data-testid":`username-${e.username}`,children:e.username}),et("span",{className:Ze({"text-color-text-light":a}),children:e.displayName})]},e.username)}function jp({loadingUsers:e,users:t,onSelectUser:n,highlightedSuggestion:r,onHighlightSuggestion:o,usersListboxId:i,mentionMode:a,...s}){return et(eo,{...s,classes:Ze("p-1",["!max-h-96"]),children:et("ul",{className:"flex-col gap-y-0.5",role:"listbox","aria-orientation":"vertical",id:i,children:e?et("li",{className:"italic p-2","data-testid":"suggestions-loading-indicator",children:"Loading suggestions…"}):et(x,{children:[t.map(((e,t)=>et($p,{user:e,highlighted:r===t,mentionMode:a,usersListboxId:i,onSelect:()=>n(e),onHighlight:()=>o(t)},e.username))),0===t.length&&et("li",{className:"italic p-2","data-testid":"suggestions-fallback",
545
545
  children:"No matches. You can still write the username"})]})})})}const qp={bold:"b",image:"g",italic:"i",link:"l",list:"u",math:"m",numlist:"o",quote:"q"};function Up({disabled:e=!1,icon:t,label:n,onClick:r,shortcutKey:o,title:i=""}){const a=he((()=>Rs()?"Cmd":"Ctrl"),[]);let s=i;o&&(s+=` (${a}-${o.toUpperCase()})`);const l={disabled:e,onClick:r,title:s};return n?et(wr,{classes:"p-1.5 text-grey-7 hover:text-grey-9",...l,size:"custom",variant:"custom",children:n}):et(Ar,{classes:"px-2 py-2.5",...l,children:t&&et(t,{className:"w-[10px] h-[10px] touch:w-[13px] touch:h-[13px]"})})}function Gp({classes:e,containerRef:t,mentionsEnabled:n,usersForMentions:r,onEditText:o,onKeyDown:i,mentionMode:a,onInsertMentionSuggestion:s,...l}){const[c,u]=se(!1),[d,h]=se(),m=Le(t),[p,f]=se(0),g=de(null),v=he((()=>n?function(e,t,n){return void 0===e||"loading"===t.status?[]:t.users.filter((t=>!e||`${t.username} ${t.displayName??""}`.toLowerCase().match(e.toLowerCase()))).slice(0,10)}(d,r):[]),[d,n,r]),b=me((e=>{if(!n)return
546
546
  ;const{x:t,y:r}=function(e){zp||(zp=document.createElement("div"),document.body.append(zp));try{const t=e.getBoundingClientRect(),n=window.getComputedStyle(e);zp.style.font=n.font,zp.style.padding=n.padding,zp.style.whiteSpace="pre-wrap",zp.style.wordWrap="break-word",zp.style.position="fixed",Bp||(zp.style.visibility="hidden"),zp.style.width=`${t.width}px`,zp.style.height=`${t.height}px`,zp.style.top=`${t.top}px`,zp.style.left=`${t.left}px`;const r=e.selectionStart,o=document.createElement("span");o.style.display="inline-block",o.style.verticalAlign="bottom";const i=e.value.substring(0,r),a=e.value.slice(r),s="\nx";zp.innerHTML="",zp.append(i,o,a,s),zp.style.overflowY="auto",zp.scrollTop=e.scrollTop;const l=o.getBoundingClientRect();return{x:l.left-t.left,y:l.top-t.top}}finally{zp.remove(),zp=void 0}}(e);g.current&&(g.current.style.transform=`translate(${t}px, ${r}px)`);const o=function(e,t){const{start:n}=Qs(e,t);return e.slice(n,t)}(e.value,e.selectionStart),i=o.startsWith("@");u(i),
547
547
  h(i?o.substring(1):void 0),i||f(0)}),[n]),y=me((e=>{const t=m.current,{value:n}=t,{start:r,end:i}=Qs(n,t.selectionStart),l=`${n.slice(0,r)}${function(e,t){return"display-name"===t?el(e.displayName??""):`@${e.username}`}(e,a)} `,c=n.slice(i);t.value=`${l}${c}`,t.selectionStart=l.length,t.selectionEnd=l.length,t.focus(),o(t.value),s?.(e),u(!1),f(0)}),[a,o,s,m]),_=fe(),w=he((()=>{if(!c)return{};const e=v[p],t=e?`${_}-${e.username}`:void 0;return{role:"combobox","aria-controls":_,"aria-expanded":!0,"aria-autocomplete":"list","aria-haspopup":"listbox","aria-activedescendant":t}}),[p,c,v,_]);return et("div",{className:"relative",children:[et("textarea",{className:Ze("border rounded p-2","text-color-text-light bg-grey-0","focus:bg-white focus:outline-none focus:shadow-focus-inner",e),onInput:e=>{o(e.target.value),f(0)},...l,onKeyUp:e=>{["Escape","Enter"].includes(e.key)||b(e.target)},onKeyDown:e=>{i?.(e),c&&0!==v.length&&("ArrowDown"===e.key?(e.preventDefault(),
@@ -584,7 +584,7 @@ const Wf=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5
584
584
  return t}function ag(e){return Ai(e)?"orphan":Ei(e)?"note":"annotation"}function sg(e){return Es([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function lg(e){return Es([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}const cg={Newest:(e,t)=>{const n=sg(e),r=sg(t);return n>r?-1:n<r?1:0},Oldest:(e,t)=>{const n=lg(e),r=lg(t);return n<r?-1:n>r?1:0},Location:(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=Mi(e.annotation),r=Mi(t.annotation);if(n.cfi&&r.cfi){const e=$f(n.cfi,r.cfi);if(0!==e)return Math.sign(e)}else{if(n.cfi)return-1;if(r.cfi)return 1}const o=n.position??Number.MAX_SAFE_INTEGER,i=r.position??Number.MAX_SAFE_INTEGER;return Math.sign(o-i)}};const ug=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,
585
585
  selected:t.selected,sortCompareFn:cg[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=og(e,eg);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,
586
586
  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=>Qf([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&Qf([e.annotation],o).length>0)}const r=Ff(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(ki(e.annotation))return!1;const n=ag(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function dg(){const e=gs(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=he((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return ug(s)}
587
- var hg,mg,pg=Lo((function({loadAnnotationsService:e,onLogin:t}){const n=gs(),r=n.routeParams().id??"",{rootThread:o}=dg(),i=n.profile().userid,[a,s]=se(!1);return ce((()=>{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]),et(x,{children:[a&&et(vs,{errorType:"annotation",onLoginRequest:t}),et(Tf,{threads:o.children})]})}),["loadAnnotationsService"]);class fg{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.1591.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])}
587
+ var hg,mg,pg=Lo((function({loadAnnotationsService:e,onLogin:t}){const n=gs(),r=n.routeParams().id??"",{rootThread:o}=dg(),i=n.profile().userid,[a,s]=se(!1);return ce((()=>{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]),et(x,{children:[a&&et(vs,{errorType:"annotation",onLoginRequest:t}),et(Tf,{threads:o.children})]})}),["loadAnnotationsService"]);class fg{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.1592.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])}
588
588
  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 gg=function(){if(mg)return hg;mg=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,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,
589
589
  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}}(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){
590
590
  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 hg=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,m=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 p=[];u;)if(l.debug&&console.log("Scrolling parent node",u),h(u,d)&&(m?m(u,i):i(u))&&(d++,p.push(u)),!(u=s(u))){f(e);break}return p.reduce(((e,i,a)=>function(e,n,i,a,s){
@@ -672,7 +672,7 @@ null==v._nextState&&null==v.__s&&(v._nextState=v.__s=v.state),v.context=y,h.getD
672
672
  }),et("body",{children:[et("section",{children:[et("h1",{children:"Summary"}),et("p",{children:et("time",{dateTime:o.toISOString(),children:iy(o)})}),et("p",{children:et("strong",{children:a})}),et("p",{children:et("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),et("table",{children:et("tbody",{style:{verticalAlign:"top"},children:[et("tr",{children:[et("td",{children:"Group:"}),et("td",{children:t})]}),et("tr",{children:[et("td",{children:"Total users:"}),et("td",{children:s.length})]}),et("tr",{children:[et("td",{children:"Users:"}),et("td",{children:s.join(", ")})]}),et("tr",{children:[et("td",{children:"Total annotations:"}),et("td",{children:e.length})]}),et("tr",{children:[et("td",{children:"Total replies:"}),et("td",{children:l.length})]})]})})]}),et("hr",{}),et("section",{children:[et("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Li(e),r=Ii(e),o=kp(e.text),i=o===`<p>${e.text}</p>`?e.text:o;return et("article",{children:[et("h2",{children:["Annotation ",t+1,":"]
673
673
  }),et("table",{children:et("tbody",{style:{verticalAlign:"top"},children:[et("tr",{children:[et("td",{children:"Created at:"}),et("td",{children:et("time",{dateTime:e.created,children:iy(new Date(e.created))})})]}),et("tr",{children:[et("td",{children:"Author:"}),et("td",{children:c(e)})]}),n&&et("tr",{children:[et("td",{children:"Page:"}),et("td",{children:n})]}),et("tr",{children:[et("td",{children:"Type:"}),et("td",{children:Ci(e)})]}),r&&et("tr",{children:[et("td",{children:"Quote:"}),et("td",{children:et("blockquote",{style:{margin:0},children:r})})]}),et("tr",{children:[et("td",{children:"Comment:"}),et("td",{dangerouslySetInnerHTML:{__html:i}})]}),e.tags.length>0&&et("tr",{children:[et("td",{children:"Tags:"}),et("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Ts(e,n,t),{uri:i,title:a}=pi(r);return{uri:i,title:a,
674
674
  uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>bi(e))),extractUsername:o}}}ay.$inject=[];class sy extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),this.url=e,this.response=t,this.reason=n}}async function ly(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new sy(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch{throw new sy(e,n,"Failed to parse response")}if(!n.ok)throw new sy(e,n,r?.reason);return r}class cy{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={
675
- "Content-Type":"application/json","Hypothesis-Client-Version":"1.1591.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:m}=ja(c.url,a),p=new URL(h);for(const[e,t]of Object.entries(m)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&p.searchParams.append(e,t.toString())}return await ly(p.toString(),{body:s?JSON.stringify(oy(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={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")},members:{read:i("group.members.read")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},
675
+ "Content-Type":"application/json","Hypothesis-Client-Version":"1.1592.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:m}=ja(c.url,a),p=new URL(h);for(const[e,t]of Object.entries(m)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&p.searchParams.append(e,t.toString())}return await ly(p.toString(),{body:s?JSON.stringify(oy(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={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")},members:{read:i("group.members.read")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},
676
676
  read:i("profile.read"),update:i("profile.update")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}cy.$inject=["apiRoutes","auth","store"];var uy,dy,hy,my,py,fy={};function gy(){return hy||(hy=1,e=fy,t=function(){if(dy)return uy;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 dy=1,uy=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){
677
677
  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},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)},
678
678
  e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.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},uy}(),e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
@@ -785,8 +785,8 @@ this._store.highlightAnnotations(e.map((({id:e})=>e)).filter(Boolean)),this._win
785
785
  this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else Kv("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){this._configMessages[e]=t,this._socket?.isConnected()&&this._socket.send(t)}async _reconnect(){const e=await this._websocketURL;if(!e)return;let t,n;this._socket?.close();try{t=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(t){const r=new URL(e);r.searchParams.set("access_token",t),n=r.toString()}else n=e;const r=new YN(n);r.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(r)})),r.on("disconnect",(()=>{if(++this._reconnectionAttempts,this._reconnectionAttempts<10){const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)
786
786
  }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,Py(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}XN.$inject=["store","apiRoutes","auth","groups","session","$window"];const ZN="hypothesis.user.tags.list",JN="hypothesis.user.tags.map";class QN{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(ZN)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Zv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){
787
787
  const t=this._storage.getObject(JN)||{};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(JN,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(ZN,n)}}QN.$inject=["localStorage"];class eS{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}eS.$inject=["store"];class tS extends Cg.TinyEmitter{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}={}){
788
- 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:Bv(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)}}tS.$inject=["store","$window"];const nS=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),rS=function(e){const{version:t,origin:n}=jv(e.location.href);return"1.1591.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1591.0) than the host page (${t}). It may not work.`),
789
- !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 oS(e,t){e.setClientId(t.clientId)}function iS(e){e.sync()}function aS(e,t){e.load(),t.load()}function sS(e,t,n){e.init(),t.init(),n.init()}function lS(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})}))}nS.sentry&&rS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;RN({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1591.0",beforeSend:(e,t)=>{if(PN>=5)return Kv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++PN;try{const n=t&&t.originalException
788
+ 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:Bv(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)}}tS.$inject=["store","$window"];const nS=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),rS=function(e){const{version:t,origin:n}=jv(e.location.href);return"1.1592.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1592.0) than the host page (${t}). It may not work.`),
789
+ !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 oS(e,t){e.setClientId(t.clientId)}function iS(e){e.sync()}function aS(e,t){e.load(),t.load()}function sS(e,t,n){e.init(),t.init(),n.init()}function lS(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})}))}nS.sentry&&rS&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;RN({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1592.0",beforeSend:(e,t)=>{if(PN>=5)return Kv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++PN;try{const n=t&&t.originalException
790
790
  ;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch{}return e}});try{zx("host_config",jv(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>"))),Cy(((e,t)=>{DN(e,t)}))}(nS.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),oS.$inject=["api","streamer"],iS.$inject=["router"],aS.$inject=["groups","session"],sS.$inject=["autosaveService","persistedDefaults","serviceURL"],lS.$inject=["frameSync","store","toastMessenger"];const cS=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",ob)}(),async function(e,t=window){const n=function(e){
791
791
  const t=jv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:qv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Gv(t.origin),ancestorLevel:Uv(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:Vv(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await $v(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services
792
792
  ;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=$v(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=To(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(nS).then((e=>{!function(e,t){const n=new V