hypothesis 1.1764.0 → 1.1765.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-template.js +1 -1
- package/build/boot.js +1 -1
- package/build/manifest.json +7 -7
- package/build/scripts/annotator.bundle.js +3 -3
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +6 -6
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/scripts/ui-playground.bundle.js +4 -4
- package/build/scripts/ui-playground.bundle.js.map +1 -1
- package/package.json +29 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var e,t,n,r,o,i,a,s,l,c,u,d,h={},p=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=Array.isArray;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(e,r,o,i,a){var s={type:e,props:r,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=t.vnode&&t.vnode(s),s}function y(e){return e.children}function _(e,t){this.props=e,this.context=t}function w(e,t){if(null==t)return e.__?w(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?w(e):null}function x(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return x(e)}}function k(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!S.__r++||o!=t.debounceRendering)&&((o=t.debounceRendering)||i)(S)}function S(){
|
|
2
|
-
for(var e,n,o,i,s,l,c,u=1;r.length;)r.length>u&&r.sort(a),e=r.shift(),u=r.length,e.__d&&(o=void 0,i=void 0,s=(i=(n=e).__v).__e,l=[],c=[],n.__P&&((o=g({},i)).__v=i.__v+1,t.vnode&&t.vnode(o),O(n.__P,o,i,n.__n,n.__P.namespaceURI,32&i.__u?[s]:null,l,null==s?w(i):s,!!(32&i.__u),c),o.__v=i.__v,o.__.__k[o.__i]=o,L(l,o,c),i.__e=i.__=null,o.__e!=s&&x(o)));S.__r=0}function A(e,t,n,r,o,i,a,s,l,c,u){var d,m,g,v,_,x,k,S=r&&r.__k||p,A=t.length;for(l=function(e,t,n,r,o){var i,a,s,l,c,u=n.length,d=u,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(a=t[i])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[i]=b(null,a,null,null,null):f(a)?a=e.__k[i]=b(y,{children:a},null,null,null):
|
|
2
|
+
for(var e,n,o,i,s,l,c,u=1;r.length;)r.length>u&&r.sort(a),e=r.shift(),u=r.length,e.__d&&(o=void 0,i=void 0,s=(i=(n=e).__v).__e,l=[],c=[],n.__P&&((o=g({},i)).__v=i.__v+1,t.vnode&&t.vnode(o),O(n.__P,o,i,n.__n,n.__P.namespaceURI,32&i.__u?[s]:null,l,null==s?w(i):s,!!(32&i.__u),c),o.__v=i.__v,o.__.__k[o.__i]=o,L(l,o,c),i.__e=i.__=null,o.__e!=s&&x(o)));S.__r=0}function A(e,t,n,r,o,i,a,s,l,c,u){var d,m,g,v,_,x,k,S=r&&r.__k||p,A=t.length;for(l=function(e,t,n,r,o){var i,a,s,l,c,u=n.length,d=u,h=0;for(e.__k=new Array(o),i=0;i<o;i++)null!=(a=t[i])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[i]=b(null,a,null,null,null):f(a)?a=e.__k[i]=b(y,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[i]=b(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+h,a.__=e,a.__b=e.__b+1,s=null,-1!=(c=a.__i=C(a,n,l,d))&&(d--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(o>u?h--:o<u&&h++),
|
|
3
3
|
"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<u;i++)null!=(s=n[i])&&0==(2&s.__u)&&(s.__e==r&&(r=w(s)),D(s,s));return r}(n,t,S,l,A),d=0;d<A;d++)null!=(g=n.__k[d])&&(m=-1==g.__i?h:S[g.__i]||h,g.__i=d,x=O(e,g,m,o,i,a,s,l,c,u),v=g.__e,g.ref&&m.ref!=g.ref&&(m.ref&&R(m.ref,null,g),u.push(g.ref,g.__c||v,g)),null==_&&null!=v&&(_=v),(k=!!(4&g.__u))||m.__k===g.__k?l=T(g,l,e,k):"function"==typeof g.type&&void 0!==x?l=x:v&&(l=v.nextSibling),g.__u&=-7);return n.__e=_,l}function T(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=T(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=w(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function E(e,t){return t=t||[],null==e||"boolean"==typeof e||(f(e)?e.some((function(e){E(e,t)})):t.push(e)),t}function C(e,t,n,r){var o,i,a,s=e.key,l=e.type,c=t[n],u=null!=c&&0==(2&c.__u)
|
|
4
4
|
;if(null===c&&null==s||u&&s==c.key&&l==c.type)return n;if(r>(u?1:0))for(o=n-1,i=n+1;o>=0||i<t.length;)if(null!=(c=t[a=o>=0?o--:i++])&&0==(2&c.__u)&&s==c.key&&l==c.type)return a;return-1}function M(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function N(e,t,n,r,o){var i,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||M(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||M(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(s,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=l,e.addEventListener(t,i?u:c,i)):e.removeEventListener(t,i?u:c,i);else{if("http://www.w3.org/2000/svg"==o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{
|
|
5
|
-
e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function I(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n.t)n.t=l++;else if(n.t<r.u)return;return r(t.event?t.event(n):n)}}}function O(n,r,o,i,a,s,l,c,u,d){var p,m,b,x,k,S,T,E,C,M,I,O,L,R,D,H,F,$=r.type;if(
|
|
5
|
+
e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function I(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n.t)n.t=l++;else if(n.t<r.u)return;return r(t.event?t.event(n):n)}}}function O(n,r,o,i,a,s,l,c,u,d){var p,m,b,x,k,S,T,E,C,M,I,O,L,R,D,H,F,$=r.type;if(void 0!==r.constructor)return null;128&o.__u&&(u=!!(32&o.__u),s=[c=r.__e=o.__e]),(p=t.__b)&&p(r);e:if("function"==typeof $)try{if(E=r.props,C="prototype"in $&&$.prototype.render,M=(p=$.contextType)&&i[p.__c],I=p?M?M.props.value:p.__:i,o.__c?T=(m=r.__c=o.__c).__=m.__E:(C?r.__c=m=new $(E,I):(r.__c=m=new _(E,I),m.constructor=$,m.render=j),M&&M.sub(m),m.state||(m.state={}),m.__n=i,b=m.__d=!0,m.__h=[],m._sb=[]),C&&null==m.__s&&(m.__s=m.state),C&&null!=$.getDerivedStateFromProps&&(m.__s==m.state&&(m.__s=g({},m.__s)),g(m.__s,$.getDerivedStateFromProps(E,m.__s))),x=m.props,k=m.state,m.__v=r,
|
|
6
6
|
b)C&&null==$.getDerivedStateFromProps&&null!=m.componentWillMount&&m.componentWillMount(),C&&null!=m.componentDidMount&&m.__h.push(m.componentDidMount);else{if(C&&null==$.getDerivedStateFromProps&&E!==x&&null!=m.componentWillReceiveProps&&m.componentWillReceiveProps(E,I),r.__v==o.__v||!m.__e&&null!=m.shouldComponentUpdate&&!1===m.shouldComponentUpdate(E,m.__s,I)){for(r.__v!=o.__v&&(m.props=E,m.state=m.__s,m.__d=!1),r.__e=o.__e,r.__k=o.__k,r.__k.some((function(e){e&&(e.__=r)})),O=0;O<m._sb.length;O++)m.__h.push(m._sb[O]);m._sb=[],m.__h.length&&l.push(m);break e}null!=m.componentWillUpdate&&m.componentWillUpdate(E,m.__s,I),C&&null!=m.componentDidUpdate&&m.__h.push((function(){m.componentDidUpdate(x,k,S)}))}if(m.context=I,m.props=E,m.__P=n,m.__e=!1,L=t.__r,R=0,C){for(m.state=m.__s,m.__d=!1,L&&L(r),p=m.render(m.props,m.state,m.context),D=0;D<m._sb.length;D++)m.__h.push(m._sb[D]);m._sb=[]}else do{m.__d=!1,L&&L(r),p=m.render(m.props,m.state,m.context),m.state=m.__s}while(m.__d&&++R<25);m.state=m.__s,
|
|
7
7
|
null!=m.getChildContext&&(i=g(g({},i),m.getChildContext())),C&&!b&&null!=m.getSnapshotBeforeUpdate&&(S=m.getSnapshotBeforeUpdate(x,k)),H=p,null!=p&&p.type===y&&null==p.key&&(H=P(p.props.children)),c=A(n,f(H)?H:[H],r,o,i,a,s,l,c,u,d),m.base=r.__e,r.__u&=-161,m.__h.length&&l.push(m),T&&(m.__E=m.__=null)}catch(n){if(r.__v=null,u||null!=s)if(n.then){for(r.__u|=u?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,r.__e=c}else{for(F=s.length;F--;)v(s[F]);z(r)}else r.__e=o.__e,r.__k=o.__k,n.then||z(r);t.__e(n,r,o)}else null==s&&r.__v==o.__v?(r.__k=o.__k,r.__e=o.__e):c=r.__e=function(n,r,o,i,a,s,l,c,u){var d,p,m,g,b,y,_,x=o.props||h,k=r.props,S=r.type;if("svg"==S?a="http://www.w3.org/2000/svg":"math"==S?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=s)for(d=0;d<s.length;d++)if((b=s[d])&&"setAttribute"in b==!!S&&(S?b.localName==S:3==b.nodeType)){n=b,s[d]=null;break}if(null==n){if(null==S)return document.createTextNode(k)
|
|
8
8
|
;n=document.createElementNS(a,S,k.is&&k),c&&(t.__m&&t.__m(r,s),c=!1),s=null}if(null==S)x===k||c&&n.data==k||(n.data=k);else{if(s=s&&e.call(n.childNodes),!c&&null!=s)for(x={},d=0;d<n.attributes.length;d++)x[(b=n.attributes[d]).name]=b.value;for(d in x)if(b=x[d],"children"==d);else if("dangerouslySetInnerHTML"==d)m=b;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;N(n,d,null,b,a)}for(d in k)b=k[d],"children"==d?g=b:"dangerouslySetInnerHTML"==d?p=b:"value"==d?y=b:"checked"==d?_=b:c&&"function"!=typeof b||x[d]===b||N(n,d,b,x[d],a);if(p)c||m&&(p.__html==m.__html||p.__html==n.innerHTML)||(n.innerHTML=p.__html),r.__k=[];else if(m&&(n.innerHTML=""),A("template"==r.type?n.content:n,f(g)?g:[g],r,o,i,"foreignObject"==S?"http://www.w3.org/1999/xhtml":a,s,l,s?s[0]:o.__k&&w(o,0),c,u),null!=s)for(d=s.length;d--;)v(s[d]);c||(d="value","progress"==S&&null==y?n.removeAttribute("value"):null!=y&&(y!==n[d]||"progress"==S&&!y||"option"==S&&y!=x[d])&&N(n,d,y,x[d],a),d="checked",
|
|
@@ -581,7 +581,7 @@ const n=e.children.map((e=>Wm(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);r
|
|
|
581
581
|
const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function xf(e,t){return e===t?0:e<t?-1:1}function kf(e,t,n){switch(n.sortBy){case"newest":{const n=yf(e);return xf(yf(t),n)}case"oldest":return xf(_f(e),_f(t));case"location":return function(e,t){if(!e.annotation||!t.annotation)return function(e,t){return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Vr(e.annotation),r=Vr(t.annotation);if(n.cfi||r.cfi){const e="/0",t=Jm(n.cfi??e,r.cfi??e);if(0!==t)return Math.sign(t)}const o=wf(n.pageIndex,r.pageIndex);if(0!==o)return o;const i=wf(n.top,r.top);if(0!==i)return i;const a=wf(n.charOffset,r.charOffset);if(0!==a)return a;return xf(e.annotation.created,t.annotation.created)}(e,t);default:return 0}}const Sf=function(e){if(1!==e.length)throw new Error("Memoize input must be a function of one argument");let t,n;return function(r){return r===t||(t=r,n=e(r)),n}}((function(e){const t=e.selection,n={expanded:t.expanded,forcedVisible:t.forcedVisible,selected:t.selected,
|
|
582
582
|
sortCompareFn:(e,n)=>kf(e,n,{sortBy:t.sortKey})};if(!!t.filterQuery||Object.keys(t.filters).length>0){const e=function(e,t={}){const n=e=>{const n=t[e];return"string"==typeof n?[n]:[]},r=n("cfi"),o=n("page"),i=n("quote"),a=n("tag"),s=n("text"),l=n("uri"),c=n("user"),u=[],d=[],h=gf(e,hf);for(const e of h){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"cfi":r.push(n);break;case"quote":i.push(n);break;case"page":o.push(n);break;case"since":{const t=86400,n={sec:1,min:60,hour:3600,day:t,week:7*t,month:30*t,year:365*t},r=e.slice(6).toLowerCase().match(/^(\d+)(sec|min|hour|day|week|month|year)?$/);if(r){const e=parseFloat(r[1]),t=r[2]||"sec";d.push(e*n[t])}}break;case"tag":a.push(n);break;case"text":s.push(n);break;case"uri":l.push(n);break;case"user":c.push(n);break;default:u.push(e)}}return{any:{terms:u,operator:"and",filterReplies:!0},cfi:{terms:r,operator:"or",filterReplies:!1},quote:{terms:i,operator:"and",filterReplies:!1},page:{terms:o,operator:"or",filterReplies:!1},since:{terms:d,
|
|
583
583
|
operator:"and",filterReplies:!0},tag:{terms:a,operator:"and",filterReplies:!0},text:{terms:s,operator:"and",filterReplies:!0},uri:{terms:l,operator:"or",filterReplies:!1},user:{terms:c,operator:"or",filterReplies:!0}}}(t.filterQuery||"",t.filters),r={},o={};for(const[t,n]of Object.entries(e))n.filterReplies?r[t]=n:o[t]=n;n.filterFn=e=>df([e],r).length>0,Object.values(o).some((e=>e.terms.length>0))&&(n.threadFilterFn=e=>!!e.annotation&&df([e.annotation],o).length>0)}const r=Xm(e.annotations,n),o={annotation:0,note:0,orphan:0};return e.showTabs&&(r.children=r.children.filter((e=>{if(e.annotation&&Fr(e.annotation))return!1;const n=e.annotation?bf(e.annotation):"orphan";return o[n]+=1,n===t.selectedTab}))),{tabCounts:o,rootThread:r}}));function Af(){const e=Fi(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a="sidebar"===r,s=ue((()=>{const e={...o,filterQuery:n,filters:i};return{annotations:t,selection:e,showTabs:a}}),[o,n,i,t,a]);return Sf(s)}
|
|
584
|
-
var Tf,Ef,Cf=er((function({loadAnnotationsService:e,onLogin:t}){const n=Fi(),r=n.routeParams().id??"",{rootThread:o}=Af(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(qi,{errorType:"annotation",onLoginRequest:t}),Ve(Fm,{threads:o.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.
|
|
584
|
+
var Tf,Ef,Cf=er((function({loadAnnotationsService:e,onLogin:t}){const n=Fi(),r=n.routeParams().id??"",{rootThread:o}=Af(),i=n.profile().userid,[a,s]=ie(!1);return se((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>e.id&&n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),Ve(y,{children:[a&&Ve(qi,{errorType:"annotation",onLoginRequest:t}),Ve(Fm,{threads:o.children})]})}),["loadAnnotationsService"]);class Mf{constructor(e,t,n=window){const r="N/A";let o=r;e.userid&&(o=e.userid,e.displayName&&(o=`${e.displayName} (${o})`)),this.version="1.1765.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||r,this.fingerprint=t[0]?.metadata?.documentFingerprint??r,this.account=o,this.timestamp=(new Date).toString();const i=t[0]?.segment;if(i){const e=[];if(i.cfi&&e.push(["CFI",i.cfi]),i.pages){const t=`${i.pages.start}-${i.pages.end}`;e.push(["Pages",t])}
|
|
585
585
|
i.url&&e.push(["URL",i.url]),this.segment=e.map((([e,t])=>`${e}: ${t}`)).join(", ")}}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}var Nf=function(){if(Ef)return Tf;Ef=1;var e="complete",t="canceled";function n(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function r(t){var o=t._scrollSettings;if(o){var i=o.maxSynchronousAlignments,a=function(e,t){var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),d=c&&null!=c.left?c.left:.5,h=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=d,g=h;if(e.isWindow(t))s=Math.min(u.width,t.innerWidth),l=Math.min(u.height,t.innerHeight),r=u.left+t.pageXOffset-t.innerWidth*f+s*f,o=u.top+t.pageYOffset-t.innerHeight*g+l*g,r-=p,o-=m,r=e.align.lockX?t.pageXOffset:r,
|
|
586
586
|
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-=p,o-=m,r=Math.max(Math.min(r,t.scrollWidth-t.clientWidth),0),o=Math.max(Math.min(o,t.scrollHeight-t.clientHeight),0),r=e.align.lockX?t.scrollLeft:r,o=e.align.lockY?t.scrollTop:o,i=r-t.scrollLeft,a=o-t.scrollTop}return{x:r,y:o,differenceX:i,differenceY:a}}(o,t),s=Date.now()-o.startTime,l=Math.min(1/o.time*s,1);if(o.endIterations>=i)return n(t,a.x,a.y),t._scrollSettings=null,o.end(e);var c=1-o.ease(l);if(n(t,a.x-a.differenceX*c,a.y-a.differenceY*c),s>=o.time)return o.endIterations++,o.scrollAncestor&&r(o.scrollAncestor),void r(t);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(r.bind(null,t))}}function o(e){return e.self===e}function i(e){
|
|
587
587
|
return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function a(){return!0}function s(e){if(e.assignedSlot)return s(e.assignedSlot);if(e.parentElement)return"body"===e.parentElement.tagName.toLowerCase()?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}return Tf=function(n,l,c){if(n){"function"==typeof l&&(c=l,l=null),l||(l={}),l.time=isNaN(l.time)?1e3:l.time,l.ease=l.ease||function(e){return 1-Math.pow(1-e,e/2)},l.align=l.align||{};var u=s(n),d=1,h=l.validTarget||a,p=l.isScrollable;l.debug&&(console.log("About to scroll to",n),u||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var m=[];u;)if(l.debug&&console.log("Scrolling parent node",u),h(u,d)&&(p?p(u,i):i(u))&&(d++,m.push(u)),!(u=s(u))){f(e);break}return m.reduce(((e,i,a)=>function(e,n,i,a,s){
|
|
@@ -679,7 +679,7 @@ client_version:r.version,annotations:e.map(Yb)}}buildTextExportContent(e,{groupN
|
|
|
679
679
|
${u.join("\n\n")}`}buildCSVExportContent(e,{groupName:t="",defaultAuthority:n="",displayNamesEnabled:r=!1,separator:o=","}={}){const{uri:i,extractUsername:a}=this._exportCommon(e,{displayNamesEnabled:r,defaultAuthority:n}),s=e=>[Xb(new Date(e.created)),a(e),Jr(e)??"",i,t,Gr(e,this._settings),Yr(e)??Xr(e)??"",e.text,e.tags.join(",")].map((e=>function(e,t){return new RegExp(`["\n\r${t}]`).test(e)?`"${e.replace(/"/g,'""')}"`:e}(e,o))).join(o);return`${["Created at","Author","Page","URL","Group","Type","Quote/description","Comment","Tags"].join(o)}\n${e.map((e=>s(e))).join("\n")}`}buildHTMLExportContent(e,{groupName:t="",displayNamesEnabled:n=!1,defaultAuthority:r="",now:o=new Date}={}){const{uri:i,title:a,uniqueUsers:s,replies:l,extractUsername:c}=this._exportCommon(e,{displayNamesEnabled:n,defaultAuthority:r});return function(e,t,n){var r=Object.assign({},Vb,n||{});return r.jsx||(r.attributeHook=null),yb(e,t,r)}(Ve("html",{lang:"en",children:[Ve("head",{children:[Ve("title",{
|
|
680
680
|
children:`Annotations on "${a}"`}),Ve("meta",{charSet:"UTF-8"})]}),Ve("body",{children:[Ve("section",{children:[Ve("h1",{children:"Summary"}),Ve("p",{children:Ve("time",{dateTime:o.toISOString(),children:Xb(o)})}),Ve("p",{children:Ve("strong",{children:a})}),Ve("p",{children:Ve("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:i})}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Group:"}),Ve("td",{children:t})]}),Ve("tr",{children:[Ve("td",{children:"Total users:"}),Ve("td",{children:s.length})]}),Ve("tr",{children:[Ve("td",{children:"Users:"}),Ve("td",{children:s.join(", ")})]}),Ve("tr",{children:[Ve("td",{children:"Total annotations:"}),Ve("td",{children:e.length})]}),Ve("tr",{children:[Ve("td",{children:"Total replies:"}),Ve("td",{children:l.length})]})]})})]}),Ve("hr",{}),Ve("section",{children:[Ve("h1",{children:"Annotations"}),e.map(((e,t)=>{const n=Jr(e),r=Yr(e),o=Xr(e),i=tp(e.text),a=i===`<p>${e.text}</p>`?e.text:i
|
|
681
681
|
;return Ve("article",{children:[Ve("h2",{children:["Annotation ",t+1,":"]}),Ve("table",{children:Ve("tbody",{style:{verticalAlign:"top"},children:[Ve("tr",{children:[Ve("td",{children:"Created at:"}),Ve("td",{children:Ve("time",{dateTime:e.created,children:Xb(new Date(e.created))})})]}),Ve("tr",{children:[Ve("td",{children:"Author:"}),Ve("td",{children:c(e)})]}),n&&Ve("tr",{children:[Ve("td",{children:"Page:"}),Ve("td",{children:n})]}),Ve("tr",{children:[Ve("td",{children:"Type:"}),Ve("td",{children:Gr(e,this._settings)})]}),r&&Ve("tr",{children:[Ve("td",{children:"Quote:"}),Ve("td",{children:Ve("blockquote",{style:{margin:0},children:r})})]}),o&&Ve("tr",{children:[Ve("td",{children:"Description:"}),Ve("td",{children:o})]}),Ve("tr",{children:[Ve("td",{children:"Comment:"}),Ve("td",{dangerouslySetInnerHTML:{__html:a}})]}),e.tags.length>0&&Ve("tr",{children:[Ve("td",{children:"Tags:"}),Ve("td",{children:e.tags.join(", ")})]})]})})]},e.id)}))]})]})]}),{},{pretty:!0}).replace(/\t/g," ")}
|
|
682
|
-
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Qi(e,n,t),{uri:i,title:a}=Ji(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Rr(e))),extractUsername:o}}}Zb.$inject=["settings"];class Qb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
682
|
+
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>Qi(e,n,t),{uri:i,title:a}=Ji(r);return{uri:i,title:a,uniqueUsers:[...new Set(e.map((e=>o(e))).filter(Boolean))],replies:e.filter((e=>Rr(e))),extractUsername:o}}}Zb.$inject=["settings"];class Qb{constructor(e,t,n){this._clientId=null;const r=e.routes(),o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){return async(a,s,l)=>{o();try{const[o,i]=await Promise.all([e,n()]),c=function(e,t){let n=e;const r=t.split(".");for(const[e,t]of r.entries()){const o=n[t];if(!o||"url"in o){if(o&&e===r.length-1)return o;break}n=o}return null}(o,t);if(!c)throw new Error(`Missing API route: ${t}`);const u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.1765.0"};i&&(u.Authorization="Bearer "+i);const d=r();d&&(u["X-Client-Id"]=d);const{url:h,unusedParams:p}=ui(c.url,a),m=new URL(h);for(const[e,t]of Object.entries(p)){
|
|
683
683
|
const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await _p(m.toString(),{body:s?JSON.stringify(Yb(s)):null,headers:u,method:c.method,signal:l})}finally{i()}}}(r,e,{getAccessToken:()=>t.getAccessToken(),getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={read:i("annotation.read"),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"),moderate:i("annotation.moderate")},this.group={member:{delete:i("group.member.delete")},members:{read:i("group.members.read")},read:i("group.read")},this.groups={list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")},this.analytics={events:{create:i("analytics.events.create")}}}setClientId(e){this._clientId=e}}
|
|
684
684
|
Qb.$inject=["apiRoutes","auth","store"];var Jb,ey,ty,ny,ry,oy={};function iy(){return ty||(ty=1,e=oy,t=function(){if(ey)return Jb;function e(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return ey=1,Jb=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(e){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),
|
|
685
685
|
this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){n._operationTimeoutCb()}),n._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){
|
|
@@ -803,8 +803,8 @@ this._socket?.isConnected()&&this._socket.send(t)}async _reconnect(){const e=awa
|
|
|
803
803
|
this._reconnectSetUp||(this._reconnectSetUp=!0,Ay(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}OA.$inject=["store","apiRoutes","auth","groups","session","$window"];const zA="hypothesis.user.tags.list",LA="hypothesis.user.tags.map";class PA{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(zA)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Lv(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject(LA)||{};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(LA,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(zA,n)}}PA.$inject=["localStorage"];class RA{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),
|
|
804
804
|
e.visible||this._store.setForcedVisible(e.id,!0)}}RA.$inject=["store"];class DA{#t=new Map;#n=30;#r;constructor(e){this.#r=e}get cacheSize(){return this.#n}set cacheSize(e){this.#n=e,this.#o()}#o(){for(const e of this.#t.keys()){const t=this.#t.get(e);if(t&&URL.revokeObjectURL(t.url),this.#t.delete(e),this.#t.size<=this.cacheSize)break}}async fetch(e,t={}){const n=this.get(e);if(n)return n;const r=await this.#r.requestThumbnail(e,t),o=await async function(e){const t=new OffscreenCanvas(e.width,e.height);t.getContext("2d").drawImage(e,0,0,e.width,e.height);const n=await t.convertToBlob();return URL.createObjectURL(n)}(r),i={url:o,width:r.width,height:r.height};return this.#t.set(e,i),this.#t.size>this.cacheSize&&this.#o(),i}get(e){const t=this.#t.get(e);return t?(this.#t.delete(e),this.#t.set(e,t),t):null}cachedThumbnailTags(){return[...this.#t.keys()]}}DA.$inject=["frameSync"];class jA extends Bf{constructor(e,t){super(),this._store=e,this._window=t,this._delayedMessageQueue=[],
|
|
805
805
|
this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_addMessage(e,t,{autoDismiss:n=!0,visuallyHidden:r=!1,delayed:o=!1}={}){if(this._store.hasToastMessage(e,t))return;if(o&&!this._window.document.hasFocus()){const o={autoDismiss:n,visuallyHidden:r};return void this._delayedMessageQueue.push({type:e,messageText:t,options:o})}const i={type:e,id:kv(10),message:t,visuallyHidden:r,autoDismiss:n};this._store.addToastMessage(i),this.emit("toastMessageAdded",i)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}jA.$inject=["store","$window"];const HA=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){
|
|
806
|
-
console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),FA=function(e){const{version:t,origin:n}=Av(e.location.href);return"1.
|
|
807
|
-
}(),n=t?[t]:void 0;vA({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.
|
|
806
|
+
console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),FA=function(e){const{version:t,origin:n}=Av(e.location.href);return"1.1765.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1765.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 $A(e,t){e.setClientId(t.clientId)}function BA(e){e.sync()}function qA(e,t){e.load(),t.load()}function UA(e,t,n){e.init(),t.init(),n.init()}function GA(e,t,n){"sidebar"===t.route()&&e.connect().catch((()=>{n.error("Hypothesis failed to connect to the web page. Try reloading the page.",{autoDismiss:!1})}))}HA.sentry&&FA&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null
|
|
807
|
+
}(),n=t?[t]:void 0;vA({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1765.0",beforeSend:(e,t)=>{if(bA>=5)return Iv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++bA;try{const n=t&&t.originalException;n instanceof Event&&(e.extra||(e.extra={}),Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted}))}catch{}return e}});try{Gx("host_config",Av(window.location.href))}catch{}Gx("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),by(((e,t)=>{yA(e,t)}))}(HA.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),$A.$inject=["api","streamer"],BA.$inject=["router"],qA.$inject=["groups","session"],UA.$inject=["autosaveService","persistedDefaults","serviceURL"],GA.$inject=["frameSync","store","toastMessenger"]
|
|
808
808
|
;const VA=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",$v)}(),async function(e,t=window){const n=function(e){const t=Av(e.location.href),n=["annotations","group","query","appType","openSidebar","showHighlights","services","branding","enableExperimentalNewNoteButton","focus","requestConfigFromFrame","theme","usernameUrl","commentsMode","groupsAllowlist"],r={openSidebar:Tv,requestConfigFromFrame:e=>{if("string"==typeof e)return e;const t=function(e){return"object"==typeof e&&null!==e?e:{}}(e);return{origin:Cv(t.origin),ancestorLevel:Ev(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:Mv(n.ancestorLevel,t),origin:n.origin}}(n,t)
|
|
809
809
|
;let o;if(r){const e=await async function(e,t){return{...await Sv(t.targetFrame,t.origin,"requestConfig",[],3e3),...e.group?{group:e.group}:{}}}(n,r);o=function(e,t){const n=e.services;return Array.isArray(n)?(n.forEach(((e,n)=>{"$rpc:requestGroups"===e.groups&&(e.groups=Sv(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=Kn(e);if(!t)return e.apiUrl;if(t.apiUrl)return t.apiUrl;throw new Error("Service should contain an apiUrl value.")}(i),i}(HA).then((e=>{!function(e,t){const n=new U
|
|
810
810
|
;n.register("analytics",Bv).register("annotationsExporter",Zb).register("annotationsService",Uv).register("annotationActivity",qv).register("api",Qb).register("apiRoutes",cy).register("auth",hy).register("autosaveService",py).register("dashboard",my).register("frameSync",Cy).register("groups",Iy).register("importAnnotationsService",wA).register("loadAnnotationsService",xA).register("localStorage",SA).register("persistedDefaults",TA).register("router",EA).register("serviceURL",CA).register("session",MA).register("streamer",OA).register("streamFilter",NA).register("tags",PA).register("threadsService",RA).register("thumbnailService",DA).register("toastMessenger",jA).register("store",{factory:Hi}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(BA),n.run(UA),n.run($A),n.run(qA),n.run(Fv),n.run(GA),H(Ve(Jn.Provider,{value:n,children:Ve(_v,{})}),t)}(e,VA)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),H(Ve(wv,{error:e}),t)}(e,VA)));
|