@pie-element/math-templated 7.1.1-next.23 → 7.1.1-next.24

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.
@@ -159,7 +159,7 @@ See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
159
159
  See also the "\`dev\` branch (2014–2015) → v0.10.0 Migration Guide" at
160
160
  https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide`)},fy(),py},py.getInterface=gy;var my=gy.MIN=1,hy=gy.MAX=3;function gy(e){if(!(my<=e&&e<=hy))throw`Only interface versions between `+my+` and `+hy+` supported. You specified: `+e;if(e<3&&typeof window<`u`&&!window.jQuery)throw`MathQuill interface version `+e+` requires jQuery 1.5.2+ to be loaded first`;function t(e){if(!e||!e.nodeType)return null;var t=U(e).children(`.mq-root-block`).attr(Hv),r=t&&$v.byId[t].controller;return r?n[r.KIND_OF_MQ](r):null}var n={};t.L=K,t.R=q,t.saneKeyboardEvents=yy;function r(e,t){for(var r in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:n}),t)if(t.hasOwnProperty(r)){var i=t[r],a=ly[r];e[r]=a?a(i):i}}t.config=function(e){return r(cy.p,e),this},t.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw`Embed name must start with letter and be only letters and digits`;dy[e]=t};var i=n.AbstractMathQuill=G(uy,function(t){t.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data},t.parseLatex=function(e){return this.__controller.parseLatex(e)},t.__mathquillify=function(t){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var a=i.addClass(t).contents().detach();r.jQ=U(`<span class="mq-root-block"/>`).attr(Hv,r.id).appendTo(i),this.latex(a.text()),this.revert=function(){var t=i.empty().unbind(`.mathquill`).removeClass(`mq-editable-field mq-math-mode mq-text-mode`).append(a);return e>=3?t[0]:t}},t.config=function(e){return r(this.__options,e),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,``).replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,``).replace(/ mq-hasCursor|mq-hasCursor ?/,``).replace(/ class=(""|(?= |>))/g,``)},t.reflow=function(){return this.__controller.root.postOrder(`reflow`),this}});for(var a in t.prototype=i.prototype,n.EditableField=G(i,function(e,t){e.__mathquillify=function(){return t.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild(`postOrder`,`dispose`),e.ends[K]=e.ends[q]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},e.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=J[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz())}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},e.select=function(){var e=this.__controller;for(e.notify(`move`).cursor.insAtRightEnd(e.root);e.cursor[K];)e.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(e){return this.__controller.notify(`move`).cursor.insAtDirEnd(e,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(K)},e.moveToRightEnd=function(){return this.moveToDirEnd(q)},e.keystroke=function(e){for(var e=e.replace(/^\s+|\s+$/g,``).split(/\s+/),t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:Gv});return this},e.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},e.dropEmbedded=function(e,t,n){var r=e-U(window).scrollLeft(),i=t-U(window).scrollTop(),a=document.elementFromPoint(r,i);this.__controller.seek(U(a),e,t),yb().setOptions(n).createLeftOf(this.__controller.cursor)},e.clickAt=function(e,t,n){n||=document.elementFromPoint(e,t);var r=this.__controller,i=r.root;return zv.contains(i.jQ[0],n)||(n=i.jQ[0]),r.seek(U(n),e+pageXOffset,t+pageYOffset),r.blurred&&this.focus(),this},e.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this}}),t.EditableField=function(){throw`wtf don't call me, I'm 'abstract'`},t.EditableField.prototype=n.EditableField.prototype,sy)(function(r,i){var a=n[r]=i(n);t[r]=function(n,i){var o=t(n);if(o instanceof a||!n||!n.nodeType)return o;var s=oy(a.RootBlock(),U(n),cy());return s.KIND_OF_MQ=r,a(s).__mathquillify(i,e)},t[r].prototype=a.prototype})(a,sy[a]);return t}py.noConflict=function(){return window.MathQuill=_y,py};var _y=window.MathQuill;window.MathQuill=py;function vy(e){for(var t=`moveOutOf deleteOutOf selectOutOf upOutOf downOutOf`.split(` `),n=0;n<t.length;n+=1)(function(t){e[t]=function(e){this.controller.handle(t,e)}})(t[n]);e.reflow=function(){this.controller.handle(`reflow`),this.controller.handle(`edited`),this.controller.handle(`edit`)}}var Y=G(function(e,t,n){function r(e,t){throw e=e?`'`+e+`'`:`EOF`,`Parse Error: `+t+` at `+e}e.init=function(e){this._=e},e.parse=function(e){return this.skip(o)._(``+e,t,r);function t(e,t){return t}},e.or=function(e){Xv(`or is passed a parser`,e instanceof n);var t=this;return n(function(n,r,i){return t._(n,r,a);function a(t){return e._(n,r,i)}})},e.then=function(e){var t=this;return n(function(r,i,a){return t._(r,o,a);function o(t,r){var o=e instanceof n?e:e(r);return Xv(`a parser is returned`,o instanceof n),o._(t,i,a)}})},e.many=function(){var e=this;return n(function(t,n,r){for(var i=[];e._(t,a,o););return n(t,i);function a(e,n){return t=e,i.push(n),!0}function o(){return!1}})},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n(function(n,i,a){for(var o=[],s=!0,c,l=0;l<e;l+=1)if(s=r._(n,u,d),!s)return a(n,c);for(;l<t&&s;l+=1)s=r._(n,u,f);return i(n,o);function u(e,t){return o.push(t),n=e,!0}function d(e,t){return c=t,n=e,!1}function f(e,t){return!1}})},e.result=function(e){return this.then(a(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then(function(e){return t.many().map(function(t){return e.concat(t)})})},e.map=function(e){return this.then(function(t){return a(e(t))})},e.skip=function(e){return this.then(function(t){return e.result(t)})},this.string=function(e){var t=e.length,r=`expected '`+e+`'`;return n(function(n,i,a){var o=n.slice(0,t);return o===e?i(n.slice(t),o):a(n,r)})};var i=this.regex=function(e){Xv(`regexp parser is anchored`,e.toString().charAt(1)===`^`);var t=`expected `+e;return n(function(n,r,i){var a=e.exec(n);if(a){var o=a[0];return r(n.slice(o.length),o)}else return i(n,t)})},a=n.succeed=function(e){return n(function(t,n){return n(t,e)})};n.fail=function(e){return n(function(t,n,r){return r(t,e)})},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n(function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,`expected any character`)}),n.all=n(function(e,t,n){return t(``,e)});var o=n.eof=n(function(e,t,n){return e?n(e,`expected EOF`):t(e,e)})}),yy=function(){var e={8:`Backspace`,9:`Tab`,10:`Enter`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Esc`,32:`Spacebar`,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`Left`,38:`Up`,39:`Right`,40:`Down`,45:`Insert`,46:`Del`,144:`NumLock`};function t(t){var n=t.which||t.keyCode,r=e[n],i,a=[];return t.ctrlKey&&a.push(`Ctrl`),t.originalEvent&&t.originalEvent.metaKey&&a.push(`Meta`),t.altKey&&a.push(`Alt`),t.shiftKey&&a.push(`Shift`),i=r||String.fromCharCode(n),!a.length&&!r?i:(a.push(i),a.join(`-`))}return function(e,n){var r=null,i=null,a=zv(e),o=zv(n.container||a),s=Gv,c;function l(e){s=e,clearTimeout(c),c=setTimeout(e)}function u(e){l(function(t){s=Gv,clearTimeout(c),e(t)})}o.bind(`keydown keypress input keyup focusout paste`,function(e){s(e)});function d(e){s(),s=Gv,clearTimeout(c),a.val(e),e&&a[0]&&a[0].select&&a[0].select(),f=!!e}var f=!1;function p(){var e=a[0];return`selectionStart`in e&&e.selectionStart!==e.selectionEnd}function m(){n.keystroke(t(r),r)}function h(e){r=e,i=null,f&&u(function(e){!(e&&e.type===`focusout`)&&a[0]&&a[0].select&&a[0].select()}),m()}function g(e){r&&i&&m(),i=e,l(v)}function _(e){r&&!i&&l(v)}function v(){if(!p()){var e=a.val();e.length===1?(a.val(``),n.typedText(e)):e&&a[0]&&a[0].select&&a[0].select()}}function y(){r=i=null}function b(e){a.focus(),l(x)}function x(){var e=a.val();a.val(``),e&&n.paste(e)}return o.bind({keydown:h,keypress:g,keyup:_,focusout:y,cut:function(){u(function(){n.cut()})},copy:function(){u(function(){n.copy()})},paste:b}),{select:d}}}();oy.open(function(e,t){e.exportText=function(){return this.root.foldChildren(``,function(e,t){return e+t.text()})}}),oy.open(function(e){e.focusBlurEvents=function(){var e=this,t=e.root,n=e.cursor,r;e.textarea.focus(function(){e.blurred=!1,clearTimeout(r),e.container.addClass(`mq-focused`),n.parent||n.insAtRightEnd(t),n.selection?(n.selection.jQ.removeClass(`mq-blur`),e.selectionChanged()):n.show()}).blur(function(){e.blurred=!0,r=setTimeout(function(){t.postOrder(`intentionalBlur`),n.clearSelection().endSelection(),a()}),U(window).bind(`blur`,i)});function i(){clearTimeout(r),n.selection&&n.selection.jQ.addClass(`mq-blur`),a()}function a(){n.hide().parent.blur(),e.container.removeClass(`mq-focused`),U(window).unbind(`blur`,i)}e.blurred=!0,n.hide().parent.blur()}}),oy.open(function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this)}}),$v.open(function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case`Ctrl-Shift-Backspace`:case`Ctrl-Backspace`:n.ctrlDeleteDir(K);break;case`Shift-Backspace`:case`Backspace`:n.backspace();break;case`Esc`:case`Tab`:n.escapeDir(q,e,t);return;case`Shift-Tab`:case`Shift-Esc`:n.escapeDir(K,e,t);return;case`End`:n.notify(`move`).cursor.insAtRightEnd(r.parent);break;case`Ctrl-End`:n.notify(`move`).cursor.insAtRightEnd(n.root);break;case`Shift-End`:for(;r[q];)n.selectRight();break;case`Ctrl-Shift-End`:for(;r[q]||r.parent!==n.root;)n.selectRight();break;case`Home`:n.notify(`move`).cursor.insAtLeftEnd(r.parent);break;case`Ctrl-Home`:n.notify(`move`).cursor.insAtLeftEnd(n.root);break;case`Shift-Home`:for(;r[K];)n.selectLeft();break;case`Ctrl-Shift-Home`:for(;r[K]||r.parent!==n.root;)n.selectLeft();break;case`Left`:n.moveLeft();break;case`Shift-Left`:n.selectLeft();break;case`Ctrl-Left`:break;case`Right`:n.moveRight();break;case`Shift-Right`:n.selectRight();break;case`Ctrl-Right`:break;case`Up`:n.moveUp();break;case`Down`:n.moveDown();break;case`Shift-Up`:if(r[K])for(;r[K];)n.selectLeft();else n.selectLeft();case`Shift-Down`:if(r[q])for(;r[q];)n.selectRight();else n.selectRight();case`Ctrl-Up`:break;case`Ctrl-Down`:break;case`Ctrl-Shift-Del`:case`Ctrl-Del`:n.ctrlDeleteDir(q);break;case`Shift-Del`:case`Del`:n.deleteForward();break;case`Meta-A`:case`Ctrl-A`:for(n.notify(`move`).cursor.insAtRightEnd(n.root);r[K];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz()},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){Xv(`overridden or never called on this node`)}}),oy.open(function(e){this.onNotify(function(e){(e===`move`||e===`upDown`)&&this.show().clearSelection()}),e.escapeDir=function(e,t,n){Zv(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify(`move`)},ly.leftRightIntoCmdGoes=function(e){if(e&&e!==`up`&&e!==`down`)throw`"up" or "down" required for leftRightIntoCmdGoes option, got "`+e+`"`;return e},e.moveDir=function(e){Zv(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify(`move`)},e.moveLeft=function(){return this.moveDir(K)},e.moveRight=function(){return this.moveDir(q)},e.moveUp=function(){return t(this,`up`)},e.moveDown=function(){return t(this,`down`)};function t(e,t){var n=e.notify(`upDown`).cursor,r=t+`Into`,i=t+`OutOf`;return n[q][r]?n.insAtLeftEnd(n[q][r]):n[K][r]?n.insAtRightEnd(n[K][r]):n.parent.bubble(function(e){var t=e[i];if(t&&(typeof t==`function`&&(t=e[i](n)),t instanceof $v&&n.jumpUpDown(e,t),t!==!0))return!1}),e}this.onNotify(function(e){e!==`upDown`&&(this.upDownCache={})}),this.onNotify(function(e){e===`edit`&&this.show().deleteSelection()}),e.deleteDir=function(e){Zv(e);var t=this.cursor,n=t.selection;return this.notify(`edit`),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[K].siblingDeleted&&t[K].siblingDeleted(t.options,q),t[q].siblingDeleted&&t[q].siblingDeleted(t.options,K),t.parent.bubble(`reflow`),this},e.ctrlDeleteDir=function(e){Zv(e);var t=this.cursor;return!t[e]||t.selection?this.deleteDir(e):(this.notify(`edit`),e===K?ty(t.parent.ends[K],t[K]).remove():ty(t[q],t.parent.ends[q]).remove(),t.insAtDirEnd(e,t.parent),t[K].siblingDeleted&&t[K].siblingDeleted(t.options,q),t[q].siblingDeleted&&t[q].siblingDeleted(t.options,K),t.parent.bubble(`reflow`),this)},e.backspace=function(){return this.deleteDir(K)},e.deleteForward=function(){return this.deleteDir(q)},this.onNotify(function(e){e!==`select`&&this.endSelection()}),e.selectDir=function(e){var t=this.notify(`select`).cursor,n=t.selection;Zv(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show()},e.selectLeft=function(){return this.selectDir(K)},e.selectRight=function(){return this.selectDir(q)}});var by=/[\\]{2,}/gm,xy=(function(){function e(e){var t=wy();return e.adopt(t,0,0),t}function t(e){for(var t=e[0]||wy(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[q],0);return t}var n=Y.string,r=Y.regex,i=Y.letter,a=Y.any,o=Y.optWhitespace,s=Y.succeed,c=Y.fail,l=i.map(function(e){return Ny(e)}),u=r(/^[^${}\\_^]/).map(function(e){return Z(e)}),d=r(/^\\not\\[a-z]+/).then(function(e){return ry[e]&&ry[e]().parser()||c(`unknown compound command: `+e)}),f=r(/^[^\\a-eg-zA-Z]/).or(n(`\\`).then(r(/^begin\{.?matrix\}/).or(r(/^[a-z]+/i)).or(r(/^\s+/).result(` `)).or(a))).then(function(e){e=e.replace(/^begin\{(.?matrix)\}$/,`$1`);var t=J[e];return t?t(e).parser():c(`unknown command: \\`+e)}),p=d.or(f).or(l).or(u),m=n(`{`).then(function(){return g}).skip(n(`}`)),h=o.then(m.or(p.map(e))),g=h.many().map(t).skip(o),_=n(`[`).then(h.then(function(e){return e.join(`latex`)===`]`?c():s(e)}).many().map(t).skip(o)).skip(n(`]`)),v=g;return v.block=h,v.optBlock=_,v})();oy.open(function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,`$1`)},e.parseLatex=function(e){return xy.parse(e).postOrder(`finalizeTree`,cy.p).join(`latex`).trim()},ly.maxDepth=function(e){return typeof e==`number`?e:Bv},e.writeLatex=function(e){var t=this.notify(`edit`).cursor,n=Y.all,r=Y.eof,i=xy.skip(r).or(n.result(!1)).parse(e);return i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[K],t[q]),i.jQize().insertBefore(t.jQ),t[K]=i.ends[q],i.finalizeInsert(t.options,t),i.ends[q][q].siblingCreated&&i.ends[q][q].siblingCreated(t.options,K),i.ends[K][K].siblingCreated&&i.ends[K][K].siblingCreated(t.options,q),t.parent.bubble(`reflow`)),this},e.renderLatexMath=function(e){e&&e.replace&&(e=e.replace(by,`\\`));var t=this.root,n=this.cursor;n.options;var r=t.jQ,i=Y.all,a=Y.eof,o=xy.skip(a).or(i.result(!1)).parse(e);if(t.eachChild(`postOrder`,`dispose`),t.ends[K]=t.ends[q]=0,o&&o.prepareInsertionAt(n)){o.children().adopt(t,0,0);var s=o.join(`html`);r.html(s),t.jQize(r.children()),t.finalizeInsert(n.options)}else r.empty();delete n.selection,n.insAtRightEnd(t)},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild(`postOrder`,`dispose`),t.ends[K]=t.ends[q]=0,delete n.selection,n.show().insAtRightEnd(t);var r=Y.regex,i=Y.string,a=Y.eof,o=Y.all,s=i(`$`).then(xy).skip(i(`$`).or(a)).map(function(e){var t=ky(n);t.createBlocks();var r=t.ends[K];return e.children().adopt(r,0,0),t}),c=i(`\\$`).result(`$`).or(r(/^[^$]/)).map(Z),l=s.or(c).many().skip(a).or(o.result(!1)).parse(e);if(l){for(var u=0;u<l.length;u+=1)l[u].adopt(t,t.ends[q],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options)}}}),oy.open(function(e){cy.p.ignoreNextMousedown=Gv,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind(`mousedown.mathquill`,function(t){var n=U(t.target).closest(`.mq-root-block`),r=$v.byId[n.attr(Hv)||e.attr(Hv)].controller,i=r.cursor;i.blink;var a=r.textareaSpan,o=r.textarea;if(t.preventDefault(),t.target.unselectable=!0,i.options.ignoreNextMousedown(t))return;i.options.ignoreNextMousedown=Gv;function s(e){i.anticursor||i.startSelection(),r.seek(U(e.target),e.pageX,e.pageY).cursor.select(),e.target&&U(e.target.ownerDocument).unbind(`mousemove`,c)}function c(e){return delete e.target,s(e)}function l(e){!i.selection&&!r.editable&&a.detach(),n.unbind(`mousemove`,s),U(e.target.ownerDocument).unbind(`mousemove`,c).unbind(`mouseup`,l)}if(a.parent().length===0)return!1;r.blurred&&(r.editable||n.prepend(a),document.body.focus(),o.focus()),t.preventDefault(),t.target.unselectable=!0,i.show(),r.seek(U(t.target),t.pageX,t.pageY).cursor.startSelection(),n.mousemove(s),U(t.target.ownerDocument).mousemove(c).mouseup(l)})}}),oy.open(function(e){e.seek=function(e,t,n){var r=this.notify(`select`).cursor;if(e){var i=e.attr(Hv)||e.attr(Vv);if(!i){var a=e.parent();i=a.attr(Hv)||a.attr(Vv)}}var o=i&&$v.byId[i]?$v.byId[i]:this.root;return r.clearSelection().show(),o.seek(t,r),this.scrollHoriz(),this}}),oy.open(function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),a=r.right-(n.right-20);if(t.ends[K]===e[q])if(i<0)var o=i;else if(a>0)if(r.left-a<n.left+20)var o=i;else var o=a;else return;else if(a>0)var o=a;else if(i<0)if(r.right-i>n.right-20)var o=a;else var o=i;else return}else{var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var o=s-(n.right-20);else if(s<n.left+20)var o=s-(n.left+20);else return}this.root.jQ.stop&&typeof this.root.jQ.stop==`function`&&this.root.jQ.stop().animate({scrollLeft:`+=`+o},100)}}),oy.open(function(e){cy.p.substituteTextarea=function(){return U(`<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />`)[0]},e.createTextarea=function(){var e=this.textareaSpan=U(`<span class="mq-textarea"></span>`),t=this.options.substituteTextarea();if(!t.nodeType)throw`substituteTextarea() must return a DOM element, got `+t;t=this.textarea=U(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged()}},e.selectionChanged=function(){var e=this;qy(e.container[0]),e.textareaSelectionTimeout===Bv&&(e.textareaSelectionTimeout=setTimeout(function(){e.setTextareaSelection()}))},e.setTextareaSelection=function(){this.textareaSelectionTimeout=Bv;var e=``;this.cursor.selection&&(e=this.cursor.selection.join(`latex`),this.options.statelessClipboard&&(e=`$`+e+`$`)),this.selectFn(e)},e.staticMathTextareaEvents=function(){var e=this;e.root;var t=e.cursor,n=e.textarea,r=e.textareaSpan;this.container.prepend(zv(`<span class="mq-selectable">`).text(`$`+e.exportLatex()+`$`)),e.blurred=!0,n.bind(`cut paste`,!1).bind(`copy`,function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){t.selection&&t.selection.clear(),setTimeout(i)});function i(){r.detach(),e.blurred=!0}e.selectFn=function(e){n.val(e),e&&n.select()}},cy.p.substituteKeyboardEvents=yy,e.editablesTextareaEvents=function(){var e=this,t=e.textarea,n=e.textareaSpan,r=this.options.substituteKeyboardEvents(t,this);this.selectFn=function(e){r.select(e)},this.container.prepend(n),this.focusBlurEvents()},e.typedText=function(e){if(e===`
161
161
  `)return this.handle(`enter`);var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz()},e.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout(function(){e.notify(`edit`),t.parent.bubble(`reflow`)})},e.copy=function(){this.setTextareaSelection()},e.paste=function(e){this.options.statelessClipboard&&(e=e.slice(0,1)===`$`&&e.slice(-1)===`$`?e.slice(1,-1):`\\text{`+e+`}`),this.writeLatex(e).cursor.show()}});var Sy=G($v,function(e,t){e.finalizeInsert=function(e,t){var n=this;n.postOrder(`finalizeTree`,e),n.postOrder(`contactWeld`,t),n.postOrder(`blur`),n.postOrder(`reflow`),n[q].siblingCreated&&n[q].siblingCreated(e,K),n[K].siblingCreated&&n[K].siblingCreated(e,q),n.bubble(`reflow`)},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(t!==Bv){var n=e.depth();if(n>t)return!1;this.removeNodesDeeperThan(t-n)}return!0},e.removeNodesDeeperThan=function(e){for(var t=0,n=[[this,t]],r;n.length;)r=n.shift(),r[0].children().each(function(i){var a=+(i instanceof wy);t=r[1]+a,t<=e?n.push([i,t]):(a?i.children():i).remove()})}}),X=G(Sy,function(e,t){e.init=function(e,n,r){var i=this;t.init.call(i),i.ctrlSeq||=e,n&&(i.htmlTemplate=n),r&&(i.textTemplate=r)},e.replaces=function(e){e.disown(),this.replacedFragment=e},e.isEmpty=function(){return this.foldChildren(!0,function(e,t){return e&&t.isEmpty()})},e.parser=function(){var e=xy.block,t=this;return e.times(t.numBlocks()).map(function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[q],0);return t})},e.createLeftOf=function(e){var n=this,r=n.replacedFragment;n.createBlocks(),t.createLeftOf.call(n,e),r&&(r.adopt(n.ends[K],0,0),r.jQ.appendTo(n.ends[K].jQ),n.placeCursor(e),n.prepareInsertionAt(e)),n.finalizeInsert(e.options),n.placeCursor(e)},e.createBlocks=function(){for(var e=this,t=e.numBlocks(),n=e.blocks=Array(t),r=0;r<t;r+=1)(n[r]=wy()).adopt(e,e.ends[q],0)},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[K],function(e,t){return e.isEmpty()?e:t}))},e.moveTowards=function(e,t,n){var r=n&&this[n+`Into`];t.insAtDirEnd(-e,r||this.ends[-e])},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null)},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e]},e.selectChildren=function(){return ay(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id])},e.seek=function(e,t){function n(e){var t={};return t[K]=e.jQ.offset().left,t[q]=t[K]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[K])return t.insLeftOf(r);if(e>i[q])return t.insRightOf(r);var a=i[K];r.eachChild(function(o){var s=n(o);if(e<s[K])return e-a<s[K]-e?o[K]?t.insAtRightEnd(o[K]):t.insLeftOf(r):t.insAtLeftEnd(o),!1;if(e>s[q])o[q]?a=s[q]:i[q]-e<e-s[q]?t.insRightOf(r):t.insAtRightEnd(o);else return o.seek(e,t),!1})},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this,t=e.blocks,n=` mathquill-command-id=`+e.id,r=e.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);Xv(`no unmatched angle brackets`,r.join(``)===this.htmlTemplate);for(var i=0,a=r[0];a;i+=1,a=r[i])if(a.slice(-2)===`/>`)r[i]=a.slice(0,-2)+n+`/>`;else if(a.charAt(0)===`<`){Xv(`not an unmatched top-level close tag`,a.charAt(1)!==`/`),r[i]=a.slice(0,-1)+n+`>`;var o=1;do i+=1,a=r[i],Xv(`no missing close tags`,a),a.slice(0,2)===`</`?--o:a.charAt(0)===`<`&&a.slice(-2)!==`/>`&&(o+=1);while(o>0)}return r.join(``).replace(/>&(\d+)/g,function(e,n){return` mathquill-block-id=`+t[n].id+`>`+t[n].join(`html`)})},e.latex=function(){return this.foldChildren(this.ctrlSeq,function(e,t){return e+`{`+(t.latex()||` `)+`}`})},e.textTemplate=[``],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],function(n,r){t+=1;var i=r.text();return n&&e.textTemplate[t]===`(`&&i[0]===`(`&&i.slice(-1)===`)`?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||``)})}}),Cy=G(X,function(e,t){e.init=function(e,n,r){r||=e&&e.length>1?e.slice(1):e,t.init.call(this,e,n,[r])},e.parser=function(){return Y.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove()},e.createBlocks=Gv,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e]},e.deleteTowards=function(e,t){t[e]=this.remove()[e]},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=Gv,e.isEmpty=function(){return!0}}),Z=G(Cy,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span>`+(n||e)+`</span>`)}}),Q=G(Cy,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-binary-operator">`+n+`</span>`,r)}}),wy=G(Sy,function(e,t){e.join=function(e){return this.foldChildren(``,function(t,n){return t+n[e]()})},e.html=function(){return this.join(`html`)},e.latex=function(){return this.join(`latex`)},e.text=function(){return this.ends[K]===this.ends[q]&&this.ends[K]!==0?this.ends[K].text():this.join(`text`)},e.keystroke=function(e,n,r){if(r.options.spaceBehavesLikeTab&&(e===`Spacebar`||e===`Shift-Spacebar`)){n.preventDefault(),r.escapeDir(e===`Shift-Spacebar`?K:q,e,n);return}return t.keystroke.apply(this,arguments)},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+`Into`])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent)},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent)},e.deleteOutOf=function(e,t){t.unwrapGramp()},e.seek=function(e,t){var n=this.ends[q];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[K].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[K];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?Ny(e):/^\d$/.test(e)?jy(e):t&&t.typingSlashWritesDivisionSymbol&&e===`/`?J[`÷`](e):t&&t.typingAsteriskWritesTimesSymbol&&e===`*`?J[`×`](e):(n=ny[e]||J[e])?n(e):Z(e)},e.write=function(e,t){var n;if(e.tooDeep())return!1;n=this.chToCmd(t,e.options),e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show())},e.focus=function(){return this.jQ.addClass(`mq-hasCursor`),this.jQ.removeClass(`mq-empty`),this},e.blur=function(){return this.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.jQ.addClass(`mq-empty`),this}});cy.p.mouseEvents=!0,sy.StaticMath=function(e){return G(e.AbstractMathQuill,function(t,n){this.RootBlock=wy,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,`mq-math-mode`),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField)},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder(`registerInnerField`,this.innerFields=[],e.MathField),t}})};var Ty=G(wy,vy);sy.MathField=function(e){return G(e.EditableField,function(e,t){this.RootBlock=Ty,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=Gv),t.__mathquillify.call(this,`mq-editable-field mq-math-mode`),delete this.__controller.root.reflow,this}})};var Ey=G($v,function(e,t){e.ctrlSeq=`\\text`,e.replaces=function(e){e instanceof ty?this.replacedText=e.remove().jQ.text():typeof e==`string`&&(this.replacedText=e)},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[K]&&this.ends[K].jQadd(this.jQ[0].firstChild)},e.createLeftOf=function(e){var n=this;if(t.createLeftOf.call(this,e),n[q].siblingCreated&&n[q].siblingCreated(e.options,K),n[K].siblingCreated&&n[K].siblingCreated(e.options,q),n.bubble(`reflow`),e.insAtRightEnd(n),n.replacedText)for(var r=0;r<n.replacedText.length;r+=1)n.write(e,n.replacedText.charAt(r))},e.parser=function(){var e=this,t=Y.string,n=Y.regex;return Y.optWhitespace.then(t(`{`)).then(n(/^[^}]*/)).skip(t(`}`)).map(function(t){return t.length===0?ty():(Dy(t).adopt(e,0,0),e)})},e.textContents=function(){return this.foldChildren(``,function(e,t){return e+t.text})},e.text=function(){return`"`+this.textContents()+`"`},e.latex=function(){var e=this.textContents();return e.length===0?``:`\\text{`+e.replace(/\\/g,`\\backslash `).replace(/[{}]/g,`\\$&`)+`}`},e.html=function(){return`<span class="mq-text-mode" mathquill-command-id=`+this.id+`>`+this.textContents()+`</span>`},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this)},e.moveOutOf=function(e,t){t.insDirOf(e,this)},e.unselectInto=e.moveTowards,e.selectTowards=X.prototype.selectTowards,e.deleteTowards=X.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this)},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this)},e.write=function(e,n){if(e.show().deleteSelection(),n!==`$`)e[K]?(e[K].appendText(n),this.bubble(`reflow`)):Dy(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),Z(`\\$`,`$`).createLeftOf(e);else if(!e[q])e.insRightOf(this);else if(!e[K])e.insLeftOf(this);else{var r=Ey(),i=this.ends[K];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e)}},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,a=Math.round((e-this.jQ.offset().left)/i);a<=0?t.insAtLeftEnd(this):a>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(a));for(var o=e-t.show().offset().left,s=o&&o<0?K:q,c=s;t[s]&&o*c>0;)t[s].moveTowards(s,t),c=o,o=e-t.offset().left;if(s*o<-s*c&&t[-s].moveTowards(-s,t),!t.anticursor)this.anticursorPosition=t[K]&&t[K].text.length;else if(t.anticursor.parent===this){var l=t[K]&&t[K].text.length;if(this.anticursorPosition===l)t.anticursor=Qv.copy(t);else{if(this.anticursorPosition<l){var u=t[K].splitRight(this.anticursorPosition);t[K]=u}else var u=t[q].splitRight(this.anticursorPosition-l);t.anticursor=Qv(this,u[K],u)}}},e.blur=function(e){wy.prototype.blur.call(this),e&&(this.textContents()===``?(this.remove(),e[K]===this?e[K]=this[K]:e[q]===this&&(e[q]=this[q])):n(this))};function n(e){e.jQ[0].normalize();var t=e.jQ.contents().filter(function(e,t){return t.nodeType===3})[0];t||={data:``},Xv(`only node in TextBlock span is Text node`,t.nodeType===3);var n=Dy(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}e.focus=wy.prototype.focus}),Dy=G($v,function(e,t){e.init=function(e){t.init.call(this),this.text=e},e.jQadd=function(e){this.dom=e,this.jQ=U(e)},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e)},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e)},e.insTextAtDirEnd=function(e,t){Zv(t),t===q?this.appendText(e):this.prependText(e)},e.splitRight=function(e){var t=Dy(this.text.slice(e)).adopt(this.parent,this,this[q]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t};function n(e,t){return t.charAt(e===K?0:-1+t.length)}e.moveTowards=function(e,t){Zv(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):Dy(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?e===q?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e])},e.selectTowards=function(e,t){Zv(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var a=Dy(i).createDir(e,t);r[e]=a,t.insDirOf(e,a)}else{var o=this[-e];if(o)o.insTextAtDirEnd(i,e);else{var a=Dy(i).createDir(-e,t);a.jQ.insDirOf(-e,t.selection.jQ)}this.text.length===1&&r[-e]===this&&(r[-e]=this[-e])}return this.deleteTowards(e,t)}});J.text=J.textnormal=J.textrm=J.textup=J.textmd=Ey;function Oy(e,t,n){return G(Ey,{ctrlSeq:e,htmlTemplate:`<`+t+` `+n+`>&0</`+t+`>`})}J.em=J.italic=J.italics=J.emph=J.textit=J.textsl=Oy(`\\textit`,`i`,`class="mq-text-mode"`),J.strong=J.bold=J.textbf=Oy(`\\textbf`,`b`,`class="mq-text-mode"`),J.sf=J.textsf=Oy(`\\textsf`,`span`,`class="mq-sans-serif mq-text-mode"`),J.tt=J.texttt=Oy(`\\texttt`,`span`,`class="mq-monospace mq-text-mode"`),J.textsc=Oy(`\\textsc`,`span`,`style="font-variant:small-caps" class="mq-text-mode"`),J.uppercase=Oy(`\\uppercase`,`span`,`style="text-transform:uppercase" class="mq-text-mode"`),J.lowercase=Oy(`\\lowercase`,`span`,`style="text-transform:lowercase" class="mq-text-mode"`);var ky=G(X,function(e,t){e.init=function(e){t.init.call(this,`$`),this.cursor=e},e.htmlTemplate=`<span class="mq-math-mode">&0</span>`,e.createBlocks=function(){t.createBlocks.call(this),this.ends[K].cursor=this.cursor,this.ends[K].write=function(e,t){t===`$`?this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),Z(`\\$`,`$`).createLeftOf(e.show())):e[q]?e[K]?wy.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent):wy.prototype.write.call(this,e,t)}},e.latex=function(){return`$`+this.ends[K].latex()+`$`}}),Ay=G(Ty,function(e,t){e.keystroke=function(e){if(!(e===`Spacebar`||e===`Shift-Spacebar`))return t.keystroke.apply(this,arguments)},e.write=function(e,t){if(e.show().deleteSelection(),t===`$`)ky(e).createLeftOf(e);else{var n;t===`<`?n=`&lt;`:t===`>`&&(n=`&gt;`),Z(t,n).createLeftOf(e)}}});sy.TextField=function(e){return G(e.EditableField,function(e,t){this.RootBlock=Ay,e.__mathquillify=function(){return t.__mathquillify.call(this,`mq-editable-field mq-text-mode`)},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},ny[`\\`]=G(X,function(e,t){e.ctrlSeq=`\\`,e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return!1}},e.htmlTemplate=`<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>`,e.textTemplate=[`\\`],e.createBlocks=function(){t.createBlocks.call(this),this.ends[K].focus=function(){return this.parent.jQ.addClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.removeClass(`mq-empty`),this},this.ends[K].blur=function(){return this.parent.jQ.removeClass(`mq-hasCursor`),this.isEmpty()&&this.parent.jQ.addClass(`mq-empty`),this},this.ends[K].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?Z(t).createLeftOf(e):(this.parent.renderCommand(e),(t!==`\\`||!this.isEmpty())&&e.parent.write(e,t))},this.ends[K].keystroke=function(e,n,r){if(e===`Tab`||e===`Enter`||e===`Spacebar`){this.parent.renderCommand(r.cursor),n.preventDefault();return}return t.keystroke.apply(this,arguments)}},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass(`mq-blur`).bind(`mousedown mousemove`,function(e){return U(e.target=n).trigger(e),!1}).insertBefore(this.jQ).add(this.jQ)}},e.latex=function(){return`\\`+this.ends[K].latex()+` `},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[q]?e.insLeftOf(this[q]):e.insAtRightEnd(this.parent);var t=this.ends[K].latex();t||=` `;var n=J[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):(n=Ey(),n.replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),J[`∉`]=J.notin=W(Q,`\\notin `,`&#8713;`),J[`≅`]=J.cong=W(Q,`\\cong `,`&#8773;`),J[`≡`]=J.equiv=W(Q,`\\equiv `,`&#8801;`),J[`⊕`]=J.oplus=W(Q,`\\oplus `,`&#8853;`),J[`⊗`]=J.otimes=W(Q,`\\otimes `,`&#8855;`),J[`≠`]=J.ne=J.neq=W(Q,`\\ne `,`&ne;`),J[`≇`]=J.ncong=W(Q,`\\ncong `,`&ncong;`),J[`∗`]=J.ast=J.star=J.loast=J.lowast=W(Q,`\\ast `,`&lowast;`),J.therefor=J.therefore=W(Q,`\\therefore `,`&there4;`),J.cuz=J.because=W(Q,`\\because `,`&#8757;`),J.prop=J.propto=W(Q,`\\propto `,`&prop;`),J[`≈`]=J.asymp=J.approx=W(Q,`\\approx `,`&asymp;`),J[`≉`]=J.nasymp=J.napprox=W(Q,`\\napprox `,`&nap;`),J.isin=J.in=W(Q,`\\in `,`&isin;`),J.ni=J.contains=W(Q,`\\ni `,`&ni;`),J.notni=J.niton=J.notcontains=J.doesnotcontain=ry[`\\not\\ni`]=W(Q,`\\not\\ni `,`&#8716;`),J.sub=J.subset=W(Q,`\\subset `,`&sub;`),J.sup=J.supset=J.superset=W(Q,`\\supset `,`&sup;`),J.nsub=J.notsub=J.nsubset=J.notsubset=ry[`\\not\\subset`]=W(Q,`\\not\\subset `,`&#8836;`),J.nsup=J.notsup=J.nsupset=J.notsupset=J.nsuperset=J.notsuperset=ry[`\\not\\supset`]=W(Q,`\\not\\supset `,`&#8837;`),J.sube=J.subeq=J.subsete=J.subseteq=W(Q,`\\subseteq `,`&sube;`),J.supe=J.supeq=J.supsete=J.supseteq=J.supersete=J.superseteq=W(Q,`\\supseteq `,`&supe;`),J.nsube=J.nsubeq=J.notsube=J.notsubeq=J.nsubsete=J.nsubseteq=J.notsubsete=J.notsubseteq=ry[`\\not\\subseteq`]=W(Q,`\\not\\subseteq `,`&#8840;`),J.nsupe=J.nsupeq=J.notsupe=J.notsupeq=J.nsupsete=J.nsupseteq=J.notsupsete=J.notsupseteq=J.nsupersete=J.nsuperseteq=J.notsupersete=J.notsuperseteq=ry[`\\not\\supseteq`]=W(Q,`\\not\\supseteq `,`&#8841;`),J.N=J.naturals=J.Naturals=W(Z,`\\mathbb{N}`,`&#8469;`),J.P=J.primes=J.Primes=J.projective=J.Projective=J.probability=J.Probability=W(Z,`\\mathbb{P}`,`&#8473;`),J.Z=J.integers=J.Integers=W(Z,`\\mathbb{Z}`,`&#8484;`),J.Q=J.rationals=J.Rationals=W(Z,`\\mathbb{Q}`,`&#8474;`),J.R=J.reals=J.Reals=W(Z,`\\mathbb{R}`,`&#8477;`),J.C=J.complex=J.Complex=J.complexes=J.Complexes=J.complexplane=J.Complexplane=J.ComplexPlane=W(Z,`\\mathbb{C}`,`&#8450;`),J.H=J.Hamiltonian=J.quaternions=J.Quaternions=W(Z,`\\mathbb{H}`,`&#8461;`),J.quad=J.emsp=W(Z,`\\quad `,` `),J.qquad=W(Z,`\\qquad `,` `),J.diamond=W(Z,`\\diamond `,`&#9671;`),J.bigtriangleup=W(Z,`\\bigtriangleup `,`&#9651;`),J.ominus=W(Z,`\\ominus `,`&#8854;`),J.uplus=W(Z,`\\uplus `,`&#8846;`),J.bigtriangledown=W(Z,`\\bigtriangledown `,`&#9661;`),J.sqcap=W(Z,`\\sqcap `,`&#8851;`),J.triangleleft=W(Z,`\\triangleleft `,`&#8882;`),J.sqcup=W(Z,`\\sqcup `,`&#8852;`),J.triangleright=W(Z,`\\triangleright `,`&#8883;`),J.odot=J.circledot=W(Z,`\\odot `,`&#8857;`),J.bigcirc=W(Z,`\\bigcirc `,`&#9711;`),J.dagger=W(Z,`\\dagger `,`&#0134;`),J.ddagger=W(Z,`\\ddagger `,`&#135;`),J.wr=W(Z,`\\wr `,`&#8768;`),J.amalg=W(Z,`\\amalg `,`&#8720;`),J.models=W(Z,`\\models `,`&#8872;`),J.prec=W(Z,`\\prec `,`&#8826;`),J.succ=W(Z,`\\succ `,`&#8827;`),J.preceq=W(Z,`\\preceq `,`&#8828;`),J.succeq=W(Z,`\\succeq `,`&#8829;`),J.simeq=W(Z,`\\simeq `,`&#8771;`),J.mid=W(Z,`\\mid `,`&#8739;`),J.ll=W(Z,`\\ll `,`&#8810;`),J.gg=W(Z,`\\gg `,`&#8811;`),J.parallel=W(Z,`\\parallel `,`&#8741;`),J.nparallel=W(Z,`\\nparallel `,`&#8742;`),J.bowtie=W(Z,`\\bowtie `,`&#8904;`),J.sqsubset=W(Z,`\\sqsubset `,`&#8847;`),J.sqsupset=W(Z,`\\sqsupset `,`&#8848;`),J.smile=W(Z,`\\smile `,`&#8995;`),J.sqsubseteq=W(Z,`\\sqsubseteq `,`&#8849;`),J.sqsupseteq=W(Z,`\\sqsupseteq `,`&#8850;`),J.doteq=W(Z,`\\doteq `,`&#8784;`),J.frown=W(Z,`\\frown `,`&#8994;`),J.vdash=W(Z,`\\vdash `,`&#8870;`),J.dashv=W(Z,`\\dashv `,`&#8867;`),J.nless=W(Z,`\\nless `,`&#8814;`),J.ngtr=W(Z,`\\ngtr `,`&#8815;`),J.longleftarrow=W(Z,`\\longleftarrow `,`&#8592;`),J.longrightarrow=W(Z,`\\longrightarrow `,`&#8594;`),J.Longleftarrow=W(Z,`\\Longleftarrow `,`&#8656;`),J.Longrightarrow=W(Z,`\\Longrightarrow `,`&#8658;`),J.longleftrightarrow=W(Z,`\\longleftrightarrow `,`&#8596;`),J.updownarrow=W(Z,`\\updownarrow `,`&#8597;`),J.Longleftrightarrow=W(Z,`\\Longleftrightarrow `,`&#8660;`),J.Updownarrow=W(Z,`\\Updownarrow `,`&#8661;`),J.mapsto=W(Z,`\\mapsto `,`&#8614;`),J.nearrow=W(Z,`\\nearrow `,`&#8599;`),J.hookleftarrow=W(Z,`\\hookleftarrow `,`&#8617;`),J.hookrightarrow=W(Z,`\\hookrightarrow `,`&#8618;`),J.searrow=W(Z,`\\searrow `,`&#8600;`),J.leftharpoonup=W(Z,`\\leftharpoonup `,`&#8636;`),J.rightharpoonup=W(Z,`\\rightharpoonup `,`&#8640;`),J.swarrow=W(Z,`\\swarrow `,`&#8601;`),J.leftharpoondown=W(Z,`\\leftharpoondown `,`&#8637;`),J.rightharpoondown=W(Z,`\\rightharpoondown `,`&#8641;`),J.nwarrow=W(Z,`\\nwarrow `,`&#8598;`),J.ldots=W(Z,`\\ldots `,`&#8230;`),J.cdots=W(Z,`\\cdots `,`&#8943;`),J.vdots=W(Z,`\\vdots `,`&#8942;`),J.ddots=W(Z,`\\ddots `,`&#8945;`),J.surd=W(Z,`\\surd `,`&#8730;`),J.triangle=W(Z,`\\triangle `,`&#9651;`),J.ell=W(Z,`\\ell `,`&#8467;`),J.top=W(Z,`\\top `,`&#8868;`),J.flat=W(Z,`\\flat `,`&#9837;`),J.natural=W(Z,`\\natural `,`&#9838;`),J.sharp=W(Z,`\\sharp `,`&#9839;`),J.wp=W(Z,`\\wp `,`&#8472;`),J.bot=W(Z,`\\bot `,`&#8869;`),J.clubsuit=W(Z,`\\clubsuit `,`&#9827;`),J.diamondsuit=W(Z,`\\diamondsuit `,`&#9826;`),J.heartsuit=W(Z,`\\heartsuit `,`&#9825;`),J.spadesuit=W(Z,`\\spadesuit `,`&#9824;`),J.circledot=W(Z,`\\circledot `,`&#8857;`),J.middot=W(Z,`\\middot `,`&middot;`),J.dottedsquare=W(Z,`\\dottedsquare `,`&#11034;`),J.square=W(Z,`\\square `,`&#11036;`),J.rectangle=W(Z,`\\rectangle `,`&#9647;`),J.oint=W(Z,`\\oint `,`&#8750;`),J.bigcap=W(Z,`\\bigcap `,`&#8745;`),J.bigcup=W(Z,`\\bigcup `,`&#8746;`),J.bigsqcup=W(Z,`\\bigsqcup `,`&#8852;`),J.bigvee=W(Z,`\\bigvee `,`&#8744;`),J.bigwedge=W(Z,`\\bigwedge `,`&#8743;`),J.bigodot=W(Z,`\\bigodot `,`&#8857;`),J.bigotimes=W(Z,`\\bigotimes `,`&#8855;`),J.bigoplus=W(Z,`\\bigoplus `,`&#8853;`),J.biguplus=W(Z,`\\biguplus `,`&#8846;`),J.lfloor=W(Z,`\\lfloor `,`&#8970;`),J.rfloor=W(Z,`\\rfloor `,`&#8971;`),J.lceil=W(Z,`\\lceil `,`&#8968;`),J.rceil=W(Z,`\\rceil `,`&#8969;`),J.opencurlybrace=J.lbrace=W(Z,`\\lbrace `,`{`),J.closecurlybrace=J.rbrace=W(Z,`\\rbrace `,`}`),J.lbrack=W(Z,`[`),J.rbrack=W(Z,`]`),J.mug=W(Z,`\\mug `,`µg`),J.mus=W(Z,`\\mus `,`µs`),J.mum=W(Z,`\\mum `,`µm`),J.muL=W(Z,`\\muL `,`µL`),J.slash=W(Z,`/`),J.vert=W(Z,`|`),J.perp=J.perpendicular=W(Z,`\\perp `,`&perp;`),J.nabla=J.del=W(Z,`\\nabla `,`&nabla;`),J.hbar=W(Z,`\\hbar `,`&#8463;`),J.AA=J.Angstrom=J.angstrom=W(Z,`\\text\\AA `,`&#8491;`),J.ring=J.circ=J.circle=W(Z,`\\circ `,`&#8728;`),J.bull=J.bullet=W(Z,`\\bullet `,`&bull;`),J.setminus=J.smallsetminus=W(Z,`\\setminus `,`&#8726;`),J.not=J[`¬`]=J.neg=W(Z,`\\neg `,`&not;`),J[`…`]=J.dots=J.ellip=J.hellip=J.ellipsis=J.hellipsis=W(Z,`\\dots `,`&hellip;`),J.converges=J.darr=J.dnarr=J.dnarrow=J.downarrow=W(Z,`\\downarrow `,`&darr;`),J.dArr=J.dnArr=J.dnArrow=J.Downarrow=W(Z,`\\Downarrow `,`&dArr;`),J.diverges=J.uarr=J.uparrow=W(Z,`\\uparrow `,`&uarr;`),J.uArr=J.Uparrow=W(Z,`\\Uparrow `,`&uArr;`),J.to=W(Q,`\\to `,`&rarr;`),J.rarr=J.rightarrow=W(Z,`\\rightarrow `,`&rarr;`),J.implies=W(Q,`\\Rightarrow `,`&rArr;`),J.rArr=J.Rightarrow=W(Z,`\\Rightarrow `,`&rArr;`),J.gets=W(Q,`\\gets `,`&larr;`),J.larr=J.leftarrow=W(Z,`\\leftarrow `,`&larr;`),J.impliedby=W(Q,`\\Leftarrow `,`&lArr;`),J.lArr=J.Leftarrow=W(Z,`\\Leftarrow `,`&lArr;`),J.harr=J.lrarr=J.leftrightarrow=W(Z,`\\leftrightarrow `,`&harr;`),J.iff=W(Q,`\\Leftrightarrow `,`&hArr;`),J.hArr=J.lrArr=J.Leftrightarrow=W(Z,`\\Leftrightarrow `,`&hArr;`),J.Re=J.Real=J.real=W(Z,`\\Re `,`&real;`),J.Im=J.imag=J.image=J.imagin=J.imaginary=J.Imaginary=W(Z,`\\Im `,`&image;`),J.part=J.partial=W(Z,`\\partial `,`&part;`),J.infty=J.infin=J.infinity=W(Z,`\\infty `,`&infin;`),J.pounds=W(Z,`\\pounds `,`&pound;`),J.alef=J.alefsym=J.aleph=J.alephsym=W(Z,`\\aleph `,`&alefsym;`),J.xist=J.xists=J.exist=J.exists=W(Z,`\\exists `,`&exist;`),J.nexists=J.nexist=W(Z,`\\nexists `,`&#8708;`),J.and=J.land=J.wedge=W(Q,`\\wedge `,`&and;`),J.or=J.lor=J.vee=W(Q,`\\vee `,`&or;`),J.o=J.O=J.empty=J.emptyset=J.oslash=J.Oslash=J.nothing=J.varnothing=W(Q,`\\varnothing `,`&empty;`),J.cup=J.union=W(Q,`\\cup `,`&cup;`),J.cap=J.intersect=J.intersection=W(Q,`\\cap `,`&cap;`),J.deg=J.degree=W(Z,`\\degree `,`&deg;`),J.ang=J.angle=W(Z,`\\angle `,`&ang;`),J.measuredangle=W(Z,`\\measuredangle `,`m&ang;`);var jy=G(Z,function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[K]instanceof My&&e[K].isItalic!==!1||e[K]instanceof sb&&e[K][K]instanceof My&&e[K][K].isItalic!==!1)?(J._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e)}}),My=G(Cy,function(e,t){e.init=function(e,n){t.init.call(this,e,`<var>`+(n||e)+`</var>`)},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?e[0]==`\\`?e=e.slice(1,e.length):e[e.length-1]==` `&&(e=e.slice(0,-1)):(this[K]&&!(this[K]instanceof My)&&!(this[K]instanceof Q)&&this[K].ctrlSeq!==`\\ `&&(e=`*`+e),this[q]&&!(this[q]instanceof Q)&&!(this[q]instanceof sb)&&(e+=`*`)),e}});cy.p.autoCommands={_maxLength:0},ly.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`autocommand "`+a+`" not minimum length of 2`;if(J[a]===Ly)throw`"`+a+`" is a built-in operator name`;n[a]=1,r=Wv(r,a.length)}return n._maxLength=r,n};var Ny=G(My,function(e,t){e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i=``,a=this,o=0;a instanceof Ny&&a.ctrlSeq===a.letter&&o<r;)i=a.letter+i,a=a[K],o+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(var o=1,a=this;o<i.length;o+=1,a=a[K]);return ty(a,this).remove(),e[K]=a[K],J[i](i).createLeftOf(e)}i=i.slice(1)}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass(`mq-operator-name`,!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==K&&this[q]instanceof Ny||this.autoUnItalicize(e)},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(t._maxLength!==0){for(var r=this.letter,i=this[K];i instanceof Ny;i=i[K])r=i.letter+r;for(var a=this[q];a instanceof Ny;a=a[q])r+=a.letter;ty(i[q]||this.parent.ends[K],a[K]||this.parent.ends[q]).each(function(e){e.italicize(!0).jQ.removeClass(`mq-first mq-last mq-followed-by-supsub`),e.ctrlSeq=e.letter});outer:for(var o=0,s=i[q]||this.parent.ends[K];o<r.length;o+=1,s=s[q])for(var c=Uv(t._maxLength,r.length-o);c>0;--c){var l=r.slice(o,o+c);if(t.hasOwnProperty(l)){for(var u=0,d=s;u<c;u+=1,d=d[q]){d.italicize(!1);var f=d}var p=Py.hasOwnProperty(l);if(s.ctrlSeq=(p?`\\`:`\\operatorname{`)+s.ctrlSeq,f.ctrlSeq+=p?` `:`}`,Iy.hasOwnProperty(l)&&f[K][K][K].jQ.addClass(`mq-last`),n(s[K])||s.jQ.addClass(`mq-first`),!n(f[q]))if(f[q]instanceof sb){var m=f[q];(m.siblingCreated=m.siblingDeleted=function(){m.jQ.toggleClass(`mq-after-operator-name`,!(m[q]instanceof gb))})()}else f.jQ.toggleClass(`mq-last`,!(f[q]instanceof gb));o+=c-1,s=f;continue outer}}}};function n(e){return!e||e instanceof Q||e instanceof ub}}),Py={},Fy=cy.p.autoOperatorNames={_maxLength:9},Iy={limsup:1,liminf:1,projlim:1,injlim:1};(function(){for(var e=`arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr`.split(` `),t=0;t<e.length;t+=1)Py[e[t]]=Fy[e[t]]=1;for(var n=`sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth`.split(` `),t=0;t<n.length;t+=1)Py[n[t]]=1;for(var r=`sin cos tan sec cosec csc cotan cot ctg`.split(` `),t=0;t<r.length;t+=1)Fy[r[t]]=Fy[`arc`+r[t]]=Fy[r[t]+`h`]=Fy[`ar`+r[t]+`h`]=Fy[`arc`+r[t]+`h`]=1;for(var i=`gcf hcf lcm proj span`.split(` `),t=0;t<i.length;t+=1)Fy[i[t]]=1})(),ly.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw`"`+e+`" not a space-delimited list of only letters`;for(var t=e.split(` `),n={},r=0,i=0;i<t.length;i+=1){var a=t[i];if(a.length<2)throw`"`+a+`" not minimum length of 2`;n[a]=1,r=Wv(r,a.length)}return n._maxLength=r,n};var Ly=G(Cy,function(e,t){e.init=function(e){this.ctrlSeq=e},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)Ny(t.charAt(n)).createLeftOf(e)},e.parser=function(){for(var e=this.ctrlSeq,t=wy(),n=0;n<e.length;n+=1)Ny(e.charAt(n)).adopt(t,t.ends[q],0);return Y.succeed(t.children())}});for(var Ry in Fy)Fy.hasOwnProperty(Ry)&&(J[Ry]=Ly);J.operatorname=G(X,function(e){e.createLeftOf=Gv,e.numBlocks=function(){return 1},e.parser=function(){return xy.block.map(function(e){return e.children()})}}),J.f=G(Ny,function(e,t){e.init=function(){Cy.p.init.call(this,this.letter=`f`,`<var class="mq-f">f</var>`)},e.italicize=function(e){return this.jQ.html(`f`).toggleClass(`mq-f`,e),t.italicize.apply(this,arguments)}}),J[` `]=J.space=W(Z,`\\ `,`&nbsp;`),J[`'`]=J.prime=W(Z,`'`,`&prime;`),J[`″`]=J.dprime=W(Z,`″`,`&Prime;`),J[`"`]=J.doublePrime=W(Z,`"`,`&Prime;`),J.backslash=W(Z,`\\backslash `,`\\`),ny[`\\`]||=J.backslash,J.$=W(Z,`\\$`,`$`);var zy=G(Cy,function(e,t){e.init=function(e,n){t.init.call(this,e,`<span class="mq-nonSymbola">`+(n||e)+`</span>`)}});J[`@`]=zy,J[`&`]=W(zy,`\\&`,`&amp;`),J[`%`]=W(zy,`\\%`,`%`),J.alpha=J.beta=J.gamma=J.delta=J.zeta=J.eta=J.theta=J.iota=J.kappa=J.mu=J.nu=J.xi=J.rho=J.sigma=J.tau=J.chi=J.psi=J.omega=G(My,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),J.phi=W(My,`\\phi `,`&#981;`),J.phiv=J.varphi=W(My,`\\varphi `,`&phi;`),J.epsilon=W(My,`\\epsilon `,`&#1013;`),J.epsiv=J.varepsilon=W(My,`\\varepsilon `,`&epsilon;`),J.piv=J.varpi=W(My,`\\varpi `,`&piv;`),J.sigmaf=J.sigmav=J.varsigma=W(My,`\\varsigma `,`&sigmaf;`),J.thetav=J.vartheta=J.thetasym=W(My,`\\vartheta `,`&thetasym;`),J.upsilon=J.upsi=W(My,`\\upsilon `,`&upsilon;`),J.gammad=J.Gammad=J.digamma=W(My,`\\digamma `,`&#989;`),J.kappav=J.varkappa=W(My,`\\varkappa `,`&#1008;`),J.rhov=J.varrho=W(My,`\\varrho `,`&#1009;`),J.pi=J.π=W(zy,`\\pi `,`&pi;`),J.lambda=W(zy,`\\lambda `,`&lambda;`),J.Upsilon=J.Upsi=J.upsih=J.Upsih=W(Cy,`\\Upsilon `,`<var style="font-family: serif">&upsih;</var>`),J.Gamma=J.Delta=J.Theta=J.Lambda=J.Xi=J.Pi=J.Sigma=J.Phi=J.Psi=J.Omega=G(Z,function(e,t){e.init=function(e){t.init.call(this,`\\`+e+` `,`&`+e+`;`)}}),J.forall=J[`∀`]=W(Z,`\\forall `,`&#8704;`);var By=G(X,function(e){e.init=function(e){this.latex=e},e.createLeftOf=function(e){var t=xy.parse(this.latex);t.children().adopt(e.parent,e[K],e[q]),e[K]=t.ends[q],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[q][q].siblingCreated&&t.ends[q][q].siblingCreated(e.options,K),t.ends[K][K].siblingCreated&&t.ends[K][K].siblingCreated(e.options,q),e.parent.bubble(`reflow`)},e.parser=function(){var e=xy.parse(this.latex).children();return Y.succeed(e)}});J[`¹`]=W(By,`^1`),J[`²`]=W(By,`^2`),J[`³`]=W(By,`^3`),J[`¼`]=W(By,`\\frac14`),J[`½`]=W(By,`\\frac12`),J[`¾`]=W(By,`\\frac34`);var Vy=G(Q,function(e){e.init=Z.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){function n(e){if(e[K]){if(e[K]instanceof Q||/^[,;:\(\[]$/.test(e[K].ctrlSeq))return``}else if(e.parent&&e.parent.parent&&e.parent.parent.isStyleBlock())return n(e.parent.parent);else return``;return`mq-binary-operator`}if(t!==q)return this.jQ[0].className=n(this),this}});J[`+`]=W(Vy,`+`,`+`),J[`–`]=J[`-`]=W(Vy,`-`,`&minus;`),J[`±`]=J.pm=J.plusmn=J.plusminus=W(Vy,`\\pm `,`&plusmn;`),J.mp=J.mnplus=J.minusplus=W(Vy,`\\mp `,`&#8723;`),ny[`*`]=J.sdot=J.cdot=W(Q,`\\cdot `,`&middot;`,`*`);var Hy=G(Q,function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?`Strict`:``;t.init.call(this,e[`ctrlSeq`+r],e[`html`+r],e[`text`+r])},e.swap=function(e){this.strict=e;var t=e?`Strict`:``;this.ctrlSeq=this.data[`ctrlSeq`+t],this.jQ.html(this.data[`html`+t]),this.textTemplate=[this.data[`text`+t]]},e.deleteTowards=function(e,n){if(e===K&&!this.strict){this.swap(!0),this.bubble(`reflow`);return}t.deleteTowards.apply(this,arguments)}}),Uy={ctrlSeq:`\\le `,html:`&le;`,text:`≤`,ctrlSeqStrict:`<`,htmlStrict:`&lt;`,textStrict:`<`},Wy={ctrlSeq:`\\ge `,html:`&ge;`,text:`≥`,ctrlSeqStrict:`>`,htmlStrict:`&gt;`,textStrict:`>`};J[`<`]=J.lt=W(Hy,Uy,!0),J[`>`]=J.gt=W(Hy,Wy,!0),J[`≤`]=J.le=J.leq=W(Hy,Uy,!1),J[`≥`]=J.ge=J.geq=W(Hy,Wy,!1);var Gy=G(Q,function(e,t){e.init=function(){t.init.call(this,`=`,`=`)},e.createLeftOf=function(e){if(e[K]instanceof Hy&&e[K].strict){e[K].swap(!1),e[K].bubble(`reflow`);return}t.createLeftOf.apply(this,arguments)}});J[`=`]=Gy,J[`×`]=J.times=W(Q,`\\times `,`&times;`,`[x]`),J[`÷`]=J.div=J.divide=J.divides=W(Q,`\\div `,`&divide;`,`[/]`),ny[`~`]=J.sim=W(Q,`\\sim `,`~`,`~`),ny[`≁`]=J.nsim=W(Q,`\\nsim `,`≁`,`≁`),J.complement=J[`∁`]=W(Z,`\\complement `,`&#8705;`),J.nexists=J[`∄`]=W(Z,`\\nexists `,`&#8708;`),J.sphericalangle=J[`∢`]=W(Z,`\\sphericalangle `,`&#8738;`),J.iint=J[`∬`]=W(Z,`\\iint `,`&#8748;`),J.iiint=J[`∭`]=W(Z,`\\iiint `,`&#8749;`),J.oiint=J[`∯`]=W(Z,`\\oiint `,`&#8751;`),J.oiiint=J[`∰`]=W(Z,`\\oiiint `,`&#8752;`),J.backsim=J[`∽`]=W(Z,`\\backsim `,`&#8765;`),J.backsimeq=J[`⋍`]=W(Z,`\\backsimeq `,`&#8909;`),J.eqsim=J[`≂`]=W(Z,`\\eqsim `,`&#8770;`),J.ncong=J[`≇`]=W(Z,`\\ncong `,`&#8775;`),J.approxeq=J[`≊`]=W(Z,`\\approxeq `,`&#8778;`),J.bumpeq=J[`≏`]=W(Z,`\\bumpeq `,`&#8783;`),J.Bumpeq=J[`≎`]=W(Z,`\\Bumpeq `,`&#8782;`),J.doteqdot=J[`≑`]=W(Z,`\\doteqdot `,`&#8785;`),J.fallingdotseq=J[`≒`]=W(Z,`\\fallingdotseq `,`&#8786;`),J.risingdotseq=J[`≓`]=W(Z,`\\risingdotseq `,`&#8787;`),J.eqcirc=J[`≖`]=W(Z,`\\eqcirc `,`&#8790;`),J.circeq=J[`≗`]=W(Z,`\\circeq `,`&#8791;`),J.triangleq=J[`≜`]=W(Z,`\\triangleq `,`&#8796;`),J.leqq=J[`≦`]=W(Z,`\\leqq `,`&#8806;`),J.geqq=J[`≧`]=W(Z,`\\geqq `,`&#8807;`),J.lneqq=J[`≨`]=W(Z,`\\lneqq `,`&#8808;`),J.gneqq=J[`≩`]=W(Z,`\\gneqq `,`&#8809;`),J.between=J[`≬`]=W(Z,`\\between `,`&#8812;`),J.nleq=J[`≰`]=W(Z,`\\nleq `,`&#8816;`),J.ngeq=J[`≱`]=W(Z,`\\ngeq `,`&#8817;`),J.lesssim=J[`≲`]=W(Z,`\\lesssim `,`&#8818;`),J.gtrsim=J[`≳`]=W(Z,`\\gtrsim `,`&#8819;`),J.lessgtr=J[`≶`]=W(Z,`\\lessgtr `,`&#8822;`),J.gtrless=J[`≷`]=W(Z,`\\gtrless `,`&#8823;`),J.preccurlyeq=J[`≼`]=W(Z,`\\preccurlyeq `,`&#8828;`),J.succcurlyeq=J[`≽`]=W(Z,`\\succcurlyeq `,`&#8829;`),J.precsim=J[`≾`]=W(Z,`\\precsim `,`&#8830;`),J.succsim=J[`≿`]=W(Z,`\\succsim `,`&#8831;`),J.nprec=J[`⊀`]=W(Z,`\\nprec `,`&#8832;`),J.nsucc=J[`⊁`]=W(Z,`\\nsucc `,`&#8833;`),J.subsetneq=J[`⊊`]=W(Z,`\\subsetneq `,`&#8842;`),J.supsetneq=J[`⊋`]=W(Z,`\\supsetneq `,`&#8843;`),J.vDash=J[`⊨`]=W(Z,`\\vDash `,`&#8872;`),J.Vdash=J[`⊩`]=W(Z,`\\Vdash `,`&#8873;`),J.Vvdash=J[`⊪`]=W(Z,`\\Vvdash `,`&#8874;`),J.VDash=J[`⊫`]=W(Z,`\\VDash `,`&#8875;`),J.nvdash=J[`⊬`]=W(Z,`\\nvdash `,`&#8876;`),J.nvDash=J[`⊭`]=W(Z,`\\nvDash `,`&#8877;`),J.nVdash=J[`⊮`]=W(Z,`\\nVdash `,`&#8878;`),J.nVDash=J[`⊯`]=W(Z,`\\nVDash `,`&#8879;`),J.vartriangleleft=J[`⊲`]=W(Z,`\\vartriangleleft `,`&#8882;`),J.vartriangleright=J[`⊳`]=W(Z,`\\vartriangleright `,`&#8883;`),J.trianglelefteq=J[`⊴`]=W(Z,`\\trianglelefteq `,`&#8884;`),J.trianglerighteq=J[`⊵`]=W(Z,`\\trianglerighteq `,`&#8885;`),J.multimap=J[`⊸`]=W(Z,`\\multimap `,`&#8888;`),J.Subset=J[`⋐`]=W(Z,`\\Subset `,`&#8912;`),J.Supset=J[`⋑`]=W(Z,`\\Supset `,`&#8913;`),J.Cap=J[`⋒`]=W(Z,`\\Cap `,`&#8914;`),J.Cup=J[`⋓`]=W(Z,`\\Cup `,`&#8915;`),J.pitchfork=J[`⋔`]=W(Z,`\\pitchfork `,`&#8916;`),J.lessdot=J[`⋖`]=W(Z,`\\lessdot `,`&#8918;`),J.gtrdot=J[`⋗`]=W(Z,`\\gtrdot `,`&#8919;`),J.lll=J[`⋘`]=W(Z,`\\lll `,`&#8920;`),J.ggg=J[`⋙`]=W(Z,`\\ggg `,`&#8921;`),J.lesseqgtr=J[`⋚`]=W(Z,`\\lesseqgtr `,`&#8922;`),J.gtreqless=J[`⋛`]=W(Z,`\\gtreqless `,`&#8923;`),J.curlyeqprec=J[`⋞`]=W(Z,`\\curlyeqprec `,`&#8926;`),J.curlyeqsucc=J[`⋟`]=W(Z,`\\curlyeqsucc `,`&#8927;`),J.nsim=J[`≁`]=W(Z,`\\nsim `,`&#8769;`),J.lnsim=J[`⋦`]=W(Z,`\\lnsim `,`&#8934;`),J.gnsim=J[`⋧`]=W(Z,`\\gnsim `,`&#8935;`),J.precnsim=J[`⋨`]=W(Z,`\\precnsim `,`&#8936;`),J.succnsim=J[`⋩`]=W(Z,`\\succnsim `,`&#8937;`),J.ntriangleleft=J[`⋪`]=W(Z,`\\ntriangleleft `,`&#8938;`),J.ntriangleright=J[`⋫`]=W(Z,`\\ntriangleright `,`&#8939;`),J.ntrianglelefteq=J[`⋬`]=W(Z,`\\ntrianglelefteq `,`&#8940;`),J.ntrianglerighteq=J[`⋭`]=W(Z,`\\ntrianglerighteq `,`&#8941;`),J.blacksquare=J[`∎`]=W(Z,`\\blacksquare `,`&#8718;`),J.colon=J[`∶`]=W(Z,`\\colon `,`&#8758;`),J.llcorner=J[`∟`]=W(Z,`\\llcorner `,`&#8735;`),J.dotplus=J[`∔`]=W(Q,`\\dotplus `,`&#8724;`),J.nmid=J[`∤`]=W(Q,`
162
- mid `,`&#8740;`),J.intercal=J[`⊺`]=W(Q,`\\intercal `,`&#8890;`),J.veebar=J[`⊻`]=W(Q,`\\veebar `,`&#8891;`),J.barwedge=J[`⊼`]=W(Q,`\\barwedge `,`&#8892;`),J.ltimes=J[`⋉`]=W(Q,`\\ltimes `,`&#8905;`),J.rtimes=J[`⋊`]=W(Q,`\\rtimes `,`&#8906;`),J.leftthreetimes=J[`⋋`]=W(Q,`\\leftthreetimes `,`&#8907;`),J.rightthreetimes=J[`⋌`]=W(Q,`\\rightthreetimes `,`&#8908;`),J.curlyvee=J[`⋎`]=W(Q,`\\curlyvee `,`&#8910;`),J.curlywedge=J[`⋏`]=W(Q,`\\curlywedge `,`&#8911;`),J.circledcirc=J[`⊚`]=W(Q,`\\circledcirc `,`&#8858;`),J.circledast=J[`⊛`]=W(Q,`\\circledast `,`&#8859;`),J.circleddash=J[`⊝`]=W(Q,`\\circleddash `,`&#8861;`),J.boxplus=J[`⊞`]=W(Q,`\\boxplus `,`&#8862;`),J.boxminus=J[`⊟`]=W(Q,`\\boxminus `,`&#8863;`),J.boxtimes=J[`⊠`]=W(Q,`\\boxtimes `,`&#8864;`),J.boxdot=J[`⊡`]=W(Q,`\\boxdot `,`&#8865;`),J[`∂`]=J.partial,J[`∃`]=J.exists,J[`∅`]=J.varnothing,J[`∆`]=J.triangle,J[`∇`]=J.nabla,J[`∈`]=J.in,J[`∊`]=J.in,J[`∋`]=J.ni,J[`∌`]=J.notni,J[`∍`]=J.ni,J[`∐`]=J.amalg,J[`−`]=J[`-`],J[`∓`]=J.mp,J[`∖`]=J.setminus,J[`∘`]=J.circ,J[`∙`]=J.bullet,J[`∝`]=J.propto,J[`∞`]=J.infty,J[`∠`]=J.angle,J[`∡`]=J.measuredangle,J[`∣`]=J.divides,J[`∥`]=J.parallel,J[`∦`]=J.nparallel,J[`∧`]=J.wedge,J[`∨`]=J.vee,J[`∩`]=J.cap,J[`∪`]=J.cup,J[`∮`]=J.oint,J[`∴`]=J.therefore,J[`∵`]=J.because,J[`∼`]=J.sim,J[`≀`]=J.wr,J[`≃`]=J.simeq,J[`≍`]=J.asymp,J[`≐`]=J.doteq,J[`≪`]=J.ll,J[`≫`]=J.gg,J[`≺`]=J.prec,J[`≻`]=J.succ,J[`⊂`]=J.subset,J[`⊃`]=J.supset,J[`⊆`]=J.subseteq,J[`⊇`]=J.supseteq,J[`⊈`]=J.nsubseteq,J[`⊉`]=J.nsupseteq,J[`⊏`]=J.sqsubset,J[`⊐`]=J.sqsupset,J[`⊓`]=J.sqcap,J[`⊔`]=J.sqcup,J[`⊖`]=J.ominus,J[`⊘`]=J.oslash,J[`⊙`]=J.odot,J[`⊢`]=J.vdash,J[`⊣`]=J.dashv,J[`⊤`]=J.top,J[`⊥`]=J.bot,J[`⊧`]=J.models,J[`⋀`]=J.wedge,J[`⋁`]=J.vee,J[`⋂`]=J.cap,J[`⋃`]=J.cup,J[`⋄`]=J.diamond,J[`⋅`]=J.cdot,J[`⋆`]=J.star,J[`⋈`]=J.bowtie,J[`⋮`]=J.vdots,J[`⋯`]=J.cdots,J[`⋱`]=J.ddots;var Ky,qy=Gv,Jy=document.createElement(`div`).style,Yy={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},Xy;for(var Zy in Yy)if(Zy in Jy){Xy=Zy;break}Xy?Ky=function(e,t,n){e.css(Xy,`scale(`+t+`,`+n+`)`)}:`filter`in Jy?(qy=function(e){e.className=e.className},Ky=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);U(window).load(function(){clearTimeout(a),i()})}):Ky=function(e,t,n){e.css(`fontSize`,n+`em`)};var Qy=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),$y=G(X,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return xy.optBlock.then(function(t){return xy.block.map(function(n){var r=eb.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),eb=G($y,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,X.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[K].latex()+`]{`+this.ends[q].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[K].upOutOf=this.ends[q],this.upInto=this.ends[q].downOutOf=this.ends[K]}}),tb=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return G(X,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},nb=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),rb=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),ib=G(X,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">&#x2d9;</span><span class="mq-empty-box">&0</span></span></span>`)}}),ab=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),ob=function(e,t){return G(Cy,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};J.mathrm=W(Qy,`\\mathrm`,`span`,`class="mq-roman mq-font"`),J.mathit=W(Qy,`\\mathit`,`i`,`class="mq-font"`),J.mathbf=W(Qy,`\\mathbf`,`b`,`class="mq-font"`),J.mathsf=W(Qy,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),J.mathtt=W(Qy,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),J.underline=W(Qy,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),J.overline=J.bar=W(tb(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),J.longdiv=W(nb,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),J.overrightarrow=W(tb(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),J.overleftarrow=W(tb(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),J.xleftarrow=W($y,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),J.xrightarrow=W($y,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),J.overleftrightarrow=W(Qy,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),J.overarc=W(Qy,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),J.dot=G(X,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">&#x2d9;</span><span class="mq-empty-box">&0</span></span></span>`)}}),J.addmatrixrow=W(rb,`\\addmatrixrow`,`span`,`+`),J.addmatrixcol=W(ab,`\\addmatrixcol`,`span`,`+`),J.ngtr=J[`≯`]=W(ob(`mq-ngtr`,`&#8815;`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),J.nless=J[`≮`]=W(ob(`mq-nless`,`&#8814;`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),J.dot=W(ib,`\\dot`),J.parallelogram=W(ob(`mq-parallelogram`,`&#9649;`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),J.textcolor=G(X,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=Y.optWhitespace,r=Y.string,i=Y.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),J.class=G(X,function(e,t){e.parser=function(){var e=this,n=Y.string,r=Y.regex;return Y.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var sb=G(X,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[K]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=K;t;t=t===K&&q)if(this[t]instanceof sb){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=Qv(i,0,i.ends[K]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=Qv(i,o.ends[q],i.ends[K]);t===K?o.adopt(i,i.ends[q],0):o.adopt(i,0,i.ends[K])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[K]===this&&(t===q&&a?a[K]?e.insRightOf(a[K]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},cy.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[K].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof Cy?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[K]&&!e[q]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),wy.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof Cy?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(K,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=U(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(Hv,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=U(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(Hv,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">&#8203;</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=cb,delete e[n].deleteOutOf,t===`sub`&&U(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function cb(e){var t=this.parent,n=e;do{if(n[q])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}J.subscript=J._=G(sb,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">&#8203;</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[K],this.sub.upOutOf=cb,t.finalizeTree.call(this)}}),J.superscript=J.supscript=J[`^`]=G(sb,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[q],this.sup.downOutOf=cb,t.finalizeTree.call(this)}});var lb=G(X,function(e,t){e.parser=function(){for(var e=Y.string,t=Y.optWhitespace,n=Y.succeed,r=xy.block,i=this,a=i.blocks=[wy(),wy()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[q],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[q],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[K],this.upInto=this.ends[q],this.ends[K].upOutOf=this.ends[q],this.ends[q].downOutOf=this.ends[K]}}),ub=G(lb,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;Cy.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[K].latex())+`^`+e(this.ends[q].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(Ny(`n`).createLeftOf(e),Gy().createLeftOf(e))}});J[`∑`]=J.sum=J.summation=W(ub,`\\sum `,`&sum;`),J[`∏`]=J.prod=J.product=W(ub,`\\prod `,`&prod;`),J.coprod=J.coproduct=W(ub,`\\coprod `,`&#8720;`),J[`∫`]=J.int=J.integral=G(ub,function(e,t){e.init=function(){Cy.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>&int;</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">&#8203</span></span></span>`)},e.createLeftOf=X.p.createLeftOf}),J.lim=J.limit=G(lb,function(e,t){e.init=function(){Cy.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[K].latex())}});var db=J.over=ny[`/`]=G(J.frac=J.dfrac=J.cfrac=J.fraction=G(X,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">&#8203;</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[q].upOutOf=this.ends[K],this.downInto=this.ends[K].downOutOf=this.ends[q]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[K];n&&!(n instanceof Q||n instanceof(J.text||Gv)||n instanceof ub||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[K];n instanceof ub&&n[q]instanceof sb&&(n=n[q],n[q]instanceof sb&&n[q].ctrlSeq!=n.ctrlSeq&&(n=n[q])),n!==e[K]&&!e.isTooDeep(1)&&(this.replaces(ty(n[q]||e.parent.ends[K],e[K])),e[K]=n)}t.createLeftOf.call(this,e)}});J.underset=G(X,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[K].upOutOf=this.ends[q],this.upInto=this.ends[q].downOutOf=this.ends[K]}}),J.overset=G(X,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[q].upOutOf=this.ends[K],this.upInto=this.ends[K].downOutOf=this.ends[q]}});var fb=J.sqrt=J[`√`]=G(X,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">&radic;</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return xy.optBlock.then(function(e){return xy.block.map(function(t){var n=pb();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[q].jQ.parent();Ky(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});J.hat=G(X,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var pb=J.nthroot=G(fb,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">&radic;</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[K].latex()+`]{`+this.ends[q].latex()+`}`}}),mb=G(X,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});J.vec=W(mb,`\\vec`,`&rarr;`,[`vec(`,`)`]),J.tilde=W(mb,`\\tilde`,`~`,[`tilde(`,`)`]),J.lrncuberoot=G(fb,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">&radic;</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[K].latex()+`}`}}),J.abs=G(X,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),J.lrnplaceholder=G(X,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[K].latex()}}),J.lrnexponent=G(X,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[q].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[K].latex()+`^`+e}}),J.lrnsquaredexponent=G(X,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[K].latex()+`^2`}}),J.lrnsubscript=G(X,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">&nbsp;</span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[K].latex()+`_`+this.ends[q].latex()}});function hb(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));Ky(this.delimjQs,Uv(1+.2*(e-1),1.2),1.2*e)}}var gb=G(G(X,hb),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,Bv,[n,r]),this.side=e,this.sides={},this.sides[K]={ch:n,ctrlSeq:i},this.sides[q]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===q?` mq-ghost`:``)+`">`+this.sides[K].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===K?` mq-ghost`:``)+`">`+this.sides[q].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[K].ctrlSeq+this.ends[K].latex()+`\\right`+this.sides[q].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof gb&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||_b[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[K].ch]===n.sides[q].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===K?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[K].ch===`|`)var r=this.matchBrack(n,q,e[q])||this.matchBrack(n,K,e[K])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&ty(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(ty(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===K?e.insAtLeftEnd(r.ends[K]):e.insRightOf(r)},e.placeCursor=Gv,e.unwrap=function(){this.ends[K].children().disown().adopt(this.parent,this,this[q]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[K].ends[this.side])){this.closeOpposing(this.ends[K].ends[this.side]);var c=this.ends[K].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:_b[this.sides[this.side].ch],ctrlSeq:_b[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===K?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[K].ends[e];ty(i,a,-e).disown().withDirAdopt(-e,this.ends[K],c,0).jQ.insAtDirEnd(e,this.ends[K].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[K])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[K].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===K)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),_b={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"&lang;":`&rang;`,"&rang;":`&lang;`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function vb(e,t){var t=t||e,n=_b[e],r=_b[t];ny[e]=W(gb,K,e,n,t,r),ny[n]=W(gb,q,e,n,t,r)}vb(`(`),vb(`[`),vb(`{`,`\\{`),J.langle=W(gb,K,`&lang;`,`&rang;`,`\\langle `,`\\rangle `),J.rangle=W(gb,q,`&lang;`,`&rang;`,`\\langle `,`\\rangle `),ny[`|`]=W(gb,K,`|`,`|`,`|`,`|`),J.lVert=W(gb,K,`&#8741;`,`&#8741;`,`\\lVert `,`\\rVert `),J.rVert=W(gb,q,`&#8741;`,`&#8741;`,`\\lVert `,`\\rVert `),J.left=G(X,function(e){e.parser=function(){var e=Y.regex,t=Y.string;Y.succeed;var n=Y.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`&lang;`,r+=` `),r==`\\lVert`&&(i=`&#8741;`,r+=` `),xy.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`&rang;`,e+=` `),e==`\\rVert`&&(t=`&#8741;`,e+=` `);var n=gb(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),J.right=G(X,function(e){e.parser=function(){return Y.fail(`unmatched \\right`)}}),J.choose=G(J.binom=J.binomial=G(G(X,hb),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=db.prototype.createLeftOf}),J.editable=J.MathQuillMathField=G(X,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=Y.string,r=Y.regex,i=Y.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=oy(this.ends[K],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),vy(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[K].controller))},e.latex=function(){return this.ends[K].latex()},e.text=function(){return this.ends[K].text()}});var yb=J.embed=G(Cy,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=Y.string,n=Y.regex,r=Y.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(dy[i](t))})})}});J.MathQuillResponseContainer=G(X,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[K].text()}}),J.MathQuillResponseContainerIcon=G(X,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[K].text()}});var bb=J.matrix=G(X,function(e,t){var n=G(wy,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[q],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&Ky(n,Uv(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=Y.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);xy.parse(u[e]||` `).children().adopt(f,f.ends[q],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[q],0);return Y.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=$v.byId[e.first().attr(Hv)],n=$v.byId[e.last().attr(Hv)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=$v.byId[U(this).attr(Hv)],a=e.eq(t+1),o=U(this).closest(`tr`).next(`tr`),s=U(this).closest(`tr`).index(),c=U(this).index(),l;if(a.length){var u=$v.byId[a.attr(Hv)];n[q]=u,u[K]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=$v.byId[l.attr(Hv)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[K]=t,this.ends[q]=n,t&&t[K]&&delete t[K],n&&n[q]&&delete n[q],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return U(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return $v.byId[U(this).attr(Hv)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=$v.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(Hv)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=U(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=U(`<td class="mq-empty">`).attr(Hv,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=U(`<td class="mq-empty">`).attr(Hv,a.id),a.jQ.insertAfter(U(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});J.pmatrix=G(bb,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),J.bmatrix=G(bb,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),J.Bmatrix=G(bb,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),J.vmatrix=G(bb,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),J.Vmatrix=G(bb,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var xb=gy(3);for(var Sb in xb)(function(e,t){typeof t==`function`?(py[e]=function(){return fy(),t.apply(this,arguments)},py[e].prototype=t.prototype):py[e]=t})(Sb,xb[Sb]);var Cb=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},wb;typeof window<`u`&&(wb=py.getInterface(3),wb&&wb.registerEmbed&&Cb(wb));function Tb(e,t){!wb||!wb.registerEmbed||wb.registerEmbed(e,t)}function Eb(e,t,n){if(!(!wb||!e))return t!=null&&(e.textContent=t),wb.StaticMath(e,n)}var Db=lm(`pie-lib:math-input:mq:static`),Ob=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,kb=/ /g;function Ab(e=``){return e.replace(kb,``)}function jb(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var Mb=class extends P.Component{static propTypes={latex:D.string.isRequired,onFocus:D.func,onBlur:D.func,className:D.string,getFieldName:D.func,onSubFieldChange:D.func,onSubFieldFocus:D.func,setInput:D.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=P.createRef()}componentDidMount(){this.update(),Lf(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),Lf()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(jb(e)>jb(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!wb)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=wb.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{Db(`blur mathfield`),this.mathField.blur()};focus=()=>{Db(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=Ab(this.mathField.parseLatex(e.latex)),n=(e.latex.match(Ob)||[]).length,r=t!==Ab(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return Db(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,F.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},Nb={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},Pb={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},Fb={"& *":{...Nb,...Pb,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},Ib=e=>(ae(5-e.length,()=>e.push([])),oe.apply(null,e)),Lb=lm(`pie-lib:math-inline:keypad`),Rb=L(Mb)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:zh(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${Fg()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});Rb.propTypes={latex:D.string.isRequired};var zb=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},Bb=L(`div`)(()=>({...Fb,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),Vb=L(nm)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:zh(),backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),Hb=L(nm)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()}})),Ub=L(cm)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()},borderRadius:0,"& .icon":{height:`30px`}})),Wb=class extends P.Component{static propTypes={className:D.string,controlledKeypadMode:D.bool,baseSet:D.array,additionalKeys:D.array,layoutForKeyPad:D.object,onPress:D.func.isRequired,onFocus:D.func,noDecimal:D.bool,setKeypadInteraction:D.func,mode:D.oneOfType([D.string,D.number])};static defaultProps={baseSet:Xf,noDecimal:!1};constructor(e){super(e),this.keypadRef=P.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{Lb(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>O([...Ib(e),...Ib(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...zb(r)};return(0,F.jsx)(Bb,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,F.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,F.jsx)(Hb,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(Rb,{latex:e.latex})},r.key);if(e.label)return(0,F.jsx)(Vb,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,F.jsx)(Ub,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(t,{className:`icon`})},r.key)}})})}},Gb=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},Kb=class extends P.Component{static propTypes={className:D.string,controlledKeypadMode:D.bool,mode:D.oneOfType([D.string,D.number]),layoutForKeyPad:D.object,onClick:D.func.isRequired,onFocus:D.func,noDecimal:D.bool,additionalKeys:D.array,setKeypadInteraction:D.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(Gb(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=If(a);return(0,F.jsx)(Wb,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:Mu(Pf(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},qb=o(((e,t)=>{t.exports={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+`box-flex`]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1}})),Jb=o(((e,t)=>{t.exports={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1}})),Yb=o(((e,t)=>{t.exports=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e}})),Xb=o(((e,t)=>{var n=Yb(),r=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,i=typeof document>`u`?{}:document.documentElement.style;t.exports=(function(){var e=(function(){for(var e in i)if(r.test(e))return e.match(r)[0];return`WebkitOpacity`in i?`Webkit`:`KhtmlOpacity`in i?`Khtml`:``})();return{style:e,css:`-`+e.toLowerCase()+`-`,dom:{Webkit:`WebKit`,ms:`MS`,o:`WebKit`}[e]||n(e)}})()})),Zb=o(((e,t)=>{t.exports=/[-\s]+(.)?/g})),Qb=o(((e,t)=>{var n=function(e,t){return t?t.toUpperCase():``},r=Zb();t.exports=function(e){return e?e.replace(r,n):``}})),$b=o(((e,t)=>{var n=/::/g,r=/([A-Z]+)([A-Z][a-z])/g,i=/([a-z\d])([A-Z])/g,a=/_/g;t.exports=function(e,t){return e?e.replace(n,`/`).replace(r,`$1_$2`).replace(i,`$1_$2`).replace(a,t||`-`):``}})),ex=o(((e,t)=>{var n=$b();t.exports=function(e){return n(e).toLowerCase()}})),tx=o(((e,t)=>{t.exports=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e}})),nx=o(((e,t)=>{var n=Qb(),r=ex(),i=tx(),a=Yb(),o=Xb(),s=qb(),c=typeof document>`u`?{}:document.documentElement.style;t.exports=function(e){return function(t,l){l||={};var u=i(n(t)),d=r(t),f=e?u:d,p=o.style?e?o.style:o.css:``;if(u in c)return l.asString?f:[f];var m=f,h=s[d],g=[];if(e&&(m=a(f)),typeof h==`function`){var _=h(f,p)||[];_&&!Array.isArray(_)&&(_=[_]),_.length&&(_=_.map(function(t){return e?i(n(t)):r(t)})),g=g.concat(_)}return p&&g.push(p+m),g.push(f),l.asString||g.length==1?g[0]:g}}})),rx=o(((e,t)=>{t.exports=nx()()})),ix=o(((e,t)=>{var n=Object.prototype.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}})),ax=o(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return!!e&&n.call(e)===`[object Object]`}})),ox=o(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return n.apply(e)===`[object Function]`}})),sx=o(((e,t)=>{Xb();var n=rx(),r=ex(),i=Qb(),a=ix(),o=ax(),s=ox(),c=function(e,t,r,i){n(t).forEach(function(t){e[i?i(t):t]=r})},l=function(e){e=(e||``).split(`;`);var t={};return e.forEach(function(e){var n=e.split(`:`);n.length==2&&(t[n[0].trim()]=n[1].trim())}),t},u={cssUnitless:Jb()},d=function(e,t,n,f){typeof e==`string`&&(e=l(e)),t||=u,t.cssUnitless=t.cssUnitless||u.cssUnitless,f||={};var p=t.scope||{},m=t.addUnits==null?p&&p.addUnits!=null?p.addUnits:!0:t.addUnits,h=(t.cssUnitless==null?p?p.cssUnitless:null:t.cssUnitless)||{},g=(t.cssUnit||p?p.cssUnit:null)||`px`,_=t.prefixProperties||(p?p.prefixProperties:null)||{},v=t.camelize?i:r,y,b,x,S,C,w,T,E;for(x in e)if(a(e,x)){if(S=e[x],b=r(n?n+x:x),y=!1,E=!1,s(S)&&(T=S.call(p||e,S,x,b,e),o(T)&&T.value!=null?(S=T.value,E=T.prefix,b=T.name?r(T.name):b):S=T),C=typeof S,w=C==`number`||C==`string`&&S!=``&&S*1==S,S==null||b==null||b===``)continue;if((w||C==`string`)&&(y=!0),!y&&S.value!=null&&S.prefix&&(y=!0,E=S.prefix,S=S.value),y){if(E||=!!_[b],w&&(S=m&&!(b in h)?S+g:S+``),(b==`border`||!b.indexOf(`border`)&&!~b.indexOf(`radius`)&&!~b.indexOf(`width`))&&w&&(b+=`-width`),!b.indexOf(`border-radius-`)&&(b.replace(/border(-radius)(-(.*))/,function(e,t,n){var r={"-top":[`-top-left`,`-top-right`],"-left":[`-top-left`,`-bottom-left`],"-right":[`-top-right`,`-bottom-right`],"-bottom":[`-bottom-left`,`-bottom-right`]};n in r?(b=[],r[n].forEach(function(e){b.push(`border`+e+t)})):b=`border`+n+t}),Array.isArray(b))){b.forEach(function(e){E?c(f,e,S,v):f[v(e)]=S});continue}E?c(f,b,S,v):f[v(b)]=S}else d(S,t,b+`-`,f)}return f};t.exports=d})),cx=o(((e,t)=>{var n=sx(),r=ix();t.exports=function(e,t){e=n(e,t);var i=[],a;for(a in e)r(e,a)&&i.push(a+`: `+e[a]);return i.join(`; `)}})),lx=o(((e,t)=>{t.exports={prefixProperties:qb(),cssUnitless:Jb(),object:sx(),string:cx()}}))(),ux=lm(`@pie-lib:mask-markup:serialization`),dx=[`span`],fx=[`em`,`strong`,`u`],px=3,mx=8,hx=1,gx=e=>{if(!e.attributes||e.attributes.length<=0)return;let t={},n;for(n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t},_x=e=>dx.includes(e)?`inline`:fx.includes(e)?`mark`:`block`,vx=e=>{let t=/([\w-]*)\s*:\s*([^;]*)/g,n,r={};for(;n=t.exec(e);)r[n[1]]=n[2].trim();return r},yx=e=>(0,lx.object)(e,{camelize:!0,addUnits:!1}),bx=(e,t)=>yx(vx(e.getAttribute(t))),xx=(e,t,n)=>{let r=e.getAttribute(n);return delete t.class,r},Sx=e=>(t,n)=>{if(!e.getAttribute)return t;if(e.getAttribute(n))switch(n){case`style`:t.style=bx(e,n);break;case`class`:t.className=xx(e,t,n);break;default:t[n]=e.getAttribute(n);break}return t},Cx=[`border`,`class`,`style`],wx={b:`bold`,em:`italic`,u:`underline`,s:`strikethrough`,code:`code`,strong:`strong`},Tx=(e,t=[])=>{if(e.nodeType===mx)return null;if(e.nodeType===px){let n={text:e.textContent};return t.length>0&&(n.marks=t.map(e=>({type:e,data:void 0}))),{object:`text`,leaves:[n]}}if(e.nodeType===hx){let n=e.tagName.toLowerCase(),r=wx[n];if(r)return ux(`[deserialize] mark: `,r),{_flatten:!0,nodes:Ex(e.childNodes,[...t,r])};if(n===`math`)return{isMath:!0,nodes:[e]};let i=gx(e)||{};n===`audio`&&i.controls===``&&(i.controls=!0);let a=Cx.reduce(Sx(e),{...i}),o=_x(n),s=Ex(e.childNodes,t);return{object:o,type:n,data:{dataset:{...e.dataset},attributes:{...a}},nodes:s}}return null},Ex=(e,t=[])=>{let n=[];for(let r=0;r<e.length;r++){let i=Tx(e[r],t);i!==null&&(i._flatten&&i.nodes?n.push(...i.nodes):n.push(i))}return n},Dx=e=>{if(!e||!e.trim())return{object:`value`,document:{object:`document`,data:{},nodes:[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:[]}]}};let t=Ex(new DOMParser().parseFromString(e,`text/html`).body.childNodes);return!t.some(e=>e.object===`block`||e.object===`inline`)&&t.length>0&&(t=[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:t}]),t.length===0&&(t=[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:[]}]),{object:`value`,document:{object:`document`,data:{},nodes:t}}},Ox=L(`div`)(({theme:e})=>({paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5)})),kx=L(`span`)(()=>({display:`inline-block`,width:`.75em`})),Ax=[`tbody`,`tr`],jx=(e,t)=>{let n=t.trim()===``,r=e&&e.type;if(!(n&&Ax.includes(r)))return t},Mx=e=>{let t=e.leaves.find(e=>k(e,`marks`,[]).length);return t?t.marks:null},Nx=(e,t,n,r,i,a)=>{if(!t)return null;let o=[];return(e.nodes||[]).forEach((e,s)=>{let c=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return o.push((0,F.jsx)(`span`,{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),o;if(r){let i=r(e,t,n);if(i){let t=e.data?.dataset?.component===`blank`;t&&o.push((0,F.jsx)(kx,{},`spacer-${s}-before`)),o.push(i),t&&o.push((0,F.jsx)(kx,{},`spacer-${s}-after`));return}}if(e.object===`text`){let t=e.leaves.reduce((e,t)=>{let n=t.text,r=jx(i,n);return r?e+r:e},``),n=Mx(e);if(n?.length>0){let e=n.map(e=>Object.keys(wx).find(t=>wx[t]===e.type)).filter(Boolean);e.length>0?o.push(e.reduceRight((e,t,n)=>(0,F.jsx)(t,{children:e},`${c}-${t}-${n}`),t)):o.push(t)}else t.length>0&&o.push(t)}else{let i=Nx(e,t,n,r,e,a);if(e.type===`p`||e.type===`paragraph`)o.push((0,F.jsx)(Ox,{children:i},c));else{let t=e.type;e.nodes&&e.nodes.length>0?o.push((0,F.jsx)(t,{...e.data.attributes,children:i},c)):o.push((0,F.jsx)(t,{...e.data.attributes},c))}}}),o},Px=L(`div`)(()=>({display:`initial`,"&:not(.MathJax) table":{borderCollapse:`collapse`},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:`8px 12px`,textAlign:`left`}})),Fx=class extends P.Component{constructor(e){super(e),this.internalContainerRef=P.createRef()}static propTypes={renderChildren:D.func,layout:D.object,value:D.object,onChange:D.func,elementType:D.string,containerRef:D.oneOfType([D.func,D.shape({current:D.instanceOf(Element)})])};componentDidMount(){let e=this.props.containerRef||this.internalContainerRef;e.current&&typeof __==`function`&&__(e.current)}handleChange=(e,t)=>{let n={...this.props.value,[e]:t};this.props.onChange(n)};render(){let{value:e,layout:t,elementType:n,containerRef:r}=this.props,i=Nx(t,e,this.handleChange,this.props.renderChildren,null,n),a=r||this.internalContainerRef;return(0,F.jsx)(Px,{ref:a,children:i})}},Ix=/\{\{(\d+)\}\}/g,Lx=(e,t)=>e?{markup:e.replace(Ix,(e,n)=>`<span data-component="${t}" data-id="${n}"></span>`)}:{markup:``},Rx=(e,t)=>{let{markup:n}=Lx(e,t);return Dx(n).document},zx=((e,t)=>class extends P.Component{static propTypes={markup:D.string,layout:D.object,value:D.object,onChange:D.func,customMarkMarkupComponent:D.func,elementType:D.string};constructor(e){super(e),this.containerRef=P.createRef()}componentDidUpdate(e){if(this.props.markup!==e.markup){let e=this.containerRef.current;(e&&e.querySelectorAll(`[data-latex][data-math-handled="true"]`)||[]).forEach(e=>{let t=e.querySelector(`mjx-container`);t&&e.removeChild(t),e.innerHTML=e.getAttribute(`data-raw`),e.removeAttribute(`data-math-handled`)})}}render(){let{markup:n,layout:r,value:i,onChange:a,elementType:o}=this.props,s=r||Rx(n,e);return(0,F.jsx)(Fx,{containerRef:this.containerRef,elementType:o,layout:s,value:i,onChange:a,renderChildren:t(this.props)})}})(`input`,e=>(t,n,r)=>{let i=t.data&&t.data.dataset||{};if(i.component===`input`)return e.customMarkMarkupComponent(i.id)}),Bx=`height ease-in 300ms, opacity ease-in 300ms`,Vx=L(`div`)(()=>({position:`relative`,height:0,overflow:`hidden`,display:`flex`,visibility:`hidden`,width:0,"&.enter":{transition:Bx,opacity:1,height:`auto`,width:`auto`,visibility:`visible`,minHeight:`25px`},"&.enter-done":{height:`auto`,visibility:`visible`,width:`auto`,minHeight:`25px`},"&.exit":{transition:Bx,opacity:0,height:0,visibility:`visible`,width:0},"&.exit-done":{opacity:0,visibility:`hidden`,height:0,width:0}})),Hx=e=>{let{show:t,children:n,className:r}=e,i=(0,P.useRef)(null);return(0,F.jsx)(Es,{nodeRef:i,in:t,appear:!0,mountOnEnter:!1,timeout:300,classNames:{enter:`enter`,enterDone:`enter-done`,exit:`exit`,exitDone:`exit-done`},children:(0,F.jsx)(Vx,{ref:i,className:r,children:n})})};Hx.propTypes={show:D.bool.isRequired,className:D.string,children:D.oneOfType([D.arrayOf(D.node),D.node]).isRequired};var $=e=>typeof e==`string`,Ux=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Wx=e=>e==null?``:``+e,Gx=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Kx=/###/g,qx=e=>e&&e.indexOf(`###`)>-1?e.replace(Kx,`.`):e,Jx=e=>!e||$(e),Yx=(e,t,n)=>{let r=$(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(Jx(e))return{};let t=qx(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Jx(e)?{}:{obj:e,k:qx(r[i])}},Xx=(e,t,n)=>{let{obj:r,k:i}=Yx(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Yx(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Yx(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Zx=(e,t,n,r)=>{let{obj:i,k:a}=Yx(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Qx=(e,t)=>{let{obj:n,k:r}=Yx(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},$x=(e,t,n)=>{let r=Qx(e,n);return r===void 0?Qx(t,n):r},eS=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?$(e[r])||e[r]instanceof String||$(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):eS(e[r],t[r],n):e[r]=t[r]);return e},tS=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),nS={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},rS=e=>$(e)?e.replace(/[&<>"'\/]/g,e=>nS[e]):e,iS=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},aS=[` `,`,`,`?`,`!`,`;`],oS=new iS(20),sS=(e,t,n)=>{t||=``,n||=``;let r=aS.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=oS.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},cS=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},lS=e=>e?.replace(/_/g,`-`),uS={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},dS=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||uS,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:($(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},fS=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},pS=class extends fS{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):$(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Qx(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!$(n)?s:cS(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Xx(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)($(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Qx(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?eS(s,n,i):s={...s,...n},Xx(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},mS={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},hS=Symbol(`i18next/PATH_KEY`);function gS(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===hS?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function _S(e,t){let{[hS]:n}=e(gS()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var vS={},yS=e=>!$(e)&&typeof e!=`boolean`&&typeof e!=`number`,bS=class e extends fS{constructor(e,t={}){super(),Gx([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=dS.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=yS(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!sS(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:$(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:$(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=_S(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?_S(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!$(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=yS(E),ee=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(ee)<0&&!($(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:yS(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&$(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=$(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!$(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=$(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=mS.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return $(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?_S(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!$(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&($(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!vS[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(vS[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!$(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},xS=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=dS.create(`languageUtils`)}getScriptPartFromCode(e){if(e=lS(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=lS(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if($(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),$(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return $(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):$(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},SS={zero:0,one:1,two:2,few:3,many:4,other:5},CS={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},wS=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=dS.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=lS(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),CS;if(!e.match(/-|_/))return CS;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>SS[e]-SS[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},TS=(e,t,n,r=`.`,i=!0)=>{let a=$x(e,t,n);return!a&&i&&$(n)&&(a=cS(e,n,r),a===void 0&&(a=cS(t,n,r))),a},ES=e=>e.replace(/\$/g,`$$$$`),DS=class{constructor(e={}){this.logger=dS.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?rS:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?tS(i):a||`{{`,this.suffix=o?tS(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?tS(d):f||tS(`$t(`),this.nestingSuffix=p?tS(p):m||tS(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=TS(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(TS(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>ES(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?ES(this.escape(e)):ES(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=$(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!$(a)&&!this.useRawValueToEscape&&(a=Wx(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${tS(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!$(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!$(i))return i;$(i)||(i=Wx(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},OS=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},kS=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(lS(r),i),t[o]=s),s(n)}},AS=e=>(t,n,r)=>e(lS(n),r)(t),jS=class{constructor(e={}){this.logger=dS.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?kS:AS;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=kS(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=OS(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},MS=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},NS=class extends fS{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=dS.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Zx(n.loaded,[i],a),MS(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();$(e)&&(e=this.languageUtils.toResolveHierarchy(e)),$(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},PS=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),$(e[1])&&(t.defaultValue=e[1]),$(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),FS=e=>($(e.ns)&&(e.ns=[e.ns]),$(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),$(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),IS=()=>{},LS=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},RS=`__i18next_supportNoticeShown`,zS=()=>!!(typeof globalThis<`u`&&globalThis[RS]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env),BS=()=>{typeof globalThis<`u`&&(globalThis[RS]=!0)},VS=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),HS=class e extends fS{constructor(e={},t){if(super(),this.options=FS(e),this.services={},this.logger=dS,this.modules={external:[]},LS(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&($(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=PS();this.options={...n,...this.options,...FS(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!VS(this)&&!zS()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),BS());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?dS.init(r(this.modules.logger),this.options):dS.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:jS;let t=new xS(this.options);this.store=new pS(this.options.resources,this.options);let i=this.services;i.logger=dS,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new wS(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new DS(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new NS(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new bS(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=IS,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Ux(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=IS){let n=t,r=$(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Ux();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=IS,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&mS.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Ux();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=$(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes($(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=_S(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=_S(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=_S(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return $(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Ux();return this.options.ns?($(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Ux();$(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new xS(PS());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=IS){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new pS(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...PS().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new DS(n)}return a.translator=new bS(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();HS.createInstance,HS.dir,HS.init,HS.loadResources,HS.reloadResources,HS.use,HS.changeLanguage,HS.getFixedT,HS.t,HS.exists,HS.setDefaultNamespace,HS.hasLoadedNamespace,HS.loadNamespaces,HS.loadLanguages,HS.init({fallbackLng:`en`,lng:`en`,debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:`You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.`,maxChoicesPerCategoryRestriction:`To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].`},ebsr:{part:`Part {{index}}`},numberLine:{addElementLimit_one:`You can only add {{count}} element`,addElementLimit_other:`You can only add {{count}} elements`,clearAll:`Clear all`},imageClozeAssociation:{reachedLimit_one:`You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.`,reachedLimit_other:`Full`},drawingResponse:{fillColor:`Fill color`,outlineColor:`Outline color`,noFill:`No fill`,lightblue:`Light blue`,lightyellow:`Light yellow`,red:`Red`,orange:`Orange`,yellow:`Yellow`,violet:`Violet`,blue:`Blue`,green:`Green`,white:`White`,black:`Black`,onDoubleClick:`Double click to edit this text. Press Enter to submit.`},charting:{addCategory:`Add category`,actions:`Actions`,add:`Add`,delete:`Delete`,newLabel:`New label`,reachedLimit_other:`There can't be more than {{count}} categories.`,keyLegend:{incorrectAnswer:`Student incorrect answer`,correctAnswer:`Student correct answer`,correctKeyAnswer:`Answer key correct`}},graphing:{point:`Point`,circle:`Circle`,line:`Line`,parabola:`Parabola`,absolute:`Absolute Value`,exponential:`Exponential`,polygon:`Polygon`,ray:`Ray`,segment:`Segment`,sine:`Sine`,vector:`Vector`,label:`Label`,redo:`Redo`,reset:`Reset`},mathInline:{primaryCorrectWithAlternates:`Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.`},multipleChoice:{minSelections:`Select at least {{minSelections}}.`,maxSelections_one:`Only {{maxSelections}} answer is allowed.`,maxSelections_other:`Only {{maxSelections}} answers are allowed.`,minmaxSelections_equal:`Select {{minSelections}}.`,minmaxSelections_range:`Select between {{minSelections}} and {{maxSelections}}.`},selectText:{correctAnswerSelected:`Correct`,correctAnswerNotSelected:`Correct Answer Not Selected`,incorrectSelection:`Incorrect Selection`,key:`Key`}},common:{undo:`Undo`,clearAll:`Clear all`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Show correct answer`,hideCorrectAnswer:`Hide correct answer`,commonCorrectAnswerWithAlternates:`Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.`,warning:`Warning`,showNote:`Show Note`,hideNote:`Hide Note`,cancel:`Cancel`}},es:{translation:{categorize:{limitMaxChoicesPerCategory:`Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,maxChoicesPerCategoryRestriction:`Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta`},ebsr:{part:`Parte {{index}}`},numberLine:{addElementLimit_one:`Solo puedes agregar {{count}} elemento`,addElementLimit_other:`Solo puedes agregar {{count}} elementos`,clearAll:`Borrar todo`},imageClozeAssociation:{reachedLimit_one:`Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,reachedLimit_other:`Lleno`},drawingResponse:{fillColor:`Color de relleno`,outlineColor:`Color del contorno`,noFill:`Sin relleno`,lightblue:`Azul claro`,lightyellow:`Amarillo claro`,red:`Rojo`,orange:`Naranja`,yellow:`Amarillo`,violet:`Violeta`,blue:`Azul`,green:`Verde`,white:`Blanco`,black:`Negro`,onDoubleClick:`Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar`},charting:{addCategory:`Añadir categoría`,actions:`Acciones`,add:`Añadir`,delete:`Eliminar`,newLabel:`Nueva etiqueta`,reachedLimit_other:`No puede haber más de {{count}} categorías.`,keyLegend:{incorrectAnswer:`Respuesta incorrecta del estudiante`,correctAnswer:`Respuesta correcta del estudiante`,correctKeyAnswer:`Clave de respuesta correcta`}},graphing:{point:`Punto`,circle:`Circulo`,line:`Línea`,parabola:`Parábola`,absolute:`Valor absoluto`,exponential:`Exponencial`,polygon:`Polígono`,ray:`Semirrecta`,segment:`Segmento `,sine:`Seno`,vector:`Vector`,label:`Etiqueta`,redo:`Rehacer`,reset:`Reiniciar`},mathInline:{primaryCorrectWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.`},multipleChoice:{minSelections:`Seleccione al menos {{minSelections}}.`,maxSelections_one:`Sólo se permite {{maxSelections}} respuesta.`,maxSelections_other:`Sólo se permiten {{maxSelections}} respuestas.`,minmaxSelections_equal:`Seleccione {{minSelections}}.`,minmaxSelections_range:`Seleccione entre {{minSelections}} y {{maxSelections}}.`},selectText:{correctAnswerSelected:`Respuesta Correcta`,correctAnswerNotSelected:`Respuesta Correcta No Seleccionada`,incorrectSelection:`Selección Incorrecta`,key:`Clave`}},common:{undo:`Deshacer`,clearAll:`Borrar todo`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Mostrar respuesta correcta`,hideCorrectAnswer:`Ocultar respuesta correcta`,commonCorrectAnswerWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.`,warning:`Advertencia`,showNote:`Mostrar Nota`,hideNote:`Ocultar Nota`,cancel:`Cancelar`}}}});var US={translator:{...HS,t:(e,t)=>{let{lng:n}=t;switch(n){case`en_US`:case`en-US`:t.lng=`en`;break;case`es_ES`:case`es-ES`:case`es_MX`:case`es-MX`:t.lng=`es`;break;default:break}return HS.t(e,{lng:n,...t})}},languageOptions:[{value:`en_US`,label:`English (US)`},{value:`es_ES`,label:`Spanish`}]};function WS(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function GS(e,t){return!e||WS(e)?e:WS(e.default)?e.default:t&&WS(e[t])?e[t]:t&&WS(e[t]?.default)?e[t].default:e}var KS=GS(sv,`Readable`)||GS(YS.Readable,`Readable`),qS=Iv,JS=qS.default,YS=JS&&typeof JS==`object`?JS:qS,{translator:XS}=US,ZS={WebkitTouchCallout:`none`,WebkitUserSelect:`none`,KhtmlUserSelect:`none`,MozUserSelect:`none`,msUserSelect:`none`,userSelect:`none`},QS=L(`div`)(()=>({width:`100%`,cursor:`pointer`})),$S=L(`div`)(()=>({margin:`0 auto`,textAlign:`center`,display:`flex`})),eC=L(`div`)(()=>({width:`fit-content`,minWidth:`140px`,alignSelf:`center`,verticalAlign:`middle`,color:`var(--correct-answer-toggle-label-color, ${zh()})`,fontWeight:`normal`,...ZS})),tC=L(`div`)(()=>({position:`absolute`,width:`25px`,"&.enter":{opacity:`0`},"&.enter-active":{opacity:`1`,transition:`opacity 0.3s ease-in`},"&.exit":{opacity:`1`},"&.exit-active":{opacity:`0`,transition:`opacity 0.3s ease-in`}})),nC=L(`div`)(()=>({width:`25px`,marginRight:`5px`,display:`flex`,alignItems:`center`})),rC=class e extends P.Component{static propTypes={onToggle:D.func,toggled:D.bool,show:D.bool,hideMessage:D.string,showMessage:D.string,className:D.string,language:D.string};static defaultProps={showMessage:`Show correct answer`,hideMessage:`Hide correct answer`,show:!1,toggled:!1};constructor(t){super(t),this.state={show:t.show},this.openIconRef=P.createRef(),this.closedIconRef=P.createRef(),e.defaultProps={...e.defaultProps,showMessage:XS.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:XS.t(`common:hideCorrectAnswer`,{lng:t.language})}}onClick(){this.props.onToggle(!this.props.toggled)}onTouch(e){e.preventDefault(),this.props.onToggle(!this.props.toggled)}UNSAFE_componentWillReceiveProps(t){this.setState({show:t.show}),t.language!==this.props?.language&&(e.defaultProps={...e.defaultProps,showMessage:XS.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:XS.t(`common:hideCorrectAnswer`,{lng:t.language})})}render(){let{className:e,toggled:t,hideMessage:n,showMessage:r}=this.props;return(0,F.jsx)(QS,{className:e,children:(0,F.jsx)(Hx,{show:this.state.show,children:(0,F.jsxs)($S,{onClick:this.onClick.bind(this),onTouchEnd:this.onTouch.bind(this),children:[(0,F.jsxs)(nC,{children:[(0,F.jsx)(Es,{nodeRef:this.openIconRef,timeout:400,in:t,exit:!t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(tC,{ref:this.openIconRef,children:(0,F.jsx)(Tm,{open:t},`correct-open`)})}),(0,F.jsx)(Es,{nodeRef:this.closedIconRef,timeout:5e3,in:!t,exit:t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(tC,{ref:this.closedIconRef,children:(0,F.jsx)(Tm,{open:t},`correct-closed`)})})]}),(0,F.jsx)(KS,{false:!0,children:(0,F.jsx)(eC,{"aria-hidden":!this.state.show,children:t?n:r})})]})})})}};function iC(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function aC(e,t){return!e||iC(e)?e:iC(e.default)?e.default:t&&iC(e[t])?e[t]:t&&iC(e[t]?.default)?e[t].default:e}var oC=aC(A_,`UiLayout`)||aC(fC.UiLayout,`UiLayout`),sC=aC(ov,`PreviewPrompt`)||aC(fC.PreviewPrompt,`PreviewPrompt`),cC=aC(sv,`Readable`)||aC(fC.Readable,`Readable`),lC=aC(b_,`Collapsible`)||aC(fC.Collapsible,`Collapsible`),uC=Iv,dC=uC.default,fC=dC&&typeof dC==`object`?dC:uC,pC=L(oC)({color:zh(),backgroundColor:sg(),display:`inline-block`}),mC=L(`div`)({width:`100%`,position:`relative`,backgroundColor:sg(),color:zh()}),hC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),gC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),_C=L(`div`)({position:`relative`,"& > div > div":{display:`flex`,alignItems:`baseline`,flexWrap:`wrap`},"& .mq-overarrow-inner":{border:`none !important`,padding:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`-2.4em`,right:`-1px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85}}),vC=L(`div`)(({theme:e,$incorrect:t,$correct:n,$showCorrectness:r,$correctAnswerShown:i})=>({maxWidth:`fit-content`,...t&&{borderColor:`${qh()} !important`},...n&&{borderColor:`${Uh()} !important`},...r&&{border:`2px solid`},...i&&{padding:e.spacing(1),letterSpacing:`0.5px`},"& > .mq-math-mode":{"& > .mq-root-block":{"& > .mq-editable-field":{minWidth:`10px`,padding:e.spacing(.25)}},"& sup":{top:0}}})),yC=L(Mb)({"& > .mq-root-block":{"& > .mq-editable-field":{borderColor:zh()}}}),bC=L(`div`)(({theme:e})=>({zIndex:10,minWidth:`400px`,marginTop:e.spacing(2)})),xC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(1),pointerEvents:`none`})),SC=L(`h2`)({position:`absolute`,left:`-10000px`,top:`auto`,width:`1px`,height:`1px`,overflow:`hidden`}),CC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),wC=L(rC)(({theme:e})=>({color:zh(),marginBottom:e.spacing(2)}));if(typeof document<`u`){let e=`math-templated-main-styles`;if(!document.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.textContent=`
162
+ mid `,`&#8740;`),J.intercal=J[`⊺`]=W(Q,`\\intercal `,`&#8890;`),J.veebar=J[`⊻`]=W(Q,`\\veebar `,`&#8891;`),J.barwedge=J[`⊼`]=W(Q,`\\barwedge `,`&#8892;`),J.ltimes=J[`⋉`]=W(Q,`\\ltimes `,`&#8905;`),J.rtimes=J[`⋊`]=W(Q,`\\rtimes `,`&#8906;`),J.leftthreetimes=J[`⋋`]=W(Q,`\\leftthreetimes `,`&#8907;`),J.rightthreetimes=J[`⋌`]=W(Q,`\\rightthreetimes `,`&#8908;`),J.curlyvee=J[`⋎`]=W(Q,`\\curlyvee `,`&#8910;`),J.curlywedge=J[`⋏`]=W(Q,`\\curlywedge `,`&#8911;`),J.circledcirc=J[`⊚`]=W(Q,`\\circledcirc `,`&#8858;`),J.circledast=J[`⊛`]=W(Q,`\\circledast `,`&#8859;`),J.circleddash=J[`⊝`]=W(Q,`\\circleddash `,`&#8861;`),J.boxplus=J[`⊞`]=W(Q,`\\boxplus `,`&#8862;`),J.boxminus=J[`⊟`]=W(Q,`\\boxminus `,`&#8863;`),J.boxtimes=J[`⊠`]=W(Q,`\\boxtimes `,`&#8864;`),J.boxdot=J[`⊡`]=W(Q,`\\boxdot `,`&#8865;`),J[`∂`]=J.partial,J[`∃`]=J.exists,J[`∅`]=J.varnothing,J[`∆`]=J.triangle,J[`∇`]=J.nabla,J[`∈`]=J.in,J[`∊`]=J.in,J[`∋`]=J.ni,J[`∌`]=J.notni,J[`∍`]=J.ni,J[`∐`]=J.amalg,J[`−`]=J[`-`],J[`∓`]=J.mp,J[`∖`]=J.setminus,J[`∘`]=J.circ,J[`∙`]=J.bullet,J[`∝`]=J.propto,J[`∞`]=J.infty,J[`∠`]=J.angle,J[`∡`]=J.measuredangle,J[`∣`]=J.divides,J[`∥`]=J.parallel,J[`∦`]=J.nparallel,J[`∧`]=J.wedge,J[`∨`]=J.vee,J[`∩`]=J.cap,J[`∪`]=J.cup,J[`∮`]=J.oint,J[`∴`]=J.therefore,J[`∵`]=J.because,J[`∼`]=J.sim,J[`≀`]=J.wr,J[`≃`]=J.simeq,J[`≍`]=J.asymp,J[`≐`]=J.doteq,J[`≪`]=J.ll,J[`≫`]=J.gg,J[`≺`]=J.prec,J[`≻`]=J.succ,J[`⊂`]=J.subset,J[`⊃`]=J.supset,J[`⊆`]=J.subseteq,J[`⊇`]=J.supseteq,J[`⊈`]=J.nsubseteq,J[`⊉`]=J.nsupseteq,J[`⊏`]=J.sqsubset,J[`⊐`]=J.sqsupset,J[`⊓`]=J.sqcap,J[`⊔`]=J.sqcup,J[`⊖`]=J.ominus,J[`⊘`]=J.oslash,J[`⊙`]=J.odot,J[`⊢`]=J.vdash,J[`⊣`]=J.dashv,J[`⊤`]=J.top,J[`⊥`]=J.bot,J[`⊧`]=J.models,J[`⋀`]=J.wedge,J[`⋁`]=J.vee,J[`⋂`]=J.cap,J[`⋃`]=J.cup,J[`⋄`]=J.diamond,J[`⋅`]=J.cdot,J[`⋆`]=J.star,J[`⋈`]=J.bowtie,J[`⋮`]=J.vdots,J[`⋯`]=J.cdots,J[`⋱`]=J.ddots;var Ky,qy=Gv,Jy=document.createElement(`div`).style,Yy={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1},Xy;for(var Zy in Yy)if(Zy in Jy){Xy=Zy;break}Xy?Ky=function(e,t,n){e.css(Xy,`scale(`+t+`,`+n+`)`)}:`filter`in Jy?(qy=function(e){e.className=e.className},Ky=function(e,t,n){t/=1+(n-1)/2,e.css(`fontSize`,n+`em`),e.hasClass(`mq-matrixed-container`)||e.addClass(`mq-matrixed-container`).wrapInner(`<span class="mq-matrixed"></span>`);var r=e.children().css(`filter`,`progid:DXImageTransform.Microsoft.Matrix(M11=`+t+`,SizingMethod='auto expand')`);function i(){e.css(`marginRight`,(r.width()-1)*(t-1)/t+`px`)}i();var a=setInterval(i);U(window).load(function(){clearTimeout(a),i()})}):Ky=function(e,t,n){e.css(`fontSize`,n+`em`)};var Qy=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`>&0</`+n+`>`)}}),$y=G(X,function(e,t){e.init=function(e,n,r){this.args=arguments,this.htmlTemplate=`<`+n+` `+r+`><`+n+` class="mq-xarrow-over">&0</`+n+`><`+n+` class="mq-xarrow-under"></`+n+`></`+n+`>`,t.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`(`,`)`]},e.parser=function(){var e=this;return xy.optBlock.then(function(t){return xy.block.map(function(n){var r=eb.apply(null,e.args);return r.blocks=[t,n],t.adopt(r,0,0),n.adopt(r,t,0),r})}).or(t.parser.call(this))}}),eb=G($y,function(e,t){e.init=function(e,t,n){this.htmlTemplate=`<`+t+` `+n+`><`+t+` class="mq-xarrow-over">&1</`+t+`><`+t+` class="mq-xarrow-under">&0</`+t+`></`+t+`>`,X.prototype.init.call(this,e),this.textTemplate=[e.replace(`\\`,``)+`[`,`](`,`)`]},e.latex=function(){return this.ctrlSeq+`[`+this.ends[K].latex()+`]{`+this.ends[q].latex()+`}`},e.finalizeTree=function(){this.downInto=this.ends[K].upOutOf=this.ends[q],this.upInto=this.ends[q].downOutOf=this.ends[K]}}),tb=function(e){var t=`<span class="`+e+`-inner-right">g</span><span class="`+e+`-inner-left">h</span>`;return G(X,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`<span class="mq-empty-box">&0</span></`+i+`></`+i+`>`)}})},nb=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<`+n+` `+r+`><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></`+n+`></span>`)}}),rb=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>`+r+`</p><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td><td class="mq-empty"></td><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),ib=G(X,function(e,t){e.init=function(e){t.init.call(this,e,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">&#x2d9;</span><span class="mq-empty-box">&0</span></span></span>`)}}),ab=G(X,function(e,t){e.init=function(e,n,r){t.init.call(this,e,`<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>`+r+`</p></span><span class="matrix-edit-content-col"><table class="mq-non-leaf mq-rows-3"><tbody><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr><tr><td class="mq-empty"></td></tr></tbody></table></span><span class="mq-paren mq-scaled">]</span></span>`)}}),ob=function(e,t){return G(Cy,function(n,r){n.init=function(n,i,a){r.init.call(this,n,`<`+i+` `+a+`><`+i+` class="`+e+`-inner">`+t+`</`+i+`></`+i+`>`)}})};J.mathrm=W(Qy,`\\mathrm`,`span`,`class="mq-roman mq-font"`),J.mathit=W(Qy,`\\mathit`,`i`,`class="mq-font"`),J.mathbf=W(Qy,`\\mathbf`,`b`,`class="mq-font"`),J.mathsf=W(Qy,`\\mathsf`,`span`,`class="mq-sans-serif mq-font"`),J.mathtt=W(Qy,`\\mathtt`,`span`,`class="mq-monospace mq-font"`),J.underline=W(Qy,`\\underline`,`span`,`class="mq-non-leaf mq-underline"`),J.overline=J.bar=W(tb(`mq-overline`),`\\overline`,`span`,`class="mq-non-leaf mq-overline"`),J.longdiv=W(nb,`\\longdiv`,`span`,`class="mq-non-leaf mq-longdiv"`),J.overrightarrow=W(tb(`mq-overarrow`),`\\overrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-right"`),J.overleftarrow=W(tb(`mq-overarrow`),`\\overleftarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-left"`),J.xleftarrow=W($y,`\\xleftarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-left"`),J.xrightarrow=W($y,`\\xrightarrow`,`span`,`class="mq-non-leaf mq-xarrow mq-arrow-right"`),J.overleftrightarrow=W(Qy,`\\overleftrightarrow`,`span`,`class="mq-non-leaf mq-overarrow mq-arrow-both"`),J.overarc=W(Qy,`\\overarc`,`span`,`class="mq-non-leaf mq-overarc"`),J.dot=G(X,function(e,t){e.init=function(){t.init.call(this,`\\dot`,`<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">&#x2d9;</span><span class="mq-empty-box">&0</span></span></span>`)}}),J.addmatrixrow=W(rb,`\\addmatrixrow`,`span`,`+`),J.addmatrixcol=W(ab,`\\addmatrixcol`,`span`,`+`),J.ngtr=J[`≯`]=W(ob(`mq-ngtr`,`&#8815;`),`\\ngtr `,`span`,`class="mq-non-leaf mq-ngtr"`),J.nless=J[`≮`]=W(ob(`mq-nless`,`&#8814;`),`\\nless `,`span`,`class="mq-non-leaf mq-nless"`),J.dot=W(ib,`\\dot`),J.parallelogram=W(ob(`mq-parallelogram`,`&#9649;`),`\\parallelogram `,`span`,`class="mq-non-leaf mq-parallelogram"`),J.textcolor=G(X,function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate=`<span class="mq-textcolor" style="color:`+e+`">&0</span>`},e.latex=function(){return`\\textcolor{`+this.color+`}{`+this.blocks[0].latex()+`}`},e.parser=function(){var e=this,n=Y.optWhitespace,r=Y.string,i=Y.regex;return n.then(r(`{`)).then(i(/^[#\w\s.,()%-]*/)).skip(r(`}`)).then(function(n){return e.setColor(n),t.parser.call(e)})},e.isStyleBlock=function(){return!0}}),J.class=G(X,function(e,t){e.parser=function(){var e=this,n=Y.string,r=Y.regex;return Y.optWhitespace.then(n(`{`)).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n(`}`)).then(function(n){return e.cls=n||``,e.htmlTemplate=`<span class="mq-class `+n+`">&0</span>`,t.parser.call(e)})},e.latex=function(){return`\\class{`+this.cls+`}{`+this.blocks[0].latex()+`}`},e.isStyleBlock=function(){return!0}});var sb=G(X,function(e,t){e.ctrlSeq=`_{...}^{...}`,e.createLeftOf=function(e){if(!(!this.replacedFragment&&!e[K]&&e.options.supSubsRequireOperand))return t.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=K;t;t=t===K&&q)if(this[t]instanceof sb){for(var n=`sub`;n;n=n===`sub`&&`sup`){var r=this[n],i=this[t][n];if(r){if(!i)this[t].addBlock(r.disown());else if(r.isEmpty())var a=Qv(i,0,i.ends[K]);else{r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),a=Qv(i,o.ends[q],i.ends[K]);t===K?o.adopt(i,i.ends[q],0):o.adopt(i,0,i.ends[K])}this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n)}}(i,r)}}this.remove(),e&&e[K]===this&&(t===q&&a?a[K]?e.insRightOf(a[K]):e.insAtLeftEnd(a.parent):e.insRightOf(this[t]));break}},cy.p.charsThatBreakOutOfSupSub=``,e.finalizeTree=function(){this.ends[K].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if(t===`_`)return;var n=this.chToCmd(t,e.options);return n instanceof Cy?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[K]&&!e[q]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),wy.p.write.apply(this,arguments)}},e.moveTowards=function(e,n,r){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(e,this):t.moveTowards.apply(this,arguments)},e.deleteTowards=function(e,n){if(n.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof Cy?r.remove():r&&r.deleteTowards(e,n.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(K,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-e,this))}else t.deleteTowards.apply(this,arguments)},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(n.length===1?n:`{`+(n||` `)+`}`):``}return e(`_`,this.sub)+e(`^`,this.sup)},e.addBlock=function(e){this.supsub===`sub`?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=U(`<span class="mq-sup"/>`).append(e.jQ.children()).attr(Hv,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=U(`<span class="mq-sub"></span>`).append(e.jQ.children()).attr(Hv,e.id).appendTo(this.jQ.removeClass(`mq-sup-only`)),this.jQ.append(`<span style="display:inline-block;width:0">&#8203;</span>`));for(var t=0;t<2;t+=1)(function(e,t,n,r){e[t].deleteOutOf=function(i,a){if(a.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var o=this.ends[i];this.children().disown().withDirAdopt(i,a.parent,a[i],a[-i]).jQ.insDirOf(-i,a.jQ),a[-i]=o}e.supsub=n,delete e[t],delete e[r+`Into`],e[n][r+`OutOf`]=cb,delete e[n].deleteOutOf,t===`sub`&&U(e.jQ.addClass(`mq-sup-only`)[0].lastChild).remove(),this.remove()}})(this,`sub sup`.split(` `)[t],`sup sub`.split(` `)[t],`down up`.split(` `)[t])},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(`.mq-sup`);if(n.length){var r=parseInt(n.css(`font-size`)),i=n.offset().top+n.height()-t.offset().top-.7*r,a=parseInt(n.css(`margin-bottom`));n.css(`margin-bottom`,a+i)}}}});function cb(e){var t=this.parent,n=e;do{if(n[q])return e.insLeftOf(t);n=n.parent.parent}while(n!==t);e.insRightOf(t)}J.subscript=J._=G(sb,function(e,t){e.supsub=`sub`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&0</span></span><span style="display:inline-block;width:0">&#8203;</span></span>`,e.textTemplate=[`_`],e.finalizeTree=function(){this.downInto=this.sub=this.ends[K],this.sub.upOutOf=cb,t.finalizeTree.call(this)}}),J.superscript=J.supscript=J[`^`]=G(sb,function(e,t){e.supsub=`sup`,e.htmlTemplate=`<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`^`],e.finalizeTree=function(){this.upInto=this.sup=this.ends[q],this.sup.downOutOf=cb,t.finalizeTree.call(this)}});var lb=G(X,function(e,t){e.parser=function(){for(var e=Y.string,t=Y.optWhitespace,n=Y.succeed,r=xy.block,i=this,a=i.blocks=[wy(),wy()],o=0;o<a.length;o+=1)a[o].adopt(i,i.ends[q],0);return t.then(e(`_`).or(e(`^`))).then(function(e){var t=a[e===`_`?0:1];return r.then(function(e){return e.children().adopt(t,t.ends[q],0),n(i)})}).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[K],this.upInto=this.ends[q],this.ends[K].upOutOf=this.ends[q],this.ends[q].downOutOf=this.ends[K]}}),ub=G(lb,function(e,t){e.init=function(e,t){var n=`<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>`+t+`</big><span class="mq-from"><span>&0</span></span></span>`;Cy.prototype.init.call(this,e,n)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[K].latex())+`^`+e(this.ends[q].latex())},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(Ny(`n`).createLeftOf(e),Gy().createLeftOf(e))}});J[`∑`]=J.sum=J.summation=W(ub,`\\sum `,`&sum;`),J[`∏`]=J.prod=J.product=W(ub,`\\prod `,`&prod;`),J.coprod=J.coproduct=W(ub,`\\coprod `,`&#8720;`),J[`∫`]=J.int=J.integral=G(ub,function(e,t){e.init=function(){Cy.prototype.init.call(this,`\\int `,`<span class="mq-int mq-non-leaf"><big>&int;</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">&#8203</span></span></span>`)},e.createLeftOf=X.p.createLeftOf}),J.lim=J.limit=G(lb,function(e,t){e.init=function(){Cy.prototype.init.call(this,`\\lim `,`<span class="mq-lim mq-non-leaf"><span class="mq-un-italicized">lim</span><span class="mq-approaches"><span>&0</span></span></span>`)},e.latex=function(){function e(e){return e.length===1?e:`{`+(e||` `)+`}`}return this.ctrlSeq+`_`+e(this.ends[K].latex())}});var db=J.over=ny[`/`]=G(J.frac=J.dfrac=J.cfrac=J.fraction=G(X,function(e,t){e.ctrlSeq=`\\frac`,e.htmlTemplate=`<span class="mq-fraction mq-non-leaf"><span class="mq-numerator"><span class="mq-empty-box">&0</span></span><span class="mq-denominator"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">&#8203;</span></span>`,e.textTemplate=[`(`,`)/(`,`)`],e.finalizeTree=function(){this.upInto=this.ends[q].upOutOf=this.ends[K],this.downInto=this.ends[K].downOutOf=this.ends[q]}}),function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[K];n&&!(n instanceof Q||n instanceof(J.text||Gv)||n instanceof ub||n.ctrlSeq===`\\ `||/^[,;:]$/.test(n.ctrlSeq));)n=n[K];n instanceof ub&&n[q]instanceof sb&&(n=n[q],n[q]instanceof sb&&n[q].ctrlSeq!=n.ctrlSeq&&(n=n[q])),n!==e[K]&&!e.isTooDeep(1)&&(this.replaces(ty(n[q]||e.parent.ends[K],e[K])),e[K]=n)}t.createLeftOf.call(this,e)}});J.underset=G(X,function(e,t){e.ctrlSeq=`\\underset`,e.htmlTemplate=`<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[K].upOutOf=this.ends[q],this.upInto=this.ends[q].downOutOf=this.ends[K]}}),J.overset=G(X,function(e,t){e.ctrlSeq=`\\overset`,e.htmlTemplate=`<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>`,e.textTemplate=[`[`,`|`,`]`],e.finalizeTree=function(){this.downInto=this.ends[q].upOutOf=this.ends[K],this.upInto=this.ends[K].downOutOf=this.ends[q]}});var fb=J.sqrt=J[`√`]=G(X,function(e,t){e.ctrlSeq=`\\sqrt`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">&radic;</span><span class="mq-non-leaf mq-sqrt-stem"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt(`,`)`],e.parser=function(){return xy.optBlock.then(function(e){return xy.block.map(function(t){var n=pb();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n})}).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[q].jQ.parent();Ky(e.prev(),1,e.innerHeight()/+e.css(`fontSize`).slice(0,-2)-.1)}});J.hat=G(X,function(e,t){e.ctrlSeq=`\\hat`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>`,e.textTemplate=[`hat(`,`)`]});var pb=J.nthroot=G(fb,function(e,t){e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">&0</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">&radic;</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&1</span></span></span>`,e.textTemplate=[`sqrt[`,`](`,`)`],e.latex=function(){return`\\sqrt[`+this.ends[K].latex()+`]{`+this.ends[q].latex()+`}`}}),mb=G(X,function(e,t){e.init=function(e,n,r){var i=`<span class="mq-non-leaf"><span class="mq-diacritic-above">`+n+`</span><span class="mq-diacritic-stem">&0</span></span>`;t.init.call(this,e,i,r)}});J.vec=W(mb,`\\vec`,`&rarr;`,[`vec(`,`)`]),J.tilde=W(mb,`\\tilde`,`~`,[`tilde(`,`)`]),J.lrncuberoot=G(fb,function(e,t){e.ctrlSeq=`\\lrncuberoot`,e.htmlTemplate=`<sup class="mq-nthroot mq-non-leaf"><span class="mq-empty-box">3</span></sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">&radic;</span><span class="mq-sqrt-stem mq-non-leaf"><span class="mq-empty-box">&0</span></span></span>`,e.textTemplate=[`sqrt[3](`,`)`],e.latex=function(){return`\\sqrt[3]{`+this.ends[K].latex()+`}`}}),J.abs=G(X,function(e){e.ctrlSeq=`\\abs`,e.htmlTemplate=`<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[`|`,`|`]}),J.lrnplaceholder=G(X,function(e,t){e.ctrlSeq=`\\lrnplaceholder`,e.htmlTemplate=`<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>`,e.textTemplate=[``],e.latex=function(){return this.ends[K].latex()}}),J.lrnexponent=G(X,function(e,t){e.ctrSeq=`\\lrnexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&1</span></span></span></span>`,e.textTemplate=[``,`**`],e.latex=function(){var e=this.ends[q].latex();return e.length>1?e=`{`+e+`}`:e.length===0&&(e=`{ }`),this.ends[K].latex()+`^`+e}}),J.lrnsquaredexponent=G(X,function(e,t){e.ctrSeq=`\\lrnsquaredexponent`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">2</span></span></span></span>`,e.textTemplate=[``,`**2`],e.latex=function(){return this.ends[K].latex()+`^2`}}),J.lrnsubscript=G(X,function(e,t){e.ctrSeq=`\\lrnsubscript`,e.htmlTemplate=`<span class="mq-lrnexponent mq-non-leaf"><span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span><span class="mq-supsub mq-non-leaf"><span class="mq-sub"><span class="mq-empty-box">&1</span></span><span style="display:inline-block;width:0">&nbsp;</span></span></span>`,e.textTemplate=[``,`_`],e.latex=function(){return this.ends[K].latex()+`_`+this.ends[q].latex()}});function hb(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(`:first`).add(this.jQ.children(`:last`)),this.contentjQ=this.jQ.children(`:eq(1)`)},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css(`fontSize`));Ky(this.delimjQs,Uv(1+.2*(e-1),1.2),1.2*e)}}var gb=G(G(X,hb),function(e,t){e.init=function(e,n,r,i,a){t.init.call(this,`\\left`+i,Bv,[n,r]),this.side=e,this.sides={},this.sides[K]={ch:n,ctrlSeq:i},this.sides[q]={ch:r,ctrlSeq:a}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-scaled mq-paren`+(this.side===q?` mq-ghost`:``)+`">`+this.sides[K].ch+`</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren`+(this.side===K?` mq-ghost`:``)+`">`+this.sides[q].ch+`</span></span>`,t.html.call(this)},e.latex=function(){return`\\left`+this.sides[K].ctrlSeq+this.ends[K].latex()+`\\right`+this.sides[q].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof gb&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||_b[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":`]`,"[":`)`}[this.sides[K].ch]===n.sides[q].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===K?0:1).removeClass(`mq-ghost`).html(this.sides[this.side].ch)},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if(this.sides[K].ch===`|`)var r=this.matchBrack(n,q,e[q])||this.matchBrack(n,K,e[K])||this.matchBrack(n,0,e.parent.parent);else var r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent)}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&ty(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble(`reflow`)}else r=this,i=r.side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(ty(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===K?e.insAtLeftEnd(r.ends[K]):e.insRightOf(r)},e.placeCursor=Gv,e.unwrap=function(){this.ends[K].children().disown().adopt(this.parent,this,this[q]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],a=r.ends[e];if(e===this.side){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}var o=n.options,s=!this.side;if(this.side=-e,this.matchBrack(o,e,this.ends[K].ends[this.side])){this.closeOpposing(this.ends[K].ends[this.side]);var c=this.ends[K].ends[e];this.unwrap(),c.siblingCreated&&c.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r)}else{if(this.matchBrack(o,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else if(t&&s){this.unwrap(),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);return}else this.sides[e]={ch:_b[this.sides[this.side].ch],ctrlSeq:_b[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass(`mq-ghost`).eq(e===K?0:1).addClass(`mq-ghost`).html(this.sides[e].ch);if(i){var c=this.ends[K].ends[e];ty(i,a,-e).disown().withDirAdopt(-e,this.ends[K],c,0).jQ.insAtDirEnd(e,this.ends[K].jQ.removeClass(`mq-empty`)),c.siblingCreated&&c.siblingCreated(n.options,e),n.insDirOf(-e,i)}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[K])}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t)},e.finalizeTree=function(){this.ends[K].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(+(this.side===K)).removeClass(`mq-ghost`),this.side=0}},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree()}}),_b={"(":`)`,")":`(`,"[":`]`,"]":`[`,"{":`}`,"}":`{`,"\\{":`\\}`,"\\}":`\\{`,"&lang;":`&rang;`,"&rang;":`&lang;`,"\\langle ":`\\rangle `,"\\rangle ":`\\langle `,"|":`|`,"\\lVert ":`\\rVert `,"\\rVert ":`\\lVert `};function vb(e,t){var t=t||e,n=_b[e],r=_b[t];ny[e]=W(gb,K,e,n,t,r),ny[n]=W(gb,q,e,n,t,r)}vb(`(`),vb(`[`),vb(`{`,`\\{`),J.langle=W(gb,K,`&lang;`,`&rang;`,`\\langle `,`\\rangle `),J.rangle=W(gb,q,`&lang;`,`&rang;`,`\\langle `,`\\rangle `),ny[`|`]=W(gb,K,`|`,`|`,`|`,`|`),J.lVert=W(gb,K,`&#8741;`,`&#8741;`,`\\lVert `,`\\rVert `),J.rVert=W(gb,q,`&#8741;`,`&#8741;`,`\\lVert `,`\\rVert `),J.left=G(X,function(e){e.parser=function(){var e=Y.regex,t=Y.string;Y.succeed;var n=Y.optWhitespace;return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(r){var i=r.charAt(0)===`\\`?r.slice(1):r;return r==`\\langle`&&(i=`&lang;`,r+=` `),r==`\\lVert`&&(i=`&#8741;`,r+=` `),xy.then(function(a){return t(`\\right`).skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(e){var t=e.charAt(0)===`\\`?e.slice(1):e;e==`\\rangle`&&(t=`&rang;`,e+=` `),e==`\\rVert`&&(t=`&#8741;`,e+=` `);var n=gb(0,i,t,r,e);return n.blocks=[a],a.adopt(n,0,0),n})})})}}),J.right=G(X,function(e){e.parser=function(){return Y.fail(`unmatched \\right`)}}),J.choose=G(J.binom=J.binomial=G(G(X,hb),function(e,t){e.ctrlSeq=`\\binom`,e.htmlTemplate=`<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>`,e.textTemplate=[`choose(`,`,`,`)`]}),function(e){e.createLeftOf=db.prototype.createLeftOf}),J.editable=J.MathQuillMathField=G(X,function(e,t){e.ctrlSeq=`\\MathQuillMathField`,e.htmlTemplate=`<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>`,e.parser=function(){var e=this,n=Y.string,r=Y.regex,i=Y.succeed;return n(`[`).then(r(/^[a-z][a-z0-9]*/i)).skip(n(`]`)).map(function(t){e.name=t}).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=oy(this.ends[K],this.jQ,e);t.KIND_OF_MQ=`MathField`,t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),vy(t.root)},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[K].controller))},e.latex=function(){return this.ends[K].latex()},e.text=function(){return this.ends[K].text()}});var yb=J.embed=G(Cy,function(e,t){e.setOptions=function(e){function t(){return``}return this.text=e.text||t,this.htmlTemplate=e.htmlString||``,this.latex=e.latex||t,this},e.parser=function(){var e=this,t=Y.string,n=Y.regex,r=Y.succeed;return t(`{`).then(n(/^[a-z][a-z0-9]*/i)).skip(t(`}`)).then(function(i){return t(`[`).then(n(/^[-\w\s]*/)).skip(t(`]`)).or(r()).map(function(t){return e.setOptions(dy[i](t))})})}});J.MathQuillResponseContainer=G(X,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainer`,e.htmlTemplate=`<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>`,e.latex=function(){return`\\MathQuillResponseContainer`},e.text=function(){return this.ends[K].text()}}),J.MathQuillResponseContainerIcon=G(X,function(e,t){e.ctrlSeq=`\\MathQuillResponseContainerIcon`,e.htmlTemplate=`<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>`,e.latex=function(){return`\\MathQuillResponseContainerIcon`},e.text=function(){return this.ends[K].text()}});var bb=J.matrix=G(X,function(e,t){var n=G(wy,function(e,t){e.init=function(e,n){return this.column=e,this.row=n,t.init.call(this)},e.keystroke=function(e,n,r){switch(e){case`Shift-Spacebar`:return n.preventDefault(),this.parent.insertColumn(this);case`Shift-Enter`:return this.parent.insertRow(this)}return t.keystroke.apply(this,arguments)},e.deleteOutOf=function(e,n){var r=this,i=arguments;this.parent.backspace(this,e,n,function(){return t.deleteOutOf.apply(r,i)})}}),r={column:`&`,row:`\\\\`};e.parentheses={left:null,right:null},e.maximum={rows:5,columns:5},e.defaults={rows:2,columns:2},e.ctrlSeq=`\\matrix`,e.createBlocks=function(){var e=this,t=e.blocks=[],r,i,a=0;this.htmlTemplate.replace(/&\d+/g,function(o,s){var c=e.htmlTemplate.substring(0,s).match(/<tr[^>]*>/gi).length-1;i=r===c?i+1:0,t[a]=n(i,c),t[a].adopt(e,e.ends[q],0),r=c,a++})},e.reflow=function(){var e=this.jQ.children(`table`),t=e.outerHeight()/+e.css(`fontSize`).slice(0,-2),n=this.jQ.children(`.mq-paren`);n.length&&Ky(n,Uv(1+.2*(t-1),1.2),1.05*t)},e.latex=function(){var e=this.getMatrixName(),t=`\\begin{`+e+`}`,n,i,a;for(a=0;a<this.blocks.length;a++)n=this.blocks[a].row,i!==void 0&&(i===n?t+=r.column:t+=r.row),i=n,t+=this.blocks[a].latex();return t+=`\\end{`+e+`}`,t},e.createLeftOf=function(n){this.cursor=n;var r=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(r,i),e.htmlTemplate=this.defaultHtmlTemplate,t.createLeftOf.call(this,n)},e.getMatrixName=function(){return this.ctrlSeq.replace(`\\`,``)},e.generateHtmlTemplate=function(e,t){var n=`<span class="mq-matrix mq-non-leaf">`+o(this.parentheses.left);n+=`<table class="mq-non-leaf">`,e=Math.min(e,this.maximum.rows),t=Math.min(t,this.maximum.columns);for(var r=0,i=0;i<e;i++){n+=`<tr>`;for(var a=0;a<t;a++)n+=`<td>&`+r+`</td>`,r++;n+=`</tr>`}return n+=`</table>`,n+=o(this.parentheses.right)+`</span>`,n;function o(e){return e?`<span class="mq-paren mq-scaled">`+e+`</span>`:``}},e.htmlTemplate=e.generateHtmlTemplate(1,1),e.parser=function(){var e=Y.regex,t=this,i=this.getMatrixName(),a=RegExp(`^(.*?)\\\\end{`+i+`}`),o=RegExp(`\\\\end{`+i+`}`);return e(a).then(function(e){var i=e.replace(o,``),a=[],s=i.split(r.row),c=Math.min(s.length,t.maximum.rows),l=0,u,d;for(d=0;d<c;d++)u=s[d].split(r.column),l=Math.max(l,u.length);for(l=Math.min(l,t.maximum.columns),d=0;d<c;d++){u=s[d].split(r.column);for(var e=0;e<l;e++){var f=n(e,d);xy.parse(u[e]||` `).children().adopt(f,f.ends[q],0),a.push(f)}}t.htmlTemplate=t.generateHtmlTemplate(c,l),t.blocks=a;for(var d=0;d<a.length;d+=1)a[d].adopt(t,t.ends[q],0);return Y.succeed(t)})},e.finalizeTree=function(){var e=this.jQ.find(`table`);e.length&&(this.relink(),e.removeClass(function(e,t){var n=t.match(/mq-rows-\d+/g);return n&&n.join(` `)||``}),e.addClass(`mq-rows-`+e.find(`tr`).length))},e.relink=function(){var e=this.jQ.find(`td`),t=$v.byId[e.first().attr(Hv)],n=$v.byId[e.last().attr(Hv)],r=e.eq(0).closest(`tr`),i=[];e.each(function(t){var n=$v.byId[U(this).attr(Hv)],a=e.eq(t+1),o=U(this).closest(`tr`).next(`tr`),s=U(this).closest(`tr`).index(),c=U(this).index(),l;if(a.length){var u=$v.byId[a.attr(Hv)];n[q]=u,u[K]=n}if(l=o.length?o.find(`td`).eq(c):r.find(`td`).eq(c+1),l.length){var d=$v.byId[l.attr(Hv)];n.downOutOf=d,d.upOutOf=n}n.column=c,n.row=s,i.push(n)}),this.ends[K]=t,this.ends[q]=n,t&&t[K]&&delete t[K],n&&n[q]&&delete n[q],this.blocks=i},e.deleteCell=function(e){var t=e.jQ.closest(`tr`),n=e.jQ.index(),r=t.index(),i=t.find(`td`).not(e.jQ),a=this.jQ.find(`tr`).not(t).map(function(){return U(this).find(`td`)[n]}),o=this.jQ.find(`td`).length===1,s;function c(){return $v.byId[U(this).attr(Hv)].isEmpty()}return i.filter(c).length===i.length&&a.length&&(i.remove(),e.jQ.remove(),t.remove(),this.finalizeTree()),a.filter(c).length===a.length&&i.length&&(a.remove(),e.jQ.remove(),this.finalizeTree()),o||(r=Math.min(r,this.jQ.find(`tr`).length-1),n=Math.min(n,this.jQ.find(`tr`).eq(r).find(`td`).length-1),s=$v.byId[this.jQ.find(`tr`).eq(r).find(`td`).eq(n).attr(Hv)]),s},e.addRow=function(e){if(!(this.jQ.find(`tr`).length>=this.maximum.rows)){for(var t=e.find(`td`).length,r=U(`<tr></tr>`),i,a,o=0;o<t;o++)i=n(),i.parent=this,i.jQ=U(`<td class="mq-empty">`).attr(Hv,i.id),r.append(i.jQ),a||=i;return r.insertAfter(e),a}},e.addColumn=function(e){if(!(e.closest(`tr`).find(`td`).length>=this.maximum.columns)){var t=e.index(),r=e.closest(`tr`).index(),i=this,a,o=[];return this.jQ.find(`tr`).each(function(){a=n(),a.parent=i,a.jQ=U(`<td class="mq-empty">`).attr(Hv,a.id),a.jQ.insertAfter(U(this).find(`td`).eq(t)),o.push(a)}),o[r]}},e.insertColumn=function(e){newBlock=this.addColumn(e.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.insertRow=function(e){newBlock=this.addRow(e.jQ.closest(`tr`)),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble(`reflow`).cursor.insAtRightEnd(newBlock))},e.backspace=function(e,t,n,r){if(e.isEmpty()){var i=this.deleteCell(e);i?n.insAtRightEnd(i):(r(),this.finalizeTree()),this.bubble(`edited`)}}});J.pmatrix=G(bb,function(e,t){e.ctrlSeq=`\\pmatrix`,e.parentheses={left:`(`,right:`)`}}),J.bmatrix=G(bb,function(e,t){e.ctrlSeq=`\\bmatrix`,e.parentheses={left:`[`,right:`]`}}),J.Bmatrix=G(bb,function(e,t){e.ctrlSeq=`\\Bmatrix`,e.parentheses={left:`{`,right:`}`}}),J.vmatrix=G(bb,function(e,t){e.ctrlSeq=`\\vmatrix`,e.parentheses={left:`|`,right:`|`}}),J.Vmatrix=G(bb,function(e,t){e.ctrlSeq=`\\Vmatrix`,e.parentheses={left:`‖`,right:`‖`}});var xb=gy(3);for(var Sb in xb)(function(e,t){typeof t==`function`?(py[e]=function(){return fy(),t.apply(this,arguments)},py[e].prototype=t.prototype):py[e]=t})(Sb,xb[Sb]);var Cb=function(e){e.registerEmbed(`newLine`,()=>({htmlString:`<div class="newLine"></div>`,text:()=>`testText`,latex:()=>`\\embed{newLine}[]`}))},wb;typeof window<`u`&&(wb=py.getInterface(3),wb&&wb.registerEmbed&&Cb(wb));function Tb(e,t){!wb||!wb.registerEmbed||wb.registerEmbed(e,t)}function Eb(e,t,n){if(!(!wb||!e))return t!=null&&(e.textContent=t),wb.StaticMath(e,n)}var Db=lm(`pie-lib:math-input:mq:static`),Ob=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,kb=/ /g;function Ab(e=``){return e.replace(kb,``)}function jb(e){let t=0;for(let n=0;n<(e||``).length;n++)e[n]===`{`&&t++;return t}var Mb=class extends P.Component{static propTypes={latex:D.string.isRequired,onFocus:D.func,onBlur:D.func,className:D.string,getFieldName:D.func,onSubFieldChange:D.func,onSubFieldFocus:D.func,setInput:D.func};static defaultProps={getFieldName:()=>{}};constructor(e){super(e),this.state={announcement:``,previousLatex:``,inputSource:null,isDeleteKeyPressed:!1},this.inputRef=P.createRef()}componentDidMount(){this.update(),Lf(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),Lf()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}createLiveRegion=()=>{this.liveRegion=document.createElement(`div`),this.liveRegion.style.position=`absolute`,this.liveRegion.style.width=`1px`,this.liveRegion.style.height=`1px`,this.liveRegion.style.marginTop=`-1px`,this.liveRegion.style.clip=`rect(1px, 1px, 1px, 1px)`,this.liveRegion.style.overflow=`hidden`,this.liveRegion.setAttribute(`aria-live`,`polite`),this.liveRegion.setAttribute(`aria-atomic`,`true`),document.body.appendChild(this.liveRegion)};addEventListeners=()=>{let e=this.inputRef.current;e&&(e.addEventListener(`keydown`,this.handleKeyDown),e.addEventListener(`click`,this.handleMathKeyboardClick))};removeEventListeners=()=>{let e=this.inputRef.current;e&&(e.removeEventListener(`keydown`,this.handleKeyDown),e.removeEventListener(`click`,this.handleMathKeyboardClick))};removeLiveRegion=()=>{this.liveRegion&&=(document.body.removeChild(this.liveRegion),null)};handleKeyDown=e=>{(e?.key===`Backspace`||e?.key===`Delete`)&&this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:`keyboard`})};handleMathKeyboardClick=()=>{this.setState({inputSource:`mathKeyboard`})};onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;let t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){let n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(this.inputRef?.current&&n&&n?.length)try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent(`keydown`,{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())};announceLatexConversion=e=>{if(!this.state){console.error(`State is not initialized`);return}let{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,i=`Converted to math symbol`;if(n===`keyboard`&&!r)if(jb(e)>jb(t))this.announceMessage(i);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(i)}catch(e){console.warn(`Error parsing latex:`,e.message),console.warn(e)}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})};announceMessage=e=>{this.setState({previousLatex:``}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=``},500))};update=()=>{if(!wb)throw Error(`MQ is not defined - but component has mounted?`);this.mathField||=wb.StaticMath(this.inputRef?.current,{handlers:{edit:this.onInputEdit.bind(this)}});try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch{this.mathField.latex(`\\MathQuillMathField[r1]{}`)}finally{this._isProgrammaticUpdate=!1}};blur=()=>{Db(`blur mathfield`),this.mathField.blur()};focus=()=>{Db(`focus mathfield...`),this.mathField.focus()};shouldComponentUpdate(e){try{let t=Ab(this.mathField.parseLatex(e.latex)),n=(e.latex.match(Ob)||[]).length,r=t!==Ab(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return Db(`[shouldComponentUpdate] `,r),r}catch(e){return console.warn(`Error parsing latex:`,e.message,`skip update`),console.warn(e),!1}}onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute(`mathquill-block-id`),10);n||=(t=t.parentElement,parseInt(t.getAttribute(`mathquill-block-id`),10));let r=this.mathField.innerFields.find(e=>e.id===n);if(r){let e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error(`error finding root block`,e.message)}};render(){let{onBlur:e,className:t}=this.props;return(0,F.jsx)(`span`,{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}},Nb={fontFamily:`MJXZERO, MJXTEX !important`,"-webkit-font-smoothing":`antialiased !important`,"& .mq-math-mode > span > var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode span var":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode .mq-nonSymbola":{fontFamily:`MJXZERO, MJXTEX-I !important`},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:`MJXZERO, MJXTEX !important`}},Pb={"& .mq-longdiv-inner":{marginTop:`-1px`,marginLeft:`5px !important;`,"& > .mq-empty":{padding:`0 !important`,marginLeft:`0px !important`,marginTop:`2px`}},"& .mq-math-mode .mq-longdiv":{display:`inline-flex !important`}},Fb={"& *":{...Nb,...Pb,"& .mq-math-mode .mq-sqrt-prefix":{top:`0 !important`},"& .mq-math-mode .mq-empty":{padding:`9px 1px !important`},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-supsub":{fontSize:`70.7% !important`},"& .mq-math-mode .mq-sqrt-stem":{marginTop:`-5px`,paddingTop:`4px`},"& .mq-math-mode .mq-paren":{verticalAlign:`middle !important`},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:`0 !important`},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:`0 !important`}}},Ib=e=>(ae(5-e.length,()=>e.push([])),oe.apply(null,e)),Lb=lm(`pie-lib:math-inline:keypad`),Rb=L(Mb)(({latex:e})=>{let t={pointerEvents:`none`,textTransform:`none !important`,color:zh(),"& .mq-scaled.mq-sqrt-prefix":{transform:`scale(1, 0.9) !important`},"& .mq-sup-only .mq-sup":{marginBottom:`0.9px !important`},"& .mq-empty":{backgroundColor:`${Fg()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:`2px solid black`},"& .mq-non-leaf.mq-overline":{borderTop:`none !important`},"& .mq-overarrow":{width:`30px`,marginTop:`0 !important`,borderTop:`2px solid black`,fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`,"&.mq-arrow-both":{top:`0px !important`,"& *":{lineHeight:`1 !important`,borderTop:`none !important`},"&:before":{fontSize:`80%`,left:`calc(-13%) !important`,top:`-0.31em !important`},"&:after":{fontSize:`80% !important`,right:`calc(-13%) !important`,top:`-1.5em`},"&.mq-empty:before":{fontSize:`80%`,left:`calc(-13%)`,top:`-0.26em`},"&.mq-empty:after":{fontSize:`80%`,right:`calc(-13%)`,top:`-0.26em`},"&.mq-empty":{minHeight:`1.4em`}},"&.mq-arrow-right:before":{fontSize:`80%`,right:`calc(-13%) !important`,top:`-0.26em !important`},"& .mq-overarrow-inner":{border:`none !important`},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:`none !important`}},"& .mq-root-block":{padding:`5px !important`},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:`-5px`,fontSize:`80% !important`,top:`-3px`},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:`-6px`,fontSize:`80% !important`,top:`-3px`},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:`2px solid black !important`,"& .mq-overline":{borderTop:`none !important`},"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`}}};return e===`\\parallel`?{...t,fontStyle:`italic !important`}:e===`\\overleftrightarrow{\\overline{}}`?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:`none !important`,paddingTop:`0 !important`},"&:after":{position:`absolute !important`,top:`0px !important`}}}:t});Rb.propTypes={latex:D.string.isRequired};var zb=e=>e?{gridTemplateColumns:`repeat(${e.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${e.rows}, minmax(40px, 60px))`,gridAutoFlow:`initial`}:{},Bb=L(`div`)(()=>({...Fb,width:`100%`,display:`grid`,gridTemplateRows:`repeat(5, minmax(40px, 60px))`,gridRowGap:`0px`,gridColumnGap:`0px`,gridAutoFlow:`column`,"&.character":{textTransform:`initial !important`,gridTemplateRows:`repeat(5, minmax(40px, 50px)) !important`},"&.language":{gridTemplateRows:`repeat(4, minmax(40px, 50px)) !important`,"& *":{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}}})),Vb=L(nm)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:`auto`,textTransform:`none`,fontSize:n||r?`200% !important`:`140% !important`,lineHeight:n||r?`100%`:`normal`,color:zh(),backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()},borderRadius:0,...t&&{fontFamily:`Roboto, Helvetica, Arial, sans-serif !important`}})),Hb=L(nm)(({category:e})=>({textTransform:`none`,padding:0,margin:0,fontSize:`110% !important`,minWidth:`auto`,borderRadius:0,backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()}})),Ub=L(cm)(({category:e})=>({minWidth:`auto`,backgroundColor:e===`operators`?Pg():Ng(),"&:hover":{backgroundColor:e===`operators`?Lg():Ig()},borderRadius:0,"& .icon":{height:`30px`}})),Wb=class extends P.Component{static propTypes={className:D.string,controlledKeypadMode:D.bool,baseSet:D.array,additionalKeys:D.array,layoutForKeyPad:D.object,onPress:D.func.isRequired,onFocus:D.func,noDecimal:D.bool,setKeypadInteraction:D.func,mode:D.oneOfType([D.string,D.number])};static defaultProps={baseSet:Xf,noDecimal:!1};constructor(e){super(e),this.keypadRef=P.createRef()}componentDidMount(){let e=this.keypadRef?.current,t=e?.closest(`.main-container`),n=e?.closest(`.pie-toolbar`);if(this.props.controlledKeypadMode&&t&&n){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),i=e.top+e.height-(r.top+r.height);if(i<0){let n=e.height+e.top-i;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.addEventListener(`mousedown`,this.handleKeypadInteraction,!0))}componentWillUnmount(){let e=this.keypadRef?.current;if(this.props.controlledKeypadMode&&e){let t=e.closest(`.main-container`);t&&(t.style.height=`unset`)}e&&(e.removeEventListener(`touchstart`,this.handleKeypadInteraction,!0),e.removeEventListener(`mousedown`,this.handleKeypadInteraction,!0))}handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)};buttonClick=e=>{Lb(`[buttonClick]`,e);let{onPress:t}=this.props;t(e)};flowKeys=(e,t)=>O([...Ib(e),...Ib(t)]);keyIsNotAllowed=e=>{let{noDecimal:t}=this.props;return!!((e.write===`.`&&e.label===`.`||e.write===`,`&&e.label===`,`)&&t)};render(){let{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:i,mode:a}=this.props,o=[`non-negative-integers`,`integers`,`decimals`,`fractions`,`item-authoring`,`language`].includes(a),s=o?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),c=s.length%5?1:0,l={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+c}, minmax(min-content, 150px))`,...zb(r)};return(0,F.jsx)(Bb,{ref:this.keypadRef,className:[e,a].filter(Boolean).join(` `),style:l,onFocus:i,children:s.map((e,t)=>{let n=this.buttonClick.bind(this,e);if(!e)return(0,F.jsx)(`span`,{},`empty-${t}`);let r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return(0,F.jsx)(Hb,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(Rb,{latex:e.latex})},r.key);if(e.label)return(0,F.jsx)(Vb,{onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,isDelete:e.label===`⌫`,isComma:e.label===`,`,isDot:e.label===`.`,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{},children:e.label},r.key);{let t=e.icon?e.icon:`div`;return(0,F.jsx)(Ub,{tabIndex:`-1`,onClick:r.onClick,disabled:r.disabled,category:o?void 0:e.category,size:`large`,...e.actions||{},...e.extraProps||{},children:(0,F.jsx)(t,{className:`icon`})},r.key)}})})}},Gb=e=>{if(e.command)return{value:e.command,type:`command`};if(e.write)return{value:e.write};if(e.keystroke)return{type:`cursor`,value:e.keystroke}},Kb=class extends P.Component{static propTypes={className:D.string,controlledKeypadMode:D.bool,mode:D.oneOfType([D.string,D.number]),layoutForKeyPad:D.object,onClick:D.func.isRequired,onFocus:D.func,noDecimal:D.bool,additionalKeys:D.array,setKeypadInteraction:D.func};static defaultProps={mode:`scientific`,noDecimal:!1,additionalKeys:[]};keypadPress=e=>{let{onClick:t}=this.props;t(Gb(e))};render(){let{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:i,additionalKeys:a,layoutForKeyPad:o,setKeypadInteraction:s}=this.props,c=If(a);return(0,F.jsx)(Wb,{className:i,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:o,additionalKeys:Mu(Pf(e),c),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}},qb=o(((e,t)=>{t.exports={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+`box-flex`]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1}})),Jb=o(((e,t)=>{t.exports={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1}})),Yb=o(((e,t)=>{t.exports=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e}})),Xb=o(((e,t)=>{var n=Yb(),r=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,i=typeof document>`u`?{}:document.documentElement.style;t.exports=(function(){var e=(function(){for(var e in i)if(r.test(e))return e.match(r)[0];return`WebkitOpacity`in i?`Webkit`:`KhtmlOpacity`in i?`Khtml`:``})();return{style:e,css:`-`+e.toLowerCase()+`-`,dom:{Webkit:`WebKit`,ms:`MS`,o:`WebKit`}[e]||n(e)}})()})),Zb=o(((e,t)=>{t.exports=/[-\s]+(.)?/g})),Qb=o(((e,t)=>{var n=function(e,t){return t?t.toUpperCase():``},r=Zb();t.exports=function(e){return e?e.replace(r,n):``}})),$b=o(((e,t)=>{var n=/::/g,r=/([A-Z]+)([A-Z][a-z])/g,i=/([a-z\d])([A-Z])/g,a=/_/g;t.exports=function(e,t){return e?e.replace(n,`/`).replace(r,`$1_$2`).replace(i,`$1_$2`).replace(a,t||`-`):``}})),ex=o(((e,t)=>{var n=$b();t.exports=function(e){return n(e).toLowerCase()}})),tx=o(((e,t)=>{t.exports=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e}})),nx=o(((e,t)=>{var n=Qb(),r=ex(),i=tx(),a=Yb(),o=Xb(),s=qb(),c=typeof document>`u`?{}:document.documentElement.style;t.exports=function(e){return function(t,l){l||={};var u=i(n(t)),d=r(t),f=e?u:d,p=o.style?e?o.style:o.css:``;if(u in c)return l.asString?f:[f];var m=f,h=s[d],g=[];if(e&&(m=a(f)),typeof h==`function`){var _=h(f,p)||[];_&&!Array.isArray(_)&&(_=[_]),_.length&&(_=_.map(function(t){return e?i(n(t)):r(t)})),g=g.concat(_)}return p&&g.push(p+m),g.push(f),l.asString||g.length==1?g[0]:g}}})),rx=o(((e,t)=>{t.exports=nx()()})),ix=o(((e,t)=>{var n=Object.prototype.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}})),ax=o(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return!!e&&n.call(e)===`[object Object]`}})),ox=o(((e,t)=>{var n=Object.prototype.toString;t.exports=function(e){return n.apply(e)===`[object Function]`}})),sx=o(((e,t)=>{Xb();var n=rx(),r=ex(),i=Qb(),a=ix(),o=ax(),s=ox(),c=function(e,t,r,i){n(t).forEach(function(t){e[i?i(t):t]=r})},l=function(e){e=(e||``).split(`;`);var t={};return e.forEach(function(e){var n=e.split(`:`);n.length==2&&(t[n[0].trim()]=n[1].trim())}),t},u={cssUnitless:Jb()},d=function(e,t,n,f){typeof e==`string`&&(e=l(e)),t||=u,t.cssUnitless=t.cssUnitless||u.cssUnitless,f||={};var p=t.scope||{},m=t.addUnits==null?p&&p.addUnits!=null?p.addUnits:!0:t.addUnits,h=(t.cssUnitless==null?p?p.cssUnitless:null:t.cssUnitless)||{},g=(t.cssUnit||p?p.cssUnit:null)||`px`,_=t.prefixProperties||(p?p.prefixProperties:null)||{},v=t.camelize?i:r,y,b,x,S,C,w,T,E;for(x in e)if(a(e,x)){if(S=e[x],b=r(n?n+x:x),y=!1,E=!1,s(S)&&(T=S.call(p||e,S,x,b,e),o(T)&&T.value!=null?(S=T.value,E=T.prefix,b=T.name?r(T.name):b):S=T),C=typeof S,w=C==`number`||C==`string`&&S!=``&&S*1==S,S==null||b==null||b===``)continue;if((w||C==`string`)&&(y=!0),!y&&S.value!=null&&S.prefix&&(y=!0,E=S.prefix,S=S.value),y){if(E||=!!_[b],w&&(S=m&&!(b in h)?S+g:S+``),(b==`border`||!b.indexOf(`border`)&&!~b.indexOf(`radius`)&&!~b.indexOf(`width`))&&w&&(b+=`-width`),!b.indexOf(`border-radius-`)&&(b.replace(/border(-radius)(-(.*))/,function(e,t,n){var r={"-top":[`-top-left`,`-top-right`],"-left":[`-top-left`,`-bottom-left`],"-right":[`-top-right`,`-bottom-right`],"-bottom":[`-bottom-left`,`-bottom-right`]};n in r?(b=[],r[n].forEach(function(e){b.push(`border`+e+t)})):b=`border`+n+t}),Array.isArray(b))){b.forEach(function(e){E?c(f,e,S,v):f[v(e)]=S});continue}E?c(f,b,S,v):f[v(b)]=S}else d(S,t,b+`-`,f)}return f};t.exports=d})),cx=o(((e,t)=>{var n=sx(),r=ix();t.exports=function(e,t){e=n(e,t);var i=[],a;for(a in e)r(e,a)&&i.push(a+`: `+e[a]);return i.join(`; `)}})),lx=o(((e,t)=>{t.exports={prefixProperties:qb(),cssUnitless:Jb(),object:sx(),string:cx()}}))(),ux=lm(`@pie-lib:mask-markup:serialization`),dx=[`span`],fx=[`em`,`strong`,`u`],px=3,mx=8,hx=1,gx=e=>{if(!e.attributes||e.attributes.length<=0)return;let t={},n;for(n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t},_x=e=>dx.includes(e)?`inline`:fx.includes(e)?`mark`:`block`,vx=e=>{let t=/([\w-]*)\s*:\s*([^;]*)/g,n,r={};for(;n=t.exec(e);)r[n[1]]=n[2].trim();return r},yx=e=>(0,lx.object)(e,{camelize:!0,addUnits:!1}),bx=(e,t)=>yx(vx(e.getAttribute(t))),xx=(e,t,n)=>{let r=e.getAttribute(n);return delete t.class,r},Sx=e=>(t,n)=>{if(!e.getAttribute)return t;if(e.getAttribute(n))switch(n){case`style`:t.style=bx(e,n);break;case`class`:t.className=xx(e,t,n);break;default:t[n]=e.getAttribute(n);break}return t},Cx=[`border`,`class`,`style`],wx={b:`bold`,em:`italic`,u:`underline`,s:`strikethrough`,code:`code`,strong:`strong`},Tx=(e,t=[])=>{if(e.nodeType===mx)return null;if(e.nodeType===px){let n={text:e.textContent};return t.length>0&&(n.marks=t.map(e=>({type:e,data:void 0}))),{object:`text`,leaves:[n]}}if(e.nodeType===hx){let n=e.tagName.toLowerCase(),r=wx[n];if(r)return ux(`[deserialize] mark: `,r),{_flatten:!0,nodes:Ex(e.childNodes,[...t,r])};if(n===`math`)return{isMath:!0,nodes:[e]};let i=gx(e)||{};n===`audio`&&i.controls===``&&(i.controls=!0);let a=Cx.reduce(Sx(e),{...i}),o=_x(n),s=Ex(e.childNodes,t);return{object:o,type:n,data:{dataset:{...e.dataset},attributes:{...a}},nodes:s}}return null},Ex=(e,t=[])=>{let n=[];for(let r=0;r<e.length;r++){let i=Tx(e[r],t);i!==null&&(i._flatten&&i.nodes?n.push(...i.nodes):n.push(i))}return n},Dx=e=>{if(!e||!e.trim())return{object:`value`,document:{object:`document`,data:{},nodes:[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:[]}]}};let t=Ex(new DOMParser().parseFromString(e,`text/html`).body.childNodes);return!t.some(e=>e.object===`block`||e.object===`inline`)&&t.length>0&&(t=[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:t}]),t.length===0&&(t=[{object:`block`,type:`span`,data:{},isVoid:!1,nodes:[]}]),{object:`value`,document:{object:`document`,data:{},nodes:t}}},Ox=L(`div`)(({theme:e})=>({paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5)})),kx=L(`span`)(()=>({display:`inline-block`,width:`.75em`})),Ax=[`tbody`,`tr`],jx=(e,t)=>{let n=t.trim()===``,r=e&&e.type;if(!(n&&Ax.includes(r)))return t},Mx=e=>{let t=e.leaves.find(e=>k(e,`marks`,[]).length);return t?t.marks:null},Nx=(e,t,n,r,i,a)=>{if(!t)return null;let o=[];return(e.nodes||[]).forEach((e,s)=>{let c=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return o.push((0,F.jsx)(`span`,{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),o;if(r){let i=r(e,t,n);if(i){let t=e.data?.dataset?.component===`blank`;t&&o.push((0,F.jsx)(kx,{},`spacer-${s}-before`)),o.push(i),t&&o.push((0,F.jsx)(kx,{},`spacer-${s}-after`));return}}if(e.object===`text`){let t=e.leaves.reduce((e,t)=>{let n=t.text,r=jx(i,n);return r?e+r:e},``),n=Mx(e);if(n?.length>0){let e=n.map(e=>Object.keys(wx).find(t=>wx[t]===e.type)).filter(Boolean);e.length>0?o.push(e.reduceRight((e,t,n)=>(0,F.jsx)(t,{children:e},`${c}-${t}-${n}`),t)):o.push(t)}else t.length>0&&o.push(t)}else{let i=Nx(e,t,n,r,e,a);if(e.type===`p`||e.type===`paragraph`)o.push((0,F.jsx)(Ox,{children:i},c));else{let t=e.type;e.nodes&&e.nodes.length>0?o.push((0,F.jsx)(t,{...e.data.attributes,children:i},c)):o.push((0,F.jsx)(t,{...e.data.attributes},c))}}}),o},Px=L(`div`)(()=>({display:`initial`,"&:not(.MathJax) table":{borderCollapse:`collapse`},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:`8px 12px`,textAlign:`left`}})),Fx=class extends P.Component{constructor(e){super(e),this.internalContainerRef=P.createRef()}static propTypes={renderChildren:D.func,layout:D.object,value:D.object,onChange:D.func,elementType:D.string,containerRef:D.oneOfType([D.func,D.shape({current:D.instanceOf(Element)})])};componentDidMount(){let e=this.props.containerRef||this.internalContainerRef;e.current&&typeof __==`function`&&__(e.current)}handleChange=(e,t)=>{let n={...this.props.value,[e]:t};this.props.onChange(n)};render(){let{value:e,layout:t,elementType:n,containerRef:r}=this.props,i=Nx(t,e,this.handleChange,this.props.renderChildren,null,n),a=r||this.internalContainerRef;return(0,F.jsx)(Px,{ref:a,children:i})}},Ix=/\{\{(\d+)\}\}/g,Lx=(e,t)=>e?{markup:e.replace(Ix,(e,n)=>`<span data-component="${t}" data-id="${n}"></span>`)}:{markup:``},Rx=(e,t)=>{let{markup:n}=Lx(e,t);return Dx(n).document},zx=((e,t)=>class extends P.Component{static propTypes={markup:D.string,layout:D.object,value:D.object,onChange:D.func,customMarkMarkupComponent:D.func,elementType:D.string};constructor(e){super(e),this.containerRef=P.createRef()}componentDidUpdate(e){if(this.props.markup!==e.markup){let e=this.containerRef.current;(e&&e.querySelectorAll(`[data-latex][data-math-handled="true"]`)||[]).forEach(e=>{let t=e.querySelector(`mjx-container`);t&&e.removeChild(t),e.innerHTML=e.getAttribute(`data-raw`),e.removeAttribute(`data-math-handled`)})}}render(){let{markup:n,layout:r,value:i,onChange:a,elementType:o}=this.props,s=r||Rx(n,e);return(0,F.jsx)(Fx,{containerRef:this.containerRef,elementType:o,layout:s,value:i,onChange:a,renderChildren:t(this.props)})}})(`input`,e=>(t,n,r)=>{let i=t.data&&t.data.dataset||{};if(i.component===`input`)return e.customMarkMarkupComponent(i.id)}),Bx=`height ease-in 300ms, opacity ease-in 300ms`,Vx=L(`div`)(()=>({position:`relative`,height:0,overflow:`hidden`,display:`flex`,visibility:`hidden`,width:0,"&.enter":{transition:Bx,opacity:1,height:`auto`,width:`auto`,visibility:`visible`,minHeight:`25px`},"&.enter-done":{height:`auto`,visibility:`visible`,width:`auto`,minHeight:`25px`},"&.exit":{transition:Bx,opacity:0,height:0,visibility:`visible`,width:0},"&.exit-done":{opacity:0,visibility:`hidden`,height:0,width:0}})),Hx=e=>{let{show:t,children:n,className:r}=e,i=(0,P.useRef)(null);return(0,F.jsx)(Es,{nodeRef:i,in:t,appear:!0,mountOnEnter:!1,timeout:300,classNames:{enter:`enter`,enterDone:`enter-done`,exit:`exit`,exitDone:`exit-done`},children:(0,F.jsx)(Vx,{ref:i,className:r,children:n})})};Hx.propTypes={show:D.bool.isRequired,className:D.string,children:D.oneOfType([D.arrayOf(D.node),D.node]).isRequired};var Ux={translation:{categorize:{limitMaxChoicesPerCategory:`You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.`,maxChoicesPerCategoryRestriction:`To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].`},ebsr:{part:`Part {{index}}`},numberLine:{addElementLimit_one:`You can only add {{count}} element`,addElementLimit_other:`You can only add {{count}} elements`,clearAll:`Clear all`},imageClozeAssociation:{reachedLimit_one:`You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.`,reachedLimit_other:`Full`},drawingResponse:{fillColor:`Fill color`,outlineColor:`Outline color`,noFill:`No fill`,lightblue:`Light blue`,lightyellow:`Light yellow`,red:`Red`,orange:`Orange`,yellow:`Yellow`,violet:`Violet`,blue:`Blue`,green:`Green`,white:`White`,black:`Black`,onDoubleClick:`Double click to edit this text. Press Enter to submit.`},charting:{addCategory:`Add category`,actions:`Actions`,add:`Add`,delete:`Delete`,newLabel:`New label`,reachedLimit_other:`There can't be more than {{count}} categories.`,keyLegend:{incorrectAnswer:`Student incorrect answer`,correctAnswer:`Student correct answer`,correctKeyAnswer:`Answer key correct`}},graphing:{point:`Point`,circle:`Circle`,line:`Line`,parabola:`Parabola`,absolute:`Absolute Value`,exponential:`Exponential`,polygon:`Polygon`,ray:`Ray`,segment:`Segment`,sine:`Sine`,vector:`Vector`,label:`Label`,redo:`Redo`,reset:`Reset`},mathInline:{primaryCorrectWithAlternates:`Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.`},mcPopulatedBlank:{answerChoices:`Answer choices`,blankLabel:`blank`,emptyBlank:`(blank)`,blankPreSelectionHint:`The answer you choose will appear on the blank line above.`,correctAnswerSelected:`Correct answer selected`,incorrectAnswerSelected:`Incorrect answer selected`,selectedAnswerImage:`Selected answer image`,choiceImage:`Choice {{id}}`,clickToEnableAutoplay:`Click to enable audio autoplay`,audioResourceUnavailable:`Audio is enabled but no playable audio URL is configured.`,listen:`Listen`,listenSilentAlt:`Repeat instructions`,listenPlayingAlt:`Instructions are playing`,printAudio:`Audio:`,printTranscript:`Transcript:`,printKey:`(key)`},multipleChoice:{minSelections:`Select at least {{minSelections}}.`,maxSelections_one:`Only {{maxSelections}} answer is allowed.`,maxSelections_other:`Only {{maxSelections}} answers are allowed.`,minmaxSelections_equal:`Select {{minSelections}}.`,minmaxSelections_range:`Select between {{minSelections}} and {{maxSelections}}.`},selectText:{correctAnswerSelected:`Correct`,correctAnswerNotSelected:`Correct Answer Not Selected`,incorrectSelection:`Incorrect Selection`,key:`Key`},simpleCloze:{correctAnswerShown:`Correct answer`,correct:`Correct`,incorrect:`Incorrect`,unanswered:`No answer`,placeholder:`Enter your answer...`,answerInput:`Your answer`,printCorrectAnswer:`Correct answer:`,printAnswerBlank:`Answer blank`},vennClassification:{tray:`Tiles to classify`,unknownTarget:`unknown`,cancelled:`Cancelled`,returnedToTray:`{{name}} returned to tray`,placedIn:`{{name}} placed in {{target}}`,pickedUp:`Picked up {{name}}`,pickedUpWithKeyboard:`Picked up {{name}}, drop target: {{target}}. Use arrow keys to choose a drop target, Enter to drop, Escape to cancel.`,dropTarget:`Drop target: {{target}}`,unsupportedCircles_one:`This diagram cannot be shown: it has {{count}} circle, and only {{supported}} are supported.`,unsupportedCircles_other:`This diagram cannot be shown: it has {{count}} circles, and only {{supported}} are supported.`,setNumber:`Set {{number}}`,regionOnly:`{{set}} only`,regionNeither:`Neither {{first}} nor {{second}}`,regionNoneOf:`None of {{sets}}`,regionAndSeparator:` and `,tileFallbackName:`Tile`,tileNotPlaced:`not placed`,tileInRegion:`in {{region}}`,tileCorrect:`correct`,tileIncorrect:`incorrect`}},common:{undo:`Undo`,clearAll:`Clear all`,correct:`Correct`,incorrect:`Incorrect`,showCorrectAnswer:`Show correct answer`,hideCorrectAnswer:`Hide correct answer`,showTeacherInstructions:`Show Teacher Instructions`,hideTeacherInstructions:`Hide Teacher Instructions`,commonCorrectAnswerWithAlternates:`Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.`,warning:`Warning`,showNote:`Show Note`,hideNote:`Hide Note`,cancel:`Cancel`}},Wx={translation:{categorize:{limitMaxChoicesPerCategory:`Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,maxChoicesPerCategoryRestriction:`Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta`},ebsr:{part:`Parte {{index}}`},numberLine:{addElementLimit_one:`Solo puedes agregar {{count}} elemento`,addElementLimit_other:`Solo puedes agregar {{count}} elementos`,clearAll:`Borrar todo`},imageClozeAssociation:{reachedLimit_one:`Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.`,reachedLimit_other:`Lleno`},drawingResponse:{fillColor:`Color de relleno`,outlineColor:`Color del contorno`,noFill:`Sin relleno`,lightblue:`Azul claro`,lightyellow:`Amarillo claro`,red:`Rojo`,orange:`Naranja`,yellow:`Amarillo`,violet:`Violeta`,blue:`Azul`,green:`Verde`,white:`Blanco`,black:`Negro`,onDoubleClick:`Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar`},charting:{addCategory:`Añadir categoría`,actions:`Acciones`,add:`Añadir`,delete:`Eliminar`,newLabel:`Nueva etiqueta`,reachedLimit_other:`No puede haber más de {{count}} categorías.`,keyLegend:{incorrectAnswer:`Respuesta incorrecta del estudiante`,correctAnswer:`Respuesta correcta del estudiante`,correctKeyAnswer:`Clave de respuesta correcta`}},graphing:{point:`Punto`,circle:`Circulo`,line:`Línea`,parabola:`Parábola`,absolute:`Valor absoluto`,exponential:`Exponencial`,polygon:`Polígono`,ray:`Semirrecta`,segment:`Segmento `,sine:`Seno`,vector:`Vector`,label:`Etiqueta`,redo:`Rehacer`,reset:`Reiniciar`},mathInline:{primaryCorrectWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.`},mcPopulatedBlank:{answerChoices:`Opciones de respuesta`,blankLabel:`espacio en blanco`,emptyBlank:`(en blanco)`,blankPreSelectionHint:`La respuesta que elijas aparecerá en la línea en blanco de arriba.`,correctAnswerSelected:`Respuesta correcta seleccionada`,incorrectAnswerSelected:`Respuesta incorrecta seleccionada`,selectedAnswerImage:`Imagen de la respuesta seleccionada`,choiceImage:`Opción {{id}}`,clickToEnableAutoplay:`Haz clic para activar la reproducción automática del audio`,audioResourceUnavailable:`El audio está activado, pero no hay una URL de audio reproducible configurada.`,listen:`Escuchar`,listenSilentAlt:`Escuchar. Repetir las instrucciones.`,listenPlayingAlt:`Escuchar. Estas son las instrucciones.`,printAudio:`Audio:`,printTranscript:`Transcripción:`,printKey:`(clave)`},multipleChoice:{minSelections:`Seleccione al menos {{minSelections}}.`,maxSelections_one:`Sólo se permite {{maxSelections}} respuesta.`,maxSelections_other:`Sólo se permiten {{maxSelections}} respuestas.`,minmaxSelections_equal:`Seleccione {{minSelections}}.`,minmaxSelections_range:`Seleccione entre {{minSelections}} y {{maxSelections}}.`},selectText:{correctAnswerSelected:`Respuesta Correcta`,correctAnswerNotSelected:`Respuesta Correcta No Seleccionada`,incorrectSelection:`Selección Incorrecta`,key:`Clave`},simpleCloze:{correctAnswerShown:`Respuesta correcta`,correct:`Correcto`,incorrect:`Incorrecto`,unanswered:`Sin respuesta`,placeholder:`Escribe tu respuesta...`,answerInput:`Tu respuesta`,printCorrectAnswer:`Respuesta correcta:`,printAnswerBlank:`Espacio para la respuesta`},vennClassification:{tray:`Fichas para clasificar`,unknownTarget:`desconocido`,cancelled:`Cancelado`,returnedToTray:`Se devolvió {{name}} a la bandeja`,placedIn:`Se colocó {{name}} en {{target}}`,pickedUp:`Se tomó {{name}}`,pickedUpWithKeyboard:`Se tomó {{name}}, destino: {{target}}. Usa las flechas para elegir un destino, Enter para soltar y Escape para cancelar.`,dropTarget:`Destino: {{target}}`,unsupportedCircles_one:`No se puede mostrar este diagrama: tiene {{count}} círculo, y solo se admiten {{supported}}.`,unsupportedCircles_other:`No se puede mostrar este diagrama: tiene {{count}} círculos, y solo se admiten {{supported}}.`,setNumber:`Conjunto {{number}}`,regionOnly:`Solo {{set}}`,regionNeither:`Ni {{first}} ni {{second}}`,regionNoneOf:`Ninguno de {{sets}}`,regionAndSeparator:` y `,tileFallbackName:`Ficha`,tileNotPlaced:`sin colocar`,tileInRegion:`en {{region}}`,tileCorrect:`correcta`,tileIncorrect:`incorrecta`}},common:{undo:`Deshacer`,clearAll:`Borrar todo`,correct:`Correcto`,incorrect:`Incorrecto`,showCorrectAnswer:`Mostrar respuesta correcta`,hideCorrectAnswer:`Ocultar respuesta correcta`,showTeacherInstructions:`Mostrar instrucciones para el maestro`,hideTeacherInstructions:`Ocultar instrucciones para el maestro`,commonCorrectAnswerWithAlternates:`Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.`,warning:`Advertencia`,showNote:`Mostrar Nota`,hideNote:`Ocultar Nota`,cancel:`Cancelar`}},$=e=>typeof e==`string`,Gx=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Kx=e=>e==null?``:``+e,qx=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Jx=/###/g,Yx=e=>e&&e.indexOf(`###`)>-1?e.replace(Jx,`.`):e,Xx=e=>!e||$(e),Zx=(e,t,n)=>{let r=$(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(Xx(e))return{};let t=Yx(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return Xx(e)?{}:{obj:e,k:Yx(r[i])}},Qx=(e,t,n)=>{let{obj:r,k:i}=Zx(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Zx(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Zx(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},$x=(e,t,n,r)=>{let{obj:i,k:a}=Zx(e,t,Object);i[a]=i[a]||[],i[a].push(n)},eS=(e,t)=>{let{obj:n,k:r}=Zx(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},tS=(e,t,n)=>{let r=eS(e,n);return r===void 0?eS(t,n):r},nS=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(r in e?$(e[r])||e[r]instanceof String||$(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):nS(e[r],t[r],n):e[r]=t[r]);return e},rS=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),iS={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},aS=e=>$(e)?e.replace(/[&<>"'\/]/g,e=>iS[e]):e,oS=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},sS=[` `,`,`,`?`,`!`,`;`],cS=new oS(20),lS=(e,t,n)=>{t||=``,n||=``;let r=sS.filter(e=>t.indexOf(e)<0&&n.indexOf(e)<0);if(r.length===0)return!0;let i=cS.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},uS=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].indexOf(typeof t)>-1&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},dS=e=>e?.replace(/_/g,`-`),fS={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},pS=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||fS,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:($(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},mS=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n.apply(n,[e,...t])})}},hS=class extends mS{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.indexOf(`.`)>-1?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):$(n)&&i?o.push(...n.split(i)):o.push(n)));let s=eS(this.data,o);return!s&&!t&&!n&&e.indexOf(`.`)>-1&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!$(n)?s:uS(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.indexOf(`.`)>-1&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Qx(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)($(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(`.`)>-1&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=eS(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?nS(s,n,i):s={...s,...n},Qx(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},gS={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},_S=Symbol(`i18next/PATH_KEY`);function vS(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===_S?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function yS(e,t){let{[_S]:n}=e(vS()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`;if(n.length>1&&i){let e=t?.ns,a=Array.isArray(e)?e:null;if(a&&a.length>1&&a.slice(1).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var bS={},xS=e=>!$(e)&&typeof e!=`boolean`&&typeof e!=`number`,SS=class e extends mS{constructor(e,t={}){super(),qx([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=pS.create(`translator`)}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=xS(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.indexOf(n)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!lS(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:$(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:$(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=yS(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?yS(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!$(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=xS(E),ee=Object.prototype.toString.apply(E);if(y&&E&&D&&_.indexOf(ee)<0&&!($(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:xS(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&$(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=$(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!$(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=$(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=gS.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return $(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?yS(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!$(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&($(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!bS[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(bS[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.indexOf(i)===0&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.indexOf(i)===0&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!$(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.substring(0,12)===`defaultValue`&&e[t]!==void 0)return!0;return!1}},CS=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pS.create(`languageUtils`)}getScriptPartFromCode(e){if(e=dS(e),!e||e.indexOf(`-`)<0)return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=dS(e),!e||e.indexOf(`-`)<0)return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if($(e)&&e.indexOf(`-`)>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>{if(e===r||!(e.indexOf(`-`)<0&&r.indexOf(`-`)<0)&&(e.indexOf(`-`)>0&&r.indexOf(`-`)<0&&e.substring(0,e.indexOf(`-`))===r||e.indexOf(r)===0&&r.length>1))return e})}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),$(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return $(e)&&(e.indexOf(`-`)>-1||e.indexOf(`_`)>-1)?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):$(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.indexOf(e)<0&&i(this.formatLanguageCode(e))}),r}},wS={zero:0,one:1,two:2,few:3,many:4,other:5},TS={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},ES=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=pS.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=dS(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),TS;if(!e.match(/-|_/))return TS;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>wS[e]-wS[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},DS=(e,t,n,r=`.`,i=!0)=>{let a=tS(e,t,n);return!a&&i&&$(n)&&(a=uS(e,n,r),a===void 0&&(a=uS(t,n,r))),a},OS=e=>e.replace(/\$/g,`$$$$`),kS=class{constructor(e={}){this.logger=pS.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?aS:t,this.escapeValue=n===void 0||n,this.useRawValueToEscape=r!==void 0&&r,this.prefix=i?rS(i):a||`{{`,this.suffix=o?rS(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u||`-`,this.unescapeSuffix=this.unescapePrefix?``:l||``,this.nestingPrefix=d?rS(d):f||rS(`$t(`),this.nestingSuffix=p?rS(p):m||rS(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_!==void 0&&_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(e.indexOf(this.formatSeparator)<0){let i=DS(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(DS(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp();let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>OS(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?OS(this.escape(e)):OS(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=$(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!$(a)&&!this.useRawValueToEscape&&(a=Kx(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;let r=e.split(RegExp(`${rS(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!$(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!$(i))return i;$(i)||(i=Kx(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},AS=e=>{let t=e.toLowerCase().trim(),n={};if(e.indexOf(`(`)>-1){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].substring(0,r[1].length-1);t===`currency`&&i.indexOf(`:`)<0?n.currency||=i.trim():t===`relativetime`&&i.indexOf(`:`)<0?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},jS=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(dS(r),i),t[o]=s),s(n)}},MS=e=>(t,n,r)=>e(dS(n),r)(t),NS=class{constructor(e={}){this.logger=pS.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?jS:MS;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=jS(t)}format(e,t,n,r={}){let i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf(`(`)>1&&i[0].indexOf(`)`)<0&&i.find(e=>e.indexOf(`)`)>-1)){let e=i.findIndex(e=>e.indexOf(`)`)>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{let{formatName:i,formatOptions:a}=AS(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},PS=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},FS=class extends mS{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=pS.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{$x(n.loaded,[i],a),PS(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();$(e)&&(e=this.languageUtils.toResolveHierarchy(e)),$(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},IS=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,simplifyPluralSuffix:!0,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),$(e[1])&&(t.defaultValue=e[1]),$(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),LS=e=>($(e.ns)&&(e.ns=[e.ns]),$(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),$(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.(`cimode`)<0&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),typeof e.initImmediate==`boolean`&&(e.initAsync=e.initImmediate),e),RS=()=>{},zS=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},BS=`__i18next_supportNoticeShown`,VS=()=>!!(typeof globalThis<`u`&&globalThis[BS]||typeof process<`u`&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||typeof process<`u`&&process.env),HS=()=>{typeof globalThis<`u`&&(globalThis[BS]=!0)},US=e=>!!(e?.modules?.backend?.name?.indexOf(`Locize`)>0||e?.modules?.backend?.constructor?.name?.indexOf(`Locize`)>0||e?.options?.backend?.backends&&e.options.backend.backends.some(e=>e?.name?.indexOf(`Locize`)>0||e?.constructor?.name?.indexOf(`Locize`)>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(e=>e?.projectId)),WS=class e extends mS{constructor(e={},t){if(super(),this.options=LS(e),this.services={},this.logger=pS,this.modules={external:[]},zS(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&($(e.ns)?e.defaultNS=e.ns:e.ns.indexOf(`translation`)<0&&(e.defaultNS=e.ns[0]));let n=IS();this.options={...n,...this.options,...LS(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!US(this)&&!VS()&&(typeof console<`u`&&console.info!==void 0&&console.info(`🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙`),HS());let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?pS.init(r(this.modules.logger),this.options):pS.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:NS;let t=new CS(this.options);this.store=new hS(this.options.resources,this.options);let i=this.services;i.logger=pS,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new ES(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`),e&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(i.formatter=r(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new kS(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new FS(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new SS(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=RS,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Gx(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=RS){let n=t,r=$(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&e.indexOf(t)<0&&e.push(t)})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Gx();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=RS,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&gS.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!([`cimode`,`dev`].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!([`cimode`,`dev`].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Gx();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=$(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes($(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n){let r=(e,t,...i)=>{let a;a=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(i)),a.lng=a.lng||r.lng,a.lngs=a.lngs||r.lngs,a.ns=a.ns||r.ns,a.keyPrefix!==``&&(a.keyPrefix=a.keyPrefix||n||r.keyPrefix);let o={...this.options,...a};typeof a.keyPrefix==`function`&&(a.keyPrefix=yS(a.keyPrefix,o));let s=this.options.keySeparator||`.`,c;return a.keyPrefix&&Array.isArray(e)?c=e.map(e=>(typeof e==`function`&&(e=yS(e,o)),`${a.keyPrefix}${s}${e}`)):(typeof e==`function`&&(e=yS(e,o)),c=a.keyPrefix?`${a.keyPrefix}${s}${e}`:e),this.t(c,a)};return $(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Gx();return this.options.ns?($(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Gx();$(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>r.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new CS(IS());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=RS){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new hS(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...IS().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new kS(n)}return a.translator=new SS(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();WS.createInstance,WS.dir,WS.init,WS.loadResources,WS.reloadResources,WS.use,WS.changeLanguage,WS.getFixedT,WS.t,WS.exists,WS.setDefaultNamespace,WS.hasLoadedNamespace,WS.loadNamespaces,WS.loadLanguages,WS.init({fallbackLng:`en`,lng:`en`,showSupportNotice:!1,resources:{en:Ux,es:Wx}});var GS={translator:{...WS,t:(e,t)=>{let{lng:n}=t;switch(n){case`en_US`:case`en-US`:t.lng=`en`;break;case`es_ES`:case`es-ES`:case`es_MX`:case`es-MX`:t.lng=`es`;break;default:break}return WS.t(e,{lng:n,...t})}},languageOptions:[{value:`en_US`,label:`English (US)`},{value:`es_ES`,label:`Spanish`}]};function KS(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function qS(e,t){return!e||KS(e)?e:KS(e.default)?e.default:t&&KS(e[t])?e[t]:t&&KS(e[t]?.default)?e[t].default:e}var JS=qS(sv,`Readable`)||qS(ZS.Readable,`Readable`),YS=Iv,XS=YS.default,ZS=XS&&typeof XS==`object`?XS:YS,{translator:QS}=GS,$S={WebkitTouchCallout:`none`,WebkitUserSelect:`none`,KhtmlUserSelect:`none`,MozUserSelect:`none`,msUserSelect:`none`,userSelect:`none`},eC=L(`div`)(()=>({width:`100%`,cursor:`pointer`})),tC=L(`div`)(()=>({margin:`0 auto`,textAlign:`center`,display:`flex`})),nC=L(`div`)(()=>({width:`fit-content`,minWidth:`140px`,alignSelf:`center`,verticalAlign:`middle`,color:`var(--correct-answer-toggle-label-color, ${zh()})`,fontWeight:`normal`,...$S})),rC=L(`div`)(()=>({position:`absolute`,width:`25px`,"&.enter":{opacity:`0`},"&.enter-active":{opacity:`1`,transition:`opacity 0.3s ease-in`},"&.exit":{opacity:`1`},"&.exit-active":{opacity:`0`,transition:`opacity 0.3s ease-in`}})),iC=L(`div`)(()=>({width:`25px`,marginRight:`5px`,display:`flex`,alignItems:`center`})),aC=class e extends P.Component{static propTypes={onToggle:D.func,toggled:D.bool,show:D.bool,hideMessage:D.string,showMessage:D.string,className:D.string,language:D.string};static defaultProps={showMessage:`Show correct answer`,hideMessage:`Hide correct answer`,show:!1,toggled:!1};constructor(t){super(t),this.state={show:t.show},this.openIconRef=P.createRef(),this.closedIconRef=P.createRef(),e.defaultProps={...e.defaultProps,showMessage:QS.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:QS.t(`common:hideCorrectAnswer`,{lng:t.language})}}onClick(){this.props.onToggle(!this.props.toggled)}onTouch(e){e.preventDefault(),this.props.onToggle(!this.props.toggled)}UNSAFE_componentWillReceiveProps(t){this.setState({show:t.show}),t.language!==this.props?.language&&(e.defaultProps={...e.defaultProps,showMessage:QS.t(`common:showCorrectAnswer`,{lng:t.language}),hideMessage:QS.t(`common:hideCorrectAnswer`,{lng:t.language})})}render(){let{className:e,toggled:t,hideMessage:n,showMessage:r}=this.props;return(0,F.jsx)(eC,{className:e,children:(0,F.jsx)(Hx,{show:this.state.show,children:(0,F.jsxs)(tC,{onClick:this.onClick.bind(this),onTouchEnd:this.onTouch.bind(this),children:[(0,F.jsxs)(iC,{children:[(0,F.jsx)(Es,{nodeRef:this.openIconRef,timeout:400,in:t,exit:!t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(rC,{ref:this.openIconRef,children:(0,F.jsx)(Tm,{open:t},`correct-open`)})}),(0,F.jsx)(Es,{nodeRef:this.closedIconRef,timeout:5e3,in:!t,exit:t,classNames:{enter:`enter`,enterActive:`enter-active`,exit:`exit`,exitActive:`exit-active`},children:(0,F.jsx)(rC,{ref:this.closedIconRef,children:(0,F.jsx)(Tm,{open:t},`correct-closed`)})})]}),(0,F.jsx)(JS,{false:!0,children:(0,F.jsx)(nC,{"aria-hidden":!this.state.show,children:t?n:r})})]})})})}};function oC(e){return typeof e==`function`||typeof e==`object`&&!!e&&typeof e.$$typeof==`symbol`}function sC(e,t){return!e||oC(e)?e:oC(e.default)?e.default:t&&oC(e[t])?e[t]:t&&oC(e[t]?.default)?e[t].default:e}var cC=sC(A_,`UiLayout`)||sC(mC.UiLayout,`UiLayout`),lC=sC(ov,`PreviewPrompt`)||sC(mC.PreviewPrompt,`PreviewPrompt`),uC=sC(sv,`Readable`)||sC(mC.Readable,`Readable`),dC=sC(b_,`Collapsible`)||sC(mC.Collapsible,`Collapsible`),fC=Iv,pC=fC.default,mC=pC&&typeof pC==`object`?pC:fC,hC=L(cC)({color:zh(),backgroundColor:sg(),display:`inline-block`}),gC=L(`div`)({width:`100%`,position:`relative`,backgroundColor:sg(),color:zh()}),_C=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),vC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),yC=L(`div`)({position:`relative`,"& > div > div":{display:`flex`,alignItems:`baseline`,flexWrap:`wrap`},"& .mq-overarrow-inner":{border:`none !important`,padding:`0 !important`},"& .mq-overarrow-inner-right":{display:`none !important`},"& .mq-overarrow-inner-left":{display:`none !important`},"& .mq-overarrow.mq-arrow-both":{minWidth:`1.23em`,"& *":{lineHeight:`1 !important`},"&:before":{top:`-0.4em`,left:`-1px`},"&:after":{top:`-2.4em`,right:`-1px`},"&.mq-empty:after":{top:`-0.45em`}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:`-0.4em`,right:`-1px`}},"& .mq-longdiv-inner":{borderTop:`1px solid !important`,paddingTop:`1.5px !important`},"& .mq-parallelogram":{lineHeight:.85}}),bC=L(`div`)(({theme:e,$incorrect:t,$correct:n,$showCorrectness:r,$correctAnswerShown:i})=>({maxWidth:`fit-content`,...t&&{borderColor:`${qh()} !important`},...n&&{borderColor:`${Uh()} !important`},...r&&{border:`2px solid`},...i&&{padding:e.spacing(1),letterSpacing:`0.5px`},"& > .mq-math-mode":{"& > .mq-root-block":{"& > .mq-editable-field":{minWidth:`10px`,padding:e.spacing(.25)}},"& sup":{top:0}}})),xC=L(Mb)({"& > .mq-root-block":{"& > .mq-editable-field":{borderColor:zh()}}}),SC=L(`div`)(({theme:e})=>({zIndex:10,minWidth:`400px`,marginTop:e.spacing(2)})),CC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(1),pointerEvents:`none`})),wC=L(`h2`)({position:`absolute`,left:`-10000px`,top:`auto`,width:`1px`,height:`1px`,overflow:`hidden`}),TC=L(`div`)(({theme:e})=>({marginBottom:e.spacing(2)})),EC=L(aC)(({theme:e})=>({color:zh(),marginBottom:e.spacing(2)}));if(typeof document<`u`){let e=`math-templated-main-styles`;if(!document.getElementById(e)){let t=document.createElement(`style`);t.id=e,t.textContent=`
163
163
  .block-container {
164
164
  margin: 8px !important;
165
165
  display: inline-flex;
@@ -194,9 +194,9 @@ mid `,`&#8740;`),J.intercal=J[`⊺`]=W(Q,`\\intercal `,`&#8890;`),J.veebar=J[`
194
194
  .incorrect {
195
195
  border-color: ${qh()} !important;
196
196
  }
197
- `,document.head.appendChild(t)}}var TC=!1,EC=/(\{\{\d+\}\})/gm,DC=6,OC=8,kC=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function AC(e=[]){return e.map(e=>({name:e,latex:e,write:e,label:e}))}function jC(e=[],t){return Math.floor(e.length/5)*30+(t===`miscellaneous`?600:500)}function MC(e){return e.split(EC).filter(e=>e)}function NC(e,t){let{responses:n,disabled:r,markup:i,printMode:a,alwaysShowCorrect:o}=e||{};if(i)return t.showCorrect?Object.keys(n||{}).reduce((e,t)=>(e[t]=n?.[t]?.answer,e),{}):MC(i).reduce((e,n)=>{if(n.match(EC)){let i=FC.getResponseKey(n),s=t.session.answers[`r${i}`];if(a&&!o){let t=`\\ \\ `.repeat(30)+`\\embed{newLine}[] `;return{...e,[i]:`\\MathQuillMathField[r${i}]{${t.repeat(3)}}`}}return r?{...e,[i]:`\\embed{answerBlock}[r${i}]`}:{...e,[i]:`\\MathQuillMathField[r${i}]{${s&&s.value||``}}`}}return e},{})}var PC={name:`smartHorizontalPlacement`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:({state:e})=>{let t=e.modifiersData.popperOffsets;if(!t)return;let n=window.innerWidth||document.documentElement.clientWidth,r=e.rects.popper.width,i=e.elements.reference.getBoundingClientRect().left,a=e.elements.popper?.offsetParent,o=a?.getBoundingClientRect?.()||{left:0},s=a?.scrollLeft||0,c=i-o.left+s,l=c-i,u=l+OC,d=l+n-r-OC;i+r<=n?t.x=c:t.x=c-r,d<u?t.x=u:t.x=Math.min(Math.max(t.x,u),d)}},FC=class e extends P.Component{static getResponseKey=e=>(e||``).replaceAll(`{{`,``).replaceAll(`}}`,``);static propTypes={session:D.object.isRequired,onSessionChange:D.func,model:D.object.isRequired};constructor(t){super(t);let n={},{model:r,session:i}=t||{},{markup:a,alwaysShowCorrect:o}=r||{},{answers:s}=i||{};a&&(a||``).replace(EC,t=>{let r=e.getResponseKey(t),i=s&&s[`r${r}`];n[`r${r}`]={value:i?.value||``}}),this.state={session:{...t.session,answers:n},activeAnswerBlock:``,showCorrect:o||!1,tooltipContainerRef:P.createRef()}}UNSAFE_componentWillMount(){typeof window<`u`&&(TC||=(Tb(`answerBlock`,e=>({htmlString:`<div class="block-container">
197
+ `,document.head.appendChild(t)}}var DC=!1,OC=/(\{\{\d+\}\})/gm,kC=6,AC=8,jC=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function MC(e=[]){return e.map(e=>({name:e,latex:e,write:e,label:e}))}function NC(e=[],t){return Math.floor(e.length/5)*30+(t===`miscellaneous`?600:500)}function PC(e){return e.split(OC).filter(e=>e)}function FC(e,t){let{responses:n,disabled:r,markup:i,printMode:a,alwaysShowCorrect:o}=e||{};if(i)return t.showCorrect?Object.keys(n||{}).reduce((e,t)=>(e[t]=n?.[t]?.answer,e),{}):PC(i).reduce((e,n)=>{if(n.match(OC)){let i=LC.getResponseKey(n),s=t.session.answers[`r${i}`];if(a&&!o){let t=`\\ \\ `.repeat(30)+`\\embed{newLine}[] `;return{...e,[i]:`\\MathQuillMathField[r${i}]{${t.repeat(3)}}`}}return r?{...e,[i]:`\\embed{answerBlock}[r${i}]`}:{...e,[i]:`\\MathQuillMathField[r${i}]{${s&&s.value||``}}`}}return e},{})}var IC={name:`smartHorizontalPlacement`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:({state:e})=>{let t=e.modifiersData.popperOffsets;if(!t)return;let n=window.innerWidth||document.documentElement.clientWidth,r=e.rects.popper.width,i=e.elements.reference.getBoundingClientRect().left,a=e.elements.popper?.offsetParent,o=a?.getBoundingClientRect?.()||{left:0},s=a?.scrollLeft||0,c=i-o.left+s,l=c-i,u=l+AC,d=l+n-r-AC;i+r<=n?t.x=c:t.x=c-r,d<u?t.x=u:t.x=Math.min(Math.max(t.x,u),d)}},LC=class e extends P.Component{static getResponseKey=e=>(e||``).replaceAll(`{{`,``).replaceAll(`}}`,``);static propTypes={session:D.object.isRequired,onSessionChange:D.func,model:D.object.isRequired};constructor(t){super(t);let n={},{model:r,session:i}=t||{},{markup:a,alwaysShowCorrect:o}=r||{},{answers:s}=i||{};a&&(a||``).replace(OC,t=>{let r=e.getResponseKey(t),i=s&&s[`r${r}`];n[`r${r}`]={value:i?.value||``}}),this.state={session:{...t.session,answers:n},activeAnswerBlock:``,showCorrect:o||!1,tooltipContainerRef:P.createRef()}}UNSAFE_componentWillMount(){typeof window<`u`&&(DC||=(Tb(`answerBlock`,e=>({htmlString:`<div class="block-container">
198
198
  <div class="block-response" id="${e}Index">R</div>
199
199
  <div class="block-math">
200
200
  <span id="${e}"></span>
201
201
  </div>
202
- </div>`,text:()=>`text`,latex:()=>`\\embed{answerBlock}[${e}]`})),!0))}handleAnswerBlockDomUpdate=()=>{let{model:e}=this.props,{session:t,showCorrect:n}=this.state,r=t.answers;this.root&&e.disabled&&!n&&Object.keys(r).forEach(t=>{let n=this.root.querySelector(`#${t}`),i=this.root.querySelector(`#${t}Index`);if(n){let a=r[t];Eb(n,a&&a.value||``),e.view&&(n.parentElement.parentElement.classList.remove(`correct`),n.parentElement.parentElement.classList.remove(`incorrect`)),i.textContent=`R`}}),__(this.root)};UNSAFE_componentWillReceiveProps(t){let{model:n}=this.props,{model:r={}}=t||{},{markup:i=``,env:a={}}=n||{},{markup:o=``,env:s={},alwaysShowCorrect:c=!1}=r,l=e=>e&&e.mode===`evaluate`;(!l(a)||!l(s))&&this.setState(e=>({...e.session,showCorrect:!1})),c&&this.setState({showCorrect:!0});let u=i.match(EC),d=o.match(EC);if(!ie(u,d)){let t={},n=this.state.session.answers;(d||[]).forEach(r=>{let i=e.getResponseKey(r),a=n&&n[`r${i}`];t[`r${i}`]={value:a?.value||``}}),this.setState(e=>({session:{...e.session,answers:t}}),()=>{this.props.onSessionChange(this.state.session),this.handleAnswerBlockDomUpdate()})}}shouldComponentUpdate(e,t){let n=ie(this.props.model,e.model),r=ie(this.state,t);return!n||!r}componentDidMount(){this.handleAnswerBlockDomUpdate(),setTimeout(()=>__(this.root),100)}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}onSubFieldFocus=e=>{let t=Array.from(this.root?.querySelectorAll(`.mq-editable-field`)||[]).map(e=>({el:e,left:e.scrollLeft,top:e.scrollTop})),n=()=>{t.forEach(({el:e,left:t,top:n})=>{e.scrollLeft=t,e.scrollTop=n})};this.setState({activeAnswerBlock:e},()=>{n(),requestAnimationFrame(n),setTimeout(n,0)})};toNodeData=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}};setInput=e=>{this.input=e};onClick=e=>{let t=this.toNodeData(e);t.type===`clear`?this.input.clear():t.type===`command`?Array.isArray(t.value)?t.value.forEach(e=>{this.input.cmd(e)}):this.input.cmd(t.value):t.type===`cursor`?this.input.keystroke(t.value):this.input.write(t.value);let n=this.input?.el?.()||this.root,r=[],i=n;for(;i&&i!==document.body&&i!==document.documentElement;)(i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight)&&r.push(i),i=i.parentElement;document.scrollingElement&&r.push(document.scrollingElement);let a=r.map(e=>({el:e,left:e.scrollLeft,top:e.scrollTop})),o={x:window.scrollX,y:window.scrollY},s=()=>{a.forEach(({el:e,left:t,top:n})=>{e.scrollLeft=t,e.scrollTop=n}),window.scrollTo(o.x,o.y)};this.input.focus(),s(),requestAnimationFrame(s),setTimeout(s,0)};callOnSessionChange=()=>{let{onSessionChange:e}=this.props;e&&e(this.state.session)};toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)};subFieldChanged=(e,t)=>{Lf(),e&&this.setState(n=>({session:{...n.session,answers:{...n.session.answers,[e]:{value:t}}}}),this.callOnSessionChange)};getFieldName=(e,t)=>{let{answers:n}=this.state.session;if(Object.keys(n||{}).length)return Object.keys(n).find(n=>{let r=t[n];return r&&r.id==e.id})};onBlur=e=>{let{relatedTarget:t,currentTarget:n}=e||{};function r(e,t=0){if(!e||t>=16)return null;let n=e.offsetParent;return n?n.getAttribute(`role`)===`tooltip`?n:r(n,t+1):null}function i(e,t=0){if(!e||t>=4)return null;let n=e?.children?.[0];return n?n.attributes&&n.attributes[`data-keypad`]?n:i(n,t+1):null}let a=r(t),o=a?i(a):null;(!t||!n||!o?.attributes[`data-keypad`])&&this.setState({activeAnswerBlock:``})};setTooltipRef(e){setTimeout(()=>{if(e&&kC){let e=document.querySelector(`[role='tooltip']`);e&&e.firstChild.setAttribute(`tabindex`,`-1`)}},1)}renderTeacherInstructions=()=>{let{model:e}=this.props,{teacherInstructions:t,animationsDisabled:n}=e||{},r=t&&(dv(t)||pv(t)),i=(0,F.jsx)(sC,{defaultClassName:`teacher-instructions`,prompt:t});return r&&(0,F.jsx)(gC,{children:n?i:(0,F.jsx)(lC,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:i})})};renderRationale=()=>{let{model:e}=this.props,{rationale:t,animationsDisabled:n}=e||{},r=(0,F.jsx)(sC,{prompt:t});return t&&(dv(t)||pv(t))&&(0,F.jsx)(gC,{children:n?r:(0,F.jsx)(lC,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:r})})};renderPlayerContent=()=>{let{model:e}=this.props,{activeAnswerBlock:t,showCorrect:n,session:r,tooltipContainerRef:i}=this.state,{correctness:a,disabled:o,view:s,responses:c,equationEditor:l,customKeys:u,feedback:d,env:{mode:f}={},printMode:p,alwaysShowCorrect:m}=e||{},h=re(c),g=AC(u),_=NC(e,this.state)||``,v=p&&!m;return(0,F.jsx)(_C,{children:(0,F.jsx)(zx,{disabled:o,markup:e.markup,value:{},customMarkMarkupComponent:e=>{let c=f===`evaluate`&&d&&d[e],u=(0,F.jsx)(yC,{ref:e=>{this.mqStatic=e||this.mqStatic},latex:_[e],onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur});return(0,F.jsx)(vC,{ref:i,$incorrect:!h&&!c&&!n,$correct:!h&&(c||n),$showCorrectness:!h&&o&&a&&!s,$correctAnswerShown:n,children:(0,F.jsx)(Su,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:t===`r${e}`,slotProps:{popper:{container:i?.current||void 0,placement:`bottom-start`,sx:{backgroundColor:`transparent`,width:`auto`,opacity:1,"& .MuiTooltip-arrow":{display:`none`}},modifiers:[{name:`preventOverflow`,enabled:!1},{name:`flip`,enabled:!1},PC]},tooltip:{sx:{fontSize:`initial`,backgroundColor:`transparent`,width:`auto`,maxWidth:`none`,marginTop:0,paddingTop:0,boxShadow:`none`}}},title:Object.keys(r.answers).map(e=>e===t&&!(n||o)&&(0,F.jsx)(bC,{"data-keypad":!0,style:{width:jC(g,l)},children:(0,F.jsx)(Kb,{additionalKeys:g,mode:l||DC,onClick:this.onClick})},e)||null),children:v?(0,F.jsx)(xC,{children:u}):(0,F.jsx)(`div`,{children:u})})})}})})};render(){let{model:e}=this.props,{showCorrect:t}=this.state,{prompt:n,env:{mode:r,role:i}={},extraCSSRules:a,correctness:o,responses:s,language:c,showNote:l,note:u}=e||{},d=!re(s)&&o&&o.correctness!==`correct`,f=(t||r===`view`&&i===`instructor`)&&l&&u;return(0,F.jsx)(pC,{extraCSSRules:a,ref:e=>{let t=gs.findDOMNode(e);this.root=t||this.root},children:(0,F.jsxs)(mC,{children:[r===`gather`&&(0,F.jsx)(SC,{children:`Math Equation Response Question`}),(0,F.jsx)(mC,{children:d&&(0,F.jsx)(wC,{language:c,show:!0,toggled:t,onToggle:this.toggleShowCorrect})}),this.renderTeacherInstructions(),n&&(0,F.jsx)(hC,{children:(0,F.jsx)(sC,{prompt:n})}),(0,F.jsx)(cC,{false:!0,children:this.renderPlayerContent()}),f&&(0,F.jsx)(CC,{className:`note`,dangerouslySetInnerHTML:{__html:u}}),this.renderRationale()]})})}},IC=g(),LC=class extends HTMLElement{constructor(){super(),this._root=null,this._sessionNotifier=S(this,()=>{this.dispatchEvent(new T(this.tagName.toLowerCase(),!0))},{delayMs:1e3}),this.sessionChangedEventCaller=()=>this._sessionNotifier.notify()}set model(e){this._model=e,this.render(),this.dispatchEvent(new w(this.tagName.toLowerCase(),this.isSessionComplete(),this._model!==void 0))}get model(){return this._model}set session(e){this._session=e,this.render()}get session(){return this._session}isSessionComplete(){return!0}onSessionChange(e){Object.keys(e).map(t=>{this._session[t]=e[t]}),this.sessionChangedEventCaller(),this.render()}connectedCallback(){this.render()}render(){if(!(!this._model||!this._session)&&this._model&&this._session){let e=P.createElement(FC,{model:this._model,session:this._session,onSessionChange:this.onSessionChange.bind(this)});this._root||=(0,IC.createRoot)(this),this._root.render(e)}}disconnectedCallback(){C(this),this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`math-templated-element`)&&customElements.define(`math-templated-element`,LC),LC})();
202
+ </div>`,text:()=>`text`,latex:()=>`\\embed{answerBlock}[${e}]`})),!0))}handleAnswerBlockDomUpdate=()=>{let{model:e}=this.props,{session:t,showCorrect:n}=this.state,r=t.answers;this.root&&e.disabled&&!n&&Object.keys(r).forEach(t=>{let n=this.root.querySelector(`#${t}`),i=this.root.querySelector(`#${t}Index`);if(n){let a=r[t];Eb(n,a&&a.value||``),e.view&&(n.parentElement.parentElement.classList.remove(`correct`),n.parentElement.parentElement.classList.remove(`incorrect`)),i.textContent=`R`}}),__(this.root)};UNSAFE_componentWillReceiveProps(t){let{model:n}=this.props,{model:r={}}=t||{},{markup:i=``,env:a={}}=n||{},{markup:o=``,env:s={},alwaysShowCorrect:c=!1}=r,l=e=>e&&e.mode===`evaluate`;(!l(a)||!l(s))&&this.setState(e=>({...e.session,showCorrect:!1})),c&&this.setState({showCorrect:!0});let u=i.match(OC),d=o.match(OC);if(!ie(u,d)){let t={},n=this.state.session.answers;(d||[]).forEach(r=>{let i=e.getResponseKey(r),a=n&&n[`r${i}`];t[`r${i}`]={value:a?.value||``}}),this.setState(e=>({session:{...e.session,answers:t}}),()=>{this.props.onSessionChange(this.state.session),this.handleAnswerBlockDomUpdate()})}}shouldComponentUpdate(e,t){let n=ie(this.props.model,e.model),r=ie(this.state,t);return!n||!r}componentDidMount(){this.handleAnswerBlockDomUpdate(),setTimeout(()=>__(this.root),100)}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}onSubFieldFocus=e=>{let t=Array.from(this.root?.querySelectorAll(`.mq-editable-field`)||[]).map(e=>({el:e,left:e.scrollLeft,top:e.scrollTop})),n=()=>{t.forEach(({el:e,left:t,top:n})=>{e.scrollLeft=t,e.scrollTop=n})};this.setState({activeAnswerBlock:e},()=>{n(),requestAnimationFrame(n),setTimeout(n,0)})};toNodeData=e=>{if(!e)return;let{type:t,value:n}=e;return t===`command`||t===`cursor`?e:t===`answer`?{type:`answer`,...e}:n===`clear`?{type:`clear`}:{type:`write`,value:n}};setInput=e=>{this.input=e};onClick=e=>{let t=this.toNodeData(e);t.type===`clear`?this.input.clear():t.type===`command`?Array.isArray(t.value)?t.value.forEach(e=>{this.input.cmd(e)}):this.input.cmd(t.value):t.type===`cursor`?this.input.keystroke(t.value):this.input.write(t.value);let n=this.input?.el?.()||this.root,r=[],i=n;for(;i&&i!==document.body&&i!==document.documentElement;)(i.scrollWidth>i.clientWidth||i.scrollHeight>i.clientHeight)&&r.push(i),i=i.parentElement;document.scrollingElement&&r.push(document.scrollingElement);let a=r.map(e=>({el:e,left:e.scrollLeft,top:e.scrollTop})),o={x:window.scrollX,y:window.scrollY},s=()=>{a.forEach(({el:e,left:t,top:n})=>{e.scrollLeft=t,e.scrollTop=n}),window.scrollTo(o.x,o.y)};this.input.focus(),s(),requestAnimationFrame(s),setTimeout(s,0)};callOnSessionChange=()=>{let{onSessionChange:e}=this.props;e&&e(this.state.session)};toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)};subFieldChanged=(e,t)=>{Lf(),e&&this.setState(n=>({session:{...n.session,answers:{...n.session.answers,[e]:{value:t}}}}),this.callOnSessionChange)};getFieldName=(e,t)=>{let{answers:n}=this.state.session;if(Object.keys(n||{}).length)return Object.keys(n).find(n=>{let r=t[n];return r&&r.id==e.id})};onBlur=e=>{let{relatedTarget:t,currentTarget:n}=e||{};function r(e,t=0){if(!e||t>=16)return null;let n=e.offsetParent;return n?n.getAttribute(`role`)===`tooltip`?n:r(n,t+1):null}function i(e,t=0){if(!e||t>=4)return null;let n=e?.children?.[0];return n?n.attributes&&n.attributes[`data-keypad`]?n:i(n,t+1):null}let a=r(t),o=a?i(a):null;(!t||!n||!o?.attributes[`data-keypad`])&&this.setState({activeAnswerBlock:``})};setTooltipRef(e){setTimeout(()=>{if(e&&jC){let e=document.querySelector(`[role='tooltip']`);e&&e.firstChild.setAttribute(`tabindex`,`-1`)}},1)}renderTeacherInstructions=()=>{let{model:e}=this.props,{teacherInstructions:t,animationsDisabled:n}=e||{},r=t&&(dv(t)||pv(t)),i=(0,F.jsx)(lC,{defaultClassName:`teacher-instructions`,prompt:t});return r&&(0,F.jsx)(vC,{children:n?i:(0,F.jsx)(dC,{labels:{hidden:`Show Teacher Instructions`,visible:`Hide Teacher Instructions`},children:i})})};renderRationale=()=>{let{model:e}=this.props,{rationale:t,animationsDisabled:n}=e||{},r=(0,F.jsx)(lC,{prompt:t});return t&&(dv(t)||pv(t))&&(0,F.jsx)(vC,{children:n?r:(0,F.jsx)(dC,{labels:{hidden:`Show Rationale`,visible:`Hide Rationale`},children:r})})};renderPlayerContent=()=>{let{model:e}=this.props,{activeAnswerBlock:t,showCorrect:n,session:r,tooltipContainerRef:i}=this.state,{correctness:a,disabled:o,view:s,responses:c,equationEditor:l,customKeys:u,feedback:d,env:{mode:f}={},printMode:p,alwaysShowCorrect:m}=e||{},h=re(c),g=MC(u),_=FC(e,this.state)||``,v=p&&!m;return(0,F.jsx)(yC,{children:(0,F.jsx)(zx,{disabled:o,markup:e.markup,value:{},customMarkMarkupComponent:e=>{let c=f===`evaluate`&&d&&d[e],u=(0,F.jsx)(xC,{ref:e=>{this.mqStatic=e||this.mqStatic},latex:_[e],onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur});return(0,F.jsx)(bC,{ref:i,$incorrect:!h&&!c&&!n,$correct:!h&&(c||n),$showCorrectness:!h&&o&&a&&!s,$correctAnswerShown:n,children:(0,F.jsx)(Su,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:t===`r${e}`,slotProps:{popper:{container:i?.current||void 0,placement:`bottom-start`,sx:{backgroundColor:`transparent`,width:`auto`,opacity:1,"& .MuiTooltip-arrow":{display:`none`}},modifiers:[{name:`preventOverflow`,enabled:!1},{name:`flip`,enabled:!1},IC]},tooltip:{sx:{fontSize:`initial`,backgroundColor:`transparent`,width:`auto`,maxWidth:`none`,marginTop:0,paddingTop:0,boxShadow:`none`}}},title:Object.keys(r.answers).map(e=>e===t&&!(n||o)&&(0,F.jsx)(SC,{"data-keypad":!0,style:{width:NC(g,l)},children:(0,F.jsx)(Kb,{additionalKeys:g,mode:l||kC,onClick:this.onClick})},e)||null),children:v?(0,F.jsx)(CC,{children:u}):(0,F.jsx)(`div`,{children:u})})})}})})};render(){let{model:e}=this.props,{showCorrect:t}=this.state,{prompt:n,env:{mode:r,role:i}={},extraCSSRules:a,correctness:o,responses:s,language:c,showNote:l,note:u}=e||{},d=!re(s)&&o&&o.correctness!==`correct`,f=(t||r===`view`&&i===`instructor`)&&l&&u;return(0,F.jsx)(hC,{extraCSSRules:a,ref:e=>{let t=gs.findDOMNode(e);this.root=t||this.root},children:(0,F.jsxs)(gC,{children:[r===`gather`&&(0,F.jsx)(wC,{children:`Math Equation Response Question`}),(0,F.jsx)(gC,{children:d&&(0,F.jsx)(EC,{language:c,show:!0,toggled:t,onToggle:this.toggleShowCorrect})}),this.renderTeacherInstructions(),n&&(0,F.jsx)(_C,{children:(0,F.jsx)(lC,{prompt:n})}),(0,F.jsx)(uC,{false:!0,children:this.renderPlayerContent()}),f&&(0,F.jsx)(TC,{className:`note`,dangerouslySetInnerHTML:{__html:u}}),this.renderRationale()]})})}},RC=g(),zC=class extends HTMLElement{constructor(){super(),this._root=null,this._sessionNotifier=S(this,()=>{this.dispatchEvent(new T(this.tagName.toLowerCase(),!0))},{delayMs:1e3}),this.sessionChangedEventCaller=()=>this._sessionNotifier.notify()}set model(e){this._model=e,this.render(),this.dispatchEvent(new w(this.tagName.toLowerCase(),this.isSessionComplete(),this._model!==void 0))}get model(){return this._model}set session(e){this._session=e,this.render()}get session(){return this._session}isSessionComplete(){return!0}onSessionChange(e){Object.keys(e).map(t=>{this._session[t]=e[t]}),this.sessionChangedEventCaller(),this.render()}connectedCallback(){this.render()}render(){if(!(!this._model||!this._session)&&this._model&&this._session){let e=P.createElement(LC,{model:this._model,session:this._session,onSessionChange:this.onSessionChange.bind(this)});this._root||=(0,RC.createRoot)(this),this._root.render(e)}}disconnectedCallback(){C(this),this._root&&=(this._root.unmount(),null)}};return typeof window<`u`&&!customElements.get(`math-templated-element`)&&customElements.define(`math-templated-element`,zC),zC})();