hypothesis 1.1289.0 → 1.1291.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?71bbd8","styles/annotator.css":"styles/annotator.css?eac46e","styles/annotator.css.map":"styles/annotator.css.map?2726f8","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?764011","styles/sidebar.css.map":"styles/sidebar.css.map?45f140","styles/ui-playground.css":"styles/ui-playground.css?c76bf2","styles/ui-playground.css.map":"styles/ui-playground.css.map?702142","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?812b67","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?aa4d84","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?f4115f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?ac89a6","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?0938bc"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1289.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:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s,t;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(t=s.runtime)||void 0===t?void 0:t.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var 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:c,manifest:s,notebookAppUrl:d,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
1
+ !function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?516eb3","styles/annotator.css":"styles/annotator.css?eac46e","styles/annotator.css.map":"styles/annotator.css.map?2726f8","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?764011","styles/sidebar.css.map":"styles/sidebar.css.map?45f140","styles/ui-playground.css":"styles/ui-playground.css?c76bf2","styles/ui-playground.css.map":"styles/ui-playground.css.map?702142","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?25afb4","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?b14148","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?f4115f","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?ac89a6","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?c7a6fe"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1291.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:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s,t;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(t=s.runtime)||void 0===t?void 0:t.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var 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:c,manifest:s,notebookAppUrl:d,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
@@ -1,5 +1,5 @@
1
1
  {
2
- "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?71bbd8",
2
+ "scripts/annotator.bundle.js": "scripts/annotator.bundle.js?516eb3",
3
3
  "styles/annotator.css": "styles/annotator.css?eac46e",
4
4
  "styles/annotator.css.map": "styles/annotator.css.map?2726f8",
5
5
  "styles/highlights.css": "styles/highlights.css?6b4ebd",
@@ -12,9 +12,9 @@
12
12
  "styles/sidebar.css.map": "styles/sidebar.css.map?45f140",
13
13
  "styles/ui-playground.css": "styles/ui-playground.css?c76bf2",
14
14
  "styles/ui-playground.css.map": "styles/ui-playground.css.map?702142",
15
- "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?812b67",
16
- "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?aa4d84",
15
+ "scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?25afb4",
16
+ "scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?b14148",
17
17
  "scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?f4115f",
18
18
  "scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?ac89a6",
19
- "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?0938bc"
19
+ "scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?c7a6fe"
20
20
  }
