hypothesis 1.1269.0 → 1.1270.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?05fdd4","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?f4aa7e","styles/annotator.css":"styles/annotator.css?02ecf3","styles/annotator.css.map":"styles/annotator.css.map?cdb6c3","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?185199","styles/katex.min.css.map":"styles/katex.min.css.map?42d80c","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?c5712d","styles/sidebar.css.map":"styles/sidebar.css.map?3e5b70","styles/ui-playground.css":"styles/ui-playground.css?a6a0f0","styles/ui-playground.css.map":"styles/ui-playground.css.map?1c8e35","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?27c322","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?c7b98c","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?7949e0","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?965083"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=s.match(/(https?):\/\/([^:/]+)/);return t?{protocol:t[1],hostname:t[2]}:null}function l(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=s.currentScript;return t?a(t.src):null}function c(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=l(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var p=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),u=c(p.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1270.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:u,manifest:s,apiUrl:p.apiUrl})}else{var d=function(){var s,t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;return null===(s=e.chrome)||void 0===s||null===(t=s.runtime)||void 0===t?void 0:t.id}();if(d&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(d))throw new Error("Could not start Hypothesis extension as configuration is missing");var h=p,y=c(h.notebookAppUrl||"https://hypothes.is/notebook"),f=c(h.profileAppUrl||"https://hypothes.is/user-profile"),m=c(h.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)e(s,i(t,u[p]))}}(document,{assetRoot:u,manifest:s,notebookAppUrl:y,profileAppUrl:f,sidebarAppUrl:m})}}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?05fdd4",
|
|
3
3
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?f4aa7e",
|
|
4
4
|
"styles/annotator.css": "styles/annotator.css?02ecf3",
|
|
5
5
|
"styles/annotator.css.map": "styles/annotator.css.map?cdb6c3",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"styles/sidebar.css.map": "styles/sidebar.css.map?3e5b70",
|
|
14
14
|
"styles/ui-playground.css": "styles/ui-playground.css?a6a0f0",
|
|
15
15
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?1c8e35",
|
|
16
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?2b041f",
|
|
17
16
|
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?27c322",
|
|
17
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?c7b98c",
|
|
18
18
|
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?7949e0",
|
|
19
|
-
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?965083"
|
|
20
20
|
}
|
|
@@ -120,7 +120,7 @@ this._hostRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._hostRP
|
|
|
120
120
|
}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{var e;const n=ko(t);if(!n)return;const i=rn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&ln(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Xe.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[]
|
|
121
121
|
;for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&an(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),s={uri:n.uri,document:n.metadata,target:o,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+r(8)};return this._sidebarRPC.call("createAnnotation",s),this.anchor(s),To(),s}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ln(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){
|
|
122
122
|
const n=function(t,e){let n=null,i=0;for(const r of t){var o;if(null===(o=r.highlights)||void 0===o||!o.length)continue;const t=cn(r.highlights).top;"up"===e&&t>=137||"down"===e&&t<=window.innerHeight-22||(!n||"up"===e&&t>i||"down"===e&&t<i)&&(n=r,i=t)}return n}(this.anchors.filter((({annotation:e})=>t.includes(e.$tag))),e);n&&this._integration.scrollToAnchor(n)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=Qe(n),o=en(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=Ao(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){
|
|
123
|
-
e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Oo(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Mo(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
123
|
+
e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Ht(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Oo(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Mo(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1270.0";const o=new URL(window.location.href)
|
|
124
124
|
;if(o.hash="",i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function Lo({config:t,groupId:e}){return Wt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Oo(t.notebookAppUrl,{...Mo(t.notebookAppUrl,t),group:e})})}function Io({eventBus:t,config:e}){const[n,i]=Nt(0),[o,r]=Nt(!0),[s,a]=Nt(null),l=Rt(""),c=Rt(null);At((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),At((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),At((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t])
|
|
125
125
|
;return null===s?null:Wt("div",{className:ve("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ne,{title:"Close the Notebook",onClick:()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:ve("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt(Lo,{config:e,groupId:s},n)]})})}class Fo{constructor(t,e,i){n(this,"_outerContainer",void 0),n(this,"_shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-notebook"),t.appendChild(this._outerContainer),this._shadowRoot=Ie(this._outerContainer),ut(Wt(Io,{eventBus:e,config:i}),this._shadowRoot)}destroy(){ut(null,this._shadowRoot),this._outerContainer.remove()}}function Do({eventBus:t,config:e}){const[n,i]=Nt(!0),o=Rt(null);At((()=>{const e=t.createEmitter()
|
|
126
126
|
;return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:Wt("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:Wt("div",{className:"relative w-full h-full","data-testid":"profile-inner",children:[Wt("div",{className:"absolute right-0 m-3",children:Wt(Ne,{title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:ve("!bg-transparent enabled:hover:!bg-grey-3"),children:Wt(Xt,{className:"w-4 h-4"})})}),Wt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class Bo{constructor(t,e,i){n(this,"_outerContainer",void 0),n(this,"shadowRoot",void 0),this._outerContainer=document.createElement("hypothesis-profile"),t.appendChild(this._outerContainer),this.shadowRoot=Ie(this._outerContainer),ut(Wt(Do,{eventBus:e,config:i}),this.shadowRoot)}destroy(){ut(null,this.shadowRoot),
|
|
@@ -87,7 +87,7 @@ closeOnClickAway:l,closeOnFocusAway:c,closeOnEscape:!t,initialFocus:u,restoreFoc
|
|
|
87
87
|
"text-color-text-light hover:text-brand":"text-light"===o,"text-color-text hover:text-brand-dark":"text"===o},{"no-underline hover:no-underline":"none"===r,"underline hover:underline":"always"===r,"no-underline hover:underline":"hover"===r},t),elementRef:n,children:e},void 0,0,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/Link.tsx",lineNumber:31,columnNumber:5},this)};const nr=function({children:e,classes:t,elementRef:n,color:r="brand",inline:o=!1,underline:i="none",variant:a="secondary",...s}){return Ne(Cn,{"data-component":"LinkButton",...s,elementRef:n,classes:K("focus-visible-ring transition-colors whitespace-nowrap","aria-pressed:font-semibold aria-expanded:font-semibold rounded-sm",{inline:o,"flex items-center":!o},{"text-brand enabled:hover:text-brand-dark":"brand"===r,"text-color-text enabled:hover:text-brand-dark":"text"===r,"text-color-text-light enabled:hover:text-brand":"text-light"===r},{"no-underline hover:no-underline":"none"===i,
|
|
88
88
|
"underline enabled:hover:underline":"always"===i,"no-underline enabled:hover:underline":"hover"===i},{"font-semibold":"primary"===a},t),unstyled:!0,children:e},void 0,0,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/navigation/LinkButton.tsx",lineNumber:37,columnNumber:5},this)};const rr=({children:e,direction:t="in",onTransitionEnd:n})=>{const r="in"===t,o=ce(null),[i,a]=ie(r?"auto":0),[s,l]=ie(r);se((()=>{if(r===(0!==i))return;const e=o.current;r?(e.style.display="",l(!0),a(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),a(0))}),[i,r]);return Ne("div",{ontransitionend:de((()=>{r?a("auto"):l(!1),null==n||n(t)}),[a,r,n,t]),ref:o,style:{display:s?"":"none",height:i,overflow:"auto"===i?"visible":"hidden",transition:"height 0.15s ease-in"},children:e},void 0,0,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/transition/Slider.tsx",lineNumber:71,columnNumber:5},void 0)}
|
|
89
89
|
;async function or({title:e="Confirm",message:t,confirmAction:n="Yes"}){const r={current:null},o=document.createElement("div");return o.setAttribute("data-testid","confirm-container"),o.style.position="relative",o.style.zIndex="10",document.body.appendChild(o),new Promise((i=>{const a=e=>{P(null,o),o.remove(),i(e)};P(Ne(Jn,{buttons:Ne(g,{children:[Ne(zn,{elementRef:r,"data-testid":"cancel-button",onClick:()=>a(!1),children:"Cancel"}),Ne(zn,{"data-testid":"confirm-button",variant:"primary",onClick:()=>a(!0),children:n})]}),initialFocus:r,title:e,onClose:()=>a(!1),children:t}),o)}))}function ir({services:e}){return Array.isArray(e)&&e[0]?e[0]:null}const ar={accentColor:"color",appBackgroundColor:"backgroundColor",ctaBackgroundColor:"backgroundColor",ctaTextColor:"color",selectionFontFamily:"fontFamily",annotationFontFamily:"fontFamily"};function sr(e,t){const n={};if(!t.branding)return n;const{branding:r}=t;return e.forEach((e=>{const t=ar[e],o=r[e];t&&o&&(n[t]=o)})),n}const lr=B({get(e){
|
|
90
|
-
throw new Error(`Missing ServiceContext provider to provide "${e}" prop`)}});function cr(e,t){function n(n){const r=he(lr),o={};for(
|
|
90
|
+
throw new Error(`Missing ServiceContext provider to provide "${e}" prop`)}});function cr(e,t){function n(n){const r=he(lr),o={};for(const e of t)e in n||(o[e]=r.get(e));const i={...o,...n};return Ne(e,{...i})}const r=e.displayName||e.name;return n.displayName=`withServices(${r})`,n}function ur(e){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ur(e)}function dr(e){var t=function(e,t){if("object"!==ur(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==ur(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ur(t)?t:String(t)}function hr(e,t,n){return(t=dr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mr(e,t){var n=Object.keys(e)
|
|
91
91
|
;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mr(Object(n),!0).forEach((function(t){hr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var gr="function"==typeof Symbol&&Symbol.observable||"@@observable",vr=function(){return Math.random().toString(36).substring(7).split("").join(".")},br={INIT:"@@redux/INIT"+vr(),REPLACE:"@@redux/REPLACE"+vr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vr()}};function _r(e){
|
|
92
92
|
if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function yr(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(fr(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(fr(1));return n(yr)(e,t)}if("function"!=typeof e)throw new Error(fr(2));var o=e,i=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(fr(3));return i}function d(e){if("function"!=typeof e)throw new Error(fr(4));if(l)throw new Error(fr(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(fr(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),a=null}}}function h(e){if(!_r(e))throw new Error(fr(7));if(void 0===e.type)throw new Error(fr(8));if(l)throw new Error(fr(9));try{l=!0,i=o(i,e)}finally{l=!1}for(var t=a=s,n=0;n<t.length;n++){(0,t[n])()}return e}function m(e){
|
|
93
93
|
if("function"!=typeof e)throw new Error(fr(10));o=e,h({type:br.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(fr(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[gr]=function(){return this},e}return h({type:br.INIT}),(r={dispatch:h,subscribe:d,getState:u,replaceReducer:m})[gr]=p,r}function wr(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:br.INIT}))throw new Error(fr(12));if(void 0===n(void 0,{type:br.PROBE_UNKNOWN_ACTION()}))throw new Error(fr(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},s=0;s<a.length;s++){var l=a[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(fr(14));o[l]=d,r=r||d!==u}return(r=r||a.length!==Object.keys(e).length)?o:e}}function xr(e,t){return function(){
|
|
@@ -534,7 +534,7 @@ function Wm(e){return aa([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.cre
|
|
|
534
534
|
;function Zm(e){return function(e){return e.replace(Xm,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class Qm{constructor(e,t){F(this,"term",void 0),F(this,"matcher",void 0),this.term=t.normalize(e),this.matcher=t}matches(e){const t=this.matcher;return t.fieldValues(e).some((e=>t.matches(t.normalize(e),this.term)))}}class Jm{constructor(e,t){F(this,"operator",void 0),F(this,"filters",void 0),this.operator=e,this.filters=t}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}function ep(e){return{fieldValues:e,matches:(e,t)=>e.includes(t),normalize:Zm}}const tp={quote:ep((e=>{var t;return[null!==(t=io(e))&&void 0!==t?t:""]})),since:{fieldValues:e=>[new Date(e.updated).valueOf()],matches:(e,t)=>(Date.now()-e)/1e3<=t,normalize:e=>e},tag:ep((e=>e.tags)),text:ep((e=>[e.text])),uri:ep((e=>[e.uri])),user:ep((e=>{var t,n;return[e.user,null!==(t=null===(n=e.user_info)||void 0===n?void 0:n.display_name)&&void 0!==t?t:""]}))};const np=function(e){
|
|
535
535
|
if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,sortCompareFn:Km[t.sortKey]},r=!!t.filterQuery||Object.keys(t.filters).length>0;if(r){const e=function(e,t={}){const n=[],r=[],o=[],i=[],a=[],s=[],l=t.user?[t.user]:[],c=Im(e);for(const e of c){const t=e.slice(0,e.indexOf(":")),c=e.slice(t.length+1);switch(t){case"quote":r.push(c);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";o.push(e*n[t])}}break;case"tag":i.push(c);break;case"text":a.push(c);break;case"uri":s.push(c);break;case"user":l.push(c);break;default:n.push(e)}}return{any:{terms:n,operator:"and"},quote:{terms:r,operator:"and"},since:{terms:o,operator:"and"},tag:{terms:i,operator:"and"
|
|
536
536
|
},text:{terms:a,operator:"and"},uri:{terms:s,operator:"or"},user:{terms:l,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=(e,t)=>new Qm(t,tp[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new Jm("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new Jm(t.operator,r)})),o=new Jm("and",r);return e.filter((e=>e.id&&o.matches(e))).map((e=>e.id))}([t],e).length>0}return!r&&"sidebar"===e.route&&(n.threadFilterFn=e=>{return!!e.annotation&&(n=e.annotation,r=t.selectedTab,!Zr(n)&&$m(n)===r);var n,r}),qm(e.annotations,n)}));function rp(){const e=Di(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a=ue((()=>({annotations:t,route:r,selection:{...o,filterQuery:n,filters:i}})),[t,n,r,o,i]);return np(a)}var op=cr((function({loadAnnotationsService:e,onLogin:t}){var n
|
|
537
|
-
;const r=Di(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",i=rp(),a=r.profile().userid,[s,l]=ie(!1);return se((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),Ne(g,{children:[s&&Ne(Pi,{errorType:"annotation",onLoginRequest:t}),Ne(Cm,{threads:i.children})]})}),["loadAnnotationsService"]);class ip{constructor(e,t,n=window){var r,o,i,a;F(this,"version",void 0),F(this,"userAgent",void 0),F(this,"urls",void 0),F(this,"fingerprint",void 0),F(this,"account",void 0),F(this,"timestamp",void 0),F(this,"segment",void 0);const s="N/A";let l=s;e.userid&&(l=e.userid,e.displayName&&(l=`${e.displayName} (${l})`)),this.version="1.
|
|
537
|
+
;const r=Di(),o=null!==(n=r.routeParams().id)&&void 0!==n?n:"",i=rp(),a=r.profile().userid,[s,l]=ie(!1);return se((()=>{l(!1),r.clearAnnotations(),e.loadThread(o).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&r.setExpanded(e.id,!0))),t.id!==o&&r.highlightAnnotations([o]))})).catch((()=>{l(!0)}))}),[o,a,e,r]),Ne(g,{children:[s&&Ne(Pi,{errorType:"annotation",onLoginRequest:t}),Ne(Cm,{threads:i.children})]})}),["loadAnnotationsService"]);class ip{constructor(e,t,n=window){var r,o,i,a;F(this,"version",void 0),F(this,"userAgent",void 0),F(this,"urls",void 0),F(this,"fingerprint",void 0),F(this,"account",void 0),F(this,"timestamp",void 0),F(this,"segment",void 0);const s="N/A";let l=s;e.userid&&(l=e.userid,e.displayName&&(l=`${e.displayName} (${l})`)),this.version="1.1270.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||s,
|
|
538
538
|
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:s,this.account=l,this.timestamp=(new Date).toString();const c=null===(a=t[0])||void 0===a?void 0:a.segment;if(c){const e=[];c.cfi&&e.push(["CFI",c.cfi]),c.url&&e.push(["URL",c.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())}}function ap(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function sp(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,m=c&&null!=c.leftOffset?c.leftOffset:0,p=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h
|
|
539
539
|
;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=m,o-=p,r=e.align.lockX?t.pageXOffset:r,o=e.align.lockY?t.pageYOffset:o,i=r-t.pageXOffset,a=o-t.pageYOffset;else{s=u.width,l=u.height,n=t.getBoundingClientRect();var v=u.left-(n.left-t.scrollLeft),b=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=b+l*g-t.clientHeight*g,r-=m,o-=p,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return ap(e,r.x,r.y),e._scrollSettings=null,t.end("complete");var a=1-t.ease(i);if(ap(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&sp(t.scrollAncestor),void sp(e);!function(e){
|
|
540
540
|
if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(sp.bind(null,e))}}function lp(e){return e.self===e}function cp(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function up(){return!0}function dp(e){if(e.assignedSlot)return dp(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var hp=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{};var r=dp(e),o=1,i=t.validTarget||up,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"))
|
|
@@ -577,11 +577,11 @@ await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}ca
|
|
|
577
577
|
children:["annotation"===s&&Ne(op,{onLogin:h}),"notebook"===s&&Ne(Fp,{}),"profile"===s&&Ne(Up,{}),"stream"===s&&Ne(Xp,{}),"sidebar"===s&&Ne(Kp,{onLogin:h,onSignUp:m})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"]);function pf({error:e}){return Ne("div",{className:K("m-2 mt-12"),children:Ne(Gn,{title:"Unable to start Hypothesis",children:e.message})})}function ff(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function gf(e){const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t).map(ff).join("")}function vf(e,t,n,r=[],o=2e3,i=window){const a=gf(10),s={jsonrpc:"2.0",method:n,params:r,id:a};try{e.postMessage(s,t)}catch(e){return Promise.reject(e)}let l;const c=new Promise(((e,n)=>{l=r=>{if(r.origin!==t)return;if(!(r.data instanceof Object)||"2.0"!==r.data.jsonrpc||r.data.id!==a)return;const{error:o,result:i}=r.data;void 0!==o?n(o):void 0!==i?e(i):n(new Error("RPC reply had no result or error"))},i.addEventListener("message",l)})),u=[c];var d,h
|
|
578
578
|
;return o&&u.push((d=o,h=`Request to ${t} timed out`,new Promise(((e,t)=>{setTimeout((()=>t(new Error(h))),d)})))),Promise.race(u).then((e=>(i.removeEventListener("message",l),e))).catch((e=>{throw i.removeEventListener("message",l),e}))}function bf(e){const t=new URL(e).hash.slice(1),n=new URLSearchParams(t).get("config");return JSON.parse(n||"{}")}function _f(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function yf(e){return parseInt(e)}function wf(e){return e&&"function"==typeof e.toString?e.toString():""}function xf(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}const kf=new Set;function Sf(...e){const t=e.join();kf.has(t)||(console.warn(...e),kf.add(t))}Sf.reset=()=>{kf.clear()};var Nf=t((e=>{
|
|
579
579
|
if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}));function Ef(e,t,n,r){const o=t.find((e=>"__world__"===e.id));o&&e.unshift(o);const i=e.map((e=>e.id));t=t.filter((e=>!i.includes(e.id))),t.forEach((e=>e.isMember=!1)),e.forEach((e=>e.isMember=!0));const a=e.concat(t);return a.forEach((e=>{e.canLeave=!!function(e){const t=ir(e);return!t||!!t.allowLeavingGroups}(r)&&"private"===e.type})),a.forEach((e=>e.isScopedToUri=function(e,t){if(e.scopes&&e.scopes.uri_patterns.length>0&&t)return function(e,t){return t.some((t=>e.match(t.split("*").map(Nf).join(".*"))))}(t,e.scopes.uri_patterns);return!0}(e,n))),a}let Af=[];function Tf(e,t,n){const r=(e=>({changeFocusModeUser:t=>{var n;e.changeFocusModeUser(t);const r=null!==(n=null==t?void 0:t.groups)&&void 0!==n?n:[],o=function(e,t){return function(e,t){return t.filter((t=>e.includes(t.id)||t.groupid&&e.includes(t.groupid)))}(e,t).map((e=>e.id))}(r,e.allGroups())
|
|
580
|
-
;r.length&&!o.length&&console.error("No matching groups found in list of filtered group IDs"),e.filterGroups(o)},showContentInfo:t=>{e.setContentInfo(t)}}))(e);function o(e){
|
|
580
|
+
;r.length&&!o.length&&console.error("No matching groups found in list of filtered group IDs"),e.filterGroups(o)},showContentInfo:t=>{e.setContentInfo(t)}}))(e);function o(e){const n=t.rpcAllowedOrigins||[];if(null==(o=e.data)||"object"!=typeof o||"2.0"!==o.jsonrpc)return;var o;if(!n.includes(e.origin))return void Sf(`Ignoring JSON-RPC request from non-whitelisted origin ${e.origin}`);const i=e.data;e.source.postMessage(function(e){const t=r[e.method];if(void 0===t)return{jsonrpc:"2.0",id:e.id,error:{code:-32601,message:"Method not found"}};e.params?t(...e.params):t();return{jsonrpc:"2.0",result:"ok",id:e.id}}(i),e.origin)}Af.forEach((e=>{o(e)})),Af=[],window.removeEventListener("message",Cf),n.addEventListener("message",o)}function Cf(e){Af.push(e)}Tf.$inject=["store","settings","$window"];class Mf{constructor(e){this._rpc=e.rpc,this._reportConfig=e.reportActivity}reportActivity(e,t){if(!this._rpc||!this._reportConfig)return;let n;switch(e){case"create":n=new Date(t.created).toISOString();break;case"update":
|
|
581
581
|
n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id,isShared:fa(t.permissions)}};this._reportConfig.events.includes(e)&&function(e,t,n,r=[]){const o={jsonrpc:"2.0",method:n,params:r};e.postMessage(o,t)}(this._rpc.targetFrame,this._rpc.origin,this._reportConfig.method,[e,r])}}Mf.$inject=["settings"];class zf{constructor(e,t,n){this._activity=e,this._api=t,this._store=n}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?ha(e.user):ma(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid;if(!i)throw new Error("Cannot create annotation when logged out");const a=o.user_info,s="s:"+gf(8),l=Object.assign({created:t.toISOString(),group:r,permissions:pa(i,r,n),tags:[],text:"",
|
|
582
582
|
updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Jr(l)&&(l.permissions=ha(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Jr(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Kr(n)}),to(n)?this._store.selectTab("note"):no(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._activity.reportActivity("delete",e),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._activity.reportActivity("flag",e),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Kr(e)?ma(t,e.group):ha(t),
|
|
583
583
|
references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t,n;const r=this._applyDraftChanges(e);let o;Yr(e)?(t=this._api.annotation.update({id:e.id},r),n="update"):(t=this._api.annotation.create({},r),n="create"),this._store.annotationSaveStarted(e);try{o=await t,this._activity.reportActivity(n,o)}finally{this._store.annotationSaveFinished(e)}for(let[t,n]of Object.entries(e))if(t.startsWith("$")){o[t]=n}return this._store.removeDraft(e),this._store.addAnnotations([o]),o}}zf.$inject=["annotationActivity","api","store"];class If 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 Rf(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new If(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new If(e,n,"Failed to parse response")}var o
|
|
584
|
-
;if(!n.ok)throw new If(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Lf(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}class Of{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
584
|
+
;if(!n.ok)throw new If(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Lf(e){const t={};for(let[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}class Of{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(let[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1270.0"};l&&(u.Authorization="Bearer "+l);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:m}=li(c.url,a),p=new URL(h);for(let[e,t]of Object.entries(m)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&p.searchParams.append(e,n.toString())}return await Rf(p.toString(),{
|
|
585
585
|
body:s?JSON.stringify(Lf(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}Of.$inject=["apiRoutes","auth","store"];var Df={};function Pf(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,
|
|
586
586
|
this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Bf=Pf;Pf.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Pf.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Pf.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)
|
|
587
587
|
}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},Pf.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)},Pf.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Pf.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Pf.prototype.start=Pf.prototype.try,Pf.prototype.errors=function(){return this._errors},Pf.prototype.attempts=function(){return this._attempts},Pf.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},
|
|
@@ -686,8 +686,8 @@ this.sendMessages(),this.emit("open",e)},this._socket.onclose=e=>{if(1e3===e.cod
|
|
|
686
686
|
}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,eg(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}H_.$inject=["store","apiRoutes","auth","groups","session"];class U_{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject("hypothesis.user.tags.list")||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Nf(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){
|
|
687
687
|
const t=this._storage.getObject("hypothesis.user.tags.map")||{};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("hypothesis.user.tags.map",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("hypothesis.user.tags.list",n)}}U_.$inject=["localStorage"];class j_{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}j_.$inject=["store"];class q_ extends Np{constructor(e,t){super(),F(this,"_store",void 0),F(this,"_window",void 0),F(this,"_delayedMessageQueue",void 0),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){const t=this._store.getToastMessage(e)
|
|
688
688
|
;t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),this.emit("toastMessageDismissed",e),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r="",visuallyHidden:o=!1,delayed:i=!1}={}){if(this._store.hasToastMessage(e,t))return;if(i&&!this._window.document.hasFocus()){const i={autoDismiss:n,moreInfoURL:r,visuallyHidden:o};return void this._delayedMessageQueue.push({type:e,messageText:t,options:i})}const a=gf(10),s={type:e,id:a,message:t,moreInfoURL:r,visuallyHidden:o};this._store.addToastMessage({isDismissed:!1,...s}),this.emit("toastMessageAdded",s),n&&setTimeout((()=>{this.dismiss(a)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}q_.$inject=["store","$window"];const $_=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){
|
|
689
|
-
console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),G_=function(e){const{version:t,origin:n}=bf(e.location.href);return"1.
|
|
690
|
-
release:"1.
|
|
689
|
+
console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),G_=function(e){const{version:t,origin:n}=bf(e.location.href);return"1.1270.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1270.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 V_(e,t){e.setClientId(t.clientId)}function Y_(e,t,n){e.load(),t.load(),n.sync()}function W_(e,t,n){e.init(),t.init(),n.init()}function K_(e,t){"sidebar"===t.route()&&e.connect()}$_.sentry&&G_&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;R_({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],
|
|
690
|
+
release:"1.1270.0",beforeSend:(e,t)=>{if(O_>=5)return Sf("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++O_;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch(e){}return e}});try{fb("host_config",bf(window.location.href))}catch(e){}fb("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),Xf(((e,t)=>{pb(e,{tags:{context:t}})}))}($_.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),V_.$inject=["api","streamer"],Y_.$inject=["groups","session","router"],W_.$inject=["autosaveService","persistedDefaults","serviceURL"],K_.$inject=["frameSync","store"];const X_=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",Cf)}(),
|
|
691
691
|
async function(e,t=window){const n=function(e){const t=bf(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl"],r={openSidebar:_f,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:wf(t.origin),ancestorLevel:yf(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:xf(n.ancestorLevel,t),origin:n.origin}}(n,t);let o;if(r){const e=await async function(e,t){return{...await vf(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group
|
|
692
692
|
}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=vf(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=ir(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}($_).then((e=>{!function(e,t){const n=new q
|
|
693
693
|
;n.register("annotationsService",zf).register("annotationActivity",Mf).register("api",Of).register("apiRoutes",jf).register("auth",Gf).register("autosaveService",Vf).register("frameSync",rg).register("groups",ag).register("loadAnnotationsService",sg).register("localStorage",cg).register("persistedDefaults",dg).register("router",hg).register("serviceURL",mg).register("session",P_).register("streamer",H_).register("streamFilter",B_).register("tags",U_).register("threadsService",j_).register("toastMessenger",q_).register("store",{factory:Oi}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(W_),n.run(V_),n.run(Y_),n.run(Tf),n.run(K_),P(Ne(lr.Provider,{value:n,children:Ne(mf,{})}),t)}(e,X_)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),P(Ne(pf,{error:e}),t)}(e,X_)));
|