hypothesis 1.975.0 → 1.976.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/boot.js +1 -1
- package/build/manifest.json +12 -12
- package/build/scripts/annotator.bundle.js +1 -1
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +7 -7
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/scripts/ui-playground.bundle.js +146 -151
- package/build/scripts/ui-playground.bundle.js.map +1 -1
- package/build/styles/annotator.css +142 -0
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +187 -0
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +800 -1
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +2 -2
|
@@ -99,12 +99,12 @@ no((function(){return e}),t)}function oo(e){var t=jr.context[e.__c],n=Xr(Fr++,9)
|
|
|
99
99
|
;return r&&(a.title=r),po("span",{className:Ur("Hyp-SvgIcon",{"Hyp-SvgIcon--inline":n}),dangerouslySetInnerHTML:{__html:o},ref:i,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/SvgIcon.js",lineNumber:69,columnNumber:5})}function go(e,t){const n="string"==typeof e?Symbol(e):e;return mo.set(n,t),n}var vo="/home/runner/work/frontend-shared/frontend-shared/src/components/buttons.js";function yo({buttonRef:e,classes:t,className:n,icon:r,iconPosition:o="left",size:i="medium",variant:a="normal",expanded:s,pressed:l,type:c="button",...u}){var h;const d=null!==(h=null==u?void 0:u.role)&&void 0!==h?h:"button",p={"aria-label":u.title};return"tab"===d?p["aria-selected"]=l:(p["aria-pressed"]=l,p["aria-expanded"]=s),po("button",{ref:e,className:Ur(n,`${n}--${i}`,`${n}--${a}`,{[`${n}--icon-${o}`]:r},t),type:c,...p,...u},void 0,!1,{fileName:vo,lineNumber:82,columnNumber:5})}function _o({className:e="Hyp-IconButton",...t}){const{icon:n}=t;return po(yo,{className:e,...t,
|
|
100
100
|
children:po(fo,{name:n},void 0,!1,{fileName:vo,lineNumber:109,columnNumber:7})},void 0,!1,{fileName:vo,lineNumber:108,columnNumber:5})}function bo({children:e,className:t="Hyp-LabeledButton",...n}){const{icon:r,iconPosition:o="left"}=n;return po(yo,{className:t,...n,children:[r&&"left"===o&&po(fo,{name:r},void 0,!1,{fileName:vo,lineNumber:127,columnNumber:43}),e,r&&"right"===o&&po(fo,{name:r},void 0,!1,{fileName:vo,lineNumber:129,columnNumber:44})]},void 0,!0,{fileName:vo,lineNumber:126,columnNumber:5})}function wo(e){return po(yo,{className:"Hyp-LinkButton",...e},void 0,!1,{fileName:vo,lineNumber:140,columnNumber:10})}
|
|
101
101
|
go("checkbox",' <svg\n width="32"\n height="32"\n viewBox="-4 -4 39 39"\n aria-hidden="true"\n focusable="false"\n >\n <rect\n class="hyp-svg-checkbox--background"\n width="35"\n height="35"\n x="-2"\n y="-2"\n stroke="currentColor"\n fill="none"\n stroke-width="3"\n rx="5"\n ry="5"\n />\n <polyline\n class="hyp-svg-checkbox--checkmark"\n points="4,14 12,23 28,5"\n stroke="transparent"\n stroke-width="5"\n fill="none"\n />\n</svg>');var xo="/home/runner/work/frontend-shared/frontend-shared/src/components/containers.js";function ko({children:e,classes:t="",containerRef:n}){return po("div",{className:Ur("Hyp-Frame",t),ref:n,children:e},void 0,!1,{fileName:xo,lineNumber:26,columnNumber:5})}function So({children:e,direction:t="row",classes:n="",containerRef:r}){return po("div",{className:Ur(`Hyp-Actions--${t}`,n),ref:r,children:e},void 0,!1,{fileName:xo,lineNumber:72,columnNumber:5})}
|
|
102
|
-
var Co='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l3.536-3.536L8 8 4.464 4.464 8 8zm0 0l-3.536 3.536L8 8l3.536 3.536L8 8z"></path></g></svg>\n',Ao="/home/runner/work/frontend-shared/frontend-shared/src/components/Dialog.js";const Eo=go("cancel",Co);let To=0;function No(e){const[t]=Zr((()=>(++To,`${e}-${To}`)));return t}function Lo({buttons:e,cancelLabel:t="Cancel",children:n,contentClass:r,icon:o,initialFocus:i,onCancel:a,role:s="dialog",title:l,withCancelButton:c=!0,withCloseButton:u=!0}){const h=No("dialog-description"),d=No("dialog-title"),p=to(
|
|
102
|
+
var Co='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l3.536-3.536L8 8 4.464 4.464 8 8zm0 0l-3.536 3.536L8 8l3.536 3.536L8 8z"></path></g></svg>\n',Ao="/home/runner/work/frontend-shared/frontend-shared/src/components/Dialog.js";const Eo=go("cancel",Co);let To=0;function No(e){const[t]=Zr((()=>(++To,`${e}-${To}`)));return t}function Lo({buttons:e,cancelLabel:t="Cancel",children:n,contentClass:r,icon:o,initialFocus:i,onCancel:a,role:s="dialog",title:l,withCancelButton:c=!0,withCloseButton:u=!0}){const h=No("dialog-description"),d=No("dialog-title"),p=to();Qr((()=>{if(null!==i){const e=null==i?void 0:i.current;e&&!e.disabled?e.focus():p.current.focus()}}),[]),eo((()=>{const e=p.current.querySelector("p");e&&(e.id=h,
|
|
103
103
|
p.current.setAttribute("aria-describedby",h))}),[h]);const m=a&&c,f=e||m;return po("div",{"aria-labelledby":d,className:Ur("Hyp-Dialog",{"Hyp-Dialog--closeable":a&&u},r),ref:p,role:s,tabIndex:-1,children:[po("header",{className:"Hyp-Dialog__header",children:[o&&po("div",{className:"Hyp-Dialog__header-icon",children:po(fo,{name:o,title:l,"data-testid":"header-icon"},void 0,!1,{fileName:Ao,lineNumber:139,columnNumber:13})},void 0,!1,{fileName:Ao,lineNumber:138,columnNumber:11}),po("h2",{className:"Hyp-Dialog__title",id:d,children:l},void 0,!1,{fileName:Ao,lineNumber:142,columnNumber:9}),a&&u&&po("div",{className:"Hyp-Dialog__close",children:po(_o,{"data-testid":"close-button",icon:Eo,title:"Close",onClick:a},void 0,!1,{fileName:Ao,lineNumber:147,columnNumber:13})},void 0,!1,{fileName:Ao,lineNumber:146,columnNumber:11})]},void 0,!0,{fileName:Ao,lineNumber:136,columnNumber:7}),n,f&&po("div",{className:"Hyp-Dialog__actions",children:[m&&po(bo,{"data-testid":"cancel-button",onClick:a,children:t},void 0,!1,{
|
|
104
104
|
fileName:Ao,lineNumber:160,columnNumber:13}),e]},void 0,!0,{fileName:Ao,lineNumber:158,columnNumber:9})]},void 0,!0,{fileName:Ao,lineNumber:125,columnNumber:5})}function Mo({name:e,classes:t="",containerClasses:n="",title:r=""}){const o=mo.get(e);if(!o)throw new Error(`Icon "${e.toString()}" is not registered`);const i=to();eo((()=>{const e=i.current.querySelector("svg");e&&e.setAttribute("class",Ur("Hyp-Icon",t))}),[t,o]);const a={};return r&&(a.title=r),po("span",{className:n,dangerouslySetInnerHTML:{__html:o},ref:i,...a},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Icon.js",lineNumber:60,columnNumber:5})}function zo({children:e,classes:t="",linkRef:n,...r}){return po("a",{className:Ur("Hyp-Link",t),ref:n,rel:"noopener noreferrer",...r,children:e},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Link.js",lineNumber:24,columnNumber:5})}function Oo(e){const t={Left:"ArrowLeft",Up:"ArrowUp",Down:"ArrowDown",Right:"ArrowRight",
|
|
105
|
-
Spacebar:" ",Del:"Delete"};return t[e]?t[e]:e}function Io(e,t,n,{useCapture:r=!1}={}){return t.forEach((t=>e.addEventListener(t,n,r))),()=>{t.forEach((t=>e.removeEventListener(t,n,r)))}}function Ro(e,t,n){Qr((()=>{if(!t)return()=>{};const r=Io(document.body,["keydown"],(e=>{"Escape"===Oo(e.key)&&n()})),o=Io(document.body,["focus"],(t=>{e.current.contains(t.target)
|
|
106
|
-
function Bo({message:e,confirmAction:t,onConfirm:n,onCancel:r,...o}){return po(Do,{onCancel:r,buttons:[po(bo,{onClick:n,variant:"primary","data-testid":"confirm-button",children:t},"ok",!1,{fileName:Po,lineNumber:
|
|
107
|
-
children:po(_o,{icon:jo,title:"Close",onClick:n},void 0,!1,{fileName:Fo,lineNumber:43,columnNumber:13})},void 0,!1,{fileName:Fo,lineNumber:42,columnNumber:11})]},void 0,!0,{fileName:Fo,lineNumber:34,columnNumber:7}),po("div",{className:"Hyp-Panel__content",children:e},void 0,!1,{fileName:Fo,lineNumber:47,columnNumber:7})]},void 0,!0,{fileName:Fo,lineNumber:29,columnNumber:5})}
|
|
105
|
+
Spacebar:" ",Del:"Delete"};return t[e]?t[e]:e}function Io(e,t,n,{useCapture:r=!1}={}){return t.forEach((t=>e.addEventListener(t,n,r))),()=>{t.forEach((t=>e.removeEventListener(t,n,r)))}}function Ro(e,t,n){Qr((()=>{if(!t)return()=>{};const r=Io(document.body,["keydown"],(e=>{"Escape"===Oo(e.key)&&n()})),o=Io(document.body,["focus"],(t=>{e.current&&!e.current.contains(t.target)&&n()}),{useCapture:!0}),i=Io(document.body,["mousedown","click"],(t=>{e.current&&!e.current.contains(t.target)&&n()}),{useCapture:!0});return()=>{r(),i(),o()}}),[e,t,n])}var Po="/home/runner/work/frontend-shared/frontend-shared/src/components/Modal.js";function Do({children:e,onCancel:t,...n}){const r=to();return Ro(r,!0,(()=>{t&&t()})),po(m,{children:[po("div",{className:"Hyp-Modal__overlay"},void 0,!1,{fileName:Po,lineNumber:39,columnNumber:7}),po("div",{className:"Hyp-Modal",ref:r,children:po(Lo,{onCancel:t,...n,children:e},void 0,!1,{fileName:Po,lineNumber:41,columnNumber:9})},void 0,!1,{fileName:Po,lineNumber:40,columnNumber:7})]
|
|
106
|
+
},void 0,!0)}function Bo({message:e,confirmAction:t,onConfirm:n,onCancel:r,...o}){return po(Do,{onCancel:r,buttons:[po(bo,{onClick:n,variant:"primary","data-testid":"confirm-button",children:t},"ok",!1,{fileName:Po,lineNumber:76,columnNumber:9})],...o,children:po("p",{children:e},void 0,!1,{fileName:Po,lineNumber:87,columnNumber:7})},void 0,!1,{fileName:Po,lineNumber:73,columnNumber:5})}var Fo="/home/runner/work/frontend-shared/frontend-shared/src/components/Panel.js";const jo=go("cancel",Co);function Ho({children:e,icon:t,onClose:n,title:r}){const o=!!n;return po("div",{className:Ur("Hyp-Panel",{"Hyp-Panel--closeable":o}),children:[po("header",{className:"Hyp-Panel__header",children:[t&&po("div",{className:"Hyp-Panel__header-icon",children:po(fo,{name:t,title:r},void 0,!1,{fileName:Fo,lineNumber:37,columnNumber:13})},void 0,!1,{fileName:Fo,lineNumber:36,columnNumber:11}),po("h2",{className:"Hyp-Panel__title",children:r},void 0,!1,{fileName:Fo,lineNumber:40,columnNumber:9}),o&&po("div",{
|
|
107
|
+
className:"Hyp-Panel__close",children:po(_o,{icon:jo,title:"Close",onClick:n},void 0,!1,{fileName:Fo,lineNumber:43,columnNumber:13})},void 0,!1,{fileName:Fo,lineNumber:42,columnNumber:11})]},void 0,!0,{fileName:Fo,lineNumber:34,columnNumber:7}),po("div",{className:"Hyp-Panel__content",children:e},void 0,!1,{fileName:Fo,lineNumber:47,columnNumber:7})]},void 0,!0,{fileName:Fo,lineNumber:29,columnNumber:5})}
|
|
108
108
|
const Uo=go("spinner",'<svg viewBox="0 0 64 64">\n <g stroke-width="6" stroke="currentColor" stroke-linecap="round">\n <line y1="16" y2="28" transform="translate(32,32) rotate(180)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(225)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".15;0;1;.8;.65;.45;.3;.15" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(270)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".3;.15;0;1;.8;.65;.45;.3" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(315)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".45;.3;.15;0;1;.85;.65;.45" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(0)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".65;.45;.3;.15;0;1;.8;.65;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(45)">\n <animate attributeName="stroke-opacity" dur="750ms" values=".8;.65;.45;.3;.15;0;1;.8" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(90)">\n <animate attributeName="stroke-opacity" dur="750ms" values="1;.85;.6;.45;.3;.15;0;1;" repeatCount="indefinite"></animate>\n </line>\n <line y1="16" y2="28" transform="translate(32,32) rotate(135)">\n <animate attributeName="stroke-opacity" dur="750ms" values="0;1;.8;.65;.45;.3;.15;0" repeatCount="indefinite"></animate>\n </line>\n </g>\n</svg>')
|
|
109
109
|
;function qo({classes:e="",size:t="medium"}){return po(Mo,{name:Uo,containerClasses:Ur(`Hyp-Spinner--${t}`,e)},void 0,!1,{fileName:"/home/runner/work/frontend-shared/frontend-shared/src/components/Spinner.js",lineNumber:32,columnNumber:5})}var $o="/home/runner/work/frontend-shared/frontend-shared/src/components/TextInput.js";function Go({classes:e="",inputRef:t,hasError:n=!1,type:r="text",...o}){return po("input",{className:Ur("Hyp-TextInput",{"has-error":n},e),...o,ref:t,type:r},void 0,!1,{fileName:$o,lineNumber:39,columnNumber:5})}function Vo({children:e,classes:t=""}){return po("div",{className:Ur("Hyp-TextInputWithButton",t),children:e},void 0,!1,{fileName:$o,lineNumber:67,columnNumber:5})}
|
|
110
110
|
var Wo='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><g fill-rule="evenodd"><rect fill="none" stroke="none" x="0" y="0" width="16" height="16"></rect><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4l4 4-4 4"></path></g></svg>',Yo='<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg width="24px" height="28px" viewBox="0 0 24 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <rect fill="#ffffff" stroke="none" width="17.14407" height="16.046612" x="3.8855932" y="3.9449153" />\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M0,2.00494659 C0,0.897645164 0.897026226,0 2.00494659,0 L21.9950534,0 C23.1023548,0 24,0.897026226 24,2.00494659 L24,21.9950534 C24,23.1023548 23.1029738,24 21.9950534,24 L2.00494659,24 C0.897645164,24 0,23.1029738 0,21.9950534 L0,2.00494659 Z M9,24 L12,28 L15,24 L9,24 Z M7.00811294,4 L4,4 L4,20 L7.00811294,20 L7.00811294,15.0028975 C7.00811294,12.004636 8.16824717,12.0097227 9,12 C10,12.0072451 11.0189302,12.0606714 11.0189302,14.003477 L11.0189302,20 L14.0270431,20 L14.0270431,13.1087862 C14.0270433,10 12,9.00309038 10,9.00309064 C8.01081726,9.00309091 8,9.00309086 7.00811294,11.0019317 L7.00811294,4 Z M19,19.9869002 C20.1045695,19.9869002 21,19.0944022 21,17.9934501 C21,16.892498 20.1045695,16 19,16 C17.8954305,16 17,16.892498 17,17.9934501 C17,19.0944022 17.8954305,19.9869002 19,19.9869002 Z" fill="currentColor"></path>\n </g>\n</svg>\n'
|
|
@@ -556,7 +556,7 @@ t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Lp(t),i
|
|
|
556
556
|
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:Ur("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var Fp=ri((function({annotationsService:e,isLoading:t,settings:n}){const r=ii(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return po("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[po(Bp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),po(Bp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
|
|
557
557
|
children:"Page Notes"}),s>0&&po(Bp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",po("br",{}),"Create one by selecting some text and clicking the"," ",po(Mo,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var jp=ri((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
558
558
|
const i=Ki(),a=ii(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?ji(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=to(s);Qr((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Qr((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return Qr((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),po("div",{children:[po("h2",{className:"sr-only",children:"Annotations"}),w&&po(Ep,{}),po(Dp,{onLogin:t,onSignUp:n}),y&&po(wp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&po(wp,{
|
|
559
|
-
errorType:"group",onLoginRequest:t}),x&&po(Fp,{isLoading:c}),po(bp,{threads:i.children}),k&&po(Tp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Hp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(bp,{threads:Ki().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.
|
|
559
|
+
errorType:"group",onLoginRequest:t}),x&&po(Fp,{isLoading:c}),po(bp,{threads:i.children}),k&&po(Tp,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Hp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(bp,{threads:Ki().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.976.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
560
560
|
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function qp(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function $p({commandName:e,iconName:t}){return po("span",{className:"whitespace-nowrap",children:[po(Mo,{name:t,classes:Ur("mx-1 -mt-1","text-color-text-light inline")}),po("em",{children:e})]})}var Gp=ri((function({settings:e}){const t=!qp(e);return po("ol",{className:"list-decimal pl-10 space-y-2",children:[po("li",{children:["To create an annotation, select text and then select the"," ",po($p,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),po("li",{
|
|
561
561
|
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po($p,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&po("li",{children:["To annotate in a private group, select the group from the groups dropdown. Don't see your group? Ask the group creator to send a"," ",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),po("li",{children:["To reply to an annotation, select the"," ",po($p,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var Vp=ri((function({toastMessenger:e,versionData:t}){return po("div",{className:"hyp-u-vertical-spacing",children:[po("dl",{className:"VersionInfo",children:[po("dt",{className:"VersionInfo__key",children:"Version"}),po("dd",{
|
|
562
562
|
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{ba(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Wp({children:e,onClick:t}){return po(wo,{
|
|
@@ -584,7 +584,7 @@ className:Ur("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"Hypo
|
|
|
584
584
|
;function Sm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Cm{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?fa(e.user):ga(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+q(8),l=Object.assign({created:t.toISOString(),group:r,permissions:va(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Ni(l)&&(l.permissions=fa(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Ni(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Ci(n)}),
|
|
585
585
|
Mi(n)?this._store.selectTab("note"):zi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ci(e)?ga(t,e.group):fa(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Si(e)?this._api.annotation.create({},n):this._api.annotation.update({id:e.id},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
|
|
586
586
|
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Cm.$inject=["api","store"];class Am extends Error{constructor(e,t,n=""){let r="Network request failed";t&&(r+=` (${t.status})`),n&&(r+=`: ${n}`),super(r),this.url=e,this.response=t,this.reason=n}}async function Em(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Am(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Am(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Am(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Tm(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function Nm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Lm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
|
|
587
|
-
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
587
|
+
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.976.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Tm(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await Em(m.toString(),{body:s?JSON.stringify(Nm(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={
|
|
588
588
|
list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}Lm.$inject=["apiRoutes","auth","store"];var Mm={};function zm(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Om=zm;zm.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},zm.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},zm.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
|
|
589
589
|
;if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},zm.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)},zm.prototype.try=function(e){
|
|
590
590
|
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},zm.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},zm.prototype.start=zm.prototype.try,zm.prototype.errors=function(){return this._errors},zm.prototype.attempts=function(){return this._attempts},zm.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=Om;e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t))
|
|
@@ -647,7 +647,7 @@ setForcedVisible:function(e,t){return{type:Zg.SET_FORCED_VISIBLE,id:e,visible:t}
|
|
|
647
647
|
panelName:e}},toggleSidebarPanel:function(e,t){return{type:lv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),uv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},hv=Xm(uv);const dv=Mf({messages:[]},{namespace:"toastMessages",reducers:uv,actionCreators:{addToastMessage:function(e){return{type:hv.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:hv.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:hv.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),pv={
|
|
648
648
|
SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},mv=Xm(pv);const fv=Mf({sidebarHasOpened:!1},{namespace:"viewer",reducers:pv,actionCreators:{setSidebarOpened:function(e){return{type:mv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function gv(e){return Lf([Rf,Qf,ng,ig,pg,wg,Ag,Ug,Fg,Vg,Vf,av,Lg,cv,dv,fv],[e],[zf])}gv.$inject=["settings"];class vv{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){
|
|
649
649
|
const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const yv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),_v=function(e){const{version:t,origin:n}=R(e.location.href)
|
|
650
|
-
;return"1.
|
|
650
|
+
;return"1.976.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.976.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 bv(e,t){e.setClientId(t.clientId)}function wv(e,t,n){e.load(),t.load(),n.sync()}function xv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function kv(e,t){"sidebar"===t.route()&&e.connect()}yv.sentry&&_v&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.976.0",beforeSend:(e,t)=>{if(Sr>=5)return K("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Sr;try{
|
|
651
651
|
const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{Yt("host_config",R(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),kr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(yv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),bv.$inject=["api","streamer"],wv.$inject=["groups","session","router"],xv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],kv.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&mo.clear()
|
|
652
652
|
;for(let[t,n]of Object.entries(e))mo.set(t,n)}(Ko);const Sv=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",te)}(),async function(e,t=window){const n=H(window),r=n.requestConfigFromFrame;if(!r)return V(e,n);if("string"==typeof r)return await G(e,t);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(yv).then((e=>{!function(e,t){const n=new vv
|
|
653
653
|
;n.register("annotationsService",Cm).register("api",Lm).register("apiRoutes",Dm).register("auth",jm).register("autosaveService",Hm).register("features",$m).register("frameSync",Km).register("groups",Qm).register("loadAnnotationsService",ef).register("localStorage",nf).register("persistedDefaults",of).register("router",af).register("serviceURL",sf).register("session",lf).register("streamer",hf).register("streamFilter",cf).register("tags",df).register("threadsService",pf).register("toastMessenger",mf).register("store",{factory:gv}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(xv),n.run(bv),n.run(wv),n.run(ee),n.run(kv),I(po(ni.Provider,{value:n,children:po(km,{})}),t)}(e,Sv)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(po(Sm,{error:e}),t)}(e,Sv)));
|