pageproof 0.1.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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/THIRD_PARTY_NOTICES.md +74 -0
  4. package/assets/SKILL.md +58 -0
  5. package/assets/_paged.css +82 -0
  6. package/assets/chicago.csl +6006 -0
  7. package/assets/default.html +496 -0
  8. package/assets/doublespaced.css +8 -0
  9. package/assets/european-journal-of-international-law.csl +404 -0
  10. package/assets/favicon.svg +5 -0
  11. package/assets/footnotes-inline.lua +56 -0
  12. package/assets/latex.css +142 -0
  13. package/assets/msword.css +100 -0
  14. package/assets/numbered.css +75 -0
  15. package/assets/vendor/mathjax/LICENSE +202 -0
  16. package/assets/vendor/mathjax/sre/mathmaps/af.json +146 -0
  17. package/assets/vendor/mathjax/sre/mathmaps/base.json +140 -0
  18. package/assets/vendor/mathjax/sre/mathmaps/ca.json +140 -0
  19. package/assets/vendor/mathjax/sre/mathmaps/da.json +140 -0
  20. package/assets/vendor/mathjax/sre/mathmaps/de.json +146 -0
  21. package/assets/vendor/mathjax/sre/mathmaps/en.json +158 -0
  22. package/assets/vendor/mathjax/sre/mathmaps/es.json +140 -0
  23. package/assets/vendor/mathjax/sre/mathmaps/euro.json +32 -0
  24. package/assets/vendor/mathjax/sre/mathmaps/fr.json +146 -0
  25. package/assets/vendor/mathjax/sre/mathmaps/hi.json +146 -0
  26. package/assets/vendor/mathjax/sre/mathmaps/it.json +146 -0
  27. package/assets/vendor/mathjax/sre/mathmaps/ko.json +146 -0
  28. package/assets/vendor/mathjax/sre/mathmaps/nb.json +146 -0
  29. package/assets/vendor/mathjax/sre/mathmaps/nemeth.json +125 -0
  30. package/assets/vendor/mathjax/sre/mathmaps/nn.json +146 -0
  31. package/assets/vendor/mathjax/sre/mathmaps/sv.json +146 -0
  32. package/assets/vendor/mathjax/sre/speech-worker.js +1 -0
  33. package/assets/vendor/mathjax/tex-mml-chtml-nofont.js +18 -0
  34. package/assets/vendor/mathjax-fonts/LICENSE +202 -0
  35. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-b.woff2 +0 -0
  36. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-bi.woff2 +0 -0
  37. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-brk.woff2 +0 -0
  38. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-c.woff2 +0 -0
  39. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-cb.woff2 +0 -0
  40. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-f.woff2 +0 -0
  41. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-fb.woff2 +0 -0
  42. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-i.woff2 +0 -0
  43. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-lo.woff2 +0 -0
  44. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-m.woff2 +0 -0
  45. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-mi.woff2 +0 -0
  46. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-n.woff2 +0 -0
  47. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-ob.woff2 +0 -0
  48. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-os.woff2 +0 -0
  49. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-s3.woff2 +0 -0
  50. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-s4.woff2 +0 -0
  51. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-so.woff2 +0 -0
  52. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-ss.woff2 +0 -0
  53. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-ssb.woff2 +0 -0
  54. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-ssi.woff2 +0 -0
  55. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-v.woff2 +0 -0
  56. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml/woff2/mjx-tex-zero.woff2 +0 -0
  57. package/assets/vendor/mathjax-fonts/mathjax-tex-font/chtml.js +1 -0
  58. package/assets/vendor/mathjax-fonts/mathjax-tex-font/package.json +88 -0
  59. package/assets/vendor/paged.polyfill.js +33251 -0
  60. package/bin/mdpreview.js +8 -0
  61. package/bin/pageproof.js +8 -0
  62. package/package.json +42 -0
  63. package/src/assets.js +246 -0
  64. package/src/cli.js +166 -0
  65. package/src/lifecycle.js +445 -0
  66. package/src/pandoc.js +346 -0
  67. package/src/server.js +228 -0
  68. package/src/util.js +43 -0
@@ -0,0 +1 @@
1
+ (()=>{var t,e,n={238(t){function e(t){return Promise.resolve().then(()=>{var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e})}e.keys=()=>[],e.resolve=e,e.id=238,t.exports=e},981(t,e){"use strict";function n(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.getOwnPropertyDescriptors&&(t=e.create(null,e.getOwnPropertyDescriptors(t))),e&&"function"==typeof e.freeze?e.freeze(t):t}function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var o=n({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var i=n({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var s=n({script:!1,style:!1,textarea:!0,title:!0});function a(t){return t===c.HTML}var c=n({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),l=Object.keys(c).map(function(t){return c[t]});var u=n({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});e.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var n in e)r(e,n)&&(t[n]=e[n]);return t},e.find=function(t,e,n){if(void 0===n&&(n=Array.prototype),t&&"function"==typeof n.find)return n.find.call(t,e);for(var o=0;o<t.length;o++)if(r(t,o)){var i=t[o];if(e.call(void 0,i,o,t))return i}},e.freeze=n,e.HTML_BOOLEAN_ATTRIBUTES=o,e.HTML_RAW_TEXT_ELEMENTS=s,e.HTML_VOID_ELEMENTS=i,e.hasDefaultHTMLNamespace=function(t){return a(t)||t===c.XML_XHTML_APPLICATION},e.hasOwn=r,e.isHTMLBooleanAttribute=function(t){return r(o,t.toLowerCase())},e.isHTMLRawTextElement=function(t){var e=t.toLowerCase();return r(s,e)&&!s[e]},e.isHTMLEscapableRawTextElement=function(t){var e=t.toLowerCase();return r(s,e)&&s[e]},e.isHTMLMimeType=a,e.isHTMLVoidElement=function(t){return r(i,t.toLowerCase())},e.isValidMimeType=function(t){return l.indexOf(t)>-1},e.MIME_TYPE=c,e.NAMESPACE=u},985(t,e,n){"use strict";var r=n(981),o=n(553),i=n(918),s=n(334),a=n(309),c=o.DOMImplementation,l=r.hasDefaultHTMLNamespace,u=r.isHTMLMimeType,h=r.isValidMimeType,d=r.MIME_TYPE,f=r.NAMESPACE,p=i.ParseError,m=a.XMLReader;function g(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function E(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||r.assign,this.domHandler=t.domHandler||N,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||g,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function N(t){var e=t||{};this.mimeType=e.mimeType||d.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}function S(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function T(t,e,n){return"string"==typeof t?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}function I(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}E.prototype.parseFromString=function(t,e){if(!h(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var n=this.assign(Object.create(null),this.xmlns),o=s.XML_ENTITIES,i=n[""]||null;l(e)?(o=s.HTML_ENTITIES,i=f.HTML):e===d.XML_SVG_IMAGE&&(i=f.SVG),n[""]=i,n.xml=n.xml||f.XML;var a=new this.domHandler({mimeType:e,defaultNamespace:i,onError:this.onError}),c=this.locator?{}:void 0;this.locator&&a.setDocumentLocator(c);var u=new m;return u.errorHandler=a,u.domBuilder=a,!r.isHTMLMimeType(e)&&"string"!=typeof t&&u.errorHandler.fatalError("source is not a string"),u.parse(this.normalizeLineEndings(String(t)),n,o),a.doc.documentElement||u.errorHandler.fatalError("missing root element"),a.doc},N.prototype={startDocument:function(){var t=new c;this.doc=u(this.mimeType)?t.createHTMLDocument(!1):t.createDocument(this.defaultNamespace,"")},startElement:function(t,e,n,r){var o=this.doc,i=o.createElementNS(t,n||e),s=r.length;I(this,i),this.currentElement=i,this.locator&&S(this.locator,i);for(var a=0;a<s;a++){t=r.getURI(a);var c=r.getValue(a),l=(n=r.getQName(a),o.createAttributeNS(t,n));this.locator&&S(r.getLocator(a),l),l.value=l.nodeValue=c,i.setAttributeNode(l)}},endElement:function(t,e,n){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&S(this.locator,n),I(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=T.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(t);else r=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(t)&&this.doc.appendChild(r),this.locator&&S(this.locator,r)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){t&&(t.lineNumber=0),this.locator=t},comment:function(t,e,n){t=T.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&S(this.locator,r),I(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n,r){var o=this.doc.implementation;if(o&&o.createDocumentType){var i=o.createDocumentType(t,e,n,r);this.locator&&S(this.locator,i),I(this,i),this.doc.doctype=i}},reportError:function(t,e){if("function"==typeof this.onError)try{this.onError(t,e,this)}catch(n){throw new p("Reporting "+t+' "'+e+'" caused '+n,this.locator)}else console.error("[xmldom "+t+"]\t"+e,function(t){if(t)return"\n@#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(this.locator))},warning:function(t){this.reportError("warning",t)},error:function(t){this.reportError("error",t)},fatalError:function(t){throw this.reportError("fatalError",t),new p(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){N.prototype[t]=function(){return null}}),e.__DOMHandler=N,e.DOMParser=E,e.normalizeLineEndings=g,e.onErrorStopParsing=function(t){if("error"===t)throw"onErrorStopParsing"},e.onWarningStopParsing=function(){throw"onWarningStopParsing"}},553(t,e,n){"use strict";var r=n(981),o=r.find,i=r.hasDefaultHTMLNamespace,s=r.hasOwn,a=r.isHTMLMimeType,c=r.isHTMLRawTextElement,l=r.isHTMLVoidElement,u=r.MIME_TYPE,h=r.NAMESPACE,d=Symbol(),f=n(918),p=f.DOMException,m=f.DOMExceptionName,g=n(112);function E(t){if(t!==d)throw new TypeError("Illegal constructor")}function N(t){return""!==t}function S(t,e){return s(t,e)||(t[e]=!0),t}function T(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(N):[]}(t);return Object.keys(e.reduce(S,{}))}function I(t){if(!g.QName_exact.test(t))throw new p(p.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+t+'"')}function A(t,e){I(e),t=t||null;var n=null,o=e;if(e.indexOf(":")>=0){var i=e.split(":");n=i[0],o=i[1]}if(null!==n&&null===t)throw new p(p.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===n&&t!==r.NAMESPACE.XML)throw new p(p.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===n||"xmlns"===e)&&t!==r.NAMESPACE.XMLNS)throw new p(p.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===r.NAMESPACE.XMLNS&&"xmlns"!==n&&"xmlns"!==e)throw new p(p.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,n,o]}function b(t,e){for(var n in t)s(t,n)&&(e[n]=t[n])}function R(t,e){var n=t.prototype;if(!(n instanceof e)){function r(){}r.prototype=e.prototype,b(n,r=new r),t.prototype=n=r}n.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),n.constructor=t)}var O={},y=O.ELEMENT_NODE=1,C=O.ATTRIBUTE_NODE=2,L=O.TEXT_NODE=3,M=O.CDATA_SECTION_NODE=4,v=O.ENTITY_REFERENCE_NODE=5,w=O.ENTITY_NODE=6,D=O.PROCESSING_INSTRUCTION_NODE=7,P=O.COMMENT_NODE=8,_=O.DOCUMENT_NODE=9,x=O.DOCUMENT_TYPE_NODE=10,F=O.DOCUMENT_FRAGMENT_NODE=11,U=O.NOTATION_NODE=12,k=r.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function B(t,e){if(e.length<t.length)return B(e,t);var n=null;for(var r in t){if(t[r]!==e[r])return n;n=t[r]}return n}function G(t){return t.guid||(t.guid=Math.random()),t.guid}function V(){}function H(t,e){this._node=t,this._refresh=e,j(this)}function j(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(vt(t,"length",n.length),!t.$$length||n.length<t.$$length)for(var r=n.length;r in t;r++)s(t,r)&&delete t[r];b(n,t),t._inc=e}}function q(){}function $(t,e){for(var n=0;n<t.length;){if(t[n]===e)return n;n++}}function X(t,e,n,r){if(r?e[$(e,r)]=n:(e[e.length]=n,e.length++),t){n.ownerElement=t;var o=t.ownerDocument;o&&(r&&tt(o,t,r),function(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===h.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}(o,t,n))}}function Y(t,e,n){var r=$(e,n);if(r>=0){for(var o=e.length-1;r<=o;)e[r]=e[++r];if(e.length=o,t){var i=t.ownerDocument;i&&tt(i,t,n),n.ownerElement=null}}}function W(){}function K(t){E(t)}function z(t){return("<"==t?"&lt;":">"==t&&"&gt;")||"&"==t&&"&amp;"||'"'==t&&"&quot;"||"&#"+t.charCodeAt()+";"}function Q(t,e){J(t,null,{enter:function(t){return!e(t)||J.STOP}})}function J(t,e,n){for(var r=[{node:t,context:e,phase:J.ENTER}];r.length>0;){var o=r.pop();if(o.phase===J.ENTER){var i=n.enter(o.node,o.context);if(i===J.STOP)return J.STOP;if(r.push({node:o.node,context:i,phase:J.EXIT}),null==i)continue;for(var s=o.node.lastChild;s;)r.push({node:s,context:i,phase:J.ENTER}),s=s.previousSibling}else n.exit&&n.exit(o.node,o.context)}}function Z(t,e){E(t);var n=e||{};this.ownerDocument=this,this.contentType=n.contentType||u.XML_APPLICATION,this.type=a(this.contentType)?"html":"xml"}function tt(t,e,n,r){t&&t._inc++,n.namespaceURI===h.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function et(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n&&!n.nextSibling)r[r.length++]=n;else{for(var o=e.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i,delete r[r.length]}}}function nt(t,e){if(t!==e.parentNode)throw new p(p.NOT_FOUND_ERR,"child's parent is not parent");var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,et(t.ownerDocument,t),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function rt(t){return t&&t.nodeType===K.DOCUMENT_TYPE_NODE}function ot(t){return t&&t.nodeType===K.ELEMENT_NODE}function it(t){return t&&t.nodeType===K.TEXT_NODE}function st(t,e){var n=t.childNodes||[];if(o(n,ot)||rt(e))return!1;var r=o(n,rt);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function at(t,e){var n=t.childNodes||[];if(o(n,function(t){return ot(t)&&t!==e}))return!1;var r=o(n,rt);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function ct(t,e,n){if(!function(t){return t&&(t.nodeType===K.DOCUMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.ELEMENT_NODE)}(t))throw new p(p.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new p(p.NOT_FOUND_ERR,"child not in parent");if(!function(t){return t&&(t.nodeType===K.CDATA_SECTION_NODE||t.nodeType===K.COMMENT_NODE||t.nodeType===K.DOCUMENT_FRAGMENT_NODE||t.nodeType===K.DOCUMENT_TYPE_NODE||t.nodeType===K.ELEMENT_NODE||t.nodeType===K.PROCESSING_INSTRUCTION_NODE||t.nodeType===K.TEXT_NODE)}(e)||rt(e)&&t.nodeType!==K.DOCUMENT_NODE)throw new p(p.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function lt(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===K.DOCUMENT_FRAGMENT_NODE){var s=i.filter(ot);if(s.length>1||o(i,it))throw new p(p.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===s.length&&!st(t,n))throw new p(p.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ot(e)&&!st(t,n))throw new p(p.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){if(o(r,rt))throw new p(p.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=o(r,ot);if(n&&r.indexOf(a)<r.indexOf(n))throw new p(p.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!n&&a)throw new p(p.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function ut(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===K.DOCUMENT_FRAGMENT_NODE){var s=i.filter(ot);if(s.length>1||o(i,it))throw new p(p.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===s.length&&!at(t,n))throw new p(p.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ot(e)&&!at(t,n))throw new p(p.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(rt(e)){function c(t){return rt(t)&&t!==n}if(o(r,c))throw new p(p.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=o(r,ot);if(n&&r.indexOf(a)<r.indexOf(n))throw new p(p.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function ht(t,e,n,r){ct(t,e,n),t.nodeType===K.DOCUMENT_NODE&&(r||lt)(t,e,n);var o=e.parentNode;if(o&&o.removeChild(e),e.nodeType===F){var i=e.firstChild;if(null==i)return e;var s=e.lastChild}else i=s=e;var a=n?n.previousSibling:t.lastChild;i.previousSibling=a,s.nextSibling=n,a?a.nextSibling=i:t.firstChild=i,null==n?t.lastChild=s:n.previousSibling=s;do{i.parentNode=t}while(i!==s&&(i=i.nextSibling));return et(t.ownerDocument||t,t,e),e.nodeType==F&&(e.firstChild=e.lastChild=null),e}function dt(t){E(t),this._nsMap=Object.create(null)}function ft(t){E(t),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function pt(t){E(t)}function mt(t){E(t)}function gt(t){E(t)}function Et(t){E(t)}function Nt(t){E(t)}function St(t){E(t)}function Tt(t){E(t)}function It(t){E(t)}function At(t){E(t)}function bt(t){E(t)}function Rt(){}function Ot(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:null!=t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var n=[],r=this.nodeType===_&&this.documentElement||this,o=r.prefix,i=r.namespaceURI;if(i&&null==o&&null==(o=r.lookupPrefix(i)))var s=[{namespace:i,prefix:null}];return Lt(this,n,s,e),n.join("")}function yt(t,e,n){var r=t.prefix||"",o=t.namespaceURI;if(!o)return!1;if("xml"===r&&o===h.XML||o===h.XMLNS)return!1;for(var i=n.length;i--;){var s=n[i];if(s.prefix===r)return s.namespace!==o}return!0}function Ct(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,z),'"')}function Lt(t,e,n,r){n||(n=[]);var o=r.nodeFilter,i=r.requireWellFormed,s=r.splitCDATASections,a="html"===(t.nodeType===_?t:t.ownerDocument).type;J(t,{ns:n},{enter:function(t,n){var u=n.ns;if(o){if(!(t=o(t)))return null;if("string"==typeof t)return e.push(t),null}switch(t.nodeType){case y:var d=t.attributes,f=d.length,E=t.tagName,N=E;if(!a&&!t.prefix&&t.namespaceURI){for(var S,T=0;T<d.length;T++)if("xmlns"===d.item(T).name){S=d.item(T).value;break}if(!S)for(var I=u.length-1;I>=0;I--){if(""===(A=u[I]).prefix&&A.namespace===t.namespaceURI){S=A.namespace;break}}if(S!==t.namespaceURI)for(I=u.length-1;I>=0;I--){var A;if((A=u[I]).namespace===t.namespaceURI){A.prefix&&(N=A.prefix+":"+E);break}}}e.push("<",N);for(var b=u.slice(),R=0;R<f;R++){"xmlns"==(O=d.item(R)).prefix?b.push({prefix:O.localName,namespace:O.value}):"xmlns"==O.nodeName&&b.push({prefix:"",namespace:O.value})}for(R=0;R<f;R++){var O;if(yt(O=d.item(R),0,b)){var w=O.prefix||"",U=O.namespaceURI;Ct(e,w?"xmlns:"+w:"xmlns",U),b.push({prefix:w,namespace:U})}var k=o?o(O):O;k&&("string"==typeof k?e.push(k):Ct(e,k.name,k.value))}if(E===N&&yt(t,0,b)){var B=t.prefix||"";U=t.namespaceURI;Ct(e,B?"xmlns:"+B:"xmlns",U),b.push({prefix:B,namespace:U})}var G=!t.firstChild;if(G&&(a||t.namespaceURI===h.HTML)&&(G=l(E)),G)return e.push("/>"),null;if(e.push(">"),a&&c(E)){for(var V=t.firstChild;V;)V.data?e.push(V.data):Lt(V,e,b.slice(),r),V=V.nextSibling;return e.push("</",N,">"),null}return{ns:b,tag:N};case _:case F:if(i&&t.nodeType===_&&null==t.documentElement)throw new p("The Document has no documentElement",m.InvalidStateError);return{ns:u};case C:return Ct(e,t.name,t.value),null;case L:if(i&&g.InvalidChar.test(t.data))throw new p("The Text node data contains characters outside the XML Char production",m.InvalidStateError);return e.push(t.data.replace(/[<&>]/g,z)),null;case M:if(i&&-1!==t.data.indexOf("]]>"))throw new p('The CDATASection data contains "]]>"',m.InvalidStateError);return s?e.push(g.CDATA_START,t.data.replace(/]]>/g,"]]]]><![CDATA[>"),g.CDATA_END):e.push(g.CDATA_START,t.data,g.CDATA_END),null;case P:if(i){if(g.InvalidChar.test(t.data))throw new p("The comment node data contains characters outside the XML Char production",m.InvalidStateError);if(-1!==t.data.indexOf("--")||"-"===t.data[t.data.length-1])throw new p('The comment node data contains "--" or ends with "-"',m.InvalidStateError)}return e.push(g.COMMENT_START,t.data,g.COMMENT_END),null;case x:var H=t.publicId,j=t.systemId;if(i){if(H&&!g.PubidLiteral_match.test(H))throw new p("DocumentType publicId is not a valid PubidLiteral",m.InvalidStateError);if(j&&"."!==j&&!g.SystemLiteral_match.test(j))throw new p("DocumentType systemId is not a valid SystemLiteral",m.InvalidStateError);if(t.internalSubset&&-1!==t.internalSubset.indexOf("]>"))throw new p('DocumentType internalSubset contains "]>"',m.InvalidStateError)}return e.push(g.DOCTYPE_DECL_START," ",t.name),H?(e.push(" ",g.PUBLIC," ",H),j&&"."!==j&&e.push(" ",j)):j&&"."!==j&&e.push(" ",g.SYSTEM," ",j),t.internalSubset&&e.push(" [",t.internalSubset,"]"),e.push(">"),null;case D:if(i){if(-1!==t.target.indexOf(":")||"xml"===t.target.toLowerCase())throw new p("The ProcessingInstruction target is not well-formed",m.InvalidStateError);if(g.InvalidChar.test(t.data))throw new p("The ProcessingInstruction data contains characters outside the XML Char production",m.InvalidStateError);if(-1!==t.data.indexOf("?>"))throw new p('The ProcessingInstruction data contains "?>"',m.InvalidStateError)}return e.push("<?",t.target," ",t.data,"?>"),null;case v:return e.push("&",t.nodeName,";"),null;default:return e.push("??",t.nodeName),null}},exit:function(t,n){n&&n.tag&&e.push("</",n.tag,">")}})}function Mt(t,e,n){var r;return J(e,null,{enter:function(e,o){var i=new e.constructor(d);for(var a in e)if(s(e,a)){var c=e[a];"object"!=typeof c&&c!=i[a]&&(i[a]=c)}e.childNodes&&(i.childNodes=new V),i.ownerDocument=t;var l=n;switch(i.nodeType){case y:var u=e.attributes,h=i.attributes=new q,f=u.length;h._ownerElement=i;for(var p=0;p<f;p++)i.setAttributeNode(Mt(t,u.item(p),!0));break;case C:l=!0}return null!==o?o.appendChild(i):r=i,l?i:null}}),r}function vt(t,e,n){t[e]=n}function wt(t){for(var e=[],n=t.firstChild;n;)n.nodeType===y&&e.push(n),n=n.nextSibling;return e}V.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t){var e;e="function"==typeof t?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:t}:t?{requireWellFormed:!!t.requireWellFormed,splitCDATASections:!1!==t.splitCDATASections,nodeFilter:t.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var n=[],r=0;r<this.length;r++)Lt(this[r],n,null,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},V.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},H.prototype.item=function(t){return j(this),this[t]||null},R(H,V),q.prototype={length:0,item:V.prototype.item,getNamedItem:function(t){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());for(var e=0;e<this.length;){var n=this[e];if(n.nodeName===t)return n;e++}return null},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!==this._ownerElement)throw new p(p.INUSE_ATTRIBUTE_ERR);var n=this.getNamedItemNS(t.namespaceURI,t.localName);return n===t?t:(X(this._ownerElement,this,t,n),n)},setNamedItemNS:function(t){return this.setNamedItem(t)},removeNamedItem:function(t){var e=this.getNamedItem(t);if(!e)throw new p(p.NOT_FOUND_ERR,t);return Y(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);if(!n)throw new p(p.NOT_FOUND_ERR,t?t+" : "+e:e);return Y(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){t||(t=null);for(var n=0;n<this.length;){var r=this[n];if(r.localName===e&&r.namespaceURI===t)return r;n++}return null}},q.prototype[Symbol.iterator]=function(){var t=this,e=0;return{next:function(){return e<t.length?{value:t[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},W.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=u.XML_APPLICATION;t===h.HTML?r=u.XML_XHTML_APPLICATION:t===h.SVG&&(r=u.XML_SVG_IMAGE);var o=new Z(d,{contentType:r});if(o.implementation=this,o.childNodes=new V,o.doctype=n||null,n&&o.appendChild(n),e){var i=o.createElementNS(t,e);o.appendChild(i)}return o},createDocumentType:function(t,e,n,r){I(t);var o=new Nt(d);return o.name=t,o.nodeName=t,o.publicId=e||"",o.systemId=n||"",o.internalSubset=r||"",o.childNodes=new V,o},createHTMLDocument:function(t){var e=new Z(d,{contentType:u.HTML});if(e.implementation=this,e.childNodes=new V,!1!==t){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var n=e.createElement("html");e.appendChild(n);var r=e.createElement("head");if(n.appendChild(r),"string"==typeof t){var o=e.createElement("title");o.appendChild(e.createTextNode(t)),r.appendChild(o)}n.appendChild(e.createElement("body"))}return e}},K.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var t=this.getRootNode();return t&&t.nodeType===t.DOCUMENT_NODE},contains:function(t){if(!t)return!1;var e=t;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},getRootNode:function(t){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(t){if(!t)return!1;for(var e=[{node:this,other:t}];e.length>0;){var n=e.pop(),r=n.node,o=n.other;if(r.nodeType!==o.nodeType)return!1;switch(r.nodeType){case r.DOCUMENT_TYPE_NODE:if(r.name!==o.name)return!1;if(r.publicId!==o.publicId)return!1;if(r.systemId!==o.systemId)return!1;break;case r.ELEMENT_NODE:if(r.namespaceURI!==o.namespaceURI)return!1;if(r.prefix!==o.prefix)return!1;if(r.localName!==o.localName)return!1;if(r.attributes.length!==o.attributes.length)return!1;for(var i=0;i<r.attributes.length;i++){var s=r.attributes.item(i),a=o.getAttributeNodeNS(s.namespaceURI,s.localName);if(!a)return!1;e.push({node:s,other:a})}break;case r.ATTRIBUTE_NODE:if(r.namespaceURI!==o.namespaceURI)return!1;if(r.localName!==o.localName)return!1;if(r.value!==o.value)return!1;break;case r.PROCESSING_INSTRUCTION_NODE:if(r.target!==o.target||r.data!==o.data)return!1;break;case r.TEXT_NODE:case r.CDATA_SECTION_NODE:case r.COMMENT_NODE:if(r.data!==o.data)return!1}if(r.childNodes.length!==o.childNodes.length)return!1;for(i=r.childNodes.length-1;i>=0;i--)e.push({node:r.childNodes[i],other:o.childNodes[i]})}return!0},isSameNode:function(t){return this===t},insertBefore:function(t,e){return ht(this,t,e)},replaceChild:function(t,e){ht(this,t,e,ut),e&&this.removeChild(e)},removeChild:function(t){return nt(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Mt(this.ownerDocument||this,this,t)},normalize:function(){J(this,null,{enter:function(t){for(var e=t.firstChild;e;){var n=e.nextSibling;null!==n&&n.nodeType===L&&e.nodeType===L?(t.removeChild(n),e.appendData(n.data)):e=n}return!0}})},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n)for(var r in n)if(s(n,r)&&n[r]===t)return r;e=e.nodeType==C?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&s(n,t))return n[t];e=e.nodeType==C?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)},compareDocumentPosition:function(t){if(this===t)return 0;var e=t,n=this,r=null,o=null;if(e instanceof ft&&(e=(r=e).ownerElement),n instanceof ft&&(n=(o=n).ownerElement,r&&e&&n===e))for(var i,s=0;i=n.attributes[s];s++){if(i===r)return k.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+k.DOCUMENT_POSITION_PRECEDING;if(i===o)return k.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+k.DOCUMENT_POSITION_FOLLOWING}if(!e||!n||n.ownerDocument!==e.ownerDocument)return k.DOCUMENT_POSITION_DISCONNECTED+k.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(G(n.ownerDocument)>G(e.ownerDocument)?k.DOCUMENT_POSITION_FOLLOWING:k.DOCUMENT_POSITION_PRECEDING);if(o&&e===n)return k.DOCUMENT_POSITION_CONTAINS+k.DOCUMENT_POSITION_PRECEDING;if(r&&e===n)return k.DOCUMENT_POSITION_CONTAINED_BY+k.DOCUMENT_POSITION_FOLLOWING;for(var a=[],c=e.parentNode;c;){if(!o&&c===n)return k.DOCUMENT_POSITION_CONTAINED_BY+k.DOCUMENT_POSITION_FOLLOWING;a.push(c),c=c.parentNode}a.reverse();for(var l=[],u=n.parentNode;u;){if(!r&&u===e)return k.DOCUMENT_POSITION_CONTAINS+k.DOCUMENT_POSITION_PRECEDING;l.push(u),u=u.parentNode}l.reverse();var h=B(a,l);for(var d in h.childNodes){var f=h.childNodes[d];if(f===n)return k.DOCUMENT_POSITION_FOLLOWING;if(f===e)return k.DOCUMENT_POSITION_PRECEDING;if(l.indexOf(f)>=0)return k.DOCUMENT_POSITION_FOLLOWING;if(a.indexOf(f)>=0)return k.DOCUMENT_POSITION_PRECEDING}return 0}},b(O,K),b(O,K.prototype),b(k,K),b(k,K.prototype),J.STOP=Symbol("walkDOM.STOP"),J.ENTER=0,J.EXIT=1,Z.prototype={implementation:null,nodeName:"#document",nodeType:_,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType===F){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return ht(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===y&&(this.documentElement=t),t},removeChild:function(t){var e=nt(this,t);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(t,e){ht(this,t,e,ut),t.ownerDocument=this,e&&this.removeChild(e),ot(t)&&(this.documentElement=t)},importNode:function(t,e){return function(t,e,n){var r;return J(e,null,{enter:function(e,o){var i=e.cloneNode(!1);return i.ownerDocument=t,i.parentNode=null,null===o?r=i:o.appendChild(i),e.nodeType===C||n?i:null}}),r}(this,t,e)},getElementById:function(t){var e=null;return Q(this.documentElement,function(n){if(n.nodeType==y&&n.getAttribute("id")==t)return e=n,!0}),e},createElement:function(t){var e=new dt(d);return e.ownerDocument=this,"html"===this.type&&(t=t.toLowerCase()),i(this.contentType)&&(e.namespaceURI=h.HTML),e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new V,(e.attributes=new q)._ownerElement=e,e},createDocumentFragment:function(){var t=new At(d);return t.ownerDocument=this,t.childNodes=new V,t},createTextNode:function(t){var e=new mt(d);return e.ownerDocument=this,e.childNodes=new V,e.appendData(t),e},createComment:function(t){var e=new gt(d);return e.ownerDocument=this,e.childNodes=new V,e.appendData(t),e},createCDATASection:function(t){if(-1!==t.indexOf("]]>"))throw new p(p.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new Et(d);return e.ownerDocument=this,e.childNodes=new V,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new bt(d);return n.ownerDocument=this,n.childNodes=new V,n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){if(!g.QName_exact.test(t))throw new p(p.INVALID_CHARACTER_ERR,'invalid character in name "'+t+'"');return"html"===this.type&&(t=t.toLowerCase()),this._createAttribute(t)},_createAttribute:function(t){var e=new ft(d);return e.ownerDocument=this,e.childNodes=new V,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){if(!g.Name.test(t))throw new p(p.INVALID_CHARACTER_ERR,'not a valid xml name "'+t+'"');if("html"===this.type)throw new p("document is an html document",m.NotSupportedError);var e=new It(d);return e.ownerDocument=this,e.childNodes=new V,e.nodeName=t,e},createElementNS:function(t,e){var n=A(t,e),r=new dt(d),o=r.attributes=new q;return r.childNodes=new V,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],o._ownerElement=r,r},createAttributeNS:function(t,e){var n=A(t,e),r=new ft(d);return r.ownerDocument=this,r.childNodes=new V,r.nodeName=e,r.name=e,r.specified=!0,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],r}},R(Z,K),dt.prototype={nodeType:y,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===h.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(t){return!!this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e?e.value:null},getAttributeNode:function(t){return this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase()),this.attributes.getNamedItem(t)},setAttribute:function(t,e){this._isInHTMLDocumentAndNamespace()&&(t=t.toLowerCase());var n=this.getAttributeNode(t);n?n.value=n.nodeValue=""+e:((n=this.ownerDocument._createAttribute(t)).value=n.nodeValue=""+e,this.setAttributeNode(n))},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n?n.value:null},setAttributeNS:function(t,e,n){var r=A(t,e)[2],o=this.getAttributeNodeNS(t,r);o?o.value=o.nodeValue=""+n:((o=this.ownerDocument.createAttributeNS(t,e)).value=o.nodeValue=""+n,this.setAttributeNode(o))},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByClassName:function(t){var e=T(t);return new H(this,function(n){var r=[];return e.length>0&&Q(n,function(o){if(o!==n&&o.nodeType===y){var i=o.getAttribute("class");if(i){var s=t===i;if(!s){var a=T(i);s=e.every((c=a,function(t){return c&&-1!==c.indexOf(t)}))}s&&r.push(o)}}var c}),r})},getElementsByTagName:function(t){var e="html"===(this.nodeType===_?this:this.ownerDocument).type,n=t.toLowerCase();return new H(this,function(r){var o=[];return Q(r,function(i){i!==r&&i.nodeType===y&&(("*"===t||i.getQualifiedName()===(e&&i.namespaceURI===h.HTML?n:t))&&o.push(i))}),o})},getElementsByTagNameNS:function(t,e){return new H(this,function(n){var r=[];return Q(n,function(o){o===n||o.nodeType!==y||"*"!==t&&o.namespaceURI!==t||"*"!==e&&o.localName!=e||r.push(o)}),r})}},Z.prototype.getElementsByClassName=dt.prototype.getElementsByClassName,Z.prototype.getElementsByTagName=dt.prototype.getElementsByTagName,Z.prototype.getElementsByTagNameNS=dt.prototype.getElementsByTagNameNS,R(dt,K),ft.prototype.nodeType=C,R(ft,K),pt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){n=this.data.substring(0,t)+n+this.data.substring(t+e),this.nodeValue=this.data=n,this.length=n.length}},R(pt,K),mt.prototype={nodeName:"#text",nodeType:L,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},R(mt,pt),gt.prototype={nodeName:"#comment",nodeType:P},R(gt,pt),Et.prototype={nodeName:"#cdata-section",nodeType:M},R(Et,mt),Nt.prototype.nodeType=x,R(Nt,K),St.prototype.nodeType=U,R(St,K),Tt.prototype.nodeType=w,R(Tt,K),It.prototype.nodeType=v,R(It,K),At.prototype.nodeName="#document-fragment",At.prototype.nodeType=F,R(At,K),bt.prototype.nodeType=D,R(bt,pt),Rt.prototype.serializeToString=function(t,e){return Ot.call(t,e)},K.prototype.toString=Ot;try{Object.defineProperty&&(Object.defineProperty(H.prototype,"length",{get:function(){return j(this),this.$$length}}),Object.defineProperty(K.prototype,"textContent",{get:function(){if(this.nodeType===y||this.nodeType===F){var t=[];return J(this,null,{enter:function(e){return e.nodeType===y||e.nodeType===F||(e.nodeType===D||e.nodeType===P?null:void t.push(e.nodeValue))}}),t.join("")}return this.nodeValue},set:function(t){switch(this.nodeType){case y:case F:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Object.defineProperty(dt.prototype,"children",{get:function(){return new H(this,wt)}}),Object.defineProperty(Z.prototype,"children",{get:function(){return new H(this,wt)}}),Object.defineProperty(At.prototype,"children",{get:function(){return new H(this,wt)}}),vt=function(t,e,n){t["$$"+e]=n})}catch(t){}e._updateLiveList=j,e.Attr=ft,e.CDATASection=Et,e.CharacterData=pt,e.Comment=gt,e.Document=Z,e.DocumentFragment=At,e.DocumentType=Nt,e.DOMImplementation=W,e.Element=dt,e.Entity=Tt,e.EntityReference=It,e.LiveNodeList=H,e.NamedNodeMap=q,e.Node=K,e.NodeList=V,e.Notation=St,e.Text=mt,e.ProcessingInstruction=bt,e.walkDOM=J,e.XMLSerializer=Rt},334(t,e,n){"use strict";var r=n(981).freeze;e.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=r({Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\u{1d504}",afr:"\u{1d51e}",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",AMP:"&",amp:"&",And:"\u2a53",and:"\u2227",andand:"\u2a55",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1d538}",aopf:"\u{1d552}",ap:"\u2248",apacir:"\u2a6f",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\u{1d49c}",ascr:"\u{1d4b6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\u{1d505}",bfr:"\u{1d51f}",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\u{1d539}",bopf:"\u{1d553}",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250c",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252c",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxUL:"\u255d",boxUl:"\u255c",boxuL:"\u255b",boxul:"\u2518",boxUR:"\u255a",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256c",boxVh:"\u256b",boxvH:"\u256a",boxvh:"\u253c",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255f",boxvR:"\u255e",boxvr:"\u251c",bprime:"\u2035",Breve:"\u02d8",breve:"\u02d8",brvbar:"\xa6",Bscr:"\u212c",bscr:"\u{1d4b7}",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsol:"\\",bsolb:"\u29c5",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22d2",cap:"\u2229",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",CenterDot:"\xb7",centerdot:"\xb7",Cfr:"\u212d",cfr:"\u{1d520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",cir:"\u25cb",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2a6d",Congruent:"\u2261",Conint:"\u222f",conint:"\u222e",ContourIntegral:"\u222e",Copf:"\u2102",copf:"\u{1d554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xa9",copy:"\xa9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21b5",Cross:"\u2a2f",cross:"\u2717",Cscr:"\u{1d49e}",cscr:"\u{1d4b8}",csub:"\u2acf",csube:"\u2ad1",csup:"\u2ad0",csupe:"\u2ad2",ctdot:"\u22ef",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cularrp:"\u293d",Cup:"\u22d3",cup:"\u222a",cupbrcap:"\u2a48",CupCap:"\u224d",cupcap:"\u2a46",cupcup:"\u2a4a",cupdot:"\u228d",cupor:"\u2a45",cups:"\u222a\ufe00",curarr:"\u21b7",curarrm:"\u293c",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",curlyvee:"\u22ce",curlywedge:"\u22cf",curren:"\xa4",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",cuvee:"\u22ce",cuwed:"\u22cf",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232d",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21a1",dArr:"\u21d3",darr:"\u2193",dash:"\u2010",Dashv:"\u2ae4",dashv:"\u22a3",dbkarow:"\u290f",dblac:"\u02dd",Dcaron:"\u010e",dcaron:"\u010f",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21ca",DDotrahd:"\u2911",ddotseq:"\u2a77",deg:"\xb0",Del:"\u2207",Delta:"\u0394",delta:"\u03b4",demptyv:"\u29b1",dfisht:"\u297f",Dfr:"\u{1d507}",dfr:"\u{1d521}",dHar:"\u2965",dharl:"\u21c3",dharr:"\u21c2",DiacriticalAcute:"\xb4",DiacriticalDot:"\u02d9",DiacriticalDoubleAcute:"\u02dd",DiacriticalGrave:"`",DiacriticalTilde:"\u02dc",diam:"\u22c4",Diamond:"\u22c4",diamond:"\u22c4",diamondsuit:"\u2666",diams:"\u2666",die:"\xa8",DifferentialD:"\u2146",digamma:"\u03dd",disin:"\u22f2",div:"\xf7",divide:"\xf7",divideontimes:"\u22c7",divonx:"\u22c7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231e",dlcrop:"\u230d",dollar:"$",Dopf:"\u{1d53b}",dopf:"\u{1d555}",Dot:"\xa8",dot:"\u02d9",DotDot:"\u20dc",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22a1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222f",DoubleDot:"\xa8",DoubleDownArrow:"\u21d3",DoubleLeftArrow:"\u21d0",DoubleLeftRightArrow:"\u21d4",DoubleLeftTee:"\u2ae4",DoubleLongLeftArrow:"\u27f8",DoubleLongLeftRightArrow:"\u27fa",DoubleLongRightArrow:"\u27f9",DoubleRightArrow:"\u21d2",DoubleRightTee:"\u22a8",DoubleUpArrow:"\u21d1",DoubleUpDownArrow:"\u21d5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21d3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21f5",DownBreve:"\u0311",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295e",DownLeftVector:"\u21bd",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295f",DownRightVector:"\u21c1",DownRightVectorBar:"\u2957",DownTee:"\u22a4",DownTeeArrow:"\u21a7",drbkarow:"\u2910",drcorn:"\u231f",drcrop:"\u230c",Dscr:"\u{1d49f}",dscr:"\u{1d4b9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29f6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22f1",dtri:"\u25bf",dtrif:"\u25be",duarr:"\u21f5",duhar:"\u296f",dwangle:"\u29a6",DZcy:"\u040f",dzcy:"\u045f",dzigrarr:"\u27ff",Eacute:"\xc9",eacute:"\xe9",easter:"\u2a6e",Ecaron:"\u011a",ecaron:"\u011b",ecir:"\u2256",Ecirc:"\xca",ecirc:"\xea",ecolon:"\u2255",Ecy:"\u042d",ecy:"\u044d",eDDot:"\u2a77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1d508}",efr:"\u{1d522}",eg:"\u2a9a",Egrave:"\xc8",egrave:"\xe8",egs:"\u2a96",egsdot:"\u2a98",el:"\u2a99",Element:"\u2208",elinters:"\u23e7",ell:"\u2113",els:"\u2a95",elsdot:"\u2a97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25fb",emptyv:"\u2205",EmptyVerySmallSquare:"\u25ab",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014a",eng:"\u014b",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1d53c}",eopf:"\u{1d556}",epar:"\u22d5",eparsl:"\u29e3",eplus:"\u2a71",epsi:"\u03b5",Epsilon:"\u0395",epsilon:"\u03b5",epsiv:"\u03f5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2a96",eqslantless:"\u2a95",Equal:"\u2a75",equals:"=",EqualTilde:"\u2242",equest:"\u225f",Equilibrium:"\u21cc",equiv:"\u2261",equivDD:"\u2a78",eqvparsl:"\u29e5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212f",esdot:"\u2250",Esim:"\u2a73",esim:"\u2242",Eta:"\u0397",eta:"\u03b7",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"\u20ac",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\ufb03",fflig:"\ufb00",ffllig:"\ufb04",Ffr:"\u{1d509}",ffr:"\u{1d523}",filig:"\ufb01",FilledSmallSquare:"\u25fc",FilledVerySmallSquare:"\u25aa",fjlig:"fj",flat:"\u266d",fllig:"\ufb02",fltns:"\u25b1",fnof:"\u0192",Fopf:"\u{1d53d}",fopf:"\u{1d557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22d4",forkv:"\u2ad9",Fouriertrf:"\u2131",fpartint:"\u2a0d",frac12:"\xbd",frac13:"\u2153",frac14:"\xbc",frac15:"\u2155",frac16:"\u2159",frac18:"\u215b",frac23:"\u2154",frac25:"\u2156",frac34:"\xbe",frac35:"\u2157",frac38:"\u215c",frac45:"\u2158",frac56:"\u215a",frac58:"\u215d",frac78:"\u215e",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1d4bb}",gacute:"\u01f5",Gamma:"\u0393",gamma:"\u03b3",Gammad:"\u03dc",gammad:"\u03dd",gap:"\u2a86",Gbreve:"\u011e",gbreve:"\u011f",Gcedil:"\u0122",Gcirc:"\u011c",gcirc:"\u011d",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2a8c",gel:"\u22db",geq:"\u2265",geqq:"\u2267",geqslant:"\u2a7e",ges:"\u2a7e",gescc:"\u2aa9",gesdot:"\u2a80",gesdoto:"\u2a82",gesdotol:"\u2a84",gesl:"\u22db\ufe00",gesles:"\u2a94",Gfr:"\u{1d50a}",gfr:"\u{1d524}",Gg:"\u22d9",gg:"\u226b",ggg:"\u22d9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2aa5",glE:"\u2a92",glj:"\u2aa4",gnap:"\u2a8a",gnapprox:"\u2a8a",gnE:"\u2269",gne:"\u2a88",gneq:"\u2a88",gneqq:"\u2269",gnsim:"\u22e7",Gopf:"\u{1d53e}",gopf:"\u{1d558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterGreater:"\u2aa2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Gscr:"\u{1d4a2}",gscr:"\u210a",gsim:"\u2273",gsime:"\u2a8e",gsiml:"\u2a90",Gt:"\u226b",GT:">",gt:">",gtcc:"\u2aa7",gtcir:"\u2a7a",gtdot:"\u22d7",gtlPar:"\u2995",gtquest:"\u2a7c",gtrapprox:"\u2a86",gtrarr:"\u2978",gtrdot:"\u22d7",gtreqless:"\u22db",gtreqqless:"\u2a8c",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\ufe00",gvnE:"\u2269\ufe00",Hacek:"\u02c7",hairsp:"\u200a",half:"\xbd",hamilt:"\u210b",HARDcy:"\u042a",hardcy:"\u044a",hArr:"\u21d4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21ad",Hat:"^",hbar:"\u210f",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22b9",Hfr:"\u210c",hfr:"\u{1d525}",HilbertSpace:"\u210b",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21ff",homtht:"\u223b",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",Hopf:"\u210d",hopf:"\u{1d559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210b",hscr:"\u{1d4bd}",hslash:"\u210f",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224e",HumpEqual:"\u224f",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xcd",iacute:"\xed",ic:"\u2063",Icirc:"\xce",icirc:"\xee",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xa1",iff:"\u21d4",Ifr:"\u2111",ifr:"\u{1d526}",Igrave:"\xcc",igrave:"\xec",ii:"\u2148",iiiint:"\u2a0c",iiint:"\u222d",iinfin:"\u29dc",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012a",imacr:"\u012b",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22b7",imped:"\u01b5",Implies:"\u21d2",in:"\u2208",incare:"\u2105",infin:"\u221e",infintie:"\u29dd",inodot:"\u0131",Int:"\u222c",int:"\u222b",intcal:"\u22ba",integers:"\u2124",Integral:"\u222b",intercal:"\u22ba",Intersection:"\u22c2",intlarhk:"\u2a17",intprod:"\u2a3c",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012e",iogon:"\u012f",Iopf:"\u{1d540}",iopf:"\u{1d55a}",Iota:"\u0399",iota:"\u03b9",iprod:"\u2a3c",iquest:"\xbf",Iscr:"\u2110",iscr:"\u{1d4be}",isin:"\u2208",isindot:"\u22f5",isinE:"\u22f9",isins:"\u22f4",isinsv:"\u22f3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xcf",iuml:"\xef",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1d50d}",jfr:"\u{1d527}",jmath:"\u0237",Jopf:"\u{1d541}",jopf:"\u{1d55b}",Jscr:"\u{1d4a5}",jscr:"\u{1d4bf}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039a",kappa:"\u03ba",kappav:"\u03f0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041a",kcy:"\u043a",Kfr:"\u{1d50e}",kfr:"\u{1d528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040c",kjcy:"\u045c",Kopf:"\u{1d542}",kopf:"\u{1d55c}",Kscr:"\u{1d4a6}",kscr:"\u{1d4c0}",lAarr:"\u21da",Lacute:"\u0139",lacute:"\u013a",laemptyv:"\u29b4",lagran:"\u2112",Lambda:"\u039b",lambda:"\u03bb",Lang:"\u27ea",lang:"\u27e8",langd:"\u2991",langle:"\u27e8",lap:"\u2a85",Laplacetrf:"\u2112",laquo:"\xab",Larr:"\u219e",lArr:"\u21d0",larr:"\u2190",larrb:"\u21e4",larrbfs:"\u291f",larrfs:"\u291d",larrhk:"\u21a9",larrlp:"\u21ab",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21a2",lat:"\u2aab",lAtail:"\u291b",latail:"\u2919",late:"\u2aad",lates:"\u2aad\ufe00",lBarr:"\u290e",lbarr:"\u290c",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298b",lbrksld:"\u298f",lbrkslu:"\u298d",Lcaron:"\u013d",lcaron:"\u013e",Lcedil:"\u013b",lcedil:"\u013c",lceil:"\u2308",lcub:"{",Lcy:"\u041b",lcy:"\u043b",ldca:"\u2936",ldquo:"\u201c",ldquor:"\u201e",ldrdhar:"\u2967",ldrushar:"\u294b",ldsh:"\u21b2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",Leftarrow:"\u21d0",leftarrow:"\u2190",LeftArrowBar:"\u21e4",LeftArrowRightArrow:"\u21c6",leftarrowtail:"\u21a2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27e6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21c3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230a",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrow:"\u2194",leftrightarrows:"\u21c6",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",LeftRightVector:"\u294e",LeftTee:"\u22a3",LeftTeeArrow:"\u21a4",LeftTeeVector:"\u295a",leftthreetimes:"\u22cb",LeftTriangle:"\u22b2",LeftTriangleBar:"\u29cf",LeftTriangleEqual:"\u22b4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21bf",LeftUpVectorBar:"\u2958",LeftVector:"\u21bc",LeftVectorBar:"\u2952",lEg:"\u2a8b",leg:"\u22da",leq:"\u2264",leqq:"\u2266",leqslant:"\u2a7d",les:"\u2a7d",lescc:"\u2aa8",lesdot:"\u2a7f",lesdoto:"\u2a81",lesdotor:"\u2a83",lesg:"\u22da\ufe00",lesges:"\u2a93",lessapprox:"\u2a85",lessdot:"\u22d6",lesseqgtr:"\u22da",lesseqqgtr:"\u2a8b",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2aa1",lesssim:"\u2272",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",lfisht:"\u297c",lfloor:"\u230a",Lfr:"\u{1d50f}",lfr:"\u{1d529}",lg:"\u2276",lgE:"\u2a91",lHar:"\u2962",lhard:"\u21bd",lharu:"\u21bc",lharul:"\u296a",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22d8",ll:"\u226a",llarr:"\u21c7",llcorner:"\u231e",Lleftarrow:"\u21da",llhard:"\u296b",lltri:"\u25fa",Lmidot:"\u013f",lmidot:"\u0140",lmoust:"\u23b0",lmoustache:"\u23b0",lnap:"\u2a89",lnapprox:"\u2a89",lnE:"\u2268",lne:"\u2a87",lneq:"\u2a87",lneqq:"\u2268",lnsim:"\u22e6",loang:"\u27ec",loarr:"\u21fd",lobrk:"\u27e6",LongLeftArrow:"\u27f5",Longleftarrow:"\u27f8",longleftarrow:"\u27f5",LongLeftRightArrow:"\u27f7",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",LongRightArrow:"\u27f6",Longrightarrow:"\u27f9",longrightarrow:"\u27f6",looparrowleft:"\u21ab",looparrowright:"\u21ac",lopar:"\u2985",Lopf:"\u{1d543}",lopf:"\u{1d55d}",loplus:"\u2a2d",lotimes:"\u2a34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25ca",lozenge:"\u25ca",lozf:"\u29eb",lpar:"(",lparlt:"\u2993",lrarr:"\u21c6",lrcorner:"\u231f",lrhar:"\u21cb",lrhard:"\u296d",lrm:"\u200e",lrtri:"\u22bf",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1d4c1}",Lsh:"\u21b0",lsh:"\u21b0",lsim:"\u2272",lsime:"\u2a8d",lsimg:"\u2a8f",lsqb:"[",lsquo:"\u2018",lsquor:"\u201a",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226a",LT:"<",lt:"<",ltcc:"\u2aa6",ltcir:"\u2a79",ltdot:"\u22d6",lthree:"\u22cb",ltimes:"\u22c9",ltlarr:"\u2976",ltquest:"\u2a7b",ltri:"\u25c3",ltrie:"\u22b4",ltrif:"\u25c2",ltrPar:"\u2996",lurdshar:"\u294a",luruhar:"\u2966",lvertneqq:"\u2268\ufe00",lvnE:"\u2268\ufe00",macr:"\xaf",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21a6",mapsto:"\u21a6",mapstodown:"\u21a7",mapstoleft:"\u21a4",mapstoup:"\u21a5",marker:"\u25ae",mcomma:"\u2a29",Mcy:"\u041c",mcy:"\u043c",mdash:"\u2014",mDDot:"\u223a",measuredangle:"\u2221",MediumSpace:"\u205f",Mellintrf:"\u2133",Mfr:"\u{1d510}",mfr:"\u{1d52a}",mho:"\u2127",micro:"\xb5",mid:"\u2223",midast:"*",midcir:"\u2af0",middot:"\xb7",minus:"\u2212",minusb:"\u229f",minusd:"\u2238",minusdu:"\u2a2a",MinusPlus:"\u2213",mlcp:"\u2adb",mldr:"\u2026",mnplus:"\u2213",models:"\u22a7",Mopf:"\u{1d544}",mopf:"\u{1d55e}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1d4c2}",mstpos:"\u223e",Mu:"\u039c",mu:"\u03bc",multimap:"\u22b8",mumap:"\u22b8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20d2",nap:"\u2249",napE:"\u2a70\u0338",napid:"\u224b\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266e",natural:"\u266e",naturals:"\u2115",nbsp:"\xa0",nbump:"\u224e\u0338",nbumpe:"\u224f\u0338",ncap:"\u2a43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2a6d\u0338",ncup:"\u2a42",Ncy:"\u041d",ncy:"\u043d",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21d7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200b",NegativeThickSpace:"\u200b",NegativeThinSpace:"\u200b",NegativeVeryThinSpace:"\u200b",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NewLine:"\n",nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1d511}",nfr:"\u{1d52b}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2a7e\u0338",nges:"\u2a7e\u0338",nGg:"\u22d9\u0338",ngsim:"\u2275",nGt:"\u226b\u20d2",ngt:"\u226f",ngtr:"\u226f",nGtv:"\u226b\u0338",nhArr:"\u21ce",nharr:"\u21ae",nhpar:"\u2af2",ni:"\u220b",nis:"\u22fc",nisd:"\u22fa",niv:"\u220b",NJcy:"\u040a",njcy:"\u045a",nlArr:"\u21cd",nlarr:"\u219a",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21cd",nleftarrow:"\u219a",nLeftrightarrow:"\u21ce",nleftrightarrow:"\u21ae",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2a7d\u0338",nles:"\u2a7d\u0338",nless:"\u226e",nLl:"\u22d8\u0338",nlsim:"\u2274",nLt:"\u226a\u20d2",nlt:"\u226e",nltri:"\u22ea",nltrie:"\u22ec",nLtv:"\u226a\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xa0",Nopf:"\u2115",nopf:"\u{1d55f}",Not:"\u2aec",not:"\xac",NotCongruent:"\u2262",NotCupCap:"\u226d",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226b\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2a7e\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224e\u0338",NotHumpEqual:"\u224f\u0338",notin:"\u2209",notindot:"\u22f5\u0338",notinE:"\u22f9\u0338",notinva:"\u2209",notinvb:"\u22f7",notinvc:"\u22f6",NotLeftTriangle:"\u22ea",NotLeftTriangleBar:"\u29cf\u0338",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226a\u0338",NotLessSlantEqual:"\u2a7d\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2aa2\u0338",NotNestedLessLess:"\u2aa1\u0338",notni:"\u220c",notniva:"\u220c",notnivb:"\u22fe",notnivc:"\u22fd",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2aaf\u0338",NotPrecedesSlantEqual:"\u22e0",NotReverseElement:"\u220c",NotRightTriangle:"\u22eb",NotRightTriangleBar:"\u29d0\u0338",NotRightTriangleEqual:"\u22ed",NotSquareSubset:"\u228f\u0338",NotSquareSubsetEqual:"\u22e2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22e3",NotSubset:"\u2282\u20d2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2ab0\u0338",NotSucceedsSlantEqual:"\u22e1",NotSucceedsTilde:"\u227f\u0338",NotSuperset:"\u2283\u20d2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2afd\u20e5",npart:"\u2202\u0338",npolint:"\u2a14",npr:"\u2280",nprcue:"\u22e0",npre:"\u2aaf\u0338",nprec:"\u2280",npreceq:"\u2aaf\u0338",nrArr:"\u21cf",nrarr:"\u219b",nrarrc:"\u2933\u0338",nrarrw:"\u219d\u0338",nRightarrow:"\u21cf",nrightarrow:"\u219b",nrtri:"\u22eb",nrtrie:"\u22ed",nsc:"\u2281",nsccue:"\u22e1",nsce:"\u2ab0\u0338",Nscr:"\u{1d4a9}",nscr:"\u{1d4c3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22e2",nsqsupe:"\u22e3",nsub:"\u2284",nsubE:"\u2ac5\u0338",nsube:"\u2288",nsubset:"\u2282\u20d2",nsubseteq:"\u2288",nsubseteqq:"\u2ac5\u0338",nsucc:"\u2281",nsucceq:"\u2ab0\u0338",nsup:"\u2285",nsupE:"\u2ac6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20d2",nsupseteq:"\u2289",nsupseteqq:"\u2ac6\u0338",ntgl:"\u2279",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"\u2278",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",Nu:"\u039d",nu:"\u03bd",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224d\u20d2",nVDash:"\u22af",nVdash:"\u22ae",nvDash:"\u22ad",nvdash:"\u22ac",nvge:"\u2265\u20d2",nvgt:">\u20d2",nvHarr:"\u2904",nvinfin:"\u29de",nvlArr:"\u2902",nvle:"\u2264\u20d2",nvlt:"<\u20d2",nvltrie:"\u22b4\u20d2",nvrArr:"\u2903",nvrtrie:"\u22b5\u20d2",nvsim:"\u223c\u20d2",nwarhk:"\u2923",nwArr:"\u21d6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xd3",oacute:"\xf3",oast:"\u229b",ocir:"\u229a",Ocirc:"\xd4",ocirc:"\xf4",Ocy:"\u041e",ocy:"\u043e",odash:"\u229d",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2a38",odot:"\u2299",odsold:"\u29bc",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29bf",Ofr:"\u{1d512}",ofr:"\u{1d52c}",ogon:"\u02db",Ograve:"\xd2",ograve:"\xf2",ogt:"\u29c1",ohbar:"\u29b5",ohm:"\u03a9",oint:"\u222e",olarr:"\u21ba",olcir:"\u29be",olcross:"\u29bb",oline:"\u203e",olt:"\u29c0",Omacr:"\u014c",omacr:"\u014d",Omega:"\u03a9",omega:"\u03c9",Omicron:"\u039f",omicron:"\u03bf",omid:"\u29b6",ominus:"\u2296",Oopf:"\u{1d546}",oopf:"\u{1d560}",opar:"\u29b7",OpenCurlyDoubleQuote:"\u201c",OpenCurlyQuote:"\u2018",operp:"\u29b9",oplus:"\u2295",Or:"\u2a54",or:"\u2228",orarr:"\u21bb",ord:"\u2a5d",order:"\u2134",orderof:"\u2134",ordf:"\xaa",ordm:"\xba",origof:"\u22b6",oror:"\u2a56",orslope:"\u2a57",orv:"\u2a5b",oS:"\u24c8",Oscr:"\u{1d4aa}",oscr:"\u2134",Oslash:"\xd8",oslash:"\xf8",osol:"\u2298",Otilde:"\xd5",otilde:"\xf5",Otimes:"\u2a37",otimes:"\u2297",otimesas:"\u2a36",Ouml:"\xd6",ouml:"\xf6",ovbar:"\u233d",OverBar:"\u203e",OverBrace:"\u23de",OverBracket:"\u23b4",OverParenthesis:"\u23dc",par:"\u2225",para:"\xb6",parallel:"\u2225",parsim:"\u2af3",parsl:"\u2afd",part:"\u2202",PartialD:"\u2202",Pcy:"\u041f",pcy:"\u043f",percnt:"%",period:".",permil:"\u2030",perp:"\u22a5",pertenk:"\u2031",Pfr:"\u{1d513}",pfr:"\u{1d52d}",Phi:"\u03a6",phi:"\u03c6",phiv:"\u03d5",phmmat:"\u2133",phone:"\u260e",Pi:"\u03a0",pi:"\u03c0",pitchfork:"\u22d4",piv:"\u03d6",planck:"\u210f",planckh:"\u210e",plankv:"\u210f",plus:"+",plusacir:"\u2a23",plusb:"\u229e",pluscir:"\u2a22",plusdo:"\u2214",plusdu:"\u2a25",pluse:"\u2a72",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"\u2a26",plustwo:"\u2a27",pm:"\xb1",Poincareplane:"\u210c",pointint:"\u2a15",Popf:"\u2119",popf:"\u{1d561}",pound:"\xa3",Pr:"\u2abb",pr:"\u227a",prap:"\u2ab7",prcue:"\u227c",prE:"\u2ab3",pre:"\u2aaf",prec:"\u227a",precapprox:"\u2ab7",preccurlyeq:"\u227c",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",preceq:"\u2aaf",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",precsim:"\u227e",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2ab9",prnE:"\u2ab5",prnsim:"\u22e8",prod:"\u220f",Product:"\u220f",profalar:"\u232e",profline:"\u2312",profsurf:"\u2313",prop:"\u221d",Proportion:"\u2237",Proportional:"\u221d",propto:"\u221d",prsim:"\u227e",prurel:"\u22b0",Pscr:"\u{1d4ab}",pscr:"\u{1d4c5}",Psi:"\u03a8",psi:"\u03c8",puncsp:"\u2008",Qfr:"\u{1d514}",qfr:"\u{1d52e}",qint:"\u2a0c",Qopf:"\u211a",qopf:"\u{1d562}",qprime:"\u2057",Qscr:"\u{1d4ac}",qscr:"\u{1d4c6}",quaternions:"\u210d",quatint:"\u2a16",quest:"?",questeq:"\u225f",QUOT:'"',quot:'"',rAarr:"\u21db",race:"\u223d\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221a",raemptyv:"\u29b3",Rang:"\u27eb",rang:"\u27e9",rangd:"\u2992",range:"\u29a5",rangle:"\u27e9",raquo:"\xbb",Rarr:"\u21a0",rArr:"\u21d2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21e5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291e",rarrhk:"\u21aa",rarrlp:"\u21ac",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21a3",rarrw:"\u219d",rAtail:"\u291c",ratail:"\u291a",ratio:"\u2236",rationals:"\u211a",RBarr:"\u2910",rBarr:"\u290f",rbarr:"\u290d",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298c",rbrksld:"\u298e",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201d",rdquor:"\u201d",rdsh:"\u21b3",Re:"\u211c",real:"\u211c",realine:"\u211b",realpart:"\u211c",reals:"\u211d",rect:"\u25ad",REG:"\xae",reg:"\xae",ReverseElement:"\u220b",ReverseEquilibrium:"\u21cb",ReverseUpEquilibrium:"\u296f",rfisht:"\u297d",rfloor:"\u230b",Rfr:"\u211c",rfr:"\u{1d52f}",rHar:"\u2964",rhard:"\u21c1",rharu:"\u21c0",rharul:"\u296c",Rho:"\u03a1",rho:"\u03c1",rhov:"\u03f1",RightAngleBracket:"\u27e9",RightArrow:"\u2192",Rightarrow:"\u21d2",rightarrow:"\u2192",RightArrowBar:"\u21e5",RightArrowLeftArrow:"\u21c4",rightarrowtail:"\u21a3",RightCeiling:"\u2309",RightDoubleBracket:"\u27e7",RightDownTeeVector:"\u295d",RightDownVector:"\u21c2",RightDownVectorBar:"\u2955",RightFloor:"\u230b",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c4",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u219d",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTeeVector:"\u295b",rightthreetimes:"\u22cc",RightTriangle:"\u22b3",RightTriangleBar:"\u29d0",RightTriangleEqual:"\u22b5",RightUpDownVector:"\u294f",RightUpTeeVector:"\u295c",RightUpVector:"\u21be",RightUpVectorBar:"\u2954",RightVector:"\u21c0",RightVectorBar:"\u2953",ring:"\u02da",risingdotseq:"\u2253",rlarr:"\u21c4",rlhar:"\u21cc",rlm:"\u200f",rmoust:"\u23b1",rmoustache:"\u23b1",rnmid:"\u2aee",roang:"\u27ed",roarr:"\u21fe",robrk:"\u27e7",ropar:"\u2986",Ropf:"\u211d",ropf:"\u{1d563}",roplus:"\u2a2e",rotimes:"\u2a35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2a12",rrarr:"\u21c9",Rrightarrow:"\u21db",rsaquo:"\u203a",Rscr:"\u211b",rscr:"\u{1d4c7}",Rsh:"\u21b1",rsh:"\u21b1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22cc",rtimes:"\u22ca",rtri:"\u25b9",rtrie:"\u22b5",rtrif:"\u25b8",rtriltri:"\u29ce",RuleDelayed:"\u29f4",ruluhar:"\u2968",rx:"\u211e",Sacute:"\u015a",sacute:"\u015b",sbquo:"\u201a",Sc:"\u2abc",sc:"\u227b",scap:"\u2ab8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227d",scE:"\u2ab4",sce:"\u2ab0",Scedil:"\u015e",scedil:"\u015f",Scirc:"\u015c",scirc:"\u015d",scnap:"\u2aba",scnE:"\u2ab6",scnsim:"\u22e9",scpolint:"\u2a13",scsim:"\u227f",Scy:"\u0421",scy:"\u0441",sdot:"\u22c5",sdotb:"\u22a1",sdote:"\u2a66",searhk:"\u2925",seArr:"\u21d8",searr:"\u2198",searrow:"\u2198",sect:"\xa7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1d516}",sfr:"\u{1d530}",sfrown:"\u2322",sharp:"\u266f",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xad",Sigma:"\u03a3",sigma:"\u03c3",sigmaf:"\u03c2",sigmav:"\u03c2",sim:"\u223c",simdot:"\u2a6a",sime:"\u2243",simeq:"\u2243",simg:"\u2a9e",simgE:"\u2aa0",siml:"\u2a9d",simlE:"\u2a9f",simne:"\u2246",simplus:"\u2a24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2a33",smeparsl:"\u29e4",smid:"\u2223",smile:"\u2323",smt:"\u2aaa",smte:"\u2aac",smtes:"\u2aac\ufe00",SOFTcy:"\u042c",softcy:"\u044c",sol:"/",solb:"\u29c4",solbar:"\u233f",Sopf:"\u{1d54a}",sopf:"\u{1d564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\ufe00",sqcup:"\u2294",sqcups:"\u2294\ufe00",Sqrt:"\u221a",sqsub:"\u228f",sqsube:"\u2291",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25a1",Square:"\u25a1",square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25aa",squf:"\u25aa",srarr:"\u2192",Sscr:"\u{1d4ae}",sscr:"\u{1d4c8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22c6",Star:"\u22c6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03f5",straightphi:"\u03d5",strns:"\xaf",Sub:"\u22d0",sub:"\u2282",subdot:"\u2abd",subE:"\u2ac5",sube:"\u2286",subedot:"\u2ac3",submult:"\u2ac1",subnE:"\u2acb",subne:"\u228a",subplus:"\u2abf",subrarr:"\u2979",Subset:"\u22d0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2ac5",SubsetEqual:"\u2286",subsetneq:"\u228a",subsetneqq:"\u2acb",subsim:"\u2ac7",subsub:"\u2ad5",subsup:"\u2ad3",succ:"\u227b",succapprox:"\u2ab8",succcurlyeq:"\u227d",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",succeq:"\u2ab0",succnapprox:"\u2aba",succneqq:"\u2ab6",succnsim:"\u22e9",succsim:"\u227f",SuchThat:"\u220b",Sum:"\u2211",sum:"\u2211",sung:"\u266a",Sup:"\u22d1",sup:"\u2283",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",supdot:"\u2abe",supdsub:"\u2ad8",supE:"\u2ac6",supe:"\u2287",supedot:"\u2ac4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27c9",suphsub:"\u2ad7",suplarr:"\u297b",supmult:"\u2ac2",supnE:"\u2acc",supne:"\u228b",supplus:"\u2ac0",Supset:"\u22d1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",supsim:"\u2ac8",supsub:"\u2ad4",supsup:"\u2ad6",swarhk:"\u2926",swArr:"\u21d9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292a",szlig:"\xdf",Tab:"\t",target:"\u2316",Tau:"\u03a4",tau:"\u03c4",tbrk:"\u23b4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20db",telrec:"\u2315",Tfr:"\u{1d517}",tfr:"\u{1d531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03b8",thetasym:"\u03d1",thetav:"\u03d1",thickapprox:"\u2248",thicksim:"\u223c",ThickSpace:"\u205f\u200a",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223c",THORN:"\xde",thorn:"\xfe",Tilde:"\u223c",tilde:"\u02dc",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xd7",timesb:"\u22a0",timesbar:"\u2a31",timesd:"\u2a30",tint:"\u222d",toea:"\u2928",top:"\u22a4",topbot:"\u2336",topcir:"\u2af1",Topf:"\u{1d54b}",topf:"\u{1d565}",topfork:"\u2ada",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25b5",triangledown:"\u25bf",triangleleft:"\u25c3",trianglelefteq:"\u22b4",triangleq:"\u225c",triangleright:"\u25b9",trianglerighteq:"\u22b5",tridot:"\u25ec",trie:"\u225c",triminus:"\u2a3a",TripleDot:"\u20db",triplus:"\u2a39",trisb:"\u29cd",tritime:"\u2a3b",trpezium:"\u23e2",Tscr:"\u{1d4af}",tscr:"\u{1d4c9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040b",tshcy:"\u045b",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226c",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",Uacute:"\xda",uacute:"\xfa",Uarr:"\u219f",uArr:"\u21d1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040e",ubrcy:"\u045e",Ubreve:"\u016c",ubreve:"\u016d",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21c5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296e",ufisht:"\u297e",Ufr:"\u{1d518}",ufr:"\u{1d532}",Ugrave:"\xd9",ugrave:"\xf9",uHar:"\u2963",uharl:"\u21bf",uharr:"\u21be",uhblk:"\u2580",ulcorn:"\u231c",ulcorner:"\u231c",ulcrop:"\u230f",ultri:"\u25f8",Umacr:"\u016a",umacr:"\u016b",uml:"\xa8",UnderBar:"_",UnderBrace:"\u23df",UnderBracket:"\u23b5",UnderParenthesis:"\u23dd",Union:"\u22c3",UnionPlus:"\u228e",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1d54c}",uopf:"\u{1d566}",UpArrow:"\u2191",Uparrow:"\u21d1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21c5",UpDownArrow:"\u2195",Updownarrow:"\u21d5",updownarrow:"\u2195",UpEquilibrium:"\u296e",upharpoonleft:"\u21bf",upharpoonright:"\u21be",uplus:"\u228e",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03d2",upsi:"\u03c5",upsih:"\u03d2",Upsilon:"\u03a5",upsilon:"\u03c5",UpTee:"\u22a5",UpTeeArrow:"\u21a5",upuparrows:"\u21c8",urcorn:"\u231d",urcorner:"\u231d",urcrop:"\u230e",Uring:"\u016e",uring:"\u016f",urtri:"\u25f9",Uscr:"\u{1d4b0}",uscr:"\u{1d4ca}",utdot:"\u22f0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25b5",utrif:"\u25b4",uuarr:"\u21c8",Uuml:"\xdc",uuml:"\xfc",uwangle:"\u29a7",vangrt:"\u299c",varepsilon:"\u03f5",varkappa:"\u03f0",varnothing:"\u2205",varphi:"\u03d5",varpi:"\u03d6",varpropto:"\u221d",vArr:"\u21d5",varr:"\u2195",varrho:"\u03f1",varsigma:"\u03c2",varsubsetneq:"\u228a\ufe00",varsubsetneqq:"\u2acb\ufe00",varsupsetneq:"\u228b\ufe00",varsupsetneqq:"\u2acc\ufe00",vartheta:"\u03d1",vartriangleleft:"\u22b2",vartriangleright:"\u22b3",Vbar:"\u2aeb",vBar:"\u2ae8",vBarv:"\u2ae9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22ab",Vdash:"\u22a9",vDash:"\u22a8",vdash:"\u22a2",Vdashl:"\u2ae6",Vee:"\u22c1",vee:"\u2228",veebar:"\u22bb",veeeq:"\u225a",vellip:"\u22ee",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200a",Vfr:"\u{1d519}",vfr:"\u{1d533}",vltri:"\u22b2",vnsub:"\u2282\u20d2",vnsup:"\u2283\u20d2",Vopf:"\u{1d54d}",vopf:"\u{1d567}",vprop:"\u221d",vrtri:"\u22b3",Vscr:"\u{1d4b1}",vscr:"\u{1d4cb}",vsubnE:"\u2acb\ufe00",vsubne:"\u228a\ufe00",vsupnE:"\u2acc\ufe00",vsupne:"\u228b\ufe00",Vvdash:"\u22aa",vzigzag:"\u299a",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2a5f",Wedge:"\u22c0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1d51a}",wfr:"\u{1d534}",Wopf:"\u{1d54e}",wopf:"\u{1d568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1d4b2}",wscr:"\u{1d4cc}",xcap:"\u22c2",xcirc:"\u25ef",xcup:"\u22c3",xdtri:"\u25bd",Xfr:"\u{1d51b}",xfr:"\u{1d535}",xhArr:"\u27fa",xharr:"\u27f7",Xi:"\u039e",xi:"\u03be",xlArr:"\u27f8",xlarr:"\u27f5",xmap:"\u27fc",xnis:"\u22fb",xodot:"\u2a00",Xopf:"\u{1d54f}",xopf:"\u{1d569}",xoplus:"\u2a01",xotime:"\u2a02",xrArr:"\u27f9",xrarr:"\u27f6",Xscr:"\u{1d4b3}",xscr:"\u{1d4cd}",xsqcup:"\u2a06",xuplus:"\u2a04",xutri:"\u25b3",xvee:"\u22c1",xwedge:"\u22c0",Yacute:"\xdd",yacute:"\xfd",YAcy:"\u042f",yacy:"\u044f",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042b",ycy:"\u044b",yen:"\xa5",Yfr:"\u{1d51c}",yfr:"\u{1d536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1d550}",yopf:"\u{1d56a}",Yscr:"\u{1d4b4}",yscr:"\u{1d4ce}",YUcy:"\u042e",yucy:"\u044e",Yuml:"\u0178",yuml:"\xff",Zacute:"\u0179",zacute:"\u017a",Zcaron:"\u017d",zcaron:"\u017e",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017b",zdot:"\u017c",zeetrf:"\u2128",ZeroWidthSpace:"\u200b",Zeta:"\u0396",zeta:"\u03b6",Zfr:"\u2128",zfr:"\u{1d537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21dd",Zopf:"\u2124",zopf:"\u{1d56b}",Zscr:"\u{1d4b5}",zscr:"\u{1d4cf}",zwj:"\u200d",zwnj:"\u200c"}),e.entityMap=e.HTML_ENTITIES},918(t,e,n){"use strict";function r(t,e){t.prototype=Object.create(Error.prototype,{constructor:{value:t},name:{value:t.name,enumerable:!0,writable:e}})}var o=n(981).freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),i=Object.keys(o);function s(t){return"number"==typeof t&&t>=1&&t<=25}function a(t,e){var n;s(t)?(this.name=i[t],this.message=e||""):(this.message=t,this.name="string"==typeof(n=e)&&n.substring(n.length-o.Error.length)===o.Error?e:o.Error),Error.captureStackTrace&&Error.captureStackTrace(this,a)}r(a,!0),Object.defineProperties(a.prototype,{code:{enumerable:!0,get:function(){var t=i.indexOf(this.name);return s(t)?t:0}}});for(var c={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},l=Object.entries(c),u=0;u<l.length;u++){a[l[u][0]]=l[u][1]}function h(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,h)}r(h),e.DOMException=a,e.DOMExceptionName=o,e.ExceptionCode=c,e.ParseError=h},112(t,e){"use strict";function n(t){try{"function"!=typeof t&&(t=RegExp);var e=new t("\u{1d306}","u").exec("\u{1d306}");return!!e&&2===e[0].length}catch(t){}return!1}var r=n();function o(t){if("["!==t.source[0])throw new Error(t+" can not be used with chars");return t.source.slice(1,t.source.lastIndexOf("]"))}function i(t,e){if("["!==t.source[0])throw new Error("/"+t.source+"/ can not be used with chars_without");if(!e||"string"!=typeof e)throw new Error(JSON.stringify(e)+" is not a valid search");if(-1===t.source.indexOf(e))throw new Error('"'+e+'" is not is /'+t.source+"/");if("-"===e&&1!==t.source.indexOf(e))throw new Error('"'+e+'" is not at the first postion of /'+t.source+"/");return new RegExp(t.source.replace(e,""),r?"u":"")}function s(t){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var n="string"==typeof t;if(n&&void 0===e&&"|"===t)throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?t:t.source}).join(""),r?"mu":"m")}function a(t){if(0===arguments.length)throw new Error("no parameters provided");return s.apply(a,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var c=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;r&&(c=s("[",o(c),"\\u{10000}-\\u{10FFFF}","]"));var l=new RegExp("[^"+o(c)+"]",r?"u":""),u=/[\x20\x09\x0D\x0A]/,h=o(u),d=s(u,"+"),f=s(u,"*"),p=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;r&&(p=s("[",o(p),"\\u{10000}-\\u{10FFFF}","]"));var m=s("[",o(p),o(/[-.0-9\xB7]/),o(/[\u0300-\u036F\u203F-\u2040]/),"]"),g=s(p,m,"*"),E=s(m,"+"),N=s("&",g,";"),S=a(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),T=a(N,"|",S),I=s("%",g,";"),A=a(s('"',a(/[^%&"]/,"|",I,"|",T),"*",'"'),"|",s("'",a(/[^%&']/,"|",I,"|",T),"*","'")),b=a('"',a(/[^<&"]/,"|",T),"*",'"',"|","'",a(/[^<&']/,"|",T),"*","'"),R=s(i(p,":"),i(m,":"),"*"),O=s(R,a(":",R),"?"),y=s("^",O,"$"),C=s("(",O,")"),L=a(/"[^"]*"|'[^']*'/),M=s(/^<\?/,"(",g,")",a(d,"(",c,"*?)"),"?",/\?>/),v=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,w=a('"',v,'*"',"|","'",i(v,"'"),"*'"),D="\x3c!--",P=s(D,a(i(c,"-"),"|",s("-",i(c,"-"))),"*","--\x3e"),_="#PCDATA",x=a(s(/\(/,f,_,a(f,/\|/,f,O),"*",f,/\)\*/),"|",s(/\(/,f,_,f,/\)/)),F=a("EMPTY","|","ANY","|",x,"|",s(/\([^>]+\)/,/[?*+]?/)),U=s("<!ELEMENT",d,a(O,"|",I),d,a(F,"|",I),f,">"),k=s("NOTATION",d,/\(/,f,g,a(f,/\|/,f,g),"*",f,/\)/),B=s(/\(/,f,E,a(f,/\|/,f,E),"*",f,/\)/),G=a(k,"|",B),V=a(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",G),H=a(/#REQUIRED|#IMPLIED/,"|",a(a("#FIXED",d),"?",b)),j=s("<!ATTLIST",d,g,a(d,g,d,V,d,H),"*",f,">"),q="about:legacy-compat",$=a('"'+q+'"',"|","'"+q+"'"),X="SYSTEM",Y="PUBLIC",W=a(a(X,d,L),"|",a(Y,d,w,d,L)),K=s("^",a(a(X,d,"(?<SystemLiteralOnly>",L,")"),"|",a(Y,d,"(?<PubidLiteral>",w,")",d,"(?<SystemLiteral>",L,")"))),z=s("^",w,"$"),Q=s("^",L,"$"),J=a(d,"NDATA",d,g),Z="<!ENTITY",tt=s(Z,d,g,d,a(A,"|",a(W,J,"?")),f,">"),et=a(A,"|",W),nt=a(tt,"|",s(Z,d,"%",d,g,d,et,f,">")),rt=s(Y,d,w),ot=s("<!NOTATION",d,g,d,a(W,"|",rt),f,">"),it=s(f,"=",f),st=/1[.]\d+/,at=s(d,"version",it,a("'",st,"'","|",'"',st,'"')),ct=/[A-Za-z][-A-Za-z0-9._]*/,lt=s(/^<\?xml/,at,a(d,"encoding",it,a('"',ct,'"',"|","'",ct,"'")),"?",a(d,"standalone",it,a("'",a("yes","|","no"),"'","|",'"',a("yes","|","no"),'"')),"?",f,/\?>/),ut=s(c,"*?",/\]\]>/),ht=s(/<!\[CDATA\[/,ut);e.chars=o,e.chars_without=i,e.detectUnicodeSupport=n,e.reg=s,e.regg=a,e.ABOUT_LEGACY_COMPAT=q,e.ABOUT_LEGACY_COMPAT_SystemLiteral=$,e.AttlistDecl=j,e.CDATA_START="<![CDATA[",e.CDATA_END="]]>",e.CDSect=ht,e.Char=c,e.Comment=P,e.COMMENT_START=D,e.COMMENT_END="--\x3e",e.DOCTYPE_DECL_START="<!DOCTYPE",e.elementdecl=U,e.EntityDecl=nt,e.EntityValue=A,e.ExternalID=W,e.ExternalID_match=K,e.Name=g,e.NotationDecl=ot,e.Reference=T,e.PEReference=I,e.PI=M,e.PUBLIC=Y,e.PubidLiteral=w,e.PubidLiteral_match=z,e.QName=O,e.QName_exact=y,e.QName_group=C,e.S=d,e.SChar_s=h,e.S_OPT=f,e.SYSTEM=X,e.SystemLiteral=L,e.SystemLiteral_match=Q,e.InvalidChar=l,e.UNICODE_REPLACEMENT_CHARACTER="\ufffd",e.UNICODE_SUPPORT=r,e.XMLDecl=lt},841(t,e,n){"use strict";var r=n(981);e.assign=r.assign,e.hasDefaultHTMLNamespace=r.hasDefaultHTMLNamespace,e.isHTMLMimeType=r.isHTMLMimeType,e.isValidMimeType=r.isValidMimeType,e.MIME_TYPE=r.MIME_TYPE,e.NAMESPACE=r.NAMESPACE;var o=n(918);e.DOMException=o.DOMException,e.DOMExceptionName=o.DOMExceptionName,e.ExceptionCode=o.ExceptionCode,e.ParseError=o.ParseError;var i=n(553);e.Attr=i.Attr,e.CDATASection=i.CDATASection,e.CharacterData=i.CharacterData,e.Comment=i.Comment,e.Document=i.Document,e.DocumentFragment=i.DocumentFragment,e.DocumentType=i.DocumentType,e.DOMImplementation=i.DOMImplementation,e.Element=i.Element,e.Entity=i.Entity,e.EntityReference=i.EntityReference,e.LiveNodeList=i.LiveNodeList,e.NamedNodeMap=i.NamedNodeMap,e.Node=i.Node,e.NodeList=i.NodeList,e.Notation=i.Notation,e.ProcessingInstruction=i.ProcessingInstruction,e.Text=i.Text,e.XMLSerializer=i.XMLSerializer;var s=n(985);e.DOMParser=s.DOMParser,e.normalizeLineEndings=s.normalizeLineEndings,e.onErrorStopParsing=s.onErrorStopParsing,e.onWarningStopParsing=s.onWarningStopParsing},309(t,e,n){"use strict";var r=n(981),o=n(112),i=n(918),s=r.isHTMLEscapableRawTextElement,a=r.isHTMLMimeType,c=r.isHTMLRawTextElement,l=r.hasOwn,u=r.NAMESPACE,h=i.ParseError,d=i.DOMException;function f(){}f.prototype={parse:function(t,e,n){var i=this.domBuilder;i.startDocument(),S(e,e=Object.create(null)),function(t,e,n,i,s){var c=a(i.mimeType);t.indexOf(o.UNICODE_REPLACEMENT_CHARACTER)>=0&&s.warning("Unicode replacement character detected, source encoding issues?");function u(t){if(t>65535){var e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}function f(t){var e=";"===t[t.length-1]?t:t+";";if(!c&&e!==t)return s.error("EntityRef: expecting ;"),t;var r=o.Reference.exec(e);if(!r||r[0].length!==e.length)return s.error("entity not matching Reference production: "+t),t;var i=e.slice(1,-1);return l(n,i)?n[i]:"#"===i.charAt(0)?u(parseInt(i.substring(1).replace("x","0x"))):(s.error("entity not found:"+t),t)}function S(e){if(e>v){var n=t.substring(v,e).replace(p,f);y&&C(v),i.characters(n,0,e-v),v=e}}var T=0,R=0,O=/\r\n?|\n|$/g,y=i.locator;function C(e,n){for(;e>=R&&(n=O.exec(t));)T=R,R=n.index+n[0].length,y.lineNumber++;y.columnNumber=e-T+1}var L=[{currentNSMap:e}],M=[],v=0;for(;;){try{var w=t.indexOf("<",v);if(w<0){if(!c&&M.length>0)return s.fatalError("unclosed xml tag(s): "+M.join(", "));if(!t.substring(v).match(/^\s*$/)){var D=i.doc,P=D.createTextNode(t.substring(v));if(D.documentElement)return s.error("Extra content at the end of the document");D.appendChild(P),i.currentElement=P}return}if(w>v){var _=t.substring(v,w);c||0!==M.length||(_=_.replace(new RegExp(o.S_OPT.source,"g"),""))&&s.error("Unexpected content outside root element: '"+_+"'"),S(w)}switch(t.charAt(w+1)){case"/":var x=t.indexOf(">",w+2),F=t.substring(w+2,x>0?x:void 0);if(!F)return s.fatalError("end tag name missing");var U=x>0&&o.reg("^",o.QName_group,o.S_OPT,"$").exec(F);if(!U)return s.fatalError('end tag name contains invalid characters: "'+F+'"');if(!i.currentElement&&!i.doc.documentElement)return;var k=M[M.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(k!==U[1]){var B=U[1].toLowerCase();if(!c||k.toLowerCase()!==B)return s.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+F+'"')}var G=L.pop();M.pop();var V=G.localNSMap;if(i.endElement(G.uri,G.localName,k),V)for(var H in V)l(V,H)&&i.endPrefixMapping(H);x++;break;case"?":y&&C(w),x=A(t,w,i,s);break;case"!":y&&C(w),x=I(t,w,i,s,c);break;default:y&&C(w);var j=new b,q=L[L.length-1].currentNSMap,$=(x=g(t,w,j,q,f,s,c),j.length);if(j.closed||(c&&r.isHTMLVoidElement(j.tagName)?j.closed=!0:M.push(j.tagName)),y&&$){for(var X=m(y,{}),Y=0;Y<$;Y++){var W=j[Y];C(W.offset),W.locator=m(y,{})}i.locator=X,E(j,i,q)&&L.push(j),i.locator=y}else E(j,i,q)&&L.push(j);c&&!j.closed?x=N(t,x,j.tagName,f,i):x++}}catch(t){if(t instanceof h)throw t;if(t instanceof d)throw new h(t.name+": "+t.message,i.locator,t);s.error("element parse error: "+t),x=-1}x>v?v=x:S(Math.max(w,v)+1)}}(t,e,n,i,this.errorHandler),i.endDocument()}};var p=/&#?\w+;?/g;function m(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function g(t,e,n,r,o,i,s){function a(t,e,r){return l(n.attributeNames,t)?i.fatalError("Attribute "+t+" redefined"):!s&&e.indexOf("<")>=0?i.fatalError("Unescaped '<' not allowed in attributes values"):void n.addValue(t,e.replace(/[\t\n\r]/g," ").replace(p,o),r)}for(var c,u=++e,h=0;;){var d=t.charAt(u);switch(d){case"=":if(1===h)c=t.slice(e,u),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(i.warning('attribute value must after "="'),c=t.slice(e,u)),e=u+1,!((u=t.indexOf(d,e))>0))throw new Error("attribute value no end '"+d+"' match");a(c,f=t.slice(e,u),e-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');a(c,f=t.slice(e,u),e),i.warning('attribute "'+c+'" missed start quot('+d+")!!"),e=u+1,h=5}break;case"/":switch(h){case 0:n.setTagName(t.slice(e,u));case 5:case 6:case 7:h=7,n.closed=!0;case 4:case 1:break;case 2:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),0==h&&n.setTagName(t.slice(e,u)),u;case">":switch(h){case 0:n.setTagName(t.slice(e,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(f=t.slice(e,u)).slice(-1)&&(n.closed=!0,f=f.slice(0,-1));case 2:2===h&&(f=c),4==h?(i.warning('attribute "'+f+'" missed quot(")!'),a(c,f,e)):(s||i.warning('attribute "'+f+'" missed value!! "'+f+'" instead!!'),a(f,f,e));break;case 3:if(!s)return i.fatalError("AttValue: ' or \" expected")}return u;case"\x80":d=" ";default:if(d<=" ")switch(h){case 0:n.setTagName(t.slice(e,u)),h=6;break;case 1:c=t.slice(e,u),h=2;break;case 4:var f=t.slice(e,u);i.warning('attribute "'+f+'" missed quot(")!!'),a(c,f,e);case 5:h=6}else switch(h){case 2:s||i.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),a(c,c,e),e=u,h=1;break;case 5:i.warning('attribute space is required"'+c+'"!!');case 6:h=1,e=u;break;case 3:h=4,e=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function E(t,e,n){for(var r=t.tagName,o=null,i=t.length;i--;){var s=t[i],a=s.qName,c=s.value;if((p=a.indexOf(":"))>0)var h=s.prefix=a.slice(0,p),d=a.slice(p+1),f="xmlns"===h&&d;else d=a,h=null,f="xmlns"===a&&"";s.localName=d,!1!==f&&(null==o&&(o=Object.create(null),S(n,n=Object.create(null))),n[f]=o[f]=c,s.uri=u.XMLNS,e.startPrefixMapping(f,c))}for(i=t.length;i--;)(s=t[i]).prefix&&("xml"===s.prefix&&(s.uri=u.XML),"xmlns"!==s.prefix&&(s.uri=n[s.prefix]));var p;(p=r.indexOf(":"))>0?(h=t.prefix=r.slice(0,p),d=t.localName=r.slice(p+1)):(h=null,d=t.localName=r);var m=t.uri=n[h||""];if(e.startElement(m,d,r,t),!t.closed)return t.currentNSMap=n,t.localNSMap=o,!0;if(e.endElement(m,d,r),o)for(h in o)l(o,h)&&e.endPrefixMapping(h)}function N(t,e,n,r,o){var i=s(n);if(i||c(n)){var a=t.indexOf("</"+n+">",e),l=t.substring(e+1,a);return i&&(l=l.replace(p,r)),o.characters(l,0,l.length),a}return e+1}function S(t,e){for(var n in t)l(t,n)&&(e[n]=t[n])}function T(t,e){var n=e;function r(e){return e=e||0,t.charAt(n+e)}function i(t){n+=t=t||1}function s(){return t.substring(n)}return{char:r,getIndex:function(){return n},getMatch:function(t){var e=o.reg("^",t).exec(s());return e?(i(e[0].length),e[0]):null},getSource:function(){return t},skip:i,skipBlanks:function(){for(var e=0;n<t.length;){var o=r();if(" "!==o&&"\n"!==o&&"\t"!==o&&"\r"!==o)return e;e++,i()}return-1},substringFromIndex:s,substringStartsWith:function(e){return t.substring(n,n+e.length)===e},substringStartsWithCaseInsensitive:function(e){return t.substring(n,n+e.length).toUpperCase()===e.toUpperCase()}}}function I(t,e,n,r,i){var s=T(t,e);switch(i?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(o.Comment);return a?(n.comment(a,o.COMMENT_START.length,a.length-o.COMMENT_START.length-o.COMMENT_END.length),s.getIndex()):r.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var c=s.getMatch(o.CDSect);return c?i||n.currentElement?(n.startCDATA(),n.characters(c,o.CDATA_START.length,c.length-o.CDATA_START.length-o.CDATA_END.length),n.endCDATA(),s.getIndex()):r.fatalError("CDATA outside of element"):r.fatalError("Invalid CDATA starting at position "+e);case"D":if(n.doc&&n.doc.documentElement)return r.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(i?!s.substringStartsWithCaseInsensitive(o.DOCTYPE_DECL_START):!s.substringStartsWith(o.DOCTYPE_DECL_START))return r.fatalError("Expected "+o.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(o.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+o.DOCTYPE_DECL_START+" at position "+s.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=s.getMatch(o.Name),!l.name)return r.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(i&&"html"!==l.name.toLowerCase()&&r.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(o.PUBLIC)||s.substringStartsWith(o.SYSTEM)){var u=o.ExternalID_match.exec(s.substringFromIndex());if(!u)return r.fatalError("doctype external id is not well-formed at position "+s.getIndex());void 0!==u.groups.SystemLiteralOnly?l.systemId=u.groups.SystemLiteralOnly:(l.systemId=u.groups.SystemLiteral,l.publicId=u.groups.PubidLiteral),s.skip(u[0].length)}else if(i&&s.substringStartsWithCaseInsensitive(o.SYSTEM)){if(s.skip(o.SYSTEM.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+o.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(o.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return r.fatalError("Expected "+o.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+o.SYSTEM+" at position "+s.getIndex())}return i&&l.systemId&&!o.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&r.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),i||(s.skipBlanks(),l.internalSubset=function(t,e){function n(t,e){var n=o.PI.exec(t.substringFromIndex());return n?"xml"===n[1].toLowerCase()?e.fatalError("xml declaration is only allowed at the start of the document, but found at position "+t.getIndex()):(t.skip(n[0].length),n[0]):e.fatalError("processing instruction is not well-formed at position "+t.getIndex())}var r=t.getSource();if("["===t.char()){t.skip(1);for(var i=t.getIndex();t.getIndex()<r.length;){if(t.skipBlanks(),"]"===t.char()){var s=r.substring(i,t.getIndex());return t.skip(1),s}var a=null;if("<"===t.char()&&"!"===t.char(1))switch(t.char(2)){case"E":"L"===t.char(3)?a=t.getMatch(o.elementdecl):"N"===t.char(3)&&(a=t.getMatch(o.EntityDecl));break;case"A":a=t.getMatch(o.AttlistDecl);break;case"N":a=t.getMatch(o.NotationDecl);break;case"-":a=t.getMatch(o.Comment)}else if("<"===t.char()&&"?"===t.char(1))a=n(t,e);else{if("%"!==t.char())return e.fatalError("Error detected in Markup declaration");a=t.getMatch(o.PEReference)}if(!a)return e.fatalError("Error in internal subset at position "+t.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}(s,r)),s.skipBlanks(),">"!==s.char()?r.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),n.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),n.endDTD(),s.getIndex());default:return r.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function A(t,e,n,r){var i=t.substring(e).match(o.PI);if(!i)return r.fatalError("Invalid processing instruction starting at position "+e);if("xml"===i[1].toLowerCase()){if(e>0)return r.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!o.XMLDecl.test(t.substring(e)))return r.fatalError("xml declaration is not well-formed")}return n.processingInstruction(i[1],i[2]),e+i[0].length}function b(){this.attributeNames=Object.create(null)}b.prototype={setTagName:function(t){if(!o.QName_exact.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!o.QName_exact.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},e.XMLReader=f,e.parseUtils=T,e.parseDoctypeCommentOrCData=I},999(t,e,n){(function(){"use strict";var e=this;function n(t){return"string"==typeof t}function r(t,e,n){return t.call.apply(t.bind,arguments)}function o(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function i(t,e,n){return(i=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?r:o).apply(null,arguments)}function s(t){var e=st;function n(){}n.prototype=e.prototype,t.G=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.F=function(t,n,r){for(var o=Array(arguments.length-2),i=2;i<arguments.length;i++)o[i-2]=arguments[i];return e.prototype[n].apply(t,o)}}var a=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function c(t,e){return-1!=t.indexOf(e)}function l(t,e){return t<e?-1:t>e?1:0}var u,h=Array.prototype.indexOf?function(t,e,n){return Array.prototype.indexOf.call(t,e,n)}:function(t,e,r){if(r=null==r?0:0>r?Math.max(0,t.length+r):r,n(t))return n(e)&&1==e.length?t.indexOf(e,r):-1;for(;r<t.length;r++)if(r in t&&t[r]===e)return r;return-1},d=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,s=0;s<o;s++)s in i&&e.call(r,i[s],s,t)},f=Array.prototype.filter?function(t,e,n){return Array.prototype.filter.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=[],s=0,a=n(t)?t.split(""):t,c=0;c<o;c++)if(c in a){var l=a[c];e.call(r,l,c,t)&&(i[s++]=l)}return i},p=Array.prototype.reduce?function(t,e,n,r){return r&&(e=i(e,r)),Array.prototype.reduce.call(t,e,n)}:function(t,e,n,r){var o=n;return d(t,function(n,i){o=e.call(r,o,n,i,t)}),o},m=Array.prototype.some?function(t,e,n){return Array.prototype.some.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,s=0;s<o;s++)if(s in i&&e.call(r,i[s],s,t))return!0;return!1};t:{var g=e.navigator;if(g){var E=g.userAgent;if(E){u=E;break t}}u=""}var N,S,T=c(u,"Opera")||c(u,"OPR"),I=c(u,"Trident")||c(u,"MSIE"),A=c(u,"Edge"),b=c(u,"Gecko")&&!(c(u.toLowerCase(),"webkit")&&!c(u,"Edge"))&&!(c(u,"Trident")||c(u,"MSIE"))&&!c(u,"Edge"),R=c(u.toLowerCase(),"webkit")&&!c(u,"Edge");function O(){var t=e.document;return t?t.documentMode:void 0}t:{var y="",C=(S=u,b?/rv\:([^\);]+)(\)|;)/.exec(S):A?/Edge\/([\d\.]+)/.exec(S):I?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(S):R?/WebKit\/(\S+)/.exec(S):T?/(?:Version)[ \/]?(\S+)/.exec(S):void 0);if(C&&(y=C?C[1]:""),I){var L=O();if(null!=L&&L>parseFloat(y)){N=String(L);break t}}N=y}var M={};function v(t){if(!M[t]){for(var e=0,n=a(String(N)).split("."),r=a(String(t)).split("."),o=Math.max(n.length,r.length),i=0;0==e&&i<o;i++){var s=n[i]||"",c=r[i]||"",u=/(\d*)(\D*)/g,h=/(\d*)(\D*)/g;do{var d=u.exec(s)||["","",""],f=h.exec(c)||["","",""];if(0==d[0].length&&0==f[0].length)break;e=l(0==d[1].length?0:parseInt(d[1],10),0==f[1].length?0:parseInt(f[1],10))||l(0==d[2].length,0==f[2].length)||l(d[2],f[2])}while(0==e)}M[t]=0<=e}}var w=e.document,D=w&&I?O()||("CSS1Compat"==w.compatMode?parseInt(N,10):5):void 0,P=I&&!(9<=Number(D)),_=I&&!(8<=Number(D));function x(t,e,n,r){this.a=t,this.nodeName=n,this.nodeValue=r,this.nodeType=2,this.parentNode=this.ownerElement=e}function F(t,e){var n=_&&"href"==e.nodeName?t.getAttribute(e.nodeName,2):e.nodeValue;return new x(e,t,e.nodeName,n)}function U(t){var e=null;if(1==(n=t.nodeType)&&(e=null==(e=null==(e=t.textContent)||null==e?t.innerText:e)||null==e?"":e),"string"!=typeof e)if(P&&"title"==t.nodeName.toLowerCase()&&1==n)e=t.text;else if(9==n||1==n){t=9==n?t.documentElement:t.firstChild;var n=0,r=[];for(e="";t;){do{1!=t.nodeType&&(e+=t.nodeValue),P&&"title"==t.nodeName.toLowerCase()&&(e+=t.text),r[n++]=t}while(t=t.firstChild);for(;n&&!(t=r[--n].nextSibling););}}else e=t.nodeValue;return""+e}function k(t,e,n){if(null===e)return!0;try{if(!t.getAttribute)return!1}catch(t){return!1}return _&&"class"==e&&(e="className"),null==n?!!t.getAttribute(e):t.getAttribute(e,2)==n}function B(t,e,r,o,i){return(P?G:V).call(null,t,e,n(r)?r:null,n(o)?o:null,i||new z)}function G(t,e,n,r,o){if(t instanceof _t||8==t.b||n&&null===t.b){var i=e.all;if(!i)return o;if("*"!=(t=$(t))&&!(i=e.getElementsByTagName(t)))return o;if(n){for(var s=[],a=0;e=i[a++];)k(e,n,r)&&s.push(e);i=s}for(a=0;e=i[a++];)"*"==t&&"!"==e.tagName||tt(o,e);return o}return q(t,e,n,r,o),o}function V(t,e,n,r,o){return e.getElementsByName&&r&&"name"==n&&!I?(e=e.getElementsByName(r),d(e,function(e){t.a(e)&&tt(o,e)})):e.getElementsByClassName&&r&&"class"==n?(e=e.getElementsByClassName(r),d(e,function(e){e.className==r&&t.a(e)&&tt(o,e)})):t instanceof Ot?q(t,e,n,r,o):e.getElementsByTagName&&(e=e.getElementsByTagName(t.f()),d(e,function(t){k(t,n,r)&&tt(o,t)})),o}function H(t,e,n,r,o){var i;if((t instanceof _t||8==t.b||n&&null===t.b)&&(i=e.childNodes)){var s=$(t);return"*"==s||(i=f(i,function(t){return t.tagName&&t.tagName.toLowerCase()==s}),i)?(n&&(i=f(i,function(t){return k(t,n,r)})),d(i,function(t){"*"==s&&("!"==t.tagName||"*"==s&&1!=t.nodeType)||tt(o,t)}),o):o}return j(t,e,n,r,o)}function j(t,e,n,r,o){for(e=e.firstChild;e;e=e.nextSibling)k(e,n,r)&&t.a(e)&&tt(o,e);return o}function q(t,e,n,r,o){for(e=e.firstChild;e;e=e.nextSibling)k(e,n,r)&&t.a(e)&&tt(o,e),q(t,e,n,r,o)}function $(t){if(t instanceof Ot){if(8==t.b)return"!";if(null===t.b)return"*"}return t.f()}function X(t,e){if(!t||!e)return!1;if(t.contains&&1==e.nodeType)return t==e||t.contains(e);if(void 0!==t.compareDocumentPosition)return t==e||!!(16&t.compareDocumentPosition(e));for(;e&&t!=e;)e=e.parentNode;return e==t}function Y(t,n){if(t==n)return 0;if(t.compareDocumentPosition)return 2&t.compareDocumentPosition(n)?1:-1;if(I&&!(9<=Number(D))){if(9==t.nodeType)return-1;if(9==n.nodeType)return 1}if("sourceIndex"in t||t.parentNode&&"sourceIndex"in t.parentNode){var r=1==t.nodeType,o=1==n.nodeType;if(r&&o)return t.sourceIndex-n.sourceIndex;var i=t.parentNode,s=n.parentNode;return i==s?K(t,n):!r&&X(i,n)?-1*W(t,n):!o&&X(s,t)?W(n,t):(r?t.sourceIndex:i.sourceIndex)-(o?n.sourceIndex:s.sourceIndex)}return(r=(o=9==t.nodeType?t:t.ownerDocument||t.document).createRange()).selectNode(t),r.collapse(!0),(o=o.createRange()).selectNode(n),o.collapse(!0),r.compareBoundaryPoints(e.Range.START_TO_END,o)}function W(t,e){var n=t.parentNode;if(n==e)return-1;for(var r=e;r.parentNode!=n;)r=r.parentNode;return K(r,t)}function K(t,e){for(var n=e;n=n.previousSibling;)if(n==t)return-1;return 1}function z(){this.b=this.a=null,this.l=0}function Q(t){this.node=t,this.a=this.b=null}function J(t,e){if(!t.a)return e;if(!e.a)return t;for(var n=t.a,r=e.a,o=null,i=null,s=0;n&&r;){i=n.node;var a=r.node;i==a||i instanceof x&&a instanceof x&&i.a==a.a?(i=n,n=n.a,r=r.a):0<Y(n.node,r.node)?(i=r,r=r.a):(i=n,n=n.a),(i.b=o)?o.a=i:t.a=i,o=i,s++}for(i=n||r;i;)i.b=o,o=o.a=i,s++,i=i.a;return t.b=o,t.l=s,t}function Z(t,e){var n=new Q(e);n.a=t.a,t.b?t.a.b=n:t.a=t.b=n,t.a=n,t.l++}function tt(t,e){var n=new Q(e);n.b=t.b,t.a?t.b.a=n:t.a=t.b=n,t.b=n,t.l++}function et(t){return(t=t.a)?t.node:null}function nt(t){return(t=et(t))?U(t):""}function rt(t,e){return new ot(t,!!e)}function ot(t,e){this.f=t,this.b=(this.c=e)?t.b:t.a,this.a=null}function it(t){var e=t.b;if(null==e)return null;var n=t.a=e;return t.b=t.c?e.b:e.a,n.node}function st(t){this.i=t,this.b=this.g=!1,this.f=null}function at(t){return"\n "+t.toString().split("\n").join("\n ")}function ct(t,e){t.g=e}function lt(t,e){t.b=e}function ut(t,e){var n=t.a(e);return n instanceof z?+nt(n):+n}function ht(t,e){var n=t.a(e);return n instanceof z?nt(n):""+n}function dt(t,e){var n=t.a(e);return n instanceof z?!!n.l:!!n}function ft(t,e,n){st.call(this,t.i),this.c=t,this.h=e,this.o=n,this.g=e.g||n.g,this.b=e.b||n.b,this.c==Nt&&(n.b||n.g||4==n.i||0==n.i||!e.f?e.b||e.g||4==e.i||0==e.i||!n.f||(this.f={name:n.f.name,s:e}):this.f={name:e.f.name,s:n})}function pt(t,e,n,r,o){var i;if(e=e.a(r),n=n.a(r),e instanceof z&&n instanceof z){for(r=it(e=rt(e));r;r=it(e))for(i=it(o=rt(n));i;i=it(o))if(t(U(r),U(i)))return!0;return!1}if(e instanceof z||n instanceof z){e instanceof z?(o=e,r=n):(o=n,r=e);for(var s=typeof r,a=it(i=rt(o));a;a=it(i)){switch(s){case"number":a=+U(a);break;case"boolean":a=!!U(a);break;case"string":a=U(a);break;default:throw Error("Illegal primitive type for comparison.")}if(o==e&&t(a,r)||o==n&&t(r,a))return!0}return!1}return o?"boolean"==typeof e||"boolean"==typeof n?t(!!e,!!n):"number"==typeof e||"number"==typeof n?t(+e,+n):t(e,n):t(+e,+n)}function mt(t,e,n,r){this.a=t,this.w=e,this.i=n,this.m=r}!b&&!I||I&&9<=Number(D)||b&&v("1.9.1"),I&&v("9"),s(ft),ft.prototype.a=function(t){return this.c.m(this.h,this.o,t)},ft.prototype.toString=function(){return"Binary Expression: "+this.c+at(this.h)+at(this.o)},mt.prototype.toString=function(){return this.a};var gt={};function Et(t,e,n,r){if(gt.hasOwnProperty(t))throw Error("Binary operator already created: "+t);return t=new mt(t,e,n,r),gt[t.toString()]=t}Et("div",6,1,function(t,e,n){return ut(t,n)/ut(e,n)}),Et("mod",6,1,function(t,e,n){return ut(t,n)%ut(e,n)}),Et("*",6,1,function(t,e,n){return ut(t,n)*ut(e,n)}),Et("+",5,1,function(t,e,n){return ut(t,n)+ut(e,n)}),Et("-",5,1,function(t,e,n){return ut(t,n)-ut(e,n)}),Et("<",4,2,function(t,e,n){return pt(function(t,e){return t<e},t,e,n)}),Et(">",4,2,function(t,e,n){return pt(function(t,e){return t>e},t,e,n)}),Et("<=",4,2,function(t,e,n){return pt(function(t,e){return t<=e},t,e,n)}),Et(">=",4,2,function(t,e,n){return pt(function(t,e){return t>=e},t,e,n)});var Nt=Et("=",3,2,function(t,e,n){return pt(function(t,e){return t==e},t,e,n,!0)});function St(t,e,n){this.a=t,this.b=e||1,this.f=n||1}function Tt(t,e){if(e.a.length&&4!=t.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");st.call(this,t.i),this.c=t,this.h=e,this.g=t.g,this.b=t.b}function It(t,e){if(e.length<t.A)throw Error("Function "+t.j+" expects at least"+t.A+" arguments, "+e.length+" given");if(null!==t.v&&e.length>t.v)throw Error("Function "+t.j+" expects at most "+t.v+" arguments, "+e.length+" given");t.B&&d(e,function(e,n){if(4!=e.i)throw Error("Argument "+n+" to function "+t.j+" is not of type Nodeset: "+e)}),st.call(this,t.i),this.h=t,this.c=e,ct(this,t.g||m(e,function(t){return t.g})),lt(this,t.D&&!e.length||t.C&&!!e.length||m(e,function(t){return t.b}))}function At(t,e,n,r,o,i,s,a,c){this.j=t,this.i=e,this.g=n,this.D=r,this.C=o,this.m=i,this.A=s,this.v=void 0!==a?a:s,this.B=!!c}Et("!=",3,2,function(t,e,n){return pt(function(t,e){return t!=e},t,e,n,!0)}),Et("and",2,2,function(t,e,n){return dt(t,n)&&dt(e,n)}),Et("or",1,2,function(t,e,n){return dt(t,n)||dt(e,n)}),s(Tt),Tt.prototype.a=function(t){return t=this.c.a(t),Vt(this.h,t)},Tt.prototype.toString=function(){return"Filter:"+at(this.c)+at(this.h)},s(It),It.prototype.a=function(t){return this.h.m.apply(null,function(t){return Array.prototype.concat.apply(Array.prototype,arguments)}(t,this.c))},It.prototype.toString=function(){var t="Function: "+this.h;if(this.c.length){var e=p(this.c,function(t,e){return t+at(e)},"Arguments:");t=t+at(e)}return t},At.prototype.toString=function(){return this.j};var bt={};function Rt(t,e,n,r,o,i,s,a){if(bt.hasOwnProperty(t))throw Error("Function already created: "+t+".");bt[t]=new At(t,e,n,r,!1,o,i,s,a)}function Ot(t,e){switch(this.h=t,this.c=void 0!==e?e:null,this.b=null,t){case"comment":this.b=8;break;case"text":this.b=3;break;case"processing-instruction":this.b=7;break;case"node":break;default:throw Error("Unexpected argument")}}function yt(t){return"comment"==t||"text"==t||"processing-instruction"==t||"node"==t}function Ct(t){this.b=t,this.a=0}Rt("boolean",2,!1,!1,function(t,e){return dt(e,t)},1),Rt("ceiling",1,!1,!1,function(t,e){return Math.ceil(ut(e,t))},1),Rt("concat",3,!1,!1,function(t,e){return p(function(t,e,n){return 2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,n)}(arguments,1),function(e,n){return e+ht(n,t)},"")},2,null),Rt("contains",2,!1,!1,function(t,e,n){return c(ht(e,t),ht(n,t))},2),Rt("count",1,!1,!1,function(t,e){return e.a(t).l},1,1,!0),Rt("false",2,!1,!1,function(){return!1},0),Rt("floor",1,!1,!1,function(t,e){return Math.floor(ut(e,t))},1),Rt("id",4,!1,!1,function(t,e){function r(t){if(P){var e=o.all[t];if(e){if(e.nodeType&&t==e.id)return e;if(e.length)return function(t,e){var r;t:{r=t.length;for(var o=n(t)?t.split(""):t,i=0;i<r;i++)if(i in o&&e.call(void 0,o[i],i,t)){r=i;break t}r=-1}return 0>r?null:n(t)?t.charAt(r):t[r]}(e,function(e){return t==e.id})}return null}return o.getElementById(t)}var o=9==(i=t.a).nodeType?i:i.ownerDocument,i=ht(e,t).split(/\s+/),s=[];d(i,function(t){!(t=r(t))||0<=h(s,t)||s.push(t)}),s.sort(Y);var a=new z;return d(s,function(t){tt(a,t)}),a},1),Rt("lang",2,!1,!1,function(){return!1},1),Rt("last",1,!0,!1,function(t){if(1!=arguments.length)throw Error("Function last expects ()");return t.f},0),Rt("local-name",3,!1,!0,function(t,e){var n=e?et(e.a(t)):t.a;return n?n.localName||n.nodeName.toLowerCase():""},0,1,!0),Rt("name",3,!1,!0,function(t,e){var n=e?et(e.a(t)):t.a;return n?n.nodeName.toLowerCase():""},0,1,!0),Rt("namespace-uri",3,!0,!1,function(){return""},0,1,!0),Rt("normalize-space",3,!1,!0,function(t,e){return(e?ht(e,t):U(t.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1),Rt("not",2,!1,!1,function(t,e){return!dt(e,t)},1),Rt("number",1,!1,!0,function(t,e){return e?ut(e,t):+U(t.a)},0,1),Rt("position",1,!0,!1,function(t){return t.b},0),Rt("round",1,!1,!1,function(t,e){return Math.round(ut(e,t))},1),Rt("starts-with",2,!1,!1,function(t,e,n){return e=ht(e,t),t=ht(n,t),0==e.lastIndexOf(t,0)},2),Rt("string",3,!1,!0,function(t,e){return e?ht(e,t):U(t.a)},0,1),Rt("string-length",1,!1,!0,function(t,e){return(e?ht(e,t):U(t.a)).length},0,1),Rt("substring",3,!1,!1,function(t,e,n,r){if(n=ut(n,t),isNaN(n)||1/0==n||-1/0==n)return"";if(r=r?ut(r,t):1/0,isNaN(r)||-1/0===r)return"";n=Math.round(n)-1;var o=Math.max(n,0);return t=ht(e,t),1/0==r?t.substring(o):t.substring(o,n+Math.round(r))},2,3),Rt("substring-after",3,!1,!1,function(t,e,n){return e=ht(e,t),t=ht(n,t),-1==(n=e.indexOf(t))?"":e.substring(n+t.length)},2),Rt("substring-before",3,!1,!1,function(t,e,n){return e=ht(e,t),t=ht(n,t),-1==(t=e.indexOf(t))?"":e.substring(0,t)},2),Rt("sum",1,!1,!1,function(t,e){for(var n=rt(e.a(t)),r=0,o=it(n);o;o=it(n))r+=+U(o);return r},1,1,!0),Rt("translate",3,!1,!1,function(t,e,n,r){e=ht(e,t),n=ht(n,t);var o=ht(r,t);for(t={},r=0;r<n.length;r++){var i=n.charAt(r);i in t||(t[i]=o.charAt(r))}for(n="",r=0;r<e.length;r++)n+=(i=e.charAt(r))in t?t[i]:i;return n},3),Rt("true",2,!1,!1,function(){return!0},0),Ot.prototype.a=function(t){return null===this.b||this.b==t.nodeType},Ot.prototype.f=function(){return this.h},Ot.prototype.toString=function(){var t="Kind Test: "+this.h;return null===this.c||(t+=at(this.c)),t};var Lt=/\$?(?:(?![0-9-\.])(?:\*|[\w-\.]+):)?(?![0-9-\.])(?:\*|[\w-\.]+)|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|\s+|./g,Mt=/^\s/;function vt(t,e){return t.b[t.a+(e||0)]}function wt(t){return t.b[t.a++]}function Dt(t){return t.b.length<=t.a}function Pt(t){st.call(this,3),this.c=t.substring(1,t.length-1)}function _t(t,e){var n;this.j=t.toLowerCase(),n="*"==this.j?"*":"http://www.w3.org/1999/xhtml",this.c=e?e.toLowerCase():n}function xt(t,e){if(st.call(this,t.i),this.h=t,this.c=e,this.g=t.g,this.b=t.b,1==this.c.length){var n=this.c[0];n.u||n.c!=Xt||"*"!=(n=n.o).f()&&(this.f={name:n.f(),s:null})}}function Ft(){st.call(this,4)}function Ut(){st.call(this,4)}function kt(t){return"/"==t||"//"==t}function Bt(t){st.call(this,4),this.c=t,ct(this,m(this.c,function(t){return t.g})),lt(this,m(this.c,function(t){return t.b}))}function Gt(t,e){this.a=t,this.b=!!e}function Vt(t,e,n){for(n=n||0;n<t.a.length;n++)for(var r,o=t.a[n],i=rt(e),s=e.l,a=0;r=it(i);a++){var c=t.b?s-a:a+1;if("number"==typeof(r=o.a(new St(r,c,s))))c=c==r;else if("string"==typeof r||"boolean"==typeof r)c=!!r;else{if(!(r instanceof z))throw Error("Predicate.evaluate returned an unexpected type.");c=0<r.l}if(!c){if(r=(c=i).f,!(u=c.a))throw Error("Next must be called at least once before remove.");var l=u.b,u=u.a;l?l.a=u:r.a=u,u?u.b=l:r.b=l,r.l--,c.a=null}}return e}function Ht(t,e,n,r){st.call(this,4),this.c=t,this.o=e,this.h=n||new Gt([]),this.u=!!r,e=0<(e=this.h).a.length?e.a[0].f:null,t.b&&e&&(t=e.name,t=P?t.toLowerCase():t,this.f={name:t,s:e.s});t:{for(t=this.h,e=0;e<t.a.length;e++)if((n=t.a[e]).g||1==n.i||0==n.i){t=!0;break t}t=!1}this.g=t}function jt(t,e,n,r){this.j=t,this.f=e,this.a=n,this.b=r}s(Pt),Pt.prototype.a=function(){return this.c},Pt.prototype.toString=function(){return"Literal: "+this.c},_t.prototype.a=function(t){var e=t.nodeType;return(1==e||2==e)&&(e=void 0!==t.localName?t.localName:t.nodeName,("*"==this.j||this.j==e.toLowerCase())&&("*"==this.c||this.c==(t.namespaceURI?t.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")))},_t.prototype.f=function(){return this.j},_t.prototype.toString=function(){return"Name Test: "+("http://www.w3.org/1999/xhtml"==this.c?"":this.c+":")+this.j},s(xt),s(Ft),Ft.prototype.a=function(t){var e=new z;return 9==(t=t.a).nodeType?tt(e,t):tt(e,t.ownerDocument),e},Ft.prototype.toString=function(){return"Root Helper Expression"},s(Ut),Ut.prototype.a=function(t){var e=new z;return tt(e,t.a),e},Ut.prototype.toString=function(){return"Context Helper Expression"},xt.prototype.a=function(t){var e=this.h.a(t);if(!(e instanceof z))throw Error("Filter expression must evaluate to nodeset.");for(var n=0,r=(t=this.c).length;n<r&&e.l;n++){var o,i=t[n],s=rt(e,i.c.a);if(i.g||i.c!=Kt)if(i.g||i.c!=Qt)for(o=it(s),e=i.a(new St(o));null!=(o=it(s));)e=J(e,o=i.a(new St(o)));else o=it(s),e=i.a(new St(o));else{for(o=it(s);(e=it(s))&&(!o.contains||o.contains(e))&&8&e.compareDocumentPosition(o);o=e);e=i.a(new St(o))}}return e},xt.prototype.toString=function(){var t;if(t="Path Expression:"+at(this.h),this.c.length){var e=p(this.c,function(t,e){return t+at(e)},"Steps:");t+=at(e)}return t},s(Bt),Bt.prototype.a=function(t){var e=new z;return d(this.c,function(n){if(!((n=n.a(t))instanceof z))throw Error("Path expression must evaluate to NodeSet.");e=J(e,n)}),e},Bt.prototype.toString=function(){return p(this.c,function(t,e){return t+at(e)},"Union Expression:")},Gt.prototype.toString=function(){return p(this.a,function(t,e){return t+at(e)},"Predicates:")},s(Ht),Ht.prototype.a=function(t){var e=t.a,n=null,r=null,o=null,i=0;if((n=this.f)&&(r=n.name,o=n.s?ht(n.s,t):null,i=1),this.u)if(this.g||this.c!=Yt)if(e=it(t=rt(new Ht(Wt,new Ot("node")).a(t))))for(n=this.m(e,r,o,i);null!=(e=it(t));)n=J(n,this.m(e,r,o,i));else n=new z;else n=B(this.o,e,r,o),n=Vt(this.h,n,i);else n=this.m(t.a,r,o,i);return n},Ht.prototype.m=function(t,e,n,r){return t=this.c.f(this.o,t,e,n),Vt(this.h,t,r)},Ht.prototype.toString=function(){var t;if(t="Step:"+at("Operator: "+(this.u?"//":"/")),this.c.j&&(t+=at("Axis: "+this.c)),t+=at(this.o),this.h.a.length){var e=p(this.h.a,function(t,e){return t+at(e)},"Predicates:");t+=at(e)}return t},jt.prototype.toString=function(){return this.j};var qt={};function $t(t,e,n,r){if(qt.hasOwnProperty(t))throw Error("Axis already created: "+t);return e=new jt(t,e,n,!!r),qt[t]=e}$t("ancestor",function(t,e){for(var n=new z,r=e;r=r.parentNode;)t.a(r)&&Z(n,r);return n},!0),$t("ancestor-or-self",function(t,e){var n=new z,r=e;do{t.a(r)&&Z(n,r)}while(r=r.parentNode);return n},!0);var Xt=$t("attribute",function(t,e){var n=new z;if("style"==(i=t.f())&&P&&e.style)return tt(n,new x(e.style,e,"style",e.style.cssText)),n;var r=e.attributes;if(r)if(t instanceof Ot&&null===t.b||"*"==i)for(var o,i=0;o=r[i];i++)P?o.nodeValue&&tt(n,F(e,o)):tt(n,o);else(o=r.getNamedItem(i))&&(P?o.nodeValue&&tt(n,F(e,o)):tt(n,o));return n},!1),Yt=$t("child",function(t,e,r,o,i){return(P?H:j).call(null,t,e,n(r)?r:null,n(o)?o:null,i||new z)},!1,!0);$t("descendant",B,!1,!0);var Wt=$t("descendant-or-self",function(t,e,n,r){var o=new z;return k(e,n,r)&&t.a(e)&&tt(o,e),B(t,e,n,r,o)},!1,!0),Kt=$t("following",function(t,e,n,r){var o=new z;do{for(var i=e;i=i.nextSibling;)k(i,n,r)&&t.a(i)&&tt(o,i),o=B(t,i,n,r,o)}while(e=e.parentNode);return o},!1,!0);$t("following-sibling",function(t,e){for(var n=new z,r=e;r=r.nextSibling;)t.a(r)&&tt(n,r);return n},!1),$t("namespace",function(){return new z},!1);var zt=$t("parent",function(t,e){var n=new z;if(9==e.nodeType)return n;if(2==e.nodeType)return tt(n,e.ownerElement),n;var r=e.parentNode;return t.a(r)&&tt(n,r),n},!1),Qt=$t("preceding",function(t,e,n,r){var o=new z,i=[];do{i.unshift(e)}while(e=e.parentNode);for(var s=1,a=i.length;s<a;s++){var c=[];for(e=i[s];e=e.previousSibling;)c.unshift(e);for(var l=0,u=c.length;l<u;l++)k(e=c[l],n,r)&&t.a(e)&&tt(o,e),o=B(t,e,n,r,o)}return o},!0,!0);$t("preceding-sibling",function(t,e){for(var n=new z,r=e;r=r.previousSibling;)t.a(r)&&Z(n,r);return n},!0);var Jt=$t("self",function(t,e){var n=new z;return t.a(e)&&tt(n,e),n},!1);function Zt(t){st.call(this,1),this.c=t,this.g=t.g,this.b=t.b}function te(t){st.call(this,1),this.c=t}function ee(t,e){this.a=t,this.b=e}function ne(t){for(var e,n=[];;){re(t,"Missing right hand side of binary expression."),e=ue(t);var r=wt(t.a);if(!r)break;var o=(r=gt[r]||null)&&r.w;if(!o){t.a.a--;break}for(;n.length&&o<=n[n.length-1].w;)e=new ft(n.pop(),n.pop(),e);n.push(e,r)}for(;n.length;)e=new ft(n.pop(),n.pop(),e);return e}function re(t,e){if(Dt(t.a))throw Error(e)}function oe(t,e){var n=wt(t.a);if(n!=e)throw Error("Bad token, expected: "+e+" got: "+n)}function ie(t){if(")"!=(t=wt(t.a)))throw Error("Bad token: "+t)}function se(t){if(2>(t=wt(t.a)).length)throw Error("Unclosed literal string");return new Pt(t)}function ae(t){var e,n,r=[];if(kt(vt(t.a))){if(e=wt(t.a),n=vt(t.a),"/"==e&&(Dt(t.a)||"."!=n&&".."!=n&&"@"!=n&&"*"!=n&&!/(?![0-9])[\w]/.test(n)))return new Ft;n=new Ft,re(t,"Missing next location step."),e=ce(t,e),r.push(e)}else{t:{switch(n=(e=vt(t.a)).charAt(0)){case"$":throw Error("Variable reference not allowed in HTML XPath");case"(":wt(t.a),e=ne(t),re(t,'unclosed "("'),oe(t,")");break;case'"':case"'":e=se(t);break;default:if(isNaN(+e)){if(yt(e)||!/(?![0-9])[\w]/.test(n)||"("!=vt(t.a,1)){e=null;break t}for(e=wt(t.a),e=bt[e]||null,wt(t.a),n=[];")"!=vt(t.a)&&(re(t,"Missing function argument list."),n.push(ne(t)),","==vt(t.a));)wt(t.a);re(t,"Unclosed function argument list."),ie(t),e=new It(e,n)}else e=new te(+wt(t.a))}"["==vt(t.a)&&(e=new Tt(e,n=new Gt(le(t))))}if(e){if(!kt(vt(t.a)))return e;n=e}else e=ce(t,"/"),n=new Ut,r.push(e)}for(;kt(vt(t.a));)e=wt(t.a),re(t,"Missing next location step."),e=ce(t,e),r.push(e);return new xt(n,r)}function ce(t,e){var n,r,o,i;if("/"!=e&&"//"!=e)throw Error('Step op should be "/" or "//"');if("."==vt(t.a))return r=new Ht(Jt,new Ot("node")),wt(t.a),r;if(".."==vt(t.a))return r=new Ht(zt,new Ot("node")),wt(t.a),r;if("@"==vt(t.a))i=Xt,wt(t.a),re(t,"Missing attribute name");else if("::"==vt(t.a,1)){if(!/(?![0-9])[\w]/.test(vt(t.a).charAt(0)))throw Error("Bad token: "+wt(t.a));if(n=wt(t.a),!(i=qt[n]||null))throw Error("No axis with name: "+n);wt(t.a),re(t,"Missing node name")}else i=Yt;if(n=vt(t.a),!/(?![0-9])[\w\*]/.test(n.charAt(0)))throw Error("Bad token: "+wt(t.a));if("("==vt(t.a,1)){if(!yt(n))throw Error("Invalid node type: "+n);if(!yt(n=wt(t.a)))throw Error("Invalid type name: "+n);oe(t,"("),re(t,"Bad nodetype");var s=null;'"'!=(o=vt(t.a).charAt(0))&&"'"!=o||(s=se(t)),re(t,"Bad nodetype"),ie(t),n=new Ot(n,s)}else if(-1==(o=(n=wt(t.a)).indexOf(":")))n=new _t(n);else{var a;if("*"==(s=n.substring(0,o)))a="*";else if(!(a=t.b(s)))throw Error("Namespace prefix not declared: "+s);n=new _t(n=n.substr(o+1),a)}return o=new Gt(le(t),i.a),r||new Ht(i,n,o,"//"==e)}function le(t){for(var e=[];"["==vt(t.a);){wt(t.a),re(t,"Missing predicate expression.");var n=ne(t);e.push(n),re(t,"Unclosed predicate expression."),oe(t,"]")}return e}function ue(t){if("-"==vt(t.a))return wt(t.a),new Zt(ue(t));var e=ae(t);if("|"!=vt(t.a))t=e;else{for(e=[e];"|"==wt(t.a);)re(t,"Missing next union location path."),e.push(ae(t));t.a.a--,t=new Bt(e)}return t}function he(t){switch(t.nodeType){case 1:return function(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}(fe,t);case 9:return he(t.documentElement);case 11:case 10:case 6:case 12:return de;default:return t.parentNode?he(t.parentNode):de}}function de(){return null}function fe(t,e){if(t.prefix==e)return t.namespaceURI||"http://www.w3.org/1999/xhtml";var n=t.getAttributeNode("xmlns:"+e);return n&&n.specified?n.value||null:t.parentNode&&9!=t.parentNode.nodeType?fe(t.parentNode,e):null}function pe(t,e){if(!t.length)throw Error("Empty XPath expression.");var n=function(t){t=t.match(Lt);for(var e=0;e<t.length;e++)Mt.test(t[e])&&t.splice(e,1);return new Ct(t)}(t);if(Dt(n))throw Error("Invalid XPath expression.");e?"function"==function(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}(e)||(e=i(e.lookupNamespaceURI,e)):e=function(){return null};var r=ne(new ee(n,e));if(!Dt(n))throw Error("Bad token: "+wt(n));this.evaluate=function(t,e){return new me(r.a(new St(t)),e)}}function me(t,e){if(0==e)if(t instanceof z)e=4;else if("string"==typeof t)e=2;else if("number"==typeof t)e=1;else{if("boolean"!=typeof t)throw Error("Unexpected evaluation result.");e=3}if(2!=e&&1!=e&&3!=e&&!(t instanceof z))throw Error("value could not be converted to the specified type");var n;switch(this.resultType=e,e){case 2:this.stringValue=t instanceof z?nt(t):""+t;break;case 1:this.numberValue=t instanceof z?+nt(t):+t;break;case 3:this.booleanValue=t instanceof z?0<t.l:!!t;break;case 4:case 5:case 6:case 7:var r=rt(t);n=[];for(var o=it(r);o;o=it(r))n.push(o instanceof x?o.a:o);this.snapshotLength=t.l,this.invalidIteratorState=!1;break;case 8:case 9:r=et(t),this.singleNodeValue=r instanceof x?r.a:r;break;default:throw Error("Unknown XPathResult type.")}var i=0;this.iterateNext=function(){if(4!=e&&5!=e)throw Error("iterateNext called with wrong result type");return i>=n.length?null:n[i++]},this.snapshotItem=function(t){if(6!=e&&7!=e)throw Error("snapshotItem called with wrong result type");return t>=n.length||0>t?null:n[t]}}function ge(t){this.lookupNamespaceURI=he(t)}function Ee(t,n){var r=t||e,o=r.Document&&r.Document.prototype||r.document;o.evaluate&&!n||(r.XPathResult=me,o.evaluate=function(t,e,n,r){return new pe(t,n).evaluate(e,r)},o.createExpression=function(t,e){return new pe(t,e)},o.createNSResolver=function(t){return new ge(t)})}s(Zt),Zt.prototype.a=function(t){return-ut(this.c,t)},Zt.prototype.toString=function(){return"Unary Expression: -"+at(this.c)},s(te),te.prototype.a=function(){return this.c},te.prototype.toString=function(){return"Number: "+this.c},me.ANY_TYPE=0,me.NUMBER_TYPE=1,me.STRING_TYPE=2,me.BOOLEAN_TYPE=3,me.UNORDERED_NODE_ITERATOR_TYPE=4,me.ORDERED_NODE_ITERATOR_TYPE=5,me.UNORDERED_NODE_SNAPSHOT_TYPE=6,me.ORDERED_NODE_SNAPSHOT_TYPE=7,me.ANY_UNORDERED_NODE_TYPE=8,me.FIRST_ORDERED_NODE_TYPE=9;var Ne,Se=["wgxpath","install"],Te=e;Se[0]in Te||!Te.execScript||Te.execScript("var "+Se[0]);for(;Se.length&&(Ne=Se.shift());)Se.length||void 0===Ee?Te=Te[Ne]?Te[Ne]:Te[Ne]={}:Te[Ne]=Ee;t.exports.install=Ee,t.exports.XPathResultType={ANY_TYPE:0,NUMBER_TYPE:1,STRING_TYPE:2,BOOLEAN_TYPE:3,UNORDERED_NODE_ITERATOR_TYPE:4,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6,ORDERED_NODE_SNAPSHOT_TYPE:7,ANY_UNORDERED_NODE_TYPE:8,FIRST_ORDERED_NODE_TYPE:9}}).call(n.g)},108(t,e,n){"use strict";n.r(e),n.d(e,{engineReady:()=>Dc,engineSetup:()=>vc,exit:()=>_c,file:()=>i,localeLoader:()=>Pc,move:()=>$h,number:()=>Gh,numericOrdinal:()=>Hh,ordinal:()=>Vh,resetEngine:()=>wc,setupEngine:()=>Mc,toDescription:()=>Uh,toEnriched:()=>kh,toJson:()=>xh,toSemantic:()=>_h,toSpeech:()=>Ph,toSpeechStructure:()=>Bh,toVis:()=>Fh,variables:()=>cd,version:()=>ad,vulgar:()=>jh,walk:()=>qh,worker:()=>o});var r={};n.r(r),n.d(r,{NodeType:()=>z,cloneNode:()=>ut,createElement:()=>et,createElementNS:()=>nt,createTextNode:()=>rt,formatXml:()=>ot,parseInput:()=>K,querySelectorAll:()=>ct,querySelectorAllByAttr:()=>st,querySelectorAllByAttrValue:()=>at,replaceNode:()=>tt,serializeXml:()=>ht,tagName:()=>lt,toArray:()=>W});var o={};n.r(o),n.d(o,{localePreferences:()=>zh,nextRules:()=>Wh,nextStyle:()=>Kh,relevantPreferences:()=>Qh,speech:()=>Yh});var i={};n.r(i),n.d(i,{localePath:()=>sd,processFile:()=>id,toDescription:()=>rd,toEnriched:()=>od,toJson:()=>nd,toSemantic:()=>ed,toSpeech:()=>td});class s{static ensureLocale(t,e){return s.LOCALES.get(t)?t:(console.error(`Locale ${t} does not exist! Using ${s.LOCALES.get(e)} instead.`),e)}}s.VERSION="5.0.0-rc.1",s.LOCALES=new Map([["af","Afrikaans"],["ca","Catalan"],["da","Danish"],["de","German"],["en","English"],["es","Spanish"],["euro","Euro"],["fr","French"],["hi","Hindi"],["it","Italian"],["ko","Korean"],["nb","Bokm\xe5l"],["nn","Nynorsk"],["sv","Swedish"],["nemeth","Nemeth"]]),s.mathjaxVersion="4.1.2",s.url="https://cdn.jsdelivr.net/npm/speech-rule-engine@"+s.VERSION+"/lib/mathmaps";var a=n(841),c=n.t(a,2),l=n(999),u=n.t(l,2);const h=c,d=(new h.DOMImplementation).createDocument("",""),f=(null==u?void 0:l.install)||window.wgxpath.install,p=function(){const t={document:{},XPathResult:{}};return f(t),t.document.XPathResult=t.XPathResult,t.document}(),m={currentDocument:d,evaluate:p.evaluate,result:p.XPathResult,createNSResolver:p.createNSResolver},g=!("undefined"==typeof window),E=g&&!(void 0===window.document),N=!("undefined"==typeof DedicatedWorkerGlobalScope),S=()=>{var t;return"undefined"!=typeof require||"undefined"!=typeof process&&null!=(null===(t=process.versions)||void 0===t?void 0:t.node)&&"undefined"!=typeof require?require:t=>null},T={extRequire:t=>"undefined"!=typeof process&&"undefined"!=typeof require?S()(t):null,windowSupported:g,documentSupported:E,webworker:N,xmldom:h,document:d,fs:E||N?null:S()("fs"),url:s.url,jsonPath:function(){if(E||N)return s.url;if(process.env.SRE_JSON_PATH||n.g.SRE_JSON_PATH)return process.env.SRE_JSON_PATH||n.g.SRE_JSON_PATH;try{return S().resolve("speech-rule-engine").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}try{return S().resolve(".").replace(/sre\.js$/,"")+"mathmaps"}catch(t){}return"undefined"!=typeof __dirname?__dirname+(__dirname.match(/lib?$/)?"/mathmaps":"/lib/mathmaps"):process.cwd()+"/lib/mathmaps"}(),xpath:m};var I,A;!function(t){t.SYNC="sync",t.ASYNC="async",t.HTTP="http"}(I||(I={})),function(t){t.PITCH="pitch",t.RATE="rate",t.VOLUME="volume",t.PAUSE="pause",t.JOIN="join",t.LAYOUT="layout"}(A||(A={}));const b=[A.PITCH,A.RATE,A.VOLUME,A.PAUSE,A.JOIN];var R,O;!function(t){t.NONE="none",t.SHALLOW="shallow",t.DEEP="deep"}(R||(R={})),function(t){t.NONE="none",t.LAYOUT="layout",t.COUNTING="counting",t.PUNCTUATION="punctuation",t.SSML="ssml",t.ACSS="acss",t.SABLE="sable",t.VOICEXML="voicexml"}(O||(O={}));const y={mathspeak:"default",clearspeak:"default"};var C;!function(t){t.DOMAIN="domain",t.STYLE="style",t.LOCALE="locale",t.TOPIC="topic",t.MODALITY="modality"}(C||(C={}));class L{static createProp(...t){const e=M.DEFAULT_ORDER,n={};for(let r=0,o=t.length,i=e.length;r<o&&r<i;r++)n[e[r]]=t[r];return new L(n)}constructor(t,e=Object.keys(t)){this.properties=t,this.order=e}getProperties(){return this.properties}getOrder(){return this.order}getAxes(){return this.order}getProperty(t){return this.properties[t]}updateProperties(t){this.properties=t}allProperties(){const t=[];return this.order.forEach(e=>t.push(this.getProperty(e).slice())),t}toString(){const t=[];return this.order.forEach(e=>t.push(e+": "+this.getProperty(e).toString())),t.join("\n")}}class M extends L{static createCstr(...t){const e=M.DEFAULT_ORDER,n={};for(let r=0,o=t.length,i=e.length;r<o&&r<i;r++)n[e[r]]=t[r];return new M(n)}static defaultCstr(){return M.createCstr.apply(null,M.DEFAULT_ORDER.map(function(t){return M.DEFAULT_VALUES[t]}))}static validOrder(t){const e=M.DEFAULT_ORDER.slice();return t.every(t=>{const n=e.indexOf(t);return-1!==n&&e.splice(n,1)})}constructor(t,e){const n={};for(const[e,r]of Object.entries(t))n[e]=[r];super(n,e),this.components=t}getComponents(){return this.components}getValue(t){return this.components[t]}getValues(){return this.order.map(t=>this.getValue(t))}allProperties(){const t=super.allProperties();for(let e,n,r=0;e=t[r],n=this.order[r];r++){const t=this.getValue(n);-1===e.indexOf(t)&&e.unshift(t)}return t}toString(){return this.getValues().join(".")}equal(t){const e=t.getAxes();if(this.order.length!==e.length)return!1;for(let n,r=0;n=e[r];r++){const e=this.getValue(n);if(!e||t.getValue(n)!==e)return!1}return!0}}M.DEFAULT_ORDER=[C.LOCALE,C.MODALITY,C.DOMAIN,C.STYLE,C.TOPIC],M.BASE_LOCALE="base",M.DEFAULT_VALUE="default",M.DEFAULT_VALUES={[C.LOCALE]:"en",[C.DOMAIN]:M.DEFAULT_VALUE,[C.STYLE]:M.DEFAULT_VALUE,[C.TOPIC]:M.DEFAULT_VALUE,[C.MODALITY]:"speech"};class v{constructor(t){this.order=t}parse(t){const e=t.split("."),n={};if(e.length>this.order.length)throw new Error("Invalid dynamic constraint: "+n);let r=0;for(let t,o=0;t=this.order[o],e.length;o++,r++){const r=e.shift();n[t]=r}return new M(n,this.order.slice(0,r))}}class w{constructor(t,e=new L(t.getProperties(),t.getOrder())){this.reference=t,this.fallback=e,this.order=this.reference.getOrder()}getReference(){return this.reference}setReference(t,e){this.reference=t,this.fallback=e||new L(t.getProperties(),t.getOrder()),this.order=this.reference.getOrder()}match(t){const e=t.getAxes();return e.length===this.reference.getAxes().length&&e.every(e=>{const n=t.getValue(e);return n===this.reference.getValue(e)||-1!==this.fallback.getProperty(e).indexOf(n)})}compare(t,e){let n=!1;for(let r,o=0;r=this.order[o];o++){const o=t.getValue(r),i=e.getValue(r);if(!n){const t=this.reference.getValue(r);if(t===o&&t!==i)return-1;if(t===i&&t!==o)return 1;if(t===o&&t===i)continue;t!==o&&t!==i&&(n=!0)}const s=this.fallback.getProperty(r),a=s.indexOf(o),c=s.indexOf(i);if(a<c)return-1;if(c<a)return 1}return 0}toString(){return this.reference.toString()+"\n"+this.fallback.toString()}}function D(t){return t.match("/$")?t:t+"/"}function P(t,e="json"){return D(T.jsonPath)+t+(e.match(/^\./)?e:"."+e)}class _{static getInstance(){return _.instance=_.instance||new _,_.instance}init(t){return t&&this.startDebugFile_(t),this.isActive_=!0,this.fileHandle}output(...t){this.isActive_&&this.output_(t)}generate(t){this.isActive_&&this.output_(t.apply(t,[]))}exit(t=()=>{}){this.stream_&&this.fileHandle.then(()=>{this.isActive_&&this.stream_&&(this.stream_.end("","",t),this.stream_=null)}),this.isActive_=!1}constructor(){this.isActive_=!1,this.fileHandle=Promise.resolve(),this.stream_=null}startDebugFile_(t){this.fileHandle=T.fs.promises.open(t,"w"),this.fileHandle=this.fileHandle.then(e=>{this.stream_=e.createWriteStream(t),this.outputFunction=function(...t){this.stream_.write(t.join(" ")),this.stream_.write("\n")}.bind(this),this.stream_.on("error",function(t){console.info("Invalid log file. Debug information sent to console."),this.outputFunction=console.info}.bind(this)),this.stream_.on("finish",function(){console.info("Finalizing debug file.")})})}output_(t){this.stream_?this.fileHandle.then(()=>this.outputFunction.apply(this.outputFunction,["Speech Rule Engine Debugger:"].concat(t))):console.info(...["Speech Rule Engine Debugger:"].concat(t))}}class x{constructor(t={}){this.delay=!1,this.domain="clearspeak",this.style=M.DEFAULT_VALUES[C.STYLE],this.locale=M.DEFAULT_VALUES[C.LOCALE],this.subiso="",this.modality=M.DEFAULT_VALUES[C.MODALITY],this.speech=R.NONE,this.markup=O.NONE,this.mark=!0,this.automark=!1,this.character=!0,this.cleanpause=!0,this.cayleyshort=!0,this.linebreaks=!1,this.rate="100",this.walker="Table",this.structure=!1,this.aria=!1,this.tree=!1,this.strict=!1,this.pprint=!1,this.rules="",this.prune="",this.set(t)}set(t){this.ensureDomain(t);for(const[e,n]of Object.entries(t))(x.BINARY_FEATURES.includes(e)||x.STRING_FEATURES.includes(e))&&(this[e]=n)}json(){const t={};return[].concat(x.STRING_FEATURES,x.BINARY_FEATURES).forEach(e=>t[e]=this[e]),t}ensureDomain(t){if(t.modality&&"speech"!==t.modality||!t.modality&&"speech"!==this.modality)return;if(!t.domain&&!t.locale)return;if("default"===t.domain)return void(t.domain="mathspeak");const e=t.locale||this.locale,n=t.domain||this.domain;-1===F.indexOf(e)||"mathspeak"===n?"en"!==e?"mathspeak"!==n&&"clearspeak"!==n&&(t.domain="mathspeak"):-1===U.indexOf(n)&&(t.domain="mathspeak"):t.domain="mathspeak"}}x.BINARY_FEATURES=["automark","mark","character","cleanpause","strict","structure","aria","pprint","cayleyshort","linebreaks","tree"],x.STRING_FEATURES=["markup","style","domain","speech","walker","locale","delay","modality","rate","rules","subiso","prune"];const F=["ca","da","es"],U=["chromevox","clearspeak","mathspeak","emacspeak","html"];class k extends Error{constructor(t=""){super(),this.message=t,this.name="SRE Error"}}class B{set defaultLocale(t){this._defaultLocale=s.ensureLocale(t,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return B.instance=B.instance||new B,B.instance}static defaultEvaluator(t,e){return t}static evaluateNode(t){return B.nodeEvaluator(t)}getRate(){const t=parseInt(this.options.rate,10);return isNaN(t)?100:t}setDynamicCstr(t){if(this.defaultLocale&&(M.DEFAULT_VALUES[C.LOCALE]=this.defaultLocale),t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(-1!==M.DEFAULT_ORDER.indexOf(r)){const e=t[r];this.options[r]=e}}}const e=[this.options.locale,this.options.modality,this.options.domain,this.options.style].join("."),n=L.createProp([M.DEFAULT_VALUES[C.LOCALE]],[M.DEFAULT_VALUES[C.MODALITY]],[M.DEFAULT_VALUES[C.DOMAIN]],[M.DEFAULT_VALUES[C.STYLE]]),r=this.comparators[this.options.domain],o=this.parsers[this.options.domain];this.parser=o||this.defaultParser,this.dynamicCstr=this.parser.parse(e),this.dynamicCstr.updateProperties(n.getProperties()),this.comparator=r?r():new w(this.dynamicCstr)}constructor(){this.options=new x,this.config=!1,this.customLoader=null,this.parsers={},this.comparator=null,this.mode=I.SYNC,this.init=!0,this.comparators={},this._defaultLocale=M.DEFAULT_VALUES[C.LOCALE],this.options.locale=this.defaultLocale,this.evaluator=B.defaultEvaluator,this.defaultParser=new v(M.DEFAULT_ORDER),this.parser=this.defaultParser,this.dynamicCstr=M.defaultCstr()}configurate(t){this.mode!==I.HTTP||T.webworker||this.config||(!function(t){const e=document.documentElement.querySelectorAll('script[type="text/x-sre-config"]');for(let n=0,r=e.length;n<r;n++){let r;try{r=e[n].innerHTML;const o=JSON.parse(r);for(const[e,n]of Object.entries(o))t[e]=n}catch(t){_.getInstance().output("Illegal configuration ",r)}}}(t),this.config=!0),function(t){if("undefined"!=typeof SREfeature)for(const[e,n]of Object.entries(SREfeature))t[e]=n}(t)}setCustomLoader(t){t&&(this.customLoader=t)}setup(t){void 0!==t.mode&&(this.mode=t.mode),this.configurate(t),this.options.set(t),t.json&&(T.jsonPath=D(t.json)),this.setCustomLoader(t.custom)}json(){return Object.assign({mode:this.mode},this.options.json())}reset(){this.options=new x}}B.nodeEvaluator=function(t){return[]};class G{static get(t=B.getInstance().options.locale){return G.promises[t]||Promise.resolve("")}static getall(){return Promise.all(Object.values(G.promises))}}G.loaded={},G.promises={};const V=T.xpath,H={xhtml:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",mml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function j(t){return H[t]||null}class q{constructor(){this.lookupNamespaceURI=j}}function $(t,e,n){return V.evaluate(t,e,new q,n,null)}function X(t,e){let n;try{n=$(t,e,V.result.ORDERED_NODE_ITERATOR_TYPE)}catch(t){return[]}const r=[];for(let t=n.iterateNext();t;t=n.iterateNext())r.push(t);return r}function Y(t){if(B.getInstance().mode!==I.HTTP)return;let e=t;for(;e&&!e.evaluate;)e=e.parentNode;e&&e.evaluate?V.currentDocument=e:t.ownerDocument&&(V.currentDocument=t.ownerDocument)}function W(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}function K(t){const e=new T.xmldom.DOMParser,n=function(t){return(t=t.replace(/&nbsp;/g,"\xa0")).replace(/>[ \f\n\r\t\v\u200b]+</g,"><").trim()}(t),r=!!n.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!n)throw new k("Empty input!");try{const t=e.parseFromString(n,r?"text/html":"text/xml");return B.getInstance().mode===I.HTTP?(V.currentDocument=t,r?t.body.childNodes[0]:t.documentElement):t.documentElement}catch(t){throw new k("Illegal input: "+t.message)}}var z,Q,J,Z;function tt(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))}function et(t){return T.document.createElement(t)}function nt(t,e){return T.document.createElementNS(t,e)}function rt(t){return T.document.createTextNode(t)}function ot(t){let e="",n=/(>)(<)(\/*)/g,r=0,o=(t=t.replace(n,"$1\r\n$2$3")).split("\r\n");for(n=/(\.)*(<)(\/*)/g,o=o.map(t=>t.replace(n,"$1\r\n$2$3").split("\r\n")).reduce((t,e)=>t.concat(e),[]);o.length;){let t=o.shift();if(!t)continue;let n=0;if(t.match(/^<\w[^>/]*>[^>]+$/)){const e=it(t,o[0]);e[0]?e[1]?(t+=o.shift().slice(0,-e[1].length),e[1].trim()&&o.unshift(e[1])):t+=o.shift():n=1}else if(t.match(/^<\/\w/))0!==r&&(r-=1);else if(t.match(/^<\w[^>]*[^/]>.*$/))n=1;else if(t.match(/^<\w[^>]*\/>.+$/)){const e=t.indexOf(">")+1,n=t.slice(e);n.trim()&&o.unshift(),t=t.slice(0,e)+n}else n=0;e+=new Array(r+1).join(" ")+t+"\r\n",r+=n}return e}function it(t,e){if(!e)return[!1,""];const n=t.match(/^<([^> ]+).*>/),r=e.match(/^<\/([^>]+)>(.*)/);return n&&r&&n[1]===r[1]?[!0,r[2]]:[!1,""]}function st(t,e){return t.querySelectorAll?W(t.querySelectorAll(`[${e}]`)):X(`.//*[@${e}]`,t)}function at(t,e,n){return t.querySelectorAll?W(t.querySelectorAll(`[${e}="${n}"]`)):X(`.//*[@${e}="${n}"]`,t)}function ct(t,e){return t.querySelectorAll?W(t.querySelectorAll(e)):X(`.//${e}`,t)}function lt(t){return t.tagName.toUpperCase()}function ut(t){return t.cloneNode(!0)}function ht(t){return(new T.xmldom.XMLSerializer).serializeToString(t)}function dt(t){const e=t.toString(16).toUpperCase();return e.length>3?e:("000"+e).slice(-4)}function ft([t,e],n){const r=parseInt(t,16),o=parseInt(e,16),i=[];for(let t=r;t<=o;t++){let e=dt(t);!1!==n[e]&&(e=n[e]||e,i.push(e))}return i}function pt(t,e={}){return ft(t,e).map(t=>String.fromCodePoint(parseInt(t,16)))}!function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(z||(z={})),function(t){t.BOLD="bold",t.BOLDFRAKTUR="bold-fraktur",t.BOLDITALIC="bold-italic",t.BOLDSCRIPT="bold-script",t.DOUBLESTRUCK="double-struck",t.DOUBLESTRUCKITALIC="double-struck-italic",t.FULLWIDTH="fullwidth",t.FRAKTUR="fraktur",t.ITALIC="italic",t.MONOSPACE="monospace",t.NORMAL="normal",t.SCRIPT="script",t.SANSSERIF="sans-serif",t.SANSSERIFITALIC="sans-serif-italic",t.SANSSERIFBOLD="sans-serif-bold",t.SANSSERIFBOLDITALIC="sans-serif-bold-italic"}(Q||(Q={})),function(t){t.SUPER="super",t.SUB="sub",t.CIRCLED="circled",t.PARENTHESIZED="parenthesized",t.PERIOD="period",t.NEGATIVECIRCLED="negative-circled",t.DOUBLECIRCLED="double-circled",t.CIRCLEDSANSSERIF="circled-sans-serif",t.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",t.COMMA="comma",t.SQUARED="squared",t.NEGATIVESQUARED="negative-squared"}(J||(J={})),function(t){t.LATINCAP="latinCap",t.LATINSMALL="latinSmall",t.GREEKCAP="greekCap",t.GREEKSMALL="greekSmall",t.DIGIT="digit"}(Z||(Z={}));const mt=[{interval:["1D400","1D419"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLD},{interval:["1D41A","1D433"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLD},{interval:["1D56C","1D585"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLDFRAKTUR},{interval:["1D468","1D481"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLDITALIC},{interval:["1D482","1D49B"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLDSCRIPT},{interval:["1D538","1D551"],base:Z.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:Q.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:Z.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:Q.FRAKTUR},{interval:["1D51E","1D537"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.FRAKTUR},{interval:["FF21","FF3A"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.FULLWIDTH},{interval:["FF41","FF5A"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.FULLWIDTH},{interval:["1D434","1D44D"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.ITALIC},{interval:["1D44E","1D467"],base:Z.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:Q.ITALIC},{interval:["1D670","1D689"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.MONOSPACE},{interval:["1D68A","1D6A3"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.MONOSPACE},{interval:["0041","005A"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.NORMAL},{interval:["0061","007A"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.NORMAL},{interval:["1D49C","1D4B5"],base:Z.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:Q.SCRIPT},{interval:["1D4B6","1D4CF"],base:Z.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:Q.SCRIPT},{interval:["1D5A0","1D5B9"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIF},{interval:["1D5BA","1D5D3"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIF},{interval:["1D608","1D621"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:Z.LATINCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:Z.LATINSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:Z.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:Q.NORMAL},{interval:["03B0","03D0"],base:Z.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:Q.NORMAL},{interval:["1D6A8","1D6C0"],base:Z.GREEKCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLD},{interval:["1D6C1","1D6E1"],base:Z.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLD},{interval:["1D6E2","1D6FA"],base:Z.GREEKCAP,subst:{},capital:!0,category:"Lu",font:Q.ITALIC},{interval:["1D6FB","1D71B"],base:Z.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:Q.ITALIC},{interval:["1D71C","1D734"],base:Z.GREEKCAP,subst:{},capital:!0,category:"Lu",font:Q.BOLDITALIC},{interval:["1D735","1D755"],base:Z.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:Q.BOLDITALIC},{interval:["1D756","1D76E"],base:Z.GREEKCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:Z.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:Z.GREEKCAP,subst:{},capital:!0,category:"Lu",font:Q.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:Z.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:Q.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.NORMAL},{interval:["2070","2079"],base:Z.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:J.SUPER},{interval:["2080","2089"],base:Z.DIGIT,subst:{},offset:0,category:"No",font:J.SUB},{interval:["245F","2473"],base:Z.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:J.CIRCLED},{interval:["3251","325F"],base:Z.DIGIT,subst:{},offset:21,category:"No",font:J.CIRCLED},{interval:["32B1","32BF"],base:Z.DIGIT,subst:{},offset:36,category:"No",font:J.CIRCLED},{interval:["2474","2487"],base:Z.DIGIT,subst:{},offset:1,category:"No",font:J.PARENTHESIZED},{interval:["2487","249B"],base:Z.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:J.PERIOD},{interval:["2775","277F"],base:Z.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:J.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:Z.DIGIT,subst:{},offset:11,category:"No",font:J.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:Z.DIGIT,subst:{},offset:1,category:"No",font:J.DOUBLECIRCLED},{interval:["277F","2789"],base:Z.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:J.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:Z.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:J.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.BOLD},{interval:["1D7D8","1D7E1"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.SANSSERIF},{interval:["1D7EC","1D7F5"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:Z.DIGIT,subst:{},offset:0,category:"Nd",font:Q.MONOSPACE},{interval:["1F101","1F10A"],base:Z.DIGIT,subst:{},offset:0,category:"No",font:J.COMMA},{interval:["24B6","24CF"],base:Z.LATINCAP,subst:{},capital:!0,category:"So",font:J.CIRCLED},{interval:["24D0","24E9"],base:Z.LATINSMALL,subst:{},capital:!1,category:"So",font:J.CIRCLED},{interval:["1F110","1F129"],base:Z.LATINCAP,subst:{},capital:!0,category:"So",font:J.PARENTHESIZED},{interval:["249C","24B5"],base:Z.LATINSMALL,subst:{},capital:!1,category:"So",font:J.PARENTHESIZED},{interval:["1F130","1F149"],base:Z.LATINCAP,subst:{},capital:!0,category:"So",font:J.SQUARED},{interval:["1F170","1F189"],base:Z.LATINCAP,subst:{},capital:!0,category:"So",font:J.NEGATIVESQUARED},{interval:["1F150","1F169"],base:Z.LATINCAP,subst:{},capital:!0,category:"So",font:J.NEGATIVECIRCLED}],gt=new Map;function Et(t,e){return t+e.split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}for(const t of mt){const e=Et(t.base,t.font),n=pt(t.interval,t.subst);let r=gt.get(e);r?r.unicode=r.unicode.concat(n):(r=t,r.unicode=n,gt.set(e,r))}var Nt;!function(t){t.PUNCTUATION="punctuation",t.FENCE="fence",t.NUMBER="number",t.IDENTIFIER="identifier",t.TEXT="text",t.OPERATOR="operator",t.RELATION="relation",t.LARGEOP="largeop",t.FUNCTION="function",t.ACCENT="accent",t.FENCED="fenced",t.FRACTION="fraction",t.PUNCTUATED="punctuated",t.RELSEQ="relseq",t.MULTIREL="multirel",t.INFIXOP="infixop",t.PREFIXOP="prefixop",t.POSTFIXOP="postfixop",t.APPL="appl",t.INTEGRAL="integral",t.BIGOP="bigop",t.SQRT="sqrt",t.ROOT="root",t.LIMUPPER="limupper",t.LIMLOWER="limlower",t.LIMBOTH="limboth",t.SUBSCRIPT="subscript",t.SUPERSCRIPT="superscript",t.UNDERSCORE="underscore",t.OVERSCORE="overscore",t.TENSOR="tensor",t.TABLE="table",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.ROW="row",t.LINE="line",t.CELL="cell",t.ENCLOSE="enclose",t.INFERENCE="inference",t.RULELABEL="rulelabel",t.CONCLUSION="conclusion",t.PREMISES="premises",t.UNKNOWN="unknown",t.EMPTY="empty"}(Nt||(Nt={}));const St=Object.assign({},Nt);var Tt;!function(t){t.COMMA="comma",t.SEMICOLON="semicolon",t.ELLIPSIS="ellipsis",t.FULLSTOP="fullstop",t.QUESTION="question",t.EXCLAMATION="exclamation",t.QUOTES="quotes",t.DASH="dash",t.TILDE="tilde",t.PRIME="prime",t.DEGREE="degree",t.VBAR="vbar",t.COLON="colon",t.OPENFENCE="openfence",t.CLOSEFENCE="closefence",t.APPLICATION="application",t.DUMMY="dummy",t.UNIT="unit",t.LABEL="label",t.OPEN="open",t.CLOSE="close",t.TOP="top",t.BOTTOM="bottom",t.NEUTRAL="neutral",t.METRIC="metric",t.LATINLETTER="latinletter",t.GREEKLETTER="greekletter",t.OTHERLETTER="otherletter",t.NUMBERSET="numbersetletter",t.INTEGER="integer",t.FLOAT="float",t.OTHERNUMBER="othernumber",t.INFTY="infty",t.MIXED="mixed",t.MULTIACCENT="multiaccent",t.OVERACCENT="overaccent",t.UNDERACCENT="underaccent",t.UNDEROVER="underover",t.SUBSUP="subsup",t.LEFTSUB="leftsub",t.LEFTSUPER="leftsuper",t.RIGHTSUB="rightsub",t.RIGHTSUPER="rightsuper",t.LEFTRIGHT="leftright",t.ABOVEBELOW="abovebelow",t.INTERVAL="interval",t.SETEMPTY="set empty",t.SETEXT="set extended",t.SETSINGLE="set singleton",t.SETCOLLECT="set collection",t.STRING="string",t.SPACE="space",t.ANNOTATION="annotation",t.TEXT="text",t.SEQUENCE="sequence",t.ENDPUNCT="endpunct",t.STARTPUNCT="startpunct",t.NEGATIVE="negative",t.POSITIVE="positive",t.NEGATION="negation",t.MULTIOP="multiop",t.PREFIXOP="prefix operator",t.POSTFIXOP="postfix operator",t.LIMFUNC="limit function",t.INFIXFUNC="infix function",t.PREFIXFUNC="prefix function",t.POSTFIXFUNC="postfix function",t.SIMPLEFUNC="simple function",t.COMPFUNC="composed function",t.SUM="sum",t.INTEGRAL="integral",t.GEOMETRY="geometry",t.BOX="box",t.BLOCK="block",t.ADDITION="addition",t.MULTIPLICATION="multiplication",t.SUBTRACTION="subtraction",t.IMPLICIT="implicit",t.DIVISION="division",t.VULGAR="vulgar",t.EQUALITY="equality",t.INEQUALITY="inequality",t.ARROW="arrow",t.ELEMENT="element",t.NONELEMENT="nonelement",t.REELEMENT="reelement",t.RENONELEMENT="renonelement",t.SET="set",t.DETERMINANT="determinant",t.ROWVECTOR="rowvector",t.BINOMIAL="binomial",t.SQUAREMATRIX="squarematrix",t.CYCLE="cycle",t.MULTILINE="multiline",t.MATRIX="matrix",t.VECTOR="vector",t.CASES="cases",t.TABLE="table",t.CAYLEY="cayley",t.PROOF="proof",t.LEFT="left",t.RIGHT="right",t.UP="up",t.DOWN="down",t.FINAL="final",t.SINGLE="single",t.HYP="hyp",t.AXIOM="axiom",t.LOGIC="logic",t.UNKNOWN="unknown",t.MGLYPH="mglyph"}(Tt||(Tt={}));const It=Object.assign({},Tt);var At;!function(t){t.CALIGRAPHIC="caligraphic",t.CALIGRAPHICBOLD="caligraphic-bold",t.OLDSTYLE="oldstyle",t.OLDSTYLEBOLD="oldstyle-bold",t.UNKNOWN="unknown"}(At||(At={}));const bt=Object.assign(Object.assign(Object.assign({},Q),At),J);var Rt;!function(t){t.ALLLETTERS="allLetters",t.D="d",t.BAR="bar",t.TILDE="tilde",t.CURLY="curly",t.PAREN="paren",t.BRACKET="bracket",t.FLOOR="floor",t.CEIL="ceil"}(Rt||(Rt={}));const Ot=Object.assign(Object.assign({},Z),Rt);function yt(t,e){return t.toString()}function Ct(t){return t.toString()}function Lt(t,e){return t+e.toLowerCase()}const Mt={};function vt(t,e=""){if(!t.childNodes||!t.childNodes[0]||!t.childNodes[0].childNodes||t.childNodes[0].childNodes.length<2||t.childNodes[0].childNodes[0].tagName!==St.NUMBER||t.childNodes[0].childNodes[0].getAttribute("role")!==It.INTEGER||t.childNodes[0].childNodes[1].tagName!==St.NUMBER||t.childNodes[0].childNodes[1].getAttribute("role")!==It.INTEGER)return{convertible:!1,content:t.textContent};const n=t.childNodes[0].childNodes[1].textContent,r=t.childNodes[0].childNodes[0].textContent,o=Number(n),i=Number(r);return isNaN(o)||isNaN(i)?{convertible:!1,content:`${r} ${e} ${n}`}:{convertible:!0,enumerator:i,denominator:o}}function wt(t,e,n){const r=vt(t);if(r.convertible){const t=r.enumerator,o=r.denominator;return t>0&&t<e&&o>0&&o<n}return!1}function Dt(t={}){return Object.assign({zero:"zero",ones:[],tens:[],large:[],special:{},wordOrdinal:Ct,numericOrdinal:Ct,numberToWords:Ct,numberToOrdinal:yt,vulgarSep:" ",numSep:" "},t)}Mt.identityCombiner=function(t,e,n){return t+e+n},Mt.prefixCombiner=function(t,e,n){return t=n?n+" "+t:t,e?e+" "+t:t},Mt.postfixCombiner=function(t,e,n){return t=n?n+" "+t:t,e?t+" "+e:t},Mt.romanceCombiner=function(t,e,n){return t=n?t+" "+n:t,e?t+" "+e:t};const Pt=_t();function _t(){return{FUNCTIONS:{fracNestDepth:t=>wt(t,10,100),radicalNestDepth:t=>"",combineRootIndex:function(t,e){return t},combineNestedFraction:Mt.identityCombiner,combineNestedRadical:Mt.identityCombiner,fontRegexp:function(t){return new RegExp("^"+t.split(/ |-/).join("( |-)")+"( |-)")},si:Lt,plural:Ct},MESSAGES:{MS:{},MSroots:{},font:{},embellish:{},role:{},enclose:{},navigate:{},regexp:{},unitTimes:""},ALPHABETS:{latinSmall:[],latinCap:[],greekSmall:[],greekCap:[],capPrefix:{default:""},smallPrefix:{default:""},digitPrefix:{default:""},languagePrefix:{},digitTrans:{default:Ct,mathspeak:Ct,clearspeak:Ct},letterTrans:{default:Ct},combiner:(t,e,n)=>t},NUMBERS:Dt(),COMBINERS:{},CORRECTIONS:{},SUBISO:{default:"",current:"",all:[]}}}function xt(t){switch(t){case 1:return Pt.MESSAGES.MS.ONCE||"";case 2:return Pt.MESSAGES.MS.TWICE;default:return t.toString()}}function Ft(t,e){return t===Pt.MESSAGES.MS.ROOTINDEX||t===Pt.MESSAGES.MS.INDEX?t:t+" "+e}function Ut(t){return kt(Pt.MESSAGES.font[t],t)}function kt(t,e){return void 0===t?e:"string"==typeof t?t:t[0]}const Bt="grammar";class Gt{static getInstance(){return Gt.instance=Gt.instance||new Gt,Gt.instance}static parseInput(t){const e={},n=t.split(":");for(const t of n){const n=t.split("="),r=n[0].trim();n[1]?e[r]=n[1].trim():r.match(/^!/)?e[r.slice(1)]=!1:e[r]=!0}return e}static parseState(t){const e={},n=t.split(" ");for(const t of n){const n=t.split(":"),r=n[0],o=n[1];e[r]=o||!0}return e}static translateString(t){if(t.match(/:unit$/))return Gt.translateUnit(t);const e=B.getInstance();let n=e.evaluator(t,e.dynamicCstr);return n=null===n?t:n,Gt.getInstance().getParameter("plural")&&(n=Pt.FUNCTIONS.plural(n)),n}static translateUnit(t){t=Gt.prepareUnit(t);const e=B.getInstance(),n=Gt.getInstance().getParameter("plural"),r=e.options.strict,o=`${e.options.locale}.${e.options.modality}.default`;let i,s;return e.options.strict=!0,n&&(i=e.defaultParser.parse(o+".plural"),s=e.evaluator(t,i)),s?(e.options.strict=r,s):(i=e.defaultParser.parse(o+".default"),s=e.evaluator(t,i),e.options.strict=r,s?(n&&(s=Pt.FUNCTIONS.plural(s)),s):Gt.cleanUnit(t))}static prepareUnit(t){const e=t.match(/:unit$/);return e?t.slice(0,e.index).replace(/\s+/g," ")+t.slice(e.index):t}static cleanUnit(t){return t.match(/:unit$/)?t.replace(/:unit$/,""):t}clear(){this.parameters_={},this.stateStack_=[]}setParameter(t,e){const n=this.parameters_[t];return e?this.parameters_[t]=e:delete this.parameters_[t],n}getParameter(t){return this.parameters_[t]}setCorrection(t,e){this.corrections_[t]=e}setPreprocessor(t,e){this.preprocessors_[t]=e}getCorrection(t){return this.corrections_[t]}getState(){const t=[];for(const[e,n]of Object.entries(this.parameters_))t.push("string"==typeof n?e+":"+n:e);return t.join(" ")}processSingles(){const t={};for(const e of this.singles)t[e]=!1;this.singles=[],this.pushState(t)}pushState(t){for(let[e,n]of Object.entries(t))e.match(/^\?/)&&(delete t[e],e=e.slice(1),this.singles.push(e)),t[e]=this.setParameter(e,n);this.stateStack_.push(t)}popState(){const t=this.stateStack_.pop();for(const[e,n]of Object.entries(t))this.setParameter(e,n)}setAttribute(t){if(t&&t.nodeType===z.ELEMENT_NODE){const e=this.getState();e&&t.setAttribute(Bt,e)}}preprocess(t){return this.runProcessors(t,this.preprocessors_)}correct(t){return this.runProcessors(t,this.corrections_)}apply(t,e){return this.currentFlags=e||{},t=this.currentFlags.adjust||this.currentFlags.preprocess?Gt.getInstance().preprocess(t):t,(this.parameters_.translate||this.currentFlags.translate)&&(t=Gt.translateString(t)),t=this.currentFlags.adjust||this.currentFlags.correct?Gt.getInstance().correct(t):t,this.currentFlags={},t}runProcessors(t,e){for(const[n,r]of Object.entries(this.parameters_)){const o=e[n];o&&(t=!0===r?o(t):o(t,r))}return t}constructor(){this.currentFlags={},this.parameters_={},this.corrections_={},this.preprocessors_={},this.stateStack_=[],this.singles=[]}}function Vt(t,e){if(!e||!t)return t;const n=Pt.FUNCTIONS.fontRegexp(Ut(e));return t.replace(n,"")}function Ht(t){let e=t%1e3,n="",r=$t.ones[Math.floor(e/100)];if(n+=r?r+$t.numSep+"honderd":"",e%=100,e)if(n+=n?$t.numSep:"",r=$t.ones[e],r)n+=r;else{const t=$t.tens[Math.floor(e/10)];r=$t.ones[e%10],n+=r?r+"-en-"+t:t}return n}function jt(t){if(0===t)return $t.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){if(t%1e3){const r=Ht(t%1e3);if(e){const t=$t.large[e];n=r+$t.numSep+t+(n?$t.numSep+n:"")}else n=r+(n?$t.numSep+n:"")}t=Math.floor(t/1e3),e++}return n}function qt(t){if(1===t)return"eerste";if(3===t)return"derde";if(8===t)return"agste";if(9===t)return"negende";return jt(t)+(t<19?"de":"ste")}Gt.getInstance().setCorrection("localFont",Ut),Gt.getInstance().setCorrection("localRole",function(t){return kt(Pt.MESSAGES.role[t],t)}),Gt.getInstance().setCorrection("localEnclose",function(t){return kt(Pt.MESSAGES.enclose[t],t)}),Gt.getInstance().setCorrection("ignoreFont",Vt),Gt.getInstance().setPreprocessor("annotation",function(t,e){return t+":"+e}),Gt.getInstance().setPreprocessor("noTranslateText",function(t){return t.match(new RegExp("^["+Pt.MESSAGES.regexp.TEXT+"]+$"))&&(Gt.getInstance().currentFlags.translate=!1),t}),Gt.getInstance().setCorrection("ignoreCaps",function(t){let e=Pt.ALPHABETS.capPrefix[B.getInstance().options.domain];return void 0===e&&(e=Pt.ALPHABETS.capPrefix.default),Vt(t,e)}),Gt.getInstance().setPreprocessor("numbers2alpha",function(t){return t.match(/\d+/)?Pt.NUMBERS.numberToWords(parseInt(t,10)):t});const $t=Dt({wordOrdinal:qt,numericOrdinal:function(t){return t.toString()+"."},numberToWords:jt,numberToOrdinal:function(t,e){return 1===t?"enkel":2===t?e?"helftes":"helfte":4===t?e?"kwarte":"kwart":qt(t)+(e?"s":"")}}),Xt=function(t,e,n){return t=n?n+" "+t:t,e?t+" "+e:t};let Yt=null;function Wt(t){const e=t%1e3,n=Math.floor(e/100),r=n?1===n?"cent":Qt.ones[n]+"-cents":"",o=function(t){const e=t%100;if(e<20)return Qt.ones[e];const n=Math.floor(e/10),r=Qt.tens[n],o=Qt.ones[e%10];return r&&o?r+(2===n?"-i-":"-")+o:r||o}(e%100);return r&&o?r+Qt.numSep+o:r||o}function Kt(t){if(0===t)return Qt.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%(e>1?1e6:1e3);if(r){let t=Qt.large[e];if(e)if(1===e)n=(1===r?"":Wt(r)+Qt.numSep)+t+(n?Qt.numSep+n:"");else{const e=Kt(r);t=1===r?t:t.replace(/\u00f3$/,"ons"),n=e+Qt.numSep+t+(n?Qt.numSep+n:"")}else n=Wt(r)}t=Math.floor(t/(e>1?1e6:1e3)),e++}return n}function zt(t){const e=Gt.getInstance().getParameter("gender");return t.toString()+("f"===e?"a":"n")}const Qt=Dt({numericOrdinal:zt,numberToWords:Kt,numberToOrdinal:function(t,e){if(t>1999)return zt(t);if(t<=10)return Qt.special.onesOrdinals[t-1];const n=Kt(t);return n.match(/mil$/)?n.replace(/mil$/,"mil\xb7l\xe8sima"):n.match(/u$/)?n.replace(/u$/,"vena"):n.match(/a$/)?n.replace(/a$/,"ena"):n+(n.match(/e$/)?"na":"ena")}}),Jt=function(t,e,n){return t="sans serif "+(n?n+" "+t:t),e?t+" "+e:t};let Zt=null;function te(t,e=!1){return t===oe.ones[1]?e?"et":"en":t}function ee(t,e=!1){let n=t%1e3,r="",o=oe.ones[Math.floor(n/100)];if(r+=o?te(o,!0)+" hundrede":"",n%=100,n)if(r+=r?" og ":"",o=e?oe.special.smallOrdinals[n]:oe.ones[n],o)r+=o;else{const t=e?oe.special.tensOrdinals[Math.floor(n/10)]:oe.tens[Math.floor(n/10)];o=oe.ones[n%10],r+=o?te(o)+"og"+t:t}return r}function ne(t,e=!1){if(0===t)return oe.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const t=ee(o,e&&!n);if(n){const e=oe.large[n],i=o>1?"er":"";r=te(t,n<=1)+" "+e+i+(r?" og ":"")+r}else r=te(t)+r}t=Math.floor(t/1e3),n++}return r}function re(t){if(t%100)return ne(t,!0);const e=ne(t);return e.match(/e$/)?e:e+"e"}const oe=Dt({wordOrdinal:re,numericOrdinal:function(t){return t.toString()+"."},numberToWords:ne,numberToOrdinal:function(t,e){return 1===t?e?"hel":"hele":2===t?e?"halv":"halve":re(t)+(e?"dele":"del")}});let ie=null;function se(t,e=!1){return t===ue.ones[1]?e?"eine":"ein":t}function ae(t){let e=t%1e3,n="",r=ue.ones[Math.floor(e/100)];if(n+=r?se(r)+"hundert":"",e%=100,e)if(n+=n?ue.numSep:"",r=ue.ones[e],r)n+=r;else{const t=ue.tens[Math.floor(e/10)];r=ue.ones[e%10],n+=r?se(r)+"und"+t:t}return n}function ce(t){if(0===t)return ue.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%1e3;if(r){const o=ae(t%1e3);if(e){const t=ue.large[e],i=e>1&&r>1?t.match(/e$/)?"n":"en":"";n=se(o,e>1)+t+i+n}else n=se(o,e>1)+n}t=Math.floor(t/1e3),e++}return n.replace(/ein$/,"eins")}function le(t){if(1===t)return"erste";if(3===t)return"dritte";if(7===t)return"siebte";if(8===t)return"achte";return ce(t)+(t<19?"te":"ste")}const ue=Dt({wordOrdinal:le,numericOrdinal:function(t){return t.toString()+"."},numberToWords:ce,numberToOrdinal:function(t,e){return 1===t?"eintel":2===t?e?"halbe":"halb":le(t)+"l"}}),he=function(t,e,n){return"s"===n&&(e=e.split(" ").map(function(t){return t.replace(/s$/,"")}).join(" "),n=""),t=n?n+" "+t:t,e?e+" "+t:t},de=function(t,e,n){return t=n&&"s"!==n?n+" "+t:t,e?t+" "+e:t};let fe=null;function pe(t){let e=t%1e3,n="";return n+=Ee.ones[Math.floor(e/100)]?Ee.ones[Math.floor(e/100)]+Ee.numSep+"hundred":"",e%=100,e&&(n+=n?Ee.numSep:"",n+=Ee.ones[e]||Ee.tens[Math.floor(e/10)]+(e%10?Ee.numSep+Ee.ones[e%10]:"")),n}function me(t){if(0===t)return Ee.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){t%1e3&&(n=pe(t%1e3)+(e?"-"+Ee.large[e]+"-":"")+n),t=Math.floor(t/1e3),e++}return n.replace(/-$/,"")}function ge(t){let e=me(t);return e.match(/one$/)?e=e.slice(0,-3)+"first":e.match(/two$/)?e=e.slice(0,-3)+"second":e.match(/three$/)?e=e.slice(0,-5)+"third":e.match(/five$/)?e=e.slice(0,-4)+"fifth":e.match(/eight$/)?e=e.slice(0,-5)+"eighth":e.match(/nine$/)?e=e.slice(0,-4)+"ninth":e.match(/twelve$/)?e=e.slice(0,-6)+"twelfth":e.match(/ty$/)?e=e.slice(0,-2)+"tieth":e+="th",e}const Ee=Dt({wordOrdinal:ge,numericOrdinal:function(t){const e=t%100,n=t.toString();if(e>10&&e<20)return n+"th";switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd";default:return n+"th"}},numberToWords:me,numberToOrdinal:function(t,e){if(1===t)return e?"oneths":"oneth";if(2===t)return e?"halves":"half";const n=ge(t);return e?n+"s":n}});let Ne=null;function Se(t){const e=t%1e3,n=Math.floor(e/100),r=Te.special.hundreds[n],o=function(t){const e=t%100;if(e<30)return Te.ones[e];const n=Te.tens[Math.floor(e/10)],r=Te.ones[e%10];return n&&r?n+" y "+r:n||r}(e%100);return 1===n?o?r+"to "+o:r:r&&o?r+" "+o:r||o}const Te=Dt({numericOrdinal:function(t){const e=Gt.getInstance().getParameter("gender");return t.toString()+("f"===e?"a":"o")},numberToWords:function(t){if(0===t)return Te.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){const r=t%1e3;if(r){let t=Te.large[e];const o=Se(r);e?1===r?(t=t.match("/^mil( |$)/")?t:"un "+t,n=t+(n?" "+n:"")):(t=t.replace(/\u00f3n$/,"ones"),n=Se(r)+" "+t+(n?" "+n:"")):n=o}t=Math.floor(t/1e3),e++}return n},numberToOrdinal:function(t,e){if(t>1999)return t.toString()+"a";if(t<=12)return Te.special.onesOrdinals[t-1];const n=[];if(t>=1e3&&(t-=1e3,n.push("mil\xe9sima")),!t)return n.join(" ");let r=0;return r=Math.floor(t/100),r>0&&(n.push(Te.special.hundredsOrdinals[r-1]),t%=100),t<=12?n.push(Te.special.onesOrdinals[t-1]):(r=Math.floor(t/10),r>0&&(n.push(Te.special.tensOrdinals[r-1]),t%=10),t>0&&n.push(Te.special.onesOrdinals[t-1])),n.join(" ")}}),Ie=function(t,e,n){return t="sans serif "+(n?n+" "+t:t),e?t+" "+e:t};let Ae=null;let be=null;function Re(t){let e=t%1e3,n="";if(n+=Le.ones[Math.floor(e/100)]?Le.ones[Math.floor(e/100)]+"-cent":"",e%=100,e){n+=n?"-":"";let t=Le.ones[e];if(t)n+=t;else{const r=Le.tens[Math.floor(e/10)];r.match(/-dix$/)?(t=Le.ones[e%10+10],n+=r.replace(/-dix$/,"")+"-"+t):n+=r+(e%10?"-"+Le.ones[e%10]:"")}}const r=n.match(/s-\w+$/);return r?n.replace(/s-\w+$/,r[0].slice(1)):n.replace(/-un$/,"-et-un")}function Oe(t){if(0===t)return Le.zero;if(t>=Math.pow(10,36))return t.toString();Le.special["tens-"+B.getInstance().options.subiso]&&(Le.tens=Le.special["tens-"+B.getInstance().options.subiso]);let e=0,n="";for(;t>0;){const r=t%1e3;if(r){let t=Le.large[e];const o=Re(r);if(t&&t.match(/^mille /)){const r=t.replace(/^mille /,"");n=n.match(RegExp(r))?o+(e?"-mille-":"")+n:n.match(RegExp(r.replace(/s$/,"")))?o+(e?"-mille-":"")+n.replace(r.replace(/s$/,""),r):o+(e?"-"+t+"-":"")+n}else t=1===r&&t?t.replace(/s$/,""):t,n=o+(e?"-"+t+"-":"")+n}t=Math.floor(t/1e3),e++}return n.replace(/-$/,"")}const ye={1:"uni\xe8me",2:"demi",3:"tiers",4:"quart"};function Ce(t){if(1===t)return"premi\xe8re";let e=Oe(t);return e.match(/^neuf$/)?e=e.slice(0,-1)+"v":e.match(/cinq$/)?e+="u":e.match(/trois$/)?e+="":(e.match(/e$/)||e.match(/s$/))&&(e=e.slice(0,-1)),e+="i\xe8me",e}const Le=Dt({wordOrdinal:Ce,numericOrdinal:function(t){const e=Gt.getInstance().getParameter("gender");return 1===t?t.toString()+("m"===e?"er":"re"):t.toString()+"e"},numberToWords:Oe,numberToOrdinal:function(t,e){const n=ye[t]||Ce(t);return 3===t?n:e?n+"s":n}});let Me=null;function ve(t){if(0===t)return De.zero;if(t>=Math.pow(10,32))return t.toString();let e=0,n="";const r=function(t){let e=t%1e3,n="";return n+=De.ones[Math.floor(e/100)]?De.ones[Math.floor(e/100)]+De.numSep+De.special.hundred:"",e%=100,e&&(n+=n?De.numSep:"",n+=De.ones[e]),n}(t%1e3);if(!(t=Math.floor(t/1e3)))return r;for(;t>0;){const r=t%100;r&&(n=De.ones[r]+De.numSep+De.large[e]+(n?De.numSep+n:"")),t=Math.floor(t/100),e++}return r?n+De.numSep+r:n}function we(t){const e=Gt.getInstance().getParameter("gender");if(t<=0)return t.toString();if(t<10)return"f"===e?De.special.ordinalsFeminine[t]:De.special.ordinalsMasculine[t];return ve(t)+("f"===e?"\u0935\u0940\u0902":"\u0935\u093e\u0901")}const De=Dt({wordOrdinal:we,numericOrdinal:function(t){const e=Gt.getInstance().getParameter("gender");return t>0&&t<10?"f"===e?De.special.simpleSmallOrdinalsFeminine[t]:De.special.simpleSmallOrdinalsMasculine[t]:t.toString().split("").map(function(t){const e=parseInt(t,10);return isNaN(e)?"":De.special.simpleNumbers[e]}).join("")+("f"===e?"\u0935\u0940\u0902":"\u0935\u093e\u0901")},numberToWords:ve,numberToOrdinal:function(t,e){return t<=10?De.special.smallDenominators[t]:we(t)+" \u0905\u0902\u0936"}});let Pe=null;function _e(t){let e=t%1e4,n="";return n+=ke.ones[Math.floor(e/1e3)]?1===Math.floor(e/1e3)?"\ucc9c":ke.ones[Math.floor(e/1e3)]+"\ucc9c":"",e%=1e3,e&&(n+=ke.ones[Math.floor(e/100)]?1===Math.floor(e/100)?"\ubc31":ke.ones[Math.floor(e/100)]+"\ubc31":"",e%=100,n+=ke.tens[Math.floor(e/10)]+(e%10?ke.ones[e%10]:"")),n}function xe(t){if(0===t)return ke.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,n="";for(;t>0;){t%1e4&&(n=_e(t%1e4)+(e?ke.large[e]+ke.numSep:"")+n),t=Math.floor(t/1e4),e++}return n.replace(/ $/,"")}function Fe(t,e){return 1===t?"\uccab\ubc88\uc9f8":Ue(t)+"\ubc88\uc9f8"}function Ue(t){const e=xe(t),n=xe(t%=100);if(!n||!t)return e;const r=20===t?"\uc2a4\ubb34":ke.tens[10+Math.floor(t/10)],o=ke.ones[10+Math.floor(t%10)];return e.slice(0,-n.length)+r+o}const ke=Dt({wordOrdinal:Ue,numericOrdinal:function(t){return Fe(t)},numberToWords:xe,numberToOrdinal:Fe});let Be=null;function Ge(t){let e=t%1e3,n="";if(n+=je.ones[Math.floor(e/100)]?je.ones[Math.floor(e/100)]+je.numSep+"cento":"",e%=100,e){n+=n?je.numSep:"";const t=je.ones[e];if(t)n+=t;else{let t=je.tens[Math.floor(e/10)];const r=e%10;1!==r&&8!==r||(t=t.slice(0,-1)),n+=t,n+=r?je.numSep+je.ones[e%10]:""}}return n}function Ve(t){if(0===t)return je.zero;if(t>=Math.pow(10,36))return t.toString();if(1===t&&Gt.getInstance().getParameter("fraction"))return"un";let e=0,n="";for(;t>0;){t%1e3&&(n=Ge(t%1e3)+(e?"-"+je.large[e]+"-":"")+n),t=Math.floor(t/1e3),e++}return n.replace(/-$/,"")}function He(t){const e="m"===Gt.getInstance().getParameter("gender")?"o":"a";let n=je.special.onesOrdinals[t];return n?n.slice(0,-1)+e:(n=Ve(t),n.slice(0,-1)+"esim"+e)}const je=Dt({wordOrdinal:He,numericOrdinal:function(t){const e=Gt.getInstance().getParameter("gender");return t.toString()+("m"===e?"o":"a")},numberToWords:Ve,numberToOrdinal:function(t,e){if(2===t)return e?"mezzi":"mezzo";const n=He(t);if(!e)return n;const r=n.match(/o$/)?"i":"e";return n.slice(0,-1)+r}}),qe=function(t,e,n){return t.match(/^[a-zA-Z]$/)&&(e=e.replace("cerchiato","cerchiata")),t=n?t+" "+n:t,e?t+" "+e:t};let $e=null;function Xe(t,e=!1){let n=t%1e3,r="";const o=Math.floor(n/100),i=Ke.ones[o];if(r+=i?(1===o?"":i)+"hundre":"",n%=100,n){if(r+=r?"og":"",e){const t=Ke.special.smallOrdinals[n];if(t)return r+t;if(n%10)return r+Ke.tens[Math.floor(n/10)]+Ke.special.smallOrdinals[n%10]}r+=Ke.ones[n]||Ke.tens[Math.floor(n/10)]+(n%10?Ke.ones[n%10]:"")}return e?Ye(r):r}function Ye(t){const e=Ke.special.endOrdinal[0];return"a"===e&&t.match(/en$/)?t.slice(0,-2)+Ke.special.endOrdinal:t.match(/(d|n)$/)||t.match(/hundre$/)?t+"de":t.match(/i$/)?t+Ke.special.endOrdinal:"a"===e&&t.match(/e$/)?t.slice(0,-1)+Ke.special.endOrdinal:(t.match(/e$/),t+"nde")}function We(t){return Je(t,!0)}const Ke=Dt({wordOrdinal:We,numericOrdinal:function(t){return t.toString()+"."},numberToWords:Je,numberToOrdinal:function(t,e){return We(t)}});function ze(t,e=!1){return t===Ke.ones[1]?"ein"===t?"eitt ":e?"et":"ett":t}function Qe(t,e=!1){let n=t%1e3,r="",o=Ke.ones[Math.floor(n/100)];if(r+=o?ze(o)+"hundre":"",n%=100,n){if(r+=r?"og":"",e){const t=Ke.special.smallOrdinals[n];if(t)return r+t}if(o=Ke.ones[n],o)r+=o;else{const t=Ke.tens[Math.floor(n/10)];o=Ke.ones[n%10],r+=o?o+"og"+t:t}}return e?Ye(r):r}function Je(t,e=!1){const n="alt"===B.getInstance().options.subiso?function(t,e=!1){if(0===t)return e?Ke.special.smallOrdinals[0]:Ke.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const i=Qe(t%1e3,!n&&e);!n&&e&&(e=!e),r=(1===n?ze(i,!0):i)+(n>1?Ke.numSep:"")+(n?Ke.large[n]+(n>1&&o>1?"er":""):"")+(n>1&&r?Ke.numSep:"")+r}t=Math.floor(t/1e3),n++}return e?r+(r.match(/tusen$/)?"de":"te"):r}(t,e):function(t,e=!1){if(0===t)return e?Ke.special.smallOrdinals[0]:Ke.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const i=Xe(t%1e3,!n&&e);!n&&e&&(e=!e),r=i+(n?" "+Ke.large[n]+(n>1&&o>1?"er":"")+(r?" ":""):"")+r}t=Math.floor(t/1e3),n++}return e?r+(r.match(/tusen$/)?"de":"te"):r}(t,e);return n}let Ze=null;function tn(t){return t.toString().split("").map(function(t){return en.ones[parseInt(t,10)]}).join("")}const en=Dt({numberToWords:tn,numberToOrdinal:tn}),nn=function(t){return t.match(RegExp("^"+ln.ALPHABETS.languagePrefix.english))?t.slice(1):t},rn=function(t,e,n){return t=nn(t),e?t+e:t},on=function(t,e,n){return e+nn(t)},sn=function(t,e,n){return e+(n||"")+(t=nn(t))+"\u283b"},an=function(t,e,n){return e+(n||"")+(t=nn(t))+"\u283b\u283b"},cn=function(t,e,n){return e+(t=nn(t))+"\u283e"};let ln=null;let un=null;function hn(t){let e=t%1e3,n="";const r=Math.floor(e/100);return n+=pn.ones[r]?(1===r?"":pn.ones[r]+pn.numSep)+"hundra":"",e%=100,e&&(n+=n?pn.numSep:"",n+=pn.ones[e]||pn.tens[Math.floor(e/10)]+(e%10?pn.numSep+pn.ones[e%10]:"")),n}function dn(t,e=!1){if(0===t)return pn.zero;if(t>=Math.pow(10,36))return t.toString();let n=0,r="";for(;t>0;){const o=t%1e3;if(o){const i=pn.large[n],s=o>1&&n>1&&!e?"er":"";r=(1===n&&1===o?"":(n>1&&1===o?"en":hn(t%1e3))+(n>1?" ":""))+(n?i+s+(n>1?" ":""):"")+r}t=Math.floor(t/1e3),n++}return r.replace(/ $/,"")}function fn(t){let e=dn(t,!0);return e.match(/^noll$/)?e="nollte":e.match(/ett$/)?e=e.replace(/ett$/,"f\xf6rsta"):e.match(/tv\xe5$/)?e=e.replace(/tv\xe5$/,"andra"):e.match(/tre$/)?e=e.replace(/tre$/,"tredje"):e.match(/fyra$/)?e=e.replace(/fyra$/,"fj\xe4rde"):e.match(/fem$/)?e=e.replace(/fem$/,"femte"):e.match(/sex$/)?e=e.replace(/sex$/,"sj\xe4tte"):e.match(/sju$/)?e=e.replace(/sju$/,"sjunde"):e.match(/\xe5tta$/)?e=e.replace(/\xe5tta$/,"\xe5ttonde"):e.match(/nio$/)?e=e.replace(/nio$/,"nionde"):e.match(/tio$/)?e=e.replace(/tio$/,"tionde"):e.match(/elva$/)?e=e.replace(/elva$/,"elfte"):e.match(/tolv$/)?e=e.replace(/tolv$/,"tolfte"):e.match(/tusen$/)?e=e.replace(/tusen$/,"tusonde"):e.match(/jard$/)||e.match(/jon$/)?e+="te":e+="de",e}const pn=Dt({wordOrdinal:fn,numericOrdinal:function(t){const e=t.toString();return e.match(/11$|12$/)?e+":e":e+(e.match(/1$|2$/)?":a":":e")},numberToWords:dn,numberToOrdinal:function(t,e){if(1===t)return"hel";if(2===t)return e?"halva":"halv";let n=fn(t);return n=n.match(/de$/)?n.replace(/de$/,""):n,n+(e?"delar":"del")}});let mn=null;const gn={af:function(){return Yt||(Yt=function(){const t=_t();return t.NUMBERS=$t,t.COMBINERS.germanPostfix=Xt,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.FUNCTIONS.fontRegexp=function(t){return new RegExp("((^"+t+" )|( "+t+"$))")},t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=$t.numberToWords,t.CORRECTIONS.article=t=>Gt.getInstance().getParameter("noArticle")?"":t,t}()),Yt},ca:function(){return Zt||(Zt=function(){const t=_t();return t.NUMBERS=Qt,t.COMBINERS.sansserif=Jt,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=Ft,t.FUNCTIONS.combineNestedRadical=(t,e,n)=>t+n,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*os$/.test(t)?t+"sos":/.*s$/.test(t)?t+"os":/.*ga$/.test(t)?t.slice(0,-2)+"gues":/.*\xe7a$/.test(t)?t.slice(0,-2)+"ces":/.*ca$/.test(t)?t.slice(0,-2)+"ques":/.*ja$/.test(t)?t.slice(0,-2)+"ges":/.*qua$/.test(t)?t.slice(0,-3)+"q\xfces":/.*a$/.test(t)?t.slice(0,-1)+"es":/.*(e|i)$/.test(t)?t+"ns":/.*\xed$/.test(t)?t.slice(0,-1)+"ins":t+"s",t.FUNCTIONS.si=(t,e)=>(e.match(/^metre/)&&(t=t.replace(/a$/,"\xe0").replace(/o$/,"\xf2").replace(/i$/,"\xed")),t+e),t.ALPHABETS.combiner=Mt.prefixCombiner,t}()),Zt},da:function(){return ie||(ie=function(){const t=_t();return t.NUMBERS=oe,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.fontRegexp=e=>e===t.ALPHABETS.capPrefix.default?RegExp("^"+e+" "):RegExp(" "+e+"$"),t.ALPHABETS.combiner=Mt.postfixCombiner,t.ALPHABETS.digitTrans.default=oe.numberToWords,t}()),ie},de:function(){return fe||(fe=function(){const t=_t();return t.NUMBERS=ue,t.COMBINERS.germanPostfix=de,t.ALPHABETS.combiner=he,t.FUNCTIONS.radicalNestDepth=e=>e>1?t.NUMBERS.numberToWords(e)+"fach":"",t.FUNCTIONS.combineRootIndex=(t,e)=>{const n=e?e+"wurzel":"";return t.replace("Wurzel",n)},t.FUNCTIONS.combineNestedRadical=(t,e,n)=>{const r=(e?e+" ":"")+(t=n.match(/exponent$/)?t+"r":t);return n.match(/ /)?n.replace(/ /," "+r+" "):r+" "+n},t.FUNCTIONS.fontRegexp=function(t){return t=t.split(" ").map(function(t){return t.replace(/s$/,"(|s)")}).join(" "),new RegExp("((^"+t+" )|( "+t+"$))")},t.CORRECTIONS.correctOne=t=>t.replace(/^eins$/,"ein"),t.CORRECTIONS.localFontNumber=t=>Ut(t).split(" ").map(function(t){return t.replace(/s$/,"")}).join(" "),t.CORRECTIONS.lowercase=t=>t.toLowerCase(),t.CORRECTIONS.article=t=>{const e=Gt.getInstance().getParameter("case"),n=Gt.getInstance().getParameter("plural");return"dative"===e?{der:"dem",die:n?"den":"der",das:"dem"}[t]:t},t.CORRECTIONS.masculine=t=>"dative"===Gt.getInstance().getParameter("case")?t+"n":t,t}()),fe},en:function(){return Ne||(Ne=function(){const t=_t();return t.NUMBERS=Ee,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=Ee.numberToWords,t.CORRECTIONS.article=t=>Gt.getInstance().getParameter("noArticle")?"":t,t}()),Ne},es:function(){return Ae||(Ae=function(){const t=_t();return t.NUMBERS=Te,t.COMBINERS.sansserif=Ie,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=Ft,t.FUNCTIONS.combineNestedRadical=(t,e,n)=>t+n,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*(a|e|i|o|u)$/.test(t)?t+"s":/.*z$/.test(t)?t.slice(0,-1)+"ces":/.*c$/.test(t)?t.slice(0,-1)+"ques":/.*g$/.test(t)?t+"ues":/.*\u00f3n$/.test(t)?t.slice(0,-2)+"ones":t+"es",t.FUNCTIONS.si=(t,e)=>(e.match(/^metro/)&&(t=t.replace(/a$/,"\xe1").replace(/o$/,"\xf3").replace(/i$/,"\xed")),t+e),t.ALPHABETS.combiner=Mt.prefixCombiner,t}()),Ae},euro:function(){return be||(be=_t()),be},fr:function(){return Me||(Me=function(){const t=_t();return t.NUMBERS=Le,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.combineRootIndex=Ft,t.FUNCTIONS.combineNestedFraction=(t,e,n)=>n.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,n)=>n+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.CORRECTIONS.article=t=>Gt.getInstance().getParameter("noArticle")?"":t,t.ALPHABETS.combiner=Mt.romanceCombiner,t.SUBISO={default:"fr",current:"fr",all:["fr","be","ch"]},t}()),Me},hi:function(){return Pe||(Pe=function(){const t=_t();return t.NUMBERS=De,t.ALPHABETS.combiner=Mt.prefixCombiner,t.FUNCTIONS.radicalNestDepth=xt,t}()),Pe},it:function(){return $e||($e=function(){const t=_t();return t.NUMBERS=je,t.COMBINERS.italianPostfix=qe,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.combineRootIndex=Ft,t.FUNCTIONS.combineNestedFraction=(t,e,n)=>n.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,n)=>n+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.ALPHABETS.combiner=Mt.romanceCombiner,t}()),$e},ko:function(){return Be||(Be=function(){const t=_t();return t.NUMBERS=ke,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.plural=function(t){return t},t.FUNCTIONS.si=(t,e)=>t+e,t.FUNCTIONS.combineRootIndex=function(t,e){return t+e},t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=ke.numberToWords,t.CORRECTIONS.postposition=t=>{if(["\uac19\ub2e4","\ub294","\uc640","\ub97c","\ub85c"].includes(t))return t;const e=t.slice(-1);let n=(e.charCodeAt(0)-44032)%28>0;return e.match(/[r,l,n,m,1,3,6,7,8,0]/i)&&(n=!0),Gt.getInstance().setParameter("final",n),t},t.CORRECTIONS.article=t=>{const e=Gt.getInstance().getParameter("final");e&&Gt.getInstance().setParameter("final",!1),"\uac19\ub2e4"===t&&(t="\ub294");const n={\ub294:"\uc740",\uc640:"\uacfc",\ub97c:"\uc744",\ub85c:"\uc73c\ub85c"}[t];return void 0!==n&&e?n:t},t}()),Be},nb:function(){return Ze||(Ze=function(){const t=_t();return t.NUMBERS=Ke,t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=Ke.numberToWords,t.FUNCTIONS.radicalNestDepth=xt,t}()),Ze},nn:function(){return un||(un=function(){const t=_t();return t.NUMBERS=Ke,t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=Ke.numberToWords,t.FUNCTIONS.radicalNestDepth=xt,t.SUBISO={default:"",current:"",all:["","alt"]},t}()),un},sv:function(){return mn||(mn=function(){const t=_t();return t.NUMBERS=pn,t.FUNCTIONS.radicalNestDepth=xt,t.FUNCTIONS.fontRegexp=function(t){return new RegExp("((^"+t+" )|( "+t+"$))")},t.ALPHABETS.combiner=Mt.prefixCombiner,t.ALPHABETS.digitTrans.default=pn.numberToWords,t.CORRECTIONS.correctOne=t=>t.replace(/^ett$/,"en"),t}()),mn},nemeth:function(){return ln||(ln=function(){const t=_t();return t.NUMBERS=en,t.COMBINERS={postfixCombiner:rn,germanCombiner:on,embellishCombiner:sn,doubleEmbellishCombiner:an,parensCombiner:cn},t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t),t.FUNCTIONS.si=Ct,t.ALPHABETS.combiner=(t,e,n)=>e?e+n+t:nn(t),t.ALPHABETS.digitTrans={default:en.numberToWords},t}()),ln}};function En(){const t=function(){const t=s.ensureLocale(B.getInstance().options.locale,B.getInstance().defaultLocale);return B.getInstance().options.locale=t,gn[t]()}();if(function(t){const e=B.getInstance().options.subiso;-1===t.SUBISO.all.indexOf(e)&&(B.getInstance().options.subiso=t.SUBISO.default);t.SUBISO.current=B.getInstance().options.subiso}(t),t){for(const e of Object.getOwnPropertyNames(t))Pt[e]=t[e];for(const[e,n]of Object.entries(t.CORRECTIONS))Gt.getInstance().setCorrection(e,n)}}var Nn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};const Sn={functionApplication:String.fromCodePoint(8289),invisibleTimes:String.fromCodePoint(8290),invisibleComma:String.fromCodePoint(8291),invisiblePlus:String.fromCodePoint(8292)};class Tn extends Map{get(t){return super.get(t)||{role:It.UNKNOWN,type:St.UNKNOWN,font:bt.UNKNOWN}}}class In extends Map{set(t,e,n=""){return super.set(this.secKey(e,t),n||e),this}has(t,e){return super.has(this.secKey(e,t))}get(t,e){return super.get(this.secKey(e,t))}secKey(t,e){return e?`${t} ${e}`:`${t}`}}const An={Meaning:new Tn,Secondary:new In,FencesHoriz:new Map,FencesVert:new Map,FencesSecondary:new Map,LatexCommands:new Map};function bn(t,e){for(const n of t)An.Meaning.set(n,{role:e.role||It.UNKNOWN,type:e.type||St.UNKNOWN,font:e.font||bt.UNKNOWN}),e.secondary&&An.Secondary.set(n,e.secondary)}function Rn(t,e,n=1){const r={},o=function(t){let e=[];for(const n of t)Array.isArray(n)?e=e.concat(ft(n,{}).map(t=>parseInt(t,16))):e.push(parseInt(n,16));return e}(e);for(const e of o)r[e]||(t.set(String.fromCodePoint(e),String.fromCodePoint(e+n)),r[e]=!0,r[e+n]=!0)}const On=["0028","0029","207D","207E","208D","208E","2768","2769","276A","276B","27EE","27EF","FE59","FE5A","FF08","FF09"],yn=["005B","005D","2045","2046","298B","298C","298D","298E","298F","2990","FF3B","FF3D"],Cn=["007B","007D","2774","2775","FE5B","FE5C","FF5B","FF5D"],Ln=["2308","2309","2E22","2E23","300C","300E","FF62"],Mn=["230A","230B","2E24","2E25","300D","300F","FF63"];function vn(t,e){for(const n of t){const t=String.fromCodePoint(parseInt(n,16));An.Secondary.set(t,e),An.FencesSecondary.set(t,e)}}const wn=["cos","cot","csc","sec","sin","tan","arccos","arccot","arccsc","arcsec","arcsin","arctan"].concat(["cosh","coth","csch","sech","sinh","tanh","arcosh","arcoth","arcsch","arsech","arsinh","artanh"],["deg","det","dim","hom","ker","Tr"],["log","ln","lg","exp","gcd","lcm","arg","im","re","Pr"]);function Dn(t,e){bn(e,An.Meaning.get(t)||{type:St.FUNCTION,role:It.PREFIXFUNC})}function Pn(t,e,n,r,o,i=[],s={},a={}){const c=gt.get(Et(t,r));c&&(c.unicode.forEach(t=>{An.Meaning.set(t,{type:e,role:n,font:o}),i.forEach(e=>An.Secondary.set(t,e))}),function(t,e){for(const[n,r]of Object.entries(e)){const e=t[n];void 0!==e&&An.Meaning.set(e,r)}}(c.unicode,s),function(t,e){for(const[n,r]of Object.entries(e)){const e=t[n];void 0!==e&&An.Secondary.set(e,r)}}(c.unicode,a))}[{set:["23","26","40","5c","a1","a7","b6","bf","2017",["2022","2025"],"2027","203b","203c",["2041","2043"],["2047","2049"],["204b","204d"],"2050","2055","2056",["2058","205e"],"2234","2235","fe45","fe46","fe5f","fe60","fe68","fe6b","ff03","ff06","ff0f","ff20","ff3c"],type:St.PUNCTUATION,role:It.UNKNOWN},{set:["22","ab","bb","2dd",["2018","201f"],"2039","203a",["301d","301f"],"fe10","ff02","ff07"],type:St.PUNCTUATION,role:It.QUOTES},{set:["3b","204f","2a1f","2a3e","fe14","fe54","ff1b"],type:St.PUNCTUATION,role:It.SEMICOLON},{set:["3f","203d","fe16","fe56","ff1f"],type:St.PUNCTUATION,role:It.QUESTION},{set:["21","fe15","fe57","ff01"],type:St.PUNCTUATION,role:It.EXCLAMATION},{set:["5e","60","a8","aa","b4","ba","2c7",["2d8","2da"],"2040","207a","207d","207e","ff3e","ff40"],type:St.PUNCTUATION,role:It.OVERACCENT},{set:["b8","2db","2038","203f","2054","208a","208d","208e"],type:St.PUNCTUATION,role:It.UNDERACCENT},{set:["3a","2982","fe13","fe30","fe55","ff1a"],type:St.PUNCTUATION,role:It.COLON},{set:["2c","2063","fe50","ff0c"],type:St.PUNCTUATION,role:It.COMMA},{set:["2026",["22ee","22f1"],"fe19"],type:St.PUNCTUATION,role:It.ELLIPSIS},{set:["2e","fe52","ff0e"],type:St.PUNCTUATION,role:It.FULLSTOP},{set:["2d","207b","208b","2212","2796","fe63","ff0d"],type:St.OPERATOR,role:It.DASH,secondary:Ot.BAR},{set:["5f","af",["2010","2015"],"203e","208b",["fe49","fe4f"],"fe58","ff3f","ffe3"],type:St.PUNCTUATION,role:It.DASH,secondary:Ot.BAR},{set:["7e","2dc","2f7","303","330","334","2053","223c","223d","301c","ff5e"],type:St.OPERATOR,role:It.TILDE,secondary:Ot.TILDE},{set:["27","2b9","2ba",["2032","2037"],"2057"],type:St.PUNCTUATION,role:It.PRIME},{set:["b0"],type:St.PUNCTUATION,role:It.DEGREE},{set:["2b","b1","2064","2213","2214","2228","222a",["228c","228e"],"2294","2295","229d","229e","22bb","22bd","22c4","22ce","22d3","2304","271b","271c","2795","27cf","29fa","29fb","29fe",["2a22","2a28"],"2a2d","2a2e","2a39","2a42","2a45","2a46","2a48","2a4a","2a4c","2a4f","2a50","2a52","2a54","2a56","2a57","2a59","2a5b","2a5d",["2a61","2a63"],"2adc","2add","fe62","ff0b"],type:St.OPERATOR,role:It.ADDITION},{set:["2a","b7","d7","2020","2021","204e","2051","2062",["2217","2219"],"2227","2229","2240","2293","2297",["2299","229b"],"22a0","22a1","22b9","22bc",["22c5","22cc"],"22cf","22d2","22d4","2303","2305","2306","25cb","2715","2716","27ce","27d1",["29d1","29d7"],"29e2","2a1d",["2a2f","2a37"],["2a3b","2a3d"],"2a40","2a43","2a44","2a47","2a49","2a4b","2a4d","2a4e","2a51","2a53","2a55","2a58","2a5a","2a5c",["2a5e","2a60"],"2ada","2adb","fe61","ff0a"],type:St.OPERATOR,role:It.MULTIPLICATION},{set:["2d","af","2010","2011","2052","207b","208b","2212","2216","2238","2242","2296","229f","2796","29ff",["2a29","2a2c"],"2a3a","2a41","fe63","ff0d"],type:St.OPERATOR,role:It.SUBTRACTION},{set:["2f","f7","2044","2215","2298","2797","27cc","29bc",["29f5","29f9"],"2a38"],type:St.OPERATOR,role:It.DIVISION},{set:["25","2030","2031","ff05","fe6a"],type:St.OPERATOR,role:It.POSTFIXOP},{set:["ac","2200","2201","2203","2204","2206",["221a","221c"],"2310","ffe2"],type:St.OPERATOR,role:It.PREFIXOP},{set:["2320","2321","23aa","23ae","23af","23b2","23b3","23b6","23b7"],type:St.OPERATOR,role:It.PREFIXOP},{set:["1d7ca","1d7cb"],type:St.OPERATOR,role:It.PREFIXOP,font:bt.BOLD},{set:["3d","7e","207c","208c","221d","2237",["223a","223f"],"2243","2245","2248",["224a","224e"],["2251","225f"],"2261","2263","229c","22cd","22d5","29e4","29e6","2a66","2a67",["2a6a","2a6c"],["2a6c","2a78"],"fe66","ff1d"],type:St.RELATION,role:It.EQUALITY},{set:["3c","3e","2241","2242","2244","2246","2247","2249","224f","2250","2260","2262",["2264","2281"],"22b0","22b1",["22d6","22e1"],["22e6","22e9"],["2976","2978"],"29c0","29c1","29e1","29e3","29e5",["2a79","2abc"],["2af7","2afa"],"fe64","fe65","ff1c","ff1e"],type:St.RELATION,role:It.INEQUALITY},{set:[["2282","228b"],["228f","2292"],["22b2","22b8"],"22d0","22d1",["22e2","22e5"],["22ea","22ed"],"27c3","27c4",["27c7","27c9"],["27d5","27d7"],"27dc",["2979","297b"],"29df",["2abd","2ad8"]],type:St.RELATION,role:It.SET},{set:["2236",["27e0","27e5"],"292b","292c",["29b5","29bb"],"29be","29bf",["29c2","29d0"]],type:St.RELATION,role:It.UNKNOWN},{set:["2205",["29b0","29b4"]],type:St.IDENTIFIER,role:It.SETEMPTY},{set:["1ab2","221e",["29dc","29de"]],type:St.IDENTIFIER,role:It.INFTY},{set:["22a2","22a3",["22a6","22af"],"27da","27db","27dd","27de","2ade",["2ae2","2ae6"],"2aec","2aed"],type:St.RELATION,role:It.LOGIC},{set:["22a4","22a5","22ba","27d8","27d9","27df","2adf","2ae0",["2ae7","2aeb"],"2af1"],type:St.IDENTIFIER,role:It.LOGIC},{set:[["2190","21ff"],"2301","2324","238b","2794",["2798","27af"],["27b1","27be"],["27f0","27ff"],["2900","292a"],["292d","2975"],["297c","297f"],["2b00","2b11"],["2b30","2b4c"],["ffe9","ffec"]],type:St.RELATION,role:It.ARROW},{set:["2208","220a",["22f2","22f9"],"22ff","27d2","2ad9"],type:St.OPERATOR,role:It.ELEMENT},{set:["2209"],type:St.OPERATOR,role:It.NONELEMENT},{set:["220b","220d",["22fa","22fe"]],type:St.OPERATOR,role:It.REELEMENT},{set:["220c"],type:St.OPERATOR,role:It.RENONELEMENT},{set:[["220f","2211"],["22c0","22c3"],["2a00","2a0b"],"2a3f","2afc","2aff"],type:St.LARGEOP,role:It.SUM},{set:["2140"],type:St.LARGEOP,role:It.SUM,font:bt.DOUBLESTRUCK},{set:[["222b","2233"],["2a0c","2a17"],["2a17","2a1c"]],type:St.LARGEOP,role:It.INTEGRAL},{set:[["2500","257F"]],type:St.RELATION,role:It.BOX},{set:[["2580","259F"]],type:St.IDENTIFIER,role:It.BLOCK},{set:[["25A0","25FF"],["2B12","2B2F"],["2B50","2B59"]],type:St.RELATION,role:It.GEOMETRY},{set:["220e","2300","2302","2311","29bd","29e0",["29e8","29f3"],"2a1e","2afe","ffed","ffee"],type:St.OPERATOR,role:It.GEOMETRY},{set:[["221f","2222"],"22be","22bf",["2312","2314"],"237c","27c0",["299b","29af"]],type:St.OPERATOR,role:It.GEOMETRY},{set:["24",["a2","a5"],"b5","2123",["2125","2127"],"212a","212b","fe69","ff04","ffe0","ffe1","ffe5","ffe6"],type:St.IDENTIFIER,role:It.UNKNOWN},{set:["a9","ae","210f","2114","2116","2117",["211e","2122"],"212e","2132",["2139","213b"],["2141","2144"],"214d","214e",["1f12a","1f12c"],"1f18a"],type:St.IDENTIFIER,role:It.OTHERLETTER},{set:["2224","2226","2239","2307","27b0","27bf","27c1","27c2","27ca","27cb","27cd","27d0","27d3","27d4","2981","2999","299a","29e7","29f4","2a20","2a21","2a64","2a65","2a68","2a69","2ae1",["2aee","2af0"],"2af2","2af3","2af5","2af6","2afb","2afd"],type:St.OPERATOR,role:It.UNKNOWN},{set:["2605","2606","26aa","26ab",["2720","274d"]],type:St.OPERATOR,role:It.UNKNOWN},{set:[["2145","2149"]],type:St.IDENTIFIER,role:It.LATINLETTER,font:bt.DOUBLESTRUCKITALIC,secondary:Ot.ALLLETTERS},{set:[["213c","213f"]],type:St.IDENTIFIER,role:It.GREEKLETTER,font:bt.DOUBLESTRUCK,secondary:Ot.ALLLETTERS},{set:["3d0","3d7","3f6",["1d26","1d2a"],"1d5e","1d60",["1d66","1d6a"]],type:St.IDENTIFIER,role:It.GREEKLETTER,font:bt.NORMAL,secondary:Ot.ALLLETTERS},{set:[["2135","2138"]],type:St.IDENTIFIER,role:It.OTHERLETTER,font:bt.NORMAL,secondary:Ot.ALLLETTERS},{set:["131","237"],type:St.IDENTIFIER,role:It.LATINLETTER,font:bt.NORMAL},{set:["1d6a4","1d6a5"],type:St.IDENTIFIER,role:It.LATINLETTER,font:bt.ITALIC},{set:["2113","2118"],type:St.IDENTIFIER,role:It.LATINLETTER,font:bt.SCRIPT},{set:[["c0","d6"],["d8","f6"],["f8","1bf"],["1c4","2af"],["1d00","1d25"],["1d6b","1d9a"],["1e00","1ef9"],["363","36f"],["1dd3","1de6"],["1d62","1d65"],"1dca","2071","207f",["2090","209c"],"2c7c"],type:St.IDENTIFIER,role:It.LATINLETTER,font:bt.NORMAL},{set:[["00bc","00be"],["2150","215f"],"2189"],type:St.NUMBER,role:It.FLOAT},{set:["23E8",["3248","324f"]],type:St.NUMBER,role:It.INTEGER},{set:[["214A","214C"],"2705","2713","2714","2717","2718"],type:St.IDENTIFIER,role:It.UNKNOWN},{set:["20","a0","ad",["2000","200f"],["2028","202f"],["205f","2060"],"206a","206b","206e","206f","feff",["fff9","fffb"]],type:St.TEXT,role:It.SPACE},{set:["7c","a6","2223","23b8","23b9","23d0","2758",["fe31","fe34"],"ff5c","ffe4","ffe8"],type:St.FENCE,role:It.NEUTRAL},{set:["2016","2225","2980","2af4"],type:St.FENCE,role:It.METRIC}].forEach(t=>{var{set:e}=t,n=Nn(t,["set"]);return bn(function(t){let e=[];for(const n of t)Array.isArray(n)?e=e.concat(pt(n)):e.push(String.fromCodePoint(parseInt(n,16)));return e}(e),n)}),Rn(An.FencesVert,["23b4",["23dc","23e1"],["fe35","fe44"],"fe47"]),Rn(An.FencesHoriz,["28","2045","207D","208D",["2308","230f"],["231c","231f"],"2329","23b0",["2768","2775"],"27c5",["27e6","27ef"],["2983","2998"],["29d8","29db"],"29fc",["2e22","2e29"],["3008","3011"],["3014","301b"],"fd3e","fe17",["fe59","fe5e"],"ff08","ff5f","ff62"]),Rn(An.FencesHoriz,["5b","7b","ff3b","ff5b"],2),Rn(An.FencesHoriz,[["239b","23a6"]],3),Rn(An.FencesHoriz,[["23a7","23a9"]],4),bn([...An.FencesHoriz.keys()],{type:St.FENCE,role:It.OPEN}),bn([...An.FencesHoriz.values()],{type:St.FENCE,role:It.CLOSE}),bn([...An.FencesVert.keys()],{type:St.FENCE,role:It.TOP}),bn([...An.FencesVert.values()],{type:St.FENCE,role:It.BOTTOM}),vn(On,Ot.PAREN),vn(Cn,Ot.CURLY),vn(yn,Ot.BRACKET),vn(Ln,Ot.CEIL),vn(Mn,Ot.FLOOR),function(){for(const[t,e]of Object.entries(bt)){const n=!!J[t]?bt.UNKNOWN:e===bt.FULLWIDTH?bt.NORMAL:e;Pn(Z.LATINCAP,St.IDENTIFIER,It.LATINLETTER,e,n,[Ot.ALLLETTERS]),Pn(Z.LATINSMALL,St.IDENTIFIER,It.LATINLETTER,e,n,[Ot.ALLLETTERS],{},{3:Ot.D}),Pn(Z.GREEKCAP,St.IDENTIFIER,It.GREEKLETTER,e,n,[Ot.ALLLETTERS]),Pn(Z.GREEKSMALL,St.IDENTIFIER,It.GREEKLETTER,e,n,[Ot.ALLLETTERS],{0:{type:St.OPERATOR,role:It.PREFIXOP,font:n},26:{type:St.OPERATOR,role:It.PREFIXOP,font:n}}),Pn(Z.DIGIT,St.NUMBER,It.INTEGER,e,n)}}(),bn(["inf","lim","liminf","limsup","max","min","sup","injlim","projlim"],{type:St.FUNCTION,role:It.LIMFUNC}),bn(wn,{type:St.FUNCTION,role:It.PREFIXFUNC}),bn(["mod","rem"],{type:St.OPERATOR,role:It.PREFIXFUNC});class _n{constructor(){this.rules=new Map}static parseUnicode(t){const e=parseInt(t,16);return String.fromCodePoint(e)}static testDynamicConstraints_(t,e){return B.getInstance().options.strict?e.cstr.equal(t):B.getInstance().comparator.match(e.cstr)}defineRulesFromMappings(t,e,n){for(const[r,o]of Object.entries(n))for(const[n,i]of Object.entries(o))this.defineRuleFromStrings(t,e,r,n,i)}getRules(t){let e=this.rules.get(t);return e||(e=[],this.rules.set(t,e)),e}defineRuleFromStrings(t,e,n,r,o){let i=this.getRules(t);const s=B.getInstance().parsers[n]||B.getInstance().defaultParser,a=B.getInstance().comparators[n],c=`${t}.${e}.${n}.${r}`,l=s.parse(c),u=a?a():B.getInstance().comparator,h=u.getReference();u.setReference(l);const d={cstr:l,action:o};i=i.filter(t=>!l.equal(t.cstr)),i.push(d),this.rules.set(t,i),u.setReference(h)}lookupRule(t,e){let n=this.getRules(e.getValue(C.LOCALE));return n=n.filter(function(t){return _n.testDynamicConstraints_(e,t)}),1===n.length?n[0]:n.length?n.sort((t,e)=>B.getInstance().comparator.compare(t.cstr,e.cstr))[0]:null}}let xn=M.DEFAULT_VALUES[C.LOCALE],Fn=M.DEFAULT_VALUES[C.MODALITY];function Un(t){return!(!t.locale&&!t.modality)&&(xn=t.locale||xn,Fn=t.modality||Fn,!0)}let kn={};function Bn(t){kn=t}const Gn=new Map,Vn=new Map;function Hn(t,e){let n=Gn.get(e);return n||(n=new _n,n.base=Vn.get(t),Gn.set(e,n),n)}function jn(t){const e=Vn.get(t.key);if(!e)return;const n=t.names;Object.assign(t,e),n&&e.names&&(t.names=t.names.concat(n))}function qn(t,e,n){Hn(t,e).defineRulesFromMappings(xn,Fn,n)}function $n(t,e,n,r){Hn(n,n).defineRuleFromStrings(xn,Fn,t,e,r)}function Xn(t){if(!Un(t))for(const[e,n]of Object.entries(t))$n("default","default",e,n)}function Yn(t){for(let e,n=0;e=t.names[n];n++)qn(t.key,e,t.mappings)}function Wn(t){for(const e of Object.keys(kn)){const n=Object.assign({},t);n.mappings={};const r=kn[e];n.names=n.names.map(function(t){return e+t});for(const e of Object.keys(t.mappings)){n.mappings[e]={};for(const o of Object.keys(t.mappings[e]))n.mappings[e][o]=gn[xn]().FUNCTIONS.si(r,t.mappings[e][o])}Yn(n)}}function Kn(t){const e=Gn.get(t);return(null==e?void 0:e.base)?e.base.category:""}function zn(t,e){return e=e||{},t.length?(e[t[0]]=zn(t.slice(1),e[t[0]]),e):e}B.getInstance().evaluator=function(t,e){const n=function(t,e){const n=Gn.get(t);return n?n.lookupRule(null,e):null}(t,e);return n?n.action:null};class Qn{constructor(t,e){this.speech=t,this.attributes=e}static empty(){return new Qn("",{})}static stringEmpty(t){return new Qn(t,{})}static stringAttr(t,e){return new Qn(t,e)}static singleton(t,e={}){return[Qn.stringAttr(t,e)]}static node(t,e,n={}){const r=Qn.getAttributes(e);return Object.assign(r,n),new Qn(t,r)}static getAttributes(t){const e={};for(const n of Qn.attributeList)t.hasAttribute(n)&&(e[n]=t.getAttribute(n));return e}}Qn.attributeList=["id","extid"];class Jn{constructor(t=null){this.data=t,this.prev=null,this.next=null}}class Zn extends Set{constructor(t){super(),this.annotations=[],this.anchor=new Jn,this.anchor.next=this.anchor,this.anchor.prev=this.anchor,t.forEach(t=>{const e=new Jn(t);t.annotation&&this.annotations.push(e),this.push(e)})}first(){return this.empty?null:this.anchor.next}last(){return this.empty?null:this.anchor.prev}push(t){t.next=this.anchor,t.prev=this.anchor.prev,t.prev.next=t,this.anchor.prev=t,super.add(t)}pop(){const t=this.last();return t?(this.delete(t),t):null}delete(t){return!!this.has(t)&&(super.delete(t),t.prev.next=t.next,t.next=t.prev,!0)}insertAfter(t,e){this.insertBefore(t,e.next)}insertBefore(t,e){const n=new Jn(t);e&&this.has(e)?(e.prev.next=n,n.prev=e.prev,n.next=e,e.prev=n):this.push(n)}prevText(t){do{t=t.prev}while(t!==this.anchor&&!t.data.text);return t===this.anchor?null:t}*[Symbol.iterator](){let t=this.anchor.next;for(;t!==this.anchor;)yield t,t=t.next}nextText(t){for(;t!==this.anchor&&!t.data.text;)t=t.next;return t}clear(){this.anchor.next=this.anchor,this.anchor.prev=this.anchor,super.clear()}empty(){return this.anchor.prev===this.anchor&&this.anchor===this.anchor.next}toList(){const t=[];let e=this.anchor.next;for(;e!==this.anchor;)t.push(e.data),e=e.next;return t}}class tr{static create(t,e={}){return t.text=Gt.getInstance().apply(t.text,e),new tr(t)}constructor({context:t,text:e,userValue:n,annotation:r,attributes:o,personality:i,layout:s}){this.context=t||"",this.text=e||"",this.userValue=n||"",this.annotation=r||"",this.attributes=o||{},this.personality=i||{},this.layout=s||""}isEmpty(){return 0===this.context.length&&0===this.text.length&&0===this.userValue.length&&0===this.annotation.length}clone(){let t,e;if(this.personality){t={};for(const[e,n]of Object.entries(this.personality))t[e]=n}if(this.attributes){e={};for(const[t,n]of Object.entries(this.attributes))e[t]=n}return new tr({context:this.context,text:this.text,userValue:this.userValue,annotation:this.annotation,personality:t,attributes:e,layout:this.layout})}toString(){return'AuditoryDescription(context="'+this.context+'" text="'+this.text+'" userValue="'+this.userValue+'" annotation="'+this.annotation+'")'}descriptionString(){return this.context&&this.text?this.context+" "+this.text:this.context||this.text}descriptionSpan(){return Qn.stringAttr(this.descriptionString(),this.attributes)}equals(t){return this.context===t.context&&this.text===t.text&&this.userValue===t.userValue&&this.annotation===t.annotation}}const er=new Map;function nr(t,e,n){const r={};if(e){const t=er.get(e)||{};Object.assign(r,t)}er.set(t,Object.assign(r,n))}function rr(t,e){const n=t.length;let r=0,o=e;return e||(o=""),function(){return r<n&&(r+=1),o+" "+r}}function or(t,e){const n=parseFloat(e),r=isNaN(n)?e:n;return function(){return[tr.create({text:"",personality:{pause:r}})]}}function ir(t,e){let n;return n=t.length>0?X("../../content/*",t[0]):[],function(){const t=n.shift(),r=e?[tr.create({text:e},{translate:!0})]:[];if(!t)return r;const o=B.evaluateNode(t);return r.concat(o)}}function sr(t,e){const n=e.split("-"),r=rr(t,n[0]||""),o=n[1]||"",i=n[2]||"";let s=!0;return function(){const t=r();return s?(s=!1,i+t+o):t+o}}function ar(t){if(function(t){if(!t.hasAttribute("annotation"))return!1;const e=t.getAttribute("annotation");return!!/clearspeak:simple$|clearspeak:simple;/.exec(e)}(t))return!0;if(t.tagName!==St.SUBSCRIPT)return!1;const e=t.childNodes[0].childNodes,n=e[1];return e[0].tagName===St.IDENTIFIER&&(cr(n)||n.tagName===St.INFIXOP&&n.hasAttribute("role")&&n.getAttribute("role")===It.IMPLICIT&&function(t){const e=X("children/*",t);return e.every(t=>cr(t)||t.tagName===St.IDENTIFIER)}(n))}function cr(t){return t.tagName===St.NUMBER&&t.hasAttribute("role")&&t.getAttribute("role")===It.INTEGER}function lr(t){return X(t.tagName===St.MATRIX?"children/row/children/cell/children/*":"children/line/children/*",t).every(ar)?[t]:[]}function ur(t){return wt(t,20,11)?[t]:[]}function hr(t){const e=parseInt(t.textContent,10);return[Qn.stringEmpty(isNaN(e)?t.textContent:e>10?Pt.NUMBERS.numericOrdinal(e):Pt.NUMBERS.wordOrdinal(e))]}let dr=null;function fr(t){let e=0;const n=t.textContent,r="open"===t.getAttribute("role")?0:1;let o=t.parentNode;for(;o;)o.tagName===St.FENCED&&o.childNodes[0].childNodes[r].textContent===n&&e++,o=o.parentNode;return dr=e>1?Pt.NUMBERS.wordOrdinal(e):"",[Qn.stringEmpty(dr)]}function pr(t){const e=t.previousSibling;let n,r;return e?(n=e,r=t):(n=t,r=t.nextSibling),r&&function(t,e){const n=An.Meaning.get(t);return n.type===St.FENCE&&(n.role===It.NEUTRAL||n.role===It.METRIC?t===e:An.FencesHoriz.get(t)===e||An.FencesVert.get(t)===e)}(n.textContent,r.textContent)?[t]:[]}function mr(t){const e=W(t.parentNode.childNodes),n=X("../../children/*",t),r=e.indexOf(t);return Nr(n[r])||Nr(n[r+1])?[t]:[]}function gr(t){const e=W(t.parentNode.childNodes),n=X("../../children/*",t),r=e.indexOf(t);return Er(n[r])&&n[r+1]&&(Er(n[r+1])||n[r+1].tagName===St.ROOT||n[r+1].tagName===St.SQRT||n[r+1].tagName===St.SUPERSCRIPT&&n[r+1].childNodes[0].childNodes[0]&&(n[r+1].childNodes[0].childNodes[0].tagName===St.NUMBER||n[r+1].childNodes[0].childNodes[0].tagName===St.IDENTIFIER)&&("2"===n[r+1].childNodes[0].childNodes[1].textContent||"3"===n[r+1].childNodes[0].childNodes[1].textContent))?[t]:[]}function Er(t){return!!t&&(t.tagName===St.NUMBER||t.tagName===St.IDENTIFIER||t.tagName===St.FUNCTION||t.tagName===St.APPL||t.tagName===St.FRACTION)}function Nr(t){return t&&(t.tagName===St.FENCED||t.hasAttribute("role")&&t.getAttribute("role")===It.LEFTRIGHT||function(t){return!!t&&(t.tagName===St.MATRIX||t.tagName===St.VECTOR)}(t))}function Sr(t){return[Qn.stringEmpty(Pt.NUMBERS.wordOrdinal(parseInt(t.textContent,10)))]}function Tr(t){return Kn(t.textContent+":unit")?[t]:[]}function Ir(t,e){const n=[];for(;t.length||e.length;)t.length&&n.push(t.shift()),e.length&&n.push(e.shift());return n}function Ar(t,e){return t?e?t.filter(t=>e.indexOf(t)<0):t:[]}Gt.getInstance().setCorrection("insertNesting",function(t,e){if(!e||!t)return t;const n=t.match(/^(open|close) /);return n?n[0]+e+" "+t.substring(n[0].length):e+" "+t});const br={factory:null,options:new x,updateFactory:function(t){br.factory=t},heuristics:new Map,flags:{combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},blacklist:{},add:function(t){const e=t.name;br.heuristics.set(e,t),br.flags[e]||(br.flags[e]=!1)},run:function(t,e,n){const r=br.heuristics.get(t);return r&&!br.blacklist[t]&&(br.flags[t]||r.applicable(e))?r.apply(e):n?n(e):e}},Rr=[];function Or(t,e){for(let n,r=0;n=Rr[r];r++){const r=n.compare(t,e);if(0!==r)return r}return 0}function yr(t){if(t.length<=1)return t;const e=t.slice();!function(t){t.sort(Or)}(e);const n=[];let r;do{r=e.pop(),n.push(r)}while(r&&e.length&&0===Or(e[e.length-1],r));return n}function Cr(t,e){return t.match(/^.+:.+$/)||!e?t:t+":"+e}new class{constructor(t,e=null){this.comparator=t,this.type=e,function(t){Rr.push(t)}(this)}compare(t,e){return this.type&&this.type===t.type&&this.type===e.type?this.comparator(t,e):0}}(function(t,e){return t.role===It.SIMPLEFUNC?1:e.role===It.SIMPLEFUNC?-1:0},St.IDENTIFIER);class Lr extends Map{set(t,e){return super.set(Cr(t,e.font),e),this}setNode(t){this.set(t.textContent,t.meaning())}get(t,e=null){return super.get(Cr(t,e))}getNode(t){return this.get(t.textContent,t.font)}}class Mr extends Map{add(t,e){const n=this.get(t);n?n.push(e):super.set(t,[e])}get(t,e=null){return super.get(Cr(t,e))}getNode(t){return this.get(t.textContent,t.font)}minimize(){for(const[t,e]of this)1===e.length&&this.delete(t)}isMultiValued(){for(const t of this.values())if(t.length>1)return!0;return!1}}class vr extends Mr{add(t,e){super.add(Cr(t,e.font),e)}addNode(t){this.add(t.textContent,t)}toString(){const t=[];for(const[e,n]of this){const r=Array(e.length+3).join(" "),o=n.map(t=>t.toString()).join("\n"+r);t.push(e+": "+o)}return t.join("\n")}collateMeaning(){const t=new wr;for(const[e,n]of this)t.set(e,n.map(t=>t.meaning()));return t}}class wr extends Mr{add(t,e){const n=this.get(t,e.font);n&&n.find(function(t){return r=e,(n=t).type===r.type&&n.role===r.role&&n.font===r.font;var n,r})||super.add(Cr(t,e.font),e)}addNode(t){this.add(t.textContent,t.meaning())}toString(){const t=[];for(const[e,n]of this){const r=Array(e.length+3).join(" "),o=n.map(t=>`{type: ${t.type}, role: ${t.role}, font: ${t.font}}`).join("\n"+r);t.push(e+": "+o)}return t.join("\n")}reduce(){for(const[t,e]of this)1!==e.length&&this.set(t,yr(e))}default(){const t=new Lr;for(const[e,n]of this)1===n.length&&t.set(e,n[0]);return t}newDefault(){const t=this.default();this.reduce();const e=this.default();return t.size!==e.size?e:null}}var Dr;!function(t){t.ANNOTATION="ANNOTATION",t.ANNOTATIONXML="ANNOTATION-XML",t.MACTION="MACTION",t.MALIGNGROUP="MALIGNGROUP",t.MALIGNMARK="MALIGNMARK",t.MATH="MATH",t.MENCLOSE="MENCLOSE",t.MERROR="MERROR",t.MFENCED="MFENCED",t.MFRAC="MFRAC",t.MGLYPH="MGLYPH",t.MI="MI",t.MLABELEDTR="MLABELEDTR",t.MMULTISCRIPTS="MMULTISCRIPTS",t.MN="MN",t.MO="MO",t.MOVER="MOVER",t.MPADDED="MPADDED",t.MPHANTOM="MPHANTOM",t.MPRESCRIPTS="MPRESCRIPTS",t.MROOT="MROOT",t.MROW="MROW",t.MS="MS",t.MSPACE="MSPACE",t.MSQRT="MSQRT",t.MSTYLE="MSTYLE",t.MSUB="MSUB",t.MSUBSUP="MSUBSUP",t.MSUP="MSUP",t.MTABLE="MTABLE",t.MTD="MTD",t.MTEXT="MTEXT",t.MTR="MTR",t.MUNDER="MUNDER",t.MUNDEROVER="MUNDEROVER",t.NONE="NONE",t.SEMANTICS="SEMANTICS"}(Dr||(Dr={}));const Pr=Object.values(Dr),_r=[Dr.MO,Dr.MI,Dr.MN,Dr.MTEXT,Dr.MS,Dr.MSPACE],xr=[Dr.MERROR,Dr.MPHANTOM,Dr.MALIGNGROUP,Dr.MALIGNMARK,Dr.MPRESCRIPTS,Dr.ANNOTATION,Dr.ANNOTATIONXML],Fr=[Dr.MATH,Dr.MROW,Dr.MPADDED,Dr.MACTION,Dr.NONE,Dr.MSTYLE,Dr.SEMANTICS],Ur=[Dr.MROOT,Dr.MSQRT],kr=["aria-label","exact-speech","alt"];function Br(t){return!!t&&lt(t)===Dr.MATH}function Gr(t){return!!t&&(xr.includes(lt(t))||!Pr.includes(lt(t)))}function Vr(t){return!!t&&Fr.includes(lt(t))}function Hr(t){return!!t&&lt(t)===Dr.MGLYPH&&!function(t){return!!t&&_r.includes(lt(t))}(t.parentNode)}function jr(t){const e=[];for(let n,r=0;n=t[r];r++){if(n.nodeType!==z.ELEMENT_NODE)continue;const t=lt(n);xr.includes(t)||(Fr.includes(t)&&0===n.childNodes.length||e.push(n))}return e}function qr(t,e){var n;if(null===(n=e.attributes)||void 0===n?void 0:n.length){const n=e.attributes;for(let e=n.length-1;e>=0;e--){const r=n[e].name;r.match(/^ext/)&&(t.attributes[r]=n[e].value,t.nobreaking=!0),kr.includes(r)&&(t.attributes["ext-speech"]=n[e].value,t.nobreaking=!0),"href"===r&&(t.attributes.href=n[e].value,t.nobreaking=!0),"data-latex"!==r.toLowerCase()&&"latex"!==r.toLowerCase()||(t.attributes.latex=n[e].value),r.match(/texclass$/)&&(t.attributes.texclass=n[e].value),"color"!==r&&"mathcolor"!==r||(t.attributes.color=n[e].value)}}}function $r(t){return t&&t.embellished&&t.childNodes.length>0?$r(t.childNodes[0]):t}function Xr(t,e,n){n&&t.reverse();const r=[];for(let o,i=0;o=t[i];i++){if(e(o))return n?{head:t.slice(i+1).reverse(),div:o,tail:r.reverse()}:{head:r,div:o,tail:t.slice(i+1)};r.push(o)}return n?{head:[],div:null,tail:r.reverse()}:{head:r,div:null,tail:[]}}function Yr(t,e){let n=t;const r=[],o=[];let i=null;do{i=Xr(n,e),o.push(i.head),r.push(i.div),n=i.tail}while(i.div);return r.pop(),{rel:r,comp:o}}function Wr(t,e){if(t.mathmlTree)return;const n=new Set;if(e.forEach(t=>{var e;return n.add((null===(e=t.mathmlTree)||void 0===e?void 0:e.parentElement)||null)}),1===n.size&&!n.has(null)){const r=[...n][0];return Vr(r)&&r.childNodes.length===e.length?void(t.mathmlTree=r):void 0}if(n.has(null)&&n.size<=2&&(n.delete(null),t.mathml.forEach(e=>{e.parentElement&&!t.mathml.includes(e)&&n.add(e.parentElement)})),1===n.size&&!n.has(null)){const e=[...n][0];if(Vr(e)&&W(e.childNodes).every(e=>t.mathml.includes(e)))return void(t.mathmlTree=e)}}var Kr;!function(t){t.EMBELLISHED="embellished",t.FENCEPOINTER="fencepointer",t.FONT="font",t.ID="id",t.ANNOTATION="annotation",t.ROLE="role",t.TYPE="type",t.CHILDREN="children",t.CONTENT="content",t.TEXT="$t"}(Kr||(Kr={}));class zr{static fromXml(t){const e=parseInt(t.getAttribute("id"),10),n=new zr(e);return n.type=t.tagName,zr.setAttribute(n,t,"role"),zr.setAttribute(n,t,"font"),zr.setAttribute(n,t,"embellished"),zr.setAttribute(n,t,"fencepointer","fencePointer"),t.getAttribute("annotation")&&n.parseAnnotation(t.getAttribute("annotation")),qr(n,t),zr.processChildren(n,t),n}static setAttribute(t,e,n,r){r=r||n;const o=e.getAttribute(n);o&&(t[r]=o)}static processChildren(t,e){for(const n of W(e.childNodes)){if(n.nodeType===z.TEXT_NODE){t.textContent=n.textContent;continue}const e=W(n.childNodes).map(zr.fromXml);e.forEach(e=>e.parent=t),"CONTENT"===lt(n)?t.contentNodes=e:t.childNodes=e}}constructor(t){this.id=t,this.mathml=[],this.parent=null,this.type=St.UNKNOWN,this.role=It.UNKNOWN,this.font=bt.UNKNOWN,this.embellished=null,this.fencePointer="",this.childNodes=[],this.textContent="",this.mathmlTree=null,this.contentNodes=[],this.annotation={},this.attributes={},this.nobreaking=!1,this.noupdate=!1}querySelectorAll(t){let e=[];for(let n,r=0;n=this.childNodes[r];r++)e=e.concat(n.querySelectorAll(t));for(let n,r=0;n=this.contentNodes[r];r++)e=e.concat(n.querySelectorAll(t));return t(this)&&e.unshift(this),e}xml(t,e){const n=function(n,r){const o=r.map(function(n){return n.xml(t,e)}),i=t.createElementNS("",n);for(let t,e=0;t=o[e];e++)i.appendChild(t);return i},r=t.createElementNS("",this.type);return e||this.xmlAttributes(r),r.textContent=this.textContent,this.contentNodes.length>0&&r.appendChild(n(Kr.CONTENT,this.contentNodes)),this.childNodes.length>0&&r.appendChild(n(Kr.CHILDREN,this.childNodes)),r}toString(t=!1){const e=K("<snode/>");return ht(this.xml(e.ownerDocument,t))}allAttributes(){const t=[];return t.push([Kr.ROLE,this.role]),this.font!==bt.UNKNOWN&&t.push([Kr.FONT,this.font]),Object.keys(this.annotation).length&&t.push([Kr.ANNOTATION,this.annotationXml()]),this.embellished&&t.push([Kr.EMBELLISHED,this.embellished]),this.fencePointer&&t.push([Kr.FENCEPOINTER,this.fencePointer]),t.push([Kr.ID,this.id.toString()]),t}annotationXml(){const t=[];for(const[e,n]of Object.entries(this.annotation))n.forEach(n=>t.push(e+":"+n));return t.join(";")}attributesXml(){const t=[];for(const[e,n]of Object.entries(this.attributes))t.push(e+":"+zr.escapeValue(n));return t.join(";")}toJson(){const t={};t[Kr.TYPE]=this.type;const e=this.allAttributes();for(let n,r=0;n=e[r];r++)t[n[0]]=n[1].toString();return this.textContent&&(t[Kr.TEXT]=this.textContent),this.childNodes.length&&(t[Kr.CHILDREN]=this.childNodes.map(function(t){return t.toJson()})),this.contentNodes.length&&(t[Kr.CONTENT]=this.contentNodes.map(function(t){return t.toJson()})),t}updateContent(t,e){const n=e?t.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):t.trim();if(t=t&&!n?t:n,this.textContent===t)return;const r=An.Meaning.get(t.replace(/\s/g," "));this.textContent=t,this.role=r.role,this.type=r.type,this.font=r.font}addMathmlNodes(t){for(let e,n=0;e=t[n];n++)-1===this.mathml.indexOf(e)&&this.mathml.push(e)}appendChild(t){this.childNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this}replaceChild(t,e){const n=this.childNodes.indexOf(t);if(-1===n)return;t.parent=null,e.parent=this,this.childNodes[n]=e;const r=t.mathml.filter(function(t){return-1===e.mathml.indexOf(t)}),o=e.mathml.filter(function(e){return-1===t.mathml.indexOf(e)});this.removeMathmlNodes(r),this.addMathmlNodes(o)}appendContentNode(t){t&&(this.contentNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this)}removeContentNode(t){if(t){const e=this.contentNodes.indexOf(t);-1!==e&&this.contentNodes.slice(e,1)}}equals(t){if(!t)return!1;if(this.type!==t.type||this.role!==t.role||this.textContent!==t.textContent||this.childNodes.length!==t.childNodes.length||this.contentNodes.length!==t.contentNodes.length)return!1;for(let e,n,r=0;e=this.childNodes[r],n=t.childNodes[r];r++)if(!e.equals(n))return!1;for(let e,n,r=0;e=this.contentNodes[r],n=t.contentNodes[r];r++)if(!e.equals(n))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(t,e){e&&this.addAnnotation_(t,e)}getAnnotation(t){const e=this.annotation[t];return e||[]}hasAnnotation(t,e){const n=this.annotation[t];return!!n&&-1!==n.indexOf(e)}parseAnnotation(t){const e=t.split(";");for(let t=0,n=e.length;t<n;t++){const n=e[t].split(":");this.addAnnotation(n[0],n[1])}}meaning(){return{type:this.type,role:this.role,font:this.font}}xmlAttributes(t){const e=this.allAttributes();for(let n,r=0;n=e[r];r++)t.setAttribute(n[0],n[1]);this.addExternalAttributes(t)}addExternalAttributes(t){for(const[e,n]of Object.entries(this.attributes))t.setAttribute(e,n)}static escapeValue(t){return t.replace(/;/g,"\\0003B")}parseAttributes(t){if(!t)return;const e=t.split(";");for(let t=0,n=e.length;t<n;t++){const[n,...r]=e[t].split(":");n&&(this.attributes[n]=r.join("").replace(/\\0003B/g,";"))}}removeMathmlNodes(t){const e=this.mathml;for(let n,r=0;n=t[r];r++){const t=e.indexOf(n);-1!==t&&e.splice(t,1)}this.mathml=e}displayTree_(t){t++;const e=Array(t).join(" ");let n="";n+="\n"+e+this.toString(),n+="\n"+e+"MathmlTree:",n+="\n"+e+this.mathmlTreeString(),n+="\n"+e+"MathML:";for(let t,r=0;t=this.mathml[r];r++)n+="\n"+e+t.toString();return n+="\n"+e+"Begin Content",this.contentNodes.forEach(function(e){n+=e.displayTree_(t)}),n+="\n"+e+"End Content",n+="\n"+e+"Begin Children",this.childNodes.forEach(function(e){n+=e.displayTree_(t)}),n+="\n"+e+"End Children",n}mathmlTreeString(){return this.mathmlTree?this.mathmlTree.toString():"EMPTY"}addAnnotation_(t,e){const n=this.annotation[t];n&&!n.includes(e)?n.push(e):this.annotation[t]=[e]}}class Qr{constructor(){this.leafMap=new vr,this.defaultMap=new Lr,this.idCounter_=-1}makeNode(t){return this.createNode_(t)}makeUnprocessed(t){const e=this.createNode_();return e.addMathmlNodes([t]),e.mathmlTree=t,e}makeEmptyNode(){const t=this.createNode_();return t.type=St.EMPTY,t}makeContentNode(t){const e=this.createNode_();return e.updateContent(t),e}makeMultipleContentNodes(t,e){const n=[];for(let r=0;r<t;r++)n.push(this.makeContentNode(e));return n}makeLeafNode(t,e){if(!t)return this.makeEmptyNode();const n=this.makeContentNode(t);n.font=e||n.font;const r=this.defaultMap.getNode(n);return r&&(n.type=r.type,n.role=r.role,n.font=r.font),this.leafMap.addNode(n),n}makeBranchNode(t,e,n,r){const o=this.createNode_();return r&&o.updateContent(r),o.type=t,o.childNodes=e,o.contentNodes=n,e.concat(n).forEach(function(t){t.parent=o,o.addMathmlNodes(t.mathml)}),o}createNode_(t){return void 0!==t?this.idCounter_=Math.max(this.idCounter_,t):t=++this.idCounter_,new zr(t)}}function Jr(t,e){return t.type===e}function Zr(t,e){return t.embellished===e}function to(t,e){return t.role===e}function eo(t){return Jr(t,St.FENCE)||Jr(t,St.PUNCTUATION)||Jr(t,St.OPERATOR)||Jr(t,St.RELATION)}function no(t){return co(t)&&!to(t,It.DIVISION)||Jr(t,St.APPL)||so(t)}function ro(t){return co(t)||so(t)}function oo(t,e){return!!e&&Jr(e,St.IDENTIFIER)&&An.Secondary.has(t.textContent,Ot.D)}function io(t){if(Jr(t,St.IDENTIFIER)){const e=t.textContent[0];return e&&t.textContent[1]&&An.Secondary.has(e,Ot.D)}return!1}function so(t){return lo(t)||uo(t)}function ao(t){return t.embellished?t.embellished:(e=t.type)===St.OPERATOR||e===St.RELATION||e===St.FENCE||e===St.PUNCTUATION?t.type:null;var e}function co(t){return Jr(t,St.OPERATOR)||Zr(t,St.OPERATOR)}function lo(t){return Jr(t,St.RELATION)||Zr(t,St.RELATION)}function uo(t){return Jr(t,St.PUNCTUATION)||Zr(t,St.PUNCTUATION)}function ho(t){return Jr(t,St.FENCE)||Zr(t,St.FENCE)}function fo(t){return!(!t||!ho(t))&&(!t.embellished||po(t))}function po(t){return!t.embellished||!function(t){return Jr(t,St.TENSOR)&&(!Jr(t.childNodes[1],St.EMPTY)||!Jr(t.childNodes[2],St.EMPTY))&&(!Jr(t.childNodes[3],St.EMPTY)||!Jr(t.childNodes[4],St.EMPTY))}(t)&&((!to(t,It.CLOSE)||!Jr(t,St.TENSOR))&&((!to(t,It.OPEN)||!Jr(t,St.SUBSCRIPT)&&!Jr(t,St.SUPERSCRIPT))&&po(t.childNodes[0])))}function mo(t){return!!t&&(Jr(t,St.TABLE)||Jr(t,St.MULTILINE))}function go(t){return!!t&&Eo(t)&&mo(t.childNodes[0])}function Eo(t){return!!t&&Jr(t,St.FENCED)&&(to(t,It.LEFTRIGHT)||Do(t))&&1===t.childNodes.length}function No(t,e){return e.length>0&&to(e[e.length-1],It.OPENFENCE)}function So(t){return t.childNodes.every(function(t){return t.childNodes.length<=1})}function To(t){return Jr(t,St.LINE)&&t.contentNodes.length&&to(t.contentNodes[0],It.LABEL)}function Io(t){return Jr(t,St.LARGEOP)||Jr(t,St.LIMBOTH)||Jr(t,St.LIMLOWER)||Jr(t,St.LIMUPPER)||Jr(t,St.FUNCTION)&&to(t,It.LIMFUNC)||(Jr(t,St.OVERSCORE)||Jr(t,St.UNDERSCORE))&&Io(t.childNodes[0])}function Ao(t,e,n){return 1===e.length&&(t[n].type===St.PUNCTUATION||t[n].embellished===St.PUNCTUATION)&&t[n]===e[0]}function bo(t){return Jr(t,St.IDENTIFIER)&&to(t,It.SIMPLEFUNC)}const Ro=[St.PUNCTUATION,St.PUNCTUATED,St.RELSEQ,St.MULTIREL,St.TABLE,St.MULTILINE,St.CASES,St.INFERENCE],Oo=[St.LIMUPPER,St.LIMLOWER,St.LIMBOTH,St.SUBSCRIPT,St.SUPERSCRIPT,St.UNDERSCORE,St.OVERSCORE,St.TENSOR];function yo(t){const e=t.type;return-1===Ro.indexOf(e)&&(e!==St.INFIXOP||t.role===It.IMPLICIT)&&(e===St.FENCED?t.role!==It.LEFTRIGHT||yo(t.childNodes[0]):-1===Oo.indexOf(e)||yo(t.childNodes[0]))}function Co(t){return function(t){return t.type===St.NUMBER&&(t.role===It.INTEGER||t.role===It.FLOAT)}(t)||t.role===It.VULGAR||t.role===It.MIXED}function Lo(t){const e=t.childNodes;return t.role===It.UNIT&&(!e.length||e[0].role===It.UNIT)}function Mo(t){const e=t.childNodes;return t.type===St.INFIXOP&&(t.role===It.MULTIPLICATION||t.role===It.IMPLICIT)&&e.length&&(Lo(e[0])||Co(e[0]))&&t.childNodes.slice(1).every(Lo)}function vo(t){return t.type===St.INFIXOP&&(t.role===It.IMPLICIT||t.role===It.UNIT&&!!t.contentNodes.length&&t.contentNodes[0].textContent===Sn.invisibleTimes)}function wo(t){return t.type===St.INFIXOP&&t.role===It.IMPLICIT}function Do(t){return t.role===It.NEUTRAL||t.role===It.METRIC}function Po(t,e){return Do(t)&&Do(e)&&$r(t).textContent===$r(e).textContent}function _o(t){return!!Do(t)&&(!t.embellished||t.type!==St.SUPERSCRIPT&&t.type!==St.SUBSCRIPT&&(t.type!==St.TENSOR||t.childNodes[3].type===St.EMPTY&&t.childNodes[4].type===St.EMPTY))}function xo(t){return!!Do(t)&&(!t.embellished||(t.type!==St.TENSOR||t.childNodes[1].type===St.EMPTY&&t.childNodes[2].type===St.EMPTY))}function Fo(t){return[It.ELEMENT,It.NONELEMENT,It.REELEMENT,It.RENONELEMENT].includes(t.role)}class Uo{static getInstance(){return Uo.instance=Uo.instance||new Uo,Uo.instance}static tableToMultiline(t){if(!So(t))return br.run("rewrite_subcases",t,Uo.classifyTable);t.type=St.MULTILINE;for(let e,n=0;e=t.childNodes[n];n++)Uo.rowToLine_(e,It.MULTILINE);return 1===t.childNodes.length&&!To(t.childNodes[0])&&Eo(t.childNodes[0].childNodes[0])&&Uo.tableToMatrixOrVector_(Uo.rewriteFencedLine_(t)),Uo.classifyMultiline(t)}static number(t){t.type!==St.UNKNOWN&&t.type!==St.IDENTIFIER||(t.type=St.NUMBER),Uo.meaningFromContent(t,Uo.numberRole_),Uo.exprFont_(t)}static classifyMultiline(t){return Uo.binomialForm_(t),Uo.classifyMultiline_(t),t}static classifyMultiline_(t){let e=0;const n=t.childNodes.length;let r;for(;e<n&&(!(r=t.childNodes[e])||!r.childNodes.length);)e++;if(e>=n)return;const o=r.childNodes[0].role;o!==It.UNKNOWN&&t.childNodes.every(function(t){const e=t.childNodes[0];return!e||e.role===o&&(Jr(e,St.RELATION)||Jr(e,St.RELSEQ))})&&(t.role=o)}static classifyTable(t){const e=Uo.computeColumns_(t);return Uo.classifyByColumns_(t,e,It.EQUALITY)||Uo.classifyByColumns_(t,e,It.INEQUALITY,[It.EQUALITY])||Uo.classifyByColumns_(t,e,It.ARROW)||Uo.detectCaleyTable(t),t}static detectCaleyTable(t){if(!t.mathmlTree)return!1;const e=t.mathmlTree,n=e.getAttribute("columnlines"),r=e.getAttribute("rowlines");return!(!n||!r)&&(!(!Uo.cayleySpacing(n)||!Uo.cayleySpacing(r))&&(t.role=It.CAYLEY,!0))}static cayleySpacing(t){const e=t.split(" ");return("solid"===e[0]||"dashed"===e[0])&&e.slice(1).every(t=>"none"===t)}static proof(t,e,n){const r=Uo.separateSemantics(e);return Uo.getInstance().proof(t,r,n)}static findSemantics(t,e,n){const r=null==n?null:n,o=Uo.getSemantics(t);return!!o&&(!!o[e]&&(null==r||o[e]===r))}static getSemantics(t){const e=t.getAttribute("semantics");return e?Uo.separateSemantics(e):null}static removePrefix(t){const[,...e]=t.split("_");return e.join("_")}static separateSemantics(t){const e={};return t.split(";").forEach(function(t){const[n,r]=t.split(":");e[Uo.removePrefix(n)]=r}),e}static matchSpaces_(t,e){for(let n,r=0;n=e[r];r++){const e=t[r].mathmlTree,o=t[r+1].mathmlTree;if(!e||!o)continue;const i=e.nextSibling;if(!i||i===o)continue;const s=Uo.getSpacer_(i);s&&s!==o&&(n.addMathmlNodes([s]),n.mathmlTree=s,n.role=It.SPACE)}}static getSpacer_(t){if(lt(t)===Dr.MSPACE)return t;for(;Vr(t)&&1===t.childNodes.length;)if(lt(t=t.childNodes[0])===Dr.MSPACE)return t;return null}static fenceToPunct_(t){const e=Uo.FENCE_TO_PUNCT_[t.role];if(e){for(;t.embellished;)t.embellished=St.PUNCTUATION,to(t,It.SUBSUP)||to(t,It.UNDEROVER)||(t.role=e),t=t.childNodes[0];t.type=St.PUNCTUATION,t.role=e}}static classifyFunction_(t,e){if(t.type===St.APPL||t.type===St.BIGOP||t.type===St.INTEGRAL)return"";if(e[0]&&e[0].textContent===Sn.functionApplication){Uo.getInstance().funcAppls[t.id]=e.shift();let n=It.SIMPLEFUNC;return br.run("simple2prefix",t),t.role!==It.PREFIXFUNC&&t.role!==It.LIMFUNC||(n=t.role),Uo.propagateFunctionRole_(t,n),"prefix"}const n=Uo.CLASSIFY_FUNCTION_[t.role];return n||((r=t).type===St.IDENTIFIER||r.role===It.LATINLETTER||r.role===It.GREEKLETTER||r.role===It.OTHERLETTER?"simple":"");var r}static propagateFunctionRole_(t,e){if(t){if(t.type===St.INFIXOP)return;to(t,It.SUBSUP)||to(t,It.UNDEROVER)||(t.role=e),Uo.propagateFunctionRole_(t.childNodes[0],e)}}static getFunctionOp_(t,e){if(e(t))return t;for(let n,r=0;n=t.childNodes[r];r++){const t=Uo.getFunctionOp_(n,e);if(t)return t}return null}static tableToMatrixOrVector_(t){const e=t.childNodes[0];Jr(e,St.MULTILINE)?Uo.tableToVector_(t):Uo.tableToMatrix_(t),t.contentNodes.forEach(e.appendContentNode.bind(e));for(let t,n=0;t=e.childNodes[n];n++)Uo.assignRoleToRow_(t,Uo.getComponentRoles_(e));return e.parent=null,e}static tableToVector_(t){const e=t.childNodes[0];e.type=St.VECTOR,1!==e.childNodes.length?Uo.binomialForm_(e):Uo.tableToSquare_(t)}static binomialForm_(t){to(t,It.UNKNOWN)&&(2===t.childNodes.length&&(t.role=It.BINOMIAL,t.childNodes[0].role=It.BINOMIAL,t.childNodes[1].role=It.BINOMIAL))}static tableToMatrix_(t){const e=t.childNodes[0];e.type=St.MATRIX,e.childNodes&&e.childNodes.length>0&&e.childNodes[0].childNodes&&e.childNodes.length===e.childNodes[0].childNodes.length?Uo.tableToSquare_(t):e.childNodes&&1===e.childNodes.length&&(e.role=It.ROWVECTOR)}static tableToSquare_(t){const e=t.childNodes[0];to(e,It.UNKNOWN)&&(Do(t)?e.role=It.DETERMINANT:e.role=It.SQUAREMATRIX)}static getComponentRoles_(t){const e=t.role;return e&&e!==It.UNKNOWN?e:t.type.toLowerCase()||It.UNKNOWN}static tableToCases_(t,e){for(let e,n=0;e=t.childNodes[n];n++)Uo.assignRoleToRow_(e,It.CASES);return t.type=St.CASES,t.appendContentNode(e),So(t)&&Uo.binomialForm_(t),t}static rewriteFencedLine_(t){const e=t.childNodes[0],n=t.childNodes[0].childNodes[0],r=t.childNodes[0].childNodes[0].childNodes[0];return n.parent=t.parent,t.parent=n,r.parent=e,n.childNodes=[t],e.childNodes=[r],n}static rowToLine_(t,e){const n=e||It.UNKNOWN;Jr(t,St.ROW)&&(t.type=St.LINE,t.role=n,1===t.childNodes.length&&Jr(t.childNodes[0],St.CELL)&&(t.childNodes=t.childNodes[0].childNodes,t.childNodes.forEach(function(e){e.parent=t})))}static assignRoleToRow_(t,e){Jr(t,St.LINE)?t.role=e:Jr(t,St.ROW)&&(t.role=e,t.childNodes.forEach(function(t){Jr(t,St.CELL)&&(t.role=e)}))}static nextSeparatorFunction_(t){let e;if(t){if(t.match(/^\s+$/))return null;e=t.replace(/\s/g,"").split("").filter(function(t){return t})}else e=[","];return function(){return e.length>1?e.shift():e[0]}}static meaningFromContent(t,e){const n=[...t.textContent].filter(t=>t.match(/[^\s]/)),r=n.map(t=>An.Meaning.get(t));e(t,n,r)}static numberRole_(t,e,n){if(t.role===It.UNKNOWN)return n.every(function(t){return t.type===St.NUMBER&&t.role===It.INTEGER||t.type===St.PUNCTUATION&&t.role===It.COMMA})?(t.role=It.INTEGER,void("0"===e[0]&&t.addAnnotation("general","basenumber"))):void(n.every(function(t){return t.type===St.NUMBER&&t.role===It.INTEGER||t.type===St.PUNCTUATION})?t.role=It.FLOAT:t.role=It.OTHERNUMBER)}static exprFont_(t){t.font===bt.UNKNOWN&&Uo.compSemantics(t,"font",bt)}static compSemantics(t,e,n){const r=[...t.textContent].map(t=>An.Meaning.get(t)).reduce(function(t,r){return t&&r[e]&&r[e]!==n.UNKNOWN&&r[e]!==t?t===n.UNKNOWN?r[e]:null:t},n.UNKNOWN);r&&(t[e]=r)}static purgeFences_(t){const e=t.rel,n=t.comp,r=[],o=[];for(;e.length>0;){const t=e.shift();let i=n.shift();fo(t)?(r.push(t),o.push(i)):(Uo.fenceToPunct_(t),i.push(t),i=i.concat(n.shift()),n.unshift(i))}return o.push(n.shift()),{rel:r,comp:o}}static rewriteFencedNode_(t){const e=t.contentNodes[0],n=t.contentNodes[1];let r=Uo.rewriteFence_(t,e);return t.contentNodes[0]=r.fence,r=Uo.rewriteFence_(r.node,n),t.contentNodes[1]=r.fence,t.contentNodes[0].parent=t,t.contentNodes[1].parent=t,function(t){const e=An.FencesSecondary.get(t.contentNodes[0].textContent),n=An.FencesSecondary.get(t.contentNodes[1].textContent);e===n&&t.addAnnotation("fences",e)}(t),r.node.parent=null,r.node}static rewriteFence_(t,e){if(!e.embellished)return{node:t,fence:e};const n=e.childNodes[0],r=Uo.rewriteFence_(t,n);return Jr(e,St.SUPERSCRIPT)||Jr(e,St.SUBSCRIPT)||Jr(e,St.TENSOR)?(to(e,It.SUBSUP)||(e.role=t.role),n!==r.node&&(e.replaceChild(n,r.node),n.parent=t),Uo.propagateFencePointer_(e,n),{node:e,fence:r.fence}):(e.replaceChild(n,r.fence),e.mathmlTree&&-1===e.mathml.indexOf(e.mathmlTree)&&e.addMathmlNodes([e.mathmlTree]),{node:r.node,fence:e})}static propagateFencePointer_(t,e){t.fencePointer=e.fencePointer||e.id.toString(),t.embellished=null}static classifyByColumns_(t,e,n,r=[]){const o=[n].concat(r);return!!(3===e.length&&Uo.testColumns_(e,1,t=>Uo.isPureRelation_(t,o))||2===e.length&&(Uo.testColumns_(e,1,t=>Uo.isEndRelation_(t,o)||Uo.isPureRelation_(t,o))||Uo.testColumns_(e,0,t=>Uo.isEndRelation_(t,o,!0)||Uo.isPureRelation_(t,o))))&&(t.role=n,!0)}static isEndRelation_(t,e,n){const r=n?t.childNodes.length-1:0;return Jr(t,St.RELSEQ)&&e.some(e=>to(t,e))&&Jr(t.childNodes[r],St.EMPTY)}static isPureRelation_(t,e){return Jr(t,St.RELATION)&&e.some(e=>to(t,e))}static computeColumns_(t){const e=[];for(let n,r=0;n=t.childNodes[r];r++)for(let t,r=0;t=n.childNodes[r];r++){e[r]?e[r].push(t):e[r]=[t]}return e}static testColumns_(t,e,n){const r=t[e];return!!r&&(r.some(function(t){return t.childNodes.length&&n(t.childNodes[0])})&&r.every(function(t){return!t.childNodes.length||n(t.childNodes[0])}))}setNodeFactory(t){Uo.getInstance().factory_=t,br.updateFactory(Uo.getInstance().factory_)}getNodeFactory(){return Uo.getInstance().factory_}identifierNode(t,e,n){if("MathML-Unit"!==n||(r=t,[It.DEGREE].includes(r.role)||[].includes(r.type))){if(!e&&1===t.textContent.length&&(t.role===It.INTEGER||t.role===It.LATINLETTER||t.role===It.GREEKLETTER)&&t.font===bt.NORMAL)return t.font=bt.ITALIC,br.run("simpleNamedFunction",t)}else t.type=St.IDENTIFIER,t.role=It.UNIT;var r;return t.type===St.UNKNOWN&&(t.type=St.IDENTIFIER),Uo.exprFont_(t),br.run("simpleNamedFunction",t)}implicitNode(t){if(t=Uo.getInstance().getMixedNumbers_(t),t=Uo.getInstance().combineUnits_(t),1===(t=Uo.getInstance().combineScripts_(t)).length)return t[0];const e=Uo.getInstance().implicitNode_(t);return br.run("combine_juxtaposition",e)}text(t,e){if(Uo.exprFont_(t),t.type=St.TEXT,e===Dr.ANNOTATIONXML)return t.role=It.ANNOTATION,t;if(e===Dr.MS)return t.role=It.STRING,t;if(e===Dr.MSPACE||t.textContent.match(/^\s*$/))return t.role=It.SPACE,t;if(/\s/.exec(t.textContent))return t.role=It.TEXT,t;const n=[...t.textContent];if(1!==n.length)return t.role=It.UNKNOWN,t;const r=An.Meaning.get(n[0]);return r.type===St.UNKNOWN||r.type===St.IDENTIFIER||(t.type=r.type,t.role=r.role,t.font=r.font,t.addAnnotation("general","text")),t}row(t){return 0===(t=t.filter(function(t){return!Jr(t,St.EMPTY)||t.hasAnnotation("empty","MFENCED")})).length?Uo.getInstance().factory_.makeEmptyNode():(t=Uo.getInstance().getFencesInRow_(t),t=Uo.getInstance().tablesInRow(t),t=Uo.getInstance().getPunctuationInRow_(t),t=Uo.getInstance().getTextInRow_(t),t=Uo.getInstance().getFunctionsInRow_(t),Uo.getInstance().relationsInRow_(t))}limitNode(t,e){if(!e.length)return Uo.getInstance().factory_.makeEmptyNode();let n=e[0],{length:r}=Uo.MML_TO_LIMIT_[t];if(e=e.slice(0,r+1),[t,e]=Uo.getInstance().cleanLimitNode(t,e,r),!e[1])return n;let{type:o,length:i}=Uo.MML_TO_LIMIT_[t];if(1===i&&e[1].role===It.DEGREE)return Uo.getInstance().row([e[0],e[1]]);if(br.run("op_with_limits",e),Io(n)){if(1===i&&eo(e[1])||2===i&&eo(e[1])&&eo(e[2])){let r=Uo.MML_TO_BOUNDS_[t];return Uo.getInstance().accentNode_(n,e,r.type,r.length,r.accent)}if(2===i){if(eo(e[1]))return n=Uo.getInstance().accentNode_(n,[n,e[1]],{MSUBSUP:St.SUBSCRIPT,MUNDEROVER:St.UNDERSCORE}[t],1,!0),e[2]?Uo.getInstance().makeLimitNode_(n,[n,e[2]],null,St.LIMUPPER):n;if(e[2]&&eo(e[2]))return n=Uo.getInstance().accentNode_(n,[n,e[2]],{MSUBSUP:St.SUPERSCRIPT,MUNDEROVER:St.OVERSCORE}[t],1,!0),Uo.getInstance().makeLimitNode_(n,[n,e[1]],null,St.LIMLOWER);e[i]||(o=St.LIMLOWER)}return Uo.getInstance().makeLimitNode_(n,e,null,o)}const s=Uo.MML_TO_BOUNDS_[t];return Uo.getInstance().accentNode_(n,e,s.type,s.length,s.accent)}cleanLimitNode(t,e,n){const r=t=>(t=>!t||Jr(t,St.EMPTY))(t)||(t=>t&&Jr(t,St.TEXT)&&to(t,It.SPACE))(t);if(1===n)return r(e[1])?(e[0].noupdate=!0,[t,[Bo([t],e[0])]]):[t,e];const o=e[1],i=e[2];return r(o)&&r(i)?(e[0].noupdate=!0,[t,[Bo([t],e[0])]]):r(o)?[t===Dr.MSUBSUP?Dr.MSUP:Dr.MOVER,[e[0],i]]:r(i)?[t===Dr.MSUBSUP?Dr.MSUB:Dr.MUNDER,[e[0],o]]:[t,e]}tablesInRow(t){let e=Yr(t,go),n=[];for(let t,r=0;t=e.rel[r];r++)n=n.concat(e.comp.shift()),n.push(Uo.tableToMatrixOrVector_(t));n=n.concat(e.comp.shift()),e=Yr(n,mo),n=[];for(let t,r=0;t=e.rel[r];r++){const r=e.comp.shift();No(0,r)&&Uo.tableToCases_(t,r.pop()),n=n.concat(r),(n.length||e.comp[0].length)&&(t=Uo.rewriteTrivialTable(t)),n.push(t)}return n.concat(e.comp.shift())}mfenced(t,e,n,r){if(n&&r.length>0){const t=Uo.nextSeparatorFunction_(n),e=[r.shift()];r.forEach(n=>{e.push(Uo.getInstance().factory_.makeContentNode(t())),e.push(n)}),r=e}return t&&e?Uo.getInstance().horizontalFencedNode_(Uo.getInstance().factory_.makeContentNode(t),Uo.getInstance().factory_.makeContentNode(e),r):(t&&r.unshift(Uo.getInstance().factory_.makeContentNode(t)),e&&r.push(Uo.getInstance().factory_.makeContentNode(e)),Uo.getInstance().row(r))}fractionLikeNode(t,e,n,r){let o;if(!r&&function(t){if(!t)return!1;if(["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].includes(t))return!0;const e=t.match(/[0-9.]+/);return!!e&&0===parseFloat(e[0])}(n)){const n=Uo.getInstance().factory_.makeBranchNode(St.LINE,[t],[]),r=Uo.getInstance().factory_.makeBranchNode(St.LINE,[e],[]);return o=Uo.getInstance().factory_.makeBranchNode(St.MULTILINE,[n,r],[]),Uo.classifyMultiline(o)}return o=Uo.getInstance().fractionNode_(t,e),r&&o.addAnnotation("general","bevelled"),o}tensor(t,e,n,r,o){const i=Uo.getInstance().factory_.makeBranchNode(St.TENSOR,[t,Uo.getInstance().scriptNode_(e,It.LEFTSUB),Uo.getInstance().scriptNode_(n,It.LEFTSUPER),Uo.getInstance().scriptNode_(r,It.RIGHTSUB),Uo.getInstance().scriptNode_(o,It.RIGHTSUPER)],[]);return i.role=t.role,i.embellished=ao(t),i}pseudoTensor(t,e,n){const r=t=>!Jr(t,St.EMPTY),o=e.filter(r).length,i=n.filter(r).length;if(!o&&!i)return t;const s=o?i?Dr.MSUBSUP:Dr.MSUB:Dr.MSUP,a=[t];return o&&a.push(Uo.getInstance().scriptNode_(e,It.RIGHTSUB,!0)),i&&a.push(Uo.getInstance().scriptNode_(n,It.RIGHTSUPER,!0)),Uo.getInstance().limitNode(s,a)}font(t){const e=Uo.MATHJAX_FONTS[t];return e||t}proof(t,e,n){if(e.inference||e.axiom||console.log("Noise"),e.axiom){const e=Uo.getInstance().cleanInference(t.childNodes),r=e.length?Uo.getInstance().factory_.makeBranchNode(St.INFERENCE,n(e),[]):Uo.getInstance().factory_.makeEmptyNode();return r.role=It.AXIOM,r.mathmlTree=t,r}const r=Uo.getInstance().inference(t,e,n);return e.proof&&(r.role=It.PROOF,r.childNodes[0].role=It.FINAL),r}inference(t,e,n){if(e.inferenceRule){const e=Uo.getInstance().getFormulas(t,[],n);return Uo.getInstance().factory_.makeBranchNode(St.INFERENCE,[e.conclusion,e.premises],[])}const r=e.labelledRule,o=W(t.childNodes),i=[];"left"!==r&&"both"!==r||i.push(Uo.getInstance().getLabel(t,o,n,It.LEFT)),"right"!==r&&"both"!==r||i.push(Uo.getInstance().getLabel(t,o,n,It.RIGHT));const s=Uo.getInstance().getFormulas(t,o,n),a=Uo.getInstance().factory_.makeBranchNode(St.INFERENCE,[s.conclusion,s.premises],i);return a.mathmlTree=t,a}getLabel(t,e,n,r){const o=Uo.getInstance().findNestedRow(e,"prooflabel",r),i=Uo.getInstance().factory_.makeBranchNode(St.RULELABEL,n(W(o.childNodes)),[]);return i.role=r,i.mathmlTree=o,i}getFormulas(t,e,n){const r=e.length?Uo.getInstance().findNestedRow(e,"inferenceRule"):t,o="up"===Uo.getSemantics(r).inferenceRule,i=o?r.childNodes[1]:r.childNodes[0],s=o?r.childNodes[0]:r.childNodes[1],a=i.childNodes[0].childNodes[0],c=W(a.childNodes[0].childNodes),l=[];let u=1;for(const t of c)u%2&&l.push(t.childNodes[0]),u++;const h=n(l),d=n(W(s.childNodes[0].childNodes))[0],f=Uo.getInstance().factory_.makeBranchNode(St.PREMISES,h,[]);f.mathmlTree=a;const p=Uo.getInstance().factory_.makeBranchNode(St.CONCLUSION,[d],[]);return p.mathmlTree=s.childNodes[0].childNodes[0],{conclusion:p,premises:f}}findNestedRow(t,e,n){return Uo.getInstance().findNestedRow_(t,e,0,n)}cleanInference(t){return W(t).filter(function(t){return"MSPACE"!==lt(t)})}operatorNode(t){return t.type===St.UNKNOWN&&(t.type=St.OPERATOR),br.run("multioperator",t)}static rewriteTrivialTable(t){return Jr(e=t,St.MULTILINE)&&1===e.childNodes.length&&e.childNodes[0].childNodes.length&&!To(e.childNodes[0])?Uo.getInstance().unwrapTrivialTable(t):t;var e}unwrapTrivialTable(t){if(!t.childNodes[0].childNodes.length)return Uo.getInstance().factory_.makeEmptyNode();const e=t.childNodes[0].childNodes[0];return e.parent=null,Bo([Dr.MTD,Dr.MTR,Dr.MTABLE],e),e}constructor(){this.funcAppls={},this.splitRoles=new Map([[It.SUBTRACTION,It.NEGATIVE],[It.ADDITION,It.POSITIVE]]),this.splitOps=["\u2212","-","\u2010","\u2011","+"],this.factory_=new Qr,br.updateFactory(this.factory_)}implicitNode_(t){const e=Uo.getInstance().factory_.makeMultipleContentNodes(t.length-1,Sn.invisibleTimes);Uo.matchSpaces_(t,e);const n=Uo.getInstance().infixNode_(t,e[0]);return n.role=It.IMPLICIT,e.forEach(function(t){t.parent=n}),n.contentNodes=e,n}infixNode_(t,e){let n=Uo.getInstance().factory_.makeBranchNode(St.INFIXOP,t,[e],$r(e).textContent);return n.role=e.role,n=br.run("propagateInterval",n),br.run("propagateSimpleFunction",n)}explicitMixed_(t){const e=Yr(t,function(t){return t.textContent===Sn.invisiblePlus});if(!e.rel.length)return t;let n=[];for(let t,r=0;t=e.rel[r];r++){const o=e.comp[r],i=e.comp[r+1],s=o.length-1;if(o[s]&&i[0]&&Jr(o[s],St.NUMBER)&&!to(o[s],It.MIXED)&&Jr(i[0],St.FRACTION)){const t=Uo.getInstance().factory_.makeBranchNode(St.NUMBER,[o[s],i[0]],[]);t.role=It.MIXED,n=n.concat(o.slice(0,s)),n.push(t),i.shift()}else n=n.concat(o),n.push(t)}return n.concat(e.comp[e.comp.length-1])}concatNode_(t,e,n){if(0===e.length)return t;const r=e.map(function(t){return $r(t).textContent}).join(" "),o=Uo.getInstance().factory_.makeBranchNode(n,[t],e,r);return e.length>1&&(o.role=It.MULTIOP),Wr(o,[t,...e]),o}multiopNode_(t){const e=Uo.getInstance().factory_.makeBranchNode(St.OPERATOR,t,[]);return e.role=It.MULTIOP,Wr(e,t),e}prefixNode_(t,e){const n=this.splitSingles(e);let r=t;for(;n.length>0;){const t=n.pop();r=Uo.getInstance().concatNode_(r,t,St.PREFIXOP),1===t.length&&-1!==this.splitOps.indexOf(t[0].textContent)&&(r.role=this.splitRoles.get(t[0].role))}return r}splitSingles(t){let e=0;const n=[];let r=0;for(;r<t.length;){const o=t[r];!this.splitRoles.has(o.role)||t[r-1]&&t[r-1].role===o.role||t[r+1]&&t[r+1].role===o.role||-1===this.splitOps.indexOf(o.textContent)||(n.push(t.slice(e,r)),n.push(t.slice(r,r+1)),e=r+1),r++}return e<r&&n.push(t.slice(e,r)),n}postfixNode_(t,e){return e.length?Uo.getInstance().concatNode_(t,e,St.POSTFIXOP):t}combineScripts_(t){const e=Yr(t,t=>Jr(t,St.SUPERSCRIPT)&&Jr(t.childNodes[0],St.EMPTY)||Jr(t,St.SUBSCRIPT)&&Jr(t.childNodes[0],St.EMPTY));if(!e.rel.length)return t;let n=[];do{const t=e.comp.shift(),r=e.rel.shift();if(!t.length){n.push(r);continue}const o=t.pop();Jr(o,St.NUMBER)||Jr(o,St.IDENTIFIER)?(r.childNodes[0]=o,o.parent=r,r.role=o.type.toLowerCase(),r.addAnnotation("collapsed",o.type.toLowerCase()),n=n.concat(t),n.push(r)):Jr(o,St.SUBSCRIPT)&&Jr(r,St.SUPERSCRIPT)?(r.childNodes[0]=o,o.parent=r,r.role=o.type.toLowerCase(),r.addAnnotation("collapsed",o.type.toLowerCase()),o.role=It.SUBSUP,n=n.concat(t),n.push(r)):(n=n.concat(t),n.push(o),n.push(r))}while(e.rel.length);return n=n.concat(e.comp.pop()),n}combineUnits_(t){const e=Yr(t,function(t){return!to(t,It.UNIT)});if(t.length===e.rel.length)return e.rel;const n=[];let r,o;do{const t=e.comp.shift();r=e.rel.shift();let i=null;o=n.pop(),o&&(t.length&&Co(o)?t.unshift(o):n.push(o)),1===t.length&&(i=t.pop()),t.length>1&&(i=Uo.getInstance().implicitNode_(t),i.role=It.UNIT),i&&n.push(i),r&&n.push(r)}while(r);return n}getMixedNumbers_(t){const e=Yr(t,function(t){return Jr(t,St.FRACTION)&&to(t,It.VULGAR)});if(!e.rel.length)return t;let n=[];for(let t,r=0;t=e.rel[r];r++){const o=e.comp[r],i=o.length-1;if(o[i]&&Jr(o[i],St.NUMBER)&&(to(o[i],It.INTEGER)||to(o[i],It.FLOAT))){const e=Uo.getInstance().factory_.makeBranchNode(St.NUMBER,[o[i],t],[]);e.role=It.MIXED,n=n.concat(o.slice(0,i)),n.push(e)}else n=n.concat(o),n.push(t)}return n.concat(e.comp[e.comp.length-1])}getTextInRow_(t){if(0===t.length)return t;if(1===t.length)return t[0].type===St.TEXT&&t[0].role===It.UNKNOWN&&(t[0].role=It.ANNOTATION),t;const{rel:e,comp:n}=Yr(t,t=>Jr(t,St.TEXT)&&!t.annotation.factor);if(0===e.length)return t;const r=[];let o=n.shift();for(;e.length>0;){let t=e.shift(),i=n.shift();const s=[];for(;!i.length&&e.length&&t.role!==It.SPACE&&e[0].role!==It.SPACE;)s.push(t),t=e.shift(),i=n.shift();if(s.length&&(s.push(t),t=Uo.getInstance().dummyNode_(s)),t.role!==It.UNKNOWN){const e=ko(o,t,i);if(e){o=e;continue}o.length&&r.push(Uo.getInstance().row(o)),r.push(t),o=i;continue}const a=An.Meaning.get(t.textContent);if(a.type!==St.UNKNOWN){t.type=a.type,t.role=a.role,t.font=a.font,t.addAnnotation("general","text"),o.push(t),o=o.concat(i);continue}if(Uo.meaningFromContent(t,(t,e,n)=>{if(t.role===It.UNKNOWN){if(Uo.numberRole_(t,e,n),t.role===It.OTHERNUMBER)return n.some(t=>t.type!==St.NUMBER&&t.type!==St.IDENTIFIER)?(t.type=St.TEXT,void(t.role=It.ANNOTATION)):void(t.role=It.UNKNOWN);t.type=St.NUMBER}}),t.role===It.UNKNOWN&&(e.length||i.length?i.length&&i[0].type===St.FENCED?(t.type=St.FUNCTION,t.role=It.PREFIXFUNC):t.role=It.TEXT:(t.type=St.IDENTIFIER,t.role=It.UNIT)),t.type!==St.TEXT){o.push(t),o=o.concat(i);continue}const c=ko(o,t,i);c?o=c:(o.length&&r.push(Uo.getInstance().row(o)),r.push(t),o=i)}return o.length>0&&r.push(Uo.getInstance().row(o)),r.length>1?[Uo.getInstance().dummyNode_(r)]:r}relationsInRow_(t){const e=Yr(t,lo),n=e.rel[0];if(!n)return Uo.getInstance().operationsInRow_(t);if(1===t.length)return t[0];const r=e.comp.map(Uo.getInstance().operationsInRow_);let o;return e.rel.some(function(t){return!t.equals(n)})?(o=Uo.getInstance().factory_.makeBranchNode(St.MULTIREL,r,e.rel),e.rel.every(function(t){return t.role===n.role})&&(o.role=n.role),o):(o=Uo.getInstance().factory_.makeBranchNode(St.RELSEQ,r,e.rel,$r(n).textContent),o.role=n.role,o)}operationsInRow_(t){if(0===t.length)return Uo.getInstance().factory_.makeEmptyNode();if(1===(t=Uo.getInstance().explicitMixed_(t)).length)return t[0];const e=[];for(;t.length>0&&co(t[0]);)e.push(t.shift());if(0===t.length)return Uo.getInstance().multiopNode_(e);if(1===t.length)return Uo.getInstance().prefixNode_(t[0],e);const n=Xr(t=br.run("convert_juxtaposition",t),co),r=Uo.getInstance().wrapFactor(e,n);return Uo.getInstance().addFactor(r,n)}wrapPostfix(t){var e;(null===(e=t.div)||void 0===e?void 0:e.role)===It.POSTFIXOP&&(t.tail.length&&t.tail[0].type!==St.OPERATOR?t.div.role=It.DIVISION:(t.head=[Uo.getInstance().postfixNode_(Uo.getInstance().implicitNode(t.head),[t.div])],t.div=t.tail.shift(),Uo.getInstance().wrapPostfix(t)))}wrapFactor(t,e){return Uo.getInstance().wrapPostfix(e),Uo.getInstance().prefixNode_(Uo.getInstance().implicitNode(e.head),t)}addFactor(t,e){return e.div?Uo.getInstance().operationsTree_(e.tail,t,e.div):(Mo(t)&&(t.role=It.UNIT),t)}operationsTree_(t,e,n,r=[]){if(0===t.length){if(r.unshift(n),e.type===St.INFIXOP){const t=Uo.getInstance().postfixNode_(e.childNodes.pop(),r);return e.appendChild(t),e}return Uo.getInstance().postfixNode_(e,r)}const o=Xr(t,co);if(0===o.head.length)return r.push(o.div),Uo.getInstance().operationsTree_(o.tail,e,n,r);const i=Uo.getInstance().wrapFactor(r,o),s=Uo.getInstance().appendOperand_(e,n,i);return Uo.getInstance().addFactor(s,o)}appendOperand_(t,e,n){if(t.type!==St.INFIXOP)return Uo.getInstance().infixNode_([t,n],e);const r=Uo.getInstance().appendDivisionOp_(t,e,n);return r||(Uo.getInstance().appendExistingOperator_(t,e,n)?t:e.role===It.MULTIPLICATION?Uo.getInstance().appendMultiplicativeOp_(t,e,n):Uo.getInstance().appendAdditiveOp_(t,e,n))}appendDivisionOp_(t,e,n){return e.role===It.DIVISION?vo(t)?Uo.getInstance().infixNode_([t,n],e):Uo.getInstance().appendLastOperand_(t,e,n):t.role===It.DIVISION?Uo.getInstance().infixNode_([t,n],e):null}appendLastOperand_(t,e,n){let r=t,o=t.childNodes[t.childNodes.length-1];for(;o&&o.type===St.INFIXOP&&!vo(o);)r=o,o=r.childNodes[t.childNodes.length-1];const i=Uo.getInstance().infixNode_([r.childNodes.pop(),n],e);return r.appendChild(i),t}appendMultiplicativeOp_(t,e,n){if(vo(t))return Uo.getInstance().infixNode_([t,n],e);let r=t,o=t.childNodes[t.childNodes.length-1];for(;o&&o.type===St.INFIXOP&&!vo(o);)r=o,o=r.childNodes[t.childNodes.length-1];const i=Uo.getInstance().infixNode_([r.childNodes.pop(),n],e);return r.appendChild(i),t}appendAdditiveOp_(t,e,n){return Uo.getInstance().infixNode_([t,n],e)}appendExistingOperator_(t,e,n){return!(!t||t.type!==St.INFIXOP||vo(t))&&(t.contentNodes[0].equals(e)?(t.appendContentNode(e),t.appendChild(n),!0):Uo.getInstance().appendExistingOperator_(t.childNodes[t.childNodes.length-1],e,n))}getFencesInRow_(t){let e=Yr(t,ho);e=Uo.purgeFences_(e);const n=e.comp.shift();return Uo.getInstance().fences_(e.rel,e.comp,[],[n])}fences_(t,e,n,r){if(0===t.length&&0===n.length)return r[0];const o=br.run("bracketed_interval",[t[0],t[1],...e[0]||[]],()=>null);if(o){t.shift(),t.shift(),e.shift();const i=r.pop()||[];return r.push([...i,o,...e.shift()]),Uo.getInstance().fences_(t,e,n,r)}const i=t=>to(t,It.OPEN);if(0===t.length){const t=r.shift();for(;n.length>0;){if(i(n[0])){const e=n.shift();Uo.fenceToPunct_(e),t.push(e)}else{const e=Xr(n,i),o=e.head.length-1,s=Uo.getInstance().neutralFences_(e.head,r.slice(0,o));r=r.slice(o),t.push(...s),e.div&&e.tail.unshift(e.div),n=e.tail}t.push(...r.shift())}return t}const s=n[n.length-1],a=t[0].role;if(a===It.OPEN||Do(t[0])&&(!s||!Po(t[0],s))){n.push(t.shift());const o=e.shift();return o&&r.push(o),Uo.getInstance().fences_(t,e,n,r)}if(s&&a===It.CLOSE&&s.role===It.OPEN){const o=Uo.getInstance().horizontalFencedNode_(n.pop(),t.shift(),r.pop());return r.push(r.pop().concat([o],e.shift())),Uo.getInstance().fences_(t,e,n,r)}if(s&&Po(t[0],s)){if(!_o(s)||!xo(t[0])){n.push(t.shift());const o=e.shift();return o&&r.push(o),Uo.getInstance().fences_(t,e,n,r)}const o=Uo.getInstance().horizontalFencedNode_(n.pop(),t.shift(),r.pop());return r.push(r.pop().concat([o],e.shift())),Uo.getInstance().fences_(t,e,n,r)}if(s&&a===It.CLOSE&&Do(s)&&n.some(i)){const o=Xr(n,i,!0),s=r.pop(),a=r.length-o.tail.length+1,c=Uo.getInstance().neutralFences_(o.tail,r.slice(a));r=r.slice(0,a);const l=Uo.getInstance().horizontalFencedNode_(o.div,t.shift(),r.pop().concat(c,s));return r.push(r.pop().concat([l],e.shift())),Uo.getInstance().fences_(t,e,o.head,r)}const c=t.shift();return Uo.fenceToPunct_(c),r.push(r.pop().concat([c],e.shift())),Uo.getInstance().fences_(t,e,n,r)}neutralFences_(t,e){if(0===t.length)return t;if(1===t.length)return Uo.fenceToPunct_(t[0]),t;const n=t.shift();if(!_o(n)){Uo.fenceToPunct_(n);const r=e.shift();return r.unshift(n),r.concat(Uo.getInstance().neutralFences_(t,e))}const r=Xr(t,function(t){return Po(t,n)});if(!r.div){Uo.fenceToPunct_(n);const r=e.shift();return r.unshift(n),r.concat(Uo.getInstance().neutralFences_(t,e))}if(!xo(r.div))return Uo.fenceToPunct_(r.div),t.unshift(n),Uo.getInstance().neutralFences_(t,e);const o=Uo.getInstance().combineFencedContent_(n,r.div,r.head,e);if(r.tail.length>0){const t=o.shift(),e=Uo.getInstance().neutralFences_(r.tail,o);return t.concat(e)}return o[0]}combineFencedContent_(t,e,n,r){if(0===n.length){const n=Uo.getInstance().horizontalFencedNode_(t,e,r.shift());return r.length>0?r[0].unshift(n):r=[[n]],r}const o=r.shift(),i=n.length-1,s=r.slice(0,i),a=(r=r.slice(i)).shift(),c=Uo.getInstance().neutralFences_(n,s);o.push(...c),o.push(...a);const l=Uo.getInstance().horizontalFencedNode_(t,e,o);return r.length>0?r[0].unshift(l):r=[[l]],r}horizontalFencedNode_(t,e,n){const r=Uo.getInstance().row(n);Jr(r,St.EMPTY)&&!r.mathmlTree&&t.mathmlTree&&t.mathmlTree.nextSibling!==e.mathmlTree&&(r.mathmlTree=t.mathmlTree.nextSibling,r.addMathmlNodes([t.mathmlTree.nextSibling]));let o=Uo.getInstance().factory_.makeBranchNode(St.FENCED,[r],[t,e]);return t.role===It.OPEN?(Uo.getInstance().classifyHorizontalFence_(o),o=br.run("propagateComposedFunction",o)):o.role=t.role,o=br.run("detect_cycle",o),Uo.rewriteFencedNode_(o)}classifyHorizontalFence_(t){if(br.run("interval_heuristic",t),t.role===It.INTERVAL)return;t.role=It.LEFTRIGHT;const e=t.childNodes;if(!function(t){return function(t){return!!t&&-1!==["{","\ufe5b","\uff5b"].indexOf(t.textContent)}(t.contentNodes[0])&&function(t){return!!t&&-1!==["}","\ufe5c","\uff5d"].indexOf(t.textContent)}(t.contentNodes[1])}(t)||e.length>1)return;if(0===e.length||e[0].type===St.EMPTY)return void(t.role=It.SETEMPTY);const n=e[0].type;if(1===e.length&&yo(e[0]))return void(t.role=It.SETSINGLE);const r=e[0].role;if(n===St.PUNCTUATED&&r===It.SEQUENCE){if(e[0].contentNodes[0].role!==It.COMMA)return 1!==e[0].contentNodes.length||e[0].contentNodes[0].role!==It.VBAR&&e[0].contentNodes[0].role!==It.COLON?void 0:(t.role=It.SETEXT,void Uo.getInstance().setExtension_(t));t.role=It.SETCOLLECT}}setExtension_(t){const e=t.childNodes[0].childNodes[0];e&&e.type===St.INFIXOP&&1===e.contentNodes.length&&Fo(e.contentNodes[0])&&(e.addAnnotation("set","intensional"),e.contentNodes[0].addAnnotation("set","intensional"))}getPunctuationInRow_(t){if(t.length<=1)return t;const e=t=>{const e=t.type;return"punctuation"===e||"text"===e||"operator"===e||"relation"===e},n=Yr(t,function(n){if(!uo(n))return!1;if(uo(n)&&!to(n,It.ELLIPSIS))return!0;const r=t.indexOf(n);if(0===r)return!t[1]||!e(t[1]);const o=t[r-1];if(r===t.length-1)return!e(o);const i=t[r+1];return!e(o)||!e(i)});if(0===n.rel.length)return t;let r=[],o=n.comp.shift();o.length>0&&r.push(Uo.getInstance().row(o));let i=0;for(;n.comp.length>0;){let t=[];const e=i;do{t.push(n.rel[i++]),o=n.comp.shift()}while(n.rel[i]&&o&&0===o.length);t=br.run("ellipses",t),n.rel.splice(e,i-e,...t),i=e+t.length,r=r.concat(t),o&&o.length>0&&r.push(Uo.getInstance().row(o))}return 1===r.length&&1===n.rel.length?r:[Uo.getInstance().punctuatedNode_(r,n.rel)]}punctuatedNode_(t,e){const n=Uo.getInstance().factory_.makeBranchNode(St.PUNCTUATED,t,e);if(e.length===t.length){const t=e[0].role;if(t!==It.UNKNOWN&&e.every(function(e){return e.role===t}))return n.role=t,n}const r=e[0];return Ao(t,e,0)?n.role=r.childNodes.length&&!r.embellished?r.role:It.STARTPUNCT:Ao(t,e,t.length-1)?n.role=r.childNodes.length&&!r.embellished?r.role:It.ENDPUNCT:e.every(t=>to(t,It.DUMMY))?n.role=It.TEXT:e.every(t=>to(t,It.SPACE))?n.role=It.SPACE:n.role=It.SEQUENCE,n}dummyNode_(t){const e=Uo.getInstance().factory_.makeMultipleContentNodes(t.length-1,Sn.invisibleComma);return e.forEach(function(t){t.role=It.DUMMY}),Uo.getInstance().punctuatedNode_(t,e)}accentRole_(t,e){if(!eo(t))return!1;const n=t.textContent,r=An.Secondary.get(n,Ot.BAR)||An.Secondary.get(n,Ot.TILDE)||t.role;return t.role=e===St.UNDERSCORE?It.UNDERACCENT:It.OVERACCENT,t.addAnnotation("accent",r),!0}accentNode_(t,e,n,r,o){const i=(e=e.slice(0,r+1))[1],s=e[2];let a;if(!o&&s&&(a=Uo.getInstance().factory_.makeBranchNode(St.SUBSCRIPT,[t,i],[]),a.role=It.SUBSUP,e=[a,s],n=St.SUPERSCRIPT),o){const r=Uo.getInstance().accentRole_(i,n);if(s){Uo.getInstance().accentRole_(s,St.OVERSCORE)&&!r?(a=Uo.getInstance().factory_.makeBranchNode(St.OVERSCORE,[t,s],[]),e=[a,i],n=St.UNDERSCORE):(a=Uo.getInstance().factory_.makeBranchNode(St.UNDERSCORE,[t,i],[]),e=[a,s],n=St.OVERSCORE),a.role=It.UNDEROVER}}return Uo.getInstance().makeLimitNode_(t,e,a,n)}makeLimitNode_(t,e,n,r){if(r===St.LIMUPPER&&t.type===St.LIMLOWER)return t.childNodes.push(e[1]),e[1].parent=t,t.type=St.LIMBOTH,t;if(r===St.LIMLOWER&&t.type===St.LIMUPPER)return t.childNodes.splice(1,-1,e[1]),e[1].parent=t,t.type=St.LIMBOTH,t;const o=Uo.getInstance().factory_.makeBranchNode(r,e,[]),i=ao(t);return n&&(n.embellished=i),o.embellished=i,o.role=t.role,o}getFunctionsInRow_(t,e){const n=e||[];if(0===t.length)return n;const r=t.shift(),o=Uo.classifyFunction_(r,t);if(!o)return n.push(r),Uo.getInstance().getFunctionsInRow_(t,n);const i=Uo.getInstance().getFunctionsInRow_(t,[]),s=Uo.getInstance().getFunctionArgs_(r,i,o);return n.concat(s)}getFunctionArgs_(t,e,n){let r,o,i;switch(n){case"integral":{const n=Uo.getInstance().getIntegralArgs_(e);if(!n.intvar&&!n.integrand.length)return n.rest.unshift(t),n.rest;const r=Uo.getInstance().row(n.integrand);return i=Uo.getInstance().integralNode_(t,r,n.intvar),br.run("intvar_from_fraction",i),n.rest.unshift(i),n.rest}case"prefix":if(e[0]&&e[0].type===St.FENCED){const n=e.shift();return Do(n)||(n.role=It.LEFTRIGHT),i=Uo.getInstance().functionNode_(t,n),e.unshift(i),e}if(r=Xr(e,no),r.head.length)o=Uo.getInstance().row(r.head),r.div&&r.tail.unshift(r.div);else{if(!r.div||!Jr(r.div,St.APPL))return e.unshift(t),e;o=r.div}return i=Uo.getInstance().functionNode_(t,o),r.tail.unshift(i),r.tail;case"bigop":return r=Xr(e,ro),r.head.length?(o=Uo.getInstance().row(r.head),i=Uo.getInstance().bigOpNode_(t,o),r.div&&r.tail.unshift(r.div),r.tail.unshift(i),r.tail):(e.unshift(t),e);default:{if(0===e.length)return[t];const n=e[0];return n.type===St.FENCED&&!Do(n)&&function(t){const e=t.childNodes;if(0===e.length)return!0;if(e.length>1)return!1;const n=e[0];if(n.type===St.INFIXOP){if(n.role!==It.IMPLICIT)return!1;if(n.childNodes.some(t=>Jr(t,St.INFIXOP)))return!1}return!0}(n)?(n.role=It.LEFTRIGHT,Uo.propagateFunctionRole_(t,It.SIMPLEFUNC),i=Uo.getInstance().functionNode_(t,e.shift()),e.unshift(i),e):(e.unshift(t),e)}}}getIntegralArgs_(t,e=[]){if(0===t.length){const t=Xr(e,ro);return t.div&&t.tail.unshift(t.div),{integrand:t.head,intvar:null,rest:t.tail}}br.run("intvar_from_implicit",t);const n=t[0];if(so(n)){const{integrand:n,rest:r}=Uo.getInstance().getIntegralArgs_(e);return{integrand:n,intvar:null,rest:r.concat(t)}}if(io(n))return n.role=It.INTEGRAL,{integrand:e,intvar:n,rest:t.slice(1)};if(t[1]&&oo(n,t[1])){const r=Uo.getInstance().prefixNode_(t[1],[n]);return r.role=It.INTEGRAL,{integrand:e,intvar:r,rest:t.slice(2)}}return e.push(t.shift()),Uo.getInstance().getIntegralArgs_(t,e)}functionNode_(t,e){const n=Uo.getInstance().factory_.makeContentNode(Sn.functionApplication),r=Uo.getInstance().funcAppls[t.id];r&&(n.mathmlTree=r.mathmlTree,n.addMathmlNodes(r.mathml),n.annotation=r.annotation,n.attributes=r.attributes,delete Uo.getInstance().funcAppls[t.id]),n.type=St.PUNCTUATION,n.role=It.APPLICATION;const o=Uo.getFunctionOp_(t,function(t){return Jr(t,St.FUNCTION)||Jr(t,St.IDENTIFIER)&&to(t,It.SIMPLEFUNC)});return Uo.getInstance().functionalNode_(St.APPL,[t,e],o,[n])}bigOpNode_(t,e){const n=Uo.getFunctionOp_(t,t=>Jr(t,St.LARGEOP));return Uo.getInstance().functionalNode_(St.BIGOP,[t,e],n,[])}integralNode_(t,e,n){e=e||Uo.getInstance().factory_.makeEmptyNode(),n=n||Uo.getInstance().factory_.makeEmptyNode();const r=Uo.getFunctionOp_(t,t=>Jr(t,St.LARGEOP));return Uo.getInstance().functionalNode_(St.INTEGRAL,[t,e,n],r,[])}functionalNode_(t,e,n,r){const o=e[0];let i;n&&(i=n.parent,r.push(n));const s=Uo.getInstance().factory_.makeBranchNode(t,e,r);return s.role=o.role,i&&(n.parent=i),s}fractionNode_(t,e){const n=Uo.getInstance().factory_.makeBranchNode(St.FRACTION,[t,e],[]);return n.role=n.childNodes.every(function(t){return Jr(t,St.NUMBER)&&to(t,It.INTEGER)})?It.VULGAR:n.childNodes.every(Lo)?It.UNIT:It.DIVISION,br.run("propagateSimpleFunction",n)}scriptNode_(t,e,n){let r;switch(t.length){case 0:r=Uo.getInstance().factory_.makeEmptyNode();break;case 1:if(r=t[0],n)return r;break;default:r=Uo.getInstance().dummyNode_(t),r.addAnnotation("general","script")}return r.role=e,r}findNestedRow_(t,e,n,r){if(n>3)return null;for(let o,i=0;o=t[i];i++){const t=lt(o);if(t!==Dr.MSPACE){if(t===Dr.MROW)return Uo.getInstance().findNestedRow_(W(o.childNodes),e,n+1,r);if(Uo.findSemantics(o,e,r))return o}}return null}}function ko(t,e,n){const r=t[t.length-1];if(r&&(r.type===St.RELATION||r.type===St.OPERATOR))return e.addAnnotation("factor",r.type),[...t,e,...n];const o=n[0];return!o||o.type!==St.RELATION&&o.type!==St.OPERATOR?null:(e.addAnnotation("factor",o.type),[...t,e,...n])}function Bo(t,e){return t.forEach(t=>e.addAnnotation("empty",t)),e}Uo.FENCE_TO_PUNCT_={[It.METRIC]:It.METRIC,[It.NEUTRAL]:It.VBAR,[It.OPEN]:It.OPENFENCE,[It.CLOSE]:It.CLOSEFENCE},Uo.MML_TO_LIMIT_={[Dr.MSUB]:{type:St.LIMLOWER,length:1},[Dr.MUNDER]:{type:St.LIMLOWER,length:1},[Dr.MSUP]:{type:St.LIMUPPER,length:1},[Dr.MOVER]:{type:St.LIMUPPER,length:1},[Dr.MSUBSUP]:{type:St.LIMBOTH,length:2},[Dr.MUNDEROVER]:{type:St.LIMBOTH,length:2}},Uo.MML_TO_BOUNDS_={[Dr.MSUB]:{type:St.SUBSCRIPT,length:1,accent:!1},[Dr.MSUP]:{type:St.SUPERSCRIPT,length:1,accent:!1},[Dr.MSUBSUP]:{type:St.SUBSCRIPT,length:2,accent:!1},[Dr.MUNDER]:{type:St.UNDERSCORE,length:1,accent:!0},[Dr.MOVER]:{type:St.OVERSCORE,length:1,accent:!0},[Dr.MUNDEROVER]:{type:St.UNDERSCORE,length:2,accent:!0}},Uo.CLASSIFY_FUNCTION_={[It.INTEGRAL]:"integral",[It.SUM]:"bigop",[It.PREFIXFUNC]:"prefix",[It.LIMFUNC]:"prefix",[It.SIMPLEFUNC]:"prefix",[It.COMPFUNC]:"prefix"},Uo.MATHJAX_FONTS={"-tex-caligraphic":bt.CALIGRAPHIC,"-tex-caligraphic-bold":bt.CALIGRAPHICBOLD,"-tex-calligraphic":bt.CALIGRAPHIC,"-tex-calligraphic-bold":bt.CALIGRAPHICBOLD,"-tex-oldstyle":bt.OLDSTYLE,"-tex-oldstyle-bold":bt.OLDSTYLEBOLD,"-tex-mathit":bt.ITALIC};let Go={};function Vo(t){return Array.from(t.textContent).map(Qn.stringEmpty)}function Ho(t,e){const n=Array.from(t.textContent),r=[],o=Uo.getInstance(),i=t.ownerDocument;for(let t,s=0;t=n[s];s++){const n=o.getNodeFactory().makeLeafNode(t,bt.UNKNOWN),s=o.identifierNode(n,bt.UNKNOWN,"");e(s),r.push(s.xml(i))}return r}function jo(t){return Ho(t,function(t){t.textContent.match(/\W/)||(t.type=St.NUMBER)})}function qo(t){return Ho(t,function(t){t.font=bt.UNKNOWN,t.type=St.IDENTIFIER})}const $o=[St.CASES,St.CELL,St.INTEGRAL,St.LINE,St.MATRIX,St.MULTILINE,St.OVERSCORE,St.ROOT,St.ROW,St.SQRT,St.SUBSCRIPT,St.SUPERSCRIPT,St.TABLE,St.UNDERSCORE,St.VECTOR];function Xo(t){return Go={},[t]}function Yo(t,e,n,r,o,i){r=r||$o,o=o||{},i=i||function(t){return!1};const s=ht(e);if(Go[t]||(Go[t]={}),Go[t][s])return Go[t][s];if(i(e)||n.indexOf(e.tagName)<0)return 0;const a=Wo(e,n,Ar(r,n),o,i,0);return Go[t][s]=a,a}function Wo(t,e,n,r,o,i){if(o(t)||n.indexOf(t.tagName)>-1||function(t,e){if(!t.attributes)return!1;const n=W(t.attributes);for(let t,r=0;t=n[r];r++)if(e[t.nodeName]===t.nodeValue)return!0;return!1}(t,r))return i;if(e.indexOf(t.tagName)>-1&&i++,!t.childNodes||0===t.childNodes.length)return i;const s=W(t.childNodes);return Math.max.apply(null,s.map(function(t){return Wo(t,e,n,r,o,i)}))}function Ko(t){return Yo("fraction",t,["fraction"],$o,{},Pt.FUNCTIONS.fracNestDepth)}function zo(t,e,n){const r=Ko(t),o=Array(r).fill(e);return n&&o.push(n),o.join(Pt.MESSAGES.regexp.JOINER_FRAC)}function Qo(t){return Qn.singleton(zo(t,Pt.MESSAGES.MS.START,Pt.MESSAGES.MS.FRAC_V))}function Jo(t){return Qn.singleton(zo(t,Pt.MESSAGES.MS.END,Pt.MESSAGES.MS.FRAC_V),{kind:"LAST"})}function Zo(t){return Qn.singleton(zo(t,Pt.MESSAGES.MS.FRAC_OVER),{})}function ti(t){return Qn.singleton(zo(t,Pt.MESSAGES.MS.START,Pt.MESSAGES.MS.FRAC_B))}function ei(t){return Qn.singleton(zo(t,Pt.MESSAGES.MS.END,Pt.MESSAGES.MS.FRAC_B),{kind:"LAST"})}function ni(t){const e=Ko(t);return Qn.singleton(1===e?Pt.MESSAGES.MS.FRAC_S:Pt.FUNCTIONS.combineNestedFraction(Pt.MESSAGES.MS.NEST_FRAC,Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.FRAC_S))}function ri(t){const e=Ko(t);return Qn.singleton(1===e?Pt.MESSAGES.MS.ENDFRAC:Pt.FUNCTIONS.combineNestedFraction(Pt.MESSAGES.MS.NEST_FRAC,Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.ENDFRAC),{kind:"LAST"})}function oi(t){const e=Ko(t);return Qn.singleton(1===e?Pt.MESSAGES.MS.FRAC_OVER:Pt.FUNCTIONS.combineNestedFraction(Pt.MESSAGES.MS.NEST_FRAC,Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.FRAC_OVER))}function ii(t){return Pt.FUNCTIONS.fracNestDepth(t)?[t]:[]}function si(t,e,n){for(;t.parentNode;){const r=t.parentNode,o=r.parentNode;if(!o)break;const i=t.getAttribute&&t.getAttribute("role");(o.tagName===St.SUBSCRIPT&&t===r.childNodes[1]||o.tagName===St.TENSOR&&i&&(i===It.LEFTSUB||i===It.RIGHTSUB))&&(e=n.sub+Pt.MESSAGES.regexp.JOINER_SUBSUPER+e),(o.tagName===St.SUPERSCRIPT&&t===r.childNodes[1]||o.tagName===St.TENSOR&&i&&(i===It.LEFTSUPER||i===It.RIGHTSUPER))&&(e=n.sup+Pt.MESSAGES.regexp.JOINER_SUBSUPER+e),t=o}return e.trim()}function ai(t){return Qn.singleton(si(t,Pt.MESSAGES.MS.SUBSCRIPT,{sup:Pt.MESSAGES.MS.SUPER,sub:Pt.MESSAGES.MS.SUB}))}function ci(t){return Qn.singleton(si(t,Pt.MESSAGES.MS.SUB,{sup:Pt.MESSAGES.MS.SUP,sub:Pt.MESSAGES.MS.SUB}))}function li(t){return Qn.singleton(si(t,Pt.MESSAGES.MS.SUPERSCRIPT,{sup:Pt.MESSAGES.MS.SUPER,sub:Pt.MESSAGES.MS.SUB}))}function ui(t){return Qn.singleton(si(t,Pt.MESSAGES.MS.SUP,{sup:Pt.MESSAGES.MS.SUP,sub:Pt.MESSAGES.MS.SUB}))}function hi(t){const e=si(t,"",{sup:Pt.MESSAGES.MS.SUPER,sub:Pt.MESSAGES.MS.SUB});return Qn.singleton(e?e.replace(new RegExp(Pt.MESSAGES.MS.SUB+"$"),Pt.MESSAGES.MS.SUBSCRIPT).replace(new RegExp(Pt.MESSAGES.MS.SUPER+"$"),Pt.MESSAGES.MS.SUPERSCRIPT):Pt.MESSAGES.MS.BASELINE)}function di(t){const e=si(t,"",{sup:Pt.MESSAGES.MS.SUP,sub:Pt.MESSAGES.MS.SUB});return Qn.singleton(e||Pt.MESSAGES.MS.BASE)}function fi(t){return Yo("radical",t,["sqrt","root"],$o,{})}function pi(t,e,n){const r=fi(t),o=function(t){const e="sqrt"===t.tagName?"2":X("children/*[1]",t)[0].textContent.trim();return Pt.MESSAGES.MSroots[e]||""}(t);return n=o?Pt.FUNCTIONS.combineRootIndex(n,o):n,1===r?n:Pt.FUNCTIONS.combineNestedRadical(e,Pt.FUNCTIONS.radicalNestDepth(r-1),n)}function mi(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NESTED,Pt.MESSAGES.MS.STARTROOT))}function gi(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NESTED,Pt.MESSAGES.MS.ENDROOT))}function Ei(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NESTED,Pt.MESSAGES.MS.ROOTINDEX))}function Ni(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.STARTROOT))}function Si(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.ENDROOT))}function Ti(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.ROOTINDEX))}function Ii(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.ROOT))}function Ai(t){return Qn.singleton(pi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.INDEX))}function bi(t){const e=function(t){return Yo("underscore",t,["underscore"],$o,{},function(t){return t.tagName&&t.tagName===St.UNDERSCORE&&t.childNodes[0].childNodes[1].getAttribute("role")===It.UNDERACCENT})}(t);return Qn.singleton(Array(e).join(Pt.MESSAGES.MS.UNDER)+Pt.MESSAGES.MS.UNDERSCRIPT)}function Ri(t){return Qn.singleton(Pt.MESSAGES.MS.ENDSCRIPTS)}function Oi(t){const e=function(t){return Yo("overscore",t,["overscore"],$o,{},function(t){return t.tagName&&t.tagName===St.OVERSCORE&&t.childNodes[0].childNodes[1].getAttribute("role")===It.OVERACCENT})}(t);return Qn.singleton(Array(e).join(Pt.MESSAGES.MS.OVER)+Pt.MESSAGES.MS.OVERSCRIPT)}function yi(t){if(t.tagName!==St.MATRIX||t.getAttribute("role")!==It.DETERMINANT)return[];const e=X("children/row/children/cell/children/*",t);for(let t,n=0;t=e[n];n++)if(t.tagName!==St.NUMBER){if(t.tagName===St.IDENTIFIER){const e=t.getAttribute("role");if(e===It.LATINLETTER||e===It.GREEKLETTER||e===It.OTHERLETTER)continue}return[]}return[t]}function Ci(){const t=t=>t.map(t=>"ancestor::"+t),e=t=>"not("+t+")",n=e(t(["subscript","superscript","tensor"]).join(" or ")),r=t(["relseq","multrel"]),o=t(["fraction","punctuation","fenced","sqrt","root"]);let i=[];for(let t,e=0;t=o[e];e++)i=i.concat(r.map(function(e){return t+"/"+e}));return[["ancestor::*/following-sibling::*",n,e(i.join(" | "))].join(" and ")]}function Li(t){if(!t.childNodes.length||!t.childNodes[0].childNodes.length||!t.childNodes[0].childNodes[0].childNodes.length)return Qn.singleton("");const e=t.childNodes[0].childNodes[0].childNodes[0].textContent;return Qn.singleton(e.match(/^\(.+\)$/)?e.slice(1,-1):e)}const Mi=new Map([[3,"CSFleftsuperscript"],[4,"CSFleftsubscript"],[2,"CSFbaseline"],[1,"CSFrightsubscript"],[0,"CSFrightsuperscript"]]),vi=new Map([[4,2],[3,3],[2,1],[1,4],[0,5]]);function wi(t){const e=[];let n="",r="",o=parseInt(t,2);for(let t=0;t<5;t++){const i="children/*["+vi.get(t)+"]";if(1&o){const e=Mi.get(t%5);n="[t] "+e+"Verbose; [n] "+i+";"+n,r="[t] "+e+"Brief; [n] "+i+";"+r}else e.unshift("name("+i+')="empty"');o>>=1}return[e,n,r]}function Di(t,e=!0){const n=["11111","11110","11101","11100","10111","10110","10101","10100","01111","01110","01101","01100"];for(const r of n){let n="tensor"+r,[o,i,s]=wi(r);if(t.defineRule(n,"default",i,"self::tensor",...o),e&&(t.defineRule(n,"brief",s,"self::tensor",...o),t.defineRule(n,"sbrief",s,"self::tensor",...o)),!(3&parseInt(r,2)))continue;const a=Mi.get(2);i+="; [t]"+a+"Verbose",s+="; [t]"+a+"Brief",n+="-baseline";const c="((.//*[not(*)])[last()]/@id)!=(((.//ancestor::fraction|ancestor::root|ancestor::sqrt|ancestor::cell|ancestor::line|ancestor::stree)[1]//*[not(*)])[last()]/@id)";t.defineRule(n,"default",i,"self::tensor",c,...o),e&&(t.defineRule(n,"brief",s,"self::tensor",c,...o),t.defineRule(n,"sbrief",s,"self::tensor",c,...o))}}function Pi(t){let e=Object.keys(Pt.MESSAGES.MSroots).length;if(!e)return[];if(e++,!t.childNodes||0===t.childNodes.length||!t.childNodes[0].childNodes)return[];const n=t.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(n))return[];const r=parseInt(n,10);return r>1&&r<=e?[t]:[]}function _i(t,e){let n=0;return function(){return Pt.NUMBERS.numericOrdinal(++n)+" "+e}}function xi(t,e){let n=0;return function(){return Pt.NUMBERS.numberToOrdinal(++n,!1)+" "+e}}function Fi(t){const e=vt(t,Pt.MESSAGES.MS.FRAC_OVER);return e.convertible&&e.enumerator&&e.denominator?[Qn.node(Pt.NUMBERS.numberToWords(e.enumerator),t.childNodes[0].childNodes[0],{separator:""}),Qn.stringAttr(Pt.NUMBERS.vulgarSep,{separator:""}),Qn.node(Pt.NUMBERS.numberToOrdinal(e.denominator,1!==e.enumerator),t.childNodes[0].childNodes[1])]:[Qn.node(e.content||"",t)]}function Ui(t){const e=W(t.parentNode.childNodes);return Qn.singleton(Pt.NUMBERS.numericOrdinal(e.indexOf(t)+1).toString())}function ki(t){const e=hi(t);return e[0].speech=e[0].speech.replace(/-$/,""),e}function Bi(t){const e=di(t);return e[0].speech=e[0].speech.replace(/-$/,""),e}function Gi(t){const e=li(t);return e[0].speech=e[0].speech.replace(/^exposant/,"exposant gauche"),e}function Vi(t){const e=ai(t);return e[0].speech=e[0].speech.replace(/^indice/,"indice gauche"),e}function Hi(t){const e=ui(t);return e[0].speech=e[0].speech.replace(/^sup/,"sup gauche"),e}function ji(t){const e=ci(t);return e[0].speech=e[0].speech.replace(/^sub/,"sub gauche"),e}function qi(t,e,n){const r=Ko(t),o=[...Array(r)].map(t=>e);return n&&o.unshift(n),o.join(Pt.MESSAGES.regexp.JOINER_FRAC)}function $i(t){return Qn.singleton(qi(t,Pt.MESSAGES.MS.START,Pt.MESSAGES.MS.FRAC_V))}function Xi(t){return Qn.singleton(qi(t,Pt.MESSAGES.MS.END,Pt.MESSAGES.MS.FRAC_V))}function Yi(t){return Qn.singleton(qi(t,Pt.MESSAGES.MS.START,Pt.MESSAGES.MS.FRAC_B))}function Wi(t){return Qn.singleton(qi(t,Pt.MESSAGES.MS.END,Pt.MESSAGES.MS.FRAC_B))}function Ki(t){const e=Ko(t);return 1===e?Qn.singleton(Pt.MESSAGES.MS.FRAC_S):Qn.singleton(Pt.FUNCTIONS.combineNestedFraction(Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.NEST_FRAC,Pt.MESSAGES.MS.FRAC_S))}function zi(t){const e=Ko(t);return 1===e?Qn.singleton(Pt.MESSAGES.MS.ENDFRAC):Qn.singleton(Pt.FUNCTIONS.combineNestedFraction(Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.NEST_FRAC,Pt.MESSAGES.MS.ENDFRAC))}function Qi(t){const e=Ko(t);return 1===e?Qn.singleton(Pt.MESSAGES.MS.FRAC_OVER):Qn.singleton(Pt.FUNCTIONS.combineNestedFraction(Pt.FUNCTIONS.radicalNestDepth(e-1),Pt.MESSAGES.MS.NEST_FRAC,Pt.MESSAGES.MS.FRAC_OVER))}function Ji(t){return 1===X("children/*[1]",t)[0].toString().match(/[^>\u2062>]+<\/[^>]*>/g).length?[t]:[]}function Zi(t,e,n){const r=fi(t);return 1===r?n:Pt.FUNCTIONS.combineNestedRadical(Pt.FUNCTIONS.radicalNestDepth(r-1),e,n)}function ts(t){return Qn.singleton(Zi(t,Pt.MESSAGES.MS.NESTED,Pt.MESSAGES.MS.STARTROOT))}function es(t){return Qn.singleton(Zi(t,Pt.MESSAGES.MS.NESTED,Pt.MESSAGES.MS.ENDROOT))}function ns(t){return Qn.singleton(Zi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.STARTROOT))}function rs(t){return Qn.singleton(Zi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.ENDROOT))}function os(t){return Qn.singleton(Zi(t,Pt.MESSAGES.MS.NEST_ROOT,Pt.MESSAGES.MS.ROOT))}function is(t,e){const n=function(t){const e=X("children/*[1]",t)[0].textContent.trim();return Pt.MESSAGES.MSroots[e]||e+"\uc81c\uacf1\uadfc"}(t);return n||e}function ss(t){return Qn.singleton(is(t,Pt.MESSAGES.MS.ROOTINDEX))}function as(t){return Qn.singleton(is(t,Pt.MESSAGES.MS.ROOTINDEX))}function cs(t){return Qn.singleton(is(t,Pt.MESSAGES.MS.INDEX))}function ls(t){const e=X("children/*",t);return Qn.singleton(Pt.NUMBERS.wordOrdinal(e.length))}function us(t){const e=X("children/*",t);return Qn.singleton(Pt.NUMBERS.wordOrdinal(e.length-1))}function hs(t){const e=X("children/*",t),n=X("content/*",t);return Qn.singleton(Pt.NUMBERS.wordOrdinal(e.length-n.length))}function ds(t,e){const n=t;let r=0;return function(){const t=tr.create({text:ps(n[r])&&ms(n[r+1])?Pt.MESSAGES.unitTimes:""},{});return r++,[t]}}const fs=[St.SUPERSCRIPT,St.SUBSCRIPT,St.OVERSCORE,St.UNDERSCORE];function ps(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;const e=t.tagName,n=X("children/*",t);t=-1!==fs.indexOf(e)?n[0]:n[n.length-1]}return!1}function ms(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;t=X("children/*",t)[0]}return!1}function gs(t){for(;t;){if("number"===t.tagName&&"1"===t.textContent)return[t];if("infixop"!==t.tagName||"multiplication"!==t.getAttribute("role")&&"implicit"!==t.getAttribute("role"))return[];t=X("children/*",t)[0]}return[]}function Es(t){const e=Ko(t);return Qn.singleton(new Array(e).join(Pt.MESSAGES.MS.FRACTION_REPEAT)+Pt.MESSAGES.MS.FRACTION_START)}function Ns(t){const e=Ko(t);return Qn.singleton(new Array(e).join(Pt.MESSAGES.MS.FRACTION_REPEAT)+Pt.MESSAGES.MS.FRACTION_END)}function Ss(t){const e=Ko(t);return Qn.singleton(new Array(e).join(Pt.MESSAGES.MS.FRACTION_REPEAT)+Pt.MESSAGES.MS.FRACTION_OVER)}function Ts(t){const e=Ko(t);return Qn.singleton(new Array(e).join(Pt.MESSAGES.MS.FRACTION_REPEAT)+"\u2838"+Pt.MESSAGES.MS.FRACTION_OVER)}function Is(t){return Pt.MESSAGES.regexp.HYPER===Ko(t).toString()?[t]:[]}function As(t,e){const n=bs(t);return Qn.singleton(1===n?e:new Array(n).join(Pt.MESSAGES.MS.NESTED)+e)}function bs(t,e){const n=e||0;return t.parentNode?bs(t.parentNode,"root"===t.tagName||"sqrt"===t.tagName?n+1:n):n}function Rs(t){return As(t,Pt.MESSAGES.MS.STARTROOT)}function Os(t){return As(t,Pt.MESSAGES.MS.ENDROOT)}function ys(t){return As(t,Pt.MESSAGES.MS.ROOTINDEX)}function Cs(t,e){var n;const r=t.slice(0);let o=!0;const i=t[0].parentNode.parentNode,s=null===(n=i.getAttribute("annotation"))||void 0===n?void 0:n.match(/depth:(\d+)/),a=s?s[1]:"";let c;return c=t.length>0?X("./content/*",i):[],function(){const t=c.shift(),n=r.shift(),s=r[0],l=e?[tr.create({text:e},{translate:!0})]:[];if(!t)return l;const u=n?si(n,"",{sup:Pt.MESSAGES.MS.SUPER,sub:Pt.MESSAGES.MS.SUB}):"",h=n&&"EMPTY"!==lt(n)||o&&i&&i.previousSibling?[tr.create({text:Pt.MESSAGES.regexp.SPACE+u},{})]:[],d=s&&"EMPTY"!==lt(s)||!c.length&&i&&i.nextSibling?[tr.create({text:Pt.MESSAGES.regexp.SPACE},{})]:[],f=B.evaluateNode(t);return f.unshift(new tr({text:"",layout:`beginrel${a}`})),f.push(new tr({text:"",layout:`endrel${a}`})),o=!1,l.concat(h,f,d)}}function Ls(t,e){const n=t.slice(0);let r;return r=t.length>0?X("../../content/*",t[0]):[],function(){const t=n.shift(),o=n[0],i=r.shift(),s=e?[tr.create({text:e},{translate:!0})]:[];if(!i)return s;const a=t&&"NUMBER"===lt(t),c=o&&"NUMBER"===lt(o);return s.concat(a&&c&&i.getAttribute("role")===It.SPACE?[tr.create({text:Pt.MESSAGES.regexp.SPACE},{})]:[])}}function Ms(t,e){var n;const r=ir(t,e),o=null===(n=t[0].parentNode.parentNode.getAttribute("annotation"))||void 0===n?void 0:n.match(/depth:(\d+)/),i=o?o[1]:"";return function(){const t=r();return t.unshift(new tr({text:"",layout:`beginrel${i}`})),t.push(new tr({text:"",layout:`endrel${i}`})),t}}Gt.getInstance().setCorrection("enlargeFence",function(t){const e="\u2820";if(1===t.length)return e+t;const n=t.split("");return n.every(function(t){return"\u2833"===t})?e+n.join(e):t.slice(0,-1)+e+t.slice(-1)}),Gt.getInstance().setCorrection("ignoreEnglish",function(t){return Vt(t,Pt.ALPHABETS.languagePrefix.english)}),Gt.getInstance().setCorrection("literal",function(t){return Array.from(t).map(t=>B.getInstance().evaluator(t,B.getInstance().dynamicCstr)).join("")});let vs=!1;function ws(){vs||(nr(M.BASE_LOCALE+".speech.mathspeak","",{CQFspaceoutNumber:jo,CQFspaceoutIdentifier:qo,CSFspaceoutText:Vo,CSFopenFracVerbose:Qo,CSFcloseFracVerbose:Jo,CSFoverFracVerbose:Zo,CSFopenFracBrief:ti,CSFcloseFracBrief:ei,CSFopenFracSbrief:ni,CSFcloseFracSbrief:ri,CSFoverFracSbrief:oi,CSFvulgarFraction:Fi,CQFvulgarFractionSmall:ii,CSFopenRadicalVerbose:mi,CSFcloseRadicalVerbose:gi,CSFindexRadicalVerbose:Ei,CSFopenRadicalBrief:Ni,CSFcloseRadicalBrief:Si,CSFindexRadicalBrief:Ti,CSFopenRadicalSbrief:Ii,CSFindexRadicalSbrief:Ai,CQFisSmallRoot:Pi,CSFsuperscriptVerbose:li,CSFsuperscriptBrief:ui,CSFsubscriptVerbose:ai,CSFsubscriptBrief:ci,CSFbaselineVerbose:hi,CSFbaselineBrief:di,CSFleftsuperscriptVerbose:li,CSFleftsubscriptVerbose:ai,CSFrightsuperscriptVerbose:li,CSFrightsubscriptVerbose:ai,CSFleftsuperscriptBrief:ui,CSFleftsubscriptBrief:ci,CSFrightsuperscriptBrief:ui,CSFrightsubscriptBrief:ci,CSFunderscript:bi,CSFoverscript:Oi,CSFendscripts:Ri,CTFordinalCounter:_i,CTFwordCounter:xi,CTFcontentIterator:ir,CQFdetIsSimple:yi,CSFRemoveParens:Li,CQFresetNesting:Xo,CGFbaselineConstraint:Ci,CGFtensorRules:Di}),nr("es.speech.mathspeak",M.BASE_LOCALE+".speech.mathspeak",{CTFunitMultipliers:ds,CQFoneLeft:gs}),nr("fr.speech.mathspeak",M.BASE_LOCALE+".speech.mathspeak",{CSFbaselineVerbose:ki,CSFbaselineBrief:Bi,CSFleftsuperscriptVerbose:Gi,CSFleftsubscriptVerbose:Vi,CSFleftsuperscriptBrief:Hi,CSFleftsubscriptBrief:ji}),nr("ko.speech.mathspeak",M.BASE_LOCALE+".speech.mathspeak",{CSFopenFracVerbose:$i,CSFcloseFracVerbose:Xi,CSFopenFracBrief:Yi,CSFcloseFracBrief:Wi,CSFopenFracSbrief:Ki,CSFoverFracSbrief:Qi,CSFcloseFracSbrief:zi,CQFisSimpleIndex:Ji,CSFindexRadicalVerbose:ss,CSFindexRadicalBrief:as,CSFindexRadicalSbrief:cs,CSFopenRadicalVerbose:ts,CSFcloseRadicalVerbose:es,CSFopenRadicalBrief:ns,CSFcloseRadicalBrief:rs,CSFopenRadicalSbrief:os}),nr(M.BASE_LOCALE+".speech.clearspeak","",{CTFpauseSeparator:or,CTFnodeCounter:sr,CTFcontentIterator:ir,CSFvulgarFraction:Fi,CQFvulgarFractionSmall:ur,CQFcellsSimple:lr,CSFordinalExponent:hr,CSFwordOrdinal:Sr,CQFmatchingFences:pr,CSFnestingDepth:fr,CQFfencedArguments:mr,CQFsimpleArguments:gr,CQFspaceoutNumber:jo,CQFisUnit:Tr}),nr("en.prefix.default","",{CSFordinalPosition:Ui}),nr("en.speech.chromevox","",{CTFnodeCounter:rr,CTFcontentIterator:ir}),nr("en.speech.emacspeak","en.speech.chromevox",{CQFvulgarFractionSmall:ii,CSFvulgarFraction:Fi}),nr("ko.summary.","ko.speech.mathspeak",{CSFordinalConversion:ls,CSFdecreasedOrdinalConversion:us,CSFlistOrdinalConversion:hs}),nr("nemeth.braille.default",M.BASE_LOCALE+".speech.mathspeak",{CSFopenFraction:Es,CSFcloseFraction:Ns,CSFoverFraction:Ss,CSFoverBevFraction:Ts,CQFhyperFraction:Is,CSFopenRadical:Rs,CSFcloseRadical:Os,CSFindexRadical:ys,CSFsubscript:ai,CSFsuperscript:li,CSFbaseline:hi,CGFtensorRules:t=>Di(t,!1),CTFcontentIterator:Ms,CTFrelationIterator:Cs,CTFimplicitIterator:Ls}),nr("euro.braille.default","nemeth.braille.default",{}),vs=!0)}class Ds{constructor(t,e,n){this.domain=t,this.name=e,this.func=n,this.active=!1}annotate(t){t.childNodes.forEach(this.annotate.bind(this)),t.contentNodes.forEach(this.annotate.bind(this)),t.addAnnotation(this.domain,this.func(t))}}class Ps{constructor(t,e,n,r={}){this.domain=t,this.name=e,this.func=n,this.def=r,this.active=!1}visit(t,e){let n=this.func(t,e);t.addAnnotation(this.domain,n[0]);for(let e,r=0;e=t.childNodes[r];r++)n=this.visit(e,n[1]);for(let e,r=0;e=t.contentNodes[r];r++)n=this.visit(e,n[1]);return n}}const _s=new Map,xs=new Map;function Fs(t){const e=t.domain+":"+t.name;t instanceof Ds?_s.set(e,t):xs.set(e,t)}function Us(t,e){const n=t+":"+e,r=_s.get(n)||xs.get(n);r&&(r.active=!0)}class ks{constructor(t,e,n,r){this.name=t,this.dynamicCstr=e,this.precondition=n,this.action=r,this.context=null}toString(){return this.name+" | "+this.dynamicCstr.toString()+" | "+this.precondition.toString()+" ==> "+this.action.toString()}}var Bs,Gs;function Vs(t){switch(t){case"[n]":return Bs.NODE;case"[m]":return Bs.MULTI;case"[t]":return Bs.TEXT;case"[p]":return Bs.PERSONALITY;default:throw"Parse error: "+t}}!function(t){t.NODE="NODE",t.MULTI="MULTI",t.TEXT="TEXT",t.PERSONALITY="PERSONALITY"}(Bs||(Bs={}));class Hs{static grammarFromString(t){return Gt.parseInput(t)}static fromString(t){const e={type:Vs(t.substring(0,3))};let n=t.slice(3).trim();if(!n)throw new $s("Missing content.");switch(e.type){case Bs.TEXT:if('"'===n[0]){const t=Xs(n,"\\(")[0].trim();if('"'!==t.slice(-1))throw new $s("Invalid string syntax.");e.content=t,n=n.slice(t.length).trim(),-1===n.indexOf("(")&&(n="");break}case Bs.NODE:case Bs.MULTI:{const t=n.indexOf(" (");if(-1===t){e.content=n.trim(),n="";break}e.content=n.substring(0,t).trim(),n=n.slice(t).trim()}}if(n){const t=Hs.attributesFromString(n);t.grammar&&(e.grammar=t.grammar,delete t.grammar),Object.keys(t).length&&(e.attributes=t)}return new Hs(e)}static attributesFromString(t){if("("!==t[0]||")"!==t.slice(-1))throw new $s("Invalid attribute expression: "+t);const e={},n=Xs(t.slice(1,-1),",");for(const t of n){const n=t.indexOf(":");if(-1===n)e[t.trim()]="true";else{const r=t.substring(0,n).trim(),o=t.slice(n+1).trim();e[r]=r===Bt?Hs.grammarFromString(o):o}}return e}constructor({type:t,content:e,attributes:n,grammar:r}){this.type=t,this.content=e,this.attributes=n,this.grammar=r}toString(){let t="";t+=function(t){switch(t){case Bs.NODE:return"[n]";case Bs.MULTI:return"[m]";case Bs.TEXT:return"[t]";case Bs.PERSONALITY:return"[p]";default:throw"Unknown type error: "+t}}(this.type),t+=this.content?" "+this.content:"";const e=this.attributesToString();return t+=e?" "+e:"",t}grammarToString(){return this.getGrammar().join(":")}getGrammar(){if(!this.grammar)return[];const t=[];for(const[e,n]of Object.entries(this.grammar))t.push(!0===n?e:!1===n?`!${e}`:`${e}=${n}`);return t}attributesToString(){const t=this.getAttributes(),e=this.grammarToString();return e&&t.push("grammar:"+e),t.length>0?"("+t.join(", ")+")":""}getAttributes(){if(!this.attributes)return[];const t=[];for(const[e,n]of Object.entries(this.attributes))t.push("true"===n?e:`${e}:${n}`);return t}}class js{static fromString(t){const e=Xs(t,";").filter(function(t){return t.match(/\S/)}).map(function(t){return t.trim()}),n=[];for(let t=0,r=e.length;t<r;t++){const r=Hs.fromString(e[t]);r&&n.push(r)}return js.naiveSpan(n),new js(n)}static naiveSpan(t){var e;let n=!1;for(let r,o=0;r=t[o];o++){if(n&&(r.type!==Bs.TEXT||'"'!==r.content[0]&&!r.content.match(/^CSF/)))continue;if(!n&&r.type===Bs.PERSONALITY)continue;if(!n){n=!0;continue}if(null===(e=r.attributes)||void 0===e?void 0:e.span)continue;const i=t[o+1];i&&i.type!==Bs.NODE||js.addNaiveSpan(r,i?i.content:"LAST")}}static addNaiveSpan(t,e){t.attributes||(t.attributes={}),t.attributes.span=e}constructor(t){this.components=t}toString(){return this.components.map(function(t){return t.toString()}).join("; ")}}class qs{static constraintValue(t,e){for(let n,r=0;n=e[r];r++)if(t.match(n))return++r;return 0}toString(){const t=this.constraints.join(", ");return`${this.query}, ${t} (${this.priority}, ${this.rank})`}constructor(t,...e){this.query=t,this.constraints=e;const[n,r]=this.presetPriority();this.priority=n?r:this.calculatePriority()}calculatePriority(){const t=qs.constraintValue(this.query,qs.queryPriorities);if(!t)return 0;const e=this.query.match(/^self::.+\[(.+)\]/);let n=0;if((null==e?void 0:e.length)&&e[1]){const t=e[1];n=qs.constraintValue(t,qs.attributePriorities)}return 100*t+10*n}presetPriority(){if(!this.constraints.length)return[!1,0];const t=this.constraints[this.constraints.length-1].match(/^priority=(.*$)/);if(!t)return[!1,0];this.constraints.pop();const e=parseFloat(t[1]);return[!0,isNaN(e)?0:e]}}qs.queryPriorities=[/^self::\*$/,/^self::[\w-]+$/,/^self::\*\[.+\]$/,/^self::[\w-]+\[.+\]$/],qs.attributePriorities=[/^@[\w-]+$/,/^@[\w-]+!=".+"$/,/^not\(contains\(@[\w-]+,\s*".+"\)\)$/,/^contains\(@[\w-]+,".+"\)$/,/^@[\w-]+=".+"$/];class $s extends k{constructor(t){super(t),this.name="RuleError"}}function Xs(t,e){const n=[];let r="";for(;""!==t;){const o=t.search(e);if(-1===o){if((t.match(/"/g)||[]).length%2!=0)throw new $s("Invalid string in expression: "+t);n.push(r+t),r="",t=""}else if((t.substring(0,o).match(/"/g)||[]).length%2==0)n.push(r+t.substring(0,o)),r="",t=t.substring(o+1);else{const e=t.substring(o).search('"');if(-1===e)throw new $s("Invalid string in expression: "+t);r+=t.substring(0,o+e+1),t=t.substring(o+e+1)}}return r&&n.push(r),n}class Ys{constructor(t,e){this.prefix=t,this.store=e}add(t,e){this.checkCustomFunctionSyntax_(t)&&(this.store[t]=e)}addStore(t){const e=Object.keys(t.store);for(let n,r=0;n=e[r];r++)this.add(n,t.store[n])}lookup(t){return this.store[t]}checkCustomFunctionSyntax_(t){const e=new RegExp("^"+this.prefix);return!!t.match(e)||(console.error("FunctionError: Invalid function name. Expected prefix "+this.prefix),!1)}}class Ws extends Ys{constructor(){super("CQF",{})}}class Ks extends Ys{constructor(){super("CSF",{})}}class zs extends Ys{constructor(){super("CTF",{})}}class Qs extends Ys{constructor(){super("CGF",{})}}class Js{constructor(){this.customQueries=new Ws,this.customStrings=new Ks,this.contextFunctions=new zs,this.customGenerators=new Qs}applyCustomQuery(t,e){const n=this.customQueries.lookup(e);return n?n(t):null}applySelector(t,e){return this.applyCustomQuery(t,e)||X(e,t)}applyQuery(t,e){const n=this.applySelector(t,e);return n.length>0?n[0]:null}applyConstraint(t,e){return!!this.applyQuery(t,e)||function(t,e){let n;try{n=$(t,e,V.result.BOOLEAN_TYPE)}catch(t){return!1}return n.booleanValue}(e,t)}constructString(t,e){const n=this.constructString_(t,e);return Array.isArray(n)?n.map(t=>t.speech).join(""):n}constructSpan(t,e,n){const r=this.constructString_(t,e);if(Array.isArray(r)){const t=r[r.length-1];return t.attributes=Object.assign({},n,t.attributes),r}return[Qn.node(r,t,n)]}constructString_(t,e){if(!e)return"";if('"'===e.charAt(0))return e.slice(1,-1);const n=this.customStrings.lookup(e);return n?n(t):function(t,e){let n;try{n=$(t,e,V.result.STRING_TYPE)}catch(t){return""}return n.stringValue}(e,t)}parse(t){const e=Array.isArray(t)?t:Object.entries(t);for(const t of e){switch(t[0].slice(0,3)){case"CQF":this.customQueries.add(t[0],t[1]);break;case"CSF":this.customStrings.add(t[0],t[1]);break;case"CTF":this.contextFunctions.add(t[0],t[1]);break;case"CGF":this.customGenerators.add(t[0],t[1]);break;default:console.error("FunctionError: Invalid function name "+t[0])}}}}class Zs{static compareStaticConstraints_(t,e){if(t.length!==e.length)return!1;for(let n,r=0;n=t[r];r++)if(-1===e.indexOf(n))return!1;return!0}static comparePreconditions_(t,e){const n=t.precondition,r=e.precondition;return n.query===r.query&&Zs.compareStaticConstraints_(n.constraints,r.constraints)}constructor(){this.context=new Js,this.parseOrder=M.DEFAULT_ORDER,this.parser=new v(this.parseOrder),this.locale=M.DEFAULT_VALUES[C.LOCALE],this.modality=M.DEFAULT_VALUES[C.MODALITY],this.domain="",this.initialized=!1,this.inherits=null,this.kind="standard",this.customTranscriptions={},this.preconditions=new Map,this.speechRules_=[],this.rank=0,this.parseMethods={Rule:this.defineRule,Generator:this.generateRules,Action:this.defineAction,Precondition:this.definePrecondition,Ignore:this.ignoreRules}}defineRule(t,e,n,r,...o){const i=this.parseAction(n),s=this.parsePrecondition(r,o),a=this.parseCstr(e);if(!(i&&s&&a))return console.error(`Rule Error: ${r}, (${e}): ${n}`),null;const c=new ks(t,a,s,i);return c.precondition.rank=this.rank++,this.addRule(c),c}addRule(t){t.context=this.context,this.speechRules_.unshift(t)}deleteRule(t){const e=this.speechRules_.indexOf(t);-1!==e&&this.speechRules_.splice(e,1)}findRule(t){for(let e,n=0;e=this.speechRules_[n];n++)if(t(e))return e;return null}findAllRules(t){return this.speechRules_.filter(t)}evaluateDefault(t){const e=t.textContent.slice(0);return e.match(/^\s+$/)?this.evaluateWhitespace(e):this.evaluateString(e)}evaluateWhitespace(t){return[]}evaluateCustom(t){const e=this.customTranscriptions[t];return void 0!==e?tr.create({text:e},{adjust:!0,translate:!1}):null}evaluateCharacter(t){return this.evaluateCustom(t)||tr.create({text:t},{adjust:!0,translate:!0})}removeDuplicates(t){for(let e,n=this.speechRules_.length-1;e=this.speechRules_[n];n--)e!==t&&t.dynamicCstr.equal(e.dynamicCstr)&&Zs.comparePreconditions_(e,t)&&this.speechRules_.splice(n,1)}getSpeechRules(){return this.speechRules_}setSpeechRules(t){this.speechRules_=t}getPreconditions(){return this.preconditions}parseCstr(t){try{return this.parser.parse(this.preParseCstr(t))}catch(e){if("RuleError"===e.name)return console.error("Rule Error ",`Illegal Dynamic Constraint: ${t}.`,e.message),null;throw e}}parsePrecondition(t,e){try{const n=this.parsePrecondition_(t);t=n[0];let r=n.slice(1);for(const t of e)r=r.concat(this.parsePrecondition_(t));return new qs(t,...r)}catch(n){if("RuleError"===n.name)return console.error("Rule Error ",`Illegal preconditions: ${t}, ${e}.`,n.message),null;throw n}}parseAction(t){try{return js.fromString(t)}catch(e){if("RuleError"===e.name)return console.error("Rule Error ",`Illegal action: ${t}.`,e.message),null;throw e}}parse(t){this.modality=t.modality||this.modality,this.locale=t.locale||this.locale,this.domain=t.domain||this.domain,this.context.parse(t.functions||[]),"actions"!==t.kind&&(this.kind=t.kind||this.kind,this.inheritRules()),this.parseRules(t.rules||[])}parseRules(t){for(let e,n=0;e=t[n];n++){const t=e[0],n=this.parseMethods[t];t&&n&&n.apply(this,e.slice(1))}}generateRules(t){const e=this.context.customGenerators.lookup(t);e&&e(this)}defineAction(t,e){let n;try{n=js.fromString(e)}catch(t){if("RuleError"===t.name)return void console.error("Action Error ",e,t.message);throw t}const r=this.getFullPreconditions(t);if(!r)return void console.error(`Action Error: No precondition for action ${t}`);this.ignoreRules(t);const o=new RegExp("^\\w+\\.\\w+\\.");r.conditions.forEach(([e,r])=>{const i=this.parseCstr(e.toString().replace(o,""));this.addRule(new ks(t,i,r,n))})}getFullPreconditions(t){const e=this.preconditions.get(t);return e||!this.inherits?e:this.inherits.getFullPreconditions(t)}definePrecondition(t,e,n,...r){const o=this.parsePrecondition(n,r),i=this.parseCstr(e);o&&i?(o.rank=this.rank++,this.preconditions.set(t,new ta(i,o))):console.error(`Precondition Error: ${n}, (${e})`)}inheritRules(){if(!this.inherits||!this.inherits.getSpeechRules().length)return;const t=new RegExp("^\\w+\\.\\w+\\."+(this.domain?"\\w+\\.":""));this.inherits.getSpeechRules().forEach(e=>{const n=this.parseCstr(e.dynamicCstr.toString().replace(t,""));this.addRule(new ks(e.name,n,e.precondition,e.action))})}ignoreRules(t,...e){let n=this.findAllRules(e=>e.name===t);if(!e.length)return void n.forEach(this.deleteRule.bind(this));let r=[];for(const t of e){const e=this.parseCstr(t);for(const t of n)e.equal(t.dynamicCstr)?this.deleteRule(t):r.push(t);n=r,r=[]}}parsePrecondition_(t){const e=this.context.customGenerators.lookup(t);return e?e():[t]}preParseCstr(t){const e=t.match("(.+)\\.(.+)");return this.locale+"."+this.modality+"."+(e?t:(this.domain?this.domain:"")+"."+t)}}class ta{constructor(t,e){this.base=t,this._conditions=[],this.constraints=[],this.allCstr={},this.constraints.push(t),this.addCondition(t,e)}get conditions(){return this._conditions}addConstraint(t){if(this.constraints.filter(e=>e.equal(t)).length)return;this.constraints.push(t);const e=[];for(const[n,r]of this.conditions)this.base.equal(n)&&e.push([t,r]);this._conditions=this._conditions.concat(e)}addBaseCondition(t){this.addCondition(this.base,t)}addFullCondition(t){this.constraints.forEach(e=>this.addCondition(e,t))}addCondition(t,e){const n=t.toString()+" "+e.toString();this.allCstr.condStr||(this.allCstr[n]=!0,this._conditions.push([t,e]))}}class ea extends Zs{constructor(){super(),this.annotators=[],this.parseMethods.Alias=this.defineAlias,this.parseMethods.AliasRule=this.defineRulesAlias,this.parseMethods.SpecializedRule=this.defineSpecializedRule,this.parseMethods.Specialized=this.defineSpecialized}initialize(){this.initialized||(this.annotations(),this.initialized=!0)}annotations(){for(let t,e=0;t=this.annotators[e];e++)Us(this.domain,t)}defineAlias(t,e,...n){const r=this.parsePrecondition(e,n);if(!r)return void console.error(`Precondition Error: ${e} ${n}`);const o=this.preconditions.get(t)||this.getFullPreconditions(t);o?o.addFullCondition(r):console.error(`Alias Error: No precondition by the name of ${t}`)}defineRulesAlias(t,e,...n){const r=this.findAllRules(function(e){return e.name===t});if(0===r.length)throw new $s("Rule with name "+t+" does not exist.");const o=[];r.forEach(t=>{(t=>{const e=t.dynamicCstr.toString(),n=t.action.toString();for(let t,r=0;t=o[r];r++)if(t.action===n&&t.cstr===e)return!1;return o.push({cstr:e,action:n}),!0})(t)&&this.addAlias_(t,e,n)})}defineSpecializedRule(t,e,n,r){const o=this.parseCstr(e),i=this.findRule(e=>e.name===t&&o.equal(e.dynamicCstr)),s=this.parseCstr(n);if(!i&&r)throw new $s("Rule named "+t+" with style "+e+" does not exist.");const a=r?js.fromString(r):i.action,c=new ks(i.name,s,i.precondition,a);this.addRule(c)}defineSpecialized(t,e,n){const r=this.parseCstr(n);if(!r)return void console.error(`Dynamic Constraint Error: ${n}`);const o=this.preconditions.get(t);o?o.addConstraint(r):console.error(`Alias Error: No precondition by the name of ${t}`)}evaluateString(t){const e=[];if(t.match(/^\s+$/))return e;let n=this.matchNumber(t);if(n&&n.length===t.length)return e.push(this.evaluateCharacter(n.number)),e;const r=t.replace(/\s/g," ").split(" ").filter(t=>t);for(let t,o=0;t=r[o];o++)if(1===t.length)e.push(this.evaluateCharacter(t));else if(t.match(new RegExp("^["+Pt.MESSAGES.regexp.TEXT+"]+$")))e.push(this.evaluateCharacter(t));else{let r=t;for(;r;){n=this.matchNumber(r);const t=r.match(new RegExp("^["+Pt.MESSAGES.regexp.TEXT+"]+"));if(n)e.push(this.evaluateCharacter(n.number)),r=r.substring(n.length);else if(t)e.push(this.evaluateCharacter(t[0])),r=r.substring(t[0].length);else{const t=Array.from(r),n=t[0];e.push(this.evaluateCharacter(n)),r=t.slice(1).join("")}}}return e}parse(t){super.parse(t),this.annotators=t.annotators||[]}addAlias_(t,e,n){const r=this.parsePrecondition(e,n),o=new ks(t.name,t.dynamicCstr,r,t.action);o.name=t.name,this.addRule(o)}matchNumber(t){const e=t.match(new RegExp("^"+Pt.MESSAGES.regexp.NUMBER)),n=t.match(new RegExp("^"+ea.regexp.NUMBER));if(!e&&!n)return null;const r=n&&n[0]===t;if(e&&e[0]===t||!r)return e?{number:e[0],length:e[0].length}:null;return{number:n[0].replace(new RegExp(ea.regexp.DIGIT_GROUP,"g"),"X").replace(new RegExp(ea.regexp.DECIMAL_MARK,"g"),Pt.MESSAGES.regexp.DECIMAL_MARK).replace(/X/g,Pt.MESSAGES.regexp.DIGIT_GROUP.replace(/\\/g,"")),length:n[0].length}}}ea.regexp={NUMBER:"((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",DECIMAL_MARK:"\\.",DIGIT_GROUP:","};class na extends ea{constructor(){super(...arguments),this.modality="braille",this.customTranscriptions={"\u22ca":"\u2808\u2821\u2833"}}evaluateString(t){const e=[],n=Array.from(t);for(let t=0;t<n.length;t++)e.push(this.evaluateCharacter(n[t]));return e}annotations(){for(let t,e=0;t=this.annotators[e];e++)Us(this.locale,t)}}class ra extends na{constructor(){super(...arguments),this.locale="euro",this.customTranscriptions={},this.customCommands={"\\cdot":"*","\\lt":"<","\\gt":">"},this.lastSpecial=!1,this.specialChars=["^","_","{","}"]}evaluateString(t){const e=t.split(/(\\[a-z]+|\\{|\\}|\\\\)/i),n=this.cleanup(e);return super.evaluateString(n)}cleanup(t){const e=[];let n=!1,r=null;for(let o of t){if(o.match(/^\\/)){"\\text"===o&&(n=!0),this.addSpace(An.LatexCommands.get(o))&&e.push(" "),o=this.customCommands[o]||o;const t=o.match(/^\\/);t&&o.match(/^\\[a-zA-Z]+$/)&&r&&e.push(" "),r=t?o:null,e.push(o);continue}const t=o.split("");for(const o of t)n?(e.push(o),n="}"!==o,r=null):o.match(/[a-z]/i)&&r?(r=null,e.push(" "),e.push(o)):o.match(/\s/)||(this.addSpace(o)&&e.push(" "),e.push(o),r=null)}return e.join("")}addSpace(t){if(!t)return!1;if(-1!==this.specialChars.indexOf(t))return this.lastSpecial=!0,!1;if(this.lastSpecial)return this.lastSpecial=!1,!1;const e=An.Meaning.get(t);return e.type===St.OPERATOR||e.type===St.RELATION||e.type===St.PUNCTUATION&&e.role===It.COLON}}!function(t){t.ROOT="root",t.DYNAMIC="dynamic",t.QUERY="query",t.BOOLEAN="boolean",t.STATIC="static"}(Gs||(Gs={}));class oa{constructor(t,e){this.constraint=t,this.test=e,this.children_={},this.kind=Gs.ROOT}getConstraint(){return this.constraint}getKind(){return this.kind}applyTest(t){return this.test(t)}addChild(t){const e=t.getConstraint(),n=this.children_[e];return this.children_[e]=t,n}getChild(t){return this.children_[t]}getChildren(){const t=[];for(const e of Object.values(this.children_))t.push(e);return t}findChildren(t){const e=[];for(const n of Object.values(this.children_))n.applyTest(t)&&e.push(n);return e}removeChild(t){delete this.children_[t]}toString(){return this.constraint}}class ia extends oa{constructor(t,e){super(t,e),this.rule_=null,this.kind=Gs.STATIC}getRule(){return this.rule_}setRule(t){this.rule_&&_.getInstance().output("Replacing rule "+this.rule_+" with "+t),this.rule_=t}toString(){return this.getRule()?this.constraint+"\n==> "+this.getRule().action:this.constraint}}function sa(t,e,n){switch(t){case Gs.ROOT:return new aa;case Gs.DYNAMIC:return new ca(e);case Gs.QUERY:return new ha(e,n);case Gs.BOOLEAN:return new da(e,n);default:return null}}class aa extends oa{constructor(){super("",()=>!0),this.kind=Gs.ROOT}}class ca extends oa{constructor(t){super(t,e=>e===t),this.kind=Gs.DYNAMIC}}const la={"=":(t,e)=>t===e,"!=":(t,e)=>t!==e,"<":(t,e)=>t<e,">":(t,e)=>t>e,"<=":(t,e)=>t<=e,">=":(t,e)=>t>=e};function ua(t){if(t.match(/^self::\*$/))return t=>!0;if(t.match(/^self::\w+$/)){const e=t.slice(6).toUpperCase();return t=>t.tagName&&lt(t)===e}if(t.match(/^self::\w+:\w+$/)){const e=t.split(":"),n=j(e[2]);if(!n)return null;const r=e[3].toUpperCase();return t=>t.localName&&t.localName.toUpperCase()===r&&t.namespaceURI===n}if(t.match(/^@\w+$/)){const e=t.slice(1);return t=>t.hasAttribute&&t.hasAttribute(e)}if(t.match(/^@\w+="[\w\d ]+"$/)){const e=t.split("="),n=e[0].slice(1),r=e[1].slice(1,-1);return t=>t.hasAttribute&&t.hasAttribute(n)&&t.getAttribute(n)===r}if(t.match(/^@\w+!="[\w\d ]+"$/)){const e=t.split("!="),n=e[0].slice(1),r=e[1].slice(1,-1);return t=>!t.hasAttribute||!t.hasAttribute(n)||t.getAttribute(n)!==r}if(t.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)){const e=t.split('"')[1];return t=>!!Gt.getInstance().getParameter(e)}if(t.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)){const e=t.split('"')[1];return t=>!Gt.getInstance().getParameter(e)}if(t.match(/^name\(\.\.\/\.\.\)="\w+"$/)){const e=t.split('"')[1].toUpperCase();return t=>{var n,r;return(null===(r=null===(n=t.parentNode)||void 0===n?void 0:n.parentNode)||void 0===r?void 0:r.tagName)&&lt(t.parentNode.parentNode)===e}}if(t.match(/^count\(preceding-sibling::\*\)=\d+$/)){const e=t.split("="),n=parseInt(e[1],10);return t=>{var e;return(null===(e=t.parentNode)||void 0===e?void 0:e.childNodes[n])===t}}if(t.match(/^.+\[@category!?=".+"\]$/)){let[,e,n,r]=t.match(/^(.+)\[@category(!?=)"(.+)"\]$/);const o=r.match(/^unit:(.+)$/);let i="";return o&&(r=o[1],i=":unit"),t=>{const o=X(e,t)[0];if(o){const t=Kn(o.textContent+i);return"="===n?t===r:t!==r}return!1}}if(t.match(/^string-length\(.+\)\W+\d+/)){const[,e,n,r]=t.match(/^string-length\((.+)\)(\W+)(\d+)/),o=la[n]||la["="],i=parseInt(r,10);return t=>{const n=X(e,t)[0];return!!n&&o(Array.from(n.textContent).length,i)}}return null}class ha extends ia{constructor(t,e){super(t,ua(t)),this.context=e,this.kind=Gs.QUERY}applyTest(t){return this.test?this.test(t):this.context.applyQuery(t,this.constraint)===t}}class da extends ia{constructor(t,e){super(t,ua(t)),this.context=e,this.kind=Gs.BOOLEAN}applyTest(t){return this.test?this.test(t):this.context.applyConstraint(t,this.constraint)}}class fa{static collectRules_(t){const e=[];let n=[t];for(;n.length;){const t=n.shift();if(t.getKind()===Gs.QUERY||t.getKind()===Gs.BOOLEAN){const n=t.getRule();n&&e.unshift(n)}n=n.concat(t.getChildren())}return e}static printWithDepth_(t,e,n){n+=new Array(e+2).join(e.toString())+": "+t.toString()+"\n";const r=t.getChildren();for(let t,o=0;t=r[o];o++)n=fa.printWithDepth_(t,e+1,n);return n}static order_(t){const e=t.getChildren();if(!e.length)return 0;const n=Math.max.apply(null,e.map(fa.order_));return Math.max(e.length,n)}constructor(){this.root=sa(Gs.ROOT,"",null)}addRule(t){let e=this.root;const n=t.context,r=t.dynamicCstr.getValues();for(let t=0,o=r.length;t<o;t++)e=this.addNode_(e,r[t],Gs.DYNAMIC,n);e=this.addNode_(e,t.precondition.query,Gs.QUERY,n);const o=t.precondition.constraints;for(let t=0,r=o.length;t<r;t++)e=this.addNode_(e,o[t],Gs.BOOLEAN,n);e.setRule(t)}lookupRules(t,e){let n=[this.root];const r=[];for(;e.length;){const t=e.shift(),r=[];for(;n.length;){n.shift().getChildren().forEach(e=>{e.getKind()===Gs.DYNAMIC&&-1===t.indexOf(e.getConstraint())||r.push(e)})}n=r.slice()}for(;n.length;){const e=n.shift();if(e.getRule){const t=e.getRule();t&&r.push(t)}const o=e.findChildren(t);n=n.concat(o)}return r}hasSubtrie(t){let e=this.root;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(e=e.getChild(r),!e)return!1}return!0}toString(){return fa.printWithDepth_(this.root,0,"")}collectRules(t=this.root){return fa.collectRules_(t)}order(){return fa.order_(this.root)}enumerate(t){return this.enumerate_(this.root,t)}byConstraint(t){let e=this.root;for(;t.length&&e;){const n=t.shift();e=e.getChild(n)}return e||null}enumerate_(t,e){e=e||{};const n=t.getChildren();for(let t,r=0;t=n[r];r++)t.kind===Gs.DYNAMIC&&(e[t.getConstraint()]=this.enumerate_(t,e[t.getConstraint()]));return e}addNode_(t,e,n,r){let o=t.getChild(e);return o||(o=sa(n,e,r),t.addChild(o)),o}}var pa;!function(t){t[t.ENTER=13]="ENTER",t[t.ESC=27]="ESC",t[t.SPACE=32]="SPACE",t[t.PAGE_UP=33]="PAGE_UP",t[t.PAGE_DOWN=34]="PAGE_DOWN",t[t.END=35]="END",t[t.HOME=36]="HOME",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN",t[t.TAB=9]="TAB",t[t.LESS=188]="LESS",t[t.GREATER=190]="GREATER",t[t.DASH=189]="DASH",t[t.ZERO=48]="ZERO",t[t.ONE=49]="ONE",t[t.TWO=50]="TWO",t[t.THREE=51]="THREE",t[t.FOUR=52]="FOUR",t[t.FIVE=53]="FIVE",t[t.SIX=54]="SIX",t[t.SEVEN=55]="SEVEN",t[t.EIGHT=56]="EIGHT",t[t.NINE=57]="NINE",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z"}(pa||(pa={}));const ma=new Map([[13,"ENTER"],[27,"ESC"],[32,"SPACE"],[33,"PAGE_UP"],[34,"PAGE_DOWN"],[35,"END"],[36,"HOME"],[37,"LEFT"],[38,"UP"],[39,"RIGHT"],[40,"DOWN"],[9,"TAB"],[188,"LESS"],[190,"GREATER"],[189,"DASH"],[48,"ZERO"],[49,"ONE"],[50,"TWO"],[51,"THREE"],[52,"FOUR"],[53,"FIVE"],[54,"SIX"],[55,"SEVEN"],[56,"EIGHT"],[57,"NINE"],[65,"A"],[66,"B"],[67,"C"],[68,"D"],[69,"E"],[70,"F"],[71,"G"],[72,"H"],[73,"I"],[74,"J"],[75,"K"],[76,"L"],[77,"M"],[78,"N"],[79,"O"],[80,"P"],[81,"Q"],[82,"R"],[83,"S"],[84,"T"],[85,"U"],[86,"V"],[87,"W"],[88,"X"],[89,"Y"],[90,"Z"]]);var ga;!function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSEMOVE="mousemove",t.SELECTSTART="selectstart",t.KEYPRESS="keypress",t.KEYDOWN="keydown",t.KEYUP="keyup",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.TOUCHCANCEL="touchcancel"}(ga||(ga={}));function Ea(t,e,n){return t?{pause:Na(t.pause,e.pause,n)}:e}function Na(t,e,n){return(n||function(n,r){return"number"==typeof n&&"number"==typeof r?n+r:"number"==typeof n?r:"number"==typeof r?n:[t,e].sort()[0]}).call(null,t,e)}function Sa(t,e){delete t.open,e.close.forEach(e=>delete t[e]),e.open.forEach(n=>t[n]=e[n]);const n=Object.keys(t);t.open=n}function Ta(t,e){if(t.length<=1)return t;const n=[];for(let r,o=0;r=e[o],t.length;o++)r.close&&r.close.length&&r.close.forEach(function(e){const r=t.indexOf(e);-1!==r&&(n.unshift(e),t.splice(r,1))});return n}let Ia={},Aa=[];function ba(t){t=t.map(t=>t.clone()),Ia={},Aa=[];let e=[];const n={};for(let r,o=0;r=t[o];o++){let t=null;const o=r.descriptionSpan(),i=r.personality,s=i[A.JOIN];delete i[A.JOIN],void 0!==i[A.PAUSE]&&(t={[A.PAUSE]:i[A.PAUSE]},delete i[A.PAUSE]);Ma(e,o,va(i,n),s,t,!0)}return e=e.concat(function(){const t=[];for(let e=Aa.length-1;e>=0;e--){const n=Aa[e];if(n.length){const e={open:[],close:[]};for(let t=0;t<n.length;t++){const r=n[t];e.close.push(r),e[r]=0}t.push(e)}}return t}()),e=function(t){const e={},n=[];for(let r,o=0;r=t[o];o++){if(!ya(r)){Ra(n,r);continue}if(!r.close||1!==r.close.length||r.open.length){Oa(r,e),n.push(r);continue}let i=t[o+1];if(!i||La(i)){Oa(r,e),n.push(r);continue}const s=Ca(i)?i:null;s&&(i=t[o+2]),i&&ya(i)&&i.open[0]===r.close[0]&&!i.close.length&&i[i.open[0]]===e[i.open[0]]?s?(Ra(n,s),o+=2):o+=1:(Oa(r,e),n.push(r))}return n}(e),e=B.getInstance().options.cleanpause?function(t){for(;Ca(t[0]);)t.shift();for(;Ca(t[t.length-1]);)t.pop();return t}(e):e,e}function Ra(t,e){const n=t[t.length-1];if(n){if(La(e)&&La(n)){if(void 0===n.join)return void(n.span=n.span.concat(e.span));const t=n.span.pop(),r=e.span.shift();return n.span.push(t+n.join+r),n.span=n.span.concat(e.span),void(n.join=e.join)}Ca(e)&&Ca(n)?n.pause=Na(n.pause,e.pause):t.push(e)}else t.push(e)}function Oa(t,e){t.rate&&(e.rate=t.rate),t.pitch&&(e.pitch=t.pitch),t.volume&&(e.volume=t.volume)}function ya(t){return"object"==typeof t&&t.open}function Ca(t){return"object"==typeof t&&1===Object.keys(t).length&&Object.keys(t)[0]===A.PAUSE}function La(t){const e=Object.keys(t);return"object"==typeof t&&(1===e.length&&"span"===e[0]||2===e.length&&("span"===e[0]&&"join"===e[1]||"span"===e[1]&&"join"===e[0]))}function Ma(t,e,n,r,o,i=!1){if(i){const i=t[t.length-1];let s;if(i&&(s=i[A.JOIN]),i&&!e.speech&&o&&Ca(i)){const t=A.PAUSE;i[t]=Na(i[t],o[t]),o=null}if(i&&e.speech&&0===Object.keys(n).length&&La(i)){if(void 0!==s){const t=i.span.pop();e=Qn.stringAttr(t.speech+s+e.speech,t.attributes)}i.span.push(e),e=Qn.empty(),i[A.JOIN]=r}}0!==Object.keys(n).length&&t.push(n),e.speech&&t.push({span:[e],join:r}),o&&t.push(o)}function va(t,e){if(!e)return t;const n={};for(const r of b){const o=t[r],i=e[r];if(!o&&!i||o&&i&&o===i)continue;const s=o||0;ya(n)||(n.open=[],n.close=[]),o||n.close.push(r),i||n.open.push(r),i&&o&&(n.close.push(r),n.open.push(r)),e[r]=s,n[r]=s,Ia[r]?Ia[r].push(s):Ia[r]=[s]}if(ya(n)){let t=n.close.slice();for(;t.length>0;){let r=Aa.pop();const o=Ar(r,t);if(t=Ar(t,r),r=o,0!==t.length){if(0!==r.length){n.close=n.close.concat(r),n.open=n.open.concat(r);for(let t,o=0;t=r[o];o++)n[t]=e[t]}}else 0!==r.length&&Aa.push(r)}Aa.push(n.open)}return n}class wa{constructor(){this.separator_=" "}set separator(t){this.separator_=t}get separator(){return"braille"===B.getInstance().options.modality?"":this.separator_}error(t){return null}merge(t){let e="";const n=t.length-1;for(let r,o=0;r=t[o];o++)if(e+=r.speech,o<n){const t=r.attributes.separator;e+=void 0!==t?t:this.separator}return e}finalize(t){return t}pauseValue(t){let e;switch(t){case"long":e=750;break;case"medium":e=500;break;case"short":e=250;break;default:e=parseInt(t,10)}return Math.floor(e*B.getInstance().getRate()/100)}}class Da extends wa{constructor(){super(...arguments),this.ignoreElements=[A.LAYOUT],this.scaleFunction=null}setScaleFunction(t,e,n,r,o=0){this.scaleFunction=i=>{const s=(i-t)/(e-t),a=n*(1-s)+r*s;return+(Math.round(a+"e+"+o)+"e-"+o)}}applyScaleFunction(t){return this.scaleFunction?this.scaleFunction(t):t}ignoreElement(t){return-1!==this.ignoreElements.indexOf(t)}}class Pa extends Da{markup(t){this.setScaleFunction(-2,2,-100,100,2);const e=ba(t),n=[],r=[];for(let t,o=0;t=e[o];o++)if(t.span)n.push(this.merge(t.span));else if(Ca(t))n.push(this.pause(t));else{if(t.close.length)for(let e=0;e<t.close.length;e++){const e=r.pop();if(-1===t.close.indexOf(e))throw new k("Unknown closing markup element: "+e);n.push(this.closeTag(e))}if(t.open.length){Ta(t.open.slice(),e.slice(o+1)).forEach(e=>{n.push(this.prosodyElement(e,t[e])),r.push(e)})}}return n.join(" ")}}class _a extends Pa{constructor(){super(...arguments),this.values=new Map}finalize(t){return function(t){if(ka.clear(),!t)return;const e=Object.keys(t).map(t=>parseInt(t)).sort();for(let t,n=0;t=e[n];n++)ka.set(t,n+1)}(this.values.get("rel")),function(t){xa="";const e=K(`<all>${t}</all>`);return _.getInstance().generate(()=>[ot(e.toString())]),xa=Ga(e),xa}(t)}pause(t){return""}prosodyElement(t,e){return t===A.LAYOUT?`<${e}>`:""}closeTag(t){return`</${t}>`}markup(t){this.values.clear();const e=[];let n=[];for(const r of t){if(!r.layout){n.push(r);continue}e.push(this.processContent(n)),n=[];const[t,o,i]=this.layoutValue(r.layout);"begin"!==t?"end"!==t?console.warn("Something went wrong with layout markup: "+o):e.push("</"+o+">"):e.push("<"+o+(i?` value="${i}"`:"")+">")}return e.push(this.processContent(n)),e.join("")}processContent(t){const e=[],n=ba(t);for(let t,r=0;t=n[r];r++)t.span?e.push(this.merge(t.span)):Ca(t);return e.join("")}layoutValue(t){const e=t.match(/^(begin|end|)(.*\D)(\d*)$/),n=e[3];return n?(t=e[2],this.values.has(t)||this.values.set(t,{}),this.values.get(t)[n]=!0,[e[1],t,n]):[e[1],e[2],""]}}_a.options={cayleyshort:B.getInstance().options.cayleyshort,linebreaks:B.getInstance().options.linebreaks};let xa="";const Fa={TABLE:function(t){let e=qa(t);e.forEach(t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1)});const[n,r]=$a(e);return e=Xa(e,r),Ya(e,n)},CASES:function(t){let e=qa(t);e.forEach(t=>{t.cells=t.cells.slice(0,-1),t.width=t.width.slice(0,-1)});const[n,r]=$a(e);return e=Xa(e,r),Ya(e,n)},CAYLEY:function(t){let e=qa(t);e.forEach(t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1),t.sep=t.sep+t.sep});const[n,r]=$a(e),o={lfence:"",rfence:"",cells:r.map(t=>"\u2810"+new Array(t).join("\u2812")),width:r,height:1,sep:e[0].sep};B.getInstance().options.cayleyshort&&"\u2800"===e[0].cells[0]&&(o.cells[0]="\u2800");return e.splice(1,0,o),e=Xa(e,r),Ya(e,n)},MATRIX:function(t){let e=qa(t);const[n,r]=$a(e);return e=Xa(e,r),Ya(e,n)},CELL:Ga,FENCE:Ga,ROW:Ga,FRACTION:function(t){const[e,n,,r,o]=Array.from(t.childNodes),i=Ua(n),s=Ua(r),a=Ha(i),c=Ha(s);let l=Math.max(a,c);const u=e+new Array(l+1).join("\u2812")+o;return l=u.length,`${Qa(i,l)}\n${u}\n${Qa(s,l)}`},NUMERATOR:Ja,DENOMINATOR:Ja,REL:Za,OP:Za};function Ua(t){const e=lt(t),n=Fa[e];return n?n(t):t.textContent}const ka=new Map;function Ba(t,e){if(!t||!e)return t+e;const n=Va(t),r=Va(e),o=n-r;t=o<0?ja(t,r,Ha(t)):t,e=o>0?ja(e,n,Ha(e)):e;const i=t.split(/\r\n|\r|\n/),s=e.split(/\r\n|\r|\n/),a=[];for(let t=0;t<i.length;t++)a.push(i[t]+s[t]);return a.join("\n")}function Ga(t){let e="";for(const n of Array.from(t.childNodes))e=n.nodeType!==z.TEXT_NODE?Ba(e,Ua(n)):Ba(e,n.textContent);return e}function Va(t){return t.split(/\r\n|\r|\n/).length}function Ha(t){return t.split(/\r\n|\r|\n/).reduce((t,e)=>Math.max(e.length,t),0)}function ja(t,e,n){return t=function(t,e){const n=e-Va(t);return t+(n>0?new Array(n+1).join("\n"):"")}(t,e),function(t,e){const n=t.split(/\r\n|\r|\n/),r=[];for(const t of n){const n=e-t.length;r.push(t+(n>0?new Array(n+1).join("\u2800"):""))}return r.join("\n")}(t,n)}function qa(t){const e=Array.from(t.childNodes),n=[];for(const t of e)t.nodeType===z.ELEMENT_NODE&&n.push(za(t));return n}function $a(t){const e=t.reduce((t,e)=>Math.max(e.height,t),0),n=[];for(let e=0;e<t[0].width.length;e++)n.push(t.map(t=>t.width[e]).reduce((t,e)=>Math.max(t,e),0));return[e,n]}function Xa(t,e){const n=[];for(const r of t){if(0===r.height)continue;const t=[];for(let n=0;n<r.cells.length;n++)t.push(ja(r.cells[n],r.height,e[n]));r.cells=t,n.push(r)}return n}function Ya(t,e){if(1===e)return t.map(t=>t.lfence+t.cells.join(t.sep)+t.rfence).join("\n");const n=[];for(const e of t){const t=Wa(e.sep,e.height);let r=e.cells.shift();for(;e.cells.length;)r=Ba(r,t),r=Ba(r,e.cells.shift());r=Ba(Wa(e.lfence,e.height),r),r=Ba(r,Wa(e.rfence,e.height)),n.push(r),n.push(e.lfence+new Array(Ha(r)-3).join(e.sep)+e.rfence)}return n.slice(0,-1).join("\n")}function Wa(t,e){let n="";for(;e;)n+=t+"\n",e--;return n.slice(0,-1)}function Ka(t){return t.nodeType===z.ELEMENT_NODE&&"FENCE"===lt(t)?Ua(t):""}function za(t){const e=Array.from(t.childNodes),n=Ka(e[0]),r=Ka(e[e.length-1]);n&&e.shift(),r&&e.pop();let o="";const i=[];for(const t of e){if(t.nodeType===z.TEXT_NODE){o=t.textContent;continue}const e=Ua(t);i.push(e)}return{lfence:n,rfence:r,sep:o,cells:i,height:i.reduce((t,e)=>Math.max(Va(e),t),0),width:i.map(Ha)}}function Qa(t,e){const n=(e-Ha(t))/2,[r,o]=Math.floor(n)===n?[n,n]:[Math.floor(n),Math.ceil(n)],i=t.split(/\r\n|\r|\n/),s=[],[a,c]=[new Array(r+1).join("\u2800"),new Array(o+1).join("\u2800")];for(const t of i)s.push(a+t+c);return s.join("\n")}function Ja(t){const e=t.firstChild,n=Ga(t);if(e&&e.nodeType===z.ELEMENT_NODE){if("ENGLISH"===lt(e))return"\u2830"+n;if("NUMBER"===lt(e))return"\u283c"+n}return n}function Za(t){if(!B.getInstance().options.linebreaks)return Ga(t);const e=ka.get(parseInt(t.getAttribute("value")));return(e?`<br value="${e}"/>`:"")+Ga(t)}class tc extends wa{markup(t){const e=ba(t);let n="",r=null,o=!1;for(let t,i=0;t=e[i];i++)ya(t)||(Ca(t)?r=t:(r&&(n+=this.pause(r[A.PAUSE]),r=null),n+=(o?this.separator:"")+this.merge(t.span),o=!0));return n}pause(t){let e;return e="number"==typeof t?t<=250?"short":t<=500?"medium":"long":t,tc.PAUSE_PUNCTUATION.get(e)||""}}tc.PAUSE_PUNCTUATION=new Map([["short",","],["medium",";"],["long","."]]);class ec extends Pa{finalize(t){return`<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="${B.getInstance().options.locale}"><prosody rate="`+B.getInstance().getRate()+'%">'+this.separator+t+this.separator+"</prosody></speak>"}pause(t){return'<break time="'+this.pauseValue(t[A.PAUSE])+'ms"/>'}prosodyElement(t,e){const n=(e=Math.floor(this.applyScaleFunction(e)))<0?e.toString():"+"+e.toString();return"<prosody "+t.toLowerCase()+'="'+n+(t===A.VOLUME?">":'%">')}closeTag(t){return"</prosody>"}markup(t){return ec.MARKS={},super.markup(t)}merge(t){const e=[];let n="";for(let r=0;r<t.length;r++){const o=t[r];if(this.isEmptySpan(o))continue;const i=ec.MARK_KIND?o.attributes.kind:"",s=B.getInstance().options.automark?o.attributes.id:B.getInstance().options.mark?o.attributes.extid:"";!s||s===n||ec.MARK_ONCE&&ec.MARKS[s]||(e.push(i?`<mark name="${s}" kind="${i}"/>`:`<mark name="${s}"/>`),n=s,ec.MARKS[s]=!0),B.getInstance().options.character&&1===o.speech.length&&o.speech.match(/[a-zA-Z]/)?e.push('<say-as interpret-as="'+ec.CHARACTER_ATTR+'">'+o.speech+"</say-as>"):e.push(o.speech)}return e.join(this.separator)}isEmptySpan(t){const e=t.attributes.separator;return t.speech.match(/^\s*$/)&&(!e||e.match(/^\s*$/))}}ec.MARK_ONCE=!1,ec.MARK_KIND=!0,ec.CHARACTER_ATTR="character",ec.MARKS={};class nc extends wa{markup(t){let e="";const n=ba(t).filter(t=>t.span);if(!n.length)return e;const r=n.length-1;for(let t,o=0;t=n[o];o++){if(t.span&&(e+=this.merge(t.span)),o>=r)continue;const n=t.join;e+=void 0===n?this.separator:n}return e}}const rc=new ec,oc=new Map([[O.NONE,new nc],[O.COUNTING,new class extends nc{finalize(t){const e=super.finalize(t),n="braille"===B.getInstance().options.modality?"\u28ff\u2800\u28ff\u2800\u28ff\u2800\u28ff\u2800\u28ff\u2800":"0123456789";let r=new Array(Math.trunc(e.length/10)+1).join(n);return r+=n.slice(0,e.length%10),e+"\n"+r}}],[O.PUNCTUATION,new tc],[O.LAYOUT,new _a],[O.ACSS,new class extends Da{markup(t){this.setScaleFunction(-2,2,0,10,0);const e=ba(t),n=[],r={open:[]};let o=null,i=!1;for(let t,s=0;t=e[s];s++){if(ya(t)){Sa(r,t);continue}if(Ca(t)){i&&(o=Ea(o,t,Math.max));continue}const e='"'+this.merge(t.span)+'"';i=!0,o&&(n.push(this.pause(o)),o=null);const s=this.prosody_(r);n.push(s?"(text ("+s+") "+e+")":e)}return"(exp "+n.join(" ")+")"}error(t){return'(error "'+ma.get(t)+'")'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case A.RATE:return"(richness . "+e+")";case A.PITCH:return"(average-pitch . "+e+")";case A.VOLUME:return"(stress . "+e+")"}return"(value . "+e+")"}pause(t){return"(pause . "+this.pauseValue(t[A.PAUSE])+")"}prosody_(t){const e=t.open,n=[];for(let r,o=0;r=e[o];o++)n.push(this.prosodyElement(r,t[r]));return n.join(" ")}}],[O.SABLE,new class extends Pa{finalize(t){return'<?xml version="1.0"?><!DOCTYPE SABLE PUBLIC "-//SABLE//DTD SABLE speech mark up//EN" "Sable.v0_2.dtd" []><SABLE>'+this.separator+t+this.separator+"</SABLE>"}pause(t){return'<BREAK MSEC="'+this.pauseValue(t[A.PAUSE])+'"/>'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case A.PITCH:return'<PITCH RANGE="'+e+'%">';case A.RATE:return'<RATE SPEED="'+e+'%">';case A.VOLUME:return'<VOLUME LEVEL="'+e+'%">';default:return"<"+t.toUpperCase()+' VALUE="'+e+'">'}}closeTag(t){return"</"+t.toUpperCase()+">"}}],[O.VOICEXML,rc],[O.SSML,rc]]);function ic(t){const e=oc.get(B.getInstance().options.markup);return e?e.markup(t):""}function sc(t){const e=oc.get(B.getInstance().options.markup);return e?e.finalize(t):t}class ac{getSpeechMap(t){let e=this.speechMaps.get(t);return e||(e=new Map,this.speechMaps.set(t,e)),e}setMap(t,e,n){this.getSpeechMap(e).set(t,n.map(t=>t.clone()))}constructor(t){this.node=t,this.speechMaps=new Map,this.nodeMap=null}addNode(t,e,n="speech"){t.nodeType===z.ELEMENT_NODE&&t.hasAttribute("id")&&this.setMap(n,t.getAttribute("id"),e)}get(t){return this.speechMaps.get(t)}getNodeMap(){if(this.nodeMap)return this.nodeMap;this.nodeMap=new Map;for(const t of st(this.node,"id")){const e=t.getAttribute("id");if(!this.nodeMap.has(e)){this.nodeMap.set(t.getAttribute("id"),t);continue}const n=t.parentNode.tagName;"children"!==n&&"stree"!==n||this.nodeMap.set(e,t)}return this.nodeMap}completeModality(t,e){const n=B.getInstance().options.modality;B.getInstance().options.modality=t;for(const[n,r]of this.getNodeMap()){this.getSpeechMap(n).has(t)||e(r)}B.getInstance().options.modality=n}json(t=["none"]){const e={},n=B.getInstance().options.markup;for(const[n,r]of this.speechMaps){const o={};for(const i of t)B.getInstance().options.markup=i,r.forEach((t,e)=>o[`${e}-${i}`]=ic(t)),e[n]=o}return B.getInstance().options.markup=n,e}}class cc{static getInstance(){return cc.instance=cc.instance||new cc,cc.instance}static debugSpeechRule(t,e){const n=t.precondition,r=t.context.applyQuery(e,n.query);_.getInstance().output(n.query,r?r.toString():r),n.constraints.forEach(n=>_.getInstance().output(n,t.context.applyConstraint(e,n)))}static debugNamedSpeechRule(t,e){const n=cc.getInstance().trie.collectRules().filter(e=>e.name==t);for(let r,o=0;r=n[o];o++)_.getInstance().output("Rule",t,"DynamicCstr:",r.dynamicCstr.toString(),"number",o),cc.debugSpeechRule(r,e)}evaluateNode(t,e=!1){Y(t),this.speechStructure&&!e||(this.speechStructure=new ac(t));const n=(new Date).getTime();let r=[];try{r=this.evaluateNode_(t)}catch(t){console.error("Something went wrong computing speech."),_.getInstance().output(t)}const o=(new Date).getTime();return _.getInstance().output("Time:",o-n),r}toString(){return this.trie.collectRules().map(t=>t.toString()).join("\n")}runInSetting(t,e){var n,r;const o=B.getInstance(),i=o.options,s=new x;for(const e of x.BINARY_FEATURES)s[e]=null!==(n=t[e])&&void 0!==n?n:i[e];for(const e of x.STRING_FEATURES)s[e]=null!==(r=t[e])&&void 0!==r?r:i[e];o.options=s,o.setDynamicCstr();const a=e();return o.options=i,o.setDynamicCstr(),a}static addStore(t){const e=function(t){const e=`${t.locale}.${t.modality}.${t.domain}`;if("actions"===t.kind){const n=lc.get(e);return n.parse(t),n}ws(),t&&!t.functions&&(t.functions=function(t,e,n){return er.get([t,e,n].join("."))||er.get([M.DEFAULT_VALUES[C.LOCALE],e,n].join("."))||er.get([M.BASE_LOCALE,e,n].join("."))||{}}(t.locale,t.modality,t.domain));const n=function(t,e){if("braille"===e&&"euro"===t)return new ra;if("braille"===e)return new na;return new ea}(t.locale,t.modality);lc.set(e,n),t.inherits&&(n.inherits=lc.get(`${t.inherits}.${t.modality}.${t.domain}`));return n.parse(t),n.initialize(),n}(t);"abstract"!==e.kind&&e.getSpeechRules().forEach(t=>cc.getInstance().trie.addRule(t)),cc.getInstance().addEvaluator(e)}processGrammar(t,e,n){const r={};for(const[o,i]of Object.entries(n))r[o]="string"==typeof i?t.constructString(e,i):i;Gt.getInstance().pushState(r)}addEvaluator(t){const e=t.evaluateDefault.bind(t),n=this.evaluators_[t.locale];if(n)return void(n[t.modality]=e);const r={};r[t.modality]=e,this.evaluators_[t.locale]=r}getEvaluator(t,e){const n=this.evaluators_[t]||this.evaluators_[M.DEFAULT_VALUES[C.LOCALE]];return n[e]||n[M.DEFAULT_VALUES[C.MODALITY]]}enumerate(t){return this.trie.enumerate(t)}constructor(){this.trie=null,this.evaluators_={},this.speechStructure=null,this.trie=new fa}evaluateNode_(t){if(!t)return[];this.updateConstraint_();let e=this.evaluateTree_(t);return e=function(t){const e=new Zn(t);for(const t of e.annotations){const n=t.data;if("punctuation"===n.annotation){const r=e.prevText(t);if(!r)continue;const o=r.data;"punctuation"!==o.annotation&&"\u2800"!==o.text&&1===n.text.length&&-1!==uc.indexOf(n.text)&&(n.text="\u2838"+n.text)}}return e.toList()}(e),e}evaluateTree_(t){const e=this.evaluateTreeInternal_(t);return this.speechStructure.addNode(t,e,B.getInstance().options.modality),e}evaluateTreeInternal_(t){const e=B.getInstance();let n;_.getInstance().generate(()=>[t.toString()]),Gt.getInstance().setAttribute(t);const r=this.lookupRule(t,e.dynamicCstr);if(!r)return e.options.strict?[]:(n=this.getEvaluator(e.options.locale,e.options.modality)(t),t.attributes&&this.addPersonality_(n,{},!1,t),n);_.getInstance().generate(()=>["Apply Rule:",r.name,r.dynamicCstr.toString(),e.mode===I.HTTP?ht(t):t.toString()]),Gt.getInstance().processSingles();const o=r.context,i=r.action.components;n=[];for(let e,r=0;e=i[r];r++){let r=[];const i=e.content||"",s=e.attributes||{};let a=!1;e.grammar&&this.processGrammar(o,t,e.grammar);let c=null;if(s.engine){c=B.getInstance().dynamicCstr.getComponents();const t=Object.assign({},c,Gt.parseInput(s.engine));B.getInstance().setDynamicCstr(t),this.updateConstraint_()}switch(e.type){case Bs.NODE:{const e=o.applyQuery(t,i);e&&(r=this.evaluateTree_(e))}break;case Bs.MULTI:{a=!0;const e=o.applySelector(t,i);e.length>0&&(r=this.evaluateNodeList_(o,e,s.sepFunc,o.constructString(t,s.separator),s.ctxtFunc,o.constructString(t,s.context)))}break;case Bs.TEXT:{const e=s.span;let n={};if(e){const r=X(e,t);n=r.length?Qn.getAttributes(r[0]):{kind:e}}r=o.constructSpan(t,i,n).map(function(t){return tr.create({text:t.speech,attributes:t.attributes},{adjust:!0})})}break;case Bs.PERSONALITY:default:r=[tr.create({text:i})]}r[0]&&!a&&(s.context&&(r[0].context=o.constructString(t,s.context)+(r[0].context||"")),s.annotation&&(r[0].annotation=s.annotation)),this.addLayout(r,s,a),e.grammar&&Gt.getInstance().popState(),n=n.concat(this.addPersonality_(r,s,a,t)),c&&(B.getInstance().setDynamicCstr(c),this.updateConstraint_())}return Gt.getInstance().popState(),n}evaluateNodeList_(t,e,n,r,o,i){if(!e.length)return[];const s=r||"",a=i||"",c=t.contextFunctions.lookup(o),l=c?c(e,a):function(){return a},u=t.contextFunctions.lookup(n),h=u?u(e,s):function(){return[tr.create({text:s},{translate:!0})]};let d=[];for(let t,n=0;t=e[n];n++){const r=this.evaluateTree_(t);if(r.length>0&&(r[0].context=l()+(r[0].context||""),d=d.concat(r)),n<e.length-1){const t=h();d=d.concat(t)}}return d}addLayout(t,e,n){const r=e.layout;r&&(r.match(/^begin/)?t.unshift(new tr({text:"",layout:r})):r.match(/^end/)?t.push(new tr({text:"",layout:r})):(t.unshift(new tr({text:"",layout:`begin${r}`})),t.push(new tr({text:"",layout:`end${r}`}))))}addPersonality_(t,e,n,r){const o={};let i=null;for(const t of b){const n=e[t];if(void 0===n)continue;const r=parseFloat(n),s=isNaN(r)?'"'===n.charAt(0)?n.slice(1,-1):n:r;t===A.PAUSE?i=s:o[t]=s}for(let e,n=0;e=t[n];n++)this.addRelativePersonality_(e,o),this.addExternalAttributes_(e,r);if(n&&t.length&&delete t[t.length-1].personality[A.JOIN],i&&t.length){const e=t[t.length-1];e.text||Object.keys(e.personality).length?t.push(tr.create({text:"",personality:{pause:i}})):e.personality[A.PAUSE]=i}return t}addExternalAttributes_(t,e){var n;if(void 0===t.attributes.id&&(t.attributes.id=e.getAttribute("id")),null===(n=e.attributes)||void 0===n?void 0:n.length){const n=e.attributes;for(let e=n.length-1;e>=0;e--){const r=n[e].name;!t.attributes[r]&&r.match(/^ext/)&&(t.attributes[r]=n[e].value)}}}addRelativePersonality_(t,e){if(!t.personality)return t.personality=e,t;const n=t.personality;for(const[t,r]of Object.entries(e))n[t]&&"number"==typeof n[t]&&"number"==typeof r?n[t]=(n[t]+r).toString():n[t]||(n[t]=r);return t}updateConstraint_(){const t=B.getInstance().dynamicCstr,e=this.trie,n={};let r=t.getValue(C.LOCALE),o=t.getValue(C.MODALITY),i=t.getValue(C.DOMAIN);e.hasSubtrie([r,o,i])||(i=M.DEFAULT_VALUES[C.DOMAIN],e.hasSubtrie([r,o,i])||(o=M.DEFAULT_VALUES[C.MODALITY],e.hasSubtrie([r,o,i])||(r=M.DEFAULT_VALUES[C.LOCALE]))),n[C.LOCALE]=[r],n[C.MODALITY]=["summary"!==o?o:M.DEFAULT_VALUES[C.MODALITY]],n[C.DOMAIN]=["speech"!==o?M.DEFAULT_VALUES[C.DOMAIN]:i];const s=t.getOrder();for(let e,r=0;e=s[r];r++)if(!n[e]){const r=t.getValue(e),o=this.makeSet_(r,t.preference),i=M.DEFAULT_VALUES[e];r!==i&&o.push(i),n[e]=o}t.updateProperties(n)}makeSet_(t,e){return e&&Object.keys(e).length?t.split(":"):[t]}lookupRule(t,e){if(!t||t.nodeType!==z.ELEMENT_NODE&&t.nodeType!==z.TEXT_NODE)return null;const n=this.lookupRules(t,e);return n.length>0?this.pickMostConstraint_(e,n):null}lookupRules(t,e){return this.trie.lookupRules(t,e.allProperties())}pickMostConstraint_(t,e){const n=B.getInstance().comparator;return e.sort(function(t,e){return n.compare(t.dynamicCstr,e.dynamicCstr)||e.precondition.priority-t.precondition.priority||e.precondition.constraints.length-t.precondition.constraints.length||e.precondition.rank-t.precondition.rank}),_.getInstance().generate((()=>["Applicable Rules:",...e.map(t=>t.name+"("+t.dynamicCstr.toString()+")")]).bind(this)),e[0]}}const lc=new Map;B.nodeEvaluator=cc.getInstance().evaluateNode.bind(cc.getInstance());const uc=["\u2806","\u2812","\u2832","\u2826","\u2834","\u2804"];const hc={small:["default"],capital:["default"],digit:["default"]};function dc(t){const e=B.getInstance().options.locale;B.getInstance().options.locale=t,En(),Un({locale:t}),function(){const t=Pt.ALPHABETS,e=(t,e)=>{const n={};return Object.keys(t).forEach(t=>n[t]=!0),Object.keys(e).forEach(t=>n[t]=!0),Object.keys(n)};hc.small=e(t.smallPrefix,t.letterTrans),hc.capital=e(t.capPrefix,t.letterTrans),hc.digit=e(t.digitPrefix,t.digitTrans)}();for(const t of gt.values()){const e=t.unicode;if("offset"in t)mc(e,t.font,t.offset||0);else{pc(e,Pt.ALPHABETS[t.base],t.font,!!t.capital)}}B.getInstance().options.locale=e,En()}function fc(t){return function(t){return"string"==typeof t?{font:t,combiner:Pt.ALPHABETS.combiner}:{font:t[0],combiner:Pt.COMBINERS[t[1]]||Mt[t[1]]||Pt.ALPHABETS.combiner}}("normal"===t||"fullwidth"===t?"":Pt.MESSAGES.font[t]||Pt.MESSAGES.embellish[t]||"")}function pc(t,e,n,r){const o=fc(n);for(let n,i,s=0;n=t[s],i=e[s];s++){const t=r?Pt.ALPHABETS.capPrefix:Pt.ALPHABETS.smallPrefix,e=r?hc.capital:hc.small;gc(o.combiner,n,i,o.font,t,Pt.ALPHABETS.letterTrans,e)}}function mc(t,e,n){const r=fc(e);for(let e,o=0;e=t[o];o++){const t=Pt.ALPHABETS.digitPrefix,i=o+n;gc(r.combiner,e,i,r.font,t,Pt.ALPHABETS.digitTrans,hc.digit)}}function gc(t,e,n,r,o,i,s){for(let a,c=0;a=s[c];c++){const s=a in i?i[a]:i.default,c=a in o?o[a]:o.default;$n(a,"default",e,t(s(n),r,c))}}var Ec=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const Nc={functions:function(t){for(const e of t)Un(e)||(Dn(e.key,e.names||[]),"base"!==xn?(jn(e),Yn(e)):Vn.set(e.key,e))},symbols:function(t){for(const e of t){if(Un(e))continue;const t=_n.parseUnicode(e.key);"base"!==xn?qn(t,t,e.mappings):Vn.set(t,e)}},units:function(t){for(const e of t)Un(e)||(e.key+=":unit","base"!==xn?(jn(e),e.names&&(e.names=e.names.map(function(t){return t+":unit"})),e.si&&Wn(e),Yn(e)):Vn.set(e.key,e))},si:t=>t.forEach(Bn),messages:function(t){const e=gn[t.locale];if(!e)return void console.error("Locale "+t.locale+" does not exist!");const n=t.kind.toUpperCase(),r=t.messages;if(!r)return;const o=e();for(const[t,e]of Object.entries(r))o[n][t]=e},rules:cc.addStore,characters:t=>t.forEach(Xn)};let Sc=!1;function Tc(){return Ec(this,arguments,void 0,function*(t=B.getInstance().options.locale){return Sc||(!function(){for(const t of gt.values()){const e=t.unicode;for(const n of e)Vn.set(n,{key:n,category:t.category})}}(),Ic(M.BASE_LOCALE),Sc=!0),G.promises[M.BASE_LOCALE].then(()=>Ec(this,void 0,void 0,function*(){const e=B.getInstance().defaultLocale;return e?(Ic(e),G.promises[e].then(()=>Ec(this,void 0,void 0,function*(){return Ic(t),G.promises[t]}))):(Ic(t),G.promises[t])}))})}function Ic(t=B.getInstance().options.locale){G.loaded[t]||(G.loaded[t]=[!1,!1],xn=M.DEFAULT_VALUES[C.LOCALE],Fn=M.DEFAULT_VALUES[C.MODALITY],function(t){const e=function(){if(B.getInstance().customLoader)return B.getInstance().customLoader;return Ac()}(),n=new Promise(n=>{e(t).then(e=>{var r;(function(t,e){let n=!0;for(let r,o=0;r=Object.keys(t)[o];o++){const o=r.split("/");e&&e!==o[0]||(n&&"symbols"===o[1]&&"base"!==o[0]&&(dc(o[0]),n=!1),Nc[o[1]](t[r]))}})("string"==typeof(r=e)?JSON.parse(r):r),G.loaded[t]=[!0,!0],n(t)},e=>{G.loaded[t]=[!0,!1],console.error(`Unable to load locale: ${t}`),B.getInstance().options.locale=B.getInstance().defaultLocale,n(t)})});G.promises[t]=n}(t))}function Ac(){switch(B.getInstance().mode){case I.ASYNC:return bc;case I.HTTP:return Oc;case I.SYNC:default:return Rc}}function bc(t){const e=P(t);return new Promise((t,n)=>{T.fs.readFile(e,"utf8",(e,r)=>{if(e)return n(e);t(r)})})}function Rc(t){const e=P(t);return new Promise((t,n)=>{let r="{}";try{r=T.fs.readFileSync(e,"utf8")}catch(t){return n(t)}t(r)})}function Oc(t){const e=P(t),n=new XMLHttpRequest;return new Promise((t,r)=>{n.onreadystatechange=function(){if(4===n.readyState){const e=n.status;0===e||e>=200&&e<400?t(n.responseText):r(e)}},n.open("GET",e,!0),n.send()})}var yc=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};function Cc(t){return yc(this,void 0,void 0,function*(){t.debug&&_.getInstance().init();const e=B.getInstance();return e.setup(t),En(),e.setDynamicCstr(),e.init?(G.promises.init=new Promise((t,e)=>{setTimeout(()=>{t("init")},10)}),e.init=!1,G.get()):e.options.delay?(e.options.delay=!1,G.get()):Tc()})}var Lc=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};function Mc(t){return Lc(this,void 0,void 0,function*(){return Cc(t)})}function vc(){return function(){const t=B.getInstance().json();return t.json=T.jsonPath,t}()}function wc(){B.getInstance().reset()}function Dc(){return Lc(this,void 0,void 0,function*(){return Mc({}).then(()=>G.getall())})}const Pc=Ac;function _c(t){const e=t||0;G.getall().then(()=>process.exit(e))}class xc{constructor(t){this.type=t,this.factory_=new Qr}getFactory(){return this.factory_}setFactory(t){this.factory_=t}getType(){return this.type}parseList(t){const e=[];for(let n,r=0;n=t[r];r++)e.push(this.parse(n));return e}}class Fc extends xc{static getAttribute_(t,e,n){if(!t.hasAttribute(e))return n;const r=t.getAttribute(e);return r.match(/^\s*$/)?null:r}constructor(t){super("MathML"),this.options=t,br.options=t,this.parseMap_=new Map([[Dr.SEMANTICS,this.semantics_.bind(this)],[Dr.MATH,this.rows_.bind(this)],[Dr.MROW,this.rows_.bind(this)],[Dr.MPADDED,this.rows_.bind(this)],[Dr.MSTYLE,this.rows_.bind(this)],[Dr.MFRAC,this.fraction_.bind(this)],[Dr.MSUB,this.limits_.bind(this)],[Dr.MSUP,this.limits_.bind(this)],[Dr.MSUBSUP,this.limits_.bind(this)],[Dr.MOVER,this.limits_.bind(this)],[Dr.MUNDER,this.limits_.bind(this)],[Dr.MUNDEROVER,this.limits_.bind(this)],[Dr.MROOT,this.root_.bind(this)],[Dr.MSQRT,this.sqrt_.bind(this)],[Dr.MTABLE,this.table_.bind(this)],[Dr.MLABELEDTR,this.tableLabeledRow_.bind(this)],[Dr.MTR,this.tableRow_.bind(this)],[Dr.MTD,this.tableCell_.bind(this)],[Dr.MS,this.text_.bind(this)],[Dr.MTEXT,this.text_.bind(this)],[Dr.MSPACE,this.space_.bind(this)],[Dr.ANNOTATIONXML,this.text_.bind(this)],[Dr.MI,this.identifier_.bind(this)],[Dr.MN,this.number_.bind(this)],[Dr.MO,this.operator_.bind(this)],[Dr.MFENCED,this.fenced_.bind(this)],[Dr.MENCLOSE,this.enclosed_.bind(this)],[Dr.MMULTISCRIPTS,this.multiscripts_.bind(this)],[Dr.ANNOTATION,this.empty_.bind(this)],[Dr.NONE,this.empty_.bind(this)],[Dr.MACTION,this.action_.bind(this)],[Dr.MPHANTOM,this.phantom_.bind(this)]]);const e={type:St.IDENTIFIER,role:It.NUMBERSET,font:bt.DOUBLESTRUCK};["C","H","N","P","Q","R","Z","\u2102","\u210d","\u2115","\u2119","\u211a","\u211d","\u2124"].forEach((t=>this.getFactory().defaultMap.set(t,e)).bind(this))}parse(t){Uo.getInstance().setNodeFactory(this.getFactory());const e=W(t.childNodes),n=lt(t),r=this.parseMap_.get(n),o=(r||this.dummy_.bind(this))(t,e);return o.noupdate?o:(qr(o,t),-1!==[Dr.MATH,Dr.MROW,Dr.MPADDED,Dr.MSTYLE,Dr.SEMANTICS,Dr.MACTION].indexOf(n)||(o.mathml.unshift(t),o.mathmlTree=t),o)}semantics_(t,e){return e.length?this.parse(e[0]):this.getFactory().makeEmptyNode()}rows_(t,e){const n=t.getAttribute("semantics");if(n&&n.match("bspr_"))return Uo.proof(t,n,this.parseList.bind(this));let r;if(1===(e=jr(e)).length)r=this.parse(e[0]),r.type!==St.EMPTY||r.mathmlTree||(r.mathmlTree=t);else{const n=br.run("function_from_identifiers",t);r=n&&n!==t?n:Uo.getInstance().row(this.parseList(e))}return r.mathml.unshift(t),r}fraction_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const n=this.parse(e[0]),r=e[1]?this.parse(e[1]):this.getFactory().makeEmptyNode();return Uo.getInstance().fractionLikeNode(n,r,t.getAttribute("linethickness"),"true"===t.getAttribute("bevelled"))}limits_(t,e){return Uo.getInstance().limitNode(lt(t),this.parseList(e))}root_(t,e){return e[1]?this.getFactory().makeBranchNode(St.ROOT,[this.parse(e[1]),this.parse(e[0])],[]):this.sqrt_(t,e)}sqrt_(t,e){const n=this.parseList(jr(e));return this.getFactory().makeBranchNode(St.SQRT,[Uo.getInstance().row(n)],[])}table_(t,e){const n=t.getAttribute("semantics");if(n&&n.match("bspr_"))return Uo.proof(t,n,this.parseList.bind(this));const r=this.getFactory().makeBranchNode(St.TABLE,this.parseList(e),[]);return r.mathmlTree=t,Uo.tableToMultiline(r)}tableRow_(t,e){const n=this.getFactory().makeBranchNode(St.ROW,this.parseList(e),[]);return n.role=It.TABLE,n}tableLabeledRow_(t,e){var n;if(!e.length)return this.tableRow_(t,e);const r=this.parse(e[0]);r.role=It.LABEL,(null===(n=r.childNodes[0])||void 0===n?void 0:n.type)===St.TEXT&&(r.childNodes[0].role=It.LABEL);const o=this.getFactory().makeBranchNode(St.ROW,this.parseList(e.slice(1)),[r]);return o.role=It.TABLE,o}tableCell_(t,e){const n=this.parseList(jr(e));let r;r=n.length?1===n.length&&Jr(n[0],St.EMPTY)?n:[Uo.getInstance().row(n)]:[];const o=this.getFactory().makeBranchNode(St.CELL,r,[]);return o.role=It.TABLE,o}phantom_(t,e){let n;return e.length?(n=this.getFactory().makeUnprocessed(t),n.type=St.TEXT,n.role=It.SPACE):n=this.empty_(t,e),n}space_(t,e){const n=t.getAttribute("width"),r=n&&n.match(/[a-z]*$/);if(!r)return this.empty_(t,e);const o=r[0],i=parseFloat(n.slice(0,r.index)),s={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[o];if(!s||isNaN(i)||i<s)return this.empty_(t,e);const a=this.getFactory().makeUnprocessed(t);return Uo.getInstance().text(a,lt(t))}text_(t,e){const n=this.leaf_(t,e);return t.textContent?(n.updateContent(t.textContent,!0),Uo.getInstance().text(n,lt(t))):n}identifier_(t,e){const n=this.leaf_(t,e);return Uo.getInstance().identifierNode(n,Uo.getInstance().font(t.getAttribute("mathvariant")),t.getAttribute("class"))}number_(t,e){const n=this.leaf_(t,e);return Uo.number(n),n}operator_(t,e){const n=this.leaf_(t,e);return Uo.getInstance().operatorNode(n),n}fenced_(t,e){const n=this.parseList(e);n.forEach(t=>{Jr(t,St.EMPTY)&&t.addAnnotation("empty","MFENCED")});const r=Fc.getAttribute_(t,"separators",","),o=Fc.getAttribute_(t,"open","("),i=Fc.getAttribute_(t,"close",")"),s=Uo.getInstance().mfenced(o,i,r,n);s.mathmlTree=t,s.addMathmlNodes([t]);return Uo.getInstance().tablesInRow([s])[0]}enclosed_(t,e){const n=this.parseList(jr(e)),r=this.getFactory().makeBranchNode(St.ENCLOSE,[Uo.getInstance().row(n)],[]);return r.role=t.getAttribute("notation")||It.UNKNOWN,r}multiscripts_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const n=this.parse(e.shift());if(!e.length)return n;const r=[],o=[],i=[],s=[];let a=!1,c=0;for(let t,n=0;t=e[n];n++)lt(t)!==Dr.MPRESCRIPTS?(a?1&c?r.push(t):o.push(t):1&c?i.push(t):s.push(t),c++):(a=!0,c=0);return jr(r).length||jr(o).length?Uo.getInstance().tensor(n,this.parseList(o),this.parseList(r),this.parseList(s),this.parseList(i)):Uo.getInstance().pseudoTensor(n,this.parseList(s),this.parseList(i))}empty_(t,e){const n=this.getFactory().makeEmptyNode();return n.addMathmlNodes([t]),n.mathmlTree=t,n}action_(t,e){const n=e[t.hasAttribute("selection")?parseInt(t.getAttribute("selection"),10)-1:0],r=this.parse(n);return r.mathmlTree=n,r}dummy_(t,e){const n=this.getFactory().makeUnprocessed(t);return n.role=t.tagName,n.textContent=t.textContent,n}leaf_(t,e){if(1===e.length&&e[0].nodeType!==z.TEXT_NODE){const n=this.getFactory().makeUnprocessed(t);return n.role=e[0].tagName,qr(n,e[0]),n}const n=this.getFactory().makeLeafNode(t.textContent,Uo.getInstance().font(t.getAttribute("mathvariant")));return t.hasAttribute("data-latex")&&An.LatexCommands.set(t.getAttribute("data-latex"),t.textContent),n}}class Uc{constructor(t,e,n=t=>!1){this.name=t,this.apply=e,this.applicable=n}}class kc extends Uc{}class Bc extends Uc{}const Gc="data-semantic-";var Vc;!function(t){t.ADDED="data-semantic-added",t.ALTERNATIVE="data-semantic-alternative",t.CHILDREN="data-semantic-children",t.COLLAPSED="data-semantic-collapsed",t.CONTENT="data-semantic-content",t.EMBELLISHED="data-semantic-embellished",t.FENCEPOINTER="data-semantic-fencepointer",t.FONT="data-semantic-font",t.ID="data-semantic-id",t.ANNOTATION="data-semantic-annotation",t.ATTRIBUTES="data-semantic-attributes",t.OPERATOR="data-semantic-operator",t.OWNS="data-semantic-owns",t.PARENT="data-semantic-parent",t.POSTFIX="data-semantic-postfix",t.PREFIX="data-semantic-prefix",t.ROLE="data-semantic-role",t.SPEECH="data-semantic-speech",t.STRUCTURE="data-semantic-structure",t.SUMMARY="data-semantic-summary",t.TYPE="data-semantic-type"}(Vc||(Vc={}));const Hc=[Vc.ADDED,Vc.ALTERNATIVE,Vc.CHILDREN,Vc.COLLAPSED,Vc.CONTENT,Vc.EMBELLISHED,Vc.FENCEPOINTER,Vc.FONT,Vc.ID,Vc.ANNOTATION,Vc.ATTRIBUTES,Vc.OPERATOR,Vc.OWNS,Vc.PARENT,Vc.POSTFIX,Vc.PREFIX,Vc.ROLE,Vc.SPEECH,Vc.STRUCTURE,Vc.SUMMARY,Vc.TYPE];function jc(t){return t.map(function(t){return t.id}).join(",")}function qc(t,e){t.setAttribute(Vc.TYPE,e.type);const n=e.allAttributes();for(let e,r=0;e=n[r];r++)t.setAttribute(Gc+e[0].toLowerCase(),e[1]);e.childNodes.length&&t.setAttribute(Vc.CHILDREN,jc(e.childNodes)),e.contentNodes.length&&t.setAttribute(Vc.CONTENT,jc(e.contentNodes)),e.parent&&t.setAttribute(Vc.PARENT,e.parent.id.toString());const r=e.attributesXml();r&&t.setAttribute(Vc.ATTRIBUTES,r),function(t,e){const n=[];e.role===It.MGLYPH&&n.push("image");e.attributes.href&&n.push("link");n.length&&t.setAttribute(Vc.POSTFIX,n.join(" "))}(t,e)}function $c(t){return Gc+t}function Xc(){const t=et("mrow");return t.setAttribute(Vc.ADDED,"true"),t}class Yc{static fromTree(t){return Yc.fromNode(t.root)}static fromNode(t){return new Yc(Yc.fromNode_(t))}static fromString(t){return new Yc(Yc.fromString_(t))}static simpleCollapseStructure(t){return"number"==typeof t}static contentCollapseStructure(t){return!!t&&!Yc.simpleCollapseStructure(t)&&"c"===t[0]}static interleaveIds(t,e){return Ir(Yc.collapsedLeafs(t),Yc.collapsedLeafs(e))}static collapsedLeafs(...t){return t.reduce((t,e)=>{return t.concat((n=e,Yc.simpleCollapseStructure(n)?[n]:Yc.contentCollapseStructure(n[1])?n.slice(2):n.slice(1)));var n},[])}static fromStructure(t,e,n){return new Yc(Yc.tree_(t,e.root,n))}static combineContentChildren(t,e,n,r){switch(t){case St.RELSEQ:case St.INFIXOP:case St.MULTIREL:return Ir(r,n);case St.PREFIXOP:return n.concat(r);case St.POSTFIXOP:return r.concat(n);case St.MATRIX:case St.VECTOR:case St.FENCED:return r.unshift(n[0]),r.push(n[1]),r;case St.CASES:return r.unshift(n[0]),r;case St.APPL:return[r[0],n[0],r[1]];case St.ROOT:return[r[0],r[1]];case St.ROW:case St.LINE:return n.length&&r.push(n[0]),r;default:return r}}static makeSexp_(t){return Yc.simpleCollapseStructure(t)?t.toString():Yc.contentCollapseStructure(t)?"(c "+t.slice(1).map(Yc.makeSexp_).join(" ")+")":"("+t.map(Yc.makeSexp_).join(" ")+")"}static fromString_(t){let e=t.replace(/\(/g,"[");return e=e.replace(/\)/g,"]"),e=e.replace(/ /g,","),e=e.replace(/c/g,'"c"'),JSON.parse(e)}static fromNode_(t){if(!t)return[];const e=t.contentNodes;let n;e.length&&(n=e.map(Yc.fromNode_),n.unshift("c"));const r=t.childNodes;if(!r.length)return e.length?[t.id,n]:t.id;const o=r.map(Yc.fromNode_);return e.length&&o.unshift(n),o.unshift(t.id),o}static tree_(t,e,n,r=0,o=1,i=1){if(!e)return[];const s=e.id,a=[s];Y(t);const c=X(`.//self::*[@${Vc.ID}=${s}]`,t)[0];if(!e.childNodes.length)return Yc.addAria(c,r,o,i,n),e.id;const l=Yc.combineContentChildren(e.type,e.role,e.contentNodes.map(function(t){return t}),e.childNodes.map(function(t){return t}));c&&Yc.addOwns_(c,l);for(let e,o=0,i=l.length;e=l[o];o++)a.push(Yc.tree_(t,e,n,r+1,o+1,i));return Yc.addAria(c,r,o,i,n),a}static addAria(t,e,n,r,o){const i=o.tree?e?"treeitem":"tree":"treeitem";o.aria&&t&&(t.setAttribute("aria-level",e.toString()),t.setAttribute("aria-posinset",n.toString()),t.setAttribute("aria-setsize",r.toString()),t.setAttribute("role",i),t.hasAttribute(Vc.OWNS)&&t.setAttribute("aria-owns",t.getAttribute(Vc.OWNS)))}static addOwns_(t,e){const n=t.getAttribute(Vc.COLLAPSED),r=n?Yc.realLeafs_(Yc.fromString(n).array):e.map(t=>t.id);t.setAttribute(Vc.OWNS,r.join(" "))}static realLeafs_(t){if(Yc.simpleCollapseStructure(t))return[t];if(Yc.contentCollapseStructure(t))return[];let e=[];for(let n=1;n<t.length;n++)e=e.concat(Yc.realLeafs_(t[n]));return e}constructor(t){this.parents=null,this.levelsMap=null,t=0===t?t:t||[],this.array=t}populate(){this.parents&&this.levelsMap||(this.parents={},this.levelsMap={},this.populate_(this.array,this.array,[]))}toString(){return Yc.makeSexp_(this.array)}populate_(t,e,n){if(Yc.simpleCollapseStructure(t))return this.levelsMap[t]=e,void(this.parents[t]=t===n[0]?n.slice(1):n);const r=Yc.contentCollapseStructure(t)?t.slice(1):t,o=[r[0]].concat(n);for(let e=0,n=r.length;e<n;e++){const n=r[e];this.populate_(n,t,o)}}isRoot(t){return t===this.levelsMap[t][0]}directChildren(t){if(!this.isRoot(t))return[];return this.levelsMap[t].slice(1).map(t=>Yc.simpleCollapseStructure(t)?t:Yc.contentCollapseStructure(t)?t[1]:t[0])}subtreeNodes(t){if(!this.isRoot(t))return[];const e=(t,n)=>{Yc.simpleCollapseStructure(t)?n.push(t):(Yc.contentCollapseStructure(t)&&(t=t.slice(1)),t.forEach(t=>e(t,n)))},n=this.levelsMap[t],r=[];return e(n.slice(1),r),r}}function Wc(t,e,n){let r=null;if(!t.length)return r;const o=n[n.length-1],i=o&&o.length,s=e&&e.length,a=Uo.getInstance();if(i&&s){if(e[0].type===St.INFIXOP&&e[0].role===It.IMPLICIT)return r=t.pop(),o.push(a.postfixNode_(o.pop(),t)),r;r=t.shift();const n=a.prefixNode_(e.shift(),t);return e.unshift(n),r}return i?(o.push(a.postfixNode_(o.pop(),t)),r):(s&&e.unshift(a.prefixNode_(e.shift(),t)),r)}function Kc(t,e,n){if(!e.length)return t;const r=t.pop(),o=e.shift(),i=n.shift();if(o.type===St.INFIXOP&&(o.role===It.IMPLICIT||o.role===It.UNIT)){_.getInstance().output("Juxta Heuristic Case 2");const s=(r?[r,o]:[o]).concat(i);return Kc(t.concat(s),e,n)}if(!r)return _.getInstance().output("Juxta Heuristic Case 3"),Kc([o].concat(i),e,n);const s=i.shift();if(!s){_.getInstance().output("Juxta Heuristic Case 9");const i=br.factory.makeBranchNode(St.INFIXOP,[r,e.shift()],[o],o.textContent);return i.role=It.IMPLICIT,br.run("combine_juxtaposition",i),e.unshift(i),Kc(t,e,n)}if(co(r)||co(s))return _.getInstance().output("Juxta Heuristic Case 4"),Kc(t.concat([r,o,s]).concat(i),e,n);let a=null;return wo(r)&&wo(s)?(_.getInstance().output("Juxta Heuristic Case 5"),r.contentNodes.push(o),r.contentNodes=r.contentNodes.concat(s.contentNodes),r.childNodes.push(s),r.childNodes=r.childNodes.concat(s.childNodes),s.childNodes.forEach(t=>t.parent=r),o.parent=r,r.addMathmlNodes(o.mathml),r.addMathmlNodes(s.mathml),a=r):wo(r)?(_.getInstance().output("Juxta Heuristic Case 6"),r.contentNodes.push(o),r.childNodes.push(s),s.parent=r,o.parent=r,r.addMathmlNodes(o.mathml),r.addMathmlNodes(s.mathml),a=r):wo(s)?(_.getInstance().output("Juxta Heuristic Case 7"),s.contentNodes.unshift(o),s.childNodes.unshift(r),r.parent=s,o.parent=s,s.addMathmlNodes(o.mathml),s.addMathmlNodes(r.mathml),a=s):(_.getInstance().output("Juxta Heuristic Case 8"),a=br.factory.makeBranchNode(St.INFIXOP,[r,s],[o],o.textContent),a.role=It.IMPLICIT),t.push(a),Kc(t.concat(i),e,n)}function zc(t){return t.childNodes[0]&&t.childNodes[0].childNodes[0]&&lt(t.childNodes[0])===Dr.MPADDED&&lt(t.childNodes[0].childNodes[0])===Dr.MPADDED&&lt(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1])===Dr.MPHANTOM}br.add(new kc("combine_juxtaposition",function(t){for(let e,n=t.childNodes.length-1;e=t.childNodes[n];n--)wo(e)&&!e.nobreaking&&(t.childNodes.splice(n,1,...e.childNodes),t.contentNodes.splice(n,0,...e.contentNodes),e.childNodes.concat(e.contentNodes).forEach(function(e){e.parent=t}),t.addMathmlNodes(e.mathml));return t})),br.add(new kc("propagateSimpleFunction",t=>(t.type!==St.INFIXOP&&t.type!==St.FRACTION||!t.childNodes.every(bo)||(t.role=It.COMPFUNC),t),t=>"clearspeak"===br.options.domain)),br.add(new kc("simpleNamedFunction",t=>(t.role!==It.UNIT&&-1!==["f","g","h","F","G","H"].indexOf(t.textContent)&&(t.role=It.SIMPLEFUNC),t),t=>"clearspeak"===br.options.domain)),br.add(new kc("propagateComposedFunction",t=>(t.type===St.FENCED&&t.childNodes[0].role===It.COMPFUNC&&(t.role=It.COMPFUNC),t),t=>"clearspeak"===br.options.domain)),br.add(new kc("multioperator",t=>{t.role!==It.UNKNOWN||t.textContent.length<=1||(Uo.compSemantics(t,"role",It),Uo.compSemantics(t,"type",St))})),br.add(new Bc("convert_juxtaposition",t=>{let e=Yr(t,function(t){return t.textContent===Sn.invisibleTimes&&t.type===St.OPERATOR});e=e.rel.length?function(t){const e=[],n=[];let r=t.comp.shift(),o=null,i=[];for(;t.comp.length;)if(i=[],r.length)o&&e.push(o),n.push(r),o=t.rel.shift(),r=t.comp.shift();else{for(o&&i.push(o);!r.length&&t.comp.length;)r=t.comp.shift(),i.push(t.rel.shift());o=Wc(i,r,n)}i.length||r.length?(e.push(o),n.push(r)):(i.push(o),Wc(i,r,n));return{rel:e,comp:n}}(e):e,t=e.comp[0];for(let n,r,o=1;n=e.comp[o],r=e.rel[o-1];o++)t.push(r),t=t.concat(n);return e=Yr(t,function(t){return t.textContent===Sn.invisibleTimes&&(t.type===St.OPERATOR||t.type===St.INFIXOP)}),e.rel.length?Kc(e.comp.shift(),e.rel,e.comp):t})),br.add(new kc("simple2prefix",t=>(t.textContent.length>1&&!t.textContent[0].match(/[A-Z]/)&&(t.role=It.PREFIXFUNC),t),t=>"braille"===br.options.modality&&t.type===St.IDENTIFIER)),br.add(new kc("detect_cycle",t=>{t.type=St.MATRIX,t.role=It.CYCLE;const e=t.childNodes[0];return e.type=St.ROW,e.role=It.CYCLE,e.textContent="",e.contentNodes=[],t},t=>t.type===St.FENCED&&t.childNodes[0].type===St.INFIXOP&&t.childNodes[0].role===It.IMPLICIT&&t.childNodes[0].childNodes.every(function(t){return t.type===St.NUMBER})&&t.childNodes[0].contentNodes.every(function(t){return t.role===It.SPACE}))),br.add(new Bc("intvar_from_implicit",function(t){const e=t[0].childNodes;t.splice(0,1,...e),t.forEach(t=>t.parent=null)},t=>t[0]&&vo(t[0]))),br.add(new kc("intvar_from_fraction",function(t){const e=t.childNodes[1],n=e.childNodes[0];if(io(n))return void(n.role=It.INTEGRAL);if(!vo(n))return;const r=n.childNodes.length,o=n.childNodes[r-2],i=n.childNodes[r-1];if(io(i))return void(i.role=It.INTEGRAL);if(oo(o,i)){const t=Uo.getInstance().prefixNode_(i,[o]);t.role=It.INTEGRAL,2===r?e.childNodes[0]=t:(n.childNodes.pop(),n.contentNodes.pop(),n.childNodes[r-2]=t,t.parent=n)}},t=>{if(t.type!==St.INTEGRAL)return!1;const[,e,n]=t.childNodes;return n.type===St.EMPTY&&e.type===St.FRACTION})),br.add(new kc("rewrite_subcases",function(t){t.addAnnotation("Emph","top");let e=[];if(t.hasAnnotation("Emph","left")){const n=Jc(t.childNodes[0].childNodes[0].childNodes[0],!0);n.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(n);for(let e,n=0;e=t.childNodes[n];n++)e.childNodes.shift()}if(e.push(t),t.hasAnnotation("Emph","right")){const n=Jc(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].childNodes[0]);n.forEach(t=>t.addAnnotation("Emph","left")),e=e.concat(n),t.childNodes[0].childNodes.pop()}Uo.tableToMultiline(t);const n=Uo.getInstance().row(e),r=t.annotation.Emph;return t.annotation.Emph=["table"],r.forEach(t=>n.addAnnotation("Emph",t)),n},t=>{let e=!0,n=!0;const r=t.childNodes[0].childNodes[0];if(!r)return!1;if(zc(r.mathmlTree)){for(let n,r=1;n=t.childNodes[r];r++)if(n.childNodes[0].childNodes.length){e=!1;break}}else e=!1;e&&t.addAnnotation("Emph","left");if(zc(t.childNodes[0].childNodes[t.childNodes[0].childNodes.length-1].mathmlTree)){const e=t.childNodes[0].childNodes.length;for(let r,o=1;r=t.childNodes[o];o++)if(r.childNodes.length>=e){n=!1;break}}else n=!1;return n&&t.addAnnotation("Emph","right"),e||n}));const Qc=[St.PUNCTUATED,St.RELSEQ,St.MULTIREL,St.INFIXOP,St.PREFIXOP,St.POSTFIXOP];function Jc(t,e){if(!t.childNodes.length)return tl(t),[t];let n=null;if(t.type===St.PUNCTUATED&&(e?t.role===It.ENDPUNCT:t.role===It.STARTPUNCT)){const r=t.childNodes;tl(r[e?r.length-1:0])&&(t=r[e?0:r.length-1],n=r[e?r.length-1:0])}if(-1!==Qc.indexOf(t.type)){const r=t.childNodes;tl(r[e?r.length-1:0]);const o=Yc.combineContentChildren(t.type,t.role,t.contentNodes,t.childNodes);return n&&(e?o.push(n):o.unshift(n)),o}return n?e?[t,n]:[n,t]:[t]}const Zc={[It.METRIC]:It.METRIC,[It.VBAR]:It.NEUTRAL,[It.OPENFENCE]:It.OPEN,[It.CLOSEFENCE]:It.CLOSE};function tl(t){if(t.type!==St.PUNCTUATION)return!1;const e=Zc[t.role];return!!e&&(t.role=e,t.type=St.FENCE,t.addAnnotation("Emph","fence"),!0)}function el(t,e,n,r=n){const o=[];for(;t&&t.role===n;)o.push(t),t=e.shift();return o.length?(t&&e.unshift(t),[1===o.length?o[0]:nl(o,r),e]):[t,e]}function nl(t,e){const n=br.factory.makeBranchNode(St.PUNCTUATION,t,[]);return n.role=e,n}function rl(t){return["[","\uff3b"].includes(t)}function ol(t){return["]","\uff3d"].includes(t)}function il(t){return["(","\u207d","\u208d"].includes(t)}function sl(t){return[")","\u207e","\u208e"].includes(t)}function al(t){return t.role===It.INFTY||t.type===St.PREFIXOP&&t.childNodes[0].role===It.INFTY}function cl(t){const e=t.childNodes[0];if(t.type!==St.FENCED||(null==e?void 0:e.type)!==St.PUNCTUATED||3!==(null==e?void 0:e.childNodes.length)||1!==(null==e?void 0:e.contentNodes.length)||(null==e?void 0:e.childNodes[1].role)!==It.COMMA)return!1;const n=t.childNodes[0].childNodes[0],r=t.childNodes[0].childNodes[2],o=t.contentNodes[0].textContent,i=t.contentNodes[1].textContent;return!!(rl(o)&&sl(i)||il(o)&&ol(i))||!(!il(o)||!sl(i)||!al(n)&&!al(r))}function ll(t){return fl(t)||function(t){return hl(t)||t.type===St.INFIXOP&&t.role===It.IMPLICIT&&(2===t.childNodes.length&&(hl(t.childNodes[0])||fl(t.childNodes[0]))&&hl(t.childNodes[1])||3===t.childNodes.length&&fl(t.childNodes[0])&&hl(t.childNodes[1])&&hl(t.childNodes[2]))}(t)||function(t){return t.type===St.PUNCTUATED&&t.role===It.ENDPUNCT&&2===t.childNodes.length&&t.childNodes[1].role===It.DEGREE&&(hl(t.childNodes[0])||dl(t.childNodes[0])||t.childNodes[0].type===St.PREFIXOP&&t.childNodes[0].role===It.NEGATIVE&&(hl(t.childNodes[0].childNodes[0])||dl(t.childNodes[0].childNodes[0])))}(t)||function(t){return t.type===St.PREFIXOP&&t.role===It.NEGATIVE&&ul(t.childNodes[0])&&t.childNodes[0].type!==St.PREFIXOP&&t.childNodes[0].type!==St.APPL&&t.childNodes[0].type!==St.PUNCTUATED}(t)||function(t){return t.type===St.APPL&&(t.childNodes[0].role===It.PREFIXFUNC||t.childNodes[0].role===It.SIMPLEFUNC)&&(ul(t.childNodes[1])||t.childNodes[1].type===St.FENCED&&ul(t.childNodes[1].childNodes[0]))}(t)}function ul(t){return t.hasAnnotation("clearspeak","simple")}function hl(t){return t.type===St.IDENTIFIER&&(t.role===It.LATINLETTER||t.role===It.GREEKLETTER||t.role===It.OTHERLETTER||t.role===It.SIMPLEFUNC)}function dl(t){return t.type===St.NUMBER&&(t.role===It.INTEGER||t.role===It.FLOAT)}function fl(t){return dl(t)||function(t){if(pl("Fraction_Over")||pl("Fraction_FracOver"))return!1;if(t.type!==St.FRACTION||t.role!==It.VULGAR)return!1;if(pl("Fraction_Ordinal"))return!0;const e=parseInt(t.childNodes[0].textContent,10),n=parseInt(t.childNodes[1].textContent,10);return e>0&&e<20&&n>0&&n<11}(t)}function pl(t){return B.getInstance().options.style===t}function ml(t){return t.type===St.TEXT&&t.role!==It.LABEL||t.type===St.PUNCTUATED&&t.role===It.TEXT&&dl(t.childNodes[0])&&function(t){for(let e=0;e<t.length-1;e++)if(t[e].type!==St.TEXT||""!==t[e].textContent)return!1;return t[t.length-1].type===St.TEXT}(t.childNodes.slice(1))||t.type===St.IDENTIFIER&&t.role===It.UNIT||t.type===St.INFIXOP&&(t.role===It.IMPLICIT||t.role===It.UNIT)}br.add(new Bc("ellipses",t=>{const e=[];let n=t.shift();for(;n;)[n,t]=el(n,t,It.FULLSTOP,It.ELLIPSIS),[n,t]=el(n,t,It.DASH),e.push(n),n=t.shift();return e},t=>t.length>1)),br.add(new Bc("op_with_limits",t=>{const e=t[0];return e.type=St.LARGEOP,e.role=It.SUM,t},t=>(t[0].type===St.OPERATOR||t[0].type===St.IDENTIFIER&&"OP"===t[0].attributes.texclass)&&t.slice(1).some(t=>t.type===St.RELSEQ||t.type===St.MULTIREL||t.type===St.INFIXOP&&t.role===It.ELEMENT||t.type===St.PUNCTUATED&&t.role===It.SEQUENCE))),br.add(new class extends Uc{}("function_from_identifiers",t=>{const e=W(t.childNodes).map(t=>t.textContent.trim()).join("");if(An.Meaning.get(e).type===St.UNKNOWN)return t;const n=br.factory.makeLeafNode(e,Uo.getInstance().font(t.getAttribute("mathvariant")));return n.mathmlTree=t,n},t=>{const e=W(t.childNodes);return!(e.length<2)&&e.every(t=>lt(t)===Dr.MI&&An.Meaning.get(t.textContent.trim()).role===It.LATINLETTER)})),br.add(new Bc("bracketed_interval",t=>{const e=t[0],n=t[1],r=t.slice(2),o=Uo.getInstance().row(r),i=br.factory.makeBranchNode(St.FENCED,[o],[e,n]);return i.role=It.INTERVAL,i},t=>{const e=t[0],n=t[1],r=t.slice(2);if(!(e&&n&&(ol(e.textContent)&&(rl(n.textContent)||ol(n.textContent))||rl(n.textContent)&&(rl(e.textContent)||ol(e.textContent)))))return!1;if(1===r.length&&r[0].type===St.PUNCTUATED&&1===r[0].contentNodes.length)return!0;const o=Yr(r,uo);return!(1!==o.rel.length||!o.comp[0].length||!o.comp[1].length)})),br.add(new kc("interval_heuristic",t=>(t.role=It.INTERVAL,t),t=>cl(t))),br.add(new kc("propagateInterval",t=>(t.childNodes.forEach(t=>{cl(t)&&(t.role=It.INTERVAL)}),t),t=>Fo(t))),Fs(new Ds("clearspeak","simple",function(t){return ll(t)?"simple":""})),Us("clearspeak","simple"),Fs(new Ds("clearspeak","unit",function(t){return ml(t)?"unit":""})),Us("clearspeak","unit");const gl=[St.MULTIREL,St.RELSEQ,St.APPL,St.ROW,St.LINE],El=[St.SUBSCRIPT,St.SUPERSCRIPT,St.OVERSCORE,St.UNDERSCORE];function Nl(t,e){const n=t.parent;if(!n)return!1;const r=n.type;return-1!==gl.indexOf(r)||r===St.PREFIXOP&&n.role===It.NEGATIVE&&!e.script&&!e.enclosed||r===St.PREFIXOP&&n.role===It.GEOMETRY||!(r!==St.PUNCTUATED||e.enclosed&&n.role!==It.TEXT)}Fs(new Ps("nemeth","number",function(t,e){return t.childNodes.length?(-1!==El.indexOf(t.type)&&(e.script=!0),t.type===St.FENCED?(e.number=!1,e.enclosed=!0,["",e]):t.type===St.PREFIXOP&&t.role!==It.GEOMETRY&&t.role!==It.NEGATIVE?(e.number=!1,["",e]):(Nl(t,e)&&(e.number=!0,e.enclosed=!1),["",e])):(Nl(t,e)&&(e.number=!0,e.script=!1,e.enclosed=!1),[e.number?"number":"",{number:!1,enclosed:e.enclosed,script:e.script}])},{number:!0})),Us("nemeth","number"),Fs(new Ps("depth","depth",function(t){return t.parent?[parseInt(t.parent.annotation.depth[0])+1]:[1]})),Us("depth","depth");class Sl{static empty(){const t=K("<math/>"),e=new Sl(t,new x);return e.mathml=t,e}static fromNode(t,e){const n=Sl.empty();return n.root=t,e&&(n.mathml=e),n}static fromRoot(t,e){let n=t;for(;n.parent;)n=n.parent;const r=Sl.fromNode(n);return e&&(r.mathml=e),r}static fromXml(t){const e=Sl.empty();return t.childNodes[0]&&(e.root=zr.fromXml(t.childNodes[0])),e}constructor(t,e){this.mathml=t,this.options=e,this.parser=new Fc(e),this.root=this.parser.parse(t),this.root=Uo.rewriteTrivialTable(this.root),this.collator=this.parser.getFactory().leafMap.collateMeaning();const n=this.collator.newDefault();n&&(this.parser=new Fc(e),this.parser.getFactory().defaultMap=n,this.root=this.parser.parse(t)),Tl.visit(this.root,{}),function(t){for(const e of _s.values())e.active&&e.annotate(t);for(const e of xs.values())e.active&&e.visit(t,Object.assign({},e.def))}(this.root)}xml(t){const e=K("<stree></stree>"),n=this.root.xml(e.ownerDocument,t);return e.appendChild(n),e}toString(t){return ht(this.xml(t))}formatXml(t){return ot(this.toString(t))}displayTree(){this.root.displayTree()}replaceNode(t,e){const n=t.parent;n?n.replaceChild(t,e):this.root=e}toJson(){const t={};return t.stree=this.root.toJson(),t}}const Tl=new Ps("general","unit",(t,e)=>(Mo(t)&&(t.role=It.UNIT),!1));function Il(t,e){return Al(t,e).xml()}function Al(t,e){return new Sl(t,e)}const bl=[],Rl=!0,Ol=new Map;function yl(t){_.getInstance().generate(()=>["WALKING START: ",t.toString()]);const e=function(t){for(let e,n=0;e=bl[n];n++)if(e.test(t))return e.constr(t);return null}(t);let n;if(e)return n=e.getMathml(),_.getInstance().generate(()=>["WALKING END: ",t.toString()]),Bl(n);if(1===t.mathml.length){if(_.getInstance().output("Walktree Case 0"),!t.childNodes.length)return _.getInstance().output("Walktree Case 0.1"),n=t.mathml[0],qc(n,t),_.getInstance().generate(()=>["WALKING END: ",t.toString()]),Bl(n);const e=t.childNodes[0];if(1===t.childNodes.length&&e.type===St.EMPTY)return _.getInstance().output("Walktree Case 0.2"),n=t.mathml[0],qc(n,t),n.appendChild(yl(e)),_.getInstance().generate(()=>["WALKING END: ",t.toString()]),Bl(n);t.childNodes.forEach(t=>{t.mathml.length||t.addMathmlNodes([Yl(t)])})}const r=t.contentNodes.map($l);Wl(t,r);const o=t.childNodes.map(yl),i=Yc.combineContentChildren(t.type,t.role,r,o);if(n=t.mathmlTree,null===n)_.getInstance().output("Walktree Case 1"),n=Cl(i,t);else{n=Xl(n);const t=Fl(i);_.getInstance().output("Walktree Case 2"),t?(_.getInstance().output("Walktree Case 2.1"),n=jl(t)):(_.getInstance().output("Walktree Case 2.2"),n=Kl(n))}return function(t,e,n){if(!e.length)return;if(1===e.length&&t===e[0])return;const r=n.role===It.IMPLICIT&&br.flags.combine_juxtaposition?function(t,e,n){const r=[];let o=W(t.childNodes),i=!1;for(;o.length;){const t=o.shift();if(t.hasAttribute(Vc.TYPE)){r.push(t);continue}const n=Ml(t,e);0!==n.length&&(1!==n.length?(i?t.setAttribute("AuxiliaryImplicit",!0):i=!0,o=n.concat(o)):r.push(t))}const s=[],a=n.childNodes.map(function(t){return t.mathmlTree});for(;a.length;){const t=a.pop();if(t){if(-1!==r.indexOf(t))break;-1!==e.indexOf(t)&&s.unshift(t)}}return r.concat(s)}(t,e,n):W(t.childNodes);if(!r.length)return void e.forEach(function(e){t.appendChild(e)});let o=0;for(;e.length;){const n=e[0];if(r[o]===n||_l(r[o],n)){e.shift(),o++;continue}if(r[o]&&-1===e.indexOf(r[o])){o++;continue}if(Pl(n,t)){e.shift();continue}const i=r[o];if(!i){if(n.parentNode){t=jl(n),e.shift();continue}const r=e[1];if(r&&r.parentNode){wl(t=jl(r),n,r),e.shift(),e.shift();continue}wl(t,n,null),e.shift();continue}vl(t,i,n),e.shift()}}(n,i,t),Ol.has(t.id)||(Ol.set(t.id,!0),qc(n,t)),_.getInstance().generate(()=>["WALKING END: ",t.toString()]),Bl(n,t)}function Cl(t,e){const n=function(t){const e=Fl(t);if(!e)return{type:xl.INVALID,node:null};const n=Fl(t.slice().reverse());if(e===n)return{type:xl.VALID,node:e};const r=Ul(e),o=function(t,e){let n=0;for(;t[n]&&-1===e.indexOf(t[n]);)n++;return t.slice(0,n+1)}(r,t),i=Ul(n,function(t){return-1!==o.indexOf(t)}),s=i[0],a=o.indexOf(s);if(-1===a)return{type:xl.INVALID,node:null};return{type:o.length!==r.length?xl.PRUNED:kl(o[a+1],i[1])?xl.VALID:xl.INVALID,node:s}}(t);let r=n.node;const o=n.type;if(o!==xl.VALID||!Vr(r)||!r.parentNode&&e.parent)if(_.getInstance().output("Walktree Case 1.1"),r=Xc(),o===xl.PRUNED)_.getInstance().output("Walktree Case 1.1.0"),r=function(t,e,n){let r=Gl(e);if(Br(r)){_.getInstance().output("Walktree Case 1.1.0.0"),Ll(r,t),W(r.childNodes).forEach(function(e){t.appendChild(e)});const e=t;t=r,r=e}const o=n.indexOf(e);return n[o]=r,tt(r,t),t.appendChild(r),n.forEach(function(e){t.appendChild(e)}),t}(r,n.node,t);else if(t[0]){_.getInstance().output("Walktree Case 1.1.1");const e=Fl(t);if(e){const n=function(t,e){const n=W(t.childNodes);let r=1/0,o=-1/0;return e.forEach(function(t){const e=n.indexOf(t);-1!==e&&(r=Math.min(r,e),o=Math.max(o,e))}),n.slice(r,o+1)}(jl(e),t);tt(e,r),n.forEach(function(t){r.appendChild(t)})}else Ll(r,t[0]),r=t[0]}return e.mathmlTree||(e.mathmlTree=r),r}function Ll(t,e){for(const n of Hc)t.hasAttribute(n)&&(e.setAttribute(n,t.getAttribute(n)),t.removeAttribute(n))}function Ml(t,e){const n=[];let r=W(t.childNodes);for(;r.length;){const t=r.shift();t.nodeType===z.ELEMENT_NODE&&(t.hasAttribute(Vc.TYPE)||-1!==e.indexOf(t)?n.push(t):r=W(t.childNodes).concat(r))}return n}function vl(t,e,n){let r=e,o=jl(r);for(;o&&Dl(o,r)&&!r.hasAttribute("AuxiliaryImplicit")&&o!==t;)r=o,o=jl(r);o&&(wl(o,n,r),r.removeAttribute("AuxiliaryImplicit"))}function wl(t,e,n){lt(t)===Dr.MACTION?wl(jl(t),e,t):t.insertBefore(e,n)}function Dl(t,e){if(lt(t)!==Dr.MACTION)return t.firstChild===e;const n=parseInt(t.getAttribute("selection"))||1;return t.childNodes[n-1]===e}function Pl(t,e){if(!t)return!1;do{if((t=jl(t))===e)return!0}while(t);return!1}function _l(t,e){const n=Sn.functionApplication;if(t&&e&&t.textContent&&e.textContent&&t.textContent===n&&e.textContent===n&&"true"===e.getAttribute(Vc.ADDED)){for(let n,r=0;n=t.attributes[r];r++)e.hasAttribute(n.nodeName)||e.setAttribute(n.nodeName,n.nodeValue);return tt(t,e),!0}return!1}var xl;function Fl(t){let e=0,n=null;for(;!n&&e<t.length;)t[e].parentNode&&(n=t[e]),e++;return n}function Ul(t,e){const n=e||(t=>!1),r=[t];for(;!n(t)&&!Br(t)&&t.parentNode;)t=jl(t),r.unshift(t);return r}function kl(t,e){return!(!t||!e||t.previousSibling||e.nextSibling)}function Bl(t,e){var n;let r=e&&!e.hasAnnotation("empty","MFENCED")&&e.getAnnotation("empty");for(;!Br(t)&&(Vl(t)||r&&t.parentNode&&r.includes(null===(n=jl(t).tagName)||void 0===n?void 0:n.toUpperCase()));)t=jl(t);return t}function Gl(t){const e=W(t.childNodes);if(!e)return t;const n=e.filter(function(t){return t.nodeType===z.ELEMENT_NODE&&!Gr(t)});return 1===n.length&&Vr(n[0])&&!n[0].hasAttribute(Vc.TYPE)?Gl(n[0]):t}function Vl(t){const e=jl(t);return!(!e||!Vr(e))&&W(e.childNodes).every(function(e){return e===t||Hl(e)})}function Hl(t){if(t.nodeType!==z.ELEMENT_NODE)return!0;if(!t||Gr(t))return!0;const e=W(t.childNodes);return!(!Vr(t)&&e.length||function(t){return!!t&&Ur.includes(lt(t))}(t)||t.hasAttribute(Vc.TYPE)||Hr(t))&&W(t.childNodes).every(Hl)}function jl(t){return t.parentNode}function ql(t,e){const n=new Yc(e);t.setAttribute(Vc.COLLAPSED,n.toString())}function $l(t){if(t.mathml.length)return yl(t);const e=Rl?Yl(t):Xc();return t.addMathmlNodes([e]),e}function Xl(t){if(lt(t)!==Dr.MFENCED)return t;const e=Xc();for(let n,r=0;n=t.attributes[r];r++)-1===["open","close","separators"].indexOf(n.name)&&e.setAttribute(n.name,n.value);return W(t.childNodes).forEach(function(t){e.appendChild(t)}),tt(t,e),e}function Yl(t){const e=et("mo"),n=rt(t.textContent);return e.appendChild(n),qc(e,t),e.setAttribute(Vc.ADDED,"true"),e}function Wl(t,e){const n=t.type+(t.textContent?","+t.textContent:"");e.forEach(function(t){Kl(t).setAttribute(Vc.OPERATOR,n)})}function Kl(t){if(Gr(t))return t;const e=W(t.childNodes);if(!e)return t;const n=e.filter(function(t){return!Hl(t)}),r=[];for(let t,e=0;t=n[e];e++)if(Vr(t)&&t.getAttribute(Vc.TYPE)!==St.PUNCTUATION){const e=Kl(t);e&&e!==t&&r.push(e)}else r.push(t);return 1===r.length?r[0]:t}function zl(t){return ot(t.toString()).toString().replace(new RegExp(Gc,"g"),"")}function Ql(t,e){const n=!!e,r=e||[],o=t.parent,i=t.contentNodes.map(function(t){return t.id});i.unshift("c");const s=[t.id,i];for(let e,i=0;e=t.childNodes[i];i++){const t=yl(e);r.push(t);const i=Kl(t);o&&!n&&i.setAttribute(Vc.PARENT,o.id.toString()),s.push(e.id)}return s}!function(t){t.VALID="valid",t.INVALID="invalid",t.PRUNED="pruned"}(xl||(xl={}));class Jl{constructor(t){this.semantic=t}}class Zl extends Jl{static test(t){return!t.mathmlTree&&t.type===St.LINE&&t.role===It.BINOMIAL}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const t=this.semantic.childNodes[0];if(this.mml=yl(t),this.mml.hasAttribute(Vc.TYPE)){const t=Xc();tt(this.mml,t),t.appendChild(this.mml),this.mml=t}return qc(this.mml,this.semantic),this.mml}}class tu extends Jl{static test(t){var e,n;return!!t.getAnnotation("collapsed").length&&(null===(n=null===(e=t.mathmlTree)||void 0===e?void 0:e.parentNode)||void 0===n?void 0:n.childNodes.length)>2}getMathml(){yl(this.semantic.childNodes[0]),yl(this.semantic.childNodes[1]);const t=this.semantic.mathmlTree,e=Cl([this.semantic.childNodes[0].mathmlTree,t],this.semantic);return qc(e,this.semantic),e}}class eu extends Jl{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=lt(t.mathmlTree),n=t.childNodes[0].role;return e===Dr.MSUBSUP&&n===It.SUBSUP||e===Dr.MUNDEROVER&&n===It.UNDEROVER}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes[0],e=t.childNodes[0],n=this.semantic.childNodes[1],r=t.childNodes[1],o=yl(n),i=yl(e),s=yl(r);return qc(this.mml,this.semantic),this.mml.setAttribute(Vc.CHILDREN,jc([e,r,n])),[i,s,o].forEach(t=>Kl(t).setAttribute(Vc.PARENT,this.mml.getAttribute(Vc.ID))),this.mml.setAttribute(Vc.TYPE,t.role),ql(this.mml,[this.semantic.id,[t.id,e.id,r.id],n.id]),this.mml}}class nu extends Jl{static multiscriptIndex(t){return t.type===St.PUNCTUATED&&t.contentNodes[0].role===It.DUMMY&&t.hasAnnotation("general","script")?Ql(t):(yl(t),t.id)}static createNone_(t){const e=et("none");return t&&qc(e,t),e.setAttribute(Vc.ADDED,"true"),e}constructor(t){super(t),this.mml=t.mathmlTree}completeMultiscript(t,e){const n=W(this.mml.childNodes).slice(1);let r=0;const o=t=>{for(const e of t){const t=n[r];if(t&&e===parseInt(t.getAttribute(Vc.ID)))t.setAttribute(Vc.PARENT,this.semantic.id.toString()),r++;else if(t&&e===parseInt(Kl(t).getAttribute(Vc.ID)))Kl(t).setAttribute(Vc.PARENT,this.semantic.id.toString()),r++;else{const n=this.semantic.querySelectorAll(t=>t.id===e);this.mml.insertBefore(nu.createNone_(n[0]),t||null)}}};o(t),n[r]&&lt(n[r])!==Dr.MPRESCRIPTS?this.mml.insertBefore(n[r],et("mprescripts")):r++,o(e)}}class ru extends nu{static test(t){if(!t.mathmlTree)return!1;return lt(t.mathmlTree)===Dr.MMULTISCRIPTS&&(t.type===St.SUPERSCRIPT||t.type===St.SUBSCRIPT)}constructor(t){super(t)}getMathml(){let t,e,n;if(qc(this.mml,this.semantic),this.semantic.childNodes[0]&&this.semantic.childNodes[0].role===It.SUBSUP){const r=this.semantic.childNodes[0];t=r.childNodes[0],e=nu.multiscriptIndex(this.semantic.childNodes[1]),n=nu.multiscriptIndex(r.childNodes[1]);const o=[this.semantic.id,[r.id,t.id,n],e];ql(this.mml,o),this.mml.setAttribute(Vc.TYPE,r.role),this.completeMultiscript(Yc.interleaveIds(n,e),[])}else{t=this.semantic.childNodes[0],e=nu.multiscriptIndex(this.semantic.childNodes[1]);const n=[this.semantic.id,t.id,e];ql(this.mml,n)}const r=Yc.collapsedLeafs(n||[],e);return Kl(yl(t)).setAttribute(Vc.PARENT,this.semantic.id.toString()),r.unshift(t.id),this.mml.setAttribute(Vc.CHILDREN,r.join(",")),this.mml}}class ou extends nu{static test(t){return!!t.mathmlTree&&t.type===St.TENSOR}constructor(t){super(t)}getMathml(){yl(this.semantic.childNodes[0]);const t=nu.multiscriptIndex(this.semantic.childNodes[1]),e=nu.multiscriptIndex(this.semantic.childNodes[2]),n=nu.multiscriptIndex(this.semantic.childNodes[3]),r=nu.multiscriptIndex(this.semantic.childNodes[4]);qc(this.mml,this.semantic);const o=[this.semantic.id,this.semantic.childNodes[0].id,t,e,n,r];ql(this.mml,o);const i=Yc.collapsedLeafs(t,e,n,r);return i.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(Vc.CHILDREN,i.join(",")),this.completeMultiscript(Yc.interleaveIds(n,r),Yc.interleaveIds(t,e)),this.mml}}class iu extends Jl{static test(t){return!(!t.mathmlTree||!t.fencePointer||t.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(t){const e=Xc(),n=new zr(t);return n.type=St.EMPTY,n.mathmlTree=e,n}static fencedMap_(t,e){e[t.id]=t.mathmlTree,t.embellished&&iu.fencedMap_(t.childNodes[0],e)}constructor(t){super(t),this.fenced=null,this.fencedMml=null,this.fencedMmlNodes=[],this.ofence=null,this.ofenceMml=null,this.ofenceMap={},this.cfence=null,this.cfenceMml=null,this.cfenceMap={},this.parentCleanup=[]}getMathml(){this.getFenced_(),this.fencedMml=yl(this.fenced),this.getFencesMml_(),this.fenced.type!==St.EMPTY||this.fencedMml.parentNode||(this.fencedMml.setAttribute(Vc.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_();return this.rewrite_()}fencedElement(t){return t.type===St.FENCED||t.type===St.MATRIX||t.type===St.VECTOR}getFenced_(){let t=this.semantic;for(;!this.fencedElement(t);)t=t.childNodes[0];this.fenced=t.childNodes[0],this.ofence=t.contentNodes[0],this.cfence=t.contentNodes[1],iu.fencedMap_(this.ofence,this.ofenceMap),iu.fencedMap_(this.cfence,this.cfenceMap)}getFencedMml_(){let t=this.ofenceMml.nextSibling;for(t=t===this.fencedMml?t:this.fencedMml;t&&t!==this.cfenceMml;)this.fencedMmlNodes.push(t),t=t.nextSibling}getFencesMml_(){let t=this.semantic;const e=Object.keys(this.ofenceMap),n=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||t===this.fenced);)-1===e.indexOf(t.fencePointer)||this.ofenceMml||(this.ofenceMml=t.mathmlTree),-1===n.indexOf(t.fencePointer)||this.cfenceMml||(this.cfenceMml=t.mathmlTree),t=t.childNodes[0];this.ofenceMml||(this.ofenceMml=this.ofence.mathmlTree),this.cfenceMml||(this.cfenceMml=this.cfence.mathmlTree),this.ofenceMml&&(this.ofenceMml=Bl(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=Bl(this.cfenceMml))}rewrite_(){let t=this.semantic,e=null;const n=this.introduceNewLayer_();for(qc(n,this.fenced.parent);!this.fencedElement(t);){const r=t.mathmlTree,o=this.specialCase_(t,r);if(o)t=o;else{qc(r,t);const e=[];for(let n,r=1;n=t.childNodes[r];r++)e.push(yl(n));t=t.childNodes[0]}const i=et("dummy"),s=r.childNodes[0];tt(r,i),tt(n,r),tt(r.childNodes[0],n),tt(i,s),e||(e=r)}return yl(this.ofence),yl(this.cfence),this.cleanupParents_(),e||n}specialCase_(t,e){const n=lt(e);let r,o=null;if(n===Dr.MSUBSUP?(o=t.childNodes[0],r=eu):n===Dr.MMULTISCRIPTS&&(t.type===St.SUPERSCRIPT||t.type===St.SUBSCRIPT?r=ru:t.type===St.TENSOR&&(r=ou),o=r&&t.childNodes[0]&&t.childNodes[0].role===It.SUBSUP?t.childNodes[0]:t),!o)return null;const i=o.childNodes[0],s=iu.makeEmptyNode_(i.id);return o.childNodes[0]=s,e=new r(t).getMathml(),o.childNodes[0]=i,this.parentCleanup.push(e),o.childNodes[0]}introduceNewLayer_(){const t=this.fullFence(this.ofenceMml),e=this.fullFence(this.cfenceMml);let n=Xc();if(tt(this.fencedMml,n),this.fencedMmlNodes.forEach(t=>n.appendChild(t)),n.insertBefore(t,this.fencedMml),n.appendChild(e),!n.parentNode){const t=Xc();for(;n.childNodes.length>0;)t.appendChild(n.childNodes[0]);n.appendChild(t),n=t}return n}fullFence(t){const e=this.fencedMml.parentNode;let n=t;for(;n.parentNode&&n.parentNode!==e;)n=n.parentNode;return n}cleanupParents_(){this.parentCleanup.forEach(function(t){const e=t.childNodes[1].getAttribute(Vc.PARENT);t.childNodes[0].setAttribute(Vc.PARENT,e)})}}class su extends Jl{static test(t){return!!t.mathmlTree&&t.hasAnnotation("Emph","top")}constructor(t){super(t),this.mrows=[],this.mml=t.mathmlTree}getMathml(){if(this.recurseToTable(this.semantic),this.mrows.length){const t=Xc();this.mml.parentNode.insertBefore(t,this.mml);for(const e of this.mrows)t.appendChild(e);t.appendChild(this.mml)}return this.mml}recurseToTable(t){var e,n;if(t.hasAnnotation("Emph","top")||t.hasAnnotation("Emph","fence")||!t.hasAnnotation("Emph","left")&&!t.hasAnnotation("Emph","right")){if(!t.mathmlTree||lt(t.mathmlTree)===Dr.MTABLE&&(null===(e=t.annotation.Emph)||void 0===e?void 0:e.length)&&"table"!==t.annotation.Emph[0]){const e=Xc();qc(e,t),this.mrows.unshift(e)}else{if(lt(t.mathmlTree)===Dr.MTABLE&&(null===(n=t.annotation.Emph)||void 0===n?void 0:n.length)&&"table"===t.annotation.Emph[0])return void this.finalizeTable(t);qc(t.mathmlTree,t)}if(t.childNodes.forEach(this.recurseToTable.bind(this)),t.textContent||"punctuated"===t.type){const e=t.contentNodes.map(t=>{const e=$l(t);return e.hasAttribute("data-semantic-added")?this.mrows.unshift(e):this.recurseToTable(t),e});return void Wl(t,e)}t.contentNodes.forEach(this.recurseToTable.bind(this))}else yl(t)}finalizeTable(t){qc(t.mathmlTree,t),t.contentNodes.forEach(t=>{yl(t)}),t.childNodes.forEach(t=>{yl(t)})}}class au extends Jl{static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=lt(t.mathmlTree),n=t.type;return(n===St.LIMUPPER||n===St.LIMLOWER)&&(e===Dr.MSUBSUP||e===Dr.MUNDEROVER)||n===St.LIMBOTH&&(e===Dr.MSUB||e===Dr.MUNDER||e===Dr.MSUP||e===Dr.MOVER)}static walkTree_(t){t&&yl(t)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=this.semantic.childNodes;return this.semantic.type!==St.LIMBOTH&&this.mml.childNodes.length>=3&&(this.mml=Cl([this.mml],this.semantic)),qc(this.mml,this.semantic),t[0].mathmlTree||(t[0].mathmlTree=this.semantic.mathmlTree),t.forEach(au.walkTree_),this.mml}}class cu extends Jl{static test(t){return!!t.mathmlTree&&t.type===St.LINE}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.contentNodes.length&&yl(this.semantic.contentNodes[0]),this.semantic.childNodes.length&&yl(this.semantic.childNodes[0]),qc(this.mml,this.semantic),this.mml}}class lu extends Jl{static test(t){return!!t.mathmlTree&&(t.type===St.INFERENCE||t.type===St.PREMISES)}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){return this.semantic.childNodes.length?(this.semantic.contentNodes.forEach(function(t){yl(t),qc(t.mathmlTree,t)}),this.semantic.childNodes.forEach(function(t){yl(t)}),qc(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent"),this.mml):this.mml}}class uu extends Jl{static test(t){return t.type===St.MATRIX||t.type===St.VECTOR||t.type===St.CASES}constructor(t){super(t),this.inner=[],this.mml=t.mathmlTree}getMathml(){const t=$l(this.semantic.contentNodes[0]),e=this.semantic.contentNodes[1]?$l(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(yl),this.mml)if(lt(this.mml)===Dr.MFENCED){const n=this.mml.childNodes;this.mml.insertBefore(t,n[0]||null),e&&this.mml.appendChild(e),this.mml=Xl(this.mml)}else{const n=[t,this.mml];e&&n.push(e),this.mml=Cl(n,this.semantic)}else this.mml=Cl([t].concat(this.inner,[e]),this.semantic);return qc(this.mml,this.semantic),this.mml}}class hu extends Jl{static test(t){return t.type===St.PUNCTUATED&&(t.role===It.TEXT||t.contentNodes.every(t=>t.role===It.DUMMY))}constructor(t){super(t),this.mml=t.mathmlTree}getMathml(){const t=[],e=Ql(this.semantic,t);return this.mml=Cl(t,this.semantic),qc(this.mml,this.semantic),this.mml.removeAttribute(Vc.CONTENT),ql(this.mml,e),this.mml}}function du(t,e){const n=ut(t),r=function(t,e,n){return _.getInstance().generate(()=>["Original MathML",zl(t)]),Ol.clear(),yl(e.root),n.structure&&t.setAttribute(Vc.STRUCTURE,Yc.fromStructure(t,e,n).toString()),_.getInstance().generate(()=>["Semantic Tree\n",zl(e),"Semantically enriched MathML\n",zl(t)]),t}(n,Al(n,e),e);return r}bl.push({test:au.test,constr:t=>new au(t)},{test:iu.test,constr:t=>new iu(t)},{test:tu.test,constr:t=>new tu(t)},{test:eu.test,constr:t=>new eu(t)},{test:ou.test,constr:t=>new ou(t)},{test:ru.test,constr:t=>new ru(t)},{test:cu.test,constr:t=>new cu(t)},{test:Zl.test,constr:t=>new Zl(t)},{test:lu.test,constr:t=>new lu(t)},{test:su.test,constr:t=>new su(t)},{test:uu.test,constr:t=>new uu(t)},{test:hu.test,constr:t=>new hu(t)});let fu=0;class pu{constructor(){this.counter=fu++,this.ATTR="sre-highlight-"+this.counter.toString(),this.color=null,this.mactionName="",this.currentHighlights=[]}highlight(t){this.currentHighlights.push(t.map(t=>{const e=this.highlightNode(t);return this.setHighlighted(t),e}))}highlightAll(t){const e=this.getMactionNodes(t);for(let t,n=0;t=e[n];n++)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach(t=>{this.isHighlighted(t.node)&&(this.unhighlightNode(t),this.unsetHighlighted(t.node))})}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}setColor(t){this.color=t}colorString(){return this.color.rgba()}addEvents(t,e){const n=this.getMactionNodes(t);for(let t,r=0;t=n[r];r++)for(const[n,r]of Object.entries(e))t.addEventListener(n,r)}getMactionNodes(t){return Array.from(t.getElementsByClassName(this.mactionName))}isMactionNode(t){const e=t.className||t.getAttribute("class");return!!e&&!!e.match(new RegExp(this.mactionName))}isHighlighted(t){return t.hasAttribute(this.ATTR)}setHighlighted(t){t.setAttribute(this.ATTR,"true")}unsetHighlighted(t){t.removeAttribute(this.ATTR)}colorizeAll(t){Y(t);X(`.//*[@${Vc.ID}]`,t).forEach(t=>this.colorize(t))}uncolorizeAll(t){X(`.//*[@${Vc.ID}]`,t).forEach(t=>this.uncolorize(t))}colorize(t){const e=$c("foreground");t.hasAttribute(e)&&(t.setAttribute(e+"-old",t.style.color),t.style.color=t.getAttribute(e))}uncolorize(t){const e=$c("foreground")+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}class mu extends pu{constructor(){super(),this.mactionName="mjx-maction"}highlightNode(t){const e={node:t,background:t.style.backgroundColor,foreground:t.style.color};if(!this.isHighlighted(t)){const e=this.colorString();t.style.backgroundColor=e.background,t.style.color=e.foreground}return e}unhighlightNode(t){t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}}const gu={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};function Eu(t,e){const n=t||{color:e};let r=Object.prototype.hasOwnProperty.call(n,"color")?gu[n.color]:n;return r||(r=gu[e]),r.alpha=Object.prototype.hasOwnProperty.call(n,"alpha")?n.alpha:1,function(t){const e=t=>(t=Math.max(t,0),t=Math.min(255,t),Math.round(t));return t.red=e(t.red),t.green=e(t.green),t.blue=e(t.blue),t.alpha=Math.max(t.alpha,0),t.alpha=Math.min(1,t.alpha),t}(r)}class Nu{static toHex(t){const e=t.toString(16);return 1===e.length?"0"+e:e}constructor(t,e){this.foreground=Eu(e,Nu.DEFAULT_FOREGROUND_),this.background=Eu(t,Nu.DEFAULT_BACKGROUND_)}rgba(){const t=function(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"};return{background:t(this.background),foreground:t(this.foreground)}}rgb(){const t=function(t){return"rgb("+t.red+","+t.green+","+t.blue+")"};return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}hex(){const t=function(t){return"#"+Nu.toHex(t.red)+Nu.toHex(t.green)+Nu.toHex(t.blue)};return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}}Nu.DEFAULT_BACKGROUND_="blue",Nu.DEFAULT_FOREGROUND_="black";class Su{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=50}generate(){return e=function(t,e,n){e=e>1?e/100:e,n=n>1?n/100:n;const r=(1-Math.abs(2*n-1))*e,o=r*(1-Math.abs(t/60%2-1)),i=n-r/2;let s=0,a=0,c=0;return 0<=t&&t<60?[s,a,c]=[r,o,0]:60<=t&&t<120?[s,a,c]=[o,r,0]:120<=t&&t<180?[s,a,c]=[0,r,o]:180<=t&&t<240?[s,a,c]=[0,o,r]:240<=t&&t<300?[s,a,c]=[o,0,r]:300<=t&&t<360&&([s,a,c]=[r,0,o]),{red:s+i,green:a+i,blue:c+i}}(this.hue,this.sat,this.light),"rgb("+(t={red:Math.round(255*e.red),green:Math.round(255*e.green),blue:Math.round(255*e.blue)}).red+","+t.green+","+t.blue+")";var t,e}increment(){this.hue=(this.hue+this.incr)%360}}class Tu extends pu{constructor(){super(),this.mactionName="mjx-svg-maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t.previousSibling||t,background:t.style.backgroundColor,foreground:t.style.color},e;if("svg"===t.tagName){const e={node:t,background:t.style.backgroundColor,foreground:t.style.color};return t.style.backgroundColor=this.colorString().background,t.style.color=this.colorString().foreground,e}const n=nt("http://www.w3.org/2000/svg","rect");let r;if("use"===t.nodeName){const e=nt("http://www.w3.org/2000/svg","g");t.parentNode.insertBefore(e,t),e.appendChild(t),r=e.getBBox(),e.parentNode.replaceChild(t,e)}else r=t.getBBox();n.setAttribute("x",(r.x-40).toString()),n.setAttribute("y",(r.y-40).toString()),n.setAttribute("width",(r.width+80).toString()),n.setAttribute("height",(r.height+80).toString());const o=t.getAttribute("transform");return o&&n.setAttribute("transform",o),n.setAttribute("fill",this.colorString().background),n.setAttribute(this.ATTR,"true"),t.parentNode.insertBefore(n,t),e={node:n,foreground:t.getAttribute("fill")},t.setAttribute("fill",this.colorString().foreground),e}setHighlighted(t){"svg"===t.tagName&&super.setHighlighted(t)}unhighlightNode(t){if("background"in t)return t.node.style.backgroundColor=t.background,void(t.node.style.color=t.foreground);t.foreground?t.node.nextSibling.setAttribute("fill",t.foreground):t.node.nextSibling.removeAttribute("fill"),t.node.parentNode.removeChild(t.node)}isMactionNode(t){let e=t.className||t.getAttribute("class");return!!e&&(e=void 0!==e.baseVal?e.baseVal:e,!!e&&!!e.match(new RegExp(this.mactionName)))}}const Iu={SVG:Tu,"SVG-V3":class extends Tu{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t,background:this.colorString().background,foreground:this.colorString().foreground},e;if("svg"===t.tagName||"MJX-CONTAINER"===t.tagName)return e={node:t,background:t.style.backgroundColor,foreground:t.style.color},t.style.backgroundColor=this.colorString().background,t.style.color=this.colorString().foreground,e;const n=(null!==document&&void 0!==document?document:r).createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("sre-highlighter-added","true");const o=t.getBBox();n.setAttribute("x",(o.x-40).toString()),n.setAttribute("y",(o.y-40).toString()),n.setAttribute("width",(o.width+80).toString()),n.setAttribute("height",(o.height+80).toString());const i=t.getAttribute("transform");if(i&&n.setAttribute("transform",i),n.setAttribute("fill",this.colorString().background),t.setAttribute(this.ATTR,"true"),t.parentNode.insertBefore(n,t),e={node:t,foreground:t.getAttribute("fill")},"rect"===t.nodeName){const e=new Nu({alpha:0,color:"white"});t.setAttribute("fill",e.rgba().background)}else t.setAttribute("fill",this.colorString().foreground);return e}unhighlightNode(t){const e=t.node.previousSibling;if(e&&e.hasAttribute("sre-highlighter-added"))return t.foreground?t.node.setAttribute("fill",t.foreground):t.node.removeAttribute("fill"),void t.node.parentNode.removeChild(e);t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}isMactionNode(t){return t.getAttribute("data-mml-node")===this.mactionName}getMactionNodes(t){return Array.from(X(`.//*[@data-mml-node="${this.mactionName}"]`,t))}},NativeMML:class extends pu{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e=t.getAttribute("style");return e+=";background-color: "+this.colorString().background,e+=";color: "+this.colorString().foreground,t.setAttribute("style",e),{node:t}}unhighlightNode(t){let e=t.node.getAttribute("style");e=e.replace(";background-color: "+this.colorString().background,""),e=e.replace(";color: "+this.colorString().foreground,""),t.node.setAttribute("style",e)}colorString(){return this.color.rgba()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}},"HTML-CSS":class extends pu{constructor(){super(),this.mactionName="maction"}highlightNode(t){const e={node:t,foreground:t.style.color,position:t.style.position},n=this.color.rgb();t.style.color=n.foreground,t.style.position="relative";const r=t.bbox;if(r&&r.w){const o=.05,i=0,s=et("span"),a=parseFloat(t.style.paddingLeft||"0");s.style.backgroundColor=n.background,s.style.opacity=n.alphaback.toString(),s.style.display="inline-block",s.style.height=r.h+r.d+2*o+"em",s.style.verticalAlign=-r.d+"em",s.style.marginTop=s.style.marginBottom=-o+"em",s.style.width=r.w+2*i+"em",s.style.marginLeft=a-i+"em",s.style.marginRight=-r.w-i-a+"em",t.parentNode.insertBefore(s,t),e.box=s}return e}unhighlightNode(t){const e=t.node;e.style.color=t.foreground,e.style.position=t.position,t.box&&t.box.parentNode.removeChild(t.box)}},"MML-CSS":class extends mu{constructor(){super(),this.mactionName="maction"}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}},CommonHTML:mu,CHTML:class extends mu{constructor(){super()}isMactionNode(t){var e;return(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())===this.mactionName.toUpperCase()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}}};function Au(t){return t?t.split(/,/):[]}function bu(t,e){return t.getAttribute(e)}function Ru(t){if(t.hasAttribute(Vc.TYPE)&&!t.hasAttribute(Vc.PARENT))return t;const e=st(t,Vc.TYPE);for(let t,n=0;t=e[n];n++)if(!t.hasAttribute(Vc.PARENT))return t;return t}function Ou(t,e){return t.getAttribute(Vc.ID)===e?t:at(t,Vc.ID,e)[0]}function yu(t,e){return t.getAttribute(Vc.ID)===e?[t]:at(t,Vc.ID,e)}class Cu{static textContent(t,e,n){if(!n&&e.textContent)return void(t.textContent=e.textContent);const r=Au(bu(e,Vc.OPERATOR));r.length>1&&(t.textContent=r[1])}static isPunctuated(t){return!Yc.simpleCollapseStructure(t)&&t[1]&&Yc.contentCollapseStructure(t[1])}constructor(t){if(this.mathml=t,this.factory=new Qr,this.nodeDict={},this.mmlRoot=Ru(t),this.streeRoot=this.assembleTree(this.mmlRoot),isNaN(this.streeRoot.id))throw new k(`Failed to rebuild semantic tree for\n ${t}`);this.stree=Sl.fromNode(this.streeRoot,this.mathml),this.xml=this.stree.xml()}getTree(){return this.stree}assembleTree(t){const e=this.makeNode(t),n=Au(bu(t,Vc.CHILDREN)),r=Au(bu(t,Vc.CONTENT));if(0===r.length&&0===n.length)return Cu.textContent(e,t,this.isEmpty(e,t)),e;if(r.length>0){const t=Ou(this.mathml,r[0]);t&&Cu.textContent(e,t,!0)}e.contentNodes=r.map(t=>this.setParent(t,e)),e.childNodes=n.map(t=>this.setParent(t,e));const o=bu(t,Vc.COLLAPSED);return o?this.postProcess(e,o):e}makeNode(t){const e=bu(t,Vc.TYPE),n=bu(t,Vc.ROLE),r=bu(t,Vc.FONT),o=bu(t,Vc.ANNOTATION)||"",i=bu(t,Vc.ATTRIBUTES)||"",s=bu(t,Vc.ID),a=bu(t,Vc.EMBELLISHED),c=bu(t,Vc.FENCEPOINTER),l=this.createNode(parseInt(s,10));return l.type=e,l.role=n,l.font=r||bt.UNKNOWN,l.parseAnnotation(o),l.parseAttributes(i),c&&(l.fencePointer=c),a&&(l.embellished=a),l}makePunctuation(t){const e=this.createNode(t);return e.updateContent(Sn.invisibleComma),e.role=It.DUMMY,e}makePunctuated(t,e,n){const r=this.createNode(e[0]);r.type=St.PUNCTUATED,r.embellished=t.embellished,r.fencePointer=t.fencePointer,r.role=n,r.addAnnotation("general","script");const o=e.splice(1,1)[0].slice(1);r.contentNodes=o.map(this.makePunctuation.bind(this)),this.collapsedChildren_(e)}makeEmpty(t,e,n){const r=this.createNode(e);r.type=St.EMPTY,r.embellished=t.embellished,r.fencePointer=t.fencePointer,r.role=n}makeIndex(t,e,n){if(Cu.isPunctuated(e))return this.makePunctuated(t,e,n),void(e=e[0]);Yc.simpleCollapseStructure(e)&&!this.nodeDict[e.toString()]&&this.makeEmpty(t,e,n)}postProcess(t,e){const n=Yc.fromString(e).array;if(t.type===It.SUBSUP){const e=this.createNode(n[1][0]);return e.type=St.SUBSCRIPT,e.role=It.SUBSUP,t.type=St.SUPERSCRIPT,e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.makeIndex(t,n[1][2],It.RIGHTSUB),this.makeIndex(t,n[2],It.RIGHTSUPER),this.collapsedChildren_(n),t}if(t.type===St.SUBSCRIPT)return this.makeIndex(t,n[2],It.RIGHTSUB),this.collapsedChildren_(n),t;if(t.type===St.SUPERSCRIPT)return this.makeIndex(t,n[2],It.RIGHTSUPER),this.collapsedChildren_(n),t;if(t.type===St.TENSOR)return this.makeIndex(t,n[2],It.LEFTSUB),this.makeIndex(t,n[3],It.LEFTSUPER),this.makeIndex(t,n[4],It.RIGHTSUB),this.makeIndex(t,n[5],It.RIGHTSUPER),this.collapsedChildren_(n),t;if(t.type===St.PUNCTUATED){if(Cu.isPunctuated(n)){const e=n.splice(1,1)[0].slice(1);t.contentNodes=e.map(this.makePunctuation.bind(this))}return t}if(t.type===It.UNDEROVER){const e=this.createNode(n[1][0]);return t.childNodes[1].role===It.OVERACCENT?(e.type=St.OVERSCORE,t.type=St.UNDERSCORE):(e.type=St.UNDERSCORE,t.type=St.OVERSCORE),e.role=It.UNDEROVER,e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.collapsedChildren_(n),t}return t}createNode(t){const e=this.factory.makeNode(t);return this.nodeDict[t.toString()]=e,e}collapsedChildren_(t){const e=t=>{const n=this.nodeDict[t[0]];n.childNodes=[];for(let r=1,o=t.length;r<o;r++){const o=t[r];n.childNodes.push(Yc.simpleCollapseStructure(o)?this.nodeDict[o]:e(o))}return n};e(t)}setParent(t,e){const n=Ou(this.mathml,t),r=this.assembleTree(n);return r.parent=e,r}isEmpty(t,e){return t.type===St.EMPTY||(t.type===St.TEXT||t.role===It.SPACE)&&"MPHANTOM"===e.tagName.toUpperCase()}}const Lu=new L({AbsoluteValue:["Auto","AbsEnd","Cardinality","Determinant"],Bar:["Auto","Conjugate"],Caps:["Auto","SayCaps"],CombinationPermutation:["Auto","ChoosePermute"],Currency:["Auto","Position","Prefix"],Ellipses:["Auto","AndSoOn"],Enclosed:["Auto","EndEnclose"],Exponent:["Auto","AfterPower","Ordinal","OrdinalPower","Exponent"],Fraction:["Auto","EndFrac","FracOver","General","GeneralEndFrac","Ordinal","Over","OverEndFrac","Per"],Functions:["Auto","None","Reciprocal"],Inference:["Auto","Long"],ImpliedTimes:["Auto","MoreImpliedTimes","None"],Log:["Auto","LnAsNaturalLog"],Matrix:["Auto","Combinatoric","EndMatrix","EndVector","SilentColNum","SpeakColNum","Vector"],MultiLineLabel:["Auto","Case","Constraint","Equation","Line","None","Row","Step"],MultiLineOverview:["Auto","None"],MultiLinePausesBetweenColumns:["Auto","Long","Short"],MultsymbolDot:["Auto","Dot"],MultsymbolX:["Auto","By","Cross"],Paren:["Auto","CoordPoint","Interval","Silent","Speak","SpeakNestingLevel"],Prime:["Auto","Angle","Length"],Roots:["Auto","PosNegSqRoot","PosNegSqRootEnd","RootEnd"],SetMemberSymbol:["Auto","Belongs","Element","Member","In"],Sets:["Auto","SilentBracket","woAll"],TriangleSymbol:["Auto","Delta"],Trig:["Auto","ArcTrig","TrigInverse","Reciprocal"],VerticalLine:["Auto","Divides","Given","SuchThat"]}),Mu="Auto";function vu(t){const e=t.split(":"),n={},r=Lu.getProperties(),o=Object.keys(r);for(let t,i=0;t=e[i];i++){const e=t.split("_");if(-1===o.indexOf(e[0]))continue;const i=e[1];i&&i!==Mu&&-1!==r[e[0]].indexOf(i)&&(n[e[0]]=e[1])}return n}function wu(t){const e=Object.keys(t),n=[];for(let r=0;r<e.length;r++)n.push(e[r]+"_"+t[e[r]]);return n.length?n.join(":"):M.DEFAULT_VALUE}class Du extends M{static comparator(){return new Pu(B.getInstance().dynamicCstr,L.createProp([M.DEFAULT_VALUES[C.LOCALE]],[M.DEFAULT_VALUES[C.MODALITY]],[M.DEFAULT_VALUES[C.DOMAIN]],[M.DEFAULT_VALUES[C.STYLE]]))}static getLocalePreferences(t){const e=t||function(t={}){for(const e of Gn.values())for(const[,n]of e.rules.entries())for(const{cstr:e}of n)t=zn(e.getValues(),t);return t}(cc.getInstance().enumerate());return Du.getLocalePreferences_(e)}static relevantPreferences(t){const e=xu[t.type];if(!e)return"ImpliedTimes";const n=e[t.role]||e[""];return n?"string"==typeof n?n:function(t,e){for(const[n,r]of Object.entries(t))if(Fu(n,e))return r;return""}(n,t)||"ImpliedTimes":"ImpliedTimes"}static getLocalePreferences_(t){const e={};for(const n of Object.keys(t)){if(!t[n].speech||!t[n].speech.clearspeak)continue;const r=Object.keys(t[n].speech.clearspeak);if(r.length<3)continue;const o=e[n]={};for(const t in Lu.getProperties()){const e=Lu.getProperties()[t],n=[t+"_Auto"];if(e)for(const o of e)-1!==r.indexOf(t+"_"+o)&&n.push(t+"_"+o);o[t]=n}}return e}constructor(t,e){super(t),this.preference=e}equal(t){if(!super.equal(t))return!1;const e=Object.keys(this.preference),n=t.preference;if(e.length!==Object.keys(n).length)return!1;for(let t,r=0;t=e[r];r++)if(this.preference[t]!==n[t])return!1;return!0}}class Pu extends w{constructor(t,e){super(t,e),this.preference=t instanceof Du?t.preference:{}}match(t){if(!(t instanceof Du))return super.match(t);if("default"===t.getComponents()[C.STYLE])return!0;const e=Object.keys(t.preference);for(let n,r=0;n=e[r];r++)if(this.preference[n]!==t.preference[n])return!1;return!0}compare(t,e){const n=super.compare(t,e);if(0!==n)return n;const r=t instanceof Du,o=e instanceof Du;if(!r&&o)return 1;if(r&&!o)return-1;if(!r&&!o)return 0;const i=Object.keys(t.preference).length,s=Object.keys(e.preference).length;return i>s?-1:i<s?1:0}}const _u=[["AbsoluteValue",St.FENCED,It.NEUTRAL],["AbsoluteValue",St.FENCED,It.METRIC],["Bar",St.OVERSCORE,""],["Caps",St.IDENTIFIER,It.LATINLETTER,"category:Lu"],["CombinationPermutation",St.APPL,It.UNKNOWN],["Currency",St.IDENTIFIER,It.UNIT,"unit:currency"],["Currency",St.INFIXOP,It.UNIT,"unit:currency"],["Enclosed",St.ENCLOSE,""],["Ellipses",St.PUNCTUATION,It.ELLIPSIS],["Exponent",St.SUPERSCRIPT,""],["Fraction",St.FRACTION,""],["Functions",St.APPL,It.SIMPLEFUNC],["ImpliedTimes",St.OPERATOR,It.IMPLICIT],["Log",St.APPL,It.PREFIXFUNC,"appl:Logarithm"],["Log",St.FUNCTION,It.PREFIXFUNC,"category:Logarithm"],["Matrix",St.MATRIX,""],["Matrix",St.VECTOR,""],["MultiLineLabel",St.ROW,""],["MultiLineLabel",St.MULTILINE,It.LABEL],["MultiLinePausesBetweenColumns",St.MULTILINE,It.TABLE],["MultiLineOverview",St.MULTILINE,""],["MultiLineLabel",St.TABLE,It.LABEL],["MultiLinePausesBetweenColumns",St.TABLE,""],["MultiLineOverview",St.TABLE,""],["MultiLineLabel",St.CASES,It.LABEL],["MultiLinePausesBetweenColumns",St.CASES,""],["MultiLineOverview",St.CASES,""],["MultsymbolDot",St.OPERATOR,It.MULTIPLICATION,"content:22C5"],["MultsymbolX",St.OPERATOR,It.MULTIPLICATION,"content:00D7"],["Paren",St.FENCED,It.LEFTRIGHT],["Prime",St.PUNCTUATION,It.PRIME],["Roots",St.ROOT,""],["Roots",St.SQRT,""],["SetMemberSymbol",St.OPERATOR,It.ELEMENT],["Sets",St.FENCED,It.SETEXT],["TriangleSymbol",St.IDENTIFIER,It.GREEKLETTER,"content:0394"],["Trig",St.APPL,It.PREFIXFUNC,"appl:Trigonometric"],["Trig",St.FUNCTION,It.PREFIXFUNC,"category:Trigonometric"],["VerticalLine",St.PUNCTUATED,It.VBAR],["VerticalLine",St.PUNCTUATION,It.VBAR],["Inference",St.INFERENCE,""],["Inference",St.PREMISES,""],["Inference",St.RULELABEL,""],["Inference",St.CONCLUSION,""]],xu=function(){const t={};for(let e,n=0;e=_u[n];n++){const n=e[0],r=e[3];let o=t[e[1]];if(o||(o={},t[e[1]]=o),!r){o[e[2]]=n;continue}let i=o[e[2]];i||(i={},o[e[2]]=i),i[r]=n}return t}();function Fu(t,e){const[n,r]=t.split(":");if(!n)return!1;const o=Uu[n];return!!o&&o(e,r)}const Uu={category:(t,e)=>Kn(t.textContent)===e,content:(t,e)=>t.textContent===String.fromCodePoint(parseInt(e,16)),appl:(t,e)=>{const n=t.childNodes[0];return!!n&&Kn(n.textContent)===e},unit:(t,e)=>Kn(t.textContent+":unit")===e};var ku;function Bu(t,e=!1){return cc.getInstance().evaluateNode(t,e)}function Gu(t,e=!1){return ic(Bu(t,e))}function Vu(t){const e=function(t){return Bu(Sl.fromNode(t).xml())}(t);return ic(e)}function Hu(t,e,n){const r=at(n,"id",e.id.toString())[0],o=r?ic(Bu(r)):Vu(e);t.setAttribute(Vc.SPEECH,o)}function ju(t,e,n){const r=Vu(e);t.setAttribute(n,r)}function qu(t,e){const n=$u(e);n&&t.setAttribute(Vc.PREFIX,n)}function $u(t){const e=function(t){const e=Sl.fromRoot(t),n=X('.//*[@id="'+t.id+'"]',e.xml());let r=n[0];n.length>1&&(r=function(t,e){const n=e[0];if(!t.parent)return n;const r=[];for(;t;)r.push(t.id),t=t.parent;const o=function(t,e){for(;e.length&&e.shift().toString()===t.getAttribute("id")&&t.parentNode&&t.parentNode.parentNode;)t=t.parentNode.parentNode;return!e.length};for(let t,n=0;t=e[n];n++)if(o(t,r.slice()))return t;return n}(t,n)||r);return r}(t);return ic(Xu(e))}function Xu(t){return t?cc.getInstance().runInSetting({modality:"prefix",strict:!0,speech:!0},function(){return cc.getInstance().evaluateNode(t)}):[]}function Yu(t,e,n){const r=ct(e,"maction");for(let e,o=0;e=r[o];o++){const r=at(t,"id",e.getAttribute("id"))[0];if(!r)continue;const o=e.childNodes[1],i=o.getAttribute(Vc.ID);let s=Ou(t,i);if(s&&"dummy"!==s.getAttribute(Vc.TYPE))continue;if(s=r.childNodes[0],s.getAttribute("sre-highlighter-added"))continue;const a=o.getAttribute(Vc.PARENT);a&&s.setAttribute(Vc.PARENT,a),s.setAttribute(Vc.TYPE,"dummy"),s.setAttribute(Vc.ID,i),s.setAttribute("role","treeitem"),s.setAttribute("aria-level",o.getAttribute("aria-level"));at(n,"id",i)[0].setAttribute("alternative",i)}}function Wu(t){const e={};for(const[,n]of Object.entries(ku))e[n]=t.getAttribute(n);return e}function Ku(t,e){const n=ct(t,"maction"),r={};for(let t,o=0;t=n[o];o++){const n=parseInt(t.getAttribute("selection")),o=Array.from(t.childNodes),i=o.filter(t=>t.hasAttribute(ku.ID))[0],s=o[n-1];if(!i||i===s)continue;const a=i.getAttribute(Vc.ID);at(e,"id",a)[0].setAttribute("alternative",a),r[t.getAttribute("id")]=Wu(i)}return r}function zu(t,e={}){const n=e.locale?{locale:e.locale}:{};return t?cc.getInstance().runInSetting(Object.assign(n,{modality:"summary",strict:!1,speech:!0}),function(){return cc.getInstance().evaluateNode(t)}):[]}function Qu(t){const e=[];return t.getAttribute("role")===It.MGLYPH&&e.push(new tr({text:"image",personality:{}})),t.hasAttribute("href")&&e.push(new tr({text:"link",personality:{}})),cc.getInstance().speechStructure.addNode(t,e,"postfix"),e}function Ju(t){Bu(t,!0);const e=cc.getInstance().speechStructure;return function(t){t.completeModality("speech",Bu),t.completeModality("prefix",Xu),t.completeModality("postfix",Qu),t.completeModality("summary",zu)}(e),e.json(["none","ssml"])}function Zu(t,e=y){var n;if("speech"!==t.modality)return t;return Du.getLocalePreferences()[t.locale]?(t.domain="mathspeak"===t.domain?"clearspeak":"mathspeak",t.style=null!==(n=e[t.domain])&&void 0!==n?n:t.style,t):t}function th(t,e){const{modality:n,domain:r,style:o,locale:i}=e;if("speech"!==n)return o;if("mathspeak"===r){const t=["default","brief","sbrief"],e=t.indexOf(o);return-1===e?o:e>=t.length-1?t[0]:t[e+1]}if("clearspeak"===r){const e=Du.getLocalePreferences()[i];if(!e)return"default";const n=Du.relevantPreferences(t),r=function(t,e){return"default"===t?Mu:vu(t)[e]||Mu}(o,n),s=e[n].map(function(t){return t.split("_")[1]}),a=s.indexOf(r);if(-1===a)return o;const c=function(t,e,n){if("default"===t)return e+"_"+n;const r=vu(t);return r[e]=n,wu(r)}(o,n,a>=s.length-1?s[0]:s[a+1]);return c}return o}function eh(t){var e;const{domain:n,style:r,domain2style:o}=t,i={};if(!o)return Object.assign(i,y),i[n]=r,i;const s=o.split(",");for(const t of s){const[n,r]=t.split(/:(.*)/);i[n]=r||(null!==(e=y[n])&&void 0!==e?e:"default")}return i}function nh(t){const e=[];for(const[n,r]of Object.entries(t))e.push(`${n}:${r}`);return e.join(",")}B.getInstance().comparators.clearspeak=Du.comparator,B.getInstance().parsers.clearspeak=new class extends v{constructor(){super([C.LOCALE,C.MODALITY,C.DOMAIN,C.STYLE])}parse(t){const e=super.parse(t);let n=e.getValue(C.STYLE);const r=e.getValue(C.LOCALE),o=e.getValue(C.MODALITY);let i={};return n!==M.DEFAULT_VALUE&&(i=this.fromPreference(n),n=this.toPreference(i)),new Du({locale:r,modality:o,domain:"clearspeak",style:n},i)}fromPreference(t){return vu(t)}toPreference(t){return wu(t)}},function(t){t.ID="data-semantic-id",t.PARENT="data-semantic-parent",t.LEVEL="aria-level",t.POS="aria-posinset",t.ROLE="role"}(ku||(ku={}));class rh{constructor(){this.modality=$c("speech"),this.rebuilt_=null,this.options_={}}getRebuilt(){return this.rebuilt_}setRebuilt(t){this.rebuilt_=t}computeRebuilt(t,e=!1){return this.rebuilt_&&!e||(this.rebuilt_=new Cu(t)),this.rebuilt_}setOptions(t){this.options_=t||{},this.modality=$c(this.options_.modality||"speech")}setOption(t,e){const n=this.getOptions();n[t]=e,this.setOptions(n)}getOptions(){return this.options_}generateSpeech(t,e){return this.rebuilt_||(this.rebuilt_=new Cu(e)),Cc(this.options_),Gu(this.getRebuilt().xml)}nextRules(){this.setOptions(Zu(this.getOptions()))}nextStyle(t){this.setOption("style",th(this.getRebuilt().nodeDict[t],this.getOptions()))}getLevel(t){return Pt.MESSAGES.navigate.LEVEL+" "+t}getActionable(t){return t?t<0?Pt.MESSAGES.navigate.EXPANDABLE:Pt.MESSAGES.navigate.COLLAPSIBLE:""}}class oh extends rh{getSpeech(t,e){const n=this.generateSpeech(t,e);return t.setAttribute(this.modality,n),n}}class ih extends rh{constructor(){super(...arguments),this.modality=$c("foreground"),this.contrast=new Su}static visitStree_(t,e,n){if(t.childNodes.length){if(t.contentNodes.length&&("punctuated"===t.type&&t.contentNodes.forEach(t=>n[t.id]=!0),"implicit"!==t.role&&e.push(t.contentNodes.map(t=>t.id))),t.childNodes.length){if("implicit"===t.role){const r=[];let o=[];for(const e of t.childNodes){const t=[];ih.visitStree_(e,t,n),t.length<=2&&r.push(t.shift()),o=o.concat(t)}return e.push(r),void o.forEach(t=>e.push(t))}t.childNodes.forEach(t=>ih.visitStree_(t,e,n))}}else n[t.id]||e.push(t.id)}getSpeech(t,e){return bu(t,this.modality)}generateSpeech(t,e){return this.getRebuilt()||this.setRebuilt(new Cu(K(e))),this.colorLeaves_(t),bu(t,this.modality)}colorLeaves_(t){const e=[];ih.visitStree_(this.getRebuilt().streeRoot,e,{});for(const n of e){const e=this.contrast.generate();let r=!1;r=Array.isArray(n)?n.map(n=>this.colorLeave_(t,n,e)).reduce((t,e)=>t||e,!1):this.colorLeave_(t,n.toString(),e),r&&this.contrast.increment()}}colorLeave_(t,e,n){const r=Ou(t,e);return!!r&&(r.setAttribute(this.modality,n),!0)}}class sh extends rh{getSpeech(t,e){return bu(t,this.modality)}}class ah extends rh{getSpeech(t,e){return""}}class ch extends rh{getSpeech(t,e,n=null){this.getRebuilt()&&Yu(t,e,this.getRebuilt().xml);const r=this.generateSpeech(t,e),o=this.getRebuilt().nodeDict;for(const[r,i]of Object.entries(o)){const o=Ou(e,r),s=Ou(t,r)||n&&Ou(n,r);o&&s&&(this.modality&&this.modality!==Vc.SPEECH?ju(s,i,this.modality):Hu(s,i,this.getRebuilt().xml),this.modality===Vc.SPEECH&&qu(s,i))}return r}}class lh extends ch{getSpeech(t,e){return super.getSpeech(t,e),bu(t,this.modality)}}class uh extends rh{getSpeech(t,e){Cc(this.getOptions());const n=t.getAttribute(Vc.ID);ju(t,this.getRebuilt().streeRoot.querySelectorAll(t=>t.id.toString()===n)[0],this.modality);return t.getAttribute(Vc.SUMMARY)}}function hh(t){return(dh[t]||dh.Direct)()}const dh={Adhoc:()=>new oh,Color:()=>new ih,Direct:()=>new sh,Dummy:()=>new ah,Node:()=>new lh,Summary:()=>new uh,Tree:()=>new ch};class fh{static factory(t,e,n,r){const o=t=>Ou(r,t),i=n.nodeDict,s=o(t),a=e.map(o),c=e.map(function(t){return i[t]}),l=new fh(c,i[t]);return l.domNodes=a,l.domPrimary_=s,l.allNodes=fh.generateAllVisibleNodes_(e,a,i,r),l}static generateAllVisibleNodes_(t,e,n,r){let o=[];for(let i=0,s=t.length;i<s;i++){if(e[i]){const n=fh.getAllVisibleNodes([t[i]],r);n.length?o=o.concat(n):o.push(e[i]);continue}const s=n[t[i]];if(!s)continue;const a=s.childNodes.map(t=>t.id.toString()),c=fh.getAllVisibleNodes(a,r);o=o.concat(fh.generateAllVisibleNodes_(a,c,n,r))}return o}static getAllVisibleNodes(t,e){let n=[];for(const r of t)n=n.concat(yu(e,r));return n}constructor(t,e){this.nodes=t,this.primary=e,this.domNodes=[],this.domPrimary_=null,this.allNodes=[]}getSemanticPrimary(){return this.primary}getSemanticNodes(){return this.nodes}getNodes(){return this.allNodes}getDomNodes(){return this.domNodes}getDomPrimary(){return this.domPrimary_}toString(){return"Primary:"+this.domPrimary_+" Nodes:"+this.domNodes}clone(){const t=new fh(this.nodes,this.primary);return t.domNodes=this.domNodes,t.domPrimary_=this.domPrimary_,t.allNodes=this.allNodes,t}}var ph;!function(t){t.UP="up",t.DOWN="down",t.LEFT="left",t.RIGHT="right",t.REPEAT="repeat",t.DEPTH="depth",t.ENTER="enter",t.EXPAND="expand",t.HOME="home",t.SUMMARY="summary",t.DETAIL="detail",t.ROW="row",t.CELL="cell"}(ph||(ph={}));class mh{static resetState(t){delete mh.STATE[t]}static setState(t,e){mh.STATE[t]=e}static getState(t){return mh.STATE[t]}}mh.STATE={};class gh{constructor(t,e,n,r){this.node=t,this.generator=e,this.highlighter=n,this.modifier=!1,this.keyMapping=new Map([[pa.UP,this.up.bind(this)],[pa.DOWN,this.down.bind(this)],[pa.RIGHT,this.right.bind(this)],[pa.LEFT,this.left.bind(this)],[pa.TAB,this.repeat.bind(this)],[pa.DASH,this.expand.bind(this)],[pa.SPACE,this.depth.bind(this)],[pa.HOME,this.home.bind(this)],[pa.X,this.summary.bind(this)],[pa.Z,this.detail.bind(this)],[pa.V,this.virtualize.bind(this)],[pa.P,this.previous.bind(this)],[pa.U,this.undo.bind(this)],[pa.LESS,this.previousRules.bind(this)],[pa.GREATER,this.nextRules.bind(this)]]),this.cursors=[],this.xml_=null,this.rebuilt_=null,this.focus_=null,this.active_=!1,this.node.id?this.id=this.node.id:this.node.hasAttribute(gh.SRE_ID_ATTR)?this.id=this.node.getAttribute(gh.SRE_ID_ATTR):(this.node.setAttribute(gh.SRE_ID_ATTR,gh.ID_COUNTER.toString()),this.id=gh.ID_COUNTER++),this.rootNode=Ru(t),this.rootId=this.rootNode.getAttribute(Vc.ID),this.xmlString_=r,this.moved=ph.ENTER}getXml(){return this.xml_||(this.xml_=K(this.xmlString_)),this.xml_}getRebuilt(){return this.rebuilt_||this.rebuildStree(),this.rebuilt_}isActive(){return this.active_}activate(){this.isActive()||this.toggleActive_()}deactivate(){this.isActive()&&(mh.setState(this.id,this.primaryId()),this.toggleActive_())}getFocus(t=!1){return null===this.rootId&&this.getRebuilt(),this.focus_||(this.focus_=this.singletonFocus(this.rootId)),t&&this.updateFocus(),this.focus_}setFocus(t){this.focus_=t}getDepth(){return this.levels.depth()-1}isSpeech(){return this.generator.modality===Vc.SPEECH}focusDomNodes(){return this.getFocus().getDomNodes()}focusSemanticNodes(){return this.getFocus().getSemanticNodes()}speech(){const t=this.focusDomNodes();if(!t.length)return"";const e=this.specialMove();if(null!==e)return e;switch(this.moved){case ph.DEPTH:return this.depth_();case ph.SUMMARY:return this.summary_();case ph.DETAIL:return this.detail_();default:{const e=[],n=this.focusSemanticNodes();for(let r=0,o=t.length;r<o;r++){const o=t[r],i=n[r];e.push(o?this.generator.getSpeech(o,this.getXml(),this.node):Vu(i))}return this.mergePrefix_(e)}}}move(t){const e=this.keyMapping.get(t);if(!e)return null;const n=e();return!(!n||n===this.getFocus())&&(this.setFocus(n),this.moved===ph.HOME&&(this.levels=this.initLevels()),!0)}up(){return this.moved=ph.UP,this.getFocus()}down(){return this.moved=ph.DOWN,this.getFocus()}left(){return this.moved=ph.LEFT,this.getFocus()}right(){return this.moved=ph.RIGHT,this.getFocus()}repeat(){return this.moved=ph.REPEAT,this.getFocus().clone()}depth(){return this.moved=this.isSpeech()?ph.DEPTH:ph.REPEAT,this.getFocus().clone()}home(){this.moved=ph.HOME;return this.singletonFocus(this.rootId)}getBySemanticId(t){return Ou(this.node,t)}primaryId(){return this.getFocus().getSemanticPrimary().id.toString()}expand(){const t=this.getFocus().getDomPrimary(),e=this.actionable_(t);return e?(this.moved=ph.EXPAND,e.dispatchEvent(new Event("click")),this.getFocus().clone()):this.getFocus()}expandable(t){return!!this.actionable_(t)&&0===t.childNodes.length}collapsible(t){return!!this.actionable_(t)&&t.childNodes.length>0}restoreState(){if(!this.highlighter)return;const t=mh.getState(this.id);if(!t)return;let e=this.getRebuilt().nodeDict[t];const n=[];for(;e;)n.push(e.id),e=e.parent;for(n.pop();n.length>0;){this.down();const t=n.pop(),e=this.findFocusOnLevel(t);if(!e)break;this.setFocus(e)}this.moved=ph.ENTER}updateFocus(){this.setFocus(fh.factory(this.getFocus().getSemanticPrimary().id.toString(),this.getFocus().getSemanticNodes().map(t=>t.id.toString()),this.getRebuilt(),this.node))}rebuildStree(){this.rebuilt_=new Cu(this.getXml()),this.rootId=this.rebuilt_.stree.root.id.toString(),this.generator.setRebuilt(this.rebuilt_),this.skeleton=Yc.fromTree(this.rebuilt_.stree),this.skeleton.populate(),this.focus_=this.singletonFocus(this.rootId),this.levels=this.initLevels(),Yu(this.node,this.getXml(),this.rebuilt_.xml)}previousLevel(){const t=this.getFocus().getDomPrimary();return t?bu(t,Vc.PARENT):this.getFocus().getSemanticPrimary().parent.id.toString()}nextLevel(){const t=this.getFocus().getDomPrimary();let e,n;if(t){e=Au(bu(t,Vc.CHILDREN)),n=Au(bu(t,Vc.CONTENT));const r=bu(t,Vc.TYPE),o=bu(t,Vc.ROLE);return this.combineContentChildren(r,o,n,e)}const r=t=>t.id.toString(),o=this.getRebuilt().nodeDict[this.primaryId()];return e=o.childNodes.map(r),n=o.contentNodes.map(r),0===e.length?[]:this.combineContentChildren(o.type,o.role,n,e)}singletonFocus(t){this.getRebuilt();const e=this.retrieveVisuals(t);return this.focusFromId(t,e)}retrieveVisuals(t){if(!this.skeleton)return[t];const e=parseInt(t,10),n=this.skeleton.subtreeNodes(e);if(!n.length)return[t];n.unshift(e);const r={},o=[];Y(this.getXml());for(const t of n)r[t]||(o.push(t.toString()),r[t]=!0,this.subtreeIds(t,r));return o}subtreeIds(t,e){const n=X(`//*[@data-semantic-id="${t}"]`,this.getXml());X("*//@data-semantic-id",n[0]).forEach(t=>e[parseInt(t.textContent,10)]=!0)}focusFromId(t,e){return fh.factory(t,e,this.getRebuilt(),this.node)}summary(){return this.moved=this.isSpeech()?ph.SUMMARY:ph.REPEAT,this.getFocus().clone()}detail(){return this.moved=this.isSpeech()?ph.DETAIL:ph.REPEAT,this.getFocus().clone()}specialMove(){return null}virtualize(t){return this.cursors.push({focus:this.getFocus(),levels:this.levels,undo:t||!this.cursors.length}),this.levels=this.levels.clone(),this.getFocus().clone()}previous(){const t=this.cursors.pop();return t?(this.levels=t.levels,t.focus):this.getFocus()}undo(){let t;do{t=this.cursors.pop()}while(t&&!t.undo);return t?(this.levels=t.levels,t.focus):this.getFocus()}update(t){Cc(t).then(()=>hh("Tree").getSpeech(this.node,this.getXml()))}nextRules(){this.generator.nextRules();const t=this.generator.getOptions();return"speech"!==t.modality?this.getFocus():(this.update(t),this.moved=ph.REPEAT,this.getFocus().clone())}previousRules(){var t;this.generator.nextStyle(null===(t=this.getFocus().getSemanticPrimary())||void 0===t?void 0:t.id.toString());const e=this.generator.getOptions();return"speech"!==e.modality?this.getFocus():(this.update(e),this.moved=ph.REPEAT,this.getFocus().clone())}refocus(){let t,e=this.getFocus();for(;!e.getNodes().length;){t=this.levels.peek();const n=this.up();if(!n)break;this.setFocus(n),e=this.getFocus(!0)}this.levels.push(t),this.setFocus(e)}toggleActive_(){this.active_=!this.active_}mergePrefix_(t,e=[]){const n=this.isSpeech()?this.prefix_():"";n&&t.unshift(n);const r=this.isSpeech()?this.postfix_():"";return r&&t.push(r),sc(function(t){const e=t.map(t=>"string"==typeof t?Qn.stringEmpty(t):t),n=oc.get(B.getInstance().options.markup);return n?n.merge(e):t.join()}(e.concat(t)))}prefix_(){const t=this.getFocus().getDomNodes(),e=this.getFocus().getSemanticNodes();return t[0]?bu(t[0],Vc.PREFIX):$u(e[0])}postfix_(){const t=this.getFocus().getDomNodes();return t[0]?bu(t[0],Vc.POSTFIX):""}depth_(){const t=Gt.getInstance().getParameter("depth");Gt.getInstance().setParameter("depth",!0);const e=this.getFocus().getDomPrimary(),n=this.expandable(e)?Pt.MESSAGES.navigate.EXPANDABLE:this.collapsible(e)?Pt.MESSAGES.navigate.COLLAPSIBLE:"",r=Pt.MESSAGES.navigate.LEVEL+" "+this.getDepth(),o=$u(this.getFocus().getSemanticNodes()[0]),i=[new tr({text:r,personality:{}}),new tr({text:o,personality:{}}),new tr({text:n,personality:{}})];return Gt.getInstance().setParameter("depth",t),sc(ic(i))}actionable_(t){const e=null==t?void 0:t.parentNode;return e&&this.highlighter.isMactionNode(e)?e:null}summary_(){const t=this.getFocus().getSemanticPrimary().id.toString(),e=function(t,e={}){return ic(zu(t,e))}(this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:at(this.getRebuilt().xml,"id",t)[0]);return this.mergePrefix_([e])}detail_(){const t=this.getFocus().getSemanticPrimary().id.toString(),e=this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:at(this.getRebuilt().xml,"id",t)[0],n=e.getAttribute("alternative");e.removeAttribute("alternative");const r=Gu(e),o=this.mergePrefix_([r]);return e.setAttribute("alternative",n),o}}gh.ID_COUNTER=0,gh.SRE_ID_ATTR="sre-explorer-id";class Eh extends gh{up(){return null}down(){return null}left(){return null}right(){return null}repeat(){return null}depth(){return null}home(){return null}getDepth(){return 0}initLevels(){return null}combineContentChildren(t,e,n,r){return[]}findFocusOnLevel(t){return null}}class Nh{constructor(){this.level_=[]}push(t){this.level_.push(t)}pop(){return this.level_.pop()}peek(){return this.level_[this.level_.length-1]||null}indexOf(t){const e=this.peek();return e?e.indexOf(t):null}find(t){const e=this.peek();if(!e)return null;for(let n=0,r=e.length;n<r;n++)if(t(e[n]))return e[n];return null}get(t){const e=this.peek();return!e||t<0||t>=e.length?null:e[t]}depth(){return this.level_.length}clone(){const t=new Nh;return t.level_=this.level_.slice(0),t}toString(){let t="";for(let e,n=0;e=this.level_[n];n++)t+="\n"+e.map(function(t){return t.toString()});return t}}class Sh extends gh{constructor(t,e,n,r){super(t,e,n,r),this.node=t,this.generator=e,this.highlighter=n,this.levels=null,this.restoreState()}initLevels(){const t=new Nh;return t.push([this.getFocus()]),t}up(){super.up();const t=this.previousLevel();if(!t)return null;this.levels.pop();return this.levels.find(function(e){return e.getSemanticNodes().some(function(e){return e.id.toString()===t})})}down(){super.down();const t=this.nextLevel();return 0===t.length?null:(this.levels.push(t),t[0])}combineContentChildren(t,e,n,r){switch(t){case St.RELSEQ:case St.INFIXOP:case St.MULTIREL:return this.makePairList(r,n);case St.PREFIXOP:return[this.focusFromId(r[0],n.concat(r))];case St.POSTFIXOP:return[this.focusFromId(r[0],r.concat(n))];case St.MATRIX:case St.VECTOR:case St.FENCED:return[this.focusFromId(r[0],[n[0],r[0],n[1]])];case St.CASES:return[this.focusFromId(r[0],[n[0],r[0]])];case St.PUNCTUATED:return e===It.TEXT?r.map(this.singletonFocus.bind(this)):r.length===n.length?n.map(this.singletonFocus.bind(this)):this.combinePunctuations(r,n,[],[]);case St.APPL:return[this.focusFromId(r[0],[r[0],n[0]]),this.singletonFocus(r[1])];case St.ROOT:return[this.singletonFocus(r[0]),this.singletonFocus(r[1])];default:return r.map(this.singletonFocus.bind(this))}}combinePunctuations(t,e,n,r){if(0===t.length)return r;const o=t.shift(),i=e.shift();return o===i?(n.push(i),this.combinePunctuations(t,e,n,r)):(e.unshift(i),n.push(o),t.length===e.length?(r.push(this.focusFromId(o,n.concat(e))),r):(r.push(this.focusFromId(o,n)),this.combinePunctuations(t,e,[],r)))}makePairList(t,e){if(0===t.length)return[];if(1===t.length)return[this.singletonFocus(t[0])];const n=[this.singletonFocus(t.shift())];for(let r=0,o=t.length;r<o;r++)n.push(this.focusFromId(t[r],[e[r],t[r]]));return n}left(){super.left();const t=this.levels.indexOf(this.getFocus());if(null===t)return null;const e=this.levels.get(t-1);return e||null}right(){super.right();const t=this.levels.indexOf(this.getFocus());if(null===t)return null;const e=this.levels.get(t+1);return e||null}findFocusOnLevel(t){return this.levels.find(e=>e.getSemanticPrimary().id===t)}}class Th extends gh{constructor(t,e,n,r){super(t,e,n,r),this.node=t,this.generator=e,this.highlighter=n,this.levels=null,this.restoreState()}initLevels(){const t=new Nh;return t.push([this.primaryId()]),t}up(){super.up();const t=this.previousLevel();return t?(this.levels.pop(),this.singletonFocus(t)):null}down(){super.down();const t=this.nextLevel();if(0===t.length)return null;const e=this.singletonFocus(t[0]);return e&&this.levels.push(t),e}combineContentChildren(t,e,n,r){switch(t){case St.RELSEQ:case St.INFIXOP:case St.MULTIREL:return Ir(r,n);case St.PREFIXOP:return n.concat(r);case St.POSTFIXOP:return r.concat(n);case St.MATRIX:case St.VECTOR:case St.FENCED:return r.unshift(n[0]),r.push(n[1]),r;case St.CASES:return r.unshift(n[0]),r;case St.PUNCTUATED:return e===It.TEXT?Ir(r,n):r;case St.APPL:return[r[0],n[0],r[1]];case St.ROOT:return[r[0],r[1]];default:return r}}left(){super.left();const t=this.levels.indexOf(this.primaryId());if(null===t)return null;const e=this.levels.get(t-1);return e?this.singletonFocus(e):null}right(){super.right();const t=this.levels.indexOf(this.primaryId());if(null===t)return null;const e=this.levels.get(t+1);return e?this.singletonFocus(e):null}findFocusOnLevel(t){return this.singletonFocus(t.toString())}focusDomNodes(){return[this.getFocus().getDomPrimary()]}focusSemanticNodes(){return[this.getFocus().getSemanticPrimary()]}}class Ih extends Th{constructor(t,e,n,r){super(t,e,n,r),this.node=t,this.generator=e,this.highlighter=n,this.firstJump=null,this.key_=null,this.row_=0,this.currentTable_=null,this.keyMapping.set(pa.ZERO,this.jumpCell.bind(this)),this.keyMapping.set(pa.ONE,this.jumpCell.bind(this)),this.keyMapping.set(pa.TWO,this.jumpCell.bind(this)),this.keyMapping.set(pa.THREE,this.jumpCell.bind(this)),this.keyMapping.set(pa.FOUR,this.jumpCell.bind(this)),this.keyMapping.set(pa.FIVE,this.jumpCell.bind(this)),this.keyMapping.set(pa.SIX,this.jumpCell.bind(this)),this.keyMapping.set(pa.SEVEN,this.jumpCell.bind(this)),this.keyMapping.set(pa.EIGHT,this.jumpCell.bind(this)),this.keyMapping.set(pa.NINE,this.jumpCell.bind(this))}move(t){this.key_=t;const e=super.move(t);return this.modifier=!1,e}up(){return this.moved=ph.UP,this.eligibleCell_()?this.verticalMove_(!1):super.up()}down(){return this.moved=ph.DOWN,this.eligibleCell_()?this.verticalMove_(!0):super.down()}jumpCell(){if(!this.isInTable_()||null===this.key_)return this.getFocus();if(this.moved===ph.ROW){this.moved=ph.CELL;const t=this.key_-pa.ZERO;return this.isLegalJump_(this.row_,t)?this.jumpCell_(this.row_,t):this.getFocus()}const t=this.key_-pa.ZERO;return t>this.currentTable_.childNodes.length?this.getFocus():(this.row_=t,this.moved=ph.ROW,this.getFocus().clone())}undo(){const t=super.undo();return t===this.firstJump&&(this.firstJump=null),t}eligibleCell_(){const t=this.getFocus().getSemanticPrimary();return this.modifier&&t.type===St.CELL&&-1!==Ih.ELIGIBLE_CELL_ROLES.indexOf(t.role)}verticalMove_(t){const e=this.previousLevel();if(!e)return null;const n=this.getFocus(),r=this.levels.indexOf(this.primaryId()),o=this.levels.pop(),i=this.levels.indexOf(e),s=this.levels.get(t?i+1:i-1);if(!s)return this.levels.push(o),null;this.setFocus(this.singletonFocus(s));const a=this.nextLevel();return a[r]?(this.levels.push(a),this.singletonFocus(a[r])):(this.setFocus(n),this.levels.push(o),null)}jumpCell_(t,e){this.firstJump?this.virtualize(!1):(this.firstJump=this.getFocus(),this.virtualize(!0));const n=this.currentTable_.id.toString();let r;do{r=this.levels.pop()}while(-1===r.indexOf(n));this.levels.push(r),this.setFocus(this.singletonFocus(n)),this.levels.push(this.nextLevel());const o=this.currentTable_.childNodes[t-1];return this.setFocus(this.singletonFocus(o.id.toString())),this.levels.push(this.nextLevel()),this.singletonFocus(o.childNodes[e-1].id.toString())}isLegalJump_(t,e){const n=at(this.getRebuilt().xml,"id",this.currentTable_.id.toString())[0];if(!n||n.hasAttribute("alternative"))return!1;const r=this.currentTable_.childNodes[t-1];if(!r)return!1;const o=at(n,"id",r.id.toString())[0];return!(!o||o.hasAttribute("alternative"))&&!(!r||!r.childNodes[e-1])}isInTable_(){let t=this.getFocus().getSemanticPrimary();for(;t;){if(-1!==Ih.ELIGIBLE_TABLE_TYPES.indexOf(t.type))return this.currentTable_=t,!0;t=t.parent}return!1}}Ih.ELIGIBLE_CELL_ROLES=[It.DETERMINANT,It.ROWVECTOR,It.BINOMIAL,It.SQUAREMATRIX,It.MULTILINE,It.MATRIX,It.VECTOR,It.CASES,It.TABLE],Ih.ELIGIBLE_TABLE_TYPES=[St.MULTILINE,St.MATRIX,St.VECTOR,St.CASES,St.TABLE];const Ah={dummy:(t,e,n,r)=>new Eh(t,e,n,r),semantic:(t,e,n,r)=>new Sh(t,e,n,r),syntax:(t,e,n,r)=>new Th(t,e,n,r),table:(t,e,n,r)=>new Ih(t,e,n,r)};class bh{static stringify_(t){return t?t.toString():t}constructor(t,e){this.name=t,this.process=e.processor,this.postprocess=e.postprocessor||((t,e)=>t),this.processor=this.postprocess?function(t){return this.postprocess(this.process(t),t)}:this.process,this.print=e.print||bh.stringify_,this.pprint=e.pprint||this.print}}bh.LocalState={walker:null,speechGenerator:null,highlighter:null};class Rh extends bh{static getKey_(t){return"string"==typeof t?pa[t.toUpperCase()]:t}constructor(t,e){super(t,e),this.key=e.key||Rh.getKey_}}const Oh=new Map;function yh(t){Oh.set(t.name,t)}function Ch(t){const e=Oh.get(t);if(!e)throw new k("Unknown processor "+t);return e}function Lh(t,e){const n=Ch(t);try{return n.processor(e)}catch(t){if(t instanceof k)throw t;throw new k(`Processing error for expression\n ${e}`)}}function Mh(t,e){const n=Ch(t);try{const t=n.processor(e);return B.getInstance().options.pprint?n.pprint(t):n.print(t)}catch(t){if(t instanceof k)throw t;throw new k(`Processing error for expression\n ${e}`)}}function vh(t,e){return Lh(t,e)}function wh(t){return t.children?(t.children&&t.children.forEach(t=>t.child=!0),t.content&&t.content.forEach(t=>t.cont=!0),t.children=Yc.combineContentChildren(t.type,t.role,t.content||[],t.children||[]),t.children.forEach(t=>wh(t)),t):t}function Dh(t,e,n,r={}){var o;if(t.options=r,t.mactions=Ku(e,n),!1===r.enableSpeech)return;t.speech=Ju(n);const i=null===(o=n.childNodes[0])||void 0===o?void 0:o.getAttribute("id"),s=st(n,"href").length;if(s){const e=`${s} ${1===s?"link":"links"}`;t.speech[i]["postfix-none"]=t.speech[i]["postfix-none"]?t.speech[i]["postfix-none"]+`, ${e}`:e,t.speech[i]["postfix-ssml"]=t.speech[i]["postfix-ssml"]?t.speech[i]["postfix-ssml"]+` <break time="250ms"/> ${e}`:e}t.label=t.speech[i]["speech-none"]+(t.speech[i]["postfix-none"]?`, ${t.speech[i]["postfix-none"]}`:""),t.ssml=t.speech[i]["speech-ssml"]+(t.speech[i]["postfix-ssml"]?` <prosody pitch="+30%" rate="+20%"> ${t.speech[i]["postfix-ssml"]} </prosody>`:""),t.translations=Object.assign({},Pt.MESSAGES.navigate)}function Ph(t){return vh("speech",t)}function _h(t){return vh("semantic",t)}function xh(t){return vh("json",t)}function Fh(t){return vh("vis",t)}function Uh(t){return vh("description",t)}function kh(t){return vh("enriched",t)}function Bh(t){return vh("speechStructure",t)}function Gh(t){return vh("number",t)}function Vh(t){return vh("ordinal",t)}function Hh(t){return vh("numericOrdinal",t)}function jh(t){return vh("vulgar",t)}function qh(t){return Mh("walker",t)}function $h(t){return function(t,e){const n=Ch(t),r=n instanceof Rh?n.key(e):e,o=n.processor(r);return B.getInstance().options.pprint?n.pprint(o):n.print(o)}("move",t)}yh(new bh("semantic",{processor:function(t){return Il(K(t),B.getInstance().options)},postprocessor:function(t,e){const n=B.getInstance().options.speech;if(n===R.NONE)return t;const r=ut(t);let o=Gu(r,!0);if(n===R.SHALLOW)return t.setAttribute("speech",sc(o)),t;const i=X(".//*[@id]",t),s=X(".//*[@id]",r);for(let t,e,n=0;t=i[n],e=s[n];n++)o=Gu(e),t.setAttribute("speech",sc(o));return t},pprint:function(t){return ot(t.toString())}})),yh(new bh("speech",{processor:function(t){return sc(ic(Bu(Il(K(t),B.getInstance().options),!0)))},pprint:function(t){const e=t.toString();return oc.get(B.getInstance().options.markup)instanceof Pa?ot(e):e}})),yh(new bh("json",{processor:function(t){return Al(K(t),B.getInstance().options).toJson()},postprocessor:function(t,e){const n=B.getInstance().options.speech;if(n===R.NONE)return t;const r=Il(K(e),B.getInstance().options),o=Gu(r);if(n===R.SHALLOW)return t.stree.speech=sc(o),t;const i=t=>{const e=Gu(X(`.//*[@id=${t.id}]`,r)[0]);t.speech=sc(e),t.children&&t.children.forEach(i)};return i(t.stree),t},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),yh(new bh("vis",{processor:function(t){const e=Al(K(t),B.getInstance().options).toJson();return e.stree=wh(e.stree),e},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),yh(new bh("description",{processor:function(t){return Bu(Il(K(t),B.getInstance().options),!0)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),yh(new bh("enriched",{processor:function(t){return function(t,e){const n=K(t);try{return du(n,e)}catch(t){return console.error(t),n}}(t,B.getInstance().options)},postprocessor:function(t,e){const n=Ru(t);let r;switch(B.getInstance().options.speech){case R.NONE:break;case R.SHALLOW:r=hh("Adhoc"),r.getSpeech(n,t);break;case R.DEEP:r=hh("Tree"),r.getSpeech(t,t)}return t},pprint:function(t){return ot(t.toString())}})),yh(new bh("rebuild",{processor:function(t){return new Cu(K(t)).stree.xml()},pprint:function(t){return ot(t.toString())}})),yh(new bh("walker",{processor:function(t){const e=hh("Node");bh.LocalState.speechGenerator=e,e.setOptions({modality:B.getInstance().options.modality,locale:B.getInstance().options.locale,domain:B.getInstance().options.domain,style:B.getInstance().options.style}),bh.LocalState.highlighter=function(t,e,n){const r=new Nu(t,e),o="NativeMML"===n.renderer&&"Safari"===n.browser?"MML-CSS":"SVG"===n.renderer&&"v3"===n.browser?"SVG-V3":n.renderer,i=new(Iu[o]||Iu.NativeMML);return i.setColor(r),i}({color:"black"},{color:"white"},{renderer:"NativeMML"});const n=Lh("enriched",t),r=function(t,e){const n=Ch(t);return B.getInstance().options.pprint?n.pprint(e):n.print(e)}("enriched",n);return bh.LocalState.walker=function(t,e,n,r,o){return(Ah[t.toLowerCase()]||Ah.dummy)(e,n,r,o)}(B.getInstance().options.walker,n,e,bh.LocalState.highlighter,r),bh.LocalState.walker},print:function(t){return bh.LocalState.walker.speech()}})),yh(new Rh("move",{processor:function(t){if(!bh.LocalState.walker)return null;return!1===bh.LocalState.walker.move(t)?function(t){const e=oc.get(B.getInstance().options.markup);return e?e.error(t):""}(t):bh.LocalState.walker.speech()}})),yh(new bh("number",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":Pt.NUMBERS.numberToWords(e)}})),yh(new bh("ordinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":Pt.NUMBERS.wordOrdinal(e)}})),yh(new bh("numericOrdinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":Pt.NUMBERS.numericOrdinal(e)}})),yh(new bh("vulgar",{processor:function(t){const[e,n]=t.split("/").map(t=>parseInt(t,10));return isNaN(e)||isNaN(n)?"":Lh("speech",`<mfrac><mn>${e}</mn><mn>${n}</mn></mfrac>`)}})),yh(new bh("latex",{processor:function(t){return"braille"===B.getInstance().options.modality&&"euro"===B.getInstance().options.locale||console.info("LaTeX input currently only works for Euro Braille output. Please use the latex-to-speech package from npm for general LaTeX input to SRE."),Lh("speech",`<math data-latex="${t}"></math>`)}})),yh(new bh("rebuildStree",{processor:function(t){return new Cu(K(t))}})),yh(new bh("speechStructure",{processor:function(t){const e=K(t);let n;try{n=new Cu(e).stree.xml()}catch(t){n=Il(e,B.getInstance().options)}return Ku(e,n),Ju(n)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),yh(new bh("workerSpeechStructure",{processor:function(t){const e=K(t);let n;try{n=new Cu(e).stree.xml()}catch(t){n=Il(e,B.getInstance().options)}B.getInstance().options.automark=!0;const r={};return Dh(r,e,n),r},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}}));var Xh=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};function Yh(t,e){return Xh(this,void 0,void 0,function*(){const n=K(t),r=new Cu(n),o=eh(e);return e.domain2style=nh(o),Jh(n,r.stree.xml(),e)})}function Wh(t,e){return Xh(this,void 0,void 0,function*(){const n=K(t),r=new Cu(n),o=eh(e);return(e=Zu(e,o)).domain2style=nh(o),Jh(n,r.stree.xml(),e)})}function Kh(t,e,n){return Xh(this,void 0,void 0,function*(){const r=K(t),o=new Cu(r),i=eh(e);return e.style=th(o.nodeDict[n],e),i[e.domain]=e.style,e.domain2style=nh(i),Jh(r,o.stree.xml(),e)})}function zh(t){return Xh(this,void 0,void 0,function*(){return Du.getLocalePreferences()[t.locale]})}function Qh(t,e){return Xh(this,void 0,void 0,function*(){var n;const r=K(t),o=new Cu(r),i=null!==(n=o.stree.root.querySelectorAll(t=>t.id.toString()===e)[0])&&void 0!==n?n:o.stree.root;return Du.relevantPreferences(i)})}function Jh(t,e,n){return Xh(this,void 0,void 0,function*(){var r;yield Cc(n),B.getInstance().options.automark=!0;const o={};if(Dh(o,t,e,n),!1===n.enableBraille)return o;yield Cc({modality:"braille",locale:n.braille,domain:"default",style:"default"});const i=null===(r=e.childNodes[0])||void 0===r?void 0:r.getAttribute("id");return o.braille=function(t){Bu(t,!0);const e=cc.getInstance().speechStructure;return e.completeModality("braille",Bu),e.json(["none"])}(e),o.braillelabel=o.braille[i]["braille-none"],o})}var Zh=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};function td(t,e){return id("speech",t,e)}function ed(t,e){return id("semantic",t,e)}function nd(t,e){return id("json",t,e)}function rd(t,e){return id("description",t,e)}function od(t,e){return id("enriched",t,e)}function id(t,e,n){switch(B.getInstance().mode){case I.ASYNC:return function(t,e,n){return Zh(this,void 0,void 0,function*(){const r=yield T.fs.promises.readFile(e,{encoding:"utf8"}),o=Mh(t,r);if(n)try{T.fs.promises.writeFile(n,o)}catch(t){throw new k("Can not write to file: "+n)}return o})}(t,e,n);case I.SYNC:return function(t,e,n){const r=function(t){let e;try{e=T.fs.readFileSync(t,{encoding:"utf8"})}catch(e){throw new k("Can not open file: "+t)}return e}(e),o=Mh(t,r);if(n)try{T.fs.writeFileSync(n,o)}catch(t){throw new k("Can not write to file: "+n)}return o}(t,e,n);default:throw new k(`Cannot process files in ${B.getInstance().mode} mode`)}}const sd=P,ad=s.VERSION;T.documentSupported||T.webworker?Mc({mode:I.HTTP}).then(()=>Mc({})):Mc({mode:I.SYNC}).then(()=>Mc({mode:I.ASYNC}));const cd=s}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t](i,i.exports,o),i.exports}e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>n[t]);return s.default=()=>n,o.d(i,s),i},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};t(void 0,void 0,void 0,function*(){if("undefined"==typeof self){self=o.g.self=o.g,o.g.DedicatedWorkerGlobalScope=o.g.constructor;const{parentPort:t,workerData:e}=yield import("node:worker_threads");o.g.addEventListener=(e,n)=>{t.on(e,n)},o.g.postMessage=e=>{t.postMessage({data:e})},o.g.maps=e.maps,o.g.require||(yield import("./require.mjs")),o.g.getMap=t=>Promise.resolve(JSON.stringify(o.g.require(t)))}else o.g=self.global=self,o.g.getMap=t=>fetch(t).then(t=>t.json()).catch(t=>console.log(t));o.g.SREfeature={custom:t=>o.g.getMap(`${o.g.maps}/${t}.json`)},yield(o.g.isLab?import("./sre-lab.js"):Promise.resolve().then(o.bind(o,108))).then(t=>o.g.SRE=t),self.addEventListener("message",function(t){t.data.debug&&console.log("Client >>> Worker:",t.data);const{cmd:o,data:i}=t.data;Object.hasOwn(e,o)?(n("Log",`running ${o}`),e[o](i).then(t=>r(o,{result:t})).catch(t=>r(o,{error:t.message}))):r(o,{error:`Invalid worker command: ${o}`})},!1);const e={import:t=>Array.isArray(t.imports)?Promise.all(t.imports.map(t=>o(238)(t))):o(238)(t.imports),setup:t=>t?(SRE.setupEngine(t),SRE.engineReady()):Promise.resolve(),speech:t=>i(SRE.worker.speech,t.mml,t.options),nextRules:t=>i(SRE.worker.nextRules,t.mml,t.options),nextStyle:t=>i(SRE.worker.nextStyle,t.mml,t.options,t.nodeId),localePreferences(e){return t(this,void 0,void 0,function*(){const t=yield SRE.worker.localePreferences(e.options);return t?JSON.stringify(t):t})},relevantPreferences(e){return t(this,void 0,void 0,function*(){var t;return null!==(t=yield SRE.worker.relevantPreferences(e.mml,e.id))&&void 0!==t?t:""})}};function n(t,e){try{self.postMessage({cmd:t,data:e})}catch(t){console.log("Posting error in worker for ",{message:(n=t).message,stack:n.stack,fileName:n.fileName,lineNumber:n.lineNumber})}var n}function r(t,e){n("Log",`finished ${t}`),n("Finished",Object.assign(Object.assign({},e),{cmd:t,success:!e.error}))}function i(e,n,r,...o){return t(this,void 0,void 0,function*(){var t;if(!n)return"";const i=null!==(t=yield e.call(null,n,r,...o))&&void 0!==t?t:{};return JSON.stringify(i)})}yield SRE.engineReady(),n("Ready",{})})})()})();