hypothesis 1.980.0 → 1.984.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/boot.js +1 -1
- package/build/manifest.json +11 -11
- package/build/scripts/annotator.bundle.js +109 -108
- package/build/scripts/annotator.bundle.js.map +1 -1
- package/build/scripts/sidebar.bundle.js +352 -352
- package/build/scripts/sidebar.bundle.js.map +1 -1
- package/build/styles/annotator.css +239 -12
- package/build/styles/annotator.css.map +1 -1
- package/build/styles/sidebar.css +176 -12
- package/build/styles/sidebar.css.map +1 -1
- package/build/styles/ui-playground.css +178 -12
- package/build/styles/ui-playground.css.map +1 -1
- package/package.json +1 -1
|
@@ -145,48 +145,48 @@ this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmou
|
|
|
145
145
|
get:n})}return Qr((()=>e.subscribe((()=>{r.find((t=>t.method.apply(e,t.args)!==t.result))&&(r.splice(0,r.length),n(0))}))),[r,e]),o.current}const ai={collapsed:!1,depth:0,visible:!0,replyCount:0};function si(e){return e.id||e.$tag}function li(e,t,n){return!(!e[n]||e[n].parent===t)&&(!e[n].parent||li(e,t,e[n].parent))}function ci(e,t,n=[]){if(e[t].parent||!n.length)return;const r=n[n.length-1];e[r]||(e[r]={...ai,children:[],id:r},ci(e,r,n.slice(0,-1))),li(e,t,r)&&(e[t].parent=r,e[r].children.push(e[t]))}function ui(e,t){return Object.assign({},t(e),{children:e.children.map((e=>ui(e,t)))})}function hi(e,t,n){const r=e.children.map((e=>hi(e,n,n))).slice().sort(t);return{...e,children:r}}function di(e,t){const n=e.children.map((e=>di(e,t+1))),r=n.reduce(((e,t)=>e+1+t.replyCount),0);return{...e,children:n,depth:t,replyCount:r}}function pi(e){return e.children.some((e=>e.visible||pi(e)))}
|
|
146
146
|
const mi=(e,t)=>e.annotation&&t.annotation?e.annotation.created<t.annotation.created?-1:e.annotation.created>t.annotation.created?1:0:0;function fi(e,t){const n=t.selected.length>0,r=t.forcedVisible.length>0;let o=function(e){const t={};e.forEach((e=>{const n=si(e);t[n]={...ai,children:[],annotation:e,id:n}})),e.forEach((e=>{const n=(e.references||[]).filter((t=>t!==e.id));return ci(t,si(e),n)}));const n=[];for(const e in t)t[e].parent||(t[e].collapsed=!0,n.push(t[e]));return{...ai,id:"root",children:n}}(e);return n&&(o.children=o.children.filter((e=>{const n=t.selected.includes(e.id),o=r&&t.forcedVisible.includes(e.id);return n||o}))),t.threadFilterFn&&(o.children=o.children.filter(t.threadFilterFn)),o.visible=!1,o=ui(o,(e=>{let n=e.visible;return t.filterFn&&(n=!(!r||!t.forcedVisible.includes(e.id))||!!e.annotation&&!!t.filterFn(e.annotation)),{...e,visible:n}})),o.children=o.children.filter((e=>e.visible||pi(e))),o=ui(o,(e=>{const n={collapsed:e.collapsed}
|
|
147
147
|
;if(t.expanded.hasOwnProperty(e.id))n.collapsed=!t.expanded[e.id];else{const r=t.filterFn&&pi(e);n.collapsed=e.collapsed&&!r}return{...e,...n}})),o=hi(o,t.sortCompareFn,mi),o=di(o,-1),o}function gi(e){const t=e.slice(0,e.indexOf(":"));if(!t)return[null,e];if(["group","quote","since","tag","text","uri","user"].includes(t)){return[t,e.slice(t.length+1)]}return[null,e]}function vi(e){if(!e)return[];const t=function(e){const t=e.slice(0,1),n=e.slice(-1);return'"'!==t&&"'"!==t||t!==n||(e=e.slice(1,e.length-1)),e};let n=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g)||[];n=n.map(t);for(let e=0;e<n.length;e++){const r=n[e],[o,i]=gi(r);o&&(n[e]=o+":"+t(i))}return n}function yi(e){const t={},n=e=>"tag"===e?"tags":e,r=(e,n)=>t[e]?t[e].push(n):t[e]=[n];if(e){const t=vi(e);for(const e of t){let[t,o]=gi(e);t||(t="any",o=e),r(n(t),o)}}return t}function _i(e){const t=e.uri;let n;try{n=new URL(t).hostname}catch{n=""}"localhost"===n&&(n="");let r=n;return e.document&&e.document.title&&(r=e.document.title[0]),{uri:t,domain:n,title:r
|
|
148
|
-
}}function bi(e){let 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 wi(e){const t=_i(e);let n="";if(t.uri&&0===t.uri.indexOf("file://")&&t.title){const e=t.uri.split("/"),r=e[e.length-1];r&&(n=r)}else t.domain&&t.domain!==t.title&&(n=t.domain);return n}function xi(e){let t=_i(e).title;return t.length>30&&(t=t.slice(0,30)+"…"),t}function ki(e){return(e.references||[]).length>0}function Si(e){return
|
|
149
|
-
return!(!
|
|
150
|
-
const
|
|
151
|
-
;function
|
|
152
|
-
autofalse:e=>"string"!=typeof e.user,value:e=>e.user+" "+function(e){return e.user_info&&e.user_info.display_name||""}(e),match:(e,t)=>t.indexOf(e)>-1}};function
|
|
153
|
-
return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=
|
|
154
|
-
c.push(n);break;default:r.push(e)}}}return{any:{terms:r,operator:"and"},quote:{terms:o,operator:"and"},since:{terms:i,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{const n=t.terms.map(
|
|
155
|
-
filterQuery:n,filters:i}})),[t,n,r,o,i]);return
|
|
156
|
-
function m(e){return c=e,s=setTimeout(g,t),u?p(e):a}function f(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=i}function g(){var e=
|
|
157
|
-
this._listeners.forEach((({eventTarget:e,eventType:t,listener:n})=>{e.removeEventListener(t,n)})),this._listeners.clear()}}const
|
|
158
|
-
t.setSelectionRange(0,t.value.length),document.execCommand("copy")}finally{t.remove()}}function
|
|
159
|
-
var
|
|
160
|
-
children:[po("div",{className:"hyp-u-layout-row annotation-share-panel__inputs",children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share this annotation",type:"text",value:r,readOnly:!0,inputRef:s}),po(_o,{icon:"copy",title:"Copy share link to clipboard",onClick:()=>{try{
|
|
161
|
-
}(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=P(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=P(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return
|
|
162
|
-
l?n():i.openSidebarPanel("loginPrompt")}}),p&&po(
|
|
163
|
-
const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);eo((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new
|
|
164
|
-
linkStyle:ti(["selectionFontFamily"],s)})]})}),["settings"]);function
|
|
165
|
-
;const i=t.exec(o.pathname);if(!i)return null;const a=i[1];return
|
|
166
|
-
const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),
|
|
167
|
-
if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var
|
|
148
|
+
}}function bi(e){let 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 wi(e){const t=_i(e);let n="";if(t.uri&&0===t.uri.indexOf("file://")&&t.title){const e=t.uri.split("/"),r=e[e.length-1];r&&(n=r)}else t.domain&&t.domain!==t.title&&(n=t.domain);return n}function xi(e){let t=_i(e).title;return t.length>30&&(t=t.slice(0,30)+"…"),t}function ki(e){return(e.references||[]).length>0}function Si(e){return!!e.id}function Ci(e){return!e.id}function Ai(e){let t=!1;return e.permissions?(e.permissions.read.forEach((e=>{const n=e.split(":");2===n.length&&"group"===n[0]&&(t=!0)})),t):t}function Ei(e){return!!(e.target&&e.target.length>0&&e.target[0].selector)}function Ti(e){return Ei(e)&&void 0===e.$orphan&&!e.$anchorTimeout}function Ni(e){return!!e.hidden}function Li(e){return!!e.$highlight||!Ci(e)&&!(zi(e)||ki(e)||e.hidden||e.text||e.tags&&e.tags.length)}function Mi(e){return Ei(e)&&!0===e.$orphan}function zi(e){
|
|
149
|
+
return!Ei(e)&&!ki(e)}function Oi(e){return!(!Ei(e)||Mi(e))}function Ii(e){if(e){const t=e.target||[];for(let e=0;e<t.length;e++){const n=t[e].selector||[];for(const e of n)if("TextPositionSelector"===e.type)return e.start}}return Number.POSITIVE_INFINITY}function Ri(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));return n?n.exact:null}
|
|
150
|
+
const Pi=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u08FE\u0900-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C82\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D02\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26]/g
|
|
151
|
+
;function Di(e){return"string"!=typeof e?e:function(e){return e.replace(Pi,"")}((t=e,t.normalize("NFKD"))).toLowerCase();var t}class Bi{constructor(e,t,n){this.field=e,this.term=t,this.checker=n}matches(e){const t=this.checker;if(t.autofalse&&t.autofalse(e))return!1;let n=t.value(e);return n=Array.isArray(n)?n.map(Di):Di(n),t.match(this.term,n)}}class Fi{constructor(e,t){this.operator=e,this.filters=t}matches(e){return"and"===this.operator?this.filters.every((t=>t.matches(e))):this.filters.some((t=>t.matches(e)))}}const ji={quote:{autofalse:e=>(e.references||[]).length>0,value:e=>Ri(e)||"",match:(e,t)=>t.indexOf(e)>-1},since:{autofalse:e=>"string"!=typeof e.updated,value:e=>new Date(e.updated),match:(e,t)=>(Date.now()-t)/1e3<=e},tag:{autofalse:e=>!Array.isArray(e.tags),value:e=>e.tags,match:(e,t)=>t.includes(e)},text:{autofalse:e=>"string"!=typeof e.text,value:e=>e.text,match:(e,t)=>t.indexOf(e)>-1},uri:{autofalse:e=>"string"!=typeof e.uri,value:e=>e.uri,match:(e,t)=>t.indexOf(e)>-1},user:{
|
|
152
|
+
autofalse:e=>"string"!=typeof e.user,value:e=>e.user+" "+function(e){return e.user_info&&e.user_info.display_name||""}(e),match:(e,t)=>t.indexOf(e)>-1}};function Hi(e){return Mi(e)?"orphan":zi(e)?"note":"annotation"}function qi(e,t){const n=e.visible===t;return e.children.reduce(((e,n)=>e+qi(n,t)),n?1:0)}function Ui(e){return qi(e,!1)}function $i(e){return qi(e,!0)}function Gi(e){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 Gi(n);throw new Error("Thread contains no annotations")}function Vi(e){return Gi([e]).reduce(((e,t)=>t.created>e?t.created:e),"")}function Wi(e){return Gi([e]).reduce(((e,t)=>(e||(e=t.created),t.created<e?t.created:e)),"")}const Yi={Newest:function(e,t){const n=Vi(e),r=Vi(t);return n>r?-1:n<r?1:0},Oldest:function(e,t){const n=Wi(e),r=Wi(t);return n<r?-1:n>r?1:0},Location:function(e,t){if(!e.annotation||!t.annotation)return function(e,t){
|
|
153
|
+
return e.annotation||t.annotation?e.annotation?1:-1:0}(e,t);const n=Ii(e.annotation),r=Ii(t.annotation);return n<r?-1:n>r?1:0}};const Ki=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,sortCompareFn:Yi[t.sortKey]},r=!!t.filterQuery||Object.keys(t.filters).length>0;if(r){const e=function(e,t={}){let n;const r=[],o=[],i=[],a=[],s=[],l=[],c=t.user?[t.user]:[];if(e){n=vi(e);for(const e of n){const t=e.slice(0,e.indexOf(":")),n=e.slice(t.length+1);switch(t){case"quote":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";i.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":
|
|
154
|
+
c.push(n);break;default:r.push(e)}}}return{any:{terms:r,operator:"and"},quote:{terms:o,operator:"and"},since:{terms:i,operator:"and"},tag:{terms:a,operator:"and"},text:{terms:s,operator:"and"},uri:{terms:l,operator:"or"},user:{terms:c,operator:"or"}}}(t.filterQuery||"",t.filters);n.filterFn=t=>function(e,t){const n=Object.entries(t).filter((([,e])=>e.terms.length>0)).map((([e,t])=>{const n=t.terms.map(Di);let r;if("any"===e){const e=["quote","text","tag","user"];r=n.map((t=>new Fi("or",e.map((e=>new Bi(e,t,ji[e]))))))}else r=n.map((t=>new Bi(e,t,ji[e])));return new Fi(t.operator,r)})),r=new Fi("and",n);return e.filter((e=>e.id&&r.matches(e))).map((e=>e.id))}([t],e).length>0}return!r&&"sidebar"===e.route&&(n.threadFilterFn=e=>{return!!e.annotation&&(n=e.annotation,r=t.selectedTab,!Ti(n)&&Hi(n)===r);var n,r}),fi(e.annotations,n)}));function Xi(){const e=ii(),t=e.allAnnotations(),n=e.filterQuery(),r=e.route(),o=e.selectionState(),i=e.getFilterValues(),a=no((()=>({annotations:t,route:r,selection:{...o,
|
|
155
|
+
filterQuery:n,filters:i}})),[t,n,r,o,i]);return Ki(a)}var Zi=/^\s+|\s+$/g,Ji=/^[-+]0x[0-9a-f]+$/i,Qi=/^0b[01]+$/i,ea=/^0o[0-7]+$/i,ta=parseInt,na="object"==typeof X&&X&&X.Object===Object&&X,ra="object"==typeof self&&self&&self.Object===Object&&self,oa=na||ra||Function("return this")(),ia=Object.prototype.toString,aa=Math.max,sa=Math.min,la=function(){return oa.Date.now()};function ca(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ua(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==ia.call(e)}(e))return NaN;if(ca(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ca(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Zi,"");var n=Qi.test(e);return n||ea.test(e)?ta(e.slice(2),n?2:8):Ji.test(e)?NaN:+e}var ha=function(e,t,n){var r,o,i,a,s,l,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}
|
|
156
|
+
function m(e){return c=e,s=setTimeout(g,t),u?p(e):a}function f(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=i}function g(){var e=la();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return h?sa(n,i-(e-c)):n}(e))}function v(e){return s=void 0,d&&r?p(e):(r=o=void 0,a)}function y(){var e=la(),n=f(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return m(l);if(h)return s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=ua(t)||0,ca(n)&&(u=!!n.leading,i=(h="maxWait"in n)?aa(ua(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},y.flush=function(){return void 0===s?a:v(la())},y};class da{constructor(){this._listeners=new Map}add(e,t,n,r){e.addEventListener(t,n,r);const o=Symbol();return this._listeners.set(o,{eventTarget:e,eventType:t,listener:n}),o}remove(e){const t=this._listeners.get(e);if(t){const{eventTarget:n,eventType:r,listener:o}=t;n.removeEventListener(r,o),this._listeners.delete(e)}}removeAll(){
|
|
157
|
+
this._listeners.forEach((({eventTarget:e,eventType:t,listener:n})=>{e.removeEventListener(t,n)})),this._listeners.clear()}}const pa={defaultHeight:200,marginAbove:800,marginBelow:800};function ma(e){const t=window.getComputedStyle(e);return e.getBoundingClientRect().height+(parseFloat(t.marginTop)+parseFloat(t.marginBottom))}function fa(e){return/^http(s?):/i.test(e)}function ga(e){return{read:[e],update:[e],delete:[e]}}function va(e,t){return Object.assign(ga(e),{read:["group:"+t]})}function ya(e,t,n){return"private"===function(e){switch(e){case"private":case"shared":return e;default:return"shared"}}(n)&&e?ga(e):va(e,t)}function _a(e){return e.read.some((e=>0===e.indexOf("group:")))}function ba(e){return!_a(e)}function wa(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("data-testid","copy-text"),t.contentEditable="true",document.body.appendChild(t),t.focus();try{const e=document.createRange(),n=document.getSelection();n.removeAllRanges(),e.selectNodeContents(t),n.addRange(e),
|
|
158
|
+
t.setSelectionRange(0,t.value.length),document.execCommand("copy")}finally{t.remove()}}function xa({label:e,iconName:t,uri:n}){return po("li",{className:"ShareLinks__link",children:po("a",{"aria-label":e,href:n,title:e,target:"_blank",rel:"noopener noreferrer",children:po(Mo,{name:t,classes:"ShareLinks__icon"})})})}function ka({shareURI:e}){const t=encodeURIComponent(e);return po("ul",{className:"ShareLinks",children:[po(xa,{iconName:"twitter",label:"Tweet share link",uri:`https://twitter.com/intent/tweet?url=${t}&hashtags=annotated`}),po(xa,{iconName:"facebook",label:"Share on Facebook",uri:`https://www.facebook.com/sharer/sharer.php?u=${t}`}),po(xa,{iconName:"email",label:"Share via email",uri:`mailto:?subject=${encodeURIComponent("Let's Annotate")}&body=${t}`})]})}function Sa(){return((e=window.navigator,t="ontouchend"in document)=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e.platform)||e.userAgent.includes("Mac")&&t)()}
|
|
159
|
+
var Ca=ri((function({annotation:e,toastMessenger:t,group:n,shareUri:r}){const o=ba(e.permissions),i=fa(e.uri),a=to(null),s=to(null),[l,c]=Zr(!1),u=to(l);if(Ro(a,l,(()=>c(!1))),Qr((()=>{var e,t;u.current!==l&&(u.current=l,l&&!Sa()&&(null===(e=s.current)||void 0===e||e.focus(),null===(t=s.current)||void 0===t||t.select()))}),[l]),!n)return null;const h=i,d="private"===n.type?po("span",{children:["Only members of the group ",po("em",{children:n.name})," may view this annotation."]}):po("span",{children:"Anyone using this link may view this annotation."}),p=o?po("span",{children:"Only you may view this annotation."}):d;return po("div",{className:"AnnotationShareControl",ref:a,children:[po(_o,{icon:"share",title:"Share",onClick:()=>c(!l),expanded:l}),l&&po("div",{className:"annotation-share-panel",children:[po("div",{className:"annotation-share-panel__header",children:po("div",{className:"annotation-share-panel__title",children:"Share this annotation"})}),po("div",{className:"annotation-share-panel__content",
|
|
160
|
+
children:[po("div",{className:"hyp-u-layout-row annotation-share-panel__inputs",children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share this annotation",type:"text",value:r,readOnly:!0,inputRef:s}),po(_o,{icon:"copy",title:"Copy share link to clipboard",onClick:()=>{try{wa(r),t.success("Copied share link to clipboard")}catch(e){t.error("Unable to copy link")}},variant:"dark"})]})}),po("div",i?{className:"annotation-share-panel__details",children:p}:{className:"annotation-share-panel__details",children:"This annotation 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 annotation by itself."}),h&&po(ka,{shareURI:r})]}),po(Mo,{name:"pointer",classes:"annotation-share-panel__arrow"})]})]})}),["toastMessenger"]);var Aa=ri((function({annotation:e,annotationsService:t,onReply:n,settings:r,toastMessenger:o}){const i=ii(),a=i.profile(),s=i.getGroup(e.group),l=i.isLoggedIn(),c=t=>function(e,t,n){return-1!==e[t].indexOf(n||"")
|
|
161
|
+
}(e.permissions,t,a.userid),u=c("delete"),h=c("update"),d=function(e){const t=P(e);return!1!==(null==t?void 0:t.allowFlagging)}(r)&&!!a.userid&&a.userid!==e.user,p=function(e){const t=P(e);return!1!==(null==t?void 0:t.enableShareLinks)}(r)&&function(e){var t,n,r,o,i,a;return fa(e.uri)?null!==(t=null!==(n=null===(r=e.links)||void 0===r?void 0:r.incontext)&&void 0!==n?n:null===(o=e.links)||void 0===o?void 0:o.html)&&void 0!==t?t:null:null!==(i=null===(a=e.links)||void 0===a?void 0:a.html)&&void 0!==i?i:null}(e);return po("div",{className:"AnnotationActionBar hyp-u-layout-row text-xl font-medium",children:[h&&po(_o,{icon:"edit",title:"Edit",onClick:()=>{i.createDraft(e,{tags:e.tags,text:e.text,isPrivate:ba(e.permissions)})}}),u&&po(_o,{icon:"trash",title:"Delete",onClick:async()=>{if(await Xo({title:"Delete annotation?",message:"Are you sure you want to delete this annotation?",confirmAction:"Delete"}))try{await t.delete(e)}catch(e){o.error(e.message)}}}),po(_o,{icon:"reply",title:"Reply",onClick:()=>{
|
|
162
|
+
l?n():i.openSidebarPanel("loginPrompt")}}),p&&po(Ca,{annotation:e,group:s,shareUri:p}),d&&!e.flagged&&po(_o,{icon:"flag",title:"Report this annotation to moderators",onClick:()=>{t.flag(e).catch((()=>o.error("Flagging annotation failed")))}}),d&&e.flagged&&po(_o,{pressed:!0,icon:"flag--active",title:"Annotation has been reported to the moderators"})]})}),["annotationsService","settings","toastMessenger"]);function Ea({isCollapsed:e,setCollapsed:t,linkStyle:n={}}){return po("div",{className:"Excerpt__inline-controls",children:po("div",{className:"Excerpt__toggle-container",children:po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:()=>t(!e),expanded:!e,title:"Toggle visibility of full excerpt text",style:n,variant:"dark",children:e?"More":"Less"})})})}const Ta=()=>{};var Na=ri((function({children:e,collapse:t=!1,collapsedHeight:n,inlineControls:r=!0,onCollapsibleChanged:o=Ta,onToggleCollapsed:i=Ta,overflowThreshold:a=0,settings:s={}}){const[l,c]=Zr(!0),u=to(),[h,d]=Zr(0),p=ro((()=>{
|
|
163
|
+
const e=u.current.clientHeight;d(e);o(e>n+a)}),[n,o,a]);eo((()=>{const e=function(e,t){if("undefined"!=typeof ResizeObserver){const n=new ResizeObserver((()=>t(e.clientWidth,e.clientHeight)));return n.observe(e),()=>n.disconnect()}const n=new da;let r=e.clientWidth,o=e.clientHeight;const i=()=>{r===e.clientWidth&&o===e.clientHeight||(r=e.clientWidth,o=e.clientHeight,t(r,o))};n.add(e,"load",i),n.add(window,"resize",i);const a=new MutationObserver(i);return a.observe(e,{characterData:!0,childList:!0,subtree:!0}),()=>{n.removeAll(),a.disconnect()}}(u.current,p);return p(),e}),[p]);const m=h>n+a,f=m&&(r?l:t),g={};0!==h&&(g["max-height"]=f?n:h);const v=e=>r?c(e):i(e);return po("div",{className:"Excerpt",style:g,children:[po("div",{className:"Excerpt__content",ref:u,children:e}),po("div",{role:"presentation",onClick:()=>v(!1),className:qr({Excerpt__shadow:!0,"Excerpt__shadow--transparent":r,"is-hidden":!f}),title:"Show the full excerpt"}),m&&r&&po(Ea,{isCollapsed:l,setCollapsed:v,
|
|
164
|
+
linkStyle:ti(["selectionFontFamily"],s)})]})}),["settings"]);function La(e,t=16/9){const n=document.createElement("iframe");return n.src=e,n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",""),function(e,t){e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%";const n=document.createElement("div");return n.style.paddingBottom=1/t*100+"%",n.style.position="relative",n.appendChild(e),n}(n,t)}function Ma(e){const t=/(\d+)([hms]?)/g,n={h:3600,m:60,s:1};let r,o=0;for(;null!==(r=t.exec(e));)r[2]?o+=Number(r[1])*n[r[2]]:o+=+r[1];return o.toString()}function za(e,t){const n=function(e){const t=["end","start","t"],n=new URLSearchParams(e.search),r=new URLSearchParams;for(let[e,o]of n)t.includes(e)&&("t"===e?r.append("start",Ma(o)):r.append(e,o));r.sort();let o=r.toString();return o&&(o=`?${o}`),o}(t);return La(`https://www.youtube.com/embed/${e}${n}`)}function Oa(e,t,n,{aspectRatio:r}={}){return o=>{if(o.hostname!==e)return null
|
|
165
|
+
;const i=t.exec(o.pathname);if(!i)return null;const a=i[1];return La(n(a),r)}}const Ia=[function(e){if("www.youtube.com"!==e.hostname)return null;if(!/\/watch\/?/.test(e.pathname))return null;const t=/[&?]v=([^&#]+)/.exec(e.search);return t?za(t[1],e):null},function(e){if("youtu.be"!==e.hostname)return null;const t=/^\/([^/]+)\/?$/.exec(e.pathname);return t?za(t[1],e):null},Oa("vimeo.com",/^\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Oa("vimeo.com",/^\/channels\/[^/]+\/([^/?#]+)\/?$/,(e=>`https://player.vimeo.com/video/${e}`)),Oa("flipgrid.com",/^\/s\/([^/]+)$/,(e=>`https://flipgrid.com/s/${e}?embed=true`)),function(e){if("archive.org"!==e.hostname)return null;const t=/^\/(embed|details)\/(.+)/.exec(e.pathname);if(!t)return null;let n=t[2];const r=new URLSearchParams(e.search);let o=r.get("start"),i=r.get("end");if(!o){const e=n.match(/\/start\/([^/]+)/);e&&(o=e[1],n=n.replace(e[0],""))}if(!i){const e=n.match(/\/end\/([^/]+)/);e&&(i=e[1],n=n.replace(e[0],""))}
|
|
166
|
+
const a=new URL(`https://archive.org/embed/${n}`);return o&&a.searchParams.append("start",o),i&&a.searchParams.append("end",i),La(a.href)},function(e){return e.pathname.endsWith(".mp3")||e.pathname.endsWith(".ogg")||e.pathname.endsWith(".wav")?function(e){const t=document.createElement("audio");return t.controls=!0,t.src=e,t}(e.href):null}];function Ra(e){if(e.href!==e.textContent&&decodeURI(e.href)!==e.textContent)return null;const t=function(e){let t,n;for(n=0;n<Ia.length;n++)if(t=Ia[n](e),t)return t;return null}(e);return t&&e.parentElement.replaceChild(t,e),t}var Pa=Object.hasOwnProperty,Da=Object.setPrototypeOf,Ba=Object.isFrozen,Fa=Object.getPrototypeOf,ja=Object.getOwnPropertyDescriptor,Ha=Object.freeze,qa=Object.seal,Ua=Object.create,$a="undefined"!=typeof Reflect&&Reflect,Ga=$a.apply,Va=$a.construct;Ga||(Ga=function(e,t,n){return e.apply(t,n)}),Ha||(Ha=function(e){return e}),qa||(qa=function(e){return e}),Va||(Va=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){
|
|
167
|
+
if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var Wa,Ya=os(Array.prototype.forEach),Ka=os(Array.prototype.pop),Xa=os(Array.prototype.push),Za=os(String.prototype.toLowerCase),Ja=os(String.prototype.match),Qa=os(String.prototype.replace),es=os(String.prototype.indexOf),ts=os(String.prototype.trim),ns=os(RegExp.prototype.test),rs=(Wa=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Va(Wa,t)});function os(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ga(e,t,r)}}function is(e,t){Da&&Da(e,null);for(var n=t.length;n--;){var r=t[n];if("string"==typeof r){var o=Za(r);o!==r&&(Ba(t)||(t[n]=o),r=o)}e[r]=!0}return e}function as(e){var t=Ua(null),n=void 0;for(n in e)Ga(Pa,e,[n])&&(t[n]=e[n]);return t}function ss(e,t){for(;null!==e;){var n=ja(e,t);if(n){if(n.get)return os(n.get);if("function"==typeof n.value)return os(n.value)}e=Fa(e)}
|
|
168
168
|
return function(e){return console.warn("fallback value for",e),null}}
|
|
169
|
-
var
|
|
170
|
-
return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function
|
|
171
|
-
;var r=t.document,o=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,g=
|
|
172
|
-
writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),U=null,$=null,G=!0,V=!0,W=!1,Y=!1,K=!1,X=!1,Z=!1,J=!1,Q=!1,ee=!1,te=!0,ne=!0,re=!1,oe={},ie=null,ae=
|
|
173
|
-
be&&be===e||(e&&"object"===(void 0===e?"undefined":
|
|
174
|
-
e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(q.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ge=ge=-1===ve.indexOf(e.PARSER_MEDIA_TYPE)?ye:e.PARSER_MEDIA_TYPE,_e="application/xhtml+xml"===ge?function(e){return e}:
|
|
175
|
-
},Se=
|
|
176
|
-
"is"===e&&!j[e])if(J||Q)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,n=void 0;if(Z)e="<remove></remove>"+e;else{var r=
|
|
177
|
-
return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Ie=function(e){return"object"===(void 0===s?"undefined":
|
|
178
|
-
var o=_(e)||e.parentNode,i=y(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(g(i[a],!0),v(e))}if(!U[r]&&Be(r)){if(q.tagNameCheck instanceof RegExp&&
|
|
179
|
-
if(!(Be(e)&&(q.tagNameCheck instanceof RegExp&&
|
|
180
|
-
r=s.attrValue,!s.forceKeepAttr&&(Le(c,e),s.keepAttr))if(
|
|
181
|
-
if(e.nodeName){var d=_e(e.nodeName);if(!B[d]||U[d])throw
|
|
182
|
-
n.removeHook=function(e){L[e]&&
|
|
183
|
-
;n=o.start;var a=o.end;n===i.length?r+=" at end of input: ":r+=" at position "+(n+1)+": ";var s=i.slice(n,a).replace(/[^]/g,"$&̲");r+=(n>15?"…"+i.slice(n-15,n):i.slice(0,n))+s+(a+15<i.length?i.slice(a,a+15)+"…":i.slice(a))}var l=new Error(r);return l.name="ParseError",l.__proto__=
|
|
184
|
-
},
|
|
169
|
+
var ls=Ha(["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","section","select","shadow","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"]),cs=Ha(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),us=Ha(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),hs=Ha(["animate","color-profile","cursor","discard","fedropshadow","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"]),ds=Ha(["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"]),ps=Ha(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ms=Ha(["#text"]),fs=Ha(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),gs=Ha(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","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"]),vs=Ha(["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"]),ys=Ha(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_s=qa(/\{\{[\s\S]*|[\s\S]*\}\}/gm),bs=qa(/<%[\s\S]*|[\s\S]*%>/gm),ws=qa(/^data-[\-\w.\u00B7-\uFFFF]/),xs=qa(/^aria-[\-\w]+$/),ks=qa(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ss=qa(/^(?:\w+script|data):/i),Cs=qa(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),As="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){
|
|
170
|
+
return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Es(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var Ts=function(){return"undefined"==typeof window?null:window},Ns=function(e,t){if("object"!==(void 0===e?"undefined":As(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};var Ls=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ts(),n=function(t){return e(t)};if(n.version="2.3.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n
|
|
171
|
+
;var r=t.document,o=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,g=ss(f,"cloneNode"),v=ss(f,"nextSibling"),y=ss(f,"childNodes"),_=ss(f,"parentNode");if("function"==typeof a){var b=o.createElement("template");b.content&&b.content.ownerDocument&&(o=b.content.ownerDocument)}var w=Ns(m,r),x=w?w.createHTML(""):"",k=o,S=k.implementation,C=k.createNodeIterator,A=k.createDocumentFragment,E=k.getElementsByTagName,T=r.importNode,N={};try{N=as(o).documentMode?o.documentMode:{}}catch(e){}var L={};n.isSupported="function"==typeof _&&S&&void 0!==S.createHTMLDocument&&9!==N;var M=_s,z=bs,O=ws,I=xs,R=Ss,P=Cs,D=ks,B=null,F=is({},[].concat(Es(ls),Es(cs),Es(us),Es(ds),Es(ms))),j=null,H=is({},[].concat(Es(fs),Es(gs),Es(vs),Es(ys))),q=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{
|
|
172
|
+
writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),U=null,$=null,G=!0,V=!0,W=!1,Y=!1,K=!1,X=!1,Z=!1,J=!1,Q=!1,ee=!1,te=!0,ne=!0,re=!1,oe={},ie=null,ae=is({},["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"]),se=null,le=is({},["audio","video","img","source","image","track"]),ce=null,ue=is({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",de="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml",me=pe,fe=!1,ge=void 0,ve=["application/xhtml+xml","text/html"],ye="text/html",_e=void 0,be=null,we=o.createElement("form"),xe=function(e){return e instanceof RegExp||e instanceof Function},ke=function(e){
|
|
173
|
+
be&&be===e||(e&&"object"===(void 0===e?"undefined":As(e))||(e={}),e=as(e),B="ALLOWED_TAGS"in e?is({},e.ALLOWED_TAGS):F,j="ALLOWED_ATTR"in e?is({},e.ALLOWED_ATTR):H,ce="ADD_URI_SAFE_ATTR"in e?is(as(ue),e.ADD_URI_SAFE_ATTR):ue,se="ADD_DATA_URI_TAGS"in e?is(as(le),e.ADD_DATA_URI_TAGS):le,ie="FORBID_CONTENTS"in e?is({},e.FORBID_CONTENTS):ae,U="FORBID_TAGS"in e?is({},e.FORBID_TAGS):{},$="FORBID_ATTR"in e?is({},e.FORBID_ATTR):{},oe="USE_PROFILES"in e&&e.USE_PROFILES,G=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=e.SAFE_FOR_TEMPLATES||!1,K=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Q=e.RETURN_DOM_FRAGMENT||!1,ee=e.RETURN_TRUSTED_TYPE||!1,Z=e.FORCE_BODY||!1,te=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,D=e.ALLOWED_URI_REGEXP||D,me=e.NAMESPACE||pe,e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),
|
|
174
|
+
e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(q.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ge=ge=-1===ve.indexOf(e.PARSER_MEDIA_TYPE)?ye:e.PARSER_MEDIA_TYPE,_e="application/xhtml+xml"===ge?function(e){return e}:Za,Y&&(V=!1),Q&&(J=!0),oe&&(B=is({},[].concat(Es(ms))),j=[],!0===oe.html&&(is(B,ls),is(j,fs)),!0===oe.svg&&(is(B,cs),is(j,gs),is(j,ys)),!0===oe.svgFilters&&(is(B,us),is(j,gs),is(j,ys)),!0===oe.mathMl&&(is(B,ds),is(j,vs),is(j,ys))),e.ADD_TAGS&&(B===F&&(B=as(B)),is(B,e.ADD_TAGS)),e.ADD_ATTR&&(j===H&&(j=as(j)),is(j,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&is(ce,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(ie===ae&&(ie=as(ie)),is(ie,e.FORBID_CONTENTS)),ne&&(B["#text"]=!0),K&&is(B,["html","head","body"]),B.table&&(is(B,["tbody"]),delete U.tbody),Ha&&Ha(e),be=e)
|
|
175
|
+
},Se=is({},["mi","mo","mn","ms","mtext"]),Ce=is({},["foreignobject","desc","title","annotation-xml"]),Ae=is({},cs);is(Ae,us),is(Ae,hs);var Ee=is({},ds);is(Ee,ps);var Te=function(e){var t=_(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});var n=Za(e.tagName),r=Za(t.tagName);if(e.namespaceURI===de)return t.namespaceURI===pe?"svg"===n:t.namespaceURI===he?"svg"===n&&("annotation-xml"===r||Se[r]):Boolean(Ae[n]);if(e.namespaceURI===he)return t.namespaceURI===pe?"math"===n:t.namespaceURI===de?"math"===n&&Ce[r]:Boolean(Ee[n]);if(e.namespaceURI===pe){if(t.namespaceURI===de&&!Ce[r])return!1;if(t.namespaceURI===he&&!Se[r])return!1;var o=is({},["title","style","font","a","script"]);return!Ee[n]&&(o[n]||!Ae[n])}return!1},Ne=function(e){Xa(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=x}catch(t){e.remove()}}},Le=function(e,t){try{Xa(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Xa(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),
|
|
176
|
+
"is"===e&&!j[e])if(J||Q)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Me=function(e){var t=void 0,n=void 0;if(Z)e="<remove></remove>"+e;else{var r=Ja(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=w?w.createHTML(e):e;if(me===pe)try{t=(new p).parseFromString(i,ge)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(me,"template",null);try{t.documentElement.innerHTML=fe?"":i}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),me===pe?E.call(t,K?"html":"body")[0]:K?t.documentElement:a},ze=function(e){return C.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Oe=function(e){
|
|
177
|
+
return e instanceof d&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},Ie=function(e){return"object"===(void 0===s?"undefined":As(s))?e instanceof s:e&&"object"===(void 0===e?"undefined":As(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Re=function(e,t,r){L[e]&&Ya(L[e],(function(e){e.call(n,t,r,be)}))},Pe=function(e){var t=void 0;if(Re("beforeSanitizeElements",e,null),Oe(e))return Ne(e),!0;if(Ja(e.nodeName,/[\u0080-\uFFFF]/))return Ne(e),!0;var r=_e(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:r,allowedTags:B}),!Ie(e.firstElementChild)&&(!Ie(e.content)||!Ie(e.content.firstElementChild))&&ns(/<[/\w]/g,e.innerHTML)&&ns(/<[/\w]/g,e.textContent))return Ne(e),!0;if("select"===r&&ns(/<template/i,e.innerHTML))return Ne(e),!0;if(!B[r]||U[r]){if(ne&&!ie[r]){
|
|
178
|
+
var o=_(e)||e.parentNode,i=y(e)||e.childNodes;if(i&&o)for(var a=i.length-1;a>=0;--a)o.insertBefore(g(i[a],!0),v(e))}if(!U[r]&&Be(r)){if(q.tagNameCheck instanceof RegExp&&ns(q.tagNameCheck,r))return!1;if(q.tagNameCheck instanceof Function&&q.tagNameCheck(r))return!1}return Ne(e),!0}return e instanceof l&&!Te(e)?(Ne(e),!0):"noscript"!==r&&"noembed"!==r||!ns(/<\/no(script|embed)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,t=Qa(t,M," "),t=Qa(t,z," "),e.textContent!==t&&(Xa(n.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Ne(e),!0)},De=function(e,t,n){if(te&&("id"===t||"name"===t)&&(n in o||n in we))return!1;if(V&&!$[t]&&ns(O,t));else if(G&&ns(I,t));else if(!j[t]||$[t]){
|
|
179
|
+
if(!(Be(e)&&(q.tagNameCheck instanceof RegExp&&ns(q.tagNameCheck,e)||q.tagNameCheck instanceof Function&&q.tagNameCheck(e))&&(q.attributeNameCheck instanceof RegExp&&ns(q.attributeNameCheck,t)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(t))||"is"===t&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&ns(q.tagNameCheck,n)||q.tagNameCheck instanceof Function&&q.tagNameCheck(n))))return!1}else if(ce[t]);else if(ns(D,Qa(n,P,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==es(n,"data:")||!se[e]){if(W&&!ns(R,Qa(n,P,"")));else if(n)return!1}else;return!0},Be=function(e){return e.indexOf("-")>0},Fe=function(e){var t=void 0,r=void 0,o=void 0,i=void 0;Re("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j};for(i=a.length;i--;){var l=t=a[i],c=l.name,u=l.namespaceURI;if(r=ts(t.value),o=_e(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,s),
|
|
180
|
+
r=s.attrValue,!s.forceKeepAttr&&(Le(c,e),s.keepAttr))if(ns(/\/>/i,r))Le(c,e);else{Y&&(r=Qa(r,M," "),r=Qa(r,z," "));var h=_e(e.nodeName);if(De(h,o,r))try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),Ka(n.removed)}catch(e){}}}Re("afterSanitizeAttributes",e,null)}},je=function e(t){var n=void 0,r=ze(t);for(Re("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Re("uponSanitizeShadowNode",n,null),Pe(n)||(n.content instanceof i&&e(n.content),Fe(n));Re("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,o){var a=void 0,l=void 0,c=void 0,u=void 0,h=void 0;if((fe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ie(e)){if("function"!=typeof e.toString)throw rs("toString is not a function");if("string"!=typeof(e=e.toString()))throw rs("dirty is not a string, aborting")}if(!n.isSupported){if("object"===As(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Ie(e))return t.toStaticHTML(e.outerHTML)}return e}if(X||ke(o),n.removed=[],"string"==typeof e&&(re=!1),re){
|
|
181
|
+
if(e.nodeName){var d=_e(e.nodeName);if(!B[d]||U[d])throw rs("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof s)1===(l=(a=Me("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!J&&!Y&&!K&&-1===e.indexOf("<"))return w&&ee?w.createHTML(e):e;if(!(a=Me(e)))return J?null:ee?x:""}a&&Z&&Ne(a.firstChild);for(var p=ze(re?e:a);c=p.nextNode();)3===c.nodeType&&c===u||Pe(c)||(c.content instanceof i&&je(c.content),Fe(c),u=c);if(u=null,re)return e;if(J){if(Q)for(h=A.call(a.ownerDocument);a.firstChild;)h.appendChild(a.firstChild);else h=a;return j.shadowroot&&(h=T.call(r,h,!0)),h}var m=K?a.outerHTML:a.innerHTML;return Y&&(m=Qa(m,M," "),m=Qa(m,z," ")),w&&ee?w.createHTML(m):m},n.setConfig=function(e){ke(e),X=!0},n.clearConfig=function(){be=null,X=!1},n.isValidAttribute=function(e,t,n){be||ke({});var r=_e(e),o=_e(t);return De(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(L[e]=L[e]||[],Xa(L[e],t))},
|
|
182
|
+
n.removeHook=function(e){L[e]&&Ka(L[e])},n.removeHooks=function(e){L[e]&&(L[e]=[])},n.removeAllHooks=function(){L={}},n}(),Ms=/["'&<>]/,zs=function(e){var t,n=""+e,r=Ms.exec(n);if(!r)return n;var o="",i=0,a=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}a!==i&&(o+=n.substring(a,i)),a=i+1,o+=t}return a!==i?o+n.substring(a,i):o};class Os{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 Os(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class Is{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 Is(t,Os.range(this,e))}}class Rs{constructor(e,t){this.position=void 0;var n,r="KaTeX parse error: "+e,o=t&&t.loc;if(o&&o.start<=o.end){var i=o.lexer.input
|
|
183
|
+
;n=o.start;var a=o.end;n===i.length?r+=" at end of input: ":r+=" at position "+(n+1)+": ";var s=i.slice(n,a).replace(/[^]/g,"$&̲");r+=(n>15?"…"+i.slice(n-15,n):i.slice(0,n))+s+(a+15<i.length?i.slice(a,a+15)+"…":i.slice(a))}var l=new Error(r);return l.name="ParseError",l.__proto__=Rs.prototype,l.position=n,l}}Rs.prototype.__proto__=Error.prototype;var Ps=/([A-Z])/g,Ds={"&":"&",">":">","<":"<",'"':""","'":"'"},Bs=/[&><"']/g;var Fs=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},js={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(Bs,(e=>Ds[e]))},hyphenate:function(e){return e.replace(Ps,"-$1").toLowerCase()},getBaseElem:Fs,isCharacterBox:function(e){var t=Fs(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(e);return null!=t?t[1]:"_relative"}
|
|
184
|
+
},Hs={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>",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",
|
|
185
185
|
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"],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"],
|
|
186
|
-
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
|
|
187
|
-
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||{},
|
|
188
|
-
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){e.url&&!e.protocol&&(e.protocol=
|
|
189
|
-
var
|
|
186
|
+
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 qs(e){if(e.default)return e.default;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 Us{constructor(e){for(var t in this.displayMode=void 0,
|
|
187
|
+
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||{},Hs)if(Hs.hasOwnProperty(t)){var n=Hs[t];this[t]=void 0!==e[t]?n.processor?n.processor(e[t]):e[t]:qs(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 Rs("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",n);"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"}
|
|
188
|
+
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){e.url&&!e.protocol&&(e.protocol=js.protocolFromUrl(e.url));var t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}class $s{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 Gs[Vs[this.id]]}sub(){return Gs[Ws[this.id]]}fracNum(){return Gs[Ys[this.id]]}fracDen(){return Gs[Ks[this.id]]}cramp(){return Gs[Xs[this.id]]}text(){return Gs[Zs[this.id]]}isTight(){return this.size>=2}}
|
|
189
|
+
var Gs=[new $s(0,0,!1),new $s(1,0,!0),new $s(2,1,!1),new $s(3,1,!0),new $s(4,2,!1),new $s(5,2,!0),new $s(6,3,!1),new $s(7,3,!0)],Vs=[4,5,4,5,6,7,6,7],Ws=[5,5,5,5,7,7,7,7],Ys=[2,3,4,5,6,7,6,7],Ks=[3,3,5,5,7,7,7,7],Xs=[1,1,3,3,5,5,7,7],Zs=[0,1,2,3,2,3,2,3],Js={DISPLAY:Gs[0],TEXT:Gs[2],SCRIPT:Gs[4],SCRIPTSCRIPT:Gs[6]},Qs=[{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 el=[];function tl(e){for(var t=0;t<el.length;t+=2)if(e>=el[t]&&e<=el[t+1])return!0;return!1}Qs.forEach((e=>e.blocks.forEach((e=>el.push(...e)))));var nl={
|
|
190
190
|
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",
|
|
191
191
|
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",
|
|
192
192
|
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",
|
|
@@ -206,7 +206,7 @@ widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,
|
|
|
206
206
|
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",
|
|
207
207
|
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",
|
|
208
208
|
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",
|
|
209
|
-
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
|
|
209
|
+
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 rl{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 js.contains(this.classes,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 ol={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],
|
|
210
210
|
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],
|
|
211
211
|
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],
|
|
212
212
|
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],
|
|
@@ -263,186 +263,186 @@ shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,
|
|
|
263
263
|
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],
|
|
264
264
|
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],
|
|
265
265
|
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],
|
|
266
|
-
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]}},
|
|
267
|
-
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]},
|
|
268
|
-
"а":"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
|
|
269
|
-
this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||
|
|
270
|
-
textSize:e,sizeMultiplier:
|
|
271
|
-
cssEmPerMu:
|
|
272
|
-
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)}},
|
|
273
|
-
this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,
|
|
274
|
-
;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='"+this.src+" 'alt='"+this.alt+"' ",t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=
|
|
275
|
-
/[îïíì]/.test(this.text)&&(this.text=
|
|
276
|
-
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+"='"+this.attributes[t]+"'");e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class
|
|
277
|
-
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+"='"+this.attributes[t]+"'");return e+="/>"}}function
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
return
|
|
300
|
-
i.maxFontSize>r&&(r=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},
|
|
301
|
-
mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},
|
|
302
|
-
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 h=e.children[u];c-="kern"===h.type?h.size:h.elem.height+h.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var d=e.children[0];if("elem"!==d.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-d.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-d.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=
|
|
303
|
-
var f=m.elem,g=m.wrapperClasses||[],v=m.wrapperStyle||{},y=
|
|
304
|
-
if(120485===n||120486===n)return[
|
|
305
|
-
;return
|
|
306
|
-
mord:
|
|
307
|
-
},
|
|
308
|
-
var n=
|
|
309
|
-
r=
|
|
310
|
-
var h=i.children[0];h.style.height=
|
|
311
|
-
;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
|
|
312
|
-
return this.character?this.character:" "}},newDocumentFragment:
|
|
313
|
-
;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
|
|
314
|
-
;if(c instanceof
|
|
315
|
-
},
|
|
266
|
+
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]}},il={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],
|
|
267
|
+
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]},al={"Å":"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",
|
|
268
|
+
"а":"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 sl(e,t,n){if(!ol[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),o=ol[t][r];if(!o&&e[0]in al&&(r=al[e[0]].charCodeAt(0),o=ol[t][r]),o||"text"!==n||tl(r)&&(o=ol[t][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var ll={};var cl=[[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]],ul=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],hl=function(e,t){return t.size<2?e:cl[e-1][t.size-1]};class dl{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,
|
|
269
|
+
this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||dl.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=ul[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 dl(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:hl(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,
|
|
270
|
+
textSize:e,sizeMultiplier:ul[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=hl(dl.BASESIZE,e);return this.size===t&&this.textSize===dl.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!==dl.BASESIZE?["sizing","reset-size"+this.size,"size"+dl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=function(e){var t;if(!ll[t=e>=5?0:e>=3?1:2]){var n=ll[t]={
|
|
271
|
+
cssEmPerMu:il.quad[t]/18};for(var r in il)il.hasOwnProperty(r)&&(n[r]=il[r][t])}return ll[t]}(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}dl.BASESIZE=6;var pl={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},ml={ex:!0,em:!0,mu:!0},fl=function(e){return"string"!=typeof e&&(e=e.unit),e in pl||e in ml||"ex"===e},gl=function(e,t){var n;if(e.unit in pl)n=pl[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 Rs("Invalid unit: '"+e.unit+"'");n=r.fontMetrics().quad}r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},vl=function(e){return+e.toFixed(4)+"em"},yl=function(e){return e.filter((e=>e)).join(" ")},_l=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,
|
|
272
|
+
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)}},bl=function(e){var t=document.createElement(e);for(var n in t.className=yl(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},wl=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+js.escape(yl(this.classes))+'"');var n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=js.hyphenate(r)+":"+this.style[r]+";");for(var o in n&&(t+=' style="'+js.escape(n)+'"'),this.attributes)this.attributes.hasOwnProperty(o)&&(t+=" "+o+'="'+js.escape(this.attributes[o])+'"');t+=">";for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+="</"+e+">"};class xl{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,
|
|
273
|
+
this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,_l.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return js.contains(this.classes,e)}toNode(){return bl.call(this,"span")}toMarkup(){return wl.call(this,"span")}}class kl{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,_l.call(this,t,r),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return js.contains(this.classes,e)}toNode(){return bl.call(this,"a")}toMarkup(){return wl.call(this,"a")}}class Sl{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}hasClass(e){return js.contains(this.classes,e)}toNode(){var e=document.createElement("img")
|
|
274
|
+
;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='"+this.src+" 'alt='"+this.alt+"' ",t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=js.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+js.escape(t)+'"'),e+="'/>"}}var Cl={"î":"ı̂","ï":"ı̈","í":"ı́","ì":"ı̀"};class Al{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<Qs.length;t++)for(var n=Qs[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}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),
|
|
275
|
+
/[îïíì]/.test(this.text)&&(this.text=Cl[this.text])}hasClass(e){return js.contains(this.classes,e)}toNode(){var e=document.createTextNode(this.text),t=null;for(var n in this.italic>0&&((t=document.createElement("span")).style.marginRight=vl(this.italic)),this.classes.length>0&&((t=t||document.createElement("span")).className=yl(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+=js.escape(yl(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+=js.hyphenate(r)+":"+this.style[r]+";");n&&(e=!0,t+=' style="'+js.escape(n)+'"');var o=js.escape(this.text);return e?(t+=">",t+=o,t+="</span>"):o}}class El{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){
|
|
276
|
+
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+"='"+this.attributes[t]+"'");e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>"}}class Tl{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",nl[this.pathName]),e}toMarkup(){return this.alternate?"<path d='"+this.alternate+"'/>":"<path d='"+nl[this.pathName]+"'/>"}}class Nl{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){
|
|
277
|
+
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+"='"+this.attributes[t]+"'");return e+="/>"}}function Ll(e){if(e instanceof Al)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}var Ml={bin:1,close:1,inner:1,open:1,punct:1,rel:1},zl={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ol={math:{},text:{}};function Il(e,t,n,r,o,i){Ol[e][o]={font:t,group:n,replace:r},i&&r&&(Ol[e][r]=Ol[e][o])}var Rl="math",Pl="text",Dl="main",Bl="ams",Fl="accent-token",jl="bin",Hl="close",ql="mathord",Ul="op-token",$l="open",Gl="rel",Vl="textord";Il(Rl,Dl,Gl,"≡","\\equiv",!0),Il(Rl,Dl,Gl,"≺","\\prec",!0),Il(Rl,Dl,Gl,"≻","\\succ",!0),Il(Rl,Dl,Gl,"∼","\\sim",!0),Il(Rl,Dl,Gl,"⊥","\\perp"),Il(Rl,Dl,Gl,"⪯","\\preceq",!0),
|
|
278
|
+
Il(Rl,Dl,Gl,"⪰","\\succeq",!0),Il(Rl,Dl,Gl,"≃","\\simeq",!0),Il(Rl,Dl,Gl,"∣","\\mid",!0),Il(Rl,Dl,Gl,"≪","\\ll",!0),Il(Rl,Dl,Gl,"≫","\\gg",!0),Il(Rl,Dl,Gl,"≍","\\asymp",!0),Il(Rl,Dl,Gl,"∥","\\parallel"),Il(Rl,Dl,Gl,"⋈","\\bowtie",!0),Il(Rl,Dl,Gl,"⌣","\\smile",!0),Il(Rl,Dl,Gl,"⊑","\\sqsubseteq",!0),Il(Rl,Dl,Gl,"⊒","\\sqsupseteq",!0),Il(Rl,Dl,Gl,"≐","\\doteq",!0),Il(Rl,Dl,Gl,"⌢","\\frown",!0),Il(Rl,Dl,Gl,"∋","\\ni",!0),Il(Rl,Dl,Gl,"∝","\\propto",!0),Il(Rl,Dl,Gl,"⊢","\\vdash",!0),Il(Rl,Dl,Gl,"⊣","\\dashv",!0),Il(Rl,Dl,Gl,"∋","\\owns"),Il(Rl,Dl,"punct",".","\\ldotp"),Il(Rl,Dl,"punct","⋅","\\cdotp"),Il(Rl,Dl,Vl,"#","\\#"),Il(Pl,Dl,Vl,"#","\\#"),Il(Rl,Dl,Vl,"&","\\&"),Il(Pl,Dl,Vl,"&","\\&"),Il(Rl,Dl,Vl,"ℵ","\\aleph",!0),Il(Rl,Dl,Vl,"∀","\\forall",!0),Il(Rl,Dl,Vl,"ℏ","\\hbar",!0),Il(Rl,Dl,Vl,"∃","\\exists",!0),Il(Rl,Dl,Vl,"∇","\\nabla",!0),Il(Rl,Dl,Vl,"♭","\\flat",!0),Il(Rl,Dl,Vl,"ℓ","\\ell",!0),Il(Rl,Dl,Vl,"♮","\\natural",!0),Il(Rl,Dl,Vl,"♣","\\clubsuit",!0),Il(Rl,Dl,Vl,"℘","\\wp",!0),Il(Rl,Dl,Vl,"♯","\\sharp",!0),
|
|
279
|
+
Il(Rl,Dl,Vl,"♢","\\diamondsuit",!0),Il(Rl,Dl,Vl,"ℜ","\\Re",!0),Il(Rl,Dl,Vl,"♡","\\heartsuit",!0),Il(Rl,Dl,Vl,"ℑ","\\Im",!0),Il(Rl,Dl,Vl,"♠","\\spadesuit",!0),Il(Rl,Dl,Vl,"§","\\S",!0),Il(Pl,Dl,Vl,"§","\\S"),Il(Rl,Dl,Vl,"¶","\\P",!0),Il(Pl,Dl,Vl,"¶","\\P"),Il(Rl,Dl,Vl,"†","\\dag"),Il(Pl,Dl,Vl,"†","\\dag"),Il(Pl,Dl,Vl,"†","\\textdagger"),Il(Rl,Dl,Vl,"‡","\\ddag"),Il(Pl,Dl,Vl,"‡","\\ddag"),Il(Pl,Dl,Vl,"‡","\\textdaggerdbl"),Il(Rl,Dl,Hl,"⎱","\\rmoustache",!0),Il(Rl,Dl,$l,"⎰","\\lmoustache",!0),Il(Rl,Dl,Hl,"⟯","\\rgroup",!0),Il(Rl,Dl,$l,"⟮","\\lgroup",!0),Il(Rl,Dl,jl,"∓","\\mp",!0),Il(Rl,Dl,jl,"⊖","\\ominus",!0),Il(Rl,Dl,jl,"⊎","\\uplus",!0),Il(Rl,Dl,jl,"⊓","\\sqcap",!0),Il(Rl,Dl,jl,"∗","\\ast"),Il(Rl,Dl,jl,"⊔","\\sqcup",!0),Il(Rl,Dl,jl,"◯","\\bigcirc",!0),Il(Rl,Dl,jl,"∙","\\bullet"),Il(Rl,Dl,jl,"‡","\\ddagger"),Il(Rl,Dl,jl,"≀","\\wr",!0),Il(Rl,Dl,jl,"⨿","\\amalg"),Il(Rl,Dl,jl,"&","\\And"),Il(Rl,Dl,Gl,"⟵","\\longleftarrow",!0),Il(Rl,Dl,Gl,"⇐","\\Leftarrow",!0),Il(Rl,Dl,Gl,"⟸","\\Longleftarrow",!0),
|
|
280
|
+
Il(Rl,Dl,Gl,"⟶","\\longrightarrow",!0),Il(Rl,Dl,Gl,"⇒","\\Rightarrow",!0),Il(Rl,Dl,Gl,"⟹","\\Longrightarrow",!0),Il(Rl,Dl,Gl,"↔","\\leftrightarrow",!0),Il(Rl,Dl,Gl,"⟷","\\longleftrightarrow",!0),Il(Rl,Dl,Gl,"⇔","\\Leftrightarrow",!0),Il(Rl,Dl,Gl,"⟺","\\Longleftrightarrow",!0),Il(Rl,Dl,Gl,"↦","\\mapsto",!0),Il(Rl,Dl,Gl,"⟼","\\longmapsto",!0),Il(Rl,Dl,Gl,"↗","\\nearrow",!0),Il(Rl,Dl,Gl,"↩","\\hookleftarrow",!0),Il(Rl,Dl,Gl,"↪","\\hookrightarrow",!0),Il(Rl,Dl,Gl,"↘","\\searrow",!0),Il(Rl,Dl,Gl,"↼","\\leftharpoonup",!0),Il(Rl,Dl,Gl,"⇀","\\rightharpoonup",!0),Il(Rl,Dl,Gl,"↙","\\swarrow",!0),Il(Rl,Dl,Gl,"↽","\\leftharpoondown",!0),Il(Rl,Dl,Gl,"⇁","\\rightharpoondown",!0),Il(Rl,Dl,Gl,"↖","\\nwarrow",!0),Il(Rl,Dl,Gl,"⇌","\\rightleftharpoons",!0),Il(Rl,Bl,Gl,"≮","\\nless",!0),Il(Rl,Bl,Gl,"","\\@nleqslant"),Il(Rl,Bl,Gl,"","\\@nleqq"),Il(Rl,Bl,Gl,"⪇","\\lneq",!0),Il(Rl,Bl,Gl,"≨","\\lneqq",!0),Il(Rl,Bl,Gl,"","\\@lvertneqq"),Il(Rl,Bl,Gl,"⋦","\\lnsim",!0),Il(Rl,Bl,Gl,"⪉","\\lnapprox",!0),Il(Rl,Bl,Gl,"⊀","\\nprec",!0),
|
|
281
|
+
Il(Rl,Bl,Gl,"⋠","\\npreceq",!0),Il(Rl,Bl,Gl,"⋨","\\precnsim",!0),Il(Rl,Bl,Gl,"⪹","\\precnapprox",!0),Il(Rl,Bl,Gl,"≁","\\nsim",!0),Il(Rl,Bl,Gl,"","\\@nshortmid"),Il(Rl,Bl,Gl,"∤","\\nmid",!0),Il(Rl,Bl,Gl,"⊬","\\nvdash",!0),Il(Rl,Bl,Gl,"⊭","\\nvDash",!0),Il(Rl,Bl,Gl,"⋪","\\ntriangleleft"),Il(Rl,Bl,Gl,"⋬","\\ntrianglelefteq",!0),Il(Rl,Bl,Gl,"⊊","\\subsetneq",!0),Il(Rl,Bl,Gl,"","\\@varsubsetneq"),Il(Rl,Bl,Gl,"⫋","\\subsetneqq",!0),Il(Rl,Bl,Gl,"","\\@varsubsetneqq"),Il(Rl,Bl,Gl,"≯","\\ngtr",!0),Il(Rl,Bl,Gl,"","\\@ngeqslant"),Il(Rl,Bl,Gl,"","\\@ngeqq"),Il(Rl,Bl,Gl,"⪈","\\gneq",!0),Il(Rl,Bl,Gl,"≩","\\gneqq",!0),Il(Rl,Bl,Gl,"","\\@gvertneqq"),Il(Rl,Bl,Gl,"⋧","\\gnsim",!0),Il(Rl,Bl,Gl,"⪊","\\gnapprox",!0),Il(Rl,Bl,Gl,"⊁","\\nsucc",!0),Il(Rl,Bl,Gl,"⋡","\\nsucceq",!0),Il(Rl,Bl,Gl,"⋩","\\succnsim",!0),Il(Rl,Bl,Gl,"⪺","\\succnapprox",!0),Il(Rl,Bl,Gl,"≆","\\ncong",!0),Il(Rl,Bl,Gl,"","\\@nshortparallel"),Il(Rl,Bl,Gl,"∦","\\nparallel",!0),Il(Rl,Bl,Gl,"⊯","\\nVDash",!0),Il(Rl,Bl,Gl,"⋫","\\ntriangleright"),
|
|
282
|
+
Il(Rl,Bl,Gl,"⋭","\\ntrianglerighteq",!0),Il(Rl,Bl,Gl,"","\\@nsupseteqq"),Il(Rl,Bl,Gl,"⊋","\\supsetneq",!0),Il(Rl,Bl,Gl,"","\\@varsupsetneq"),Il(Rl,Bl,Gl,"⫌","\\supsetneqq",!0),Il(Rl,Bl,Gl,"","\\@varsupsetneqq"),Il(Rl,Bl,Gl,"⊮","\\nVdash",!0),Il(Rl,Bl,Gl,"⪵","\\precneqq",!0),Il(Rl,Bl,Gl,"⪶","\\succneqq",!0),Il(Rl,Bl,Gl,"","\\@nsubseteqq"),Il(Rl,Bl,jl,"⊴","\\unlhd"),Il(Rl,Bl,jl,"⊵","\\unrhd"),Il(Rl,Bl,Gl,"↚","\\nleftarrow",!0),Il(Rl,Bl,Gl,"↛","\\nrightarrow",!0),Il(Rl,Bl,Gl,"⇍","\\nLeftarrow",!0),Il(Rl,Bl,Gl,"⇏","\\nRightarrow",!0),Il(Rl,Bl,Gl,"↮","\\nleftrightarrow",!0),Il(Rl,Bl,Gl,"⇎","\\nLeftrightarrow",!0),Il(Rl,Bl,Gl,"△","\\vartriangle"),Il(Rl,Bl,Vl,"ℏ","\\hslash"),Il(Rl,Bl,Vl,"▽","\\triangledown"),Il(Rl,Bl,Vl,"◊","\\lozenge"),Il(Rl,Bl,Vl,"Ⓢ","\\circledS"),Il(Rl,Bl,Vl,"®","\\circledR"),Il(Pl,Bl,Vl,"®","\\circledR"),Il(Rl,Bl,Vl,"∡","\\measuredangle",!0),Il(Rl,Bl,Vl,"∄","\\nexists"),Il(Rl,Bl,Vl,"℧","\\mho"),Il(Rl,Bl,Vl,"Ⅎ","\\Finv",!0),Il(Rl,Bl,Vl,"⅁","\\Game",!0),Il(Rl,Bl,Vl,"‵","\\backprime"),
|
|
283
|
+
Il(Rl,Bl,Vl,"▲","\\blacktriangle"),Il(Rl,Bl,Vl,"▼","\\blacktriangledown"),Il(Rl,Bl,Vl,"■","\\blacksquare"),Il(Rl,Bl,Vl,"⧫","\\blacklozenge"),Il(Rl,Bl,Vl,"★","\\bigstar"),Il(Rl,Bl,Vl,"∢","\\sphericalangle",!0),Il(Rl,Bl,Vl,"∁","\\complement",!0),Il(Rl,Bl,Vl,"ð","\\eth",!0),Il(Pl,Dl,Vl,"ð","ð"),Il(Rl,Bl,Vl,"╱","\\diagup"),Il(Rl,Bl,Vl,"╲","\\diagdown"),Il(Rl,Bl,Vl,"□","\\square"),Il(Rl,Bl,Vl,"□","\\Box"),Il(Rl,Bl,Vl,"◊","\\Diamond"),Il(Rl,Bl,Vl,"¥","\\yen",!0),Il(Pl,Bl,Vl,"¥","\\yen",!0),Il(Rl,Bl,Vl,"✓","\\checkmark",!0),Il(Pl,Bl,Vl,"✓","\\checkmark"),Il(Rl,Bl,Vl,"ℶ","\\beth",!0),Il(Rl,Bl,Vl,"ℸ","\\daleth",!0),Il(Rl,Bl,Vl,"ℷ","\\gimel",!0),Il(Rl,Bl,Vl,"ϝ","\\digamma",!0),Il(Rl,Bl,Vl,"ϰ","\\varkappa"),Il(Rl,Bl,$l,"┌","\\@ulcorner",!0),Il(Rl,Bl,Hl,"┐","\\@urcorner",!0),Il(Rl,Bl,$l,"└","\\@llcorner",!0),Il(Rl,Bl,Hl,"┘","\\@lrcorner",!0),Il(Rl,Bl,Gl,"≦","\\leqq",!0),Il(Rl,Bl,Gl,"⩽","\\leqslant",!0),Il(Rl,Bl,Gl,"⪕","\\eqslantless",!0),Il(Rl,Bl,Gl,"≲","\\lesssim",!0),Il(Rl,Bl,Gl,"⪅","\\lessapprox",!0),
|
|
284
|
+
Il(Rl,Bl,Gl,"≊","\\approxeq",!0),Il(Rl,Bl,jl,"⋖","\\lessdot"),Il(Rl,Bl,Gl,"⋘","\\lll",!0),Il(Rl,Bl,Gl,"≶","\\lessgtr",!0),Il(Rl,Bl,Gl,"⋚","\\lesseqgtr",!0),Il(Rl,Bl,Gl,"⪋","\\lesseqqgtr",!0),Il(Rl,Bl,Gl,"≑","\\doteqdot"),Il(Rl,Bl,Gl,"≓","\\risingdotseq",!0),Il(Rl,Bl,Gl,"≒","\\fallingdotseq",!0),Il(Rl,Bl,Gl,"∽","\\backsim",!0),Il(Rl,Bl,Gl,"⋍","\\backsimeq",!0),Il(Rl,Bl,Gl,"⫅","\\subseteqq",!0),Il(Rl,Bl,Gl,"⋐","\\Subset",!0),Il(Rl,Bl,Gl,"⊏","\\sqsubset",!0),Il(Rl,Bl,Gl,"≼","\\preccurlyeq",!0),Il(Rl,Bl,Gl,"⋞","\\curlyeqprec",!0),Il(Rl,Bl,Gl,"≾","\\precsim",!0),Il(Rl,Bl,Gl,"⪷","\\precapprox",!0),Il(Rl,Bl,Gl,"⊲","\\vartriangleleft"),Il(Rl,Bl,Gl,"⊴","\\trianglelefteq"),Il(Rl,Bl,Gl,"⊨","\\vDash",!0),Il(Rl,Bl,Gl,"⊪","\\Vvdash",!0),Il(Rl,Bl,Gl,"⌣","\\smallsmile"),Il(Rl,Bl,Gl,"⌢","\\smallfrown"),Il(Rl,Bl,Gl,"≏","\\bumpeq",!0),Il(Rl,Bl,Gl,"≎","\\Bumpeq",!0),Il(Rl,Bl,Gl,"≧","\\geqq",!0),Il(Rl,Bl,Gl,"⩾","\\geqslant",!0),Il(Rl,Bl,Gl,"⪖","\\eqslantgtr",!0),Il(Rl,Bl,Gl,"≳","\\gtrsim",!0),Il(Rl,Bl,Gl,"⪆","\\gtrapprox",!0),
|
|
285
|
+
Il(Rl,Bl,jl,"⋗","\\gtrdot"),Il(Rl,Bl,Gl,"⋙","\\ggg",!0),Il(Rl,Bl,Gl,"≷","\\gtrless",!0),Il(Rl,Bl,Gl,"⋛","\\gtreqless",!0),Il(Rl,Bl,Gl,"⪌","\\gtreqqless",!0),Il(Rl,Bl,Gl,"≖","\\eqcirc",!0),Il(Rl,Bl,Gl,"≗","\\circeq",!0),Il(Rl,Bl,Gl,"≜","\\triangleq",!0),Il(Rl,Bl,Gl,"∼","\\thicksim"),Il(Rl,Bl,Gl,"≈","\\thickapprox"),Il(Rl,Bl,Gl,"⫆","\\supseteqq",!0),Il(Rl,Bl,Gl,"⋑","\\Supset",!0),Il(Rl,Bl,Gl,"⊐","\\sqsupset",!0),Il(Rl,Bl,Gl,"≽","\\succcurlyeq",!0),Il(Rl,Bl,Gl,"⋟","\\curlyeqsucc",!0),Il(Rl,Bl,Gl,"≿","\\succsim",!0),Il(Rl,Bl,Gl,"⪸","\\succapprox",!0),Il(Rl,Bl,Gl,"⊳","\\vartriangleright"),Il(Rl,Bl,Gl,"⊵","\\trianglerighteq"),Il(Rl,Bl,Gl,"⊩","\\Vdash",!0),Il(Rl,Bl,Gl,"∣","\\shortmid"),Il(Rl,Bl,Gl,"∥","\\shortparallel"),Il(Rl,Bl,Gl,"≬","\\between",!0),Il(Rl,Bl,Gl,"⋔","\\pitchfork",!0),Il(Rl,Bl,Gl,"∝","\\varpropto"),Il(Rl,Bl,Gl,"◀","\\blacktriangleleft"),Il(Rl,Bl,Gl,"∴","\\therefore",!0),Il(Rl,Bl,Gl,"∍","\\backepsilon"),Il(Rl,Bl,Gl,"▶","\\blacktriangleright"),Il(Rl,Bl,Gl,"∵","\\because",!0),
|
|
286
|
+
Il(Rl,Bl,Gl,"⋘","\\llless"),Il(Rl,Bl,Gl,"⋙","\\gggtr"),Il(Rl,Bl,jl,"⊲","\\lhd"),Il(Rl,Bl,jl,"⊳","\\rhd"),Il(Rl,Bl,Gl,"≂","\\eqsim",!0),Il(Rl,Dl,Gl,"⋈","\\Join"),Il(Rl,Bl,Gl,"≑","\\Doteq",!0),Il(Rl,Bl,jl,"∔","\\dotplus",!0),Il(Rl,Bl,jl,"∖","\\smallsetminus"),Il(Rl,Bl,jl,"⋒","\\Cap",!0),Il(Rl,Bl,jl,"⋓","\\Cup",!0),Il(Rl,Bl,jl,"⩞","\\doublebarwedge",!0),Il(Rl,Bl,jl,"⊟","\\boxminus",!0),Il(Rl,Bl,jl,"⊞","\\boxplus",!0),Il(Rl,Bl,jl,"⋇","\\divideontimes",!0),Il(Rl,Bl,jl,"⋉","\\ltimes",!0),Il(Rl,Bl,jl,"⋊","\\rtimes",!0),Il(Rl,Bl,jl,"⋋","\\leftthreetimes",!0),Il(Rl,Bl,jl,"⋌","\\rightthreetimes",!0),Il(Rl,Bl,jl,"⋏","\\curlywedge",!0),Il(Rl,Bl,jl,"⋎","\\curlyvee",!0),Il(Rl,Bl,jl,"⊝","\\circleddash",!0),Il(Rl,Bl,jl,"⊛","\\circledast",!0),Il(Rl,Bl,jl,"⋅","\\centerdot"),Il(Rl,Bl,jl,"⊺","\\intercal",!0),Il(Rl,Bl,jl,"⋒","\\doublecap"),Il(Rl,Bl,jl,"⋓","\\doublecup"),Il(Rl,Bl,jl,"⊠","\\boxtimes",!0),Il(Rl,Bl,Gl,"⇢","\\dashrightarrow",!0),Il(Rl,Bl,Gl,"⇠","\\dashleftarrow",!0),Il(Rl,Bl,Gl,"⇇","\\leftleftarrows",!0),
|
|
287
|
+
Il(Rl,Bl,Gl,"⇆","\\leftrightarrows",!0),Il(Rl,Bl,Gl,"⇚","\\Lleftarrow",!0),Il(Rl,Bl,Gl,"↞","\\twoheadleftarrow",!0),Il(Rl,Bl,Gl,"↢","\\leftarrowtail",!0),Il(Rl,Bl,Gl,"↫","\\looparrowleft",!0),Il(Rl,Bl,Gl,"⇋","\\leftrightharpoons",!0),Il(Rl,Bl,Gl,"↶","\\curvearrowleft",!0),Il(Rl,Bl,Gl,"↺","\\circlearrowleft",!0),Il(Rl,Bl,Gl,"↰","\\Lsh",!0),Il(Rl,Bl,Gl,"⇈","\\upuparrows",!0),Il(Rl,Bl,Gl,"↿","\\upharpoonleft",!0),Il(Rl,Bl,Gl,"⇃","\\downharpoonleft",!0),Il(Rl,Dl,Gl,"⊶","\\origof",!0),Il(Rl,Dl,Gl,"⊷","\\imageof",!0),Il(Rl,Bl,Gl,"⊸","\\multimap",!0),Il(Rl,Bl,Gl,"↭","\\leftrightsquigarrow",!0),Il(Rl,Bl,Gl,"⇉","\\rightrightarrows",!0),Il(Rl,Bl,Gl,"⇄","\\rightleftarrows",!0),Il(Rl,Bl,Gl,"↠","\\twoheadrightarrow",!0),Il(Rl,Bl,Gl,"↣","\\rightarrowtail",!0),Il(Rl,Bl,Gl,"↬","\\looparrowright",!0),Il(Rl,Bl,Gl,"↷","\\curvearrowright",!0),Il(Rl,Bl,Gl,"↻","\\circlearrowright",!0),Il(Rl,Bl,Gl,"↱","\\Rsh",!0),Il(Rl,Bl,Gl,"⇊","\\downdownarrows",!0),Il(Rl,Bl,Gl,"↾","\\upharpoonright",!0),Il(Rl,Bl,Gl,"⇂","\\downharpoonright",!0),
|
|
288
|
+
Il(Rl,Bl,Gl,"⇝","\\rightsquigarrow",!0),Il(Rl,Bl,Gl,"⇝","\\leadsto"),Il(Rl,Bl,Gl,"⇛","\\Rrightarrow",!0),Il(Rl,Bl,Gl,"↾","\\restriction"),Il(Rl,Dl,Vl,"‘","`"),Il(Rl,Dl,Vl,"$","\\$"),Il(Pl,Dl,Vl,"$","\\$"),Il(Pl,Dl,Vl,"$","\\textdollar"),Il(Rl,Dl,Vl,"%","\\%"),Il(Pl,Dl,Vl,"%","\\%"),Il(Rl,Dl,Vl,"_","\\_"),Il(Pl,Dl,Vl,"_","\\_"),Il(Pl,Dl,Vl,"_","\\textunderscore"),Il(Rl,Dl,Vl,"∠","\\angle",!0),Il(Rl,Dl,Vl,"∞","\\infty",!0),Il(Rl,Dl,Vl,"′","\\prime"),Il(Rl,Dl,Vl,"△","\\triangle"),Il(Rl,Dl,Vl,"Γ","\\Gamma",!0),Il(Rl,Dl,Vl,"Δ","\\Delta",!0),Il(Rl,Dl,Vl,"Θ","\\Theta",!0),Il(Rl,Dl,Vl,"Λ","\\Lambda",!0),Il(Rl,Dl,Vl,"Ξ","\\Xi",!0),Il(Rl,Dl,Vl,"Π","\\Pi",!0),Il(Rl,Dl,Vl,"Σ","\\Sigma",!0),Il(Rl,Dl,Vl,"Υ","\\Upsilon",!0),Il(Rl,Dl,Vl,"Φ","\\Phi",!0),Il(Rl,Dl,Vl,"Ψ","\\Psi",!0),Il(Rl,Dl,Vl,"Ω","\\Omega",!0),Il(Rl,Dl,Vl,"A","Α"),Il(Rl,Dl,Vl,"B","Β"),Il(Rl,Dl,Vl,"E","Ε"),Il(Rl,Dl,Vl,"Z","Ζ"),Il(Rl,Dl,Vl,"H","Η"),Il(Rl,Dl,Vl,"I","Ι"),Il(Rl,Dl,Vl,"K","Κ"),Il(Rl,Dl,Vl,"M","Μ"),Il(Rl,Dl,Vl,"N","Ν"),Il(Rl,Dl,Vl,"O","Ο"),
|
|
289
|
+
Il(Rl,Dl,Vl,"P","Ρ"),Il(Rl,Dl,Vl,"T","Τ"),Il(Rl,Dl,Vl,"X","Χ"),Il(Rl,Dl,Vl,"¬","\\neg",!0),Il(Rl,Dl,Vl,"¬","\\lnot"),Il(Rl,Dl,Vl,"⊤","\\top"),Il(Rl,Dl,Vl,"⊥","\\bot"),Il(Rl,Dl,Vl,"∅","\\emptyset"),Il(Rl,Bl,Vl,"∅","\\varnothing"),Il(Rl,Dl,ql,"α","\\alpha",!0),Il(Rl,Dl,ql,"β","\\beta",!0),Il(Rl,Dl,ql,"γ","\\gamma",!0),Il(Rl,Dl,ql,"δ","\\delta",!0),Il(Rl,Dl,ql,"ϵ","\\epsilon",!0),Il(Rl,Dl,ql,"ζ","\\zeta",!0),Il(Rl,Dl,ql,"η","\\eta",!0),Il(Rl,Dl,ql,"θ","\\theta",!0),Il(Rl,Dl,ql,"ι","\\iota",!0),Il(Rl,Dl,ql,"κ","\\kappa",!0),Il(Rl,Dl,ql,"λ","\\lambda",!0),Il(Rl,Dl,ql,"μ","\\mu",!0),Il(Rl,Dl,ql,"ν","\\nu",!0),Il(Rl,Dl,ql,"ξ","\\xi",!0),Il(Rl,Dl,ql,"ο","\\omicron",!0),Il(Rl,Dl,ql,"π","\\pi",!0),Il(Rl,Dl,ql,"ρ","\\rho",!0),Il(Rl,Dl,ql,"σ","\\sigma",!0),Il(Rl,Dl,ql,"τ","\\tau",!0),Il(Rl,Dl,ql,"υ","\\upsilon",!0),Il(Rl,Dl,ql,"ϕ","\\phi",!0),Il(Rl,Dl,ql,"χ","\\chi",!0),Il(Rl,Dl,ql,"ψ","\\psi",!0),Il(Rl,Dl,ql,"ω","\\omega",!0),Il(Rl,Dl,ql,"ε","\\varepsilon",!0),Il(Rl,Dl,ql,"ϑ","\\vartheta",!0),
|
|
290
|
+
Il(Rl,Dl,ql,"ϖ","\\varpi",!0),Il(Rl,Dl,ql,"ϱ","\\varrho",!0),Il(Rl,Dl,ql,"ς","\\varsigma",!0),Il(Rl,Dl,ql,"φ","\\varphi",!0),Il(Rl,Dl,jl,"∗","*",!0),Il(Rl,Dl,jl,"+","+"),Il(Rl,Dl,jl,"−","-",!0),Il(Rl,Dl,jl,"⋅","\\cdot",!0),Il(Rl,Dl,jl,"∘","\\circ"),Il(Rl,Dl,jl,"÷","\\div",!0),Il(Rl,Dl,jl,"±","\\pm",!0),Il(Rl,Dl,jl,"×","\\times",!0),Il(Rl,Dl,jl,"∩","\\cap",!0),Il(Rl,Dl,jl,"∪","\\cup",!0),Il(Rl,Dl,jl,"∖","\\setminus"),Il(Rl,Dl,jl,"∧","\\land"),Il(Rl,Dl,jl,"∨","\\lor"),Il(Rl,Dl,jl,"∧","\\wedge",!0),Il(Rl,Dl,jl,"∨","\\vee",!0),Il(Rl,Dl,Vl,"√","\\surd"),Il(Rl,Dl,$l,"⟨","\\langle",!0),Il(Rl,Dl,$l,"∣","\\lvert"),Il(Rl,Dl,$l,"∥","\\lVert"),Il(Rl,Dl,Hl,"?","?"),Il(Rl,Dl,Hl,"!","!"),Il(Rl,Dl,Hl,"⟩","\\rangle",!0),Il(Rl,Dl,Hl,"∣","\\rvert"),Il(Rl,Dl,Hl,"∥","\\rVert"),Il(Rl,Dl,Gl,"=","="),Il(Rl,Dl,Gl,":",":"),Il(Rl,Dl,Gl,"≈","\\approx",!0),Il(Rl,Dl,Gl,"≅","\\cong",!0),Il(Rl,Dl,Gl,"≥","\\ge"),Il(Rl,Dl,Gl,"≥","\\geq",!0),Il(Rl,Dl,Gl,"←","\\gets"),Il(Rl,Dl,Gl,">","\\gt",!0),Il(Rl,Dl,Gl,"∈","\\in",!0),
|
|
291
|
+
Il(Rl,Dl,Gl,"","\\@not"),Il(Rl,Dl,Gl,"⊂","\\subset",!0),Il(Rl,Dl,Gl,"⊃","\\supset",!0),Il(Rl,Dl,Gl,"⊆","\\subseteq",!0),Il(Rl,Dl,Gl,"⊇","\\supseteq",!0),Il(Rl,Bl,Gl,"⊈","\\nsubseteq",!0),Il(Rl,Bl,Gl,"⊉","\\nsupseteq",!0),Il(Rl,Dl,Gl,"⊨","\\models"),Il(Rl,Dl,Gl,"←","\\leftarrow",!0),Il(Rl,Dl,Gl,"≤","\\le"),Il(Rl,Dl,Gl,"≤","\\leq",!0),Il(Rl,Dl,Gl,"<","\\lt",!0),Il(Rl,Dl,Gl,"→","\\rightarrow",!0),Il(Rl,Dl,Gl,"→","\\to"),Il(Rl,Bl,Gl,"≱","\\ngeq",!0),Il(Rl,Bl,Gl,"≰","\\nleq",!0),Il(Rl,Dl,"spacing"," ","\\ "),Il(Rl,Dl,"spacing"," ","\\space"),Il(Rl,Dl,"spacing"," ","\\nobreakspace"),Il(Pl,Dl,"spacing"," ","\\ "),Il(Pl,Dl,"spacing"," "," "),Il(Pl,Dl,"spacing"," ","\\space"),Il(Pl,Dl,"spacing"," ","\\nobreakspace"),Il(Rl,Dl,"spacing",null,"\\nobreak"),Il(Rl,Dl,"spacing",null,"\\allowbreak"),Il(Rl,Dl,"punct",",",","),Il(Rl,Dl,"punct",";",";"),Il(Rl,Bl,jl,"⊼","\\barwedge",!0),Il(Rl,Bl,jl,"⊻","\\veebar",!0),Il(Rl,Dl,jl,"⊙","\\odot",!0),Il(Rl,Dl,jl,"⊕","\\oplus",!0),Il(Rl,Dl,jl,"⊗","\\otimes",!0),
|
|
292
|
+
Il(Rl,Dl,Vl,"∂","\\partial",!0),Il(Rl,Dl,jl,"⊘","\\oslash",!0),Il(Rl,Bl,jl,"⊚","\\circledcirc",!0),Il(Rl,Bl,jl,"⊡","\\boxdot",!0),Il(Rl,Dl,jl,"△","\\bigtriangleup"),Il(Rl,Dl,jl,"▽","\\bigtriangledown"),Il(Rl,Dl,jl,"†","\\dagger"),Il(Rl,Dl,jl,"⋄","\\diamond"),Il(Rl,Dl,jl,"⋆","\\star"),Il(Rl,Dl,jl,"◃","\\triangleleft"),Il(Rl,Dl,jl,"▹","\\triangleright"),Il(Rl,Dl,$l,"{","\\{"),Il(Pl,Dl,Vl,"{","\\{"),Il(Pl,Dl,Vl,"{","\\textbraceleft"),Il(Rl,Dl,Hl,"}","\\}"),Il(Pl,Dl,Vl,"}","\\}"),Il(Pl,Dl,Vl,"}","\\textbraceright"),Il(Rl,Dl,$l,"{","\\lbrace"),Il(Rl,Dl,Hl,"}","\\rbrace"),Il(Rl,Dl,$l,"[","\\lbrack",!0),Il(Pl,Dl,Vl,"[","\\lbrack",!0),Il(Rl,Dl,Hl,"]","\\rbrack",!0),Il(Pl,Dl,Vl,"]","\\rbrack",!0),Il(Rl,Dl,$l,"(","\\lparen",!0),Il(Rl,Dl,Hl,")","\\rparen",!0),Il(Pl,Dl,Vl,"<","\\textless",!0),Il(Pl,Dl,Vl,">","\\textgreater",!0),Il(Rl,Dl,$l,"⌊","\\lfloor",!0),Il(Rl,Dl,Hl,"⌋","\\rfloor",!0),Il(Rl,Dl,$l,"⌈","\\lceil",!0),Il(Rl,Dl,Hl,"⌉","\\rceil",!0),Il(Rl,Dl,Vl,"\\","\\backslash"),Il(Rl,Dl,Vl,"∣","|"),
|
|
293
|
+
Il(Rl,Dl,Vl,"∣","\\vert"),Il(Pl,Dl,Vl,"|","\\textbar",!0),Il(Rl,Dl,Vl,"∥","\\|"),Il(Rl,Dl,Vl,"∥","\\Vert"),Il(Pl,Dl,Vl,"∥","\\textbardbl"),Il(Pl,Dl,Vl,"~","\\textasciitilde"),Il(Pl,Dl,Vl,"\\","\\textbackslash"),Il(Pl,Dl,Vl,"^","\\textasciicircum"),Il(Rl,Dl,Gl,"↑","\\uparrow",!0),Il(Rl,Dl,Gl,"⇑","\\Uparrow",!0),Il(Rl,Dl,Gl,"↓","\\downarrow",!0),Il(Rl,Dl,Gl,"⇓","\\Downarrow",!0),Il(Rl,Dl,Gl,"↕","\\updownarrow",!0),Il(Rl,Dl,Gl,"⇕","\\Updownarrow",!0),Il(Rl,Dl,Ul,"∐","\\coprod"),Il(Rl,Dl,Ul,"⋁","\\bigvee"),Il(Rl,Dl,Ul,"⋀","\\bigwedge"),Il(Rl,Dl,Ul,"⨄","\\biguplus"),Il(Rl,Dl,Ul,"⋂","\\bigcap"),Il(Rl,Dl,Ul,"⋃","\\bigcup"),Il(Rl,Dl,Ul,"∫","\\int"),Il(Rl,Dl,Ul,"∫","\\intop"),Il(Rl,Dl,Ul,"∬","\\iint"),Il(Rl,Dl,Ul,"∭","\\iiint"),Il(Rl,Dl,Ul,"∏","\\prod"),Il(Rl,Dl,Ul,"∑","\\sum"),Il(Rl,Dl,Ul,"⨂","\\bigotimes"),Il(Rl,Dl,Ul,"⨁","\\bigoplus"),Il(Rl,Dl,Ul,"⨀","\\bigodot"),Il(Rl,Dl,Ul,"∮","\\oint"),Il(Rl,Dl,Ul,"∯","\\oiint"),Il(Rl,Dl,Ul,"∰","\\oiiint"),Il(Rl,Dl,Ul,"⨆","\\bigsqcup"),Il(Rl,Dl,Ul,"∫","\\smallint"),
|
|
294
|
+
Il(Pl,Dl,"inner","…","\\textellipsis"),Il(Rl,Dl,"inner","…","\\mathellipsis"),Il(Pl,Dl,"inner","…","\\ldots",!0),Il(Rl,Dl,"inner","…","\\ldots",!0),Il(Rl,Dl,"inner","⋯","\\@cdots",!0),Il(Rl,Dl,"inner","⋱","\\ddots",!0),Il(Rl,Dl,Vl,"⋮","\\varvdots"),Il(Rl,Dl,Fl,"ˊ","\\acute"),Il(Rl,Dl,Fl,"ˋ","\\grave"),Il(Rl,Dl,Fl,"¨","\\ddot"),Il(Rl,Dl,Fl,"~","\\tilde"),Il(Rl,Dl,Fl,"ˉ","\\bar"),Il(Rl,Dl,Fl,"˘","\\breve"),Il(Rl,Dl,Fl,"ˇ","\\check"),Il(Rl,Dl,Fl,"^","\\hat"),Il(Rl,Dl,Fl,"⃗","\\vec"),Il(Rl,Dl,Fl,"˙","\\dot"),Il(Rl,Dl,Fl,"˚","\\mathring"),Il(Rl,Dl,ql,"","\\@imath"),Il(Rl,Dl,ql,"","\\@jmath"),Il(Rl,Dl,Vl,"ı","ı"),Il(Rl,Dl,Vl,"ȷ","ȷ"),Il(Pl,Dl,Vl,"ı","\\i",!0),Il(Pl,Dl,Vl,"ȷ","\\j",!0),Il(Pl,Dl,Vl,"ß","\\ss",!0),Il(Pl,Dl,Vl,"æ","\\ae",!0),Il(Pl,Dl,Vl,"œ","\\oe",!0),Il(Pl,Dl,Vl,"ø","\\o",!0),Il(Pl,Dl,Vl,"Æ","\\AE",!0),Il(Pl,Dl,Vl,"Œ","\\OE",!0),Il(Pl,Dl,Vl,"Ø","\\O",!0),Il(Pl,Dl,Fl,"ˊ","\\'"),Il(Pl,Dl,Fl,"ˋ","\\`"),Il(Pl,Dl,Fl,"ˆ","\\^"),Il(Pl,Dl,Fl,"˜","\\~"),Il(Pl,Dl,Fl,"ˉ","\\="),Il(Pl,Dl,Fl,"˘","\\u"),
|
|
295
|
+
Il(Pl,Dl,Fl,"˙","\\."),Il(Pl,Dl,Fl,"¸","\\c"),Il(Pl,Dl,Fl,"˚","\\r"),Il(Pl,Dl,Fl,"ˇ","\\v"),Il(Pl,Dl,Fl,"¨",'\\"'),Il(Pl,Dl,Fl,"˝","\\H"),Il(Pl,Dl,Fl,"◯","\\textcircled");var Wl={"--":!0,"---":!0,"``":!0,"''":!0};Il(Pl,Dl,Vl,"–","--",!0),Il(Pl,Dl,Vl,"–","\\textendash"),Il(Pl,Dl,Vl,"—","---",!0),Il(Pl,Dl,Vl,"—","\\textemdash"),Il(Pl,Dl,Vl,"‘","`",!0),Il(Pl,Dl,Vl,"‘","\\textquoteleft"),Il(Pl,Dl,Vl,"’","'",!0),Il(Pl,Dl,Vl,"’","\\textquoteright"),Il(Pl,Dl,Vl,"“","``",!0),Il(Pl,Dl,Vl,"“","\\textquotedblleft"),Il(Pl,Dl,Vl,"”","''",!0),Il(Pl,Dl,Vl,"”","\\textquotedblright"),Il(Rl,Dl,Vl,"°","\\degree",!0),Il(Pl,Dl,Vl,"°","\\degree"),Il(Pl,Dl,Vl,"°","\\textdegree",!0),Il(Rl,Dl,Vl,"£","\\pounds"),Il(Rl,Dl,Vl,"£","\\mathsterling",!0),Il(Pl,Dl,Vl,"£","\\pounds"),Il(Pl,Dl,Vl,"£","\\textsterling",!0),Il(Rl,Bl,Vl,"✠","\\maltese"),Il(Pl,Bl,Vl,"✠","\\maltese");for(var Yl=0;Yl<'0123456789/@."'.length;Yl++){var Kl='0123456789/@."'.charAt(Yl);Il(Rl,Dl,Vl,Kl,Kl)}for(var Xl=0;Xl<'0123456789!@*()-=+";:?/.,'.length;Xl++){
|
|
296
|
+
var Zl='0123456789!@*()-=+";:?/.,'.charAt(Xl);Il(Pl,Dl,Vl,Zl,Zl)}for(var Jl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ql=0;Ql<Jl.length;Ql++){var ec=Jl.charAt(Ql);Il(Rl,Dl,ql,ec,ec),Il(Pl,Dl,Vl,ec,ec)}Il(Rl,Bl,Vl,"C","ℂ"),Il(Pl,Bl,Vl,"C","ℂ"),Il(Rl,Bl,Vl,"H","ℍ"),Il(Pl,Bl,Vl,"H","ℍ"),Il(Rl,Bl,Vl,"N","ℕ"),Il(Pl,Bl,Vl,"N","ℕ"),Il(Rl,Bl,Vl,"P","ℙ"),Il(Pl,Bl,Vl,"P","ℙ"),Il(Rl,Bl,Vl,"Q","ℚ"),Il(Pl,Bl,Vl,"Q","ℚ"),Il(Rl,Bl,Vl,"R","ℝ"),Il(Pl,Bl,Vl,"R","ℝ"),Il(Rl,Bl,Vl,"Z","ℤ"),Il(Pl,Bl,Vl,"Z","ℤ"),Il(Rl,Dl,ql,"h","ℎ"),Il(Pl,Dl,ql,"h","ℎ");for(var tc="",nc=0;nc<Jl.length;nc++){var rc=Jl.charAt(nc);Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56320+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56372+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56424+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56580+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56736+nc)),Il(Pl,Dl,Vl,rc,tc),
|
|
297
|
+
Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56788+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56840+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56944+nc)),Il(Pl,Dl,Vl,rc,tc),nc<26&&(Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56632+nc)),Il(Pl,Dl,Vl,rc,tc),Il(Rl,Dl,ql,rc,tc=String.fromCharCode(55349,56476+nc)),Il(Pl,Dl,Vl,rc,tc))}Il(Rl,Dl,ql,"k",tc=String.fromCharCode(55349,56668)),Il(Pl,Dl,Vl,"k",tc);for(var oc=0;oc<10;oc++){var ic=oc.toString();Il(Rl,Dl,ql,ic,tc=String.fromCharCode(55349,57294+oc)),Il(Pl,Dl,Vl,ic,tc),Il(Rl,Dl,ql,ic,tc=String.fromCharCode(55349,57314+oc)),Il(Pl,Dl,Vl,ic,tc),Il(Rl,Dl,ql,ic,tc=String.fromCharCode(55349,57324+oc)),Il(Pl,Dl,Vl,ic,tc),Il(Rl,Dl,ql,ic,tc=String.fromCharCode(55349,57334+oc)),Il(Pl,Dl,Vl,ic,tc)}for(var ac=0;ac<"ÐÞþ".length;ac++){var sc="ÐÞþ".charAt(ac);Il(Rl,Dl,ql,sc,sc),Il(Pl,Dl,Vl,sc,sc)}
|
|
298
|
+
var lc=[["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"],["","",""],["","",""],["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"]],cc=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],uc=function(e,t,n){
|
|
299
|
+
return Ol[n][e]&&Ol[n][e].replace&&(e=Ol[n][e].replace),{value:e,metrics:sl(e,t,n)}},hc=function(e,t,n,r,o){var i,a=uc(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 Al(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 Al(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},dc=(e,t)=>{if(yl(e.classes)!==yl(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},pc=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),
|
|
300
|
+
i.maxFontSize>r&&(r=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},mc=function(e,t,n,r){var o=new xl(e,t,n,r);return pc(o),o},fc=(e,t,n,r)=>new xl(e,t,n,r),gc=function(e){var t=new rl(e);return pc(t),t},vc=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")},yc={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"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},
|
|
301
|
+
mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},_c={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},bc={fontMap:yc,makeSymbol:hc,mathsym:function(e,t,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&uc(e,"Main-Bold",t).metrics?hc(e,"Main-Bold",t,n,r.concat(["mathbf"])):"\\"===e||"main"===Ol[t][e].font?hc(e,"Main-Regular",t,n,r):hc(e,"AMS-Regular",t,n,r.concat(["amsrm"]))},makeSpan:mc,makeSvgSpan:fc,makeLineSpan:function(e,t,n){var r=mc([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=vl(r.height),r.maxFontSize=1,r},makeAnchor:function(e,t,n,r){var o=new kl(e,t,n,r);return pc(o),o},makeFragment:gc,wrapFragment:function(e,t){return e instanceof rl?mc([],[e],t):e},makeVList:function(e,t){for(var{children:n,depth:r}=function(e){if("individualShift"===e.positionType){
|
|
302
|
+
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 h=e.children[u];c-="kern"===h.type?h.size:h.elem.height+h.elem.depth}l=c}else if("bottom"===e.positionType)l=-e.positionData;else{var d=e.children[0];if("elem"!==d.type)throw new Error('First child must have type "elem".');if("shift"===e.positionType)l=-d.elem.depth-e.positionData;else{if("firstBaseline"!==e.positionType)throw new Error("Invalid positionType "+e.positionType+".");l=-d.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=mc(["pstrut"],[]);l.style.height=vl(o);for(var c=[],u=r,h=r,d=r,p=0;p<n.length;p++){var m=n[p];if("kern"===m.type)d+=m.size;else{
|
|
303
|
+
var f=m.elem,g=m.wrapperClasses||[],v=m.wrapperStyle||{},y=mc(g,[l,f],void 0,v);y.style.top=vl(-o-d-f.depth),m.marginLeft&&(y.style.marginLeft=m.marginLeft),m.marginRight&&(y.style.marginRight=m.marginRight),c.push(y),d+=f.height+f.depth}u=Math.min(u,d),h=Math.max(h,d)}var _,b=mc(["vlist"],c);if(b.style.height=vl(h),u<0){var w=mc([],[]),x=mc(["vlist"],[w]);x.style.height=vl(-u);var k=mc(["vlist-s"],[new Al("")]);_=[mc(["vlist-r"],[b,k]),mc(["vlist-r"],[x])]}else _=[mc(["vlist-r"],[b])];var S=mc(["vlist-t"],_);return 2===_.length&&S.classes.push("vlist-t2"),S.height=h,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;if(55349===o.charCodeAt(0)){var[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[lc[o][2],lc[o][r]]}if(120782<=n&&n<=120831){var i=Math.floor((n-120782)/10);return[cc[i][2],cc[i][r]]}
|
|
304
|
+
if(120485===n||120486===n)return[lc[0][2],lc[0][r]];if(120486<n&&n<120782)return["",""];throw new Rs("Unsupported character: "+e)}(o,r);return hc(o,l,r,t,i.concat(c))}if(s){var u,h;if("boldsymbol"===s){var d=function(e,t,n,r,o){return"textord"!==o&&uc(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}}(o,r,0,0,n);u=d.fontName,h=[d.fontClass]}else a?(u=yc[s].fontName,h=[s]):(u=vc(s,t.fontWeight,t.fontShape),h=[s,t.fontWeight,t.fontShape]);if(uc(o,u,r).metrics)return hc(o,u,r,t,i.concat(h));if(Wl.hasOwnProperty(o)&&"Typewriter"===u.substr(0,10)){for(var p=[],m=0;m<o.length;m++)p.push(hc(o[m],u,r,t,i.concat(h)));return gc(p)}}if("mathord"===n)return hc(o,"Math-Italic",r,t,i.concat(["mathnormal"]));if("textord"===n){var f=Ol[r][o]&&Ol[r][o].font;if("ams"===f){var g=vc("amsrm",t.fontWeight,t.fontShape);return hc(o,g,r,t,i.concat("amsrm",t.fontWeight,t.fontShape))}if("main"!==f&&f){var v=vc(f,t.fontWeight,t.fontShape)
|
|
305
|
+
;return hc(o,v,r,t,i.concat(v,t.fontWeight,t.fontShape))}var y=vc("textrm",t.fontWeight,t.fontShape);return hc(o,y,r,t,i.concat(t.fontWeight,t.fontShape))}throw new Error("unexpected type: "+n+" in makeOrd")},makeGlue:(e,t)=>{var n=mc(["mspace"],[],t),r=gl(e,t);return n.style.marginRight=vl(r),n},staticSvg:function(e,t){var[n,r,o]=_c[e],i=new Tl(n),a=new El([i],{width:vl(r),height:vl(o),style:"width:"+vl(r),viewBox:"0 0 "+1e3*r+" "+1e3*o,preserveAspectRatio:"xMinYMin"}),s=fc(["overlay"],[a],t);return s.height=o,s.style.height=vl(o),s.style.width=vl(r),s},svgData:_c,tryCombineChars:e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Al&&r instanceof Al&&dc(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}},wc={number:3,unit:"mu"},xc={number:4,unit:"mu"},kc={number:5,unit:"mu"},Sc={mord:{mop:wc,mbin:xc,mrel:kc,minner:wc},mop:{mord:wc,mop:wc,mrel:kc,minner:wc},mbin:{mord:xc,mop:xc,mopen:xc,minner:xc},mrel:{
|
|
306
|
+
mord:kc,mop:kc,mopen:kc,minner:kc},mopen:{},mclose:{mop:wc,mbin:xc,mrel:kc,minner:wc},mpunct:{mord:wc,mop:wc,mrel:kc,mopen:wc,mclose:wc,mpunct:wc,minner:wc},minner:{mord:wc,mop:wc,mbin:xc,mrel:kc,mopen:wc,mpunct:wc,minner:wc}},Cc={mord:{mop:wc},mop:{mord:wc,mop:wc},mbin:{},mrel:{},mopen:{},mclose:{mop:wc},mpunct:{},minner:{mop:wc}},Ac={},Ec={},Tc={};function Nc(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)Ac[n[l]]=s;t&&(i&&(Ec[t]=i),a&&(Tc[t]=a))}function Lc(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Nc({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var Mc=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e
|
|
307
|
+
},zc=function(e){return"ordgroup"===e.type?e.body:[e]},Oc=bc.makeSpan,Ic=["leftmost","mbin","mopen","mrel","mop","mpunct"],Rc=["rightmost","mrel","mclose","mpunct"],Pc={display:Js.DISPLAY,text:Js.TEXT,script:Js.SCRIPT,scriptscript:Js.SCRIPTSCRIPT},Dc={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Bc=function(e,t,n,r){void 0===r&&(r=[null,null]);for(var o=[],i=0;i<e.length;i++){var a=$c(e[i],t);if(a instanceof rl){var s=a.children;o.push(...s)}else o.push(a)}if(bc.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(Pc[c.style]))}var u=Oc([r[0]||"leftmost"],[],t),h=Oc([r[1]||"rightmost"],[],t),d="root"===n;return Fc(o,((e,t)=>{var n=t.classes[0],r=e.classes[0];"mbin"===n&&js.contains(Rc,r)?t.classes[0]="mord":"mbin"===r&&js.contains(Ic,n)&&(e.classes[0]="mord")}),{node:u},h,d),Fc(o,((e,t)=>{
|
|
308
|
+
var n=qc(t),r=qc(e),o=n&&r?e.hasClass("mtight")?Cc[n][r]:Sc[n][r]:null;if(o)return bc.makeGlue(o,l)}),{node:u},h,d),o},Fc=function e(t,n,r,o,i){o&&t.push(o);for(var a=0;a<t.length;a++){var s=t[a],l=jc(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=Oc(["leftmost"])),r.insertAfter=(e=>n=>{t.splice(e+1,0,n),a++})(a)}}o&&t.pop()},jc=function(e){return e instanceof rl||e instanceof kl||e instanceof xl&&e.hasClass("enclosing")?e:null},Hc=function e(t,n){var r=jc(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},qc=function(e,t){return e?(t&&(e=Hc(e,t)),Dc[e.classes[0]]||null):null},Uc=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return Oc(t.concat(n))},$c=function(e,t,n){if(!e)return Oc();if(Ec[e.type]){var r=Ec[e.type](e,t);if(n&&t.size!==n.size){
|
|
309
|
+
r=Oc(t.sizingClasses(n),[r],t);var o=t.sizeMultiplier/n.sizeMultiplier;r.height*=o,r.depth*=o}return r}throw new Rs("Got group of unknown type: '"+e.type+"'")};function Gc(e,t){var n=Oc(["base"],e,t),r=Oc(["strut"]);return r.style.height=vl(n.height+n.depth),n.depth&&(r.style.verticalAlign=vl(-n.depth)),n.children.unshift(r),n}function Vc(e,t){var n=null;1===e.length&&"tag"===e[0].type&&(n=e[0].tag,e=e[0].body);var r,o=Bc(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(Gc(s,t)),s=[])}else o[l].hasClass("newline")&&(s.pop(),s.length>0&&(a.push(Gc(s,t)),s=[]),a.push(o[l]));s.length>0&&a.push(Gc(s,t)),n?((i=Gc(Bc(n,t,!0))).classes=["tag"],a.push(i)):r&&a.push(r);var u=Oc(["katex-html"],a);if(u.setAttribute("aria-hidden","true"),i){
|
|
310
|
+
var h=i.children[0];h.style.height=vl(u.height+u.depth),u.depth&&(h.style.verticalAlign=vl(-u.depth))}return u}function Wc(e){return new rl(e)}class Yc{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=yl(this.classes));for(var n=0;n<this.children.length;n++)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+=js.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+js.escape(yl(this.classes))+'"'),e+=">"
|
|
311
|
+
;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 Kc{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return js.escape(this.toText())}toText(){return this.text}}var Xc={MathNode:Yc,TextNode:Kc,SpaceNode:class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,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",vl(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+vl(this.width)+'"/>'}toText(){
|
|
312
|
+
return this.character?this.character:" "}},newDocumentFragment:Wc},Zc=function(e,t,n){return!Ol[t][e]||!Ol[t][e].replace||55349===e.charCodeAt(0)||Wl.hasOwnProperty(e)&&n&&(n.fontFamily&&"tt"===n.fontFamily.substr(4,2)||n.font&&"tt"===n.font.substr(4,2))||(e=Ol[t][e].replace),new Xc.TextNode(e)},Jc=function(e){return 1===e.length?e[0]:new Xc.MathNode("mrow",e)},Qc=function(e,t){if("texttt"===t.fontFamily)return"monospace";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"
|
|
313
|
+
;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 js.contains(["\\imath","\\jmath"],o)?null:(Ol[r][o]&&Ol[r][o].replace&&(o=Ol[r][o].replace),sl(o,bc.fontMap[n].fontName,r)?bc.fontMap[n].variant:null)},eu=function(e,t,n){if(1===e.length){var r=nu(e[0],t);return n&&r instanceof Yc&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var o,i=[],a=0;a<e.length;a++){var s=nu(e[a],t);if(s instanceof Yc&&o instanceof Yc){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("mi"===s.type&&1===s.children.length&&"mn"===o.type){var l=s.children[0];if(l instanceof Kc&&"."===l.text){o.children.push(...s.children);continue}}else if("mi"===o.type&&1===o.children.length){var c=o.children[0]
|
|
314
|
+
;if(c instanceof Kc&&"̸"===c.text&&("mo"===s.type||"mi"===s.type||"mn"===s.type)){var u=s.children[0];u instanceof Kc&&u.text.length>0&&(u.text=u.text.slice(0,1)+"̸"+u.text.slice(1),i.pop())}}}i.push(s),o=s}return i},tu=function(e,t,n){return Jc(eu(e,t,n))},nu=function(e,t){if(!e)return new Xc.MathNode("mrow");if(Tc[e.type])return Tc[e.type](e,t);throw new Rs("Got group of unknown type: '"+e.type+"'")};function ru(e,t,n,r,o){var i,a=eu(e,n);i=1===a.length&&a[0]instanceof Yc&&js.contains(["mrow","mtable"],a[0].type)?a[0]:new Xc.MathNode("mrow",a);var s=new Xc.MathNode("annotation",[new Xc.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var l=new Xc.MathNode("semantics",[i,s]),c=new Xc.MathNode("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=o?"katex":"katex-mathml";return bc.makeSpan([u],[c])}var ou=function(e){return new dl({style:e.displayMode?Js.DISPLAY:Js.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})
|
|
315
|
+
},iu=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=bc.makeSpan(n,[e])}return e},au={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:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},su={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],
|
|
316
316
|
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"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],
|
|
317
317
|
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],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],
|
|
318
|
-
xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},
|
|
319
|
-
;if(
|
|
320
|
-
for(var w=0;w<b;w++){var x=new
|
|
321
|
-
;if(r.isShifty&&
|
|
322
|
-
o.height=Math.max(f.height,o.height),o.classes[0]="mord",o):f},
|
|
323
|
-
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:
|
|
324
|
-
mathmlBuilder:(e,t)=>{var n=
|
|
325
|
-
var n,r=t.style,o=t.havingStyle(r.sup()),i=
|
|
326
|
-
var i=
|
|
327
|
-
}}
|
|
328
|
-
type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=
|
|
329
|
-
argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,o=
|
|
330
|
-
"\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},
|
|
331
|
-
;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
|
|
332
|
-
;return
|
|
333
|
-
return
|
|
334
|
-
;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
|
|
335
|
-
u="Size4-Regular"):"\\lfloor"===e||"⌊"===e?(l=a="⎢",c="⎣",u="Size4-Regular"):"\\lceil"===e||"⌈"===e?(a="⎡",l=c="⎢",u="Size4-Regular"):"\\rfloor"===e||"⌋"===e?(l=a="⎥",c="⎦",u="Size4-Regular"):"\\rceil"===e||"⌉"===e?(a="⎤",l=c="⎥",u="Size4-Regular"):"("===e||"\\lparen"===e?(a="⎛",l="⎜",c="⎝",u="Size4-Regular"):")"===e||"\\rparen"===e?(a="⎞",l="⎟",c="⎠",u="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(a="⎧",s="⎨",c="⎩",l="⎪",u="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(a="⎫",s="⎬",c="⎭",l="⎪",u="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(a="⎧",c="⎩",l="⎪",u="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(a="⎫",c="⎭",l="⎪",u="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(a="⎧",c="⎭",l="⎪",u="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(a="⎫",c="⎩",l="⎪",u="Size4-Regular");var h=
|
|
336
|
-
;n&&(x*=r.sizeMultiplier);var k=w/2-x,S=[];if(S.push(
|
|
318
|
+
xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},lu=function(e,t,n,r,o){var i,a=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(i=bc.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 Nl({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&l.push(new Nl({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new El(l,{width:"100%",height:vl(a)});i=bc.makeSvgSpan([],[c],o)}return i.height=a,i.style.height=vl(a),i},cu=function(e){var t=new Xc.MathNode("mo",[new Xc.TextNode(au[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},uu=function(e,t){var{span:n,minWidth:r,height:o}=function(){var n=4e5,r=e.label.substr(1)
|
|
319
|
+
;if(js.contains(["widehat","widecheck","widetilde","utilde"],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 Tl(i),u=new El([c],{width:"100%",height:vl(a),viewBox:"0 0 "+n+" "+o,preserveAspectRatio:"none"});return{span:bc.makeSvgSpan([],[u],t),minWidth:0,height:a}}var h,d,p,m=[],f=su[r],[g,v,y]=f,_=y/1e3,b=g.length;if(1===b)h=["hide-tail"],d=[f[3]];else if(2===b)h=["halfarrow-left","halfarrow-right"],d=["xMinYMin","xMaxYMin"];else{if(3!==b)throw new Error("Correct katexImagesData or update code here to support\n "+b+" children.");h=["brace-left","brace-center","brace-right"],d=["xMinYMin","xMidYMin","xMaxYMin"]}
|
|
320
|
+
for(var w=0;w<b;w++){var x=new Tl(g[w]),k=new El([x],{width:"400em",height:vl(_),viewBox:"0 0 "+n+" "+y,preserveAspectRatio:d[w]+" slice"}),S=bc.makeSvgSpan([h[w]],[k],t);if(1===b)return{span:S,minWidth:v,height:_};S.style.height=vl(_),m.push(S)}return{span:bc.makeSpan(["stretchy"],m,t),minWidth:v,height:_}}();return n.height=o,n.style.height=vl(o),r>0&&(n.style.minWidth=vl(r)),n};function hu(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 du(e){var t=pu(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 pu(e){return e&&("atom"===e.type||zl.hasOwnProperty(e.type))?e:null}var mu=(e,t)=>{var n,r,o;e&&"supsub"===e.type?(n=(r=hu(e.base,"accent")).base,e.base=n,o=function(e){if(e instanceof xl)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}($c(e,t)),e.base=r):n=(r=hu(e,"accent")).base;var i=$c(n,t.havingCrampedStyle()),a=0
|
|
321
|
+
;if(r.isShifty&&js.isCharacterBox(n)){var s=js.getBaseElem(n);a=Ll($c(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=uu(r,t),l=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+vl(2*a)+")",marginLeft:vl(2*a)}:void 0}]},t);else{var h,d;"\\vec"===r.label?(h=bc.staticSvg("vec",t),d=bc.svgData.vec[1]):((h=Ll(h=bc.makeOrd({mode:r.mode,text:r.label},t,"textord"))).italic=0,d=h.width,c&&(u+=h.depth)),l=bc.makeSpan(["accent-body"],[h]);var p="\\textcircled"===r.label;p&&(l.classes.push("accent-full"),u=i.height);var m=a;p||(m-=d/2),l.style.left=vl(m),"\\textcircled"===r.label&&(l.style.top=".2em"),l=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-u},{type:"elem",elem:l}]},t)}var f=bc.makeSpan(["mord","accent"],[l],t);return o?(o.children[0]=f,
|
|
322
|
+
o.height=Math.max(f.height,o.height),o.classes[0]="mord",o):f},fu=(e,t)=>{var n=e.isStretchy?cu(e.label):new Xc.MathNode("mo",[Zc(e.label,e.mode)]),r=new Xc.MathNode("mover",[nu(e.base,t),n]);return r.setAttribute("accent","true"),r},gu=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((e=>"\\"+e)).join("|"));Nc({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)=>{var n=Mc(t[0]),r=!gu.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:mu,mathmlBuilder:fu}),Nc({type:"accent",
|
|
323
|
+
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:mu,mathmlBuilder:fu}),Nc({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)=>{var n=$c(e.base,t),r=uu(e,t),o="\\utilde"===e.label?.12:0,i=bc.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:n}]},t);return bc.makeSpan(["mord","accentunder"],[i],t)},
|
|
324
|
+
mathmlBuilder:(e,t)=>{var n=cu(e.label),r=new Xc.MathNode("munder",[nu(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var vu=e=>{var t=new Xc.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Nc({type:"xArrow",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){
|
|
325
|
+
var n,r=t.style,o=t.havingStyle(r.sup()),i=bc.wrapFragment($c(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=bc.wrapFragment($c(e.below,o,t),t)).classes.push(a+"-arrow-pad"));var s,l=uu(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,u=-t.fontMetrics().axisHeight-.5*l.height-.111;if((i.depth>.25||"\\xleftequilibrium"===e.label)&&(u-=i.depth),n){var h=-t.fontMetrics().axisHeight+n.height+.5*l.height+.111;s=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:l,shift:c},{type:"elem",elem:n,shift:h}]},t)}else s=bc.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"),bc.makeSpan(["mrel","x-arrow"],[s],t)},mathmlBuilder(e,t){var n,r=cu(e.label);if(r.setAttribute("minsize","x"===e.label.charAt(0)?"1.75em":"3.0em"),e.body){var o=vu(nu(e.body,t));if(e.below){
|
|
326
|
+
var i=vu(nu(e.below,t));n=new Xc.MathNode("munderover",[r,i,o])}else n=new Xc.MathNode("mover",[r,o])}else if(e.below){var a=vu(nu(e.below,t));n=new Xc.MathNode("munder",[r,a])}else n=vu(),n=new Xc.MathNode("mover",[r,n]);return n}});var yu={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},_u=e=>"textord"===e.type&&"@"===e.text;function bu(e,t,n){var r=yu[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"}
|
|
327
|
+
}}Nc({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=bc.wrapFragment($c(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=vl(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Xc.MathNode("mrow",[nu(e.label,t)]);return(n=new Xc.MathNode("mpadded",[n])).setAttribute("width","0"),"left"===e.side&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),(n=new Xc.MathNode("mstyle",[n])).setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}}),Nc({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=bc.wrapFragment($c(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder:(e,t)=>new Xc.MathNode("mrow",[nu(e.fragment,t)])}),Nc({
|
|
328
|
+
type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=hu(t[0],"ordgroup").body,o="",i=0;i<r.length;i++){o+=hu(r[i],"textord").text}var a,s=parseInt(o);if(isNaN(s))throw new Rs("\\@char has non-numeric argument "+o);if(s<0||s>=1114111)throw new Rs("\\@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 wu=(e,t)=>{var n=Bc(e.body,t.withColor(e.color),!1);return bc.makeFragment(n)},xu=(e,t)=>{var n=eu(e.body,t.withColor(e.color)),r=new Xc.MathNode("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Nc({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=hu(t[0],"color-token").color,o=t[1];return{type:"color",mode:n.mode,color:r,body:zc(o)}},htmlBuilder:wu,mathmlBuilder:xu}),Nc({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,
|
|
329
|
+
argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,o=hu(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:wu,mathmlBuilder:xu}),Nc({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:1,argTypes:["size"],allowedInText:!0},handler(e,t,n){var{parser:r}=e,o=n[0],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&&hu(o,"size").value}},htmlBuilder(e,t){var n=bc.makeSpan(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=vl(gl(e.size,t)))),n},mathmlBuilder(e,t){var n=new Xc.MathNode("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",vl(gl(e.size,t)))),n}});var ku={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef",
|
|
330
|
+
"\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Su=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Rs("Expected a control sequence",e);return t},Cu=(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)};Nc({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(ku[r.text])return"\\global"!==n&&"\\\\globallong"!==n||(r.text=ku[r.text]),hu(t.parseFunction(),"internal");throw new Rs("Invalid token after macro prefix",r)}}),Nc({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 Rs("Expected a control sequence",r)
|
|
331
|
+
;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 Rs('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==a+1)throw new Rs('Argument number "'+r.text+'" out of order');a++,s.push([])}else{if("EOF"===r.text)throw new Rs("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===ku[n]),{type:"internal",mode:t.mode}}}),Nc({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=Su(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)
|
|
332
|
+
;return Cu(t,r,o,"\\\\globallet"===n),{type:"internal",mode:t.mode}}}),Nc({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=Su(t.gullet.popToken()),o=t.gullet.popToken(),i=t.gullet.popToken();return Cu(t,r,i,"\\\\globalfuture"===n),t.gullet.pushToken(i),t.gullet.pushToken(o),{type:"internal",mode:t.mode}}});var Au=function(e,t,n){var r=sl(Ol.math[e]&&Ol.math[e].replace||e,t,n);if(!r)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return r},Eu=function(e,t,n,r){var o=n.havingBaseStyle(t),i=bc.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},Tu=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=vl(o),e.height-=o,e.depth+=o},Nu=function(e,t,n,r,o,i){var a=function(e,t,n,r){
|
|
333
|
+
return bc.makeSymbol(e,"Size"+t+"-Regular",n,r)}(e,t,o,r),s=Eu(bc.makeSpan(["delimsizing","size"+t],[a],r),Js.TEXT,r,i);return n&&Tu(s,r,Js.TEXT),s},Lu=function(e,t,n){var r;return r="Size1-Regular"===t?"delim-size1":"delim-size4",{type:"elem",elem:bc.makeSpan(["delimsizinginner",r],[bc.makeSpan([],[bc.makeSymbol(e,t,n)])])}},Mu=function(e,t,n){var r=ol["Size4-Regular"][e.charCodeAt(0)]?ol["Size4-Regular"][e.charCodeAt(0)][4]:ol["Size1-Regular"][e.charCodeAt(0)][4],o=new Tl("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"
|
|
334
|
+
;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 El([o],{width:vl(r),height:vl(t),style:"width:"+vl(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=bc.makeSvgSpan([],[i],n);return a.height=t,a.style.height=vl(t),a.style.width=vl(r),{type:"elem",elem:a}},zu={type:"kern",size:-.008},Ou=["|","\\lvert","\\rvert","\\vert"],Iu=["\\|","\\lVert","\\rVert","\\Vert"],Ru=function(e,t,n,r,o,i){var a,s,l,c;a=l=c=e,s=null;var u="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"):js.contains(Ou,e)?l="∣":js.contains(Iu,e)?l="∥":"["===e||"\\lbrack"===e?(a="⎡",l="⎢",c="⎣",u="Size4-Regular"):"]"===e||"\\rbrack"===e?(a="⎤",l="⎥",c="⎦",
|
|
335
|
+
u="Size4-Regular"):"\\lfloor"===e||"⌊"===e?(l=a="⎢",c="⎣",u="Size4-Regular"):"\\lceil"===e||"⌈"===e?(a="⎡",l=c="⎢",u="Size4-Regular"):"\\rfloor"===e||"⌋"===e?(l=a="⎥",c="⎦",u="Size4-Regular"):"\\rceil"===e||"⌉"===e?(a="⎤",l=c="⎥",u="Size4-Regular"):"("===e||"\\lparen"===e?(a="⎛",l="⎜",c="⎝",u="Size4-Regular"):")"===e||"\\rparen"===e?(a="⎞",l="⎟",c="⎠",u="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(a="⎧",s="⎨",c="⎩",l="⎪",u="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(a="⎫",s="⎬",c="⎭",l="⎪",u="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(a="⎧",c="⎩",l="⎪",u="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(a="⎫",c="⎭",l="⎪",u="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(a="⎧",c="⎭",l="⎪",u="Size4-Regular"):"\\rmoustache"!==e&&"⎱"!==e||(a="⎫",c="⎩",l="⎪",u="Size4-Regular");var h=Au(a,u,o),d=h.height+h.depth,p=Au(l,u,o),m=p.height+p.depth,f=Au(c,u,o),g=f.height+f.depth,v=0,y=1;if(null!==s){var _=Au(s,u,o);v=_.height+_.depth,y=2}var b=d+g+v,w=b+Math.max(0,Math.ceil((t-b)/(y*m)))*y*m,x=r.fontMetrics().axisHeight
|
|
336
|
+
;n&&(x*=r.sizeMultiplier);var k=w/2-x,S=[];if(S.push(Lu(c,u,o)),S.push(zu),null===s){var C=w-d-g+.016;S.push(Mu(l,C,r))}else{var A=(w-d-g-v)/2+.016;S.push(Mu(l,A,r)),S.push(zu),S.push(Lu(s,u,o)),S.push(zu),S.push(Mu(l,A,r))}S.push(zu),S.push(Lu(a,u,o));var E=r.havingBaseStyle(Js.TEXT),T=bc.makeVList({positionType:"bottom",positionData:k,children:S},E);return Eu(bc.makeSpan(["delimsizing","mult"],[T],E),Js.TEXT,r,i)},Pu=function(e,t,n,r,o){var i=function(e,t,n){t*=1e3;var r="";switch(e){case"sqrtMain":r=function(e,t){
|
|
337
337
|
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,80);break;case"sqrtSize1":r=function(e,t){
|
|
338
338
|
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,80);break;case"sqrtSize2":r=function(e,t){
|
|
339
339
|
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,80);break;case"sqrtSize3":r=function(e,t){
|
|
340
340
|
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,80);break;case"sqrtSize4":r=function(e,t){
|
|
341
|
-
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,80);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,80,n)}return r}(e,r,n),a=new
|
|
342
|
-
;return
|
|
343
|
-
type:"stack"}]
|
|
344
|
-
var n,r,o=t.havingBaseSizing(),i
|
|
345
|
-
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
|
|
346
|
-
},
|
|
347
|
-
mode:e.parser.mode,size:
|
|
348
|
-
;--r.leftrightDepth,r.expect("\\right",!1);var i=
|
|
349
|
-
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return
|
|
350
|
-
number:.6,unit:"pt"},t),u=
|
|
351
|
-
s=o.depth+g,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)r=
|
|
352
|
-
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};
|
|
353
|
-
argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=
|
|
354
|
-
handler:o},l=0;l<n.length;++l)
|
|
355
|
-
y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new
|
|
356
|
-
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:y,leqno:d}}function
|
|
357
|
-
x.depth=w,v+=b,x.pos=v,v+=w+C,s[n]=x,y(i[n+1])}var A,E,T=v/2+t.fontMetrics().axisHeight,N=e.cols||[],L=[],M=[];if(e.tags&&e.tags.some((e=>e)))for(n=0;n<o;++n){var z=s[n],O=z.pos-T,I=e.tags[n],R=void 0;(R=!0===I?
|
|
358
|
-
;(r>0||e.hskipBeforeAndAfter)&&0!==(H=
|
|
359
|
-
},
|
|
360
|
-
for(var _=e.cols||[],b="",w=1;w<_.length;w++)b+=w%2?"0em ":"1em ";c.setAttribute("columnspacing",b.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;h+=k[0].length>0?"left ":"",h+=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()),""!==h&&(c=new
|
|
361
|
-
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+=
|
|
362
|
-
;throw new
|
|
363
|
-
type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:
|
|
364
|
-
type:"align",align:"l",pregap:0,postgap:0}]},
|
|
365
|
-
;return
|
|
366
|
-
}if(
|
|
367
|
-
argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];if("ordgroup"!==o.type)throw new
|
|
368
|
-
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}
|
|
369
|
-
props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:o}=e,i=t[1],a=t[0];n="\\stackrel"!==o?
|
|
370
|
-
htmlBuilder:
|
|
371
|
-
;a.height=a.height<s?s:a.height,a.depth=a.depth<l?l:a.depth}n=t.havingStyle(i);var c,u,h,d,p,m,f,g,v,y,_
|
|
372
|
-
return n=t.havingStyle(r),f.height*=n.sizeMultiplier/t.sizeMultiplier,f.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===
|
|
373
|
-
if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var s=new
|
|
374
|
-
return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:n,leftDelim:s,rightDelim:l,size:c,barSize:null}},htmlBuilder:
|
|
375
|
-
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=
|
|
376
|
-
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}(
|
|
377
|
-
var l=
|
|
378
|
-
htmlBuilder:(e,t)=>{var n=
|
|
379
|
-
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=
|
|
380
|
-
;e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var o=
|
|
381
|
-
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=
|
|
382
|
-
var n=new
|
|
383
|
-
;return new
|
|
384
|
-
;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}}}),
|
|
385
|
-
kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var d
|
|
386
|
-
type:"elem",elem:l.elem,marginLeft:
|
|
387
|
-
;1===p.length&&p[0]instanceof
|
|
388
|
-
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=
|
|
389
|
-
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 u=l[c];u instanceof
|
|
391
|
-
case"mspace":case"mtext":break;case"mo":var a=i.children[0];1===i.children.length&&a instanceof
|
|
392
|
-
children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]},t);return
|
|
393
|
-
;return n=
|
|
394
|
-
;return
|
|
395
|
-
var n=
|
|
396
|
-
numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,o=!1,i=!1,a=n[0]&&
|
|
397
|
-
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
|
|
398
|
-
var{body:n,index:r}=e;return r?new
|
|
399
|
-
;return n?"op"===n.type?n.limits&&(t.style.size===
|
|
400
|
-
;var w=4*u.defaultRuleThickness;if(h-r.depth-(o.height-d)<w){d=w-(h-r.depth)+o.height;var x=.8*u.xHeight-(h-r.depth);x>0&&(h+=x,d-=x)}var k=[{type:"elem",elem:o,shift:d,marginRight:y,marginLeft:_},{type:"elem",elem:r,shift:-h,marginRight:y}];g=
|
|
401
|
-
;if(e.sub&&i.push(
|
|
402
|
-
}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var
|
|
403
|
-
;if("text"===e.mode){var r=
|
|
404
|
-
;return n?
|
|
405
|
-
},mathmlBuilder(e,t){var n=new
|
|
406
|
-
return
|
|
407
|
-
;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
|
|
408
|
-
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
|
|
409
|
-
|
|
410
|
-
;if(i&&!t)throw new
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
"\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
this.lexer=new
|
|
428
|
-
}else if("EOF"===r.text)throw new
|
|
429
|
-
this.expansionCount>this.settings.maxExpand)throw new
|
|
430
|
-
return 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
|
|
431
|
-
math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},
|
|
341
|
+
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,80);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,80,n)}return r}(e,r,n),a=new Tl(e,i),s=new El([a],{width:"400em",height:vl(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"})
|
|
342
|
+
;return bc.makeSvgSpan(["hide-tail"],[s],o)},Du=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Bu=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],Fu=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],ju=[0,1.2,1.8,2.4,3],Hu=[{type:"small",style:Js.SCRIPTSCRIPT},{type:"small",style:Js.SCRIPT},{type:"small",style:Js.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],qu=[{type:"small",style:Js.SCRIPTSCRIPT},{type:"small",style:Js.SCRIPT},{type:"small",style:Js.TEXT},{type:"stack"}],Uu=[{type:"small",style:Js.SCRIPTSCRIPT},{type:"small",style:Js.SCRIPT},{type:"small",style:Js.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{
|
|
343
|
+
type:"stack"}],$u=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.")},Gu=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=Au(e,$u(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]},Vu=function(e,t,n,r,o,i){var a;"<"===e||"\\lt"===e||"⟨"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"⟩"!==e||(e="\\rangle"),a=js.contains(Fu,e)?Hu:js.contains(Du,e)?Uu:qu;var s=Gu(e,t,a,r);return"small"===s.type?function(e,t,n,r,o,i){var a=bc.makeSymbol(e,"Main-Regular",o,r),s=Eu(a,t,r,i);return n&&Tu(s,r,t),s}(e,s.style,n,r,o,i):"large"===s.type?Nu(e,s.size,n,r,o,i):Ru(e,t,n,r,o,i)},Wu={sqrtImage:function(e,t){
|
|
344
|
+
var n,r,o=t.havingBaseSizing(),i=Gu("\\surd",e*o.sizeMultiplier,Uu,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=Pu("sqrtMain",l=(1+s+.08)/a,u=1e3+1e3*s+80,s,t)).style.minWidth="0.853em",r=.833/a):"large"===i.type?(u=1080*ju[i.size],c=(ju[i.size]+s)/a,l=(ju[i.size]+s+.08)/a,(n=Pu("sqrtSize"+i.size,l,u,s,t)).style.minWidth="1.02em",r=1/a):(l=e+s+.08,c=e+s,u=Math.floor(1e3*e+s)+80,(n=Pu("sqrtTall",l,u,s,t)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=vl(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"),js.contains(Du,e)||js.contains(Fu,e))return Nu(e,t,!1,n,r,o);if(js.contains(Bu,e))return Ru(e,ju[t],!1,n,r,o);throw new Rs("Illegal delimiter: '"+e+"'")},sizeToMaxHeight:ju,customSizedDelim:Vu,leftRightDelim:function(e,t,n,r,o,i){
|
|
345
|
+
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 Vu(e,c,!0,r,o,i)}},Yu={"\\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}
|
|
346
|
+
},Ku=["(","\\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 Xu(e,t){var n=pu(e);if(n&&js.contains(Ku,n.text))return n;throw new Rs(n?"Invalid delimiter '"+n.text+"' after '"+t.funcName+"'":"Invalid delimiter type '"+e.type+"'",e)}function Zu(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Nc({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=Xu(t[0],e);return{type:"delimsizing",
|
|
347
|
+
mode:e.parser.mode,size:Yu[e.funcName].size,mclass:Yu[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>"."===e.delim?bc.makeSpan([e.mclass]):Wu.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];"."!==e.delim&&t.push(Zc(e.delim,e.mode));var n=new Xc.MathNode("mo",t);"mopen"===e.mclass||"mclose"===e.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=vl(Wu.sizeToMaxHeight[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}}),Nc({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 Rs("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Xu(t[0],e).text,color:n}}}),Nc({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Xu(t[0],e),r=e.parser;++r.leftrightDepth;var o=r.parseExpression(!1)
|
|
348
|
+
;--r.leftrightDepth,r.expect("\\right",!1);var i=hu(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:o,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{Zu(e);for(var n,r,o=Bc(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?Uc(t,["mopen"]):Wu.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]=Wu.leftRightDelim(u.delim,i,a,u.options,e.mode,[]))}if("."===e.right)r=Uc(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;r=Wu.leftRightDelim(e.right,i,a,h,e.mode,["mclose"])}return o.push(r),bc.makeSpan(["minner"],o,t)},mathmlBuilder:(e,t)=>{Zu(e);var n=eu(e.body,t);if("."!==e.left){var r=new Xc.MathNode("mo",[Zc(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if("."!==e.right){var o=new Xc.MathNode("mo",[Zc(e.right,e.mode)])
|
|
349
|
+
;o.setAttribute("fence","true"),e.rightColor&&o.setAttribute("mathcolor",e.rightColor),n.push(o)}return Jc(n)}}),Nc({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Xu(t[0],e);if(!e.parser.leftrightDepth)throw new Rs("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;if("."===e.delim)n=Uc(t,[]);else{n=Wu.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?Zc("|","text"):Zc(e.delim,e.mode),r=new Xc.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Ju=(e,t)=>{var n,r,o=bc.wrapFragment($c(e.body,t),t),i=e.label.substr(1),a=t.sizeMultiplier,s=0,l=js.isCharacterBox(e.body);if("sout"===i)(n=bc.makeSpan(["stretchy","sout"])).height=t.fontMetrics().defaultRuleThickness/a,s=-.5*t.fontMetrics().xHeight;else if("phase"===i){var c=gl({
|
|
350
|
+
number:.6,unit:"pt"},t),u=gl({number:.35,unit:"ex"},t);a/=t.havingBaseSizing().sizeMultiplier;var h=o.height+o.depth+c+u;o.style.paddingLeft=vl(h/2+c);var d=Math.floor(1e3*h*a),p=function(e){return"M400000 "+e+" H0 L"+e/2+" 0 l65 45 L145 "+(e-80)+" H400000z"}(d),m=new El([new Tl("phase",p)],{width:"400em",height:vl(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});(n=bc.makeSvgSpan(["hide-tail"],[m],t)).style.height=vl(h),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=lu(o,i,f,g,t),/fbox|boxed|fcolorbox/.test(i)?(n.style.borderStyle="solid",n.style.borderWidth=vl(v)):"angl"===i&&.049!==v&&(n.style.borderTopWidth=vl(v),n.style.borderRightWidth=vl(v)),
|
|
351
|
+
s=o.depth+g,e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor,e.borderColor&&(n.style.borderColor=e.borderColor))}if(e.backgroundColor)r=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:s},{type:"elem",elem:o,shift:0}]},t);else{var y=/cancel|phase/.test(i)?["svg-align"]:[];r=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:n,shift:s,wrapperClasses:y}]},t)}return/cancel/.test(i)&&(r.height=o.height,r.depth=o.depth),/cancel/.test(i)&&!l?bc.makeSpan(["mord","cancel-lap"],[r],t):bc.makeSpan(["mord"],[r],t)},Qu=(e,t)=>{var n=0,r=new Xc.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[nu(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":
|
|
352
|
+
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};Nc({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=hu(t[0],"color-token").color,a=t[1];return{type:"enclose",mode:r.mode,label:o,backgroundColor:i,body:a}},htmlBuilder:Ju,mathmlBuilder:Qu}),Nc({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,
|
|
353
|
+
argTypes:["color","color","text"]},handler(e,t,n){var{parser:r,funcName:o}=e,i=hu(t[0],"color-token").color,a=hu(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:r.mode,label:o,backgroundColor:a,borderColor:i,body:s}},htmlBuilder:Ju,mathmlBuilder:Qu}),Nc({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]}}}),Nc({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:Ju,mathmlBuilder:Qu}),Nc({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 eh={};function th(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,
|
|
354
|
+
handler:o},l=0;l<n.length;++l)eh[n[l]]=s;i&&(Ec[t]=i),a&&(Tc[t]=a)}var nh={};function rh(e,t){nh[e]=t}function oh(e){var t=[];e.consumeSpaces();for(var n=e.fetch().text;"\\hline"===n||"\\hdashline"===n;)e.consume(),t.push("\\hdashline"===n),e.consumeSpaces(),n=e.fetch().text;return t}var ih=e=>{if(!e.parser.settings.displayMode)throw new Rs("{"+e.envName+"} can be used only in display mode.")};function ah(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function sh(e,t,n){var{hskipBeforeAndAfter:r,addJot:o,cols:i,arraystretch:a,colSeparationType:s,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:h,leqno:d}=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 Rs("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var m=[],f=[m],g=[],v=[],y=null!=l?[]:void 0;function _(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function b(){
|
|
355
|
+
y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new Is("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(Boolean(l)&&"1"===e.gullet.macros.get("\\@eqnsw")))}for(_(),v.push(oh(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(h&&m.length===h){if(c||s)throw new Rs("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){b(),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 Rs("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),b(),v.push(oh(e)),m=[],f.push(m),_()}}return e.gullet.endGroup(),
|
|
356
|
+
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:y,leqno:d}}function lh(e){return"d"===e.substr(0,1)?"display":"text"}var ch=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,h=5*u;e.colSeparationType&&"small"===e.colSeparationType&&(h=t.havingStyle(Js.SCRIPT).sizeMultiplier/t.sizeMultiplier*.2778);var d="CD"===e.colSeparationType?gl({number:3,unit:"ex"},t):12*u,p=3*u,m=e.arraystretch*d,f=.7*m,g=.3*m,v=0;function y(e){for(var t=0;t<e.length;++t)t>0&&(v+=.25),l.push({pos:v,isDashed:e[t]})}for(y(i[0]),n=0;n<e.body.length;++n){var _=e.body[n],b=f,w=g;a<_.length&&(a=_.length);var x=new Array(_.length);for(r=0;r<_.length;++r){var k=$c(_[r],t);w<k.depth&&(w=k.depth),b<k.height&&(b=k.height),x[r]=k}var S=e.rowGaps[n],C=0;S&&(C=gl(S,t))>0&&(w<(C+=g)&&(w=C),C=0),e.addJot&&(w+=p),x.height=b,
|
|
357
|
+
x.depth=w,v+=b,x.pos=v,v+=w+C,s[n]=x,y(i[n+1])}var A,E,T=v/2+t.fontMetrics().axisHeight,N=e.cols||[],L=[],M=[];if(e.tags&&e.tags.some((e=>e)))for(n=0;n<o;++n){var z=s[n],O=z.pos-T,I=e.tags[n],R=void 0;(R=!0===I?bc.makeSpan(["eqn-num"],[],t):!1===I?bc.makeSpan([],[],t):bc.makeSpan([],Bc(I,t,!0),t)).depth=z.depth,R.height=z.height,M.push({type:"elem",elem:R,shift:O})}for(r=0,E=0;r<a||E<N.length;++r,++E){for(var P=N[E]||{},D=!0;"separator"===P.type;){if(D||((A=bc.makeSpan(["arraycolsep"],[])).style.width=vl(t.fontMetrics().doubleRuleSep),L.push(A)),"|"!==P.separator&&":"!==P.separator)throw new Rs("Invalid separator type: "+P.separator);var B="|"===P.separator?"solid":"dashed",F=bc.makeSpan(["vertical-separator"],[],t);F.style.height=vl(v),F.style.borderRightWidth=vl(c),F.style.borderRightStyle=B,F.style.margin="0 "+vl(-c/2);var j=v-T;j&&(F.style.verticalAlign=vl(-j)),L.push(F),P=N[++E]||{},D=!1}if(!(r>=a)){var H=void 0
|
|
358
|
+
;(r>0||e.hskipBeforeAndAfter)&&0!==(H=js.deflt(P.pregap,h))&&((A=bc.makeSpan(["arraycolsep"],[])).style.width=vl(H),L.push(A));var q=[];for(n=0;n<o;++n){var U=s[n],$=U[r];if($){var G=U.pos-T;$.depth=U.depth,$.height=U.height,q.push({type:"elem",elem:$,shift:G})}}q=bc.makeVList({positionType:"individualShift",children:q},t),q=bc.makeSpan(["col-align-"+(P.align||"c")],[q]),L.push(q),(r<a-1||e.hskipBeforeAndAfter)&&0!==(H=js.deflt(P.postgap,h))&&((A=bc.makeSpan(["arraycolsep"],[])).style.width=vl(H),L.push(A))}}if(s=bc.makeSpan(["mtable"],L),l.length>0){for(var V=bc.makeLineSpan("hline",t,c),W=bc.makeLineSpan("hdashline",t,c),Y=[{type:"elem",elem:s,shift:0}];l.length>0;){var K=l.pop(),X=K.pos-T;K.isDashed?Y.push({type:"elem",elem:W,shift:X}):Y.push({type:"elem",elem:V,shift:X})}s=bc.makeVList({positionType:"individualShift",children:Y},t)}if(0===M.length)return bc.makeSpan(["mord"],[s],t);var Z=bc.makeVList({positionType:"individualShift",children:M},t);return Z=bc.makeSpan(["tag"],[Z],t),bc.makeFragment([s,Z])
|
|
359
|
+
},uh={c:"center ",l:"left ",r:"right "},hh=function(e,t){for(var n=[],r=new Xc.MathNode("mtd",[],["mtr-glue"]),o=new Xc.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 Xc.MathNode("mtd",[nu(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 Xc.MathNode("mtr",s))}var c=new Xc.MathNode("mtable",n),u=.5===e.arraystretch?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",vl(u));var h="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",f=!1,g=0,v=p.length;"separator"===p[0].type&&(h+="top ",g=1),"separator"===p[p.length-1].type&&(h+="bottom ",v-=1);for(var y=g;y<v;y++)"align"===p[y].type?(d+=uh[p[y].align],f&&(m+="none "),f=!0):"separator"===p[y].type&&f&&(m+="|"===p[y].separator?"solid ":"dashed ",f=!1);c.setAttribute("columnalign",d.trim()),/[sd]/.test(m)&&c.setAttribute("columnlines",m.trim())}if("align"===e.colSeparationType){
|
|
360
|
+
for(var _=e.cols||[],b="",w=1;w<_.length;w++)b+=w%2?"0em ":"1em ";c.setAttribute("columnspacing",b.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;h+=k[0].length>0?"left ":"",h+=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()),""!==h&&(c=new Xc.MathNode("menclose",[c])).setAttribute("notation",h.trim()),e.arraystretch&&e.arraystretch<1&&(c=new Xc.MathNode("mstyle",[c])).setAttribute("scriptlevel","1"),c},dh=function(e,t){-1===e.envName.indexOf("ed")&&ih(e);var n,r=[],o=e.envName.indexOf("at")>-1?"alignat":"align",i="split"===e.envName,a=sh(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:ah(e.envName),emptySingleRow:!0,
|
|
361
|
+
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+=hu(t[0].body[u],"textord").text}n=Number(c),s=2*n}var h=!s;a.body.forEach((function(e){for(var t=1;t<e.length;t+=2){var r=hu(e[t],"styling");hu(r.body[0],"ordgroup").body.unshift(l)}if(h)s<e.length&&(s=e.length);else{var o=e.length/2;if(n<o)throw new Rs("Too many math in a row: expected "+n+", but got "+o,e[0])}}));for(var d=0;d<s;++d){var p="r",m=0;d%2==1?p="l":d>0&&h&&(m=1),r[d]={type:"align",align:p,pregap:m,postgap:0}}return a.colSeparationType=h?"align":"alignat",a};th({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=(pu(t[0])?[t[0]]:hu(t[0],"ordgroup").body).map((function(e){var t=du(e).text;if(-1!=="lcr".indexOf(t))return{type:"align",align:t};if("|"===t)return{type:"separator",separator:"|"};if(":"===t)return{type:"separator",separator:":"}
|
|
362
|
+
;throw new Rs("Unknown column alignment: "+t,e)})),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return sh(e.parser,r,lh(e.envName))},htmlBuilder:ch,mathmlBuilder:hh}),th({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 Rs("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),r.cols=[{type:"align",align:n}]}}var i=sh(e.parser,r,lh(e.envName)),a=Math.max(0,...i.body.map((e=>e.length)));return i.cols=new Array(a).fill({type:"align",align:n}),t?{
|
|
363
|
+
type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t=sh(e.parser,{arraystretch:.5},"script");return t.colSeparationType="small",t},htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=(pu(t[0])?[t[0]]:hu(t[0],"ordgroup").body).map((function(e){var t=du(e).text;if(-1!=="lc".indexOf(t))return{type:"align",align:t};throw new Rs("Unknown column alignment: "+t,e)}));if(n.length>1)throw new Rs("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=sh(e.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new Rs("{subarray} can contain only one column");return r},htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t=sh(e.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{
|
|
364
|
+
type:"align",align:"l",pregap:0,postgap:0}]},lh(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:ch,mathmlBuilder:hh}),th({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:dh,htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){js.contains(["gather","gather*"],e.envName)&&ih(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:ah(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return sh(e.parser,t,"display")},htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:dh,htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){ih(e);var t={autoTag:ah(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno}
|
|
365
|
+
;return sh(e.parser,t,"display")},htmlBuilder:ch,mathmlBuilder:hh}),th({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(ih(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 Rs("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(_u(l[u])){i.push(c);var h=du(l[u+=1]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(h)>-1);else{if(!("<>AV".indexOf(h)>-1))throw new Rs('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=h,("mathord"===(r=l[f]).type||"atom"===r.type)&&r.text===o){m=!1,u=f;break
|
|
366
|
+
}if(_u(l[f]))throw new Rs("Missing a "+h+" character to complete a CD arrow.",l[f]);d[p].body.push(l[f])}if(m)throw new Rs("Missing a "+h+" character to complete a CD arrow.",l[u])}}var g={type:"styling",body:[bu(h,d,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:ch,mathmlBuilder:hh}),rh("\\nonumber","\\gdef\\@eqnsw{0}"),rh("\\notag","\\nonumber"),Nc({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Rs(e.funcName+" valid only within array environment")}});var ph=eh;Nc({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,
|
|
367
|
+
argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,o=t[0];if("ordgroup"!==o.type)throw new Rs("Invalid environment name",o);for(var i="",a=0;a<o.body.length;++a)i+=hu(o.body[a],"textord").text;if("\\begin"===r){if(!ph.hasOwnProperty(i))throw new Rs("No such environment: "+i,o);var s=ph[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",s),u={mode:n.mode,envName:i,parser:n},h=s.handler(u,l,c);n.expect("\\end",!1);var d=n.nextToken,p=hu(n.parseFunction(),"environment");if(p.name!==i)throw new Rs("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",d);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:o}}});var mh=bc.makeSpan;function fh(e,t){var n=Bc(e.body,t,!0);return mh([e.mclass],n,t)}function gh(e,t){var n,r=eu(e.body,t);return"minner"===e.mclass?n=new Xc.MathNode("mpadded",r):"mord"===e.mclass?e.isCharacterBox?(n=r[0]).type="mi":n=new Xc.MathNode("mi",r):(e.isCharacterBox?(n=r[0]).type="mo":n=new Xc.MathNode("mo",r),"mbin"===e.mclass?(n.attributes.lspace="0.22em",
|
|
368
|
+
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}Nc({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.substr(5),body:zc(o),isCharacterBox:js.isCharacterBox(o)}},htmlBuilder:fh,mathmlBuilder:gh});var vh=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};Nc({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:vh(t[0]),body:zc(t[1]),isCharacterBox:js.isCharacterBox(t[1])}}}),Nc({type:"mclass",names:["\\stackrel","\\overset","\\underset"],
|
|
369
|
+
props:{numArgs:2},handler(e,t){var n,{parser:r,funcName:o}=e,i=t[1],a=t[0];n="\\stackrel"!==o?vh(i):"mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:"\\stackrel"!==o,body:zc(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:js.isCharacterBox(l)}},htmlBuilder:fh,mathmlBuilder:gh});var yh=(e,t)=>{var n=e.font,r=t.withFont(n);return $c(e.body,r)},_h=(e,t)=>{var n=e.font,r=t.withFont(n);return nu(e.body,r)},bh={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Nc({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,o=Mc(t[0]),i=r;return i in bh&&(i=bh[i]),{type:"font",mode:n.mode,font:i.slice(1),body:o}},
|
|
370
|
+
htmlBuilder:yh,mathmlBuilder:_h}),Nc({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0],o=js.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:vh(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:o}}}),Nc({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:yh,mathmlBuilder:_h});var wh=(e,t)=>{var n=t;return"display"===e?n=n.id>=Js.SCRIPT.id?n.text():Js.DISPLAY:"text"===e&&n.size===Js.DISPLAY.size?n=Js.TEXT:"script"===e?n=Js.SCRIPT:"scriptscript"===e&&(n=Js.SCRIPTSCRIPT),n},xh=(e,t)=>{var n,r=wh(e.size,t.style),o=r.fracNum(),i=r.fracDen();n=t.havingStyle(o);var a=$c(e.numer,n,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm
|
|
371
|
+
;a.height=a.height<s?s:a.height,a.depth=a.depth<l?l:a.depth}n=t.havingStyle(i);var c,u,h,d,p,m,f,g,v,y,_=$c(e.denom,n,t);if(e.hasBarLine?(e.barSize?(u=gl(e.barSize,t),c=bc.makeLineSpan("frac-line",t,u)):c=bc.makeLineSpan("frac-line",t),u=c.height,h=c.height):(c=null,u=0,h=t.fontMetrics().defaultRuleThickness),r.size===Js.DISPLAY.size||"display"===e.size?(d=t.fontMetrics().num1,p=u>0?3*h:7*h,m=t.fontMetrics().denom1):(u>0?(d=t.fontMetrics().num2,p=h):(d=t.fontMetrics().num3,p=3*h),m=t.fontMetrics().denom2),c){var b=t.fontMetrics().axisHeight;d-a.depth-(b+.5*u)<p&&(d+=p-(d-a.depth-(b+.5*u))),b-.5*u-(_.height-m)<p&&(m+=p-(b-.5*u-(_.height-m)));var w=-(b-.5*u);f=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:_,shift:m},{type:"elem",elem:c,shift:w},{type:"elem",elem:a,shift:-d}]},t)}else{var x=d-a.depth-(_.height-m);x<p&&(d+=.5*(p-x),m+=.5*(p-x)),f=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:_,shift:m},{type:"elem",elem:a,shift:-d}]},t)}
|
|
372
|
+
return n=t.havingStyle(r),f.height*=n.sizeMultiplier/t.sizeMultiplier,f.depth*=n.sizeMultiplier/t.sizeMultiplier,g=r.size===Js.DISPLAY.size?t.fontMetrics().delim1:r.size===Js.SCRIPTSCRIPT.size?t.havingStyle(Js.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,v=null==e.leftDelim?Uc(t,["mopen"]):Wu.customSizedDelim(e.leftDelim,g,!0,t.havingStyle(r),e.mode,["mopen"]),y=e.continued?bc.makeSpan([]):null==e.rightDelim?Uc(t,["mclose"]):Wu.customSizedDelim(e.rightDelim,g,!0,t.havingStyle(r),e.mode,["mclose"]),bc.makeSpan(["mord"].concat(n.sizingClasses(t)),[v,bc.makeSpan(["mfrac"],[f]),y],t)},kh=(e,t)=>{var n=new Xc.MathNode("mfrac",[nu(e.numer,t),nu(e.denom,t)]);if(e.hasBarLine){if(e.barSize){var r=gl(e.barSize,t);n.setAttribute("linethickness",vl(r))}}else n.setAttribute("linethickness","0px");var o=wh(e.size,t.style);if(o.size!==t.style.size){n=new Xc.MathNode("mstyle",[n]);var i=o.size===Js.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}
|
|
373
|
+
if(null!=e.leftDelim||null!=e.rightDelim){var a=[];if(null!=e.leftDelim){var s=new Xc.MathNode("mo",[new Xc.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),a.push(s)}if(a.push(n),null!=e.rightDelim){var l=new Xc.MathNode("mo",[new Xc.TextNode(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}return Jc(a)}return n};Nc({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;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"}
|
|
374
|
+
return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:n,leftDelim:s,rightDelim:l,size:c,barSize:null}},htmlBuilder:xh,mathmlBuilder:kh}),Nc({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}}}),Nc({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":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 Sh=["display","text","script","scriptscript"],Ch=function(e){var t=null;return e.length>0&&(t="."===(t=e)?null:t),t};Nc({type:"genfrac",names:["\\genfrac"],
|
|
375
|
+
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=Mc(t[0]),s="atom"===a.type&&"open"===a.family?Ch(a.text):null,l=Mc(t[1]),c="atom"===l.type&&"close"===l.family?Ch(l.text):null,u=hu(t[2],"size"),h=null;n=!!u.isBlank||(h=u.value).number>0;var d="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){var m=hu(p.body[0],"textord");d=Sh[Number(m.text)]}}else p=hu(p,"textord"),d=Sh[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:o,denom:i,continued:!1,hasBarLine:n,barSize:h,leftDelim:s,rightDelim:c,size:d}},htmlBuilder:xh,mathmlBuilder:kh}),Nc({type:"infix",names:["\\above"],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:hu(t[0],"size").value,token:o}}}),Nc({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{
|
|
376
|
+
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}(hu(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:xh,mathmlBuilder:kh});var Ah=(e,t)=>{var n,r,o=t.style;"supsub"===e.type?(n=e.sup?$c(e.sup,t.havingStyle(o.sup()),t):$c(e.sub,t.havingStyle(o.sub()),t),r=hu(e.base,"horizBrace")):r=hu(e,"horizBrace");var i,a=$c(r.base,t.havingBaseStyle(Js.DISPLAY)),s=uu(r,t);if(r.isOver?(i=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},t)).children[0].children[0].children[1].classes.push("svg-align"):(i=bc.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){
|
|
377
|
+
var l=bc.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t);i=r.isOver?bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},t):bc.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 bc.makeSpan(["mord",r.isOver?"mover":"munder"],[i],t)};Nc({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:Ah,mathmlBuilder:(e,t)=>{var n=cu(e.label);return new Xc.MathNode(e.isOver?"mover":"munder",[nu(e.base,t),n])}}),Nc({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],o=hu(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:n.mode,href:o,body:zc(r)}:n.formatUnsupportedCmd("\\href")},
|
|
378
|
+
htmlBuilder:(e,t)=>{var n=Bc(e.body,t,!1);return bc.makeAnchor(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=tu(e.body,t);return n instanceof Yc||(n=new Yc("mrow",[n])),n.setAttribute("href",e.href),n}}),Nc({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=hu(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:zc(s)}}}),Nc({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:zc(t[0])}},htmlBuilder(e,t){var n=Bc(e.body,t,!1);return bc.makeFragment(n)},mathmlBuilder:(e,t)=>new Xc.MathNode("mrow",eu(e.body,t))}),Nc({type:"html",
|
|
379
|
+
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=hu(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 h=c[u].split("=");if(2!==h.length)throw new Rs("Error parsing key-value for \\htmlData");l["data-"+h[0].trim()]=h[1].trim()}n={command:"\\htmlData",attributes:l};break;default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(n)?{type:"html",mode:r.mode,attributes:l,body:zc(s)}:r.formatUnsupportedCmd(o)},htmlBuilder:(e,t)=>{var n=Bc(e.body,t,!1),r=["enclosing"]
|
|
380
|
+
;e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var o=bc.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)=>tu(e.body,t)}),Nc({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:zc(t[0]),mathml:zc(t[1])}},htmlBuilder:(e,t)=>{var n=Bc(e.html,t,!1);return bc.makeFragment(n)},mathmlBuilder:(e,t)=>tu(e.mathml,t)});var Eh=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 Rs("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!fl(n))throw new Rs("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Nc({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{
|
|
381
|
+
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=hu(n[0],"raw").string.split(","),c=0;c<l.length;c++){var u=l[c].split("=");if(2===u.length){var h=u[1].trim();switch(u[0].trim()){case"alt":s=h;break;case"width":o=Eh(h);break;case"height":i=Eh(h);break;case"totalheight":a=Eh(h);break;default:throw new Rs("Invalid key: '"+u[0]+"' in \\includegraphics.")}}}var d=hu(t[0],"url").url;return""===s&&(s=(s=(s=d).replace(/^.*[\\/]/,"")).substring(0,s.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:s,width:o,height:i,totalheight:a,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=gl(e.height,t),r=0;e.totalheight.number>0&&(r=gl(e.totalheight,t)-n);var o=0;e.width.number>0&&(o=gl(e.width,t));var i={height:vl(n+r)};o>0&&(i.width=vl(o)),r>0&&(i.verticalAlign=vl(-r));var a=new Sl(e.src,e.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(e,t)=>{
|
|
382
|
+
var n=new Xc.MathNode("mglyph",[]);n.setAttribute("alt",e.alt);var r=gl(e.height,t),o=0;if(e.totalheight.number>0&&(o=gl(e.totalheight,t)-r,n.setAttribute("valign",vl(-o))),n.setAttribute("height",vl(r+o)),e.width.number>0){var i=gl(e.width,t);n.setAttribute("width",vl(i))}return n.setAttribute("src",e.src),n}}),Nc({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=hu(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"),"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)=>bc.makeGlue(e.dimension,t),mathmlBuilder(e,t){var n=gl(e.dimension,t)
|
|
383
|
+
;return new Xc.SpaceNode(n)}}),Nc({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=bc.makeSpan([],[$c(e.body,t)]),n=bc.makeSpan(["inner"],[n],t)):n=bc.makeSpan(["inner"],[$c(e.body,t)]);var r=bc.makeSpan(["fix"],[]),o=bc.makeSpan([e.alignment],[n,r],t),i=bc.makeSpan(["strut"]);return i.style.height=vl(o.height+o.depth),o.depth&&(i.style.verticalAlign=vl(-o.depth)),o.children.unshift(i),o=bc.makeSpan(["thinbox"],[o],t),bc.makeSpan(["mord","vbox"],[o],t)},mathmlBuilder:(e,t)=>{var n=new Xc.MathNode("mpadded",[nu(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}}),Nc({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,o=r.mode
|
|
384
|
+
;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}}}),Nc({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Rs("Mismatched "+e.funcName)}});var Th=(e,t)=>{switch(t.style.size){case Js.DISPLAY.size:return e.display;case Js.TEXT.size:return e.text;case Js.SCRIPT.size:return e.script;case Js.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Nc({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:zc(t[0]),text:zc(t[1]),script:zc(t[2]),scriptscript:zc(t[3])}},htmlBuilder:(e,t)=>{var n=Th(e,t),r=Bc(n,t,!1);return bc.makeFragment(r)},mathmlBuilder:(e,t)=>{var n=Th(e,t);return tu(n,t)}});var Nh=(e,t,n,r,o,i,a)=>{e=bc.makeSpan([],[e]);var s,l,c,u=n&&js.isCharacterBox(n);if(t){var h=$c(t,r.havingStyle(o.sup()),r);l={elem:h,
|
|
385
|
+
kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-h.depth)}}if(n){var d=$c(n,r.havingStyle(o.sub()),r);s={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}if(l&&s){var p=r.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+e.depth+a;c=bc.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:vl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e},{type:"kern",size:l.kern},{type:"elem",elem:l.elem,marginLeft:vl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(s){var m=e.height-a;c=bc.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:vl(-i)},{type:"kern",size:s.kern},{type:"elem",elem:e}]},r)}else{if(!l)return e;var f=e.depth+a;c=bc.makeVList({positionType:"bottom",positionData:f,children:[{type:"elem",elem:e},{type:"kern",size:l.kern},{
|
|
386
|
+
type:"elem",elem:l.elem,marginLeft:vl(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}var g=[c];if(s&&0!==i&&!u){var v=bc.makeSpan(["mspace"],[],r);v.style.marginRight=vl(i),g.unshift(v)}return bc.makeSpan(["mop","op-limits"],g,r)},Lh=["\\smallint"],Mh=(e,t)=>{var n,r,o,i=!1;"supsub"===e.type?(n=e.sup,r=e.sub,o=hu(e.base,"op"),i=!0):o=hu(e,"op");var a,s=t.style,l=!1;if(s.size===Js.DISPLAY.size&&o.symbol&&!js.contains(Lh,o.name)&&(l=!0),o.symbol){var c=l?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==o.name&&"\\oiiint"!==o.name||(u=o.name.substr(1),o.name="oiint"===u?"\\iint":"\\iiint"),a=bc.makeSymbol(o.name,c,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var h=a.italic,d=bc.staticSvg(u+"Size"+(l?"2":"1"),t);a=bc.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:d,shift:l?.08:0}]},t),o.name="\\"+u,a.classes.unshift("mop"),a.italic=h}}else if(o.body){var p=Bc(o.body,t,!0)
|
|
387
|
+
;1===p.length&&p[0]instanceof Al?(a=p[0]).classes[0]="mop":a=bc.makeSpan(["mop"],p,t)}else{for(var m=[],f=1;f<o.name.length;f++)m.push(bc.mathsym(o.name[f],o.mode,t));a=bc.makeSpan(["mop"],m,t)}var g=0,v=0;return(a instanceof Al||"\\oiint"===o.name||"\\oiiint"===o.name)&&!o.suppressBaseShift&&(g=(a.height-a.depth)/2-t.fontMetrics().axisHeight,v=a.italic),i?Nh(a,n,r,t,s,v,g):(g&&(a.style.position="relative",a.style.top=vl(g)),a)},zh=(e,t)=>{var n;if(e.symbol)n=new Yc("mo",[Zc(e.name,e.mode)]),js.contains(Lh,e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Yc("mo",eu(e.body,t));else{n=new Yc("mi",[new Kc(e.name.slice(1))]);var r=new Yc("mo",[Zc("","text")]);n=e.parentIsSupSub?new Yc("mrow",[n,r]):Wc([n,r])}return n},Oh={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Nc({type:"op",
|
|
388
|
+
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:Mh,mathmlBuilder:zh}),Nc({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:zc(r)}},htmlBuilder:Mh,mathmlBuilder:zh});var Ih={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Nc({type:"op",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"],
|
|
389
|
+
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:Mh,mathmlBuilder:zh}),Nc({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:Mh,mathmlBuilder:zh}),Nc({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs: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:Mh,mathmlBuilder:zh});var Rh=(e,t)=>{var n,r,o,i,a=!1;if("supsub"===e.type?(n=e.sup,r=e.sub,o=hu(e.base,"operatorname"),a=!0):o=hu(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=Bc(s,t.withFont("mathrm"),!0),c=0;c<l.length;c++){
|
|
390
|
+
var u=l[c];u instanceof Al&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=bc.makeSpan(["mop"],l,t)}else i=bc.makeSpan(["mop"],[],t);return a?Nh(i,n,r,t,t.style,0,0):i};function Ph(e,t,n){for(var r=Bc(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 bc.makeFragment(r)}Nc({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:zc(o),alwaysHandleSupSub:"\\operatornamewithlimits"===r,limits:!1,parentIsSupSub:!1}},htmlBuilder:Rh,mathmlBuilder:(e,t)=>{for(var n=eu(e.body,t.withFont("mathrm")),r=!0,o=0;o<n.length;o++){var i=n[o];if(i instanceof Xc.SpaceNode);else if(i instanceof Xc.MathNode)switch(i.type){case"mi":case"mn":case"ms":
|
|
391
|
+
case"mspace":case"mtext":break;case"mo":var a=i.children[0];1===i.children.length&&a instanceof Xc.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 Xc.TextNode(s)]}var l=new Xc.MathNode("mi",n);l.setAttribute("mathvariant","normal");var c=new Xc.MathNode("mo",[Zc("","text")]);return e.parentIsSupSub?new Xc.MathNode("mrow",[l,c]):Xc.newDocumentFragment([l,c])}}),rh("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Lc({type:"ordgroup",htmlBuilder:(e,t)=>e.semisimple?bc.makeFragment(Bc(e.body,t,!1)):bc.makeSpan(["mord"],Bc(e.body,t,!0),t),mathmlBuilder:(e,t)=>tu(e.body,t,!0)}),Nc({type:"overline",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=$c(e.body,t.havingCrampedStyle()),r=bc.makeLineSpan("overline-line",t),o=t.fontMetrics().defaultRuleThickness,i=bc.makeVList({positionType:"firstBaseline",
|
|
392
|
+
children:[{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r},{type:"kern",size:o}]},t);return bc.makeSpan(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Xc.MathNode("mo",[new Xc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Xc.MathNode("mover",[nu(e.body,t),n]);return r.setAttribute("accent","true"),r}}),Nc({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:zc(r)}},htmlBuilder:(e,t)=>{var n=Bc(e.body,t.withPhantom(),!1);return bc.makeFragment(n)},mathmlBuilder:(e,t)=>{var n=eu(e.body,t);return new Xc.MathNode("mphantom",n)}}),Nc({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,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=bc.makeSpan([],[$c(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
|
|
393
|
+
;return n=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t),bc.makeSpan(["mord"],[n],t)},mathmlBuilder:(e,t)=>{var n=eu(zc(e.body),t),r=new Xc.MathNode("mphantom",n),o=new Xc.MathNode("mpadded",[r]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),Nc({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=bc.makeSpan(["inner"],[$c(e.body,t.withPhantom())]),r=bc.makeSpan(["fix"],[]);return bc.makeSpan(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=eu(zc(e.body),t),r=new Xc.MathNode("mphantom",n),o=new Xc.MathNode("mpadded",[r]);return o.setAttribute("width","0px"),o}}),Nc({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=hu(t[0],"size").value,o=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:o}},htmlBuilder(e,t){var n=$c(e.body,t),r=gl(e.dy,t)
|
|
394
|
+
;return bc.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},t)},mathmlBuilder(e,t){var n=new Xc.MathNode("mpadded",[nu(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}}),Nc({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}}),Nc({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,o=n[0],i=hu(t[0],"size"),a=hu(t[1],"size");return{type:"rule",mode:r.mode,shift:o&&hu(o,"size").value,width:i.value,height:a.value}},htmlBuilder(e,t){var n=bc.makeSpan(["mord","rule"],[],t),r=gl(e.width,t),o=gl(e.height,t),i=e.shift?gl(e.shift,t):0;return n.style.borderRightWidth=vl(r),n.style.borderTopWidth=vl(o),n.style.bottom=vl(i),n.width=r,n.height=o+i,n.depth=-i,n.maxFontSize=1.125*o*t.sizeMultiplier,n},mathmlBuilder(e,t){
|
|
395
|
+
var n=gl(e.width,t),r=gl(e.height,t),o=e.shift?gl(e.shift,t):0,i=t.color&&t.getColor()||"black",a=new Xc.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",vl(n)),a.setAttribute("height",vl(r));var s=new Xc.MathNode("mpadded",[a]);return o>=0?s.setAttribute("height",vl(o)):(s.setAttribute("height",vl(o)),s.setAttribute("depth",vl(-o))),s.setAttribute("voffset",vl(o)),s}});var Dh=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];Nc({type:"sizing",names:Dh,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:Dh.indexOf(r)+1,body:i}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return Ph(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=eu(e.body,n),o=new Xc.MathNode("mstyle",r);return o.setAttribute("mathsize",vl(n.sizeMultiplier)),o}}),Nc({type:"smash",names:["\\smash"],props:{
|
|
396
|
+
numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,o=!1,i=!1,a=n[0]&&hu(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=bc.makeSpan([],[$c(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=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},t);return bc.makeSpan(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var n=new Xc.MathNode("mpadded",[nu(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}}),Nc({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){
|
|
397
|
+
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=$c(e.body,t.havingCrampedStyle());0===n.height&&(n.height=t.fontMetrics().xHeight),n=bc.wrapFragment(n,t);var r=t.fontMetrics().defaultRuleThickness,o=r;t.style.id<Js.TEXT.id&&(o=t.fontMetrics().xHeight);var i=r+o/4,a=n.height+n.depth+i+r,{span:s,ruleWidth:l,advanceWidth:c}=Wu.sqrtImage(a,t),u=s.height-l;u>n.height+n.depth+i&&(i=(i+u-n.height-n.depth)/2);var h=s.height-n.height-i-l;n.style.paddingLeft=vl(c);var d=bc.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:s},{type:"kern",size:l}]},t);if(e.index){var p=t.havingStyle(Js.SCRIPTSCRIPT),m=$c(e.index,p,t),f=.6*(d.height-d.depth),g=bc.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:m}]},t),v=bc.makeSpan(["root"],[g]);return bc.makeSpan(["mord","sqrt"],[v,d],t)}return bc.makeSpan(["mord","sqrt"],[d],t)},mathmlBuilder(e,t){
|
|
398
|
+
var{body:n,index:r}=e;return r?new Xc.MathNode("mroot",[nu(n,t),nu(r,t)]):new Xc.MathNode("msqrt",[nu(n,t)])}});var Bh={display:Js.DISPLAY,text:Js.TEXT,script:Js.SCRIPT,scriptscript:Js.SCRIPTSCRIPT};Nc({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=Bh[e.style],r=t.havingStyle(n).withFont("");return Ph(e.body,r,t)},mathmlBuilder(e,t){var n=Bh[e.style],r=t.havingStyle(n),o=eu(e.body,r),i=new Xc.MathNode("mstyle",o),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});Lc({type:"supsub",htmlBuilder(e,t){var n=function(e,t){var n=e.base
|
|
399
|
+
;return n?"op"===n.type?n.limits&&(t.style.size===Js.DISPLAY.size||n.alwaysHandleSupSub)?Mh:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(t.style.size===Js.DISPLAY.size||n.limits)?Rh:null:"accent"===n.type?js.isCharacterBox(n.base)?mu:null:"horizBrace"===n.type&&!e.sub===n.isOver?Ah:null:null}(e,t);if(n)return n(e,t);var r,o,i,{base:a,sup:s,sub:l}=e,c=$c(a,t),u=t.fontMetrics(),h=0,d=0,p=a&&js.isCharacterBox(a);if(s){var m=t.havingStyle(t.style.sup());r=$c(s,m,t),p||(h=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(l){var f=t.havingStyle(t.style.sub());o=$c(l,f,t),p||(d=c.depth+f.fontMetrics().subDrop*f.sizeMultiplier/t.sizeMultiplier)}i=t.style===Js.DISPLAY?u.sup1:t.style.cramped?u.sup3:u.sup2;var g,v=t.sizeMultiplier,y=vl(.5/u.ptPerEm/v),_=null;if(o){var b=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(c instanceof Al||b)&&(_=vl(-c.italic))}if(r&&o){h=Math.max(h,i,r.depth+.25*u.xHeight),d=Math.max(d,u.sub2)
|
|
400
|
+
;var w=4*u.defaultRuleThickness;if(h-r.depth-(o.height-d)<w){d=w-(h-r.depth)+o.height;var x=.8*u.xHeight-(h-r.depth);x>0&&(h+=x,d-=x)}var k=[{type:"elem",elem:o,shift:d,marginRight:y,marginLeft:_},{type:"elem",elem:r,shift:-h,marginRight:y}];g=bc.makeVList({positionType:"individualShift",children:k},t)}else if(o){d=Math.max(d,u.sub1,o.height-.8*u.xHeight);var S=[{type:"elem",elem:o,marginLeft:_,marginRight:y}];g=bc.makeVList({positionType:"shift",positionData:d,children:S},t)}else{if(!r)throw new Error("supsub must have either sup or sub.");h=Math.max(h,i,r.depth+.25*u.xHeight),g=bc.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:r,marginRight:y}]},t)}var C=qc(c,"right")||"mord";return bc.makeSpan([C],[c,bc.makeSpan(["msupsub"],[g])],t)},mathmlBuilder(e,t){var n,r=!1;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=[nu(e.base,t)]
|
|
401
|
+
;if(e.sub&&i.push(nu(e.sub,t)),e.sup&&i.push(nu(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===Js.DISPLAY||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(t.style===Js.DISPLAY||a.limits)?"munderover":"msubsup"}else{var s=e.base;o=s&&"op"===s.type&&s.limits&&(t.style===Js.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||t.style===Js.DISPLAY)?"munder":"msub"}else{var l=e.base;o=l&&"op"===l.type&&l.limits&&(t.style===Js.DISPLAY||l.alwaysHandleSupSub)||l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||t.style===Js.DISPLAY)?"mover":"msup"}return new Xc.MathNode(o,i)}}),Lc({type:"atom",htmlBuilder:(e,t)=>bc.mathsym(e.text,e.mode,t,["m"+e.family]),mathmlBuilder(e,t){var n=new Xc.MathNode("mo",[Zc(e.text,e.mode)]);if("bin"===e.family){var r=Qc(e,t);"bold-italic"===r&&n.setAttribute("mathvariant",r)
|
|
402
|
+
}else"punct"===e.family?n.setAttribute("separator","true"):"open"!==e.family&&"close"!==e.family||n.setAttribute("stretchy","false");return n}});var Fh={mi:"italic",mn:"normal",mtext:"normal"};Lc({type:"mathord",htmlBuilder:(e,t)=>bc.makeOrd(e,t,"mathord"),mathmlBuilder(e,t){var n=new Xc.MathNode("mi",[Zc(e.text,e.mode,t)]),r=Qc(e,t)||"italic";return r!==Fh[n.type]&&n.setAttribute("mathvariant",r),n}}),Lc({type:"textord",htmlBuilder:(e,t)=>bc.makeOrd(e,t,"textord"),mathmlBuilder(e,t){var n,r=Zc(e.text,e.mode,t),o=Qc(e,t)||"normal";return n="text"===e.mode?new Xc.MathNode("mtext",[r]):/[0-9]/.test(e.text)?new Xc.MathNode("mn",[r]):"\\prime"===e.text?new Xc.MathNode("mo",[r]):new Xc.MathNode("mi",[r]),o!==Fh[n.type]&&n.setAttribute("mathvariant",o),n}});var jh={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Hh={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Lc({type:"spacing",htmlBuilder(e,t){if(Hh.hasOwnProperty(e.text)){var n=Hh[e.text].className||""
|
|
403
|
+
;if("text"===e.mode){var r=bc.makeOrd(e,t,"textord");return r.classes.push(n),r}return bc.makeSpan(["mspace",n],[bc.mathsym(e.text,e.mode,t)],t)}if(jh.hasOwnProperty(e.text))return bc.makeSpan(["mspace",jh[e.text]],[],t);throw new Rs('Unknown type of space "'+e.text+'"')},mathmlBuilder(e,t){if(!Hh.hasOwnProperty(e.text)){if(jh.hasOwnProperty(e.text))return new Xc.MathNode("mspace");throw new Rs('Unknown type of space "'+e.text+'"')}return new Xc.MathNode("mtext",[new Xc.TextNode(" ")])}});var qh=()=>{var e=new Xc.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Lc({type:"tag",mathmlBuilder(e,t){var n=new Xc.MathNode("mtable",[new Xc.MathNode("mtr",[qh(),new Xc.MathNode("mtd",[tu(e.body,t)]),qh(),new Xc.MathNode("mtd",[tu(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var Uh={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},$h={"\\textbf":"textbf","\\textmd":"textmd"},Gh={"\\textit":"textit","\\textup":"textup"},Vh=(e,t)=>{var n=e.font
|
|
404
|
+
;return n?Uh[n]?t.withTextFontFamily(Uh[n]):$h[n]?t.withTextFontWeight($h[n]):t.withTextFontShape(Gh[n]):t};Nc({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],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:zc(o),font:r}},htmlBuilder(e,t){var n=Vh(e,t),r=Bc(e.body,n,!0);return bc.makeSpan(["mord","text"],r,n)},mathmlBuilder(e,t){var n=Vh(e,t);return tu(e.body,n)}}),Nc({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){var n=$c(e.body,t),r=bc.makeLineSpan("underline-line",t),o=t.fontMetrics().defaultRuleThickness,i=bc.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 bc.makeSpan(["mord","underline"],[i],t)
|
|
405
|
+
},mathmlBuilder(e,t){var n=new Xc.MathNode("mo",[new Xc.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Xc.MathNode("munder",[nu(e.body,t),n]);return r.setAttribute("accentunder","true"),r}}),Nc({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=$c(e.body,t),r=t.fontMetrics().axisHeight,o=.5*(n.height-r-(n.depth+r));return bc.makeVList({positionType:"shift",positionData:o,children:[{type:"elem",elem:n}]},t)},mathmlBuilder:(e,t)=>new Xc.MathNode("mpadded",[nu(e.body,t)],["vcenter"])}),Nc({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Rs("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=Wh(e),r=[],o=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var a=n[i];"~"===a&&(a="\\textasciitilde"),r.push(bc.makeSymbol(a,"Typewriter-Regular",e.mode,o,["mord","texttt"]))}
|
|
406
|
+
return bc.makeSpan(["mord","text"].concat(o.sizingClasses(t)),bc.tryCombineChars(r),o)},mathmlBuilder(e,t){var n=new Xc.TextNode(Wh(e)),r=new Xc.MathNode("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var Wh=e=>e.body.replace(/ /g,e.star?"␣":" "),Yh=Ac,Kh=new RegExp("[̀-ͯ]+$");class Xh{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("([ \r\n\t]+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-][̀-ͯ]*|[\ud800-\udbff][\udc00-\udfff][̀-ͯ]*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|(\\\\[a-zA-Z@]+)[ \r\n\t]*|\\\\[^\ud800-\udfff])","g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Is("EOF",new Os(this,t,t));var n=this.tokenRegex.exec(e);if(null===n||n.index!==t)throw new Rs("Unexpected character: '"+e[t]+"'",new Is(e[t],new Os(this,t,t+1)));var r=n[6]||n[3]||(n[2]?"\\ ":" ")
|
|
407
|
+
;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 Is(r,new Os(this,t,this.tokenRegex.lastIndex))}}class Zh{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(){if(0===this.undefStack.length)throw new Rs("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){
|
|
408
|
+
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 Jh=nh;rh("\\noexpand",(function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),rh("\\expandafter",(function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),rh("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),rh("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),rh("\\@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}})),
|
|
409
|
+
rh("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),rh("\\TextOrMath",(function(e){var t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));var Qh={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};rh("\\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 Rs("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(null==(r=Qh[n.text])||r>=t)throw new Rs("Invalid base-"+t+" digit "+n.text);for(var o;null!=(o=Qh[e.future().text])&&o<t;)r*=t,r+=o,e.popToken()}return"\\@char{"+r+"}"}));var ed=(e,t,n)=>{var r=e.consumeArg().tokens;if(1!==r.length)throw new Rs("\\newcommand's first argument must be a macro name");var o=r[0].text,i=e.isDefined(o)
|
|
410
|
+
;if(i&&!t)throw new Rs("\\newcommand{"+o+"} attempting to redefine "+o+"; use \\renewcommand");if(!i&&!n)throw new Rs("\\renewcommand{"+o+"} when command "+o+" does not yet exist; use \\newcommand");var a=0;if(1===(r=e.consumeArg().tokens).length&&"["===r[0].text){for(var s="",l=e.expandNextToken();"]"!==l.text&&"EOF"!==l.text;)s+=l.text,l=e.expandNextToken();if(!s.match(/^\s*[0-9]+\s*$/))throw new Rs("Invalid number of arguments: "+s);a=parseInt(s),r=e.consumeArg().tokens}return e.macros.set(o,{tokens:r,numArgs:a}),""};rh("\\newcommand",(e=>ed(e,!1,!0))),rh("\\renewcommand",(e=>ed(e,!0,!1))),rh("\\providecommand",(e=>ed(e,!0,!0))),rh("\\message",(e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map((e=>e.text)).join("")),""})),rh("\\errmessage",(e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map((e=>e.text)).join("")),""})),rh("\\show",(e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Yh[n],Ol.math[n],Ol.text[n]),""})),rh("\\bgroup","{"),rh("\\egroup","}"),
|
|
411
|
+
rh("~","\\nobreakspace"),rh("\\lq","`"),rh("\\rq","'"),rh("\\aa","\\r a"),rh("\\AA","\\r A"),rh("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),rh("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),rh("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),rh("ℬ","\\mathscr{B}"),rh("ℰ","\\mathscr{E}"),rh("ℱ","\\mathscr{F}"),rh("ℋ","\\mathscr{H}"),rh("ℐ","\\mathscr{I}"),rh("ℒ","\\mathscr{L}"),rh("ℳ","\\mathscr{M}"),rh("ℛ","\\mathscr{R}"),rh("ℭ","\\mathfrak{C}"),rh("ℌ","\\mathfrak{H}"),rh("ℨ","\\mathfrak{Z}"),rh("\\Bbbk","\\Bbb{k}"),rh("·","\\cdotp"),rh("\\llap","\\mathllap{\\textrm{#1}}"),rh("\\rlap","\\mathrlap{\\textrm{#1}}"),rh("\\clap","\\mathclap{\\textrm{#1}}"),rh("\\mathstrut","\\vphantom{(}"),rh("\\underbar","\\underline{\\text{#1}}"),rh("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),rh("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),rh("\\ne","\\neq"),rh("≠","\\neq"),
|
|
412
|
+
rh("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),rh("∉","\\notin"),rh("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),rh("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),rh("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),rh("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),rh("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),rh("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),rh("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),rh("⟂","\\perp"),rh("‼","\\mathclose{!\\mkern-0.8mu!}"),rh("∌","\\notni"),rh("⌜","\\ulcorner"),rh("⌝","\\urcorner"),rh("⌞","\\llcorner"),rh("⌟","\\lrcorner"),rh("©","\\copyright"),rh("®","\\textregistered"),rh("️","\\textregistered"),rh("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),
|
|
413
|
+
rh("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),rh("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),rh("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),rh("\\vdots","\\mathord{\\varvdots\\rule{0pt}{15pt}}"),rh("⋮","\\vdots"),rh("\\varGamma","\\mathit{\\Gamma}"),rh("\\varDelta","\\mathit{\\Delta}"),rh("\\varTheta","\\mathit{\\Theta}"),rh("\\varLambda","\\mathit{\\Lambda}"),rh("\\varXi","\\mathit{\\Xi}"),rh("\\varPi","\\mathit{\\Pi}"),rh("\\varSigma","\\mathit{\\Sigma}"),rh("\\varUpsilon","\\mathit{\\Upsilon}"),rh("\\varPhi","\\mathit{\\Phi}"),rh("\\varPsi","\\mathit{\\Psi}"),rh("\\varOmega","\\mathit{\\Omega}"),rh("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),rh("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),rh("\\boxed","\\fbox{$\\displaystyle{#1}$}"),rh("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),rh("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),
|
|
414
|
+
rh("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");var td={",":"\\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","\\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",
|
|
415
|
+
"\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};rh("\\dots",(function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in td?t=td[n]:("\\not"===n.substr(0,4)||n in Ol.math&&js.contains(["bin","rel"],Ol.math[n].group))&&(t="\\dotsb"),t}));var nd={")":!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};rh("\\dotso",(function(e){return e.future().text in nd?"\\ldots\\,":"\\ldots"})),rh("\\dotsc",(function(e){var t=e.future().text;return t in nd&&","!==t?"\\ldots\\,":"\\ldots"})),rh("\\cdots",(function(e){return e.future().text in nd?"\\@cdots\\,":"\\@cdots"})),rh("\\dotsb","\\cdots"),rh("\\dotsm","\\cdots"),rh("\\dotsi","\\!\\cdots"),rh("\\dotsx","\\ldots\\,"),rh("\\DOTSI","\\relax"),rh("\\DOTSB","\\relax"),rh("\\DOTSX","\\relax"),rh("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),rh("\\,","\\tmspace+{3mu}{.1667em}"),rh("\\thinspace","\\,"),
|
|
416
|
+
rh("\\>","\\mskip{4mu}"),rh("\\:","\\tmspace+{4mu}{.2222em}"),rh("\\medspace","\\:"),rh("\\;","\\tmspace+{5mu}{.2777em}"),rh("\\thickspace","\\;"),rh("\\!","\\tmspace-{3mu}{.1667em}"),rh("\\negthinspace","\\!"),rh("\\negmedspace","\\tmspace-{4mu}{.2222em}"),rh("\\negthickspace","\\tmspace-{5mu}{.277em}"),rh("\\enspace","\\kern.5em "),rh("\\enskip","\\hskip.5em\\relax"),rh("\\quad","\\hskip1em\\relax"),rh("\\qquad","\\hskip2em\\relax"),rh("\\tag","\\@ifstar\\tag@literal\\tag@paren"),rh("\\tag@paren","\\tag@literal{({#1})}"),rh("\\tag@literal",(e=>{if(e.macros.get("\\df@tag"))throw new Rs("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),rh("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),rh("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),rh("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),
|
|
417
|
+
rh("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),rh("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),rh("\\newline","\\\\\\relax"),rh("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var rd=vl(ol["Main-Regular"]["T".charCodeAt(0)][1]-.7*ol["Main-Regular"]["A".charCodeAt(0)][1]);rh("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+rd+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),rh("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+rd+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),rh("\\hspace","\\@ifstar\\@hspacer\\@hspace"),rh("\\@hspace","\\hskip #1\\relax"),rh("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),rh("\\ordinarycolon",":"),rh("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),rh("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),
|
|
418
|
+
rh("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),rh("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),rh("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),rh("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),rh("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),rh("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),rh("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),rh("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),
|
|
419
|
+
rh("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),rh("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),rh("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),rh("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),rh("∷","\\dblcolon"),rh("∹","\\eqcolon"),rh("≔","\\coloneqq"),rh("≕","\\eqqcolon"),rh("⩴","\\Coloneqq"),rh("\\ratio","\\vcentcolon"),rh("\\coloncolon","\\dblcolon"),rh("\\colonequals","\\coloneqq"),rh("\\coloncolonequals","\\Coloneqq"),rh("\\equalscolon","\\eqqcolon"),rh("\\equalscoloncolon","\\Eqqcolon"),rh("\\colonminus","\\coloneq"),rh("\\coloncolonminus","\\Coloneq"),rh("\\minuscolon","\\eqcolon"),rh("\\minuscoloncolon","\\Eqcolon"),rh("\\coloncolonapprox","\\Colonapprox"),rh("\\coloncolonsim","\\Colonsim"),
|
|
420
|
+
rh("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),rh("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),rh("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),rh("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),rh("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),rh("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),rh("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),rh("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),rh("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),rh("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),rh("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),rh("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),rh("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),rh("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),rh("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),rh("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),
|
|
421
|
+
rh("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),rh("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),rh("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),rh("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),rh("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),rh("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),rh("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),rh("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),rh("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),rh("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),rh("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),rh("\\imath","\\html@mathml{\\@imath}{ı}"),rh("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),rh("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),rh("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),rh("⟦","\\llbracket"),rh("⟧","\\rrbracket"),rh("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),
|
|
422
|
+
rh("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),rh("⦃","\\lBrace"),rh("⦄","\\rBrace"),rh("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),rh("⦵","\\minuso"),rh("\\darr","\\downarrow"),rh("\\dArr","\\Downarrow"),rh("\\Darr","\\Downarrow"),rh("\\lang","\\langle"),rh("\\rang","\\rangle"),rh("\\uarr","\\uparrow"),rh("\\uArr","\\Uparrow"),rh("\\Uarr","\\Uparrow"),rh("\\N","\\mathbb{N}"),rh("\\R","\\mathbb{R}"),rh("\\Z","\\mathbb{Z}"),rh("\\alef","\\aleph"),rh("\\alefsym","\\aleph"),rh("\\Alpha","\\mathrm{A}"),rh("\\Beta","\\mathrm{B}"),rh("\\bull","\\bullet"),rh("\\Chi","\\mathrm{X}"),rh("\\clubs","\\clubsuit"),rh("\\cnums","\\mathbb{C}"),rh("\\Complex","\\mathbb{C}"),rh("\\Dagger","\\ddagger"),rh("\\diamonds","\\diamondsuit"),rh("\\empty","\\emptyset"),rh("\\Epsilon","\\mathrm{E}"),rh("\\Eta","\\mathrm{H}"),rh("\\exist","\\exists"),rh("\\harr","\\leftrightarrow"),
|
|
423
|
+
rh("\\hArr","\\Leftrightarrow"),rh("\\Harr","\\Leftrightarrow"),rh("\\hearts","\\heartsuit"),rh("\\image","\\Im"),rh("\\infin","\\infty"),rh("\\Iota","\\mathrm{I}"),rh("\\isin","\\in"),rh("\\Kappa","\\mathrm{K}"),rh("\\larr","\\leftarrow"),rh("\\lArr","\\Leftarrow"),rh("\\Larr","\\Leftarrow"),rh("\\lrarr","\\leftrightarrow"),rh("\\lrArr","\\Leftrightarrow"),rh("\\Lrarr","\\Leftrightarrow"),rh("\\Mu","\\mathrm{M}"),rh("\\natnums","\\mathbb{N}"),rh("\\Nu","\\mathrm{N}"),rh("\\Omicron","\\mathrm{O}"),rh("\\plusmn","\\pm"),rh("\\rarr","\\rightarrow"),rh("\\rArr","\\Rightarrow"),rh("\\Rarr","\\Rightarrow"),rh("\\real","\\Re"),rh("\\reals","\\mathbb{R}"),rh("\\Reals","\\mathbb{R}"),rh("\\Rho","\\mathrm{P}"),rh("\\sdot","\\cdot"),rh("\\sect","\\S"),rh("\\spades","\\spadesuit"),rh("\\sub","\\subset"),rh("\\sube","\\subseteq"),rh("\\supe","\\supseteq"),rh("\\Tau","\\mathrm{T}"),rh("\\thetasym","\\vartheta"),rh("\\weierp","\\wp"),rh("\\Zeta","\\mathrm{Z}"),rh("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),
|
|
424
|
+
rh("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),rh("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),rh("\\bra","\\mathinner{\\langle{#1}|}"),rh("\\ket","\\mathinner{|{#1}\\rangle}"),rh("\\braket","\\mathinner{\\langle{#1}\\rangle}"),rh("\\Bra","\\left\\langle#1\\right|"),rh("\\Ket","\\left|#1\\right\\rangle"),rh("\\angln","{\\angl n}"),rh("\\blue","\\textcolor{##6495ed}{#1}"),rh("\\orange","\\textcolor{##ffa500}{#1}"),rh("\\pink","\\textcolor{##ff00af}{#1}"),rh("\\red","\\textcolor{##df0030}{#1}"),rh("\\green","\\textcolor{##28ae7b}{#1}"),rh("\\gray","\\textcolor{gray}{#1}"),rh("\\purple","\\textcolor{##9d38bd}{#1}"),rh("\\blueA","\\textcolor{##ccfaff}{#1}"),rh("\\blueB","\\textcolor{##80f6ff}{#1}"),rh("\\blueC","\\textcolor{##63d9ea}{#1}"),rh("\\blueD","\\textcolor{##11accd}{#1}"),rh("\\blueE","\\textcolor{##0c7f99}{#1}"),rh("\\tealA","\\textcolor{##94fff5}{#1}"),rh("\\tealB","\\textcolor{##26edd5}{#1}"),rh("\\tealC","\\textcolor{##01d1c1}{#1}"),rh("\\tealD","\\textcolor{##01a995}{#1}"),
|
|
425
|
+
rh("\\tealE","\\textcolor{##208170}{#1}"),rh("\\greenA","\\textcolor{##b6ffb0}{#1}"),rh("\\greenB","\\textcolor{##8af281}{#1}"),rh("\\greenC","\\textcolor{##74cf70}{#1}"),rh("\\greenD","\\textcolor{##1fab54}{#1}"),rh("\\greenE","\\textcolor{##0d923f}{#1}"),rh("\\goldA","\\textcolor{##ffd0a9}{#1}"),rh("\\goldB","\\textcolor{##ffbb71}{#1}"),rh("\\goldC","\\textcolor{##ff9c39}{#1}"),rh("\\goldD","\\textcolor{##e07d10}{#1}"),rh("\\goldE","\\textcolor{##a75a05}{#1}"),rh("\\redA","\\textcolor{##fca9a9}{#1}"),rh("\\redB","\\textcolor{##ff8482}{#1}"),rh("\\redC","\\textcolor{##f9685d}{#1}"),rh("\\redD","\\textcolor{##e84d39}{#1}"),rh("\\redE","\\textcolor{##bc2612}{#1}"),rh("\\maroonA","\\textcolor{##ffbde0}{#1}"),rh("\\maroonB","\\textcolor{##ff92c6}{#1}"),rh("\\maroonC","\\textcolor{##ed5fa6}{#1}"),rh("\\maroonD","\\textcolor{##ca337c}{#1}"),rh("\\maroonE","\\textcolor{##9e034e}{#1}"),rh("\\purpleA","\\textcolor{##ddd7ff}{#1}"),rh("\\purpleB","\\textcolor{##c6b9fc}{#1}"),rh("\\purpleC","\\textcolor{##aa87ff}{#1}"),
|
|
426
|
+
rh("\\purpleD","\\textcolor{##7854ab}{#1}"),rh("\\purpleE","\\textcolor{##543b78}{#1}"),rh("\\mintA","\\textcolor{##f5f9e8}{#1}"),rh("\\mintB","\\textcolor{##edf2df}{#1}"),rh("\\mintC","\\textcolor{##e0e5cc}{#1}"),rh("\\grayA","\\textcolor{##f6f7f7}{#1}"),rh("\\grayB","\\textcolor{##f0f1f2}{#1}"),rh("\\grayC","\\textcolor{##e3e5e6}{#1}"),rh("\\grayD","\\textcolor{##d6d8da}{#1}"),rh("\\grayE","\\textcolor{##babec2}{#1}"),rh("\\grayF","\\textcolor{##888d93}{#1}"),rh("\\grayG","\\textcolor{##626569}{#1}"),rh("\\grayH","\\textcolor{##3b3e40}{#1}"),rh("\\grayI","\\textcolor{##21242c}{#1}"),rh("\\kaBlue","\\textcolor{##314453}{#1}"),rh("\\kaGreen","\\textcolor{##71B307}{#1}");var od={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class id{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 Zh(Jh,t.macros),this.mode=n,this.stack=[]}feed(e){
|
|
427
|
+
this.lexer=new Xh(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 Is("EOF",n.loc)),this.pushTokens(r),t.range(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 Rs("Extra }",r)
|
|
428
|
+
}else if("EOF"===r.text)throw new Rs("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 Rs("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 Rs("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}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(null==r||e&&r.unexpandable){if(e&&null==r&&"\\"===n[0]&&!this.isDefined(n))throw new Rs("Undefined control sequence: "+n);return this.pushToken(t),t}if(this.expansionCount++,
|
|
429
|
+
this.expansionCount>this.settings.maxExpand)throw new Rs("Too many expansions: infinite loop or need to increase maxExpand setting");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 Rs("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 Rs("Not a valid argument number",s);o.splice(a,2,...i[+s.text-1])}}}return this.pushTokens(o),o}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;){var e=this.expandOnce();if(e instanceof Is)return e.treatAsRelax&&(e.text="\\relax"),this.stack.pop()}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Is(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;){var r=this.expandOnce(!0);r instanceof Is&&(r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),t.push(this.stack.pop()))}
|
|
430
|
+
return 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 Xh(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)||Ol.math.hasOwnProperty(e)||Ol.text.hasOwnProperty(e)||od.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 ad={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",
|
|
431
|
+
math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},sd={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ",
|
|
432
432
|
"ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ",
|
|
433
433
|
"Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ",
|
|
434
|
-
"έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class
|
|
435
|
-
this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new
|
|
436
|
-
["\\\\abovefrac"===t?this.callFunction(t,[o,e[n],i],[]):this.callFunction(t,[o,i],[])]}return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var r=this.parseGroup(e);if(!r)throw new
|
|
437
|
-
}else if("_"===o.text){if(n)throw new
|
|
438
|
-
breakOnTokenText:o},a=
|
|
439
|
-
if(n)throw new
|
|
440
|
-
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
|
|
441
|
-
;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:
|
|
442
|
-
t-=1)),"'"!==o&&"`"!==o||e[n+1].text!==o||(e.splice(n,2,{type:"textord",mode:"text",loc:
|
|
443
|
-
;var a,s=
|
|
444
|
-
if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new
|
|
445
|
-
;if("html"===n.output){var i=
|
|
434
|
+
"έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};class ld{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 id(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 Rs("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"),
|
|
435
|
+
this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Is("}")),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!==ld.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 Rs("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},
|
|
436
|
+
["\\\\abovefrac"===t?this.callFunction(t,[o,e[n],i],[]):this.callFunction(t,[o,i],[])]}return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var r=this.parseGroup(e);if(!r)throw new Rs("Expected group after '"+n+"'",t);return r}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("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 Rs("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 Rs("Double superscript",o);t=this.handleSupSubscript("superscript")
|
|
437
|
+
}else if("_"===o.text){if(n)throw new Rs("Double subscript",o);n=this.handleSupSubscript("subscript")}else{if("'"!==o.text)break;if(t)throw new Rs("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}}}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 Rs("Got function '"+r+"' with no arguments"+(t?" as "+t:""),n);if("text"===this.mode&&!o.allowedInText)throw new Rs("Can't use function '"+r+"' in text mode",n);if("math"===this.mode&&!1===o.allowedInMath)throw new Rs("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,
|
|
438
|
+
breakOnTokenText:o},a=Yh[e];if(a&&a.handler)return a.handler(i,t,n);throw new Rs("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 Rs("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":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":
|
|
439
|
+
if(n)throw new Rs("A primitive argument cannot be optional");var i=this.parseGroup(e);if(null==i)throw new Rs("Expected group as "+e,this.fetch());return i;case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new Rs("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();if(""===i)throw new Rs("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}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new Rs("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,
|
|
440
|
+
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 Rs("Invalid size: '"+t.text+"'",t);var o={number:+(r[1]+r[2]),unit:r[3]};if(!fl(o))throw new Rs("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);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()
|
|
441
|
+
;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:Os.range(r,s),body:a,semisimple:"\\begingroup"===o||void 0}}else if(null==(n=this.parseFunction(t,e)||this.parseSymbol())&&"\\"===o[0]&&!od.hasOwnProperty(o)){if(this.settings.throwOnError)throw new Rs("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:Os.range(r,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Os.range(r,e[n+1]),text:"--"}),
|
|
442
|
+
t-=1)),"'"!==o&&"`"!==o||e[n+1].text!==o||(e.splice(n,2,{type:"textord",mode:"text",loc:Os.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 Rs("\\verb assertion failed --\n please report what input caused this bug");return{type:"verb",mode:"text",body:n=n.slice(1,-1),star:r}}sd.hasOwnProperty(t[0])&&!Ol[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=sd[t[0]]+t.substr(1));var o,i=Kh.exec(t);if(i&&("i"===(t=t.substring(0,i.index))?t="ı":"j"===t&&(t="ȷ")),Ol[this.mode][t]){this.settings.strict&&"math"===this.mode&&"ÐÞþ".indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e)
|
|
443
|
+
;var a,s=Ol[this.mode][t].group,l=Os.range(e);if(Ml.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;this.settings.strict&&(tl(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:Os.range(e),text:t}}if(this.consume(),i)for(var u=0;u<i[0].length;u++){var h=i[0][u];if(!ad[h])throw new Rs("Unknown accent ' "+h+"'",e);var d=ad[h][this.mode]||ad[h].text;if(!d)throw new Rs("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Os.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}}ld.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var cd=function(e,t){
|
|
444
|
+
if(!("string"==typeof e||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new ld(e,t);delete n.gullet.macros.current["\\df@tag"];var r=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new Rs("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:n.subparse([new Is("\\df@tag")])}]}return 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."));var ud=function(e,t,n){if(n.throwOnError||!(e instanceof Rs))throw e;var r=bc.makeSpan(["katex-error"],[new Al(t)]);return r.setAttribute("title",e.toString()),r.setAttribute("style","color:"+n.errorColor),r},hd=function(e,t){var n=new Us(t);try{return function(e,t,n){var r,o=ou(n);if("mathml"===n.output)return ru(e,t,o,n.displayMode,!0)
|
|
445
|
+
;if("html"===n.output){var i=Vc(e,o);r=bc.makeSpan(["katex"],[i])}else{var a=ru(e,t,o,n.displayMode,!1),s=Vc(e,o);r=bc.makeSpan(["katex"],[a,s])}return iu(r,n)}(cd(e,n),e,n)}catch(t){return ud(t,e,n)}},dd=function(e,t){return hd(e,t).toMarkup()},pd={exports:{}};!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,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,
|
|
446
446
|
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:{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",
|
|
447
447
|
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"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,
|
|
448
448
|
description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"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,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,
|
|
@@ -513,144 +513,144 @@ e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r})
|
|
|
513
513
|
r||(o=n.subParser("makeMarkdown.header")(e,t,2)+"\n\n");break;case"h3":r||(o=n.subParser("makeMarkdown.header")(e,t,3)+"\n\n");break;case"h4":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":
|
|
514
514
|
o=n.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":o=n.subParser("makeMarkdown.strong")(e,t);break;case"del":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+="**"
|
|
515
515
|
;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){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 h=a.push([])-1,d=l[r].getElementsByTagName("td");for(o=0;o<s.length;++o){var p=" ";void 0!==d[o]&&(p=n.subParser("makeMarkdown.tableCell")(d[o],t)),a[h].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){
|
|
516
|
-
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="";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(X)}(
|
|
517
|
-
type:"output",filter:function(e){return e.replace(/<a href=/g,'<a target="_blank" href=')}}]}let
|
|
518
|
-
const r=no((()=>e?
|
|
519
|
-
;var
|
|
520
|
-
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)),{text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function
|
|
521
|
-
o===t&&i===n?(a=
|
|
522
|
-
;const u={buttonRef:e,disabled:t,icon:n,onClick:o,tabIndex:a,title:c};return r?po(bo,{classes:"font-normal TransparentButton",...u,children:r}):po(_o,{classes:"MarkdownEditor__toolbar-button",...u})}function
|
|
523
|
-
iconName:"format-italic",onClick:()=>t("italic"),shortcutKey:
|
|
524
|
-
className:"hyp-u-layout-row--center",children:po(zo,{href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",classes:"text-tiny IconOnlyLink",linkRef:g[h],tabIndex:v(h),title:"Formatting help","aria-label":"Formatting help",children:po(Mo,{name:"help"})})}),po(
|
|
525
|
-
n((e=>
|
|
526
|
-
const a=n?{id:`${n}${r}`}:{};return po("li",{role:"option","aria-selected":(e===r).toString(),className:qr({"is-selected":e===r},"AutocompleteList__li"),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 po("div",{className:qr({"is-hidden":c},"AutocompleteList"),children:po("ul",{className:"AutocompleteList__items",tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s})})}let
|
|
516
|
+
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="";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(X)}(pd);var md=pd.exports;const fd=Ls(window);function gd(){return[{
|
|
517
|
+
type:"output",filter:function(e){return e.replace(/<a href=/g,'<a target="_blank" href=')}}]}let vd;function yd(e){return"{math:"+e.toString()+"}"}function _d(e){const t=function(e){const t=[];let n=0,r=e;for(;;){const e=r.indexOf("$$",n),o=r.indexOf("\\(",n);if(-1===e&&-1===o)break;let i,a;if(-1!==e&&(-1===o||e<o)?(i=e,a=r.indexOf("$$",i+2)):(i=o,a=r.indexOf("\\)",i+2)),-1===a)break;a+=2;const s=t.length+1,l=yd(s);let c;t.push({id:s,expression:r.slice(i+2,a-2),inline:-1!==o}),c=-1!==o?l:"\n\n"+l+"\n\n",r=r.slice(0,i)+c+r.slice(a),n=i+c.length}return{mathBlocks:t,content:r}}(e),n=fd.sanitize(function(e){return vd||(vd=new md.Converter({extensions:[gd],simplifiedAutoLink:!0,literalMidWordUnderscores:!0,strikethrough:!0})),vd.makeHtml(e)}(t.content)),r=function(e,t){return t.reduce(((e,t)=>{let n;try{n=t.inline?dd(t.expression):dd(t.expression,{displayMode:!0})}catch(e){n=zs(t.expression)}return e.replace(yd(t.id),n)}),e)}(n,t.mathBlocks);return r}function bd({markdown:e="",textClass:t={},textStyle:n={}}){
|
|
518
|
+
const r=no((()=>e?_d(e):""),[e]),o=to();Qr((()=>{!function(e,{className:t}={}){const n=Array.from(e.getElementsByTagName("a"));for(let e of n){const n=Ra(e);n&&(t?n.className=t:n.style.width="350px")}}(o.current,{className:"MarkdownView__embed"})}),[e]);return po("div",{className:qr("MarkdownView",t),dir:"auto",lang:"",ref:o,dangerouslySetInnerHTML:{__html:r},style:n})}function wd({annotation:e,tags:t}){const n=ii(),r=n.defaultAuthority(),o=no((()=>!Qo(e.user,r)),[e,r]),i=e=>n.getLink("search.tag",{tag:e});return po("ul",{className:"TagList","aria-label":"Annotation tags",children:t.map((e=>po("li",{className:"TagList__item",children:[o&&po("a",{className:"TagList__link",href:i(e),lang:"",target:"_blank",rel:"noopener noreferrer","aria-label":`Tag: ${e}`,title:`View annotations with tag: ${e}`,children:e}),!o&&po("span",{className:"TagList__text","aria-label":`Tag: ${e}`,lang:"",children:e})]},e)))})}fd.addHook("afterSanitizeAttributes",(e=>{"target"in e&&e.setAttribute("target","_blank")}))
|
|
519
|
+
;var xd=ri((function({annotation:e,settings:t}){var n,r;const[o,i]=Zr(!0),[a,s]=Zr(!1),l=ii().getDraft(e),c=o?"More":"Less",u=null!==(n=null==l?void 0:l.tags)&&void 0!==n?n:e.tags,h=null!==(r=null==l?void 0:l.text)&&void 0!==r?r:e.text,d=h.length>0,p=u.length>0,m=ti(["annotationFontFamily"],t);return po("div",{className:"hyp-u-vertical-spacing--2",children:[d&&po(Na,{collapse:o,collapsedHeight:400,inlineControls:!1,onCollapsibleChanged:s,onToggleCollapsed:i,overflowThreshold:20,children:po(bd,{textStyle:m,markdown:h,textClass:{AnnotationBody__text:!0,"p-redacted-content":Ni(e)}})}),a&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{expanded:!o,onClick:()=>i(!o),title:`Toggle visibility of full annotation text: Show ${c}`,children:c})}),p&&po(wd,{annotation:e,tags:u})]})}),["settings"]);const kd=0,Sd=1;function Cd(e,t,n,r){let o=e.selectionStart,i=e.selectionEnd;return o>=t+n?(o+=r.length-n,
|
|
520
|
+
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)),{text:e.text.slice(0,t)+r+e.text.slice(t+n),selectionStart:o,selectionEnd:i}}function Ad(e,t=kd){const n=e.text.slice(e.selectionStart,e.selectionEnd);let r,o="";if(t===Sd&&(o="!"),n.match(/[a-z]+:\/\/.*/)){const t="Description";return r=Cd(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://insert-your-link-here.com";return r=Cd(e,e.selectionStart,n.length,t+i+")"),r.selectionStart=e.selectionStart+t.length,r.selectionEnd=r.selectionStart+i.length,r}}function Ed(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=Cd(e,e.selectionStart,0,r),a.selectionStart=a.selectionEnd-r.length),
|
|
521
|
+
o===t&&i===n?(a=Cd(a,a.selectionStart-t.length,t.length,""),a=Cd(a,a.selectionEnd,n.length,"")):(a=Cd(a,a.selectionStart,0,t),a=Cd(a,a.selectionEnd,0,n)),a}function Td(e,t){const n=e.indexOf("\n",t);return n<0?e.length:n}function Nd(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=Td(e.text,t);for(;i<=Td(e.text,n);){const t=i===e.text.length,a=i-o,s=Td((e=r(e,o,i)).text,o)-o;if(n+=s-a,t)break;o=o+s+1,i=Td(e.text,o)}return e}function Ld(e,t){const n=e.selectionStart,r=e.selectionEnd;let o=!0;return Nd(e,n,r,((e,n)=>(e.text.slice(n,n+t.length)!==t&&(o=!1),e))),Nd(e,n,r,o?(e,n)=>Cd(e,n,t.length,""):(e,n)=>e.text.slice(n,n+t.length)===t?e:Cd(e,n,0,t))}const Md={bold:"b",italic:"i",link:"l",quote:"q",image:"g",numlist:"o",list:"u"};function zd({buttonRef:e,disabled:t=!1,iconName:n="",label:r,onClick:o,shortcutKey:i,tabIndex:a,title:s=""}){const l=no((()=>((e=window.navigator.userAgent)=>e.indexOf("Mac OS")>=0)()?"Cmd":"Ctrl"),[]);let c=s;i&&(c+=` (${l}-${i.toUpperCase()})`)
|
|
522
|
+
;const u={buttonRef:e,disabled:t,icon:n,onClick:o,tabIndex:a,title:c};return r?po(bo,{classes:"font-normal TransparentButton",...u,children:r}):po(_o,{classes:"MarkdownEditor__toolbar-button",...u})}function Od({isPreviewing:e,onCommand:t,onTogglePreview:n}){const r=0,o=1,i=2,a=3,s=4,l=5,c=6,u=7,h=8,d=9,p=10,[m,f]=Zr(0),g=to([]).current;if(0===g.length)for(let e=0;e<=p;e++)g.push({current:null});const v=e=>m===e?0:-1;return po("div",{className:"hyp-u-layout-row hyp-u-border--left hyp-u-border--right hyp-u-border--top hyp-u-bg-color--white MarkdownEditor__toolbar",role:"toolbar","aria-label":"Markdown editor toolbar",onKeyDown:t=>{let n=0;const r=p-1;e&&(n=h);let o=null;switch(Oo(t.key)){case"ArrowLeft":o=m<=n?r:m-1;break;case"ArrowRight":o=m>=r?n:m+1;break;case"Home":o=n;break;case"End":o=r}var i;null!==o&&(f(i=o),g[i].current.focus(),t.preventDefault())},children:[po(zd,{disabled:e,iconName:"format-bold",onClick:()=>t("bold"),shortcutKey:Md.bold,buttonRef:g[r],tabIndex:v(r),title:"Bold"}),po(zd,{disabled:e,
|
|
523
|
+
iconName:"format-italic",onClick:()=>t("italic"),shortcutKey:Md.italic,buttonRef:g[o],tabIndex:v(o),title:"Italic"}),po(zd,{disabled:e,iconName:"format-quote",onClick:()=>t("quote"),shortcutKey:Md.quote,buttonRef:g[i],tabIndex:v(i),title:"Quote"}),po(zd,{disabled:e,iconName:"link",onClick:()=>t("link"),shortcutKey:Md.link,buttonRef:g[a],tabIndex:v(a),title:"Insert link"}),po(zd,{disabled:e,iconName:"image",onClick:()=>t("image"),shortcutKey:Md.image,buttonRef:g[s],tabIndex:v(s),title:"Insert image"}),po(zd,{disabled:e,iconName:"format-functions",onClick:()=>t("math"),buttonRef:g[l],tabIndex:v(l),title:"Insert math (LaTeX is supported)"}),po(zd,{disabled:e,iconName:"format-list-numbered",onClick:()=>t("numlist"),shortcutKey:Md.numlist,buttonRef:g[c],tabIndex:v(c),title:"Numbered list"}),po(zd,{disabled:e,iconName:"format-list-unordered",onClick:()=>t("list"),shortcutKey:Md.list,buttonRef:g[u],tabIndex:v(u),title:"Bulleted list"}),po("span",{className:"hyp-u-stretch"}),po("div",{
|
|
524
|
+
className:"hyp-u-layout-row--center",children:po(zo,{href:"https://web.hypothes.is/help/formatting-annotations-with-markdown/",target:"_blank",classes:"text-tiny IconOnlyLink",linkRef:g[h],tabIndex:v(h),title:"Formatting help","aria-label":"Formatting help",children:po(Mo,{name:"help"})})}),po(zd,{label:e?"Write":"Preview",onClick:n,buttonRef:g[d],tabIndex:v(d)})]})}function Id({label:e="",onEditText:t=(()=>{}),text:n="",textStyle:r={}}){const[o,i]=Zr(!1),a=to(null);Qr((()=>{var e;o||(null===(e=a.current)||void 0===e||e.focus())}),[o]);const s=e=>{a.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);return 0===t.length||"\n"===t.slice(-1)||"$$"===t.slice(-2)?Ed(e,"$$","$$","Insert LaTeX"):Ed(e,"\\(","\\)","Insert LaTeX")};switch(e){case"bold":n((e=>Ed(e,"**","**","Bold")));break;case"italic":
|
|
525
|
+
n((e=>Ed(e,"*","*","Italic")));break;case"quote":n((e=>Ld(e,"> ")));break;case"link":n((e=>Ad(e)));break;case"image":n((e=>Ad(e,Sd)));break;case"math":n(r);break;case"numlist":n((e=>Ld(e,"1. ")));break;case"list":n((e=>Ld(e,"* ")));break;default:throw new Error(`Unknown toolbar command "${e}"`)}}(e,a.current),t({text:a.current.value}))};return po("div",{className:"leading-none",children:[po(Od,{onCommand:s,isPreviewing:o,onTogglePreview:()=>i(!o)}),o?po(bd,{markdown:n,textClass:{"hyp-u-border":!0,"hyp-u-bg-color--grey-1":!0,"hyp-u-padding":!0},textStyle:r}):po("textarea",{"aria-label":e,className:"MarkdownEditor__input",dir:"auto",ref:a,onClick:e=>e.stopPropagation(),onKeyDown:e=>{if(e.ctrlKey||e.metaKey)for(let[t,n]of Object.entries(Md))n===Oo(e.key)&&(e.stopPropagation(),e.preventDefault(),s(t))},onInput:e=>{t({text:e.target.value})},value:n,style:r})]})}const Rd=e=>e;function Pd({activeItem:e=-1,id:t,itemPrefixId:n,list:r,listFormatter:o=Rd,onSelectItem:i,open:a=!1}){const s=no((()=>r.map(((t,r)=>{
|
|
526
|
+
const a=n?{id:`${n}${r}`}:{};return po("li",{role:"option","aria-selected":(e===r).toString(),className:qr({"is-selected":e===r},"AutocompleteList__li"),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 po("div",{className:qr({"is-hidden":c},"AutocompleteList"),children:po("ul",{className:"AutocompleteList__items",tabIndex:-1,"aria-label":"Suggestions",role:"listbox",...l,children:s})})}let Dd=0;var Bd=ri((function({onAddTag:e,onRemoveTag:t,onTagInput:n,tagList:r,tags:o}){const i=to(),[a,s]=Zr([]),[l,c]=Zr(-1),[u,h]=Zr(!1),[d]=Zr((()=>(++Dd,`TagEditor-${Dd}`))),p=to();Ro(p,u,(()=>{h(!1)}));const m=()=>i.current.value.trim(),f=()=>m()&&m().length>0,g=()=>{i.current.value="",null==n||n("")},v=t=>{e(t)&&(h(!1),c(-1),g(),i.current.focus())},y=e=>{let t=l+e;t<-1?t=a.length-1:t>=a.length&&(t=-1),c(t)},_=l>=0?`${d}-AutocompleteList-item-${l}`:"";return po("div",{className:"TagEditor",children:[po("ul",{className:"TagEditor__tags",
|
|
527
527
|
"aria-label":"Suggested tags for annotation",children:r.map((e=>po("li",{className:"TagEditor__item","aria-label":`Tag: ${e}`,children:[po("span",{lang:"",className:"TagEditor__edit",children:e}),po("button",{onClick:()=>{t(e)},"aria-label":`Remove Tag: ${e}`,title:`Remove Tag: ${e}`,className:"TagEditor__delete",children:po(Mo,{name:"cancel"})})]},`${e}`)))}),po("span",{id:d,className:"TagEditor__combobox-wrapper",ref:p,role:"combobox","aria-expanded":u.toString(),"aria-owns":`${d}-AutocompleteList`,"aria-haspopup":"listbox",children:[po("input",{onInput:()=>{null==n||n(m()),(()=>{if(f()){const e=o.filter(m());s(((e,t)=>{const n=[];return e.forEach((e=>{t.indexOf(e)<0&&n.push(e)})),n.sort()})(e,r)),h(e.length>0)}else h(!1);c(-1)})()},onKeyDown:e=>{switch(Oo(e.key)){case"ArrowUp":y(-1),e.preventDefault();break;case"ArrowDown":y(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
|
|
528
|
-
;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&h(!0)},ref:i,placeholder:"Add new tags",className:"TagEditor__input",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":_,"aria-controls":`${d}-AutocompleteList`,dir:"auto"}),po(
|
|
529
|
-
title:"View more information about the Creative Commons Public Domain dedication",children:[po(Mo,{name:"cc-std",classes:"text-tiny"}),po(Mo,{name:"cc-zero",classes:"hyp-u-margin--left--1 text-tiny"}),po("div",{className:"hyp-u-margin--left--2",children:"Annotations can be freely reused by anyone for any purpose."})]})})}function
|
|
530
|
-
i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}function
|
|
531
|
-
"aria-label":u,title:u,children:po("span",{className:"Menu__toggle-wrapper",children:[a,c&&po("span",{className:qr("Menu__toggle-arrow",h&&"is-open"),children:po(fo,{name:"expand-menu",className:"Menu__toggle-icon"})})]})}),h&&po(m,{children:[po(
|
|
532
|
-
function
|
|
533
|
-
"is-disabled":r,"is-expanded":o,"is-selected":i}),tabIndex:-1,onKeyDown:S,onClick:c,role:k?"menuitemradio":"menuitem","aria-checked":k?i:void 0,"aria-haspopup":x,"aria-expanded":x?s:void 0,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b}),x&&po("div",{role:"none",icon:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle",onClick:u,title:`Show actions for ${l}`,children:po(fo,{name:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle-icon"})})]}),po(m,{children:[w,x&&po(
|
|
534
|
-
isPrivate:"private"===t}),ki(e)||o.setDefault("annotationPrivacy",t)},u=ti(["ctaTextColor","ctaBackgroundColor"],r),h=po("div",{className:"annotation-publish-button__menu-label",style:u,children:po(Mo,{name:"expand-menu"})});return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--4",children:[po("div",{className:"annotation-publish-button",children:[po(bo,{classes:"PublishControlButton","data-testid":"publish-control-button",style:u,onClick:n,disabled:t,size:"large",variant:"primary",children:["Post to ",l]}),po("div",{className:"annotation-publish-button__menu-wrapper",style:u,children:po(
|
|
535
|
-
}),po("div",{children:po(bo,{icon:"cancel",onClick:()=>{o.removeDraft(e),
|
|
536
|
-
onRemoveTag:e=>{const t=[...h],n=t.indexOf(e);return n>=0&&(t.splice(n,1),m({tags:t}),!0)},onTagInput:a,tagList:h}),po("div",{className:"hyp-u-layout-row annotation__form-actions",children:po(
|
|
537
|
-
classes:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--muted p-link--hover-muted",href:t.links.html,target:"_blank",children:["open"===t.type?po(Mo,{classes:"text-tiny",name:"public"}):po(Mo,{classes:"text-tiny",name:"groups"}),po("span",{children:t.name})]}),r&&!n&&po("span",{className:"hyp-u-layout-row--align-baseline text-color-text-light",children:po("span",{"data-testid":"private-info",children:"Only me"})})]})}let
|
|
538
|
-
;return`${n} hr${n>1?"s":""} ago`},nextUpdate:36e5},{test:(e,t)=>e.getFullYear()===t.getFullYear(),formatter:function(e,t,n){return
|
|
539
|
-
const[o,i]=Zr((()=>new Date)),a=no((()=>new Date(e)),[e]),s=no((()=>r&&new Date(t)),[t,r]),l=no((()=>({absolute:
|
|
540
|
-
;const a=ii(),s=a.defaultAuthority(),l=a.isFeatureEnabled("client_display_names"),c=Qo(e.user,s),u=
|
|
541
|
-
onClick:()=>a.setExpanded(e.id,!0),title:"Expand replies",children:v}),f&&po("div",{className:"hyp-u-layout-row--justify-right hyp-u-stretch",children:po(
|
|
542
|
-
;function
|
|
543
|
-
className:"hyp-u-layout-row--justify-right hyp-u-stretch","data-testid":"saving-message",children:"Saving..."}),e&&f&&po(So,{classes:"hyp-u-stretch",children:po(
|
|
544
|
-
}).then((()=>{r.unhideAnnotation(o)})).catch((()=>{n.error("Failed to unhide annotation")}))}:()=>{const o=e.id;t.annotation.hide({id:o}).then((()=>{r.hideAnnotation(o)})).catch((()=>{n.error("Failed to hide annotation")}))},title:e.hidden?"Make this annotation visible to everyone":"Hide this annotationn from non-moderators",variant:"dark",children:e.hidden?"Unhide":"Hide"})})]}):null}),["api","toastMessenger"]);function
|
|
545
|
-
annotation:t.annotation}),po(
|
|
546
|
-
threadsService:n})},t.id)))})]})]})}),["threadsService"]);var
|
|
547
|
-
;const[i,a]=Zr({}),[s,l]=Zr(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:h,visibleThreads:d}=no((()=>function(e,t,n,r,o=
|
|
548
|
-
}),d.map((e=>po("div",{className:"ThreadList__card",id:e.id,children:po(
|
|
549
|
-
children:"Log in"})]})]})})}var
|
|
550
|
-
children:[a>0?a:"No"," ",1===a?n:r]}),o&&po("span",{children:[" ","for"," ",po("span",{className:"filter-facet--pre",children:`'${o}'`})]}),i&&po("span",{children:[" ","by ",po("span",{className:"filter-facet",children:i})]}),t>0&&po("span",{className:"filter-facet--muted",children:[" ","(and ",t," more)"]})]}),po("div",{children:e})]})})}function
|
|
551
|
-
entitySingular:"result",entityPlural:"results",filterQuery:e.filterQuery,focusDisplayName:e.focusDisplayName,resultCount:r})}function
|
|
552
|
-
}):a.focusConfigured?po(
|
|
553
|
-
var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),h=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=h,g=d;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,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),y=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=y+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}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return
|
|
554
|
-
e._scrollSettings=null,t.end("complete");var a=1-t.ease(i);if(
|
|
555
|
-
;var r=
|
|
556
|
-
t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&
|
|
557
|
-
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:qr("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var
|
|
558
|
-
children:"Page Notes"}),s>0&&po(
|
|
559
|
-
const i=
|
|
560
|
-
errorType:"group",onLoginRequest:t}),x&&po(
|
|
561
|
-
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function
|
|
562
|
-
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po(
|
|
563
|
-
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{
|
|
564
|
-
classes:"leading-none text-brand",onClick:t,children:[e,po(Mo,{classes:"ml-1",name:"arrow-right"})]})}function
|
|
565
|
-
className:"grow text-lg font-medium","data-testid":"subpanel-title",children:{tutorial:"Getting started",versionInfo:"About this version"}[a]}),"versionInfo"===a&&po(
|
|
566
|
-
off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,a=r.length;i<a;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},
|
|
567
|
-
this._maxResults&&t.total>this._maxResults)return this.emit("error",new
|
|
568
|
-
const e=ii(),t=e.getFilter("user"),n=function(){const e=ii(),t=e.allAnnotations(),n=e.defaultAuthority(),r=e.isFeatureEnabled("client_display_names"),o=e.getFocusFilters(),i=Jo(e.profile().userid);return no((()=>{const e={};if(t.forEach((t=>{const o=Jo(t.user);e[o]=
|
|
569
|
-
children:"No results"}),a&&t&&po("strong",{children:[l," ",1===l?"result":"results"]}),a&&!t&&po("strong",{children:[c," ",1===c?"thread":"threads"]})]}),s&&po("h3",{children:["(and ",e," more)"]}),!t&&a&&po("h3",{children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function
|
|
570
|
-
children:null===t?po("div",{className:"PaginationNavigation__gap",children:"..."}):po(bo,{classes:"PaginationPageButton",title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),variant:"dark",children:t.toString()},`page-${n}`)},n)))}),po("div",{className:"PaginationNavigation__relative PaginationNavigation__next",children:r&&po(bo,{classes:"PaginationPageButton",icon:"arrow-right",iconPosition:"right",title:"Go to next page",onClick:t=>a(e+1,t.target),variant:"dark",children:"next"})})]})}function
|
|
571
|
-
;const r=ii(),o=r.getFilterValues(),i=r.focusedGroup(),a=r.forcedVisibleThreads().length,s=r.hasAppliedFilter(),l=r.isLoading(),c=r.annotationResultCount(),u=r.pendingUpdateCount(),h=
|
|
572
|
-
className:"NotebookView__results hyp-u-layout-row--align-center text-lg font-medium",children:[u>0&&!s&&po(_o,{icon:"refresh",onClick:()=>t.applyPendingUpdates(),variant:"primary",title:k}),po(
|
|
573
|
-
;var
|
|
574
|
-
title:"Copy share link",variant:"dark"})]})}),po("p",{"data-testid":"sharing-details",children:["private"===r.type?po("span",{children:["Annotations in the private group"," ",po("em",{children:r.name})," are only visible to group members."]}):po("span",{children:["Anyone using this link may view the annotations in the group"," ",po("em",{children:r.name}),"."]})," ",po("span",{children:["Private (",po(Mo,{name:"lock",classes:"inline -mt-0.5"})," ",po("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),po(
|
|
575
|
-
children:[po("div",{className:"toast-message__type",children:po(Mo,{name:r,classes:"toast-message__icon"})}),po("div",{className:"toast-message__message",children:[po("strong",{children:[n,": "]}),e.message,e.moreInfoURL&&po("div",{className:"toast-message__link",children:po("a",{href:e.moreInfoURL,onClick:e=>e.stopPropagation(),target:"_new",children:"More info"})})]})]})})}var
|
|
576
|
-
;!r.length&&e.organization.logo&&(n.logo=e.organization.logo),r.push(n)}(e,t[n])})),t}function
|
|
577
|
-
onToggleSubmenu:h,submenu:po(m,{children:[po("ul",{children:[i&&po("li",{children:po(
|
|
578
|
-
const t=ii(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=no((()=>
|
|
579
|
-
}),h&&po(
|
|
580
|
-
classes:"TopBar__menu-icon"})});return po("div",{className:"SortMenu",children:po(
|
|
581
|
-
onOpenChanged:u,children:[po(
|
|
582
|
-
children:"/"}),po(wo,{classes:"InlineLinkButton",onClick:r,style:c,variant:"primary",children:"Log in"})]}),"logged-in"===e.status&&po(
|
|
583
|
-
;var
|
|
584
|
-
className:qr("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"HypothesisApp--notebook":"notebook"===l}),style:u,children:["notebook"!==l&&po(
|
|
585
|
-
;function
|
|
586
|
-
|
|
587
|
-
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}
|
|
588
|
-
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.
|
|
589
|
-
list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}
|
|
590
|
-
;if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},
|
|
591
|
-
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},
|
|
592
|
-
;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){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}}}(
|
|
593
|
-
return this._routeCache||(this._routeCache=
|
|
594
|
-
"object"==typeof i.data&&i.data.state===n&&("authorization_response"===i.data.type&&t(i.data),"authorization_canceled"===i.data.type&&r(new Error("Authorization window was closed")),e.removeEventListener("message",o))}))})),o=new URL(this.authorizationEndpoint);return 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),t.location=o.toString(),r.then((e=>e.code))}async _formPost(e,t){const n=new URLSearchParams;for(let[e,r]of Object.entries(t))n.set(e,r);n.sort();return
|
|
595
|
-
const t=`left=${e.screen.width/2-237.5},top=${e.screen.height/2-215},width=475,height=430`,n=e.open("about:blank","Log in to Hypothesis",t);if(!n)throw new Error("Failed to open login window");return n}}class
|
|
596
|
-
;return d(n),n})(i),i=null):a=Promise.resolve(function(){const e=n.getObject(h());return e&&"string"==typeof e.accessToken&&"string"==typeof e.refreshToken&&"number"==typeof e.expiresAt?{accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt}:null}())}const e=a,t=await a;if(!t)return null;if(e!==a)return f();if(Date.now()>t.expiresAt){const e=m();return a=(async(e,t)=>{const n=await p();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}return t.persist&&d(r),r})(t.refreshToken,{persist:void 0===e}),f()}return t.accessToken};(()=>{e.addEventListener("storage",(({key:e})=>{e===h()&&(a=null,this.emit("oauthTokensChanged"))}))})(),this.login=async function(){const t=
|
|
597
|
-
|
|
598
|
-
const r=Array.isArray(t),o=()=>r?t.map((e=>e())):t();let i=o();return e((()=>{const e=o();if(r?
|
|
599
|
-
!t)throw new Error("Invalid request of channel/port");const n=U(6);return new Promise(((t,r)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:e,type:"request",requestId:n},"*")},i=setInterval(o,250),a=setTimeout((()=>{clearInterval(i),r(new Error(`Unable to establish ${this._source}-${e} communication channel`))}),2e4),s=this._listeners.add(window,"message",(r=>{const{data:o,ports:l}=r;
|
|
600
|
-
;return
|
|
601
|
-
uri:n}}function
|
|
602
|
-
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))}))}_connectGuest(e){const t=new
|
|
603
|
-
this._annotationsService.create(e)}));let r={};const o=
|
|
604
|
-
|
|
605
|
-
;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e: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=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0
|
|
606
|
-
_fetchGroup(e){return this._api.group.read({id:e,expand:
|
|
607
|
-
;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:
|
|
608
|
-
return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(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"})}}
|
|
609
|
-
});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};this._searchClient=new
|
|
610
|
-
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),!ki(t)){const e=t.id;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}}
|
|
611
|
-
removeItem(e){this._storage.removeItem(e)}}
|
|
612
|
-
{const e=t.id;delete r.id,n=`/a/${e}`}break;case"notebook":n="/notebook";break;case"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[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()}}
|
|
613
|
-
this._authority=null!==(i=null===(a=P(r))||void 0===a?void 0:a.authority)&&void 0!==i?i:null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=
|
|
614
|
-
return this._lastLoad=null,this._lastLoadTime=null,this.load()}}
|
|
615
|
-
n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class
|
|
616
|
-
case"create":case"update":case"past":this._store.receiveRealTimeUpdates({updatedAnnotations:e});break;case"delete":this._store.receiveRealTimeUpdates({deletedAnnotations:e})}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 K("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{
|
|
617
|
-
throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(n){const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new
|
|
618
|
-
this._socket||await this._reconnect()}}
|
|
619
|
-
dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r=""}={}){if(this._store.hasToastMessage(e,t))return;const o=U(10),i={type:e,id:o,message:t,moreInfoURL:r};this._store.addToastMessage({isDismissed:!1,...i}),n&&setTimeout((()=>{this.dismiss(o)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}function
|
|
620
|
-
;t%2?
|
|
621
|
-
;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(
|
|
622
|
-
if("object"!=typeof e||null===e)throw new Error(
|
|
623
|
-
;return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function
|
|
624
|
-
return e(o)}));return r=
|
|
625
|
-
console.log("Prev State:",e.getState()),console.log("Action:",r),n(r),console.log("Next State:",e.getState()),console.groupEnd()}}}const
|
|
626
|
-
;return{...e,hasFetchedAnnotations:!0,activeAnnotationFetches:e.activeAnnotationFetches-1}},SET_ANNOTATION_RESULT_COUNT:(e,t)=>({annotationResultCount:t.resultCount})},
|
|
627
|
-
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
|
|
628
|
-
get:r,put:function(t,o){"NOT_FOUND"===r(t)&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(l,u);function d(){var t=h.get(arguments);if("NOT_FOUND"===t){if(t=e.apply(null,arguments),c){var n=h.getEntries(),r=n.find((function(e){return c(e.value,t)}));r&&(t=r.value)}h.put(arguments,t)}return t}return d.clearCache=function(){return h.clear()},d}function
|
|
629
|
-
"function"!=typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s,u=c.memoizeOptions,h=void 0===u?n:u,d=Array.isArray(h)?h:[h],p=
|
|
630
|
-
selectors:{route:function(e){return e.name},routeParams:function(e){return e.params}}});function
|
|
631
|
-
highlighted:t.
|
|
632
|
-
e.filter((e=>!(e.id&&e.id in n||e.$tag&&e.$tag in r)))}(n().annotations.annotations,e);t({type:
|
|
633
|
-
},highlightAnnotations:function(e){return{type:
|
|
634
|
-
newHighlights:
|
|
635
|
-
directLinkedAnnotationId:null,directLinkedGroupId:null,directLinkedGroupFetchFailed:!1}}},
|
|
636
|
-
},directLinkedGroupId:function(e){return e.directLinkedGroupId}}});class
|
|
637
|
-
draft:new
|
|
638
|
-
SET_FOCUS_MODE:function(e,t){var n;return{focusActive:null!==(n=t.active)&&void 0!==n?n:!e.focusActive}},CLEAR_SELECTION:function(){return{filters:{},focusActive:!1,query:null}}},
|
|
639
|
-
setFilterQuery:function(e){return{type:
|
|
640
|
-
}(t))),[])),(e=>e)),
|
|
641
|
-
profile:function(e){return e.profile}}}),
|
|
642
|
-
return e.groups.find((e=>e.id===t))}const
|
|
643
|
-
|
|
644
|
-
FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})},
|
|
645
|
-
pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:
|
|
646
|
-
return{forcedVisible:{},selected:{}}},SET_FILTER:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FILTER_QUERY:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FOCUS_MODE:function(){return{forcedVisible:{},selected:{}}},REMOVE_ANNOTATIONS:function(e,t){let n=e.selectedTab;"orphan"===n&&0
|
|
647
|
-
;return"note"!==e&&t.push("Location"),t})),
|
|
648
|
-
CLOSE_SIDEBAR_PANEL:function(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(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}}},
|
|
649
|
-
;const
|
|
650
|
-
get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}
|
|
651
|
-
factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const
|
|
652
|
-
"sidebar"===t.route()&&e.connect()}
|
|
653
|
-
document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),
|
|
654
|
-
}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(
|
|
655
|
-
console.error("Failed to start Hypothesis client: ",e),I(po(
|
|
528
|
+
;-1!==l?v(a[l]):1===a.length?v(a[0]):v(m()),e.preventDefault()}},onFocus:()=>{f()&&h(!0)},ref:i,placeholder:"Add new tags",className:"TagEditor__input",type:"text",autoComplete:"off","aria-autocomplete":"list","aria-activedescendant":_,"aria-controls":`${d}-AutocompleteList`,dir:"auto"}),po(Pd,{id:`${d}-AutocompleteList`,list:a,listFormatter:e=>{const t=m().toLowerCase(),n=e.toLowerCase().indexOf(t);if(-1===n)return po("span",{children:e});const r=e.slice(0,n),o=e.slice(n,n+t.length),i=e.slice(n+t.length);return po("span",{children:[po("strong",{children:r}),o,po("strong",{children:i})]})},open:u,onSelectItem:e=>{e&&v(e)},itemPrefixId:`${d}-AutocompleteList-item-`,activeItem:l})]})]})}),["tags"]);function Fd(){return po("div",{className:"hyp-u-padding--top hyp-u-border--top text-sm leading-none",children:po(zo,{classes:"hyp-u-layout-row--align-center p-link--muted",href:"http://creativecommons.org/publicdomain/zero/1.0/",target:"_blank",
|
|
529
|
+
title:"View more information about the Creative Commons Public Domain dedication",children:[po(Mo,{name:"cc-std",classes:"text-tiny"}),po(Mo,{name:"cc-zero",classes:"hyp-u-margin--left--1 text-tiny"}),po("div",{className:"hyp-u-margin--left--2",children:"Annotations can be freely reused by anyone for any purpose."})]})})}function jd(e){return null!==e.offsetParent}function Hd({className:e,closeMenu:t,children:n,visible:r}){const o=to();Qr((()=>{let e=null;return r&&(e=setTimeout((()=>{const e=o.current.querySelector('[role^="menuitem"]');e&&e.focus()}))),()=>{clearTimeout(e)}}),[r]);return po("div",{role:"menu",className:e,ref:o,onKeyDown:e=>{const n=Array.from(o.current.querySelectorAll('[role^="menuitem"]')).filter(jd);let r=n.findIndex((e=>e.contains(document.activeElement))),i=!1;switch(Oo(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}
|
|
530
|
+
i&&r>=0&&(e.stopPropagation(),e.preventDefault(),n[r].focus())},children:n})}function qd({className:e}){return po("svg",{className:qr("Menu__arrow",e),width:15,height:8,children:po("path",{d:"M0 8 L7 0 L15 8",stroke:"currentColor",strokeWidth:"2"})})}let Ud=!1;const $d=()=>{};function Gd({align:e="left",arrowClass:t="",children:n,containerPositioned:r=!0,contentClass:o,defaultOpen:i=!1,label:a,open:s,onOpenChanged:l,menuIndicator:c=!0,title:u}){let[h,d]=Zr(i);"boolean"==typeof s&&(h=s,d=l||$d);const p=to(h);Qr((()=>{"function"==typeof l&&p.current!==h&&(p.current=h,l(h))}),[h,l]);const f=e=>{if("mousedown"===e.type)Ud=!0;else if("click"===e.type&&Ud)return Ud=!1,e.stopPropagation(),void e.preventDefault();d(!h)},g=ro((()=>d(!1)),[d]),v=to();Ro(v,h,g);const y=e=>e.stopPropagation();return po("div",{className:"Menu",ref:v,style:{position:r?"relative":"static"},onClick:y,onMouseDown:y,children:[po("button",{"aria-expanded":h?"true":"false","aria-haspopup":!0,className:"Menu__toggle",onMouseDown:f,onClick:f,
|
|
531
|
+
"aria-label":u,title:u,children:po("span",{className:"Menu__toggle-wrapper",children:[a,c&&po("span",{className:qr("Menu__toggle-arrow",h&&"is-open"),children:po(fo,{name:"expand-menu",className:"Menu__toggle-icon"})})]})}),h&&po(m,{children:[po(qd,{className:t}),po("div",{className:qr("Menu__content",`Menu__content--align-${e}`,o),role:"menu",tabIndex:-1,onClick:g,onKeyDown:e=>{const t=Oo(e.key);"Enter"!==t&&" "!==t||setTimeout((()=>{g()}))},children:po(Hd,{visible:!0,children:n})})]})]})}function Vd({children:e,visible:t}){const n=to(),[r,o]=Zr(t?"auto":0),[i,a]=Zr(t);Qr((()=>{if(t===(0!==r))return;const e=n.current;t?(e.style.display="",a(!0),o(e.scrollHeight)):(e.style.height=`${e.scrollHeight}px`,e.getBoundingClientRect(),o(0))}),[r,t]);return po("div",{ontransitionend:ro((()=>{t?o("auto"):a(!1)}),[o,t]),ref:n,style:{display:i?"":"none",height:r,overflow:"auto"===r?"visible":"hidden",transition:"height 0.15s ease-in"},children:e})}
|
|
532
|
+
function Wd({href:e,icon:t,iconAlt:n,isDisabled:r,isExpanded:o,isSelected:i,isSubmenuItem:a,isSubmenuVisible:s,label:l,onClick:c,onToggleSubmenu:u,submenu:h}){const d=t&&-1!==t.indexOf("/"),p=t||a,f=t&&a,g=to();let v=null,y=null;t&&"blank"!==t&&(y=d?po("img",{className:"MenuItem__icon",alt:n,src:t}):po(fo,{name:t,className:"MenuItem__icon"}));const _=a?null:y,b=a?y:null;let w;const x="boolean"==typeof s,k="boolean"==typeof i;Qr((()=>()=>{clearTimeout(v)}),[]);const S=e=>{switch(Oo(e.key)){case"ArrowRight":u&&(e.stopPropagation(),e.preventDefault(),u(e));break;case"Enter":case" ":c&&c(e)}};return w=e?po("a",{ref:g,className:qr("MenuItem",{"is-submenu":a,"is-disabled":r}),href:e,target:"_blank",tabIndex:-1,rel:"noopener noreferrer",role:"menuitem",onKeyDown:S,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b})]}):po("div",{ref:g,className:qr("MenuItem",{"is-submenu":a,
|
|
533
|
+
"is-disabled":r,"is-expanded":o,"is-selected":i}),tabIndex:-1,onKeyDown:S,onClick:c,role:k?"menuitemradio":"menuitem","aria-checked":k?i:void 0,"aria-haspopup":x,"aria-expanded":x?s:void 0,children:[p&&po("div",{className:"MenuItem__icon-container",children:_}),po("span",{className:"MenuItem__label",children:l}),f&&po("div",{className:"MenuItem__icon-container",children:b}),x&&po("div",{role:"none",icon:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle",onClick:u,title:`Show actions for ${l}`,children:po(fo,{name:s?"collapse-menu":"expand-menu",className:"MenuItem__toggle-icon"})})]}),po(m,{children:[w,x&&po(Vd,{visible:s,children:po(Hd,{closeMenu:e=>{u&&u(e),v=setTimeout((()=>{g.current.focus()}))},visible:s,className:"MenuItem__submenu",children:h})})]})}var Yd=ri((function({annotation:e,isDisabled:t,onSave:n,settings:r}){const o=ii(),i=o.getDraft(e),a=o.getGroup(e.group);if(!a)return null;const s=i?i.isPrivate:!_a(e.permissions),l=s?"Only Me":a.name,c=t=>{o.createDraft(e,{...i,
|
|
534
|
+
isPrivate:"private"===t}),ki(e)||o.setDefault("annotationPrivacy",t)},u=ti(["ctaTextColor","ctaBackgroundColor"],r),h=po("div",{className:"annotation-publish-button__menu-label",style:u,children:po(Mo,{name:"expand-menu"})});return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--4",children:[po("div",{className:"annotation-publish-button",children:[po(bo,{classes:"PublishControlButton","data-testid":"publish-control-button",style:u,onClick:n,disabled:t,size:"large",variant:"primary",children:["Post to ",l]}),po("div",{className:"annotation-publish-button__menu-wrapper",style:u,children:po(Gd,{arrowClass:"annotation-publish-button__menu-arrow",containerPositioned:!1,contentClass:"annotation-publish-button__menu-content",label:h,menuIndicator:!1,title:"Change annotation sharing setting",align:"left",children:[po(Wd,{icon:"open"===a.type?"public":"groups",label:a.name,isSelected:!s,onClick:()=>c("shared")}),po(Wd,{icon:"lock",label:"Only Me",isSelected:s,onClick:()=>c("private")})]})})]
|
|
535
|
+
}),po("div",{children:po(bo,{icon:"cancel",onClick:()=>{o.removeDraft(e),Ci(e)&&o.removeAnnotations([e])},size:"large",children:"Cancel"})})]})}),["settings"]);var Kd=ri((function({annotation:e,annotationsService:t,settings:n,tags:r,toastMessenger:o}){const[i,a]=Zr(null),s=ii(),l=s.getDraft(e),c=s.getGroup(e.group);if(!l)return null;const u=!l.isPrivate&&c&&"private"!==c.type,h=l.tags,d=l.text,p=!d&&!h.length,m=({tags:e})=>{s.createDraft(l.annotation,{...l,tags:e})},f=e=>{if(!e||h.indexOf(e)>=0)return!1;const t=[...h,e];return r.store(t),m({tags:t}),!0},g=async()=>{i&&f(i);try{await t.save(e)}catch(e){o.error("Saving annotation failed")}};return po("div",{className:"hyp-u-vertical-spacing AnnotationEditor",onKeyDown:e=>{const t=Oo(e.key);p||(e.metaKey||e.ctrlKey)&&"Enter"===t&&(e.stopPropagation(),e.preventDefault(),g())},children:[po(Id,{textStyle:ti(["annotationFontFamily"],n),label:"Annotation body",text:d,onEditText:({text:e})=>{s.createDraft(l.annotation,{...l,text:e})}}),po(Bd,{onAddTag:f,
|
|
536
|
+
onRemoveTag:e=>{const t=[...h],n=t.indexOf(e);return n>=0&&(t.splice(n,1),m({tags:t}),!0)},onTagInput:a,tagList:h}),po("div",{className:"hyp-u-layout-row annotation__form-actions",children:po(Yd,{annotation:e,isDisabled:p,onSave:g})}),u&&po(Fd,{})]})}),["annotationsService","settings","tags","toastMessenger"]);function Xd(e,t,n){var r;return(n||t)&&null!==(r=e.user_info)&&void 0!==r&&r.display_name?e.user_info.display_name:Jo(e.user)}function Zd({domain:e,link:t,title:n}){return po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--2",children:[po("div",{className:"text-color-text-light",children:['on "',t?po(zo,{href:t,target:"_blank",children:n}):po("span",{children:n}),'"']}),e&&po("span",{className:"text-color-text-light",children:["(",e,")"]})]})}function Jd({annotation:e}){const t=ii().getGroup(e.group),n=null==t?void 0:t.links.html,r=ba(e.permissions);return po("div",{className:"hyp-u-layout-row--align-baseline",children:[t&&n&&po(zo,{
|
|
537
|
+
classes:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 p-link--muted p-link--hover-muted",href:t.links.html,target:"_blank",children:["open"===t.type?po(Mo,{classes:"text-tiny",name:"public"}):po(Mo,{classes:"text-tiny",name:"groups"}),po("span",{children:t.name})]}),r&&!n&&po("span",{className:"hyp-u-layout-row--align-baseline text-color-text-light",children:po("span",{"data-testid":"private-info",children:"Only me"})})]})}let Qd={};function ep(e,t){return t-e}function tp(e,t,n=window.Intl){const r=JSON.stringify(t);let o=Qd[r];return o||(o=Qd[r]=new n.DateTimeFormat(void 0,t)),o.format(e)}const np=[{test:(e,t)=>ep(e,t)<3e4,formatter:()=>"Just now",nextUpdate:1e3},{test:(e,t)=>ep(e,t)<6e4,formatter:function(e,t){return`${Math.floor(ep(e,t)/1e3)} secs ago`},nextUpdate:1e3},{test:(e,t)=>ep(e,t)<36e5,formatter:function(e,t){const n=Math.floor(ep(e,t)/6e4);return`${n} min${n>1?"s":""} ago`},nextUpdate:6e4},{test:(e,t)=>ep(e,t)<864e5,formatter:function(e,t){const n=Math.floor(ep(e,t)/36e5)
|
|
538
|
+
;return`${n} hr${n>1?"s":""} ago`},nextUpdate:36e5},{test:(e,t)=>e.getFullYear()===t.getFullYear(),formatter:function(e,t,n){return tp(e,{month:"short",day:"numeric"},n)},nextUpdate:null}],rp={test:()=>!0,formatter:function(e,t,n){return tp(e,{day:"numeric",month:"short",year:"numeric"},n)},nextUpdate:null};function op(e,t){for(let n of np)if(n.test(e,t))return n;return rp}function ip(e){return!isNaN(e.valueOf())}function ap(e,t){let n;const r=new Date(e),o=()=>{const e=function(e,t){if(!e||!ip(e)||!ip(t))return null;let n=op(e,t).nextUpdate;return null===n?null:(n=Math.max(n,5e3),n=Math.min(n,20736e5),n)}(r,new Date);if(null===e)return;n=setTimeout((()=>{t(),o()}),e+500)};return o(),()=>clearTimeout(n)}function sp(e,t,n){return e?op(e,t).formatter(e,t,n):""}function lp(e,t){return tp(e,{year:"numeric",month:"short",day:"2-digit",weekday:"long",hour:"2-digit",minute:"2-digit"},t)}function cp({annotationCreated:e,annotationUpdated:t,annotationUrl:n,withEditedTimestamp:r}){
|
|
539
|
+
const[o,i]=Zr((()=>new Date)),a=no((()=>new Date(e)),[e]),s=no((()=>r&&new Date(t)),[t,r]),l=no((()=>({absolute:lp(a),relative:sp(a,o)})),[a,o]),c=no((()=>s?{absolute:lp(s),relative:sp(s,o)}:{}),[s,o]);Qr((()=>ap(s?t:e,(()=>i(new Date)))),[e,t,a,s,o]);const u=c&&c.relative!==l.relative?`edited ${c.relative}`:"edited";return po("div",{children:[r&&po("span",{className:"text-color-text-light text-sm italic","data-testid":"timestamp-edited",title:c.absolute,children:["(",u,")"," "]}),n?po(zo,{classes:"p-link--muted p-link--hover-muted",target:"_blank",title:l.absolute,href:n,children:l.relative}):po("span",{className:"color-text-color-light","data-testid":"timestamp-created",title:l.absolute,children:l.relative})]})}function up({authorLink:e,displayName:t}){const n=po("h3",{className:"text-color-text font-bold",children:t});return e?po(zo,{href:e,target:"_blank",children:n}):po("div",{children:n})}var hp=ri((function({annotation:e,isEditing:t,replyCount:n,threadIsCollapsed:r,settings:o}){var i
|
|
540
|
+
;const a=ii(),s=a.defaultAuthority(),l=a.isFeatureEnabled("client_display_names"),c=Qo(e.user,s),u=Xd(e,c,l),h=(()=>{var t;return c?null!==(t=o.usernameUrl&&`${o.usernameUrl}${Jo(e.user)}`)&&void 0!==t?t:void 0:a.getLink("user",{user:e.user})})(),d=ki(e)&&r,p=ba(e.permissions),m=(null===(i=e.links)||void 0===i?void 0:i.html)||"",f=!t&&e.created,g=no((()=>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]),v=`${n} ${n>1?"replies":"reply"}`,y=n>0&&d,_=!ki(e),b=function(e){return{domain:wi(e),titleText:xi(e),titleLink:bi(e)}}(e),w=m&&b.titleLink?b.titleLink:"",x="sidebar"!==a.route()&&b.titleText;return po("header",{children:[po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[p&&!t&&po(Mo,{classes:"text-tiny",name:"lock",title:"This annotation is visible only to you"}),po(up,{authorLink:h,displayName:u}),y&&po(wo,{
|
|
541
|
+
onClick:()=>a.setExpanded(e.id,!0),title:"Expand replies",children:v}),f&&po("div",{className:"hyp-u-layout-row--justify-right hyp-u-stretch",children:po(cp,{annotationCreated:e.created,annotationUpdated:e.updated,annotationUrl:m,withEditedTimestamp:g})})]}),_&&po("div",{className:"hyp-u-layout-row--align-baseline hyp-u-horizontal-spacing--2 flex-wrap-reverse",children:[po(Jd,{annotation:e}),!t&&Li(e)&&po(Mo,{name:"highlight",title:"This is a highlight. Click 'edit' to add a note or tag.",classes:"text-tiny text-color-text-light"}),x&&po(Zd,{domain:b.domain,link:w,title:b.titleText})]})]})}),["settings"]);var dp=ri((function({annotation:e,isFocused:t,settings:n={}}){return po("div",{className:qr({"is-orphan":Mi(e)}),children:po(Na,{collapsedHeight:35,inlineControls:!0,overflowThreshold:20,children:po("blockquote",{className:qr("p-quoted-text",{"is-focused":t,"p-redacted-content":Mi(e)}),dir:"auto",lang:"",style:ti(["selectionFontFamily"],n),children:Ri(e)})})})}),["settings"])
|
|
542
|
+
;function pp({onToggleReplies:e,replyCount:t,threadIsCollapsed:n}){const r=`${n?"Show replies":"Hide replies"} (${t})`;return po(wo,{onClick:e,title:r,children:r})}var mp=ri((function({annotation:e,hasAppliedFilter:t,isReply:n,onToggleReplies:r,replyCount:o,threadIsCollapsed:i,annotationsService:a}){const s=n&&i,l=ii(),c=e&&!!Ri(e),u=e&&l.isAnnotationFocused(e.$tag),h=e&&l.isSavingAnnotation(e),d=e&&!!l.getDraft(e)&&!h,p=l.profile().userid,f=!h&&!d,g=!n&&!t&&o>0;return po("article",{className:qr("hyp-u-vertical-spacing",{"is-collapsed":i,"is-focused":u}),children:[e&&po(m,{children:[po(hp,{annotation:e,isEditing:d,replyCount:o,threadIsCollapsed:i}),c&&po(dp,{annotation:e,isFocused:u}),!s&&!d&&po(xd,{annotation:e}),d&&po(Kd,{annotation:e})]}),!e&&!s&&po("div",{children:po("em",{children:"Message not available."})}),!s&&po("footer",{children:po("div",{className:"hyp-u-layout-row",children:[g&&po(pp,{onToggleReplies:r,replyCount:o,threadIsCollapsed:i}),h&&po("div",{
|
|
543
|
+
className:"hyp-u-layout-row--justify-right hyp-u-stretch","data-testid":"saving-message",children:"Saving..."}),e&&f&&Si(e)&&po(So,{classes:"hyp-u-stretch",children:po(Aa,{annotation:e,onReply:()=>{e&&Si(e)&&a.reply(e,p)}})})]})})]})}),["annotationsService"]);var fp=ri((function({annotation:e,api:t,toastMessenger:n}){const r=ii(),o=function(e){return e.moderation?e.moderation.flagCount:null}(e);return null!==o&&(o>0||e.hidden)?po("div",{className:qr("flex gap-x-3 bg-grey-1 text-color-text font-semibold","mb-2 ",{"-mt-3 -ml-3 -mr-3":!ki(e),"-mr-3":ki(e)}),children:[po("div",{className:qr("p-3 text-white",{"bg-red-error":!e.hidden,"bg-grey-6":e.hidden}),children:po(Mo,{name:e.hidden?"hide":"flag"})}),po("div",{className:"self-center grow",children:[!e.hidden&&po("span",{children:["Flagged for review by ",o," ",1===o?"user":"users"]}),e.hidden&&po("span",{children:"Hidden from users"})]}),po("div",{className:"self-center pr-2",children:po(bo,{classes:"py-1 bg-slate-1",onClick:e.hidden?()=>{const o=e.id
|
|
544
|
+
;t.annotation.unhide({id:o}).then((()=>{r.unhideAnnotation(o)})).catch((()=>{n.error("Failed to unhide annotation")}))}:()=>{const o=e.id;t.annotation.hide({id:o}).then((()=>{r.hideAnnotation(o)})).catch((()=>{n.error("Failed to hide annotation")}))},title:e.hidden?"Make this annotation visible to everyone":"Hide this annotationn from non-moderators",variant:"dark",children:e.hidden?"Unhide":"Hide"})})]}):null}),["api","toastMessenger"]);function gp({annotation:e,...t}){const n=ii(),r=e&&n.isSavingAnnotation(e),o=e&&!!n.getDraft(e)&&!r;return e?po("div",{className:"Thread__top-annotation-header",children:po(hp,{annotation:e,isEditing:o,...t})}):null}var vp=ri((function e({thread:t,threadsService:n}){const r=!t.collapsed,o=Ui(t)>0,i=!!t.parent,a=t.collapsed?"collapsed":"expand-menu",s=t.collapsed?"Expand replies":"Collapse replies",l=t.children.filter((e=>$i(e)>0)),c=ii(),u=c.hasAppliedFilter(),h=ro((()=>c.setExpanded(t.id,!!t.collapsed)),[c,t.id,t.collapsed]),d=no((()=>t.visible&&po(m,{
|
|
545
|
+
children:[t.annotation&&po(fp,{annotation:t.annotation}),po(mp,{annotation:t.annotation,hasAppliedFilter:u,isReply:!!t.parent,onToggleReplies:h,replyCount:t.replyCount,threadIsCollapsed:t.collapsed})]})),[u,h,t.annotation,t.parent,t.replyCount,t.collapsed,t.visible]);return po("section",{className:qr("Thread",{"Thread--reply":t.depth>0,"is-collapsed":t.collapsed}),children:[i&&po("div",{className:"Thread__collapse",children:po("div",{className:"Thread__collapse-button-container",children:po(_o,{classes:"NonResponsiveIconButton",expanded:!t.collapsed,icon:a,title:s,onClick:h,size:"medium",variant:"light"})})}),po("div",{className:"Thread__content",children:[d,o&&po(m,{children:[!t.parent&&po(gp,{annotation:t.annotation,replyCount:t.replyCount,threadIsCollapsed:t.collapsed}),po("div",{className:"Thread__hidden-toggle-button-container",children:po(bo,{onClick:()=>n.forceVisible(t),children:["Show ",Ui(t)," more in conversation"]})})]}),r&&po("ul",{className:"Thread__children",children:l.map((t=>po("li",{
|
|
546
|
+
children:po(e,{thread:t,threadsService:n})},t.id)))})]})]})}),["threadsService"]);var yp=ri((function({frameSync:e,thread:t}){const n=ii(),r=t.annotation&&t.annotation.$tag,o=r&&n.isAnnotationFocused(r),i=no((()=>ha((t=>{const n=t?[t]:[];e.focusAnnotations(n)}),10)),[e]),a=ro((t=>{e.scrollToAnnotation(t)}),[e]),s=no((()=>po(vp,{thread:t})),[t]);return po("div",{onClick:e=>{var t;(t=e.target).closest("button")||t.closest("a")||a(r)},onMouseEnter:()=>i(r),onMouseLeave:()=>i(null),className:qr("ThreadCard p-3",{"is-focused":o}),children:s},t.id)}),["frameSync"]);function _p(){const e=document.querySelector(".js-thread-list-scroll-root");if(!e)throw new Error("Scroll container is missing");return e}function bp(e){return Math.max(e-e%50,0)}function wp({threads:e}){const[t,n]=Zr(0),[r,o]=Zr(0);eo((()=>{const e=new da,t=_p();n(t.clientHeight),o(bp(t.scrollTop));const r=ha((()=>{n(t.clientHeight),o(bp(t.scrollTop))}),10,{maxWait:100});return e.add(t,"scroll",r),e.add(window,"resize",r),()=>{e.removeAll(),r.cancel()}
|
|
547
|
+
}),[]);const[i,a]=Zr({}),[s,l]=Zr(null),c=e,{offscreenLowerHeight:u,offscreenUpperHeight:h,visibleThreads:d}=no((()=>function(e,t,n,r,o=pa){const{defaultHeight:i,marginAbove:a,marginBelow:s}=o,l=[];let c=0,u=0,h=0;return e.forEach((e=>{const o=t[e.id]||i;c+o<n-a?u+=o:c<n+r+s?l.push(e):h+=o,c+=o})),{visibleThreads:l,offscreenUpperHeight:u,offscreenLowerHeight:h}}(c,i,r,t)),[c,i,r,t]),p=ii(),m=(()=>{const e=p.unsavedAnnotations();return e.length?e[e.length-1].$tag:null})();return Qr((()=>{m&&(p.setForcedVisible(m,!0),l(m))}),[p,m]),Qr((()=>{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[e.id]||pa.defaultHeight)(t)),0);_p().scrollTop=t}),[s,c,i]),Qr((()=>{a((e=>{const t={};for(let{id:n}of d){const r=document.getElementById(n);if(!r)return console.warn("ThreadList could not measure thread. Element not found."),e;const o=ma(r);o!==e[n]&&(t[n]=o)}return 0===Object.keys(t).length?e:{...e,...t}}))}),[d]),po("div",{children:[po("div",{style:{
|
|
548
|
+
height:h}}),d.map((e=>po("div",{className:"ThreadList__card",id:e.id,children:po(yp,{thread:e})},e.id))),po("div",{style:{height:u}})]})}function xp({errorType:e,onLoginRequest:t,showClearSelection:n=!1}){const r=ii(),o=r.isLoggedIn();return po("div",{className:"mb-4",children:po(Ho,{icon:"restricted",title:"annotation"===e?"Annotation unavailable":"Group unavailable",children:[po("p",{children:o?"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 an annotation, but that annotation\n cannot be found, or you 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.`}),po("div",{className:"hyp-u-layout-row--justify-right hyp-u-horizontal-spacing",children:[n&&po(bo,{variant:o?"primary":void 0,onClick:()=>r.clearSelection(),children:"Show all annotations"}),!o&&po(bo,{variant:"primary",onClick:t,
|
|
549
|
+
children:"Log in"})]})]})})}var kp=ri((function({loadAnnotationsService:e,onLogin:t}){const n=ii(),r=n.routeParams().id,o=Xi(),i=n.profile().userid,[a,s]=Zr(!1);return Qr((()=>{s(!1),n.clearAnnotations(),e.loadThread(r).then((e=>{const t=e.filter((e=>0===(e.references||[]).length))[0];t&&(e.forEach((e=>n.setExpanded(e.id,!0))),t.id!==r&&n.highlightAnnotations([r]))})).catch((()=>{s(!0)}))}),[r,i,e,n]),po(m,{children:[a&&po(xp,{errorType:"annotation",onLoginRequest:t}),po(wp,{threads:o.children})]})}),["loadAnnotationsService"]);function Sp({actionButton:e,additionalCount:t=0,entitySingular:n="annotation",entityPlural:r="annotations",filterQuery:o,focusDisplayName:i,resultCount:a}){return po("div",{className:"FilterStatus",children:ii().isLoading()?po("div",{className:"hyp-u-layout-row--center",children:po(Uo,{})}):po("div",{className:"hyp-u-layout-row--align-center",children:[po("div",{className:"FilterStatus__text",children:[a>0&&po("span",{children:"Showing "}),po("span",{className:"filter-facet",
|
|
550
|
+
children:[a>0?a:"No"," ",1===a?n:r]}),o&&po("span",{children:[" ","for"," ",po("span",{className:"filter-facet--pre",children:`'${o}'`})]}),i&&po("span",{children:[" ","by ",po("span",{className:"filter-facet",children:i})]}),t>0&&po("span",{className:"filter-facet--muted",children:[" ","(and ",t," more)"]})]}),po("div",{children:e})]})})}function Cp({filterState:e,rootThread:t}){const n=ii(),r=n.directLinkedAnnotationId(),o=n.annotationCount(),i=(t.children||[]).filter((e=>e.annotation&&e.visible)).length-e.selectedCount,a=!e.focusConfigured&&!r?`Show all (${o})`:"Show all",s=po(bo,{title:a,variant:"primary",onClick:()=>n.clearSelection(),icon:"cancel",children:a});return po(Sp,{resultCount:e.selectedCount,additionalCount:i,actionButton:s})}function Ap({filterState:e,rootThread:t}){const n=ii(),r=$i(t)-e.forcedVisibleCount,o=po(bo,{icon:"cancel",variant:"primary",title:"Clear search",onClick:()=>n.clearSelection(),children:"Clear search"});return po(Sp,{actionButton:o,additionalCount:e.forcedVisibleCount,
|
|
551
|
+
entitySingular:"result",entityPlural:"results",filterQuery:e.filterQuery,focusDisplayName:e.focusDisplayName,resultCount:r})}function Ep({filterState:e,rootThread:t}){const n=ii(),r=$i(t)-e.forcedVisibleCount,o={};e.forcedVisibleCount>0?(o.onClick=()=>n.clearSelection(),o.title="Reset filters"):(o.onClick=()=>n.toggleFocusMode(),o.title=e.focusActive?"Show all":`Show only ${e.focusDisplayName}`);const i=e.focusActive?e.focusDisplayName:"",a=po(bo,{variant:"primary",...o,children:o.title});return po(Sp,{resultCount:r,actionButton:a,additionalCount:e.forcedVisibleCount,filterQuery:e.filterQuery,focusDisplayName:i})}function Tp(){const e=Xi(),t=ii(),n=t.focusState(),r=t.forcedVisibleThreads().length,o=t.filterQuery(),i=t.selectedAnnotations().length,a=no((()=>({filterQuery:o,focusActive:n.active,focusConfigured:n.configured,focusDisplayName:n.displayName,forcedVisibleCount:r,selectedCount:i})),[n,r,o,i]);return a.selectedCount>0?po(Cp,{filterState:a,rootThread:e}):a.filterQuery?po(Ap,{filterState:a,rootThread:e
|
|
552
|
+
}):a.focusConfigured?po(Ep,{filterState:a,rootThread:e}):null}function Np({onLogin:e}){const t=ii();return po("div",{className:"LoggedOutMessage",children:[po("span",{children:["This is a public annotation created with Hypothesis. ",po("br",{}),"To reply or make your own annotations on this document,"," ",po("a",{className:"LoggedOutMessage__link",href:t.getLink("signup"),target:"_blank",rel:"noopener noreferrer",children:"create a free account"})," ","or"," ",po(wo,{classes:"InlineLinkButton InlineLinkButton--underlined",onClick:e,variant:"dark",children:"log in"}),"."]}),po("div",{className:"LoggedOutMessage__logo",children:po("a",{href:"https://hypothes.is","aria-label":"Hypothesis homepage",title:"Hypothesis homepage",children:po(Mo,{name:"logo",classes:"w-16 h-16 hyp-u-color--grey-7"})})})]})}function Lp(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function Mp(e){var t=e._scrollSettings;if(t){var n=t.maxSynchronousAlignments,r=function(e,t){
|
|
553
|
+
var n,r,o,i,a,s,l,c=e.align,u=e.target.getBoundingClientRect(),h=c&&null!=c.left?c.left:.5,d=c&&null!=c.top?c.top:.5,p=c&&null!=c.leftOffset?c.leftOffset:0,m=c&&null!=c.topOffset?c.topOffset:0,f=h,g=d;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,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),y=u.top-(n.top-t.scrollTop);r=v+s*f-t.clientWidth*f,o=y+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}}(t,e),o=Date.now()-t.startTime,i=Math.min(1/t.time*o,1);if(t.endIterations>=n)return Lp(e,r.x,r.y),
|
|
554
|
+
e._scrollSettings=null,t.end("complete");var a=1-t.ease(i);if(Lp(e,r.x-r.differenceX*a,r.y-r.differenceY*a),o>=t.time)return t.endIterations++,t.scrollAncestor&&Mp(t.scrollAncestor),void Mp(e);!function(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}(Mp.bind(null,e))}}function zp(e){return e.self===e}function Op(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function Ip(){return!0}function Rp(e){if(e.assignedSlot)return Rp(e.assignedSlot);if(e.parentElement)return"BODY"===e.parentElement.tagName?e.parentElement.ownerDocument.defaultView||e.parentElement.ownerDocument.ownerWindow:e.parentElement;if(e.getRootNode){var t=e.getRootNode();if(11===t.nodeType)return t.host}}var Pp=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)},t.align=t.align||{}
|
|
555
|
+
;var r=Rp(e),o=1,i=t.validTarget||Ip,a=t.isScrollable;t.debug&&(console.log("About to scroll to",e),r||console.error("Target did not have a parent, is it mounted in the DOM?"));for(var s=[];r;)if(t.debug&&console.log("Scrolling parent node",r),i(r,o)&&(a?a(r,Op):Op(r))&&(o++,s.push(r)),!(r=Rp(r))){l("complete");break}return s.reduce(((n,r,o)=>function(e,t,n,r,o){var i,a=!t._scrollSettings,s=t._scrollSettings,l=Date.now(),c={passive:!0};function u(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),n.debug&&console.log("Scrolling ended with type",e,"for",t),o(e),i&&(t.removeEventListener("touchstart",i,c),t.removeEventListener("wheel",i,c))}s&&s.end("canceled");var h=n.maxSynchronousAlignments;return null==h&&(h=3),t._scrollSettings={startTime:l,endIterations:0,target:e,time:n.time,ease:n.ease,align:n.align,isWindow:n.isWindow||zp,maxSynchronousAlignments:h,end:u,scrollAncestor:r},"cancellable"in n&&!n.cancellable||(i=u.bind(null,"canceled"),
|
|
556
|
+
t.addEventListener("touchstart",i,c),t.addEventListener("wheel",i,c)),a&&Mp(t),i}(e,r,t,s[o+1],l)),null)}function l(e){--o||n&&n(e)}};function Dp({children:e,icon:t="",panelName:n,title:r,onActiveChanged:o}){const i=ii(),a=i.isSidebarPanelOpen(n),s=to(null),l=to(a);Qr((()=>{l.current!==a&&(l.current=a,a&&Pp(s.current),"function"==typeof o&&o(a))}),[a,o]);const c=ro((()=>{i.toggleSidebarPanel(n,!1)}),[i,n]);return po(Vd,{visible:a,children:po("div",{ref:s,className:"mb-4",children:po(Ho,{title:r,icon:t,onClose:c,children:e})})})}function Bp({onLogin:e,onSignUp:t}){return ii().isLoggedIn()?null:po(Dp,{icon:"restricted",title:"Login needed",panelName:"loginPrompt",children:[po("p",{children:"Please log in to create annotations or highlights."}),po(So,{children:[po(bo,{title:"Sign up",onClick:t,children:"Sign up"}),po(bo,{title:"Log in",variant:"primary",onClick:e,children:"Log in"})]})]})}function Fp({children:e,count:t,isWaitingToAnchor:n,isSelected:r,label:o,onSelect:i}){const a=()=>{r||i()
|
|
557
|
+
},s=t>0?`${o} (${t} available)`:o;return po(bo,{classes:qr("text-color-text","SelectionTab",{"is-selected":r}),onClick:a,onMouseDown:a,pressed:!!r,role:"tab",tabIndex:0,title:s,children:po(m,{children:[e,t>0&&!n&&po("span",{className:"text-tiny",style:"position:relative;bottom:3px;left:2px",children:t})]})})}var jp=ri((function({annotationsService:e,isLoading:t,settings:n}){const r=ii(),o=r.selectedTab(),i=r.noteCount(),a=r.annotationCount(),s=r.orphanCount(),l=r.isWaitingToAnchorAnnotations(),c=e=>{r.clearSelection(),r.selectTab(e)},u="annotation"===o&&0===a&&!l,h="note"===o&&0===i;return po("div",{className:"hyp-u-vertical-spacing--4 SelectionTabs__container",children:[po("div",{className:"hyp-u-layout-row hyp-u-horizontal-spacing--6 SelectionTabs",role:"tablist",children:[po(Fp,{count:a,isWaitingToAnchor:l,isSelected:"annotation"===o,label:"Annotations",onSelect:()=>c("annotation"),children:"Annotations"}),po(Fp,{count:i,isWaitingToAnchor:l,isSelected:"note"===o,label:"Page notes",onSelect:()=>c("note"),
|
|
558
|
+
children:"Page Notes"}),s>0&&po(Fp,{count:s,isWaitingToAnchor:l,isSelected:"orphan"===o,label:"Orphans",onSelect:()=>c("orphan"),children:"Orphans"})]}),"note"===o&&n.enableExperimentalNewNoteButton&&po("div",{className:"hyp-u-layout-row--justify-right",children:po(bo,{"data-testid":"new-note-button",icon:"add",onClick:()=>e.createPageNote(),variant:"primary",style:ti(["ctaBackgroundColor"],n),children:"New note"})}),!t&&h&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"notes-unavailable-message",children:"There are no page notes in this group."})}),!t&&u&&po(ko,{classes:"text-center",children:po("span",{"data-testid":"annotations-unavailable-message",children:["There are no annotations in this group.",po("br",{}),"Create one by selecting some text and clicking the"," ",po(Mo,{classes:"m-0.5 inline -mt-0.5",name:"annotate",title:"Annotate"})," ","button."]})})]})}),["annotationsService","settings"]);var Hp=ri((function({frameSync:e,onLogin:t,onSignUp:n,loadAnnotationsService:r,streamer:o}){
|
|
559
|
+
const i=Xi(),a=ii(),s=a.focusedGroupId(),l=a.hasAppliedFilter()||a.hasSelectedAnnotations(),c=a.isLoading(),u=a.isLoggedIn(),h=a.directLinkedAnnotationId(),d=h?a.findAnnotationByID(h):void 0,p=d?Hi(d):"annotation",m=a.searchUris(),f=a.hasSidebarOpened(),g=a.profile().userid,v=d&&!1===d.$orphan?d.$tag:null,y=!(c||!h)&&!d,_=a.directLinkedGroupFetchFailed(),b=y||_,w=!b,x=!b&&!l,k=h&&!u&&!y&&!c,S=to(s);Qr((()=>{if(!S.current||S.current!==s){if(S.current){let e=a.focusState().active;a.clearSelection(),e&&a.toggleFocusMode(!0)}S.current=s}s&&m.length&&r.load({groupId:s,uris:m})}),[a,r,s,g,m]),Qr((()=>{v?(e.focusAnnotations([v]),e.scrollToAnnotation(v),a.selectTab(p)):d&&a.selectTab(p)}),[p,e,d,v,a]);const C=a.hasFetchedProfile();return Qr((()=>{C&&(f||u)&&o.connect({applyUpdatesImmediately:!1})}),[C,u,f,o]),po("div",{children:[po("h2",{className:"sr-only",children:"Annotations"}),w&&po(Tp,{}),po(Bp,{onLogin:t,onSignUp:n}),y&&po(xp,{errorType:"annotation",onLoginRequest:t,showClearSelection:!0}),_&&po(xp,{
|
|
560
|
+
errorType:"group",onLoginRequest:t}),x&&po(jp,{isLoading:c}),po(wp,{threads:i.children}),k&&po(Np,{onLogin:t})]})}),["frameSync","loadAnnotationsService","streamer"]);var qp=ri((function({api:e,toastMessenger:t}){const n=ii(),r=n.routeParams().q,o=ro((async t=>{const r={_separate_replies:!0,offset:0,limit:20,...yi(t)};try{n.annotationFetchStarted();const t=await e.search(r);n.addAnnotations([...t.rows,...t.replies])}finally{n.annotationFetchFinished()}}),[e,n]);return Qr((()=>{n.setSortKey("Newest"),n.clearAnnotations(),o(r).catch((e=>{t.error(`Unable to fetch annotations: ${e.message}`)}))}),[r,o,n,t]),po(wp,{threads:Xi().children})}),["api","toastMessenger"]);class Up{constructor(e,t,n=window){var r,o,i;const a="N/A";let s=a;e.userid&&(s=e.userid,e.displayName&&(s=`${e.displayName} (${s})`)),this.version="1.984.0",this.userAgent=n.navigator.userAgent,this.urls=t.map((e=>e.uri)).join(", ")||a,
|
|
561
|
+
this.fingerprint=null!==(r=null===(o=t[0])||void 0===o||null===(i=o.metadata)||void 0===i?void 0:i.documentFingerprint)&&void 0!==r?r:a,this.account=s,this.timestamp=(new Date).toString()}asFormattedString(){return`Version: ${this.version}\nUser Agent: ${this.userAgent}\nURL: ${this.urls}\nFingerprint: ${this.fingerprint}\nAccount: ${this.account}\nDate: ${this.timestamp}\n`}asEncodedURLString(){return encodeURIComponent(this.asFormattedString())}}function $p(e){const t=P(e);return!(null==t||!t.authority)&&t.authority!==e.authDomain}function Gp({commandName:e,iconName:t}){return po("span",{className:"whitespace-nowrap",children:[po(Mo,{name:t,classes:qr("mx-1 -mt-1","text-color-text-light inline")}),po("em",{children:e})]})}var Vp=ri((function({settings:e}){const t=!$p(e);return po("ol",{className:"list-decimal pl-10 space-y-2",children:[po("li",{children:["To create an annotation, select text and then select the"," ",po(Gp,{iconName:"annotate",commandName:"Annotate"})," ","button."]}),po("li",{
|
|
562
|
+
children:["To create a highlight (",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/why-are-highlights-private-by-default/",target:"_blank",children:"visible only to you"}),"), select text and then select the"," ",po(Gp,{iconName:"highlight",commandName:"Highlight"})," ","button."]}),t&&po("li",{children:["To annotate in a private group, select the group from the groups dropdown. Don't see your group? Ask the group creator to send a"," ",po(zo,{classes:"underline hover:underline",href:"https://web.hypothes.is/help/how-to-join-a-private-group/",target:"_blank",children:"join link"}),")."]}),po("li",{children:["To reply to an annotation, select the"," ",po(Gp,{iconName:"reply",commandName:"Reply"})," button."]})]})}),["settings"]);var Wp=ri((function({toastMessenger:e,versionData:t}){return po("div",{className:"hyp-u-vertical-spacing",children:[po("dl",{className:"VersionInfo",children:[po("dt",{className:"VersionInfo__key",children:"Version"}),po("dd",{
|
|
563
|
+
className:"VersionInfo__value",children:t.version}),po("dt",{className:"VersionInfo__key",children:"User Agent"}),po("dd",{className:"VersionInfo__value",children:t.userAgent}),po("dt",{className:"VersionInfo__key",children:"URL"}),po("dd",{className:"VersionInfo__value",children:t.urls}),po("dt",{className:"VersionInfo__key",children:"Fingerprint"}),po("dd",{className:"VersionInfo__value",children:t.fingerprint}),po("dt",{className:"VersionInfo__key",children:"Account"}),po("dd",{className:"VersionInfo__value",children:t.account}),po("dt",{className:"VersionInfo__key",children:"Date"}),po("dd",{className:"VersionInfo__value",children:t.timestamp})]}),po("div",{className:"hyp-u-layout-row--justify-center",children:po(bo,{onClick:()=>{try{wa(t.asFormattedString()),e.success("Copied version info to clipboard")}catch(t){e.error("Unable to copy version info")}},icon:"copy",children:"Copy version details"})})]})}),["toastMessenger"]);function Yp({children:e,onClick:t}){return po(wo,{
|
|
564
|
+
classes:"leading-none text-brand",onClick:t,children:[e,po(Mo,{classes:"ml-1",name:"arrow-right"})]})}function Kp({linkText:e,url:t}){return po("div",{className:"flex-1 border-r last-of-type:border-r-0",children:po(zo,{href:t,classes:"flex items-center justify-center space-x-2 text-color-text-light text-lg font-medium",target:"_blank",children:[po("span",{children:e})," ",po(Mo,{name:"external",classes:"w-3 h-3"})]})})}var Xp=ri((function({auth:e,session:t}){const n=ii(),r=n.frames(),o=n.mainFrame(),i=!!n.profile().preferences.show_sidebar_tutorial,[a,s]=Zr("tutorial"),l=no((()=>{const t=e||{status:"logged-out"},n=[...r].sort(((e,t)=>e===o?-1:t===o?1:0));return new Up(t,n)}),[e,r,o]),c=`https://web.hypothes.is/get-help/?sys_info=${l.asEncodedURLString()}`,u=(e,t)=>{e.preventDefault(),s(t)};return po(Dp,{title:"Help",panelName:"help",onActiveChanged:ro((e=>{!e&&i&&t.dismissSidebarTutorial()}),[t,i]),children:po("div",{className:"space-y-4",children:[po("div",{className:"flex items-center",children:[po("h3",{
|
|
565
|
+
className:"grow text-lg font-medium","data-testid":"subpanel-title",children:{tutorial:"Getting started",versionInfo:"About this version"}[a]}),"versionInfo"===a&&po(Yp,{onClick:e=>u(e,"tutorial"),children:"Getting started"}),"tutorial"===a&&po(Yp,{onClick:e=>u(e,"versionInfo"),children:"About this version"})]}),po("div",{className:"border-y py-4",children:["tutorial"===a&&po(Vp,{}),"versionInfo"===a&&po(Wp,{versionData:l})]}),po("div",{className:"flex items-center",children:[po(Kp,{linkText:"Help topics",url:"https://web.hypothes.is/help/"}),po(Kp,{linkText:"New support ticket",url:c})]})]})})}),["session"]),Zp={exports:{}};function Jp(){}Jp.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},
|
|
566
|
+
off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,a=r.length;i<a;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},Zp.exports=Jp;var Qp=Zp.exports.TinyEmitter=Jp;class em extends Error{constructor(e){super(`Results size exceeds ${e}`)}}function tm(e){return 0===e?50:200}class nm extends Qp{constructor(e,{getPageSize:t=tm,separateReplies:n=!0,incremental:r=!0,maxResults:o=null,sortBy:i="created",sortOrder:a="asc"}={}){super(),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._results=[],this._resultCount=null}async _getPage(e,t,n=0){const r=this._getPageSize(n),o={limit:r,sort:this._sortBy,order:this._sortOrder,_separate_replies:this._separateReplies,...e};t&&(o.search_after=t);try{const t=await this._searchFn(o);if(this._canceled)return;if(null===this._resultCount&&(this._resultCount=t.total,this.emit("resultCount",this._resultCount)),
|
|
567
|
+
this._maxResults&&t.total>this._maxResults)return this.emit("error",new em(this._maxResults)),void this.emit("end");const i=t.rows.concat(t.replies||[]);this._incremental?this.emit("results",i):this._results=this._results.concat(i);const a=i.length===r,s=i.length>0?i[i.length-1][this._sortBy]:null;a&&s?this._getPage(e,s,n+1):(this._incremental||this.emit("results",this._results),this.emit("end"))}catch(e){if(this._canceled)return;this.emit("error",e),this.emit("end")}}get(e){this._results=[],this._resultCount=null,this._getPage(e)}cancel(){this._canceled=!0,this.emit("end")}}function rm({defaultOption:e,icon:t,onSelect:n,options:r,selectedOption:o,title:i}){const a=[e,...r],s=null!=o?o:e,l=po("span",{className:"FilterSelect__menu-label",children:[t&&po(Mo,{name:t,classes:"text-xl hyp-u-margin--right--3"}),s.display]});return po(Gd,{label:l,title:i,contentClass:"FilterSelect__menu",children:a.map((e=>po(Wd,{onClick:()=>n(e),isSelected:e.value===s.value,label:e.display},e.value)))})}function om(){
|
|
568
|
+
const e=ii(),t=e.getFilter("user"),n=function(){const e=ii(),t=e.allAnnotations(),n=e.defaultAuthority(),r=e.isFeatureEnabled("client_display_names"),o=e.getFocusFilters(),i=Jo(e.profile().userid);return no((()=>{const e={};if(t.forEach((t=>{const o=Jo(t.user);e[o]=Xd(t,Qo(t.user,n),r)})),o.user){const t=Jo(o.user.value)||o.user.value;e[t]=o.user.display}const a=Object.keys(e).map((t=>({display:t===i?`${e[t]} (Me)`:e[t],value:t})));return a.sort(((e,t)=>i===e.value?-1:i===t.value?1:e.display.localeCompare(t.display))),a}),[t,i,n,r,o.user])}();return po(rm,{defaultOption:{value:"",display:"Everybody"},icon:"profile",onSelect:t=>e.setFilter("user",t),options:n,selectedOption:t,title:"Filter by user"})}function im({forcedVisibleCount:e,isFiltered:t,isLoading:n,resultCount:r}){const o=Xi(),i=n?r:$i(o),a=o.children.length>0,s=t&&e>0,l=i-e,c=o.children.length;return po("div",{className:"hyp-u-layout-row NotebookResultCount",children:[n&&po(Uo,{size:"small"}),!n&&po("h2",{children:[!a&&po("strong",{
|
|
569
|
+
children:"No results"}),a&&t&&po("strong",{children:[l," ",1===l?"result":"results"]}),a&&!t&&po("strong",{children:[c," ",1===c?"thread":"threads"]})]}),s&&po("h3",{children:["(and ",e," more)"]}),!t&&a&&po("h3",{children:["(",i," ",1===i?"annotation":"annotations",")"]})]})}function am({currentPage:e,onChangePage:t,totalPages:n}){const r=e<n,o=e>1,i=function(e,t,n=5){if(t<=1)return[];const r=new Set([1,e,t]);let o=1;for(;r.size<Math.min(t,n);)e+o<=t&&r.add(e+o),e-o>=1&&r.add(e-o),++o;const i=[];return[...r].sort(((e,t)=>e-t)).forEach(((e,t,n)=>{t>0&&e-n[t-1]>1&&i.push(null),i.push(e)})),i}(e,n),a=(e,n)=>{t(e),null==n||n.blur()};return po("div",{className:"PaginationNavigation",children:[po("div",{className:"PaginationNavigation__relative PaginationNavigation__prev",children:o&&po(bo,{classes:"PaginationPageButton",icon:"arrow-left",title:"Go to previous page",onClick:t=>a(e-1,t.target),variant:"dark",children:"prev"})}),po("ul",{className:"PaginationNavigation__pages",children:i.map(((t,n)=>po("li",{
|
|
570
|
+
children:null===t?po("div",{className:"PaginationNavigation__gap",children:"..."}):po(bo,{classes:"PaginationPageButton",title:`Go to page ${t}`,pressed:t===e,onClick:e=>a(t,e.target),variant:"dark",children:t.toString()},`page-${n}`)},n)))}),po("div",{className:"PaginationNavigation__relative PaginationNavigation__next",children:r&&po(bo,{classes:"PaginationPageButton",icon:"arrow-right",iconPosition:"right",title:"Go to next page",onClick:t=>a(e+1,t.target),variant:"dark",children:"next"})})]})}function sm({currentPage:e,isLoading:t,onChangePage:n,threads:r,pageSize:o=25}){const{paginatedThreads:i,totalPages:a}=no((()=>{const t=r.filter((e=>$i(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 po(m,{children:[po(wp,{threads:i}),!t&&po(am,{currentPage:e,onChangePage:n,totalPages:a})]})}var lm=ri((function({loadAnnotationsService:e,streamer:t}){var n
|
|
571
|
+
;const r=ii(),o=r.getFilterValues(),i=r.focusedGroup(),a=r.forcedVisibleThreads().length,s=r.hasAppliedFilter(),l=r.isLoading(),c=r.annotationResultCount(),u=r.pendingUpdateCount(),h=Xi(),d=null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"…",p=(null==i?void 0:i.id)||r.directLinkedGroupId(),m=to(1),[f,g]=Zr(1),[v,y]=Zr(!1),_=e=>{e instanceof em&&y(!0)},b=r.hasFetchedProfile();Qr((()=>{b&&t.connect({applyUpdatesImmediately:!1})}),[b,t]),Qr((()=>{r.setSortKey("Newest"),p&&e.load({groupId:p,sortBy:"updated",sortOrder:"desc",maxResults:5e3,onError:_,streamFilterBy:"group"})}),[e,p,r]);const w=e=>{g(e)};Qr((()=>{w(1)}),[o,i]);const x=to(null);eo((()=>{f!==m.current&&(Pp(x.current),m.current=f)}),[f]);const k=`Show ${u} new or updated ${u>1?"annotations":"annotation"}`;return po("div",{className:"NotebookView",children:[po("header",{className:"NotebookView__heading",ref:x,children:po("h1",{className:"NotebookView__group-name",children:d})}),po("div",{className:"NotebookView__filters",children:po(om,{})}),po("div",{
|
|
572
|
+
className:"NotebookView__results hyp-u-layout-row--align-center text-lg font-medium",children:[u>0&&!s&&po(_o,{icon:"refresh",onClick:()=>t.applyPendingUpdates(),variant:"primary",title:k}),po(im,{forcedVisibleCount:a,isFiltered:s,isLoading:l,resultCount:c})]}),po("div",{className:"NotebookView__items",children:[v&&po("div",{className:"NotebookView__messages",children:po(Ho,{title:"Too many results to show",children:["This preview of the Notebook can show"," ",po("strong",{children:["up to ",5e3," results"]})," at a time (there are"," ",c," to show here)."," ",po("a",{href:"mailto:support@hypothes.is?subject=Hypothesis%20Notebook&body=Please%20notify%20me%20when%20the%20Hypothesis%20Notebook%20is%20updated%20to%20support%20more%20than%205000%20annotations",children:"Contact us"})," ","if you would like to be notified when support for more annotations is available."]})}),po(sm,{currentPage:f,isLoading:l,onChangePage:w,threads:h.children})]})]})}),["loadAnnotationsService","streamer"])
|
|
573
|
+
;var cm=ri((function({toastMessenger:e}){const t=ii(),n=t.mainFrame(),r=t.focusedGroup(),o=`Share Annotations in ${r&&r.name||"..."}`,i=r&&n,a=i&&(s=n.uri,l=r.id,fa(s)?`https://hyp.is/go?url=${encodeURIComponent(s)}&group=${l}`:null);var s,l;return po(Dp,{title:o,panelName:"shareGroupAnnotations",children:[!i&&po("div",{className:"flex flex-row items-center justify-center",children:po(Uo,{})}),i&&po("div",{className:"text-color-text-light space-y-3",children:a?po(m,{children:[po("div",{className:"text-color-text font-medium","data-testid":"sharing-intro",children:"private"===r.type?po("p",{children:"Use this link to share these annotations with other group members:"}):po("p",{children:"Use this link to share these annotations with anyone:"})}),po("div",{children:po(Vo,{children:[po(Go,{"aria-label":"Use this URL to share these annotations",type:"text",value:a,readOnly:!0}),po(_o,{icon:"copy",onClick:()=>{try{wa(a),e.success("Copied share link to clipboard")}catch(t){e.error("Unable to copy link")}},
|
|
574
|
+
title:"Copy share link",variant:"dark"})]})}),po("p",{"data-testid":"sharing-details",children:["private"===r.type?po("span",{children:["Annotations in the private group"," ",po("em",{children:r.name})," are only visible to group members."]}):po("span",{children:["Anyone using this link may view the annotations in the group"," ",po("em",{children:r.name}),"."]})," ",po("span",{children:["Private (",po(Mo,{name:"lock",classes:"inline -mt-0.5"})," ",po("em",{children:"Only Me"}),") annotations are only visible to you."]})]}),po(ka,{shareURI:a})]}):po("p",{"data-testid":"no-sharing",children:"These annotations cannot be shared because this document is not available on the web."})})]})}),["toastMessenger"]);function um({message:e,onDismiss:t}){const n=e.type.charAt(0).toUpperCase()+e.type.slice(1),r="notice"===e.type?"cancel":e.type;return po("li",{className:qr("toast-message-container",{"is-dismissed":e.isDismissed}),onClick:()=>t(e.id),children:po("div",{className:qr("toast-message",`toast-message--${e.type}`),
|
|
575
|
+
children:[po("div",{className:"toast-message__type",children:po(Mo,{name:r,classes:"toast-message__icon"})}),po("div",{className:"toast-message__message",children:[po("strong",{children:[n,": "]}),e.message,e.moreInfoURL&&po("div",{className:"toast-message__link",children:po("a",{href:e.moreInfoURL,onClick:e=>e.stopPropagation(),target:"_new",children:"More info"})})]})]})})}var hm=ri((function({toastMessenger:e}){return po("div",{children:po("ul",{"aria-live":"polite","aria-relevant":"additions",className:"ToastMessages",children:ii().getToastMessages().map((t=>po(um,{message:t,onDismiss:t=>e.dismiss(t)},t.id)))})})}),["toastMessenger"]);function dm(e){return e.organization&&e.organization.name}function pm(e){const t={};return e.forEach((e=>{if("object"!=typeof e.organization)return;const n="__default__"===(r=e.organization).id?"__default__":`${r.name.toLowerCase()}${r.id}`;var r;void 0===t[n]&&(t[n]=Object.assign({},e.organization),t[n].groups=[]),function(e,t){const n=Object.assign({},e),r=t.groups
|
|
576
|
+
;!r.length&&e.organization.logo&&(n.logo=e.organization.logo),r.push(n)}(e,t[n])})),t}function mm(e){const t=pm(e),n=[],r=[];return Object.keys(t).sort().forEach((e=>{"__default__"===e?n.push(...t[e].groups):r.push(...t[e].groups)})),n.length&&r.push(...n),r}function fm({heading:e,children:t}){return po(m,{children:[e&&po("h2",{className:"MenuSection__heading",children:e}),po("ul",{className:"MenuSection__content",children:x(t).map((e=>po("li",{children:e},e.key)))})]})}var gm=ri((function({isExpanded:e,group:t,groups:n,onExpand:r,toastMessenger:o}){const i=t.links.html,a=i||t.canLeave,s=t.scopes&&!t.scopes.enforced||t.isScopedToUri,l=ii(),c=l.focusedGroupId(),u=t.id===c,h=t=>{t.stopPropagation(),t.preventDefault(),r(!e)},d="private"===t.type?"Copy invite link":"Copy activity link";return po(Wd,{icon:t.logo||"blank",iconAlt:dm(t),isDisabled:!s,isExpanded:!!a&&e,isSelected:u,isSubmenuVisible:a?e:void 0,label:t.name,onClick:s?()=>{l.clearDirectLinkedGroupFetchFailed(),l.clearDirectLinkedIds(),n.focus(t.id)}:h,
|
|
577
|
+
onToggleSubmenu:h,submenu:po(m,{children:[po("ul",{children:[i&&po("li",{children:po(Wd,{href:i,icon:"external",isSubmenuItem:!0,label:"View group activity"})}),i&&po("li",{children:po(Wd,{onClick:()=>(e=>{try{wa(e),o.success(`Copied link for "${t.name}"`)}catch(e){o.error("Unable to copy link")}})(i),icon:"copy",isSubmenuItem:!0,label:d})}),t.canLeave&&po("li",{children:po(Wd,{icon:"leave",isSubmenuItem:!0,label:"Leave group",onClick:async()=>{const e=`Are you sure you want to leave the group "${t.name}"?`;await Xo({title:"Leave group?",message:e,confirmAction:"Leave"})&&n.leave(t.id)}})})]}),!s&&po("p",{className:"GroupListItem__footer",children:"This group is restricted to specific URLs."})]})})}),["groups","toastMessenger"]);function vm({expandedGroup:e,onExpandGroup:t,groups:n,heading:r}){return po(fm,{heading:r,children:n.map((n=>po(gm,{isExpanded:n===e,onExpand:e=>t(e?n:null),group:n},n.id)))})}var ym=ri((function({settings:e}){
|
|
578
|
+
const t=ii(),n=t.getCurrentlyViewingGroups(),r=t.getFeaturedGroups(),o=t.getMyGroups(),i=t.focusedGroup(),a=t.profile().userid,s=no((()=>mm(o)),[o]),l=no((()=>mm(r)),[r]),c=no((()=>mm(n)),[n]),u=t.defaultAuthority(),h=a&&!Qo(a,u),d=t.getLink("groups.new"),[p,m]=Zr(null);let f;if(i){const t=i.organization.logo||function(e){const t=P(e);return t&&t.icon?t.icon:null}(e)||"",n=dm(i)?dm(i):"";f=po("span",{className:"GroupList__menu-label",children:[t&&po("img",{className:"GroupList__menu-icon",src:t,alt:n}),i.name]})}else f=po("span",{children:"…"});return!!$p(e)&&n.length+r.length+o.length<2?f:po(Gd,{align:"left",contentClass:"GroupList__content",label:f,onOpenChanged:()=>m(null),title:i?`Select group (now viewing: ${i.name})`:"Select group",children:[c.length>0&&po(vm,{expandedGroup:p,onExpandGroup:m,heading:"Currently Viewing",groups:c}),l.length>0&&po(vm,{expandedGroup:p,onExpandGroup:m,heading:"Featured Groups",groups:l}),s.length>0&&po(vm,{expandedGroup:p,onExpandGroup:m,heading:"My Groups",groups:s
|
|
579
|
+
}),h&&po(Wd,{icon:"add",href:d,label:"New private group"})]})}),["settings"]);function _m({alwaysExpanded:e,query:t,onSearch:n}){const r=ii().isLoading(),o=to(),[i,a]=Zr(t),[s,l]=Zr(t);return t!==i&&(l(t),a(t)),po("form",{action:"#",className:"SearchInput__form",name:"searchForm",onSubmit:e=>{e.preventDefault(),(o.current.value||i)&&n(o.current.value)},children:[po("input",{"aria-label":"Search",className:qr("SearchInput__input",{"is-expanded":e||t}),dir:"auto",type:"text",name:"query",placeholder:r?"Loading…":"Search…",disabled:r,ref:o,value:s||"",onInput:e=>l(e.target.value)}),!r&&po("div",{className:"SearchInput__button-container",children:po(_o,{icon:"search",onClick:()=>o.current.focus(),size:"small",title:"Search annotations"})}),r&&po("div",{style:"margin:0.5em 0",children:po(Uo,{size:"small"})})]})}function bm(){const e=ii(),t=e.sortKey(),n=e.sortKeys().map((n=>po(Wd,{label:n,onClick:()=>e.setSortKey(n),isSelected:n===t},n))),r=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"sort",
|
|
580
|
+
classes:"TopBar__menu-icon"})});return po("div",{className:"SortMenu",children:po(Gd,{label:r,title:`Sort by ${t}`,align:"right",menuIndicator:!1,children:n})})}var wm=ri((function({router:e}){return po(_m,{query:ii().routeParams().q,onSearch:t=>{e.navigate("stream",{q:t})},alwaysExpanded:!0})}),["router"]);var xm=ri((function({auth:e,frameSync:t,onLogout:n,settings:r}){const o=ii(),i=o.defaultAuthority(),a=Qo(e.userid,i),s=P(r),l=o.isFeatureEnabled("notebook_launch"),[c,u]=Zr(!1),h=e=>s&&!!s[e],d=!a||h("onProfileRequestProvided"),p=!a||h("onLogoutRequestProvided"),m=()=>{t.notifyHost("openNotebook",o.focusedGroupId())},f=()=>a&&t.notifyHost("profileRequested"),g=(()=>{const t={};return d&&(a||(t.href=o.getLink("user",{user:e.username})),t.onClick=f),t})(),v=po("span",{className:"TopBar__menu-label",children:po(Mo,{name:"profile",classes:"TopBar__menu-icon"})});return po("div",{className:"UserMenu",onKeyDown:e=>{"n"===e.key&&(m(),u(!1))},children:po(Gd,{label:v,title:e.displayName,align:"right",open:c,
|
|
581
|
+
onOpenChanged:u,children:[po(fm,{children:[po(Wd,{label:e.displayName,isDisabled:!d,...g}),!a&&po(Wd,{label:"Account settings",href:o.getLink("account.settings")}),l&&po(Wd,{label:"Open notebook",onClick:()=>m()})]}),p&&po(fm,{children:po(Wd,{label:"Log out",onClick:n})})]})})}),["frameSync","settings"]);var km=ri((function({auth:e,frameSync:t,isSidebar:n,onLogin:r,onLogout:o,onSignUp:i,settings:a,streamer:s}){const l=!$p(a),c=ti(["accentColor"],a),u=ii(),h=u.filterQuery(),d=u.pendingUpdateCount(),p=u.isSidebarPanelOpen("help"),f=u.isSidebarPanelOpen("shareGroupAnnotations"),g=()=>{const e=P(a);e&&e.onHelpRequestProvided?t.notifyHost("helpRequested"):u.toggleSidebarPanel("help")},v=po(m,{children:["unknown"===e.status&&po("span",{className:"TopBar__login-links",children:"⋯"}),"logged-out"===e.status&&po("span",{className:"TopBar__login-links text-lg font-medium hyp-u-horizontal-spacing--2",children:[po(wo,{classes:"InlineLinkButton",onClick:i,style:c,variant:"primary",children:"Sign up"}),po("div",{
|
|
582
|
+
children:"/"}),po(wo,{classes:"InlineLinkButton",onClick:r,style:c,variant:"primary",children:"Log in"})]}),"logged-in"===e.status&&po(xm,{auth:e,onLogout:o})]});return po("div",{className:"TopBar",children:[!n&&po("div",{className:"TopBar__inner content",children:[po(wm,{}),po("div",{className:"hyp-u-stretch"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]}),n&&po("div",{className:"TopBar__inner content",children:[po(ym,{}),po("div",{className:"hyp-u-stretch"}),d>0&&po(_o,{icon:"refresh",onClick:()=>s.applyPendingUpdates(),size:"small",variant:"primary",title:`Show ${d} new/updated ${1===d?"annotation":"annotations"}`}),po(_m,{query:h||null,onSearch:u.setFilterQuery}),po(bm,{}),l&&po(_o,{icon:"share",expanded:f,onClick:()=>{u.toggleSidebarPanel("shareGroupAnnotations")},size:"small",title:"Share annotations on this page"}),po(_o,{icon:"help",expanded:p,onClick:g,size:"small",title:"Help"}),v]})]})}),["frameSync","settings","streamer"])
|
|
583
|
+
;var Sm=ri((function({auth:e,frameSync:t,settings:n,session:r,toastMessenger:o}){const i=ii(),a=i.hasFetchedProfile(),s=i.profile(),l=i.route(),c=no((()=>a?function(e){const t=Zo(e.userid);if(t&&e.userid){let n=t.username;return e.user_info&&e.user_info.display_name&&(n=e.user_info.display_name),{status:"logged-in",displayName:n,userid:e.userid,username:t.username}}return{status:"logged-out"}}(s):{status:"unknown"}),[a,s]),u=no((()=>ti(["appBackgroundColor"],n)),[n]),h="clean"===n.theme,d="sidebar"===l;Qr((()=>{(function(e,t,n){const r="object"==typeof t.preferences&&!!t.preferences.show_sidebar_tutorial,o=P(n)||{onHelpRequestProvided:!1};return e&&!o.onHelpRequestProvided&&r})(d,s,n)&&i.openSidebarPanel("help")}),[d,s,n,i]);const p=async()=>{if(P(n))t.notifyHost("loginRequested");else try{await e.login(),i.closeSidebarPanel("loginPrompt"),i.clearGroups(),r.reload()}catch(e){o.error(e.message)}},m=()=>{P(n)?t.notifyHost("signupRequested"):window.open(i.getLink("signup"))};return po("div",{
|
|
584
|
+
className:qr("HypothesisApp","js-thread-list-scroll-root",{"theme-clean":h,"HypothesisApp--notebook":"notebook"===l}),style:u,children:["notebook"!==l&&po(km,{auth:c,onLogin:p,onSignUp:m,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?"),Xo({title:"Discard drafts?",message:t,confirmAction:"Discard"})})()&&(i.clearGroups(),i.removeAnnotations(i.unsavedAnnotations()),i.discardAllDrafts(),P(n)?t.notifyHost("logoutRequested"):r.logout())},isSidebar:d}),po("div",{className:"HypothesisApp__content",children:[po(hm,{}),po(Xp,{auth:"logged-in"===c.status?c:{}}),po(cm,{}),l&&po("main",{children:["annotation"===l&&po(kp,{onLogin:p}),"notebook"===l&&po(lm,{}),"stream"===l&&po(qp,{}),"sidebar"===l&&po(Hp,{onLogin:p,onSignUp:m})]})]})]})}),["auth","frameSync","session","settings","toastMessenger"])
|
|
585
|
+
;function Cm({error:e}){return po("div",{className:"LaunchErrorPanel",children:po(Ho,{title:"Unable to start Hypothesis",children:e.message})})}class Am{constructor(e,t){this._api=e,this._store=t}_applyDraftChanges(e){const t={},n=this._store.getDraft(e);return n&&(t.tags=n.tags,t.text=n.text,t.permissions=n.isPrivate?ga(e.user):va(e.user,e.group)),{...e,...t}}_initialize(e,t=new Date){const n=this._store.getDefault("annotationPrivacy"),r=this._store.focusedGroupId(),o=this._store.profile();if(!r)throw new Error("Cannot create annotation without a group");const i=o.userid,a=o.user_info,s="s:"+U(8),l=Object.assign({created:t.toISOString(),group:r,permissions:ya(i,r,n),tags:[],text:"",updated:t.toISOString(),user:i,user_info:a,$tag:s,hidden:!1,links:{},document:{title:""}},e);return Li(l)&&(l.permissions=ga(i)),l}create(e,t=new Date){const n=this._initialize(e,t);this._store.addAnnotations([n]),this._store.deleteNewAndEmptyDrafts(),Li(n)||this._store.createDraft(n,{tags:n.tags,text:n.text,isPrivate:!Ai(n)}),
|
|
586
|
+
zi(n)?this._store.selectTab("note"):Oi(n)&&this._store.selectTab("annotation"),(n.references||[]).forEach((e=>{this._store.setExpanded(e,!0)}))}createPageNote(){const e=this._store.mainFrame();if(!this._store.isLoggedIn())return void this._store.openSidebarPanel("loginPrompt");if(!e)return;const t={target:[],uri:e.uri};this.create(t)}async delete(e){await this._api.annotation.delete({id:e.id}),this._store.removeAnnotations([e])}async flag(e){await this._api.annotation.flag({id:e.id}),this._store.updateFlagStatus(e.id,!0)}reply(e,t){const n={group:e.group,permissions:Ai(e)?va(t,e.group):ga(t),references:(e.references||[]).concat(e.id),target:[{source:e.target[0].source}],uri:e.uri};this.create(n)}async save(e){let t;const n=this._applyDraftChanges(e);let r;t=Si(e)?this._api.annotation.update({id:e.id},n):this._api.annotation.create({},n),this._store.annotationSaveStarted(e);try{r=await t}finally{this._store.annotationSaveFinished(e)}return Object.keys(e).forEach((t=>{"$"===t[0]&&(r[t]=e[t])})),
|
|
587
|
+
this._store.removeDraft(e),this._store.addAnnotations([r]),r}}Am.$inject=["api","store"];class Em 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 Tm(e,t){let n,r;try{n=await fetch(e,t)}catch(t){throw new Em(e,null,t.message)}if(204===n.status)return null;try{r=await n.json()}catch(t){throw new Em(e,n,"Failed to parse response")}var o;if(!n.ok)throw new Em(e,n,null===(o=r)||void 0===o?void 0:o.reason);return r}function Nm(e,t){const n={};for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=":"+r;-1!==e.indexOf(i)?e=e.replace(i,encodeURIComponent(String(o))):n[r]=o}return{url:e,unusedParams:n}}function Lm(e){const t={};for(const n in e)e.hasOwnProperty(n)&&"$"!==n[0]&&(t[n]=e[n]);return t}class Mm{constructor(e,t,n){const r=e.routes();this._clientId=null;const o=()=>this._clientId,i=e=>function(e,t,{getAccessToken:n,getClientId:r,onRequestStarted:o,onRequestFinished:i}){
|
|
588
|
+
return async(a,s)=>{o();try{const[o,l]=await Promise.all([e,n()]),c=function(e,t){let n=e;return t.split(".").forEach((e=>{n=n[e]})),n}(o,t),u={"Content-Type":"application/json","Hypothesis-Client-Version":"1.984.0"};l&&(u.Authorization="Bearer "+l);const h=r();h&&(u["X-Client-Id"]=h);const{url:d,unusedParams:p}=Nm(c.url,a),m=new URL(d);for(let[e,t]of Object.entries(p)){Array.isArray(t)||(t=[t]);for(let n of t)null!=n&&m.searchParams.append(e,n.toString())}return await Tm(m.toString(),{body:s?JSON.stringify(Lm(s)):null,headers:u,method:c.method})}finally{i()}}}(r,e,{getAccessToken:t.getAccessToken,getClientId:o,onRequestStarted:n.apiRequestStarted,onRequestFinished:n.apiRequestFinished});this.search=i("search"),this.annotation={create:i("annotation.create"),delete:i("annotation.delete"),get:i("annotation.read"),update:i("annotation.update"),flag:i("annotation.flag"),hide:i("annotation.hide"),unhide:i("annotation.unhide")},this.group={member:{delete:i("group.member.delete")},read:i("group.read")},this.groups={
|
|
589
|
+
list:i("groups.read")},this.profile={groups:{read:i("profile.groups.read")},read:i("profile.read"),update:i("profile.update")}}setClientId(e){this._clientId=e}}Mm.$inject=["apiRoutes","auth","store"];var zm={};function Om(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Im=Om;Om.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Om.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Om.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime()
|
|
590
|
+
;if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),n),this._options.unref&&this._timer.unref(),!0},Om.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)},Om.prototype.try=function(e){
|
|
591
|
+
console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},Om.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},Om.prototype.start=Om.prototype.try,Om.prototype.errors=function(){return this._errors},Om.prototype.attempts=function(){return this._attempts},Om.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,a=(e[i]||0)+1;e[i]=a,a>=n&&(t=o,n=a)}return t},function(e){var t=Im;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))
|
|
592
|
+
;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){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}}}(zm);var Rm=zm;function Pm(e,t){return new Promise(((n,r)=>{const o=Rm.operation(t);o.attempt((async()=>{try{const t=await e();o.retry(),n(t)}catch(e){o.retry(e)||r(e)}}))}))}function Dm(e){return Pm((()=>Tm(e)))}class Bm{constructor(e){this._apiUrl=e.apiUrl,this._routeCache=null,this._linkCache=null}routes(){
|
|
593
|
+
return this._routeCache||(this._routeCache=Dm(this._apiUrl).then((e=>e.links))),this._routeCache}links(){return this._linkCache||(this._linkCache=this.routes().then((e=>Dm(e.links.url)))),this._linkCache}}Bm.$inject=["settings"];class Fm extends Error{constructor(e,t){super(e),this.cause=t}}class jm{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 Fm("Failed to revoke access token",e)}}authorize(e,t){const n=U(16),r=new Promise(((t,r)=>{e.addEventListener("message",(function o(i){
|
|
594
|
+
"object"==typeof i.data&&i.data.state===n&&("authorization_response"===i.data.type&&t(i.data),"authorization_canceled"===i.data.type&&r(new Error("Authorization window was closed")),e.removeEventListener("message",o))}))})),o=new URL(this.authorizationEndpoint);return 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),t.location=o.toString(),r.then((e=>e.code))}async _formPost(e,t){const n=new URLSearchParams;for(let[e,r]of Object.entries(t))n.set(e,r);n.sort();return Tm(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){throw new Fm("Failed to fetch access token",e)}return{accessToken:t.access_token,expiresAt:Date.now()+1e3*(t.expires_in-10),refreshToken:t.refresh_token}}static openAuthPopupWindow(e){
|
|
595
|
+
const t=`left=${e.screen.width/2-237.5},top=${e.screen.height/2-215},width=475,height=430`,n=e.open("about:blank","Log in to Hypothesis",t);if(!n)throw new Error("Failed to open login window");return n}}class Hm extends Qp{constructor(e,t,n,r,o){let i,a,s;super();const l=(c="token",u=r.apiUrl,new URL(c,u).href);var c,u;function h(){let e=new URL(r.apiUrl).hostname;return e=e.replace(/\./g,"%2E"),`hypothesis.oauth.${e}.token`}function d(e){n.setObject(h(),e)}const p=async()=>{if(s)return s;const e=await t.links();return s=new jm({clientId:r.oauthClientId,authorizationEndpoint:e["oauth.authorize"],revokeEndpoint:e["oauth.revoke"],tokenEndpoint:l}),s},m=()=>{var e;return null===(e=P(r))||void 0===e?void 0:e.grantToken},f=async()=>{if(!a){const e=m();void 0!==e?a=e?p().then((t=>t.exchangeGrantToken(e))).catch((e=>{var t;throw t="You must reload the page to annotate.",o.error(`Hypothesis login lost: ${t}`,{autoDismiss:!1}),e})):Promise.resolve(null):i?(a=(async e=>{const t=await p(),n=await t.exchangeAuthCode(e)
|
|
596
|
+
;return d(n),n})(i),i=null):a=Promise.resolve(function(){const e=n.getObject(h());return e&&"string"==typeof e.accessToken&&"string"==typeof e.refreshToken&&"number"==typeof e.expiresAt?{accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt}:null}())}const e=a,t=await a;if(!t)return null;if(e!==a)return f();if(Date.now()>t.expiresAt){const e=m();return a=(async(e,t)=>{const n=await p();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}return t.persist&&d(r),r})(t.refreshToken,{persist:void 0===e}),f()}return t.accessToken};(()=>{e.addEventListener("storage",(({key:e})=>{e===h()&&(a=null,this.emit("oauthTokensChanged"))}))})(),this.login=async function(){const t=jm.openAuthPopupWindow(e),n=await p(),r=await n.authorize(e,t);i=r,a=null},this.logout=async function(){const[e,t]=await Promise.all([a,p()]);e&&await t.revokeToken(e.accessToken),a=Promise.resolve(null),n.removeItem(h())},this.getAccessToken=f}}
|
|
597
|
+
Hm.$inject=["$window","apiRoutes","localStorage","settings","toastMessenger"];class qm{constructor(e,t){this._annotationsService=e,this._store=t,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),Pm((()=>this._annotationsService.save(t))).catch((()=>{this._failed.add(n)})).finally((()=>{this._saving.delete(n)})))}))}))}isSaving(){return this._saving.size>0}}qm.$inject=["annotationsService","store"];var Um=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;var u=e[c],h=t[c];if(!1===(o=n?n.call(r,u,h,c):void 0)||void 0===o&&u!==h)return!1}return!0};function $m(e,t,n){
|
|
598
|
+
const r=Array.isArray(t),o=()=>r?t.map((e=>e())):t();let i=o();return e((()=>{const e=o();if(r?Um(e,i):e===i)return;const t=i;i=e,n(e,t)}))}class Gm{constructor(e,t){this._frameSync=e,this._store=t}init(){const e=()=>this._store.profile().features;$m(this._store.subscribe,[e,()=>this._store.frames()],(()=>{this._frameSync.notifyHost("featureFlagsUpdated",e()||{})}))}}function Vm(e,t){return!!function(e){if(null===e||"object"!=typeof e)return!1;for(let t of["frame1","frame2","type","requestId"])if("string"!=typeof e[t])return!1;return!0}(e)&&JSON.stringify(e,Object.keys(t).sort())===JSON.stringify(t,Object.keys(t).sort())}Gm.$inject=["frameSync","store"];class Wm{constructor({hostFrame:e,source:t}){this._hostFrame=e,this._source=t,this._listeners=new da}destroy(){this._listeners.removeAll()}async discover(e){let t=!1;if(("guest"===this._source&&"host"===e||"guest"===this._source&&"sidebar"===e||"sidebar"===this._source&&"host"===e||"notebook"===this._source&&"sidebar"===e)&&(t=!0),
|
|
599
|
+
!t)throw new Error("Invalid request of channel/port");const n=U(6);return new Promise(((t,r)=>{const o=()=>{this._hostFrame.postMessage({frame1:this._source,frame2:e,type:"request",requestId:n},"*")},i=setInterval(o,250),a=setTimeout((()=>{clearInterval(i),r(new Error(`Unable to establish ${this._source}-${e} communication channel`))}),2e4),s=this._listeners.add(window,"message",(r=>{const{data:o,ports:l}=r;Vm(o,{frame1:this._source,frame2:e,type:"offer",requestId:n})&&(clearInterval(i),clearTimeout(a),this._listeners.remove(s),t(l[0]))}));o()}))}}function Ym(e,t,n=[],r=-1){e.postMessage({protocol:"frame-rpc",version:"1.0.0",arguments:n,method:t,sequence:r})}class Km{constructor({userAgent:e=navigator.userAgent,currentWindow:t=window}={}){this._port=null,this._methods=new Map,this._sequence=1,this._callbacks=new Map,this._listeners=new da,this._listeners.add(t,"unload",(()=>{this._port&&(Ym(this._port,"close"),t!==t.parent&&function(e){const t=e.match(/\bAppleWebKit\/([0-9]+)\b/)
|
|
600
|
+
;return!!t&&!(parseInt(t[1])<=537)}(e)&&t.parent.postMessage({type:"hypothesisPortClosed"},"*",[this._port]))})),this._pendingCalls=[],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))),e.start(),Ym(e,"connect");for(let[e,t]of this._pendingCalls)this.call(e,...t);this._pendingCalls=[]}destroy(){this._port&&(Ym(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)),Ym(this._port,e,t,n)}_parseMessage({data:e}){return e&&"object"==typeof e?"frame-rpc"!==e.protocol||"1.0.0"!==e.version?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){
|
|
601
|
+
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:"frame-rpc",response:t.sequence,version:"1.0.0"};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 Xm({$tag:e,target:t,uri:n}){return{$tag:e,target:t,uri:n}}function Zm(e,t){const n=e.find((e=>e.uri===t.uri));return n||e.find((e=>null===e.id))}class Jm{constructor(e,t,n){this._window=e,this._annotationsService=t,this._store=n,this._portFinder=new Wm({hostFrame:this._window.parent,source:"sidebar"}),this._listeners=new da,this._hostRPC=new Km,this._guestRPC=new Map,this._nextGuestId=0,this._inFrame=new Set,this._highlightsVisible=!1,this._setupSyncToGuests(),this._setupHostEvents()}_setupSyncToGuests(){let e=0;$m(this._store.subscribe,[()=>this._store.allAnnotations(),()=>this._store.frames()],(([t,n],[r])=>{
|
|
602
|
+
let o=0;const i=new Set,a=[];t.forEach((e=>{ki(e)||(Ai(e)&&++o,i.add(e.$tag),this._inFrame.has(e.$tag)||a.push(e))}));const s=r.filter((e=>!i.has(e.$tag)));if(a.length>0){const e=new Map;for(let t of a){var l;const r=Zm(n,t);if(!r)continue;const o=null!==(l=e.get(r.id))&&void 0!==l?l:[];o.push(t),e.set(r.id,o)}for(let[t,n]of e){const e=this._guestRPC.get(t);e&&e.call("loadAnnotations",n.map(Xm))}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))}))}_connectGuest(e){const t=new Km;++this._nextGuestId;let n=`temp-${this._nextGuestId}`;this._guestRPC.set(n,t),t.on("documentInfoChanged",(e=>{this._guestRPC.delete(n),n=e.frameIdentifier,this._guestRPC.set(n,t),this._store.connectFrame({id:e.frameIdentifier,metadata:e.metadata,uri:e.uri})})),t.on("close",(()=>{
|
|
603
|
+
const e=this._store.frames().find((e=>e.id===n));e&&this._store.destroyFrame(e),t.destroy(),this._guestRPC.delete(n)})),t.on("createAnnotation",(e=>{if(!this._store.isLoggedIn())return this._hostRPC.call("openSidebar"),this._store.openSidebarPanel("loginPrompt"),void this._guestRPC.forEach((t=>t.call("deleteAnnotation",e.$tag)));this._inFrame.add(e.$tag),e.$highlight||this._hostRPC.call("openSidebar"),this._hostRPC.call("showHighlights"),this._annotationsService.create(e)}));let r={};const o=ha((()=>{this._store.updateAnchorStatus(r),r={}}),10);t.on("syncAnchoringStatus",(({$tag:e,$orphan:t})=>{this._inFrame.add(e),r[e]=t?"orphan":"anchored",o()})),t.on("showAnnotations",(e=>{this._store.selectAnnotations(this._store.findIDsForTags(e)),this._store.selectTab("annotation")})),t.on("focusAnnotations",(e=>{this._store.focusAnnotations(e||[])})),t.on("toggleAnnotationSelection",(e=>{this._store.toggleSelectedAnnotations(this._store.findIDsForTags(e))})),t.on("openSidebar",(()=>{this._hostRPC.call("openSidebar")
|
|
604
|
+
})),t.on("closeSidebar",(()=>{this._hostRPC.call("closeSidebar")})),t.connect(e),t.call("setHighlightsVisible",this._highlightsVisible)}_setupHostEvents(){this._hostRPC.on("sidebarOpened",(()=>{this._store.setSidebarOpened(!0)})),this._hostRPC.on("setHighlightsVisible",(e=>{this._highlightsVisible=e,this._guestRPC.forEach((t=>t.call("setHighlightsVisible",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;Vm(t,{frame1:"guest",frame2:"sidebar",type:"offer"})&&this._connectGuest(n[0])}))}notifyHost(e,...t){this._hostRPC.call(e,...t)}focusAnnotations(e){this._store.focusAnnotations(e),this._guestRPC.forEach((t=>t.call("focusAnnotations",e)))}scrollToAnnotation(e){this._guestRPC.forEach((t=>t.call("scrollToAnnotation",e)))}destroy(){this._portFinder.destroy(),this._listeners.removeAll()}}function Qm(e){return Object.keys(e).reduce(((e,t)=>(e[t]=t,e)),{})}Jm.$inject=["$window","annotationsService","store"]
|
|
605
|
+
;const ef={id:"__default__",name:"__DEFAULT__",logo:"data:image/svg+xml;utf8,"+encodeURIComponent(Yo)};const tf=["organization","scopes"];class nf{constructor(e,t,n,r,o,i){this._store=e,this._api=t,this._auth=n,this._settings=o,this._toastMessenger=i,this._serviceConfig=P(o),this._reloadSetUp=!1}_mainURI(){var e,t;return null!==(e=null===(t=this._store.mainFrame())||void 0===t?void 0:t.uri)&&void 0!==e?e: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=>"__world__"!==e.id&&e.isScopedToUri));return o?"__world__"===r||"__world__"===n?e:e.filter((e=>"__world__"!==e.id)):e}_setupAutoReload(){this._reloadSetUp||(this._reloadSetUp=!0,$m(this._store.subscribe,(()=>this._mainURI()),(()=>{this.load()})),$m(this._store.subscribe,[()=>this._store.hasFetchedProfile(),()=>this._store.profile().userid],((e,[t])=>{t&&this.load()})))}
|
|
606
|
+
_addGroupsToStore(e,t){!function(e){e.forEach((e=>{e.organization&&"object"==typeof e.organization||(e.organization=ef)}))}(e);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:tf})}async _loadGroupsForUserAndDocument(){var e;const t=()=>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 n=null;"sidebar"===this._store.route()&&(n=await t()),this._setupAutoReload();const r=this._store.directLinkedAnnotationId();let o=null;r&&(o=this._api.annotation.get({id:r}).catch((()=>null)));const i=this._store.directLinkedGroupId();let a=null;i&&(a=this._fetchGroup(i).then((e=>(this._store.clearDirectLinkedGroupFetchFailed(),e))).catch((()=>(this._store.setDirectLinkedGroupFetchFailed(),
|
|
607
|
+
null))));const s={expand:tf},l=null===(e=this._serviceConfig)||void 0===e?void 0:e.authority;l&&(s.authority=l),n&&(s.document_uri=n);const[c,u,h,d,p]=await Promise.all([this._api.profile.groups.read({expand:tf}),this._api.groups.list(s),this._auth.getAccessToken(),o,a]);p&&!u.some((e=>e.id===p.id))&&u.push(p);let m=null;if(d){m=d.group;const e=c.concat(u).find((e=>e.id===d.group));if(!e)try{const e=await this._fetchGroup(d.group);u.push(e)}catch(e){this._toastMessenger.error("Unable to fetch group for linked annotation")}}const f=null!==h,g=await this._filterGroups(J(c,u,n,this._settings),f,m,i),v=m||i||null;return this._addGroupsToStore(g,v),g}async _loadServiceSpecifiedGroups(e){const t=await this._api.profile.groups.read({expand:tf});let n;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),
|
|
608
|
+
n&&this._toastMessenger.error(`Unable to fetch groups: ${n.message}`,{autoDismiss:!1}),i}async load(){var e;if(null!==(e=this._serviceConfig)&&void 0!==e&&e.groups){let e=[];try{e=await this._serviceConfig.groups}catch(e){this._toastMessenger.error(`Unable to fetch group configuration: ${e.message}`)}return this._loadServiceSpecifiedGroups(e)}return this._loadGroupsForUserAndDocument()}focus(e){const t=this._store.focusedGroupId();this._store.focusGroup(e);const n=this._store.focusedGroupId();if(t!==n&&null!==t&&n){const e=this._store.newAnnotations().filter((e=>!ki(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"})}}nf.$inject=["store","api","auth","session","settings","toastMessenger"];class rf{constructor(e,t,n,r){this._api=e,this._store=t,this._streamer=n,this._streamFilter=r,this._searchClient=null}
|
|
609
|
+
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};this._searchClient=new nm(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=>{
|
|
610
|
+
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}),ki(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),!ki(t)){const e=t.id;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}}rf.$inject=["api","store","streamer","streamFilter"];class of{constructor(){this._store={}}getItem(e){return e in this._store?this._store[e]:null}setItem(e,t){this._store[e]=t}removeItem(e){delete this._store[e]}}class af{constructor(e){
|
|
611
|
+
let t="hypothesis.testKey";try{this._storage=e.localStorage,e.localStorage.setItem(t,t),e.localStorage.getItem(t),e.localStorage.removeItem(t)}catch(e){this._storage=new of}}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)}}af.$inject=["$window"];const sf={annotationPrivacy:"hypothesis.privacy",focusedGroup:"hypothesis.groups.focus"};class lf{constructor(e,t){this._storage=e,this._store=t}init(){Object.keys(sf).forEach((e=>{const t=this._storage.getItem(sf[e]);this._store.setDefault(e,t)})),$m(this._store.subscribe,(()=>this._store.getDefaults()),((e,t)=>{for(let n in e)t[n]!==e[n]&&n in sf&&this._storage.setItem(sf[n],e[n])}))}}lf.$inject=["localStorage","store"];class cf{constructor(e,t){this._window=e,this._store=t,this._didRegisterPopstateListener=!1}currentRoute(){
|
|
612
|
+
const e=this._window.location.pathname.slice(1).split("/"),t=new URLSearchParams(this._window.location.search),n={};for(let[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"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"stream":n="/stream";break;default:throw new Error(`Cannot generate URL for route "${e}"`)}let o=!1;const i=new URLSearchParams;for(let[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()}}
|
|
613
|
+
cf.$inject=["$window","store"];class uf{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}`)}}}uf.$inject=["apiRoutes","store"];class hf{constructor(e,t,n,r,o){var i,a;this._api=t,this._auth=n,this._store=e,this._toastMessenger=o,this._authority=null!==(i=null===(a=P(r))||void 0===a?void 0:a.authority)&&void 0!==i?i:null,this._lastLoad=null,this._lastLoadTime=null,n.on("oauthTokensChanged",(()=>this.reload()))}load(){return(!this._lastLoad||!this._lastLoadTime||Date.now()-this._lastLoadTime>3e5)&&(this._lastLoadTime=Date.now(),this._lastLoad=Pm((()=>{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:{
|
|
614
|
+
show_sidebar_tutorial:!1}});this.update(e)}update(e){const t=this._store.profile(),n=e.userid!==t.userid;return this._store.updateProfile(e),this._lastLoad=Promise.resolve(e),this._lastLoadTime=Date.now(),n&&(e.userid?Cr({id:e.userid}):Cr(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()}}hf.$inject=["store","api","auth","settings","toastMessenger"];class df{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 pf extends Qp{constructor(e){super();const t=[];let n;const r=()=>{for(;t.length>0;){const e=JSON.stringify(t.shift())
|
|
615
|
+
;n.send(e)}};this.close=()=>{n.close(1e3)},this.send=e=>{t.push(e),this.isConnected()&&r()},this.isConnected=()=>n.readyState===WebSocket.OPEN,(()=>{n=new WebSocket(e),n.onopen=e=>{r(),this.emit("open",e)},n.onclose=e=>{if(1e3===e.code||1001===e.code)return void this.emit("close",e);const t=new Error(`WebSocket closed abnormally, code: ${e.code}`);console.warn(t),this.emit("disconnect")},n.onerror=e=>{this.emit("error",e)},n.onmessage=e=>{this.emit("message",e)}})()}}class mf{constructor(e,t,n,r,o){this._auth=n,this._groups=r,this._session=o,this._store=e,this._websocketURL=t.links().then((e=>e.websocket)),this.clientId=U(32),this._socket=null,this._updateImmediately=!0,this._configMessages={},this._reconnectionAttempts=0,this._reconnectSetUp=!1}applyPendingUpdates(){const e=Object.values(this._store.pendingUpdates());e.length&&this._store.addAnnotations(e);const t=Object.keys(this._store.pendingDeletions()).map((e=>({id:e})));t.length&&this._store.removeAnnotations(t),this._store.clearPendingUpdates()}
|
|
616
|
+
_handleSocketError(e,t){K("Error connecting to H push notification service:",t);const n=new URL(e).hostname;-1!==["localhost","127.0.0.1"].indexOf(n)&&K("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})}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 K("Received unsupported notification",t.type)}_sendClientConfig(e){Object.keys(this._configMessages).forEach((t=>{
|
|
617
|
+
this._configMessages[t]&&e.send(this._configMessages[t])}))}setConfig(e,t){var n;this._configMessages[e]=t,null!==(n=this._socket)&&void 0!==n&&n.isConnected()&&this._socket.send(t)}async _reconnect(){var e;const t=await this._websocketURL;if(!t)return;let n,r;null===(e=this._socket)||void 0===e||e.close();try{n=await this._auth.getAccessToken()}catch(e){throw console.error("Failed to fetch token for WebSocket authentication",e),e}if(n){const e=new URL(t);e.searchParams.set("access_token",n),r=e.toString()}else r=t;const o=new pf(r);o.on("open",(()=>{this._reconnectionAttempts=0,this._sendClientConfig(o)})),o.on("disconnect",(()=>{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")})),o.on("error",(e=>this._handleSocketError(t,e))),o.on("message",(e=>this._handleSocketMessage(e))),this._socket=o,this.setConfig("client-id",{
|
|
618
|
+
messageType:"client_id",value:this.clientId}),this.setConfig("auth-check",{type:"whoami",id:1})}async connect(e={}){var t;this._updateImmediately=null===(t=e.applyUpdatesImmediately)||void 0===t||t,this._reconnectSetUp||(this._reconnectSetUp=!0,$m(this._store.subscribe,(()=>this._store.profile().userid),(()=>{this._reconnect()}))),this._socket||await this._reconnect()}}mf.$inject=["store","apiRoutes","auth","groups","session"];class ff{constructor(e){this._storage=e}filter(e,t=null){const n=this._storage.getObject("hypothesis.user.tags.list")||[];let r=0;return n.filter((n=>{if(null!==t&&r>=t)return!1;const o=n.split(/\W+/),i=new RegExp(`^${Z(e)}`,"i");return!(!o.some((e=>e.match(i)))&&!n.match(i))&&(++r,!0)}))}store(e){const t=this._storage.getObject("hypothesis.user.tags.map")||{};e.forEach((e=>{t[e]?(t[e].count+=1,t[e].updated=Date.now()):t[e]={text:e,count:1,updated:Date.now()}})),this._storage.setObject("hypothesis.user.tags.map",t)
|
|
619
|
+
;const n=Object.keys(t).sort(((e,n)=>t[e].count!==t[n].count?t[n].count-t[e].count:e.localeCompare(n)));this._storage.setObject("hypothesis.user.tags.list",n)}}ff.$inject=["localStorage"];class gf{constructor(e){this._store=e}forceVisible(e){e.children.forEach((e=>{this.forceVisible(e)})),e.visible||this._store.setForcedVisible(e.id,!0)}}gf.$inject=["store"];class vf{constructor(e){this._store=e}dismiss(e){const t=this._store.getToastMessage(e);t&&!t.isDismissed&&(this._store.updateToastMessage({...t,isDismissed:!0}),setTimeout((()=>{this._store.removeToastMessage(e)}),500))}_addMessage(e,t,{autoDismiss:n=!0,moreInfoURL:r=""}={}){if(this._store.hasToastMessage(e,t))return;const o=U(10),i={type:e,id:o,message:t,moreInfoURL:r};this._store.addToastMessage({isDismissed:!1,...i}),n&&setTimeout((()=>{this.dismiss(o)}),5e3)}error(e,t){this._addMessage("error",e,t)}success(e,t){this._addMessage("success",e,t)}notice(e,t){this._addMessage("notice",e,t)}}function yf(e,t,n){return t in e?Object.defineProperty(e,t,{
|
|
620
|
+
value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _f(e,t){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 bf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_f(Object(n),!0).forEach((function(t){yf(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wf(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. "}vf.$inject=["store"];var xf="function"==typeof Symbol&&Symbol.observable||"@@observable",kf=function(){return Math.random().toString(36).substring(7).split("").join(".")},Sf={INIT:"@@redux/INIT"+kf(),
|
|
621
|
+
REPLACE:"@@redux/REPLACE"+kf(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+kf()}};function Cf(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Af(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(wf(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(wf(1));return n(Af)(e,t)}if("function"!=typeof e)throw new Error(wf(2));var o=e,i=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(wf(3));return i}function h(e){if("function"!=typeof e)throw new Error(wf(4));if(l)throw new Error(wf(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(wf(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),a=null}}}function d(e){if(!Cf(e))throw new Error(wf(7));if(void 0===e.type)throw new Error(wf(8))
|
|
622
|
+
;if(l)throw new Error(wf(9));try{l=!0,i=o(i,e)}finally{l=!1}for(var t=a=s,n=0;n<t.length;n++){(0,t[n])()}return e}function p(e){if("function"!=typeof e)throw new Error(wf(10));o=e,d({type:Sf.REPLACE})}function m(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(wf(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[xf]=function(){return this},e}return d({type:Sf.INIT}),(r={dispatch:d,subscribe:h,getState:u,replaceReducer:p})[xf]=m,r}function Ef(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var i,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Sf.INIT}))throw new Error(wf(12));if(void 0===n(void 0,{type:Sf.PROBE_UNKNOWN_ACTION()}))throw new Error(wf(13))}))}(n)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var r=!1,o={},s=0;s<a.length;s++){var l=a[s],c=n[l],u=e[l],h=c(u,t);if(void 0===h)throw t&&t.type,
|
|
623
|
+
new Error(wf(14));o[l]=h,r=r||h!==u}return(r=r||a.length!==Object.keys(e).length)?o:e}}function Tf(e,t){return function(){return t(e.apply(this,arguments))}}function Nf(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Lf(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var Mf=Lf();Mf.withExtraArgument=Lf;var zf=Mf;function Of(e,t=[],n=[]){const r={},o={},i={};e.forEach((e=>{e.namespace?(r[e.namespace]=e.initialState(...t),o[e.namespace]=function(e){return(t={},n)=>{const r=e[n.type];if(!r)return t;const o=r(t,n);return Array.isArray(o)?o:{...t,...o}}}(e.reducers),i[e.namespace]={selectors:e.selectors,rootSelectors:e.rootSelectors||{}}):console.warn("Store module does not specify a namespace",e)}));const a=function(){
|
|
624
|
+
for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(wf(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return r=Nf.apply(void 0,i)(n.dispatch),bf(bf({},n),{},{dispatch:r})}}}(...[zf],...n);const s=Af(Ef(o),r,a),l=Object.assign({},...e.map((e=>e.actionCreators))),c=function(e,t){if("function"==typeof e)return Tf(e,t);if("object"!=typeof e||null===e)throw new Error(wf(16));var n={};for(var r in e){var o=e[r];"function"==typeof o&&(n[r]=Tf(o,t))}return n}(l,s.dispatch),u=function(e,t){const n={};return Object.keys(e).forEach((r=>{const{selectors:o,rootSelectors:i={}}=e[r];Object.keys(o).forEach((e=>{if(n[e])throw new Error(`Duplicate selector "${e}"`);n[e]=(...n)=>o[e](t()[r],...n)})),Object.keys(i).forEach((e=>{if(n[e])throw new Error(`Duplicate selector "${e}"`);n[e]=(...n)=>i[e](t(),...n)}))})),n}(i,s.getState)
|
|
625
|
+
;return Object.assign(s,c,u),s}function If(e,t){if(!(e instanceof Function)){const t=e;e=()=>t}return{initialState:e,...t}}function Rf(e){let t=0;return function(n){return function(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 Pf={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");return{...e,activeApiRequests:e.activeApiRequests-1}},ANNOTATION_SAVE_STARTED(e,t){let 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,
|
|
626
|
+
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})},Df=Qm(Pf);const Bf=If({activeAnnotationSaveRequests:[],activeApiRequests:0,activeAnnotationFetches:0,hasFetchedAnnotations:!1,annotationResultCount:null},{reducers:Pf,namespace:"activity",actionCreators:{annotationFetchStarted:function(){return{type:Df.ANNOTATION_FETCH_STARTED}},annotationFetchFinished:function(){return{type:Df.ANNOTATION_FETCH_FINISHED}},annotationSaveStarted:function(e){return{type:Df.ANNOTATION_SAVE_STARTED,annotation:e}},annotationSaveFinished:function(e){return{type:Df.ANNOTATION_SAVE_FINISHED,annotation:e}},apiRequestStarted:function(){return{
|
|
627
|
+
type:Df.API_REQUEST_STARTED}},apiRequestFinished:function(){return{type:Df.API_REQUEST_FINISHED}},setAnnotationResultCount:function(e){return{type:Df.SET_ANNOTATION_RESULT_COUNT,resultCount:e}}},selectors:{hasFetchedAnnotations:function(e){return e.hasFetchedAnnotations},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 Ff=function(e,t){return e===t};function jf(e,t){var n,r,o="object"==typeof t?t:{equalityCheck:t},i=o.equalityCheck,a=void 0===i?Ff:i,s=o.maxSize,l=void 0===s?1:s,c=o.resultEqualityCheck,u=function(e){return function(t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}}(a),h=1===l?(n=u,{get:function(e){return r&&n(r.key,e)?r.value:"NOT_FOUND"},
|
|
628
|
+
put:function(e,t){r={key:e,value:t}},getEntries:function(){return r?[r]:[]},clear:function(){r=void 0}}):function(e,t){var n=[];function r(e){var r=n.findIndex((function(n){return t(e,n.key)}));if(r>-1){var o=n[r];return r>0&&(n.splice(r,1),n.unshift(o)),o.value}return"NOT_FOUND"}return{get:r,put:function(t,o){"NOT_FOUND"===r(t)&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(l,u);function d(){var t=h.get(arguments);if("NOT_FOUND"===t){if(t=e.apply(null,arguments),c){var n=h.getEntries(),r=n.find((function(e){return c(e.value,t)}));r&&(t=r.value)}h.put(arguments,t)}return t}return d.clearCache=function(){return h.clear()},d}function Hf(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return"function"==typeof e?"function "+(e.name||"unnamed")+"()":typeof e})).join(", ")
|
|
629
|
+
;throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+n+"]")}return t}function qf(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var i,a=0,s={memoizeOptions:void 0},l=r.pop();if("object"==typeof l&&(s=l,l=r.pop()),"function"!=typeof l)throw new Error("createSelector expects an output function after the inputs, but received: ["+typeof l+"]");var c=s,u=c.memoizeOptions,h=void 0===u?n:u,d=Array.isArray(h)?h:[h],p=Hf(r),m=e.apply(void 0,[function(){return a++,l.apply(null,arguments)}].concat(d)),f=e((function(){for(var e=[],t=p.length,n=0;n<t;n++)e.push(p[n].apply(null,arguments));return i=m.apply(null,e)}));return Object.assign(f,{resultFunc:l,memoizedResultFunc:m,dependencies:p,lastResult:function(){return i},recomputations:function(){return a},resetRecomputations:function(){return a=0}}),f};return o}var Uf=qf(jf)
|
|
630
|
+
;function $f(e,t){return e.reduce(((e,n)=>t(n)?e+1:e),0)}function Gf(e){const t={};return e.forEach((e=>t[e]=!0)),t}function Vf(e){return Object.keys(e).filter((t=>!0===e[t]))}const Wf={CHANGE_ROUTE:(e,{name:t,params:n})=>({name:t,params:n})},Yf=Qm(Wf);const Kf=If({name:null,params:{}},{namespace:"route",reducers:Wf,actionCreators:{changeRoute:function(e,t={}){return{type:Yf.CHANGE_ROUTE,name:e,params:t}}},selectors:{route:function(e){return e.name},routeParams:function(e){return e.params}}});function Xf(e,t){return e.find((e=>e.id===t))}function Zf(e,t){return e.find((e=>e.$tag===t))}const Jf={ADD_ANNOTATIONS(e,t){const n={},r={},o=[],i=[],a=[];let s=e.nextTag;return t.annotations.forEach((t=>{let i;t.id&&(i=Xf(e.annotations,t.id)),!i&&t.$tag&&(i=Zf(e.annotations,t.$tag)),i?(a.push(Object.assign({},i,t)),t.id&&(n[t.id]=!0),i.$tag&&(r[i.$tag]=!0)):(o.push(function(e,t){let n=e.$orphan;return e.id||(n=!1),Object.assign({},e,{$anchorTimeout:!1,$tag:e.$tag||t,$orphan:n})}(t,"t"+s)),++s)})),
|
|
631
|
+
e.annotations.forEach((e=>{n[e.id]||r[e.$tag]||i.push(e)})),{annotations:o.concat(a).concat(i),nextTag:s}},CLEAR_ANNOTATIONS:()=>({annotations:[],focused:{},highlighted:{}}),FOCUS_ANNOTATIONS:(e,t)=>({focused:Gf(t.focusedTags)}),HIDE_ANNOTATION:(e,t)=>({annotations:e.annotations.map((e=>e.id!==t.id?e:{...e,hidden:!0}))}),HIGHLIGHT_ANNOTATIONS:(e,t)=>({highlighted:t.highlighted}),REMOVE_ANNOTATIONS:(e,t)=>({annotations:[...t.remainingAnnotations]}),UNHIDE_ANNOTATION:(e,t)=>({annotations:e.annotations.map((e=>e.id!==t.id?e:Object.assign({},e,{hidden:!1})))}),UPDATE_ANCHOR_STATUS:(e,t)=>({annotations:e.annotations.map((e=>{if(!t.statusUpdates.hasOwnProperty(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){
|
|
632
|
+
const e=t.isFlagged?1:-1;n.moderation={...n.moderation,flagCount:n.moderation.flagCount+e}}return n}return e}))})},Qf=Qm(Jf);function eg(e){return(t,n)=>{const r=function(e,t){const n={},r={};return t.forEach((e=>{e.id&&(n[e.id]=!0),e.$tag&&(r[e.$tag]=!0)})),e.filter((e=>!(e.id&&e.id in n||e.$tag&&e.$tag in r)))}(n().annotations.annotations,e);t({type:Qf.REMOVE_ANNOTATIONS,annotationsToRemove:e,remainingAnnotations:r})}}function tg(e){return{type:Qf.UPDATE_ANCHOR_STATUS,statusUpdates:e}}const ng=If({annotations:[],focused:{},highlighted:{},nextTag:1},{namespace:"annotations",reducers:Jf,actionCreators:{addAnnotations:function(e){return function(t,n){const r=e.filter((e=>!e.id||!Xf(n().annotations.annotations,e.id)));if(t({type:Qf.ADD_ANNOTATIONS,annotations:e,currentAnnotationCount:n().annotations.annotations.length}),"sidebar"!==Kf.selectors.route(n().route))return;const o=r.filter(Ti).map((e=>e.id));o.length>0&&setTimeout((()=>{
|
|
633
|
+
const e=n().annotations.annotations,r=o.map((t=>t?Xf(e,t):null)).filter((e=>e&&Ti(e))).reduce(((e,t)=>(e[t.$tag]="timeout",e)),{});t(tg(r))}),500)}},clearAnnotations:function(){return{type:Qf.CLEAR_ANNOTATIONS}},focusAnnotations:function(e){return{type:Qf.FOCUS_ANNOTATIONS,focusedTags:e}},hideAnnotation:function(e){return{type:Qf.HIDE_ANNOTATION,id:e}},highlightAnnotations:function(e){return{type:Qf.HIGHLIGHT_ANNOTATIONS,highlighted:Gf(e)}},removeAnnotations:eg,unhideAnnotation:function(e){return{type:Qf.UNHIDE_ANNOTATION,id:e}},updateAnchorStatus:tg,updateFlagStatus:function(e,t){return{type:Qf.UPDATE_FLAG_STATUS,id:e,isFlagged:t}}},selectors:{allAnnotations:function(e){return e.annotations},annotationCount:Uf((e=>e.annotations),(e=>$f(e,Oi))),annotationExists:function(e,t){return e.annotations.some((e=>e.id===t))},findAnnotationByID:function(e,t){return Xf(e.annotations,t)},findIDsForTags:function(e,t){const n=[];return t.forEach((t=>{const r=Zf(e.annotations,t);r&&r.id&&n.push(r.id)})),n},
|
|
634
|
+
focusedAnnotations:Uf((e=>e.focused),(e=>Vf(e))),highlightedAnnotations:Uf((e=>e.highlighted),(e=>Vf(e))),isAnnotationFocused:function(e,t){return!0===e.focused[t]},isWaitingToAnchorAnnotations:Uf((e=>e.annotations),(e=>e.some(Ti))),newAnnotations:Uf((e=>e.annotations),(e=>e.filter((e=>Ci(e)&&!Li(e))))),newHighlights:Uf((e=>e.annotations),(e=>e.filter((e=>Ci(e)&&Li(e))))),noteCount:Uf((e=>e.annotations),(e=>$f(e,zi))),orphanCount:Uf((e=>e.annotations),(e=>$f(e,Mi))),savedAnnotations:function(e){return e.annotations.filter((e=>Si(e)))}}}),rg={SET_DEFAULT:function(e,t){return{[t.defaultKey]:t.value}}},og=Qm(rg);const ig=If({annotationPrivacy:null,focusedGroup:null},{namespace:"defaults",reducers:rg,actionCreators:{setDefault:function(e,t){return{type:og.SET_DEFAULT,defaultKey:e,value:t}}},selectors:{getDefault:function(e,t){return e[t]},getDefaults:function(e){return e}}});const ag={UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED:(e,t)=>({directLinkedGroupFetchFailed:t.directLinkedGroupFetchFailed}),
|
|
635
|
+
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:function(){return{directLinkedAnnotationId:null,directLinkedGroupId:null,directLinkedGroupFetchFailed:!1}}},sg=Qm(ag);const lg=If((function(e){return{directLinkedGroupId:e.group||null,directLinkedAnnotationId:e.annotations||null,directLinkedGroupFetchFailed:!1}}),{namespace:"directLinked",reducers:ag,actionCreators:{setDirectLinkedGroupFetchFailed:function(){return{type:sg.UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED,directLinkedGroupFetchFailed:!0}},setDirectLinkedGroupId:function(e){return{type:sg.UPDATE_DIRECT_LINKED_GROUP_ID,directLinkedGroupId:e}},setDirectLinkedAnnotationId:function(e){return{type:sg.UPDATE_DIRECT_LINKED_ANNOTATION_ID,directLinkedAnnotationId:e}},clearDirectLinkedGroupFetchFailed:function(){return{
|
|
636
|
+
type:sg.UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED,directLinkedGroupFetchFailed:!1}},clearDirectLinkedIds:function(){return{type:sg.CLEAR_DIRECT_LINKED_IDS}}},selectors:{directLinkedAnnotationId:function(e){return e.directLinkedAnnotationId},directLinkedGroupFetchFailed:function(e){return e.directLinkedGroupFetchFailed},directLinkedGroupId:function(e){return e.directLinkedGroupId}}});class cg{constructor(e,t){this.annotation={id:e.id,$tag:e.$tag},this.isPrivate=t.isPrivate,this.tags=t.tags,this.text=t.text}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}}const ug={DISCARD_ALL_DRAFTS:function(){return[]},REMOVE_DRAFT:function(e,t){return e.filter((e=>!e.match(t.annotation)))},UPDATE_DRAFT:function(e,t){const n=e.filter((e=>!e.match(t.draft.annotation)));return n.push(t.draft),n}},hg=Qm(ug);function dg(e){return{type:hg.REMOVE_DRAFT,annotation:e}}function pg(e,t){const n=e
|
|
637
|
+
;for(let e=0;e<n.length;e++){const r=n[e];if(r.match(t))return r}return null}function mg(e,t){const n=pg(e,t);return n?n.isEmpty()?null:n:null}const fg=Uf((e=>e),(e=>e.filter((e=>!e.annotation.id)).map((e=>e.annotation)))),gg=If([],{namespace:"drafts",reducers:ug,actionCreators:{createDraft:function(e,t){return{type:hg.UPDATE_DRAFT,draft:new cg(e,t)}},deleteNewAndEmptyDrafts:function(){return(e,t)=>{const n=t().drafts.filter((e=>Ci(e.annotation)&&!mg(t().drafts,e.annotation))).map((t=>(e(dg(t.annotation)),t.annotation)));e(eg(n))}},discardAllDrafts:function(){return{type:hg.DISCARD_ALL_DRAFTS}},removeDraft:dg},selectors:{countDrafts:function(e){return e.length},getDraft:pg,getDraftIfNotEmpty:mg,unsavedAnnotations:fg}});function vg(e){var t,n;return!!(null!==(t=e.user)&&void 0!==t&&t.username||null!==(n=e.user)&&void 0!==n&&n.userid)}function yg(e){if(!vg(e))return{};const t=e.user.username||e.user.userid||"";return{user:{value:t,display:e.user.displayName||t}}}const _g={CHANGE_FOCUS_MODE_USER:function(e,t){
|
|
638
|
+
return{focusActive:vg({user:t.user}),focusFilters:yg({user:t.user})}},SET_FILTER:function(e,t){var n;const r={...e.filters,[t.filterName]:t.filterOption};return""===(null===(n=t.filterOption)||void 0===n?void 0:n.value)&&delete r[t.filterName],{filters:r}},SET_FILTER_QUERY:function(e,t){return{query:t.query}},SET_FOCUS_MODE:function(e,t){var n;return{focusActive:null!==(n=t.active)&&void 0!==n?n:!e.focusActive}},CLEAR_SELECTION:function(){return{filters:{},focusActive:!1,query:null}}},bg=Qm(_g);const wg=Uf((e=>e.focusActive),(e=>e.focusFilters),((e,t)=>{var n;return{active:e,configured:!(null==t||!t.user),displayName:(null==t||null===(n=t.user)||void 0===n?void 0:n.display)||""}})),xg=Uf((e=>e.filters),(e=>e.focusActive),(e=>e.focusFilters),((e,t,n)=>t?{...n,...e}:{...e}));const kg=Uf((e=>xg(e)),(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].value)),t}));const Sg=If((function(e){const t=e.focus||{};return{filters:{},focusActive:vg(t),focusFilters:yg(t),query:e.query||null}}),{namespace:"filters",
|
|
639
|
+
reducers:_g,actionCreators:{changeFocusModeUser:function(e){return{type:bg.CHANGE_FOCUS_MODE_USER,user:e}},setFilter:function(e,t){return(n,r)=>{var o;null!==(o=r().filters.focusFilters)&&void 0!==o&&o[e]&&n({type:bg.SET_FOCUS_MODE,active:!1}),n({type:bg.SET_FILTER,filterName:e,filterOption:t})}},setFilterQuery:function(e){return{type:bg.SET_FILTER_QUERY,query:e}},toggleFocusMode:function(e){return{type:bg.SET_FOCUS_MODE,active:e}}},selectors:{filterQuery:function(e){return e.query},focusState:wg,getFilter:function(e,t){return xg(e)[t]},getFilters:xg,getFilterValues:kg,getFocusFilters:function(e){return e.focusFilters},hasAppliedFilter:function(e){return!(!e.query&&!Object.keys(xg(e)).length)}}}),Cg={CONNECT_FRAME:function(e,t){return[...e,t.frame]},DESTROY_FRAME:function(e,t){return e.filter((e=>e!==t.frame))},UPDATE_FRAME_ANNOTATION_FETCH_STATUS:function(e,t){return e.map((e=>e.uri&&e.uri===t.uri?Object.assign({},e,{isAnnotationFetchComplete:t.isAnnotationFetchComplete}):e))}},Ag=Qm(Cg)
|
|
640
|
+
;const Eg=Uf((e=>e),(e=>e.find((e=>!e.id))||null));const Tg=qf(jf,Um)((e=>e.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)),Ng=If([],{namespace:"frames",reducers:Cg,actionCreators:{connectFrame:function(e){return{type:Ag.CONNECT_FRAME,frame:e}},destroyFrame:function(e){return{type:Ag.DESTROY_FRAME,frame:e}},updateFrameAnnotationFetchStatus:function(e,t){return{type:Ag.UPDATE_FRAME_ANNOTATION_FETCH_STATUS,isAnnotationFetchComplete:t,uri:e}}},selectors:{frames:function(e){return e},mainFrame:Eg,searchUris:Tg}}),Lg={features:{},preferences:{},userid:null};const Mg={UPDATE_PROFILE:function(e,t){return{profile:{...t.profile}}}},zg=Qm(Mg);const Og=If((function(e){var t;return{defaultAuthority:null!==(t=null==e?void 0:e.authDomain)&&void 0!==t?t:"",profile:Lg}}),{namespace:"session",reducers:Mg,
|
|
641
|
+
actionCreators:{updateProfile:function(e){return{type:zg.UPDATE_PROFILE,profile:e}}},selectors:{defaultAuthority:function(e){return e.defaultAuthority},hasFetchedProfile:function(e){return e.profile!==Lg},isFeatureEnabled:function(e,t){return!!e.profile.features[t]},isLoggedIn:function(e){return null!==e.profile.userid},profile:function(e){return e.profile}}}),Ig={FILTER_GROUPS(e,t){var n;if(null===(n=t.filteredGroupIds)||void 0===n||!n.length)return{filteredGroupIds:null};const r=e.groups.filter((e=>t.filteredGroupIds.includes(e.id)));if(!r.length)return{filteredGroupIds:null};let o=e.focusedGroupId;return o&&t.filteredGroupIds.includes(o)||(o=r[0].id),{filteredGroupIds:t.filteredGroupIds,focusedGroupId:o}},FOCUS_GROUP(e,t){const n=e.groups.find((e=>e.id===t.id));return n?{focusedGroupId:t.id}:(console.error(`Attempted to focus group ${t.id} which is not loaded`),{})},LOAD_GROUPS(e,t){const n=t.groups;let r=e.focusedGroupId
|
|
642
|
+
;return null!==e.focusedGroupId&&n.find((t=>t.id===e.focusedGroupId))||(r=n.length>0?n[0].id:null),{focusedGroupId:r,groups:t.groups}},CLEAR_GROUPS:()=>({filteredGroupIds:null,focusedGroupId:null,groups:[]})},Rg=Qm(Ig);function Pg(e){return e.filteredGroupIds?e.groups.filter((t=>{var n;return null===(n=e.filteredGroupIds)||void 0===n?void 0:n.includes(t.id)})):e.groups}function Dg(e,t){return e.groups.find((e=>e.id===t))}const Bg=Uf((e=>Pg(e)),(e=>e.filter((e=>!e.isMember&&e.isScopedToUri)))),Fg=Uf((e=>Pg(e)),(e=>e.filter((e=>e.isScopedToUri)))),jg=Uf((e=>Pg(e.groups)),(e=>Og.selectors.isLoggedIn(e.session)),((e,t)=>t?e.filter((e=>e.isMember)):[])),Hg=Uf((e=>Pg(e.groups)),(e=>jg(e)),(e=>Bg(e.groups)),((e,t,n)=>e.filter((e=>!t.includes(e)&&!n.includes(e))))),qg=If({filteredGroupIds:null,groups:[],focusedGroupId:null},{namespace:"groups",reducers:Ig,actionCreators:{filterGroups:function(e){return{type:Rg.FILTER_GROUPS,filteredGroupIds:e}},focusGroup:function(e){return{type:Rg.FOCUS_GROUP,id:e}},
|
|
643
|
+
loadGroups:function(e){return{type:Rg.LOAD_GROUPS,groups:e}},clearGroups:function(){return{type:Rg.CLEAR_GROUPS}}},selectors:{allGroups:function(e){return e.groups},filteredGroups:Pg,filteredGroupIds:function(e){return e.filteredGroupIds},focusedGroup:function(e){return e.focusedGroupId?Dg(e,e.focusedGroupId):null},focusedGroupId:function(e){return e.focusedGroupId},getFeaturedGroups:Bg,getGroup:Dg,getInScopeGroups:Fg},rootSelectors:{getCurrentlyViewingGroups:Hg,getMyGroups:jg}}),Ug={UPDATE_LINKS:(e,t)=>({...t.links})},$g=Qm(Ug);const Gg=If(null,{namespace:"links",reducers:Ug,actionCreators:{updateLinks:function(e){return{type:$g.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}=Nm(r,n),a=Object.keys(i);if(a.length>0)throw new Error(`Unused parameters: ${a.join(", ")}`);return o}}}),Vg={RECEIVE_REAL_TIME_UPDATES:(e,t)=>({pendingUpdates:{...t.pendingUpdates},pendingDeletions:{...t.pendingDeletions}
|
|
644
|
+
}),CLEAR_PENDING_UPDATES:()=>({pendingUpdates:{},pendingDeletions:{}}),ADD_ANNOTATIONS(e,{annotations:t}){const n={...e.pendingUpdates};return t.forEach((e=>delete n[e.id])),{pendingUpdates:n}},REMOVE_ANNOTATIONS(e,{annotationsToRemove:t}){const n={...e.pendingUpdates},r={...e.pendingDeletions};return t.forEach((e=>{delete n[e.id],delete r[e.id]})),{pendingUpdates:n,pendingDeletions:r}},FOCUS_GROUP:()=>({pendingUpdates:{},pendingDeletions:{}})},Wg=Qm(Vg);const Yg=Uf((e=>[e.pendingUpdates,e.pendingDeletions]),(([e,t])=>Object.keys(e).length+Object.keys(t).length));const Kg=If({pendingUpdates:{},pendingDeletions:{}},{namespace:"realTimeUpdates",reducers:Vg,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!==qg.selectors.focusedGroupId(t)&&"sidebar"===Kf.selectors.route(n)||(o[e.id]=e)})),t.forEach((e=>{
|
|
645
|
+
const t=e.id;delete o[t];const n=r().annotations;ng.selectors.annotationExists(n,t)&&(i[t]=!0)})),n({type:Wg.RECEIVE_REAL_TIME_UPDATES,pendingUpdates:o,pendingDeletions:i})}},clearPendingUpdates:function(){return{type:Wg.CLEAR_PENDING_UPDATES}}},selectors:{hasPendingDeletion:function(e,t){return e.pendingDeletions.hasOwnProperty(t)},pendingDeletions:function(e){return e.pendingDeletions},pendingUpdates:function(e){return e.pendingUpdates},pendingUpdateCount:Yg}}),Xg={annotation:"Location",note:"Oldest",orphan:"Location"};function Zg(e){const t={};return e.annotations&&!e.query&&(t[e.annotations]=!0),t}const Jg=(e,t)=>t===e?{}:{selectedTab:e,sortKey:Xg[e]},Qg={CLEAR_SELECTION:function(){return{forcedVisible:{},selected:{}}},SELECT_ANNOTATIONS:function(e,t){return{selected:t.selection}},SELECT_TAB:function(e,t){return Jg(t.tab,e.selectedTab)},SET_EXPANDED:function(e,t){const n={...e.expanded};return n[t.id]=t.expanded,{expanded:n}},SET_FORCED_VISIBLE:function(e,t){return{forcedVisible:{...e.forcedVisible,
|
|
646
|
+
[t.id]:t.visible}}},SET_SORT_KEY:function(e,t){return{sortKey:t.key}},TOGGLE_SELECTED_ANNOTATIONS:function(e,t){const n={...e.selected};return t.toggleIds.forEach((e=>{n[e]=!n[e]})),{selected:n}},ADD_ANNOTATIONS(e,t){const n=t.annotations.filter((e=>!ki(e))),r=$f(t.annotations,zi)===n.length;return 0===t.currentAnnotationCount&&r?Jg("note",e.selectedTab):{}},CHANGE_FOCUS_MODE_USER:function(){return{forcedVisible:{},selected:{}}},SET_FILTER:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FILTER_QUERY:function(){return{forcedVisible:{},selected:{},expanded:{}}},SET_FOCUS_MODE:function(){return{forcedVisible:{},selected:{}}},REMOVE_ANNOTATIONS:function(e,t){let n=e.selectedTab;"orphan"===n&&0===$f(t.remainingAnnotations,Mi)&&(n="annotation");const r=e=>(t.annotationsToRemove.forEach((t=>{t.id&&delete e[t.id],t.$tag&&delete e[t.$tag]})),e);return{...Jg(n,e.selectedTab),expanded:r({...e.expanded}),forcedVisible:r({...e.forcedVisible}),selected:r({...e.selected})}}},ev=Qm(Qg);function tv(e){
|
|
647
|
+
return e.expanded}const nv=Uf((e=>e.forcedVisible),(e=>Vf(e))),rv=Uf((e=>e.selected),(e=>Vf(e).length>0)),ov=Uf((e=>e.selected),(e=>Vf(e)));function iv(e){return e.selectedTab}const av=Uf((e=>e),(e=>({expanded:tv(e),forcedVisible:nv(e),selected:ov(e),sortKey:sv(e),selectedTab:iv(e)})));function sv(e){return e.sortKey}const lv=Uf((e=>e.selectedTab),(e=>{const t=["Newest","Oldest"];return"note"!==e&&t.push("Location"),t})),cv=If((function(e){return{selected:Zg(e),expanded:Zg(e)||{},forcedVisible:{},selectedTab:"annotation",sortKey:Xg.annotation}}),{namespace:"selection",reducers:Qg,actionCreators:{clearSelection:function(){return{type:ev.CLEAR_SELECTION}},selectAnnotations:function(e){return t=>{t({type:ev.CLEAR_SELECTION}),t({type:ev.SELECT_ANNOTATIONS,selection:Gf(e)})}},selectTab:function(e){return{type:ev.SELECT_TAB,tab:e}},setExpanded:function(e,t){return{type:ev.SET_EXPANDED,id:e,expanded:t}},setForcedVisible:function(e,t){return{type:ev.SET_FORCED_VISIBLE,id:e,visible:t}},setSortKey:function(e){return{
|
|
648
|
+
type:ev.SET_SORT_KEY,key:e}},toggleSelectedAnnotations:function(e){return{type:ev.TOGGLE_SELECTED_ANNOTATIONS,toggleIds:e}}},selectors:{expandedMap:tv,forcedVisibleThreads:nv,hasSelectedAnnotations:rv,selectedAnnotations:ov,selectedTab:iv,selectionState:av,sortKey:sv,sortKeys:lv}}),uv={OPEN_SIDEBAR_PANEL:function(e,t){return{activePanelName:t.panelName}},CLOSE_SIDEBAR_PANEL:function(e,t){let n=e.activePanelName;return t.panelName===n&&(n=null),{activePanelName:n}},TOGGLE_SIDEBAR_PANEL:function(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}}},hv=Qm(uv);const dv=If({activePanelName:null},{namespace:"sidebarPanels",reducers:uv,actionCreators:{openSidebarPanel:function(e){return{type:hv.OPEN_SIDEBAR_PANEL,panelName:e}},closeSidebarPanel:function(e){return{type:hv.CLOSE_SIDEBAR_PANEL,panelName:e}},toggleSidebarPanel:function(e,t){return{type:hv.TOGGLE_SIDEBAR_PANEL,panelName:e,panelState:t}}},
|
|
649
|
+
selectors:{isSidebarPanelOpen:function(e,t){return e.activePanelName===t}}}),pv={ADD_MESSAGE:function(e,t){return{messages:e.messages.concat({...t.message})}},REMOVE_MESSAGE:function(e,t){return{messages:e.messages.filter((e=>e.id!==t.id))}},UPDATE_MESSAGE:function(e,t){return{messages:e.messages.map((e=>e.id&&e.id===t.message.id?{...t.message}:e))}}},mv=Qm(pv);const fv=If({messages:[]},{namespace:"toastMessages",reducers:pv,actionCreators:{addToastMessage:function(e){return{type:mv.ADD_MESSAGE,message:e}},removeToastMessage:function(e){return{type:mv.REMOVE_MESSAGE,id:e}},updateToastMessage:function(e){return{type:mv.UPDATE_MESSAGE,message:e}}},selectors:{getToastMessage:function(e,t){return e.messages.find((e=>e.id===t))},getToastMessages:function(e){return e.messages},hasToastMessage:function(e,t,n){return e.messages.some((e=>e.type===t&&e.message===n))}}}),gv={SET_SIDEBAR_OPENED:(e,t)=>!0===t.opened?{sidebarHasOpened:!0}:{}},vv=Qm(gv);const yv=If({sidebarHasOpened:!1},{namespace:"viewer",reducers:gv,
|
|
650
|
+
actionCreators:{setSidebarOpened:function(e){return{type:vv.SET_SIDEBAR_OPENED,opened:e}}},selectors:{hasSidebarOpened:function(e){return e.sidebarHasOpened}}});function _v(e){return Of([Bf,ng,ig,lg,gg,Sg,Ng,Gg,qg,Kg,Kf,cv,Og,dv,fv,yv],[e],[Rf])}_v.$inject=["settings"];class bv{constructor(){this._providers=new Map,this._instances=new Map,this._constructing=new Set}get(e){if(this._instances.has(e))return this._instances.get(e);const t=this._providers.get(e);if(!t)throw new Error(`"${e}" is not registered`);if("value"in t)return this._instances.set(e,t.value),t.value;if(this._constructing.has(e))throw new Error(`Encountered a circular dependency when constructing "${e}"`);this._constructing.add(e);try{const n=[],r="class"in t&&t.class.$inject||"factory"in t&&t.factory.$inject||[];for(const t of r)try{n.push(this.get(t))}catch(n){const r=new Error(`Failed to construct dependency "${t}" of "${e}": ${n.message}`);throw r.cause=n,r}let o;if(t.class)o=new t.class(...n);else{o=(0,t.factory)(...n)}
|
|
651
|
+
return this._instances.set(e,o),o}finally{this._constructing.delete(e)}}register(e,t){if("function"==typeof t)t={class:t};else if(!function(e){return"object"==typeof e&&null!==e&&("value"in e||"function"==typeof e.class||"function"==typeof e.factory)}(t))throw new Error(`Invalid provider for "${e}"`);return this._providers.set(e,t),this}run(e){const t="Injector.run";this.register(t,{factory:e});try{return this.get(t)}finally{this._instances.delete(t),this._providers.delete(t)}}}const wv=function(t){for(var n={},r=t.querySelectorAll("script.js-hypothesis-config"),o=0;o<r.length;o++){var i=void 0;try{i=JSON.parse(r[o].textContent||"")}catch(e){console.warn("Could not parse settings from js-hypothesis-config tags",e),i={}}e(n,i)}return n}(document),xv=function(e){const{version:t,origin:n}=R(e.location.href);return"1.984.0"!==t?(console.warn(`The Hypothesis sidebar is using a different version (1.984.0) than the host page (${t}). It may not work.`),
|
|
652
|
+
!1):"null"===e.origin?(console.warn("Hypothesis has been loaded in a sandboxed frame. This is not supported."),!1):e.origin===n||(console.warn(`The Hypothesis sidebar is running in a different origin (${e.origin}) than expected (${n}). It may not work.`),!1)}(window);function kv(e,t){e.setClientId(t.clientId)}function Sv(e,t,n){e.load(),t.load(),n.sync()}function Cv(e,t,n,r){e.init(),t.init(),n.init(),r.init()}function Av(e,t){"sidebar"===t.route()&&e.connect()}wv.sentry&&xv&&function(e){const t=function(){let e=import.meta.url;return e?new URL(e).origin:null}(),n=t?[t]:void 0;wr({dsn:e.dsn,environment:e.environment,allowUrls:n,ignoreErrors:["Network request failed","Object Not Found Matching Id"],release:"1.984.0",beforeSend:(e,t)=>{if(Sr>=5)return K("Client-side Sentry quota reached. No further Sentry events will be sent"),null;++Sr;try{const n=t&&t.originalException;n instanceof Event&&Object.assign(e.extra,{type:n.type,detail:n.detail,isTrusted:n.isTrusted})}catch(e){}return e}});try{
|
|
653
|
+
Yt("host_config",R(window.location.href))}catch(e){}Yt("loaded_scripts",Array.from(document.querySelectorAll("script")).filter((e=>!e.type||e.type.match(/javascript|module/))).map((e=>e.src||"<inline>"))),kr(((e,t)=>{Wt(e,{tags:{context:t}})}))}(wv.sentry),function(e){e.addEventListener("click",(e=>{const t=e.target;if("A"===t.tagName){const e=t;"_blank"===e.target&&(e.rel="noopener")}}))}(document.body),function(e=n){let t=!1;try{document.createElement("div").dir="auto"}catch(e){t=!0}if(t){const t=e.vnode;e.vnode=e=>{"string"==typeof e.type&&"dir"in e.props&&"auto"===e.props.dir&&(e.props.dir=""),t&&t(e)}}}(),kv.$inject=["api","streamer"],Sv.$inject=["groups","session","router"],Cv.$inject=["autosaveService","features","persistedDefaults","serviceURL"],Av.$inject=["frameSync","store"],function(e,{reset:t=!1}={}){t&&mo.clear();for(let[t,n]of Object.entries(e))mo.set(t,n)}(Ko);const Ev=document.querySelector("hypothesis-app");!function(e=window){e.addEventListener("message",te)}(),async function(e,t=window){
|
|
654
|
+
const n=H(window),r=n.requestConfigFromFrame;if(!r)return V(e,n);if("string"==typeof r)return await G(e,t);if("number"==typeof r.ancestorLevel&&"string"==typeof r.origin){const o=function(e,t=window){let n=t;for(let t=0;t<e;t++){if(n===n.top)throw new Error("The target parent frame has exceeded the ancestor tree. Try reducing the `requestConfigFromFrame.ancestorLevel` value in the `hypothesisConfig`");n=n.parent}return n}(r.ancestorLevel,t);return{...await W(e,o,r.origin),...n.group?{group:n.group}:{}}}throw new Error("Improper `requestConfigFromFrame` object. Both `ancestorLevel` and `origin` need to be specified")}(wv).then((e=>{!function(e,t){const n=new bv
|
|
655
|
+
;n.register("annotationsService",Am).register("api",Mm).register("apiRoutes",Bm).register("auth",Hm).register("autosaveService",qm).register("features",Gm).register("frameSync",Jm).register("groups",nf).register("loadAnnotationsService",rf).register("localStorage",af).register("persistedDefaults",lf).register("router",cf).register("serviceURL",uf).register("session",hf).register("streamer",mf).register("streamFilter",df).register("tags",ff).register("threadsService",gf).register("toastMessenger",vf).register("store",{factory:_v}),n.register("$window",{value:window}).register("settings",{value:e}),n.run(Cv),n.run(kv),n.run(Sv),n.run(ee),n.run(Av),I(po(ni.Provider,{value:n,children:po(Sm,{})}),t)}(e,Ev)})).catch((e=>function(e,t){console.error("Failed to start Hypothesis client: ",e),I(po(Cm,{error:e}),t)}(e,Ev)));
|
|
656
656
|
//# sourceMappingURL=sidebar.bundle.js.map
|