hypothesis 1.1506.0 → 1.1507.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/boot.js +1 -1
- package/build/manifest.json +11 -11
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/sidebar.bundle.js +6 -6
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css +1 -16
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +1 -21
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +1 -21
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +2 -2
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?4fae21","styles/annotator.css":"styles/annotator.css?4419eb","styles/annotator.css.map":"styles/annotator.css.map?2f69d8","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?58e394","styles/katex.min.css.map":"styles/katex.min.css.map?1785d7","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?83126d","styles/sidebar.css.map":"styles/sidebar.css.map?a87d69","styles/ui-playground.css":"styles/ui-playground.css?9c695e","styles/ui-playground.css.map":"styles/ui-playground.css.map?30fd11","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?e24c09","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?52153d","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?327f04","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?4b9456","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?37658c"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),p=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1507.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,p=["styles/katex.min.css","styles/sidebar.css"];l<p.length;l++)e(s,i(t,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 u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var p=[];void 0!==window.PDFViewerApplication&&p.push("styles/pdfjs-overrides.css"),p.push("styles/highlights.css");for(var c=0,u=p;c<u.length;c++)e(s,i(t,u[c]))}}(document,{assetRoot:p,manifest:s,notebookAppUrl:d,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,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
3
|
-
"styles/annotator.css": "styles/annotator.css?
|
|
4
|
-
"styles/annotator.css.map": "styles/annotator.css.map?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?4fae21",
|
|
3
|
+
"styles/annotator.css": "styles/annotator.css?4419eb",
|
|
4
|
+
"styles/annotator.css.map": "styles/annotator.css.map?2f69d8",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
6
6
|
"styles/highlights.css.map": "styles/highlights.css.map?241350",
|
|
7
7
|
"styles/katex.min.css": "styles/katex.min.css?58e394",
|
|
8
8
|
"styles/katex.min.css.map": "styles/katex.min.css.map?1785d7",
|
|
9
9
|
"styles/pdfjs-overrides.css": "styles/pdfjs-overrides.css?c95edf",
|
|
10
10
|
"styles/pdfjs-overrides.css.map": "styles/pdfjs-overrides.css.map?1d8ac6",
|
|
11
|
-
"styles/sidebar.css": "styles/sidebar.css?
|
|
12
|
-
"styles/sidebar.css.map": "styles/sidebar.css.map?
|
|
13
|
-
"styles/ui-playground.css": "styles/ui-playground.css?
|
|
14
|
-
"styles/ui-playground.css.map": "styles/ui-playground.css.map?
|
|
15
|
-
"scripts/
|
|
11
|
+
"styles/sidebar.css": "styles/sidebar.css?83126d",
|
|
12
|
+
"styles/sidebar.css.map": "styles/sidebar.css.map?a87d69",
|
|
13
|
+
"styles/ui-playground.css": "styles/ui-playground.css?9c695e",
|
|
14
|
+
"styles/ui-playground.css.map": "styles/ui-playground.css.map?30fd11",
|
|
15
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?e24c09",
|
|
16
16
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?52153d",
|
|
17
|
-
"scripts/
|
|
18
|
-
"scripts/
|
|
19
|
-
"scripts/
|
|
17
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?327f04",
|
|
18
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?4b9456",
|
|
19
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?37658c"
|
|
20
20
|
}
|
|
@@ -135,7 +135,7 @@ this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?
|
|
|
135
135
|
if(!t.selector||!t.selector.some((e=>"TextQuoteSelector"===e.type)))return{annotation:e,target:t};let n;try{const i=await this._integration.anchor(this.element,t.selector),o=Vn.fromRange(i);n={annotation:e,target:t,range:o}}catch(i){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&&Jn(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=[]
|
|
136
136
|
;const n=await this.getDocumentInfo(),i=this.element,r=(await Promise.all(t.map((e=>this._integration.describe(i,e))))).map((e=>({source:n.uri,selector:e}))),s={uri:n.uri,document:n.metadata,target:r,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+o(8)};return this._sidebarRPC.call("createAnnotation",s),this.anchor(s),vr(),s}_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);ei(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(),i=zn(n),o=Yn(n);o?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=mr(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],
|
|
137
137
|
this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}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){st(e,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(e){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new dr(this.element)),this._outsideAssignmentNotice.setVisible(e)}}function wr(e,t){const n=new URL(e),i=new URLSearchParams
|
|
138
|
-
;return i.append("config",JSON.stringify(t)),n.hash=i.toString(),n.toString()}function xr(e,t){const n={};for(const[e,i]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=i&&(n[e]=i);n.origin=new URL(e).origin,n.version="1.
|
|
138
|
+
;return i.append("config",JSON.stringify(t)),n.hash=i.toString(),n.toString()}function xr(e,t){const n={};for(const[e,i]of Object.entries(t))"notebookAppUrl"!==e&&"sidebarAppUrl"!==e&&null!=i&&(n[e]=i);n.origin=new URL(e).origin,n.version="1.1507.0";const i=new URL(window.location.href);if(i.hash="",n.hostURL=i.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 Cr({closed:e,onClose:t,children:n,"data-testid":i,"aria-label":o}){const r=Ye(null);return je((()=>{e?r.current?.close():r.current?.showModal()}),[e]),je((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),bt("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":i,
|
|
139
139
|
"aria-label":o,children:n})}function Sr({closed:e,children:t,...n}){return bt("div",{...n,className:_t("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:bt("div",{className:"relative w-full h-full",children:t})})}function Nr({document_:e=document,...t}){return bt(Ke((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?Cr:Sr),[e]),{...t})}function Er({config:e,groupId:t}){return bt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:wr(e.notebookAppUrl,{...xr(e.notebookAppUrl,e),group:t})})}function Ar({eventBus:e,config:t}){const[n,i]=ze(0),[o,r]=ze(!0),[s,a]=ze(null),l=Ye(""),c=Ye(null);je((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),je((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),je((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),i((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}
|
|
140
140
|
}),[e]);const h=Ge((()=>{r(!0),c.current?.publish("closeNotebook")}),[]);return null===s?null:bt(Nr,{closed:o,onClose:h,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[bt("div",{className:"absolute right-0 m-3",children:bt(rn,{title:"Close notebook",onClick:h,variant:"dark",classes:_t("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:bt(At,{className:"w-4 h-4"})})}),bt(Er,{config:t,groupId:s},n)]})}class Tr{constructor(e,t,n){this._container=new Tn("notebook",(()=>bt(Ar,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function kr({eventBus:e,config:t}){const[n,i]=ze(!0),o=Ye(null);je((()=>{const t=e.createEmitter();return t.subscribe("openProfile",(()=>{i(!1)})),o.current=t,()=>{t.destroy()}}),[e]);const r=()=>{i(!0),o.current?.publish("closeProfile")};return n?null:bt(Nr,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[bt("div",{
|
|
141
141
|
className:"absolute right-0 m-3",children:bt(rn,{title:"Close profile dialog",onClick:r,variant:"dark",classes:_t("!bg-transparent enabled:hover:!bg-grey-3"),children:bt(At,{className:"w-4 h-4"})})}),bt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Rr{constructor(e,t,n){this._container=new Tn("profile",(()=>bt(kr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}var Pr={exports:{}};!function(e){!function(t,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l="function",c=Math.round,h=Math.abs,u=Date.now;function d(e,t,n){return setTimeout(b(e,n),t)}function f(e,t,n){return!!Array.isArray(e)&&(p(e,n[t],n),!0)}function p(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==o)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function m(e,n,i){var o="DEPRECATED METHOD: "+n+"\n"+i+" AT \n"
|
|
@@ -550,7 +550,7 @@ const gf=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5
|
|
|
550
550
|
;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=Wo(e.annotation),r=Wo(t.annotation);if(n.cfi&&r.cfi){const e=uf(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 zf=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,sortCompareFn:If[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=Af(e,xf);for(const e of h){
|
|
551
551
|
const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and"},cfi:{terms:r,operator:"or"},quote:{terms:i,operator:"and"},page:{terms:o,operator:"or"},since:{terms:d,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=(e,t)=>new bf(t,wf[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"]
|
|
552
552
|
;r=t.terms.map((t=>new yf("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new yf(t.operator,r)})),o=new yf("and",r);return e.filter((e=>e.id&&o.matches(e))).map((e=>e.id))}([t],e).length>0}const r=sf(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(Ho(e.annotation))return!1;const n=Tf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Lf(){const e=Ma(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=ce((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return zf(s)}var Of=Qr((function({loadAnnotationsService:e,onLogin:t}){const n=Ma(),r=n.routeParams().id??"",{rootThread:o}=Lf(),i=n.profile().userid,[a,s]=oe(!1);return ae((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0]
|
|
553
|
-
;t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Pe(_,{children:[a&&Pe(Ia,{errorType:"annotation",onLoginRequest:t}),Pe(Xp,{threads:o.children})]})}),["loadAnnotationsService"]);class Pf{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.
|
|
553
|
+
;t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Pe(_,{children:[a&&Pe(Ia,{errorType:"annotation",onLoginRequest:t}),Pe(Xp,{threads:o.children})]})}),["loadAnnotationsService"]);class Pf{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.1507.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])}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`}
|
|
554
554
|
asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}var Rf="complete",Df="canceled";function Ff(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function Bf(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=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,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),
|
|
555
555
|
o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return Ff(e,r.x,r.y),e._scrollSettings=null,t.end(Rf);var a=1-t.ease(i);if(Ff(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&Bf(t.scrollAncestor),void Bf(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(Bf.bind(null,e))}}function Hf(e){return e.self===e}function jf(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function qf(){return!0}function $f(e){if(e.assignedSlot)return $f(e.assignedSlot)
|
|
556
556
|
;if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var Uf=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{};var r=$f(e),o=1,i=t.validTarget||qf,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var s=[];r;)if(t.debug&&console.log("Scrolling parent node",r),i(r,o)&&(a?a(r,jf):jf(r))&&(o++,s.push(r)),!(r=$f(r))){l(Rf);break}return s.reduce(((n,r,o)=>function(e,t,n,r,o){var i,a=!t._scrollSettings,s=t._scrollSettings,l=Date.now(),c={passive:!0};function u(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),
|
|
@@ -637,7 +637,7 @@ null==v._nextState&&null==v.__s&&(v._nextState=v.__s=v.state),v.context=y,h.getD
|
|
|
637
637
|
}),Pe("body",{children:[Pe("section",{children:[Pe("h1",{children:"Summary"}),Pe("p",{children:Pe("time",{dateTime:o.toISOString(),children:zp(o)})}),Pe("p",{children:Pe("strong",{children:a})}),Pe("p",{children:Pe("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Pe("table",{children:Pe("tbody",{style:{verticalAlign:"top"},children:[Pe("tr",{children:[Pe("td",{children:"Group:"}),Pe("td",{children:t})]}),Pe("tr",{children:[Pe("td",{children:"Total users:"}),Pe("td",{children:s.length})]}),Pe("tr",{children:[Pe("td",{children:"Users:"}),Pe("td",{children:s.join(", ")})]}),Pe("tr",{children:[Pe("td",{children:"Total annotations:"}),Pe("td",{children:e.length})]}),Pe("tr",{children:[Pe("td",{children:"Total replies:"}),Pe("td",{children:l.length})]})]})})]}),Pe("hr",{}),Pe("section",{children:[Pe("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Xo(e),r=Yo(e),o=Fm(e.text),i=o===`<p>${e.text}</p>`?e.text:o;return Pe("article",{children:[Pe("h2",{children:["Annotation ",t+1,":"]
|
|
638
638
|
}),Pe("table",{children:Pe("tbody",{style:{verticalAlign:"top"},children:[Pe("tr",{children:[Pe("td",{children:"Created at:"}),Pe("td",{children:Pe("time",{dateTime:e.created,children:zp(new Date(e.created))})})]}),Pe("tr",{children:[Pe("td",{children:"Author:"}),Pe("td",{children:c(e)})]}),n&&Pe("tr",{children:[Pe("td",{children:"Page:"}),Pe("td",{children:n})]}),Pe("tr",{children:[Pe("td",{children:"Type:"}),Pe("td",{children:Vo(e)})]}),r&&Pe("tr",{children:[Pe("td",{children:"Quote:"}),Pe("td",{children:Pe("blockquote",{style:{margin:0},children:r})})]}),Pe("tr",{children:[Pe("td",{children:"Comment:"}),Pe("td",{dangerouslySetInnerHTML:{__html:i}})]}),e.tags.length>0&&Pe("tr",{children:[Pe("td",{children:"Tags:"}),Pe("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=>as(e,n,t),{uri:i,title:a}=Io(r);return{uri:i,title:a,
|
|
639
639
|
uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Po(e))),extractUsername:o}}}Cb.$inject=[];class Mb 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 Ib(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Mb(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Mb(e,n,"Failed to parse response")}if(!n.ok)throw new Mb(e,n,r?.reason);return r}class zb{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)=>{o();try{const[o,i]=await Promise.all([e,n()]),l=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!l)throw new Error(`Missing API route: ${t}`);const c={
|
|
640
|
-
"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
640
|
+
"Content-Type":"application/json","Hypothesis-Client-Version":"1.1507.0"};i&&(c.Authorization="Bearer "+i);const u=r();u&&(c["X-Client-Id"]=u);const{url:d,unusedParams:h}=na(l.url,a),m=new URL(d);for(const[e,t]of Object.entries(h)){const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await Ib(m.toString(),{body:s?JSON.stringify(Tb(s)):null,headers:c,method:l.method})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")},
|
|
641
641
|
this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}zb.$inject=["apiRoutes","auth","store"];var Lb={};function Ob(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Pb=Ob;Ob.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Ob.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Ob.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),
|
|
642
642
|
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},Ob.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)},Ob.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Ob.prototype.start=function(e){
|
|
643
643
|
console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Ob.prototype.start=Ob.prototype.try,Ob.prototype.errors=function(){return this._errors},Ob.prototype.attempts=function(){return this._attempts},Ob.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=Pb;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));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort((function(e,t){return e-t})),r},
|
|
@@ -665,7 +665,7 @@ logo:"data:image/svg+xml;utf8,"+encodeURIComponent('<?xml version="1.0" encoding
|
|
|
665
665
|
;const[l,c,u,d,h]=await Promise.all([this._api.profile.groups.read({expand:ay}),this._api.groups.list(a),this._auth.getAccessToken(),r,i]);h&&!c.some((e=>e.id===h.id))&&c.push(h);let m=null;if(d){m=d.group;const e=l.concat(c).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);c.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const p=null!==u,f=await this._filterGroups(Nv(l,c,t,this._settings),p,m,o),g=m||o||null;return this._addGroupsToStore(f,g),f}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:ay});let n=null;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}},o=await Promise.all(e.map((e=>t.find((t=>t.id===e||t.groupid===e))||r(e)))),i=o.filter((e=>null!==e)),a=this._store.directLinkedGroupId();return this._addGroupsToStore(i,a),n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){const e=this._serviceConfig?.groups
|
|
666
666
|
;if(Array.isArray(e)||(t=e,"function"==typeof t?.then)){let t=[];try{t=await e}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}return this._loadServiceSpecifiedGroups(t)}return this._loadGroupsForUserAndDocument();var t}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!Po(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}}sy.$inject=["store","api","auth","settings","toastMessenger"];const ly=Object.prototype.toString;function cy(e){switch(ly.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return yy(e,Error)}}function uy(e,t){return ly.call(e)===`[object ${t}]`}function dy(e){return uy(e,"ErrorEvent")}function hy(e){return uy(e,"DOMError")}function my(e){
|
|
667
667
|
return uy(e,"String")}function py(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function fy(e){return null===e||py(e)||"object"!=typeof e&&"function"!=typeof e}function gy(e){return uy(e,"Object")}function vy(e){return"undefined"!=typeof Event&&yy(e,Event)}function by(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function yy(e,t){try{return e instanceof t}catch(e){return!1}}function _y(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function wy(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function xy(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{_y(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function ky(e,t,n=!1){return!!my(e)&&(uy(t,"RegExp")?t.test(e):!!my(t)&&(n?e===t:e.includes(t)))}function Ny(e,t=[],n=!1){return t.some((t=>ky(e,t,n)))}function Sy(e,t,n=250,r,o,i,a){
|
|
668
|
-
if(!(i.exception&&i.exception.values&&a&&yy(a.originalException,Error)))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;var l,c;s&&(i.exception.values=(l=Ay(e,t,o,a.originalException,r,i.exception.values,s,0),c=n,l.map((e=>(e.value&&(e.value=wy(e.value,c)),e)))))}function Ay(e,t,n,r,o,i,a,s){if(i.length>=n+1)return i;let l=[...i];if(yy(r[o],Error)){Ey(a,s);const i=e(t,r[o]),c=l.length;Ty(i,o,c,s),l=Ay(e,t,n,r[o],o,[i,...l],i,c)}return Array.isArray(r.errors)&&r.errors.forEach(((r,i)=>{if(yy(r,Error)){Ey(a,s);const c=e(t,r),u=l.length;Ty(c,`errors[${i}]`,u,s),l=Ay(e,t,n,r,o,[c,...l],c,u)}})),l}function Ey(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Ty(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}const Cy="8.
|
|
668
|
+
if(!(i.exception&&i.exception.values&&a&&yy(a.originalException,Error)))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;var l,c;s&&(i.exception.values=(l=Ay(e,t,o,a.originalException,r,i.exception.values,s,0),c=n,l.map((e=>(e.value&&(e.value=wy(e.value,c)),e)))))}function Ay(e,t,n,r,o,i,a,s){if(i.length>=n+1)return i;let l=[...i];if(yy(r[o],Error)){Ey(a,s);const i=e(t,r[o]),c=l.length;Ty(i,o,c,s),l=Ay(e,t,n,r[o],o,[i,...l],i,c)}return Array.isArray(r.errors)&&r.errors.forEach(((r,i)=>{if(yy(r,Error)){Ey(a,s);const c=e(t,r),u=l.length;Ty(c,`errors[${i}]`,u,s),l=Ay(e,t,n,r,o,[c,...l],c,u)}})),l}function Ey(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Ty(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}const Cy="8.19.0",My=globalThis;function Iy(e,t,n){
|
|
669
669
|
const r=My,o=r.__SENTRY__=r.__SENTRY__||{},i=o[Cy]=o[Cy]||{};return i[e]||(i[e]=t())}const zy=My,Ly=80;function Oy(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,o=[];let i=0,a=0;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||Ly;for(;n&&i++<r&&(c=Py(n,u),!("html"===c||i>1&&a+o.length*l+c.length>=d));)o.push(c),a+=c.length,n=n.parentNode;return o.reverse().join(s)}catch(e){return"<unknown>"}}function Py(e,t){const n=e,r=[];if(!n||!n.tagName)return"";if(zy.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const o=t&&t.length?t.filter((e=>n.getAttribute(e))).map((e=>[e,n.getAttribute(e)])):null;if(o&&o.length)o.forEach((e=>{r.push(`[${e[0]}="${e[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&my(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}
|
|
670
670
|
const i=["aria-label","type","name","title","alt"];for(const e of i){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}const Ry="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Dy=["debug","info","warn","error","log","assert","trace"],Fy={};function By(e){if(!("console"in My))return e();const t=My.console,n={},r=Object.keys(Fy);r.forEach((e=>{const r=Fy[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}const Hy=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Ry?Dy.forEach((n=>{t[n]=(...t)=>{e&&By((()=>{My.console[n](`Sentry Logger [${n}]:`,...t)}))}})):Dy.forEach((e=>{t[e]=()=>{}})),t}(),jy=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function qy(e,t=!1){const{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r?`${r}/`:r}${a}`}function $y(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,
|
|
671
671
|
port:e.port||"",path:e.path||"",projectId:e.projectId}}function Uy(e){const t="string"==typeof e?function(e){const t=jy.exec(e);if(!t)return void By((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,o="",i="",a="",s=""]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return $y({host:i,pass:o,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):$y(e);if(t&&function(e){if(!Ry)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(Hy.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Hy.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Hy.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Hy.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}class Gy extends Error{constructor(e,t="warn"){super(e),this.message=e,
|
|
@@ -702,8 +702,8 @@ function ix(e,t){return Aw().captureEvent(e,t)}function ax(e,t){Ew().setExtra(e,
|
|
|
702
702
|
;t.forEach((e=>{e.isDefaultInstance=!0})),r=Array.isArray(n)?[...t,...n]:"function"==typeof n?P_(n(t)):t;const o=function(e){const t={};return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.values(t)}(r),i=o.findIndex((e=>"Debug"===e.name));if(i>-1){const[e]=o.splice(i,1);o.push(e)}return o}function fx(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function gx(e,t,n){if(n[t.name])uw&&Hy.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===mx.indexOf(t.name)&&"function"==typeof t.setupOnce&&(t.setupOnce(),mx.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}uw&&Hy.log(`Integration installed: ${t.name}`)}}
|
|
703
703
|
const vx="Not capturing exception because it's already been captured.";class bx{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=Uy(e.dsn):uw&&Hy.warn("No DSN provided, client will not send events."),this._dsn){const o=(t=this._dsn,n=e.tunnel,r=e._metadata?e._metadata.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${hx(t,r)}`);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:o})}var t,n,r}captureException(e,t,n){const r=C_();if(O_(e))return uw&&Hy.log(vx),r;const o={event_id:r,...t};return this._process(this.eventFromException(e,o).then((e=>this._captureEvent(e,o,n)))),o.event_id}captureMessage(e,t,n,r){const o={event_id:C_(),...n
|
|
704
704
|
},i=py(e)?e:String(e),a=fy(e)?this.eventFromMessage(i,t,o):this.eventFromException(e,o);return this._process(a.then((e=>this._captureEvent(e,o,r)))),o.event_id}captureEvent(e,t,n){const r=C_();if(t&&t.originalException&&O_(t.originalException))return uw&&Hy.log(vx),r;const o={event_id:r,...t},i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,o,i||n)),o.event_id}captureSession(e){"string"!=typeof e.release?uw&&Hy.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),pw(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.emit("flush"),this._isClientDoneProcessing(e).then((n=>t.flush(e).then((e=>n&&e))))):H_(!0)}close(e){return this.flush(e).then((e=>(this.getOptions().enabled=!1,this.emit("close"),e)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){
|
|
705
|
-
this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];gx(this,e,this._integrations),t||fx(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Kw(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=Q_(n,nw(e));const r=this.sendEnvelope(n);r&&r.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,n,r){const o=iw(n);return J_({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:qy(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const n=`${e}:${t}`;uw&&Hy.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(e,t){
|
|
706
|
-
const
|
|
705
|
+
this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];gx(this,e,this._integrations),t||fx(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Kw(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=Q_(n,nw(e));const r=this.sendEnvelope(n);r&&r.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,n,r){const o=iw(n);return J_({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:qy(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const n=`${e}:${t}`;uw&&Hy.log(`Adding outcome: "${n}"`),this._outcomes[n]=(this._outcomes[n]||0)+1}}on(e,t){const n=this._hooks[e]=this._hooks[e]||[];return n.push(t),()=>{
|
|
706
|
+
const e=n.indexOf(t);e>-1&&n.splice(e,1)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach((e=>e(...t)))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,(e=>(uw&&Hy.error("Error while sending event:",e),e))):(uw&&Hy.error("Transport disabled"),H_({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t&&gx(e,t,n)})),n}(this,e),fx(this,e)}_updateSessionFromEvent(e,t){let n=!1,r=!1;const o=t.exception&&t.exception.values;if(o){r=!0;for(const e of o){const t=e.mechanism;if(t&&!1===t.handled){n=!0;break}}}const i="ok"===e.status;(i&&0===e.errors||i&&n)&&(pw(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new q_((t=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))}),1)}))}_isEnabled(){
|
|
707
707
|
return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r=Ew()){const o=this.getOptions(),i=Object.keys(this._integrations);return!t.integrations&&i.length>0&&(t.integrations=i),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),ex(o,e,t,n,this,r).then((e=>{if(null===e)return e;const t={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if(!(e.contexts&&e.contexts.trace)&&t){const{traceId:n,spanId:r,parentSpanId:o,dsc:i}=t;e.contexts={trace:Zy({trace_id:n,span_id:r,parent_span_id:o}),...e.contexts};const a=i||Ww(n,this);e.sdkProcessingMetadata={dynamicSamplingContext:a,...e.sdkProcessingMetadata}}return e}))}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then((e=>e.event_id),(e=>{if(uw){const t=e;"log"===t.logLevel?Hy.log(t.message):Hy.warn(t)}}))}_processEvent(e,t,n){const r=this.getOptions(),{sampleRate:o}=r,i=_x(e),a=yx(e),s=e.type||"error",l=`before send for type \`${s}\``,c=void 0===o?void 0:function(e){
|
|
708
708
|
if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;if(!("number"!=typeof t||isNaN(t)||t<0||t>1))return t;uw&&Hy.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`)}(o);if(a&&"number"==typeof c&&Math.random()>c)return this.recordDroppedEvent("sample_rate","error",e),j_(new Gy(`Discarding event because it's not included in the random sample (sampling rate = ${o})`,"log"));const u="replay_event"===s?"replay":s,d=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,d).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",u,e),new Gy("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const o=function(e,t,n,r){const{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:a}=t;if(yx(n)&&o)return o(n,r);if(_x(n)){if(n.spans&&a){const t=[];for(const r of n.spans){
|
|
709
709
|
const n=a(r);n?t.push(n):e.recordDroppedEvent("before_send","span")}n.spans=t}if(i)return i(n,r)}return n}(this,r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(by(e))return e.then((e=>{if(!gy(e)&&null!==e)throw new Gy(n);return e}),(e=>{throw new Gy(`${t} rejected with ${e}`)}));if(!gy(e)&&null!==e)throw new Gy(n);return e}(o,l)})).then((r=>{if(null===r){if(this.recordDroppedEvent("before_send",u,e),_x(e)){const t=1+(e.spans||[]).length;this._outcomes.span=(this._outcomes.span||0)+t}throw new Gy(`${l} returned \`null\`, will not send event.`,"log")}const o=n&&n.getSession();!i&&o&&this._updateSessionFromEvent(o,r);const a=r.transaction_info;if(i&&a&&r.transaction!==e.transaction){const e="custom";r.transaction_info={...a,source:e}}return this.sendEvent(r,t),r})).then(null,(e=>{if(e instanceof Gy)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),
|
|
@@ -747,7 +747,7 @@ deletedAnnotations:e})}this._updateImmediately&&this.applyPendingUpdates()}else
|
|
|
747
747
|
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,ty(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}Qk.$inject=["store","apiRoutes","auth","groups","session","$window"];const Zk="hypothesis.user.tags.list",eN="hypothesis.user.tags.map";class tN{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(Zk)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1
|
|
748
748
|
;const o=n.split(/\W+/),i=new RegExp(`^${kv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(eN)||{};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(eN,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(Zk,n)}}tN.$inject=["localStorage"];class nN{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}nN.$inject=["store"];class rN extends rg{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))}
|
|
749
749
|
_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:pv(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)}}rN.$inject=["store","$window"];const oN=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),iN=function(e){const{version:t,origin:n}=gv(e.location.href)
|
|
750
|
-
;return"1.
|
|
750
|
+
;return"1.1507.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1507.0) than the host page (${t}). It may not work.`),!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function aN(e,t){e.setClientId(t.clientId)}function sN(e,t,n){e.load(),t.load(),n.sync()}function lN(e,t,n){e.init(),t.init(),n.init()}function cN(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})}))}oN.sentry&&iN&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;Dk({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1507.0",beforeSend:(e,t)=>{
|
|
751
751
|
if(Fk>=5)return xv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Fk;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch(e){}return e}});try{ax("host_config",gv(window.location.href))}catch(e){}ax("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Yb(((e,t)=>{Bk(e,t)}))}(oN.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")}))}(document.body),aN.$inject=["api","streamer"],sN.$inject=["groups","session","router"],lN.$inject=["autosaveService","persistedDefaults","serviceURL"],cN.$inject=["frameSync","store","toastMessenger"];const uN=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",Tv)}(),async function(e,t=window){const n=function(e){
|
|
752
752
|
const t=gv(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:vv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:yv(t.origin),ancestorLevel:bv(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:_v(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await fv(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services
|
|
753
753
|
;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=fv(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=Wr(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(oN).then((e=>{!function(e,t){const n=new $
|