hypothesis 1.1560.0 → 1.1561.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?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?dd9e32","styles/annotator.css":"styles/annotator.css?4a2cb6","styles/annotator.css.map":"styles/annotator.css.map?969663","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?5068b6","styles/sidebar.css.map":"styles/sidebar.css.map?c64c75","styles/ui-playground.css":"styles/ui-playground.css?b9b933","styles/ui-playground.css.map":"styles/ui-playground.css.map?d1c947","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?923a7c","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?857591","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?d4fffd","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?9baecf","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?243dea"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var o=s.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=e,t(o),s.head.appendChild(o)}function o(s,e){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&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,o,r){var n=s.createElement("link");n.rel=e,n.href=r,n.type="application/annotator+".concat(o),t(n),s.head.appendChild(n)}function n(s,e,o){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=o,"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=[()=>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 t={},e=s.querySelectorAll("script.js-hypothesis-config"),o=0;o<e.length;o++){var r=void 0;try{r=JSON.parse(e[o].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.1561.0/");if(document.querySelector("hypothesis-app")){!function(s,t){n(s,"fetch",t.apiUrl),n(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)o(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 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,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),n(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++)o(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,d=p;c<d.length;c++)e(s,i(t,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/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?dd9e32",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?4a2cb6",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?969663",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"styles/ui-playground.css": "styles/ui-playground.css?b9b933",
|
|
14
14
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?d1c947",
|
|
15
15
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?923a7c",
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?857591",
|
|
17
17
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?d4fffd",
|
|
18
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
18
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?9baecf",
|
|
19
19
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?243dea"
|
|
20
20
|
}
|
|
@@ -144,7 +144,7 @@ this._sidebarRPC.on("navigateToSegment",(e=>this._integration.navigateToSegment?
|
|
|
144
144
|
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=fo.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&&Eo(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=>({
|
|
145
145
|
source:n.uri,selector:e}))),r={uri:n.uri,document:n.metadata,target:i,$highlight:e,$cluster:e?"user-highlights":"user-annotations",$tag:"a:"+en(8)};return this._sidebarRPC.call("createAnnotation",r),this.anchor(r),Sr(),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);ko(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=bo(n),i=yo(n);i?(this.selectedRanges=[t],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=xr(),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}
|
|
146
146
|
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 wr(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={}
|
|
147
|
-
;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.
|
|
147
|
+
;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.1561.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 Pr({closed:e,onClose:t,children:n,"data-testid":o,"aria-label":i}){const r=re(null);return oe((()=>{e?r.current?.close():r.current?.showModal()}),[e]),oe((()=>{const e=r.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Pe("dialog",{ref:r,className:"relative w-full h-full backdrop:bg-black/50","data-testid":o,"aria-label":i,children:n})}function Tr({closed:e,children:t,...n}){return Pe("div",{...n,
|
|
148
148
|
className:Ae("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Pe("div",{className:"relative w-full h-full",children:t})})}function Or({document_:e=document,...t}){return Pe(se((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?Pr:Tr),[e]),{...t})}function Lr({config:e,groupId:t}){return Pe("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 Mr({eventBus:e,config:t}){const[n,o]=ne(0),[i,r]=ne(!0),[s,a]=ne(null),l=re(""),c=re(null);oe((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),oe((()=>{document.body.style.overflow=i?l.current:"hidden"}),[i]),oe((()=>{const t=e.createEmitter();return t.subscribe("openNotebook",(e=>{r(!1),o((e=>e+1)),a(e)})),c.current=t,()=>{t.destroy()}}),[e]);const d=ae((()=>{r(!0),c.current?.publish("closeNotebook")}),[])
|
|
149
149
|
;return null===s?null:Pe(Or,{closed:i,onClose:d,"data-testid":"notebook-outer","aria-label":"Hypothesis notebook",children:[Pe("div",{className:"absolute right-0 m-3",children:Pe(St,{title:"Close notebook",onClick:d,variant:"dark",classes:Ae("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:Pe(De,{className:"w-4 h-4"})})}),Pe(Lr,{config:t,groupId:s},n)]})}class Ir{constructor(e,t,n){this._container=new eo("notebook",(()=>Pe(Mr,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Br({eventBus:e,config:t}){const[n,o]=ne(!0),i=re(null);oe((()=>{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:Pe(Or,{closed:n,onClose:r,"data-testid":"profile-outer","aria-label":"Hypothesis profile",children:[Pe("div",{className:"absolute right-0 m-3",children:Pe(St,{
|
|
150
150
|
title:"Close profile dialog",onClick:r,variant:"dark",classes:Ae("!bg-transparent enabled:hover:!bg-grey-3"),children:Pe(De,{className:"w-4 h-4"})})}),Pe("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:t.profileAppUrl})]})}class Fr{constructor(e,t,n){this._container=new eo("profile",(()=>Pe(Br,{eventBus:t,config:n}))),e.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Dr({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 Pe("ul",{className:"relative",children:[s&&Pe("li",{className:"absolute right-0 pointer-events-auto mt-[-11px]",style:{top:e.position},children:Pe(Jt,{"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([]),
|
|
@@ -140,18 +140,18 @@ filters:{},focusActive:new Set(Object.keys(t)),focusFilters:t,query:e.query||nul
|
|
|
140
140
|
},{equalityCheck:r=ni,maxSize:o=1,resultEqualityCheck:i}=n,a=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;const{length:r}=t;for(let o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(r);let s=0;const l=o<=1?function(e){let t;return{get:n=>t&&e(t.key,n)?t.value:Zo,put(e,n){t={key:e,value:n}},getEntries:()=>t?[t]:[],clear(){t=void 0}}}(a):function(e,t){let n=[];function r(e){const r=n.findIndex((n=>t(e,n.key)));if(r>-1){const e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return Zo}return{get:r,put:function(t,o){r(t)===Zo&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(o,a);function c(){let t=l.get(arguments);if(t===Zo){if(t=e.apply(null,arguments),s++,i){const e=l.getEntries().find((e=>i(e.value,t)));e&&(t=e.value,0!==s&&s--)}l.put(arguments,t)}return t}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c
|
|
141
141
|
}),Ea),Oa=za((e=>e.frames.reduce(((e,t)=>e.concat(function(e){let t=[e.uri];return e.metadata&&e.metadata.documentFingerprint&&(t=e.metadata.link.map((e=>e.href))),e.metadata&&e.metadata.link&&e.metadata.link.forEach((e=>{e.href.startsWith("doi:")&&t.push(e.href)})),t}(t))),[])),(e=>e),{devModeChecks:{identityFunctionCheck:"never"}});const La=Yo({frames:[],contentInfo:null},{namespace:"frames",reducers:Ta,actionCreators:{connectFrame:function(e){return Ko(0,"CONNECT_FRAME",{frame:e})},destroyFrame:function(e){return Ko(0,"DESTROY_FRAME",{frame:e})},setContentInfo:function(e){return Ko(0,"SET_CONTENT_INFO",{info:e})},updateFrameAnnotationFetchStatus:function(e,t){return Ko(0,"UPDATE_FRAME_ANNOTATION_FETCH_STATUS",{uri:e,isAnnotationFetchComplete:t})}},selectors:{getContentInfo:function(e){return e.contentInfo},frames:function(e){return e.frames},mainFrame:Ma,defaultContentFrame:Ia,searchUris:Oa}}),Ra={FILTER_GROUPS(e,t){if(!t.filteredGroupIds?.length)return{filteredGroupIds:null}
|
|
142
142
|
;const n=e.groups.filter((e=>t.filteredGroupIds.includes(e.id)));if(!n.length)return{filteredGroupIds:null};let r=e.focusedGroupId;return r&&t.filteredGroupIds.includes(r)||(r=n[0].id),{filteredGroupIds:t.filteredGroupIds,focusedGroupId:r}},FOCUS_GROUP(e,t){const n=e.groups.find((e=>e.id===t.id));if(!n)return console.error(`Attempted to focus group ${t.id} which is not loaded`),{};return e.focusedGroupId===t.id?{focusedGroupId:t.id}:{focusedGroupId:t.id,focusedGroupMembers:null}},LOAD_GROUPS(e,t){const n=t.groups;let r=e.focusedGroupId;return null!==e.focusedGroupId&&n.find((t=>t.id===e.focusedGroupId))||(r=n.length>0?n[0].id:null),{focusedGroupId:r,groups:t.groups}},LOAD_FOCUSED_GROUP_MEMBERS(e,t){if(!e.focusedGroupId)throw new Error("A group needs to be focused before loading its members");const{focusedGroupMembers:n}=t;return{focusedGroupMembers:n}},CLEAR_GROUPS:()=>({filteredGroupIds:null,focusedGroupId:null,groups:[],focusedGroupMembers:null})};function Pa(e){
|
|
143
|
-
return e.filteredGroupIds?e.groups.filter((t=>e.filteredGroupIds?.includes(t.id))):e.groups}function Da(e,t){return e.groups.find((e=>e.id===t))}const Fa=ci((e=>Pa(e)),(e=>e.filter((e=>!e.isMember&&e.isScopedToUri)))),Ba=ci((e=>Pa(e)),(e=>e.filter((e=>e.isScopedToUri)))),Ha=ci((e=>Pa(e.groups)),(e=>Ui.selectors.isLoggedIn(e.session)),((e,t)=>t?e.filter((e=>e.isMember)):[])),ja=ci((e=>Pa(e.groups)),(e=>Ha(e)),(e=>Fa(e.groups)),((e,t,n)=>e.filter((e=>!t.includes(e)&&!n.includes(e))))),$a=Yo({filteredGroupIds:null,groups:[],focusedGroupId:null,focusedGroupMembers:null},{namespace:"groups",reducers:Ra,actionCreators:{filterGroups:function(e){return Ko(0,"FILTER_GROUPS",{filteredGroupIds:e})},focusGroup:function(e){return Ko(0,"FOCUS_GROUP",{id:e})},loadGroups:function(e){return Ko(0,"LOAD_GROUPS",{groups:e})},
|
|
144
|
-
return e.groups},filteredGroups:Pa,filteredGroupIds:function(e){return e.filteredGroupIds},focusedGroup:function(e){return e.focusedGroupId?Da(e,e.focusedGroupId)??null:null},focusedGroupId:function(e){return e.focusedGroupId},getFocusedGroupMembers:function(e){return e.focusedGroupMembers},getFeaturedGroups:Fa,getGroup:Da,getInScopeGroups:Ba},rootSelectors:{getCurrentlyViewingGroups:ja,getMyGroups:Ha}});function qa(e,t){const n={};for(const r in t)if(di(t,r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}const Ua={UPDATE_LINKS:(e,t)=>({...t.links})};const Ga=Yo(null,{namespace:"links",reducers:Ua,actionCreators:{updateLinks:function(e){return Ko(0,"UPDATE_LINKS",{links:e})}},selectors:{getLink:function(e,t,n={}){if(!e)return"";const r=e[t];if(!r)throw new Error(`Unknown link "${t}"`)
|
|
145
|
-
RECEIVE_REAL_TIME_UPDATES:(e,t)=>({pendingUpdates:{...t.pendingUpdates},pendingDeletions:{...t.pendingDeletions}}),CLEAR_PENDING_UPDATES:()=>({pendingUpdates:{},pendingDeletions:{}}),ADD_ANNOTATIONS(e,{annotations:t}){const n={...e.pendingUpdates};for(const e of t)e.id&&delete n[e.id];return{pendingUpdates:n}},REMOVE_ANNOTATIONS(e,{annotationsToRemove:t}){const n={...e.pendingUpdates},r={...e.pendingDeletions};for(const e of t)e.id&&(delete n[e.id],delete r[e.id]);return{pendingUpdates:n,pendingDeletions:r}},FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})};const Wa=ci((e=>e.pendingUpdates),(e=>e.pendingDeletions),((e,t)=>Object.keys(e).length+Object.keys(t).length));const Ka=Yo({pendingUpdates:{},pendingDeletions:{}},{namespace:"realTimeUpdates",reducers:Va,actionCreators:{receiveRealTimeUpdates:function({updatedAnnotations:e=[],deletedAnnotations:t=[]}){
|
|
146
|
-
const t=r().groups,n=r().route;e.group!==$a.selectors.focusedGroupId(t)&&"sidebar"===Hi.selectors.route(n)||(o[e.id]=e)})),t.forEach((e=>{const t=e.id;delete o[t];const n=r().annotations;sa.selectors.annotationExists(n,t)&&(i[t]=!0)})),n(Ko(0,"RECEIVE_REAL_TIME_UPDATES",{pendingUpdates:o,pendingDeletions:i}))}},clearPendingUpdates:function(){return Ko(0,"CLEAR_PENDING_UPDATES",void 0)}},selectors:{hasPendingDeletion:function(e,t){return di(e.pendingDeletions,t)},hasPendingUpdates:function(e){return Object.keys(e.pendingUpdates).length>0},hasPendingUpdatesOrDeletions:function(e){return Wa(e)>0},pendingDeletions:function(e){return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:Wa}}),Ya={annotation:"Location",note:"Oldest",orphan:"Location"};function Xa(e){const t={};return e.annotations&&!e.query&&(t[e.annotations]=!0),t}function Ja(e,t){
|
|
147
|
-
CLEAR_SELECTION:()=>({forcedVisible:{},selected:{}}),SELECT_ANNOTATIONS:(e,t)=>({selected:t.selection}),SELECT_TAB:(e,t)=>Ja(t.tab,e.selectedTab),SET_EXPANDED(e,t){const n={...e.expanded};return n[t.id]=t.expanded,{expanded:n}},SET_ANNOTATION_FOCUS_REQUEST:(e,t)=>({focusRequest:t.id}),SET_FORCED_VISIBLE:(e,t)=>({forcedVisible:{...e.forcedVisible,[t.id]:t.visible}}),SET_SORT_KEY:(e,t)=>({sortKey:t.key}),TOGGLE_SELECTED_ANNOTATIONS(e,t){const n={...e.selected};return t.toggleIds.forEach((e=>{n[e]=!n[e]})),{selected:n}},ADD_ANNOTATIONS(e,t){const n=t.annotations.filter((e=>!yi(e))),r=Ri(t.annotations,Ti)===n.length;return 0===t.currentAnnotationCount&&r?Ja("note",e.selectedTab):{}},CHANGE_FOCUS_MODE_USER:()=>({forcedVisible:{},selected:{}}),SET_FILTER:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FILTER_QUERY:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FOCUS_MODE:()=>({
|
|
148
|
-
;"orphan"===n&&0===Ri(t.remainingAnnotations,Ei)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{...Ja(n,e.selectedTab),expanded:r({...e.expanded}),forcedVisible:r({...e.forcedVisible}),selected:r({...e.selected})}}};function Za(){return Ko(0,"CLEAR_SELECTION",void 0)}function es(e){return e.expanded}const ts=ci((e=>e.forcedVisible),(e=>Di(e))),ns=ci((e=>e.selected),(e=>Di(e).length>0)),rs=ci((e=>e.selected),(e=>Di(e)));function os(e){return e.selectedTab}const is=ci((e=>e),(e=>({expanded:es(e),forcedVisible:ts(e),selected:rs(e),sortKey:as(e),selectedTab:os(e)})));function as(e){return e.sortKey}const ss=ci((e=>e.selectedTab),(e=>{const t=["Newest","Oldest"];return"note"!==e&&t.push("Location"),t})),ls=Yo((function(e){return{selected:Xa(e),expanded:Xa(e),forcedVisible:{},selectedTab:"annotation",sortKey:Ya.annotation,focusRequest:null}}),{namespace:"selection",
|
|
149
|
-
return Ko(0,"CLEAR_ANNOTATION_FOCUS_REQUEST",void 0)},clearSelection:Za,selectAnnotations:function(e){return t=>{t(Za()),t(Ko(0,"SELECT_ANNOTATIONS",{selection:Pi(e)}))}},selectTab:function(e){return Ko(0,"SELECT_TAB",{tab:e})},setAnnotationFocusRequest:function(e){return Ko(0,"SET_ANNOTATION_FOCUS_REQUEST",{id:e})},setExpanded:function(e,t){return Ko(0,"SET_EXPANDED",{id:e,expanded:t})},setForcedVisible:function(e,t){return Ko(0,"SET_FORCED_VISIBLE",{id:e,visible:t})},setSortKey:function(e){return Ko(0,"SET_SORT_KEY",{key:e})},toggleSelectedAnnotations:function(e){return Ko(0,"TOGGLE_SELECTED_ANNOTATIONS",{toggleIds:e})}},selectors:{expandedMap:es,annotationFocusRequest:function(e){return e.focusRequest},forcedVisibleThreads:ts,hasSelectedAnnotations:ns,selectedAnnotations:rs,selectedTab:os,selectionState:is,sortKey:as,sortKeys:ss}}),cs={OPEN_SIDEBAR_PANEL:(e,t)=>({activePanelName:t.panelName}),CLOSE_SIDEBAR_PANEL(e,t){let n=e.activePanelName
|
|
150
|
-
TOGGLE_SIDEBAR_PANEL(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}};const us=Yo({activePanelName:null},{namespace:"sidebarPanels",reducers:cs,actionCreators:{openSidebarPanel:function(e){return Ko(0,"OPEN_SIDEBAR_PANEL",{panelName:e})},closeSidebarPanel:function(e){return Ko(0,"CLOSE_SIDEBAR_PANEL",{panelName:e})},toggleSidebarPanel:function(e,t){return Ko(0,"TOGGLE_SIDEBAR_PANEL",{panelName:e,panelState:t})}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),ds={ADD_MESSAGE:(e,t)=>({messages:e.messages.concat({...t.message})}),REMOVE_MESSAGE:(e,t)=>({messages:e.messages.filter((e=>e.id!==t.id))})};const hs=Yo({messages:[]},{namespace:"toastMessages",reducers:ds,actionCreators:{addToastMessage:function(e){return Ko(0,"ADD_MESSAGE",{message:e})},removeToastMessage:function(e){return Ko(0,"REMOVE_MESSAGE",{id:e})}
|
|
151
|
-
return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),ms={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}};const ps=Yo({sidebarHasOpened:!1},{namespace:"viewer",reducers:ms,actionCreators:{setSidebarOpened:function(e){return Ko(0,"SET_SIDEBAR_OPENED",{opened:e})}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});class fs{constructor(e,t,n,r){this.name=e,this.method=t,this.args=n,this.result=r}matches(e,t){return this.name===e&&this.args.every(((e,n)=>t[n]===e))}}function gs(e){return Wo([Qo,sa,ca,da,ba,Na,La,Ga,$a,Ka,Hi,ls,Ui,us,hs,ps],[e],[Xo])}function vs(){var e;return function(e){const[,t]=se((e=>e+1),0),n=ue([]).current,r=ue(null);if(!r.current){const t=new Map,o=(e,r)=>{const o=e[r];if("function"!=typeof o)return o;let i=t.get(r);return i||(i=(...t)=>{const i=n.find((e=>e.matches(r,t)))
|
|
152
|
-
;return a===e.getState()&&n.push(new fs(r,o,t,s)),s},t.set(r,i),i)};r.current=new Proxy(e,{get:o})}return ce((()=>e.subscribe((()=>{n.find((t=>t.method.apply(e,t.args)!==t.result))&&(n.splice(0,n.length),t(0))}))),[n,e]),r.current}((e="store",me(Oo).get(e)))}function bs({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=vs(),o=r.isLoggedIn();return Ze("div",{className:"mb-4",children:Ze(Rr,{icon:ar,title:"annotation"===e?"Annotation unavailable":"Group unavailable",children:[Ze("p",{children:o?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":"The current URL links to an annotation, but that annotation\n cannot be found, or you do not have permission to view it.":`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),Ze("div",{className:"flex justify-end space-x-2",
|
|
153
|
-
onClick:()=>r.clearSelection(),children:"Show all annotations"}),!o&&Ze(xr,{variant:"primary",onClick:t,children:"Log in"})]})]})})}var ys,_s;gs.$inject=["settings"];var ws=function(){if(_s)return ys;_s=1;var t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,m=Math.min,p=function(){return u.Date.now()};function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return t;if(f(e)){var l="function"==typeof e.valueOf?e.valueOf():e;e=f(l)?l+"":l}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var c=i.test(e);return c||a.test(e)?s(e.slice(2),c?2:8):o.test(e)?t:+e}
|
|
154
|
-
var r,o,i,a,s,l,c=0,u=!1,d=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}function y(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return d?m(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(d)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=g(t)||0,f(n)&&(u=!!n.leading,i=(d="maxWait"in n)?h(g(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x},ys}(),xs=t(ws);const ks={defaultHeight:200,marginAbove:800,marginBelow:800};function Ns(e){const t=window.getComputedStyle(e)
|
|
143
|
+
return e.filteredGroupIds?e.groups.filter((t=>e.filteredGroupIds?.includes(t.id))):e.groups}function Da(e,t){return e.groups.find((e=>e.id===t))}const Fa=ci((e=>Pa(e)),(e=>e.filter((e=>!e.isMember&&e.isScopedToUri)))),Ba=ci((e=>Pa(e)),(e=>e.filter((e=>e.isScopedToUri)))),Ha=ci((e=>Pa(e.groups)),(e=>Ui.selectors.isLoggedIn(e.session)),((e,t)=>t?e.filter((e=>e.isMember)):[])),ja=ci((e=>Pa(e.groups)),(e=>Ha(e)),(e=>Fa(e.groups)),((e,t,n)=>e.filter((e=>!t.includes(e)&&!n.includes(e))))),$a=Yo({filteredGroupIds:null,groups:[],focusedGroupId:null,focusedGroupMembers:null},{namespace:"groups",reducers:Ra,actionCreators:{filterGroups:function(e){return Ko(0,"FILTER_GROUPS",{filteredGroupIds:e})},focusGroup:function(e){return Ko(0,"FOCUS_GROUP",{id:e})},loadGroups:function(e){return Ko(0,"LOAD_GROUPS",{groups:e})},startLoadingFocusedGroupMembers:function(){return Ko(0,"LOAD_FOCUSED_GROUP_MEMBERS",{focusedGroupMembers:"loading"})},loadFocusedGroupMembers:function(e){return Ko(0,"LOAD_FOCUSED_GROUP_MEMBERS",{
|
|
144
|
+
focusedGroupMembers:e})},clearGroups:function(){return Ko(0,"CLEAR_GROUPS",void 0)}},selectors:{allGroups:function(e){return e.groups},filteredGroups:Pa,filteredGroupIds:function(e){return e.filteredGroupIds},focusedGroup:function(e){return e.focusedGroupId?Da(e,e.focusedGroupId)??null:null},focusedGroupId:function(e){return e.focusedGroupId},getFocusedGroupMembers:function(e){return e.focusedGroupMembers},getFeaturedGroups:Fa,getGroup:Da,getInScopeGroups:Ba},rootSelectors:{getCurrentlyViewingGroups:ja,getMyGroups:Ha}});function qa(e,t){const n={};for(const r in t)if(di(t,r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}const Ua={UPDATE_LINKS:(e,t)=>({...t.links})};const Ga=Yo(null,{namespace:"links",reducers:Ua,actionCreators:{updateLinks:function(e){return Ko(0,"UPDATE_LINKS",{links:e})}},selectors:{getLink:function(e,t,n={}){if(!e)return"";const r=e[t];if(!r)throw new Error(`Unknown link "${t}"`)
|
|
145
|
+
;const{url:o,unusedParams:i}=qa(r,n),a=Object.keys(i);if(a.length>0)throw new Error(`Unused parameters: ${a.join(", ")}`);return o}}}),Va={RECEIVE_REAL_TIME_UPDATES:(e,t)=>({pendingUpdates:{...t.pendingUpdates},pendingDeletions:{...t.pendingDeletions}}),CLEAR_PENDING_UPDATES:()=>({pendingUpdates:{},pendingDeletions:{}}),ADD_ANNOTATIONS(e,{annotations:t}){const n={...e.pendingUpdates};for(const e of t)e.id&&delete n[e.id];return{pendingUpdates:n}},REMOVE_ANNOTATIONS(e,{annotationsToRemove:t}){const n={...e.pendingUpdates},r={...e.pendingDeletions};for(const e of t)e.id&&(delete n[e.id],delete r[e.id]);return{pendingUpdates:n,pendingDeletions:r}},FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})};const Wa=ci((e=>e.pendingUpdates),(e=>e.pendingDeletions),((e,t)=>Object.keys(e).length+Object.keys(t).length));const Ka=Yo({pendingUpdates:{},pendingDeletions:{}},{namespace:"realTimeUpdates",reducers:Va,actionCreators:{receiveRealTimeUpdates:function({updatedAnnotations:e=[],deletedAnnotations:t=[]}){
|
|
146
|
+
return(n,r)=>{const o={...r().realTimeUpdates.pendingUpdates},i={...r().realTimeUpdates.pendingDeletions};e.forEach((e=>{const t=r().groups,n=r().route;e.group!==$a.selectors.focusedGroupId(t)&&"sidebar"===Hi.selectors.route(n)||(o[e.id]=e)})),t.forEach((e=>{const t=e.id;delete o[t];const n=r().annotations;sa.selectors.annotationExists(n,t)&&(i[t]=!0)})),n(Ko(0,"RECEIVE_REAL_TIME_UPDATES",{pendingUpdates:o,pendingDeletions:i}))}},clearPendingUpdates:function(){return Ko(0,"CLEAR_PENDING_UPDATES",void 0)}},selectors:{hasPendingDeletion:function(e,t){return di(e.pendingDeletions,t)},hasPendingUpdates:function(e){return Object.keys(e.pendingUpdates).length>0},hasPendingUpdatesOrDeletions:function(e){return Wa(e)>0},pendingDeletions:function(e){return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:Wa}}),Ya={annotation:"Location",note:"Oldest",orphan:"Location"};function Xa(e){const t={};return e.annotations&&!e.query&&(t[e.annotations]=!0),t}function Ja(e,t){
|
|
147
|
+
return t===e?{}:{selectedTab:e,sortKey:Ya[e]}}const Qa={CLEAR_ANNOTATION_FOCUS_REQUEST:()=>({focusRequest:null}),CLEAR_SELECTION:()=>({forcedVisible:{},selected:{}}),SELECT_ANNOTATIONS:(e,t)=>({selected:t.selection}),SELECT_TAB:(e,t)=>Ja(t.tab,e.selectedTab),SET_EXPANDED(e,t){const n={...e.expanded};return n[t.id]=t.expanded,{expanded:n}},SET_ANNOTATION_FOCUS_REQUEST:(e,t)=>({focusRequest:t.id}),SET_FORCED_VISIBLE:(e,t)=>({forcedVisible:{...e.forcedVisible,[t.id]:t.visible}}),SET_SORT_KEY:(e,t)=>({sortKey:t.key}),TOGGLE_SELECTED_ANNOTATIONS(e,t){const n={...e.selected};return t.toggleIds.forEach((e=>{n[e]=!n[e]})),{selected:n}},ADD_ANNOTATIONS(e,t){const n=t.annotations.filter((e=>!yi(e))),r=Ri(t.annotations,Ti)===n.length;return 0===t.currentAnnotationCount&&r?Ja("note",e.selectedTab):{}},CHANGE_FOCUS_MODE_USER:()=>({forcedVisible:{},selected:{}}),SET_FILTER:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FILTER_QUERY:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FOCUS_MODE:()=>({
|
|
148
|
+
forcedVisible:{},selected:{}}),REMOVE_ANNOTATIONS(e,t){let n=e.selectedTab;"orphan"===n&&0===Ri(t.remainingAnnotations,Ei)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{...Ja(n,e.selectedTab),expanded:r({...e.expanded}),forcedVisible:r({...e.forcedVisible}),selected:r({...e.selected})}}};function Za(){return Ko(0,"CLEAR_SELECTION",void 0)}function es(e){return e.expanded}const ts=ci((e=>e.forcedVisible),(e=>Di(e))),ns=ci((e=>e.selected),(e=>Di(e).length>0)),rs=ci((e=>e.selected),(e=>Di(e)));function os(e){return e.selectedTab}const is=ci((e=>e),(e=>({expanded:es(e),forcedVisible:ts(e),selected:rs(e),sortKey:as(e),selectedTab:os(e)})));function as(e){return e.sortKey}const ss=ci((e=>e.selectedTab),(e=>{const t=["Newest","Oldest"];return"note"!==e&&t.push("Location"),t})),ls=Yo((function(e){return{selected:Xa(e),expanded:Xa(e),forcedVisible:{},selectedTab:"annotation",sortKey:Ya.annotation,focusRequest:null}}),{namespace:"selection",
|
|
149
|
+
reducers:Qa,actionCreators:{clearAnnotationFocusRequest:function(){return Ko(0,"CLEAR_ANNOTATION_FOCUS_REQUEST",void 0)},clearSelection:Za,selectAnnotations:function(e){return t=>{t(Za()),t(Ko(0,"SELECT_ANNOTATIONS",{selection:Pi(e)}))}},selectTab:function(e){return Ko(0,"SELECT_TAB",{tab:e})},setAnnotationFocusRequest:function(e){return Ko(0,"SET_ANNOTATION_FOCUS_REQUEST",{id:e})},setExpanded:function(e,t){return Ko(0,"SET_EXPANDED",{id:e,expanded:t})},setForcedVisible:function(e,t){return Ko(0,"SET_FORCED_VISIBLE",{id:e,visible:t})},setSortKey:function(e){return Ko(0,"SET_SORT_KEY",{key:e})},toggleSelectedAnnotations:function(e){return Ko(0,"TOGGLE_SELECTED_ANNOTATIONS",{toggleIds:e})}},selectors:{expandedMap:es,annotationFocusRequest:function(e){return e.focusRequest},forcedVisibleThreads:ts,hasSelectedAnnotations:ns,selectedAnnotations:rs,selectedTab:os,selectionState:is,sortKey:as,sortKeys:ss}}),cs={OPEN_SIDEBAR_PANEL:(e,t)=>({activePanelName:t.panelName}),CLOSE_SIDEBAR_PANEL(e,t){let n=e.activePanelName
|
|
150
|
+
;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}};const us=Yo({activePanelName:null},{namespace:"sidebarPanels",reducers:cs,actionCreators:{openSidebarPanel:function(e){return Ko(0,"OPEN_SIDEBAR_PANEL",{panelName:e})},closeSidebarPanel:function(e){return Ko(0,"CLOSE_SIDEBAR_PANEL",{panelName:e})},toggleSidebarPanel:function(e,t){return Ko(0,"TOGGLE_SIDEBAR_PANEL",{panelName:e,panelState:t})}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),ds={ADD_MESSAGE:(e,t)=>({messages:e.messages.concat({...t.message})}),REMOVE_MESSAGE:(e,t)=>({messages:e.messages.filter((e=>e.id!==t.id))})};const hs=Yo({messages:[]},{namespace:"toastMessages",reducers:ds,actionCreators:{addToastMessage:function(e){return Ko(0,"ADD_MESSAGE",{message:e})},removeToastMessage:function(e){return Ko(0,"REMOVE_MESSAGE",{id:e})}
|
|
151
|
+
},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),ms={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}};const ps=Yo({sidebarHasOpened:!1},{namespace:"viewer",reducers:ms,actionCreators:{setSidebarOpened:function(e){return Ko(0,"SET_SIDEBAR_OPENED",{opened:e})}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});class fs{constructor(e,t,n,r){this.name=e,this.method=t,this.args=n,this.result=r}matches(e,t){return this.name===e&&this.args.every(((e,n)=>t[n]===e))}}function gs(e){return Wo([Qo,sa,ca,da,ba,Na,La,Ga,$a,Ka,Hi,ls,Ui,us,hs,ps],[e],[Xo])}function vs(){var e;return function(e){const[,t]=se((e=>e+1),0),n=ue([]).current,r=ue(null);if(!r.current){const t=new Map,o=(e,r)=>{const o=e[r];if("function"!=typeof o)return o;let i=t.get(r);return i||(i=(...t)=>{const i=n.find((e=>e.matches(r,t)))
|
|
152
|
+
;if(i)return i.result;const a=e.getState(),s=o.apply(e,t);return a===e.getState()&&n.push(new fs(r,o,t,s)),s},t.set(r,i),i)};r.current=new Proxy(e,{get:o})}return ce((()=>e.subscribe((()=>{n.find((t=>t.method.apply(e,t.args)!==t.result))&&(n.splice(0,n.length),t(0))}))),[n,e]),r.current}((e="store",me(Oo).get(e)))}function bs({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=vs(),o=r.isLoggedIn();return Ze("div",{className:"mb-4",children:Ze(Rr,{icon:ar,title:"annotation"===e?"Annotation unavailable":"Group unavailable",children:[Ze("p",{children:o?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":"The current URL links to an annotation, but that annotation\n cannot be found, or you do not have permission to view it.":`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),Ze("div",{className:"flex justify-end space-x-2",
|
|
153
|
+
children:[n&&Ze(xr,{variant:o?"primary":void 0,onClick:()=>r.clearSelection(),children:"Show all annotations"}),!o&&Ze(xr,{variant:"primary",onClick:t,children:"Log in"})]})]})})}var ys,_s;gs.$inject=["settings"];var ws=function(){if(_s)return ys;_s=1;var t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=Object.prototype.toString,h=Math.max,m=Math.min,p=function(){return u.Date.now()};function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return t;if(f(e)){var l="function"==typeof e.valueOf?e.valueOf():e;e=f(l)?l+"":l}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var c=i.test(e);return c||a.test(e)?s(e.slice(2),c?2:8):o.test(e)?t:+e}
|
|
154
|
+
return ys=function(e,t,n){var r,o,i,a,s,l,c=0,u=!1,d=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}function y(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=i}function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return d?m(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(d)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=g(t)||0,f(n)&&(u=!!n.leading,i=(d="maxWait"in n)?h(g(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x},ys}(),xs=t(ws);const ks={defaultHeight:200,marginAbove:800,marginBelow:800};function Ns(e){const t=window.getComputedStyle(e)
|
|
155
155
|
;return e.getBoundingClientRect().height+(parseFloat(t.marginTop)+parseFloat(t.marginBottom))}function Ss(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+Ss(n,t)),n?1:0)}function As(e){return Ss(e,!1)}function Es(e){return Ss(e,!0)}function Ts(e){const t=e.filter((e=>!!e.annotation)).map((e=>e.annotation));if(t.length)return t;const n=[];if(e.forEach((e=>{e.children&&n.push(...e.children)})),n.length)return Ts(n);throw new Error("Thread contains no annotations")}function Cs(e,t,n){const r=pi(e.user,t);return(n||r)&&e.user_info?.display_name?e.user_info.display_name:mi(e.user)}function Ms(e){return/^http(s?):/i.test(e)}function Is(e){return{read:[e],update:[e],delete:[e]}}function zs(e,t){return Object.assign(Is(e),{read:["group:"+t]})}function Os(e,t,n){return"private"===function(e){switch(e){case"private":case"shared":return e;default:return"shared"}}(n)&&e?Is(e):zs(e,t)}function Ls(e){return e.read.some((e=>0===e.indexOf("group:")))}function Rs(e){return!Ls(e)}
|
|
156
156
|
const Ps=(e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0,Ds=(e=window.navigator,t="ontouchend"in document)=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e.platform)||e.userAgent.includes("Mac")&&t;async function Fs(e,t=navigator){await t.clipboard.writeText(e)}function Bs({classes:e,direction:t="up"}){return Ze("up"===t?Xn:Kn,{className:Xe("absolute inline z-2 text-grey-3 fill-white",e)})}function Hs({label:e,icon:t,uri:n}){return Ze("li",{children:Ze(bo,{"aria-label":e,classes:"text-grey-6 hover:text-color-text",href:n,title:e,target:"_blank",variant:"custom",underline:"none",children:Ze(t,{className:"w-em h-em"})})})}function js({shareURI:e}){const t=encodeURIComponent(e);return Ze("div",{className:"pt-2 border-t",children:Ze("ul",{className:"flex flex-row gap-x-4 items-center justify-center",children:[Ze(Hs,{icon:pr,label:"Tweet share link",uri:`https://twitter.com/intent/tweet?url=${t}&hashtags=annotated`}),Ze(Hs,{icon:hr,label:"Share on Facebook",
|
|
157
157
|
uri:`https://www.facebook.com/sharer/sharer.php?u=${t}`}),Ze(Hs,{icon:Zt,label:"Share via email",uri:`mailto:?subject=${encodeURIComponent("Let's Annotate")}&body=${t}`})]})})}var $s=Lo((function({annotation:e,toastMessenger:t,shareUri:n}){const r=vs().getGroup(e.group),o=Rs(e.permissions),i=Ms(e.uri),a=ue(null),s=ue(null),[l,c]=ae(!1),u=ue(l);if(Ce(s,(()=>c(!1)),{enabled:l}),le((()=>{u.current!==l&&(u.current=l,l&&!Ds()&&(a.current?.focus(),a.current?.select()))}),[l]),!r)return null;const d=i,h="private"===r.type?Ze("span",{children:["Only members of the group ",Ze("em",{children:r.name})," may view this annotation."]}):Ze("span",{children:"Anyone using this link may view this annotation."}),m=o?Ze("span",{children:"Only you may view this annotation."}):h;return Ze("div",{className:"relative",ref:s,tabIndex:-1,children:[Ze(Er,{icon:ur,title:"Share",onClick:()=>c(!l),expanded:l}),l&&Ze("div",{className:"absolute bottom-8 right-0 touch:bottom-touch-minimum",children:Ze(st,{
|
|
@@ -544,9 +544,9 @@ i=!0;break;case"End":r=n.length-1,i=!0}i&&r>=0&&(e.stopPropagation(),e.preventDe
|
|
|
544
544
|
isExpanded:a,onToggleSubmenu:u})]}),S=Xe("focus-visible-ring ring-inset","w-full min-w-[150px] flex items-center select-none","rounded-none",{"focus-visible:rounded-lg":!o,"focus-visible:rounded-r-lg":o,"cursor-pointer":!n},"group",{"min-h-[30px] font-normal":i,"min-h-[40px] font-medium":!i,"bg-grey-1":i||r,"hover:bg-grey-3":!n&&(i||r),"bg-white":!i&&!r,"hover:bg-grey-1":!n&&!i&&!r,"pr-1":!g},{"border-l-[4px] border-l-brand":o,"pl-[4px]":!o,"text-color-text-light":n,"text-color-text hover:text-color-text":!n});return f=e?Ze("a",{ref:m,className:S,"data-testid":"menu-item",href:e,target:"_blank",tabIndex:-1,rel:"noopener noreferrer",role:"menuitem",onKeyDown:b,children:N}):Ze("div",{ref:m,className:S,"data-testid":"menu-item",tabIndex:-1,onKeyDown:b,onClick:c,role:v?"menuitemradio":"menuitem","aria-checked":v?o:void 0,"aria-haspopup":g,"aria-expanded":g?a:void 0,children:N}),Ze(x,{children:[f,g&&Ze(To,{direction:a?"in":"out",children:Ze(Bp,{closeMenu:e=>{u&&u(e),p=setTimeout((()=>{m.current.focus()}))},
|
|
545
545
|
visible:a,className:"border-y border-grey-3",children:d})})]})}var Gp=Lo((function({group:e,isDisabled:t,isPrivate:n,onCancel:r,onSave:o,onSetPrivate:i,settings:a}){const s=zo(["ctaTextColor","ctaBackgroundColor"],a),l=Ze("div",{className:"w-9 h-9 flex items-center justify-center text-color-text-inverted",style:s,children:Ze($n,{className:"w-4 h-4"})});return Ze("div",{className:"flex flex-row gap-x-3",children:[Ze("div",{className:"flex relative",children:[Ze(xr,{classes:Xe("rounded-r-none"),"data-testid":"publish-control-button",style:s,onClick:o,disabled:t,size:"lg",variant:"primary",children:["Post to ",n?"Only Me":e.name]}),Ze("div",{className:Xe("flex flex-row rounded-r bg-grey-7 hover:bg-grey-8"),style:s,children:Ze($p,{containerPositioned:!1,contentClass:Xe("min-w-full"),label:l,menuIndicator:!1,title:"Change annotation sharing setting",align:"left",children:[Ze(Up,{icon:"open"===e.type?hn:bn,label:e.name,isSelected:!n,onClick:()=>i(!1)}),Ze(Up,{icon:Pn,label:"Only Me",isSelected:n,onClick:()=>i(!0)
|
|
546
546
|
})]})})]}),Ze("div",{children:Ze(xr,{"data-testid":"cancel-button",onClick:r,size:"lg",children:[Ze(yt,{}),"Cancel"]})})]})}),["settings"]);var Vp=Lo((function({annotation:e,draft:t,annotationsService:n,groups:r,settings:o,tags:i,toastMessenger:a}){const[s,l]=ae(null),c=vs(),u=c.getGroup(e.group),d=de((()=>yi(e)),[e]),h=!t.isPrivate&&u&&"private"!==u.type,m=Co(o)?.enableHelpPanel??!0,p=t.tags,f=t.text,g=!f&&!p.length,v=he((e=>{c.createDraft(t.annotation,{...t,tags:e})}),[t,c]),b=he((e=>{if(!e||p.indexOf(e)>=0)return!1;const t=[...p,e];return i.store(t),v(t),!0}),[v,p,i]),y=he((e=>{const t=[...p],n=t.indexOf(e);return n>=0&&(t.splice(n,1),v(t),!0)}),[v,p]),_=he((e=>{c.createDraft(t.annotation,{...t,text:e})}),[t,c]),w=he((n=>{c.createDraft(e,{...t,isPrivate:n}),d||c.setDefault("annotationPrivacy",n?"private":"shared")}),[e,t,d,c]),x=async()=>{s&&b(s);const t=`${Mi(e)} ${_i(e)?"updated":"saved"}`;try{await n.save(e),a.success(t,{visuallyHidden:!0})}catch{a.error("Saving annotation failed")}},k=he((()=>{
|
|
547
|
-
c.removeDraft(e),_i(e)||c.removeAnnotations([e])}),[e,c]),N=zo(["annotationFontFamily"],o),S=c.isFeatureEnabled("at_mentions"),A=c.usersWhoAnnotated(),E=c.getFocusedGroupMembers()
|
|
548
|
-
|
|
549
|
-
|
|
547
|
+
c.removeDraft(e),_i(e)||c.removeAnnotations([e])}),[e,c]),N=zo(["annotationFontFamily"],o),S=c.isFeatureEnabled("at_mentions"),A=c.usersWhoAnnotated(),E=c.getFocusedGroupMembers();return le((()=>{S&&null===E&&r.loadFocusedGroupMembers()}),[E,r,S]),Ze("div",{"data-testid":"annotation-editor",className:"space-y-4",onKeyDown:e=>{const t=e.key;g||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),x())},children:[Ze(zp,{textStyle:N,label:d?"Enter reply":"Enter comment",text:f,onEditText:_,mentionsEnabled:S,usersForMentions:A,showHelpLink:m}),Ze(Pp,{onAddTag:b,onRemoveTag:y,onTagInput:l,tagList:p}),u&&Ze(Gp,{group:u,isDisabled:g,isPrivate:t.isPrivate,onCancel:k,onSave:x,onSetPrivate:w}),h&&Ze(Dp,{})]})}),["annotationsService","groups","settings","tags","toastMessenger"]);function Wp({domain:e,link:t,title:n}){return Ze("div",{className:"flex gap-x-1",children:[Ze("div",{className:"text-color-text-light",children:['on "',t?Ze(bo,{href:t,target:"_blank",underline:"none",children:n
|
|
548
|
+
}):Ze("span",{children:n}),'"']}),e&&Ze("span",{className:"text-color-text-light",children:["(",e,")"]})]})}function Kp({group:e}){const t=e?.links.html;return Ze(x,{children:e&&t&&Ze(bo,{classes:Xe("text-color-text-light hover:text-color-text-light"),href:e.links.html,target:"_blank",underline:"hover",variant:"custom",children:Ze("div",{className:"flex items-baseline gap-x-1",children:["open"===e.type?Ze(hn,{className:"w-2.5 h-2.5"}):Ze(bn,{className:"w-2.5 h-2.5"}),Ze("span",{children:e.name})]})})})}function Yp({annotationCreated:e,annotationUpdated:t,annotationURL:n,withEditedTimestamp:r}){const[o,i]=ae((()=>new Date)),a=de((()=>new Date(e)),[e]),s=de((()=>r&&new Date(t)),[t,r]),l=de((()=>({absolute:Ge(a,{includeWeekday:!0}),relative:Ue(a,o)})),[a,o]),c=de((()=>s?{absolute:Ge(s,{includeWeekday:!0}),relative:Ue(s,o)}:{}),[s,o]);le((()=>qe(s?t:e,(()=>i(new Date)))),[e,t,a,s,o]);const u=c&&c.relative!==l.relative?`edited ${c.relative}`:"edited";return Ze("div",{children:[r&&Ze("span",{
|
|
549
|
+
className:"text-color-text-light text-xs italic","data-testid":"timestamp-edited",title:c.absolute,children:["(",u,")"," "]}),n?Ze(bo,{classes:"text-color-text-light hover:text-color-text-light",target:"_blank",title:l.absolute,href:n,underline:"hover",variant:"custom",children:l.relative}):Ze("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:l.absolute,children:l.relative})]})}function Xp({authorLink:e,displayName:t}){const n=Ze("h3",{className:"text-color-text font-bold",children:t});return e?Ze(bo,{href:e,target:"_blank",underline:"none",variant:"custom",children:n}):Ze("div",{children:n})}var Jp=Lo((function({annotation:e,isEditing:t,replyCount:n,threadIsCollapsed:r,settings:o}){const i=vs(),a=i.defaultAuthority(),s=i.isFeatureEnabled("client_display_names"),l=i.getLink("user",{user:e.user}),c=de((()=>Cs(e,a,s)),[e,a,s]),u=de((()=>function(e,t,n,r){return!pi(e.user,n)&&r?r:(t.usernameUrl&&`${t.usernameUrl}${mi(e.user)}`)??void 0
|
|
550
550
|
}(e,o,a,l)),[e,o,a,l]),d=yi(e)&&r,h=e.links?.html||"",m=de((()=>function(e){if(!e.updated||!e.created||e.updated===e.created)return!1;const t=new Date(e.created).getTime(),n=new Date(e.updated).getTime();return!isNaN(t)&&!isNaN(n)&&n-t>2e3}(e)&&!d),[e,d]),p=function(e){return{domain:vi(e),titleText:bi(e),titleLink:gi(e)}}(e),f=h&&p.titleLink?p.titleLink:"",g="sidebar"!==i.route()&&p.titleText;let v;"sidebar"!==i.route()&&(v=i.getGroup(e.group));const b=Li(e);return Ze("header",{children:[Ze("div",{className:"flex gap-x-1 items-center flex-wrap-reverse",children:[Rs(e.permissions)&&!t&&Ze(Pn,{className:"w-[12px] h-[12px]",title:"This annotation is visible only to you"}),Ze(Xp,{authorLink:u,displayName:c}),n>0&&d&&Ze(_o,{variant:"text-light",onClick:()=>i.setExpanded(e.id,!0),title:"Expand replies",underline:"hover",children:`${n} ${n>1?"replies":"reply"}`}),!t&&e.created&&Ze("div",{className:"flex justify-end grow",children:Ze(Yp,{annotationCreated:e.created,annotationUpdated:e.updated,annotationURL:h,
|
|
551
551
|
withEditedTimestamp:m})})]}),!yi(e)&&Ze("div",{className:"flex gap-x-1 items-baseline flex-wrap-reverse","data-testid":"extended-header-info",children:[v&&Ze(Kp,{group:v}),!t&&Ai(e)&&Ze(Nn,{title:"This is a highlight. Click 'edit' to add a note or tag.",className:"w-[10px] h-[10px] text-color-text-light"}),(g||b)&&Ze("span",{className:"flex",children:[g&&Ze(Wp,{domain:p.domain,link:f,title:p.titleText}),b&&Ze("span",{className:"text-grey-6","data-testid":"page-number",children:[g&&", ","p. ",b]})]})]})]})}),["settings"]);var Qp=Lo((function({quote:e,isHovered:t,isOrphan:n,settings:r}){return Ze(Vs,{collapsedHeight:35,inlineControls:!0,overflowThreshold:20,children:Ze(pp,{classes:Xe({"p-redacted-text":n}),children:Ze("blockquote",{className:Xe("hover:border-l-blue-quote",{"border-l-blue-quote":t}),style:zo(["selectionFontFamily"],r),children:e})})})}),["settings"]);function Zp({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return Ze(xr,{
|
|
552
552
|
classes:Xe("text-grey-7 enabled:hover:text-brand-dark","enabled:hover:underline"),onClick:e,title:r,variant:"custom",children:r})}function ef(){return Ze("div",{className:Xe("flex grow justify-end items-center gap-x-1","h-8 touch:h-touch-minimum"),"data-testid":"saving-message",children:[Ze("span",{className:"text-[16px] animate-fade-in-slow",children:Ze(co,{size:"sm"})}),Ze("div",{className:"text-color-text-light font-medium",children:"Saving..."})]})}var tf=Lo((function({annotation:e,isReply:t,onToggleReplies:n,replyCount:r,threadIsCollapsed:o,annotationsService:i}){const a=vs(),s=zi(e),l=a.getDraft(e),c=a.profile().userid,u=a.isAnnotationHovered(e.$tag),d=a.isSavingAnnotation(e),h=!!l&&!d,m=t&&o,p=!d&&!h&&_i(e),f=a.defaultAuthority(),g=a.isFeatureEnabled("client_display_names"),v=de((()=>Cs(e,f,g)),[e,f,g]);return Ze("article",{className:"space-y-4","aria-label":`${_i(e)?Mi(e):`New ${Mi(e).toLowerCase()}`} by ${v}${a.isAnnotationHighlighted(e)?" - Highlighted":""}`,children:[Ze(Jp,{annotation:e,
|
|
@@ -568,7 +568,7 @@ const zf=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5
|
|
|
568
568
|
return t}function Gf(e){return Ei(e)?"orphan":Ti(e)?"note":"annotation"}function Vf(e){return Ts([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function Wf(e){return Ts([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}const Kf={Newest:(e,t)=>{const n=Vf(e),r=Vf(t);return n>r?-1:n<r?1:0},Oldest:(e,t)=>{const n=Wf(e),r=Wf(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=Ii(e.annotation),r=Ii(t.annotation);if(n.cfi&&r.cfi){const e=Af(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 Yf=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,
|
|
569
569
|
selected:t.selected,sortCompareFn:Kf[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=qf(e,Bf);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,
|
|
570
570
|
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=>Ff([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&Ff([e.annotation],o).length>0)}const r=kf(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(Ni(e.annotation))return!1;const n=Gf(e.annotation);return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Xf(){const e=vs(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=de((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[t,n,o,i,a]);return Yf(s)}
|
|
571
|
-
var Jf,Qf,Zf=Lo((function({loadAnnotationsService:e,onLogin:t}){const n=vs(),r=n.routeParams().id??"",{rootThread:o}=Xf(),i=n.profile().userid,[a,s]=ae(!1);return le((()=>{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]),Ze(x,{children:[a&&Ze(bs,{errorType:"annotation",onLoginRequest:t}),Ze(mf,{threads:o.children})]})}),["loadAnnotationsService"]);class eg{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.
|
|
571
|
+
var Jf,Qf,Zf=Lo((function({loadAnnotationsService:e,onLogin:t}){const n=vs(),r=n.routeParams().id??"",{rootThread:o}=Xf(),i=n.profile().userid,[a,s]=ae(!1);return le((()=>{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]),Ze(x,{children:[a&&Ze(bs,{errorType:"annotation",onLoginRequest:t}),Ze(mf,{threads:o.children})]})}),["loadAnnotationsService"]);class eg{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.1561.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])}
|
|
572
572
|
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 tg=function(){if(Qf)return Jf;Qf=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,
|
|
573
573
|
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){
|
|
574
574
|
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 Jf=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){
|
|
@@ -655,7 +655,7 @@ null==v._nextState&&null==v.__s&&(v._nextState=v.__s=v.state),v.context=y,h.getD
|
|
|
655
655
|
}),Ze("body",{children:[Ze("section",{children:[Ze("h1",{children:"Summary"}),Ze("p",{children:Ze("time",{dateTime:o.toISOString(),children:Ub(o)})}),Ze("p",{children:Ze("strong",{children:a})}),Ze("p",{children:Ze("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Ze("table",{children:Ze("tbody",{style:{verticalAlign:"top"},children:[Ze("tr",{children:[Ze("td",{children:"Group:"}),Ze("td",{children:t})]}),Ze("tr",{children:[Ze("td",{children:"Total users:"}),Ze("td",{children:s.length})]}),Ze("tr",{children:[Ze("td",{children:"Users:"}),Ze("td",{children:s.join(", ")})]}),Ze("tr",{children:[Ze("td",{children:"Total annotations:"}),Ze("td",{children:e.length})]}),Ze("tr",{children:[Ze("td",{children:"Total replies:"}),Ze("td",{children:l.length})]})]})})]}),Ze("hr",{}),Ze("section",{children:[Ze("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Li(e),r=zi(e),o=mp(e.text),i=o===`<p>${e.text}</p>`?e.text:o;return Ze("article",{children:[Ze("h2",{children:["Annotation ",t+1,":"]
|
|
656
656
|
}),Ze("table",{children:Ze("tbody",{style:{verticalAlign:"top"},children:[Ze("tr",{children:[Ze("td",{children:"Created at:"}),Ze("td",{children:Ze("time",{dateTime:e.created,children:Ub(new Date(e.created))})})]}),Ze("tr",{children:[Ze("td",{children:"Author:"}),Ze("td",{children:c(e)})]}),n&&Ze("tr",{children:[Ze("td",{children:"Page:"}),Ze("td",{children:n})]}),Ze("tr",{children:[Ze("td",{children:"Type:"}),Ze("td",{children:Mi(e)})]}),r&&Ze("tr",{children:[Ze("td",{children:"Quote:"}),Ze("td",{children:Ze("blockquote",{style:{margin:0},children:r})})]}),Ze("tr",{children:[Ze("td",{children:"Comment:"}),Ze("td",{dangerouslySetInnerHTML:{__html:i}})]}),e.tags.length>0&&Ze("tr",{children:[Ze("td",{children:"Tags:"}),Ze("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=>Cs(e,n,t),{uri:i,title:a}=fi(r);return{uri:i,title:a,
|
|
657
657
|
uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>yi(e))),extractUsername:o}}}Gb.$inject=[];class Vb 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 Wb(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Vb(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch{throw new Vb(e,n,"Failed to parse response")}if(!n.ok)throw new Vb(e,n,r?.reason);return r}class Kb{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={
|
|
658
|
-
"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
658
|
+
"Content-Type":"application/json","Hypothesis-Client-Version":"1.1561.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:m}=qa(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 Wb(p.toString(),{body:s?JSON.stringify(qb(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")},
|
|
659
659
|
read:i("profile.read"),update:i("profile.update")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}Kb.$inject=["apiRoutes","auth","store"];var Yb,Xb,Jb,Qb,Zb,ey={};function ty(){return Jb||(Jb=1,e=ey,t=function(){if(Xb)return Yb;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 Xb=1,Yb=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){
|
|
660
660
|
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)},
|
|
661
661
|
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},Yb}(),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))
|
|
@@ -681,21 +681,21 @@ logo:"data:image/svg+xml;utf8,"+encodeURIComponent('<?xml version="1.0" encoding
|
|
|
681
681
|
};const Ay=["organization","scopes"];class Ey{_focusedMembersController=null;constructor(e,t,n,r,o){this._store=e,this._api=t,this._auth=n,this._settings=r,this._toastMessenger=o,this._serviceConfig=Co(r),this._reloadSetUp=!1}_mainURI(){return this._store.defaultContentFrame()?.uri??null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>e.id!==Fv&&e.isScopedToUri));return o?r===Fv||n===Fv?e:e.filter((e=>e.id!==Fv)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,wy(this._store.subscribe,(()=>this._mainURI()),(()=>this.load())),wy(this._store.subscribe,(()=>[this._store.hasFetchedProfile(),this._store.profile().userid]),((e,[t])=>{t&&this.load()}),Ea))}_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=Sy)}))}(e)
|
|
682
682
|
;const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:Ay})}async _loadGroupsForUserAndDocument(){const e=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let t=null;"sidebar"===this._store.route()&&(t=await e()),this._setupAutoReload();const n=this._store.directLinkedAnnotationId();let r=null;n&&(r=this._api.annotation.get({id:n}).catch((()=>null)));const o=this._store.directLinkedGroupId();let i=null;o&&(i=this._fetchGroup(o).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),null))));const a={expand:Ay},s=this._serviceConfig?.authority;s&&(a.authority=s),t&&(a.document_uri=t)
|
|
683
683
|
;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{this._toastMessenger.error("Unable to fetch group for linked annotation")}}const p=null!==u,f=await this._filterGroups(Bv(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
|
|
684
|
-
;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){this._focusedMembersController?.abort();const e=this._store.newAnnotations().filter((e=>!yi(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"})}async loadFocusedGroupMembers(
|
|
685
|
-
}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}Ey.$inject=["store","api","auth","settings","toastMessenger"];const Ty="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Cy="8.51.0",My=globalThis;function Iy(e,t,n){const r=My,o=r.__SENTRY__=r.__SENTRY__||{},i=o[Cy]=o[Cy]||{};return i[e]||(i[e]=t())}const zy="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Oy=["debug","info","warn","error","log","assert","trace"],Ly={};function Ry(e){if(!("console"in My))return e();const t=My.console,n={},r=Object.keys(Ly);r.forEach((e=>{const r=Ly[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{
|
|
686
|
-
;return zy?Oy.forEach((n=>{t[n]=(...t)=>{e&&Ry((()=>{My.console[n](`Sentry Logger [${n}]:`,...t)}))}})):Oy.forEach((e=>{t[e]=()=>{}})),t})),Dy=50,Fy="?",By=/\(error: (.*)\)/,Hy=/captureMessage|captureException/;function jy(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0,r=0)=>{const o=[],i=e.split("\n");for(let e=n;e<i.length;e++){const n=i[e];if(n.length>1024)continue;const a=By.test(n)?n.replace(By,"$1"):n;if(!a.match(/\S*Error: /)){for(const e of t){const t=e(a);if(t){o.push(t);break}}if(o.length>=Dy+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);/sentryWrapped/.test($y(t).function||"")&&t.pop();t.reverse(),Hy.test($y(t).function||"")&&(t.pop(),Hy.test($y(t).function||"")&&t.pop());return t.slice(0,Dy).map((e=>({...e,filename:e.filename||$y(t).filename,function:e.function||Fy})))}(o.slice(r))}}function $y(e){return e[e.length-1]||{}}
|
|
687
|
-
const t=e.exception;if(t){const e=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)})),e}catch(e){return}}}const Vy={},Wy={};function Ky(e,t){Vy[e]=Vy[e]||[],Vy[e].push(t)}function Yy(e,t){if(!Wy[e]){Wy[e]=!0;try{t()}catch(t){zy&&Py.error(`Error while instrumenting ${e}`,t)}}}function Xy(e,t){const n=e&&Vy[e];if(n)for(const r of n)try{r(t)}catch(t){zy&&Py.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Uy(r)}\nError:`,t)}}let Jy=null;function Qy(){Jy=My.onerror,My.onerror=function(e,t,n,r,o){return Xy("error",{column:r,error:o,line:n,msg:e,url:t}),!!Jy&&Jy.apply(this,arguments)},My.onerror.__SENTRY_INSTRUMENTED__=!0}let Zy=null;function e_(){Zy=My.onunhandledrejection,My.onunhandledrejection=function(e){return Xy("unhandledrejection",e),!Zy||Zy.apply(this,arguments)},My.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}
|
|
688
|
-
t[Cy]=t[Cy]||{}}const r_=Object.prototype.toString;function o_(e){switch(r_.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return p_(e,Error)}}function i_(e,t){return r_.call(e)===`[object ${t}]`}function a_(e){return i_(e,"ErrorEvent")}function s_(e){return i_(e,"DOMError")}function l_(e){return i_(e,"String")}function c_(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function u_(e){return null===e||c_(e)||"object"!=typeof e&&"function"!=typeof e}function d_(e){return i_(e,"Object")}function h_(e){return"undefined"!=typeof Event&&p_(e,Event)}function m_(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function p_(e,t){try{return e instanceof t}catch(e){return!1}}function f_(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}
|
|
689
|
-
;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||v_;for(;n&&i++<r&&(c=y_(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 y_(e,t){const n=e,r=[];if(!n||!n.tagName)return"";if(g_.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&&l_(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const i=["aria-label","type","name","title","alt"];for(const e of i){const t=n.getAttribute(e)
|
|
690
|
-
return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function w_(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{f_(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function x_(e,t,n=!1){return!!l_(e)&&(i_(t,"RegExp")?t.test(e):!!l_(t)&&(n?e===t:e.includes(t)))}function k_(e,t=[],n=!1){return t.some((t=>x_(e,t,n)))}function N_(e,t,n){if(!(t in e))return;const r=e[t],o=n(r);"function"==typeof o&&A_(o,r);try{e[t]=o}catch(n){zy&&Py.log(`Failed to replace method "${t}" in object`,e)}}function S_(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(n){zy&&Py.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function A_(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,S_(e,"__sentry_original__",t)}catch(e){}}function E_(e){return e.__sentry_original__}function T_(e){
|
|
691
|
-
;if(h_(e)){const t={type:e.type,target:C_(e.target),currentTarget:C_(e.currentTarget),...M_(e)};return"undefined"!=typeof CustomEvent&&p_(e,CustomEvent)&&(t.detail=e.detail),t}return e}function C_(e){try{return t=e,"undefined"!=typeof Element&&p_(t,Element)?b_(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}var t}function M_(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function I_(e){return z_(e,new Map)}function z_(e,t){if(function(e){if(!d_(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(e){return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const n of Object.getOwnPropertyNames(e))void 0!==e[n]&&(r[n]=z_(e[n],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach((e=>{r.push(z_(e,t))})),r}return e}
|
|
692
|
-
const{performance:e}=My;if(!e||!e.now)return L_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/O_}();function P_(){const e=My,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function D_(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function F_(e){const{message:t,event_id:n}=e;if(t)return t;const r=D_(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function B_(e,t,n){const r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function H_(e,t){const n=D_(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",
|
|
693
|
-
;n.mechanism.data=e}}function j_(e){if(function(e){try{return e.__sentry_captured__}catch(e){}}(e))return!0;try{S_(e,"__sentry_captured__",!0)}catch(e){}return!1}var $_;function q_(e){return new G_((t=>{t(e)}))}function U_(e){return new G_(((t,n)=>{n(e)}))}(()=>{const{performance:e}=My;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),o=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,i=o<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):t;(i||s<t)&&(o<=s&&e.timeOrigin)})(),function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}($_||($_={}));class G_{constructor(e){G_.prototype.__init.call(this),G_.prototype.__init2.call(this),G_.prototype.__init3.call(this),G_.prototype.__init4.call(this),this._state=$_.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new G_(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)
|
|
694
|
-
this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new G_(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}__init(){this._resolve=e=>{this._setResult($_.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult($_.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===$_.PENDING&&(m_(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===$_.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===$_.RESOLVED&&e[1](this._value),this._state===$_.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function V_(e){const t=R_(),n={sid:P_(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return I_({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),
|
|
695
|
-
errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return W_(n,e),n}function W_(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||R_(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:P_()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),
|
|
696
|
-
|
|
697
|
-
}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Q_(e,Z_(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&W_(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){
|
|
698
|
-
return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this
|
|
684
|
+
;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){this._focusedMembersController?.abort();const e=this._store.newAnnotations().filter((e=>!yi(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"})}async loadFocusedGroupMembers(){const e=this._store.focusedGroupId();if(!e)return;this._focusedMembersController?.abort(),this._focusedMembersController=new AbortController;const{signal:t}=this._focusedMembersController;this._store.startLoadingFocusedGroupMembers();const n=await this._fetchAllMembers(e,t)
|
|
685
|
+
;this._store.loadFocusedGroupMembers(t?.aborted?null:n)}async _fetchAllMembers(e,t){const n=await this._fetchMembers({groupId:e,signal:t}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}Ey.$inject=["store","api","auth","settings","toastMessenger"];const Ty="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Cy="8.51.0",My=globalThis;function Iy(e,t,n){const r=My,o=r.__SENTRY__=r.__SENTRY__||{},i=o[Cy]=o[Cy]||{};return i[e]||(i[e]=t())}const zy="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Oy=["debug","info","warn","error","log","assert","trace"],Ly={};function Ry(e){if(!("console"in My))return e();const t=My.console,n={},r=Object.keys(Ly);r.forEach((e=>{const r=Ly[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{
|
|
686
|
+
t[e]=n[e]}))}}const Py=Iy("logger",(function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return zy?Oy.forEach((n=>{t[n]=(...t)=>{e&&Ry((()=>{My.console[n](`Sentry Logger [${n}]:`,...t)}))}})):Oy.forEach((e=>{t[e]=()=>{}})),t})),Dy=50,Fy="?",By=/\(error: (.*)\)/,Hy=/captureMessage|captureException/;function jy(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0,r=0)=>{const o=[],i=e.split("\n");for(let e=n;e<i.length;e++){const n=i[e];if(n.length>1024)continue;const a=By.test(n)?n.replace(By,"$1"):n;if(!a.match(/\S*Error: /)){for(const e of t){const t=e(a);if(t){o.push(t);break}}if(o.length>=Dy+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);/sentryWrapped/.test($y(t).function||"")&&t.pop();t.reverse(),Hy.test($y(t).function||"")&&(t.pop(),Hy.test($y(t).function||"")&&t.pop());return t.slice(0,Dy).map((e=>({...e,filename:e.filename||$y(t).filename,function:e.function||Fy})))}(o.slice(r))}}function $y(e){return e[e.length-1]||{}}
|
|
687
|
+
const qy="<anonymous>";function Uy(e){try{return e&&"function"==typeof e&&e.name||qy}catch(e){return qy}}function Gy(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)})),e}catch(e){return}}}const Vy={},Wy={};function Ky(e,t){Vy[e]=Vy[e]||[],Vy[e].push(t)}function Yy(e,t){if(!Wy[e]){Wy[e]=!0;try{t()}catch(t){zy&&Py.error(`Error while instrumenting ${e}`,t)}}}function Xy(e,t){const n=e&&Vy[e];if(n)for(const r of n)try{r(t)}catch(t){zy&&Py.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Uy(r)}\nError:`,t)}}let Jy=null;function Qy(){Jy=My.onerror,My.onerror=function(e,t,n,r,o){return Xy("error",{column:r,error:o,line:n,msg:e,url:t}),!!Jy&&Jy.apply(this,arguments)},My.onerror.__SENTRY_INSTRUMENTED__=!0}let Zy=null;function e_(){Zy=My.onunhandledrejection,My.onunhandledrejection=function(e){return Xy("unhandledrejection",e),!Zy||Zy.apply(this,arguments)},My.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}
|
|
688
|
+
function t_(){return n_(My),My}function n_(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Cy,t[Cy]=t[Cy]||{}}const r_=Object.prototype.toString;function o_(e){switch(r_.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return p_(e,Error)}}function i_(e,t){return r_.call(e)===`[object ${t}]`}function a_(e){return i_(e,"ErrorEvent")}function s_(e){return i_(e,"DOMError")}function l_(e){return i_(e,"String")}function c_(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function u_(e){return null===e||c_(e)||"object"!=typeof e&&"function"!=typeof e}function d_(e){return i_(e,"Object")}function h_(e){return"undefined"!=typeof Event&&p_(e,Event)}function m_(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function p_(e,t){try{return e instanceof t}catch(e){return!1}}function f_(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}
|
|
689
|
+
const g_=My,v_=80;function b_(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||v_;for(;n&&i++<r&&(c=y_(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 y_(e,t){const n=e,r=[];if(!n||!n.tagName)return"";if(g_.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&&l_(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const i=["aria-label","type","name","title","alt"];for(const e of i){const t=n.getAttribute(e)
|
|
690
|
+
;t&&r.push(`[${e}="${t}"]`)}return r.join("")}function __(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function w_(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{f_(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function x_(e,t,n=!1){return!!l_(e)&&(i_(t,"RegExp")?t.test(e):!!l_(t)&&(n?e===t:e.includes(t)))}function k_(e,t=[],n=!1){return t.some((t=>x_(e,t,n)))}function N_(e,t,n){if(!(t in e))return;const r=e[t],o=n(r);"function"==typeof o&&A_(o,r);try{e[t]=o}catch(n){zy&&Py.log(`Failed to replace method "${t}" in object`,e)}}function S_(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(n){zy&&Py.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function A_(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,S_(e,"__sentry_original__",t)}catch(e){}}function E_(e){return e.__sentry_original__}function T_(e){
|
|
691
|
+
if(o_(e))return{message:e.message,name:e.name,stack:e.stack,...M_(e)};if(h_(e)){const t={type:e.type,target:C_(e.target),currentTarget:C_(e.currentTarget),...M_(e)};return"undefined"!=typeof CustomEvent&&p_(e,CustomEvent)&&(t.detail=e.detail),t}return e}function C_(e){try{return t=e,"undefined"!=typeof Element&&p_(t,Element)?b_(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}var t}function M_(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function I_(e){return z_(e,new Map)}function z_(e,t){if(function(e){if(!d_(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(e){return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const n of Object.getOwnPropertyNames(e))void 0!==e[n]&&(r[n]=z_(e[n],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach((e=>{r.push(z_(e,t))})),r}return e}
|
|
692
|
+
const O_=1e3;function L_(){return Date.now()/O_}const R_=function(){const{performance:e}=My;if(!e||!e.now)return L_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/O_}();function P_(){const e=My,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function D_(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function F_(e){const{message:t,event_id:n}=e;if(t)return t;const r=D_(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function B_(e,t,n){const r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function H_(e,t){const n=D_(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",
|
|
693
|
+
handled:!0,...r,...t},t&&"data"in t){const e={...r&&r.data,...t.data};n.mechanism.data=e}}function j_(e){if(function(e){try{return e.__sentry_captured__}catch(e){}}(e))return!0;try{S_(e,"__sentry_captured__",!0)}catch(e){}return!1}var $_;function q_(e){return new G_((t=>{t(e)}))}function U_(e){return new G_(((t,n)=>{n(e)}))}(()=>{const{performance:e}=My;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),o=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,i=o<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):t;(i||s<t)&&(o<=s&&e.timeOrigin)})(),function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}($_||($_={}));class G_{constructor(e){G_.prototype.__init.call(this),G_.prototype.__init2.call(this),G_.prototype.__init3.call(this),G_.prototype.__init4.call(this),this._state=$_.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new G_(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)
|
|
694
|
+
}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new G_(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}__init(){this._resolve=e=>{this._setResult($_.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult($_.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===$_.PENDING&&(m_(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===$_.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===$_.RESOLVED&&e[1](this._value),this._state===$_.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function V_(e){const t=R_(),n={sid:P_(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return I_({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),
|
|
695
|
+
timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return W_(n,e),n}function W_(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||R_(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:P_()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),
|
|
696
|
+
t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function K_(){return P_()}function Y_(){return P_().substring(16)}function X_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=X_(r[e],t[e],n-1));return r}const J_="_sentrySpan";function Q_(e,t){t?S_(e,J_,t):delete e[J_]}function Z_(e){return e[J_]}class ew{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:K_(),spanId:Y_()}}clone(){const e=new ew;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={
|
|
697
|
+
...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Q_(e,Z_(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&W_(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){
|
|
698
|
+
return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this
|
|
699
699
|
;const t="function"==typeof e?e(this):e,[n,r]=t instanceof tw?[t.getScopeData(),t.getRequestSession()]:d_(t)?[e,e.requestSession]:[],{tags:o,extra:i,user:a,contexts:s,level:l,fingerprint:c=[],propagationContext:u}=n||{};return this._tags={...this._tags,...o},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Q_(this,void 0),this._attachments=[],this.setPropagationContext({traceId:K_()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:L_(),...e},o=this._breadcrumbs;return o.push(r),this._breadcrumbs=o.length>n?o.slice(-n):o,
|
|
700
700
|
this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Z_(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=X_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Y_(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:P_()
|
|
701
701
|
;if(!this._client)return Py.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:P_();if(!this._client)return Py.warn("No client configured on scope - will not capture message!"),r;const o=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:P_();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Py.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const tw=ew;class nw{constructor(e,t){let n,r;n=e||new tw,r=t||new tw,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){
|
|
@@ -769,7 +769,7 @@ const e=Object.values(this._store.pendingUpdates());e.length&&(this._store.addAn
|
|
|
769
769
|
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,wy(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}TN.$inject=["store","apiRoutes","auth","groups","session","$window"];const CN="hypothesis.user.tags.list",MN="hypothesis.user.tags.map";class IN{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(CN)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Pv(e)}`,"i")
|
|
770
770
|
;return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(MN)||{};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(MN,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(CN,n)}}IN.$inject=["localStorage"];class zN{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}zN.$inject=["store"];class ON extends pg.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))}
|
|
771
771
|
_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:Sv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}ON.$inject=["store","$window"];const LN=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),RN=function(e){const{version:t,origin:n}=Ev(e.location.href)
|
|
772
|
-
;return"1.
|
|
772
|
+
;return"1.1561.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1561.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 PN(e,t){e.setClientId(t.clientId)}function DN(e){e.sync()}function FN(e,t){e.load(),t.load()}function BN(e,t,n){e.init(),t.init(),n.init()}function HN(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})}))}LN.sentry&&RN&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;mN({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1561.0",beforeSend:(e,t)=>{
|
|
773
773
|
if(pN>=5)return Ov("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++pN;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{}return e}});try{mx("host_config",Ev(window.location.href))}catch{}mx("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),py(((e,t)=>{fN(e,t)}))}(LN.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),PN.$inject=["api","streamer"],DN.$inject=["router"],FN.$inject=["groups","session"],BN.$inject=["autosaveService","persistedDefaults","serviceURL"],HN.$inject=["frameSync","store","toastMessenger"];const jN=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",qv)}(),async function(e,t=window){const n=function(e){
|
|
774
774
|
const t=Ev(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:Tv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Mv(t.origin),ancestorLevel:Cv(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:Iv(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await Av(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services
|
|
775
775
|
;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=Av(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=Co(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(LN).then((e=>{!function(e,t){const n=new G
|