@@ -2,32 +2,32 @@
2
2
  return!!(t&&t!==document&&"HTML"!==t.nodeName&&"BODY"!==t.nodeName&&"classList"in t&&"contains"in t.classList)}function s(t){var e=t.type,n=t.tagName;return!("INPUT"!==n||!o[e]||t.readOnly)||"TEXTAREA"===n&&!t.readOnly||!!t.isContentEditable}function a(t){t.classList.contains("focus-visible")||(t.classList.add("focus-visible"),t.setAttribute("data-focus-visible-added",""))}function l(t){t.hasAttribute("data-focus-visible-added")&&(t.classList.remove("focus-visible"),t.removeAttribute("data-focus-visible-added"))}function c(n){n.metaKey||n.altKey||n.ctrlKey||(r(t.activeElement)&&a(t.activeElement),e=!0)}function h(t){e=!1}function u(t){r(t.target)&&(e||s(t.target))&&a(t.target)}function d(t){r(t.target)&&(t.target.classList.contains("focus-visible")||t.target.hasAttribute("data-focus-visible-added"))&&(n=!0,window.clearTimeout(i),i=window.setTimeout((function(){n=!1}),100),l(t.target))}function f(t){"hidden"===document.visibilityState&&(n&&(e=!0),p())}function p(){document.addEventListener("mousemove",g),
3
3
  document.addEventListener("mousedown",g),document.addEventListener("mouseup",g),document.addEventListener("pointermove",g),document.addEventListener("pointerdown",g),document.addEventListener("pointerup",g),document.addEventListener("touchmove",g),document.addEventListener("touchstart",g),document.addEventListener("touchend",g)}function m(){document.removeEventListener("mousemove",g),document.removeEventListener("mousedown",g),document.removeEventListener("mouseup",g),document.removeEventListener("pointermove",g),document.removeEventListener("pointerdown",g),document.removeEventListener("pointerup",g),document.removeEventListener("touchmove",g),document.removeEventListener("touchstart",g),document.removeEventListener("touchend",g)}function g(t){t.target.nodeName&&"html"===t.target.nodeName.toLowerCase()||(e=!1,m())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",h,!0),document.addEventListener("pointerdown",h,!0),document.addEventListener("touchstart",h,!0),
4
4
  document.addEventListener("visibilitychange",f,!0),p(),t.addEventListener("focus",u,!0),t.addEventListener("blur",d,!0),t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host?t.host.setAttribute("data-js-focus-visible",""):t.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var e;window.applyFocusVisiblePolyfill=t;try{e=new CustomEvent("focus-visible-polyfill-ready")}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(e)}"undefined"!=typeof document&&t(document)}();class i{constructor(){n(this,"_listeners",void 0),this._listeners=new Map}add(t,e,n,i){t.addEventListener(e,n,i);const o=Symbol();return this._listeners.set(o,{eventTarget:t,eventType:e,listener:n,options:i}),o}remove(t){const e=this._listeners.get(t);if(e){const{eventTarget:n,eventType:i,listener:o,options:r}=e
5
- ;n.removeEventListener(i,o,r),this._listeners.delete(t)}}removeAll(){this._listeners.forEach((({eventTarget:t,eventType:e,listener:n,options:i})=>{t.removeEventListener(e,n,i)})),this._listeners.clear()}}function o(t){const e=t.toString(16);return 1===e.length?"0"+e:e}function r(t){const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e).map(o).join("")}function s(t){if(null===t||"object"!=typeof t)return!1;for(let e of["frame1","frame2","type","requestId"])if("string"!=typeof t[e])return!1;return!0}function a(t,e){return!!s(t)&&JSON.stringify(t,Object.keys(e).sort())===JSON.stringify(e,Object.keys(e).sort())}class l{constructor({hostFrame:t,source:e,sourceId:n}){this._hostFrame=t,this._source=e,this._sourceId=n,this._listeners=new i}destroy(){this._listeners.removeAll()}async discover(t){let e=!1;if(("guest"===this._source&&"host"===t||"guest"===this._source&&"sidebar"===t||"sidebar"===this._source&&"host"===t||"notebook"===this._source&&"sidebar"===t)&&(e=!0),
6
- !e)throw new Error("Invalid request of channel/port");const n=r(6);return new Promise(((e,i)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:t,type:"request",requestId:n,sourceId:this._sourceId},"*")},r=setInterval(o,250),s=setTimeout((()=>{clearInterval(r),i(new Error(`Unable to establish ${this._source}-${t} communication channel`))}),2e4),l=this._listeners.add(window,"message",(i=>{const{data:o,ports:c}=i;a(o,{frame1:this._source,frame2:t,type:"offer",requestId:n})&&(clearInterval(r),clearTimeout(s),this._listeners.remove(l),e(c[0]))}));o()}))}}var c={exports:{}};function h(){}h.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function o(){i.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){
7
- var n=this.e||(this.e={}),i=n[t],o=[];if(i&&e)for(var r=0,s=i.length;r<s;r++)i[r].fn!==e&&i[r].fn._!==e&&o.push(i[r]);return o.length?n[t]=o:delete n[t],this}},c.exports=h;var u=c.exports.TinyEmitter=h;let d=null;function f(t){return t instanceof Error?{message:t.message,stack:t.stack}:{message:String(t),stack:void 0}}function p(t,e){if(!d)return;const n={type:"hypothesis-error",error:t instanceof Error?t:f(t),context:e};try{try{d.postMessage(n,"*")}catch(t){if(!(t instanceof DOMException&&"DataCloneError"===t.name))throw t;n.error=f(n.error),d.postMessage(n,"*")}}catch(t){console.warn("Unable to report Hypothesis error",t)}}function m(t){d=t}class g{constructor(t){this._hypothesisAppsOrigin=t,this._emitter=new u,this._handledRequests=new Set,this._sidebarHostChannel=new MessageChannel,this._listeners=new i,this._allowedMessages=[{allowedOrigin:"*",frame1:"guest",frame2:"host",type:"request"},{allowedOrigin:"*",frame1:"guest",frame2:"sidebar",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,
8
- frame1:"sidebar",frame2:"host",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,frame1:"notebook",frame2:"sidebar",type:"request"}],this._listen()}_listen(){const t="Handling port request",e=new Set,n=n=>{e.has(n)||(e.add(n),p(new Error(n),t))};var i,o;this._listeners.add(window,"message",(i=t=>{const{data:e,origin:i,source:o}=t;if(!s(e)||"request"!==e.type)return;const{frame1:r,frame2:a,requestId:l,sourceId:c}=e,h=`${r}-${a}`;if(!function(t){return!(null===t||t instanceof MessagePort||window.ServiceWorker&&t instanceof ServiceWorker)}(o))return void n(`Ignored port request for channel ${h} from non-Window source`);if(void 0===this._allowedMessages.find((({allowedOrigin:t,...n})=>this._messageMatches({allowedMessage:n,allowedOrigin:t,data:e,origin:i}))))return void n(`Ignored invalid port request for channel ${h} from ${i}`);if(this._handledRequests.has(l))return;this._handledRequests.add(l);const u="sidebar-host"===h?this._sidebarHostChannel:new MessageChannel,d={frame1:r,frame2:a,type:"offer",
9
- requestId:l,sourceId:c},f="null"===i?"*":i;o.postMessage(d,f,[u.port1]),"sidebar"===a?this._sidebarHostChannel.port2.postMessage(d,[u.port2]):"host"===a&&this._emitter.emit("frameConnected",r,u.port2)},o=t,(...t)=>{try{return i(...t)}catch(t){throw p(t,o),t}}))}_messageMatches({allowedMessage:t,allowedOrigin:e,data:n,origin:i}){return("*"===e||i===e)&&a(n,t)}on(t,e){this._emitter.on(t,e)}destroy(){this._listeners.removeAll()}}const _="1.0.0",v="frame-rpc";function b(t,e,n=[],i=-1){t.postMessage({protocol:v,version:_,arguments:n,method:e,sequence:i})}function y(t){const e=t.match(/\bAppleWebKit\/([0-9]+)\b/);if(!e)return!1;return!(parseInt(e[1])<=537)}class w{constructor({userAgent:t=navigator.userAgent,currentWindow:e=window}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new i,this._listeners.add(e,"unload",(()=>{this._port&&(b(this._port,"close"),e!==e.parent&&y(t)&&e.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),
10
- this._pendingCalls=[],this._receivedCloseEvent=!1}on(t,e){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(t,e)}connect(t){this._port=t,this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),b(t,"connect");for(let[t,e]of this._pendingCalls)this.call(t,...e);this._pendingCalls=[]}destroy(){this._port&&(b(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(t,...e){if(this._port||this._pendingCalls.push([t,e]),!this._port||this._destroyed)return;const n=this._sequence++,i=e[e.length-1];"function"==typeof i&&(this._callbacks.set(n,i),e=e.slice(0,-1)),b(this._port,t,e,n)}_parseMessage({data:t}){return t&&"object"==typeof t?t.protocol!==v||t.version!==_?null:Array.isArray(t.arguments)?t:null:null}_handle(t){const e=this._parseMessage(t),n=this._port;if(e&&n)if("method"in e){if("close"===e.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const t=this._methods.get(e.method);if(!t)return
11
- ;const i=(...t)=>{const i={arguments:t,protocol:v,response:e.sequence,version:_};n.postMessage(i)};t(...e.arguments,i)}else if("response"in e){const t=this._callbacks.get(e.response);this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function x(t){if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function C(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}Object.assign(e,o)}return e}function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function E(t,e,n){const i=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return i.href}
12
- function N(t){return"string"==typeof t?t:null}function A(t){const e=function(t){if(!S(t,"hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t),n=x(e.ignoreOtherConfiguration)?{}:C(t.document);function i(t){return S(e,t)?e[t]:S(n,t)?n[t]:void 0}return{get annotations(){return N(n.annotations)||function(){const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return E(t,"hypothesis-client","javascript")},get group(){return N(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return E(t,"notebook","html")},get profileAppUrl(){return E(t,"profile","html")},get showHighlights(){return function(){const t=i("showHighlights");switch(t){case"always":case"never":
13
- case"whenSidebarOpen":return t;case!0:return"always";case!1:return"never";default:return"always"}}()},get sidebarAppUrl(){return E(t,"sidebar","html")},get query(){return N(n.query)||function(){const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:i}}const R=(t,e)=>t.hostPageSetting(e),T={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:R},branding:{defaultValue:null,allowInBrowserExt:!1,getValue:R},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentInfoBanner:{allowInBrowserExt:!1,defaultValue:null,getValue:R},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:R},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:R},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:R},usernameUrl:{
14
- allowInBrowserExt:!1,defaultValue:null,getValue:R},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:R},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:x,getValue:R},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:R},services:{allowInBrowserExt:!1,defaultValue:null,getValue:R},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.notebookAppUrl},profileAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.profileAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:R},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:R}};function k(t,e=window){const n=A(e),i={};for(const r of function(t){const e={annotator:["clientUrl","contentInfoBanner","subFrameIdentifier"],
15
- sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"],profile:["profileAppUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"profile":return e.profile;case"all":return Object.values(e).flat();default:throw new Error(`Invalid application context used: "${t}"`)}}(t)){const t=T[r],s=void 0!==t.defaultValue,a=!((o=E(e,"sidebar","html")).startsWith("http://")||o.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(i[r]=t.defaultValue);continue}const l=t.getValue(n,r);void 0!==l?i[r]=t.coerce?t.coerce(l):l:s&&(i[r]=t.defaultValue)}var o;return i}
16
- var P,O,M,L,I,D,F,B,H={},V=[],U=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q=Array.isArray;function W(t,e){for(var n in e)t[n]=e[n];return t}function z(t){var e=t.parentNode;e&&e.removeChild(t)}function $(t,e,n,i,o){var r={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++M:o};return null==o&&null!=O.vnode&&O.vnode(r),r}function j(t){return t.children}function X(t,e){this.props=t,this.context=e}function Y(t,e){if(null==e)return t.__?Y(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?Y(t):null}function G(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return G(t)}}function Z(t){(!t.__d&&(t.__d=!0)&&L.push(t)&&!K.__r++||I!==O.debounceRendering)&&((I=O.debounceRendering)||D)(K)}function K(){var t,e,n,i,o,r,s,a
17
- ;for(L.sort(F);t=L.shift();)t.__d&&(e=L.length,i=void 0,o=void 0,s=(r=(n=t).__v).__e,(a=n.__P)&&(i=[],(o=W({},r)).__v=r.__v+1,st(a,r,o,n.__n,void 0!==a.ownerSVGElement,null!=r.__h?[s]:null,i,null==s?Y(r):s,r.__h),at(i,r),r.__e!=s&&G(r)),L.length>e&&L.sort(F));K.__r=0}function Q(t,e,n,i,o,r,s,a,l,c){var h,u,d,f,p,m,g,_=i&&i.__k||V,v=_.length;for(n.__k=[],h=0;h<e.length;h++)if(null!=(f=n.__k[h]=null==(f=e[h])||"boolean"==typeof f||"function"==typeof f?null:"string"==typeof f||"number"==typeof f||"bigint"==typeof f?$(null,f,null,null,f):q(f)?$(j,{children:f},null,null,null):f.__b>0?$(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(d=_[h])||d&&f.key==d.key&&f.type===d.type)_[h]=void 0;else for(u=0;u<v;u++){if((d=_[u])&&f.key==d.key&&f.type===d.type){_[u]=void 0;break}d=null}st(t,f,d=d||H,o,r,s,a,l,c),p=f.__e,(u=f.ref)&&d.ref!=u&&(g||(g=[]),d.ref&&g.push(d.ref,null,f),g.push(u,f.__c||p,f)),null!=p?(null==m&&(m=p),
18
- "function"==typeof f.type&&f.__k===d.__k?f.__d=l=J(f,l,t):l=tt(t,f,d,_,p,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=t&&(l=Y(d))}for(n.__e=m,h=v;h--;)null!=_[h]&&("function"==typeof n.type&&null!=_[h].__e&&_[h].__e==n.__d&&(n.__d=et(i).nextSibling),ht(_[h],_[h]));if(g)for(h=0;h<g.length;h++)ct(g[h],g[++h],g[++h])}function J(t,e,n){for(var i,o=t.__k,r=0;o&&r<o.length;r++)(i=o[r])&&(i.__=t,e="function"==typeof i.type?J(i,e,n):tt(n,i,i,o,i.__e,e));return e}function tt(t,e,n,i,o,r){var s,a,l;if(void 0!==e.__d)s=e.__d,e.__d=void 0;else if(null==n||o!=r||null==o.parentNode)t:if(null==r||r.parentNode!==t)t.appendChild(o),s=null;else{for(a=r,l=0;(a=a.nextSibling)&&l<i.length;l+=1)if(a==o)break t;t.insertBefore(o,r),s=r}return void 0!==s?s:o.nextSibling}function et(t){var e,n,i;if(null==t.type||"string"==typeof t.type)return t.__e;if(t.__k)for(e=t.__k.length-1;e>=0;e--)if((n=t.__k[e])&&(i=et(n)))return i;return null}function nt(t,e,n){
19
- "-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||U.test(e)?n:n+"px"}function it(t,e,n,i,o){var r;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||nt(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||nt(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?i||t.addEventListener(e,r?rt:ot,r):t.removeEventListener(e,r?rt:ot,r);else if("dangerouslySetInnerHTML"!==e){if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==e&&"height"!==e&&"href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&"rowSpan"!==e&&"colSpan"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,n))}}function ot(t){return this.l[t.type+!1](O.event?O.event(t):t)}function rt(t){
20
- return this.l[t.type+!0](O.event?O.event(t):t)}function st(t,e,n,i,o,r,s,a,l){var c,h,u,d,f,p,m,g,_,v,b,y,w,x,C,S=e.type;if(void 0!==e.constructor)return null;null!=n.__h&&(l=n.__h,a=e.__e=n.__e,e.__h=null,r=[a]),(c=O.__b)&&c(e);try{t:if("function"==typeof S){if(g=e.props,_=(c=S.contextType)&&i[c.__c],v=c?_?_.props.value:c.__:i,n.__c?m=(h=e.__c=n.__c).__=h.__E:("prototype"in S&&S.prototype.render?e.__c=h=new S(g,v):(e.__c=h=new X(g,v),h.constructor=S,h.render=ut),_&&_.sub(h),h.props=g,h.state||(h.state={}),h.context=v,h.__n=i,u=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=S.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=W({},h.__s)),W(h.__s,S.getDerivedStateFromProps(g,h.__s))),d=h.props,f=h.state,h.__v=e,u)null==S.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==S.getDerivedStateFromProps&&g!==d&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,v),
21
- !h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,v)||e.__v===n.__v){for(e.__v!==n.__v&&(h.props=g,h.state=h.__s,h.__d=!1),h.__e=!1,e.__e=n.__e,e.__k=n.__k,e.__k.forEach((function(t){t&&(t.__=e)})),b=0;b<h._sb.length;b++)h.__h.push(h._sb[b]);h._sb=[],h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,v),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(d,f,p)}))}if(h.context=v,h.props=g,h.__P=t,y=O.__r,w=0,"prototype"in S&&S.prototype.render){for(h.state=h.__s,h.__d=!1,y&&y(e),c=h.render(h.props,h.state,h.context),x=0;x<h._sb.length;x++)h.__h.push(h._sb[x]);h._sb=[]}else do{h.__d=!1,y&&y(e),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++w<25);h.state=h.__s,null!=h.getChildContext&&(i=W(W({},i),h.getChildContext())),u||null==h.getSnapshotBeforeUpdate||(p=h.getSnapshotBeforeUpdate(d,f)),Q(t,q(C=null!=c&&c.type===j&&null==c.key?c.props.children:c)?C:[C],e,n,i,o,r,s,a,l),h.base=e.__e,e.__h=null,
22
- h.__h.length&&s.push(h),m&&(h.__E=h.__=null),h.__e=!1}else null==r&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=lt(n.__e,e,n,i,o,r,s,l);(c=O.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=r)&&(e.__e=a,e.__h=!!l,r[r.indexOf(a)]=null),O.__e(t,e,n)}}function at(t,e){O.__c&&O.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){O.__e(t,e.__v)}}))}function lt(t,e,n,i,o,r,s,a){var l,c,h,u=n.props,d=e.props,f=e.type,p=0;if("svg"===f&&(o=!0),null!=r)for(;p<r.length;p++)if((l=r[p])&&"setAttribute"in l==!!f&&(f?l.localName===f:3===l.nodeType)){t=l,r[p]=null;break}if(null==t){if(null===f)return document.createTextNode(d);t=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),r=null,a=!1}if(null===f)u===d||a&&t.data===d||(t.data=d);else{if(r=r&&P.call(t.childNodes),c=(u=n.props||H).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!a){if(null!=r)for(u={},p=0;p<t.attributes.length;p++)u[t.attributes[p].name]=t.attributes[p].value
23
- ;(h||c)&&(h&&(c&&h.__html==c.__html||h.__html===t.innerHTML)||(t.innerHTML=h&&h.__html||""))}if(function(t,e,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in e||it(t,r,null,n[r],i);for(r in e)o&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||it(t,r,e[r],n[r],i)}(t,d,u,o,a),h)e.__k=[];else if(Q(t,q(p=e.props.children)?p:[p],e,n,i,o&&"foreignObject"!==f,r,s,r?r[0]:n.__k&&Y(n,0),a),null!=r)for(p=r.length;p--;)null!=r[p]&&z(r[p]);a||("value"in d&&void 0!==(p=d.value)&&(p!==t.value||"progress"===f&&!p||"option"===f&&p!==u.value)&&it(t,"value",p,u.value,!1),"checked"in d&&void 0!==(p=d.checked)&&p!==t.checked&&it(t,"checked",p,u.checked,!1))}return t}function ct(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){O.__e(t,n)}}function ht(t,e,n){var i,o;if(O.unmount&&O.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||ct(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){O.__e(t,e)}i.base=i.__P=null,t.__c=void 0}
24
- if(i=t.__k)for(o=0;o<i.length;o++)i[o]&&ht(i[o],e,n||"function"!=typeof t.type);n||null==t.__e||z(t.__e),t.__=t.__e=t.__d=void 0}function ut(t,e,n){return this.constructor(t,n)}function dt(t,e,n){var i,o,r;O.__&&O.__(t,e),o=(i="function"==typeof n)?null:n&&n.__k||e.__k,r=[],st(e,t=(!i&&n||e).__k=function(t,e,n){var i,o,r,s={};for(r in e)"key"==r?i=e[r]:"ref"==r?o=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?P.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===s[r]&&(s[r]=t.defaultProps[r]);return $(t,s,i,o,null)}(j,null,[t]),o||H,H,void 0!==e.ownerSVGElement,!i&&n?[n]:o?null:e.firstChild?P.call(e.childNodes):null,r,!i&&n?n:o?o.__e:e.firstChild,i),at(r,t)}function ft(t,e){var n={__c:e="__cC"+B++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){
25
- this.props.value!==t.value&&n.some((function(t){t.__e=!0,Z(t)}))},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}P=V.slice,O={__e:function(t,e,n,i){for(var o,r,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(t)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),s=o.__d),s)return o.__E=o}catch(e){t=e}throw t}},M=0,X.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=W({},this.state),"function"==typeof t&&(t=t(W({},n),this.props)),t&&W(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),Z(this))},X.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Z(this))},X.prototype.render=j,L=[],D="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,F=function(t,e){
26
- return t.__v.__b-e.__v.__b},K.__r=0,B=0;var pt,mt,gt,_t,vt=0,bt=[],yt=[],wt=O.__b,xt=O.__r,Ct=O.diffed,St=O.__c,Et=O.unmount;function Nt(t,e){O.__h&&O.__h(mt,t,vt||e),vt=0;var n=mt.__H||(mt.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:yt}),n.__[t]}function At(t){return vt=1,function(t,e,n){var i=Nt(pt++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):Bt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=mt,!mt.u)){var o=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return t.__c}));if(o.every((function(t){return!t.__N})))return!r||r.call(this,t,e,n);var s=!1;return o.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(s=!0)}})),!(!s&&i.__c.props===t)&&(!r||r.call(this,t,e,n))};mt.u=!0;var r=mt.shouldComponentUpdate,s=mt.componentWillUpdate;mt.componentWillUpdate=function(t,e,n){if(this.__e){var i=r;r=void 0,o(t,e,n),r=i}s&&s.call(this,t,e,n)},mt.shouldComponentUpdate=o}
27
- return i.__N||i.__}(Bt,t)}function Rt(t,e){var n=Nt(pt++,3);!O.__s&&Ft(n.__H,e)&&(n.__=t,n.i=e,mt.__H.__h.push(n))}function Tt(t){return vt=5,kt((function(){return{current:t}}),[])}function kt(t,e){var n=Nt(pt++,7);return Ft(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Pt(t,e){return vt=8,kt((function(){return t}),e)}function Ot(){for(var t;t=bt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(It),t.__H.__h.forEach(Dt),t.__H.__h=[]}catch(e){t.__H.__h=[],O.__e(e,t.__v)}}O.__b=function(t){mt=null,wt&&wt(t)},O.__r=function(t){xt&&xt(t),pt=0;var e=(mt=t.__c).__H;e&&(gt===mt?(e.__h=[],mt.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=yt,t.__N=t.i=void 0}))):(e.__h.forEach(It),e.__h.forEach(Dt),e.__h=[],pt=0)),gt=mt},O.diffed=function(t){Ct&&Ct(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==bt.push(e)&&_t===O.requestAnimationFrame||((_t=O.requestAnimationFrame)||Lt)(Ot)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==yt&&(t.__=t.__V),t.i=void 0,t.__V=yt}))),gt=mt=null},
28
- O.__c=function(t,e){e.some((function(t){try{t.__h.forEach(It),t.__h=t.__h.filter((function(t){return!t.__||Dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],O.__e(n,t.__v)}})),St&&St(t,e)},O.unmount=function(t){Et&&Et(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{It(t)}catch(t){e=t}})),n.__H=void 0,e&&O.__e(e,n.__v))};var Mt="function"==typeof requestAnimationFrame;function Lt(t){var e,n=function(){clearTimeout(i),Mt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);Mt&&(e=requestAnimationFrame(n))}function It(t){var e=mt,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),mt=e}function Dt(t){var e=mt;t.__c=t.__(),mt=e}function Ft(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function Bt(t,e){return"function"==typeof e?e(t):e}const Ht={alt:1,ctrl:2,meta:4,shift:8};function Vt(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let i=0,o=null;for(const t of n){const e=Ht[t];if(e)i|=e;else{
29
- if(null!==o)throw new Error("Multiple non-modifier keys specified");o=t}}if(!o)throw new Error(`Invalid shortcut: ${e}`);return((t.ctrlKey?Ht.ctrl:0)|(t.metaKey?Ht.meta:0)|(t.altKey?Ht.alt:0)|(t.shiftKey?Ht.shift:0))===i&&t.key.toLowerCase()===o}function Ut(t,e,{rootElement:n}={}){Rt((()=>{if(t)return function(t,e,{rootElement:n=document.documentElement}={}){const i=n=>{Vt(n,t)&&e(n)};return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}(t,e,{rootElement:n})}),[t,e,n])}const qt=(t=window)=>t.matchMedia("(pointer: coarse)").matches;var Wt=0;function zt(t,e,n,i,o,r){var s,a,l={};for(a in e)"ref"==a?s=e[a]:l[a]=e[a];var c={type:t,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Wt,__source:o,__self:r};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return O.vnode&&O.vnode(c),c}var $t="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Annotate.tsx";function jt(t){
30
- return zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","data-component":"AnnotateIcon",...t,children:zt("path",{fill:"currentColor",
5
+ ;n.removeEventListener(i,o,r),this._listeners.delete(t)}}removeAll(){this._listeners.forEach((({eventTarget:t,eventType:e,listener:n,options:i})=>{t.removeEventListener(e,n,i)})),this._listeners.clear()}}function o(t){const e=t.toString(16);return 1===e.length?"0"+e:e}function r(t){const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e).map(o).join("")}function s(t){if(null===t||"object"!=typeof t)return!1;for(const e of["frame1","frame2","type","requestId"])if("string"!=typeof t[e])return!1;return!0}function a(t,e){return!!s(t)&&JSON.stringify(t,Object.keys(e).sort())===JSON.stringify(e,Object.keys(e).sort())}class l{constructor({hostFrame:t,source:e,sourceId:o}){n(this,"_hostFrame",void 0),n(this,"_listeners",void 0),n(this,"_source",void 0),n(this,"_sourceId",void 0),this._hostFrame=t,this._source=e,this._sourceId=o,this._listeners=new i}destroy(){this._listeners.removeAll()}async discover(t){let e=!1
6
+ ;if(("guest"===this._source&&"host"===t||"guest"===this._source&&"sidebar"===t||"sidebar"===this._source&&"host"===t||"notebook"===this._source&&"sidebar"===t)&&(e=!0),!e)throw new Error("Invalid request of channel/port");const n=r(6);return new Promise(((e,i)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:t,type:"request",requestId:n,sourceId:this._sourceId},"*")},r=setInterval(o,250),s=setTimeout((()=>{clearInterval(r),i(new Error(`Unable to establish ${this._source}-${t} communication channel`))}),2e4),l=this._listeners.add(window,"message",(i=>{const{data:o,ports:c}=i;a(o,{frame1:this._source,frame2:t,type:"offer",requestId:n})&&(clearInterval(r),clearTimeout(s),this._listeners.remove(l),e(c[0]))}));o()}))}}var c={exports:{}};function h(){}h.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function o(){i.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){
7
+ for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;i<o;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],o=[];if(i&&e)for(var r=0,s=i.length;r<s;r++)i[r].fn!==e&&i[r].fn._!==e&&o.push(i[r]);return o.length?n[t]=o:delete n[t],this}},c.exports=h;var u=c.exports.TinyEmitter=h;let d=null;function f(t){return t instanceof Error?{message:t.message,stack:t.stack}:{message:String(t),stack:void 0}}function p(t,e){if(!d)return;const n={type:"hypothesis-error",error:t instanceof Error?t:f(t),context:e};try{try{d.postMessage(n,"*")}catch(t){if(!(t instanceof DOMException&&"DataCloneError"===t.name))throw t;n.error=f(n.error),d.postMessage(n,"*")}}catch(t){console.warn("Unable to report Hypothesis error",t)}}function m(t){d=t}class g{constructor(t){this._hypothesisAppsOrigin=t,this._emitter=new u,this._handledRequests=new Set,this._sidebarHostChannel=new MessageChannel,this._listeners=new i,this._allowedMessages=[{allowedOrigin:"*",
8
+ frame1:"guest",frame2:"host",type:"request"},{allowedOrigin:"*",frame1:"guest",frame2:"sidebar",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,frame1:"sidebar",frame2:"host",type:"request"},{allowedOrigin:this._hypothesisAppsOrigin,frame1:"notebook",frame2:"sidebar",type:"request"}],this._listen()}_listen(){const t="Handling port request",e=new Set,n=n=>{e.has(n)||(e.add(n),p(new Error(n),t))};var i,o;this._listeners.add(window,"message",(i=t=>{const{data:e,origin:i,source:o}=t;if(!s(e)||"request"!==e.type)return;const{frame1:r,frame2:a,requestId:l,sourceId:c}=e,h=`${r}-${a}`;if(!function(t){return!(null===t||t instanceof MessagePort||window.ServiceWorker&&t instanceof ServiceWorker)}(o))return void n(`Ignored port request for channel ${h} from non-Window source`);if(void 0===this._allowedMessages.find((({allowedOrigin:t,...n})=>this._messageMatches({allowedMessage:n,allowedOrigin:t,data:e,origin:i}))))return void n(`Ignored invalid port request for channel ${h} from ${i}`)
9
+ ;if(this._handledRequests.has(l))return;this._handledRequests.add(l);const u="sidebar-host"===h?this._sidebarHostChannel:new MessageChannel,d={frame1:r,frame2:a,type:"offer",requestId:l,sourceId:c},f="null"===i?"*":i;o.postMessage(d,f,[u.port1]),"sidebar"===a?this._sidebarHostChannel.port2.postMessage(d,[u.port2]):"host"===a&&this._emitter.emit("frameConnected",r,u.port2)},o=t,(...t)=>{try{return i(...t)}catch(t){throw p(t,o),t}}))}_messageMatches({allowedMessage:t,allowedOrigin:e,data:n,origin:i}){return("*"===e||i===e)&&a(n,t)}on(t,e){this._emitter.on(t,e)}destroy(){this._listeners.removeAll()}}const _="1.0.0",v="frame-rpc";function b(t,e,n=[],i=-1){t.postMessage({protocol:v,version:_,arguments:n,method:e,sequence:i})}function y(t){const e=t.match(/\bAppleWebKit\/([0-9]+)\b/);if(!e)return!1;return!(parseInt(e[1])<=537)}class w{constructor({userAgent:t=navigator.userAgent,currentWindow:e=window}={}){n(this,"_callbacks",void 0),n(this,"_destroyed",void 0),n(this,"_listeners",void 0),n(this,"_methods",void 0),
10
+ n(this,"_port",void 0),n(this,"_sequence",void 0),n(this,"_pendingCalls",void 0),n(this,"_receivedCloseEvent",void 0),this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new i,this._listeners.add(e,"unload",(()=>{this._port&&(b(this._port,"close"),e!==e.parent&&y(t)&&e.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],this._destroyed=!1,this._receivedCloseEvent=!1}on(t,e){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(t,e)}connect(t){this._port=t,this._listeners.add(t,"message",(t=>this._handle(t))),t.start(),b(t,"connect");for(const[t,e]of this._pendingCalls)this.call(t,...e);this._pendingCalls=[]}destroy(){this._port&&(b(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(t,...e){if(this._port||this._pendingCalls.push([t,e]),!this._port||this._destroyed)return;const n=this._sequence++,i=e[e.length-1]
11
+ ;"function"==typeof i&&(this._callbacks.set(n,i),e=e.slice(0,-1)),b(this._port,t,e,n)}_parseMessage({data:t}){return t&&"object"==typeof t?t.protocol!==v||t.version!==_?null:Array.isArray(t.arguments)?t:null:null}_handle(t){const e=this._parseMessage(t),n=this._port;if(e&&n)if("method"in e){if("close"===e.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const t=this._methods.get(e.method);if(!t)return;const i=(...t)=>{const i={arguments:t,protocol:v,response:e.sequence,version:_};n.postMessage(i)};t(...e.arguments,i)}else if("response"in e){const t=this._callbacks.get(e.response);this._callbacks.delete(e.response),t&&t(...e.arguments)}}}function x(t){if("string"==typeof t&&"false"===t.trim().toLocaleLowerCase())return!1;const e=Number(t);return isNaN(e)?"string"==typeof t:Boolean(e)}function C(t){for(var e={},n=t.querySelectorAll("script.js-hypothesis-config"),i=0;i<n.length;i++){var o=void 0;try{o=JSON.parse(n[i].textContent||"")}catch(t){
12
+ console.warn("Could not parse settings from js-hypothesis-config tags",t),o={}}Object.assign(e,o)}return e}function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function E(t,e,n){const i=t.document.querySelector(`link[type="application/annotator+${n}"][rel="${e}"]`);if(!i)throw new Error(`No application/annotator+${n} (rel="${e}") link in the document`);if(!i.href)throw new Error(`application/annotator+${n} (rel="${e}") link has no href`);return i.href}function N(t){return"string"==typeof t?t:null}function A(t){const e=function(t){if(!S(t,"hypothesisConfig"))return{};if("function"!=typeof t.hypothesisConfig){const t="https://h.readthedocs.io/projects/client/en/latest/publishers/config/#window.hypothesisConfig";return console.warn("hypothesisConfig must be a function, see: "+t),{}}return t.hypothesisConfig()}(t),n=x(e.ignoreOtherConfiguration)?{}:C(t.document);function i(t){return S(e,t)?e[t]:S(n,t)?n[t]:void 0}return{get annotations(){return N(n.annotations)||function(){
13
+ const e=t.location.href.match(/#annotations:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get clientUrl(){return E(t,"hypothesis-client","javascript")},get group(){return N(n.group)||function(){const e=t.location.href.match(/#annotations:group:([A-Za-z0-9_-]+)$/);return e?e[1]:null}()},get notebookAppUrl(){return E(t,"notebook","html")},get profileAppUrl(){return E(t,"profile","html")},get showHighlights(){return function(){const t=i("showHighlights");switch(t){case"always":case"never":case"whenSidebarOpen":return t;case!0:return"always";case!1:return"never";default:return"always"}}()},get sidebarAppUrl(){return E(t,"sidebar","html")},get query(){return N(n.query)||function(){const e=t.location.href.match(/#annotations:(query|q):(.+)$/i);if(e)try{return decodeURIComponent(e[2])}catch(t){}return null}()},hostPageSetting:i}}const R=(t,e)=>t.hostPageSetting(e),T={annotations:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.annotations},appType:{allowInBrowserExt:!0,defaultValue:null,getValue:R},branding:{
14
+ defaultValue:null,allowInBrowserExt:!1,getValue:R},clientUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.clientUrl},contentInfoBanner:{allowInBrowserExt:!1,defaultValue:null,getValue:R},enableExperimentalNewNoteButton:{allowInBrowserExt:!1,defaultValue:null,getValue:R},group:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.group},focus:{allowInBrowserExt:!1,defaultValue:null,getValue:R},theme:{allowInBrowserExt:!1,defaultValue:null,getValue:R},usernameUrl:{allowInBrowserExt:!1,defaultValue:null,getValue:R},onLayoutChange:{allowInBrowserExt:!1,defaultValue:null,getValue:R},openSidebar:{allowInBrowserExt:!0,defaultValue:!1,coerce:x,getValue:R},query:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.query},requestConfigFromFrame:{allowInBrowserExt:!1,defaultValue:null,getValue:R},services:{allowInBrowserExt:!1,defaultValue:null,getValue:R},showHighlights:{allowInBrowserExt:!1,defaultValue:"always",getValue:t=>t.showHighlights},notebookAppUrl:{allowInBrowserExt:!0,defaultValue:null,
15
+ getValue:t=>t.notebookAppUrl},profileAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.profileAppUrl},sidebarAppUrl:{allowInBrowserExt:!0,defaultValue:null,getValue:t=>t.sidebarAppUrl},subFrameIdentifier:{allowInBrowserExt:!0,defaultValue:null,getValue:R},externalContainerSelector:{allowInBrowserExt:!1,defaultValue:null,getValue:R}};function k(t,e=window){const n=A(e),i={};for(const r of function(t){const e={annotator:["clientUrl","contentInfoBanner","subFrameIdentifier"],sidebar:["appType","annotations","branding","enableExperimentalNewNoteButton","externalContainerSelector","focus","group","onLayoutChange","openSidebar","query","requestConfigFromFrame","services","showHighlights","sidebarAppUrl","theme","usernameUrl"],notebook:["branding","group","notebookAppUrl","requestConfigFromFrame","services","theme","usernameUrl"],profile:["profileAppUrl"]};switch(t){case"annotator":return e.annotator;case"sidebar":return e.sidebar;case"notebook":return e.notebook;case"profile":return e.profile;case"all":
16
+ return Object.values(e).flat();default:throw new Error(`Invalid application context used: "${t}"`)}}(t)){const t=T[r],s=void 0!==t.defaultValue,a=!((o=E(e,"sidebar","html")).startsWith("http://")||o.startsWith("https://"));if(!t.allowInBrowserExt&&a){s&&(i[r]=t.defaultValue);continue}const l=t.getValue(n,r);void 0!==l?i[r]=t.coerce?t.coerce(l):l:s&&(i[r]=t.defaultValue)}var o;return i}var P,O,M,L,I,D,F,B,H={},V=[],U=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q=Array.isArray;function W(t,e){for(var n in e)t[n]=e[n];return t}function z(t){var e=t.parentNode;e&&e.removeChild(t)}function $(t,e,n,i,o){var r={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++M:o};return null==o&&null!=O.vnode&&O.vnode(r),r}function j(t){return t.children}function X(t,e){this.props=t,this.context=e}function Y(t,e){if(null==e)return t.__?Y(t.__,t.__.__k.indexOf(t)+1):null
17
+ ;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?Y(t):null}function G(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return G(t)}}function Z(t){(!t.__d&&(t.__d=!0)&&L.push(t)&&!K.__r++||I!==O.debounceRendering)&&((I=O.debounceRendering)||D)(K)}function K(){var t,e,n,i,o,r,s,a;for(L.sort(F);t=L.shift();)t.__d&&(e=L.length,i=void 0,o=void 0,s=(r=(n=t).__v).__e,(a=n.__P)&&(i=[],(o=W({},r)).__v=r.__v+1,st(a,r,o,n.__n,void 0!==a.ownerSVGElement,null!=r.__h?[s]:null,i,null==s?Y(r):s,r.__h),at(i,r),r.__e!=s&&G(r)),L.length>e&&L.sort(F));K.__r=0}function Q(t,e,n,i,o,r,s,a,l,c){var h,u,d,f,p,m,g,_=i&&i.__k||V,v=_.length;for(n.__k=[],h=0;h<e.length;h++)if(null!=(f=n.__k[h]=null==(f=e[h])||"boolean"==typeof f||"function"==typeof f?null:"string"==typeof f||"number"==typeof f||"bigint"==typeof f?$(null,f,null,null,f):q(f)?$(j,{children:f
18
+ },null,null,null):f.__b>0?$(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f)){if(f.__=n,f.__b=n.__b+1,null===(d=_[h])||d&&f.key==d.key&&f.type===d.type)_[h]=void 0;else for(u=0;u<v;u++){if((d=_[u])&&f.key==d.key&&f.type===d.type){_[u]=void 0;break}d=null}st(t,f,d=d||H,o,r,s,a,l,c),p=f.__e,(u=f.ref)&&d.ref!=u&&(g||(g=[]),d.ref&&g.push(d.ref,null,f),g.push(u,f.__c||p,f)),null!=p?(null==m&&(m=p),"function"==typeof f.type&&f.__k===d.__k?f.__d=l=J(f,l,t):l=tt(t,f,d,_,p,l),"function"==typeof n.type&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=t&&(l=Y(d))}for(n.__e=m,h=v;h--;)null!=_[h]&&("function"==typeof n.type&&null!=_[h].__e&&_[h].__e==n.__d&&(n.__d=et(i).nextSibling),ht(_[h],_[h]));if(g)for(h=0;h<g.length;h++)ct(g[h],g[++h],g[++h])}function J(t,e,n){for(var i,o=t.__k,r=0;o&&r<o.length;r++)(i=o[r])&&(i.__=t,e="function"==typeof i.type?J(i,e,n):tt(n,i,i,o,i.__e,e));return e}function tt(t,e,n,i,o,r){var s,a,l;if(void 0!==e.__d)s=e.__d,
19
+ e.__d=void 0;else if(null==n||o!=r||null==o.parentNode)t:if(null==r||r.parentNode!==t)t.appendChild(o),s=null;else{for(a=r,l=0;(a=a.nextSibling)&&l<i.length;l+=1)if(a==o)break t;t.insertBefore(o,r),s=r}return void 0!==s?s:o.nextSibling}function et(t){var e,n,i;if(null==t.type||"string"==typeof t.type)return t.__e;if(t.__k)for(e=t.__k.length-1;e>=0;e--)if((n=t.__k[e])&&(i=et(n)))return i;return null}function nt(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||U.test(e)?n:n+"px"}function it(t,e,n,i,o){var r;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||nt(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||nt(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])r=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?i||t.addEventListener(e,r?rt:ot,r):t.removeEventListener(e,r?rt:ot,r);else if("dangerouslySetInnerHTML"!==e){
20
+ if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==e&&"height"!==e&&"href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&"rowSpan"!==e&&"colSpan"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,n))}}function ot(t){return this.l[t.type+!1](O.event?O.event(t):t)}function rt(t){return this.l[t.type+!0](O.event?O.event(t):t)}function st(t,e,n,i,o,r,s,a,l){var c,h,u,d,f,p,m,g,_,v,b,y,w,x,C,S=e.type;if(void 0!==e.constructor)return null;null!=n.__h&&(l=n.__h,a=e.__e=n.__e,e.__h=null,r=[a]),(c=O.__b)&&c(e);try{t:if("function"==typeof S){if(g=e.props,_=(c=S.contextType)&&i[c.__c],v=c?_?_.props.value:c.__:i,n.__c?m=(h=e.__c=n.__c).__=h.__E:("prototype"in S&&S.prototype.render?e.__c=h=new S(g,v):(e.__c=h=new X(g,v),h.constructor=S,h.render=ut),_&&_.sub(h),h.props=g,h.state||(h.state={}),h.context=v,h.__n=i,u=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),
21
+ null!=S.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=W({},h.__s)),W(h.__s,S.getDerivedStateFromProps(g,h.__s))),d=h.props,f=h.state,h.__v=e,u)null==S.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==S.getDerivedStateFromProps&&g!==d&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,v),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,v)||e.__v===n.__v){for(e.__v!==n.__v&&(h.props=g,h.state=h.__s,h.__d=!1),h.__e=!1,e.__e=n.__e,e.__k=n.__k,e.__k.forEach((function(t){t&&(t.__=e)})),b=0;b<h._sb.length;b++)h.__h.push(h._sb[b]);h._sb=[],h.__h.length&&s.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,v),null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(d,f,p)}))}if(h.context=v,h.props=g,h.__P=t,y=O.__r,w=0,"prototype"in S&&S.prototype.render){for(h.state=h.__s,h.__d=!1,y&&y(e),c=h.render(h.props,h.state,h.context),
22
+ x=0;x<h._sb.length;x++)h.__h.push(h._sb[x]);h._sb=[]}else do{h.__d=!1,y&&y(e),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++w<25);h.state=h.__s,null!=h.getChildContext&&(i=W(W({},i),h.getChildContext())),u||null==h.getSnapshotBeforeUpdate||(p=h.getSnapshotBeforeUpdate(d,f)),Q(t,q(C=null!=c&&c.type===j&&null==c.key?c.props.children:c)?C:[C],e,n,i,o,r,s,a,l),h.base=e.__e,e.__h=null,h.__h.length&&s.push(h),m&&(h.__E=h.__=null),h.__e=!1}else null==r&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=lt(n.__e,e,n,i,o,r,s,l);(c=O.diffed)&&c(e)}catch(t){e.__v=null,(l||null!=r)&&(e.__e=a,e.__h=!!l,r[r.indexOf(a)]=null),O.__e(t,e,n)}}function at(t,e){O.__c&&O.__c(e,t),t.some((function(e){try{t=e.__h,e.__h=[],t.some((function(t){t.call(e)}))}catch(t){O.__e(t,e.__v)}}))}function lt(t,e,n,i,o,r,s,a){var l,c,h,u=n.props,d=e.props,f=e.type,p=0;if("svg"===f&&(o=!0),null!=r)for(;p<r.length;p++)if((l=r[p])&&"setAttribute"in l==!!f&&(f?l.localName===f:3===l.nodeType)){t=l,r[p]=null;break}if(null==t){
23
+ if(null===f)return document.createTextNode(d);t=o?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,d.is&&d),r=null,a=!1}if(null===f)u===d||a&&t.data===d||(t.data=d);else{if(r=r&&P.call(t.childNodes),c=(u=n.props||H).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!a){if(null!=r)for(u={},p=0;p<t.attributes.length;p++)u[t.attributes[p].name]=t.attributes[p].value;(h||c)&&(h&&(c&&h.__html==c.__html||h.__html===t.innerHTML)||(t.innerHTML=h&&h.__html||""))}if(function(t,e,n,i,o){var r;for(r in n)"children"===r||"key"===r||r in e||it(t,r,null,n[r],i);for(r in e)o&&"function"!=typeof e[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===e[r]||it(t,r,e[r],n[r],i)}(t,d,u,o,a),h)e.__k=[];else if(Q(t,q(p=e.props.children)?p:[p],e,n,i,o&&"foreignObject"!==f,r,s,r?r[0]:n.__k&&Y(n,0),a),null!=r)for(p=r.length;p--;)null!=r[p]&&z(r[p]);a||("value"in d&&void 0!==(p=d.value)&&(p!==t.value||"progress"===f&&!p||"option"===f&&p!==u.value)&&it(t,"value",p,u.value,!1),
24
+ "checked"in d&&void 0!==(p=d.checked)&&p!==t.checked&&it(t,"checked",p,u.checked,!1))}return t}function ct(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){O.__e(t,n)}}function ht(t,e,n){var i,o;if(O.unmount&&O.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||ct(i,null,e)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){O.__e(t,e)}i.base=i.__P=null,t.__c=void 0}if(i=t.__k)for(o=0;o<i.length;o++)i[o]&&ht(i[o],e,n||"function"!=typeof t.type);n||null==t.__e||z(t.__e),t.__=t.__e=t.__d=void 0}function ut(t,e,n){return this.constructor(t,n)}function dt(t,e,n){var i,o,r;O.__&&O.__(t,e),o=(i="function"==typeof n)?null:n&&n.__k||e.__k,r=[],st(e,t=(!i&&n||e).__k=function(t,e,n){var i,o,r,s={};for(r in e)"key"==r?i=e[r]:"ref"==r?o=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?P.call(arguments,2):n),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===s[r]&&(s[r]=t.defaultProps[r]);return $(t,s,i,o,null)
25
+ }(j,null,[t]),o||H,H,void 0!==e.ownerSVGElement,!i&&n?[n]:o?null:e.firstChild?P.call(e.childNodes):null,r,!i&&n?n:o?o.__e:e.firstChild,i),at(r,t)}function ft(t,e){var n={__c:e="__cC"+B++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some((function(t){t.__e=!0,Z(t)}))},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}P=V.slice,O={__e:function(t,e,n,i){for(var o,r,s;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&null!=r.getDerivedStateFromError&&(o.setState(r.getDerivedStateFromError(t)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),s=o.__d),s)return o.__E=o}catch(e){t=e}throw t}},M=0,X.prototype.setState=function(t,e){var n
26
+ ;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=W({},this.state),"function"==typeof t&&(t=t(W({},n),this.props)),t&&W(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),Z(this))},X.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Z(this))},X.prototype.render=j,L=[],D="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,F=function(t,e){return t.__v.__b-e.__v.__b},K.__r=0,B=0;var pt,mt,gt,_t,vt=0,bt=[],yt=[],wt=O.__b,xt=O.__r,Ct=O.diffed,St=O.__c,Et=O.unmount;function Nt(t,e){O.__h&&O.__h(mt,t,vt||e),vt=0;var n=mt.__H||(mt.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:yt}),n.__[t]}function At(t){return vt=1,function(t,e,n){var i=Nt(pt++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):Bt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=mt,!mt.u)){var o=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return t.__c}));if(o.every((function(t){return!t.__N
27
+ })))return!r||r.call(this,t,e,n);var s=!1;return o.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(s=!0)}})),!(!s&&i.__c.props===t)&&(!r||r.call(this,t,e,n))};mt.u=!0;var r=mt.shouldComponentUpdate,s=mt.componentWillUpdate;mt.componentWillUpdate=function(t,e,n){if(this.__e){var i=r;r=void 0,o(t,e,n),r=i}s&&s.call(this,t,e,n)},mt.shouldComponentUpdate=o}return i.__N||i.__}(Bt,t)}function Rt(t,e){var n=Nt(pt++,3);!O.__s&&Ft(n.__H,e)&&(n.__=t,n.i=e,mt.__H.__h.push(n))}function Tt(t){return vt=5,kt((function(){return{current:t}}),[])}function kt(t,e){var n=Nt(pt++,7);return Ft(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Pt(t,e){return vt=8,kt((function(){return t}),e)}function Ot(){for(var t;t=bt.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(It),t.__H.__h.forEach(Dt),t.__H.__h=[]}catch(e){t.__H.__h=[],O.__e(e,t.__v)}}O.__b=function(t){mt=null,wt&&wt(t)},O.__r=function(t){xt&&xt(t),pt=0;var e=(mt=t.__c).__H;e&&(gt===mt?(e.__h=[],mt.__h=[],e.__.forEach((function(t){
28
+ t.__N&&(t.__=t.__N),t.__V=yt,t.__N=t.i=void 0}))):(e.__h.forEach(It),e.__h.forEach(Dt),e.__h=[],pt=0)),gt=mt},O.diffed=function(t){Ct&&Ct(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==bt.push(e)&&_t===O.requestAnimationFrame||((_t=O.requestAnimationFrame)||Lt)(Ot)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==yt&&(t.__=t.__V),t.i=void 0,t.__V=yt}))),gt=mt=null},O.__c=function(t,e){e.some((function(t){try{t.__h.forEach(It),t.__h=t.__h.filter((function(t){return!t.__||Dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],O.__e(n,t.__v)}})),St&&St(t,e)},O.unmount=function(t){Et&&Et(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{It(t)}catch(t){e=t}})),n.__H=void 0,e&&O.__e(e,n.__v))};var Mt="function"==typeof requestAnimationFrame;function Lt(t){var e,n=function(){clearTimeout(i),Mt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);Mt&&(e=requestAnimationFrame(n))}function It(t){var e=mt,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),mt=e}function Dt(t){var e=mt
29
+ ;t.__c=t.__(),mt=e}function Ft(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function Bt(t,e){return"function"==typeof e?e(t):e}const Ht={alt:1,ctrl:2,meta:4,shift:8};function Vt(t,e){const n=e.split("+").map((t=>t.toLowerCase()));let i=0,o=null;for(const t of n){const e=Ht[t];if(e)i|=e;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=t}}if(!o)throw new Error(`Invalid shortcut: ${e}`);return((t.ctrlKey?Ht.ctrl:0)|(t.metaKey?Ht.meta:0)|(t.altKey?Ht.alt:0)|(t.shiftKey?Ht.shift:0))===i&&t.key.toLowerCase()===o}function Ut(t,e,{rootElement:n}={}){Rt((()=>{if(t)return function(t,e,{rootElement:n=document.documentElement}={}){const i=n=>{Vt(n,t)&&e(n)};return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}(t,e,{rootElement:n})}),[t,e,n])}const qt=(t=window)=>t.matchMedia("(pointer: coarse)").matches;var Wt=0;function zt(t,e,n,i,o,r){var s,a,l={};for(a in e)"ref"==a?s=e[a]:l[a]=e[a];var c={type:t,props:l,key:n,ref:s,__k:null,__:null,
30
+ __b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Wt,__source:o,__self:r};if("function"==typeof t&&(s=t.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return O.vnode&&O.vnode(c),c}var $t="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Annotate.tsx";function jt(t){return zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16","data-component":"AnnotateIcon",...t,children:zt("path",{fill:"currentColor",
31
31
  d:"M15 0c.27 0 .505.099.703.297A.961.961 0 0 1 16 1v15l-4-3H1a.974.974 0 0 1-.703-.29A.953.953 0 0 1 0 12V1A.96.96 0 0 1 .29.29.966.966 0 0 1 1 0h14zM7 3l-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C4.156 5.229 4 6 4 7l.002.063.006.062a.896.896 0 0 1 .008.11l-.002.074-.006.066a1.447 1.447 0 0 0 .43 1.188C4.729 8.854 5.082 9 5.5 9c.417 0 .77-.146 1.063-.438C6.854 8.271 7 7.918 7 7.5c0-.417-.146-.77-.438-1.063A1.447 1.447 0 0 0 5.5 6a1.467 1.467 0 0 0-.422.062c.177-1.03.542-1.632 1.094-1.804L7 4V3zm5 0-.469.063c-.312.041-.656.187-1.031.437-.375.25-.719.646-1.031 1.188C9.156 5.229 9 6 9 7l.002.063.006.062a.896.896 0 0 1 .008.11l-.002.074-.006.066a1.447 1.447 0 0 0 .43 1.188c.291.291.645.437 1.062.437.417 0 .77-.146 1.063-.438.291-.291.437-.645.437-1.062 0-.417-.146-.77-.438-1.063A1.447 1.447 0 0 0 10.5 6a1.467 1.467 0 0 0-.422.062c.177-1.03.542-1.632 1.094-1.804L12 4V3z"},void 0,0,{fileName:$t,lineNumber:19,columnNumber:7},this)},void 0,0,{fileName:$t,lineNumber:11,columnNumber:5},this)}
