hypothesis 1.1748.0 → 1.1749.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.
|
@@ -92,96 +92,96 @@ classes:Je(l&&{"focus-visible:ring focus-visible:outline-none transition-colors
|
|
|
92
92
|
const r=e<n,o=e>1,i=function(e,t,{boundaryCount:n=1,siblingCount:r=1}={}){if(t<=1)return[];const o=[],i=t-(e=Math.max(1,Math.min(e,t)));let a=null;if((n=Math.max(n,1))+(r=Math.max(r,0))<e-1){for(let e=1;e<=n;e++)o.push(e);a={index:o.length,count:e-r-n,value:e-r-1},o.push(null);for(let t=e-r;t<e;t++)o.push(t)}else for(let t=1;t<e;t++)o.push(t);o.push(e);let s=null;if(n+r<i){for(let t=e+1;t<=e+r;t++)o.push(t);s={index:o.length,count:t-n+1-(e+r),value:e+r+1},o.push(null);for(let e=t-n+1;e<=t;e++)o.push(e)}else for(let n=e+1;n<=t;n++)o.push(n);const l=Math.min(2*n+2*r+3,t);for(;o.length<l&&(null!==(c=s)&&void 0!==c&&c.count||null!==(u=a)&&void 0!==u&&u.count);){var c,u;s&&s.count>0?(o.splice(s.index,0,s.value),++s.index,++s.value,--s.count):a&&(o.splice(a.index+1,0,a.value),--a.value,--a.count)}return o}(e,n),a=(e,n)=>{t(e),n.blur()};return Ve("div",{className:"flex items-center text-md select-none","data-testid":"pagination-navigation",children:[Ve("div",{className:"mr-2",children:Ve(qn,{invisible:!o,
|
|
93
93
|
title:"Go to previous page",onClick:t=>a(e-1,t.target),children:[Ve(ct,{}),"prev"]})}),Ve("ul",{className:Je("hidden","md:flex md:items-center md:justify-center md:gap-x-2","md:grow"),children:i.map(((t,n)=>Ve("li",{children:null===t?Ve("div",{className:"px-3 text-center","data-testid":"pagination-gap",children:"…"}):Ve(qn,{title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),children:t.toString()},`page-${n}`)},n)))}),Ve("div",{className:Je("ml-2 flex justify-end","grow md:grow-0"),children:Ve(qn,{invisible:!r,title:"Go to next page",onClick:t=>a(e+1,t.target),children:["next",Ve(ut,{})]})})]})}function Gn({children:e,classes:t,elementRef:n,icon:r,textContent:o,selected:i=!1,size:a="md",variant:s="text",unstyled:l=!1,...c}){const u=!l,d=u&&"custom"!==a;return Ve(dn,{"data-component":"Tab",...c,classes:Je(d&&"gap-x-1.5",u&&"custom"!==s&&{"px-4 py-2":"tab"===s&&d,"font-semibold text-grey-7 rounded-t-lg border border-transparent border-b-0":"tab"===s,
|
|
94
94
|
"aria-selected:text-color-text aria-selected:bg-white":"tab"===s,"aria-selected:border aria-selected:border-grey-3 aria-selected:border-b-0":"tab"===s,"enabled:hover:text-color-text disabled:text-grey-7/50":"tab"===s,"enabled:hover:text-brand-dark":"text"===s,"aria-selected:font-bold":"text"===s},t),elementRef:n,"aria-selected":i,role:"tab",variant:"custom",size:"custom",unstyled:l,children:[r&&Ve(r,{className:Je("p-[0.125em] w-em h-em")}),Ve("span",{"data-content":o,"data-testid":"sizing-wrapper",className:Je({"before:content-[attr(data-content)] before:font-bold":o,"before:block before:invisible before:h-0 before:overflow-hidden":o}),children:e})]})}function Vn({children:e,classes:t,elementRef:n,vertical:r=!1,...o}){const i=Ie(n);return Se(i,{selector:"button",horizontal:!0,vertical:r}),Ve("div",{"data-component":"TabList",...o,ref:i,className:Je("flex focus-visible:ring focus-visible:outline-none",{"flex-col":r},t),role:"tablist","aria-orientation":r?"vertical":"horizontal",children:e})}
|
|
95
|
-
const Wn=({children:e,direction:t="in",onTransitionEnd:n,delay:r,elementRef:o})=>{const i="in"===t,a=Ie(o),[s,l]=ie(i?"auto":0),[c,u]=ie(i);se((()=>{if(i===(0!==s))return;const e=a.current;i?(e.style.display="",u(!0),l(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),l(0))}),[s,a,i]);const d=de((e=>{e.target===a.current&&"height"===e.propertyName&&(i?l("auto"):u(!1),null==n||n(t))}),[a,i,n,t]);return Ve("div",{ontransitionend:d,ref:a,style:{display:c?"":"none",height:s,overflow:"auto"===s?"visible":"hidden",transition:"height 0.15s ease-in",transitionDelay:r},children:e})};function Kn({services:e}){return Array.isArray(e)&&e[0]?e[0]:null}function Yn(e){const t=Kn(e);return!!t?.authority&&t.authority!==e.authDomain}const
|
|
96
|
-
;return e.forEach((e=>{const t=
|
|
97
|
-
;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(
|
|
98
|
-
return(i=a).forEach((e=>{e()})),e}h({type:
|
|
99
|
-
return function(...n){return t(e.apply(this,n))}}var
|
|
100
|
-
;if("object"!=typeof e||null===e)throw new Error(
|
|
95
|
+
const Wn=({children:e,direction:t="in",onTransitionEnd:n,delay:r,elementRef:o})=>{const i="in"===t,a=Ie(o),[s,l]=ie(i?"auto":0),[c,u]=ie(i);se((()=>{if(i===(0!==s))return;const e=a.current;i?(e.style.display="",u(!0),l(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),l(0))}),[s,a,i]);const d=de((e=>{e.target===a.current&&"height"===e.propertyName&&(i?l("auto"):u(!1),null==n||n(t))}),[a,i,n,t]);return Ve("div",{ontransitionend:d,ref:a,style:{display:c?"":"none",height:s,overflow:"auto"===s?"visible":"hidden",transition:"height 0.15s ease-in",transitionDelay:r},children:e})};function Kn({services:e}){return Array.isArray(e)&&e[0]?e[0]:null}function Yn(e){const t=Kn(e);return!!t?.authority&&t.authority!==e.authDomain}function Xn(e,t){return!0===e.youtubeAssignment&&!0===t.preferences?.show_youtube_gdpr_banner}const Zn={accentColor:"color",appBackgroundColor:"backgroundColor",ctaBackgroundColor:"backgroundColor",ctaTextColor:"color",selectionFontFamily:"fontFamily",
|
|
96
|
+
annotationFontFamily:"fontFamily"};function Qn(e,t){const n={};if(!t.branding)return n;const{branding:r}=t;return e.forEach((e=>{const t=Zn[e],o=r[e];t&&o&&(n[t]=o)})),n}const Jn=F({get(e){throw new Error(`Missing ServiceContext provider to provide "${e}" prop`)}});function er(e,t){function n(n){const r=he(Jn),o={};for(const e of t)e in n||(o[e]=r.get(e));const i={...o,...n};return Ve(e,{...i})}const r=e.displayName||e.name;return n.displayName=`withServices(${r})`,n}function tr(e){return he(Jn).get(e)}function nr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var rr=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),or=()=>Math.random().toString(36).substring(7).split("").join("."),ir={INIT:`@@redux/INIT${or()}`,REPLACE:`@@redux/REPLACE${or()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${or()}`};function ar(e,t,n){if("function"!=typeof e)throw new Error(nr(2))
|
|
97
|
+
;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(nr(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(nr(1));return n(ar)(e,t)}let r=e,o=t,i=new Map,a=i,s=0,l=!1;function c(){a===i&&(a=new Map,i.forEach(((e,t)=>{a.set(t,e)})))}function u(){if(l)throw new Error(nr(3));return o}function d(e){if("function"!=typeof e)throw new Error(nr(4));if(l)throw new Error(nr(5));let t=!0;c();const n=s++;return a.set(n,e),function(){if(t){if(l)throw new Error(nr(6));t=!1,c(),a.delete(n),i=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}(e))throw new Error(nr(7));if(void 0===e.type)throw new Error(nr(8));if("string"!=typeof e.type)throw new Error(nr(17));if(l)throw new Error(nr(9));try{l=!0,o=r(o,e)}finally{l=!1}
|
|
98
|
+
return(i=a).forEach((e=>{e()})),e}h({type:ir.INIT});return{dispatch:h,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(nr(10));r=e,h({type:ir.REPLACE})},[rr]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(nr(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[rr](){return this}}}}}function sr(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}const r=Object.keys(n);let o;try{!function(e){Object.keys(e).forEach((t=>{const n=e[t];if(void 0===n(void 0,{type:ir.INIT}))throw new Error(nr(12));if(void 0===n(void 0,{type:ir.PROBE_UNKNOWN_ACTION()}))throw new Error(nr(13))}))}(n)}catch(e){o=e}return function(e={},t){if(o)throw o;let i=!1;const a={};for(let o=0;o<r.length;o++){const s=r[o],l=n[s],c=e[s],u=l(c,t);if(void 0===u)throw t&&t.type,new Error(nr(14));a[s]=u,i=i||u!==c}return i=i||r.length!==Object.keys(e).length,i?a:e}}function lr(e,t){
|
|
99
|
+
return function(...n){return t(e.apply(this,n))}}var cr,ur=({dispatch:e,getState:t})=>n=>r=>"function"==typeof r?r(e,t,cr):n(r);function dr(e){return(t={},n)=>{const r=e[n.type];if(!r)return t;const o=r(t,n);return{...t,...o}}}function hr(e,t){const n={};for(const[r,o]of Object.entries(e))n[r]=(...e)=>o(t(),...e);return n}function pr(e,t){return Object.assign(e,t)}function mr(e,t=[],n=[]){const r={};for(const n of e)r[n.namespace]=n.initialState(...t);const o={};for(const t of e)o[t.namespace]=dr(t.reducers);const i=function(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error(nr(15))};const a={getState:o.getState,dispatch:(e,...t)=>i(e,...t)},s=e.map((e=>e(a)));return i=function(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...n)=>e(t(...n))))}(...s)(o.dispatch),{...o,dispatch:i}}}(...[ur],...n);const a=ar(sr(o),r,i),s={};for(const t of e)pr(s,t.actionCreators);const l=function(e,t){if("function"==typeof e)return lr(e,t)
|
|
100
|
+
;if("object"!=typeof e||null===e)throw new Error(nr(16));const n={};for(const r in e){const o=e[r];"function"==typeof o&&(n[r]=lr(o,t))}return n}(s,a.dispatch);Object.assign(a,l);const c={};for(const t of e){const{namespace:e,selectors:n,rootSelectors:r}=t;if(pr(c,hr(n,(()=>a.getState()[e]))),r){pr(c,hr(r,a.getState))}}return Object.assign(a,c),a}function fr(e,t,n){if(n&&"type"in n)throw new Error("Payload cannot contain a `type` field");return{type:t,...n}}function gr(e,t){if(!(e instanceof Function)){const t=e;e=()=>t}return{initialState:e,...t}}function vr(e){let t=0;return n=>r=>{if(!window.debug)return void n(r);++t;const o=r.type+" ("+t.toString()+")";console.group(o),console.log("Prev State:",e.getState()),console.log("Action:",r),n(r),console.log("Next State:",e.getState()),console.groupEnd()}}const br={API_REQUEST_STARTED:e=>({...e,activeApiRequests:e.activeApiRequests+1}),API_REQUEST_FINISHED(e){if(0===e.activeApiRequests)throw new Error("API_REQUEST_FINISHED action when no requests were active")
|
|
101
101
|
;return{...e,activeApiRequests:e.activeApiRequests-1}},ANNOTATION_SAVE_STARTED(e,t){const n=[];t.annotation.$tag&&!e.activeAnnotationSaveRequests.includes(t.annotation.$tag)&&n.push(t.annotation.$tag);const r=e.activeAnnotationSaveRequests.concat(n);return{...e,activeAnnotationSaveRequests:r}},ANNOTATION_SAVE_FINISHED(e,t){const n=e.activeAnnotationSaveRequests.filter((e=>e!==t.annotation.$tag));return{...e,activeAnnotationSaveRequests:n}},ANNOTATION_FETCH_STARTED:e=>({...e,activeAnnotationFetches:e.activeAnnotationFetches+1}),ANNOTATION_FETCH_FINISHED(e){if(0===e.activeAnnotationFetches)throw new Error("ANNOTATION_FETCH_FINISHED action when no annotation fetches were active");return{...e,hasFetchedAnnotations:!0,activeAnnotationFetches:e.activeAnnotationFetches-1}},SET_ANNOTATION_RESULT_COUNT:(e,t)=>({annotationResultCount:t.resultCount}),BEGIN_IMPORT:(e,t)=>({importsPending:e.importsPending+t.count,importsTotal:e.importsTotal+t.count}),COMPLETE_IMPORT(e,t){if(!e.importsPending)return e
|
|
102
|
-
;const n=Math.max(e.importsPending-t.count,0);return{importsPending:n,importsTotal:n>0?e.importsTotal:0}}};const
|
|
103
|
-
return
|
|
104
|
-
}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}var
|
|
105
|
-
function
|
|
106
|
-
var Mr
|
|
107
|
-
return!(!("$highlight"in e)||!e.$highlight)||!
|
|
108
|
-
;return n?n.exact:null}function
|
|
109
|
-
;const
|
|
110
|
-
;for(const i of t.annotations){let l;i.id&&(l=
|
|
111
|
-
const e=t.isFlagged?1:-1;n.moderation={...n.moderation,flagCount:n.moderation.flagCount+e}}return n}return e}))})};function
|
|
112
|
-
;const r=
|
|
113
|
-
const e=n().annotations.annotations,r=i.map((t=>t?
|
|
114
|
-
return!0===e.hovered[t]},isWaitingToAnchorAnnotations:
|
|
115
|
-
;const
|
|
116
|
-
constructor(e,t){this.annotation={id:e.id,$tag:e.$tag},this.isPrivate=t.isPrivate,this.tags=t.tags,this.text=t.text,this.description=t.description}match(e){return this.annotation.$tag&&e.$tag===this.annotation.$tag||this.annotation.id&&e.id===this.annotation.id}isEmpty(){return!this.text&&0===this.tags.length&&!this.description}}const
|
|
117
|
-
draft:new
|
|
118
|
-
SET_FILTER_QUERY:(e,t)=>({query:t.query}),SET_FOCUS_MODE(e,t){let n=new Set(e.focusActive);if(void 0!==t.key){t.active??!n.has(t.key)?n.add(t.key):n.delete(t.key)}else{n=t.active??0===n.size?new Set(Object.keys(e.focusFilters)):new Set}return{focusActive:n}}};const
|
|
119
|
-
setFilter:function(e,t){return(n,r)=>{r().filters.focusFilters?.[e]&&n(
|
|
120
|
-
;var u=e[c],d=t[c];if(!1===(o=n?n.call(r,u,d,c):void 0)||void 0===o&&u!==d)return!1}return!0}));const
|
|
121
|
-
get:n=>t&&e(t.key,n)?t.value:
|
|
122
|
-
identityFunctionCheck:"never"}});const
|
|
123
|
-
;if(!n)return console.error(`Attempted to focus group ${t.id} which is not loaded`),{};return e.focusedGroupId===t.id?{focusedGroupId:t.id}:{focusedGroupId:t.id,focusedGroupMembers:{status:"not-loaded"}}},LOAD_GROUPS(e,t){const n=t.groups;let r=e.focusedGroupId;return null!==e.focusedGroupId&&n.find((t=>t.id===e.focusedGroupId))||(r=n.length>0?n[0].id:null),{focusedGroupId:r,groups:t.groups}},LOAD_FOCUSED_GROUP_MEMBERS(e,t){if(!e.focusedGroupId)throw new Error("A group needs to be focused before loading its members");const{focusedGroupMembers:n}=t;return{focusedGroupMembers:n}},CLEAR_GROUPS:()=>({filteredGroupIds:null,focusedGroupId:null,groups:[],focusedGroupMembers:{status:"not-loaded"}})};function
|
|
124
|
-
const
|
|
125
|
-
return
|
|
126
|
-
;if(a.length>0)throw new Error(`Unused parameters: ${a.join(", ")}`);return o}}}),
|
|
127
|
-
const r=o(e),i=n.find((e=>e.id===t));return i?r&&!o(i.mentions):r})).length})),
|
|
128
|
-
return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:
|
|
129
|
-
const n=t.annotations.filter((e=>!
|
|
130
|
-
expanded:
|
|
131
|
-
setSortKey:function(e){return
|
|
132
|
-
return
|
|
133
|
-
;class
|
|
134
|
-
title:"group"===e?"Group unavailable":r?"Comment unavailable":"Annotation unavailable",children:[Ve("p",{children:i?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":`The current URL links to ${r?"a comment":"an annotation"},\n but that ${r?"comment":"annotation"} cannot be found, or you\n do not have permission to view it.`:`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),Ve("div",{className:"flex justify-end space-x-2",children:[n&&Ve(dn,{variant:i?"primary":void 0,onClick:()=>o.clearSelection(),children:["Show all ",r?"comments":"annotations"]}),!i&&Ve(dn,{variant:"primary",onClick:t,children:"Log in"})]})]})})}),["settings"]);var
|
|
135
|
-
;var e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof We&&We&&We.Object===Object&&We,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&u.call(e)==t}(s))return e;if(m(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=m(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(n,"");var c=o.test(s);return c||i.test(s)?a(s.slice(2),c?2:8):r.test(s)?e:+s}return
|
|
136
|
-
function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return g?h(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(g)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=f(t)||0,m(n)&&(u=!!n.leading,i=(g="maxWait"in n)?d(f(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x}
|
|
137
|
-
const t=e.filter((e=>!!e.annotation)).map((e=>e.annotation));if(t.length)return t;const n=[];if(e.forEach((e=>{e.children&&n.push(...e.children)})),n.length)return
|
|
138
|
-
titleLink:
|
|
139
|
-
}),[t]);return se((function(){return r}),[r]),de((function(t,o){r(),n.current=e((function(){t(),n.current=null}),o)}),[r,e])}var
|
|
140
|
-
s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,m){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,m),s=u,l=m;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(h.n=-1),p(s,l)):h.n=l:h.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=h.n<0)?l:n.call(r,h))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(
|
|
141
|
-
|
|
142
|
-
0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return
|
|
143
|
-
;return t?null!==(n=null!==(r=null===(o=e.links)||void 0===o?void 0:o.incontext)&&void 0!==r?r:null===(i=e.links)||void 0===i?void 0:i.html)&&void 0!==n?n:null:null!==(a=null===(s=e.links)||void 0===s?void 0:s.html)&&void 0!==a?a:null}(t,a),l=n?"comment":"annotation",c=ce(null),u=ce(null),d=
|
|
102
|
+
;const n=Math.max(e.importsPending-t.count,0);return{importsPending:n,importsTotal:n>0?e.importsTotal:0}}};const yr=gr({activeAnnotationSaveRequests:[],activeApiRequests:0,activeAnnotationFetches:0,hasFetchedAnnotations:!1,annotationResultCount:null,importsPending:0,importsTotal:0},{reducers:br,namespace:"activity",actionCreators:{annotationFetchStarted:function(){return fr(0,"ANNOTATION_FETCH_STARTED",void 0)},annotationFetchFinished:function(){return fr(0,"ANNOTATION_FETCH_FINISHED",void 0)},annotationSaveStarted:function(e){return fr(0,"ANNOTATION_SAVE_STARTED",{annotation:e})},annotationSaveFinished:function(e){return fr(0,"ANNOTATION_SAVE_FINISHED",{annotation:e})},apiRequestStarted:function(){return fr(0,"API_REQUEST_STARTED",void 0)},apiRequestFinished:function(){return fr(0,"API_REQUEST_FINISHED",void 0)},beginImport:function(e){return fr(0,"BEGIN_IMPORT",{count:e})},completeImport:function(e){return fr(0,"COMPLETE_IMPORT",{count:e})},setAnnotationResultCount:function(e){
|
|
103
|
+
return fr(0,"SET_ANNOTATION_RESULT_COUNT",{resultCount:e})}},selectors:{hasFetchedAnnotations:function(e){return e.hasFetchedAnnotations},importsPending:function(e){return e.importsPending},importsTotal:function(e){return e.importsTotal},isLoading:function(e){return e.activeApiRequests>0||!e.hasFetchedAnnotations},isFetchingAnnotations:function(e){return e.activeAnnotationFetches>0},isSavingAnnotation:function(e,t){return!!t.$tag&&e.activeAnnotationSaveRequests.includes(t.$tag)},annotationResultCount:function(e){return e.annotationResultCount}}});var _r=Symbol("NOT_FOUND");var wr=e=>Array.isArray(e)?e:[e];function xr(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every((e=>"function"==typeof e))){const n=e.map((e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e)).join(", ");throw new TypeError(`${t}[${n}]`)}
|
|
104
|
+
}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}var kr=(e,t)=>e===t;var Sr="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}},Ar=0,Tr=1;function Er(){return{s:Ar,v:void 0,o:null,p:null}}function Cr(e,t={}){let n=Er();const{resultEqualityCheck:r}=t;let o,i=0;function a(){let t=n;const{length:a}=arguments;for(let e=0,n=a;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=Er(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=Er(),e.set(n,t)):t=r}}const s=t;let l;if(t.s===Tr)l=t.v;else if(l=e.apply(null,arguments),i++,r){const e=o?.deref?.()??o;null!=e&&r(e,l)&&(l=e,0!==i&&i--);o="object"==typeof l&&null!==l||"function"==typeof l?new Sr(l):l}return s.s=Tr,s.v=l,l}return a.clearCache=()=>{n=Er(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}
|
|
105
|
+
function Mr(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},a=e.pop();"object"==typeof a&&(i=a,a=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const s={...n,...i},{memoize:l,memoizeOptions:c=[],argsMemoize:u=Cr,argsMemoizeOptions:d=[]}=s,h=wr(c),p=wr(d),m=xr(e),f=l((function(){return r++,a.apply(null,arguments)}),...h),g=u((function(){o++;const e=function(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return t=f.apply(null,e),t}),...p);return Object.assign(g,{resultFunc:a,memoizedResultFunc:f,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}
|
|
106
|
+
var Nr=Mr(Cr),Ir=Object.assign(((e,t=Nr)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map((t=>e[t])),((...e)=>e.reduce(((e,t,r)=>(e[n[r]]=t,e)),{})))}),{withTypes:()=>Ir});function Or(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function zr(e){if(!e)return null;const t=e.match(/^acct:([^@]+)@(.+)/);return t?{username:t[1],provider:t[2]}:null}function Lr(e){const t=zr(e);return t?t.username:""}function Pr(e,t){const n=zr(e);return!!n&&n.provider!==t}function Rr(e){return(e.references||[]).length>0}function Dr(e){return!!e.id}function jr(e){return!e.id}function Hr(e){return!!(e.target&&e.target.length>0&&e.target[0].selector)}function Fr(e){return Hr(e)&&void 0===e.$orphan&&!e.$anchorTimeout}function $r(e){
|
|
107
|
+
return!(!("$highlight"in e)||!e.$highlight)||!jr(e)&&!(qr(e)||Rr(e)||e.hidden||e.text||e.tags&&e.tags.length)}function Br(e){return Hr(e)&&!0===e.$orphan}function qr(e){return!Hr(e)&&!Rr(e)}function Ur(e){return!(!Hr(e)||Br(e))}function Gr(e,{commentsMode:t}){return Rr(e)?"Reply":$r(e)?"Highlight":qr(e)?t?"Comment":"Page note":"Annotation"}function Vr(e){const t=e.target[0];if(!t?.selector)return{};let n,r,o,i;for(const e of t.selector)switch(e.type){case"TextPositionSelector":r=e.start;break;case"EPUBContentSelector":n=e.cfi;break;case"PageSelector":o=e.index;break;case"ShapeSelector":i=Wr(e)}return{cfi:n,charOffset:r,pageIndex:o,top:i}}function Wr(e){const t=e.view?.top??0;switch(e.shape.type){case"rect":return Math.abs(t-e.shape.top);case"point":return Math.abs(t-e.shape.y);default:return}}function Kr(e){return e.moderation?.flagCount??null}function Yr(e){if(0===e.target.length)return null;const t=e.target[0];if(!t.selector)return null;const n=t.selector.find((e=>"TextQuoteSelector"===e.type))
|
|
108
|
+
;return n?n.exact:null}function Xr(e){return e.target[0]?.description}function Zr(e){const t=e.target[0]?.selector?.find((e=>"ShapeSelector"===e.type));return t??null}function Qr(e){const t=e.target[0]?.selector?.find((e=>"EPUBContentSelector"===e.type));return t?.cfi}function Jr(e){const t=e.target[0]?.selector?.find((e=>"PageSelector"===e.type));return t?.label}function eo(e,t){return e.reduce(((e,n)=>t(n)?e+1:e),0)}function to(e){const t={};return e.forEach((e=>t[e]=!0)),t}function no(e){return Object.keys(e).filter((t=>!0===e[t]))}function ro(e){return Object.entries(e)}const oo={CHANGE_ROUTE:(e,{name:t,params:n})=>({name:t,params:n})};const io=gr({name:null,params:{}},{namespace:"route",reducers:oo,actionCreators:{changeRoute:function(e,t={}){return fr(0,"CHANGE_ROUTE",{name:e,params:t})}},selectors:{route:function(e){return e.name},routeParams:function(e){return e.params}}}),ao={features:{},preferences:{},userid:null};const so={UPDATE_PROFILE:(e,t)=>({profile:{...t.profile}})}
|
|
109
|
+
;const lo=Nr((e=>e.profile),(e=>e.features),((e,t)=>{const n={...e.features};for(const e of t)n[e]=!0;return n}));const co=gr((function(e){return{defaultAuthority:e?.authDomain??"",features:e.features??[],profile:ao}}),{namespace:"session",reducers:so,actionCreators:{updateProfile:function(e){return fr(0,"UPDATE_PROFILE",{profile:e})}},selectors:{defaultAuthority:function(e){return e.defaultAuthority},features:lo,hasFetchedProfile:function(e){return e.profile!==ao},isFeatureEnabled:function(e,t){return Boolean(lo(e)[t])},isLoggedIn:function(e){return null!==e.profile.userid},profile:function(e){return e.profile}}});function uo(e,t){return e.find((e=>e.id===t))}function ho(e,t){return e.find((e=>e.$tag===t))}function po(e,t,n){let r=e.$orphan;e.id||(r=!1);let o="other-content";return e.user===n&&(o=$r(e)?"user-highlights":"user-annotations"),Object.assign({},e,{$anchorTimeout:!1,$cluster:o,$tag:e.$tag||t,$orphan:r})}const mo={ADD_ANNOTATIONS(e,t){const n=new Set,r=new Set,o=[],i=[],a=[];let s=e.nextTag
|
|
110
|
+
;for(const i of t.annotations){let l;i.id&&(l=uo(e.annotations,i.id)),!l&&i.$tag&&(l=ho(e.annotations,i.$tag)),l?(a.push(Object.assign({},l,i)),i.id&&n.add(i.id),l.$tag&&r.add(l.$tag)):(o.push(po(i,"t"+s,t.currentUserId)),++s)}for(const t of e.annotations)n.has(t.id)||r.has(t.$tag)||i.push(t);return{annotations:o.concat(a).concat(i),nextTag:s}},CLEAR_ANNOTATIONS:()=>({annotations:[],highlighted:{},hovered:{}}),HOVER_ANNOTATIONS:(e,t)=>({hovered:to(t.tags)}),HIGHLIGHT_ANNOTATIONS:(e,t)=>({highlighted:t.highlighted}),REMOVE_ANNOTATIONS:(e,t)=>({annotations:[...t.remainingAnnotations]}),UPDATE_ANCHOR_STATUS:(e,t)=>({annotations:e.annotations.map((e=>{if(!Or(t.statusUpdates,e.$tag))return e;const n=t.statusUpdates[e.$tag];return"timeout"===n?Object.assign({},e,{$anchorTimeout:!0}):Object.assign({},e,{$orphan:"orphan"===n})}))}),UPDATE_FLAG_STATUS:(e,t)=>({annotations:e.annotations.map((e=>{if(e.id&&e.id===t.id){if(e.flagged===t.isFlagged)return e;const n=Object.assign({},e,{flagged:t.isFlagged});if(n.moderation){
|
|
111
|
+
const e=t.isFlagged?1:-1;n.moderation={...n.moderation,flagCount:n.moderation.flagCount+e}}return n}return e}))})};function fo(e){return(t,n)=>{const r=function(e,t){const n=new Set,r=new Set;for(const e of t)e.id&&n.add(e.id),e.$tag&&r.add(e.$tag);return e.filter((e=>!(e.id&&n.has(e.id)||e.$tag&&r.has(e.$tag))))}(n().annotations.annotations,e);t(fr(0,"REMOVE_ANNOTATIONS",{annotationsToRemove:e,remainingAnnotations:r}))}}function go(e){return fr(0,"UPDATE_ANCHOR_STATUS",{statusUpdates:e})}const vo=Nr((e=>e.annotations),(e=>eo(e,Ur)));const bo=Nr((e=>e.hovered),(e=>no(e))),yo=Nr((e=>e.highlighted),(e=>no(e)));const _o=Nr((e=>e.annotations),(e=>e.some(Fr))),wo=Nr((e=>e.annotations),(e=>e.filter((e=>jr(e)&&!$r(e))))),xo=Nr((e=>e.annotations),(e=>e.filter((e=>jr(e)&&$r(e))))),ko=Nr((e=>e.annotations),(e=>eo(e,qr))),So=Nr((e=>e.annotations),(e=>eo(e,Br))),Ao=Nr((e=>e.annotations),(e=>e.filter((e=>Dr(e))))),To=Nr((e=>e.annotations),(e=>{const t=new Map;return e.forEach((e=>{const{user:n}=e;if(t.has(n))return
|
|
112
|
+
;const r=Lr(n),o=e.user_info?.display_name??null;t.set(n,{userid:n,username:r,displayName:o})})),[...t.values()].sort(((e,t)=>{const n=e.username,r=t.username;return n.localeCompare(r,void 0,{sensitivity:"base"})}))})),Eo=Nr((e=>e.annotations),(e=>{const t=e.flatMap((e=>e.mentions??[])),n=new Set;return t.filter((({userid:e})=>{const t=n.has(e);return n.add(e),!t})).map((({display_name:e,...t})=>({displayName:e,...t})))})),Co=gr({annotations:[],highlighted:{},hovered:{},nextTag:1},{namespace:"annotations",reducers:mo,actionCreators:{addAnnotations:function(e){return function(t,n){const r=e.filter((e=>!e.id||!uo(n().annotations.annotations,e.id))),o=co.selectors.profile(n().session);if(t(fr(0,"ADD_ANNOTATIONS",{annotations:e,currentAnnotationCount:n().annotations.annotations.length,currentUserId:o.userid})),"sidebar"!==io.selectors.route(n().route))return;const i=r.filter(Fr).map((e=>e.id));i.length>0&&setTimeout((()=>{
|
|
113
|
+
const e=n().annotations.annotations,r=i.map((t=>t?uo(e,t):null)).filter((e=>e&&Fr(e))).reduce(((e,t)=>(e[t.$tag]="timeout",e)),{});t(go(r))}),500)}},clearAnnotations:function(){return fr(0,"CLEAR_ANNOTATIONS",void 0)},hoverAnnotations:function(e){return fr(0,"HOVER_ANNOTATIONS",{tags:e})},highlightAnnotations:function(e){return fr(0,"HIGHLIGHT_ANNOTATIONS",{highlighted:to(e)})},removeAnnotations:fo,updateAnchorStatus:go,updateFlagStatus:function(e,t){return fr(0,"UPDATE_FLAG_STATUS",{id:e,isFlagged:t})}},selectors:{allAnnotations:function(e){return e.annotations},annotationCount:vo,annotationExists:function(e,t){return e.annotations.some((e=>e.id===t))},findAnnotationByID:function(e,t){return uo(e.annotations,t)},findIDsForTags:function(e,t){const n=[];for(const r of t){const t=ho(e.annotations,r);t&&t.id&&n.push(t.id)}return n},hoveredAnnotations:bo,highlightedAnnotations:yo,isAnnotationHighlighted:function(e,t){return!!t?.id&&!0===e.highlighted[t.id]},isAnnotationHovered:function(e,t){
|
|
114
|
+
return!0===e.hovered[t]},isWaitingToAnchorAnnotations:_o,newAnnotations:wo,newHighlights:xo,noteCount:ko,orphanCount:So,savedAnnotations:Ao,usersWhoAnnotated:To,usersWhoWereMentioned:Eo}}),Mo={SET_DEFAULT:(e,t)=>({[t.defaultKey]:t.value})};const No=gr({annotationPrivacy:null,focusedGroup:null},{namespace:"defaults",reducers:Mo,actionCreators:{setDefault:function(e,t){return fr(0,"SET_DEFAULT",{defaultKey:e,value:t})}},selectors:{getDefault:function(e,t){return e[t]},getDefaults:function(e){return e}}});const Io={UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED:(e,t)=>({directLinkedGroupFetchFailed:t.directLinkedGroupFetchFailed}),UPDATE_DIRECT_LINKED_GROUP_ID:(e,t)=>({directLinkedGroupId:t.directLinkedGroupId}),UPDATE_DIRECT_LINKED_ANNOTATION_ID:(e,t)=>({directLinkedAnnotationId:t.directLinkedAnnotationId}),CLEAR_DIRECT_LINKED_IDS:()=>({directLinkedAnnotationId:null,directLinkedGroupId:null}),CLEAR_SELECTION:()=>({directLinkedAnnotationId:null,directLinkedGroupId:null,directLinkedGroupFetchFailed:!1})}
|
|
115
|
+
;const Oo=gr((function(e){return{directLinkedGroupId:e.group||null,directLinkedAnnotationId:e.annotations||null,directLinkedGroupFetchFailed:!1}}),{namespace:"directLinked",reducers:Io,actionCreators:{setDirectLinkedGroupFetchFailed:function(){return fr(0,"UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED",{directLinkedGroupFetchFailed:!0})},setDirectLinkedGroupId:function(e){return fr(0,"UPDATE_DIRECT_LINKED_GROUP_ID",{directLinkedGroupId:e})},setDirectLinkedAnnotationId:function(e){return fr(0,"UPDATE_DIRECT_LINKED_ANNOTATION_ID",{directLinkedAnnotationId:e})},clearDirectLinkedGroupFetchFailed:function(){return fr(0,"UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED",{directLinkedGroupFetchFailed:!1})},clearDirectLinkedIds:function(){return fr(0,"CLEAR_DIRECT_LINKED_IDS",void 0)}},selectors:{directLinkedAnnotationId:function(e){return e.directLinkedAnnotationId},directLinkedGroupFetchFailed:function(e){return e.directLinkedGroupFetchFailed},directLinkedGroupId:function(e){return e.directLinkedGroupId}}});class zo{
|
|
116
|
+
constructor(e,t){this.annotation={id:e.id,$tag:e.$tag},this.isPrivate=t.isPrivate,this.tags=t.tags,this.text=t.text,this.description=t.description}match(e){return this.annotation.$tag&&e.$tag===this.annotation.$tag||this.annotation.id&&e.id===this.annotation.id}isEmpty(){return!this.text&&0===this.tags.length&&!this.description}}const Lo={DISCARD_ALL_DRAFTS:()=>({drafts:[]}),REMOVE_DRAFT:(e,t)=>({drafts:e.drafts.filter((e=>!e.match(t.annotation)))}),UPDATE_DRAFT(e,t){const n=e.drafts.filter((e=>!e.match(t.draft.annotation)));return n.push(t.draft),{drafts:n}}};function Po(e){return fr(0,"REMOVE_DRAFT",{annotation:e})}function Ro(e,t){const n=e.drafts;for(let e=0;e<n.length;e++){const r=n[e];if(r.match(t))return r}return null}function Do(e,t){const n=Ro(e,t);return n?n.isEmpty()?null:n:null}const jo=Nr((e=>e.drafts),(e=>e.filter((e=>!e.annotation.id)).map((e=>e.annotation)))),Ho=gr({drafts:[]},{namespace:"drafts",reducers:Lo,actionCreators:{createDraft:function(e,t){return fr(0,"UPDATE_DRAFT",{
|
|
117
|
+
draft:new zo(e,t)})},deleteNewAndEmptyDrafts:function(){return(e,t)=>{const n=t().drafts.drafts.filter((e=>!e.annotation.id&&!Do(t().drafts,e.annotation))).map((t=>(e(Po(t.annotation)),t.annotation)));e(fo(n))}},discardAllDrafts:function(){return fr(0,"DISCARD_ALL_DRAFTS",void 0)},removeDraft:Po},selectors:{countDrafts:function(e){return e.drafts.length},getDraft:Ro,getDraftIfNotEmpty:Do,unsavedAnnotations:jo}});function Fo(e){const t={},n=e.user,r=n?.username||n?.userid||"";return n&&r&&(t.user={value:r,display:n.displayName||r}),e.pages&&(t.page={value:e.pages,display:e.pages}),e.cfi&&(t.cfi={value:e.cfi.range,display:e.cfi.label}),t}const $o={CHANGE_FOCUS_MODE_USER(e,t){const n={...e.focusFilters},{user:r}=Fo({user:t.user}),o=new Set(e.focusActive);return void 0!==r?(o.add("user"),n.user=r):(o.delete("user"),delete n.user),{focusActive:o,focusFilters:n}},SET_FILTER(e,t){const n={...e.filters,[t.filterName]:t.filterOption};return""===t.filterOption?.value&&delete n[t.filterName],{filters:n}},
|
|
118
|
+
SET_FILTER_QUERY:(e,t)=>({query:t.query}),SET_FOCUS_MODE(e,t){let n=new Set(e.focusActive);if(void 0!==t.key){t.active??!n.has(t.key)?n.add(t.key):n.delete(t.key)}else{n=t.active??0===n.size?new Set(Object.keys(e.focusFilters)):new Set}return{focusActive:n}}};const Bo=Nr((e=>e.focusActive),(e=>e.focusFilters),((e,t)=>({active:e.size>0,configured:Object.values(t??{}).some((e=>void 0!==e)),displayName:t?.user?.display??"",contentRange:t?.cfi?.display,pageRange:t?.page?.display}))),qo=Nr((e=>e.filters),(e=>e.focusActive),(e=>e.focusFilters),((e,t,n)=>{const r={};for(const e of t){const t=n[e];t&&(r[e]=t)}return Object.assign(r,e),r}));const Uo=Nr((e=>qo(e)),(e=>{const t={};for(const[n,r]of Object.entries(e))r&&(t[n]=r.value);return t}));const Go=gr((function(e){const t=Fo(e.focus||{});return{filters:{},focusActive:new Set(Object.keys(t)),focusFilters:t,query:e.query||null}}),{namespace:"filters",reducers:$o,actionCreators:{changeFocusModeUser:function(e){return fr(0,"CHANGE_FOCUS_MODE_USER",{user:e})},
|
|
119
|
+
setFilter:function(e,t){return(n,r)=>{r().filters.focusFilters?.[e]&&n(fr(0,"SET_FOCUS_MODE",{active:!1,key:e})),n(fr(0,"SET_FILTER",{filterName:e,filterOption:t}))}},setFilterQuery:function(e){return fr(0,"SET_FILTER_QUERY",{query:e})},toggleFocusMode:function({active:e,key:t}={}){return fr(0,"SET_FOCUS_MODE",{active:e,key:t})}},selectors:{filterQuery:function(e){return e.query},focusState:Bo,getFilter:function(e,t){return qo(e)[t]},getFilters:qo,getFilterValues:Uo,getFocusActive:function(e){return e.focusActive},getFocusFilters:function(e){return e.focusFilters},hasAppliedFilter:function(e){const t=qo(e);return Boolean(e.query||Object.keys(t).length)}}});var Vo,Wo;var Ko=Ke(Wo?Vo:(Wo=1,Vo=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var c=i[l];if(!s(c))return!1
|
|
120
|
+
;var u=e[c],d=t[c];if(!1===(o=n?n.call(r,u,d,c):void 0)||void 0===o&&u!==d)return!1}return!0}));const Yo={CONNECT_FRAME(e,t){const n=e.frames.findIndex((e=>e.id===t.frame.id)),r=[...e.frames];return-1!==n?r[n]=t.frame:r.push(t.frame),{frames:r}},DESTROY_FRAME(e,t){const n=e.frames.filter((e=>e!==t.frame));return{frames:n}},UPDATE_FRAME_ANNOTATION_FETCH_STATUS:(e,t)=>({frames:e.frames.map((e=>e.uri&&e.uri===t.uri?Object.assign({},e,{isAnnotationFetchComplete:t.isAnnotationFetchComplete}):e))}),SET_CONTENT_INFO:(e,t)=>({contentInfo:t.info})};const Xo=e=>e.find((e=>!e.id))||null,Zo=Nr((e=>e.frames),Xo),Qo=Nr((e=>e.frames),(e=>{const t=Xo(e);return t||(e.length>0?e[0]:null)}));const Jo=Mr((function(e,t){const n="object"==typeof t?t:{equalityCheck:t},{equalityCheck:r=kr,maxSize:o=1,resultEqualityCheck:i}=n,a=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;const{length:r}=t;for(let o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(r);let s=0;const l=o<=1?function(e){let t;return{
|
|
121
|
+
get:n=>t&&e(t.key,n)?t.value:_r,put(e,n){t={key:e,value:n}},getEntries:()=>t?[t]:[],clear(){t=void 0}}}(a):function(e,t){let n=[];function r(e){const r=n.findIndex((n=>t(e,n.key)));if(r>-1){const e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return _r}return{get:r,put:function(t,o){r(t)===_r&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(o,a);function c(){let t=l.get(arguments);if(t===_r){if(t=e.apply(null,arguments),s++,i){const e=l.getEntries().find((e=>i(e.value,t)));e&&(t=e.value,0!==s&&s--)}l.put(arguments,t)}return t}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}),Ko),ei=Jo((e=>e.frames.reduce(((e,t)=>e.concat(function(e){let t=[e.uri];return e.metadata&&e.metadata.documentFingerprint&&(t=e.metadata.link.map((e=>e.href))),e.metadata&&e.metadata.link&&e.metadata.link.forEach((e=>{e.href.startsWith("doi:")&&t.push(e.href)})),t}(t))),[])),(e=>e),{devModeChecks:{
|
|
122
|
+
identityFunctionCheck:"never"}});const ti=gr({frames:[],contentInfo:null},{namespace:"frames",reducers:Yo,actionCreators:{connectFrame:function(e){return fr(0,"CONNECT_FRAME",{frame:e})},destroyFrame:function(e){return fr(0,"DESTROY_FRAME",{frame:e})},setContentInfo:function(e){return fr(0,"SET_CONTENT_INFO",{info:e})},updateFrameAnnotationFetchStatus:function(e,t){return fr(0,"UPDATE_FRAME_ANNOTATION_FETCH_STATUS",{uri:e,isAnnotationFetchComplete:t})}},selectors:{getContentInfo:function(e){return e.contentInfo},frames:function(e){return e.frames},mainFrame:Zo,defaultContentFrame:Qo,searchUris:ei}}),ni={FILTER_GROUPS(e,t){if(!t.filteredGroupIds?.length)return{filteredGroupIds:null};const n=e.groups.filter((e=>t.filteredGroupIds.includes(e.id)));if(!n.length)return{filteredGroupIds:null};let r=e.focusedGroupId;return r&&t.filteredGroupIds.includes(r)||(r=n[0].id),{filteredGroupIds:t.filteredGroupIds,focusedGroupId:r}},FOCUS_GROUP(e,t){const n=e.groups.find((e=>e.id===t.id))
|
|
123
|
+
;if(!n)return console.error(`Attempted to focus group ${t.id} which is not loaded`),{};return e.focusedGroupId===t.id?{focusedGroupId:t.id}:{focusedGroupId:t.id,focusedGroupMembers:{status:"not-loaded"}}},LOAD_GROUPS(e,t){const n=t.groups;let r=e.focusedGroupId;return null!==e.focusedGroupId&&n.find((t=>t.id===e.focusedGroupId))||(r=n.length>0?n[0].id:null),{focusedGroupId:r,groups:t.groups}},LOAD_FOCUSED_GROUP_MEMBERS(e,t){if(!e.focusedGroupId)throw new Error("A group needs to be focused before loading its members");const{focusedGroupMembers:n}=t;return{focusedGroupMembers:n}},CLEAR_GROUPS:()=>({filteredGroupIds:null,focusedGroupId:null,groups:[],focusedGroupMembers:{status:"not-loaded"}})};function ri(e){return e.filteredGroupIds?e.groups.filter((t=>e.filteredGroupIds?.includes(t.id))):e.groups}function oi(e,t){return e.groups.find((e=>e.id===t))}
|
|
124
|
+
const ii=Nr((e=>ri(e)),(e=>e.filter((e=>!e.isMember&&e.isScopedToUri)))),ai=Nr((e=>ri(e)),(e=>e.filter((e=>e.isScopedToUri)))),si=Nr((e=>ri(e.groups)),(e=>co.selectors.isLoggedIn(e.session)),((e,t)=>t?e.filter((e=>e.isMember)):[])),li=Nr((e=>ri(e.groups)),(e=>si(e)),(e=>ii(e.groups)),((e,t,n)=>e.filter((e=>!t.includes(e)&&!n.includes(e))))),ci=gr({filteredGroupIds:null,groups:[],focusedGroupId:null,focusedGroupMembers:{status:"not-loaded"}},{namespace:"groups",reducers:ni,actionCreators:{filterGroups:function(e){return fr(0,"FILTER_GROUPS",{filteredGroupIds:e})},focusGroup:function(e){return fr(0,"FOCUS_GROUP",{id:e})},loadGroups:function(e){return fr(0,"LOAD_GROUPS",{groups:e})},startLoadingFocusedGroupMembers:function(){return fr(0,"LOAD_FOCUSED_GROUP_MEMBERS",{focusedGroupMembers:{status:"loading"}})},loadFocusedGroupMembers:function(e){return fr(0,"LOAD_FOCUSED_GROUP_MEMBERS",{focusedGroupMembers:null===e?{status:"not-loaded"}:{status:"loaded",members:e}})},clearGroups:function(){
|
|
125
|
+
return fr(0,"CLEAR_GROUPS",void 0)}},selectors:{allGroups:function(e){return e.groups},filteredGroups:ri,filteredGroupIds:function(e){return e.filteredGroupIds},focusedGroup:function(e){return e.focusedGroupId?oi(e,e.focusedGroupId)??null:null},focusedGroupId:function(e){return e.focusedGroupId},getFocusedGroupMembers:function(e){return e.focusedGroupMembers},getFeaturedGroups:ii,getGroup:oi,getInScopeGroups:ai},rootSelectors:{getCurrentlyViewingGroups:li,getMyGroups:si}});function ui(e,t){const n={};for(const r in t)if(Or(t,r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}const di={UPDATE_LINKS:(e,t)=>({...t.links})};const hi=gr(null,{namespace:"links",reducers:di,actionCreators:{updateLinks:function(e){return fr(0,"UPDATE_LINKS",{links:e})}},selectors:{getLink:function(e,t,n={}){if(!e)return"";const r=e[t];if(!r)throw new Error(`Unknown link "${t}"`);const{url:o,unusedParams:i}=ui(r,n),a=Object.keys(i)
|
|
126
|
+
;if(a.length>0)throw new Error(`Unused parameters: ${a.join(", ")}`);return o}}}),pi={RECEIVE_REAL_TIME_UPDATES:(e,t)=>({pendingUpdates:{...t.pendingUpdates},pendingDeletions:{...t.pendingDeletions}}),CLEAR_PENDING_UPDATES:()=>({pendingUpdates:{},pendingDeletions:{}}),ADD_ANNOTATIONS(e,{annotations:t}){const n={...e.pendingUpdates};for(const e of t)e.id&&delete n[e.id];return{pendingUpdates:n}},REMOVE_ANNOTATIONS(e,{annotationsToRemove:t}){const n={...e.pendingUpdates},r={...e.pendingDeletions};for(const e of t)e.id&&(delete n[e.id],delete r[e.id]);return{pendingUpdates:n,pendingDeletions:r}},FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})};const mi=Nr((e=>e.pendingUpdates),(e=>e.pendingDeletions),((e,t)=>Object.keys(e).length+Object.keys(t).length));const fi=Nr((e=>e.realTimeUpdates.pendingUpdates),(e=>co.selectors.profile(e.session)),(e=>Co.selectors.allAnnotations(e.annotations)),((e,{userid:t},n)=>{const r=Object.values(e),o=e=>!!e?.some((e=>e.userid===t));return r.filter((({mentions:e,id:t})=>{
|
|
127
|
+
const r=o(e),i=n.find((e=>e.id===t));return i?r&&!o(i.mentions):r})).length})),gi=gr({pendingUpdates:{},pendingDeletions:{}},{namespace:"realTimeUpdates",reducers:pi,actionCreators:{receiveRealTimeUpdates:function({updatedAnnotations:e=[],deletedAnnotations:t=[]}){return(n,r)=>{const o={...r().realTimeUpdates.pendingUpdates},i={...r().realTimeUpdates.pendingDeletions};e.forEach((e=>{const t=r().groups,n=r().route;e.group!==ci.selectors.focusedGroupId(t)&&"sidebar"===io.selectors.route(n)||(o[e.id]=e)})),t.forEach((e=>{const t=e.id;delete o[t];const n=r().annotations;Co.selectors.annotationExists(n,t)&&(i[t]=!0)})),n(fr(0,"RECEIVE_REAL_TIME_UPDATES",{pendingUpdates:o,pendingDeletions:i}))}},clearPendingUpdates:function(){return fr(0,"CLEAR_PENDING_UPDATES",void 0)}},selectors:{hasPendingDeletion:function(e,t){return Or(e.pendingDeletions,t)},hasPendingUpdates:function(e){return Object.keys(e.pendingUpdates).length>0},hasPendingUpdatesOrDeletions:function(e){return mi(e)>0},pendingDeletions:function(e){
|
|
128
|
+
return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:mi},rootSelectors:{pendingMentionCount:fi}}),vi={annotation:"location",note:"oldest",orphan:"location"};function bi(e,t){return t?"newest":vi[e]}function yi(e){const t={};return e.annotations&&!e.query&&(t[e.annotations]=!0),t}function _i(e,t,n){return t===e?{}:{selectedTab:e,sortKey:bi(e,n)}}const wi={CLEAR_ANNOTATION_FOCUS_REQUEST:()=>({focusRequest:null}),CLEAR_SELECTION:()=>({forcedVisible:{},selected:{}}),SELECT_ANNOTATIONS:(e,t)=>({selected:t.selection}),SELECT_TAB:(e,t)=>_i(t.tab,e.selectedTab,e.commentsMode),SET_EXPANDED(e,t){const n={...e.expanded};return n[t.id]=t.expanded,{expanded:n}},SET_ANNOTATION_FOCUS_REQUEST:(e,t)=>({focusRequest:t.id}),SET_FORCED_VISIBLE:(e,t)=>({forcedVisible:{...e.forcedVisible,[t.id]:t.visible}}),SET_SORT_KEY:(e,t)=>({sortKey:t.key}),TOGGLE_SELECTED_ANNOTATIONS(e,t){const n={...e.selected};return t.toggleIds.forEach((e=>{n[e]=!n[e]})),{selected:n}},ADD_ANNOTATIONS(e,t){
|
|
129
|
+
const n=t.annotations.filter((e=>!Rr(e))),r=eo(t.annotations,qr)===n.length;return 0===t.currentAnnotationCount&&r?_i("note",e.selectedTab,e.commentsMode):{}},CHANGE_FOCUS_MODE_USER:()=>({forcedVisible:{},selected:{}}),SET_FILTER:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FILTER_QUERY:()=>({forcedVisible:{},selected:{},expanded:{}}),SET_FOCUS_MODE:()=>({forcedVisible:{},selected:{}}),REMOVE_ANNOTATIONS(e,t){let n=e.selectedTab;"orphan"===n&&0===eo(t.remainingAnnotations,Br)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{..._i(n,e.selectedTab,e.commentsMode),expanded:r({...e.expanded}),forcedVisible:r({...e.forcedVisible}),selected:r({...e.selected})}}};function xi(){return fr(0,"CLEAR_SELECTION",void 0)}function ki(e){return e.expanded}const Si=Nr((e=>e.forcedVisible),(e=>no(e))),Ai=Nr((e=>e.selected),(e=>no(e).length>0)),Ti=Nr((e=>e.selected),(e=>no(e)));function Ei(e){return e.selectedTab}const Ci=Nr((e=>e),(e=>({
|
|
130
|
+
expanded:ki(e),forcedVisible:Si(e),selected:Ti(e),sortKey:Mi(e),selectedTab:Ei(e)})));function Mi(e){return e.sortKey}const Ni=Nr((e=>e.selectedTab),(e=>e.commentsMode),((e,t)=>{const n=["newest","oldest"];return"note"===e||t||n.push("location"),n})),Ii=gr((function(e){return{selected:yi(e),expanded:yi(e),forcedVisible:{},selectedTab:e.commentsMode?"note":"annotation",sortKey:bi("annotation",e.commentsMode),focusRequest:null,commentsMode:e.commentsMode}}),{namespace:"selection",reducers:wi,actionCreators:{clearAnnotationFocusRequest:function(){return fr(0,"CLEAR_ANNOTATION_FOCUS_REQUEST",void 0)},clearSelection:xi,selectAnnotations:function(e){return t=>{t(xi()),t(fr(0,"SELECT_ANNOTATIONS",{selection:to(e)}))}},selectTab:function(e){return fr(0,"SELECT_TAB",{tab:e})},setAnnotationFocusRequest:function(e){return fr(0,"SET_ANNOTATION_FOCUS_REQUEST",{id:e})},setExpanded:function(e,t){return fr(0,"SET_EXPANDED",{id:e,expanded:t})},setForcedVisible:function(e,t){return fr(0,"SET_FORCED_VISIBLE",{id:e,visible:t})},
|
|
131
|
+
setSortKey:function(e){return fr(0,"SET_SORT_KEY",{key:e})},toggleSelectedAnnotations:function(e){return fr(0,"TOGGLE_SELECTED_ANNOTATIONS",{toggleIds:e})}},selectors:{expandedMap:ki,annotationFocusRequest:function(e){return e.focusRequest},forcedVisibleThreads:Si,hasSelectedAnnotations:Ai,selectedAnnotations:Ti,selectedTab:Ei,selectionState:Ci,sortKey:Mi,sortKeys:Ni}}),Oi={OPEN_SIDEBAR_PANEL:(e,t)=>({activePanelName:t.panelName}),CLOSE_SIDEBAR_PANEL(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL(e,t){let n;const r=e.activePanelName===t.panelName,o=void 0!==t.panelState?t.panelState:!r;return n=o?t.panelName:r&&!o?null:e.activePanelName,{activePanelName:n}}};const zi=gr({activePanelName:null},{namespace:"sidebarPanels",reducers:Oi,actionCreators:{openSidebarPanel:function(e){return fr(0,"OPEN_SIDEBAR_PANEL",{panelName:e})},closeSidebarPanel:function(e){return fr(0,"CLOSE_SIDEBAR_PANEL",{panelName:e})},toggleSidebarPanel:function(e,t){
|
|
132
|
+
return fr(0,"TOGGLE_SIDEBAR_PANEL",{panelName:e,panelState:t})}},selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),Li={ADD_MESSAGE:(e,t)=>({messages:e.messages.concat({...t.message})}),REMOVE_MESSAGE:(e,t)=>({messages:e.messages.filter((e=>e.id!==t.id))})};const Pi=gr({messages:[]},{namespace:"toastMessages",reducers:Li,actionCreators:{addToastMessage:function(e){return fr(0,"ADD_MESSAGE",{message:e})},removeToastMessage:function(e){return fr(0,"REMOVE_MESSAGE",{id: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))}}}),Ri={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}};const Di=gr({sidebarHasOpened:!1},{namespace:"viewer",reducers:Ri,actionCreators:{setSidebarOpened:function(e){return fr(0,"SET_SIDEBAR_OPENED",{opened:e})}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}})
|
|
133
|
+
;class ji{constructor(e,t,n,r){this.name=e,this.method=t,this.args=n,this.result=r}matches(e,t){return this.name===e&&this.args.every(((e,n)=>t[n]===e))}}function Hi(e){return mr([yr,Co,No,Oo,Ho,Go,ti,hi,ci,gi,io,Ii,co,zi,Pi,Di],[e],[vr])}function Fi(){return function(e){const[,t]=ae((e=>e+1),0),n=ce([]).current,r=ce(null);if(!r.current){const t=new Map,o=(e,r)=>{const o=e[r];if("function"!=typeof o)return o;let i=t.get(r);return i||(i=(...t)=>{const i=n.find((e=>e.matches(r,t)));if(i)return i.result;const a=e.getState(),s=o.apply(e,t);return a===e.getState()&&n.push(new ji(r,o,t,s)),s},t.set(r,i),i)};r.current=new Proxy(e,{get:o})}return le((()=>e.subscribe((()=>{n.find((t=>t.method.apply(e,t.args)!==t.result))&&(n.splice(0,n.length),t(0))}))),[n,e]),r.current}(tr("store"))}Hi.$inject=["settings"];var $i,Bi,qi=er((function({errorType:e,onLoginRequest:t,showClearSelection:n=!1,settings:{commentsMode:r}}){const o=Fi(),i=o.isLoggedIn();return Ve("div",{className:"mb-4",children:Ve(bn,{icon:on,
|
|
134
|
+
title:"group"===e?"Group unavailable":r?"Comment unavailable":"Annotation unavailable",children:[Ve("p",{children:i?"group"===e?"The current URL links to a group, but that group cannot be found,\n or you do not have permission to view the annotations in that group.":`The current URL links to ${r?"a comment":"an annotation"},\n but that ${r?"comment":"annotation"} cannot be found, or you\n do not have permission to view it.`:`The ${e} associated with the current URL is unavailable.\n You may need to log in to see it.`}),Ve("div",{className:"flex justify-end space-x-2",children:[n&&Ve(dn,{variant:i?"primary":void 0,onClick:()=>o.clearSelection(),children:["Show all ",r?"comments":"annotations"]}),!i&&Ve(dn,{variant:"primary",onClick:t,children:"Log in"})]})]})})}),["settings"]);var Ui=function(){if(Bi)return $i;Bi=1
|
|
135
|
+
;var e=NaN,t="[object Symbol]",n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,s="object"==typeof We&&We&&We.Object===Object&&We,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=Object.prototype.toString,d=Math.max,h=Math.min,p=function(){return c.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(s){if("number"==typeof s)return s;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&u.call(e)==t}(s))return e;if(m(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=m(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=s.replace(n,"");var c=o.test(s);return c||i.test(s)?a(s.slice(2),c?2:8):r.test(s)?e:+s}return $i=function(e,t,n){var r,o,i,a,s,l,c=0,u=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}function y(e){var n=e-l;return void 0===l||n>=t||n<0||g&&e-c>=i}
|
|
136
|
+
function _(){var e=p();if(y(e))return w(e);s=setTimeout(_,function(e){var n=t-(e-l);return g?h(n,i-(e-c)):n}(e))}function w(e){return s=void 0,v&&r?b(e):(r=o=void 0,a)}function x(){var e=p(),n=y(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(_,t),u?b(e):a}(l);if(g)return s=setTimeout(_,t),b(l)}return void 0===s&&(s=setTimeout(_,t)),a}return t=f(t)||0,m(n)&&(u=!!n.leading,i=(g="maxWait"in n)?d(f(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},x.flush=function(){return void 0===s?a:w(p())},x},$i}(),Gi=Ke(Ui);const Vi={defaultHeight:200,marginAbove:800,marginBelow:800};function Wi(e){const t=window.getComputedStyle(e);return e.getBoundingClientRect().height+(parseFloat(t.marginTop)+parseFloat(t.marginBottom))}function Ki(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+Ki(n,t)),n?1:0)}function Yi(e){return Ki(e,!1)}function Xi(e){return Ki(e,!0)}function Zi(e){
|
|
137
|
+
const t=e.filter((e=>!!e.annotation)).map((e=>e.annotation));if(t.length)return t;const n=[];if(e.forEach((e=>{e.children&&n.push(...e.children)})),n.length)return Zi(n);throw new Error("Thread contains no annotations")}function Qi(e,t,n){const r=Pr(e.user,t);return(n||r)&&e.user_info?.display_name?e.user_info.display_name:Lr(e.user)}function Ji(e){var t,n=e.uri;try{t=new URL(n).hostname}catch(e){t=""}"localhost"===t&&(t="");var r=t;return e.document&&e.document.title&&(r=e.document.title[0]),{uri:n,domain:t,title:r}}function ea(e){var t=e.uri;return t&&0!==t.indexOf("http://")&&0!==t.indexOf("https://")&&(t=null),e.links&&e.links.incontext&&(t=e.links.incontext),t}function ta(e){var t=Ji(e),n="";if(t.uri&&0===t.uri.indexOf("file://")&&t.title){var r=t.uri.split("/"),o=r[r.length-1];o&&(n=o)}else t.domain&&t.domain!==t.title&&(n=t.domain);return n}function na(e){var t=Ji(e).title;return t.length>30&&(t=t.slice(0,30)+"…"),t}function ra(e){var t,n=e.annotation,r=function(e){return{domain:ta(e),titleText:na(e),
|
|
138
|
+
titleLink:ea(e)}}(n),o=r.domain,i=r.titleText,a=r.titleLink,s=((null===(t=n.links)||void 0===t?void 0:t.html)||"")&&a?a:"";return Ve("div",{className:"flex gap-x-1",children:[Ve("div",{className:"text-color-text-light",children:['on "',s?Ve($n,{href:s,target:"_blank",underline:"none",children:i}):Ve("span",{children:i}),'"']}),o&&Ve("span",{className:"text-color-text-light",children:["(",o,")"]})]})}function oa(e){var t=e.group,n=null==t?void 0:t.links.html;return Ve(y,{children:t&&n&&Ve($n,{classes:Je("text-color-text-light hover:text-color-text-light"),href:t.links.html,target:"_blank",underline:"hover",variant:"custom",children:Ve("div",{className:"flex items-baseline gap-x-1",children:["open"===t.type?Ve(zt,{className:"w-2.5 h-2.5"}):Ve(Pt,{className:"w-2.5 h-2.5"}),Ve("span",{children:t.name})]})})})}function ia(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:setTimeout,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:clearTimeout,n=ce(null),r=de((function(){n.current&&t(n.current)
|
|
139
|
+
}),[t]);return se((function(){return r}),[r]),de((function(t,o){r(),n.current=e((function(){t(),n.current=null}),o)}),[r,e])}var aa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.navigator,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ontouchend"in document;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e.platform)||e.userAgent.includes("Mac")&&t};function sa(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return la(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,s=0,l=e,h.n=n,a}};function p(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],p=h.p,m=i[2];n>3?(o=m===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(s=0,h.v=r,h.n=i[1]):p<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,h.n=m,
|
|
140
|
+
s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,m){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,m),s=u,l=m;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(h.n=-1),p(s,l)):h.n=l:h.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=h.n<0)?l:n.call(r,h))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(la(t={},r,(function(){return this})),t),d=c.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,la(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,la(d,"constructor",c),la(c,"constructor",l),l.displayName="GeneratorFunction",
|
|
141
|
+
la(c,o,"GeneratorFunction"),la(d),la(d,o,"Generator"),la(d,r,(function(){return this})),la(d,"toString",(function(){return"[object Generator]"})),(sa=function(){return{w:i,m:h}})()}function la(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}la=function(e,t,n,r){function i(t,n){la(e,t,(function(e){return this._invoke(t,n,e)}))}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},la(e,t,n,r)}function ca(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function ua(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){ca(i,r,o,a,s,"next",e)}function s(e){ca(i,r,o,a,s,"throw",e)}a(void 0)}))}}function da(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,
|
|
142
|
+
0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ha(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ha(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ha(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pa(e){var t=e.annotation,n=e.commentsMode,r=e.group,o=e.onCopy,i=!t.permissions.read.some((function(e){return e.startsWith("group:")})),a=/^http(s?):/i.test(t.uri),s=function(e,t){var n,r,o,i,a,s
|
|
143
|
+
;return t?null!==(n=null!==(r=null===(o=e.links)||void 0===o?void 0:o.incontext)&&void 0!==r?r:null===(i=e.links)||void 0===i?void 0:i.html)&&void 0!==n?n:null:null!==(a=null===(s=e.links)||void 0===s?void 0:s.html)&&void 0!==a?a:null}(t,a),l=n?"comment":"annotation",c=ce(null),u=ce(null),d=da(ie(!1),2),h=d[0],p=d[1],m=ce(h),f=da(ie(!1),2),g=f[0],v=f[1],b=ia(),_=de(ua(sa().m((function e(){var t;return sa().w((function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(s);case 1:v(!0),b((function(){return v(!1)}),1500),null==o||o({ok:!0,value:s}),e.n=3;break;case 2:e.p=2,t=e.v,null==o||o({ok:!1,error:t});case 3:return e.a(2)}}),e,null,[[0,2]])}))),[o,b,s]);if(se((function(){var e,t;m.current!==h&&(m.current=h,h&&!aa()&&(null===(e=c.current)||void 0===e||e.focus(),null===(t=c.current)||void 0===t||t.select()))}),[h]),!r||!s)return null;var w="private"===r.type?Ve("span",{children:["Only members of the group ",Ve("em",{children:r.name})," may view this"," ",l,"."]}):Ve("span",{
|
|
144
144
|
children:["Anyone using this link may view this ",l,"."]}),x=i?Ve("span",{children:["Only you may view this ",l,"."]}):w;return Ve("div",{className:"relative",ref:u,children:[Ve(mn,{icon:sn,title:"Share",onClick:function(){return p((function(e){return!e}))},expanded:h}),Ve(Nn,{open:h,onClose:function(){return p(!1)},anchorElementRef:u,align:"right",placement:"above",arrow:!0,classes:HTMLElement.prototype.hasOwnProperty("popover")?void 0:"w-max",children:Ve("div",{className:"p-2 flex flex-col gap-y-2",children:[Ve("h2",{className:"text-brand text-[14px] font-medium",children:["Share this ",l]}),Ve("div",{className:"flex w-full text-[13px]",children:Ve(pn,{children:[Ve(An,{"aria-label":"Use this URL to share this ".concat(l),type:"text",value:s,readOnly:!0,elementRef:c}),Ve(mn,{icon:g?gt:_t,title:"Copy share link to clipboard",onClick:_,variant:"dark"})]})}),Ve("div",{className:"text-[13px] font-normal","data-testid":"share-details",children:Ve(y,a?{children:x}:{
|
|
145
|
-
children:["This ",l," cannot be shared in its original context because it was made on a document that is not available on the web. This link shares the ",l," by itself."]})})]})})]})}function
|
|
146
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function
|
|
147
|
-
"text-xs":"subtle"===p,"font-bold":"prominent"===p}),"data-testid":"timestamp-edited","data-variant":p,title:d.absolute,children:["(",h,")"," "]}),r?Ve($n,{classes:"text-color-text-light hover:text-color-text-light",target:"_blank",title:u.absolute,href:r,underline:"hover",variant:"custom",children:u.relative}):Ve("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:u.absolute,children:u.relative})]})}function
|
|
148
|
-
var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function
|
|
149
|
-
return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return
|
|
150
|
-
var t=e.isCollapsed,n=e.setCollapsed,r=e.inlineControlExpandText,o=void 0===r?"More":r,i=e.inlineControlCollapseText,a=void 0===i?"Less":i,s=e.inlineControlStyle,l=e.inlineControlClasses;return Ve("div",{className:Je("absolute block right-0 bottom-0","w-20 bg-gradient-to-l from-white"),children:Ve("div",{className:"flex justify-end",children:Ve(Bn,{variant:"text",onClick:function(){return n(!t)},expanded:!t,title:"Toggle visibility of full excerpt text",style:s,classes:l,underline:"always",inline:!0,children:t?o:a})})})}function
|
|
151
|
-
-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,
|
|
152
|
-
className:Je("transition-[opacity] duration-150 ease-linear","absolute w-full bottom-0 h-touch-minimum",{"bg-gradient-to-b from-white/0 via-95% via-black/10 to-100% to-black/15":v&&S,"bg-none":!v,"opacity-0 pointer-events-none":!S}),title:"Show the full excerpt"}),k&&g&&Ve(
|
|
153
|
-
className:"line-clamp-2",children:t.description}),t.joined&&Ve("div",{"data-testid":"joined",className:"text-color-text-light",children:["Joined"," ",Ve("b",{children:Ue(t.joined,{includeTime:!1})})]})]})}),Ve("div",{className:"px-3 py-2 border-t",children:Ve($n,{variant:"text-light",classes:"flex gap-x-1 items-center",target:"_blank",href:n?"https://web.hypothes.is/help/mentions-for-the-hypothesis-web-app/":"https://web.hypothes.is/help/mentions-for-the-hypothesis-lms-app/","data-testid":"kb-article-link",children:[Ve(Ft,{className:"w-3 h-3"})," Learn more about @mentions"]})})]})}function
|
|
154
|
-
return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function
|
|
155
|
-
;for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,
|
|
156
|
-
function
|
|
157
|
-
;if(e.hasAttribute("data-hyp-mention-type"))return[e,i];var a,s,l=t&&t.link?"link":t?"no-link":"invalid",c=document.createElement("link"===l?"a":"span");return c.setAttribute("data-hyp-mention",""),c.setAttribute("data-hyp-mention-type",l),c.textContent=t?"username"===n?"@".concat(t.username):t.display_name?"@".concat(t.display_name):o:o,"link"===l&&(c.setAttribute("href",null!==(a=null==t?void 0:t.link)&&void 0!==a?a:""),c.setAttribute("target","_blank")),"invalid"!==l&&c.setAttribute("data-userid",null!==(s=e.dataset.userid)&&void 0!==s?s:""),e.replaceWith(c),[c,i]}(e,a,n)))};for(a.s();!(r=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return i}var
|
|
145
|
+
children:["This ",l," cannot be shared in its original context because it was made on a document that is not available on the web. This link shares the ",l," by itself."]})})]})})]})}function ma(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fa(e,t):void 0}}(e,t)||function(){
|
|
146
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ga(e){var t=e.annotationCreated,n=e.annotationUpdated,r=e.annotationURL,o=e.withEditedTimestamp,i=ma(ie((function(){return new Date})),2),a=i[0],s=i[1],l=ue((function(){return new Date(t)}),[t]),c=ue((function(){return o&&new Date(n)}),[n,o]),u=ue((function(){return{absolute:Ue(l,{includeWeekday:!0}),relative:qe(l,a)}}),[l,a]),d=ue((function(){return c?{absolute:Ue(c,{includeWeekday:!0}),relative:qe(c,a)}:{}}),[c,a]);se((function(){return Be(c?n:t,(function(){return s(new Date)}))}),[t,n,l,c,a]);var h=d&&d.relative!==u.relative?"edited ".concat(d.relative):"edited",p="string"==typeof o?o:"subtle";return Ve("div",{children:[o&&Ve("span",{className:Je("italic",{"text-color-text-light":"highlighted"!==p,"text-brand":"highlighted"===p,
|
|
147
|
+
"text-xs":"subtle"===p,"font-bold":"prominent"===p}),"data-testid":"timestamp-edited","data-variant":p,title:d.absolute,children:["(",h,")"," "]}),r?Ve($n,{classes:"text-color-text-light hover:text-color-text-light",target:"_blank",title:u.absolute,href:r,underline:"hover",variant:"custom",children:u.relative}):Ve("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:u.absolute,children:u.relative})]})}function va(e){var t=e.authorLink,n=Ve("h3",{className:"text-color-text font-bold",children:e.displayName});return t?Ve($n,{href:t,target:"_blank",underline:"none",variant:"custom",children:n}):Ve("div",{children:n})}function ba(e){return ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ba(e)}var ya=["children","collapsed","collapsedHeight","onCollapsibleChanged","onToggleCollapsed","overflowThreshold","shadow"];function _a(e,t){
|
|
148
|
+
var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_a(Object(n),!0).forEach((function(t){xa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ba(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=ba(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ba(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ka(e,t){
|
|
149
|
+
return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Aa(e){
|
|
150
|
+
var t=e.isCollapsed,n=e.setCollapsed,r=e.inlineControlExpandText,o=void 0===r?"More":r,i=e.inlineControlCollapseText,a=void 0===i?"Less":i,s=e.inlineControlStyle,l=e.inlineControlClasses;return Ve("div",{className:Je("absolute block right-0 bottom-0","w-20 bg-gradient-to-l from-white"),children:Ve("div",{className:"flex justify-end",children:Ve(Bn,{variant:"text",onClick:function(){return n(!t)},expanded:!t,title:"Toggle visibility of full excerpt text",style:s,classes:l,underline:"always",inline:!0,children:t?o:a})})})}function Ta(e){var t=e.children,n=e.collapsed,r=e.collapsedHeight,o=e.onCollapsibleChanged,i=e.onToggleCollapsed,a=e.overflowThreshold,s=void 0===a?0:a,l=e.shadow,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],
|
|
151
|
+
-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,ya),u="boolean"==typeof n,d=ka(ie(null==n||n),2),h=d[0],p=d[1],m=u?n:h,f=de((function(e){null==i||i(e),u||p(e)}),[u,i]),g=c.inlineControl,v=null!=l?l:!g,b=ce(null),y=ka(ie(0),2),_=y[0],w=y[1],x=de((function(){var e=b.current.clientHeight;w(e),null==o||o(e>r+s)}),[r,o,s]);le((function(){var e,t,n,r=(e=b.current,t=x,(n=new ResizeObserver((function(){return t(e.clientWidth,e.clientHeight)}))).observe(e),function(){return n.disconnect()});return x(),r}),[x]);var k=_>r+s,S=k&&m,A={};return 0!==_&&(A.maxHeight=S?r:_),Ve("div",{"data-testid":"excerpt-container",className:Je("relative overflow-hidden","transition-[max-height] ease-in duration-150"),style:A,children:[Ve("div",{className:Je("inline-block w-full"),"data-testid":"excerpt-content",ref:b,children:t}),Ve("div",{"data-testid":"excerpt-expand",role:"presentation",onClick:function(){return f(!1)},
|
|
152
|
+
className:Je("transition-[opacity] duration-150 ease-linear","absolute w-full bottom-0 h-touch-minimum",{"bg-gradient-to-b from-white/0 via-95% via-black/10 to-100% to-black/15":v&&S,"bg-none":!v,"opacity-0 pointer-events-none":!S}),title:"Show the full excerpt"}),k&&g&&Ve(Aa,wa({isCollapsed:m,setCollapsed:f},c))]})}function Ea(e){var t=e.content,n="username"===e.mentionMode;return Ve(y,{children:[Ve("div",{className:"px-3 py-2",children:Ve("div","string"==typeof t?{"data-testid":"user-not-found",children:["User ",Ve("span",{className:"font-bold",children:t})," does not exist or does not have access to this group"]}:{className:"flex flex-col gap-y-4",children:[Ve("div",{className:"flex flex-col gap-y-1.5",children:[n&&Ve("div",{"data-testid":"username",className:"text-md font-bold",children:["@",t.username]}),t.display_name&&Ve("div",{"data-testid":"display-name",className:Je({"text-color-text-light":n,"text-md font-bold":!n}),children:t.display_name})]}),t.description&&Ve("div",{"data-testid":"description",
|
|
153
|
+
className:"line-clamp-2",children:t.description}),t.joined&&Ve("div",{"data-testid":"joined",className:"text-color-text-light",children:["Joined"," ",Ve("b",{children:Ue(t.joined,{includeTime:!1})})]})]})}),Ve("div",{className:"px-3 py-2 border-t",children:Ve($n,{variant:"text-light",classes:"flex gap-x-1 items-center",target:"_blank",href:n?"https://web.hypothes.is/help/mentions-for-the-hypothesis-web-app/":"https://web.hypothes.is/help/mentions-for-the-hypothesis-lms-app/","data-testid":"kb-article-link",children:[Ve(Ft,{className:"w-3 h-3"})," Learn more about @mentions"]})})]})}function Ca(e){return Ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ca(e)}var Ma=["children","classes"];function Na(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){
|
|
154
|
+
return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Na(Object(n),!0).forEach((function(t){Oa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Na(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Oa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ca(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Ca(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ca(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function za(e){var t=e.children,n=e.classes,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={}
|
|
155
|
+
;for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Ma);return Ve("div",Ia(Ia({dir:"auto",lang:"",className:Je("StyledText",n)},r),{},{children:t}))}function La(e){return function(e){if(Array.isArray(e))return Ra(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Pa(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pa(e,t){if(e){if("string"==typeof e)return Ra(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ra(e,t):void 0}}
|
|
156
|
+
function Ra(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Da(e,t,n){var r,o=e.querySelectorAll("[data-hyp-mention]"),i=new Map,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Pa(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(o);try{var s=function(){var e=r.value,o=e.dataset.userid,a=o?t.find((function(e){return e.userid===o})):void 0;i.set.apply(i,La(function(e,t,n){var r,o=null!==(r=e.textContent)&&void 0!==r?r:"",i=null!=t?t:o
|
|
157
|
+
;if(e.hasAttribute("data-hyp-mention-type"))return[e,i];var a,s,l=t&&t.link?"link":t?"no-link":"invalid",c=document.createElement("link"===l?"a":"span");return c.setAttribute("data-hyp-mention",""),c.setAttribute("data-hyp-mention-type",l),c.textContent=t?"username"===n?"@".concat(t.username):t.display_name?"@".concat(t.display_name):o:o,"link"===l&&(c.setAttribute("href",null!==(a=null==t?void 0:t.link)&&void 0!==a?a:""),c.setAttribute("target","_blank")),"invalid"!==l&&c.setAttribute("data-userid",null!==(s=e.dataset.userid)&&void 0!==s?s:""),e.replaceWith(c),[c,i]}(e,a,n)))};for(a.s();!(r=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return i}var ja={PENDING:{label:"Pending",icon:function(e){return Ve("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 16 16","data-component":"DottedCircleIcon",...e,children:Ve("path",{fill:"currentColor","fill-rule":"evenodd",
|
|
158
158
|
d:"M6.956.068a8 8 0 0 1 2.088 0 .889.889 0 1 1-.23 1.762 6.3 6.3 0 0 0-1.628 0 .889.889 0 0 1-.23-1.762m4.668 1.748a.89.89 0 0 1 1.247-.163c.554.426 1.05.922 1.476 1.476a.889.889 0 0 1-1.41 1.083 6.3 6.3 0 0 0-1.15-1.15.89.89 0 0 1-.163-1.246m-7.248 0c.299.39.226.948-.164 1.247a6.3 6.3 0 0 0-1.15 1.15.889.889 0 0 1-1.409-1.084A8 8 0 0 1 3.13 1.653a.89.89 0 0 1 1.247.163m10.56 4.374a.89.89 0 0 1 .996.766 8 8 0 0 1 0 2.088.889.889 0 1 1-1.762-.23 6.3 6.3 0 0 0 0-1.628.89.89 0 0 1 .766-.996m-13.872 0c.487.063.83.51.766.996a6.3 6.3 0 0 0 0 1.628.889.889 0 0 1-1.762.23 8 8 0 0 1 0-2.088.89.89 0 0 1 .996-.766m13.12 5.434c.389.3.462.857.163 1.247a8 8 0 0 1-1.476 1.476.889.889 0 0 1-1.084-1.41 6.3 6.3 0 0 0 1.15-1.15.89.89 0 0 1 1.247-.163m-12.368 0a.89.89 0 0 1 1.247.163c.331.432.718.819 1.15 1.15a.889.889 0 0 1-1.084 1.41 8 8 0 0 1-1.476-1.476.89.89 0 0 1 .163-1.247m4.374 3.312a.89.89 0 0 1 .996-.766 6.3 6.3 0 0 0 1.628 0 .889.889 0 1 1 .23 1.762 8 8 0 0 1-2.088 0 .89.89 0 0 1-.766-.996","clip-rule":"evenodd"})})}
|
|
159
|
-
},APPROVED:{label:"Approved",icon:function(e){return Ve("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CheckAllIcon",...e,children:Ve("g",{"fill-rule":"evenodd",children:[Ve("path",{fill:"none",d:"M0 0h16v16H0z"}),Ve("path",{fill:"currentColor",d:"M15.58 2.332a1 1 0 0 1 .235 1.394l-7 9.853a1 1 0 0 1-1.672-.065l-3-5a1 1 0 1 1 1.714-1.028l2.214 3.688 6.114-8.606a1 1 0 0 1 1.394-.236M.486 7.143a1 1 0 0 1 1.371.343l3 5a1 1 0 1 1-1.715 1.028l-3-5a1 1 0 0 1 .344-1.371"}),Ve("path",{fill:"currentColor",d:"M11.6 2.2a1 1 0 0 1 .2 1.4l-3 4a1 1 0 1 1-1.6-1.2l3-4a1 1 0 0 1 1.4-.2"})]})})}},DENIED:{label:"Declined",icon:on},SPAM:{label:"Spam",icon:pt}};Object.freeze(
|
|
160
|
-
|
|
161
|
-
let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:
|
|
162
|
-
const
|
|
163
|
-
;var
|
|
164
|
-
;const{implementation:k,createNodeIterator:S,createDocumentFragment:A,getElementsByTagName:T}=r,{importNode:E}=o;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof
|
|
165
|
-
writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,W=!0,K=!1,Y=!0,X=!1,Z=!0,Q=!1,J=!1,ee=!1,te=!1,ne=!1,re=!1,oe=!0,ie=!1,ae=!0,se=!1,le={},ce=null;const ue=
|
|
166
|
-
;const Te=["application/xhtml+xml","text/html"];let Ee=null,Ce=null;const Me=r.createElement("form"),Ne=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ce||Ce!==e){if(e&&"object"==typeof e||(e={}),e=
|
|
167
|
-
Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,X=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,Q=e.WHOLE_DOCUMENT||!1,te=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,ae=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||
|
|
168
|
-
|
|
169
|
-
;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,i)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));
|
|
170
|
-
if(!t||!t.documentElement){t=k.createDocument(be,"template",null);try{t.documentElement.innerHTML=ye?x:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),be===ve?T.call(t,Q?"html":"body")[0]:Q?t.documentElement:i},De=function(e){return S.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},je=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},He=function(e){return"function"==typeof l&&e instanceof l};function Fe(e,t,r){
|
|
171
|
-
;if(Fe(C.uponSanitizeElement,e,{tagName:r,allowedTags:j}),Z&&e.hasChildNodes()&&!He(e.firstElementChild)&&
|
|
172
|
-
;return!!_e[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===ve?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(Oe[n]):e.namespaceURI===fe?t.namespaceURI===ve?"math"===n:t.namespaceURI===ge?"math"===n&&ke[r]:Boolean(ze[n]):e.namespaceURI===ve?!(t.namespaceURI===ge&&!ke[r])&&!(t.namespaceURI===fe&&!xe[r])&&!ze[n]&&(Se[n]||!Oe[n]):!("application/xhtml+xml"!==Ae||!_e[e.namespaceURI]))}(e)?(Le(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!
|
|
173
|
-
if(!(qe(e)&&(B.tagNameCheck instanceof RegExp&&
|
|
174
|
-
r.forceKeepAttr=void 0,Fe(C.uponSanitizeAttribute,e,r),d=r.attrValue,!ie||"id"!==c&&"name"!==c||(Pe(a,e),d="user-content-"+d),Z&&
|
|
175
|
-
let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,s=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!He(e)){if("function"!=typeof e.toString)throw
|
|
176
|
-
;return(F.shadowroot||F.shadowrootmode)&&(c=E.call(o,c,!0)),c}let d=Q?r.outerHTML:r.innerHTML;return Q&&j["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&
|
|
177
|
-
uponSanitizeShadowNode:[]}},n}();var
|
|
178
|
-
;if(i&&i.start<=i.end){var a=i.lexer.input;n=i.start,r=i.end,n===a.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";var s=a.slice(n,r).replace(/[^]/g,"$&̲");o+=(n>15?"…"+a.slice(n-15,n):a.slice(0,n))+s+(r+15<a.length?a.slice(r,r+15)+"…":a.slice(r))}var l=new Error(o);return l.name="ParseError",l.__proto__=
|
|
179
|
-
var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"}},
|
|
159
|
+
},APPROVED:{label:"Approved",icon:function(e){return Ve("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16","data-component":"CheckAllIcon",...e,children:Ve("g",{"fill-rule":"evenodd",children:[Ve("path",{fill:"none",d:"M0 0h16v16H0z"}),Ve("path",{fill:"currentColor",d:"M15.58 2.332a1 1 0 0 1 .235 1.394l-7 9.853a1 1 0 0 1-1.672-.065l-3-5a1 1 0 1 1 1.714-1.028l2.214 3.688 6.114-8.606a1 1 0 0 1 1.394-.236M.486 7.143a1 1 0 0 1 1.371.343l3 5a1 1 0 1 1-1.715 1.028l-3-5a1 1 0 0 1 .344-1.371"}),Ve("path",{fill:"currentColor",d:"M11.6 2.2a1 1 0 0 1 .2 1.4l-3 4a1 1 0 1 1-1.6-1.2l3-4a1 1 0 0 1 1.4-.2"})]})})}},DENIED:{label:"Declined",icon:on},SPAM:{label:"Spam",icon:pt}};Object.freeze(ja);const{entries:Ha,setPrototypeOf:Fa,isFrozen:$a,getPrototypeOf:Ba,getOwnPropertyDescriptor:qa}=Object;let{freeze:Ua,seal:Ga,create:Va}=Object,{apply:Wa,construct:Ka}="undefined"!=typeof Reflect&&Reflect;Ua||(Ua=function(e){return e}),Ga||(Ga=function(e){return e}),
|
|
160
|
+
Wa||(Wa=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),Ka||(Ka=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const Ya=us(Array.prototype.forEach),Xa=us(Array.prototype.lastIndexOf),Za=us(Array.prototype.pop),Qa=us(Array.prototype.push),Ja=us(Array.prototype.splice),es=us(String.prototype.toLowerCase),ts=us(String.prototype.toString),ns=us(String.prototype.match),rs=us(String.prototype.replace),os=us(String.prototype.indexOf),is=us(String.prototype.trim),as=us(Object.prototype.hasOwnProperty),ss=us(RegExp.prototype.test),ls=(cs=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ka(cs,t)});var cs;function us(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Wa(e,t,r)}}function ds(e,t){
|
|
161
|
+
let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:es;Fa&&Fa(e,null);let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&($a(t)||(t[r]=e),o=e)}e[o]=!0}return e}function hs(e){for(let t=0;t<e.length;t++){as(e,t)||(e[t]=null)}return e}function ps(e){const t=Va(null);for(const[n,r]of Ha(e)){as(e,n)&&(Array.isArray(r)?t[n]=hs(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=ps(r):t[n]=r)}return t}function ms(e,t){for(;null!==e;){const n=qa(e,t);if(n){if(n.get)return us(n.get);if("function"==typeof n.value)return us(n.value)}e=Ba(e)}return function(){return null}}
|
|
162
|
+
const fs=Ua(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gs=Ua(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vs=Ua(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),bs=Ua(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ys=Ua(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),_s=Ua(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ws=Ua(["#text"]),xs=Ua(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),ks=Ua(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ss=Ua(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),As=Ua(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ts=Ga(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Es=Ga(/<%[\w\W]*|[\w\W]*%>/gm),Cs=Ga(/\$\{[\w\W]*/gm),Ms=Ga(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ns=Ga(/^aria-[\-\w]+$/),Is=Ga(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Os=Ga(/^(?:\w+script|data):/i),zs=Ga(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ls=Ga(/^html$/i),Ps=Ga(/^[a-z][.\w]*(-[.\w]+)+$/i)
|
|
163
|
+
;var Rs=Object.freeze({__proto__:null,ARIA_ATTR:Ns,ATTR_WHITESPACE:zs,CUSTOM_ELEMENT:Ps,DATA_ATTR:Ms,DOCTYPE_NAME:Ls,ERB_EXPR:Es,IS_ALLOWED_URI:Is,IS_SCRIPT_OR_DATA:Os,MUSTACHE_EXPR:Ts,TMPLIT_EXPR:Cs});const Ds=1,js=3,Hs=7,Fs=8,$s=9,Bs=function(){return"undefined"==typeof window?null:window};var qs,Us,Gs=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bs();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==$s||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const o=r,i=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:m}=t,f=c.prototype,g=ms(f,"cloneNode"),v=ms(f,"remove"),b=ms(f,"nextSibling"),y=ms(f,"childNodes"),_=ms(f,"parentNode");if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let w,x=""
|
|
164
|
+
;const{implementation:k,createNodeIterator:S,createDocumentFragment:A,getElementsByTagName:T}=r,{importNode:E}=o;let C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Ha&&"function"==typeof _&&k&&void 0!==k.createHTMLDocument;const{MUSTACHE_EXPR:M,ERB_EXPR:N,TMPLIT_EXPR:I,DATA_ATTR:O,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:R}=Rs;let{IS_ALLOWED_URI:D}=Rs,j=null;const H=ds({},[...fs,...gs,...vs,...ys,...ws]);let F=null;const $=ds({},[...xs,...ks,...Ss,...As]);let B=Object.seal(Va(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,U=null;const G=Object.seal(Va(null,{tagCheck:{
|
|
165
|
+
writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,W=!0,K=!1,Y=!0,X=!1,Z=!0,Q=!1,J=!1,ee=!1,te=!1,ne=!1,re=!1,oe=!0,ie=!1,ae=!0,se=!1,le={},ce=null;const ue=ds({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const he=ds({},["audio","video","img","source","image","track"]);let pe=null;const me=ds({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let be=ve,ye=!1,_e=null;const we=ds({},[fe,ge,ve],ts);let xe=ds({},["mi","mo","mn","ms","mtext"]),ke=ds({},["annotation-xml"]);const Se=ds({},["title","style","font","a","script"]);let Ae=null
|
|
166
|
+
;const Te=["application/xhtml+xml","text/html"];let Ee=null,Ce=null;const Me=r.createElement("form"),Ne=function(e){return e instanceof RegExp||e instanceof Function},Ie=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ce||Ce!==e){if(e&&"object"==typeof e||(e={}),e=ps(e),Ae=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ee="application/xhtml+xml"===Ae?ts:es,j=as(e,"ALLOWED_TAGS")?ds({},e.ALLOWED_TAGS,Ee):H,F=as(e,"ALLOWED_ATTR")?ds({},e.ALLOWED_ATTR,Ee):$,_e=as(e,"ALLOWED_NAMESPACES")?ds({},e.ALLOWED_NAMESPACES,ts):we,pe=as(e,"ADD_URI_SAFE_ATTR")?ds(ps(me),e.ADD_URI_SAFE_ATTR,Ee):me,de=as(e,"ADD_DATA_URI_TAGS")?ds(ps(he),e.ADD_DATA_URI_TAGS,Ee):he,ce=as(e,"FORBID_CONTENTS")?ds({},e.FORBID_CONTENTS,Ee):ue,q=as(e,"FORBID_TAGS")?ds({},e.FORBID_TAGS,Ee):ps({}),U=as(e,"FORBID_ATTR")?ds({},e.FORBID_ATTR,Ee):ps({}),le=!!as(e,"USE_PROFILES")&&e.USE_PROFILES,V=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,
|
|
167
|
+
Y=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,X=e.SAFE_FOR_TEMPLATES||!1,Z=!1!==e.SAFE_FOR_XML,Q=e.WHOLE_DOCUMENT||!1,te=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,ee=e.FORCE_BODY||!1,oe=!1!==e.SANITIZE_DOM,ie=e.SANITIZE_NAMED_PROPS||!1,ae=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||Is,be=e.NAMESPACE||ve,xe=e.MATHML_TEXT_INTEGRATION_POINTS||xe,ke=e.HTML_INTEGRATION_POINTS||ke,B=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(B.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ne(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(B.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(B.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(W=!1),ne&&(te=!0),le&&(j=ds({},ws),F=[],!0===le.html&&(ds(j,fs),ds(F,xs)),!0===le.svg&&(ds(j,gs),
|
|
168
|
+
ds(F,ks),ds(F,As)),!0===le.svgFilters&&(ds(j,vs),ds(F,ks),ds(F,As)),!0===le.mathMl&&(ds(j,ys),ds(F,Ss),ds(F,As))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?G.tagCheck=e.ADD_TAGS:(j===H&&(j=ps(j)),ds(j,e.ADD_TAGS,Ee))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?G.attributeCheck=e.ADD_ATTR:(F===$&&(F=ps(F)),ds(F,e.ADD_ATTR,Ee))),e.ADD_URI_SAFE_ATTR&&ds(pe,e.ADD_URI_SAFE_ATTR,Ee),e.FORBID_CONTENTS&&(ce===ue&&(ce=ps(ce)),ds(ce,e.FORBID_CONTENTS,Ee)),ae&&(j["#text"]=!0),Q&&ds(j,["html","head","body"]),j.table&&(ds(j,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ls('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ls('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null
|
|
169
|
+
;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(m,i)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));Ua&&Ua(e),Ce=e}},Oe=ds({},[...gs,...vs,...bs]),ze=ds({},[...ys,..._s]),Le=function(e){Qa(n.removed,{element:e});try{_(e).removeChild(e)}catch(t){v(e)}},Pe=function(e,t){try{Qa(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Qa(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(te||ne)try{Le(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){let t=null,n=null;if(ee)e="<remove></remove>"+e;else{const t=ns(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ae&&be===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=w?w.createHTML(e):e;if(be===ve)try{t=(new p).parseFromString(o,Ae)}catch(e){}
|
|
170
|
+
if(!t||!t.documentElement){t=k.createDocument(be,"template",null);try{t.documentElement.innerHTML=ye?x:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),be===ve?T.call(t,Q?"html":"body")[0]:Q?t.documentElement:i},De=function(e){return S.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},je=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},He=function(e){return"function"==typeof l&&e instanceof l};function Fe(e,t,r){Ya(e,(e=>{e.call(n,t,r,Ce)}))}const $e=function(e){let t=null;if(Fe(C.beforeSanitizeElements,e,null),je(e))return Le(e),!0;const r=Ee(e.nodeName)
|
|
171
|
+
;if(Fe(C.uponSanitizeElement,e,{tagName:r,allowedTags:j}),Z&&e.hasChildNodes()&&!He(e.firstElementChild)&&ss(/<[/\w!]/g,e.innerHTML)&&ss(/<[/\w!]/g,e.textContent))return Le(e),!0;if(e.nodeType===Hs)return Le(e),!0;if(Z&&e.nodeType===Fs&&ss(/<[/\w]/g,e.data))return Le(e),!0;if(!(G.tagCheck instanceof Function&&G.tagCheck(r))&&(!j[r]||q[r])){if(!q[r]&&qe(r)){if(B.tagNameCheck instanceof RegExp&&ss(B.tagNameCheck,r))return!1;if(B.tagNameCheck instanceof Function&&B.tagNameCheck(r))return!1}if(ae&&!ce[r]){const t=_(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=g(n[r],!0);o.__removalCount=(e.__removalCount||0)+1,t.insertBefore(o,b(e))}}}return Le(e),!0}return e instanceof c&&!function(e){let t=_(e);t&&t.tagName||(t={namespaceURI:be,tagName:"template"});const n=es(e.tagName),r=es(t.tagName)
|
|
172
|
+
;return!!_e[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===ve?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(Oe[n]):e.namespaceURI===fe?t.namespaceURI===ve?"math"===n:t.namespaceURI===ge?"math"===n&&ke[r]:Boolean(ze[n]):e.namespaceURI===ve?!(t.namespaceURI===ge&&!ke[r])&&!(t.namespaceURI===fe&&!xe[r])&&!ze[n]&&(Se[n]||!Oe[n]):!("application/xhtml+xml"!==Ae||!_e[e.namespaceURI]))}(e)?(Le(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!ss(/<\/no(script|embed|frames)/i,e.innerHTML)?(X&&e.nodeType===js&&(t=e.textContent,Ya([M,N,I],(e=>{t=rs(t,e," ")})),e.textContent!==t&&(Qa(n.removed,{element:e.cloneNode()}),e.textContent=t)),Fe(C.afterSanitizeElements,e,null),!1):(Le(e),!0)},Be=function(e,t,n){if(oe&&("id"===t||"name"===t)&&(n in r||n in Me))return!1;if(W&&!U[t]&&ss(O,t));else if(V&&ss(z,t));else if(G.attributeCheck instanceof Function&&G.attributeCheck(t,e));else if(!F[t]||U[t]){
|
|
173
|
+
if(!(qe(e)&&(B.tagNameCheck instanceof RegExp&&ss(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&ss(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||"is"===t&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&ss(B.tagNameCheck,n)||B.tagNameCheck instanceof Function&&B.tagNameCheck(n))))return!1}else if(pe[t]);else if(ss(D,rs(n,P,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==os(n,"data:")||!de[e]){if(K&&!ss(L,rs(n,P,"")));else if(n)return!1}else;return!0},qe=function(e){return"annotation-xml"!==e&&ns(e,R)},Ue=function(e){Fe(C.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||je(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:a,namespaceURI:s,value:l}=i,c=Ee(a),u=l;let d="value"===a?u:is(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,
|
|
174
|
+
r.forceKeepAttr=void 0,Fe(C.uponSanitizeAttribute,e,r),d=r.attrValue,!ie||"id"!==c&&"name"!==c||(Pe(a,e),d="user-content-"+d),Z&&ss(/((--!?|])>)|<\/(style|title|textarea)/i,d)){Pe(a,e);continue}if("attributename"===c&&ns(d,"href")){Pe(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Pe(a,e);continue}if(!Y&&ss(/\/>/i,d)){Pe(a,e);continue}X&&Ya([M,N,I],(e=>{d=rs(d,e," ")}));const h=Ee(e.nodeName);if(Be(h,c,d)){if(w&&"object"==typeof m&&"function"==typeof m.getAttributeType)if(s);else switch(m.getAttributeType(h,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),je(e)?Le(e):Za(n.removed)}catch(t){Pe(a,e)}}else Pe(a,e)}Fe(C.afterSanitizeAttributes,e,null)},Ge=function e(t){let n=null;const r=De(t);for(Fe(C.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Fe(C.uponSanitizeShadowNode,n,null),$e(n),Ue(n),n.content instanceof a&&e(n.content);Fe(C.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){
|
|
175
|
+
let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,s=null,c=null;if(ye=!e,ye&&(e="\x3c!--\x3e"),"string"!=typeof e&&!He(e)){if("function"!=typeof e.toString)throw ls("toString is not a function");if("string"!=typeof(e=e.toString()))throw ls("dirty is not a string, aborting")}if(!n.isSupported)return e;if(J||Ie(t),n.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Ee(e.nodeName);if(!j[t]||q[t])throw ls("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Re("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===Ds&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!te&&!X&&!Q&&-1===e.indexOf("<"))return w&&re?w.createHTML(e):e;if(r=Re(e),!r)return te?null:re?x:""}r&&ee&&Le(r.firstChild);const u=De(se?e:r);for(;s=u.nextNode();)$e(s),Ue(s),s.content instanceof a&&Ge(s.content);if(se)return e;if(te){if(ne)for(c=A.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r
|
|
176
|
+
;return(F.shadowroot||F.shadowrootmode)&&(c=E.call(o,c,!0)),c}let d=Q?r.outerHTML:r.innerHTML;return Q&&j["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&ss(Ls,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),X&&Ya([M,N,I],(e=>{d=rs(d,e," ")})),w&&re?w.createHTML(d):d},n.setConfig=function(){Ie(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},n.clearConfig=function(){Ce=null,J=!1},n.isValidAttribute=function(e,t,n){Ce||Ie({});const r=Ee(e),o=Ee(t);return Be(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&Qa(C[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Xa(C[e],t);return-1===n?void 0:Ja(C[e],n,1)[0]}return Za(C[e])},n.removeHooks=function(e){C[e]=[]},n.removeAllHooks=function(){C={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],
|
|
177
|
+
uponSanitizeShadowNode:[]}},n}();var Vs=function(){if(Us)return qs;Us=1;var e=/["'&<>]/;return qs=function(t){var n,r=""+t,o=e.exec(r);if(!o)return r;var i="",a=0,s=0;for(a=o.index;a<r.length;a++){switch(r.charCodeAt(a)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==a&&(i+=r.substring(s,a)),s=a+1,i+=n}return s!==a?i+r.substring(s,a):i},qs}(),Ws=Ke(Vs);class Ks{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new Ks(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class Ys{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new Ys(t,Ks.range(this,e))}}class Xs{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n,r,o="KaTeX parse error: "+e,i=t&&t.loc
|
|
178
|
+
;if(i&&i.start<=i.end){var a=i.lexer.input;n=i.start,r=i.end,n===a.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";var s=a.slice(n,r).replace(/[^]/g,"$&̲");o+=(n>15?"…"+a.slice(n-15,n):a.slice(0,n))+s+(r+15<a.length?a.slice(r,r+15)+"…":a.slice(r))}var l=new Error(o);return l.name="ParseError",l.__proto__=Xs.prototype,l.position=n,null!=n&&null!=r&&(l.length=r-n),l.rawMessage=e,l}}Xs.prototype.__proto__=Error.prototype;var Zs=/([A-Z])/g,Qs={"&":"&",">":">","<":"<",'"':""","'":"'"},Js=/[&><"']/g;var el=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},tl={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(Js,(e=>Qs[e]))},hyphenate:function(e){return e.replace(Zs,"-$1").toLowerCase()},getBaseElem:el,isCharacterBox:function(e){var t=el(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){
|
|
179
|
+
var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"}},nl={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",
|
|
180
180
|
cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],
|
|
181
|
-
description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function
|
|
182
|
-
;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class
|
|
183
|
-
;"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]")}}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(e){r="error"}return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){if(e.url&&!e.protocol){var t=
|
|
184
|
-
return
|
|
181
|
+
description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function rl(e){if(e.default)return e.default
|
|
182
|
+
;var t=e.type,n=Array.isArray(t)?t[0]:t;if("string"!=typeof n)return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class ol{constructor(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{},nl)if(nl.hasOwnProperty(t)){var n=nl[t];this[t]=void 0!==e[t]?n.processor?n.processor(e[t]):e[t]:rl(n)}}reportNonstrict(e,t,n){var r=this.strict;if("function"==typeof r&&(r=r(e,t,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new Xs("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n)
|
|
183
|
+
;"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]")}}useStrictBehavior(e,t,n){var r=this.strict;if("function"==typeof r)try{r=r(e,t,n)}catch(e){r="error"}return!(!r||"ignore"===r)&&(!0===r||"error"===r||("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+t+" ["+e+"]"),!1)))}isTrusted(e){if(e.url&&!e.protocol){var t=tl.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}var n="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(n)}}class il{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return al[sl[this.id]]}sub(){
|
|
184
|
+
return al[ll[this.id]]}fracNum(){return al[cl[this.id]]}fracDen(){return al[ul[this.id]]}cramp(){return al[dl[this.id]]}text(){return al[hl[this.id]]}isTight(){return this.size>=2}}var al=[new il(0,0,!1),new il(1,0,!0),new il(2,1,!1),new il(3,1,!0),new il(4,2,!1),new il(5,2,!0),new il(6,3,!1),new il(7,3,!0)],sl=[4,5,4,5,6,7,6,7],ll=[5,5,5,5,7,7,7,7],cl=[2,3,4,5,6,7,6,7],ul=[3,3,5,5,7,7,7,7],dl=[1,1,3,3,5,5,7,7],hl=[0,1,2,3,2,3,2,3],pl={DISPLAY:al[0],TEXT:al[2],SCRIPT:al[4],SCRIPTSCRIPT:al[6]},ml=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var fl=[];function gl(e){for(var t=0;t<fl.length;t+=2)if(e>=fl[t]&&e<=fl[t+1])return!0;return!1}ml.forEach((e=>e.blocks.forEach((e=>fl.push(...e)))));var vl=80,bl={
|
|
185
185
|
doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
|
|
186
186
|
doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
|
|
187
187
|
leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
|
|
@@ -201,7 +201,7 @@ widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,
|
|
|
201
201
|
baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
|
|
202
202
|
rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",
|
|
203
203
|
rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",
|
|
204
|
-
shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};class
|
|
204
|
+
shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};class yl{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map((e=>e.toText())).join("")}}var _l={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],
|
|
205
205
|
67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],
|
|
206
206
|
8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],
|
|
207
207
|
8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],
|
|
@@ -258,194 +258,194 @@ shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,
|
|
|
258
258
|
8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],
|
|
259
259
|
37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],
|
|
260
260
|
79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],
|
|
261
|
-
120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},
|
|
262
|
-
quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},
|
|
263
|
-
"а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function
|
|
264
|
-
this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||
|
|
265
|
-
textSize:e,sizeMultiplier:
|
|
266
|
-
cssEmPerMu:
|
|
267
|
-
this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},
|
|
268
|
-
;return t+="</"+e+">"};class
|
|
269
|
-
hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+
|
|
270
|
-
}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text
|
|
271
|
-
this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+
|
|
272
|
-
constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var
|
|
292
|
-
|
|
293
|
-
var
|
|
294
|
-
return
|
|
295
|
-
i.maxFontSize>r&&(r=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},
|
|
296
|
-
fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}}
|
|
297
|
-
for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,o=r,i=1;i<t.length;i++){var a=-t[i].shift-o-t[i].elem.depth,s=a-(t[i-1].elem.height+t[i-1].elem.depth);o+=a,n.push({type:"kern",size:s}),n.push(t[i])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,u=0;u<e.children.length;u++){var d=e.children[u];c-="kern"===d.type?d.size:d.elem.height+d.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var h=e.children[0];if("elem"!==h.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-h.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-h.elem.depth}}return{children:e.children,depth:l}}(e),o=0,i=0;i<n.length;i++){var a=n[i];if("elem"===a.type){var s=a.elem;o=Math.max(o,s.maxFontSize,s.height)}}o+=2;var l=
|
|
298
|
-
;for(var c=[],u=r,d=r,h=r,p=0;p<n.length;p++){var m=n[p];if("kern"===m.type)h+=m.size;else{var f=m.elem,g=m.wrapperClasses||[],v=m.wrapperStyle||{},b=
|
|
299
|
-
if(120782<=n&&n<=120831){var i=Math.floor((n-120782)/10);return[
|
|
300
|
-
;return
|
|
301
|
-
mop:
|
|
302
|
-
throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var
|
|
303
|
-
;"mbin"===n&&
|
|
304
|
-
;return
|
|
305
|
-
n?((i=
|
|
306
|
-
for(var r=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof
|
|
307
|
-
this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":e>=-.05556&&e<=-.05555?" ":e>=-.1667&&e<=-.1666?" ":e>=-.2223&&e<=-.2222?" ":e>=-.2778&&e<=-.2777?" ":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",
|
|
308
|
-
;if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathsfit"===n)return"sans-serif-italic";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var o=e.text;return["\\imath","\\jmath"].includes(o)?null:(
|
|
309
|
-
var t=e.children[0];return t instanceof
|
|
310
|
-
;l instanceof
|
|
311
|
-
;return
|
|
312
|
-
"\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},
|
|
261
|
+
120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},wl={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],
|
|
262
|
+
quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},xl={"Å":"A","Ð":"D","Þ":"o","å":"a","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R",
|
|
263
|
+
"а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function kl(e,t,n){if(!_l[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),o=_l[t][r];if(!o&&e[0]in xl&&(r=xl[e[0]].charCodeAt(0),o=_l[t][r]),o||"text"!==n||gl(r)&&(o=_l[t][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var Sl={};var Al=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Tl=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],El=function(e,t){return t.size<2?e:Al[e-1][t.size-1]};class Cl{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,
|
|
264
|
+
this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Cl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Tl[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new Cl(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:El(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,
|
|
265
|
+
textSize:e,sizeMultiplier:Tl[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=El(Cl.BASESIZE,e);return this.size===t&&this.textSize===Cl.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Cl.BASESIZE?["sizing","reset-size"+this.size,"size"+Cl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!Sl[t=e>=5?0:e>=3?1:2]){var n=Sl[t]={
|
|
266
|
+
cssEmPerMu:wl.quad[t]/18};for(var r in wl)wl.hasOwnProperty(r)&&(n[r]=wl[r][t])}return Sl[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Cl.BASESIZE=6;var Ml={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},Nl={ex:!0,em:!0,mu:!0},Il=function(e){return"string"!=typeof e&&(e=e.unit),e in Ml||e in Nl||"ex"===e},Ol=function(e,t){var n;if(e.unit in Ml)n=Ml[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if("mu"===e.unit)n=t.fontMetrics().cssEmPerMu;else{var r;if(r=t.style.isTight()?t.havingStyle(t.style.text()):t,"ex"===e.unit)n=r.fontMetrics().xHeight;else{if("em"!==e.unit)throw new Xs("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},zl=function(e){return+e.toFixed(4)+"em"},Ll=function(e){return e.filter((e=>e)).join(" ")},Pl=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,
|
|
267
|
+
this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var r=t.getColor();r&&(this.style.color=r)}},Rl=function(e){var t=document.createElement(e);for(var n in t.className=Ll(this.classes),this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var r in this.attributes)this.attributes.hasOwnProperty(r)&&t.setAttribute(r,this.attributes[r]);for(var o=0;o<this.children.length;o++)t.appendChild(this.children[o].toNode());return t},Dl=/[\s"'>/=\x00-\x1f]/,jl=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+tl.escape(Ll(this.classes))+'"');var n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=tl.hyphenate(r)+":"+this.style[r]+";");for(var o in n&&(t+=' style="'+tl.escape(n)+'"'),this.attributes)if(this.attributes.hasOwnProperty(o)){if(Dl.test(o))throw new Xs("Invalid attribute name '"+o+"'");t+=" "+o+'="'+tl.escape(this.attributes[o])+'"'}t+=">";for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup()
|
|
268
|
+
;return t+="</"+e+">"};class Hl{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Pl.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Rl.call(this,"span")}toMarkup(){return jl.call(this,"span")}}class Fl{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Pl.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Rl.call(this,"a")}toMarkup(){return jl.call(this,"a")}}class $l{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}
|
|
269
|
+
hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");for(var t in e.src=this.src,e.alt=this.alt,e.className="mord",this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+tl.escape(this.src)+'" alt="'+tl.escape(this.alt)+'"',t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=tl.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+tl.escape(t)+'"'),e+="'/>"}}var Bl={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class ql{constructor(e,t,n,r,o,i,a,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=o||0,this.width=i||0,this.classes=a||[],this.style=s||{},this.maxFontSize=0;var l=function(e){for(var t=0;t<ml.length;t++)for(var n=ml[t],r=0;r<n.blocks.length;r++){var o=n.blocks[r];if(e>=o[0]&&e<=o[1])return n.name}return null
|
|
270
|
+
}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Bl[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;for(var n in this.italic>0&&((t=document.createElement("span")).style.marginRight=zl(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=Ll(this.classes)),this.style)this.style.hasOwnProperty(n)&&((t=t||document.createElement("span")).style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=tl.escape(Ll(this.classes)),t+='"');var n="";for(var r in this.italic>0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=tl.hyphenate(r)+":"+this.style[r]+";");n&&(e=!0,t+=' style="'+tl.escape(n)+'"');var o=tl.escape(this.text);return e?(t+=">",t+=o,t+="</span>"):o}}class Ul{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],
|
|
271
|
+
this.attributes=t||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+tl.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class Gl{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","path");return this.alternate?e.setAttribute("d",this.alternate):e.setAttribute("d",bl[this.pathName]),e}toMarkup(){return this.alternate?'<path d="'+tl.escape(this.alternate)+'"/>':'<path d="'+tl.escape(bl[this.pathName])+'"/>'}}class Vl{
|
|
272
|
+
constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+tl.escape(this.attributes[t])+'"');return e+="/>"}}function Wl(e){if(e instanceof ql)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var Kl={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Yl={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Xl={math:{},text:{}};function Zl(e,t,n,r,o,i){Xl[e][o]={font:t,group:n,replace:r},i&&r&&(Xl[e][r]=Xl[e][o])}var Ql="math",Jl="text",ec="main",tc="ams",nc="accent-token",rc="bin",oc="close",ic="inner",ac="mathord",sc="op-token",lc="open",cc="punct",uc="rel",dc="spacing",hc="textord";Zl(Ql,ec,uc,"≡","\\equiv",!0),Zl(Ql,ec,uc,"≺","\\prec",!0),
|
|
273
|
+
Zl(Ql,ec,uc,"≻","\\succ",!0),Zl(Ql,ec,uc,"∼","\\sim",!0),Zl(Ql,ec,uc,"⊥","\\perp"),Zl(Ql,ec,uc,"⪯","\\preceq",!0),Zl(Ql,ec,uc,"⪰","\\succeq",!0),Zl(Ql,ec,uc,"≃","\\simeq",!0),Zl(Ql,ec,uc,"∣","\\mid",!0),Zl(Ql,ec,uc,"≪","\\ll",!0),Zl(Ql,ec,uc,"≫","\\gg",!0),Zl(Ql,ec,uc,"≍","\\asymp",!0),Zl(Ql,ec,uc,"∥","\\parallel"),Zl(Ql,ec,uc,"⋈","\\bowtie",!0),Zl(Ql,ec,uc,"⌣","\\smile",!0),Zl(Ql,ec,uc,"⊑","\\sqsubseteq",!0),Zl(Ql,ec,uc,"⊒","\\sqsupseteq",!0),Zl(Ql,ec,uc,"≐","\\doteq",!0),Zl(Ql,ec,uc,"⌢","\\frown",!0),Zl(Ql,ec,uc,"∋","\\ni",!0),Zl(Ql,ec,uc,"∝","\\propto",!0),Zl(Ql,ec,uc,"⊢","\\vdash",!0),Zl(Ql,ec,uc,"⊣","\\dashv",!0),Zl(Ql,ec,uc,"∋","\\owns"),Zl(Ql,ec,cc,".","\\ldotp"),Zl(Ql,ec,cc,"⋅","\\cdotp"),Zl(Ql,ec,hc,"#","\\#"),Zl(Jl,ec,hc,"#","\\#"),Zl(Ql,ec,hc,"&","\\&"),Zl(Jl,ec,hc,"&","\\&"),Zl(Ql,ec,hc,"ℵ","\\aleph",!0),Zl(Ql,ec,hc,"∀","\\forall",!0),Zl(Ql,ec,hc,"ℏ","\\hbar",!0),Zl(Ql,ec,hc,"∃","\\exists",!0),Zl(Ql,ec,hc,"∇","\\nabla",!0),Zl(Ql,ec,hc,"♭","\\flat",!0),Zl(Ql,ec,hc,"ℓ","\\ell",!0),
|
|
274
|
+
Zl(Ql,ec,hc,"♮","\\natural",!0),Zl(Ql,ec,hc,"♣","\\clubsuit",!0),Zl(Ql,ec,hc,"℘","\\wp",!0),Zl(Ql,ec,hc,"♯","\\sharp",!0),Zl(Ql,ec,hc,"♢","\\diamondsuit",!0),Zl(Ql,ec,hc,"ℜ","\\Re",!0),Zl(Ql,ec,hc,"♡","\\heartsuit",!0),Zl(Ql,ec,hc,"ℑ","\\Im",!0),Zl(Ql,ec,hc,"♠","\\spadesuit",!0),Zl(Ql,ec,hc,"§","\\S",!0),Zl(Jl,ec,hc,"§","\\S"),Zl(Ql,ec,hc,"¶","\\P",!0),Zl(Jl,ec,hc,"¶","\\P"),Zl(Ql,ec,hc,"†","\\dag"),Zl(Jl,ec,hc,"†","\\dag"),Zl(Jl,ec,hc,"†","\\textdagger"),Zl(Ql,ec,hc,"‡","\\ddag"),Zl(Jl,ec,hc,"‡","\\ddag"),Zl(Jl,ec,hc,"‡","\\textdaggerdbl"),Zl(Ql,ec,oc,"⎱","\\rmoustache",!0),Zl(Ql,ec,lc,"⎰","\\lmoustache",!0),Zl(Ql,ec,oc,"⟯","\\rgroup",!0),Zl(Ql,ec,lc,"⟮","\\lgroup",!0),Zl(Ql,ec,rc,"∓","\\mp",!0),Zl(Ql,ec,rc,"⊖","\\ominus",!0),Zl(Ql,ec,rc,"⊎","\\uplus",!0),Zl(Ql,ec,rc,"⊓","\\sqcap",!0),Zl(Ql,ec,rc,"∗","\\ast"),Zl(Ql,ec,rc,"⊔","\\sqcup",!0),Zl(Ql,ec,rc,"◯","\\bigcirc",!0),Zl(Ql,ec,rc,"∙","\\bullet",!0),Zl(Ql,ec,rc,"‡","\\ddagger"),Zl(Ql,ec,rc,"≀","\\wr",!0),Zl(Ql,ec,rc,"⨿","\\amalg"),Zl(Ql,ec,rc,"&","\\And"),
|
|
275
|
+
Zl(Ql,ec,uc,"⟵","\\longleftarrow",!0),Zl(Ql,ec,uc,"⇐","\\Leftarrow",!0),Zl(Ql,ec,uc,"⟸","\\Longleftarrow",!0),Zl(Ql,ec,uc,"⟶","\\longrightarrow",!0),Zl(Ql,ec,uc,"⇒","\\Rightarrow",!0),Zl(Ql,ec,uc,"⟹","\\Longrightarrow",!0),Zl(Ql,ec,uc,"↔","\\leftrightarrow",!0),Zl(Ql,ec,uc,"⟷","\\longleftrightarrow",!0),Zl(Ql,ec,uc,"⇔","\\Leftrightarrow",!0),Zl(Ql,ec,uc,"⟺","\\Longleftrightarrow",!0),Zl(Ql,ec,uc,"↦","\\mapsto",!0),Zl(Ql,ec,uc,"⟼","\\longmapsto",!0),Zl(Ql,ec,uc,"↗","\\nearrow",!0),Zl(Ql,ec,uc,"↩","\\hookleftarrow",!0),Zl(Ql,ec,uc,"↪","\\hookrightarrow",!0),Zl(Ql,ec,uc,"↘","\\searrow",!0),Zl(Ql,ec,uc,"↼","\\leftharpoonup",!0),Zl(Ql,ec,uc,"⇀","\\rightharpoonup",!0),Zl(Ql,ec,uc,"↙","\\swarrow",!0),Zl(Ql,ec,uc,"↽","\\leftharpoondown",!0),Zl(Ql,ec,uc,"⇁","\\rightharpoondown",!0),Zl(Ql,ec,uc,"↖","\\nwarrow",!0),Zl(Ql,ec,uc,"⇌","\\rightleftharpoons",!0),Zl(Ql,tc,uc,"≮","\\nless",!0),Zl(Ql,tc,uc,"","\\@nleqslant"),Zl(Ql,tc,uc,"","\\@nleqq"),Zl(Ql,tc,uc,"⪇","\\lneq",!0),Zl(Ql,tc,uc,"≨","\\lneqq",!0),
|
|
276
|
+
Zl(Ql,tc,uc,"","\\@lvertneqq"),Zl(Ql,tc,uc,"⋦","\\lnsim",!0),Zl(Ql,tc,uc,"⪉","\\lnapprox",!0),Zl(Ql,tc,uc,"⊀","\\nprec",!0),Zl(Ql,tc,uc,"⋠","\\npreceq",!0),Zl(Ql,tc,uc,"⋨","\\precnsim",!0),Zl(Ql,tc,uc,"⪹","\\precnapprox",!0),Zl(Ql,tc,uc,"≁","\\nsim",!0),Zl(Ql,tc,uc,"","\\@nshortmid"),Zl(Ql,tc,uc,"∤","\\nmid",!0),Zl(Ql,tc,uc,"⊬","\\nvdash",!0),Zl(Ql,tc,uc,"⊭","\\nvDash",!0),Zl(Ql,tc,uc,"⋪","\\ntriangleleft"),Zl(Ql,tc,uc,"⋬","\\ntrianglelefteq",!0),Zl(Ql,tc,uc,"⊊","\\subsetneq",!0),Zl(Ql,tc,uc,"","\\@varsubsetneq"),Zl(Ql,tc,uc,"⫋","\\subsetneqq",!0),Zl(Ql,tc,uc,"","\\@varsubsetneqq"),Zl(Ql,tc,uc,"≯","\\ngtr",!0),Zl(Ql,tc,uc,"","\\@ngeqslant"),Zl(Ql,tc,uc,"","\\@ngeqq"),Zl(Ql,tc,uc,"⪈","\\gneq",!0),Zl(Ql,tc,uc,"≩","\\gneqq",!0),Zl(Ql,tc,uc,"","\\@gvertneqq"),Zl(Ql,tc,uc,"⋧","\\gnsim",!0),Zl(Ql,tc,uc,"⪊","\\gnapprox",!0),Zl(Ql,tc,uc,"⊁","\\nsucc",!0),Zl(Ql,tc,uc,"⋡","\\nsucceq",!0),Zl(Ql,tc,uc,"⋩","\\succnsim",!0),Zl(Ql,tc,uc,"⪺","\\succnapprox",!0),Zl(Ql,tc,uc,"≆","\\ncong",!0),
|
|
277
|
+
Zl(Ql,tc,uc,"","\\@nshortparallel"),Zl(Ql,tc,uc,"∦","\\nparallel",!0),Zl(Ql,tc,uc,"⊯","\\nVDash",!0),Zl(Ql,tc,uc,"⋫","\\ntriangleright"),Zl(Ql,tc,uc,"⋭","\\ntrianglerighteq",!0),Zl(Ql,tc,uc,"","\\@nsupseteqq"),Zl(Ql,tc,uc,"⊋","\\supsetneq",!0),Zl(Ql,tc,uc,"","\\@varsupsetneq"),Zl(Ql,tc,uc,"⫌","\\supsetneqq",!0),Zl(Ql,tc,uc,"","\\@varsupsetneqq"),Zl(Ql,tc,uc,"⊮","\\nVdash",!0),Zl(Ql,tc,uc,"⪵","\\precneqq",!0),Zl(Ql,tc,uc,"⪶","\\succneqq",!0),Zl(Ql,tc,uc,"","\\@nsubseteqq"),Zl(Ql,tc,rc,"⊴","\\unlhd"),Zl(Ql,tc,rc,"⊵","\\unrhd"),Zl(Ql,tc,uc,"↚","\\nleftarrow",!0),Zl(Ql,tc,uc,"↛","\\nrightarrow",!0),Zl(Ql,tc,uc,"⇍","\\nLeftarrow",!0),Zl(Ql,tc,uc,"⇏","\\nRightarrow",!0),Zl(Ql,tc,uc,"↮","\\nleftrightarrow",!0),Zl(Ql,tc,uc,"⇎","\\nLeftrightarrow",!0),Zl(Ql,tc,uc,"△","\\vartriangle"),Zl(Ql,tc,hc,"ℏ","\\hslash"),Zl(Ql,tc,hc,"▽","\\triangledown"),Zl(Ql,tc,hc,"◊","\\lozenge"),Zl(Ql,tc,hc,"Ⓢ","\\circledS"),Zl(Ql,tc,hc,"®","\\circledR"),Zl(Jl,tc,hc,"®","\\circledR"),Zl(Ql,tc,hc,"∡","\\measuredangle",!0),
|
|
278
|
+
Zl(Ql,tc,hc,"∄","\\nexists"),Zl(Ql,tc,hc,"℧","\\mho"),Zl(Ql,tc,hc,"Ⅎ","\\Finv",!0),Zl(Ql,tc,hc,"⅁","\\Game",!0),Zl(Ql,tc,hc,"‵","\\backprime"),Zl(Ql,tc,hc,"▲","\\blacktriangle"),Zl(Ql,tc,hc,"▼","\\blacktriangledown"),Zl(Ql,tc,hc,"■","\\blacksquare"),Zl(Ql,tc,hc,"⧫","\\blacklozenge"),Zl(Ql,tc,hc,"★","\\bigstar"),Zl(Ql,tc,hc,"∢","\\sphericalangle",!0),Zl(Ql,tc,hc,"∁","\\complement",!0),Zl(Ql,tc,hc,"ð","\\eth",!0),Zl(Jl,ec,hc,"ð","ð"),Zl(Ql,tc,hc,"╱","\\diagup"),Zl(Ql,tc,hc,"╲","\\diagdown"),Zl(Ql,tc,hc,"□","\\square"),Zl(Ql,tc,hc,"□","\\Box"),Zl(Ql,tc,hc,"◊","\\Diamond"),Zl(Ql,tc,hc,"¥","\\yen",!0),Zl(Jl,tc,hc,"¥","\\yen",!0),Zl(Ql,tc,hc,"✓","\\checkmark",!0),Zl(Jl,tc,hc,"✓","\\checkmark"),Zl(Ql,tc,hc,"ℶ","\\beth",!0),Zl(Ql,tc,hc,"ℸ","\\daleth",!0),Zl(Ql,tc,hc,"ℷ","\\gimel",!0),Zl(Ql,tc,hc,"ϝ","\\digamma",!0),Zl(Ql,tc,hc,"ϰ","\\varkappa"),Zl(Ql,tc,lc,"┌","\\@ulcorner",!0),Zl(Ql,tc,oc,"┐","\\@urcorner",!0),Zl(Ql,tc,lc,"└","\\@llcorner",!0),Zl(Ql,tc,oc,"┘","\\@lrcorner",!0),Zl(Ql,tc,uc,"≦","\\leqq",!0),
|
|
279
|
+
Zl(Ql,tc,uc,"⩽","\\leqslant",!0),Zl(Ql,tc,uc,"⪕","\\eqslantless",!0),Zl(Ql,tc,uc,"≲","\\lesssim",!0),Zl(Ql,tc,uc,"⪅","\\lessapprox",!0),Zl(Ql,tc,uc,"≊","\\approxeq",!0),Zl(Ql,tc,rc,"⋖","\\lessdot"),Zl(Ql,tc,uc,"⋘","\\lll",!0),Zl(Ql,tc,uc,"≶","\\lessgtr",!0),Zl(Ql,tc,uc,"⋚","\\lesseqgtr",!0),Zl(Ql,tc,uc,"⪋","\\lesseqqgtr",!0),Zl(Ql,tc,uc,"≑","\\doteqdot"),Zl(Ql,tc,uc,"≓","\\risingdotseq",!0),Zl(Ql,tc,uc,"≒","\\fallingdotseq",!0),Zl(Ql,tc,uc,"∽","\\backsim",!0),Zl(Ql,tc,uc,"⋍","\\backsimeq",!0),Zl(Ql,tc,uc,"⫅","\\subseteqq",!0),Zl(Ql,tc,uc,"⋐","\\Subset",!0),Zl(Ql,tc,uc,"⊏","\\sqsubset",!0),Zl(Ql,tc,uc,"≼","\\preccurlyeq",!0),Zl(Ql,tc,uc,"⋞","\\curlyeqprec",!0),Zl(Ql,tc,uc,"≾","\\precsim",!0),Zl(Ql,tc,uc,"⪷","\\precapprox",!0),Zl(Ql,tc,uc,"⊲","\\vartriangleleft"),Zl(Ql,tc,uc,"⊴","\\trianglelefteq"),Zl(Ql,tc,uc,"⊨","\\vDash",!0),Zl(Ql,tc,uc,"⊪","\\Vvdash",!0),Zl(Ql,tc,uc,"⌣","\\smallsmile"),Zl(Ql,tc,uc,"⌢","\\smallfrown"),Zl(Ql,tc,uc,"≏","\\bumpeq",!0),Zl(Ql,tc,uc,"≎","\\Bumpeq",!0),Zl(Ql,tc,uc,"≧","\\geqq",!0),
|
|
280
|
+
Zl(Ql,tc,uc,"⩾","\\geqslant",!0),Zl(Ql,tc,uc,"⪖","\\eqslantgtr",!0),Zl(Ql,tc,uc,"≳","\\gtrsim",!0),Zl(Ql,tc,uc,"⪆","\\gtrapprox",!0),Zl(Ql,tc,rc,"⋗","\\gtrdot"),Zl(Ql,tc,uc,"⋙","\\ggg",!0),Zl(Ql,tc,uc,"≷","\\gtrless",!0),Zl(Ql,tc,uc,"⋛","\\gtreqless",!0),Zl(Ql,tc,uc,"⪌","\\gtreqqless",!0),Zl(Ql,tc,uc,"≖","\\eqcirc",!0),Zl(Ql,tc,uc,"≗","\\circeq",!0),Zl(Ql,tc,uc,"≜","\\triangleq",!0),Zl(Ql,tc,uc,"∼","\\thicksim"),Zl(Ql,tc,uc,"≈","\\thickapprox"),Zl(Ql,tc,uc,"⫆","\\supseteqq",!0),Zl(Ql,tc,uc,"⋑","\\Supset",!0),Zl(Ql,tc,uc,"⊐","\\sqsupset",!0),Zl(Ql,tc,uc,"≽","\\succcurlyeq",!0),Zl(Ql,tc,uc,"⋟","\\curlyeqsucc",!0),Zl(Ql,tc,uc,"≿","\\succsim",!0),Zl(Ql,tc,uc,"⪸","\\succapprox",!0),Zl(Ql,tc,uc,"⊳","\\vartriangleright"),Zl(Ql,tc,uc,"⊵","\\trianglerighteq"),Zl(Ql,tc,uc,"⊩","\\Vdash",!0),Zl(Ql,tc,uc,"∣","\\shortmid"),Zl(Ql,tc,uc,"∥","\\shortparallel"),Zl(Ql,tc,uc,"≬","\\between",!0),Zl(Ql,tc,uc,"⋔","\\pitchfork",!0),Zl(Ql,tc,uc,"∝","\\varpropto"),Zl(Ql,tc,uc,"◀","\\blacktriangleleft"),
|
|
281
|
+
Zl(Ql,tc,uc,"∴","\\therefore",!0),Zl(Ql,tc,uc,"∍","\\backepsilon"),Zl(Ql,tc,uc,"▶","\\blacktriangleright"),Zl(Ql,tc,uc,"∵","\\because",!0),Zl(Ql,tc,uc,"⋘","\\llless"),Zl(Ql,tc,uc,"⋙","\\gggtr"),Zl(Ql,tc,rc,"⊲","\\lhd"),Zl(Ql,tc,rc,"⊳","\\rhd"),Zl(Ql,tc,uc,"≂","\\eqsim",!0),Zl(Ql,ec,uc,"⋈","\\Join"),Zl(Ql,tc,uc,"≑","\\Doteq",!0),Zl(Ql,tc,rc,"∔","\\dotplus",!0),Zl(Ql,tc,rc,"∖","\\smallsetminus"),Zl(Ql,tc,rc,"⋒","\\Cap",!0),Zl(Ql,tc,rc,"⋓","\\Cup",!0),Zl(Ql,tc,rc,"⩞","\\doublebarwedge",!0),Zl(Ql,tc,rc,"⊟","\\boxminus",!0),Zl(Ql,tc,rc,"⊞","\\boxplus",!0),Zl(Ql,tc,rc,"⋇","\\divideontimes",!0),Zl(Ql,tc,rc,"⋉","\\ltimes",!0),Zl(Ql,tc,rc,"⋊","\\rtimes",!0),Zl(Ql,tc,rc,"⋋","\\leftthreetimes",!0),Zl(Ql,tc,rc,"⋌","\\rightthreetimes",!0),Zl(Ql,tc,rc,"⋏","\\curlywedge",!0),Zl(Ql,tc,rc,"⋎","\\curlyvee",!0),Zl(Ql,tc,rc,"⊝","\\circleddash",!0),Zl(Ql,tc,rc,"⊛","\\circledast",!0),Zl(Ql,tc,rc,"⋅","\\centerdot"),Zl(Ql,tc,rc,"⊺","\\intercal",!0),Zl(Ql,tc,rc,"⋒","\\doublecap"),Zl(Ql,tc,rc,"⋓","\\doublecup"),
|
|
282
|
+
Zl(Ql,tc,rc,"⊠","\\boxtimes",!0),Zl(Ql,tc,uc,"⇢","\\dashrightarrow",!0),Zl(Ql,tc,uc,"⇠","\\dashleftarrow",!0),Zl(Ql,tc,uc,"⇇","\\leftleftarrows",!0),Zl(Ql,tc,uc,"⇆","\\leftrightarrows",!0),Zl(Ql,tc,uc,"⇚","\\Lleftarrow",!0),Zl(Ql,tc,uc,"↞","\\twoheadleftarrow",!0),Zl(Ql,tc,uc,"↢","\\leftarrowtail",!0),Zl(Ql,tc,uc,"↫","\\looparrowleft",!0),Zl(Ql,tc,uc,"⇋","\\leftrightharpoons",!0),Zl(Ql,tc,uc,"↶","\\curvearrowleft",!0),Zl(Ql,tc,uc,"↺","\\circlearrowleft",!0),Zl(Ql,tc,uc,"↰","\\Lsh",!0),Zl(Ql,tc,uc,"⇈","\\upuparrows",!0),Zl(Ql,tc,uc,"↿","\\upharpoonleft",!0),Zl(Ql,tc,uc,"⇃","\\downharpoonleft",!0),Zl(Ql,ec,uc,"⊶","\\origof",!0),Zl(Ql,ec,uc,"⊷","\\imageof",!0),Zl(Ql,tc,uc,"⊸","\\multimap",!0),Zl(Ql,tc,uc,"↭","\\leftrightsquigarrow",!0),Zl(Ql,tc,uc,"⇉","\\rightrightarrows",!0),Zl(Ql,tc,uc,"⇄","\\rightleftarrows",!0),Zl(Ql,tc,uc,"↠","\\twoheadrightarrow",!0),Zl(Ql,tc,uc,"↣","\\rightarrowtail",!0),Zl(Ql,tc,uc,"↬","\\looparrowright",!0),Zl(Ql,tc,uc,"↷","\\curvearrowright",!0),
|
|
283
|
+
Zl(Ql,tc,uc,"↻","\\circlearrowright",!0),Zl(Ql,tc,uc,"↱","\\Rsh",!0),Zl(Ql,tc,uc,"⇊","\\downdownarrows",!0),Zl(Ql,tc,uc,"↾","\\upharpoonright",!0),Zl(Ql,tc,uc,"⇂","\\downharpoonright",!0),Zl(Ql,tc,uc,"⇝","\\rightsquigarrow",!0),Zl(Ql,tc,uc,"⇝","\\leadsto"),Zl(Ql,tc,uc,"⇛","\\Rrightarrow",!0),Zl(Ql,tc,uc,"↾","\\restriction"),Zl(Ql,ec,hc,"‘","`"),Zl(Ql,ec,hc,"$","\\$"),Zl(Jl,ec,hc,"$","\\$"),Zl(Jl,ec,hc,"$","\\textdollar"),Zl(Ql,ec,hc,"%","\\%"),Zl(Jl,ec,hc,"%","\\%"),Zl(Ql,ec,hc,"_","\\_"),Zl(Jl,ec,hc,"_","\\_"),Zl(Jl,ec,hc,"_","\\textunderscore"),Zl(Ql,ec,hc,"∠","\\angle",!0),Zl(Ql,ec,hc,"∞","\\infty",!0),Zl(Ql,ec,hc,"′","\\prime"),Zl(Ql,ec,hc,"△","\\triangle"),Zl(Ql,ec,hc,"Γ","\\Gamma",!0),Zl(Ql,ec,hc,"Δ","\\Delta",!0),Zl(Ql,ec,hc,"Θ","\\Theta",!0),Zl(Ql,ec,hc,"Λ","\\Lambda",!0),Zl(Ql,ec,hc,"Ξ","\\Xi",!0),Zl(Ql,ec,hc,"Π","\\Pi",!0),Zl(Ql,ec,hc,"Σ","\\Sigma",!0),Zl(Ql,ec,hc,"Υ","\\Upsilon",!0),Zl(Ql,ec,hc,"Φ","\\Phi",!0),Zl(Ql,ec,hc,"Ψ","\\Psi",!0),Zl(Ql,ec,hc,"Ω","\\Omega",!0),Zl(Ql,ec,hc,"A","Α"),
|
|
284
|
+
Zl(Ql,ec,hc,"B","Β"),Zl(Ql,ec,hc,"E","Ε"),Zl(Ql,ec,hc,"Z","Ζ"),Zl(Ql,ec,hc,"H","Η"),Zl(Ql,ec,hc,"I","Ι"),Zl(Ql,ec,hc,"K","Κ"),Zl(Ql,ec,hc,"M","Μ"),Zl(Ql,ec,hc,"N","Ν"),Zl(Ql,ec,hc,"O","Ο"),Zl(Ql,ec,hc,"P","Ρ"),Zl(Ql,ec,hc,"T","Τ"),Zl(Ql,ec,hc,"X","Χ"),Zl(Ql,ec,hc,"¬","\\neg",!0),Zl(Ql,ec,hc,"¬","\\lnot"),Zl(Ql,ec,hc,"⊤","\\top"),Zl(Ql,ec,hc,"⊥","\\bot"),Zl(Ql,ec,hc,"∅","\\emptyset"),Zl(Ql,tc,hc,"∅","\\varnothing"),Zl(Ql,ec,ac,"α","\\alpha",!0),Zl(Ql,ec,ac,"β","\\beta",!0),Zl(Ql,ec,ac,"γ","\\gamma",!0),Zl(Ql,ec,ac,"δ","\\delta",!0),Zl(Ql,ec,ac,"ϵ","\\epsilon",!0),Zl(Ql,ec,ac,"ζ","\\zeta",!0),Zl(Ql,ec,ac,"η","\\eta",!0),Zl(Ql,ec,ac,"θ","\\theta",!0),Zl(Ql,ec,ac,"ι","\\iota",!0),Zl(Ql,ec,ac,"κ","\\kappa",!0),Zl(Ql,ec,ac,"λ","\\lambda",!0),Zl(Ql,ec,ac,"μ","\\mu",!0),Zl(Ql,ec,ac,"ν","\\nu",!0),Zl(Ql,ec,ac,"ξ","\\xi",!0),Zl(Ql,ec,ac,"ο","\\omicron",!0),Zl(Ql,ec,ac,"π","\\pi",!0),Zl(Ql,ec,ac,"ρ","\\rho",!0),Zl(Ql,ec,ac,"σ","\\sigma",!0),Zl(Ql,ec,ac,"τ","\\tau",!0),Zl(Ql,ec,ac,"υ","\\upsilon",!0),
|
|
285
|
+
Zl(Ql,ec,ac,"ϕ","\\phi",!0),Zl(Ql,ec,ac,"χ","\\chi",!0),Zl(Ql,ec,ac,"ψ","\\psi",!0),Zl(Ql,ec,ac,"ω","\\omega",!0),Zl(Ql,ec,ac,"ε","\\varepsilon",!0),Zl(Ql,ec,ac,"ϑ","\\vartheta",!0),Zl(Ql,ec,ac,"ϖ","\\varpi",!0),Zl(Ql,ec,ac,"ϱ","\\varrho",!0),Zl(Ql,ec,ac,"ς","\\varsigma",!0),Zl(Ql,ec,ac,"φ","\\varphi",!0),Zl(Ql,ec,rc,"∗","*",!0),Zl(Ql,ec,rc,"+","+"),Zl(Ql,ec,rc,"−","-",!0),Zl(Ql,ec,rc,"⋅","\\cdot",!0),Zl(Ql,ec,rc,"∘","\\circ",!0),Zl(Ql,ec,rc,"÷","\\div",!0),Zl(Ql,ec,rc,"±","\\pm",!0),Zl(Ql,ec,rc,"×","\\times",!0),Zl(Ql,ec,rc,"∩","\\cap",!0),Zl(Ql,ec,rc,"∪","\\cup",!0),Zl(Ql,ec,rc,"∖","\\setminus",!0),Zl(Ql,ec,rc,"∧","\\land"),Zl(Ql,ec,rc,"∨","\\lor"),Zl(Ql,ec,rc,"∧","\\wedge",!0),Zl(Ql,ec,rc,"∨","\\vee",!0),Zl(Ql,ec,hc,"√","\\surd"),Zl(Ql,ec,lc,"⟨","\\langle",!0),Zl(Ql,ec,lc,"∣","\\lvert"),Zl(Ql,ec,lc,"∥","\\lVert"),Zl(Ql,ec,oc,"?","?"),Zl(Ql,ec,oc,"!","!"),Zl(Ql,ec,oc,"⟩","\\rangle",!0),Zl(Ql,ec,oc,"∣","\\rvert"),Zl(Ql,ec,oc,"∥","\\rVert"),Zl(Ql,ec,uc,"=","="),Zl(Ql,ec,uc,":",":"),
|
|
286
|
+
Zl(Ql,ec,uc,"≈","\\approx",!0),Zl(Ql,ec,uc,"≅","\\cong",!0),Zl(Ql,ec,uc,"≥","\\ge"),Zl(Ql,ec,uc,"≥","\\geq",!0),Zl(Ql,ec,uc,"←","\\gets"),Zl(Ql,ec,uc,">","\\gt",!0),Zl(Ql,ec,uc,"∈","\\in",!0),Zl(Ql,ec,uc,"","\\@not"),Zl(Ql,ec,uc,"⊂","\\subset",!0),Zl(Ql,ec,uc,"⊃","\\supset",!0),Zl(Ql,ec,uc,"⊆","\\subseteq",!0),Zl(Ql,ec,uc,"⊇","\\supseteq",!0),Zl(Ql,tc,uc,"⊈","\\nsubseteq",!0),Zl(Ql,tc,uc,"⊉","\\nsupseteq",!0),Zl(Ql,ec,uc,"⊨","\\models"),Zl(Ql,ec,uc,"←","\\leftarrow",!0),Zl(Ql,ec,uc,"≤","\\le"),Zl(Ql,ec,uc,"≤","\\leq",!0),Zl(Ql,ec,uc,"<","\\lt",!0),Zl(Ql,ec,uc,"→","\\rightarrow",!0),Zl(Ql,ec,uc,"→","\\to"),Zl(Ql,tc,uc,"≱","\\ngeq",!0),Zl(Ql,tc,uc,"≰","\\nleq",!0),Zl(Ql,ec,dc," ","\\ "),Zl(Ql,ec,dc," ","\\space"),Zl(Ql,ec,dc," ","\\nobreakspace"),Zl(Jl,ec,dc," ","\\ "),Zl(Jl,ec,dc," "," "),Zl(Jl,ec,dc," ","\\space"),Zl(Jl,ec,dc," ","\\nobreakspace"),Zl(Ql,ec,dc,null,"\\nobreak"),Zl(Ql,ec,dc,null,"\\allowbreak"),Zl(Ql,ec,cc,",",","),Zl(Ql,ec,cc,";",";"),Zl(Ql,tc,rc,"⊼","\\barwedge",!0),
|
|
287
|
+
Zl(Ql,tc,rc,"⊻","\\veebar",!0),Zl(Ql,ec,rc,"⊙","\\odot",!0),Zl(Ql,ec,rc,"⊕","\\oplus",!0),Zl(Ql,ec,rc,"⊗","\\otimes",!0),Zl(Ql,ec,hc,"∂","\\partial",!0),Zl(Ql,ec,rc,"⊘","\\oslash",!0),Zl(Ql,tc,rc,"⊚","\\circledcirc",!0),Zl(Ql,tc,rc,"⊡","\\boxdot",!0),Zl(Ql,ec,rc,"△","\\bigtriangleup"),Zl(Ql,ec,rc,"▽","\\bigtriangledown"),Zl(Ql,ec,rc,"†","\\dagger"),Zl(Ql,ec,rc,"⋄","\\diamond"),Zl(Ql,ec,rc,"⋆","\\star"),Zl(Ql,ec,rc,"◃","\\triangleleft"),Zl(Ql,ec,rc,"▹","\\triangleright"),Zl(Ql,ec,lc,"{","\\{"),Zl(Jl,ec,hc,"{","\\{"),Zl(Jl,ec,hc,"{","\\textbraceleft"),Zl(Ql,ec,oc,"}","\\}"),Zl(Jl,ec,hc,"}","\\}"),Zl(Jl,ec,hc,"}","\\textbraceright"),Zl(Ql,ec,lc,"{","\\lbrace"),Zl(Ql,ec,oc,"}","\\rbrace"),Zl(Ql,ec,lc,"[","\\lbrack",!0),Zl(Jl,ec,hc,"[","\\lbrack",!0),Zl(Ql,ec,oc,"]","\\rbrack",!0),Zl(Jl,ec,hc,"]","\\rbrack",!0),Zl(Ql,ec,lc,"(","\\lparen",!0),Zl(Ql,ec,oc,")","\\rparen",!0),Zl(Jl,ec,hc,"<","\\textless",!0),Zl(Jl,ec,hc,">","\\textgreater",!0),Zl(Ql,ec,lc,"⌊","\\lfloor",!0),Zl(Ql,ec,oc,"⌋","\\rfloor",!0),
|
|
288
|
+
Zl(Ql,ec,lc,"⌈","\\lceil",!0),Zl(Ql,ec,oc,"⌉","\\rceil",!0),Zl(Ql,ec,hc,"\\","\\backslash"),Zl(Ql,ec,hc,"∣","|"),Zl(Ql,ec,hc,"∣","\\vert"),Zl(Jl,ec,hc,"|","\\textbar",!0),Zl(Ql,ec,hc,"∥","\\|"),Zl(Ql,ec,hc,"∥","\\Vert"),Zl(Jl,ec,hc,"∥","\\textbardbl"),Zl(Jl,ec,hc,"~","\\textasciitilde"),Zl(Jl,ec,hc,"\\","\\textbackslash"),Zl(Jl,ec,hc,"^","\\textasciicircum"),Zl(Ql,ec,uc,"↑","\\uparrow",!0),Zl(Ql,ec,uc,"⇑","\\Uparrow",!0),Zl(Ql,ec,uc,"↓","\\downarrow",!0),Zl(Ql,ec,uc,"⇓","\\Downarrow",!0),Zl(Ql,ec,uc,"↕","\\updownarrow",!0),Zl(Ql,ec,uc,"⇕","\\Updownarrow",!0),Zl(Ql,ec,sc,"∐","\\coprod"),Zl(Ql,ec,sc,"⋁","\\bigvee"),Zl(Ql,ec,sc,"⋀","\\bigwedge"),Zl(Ql,ec,sc,"⨄","\\biguplus"),Zl(Ql,ec,sc,"⋂","\\bigcap"),Zl(Ql,ec,sc,"⋃","\\bigcup"),Zl(Ql,ec,sc,"∫","\\int"),Zl(Ql,ec,sc,"∫","\\intop"),Zl(Ql,ec,sc,"∬","\\iint"),Zl(Ql,ec,sc,"∭","\\iiint"),Zl(Ql,ec,sc,"∏","\\prod"),Zl(Ql,ec,sc,"∑","\\sum"),Zl(Ql,ec,sc,"⨂","\\bigotimes"),Zl(Ql,ec,sc,"⨁","\\bigoplus"),Zl(Ql,ec,sc,"⨀","\\bigodot"),Zl(Ql,ec,sc,"∮","\\oint"),
|
|
289
|
+
Zl(Ql,ec,sc,"∯","\\oiint"),Zl(Ql,ec,sc,"∰","\\oiiint"),Zl(Ql,ec,sc,"⨆","\\bigsqcup"),Zl(Ql,ec,sc,"∫","\\smallint"),Zl(Jl,ec,ic,"…","\\textellipsis"),Zl(Ql,ec,ic,"…","\\mathellipsis"),Zl(Jl,ec,ic,"…","\\ldots",!0),Zl(Ql,ec,ic,"…","\\ldots",!0),Zl(Ql,ec,ic,"⋯","\\@cdots",!0),Zl(Ql,ec,ic,"⋱","\\ddots",!0),Zl(Ql,ec,hc,"⋮","\\varvdots"),Zl(Jl,ec,hc,"⋮","\\varvdots"),Zl(Ql,ec,nc,"ˊ","\\acute"),Zl(Ql,ec,nc,"ˋ","\\grave"),Zl(Ql,ec,nc,"¨","\\ddot"),Zl(Ql,ec,nc,"~","\\tilde"),Zl(Ql,ec,nc,"ˉ","\\bar"),Zl(Ql,ec,nc,"˘","\\breve"),Zl(Ql,ec,nc,"ˇ","\\check"),Zl(Ql,ec,nc,"^","\\hat"),Zl(Ql,ec,nc,"⃗","\\vec"),Zl(Ql,ec,nc,"˙","\\dot"),Zl(Ql,ec,nc,"˚","\\mathring"),Zl(Ql,ec,ac,"","\\@imath"),Zl(Ql,ec,ac,"","\\@jmath"),Zl(Ql,ec,hc,"ı","ı"),Zl(Ql,ec,hc,"ȷ","ȷ"),Zl(Jl,ec,hc,"ı","\\i",!0),Zl(Jl,ec,hc,"ȷ","\\j",!0),Zl(Jl,ec,hc,"ß","\\ss",!0),Zl(Jl,ec,hc,"æ","\\ae",!0),Zl(Jl,ec,hc,"œ","\\oe",!0),Zl(Jl,ec,hc,"ø","\\o",!0),Zl(Jl,ec,hc,"Æ","\\AE",!0),Zl(Jl,ec,hc,"Œ","\\OE",!0),Zl(Jl,ec,hc,"Ø","\\O",!0),Zl(Jl,ec,nc,"ˊ","\\'"),
|
|
290
|
+
Zl(Jl,ec,nc,"ˋ","\\`"),Zl(Jl,ec,nc,"ˆ","\\^"),Zl(Jl,ec,nc,"˜","\\~"),Zl(Jl,ec,nc,"ˉ","\\="),Zl(Jl,ec,nc,"˘","\\u"),Zl(Jl,ec,nc,"˙","\\."),Zl(Jl,ec,nc,"¸","\\c"),Zl(Jl,ec,nc,"˚","\\r"),Zl(Jl,ec,nc,"ˇ","\\v"),Zl(Jl,ec,nc,"¨",'\\"'),Zl(Jl,ec,nc,"˝","\\H"),Zl(Jl,ec,nc,"◯","\\textcircled");var pc={"--":!0,"---":!0,"``":!0,"''":!0};Zl(Jl,ec,hc,"–","--",!0),Zl(Jl,ec,hc,"–","\\textendash"),Zl(Jl,ec,hc,"—","---",!0),Zl(Jl,ec,hc,"—","\\textemdash"),Zl(Jl,ec,hc,"‘","`",!0),Zl(Jl,ec,hc,"‘","\\textquoteleft"),Zl(Jl,ec,hc,"’","'",!0),Zl(Jl,ec,hc,"’","\\textquoteright"),Zl(Jl,ec,hc,"“","``",!0),Zl(Jl,ec,hc,"“","\\textquotedblleft"),Zl(Jl,ec,hc,"”","''",!0),Zl(Jl,ec,hc,"”","\\textquotedblright"),Zl(Ql,ec,hc,"°","\\degree",!0),Zl(Jl,ec,hc,"°","\\degree"),Zl(Jl,ec,hc,"°","\\textdegree",!0),Zl(Ql,ec,hc,"£","\\pounds"),Zl(Ql,ec,hc,"£","\\mathsterling",!0),Zl(Jl,ec,hc,"£","\\pounds"),Zl(Jl,ec,hc,"£","\\textsterling",!0),Zl(Ql,tc,hc,"✠","\\maltese"),Zl(Jl,tc,hc,"✠","\\maltese");for(var mc='0123456789/@."',fc=0;fc<14;fc++){
|
|
291
|
+
var gc=mc.charAt(fc);Zl(Ql,ec,hc,gc,gc)}for(var vc='0123456789!@*()-=+";:?/.,',bc=0;bc<25;bc++){var yc=vc.charAt(bc);Zl(Jl,ec,hc,yc,yc)}for(var _c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",wc=0;wc<52;wc++){var xc=_c.charAt(wc);Zl(Ql,ec,ac,xc,xc),Zl(Jl,ec,hc,xc,xc)}Zl(Ql,tc,hc,"C","ℂ"),Zl(Jl,tc,hc,"C","ℂ"),Zl(Ql,tc,hc,"H","ℍ"),Zl(Jl,tc,hc,"H","ℍ"),Zl(Ql,tc,hc,"N","ℕ"),Zl(Jl,tc,hc,"N","ℕ"),Zl(Ql,tc,hc,"P","ℙ"),Zl(Jl,tc,hc,"P","ℙ"),Zl(Ql,tc,hc,"Q","ℚ"),Zl(Jl,tc,hc,"Q","ℚ"),Zl(Ql,tc,hc,"R","ℝ"),Zl(Jl,tc,hc,"R","ℝ"),Zl(Ql,tc,hc,"Z","ℤ"),Zl(Jl,tc,hc,"Z","ℤ"),Zl(Ql,ec,ac,"h","ℎ"),Zl(Jl,ec,ac,"h","ℎ");for(var kc="",Sc=0;Sc<52;Sc++){var Ac=_c.charAt(Sc);Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56320+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56372+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56424+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56580+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56684+Sc)),
|
|
292
|
+
Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56736+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56788+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56840+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56944+Sc)),Zl(Jl,ec,hc,Ac,kc),Sc<26&&(Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56632+Sc)),Zl(Jl,ec,hc,Ac,kc),Zl(Ql,ec,ac,Ac,kc=String.fromCharCode(55349,56476+Sc)),Zl(Jl,ec,hc,Ac,kc))}Zl(Ql,ec,ac,"k",kc=String.fromCharCode(55349,56668)),Zl(Jl,ec,hc,"k",kc);for(var Tc=0;Tc<10;Tc++){var Ec=Tc.toString();Zl(Ql,ec,ac,Ec,kc=String.fromCharCode(55349,57294+Tc)),Zl(Jl,ec,hc,Ec,kc),Zl(Ql,ec,ac,Ec,kc=String.fromCharCode(55349,57314+Tc)),Zl(Jl,ec,hc,Ec,kc),Zl(Ql,ec,ac,Ec,kc=String.fromCharCode(55349,57324+Tc)),Zl(Jl,ec,hc,Ec,kc),Zl(Ql,ec,ac,Ec,kc=String.fromCharCode(55349,57334+Tc)),Zl(Jl,ec,hc,Ec,kc)}for(var Cc="ÐÞþ",Mc=0;Mc<3;Mc++){var Nc=Cc.charAt(Mc);Zl(Ql,ec,ac,Nc,Nc),Zl(Jl,ec,hc,Nc,Nc)}
|
|
293
|
+
var Ic=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Oc=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],zc=function(e,t,n){
|
|
294
|
+
return Xl[n][e]&&Xl[n][e].replace&&(e=Xl[n][e].replace),{value:e,metrics:kl(e,t,n)}},Lc=function(e,t,n,r,o){var i,a=zc(e,t,n),s=a.metrics;if(e=a.value,s){var l=s.italic;("text"===n||r&&"mathit"===r.font)&&(l=0),i=new ql(e,s.height,s.depth,l,s.skew,s.width,o)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"' and mode '"+n+"'"),i=new ql(e,0,0,0,0,0,o);if(r){i.maxFontSize=r.sizeMultiplier,r.style.isTight()&&i.classes.push("mtight");var c=r.getColor();c&&(i.style.color=c)}return i},Pc=(e,t)=>{if(Ll(e.classes)!==Ll(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(1===e.classes.length){var n=e.classes[0];if("mbin"===n||"mord"===n)return!1}for(var r in e.style)if(e.style.hasOwnProperty(r)&&e.style[r]!==t.style[r])return!1;for(var o in t.style)if(t.style.hasOwnProperty(o)&&e.style[o]!==t.style[o])return!1;return!0},Rc=function(e){for(var t=0,n=0,r=0,o=0;o<e.children.length;o++){var i=e.children[o];i.height>t&&(t=i.height),i.depth>n&&(n=i.depth),
|
|
295
|
+
i.maxFontSize>r&&(r=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},Dc=function(e,t,n,r){var o=new Hl(e,t,n,r);return Rc(o),o},jc=(e,t,n,r)=>new Hl(e,t,n,r),Hc=function(e){var t=new yl(e);return Rc(t),t},Fc=function(e,t,n){var r="";switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return r+"-"+("textbf"===t&&"textit"===n?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},$c={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",
|
|
296
|
+
fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Bc={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},qc={fontMap:$c,makeSymbol:Lc,mathsym:function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&zc(e,"Main-Bold",t).metrics?Lc(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===Xl[t][e].font?Lc(e,"Main-Regular",t,n,r):Lc(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},makeSpan:Dc,makeSvgSpan:jc,makeLineSpan:function(e,t,n){var r=Dc([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=zl(r.height),r.maxFontSize=1,r},makeAnchor:function(e,t,n,r){var o=new Fl(e,t,n,r);return Rc(o),o},makeFragment:Hc,wrapFragment:function(e,t){return e instanceof yl?Dc([],[e],t):e},makeVList:function(e,t){
|
|
297
|
+
for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,o=r,i=1;i<t.length;i++){var a=-t[i].shift-o-t[i].elem.depth,s=a-(t[i-1].elem.height+t[i-1].elem.depth);o+=a,n.push({type:"kern",size:s}),n.push(t[i])}return{children:n,depth:r}}var l;if("top"===e.positionType){for(var c=e.positionData,u=0;u<e.children.length;u++){var d=e.children[u];c-="kern"===d.type?d.size:d.elem.height+d.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var h=e.children[0];if("elem"!==h.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-h.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-h.elem.depth}}return{children:e.children,depth:l}}(e),o=0,i=0;i<n.length;i++){var a=n[i];if("elem"===a.type){var s=a.elem;o=Math.max(o,s.maxFontSize,s.height)}}o+=2;var l=Dc(["pstrut"],[]);l.style.height=zl(o)
|
|
298
|
+
;for(var c=[],u=r,d=r,h=r,p=0;p<n.length;p++){var m=n[p];if("kern"===m.type)h+=m.size;else{var f=m.elem,g=m.wrapperClasses||[],v=m.wrapperStyle||{},b=Dc(g,[l,f],void 0,v);b.style.top=zl(-o-h-f.depth),m.marginLeft&&(b.style.marginLeft=m.marginLeft),m.marginRight&&(b.style.marginRight=m.marginRight),c.push(b),h+=f.height+f.depth}u=Math.min(u,h),d=Math.max(d,h)}var y,_=Dc(["vlist"],c);if(_.style.height=zl(d),u<0){var w=Dc([],[]),x=Dc(["vlist"],[w]);x.style.height=zl(-u);var k=Dc(["vlist-s"],[new ql("")]);y=[Dc(["vlist-r"],[_,k]),Dc(["vlist-r"],[x])]}else y=[Dc(["vlist-r"],[_])];var S=Dc(["vlist-t"],y);return 2===y.length&&S.classes.push("vlist-t2"),S.height=d,S.depth=-u,S},makeOrd:function(e,t,n){var r=e.mode,o=e.text,i=["mord"],a="math"===r||"text"===r&&t.font,s=a?t.font:t.fontFamily,l="",c="";if(55349===o.charCodeAt(0)&&([l,c]=function(e,t){var n=1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536,r="math"===t?0:1;if(119808<=n&&n<120484){var o=Math.floor((n-119808)/26);return[Ic[o][2],Ic[o][r]]}
|
|
299
|
+
if(120782<=n&&n<=120831){var i=Math.floor((n-120782)/10);return[Oc[i][2],Oc[i][r]]}if(120485===n||120486===n)return[Ic[0][2],Ic[0][r]];if(120486<n&&n<120782)return["",""];throw new Xs("Unsupported character: "+e)}(o,r)),l.length>0)return Lc(o,l,r,t,i.concat(c));if(s){var u,d;if("boldsymbol"===s){var h=function(e,t,n,r,o){return"textord"!==o&&zc(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(o,r,0,0,n);u=h.fontName,d=[h.fontClass]}else a?(u=$c[s].fontName,d=[s]):(u=Fc(s,t.fontWeight,t.fontShape),d=[s,t.fontWeight,t.fontShape]);if(zc(o,u,r).metrics)return Lc(o,u,r,t,i.concat(d));if(pc.hasOwnProperty(o)&&"Typewriter"===u.slice(0,10)){for(var p=[],m=0;m<o.length;m++)p.push(Lc(o[m],u,r,t,i.concat(d)));return Hc(p)}}if("mathord"===n)return Lc(o,"Math-Italic",r,t,i.concat(["mathnormal"]));if("textord"===n){var f=Xl[r][o]&&Xl[r][o].font;if("ams"===f){var g=Fc("amsrm",t.fontWeight,t.fontShape)
|
|
300
|
+
;return Lc(o,g,r,t,i.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==f&&f){var v=Fc(f,t.fontWeight,t.fontShape);return Lc(o,v,r,t,i.concat(v,t.fontWeight,t.fontShape))}var b=Fc("textrm",t.fontWeight,t.fontShape);return Lc(o,b,r,t,i.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+n+" in makeOrd")},makeGlue:(e,t)=>{var n=Dc(["mspace"],[],t),r=Ol(e,t);return n.style.marginRight=zl(r),n},staticSvg:function(e,t){var[n,r,o]=Bc[e],i=new Gl(n),a=new Ul([i],{width:zl(r),height:zl(o),style:"width:"+zl(r),viewBox:"0 0 "+1e3*r+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),s=jc(["overlay"],[a],t);return s.height=o,s.style.height=zl(o),s.style.width=zl(r),s},svgData:Bc,tryCombineChars:e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof ql&&r instanceof ql&&Pc(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e}},Uc={number:3,unit:"mu"},Gc={number:4,unit:"mu"},Vc={number:5,unit:"mu"},Wc={mord:{
|
|
301
|
+
mop:Uc,mbin:Gc,mrel:Vc,minner:Uc},mop:{mord:Uc,mop:Uc,mrel:Vc,minner:Uc},mbin:{mord:Gc,mop:Gc,mopen:Gc,minner:Gc},mrel:{mord:Vc,mop:Vc,mopen:Vc,minner:Vc},mopen:{},mclose:{mop:Uc,mbin:Gc,mrel:Vc,minner:Uc},mpunct:{mord:Uc,mop:Uc,mrel:Vc,mopen:Uc,mclose:Uc,mpunct:Uc,minner:Uc},minner:{mord:Uc,mop:Uc,mbin:Gc,mrel:Vc,mopen:Uc,mpunct:Uc,minner:Uc}},Kc={mord:{mop:Uc},mop:{mord:Uc,mop:Uc},mbin:{},mrel:{},mopen:{},mclose:{mop:Uc},mpunct:{},minner:{mop:Uc}},Yc={},Xc={},Zc={};function Qc(e){for(var{type:t,names:n,props:r,handler:o,htmlBuilder:i,mathmlBuilder:a}=e,s={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:o},l=0;l<n.length;++l)Yc[n[l]]=s;t&&(i&&(Xc[t]=i),a&&(Zc[t]=a))}function Jc(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Qc({type:t,names:[],props:{numArgs:0},handler(){
|
|
302
|
+
throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var eu=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},tu=function(e){return"ordgroup"===e.type?e.body:[e]},nu=qc.makeSpan,ru=["leftmost","mbin","mopen","mrel","mop","mpunct"],ou=["rightmost","mrel","mclose","mpunct"],iu={display:pl.DISPLAY,text:pl.TEXT,script:pl.SCRIPT,scriptscript:pl.SCRIPTSCRIPT},au={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},su=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var o=[],i=0;i<e.length;i++){var a=pu(e[i],t);if(a instanceof yl){var s=a.children;o.push(...s)}else o.push(a)}if(qc.tryCombineChars(o),!n)return o;var l=t;if(1===e.length){var c=e[0];"sizing"===c.type?l=t.havingSize(c.size):"styling"===c.type&&(l=t.havingStyle(iu[c.style]))}var u=nu([r[0]||"leftmost"],[],t),d=nu([r[1]||"rightmost"],[],t),h="root"===n;return lu(o,((e,t)=>{var n=t.classes[0],r=e.classes[0]
|
|
303
|
+
;"mbin"===n&&ou.includes(r)?t.classes[0]="mord":"mbin"===r&&ru.includes(n)&&(e.classes[0]="mord")}),{node:u},d,h),lu(o,((e,t)=>{var n=du(t),r=du(e),o=n&&r?e.hasClass("mtight")?Kc[n][r]:Wc[n][r]:null;if(o)return qc.makeGlue(o,l)}),{node:u},d,h),o},lu=function e(t,n,r,o,i){o&&t.push(o);for(var a=0;a<t.length;a++){var s=t[a],l=cu(s);if(l)e(l.children,n,r,null,i);else{var c=!s.hasClass("mspace");if(c){var u=n(s,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),a++))}c?r.node=s:i&&s.hasClass("newline")&&(r.node=nu(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),a++})(a)}}o&&t.pop()},cu=function(e){return e instanceof yl||e instanceof Fl||e instanceof Hl&&e.hasClass("enclosing")?e:null},uu=function e(t,n){var r=cu(t);if(r){var o=r.children;if(o.length){if("right"===n)return e(o[o.length-1],"right");if("left"===n)return e(o[0],"left")}}return t},du=function(e,t){return e?(t&&(e=uu(e,t)),au[e.classes[0]]||null):null},hu=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses())
|
|
304
|
+
;return nu(t.concat(n))},pu=function(e,t,n){if(!e)return nu();if(Xc[e.type]){var r=Xc[e.type](e,t);if(n&&t.size!==n.size){r=nu(t.sizingClasses(n),[r],t);var o=t.sizeMultiplier/n.sizeMultiplier;r.height*=o,r.depth*=o}return r}throw new Xs("Got group of unknown type: '"+e.type+"'")};function mu(e,t){var n=nu(["base"],e,t),r=nu(["strut"]);return r.style.height=zl(n.height+n.depth),n.depth&&(r.style.verticalAlign=zl(-n.depth)),n.children.unshift(r),n}function fu(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,o=su(e,t,"root");2===o.length&&o[1].hasClass("tag")&&(r=o.pop());for(var i,a=[],s=[],l=0;l<o.length;l++)if(s.push(o[l]),o[l].hasClass("mbin")||o[l].hasClass("mrel")||o[l].hasClass("allowbreak")){for(var c=!1;l<o.length-1&&o[l+1].hasClass("mspace")&&!o[l+1].hasClass("newline");)l++,s.push(o[l]),o[l].hasClass("nobreak")&&(c=!0);c||(a.push(mu(s,t)),s=[])}else o[l].hasClass("newline")&&(s.pop(),s.length>0&&(a.push(mu(s,t)),s=[]),a.push(o[l]));s.length>0&&a.push(mu(s,t)),
|
|
305
|
+
n?((i=mu(su(n,t,!0))).classes=["tag"],a.push(i)):r&&a.push(r);var u=nu(["katex-html"],a);if(u.setAttribute("aria-hidden","true"),i){var d=i.children[0];d.style.height=zl(u.height+u.depth),u.depth&&(d.style.verticalAlign=zl(-u.depth))}return u}function gu(e){return new yl(e)}class vu{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Ll(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof bu&&this.children[n+1]instanceof bu){
|
|
306
|
+
for(var r=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof bu;)r+=this.children[++n].toText();e.appendChild(new bu(r).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=tl.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+tl.escape(Ll(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">"}toText(){return this.children.map((e=>e.toText())).join("")}}class bu{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return tl.escape(this.toText())}toText(){return this.text}}var yu={MathNode:vu,TextNode:bu,SpaceNode:class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,
|
|
307
|
+
this.character=e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":e>=-.05556&&e<=-.05555?" ":e>=-.1667&&e<=-.1666?" ":e>=-.2223&&e<=-.2222?" ":e>=-.2778&&e<=-.2777?" ":null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",zl(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+zl(this.width)+'"/>'}toText(){return this.character?this.character:" "}},newDocumentFragment:gu},_u=function(e,t,n){return!Xl[t][e]||!Xl[t][e].replace||55349===e.charCodeAt(0)||pc.hasOwnProperty(e)&&n&&(n.fontFamily&&"tt"===n.fontFamily.slice(4,6)||n.font&&"tt"===n.font.slice(4,6))||(e=Xl[t][e].replace),new yu.TextNode(e)},wu=function(e){return 1===e.length?e[0]:new yu.MathNode("mrow",e)},xu=function(e,t){if("texttt"===t.fontFamily)return"monospace"
|
|
308
|
+
;if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var n=t.font;if(!n||"mathnormal"===n)return null;var r=e.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===e.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathsfit"===n)return"sans-serif-italic";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var o=e.text;return["\\imath","\\jmath"].includes(o)?null:(Xl[r][o]&&Xl[r][o].replace&&(o=Xl[r][o].replace),kl(o,qc.fontMap[n].fontName,r)?qc.fontMap[n].variant:null)};function ku(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){
|
|
309
|
+
var t=e.children[0];return t instanceof bu&&"."===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){var n=e.children[0];return n instanceof bu&&","===n.text}return!1}var Su=function(e,t,n){if(1===e.length){var r=Tu(e[0],t);return n&&r instanceof vu&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var o,i=[],a=0;a<e.length;a++){var s=Tu(e[a],t);if(s instanceof vu&&o instanceof vu){if("mtext"===s.type&&"mtext"===o.type&&s.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...s.children);continue}if("mn"===s.type&&"mn"===o.type){o.children.push(...s.children);continue}if(ku(s)&&"mn"===o.type){o.children.push(...s.children);continue}if("mn"===s.type&&ku(o))s.children=[...o.children,...s.children],i.pop();else if(("msup"===s.type||"msub"===s.type)&&s.children.length>=1&&("mn"===o.type||ku(o))){var l=s.children[0]
|
|
310
|
+
;l instanceof vu&&"mn"===l.type&&(l.children=[...o.children,...l.children],i.pop())}else if("mi"===o.type&&1===o.children.length){var c=o.children[0];if(c instanceof bu&&"̸"===c.text&&("mo"===s.type||"mi"===s.type||"mn"===s.type)){var u=s.children[0];u instanceof bu&&u.text.length>0&&(u.text=u.text.slice(0,1)+"̸"+u.text.slice(1),i.pop())}}}i.push(s),o=s}return i},Au=function(e,t,n){return wu(Su(e,t,n))},Tu=function(e,t){if(!e)return new yu.MathNode("mrow");if(Zc[e.type])return Zc[e.type](e,t);throw new Xs("Got group of unknown type: '"+e.type+"'")};function Eu(e,t,n,r,o){var i,a=Su(e,n);i=1===a.length&&a[0]instanceof vu&&["mrow","mtable"].includes(a[0].type)?a[0]:new yu.MathNode("mrow",a);var s=new yu.MathNode("annotation",[new yu.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var l=new yu.MathNode("semantics",[i,s]),c=new yu.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=o?"katex":"katex-mathml"
|
|
311
|
+
;return qc.makeSpan([u],[c])}var Cu=function(e){return new Cl({style:e.displayMode?pl.DISPLAY:pl.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Mu=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=qc.makeSpan(n,[e])}return e},Nu={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋",
|
|
312
|
+
"\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Iu={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],
|
|
313
313
|
"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],
|
|
314
|
-
undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},
|
|
315
|
-
;return t.setAttribute("stretchy","true"),t},
|
|
316
|
-
if(3!==_)throw new Error("Correct katexImagesData or update code here to support\n "+_+" children.");d=["brace-left","brace-center","brace-right"],h=["xMinYMin","xMidYMin","xMaxYMin"]}for(var w=0;w<_;w++){var x=new
|
|
317
|
-
e.base=n,o=function(e){if(e instanceof
|
|
318
|
-
positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-u},{type:"elem",elem:l}]},t)}var f=
|
|
319
|
-
var n=
|
|
320
|
-
var n=
|
|
321
|
-
names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:o}=e;return{type:"xArrow",mode:r.mode,label:o,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,o=t.havingStyle(r.sup()),i=
|
|
322
|
-
;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(u-=i.depth),n){var d=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;s=
|
|
323
|
-
;return"minner"===e.mclass?n=new
|
|
324
|
-
type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:
|
|
325
|
-
var n=
|
|
326
|
-
;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=
|
|
327
|
-
for(var{parser:n}=e,r=
|
|
328
|
-
var{parser:n,breakOnTokenText:r}=e,o=
|
|
329
|
-
"\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},
|
|
330
|
-
;for(var i,a=0,s=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){i=t.gullet.future(),s[a].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new
|
|
331
|
-
;return
|
|
332
|
-
return
|
|
333
|
-
;case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),i=new
|
|
314
|
+
undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ou=function(e,t,n,r,o){var i,a=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(i=qc.makeSpan(["stretchy",t],[],o),"fbox"===t){var s=o.color&&o.getColor();s&&(i.style.borderColor=s)}}else{var l=[];/^[bx]cancel$/.test(t)&&l.push(new Vl({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new Vl({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new Ul(l,{width:"100%",height:zl(a)});i=qc.makeSvgSpan([],[c],o)}return i.height=a,i.style.height=zl(a),i},zu=function(e){var t=new yu.MathNode("mo",[new yu.TextNode(Nu[e.replace(/^\\/,"")])])
|
|
315
|
+
;return t.setAttribute("stretchy","true"),t},Lu=function(e,t){var{span:n,minWidth:r,height:o}=function(){var n=4e5,r=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(r)){var o,i,a,s="ordgroup"===(p=e.base).type?p.body.length:1;if(s>5)"widehat"===r||"widecheck"===r?(o=420,n=2364,a=.42,i=r+"4"):(o=312,n=2340,a=.34,i="tilde4");else{var l=[1,1,2,2,3,3][s];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][l],o=[0,239,300,360,420][l],a=[0,.24,.3,.3,.36,.42][l],i=r+l):(n=[0,600,1033,2339,2340][l],o=[0,260,286,306,312][l],a=[0,.26,.286,.3,.306,.34][l],i="tilde"+l)}var c=new Gl(i),u=new Ul([c],{width:"100%",height:zl(a),viewBox:"0 0 "+n+" "+o,preserveAspectRatio:"none"});return{span:qc.makeSvgSpan([],[u],t),minWidth:0,height:a}}var d,h,p,m=[],f=Iu[r],[g,v,b]=f,y=b/1e3,_=g.length;if(1===_)d=["hide-tail"],h=[f[3]];else if(2===_)d=["halfarrow-left","halfarrow-right"],h=["xMinYMin","xMaxYMin"];else{
|
|
316
|
+
if(3!==_)throw new Error("Correct katexImagesData or update code here to support\n "+_+" children.");d=["brace-left","brace-center","brace-right"],h=["xMinYMin","xMidYMin","xMaxYMin"]}for(var w=0;w<_;w++){var x=new Gl(g[w]),k=new Ul([x],{width:"400em",height:zl(y),viewBox:"0 0 "+n+" "+b,preserveAspectRatio:h[w]+" slice"}),S=qc.makeSvgSpan([d[w]],[k],t);if(1===_)return{span:S,minWidth:v,height:y};S.style.height=zl(y),m.push(S)}return{span:qc.makeSpan(["stretchy"],m,t),minWidth:v,height:y}}();return n.height=o,n.style.height=zl(o),r>0&&(n.style.minWidth=zl(r)),n};function Pu(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function Ru(e){var t=Du(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Du(e){return e&&("atom"===e.type||Yl.hasOwnProperty(e.type))?e:null}var ju=(e,t)=>{var n,r,o;e&&"supsub"===e.type?(n=(r=Pu(e.base,"accent")).base,
|
|
317
|
+
e.base=n,o=function(e){if(e instanceof Hl)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}(pu(e,t)),e.base=r):n=(r=Pu(e,"accent")).base;var i=pu(n,t.havingCrampedStyle()),a=0;if(r.isShifty&&tl.isCharacterBox(n)){var s=tl.getBaseElem(n);a=Wl(pu(s,t.havingCrampedStyle())).skew}var l,c="\\c"===r.label,u=c?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight);if(r.isStretchy)l=Lu(r,t),l=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+zl(2*a)+")",marginLeft:zl(2*a)}:void 0}]},t);else{var d,h;"\\vec"===r.label?(d=qc.staticSvg("vec",t),h=qc.svgData.vec[1]):((d=Wl(d=qc.makeOrd({mode:r.mode,text:r.label},t,"textord"))).italic=0,h=d.width,c&&(u+=d.depth)),l=qc.makeSpan(["accent-body"],[d]);var p="\\textcircled"===r.label;p&&(l.classes.push("accent-full"),u=i.height);var m=a;p||(m-=h/2),l.style.left=zl(m),"\\textcircled"===r.label&&(l.style.top=".2em"),l=qc.makeVList({
|
|
318
|
+
positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-u},{type:"elem",elem:l}]},t)}var f=qc.makeSpan(["mord","accent"],[l],t);return o?(o.children[0]=f,o.height=Math.max(f.height,o.height),o.classes[0]="mord",o):f},Hu=(e,t)=>{var n=e.isStretchy?zu(e.label):new yu.MathNode("mo",[_u(e.label,e.mode)]),r=new yu.MathNode("mover",[Tu(e.base,t),n]);return r.setAttribute("accent","true"),r},Fu=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((e=>"\\"+e)).join("|"));Qc({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{
|
|
319
|
+
var n=eu(t[0]),r=!Fu.test(e.funcName),o=!r||"\\widehat"===e.funcName||"\\widetilde"===e.funcName||"\\widecheck"===e.funcName;return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:o,base:n}},htmlBuilder:ju,mathmlBuilder:Hu}),Qc({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return"math"===r&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:ju,mathmlBuilder:Hu}),Qc({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:o}},htmlBuilder:(e,t)=>{
|
|
320
|
+
var n=pu(e.base,t),r=Lu(e,t),o="\\utilde"===e.label?.12:0,i=qc.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:n}]},t);return qc.makeSpan(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=zu(e.label),r=new yu.MathNode("munder",[Tu(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var $u=e=>{var t=new yu.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Qc({type:"xArrow",
|
|
321
|
+
names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:o}=e;return{type:"xArrow",mode:r.mode,label:o,body:t[0],below:n[0]}},htmlBuilder(e,t){var n,r=t.style,o=t.havingStyle(r.sup()),i=qc.wrapFragment(pu(e.body,o,t),t),a="\\x"===e.label.slice(0,2)?"x":"cd";i.classes.push(a+"-arrow-pad"),e.below&&(o=t.havingStyle(r.sub()),(n=qc.wrapFragment(pu(e.below,o,t),t)).classes.push(a+"-arrow-pad"));var s,l=Lu(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,u=-t.fontMetrics().axisHeight-.5*l.height-.111
|
|
322
|
+
;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(u-=i.depth),n){var d=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;s=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:l,shift:c},{type:"elem",elem:n,shift:d}]},t)}else s=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:l,shift:c}]},t);return s.children[0].children[0].children[1].classes.push("svg-align"),qc.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder(e,t){var n,r=zu(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var o=$u(Tu(e.body,t));if(e.below){var i=$u(Tu(e.below,t));n=new yu.MathNode("munderover",[r,i,o])}else n=new yu.MathNode("mover",[r,o])}else if(e.below){var a=$u(Tu(e.below,t));n=new yu.MathNode("munder",[r,a])}else n=$u(),n=new yu.MathNode("mover",[r,n]);return n}});var Bu=qc.makeSpan;function qu(e,t){var n=su(e.body,t,!0);return Bu([e.mclass],n,t)}function Uu(e,t){var n,r=Su(e.body,t)
|
|
323
|
+
;return"minner"===e.mclass?n=new yu.MathNode("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new yu.MathNode("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new yu.MathNode("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):"mpunct"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):"mopen"===e.mclass||"mclose"===e.mclass?(n.attributes.lspace="0em",n.attributes.rspace="0em"):"minner"===e.mclass&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Qc({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:tu(o),isCharacterBox:tl.isCharacterBox(o)}},htmlBuilder:qu,mathmlBuilder:Uu});var Gu=e=>{var t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};Qc({
|
|
324
|
+
type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Gu(t[0]),body:tu(t[1]),isCharacterBox:tl.isCharacterBox(t[1])}}}),Qc({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:o}=e,i=t[1],a=t[0];n="\\stackrel"!==o?Gu(i):"mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==o,body:tu(i)},l={type:"supsub",mode:a.mode,base:s,sup:"\\underset"===o?null:a,sub:"\\underset"===o?a:null};return{type:"mclass",mode:r.mode,mclass:n,body:[l],isCharacterBox:tl.isCharacterBox(l)}},htmlBuilder:qu,mathmlBuilder:Uu}),Qc({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Gu(t[0]),body:tu(t[0])}},htmlBuilder(e,t){var n=su(e.body,t,!0),r=qc.makeSpan([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){
|
|
325
|
+
var n=Su(e.body,t),r=new yu.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Vu={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Wu=e=>"textord"===e.type&&"@"===e.text;function Ku(e,t,n){var r=Vu[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":var o={type:"atom",text:r,mode:"math",family:"rel"},i={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[o],[]),n.callFunction("\\\\cdright",[t[1]],[])]};return n.callFunction("\\\\cdparent",[i],[]);case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":return n.callFunction("\\Big",[{type:"textord",text:"\\Vert",mode:"math"}],[]);default:return{type:"textord",text:" ",mode:"math"}}}Qc({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e
|
|
326
|
+
;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=qc.wrapFragment(pu(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=zl(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new yu.MathNode("mrow",[Tu(e.label,t)]);return(n=new yu.MathNode("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new yu.MathNode("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),Qc({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=qc.wrapFragment(pu(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new yu.MathNode("mrow",[Tu(e.fragment,t)])}),Qc({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){
|
|
327
|
+
for(var{parser:n}=e,r=Pu(t[0],"ordgroup").body,o="",i=0;i<r.length;i++){o+=Pu(r[i],"textord").text}var a,s=parseInt(o);if(isNaN(s))throw new Xs("\\@char has non-numeric argument "+o);if(s<0||s>=1114111)throw new Xs("\\@char with invalid code point "+o);return s<=65535?a=String.fromCharCode(s):(s-=65536,a=String.fromCharCode(55296+(s>>10),56320+(1023&s))),{type:"textord",mode:n.mode,text:a}}});var Yu=(e,t)=>{var n=su(e.body,t.withColor(e.color),!1);return qc.makeFragment(n)},Xu=(e,t)=>{var n=Su(e.body,t.withColor(e.color)),r=new yu.MathNode("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Qc({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=Pu(t[0],"color-token").color,o=t[1];return{type:"color",mode:n.mode,color:r,body:tu(o)}},htmlBuilder:Yu,mathmlBuilder:Xu}),Qc({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){
|
|
328
|
+
var{parser:n,breakOnTokenText:r}=e,o=Pu(t[0],"color-token").color;n.gullet.macros.set("\\current@color",o);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:o,body:i}},htmlBuilder:Yu,mathmlBuilder:Xu}),Qc({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,o="["===r.gullet.future().text?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:o&&Pu(o,"size").value}},htmlBuilder(e,t){var n=qc.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=zl(Ol(e.size,t)))),n},mathmlBuilder(e,t){var n=new yu.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",zl(Ol(e.size,t)))),n}});var Zu={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef",
|
|
329
|
+
"\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Qu=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Xs("Expected a control sequence",e);return t},Ju=(e,t,n,r)=>{var o=e.gullet.macros.get(n.text);null==o&&(n.noexpand=!0,o={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,o,r)};Qc({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(Zu[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=Zu[r.text]),Pu(t.parseFunction(),"internal");throw new Xs("Invalid token after macro prefix",r)}}),Qc({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),o=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new Xs("Expected a control sequence",r)
|
|
330
|
+
;for(var i,a=0,s=[[]];"{"!==t.gullet.future().text;)if("#"===(r=t.gullet.popToken()).text){if("{"===t.gullet.future().text){i=t.gullet.future(),s[a].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Xs('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==a+1)throw new Xs('Argument number "'+r.text+'" out of order');a++,s.push([])}else{if("EOF"===r.text)throw new Xs("Expected a macro definition");s[a].push(r.text)}var{tokens:l}=t.gullet.consumeArg();return i&&l.unshift(i),"\\edef"!==n&&"\\xdef"!==n||(l=t.gullet.expandTokens(l)).reverse(),t.gullet.macros.set(o,{tokens:l,numArgs:a,delimiters:s},n===Zu[n]),{type:"internal",mode:t.mode}}}),Qc({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=Qu(t.gullet.popToken());t.gullet.consumeSpaces();var o=(e=>{var t=e.gullet.popToken();return"="===t.text&&" "===(t=e.gullet.popToken()).text&&(t=e.gullet.popToken()),t})(t)
|
|
331
|
+
;return Ju(t,r,o,"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),Qc({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=Qu(t.gullet.popToken()),o=t.gullet.popToken(),i=t.gullet.popToken();return Ju(t,r,i,"\\\\globalfuture"===n),t.gullet.pushToken(i),t.gullet.pushToken(o),{type:"internal",mode:t.mode}}});var ed=function(e,t,n){var r=kl(Xl.math[e]&&Xl.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},td=function(e,t,n,r){var o=n.havingBaseStyle(t),i=qc.makeSpan(r.concat(o.sizingClasses(n)),[e],n),a=o.sizeMultiplier/n.sizeMultiplier;return i.height*=a,i.depth*=a,i.maxFontSize=o.sizeMultiplier,i},nd=function(e,t,n){var r=t.havingBaseStyle(n),o=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=zl(o),e.height-=o,e.depth+=o},rd=function(e,t,n,r,o,i){var a=function(e,t,n,r){
|
|
332
|
+
return qc.makeSymbol(e,"Size"+t+"-Regular",n,r)}(e,t,o,r),s=td(qc.makeSpan(["delimsizing","size"+t],[a],r),pl.TEXT,r,i);return n&&nd(s,r,pl.TEXT),s},od=function(e,t,n){var r;return r="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:qc.makeSpan(["delimsizinginner",r],[qc.makeSpan([],[qc.makeSymbol(e,t,n)])])}},id=function(e,t,n){var r=_l["Size4-Regular"][e.charCodeAt(0)]?_l["Size4-Regular"][e.charCodeAt(0)][4]:_l["Size1-Regular"][e.charCodeAt(0)][4],o=new Gl("inner",function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145zM367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z";case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z"
|
|
333
|
+
;case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257zM478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z";default:return""}}(e,Math.round(1e3*t))),i=new Ul([o],{width:zl(r),height:zl(t),style:"width:"+zl(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=qc.makeSvgSpan([],[i],n);return a.height=t,a.style.height=zl(t),a.style.width=zl(r),{type:"elem",elem:a}},ad={type:"kern",size:-.008},sd=["|","\\lvert","\\rvert","\\vert"],ld=["\\|","\\lVert","\\rVert","\\Vert"],cd=function(e,t,n,r,o,i){var a,s,l,c,u="",d=0;a=l=c=e,s=null;var h="Size1-Regular";"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?a=l="⏐":"\\Downarrow"===e?a=l="‖":"\\updownarrow"===e?(a="\\uparrow",l="⏐",c="\\downarrow"):"\\Updownarrow"===e?(a="\\Uparrow",l="‖",c="\\Downarrow"):sd.includes(e)?(l="∣",u="vert",d=333):ld.includes(e)?(l="∥",u="doublevert",d=556):"["===e||"\\lbrack"===e?(a="⎡",l="⎢",c="⎣",h="Size4-Regular",
|
|
334
334
|
u="lbrack",d=667):"]"===e||"\\rbrack"===e?(a="⎤",l="⎥",c="⎦",h="Size4-Regular",u="rbrack",d=667):"\\lfloor"===e||"⌊"===e?(l=a="⎢",c="⎣",h="Size4-Regular",u="lfloor",d=667):"\\lceil"===e||"⌈"===e?(a="⎡",l=c="⎢",h="Size4-Regular",u="lceil",d=667):"\\rfloor"===e||"⌋"===e?(l=a="⎥",c="⎦",h="Size4-Regular",u="rfloor",d=667):"\\rceil"===e||"⌉"===e?(a="⎤",l=c="⎥",h="Size4-Regular",u="rceil",d=667):"("===e||"\\lparen"===e?(a="⎛",l="⎜",c="⎝",h="Size4-Regular",u="lparen",d=875):")"===e||"\\rparen"===e?(a="⎞",l="⎟",c="⎠",h="Size4-Regular",u="rparen",d=875):"\\{"===e||"\\lbrace"===e?(a="⎧",s="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(a="⎫",s="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(a="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(a="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(a="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(a="⎫",c="⎩",l="⎪",h="Size4-Regular")
|
|
335
|
-
;var p=
|
|
335
|
+
;var p=ed(a,h,o),m=p.height+p.depth,f=ed(l,h,o),g=f.height+f.depth,v=ed(c,h,o),b=v.height+v.depth,y=0,_=1;if(null!==s){var w=ed(s,h,o);y=w.height+w.depth,_=2}var x=m+b+y,k=x+Math.max(0,Math.ceil((t-x)/(_*g)))*_*g,S=r.fontMetrics().axisHeight;n&&(S*=r.sizeMultiplier);var A=k/2-S,T=[];if(u.length>0){var E=k-m-b,C=Math.round(1e3*k),M=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z";case"doublevert":
|
|
336
336
|
return"M145 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+t+" v585 h43z\nM367 15 v585 v"+t+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-t+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+" v602 h84z\nM403 1759 V0 H319 V1759 v"+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+t+" v602 h84z";case"lparen":
|
|
337
337
|
return"M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(t+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(t+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":
|
|
338
|
-
return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(u,Math.round(1e3*E)),N=new
|
|
339
|
-
var P=k-m-b+.016;T.push(
|
|
340
|
-
;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,
|
|
341
|
-
return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,
|
|
342
|
-
return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,
|
|
343
|
-
return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,
|
|
344
|
-
;return
|
|
345
|
-
type:"stack"}],
|
|
346
|
-
var n,r,o=t.havingBaseSizing(),i=
|
|
347
|
-
var a=r.fontMetrics().axisHeight*r.sizeMultiplier,s=5/r.fontMetrics().ptPerEm,l=Math.max(t-a,n+a),c=Math.max(l/500*901,2*l-s);return
|
|
348
|
-
},
|
|
349
|
-
size:
|
|
350
|
-
r.expect("\\right",!1);var i=
|
|
351
|
-
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return
|
|
352
|
-
number:.6,unit:"pt"},t),u=
|
|
353
|
-
s=o.depth+g,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)r=
|
|
354
|
-
r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var o=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+o+"em solid "+String(e.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};
|
|
355
|
-
argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=
|
|
356
|
-
handler:o},l=0;l<n.length;++l)
|
|
357
|
-
function _(){b&&(e.gullet.macros.get("\\df@tag")?(b.push(e.subparse([new
|
|
358
|
-
return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:o,arraystretch:a,body:f,cols:i,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:s,tags:b,leqno:h}}function
|
|
359
|
-
e.addJot&&(w+=p),x.height=_,x.depth=w,v+=_,x.pos=v,v+=w+A,s[n]=x,b(i[n+1])}var T,E,C=v/2+t.fontMetrics().axisHeight,M=e.cols||[],N=[],I=[];if(e.tags&&e.tags.some((e=>e)))for(n=0;n<o;++n){var O=s[n],z=O.pos-C,L=e.tags[n],P=void 0;(P=!0===L?
|
|
360
|
-
;(r>0||e.hskipBeforeAndAfter)&&0!==($=
|
|
361
|
-
},
|
|
362
|
-
for(var y=e.cols||[],_="",w=1;w<y.length;w++)_+=w%2?"0em ":"1em ";c.setAttribute("columnspacing",_.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var x="",k=e.hLinesBeforeRow;d+=k[0].length>0?"left ":"",d+=k[k.length-1].length>0?"right ":"";for(var S=1;S<k.length-1;S++)x+=0===k[S].length?"none ":k[S][0]?"dashed ":"solid ";return/[sd]/.test(x)&&c.setAttribute("rowlines",x.trim()),""!==d&&(c=new
|
|
363
|
-
colSeparationType:o,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",u=0;u<t[0].body.length;u++){c+=
|
|
364
|
-
;throw new
|
|
365
|
-
type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:
|
|
366
|
-
type:"align",align:"l",pregap:0,postgap:0}]},
|
|
367
|
-
;return
|
|
368
|
-
}if(
|
|
369
|
-
argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];if("ordgroup"!==o.type)throw new
|
|
370
|
-
names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=
|
|
371
|
-
;return"display"===e?n=n.id>=
|
|
372
|
-
;var w=-(_-.5*u);f=
|
|
373
|
-
;if(e.hasBarLine){if(e.barSize){var r=
|
|
374
|
-
;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,s="(",l=")";break;case"\\\\bracefrac":n=!1,s="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,s="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(o){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text"}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:n,leftDelim:s,rightDelim:l,size:c,barSize:null}},htmlBuilder:
|
|
375
|
-
t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:o}}});var
|
|
376
|
-
props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:o}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:
|
|
377
|
-
},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=
|
|
378
|
-
type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],o=
|
|
379
|
-
allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:
|
|
380
|
-
attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:
|
|
381
|
-
;if(!
|
|
382
|
-
;e.totalheight.number>0&&(r=
|
|
383
|
-
"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:o.value}},htmlBuilder:(e,t)=>
|
|
384
|
-
var n=new
|
|
385
|
-
script:
|
|
386
|
-
children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:
|
|
387
|
-
var d=a.italic,h=
|
|
388
|
-
"∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};
|
|
389
|
-
names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:
|
|
390
|
-
;var
|
|
391
|
-
alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:
|
|
392
|
-
names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=
|
|
393
|
-
allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=
|
|
394
|
-
;return o.setAttribute("width","0px"),o}}),
|
|
395
|
-
var n=
|
|
396
|
-
body:i}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return
|
|
397
|
-
mathmlBuilder:(e,t)=>{var n=new
|
|
398
|
-
var p=t.havingStyle(
|
|
399
|
-
text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});
|
|
400
|
-
var _=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof
|
|
401
|
-
;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var o,i=[
|
|
402
|
-
var n=new
|
|
403
|
-
"\\nobreakspace":{className:"nobreak"}};
|
|
404
|
-
"\\textnormal":"textrm"},
|
|
405
|
-
var n=
|
|
406
|
-
throw new
|
|
407
|
-
setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new
|
|
408
|
-
if(0===this.undefStack.length)throw new
|
|
409
|
-
;return e.expandOnce(!0),{tokens:[t],numArgs:0}})),
|
|
410
|
-
if(null==(r=
|
|
411
|
-
var t=e.consumeArgs(1)[0];return console.log(t.reverse().map((e=>e.text)).join("")),""})),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
"\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};
|
|
416
|
-
;return t in
|
|
417
|
-
if(e.macros.get("\\df@tag"))throw new
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
;return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
this.stack=[]}feed(e){this.lexer=new
|
|
429
|
-
}else if("EOF"===r.text)throw new
|
|
430
|
-
if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new
|
|
431
|
-
return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map((e=>e.text)).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var o=0;if(-1!==r.indexOf("#"))for(var i=r.replace(/##/g,"");-1!==i.indexOf("#"+(o+1));)++o;for(var a=new
|
|
432
|
-
"ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),
|
|
433
|
-
text:"\\H"},"̧":{text:"\\c"}},
|
|
338
|
+
return"M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(t+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(t+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:throw new Error("Unknown stretchy delimiter.")}}(u,Math.round(1e3*E)),N=new Gl(u,M),I=(d/1e3).toFixed(3)+"em",O=(C/1e3).toFixed(3)+"em",z=new Ul([N],{width:I,height:O,viewBox:"0 0 "+d+" "+C}),L=qc.makeSvgSpan([],[z],r);L.height=C/1e3,L.style.width=I,L.style.height=O,T.push({type:"elem",elem:L})}else{if(T.push(od(c,h,o)),T.push(ad),null===s){
|
|
339
|
+
var P=k-m-b+.016;T.push(id(l,P,r))}else{var R=(k-m-b-y)/2+.016;T.push(id(l,R,r)),T.push(ad),T.push(od(s,h,o)),T.push(ad),T.push(id(l,R,r))}T.push(ad),T.push(od(a,h,o))}var D=r.havingBaseStyle(pl.TEXT),j=qc.makeVList({positionType:"bottom",positionData:A,children:T},D);return td(qc.makeSpan(["delimsizing","mult"],[j],D),pl.TEXT,r,i)},ud=.08,dd=function(e,t,n,r,o){var i=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){return"M95,"+(622+e+t)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+e/2.075+" -"+e+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+e)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,vl);break
|
|
340
|
+
;case"sqrtSize1":r=function(e,t){return"M263,"+(601+e+t)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+e/2.084+" -"+e+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+e)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,vl);break;case"sqrtSize2":r=function(e,t){
|
|
341
|
+
return"M983 "+(10+e+t)+"\nl"+e/3.13+" -"+e+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+e)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"}(t,vl);break;case"sqrtSize3":r=function(e,t){
|
|
342
|
+
return"M424,"+(2398+e+t)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+e/4.223+" -"+e+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+e)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+e)+" "+t+"\nh400000v"+(40+e)+"h-400000z"}(t,vl);break;case"sqrtSize4":r=function(e,t){
|
|
343
|
+
return"M473,"+(2713+e+t)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+e/5.298+" -"+e+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+e)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"}(t,vl);break;case"sqrtTall":r=function(e,t,n){return"M702 "+(e+t)+"H400000"+(40+e)+"\nH742v"+(n-54-t-e)+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+t+"H400000v"+(40+e)+"H742z"}(t,vl,n)}return r}(e,r,n),a=new Gl(e,i),s=new Ul([a],{width:"400em",height:zl(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"})
|
|
344
|
+
;return qc.makeSvgSpan(["hide-tail"],[s],o)},hd=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],pd=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],md=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],fd=[0,1.2,1.8,2.4,3],gd=[{type:"small",style:pl.SCRIPTSCRIPT},{type:"small",style:pl.SCRIPT},{type:"small",style:pl.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],vd=[{type:"small",style:pl.SCRIPTSCRIPT},{type:"small",style:pl.SCRIPT},{type:"small",style:pl.TEXT},{type:"stack"}],bd=[{type:"small",style:pl.SCRIPTSCRIPT},{type:"small",style:pl.SCRIPT},{type:"small",style:pl.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{
|
|
345
|
+
type:"stack"}],yd=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},_d=function(e,t,n,r){for(var o=Math.min(2,3-r.style.size);o<n.length&&"stack"!==n[o].type;o++){var i=ed(e,yd(n[o]),"math"),a=i.height+i.depth;if("small"===n[o].type&&(a*=r.havingBaseStyle(n[o].style).sizeMultiplier),a>t)return n[o]}return n[n.length-1]},wd=function(e,t,n,r,o,i){var a;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),a=md.includes(e)?gd:hd.includes(e)?bd:vd;var s=_d(e,t,a,r);return"small"===s.type?function(e,t,n,r,o,i){var a=qc.makeSymbol(e,"Main-Regular",o,r),s=td(a,t,r,i);return n&&nd(s,r,t),s}(e,s.style,n,r,o,i):"large"===s.type?rd(e,s.size,n,r,o,i):cd(e,t,n,r,o,i)},xd={sqrtImage:function(e,t){
|
|
346
|
+
var n,r,o=t.havingBaseSizing(),i=_d("\\surd",e*o.sizeMultiplier,bd,o),a=o.sizeMultiplier,s=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l=0,c=0,u=0;return"small"===i.type?(e<1?a=1:e<1.4&&(a=.7),c=(1+s)/a,(n=dd("sqrtMain",l=(1+s+ud)/a,u=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",r=.833/a):"large"===i.type?(u=1080*fd[i.size],c=(fd[i.size]+s)/a,l=(fd[i.size]+s+ud)/a,(n=dd("sqrtSize"+i.size,l,u,s,t)).style.minWidth="1.02em",r=1/a):(l=e+s+ud,c=e+s,u=Math.floor(1e3*e+s)+80,(n=dd("sqrtTall",l,u,s,t)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=zl(l),{span:n,advanceWidth:r,ruleWidth:(t.fontMetrics().sqrtRuleThickness+s)*a}},sizedDelim:function(e,t,n,r,o){if("<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),hd.includes(e)||md.includes(e))return rd(e,t,!1,n,r,o);if(pd.includes(e))return cd(e,fd[t],!1,n,r,o);throw new Xs("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:fd,customSizedDelim:wd,leftRightDelim:function(e,t,n,r,o,i){
|
|
347
|
+
var a=r.fontMetrics().axisHeight*r.sizeMultiplier,s=5/r.fontMetrics().ptPerEm,l=Math.max(t-a,n+a),c=Math.max(l/500*901,2*l-s);return wd(e,c,!0,r,o,i)}},kd={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}
|
|
348
|
+
},Sd=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Ad(e,t){var n=Du(e);if(n&&Sd.includes(n.text))return n;throw new Xs(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function Td(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qc({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Ad(t[0],e);return{type:"delimsizing",mode:e.parser.mode,
|
|
349
|
+
size:kd[e.funcName].size,mclass:kd[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?qc.makeSpan([e.mclass]):xd.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(_u(e.delim,e.mode));var n=new yu.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=zl(xd.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),Qc({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new Xs("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Ad(t[0],e).text,color:n}}}),Qc({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ad(t[0],e),r=e.parser;++r.leftrightDepth;var o=r.parseExpression(!1);--r.leftrightDepth,
|
|
350
|
+
r.expect("\\right",!1);var i=Pu(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:o,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{Td(e);for(var n,r,o=su(e.body,t,!0,["mopen","mclose"]),i=0,a=0,s=!1,l=0;l<o.length;l++)o[l].isMiddle?s=!0:(i=Math.max(o[l].height,i),a=Math.max(o[l].depth,a));if(i*=t.sizeMultiplier,a*=t.sizeMultiplier,n="."===e.left?hu(t,["mopen"]):xd.leftRightDelim(e.left,i,a,t,e.mode,["mopen"]),o.unshift(n),s)for(var c=1;c<o.length;c++){var u=o[c].isMiddle;u&&(o[c]=xd.leftRightDelim(u.delim,i,a,u.options,e.mode,[]))}if("."===e.right)r=hu(t,["mclose"]);else{var d=e.rightColor?t.withColor(e.rightColor):t;r=xd.leftRightDelim(e.right,i,a,d,e.mode,["mclose"])}return o.push(r),qc.makeSpan(["minner"],o,t)},mathmlBuilder:(e,t)=>{Td(e);var n=Su(e.body,t);if("."!==e.left){var r=new yu.MathNode("mo",[_u(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var o=new yu.MathNode("mo",[_u(e.right,e.mode)])
|
|
351
|
+
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return wu(n)}}),Qc({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Ad(t[0],e);if(!e.parser.leftrightDepth)throw new Xs("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=hu(t,[]);else{n=xd.sizedDelim(e.delim,1,t,e.mode,[]);var r={delim:e.delim,options:t};n.isMiddle=r}return n},mathmlBuilder:(e,t)=>{var n="\\vert"===e.delim||"|"===e.delim?_u("|","text"):_u(e.delim,e.mode),r=new yu.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Ed=(e,t)=>{var n,r,o=qc.wrapFragment(pu(e.body,t),t),i=e.label.slice(1),a=t.sizeMultiplier,s=0,l=tl.isCharacterBox(e.body);if("sout"===i)(n=qc.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/a,s=-.5*t.fontMetrics().xHeight;else if("phase"===i){var c=Ol({
|
|
352
|
+
number:.6,unit:"pt"},t),u=Ol({number:.35,unit:"ex"},t);a/=t.havingBaseSizing().sizeMultiplier;var d=o.height+o.depth+c+u;o.style.paddingLeft=zl(d/2+c);var h=Math.floor(1e3*d*a),p=function(e){return"M400000 "+e+" H0 L"+e/2+" 0 l65 45 L145 "+(e-80)+" H400000z"}(h),m=new Ul([new Gl("phase",p)],{width:"400em",height:zl(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});(n=qc.makeSvgSpan(["hide-tail"],[m],t)).style.height=zl(d),s=o.depth+c+u}else{/cancel/.test(i)?l||o.classes.push("cancel-pad"):"angl"===i?o.classes.push("anglpad"):o.classes.push("boxpad");var f=0,g=0,v=0;/box/.test(i)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),g=f=t.fontMetrics().fboxsep+("colorbox"===i?0:v)):"angl"===i?(f=4*(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness)),g=Math.max(0,.25-o.depth)):g=f=l?.2:0,n=Ou(o,i,f,g,t),/fbox|boxed|fcolorbox/.test(i)?(n.style.borderStyle="solid",n.style.borderWidth=zl(v)):"angl"===i&&.049!==v&&(n.style.borderTopWidth=zl(v),n.style.borderRightWidth=zl(v)),
|
|
353
|
+
s=o.depth+g,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)r=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:s},{type:"elem",elem:o,shift:0}]},t);else{var b=/cancel|phase/.test(i)?["svg-align"]:[];r=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:n,shift:s,wrapperClasses:b}]},t)}return/cancel/.test(i)&&(r.height=o.height,r.depth=o.depth),/cancel/.test(i)&&!l?qc.makeSpan(["mord","cancel-lap"],[r],t):qc.makeSpan(["mord"],[r],t)},Cd=(e,t)=>{var n=0,r=new yu.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Tu(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":
|
|
354
|
+
r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===e.label){var o=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+o+"em solid "+String(e.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};Qc({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=Pu(t[0],"color-token").color,a=t[1];return{type:"enclose",mode:r.mode,label:o,backgroundColor:i,body:a}},htmlBuilder:Ed,mathmlBuilder:Cd}),Qc({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,
|
|
355
|
+
argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=Pu(t[0],"color-token").color,a=Pu(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:r.mode,label:o,backgroundColor:a,borderColor:i,body:s}},htmlBuilder:Ed,mathmlBuilder:Cd}),Qc({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}}),Qc({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"enclose",mode:n.mode,label:r,body:o}},htmlBuilder:Ed,mathmlBuilder:Cd}),Qc({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var Md={};function Nd(e){for(var{type:t,names:n,props:r,handler:o,htmlBuilder:i,mathmlBuilder:a}=e,s={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,
|
|
356
|
+
handler:o},l=0;l<n.length;++l)Md[n[l]]=s;i&&(Xc[t]=i),a&&(Zc[t]=a)}var Id={};function Od(e,t){Id[e]=t}function zd(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for("\\relax"===n&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var Ld=e=>{if(!e.parser.settings.displayMode)throw new Xs("{"+e.envName+"} can be used only in display mode.")};function Pd(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function Rd(e,t,n){var{hskipBeforeAndAfter:r,addJot:o,cols:i,arraystretch:a,colSeparationType:s,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:h}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!a){var p=e.gullet.expandMacroAsText("\\arraystretch");if(null==p)a=1;else if(!(a=parseFloat(p))||a<0)throw new Xs("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],f=[m],g=[],v=[],b=null!=l?[]:void 0;function y(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}
|
|
357
|
+
function _(){b&&(e.gullet.macros.get("\\df@tag")?(b.push(e.subparse([new Ys("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):b.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(y(),v.push(zd(e));;){var w=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),w={type:"ordgroup",mode:e.mode,body:w},n&&(w={type:"styling",mode:e.mode,style:n,body:[w]}),m.push(w);var x=e.fetch().text;if("&"===x){if(d&&m.length===d){if(c||s)throw new Xs("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else{if("\\end"===x){_(),1===m.length&&"styling"===w.type&&0===w.body[0].body.length&&(f.length>1||!u)&&f.pop(),v.length<f.length+1&&v.push([]);break}if("\\\\"!==x)throw new Xs("Expected & or \\\\ or \\cr or \\end",e.nextToken);e.consume();var k=void 0;" "!==e.gullet.future().text&&(k=e.parseSizeGroup(!0)),g.push(k?k.value:null),_(),v.push(zd(e)),m=[],f.push(m),y()}}
|
|
358
|
+
return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:o,arraystretch:a,body:f,cols:i,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:s,tags:b,leqno:h}}function Dd(e){return"d"===e.slice(0,1)?"display":"text"}var jd=function(e,t){var n,r,o=e.body.length,i=e.hLinesBeforeRow,a=0,s=new Array(o),l=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),u=1/t.fontMetrics().ptPerEm,d=5*u;e.colSeparationType&&"small"===e.colSeparationType&&(d=t.havingStyle(pl.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var h="CD"===e.colSeparationType?Ol({number:3,unit:"ex"},t):12*u,p=3*u,m=e.arraystretch*h,f=.7*m,g=.3*m,v=0;function b(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(b(i[0]),n=0;n<e.body.length;++n){var y=e.body[n],_=f,w=g;a<y.length&&(a=y.length);var x=new Array(y.length);for(r=0;r<y.length;++r){var k=pu(y[r],t);w<k.depth&&(w=k.depth),_<k.height&&(_=k.height),x[r]=k}var S=e.rowGaps[n],A=0;S&&(A=Ol(S,t))>0&&(w<(A+=g)&&(w=A),A=0),
|
|
359
|
+
e.addJot&&(w+=p),x.height=_,x.depth=w,v+=_,x.pos=v,v+=w+A,s[n]=x,b(i[n+1])}var T,E,C=v/2+t.fontMetrics().axisHeight,M=e.cols||[],N=[],I=[];if(e.tags&&e.tags.some((e=>e)))for(n=0;n<o;++n){var O=s[n],z=O.pos-C,L=e.tags[n],P=void 0;(P=!0===L?qc.makeSpan(["eqn-num"],[],t):!1===L?qc.makeSpan([],[],t):qc.makeSpan([],su(L,t,!0),t)).depth=O.depth,P.height=O.height,I.push({type:"elem",elem:P,shift:z})}for(r=0,E=0;r<a||E<M.length;++r,++E){for(var R=M[E]||{},D=!0;"separator"===R.type;){if(D||((T=qc.makeSpan(["arraycolsep"],[])).style.width=zl(t.fontMetrics().doubleRuleSep),N.push(T)),"|"!==R.separator&&":"!==R.separator)throw new Xs("Invalid separator type: "+R.separator);var j="|"===R.separator?"solid":"dashed",H=qc.makeSpan(["vertical-separator"],[],t);H.style.height=zl(v),H.style.borderRightWidth=zl(c),H.style.borderRightStyle=j,H.style.margin="0 "+zl(-c/2);var F=v-C;F&&(H.style.verticalAlign=zl(-F)),N.push(H),R=M[++E]||{},D=!1}if(!(r>=a)){var $=void 0
|
|
360
|
+
;(r>0||e.hskipBeforeAndAfter)&&0!==($=tl.deflt(R.pregap,d))&&((T=qc.makeSpan(["arraycolsep"],[])).style.width=zl($),N.push(T));var B=[];for(n=0;n<o;++n){var q=s[n],U=q[r];if(U){var G=q.pos-C;U.depth=q.depth,U.height=q.height,B.push({type:"elem",elem:U,shift:G})}}B=qc.makeVList({positionType:"individualShift",children:B},t),B=qc.makeSpan(["col-align-"+(R.align||"c")],[B]),N.push(B),(r<a-1||e.hskipBeforeAndAfter)&&0!==($=tl.deflt(R.postgap,d))&&((T=qc.makeSpan(["arraycolsep"],[])).style.width=zl($),N.push(T))}}if(s=qc.makeSpan(["mtable"],N),l.length>0){for(var V=qc.makeLineSpan("hline",t,c),W=qc.makeLineSpan("hdashline",t,c),K=[{type:"elem",elem:s,shift:0}];l.length>0;){var Y=l.pop(),X=Y.pos-C;Y.isDashed?K.push({type:"elem",elem:W,shift:X}):K.push({type:"elem",elem:V,shift:X})}s=qc.makeVList({positionType:"individualShift",children:K},t)}if(0===I.length)return qc.makeSpan(["mord"],[s],t);var Z=qc.makeVList({positionType:"individualShift",children:I},t);return Z=qc.makeSpan(["tag"],[Z],t),qc.makeFragment([s,Z])
|
|
361
|
+
},Hd={c:"center ",l:"left ",r:"right "},Fd=function(e,t){for(var n=[],r=new yu.MathNode("mtd",[],["mtr-glue"]),o=new yu.MathNode("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var a=e.body[i],s=[],l=0;l<a.length;l++)s.push(new yu.MathNode("mtd",[Tu(a[l],t)]));e.tags&&e.tags[i]&&(s.unshift(r),s.push(r),e.leqno?s.unshift(o):s.push(o)),n.push(new yu.MathNode("mtr",s))}var c=new yu.MathNode("mtable",n),u=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",zl(u));var d="",h="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(d+="top ",g=1),"separator"===p[p.length-1].type&&(d+="bottom ",v-=1);for(var b=g;b<v;b++)"align"===p[b].type?(h+=Hd[p[b].align],f&&(m+="none "),f=!0):"separator"===p[b].type&&f&&(m+="|"===p[b].separator?"solid ":"dashed ",f=!1);c.setAttribute("columnalign",h.trim()),/[sd]/.test(m)&&c.setAttribute("columnlines",m.trim())}if("align"===e.colSeparationType){
|
|
362
|
+
for(var y=e.cols||[],_="",w=1;w<y.length;w++)_+=w%2?"0em ":"1em ";c.setAttribute("columnspacing",_.trim())}else"alignat"===e.colSeparationType||"gather"===e.colSeparationType?c.setAttribute("columnspacing","0em"):"small"===e.colSeparationType?c.setAttribute("columnspacing","0.2778em"):"CD"===e.colSeparationType?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var x="",k=e.hLinesBeforeRow;d+=k[0].length>0?"left ":"",d+=k[k.length-1].length>0?"right ":"";for(var S=1;S<k.length-1;S++)x+=0===k[S].length?"none ":k[S][0]?"dashed ":"solid ";return/[sd]/.test(x)&&c.setAttribute("rowlines",x.trim()),""!==d&&(c=new yu.MathNode("menclose",[c])).setAttribute("notation",d.trim()),e.arraystretch&&e.arraystretch<1&&(c=new yu.MathNode("mstyle",[c])).setAttribute("scriptlevel","1"),c},$d=function(e,t){-1===e.envName.indexOf("ed")&&Ld(e);var n,r=[],o=e.envName.indexOf("at")>-1?"alignat":"align",i="split"===e.envName,a=Rd(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:Pd(e.envName),emptySingleRow:!0,
|
|
363
|
+
colSeparationType:o,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,l={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&"ordgroup"===t[0].type){for(var c="",u=0;u<t[0].body.length;u++){c+=Pu(t[0].body[u],"textord").text}n=Number(c),s=2*n}var d=!s;a.body.forEach((function(e){for(var t=1;t<e.length;t+=2){var r=Pu(e[t],"styling");Pu(r.body[0],"ordgroup").body.unshift(l)}if(d)s<e.length&&(s=e.length);else{var o=e.length/2;if(n<o)throw new Xs("Too many math in a row: expected "+n+", but got "+o,e[0])}}));for(var h=0;h<s;++h){var p="r",m=0;h%2==1?p="l":h>0&&d&&(m=1),r[h]={type:"align",align:p,pregap:m,postgap:0}}return a.colSeparationType=d?"align":"alignat",a};Nd({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(Du(t[0])?[t[0]]:Pu(t[0],"ordgroup").body).map((function(e){var t=Ru(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"}
|
|
364
|
+
;throw new Xs("Unknown column alignment: "+t,e)})),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return Rd(e.parser,r,Dd(e.envName))},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if("*"===e.envName.charAt(e.envName.length-1)){var o=e.parser;if(o.consumeSpaces(),"["===o.fetch().text){if(o.consume(),o.consumeSpaces(),n=o.fetch().text,-1==="lcr".indexOf(n))throw new Xs("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),r.cols=[{type:"align",align:n}]}}var i=Rd(e.parser,r,Dd(e.envName)),a=Math.max(0,...i.body.map((e=>e.length)));return i.cols=new Array(a).fill({type:"align",align:n}),t?{
|
|
365
|
+
type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=Rd(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(Du(t[0])?[t[0]]:Pu(t[0],"ordgroup").body).map((function(e){var t=Ru(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new Xs("Unknown column alignment: "+t,e)}));if(n.length>1)throw new Xs("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=Rd(e.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new Xs("{subarray} can contain only one column");return r},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=Rd(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{
|
|
366
|
+
type:"align",align:"l",pregap:0,postgap:0}]},Dd(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:$d,htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&Ld(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Pd(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Rd(e.parser,t,"display")},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:$d,htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Ld(e);var t={autoTag:Pd(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno}
|
|
367
|
+
;return Rd(e.parser,t,"display")},htmlBuilder:jd,mathmlBuilder:Fd}),Nd({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(Ld(e),function(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===t[t.length-1].length&&t.pop();break}throw new Xs("Expected \\\\ or \\cr or \\end",e.nextToken)}e.consume()}for(var r,o,i=[],a=[i],s=0;s<t.length;s++){for(var l=t[s],c={type:"styling",body:[],mode:"math",style:"display"},u=0;u<l.length;u++)if(Wu(l[u])){i.push(c);var d=Ru(l[u+=1]).text,h=new Array(2);if(h[0]={type:"ordgroup",mode:"math",body:[]},h[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(d)>-1);else{if(!("<>AV".indexOf(d)>-1))throw new Xs('Expected one of "<>AV=|." after @',l[u]);for(var p=0;p<2;p++){for(var m=!0,f=u+1;f<l.length;f++){if(o=d,("mathord"===(r=l[f]).type||"atom"===r.type)&&r.text===o){m=!1,u=f;break
|
|
368
|
+
}if(Wu(l[f]))throw new Xs("Missing a "+d+" character to complete a CD arrow.",l[f]);h[p].body.push(l[f])}if(m)throw new Xs("Missing a "+d+" character to complete a CD arrow.",l[u])}}var g={type:"styling",body:[Ku(d,h,e)],mode:"math",style:"display"};i.push(g),c={type:"styling",body:[],mode:"math",style:"display"}}else c.body.push(l[u]);s%2==0?i.push(c):i.shift(),i=[],a.push(i)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:a,arraystretch:1,addJot:!0,rowGaps:[null],cols:new Array(a[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25}),colSeparationType:"CD",hLinesBeforeRow:new Array(a.length+1).fill([])}}(e.parser)),htmlBuilder:jd,mathmlBuilder:Fd}),Od("\\nonumber","\\gdef\\@eqnsw{0}"),Od("\\notag","\\nonumber"),Qc({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Xs(e.funcName+" valid only within array environment")}});var Bd=Md;Qc({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,
|
|
369
|
+
argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];if("ordgroup"!==o.type)throw new Xs("Invalid environment name",o);for(var i="",a=0;a<o.body.length;++a)i+=Pu(o.body[a],"textord").text;if("\\begin"===r){if(!Bd.hasOwnProperty(i))throw new Xs("No such environment: "+i,o);var s=Bd[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",s),u={mode:n.mode,envName:i,parser:n},d=s.handler(u,l,c);n.expect("\\end",!1);var h=n.nextToken,p=Pu(n.parseFunction(),"environment");if(p.name!==i)throw new Xs("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",h);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:o}}});var qd=(e,t)=>{var n=e.font,r=t.withFont(n);return pu(e.body,r)},Ud=(e,t)=>{var n=e.font,r=t.withFont(n);return Tu(e.body,r)},Gd={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Qc({type:"font",
|
|
370
|
+
names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=eu(t[0]),i=r;return i in Gd&&(i=Gd[i]),{type:"font",mode:n.mode,font:i.slice(1),body:o}},htmlBuilder:qd,mathmlBuilder:Ud}),Qc({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],o=tl.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Gu(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:o}}}),Qc({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:o}=e,{mode:i}=n,a=n.parseExpression(!0,o);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:qd,mathmlBuilder:Ud});var Vd=(e,t)=>{var n=t
|
|
371
|
+
;return"display"===e?n=n.id>=pl.SCRIPT.id?n.text():pl.DISPLAY:"text"===e&&n.size===pl.DISPLAY.size?n=pl.TEXT:"script"===e?n=pl.SCRIPT:"scriptscript"===e&&(n=pl.SCRIPTSCRIPT),n},Wd=(e,t)=>{var n,r=Vd(e.size,t.style),o=r.fracNum(),i=r.fracDen();n=t.havingStyle(o);var a=pu(e.numer,n,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;a.height=a.height<s?s:a.height,a.depth=a.depth<l?l:a.depth}n=t.havingStyle(i);var c,u,d,h,p,m,f,g,v,b,y=pu(e.denom,n,t);if(e.hasBarLine?(e.barSize?(u=Ol(e.barSize,t),c=qc.makeLineSpan("frac-line",t,u)):c=qc.makeLineSpan("frac-line",t),u=c.height,d=c.height):(c=null,u=0,d=t.fontMetrics().defaultRuleThickness),r.size===pl.DISPLAY.size||"display"===e.size?(h=t.fontMetrics().num1,p=u>0?3*d:7*d,m=t.fontMetrics().denom1):(u>0?(h=t.fontMetrics().num2,p=d):(h=t.fontMetrics().num3,p=3*d),m=t.fontMetrics().denom2),c){var _=t.fontMetrics().axisHeight;h-a.depth-(_+.5*u)<p&&(h+=p-(h-a.depth-(_+.5*u))),_-.5*u-(y.height-m)<p&&(m+=p-(_-.5*u-(y.height-m)))
|
|
372
|
+
;var w=-(_-.5*u);f=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:y,shift:m},{type:"elem",elem:c,shift:w},{type:"elem",elem:a,shift:-h}]},t)}else{var x=h-a.depth-(y.height-m);x<p&&(h+=.5*(p-x),m+=.5*(p-x)),f=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:y,shift:m},{type:"elem",elem:a,shift:-h}]},t)}return n=t.havingStyle(r),f.height*=n.sizeMultiplier/t.sizeMultiplier,f.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===pl.DISPLAY.size?t.fontMetrics().delim1:r.size===pl.SCRIPTSCRIPT.size?t.havingStyle(pl.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?hu(t,["mopen"]):xd.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),b=e.continued?qc.makeSpan([]):null==e.rightDelim?hu(t,["mclose"]):xd.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),qc.makeSpan(["mord"].concat(n.sizingClasses(t)),[v,qc.makeSpan(["mfrac"],[f]),b],t)},Kd=(e,t)=>{var n=new yu.MathNode("mfrac",[Tu(e.numer,t),Tu(e.denom,t)])
|
|
373
|
+
;if(e.hasBarLine){if(e.barSize){var r=Ol(e.barSize,t);n.setAttribute("linethickness",zl(r))}}else n.setAttribute("linethickness","0px");var o=Vd(e.size,t.style);if(o.size!==t.style.size){n=new yu.MathNode("mstyle",[n]);var i=o.size===pl.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var s=new yu.MathNode("mo",[new yu.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),a.push(s)}if(a.push(n),null!=e.rightDelim){var l=new yu.MathNode("mo",[new yu.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}return wu(a)}return n};Qc({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var n,{parser:r,funcName:o}=e,i=t[0],a=t[1],s=null,l=null,c="auto";switch(o){case"\\dfrac":case"\\frac":case"\\tfrac":n=!0;break
|
|
374
|
+
;case"\\\\atopfrac":n=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":n=!1,s="(",l=")";break;case"\\\\bracefrac":n=!1,s="\\{",l="\\}";break;case"\\\\brackfrac":n=!1,s="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(o){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text"}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:n,leftDelim:s,rightDelim:l,size:c,barSize:null}},htmlBuilder:Wd,mathmlBuilder:Kd}),Qc({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0],i=t[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:o,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Qc({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var t,{parser:n,funcName:r,token:o}=e;switch(r){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;case"\\brace":
|
|
375
|
+
t="\\\\bracefrac";break;case"\\brack":t="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:t,token:o}}});var Yd=["display","text","script","scriptscript"],Xd=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};Qc({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var n,{parser:r}=e,o=t[4],i=t[5],a=eu(t[0]),s="atom"===a.type&&"open"===a.family?Xd(a.text):null,l=eu(t[1]),c="atom"===l.type&&"close"===l.family?Xd(l.text):null,u=Pu(t[2],"size"),d=null;n=!!u.isBlank||(d=u.value).number>0;var h="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var m=Pu(p.body[0],"textord");h=Yd[Number(m.text)]}}else p=Pu(p,"textord"),h=Yd[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:o,denom:i,continued:!1,hasBarLine:n,barSize:d,leftDelim:s,rightDelim:c,size:h}},htmlBuilder:Wd,mathmlBuilder:Kd}),Qc({type:"infix",names:["\\above"],
|
|
376
|
+
props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:o}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Pu(t[0],"size").value,token:o}}}),Qc({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0],i=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(Pu(t[1],"infix").size),a=t[2],s=i.number>0;return{type:"genfrac",mode:n.mode,numer:o,denom:a,continued:!1,hasBarLine:s,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Wd,mathmlBuilder:Kd});var Zd=(e,t)=>{var n,r,o=t.style;"supsub"===e.type?(n=e.sup?pu(e.sup,t.havingStyle(o.sup()),t):pu(e.sub,t.havingStyle(o.sub()),t),r=Pu(e.base,"horizBrace")):r=Pu(e,"horizBrace");var i,a=pu(r.base,t.havingBaseStyle(pl.DISPLAY)),s=Lu(r,t);if(r.isOver?(i=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]
|
|
377
|
+
},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=qc.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},t)).children[0].children[0].children[0].classes.push("svg-align"),n){var l=qc.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t);i=r.isOver?qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},t):qc.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},t)}return qc.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t)};Qc({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:t[0]}},htmlBuilder:Zd,mathmlBuilder:(e,t)=>{var n=zu(e.label);return new yu.MathNode(e.isOver?"mover":"munder",[Tu(e.base,t),n])}}),Qc({
|
|
378
|
+
type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],o=Pu(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:n.mode,href:o,body:tu(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=su(e.body,t,!1);return qc.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Au(e.body,t);return n instanceof vu||(n=new vu("mrow",[n])),n.setAttribute("href",e.href),n}}),Qc({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Pu(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var o=[],i=0;i<r.length;i++){var a=r[i];"~"===a&&(a="\\textasciitilde"),o.push({type:"textord",mode:"text",text:a})}var s={type:"text",mode:n.mode,font:"\\texttt",body:o};return{type:"href",mode:n.mode,href:r,body:tu(s)}}}),Qc({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],
|
|
379
|
+
allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:tu(t[0])}},htmlBuilder(e,t){var n=su(e.body,t,!1);return qc.makeFragment(n)},mathmlBuilder:(e,t)=>new yu.MathNode("mrow",Su(e.body,t))}),Qc({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var n,{parser:r,funcName:o,token:i}=e,a=Pu(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l={};switch(o){case"\\htmlClass":l.class=a,n={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,n={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,n={command:"\\htmlStyle",style:a};break;case"\\htmlData":for(var c=a.split(","),u=0;u<c.length;u++){var d=c[u],h=d.indexOf("=");if(h<0)throw new Xs("\\htmlData key/value '"+d+"' missing equals sign");var p=d.slice(0,h),m=d.slice(h+1);l["data-"+p.trim()]=m}n={command:"\\htmlData",
|
|
380
|
+
attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:tu(s)}:r.formatUnsupportedCmd(o)},htmlBuilder:(e,t)=>{var n=su(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var o=qc.makeSpan(r,n,t);for(var i in e.attributes)"class"!==i&&e.attributes.hasOwnProperty(i)&&o.setAttribute(i,e.attributes[i]);return o},mathmlBuilder:(e,t)=>Au(e.body,t)}),Qc({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:tu(t[0]),mathml:tu(t[1])}},htmlBuilder:(e,t)=>{var n=su(e.html,t,!1);return qc.makeFragment(n)},mathmlBuilder:(e,t)=>Au(e.mathml,t)});var Qd=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new Xs("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]}
|
|
381
|
+
;if(!Il(n))throw new Xs("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Qc({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,o={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},s="";if(n[0])for(var l=Pu(n[0],"raw").string.split(","),c=0;c<l.length;c++){var u=l[c].split("=");if(2===u.length){var d=u[1].trim();switch(u[0].trim()){case"alt":s=d;break;case"width":o=Qd(d);break;case"height":i=Qd(d);break;case"totalheight":a=Qd(d);break;default:throw new Xs("Invalid key: '"+u[0]+"' in \\includegraphics.")}}}var h=Pu(t[0],"url").url;return""===s&&(s=(s=(s=h).replace(/^.*[\\/]/,"")).substring(0,s.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:r.mode,alt:s,width:o,height:i,totalheight:a,src:h}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=Ol(e.height,t),r=0
|
|
382
|
+
;e.totalheight.number>0&&(r=Ol(e.totalheight,t)-n);var o=0;e.width.number>0&&(o=Ol(e.width,t));var i={height:zl(n+r)};o>0&&(i.width=zl(o)),r>0&&(i.verticalAlign=zl(-r));var a=new $l(e.src,e.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(e,t)=>{var n=new yu.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var r=Ol(e.height,t),o=0;if(e.totalheight.number>0&&(o=Ol(e.totalheight,t)-r,n.setAttribute("valign",zl(-o))),n.setAttribute("height",zl(r+o)),e.width.number>0){var i=Ol(e.width,t);n.setAttribute("width",zl(i))}return n.setAttribute("src",e.src),n}}),Qc({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,o=Pu(t[0],"size");if(n.settings.strict){var i="m"===r[1],a="mu"===o.value.unit;i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+o.value.unit+" units"),
|
|
383
|
+
"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:o.value}},htmlBuilder:(e,t)=>qc.makeGlue(e.dimension,t),mathmlBuilder(e,t){var n=Ol(e.dimension,t);return new yu.SpaceNode(n)}}),Qc({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:o}},htmlBuilder:(e,t)=>{var n;"clap"===e.alignment?(n=qc.makeSpan([],[pu(e.body,t)]),n=qc.makeSpan(["inner"],[n],t)):n=qc.makeSpan(["inner"],[pu(e.body,t)]);var r=qc.makeSpan(["fix"],[]),o=qc.makeSpan([e.alignment],[n,r],t),i=qc.makeSpan(["strut"]);return i.style.height=zl(o.height+o.depth),o.depth&&(i.style.verticalAlign=zl(-o.depth)),o.children.unshift(i),o=qc.makeSpan(["thinbox"],[o],t),qc.makeSpan(["mord","vbox"],[o],t)},mathmlBuilder:(e,t)=>{
|
|
384
|
+
var n=new yu.MathNode("mpadded",[Tu(e.body,t)]);if("rlap"!==e.alignment){var r="llap"===e.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),Qc({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,o=r.mode;r.switchMode("math");var i="\\("===n?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(o),{type:"styling",mode:r.mode,style:"text",body:a}}}),Qc({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Xs("Mismatched "+e.funcName)}});var Jd=(e,t)=>{switch(t.style.size){case pl.DISPLAY.size:return e.display;case pl.TEXT.size:return e.text;case pl.SCRIPT.size:return e.script;case pl.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Qc({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:tu(t[0]),text:tu(t[1]),
|
|
385
|
+
script:tu(t[2]),scriptscript:tu(t[3])}},htmlBuilder:(e,t)=>{var n=Jd(e,t),r=su(n,t,!1);return qc.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=Jd(e,t);return Au(n,t)}});var eh=(e,t,n,r,o,i,a)=>{e=qc.makeSpan([],[e]);var s,l,c,u=n&&tl.isCharacterBox(n);if(t){var d=pu(t,r.havingStyle(o.sup()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=pu(n,r.havingStyle(o.sub()),r);s={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}if(l&&s){var p=r.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+a;c=qc.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:zl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:zl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(s){var m=e.height-a;c=qc.makeVList({positionType:"top",positionData:m,
|
|
386
|
+
children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:zl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e}]},r)}else{if(!l)return e;var f=e.depth+a;c=qc.makeVList({positionType:"bottom",positionData:f,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:zl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}var g=[c];if(s&&0!==i&&!u){var v=qc.makeSpan(["mspace"],[],r);v.style.marginRight=zl(i),g.unshift(v)}return qc.makeSpan(["mop","op-limits"],g,r)},th=["\\smallint"],nh=(e,t)=>{var n,r,o,i=!1;"supsub"===e.type?(n=e.sup,r=e.sub,o=Pu(e.base,"op"),i=!0):o=Pu(e,"op");var a,s=t.style,l=!1;if(s.size===pl.DISPLAY.size&&o.symbol&&!th.includes(o.name)&&(l=!0),o.symbol){var c=l?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==o.name&&"\\oiiint"!==o.name||(u=o.name.slice(1),o.name="oiint"===u?"\\iint":"\\iiint"),a=qc.makeSymbol(o.name,c,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){
|
|
387
|
+
var d=a.italic,h=qc.staticSvg(u+"Size"+(l?"2":"1"),t);a=qc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:h,shift:l?.08:0}]},t),o.name="\\"+u,a.classes.unshift("mop"),a.italic=d}}else if(o.body){var p=su(o.body,t,!0);1===p.length&&p[0]instanceof ql?(a=p[0]).classes[0]="mop":a=qc.makeSpan(["mop"],p,t)}else{for(var m=[],f=1;f<o.name.length;f++)m.push(qc.mathsym(o.name[f],o.mode,t));a=qc.makeSpan(["mop"],m,t)}var g=0,v=0;return(a instanceof ql||"\\oiint"===o.name||"\\oiiint"===o.name)&&!o.suppressBaseShift&&(g=(a.height-a.depth)/2-t.fontMetrics().axisHeight,v=a.italic),i?eh(a,n,r,t,s,v,g):(g&&(a.style.position="relative",a.style.top=zl(g)),a)},rh=(e,t)=>{var n;if(e.symbol)n=new vu("mo",[_u(e.name,e.mode)]),th.includes(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new vu("mo",Su(e.body,t));else{n=new vu("mi",[new bu(e.name.slice(1))]);var r=new vu("mo",[_u("","text")]);n=e.parentIsSupSub?new vu("mrow",[n,r]):gu([n,r])}return n},oh={"∏":"\\prod",
|
|
388
|
+
"∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Qc({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=r;return 1===o.length&&(o=oh[o]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:nh,mathmlBuilder:rh}),Qc({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:tu(r)}},htmlBuilder:nh,mathmlBuilder:rh});var ih={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Qc({type:"op",
|
|
389
|
+
names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nh,mathmlBuilder:rh}),Qc({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:nh,mathmlBuilder:rh}),Qc({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,r=n;return 1===r.length&&(r=ih[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:nh,mathmlBuilder:rh})
|
|
390
|
+
;var ah=(e,t)=>{var n,r,o,i,a=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,o=Pu(e.base,"operatorname"),a=!0):o=Pu(e,"operatorname"),o.body.length>0){for(var s=o.body.map((e=>{var t=e.text;return"string"==typeof t?{type:"textord",mode:e.mode,text:t}:e})),l=su(s,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof ql&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=qc.makeSpan(["mop"],l,t)}else i=qc.makeSpan(["mop"],[],t);return a?eh(i,n,r,t,t.style,0,0):i};function sh(e,t,n){for(var r=su(e,t,!1),o=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var a=r[i].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[a+1]==="reset-size"+t.size&&(r[i].classes[a+1]="reset-size"+n.size),r[i].height*=o,r[i].depth*=o}return qc.makeFragment(r)}Qc({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=t[0];return{type:"operatorname",mode:n.mode,body:tu(o),
|
|
391
|
+
alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:ah,mathmlBuilder:(e,t)=>{for(var n=Su(e.body,t.withFont("mathrm")),r=!0,o=0;o<n.length;o++){var i=n[o];if(i instanceof yu.SpaceNode);else if(i instanceof yu.MathNode)switch(i.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":var a=i.children[0];1===i.children.length&&a instanceof yu.TextNode?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break;default:r=!1}else r=!1}if(r){var s=n.map((e=>e.toText())).join("");n=[new yu.TextNode(s)]}var l=new yu.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new yu.MathNode("mo",[_u("","text")]);return e.parentIsSupSub?new yu.MathNode("mrow",[l,c]):yu.newDocumentFragment([l,c])}}),Od("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Jc({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?qc.makeFragment(su(e.body,t,!1)):qc.makeSpan(["mord"],su(e.body,t,!0),t),mathmlBuilder:(e,t)=>Au(e.body,t,!0)}),Qc({type:"overline",
|
|
392
|
+
names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=pu(e.body,t.havingCrampedStyle()),r=qc.makeLineSpan("overline-line",t),o=t.fontMetrics().defaultRuleThickness,i=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]},t);return qc.makeSpan(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new yu.MathNode("mo",[new yu.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new yu.MathNode("mover",[Tu(e.body,t),n]);return r.setAttribute("accent","true"),r}}),Qc({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:tu(r)}},htmlBuilder:(e,t)=>{var n=su(e.body,t.withPhantom(),!1);return qc.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=Su(e.body,t);return new yu.MathNode("mphantom",n)}}),Qc({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,
|
|
393
|
+
allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=qc.makeSpan([],[pu(e.body,t.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),qc.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=Su(tu(e.body),t),r=new yu.MathNode("mphantom",n),o=new yu.MathNode("mpadded",[r]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),Qc({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=qc.makeSpan(["inner"],[pu(e.body,t.withPhantom())]),r=qc.makeSpan(["fix"],[]);return qc.makeSpan(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Su(tu(e.body),t),r=new yu.MathNode("mphantom",n),o=new yu.MathNode("mpadded",[r])
|
|
394
|
+
;return o.setAttribute("width","0px"),o}}),Qc({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Pu(t[0],"size").value,o=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:o}},htmlBuilder(e,t){var n=pu(e.body,t),r=Ol(e.dy,t);return qc.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new yu.MathNode("mpadded",[Tu(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),Qc({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),Qc({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,o=n[0],i=Pu(t[0],"size"),a=Pu(t[1],"size");return{type:"rule",mode:r.mode,shift:o&&Pu(o,"size").value,width:i.value,height:a.value}},htmlBuilder(e,t){
|
|
395
|
+
var n=qc.makeSpan(["mord","rule"],[],t),r=Ol(e.width,t),o=Ol(e.height,t),i=e.shift?Ol(e.shift,t):0;return n.style.borderRightWidth=zl(r),n.style.borderTopWidth=zl(o),n.style.bottom=zl(i),n.width=r,n.height=o+i,n.depth=-i,n.maxFontSize=1.125*o*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Ol(e.width,t),r=Ol(e.height,t),o=e.shift?Ol(e.shift,t):0,i=t.color&&t.getColor()||"black",a=new yu.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",zl(n)),a.setAttribute("height",zl(r));var s=new yu.MathNode("mpadded",[a]);return o>=0?s.setAttribute("height",zl(o)):(s.setAttribute("height",zl(o)),s.setAttribute("depth",zl(-o))),s.setAttribute("voffset",zl(o)),s}});var lh=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];Qc({type:"sizing",names:lh,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:o}=e,i=o.parseExpression(!1,n);return{type:"sizing",mode:o.mode,size:lh.indexOf(r)+1,
|
|
396
|
+
body:i}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return sh(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Su(e.body,n),o=new yu.MathNode("mstyle",r);return o.setAttribute("mathsize",zl(n.sizeMultiplier)),o}}),Qc({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,o=!1,i=!1,a=n[0]&&Pu(n[0],"ordgroup");if(a)for(var s="",l=0;l<a.body.length;++l){if("t"===(s=a.body[l].text))o=!0;else{if("b"!==s){o=!1,i=!1;break}i=!0}}else o=!0,i=!0;var c=t[0];return{type:"smash",mode:r.mode,body:c,smashHeight:o,smashDepth:i}},htmlBuilder:(e,t)=>{var n=qc.makeSpan([],[pu(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(e.smashDepth&&(n.depth=0,n.children))for(var o=0;o<n.children.length;o++)n.children[o].depth=0;var i=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t);return qc.makeSpan(["mord"],[i],t)},
|
|
397
|
+
mathmlBuilder:(e,t)=>{var n=new yu.MathNode("mpadded",[Tu(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),Qc({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,o=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:o}},htmlBuilder(e,t){var n=pu(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=qc.wrapFragment(n,t);var r=t.fontMetrics().defaultRuleThickness,o=r;t.style.id<pl.TEXT.id&&(o=t.fontMetrics().xHeight);var i=r+o/4,a=n.height+n.depth+i+r,{span:s,ruleWidth:l,advanceWidth:c}=xd.sqrtImage(a,t),u=s.height-l;u>n.height+n.depth+i&&(i=(i+u-n.height-n.depth)/2);var d=s.height-n.height-i-l;n.style.paddingLeft=zl(c);var h=qc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+d)},{type:"elem",elem:s},{type:"kern",size:l}]},t);if(e.index){
|
|
398
|
+
var p=t.havingStyle(pl.SCRIPTSCRIPT),m=pu(e.index,p,t),f=.6*(h.height-h.depth),g=qc.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:m}]},t),v=qc.makeSpan(["root"],[g]);return qc.makeSpan(["mord","sqrt"],[v,h],t)}return qc.makeSpan(["mord","sqrt"],[h],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new yu.MathNode("mroot",[Tu(n,t),Tu(r,t)]):new yu.MathNode("msqrt",[Tu(n,t)])}});var ch={display:pl.DISPLAY,text:pl.TEXT,script:pl.SCRIPT,scriptscript:pl.SCRIPTSCRIPT};Qc({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:o}=e,i=o.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:o.mode,style:a,body:i}},htmlBuilder(e,t){var n=ch[e.style],r=t.havingStyle(n).withFont("");return sh(e.body,r,t)},mathmlBuilder(e,t){var n=ch[e.style],r=t.havingStyle(n),o=Su(e.body,r),i=new yu.MathNode("mstyle",o),a={display:["0","true"],
|
|
399
|
+
text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});Jc({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base;return n?"op"===n.type?n.limits&&(t.style.size===pl.DISPLAY.size||n.alwaysHandleSupSub)?nh:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===pl.DISPLAY.size||n.limits)?ah:null:"accent"===n.type?tl.isCharacterBox(n.base)?ju:null:"horizBrace"===n.type&&!e.sub===n.isOver?Zd:null:null}(e,t);if(n)return n(e,t);var r,o,i,{base:a,sup:s,sub:l}=e,c=pu(a,t),u=t.fontMetrics(),d=0,h=0,p=a&&tl.isCharacterBox(a);if(s){var m=t.havingStyle(t.style.sup());r=pu(s,m,t),p||(d=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(l){var f=t.havingStyle(t.style.sub());o=pu(l,f,t),p||(h=c.depth+f.fontMetrics().subDrop*f.sizeMultiplier/t.sizeMultiplier)}i=t.style===pl.DISPLAY?u.sup1:t.style.cramped?u.sup3:u.sup2;var g,v=t.sizeMultiplier,b=zl(.5/u.ptPerEm/v),y=null;if(o){
|
|
400
|
+
var _=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof ql||_)&&(y=zl(-c.italic))}if(r&&o){d=Math.max(d,i,r.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var w=4*u.defaultRuleThickness;if(d-r.depth-(o.height-h)<w){h=w-(d-r.depth)+o.height;var x=.8*u.xHeight-(d-r.depth);x>0&&(d+=x,h-=x)}var k=[{type:"elem",elem:o,shift:h,marginRight:b,marginLeft:y},{type:"elem",elem:r,shift:-d,marginRight:b}];g=qc.makeVList({positionType:"individualShift",children:k},t)}else if(o){h=Math.max(h,u.sub1,o.height-.8*u.xHeight);var S=[{type:"elem",elem:o,marginLeft:y,marginRight:b}];g=qc.makeVList({positionType:"shift",positionData:h,children:S},t)}else{if(!r)throw new Error("supsub must have either sup or sub.");d=Math.max(d,i,r.depth+.25*u.xHeight),g=qc.makeVList({positionType:"shift",positionData:-d,children:[{type:"elem",elem:r,marginRight:b}]},t)}var A=du(c,"right")||"mord";return qc.makeSpan([A],[c,qc.makeSpan(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1
|
|
401
|
+
;e.base&&"horizBrace"===e.base.type&&!!e.sup===e.base.isOver&&(r=!0,n=e.base.isOver),!e.base||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0);var o,i=[Tu(e.base,t)];if(e.sub&&i.push(Tu(e.sub,t)),e.sup&&i.push(Tu(e.sup,t)),r)o=n?"mover":"munder";else if(e.sub)if(e.sup){var a=e.base;o=a&&"op"===a.type&&a.limits&&t.style===pl.DISPLAY||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(t.style===pl.DISPLAY||a.limits)?"munderover":"msubsup"}else{var s=e.base;o=s&&"op"===s.type&&s.limits&&(t.style===pl.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===pl.DISPLAY)?"munder":"msub"}else{var l=e.base;o=l&&"op"===l.type&&l.limits&&(t.style===pl.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===pl.DISPLAY)?"mover":"msup"}return new yu.MathNode(o,i)}}),Jc({type:"atom",htmlBuilder:(e,t)=>qc.mathsym(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){
|
|
402
|
+
var n=new yu.MathNode("mo",[_u(e.text,e.mode)]);if("bin"===e.family){var r=xu(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var uh={mi:"italic",mn:"normal",mtext:"normal"};Jc({type:"mathord",htmlBuilder:(e,t)=>qc.makeOrd(e,t,"mathord"),mathmlBuilder(e,t){var n=new yu.MathNode("mi",[_u(e.text,e.mode,t)]),r=xu(e,t)||"italic";return r!==uh[n.type]&&n.setAttribute("mathvariant",r),n}}),Jc({type:"textord",htmlBuilder:(e,t)=>qc.makeOrd(e,t,"textord"),mathmlBuilder(e,t){var n,r=_u(e.text,e.mode,t),o=xu(e,t)||"normal";return n="text"===e.mode?new yu.MathNode("mtext",[r]):/[0-9]/.test(e.text)?new yu.MathNode("mn",[r]):"\\prime"===e.text?new yu.MathNode("mo",[r]):new yu.MathNode("mi",[r]),o!==uh[n.type]&&n.setAttribute("mathvariant",o),n}});var dh={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},hh={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},
|
|
403
|
+
"\\nobreakspace":{className:"nobreak"}};Jc({type:"spacing",htmlBuilder(e,t){if(hh.hasOwnProperty(e.text)){var n=hh[e.text].className||"";if("text"===e.mode){var r=qc.makeOrd(e,t,"textord");return r.classes.push(n),r}return qc.makeSpan(["mspace",n],[qc.mathsym(e.text,e.mode,t)],t)}if(dh.hasOwnProperty(e.text))return qc.makeSpan(["mspace",dh[e.text]],[],t);throw new Xs('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!hh.hasOwnProperty(e.text)){if(dh.hasOwnProperty(e.text))return new yu.MathNode("mspace");throw new Xs('Unknown type of space "'+e.text+'"')}return new yu.MathNode("mtext",[new yu.TextNode(" ")])}});var ph=()=>{var e=new yu.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Jc({type:"tag",mathmlBuilder(e,t){var n=new yu.MathNode("mtable",[new yu.MathNode("mtr",[ph(),new yu.MathNode("mtd",[Au(e.body,t)]),ph(),new yu.MathNode("mtd",[Au(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var mh={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt",
|
|
404
|
+
"\\textnormal":"textrm"},fh={"\\textbf":"textbf","\\textmd":"textmd"},gh={"\\textit":"textit","\\textup":"textup"},vh=(e,t)=>{var n=e.font;return n?mh[n]?t.withTextFontFamily(mh[n]):fh[n]?t.withTextFontWeight(fh[n]):"\\emph"===n?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(gh[n]):t};Qc({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];return{type:"text",mode:n.mode,body:tu(o),font:r}},htmlBuilder(e,t){var n=vh(e,t),r=su(e.body,n,!0);return qc.makeSpan(["mord","text"],r,n)},mathmlBuilder(e,t){var n=vh(e,t);return Au(e.body,n)}}),Qc({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){
|
|
405
|
+
var n=pu(e.body,t),r=qc.makeLineSpan("underline-line",t),o=t.fontMetrics().defaultRuleThickness,i=qc.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:o},{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n}]},t);return qc.makeSpan(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new yu.MathNode("mo",[new yu.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new yu.MathNode("munder",[Tu(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),Qc({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=pu(e.body,t),r=t.fontMetrics().axisHeight,o=.5*(n.height-r-(n.depth+r));return qc.makeVList({positionType:"shift",positionData:o,children:[{type:"elem",elem:n}]},t)},mathmlBuilder:(e,t)=>new yu.MathNode("mpadded",[Tu(e.body,t)],["vcenter"])}),Qc({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){
|
|
406
|
+
throw new Xs("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=bh(e),r=[],o=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var a=n[i];"~"===a&&(a="\\textasciitilde"),r.push(qc.makeSymbol(a,"Typewriter-Regular",e.mode,o,["mord","texttt"]))}return qc.makeSpan(["mord","text"].concat(o.sizingClasses(t)),qc.tryCombineChars(r),o)},mathmlBuilder(e,t){var n=new yu.TextNode(bh(e)),r=new yu.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var bh=e=>e.body.replace(/ /g,e.star?"␣":" "),yh=Yc,_h="[ \r\n\t]",wh="(\\\\[a-zA-Z@]+)"+_h+"*",xh="[̀-ͯ]",kh=new RegExp(xh+"+$"),Sh="("+_h+"+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-]"+xh+"*|[\ud800-\udbff][\udc00-\udfff]"+xh+"*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|"+wh+"|\\\\[^\ud800-\udfff])";class Ah{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(Sh,"g"),this.catcodes={"%":14,"~":13}}
|
|
407
|
+
setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Ys("EOF",new Ks(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new Xs("Unexpected character: '"+e[t]+"'",new Ys(e[t],new Ks(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[r]){var o=e.indexOf("\n",this.tokenRegex.lastIndex);return-1===o?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=o+1,this.lex()}return new Ys(r,new Ks(this,t,this.tokenRegex.lastIndex))}}class Th{constructor(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){
|
|
408
|
+
if(0===this.undefStack.length)throw new Xs("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(null==e[t]?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(void 0===n&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var o=this.undefStack[this.undefStack.length-1];o&&!o.hasOwnProperty(e)&&(o[e]=this.current[e])}null==t?delete this.current[e]:this.current[e]=t}}var Eh=Id;Od("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),Od("\\expandafter",(function(e){var t=e.popToken()
|
|
409
|
+
;return e.expandOnce(!0),{tokens:[t],numArgs:0}})),Od("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),Od("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),Od("\\@ifnextchar",(function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return 1===t[0].length&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),Od("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Od("\\TextOrMath",(function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));var Ch={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Od("\\char",(function(e){var t,n=e.popToken(),r="";if("'"===n.text)t=8,n=e.popToken();else if('"'===n.text)t=16,n=e.popToken();else if("`"===n.text)if("\\"===(n=e.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new Xs("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){
|
|
410
|
+
if(null==(r=Ch[n.text])||r>=t)throw new Xs("Invalid base-"+t+" digit "+n.text);for(var o;null!=(o=Ch[e.future().text])&&o<t;)r*=t,r+=o,e.popToken()}return"\\@char{"+r+"}"}));var Mh=(e,t,n,r)=>{var o=e.consumeArg().tokens;if(1!==o.length)throw new Xs("\\newcommand's first argument must be a macro name");var i=o[0].text,a=e.isDefined(i);if(a&&!t)throw new Xs("\\newcommand{"+i+"} attempting to redefine "+i+"; use \\renewcommand");if(!a&&!n)throw new Xs("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var s=0;if(1===(o=e.consumeArg().tokens).length&&"["===o[0].text){for(var l="",c=e.expandNextToken();"]"!==c.text&&"EOF"!==c.text;)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Xs("Invalid number of arguments: "+l);s=parseInt(l),o=e.consumeArg().tokens}return a&&r||e.macros.set(i,{tokens:o,numArgs:s}),""};Od("\\newcommand",(e=>Mh(e,!1,!0,!1))),Od("\\renewcommand",(e=>Mh(e,!0,!1,!1))),Od("\\providecommand",(e=>Mh(e,!0,!0,!0))),Od("\\message",(e=>{
|
|
411
|
+
var t=e.consumeArgs(1)[0];return console.log(t.reverse().map((e=>e.text)).join("")),""})),Od("\\errmessage",(e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map((e=>e.text)).join("")),""})),Od("\\show",(e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),yh[n],Xl.math[n],Xl.text[n]),""})),Od("\\bgroup","{"),Od("\\egroup","}"),Od("~","\\nobreakspace"),Od("\\lq","`"),Od("\\rq","'"),Od("\\aa","\\r a"),Od("\\AA","\\r A"),Od("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),Od("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),Od("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),Od("ℬ","\\mathscr{B}"),Od("ℰ","\\mathscr{E}"),Od("ℱ","\\mathscr{F}"),Od("ℋ","\\mathscr{H}"),Od("ℐ","\\mathscr{I}"),Od("ℒ","\\mathscr{L}"),Od("ℳ","\\mathscr{M}"),Od("ℛ","\\mathscr{R}"),Od("ℭ","\\mathfrak{C}"),Od("ℌ","\\mathfrak{H}"),Od("ℨ","\\mathfrak{Z}"),Od("\\Bbbk","\\Bbb{k}"),Od("·","\\cdotp"),Od("\\llap","\\mathllap{\\textrm{#1}}"),
|
|
412
|
+
Od("\\rlap","\\mathrlap{\\textrm{#1}}"),Od("\\clap","\\mathclap{\\textrm{#1}}"),Od("\\mathstrut","\\vphantom{(}"),Od("\\underbar","\\underline{\\text{#1}}"),Od("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),Od("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),Od("\\ne","\\neq"),Od("≠","\\neq"),Od("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),Od("∉","\\notin"),Od("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),Od("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),Od("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),Od("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),Od("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),Od("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),Od("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),
|
|
413
|
+
Od("⟂","\\perp"),Od("‼","\\mathclose{!\\mkern-0.8mu!}"),Od("∌","\\notni"),Od("⌜","\\ulcorner"),Od("⌝","\\urcorner"),Od("⌞","\\llcorner"),Od("⌟","\\lrcorner"),Od("©","\\copyright"),Od("®","\\textregistered"),Od("️","\\textregistered"),Od("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),Od("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),Od("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),Od("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),Od("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),Od("⋮","\\vdots"),Od("\\varGamma","\\mathit{\\Gamma}"),Od("\\varDelta","\\mathit{\\Delta}"),Od("\\varTheta","\\mathit{\\Theta}"),Od("\\varLambda","\\mathit{\\Lambda}"),Od("\\varXi","\\mathit{\\Xi}"),Od("\\varPi","\\mathit{\\Pi}"),Od("\\varSigma","\\mathit{\\Sigma}"),Od("\\varUpsilon","\\mathit{\\Upsilon}"),Od("\\varPhi","\\mathit{\\Phi}"),Od("\\varPsi","\\mathit{\\Psi}"),Od("\\varOmega","\\mathit{\\Omega}"),Od("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),
|
|
414
|
+
Od("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),Od("\\boxed","\\fbox{$\\displaystyle{#1}$}"),Od("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),Od("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),Od("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),Od("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),Od("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Nh={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb",
|
|
415
|
+
"\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Od("\\dots",(function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in Nh?t=Nh[n]:("\\not"===n.slice(0,4)||n in Xl.math&&["bin","rel"].includes(Xl.math[n].group))&&(t="\\dotsb"),t}));var Ih={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Od("\\dotso",(function(e){return e.future().text in Ih?"\\ldots\\,":"\\ldots"})),Od("\\dotsc",(function(e){var t=e.future().text
|
|
416
|
+
;return t in Ih&&","!==t?"\\ldots\\,":"\\ldots"})),Od("\\cdots",(function(e){return e.future().text in Ih?"\\@cdots\\,":"\\@cdots"})),Od("\\dotsb","\\cdots"),Od("\\dotsm","\\cdots"),Od("\\dotsi","\\!\\cdots"),Od("\\dotsx","\\ldots\\,"),Od("\\DOTSI","\\relax"),Od("\\DOTSB","\\relax"),Od("\\DOTSX","\\relax"),Od("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Od("\\,","\\tmspace+{3mu}{.1667em}"),Od("\\thinspace","\\,"),Od("\\>","\\mskip{4mu}"),Od("\\:","\\tmspace+{4mu}{.2222em}"),Od("\\medspace","\\:"),Od("\\;","\\tmspace+{5mu}{.2777em}"),Od("\\thickspace","\\;"),Od("\\!","\\tmspace-{3mu}{.1667em}"),Od("\\negthinspace","\\!"),Od("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Od("\\negthickspace","\\tmspace-{5mu}{.277em}"),Od("\\enspace","\\kern.5em "),Od("\\enskip","\\hskip.5em\\relax"),Od("\\quad","\\hskip1em\\relax"),Od("\\qquad","\\hskip2em\\relax"),Od("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Od("\\tag@paren","\\tag@literal{({#1})}"),Od("\\tag@literal",(e=>{
|
|
417
|
+
if(e.macros.get("\\df@tag"))throw new Xs("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Od("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Od("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Od("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Od("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Od("\\newline","\\\\\\relax"),Od("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Oh=zl(_l["Main-Regular"]["T".charCodeAt(0)][1]-.7*_l["Main-Regular"]["A".charCodeAt(0)][1]);Od("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Oh+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Od("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Oh+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Od("\\hspace","\\@ifstar\\@hspacer\\@hspace"),
|
|
418
|
+
Od("\\@hspace","\\hskip #1\\relax"),Od("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Od("\\ordinarycolon",":"),Od("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Od("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Od("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Od("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Od("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Od("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Od("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Od("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),
|
|
419
|
+
Od("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Od("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Od("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Od("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Od("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Od("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Od("∷","\\dblcolon"),Od("∹","\\eqcolon"),Od("≔","\\coloneqq"),Od("≕","\\eqqcolon"),Od("⩴","\\Coloneqq"),Od("\\ratio","\\vcentcolon"),Od("\\coloncolon","\\dblcolon"),Od("\\colonequals","\\coloneqq"),Od("\\coloncolonequals","\\Coloneqq"),Od("\\equalscolon","\\eqqcolon"),
|
|
420
|
+
Od("\\equalscoloncolon","\\Eqqcolon"),Od("\\colonminus","\\coloneq"),Od("\\coloncolonminus","\\Coloneq"),Od("\\minuscolon","\\eqcolon"),Od("\\minuscoloncolon","\\Eqcolon"),Od("\\coloncolonapprox","\\Colonapprox"),Od("\\coloncolonsim","\\Colonsim"),Od("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Od("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Od("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Od("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Od("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),Od("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Od("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Od("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),Od("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),Od("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),Od("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),Od("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),
|
|
421
|
+
Od("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),Od("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),Od("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),Od("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),Od("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),Od("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),Od("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),Od("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),Od("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),Od("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),Od("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),Od("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),Od("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),Od("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),Od("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),Od("\\imath","\\html@mathml{\\@imath}{ı}"),Od("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),Od("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),
|
|
422
|
+
Od("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),Od("⟦","\\llbracket"),Od("⟧","\\rrbracket"),Od("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),Od("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),Od("⦃","\\lBrace"),Od("⦄","\\rBrace"),Od("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Od("⦵","\\minuso"),Od("\\darr","\\downarrow"),Od("\\dArr","\\Downarrow"),Od("\\Darr","\\Downarrow"),Od("\\lang","\\langle"),Od("\\rang","\\rangle"),Od("\\uarr","\\uparrow"),Od("\\uArr","\\Uparrow"),Od("\\Uarr","\\Uparrow"),Od("\\N","\\mathbb{N}"),Od("\\R","\\mathbb{R}"),Od("\\Z","\\mathbb{Z}"),Od("\\alef","\\aleph"),Od("\\alefsym","\\aleph"),Od("\\Alpha","\\mathrm{A}"),Od("\\Beta","\\mathrm{B}"),Od("\\bull","\\bullet"),Od("\\Chi","\\mathrm{X}"),Od("\\clubs","\\clubsuit"),Od("\\cnums","\\mathbb{C}"),
|
|
423
|
+
Od("\\Complex","\\mathbb{C}"),Od("\\Dagger","\\ddagger"),Od("\\diamonds","\\diamondsuit"),Od("\\empty","\\emptyset"),Od("\\Epsilon","\\mathrm{E}"),Od("\\Eta","\\mathrm{H}"),Od("\\exist","\\exists"),Od("\\harr","\\leftrightarrow"),Od("\\hArr","\\Leftrightarrow"),Od("\\Harr","\\Leftrightarrow"),Od("\\hearts","\\heartsuit"),Od("\\image","\\Im"),Od("\\infin","\\infty"),Od("\\Iota","\\mathrm{I}"),Od("\\isin","\\in"),Od("\\Kappa","\\mathrm{K}"),Od("\\larr","\\leftarrow"),Od("\\lArr","\\Leftarrow"),Od("\\Larr","\\Leftarrow"),Od("\\lrarr","\\leftrightarrow"),Od("\\lrArr","\\Leftrightarrow"),Od("\\Lrarr","\\Leftrightarrow"),Od("\\Mu","\\mathrm{M}"),Od("\\natnums","\\mathbb{N}"),Od("\\Nu","\\mathrm{N}"),Od("\\Omicron","\\mathrm{O}"),Od("\\plusmn","\\pm"),Od("\\rarr","\\rightarrow"),Od("\\rArr","\\Rightarrow"),Od("\\Rarr","\\Rightarrow"),Od("\\real","\\Re"),Od("\\reals","\\mathbb{R}"),Od("\\Reals","\\mathbb{R}"),Od("\\Rho","\\mathrm{P}"),Od("\\sdot","\\cdot"),Od("\\sect","\\S"),Od("\\spades","\\spadesuit"),
|
|
424
|
+
Od("\\sub","\\subset"),Od("\\sube","\\subseteq"),Od("\\supe","\\supseteq"),Od("\\Tau","\\mathrm{T}"),Od("\\thetasym","\\vartheta"),Od("\\weierp","\\wp"),Od("\\Zeta","\\mathrm{Z}"),Od("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Od("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Od("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Od("\\bra","\\mathinner{\\langle{#1}|}"),Od("\\ket","\\mathinner{|{#1}\\rangle}"),Od("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Od("\\Bra","\\left\\langle#1\\right|"),Od("\\Ket","\\left|#1\\right\\rangle");var zh=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,o=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var l=t=>n=>{e&&(n.macros.set("|",a),o.length&&n.macros.set("\\|",s));var i=t;!t&&o.length&&("|"===n.future().text&&(n.popToken(),i=!0));return{tokens:i?o:r,numArgs:0}};t.macros.set("|",l(!1)),o.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,u=t.expandTokens([...i,...c,...n])
|
|
425
|
+
;return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};Od("\\bra@ket",zh(!1)),Od("\\bra@set",zh(!0)),Od("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),Od("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),Od("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),Od("\\angln","{\\angl n}"),Od("\\blue","\\textcolor{##6495ed}{#1}"),Od("\\orange","\\textcolor{##ffa500}{#1}"),Od("\\pink","\\textcolor{##ff00af}{#1}"),Od("\\red","\\textcolor{##df0030}{#1}"),Od("\\green","\\textcolor{##28ae7b}{#1}"),Od("\\gray","\\textcolor{gray}{#1}"),Od("\\purple","\\textcolor{##9d38bd}{#1}"),Od("\\blueA","\\textcolor{##ccfaff}{#1}"),Od("\\blueB","\\textcolor{##80f6ff}{#1}"),Od("\\blueC","\\textcolor{##63d9ea}{#1}"),Od("\\blueD","\\textcolor{##11accd}{#1}"),Od("\\blueE","\\textcolor{##0c7f99}{#1}"),Od("\\tealA","\\textcolor{##94fff5}{#1}"),Od("\\tealB","\\textcolor{##26edd5}{#1}"),Od("\\tealC","\\textcolor{##01d1c1}{#1}"),
|
|
426
|
+
Od("\\tealD","\\textcolor{##01a995}{#1}"),Od("\\tealE","\\textcolor{##208170}{#1}"),Od("\\greenA","\\textcolor{##b6ffb0}{#1}"),Od("\\greenB","\\textcolor{##8af281}{#1}"),Od("\\greenC","\\textcolor{##74cf70}{#1}"),Od("\\greenD","\\textcolor{##1fab54}{#1}"),Od("\\greenE","\\textcolor{##0d923f}{#1}"),Od("\\goldA","\\textcolor{##ffd0a9}{#1}"),Od("\\goldB","\\textcolor{##ffbb71}{#1}"),Od("\\goldC","\\textcolor{##ff9c39}{#1}"),Od("\\goldD","\\textcolor{##e07d10}{#1}"),Od("\\goldE","\\textcolor{##a75a05}{#1}"),Od("\\redA","\\textcolor{##fca9a9}{#1}"),Od("\\redB","\\textcolor{##ff8482}{#1}"),Od("\\redC","\\textcolor{##f9685d}{#1}"),Od("\\redD","\\textcolor{##e84d39}{#1}"),Od("\\redE","\\textcolor{##bc2612}{#1}"),Od("\\maroonA","\\textcolor{##ffbde0}{#1}"),Od("\\maroonB","\\textcolor{##ff92c6}{#1}"),Od("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Od("\\maroonD","\\textcolor{##ca337c}{#1}"),Od("\\maroonE","\\textcolor{##9e034e}{#1}"),Od("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Od("\\purpleB","\\textcolor{##c6b9fc}{#1}"),
|
|
427
|
+
Od("\\purpleC","\\textcolor{##aa87ff}{#1}"),Od("\\purpleD","\\textcolor{##7854ab}{#1}"),Od("\\purpleE","\\textcolor{##543b78}{#1}"),Od("\\mintA","\\textcolor{##f5f9e8}{#1}"),Od("\\mintB","\\textcolor{##edf2df}{#1}"),Od("\\mintC","\\textcolor{##e0e5cc}{#1}"),Od("\\grayA","\\textcolor{##f6f7f7}{#1}"),Od("\\grayB","\\textcolor{##f0f1f2}{#1}"),Od("\\grayC","\\textcolor{##e3e5e6}{#1}"),Od("\\grayD","\\textcolor{##d6d8da}{#1}"),Od("\\grayE","\\textcolor{##babec2}{#1}"),Od("\\grayF","\\textcolor{##888d93}{#1}"),Od("\\grayG","\\textcolor{##626569}{#1}"),Od("\\grayH","\\textcolor{##3b3e40}{#1}"),Od("\\grayI","\\textcolor{##21242c}{#1}"),Od("\\kaBlue","\\textcolor{##314453}{#1}"),Od("\\kaGreen","\\textcolor{##71B307}{#1}");var Lh={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ph{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Th(Eh,t.macros),this.mode=n,
|
|
428
|
+
this.stack=[]}feed(e){this.lexer=new Ah(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:r,end:n}=this.consumeArg(["]"]))}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new Ys("EOF",n.loc)),this.pushTokens(r),new Ys("",Ks.range(t,n))}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r,o=this.future(),i=0,a=0;do{if(r=this.popToken(),t.push(r),"{"===r.text)++i;else if("}"===r.text){if(-1===--i)throw new Xs("Extra }",r)
|
|
429
|
+
}else if("EOF"===r.text)throw new Xs("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",r);if(e&&n)if((0===i||1===i&&"{"===e[a])&&r.text===e[a]){if(++a===e.length){t.splice(-a,a);break}}else a=0}while(0!==i||n);return"{"===o.text&&"}"===t[t.length-1].text&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:o,end:r}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new Xs("The length of delimiters doesn't match the number of args!");for(var n=t[0],r=0;r<n.length;r++){var o=this.popToken();if(n[r]!==o.text)throw new Xs("Use of the macro doesn't match its definition",o)}}for(var i=[],a=0;a<e;a++)i.push(this.consumeArg(t&&t[a+1]).tokens);return i}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new Xs("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){
|
|
430
|
+
if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new Xs("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var o=r.tokens,i=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs)for(var a=(o=o.slice()).length-1;a>=0;--a){var s=o[a];if("#"===s.text){if(0===a)throw new Xs("Incomplete placeholder at end of macro body",s);if("#"===(s=o[--a]).text)o.splice(a+1,1);else{if(!/^[1-9]$/.test(s.text))throw new Xs("Not a valid argument number",s);o.splice(a,2,...i[+s.text-1])}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Ys(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(!1===this.expandOnce(!0)){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(r)}
|
|
431
|
+
return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t?t.map((e=>e.text)).join(""):t}_getExpansion(e){var t=this.macros.get(e);if(null==t)return t;if(1===e.length){var n=this.lexer.catcodes[e];if(null!=n&&13!==n)return}var r="function"==typeof t?t(this):t;if("string"==typeof r){var o=0;if(-1!==r.indexOf("#"))for(var i=r.replace(/##/g,"");-1!==i.indexOf("#"+(o+1));)++o;for(var a=new Ah(r,this.settings),s=[],l=a.lex();"EOF"!==l.text;)s.push(l),l=a.lex();return s.reverse(),{tokens:s,numArgs:o}}return r}isDefined(e){return this.macros.has(e)||yh.hasOwnProperty(e)||Xl.math.hasOwnProperty(e)||Xl.text.hasOwnProperty(e)||Lh.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:yh.hasOwnProperty(e)&&!yh[e].primitive}}var Rh=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Dh=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9",
|
|
432
|
+
"ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),jh={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{
|
|
433
|
+
text:"\\H"},"̧":{text:"\\c"}},Hh={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř",
|
|
434
434
|
"ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï",
|
|
435
435
|
"Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ",
|
|
436
|
-
"ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class
|
|
437
|
-
this.gullet.pushToken(new
|
|
438
|
-
var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var o;t=this.parseGroup(e)}while("internal"===(null==(o=t)?void 0:o.type));if(!t)throw new
|
|
439
|
-
}else if("_"===o.text){if(n)throw new
|
|
440
|
-
;if("text"===this.mode&&!o.allowedInText)throw new
|
|
441
|
-
return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text"}:null;case"raw":var o=this.parseStringGroup("raw",n);return null!=o?{type:"raw",mode:"text",string:o.text}:null;case"primitive":if(n)throw new
|
|
442
|
-
;if(""===i)throw new
|
|
443
|
-
;var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:n.loc,body:o};return t&&this.switchMode(r),i}parseGroup(e,t){var n,r=this.fetch(),o=r.text;if("{"===o||"\\begingroup"===o){this.consume();var i="{"===o?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,i),s=this.fetch();this.expect(i),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:
|
|
444
|
-
if(this.settings.throwOnError)throw new
|
|
445
|
-
|
|
446
|
-
;this.settings.strict&&(
|
|
447
|
-
delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new
|
|
448
|
-
var a=
|
|
436
|
+
"ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class Fh{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Ph(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(void 0===t&&(t=!0),this.fetch().text!==e)throw new Xs("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),
|
|
437
|
+
this.gullet.pushToken(new Ys("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){"math"===this.mode&&this.consumeSpaces();var r=this.fetch();if(-1!==Fh.endOfExpression.indexOf(r.text))break;if(t&&r.text===t)break;if(e&&yh[r.text]&&yh[r.text].infix)break;var o=this.parseAtom(t);if(!o)break;"internal"!==o.type&&n.push(o)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t,n=-1,r=0;r<e.length;r++)if("infix"===e[r].type){if(-1!==n)throw new Xs("only one infix operator per group",e[r].token);n=r,t=e[r].replaceWith}if(-1!==n&&t){var o,i,a=e.slice(0,n),s=e.slice(n+1);return o=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},i=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},["\\\\abovefrac"===t?this.callFunction(t,[o,e[n],i],[]):this.callFunction(t,[o,i],[])]}return e}handleSupSubscript(e){
|
|
438
|
+
var t,n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();do{var o;t=this.parseGroup(e)}while("internal"===(null==(o=t)?void 0:o.type));if(!t)throw new Xs("Expected group after '"+r+"'",n);return t}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t,n,r=this.parseGroup("atom",e);if("internal"===(null==r?void 0:r.type))return r;if("text"===this.mode)return r;for(;;){this.consumeSpaces();var o=this.fetch();if("\\limits"===o.text||"\\nolimits"===o.text){if(r&&"op"===r.type){var i="\\limits"===o.text;r.limits=i,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new Xs("Limit controls must follow a math operator",o);r.alwaysHandleSupSub&&(r.limits="\\limits"===o.text)}this.consume()}else if("^"===o.text){if(t)throw new Xs("Double superscript",o);t=this.handleSupSubscript("superscript")
|
|
439
|
+
}else if("_"===o.text){if(n)throw new Xs("Double subscript",o);n=this.handleSupSubscript("subscript")}else if("'"===o.text){if(t)throw new Xs("Double superscript",o);var a={type:"textord",mode:this.mode,text:"\\prime"},s=[a];for(this.consume();"'"===this.fetch().text;)s.push(a),this.consume();"^"===this.fetch().text&&s.push(this.handleSupSubscript("superscript")),t={type:"ordgroup",mode:this.mode,body:s}}else{if(!Dh[o.text])break;var l=Rh.test(o.text),c=[];for(c.push(new Ys(Dh[o.text])),this.consume();;){var u=this.fetch().text;if(!Dh[u])break;if(Rh.test(u)!==l)break;c.unshift(new Ys(Dh[u])),this.consume()}var d=this.subparse(c);l?n={type:"ordgroup",mode:"math",body:d}:t={type:"ordgroup",mode:"math",body:d}}}return t||n?{type:"supsub",mode:this.mode,base:r,sup:t,sub:n}:r}parseFunction(e,t){var n=this.fetch(),r=n.text,o=yh[r];if(!o)return null;if(this.consume(),t&&"atom"!==t&&!o.allowedInArgument)throw new Xs("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n)
|
|
440
|
+
;if("text"===this.mode&&!o.allowedInText)throw new Xs("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===o.allowedInMath)throw new Xs("Can't use function '"+r+"' in math mode",n);var{args:i,optArgs:a}=this.parseArguments(r,o);return this.callFunction(r,i,a,n,e)}callFunction(e,t,n,r,o){var i={funcName:e,parser:this,token:r,breakOnTokenText:o},a=yh[e];if(a&&a.handler)return a.handler(i,t,n);throw new Xs("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};for(var r=[],o=[],i=0;i<n;i++){var a=t.argTypes&&t.argTypes[i],s=i<t.numOptionalArgs;(t.primitive&&null==a||"sqrt"===t.type&&1===i&&null==o[0])&&(a="primitive");var l=this.parseGroupOfType("argument to '"+e+"'",a,s);if(s)o.push(l);else{if(null==l)throw new Xs("Null argument, please report this as a bug");r.push(l)}}return{args:r,optArgs:o}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":
|
|
441
|
+
return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":var r=this.parseArgumentGroup(n,"text");return null!=r?{type:"styling",mode:r.mode,body:[r],style:"text"}:null;case"raw":var o=this.parseStringGroup("raw",n);return null!=o?{type:"raw",mode:"text",string:o.text}:null;case"primitive":if(n)throw new Xs("A primitive argument cannot be optional");var i=this.parseGroup(e);if(null==i)throw new Xs("Expected group as "+e,this.fetch());return i;case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new Xs("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;" "===this.fetch().text;)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(null==n)return null;for(var r,o="";"EOF"!==(r=this.fetch()).text;)o+=r.text,this.consume();return this.consume(),n.text=o,n}parseRegexGroup(e,t){for(var n,r=this.fetch(),o=r,i="";"EOF"!==(n=this.fetch()).text&&e.test(i+n.text);)i+=(o=n).text,this.consume()
|
|
442
|
+
;if(""===i)throw new Xs("Invalid "+t+": '"+r.text+"'",r);return r.range(o,i)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(null==t)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new Xs("Invalid color: '"+t.text+"'",t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!(t=e||"{"===this.gullet.future().text?this.parseStringGroup("size",e):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;e||0!==t.text.length||(t.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new Xs("Invalid size: '"+t.text+"'",t);var o={number:+(r[1]+r[2]),unit:r[3]};if(!Il(o))throw new Xs("Invalid unit: '"+o.unit+"'",t);return{type:"size",mode:this.mode,value:o,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12)
|
|
443
|
+
;var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(null==n)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:n.loc,body:o};return t&&this.switchMode(r),i}parseGroup(e,t){var n,r=this.fetch(),o=r.text;if("{"===o||"\\begingroup"===o){this.consume();var i="{"===o?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,i),s=this.fetch();this.expect(i),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:Ks.range(r,s),body:a,semisimple:"\\begingroup"===o||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===o[0]&&!Lh.hasOwnProperty(o)){
|
|
444
|
+
if(this.settings.throwOnError)throw new Xs("Undefined control sequence: "+o,r);n=this.formatUnsupportedCmd(o),this.consume()}return n}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n],o=r.text;"-"===o&&"-"===e[n+1].text&&(n+1<t&&"-"===e[n+2].text?(e.splice(n,3,{type:"textord",mode:"text",loc:Ks.range(r,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Ks.range(r,e[n+1]),text:"--"}),t-=1)),"'"!==o&&"`"!==o||e[n+1].text!==o||(e.splice(n,2,{type:"textord",mode:"text",loc:Ks.range(r,e[n+1]),text:o+o}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r="*"===n.charAt(0);if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new Xs("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}
|
|
445
|
+
Hh.hasOwnProperty(t[0])&&!Xl[this.mode][t[0]]&&(this.settings.strict&&"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=Hh[t[0]]+t.slice(1));var o,i=kh.exec(t);if(i&&("i"===(t=t.substring(0,i.index))?t="ı":"j"===t&&(t="ȷ")),Xl[this.mode][t]){this.settings.strict&&"math"===this.mode&&Cc.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a,s=Xl[this.mode][t].group,l=Ks.range(e);if(Kl.hasOwnProperty(s)){var c=s;a={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else a={type:s,mode:this.mode,loc:l,text:t};o=a}else{if(!(t.charCodeAt(0)>=128))return null
|
|
446
|
+
;this.settings.strict&&(gl(t.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'" ('+t.charCodeAt(0)+")",e)),o={type:"textord",mode:"text",loc:Ks.range(e),text:t}}if(this.consume(),i)for(var u=0;u<i[0].length;u++){var d=i[0][u];if(!jh[d])throw new Xs("Unknown accent ' "+d+"'",e);var h=jh[d][this.mode]||jh[d].text;if(!h)throw new Xs("Accent "+d+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Ks.range(e),label:h,isStretchy:!1,isShifty:!0,base:o}}return o}}Fh.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var $h=function(e,t){if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Fh(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],
|
|
447
|
+
delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new Xs("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new Ys("\\df@tag")])}]}return r},Bh=function(e,t,n){t.textContent="";var r=Gh(e,n).toNode();t.appendChild(r)};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Bh=function(){throw new Xs("KaTeX doesn't work in quirks mode.")});var qh,Uh=function(e,t,n){if(n.throwOnError||!(e instanceof Xs))throw e;var r=qc.makeSpan(["katex-error"],[new ql(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},Gh=function(e,t){var n=new ol(t);try{return function(e,t,n){var r,o=Cu(n);if("mathml"===n.output)return Eu(e,t,o,n.displayMode,!0);if("html"===n.output){var i=fu(e,o);r=qc.makeSpan(["katex"],[i])}else{
|
|
448
|
+
var a=Eu(e,t,o,n.displayMode,!1),s=fu(e,o);r=qc.makeSpan(["katex"],[a,s])}return Mu(r,n)}($h(e,n),e,n)}catch(t){return Uh(t,e,n)}},Vh={version:"0.16.27",render:Bh,renderToString:function(e,t){return Gh(e,t).toMarkup()},ParseError:Xs,SETTINGS_SCHEMA:nl,__parse:function(e,t){var n=new ol(t);return $h(e,n)},__renderToDomTree:Gh,__renderToHTMLTree:function(e,t){var n=new ol(t);try{return function(e,t,n){var r=fu(e,Cu(n)),o=qc.makeSpan(["katex"],[r]);return Mu(o,n)}($h(e,n),0,n)}catch(t){return Uh(t,e,n)}},__setFontMetrics:function(e,t){_l[e]=t},__defineSymbol:Zl,__defineFunction:Qc,__defineMacro:Od,__domTree:{Span:Hl,Anchor:Fl,SymbolNode:ql,SvgNode:Ul,PathNode:Gl,LineNode:Vl}},Wh={exports:{}},Kh=Wh.exports;var Yh,Xh=(qh||(qh=1,function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,
|
|
449
449
|
describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{
|
|
450
450
|
defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},
|
|
451
451
|
smartIndentationFix:{defaultValue:!1,describe:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,describe:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,describe:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,
|
|
@@ -517,156 +517,157 @@ var o=new Array(r+1).join("#"),i="";if(e.hasChildNodes()){i=o+" ";for(var a=e.ch
|
|
|
517
517
|
r||(o=n.subParser("makeMarkdown.header")(e,t,4)+"\n\n");break;case"h5":r||(o=n.subParser("makeMarkdown.header")(e,t,5)+"\n\n");break;case"h6":r||(o=n.subParser("makeMarkdown.header")(e,t,6)+"\n\n");break;case"p":r||(o=n.subParser("makeMarkdown.paragraph")(e,t)+"\n\n");break;case"blockquote":r||(o=n.subParser("makeMarkdown.blockquote")(e,t)+"\n\n");break;case"hr":r||(o=n.subParser("makeMarkdown.hr")(e,t)+"\n\n");break;case"ol":r||(o=n.subParser("makeMarkdown.list")(e,t,"ol")+"\n\n");break;case"ul":r||(o=n.subParser("makeMarkdown.list")(e,t,"ul")+"\n\n");break;case"precode":r||(o=n.subParser("makeMarkdown.codeBlock")(e,t)+"\n\n");break;case"pre":r||(o=n.subParser("makeMarkdown.pre")(e,t)+"\n\n");break;case"table":r||(o=n.subParser("makeMarkdown.table")(e,t)+"\n\n");break;case"code":o=n.subParser("makeMarkdown.codeSpan")(e,t);break;case"em":case"i":o=n.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":o=n.subParser("makeMarkdown.strong")(e,t);break;case"del":
|
|
518
518
|
o=n.subParser("makeMarkdown.strikethrough")(e,t);break;case"a":o=n.subParser("makeMarkdown.links")(e,t);break;case"img":o=n.subParser("makeMarkdown.image")(e,t);break;default:o=e.outerHTML+"\n\n"}return o})),n.subParser("makeMarkdown.paragraph",(function(e,t){var r="";if(e.hasChildNodes())for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t);return r=r.trim()})),n.subParser("makeMarkdown.pre",(function(e,t){var n=e.getAttribute("prenum");return"<pre>"+t.preList[n]+"</pre>"})),n.subParser("makeMarkdown.strikethrough",(function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t);r+="~~"}return r})),n.subParser("makeMarkdown.strong",(function(e,t){var r="";if(e.hasChildNodes()){r+="**";for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t);r+="**"}return r})),n.subParser("makeMarkdown.table",(function(e,t){
|
|
519
519
|
var r,o,i="",a=[[],[]],s=e.querySelectorAll("thead>tr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;r<s.length;++r){var c=n.subParser("makeMarkdown.tableCell")(s[r],t),u="---";if(s[r].hasAttribute("style"))switch(s[r].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":u=":---";break;case"text-align:right;":u="---:";break;case"text-align:center;":u=":---:"}a[0][r]=c.trim(),a[1][r]=u}for(r=0;r<l.length;++r){var d=a.push([])-1,h=l[r].getElementsByTagName("td");for(o=0;o<s.length;++o){var p=" ";void 0!==h[o]&&(p=n.subParser("makeMarkdown.tableCell")(h[o],t)),a[d].push(p)}}var m=3;for(r=0;r<a.length;++r)for(o=0;o<a[r].length;++o){var f=a[r][o].length;f>m&&(m=f)}for(r=0;r<a.length;++r){for(o=0;o<a[r].length;++o)1===r?":"===a[r][o].slice(-1)?a[r][o]=n.helper.padEnd(a[r][o].slice(-1),m-1,"-")+":":a[r][o]=n.helper.padEnd(a[r][o],m,"-"):a[r][o]=n.helper.padEnd(a[r][o],m);i+="| "+a[r].join(" | ")+" |\n"}return i.trim()})),n.subParser("makeMarkdown.tableCell",(function(e,t){var r=""
|
|
520
|
-
;if(!e.hasChildNodes())return"";for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t,!0);return r.trim()})),n.subParser("makeMarkdown.txt",(function(e){var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),t=(t=(t=(t=(t=(t=(t=(t=(t=n.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")})),e.exports?e.exports=n:this.showdown=n}).call(
|
|
521
|
-
;if(-1!==o&&(-1===i||o<i)?(a=o,s=r.indexOf("$$",a+2)):(a=i,s=r.indexOf("\\)",a+2)),-1===s)break;s+=2;var l=t.length+1,c=
|
|
522
|
-
0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||
|
|
523
|
-
e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";var n=document.createElement("div");return n.style.paddingBottom="".concat(1/t*100,"%"),n.style.position="relative",n.appendChild(e),n}(n,t)}function
|
|
524
|
-
f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(r);try{for(i.s();!(t=i.n()).done;){var a=
|
|
525
|
-
},
|
|
526
|
-
var n=function(e){var t,n;for(n=0;n<
|
|
527
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function
|
|
528
|
-
for(var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).className,n=0,r=Array.from(e.getElementsByTagName("a"));n<r.length;n++){var o=
|
|
529
|
-
"data-testid":"markdown-text",ref:m,dangerouslySetInnerHTML:{__html:p},style:r,onMouseEnterCapture:s?function(e){var t=e.target,n=v.current.get(t);n&&(x(n),f.current=t)}:void 0,onMouseLeaveCapture:function(e){var t=e.target;f.current!==t||y||(x(null),f.current=null)}})}),s&&Ve(Nn,{open:!!y,onClose:function(){return x(null)},anchorElementRef:f,classes:"!max-w-[75%]",elementRef:g,children:Ve(
|
|
530
|
-
;return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?
|
|
531
|
-
children:[Ve("filter"===r?Nt:l,{}),null!=s?s:"All"]}),disabled:a,children:["filter"===r&&Ve(Pn.Option,{value:void 0,classes:"text-grey-7",children:"All"}),Object.entries(
|
|
532
|
-
;return"PENDING"===e?s="Not visible to other users yet. Waiting for a moderator to review it.":"DENIED"===e&&(s="Not visible to other users. Edit this annotation to resubmit it for moderator approval."),Ve("div",{className:"relative","data-testid":"moderation-status-badge",children:[Ve(dn,{variant:"custom",elementRef:o,classes:Je("px-1.5 py-1 rounded flex items-center gap-1.5",{"bg-grey-2 text-black":"PENDING"===e,"bg-red-light text-red-dark":"DENIED"===e},t),onClick:()=>r(!0),children:[Ve(i,{className:Je("PENDING"===e&&"text-grey-7")}),a]}),Ve(Nn,{open:n,onClose:()=>r(!1),anchorElementRef:o,placement:"above",classes:"!bg-grey-9 !border-grey-9 text-white px-2.5 py-2",children:s})]})}var
|
|
533
|
-
;let i=n?"notice":"error",a=n?"The annotation has been updated since this page was loaded. Review this new version and try again.":"An error occurred updating the moderation status";n&&await r.loadAnnotation(e.id).catch((()=>{i="error",a="The annotation has been updated since this page was loaded"})),"notice"===i?o.notice(a,{autoDismiss:!1}):o.error(a)}),[e,r,o]),u=de((async t=>{l(!0);try{await r.moderate(e,t)}catch(e){await c(e)}finally{l(!1)}}),[e,r,c]),d=!!
|
|
534
|
-
var
|
|
535
|
-
onClick:async()=>{const n=
|
|
536
|
-
variant:"text-light",href:e,lang:"",target:"_blank","aria-label":`Tag: ${n}`,title:`View annotations with tag: ${n}`,underline:"none",children:n}):Ve("span",{className:"text-color-text-light cursor-default","aria-label":`Tag: ${n}`,lang:"",children:n})}),t&&Ve("button",{className:Je("px-1.5 py-1 touch:p-2","border-l rounded rounded-l-none","text-grey-6 hover:text-color-text hover:bg-grey-2","transition-colors duration-200","focus-visible-ring ring-inset"),onClick:()=>{t(n)},title:`Remove tag: ${n}`,children:Ve(dt,{className:"font-base w-em h-em",title:`Remove ${n}`})})]})}function
|
|
537
|
-
const[n,r]=ie(!0),[o,i]=ie(!1),a=
|
|
538
|
-
;const
|
|
539
|
-
text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function
|
|
540
|
-
a=
|
|
541
|
-
children:[a&&Ve("span",{className:"truncate","data-testid":`username-${e.username}`,children:e.username}),Ve("span",{className:Je({"text-color-text-light":a}),children:e.displayName})]},e.username)}function
|
|
542
|
-
;function
|
|
543
|
-
|
|
544
|
-
const t=p.current,{value:n}=t,{start:r,end:i}
|
|
545
|
-
f((e=>Math.max(e-1,0)))):"Enter"===e.key&&(e.preventDefault(),y(v[m])))},ref:p,...w}),Ve("div",{ref:g,className:"absolute top-0 left-0 w-0 h-0 pointer-events-none"}),n&&Ve(
|
|
546
|
-
}),Ve(
|
|
547
|
-
})}),Ve(
|
|
548
|
-
;return 0===t.length||"\n"===t.slice(-1)||"$$"===t.slice(-2)?
|
|
549
|
-
if(e.ctrlKey||e.metaKey)for(const[t,n]of Object.entries(
|
|
550
|
-
"data-testid":"autocomplete-list-container",children:Ve(it,{width:"auto",classes:"overflow-hidden",children:[Ve("ul",{tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s}),Ve(
|
|
551
|
-
;return n.sort()})(e,r)),d(e.length>0)}else d(!1);c(-1)})()},onKeyDown:e=>{switch(e.key){case"ArrowUp":b(-1),e.preventDefault();break;case"ArrowDown":b(1),e.preventDefault();break;case"Escape":g(),e.preventDefault();break;case"Enter":case",":v(-1===l?m():a[l]),e.preventDefault();break;case"Tab":if(!f())break;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&d(!0)},elementRef:i,placeholder:"Add new tags",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":y,"aria-controls":`${h}-AutocompleteList`,"aria-expanded":u,"aria-label":"Add tags",dir:"auto",role:"combobox",classes:Je("text-base touch:text-touch-base")}),Ve(
|
|
552
|
-
itemPrefixId:`${h}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);let
|
|
553
|
-
const n=Array.from(o.current.querySelectorAll('[role^="menuitem"]')).filter(
|
|
554
|
-
position:n?"relative":"static"},y="max-w-full min-w-0";return Ve("div",{className:Je("relative",y),"data-testid":"menu-container",ref:g,style:b,onClick:v,onMouseDown:v,children:[Ve("button",{"aria-expanded":d?"true":"false","aria-haspopup":!0,className:Je("focus-visible-ring rounded transition-colors","flex items-center justify-center gap-x-1",y,{"text-grey-7 hover:text-grey-9":!d,"text-brand":d}),"data-testid":"menu-toggle-button",disabled:i,onMouseDown:m,onClick:m,"aria-label":u,title:u,children:[a,c&&Ve("span",{className:Je({"rotate-180 text-color-text":d}),children:Ve(Yt,{className:"w-2.5 h-2.5"})})]}),d&&Ve("div",{className:Je("focus-visible-ring","absolute top-[calc(100%+3px)] z-1","border shadow-intense rounded-lg overflow-hidden bg-white text-md",{"left-0":"left"===e,"right-0":"right"===e},r),"data-testid":"menu-content",role:"menu",tabIndex:-1,onClick:f,onKeyDown:e=>{const t=e.key;"Enter"!==t&&" "!==t||setTimeout((()=>{f()}))},children:Ve(
|
|
555
|
-
function
|
|
556
|
-
"data-testid":"left-item-container",children:l??w}),Ve("span",{className:"flex items-center grow whitespace-nowrap px-1",children:s}),k&&Ve("div",{className:"w-8 flex items-center justify-center","data-testid":"right-item-container",children:x}),g&&Ve(
|
|
557
|
-
className:A,"data-testid":"menu-item",tabIndex:-1,onKeyDown:b,onClick:c,role:v?"menuitemradio":"menuitem","aria-checked":v?o:void 0,"aria-haspopup":g,"aria-expanded":g?a:void 0,children:S}),Ve(y,{children:[f,g&&Ve(Wn,{direction:a?"in":"out",children:Ve(
|
|
558
|
-
className:"flex relative max-w-full min-w-0",children:[Ve(dn,{classes:Je("rounded-r-none","truncate !block"),"data-testid":"publish-control-button",style:s,onClick:o,disabled:t,size:"lg",variant:"primary",title:d?c:void 0,elementRef:u,children:c}),Ve("div",{className:Je("flex flex-row rounded-r bg-grey-7 hover:bg-grey-8"),style:s,children:Ve(
|
|
559
|
-
"aria-label":"Thumbnail description",value:e,onInput:e=>t(e.target.value),maxlength:5e3,classes:"flex-1"}),Ve(mn,{icon:Ft,title:"About thumbnail descriptions",onClick:()=>r(!n),expanded:n,elementRef:o,classes:"text-[16px]"})]}),Ve(Nn,{open:n,align:"right",anchorElementRef:o,onClose:()=>r(!1),classes:Je("mt-1","w-80 max-w-[100vw]","p-2 text-sm"),children:Ve("div",{className:"flex flex-col gap-y-2",children:["Description of the thumbnail image used for accessibility, search and export to text formats.",Ve($n,{href:"https://web.hypothes.is/help/how-to-write-alt-text/",underline:"always",target:"_blank",children:"Learn how to write alt text"})]})})]})}var
|
|
560
|
-
;!function(e,t=window){const n=
|
|
561
|
-
const{displayName:t}=e;t&&"display-name"===T&&E.current.set(t,e)}),[T]),M=async()=>{s&&w(s);const n=`${
|
|
562
|
-
;return n.localeCompare(o,void 0,{sensitivity:"base"})||e.username.localeCompare(t.username)}));return{status:"loaded",users:a}}({usersWhoAnnotated:z,usersWhoWereMentioned:L,focusedGroupMembers:P,mentionMode:T})),[P,T,z,L]);return se((()=>{O&&"not-loaded"===P.status&&r.loadFocusedGroupMembers()}),[P,r,O]),Ve("div",{"data-testid":"annotation-editor",className:"space-y-4",onKeyDown:e=>{const t=e.key;b||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),M())},children:[h&&Ve(
|
|
563
|
-
;var
|
|
564
|
-
title:"Expand replies",underline:"hover",children:`${n} ${n>1?"replies":"reply"}`}),!t&&e.created&&Ve("div",{className:"flex justify-end grow",children:Ve(
|
|
565
|
-
overflowThreshold:20,children:Ve(
|
|
566
|
-
className:"border rounded-md",style:{width:`${d}px`,height:`${h}px`}}),!i&&!s&&Ve("span",{"data-testid":"placeholder",children:"Loading thumbnail..."}),!i&&s&&Ve("span",{"data-testid":"error",children:["Unable to render thumbnail: ",s]})]}),i&&u&&o&&Ve(
|
|
567
|
-
const s=
|
|
568
|
-
threadIsCollapsed:o})]}),p&&Ve(
|
|
569
|
-
children:["Flagged for review by ",t," ",1===t?"user":"users"]}),e.hidden&&Ve("span",{children:"Hidden from users"})]})]}):null}function
|
|
570
|
-
children:[Ve(
|
|
571
|
-
className:Je("mt-2","[text-align:start]"),children:Ve(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var
|
|
572
|
-
classes:Je("cursor-pointer focus-visible-ring theme-clean:border-none",{"border-brand":a,"border-red":!a&&c}),"data-testid":"thread-card",elementRef:h,tabIndex:0,"aria-description":"Press Enter to scroll annotation into view",onClick:e=>{var n;(n=e.target).closest("button")||n.closest("a")||!t.annotation||s(t.annotation)},onMouseEnter:()=>i(t.annotation??null),onMouseLeave:()=>i(null),onKeyDown:e=>{e.target===h.current&&["Enter"," "].includes(e.key)&&t.annotation&&s(t.annotation)},children:Ve(st,{children:u})},t.id)}),["frameSync"]);const
|
|
573
|
-
o(
|
|
574
|
-
}),[e]),f=
|
|
575
|
-
;o!==e.get(n)&&t.set(n,o)}return 0===t.size?e:new Map([...e,...t])}))}),[h]),Ve("div",{role:"list",children:[Ve("div",{style:{height:d}}),h.map(((t,n)=>Ve("div",{role:"listitem","aria-setsize":e.length,"aria-posinset":p+n+1,className:Je("mb-3"),"data-testid":"thread-card-container",id:t.id,children:[m.get(t)&&Ve("h3",{className:"text-md text-grey-7 font-bold pt-3 pb-2",children:m.get(t)}),Ve(
|
|
576
|
-
const n=e.children.map((e=>
|
|
577
|
-
;let o=e.visible;return t.filterFn&&(o=!(!r||!t.forcedVisible.includes(e.id))||!!e.annotation&&!!t.filterFn(e.annotation)),{...e,visible:o}})),o.children=o.children.filter((e=>e.visible||
|
|
578
|
-
}(n(e),n(t))}function
|
|
579
|
-
}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}function
|
|
580
|
-
;return e.filter((e=>o.matches(e)))}const
|
|
581
|
-
const n=e??Number.MIN_SAFE_INTEGER,r=t??Number.MIN_SAFE_INTEGER;return Math.sign(n-r)}function
|
|
582
|
-
sortCompareFn:(e,n)=>
|
|
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=>
|
|
584
|
-
var
|
|
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
|
|
520
|
+
;if(!e.hasChildNodes())return"";for(var o=e.childNodes,i=o.length,a=0;a<i;++a)r+=n.subParser("makeMarkdown.node")(o[a],t,!0);return r.trim()})),n.subParser("makeMarkdown.txt",(function(e){var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),t=(t=(t=(t=(t=(t=(t=(t=(t=n.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")})),e.exports?e.exports=n:this.showdown=n}).call(Kh)}(Wh)),Wh.exports),Zh=Ke(Xh),Qh=Gs(window);function Jh(){return[{type:"output",filter:function(e){return e.replace(/<a href=/g,'<a target="_blank" href=')}}]}function ep(e){return"{math:"+e.toString()+"}"}function tp(e){var t=function(e){for(var t=[],n=0,r=e;;){var o=r.indexOf("$$",n),i=r.indexOf("\\(",n);if(-1===o&&-1===i)break;var a=void 0,s=void 0
|
|
521
|
+
;if(-1!==o&&(-1===i||o<i)?(a=o,s=r.indexOf("$$",a+2)):(a=i,s=r.indexOf("\\)",a+2)),-1===s)break;s+=2;var l=t.length+1,c=ep(l);t.push({id:l,expression:r.slice(a+2,s-2),inline:-1!==i});var u=void 0;u=-1!==i?c:"\n\n"+c+"\n\n",r=r.slice(0,a)+u+r.slice(s),n=a+u.length}return{mathBlocks:t,content:r}}(e),n=Qh.sanitize(function(e){return Yh||(Yh=new Zh.Converter({extensions:[Jh],simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0})),Yh.makeHtml(e)}(t.content)),r=function(e,t){return t.reduce((function(e,t){var n;try{n=t.inline?Vh.renderToString(t.expression):Vh.renderToString(t.expression,{displayMode:!0})}catch(e){n=Ws(t.expression)}return e.replace(ep(t.id),n)}),e)}(n,t.mathBlocks);return r}function np(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,
|
|
522
|
+
0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||rp(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rp(e,t){if(e){if("string"==typeof e)return op(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?op(e,t):void 0}}function op(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ip(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16/9,n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",
|
|
523
|
+
e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";var n=document.createElement("div");return n.style.paddingBottom="".concat(1/t*100,"%"),n.style.position="relative",n.appendChild(e),n}(n,t)}function ap(e){for(var t,n=/(\d+)([hms]?)/g,r={h:3600,m:60,s:1},o=0;null!==(t=n.exec(e));)if(t[2]){var i=t[2];o+=Number(t[1])*r[i]}else o+=+t[1];return o.toString()}function sp(e){var t,n=["end","start","t"],r=new URLSearchParams(e.search),o=new URLSearchParams,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=rp(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},
|
|
524
|
+
f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(r);try{for(i.s();!(t=i.n()).done;){var a=np(t.value,2),s=a[0],l=a[1];n.includes(s)&&("t"===s?o.append("start",ap(l)):o.append(s,l))}}catch(e){i.e(e)}finally{i.f()}o.sort();var c=o.toString();return c&&(c="?".concat(c)),c}function lp(e,t){var n=sp(t);return ip("https://www.youtube.com/embed/".concat(e).concat(n))}function cp(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).aspectRatio;return function(o){if(o.hostname!==e)return null;var i=t.exec(o.pathname);if(!i)return null;var a=i[1];return ip(n(a),r)}}Qh.addHook("afterSanitizeAttributes",(function(e){"target"in e&&e.setAttribute("target","_blank")}));var up=[function(e){if("www.youtube.com"!==e.hostname)return null;if(!/\/watch\/?/.test(e.pathname))return null;var t=/[&?]v=([^&#]+)/.exec(e.search);return t?lp(t[1],e):null},function(e){if("youtu.be"!==e.hostname)return null;var t=/^\/([^/]+)\/?$/.exec(e.pathname);return t?lp(t[1],e):null
|
|
525
|
+
},cp("vimeo.com",/^\/([^/?#]+)\/?$/,(function(e){return"https://player.vimeo.com/video/".concat(e)})),cp("vimeo.com",/^\/channels\/[^/]+\/([^/?#]+)\/?$/,(function(e){return"https://player.vimeo.com/video/".concat(e)})),function(e){if("archive.org"!==e.hostname)return null;var t=/^\/(embed|details)\/(.+)/.exec(e.pathname);if(!t)return null;var n=t[2],r=new URLSearchParams(e.search),o=r.get("start"),i=r.get("end");if(!o){var a=n.match(/\/start\/([^/]+)/);a&&(o=a[1],n=n.replace(a[0],""))}if(!i){var s=n.match(/\/end\/([^/]+)/);s&&(i=s[1],n=n.replace(s[0],""))}var l=new URL("https://archive.org/embed/".concat(n));return o&&l.searchParams.append("start",o),i&&l.searchParams.append("end",i),ip(l.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?(t=e.href,(n=document.createElement("audio")).controls=!0,n.src=t,n):null;var t,n}];function dp(e){if(e.href!==e.textContent)try{var t=encodeURI(e.textContent);if(e.href!==t)return null}catch(e){return null}
|
|
526
|
+
var n=function(e){var t,n;for(n=0;n<up.length;n++)if(t=up[n](e))return t;return null}(e);return n&&e.parentElement.replaceChild(n,e),n}function hp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pp(e,t):void 0}}(e,t)||function(){
|
|
527
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mp(e){var t=Math.floor(e.x),n=Math.floor(e.y),r=Math.ceil(e.right),o=Math.ceil(e.bottom);return new DOMRect(t,n,r-t,o-n)}function fp(e){var t=e.markdown,n=e.classes,r=e.style,o=e.mentions,i=void 0===o?[]:o,a=e.mentionsEnabled,s=void 0!==a&&a,l=e.mentionMode,c=e.setTimeout_,u=void 0===c?setTimeout:c,d=e.clearTimeout_,h=void 0===d?clearTimeout:d,p=ue((function(){return t?tp(t):""}),[t]),m=ce(null),f=ce(null),g=ce(null),v=ce(new Map),b=hp(ie(null),2),y=b[0],_=b[1],w=ce(),x=de((function(e){w.current&&h(w.current);var t=function(){_(e),w.current=null};null===e?t():w.current=u(t,400)}),[h,u]);return se((function(){return function(){w.current&&h(w.current)}}),[h]),se((function(){!function(e){
|
|
528
|
+
for(var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).className,n=0,r=Array.from(e.getElementsByTagName("a"));n<r.length;n++){var o=dp(r[n]);o&&(t?o.className=t:o.style.width="350px")}}(m.current,{className:"w-full md:w-[380px]"})}),[t]),se((function(){v.current=Da(m.current,i,l)}),[l,i]),le((function(){var e=f.current,t=g.current;if(!e||!t||!y)return function(){};var n=function(n){var r=function(e,t){var n=Math.min(e.x,t.x),r=Math.min(e.y,t.y),o=Math.max(e.right,t.right),i=Math.max(e.bottom,t.bottom);return DOMRect.fromRect({x:n,y:r,width:o-n,height:i-r})}(mp(e.getBoundingClientRect()),mp(t.getBoundingClientRect()));(function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom})(r,n.clientX,n.clientY)||(x(null),f.current=null)};return document.body.addEventListener("mousemove",n),function(){document.body.removeEventListener("mousemove",n)}}),[y,x]),Ve("div",{className:Je("w-full wrap-anywhere cursor-text",{relative:s}),children:[Ve(za,{children:Ve("div",{className:n,
|
|
529
|
+
"data-testid":"markdown-text",ref:m,dangerouslySetInnerHTML:{__html:p},style:r,onMouseEnterCapture:s?function(e){var t=e.target,n=v.current.get(t);n&&(x(n),f.current=t)}:void 0,onMouseLeaveCapture:function(e){var t=e.target;f.current!==t||y||(x(null),f.current=null)}})}),s&&Ve(Nn,{open:!!y,onClose:function(){return x(null)},anchorElementRef:f,classes:"!max-w-[75%]",elementRef:g,children:Ve(Ea,{content:null!=y?y:"",mentionMode:l})})]})}function gp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vp(e,t);var n={}.toString.call(e).slice(8,-1)
|
|
530
|
+
;return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vp(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bp(e){var t=e.selected,n=e.onChange,r=e.mode,o=e.alignListbox,i=void 0===o?"right":o,a=e.disabled,s=t?ja[t].label:void 0,l=t?ja[t].icon:y;return Ve(Pn,{value:t,onChange:n,alignListbox:i,containerClasses:"!w-auto",buttonClasses:Je("select"===r&&{"!bg-green-light !text-green-dark":"APPROVED"===t,"!bg-yellow-light !text-yellow-dark":"SPAM"===t,"!bg-red-light !text-red-dark":"DENIED"===t,"disabled:opacity-50":"PENDING"!==t}),"aria-label":"Moderation status",buttonContent:Ve("div",{className:"flex gap-x-1.5 items-center",
|
|
531
|
+
children:[Ve("filter"===r?Nt:l,{}),null!=s?s:"All"]}),disabled:a,children:["filter"===r&&Ve(Pn.Option,{value:void 0,classes:"text-grey-7",children:"All"}),Object.entries(ja).map((function(e){var t=gp(e,2),n=t[0],r=t[1],o=r.label,i=r.icon;return Ve(Pn.Option,{value:n,children:Ve("div",{className:"flex gap-x-1.5 items-center text-grey-7",children:[Ve(i,{}),o]})},n)}))]})}class yp 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 _p(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new yp(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch{throw new yp(e,n,"Failed to parse response")}if(!n.ok)throw new yp(e,n,r?.reason);return r}function wp({status:e,classes:t}){const[n,r]=ie(!1),o=ce(null);if(!["PENDING","DENIED"].includes(e))return null;const{icon:i,label:a}=ja[e];let s=""
|
|
532
|
+
;return"PENDING"===e?s="Not visible to other users yet. Waiting for a moderator to review it.":"DENIED"===e&&(s="Not visible to other users. Edit this annotation to resubmit it for moderator approval."),Ve("div",{className:"relative","data-testid":"moderation-status-badge",children:[Ve(dn,{variant:"custom",elementRef:o,classes:Je("px-1.5 py-1 rounded flex items-center gap-1.5",{"bg-grey-2 text-black":"PENDING"===e,"bg-red-light text-red-dark":"DENIED"===e},t),onClick:()=>r(!0),children:[Ve(i,{className:Je("PENDING"===e&&"text-grey-7")}),a]}),Ve(Nn,{open:n,onClose:()=>r(!1),anchorElementRef:o,placement:"above",classes:"!bg-grey-9 !border-grey-9 text-white px-2.5 py-2",children:s})]})}var xp=er((function({annotation:e,groupIsPreModerated:t,badgeClasses:n,annotationsService:r,toastMessenger:o}){const i=e.actions?.includes("moderate"),a=e?.moderation_status??"APPROVED",[s,l]=ie(!1),c=de((async t=>{const n=t instanceof yp&&409===t.response?.status
|
|
533
|
+
;let i=n?"notice":"error",a=n?"The annotation has been updated since this page was loaded. Review this new version and try again.":"An error occurred updating the moderation status";n&&await r.loadAnnotation(e.id).catch((()=>{i="error",a="The annotation has been updated since this page was loaded"})),"notice"===i?o.notice(a,{autoDismiss:!1}):o.error(a)}),[e,r,o]),u=de((async t=>{l(!0);try{await r.moderate(e,t)}catch(e){await c(e)}finally{l(!1)}}),[e,r,c]),d=!!Kr(e);return t||"APPROVED"!==a||d?i?Ve(bp,{mode:"select",alignListbox:"left",selected:a,onChange:u,disabled:s}):Ve(wp,{status:a,classes:n}):null}),["annotationsService","toastMessenger"]);function kp(e){return{read:[e],update:[e],delete:[e]}}function Sp(e,t){return Object.assign(kp(e),{read:["group:"+t]})}function Ap(e,t,n){return"private"===function(e){switch(e){case"private":case"shared":return e;default:return"shared"}}(n)&&e?kp(e):Sp(e,t)}function Tp(e){return e.read.some((e=>e.startsWith("group:")))}function Ep(e){return!Tp(e)}
|
|
534
|
+
var Cp=er((function({annotation:e,settings:t,toastMessenger:n}){return Ve(pa,{annotation:e,group:Fi().getGroup(e.group)??null,onCopy:de((async e=>{e.ok?n.success("Copied share link to clipboard"):n.error("Unable to copy link")}),[n]),"data-testid":"base-share-control",commentsMode:t.commentsMode})}),["settings","toastMessenger"]);var Mp=er((function({annotation:e,annotationsService:t,onReply:n,settings:r,toastMessenger:o}){const i=Fi(),a=i.profile(),s=i.isLoggedIn(),l=t=>function(e,t,n){return-1!==e[t].indexOf(n||"")}(e.permissions,t,a.userid),c=l("delete"),u=l("update"),d=function(e){const t=Kn(e);return!1!==t?.allowFlagging}(r)&&!!a.userid&&a.userid!==e.user,h=function(e){const t=Kn(e);return!1!==t?.enableShareLinks}(r);return Ve("div",{className:"flex text-[16px]","data-testid":"annotation-action-bar",children:[u&&Ve(mn,{icon:xt,title:"Edit",onClick:()=>{i.createDraft(e,{tags:e.tags,text:e.text,isPrivate:Ep(e.permissions),description:e.target[0]?.description})}}),c&&Ve(mn,{icon:un,title:"Delete",
|
|
535
|
+
onClick:async()=>{const n=Gr(e,r);if(await wn({title:`Delete ${n.toLowerCase()}?`,message:`Are you sure you want to delete this ${n.toLowerCase()}?`,confirmAction:"Delete"}))try{await t.delete(e),o.success(`${n} deleted`,{visuallyHidden:!0})}catch(e){o.error(e.message)}}}),Ve(mn,{icon:rn,title:"Reply",onClick:()=>{s?n():i.openSidebarPanel("loginPrompt")}}),h&&Ve(Cp,{annotation:e}),d&&!e.flagged&&Ve(mn,{icon:It,title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&Ve(mn,{pressed:!0,icon:Ot,title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function Np({children:e}){return Ve("ul",{className:"flex flex-wrap gap-2 leading-none","aria-label":"Annotation tags",children:e})}function Ip({href:e,onRemoveTag:t,tag:n}){return Ve("li",{className:"flex items-center border rounded bg-grey-0",children:[Ve("div",{className:"grow px-1.5 py-1 touch:p-2",children:e?Ve($n,{
|
|
536
|
+
variant:"text-light",href:e,lang:"",target:"_blank","aria-label":`Tag: ${n}`,title:`View annotations with tag: ${n}`,underline:"none",children:n}):Ve("span",{className:"text-color-text-light cursor-default","aria-label":`Tag: ${n}`,lang:"",children:n})}),t&&Ve("button",{className:Je("px-1.5 py-1 touch:p-2","border-l rounded rounded-l-none","text-grey-6 hover:text-color-text hover:bg-grey-2","transition-colors duration-200","focus-visible-ring ring-inset"),onClick:()=>{t(n)},title:`Remove tag: ${n}`,children:Ve(dt,{className:"font-base w-em h-em",title:`Remove ${n}`})})]})}function Op({classes:e,setCollapsed:t,collapsed:n}){const r=n?"More":"Less";return Ve(dn,{classes:Je("text-grey-7 font-normal",e),expanded:!n,onClick:()=>t(!n),title:`Toggle visibility of full annotation text: Show ${r}`,children:Ve("div",{className:"flex items-center gap-x-2",children:[Ve(n?Et:yt,{className:"w-3 h-3"}),Ve("div",{children:r})]})})}var zp=er((function({annotation:e,settings:t}){
|
|
537
|
+
const[n,r]=ie(!0),[o,i]=ie(!1),a=Fi(),s=a.defaultAuthority(),l=a.getDraft(e),c=a.isFeatureEnabled("at_mentions"),u=l?.tags??e.tags,d=l?.text??e.text,h=d.length>0,p=u.length>0,m=Qn(["annotationFontFamily"],t),f=ue((()=>Pr(e.user,s)),[e,s]),g=f?"display-name":"username",v=e=>a.getLink("search.tag",{tag:e});return Ve("div",{className:"space-y-4",children:[h&&Ve(Ta,{inlineControl:!1,collapsed:n,collapsedHeight:400,onCollapsibleChanged:i,onToggleCollapsed:r,overflowThreshold:20,children:Ve(fp,{markdown:d,style:m,mentions:e.mentions,mentionsEnabled:c,mentionMode:g})}),(o||p)&&Ve("div",{className:"flex flex-row gap-x-2",children:[Ve("div",{className:"grow",children:p&&Ve(Np,{children:u.map((e=>Ve(Ip,{tag:e,href:f?void 0:v(e)},e)))})}),o&&Ve("div",{children:Ve(Op,{classes:Je("-mt-3"),collapsed:n,setCollapsed:r})})]})]})}),["settings"])
|
|
538
|
+
;const Lp=(e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0,Pp=String.raw`[\s,.;:|?!'"\-()[\]{}]`,Rp=new RegExp(`(^|${Pp})@([A-Za-z0-9_][A-Za-z0-9._]+[A-Za-z0-9_])(?=${Pp}|$)`,"g"),Dp=String.raw`[^\]^[]*`,jp=new RegExp(`@\\[(${Dp})]`,"g");function Hp(e,t){const n=document.createElement("a");return n.setAttribute("data-hyp-mention",""),n.setAttribute("data-userid",e),n.textContent=t,n.outerHTML}const Fp=/<a[^>]\bdata-hyp-mention\b[^>]*>@([^<]+)<\/a>/g;function $p(e,t){const n=[...e.slice(0,t).matchAll(new RegExp(Pp,"g"))],r=n.length>0?Math.max(...n.map((e=>e.index))):-1,o=e.slice(t).search(new RegExp(Pp));return{start:r+1,end:-1===o?e.length:t+o}}function Bp(e){return`@[${e.replace(/[[\]]/g,"")}]`}let qp,Up=function(e){return e.ANCHOR_LINK="ANCHOR_LINK",e.IMAGE_LINK="IMAGE_LINK",e}({});function Gp(e,t,n,r){let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,i+=r.length-n):i<=t||(o<=t&&i>=t+n?i+=r.length-n:o<t&&i<t+n?o=t:o<t+n&&i>t+n?i+=r.length-n:t<o&&t+n>i&&(o=t,i=t+n)),{
|
|
539
|
+
text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Vp(e,t=Up.ANCHOR_LINK){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===Up.IMAGE_LINK&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Gp(e,e.selectionStart,n.length,o+"["+t+"]("+n+")"),r.selectionStart=e.selectionStart+o.length+1,r.selectionEnd=r.selectionStart+t.length,r}{const t=o+"["+n+"](",i="http://example.com/insert-your-link-here";return r=Gp(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Wp(e,t,n,r){void 0===n&&(n=t);const o=e.text.slice(e.selectionStart-t.length,e.selectionStart),i=e.text.slice(e.selectionEnd,e.selectionEnd+t.length);let a=e;return e.selectionStart===e.selectionEnd&&r&&(a=Gp(e,e.selectionStart,0,r),a.selectionStart=a.selectionEnd-r.length),o===t&&i===n?(a=Gp(a,a.selectionStart-t.length,t.length,""),a=Gp(a,a.selectionEnd,n.length,"")):(a=Gp(a,a.selectionStart,0,t),
|
|
540
|
+
a=Gp(a,a.selectionEnd,0,n)),a}function Kp(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Yp(e,t,n,r){let o=function(e,t){const n=e.lastIndexOf("\n",t);return n<0?0:n+1}(e.text,t),i=Kp(e.text,t),a=0;for(;i<=Kp(e.text,n);){const t=i===e.text.length,s=i-o,l=Kp((e=r(e,o,i,a)).text,o)-o;if(n+=l-s,t)break;o=o+l+1,i=Kp(e.text,o),a+=1}return e}function Xp(e,t){const n=e.selectionStart,r=e.selectionEnd,o=e=>"function"==typeof t?t(e):t;let i=!0;return Yp(e,n,r,((e,t,n,r)=>{const a=o(r);return e.text.slice(t,t+a.length)!==a&&(i=!1),e})),Yp(e,n,r,i?(e,t,n,r)=>Gp(e,t,o(r).length,""):(e,t,n,r)=>{const i=o(r);return e.text.slice(t,t+i.length)===i?e:Gp(e,t,0,i)})}const Zp=!1;function Qp({user:e,usersListboxId:t,highlighted:n,mentionMode:r,onSelect:o,onHighlight:i}){const a="username"===r;return Ve("li",{id:`${t}-${e.username}`,className:Je("flex justify-between items-center gap-x-2 rounded p-2","leading-tight",{"bg-grey-2":n}),onClick:e=>{e.stopPropagation(),o()},onMouseMove:i,role:"option","aria-selected":n,
|
|
541
|
+
children:[a&&Ve("span",{className:"truncate","data-testid":`username-${e.username}`,children:e.username}),Ve("span",{className:Je({"text-color-text-light":a}),children:e.displayName})]},e.username)}function Jp({loadingUsers:e,users:t,onSelectUser:n,highlightedSuggestion:r,onHighlightSuggestion:o,usersListboxId:i,mentionMode:a,...s}){return Ve(Nn,{...s,classes:Je("p-1",["!max-h-96"]),children:Ve("ul",{className:"flex-col gap-y-0.5",role:"listbox","aria-orientation":"vertical",id:i,children:e?Ve("li",{className:"italic p-2","data-testid":"suggestions-loading-indicator",children:"Loading suggestions…"}):Ve(y,{children:[t.map(((e,t)=>Ve(Qp,{user:e,highlighted:r===t,mentionMode:a,usersListboxId:i,onSelect:()=>n(e),onHighlight:()=>o(t)},e.username))),0===t.length&&Ve("li",{className:"italic p-2","data-testid":"suggestions-fallback",children:"No matches. You can still write the username"})]})})})}const em={bold:"b",image:"g",italic:"i",link:"l",list:"u",math:"m",numlist:"o",quote:"q"}
|
|
542
|
+
;function tm({disabled:e=!1,icon:t,label:n,onClick:r,shortcutKey:o,title:i="",classes:a}){const s=ue((()=>Lp()?"Cmd":"Ctrl"),[]);let l=i;o&&(l+=` (${s}-${o.toUpperCase()})`);const c={disabled:e,onClick:r,title:l};return n?Ve(dn,{classes:Je("p-1.5 text-grey-7 hover:text-grey-9",a),...c,size:"custom",variant:"custom",children:n}):Ve(mn,{classes:Je("px-2 py-2.5",a),...c,children:t&&Ve(t,{className:"w-[10px] h-[10px] touch:w-[13px] touch:h-[13px]"})})}function nm({classes:e,containerRef:t,mentionsEnabled:n,usersForMentions:r,onEditText:o,onKeyDown:i,mentionMode:a,onInsertMentionSuggestion:s,...l}){const[c,u]=ie(!1),[d,h]=ie(),p=Ie(t),[m,f]=ie(0),g=ce(null),v=ue((()=>n?function(e,t,{mentionMode:n,maxUsers:r=10}){return void 0===e||"loading"===t.status?[]:t.users.filter((t=>{if(!e)return!0;const r=t.displayName??"";return("username"===n?`${t.username} ${r}`:r).toLowerCase().includes(e.toLowerCase())})).slice(0,r)}(d,r,{mentionMode:a}):[]),[d,a,n,r]),b=de((e=>{if(!n)return;const{x:t,y:r}=function(e){
|
|
543
|
+
qp||(qp=document.createElement("div"),document.body.append(qp));try{const t=e.getBoundingClientRect(),n=window.getComputedStyle(e);qp.style.font=n.font,qp.style.padding=n.padding,qp.style.whiteSpace="pre-wrap",qp.style.wordWrap="break-word",qp.style.position="fixed",Zp||(qp.style.visibility="hidden"),qp.style.width=`${t.width}px`,qp.style.height=`${t.height}px`,qp.style.top=`${t.top}px`,qp.style.left=`${t.left}px`;const r=e.selectionStart,o=document.createElement("span");o.style.display="inline-block",o.style.verticalAlign="bottom";const i=e.value.substring(0,r),a=e.value.slice(r),s="\nx";qp.innerHTML="",qp.append(i,o,a,s),qp.style.overflowY="auto",qp.scrollTop=e.scrollTop;const l=o.getBoundingClientRect();return{x:l.left-t.left,y:l.top-t.top}}finally{qp.remove(),qp=void 0}}(e);g.current&&(g.current.style.transform=`translate(${t}px, ${r}px)`);const o=function(e,t){const{start:n}=$p(e,t);return e.slice(n,t)}(e.value,e.selectionStart),i=o.startsWith("@");u(i),h(i?o.substring(1):void 0)}),[n]),y=de((e=>{
|
|
544
|
+
const t=p.current,{value:n}=t,{start:r,end:i}=$p(n,t.selectionStart),l=`${n.slice(0,r)}${function(e,t){return"display-name"===t?Bp(e.displayName??""):`@${e.username}`}(e,a)} `,c=n.slice(i);t.value=`${l}${c}`,t.selectionStart=l.length,t.selectionEnd=l.length,t.focus(),o(t.value),s?.(e),u(!1),f(0)}),[a,o,s,p]),_=pe(),w=ue((()=>{if(!c)return{};const e=v[m],t=e?`${_}-${e.username}`:void 0;return{role:"combobox","aria-controls":_,"aria-expanded":!0,"aria-autocomplete":"list","aria-haspopup":"listbox","aria-activedescendant":t}}),[m,c,v,_]);return Ve("div",{className:"relative",children:[Ve("textarea",{className:Je("border rounded p-2","placeholder:text-grey-6 bg-grey-0","focus:bg-white focus:outline-none focus:shadow-focus-inner",e),onInput:e=>{const t=e.target;o(t.value),f(0),b(t)},...l,onKeyUp:e=>{c&&b(e.target)},onKeyDown:e=>{i?.(e),c&&0!==v.length&&("ArrowDown"===e.key?(e.preventDefault(),f((e=>Math.min(e+1,v.length-1)))):"ArrowUp"===e.key?(e.preventDefault(),
|
|
545
|
+
f((e=>Math.max(e-1,0)))):"Enter"===e.key&&(e.preventDefault(),y(v[m])))},ref:p,...w}),Ve("div",{ref:g,className:"absolute top-0 left-0 w-0 h-0 pointer-events-none"}),n&&Ve(Jp,{open:c,onClose:()=>u(!1),anchorElementRef:g,loadingUsers:"loading"===r.status,users:v,highlightedSuggestion:m,onHighlightSuggestion:f,onSelectUser:y,usersListboxId:_,mentionMode:a})]})}function rm({isPreviewing:e,onCommand:t,onTogglePreview:n,showHelpLink:r,mentionsEnabled:o}){const i=ce(null);return Se(i),Ve("div",{className:Je("flex flex-wrap w-full items-center","p-1 border-x border-t rounded-t bg-white","touch:h-auto touch:overflow-x-scroll touch:flex-nowrap touch:pb-2.5"),"data-testid":"markdown-toolbar",role:"toolbar","aria-label":"Markdown editor toolbar",ref:i,children:[Ve(tm,{disabled:e,icon:At,onClick:()=>t("bold"),shortcutKey:em.bold,title:"Bold"}),Ve(tm,{disabled:e,icon:Tt,onClick:()=>t("italic"),shortcutKey:em.italic,title:"Italic"}),Ve(tm,{disabled:e,icon:St,onClick:()=>t("quote"),shortcutKey:em.quote,title:"Quote"
|
|
546
|
+
}),Ve(tm,{disabled:e,icon:Bt,onClick:()=>t("link"),shortcutKey:em.link,title:"Insert link"}),Ve(tm,{disabled:e,icon:Ht,onClick:()=>t("image"),shortcutKey:em.image,title:"Insert image"}),Ve(tm,{disabled:e,icon:kt,onClick:()=>t("math"),title:"Insert math (LaTeX is supported)"}),Ve(tm,{disabled:e,icon:qt,onClick:()=>t("numlist"),shortcutKey:em.numlist,title:"Numbered list"}),Ve(tm,{disabled:e,icon:Ut,onClick:()=>t("list"),shortcutKey:em.list,title:"Bulleted list"}),o&&Ve(tm,{disabled:e,icon:Wt,onClick:()=>t("mention"),title:"Mention",classes:"!text-brand"}),Ve("div",{className:"grow flex justify-end",children:[r&&Ve($n,{classes:"text-grey-7 hover:!text-grey-7",href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",title:"Formatting help","aria-label":"Formatting help",underline:"none",variant:"custom",children:Ve("div",{className:Je("flex justify-center items-center","touch:h-touch-minimum touch:w-touch-minimum","px-2 py-2.5 touch:p-0"),children:Ve(Rt,{className:"w-2.5 h-2.5"})
|
|
547
|
+
})}),Ve(tm,{label:e?"Write":"Preview",onClick:n})]})]})}function om({mentionsEnabled:e=!1,label:t,onEditText:n=(()=>{}),text:r,textStyle:o={},showHelpLink:i=!0,usersForMentions:a,mentions:s,mentionMode:l,onInsertMentionSuggestion:c}){const[u,d]=ie(!1),h=ce(null),p=ue((()=>function({text:e,mentionMode:t,mentions:n=[]}){return e.replace(Fp,((e,r)=>{const o=document.createElement("div");o.innerHTML=e;const i=o.querySelector("a[data-hyp-mention]")?.getAttribute("data-userid"),a=n.find((({original_userid:e})=>e===i));return"username"===t?`@${a?.username??r}`:Bp(a?.display_name||r)}))}({text:r,mentionMode:l,mentions:s})),[l,s,r]);se((()=>{u||h.current?.focus()}),[u]);const m=e=>{h.current&&(!function(e,t){const n=e=>{const n=e({text:t.value,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd});t.value=n.text,t.selectionStart=n.selectionStart,t.selectionEnd=n.selectionEnd,t.focus()},r=e=>{const t=e.text.slice(0,e.selectionStart)
|
|
548
|
+
;return 0===t.length||"\n"===t.slice(-1)||"$$"===t.slice(-2)?Wp(e,"$$","$$","Insert LaTeX"):Wp(e,"\\(","\\)","Insert LaTeX")};switch(e){case"bold":n((e=>Wp(e,"**","**","Bold")));break;case"italic":n((e=>Wp(e,"*","*","Italic")));break;case"quote":n((e=>Xp(e,"> ")));break;case"link":n((e=>Vp(e)));break;case"image":n((e=>Vp(e,Up.IMAGE_LINK)));break;case"math":n(r);break;case"numlist":n((e=>Xp(e,(e=>`${e+1}. `))));break;case"list":n((e=>Xp(e,"* ")));break;case"mention":n((e=>Wp(e,"@","",""))),t.dispatchEvent(new KeyboardEvent("input",{key:"@"}))}}(e,h.current),n(h.current.value))};return Ve("div",{className:"leading-none",children:[Ve(rm,{onCommand:m,isPreviewing:u,onTogglePreview:()=>d(!u),showHelpLink:i,mentionsEnabled:e}),u?Ve(fp,{markdown:r,classes:"border bg-grey-1 p-2",style:o,mentions:s,mentionsEnabled:e,mentionMode:l}):Ve(nm,{"aria-label":t,placeholder:t,dir:"auto",classes:Je("w-full min-h-[8em] resize-y","rounded-t-none","text-base touch:text-touch-base"),containerRef:h,onKeyDown:e=>{
|
|
549
|
+
if(e.ctrlKey||e.metaKey)for(const[t,n]of Object.entries(em))n===e.key&&(e.stopPropagation(),e.preventDefault(),m(t))},onEditText:n,value:p,style:o,mentionsEnabled:e,usersForMentions:a,mentionMode:l,onInsertMentionSuggestion:c})]})}function im({classes:e,direction:t="up"}){return Ve("up"===t?Jt:Qt,{className:Je("absolute inline z-2 text-grey-3 fill-white",e)})}const am=e=>e;function sm({activeItem:e=-1,id:t,itemPrefixId:n,list:r,listFormatter:o=am,onSelectItem:i,open:a=!1}){const s=ue((()=>r.map(((t,r)=>{const a=n?{id:`${n}${r}`}:{};return Ve("li",{role:"option","aria-selected":e===r,className:Je("flex items-center","border-l-4 py-1 px-3 cursor-pointer hover:bg-grey-2","touch:h-touch-minimum",{"border-brand bg-grey-1":e===r,"border-transparent":e!==r}),onClick:()=>{i(t)},...a,children:o(t,r)},`AutocompleteList-${r}`)}))),[e,n,r,o,i]),l=t?{id:t}:{},c=0===r.length||!a;return Ve("div",{className:"relative",children:Ve("div",{className:Je({hidden:c},"absolute top-[3px] z-3","min-w-[10em]"),
|
|
550
|
+
"data-testid":"autocomplete-list-container",children:Ve(it,{width:"auto",classes:"overflow-hidden",children:[Ve("ul",{tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s}),Ve(im,{direction:"up",classes:"top-[-8px] left-2"})]})})})}let lm=0;var cm=er((function({onAddTag:e,onRemoveTag:t,onTagInput:n,tagList:r,tags:o}){const i=ce(),[a,s]=ie([]),[l,c]=ie(-1),[u,d]=ie(!1),[h]=ie((()=>(++lm,`TagEditor-${lm}`))),p=ce(null);Ce(p,(()=>d(!1)),{enabled:u});const m=()=>i.current.value.trim(),f=()=>m()&&m().length>0,g=()=>{i.current.value="",n?.("")},v=t=>{e(t)&&(d(!1),c(-1),g(),i.current.focus())},b=e=>{let t=l+e;t<-1?t=a.length-1:t>=a.length&&(t=-1),c(t)},y=l>=0?`${h}-AutocompleteList-item-${l}`:"";return Ve("div",{className:"space-y-4",children:[Ve(Np,{children:r.map((e=>Ve(Ip,{onRemoveTag:t,tag:e},e)))}),Ve("div",{id:h,"data-testid":"combobox-container",ref:p,children:[Ve(An,{onInput:()=>{n?.(m()),(()=>{if(f()){const e=o.filter(m());s(((e,t)=>{const n=[];for(const r of e)t.indexOf(r)<0&&n.push(r)
|
|
551
|
+
;return n.sort()})(e,r)),d(e.length>0)}else d(!1);c(-1)})()},onKeyDown:e=>{switch(e.key){case"ArrowUp":b(-1),e.preventDefault();break;case"ArrowDown":b(1),e.preventDefault();break;case"Escape":g(),e.preventDefault();break;case"Enter":case",":v(-1===l?m():a[l]),e.preventDefault();break;case"Tab":if(!f())break;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&d(!0)},elementRef:i,placeholder:"Add new tags",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":y,"aria-controls":`${h}-AutocompleteList`,"aria-expanded":u,"aria-label":"Add tags",dir:"auto",role:"combobox",classes:Je("text-base touch:text-touch-base")}),Ve(sm,{id:`${h}-AutocompleteList`,list:a,listFormatter:e=>{const t=m().toLowerCase(),n=e.toLowerCase().indexOf(t);if(-1===n)return Ve("span",{children:e});const r=e.slice(0,n),o=e.slice(n,n+t.length),i=e.slice(n+t.length);return Ve("span",{children:[Ve("strong",{children:r}),o,Ve("strong",{children:i})]})},open:u,onSelectItem:e=>{e&&v(e)},
|
|
552
|
+
itemPrefixId:`${h}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);let um=0;function dm(e){e.preventDefault(),e.returnValue=!0}function hm(){return Ve("div",{className:"pt-2 border-t text-xs leading-none",children:Ve($n,{href:"http://creativecommons.org/publicdomain/zero/1.0/",target:"_blank",title:"View more information about the Creative Commons Public Domain dedication",underline:"none",variant:"text-light",children:Ve("div",{className:"flex items-center",children:[Ve(mt,{className:"w-[10px] h-[10px]"}),Ve(ft,{className:"w-[10px] h-[10px] ml-px"}),Ve("div",{className:"ml-1",children:"Annotations can be freely reused by anyone for any purpose."})]})})})}function pm(e){return null!==e.offsetParent}function mm({className:e,closeMenu:t,children:n,visible:r}){const o=ce(null);se((()=>{let e;return r&&(e=setTimeout((()=>{const e=o.current.querySelector('[role^="menuitem"]');e&&e.focus()}))),()=>{clearTimeout(e)}}),[r]);return Ve("div",{role:"menu",className:e,ref:o,onKeyDown:e=>{
|
|
553
|
+
const n=Array.from(o.current.querySelectorAll('[role^="menuitem"]')).filter(pm);let r=n.findIndex((e=>e.contains(document.activeElement))),i=!1;switch(e.key){case"ArrowLeft":case"Escape":t&&(t(e),i=!0);break;case"ArrowUp":r-=1,r<0&&(r=n.length-1),i=!0;break;case"ArrowDown":r+=1,r===n.length&&(r=0),i=!0;break;case"Home":r=0,i=!0;break;case"End":r=n.length-1,i=!0}i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}let fm=!1;const gm=()=>{};function vm({align:e="left",children:t,containerPositioned:n=!0,contentClass:r,defaultOpen:o=!1,disabled:i=!1,label:a,open:s,onOpenChanged:l,menuIndicator:c=!0,title:u}){let[d,h]=ie(o);"boolean"==typeof s&&(d=s,h=l||gm);const p=ce(d);se((()=>{"function"==typeof l&&p.current!==d&&(p.current=d,l(d))}),[d,l]);const m=e=>{if("mousedown"===e.type)fm=!0;else if("click"===e.type&&fm)return fm=!1,e.stopPropagation(),void e.preventDefault();h(!d)},f=de((()=>h(!1)),[h]),g=ce(null);Ce(g,f,{enabled:d});const v=e=>e.stopPropagation(),b={
|
|
554
|
+
position:n?"relative":"static"},y="max-w-full min-w-0";return Ve("div",{className:Je("relative",y),"data-testid":"menu-container",ref:g,style:b,onClick:v,onMouseDown:v,children:[Ve("button",{"aria-expanded":d?"true":"false","aria-haspopup":!0,className:Je("focus-visible-ring rounded transition-colors","flex items-center justify-center gap-x-1",y,{"text-grey-7 hover:text-grey-9":!d,"text-brand":d}),"data-testid":"menu-toggle-button",disabled:i,onMouseDown:m,onClick:m,"aria-label":u,title:u,children:[a,c&&Ve("span",{className:Je({"rotate-180 text-color-text":d}),children:Ve(Yt,{className:"w-2.5 h-2.5"})})]}),d&&Ve("div",{className:Je("focus-visible-ring","absolute top-[calc(100%+3px)] z-1","border shadow-intense rounded-lg overflow-hidden bg-white text-md",{"left-0":"left"===e,"right-0":"right"===e},r),"data-testid":"menu-content",role:"menu",tabIndex:-1,onClick:f,onKeyDown:e=>{const t=e.key;"Enter"!==t&&" "!==t||setTimeout((()=>{f()}))},children:Ve(mm,{visible:!0,children:t})})]})}
|
|
555
|
+
function bm({title:e,isExpanded:t,onToggleSubmenu:n}){const r=t?Kt:Yt;return Ve("div",{"data-testid":"submenu-toggle",role:"none",className:Je("flex flex-col items-center justify-center w-10 h-10","text-grey-6 bg-grey-1","bg-clip-content border-[8px] border-transparent rounded-xl","group-hover:hover:text-grey-8",{"bg-grey-4":t,"group-hover:bg-grey-3":!t}),onClick:n,title:e,children:Ve(r,{className:"w-3 h-3",viewBox:"0 0 16 16"})})}function ym({href:e,icon:t,isDisabled:n,isExpanded:r,isSelected:o,isSubmenuItem:i,isSubmenuVisible:a,label:s,leftChannelContent:l,onClick:c,onToggleSubmenu:u,submenu:d,submenuToggleTitle:h}){const p=ce(null);let m,f;const g="boolean"==typeof a,v="boolean"==typeof o;se((()=>()=>{clearTimeout(m)}),[]);const b=e=>{switch(e.key){case"ArrowRight":u&&(e.stopPropagation(),e.preventDefault(),u(e));break;case"Enter":case" ":c&&c(e)}},_=t?Ve(t,{className:"h-3 w-3"}):null,w=i?null:_,x=i?_:null,k=!!x,S=Ve(y,{children:[(l||i||!!w)&&Ve("div",{className:"w-7 flex items-center justify-center",
|
|
556
|
+
"data-testid":"left-item-container",children:l??w}),Ve("span",{className:"flex items-center grow whitespace-nowrap px-1",children:s}),k&&Ve("div",{className:"w-8 flex items-center justify-center","data-testid":"right-item-container",children:x}),g&&Ve(bm,{title:h??("string"==typeof s?`Show actions for ${s}`:"Toggle submenu"),isExpanded:a,onToggleSubmenu:u})]}),A=Je("focus-visible-ring ring-inset","w-full min-w-[150px] flex items-center select-none","rounded-none",{"focus-visible:rounded-lg":!o,"focus-visible:rounded-r-lg":o,"cursor-pointer":!n},"group",{"min-h-[30px] font-normal":i,"min-h-[40px] font-medium":!i,"bg-grey-1":i||r,"hover:bg-grey-3":!n&&(i||r),"bg-white":!i&&!r,"hover:bg-grey-1":!n&&!i&&!r,"pr-1":!g},{"border-l-[4px] border-l-brand":o,"pl-[4px]":!o,"text-color-text-light":n,"text-color-text hover:text-color-text":!n});return f=e?Ve("a",{ref:p,className:A,"data-testid":"menu-item",href:e,target:"_blank",tabIndex:-1,rel:"noopener noreferrer",role:"menuitem",onKeyDown:b,children:S}):Ve("div",{ref:p,
|
|
557
|
+
className:A,"data-testid":"menu-item",tabIndex:-1,onKeyDown:b,onClick:c,role:v?"menuitemradio":"menuitem","aria-checked":v?o:void 0,"aria-haspopup":g,"aria-expanded":g?a:void 0,children:S}),Ve(y,{children:[f,g&&Ve(Wn,{direction:a?"in":"out",children:Ve(mm,{closeMenu:e=>{u&&u(e),m=setTimeout((()=>{p.current.focus()}))},visible:a,className:"border-y border-grey-3",children:d})})]})}var _m=er((function({group:e,isDisabled:t,isPrivate:n,onCancel:r,onSave:o,onSetPrivate:i,settings:a}){const s=Qn(["ctaTextColor","ctaBackgroundColor"],a),l=Ve("div",{className:"w-9 h-9 flex items-center justify-center text-color-text-inverted",style:s,children:Ve(Yt,{className:"w-4 h-4"})}),c=`Post to ${n?"Only Me":e.name}`,u=ce(null),d=function(e){const[t,n]=ie(!1);return se((()=>{const t=e.current;if(!t)return()=>{};const r=()=>n(t.scrollWidth>t.clientWidth);r();const o=new ResizeObserver(r);return o.observe(t),()=>o.disconnect()}),[e]),t}(u);return Ve("div",{className:"flex flex-row gap-x-3",children:[Ve("div",{
|
|
558
|
+
className:"flex relative max-w-full min-w-0",children:[Ve(dn,{classes:Je("rounded-r-none","truncate !block"),"data-testid":"publish-control-button",style:s,onClick:o,disabled:t,size:"lg",variant:"primary",title:d?c:void 0,elementRef:u,children:c}),Ve("div",{className:Je("flex flex-row rounded-r bg-grey-7 hover:bg-grey-8"),style:s,children:Ve(vm,{containerPositioned:!1,contentClass:Je("min-w-full"),label:l,menuIndicator:!1,title:"Change annotation sharing setting",align:"left",children:[Ve(ym,{icon:"open"===e.type?zt:Pt,label:e.name,isSelected:!n,onClick:()=>i(!1)}),Ve(ym,{icon:Gt,label:"Only Me",isSelected:n,onClick:()=>i(!0)})]})})]}),Ve("div",{children:Ve(dn,{"data-testid":"cancel-button",onClick:r,size:"lg",children:[Ve(dt,{}),"Cancel"]})})]})}),["settings"]);function wm({description:e,onEdit:t}){const[n,r]=ie(!1),o=ce(null);return Ve("div",{className:"relative",children:[Ve("div",{className:"flex gap-1 items-center",children:[Ve(An,{"data-testid":"description",placeholder:"Thumbnail description",
|
|
559
|
+
"aria-label":"Thumbnail description",value:e,onInput:e=>t(e.target.value),maxlength:5e3,classes:"flex-1"}),Ve(mn,{icon:Ft,title:"About thumbnail descriptions",onClick:()=>r(!n),expanded:n,elementRef:o,classes:"text-[16px]"})]}),Ve(Nn,{open:n,align:"right",anchorElementRef:o,onClose:()=>r(!1),classes:Je("mt-1","w-80 max-w-[100vw]","p-2 text-sm"),children:Ve("div",{className:"flex flex-col gap-y-2",children:["Description of the thumbnail image used for accessibility, search and export to text formats.",Ve($n,{href:"https://web.hypothes.is/help/how-to-write-alt-text/",underline:"always",target:"_blank",children:"Learn how to write alt text"})]})})]})}var xm=er((function({annotation:e,annotationsService:t,draft:n,groups:r,settings:o,tags:i,toastMessenger:a}){const[s,l]=ie(null),c=Fi(),u=c.getGroup(e.group),d=ue((()=>Rr(e)),[e]),h=ue((()=>Zr(e)&&c.isFeatureEnabled("image_descriptions")),[e,c]),p=!n.isPrivate&&u&&"private"!==u.type,m=Kn(o)?.enableHelpPanel??!0,f=n.tags,g=n.text,v=n.description,b=!g&&!f.length&&!v
|
|
560
|
+
;!function(e,t=window){const n=tr("annotationActivity");se((()=>e?(um+=1,1===um&&(n.notifyUnsavedChanges(!0),t.addEventListener("beforeunload",dm)),()=>{um-=1,0===um&&(n.notifyUnsavedChanges(!1),t.removeEventListener("beforeunload",dm))}):()=>{}),[n,e,t])}(!b);const y=de((e=>{c.createDraft(n.annotation,{...n,description:e})}),[n,c]),_=de((e=>{c.createDraft(n.annotation,{...n,tags:e})}),[n,c]),w=de((e=>{if(!e||f.indexOf(e)>=0)return!1;const t=[...f,e];return i.store(t),_(t),!0}),[_,f,i]),x=de((e=>{const t=[...f],n=t.indexOf(e);return n>=0&&(t.splice(n,1),_(t),!0)}),[_,f]),k=de((e=>{c.createDraft(n.annotation,{...n,text:e})}),[n,c]),S=de((t=>{c.createDraft(e,{...n,isPrivate:t}),d||c.setDefault("annotationPrivacy",t?"private":"shared")}),[e,n,d,c]),A=c.defaultAuthority(),T=ue((()=>Pr(e.user,A)?"display-name":"username"),[e.user,A]),E=ce(new Map("username"===T?[]:e.mentions?.filter((e=>!!e.display_name)).map((({userid:e,username:t,display_name:n})=>[n,{userid:e,username:t,displayName:n}])))),C=de((e=>{
|
|
561
|
+
const{displayName:t}=e;t&&"display-name"===T&&E.current.set(t,e)}),[T]),M=async()=>{s&&w(s);const n=`${Gr(e,o)} ${Dr(e)?"updated":"saved"}`;try{await t.save(e,"username"===T?{mentionMode:T}:{mentionMode:T,usersMap:E.current}),a.success(n,{visuallyHidden:!0}),E.current=new Map}catch{a.error("Saving annotation failed")}},N=de((()=>{c.removeDraft(e),E.current=new Map,Dr(e)||c.removeAnnotations([e])}),[e,c]),I=Qn(["annotationFontFamily"],o),O=c.isFeatureEnabled("at_mentions"),z=c.usersWhoAnnotated(),L=c.usersWhoWereMentioned(),P=c.getFocusedGroupMembers(),R=ue((()=>function({usersWhoAnnotated:e,usersWhoWereMentioned:t,focusedGroupMembers:n,mentionMode:r}){if("loaded"!==n.status)return{status:"loading"};const o=n.members.map((({userid:e,username:t,display_name:n})=>({userid:e,username:t,displayName:n}))),i=new Set,a=[...e,...t,...o].filter((({userid:e})=>{const t=i.has(e);return i.add(e),!t})).sort(((e,t)=>{if("username"===r)return e.username.localeCompare(t.username);const n=e.displayName??"",o=t.displayName??""
|
|
562
|
+
;return n.localeCompare(o,void 0,{sensitivity:"base"})||e.username.localeCompare(t.username)}));return{status:"loaded",users:a}}({usersWhoAnnotated:z,usersWhoWereMentioned:L,focusedGroupMembers:P,mentionMode:T})),[P,T,z,L]);return se((()=>{O&&"not-loaded"===P.status&&r.loadFocusedGroupMembers()}),[P,r,O]),Ve("div",{"data-testid":"annotation-editor",className:"space-y-4",onKeyDown:e=>{const t=e.key;b||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),M())},children:[h&&Ve(wm,{description:v??"",onEdit:y}),Ve(om,{textStyle:I,label:d?"Enter reply":"Enter comment",text:g,onEditText:k,mentionsEnabled:O,usersForMentions:R,showHelpLink:m,mentions:e.mentions,mentionMode:T,onInsertMentionSuggestion:C}),Ve(cm,{onAddTag:w,onRemoveTag:x,onTagInput:l,tagList:f}),u&&Ve(_m,{group:u,isDisabled:b,isPrivate:n.isPrivate,onCancel:N,onSave:M,onSetPrivate:S}),p&&Ve(hm,{})]})}),["annotationsService","groups","settings","tags","toastMessenger"])
|
|
563
|
+
;var km=er((function({annotation:e,isEditing:t,replyCount:n,threadIsCollapsed:r,settings:o}){const i=Fi(),a=i.defaultAuthority(),s=i.isFeatureEnabled("client_display_names"),l=i.getLink("user",{user:e.user}),c=ue((()=>Qi(e,a,s)),[e,a,s]),u=ue((()=>function(e,t,n,r){return!Pr(e.user,n)&&r?r:(t.usernameUrl&&`${t.usernameUrl}${Lr(e.user)}`)??void 0}(e,o,a,l)),[e,o,a,l]),d=Rr(e)&&r,h=e.links?.html||"",p=ue((()=>function(e){if(!e.updated||!e.created||e.updated===e.created)return!1;const t=new Date(e.created).getTime(),n=new Date(e.updated).getTime();return!isNaN(t)&&!isNaN(n)&&n-t>2e3}(e)&&!d),[e,d]),m="sidebar"!==i.route();let f;"sidebar"!==i.route()&&(f=i.getGroup(e.group));const g=Jr(e);return Ve("header",{children:[Ve("div",{className:"flex gap-x-1 items-center flex-wrap-reverse",children:[Ep(e.permissions)&&!t&&Ve(Gt,{className:"w-[12px] h-[12px]",title:"This annotation is visible only to you"}),Ve(va,{authorLink:u,displayName:c}),n>0&&d&&Ve(Bn,{variant:"text-light",onClick:()=>i.setExpanded(e.id,!0),
|
|
564
|
+
title:"Expand replies",underline:"hover",children:`${n} ${n>1?"replies":"reply"}`}),!t&&e.created&&Ve("div",{className:"flex justify-end grow",children:Ve(ga,{annotationCreated:e.created,annotationUpdated:e.updated,annotationURL:h,withEditedTimestamp:p})})]}),!Rr(e)&&Ve("div",{className:"flex gap-x-1 items-baseline flex-wrap-reverse","data-testid":"extended-header-info",children:[f&&Ve(oa,{group:f}),!t&&$r(e)&&Ve(jt,{title:"This is a highlight. Click 'edit' to add a note or tag.",className:"w-[10px] h-[10px] text-color-text-light"}),m&&Ve("div",{className:"flex",children:[Ve(ra,{annotation:e}),g&&Ve("span",{className:"text-grey-6",children:", "})]}),g&&Ve("span",{className:"text-grey-6","data-testid":"page-number",children:["p. ",g]})]})]})}),["settings"]);var Sm=er((function({settings:e,...t}){return Ve(Ta,{...t,inlineControl:!0,inlineControlStyle:Qn(["selectionFontFamily"],e)})}),["settings"]);var Am=er((function({quote:e,isHovered:t,isOrphan:n,settings:r}){return Ve(Sm,{collapsedHeight:35,
|
|
565
|
+
overflowThreshold:20,children:Ve(za,{classes:Je({"p-redacted-text":n}),children:Ve("blockquote",{className:Je("hover:border-l-blue-quote",{"border-l-blue-quote":t}),style:Qn(["selectionFontFamily"],r),children:e})})})}),["settings"]);function Tm({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return Ve(dn,{classes:Je("text-grey-7 enabled:hover:text-brand-dark","enabled:hover:underline"),onClick:e,title:r,variant:"custom",children:r})}var Em=er((function({description:e,textInImage:t,tag:n,thumbnailService:r,showDescription:o=!0}){const[i,a]=ie((()=>r.get(n))),[s,l]=ie(),c=ue((()=>window.devicePixelRatio),[]);let u;se((()=>{i||s||r.fetch(n,{maxWidth:196*c,devicePixelRatio:c}).then(a).catch((e=>l(e.message)))}),[s,c,n,i,r]),e?u=e:t&&(u=t);const d=i?i.width/c:0,h=i?i.height/c:0,p=pe();return Ve(y,{children:[Ve("div",{className:"flex flex-row justify-center relative","data-testid":"thumbnail-container",children:[i&&Ve("img",{src:i.url,alt:u,
|
|
566
|
+
className:"border rounded-md",style:{width:`${d}px`,height:`${h}px`}}),!i&&!s&&Ve("span",{"data-testid":"placeholder",children:"Loading thumbnail..."}),!i&&s&&Ve("span",{"data-testid":"error",children:["Unable to render thumbnail: ",s]})]}),i&&u&&o&&Ve(Sm,{collapsedHeight:35,children:Ve(za,{"aria-hidden":"true",children:Ve("blockquote",{id:p,children:u})})})]})}),["thumbnailService"]);function Cm(){return Ve("div",{className:Je("flex grow justify-end items-center gap-x-1","h-8 touch:h-touch-minimum"),"data-testid":"saving-message",children:[Ve("span",{className:"text-[16px] animate-fade-in-slow",children:Ve(Rn,{size:"sm"})}),Ve("div",{className:"text-color-text-light font-medium",children:"Saving..."})]})}var Mm=er((function({annotation:e,isReply:t,onToggleReplies:n,replyCount:r,threadIsCollapsed:o,annotationsService:i,settings:a}){
|
|
567
|
+
const s=Fi(),l=Yr(e),c=Xr(e),u=s.getDraft(e),d=s.profile().userid,h=s.isAnnotationHovered(e.$tag),p=s.isSavingAnnotation(e),m=!!u&&!p,f=t&&o,g=!p&&!m&&Dr(e),v=s.defaultAuthority(),b=s.isFeatureEnabled("client_display_names"),y=ue((()=>Qi(e,v,b)),[e,v,b]),_=ue((()=>Ue(e.created)),[e.created]),w=Gr(e,a),x=Dr(e)?w:`New ${w.toLowerCase()}`,k=s.isAnnotationHighlighted(e)?" - Highlighted":"",S=ue((()=>Zr(e)),[e]);return Ve("article",{className:"space-y-4","aria-label":`${x} by ${y} on ${_}${k}`,children:[Ve(km,{annotation:e,isEditing:m,replyCount:r,threadIsCollapsed:o}),S&&Ve(Em,{tag:e.$tag,textInImage:S.text,description:c,showDescription:!m}),l&&Ve(Am,{quote:l,isHovered:h,isOrphan:Br(e)}),!f&&!m&&Ve(zp,{annotation:e}),m&&Ve(xm,{annotation:e,draft:u}),!f&&Ve("footer",{className:"flex items-start",children:[Ve("div",{className:"flex flex-col items-start gap-y-1",children:[g&&Ve(xp,{annotation:e,groupIsPreModerated:!!s.focusedGroup()?.pre_moderated,badgeClasses:"mt-0.5"}),n&&Ve(Tm,{onToggleReplies:n,replyCount:r,
|
|
568
|
+
threadIsCollapsed:o})]}),p&&Ve(Cm,{}),g&&Ve(at,{classes:"grow",children:Ve(Mp,{annotation:e,onReply:()=>{Dr(e)&&d&&i.reply(e,d)}})})]})]})}),["annotationsService","settings"]);function Nm({isReply:e,replyCount:t,threadIsCollapsed:n,onToggleReplies:r}){return Ve("article",{className:"space-y-4","aria-label":(e?"Reply":"Annotation")+" with unavailable content",children:[Ve("div",{children:Ve("em",{children:"Message not available."})}),r&&Ve("footer",{className:"flex items-center",children:Ve(Tm,{onToggleReplies:r,replyCount:t,threadIsCollapsed:n})})]})}function Im({annotation:e}){const t=Kr(e);return!!t?Ve("div",{className:Je("flex gap-x-3 bg-grey-1 text-color-text font-semibold","rounded-t-lg overflow-hidden","mb-2 ",{"-mt-3 -ml-3 -mr-3":!Rr(e),"-mr-3":Rr(e)}),children:[Ve("div",{className:Je("p-3 text-white",{"bg-red-error":!e.hidden,"bg-grey-6":e.hidden}),children:e.hidden?Ve(Dt,{className:"w-em h-em"}):Ve(It,{className:"w-em h-em"})}),Ve("div",{className:"self-center grow",children:[!e.hidden&&Ve("span",{
|
|
569
|
+
children:["Flagged for review by ",t," ",1===t?"user":"users"]}),e.hidden&&Ve("span",{children:"Hidden from users"})]})]}):null}function Om({threadIsCollapsed:e,onToggleReplies:t}){const n=e?ht:Yt,r=e?"Expand replies":"Collapse replies";return Ve("div",{className:Je("cursor-auto",{"bg-thread-line":!e}),"data-testid":"thread-collapse-channel",children:Ve("div",{className:Je("bg-white"),children:Ve(dn,{classes:Je("-mt-1 touch:min-w-[auto] touch:min-h-[auto] p-[6.5px]","text-grey-6 hover:text-grey-8"),"data-testid":"toggle-button",expanded:!e,title:r,onClick:t,size:"custom",variant:"custom",children:Ve(n,{className:"w-em h-em"})})})})}var zm=er((function e({thread:t,threadsService:n}){const r=!!t.parent,o=t.children.filter((e=>Xi(e)>0)),i=Fi(),a=i.hasAppliedFilter(),s=t.annotation&&i.isSavingAnnotation(t.annotation),l=t.annotation&&!!i.getDraft(t.annotation)&&!s,c=de((()=>i.setExpanded(t.id,!!t.collapsed)),[i,t.id,t.collapsed]),u=!r&&!l&&!a&&t.replyCount>0,d=ue((()=>t.visible&&Ve(y,{children:t.annotation?Ve(y,{
|
|
570
|
+
children:[Ve(Im,{annotation:t.annotation}),Ve(Mm,{annotation:t.annotation,isReply:r,onToggleReplies:u?c:void 0,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})]}):Ve(Nm,{isReply:r,onToggleReplies:u?c:void 0,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})})),[r,c,u,t.annotation,t.replyCount,t.collapsed,t.visible]);return Ve("section",{className:"flex","data-testid":"thread-container",children:[r&&Ve(Om,{threadIsCollapsed:t.collapsed,onToggleReplies:c}),Ve("div",{className:Je("grow max-w-full min-w-0"),"data-testid":"thread-content",children:[d,Yi(t)>0&&Ve("div",{className:"space-y-2",children:[!t.parent&&t.annotation&&Ve(km,{annotation:t.annotation,isEditing:l,replyCount:t.replyCount,threadIsCollapsed:t.collapsed}),Ve("div",{children:Ve(dn,{"data-testid":"show-hidden-button",onClick:()=>n.forceVisible(t),children:["Show ",Yi(t)," more in conversation"]})})]}),!t.collapsed&&Ve("ul",{className:Je("-ml-3"),"data-testid":"thread-children",children:o.map((t=>Ve("li",{
|
|
571
|
+
className:Je("mt-2","[text-align:start]"),children:Ve(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var Lm=er((function({frameSync:e,thread:t}){const n=Fi(),r=t.annotation?.$tag??null,o=!(!r||!n.isAnnotationHovered(r)),i=ue((()=>Gi((t=>e.hoverAnnotation(t)),10)),[e]),a=n.isAnnotationHighlighted(t.annotation),s=de((t=>{e.scrollToAnnotation(t)}),[e]),l=n.profile().userid,c="DENIED"===t.annotation?.moderation_status&&t.annotation.user===l,u=ue((()=>Ve(zm,{thread:t})),[t]),d=n.annotationFocusRequest(),h=ce(null);return se((()=>{d===t.id&&h.current&&(h.current.focus(),n.clearAnnotationFocusRequest())}),[d,n,t.id]),se((()=>{const e=h.current;if(!e)return()=>{};const n=()=>{i(t.annotation??null)},r=t=>{const n=t.relatedTarget;n&&n instanceof Node&&e.contains(n)||i(null)};return e.addEventListener("focusin",n),e.addEventListener("focusout",r),()=>{e.removeEventListener("focusin",n),e.removeEventListener("focusout",r)}}),[i,t.annotation]),Ve(it,{active:o,
|
|
572
|
+
classes:Je("cursor-pointer focus-visible-ring theme-clean:border-none",{"border-brand":a,"border-red":!a&&c}),"data-testid":"thread-card",elementRef:h,tabIndex:0,"aria-description":"Press Enter to scroll annotation into view",onClick:e=>{var n;(n=e.target).closest("button")||n.closest("a")||!t.annotation||s(t.annotation)},onMouseEnter:()=>i(t.annotation??null),onMouseLeave:()=>i(null),onKeyDown:e=>{e.target===h.current&&["Enter"," "].includes(e.key)&&t.annotation&&s(t.annotation)},children:Ve(st,{children:u})},t.id)}),["frameSync"]);const Pm=50;function Rm(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function Dm(e){return Math.max(e-e%Pm,0)}function jm(e){const t=e.target[0];if(t)return t.selector?.find((e=>"EPUBContentSelector"===e.type))}function Hm(e){if(!e.annotation)return null;const t=jm(e.annotation);return t?.cfi??null}function Fm({threads:e}){const[t,n]=ie(0),[r,o]=ie(0);le((()=>{const e=new xe,t=Rm();n(t.clientHeight),
|
|
573
|
+
o(Dm(t.scrollTop));const r=Gi((()=>{n(t.clientHeight),o(Dm(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}}),[]);const[i,a]=ie((()=>new Map)),[s,l]=ie(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:d,visibleThreads:h,offscreenThreadsAbove:p}=ue((()=>function(e,t,n,r,o=Vi){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,d=0,h=0;return e.forEach((e=>{const o=t.get(e.id)||i;c+o<n-a?(u+=o,h+=1):c<n+r+s?l.push(e):d+=o,c+=o})),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:d,offscreenThreadsAbove:h}}(c,i,r,t)),[c,i,r,t]),m=ue((()=>{let t=null,n=null;const r=function(e){const t=new Map;for(const n of e){if(!n.annotation)continue;const e=jm(n.annotation);e?.title&&t.set(e.cfi,e.title)}return t}(e),o=new Map;for(const i of e){const e=Hm(i);if(!e||t===e)continue;t=e;const a=r.get(e)??"Untitled chapter";n!==a&&(n=a,o.set(i,a))}return o
|
|
574
|
+
}),[e]),f=Fi(),g=f.profile().userid,v=f.countDrafts()>0,b=f.highlightedAnnotations(),y=f.allAnnotations(),_=(()=>{const e=f.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();se((()=>{_&&(f.setForcedVisible(_,!0),l(_))}),[f,_]);const w=ue((()=>function(e,{highlightedAnnotations:t,currentUserId:n}){if(0===t.length)return null;const r=e.filter((e=>e.id&&t.includes(e.id))).sort(((e,t)=>t.updated===e.updated?0:t.updated>e.updated?1:-1));return(n?r.find((e=>e.mentions&&e.mentions.some((({userid:e})=>e===n)))):null)??r[0]??null}(y,{highlightedAnnotations:b,currentUserId:g})?.id),[y,g,b]);return se((()=>{!v&&w&&l(w)}),[v,w]),se((()=>{if(!s)return;const e=c.findIndex((e=>e.id===s));if(-1===e)return;l(null);const t=c.slice(0,e).reduce(((e,t)=>e+(e=>i.get(e.id)||Vi.defaultHeight)(t)),0);Rm().scrollTop=t}),[s,c,i]),se((()=>{a((e=>{const t=new Map;for(const{id:n}of h){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=Wi(r)
|
|
575
|
+
;o!==e.get(n)&&t.set(n,o)}return 0===t.size?e:new Map([...e,...t])}))}),[h]),Ve("div",{role:"list",children:[Ve("div",{style:{height:d}}),h.map(((t,n)=>Ve("div",{role:"listitem","aria-setsize":e.length,"aria-posinset":p+n+1,className:Je("mb-3"),"data-testid":"thread-card-container",id:t.id,children:[m.get(t)&&Ve("h3",{className:"text-md text-grey-7 font-bold pt-3 pb-2",children:m.get(t)}),Ve(Lm,{thread:t})]},t.id))),Ve("div",{style:{height:u}})]})}const $m={collapsed:!1,depth:0,visible:!0,replyCount:0};function Bm(e){return e.id||e.$tag}function qm(e,t,n){const r=e[n];return!(!r||r.parent===t)&&(!r.parent||qm(e,t,r.parent))}function Um(e,t,n){if(e[t].parent||!n.length)return;const r=n[n.length-1];e[r]||(e[r]={...$m,children:[],id:r},Um(e,r,n.slice(0,-1))),qm(e,t,r)&&(e[t].parent=r,e[r].children.push(e[t]))}function Gm(e,t){return Object.assign({},t(e),{children:e.children.map((e=>Gm(e,t)))})}function Vm(e,t,n){const r=e.children.map((e=>Vm(e,n,n))).slice().sort(t);return{...e,children:r}}function Wm(e,t){
|
|
576
|
+
const n=e.children.map((e=>Wm(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);return{...e,children:n,depth:t,replyCount:r}}function Km(e){return e.children.some((e=>e.visible||Km(e)))}const Ym=(e,t)=>e.annotation&&t.annotation?e.annotation.created<t.annotation.created?-1:e.annotation.created>t.annotation.created?1:0:0;function Xm(e,t){const n=t.selected.length>0,r=t.forcedVisible.length>0;let o=function(e){const t={};e.forEach((e=>{const n=Bm(e);t[n]={...$m,children:[],annotation:e,id:n}})),e.forEach((e=>{const n=(e.references||[]).filter((t=>t!==e.id));return Um(t,Bm(e),n)}));const n=[];for(const e in t)t[e].parent||(t[e].collapsed=!0,n.push(t[e]));return{...$m,id:"root",children:n}}(e);if(n)o.children=o.children.filter((e=>{const n=t.selected.includes(e.id),o=r&&t.forcedVisible.includes(e.id);return n||o}));else if(t.threadFilterFn){const e=t.threadFilterFn;o.children=o.children.filter((n=>!(!r||!t.forcedVisible.includes(n.id))||e(n)))}return o.visible=!1,o=Gm(o,(e=>{if(n)return{...e,visible:!0}
|
|
577
|
+
;let o=e.visible;return t.filterFn&&(o=!(!r||!t.forcedVisible.includes(e.id))||!!e.annotation&&!!t.filterFn(e.annotation)),{...e,visible:o}})),o.children=o.children.filter((e=>e.visible||Km(e))),o=Gm(o,(e=>{const n={collapsed:e.collapsed};if(Or(t.expanded,e.id))n.collapsed=!t.expanded[e.id];else{const r=t.filterFn&&Km(e);n.collapsed=e.collapsed&&!r}return{...e,...n}})),o=Vm(o,t.sortCompareFn,Ym),o=Wm(o,-1),o}function Zm(e){const t=Qm(e),[n,r]=t.split("-",2);return[n,r??n]}function Qm(e){if(!e.includes("["))return e;let t="",n=!1,r=!1;for(const o of e)n||"^"!==o?(n||"["!==o?!n&&r&&"]"===o?r=!1:r||(t+=o):r=!0,n=!1):n=!0;return t}function Jm(e,t){const n=e=>function(e){const t=Qm(e),n=t.indexOf("!");return-1===n?t:t.slice(0,n)}(e).split("/").map((e=>{const t=parseInt(e,10);return Number.isNaN(t)?e:t}));return function(e,t){for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n]){if(typeof e[n]!=typeof t[n])return"number"==typeof e[n]?-1:1;if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length
|
|
578
|
+
}(n(e),n(t))}function ef(e,t,n){return Jm(e,t)>=0&&Jm(e,n)<0}function tf(e){if(!e)return null;const[t,n]=e.includes("-")?e.split("-"):[e,e];let r=null;if(t&&(r=parseInt(t),!Number.isInteger(r)))return null;let o=null;return n&&(o=parseInt(n),!Number.isInteger(o))?null:null===r||null===o?[r,o]:[Math.min(r,o),Math.max(r,o)]}let nf=function(e){return e[e.Overlap=0]="Overlap",e[e.NoOverlap=1]="NoOverlap",e[e.Unknown=2]="Unknown",e}({});function rf(e,t,n){return[e[0]??t,e[1]??n]}function of(e,t){const n=tf(e),r=tf(t);if(!n||!r)return e&&t&&e===t?nf.Overlap:nf.Unknown;const o=2**31,[i,a]=rf(n,1,o),[s,l]=rf(r,1,o);return i<=s?s<=a?nf.Overlap:nf.NoOverlap:i<=l?nf.Overlap:nf.NoOverlap}function af(e){return function(e){return e.replace(/\p{M}/gu,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class sf{constructor(e,t){this.term=t.normalize(e),this.matcher=t}matches(e){const t=this.matcher;return t.fieldValues(e).some((e=>t.matches(t.normalize(e),this.term)))}}class lf{constructor(e,t){this.operator=e,this.filters=t
|
|
579
|
+
}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}function cf(e){return{fieldValues:e,matches:(e,t)=>e.includes(t),normalize:af}}const uf={quote:cf((e=>[Yr(e)??Xr(e)??""])),cfi:{fieldValues:e=>[Qr(e)?.trim()??""],matches:(e,t)=>{const[n,r]=Zm(t);return ef(e,n,r)},normalize:e=>Qm(e.trim())},page:{fieldValues:e=>[Jr(e)?.trim()??""],matches:(e,t)=>of(e,t)===nf.Overlap,normalize:e=>e.trim()},since:{fieldValues:e=>[new Date(e.updated).valueOf()],matches:(e,t)=>(Date.now()-e)/1e3<=t,normalize:e=>e},tag:cf((e=>e.tags)),text:cf((e=>[e.text])),uri:cf((e=>[e.uri])),user:cf((e=>[e.user,e.user_info?.display_name??""]))};function df(e,t){const n=(e,t)=>new sf(t,uf[e]),r=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{let r;if("any"===e){const e=["quote","text","tag","user"];r=t.terms.map((t=>new lf("or",e.map((e=>n(e,t))))))}else r=t.terms.map((t=>n(e,t)));return new lf(t.operator,r)})),o=new lf("and",r)
|
|
580
|
+
;return e.filter((e=>o.matches(e)))}const hf=["cfi","quote","page","since","tag","text","uri","user"],pf=["group","quote","tag","text","uri","user"];function mf(e,t){const n=e.slice(0,e.indexOf(":"));if(!n)return[null,e];if(t.includes(n)){return[n,e.slice(n.length+1)]}return[null,e]}function ff(e){const t=e.slice(0,1),n=e.slice(-1);return'"'!==t&&"'"!==t||t!==n||(e=e.slice(1,e.length-1)),e}function gf(e,t){const n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);return n?n.map(ff).filter((e=>e.length>0)).map((e=>{const[n,r]=mf(e,t);return n?n+":"+ff(r):e})):[]}function vf(e){const t={},n=e=>"tag"===e?"tags":e,r=gf(e,pf);for(const e of r){let[r,o]=mf(e,pf);r||(r="any",o=e);const i=n(r);t[i]?t[i].push(o):t[i]=[o]}return t}function bf(e){return Br(e)?"orphan":qr(e)?"note":"annotation"}function yf(e){return Zi([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function _f(e){return Zi([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}function wf(e,t){
|
|
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
|
+
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
|
+
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.1749.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
|
+
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
|
-
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
|
|
588
|
-
var l,c=!n._scrollSettings,u=n._scrollSettings,d=Date.now(),h={passive:!0};function p(e){n._scrollSettings=null,n.parentElement&&n.parentElement._scrollSettings&&n.parentElement._scrollSettings.end(e),i.debug&&console.log("Scrolling ended with type",e,"for",n),s(e),l&&(n.removeEventListener("touchstart",l,h),n.removeEventListener("wheel",l,h))}u&&u.end(t);var m=i.maxSynchronousAlignments;return null==m&&(m=3),n._scrollSettings={startTime:d,endIterations:0,target:e,time:i.time,ease:i.ease,align:i.align,isWindow:i.isWindow||o,maxSynchronousAlignments:m,end:p,scrollAncestor:a},"cancellable"in i&&!i.cancellable||(l=p.bind(null,t),n.addEventListener("touchstart",l,h),n.addEventListener("wheel",l,h)),c&&r(n),l}(n,i,l,m[a+1],f)),null)}function f(e){--d||c&&c(e)}},
|
|
589
|
-
a&&u.current&&
|
|
590
|
-
}),Ve("li",{children:["To create a highlight (",Ve($n,{href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",underline:"always",children:"visible only to you"}),"), select text and then select the"," ",Ve(
|
|
591
|
-
}var
|
|
592
|
-
classes:Je("order-last","text-[16px]","text-grey-6 hover:text-grey-7 hover:bg-grey-3/50","touch:!min-h-0"),title:t,variant:"custom",size:"sm"}),Ve(Vn,{classes:"grow gap-x-1 -mb-[1px] z-2",children:e})]})}function
|
|
593
|
-
const n=
|
|
594
|
-
children:[Ve("div",{className:"border-b",children:[!t.commentsMode&&Ve(
|
|
595
|
-
this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._expectedCount=null,this._fetchedCount=0,this._results=[]}async _getPage(e,t,n=0){const r={limit:this._getPageSize(n),sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(r.search_after=t);try{const t=await this._searchFn(r);if(this._canceled)return;if(null===this._expectedCount&&(this._expectedCount=t.total,this.emit("resultCount",this._expectedCount)),this._maxResults&&t.total>this._maxResults)return this.emit("error",new
|
|
596
|
-
this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._expectedCount=null,this._fetchedCount=0,this._results=[],this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function
|
|
597
|
-
;e[t]=n.user.display}const a=Object.keys(e).map((t=>({display:t===r?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>r===e.value?-1:r===t.value?1:e.display.localeCompare(t.display))),a}),[t,r,o,i,n.user])}();return Ve(
|
|
598
|
-
function
|
|
599
|
-
;return((e.ctrlKey?
|
|
600
|
-
function
|
|
601
|
-
group:"Annotator"},{id:"activateRectResize",label:"Resize rectangle selection",description:"Change the rectangle selection size",group:"Annotator"},{id:"activatePoint",label:"Create pin selection",description:"Create annotation and move pin selection",group:"Annotator"}];function
|
|
602
|
-
const o=
|
|
603
|
-
const n=
|
|
604
|
-
className:Je("container flex flex-row-reverse relative","right-[4rem]"),children:Ve(
|
|
605
|
-
currentPage:p,isLoading:s,onChangePage:y,threads:c.children})]})]})}),["loadAnnotationsService","streamer"]);function
|
|
606
|
-
children:"Notification preferences saved"},r)}),r>0&&Ve(
|
|
607
|
-
function
|
|
608
|
-
const n=
|
|
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){
|
|
588
|
+
var l,c=!n._scrollSettings,u=n._scrollSettings,d=Date.now(),h={passive:!0};function p(e){n._scrollSettings=null,n.parentElement&&n.parentElement._scrollSettings&&n.parentElement._scrollSettings.end(e),i.debug&&console.log("Scrolling ended with type",e,"for",n),s(e),l&&(n.removeEventListener("touchstart",l,h),n.removeEventListener("wheel",l,h))}u&&u.end(t);var m=i.maxSynchronousAlignments;return null==m&&(m=3),n._scrollSettings={startTime:d,endIterations:0,target:e,time:i.time,ease:i.ease,align:i.align,isWindow:i.isWindow||o,maxSynchronousAlignments:m,end:p,scrollAncestor:a},"cancellable"in i&&!i.cancellable||(l=p.bind(null,t),n.addEventListener("touchstart",l,h),n.addEventListener("wheel",l,h)),c&&r(n),l}(n,i,l,m[a+1],f)),null)}function f(e){--d||c&&c(e)}},Tf}(),If=Ke(Nf);function Of({children:e,panelName:t,label:n,onActiveChanged:r,initialFocus:o}){const i=Fi(),a=i.isSidebarPanelOpen(t),[s,l]=ie(!1),c=a||s,u=ce(null),d=ce(a),h=ce(null),p=ce(null);se((()=>{d.current!==a&&(d.current=a,
|
|
589
|
+
a&&u.current&&If(u.current),r?.(a))}),[a,r]);const m=de((e=>{if(l("in"===e),"out"===e)return void p.current?.focus();const t=o?.current,n=t&&!t.disabled?t:h.current;p.current=document.activeElement,n?.focus()}),[o]),f=de((()=>i.toggleSidebarPanel(t,!1)),[i,t]);return Ve(nt.Provider,{value:{onClose:f},children:Ve(Wn,{direction:a?"in":"out",onTransitionEnd:m,elementRef:u,children:c&&Ve("section",{"aria-label":n,className:"mb-4 focus-visible-ring rounded-lg",ref:h,tabIndex:-1,children:e})})})}function zf({commandName:e,icon:t}){return Ve("span",{className:"whitespace-nowrap","data-testid":"instruction",children:[Ve(t,{className:Je("w-em h-em","mx-1 -mt-1","text-color-text-light inline"),"aria-hidden":!0}),Ve("em",{"data-testid":"command-name",children:e})]})}var Lf=er((function({settings:e}){const t=!Yn(e);return Ve("ol",{className:"list-decimal pl-10 space-y-2",children:[Ve("li",{children:["To create an annotation, select text and then select the"," ",Ve(zf,{icon:lt,commandName:"Annotate"})," button."]
|
|
590
|
+
}),Ve("li",{children:["To create a highlight (",Ve($n,{href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",underline:"always",children:"visible only to you"}),"), select text and then select the"," ",Ve(zf,{icon:jt,commandName:"Highlight"})," button."]}),t&&Ve("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"," ",Ve($n,{href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",underline:"always",children:"join link"}),"."]}),Ve("li",{children:["To reply to an annotation, select the"," ",Ve(zf,{icon:rn,commandName:"Reply"})," button."]})]})}),["settings"]);async function Pf(e,t=navigator){await t.clipboard.writeText(e)}function Rf({label:e,children:t,classes:n}){return Ve(y,{children:[Ve("dt",{className:"col-span-1 sm:text-right font-medium",children:e}),Ve("dd",{className:Je("col-span-1 sm:col-span-3 text-color-text-light break-words",n),children:t})]})
|
|
591
|
+
}var Df=er((function({toastMessenger:e,versionData:t}){return Ve("div",{className:"space-y-4",children:[Ve("dl",{className:"grid grid-cols-1 sm:grid-cols-4 sm:gap-x-2",children:[Ve(Rf,{label:"Version",children:t.version}),Ve(Rf,{label:"User Agent",children:t.userAgent}),Ve(Rf,{classes:Je("break-all"),label:"URL",children:t.urls}),Ve(Rf,{label:"Fingerprint",children:t.fingerprint}),t.segment&&Ve(Rf,{label:"Segment",children:t.segment}),Ve(Rf,{label:"Account",children:t.account}),Ve(Rf,{label:"Date",children:t.timestamp})]}),Ve("div",{className:"flex items-center justify-center",children:Ve(dn,{onClick:async()=>{try{await Pf(t.asFormattedString()),e.success("Copied version info to clipboard")}catch{e.error("Unable to copy version info")}},icon:_t,children:"Copy version details"})})]})}),["toastMessenger"]);function jf({children:e,closeTitle:t}){return Ve("div",{"data-testid":"tab-header",className:"flex items-center",children:[Ve(fn,{
|
|
592
|
+
classes:Je("order-last","text-[16px]","text-grey-6 hover:text-grey-7 hover:bg-grey-3/50","touch:!min-h-0"),title:t,variant:"custom",size:"sm"}),Ve(Vn,{classes:"grow gap-x-1 -mb-[1px] z-2",children:e})]})}function Hf({children:e,active:t,title:n,...r}){return Ve("div",{role:"tabpanel",...r,className:Je("p-3 focus-visible-ring ring-inset",{hidden:!t}),hidden:!t,children:[n&&Ve(gn,{children:n}),Ve("div",{className:"space-y-3 pt-2",children:e})]})}function Ff({linkText:e,url:t}){return Ve("div",{className:"flex-1 flex items-center justify-center border-r last-of-type:border-r-0 text-md font-medium",children:Ve($n,{variant:"text-light",href:t,target:"_blank",underline:"none",children:Ve("div",{className:"flex items-center gap-x-2",children:[Ve("span",{children:e})," ",Ve(Ct,{className:"w-3 h-3"})]})})})}var $f=er((function({session:e,settings:t}){
|
|
593
|
+
const n=Fi(),r=n.frames(),o=n.mainFrame(),i=n.profile(),a=i.user_info?.display_name??Lr(i.userid),s=pe(),l=pe(),c=pe(),u=pe(),d=!!n.profile().preferences.show_sidebar_tutorial,[h,p]=ie(t.commentsMode?"versionInfo":"tutorial"),m=ue((()=>{const e=[...r].sort(((e,t)=>e===o?-1:t===o?1:0));return new Mf({userid:i.userid,displayName:a},e)}),[i,a,r,o]),f=`https://web.hypothes.is/get-help/?sys_info=${m.asEncodedURLString()}`;return Ve(Of,{label:"Help panel",panelName:"help",onActiveChanged:de((t=>{!t&&d&&e.dismissSidebarTutorial()}),[e,d]),children:[Ve(jf,{closeTitle:"Close help panel",children:[!t.commentsMode&&Ve(Gn,{id:s,"aria-controls":l,variant:"tab",textContent:"Help",selected:"tutorial"===h,onClick:()=>p("tutorial"),"data-testid":"tutorial-tab",children:"Help"}),Ve(Gn,{id:c,"aria-controls":u,variant:"tab",textContent:"Version",selected:"versionInfo"===h,onClick:()=>p("versionInfo"),"data-testid":"version-info-tab",children:"Version"})]}),Ve(it,{classes:Je({"rounded-tl-none":"tutorial"===h||t.commentsMode}),
|
|
594
|
+
children:[Ve("div",{className:"border-b",children:[!t.commentsMode&&Ve(Hf,{id:l,"aria-labelledby":s,active:"tutorial"===h,title:"Getting started","data-testid":"tutorial-panel",children:Ve(Lf,{})}),Ve(Hf,{id:u,"aria-labelledby":c,active:"versionInfo"===h,title:"Version details",children:Ve(Df,{versionData:m})})]}),Ve("div",{className:"flex items-center p-3",children:[Ve(Ff,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),Ve(Ff,{linkText:"New support ticket",url:f})]})]})]})}),["session","settings"]);class Bf{#e=[];destroy(){this.#e=[]}on(e,t){this.#e.push({name:e,callback:t})}off(e,t){this.#e=this.#e.filter((n=>!(n.name===e&&n.callback===t)))}emit(e,...t){for(const n of this.#e){if(n.name!==e)continue;(0,n.callback)(...t)}}}class qf extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function Uf(e){return 0===e?50:200}class Gf extends Bf{constructor(e,{getPageSize:t=Uf,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),
|
|
595
|
+
this._searchFn=e,this._getPageSize=t,this._separateReplies=n,this._incremental=r,this._maxResults=o,this._sortBy=i,this._sortOrder=a,this._canceled=!1,this._expectedCount=null,this._fetchedCount=0,this._results=[]}async _getPage(e,t,n=0){const r={limit:this._getPageSize(n),sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(r.search_after=t);try{const t=await this._searchFn(r);if(this._canceled)return;if(null===this._expectedCount&&(this._expectedCount=t.total,this.emit("resultCount",this._expectedCount)),this._maxResults&&t.total>this._maxResults)return this.emit("error",new qf(this._maxResults)),void this.emit("end");const o=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",o):this._results=this._results.concat(o),this._fetchedCount+=o.length;const i=this._fetchedCount<this._expectedCount||this._expectedCount>1e3;let a=null;o.length>0&&i&&(a=o[o.length-1][this._sortBy]),a?this._getPage(e,a,n+1):(this._incremental||this.emit("results",this._results),
|
|
596
|
+
this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._expectedCount=null,this._fetchedCount=0,this._results=[],this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function Vf({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=o??e,l=Ve("span",{className:Je("shrink-0 flex items-center gap-x-2","text-color-text font-bold text-md"),children:[t&&Ve(t,{className:"w-4 h-4"}),s.display]});return Ve(vm,{label:l,title:i,contentClass:Je("max-h-[min(60vh,504px)] overflow-y-auto"),children:a.map((e=>Ve(ym,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function Wf(){const e=Fi(),t=e.getFilter("user"),n=function(){const e=Fi(),t=e.allAnnotations(),n=e.getFocusFilters(),r=Lr(e.profile().userid),o=e.defaultAuthority(),i=e.isFeatureEnabled("client_display_names");return ue((()=>{const e={};if(t.forEach((t=>{const n=Lr(t.user);e[n]=Qi(t,o,i)})),n.user){const t=Lr(n.user.value)||n.user.value
|
|
597
|
+
;e[t]=n.user.display}const a=Object.keys(e).map((t=>({display:t===r?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>r===e.value?-1:r===t.value?1:e.display.localeCompare(t.display))),a}),[t,r,o,i,n.user])}();return Ve(Vf,{defaultOption:{value:"",display:"Everybody"},icon:en,onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function Kf({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const{rootThread:o}=Af(),i=n?r:Xi(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return Ve("div",{className:"flex gap-x-1 leading-none",children:[n&&Ve(Rn,{size:"sm"}),!n&&Ve("h2",{className:"font-bold",children:[!a&&Ve("span",{children:"No results"}),a&&t&&Ve("span",{children:[l," ",1===l?"result":"results"]}),a&&!t&&Ve("span",{children:[c," ",1===c?"thread":"threads"]})]}),s&&Ve("h3",{className:"italic font-normal",children:["(and ",e," more)"]}),!t&&a&&Ve("h3",{className:"italic font-normal",children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}
|
|
598
|
+
function Yf({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=ue((()=>{const t=r.filter((e=>Xi(e)>0)),n=(e-1)*o,i=n+o,a=Math.ceil(t.length/o);return{paginatedThreads:t.slice(n,i),totalPages:a}}),[r,e,o]);return Ve(y,{children:[Ve(Fm,{threads:i}),!t&&Ve(Un,{currentPage:e,onChangePage:n,totalPages:a})]})}function Xf(e,t,n){return 1===e?t:n}const Zf={alt:1,ctrl:2,meta:4,shift:8};function Qf(e,t,{rootElement:n=document.documentElement??void 0,ignoreWhenEditable:r=!1}={}){const o=n=>{var o;r&&(o=n.target,o instanceof HTMLElement&&(o.isContentEditable||["INPUT","TEXTAREA"].includes(o.tagName)))||function(e,t){if(!(e instanceof KeyboardEvent))return!1;const n=t.split("+").map((e=>e.toLowerCase()));let r=0,o=null;for(const e of n){const t=Zf[e];if(t)r|=t;else{if(null!==o)throw new Error("Multiple non-modifier keys specified");o=e}}if(!o)throw new Error(`Invalid shortcut: ${t}`)
|
|
599
|
+
;return((e.ctrlKey?Zf.ctrl:0)|(e.metaKey?Zf.meta:0)|(e.altKey?Zf.alt:0)|(e.shiftKey?Zf.shift:0))===r&&e.key.toLowerCase()===o}(n,e)&&t(n)};return n?(n.addEventListener("keydown",o),()=>n.removeEventListener("keydown",o)):()=>{}}function Jf(e,t,{rootElement:n,ignoreWhenEditable:r}={}){se((()=>{if(e)return Qf(e,t,{rootElement:n,ignoreWhenEditable:r})}),[e,t,n,r])}const eg={applyUpdates:"l",openSearch:"/",annotateSelection:"a",highlightSelection:"h",toggleHighlights:"ctrl+shift+h",showSelection:"s",hideAdder:"Escape",activateRectMove:"ctrl+shift+y",activateRectResize:"ctrl+shift+j",activatePoint:"ctrl+shift+u"},tg=["activateRectMove","activateRectResize","activatePoint"],ng=[];let rg={...eg};const og=new Set;function ig(e){const t={};return Object.keys(eg).forEach((n=>{const r=e[n];"string"!=typeof r&&null!==r||(t[n]=r)})),t}function ag(){const e={...rg};for(const t of og)t(e)}function sg(){return{...rg}}function lg(e){rg={...eg,...ig(e)},ag()}function cg(e){return og.add(e),e({...rg}),()=>{og.delete(e)}}
|
|
600
|
+
function ug(){const[e,t]=ie((()=>sg()));return se((()=>cg(t)),[]),e}const dg=[{id:"applyUpdates",label:"Load new updates",description:"Loads new/updated annotations in the Sidebar.",group:"Sidebar"},{id:"openSearch",label:"Search",description:"Opens the Search filter.",group:"Search"},{id:"annotateSelection",label:"Create annotation",description:"Create annotation at selected text.",group:"Annotator"},{id:"highlightSelection",label:"Create Highlight",description:"Create Highlight at selected text.",group:"Annotator"},{id:"toggleHighlights",label:"Show/hide highlights",description:"Turns the highlights over selected text on and off.",group:"Annotator"},{id:"showSelection",label:"Show anchored annotations",description:"Moves focus to the annotation Card in the Sidebar.",group:"Annotator"},{id:"hideAdder",label:"Close the Adder",description:"Closes the Adder when it is open.",group:"Annotator"},{id:"activateRectMove",label:"Create rectangle selection",description:"Create annotation and move rectangle selection",
|
|
601
|
+
group:"Annotator"},{id:"activateRectResize",label:"Resize rectangle selection",description:"Change the rectangle selection size",group:"Annotator"},{id:"activatePoint",label:"Create pin selection",description:"Create annotation and move pin selection",group:"Annotator"}];function hg({hidden:e,children:t}){return Ve("span",{className:Je("group-hover:inline group-focus:inline",{hidden:e}),children:t})}function pg({type:e,collapsed:t,count:n}){const r="updates"===e?"update":"mention",o="updates"===e?"updates":"mentions",i="updates"===e?wt:Wt;return Ve("div",{className:Je("flex gap-1.5 items-center px-2 py-1","border-l first:border-l-0 border-white/60"),children:[Ve(i,{className:"w-em h-em"}),Ve("div",{className:"flex gap-1",children:[Ve("span",{className:"font-bold",children:n}),Ve(hg,{hidden:t,children:Xf(n,r,o)})]})]})}var mg=er((function({streamer:e,analytics:t,setTimeout_:n=setTimeout,clearTimeout_:r=clearTimeout}){
|
|
602
|
+
const o=Fi(),i=o.pendingUpdateCount(),a=o.pendingMentionCount(),s=o.isFeatureEnabled("at_mentions"),l=o.hasPendingUpdatesOrDeletions(),c=ug(),u=c.applyUpdates??"l",d=de((()=>{e.applyPendingUpdates(),t.trackEvent("client.realtime.apply_updates")}),[t,e]),[h,p]=ie(!1),m=ce(null);return Jf(c.applyUpdates,(()=>l&&d()),{ignoreWhenEditable:!0}),se((()=>(l?m.current=n((()=>{p(!0),m.current=null}),5e3):p(!1),()=>m.current&&r(m.current))),[r,l,n]),l?Ve("div",{role:"status",className:"absolute right-0 animate-updates-notification-slide-in",children:Ve(dn,{onClick:d,unstyled:!0,classes:Je("flex items-center","rounded shadow-lg bg-gray-900 text-white","group focus-visible-ring"),"data-testid":"notification","data-collapsed":h,children:[Ve(pg,{type:"updates",collapsed:h,count:i}),s&&a>0&&Ve(pg,{type:"mentions",collapsed:h,count:a}),Ve("span",{className:"sr-only",children:["load them by pressing ",u]})]})}):null}),["streamer","analytics"]);var fg=er((function({loadAnnotationsService:e,streamer:t}){
|
|
603
|
+
const n=Fi(),r=n.getFilterValues(),o=n.focusedGroup(),i=n.forcedVisibleThreads().length,a=n.hasAppliedFilter(),s=n.isLoading(),l=n.annotationResultCount(),{rootThread:c}=Af(),u=o?.name??"…",d=o?.id||n.directLinkedGroupId(),h=ce(1),[p,m]=ie(1),[f,g]=ie(!1),v=e=>{e instanceof qf&&g(!0)},b=n.hasFetchedProfile();se((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),se((()=>{n.setSortKey("newest"),d&&e.load({groupId:d,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:v,streamFilterBy:"group"})}),[e,d,n]);const y=e=>{m(e)};se((()=>{y(1)}),[r,o]);const _=ce(null);return le((()=>{p!==h.current&&(_.current&&If(_.current),h.current=p)}),[p]),Ve("div",{className:"grid gap-2 lg:grid-cols-2","data-testid":"notebook-container",children:[Ve("header",{className:"leading-none lg:col-span-2",ref:_,children:Ve("h1",{className:"text-xl font-bold","data-testid":"notebook-group-name",children:u})}),Ve("div",{className:"absolute w-full z-5 left-0 lg:top-8 top-5",children:Ve("div",{
|
|
604
|
+
className:Je("container flex flex-row-reverse relative","right-[4rem]"),children:Ve(mg,{})})}),Ve("div",{className:"justify-self-start",children:Ve(Wf,{})}),Ve("div",{className:"flex items-center lg:justify-self-end text-md font-medium",children:Ve(Kf,{forcedVisibleCount:i,isFiltered:a,isLoading:s,resultCount:l??0})}),Ve("div",{className:"lg:col-span-2",children:[f&&Ve("div",{className:"py-4","data-testid":"notebook-messages",children:Ve(bn,{title:"Too many results to show",children:[Ve("p",{children:["This preview of the Notebook can show"," ",Ve("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",l," to show here)."]}),Ve("p",{children:[Ve($n,{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",underline:"always",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})]})}),Ve(Yf,{
|
|
605
|
+
currentPage:p,isLoading:s,onChangePage:y,threads:c.children})]})]})}),["loadAnnotationsService","streamer"]);function gg({classes:e,children:t,onClose:n=(()=>{}),...r}){return Ve("div",{className:Je("flex items-center gap-x-1 py-1 px-2 rounded","bg-green-success/10 animate-pulse-fade-out",e),onAnimationEnd:n,...r,children:[Ve(gt,{className:"text-green-success w-em h-em p-[0.125em]"}),Ve("div",{className:"text-sm",children:t})]})}function vg(){const e=Fi(),[t,n]=ie(!1),[r,o]=ie(0);if(se((()=>{let e;return t&&(e=setTimeout((()=>{n(!1),o((e=>e+1))}),1e3)),()=>{clearTimeout(e)}}),[t]),!e.isFeatureEnabled("client_user_profile"))return null;const i=r>0&&!t;return Ve(it,{"data-testid":"profile-container",classes:"overflow-hidden",children:[Ve("div",{className:Je("h-12","px-3 border-b flex items-center"),children:[Ve("div",{className:"grow",children:Ve("h1",{className:"text-xl text-slate-7 font-normal",children:"Notifications"})}),Ve("ul",{className:"sr-only","aria-live":"polite",children:i&&Ve("li",{
|
|
606
|
+
children:"Notification preferences saved"},r)}),r>0&&Ve(gg,{onClose:()=>o(0),children:"Saved"},r)]}),Ve(ot,{children:Ve(st,{size:"lg",children:Ve(kn,{defaultChecked:!0,disabled:t,onChange:()=>n(!0),checkedIcon:t?cn:void 0,icon:t?cn:void 0,children:"Email me a daily summary of activity in my courses"})})})]})}function bg({annotations:e,getDisplayName:t,excludeReplies:n=!1}){const r=new Map;for(const o of e){if(n&&Rr(o))continue;let e=r.get(o.user);e||(e={userid:o.user,displayName:t(o),annotations:[]},r.set(o.user,e)),e.annotations.push(o)}const o=[...r.values()];return o.sort(((e,t)=>e.displayName.localeCompare(t.displayName))),o}function yg(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`}function _g({documentMetadata:e,groupName:t,date:n=new Date}){const r=[yg(n)];return e?.title?r.push(function(e,t){const n=Array.from(e);return n.length<=t?e:n.slice(0,t).join("")}(e.title,50)):r.push("Hypothesis"),t&&r.push(t.replace(/ /g,"-")),r.join("-")}
|
|
607
|
+
function wg(){return Ve("div",{className:"flex flex-row items-center justify-center","data-testid":"loading-spinner",children:Ve(Rn,{size:"md"})})}function xg({userAnnotations:e}){return Ve("div",{className:"flex gap-x-2",children:[e.displayName,Ve("div",{className:"rounded px-1 bg-grey-7 text-white",children:e.annotations.length})]})}const kg=[{value:"json",title:"JSON",description:"For import into another Hypothesis group or document"},{value:"txt",title:"Plain text (TXT)",shortTitle:"Text",description:"For import into word processors as plain text"},{value:"html",title:"Rich text (HTML)",shortTitle:"HTML",description:"For import into word processors as rich text"},{value:"csv",title:"Table (CSV)",shortTitle:"CSV",description:"For import into a spreadsheet"}];var Sg=er((function({annotationsExporter:e,toastMessenger:t}){
|
|
608
|
+
const n=Fi(),r=n.focusedGroup(),o=r&&!n.isLoading(),i=n.defaultContentFrame(),a=n.savedAnnotations(),s=n.defaultAuthority(),l=n.isFeatureEnabled("client_display_names"),c=de((e=>Qi(e,s,l)),[s,l]),u=ue((()=>bg({annotations:a,getDisplayName:c})),[a,c]),d=n.profile(),h=d.userid,p=ue((()=>({annotations:a,displayName:"All annotations"})),[a]),[m,f]=ie(h),g=ue((()=>u.find((e=>e.userid===m))??p),[p,m,u]),[v,b]=ie(kg[0]),_=pe(),w=pe(),x=n.countDrafts(),k=ue((()=>_g({documentMetadata:i?.metadata,groupName:r?.name})),[i,r]),[S,A]=ie(),T=de(((t,n)=>{const o=g?.annotations??a;switch(t){case"json":{const t=e.buildJSONExportContent(o,{profile:d});return JSON.stringify(t,null,2)}case"txt":return e.buildTextExportContent(o,{groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});case"csv":return e.buildCSVExportContent(o,{separator:"file"===n?",":"\t",groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l});case"html":return e.buildHTMLExportContent(o,{groupName:r?.name,defaultAuthority:s,displayNamesEnabled:l})
|
|
609
609
|
;default:throw new Error(`Invalid format: ${t}`)}}),[e,s,l,a,r?.name,d,g?.annotations]),E=de((e=>{e.preventDefault();try{const e=v.value,t=`${S??k}.${e}`,n=T(e,"file"),r=function(e){return{json:"application/json",txt:"text/plain",csv:"text/csv",html:"text/html"}[e]}(e);!function(e,t,n,r=document){const o=new Blob([e],{type:t}),i=URL.createObjectURL(o),a=r.createElement("a");a.setAttribute("href",i),a.setAttribute("download",n),a.style.visibility="hidden",r.body.appendChild(a),a.click(),r.body.removeChild(a),URL.revokeObjectURL(i)}(n,r,t)}catch(e){t.error(`Exporting annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,S,k,v.value,t]),C=de((async()=>{const e=v.value,n=T(e,"clipboard");try{"html"===e?await async function(e,t=navigator,n=document){const r=["text/html","text/plain"];if(t.clipboard.write){const n=r.reduce(((t,n)=>(t[n]=new Blob([e],{type:n}),t)),{});await t.clipboard.write([new ClipboardItem(n)])}else{const t=t=>{r.forEach((n=>t.clipboardData?.setData(n,e))),t.preventDefault()}
|
|
610
|
-
;n.addEventListener("copy",t);try{n.execCommand("copy")}finally{n.removeEventListener("copy",t)}}}(n):await
|
|
611
|
-
value:e.userid,children:Ve(
|
|
612
|
-
children:["You have ",x," unsaved"," ",
|
|
613
|
-
;return Ve("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Ve("svg",{viewBox:`0 0 ${e} ${e}`,children:Ve("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",transitionProperty:"stroke-dashoffset"}})})})}function
|
|
614
|
-
className:"max-w-full pr-10 truncate","data-testid":"filename-container",children:o??"Select a file"}),Ve("div",{className:"absolute right-0 h-full p-2 border-l bg-grey-2",children:Ve(Mt,{})})]})}var
|
|
615
|
-
;const _=Boolean(s.focusedGroup()&&s.defaultContentFrame()&&s.hasFetchedAnnotations()&&!s.isFetchingAnnotations()&&g),w=t&&!r&&!i,x=s.importsPending(),k=s.importsTotal(),S=k-x,A=w||x>0,T=x>0?Math.round(S/k*100):null;return Ve(y,{children:[Ve("p",{className:"text-color-text-light mb-3",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations/",target:"_blank",children:"Learn more"})," ","about importing annotations."]}),Ve("label",{htmlFor:v,className:"font-medium",children:"Select Hypothesis export file:"}),Ve(
|
|
616
|
-
"data-testid":"error-info",children:[Ve("b",{children:"Unable to find annotations to import:"})," ",i]}),Ve(at,{children:[null!==T&&Ve("span",{"data-testid":"progress-text",className:"text-grey-6",children:[T,"% complete"]}),Ve(dn,{"data-testid":"import-button",disabled:!_||A,onClick:g,variant:"primary",children:[null!==T&&Ve(
|
|
617
|
-
children:"Use this link to share these annotations with other group members:"}):Ve("p",{children:"Use this link to share these annotations with anyone:"})}),Ve("div",{children:Ve(pn,{children:[Ve(An,{"aria-label":"Use this URL to share these annotations",type:"text",value:i,readOnly:!0}),Ve(mn,{icon:_t,onClick:l,title:"Copy share link",variant:"dark"})]})}),Ve("p",{"data-testid":"sharing-details",children:["private"===r.type?Ve("span",{children:["Annotations in the private group ",Ve("em",{children:r.name})," ","are only visible to group members."]}):Ve("span",{children:["Anyone using this link may view the annotations in the group"," ",Ve("em",{children:r.name}),"."]})," ",Ve("span",{children:["Private (",Ve(Gt,{className:"inline w-[14px] h-[14px] -mt-0.5"})," ",Ve("em",{children:"Only Me"}),") annotations are only visible to you."]})]})]}):Ve("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})}):Ve(
|
|
618
|
-
;function
|
|
619
|
-
title:`Export from ${n}`,children:Ve(
|
|
620
|
-
label:"Login panel",panelName:"loginPrompt",children:Ve(it,{children:[Ve(vn,{children:[Ve(on,{className:"w-em h-em"}),Ve(gn,{children:"Login needed"})]}),Ve(st,{children:[Ve("p",{"data-testid":"main-text",children:["Please log in to"," ",n?.commentsMode?"write a comment":"create annotations or highlights","."]}),Ve(at,{children:[Ve(dn,{title:"Sign up",onClick:t,children:"Sign up"}),Ve(dn,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})]})})}),["settings"]);const
|
|
621
|
-
var
|
|
622
|
-
label:n.commentsMode?"Comments":"Page notes",name:"note",onSelect:()=>d("note"),children:n.commentsMode?"Comments":"Page Notes"}),c>0&&Ve(
|
|
623
|
-
children:"There are no annotations in this group."}),Ve("p",{children:["Create one by selecting some text and clicking the"," ",Ve(lt,{className:"w-em h-em inline m-0.5 -mt-0.5",title:"Annotate"})," ","button."]})]})}),Ve(
|
|
624
|
-
const t=
|
|
625
|
-
}),testId:"page-focus-toggle"}),i.cfi&&Ve(
|
|
626
|
-
i.selectTab(d)):u&&i.selectTab(d)}),[d,e,u,i]);const x=i.hasFetchedProfile();return se((()=>{x&&(p||l)&&o.connect({applyUpdatesImmediately:!1})}),[x,l,p,o]),Ve("div",{className:"relative",children:[Ve("h2",{className:"sr-only",children:"Annotations"}),Ve("div",{className:Je("fixed z-10","right-[9px] top-12"),children:Ve(
|
|
627
|
-
t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]);const{rootThread:i}=
|
|
628
|
-
e===
|
|
629
|
-
});return Ve(
|
|
630
|
-
className:Je("p-2 pl-9 bg-grey-1 hyphens-none"),"data-testid":"unselectable-group-note",children:"This group is restricted to specific URLs."})]})})}),["groups","toastMessenger"]);function
|
|
631
|
-
const t=
|
|
632
|
-
;function
|
|
633
|
-
return Ve("div",{...r,className:Je("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Ve("div",{className:Je("relative w-full h-full",n),children:t})})}function
|
|
610
|
+
;n.addEventListener("copy",t);try{n.execCommand("copy")}finally{n.removeEventListener("copy",t)}}}(n):await Pf(n),t.success("Annotations copied")}catch(e){t.error(`Copying annotations failed: ${e.message}`,{autoDismiss:!1})}}),[T,v.value,t]);return o?Ve("form",{className:"space-y-3",onSubmit:E,"data-testid":"export-form",children:[a.length>0?Ve(y,{children:[Ve("p",{className:"text-color-text-light",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations-in-the-hypothesis-web-app/",target:"_blank",children:"Learn more"})," ","about copying and exporting annotations."]}),Ve("div",{className:"flex flex-col gap-y-3",children:[Ve("label",{htmlFor:w,className:"font-medium",children:["Select which user","'","s annotations to export:"]}),Ve(Pn,{value:m,onChange:f,buttonId:w,buttonContent:Ve(xg,{userAnnotations:g}),"data-testid":"user-select",children:[Ve(Pn.Option,{value:void 0,children:Ve(xg,{userAnnotations:p})}),u.map((e=>Ve(Pn.Option,{
|
|
611
|
+
value:e.userid,children:Ve(xg,{userAnnotations:e})},e.userid)))]}),Ve("label",{"data-testid":"export-count",htmlFor:_,className:"font-medium",children:"Name of export file:"}),Ve("div",{className:"flex",children:[Ve(An,{classes:"grow","data-testid":"export-filename",id:_,defaultValue:k,value:S,onChange:e=>A(e.target.value),required:!0,maxLength:250}),Ve("div",{className:"grow-0 ml-2 min-w-[5rem]",children:Ve(Pn,{"aria-label":"Export format",value:v,onChange:b,buttonContent:v.shortTitle??v.title,"data-testid":"export-format-select",alignListbox:"right",listboxOverflow:"wrap",children:kg.map((e=>Ve(Pn.Option,{value:e,children:Ve("div",{className:"flex-col gap-y-2",children:[Ve("div",{className:"font-bold","data-testid":"format-name",children:e.title}),Ve("div",{"data-testid":"format-description",children:e.description})]})},e.value)))})})]})]})]}):Ve("p",{"data-testid":"no-annotations-message",children:"There are no annotations available for export."}),x>0&&Ve("p",{"data-testid":"drafts-message",
|
|
612
|
+
children:["You have ",x," unsaved"," ",Xf(x,"draft","drafts"),a.length>0&&Ve(y,{children:" that will not be included"}),"."]}),Ve(at,{children:[Ve(dn,{"data-testid":"copy-button",icon:_t,onClick:C,disabled:0===a.length,children:"Copy to clipboard"}),Ve(dn,{"data-testid":"export-button",variant:"primary",disabled:0===a.length,type:"submit",children:"Export"})]})]}):Ve(wg,{})}),["annotationsExporter","toastMessenger"]);function Ag(){let e,t;return{promise:new Promise(((n,r)=>{e=n,t=r})),resolve:e,reject:t}}async function Tg(e){let t;try{t=await function(e,t=new FileReader){const{promise:n,resolve:r,reject:o}=Ag();return t.addEventListener("loadend",(e=>{try{const t=e.target?.result?.toString()??"",n=JSON.parse(t);r(n)}catch(e){o(e)}})),t.readAsText(e),n}(e)}catch{throw new Error("Not a valid JSON file")}if(null===(n=t)||"object"!=typeof n||!Array.isArray(t.annotations))throw new Error("Not a valid Hypothesis JSON file");var n;return t.annotations}function Eg({size:e,value:t}){const n=e-4,r=Math.PI*n
|
|
613
|
+
;return Ve("span",{className:"text-grey-3",role:"progressbar","aria-valuenow":t,style:{width:`${e}px`,height:`${e}px`,transform:"rotate(-90deg)"},children:Ve("svg",{viewBox:`0 0 ${e} ${e}`,children:Ve("circle",{cx:e/2,cy:e/2,r:n/2,fill:"none",stroke:"currentColor","stroke-width":2,style:{strokeDasharray:r,strokeDashoffset:r-r*(t/100)+"px",transitionDuration:"300ms",transitionProperty:"stroke-dashoffset"}})})})}function Cg({onFileSelected:e,disabled:t,id:n}){const r=ce(null),[o,i]=ie(null);return Ve(dn,{variant:"custom",classes:Je("w-full relative overflow-hidden border rounded","bg-grey-0 hover:bg-grey-0"),title:o?`${o}, Select a file`:"Select a file",onClick:()=>r.current?.click(),disabled:t,"data-testid":"file-input-proxy-button",children:[Ve("input",{ref:r,accept:".json",id:n,type:"file",disabled:t,className:"invisible absolute w-0 h-0","aria-hidden":!0,"data-testid":"file-input",onChange:t=>{const n=t.target.files;i(n?.[0]?.name??null),null!==n&&n.length>0&&e(n[0])}}),Ve("div",{
|
|
614
|
+
className:"max-w-full pr-10 truncate","data-testid":"filename-container",children:o??"Select a file"}),Ve("div",{className:"absolute right-0 h-full p-2 border-l bg-grey-2",children:Ve(Mt,{})})]})}var Mg=er((function({importAnnotationsService:e}){const[t,n]=ie(null),[r,o]=ie(null),[i,a]=ie(null),s=Fi(),l=s.profile().userid,c=s.defaultAuthority(),u=s.isFeatureEnabled("client_display_names"),d=de((e=>Qi(e,c,u)),[c,u]),h=ue((()=>r?bg({annotations:r,getDisplayName:d,excludeReplies:!0}):null),[r,d]),[p,m]=ie(null),f=ue((()=>h?.find((e=>e.userid===p))??null),[p,h]);let g;se((()=>{l&&t&&(o(null),a(null),m(null),Tg(t).then((e=>{o(e);const t=e.some((e=>e.user===l));m(t?l:null)})).catch((e=>{a(e.message)})))}),[l,t]),f&&(g=async()=>{e.import(f.annotations)});const v=pe(),b=pe();if(!l)return Ve("p",{"data-testid":"log-in-message",children:"You must log in to import annotations."})
|
|
615
|
+
;const _=Boolean(s.focusedGroup()&&s.defaultContentFrame()&&s.hasFetchedAnnotations()&&!s.isFetchingAnnotations()&&g),w=t&&!r&&!i,x=s.importsPending(),k=s.importsTotal(),S=k-x,A=w||x>0,T=x>0?Math.round(S/k*100):null;return Ve(y,{children:[Ve("p",{className:"text-color-text-light mb-3",children:[Ve($n,{variant:"text-light",underline:"always",href:"https://web.hypothes.is/help/exporting-and-importing-annotations/",target:"_blank",children:"Learn more"})," ","about importing annotations."]}),Ve("label",{htmlFor:v,className:"font-medium",children:"Select Hypothesis export file:"}),Ve(Cg,{onFileSelected:n,disabled:A,id:v}),h&&Ve(y,{children:[Ve("label",{htmlFor:b,className:"block font-medium",children:"Select which user's annotations to import:"}),Ve(Pn,{value:f,onChange:e=>m(e?.userid??null),buttonId:b,buttonContent:f?Ve(xg,{userAnnotations:f}):Ve("span",{className:"text-grey-6",children:"Select a user..."}),children:h.map((e=>Ve(Pn.Option,{value:e,children:Ve(xg,{userAnnotations:e})},e.userid)))})]}),i&&Ve("p",{
|
|
616
|
+
"data-testid":"error-info",children:[Ve("b",{children:"Unable to find annotations to import:"})," ",i]}),Ve(at,{children:[null!==T&&Ve("span",{"data-testid":"progress-text",className:"text-grey-6",children:[T,"% complete"]}),Ve(dn,{"data-testid":"import-button",disabled:!_||A,onClick:g,variant:"primary",children:[null!==T&&Ve(Eg,{size:22,value:T}),"Import"]})]})]})}),["importAnnotationsService"]);var Ng=er((function({toastMessenger:e}){const t=Fi(),n=t.mainFrame(),r=t.focusedGroup(),o=r&&n,i=o&&(a=n.uri,s=r.id,/^http(s?):/i.test(a)?`https://hyp.is/go?url=${encodeURIComponent(a)}&group=${s}`:null);var a,s;const l=de((async()=>{try{i&&(await Pf(i),e.success("Copied share link to clipboard"))}catch{e.error("Unable to copy link")}}),[i,e]);return o?Ve("div",{className:"text-color-text-light space-y-3",children:i?Ve(y,{children:[Ve("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?Ve("p",{
|
|
617
|
+
children:"Use this link to share these annotations with other group members:"}):Ve("p",{children:"Use this link to share these annotations with anyone:"})}),Ve("div",{children:Ve(pn,{children:[Ve(An,{"aria-label":"Use this URL to share these annotations",type:"text",value:i,readOnly:!0}),Ve(mn,{icon:_t,onClick:l,title:"Copy share link",variant:"dark"})]})}),Ve("p",{"data-testid":"sharing-details",children:["private"===r.type?Ve("span",{children:["Annotations in the private group ",Ve("em",{children:r.name})," ","are only visible to group members."]}):Ve("span",{children:["Anyone using this link may view the annotations in the group"," ",Ve("em",{children:r.name}),"."]})," ",Ve("span",{children:["Private (",Ve(Gt,{className:"inline w-[14px] h-[14px] -mt-0.5"})," ",Ve("em",{children:"Only Me"}),") annotations are only visible to you."]})]})]}):Ve("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})}):Ve(wg,{})}),["toastMessenger"])
|
|
618
|
+
;function Ig({shareTab:e}){const t=Fi().focusedGroup(),n=t&&t.name||"...",r=`Share Annotations in ${n}`,o=e?"share":"export",[i,a]=ie(o),s=i===o;return Ve(Of,{label:"Share panel",panelName:"shareGroupAnnotations",children:[Ve(jf,{closeTitle:"Close share panel",children:[e&&Ve(Gn,{id:"share-panel-tab","aria-controls":"share-panel",variant:"tab",selected:"share"===i,onClick:()=>a("share"),textContent:"Share",children:"Share"}),Ve(Gn,{id:"export-panel-tab","aria-controls":"export-panel",variant:"tab",selected:"export"===i,onClick:()=>a("export"),textContent:"Export",children:"Export"}),Ve(Gn,{id:"import-panel-tab","aria-controls":"import-panel",variant:"tab",selected:"import"===i,onClick:()=>a("import"),textContent:"Import",children:"Import"})]}),Ve(it,{classes:Je({"rounded-tl-none":s}),children:[Ve(Hf,{id:"share-panel","data-testid":"share-panel",active:"share"===i,"aria-labelledby":"share-panel-tab",title:r,children:Ve(Ng,{})}),Ve(Hf,{id:"export-panel",active:"export"===i,"aria-labelledby":"export-panel-tab",
|
|
619
|
+
title:`Export from ${n}`,children:Ve(Sg,{})}),Ve(Hf,{id:"import-panel",active:"import"===i,"aria-labelledby":"import-panel-tab",title:`Import into ${n}`,children:Ve(Mg,{})})]})]})}function Og({onLogin:e}){const t=Fi();return Ve("div",{className:"flex flex-col items-center m-6 space-y-6",children:[Ve("span",{className:"text-center",children:["This is a public annotation created with Hypothesis. ",Ve("br",{}),"To reply or make your own annotations on this document,"," ",Ve($n,{variant:"text",href:t.getLink("signup"),target:"_blank",underline:"always",children:"create a free account"})," ","or"," ",Ve(Bn,{inline:!0,variant:"text",onClick:e,underline:"always",children:"log in"}),"."]}),Ve("div",{children:Ve($n,{href:"https://hypothes.is","aria-label":"Hypothesis homepage",target:"_blank",title:"Hypothesis homepage",underline:"none",variant:"custom",children:Ve(Vt,{className:"w-16 h-16 text-grey-7"})})})]})}var zg=er((function({onLogin:e,onSignUp:t,settings:n}){return Fi().isLoggedIn()?null:Ve(Of,{
|
|
620
|
+
label:"Login panel",panelName:"loginPrompt",children:Ve(it,{children:[Ve(vn,{children:[Ve(on,{className:"w-em h-em"}),Ve(gn,{children:"Login needed"})]}),Ve(st,{children:[Ve("p",{"data-testid":"main-text",children:["Please log in to"," ",n?.commentsMode?"write a comment":"create annotations or highlights","."]}),Ve(at,{children:[Ve(dn,{title:"Sign up",onClick:t,children:"Sign up"}),Ve(dn,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})]})})}),["settings"]);const Lg=e=>`${e}-tab`,Pg=e=>`${e}-panel`;function Rg({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i,name:a}){const s=()=>{r||i()},l=t>0?`${o} (${t} available)`:o;return Ve(Bn,{classes:Je("bg-transparent min-w-[5.25rem]",{"font-bold":r}),variant:"text",onClick:s,onMouseDown:s,pressed:!!r,role:"tab",id:Lg(a),"aria-controls":Pg(a),tabIndex:0,title:l,underline:"none",children:Ve(y,{children:[e,t>0&&!n&&Ve("span",{className:"relative bottom-[3px] left-[2px] text-[10px]",children:t})]})})}
|
|
621
|
+
var Dg=er((function({annotationsService:e,isLoading:t,settings:n}){const{rootThread:r,tabCounts:o}=Af(),i=Fi(),a=i.selectedTab(),s=o.note,l=o.annotation,c=o.orphan,u=i.isWaitingToAnchorAnnotations(),d=e=>{i.selectTab(e)},h="annotation"===a&&0===l&&!u,p="note"===a&&0===s,m=[];if(l>0){const e=Xf(l,"annotation","annotations");m.push(`${l} ${e}`)}if(s>0){const e=Xf(s,"note","notes");m.push(`${s} ${e}`)}if(c>0){const e=Xf(s,"unanchored","unanchored");m.push(`${c} ${e}`)}const f=m.join(", "),g=de((async()=>{e.createPageNote()}),[e]);return Ve(y,{children:[Ve("div",{"aria-live":"polite",role:"status",className:"sr-only",children:f}),Ve("div",{className:Je("space-y-3 pb-[9px]"),children:[Ve("div",{className:"flex gap-x-6 theme-clean:ml-[15px] mt-1",role:"tablist",children:[!n.commentsMode&&Ve(Rg,{count:l,isWaitingToAnchor:u,isSelected:"annotation"===a,label:"Annotations",name:"annotation",onSelect:()=>d("annotation"),children:"Annotations"}),Ve(Rg,{count:s,isWaitingToAnchor:u,isSelected:"note"===a,
|
|
622
|
+
label:n.commentsMode?"Comments":"Page notes",name:"note",onSelect:()=>d("note"),children:n.commentsMode?"Comments":"Page Notes"}),c>0&&Ve(Rg,{count:c,isWaitingToAnchor:u,isSelected:"orphan"===a,label:"Unanchored",name:"orphan",onSelect:()=>d("orphan"),children:"Unanchored"})]}),Ve("div",{className:"space-y-3",role:"tabpanel",id:Pg(a),"aria-labelledby":Lg(a),children:["note"===a&&n.enableExperimentalNewNoteButton&&Ve("div",{className:"flex justify-end",children:Ve(dn,{"data-testid":"new-note-button",onClick:g,variant:"primary",style:Qn(["ctaBackgroundColor"],n),children:[Ve(Zt,{}),n.commentsMode?"Add comment":"New note"]})}),!t&&p&&Ve(it,{"data-testid":"notes-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center",children:["There are no ",n.commentsMode?"comments":"page notes"," ","in this group."]})}),!t&&h&&Ve(it,{"data-testid":"annotations-unavailable-message",variant:"flat",children:Ve(st,{classes:"text-center !space-y-1",children:[Ve("p",{
|
|
623
|
+
children:"There are no annotations in this group."}),Ve("p",{children:["Create one by selecting some text and clicking the"," ",Ve(lt,{className:"w-em h-em inline m-0.5 -mt-0.5",title:"Annotate"})," ","button."]})]})}),Ve(Fm,{threads:r.children})]})]})]})}),["annotationsService","frameSync","settings"]);function jg({label:e,icon:t,description:n,active:r,disabled:o=!1,setActive:i,testId:a}){return Ve(dn,{"data-testid":a,classes:Je({"font-medium rounded-lg py-1":!0,"text-grey-7 bg-grey-2":!r,"text-grey-1 bg-grey-7":r,"opacity-50":o}),disabled:o,onClick:()=>i(!r),variant:"custom",title:n,children:[t&&Ve(t,{className:"w-em h-em"}),Ve("span",{className:"max-w-56 truncate",children:e}),Ve("div",{className:Je({"h-[2em] w-[1.5px] -mt-1 -mb-1":!0,"bg-grey-3":!r,"bg-grey-5":r})}),Ve(r?Xt:Zt,{className:"w-em h-em"})]})}function Hg({children:e}){return Ve("div",{className:"mb-3",children:Ve(it,{children:Ve(st,{children:e})})})}function Fg({withCardContainer:e=!1}){
|
|
624
|
+
const t=Fi(),n=t.selectedAnnotations().length,r=n>0,o=t.getFocusActive(),i=t.getFocusFilters(),a=Object.keys(i).length>0;if(!(r||a))return null;return Ve(e?Hg:y,{children:Ve("div",{className:"flex flex-row flex-wrap gap-2 items-center","data-testid":"filter-controls",children:[Ve("b",{children:"Filters"}),r&&Ve(jg,{label:`Clear filter: ${n} selected`,description:`Show only the ${n} selected annotations. Press to clear this filter and show all annotations.`,active:!0,setActive:()=>t.clearSelection(),testId:"selection-toggle"}),i.user&&Ve(jg,{icon:en,label:`Clear filter: by author ${i.user.display}`,description:`Show annotations by ${i.user.display}. Press to clear this filter.`,active:o.has("user"),disabled:r,setActive:()=>t.toggleFocusMode({key:"user"}),testId:"user-focus-toggle"}),i.page&&Ve(jg,{icon:Mt,label:`Clear filter: pages ${i.page.display}`,description:`Show annotations on pages ${i.page.display}. Press to clear this filter.`,active:o.has("page"),disabled:r,setActive:()=>t.toggleFocusMode({key:"page"
|
|
625
|
+
}),testId:"page-focus-toggle"}),i.cfi&&Ve(jg,{icon:Mt,label:"Clear filter: selected chapter",description:"Show annotations on selected book chapter(s). Press to clear this filter.",active:o.has("cfi"),disabled:r,setActive:()=>t.toggleFocusMode({key:"cfi"}),testId:"cfi-focus-toggle"})]})})}var $g=er((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){const i=Fi(),a=i.focusedGroupId(),s=i.isLoading(),l=i.isLoggedIn(),c=i.directLinkedAnnotationId(),u=c?i.findAnnotationByID(c):void 0,d=u?bf(u):"annotation",h=i.searchUris(),p=i.hasSidebarOpened(),m=i.profile().userid,f=!(s||!c)&&!u,g=i.directLinkedGroupFetchFailed(),v=f||g,b=i.isSidebarPanelOpen("searchAnnotations"),y=!v&&!b,_=c&&!l&&!f&&!s,w=ce(a);se((()=>{if(!w.current||w.current!==a){if(w.current){const e=i.focusState().active;i.clearSelection(),e&&i.toggleFocusMode({active:!0})}w.current=a}a&&h.length&&r.load({groupId:a,uris:h})}),[i,r,a,m,h]),se((()=>{u&&!1===u.$orphan?(e.hoverAnnotation(u),e.scrollToAnnotation(u),
|
|
626
|
+
i.selectTab(d)):u&&i.selectTab(d)}),[d,e,u,i]);const x=i.hasFetchedProfile();return se((()=>{x&&(p||l)&&o.connect({applyUpdatesImmediately:!1})}),[x,l,p,o]),Ve("div",{className:"relative",children:[Ve("h2",{className:"sr-only",children:"Annotations"}),Ve("div",{className:Je("fixed z-10","right-[9px] top-12"),children:Ve(mg,{})}),y&&Ve(Fg,{withCardContainer:!0}),Ve(zg,{onLogin:t,onSignUp:n}),f&&Ve(qi,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),g&&Ve(qi,{errorType:"group",onLoginRequest:t}),!v&&Ve(Dg,{isLoading:s}),_&&Ve(Og,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var Bg=er((function({api:e,toastMessenger:t}){const n=Fi(),r=n.routeParams().q,o=de((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...vf(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);se((()=>{n.setSortKey("newest"),n.clearAnnotations(),o(r??"").catch((e=>{
|
|
627
|
+
t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]);const{rootThread:i}=Af();return Ve(Fm,{threads:i.children})}),["api","toastMessenger"]);var qg=er((function({toastMessenger:e}){const t=Fi().getToastMessages();return Ve("div",{className:Je("z-10","absolute left-0 w-full"),children:Ve(Fn,{messages:t,onMessageDismiss:t=>e.dismiss(t),transitionClasses:{transitionIn:"motion-safe:animate-slide-in-from-right lg:animate-fade-in motion-reduce:animate-fade-in"}})})}),["toastMessenger"]);function Ug(e){return e.organization.name}const Gg="__default__";function Vg(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n=(r=e.organization).id===Gg?Gg:`${r.name.toLowerCase()}${r.id}`;var r;void 0===t[n]&&(t[n]={...e.organization,groups:[]}),function(e,t){const n=Object.assign({},e),r=t.groups;!r.length&&e.organization.logo&&(n.logo=e.organization.logo),r.push(n)}(e,t[n])})),t}function Wg(e){const t=Vg(e),n=[],r=[];return Object.keys(t).sort().forEach((e=>{
|
|
628
|
+
e===Gg?n.push(...t[e].groups):r.push(...t[e].groups)})),n.length&&r.push(...n),r}function Kg({heading:e,children:t}){return Ve(y,{children:[e&&Ve("h2",{className:"text-color-text-light p-3 leading-none uppercase",children:e}),Ve("ul",{className:"border-b",children:E(t).map((e=>Ve("li",{children:e},e.key)))})]})}function Yg({type:e}){return Ve("div",{className:"text-color-text-light",title:"open"===e?"Public group":"restricted"===e?"Restricted group":"Private group","data-testid":"group-icon",children:["open"===e&&Ve(zt,{}),"restricted"===e&&Ve(Lt,{}),"private"===e&&Ve(Gt,{})]})}var Xg=er((function({isExpanded:e,group:t,groups:n,onExpand:r,showIcon:o=!0,toastMessenger:i}){const a=t.links.html,s=a||t.canLeave,l=t.scopes&&!t.scopes.enforced||t.isScopedToUri,c=Fi(),u=c.focusedGroupId(),d=t.id===u,h=t=>{t.stopPropagation(),t.preventDefault(),r(!e)},p="private"===t.type?"Copy invite link":"Copy activity link",m=t.logo?Ve("img",{className:"w-4 h-4",alt:Ug(t),src:t.logo}):Ve("span",{className:"sr-only",children:Ug(t)
|
|
629
|
+
});return Ve(ym,{isDisabled:!l,isExpanded:!!s&&e,isSelected:d,isSubmenuVisible:s?e:void 0,label:Ve("div",{className:"grow flex items-center justify-between gap-x-2",children:[t.name,o&&Ve(Yg,{type:t.type})]}),leftChannelContent:m,onClick:l?()=>{c.clearDirectLinkedGroupFetchFailed(),c.clearDirectLinkedIds(),n.focus(t.id)}:h,onToggleSubmenu:h,submenuToggleTitle:`Show actions for ${t.name}`,submenu:Ve(y,{children:[Ve("ul",{children:[a&&Ve("li",{children:Ve(ym,{href:a,icon:Ct,isSubmenuItem:!0,label:"View group activity"})}),a&&Ve("li",{children:Ve(ym,{onClick:()=>(async e=>{try{await Pf(e),i.success(`Copied link for "${t.name}"`)}catch{i.error("Unable to copy link")}})(a),icon:_t,isSubmenuItem:!0,label:p})}),t.canLeave&&Ve("li",{children:Ve(ym,{icon:$t,isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await wn({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!l&&Ve("p",{
|
|
630
|
+
className:Je("p-2 pl-9 bg-grey-1 hyphens-none"),"data-testid":"unselectable-group-note",children:"This group is restricted to specific URLs."})]})})}),["groups","toastMessenger"]);function Zg({expandedGroup:e,onExpandGroup:t,groups:n,heading:r,showIcons:o}){return Ve(Kg,{heading:r,children:n.map((n=>Ve(Xg,{isExpanded:n===e,onExpand:e=>t(e?n:null),group:n,showIcon:o},n.id)))})}function Qg({group:e,settings:t}){const n=e.organization.logo||function(e){const t=Kn(e);return t&&t.icon?t.icon:null}(t)||"",r=Ug(e);return Ve(y,{children:[n&&Ve("img",{className:Je("relative top-[1px] w-4 h-4","max-[350px]:hidden"),src:n,alt:r}),Ve("span",{className:Je("text-md text-color-text font-bold truncate","py-1"),children:e.name})]})}var Jg=er((function({settings:e}){
|
|
631
|
+
const t=Fi(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=t.importsPending()>0,l=ue((()=>Wg(o)),[o]),c=ue((()=>Wg(r)),[r]),u=ue((()=>Wg(n)),[n]),d=t.defaultAuthority(),h=!e.groupsAllowlist&&a&&!Pr(a,d),p=t.getLink("groups.new"),[m,f]=ie(null),g=i?Ve(Qg,{group:i,settings:e}):Ve("span",{children:"…"}),v=Yn(e),b=!v;return!!v&&n.length+r.length+o.length<2?g:Ve(vm,{align:"left",contentClass:"min-w-[250px]",disabled:s,label:g,onOpenChanged:()=>f(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[u.length>0&&Ve(Zg,{expandedGroup:m,onExpandGroup:f,heading:"Currently Viewing",groups:u,showIcons:b}),c.length>0&&Ve(Zg,{expandedGroup:m,onExpandGroup:f,heading:"Featured Groups",groups:c,showIcons:b}),l.length>0&&Ve(Zg,{expandedGroup:m,onExpandGroup:f,heading:"My Groups",groups:l,showIcons:b}),h&&Ve(ym,{icon:Zt,href:p,label:"Create new group"})]})}),["settings"]);const ev={newest:"Newest",oldest:"Oldest",location:"Location"}
|
|
632
|
+
;function tv(){const e=Fi(),t=e.sortKey(),n=e.sortKeys().map((n=>Ve(ym,{label:ev[n],onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=Ve("span",{className:"p-1",children:Ve(ln,{})});return Ve("div",{"data-component":"SortMenu",children:Ve(vm,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}function nv({classes:e,...t}){return Ve(mn,{...t,classes:Je(e,"border border-transparent","aria-pressed:border-grey-3 aria-pressed:bg-grey-1")})}function rv(e){return Ve(nv,{size:"custom",classes:"touch:min-w-touch-minimum p-1",...e})}function ov({closed:e,onClose:t,children:n,className:r,"data-testid":o,"aria-label":i}){const a=ce(null);return se((()=>{e?a.current?.close():a.current?.showModal()}),[e]),se((()=>{const e=a.current;return e?.addEventListener("cancel",t),()=>{e?.removeEventListener("cancel",t)}}),[t]),Ve("dialog",{ref:a,className:Je("relative m-5 w-full h-full backdrop:bg-black/50",r),"data-testid":o,"aria-label":i,children:n})}function iv({closed:e,children:t,className:n,...r}){
|
|
633
|
+
return Ve("div",{...r,className:Je("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:e}),children:Ve("div",{className:Je("relative w-full h-full",n),children:t})})}function av({document_:e=document,...t}){return Ve(ue((()=>function(e){return"function"==typeof e.createElement("dialog").showModal}(e)?ov:iv),[e]),{...t})}function sv({onClose:e}){return Ve("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[Ve("h2",{className:"text-lg font-bold",children:"Keyboard shortcuts"}),Ve(mn,{title:"Close keyboard shortcuts",onClick:e,variant:"dark",classes:Je("!bg-transparent enabled:hover:!bg-grey-3"),children:Ve(dt,{className:"w-4 h-4"})})]})}function lv({handleShortcutInputKeyDown:e,shortcutsKeyValue:t,duplicateShortcutsMessage:n,saveError:r,shortcutDefinitionsToShow:o}){const i=o.reduce(((e,t)=>(e[t.group]??=[],e[t.group].push(t),e)),{});return Ve("div",{className:"px-4 pt-3 pb-4 space-y-4 max-h-[70vh] overflow-y-auto",children:[Ve("p",{className:"text-sm text-grey-7",
|
|
634
634
|
children:"Customize your keyboard shortcuts by typing a new keystroke. Clear a field to disable that shortcut."}),n&&Ve("p",{className:"text-xs text-red-dark","data-testid":"duplicate-shortcuts-error",children:n}),r&&Ve("p",{className:"text-xs text-red-dark","data-testid":"save-shortcuts-error",children:r}),Object.entries(i).map((([n,r])=>Ve("div",{className:"space-y-2",children:[Ve("h3",{className:"text-sm font-semibold text-grey-7",children:n}),Ve("div",{className:"space-y-2",children:r.map((({id:n,label:r,description:o})=>Ve("div",{className:"flex items-center justify-between gap-3",children:[Ve("div",{className:"flex-1 min-w-0",children:[Ve("div",{className:"text-sm font-medium truncate","data-testid":`shortcut-label-${n}`,children:r}),o&&Ve("div",{className:"text-xs text-grey-6","data-testid":`shortcut-description-${n}`,children:o})]}),Ve("div",{className:"w-32",children:Ve(An,{"aria-label":`Shortcut for ${r}`,"data-testid":`shortcut-input-${n}`,value:t[n]??"",onKeyDown:t=>e(n,t),
|
|
635
|
-
placeholder:"Press keys",classes:"text-sm",readOnly:!0})})]},n)))})]},n)))]})}function
|
|
636
|
-
"data-testid":"cancel-shortcuts-button",children:"Cancel"})]})]})}var
|
|
637
|
-
"data-testid":"keyboard-shortcuts-modal",className:"m-0 bg-transparent",children:Ve("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:Ve("div",{className:"relative w-full sm:h-auto sm:max-w-xl bg-white rounded shadow-lg",children:[Ve(
|
|
638
|
-
;var
|
|
639
|
-
children:[Ve("div",{"data-testid":"user-menu",onKeyDown:e=>{"n"===e.key?(_(),d(!1)):b&&"p"===e.key&&(w(),d(!1))},children:Ve(
|
|
640
|
-
e.isSidebarPanelOpen("searchAnnotations")||(e.openSidebarPanel("searchAnnotations"),n.preventDefault(),n.stopPropagation())}),[e]),o=
|
|
641
|
-
classes:Je("pl-8 pr-8","disabled:text-grey-6","text-base touch:text-touch-base"),"data-testid":"search-input",dir:"auto",name:"query",placeholder:s?"Loading…":"Search…",disabled:t||s,elementRef:l,value:h||"",onInput:e=>p(e.target.value),onKeyDown:o}),h&&Ve(mn,{classes:"absolute right-0 text-[16px] top-[50%] translate-y-[-50%]",size:"lg",icon:dt,"data-testid":"clear-button",title:"Clear search",onClick:r,disabled:t})]})})}var
|
|
642
|
-
const a=
|
|
643
|
-
className:"flex items-center text-md font-medium space-x-1 pl-1","data-testid":"login-links",children:[!l&&!c&&Ve("span",{children:"⋯"}),!l&&c&&Ve(y,{children:[Ve(Bn,{classes:"inline",onClick:r,style:a,underline:"none",children:"Sign up"}),Ve("div",{children:"/"}),Ve(Bn,{classes:"inline",onClick:t,style:a,underline:"none",children:"Log in"})]})]})]})]})})}),["frameSync","settings"]);
|
|
644
|
-
const i=
|
|
645
|
-
;
|
|
646
|
-
|
|
647
|
-
;
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
"
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
635
|
+
placeholder:"Press keys",classes:"text-sm",readOnly:!0})})]},n)))})]},n)))]})}function cv({duplicateShortcutsMessage:e,onCancel:t,onSave:n,session:r,onSaveError:o}){return Ve("div",{className:"flex flex-col gap-3 border-t px-4 py-3 sm:flex-row items-center sm:justify-between",children:[Ve(dn,{onClick:async()=>{rg={...eg},ag();try{await r.updateShortcutPreferences({}),o(null)}catch{o("Unable to save keyboard shortcuts")}},variant:"custom",classes:"text-sm text-grey-7 hover:text-grey-9 w-min","data-testid":"reset-shortcuts-button",children:"Reset all shortcuts to defaults"}),Ve("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap justify-center",children:[Ve(dn,{onClick:async()=>{if(!e)try{await r.updateShortcutPreferences(sg()),o(null),n()}catch{o("Unable to save keyboard shortcuts")}},variant:"primary",disabled:!!e,classes:"w-min","data-testid":"save-shortcuts-button",children:"Save"}),Ve(dn,{onClick:t,variant:"custom",classes:"text-sm text-grey-7 hover:text-grey-9 w-min",
|
|
636
|
+
"data-testid":"cancel-shortcuts-button",children:"Cancel"})]})]})}var uv=er((function({open:e,onClose:t,session:n}){const r=ug(),o=Fi(),i=o.hasFetchedProfile(),a=o.profile(),s=o.isFeatureEnabled("vpat_keyboard"),[l,c]=ie(null),u=ue((()=>dg.filter((e=>!tg.includes(e.id)||s))),[s]),d=()=>{i&&lg(a.preferences?.shortcuts_preferences??{}),c(null),t()},h=(e,t)=>{!function(e,t){rg={...rg,[e]:t&&""!==t.trim()?t.trim():null},ag()}(e,""===t.trim()?null:t),c(null)},p=ue((()=>{const e=new Map;return u.forEach((t=>{const n=r[t.id]?.trim().toLowerCase();if(n){const r=e.get(n)??[];r.push(t),e.set(n,r)}})),[...e.entries()].filter((([,e])=>{return!((t=e.map((({id:e})=>e))).length<=1||ng.some((e=>t.every((t=>e.includes(t))))));var t}))}),[r,u]),m=p.length>0?`Each keystroke can only be used once. Resolve duplicate use of ${p.map((([e,t])=>`"${e}". Currently assigned to: ${t.map((({label:e})=>e)).join(", ")}`)).join("; ")}.`:null;return Ve(av,{closed:!e,onClose:d,"aria-label":"Keyboard shortcuts",
|
|
637
|
+
"data-testid":"keyboard-shortcuts-modal",className:"m-0 bg-transparent",children:Ve("div",{className:"fixed inset-0 flex items-center justify-center p-4 sm:p-6",children:Ve("div",{className:"relative w-full sm:h-auto sm:max-w-xl bg-white rounded shadow-lg",children:[Ve(sv,{onClose:d}),Ve(lv,{duplicateShortcutsMessage:m,handleShortcutInputKeyDown:(e,t)=>{const n=function(e){const{key:t}=e;if("Shift"===t||"Control"===t||"Alt"===t||"Meta"===t)return null;if("Tab"===t)return null;const n=[];e.ctrlKey&&n.push("ctrl"),e.metaKey&&n.push("meta"),e.altKey&&n.push("alt"),e.shiftKey&&n.push("shift");const r=1===t.length?t.toLowerCase():t;return n.push(r),{shortcut:n.join("+"),shouldClear:!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||"Backspace"!==e.key&&"Delete"!==e.key)}}(t);n&&(t.preventDefault(),t.stopPropagation(),h(e,n.shouldClear?"":n.shortcut))},shortcutDefinitionsToShow:u,shortcutsKeyValue:r,saveError:l}),Ve(cv,{duplicateShortcutsMessage:m,onCancel:d,onSave:t,session:n,onSaveError:c})]})})})}),["session"])
|
|
638
|
+
;var dv=er((function({dashboard:e,isMenuOpen:t,toastMessenger:n}){const[r,o]=ie(),i=!r,a=de((()=>{"string"!=typeof r?r&&n.error("Can't open dashboard: You must reload the page.",{autoDismiss:!1}):e.open(r)}),[r,e,n]);return se((()=>(t&&e.getAuthToken().then(o).catch((e=>{console.warn("An error occurred while getting auth token",e),o(e)})),()=>o(void 0))),[e,t]),Ve(ym,{label:"Open dashboard",isDisabled:i,onClick:a})}),["dashboard","toastMessenger"]);var hv=er((function({frameSync:e,onLogout:t,settings:n}){const r=Fi(),o=r.defaultAuthority(),i=r.profile(),a=Pr(i.userid,o),s=Kn(n),l=Lr(i.userid),c=i.user_info?.display_name??l,[u,d]=ie(!1),[h,p]=ie(!1),m=e=>s&&!!s[e],f=!a||m("onProfileRequestProvided"),g=!a||m("onLogoutRequestProvided"),v=r.importsPending()>0,b=r.isFeatureEnabled("client_user_profile"),_=()=>{const t=r.focusedGroupId();t&&e.notifyHost("openNotebook",t)},w=()=>e.notifyHost("openProfile"),x=f&&!a?r.getLink("user",{user:l}):void 0,k=Ve("span",{className:"p-1",children:Ve(en,{})});return Ve(y,{
|
|
639
|
+
children:[Ve("div",{"data-testid":"user-menu",onKeyDown:e=>{"n"===e.key?(_(),d(!1)):b&&"p"===e.key&&(w(),d(!1))},children:Ve(vm,{label:k,title:c,align:"right",open:u,onOpenChanged:d,children:[Ve(Kg,{children:[Ve(ym,{label:c,isDisabled:!f,href:x,onClick:f?()=>a&&e.notifyHost("profileRequested"):void 0}),!a&&Ve(ym,{label:"Account settings",href:r.getLink("account.settings")}),b&&Ve(ym,{label:"Your profile",onClick:()=>w()}),Ve(ym,{label:"Open notebook",onClick:()=>_()})]}),Ve(Kg,{children:Ve(ym,{label:"Keyboard shortcuts",onClick:()=>{p(!0),d(!1)}})}),n.dashboard?.showEntryPoint&&Ve(Kg,{children:Ve(dv,{isMenuOpen:u})}),g&&Ve(Kg,{children:Ve(ym,{isDisabled:v,label:"Log out",onClick:t})})]})}),Ve(uv,{open:h,onClose:()=>p(!1)})]})}),["frameSync","settings"]);function pv(){const e=Fi(),t=e.isLoading(),n=e.isSidebarPanelOpen("searchAnnotations"),r=de((()=>{e.toggleSidebarPanel("searchAnnotations")}),[e]);return function(e){const t=ce(null),n=ug(),r=de((n=>{t.current=document.activeElement,
|
|
640
|
+
e.isSidebarPanelOpen("searchAnnotations")||(e.openSidebarPanel("searchAnnotations"),n.preventDefault(),n.stopPropagation())}),[e]),o=Lp()?"meta":"ctrl";Jf(n.openSearch,r,{ignoreWhenEditable:!0}),Jf(`${o}+k`,r,{ignoreWhenEditable:!1})}(e),Ve(y,{children:[t&&Ve(Rn,{}),!t&&Ve(rv,{icon:an,expanded:n,pressed:n,onClick:r,title:"Show search panel"})]})}function mv({classes:e,disabled:t=!1,inputRef:n,onClearSearch:r,onKeyDown:o,onSearch:i,query:a}){const s=Fi().isLoading(),l=Ie(n),c=ug(),[u,d]=ie(a),[h,p]=ie(a);Jf(c.openSearch,(e=>{document.activeElement!==l.current&&(e.preventDefault(),l.current?.focus())}),{ignoreWhenEditable:!0});return a!==u&&(p(a),d(a)),Ve("form",{name:"searchForm",onSubmit:e=>{e.preventDefault(),(l.current?.value||u)&&i(l.current?.value??"")},className:Je("space-y-3",e),children:Ve("div",{className:"relative",children:[Ve(mn,{classes:"absolute left-0 text-[16px] top-[50%] translate-y-[-50%]",icon:an,size:"lg",title:"Search",type:"submit",disabled:t}),Ve(An,{"aria-label":"Search",
|
|
641
|
+
classes:Je("pl-8 pr-8","disabled:text-grey-6","text-base touch:text-touch-base"),"data-testid":"search-input",dir:"auto",name:"query",placeholder:s?"Loading…":"Search…",disabled:t||s,elementRef:l,value:h||"",onInput:e=>p(e.target.value),onKeyDown:o}),h&&Ve(mn,{classes:"absolute right-0 text-[16px] top-[50%] translate-y-[-50%]",size:"lg",icon:dt,"data-testid":"clear-button",title:"Clear search",onClick:r,disabled:t})]})})}var fv=er((function({router:e}){const t=Fi(),{q:n}=t.routeParams(),r=t=>{e.navigate("stream",{q:t})};return Ve(mv,{query:n??"",onSearch:r,onClearSearch:()=>r("")})}),["router"]);function gv(e,t){const n=Kn(e)??{};switch(t){case"share":return!e.commentsMode&&(n.enableShareImportExportPanel??!0);case"account":return n.enableAccountMenu??!0;case"help":return n.enableHelpPanel??!0;default:return!0}}var vv=er((function({isSidebar:e,onLogin:t,onLogout:n,onSignUp:r,frameSync:o,settings:i}){
|
|
642
|
+
const a=Qn(["accentColor"],i),s=Fi(),l=s.isLoggedIn(),c=s.hasFetchedProfile(),u=s.isSidebarPanelOpen("help"),d=s.isSidebarPanelOpen("shareGroupAnnotations");return Ve("div",{className:Je("absolute h-10 left-0 top-0 right-0 z-4","text-grey-7 border-b theme-clean:border-b-0 bg-white"),"data-testid":"top-bar",children:Ve("div",{className:Je("container flex items-center h-full","text-[16px]"),"data-testid":"top-bar-content",children:[Ve(e?Jg:fv,{}),Ve("div",{className:"grow flex items-center justify-end",children:[e&&Ve(y,{children:[Ve(pv,{}),Ve(tv,{}),gv(i,"share")&&Ve(rv,{icon:sn,expanded:d,pressed:d,onClick:()=>{s.toggleSidebarPanel("shareGroupAnnotations")},title:"Show share panel","data-testid":"share-icon-button"})]}),gv(i,"help")&&Ve(rv,{icon:Rt,expanded:u,pressed:u,onClick:()=>{const e=Kn(i);e&&e.onHelpRequestProvided?o.notifyHost("helpRequested"):s.toggleSidebarPanel("help")},title:"Show help panel","data-testid":"help-icon-button"}),l?gv(i,"account")&&Ve(hv,{onLogout:n}):Ve("div",{
|
|
643
|
+
className:"flex items-center text-md font-medium space-x-1 pl-1","data-testid":"login-links",children:[!l&&!c&&Ve("span",{children:"⋯"}),!l&&c&&Ve(y,{children:[Ve(Bn,{classes:"inline",onClick:r,style:a,underline:"none",children:"Sign up"}),Ve("div",{children:"/"}),Ve(Bn,{classes:"inline",onClick:t,style:a,underline:"none",children:"Log in"})]})]})]})]})})}),["frameSync","settings"]);var bv=er((function({session:e}){return Ve("div",{className:Je("flex flex-col gap-3 p-4 bg-grey-1 border-b border-grey-3 text-color-text","text-sm"),"data-testid":"youtube-disclaimer-banner",children:[Ve("p",{className:"m-0",children:"This activity includes embedded YouTube videos. Hypothesis does not control whether YouTube displays ads or collects limited technical data such as IP address or device information when videos are viewed. Your institution may choose to disable the YouTube integration at any time."}),Ve("div",{children:Ve(dn,{onClick:()=>{e.dismissYoutubeDisclaimer()},variant:"primary",
|
|
644
|
+
"data-testid":"youtube-disclaimer-dismiss",children:"Dismiss"})})]})}),["session"]);function yv(){const e=Fi(),t=e.filterQuery(),n=ce(null),r=e.hasSelectedAnnotations(),o=()=>{e.closeSidebarPanel("searchAnnotations")};return Ve(Of,{panelName:"searchAnnotations",label:"Search panel",initialFocus:n,onActiveChanged:t=>{t||e.setFilterQuery(null)},children:Ve(it,{children:Ve(st,{children:[Ve("div",{className:"flex gap-x-3",children:Ve(mv,{inputRef:n,classes:"grow",disabled:r,query:t||null,onClearSearch:o,onSearch:e.setFilterQuery,onKeyDown:e=>{"Escape"===e.key&&o()}})}),Ve(Fg,{})]})})})}var _v=er((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=Fi(),a=i.profile(),s=i.route(),l="notebook"===s||"profile"===s,c=ue((()=>Qn(["appBackgroundColor"],n)),[n]),u="clean"===n.theme,d="sidebar"===s;se((()=>{(function(e,t,n){if(!e)return!1;if("object"!=typeof t.preferences||!t.preferences.show_sidebar_tutorial)return!1;const r=Kn(n);return!r?.onHelpRequestProvided&&!1!==r?.enableHelpPanel
|
|
645
|
+
})(d,a,n)&&i.openSidebarPanel("help")}),[d,a,n,i]);const h=Yn(n),p=async t=>{try{await e.login({action:t}),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},m=async()=>{Kn(n)?t.notifyHost("loginRequested"):await p("login")},f=async()=>{Kn(n)?t.notifyHost("signupRequested"):await p("signup")};return Ve("div",{className:Je("h-full min-h-full overflow-auto","lg:pb-16 bg-grey-2","js-thread-list-scroll-root",{"theme-clean":u,"pt-[49px]":!l,"p-4 lg:p-12":l}),"data-testid":"hypothesis-app",style:c,children:[!l&&Ve(vv,{onLogin:m,onSignUp:f,onLogout:async()=>{await(async()=>{const e=i.countDrafts();if(0===e)return!0;let t="";return 1===e?t="You have an unsaved annotation.\nDo you really want to discard this draft?":e>1&&(t="You have "+e+" unsaved annotations.\nDo you really want to discard these drafts?"),wn({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),
|
|
646
|
+
Kn(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),!l&&Xn(n,a)&&Ve(bv,{}),Ve("div",{className:"container",children:[Ve(qg,{}),Ve($f,{}),Ve(yv,{}),Ve(Ig,{shareTab:!h}),s&&Ve("main",{children:["annotation"===s&&Ve(Cf,{onLogin:m}),"notebook"===s&&Ve(fg,{}),"profile"===s&&Ve(vg,{}),"stream"===s&&Ve(Bg,{}),"sidebar"===s&&Ve($g,{onLogin:m,onSignUp:f})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"]);function wv({error:e}){return Ve("div",{className:Je("m-2 mt-12"),children:Ve(bn,{title:"Unable to start Hypothesis",children:e.message})})}function xv(e){const t=e.toString(16);return 1===t.length?"0"+t:t}function kv(e){const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t).map(xv).join("")}function Sv(e,t,n,r=[],o=2e3,i=window){const a=kv(10),s={jsonrpc:"2.0",method:n,params:r,id:a};try{e.postMessage(s,t)}catch(e){return Promise.reject(e)}let l;const c=new Promise(((e,n)=>{l=r=>{if(r.origin!==t)return
|
|
647
|
+
;if(!(r.data instanceof Object)||"2.0"!==r.data.jsonrpc||r.data.id!==a)return;const{error:o,result:i}=r.data;void 0!==o?n(o):void 0!==i?e(i):n(new Error("RPC reply had no result or error"))},i.addEventListener("message",l)})),u=[c];var d,h;return o&&u.push((d=o,h=`Request to ${t} timed out`,new Promise(((e,t)=>{setTimeout((()=>t(new Error(h))),d)})))),Promise.race(u).then((e=>(i.removeEventListener("message",l),e))).catch((e=>{throw i.removeEventListener("message",l),e}))}function Av(e){const t=new URL(e).hash.slice(1),n=new URLSearchParams(t).get("config");return JSON.parse(n||"{}")}function Tv(e){if("string"==typeof e&&"false"===e.trim().toLocaleLowerCase())return!1;const t=Number(e);return isNaN(t)?"string"==typeof e:Boolean(t)}function Ev(e){return parseInt(e)}function Cv(e){return e&&"function"==typeof e.toString?e.toString():""}function Mv(e,t=window){let n=t;for(let t=0;t<e;t++){
|
|
648
|
+
if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}const Nv=new Set;function Iv(...e){const t=e.join();Nv.has(t)||(console.warn(...e),Nv.add(t))}var Ov,zv;Iv.reset=()=>{Nv.clear()};var Lv=Ke(zv?Ov:(zv=1,Ov=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}));function Pv(e){const t=Kn(e);return!t||!!t.allowLeavingGroups}const Rv="__world__";function Dv(e,t,n,r){const o=t.find((e=>e.id===Rv));o&&e.unshift(o);const i=e.map((e=>e.id));t=t.filter((e=>!i.includes(e.id))),t.forEach((e=>e.isMember=!1)),e.forEach((e=>e.isMember=!0));const a=e.concat(t);for(const e of a)e.canLeave=Pv(r)&&e.isMember&&e.id!==Rv;return a.forEach((e=>e.isScopedToUri=function(e,t){if(e.scopes&&e.scopes.uri_patterns.length>0&&t)return function(e,t){return t.some((t=>e.match(t.split("*").map(Lv).join(".*"))))
|
|
649
|
+
}(t,e.scopes.uri_patterns);return!0}(e,n))),a}let jv=[];const Hv=e=>({changeFocusModeUser:t=>{e.changeFocusModeUser(t);const n=t?.groups??[],r=function(e,t){return function(e,t){return t.filter((t=>e.includes(t.id)||t.groupid&&e.includes(t.groupid)))}(e,t).map((e=>e.id))}(n,e.allGroups());n.length&&!r.length&&console.error("No matching groups found in list of filtered group IDs"),e.filterGroups(r)},showContentInfo:t=>{e.setContentInfo(t)}});function Fv(e,t,n){const r=Hv(e);function o(e){const n=t.rpcAllowedOrigins||[];if(null==(o=e.data)||"object"!=typeof o||"2.0"!==o.jsonrpc)return;var o;if(!n.includes(e.origin))return void Iv(`Ignoring JSON-RPC request from non-whitelisted origin ${e.origin}`);const i=e.data;e.source.postMessage(function(e){const t=r[e.method];if(void 0===t)return{jsonrpc:"2.0",id:e.id,error:{code:-32601,message:"Method not found"}};e.params?t(...e.params):t();return{jsonrpc:"2.0",result:"ok",id:e.id}}(i),e.origin)}jv.forEach((e=>{o(e)})),jv=[],window.removeEventListener("message",$v),
|
|
650
|
+
n.addEventListener("message",o)}function $v(e){jv.push(e)}Fv.$inject=["store","settings","$window"];class Bv{constructor(e){this._api=e}trackEvent(e){this._api.analytics.events.create({},{event:e}).catch((t=>console.warn(`Could not track event "${e}"`,t)))}}Bv.$inject=["api"];class qv{constructor(e){this._rpc=e.rpc,this._reportConfig=e.reportActivity}reportActivity(e,t){if(!this._rpc||!this._reportConfig)return;let n;switch(e){case"create":n=new Date(t.created).toISOString();break;case"update":n=new Date(t.updated).toISOString();break;default:n=(new Date).toISOString()}const r={date:n,annotation:{id:t.id,isShared:Tp(t.permissions)}};this._reportConfig.events.includes(e)&&this.notify(this._reportConfig.method,[e,r])}notifyUnsavedChanges(e){this.notify("reportUnsavedChanges",[{unsaved:e}])}notify(e,t){this._rpc&&function(e,t,n,r=[]){const o={jsonrpc:"2.0",method:n,params:r};e.postMessage(o,t)}(this._rpc.targetFrame,this._rpc.origin,e,t)}}qv.$inject=["settings"];class Uv{constructor(e,t,n,r){this._activity=e,
|
|
651
|
+
this._api=t,this._settings=n,this._store=r}_applyDraftChanges(e,t){const n={},r=this._store.getDraft(e),o=zr(this._store.profile().userid)?.provider??this._store.defaultAuthority(),i=this._store.isFeatureEnabled("at_mentions");if(!r)return{...e};i?"username"===t.mentionMode?n.text=function(e,t){return e.replace(Rp,((e,n,r)=>`${n}${Hp(function(e,t){return`acct:${e}@${t}`}(r,t),`@${r}`)}`))}(r.text,o):n.text=function(e,t){return e.replace(jp,((e,n)=>{const r=t.get(n);return r?Hp(r.userid,`@${n}`):Bp(n)}))}(r.text,t.usersMap):n.text=r.text,n.tags=r.tags,n.permissions=r.isPrivate?kp(e.user):Sp(e.user,e.group);const a=e.target;if(a[0]&&a[0].description!==r.description){const e=structuredClone(a);e[0].description=r.description,n.target=e}return{...e,...n}}annotationFromData(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
|
|
652
|
+
;if(!i)throw new Error("Cannot create annotation when logged out");const a=o.user_info,s=`s:${kv(8)}`,l=Object.assign({created:t.toISOString(),group:r,permissions:Ap(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return $r(l)&&(l.permissions=kp(i)),this._settings.annotationMetadata&&(l.metadata={...this._settings.annotationMetadata}),l}create(e,t=new Date){const n=this.annotationFromData(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),$r(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:Ep(n.permissions),description:n.target[0]?.description}),qr(n)?this._store.selectTab("note"):Ur(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(e){const t=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!t)return;const n={target:[{source:t.uri}],uri:t.uri,document:e};this.create(n)}
|
|
653
|
+
async delete(e){await this._api.annotation.delete({id:e.id}),this._activity.reportActivity("delete",e),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._activity.reportActivity("flag",e),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ep(e.permissions)?kp(t):Sp(t,e.group),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e,t={mentionMode:"username"}){let n,r;const o=this._applyDraftChanges(e,t);let i;Dr(e)?(n=this._api.annotation.update({id:e.id},o),r="update"):(n=this._api.annotation.create({},o),r="create"),this._store.annotationSaveStarted(e);try{i=await n,this._activity.reportActivity(r,i)}finally{this._store.annotationSaveFinished(e)}for(const[t,n]of Object.entries(e))if(t.startsWith("$")){i[t]=n}return this._store.removeDraft(e),this._store.addAnnotations([i]),i}async moderate(e,t){const n=await this._api.annotation.moderate({id:e.id},{
|
|
654
|
+
moderation_status:t,current_moderation_status:e.moderation_status,annotation_updated:e.updated});return this._store.addAnnotations([n]),n}async loadAnnotation(e){const t=await this._api.annotation.read({id:e});return this._store.addAnnotations([t]),t}}if(Uv.$inject=["annotationActivity","api","settings","store"],"function"!=typeof Symbol){var Gv=0;Symbol=function(e){return"@@"+e+ ++Gv},Symbol.for=function(e){return"@@"+e}}
|
|
655
|
+
var Vv="diffed",Wv="__s",Kv="__d",Yv=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,Xv=/[\s\n\\/='"\0<>]/,Zv=/^(xlink|xmlns|xml)([A-Z])/,Qv=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,Jv=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,eb=new Set(["draggable","spellcheck"]);function tb(e){void 0!==e.__g?e.__g|=8:e[Kv]=!0}function nb(e){void 0!==e.__g?e.__g&=-9:e[Kv]=!1}function rb(e){return void 0!==e.__g?!!(8&e.__g):!0===e[Kv]}var ob=/["&<]/;function ib(e){if(0===e.length||!1===ob.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}
|
|
656
|
+
n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var ab=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},sb=function(e,t,n){return String(e).length>40||-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},lb={},cb=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),ub=/[A-Z]/g;function db(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:lb[n]||(lb[n]=n.replace(ub,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||cb.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}
|
|
657
|
+
function hb(e,t){return Array.isArray(t)?t.reduce(hb,e):null!=t&&!1!==t&&e.push(t),e}function pb(){this.__d=!0}function mb(e,t){return{__v:e,context:t,props:e.props,setState:pb,forceUpdate:pb,__d:!0,__h:new Array(0)}}function fb(e,t){var n=e.contextType,r=n&&t[n.__c];return null!=n?r?r.props.value:n.__:t}var gb=[],vb=[],bb=new Set(["pre","textarea"]);function yb(e,n,r,o){var i=t[Wv];t[Wv]=!0;try{return _b(e,n||{},r,o)}finally{t.__c&&t.__c(e,vb),t[Wv]=i,vb.length=0}}function _b(e,n,r,o,i,a){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return"function"==typeof e?"":ib(e+"");var s=r.pretty,l=s&&"string"==typeof s?s:"\t";if(Array.isArray(e)){for(var c="",u=0;u<e.length;u++)s&&u>0&&(c+="\n"),c+=_b(e[u],n,r,o,i,a);return c}if(void 0!==e.constructor)return"";t.__b&&t.__b(e);var d,h=e.type,p=e.props,m=!1;if("function"==typeof h){if(m=!0,!r.shallow||!o&&!1!==r.renderRootComponent||h===y){if(h===y){var f=[];return hb(f,e.props.children),_b(f,n,r,!1!==r.shallowHighOrder,i,a)}
|
|
658
|
+
var g,v=e.__c=mb(e,n),b=t.__r;if(h.prototype&&"function"==typeof h.prototype.render){var _=fb(h,n);(v=e.__c=new h(p,_)).__v=e,tb(v),v.props=p,null==v.state&&(v.state={}),null==v._nextState&&null==v.__s&&(v._nextState=v.__s=v.state),v.context=_,h.getDerivedStateFromProps?v.state=Object.assign({},v.state,h.getDerivedStateFromProps(v.props,v.state)):v.componentWillMount&&(v.componentWillMount(),v.state=v._nextState!==v.state?v._nextState:v.__s!==v.state?v.__s:v.state),b&&b(e),g=v.render(v.props,v.state,v.context)}else for(var w=fb(h,n),x=0;rb(v)&&x++<25;)nb(v),b&&b(e),g=h.call(e.__c,p,w);v.getChildContext&&(n=Object.assign({},n,v.getChildContext()));var k=_b(g,n,r,!1!==r.shallowHighOrder,i,a);return t[Vv]&&t[Vv](e),k}h=(d=h).displayName||d!==Function&&d.name||wb(d)}var S,A,T="<"+h,E=s&&"string"==typeof h&&bb.has(h);if(p){var C=Object.keys(p);r&&!0===r.sortAttributes&&C.sort();for(var M=0;M<C.length;M++){var N=C[M],I=p[N];if("children"!==N){
|
|
659
|
+
if(!Xv.test(N)&&(r&&r.allAttributes||"key"!==N&&"ref"!==N&&"__self"!==N&&"__source"!==N)){if("defaultValue"===N)N="value";else if("defaultChecked"===N)N="checked";else if("defaultSelected"===N)N="selected";else if("className"===N){if(void 0!==p.class)continue;N="class"}else"acceptCharset"===N?N="accept-charset":"httpEquiv"===N?N="http-equiv":Zv.test(N)?N=N.replace(Zv,"$1:$2").toLowerCase():"-"!==N.at(4)&&!eb.has(N)||null==I?i?Jv.test(N)&&(N="panose1"===N?"panose-1":N.replace(/([A-Z])/g,"-$1").toLowerCase()):Qv.test(N)&&(N=N.toLowerCase()):I+="";if("htmlFor"===N){if(p.for)continue;N="for"}"style"===N&&I&&"object"==typeof I&&(I=db(I)),"a"===N[0]&&"r"===N[1]&&"boolean"==typeof I&&(I=String(I));var O=r.attributeHook&&r.attributeHook(N,I,n,r,m);if(O||""===O)T+=O;else if("dangerouslySetInnerHTML"===N)A=I&&I.__html;else if("textarea"===h&&"value"===N)S=I;else if((I||0===I||""===I)&&"function"!=typeof I){if(!(!0!==I&&""!==I||(I=N,r&&r.xml))){T=T+" "+N;continue}if("value"===N){if("select"===h){a=I;continue}
|
|
660
|
+
"option"===h&&a==I&&void 0===p.selected&&(T+=" selected")}T=T+" "+N+'="'+ib(I+"")+'"'}}}else S=I}}if(s){var z=T.replace(/\n\s*/," ");z===T||~z.indexOf("\n")?s&&~T.indexOf("\n")&&(T+="\n"):T=z}if(T+=">",Xv.test(h))throw new Error(h+" is not a valid HTML tag name in "+T);var L,P=Yv.test(h)||r.voidElements&&r.voidElements.test(h),R=[];if(A)s&&!E&&sb(A)&&(A="\n"+l+ab(A,l)),T+=A;else if(null!=S&&hb(L=[],S).length){for(var D=s&&!E&&"string"==typeof h,j=D&&~T.indexOf("\n"),H=!1,F=0;F<L.length;F++){var $=L[F];if(null!=$&&!1!==$){var B=_b($,n,r,!0,"svg"===h||"foreignObject"!==h&&i,a);if(D&&!j&&sb(B)&&(j=!0),B)if(D){var q=B.length>0&&"<"!=B[0];H&&q?R[R.length-1]+=B:R.push(B),H=q}else R.push(B)}}if(D&&j)for(var U=R.length;U--;)R[U]="\n"+l+ab(R[U],l)}if(t[Vv]&&t[Vv](e),R.length||A)T+=R.join("");else if(r&&r.xml)return T.substring(0,T.length-1)+" />";return!P||L||A?(s&&!E&&~T.indexOf("\n")&&(T+="\n"),T=T+"</"+h+">"):T=T.replace(/>$/," />"),T}function wb(e){
|
|
661
|
+
var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=gb.length;r--;)if(gb[r]===e){n=r;break}n<0&&(n=gb.push(e)-1),t="UnnamedComponent"+n}return t}const xb=/(\\|\"|\')/g;var kb=function(e){return e.replace(xb,"\\$1")};const Sb=Object.prototype.toString,Ab=Date.prototype.toISOString,Tb=Error.prototype.toString,Eb=RegExp.prototype.toString,Cb=Symbol.prototype.toString,Mb=/^Symbol\((.*)\)(.*)$/,Nb=/\n/gi,Ib=Object.getOwnPropertySymbols||(e=>[]);function Ob(e){return"[object Array]"===e||"[object ArrayBuffer]"===e||"[object DataView]"===e||"[object Float32Array]"===e||"[object Float64Array]"===e||"[object Int8Array]"===e||"[object Int16Array]"===e||"[object Int32Array]"===e||"[object Uint8Array]"===e||"[object Uint8ClampedArray]"===e||"[object Uint16Array]"===e||"[object Uint32Array]"===e}function zb(e){return""===e.name?"[Function anonymous]":"[Function "+e.name+"]"}function Lb(e){return Cb.call(e).replace(Mb,"Symbol($1)")}function Pb(e){
|
|
662
|
+
return"["+Tb.call(e)+"]"}function Rb(e){if(!0===e||!1===e)return""+e;if(void 0===e)return"undefined";if(null===e)return"null";const t=typeof e;if("number"===t)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===t)return'"'+kb(e)+'"';if("function"===t)return zb(e);if("symbol"===t)return Lb(e);const n=Sb.call(e);return"[object WeakMap]"===n?"WeakMap {}":"[object WeakSet]"===n?"WeakSet {}":"[object Function]"===n||"[object GeneratorFunction]"===n?zb(e,min):"[object Symbol]"===n?Lb(e):"[object Date]"===n?Ab.call(e):"[object Error]"===n?Pb(e):"[object RegExp]"===n?Eb.call(e):"[object Arguments]"===n&&0===e.length?"Arguments []":Ob(n)&&0===e.length?e.constructor.name+" []":e instanceof Error&&Pb(e)}function Db(e,t,n,r,o,i,a,s,l,c){let u="";if(e.length){u+=o;const d=n+t;for(let n=0;n<e.length;n++)u+=d+Fb(e[n],t,d,r,o,i,a,s,l,c),n<e.length-1&&(u+=","+r);u+=o+n}return"["+u+"]"}function jb(e,t,n,r,o,i,a,s,l,c){if((i=i.slice()).indexOf(e)>-1)return"[Circular]";i.push(e);const u=++s>a
|
|
663
|
+
;if(!u&&e.toJSON&&"function"==typeof e.toJSON)return Fb(e.toJSON(),t,n,r,o,i,a,s,l,c);const d=Sb.call(e);return"[object Arguments]"===d?u?"[Arguments]":function(e,t,n,r,o,i,a,s,l,c){return(c?"":"Arguments ")+Db(e,t,n,r,o,i,a,s,l,c)}(e,t,n,r,o,i,a,s,l,c):Ob(d)?u?"[Array]":function(e,t,n,r,o,i,a,s,l,c){return(c?"":e.constructor.name+" ")+Db(e,t,n,r,o,i,a,s,l,c)}(e,t,n,r,o,i,a,s,l,c):"[object Map]"===d?u?"[Map]":function(e,t,n,r,o,i,a,s,l,c){let u="Map {";const d=e.entries();let h=d.next();if(!h.done){u+=o;const e=n+t;for(;!h.done;)u+=e+Fb(h.value[0],t,e,r,o,i,a,s,l,c)+" => "+Fb(h.value[1],t,e,r,o,i,a,s,l,c),h=d.next(),h.done||(u+=","+r);u+=o+n}return u+"}"}(e,t,n,r,o,i,a,s,l,c):"[object Set]"===d?u?"[Set]":function(e,t,n,r,o,i,a,s,l,c){let u="Set {";const d=e.entries();let h=d.next();if(!h.done){u+=o;const e=n+t;for(;!h.done;)u+=e+Fb(h.value[1],t,e,r,o,i,a,s,l,c),h=d.next(),h.done||(u+=","+r);u+=o+n}return u+"}"}(e,t,n,r,o,i,a,s,l,c):"object"==typeof e?u?"[Object]":function(e,t,n,r,o,i,a,s,l,c){
|
|
664
|
+
let u=(c?"":e.constructor?e.constructor.name+" ":"Object ")+"{",d=Object.keys(e).sort();const h=Ib(e);if(h.length&&(d=d.filter((e=>!("symbol"==typeof e||"[object Symbol]"===Sb.call(e)))).concat(h)),d.length){u+=o;const h=n+t;for(let n=0;n<d.length;n++){const p=d[n];u+=h+Fb(p,t,h,r,o,i,a,s,l,c)+": "+Fb(e[p],t,h,r,o,i,a,s,l,c),n<d.length-1&&(u+=","+r)}u+=o+n}return u+"}"}(e,t,n,r,o,i,a,s,l,c):void 0}function Hb(e,t,n,r,o,i,a,s,l,c){let u,d=!1;for(let t=0;t<l.length;t++)if(u=l[t],u.test(e)){d=!0;break}return!!d&&u.print(e,(function(e){return Fb(e,t,n,r,o,i,a,s,l,c)}),(function(e){const r=n+t;return r+e.replace(Nb,"\n"+r)}),{edgeSpacing:o,spacing:r})}function Fb(e,t,n,r,o,i,a,s,l,c){return Rb(e)||Hb(e,t,n,r,o,i,a,s,l,c)||jb(e,t,n,r,o,i,a,s,l,c)}const $b={indent:2,min:!1,maxDepth:1/0,plugins:[]};function Bb(e){return new Array(e+1).join(" ")}var qb=function(e,t){let n,r;t?(function(e){if(Object.keys(e).forEach((e=>{if(!$b.hasOwnProperty(e))throw new Error("prettyFormat: Invalid option: "+e)})),
|
|
665
|
+
e.min&&void 0!==e.indent&&0!==e.indent)throw new Error("prettyFormat: Cannot run with min option and indent")}(t),t=function(e){const t={};return Object.keys($b).forEach((n=>t[n]=e.hasOwnProperty(n)?e[n]:$b[n])),t.min&&(t.indent=0),t}(t)):t=$b;const o=t.min?" ":"\n",i=t.min?"":"\n";if(t&&t.plugins.length){n=Bb(t.indent),r=[];var a=Hb(e,n,"",o,i,r,t.maxDepth,0,t.plugins,t.min);if(a)return a}return Rb(e)||(n||(n=Bb(t.indent)),r||(r=[]),jb(e,n,"",o,i,r,t.maxDepth,0,t.plugins,t.min))},Ub={test:function(e){return e&&"object"==typeof e&&"type"in e&&"props"in e&&"key"in e},print:function(e){return yb(e,Ub.context,Ub.opts,!0)}},Gb={plugins:[Ub]},Vb={attributeHook:function(e,t,n,r,o){var i=typeof t;if("dangerouslySetInnerHTML"===e)return!1;if(null==t||"function"===i&&!r.functions)return"";if(r.skipFalseAttributes&&!o&&(!1===t||("class"===e||"style"===e)&&""===t))return"";var a="string"==typeof r.pretty?r.pretty:"\t";return"string"!==i?("function"!==i||r.functionNames?(Ub.context=n,Ub.opts=r,
|
|
666
|
+
~(t=qb(t,Gb)).indexOf("\n")&&(t=ab("\n"+t,a)+"\n")):t="Function",ab("\n"+e+"={"+t+"}",a)):"\n"+a+e+'="'+ib(t)+'"'},jsx:!0,xml:!1,functions:!0,functionNames:!0,skipFalseAttributes:!0,pretty:" "};function Wb(e,t){const n=new RegExp(`^ {${t}}`,"gm");return e.replace(n,"")}function Kb(e,...t){return n=function(e,...t){const n=e.join("").match(/^[ \t]*(?=\S)/gm),r=n?Math.min(...n.map((e=>e.length))):0;let o="";for(const[n,i]of t.entries())o+=Wb(e[n],r),o+=i;return o+Wb(e[e.length-1],r)}([...e],...t),n.replace(/^\s*\n|\n\s*$/g,"");var n}function Yb(e){const t={};for(const[n,r]of Object.entries(e))n.startsWith("$")||(t[n]=r);return t}function Xb(e){return`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")} ${`${e.getHours()}`.padStart(2,"0")}:${`${e.getMinutes()}`.padStart(2,"0")}`}class Zb{constructor(e){this._settings=e}buildJSONExportContent(e,{profile:t,now:n=new Date}){const r=new Mf(t,[]);return{export_date:n.toISOString(),export_userid:t.userid??"",
|
|
667
|
+
client_version:r.version,annotations:e.map(Yb)}}buildTextExportContent(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}),u=e.map(((e,t)=>{const n=Jr(e),r=Yr(e),o=Xr(e);return Kb`
|
|
667
668
|
Annotation ${t+1}:
|
|
668
|
-
${[`Created at: ${
|
|
669
|
-
${
|
|
669
|
+
${[`Created at: ${Xb(new Date(e.created))}`,`Author: ${c(e)}`,n?`Page: ${n}`:void 0,`Type: ${Gr(e,this._settings)}`,r?`Quote: "${r}"`:void 0,o?`Description: ${o}`:void 0,`Comment: ${e.text}`,e.tags.length>0?`Tags: ${e.tags.join(", ")}`:void 0].filter(Boolean).join("\n")}`}));return Kb`
|
|
670
|
+
${Xb(o)}
|
|
670
671
|
${a}
|
|
671
672
|
${i}
|
|
672
673
|
Group: ${t}
|
|
@@ -675,131 +676,132 @@ client_version:r.version,annotations:e.map(Wb)}}buildTextExportContent(e,{groupN
|
|
|
675
676
|
Total annotations: ${e.length}
|
|
676
677
|
Total replies: ${l.length}
|
|
677
678
|
|
|
678
|
-
${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=>[
|
|
679
|
-
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:
|
|
680
|
-
;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:
|
|
681
|
-
_exportCommon(e,{displayNamesEnabled:t,defaultAuthority:n}){const[r]=e;if(!r)throw new Error("No annotations to export");const o=e=>
|
|
682
|
-
const n=Array.isArray(t)?t:[t];for(const t of n)null!=t&&m.searchParams.append(e,t.toString())}return await
|
|
683
|
-
|
|
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
|
+
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
|
+
;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.1749.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
|
+
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
|
+
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),
|
|
684
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){
|
|
685
|
-
console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},
|
|
686
|
-
var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var a=r[i],s=t[a];t[a]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){r.apply(t,i)}))}.bind(t,s),t[a].options=n}}),
|
|
687
|
-
return this._linkCache||(this._linkCache=this.routes().then((async e=>
|
|
688
|
-
;a.state===n&&("authorization_response"===a.type&&t(i.data),"authorization_canceled"===a.type&&r(new Error("Authorization window was closed")),e.removeEventListener("message",o))}))})),o=new URL(this.authorizationEndpoint);o.searchParams.set("client_id",this.clientId),o.searchParams.set("origin",e.location.origin),o.searchParams.set("response_mode","web_message"),o.searchParams.set("response_type","code"),o.searchParams.set("state",n),o.searchParams.set("action",t);const i=`left=${e.screen.width/2-237.5},top=${e.screen.height/2-315},width=475,height=630`;if(!e.open(o.toString(),"Log in to Hypothesis",i))throw new Error("Failed to open login window");return r.then((e=>e.code))}async _formPost(e,t){const n=new URLSearchParams;for(const[e,r]of Object.entries(t))n.set(e,r);n.sort();return
|
|
689
|
-
throw new
|
|
690
|
-
;return this._client=new
|
|
686
|
+
console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},Jb}(),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));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort((function(e,t){return e-t})),r},e.createTimeout=function(e,t){
|
|
687
|
+
var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var a=r[i],s=t[a];t[a]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){r.apply(t,i)}))}.bind(t,s),t[a].options=n}}),oy;var e,t}var ay=Ke(ry?ny:(ry=1,ny=iy()));function sy(e,t){return new Promise(((n,r)=>{const o=ay.operation(t);o.attempt((async()=>{try{const t=await e();o.retry(),n(t)}catch(e){o.retry(e)||r(e)}}))}))}function ly(e){return sy((()=>_p(e)))}class cy{constructor(e){this._apiURL=e.apiUrl,this._routeCache=null,this._linkCache=null}routes(){return this._routeCache||(this._routeCache=ly(this._apiURL).then((e=>e.links))),this._routeCache}links(){
|
|
688
|
+
return this._linkCache||(this._linkCache=this.routes().then((async e=>ly(e.links.url)))),this._linkCache}}cy.$inject=["settings"];class uy extends Error{constructor(e,t){super(e),this.cause=t}}class dy{constructor(e){this.clientId=e.clientId,this.tokenEndpoint=e.tokenEndpoint,this.authorizationEndpoint=e.authorizationEndpoint,this.revokeEndpoint=e.revokeEndpoint}exchangeAuthCode(e){return this._getAccessToken({client_id:this.clientId,grant_type:"authorization_code",code:e})}exchangeGrantToken(e){return this._getAccessToken({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:e})}refreshToken(e){return this._getAccessToken({grant_type:"refresh_token",refresh_token:e})}async revokeToken(e){try{await this._formPost(this.revokeEndpoint,{token:e})}catch(e){throw new uy("Failed to revoke access token",e)}}authorize(e,t="login"){const n=kv(16),r=new Promise(((t,r)=>{e.addEventListener("message",(function o(i){if("object"!=typeof i.data)return;const a=i.data
|
|
689
|
+
;a.state===n&&("authorization_response"===a.type&&t(i.data),"authorization_canceled"===a.type&&r(new Error("Authorization window was closed")),e.removeEventListener("message",o))}))})),o=new URL(this.authorizationEndpoint);o.searchParams.set("client_id",this.clientId),o.searchParams.set("origin",e.location.origin),o.searchParams.set("response_mode","web_message"),o.searchParams.set("response_type","code"),o.searchParams.set("state",n),o.searchParams.set("action",t);const i=`left=${e.screen.width/2-237.5},top=${e.screen.height/2-315},width=475,height=630`;if(!e.open(o.toString(),"Log in to Hypothesis",i))throw new Error("Failed to open login window");return r.then((e=>e.code))}async _formPost(e,t){const n=new URLSearchParams;for(const[e,r]of Object.entries(t))n.set(e,r);n.sort();return _p(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()})}async _getAccessToken(e){let t;try{t=await this._formPost(this.tokenEndpoint,e)}catch(e){
|
|
690
|
+
throw new uy("Failed to fetch access token",e)}return{accessToken:t.access_token,expiresAt:Date.now()+1e3*(t.expires_in-10),refreshToken:t.refresh_token}}}class hy extends Bf{constructor(e,t,n,r,o){super(),this._authCode=null,this._client=null,this._tokenInfoPromise=null,this._apiRoutes=t,this._localStorage=n,this._settings=r,this._toastMessenger=o,this._window=e,this._listenForTokenStorageEvents()}_listenForTokenStorageEvents(){this._window.addEventListener("storage",(({key:e})=>{e===this._storageKey()&&(this._tokenInfoPromise=null,this.emit("oauthTokensChanged"))}))}_loadToken(){const e=this._localStorage.getObject(this._storageKey());return(e=>!!e&&"object"==typeof e&&"accessToken"in e&&"string"==typeof e.accessToken&&"refreshToken"in e&&"string"==typeof e.refreshToken&&"expiresAt"in e&&"number"==typeof e.expiresAt)(e)?{accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt}:null}async _oauthClient(){if(this._client)return this._client;const e=await this._apiRoutes.links();var t,n
|
|
691
|
+
;return this._client=new dy({clientId:this._settings.oauthClientId,authorizationEndpoint:e["oauth.authorize"],revokeEndpoint:e["oauth.revoke"],tokenEndpoint:(t="token",n=this._settings.apiUrl,new URL(t,n).href)}),this._client}async _exchangeAuthCodeForToken(e){const t=await this._oauthClient(),n=await t.exchangeAuthCode(e);return this._saveToken(n),n}async _exchangeGrantToken(e){const t=await this._oauthClient();try{return await t.exchangeGrantToken(e)}catch(e){throw this._toastMessenger.error("Hypothesis login lost: You must reload the page to annotate.",{autoDismiss:!1}),e}}_getGrantToken(){return Kn(this._settings)?.grantToken}_storageKey(){let e=new URL(this._settings.apiUrl).hostname;return e=e.replace(/\./g,"%2E"),`hypothesis.oauth.${e}.token`}_saveToken(e){this._localStorage.setObject(this._storageKey(),e)}async _refreshAccessToken(e,t){const n=await this._oauthClient();let r;try{if(r=await n.refreshToken(e),Date.now()>r.expiresAt)throw new Error("Refreshed token expired in the past")}catch{return null
|
|
691
692
|
}return t.persist&&this._saveToken(r),r}async getAccessToken(){if(!this._tokenInfoPromise){const e=this._getGrantToken();void 0!==e?this._tokenInfoPromise=e?this._exchangeGrantToken(e):Promise.resolve(null):this._authCode?(this._tokenInfoPromise=this._exchangeAuthCodeForToken(this._authCode),this._authCode=null):this._tokenInfoPromise=Promise.resolve(this._loadToken())}const e=this._tokenInfoPromise,t=await this._tokenInfoPromise;if(!t)return null;if(e!==this._tokenInfoPromise)return this.getAccessToken();if(Date.now()>t.expiresAt){const e=this._getGrantToken();return this._tokenInfoPromise=this._refreshAccessToken(t.refreshToken,{persist:void 0===e}),this.getAccessToken()}return t.accessToken}async login({action:e="login"}={}){const t=await this._oauthClient(),n=await t.authorize(this._window,e);this._authCode=n,this._tokenInfoPromise=null}async logout(){const[e,t]=await Promise.all([this._tokenInfoPromise,this._oauthClient()]);e&&await t.revokeToken(e.accessToken),this._tokenInfoPromise=null,
|
|
692
|
-
this._localStorage.removeItem(this._storageKey())}}
|
|
693
|
-
if(!this._rpc||!this._dashboardConfig)throw new Error("Dashboard cannot be opened due to missing configuration");const n=t.createElement("form");n.action=this._dashboardConfig.entryPointURL,n.target="_blank",n.method="POST";const r=t.createElement("input");r.type="hidden",r.name=this._dashboardConfig.authFieldName,r.value=e,n.append(r),t.body.append(n),n.submit(),n.remove()}}function
|
|
694
|
-
r(new
|
|
695
|
-
this._listeners=new xe,"onclose"in MessagePort.prototype&&!t||this._listeners.add(e,"unload",(e=>{e instanceof CustomEvent||this._port&&
|
|
696
|
-
return e&&"object"==typeof e?e.protocol!==
|
|
697
|
-
;return r||(e[0]??null)}class
|
|
698
|
-
;if(a.length>0){const e=new Map,t=[];for(const r of a){const o=
|
|
699
|
-
const n=new
|
|
693
|
+
this._localStorage.removeItem(this._storageKey())}}hy.$inject=["$window","apiRoutes","localStorage","settings","toastMessenger"];class py{constructor(e,t,n){this._annotationsService=e,this._toastMessenger=t,this._store=n,this._saving=new Set,this._failed=new Set}init(){const e=e=>!this._saving.has(e)&&!this._failed.has(e);this._store.subscribe((()=>{this._store.newHighlights().forEach((t=>{const n=t.$tag;e(n)&&(this._saving.add(n),sy((()=>this._annotationsService.save(t))).then((()=>{this._toastMessenger.success(`Highlighted "${Yr(t)}"`,{visuallyHidden:!0})})).catch((()=>{this._failed.add(n)})).finally((()=>{this._saving.delete(n)})))}))}))}isSaving(){return this._saving.size>0}}py.$inject=["annotationsService","toastMessenger","store"];class my{constructor(e){this._rpc=e.rpc,this._dashboardConfig=e.dashboard}async getAuthToken(){if(this._rpc&&this._dashboardConfig)return Sv(this._rpc.targetFrame,this._rpc.origin,this._dashboardConfig.authTokenRPCMethod)}open(e,t=document){
|
|
694
|
+
if(!this._rpc||!this._dashboardConfig)throw new Error("Dashboard cannot be opened due to missing configuration");const n=t.createElement("form");n.action=this._dashboardConfig.entryPointURL,n.target="_blank",n.method="POST";const r=t.createElement("input");r.type="hidden",r.name=this._dashboardConfig.authFieldName,r.value=e,n.append(r),t.body.append(n),n.submit(),n.remove()}}function fy(e){if(null===e||"object"!=typeof e)return!1;for(const t of["frame1","frame2","type","requestId"])if("string"!=typeof e[t])return!1;return!0}my.$inject=["settings"];class gy extends Error{constructor(e){super(e)}}class vy{constructor({hostFrame:e,source:t,sourceId:n}){this._hostFrame=e,this._source=t,this._sourceId=n,this._listeners=new xe}destroy(){this._listeners.removeAll()}async discover(e){const t=kv(6);return new Promise(((n,r)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:e,type:"request",requestId:t,sourceId:this._sourceId},"*")},i=setInterval(o,250),a=setTimeout((()=>{clearInterval(i),
|
|
695
|
+
r(new gy(`Unable to establish ${this._source}-${e} communication channel`))}),2e4),s=this._listeners.add(window,"message",(o=>{const{data:l,ports:c}=o;fy(l)&&l.requestId===t&&"request"!==l.type&&(clearInterval(i),clearTimeout(a),this._listeners.remove(s),"string"==typeof l.error?r(new gy(l.error)):c.length>0?n(c[0]):r(new gy(`${this._source}-${e} port request failed`)))}));o()}))}}function by(e){const t=t=>{const{data:n}=t;if(n&&"hypothesis-error"===n?.type){const{context:t,error:r}=n;e(r instanceof Error?r:function(e){const t=new Error(e.message);return t.stack=e.stack,t}(r),t)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}const yy="1.0.0",_y="frame-rpc";function wy(e,t=[],n=-1){return{protocol:_y,version:yy,arguments:t,method:e,sequence:n}}function xy(e,t,n=[],r=-1){e.postMessage(wy(t,n,r))}class ky{constructor({currentWindow:e=window,forceUnloadListener:t=!1}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,
|
|
696
|
+
this._listeners=new xe,"onclose"in MessagePort.prototype&&!t||this._listeners.add(e,"unload",(e=>{e instanceof CustomEvent||this._port&&xy(this._port,"close")})),this._pendingCalls=[],this._destroyed=!1,this._receivedCloseEvent=!1}on(e,t){if(this._port)throw new Error("Cannot add a method handler after a port is connected");this._methods.set(e,t)}connect(e){this._port=e,this._listeners.add(e,"message",(e=>this._handle(e))),this._listeners.add(e,"close",(()=>{e.dispatchEvent(new MessageEvent("message",{data:wy("close")}))})),e.start(),xy(e,"connect");for(const[e,t]of this._pendingCalls)this.call(e,...t);this._pendingCalls=[]}destroy(){this._port&&(xy(this._port,"close"),this._port.close()),this._destroyed=!0,this._listeners.removeAll()}call(e,...t){if(this._port||this._pendingCalls.push([e,t]),!this._port||this._destroyed)return;const n=this._sequence++,r=t[t.length-1];"function"==typeof r&&(this._callbacks.set(n,r),t=t.slice(0,-1)),xy(this._port,e,t,n)}_parseMessage({data:e}){
|
|
697
|
+
return e&&"object"==typeof e?e.protocol!==_y||e.version!==yy?null:Array.isArray(e.arguments)?e:null:null}_handle(e){const t=this._parseMessage(e),n=this._port;if(t&&n)if("method"in t){if("close"===t.method){if(this._receivedCloseEvent)return;this._receivedCloseEvent=!0}const e=this._methods.get(t.method);if(!e)return;const r=(...e)=>{const r={arguments:e,protocol:_y,response:t.sequence,version:yy};n.postMessage(r)};e(...t.arguments,r)}else if("response"in t){const e=this._callbacks.get(t.response);this._callbacks.delete(t.response),e&&e(...t.arguments)}}}function Sy(e,t){const n=e.target[0].selector?.find((e=>"EPUBContentSelector"===e.type));return!n||Boolean(t.url&&n.url===t.url||t.cfi&&n.cfi&&Qm(n.cfi)===Qm(t.cfi))}function Ay(e,t,n,r){let o=t();return e((()=>{const e=t();if(r?r(e,o):e===o)return;const i=o;o=e,n(e,i)}))}function Ty({$cluster:e,$tag:t,target:n,uri:r}){return{$cluster:e,$tag:t,target:n,uri:r}}function Ey(e,t){const n=e.find((e=>e.uri===t.uri));if(n)return n;const r=e.find((e=>null===e.id))
|
|
698
|
+
;return r||(e[0]??null)}class Cy{constructor(e,t,n,r){this._window=e,this._annotationsService=t,this._store=n,this._toastMessenger=r,this._portFinder=new vy({hostFrame:this._window.parent,source:"sidebar"}),this._listeners=new xe,this._shortcutsUnsubscribe=null,this._hostRPC=new ky,this._guestRPC=new Map,this._inFrame=new Set,this._highlightsVisible=!1,this._pendingScrollToTag=null,this._pendingHoverTag=null,this._pendingAnchorStatusUpdates=new Map,this._scheduleAnchorStatusUpdate=Gi((()=>{const e=Object.fromEntries(this._pendingAnchorStatusUpdates.entries());this._store.updateAnchorStatus(e),this._pendingAnchorStatusUpdates.clear()}),10),this._sidebarIsOpen=!1,this._setupSyncToGuests(),this._setupHostEvents(),this._setupFeatureFlagSync(),this._setupShortcutsSync(),this._setupToastMessengerEvents()}_setupSyncToGuests(){let e=0;const t=(t,n,r)=>{let o=0;const i=new Set,a=[];t.forEach((e=>{Rr(e)||(Ep(e.permissions)||++o,i.add(e.$tag),this._inFrame.has(e.$tag)||a.push(e))}));const s=r.filter((e=>!i.has(e.$tag)))
|
|
699
|
+
;if(a.length>0){const e=new Map,t=[];for(const r of a){const o=Ey(n,r);if(!o||o.segment&&!Sy(r,o.segment)){t.push(r.$tag);continue}const i=e.get(o.id)??[];i.push(r),e.set(o.id,i)}t.length>0&&this._updateAnchorStatus(t,"anchored");for(const[t,n]of e){const e=this._guestRPC.get(t);e&&e.call("loadAnnotations",n.map(Ty))}a.forEach((e=>{this._inFrame.add(e.$tag)}))}s.forEach((e=>{this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag))),this._inFrame.delete(e.$tag)})),n.length>0&&n.every((e=>e.isAnnotationFetchComplete))&&(0!==o&&o===e||(this._hostRPC.call("publicAnnotationCountChanged",o),e=o))};Ay(this._store.subscribe,(()=>[this._store.allAnnotations(),this._store.frames()]),(([e,n],[r])=>t(e,n,r)),Ko),Ay(this._store.subscribe,(()=>this._store.getContentInfo()),(e=>{this._guestRPC.forEach((t=>{t.call("showContentInfo",e)}))}))}_updateAnchorStatus(e,t){const n=Array.isArray(e)?e:[e];for(const e of n)this._pendingAnchorStatusUpdates.set(e,t);this._scheduleAnchorStatusUpdate()}_connectGuest(e,t){
|
|
700
|
+
const n=new ky;this._guestRPC.set(t,n),n.on("documentInfoChanged",(e=>{const r=this._store.getFocusFilters();if(e.segmentInfo&&Object.keys(r).length>0){const t=function(e,t){if(e.cfi&&t.cfi){const[n,r]=Zm(t.cfi.value);return ef(e.cfi,n,r)}if(e.pages&&t.page)return of(`${e.pages.start}-${e.pages.end}`,t.page.value)===nf.Overlap;return!0}(e.segmentInfo,r);n.call("setOutsideAssignmentNoticeVisible",!t)}this._store.connectFrame({id:t,metadata:e.metadata,uri:e.uri,segment:e.segmentInfo,persistent:e.persistent})})),n.on("close",(()=>{const e=this._store.frames().find((e=>e.id===t));e&&!e.persistent&&this._store.destroyFrame(e),this._inFrame.clear(),n.destroy(),this._guestRPC.delete(t)})),n.on("createAnnotation",(e=>{const t=this._store.isLoggedIn(),n=null!==this._store.focusedGroup();if(!t||!n)return this._hostRPC.call("openSidebar"),t||this._store.openSidebarPanel("loginPrompt"),void this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag)));this._inFrame.add(e.$tag),
|
|
700
701
|
e.$highlight||this._hostRPC.call("openSidebar"),this._hostRPC.call("showHighlights"),this._annotationsService.create(e)})),n.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),this._updateAnchorStatus(e,t?"orphan":"anchored"),e===this._pendingHoverTag&&(this._pendingHoverTag=null,n.call("hoverAnnotations",[e])),this._pendingScrollToTag&&e===this._pendingScrollToTag&&(this._pendingScrollToTag=null,n.call("scrollToAnnotation",e))})),n.on("showAnnotations",((e,t=!1)=>{const n=this._store.findIDsForTags(e);this._store.selectAnnotations(n),this._store.selectTab("annotation"),n.length>0&&t&&(this._store.setAnnotationFocusRequest(n[0]),window.focus())})),n.on("hoverAnnotations",(e=>{this._store.hoverAnnotations(e||[])})),n.on("toggleAnnotationSelection",(e=>{this._store.toggleSelectedAnnotations(this._store.findIDsForTags(e))})),n.on("openSidebar",(()=>{this._hostRPC.call("openSidebar")})),n.on("closeSidebar",(()=>{this._hostRPC.call("closeSidebar")})),n.connect(e),
|
|
701
|
-
n.call("setHighlightsVisible",this._highlightsVisible),n.call("featureFlagsUpdated",this._store.features()),n.call("shortcutsUpdated",
|
|
702
|
-
e.visuallyHidden&&!this._sidebarIsOpen&&this.notifyHost("toastMessageAdded",e)})),this._toastMessenger.on("toastMessageDismissed",(e=>{this.notifyHost("toastMessageDismissed",e)}))}async connect(){const e=await this._portFinder.discover("host");this._hostRPC.connect(e),this._listeners.add(e,"message",(e=>{const{data:t,ports:n}=e,r=t;
|
|
703
|
-
;const n=this._guestRPC.get(t?.id);return n?t.segment&&!
|
|
702
|
+
n.call("setHighlightsVisible",this._highlightsVisible),n.call("featureFlagsUpdated",this._store.features()),n.call("shortcutsUpdated",sg());const r=this._store.getContentInfo();r&&n.call("showContentInfo",r)}_setupHostEvents(){this._hostRPC.on("sidebarOpened",(()=>{this._sidebarIsOpen=!0,this._store.setSidebarOpened(!0)})),this._hostRPC.on("sidebarClosed",(()=>{this._sidebarIsOpen=!1})),this._hostRPC.on("setHighlightsVisible",(e=>{this._highlightsVisible=e,this._guestRPC.forEach((t=>t.call("setHighlightsVisible",e)))}))}_setupFeatureFlagSync(){const e=()=>this._store.features(),t=e=>{this._hostRPC.call("featureFlagsUpdated",e);for(const t of this._guestRPC.values())t.call("featureFlagsUpdated",e)};t(e()),Ay(this._store.subscribe,e,t)}_setupShortcutsSync(){this._shortcutsUnsubscribe?.(),this._shortcutsUnsubscribe=cg((e=>{for(const t of this._guestRPC.values())t.call("shortcutsUpdated",e)}))}_setupToastMessengerEvents(){this._toastMessenger.on("toastMessageAdded",(e=>{
|
|
703
|
+
e.visuallyHidden&&!this._sidebarIsOpen&&this.notifyHost("toastMessageAdded",e)})),this._toastMessenger.on("toastMessageDismissed",(e=>{this.notifyHost("toastMessageDismissed",e)}))}async connect(){const e=await this._portFinder.discover("host");this._hostRPC.connect(e),this._listeners.add(e,"message",(e=>{const{data:t,ports:n}=e,r=t;fy(r)&&function(e,t){return!!fy(e)&&JSON.stringify(e,Object.keys(t).sort())===JSON.stringify(t,Object.keys(t).sort())}(r,{frame1:"guest",frame2:"sidebar",type:"offer"})&&this._connectGuest(n[0],r.sourceId??null)}))}notifyHost(e,...t){this._hostRPC.call(e,...t)}hoverAnnotation(e){this._pendingHoverTag=null;const t=e?[e.$tag]:[];if(this._store.hoverAnnotations(t),!e)return void this._guestRPC.forEach((e=>e.call("hoverAnnotations",[])));const n=Ey(this._store.frames(),e);!n||n.segment&&!Sy(e,n.segment)?this._pendingHoverTag=e.$tag:this._guestRPC.forEach((e=>e.call("hoverAnnotations",t)))}scrollToAnnotation(e){const t=Ey(this._store.frames(),e);if(!t)return
|
|
704
|
+
;const n=this._guestRPC.get(t?.id);return n?t.segment&&!Sy(e,t.segment)?(this._pendingScrollToTag=e.$tag,void n.call("navigateToSegment",Ty(e))):void n.call("scrollToAnnotation",e.$tag):void 0}async requestThumbnail(e,t={}){const n=this._guestRPC.get(null);if(!n)throw new Error("No guest connected");return new Promise(((r,o)=>{n.call("renderThumbnail",e,t,(e=>{e.ok?r(e.value):o(new Error(e.error))}))}))}async getDocumentInfo(){const e=this._guestRPC.get(null);if(!e)throw new Error("No guest connected");const{promise:t,resolve:n}=Ag();return e.call("getDocumentInfo",n),t}destroy(){this._portFinder.destroy(),this._listeners.removeAll(),this._shortcutsUnsubscribe?.(),this._shortcutsUnsubscribe=null}}Cy.$inject=["$window","annotationsService","store","toastMessenger"];const My={id:"__default__",name:"__DEFAULT__",
|
|
704
705
|
logo:"data:image/svg+xml;utf8,"+encodeURIComponent('<?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>')
|
|
705
|
-
};const
|
|
706
|
-
;const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:
|
|
707
|
-
;const[l,c,u,d,h]=await Promise.all([this._api.profile.groups.read({expand:
|
|
708
|
-
;if(Array.isArray(e)||(n=e,"function"==typeof n?.then)){let n=[];try{n=await e}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}t=await this._loadServiceSpecifiedGroups(n)}else t=await this._loadGroupsForUserAndDocument();var n;const{groupsAllowlist:r}=this._settings;return r&&this._store.filterGroups(r),t}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){this._focusedMembersController?.abort();const e=this._store.newAnnotations().filter((e=>!
|
|
709
|
-
;const n=await this._fetchAllMembers(e,t);this._store.loadFocusedGroupMembers(t?.aborted?null:n)}async _fetchAllMembers(e,t){const n=await this._fetchMembers({groupId:e,signal:t}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}
|
|
710
|
-
;const t=
|
|
711
|
-
;/sentryWrapped/.test(
|
|
712
|
-
|
|
713
|
-
return"undefined"!=typeof Event&&
|
|
714
|
-
r.push(`[${e[0]}="${e[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&
|
|
715
|
-
currentTarget:
|
|
716
|
-
return
|
|
717
|
-
const t=
|
|
718
|
-
e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function
|
|
719
|
-
this._sdkProcessingMetadata={},this._propagationContext={traceId:
|
|
720
|
-
setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&
|
|
721
|
-
return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof
|
|
722
|
-
sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:
|
|
723
|
-
sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:
|
|
724
|
-
...t,event_id:n},this),n):(
|
|
725
|
-
;return e.stack=e.stack||new
|
|
726
|
-
const
|
|
727
|
-
})).reduce(((e,[t,n])=>(t&&n&&(e[t]=n),e)),{})}const
|
|
728
|
-
;if(t&&function(e){if(!
|
|
729
|
-
return e>9999999999?e/1e3:e}function
|
|
730
|
-
|
|
731
|
-
;const c=i?.get("sentry.dsc"),u=c&&
|
|
732
|
-
;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(
|
|
733
|
-
;if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return s.replace("object ","");if(i(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return
|
|
734
|
-
;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(
|
|
735
|
-
const o=
|
|
736
|
-
finally(e){return new
|
|
737
|
-
;Object.keys(r).length&&(e.tags={...r,...e.tags});Object.keys(o).length&&(e.user={...o,...e.user});Object.keys(i).length&&(e.contexts={...i,...e.contexts});a&&(e.level=a);s&&"transaction"!==e.type&&(e.transaction=s)}(e,t),r&&function(e,t){e.contexts={trace
|
|
738
|
-
;
|
|
739
|
-
e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),o&&o.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=
|
|
740
|
-
const p=[...n.attachments||[],...h.attachments];p.length&&(n.attachments=p),
|
|
741
|
-
;e.spans&&(r.spans=e.spans.map((e=>({...e,...e.data&&{data:
|
|
742
|
-
;n&&t&&t.captureSession(n)}function
|
|
743
|
-
if(n[t.name])
|
|
744
|
-
return
|
|
745
|
-
const
|
|
746
|
-
}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&
|
|
747
|
-
return!!e&&"object"==typeof e&&
|
|
748
|
-
captureException(e,t,n){const r
|
|
749
|
-
;this.emit("flush");const n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some((({name:e})=>e.startsWith("Spotlight"))))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name]
|
|
750
|
-
}else{if(!e.release&&!t)return void(
|
|
751
|
-
_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t
|
|
752
|
-
;const r=function(e,t){const n=t.getPropagationContext();return n.dsc||
|
|
753
|
-
if(null===e)throw this.recordDroppedEvent("event_processor",u),
|
|
754
|
-
...c.profile_id&&{[
|
|
755
|
-
;if(s&&i&&this._updateSessionFromEvent(i,o),a){const e=(o.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(o.spans?o.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=o.transaction_info;if(a&&c&&o.transaction!==e.transaction){const e="custom";o.transaction_info={...c,source:e}}return this.sendEvent(o,t),o})).then(null,(e=>{if(
|
|
756
|
-
|
|
757
|
-
console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})));
|
|
758
|
-
const t=
|
|
759
|
-
;const n=e.transaction;return!!n&&
|
|
760
|
-
}(e,t.allowUrls))return
|
|
761
|
-
;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=
|
|
762
|
-
return"warn"===e?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const
|
|
763
|
-
;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function
|
|
764
|
-
const n=new Error,{method:r,url:o}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:
|
|
765
|
-
function
|
|
766
|
-
Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function
|
|
767
|
-
if("number"==typeof e.framesToPop)return e.framesToPop;return 0}(t);try{return e(n,r,o)}catch{}return[]}const
|
|
768
|
-
}),i}return i=
|
|
769
|
-
;!function(e,t,n=[t],r="npm"){const o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:n.map((e=>({name:`${r}:@sentry/${e}`,version:
|
|
770
|
-
const i=
|
|
771
|
-
if("click"===t||"keypress"==t)try{const n=this.__sentry_instrumentation_handlers__||{},o=n[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}})))}))}function
|
|
772
|
-
const n=t.length>2?t[2]:void 0;if(n){const r=
|
|
773
|
-
virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(s(),e.apply(t,n))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,o]=n,i=t[
|
|
774
|
-
let n=0,r=0;return
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
;a&&a>
|
|
778
|
-
input:l,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:c,type:"http",level
|
|
779
|
-
;let i=n?
|
|
780
|
-
setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&
|
|
781
|
-
}),i])}})),
|
|
782
|
-
ignoreDuration:!0}),
|
|
783
|
-
type:"auto.browser.global_handlers.onerror"}})}))}(e),
|
|
784
|
-
const e=
|
|
785
|
-
;const r={...e,enabled:!t&&e.enabled,stackParser:(o=e.stackParser||
|
|
786
|
-
uri:t?.uri??e.uri,document:t?.metadata??e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=
|
|
787
|
-
message:[o,n,a].filter((e=>e.length>0)).join(", ")}}(a);return"success"===c?this._toastMessenger.success(u):"notice"===c?this._toastMessenger.notice(u,{autoDismiss:!1}):"error"===c&&this._toastMessenger.error(u,{autoDismiss:!1}),a}}
|
|
788
|
-
;this._searchClient=new
|
|
789
|
-
;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}
|
|
790
|
-
this._storage=e,this._store=t}init(){for(const[e,t]of
|
|
791
|
-
;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(const[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){this._window.history.pushState({},"",this.routeUrl(e,t)),this.sync()}}
|
|
792
|
-
return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=
|
|
793
|
-
return this._lastLoad=null,this._lastLoadTime=null,this.load()}}
|
|
794
|
-
this.isConnected()&&this.sendMessages()}isConnected(){return this._socket.readyState===WebSocket.OPEN}sendMessages(){for(;this._messageQueue.length>0;){const e=JSON.stringify(this._messageQueue.shift());this._socket.send(e)}}}class
|
|
795
|
-
const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})));t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){
|
|
796
|
-
}else
|
|
797
|
-
r.on("message",(e=>this._handleSocketMessage(e))),this._socket=r,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,
|
|
798
|
-
;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(
|
|
799
|
-
const t=this.#t.get(e);return t?(this.#t.delete(e),this.#t.set(e,t),t):null}cachedThumbnailTags(){return[...this.#t.keys()]}}
|
|
800
|
-
this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}
|
|
801
|
-
function kA(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})}))}
|
|
802
|
-
const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),
|
|
803
|
-
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:
|
|
804
|
-
;n.register("analytics",
|
|
706
|
+
};const Ny=["organization","scopes"];class Iy{_focusedMembersController=null;constructor(e,t,n,r,o){this._store=e,this._api=t,this._auth=n,this._settings=r,this._toastMessenger=o,this._serviceConfig=Kn(r),this._reloadSetUp=!1}_mainURI(){return this._store.defaultContentFrame()?.uri??null}async _filterGroups(e,t,n,r){if(r){const t=e.find((e=>e.id===r));t&&!t.isScopedToUri&&t.scopes&&t.scopes.enforced&&(e=e.filter((e=>e.id!==r)),this._store.setDirectLinkedGroupFetchFailed(),r=null)}if(t)return e;const o=e.some((e=>e.id!==Rv&&e.isScopedToUri));return o?r===Rv||n===Rv?e:e.filter((e=>e.id!==Rv)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,Ay(this._store.subscribe,(()=>this._mainURI()),(()=>this.load())),Ay(this._store.subscribe,(()=>[this._store.hasFetchedProfile(),this._store.profile().userid]),((e,[t])=>{t&&this.load()}),Ko))}_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=My)}))}(e)
|
|
707
|
+
;const n=0===this._store.allGroups().length,r=this._store.getDefault("focusedGroup");this._store.loadGroups(e),n&&(t&&e.some((e=>e.id===t))?this.focus(t):r&&e.some((e=>e.id===r))&&this.focus(r))}_fetchGroup(e){return this._api.group.read({id:e,expand:Ny})}async _loadGroupsForUserAndDocument(){const e=()=>function(e,t){const n=t(e);return null!==n?Promise.resolve(n):new Promise((n=>{const r=e.subscribe((()=>{const o=t(e);null!==o&&(r(),n(o))}))}))}(this._store,(()=>this._mainURI()));let t=null;"sidebar"===this._store.route()&&(t=await e()),this._setupAutoReload();const n=this._store.directLinkedAnnotationId();let r=null;n&&(r=this._api.annotation.get({id:n}).catch((()=>null)));const o=this._store.directLinkedGroupId();let i=null;o&&(i=this._fetchGroup(o).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),null))));const a={expand:Ny},s=this._serviceConfig?.authority;s&&(a.authority=s),t&&(a.document_uri=t)
|
|
708
|
+
;const[l,c,u,d,h]=await Promise.all([this._api.profile.groups.read({expand:Ny}),this._api.groups.list(a),this._auth.getAccessToken(),r,i]);h&&!c.some((e=>e.id===h.id))&&c.push(h);let p=null;if(d){p=d.group;const e=l.concat(c).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);c.push(e)}catch{this._toastMessenger.error("Unable to fetch group for linked annotation")}}const m=null!==u,f=await this._filterGroups(Dv(l,c,t,this._settings),m,p,o),g=p||o||null;return this._addGroupsToStore(f,g),f}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:Ny});let n=null;const r=async e=>{try{return await this._fetchGroup(e)}catch(e){return n=e,null}},o=await Promise.all(e.map((e=>t.find((t=>t.id===e||t.groupid===e))||r(e)))),i=o.filter((e=>null!==e)),a=this._store.directLinkedGroupId();return this._addGroupsToStore(i,a),n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){const e=this._serviceConfig?.groups;let t
|
|
709
|
+
;if(Array.isArray(e)||(n=e,"function"==typeof n?.then)){let n=[];try{n=await e}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}t=await this._loadServiceSpecifiedGroups(n)}else t=await this._loadGroupsForUserAndDocument();var n;const{groupsAllowlist:r}=this._settings;return r&&this._store.filterGroups(r),t}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){this._focusedMembersController?.abort();const e=this._store.newAnnotations().filter((e=>!Rr(e))).map((e=>({...e,group:n})));e.length&&this._store.addAnnotations(e),this._store.setDefault("focusedGroup",n)}}leave(e){return this._api.group.member.delete({pubid:e,userid:"me"})}async loadFocusedGroupMembers(){const e=this._store.focusedGroupId();if(!e)return;this._focusedMembersController?.abort(),this._focusedMembersController=new AbortController;const{signal:t}=this._focusedMembersController;this._store.startLoadingFocusedGroupMembers()
|
|
710
|
+
;const n=await this._fetchAllMembers(e,t);this._store.loadFocusedGroupMembers(t?.aborted?null:n)}async _fetchAllMembers(e,t){const n=await this._fetchMembers({groupId:e,signal:t}),r=Math.min(Math.ceil(n.meta.page.total/100),10);let o=n.data;for(let n=2;n<=r&&!t?.aborted;n++){const r=await this._fetchMembers({groupId:e,page:n,signal:t});o=o.concat(r.data)}return o}_fetchMembers({groupId:e,page:t=1,signal:n}){return this._api.group.members.read({pubid:e,"page[number]":t,"page[size]":100},void 0,n)}}Iy.$inject=["store","api","auth","settings","toastMessenger"];const Oy="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,zy=globalThis,Ly="10.29.0";function Py(){return Ry(zy),zy}function Ry(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ly,t[Ly]=t[Ly]||{}}function Dy(e,t,n=zy){const r=n.__SENTRY__=n.__SENTRY__||{},o=r[Ly]=r[Ly]||{};return o[e]||(o[e]=t())}const jy=["debug","info","warn","error","log","assert","trace"],Hy="Sentry Logger ",Fy={};function $y(e){if(!("console"in zy))return e()
|
|
711
|
+
;const t=zy.console,n={},r=Object.keys(Fy);r.forEach((e=>{const r=Fy[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function By(){return Uy().enabled}function qy(e,...t){Oy&&By()&&$y((()=>{zy.console[e](`${Hy}[${e}]:`,...t)}))}function Uy(){return Oy?Dy("loggerSettings",(()=>({enabled:!1}))):{enabled:!1}}const Gy={enable:function(){Uy().enabled=!0},disable:function(){Uy().enabled=!1},isEnabled:By,log:function(...e){qy("log",...e)},warn:function(...e){qy("warn",...e)},error:function(...e){qy("error",...e)}},Vy=50,Wy="?",Ky=/\(error: (.*)\)/,Yy=/captureMessage|captureException/;function Xy(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0,r=0)=>{const o=[],i=e.split("\n");for(let e=n;e<i.length;e++){let n=i[e];n.length>1024&&(n=n.slice(0,1024));const a=Ky.test(n)?n.replace(Ky,"$1"):n;if(!a.match(/\S*Error: /)){for(const e of t){const t=e(a);if(t){o.push(t);break}}if(o.length>=Vy+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e)
|
|
712
|
+
;/sentryWrapped/.test(Zy(t).function||"")&&t.pop();t.reverse(),Yy.test(Zy(t).function||"")&&(t.pop(),Yy.test(Zy(t).function||"")&&t.pop());return t.slice(0,Vy).map((e=>({...e,filename:e.filename||Zy(t).filename,function:e.function||Wy})))}(o.slice(r))}}function Zy(e){return e[e.length-1]||{}}const Qy="<anonymous>";function Jy(e){try{return e&&"function"==typeof e&&e.name||Qy}catch{return Qy}}function e_(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach((t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)})),e}catch{return}}}function t_(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const n_={},r_={};function o_(e,t){n_[e]=n_[e]||[],n_[e].push(t)}function i_(e,t){if(!r_[e]){r_[e]=!0;try{t()}catch(t){Oy&&Gy.error(`Error while instrumenting ${e}`,t)}}}function a_(e,t){const n=e&&n_[e];if(n)for(const r of n)try{r(t)}catch(t){Oy&&Gy.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${Jy(r)}\nError:`,t)}}let s_=null;function l_(){s_=zy.onerror,
|
|
713
|
+
zy.onerror=function(e,t,n,r,o){return a_("error",{column:r,error:o,line:n,msg:e,url:t}),!!s_&&s_.apply(this,arguments)},zy.onerror.__SENTRY_INSTRUMENTED__=!0}let c_=null;function u_(){c_=zy.onunhandledrejection,zy.onunhandledrejection=function(e){return a_("unhandledrejection",e),!c_||c_.apply(this,arguments)},zy.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const d_=Object.prototype.toString;function h_(e){switch(d_.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return x_(e,Error)}}function p_(e,t){return d_.call(e)===`[object ${t}]`}function m_(e){return p_(e,"ErrorEvent")}function f_(e){return p_(e,"DOMError")}function g_(e){return p_(e,"String")}function v_(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function b_(e){return null===e||v_(e)||"object"!=typeof e&&"function"!=typeof e}function y_(e){return p_(e,"Object")}function __(e){
|
|
714
|
+
return"undefined"!=typeof Event&&x_(e,Event)}function w_(e){return Boolean(e?.then&&"function"==typeof e.then)}function x_(e,t){try{return e instanceof t}catch{return!1}}function k_(e){return!("object"!=typeof e||null===e||!(e.__isVue||e._isVue||e.__v_isVNode))}const S_=zy,A_=80;function T_(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,o=[];let i=0,a=0;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||A_;for(;n&&i++<r&&(c=E_(n,u),!("html"===c||i>1&&a+o.length*l+c.length>=d));)o.push(c),a+=c.length,n=n.parentNode;return o.reverse().join(s)}catch{return"<unknown>"}}function E_(e,t){const n=e,r=[];if(!n?.tagName)return"";if(S_.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const o=t?.length?t.filter((e=>n.getAttribute(e))).map((e=>[e,n.getAttribute(e)])):null;if(o?.length)o.forEach((e=>{
|
|
715
|
+
r.push(`[${e[0]}="${e[1]}"]`)}));else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&g_(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}const i=["aria-label","type","name","title","alt"];for(const e of i){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function C_(){try{return S_.document.location.href}catch{return""}}function M_(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const o=n(r);"function"==typeof o&&I_(o,r);try{e[t]=o}catch{Oy&&Gy.log(`Failed to replace method "${t}" in object`,e)}}function N_(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Oy&&Gy.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function I_(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,N_(e,"__sentry_original__",t)}catch{}}function O_(e){return e.__sentry_original__}function z_(e){if(h_(e))return{message:e.message,name:e.name,stack:e.stack,...P_(e)};if(__(e)){const t={type:e.type,target:L_(e.target),
|
|
716
|
+
currentTarget:L_(e.currentTarget),...P_(e)};return"undefined"!=typeof CustomEvent&&x_(e,CustomEvent)&&(t.detail=e.detail),t}return e}function L_(e){try{return t=e,"undefined"!=typeof Element&&x_(t,Element)?T_(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}var t}function P_(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function R_(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function D_(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{k_(r)?n.push(t_(r)):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function j_(e,t,n=!1){return!!g_(e)&&(p_(t,"RegExp")?t.test(e):!!g_(t)&&(n?e===t:e.includes(t)))}function H_(e,t=[],n=!1){return t.some((t=>j_(e,t,n)))}let F_;function $_(e=function(){const e=zy;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return e.randomUUID().replace(/-/g,"")}catch{}
|
|
717
|
+
return F_||(F_=[1e7]+1e3+4e3+8e3+1e11),F_.replace(/[018]/g,(e=>(e^(16*Math.random()&15)>>e/4).toString(16)))}function B_(e){return e.exception?.values?.[0]}function q_(e){const{message:t,event_id:n}=e;if(t)return t;const r=B_(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function U_(e,t,n){const r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function G_(e,t){const n=B_(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function V_(e){if(function(e){try{return e.__sentry_captured__}catch{}}(e))return!0;try{N_(e,"__sentry_captured__",!0)}catch{}return!1}const W_=1e3;function K_(){return Date.now()/W_}let Y_;function X_(){return(Y_??(Y_=function(){const{performance:e}=zy;if(!e?.now||!e.timeOrigin)return K_;const t=e.timeOrigin;return()=>(t+e.now())/W_}()))()}function Z_(e){
|
|
718
|
+
const t=X_(),n={sid:$_(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&Q_(n,e),n}function Q_(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||X_(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:$_()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),
|
|
719
|
+
e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function J_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=J_(r[e],t[e],n-1));return r}function ew(){return $_()}function tw(){return $_().substring(16)}const nw="_sentrySpan";function rw(e,t){t?N_(e,nw,t):delete e[nw]}function ow(e){return e[nw]}class iw{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},
|
|
720
|
+
this._sdkProcessingMetadata={},this._propagationContext={traceId:ew(),sampleRand:Math.random()}}clone(){const e=new iw;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,rw(e,ow(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}
|
|
721
|
+
setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Q_(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){
|
|
722
|
+
return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof iw?t.getScopeData():y_(t)?e:void 0,{tags:r,attributes:o,extra:i,user:a,contexts:s,level:l,fingerprint:c=[],propagationContext:u}=n||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...o},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,rw(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ew(),
|
|
723
|
+
sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:K_(),...e,message:e.message?R_(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,
|
|
724
|
+
sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ow(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=J_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t?.event_id||$_();if(!this._client)return Oy&&Gy.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||$_();if(!this._client)return Oy&&Gy.warn("No client configured on scope - will not capture message!"),r;const o=n?.syntheticException??new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureEvent(e,t){const n=t?.event_id||$_();return this._client?(this._client.captureEvent(e,{
|
|
725
|
+
...t,event_id:n},this),n):(Oy&&Gy.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}class aw{constructor(e,t){let n,r;n=e||new iw,r=t||new iw,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return w_(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function sw(){const e=Ry(Py())
|
|
726
|
+
;return e.stack=e.stack||new aw(Dy("defaultCurrentScope",(()=>new iw)),Dy("defaultIsolationScope",(()=>new iw)))}function lw(e){return sw().withScope(e)}function cw(e,t){const n=sw();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function uw(e){return sw().withScope((()=>e(sw().getIsolationScope())))}function dw(e){const t=Ry(e);return t.acs?t.acs:{withIsolationScope:uw,withScope:lw,withSetScope:cw,withSetIsolationScope:(e,t)=>uw(t),getCurrentScope:()=>sw().getScope(),getIsolationScope:()=>sw().getIsolationScope()}}function hw(){return dw(Py()).getCurrentScope()}function pw(){return dw(Py()).getIsolationScope()}function mw(){return hw().getClient()}function fw(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:o}=t,i={trace_id:n,span_id:o||tw()};return r&&(i.parent_span_id=r),i}
|
|
727
|
+
const gw="sentry.source",vw="sentry.sample_rate",bw="sentry.previous_trace_sample_rate",yw="sentry.op",_w="sentry.origin",ww="sentry.profile_id",xw="sentry.exclusive_time",kw=0,Sw=1,Aw="_sentryScope",Tw="_sentryIsolationScope";function Ew(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Cw(e){const t=e;return{scope:t[Aw],isolationScope:Ew(t[Tw])}}const Mw="sentry-",Nw=/^sentry-/;function Iw(e){const t=function(e){if(!e||!g_(e)&&!Array.isArray(e))return;if(Array.isArray(e))return e.reduce(((e,t)=>{const n=Ow(t);return Object.entries(n).forEach((([t,n])=>{e[t]=n})),e}),{});return Ow(e)}(e);if(!t)return;const n=Object.entries(t).reduce(((e,[t,n])=>{if(t.match(Nw)){e[t.slice(Mw.length)]=n}return e}),{});return Object.keys(n).length>0?n:void 0}function Ow(e){return e.split(",").map((e=>{const t=e.indexOf("=");if(-1===t)return[];return[e.slice(0,t),e.slice(t+1)].map((e=>{try{return decodeURIComponent(e.trim())}catch{return}}))
|
|
728
|
+
})).reduce(((e,[t,n])=>(t&&n&&(e[t]=n),e)),{})}const zw=/^o(\d+)\./,Lw=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Pw(e,t=!1){const{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r?`${r}/`:r}${a}`}function Rw(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Dw(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(zw);return t?.[1]}(n)),r}function jw(e){const t="string"==typeof e?function(e){const t=Lw.exec(e);if(!t)return void $y((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,o="",i="",a="",s=""]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return Rw({host:i,pass:o,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):Rw(e)
|
|
729
|
+
;if(t&&function(e){if(!Oy)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(Gy.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Gy.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Gy.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Gy.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}const Hw=1;let Fw=!1;function $w(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:Gw(e).parent_span_id,i=Cw(e).scope;return{parent_span_id:o,span_id:r?i?.getPropagationContext().propagationSpanId||tw():t,trace_id:n}}function Bw(e){return e&&e.length>0?e.map((({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:o})=>({span_id:e,trace_id:t,sampled:n===Hw,attributes:o,...r}))):void 0}function qw(e){return"number"==typeof e?Uw(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Uw(e.getTime()):X_()}function Uw(e){
|
|
730
|
+
return e>9999999999?e/1e3:e}function Gw(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:o,name:i,endTime:a,status:s,links:l}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0,start_timestamp:qw(o),timestamp:qw(a)||void 0,status:Vw(s),op:r[yw],origin:r[_w],links:Bw(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Vw(e){if(e&&e.code!==kw)return e.code===Sw?"ok":e.message||"internal_error"}const Ww="_sentryRootSpan";function Kw(e){return e[Ww]||e}function Yw(){Fw||($y((()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")})),Fw=!0)}function Xw(e){
|
|
731
|
+
Gy.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Zw(e,t){if(!t?.length||!e.description)return!1;for(const r of t){if("string"==typeof(n=r)||n instanceof RegExp){if(j_(e.description,r))return Oy&&Xw(e),!0;continue}if(!r.name&&!r.op)continue;const t=!r.name||j_(e.description,r.name),o=!r.op||e.op&&j_(e.op,r.op);if(t&&o)return Oy&&Xw(e),!0}var n;return!1}function Qw(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}const Jw="production",ex="_frozenDsc";function tx(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={environment:n.environment||Jw,release:n.release,public_key:r,trace_id:e,org_id:Dw(t)};return t.emit("createDsc",o),o}function nx(e){const t=mw();if(!t)return{};const n=Kw(e),r=Gw(n),o=r.data,i=n.spanContext().traceState,a=i?.get("sentry.sample_rate")??o[vw]??o[bw];function s(e){return"number"!=typeof a&&"string"!=typeof a||(e.sample_rate=`${a}`),e}const l=n[ex];if(l)return s(l)
|
|
732
|
+
;const c=i?.get("sentry.dsc"),u=c&&Iw(c);if(u)return s(u);const d=tx(e.spanContext().traceId,t),h=o[gw],p=r.description;return"url"!==h&&p&&(d.transaction=p),function(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=mw()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return t===Hw}(n)),d.sample_rand=i?.get("sentry.sample_rand")??Cw(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit("createDsc",d,n),d}function rx(e,t=100,n=1/0){try{return ix("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function ox(e,t=3,n=102400){const r=rx(e,t);return o=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(o))>n?ox(e,t-1,n):r;var o}function ix(e,t,n=1/0,r=1/0,o=function(){const e=new WeakSet;function t(t){return!!e.has(t)||(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}()){const[i,a]=o
|
|
733
|
+
;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(k_(t))return t_(t);if(y_(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${Jy(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t)
|
|
734
|
+
;if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return s.replace("object ","");if(i(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return ix("",c.toJSON(),l-1,r,o)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=z_(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=r){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=ix(e,t,l-1,r,o),d++}return a(t),u}function ax(e,t=[]){return[e,t]}function sx(e,t){const[n,r]=e;return[n,[...r,t]]}function lx(e,t){const n=e[1];for(const e of n){if(t(e,e[0].type))return!0}return!1}function cx(e){const t=Ry(zy);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function ux(e){const[t,n]=e;let r=JSON.stringify(t);function o(e){"string"==typeof r?r="string"==typeof e?r+e:[cx(r),e]:r.push("string"==typeof e?cx(e):e)}for(const e of n){const[t,n]=e
|
|
735
|
+
;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(rx(n))}o(e)}}return"string"==typeof r?r:function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function dx(e){const t="string"==typeof e.data?cx(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const hx={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function px(e){return hx[e]}function mx(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function fx(e,t,n,r){
|
|
736
|
+
const o=mx(n),i=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const a=function(e,t,n,r){const o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Pw(r)},...o&&{trace:o}}}(e,o,r,t);delete e.sdkProcessingMetadata;return ax(a,[[{type:i},e]])}function gx(e){return new bx((t=>{t(e)}))}function vx(e){return new bx(((t,n)=>{n(e)}))}class bx{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(e,t){return new bx(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}
|
|
737
|
+
finally(e){return new bx(((t,n)=>{let r,o;return this.then((t=>{o=!1,r=t,e&&e()}),(t=>{o=!0,r=t,e&&e()})).then((()=>{o?n(r):t(r)}))}))}_executeHandlers(){if(0===this._state)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(1===this._state&&e[1](this._value),2===this._state&&e[2](this._value),e[0]=!0)}))}_runExecutor(e){const t=(e,t)=>{0===this._state&&(w_(t)?t.then(n,r):(this._state=e,this._value=t,this._executeHandlers()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function yx(e,t,n,r=0){try{const o=_x(t,n,e,r);return w_(o)?o:gx(o)}catch(e){return vx(e)}}function _x(e,t,n,r){const o=n[r];if(!e||!o)return e;const i=o({...e},t);return Oy&&null===i&&Gy.log(`Event processor "${o.id||"?"}" dropped event`),w_(i)?i.then((e=>_x(e,t,n,r+1))):_x(i,t,n,r+1)}function wx(e,t){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;!function(e,t){const{extra:n,tags:r,user:o,contexts:i,level:a,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra})
|
|
738
|
+
;Object.keys(r).length&&(e.tags={...r,...e.tags});Object.keys(o).length&&(e.user={...o,...e.user});Object.keys(i).length&&(e.contexts={...i,...e.contexts});a&&(e.level=a);s&&"transaction"!==e.type&&(e.transaction=s)}(e,t),r&&function(e,t){e.contexts={trace:$w(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:nx(t),...e.sdkProcessingMetadata};const n=Kw(t),r=Gw(n).description;r&&!e.transaction&&"transaction"===e.type&&(e.transaction=r)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t));e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,o),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,i)}function xx(e,t){const{extra:n,tags:r,user:o,contexts:i,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:p,span:m}=t
|
|
739
|
+
;kx(e,"extra",n),kx(e,"tags",r),kx(e,"user",o),kx(e,"contexts",i),e.sdkProcessingMetadata=J_(e.sdkProcessingMetadata,s,2),a&&(e.level=a),p&&(e.transactionName=p),m&&(e.span=m),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function kx(e,t,n){e[t]=J_(e[t],n,1)}let Sx,Ax,Tx,Ex;function Cx(e,t,n,r,o,i){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||$_(),timestamp:t.timestamp||K_()},c=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:o,maxValueLength:i}=t;e.environment=e.environment||n||Jw,!e.release&&r&&(e.release=r);!e.dist&&o&&(e.dist=o);const a=e.request;a?.url&&i&&(a.url=R_(a.url,i));i&&e.exception?.values?.forEach((e=>{e.value&&(e.value=R_(e.value,i))}))}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},
|
|
740
|
+
e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),o&&o.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=zy._sentryDebugIds,n=zy._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(Ex&&r.length===Ax&&o.length===Tx)return Ex;Ax=r.length,Tx=o.length,Ex={},Sx||(Sx={});const i=(t,n)=>{for(const r of t){const t=n[r],o=Sx?.[r];if(o&&Ex&&t)Ex[o[0]]=t,Sx&&(Sx[r]=[o[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const o=n[e],i=o?.filename;if(i&&Ex&&Sx){Ex[i]=t,Sx[r]=[i,t];break}}}}};return t&&i(r,t),n&&i(o,n),Ex}(t);e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.filename&&(e.debug_id=n[e.filename])}))}))}(l,e.stackParser);const u=function(e,t){if(!t)return e;const n=e?e.clone():new iw;return n.update(t),n}(r,n.captureContext);n.mechanism&&G_(l,n.mechanism);const d=o?o.getEventProcessors():[],h=Dy("globalScope",(()=>new iw)).getScopeData();if(i){xx(h,i.getScopeData())}if(u){xx(h,u.getScopeData())}
|
|
741
|
+
const p=[...n.attachments||[],...h.attachments];p.length&&(n.attachments=p),wx(l,h);return yx([...d,...h.eventProcessors],l,n).then((e=>(e&&function(e){const t={};if(e.exception?.values?.forEach((e=>{e.stacktrace?.frames?.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))})),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach((([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})}))}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:rx(e.data,t,n)}})))},...e.user&&{user:rx(e.user,t,n)},...e.contexts&&{contexts:rx(e.contexts,t,n)},...e.extra&&{extra:rx(e.extra,t,n)}};e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=rx(e.contexts.trace.data,t,n)))
|
|
742
|
+
;e.spans&&(r.spans=e.spans.map((e=>({...e,...e.data&&{data:rx(e.data,t,n)}}))));e.contexts?.flags&&r.contexts&&(r.contexts.flags=rx(e.contexts.flags,3,n));return r}(e,a,s):e)))}function Mx(e){if(e)return function(e){return e instanceof iw||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>Nx.includes(e)))}(e)?{captureContext:e}:e}const Nx=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function Ix(e,t){return hw().captureException(e,Mx(t))}function Ox(e,t){return hw().captureEvent(e,t)}function zx(e,t){pw().setExtra(e,t)}function Lx(e){const t=pw(),n=hw(),{userAgent:r}=zy.navigator||{},o=Z_({user:n.getUser()||t.getUser(),...r&&{userAgent:r},...e}),i=t.getSession();return"ok"===i?.status&&Q_(i,{status:"exited"}),Px(),t.setSession(o),o}function Px(){const e=pw(),t=hw().getSession()||e.getSession();t&&function(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),Q_(e,n)}(t),Rx(),e.setSession()}function Rx(){const e=pw(),t=mw(),n=e.getSession()
|
|
743
|
+
;n&&t&&t.captureSession(n)}function Dx(e=!1){e?Px():Rx()}const jx="7";function Hx(e,t,n){return t||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){const n={sentry_version:jx};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(e,n)}`}const Fx=[];function $x(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach((e=>{e.isDefaultInstance=!0})),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.values(t)}(r)}function Bx(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function qx(e,t,n){
|
|
744
|
+
if(n[t.name])Oy&&Gy.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,Fx.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),Fx.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}Oy&&Gy.log(`Integration installed: ${t.name}`)}}function Ux(e,t){const n=t??function(e){return Gx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Pw(r)),ax(o,[(i=e,[{type:"log",item_count:i.length,content_type:"application/vnd.sentry.items.log+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());Gx().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function Gx(){
|
|
745
|
+
return Dy("clientToLogBufferMap",(()=>new WeakMap))}function Vx(e,t){const n=t??function(e){return Wx().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),o=function(e,t,n,r){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Pw(r)),ax(o,[(i=e,[{type:"trace_metric",item_count:i.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:i}])]);var i}(n,r._metadata,r.tunnel,e.getDsn());Wx().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function Wx(){return Dy("clientToMetricBufferMap",(()=>new WeakMap))}const Kx=Symbol.for("SentryBufferFullError");function Yx(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return vx(Kx);const o=r();return t.add(o),o.then((()=>n(o)),(()=>n(o))),o},drain:function(e){if(!t.size)return gx(!0);const n=Promise.allSettled(Array.from(t)).then((()=>!0));if(!e)return n;const r=[n,new Promise((t=>setTimeout((()=>t(!1)),e)))];return Promise.race(r)}}}
|
|
746
|
+
const Xx=6e4;function Zx(e,{statusCode:t,headers:n},r=Date.now()){const o={...e},i=n?.["x-sentry-rate-limits"],a=n?.["retry-after"];if(i)for(const e of i.trim().split(",")){const[t,n,,,i]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(n)for(const e of n.split(";"))"metric_bucket"===e&&i&&!i.split(";").includes("custom")||(o[e]=r+s);else o.all=r+s}else a?o.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?Xx:r-t}(a,r):429===t&&(o.all=r+6e4);return o}const Qx=64;function Jx(e,t,n=Yx(e.bufferSize||Qx)){let r={};return{send:function(o){const i=[];if(lx(o,((t,n)=>{const o=px(n);!function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,o)?i.push(t):e.recordDroppedEvent("ratelimit_backoff",o)})),0===i.length)return Promise.resolve({});const a=ax(o[0],i),s=t=>{lx(a,((n,r)=>{e.recordDroppedEvent(t,px(r))}))};return n.add((()=>t({body:ux(a)
|
|
747
|
+
}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Oy&&Gy.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=Zx(r,e),e)),(e=>{throw s("network_error"),Oy&&Gy.error("Encountered error running transport request:",e),e})))).then((e=>e),(e=>{if(e===Kx)return Oy&&Gy.error("Skipped sending event because buffer is full."),s("queue_overflow"),Promise.resolve({});throw e}))},flush:e=>n.drain(e)}}function ek(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const tk="Not capturing exception because it's already been captured.",nk="Discarded session because of missing or non-string release",rk=Symbol.for("SentryInternalError"),ok=Symbol.for("SentryDoNotSendEventError");function ik(e){return{message:e,[rk]:!0}}function ak(e){return{message:e,[ok]:!0}}function sk(e){return!!e&&"object"==typeof e&&rk in e}function lk(e){
|
|
748
|
+
return!!e&&"object"==typeof e&&ok in e}function ck(e,t,n,r,o){let i,a=0,s=!1;e.on(n,(()=>{a=0,clearTimeout(i),s=!1})),e.on(t,(t=>{a+=r(t),a>=8e5?o(e):s||(s=!0,i=setTimeout((()=>{o(e)}),5e3))})),e.on("flush",(()=>{o(e)}))}class uk{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Yx(e.transportOptions?.bufferSize??Qx),e.dsn?this._dsn=jw(e.dsn):Oy&&Gy.warn("No DSN provided, client will not send events."),this._dsn){const t=Hx(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&ck(this,"afterCaptureLog","flushLogs",fk,Ux);(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&ck(this,"afterCaptureMetric","flushMetrics",mk,Vx)}
|
|
749
|
+
captureException(e,t,n){const r=$_();if(V_(e))return Oy&&Gy.log(tk),r;const o={event_id:r,...t};return this._process((()=>this.eventFromException(e,o).then((e=>this._captureEvent(e,o,n))).then((e=>e))),"error"),o.event_id}captureMessage(e,t,n,r){const o={event_id:$_(),...n},i=v_(e)?e:String(e),a=b_(e),s=a?this.eventFromMessage(i,t,o):this.eventFromException(e,o);return this._process((()=>s.then((e=>this._captureEvent(e,o,r)))),a?"unknown":"error"),o.event_id}captureEvent(e,t,n){const r=$_();if(t?.originalException&&V_(t.originalException))return Oy&&Gy.log(tk),r;const o={event_id:r,...t},i=e.sdkProcessingMetadata||{},a=i.capturedSpanScope,s=i.capturedSpanIsolationScope,l=dk(e.type);return this._process((()=>this._captureEvent(e,o,a||n,s)),l),o.event_id}captureSession(e){this.sendSession(e),Q_(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const t=this._transport;if(!t)return!0
|
|
750
|
+
;this.emit("flush");const n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some((({name:e})=>e.startsWith("Spotlight"))))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const t=this._integrations[e.name];qx(this,e,this._integrations),t||Bx(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=fx(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=sx(n,dx(e));this.sendEnvelope(n).then((t=>this.emit("afterSendEvent",e,t)))}sendSession(e){const{release:t,environment:n=Jw}=this._options;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Oy&&Gy.warn(nk));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r
|
|
751
|
+
}else{if(!e.release&&!t)return void(Oy&&Gy.warn(nk));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const o=mx(n);return ax({sent_at:(new Date).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:Pw(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){const r=`${e}:${t}`;Oy&&Gy.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){const n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this._hooks[e];n&&n.forEach((e=>e(...t)))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return Oy&&Gy.error("Error while sending envelope:",e),{}}return Oy&&Gy.error("Transport disabled"),{}}
|
|
752
|
+
_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t&&qx(e,t,n)})),n}(this,e),Bx(this,e)}_updateSessionFromEvent(e,t){let n="fatal"===t.level,r=!1;const o=t.exception?.values;if(o){r=!0,n=!1;for(const e of o)if(!1===e.mechanism?.handled){n=!0;break}}const i="ok"===e.status;(i&&0===e.errors||i&&n)&&(Q_(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise((e=>setTimeout(e,1))),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r){const o=this.getOptions(),i=Object.keys(this._integrations);return!t.integrations&&i?.length&&(t.integrations=i),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Cx(o,e,t,n,this,r).then((e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:fw(n),...e.contexts}
|
|
753
|
+
;const r=function(e,t){const n=t.getPropagationContext();return n.dsc||tx(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e}))}_captureEvent(e,t={},n=hw(),r=pw()){return Oy&&hk(e)&&Gy.log(`Captured error event \`${ek(e)[0]||"<unknown>"}\``),this._processEvent(e,t,n,r).then((e=>e.event_id),(e=>{Oy&&(lk(e)?Gy.log(e.message):sk(e)?Gy.warn(e.message):Gy.warn(e))}))}_processEvent(e,t,n,r){const o=this.getOptions(),{sampleRate:i}=o,a=pk(e),s=hk(e),l=`before send for type \`${e.type||"error"}\``,c=void 0===i?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(i);if(s&&"number"==typeof c&&Math.random()>c)return this.recordDroppedEvent("sample_rate","error"),vx(ak(`Discarding event because it's not included in the random sample (sampling rate = ${i})`));const u=dk(e.type);return this._prepareEvent(e,t,n,r).then((e=>{
|
|
754
|
+
if(null===e)throw this.recordDroppedEvent("event_processor",u),ak("An event processor returned `null`, will not send event.");if(t.data&&!0===t.data.__sentry__)return e;const n=function(e,t,n,r){const{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:a,ignoreSpans:s}=t;let l=n;if(hk(l)&&o)return o(l,r);if(pk(l)){if(a||s){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:o,origin:i,data:a,op:s}=e.contexts?.trace??{};return{data:a??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:a?.[ww],exclusive_time:a?.[xw],measurements:e.measurements,is_segment:!0}}(l);if(s?.length&&Zw(t,s))return null;if(a){const e=a(t);e?l=J_(n,{type:"transaction",timestamp:(c=e).timestamp,start_timestamp:c.start_timestamp,transaction:c.description,contexts:{trace:{trace_id:c.trace_id,span_id:c.span_id,parent_span_id:c.parent_span_id,op:c.op,status:c.status,origin:c.origin,data:{...c.data,
|
|
755
|
+
...c.profile_id&&{[ww]:c.profile_id},...c.exclusive_time&&{[xw]:c.exclusive_time}}}},measurements:c.measurements}):Yw()}if(l.spans){const t=[],n=l.spans;for(const e of n)if(s?.length&&Zw(e,s))Qw(n,e);else if(a){const n=a(e);n?t.push(n):(Yw(),t.push(e))}else t.push(e);const r=l.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),l.spans=t}}if(i){if(l.spans){const e=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return i(l,r)}}var c;return l}(this,o,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(w_(e))return e.then((e=>{if(!y_(e)&&null!==e)throw ik(n);return e}),(e=>{throw ik(`${t} rejected with ${e}`)}));if(!y_(e)&&null!==e)throw ik(n);return e}(n,l)})).then((o=>{if(null===o){if(this.recordDroppedEvent("before_send",u),a){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw ak(`${l} returned \`null\`, will not send event.`)}const i=n.getSession()||r.getSession()
|
|
756
|
+
;if(s&&i&&this._updateSessionFromEvent(i,o),a){const e=(o.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(o.spans?o.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=o.transaction_info;if(a&&c&&o.transaction!==e.transaction){const e="custom";o.transaction_info={...c,source:e}}return this.sendEvent(o,t),o})).then(null,(e=>{if(lk(e)||sk(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:e}),ik(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e===Kx&&this.recordDroppedEvent("queue_overflow",t),e)))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map((([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}}))}_flushOutcomes(){
|
|
757
|
+
Oy&&Gy.log("Flushing outcomes...");const e=this._clearOutcomes();if(0===e.length)return void(Oy&&Gy.log("No outcomes to send"));if(!this._dsn)return void(Oy&&Gy.log("No dsn provided, will not send outcomes"));Oy&&Gy.log("Sending outcomes:",e);const t=(n=e,ax((r=this._options.tunnel&&Pw(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:K_(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function dk(e){return"replay_event"===e?"replay":e||"error"}function hk(e){return void 0===e.type}function pk(e){return"transaction"===e.type}function mk(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+gk(e.attributes)}function fk(e){let t=0;return e.message&&(t+=2*e.message.length),t+gk(e.attributes)}function gk(e){if(!e)return 0;let t=0;return Object.values(e).forEach((e=>{Array.isArray(e)?t+=e.length*vk(e[0]):b_(e)?t+=vk(e):t+=100})),t}function vk(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function bk(e,t){!0===t.debug&&(Oy?Gy.enable():$y((()=>{
|
|
758
|
+
console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})));hw().update(t.initialScope);const n=new e(t);return function(e){hw().setClient(e)}(n),n.init(),n}function yk(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function _k(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}const wk=100;function xk(e,t){const n=mw(),r=pw();if(!n)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=wk}=n.getOptions();if(i<=0)return;const a={timestamp:K_(),...e},s=o?$y((()=>o(a,t))):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.addBreadcrumb(s,i))}let kk;const Sk=new WeakMap,Ak=()=>({name:"FunctionToString",setupOnce(){kk=Function.prototype.toString;try{Function.prototype.toString=function(...e){
|
|
759
|
+
const t=O_(this),n=Sk.has(mw())&&void 0!==t?t:this;return kk.apply(n,e)}}catch{}},setup(e){Sk.set(e,!0)}}),Tk=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Ek=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=Mk(e,r)},processEvent(n,r,o){if(!t){const n=o.getOptions();t=Mk(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1
|
|
760
|
+
;const n=e.transaction;return!!n&&H_(n,t)}(e,t.ignoreTransactions))return Oy&&Gy.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${q_(e)}`),!0}else{if(function(e,t){if(!t?.length)return!1;return ek(e).some((e=>H_(e,t)))}(e,t.ignoreErrors))return Oy&&Gy.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${q_(e)}`),!0;if(function(e){if(!e.exception?.values?.length)return!1;return!e.message&&!e.exception.values.some((e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return Oy&&Gy.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${q_(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Nk(e);return!!n&&H_(n,t)}(e,t.denyUrls))return Oy&&Gy.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${q_(e)}.\nUrl: ${Nk(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Nk(e);return!n||H_(n,t)
|
|
761
|
+
}(e,t.allowUrls))return Oy&&Gy.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${q_(e)}.\nUrl: ${Nk(e)}`),!0}return!1}(n,t)?null:n}}},Ck=(e={})=>({...Ek(e),name:"InboundFilters"});function Mk(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Tk],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Nk(e){try{const t=[...e.exception?.values??[]].reverse().find((e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length)),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Oy&&Gy.error(`Cannot extract url for event ${q_(e)}`),null}}function Ik(e,t,n,r,o,i){if(!o.exception?.values||!i||!x_(i.originalException,Error))return
|
|
762
|
+
;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=Ok(e,t,r,i.originalException,n,o.exception.values,a,0))}function Ok(e,t,n,r,o,i,a,s){if(i.length>=n+1)return i;let l=[...i];if(x_(r[o],Error)){zk(a,s);const i=e(t,r[o]),c=l.length;Lk(i,o,c,s),l=Ok(e,t,n,r[o],o,[i,...l],i,c)}return Array.isArray(r.errors)&&r.errors.forEach(((r,i)=>{if(x_(r,Error)){zk(a,s);const c=e(t,r),u=l.length;Lk(c,`errors[${i}]`,u,s),l=Ok(e,t,n,r,o,[c,...l],c,u)}})),l}function zk(e,t){e.mechanism={handled:!0,type:"auto.core.linked_errors",...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Lk(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Pk(){"console"in zy&&jy.forEach((function(e){e in zy.console&&M_(zy.console,e,(function(t){return Fy[e]=t,function(...t){a_("console",{args:t,level:e});const n=Fy[e];n?.apply(zy.console,t)}}))}))}function Rk(e){
|
|
763
|
+
return"warn"===e?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const Dk=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){if(!t)return!1;if(function(e,t){const n=e.message,r=t.message;if(!n&&!r)return!1;if(n&&!r||!n&&r)return!1;if(n!==r)return!1;if(!Hk(e,t))return!1;if(!jk(e,t))return!1;return!0}(e,t))return!0;if(function(e,t){const n=Fk(t),r=Fk(e);if(!n||!r)return!1;if(n.type!==r.type||n.value!==r.value)return!1;if(!Hk(e,t))return!1;if(!jk(e,t))return!1;return!0}(e,t))return!0;return!1}(t,e))return Oy&&Gy.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function jk(e,t){let n=e_(e),r=e_(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],o=n[e];if(t.filename!==o.filename||t.lineno!==o.lineno||t.colno!==o.colno||t.function!==o.function)return!1}return!0}function Hk(e,t){let n=e.fingerprint,r=t.fingerprint
|
|
764
|
+
;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function Fk(e){return e.exception?.values?.[0]}function $k(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const Bk=zy;function qk(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Uk(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in Bk))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(qk(Bk.fetch))return!0;let e=!1;const t=Bk.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=qk(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Oy&&Gy.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}function Gk(e,t){const n="fetch";o_(n,e),i_(n,(()=>function(e,t=!1){if(t&&!Uk())return;M_(zy,"fetch",(function(e){return function(...t){
|
|
765
|
+
const n=new Error,{method:r,url:o}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:Wk(t),method:Vk(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Wk(t),method:Vk(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:r,url:o},startTimestamp:1e3*X_(),virtualError:n,headers:Kk(t)};return a_("fetch",{...i}),e.apply(zy,t).then((async e=>(a_("fetch",{...i,endTimestamp:1e3*X_(),response:e}),e)),(e=>{if(a_("fetch",{...i,endTimestamp:1e3*X_(),error:e}),h_(e)&&void 0===e.stack&&(e.stack=n.stack,N_(e,"framesToPop",1)),e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(i.fetchData.url);e.message=`${e.message} (${t.host})`}catch{}throw e}))}}))}(0,t)))}function Vk(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Wk(e){return"string"==typeof e?e:e?Vk(e,"url")?e.url:e.toString?e.toString():"":""}
|
|
766
|
+
function Kk(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(r=t,"undefined"!=typeof Request&&x_(r,Request))return new Headers(t.headers)}catch{}var r}const Yk=zy;let Xk=0;function Zk(){return Xk>0}function Qk(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.__sentry_wrapped__;if(t)return"function"==typeof t?t:e;if(O_(e))return e}catch{return e}const n=function(...n){try{const r=n.map((e=>Qk(e,t)));return e.apply(this,r)}catch(e){throw Xk++,setTimeout((()=>{Xk--})),function(...e){const t=dw(Py());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}t.withScope(e[0])}((r=>{r.addEventProcessor((e=>(t.mechanism&&(U_(e,void 0),G_(e,t.mechanism)),e.extra={...e.extra,arguments:n},e))),Ix(e)})),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}I_(n,e),N_(e,"__sentry_wrapped__",n);try{
|
|
767
|
+
Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Jk(e,t){const n=nS(e,t),r={type:iS(t),value:aS(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function eS(e,t,n,r){const o=mw(),i=o?.getOptions().normalizeDepth,a=function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}return}(t),s={__serialized__:ox(t,i)};if(a)return{exception:{values:[Jk(e,a)]},extra:s};const l={exception:{values:[{type:__(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:cS(t,{isUnhandledRejection:r})}]},extra:s};if(n){const t=nS(e,n);t.length&&(l.exception.values[0].stacktrace={frames:t})}return l}function tS(e,t){return{exception:{values:[Jk(e,t)]}}}function nS(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e&&rS.test(e.message))return 1;return 0}(t),o=function(e){
|
|
768
|
+
if("number"==typeof e.framesToPop)return e.framesToPop;return 0}(t);try{return e(n,r,o)}catch{}return[]}const rS=/Minified React error #\d+;/i;function oS(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function iS(e){const t=e?.name;if(!t&&oS(e)){return e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception"}return t}function aS(e){const t=e?.message;return oS(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function sS(e,t,n,r,o){let i;if(m_(t)&&t.error){return tS(e,t.error)}if(f_(t)||p_(t,"DOMException")){const o=t;if("stack"in t)i=tS(e,t);else{const t=o.name||(f_(o)?"DOMError":"DOMException"),a=o.message?`${t}: ${o.message}`:t;i=lS(e,a,n,r),U_(i,a)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}if(h_(t))return tS(e,t);if(y_(t)||__(t)){return i=eS(e,t,n,o),G_(i,{synthetic:!0
|
|
769
|
+
}),i}return i=lS(e,t,n,r),U_(i,`${t}`),G_(i,{synthetic:!0}),i}function lS(e,t,n,r){const o={};if(r&&n){const r=nS(e,n);r.length&&(o.exception={values:[{value:t,stacktrace:{frames:r}}]}),G_(o,{synthetic:!0})}if(v_(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return o.logentry={message:e,params:n},o}return o.message=t,o}function cS(e,{isUnhandledRejection:t}){const n=function(e){const t=Object.keys(z_(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),r=t?"promise rejection":"exception";if(m_(e))return`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``;if(__(e)){return`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`}return`Object captured as ${r} with keys: ${n}`}class uS extends uk{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Yk.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n
|
|
770
|
+
;!function(e,t,n=[t],r="npm"){const o=e._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${t}`,packages:n.map((e=>({name:`${r}:@sentry/${e}`,version:Ly}))),version:Ly}),e._metadata=o}(t,"browser",["browser"],Yk.SENTRY_SDK_SOURCE||"npm"),t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t._metadata.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:o,enableLogs:i,_experiments:a,enableMetrics:s}=this._options,l=s??a?.enableMetrics??!0;Yk.document&&(o||i||l)&&Yk.document.addEventListener("visibilitychange",(()=>{"hidden"===Yk.document.visibilityState&&(o&&this._flushOutcomes(),i&&Ux(this),l&&Vx(this))})),r&&this.on("beforeSendSession",_k)}eventFromException(e,t){return function(e,t,n,r){const o=sS(e,t,n?.syntheticException||void 0,r);return G_(o),o.level="error",n?.event_id&&(o.event_id=n.event_id),gx(o)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,o){
|
|
771
|
+
const i=lS(e,t,r?.syntheticException||void 0,o);return i.level=n,r?.event_id&&(i.event_id=r.event_id),gx(i)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n,r)}}const dS="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,hS=zy,pS=1e3;let mS,fS,gS,vS;function bS(){if(!hS.document)return;const e=a_.bind(null,"dom"),t=yS(e,!0);hS.document.addEventListener("click",t,!1),hS.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const n=hS,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(M_(r,"addEventListener",(function(t){return function(n,r,o){if("click"===n||"keypress"==n)try{const r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},i=r[n]=r[n]||{refCount:0};if(!i.handler){const r=yS(e);i.handler=r,t.call(this,n,r,o)}i.refCount++}catch{}return t.call(this,n,r,o)}})),M_(r,"removeEventListener",(function(e){return function(t,n,r){
|
|
772
|
+
if("click"===t||"keypress"==t)try{const n=this.__sentry_instrumentation_handlers__||{},o=n[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}})))}))}function yS(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;N_(n,"_sentryCaptured",!0),r&&!r._sentryId&&N_(r,"_sentryId",$_());const o="keypress"===n.type?"input":n.type;if(!function(e){if(e.type!==fS)return!1;try{if(!e.target||e.target._sentryId!==gS)return!1}catch{}return!0}(n)){e({event:n,name:o,global:t}),fS=n.type,gS=r?r._sentryId:void 0}clearTimeout(mS),mS=hS.setTimeout((()=>{gS=void 0,fS=void 0}),pS)}}function _S(e){const t="history";o_(t,e),i_(t,wS)}function wS(){function e(e){return function(...t){
|
|
773
|
+
const n=t.length>2?t[2]:void 0;if(n){const r=vS,o=function(e){try{return new URL(e,hS.location.origin).toString()}catch{return e}}(String(n));if(vS=o,r===o)return e.apply(this,t);a_("history",{from:r,to:o})}return e.apply(this,t)}}hS.addEventListener("popstate",(()=>{const e=hS.location.href,t=vS;if(vS=e,t===e)return;a_("history",{from:t,to:e})})),"history"in Bk&&Bk.history&&(M_(hS.history,"pushState",e),M_(hS.history,"replaceState",e))}const xS={};const kS="__sentry_xhr_v3__";function SS(){if(!hS.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,o=1e3*X_(),i=g_(n[0])?n[0].toUpperCase():void 0,a=function(e){if(g_(e))return e;try{return e.toString()}catch{}return}(n[1]);if(!i||!a)return e.apply(t,n);t[kS]={method:i,url:a,request_headers:{}},"POST"===i&&a.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const s=()=>{const e=t[kS];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}a_("xhr",{endTimestamp:1e3*X_(),startTimestamp:o,xhr:t,
|
|
774
|
+
virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(s(),e.apply(t,n))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,o]=n,i=t[kS];return i&&g_(r)&&g_(o)&&(i.request_headers[r.toLowerCase()]=o),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[kS];if(!r)return e.apply(t,n);void 0!==n[0]&&(r.body=n[0]);return a_("xhr",{startTimestamp:1e3*X_(),xhr:t}),e.apply(t,n)}})}const AS=40;function TS(e,t=function(e){const t=xS[e];if(t)return t;let n=hS[e];if(qk(n))return xS[e]=n.bind(hS);const r=hS.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const o=t.contentWindow;o?.[e]&&(n=o[e]),r.head.removeChild(t)}catch(t){dS&&Gy.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?xS[e]=n.bind(hS):n}("fetch")){
|
|
775
|
+
let n=0,r=0;return Jx(e,(async function(o){const i=o.body.length;n+=i,r++;const a={body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,a);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw xS["fetch"]=void 0,e}finally{n-=i,r--}}),Yx(e.bufferSize||AS))}const ES="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function CS(e,t,n,r){const o={filename:e,function:"<anonymous>"===t?Wy:t,in_app:!0};return void 0!==n&&(o.lineno=n),void 0!==r&&(o.colno=r),o}
|
|
776
|
+
const MS=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,NS=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,IS=/\((\S*)(?::(\d+))(?::(\d+))\)/,OS=/at (.+?) ?\(data:(.+?),/,zS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,LS=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,PS=Xy(...[[30,e=>{const t=e.match(OS);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=MS.exec(e);if(n){const[,e,t,r]=n;return CS(e,Wy,+t,+r)}const r=NS.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){const e=IS.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=RS(r[1]||Wy,r[2]);return CS(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=zS.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=LS.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Wy;return[n,e]=RS(n,e),
|
|
777
|
+
CS(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]]),RS=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Wy,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},DS=1024,jS=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";o_(t,e),i_(t,Pk)}(function(e){return function(t){if(mw()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:Rk(t.level),message:D_(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${D_(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}xk(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(mw()!==e)return;let r,o,i="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0
|
|
778
|
+
;a&&a>DS&&(ES&&Gy.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=DS),"string"==typeof i&&(i=[i]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=T_(t,{keyAttrs:i,maxStringLength:a}),o=function(e){if(!S_.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};o&&(s.data={"ui.component_name":o}),xk(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),o_("dom",n),i_("dom",bS)),t.xhr&&function(e){o_("xhr",e),i_("xhr",SS)}(function(e){return function(t){if(mw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,o=t.xhr[kS];if(!n||!r||!o)return;const{method:i,url:a,status_code:s,body:l}=o,c={method:i,url:a,status_code:s},u={xhr:t.xhr,
|
|
779
|
+
input:l,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:c,type:"http",level:$k(s)};e.emit("beforeOutgoingRequestBreadcrumb",d,u),xk(d,u)}}(e)),t.fetch&&Gk(function(e){return function(t){if(mw()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.fetchData.method,t.fetchData.url,t.error){const o=t.fetchData,i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,i),xk(a,i)}else{const o=t.response,i={...t.fetchData,status_code:o?.status};t.fetchData.request_body_size,t.fetchData.response_body_size,o?.status;const a={input:t.args,response:o,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,type:"http",level:$k(i.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",s,a),xk(s,a)}}}(e)),t.history&&_S(function(e){return function(t){if(mw()!==e)return;let n=t.from,r=t.to;const o=yk(Yk.location.href)
|
|
780
|
+
;let i=n?yk(n):void 0;const a=yk(r);i?.path||(i=o),o.protocol===a.protocol&&o.host===a.host&&(r=a.relative),o.protocol===i.protocol&&o.host===i.host&&(n=i.relative),xk({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){mw()===e&&xk({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:q_(t)},{event:t})}}(e))}}};const HS=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],FS=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,
|
|
781
|
+
setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&M_(Yk,"setTimeout",$S),t.setInterval&&M_(Yk,"setInterval",$S),t.requestAnimationFrame&&M_(Yk,"requestAnimationFrame",BS),t.XMLHttpRequest&&"XMLHttpRequest"in Yk&&M_(XMLHttpRequest.prototype,"send",qS);const e=t.eventTarget;if(e){(Array.isArray(e)?e:HS).forEach((e=>function(e,t){const n=Yk,r=n[e]?.prototype;if(!r?.hasOwnProperty?.("addEventListener"))return;M_(r,"addEventListener",(function(n){return function(r,o,i){try{"function"==typeof o.handleEvent&&(o.handleEvent=Qk(o.handleEvent,{mechanism:{data:{handler:Jy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,o),n.apply(this,[r,Qk(o,{mechanism:{data:{handler:Jy(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}
|
|
782
|
+
}),i])}})),M_(r,"removeEventListener",(function(e){return function(t,n,r){try{const o=n.__sentry_wrapped__;o&&e.call(this,t,o,r)}catch{}return e.call(this,t,n,r)}}))}(e,t)))}}}};function $S(e){return function(...t){const n=t[0];return t[0]=Qk(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Jy(e)}`}}),e.apply(this,t)}}function BS(e){return function(t){return e.apply(this,[Qk(t,{mechanism:{data:{handler:Jy(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function qS(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&M_(n,e,(function(t){const n={mechanism:{data:{handler:Jy(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=O_(t);return r&&(n.mechanism.data.handler=Jy(r)),Qk(t,n)}))})),e.apply(this,t)}}const US=()=>({name:"BrowserSession",setupOnce(){void 0!==Yk.document?(Lx({ignoreDuration:!0}),Dx(),_S((({from:e,to:t})=>{void 0!==e&&e!==t&&(Lx({
|
|
783
|
+
ignoreDuration:!0}),Dx())}))):ES&&Gy.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),GS=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(!function(e){!function(e){const t="error";o_(t,e),i_(t,l_)}((t=>{const{stackParser:n,attachStacktrace:r}=WS();if(mw()!==e||Zk())return;const{msg:o,url:i,line:a,column:s,error:l}=t,c=function(e,t,n,r){const o=e.exception=e.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=r,u=n,d=function(e){if(!g_(e)||0===e.length)return;if(e.startsWith("data:")){const t=e.match(/^data:([^;]+)/);return`<data:${t?t[1]:"text/javascript"}${e.includes("base64,")?",base64":""}>`}return e}(t)??C_();0===l.length&&l.push({colno:c,filename:d,function:Wy,in_app:!0,lineno:u});return e}(sS(n,l||o,void 0,r,!1),i,a,s);c.level="error",Ox(c,{originalException:l,mechanism:{handled:!1,
|
|
784
|
+
type:"auto.browser.global_handlers.onerror"}})}))}(e),VS("onerror")),t.onunhandledrejection&&(!function(e){!function(e){const t="unhandledrejection";o_(t,e),i_(t,u_)}((t=>{const{stackParser:n,attachStacktrace:r}=WS();if(mw()!==e||Zk())return;const o=function(e){if(b_(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),i=b_(o)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(o)}`}]}}:sS(n,o,void 0,r,!0);i.level="error",Ox(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}))}(e),VS("onunhandledrejection"))}}};function VS(e){ES&&Gy.log(`Global Handler attached: ${e}`)}function WS(){const e=mw();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const KS=()=>({name:"HttpContext",preprocessEvent(e){if(!Yk.navigator&&!Yk.location&&!Yk.document)return;const t=function(){
|
|
785
|
+
const e=C_(),{referrer:t}=Yk.document||{},{userAgent:n}=Yk.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),YS=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,o){Ik(Jk,o.getOptions().stackParser,n,t,e,r)}}};function XS(){return!!function(){if(void 0===Yk.window)return!1;const e=Yk;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=C_(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Yk===Yk.top&&r.some((e=>n.startsWith(`${e}://`))))}()&&(ES&&$y((()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")})),!0)}function ZS(e={}){const t=!e.skipBrowserExtensionCheck&&XS();let n=null==e.defaultIntegrations?[Ck(),Ak(),FS(),jS(),GS(),YS(),Dk(),KS(),US()]:e.defaultIntegrations
|
|
786
|
+
;const r={...e,enabled:!t&&e.enabled,stackParser:(o=e.stackParser||PS,Array.isArray(o)?Xy(...o):o),integrations:$x({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||TS};var o;return bk(uS,r)}let QS=0;function JS(e,t){Ix(e,{tags:{context:t}})}function eA(e){!function(e){pw().setUser(e)}(e)}class tA{constructor(e,t,n){this._store=e,this._annotationsService=t,this._toastMessenger=n}async import(e){this._store.beginImport(e.length);const t=this._store.profile().userid;if(!t)throw new Error("Cannot import when logged out");const n=this._store.focusedGroupId();if(!n)throw new Error("Cannot import when no group is selected");const r=this._store.allAnnotations(),o=this._store.defaultContentFrame(),i=async e=>{const i=r.find((t=>function(e,t){return e.text===t.text&&!!function(e,t){return e.length===t.length&&e.every(((e,n)=>t[n]===e))}(e.tags,t.tags)&&Yr(e)===Yr(t)}(e,t)));if(i)return{type:"duplicate",annotation:i};try{const r=function(e,t){return{target:e.target,tags:e.tags,text:e.text,
|
|
787
|
+
uri:t?.uri??e.uri,document:t?.metadata??e.document,extra:{source:"import",original_id:e.id}}}(e,o),i=this._annotationsService.annotationFromData(r);i.permissions=Tp(e.permissions)?Sp(t,n):kp(t);return{type:"import",annotation:await this._annotationsService.save(i)}}catch(e){return JS(e,"annotation-import"),{type:"error",error:e}}},a=[],s=e.map(((e,t)=>({ann:e,index:t}))),l=[];for(;s.length>0;){const e=s.shift(),t=i(e.ann).then((t=>{this._store.completeImport(1),a[e.index]=t})).then((()=>{const e=l.indexOf(t);-1!==e&&l.splice(e,1)}));l.push(t),l.length>=5&&await Promise.race(l)}await Promise.all(l);const{messageType:c,message:u}=function(e){const t=e.filter((e=>"error"===e.type)),n=t.length>0?`${t.length} imports failed (${t[0].error.message})`:"",r=e.filter((e=>"import"===e.type)).length,o=r>0?`${r} annotations imported`:"",i=e.filter((e=>"duplicate"===e.type)).length,a=i>0?`${i} duplicates skipped`:"";let s;return s=0===t.length?r>0?"success":"notice":r>0?"notice":"error",{messageType:s,
|
|
788
|
+
message:[o,n,a].filter((e=>e.length>0)).join(", ")}}(a);return"success"===c?this._toastMessenger.success(u):"notice"===c?this._toastMessenger.notice(u,{autoDismiss:!1}):"error"===c&&this._toastMessenger.error(u,{autoDismiss:!1}),a}}tA.$inject=["store","annotationsService","toastMessenger"];class nA{constructor(e,t,n,r){this._api=e,this._store=t,this._streamer=n,this._streamFilter=r,this._searchClient=null}load({groupId:e,uris:t,onError:n,maxResults:r,sortBy:o,sortOrder:i,streamFilterBy:a="uri"}){if(this._store.removeAnnotations(this._store.savedAnnotations()),this._searchClient&&this._searchClient.cancel(),"group"===a)this._streamFilter.resetFilter().addClause("/group","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()});else t&&t.length>0&&(this._streamFilter.resetFilter().addClause("/uri","one_of",t),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}));const s={incremental:!0,separateReplies:!1,maxResults:r,sortBy:o,sortOrder:i}
|
|
789
|
+
;this._searchClient=new Gf(this._api.search,s),this._searchClient.on("resultCount",(e=>{this._store.setAnnotationResultCount(e)})),this._searchClient.on("results",(e=>{e.length&&this._store.addAnnotations(e)})),this._searchClient.on("error",(e=>{"function"==typeof n?n(e):console.error(e)})),this._searchClient.on("end",(()=>{this._searchClient=null,t&&t.length>0&&this._store.frames().forEach((e=>{t.indexOf(e.uri)>=0&&this._store.updateFrameAnnotationFetchStatus(e.uri,!0)})),this._store.annotationFetchFinished()})),this._store.annotationFetchStarted(),this._searchClient.get({group:e,uri:t})}async loadThread(e){let t,n;this._store.clearAnnotations();try{this._store.annotationFetchStarted(),t=await this._api.annotation.get({id:e}),Rr(t)&&(t=await this._api.annotation.get({id:t.references[0]})),n=await this._api.search({references:t.id})}finally{this._store.annotationFetchFinished()}const r=[t,...n.rows];if(this._store.addAnnotations(r),!Rr(t)){const e=t.id
|
|
790
|
+
;this._streamFilter.addClause("/references","one_of",e,!0).addClause("/id","equals",e,!0),this._streamer.setConfig("filter",{filter:this._streamFilter.getFilter()}),this._streamer.connect()}return r}}nA.$inject=["api","store","streamer","streamFilter"];class rA{constructor(){this._store=new Map}getItem(e){return this._store.get(e)??null}setItem(e,t){this._store.set(e,t)}removeItem(e){this._store.delete(e)}}class oA{constructor(e){const t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch{this._storage=new rA}}getItem(e){return this._storage.getItem(e)}getObject(e){const t=this._storage.getItem(e);return t?JSON.parse(t):null}setItem(e,t){this._storage.setItem(e,t)}setObject(e,t){const n=JSON.stringify(t);this._storage.setItem(e,n)}removeItem(e){this._storage.removeItem(e)}}oA.$inject=["$window"];const iA={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class aA{constructor(e,t){
|
|
791
|
+
this._storage=e,this._store=t}init(){for(const[e,t]of ro(iA)){const n=this._storage.getItem(t);this._store.setDefault(e,n)}Ay(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(const[n,r]of ro(e))t[n]!==r&&n in iA&&this._storage.setItem(iA[n],r)}))}}aA.$inject=["localStorage","store"];class sA{constructor(e,t){this._window=e,this._store=t,this._didRegisterPopstateListener=!1}currentRoute(){const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(const[e,r]of t)n[e]=r;"client"===e[0]&&e.shift();let r;switch(e[0].replace(/\.html$/,"")){case"a":r="annotation",n.id=e[1]||"";break;case"notebook":r="notebook";break;case"user-profile":r="profile";break;case"stream":r="stream";break;default:r="sidebar"}return{route:r,params:n}}routeUrl(e,t={}){let n;const r={...t};switch(e){case"annotation":{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"profile":n="/user-profile";break;case"stream":n="/stream";break
|
|
792
|
+
;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(const[e,t]of Object.entries(r))o=!0,i.set(e,t);return o&&(n+="?"+i.toString()),n}sync(){const{route:e,params:t}=this.currentRoute();this._store.changeRoute(e,t),this._didRegisterPopstateListener||(this._window.addEventListener("popstate",(()=>{this.sync()})),this._didRegisterPopstateListener=!0)}navigate(e,t){this._window.history.pushState({},"",this.routeUrl(e,t)),this.sync()}}sA.$inject=["$window","store"];class lA{constructor(e,t){this._apiRoutes=e,this._store=t}async init(){try{const e=await this._apiRoutes.links();this._store.updateLinks(e)}catch(e){console.warn(`Failed to fetch Hypothesis links: ${e.message}`)}}}lA.$inject=["apiRoutes","store"];class cA{constructor(e,t,n,r,o){this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=Kn(r)?.authority??null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){
|
|
793
|
+
return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=sy((()=>{const e=this._authority?{authority:this._authority}:{};return this._api.profile.read(e)})).then((e=>(this.update(e),this._lastLoadTime=Date.now(),e))).catch((e=>{throw this._lastLoadTime=null,e}))),this._lastLoad}async dismissSidebarTutorial(){const e=await this._api.profile.update({},{preferences:{show_sidebar_tutorial:!1}});this.update(e)}async dismissYoutubeDisclaimer(){try{const e=await this._api.profile.update({},{preferences:{show_youtube_gdpr_banner:!1}});this.update(e)}catch(e){throw this._toastMessenger.error("Unable to dismiss YouTube disclaimer. Please try again."),e}}async updateShortcutPreferences(e){const t=await this._api.profile.update({},{preferences:{shortcuts_preferences:e}});this.update(t)}update(e){const t=this._store.profile(),n=e.userid!==t.userid;this._store.updateProfile(e);return lg(e.preferences?.shortcuts_preferences??{}),
|
|
794
|
+
this._lastLoad=Promise.resolve(e),this._lastLoadTime=Date.now(),n&&(e.userid?eA({id:e.userid}):eA(null)),e}async logout(){try{return await this._auth.logout(),this.reload()}catch(e){throw this._toastMessenger.error("Log out failed"),new Error(e)}}reload(){return this._lastLoad=null,this._lastLoadTime=null,this.load()}}cA.$inject=["store","api","auth","settings","toastMessenger"];class uA{constructor(){this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}}}addClause(e,t,n,r=!1){return this._filter.clauses.push({field:e,operator:t,value:n,case_sensitive:r}),this}getFilter(){return this._filter}resetFilter(){return this._filter={match_policy:"include_any",clauses:[],actions:{create:!0,update:!0,delete:!0}},this}}class dA extends Bf{constructor(e){super(),this._messageQueue=[],this._socket=new WebSocket(e),this._socket.onopen=e=>{this.sendMessages(),this.emit("open",e)},this._socket.onclose=e=>{if(1e3===e.code||1001===e.code)return void this.emit("close",e)
|
|
795
|
+
;const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},this._socket.onerror=e=>{this.emit("error",e)},this._socket.onmessage=e=>{this.emit("message",e)}}close(){this._socket.close(1e3)}send(e){this._messageQueue.push(e),this.isConnected()&&this.sendMessages()}isConnected(){return this._socket.readyState===WebSocket.OPEN}sendMessages(){for(;this._messageQueue.length>0;){const e=JSON.stringify(this._messageQueue.shift());this._socket.send(e)}}}class hA{constructor(e,t,n,r,o,i){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=kv(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1,this._window=i}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());if(e.length){this._store.addAnnotations(e),this._store.highlightAnnotations(e.map((({id:e})=>e)).filter(Boolean)),
|
|
796
|
+
this._window.setTimeout((()=>this._store.highlightAnnotations([])),5e3);const t=[...e].filter((e=>e.id)).sort(((e,t)=>e.updated.localeCompare(t.updated))),n=t[0];if(n?.id){const e=bf(n);this._store.selectTab(e),this._store.setAnnotationFocusRequest(n.id)}}const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})));t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}_handleSocketError(e,t){Iv("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&Iv("Check that your H service is configured to allow WebSocket connections from "+window.location.origin)}_handleSocketMessage(e){const t=JSON.parse(e.data);if(t)if("annotation-notification"===t.type){const e=t.payload;switch(t.options.action){case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}
|
|
797
|
+
this._updateImmediately&&this.applyPendingUpdates()}else if("session-change"===t.type)this._session.update(t.model),this._groups.load();else if("whoyouare"===t.type){const e=this._store.profile().userid;t.userid!==e&&console.warn('WebSocket user ID "%s" does not match logged-in ID "%s"',t.userid,e)}else Iv("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){this._configMessages[e]=t,this._socket?.isConnected()&&this._socket.send(t)}async _reconnect(){const e=await this._websocketURL;if(!e)return;let t,n;this._socket?.close();try{t=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(t){const r=new URL(e);r.searchParams.set("access_token",t),n=r.toString()}else n=e;const r=new dA(n);r.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(r)})),r.on("disconnect",(()=>{
|
|
798
|
+
if(++this._reconnectionAttempts,this._reconnectionAttempts<10){const e=1e3*2**this._reconnectionAttempts;setTimeout((()=>this._reconnect()),e)}else console.error("Gave up trying to reconnect to Hypothesis real time update service")})),r.on("error",(t=>this._handleSocketError(e,t))),r.on("message",(e=>this._handleSocketMessage(e))),this._socket=r,this.setConfig("client-id",{messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){this._updateImmediately=e.applyUpdatesImmediately??!0,this._reconnectSetUp||(this._reconnectSetUp=!0,Ay(this._store.subscribe,(()=>this._store.profile().userid),(()=>this._reconnect()))),this._socket||await this._reconnect()}}hA.$inject=["store","apiRoutes","auth","groups","session","$window"];const pA="hypothesis.user.tags.list",mA="hypothesis.user.tags.map";class fA{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject(pA)||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1
|
|
799
|
+
;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(mA)||{};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(mA,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(pA,n)}}fA.$inject=["localStorage"];class gA{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}gA.$inject=["store"];class vA{#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){
|
|
800
|
+
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()]}}vA.$inject=["frameSync"];class bA extends Bf{constructor(e,t){super(),this._store=e,this._window=t,this._delayedMessageQueue=[],this._window.addEventListener("focus",(()=>{this._delayedMessageQueue.forEach((({type:e,messageText:t,options:n})=>this._addMessage(e,t,n))),this._delayedMessageQueue=[]}))}dismiss(e){this._store.getToastMessage(e)&&(this._store.removeToastMessage(e),this.emit("toastMessageDismissed",e))}_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}
|
|
801
|
+
;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)}}bA.$inject=["store","$window"];const yA=function(e){for(var t={},n=e.querySelectorAll("script.js-hypothesis-config"),r=0;r<n.length;r++){var o=void 0;try{o=JSON.parse(n[r].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),o={}}Object.assign(t,o)}return t}(document),_A=function(e){const{version:t,origin:n}=Av(e.location.href);return"1.1749.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.1749.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."),
|
|
802
|
+
!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 wA(e,t){e.setClientId(t.clientId)}function xA(e){e.sync()}function kA(e,t){e.load(),t.load()}function SA(e,t,n){e.init(),t.init(),n.init()}function AA(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})}))}yA.sentry&&_A&&function(e){const t=function(){const e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;ZS({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.1749.0",beforeSend:(e,t)=>{if(QS>=5)return Iv("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++QS;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{}
|
|
803
|
+
return e}});try{zx("host_config",Av(window.location.href))}catch{}zx("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),by(((e,t)=>{JS(e,t)}))}(yA.sentry),document.body.addEventListener("click",(e=>{const t=e.target;"A"===t.tagName&&"_blank"===t.target&&(t.rel="noopener")})),wA.$inject=["api","streamer"],xA.$inject=["router"],kA.$inject=["groups","session"],SA.$inject=["autosaveService","persistedDefaults","serviceURL"],AA.$inject=["frameSync","store","toastMessenger"];const TA=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=>{
|
|
804
|
+
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);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),
|
|
805
|
+
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}(yA).then((e=>{!function(e,t){const n=new U;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",tA).register("loadAnnotationsService",nA).register("localStorage",oA).register("persistedDefaults",aA).register("router",sA).register("serviceURL",lA).register("session",cA).register("streamer",hA).register("streamFilter",uA).register("tags",fA).register("threadsService",gA).register("thumbnailService",vA).register("toastMessenger",bA).register("store",{factory:Hi}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(xA),n.run(SA),n.run(wA),n.run(kA),n.run(Fv),n.run(AA),
|
|
806
|
+
H(Ve(Jn.Provider,{value:n,children:Ve(_v,{})}),t)}(e,TA)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),H(Ve(wv,{error:e}),t)}(e,TA)));
|
|
805
807
|
//# sourceMappingURL=sidebar.bundle.js.map
|