32
32
  var Xt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/Cancel.tsx";function Yt(t){return zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CancelIcon",...t,children:zt("g",{fill:"none","fill-rule":"evenodd",children:[zt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Xt,lineNumber:21,columnNumber:9},this),zt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8 3.536-3.536L8 8 4.464 4.464 8 8zm0 0-3.536 3.536L8 8l3.536 3.536L8 8z"},void 0,0,{fileName:Xt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Xt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Xt,lineNumber:11,columnNumber:5},this)}var Gt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretDown.tsx";function Zt(t){return zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretDownIcon",
33
33
  ...t,children:zt("g",{fill:"none","fill-rule":"evenodd",children:[zt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Gt,lineNumber:21,columnNumber:9},this),zt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 6-4 4-4-4"},void 0,0,{fileName:Gt,lineNumber:22,columnNumber:9},this)]},void 0,0,{fileName:Gt,lineNumber:20,columnNumber:7},this)},void 0,0,{fileName:Gt,lineNumber:11,columnNumber:5},this)}var Kt="/home/runner/work/frontend-shared/frontend-shared/src/components/icons/CaretLeft.tsx";function Qt(t){return zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CaretLeftIcon",...t,children:zt("g",{fill:"none","fill-rule":"evenodd",children:[zt("path",{d:"M0 0h16v16H0z"},void 0,0,{fileName:Kt,lineNumber:21,columnNumber:9},this),zt("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 12 6 8l4-4"},void 0,0,{fileName:Kt,lineNumber:22,
@@ -117,12 +117,12 @@ n(this,"_informHostOnNextSelectionClear",void 0),n(this,"_selectionObserver",voi
117
117
  sourceId:null!==(r=this._frameIdentifier)&&void 0!==r?r:void 0}),this.features=new wn,this._featureFlagsReceived=new Promise((t=>{this.features.on("flagsChanged",t)})),this._integration=Ao(this),this._integration.on("uriChanged",(()=>this._sendDocumentInfo())),e.contentInfoBanner)&&(null===(c=(h=this._integration).showContentInfo)||void 0===c||c.call(h,e.contentInfoBanner));null!==(s=(a=this._integration).canStyleClusteredHighlights)&&void 0!==s&&s.call(a)&&(this._clusterToolbar=new Nn(this._integration.contentContainer(),{features:this.features})),this._hostRPC=new w,this._connectHost(o),this._sidebarRPC=new w,this._connectSidebar(),this._bucketBarClient=new _n({contentContainer:this._integration.contentContainer(),hostRPC:this._hostRPC}),this._sideBySideActive=!1,this._listeners=new i,this._setupElementEvents(),this._hoveredAnnotations=new Set}_setupElementEvents(){const t=t=>{this._sideBySideActive||ko(t).length||this._sidebarRPC.call("closeSidebar")};this._listeners.add(this.element,"mouseup",(t=>{
118
118
  const{target:e,metaKey:n,ctrlKey:i}=t,o=ko(e);if(o.length&&this._highlightsVisible){const t=n||i;this.selectAnnotations(o,{toggle:t})}})),this._listeners.add(this.element,"mousedown",(({target:e})=>{t(e)})),this._listeners.add(this.element,"touchstart",(({target:e})=>{t(e)})),this._listeners.add(this.element,"mouseover",(({target:t})=>{const e=ko(t);e.length&&this._highlightsVisible&&this._sidebarRPC.call("hoverAnnotations",e)})),this._listeners.add(this.element,"mouseout",(()=>{this._highlightsVisible&&this._sidebarRPC.call("hoverAnnotations",[])})),this._listeners.add(this.element,"keydown",(t=>{this._handleShortcut(t)})),this._listeners.add(window,"resize",(()=>this._repositionAdder()))}async getDocumentInfo(){var t,e,n,i,o;const[r,s,a]=await Promise.all([this._integration.uri(),this._integration.getMetadata(),null===(t=(e=this._integration).segmentInfo)||void 0===t?void 0:t.call(e)]);return{uri:oi(r),metadata:s,segmentInfo:a,
119
119
  persistent:null!==(n=null===(i=(o=this._integration).persistFrame)||void 0===i?void 0:i.call(o))&&void 0!==n&&n}}async _sendDocumentInfo(){var t,e;null!==(t=(e=this._integration).waitForFeatureFlags)&&void 0!==t&&t.call(e)&&await this._featureFlagsReceived;const n=await this.getDocumentInfo();this._sidebarRPC.call("documentInfoChanged",n)}_repositionAdder(){if(!this._isAdderVisible)return;const t=Je();t&&this._onSelection(t)}async _connectHost(t){this._hostRPC.on("clearSelection",(()=>{Je()&&(this._informHostOnNextSelectionClear=!1,Oo())})),this._hostRPC.on("createAnnotation",(()=>this.createAnnotation())),this._hostRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._hostRPC.on("scrollToClosestOffScreenAnchor",((t,e)=>this._scrollToClosestOffScreenAnchor(t,e))),this._hostRPC.on("selectAnnotations",((t,e)=>this.selectAnnotations(t,{toggle:e}))),this._hostRPC.on("sidebarLayoutChanged",(e=>{var n,i
120
- ;((n=window)===(i=t)||n.parent===i&&n.frameElement&&n.frameElement.getBoundingClientRect().width/n.parent.innerWidth>=.8)&&this.fitSideBySide(e)})),this._hostRPC.on("close",(()=>this.emit("hostDisconnected")));const e=await this._portFinder.discover("host");this._hostRPC.connect(e)}async _connectSidebar(){this._sidebarRPC.on("featureFlagsUpdated",(t=>this.features.update(t))),this._sidebarRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._sidebarRPC.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));if(null==e||!e.highlights)return;const n=Po(e);if(!n)return;const i=new Mo(n);if(this.element.dispatchEvent(i)){Promise.resolve(i.ready).then((()=>this._integration.scrollToAnchor(e)))}})),this._sidebarRPC.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t,!1)})),this._sidebarRPC.on("deleteAnnotation",(t=>this.detach(t))),this._sidebarRPC.on("loadAnnotations",(t=>t.forEach((t=>this.anchor(t))))),this._sidebarRPC.on("showContentInfo",(t=>{var e,n
121
- ;return null===(e=(n=this._integration).showContentInfo)||void 0===e?void 0:e.call(n,t)})),this._sidebarRPC.on("navigateToSegment",(t=>{var e,n;return null===(e=(n=this._integration).navigateToSegment)||void 0===e?void 0:e.call(n,t)})),this._portFinder.discover("sidebar").then((t=>{this._sidebarRPC.connect(t)})),this._sendDocumentInfo()}destroy(){var t;this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),function(t){cn(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{var e;const n=Po(t);if(!n)return;const i=an(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)&&hn(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),
122
- 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=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&cn(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=[]
123
- ;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),Oo(),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);hn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_scrollToClosestOffScreenAnchor(t,e){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=un(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){
124
- const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=tn(n),o=on(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=To(),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}={}){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){
125
- this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Vt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Io(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Do(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.1289.0";const o=new URL(window.location.href);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}
120
+ ;((n=window)===(i=t)||n.parent===i&&n.frameElement&&n.frameElement.getBoundingClientRect().width/n.parent.innerWidth>=.8)&&this.fitSideBySide(e)})),this._hostRPC.on("close",(()=>this.emit("hostDisconnected")));const e=await this._portFinder.discover("host");this._hostRPC.connect(e)}async _scrollToAnchor(t){const e=Po(t);if(!e)return;const n=new Mo(e);this.element.dispatchEvent(n)&&(await n.ready,await this._integration.scrollToAnchor(t))}async _connectSidebar(){this._sidebarRPC.on("featureFlagsUpdated",(t=>this.features.update(t))),this._sidebarRPC.on("hoverAnnotations",(t=>this._hoverAnnotations(t))),this._sidebarRPC.on("scrollToAnnotation",(t=>{const e=this.anchors.find((e=>e.annotation.$tag===t));null!=e&&e.highlights&&this._scrollToAnchor(e)})),this._sidebarRPC.on("setHighlightsVisible",(t=>{this.setHighlightsVisible(t,!1)})),this._sidebarRPC.on("deleteAnnotation",(t=>this.detach(t))),this._sidebarRPC.on("loadAnnotations",(t=>t.forEach((t=>this.anchor(t))))),this._sidebarRPC.on("showContentInfo",(t=>{
121
+ var e,n;return null===(e=(n=this._integration).showContentInfo)||void 0===e?void 0:e.call(n,t)})),this._sidebarRPC.on("navigateToSegment",(t=>{var e,n;return null===(e=(n=this._integration).navigateToSegment)||void 0===e?void 0:e.call(n,t)})),this._portFinder.discover("sidebar").then((t=>{this._sidebarRPC.connect(t)})),this._sendDocumentInfo()}destroy(){var t;this._portFinder.destroy(),this._hostRPC.destroy(),this._sidebarRPC.destroy(),this._listeners.removeAll(),this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),function(t){cn(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){const e=t=>{var e;const n=Po(t);if(!n)return;const i=an(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)&&hn(i,!0)};this.detach(t.$tag,!1),
122
+ 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=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&cn(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
123
+ ;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),Oo(),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);hn(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}async _scrollToClosestOffScreenAnchor(t,e){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=un(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&&await this._scrollToAnchor(n)}
124
+ _onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=tn(n),o=on(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=To(),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}={}){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){
125
+ this._sideBySideActive=this._integration.fitSideBySide(t)}get sideBySideActive(){return this._sideBySideActive}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){Vt(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}}function Io(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Do(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.1291.0";const o=new URL(window.location.href);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}
126
126
  function Fo({config:t,groupId:e}){return zt("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allowFullScreen:!0,src:Io(t.notebookAppUrl,{...Do(t.notebookAppUrl,t),group:e})})}function Bo({eventBus:t,config:e}){const[n,i]=At(0),[o,r]=At(!0),[s,a]=At(null),l=Tt(""),c=Tt(null);Rt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),Rt((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),Rt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);return null===s?null:zt("div",{className:be("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:o}),"data-testid":"notebook-outer",children:zt("div",{className:"relative w-full h-full","data-testid":"notebook-inner",children:[zt("div",{className:"absolute right-0 m-3",children:zt(Ae,{title:"Close the Notebook",onClick:()=>{var t;r(!0),
127
127
  null===(t=c.current)||void 0===t||t.publish("closeNotebook")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:zt(Yt,{className:"w-4 h-4"})})}),zt(Fo,{config:e,groupId:s},n)]})})}class Ho{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),dt(zt(Bo,{eventBus:e,config:i}),this._shadowRoot)}destroy(){dt(null,this._shadowRoot),this._outerContainer.remove()}}function Vo({eventBus:t,config:e}){const[n,i]=At(!0),o=Tt(null);Rt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);return n?null:zt("div",{className:"fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50","data-testid":"profile-outer",children:zt("div",{className:"relative w-full h-full","data-testid":"profile-inner",children:[zt("div",{className:"absolute right-0 m-3",children:zt(Ae,{
128
128
  title:"Close the Profile",onClick:()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")},variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:zt(Yt,{className:"w-4 h-4"})})}),zt("iframe",{title:"Hypothesis profile",className:"h-full w-full border-0",src:e.profileAppUrl})]})})}class Uo{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),dt(zt(Vo,{eventBus:e,config:i}),this.shadowRoot)}destroy(){dt(null,this.shadowRoot),this._outerContainer.remove()}}var qo={exports:{}};!function(t){!function(e,n,i,o){var r,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),l="function",c=Math.round,h=Math.abs,u=Date.now;function d(t,e,n){return setTimeout(b(t,n),e)}function f(t,e,n){return!!Array.isArray(t)&&(p(t,n[e],n),!0)}function p(t,e,n){var i