@pie-element/ebsr 6.6.3-next.1082 → 6.6.3-next.1089

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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * MathQuill v1.1.2, by Han, Jeanine, and Mary
3
+ * http://mathquill.com | maintainers@mathquill.com
4
+ *
5
+ * This Source Code Form is subject to the terms of the
6
+ * Mozilla Public License, v. 2.0. If a copy of the MPL
7
+ * was not distributed with this file, You can obtain
8
+ * one at http://mozilla.org/MPL/2.0/.
9
+ */
10
+ !function(){function t(){}function e(t){var e=t.length-1;return function(){var n=m.call(arguments,0,e),s=m.call(arguments,e);return t.apply(this,n.concat([s]))}}function n(t){return e(function(e,n){"function"!=typeof e&&(e=g(e));var s=function(t){return e.apply(t,[t].concat(n))};return t.call(this,s)})}function s(t){var e=m.call(arguments,1);return function(){return t.apply(this,e)}}function i(t,e){if(!e)throw new Error("prayer failed: "+t)}function r(t){i("a direction was passed",t===q||t===v)}function a(t,e,n){i("a parent is always present",t),i("leftward is properly set up",function(){return e?e[v]===n&&e.parent===t:t.ends[q]===n}()),i("rightward is properly set up",function(){return n?n[q]===e&&n.parent===t:t.ends[v]===e}())}function o(){window.console&&console.warn('You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide')}function l(t){return o(),Pt(t)}function c(e){function n(t){var e,n;return t&&t.nodeType?(e=x(t).children(".mq-root-block").attr(Wt),n=e&&y.byId[e].controller,n?i[n.KIND_OF_MQ](n):null):null}function s(t,e){var n,s,r;e&&e.handlers&&(e.handlers={fns:e.handlers,APIClasses:i});for(n in e)e.hasOwnProperty(n)&&(s=e[n],r=E[n],t[n]=r?r(s):s)}var i,r,a;if(!(I<=e&&e<=R))throw"Only interface versions between "+I+" and "+R+" supported. You specified: "+e;i={},n.L=q,n.R=v,n.saneKeyboardEvents=M,n.config=function(t){return s(_.p,t),this},n.registerEmbed=function(t,e){if(!/^[a-z][a-z0-9]*$/i.test(t))throw"Embed name must start with letter and be only letters and digits";A[t]=e},r=i.AbstractMathQuill=b(L,function(t){t.init=function(t){this.__controller=t,this.__options=t.options,this.id=t.id,this.data=t.data},t.parseLatex=function(t){return this.__controller.parseLatex(t)},t.__mathquillify=function(t){var e,n=this.__controller,s=n.root,i=n.container;n.createTextarea(),e=i.addClass(t).contents().detach(),s.jQ=x('<span class="mq-root-block"/>').attr(Wt,s.id).appendTo(i),this.latex(e.text()),this.revert=function(){return i.empty().unbind(".mathquill").removeClass("mq-editable-field mq-math-mode mq-text-mode").append(e)}},t.config=function(t){return s(this.__options,t),this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText()},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexMath(t),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}}),n.prototype=r.prototype,i.EditableField=b(r,function(e,n){e.__mathquillify=function(){return n.__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(t){return this.__controller.writeLatex(t),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.empty=function(){var t=this.__controller.root,e=this.__controller.cursor;return t.eachChild("postOrder","dispose"),t.ends[q]=t.ends[v]=0,t.jQ.empty(),delete e.selection,e.insAtRightEnd(t),this},e.cmd=function(t){var e,n=this.__controller.notify(),s=n.cursor;return/^\\[a-z]+$/i.test(t)&&!s.isTooDeep()?(t=t.slice(1),(e=k[t])&&(t=e(t),s.selection&&t.replaces(s.replaceSelection()),t.createLeftOf(s.show()),this.__controller.scrollHoriz())):s.parent.write(s,t),n.blurred&&s.hide().parent.blur(),this},e.select=function(){var t=this.__controller;for(t.notify("move").cursor.insAtRightEnd(t.root);t.cursor[q];)t.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(t){return this.__controller.notify("move").cursor.insAtDirEnd(t,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(q)},e.moveToRightEnd=function(){return this.moveToDirEnd(v)},e.keystroke=function(e){var n;for(e=e.replace(/^\s+|\s+$/g,"").split(/\s+/),n=0;n<e.length;n+=1)this.__controller.keystroke(e[n],{preventDefault:t});return this},e.typedText=function(t){for(var e=0;e<t.length;e+=1)this.__controller.typedText(t.charAt(e));return this},e.dropEmbedded=function(t,e,n){var s,i=t-x(window).scrollLeft(),r=e-x(window).scrollTop(),a=document.elementFromPoint(i,r);this.__controller.seek(x(a),t,e),s=Qt().setOptions(n),s.createLeftOf(this.__controller.cursor)},e.clickAt=function(t,e,n){n=n||document.elementFromPoint(t,e);var s=this.__controller,i=s.root;return Ht.contains(i.jQ[0],n)||(n=i.jQ[0]),s.seek(x(n),t+pageXOffset,e+pageYOffset),s.blurred&&this.focus(),this},e.ignoreNextMousedown=function(t){return this.__controller.cursor.options.ignoreNextMousedown=t,this}}),n.EditableField=function(){throw"wtf don't call me, I'm 'abstract'"},n.EditableField.prototype=i.EditableField.prototype;for(a in D)!function(t,s){var r=i[t]=s(i);n[t]=function(s,i){var a,o=n(s);return o instanceof r||!s||!s.nodeType?o:(a=C(r.RootBlock(),x(s),_()),a.KIND_OF_MQ=t,r(a).__mathquillify(i,e))},n[t].prototype=r.prototype}(a,D[a]);return n}function u(t){var e,n="moveOutOf deleteOutOf selectOutOf upOutOf downOutOf".split(" ");for(e=0;e<n.length;e+=1)!function(e){t[e]=function(t){this.controller.handle(e,t)}}(n[e]);t.reflow=function(){this.controller.handle("reflow"),this.controller.handle("edited"),this.controller.handle("edit")}}function h(t,e,n){return b(K,{ctrlSeq:t,htmlTemplate:"<"+e+" "+n+">&0</"+e+">"})}function p(t){var e=this.parent,n=t;do{if(n[v])return t.insLeftOf(e);n=n.parent.parent}while(n!==e);t.insRightOf(e)}function f(t,e){t.jQadd=function(){e.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(":first").add(this.jQ.children(":last")),this.contentjQ=this.jQ.children(":eq(1)")},t.reflow=function(){var t=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css("fontSize"));J(this.delimjQs,Gt(1+.2*(t-1),1.2),1.2*t)}}function d(t,e){var e=e||t,n=kt[t],i=kt[e];T[t]=s(Ot,q,t,n,e,i),T[n]=s(Ot,v,t,n,e,i)}var m,g,b,q,v,x,w,y,O,k,T,Q,j,S,C,D,_,E,L,A,I,R,z,M,B,F,N,$,P,V,H,U,W,G,K,Y,Z,X,J,tt,et,nt,st,it,rt,at,ot,lt,ct,ut,ht,pt,ft,dt,mt,gt,bt,qt,vt,xt,wt,yt,Ot,kt,Tt,Qt,jt,St,Ct,Dt,_t,Et,Lt,At,It,Rt,zt,Mt,Bt,Ft,Nt,$t,Pt,Vt,Ht=window.jQuery,Ut="mathquill-command-id",Wt="mathquill-block-id",Gt=Math.min,Kt=Math.max;if(!Ht)throw"MathQuill requires jQuery 1.5.2+ to be loaded first";m=[].slice,g=e(function(t,n){return e(function(e,s){if(t in e)return e[t].apply(e,n.concat(s))})}),b=function(t,e,n){function s(t){return"object"==typeof t}function i(t){return"function"==typeof t}function r(){}return function t(n,a){function o(){var t=new l;return i(t.init)&&t.init.apply(t,arguments),t}function l(){}var c,u,h;return void 0===a&&(a=n,n=Object),o.Bare=l,c=r.prototype=n.prototype,u=l.prototype=o.prototype=o.p=new r,u.constructor=o,o.extend=function(e){return t(o,e)},(o.open=function(t){if(h={},i(t)?h=t.call(o,u,c,o,n):s(t)&&(h=t),s(h))for(var r in h)e.call(h,r)&&(u[r]=h[r]);return i(u.init)||(u.init=n),o})(a)}}(0,{}.hasOwnProperty),q=-1,v=1,x=b(Ht,function(t){t.insDirOf=function(t,e){return t===q?this.insertBefore(e.first()):this.insertAfter(e.last())},t.insAtDirEnd=function(t,e){return t===q?this.prependTo(e):this.appendTo(e)}}),w=b(function(t){t.parent=0,t[q]=0,t[v]=0,t.init=function(t,e,n){this.parent=t,this[q]=e,this[v]=n},this.copy=function(t){return w(t.parent,t[q],t[v])}}),y=b(function(t){function e(){return s+=1}t[q]=0,t[v]=0,t.parent=0;var s=0;this.byId={},t.init=function(){this.id=e(),y.byId[this.id]=this,this.ends={},this.ends[q]=0,this.ends[v]=0},t.dispose=function(){delete y.byId[this.id]},t.toString=function(){return"{{ MathQuill Node #"+this.id+" }}"},t.jQ=x(),t.jQadd=function(t){return this.jQ=this.jQ.add(t)},t.jQize=function(t){function e(t){var n,s;for(t.getAttribute&&(n=t.getAttribute("mathquill-command-id"),s=t.getAttribute("mathquill-block-id"),n&&y.byId[n].jQadd(t),s&&y.byId[s].jQadd(t)),t=t.firstChild;t;t=t.nextSibling)e(t)}var n;for(t=x(t||this.html()),n=0;n<t.length;n+=1)e(t[n]);return t},t.createDir=function(t,e){r(t);var n=this;return n.jQize(),n.jQ.insDirOf(t,e.jQ),e[t]=n.adopt(e.parent,e[q],e[v]),n},t.createLeftOf=function(t){return this.createDir(q,t)},t.selectChildren=function(t,e){return S(t,e)},t.bubble=n(function(t){var e;for(e=this;e&&!1!==t(e);e=e.parent);return this}),t.postOrder=n(function(t){return function e(n){n.eachChild(e),t(n)}(this),this}),t.isEmpty=function(){return 0===this.ends[q]&&0===this.ends[v]},t.isStyleBlock=function(){return!1},t.children=function(){return O(this.ends[q],this.ends[v])},t.eachChild=function(){var t=this.children();return t.each.apply(t,arguments),this},t.foldChildren=function(t,e){return this.children().fold(t,e)},t.withDirAdopt=function(t,e,n,s){return O(this,this).withDirAdopt(t,e,n,s),this},t.adopt=function(t,e,n){return O(this,this).adopt(t,e,n),this},t.disown=function(){return O(this,this).disown(),this},t.remove=function(){return this.jQ.remove(),this.postOrder("dispose"),this.disown()}}),O=b(function(t){t.init=function(t,e,n){if(void 0===n&&(n=q),r(n),i("no half-empty fragments",!t==!e),this.ends={},t){i("withDir is passed to Fragment",t instanceof y),i("oppDir is passed to Fragment",e instanceof y),i("withDir and oppDir have the same parent",t.parent===e.parent),this.ends[n]=t,this.ends[-n]=e;var s=this.fold([],function(t,e){return t.push.apply(t,e.jQ.get()),t});this.jQ=this.jQ.add(s)}},t.jQ=x(),t.withDirAdopt=function(t,e,n,s){return t===q?this.adopt(e,n,s):this.adopt(e,s,n)},t.adopt=function(t,e,n){var s,i,r;return a(t,e,n),s=this,s.disowned=!1,(i=s.ends[q])?(r=s.ends[v],e||(t.ends[q]=i),n?n[q]=r:t.ends[v]=r,s.ends[v][v]=n,s.each(function(n){n[q]=e,n.parent=t,e&&(e[v]=n),e=n}),s):this},t.disown=function(){var t,e,n=this,s=n.ends[q];return!s||n.disowned?n:(n.disowned=!0,t=n.ends[v],e=s.parent,a(e,s[q],s),a(e,t,t[v]),s[q]?s[q][v]=t[v]:e.ends[q]=t[v],t[v]?t[v][q]=s[q]:e.ends[v]=s[q],n)},t.remove=function(){return this.jQ.remove(),this.each("postOrder","dispose"),this.disown()},t.each=n(function(t){var e=this,n=e.ends[q];if(!n)return e;for(;n!==e.ends[v][v]&&!1!==t(n);n=n[v]);return e}),t.fold=function(t,e){return this.each(function(n){t=e.call(this,t,n)}),t}}),k={},T={},Q={},j=b(w,function(t){t.init=function(t,e){this.parent=t,this.options=e;var n=this.jQ=this._jQ=x('<span class="mq-cursor">&#8203;</span>');this.blink=function(){n.toggleClass("mq-blink")},this.upDownCache={}},t.show=function(){return this.jQ=this._jQ.removeClass("mq-blink"),"intervalId"in this?clearInterval(this.intervalId):(this[v]?this.selection&&this.selection.ends[q][q]===this[q]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[v].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},t.hide=function(){return"intervalId"in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=x(),this},t.withDirInsertAt=function(t,e,n,s){var i=this.parent;this.parent=e,this[t]=n,this[-t]=s,i!==e&&i.blur&&i.blur(this)},t.insDirOf=function(t,e){return r(t),this.jQ.insDirOf(t,e.jQ),this.withDirInsertAt(t,e.parent,e[t],e),this.parent.jQ.addClass("mq-hasCursor"),this},t.insLeftOf=function(t){return this.insDirOf(q,t)},t.insRightOf=function(t){return this.insDirOf(v,t)},t.insAtDirEnd=function(t,e){return r(t),this.jQ.insAtDirEnd(t,e.jQ),this.withDirInsertAt(t,e,0,e.ends[t]),e.focus(),this},t.insAtLeftEnd=function(t){return this.insAtDirEnd(q,t)},t.insAtRightEnd=function(t){return this.insAtDirEnd(v,t)},t.jumpUpDown=function(t,e){var n,s,i=this;i.upDownCache[t.id]=w.copy(i),n=i.upDownCache[e.id],n?n[v]?i.insLeftOf(n[v]):i.insAtRightEnd(n.parent):(s=i.offset().left,e.seek(s,i))},t.offset=function(){var t=this,e=t.jQ.removeClass("mq-cursor").offset();return t.jQ.addClass("mq-cursor"),e},t.unwrapGramp=function(){var t=this.parent.parent,e=t.parent,n=t[v],s=this,i=t[q];if(t.disown().eachChild(function(s){s.isEmpty()||(s.children().adopt(e,i,n).each(function(e){e.jQ.insertBefore(t.jQ.first())}),i=s.ends[v])}),!this[v])if(this[q])this[v]=this[q][v];else for(;!this[v];){if(this.parent=this.parent[v],!this.parent){this[v]=t[v],this.parent=e;break}this[v]=this.parent.ends[q]}this[v]?this.insLeftOf(this[v]):this.insAtRightEnd(e),t.jQ.remove(),t[q].siblingDeleted&&t[q].siblingDeleted(s.options,v),t[v].siblingDeleted&&t[v].siblingDeleted(s.options,q)},t.startSelection=function(){var t,e=this.anticursor=w.copy(this),n=e.ancestors={};for(t=e;t.parent;t=t.parent)n[t.parent.id]=t},t.endSelection=function(){delete this.anticursor},t.select=function(){var t,e,n,s,r,a,o,l=this.anticursor;if(this[q]===l[q]&&this.parent===l.parent)return!1;for(t=this;t.parent;t=t.parent)if(t.parent.id in l.ancestors){e=t.parent;break}if(i("cursor and anticursor in the same tree",e),n=l.ancestors[e.id],a=v,t[q]!==n)for(o=t;o;o=o[v])if(o[v]===n[v]){a=q,s=t,r=n;break}return a===v&&(s=n,r=t),s instanceof w&&(s=s[v]),r instanceof w&&(r=r[q]),this.hide().selection=e.selectChildren(s,r),this.insDirOf(a,this.selection.ends[a]),this.selectionChanged(),!0},t.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},t.deleteSelection=function(){this.selection&&(this[q]=this.selection.ends[q][q],this[v]=this.selection.ends[v][v],this.selection.remove(),this.selectionChanged(),delete this.selection)},t.replaceSelection=function(){var t=this.selection;return t&&(this[q]=t.ends[q][q],this[v]=t.ends[v][v],delete this.selection),t},t.depth=function(){for(var t=this,e=0;t=t.parent;)e+=t instanceof W?1:0;return e},t.isTooDeep=function(t){if(void 0!==this.options.maxDepth)return this.depth()+(t||0)>this.options.maxDepth},t.howDeep=function(){for(var t=0,e=this;e=e.parent;)t++;return 1+Math.floor(t/2)},t.tooDeep=function(){var t=this.options.maxDepth;return t&&this.howDeep()>t}}),S=b(O,function(t,e){t.init=function(){e.init.apply(this,arguments),this.jQ=this.jQ.wrapAll('<span class="mq-selection"></span>').parent()},t.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),e.adopt.apply(this,arguments)},t.clear=function(){return this.jQ.replaceWith(this.jQ[0].childNodes),this},t.join=function(t){return this.fold("",function(e,n){return e+n[t]()})}}),C=b(function(t){t.init=function(t,e,n){this.id=t.id,this.data={},this.root=t,this.container=e,this.options=n,t.controller=this,this.cursor=t.cursor=j(t,n)},t.handle=function(t,e){var n,s=this.options.handlers;s&&s.fns[t]&&(n=s.APIClasses[this.KIND_OF_MQ](this),e===q||e===v?s.fns[t](e,n):s.fns[t](n))};var e=[];this.onNotify=function(t){e.push(t)},t.notify=function(){for(var t=0;t<e.length;t+=1)e[t].apply(this.cursor,arguments);return this}}),D={},_=b(),E={},L=b(),A={},l.prototype=L.p,l.VERSION="v1.1.2",l.interfaceVersion=function(t){if(1!==t)throw"Only interface version 1 supported. You specified: "+t;return o=function(){window.console&&console.warn('You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide')},o(),l},l.getInterface=c,I=c.MIN=1,R=c.MAX=2,l.noConflict=function(){return window.MathQuill=z,l},z=window.MathQuill,window.MathQuill=l,M=function(){function e(t){var e,s=t.which||t.keyCode,i=n[s],r=[];return t.ctrlKey&&r.push("Ctrl"),t.originalEvent&&t.originalEvent.metaKey&&r.push("Meta"),t.altKey&&r.push("Alt"),t.shiftKey&&r.push("Shift"),e=i||String.fromCharCode(s),r.length||i?(r.push(e),r.join("-")):e}var n={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"};return function(n,s){function i(t){y=t,clearTimeout(g),g=setTimeout(t)}function r(e){i(function(n){y=t,clearTimeout(g),e(n)})}function a(e){y(),y=t,clearTimeout(g),x.val(e),e&&x[0]&&x[0].select&&x[0].select(),b=!!e}function o(){var t=x[0];return"selectionStart"in t&&t.selectionStart!==t.selectionEnd}function l(){s.keystroke(e(q),q)}function c(t){q=t,v=null,b&&r(function(t){t&&"focusout"===t.type||!x[0]||!x[0].select||x[0].select()}),l()}function u(t){q&&v&&l(),v=t,i(p)}function h(t){q&&!v&&i(p)}function p(){if(!o()){var t=x.val();1===t.length?(x.val(""),s.typedText(t)):t&&x[0]&&x[0].select&&x[0].select()}}function f(){q=v=null}function d(t){x.focus(),i(m)}function m(){var t=x.val();x.val(""),t&&s.paste(t)}var g,b,q=null,v=null,x=Ht(n),w=Ht(s.container||x),y=t;return w.bind("keydown keypress input keyup focusout paste",function(t){y(t)}),b=!1,w.bind({keydown:c,keypress:u,keyup:h,focusout:f,cut:function(){r(function(){s.cut()})},copy:function(){r(function(){s.copy()})},paste:d}),{select:a}}}(),B=b(function(t,e,n){function s(t,e){throw t=t?"'"+t+"'":"EOF","Parse Error: "+e+" at "+t}var r,a,o;t.init=function(t){this._=t},t.parse=function(t){function e(t,e){return e}return this.skip(o)._(""+t,e,s)},t.or=function(t){i("or is passed a parser",t instanceof n);var e=this;return n(function(n,s,i){function r(e){return t._(n,s,i)}return e._(n,s,r)})},t.then=function(t){var e=this;return n(function(s,r,a){function o(e,s){var o=t instanceof n?t:t(s);return i("a parser is returned",o instanceof n),o._(e,r,a)}return e._(s,o,a)})},t.many=function(){var t=this;return n(function(e,n,s){function i(t,n){return e=t,a.push(n),!0}function r(){return!1}for(var a=[];t._(e,i,r););return n(e,a)})},t.times=function(t,e){arguments.length<2&&(e=t);var s=this;return n(function(n,i,r){function a(t,e){return h.push(e),n=t,!0}function o(t,e){return c=e,n=t,!1}function l(t,e){return!1}var c,u,h=[],p=!0;for(u=0;u<t;u+=1)if(!(p=s._(n,a,o)))return r(n,c);for(;u<e&&p;u+=1)p=s._(n,a,l);return i(n,h)})},t.result=function(t){return this.then(a(t))},t.atMost=function(t){return this.times(0,t)},t.atLeast=function(t){var e=this;return e.times(t).then(function(t){return e.many().map(function(e){return t.concat(e)})})},t.map=function(t){return this.then(function(e){return a(t(e))})},t.skip=function(t){return this.then(function(e){return t.result(e)})},this.string=function(t){var e=t.length,s="expected '"+t+"'";return n(function(n,i,r){var a=n.slice(0,e);return a===t?i(n.slice(e),a):r(n,s)})},r=this.regex=function(t){i("regexp parser is anchored","^"===t.toString().charAt(1));var e="expected "+t;return n(function(n,s,i){var r,a=t.exec(n);return a?(r=a[0],s(n.slice(r.length),r)):i(n,e)})},a=n.succeed=function(t){return n(function(e,n){return n(e,t)})},n.fail=function(t){return n(function(e,n,s){return s(e,t)})},n.letter=r(/^[a-z]/i),n.letters=r(/^[a-z]*/i),n.digit=r(/^[0-9]/),n.digits=r(/^[0-9]*/),n.whitespace=r(/^\s+/),n.optWhitespace=r(/^\s*/),n.any=n(function(t,e,n){return t?e(t.slice(1),t.charAt(0)):n(t,"expected any character")}),n.all=n(function(t,e,n){return e("",t)}),o=n.eof=n(function(t,e,n){return t?n(t,"expected EOF"):e(t,t)})}),F=/[\\]{2,}/gm,N=function(){function t(t){var e=W();return t.adopt(e,0,0),e}function e(t){var e,n=t[0]||W();for(e=1;e<t.length;e+=1)t[e].children().adopt(n,n.ends[v],0);return n}var n=B.string,s=B.regex,i=B.letter,r=B.any,a=B.optWhitespace,o=B.succeed,l=B.fail,c=i.map(function(t){return Dt(t)}),u=s(/^[^${}\\_^]/).map(function(t){return H(t)}),h=s(/^\\not\\[a-z]+/).then(function(t){return Q[t]&&Q[t]().parser()||l("unknown compound command: "+t)}),p=s(/^[^\\a-eg-zA-Z]/).or(n("\\").then(s(/^begin\{.?matrix\}/).or(s(/^[a-z]+/i)).or(s(/^\s+/).result(" ")).or(r))).then(function(t){t=t.replace(/^begin\{(.?matrix)\}$/,"$1");var e=k[t];return e?e(t).parser():l("unknown command: \\"+t)}),f=h.or(p).or(c).or(u),d=n("{").then(function(){return g}).skip(n("}")),m=a.then(d.or(f.map(t))),g=m.many().map(e).skip(a),b=n("[").then(m.then(function(t){return"]"!==t.join("latex")?o(t):l()}).many().map(e).skip(a)).skip(n("]")),q=g;return q.block=m,q.optBlock=b,q}(),C.open(function(t,e){t.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,"$1")},t.parseLatex=function(t){return N.parse(t).postOrder("finalizeTree",_.p).join("latex").trim()},E.maxDepth=function(t){return"number"==typeof t?t:void 0},t.writeLatex=function(t){var e,n=this.notify("edit").cursor,s=B.all,i=B.eof,r=N.skip(i).or(s.result(!1)).parse(t);return r&&!r.isEmpty()&&r.prepareInsertionAt(n)&&(r.children().adopt(n.parent,n[q],n[v]),e=r.jQize(),e.insertBefore(n.jQ),n[q]=r.ends[v],r.finalizeInsert(n.options,n),r.ends[v][v].siblingCreated&&r.ends[v][v].siblingCreated(n.options,q),r.ends[q][q].siblingCreated&&r.ends[q][q].siblingCreated(n.options,v),n.parent.bubble("reflow")),this},t.renderLatexMath=function(t){var e,n,s,i,r,a,o;t&&t.replace&&(t=t.replace(F,"\\")),e=this.root,n=this.cursor,n.options,s=e.jQ,i=B.all,r=B.eof,a=N.skip(r).or(i.result(!1)).parse(t),e.eachChild("postOrder","dispose"),e.ends[q]=e.ends[v]=0,a&&a.prepareInsertionAt(n)?(a.children().adopt(e,0,0),o=a.join("html"),s.html(o),e.jQize(s.children()),e.finalizeInsert(n.options)):s.empty(),delete n.selection,n.insAtRightEnd(e)},t.renderLatexText=function(t){var e,n,s,i,r,a,o,l,c,u,h=this.root,p=this.cursor;if(h.jQ.children().slice(1).remove(),h.eachChild("postOrder","dispose"),h.ends[q]=h.ends[v]=0,delete p.selection,p.show().insAtRightEnd(h),e=B.regex,n=B.string,s=B.eof,i=B.all,r=n("$").then(N).skip(n("$").or(s)).map(function(t){var e,n=Z(p);return n.createBlocks(),e=n.ends[q],t.children().adopt(e,0,0),n}),a=n("\\$").result("$"),o=a.or(e(/^[^$]/)).map(H),l=r.or(o).many(),c=l.skip(s).or(i.result(!1)).parse(t)){for(u=0;u<c.length;u+=1)c[u].adopt(h,h.ends[v],0);h.jQize().appendTo(h.jQ),h.finalizeInsert(p.options)}}}),C.open(function(t){t.focusBlurEvents=function(){function t(){clearTimeout(n),r.selection&&r.selection.jQ.addClass("mq-blur"),e()}function e(){r.hide().parent.blur(),s.container.removeClass("mq-focused"),x(window).unbind("blur",t)}var n,s=this,i=s.root,r=s.cursor;s.textarea.focus(function(){s.blurred=!1,clearTimeout(n),s.container.addClass("mq-focused"),r.parent||r.insAtRightEnd(i),r.selection?(r.selection.jQ.removeClass("mq-blur"),s.selectionChanged()):r.show()}).blur(function(){s.blurred=!0,n=setTimeout(function(){i.postOrder("intentionalBlur"),r.clearSelection().endSelection(),e()}),x(window).bind("blur",t)}),s.blurred=!0,r.hide().parent.blur()}}),C.open(function(t,e){t.exportText=function(){return this.root.foldChildren("",function(t,e){return t+e.text()})}}),C.open(function(t){t.keystroke=function(t,e){this.cursor.parent.keystroke(t,e,this)}}),y.open(function(t){t.keystroke=function(t,e,n){var s=n.cursor;switch(t){case"Ctrl-Shift-Backspace":case"Ctrl-Backspace":n.ctrlDeleteDir(q);break;case"Shift-Backspace":case"Backspace":n.backspace();break;case"Esc":case"Tab":return void n.escapeDir(v,t,e);case"Shift-Tab":case"Shift-Esc":return void n.escapeDir(q,t,e);case"End":n.notify("move").cursor.insAtRightEnd(s.parent);break;case"Ctrl-End":n.notify("move").cursor.insAtRightEnd(n.root);break;case"Shift-End":for(;s[v];)n.selectRight();break;case"Ctrl-Shift-End":for(;s[v]||s.parent!==n.root;)n.selectRight();break;case"Home":n.notify("move").cursor.insAtLeftEnd(s.parent);break;case"Ctrl-Home":n.notify("move").cursor.insAtLeftEnd(n.root);break;case"Shift-Home":for(;s[q];)n.selectLeft();break;case"Ctrl-Shift-Home":for(;s[q]||s.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(s[q])for(;s[q];)n.selectLeft();else n.selectLeft();case"Shift-Down":if(s[v])for(;s[v];)n.selectRight();else n.selectRight();case"Ctrl-Up":case"Ctrl-Down":break;case"Ctrl-Shift-Del":case"Ctrl-Del":n.ctrlDeleteDir(v);break;case"Shift-Del":case"Del":n.deleteForward();break;case"Meta-A":case"Ctrl-A":for(n.notify("move").cursor.insAtRightEnd(n.root);s[q];)n.selectLeft();break;default:return}e.preventDefault(),n.scrollHoriz()},t.moveOutOf=t.moveTowards=t.deleteOutOf=t.deleteTowards=t.unselectInto=t.selectOutOf=t.selectTowards=function(){i("overridden or never called on this node")}}),C.open(function(t){function e(t,e){var n=t.notify("upDown").cursor,s=e+"Into",i=e+"OutOf";return n[v][s]?n.insAtLeftEnd(n[v][s]):n[q][s]?n.insAtRightEnd(n[q][s]):n.parent.bubble(function(t){var e=t[i];if(e&&("function"==typeof e&&(e=t[i](n)),e instanceof y&&n.jumpUpDown(t,e),!0!==e))return!1}),t}this.onNotify(function(t){"move"!==t&&"upDown"!==t||this.show().clearSelection()}),t.escapeDir=function(t,e,n){r(t);var s=this.cursor;if(s.parent!==this.root&&n.preventDefault(),s.parent!==this.root)return s.parent.moveOutOf(t,s),this.notify("move")},E.leftRightIntoCmdGoes=function(t){if(t&&"up"!==t&&"down"!==t)throw'"up" or "down" required for leftRightIntoCmdGoes option, got "'+t+'"';return t},t.moveDir=function(t){r(t);var e=this.cursor,n=e.options.leftRightIntoCmdGoes;return e.selection?e.insDirOf(t,e.selection.ends[t]):e[t]?e[t].moveTowards(t,e,n):e.parent.moveOutOf(t,e,n),this.notify("move")},t.moveLeft=function(){return this.moveDir(q)},t.moveRight=function(){return this.moveDir(v)},t.moveUp=function(){return e(this,"up")},t.moveDown=function(){return e(this,"down")},this.onNotify(function(t){"upDown"!==t&&(this.upDownCache={})}),this.onNotify(function(t){"edit"===t&&this.show().deleteSelection()}),t.deleteDir=function(t){var e,n;return r(t),e=this.cursor,n=e.selection,this.notify("edit"),n||(e[t]?e[t].deleteTowards(t,e):e.parent.deleteOutOf(t,e)),e[q].siblingDeleted&&e[q].siblingDeleted(e.options,v),e[v].siblingDeleted&&e[v].siblingDeleted(e.options,q),e.parent.bubble("reflow"),this},t.ctrlDeleteDir=function(t){r(t);var e=this.cursor;return!e[t]||e.selection?this.deleteDir(t):(this.notify("edit"),t===q?O(e.parent.ends[q],e[q]).remove():O(e[v],e.parent.ends[v]).remove(),e.insAtDirEnd(t,e.parent),e[q].siblingDeleted&&e[q].siblingDeleted(e.options,v),e[v].siblingDeleted&&e[v].siblingDeleted(e.options,q),e.parent.bubble("reflow"),this)},t.backspace=function(){return this.deleteDir(q)},t.deleteForward=function(){return this.deleteDir(v)},this.onNotify(function(t){"select"!==t&&this.endSelection()}),t.selectDir=function(t){var e,n=this.notify("select").cursor,s=n.selection;r(t),n.anticursor||n.startSelection(),e=n[t],e?s&&s.ends[t]===e&&n.anticursor[-t]!==e?e.unselectInto(t,n):e.selectTowards(t,n):n.parent.selectOutOf(t,n),n.clearSelection(),n.select()||n.show()},t.selectLeft=function(){return this.selectDir(q)},t.selectRight=function(){return this.selectDir(v)}}),C.open(function(t){_.p.substituteTextarea=function(){return x("<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />")[0]},t.createTextarea=function(){var t,e=this.textareaSpan=x('<span class="mq-textarea"></span>'),n=this.options.substituteTextarea();if(!n.nodeType)throw"substituteTextarea() must return a DOM element, got "+n;n=this.textarea=x(n).appendTo(e),t=this,t.cursor.selectionChanged=function(){t.selectionChanged()}},t.selectionChanged=function(){var t=this;tt(t.container[0]),void 0===t.textareaSelectionTimeout&&(t.textareaSelectionTimeout=setTimeout(function(){t.setTextareaSelection()}))},t.setTextareaSelection=function(){this.textareaSelectionTimeout=void 0;var t="";this.cursor.selection&&(t=this.cursor.selection.join("latex"),this.options.statelessClipboard&&(t="$"+t+"$")),this.selectFn(t)},t.staticMathTextareaEvents=function(){function t(){i.detach(),e.blurred=!0}var e=this,n=(e.root,e.cursor),s=e.textarea,i=e.textareaSpan;this.container.prepend(Ht('<span class="mq-selectable">').text("$"+e.exportLatex()+"$")),e.blurred=!0,s.bind("cut paste",!1).bind("copy",function(){e.setTextareaSelection()}).focus(function(){e.blurred=!1}).blur(function(){n.selection&&n.selection.clear(),setTimeout(t)}),e.selectFn=function(t){s.val(t),t&&s.select()}},_.p.substituteKeyboardEvents=M,t.editablesTextareaEvents=function(){var t=this,e=t.textarea,n=t.textareaSpan,s=this.options.substituteKeyboardEvents(e,this);this.selectFn=function(t){s.select(t)},this.container.prepend(n),this.focusBlurEvents()},t.typedText=function(t){if("\n"===t)return this.handle("enter");var e=this.notify().cursor;e.parent.write(e,t),this.scrollHoriz()},t.cut=function(){var t=this,e=t.cursor;e.selection&&setTimeout(function(){t.notify("edit"),e.parent.bubble("reflow")})},t.copy=function(){this.setTextareaSelection()},t.paste=function(t){this.options.statelessClipboard&&(t="$"===t.slice(0,1)&&"$"===t.slice(-1)?t.slice(1,-1):"\\text{"+t+"}"),this.writeLatex(t).cursor.show()}}),C.open(function(e){_.p.ignoreNextMousedown=t,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind("mousedown.mathquill",function(n){function s(t){c.anticursor||c.startSelection(),l.seek(x(t.target),t.pageX,t.pageY).cursor.select(),t.target&&x(t.target.ownerDocument).unbind("mousemove",i)}function i(t){return delete t.target,s(t)}function r(t){c.selection||l.editable||u.detach(),a.unbind("mousemove",s),x(t.target.ownerDocument).unbind("mousemove",i).unbind("mouseup",r)}var a=x(n.target).closest(".mq-root-block"),o=y.byId[a.attr(Wt)||e.attr(Wt)],l=o.controller,c=l.cursor,u=(c.blink,l.textareaSpan),h=l.textarea;if(n.preventDefault(),n.target.unselectable=!0,!c.options.ignoreNextMousedown(n)){if(c.options.ignoreNextMousedown=t,0===u.parent().length)return!1;l.blurred&&(l.editable||a.prepend(u),document.body.focus(),h.focus()),n.preventDefault(),n.target.unselectable=!0,c.show(),l.seek(x(n.target),n.pageX,n.pageY).cursor.startSelection(),a.mousemove(s),x(n.target.ownerDocument).mousemove(i).mouseup(r)}})}}),C.open(function(t){t.seek=function(t,e,n){var s,r,a,o=this.notify("select").cursor;return t&&((s=t.attr(Wt)||t.attr(Ut))||(r=t.parent(),s=r.attr(Wt)||r.attr(Ut))),a=s?y.byId[s]:this.root,i("nodeId is the id of some Node that exists",a),o.clearSelection().show(),a.seek(e,o),this.scrollHoriz(),this}}),C.open(function(t){t.scrollHoriz=function(){var t,e,n,s,i,r=this.cursor,a=r.selection,o=this.root.jQ[0].getBoundingClientRect();if(a)if(n=a.jQ[0].getBoundingClientRect(),s=n.left-(o.left+20),i=n.right-(o.right-20),a.ends[q]===r[v])if(s<0)e=s;else{if(!(i>0))return;e=n.left-i<o.left+20?s:i}else if(i>0)e=i;else{if(!(s<0))return;e=n.right-s>o.right-20?i:s}else if((t=r.jQ[0].getBoundingClientRect().left)>o.right-20)e=t-(o.right-20);else{if(!(t<o.left+20))return;e=t-(o.left+20)}this.root.jQ.stop().animate({scrollLeft:"+="+e},100)}}),$=b(y,function(t,e){t.finalizeInsert=function(t,e){var n=this;n.postOrder("finalizeTree",t),n.postOrder("contactWeld",e),n.postOrder("blur"),n.postOrder("reflow"),n[v].siblingCreated&&n[v].siblingCreated(t,q),n[q].siblingCreated&&n[q].siblingCreated(t,v),n.bubble("reflow")},t.prepareInsertionAt=function(t){var e,n=t.options.maxDepth;if(void 0!==n){if((e=t.depth())>n)return!1;this.removeNodesDeeperThan(n-e)}return!0},t.removeNodesDeeperThan=function(t){for(var e,n=0,s=[[this,n]];s.length;)e=s.shift(),e[0].children().each(function(i){var r=i instanceof W?1:0;n=e[1]+r,
11
+ n<=t?s.push([i,n]):(r?i.children():i).remove()})}}),P=b($,function(t,e){t.init=function(t,n,s){var i=this;e.init.call(i),i.ctrlSeq||(i.ctrlSeq=t),n&&(i.htmlTemplate=n),s&&(i.textTemplate=s)},t.replaces=function(t){t.disown(),this.replacedFragment=t},t.isEmpty=function(){return this.foldChildren(!0,function(t,e){return t&&e.isEmpty()})},t.parser=function(){var t=N.block,e=this;return t.times(e.numBlocks()).map(function(t){e.blocks=t;for(var n=0;n<t.length;n+=1)t[n].adopt(e,e.ends[v],0);return e})},t.createLeftOf=function(t){var n=this,s=n.replacedFragment;n.createBlocks(),e.createLeftOf.call(n,t),s&&(s.adopt(n.ends[q],0,0),s.jQ.appendTo(n.ends[q].jQ),n.placeCursor(t),n.prepareInsertionAt(t)),n.finalizeInsert(t.options),n.placeCursor(t)},t.createBlocks=function(){var t,e,n=this,s=n.numBlocks(),i=n.blocks=Array(s);for(t=0;t<s;t+=1)e=i[t]=W(),e.adopt(n,n.ends[v],0)},t.placeCursor=function(t){t.insAtRightEnd(this.foldChildren(this.ends[q],function(t,e){return t.isEmpty()?t:e}))},t.moveTowards=function(t,e,n){var s=n&&this[n+"Into"];e.insAtDirEnd(-t,s||this.ends[-t])},t.deleteTowards=function(t,e){this.isEmpty()?e[t]=this.remove()[t]:this.moveTowards(t,e,null)},t.selectTowards=function(t,e){e[-t]=this,e[t]=this[t]},t.selectChildren=function(){return S(this,this)},t.unselectInto=function(t,e){e.insAtDirEnd(-t,e.anticursor.ancestors[this.id])},t.seek=function(t,e){function n(t){var e={};return e[q]=t.jQ.offset().left,e[v]=e[q]+t.jQ.outerWidth(),e}var s,i=this,r=n(i);return t<r[q]?e.insLeftOf(i):t>r[v]?e.insRightOf(i):(s=r[q],void i.eachChild(function(a){var o=n(a);return t<o[q]?(t-s<o[q]-t?a[q]?e.insAtRightEnd(a[q]):e.insLeftOf(i):e.insAtLeftEnd(a),!1):t>o[v]?void(a[v]?s=o[v]:r[v]-t<t-o[v]?e.insRightOf(i):e.insAtRightEnd(a)):(a.seek(t,e),!1)}))},t.numBlocks=function(){var t=this.htmlTemplate.match(/&\d+/g);return t?t.length:0},t.html=function(){var t,e,n,s=this,r=s.blocks,a=" mathquill-command-id="+s.id,o=s.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);for(i("no unmatched angle brackets",o.join("")===this.htmlTemplate),t=0,e=o[0];e;t+=1,e=o[t])if("/>"===e.slice(-2))o[t]=e.slice(0,-2)+a+"/>";else if("<"===e.charAt(0)){i("not an unmatched top-level close tag","/"!==e.charAt(1)),o[t]=e.slice(0,-1)+a+">",n=1;do{t+=1,e=o[t],i("no missing close tags",e),"</"===e.slice(0,2)?n-=1:"<"===e.charAt(0)&&"/>"!==e.slice(-2)&&(n+=1)}while(n>0)}return o.join("").replace(/>&(\d+)/g,function(t,e){return" mathquill-block-id="+r[e].id+">"+r[e].join("html")})},t.latex=function(){return this.foldChildren(this.ctrlSeq,function(t,e){return t+"{"+(e.latex()||" ")+"}"})},t.textTemplate=[""],t.text=function(){var t=this,e=0;return t.foldChildren(t.textTemplate[e],function(n,s){e+=1;var i=s.text();return n&&"("===t.textTemplate[e]&&"("===i[0]&&")"===i.slice(-1)?n+i.slice(1,-1)+t.textTemplate[e]:n+i+(t.textTemplate[e]||"")})}}),V=b(P,function(e,n){e.init=function(t,e,s){s||(s=t&&t.length>1?t.slice(1):t),n.init.call(this,t,e,[s])},e.parser=function(){return B.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(t){t.remove()},e.createBlocks=t,e.moveTowards=function(t,e){e.jQ.insDirOf(t,this.jQ),e[-t]=this,e[t]=this[t]},e.deleteTowards=function(t,e){e[t]=this.remove()[t]},e.seek=function(t,e){t-this.jQ.offset().left<this.jQ.outerWidth()/2?e.insLeftOf(this):e.insRightOf(this)},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=t,e.isEmpty=function(){return!0}}),H=b(V,function(t,e){t.init=function(t,n){e.init.call(this,t,"<span>"+(n||t)+"</span>")}}),U=b(V,function(t,e){t.init=function(t,n,s){e.init.call(this,t,'<span class="mq-binary-operator">'+n+"</span>",s)}}),W=b($,function(t,e){t.join=function(t){return this.foldChildren("",function(e,n){return e+n[t]()})},t.html=function(){return this.join("html")},t.latex=function(){return this.join("latex")},t.text=function(){return this.ends[q]===this.ends[v]&&0!==this.ends[q]?this.ends[q].text():this.join("text")},t.keystroke=function(t,n,s){return!s.options.spaceBehavesLikeTab||"Spacebar"!==t&&"Shift-Spacebar"!==t?e.keystroke.apply(this,arguments):(n.preventDefault(),void s.escapeDir("Shift-Spacebar"===t?q:v,t,n))},t.moveOutOf=function(t,e,n){n&&this.parent[n+"Into"]||!this[t]?e.insDirOf(t,this.parent):e.insAtDirEnd(-t,this[t])},t.selectOutOf=function(t,e){e.insDirOf(t,this.parent)},t.deleteOutOf=function(t,e){e.unwrapGramp()},t.seek=function(t,e){var n=this.ends[v];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<t)return e.insAtRightEnd(this);if(t<this.ends[q].jQ.offset().left)return e.insAtLeftEnd(this);for(;t<n.jQ.offset().left;)n=n[q];return n.seek(t,e)},t.chToCmd=function(t,e){var n;return t.match(/^[a-eg-zA-Z]$/)?Dt(t):/^\d$/.test(t)?St(t):e&&e.typingSlashWritesDivisionSymbol&&"/"===t?k["÷"](t):e&&e.typingAsteriskWritesTimesSymbol&&"*"===t?k["×"](t):(n=T[t]||k[t])?n(t):H(t)},t.write=function(t,e){var n;if(t.tooDeep())return!1;n=this.chToCmd(e,t.options),t.selection&&n.replaces(t.replaceSelection()),t.isTooDeep()||n.createLeftOf(t.show())},t.focus=function(){return this.jQ.addClass("mq-hasCursor"),this.jQ.removeClass("mq-empty"),this},t.blur=function(){return this.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.jQ.addClass("mq-empty"),this}}),_.p.mouseEvents=!0,D.StaticMath=function(t){return b(t.AbstractMathQuill,function(e,n){this.RootBlock=W,e.__mathquillify=function(t,e){return this.config(t),n.__mathquillify.call(this,"mq-math-mode"),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},e.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder("registerInnerField",this.innerFields=[],t.MathField)},e.latex=function(){var e=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder("registerInnerField",this.innerFields=[],t.MathField),e}})},G=b(W,u),D.MathField=function(e){return b(e.EditableField,function(e,n){this.RootBlock=G,e.__mathquillify=function(e,s){return this.config(e),s>1&&(this.__controller.root.reflow=t),n.__mathquillify.call(this,"mq-editable-field mq-math-mode"),delete this.__controller.root.reflow,this}})},K=b(y,function(t,e){function n(t){var e,n;return t.jQ[0].normalize(),e=t.jQ.contents().filter(function(t,e){return 3===e.nodeType})[0],e||(e={data:""}),i("only node in TextBlock span is Text node",3===e.nodeType),n=Y(e.data),n.jQadd(e),t.children().disown(),n.adopt(t,0,0)}t.ctrlSeq="\\text",t.replaces=function(t){t instanceof O?this.replacedText=t.remove().jQ.text():"string"==typeof t&&(this.replacedText=t)},t.jQadd=function(t){e.jQadd.call(this,t),this.ends[q]&&this.ends[q].jQadd(this.jQ[0].firstChild)},t.createLeftOf=function(t){var n,s=this;if(e.createLeftOf.call(this,t),s[v].siblingCreated&&s[v].siblingCreated(t.options,q),s[q].siblingCreated&&s[q].siblingCreated(t.options,v),s.bubble("reflow"),t.insAtRightEnd(s),s.replacedText)for(n=0;n<s.replacedText.length;n+=1)s.write(t,s.replacedText.charAt(n))},t.parser=function(){var t=this,e=B.string,n=B.regex;return B.optWhitespace.then(e("{")).then(n(/^[^}]*/)).skip(e("}")).map(function(e){return 0===e.length?O():(Y(e).adopt(t,0,0),t)})},t.textContents=function(){return this.foldChildren("",function(t,e){return t+e.text})},t.text=function(){return'"'+this.textContents()+'"'},t.latex=function(){var t=this.textContents();return 0===t.length?"":"\\text{"+t.replace(/\\/g,"\\backslash ").replace(/[{}]/g,"\\$&")+"}"},t.html=function(){return'<span class="mq-text-mode" mathquill-command-id='+this.id+">"+this.textContents()+"</span>"},t.moveTowards=function(t,e){e.insAtDirEnd(-t,this)},t.moveOutOf=function(t,e){e.insDirOf(t,this)},t.unselectInto=t.moveTowards,t.selectTowards=P.prototype.selectTowards,t.deleteTowards=P.prototype.deleteTowards,t.selectOutOf=function(t,e){e.insDirOf(t,this)},t.deleteOutOf=function(t,e){this.isEmpty()&&e.insRightOf(this)},t.write=function(t,n){var s,i;t.show().deleteSelection(),"$"!==n?t[q]?(t[q].appendText(n),this.bubble("reflow")):Y(n).createLeftOf(t):this.isEmpty()?(t.insRightOf(this),H("\\$","$").createLeftOf(t)):t[v]?t[q]?(s=K(),i=this.ends[q],i.disown().jQ.detach(),i.adopt(s,0,0),t.insLeftOf(this),e.createLeftOf.call(s,t)):t.insLeftOf(this):t.insRightOf(this)},t.seek=function(t,e){var s,i,r,a,o,l,c,u;for(e.hide(),s=n(this),i=this.jQ.width()/this.text.length,r=Math.round((t-this.jQ.offset().left)/i),r<=0?e.insAtLeftEnd(this):r>=s.text.length?e.insAtRightEnd(this):e.insLeftOf(s.splitRight(r)),a=t-e.show().offset().left,o=a&&a<0?q:v,l=o;e[o]&&a*l>0;)e[o].moveTowards(o,e),l=a,a=t-e.offset().left;o*a<-o*l&&e[-o].moveTowards(-o,e),e.anticursor?e.anticursor.parent===this&&(c=e[q]&&e[q].text.length,this.anticursorPosition===c?e.anticursor=w.copy(e):(this.anticursorPosition<c?(u=e[q].splitRight(this.anticursorPosition),e[q]=u):u=e[v].splitRight(this.anticursorPosition-c),e.anticursor=w(this,u[q],u))):this.anticursorPosition=e[q]&&e[q].text.length},t.blur=function(t){W.prototype.blur.call(this),t&&(""===this.textContents()?(this.remove(),t[q]===this?t[q]=this[q]:t[v]===this&&(t[v]=this[v])):n(this))},t.focus=W.prototype.focus}),Y=b(y,function(t,e){function n(t,e){return e.charAt(t===q?0:-1+e.length)}t.init=function(t){e.init.call(this),this.text=t},t.jQadd=function(t){this.dom=t,this.jQ=x(t)},t.jQize=function(){return this.jQadd(document.createTextNode(this.text))},t.appendText=function(t){this.text+=t,this.dom.appendData(t)},t.prependText=function(t){this.text=t+this.text,this.dom.insertData(0,t)},t.insTextAtDirEnd=function(t,e){r(e),e===v?this.appendText(t):this.prependText(t)},t.splitRight=function(t){var e=Y(this.text.slice(t)).adopt(this.parent,this,this[v]);return e.jQadd(this.dom.splitText(t)),this.text=this.text.slice(0,t),e},t.moveTowards=function(t,e){var s,i;return r(t),s=n(-t,this.text),i=this[-t],i?i.insTextAtDirEnd(s,t):Y(s).createDir(-t,e),this.deleteTowards(t,e)},t.latex=function(){return this.text},t.deleteTowards=function(t,e){this.text.length>1?t===v?(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(),e[t]=this[t])},t.selectTowards=function(t,e){var s,i,a,o;return r(t),s=e.anticursor,i=n(-t,this.text),s[t]===this?(a=Y(i).createDir(t,e),s[t]=a,e.insDirOf(t,a)):(o=this[-t],o?o.insTextAtDirEnd(i,t):(a=Y(i).createDir(-t,e),a.jQ.insDirOf(-t,e.selection.jQ)),1===this.text.length&&s[-t]===this&&(s[-t]=this[-t])),this.deleteTowards(t,e)}}),k.text=k.textnormal=k.textrm=k.textup=k.textmd=K,k.em=k.italic=k.italics=k.emph=k.textit=k.textsl=h("\\textit","i",'class="mq-text-mode"'),k.strong=k.bold=k.textbf=h("\\textbf","b",'class="mq-text-mode"'),k.sf=k.textsf=h("\\textsf","span",'class="mq-sans-serif mq-text-mode"'),k.tt=k.texttt=h("\\texttt","span",'class="mq-monospace mq-text-mode"'),k.textsc=h("\\textsc","span",'style="font-variant:small-caps" class="mq-text-mode"'),k.uppercase=h("\\uppercase","span",'style="text-transform:uppercase" class="mq-text-mode"'),k.lowercase=h("\\lowercase","span",'style="text-transform:lowercase" class="mq-text-mode"'),Z=b(P,function(t,e){t.init=function(t){e.init.call(this,"$"),this.cursor=t},t.htmlTemplate='<span class="mq-math-mode">&0</span>',t.createBlocks=function(){e.createBlocks.call(this),this.ends[q].cursor=this.cursor,this.ends[q].write=function(t,e){"$"!==e?W.prototype.write.call(this,t,e):this.isEmpty()?(t.insRightOf(this.parent),this.parent.deleteTowards(dir,t),H("\\$","$").createLeftOf(t.show())):t[v]?t[q]?W.prototype.write.call(this,t,e):t.insLeftOf(this.parent):t.insRightOf(this.parent)}},t.latex=function(){return"$"+this.ends[q].latex()+"$"}}),X=b(G,function(t,e){t.keystroke=function(t){if("Spacebar"!==t&&"Shift-Spacebar"!==t)return e.keystroke.apply(this,arguments)},t.write=function(t,e){if(t.show().deleteSelection(),"$"===e)Z(t).createLeftOf(t);else{var n;"<"===e?n="&lt;":">"===e&&(n="&gt;"),H(e,n).createLeftOf(t)}}}),D.TextField=function(t){return b(t.EditableField,function(t,e){this.RootBlock=X,t.__mathquillify=function(){return e.__mathquillify.call(this,"mq-editable-field mq-text-mode")},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexText(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})},T["\\"]=b(P,function(t,e){t.ctrlSeq="\\",t.replaces=function(t){this._replacedFragment=t.disown(),this.isEmpty=function(){return!1}},t.htmlTemplate='<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>',t.textTemplate=["\\"],t.createBlocks=function(){e.createBlocks.call(this),this.ends[q].focus=function(){return this.parent.jQ.addClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.removeClass("mq-empty"),this},this.ends[q].blur=function(){return this.parent.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.addClass("mq-empty"),this},this.ends[q].write=function(t,e){t.show().deleteSelection(),e.match(/[a-z]/i)?H(e).createLeftOf(t):(this.parent.renderCommand(t),"\\"===e&&this.isEmpty()||t.parent.write(t,e))},this.ends[q].keystroke=function(t,n,s){return"Tab"===t||"Enter"===t||"Spacebar"===t?(this.parent.renderCommand(s.cursor),void n.preventDefault()):e.keystroke.apply(this,arguments)}},t.createLeftOf=function(t){if(e.createLeftOf.call(this,t),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass("mq-blur").bind("mousedown mousemove",function(t){return x(t.target=n).trigger(t),!1}).insertBefore(this.jQ).add(this.jQ)}},t.latex=function(){return"\\"+this.ends[q].latex()+" "},t.renderCommand=function(t){var e,n;this.jQ=this.jQ.last(),this.remove(),this[v]?t.insLeftOf(this[v]):t.insAtRightEnd(this.parent),e=this.ends[q].latex(),e||(e=" "),n=k[e],n?(n=n(e),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(t)):(n=K(),n.replaces(e),n.createLeftOf(t),t.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),tt=t,et=document.createElement("div"),nt=et.style,st={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1};for(rt in st)if(rt in nt){it=rt;break}it?J=function(t,e,n){t.css(it,"scale("+e+","+n+")")}:"filter"in nt?(tt=function(t){t.className=t.className},J=function(t,e,n){function s(){t.css("marginRight",(i.width()-1)*(e-1)/e+"px")}var i,r;e/=1+(n-1)/2,t.css("fontSize",n+"em"),t.hasClass("mq-matrixed-container")||t.addClass("mq-matrixed-container").wrapInner('<span class="mq-matrixed"></span>'),i=t.children().css("filter","progid:DXImageTransform.Microsoft.Matrix(M11="+e+",SizingMethod='auto expand')"),s(),r=setInterval(s),x(window).load(function(){clearTimeout(r),s()})}):J=function(t,e,n){t.css("fontSize",n+"em")},at=b(P,function(t,e){t.init=function(t,n,s){e.init.call(this,t,"<"+n+" "+s+">&0</"+n+">")}}),ot=b(P,function(t,e){t.init=function(t,n,s){this.args=arguments,this.htmlTemplate="<"+n+" "+s+"><"+n+' class="mq-xarrow-over">&0</'+n+"><"+n+' class="mq-xarrow-under"></'+n+"></"+n+">",e.init.call(this,t),this.textTemplate=[t.replace("\\","")+"(",")"]},t.parser=function(){var t=this;return N.optBlock.then(function(e){return N.block.map(function(n){var s=lt.apply(null,t.args);return s.blocks=[e,n],e.adopt(s,0,0),n.adopt(s,e,0),s})}).or(e.parser.call(this))}}),lt=b(ot,function(t,e){t.init=function(t,e,n){this.htmlTemplate="<"+e+" "+n+"><"+e+' class="mq-xarrow-over">&1</'+e+"><"+e+' class="mq-xarrow-under">&0</'+e+"></"+e+">",P.prototype.init.call(this,t),this.textTemplate=[t.replace("\\","")+"[","](",")"]},t.latex=function(){return this.ctrlSeq+"["+this.ends[q].latex()+"]{"+this.ends[v].latex()+"}"},t.finalizeTree=function(){this.downInto=this.ends[q].upOutOf=this.ends[v],this.upInto=this.ends[v].downOutOf=this.ends[q]}}),ct=function(t){var e='<span class="'+t+'-inner-right">g</span><span class="'+t+'-inner-left">h</span>';return b(P,function(n,s){n.init=function(n,i,r){s.init.call(this,n,"<"+i+" "+r+"><"+i+' class="'+t+'-inner">'+e+'<span class="mq-empty-box">&0</span></'+i+"></"+i+">")}})},ut=b(P,function(t,e){t.init=function(t,n,s){e.init.call(this,t,"<"+n+" "+s+'><span class="mq-longdiv-curve-border">)</span><span class="mq-longdiv-inner"><span class="mq-empty">&0</span></'+n+"></span>")}}),ht=b(P,function(t,e){t.init=function(t,n,s){e.init.call(this,t,'<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-row"><p>'+s+'</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>')}}),pt=b(P,function(t,e){t.init=function(t){e.init.call(this,t,'<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>')}}),ft=b(P,function(t,e){t.init=function(t,n,s){e.init.call(this,t,'<span class="mq-matrix"><span class="mq-paren mq-scaled">[</span><span class="matrix-edit-content-col"><p>'+s+'</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>')}}),dt=function(t,e){return b(V,function(n,s){n.init=function(n,i,r){s.init.call(this,n,"<"+i+" "+r+"><"+i+' class="'+t+'-inner">'+e+"</"+i+"></"+i+">")}})},k.mathrm=s(at,"\\mathrm","span",'class="mq-roman mq-font"'),k.mathit=s(at,"\\mathit","i",'class="mq-font"'),k.mathbf=s(at,"\\mathbf","b",'class="mq-font"'),k.mathsf=s(at,"\\mathsf","span",'class="mq-sans-serif mq-font"'),k.mathtt=s(at,"\\mathtt","span",'class="mq-monospace mq-font"'),k.underline=s(at,"\\underline","span",'class="mq-non-leaf mq-underline"'),k.overline=k.bar=s(ct("mq-overline"),"\\overline","span",'class="mq-non-leaf mq-overline"'),k.longdiv=s(ut,"\\longdiv","span",'class="mq-non-leaf mq-longdiv"'),k.overrightarrow=s(ct("mq-overarrow"),"\\overrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-right"'),k.overleftarrow=s(ct("mq-overarrow"),"\\overleftarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-left"'),k.xleftarrow=s(ot,"\\xleftarrow","span",'class="mq-non-leaf mq-xarrow mq-arrow-left"'),k.xrightarrow=s(ot,"\\xrightarrow","span",'class="mq-non-leaf mq-xarrow mq-arrow-right"'),k.overleftrightarrow=s(at,"\\overleftrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-both"'),k.overarc=s(at,"\\overarc","span",'class="mq-non-leaf mq-overarc"'),k.dot=b(P,function(t,e){t.init=function(){e.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>')}}),k.addmatrixrow=s(ht,"\\addmatrixrow","span","+"),k.addmatrixcol=s(ft,"\\addmatrixcol","span","+"),k.ngtr=k["≯"]=s(dt("mq-ngtr","&#8815;"),"\\ngtr ","span",'class="mq-non-leaf mq-ngtr"'),k.nless=k["≮"]=s(dt("mq-nless","&#8814;"),"\\nless ","span",'class="mq-non-leaf mq-nless"'),k.dot=s(pt,"\\dot"),k.parallelogram=s(dt("mq-parallelogram","&#9649;"),"\\parallelogram ","span",'class="mq-non-leaf mq-parallelogram"'),k.textcolor=b(P,function(t,e){t.setColor=function(t){this.color=t,this.htmlTemplate='<span class="mq-textcolor" style="color:'+t+'">&0</span>'},t.latex=function(){return"\\textcolor{"+this.color+"}{"+this.blocks[0].latex()+"}"},t.parser=function(){var t=this,n=B.optWhitespace,s=B.string,i=B.regex;return n.then(s("{")).then(i(/^[#\w\s.,()%-]*/)).skip(s("}")).then(function(n){return t.setColor(n),e.parser.call(t)})},t.isStyleBlock=function(){return!0}}),k.class=b(P,function(t,e){t.parser=function(){var t=this,n=B.string,s=B.regex;return B.optWhitespace.then(n("{")).then(s(/^[-\w\s\\\xA0-\xFF]*/)).skip(n("}")).then(function(n){return t.cls=n||"",t.htmlTemplate='<span class="mq-class '+n+'">&0</span>',e.parser.call(t)})},t.latex=function(){return"\\class{"+this.cls+"}{"+this.blocks[0].latex()+"}"},t.isStyleBlock=function(){return!0}}),mt=b(P,function(t,e){t.ctrlSeq="_{...}^{...}",t.createLeftOf=function(t){if(this.replacedFragment||t[q]||!t.options.supSubsRequireOperand)return e.createLeftOf.apply(this,arguments)},t.contactWeld=function(t){var e,n,s,i,r,a;for(e=q;e;e=e===q&&v)if(this[e]instanceof mt){for(n="sub";n;n="sub"===n&&"sup")s=this[n],i=this[e][n],s&&(i?s.isEmpty()?a=w(i,0,i.ends[q]):(s.jQ.children().insAtDirEnd(-e,i.jQ),r=s.children().disown(),a=w(i,r.ends[v],i.ends[q]),e===q?r.adopt(i,i.ends[v],0):r.adopt(i,0,i.ends[q])):this[e].addBlock(s.disown()),this.placeCursor=function(t,n){return function(s){s.insAtDirEnd(-e,t||n)}}(i,s));this.remove(),t&&t[q]===this&&(e===v&&a?a[q]?t.insRightOf(a[q]):t.insAtLeftEnd(a.parent):t.insRightOf(this[e]));break}},_.p.charsThatBreakOutOfSupSub="",t.finalizeTree=function(){this.ends[q].write=function(t,e){if(t.options.autoSubscriptNumerals&&this===this.parent.sub){if("_"===e)return;var n=this.chToCmd(e,t.options);return n instanceof V?t.deleteSelection():t.clearSelection().insRightOf(this.parent),n.createLeftOf(t.show())}t[q]&&!t[v]&&!t.selection&&t.options.charsThatBreakOutOfSupSub.indexOf(e)>-1&&t.insRightOf(this.parent),W.p.write.apply(this,arguments)}},t.moveTowards=function(t,n,s){n.options.autoSubscriptNumerals&&!this.sup?n.insDirOf(t,this):e.moveTowards.apply(this,arguments)},t.deleteTowards=function(t,n){if(n.options.autoSubscriptNumerals&&this.sub){var s=this.sub.ends[-t];s instanceof V?s.remove():s&&s.deleteTowards(t,n.insAtDirEnd(-t,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(q,n.insAtLeftEnd(this.sub)),this.sup&&n.insDirOf(-t,this))}else e.deleteTowards.apply(this,arguments)},t.latex=function(){function t(t,e){var n=e&&e.latex();return e?t+(1===n.length?n:"{"+(n||" ")+"}"):""}return t("_",this.sub)+t("^",this.sup)},t.addBlock=function(t){"sub"===this.supsub?(this.sup=this.upInto=this.sub.upOutOf=t,t.adopt(this,this.sub,0).downOutOf=this.sub,t.jQ=x('<span class="mq-sup"/>').append(t.jQ.children()).attr(Wt,t.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=t,t.adopt(this,0,this.sup).upOutOf=this.sup,t.jQ=x('<span class="mq-sub"></span>').append(t.jQ.children()).attr(Wt,t.id).appendTo(this.jQ.removeClass("mq-sup-only")),this.jQ.append('<span style="display:inline-block;width:0">&#8203;</span>'));for(var e=0;e<2;e+=1)!function(t,e,n,s){t[e].deleteOutOf=function(i,r){if(r.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var a=this.ends[i];this.children().disown().withDirAdopt(i,r.parent,r[i],r[-i]).jQ.insDirOf(-i,r.jQ),r[-i]=a}t.supsub=n,delete t[e],delete t[s+"Into"],t[n][s+"OutOf"]=p,delete t[n].deleteOutOf,"sub"===e&&x(t.jQ.addClass("mq-sup-only")[0].lastChild).remove(),this.remove()}}(this,"sub sup".split(" ")[e],"sup sub".split(" ")[e],"down up".split(" ")[e])},t.reflow=function(){var t,e,n,s,i,r=this.jQ,a=r.prev();a.length&&(t=r.children(".mq-sup"),t.length&&(e=parseInt(t.css("font-size")),n=t.offset().top+t.height(),s=n-a.offset().top-.7*e,i=parseInt(t.css("margin-bottom")),t.css("margin-bottom",i+s)))}}),k.subscript=k._=b(mt,function(t,e){t.supsub="sub",t.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>',t.textTemplate=["_"],t.finalizeTree=function(){this.downInto=this.sub=this.ends[q],this.sub.upOutOf=p,e.finalizeTree.call(this)}}),k.superscript=k.supscript=k["^"]=b(mt,function(t,e){t.supsub="sup",t.htmlTemplate='<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup"><span class="mq-empty-box">&0</span></span></span>',t.textTemplate=["^"],t.finalizeTree=function(){this.upInto=this.sup=this.ends[v],this.sup.downOutOf=p,e.finalizeTree.call(this)}}),gt=b(P,function(t,e){t.parser=function(){var t,e=B.string,n=B.optWhitespace,s=B.succeed,i=N.block,r=this,a=r.blocks=[W(),W()];for(t=0;t<a.length;t+=1)a[t].adopt(r,r.ends[v],0);return n.then(e("_").or(e("^"))).then(function(t){var e=a["_"===t?0:1];return i.then(function(t){return t.children().adopt(e,e.ends[v],0),s(r)})}).many().result(r)},t.finalizeTree=function(){this.downInto=this.ends[q],this.upInto=this.ends[v],this.ends[q].upOutOf=this.ends[v],this.ends[v].downOutOf=this.ends[q]}}),bt=b(gt,function(t,e){t.init=function(t,e){var n='<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>'+e+'</big><span class="mq-from"><span>&0</span></span></span>';V.prototype.init.call(this,t,n)},t.latex=function(){function t(t){return 1===t.length?t:"{"+(t||" ")+"}"}return this.ctrlSeq+"_"+t(this.ends[q].latex())+"^"+t(this.ends[v].latex())},t.createLeftOf=function(t){e.createLeftOf.apply(this,arguments),t.options.sumStartsWithNEquals&&(Dt("n").createLeftOf(t),$t().createLeftOf(t))}}),k["∑"]=k.sum=k.summation=s(bt,"\\sum ","&sum;"),k["∏"]=k.prod=k.product=s(bt,"\\prod ","&prod;"),k.coprod=k.coproduct=s(bt,"\\coprod ","&#8720;"),k["∫"]=k.int=k.integral=b(bt,function(t,e){t.init=function(){V.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>')},t.createLeftOf=P.p.createLeftOf}),k.lim=k.limit=b(gt,function(t,e){t.init=function(){V.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>')},t.latex=function(){return this.ctrlSeq+"_"+function(t){return 1===t.length?t:"{"+(t||" ")+"}"}(this.ends[q].latex())}}),qt=k.frac=k.dfrac=k.cfrac=k.fraction=b(P,function(t,e){t.ctrlSeq="\\frac",t.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>',t.textTemplate=["(",")/(",")"],t.finalizeTree=function(){this.upInto=this.ends[v].upOutOf=this.ends[q],this.downInto=this.ends[q].downOutOf=this.ends[v]}}),vt=k.over=T["/"]=b(qt,function(e,n){e.createLeftOf=function(e){if(!this.replacedFragment){for(var s=e[q];s&&!(s instanceof U||s instanceof(k.text||t)||s instanceof bt||"\\ "===s.ctrlSeq||/^[,;:]$/.test(s.ctrlSeq));)s=s[q];s instanceof bt&&s[v]instanceof mt&&(s=s[v],s[v]instanceof mt&&s[v].ctrlSeq!=s.ctrlSeq&&(s=s[v])),s===e[q]||e.isTooDeep(1)||(this.replaces(O(s[v]||e.parent.ends[q],e[q])),e[q]=s)}n.createLeftOf.call(this,e)}}),k.underset=b(P,function(t,e){t.ctrlSeq="\\underset",t.htmlTemplate='<span class="mq-underset mq-overunder mq-non-leaf"><span class="mq-over">&1</span><span class="mq-under">&0</span></span>',t.textTemplate=["[","|","]"],t.finalizeTree=function(){this.downInto=this.ends[q].upOutOf=this.ends[v],this.upInto=this.ends[v].downOutOf=this.ends[q]}}),k.overset=b(P,function(t,e){t.ctrlSeq="\\overset",t.htmlTemplate='<span class="mq-overset mq-overunder mq-non-leaf"><span class="mq-over">&0</span><span class="mq-under">&1</span></span>',t.textTemplate=["[","|","]"],t.finalizeTree=function(){this.downInto=this.ends[v].upOutOf=this.ends[q],this.upInto=this.ends[q].downOutOf=this.ends[v]}}),xt=k.sqrt=k["√"]=b(P,function(t,e){t.ctrlSeq="\\sqrt",t.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>',t.textTemplate=["sqrt(",")"],t.parser=function(){return N.optBlock.then(function(t){return N.block.map(function(e){var n=wt();return n.blocks=[t,e],t.adopt(n,0,0),e.adopt(n,t,0),n})}).or(e.parser.call(this))},t.reflow=function(){var t=this.ends[v].jQ.parent();J(t.prev(),1,t.innerHeight()/+t.css("fontSize").slice(0,-2)-.1)}}),k.hat=b(P,function(t,e){t.ctrlSeq="\\hat",t.htmlTemplate='<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>',t.textTemplate=["hat(",")"]}),wt=k.nthroot=b(xt,function(t,e){t.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>',t.textTemplate=["sqrt[","](",")"],t.latex=function(){return"\\sqrt["+this.ends[q].latex()+"]{"+this.ends[v].latex()+"}"}}),yt=b(P,function(t,e){t.init=function(t,n,s){var i='<span class="mq-non-leaf"><span class="mq-diacritic-above">'+n+'</span><span class="mq-diacritic-stem">&0</span></span>';e.init.call(this,t,i,s)}}),k.vec=s(yt,"\\vec","&rarr;",["vec(",")"]),k.tilde=s(yt,"\\tilde","~",["tilde(",")"]),k.lrncuberoot=b(xt,function(t,e){t.ctrlSeq="\\lrncuberoot",t.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>',t.textTemplate=["sqrt[3](",")"],t.latex=function(){return"\\sqrt[3]{"+this.ends[q].latex()+"}"}}),k.abs=b(P,function(t){t.ctrlSeq="\\abs",t.htmlTemplate='<span class="mq-abs mq-non-leaf"><span class="mq-empty-box">&0</span></span>',t.textTemplate=["|","|"]}),k.lrnplaceholder=b(P,function(t,e){t.ctrlSeq="\\lrnplaceholder",t.htmlTemplate='<span class="mq-lrnplaceholder mq-non-leaf"><span class="mq-empty-box">&0</span></span>',t.textTemplate=[""],t.latex=function(){return this.ends[q].latex()}}),k.lrnexponent=b(P,function(t,e){t.ctrSeq="\\lrnexponent",t.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>',t.textTemplate=["","**"],t.latex=function(){var t=this.ends[v].latex();return t.length>1?t="{"+t+"}":0===t.length&&(t="{ }"),this.ends[q].latex()+"^"+t}}),k.lrnsquaredexponent=b(P,function(t,e){t.ctrSeq="\\lrnsquaredexponent",t.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>',t.textTemplate=["","**2"],t.latex=function(){return this.ends[q].latex()+"^2"}}),k.lrnsubscript=b(P,function(t,e){t.ctrSeq="\\lrnsubscript",t.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>',t.textTemplate=["","_"],t.latex=function(){return this.ends[q].latex()+"_"+this.ends[v].latex()}}),Ot=b(b(P,f),function(e,n){e.init=function(t,e,s,i,r){n.init.call(this,"\\left"+i,void 0,[e,s]),this.side=t,this.sides={},this.sides[q]={ch:e,ctrlSeq:i},this.sides[v]={ch:s,ctrlSeq:r}},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate='<span class="mq-non-leaf"><span class="mq-scaled mq-paren'+(this.side===v?" mq-ghost":"")+'">'+this.sides[q].ch+'</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren'+(this.side===q?" mq-ghost":"")+'">'+this.sides[v].ch+"</span></span>",n.html.call(this)},e.latex=function(){return"\\left"+this.sides[q].ctrlSeq+this.ends[q].latex()+"\\right"+this.sides[v].ctrlSeq},e.matchBrack=function(t,e,n){return n instanceof Ot&&n.side&&n.side!==-e&&(!t.restrictMismatchedBrackets||kt[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":"]","[":")"}[this.sides[q].ch]===n.sides[v].ch)&&n},e.closeOpposing=function(t){t.side=0,t.sides[this.side]=this.sides[this.side],t.delimjQs.eq(this.side===q?0:1).removeClass("mq-ghost").html(this.sides[this.side].ch)},e.createLeftOf=function(t){var e,s,i;this.replacedFragment||(e=t.options,
12
+ s="|"===this.sides[q].ch?this.matchBrack(e,v,t[v])||this.matchBrack(e,q,t[q])||this.matchBrack(e,0,t.parent.parent):this.matchBrack(e,-this.side,t[-this.side])||this.matchBrack(e,-this.side,t.parent.parent)),s?(i=this.side=-s.side,this.closeOpposing(s),s===t.parent.parent&&t[i]&&O(t[i],t.parent.ends[i],-i).disown().withDirAdopt(-i,s.parent,s,s[i]).jQ.insDirOf(i,s.jQ),s.bubble("reflow")):(s=this,i=s.side,s.replacedFragment?s.side=0:t[-i]&&(s.replaces(O(t[-i],t.parent.ends[-i],i)),t[-i]=0),n.createLeftOf.call(s,t)),i===q?t.insAtLeftEnd(s.ends[q]):t.insRightOf(s)},e.placeCursor=t,e.unwrap=function(){this.ends[q].children().disown().adopt(this.parent,this,this[v]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(t,e,n){var s,i,r,a=this.parent,o=this[t],l=a.ends[t];if(t===this.side)return this.unwrap(),void(o?n.insDirOf(-t,o):n.insAtDirEnd(t,a));if(s=n.options,i=!this.side,this.side=-t,this.matchBrack(s,t,this.ends[q].ends[this.side]))this.closeOpposing(this.ends[q].ends[this.side]),r=this.ends[q].ends[t],this.unwrap(),r.siblingCreated&&r.siblingCreated(n.options,t),o?n.insDirOf(-t,o):n.insAtDirEnd(t,a);else{if(this.matchBrack(s,t,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else{if(e&&i)return this.unwrap(),void(o?n.insDirOf(-t,o):n.insAtDirEnd(t,a));this.sides[t]={ch:kt[this.sides[this.side].ch],ctrlSeq:kt[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass("mq-ghost").eq(t===q?0:1).addClass("mq-ghost").html(this.sides[t].ch)}o?(r=this.ends[q].ends[t],O(o,l,-t).disown().withDirAdopt(-t,this.ends[q],r,0).jQ.insAtDirEnd(t,this.ends[q].jQ.removeClass("mq-empty")),r.siblingCreated&&r.siblingCreated(n.options,t),n.insDirOf(-t,o)):e?n.insDirOf(t,this):n.insAtDirEnd(t,this.ends[q])}},e.deleteTowards=function(t,e){this.deleteSide(-t,!1,e)},e.finalizeTree=function(){this.ends[q].deleteOutOf=function(t,e){this.parent.deleteSide(t,!0,e)},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(this.side===q?1:0).removeClass("mq-ghost"),this.side=0}},e.siblingCreated=function(t,e){e===-this.side&&this.finalizeTree()}}),kt={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{","\\{":"\\}","\\}":"\\{","&lang;":"&rang;","&rang;":"&lang;","\\langle ":"\\rangle ","\\rangle ":"\\langle ","|":"|","\\lVert ":"\\rVert ","\\rVert ":"\\lVert "},d("("),d("["),d("{","\\{"),k.langle=s(Ot,q,"&lang;","&rang;","\\langle ","\\rangle "),k.rangle=s(Ot,v,"&lang;","&rang;","\\langle ","\\rangle "),T["|"]=s(Ot,q,"|","|","|","|"),k.lVert=s(Ot,q,"&#8741;","&#8741;","\\lVert ","\\rVert "),k.rVert=s(Ot,v,"&#8741;","&#8741;","\\lVert ","\\rVert "),k.left=b(P,function(t){t.parser=function(){var t=B.regex,e=B.string,n=(B.succeed,B.optWhitespace);return n.then(t(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then(function(s){var i="\\"===s.charAt(0)?s.slice(1):s;return"\\langle"==s&&(i="&lang;",s+=" "),"\\lVert"==s&&(i="&#8741;",s+=" "),N.then(function(r){return e("\\right").skip(n).then(t(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map(function(t){var e,n="\\"===t.charAt(0)?t.slice(1):t;return"\\rangle"==t&&(n="&rang;",t+=" "),"\\rVert"==t&&(n="&#8741;",t+=" "),e=Ot(0,i,n,s,t),e.blocks=[r],r.adopt(e,0,0),e})})})}}),k.right=b(P,function(t){t.parser=function(){return B.fail("unmatched \\right")}}),Tt=k.binom=k.binomial=b(b(P,f),function(t,e){t.ctrlSeq="\\binom",t.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>',t.textTemplate=["choose(",",",")"]}),k.choose=b(Tt,function(t){t.createLeftOf=vt.prototype.createLeftOf}),k.editable=k.MathQuillMathField=b(P,function(t,e){t.ctrlSeq="\\MathQuillMathField",t.htmlTemplate='<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>',t.parser=function(){var t=this,n=B.string,s=B.regex,i=B.succeed;return n("[").then(s(/^[a-z][a-z0-9]*/i)).skip(n("]")).map(function(e){t.name=e}).or(i()).then(e.parser.call(t))},t.finalizeTree=function(t){var e=C(this.ends[q],this.jQ,t);e.KIND_OF_MQ="MathField",e.editable=!0,e.createTextarea(),e.editablesTextareaEvents(),e.cursor.insAtRightEnd(e.root),u(e.root)},t.registerInnerField=function(t,e){t.push(t[this.name]=e(this.ends[q].controller))},t.latex=function(){return this.ends[q].latex()},t.text=function(){return this.ends[q].text()}}),Qt=k.embed=b(V,function(t,e){t.setOptions=function(t){function e(){return""}return this.text=t.text||e,this.htmlTemplate=t.htmlString||"",this.latex=t.latex||e,this},t.parser=function(){var t=this,e=B.string,n=B.regex,s=B.succeed;return e("{").then(n(/^[a-z][a-z0-9]*/i)).skip(e("}")).then(function(i){return e("[").then(n(/^[-\w\s]*/)).skip(e("]")).or(s()).map(function(e){return t.setOptions(A[i](e))})})}}),k.MathQuillResponseContainer=b(P,function(t,e){t.ctrlSeq="\\MathQuillResponseContainer",t.htmlTemplate='<span class="lrn-mq-response-container"><marker class="lrn-qe-keyboard-i-response"></marker><content>Response</content></span>',t.latex=function(){return"\\MathQuillResponseContainer"},t.text=function(){return this.ends[q].text()}}),k.MathQuillResponseContainerIcon=b(P,function(t,e){t.ctrlSeq="\\MathQuillResponseContainerIcon",t.htmlTemplate='<span class="lrn-mq-response-container-icon"><span class="lrn-qe-keyboard-i-response"></span></span>',t.latex=function(){return"\\MathQuillResponseContainerIcon"},t.text=function(){return this.ends[q].text()}}),jt=k.matrix=b(P,function(t,e){var n=b(W,function(t,e){t.init=function(t,n){return this.column=t,this.row=n,e.init.call(this)},t.keystroke=function(t,n,s){switch(t){case"Shift-Spacebar":return n.preventDefault(),this.parent.insertColumn(this);case"Shift-Enter":return this.parent.insertRow(this)}return e.keystroke.apply(this,arguments)},t.deleteOutOf=function(t,n){var s=this,i=arguments;this.parent.backspace(this,t,n,function(){return e.deleteOutOf.apply(s,i)})}}),s={column:"&",row:"\\\\"};t.parentheses={left:null,right:null},t.maximum={rows:5,columns:5},t.defaults={rows:2,columns:2},t.ctrlSeq="\\matrix",t.createBlocks=function(){var t,e,s=this,i=s.blocks=[],r=0;this.htmlTemplate.replace(/&\d+/g,function(a,o){var l=s.htmlTemplate.substring(0,o).match(/<tr[^>]*>/gi).length-1;e=t===l?e+1:0,i[r]=n(e,l),i[r].adopt(s,s.ends[v],0),t=l,r++})},t.reflow=function(){var t=this.jQ.children("table"),e=t.outerHeight()/+t.css("fontSize").slice(0,-2),n=this.jQ.children(".mq-paren");n.length&&J(n,Gt(1+.2*(e-1),1.2),1.05*e)},t.latex=function(){var t,e,n,i=this.getMatrixName(),r="\\begin{"+i+"}";for(n=0;n<this.blocks.length;n++)t=this.blocks[n].row,void 0!==e&&(r+=e!==t?s.row:s.column),e=t,r+=this.blocks[n].latex();return r+="\\end{"+i+"}"},t.createLeftOf=function(n){this.cursor=n;var s=Math.min(this.defaults.rows,this.maximum.rows),i=Math.min(this.defaults.columns,this.maximum.columns);this.defaultHtmlTemplate=this.defaultHtmlTemplate||this.generateHtmlTemplate(s,i),t.htmlTemplate=this.defaultHtmlTemplate,e.createLeftOf.call(this,n)},t.getMatrixName=function(){return this.ctrlSeq.replace("\\","")},t.generateHtmlTemplate=function(t,e){function n(t){return t?'<span class="mq-paren mq-scaled">'+t+"</span>":""}var s,i,r,a='<span class="mq-matrix mq-non-leaf">'+n(this.parentheses.left);for(a+='<table class="mq-non-leaf">',t=Math.min(t,this.maximum.rows),e=Math.min(e,this.maximum.columns),s=0,i=0;i<t;i++){for(a+="<tr>",r=0;r<e;r++)a+="<td>&"+s+"</td>",s++;a+="</tr>"}return a+="</table>",a+=n(this.parentheses.right)+"</span>"},t.htmlTemplate=t.generateHtmlTemplate(1,1),t.parser=function(){var t=B.regex,e=this,i=this.getMatrixName(),r=new RegExp("^(.*?)\\\\end{"+i+"}"),a=new RegExp("\\\\end{"+i+"}");return t(r).then(function(t){var i,r,o,l,c=t.replace(a,""),u=[],h=c.split(s.row),p=Math.min(h.length,e.maximum.rows),f=0;for(r=0;r<p;r++)i=h[r].split(s.column),f=Math.max(f,i.length);for(f=Math.min(f,e.maximum.columns),r=0;r<p;r++)for(i=h[r].split(s.column),t=0;t<f;t++)o=n(t,r),l=N.parse(i[t]||" "),l.children().adopt(o,o.ends[v],0),u.push(o);for(e.htmlTemplate=e.generateHtmlTemplate(p,f),e.blocks=u,r=0;r<u.length;r+=1)u[r].adopt(e,e.ends[v],0);return B.succeed(e)})},t.finalizeTree=function(){var t=this.jQ.find("table");t.length&&(this.relink(),t.removeClass(function(t,e){var n=e.match(/mq-rows-\d+/g);return n&&n.join(" ")||""}),t.addClass("mq-rows-"+t.find("tr").length))},t.relink=function(){var t=this.jQ.find("td"),e=y.byId[t.first().attr(Wt)],n=y.byId[t.last().attr(Wt)],s=t.eq(0).closest("tr"),i=[];t.each(function(e){var n,r,a,o=y.byId[x(this).attr(Wt)],l=t.eq(e+1),c=x(this).closest("tr").next("tr"),u=x(this).closest("tr").index(),h=x(this).index();l.length&&(r=y.byId[l.attr(Wt)],o[v]=r,r[q]=o),n=c.length?c.find("td").eq(h):s.find("td").eq(h+1),n.length&&(a=y.byId[n.attr(Wt)],o.downOutOf=a,a.upOutOf=o),o.column=h,o.row=u,i.push(o)}),this.ends[q]=e,this.ends[v]=n,e&&e[q]&&delete e[q],n&&n[v]&&delete n[v],this.blocks=i},t.deleteCell=function(t){function e(){return y.byId[x(this).attr(Wt)].isEmpty()}var n,s=t.jQ.closest("tr"),i=t.jQ.index(),r=s.index(),a=s.find("td").not(t.jQ),o=this.jQ.find("tr").not(s).map(function(){return x(this).find("td")[i]}),l=1===this.jQ.find("td").length;return a.filter(e).length===a.length&&o.length&&(a.remove(),t.jQ.remove(),s.remove(),this.finalizeTree()),o.filter(e).length===o.length&&a.length&&(o.remove(),t.jQ.remove(),this.finalizeTree()),l||(r=Math.min(r,this.jQ.find("tr").length-1),i=Math.min(i,this.jQ.find("tr").eq(r).find("td").length-1),n=y.byId[this.jQ.find("tr").eq(r).find("td").eq(i).attr(Wt)]),n},t.addRow=function(t){var e,s,i,r,a;if(!(this.jQ.find("tr").length>=this.maximum.rows)){for(e=t.find("td").length,s=x("<tr></tr>"),a=0;a<e;a++)i=n(),i.parent=this,i.jQ=x('<td class="mq-empty">').attr(Wt,i.id),s.append(i.jQ),r=r||i;return s.insertAfter(t),r}},t.addColumn=function(t){var e,s,i,r,a;if(!(t.closest("tr").find("td").length>=this.maximum.columns))return e=t.index(),s=t.closest("tr").index(),i=this,a=[],this.jQ.find("tr").each(function(){r=n(),r.parent=i,r.jQ=x('<td class="mq-empty">').attr(Wt,r.id),r.jQ.insertAfter(x(this).find("td").eq(e)),a.push(r)}),a[s]},t.insertColumn=function(t){newBlock=this.addColumn(t.jQ),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble("reflow").cursor.insAtRightEnd(newBlock))},t.insertRow=function(t){newBlock=this.addRow(t.jQ.closest("tr")),newBlock&&(this.cursor=this.cursor||this.parent.cursor,this.finalizeTree(),this.bubble("reflow").cursor.insAtRightEnd(newBlock))},t.backspace=function(t,e,n,s){if(t.isEmpty()){var i=this.deleteCell(t);i?n.insAtRightEnd(i):(s(),this.finalizeTree()),this.bubble("edited")}}}),k.pmatrix=b(jt,function(t,e){t.ctrlSeq="\\pmatrix",t.parentheses={left:"(",right:")"}}),k.bmatrix=b(jt,function(t,e){t.ctrlSeq="\\bmatrix",t.parentheses={left:"[",right:"]"}}),k.Bmatrix=b(jt,function(t,e){t.ctrlSeq="\\Bmatrix",t.parentheses={left:"{",right:"}"}}),k.vmatrix=b(jt,function(t,e){t.ctrlSeq="\\vmatrix",t.parentheses={left:"|",right:"|"}}),k.Vmatrix=b(jt,function(t,e){t.ctrlSeq="\\Vmatrix",t.parentheses={left:"‖",right:"‖"}}),k["∉"]=k.notin=s(U,"\\notin ","&#8713;"),k["≅"]=k.cong=s(U,"\\cong ","&#8773;"),k["≡"]=k.equiv=s(U,"\\equiv ","&#8801;"),k["⊕"]=k.oplus=s(U,"\\oplus ","&#8853;"),k["⊗"]=k.otimes=s(U,"\\otimes ","&#8855;"),k["≠"]=k.ne=k.neq=s(U,"\\ne ","&ne;"),k["≇"]=k.ncong=s(U,"\\ncong ","&ncong;"),k["∗"]=k.ast=k.star=k.loast=k.lowast=s(U,"\\ast ","&lowast;"),k.therefor=k.therefore=s(U,"\\therefore ","&there4;"),k.cuz=k.because=s(U,"\\because ","&#8757;"),k.prop=k.propto=s(U,"\\propto ","&prop;"),k["≈"]=k.asymp=k.approx=s(U,"\\approx ","&asymp;"),k["≉"]=k.nasymp=k.napprox=s(U,"\\napprox ","&nap;"),k.isin=k.in=s(U,"\\in ","&isin;"),k.ni=k.contains=s(U,"\\ni ","&ni;"),k.notni=k.niton=k.notcontains=k.doesnotcontain=Q["\\not\\ni"]=s(U,"\\not\\ni ","&#8716;"),k.sub=k.subset=s(U,"\\subset ","&sub;"),k.sup=k.supset=k.superset=s(U,"\\supset ","&sup;"),k.nsub=k.notsub=k.nsubset=k.notsubset=Q["\\not\\subset"]=s(U,"\\not\\subset ","&#8836;"),k.nsup=k.notsup=k.nsupset=k.notsupset=k.nsuperset=k.notsuperset=Q["\\not\\supset"]=s(U,"\\not\\supset ","&#8837;"),k.sube=k.subeq=k.subsete=k.subseteq=s(U,"\\subseteq ","&sube;"),k.supe=k.supeq=k.supsete=k.supseteq=k.supersete=k.superseteq=s(U,"\\supseteq ","&supe;"),k.nsube=k.nsubeq=k.notsube=k.notsubeq=k.nsubsete=k.nsubseteq=k.notsubsete=k.notsubseteq=Q["\\not\\subseteq"]=s(U,"\\not\\subseteq ","&#8840;"),k.nsupe=k.nsupeq=k.notsupe=k.notsupeq=k.nsupsete=k.nsupseteq=k.notsupsete=k.notsupseteq=k.nsupersete=k.nsuperseteq=k.notsupersete=k.notsuperseteq=Q["\\not\\supseteq"]=s(U,"\\not\\supseteq ","&#8841;"),k.N=k.naturals=k.Naturals=s(H,"\\mathbb{N}","&#8469;"),k.P=k.primes=k.Primes=k.projective=k.Projective=k.probability=k.Probability=s(H,"\\mathbb{P}","&#8473;"),k.Z=k.integers=k.Integers=s(H,"\\mathbb{Z}","&#8484;"),k.Q=k.rationals=k.Rationals=s(H,"\\mathbb{Q}","&#8474;"),k.R=k.reals=k.Reals=s(H,"\\mathbb{R}","&#8477;"),k.C=k.complex=k.Complex=k.complexes=k.Complexes=k.complexplane=k.Complexplane=k.ComplexPlane=s(H,"\\mathbb{C}","&#8450;"),k.H=k.Hamiltonian=k.quaternions=k.Quaternions=s(H,"\\mathbb{H}","&#8461;"),k.quad=k.emsp=s(H,"\\quad "," "),k.qquad=s(H,"\\qquad "," "),k.diamond=s(H,"\\diamond ","&#9671;"),k.bigtriangleup=s(H,"\\bigtriangleup ","&#9651;"),k.ominus=s(H,"\\ominus ","&#8854;"),k.uplus=s(H,"\\uplus ","&#8846;"),k.bigtriangledown=s(H,"\\bigtriangledown ","&#9661;"),k.sqcap=s(H,"\\sqcap ","&#8851;"),k.triangleleft=s(H,"\\triangleleft ","&#8882;"),k.sqcup=s(H,"\\sqcup ","&#8852;"),k.triangleright=s(H,"\\triangleright ","&#8883;"),k.odot=k.circledot=s(H,"\\odot ","&#8857;"),k.bigcirc=s(H,"\\bigcirc ","&#9711;"),k.dagger=s(H,"\\dagger ","&#0134;"),k.ddagger=s(H,"\\ddagger ","&#135;"),k.wr=s(H,"\\wr ","&#8768;"),k.amalg=s(H,"\\amalg ","&#8720;"),k.models=s(H,"\\models ","&#8872;"),k.prec=s(H,"\\prec ","&#8826;"),k.succ=s(H,"\\succ ","&#8827;"),k.preceq=s(H,"\\preceq ","&#8828;"),k.succeq=s(H,"\\succeq ","&#8829;"),k.simeq=s(H,"\\simeq ","&#8771;"),k.mid=s(H,"\\mid ","&#8739;"),k.ll=s(H,"\\ll ","&#8810;"),k.gg=s(H,"\\gg ","&#8811;"),k.parallel=s(H,"\\parallel ","&#8741;"),k.nparallel=s(H,"\\nparallel ","&#8742;"),k.bowtie=s(H,"\\bowtie ","&#8904;"),k.sqsubset=s(H,"\\sqsubset ","&#8847;"),k.sqsupset=s(H,"\\sqsupset ","&#8848;"),k.smile=s(H,"\\smile ","&#8995;"),k.sqsubseteq=s(H,"\\sqsubseteq ","&#8849;"),k.sqsupseteq=s(H,"\\sqsupseteq ","&#8850;"),k.doteq=s(H,"\\doteq ","&#8784;"),k.frown=s(H,"\\frown ","&#8994;"),k.vdash=s(H,"\\vdash ","&#8870;"),k.dashv=s(H,"\\dashv ","&#8867;"),k.nless=s(H,"\\nless ","&#8814;"),k.ngtr=s(H,"\\ngtr ","&#8815;"),k.longleftarrow=s(H,"\\longleftarrow ","&#8592;"),k.longrightarrow=s(H,"\\longrightarrow ","&#8594;"),k.Longleftarrow=s(H,"\\Longleftarrow ","&#8656;"),k.Longrightarrow=s(H,"\\Longrightarrow ","&#8658;"),k.longleftrightarrow=s(H,"\\longleftrightarrow ","&#8596;"),k.updownarrow=s(H,"\\updownarrow ","&#8597;"),k.Longleftrightarrow=s(H,"\\Longleftrightarrow ","&#8660;"),k.Updownarrow=s(H,"\\Updownarrow ","&#8661;"),k.mapsto=s(H,"\\mapsto ","&#8614;"),k.nearrow=s(H,"\\nearrow ","&#8599;"),k.hookleftarrow=s(H,"\\hookleftarrow ","&#8617;"),k.hookrightarrow=s(H,"\\hookrightarrow ","&#8618;"),k.searrow=s(H,"\\searrow ","&#8600;"),k.leftharpoonup=s(H,"\\leftharpoonup ","&#8636;"),k.rightharpoonup=s(H,"\\rightharpoonup ","&#8640;"),k.swarrow=s(H,"\\swarrow ","&#8601;"),k.leftharpoondown=s(H,"\\leftharpoondown ","&#8637;"),k.rightharpoondown=s(H,"\\rightharpoondown ","&#8641;"),k.nwarrow=s(H,"\\nwarrow ","&#8598;"),k.ldots=s(H,"\\ldots ","&#8230;"),k.cdots=s(H,"\\cdots ","&#8943;"),k.vdots=s(H,"\\vdots ","&#8942;"),k.ddots=s(H,"\\ddots ","&#8945;"),k.surd=s(H,"\\surd ","&#8730;"),k.triangle=s(H,"\\triangle ","&#9651;"),k.ell=s(H,"\\ell ","&#8467;"),k.top=s(H,"\\top ","&#8868;"),k.flat=s(H,"\\flat ","&#9837;"),k.natural=s(H,"\\natural ","&#9838;"),k.sharp=s(H,"\\sharp ","&#9839;"),k.wp=s(H,"\\wp ","&#8472;"),k.bot=s(H,"\\bot ","&#8869;"),k.clubsuit=s(H,"\\clubsuit ","&#9827;"),k.diamondsuit=s(H,"\\diamondsuit ","&#9826;"),k.heartsuit=s(H,"\\heartsuit ","&#9825;"),k.spadesuit=s(H,"\\spadesuit ","&#9824;"),k.circledot=s(H,"\\circledot ","&#8857;"),k.middot=s(H,"\\middot ","&middot;"),k.dottedsquare=s(H,"\\dottedsquare ","&#11034;"),k.square=s(H,"\\square ","&#11036;"),k.rectangle=s(H,"\\rectangle ","&#9647;"),k.oint=s(H,"\\oint ","&#8750;"),k.bigcap=s(H,"\\bigcap ","&#8745;"),k.bigcup=s(H,"\\bigcup ","&#8746;"),k.bigsqcup=s(H,"\\bigsqcup ","&#8852;"),k.bigvee=s(H,"\\bigvee ","&#8744;");k.bigwedge=s(H,"\\bigwedge ","&#8743;"),k.bigodot=s(H,"\\bigodot ","&#8857;"),k.bigotimes=s(H,"\\bigotimes ","&#8855;"),k.bigoplus=s(H,"\\bigoplus ","&#8853;"),k.biguplus=s(H,"\\biguplus ","&#8846;"),k.lfloor=s(H,"\\lfloor ","&#8970;"),k.rfloor=s(H,"\\rfloor ","&#8971;"),k.lceil=s(H,"\\lceil ","&#8968;"),k.rceil=s(H,"\\rceil ","&#8969;"),k.opencurlybrace=k.lbrace=s(H,"\\lbrace ","{"),k.closecurlybrace=k.rbrace=s(H,"\\rbrace ","}"),k.lbrack=s(H,"["),k.rbrack=s(H,"]"),k.mug=s(H,"\\mug ","µg"),k.mus=s(H,"\\mus ","µs"),k.mum=s(H,"\\mum ","µm"),k.muL=s(H,"\\muL ","µL"),k.slash=s(H,"/"),k.vert=s(H,"|"),k.perp=k.perpendicular=s(H,"\\perp ","&perp;"),k.nabla=k.del=s(H,"\\nabla ","&nabla;"),k.hbar=s(H,"\\hbar ","&#8463;"),k.AA=k.Angstrom=k.angstrom=s(H,"\\text\\AA ","&#8491;"),k.ring=k.circ=k.circle=s(H,"\\circ ","&#8728;"),k.bull=k.bullet=s(H,"\\bullet ","&bull;"),k.setminus=k.smallsetminus=s(H,"\\setminus ","&#8726;"),k.not=k["¬"]=k.neg=s(H,"\\neg ","&not;"),k["…"]=k.dots=k.ellip=k.hellip=k.ellipsis=k.hellipsis=s(H,"\\dots ","&hellip;"),k.converges=k.darr=k.dnarr=k.dnarrow=k.downarrow=s(H,"\\downarrow ","&darr;"),k.dArr=k.dnArr=k.dnArrow=k.Downarrow=s(H,"\\Downarrow ","&dArr;"),k.diverges=k.uarr=k.uparrow=s(H,"\\uparrow ","&uarr;"),k.uArr=k.Uparrow=s(H,"\\Uparrow ","&uArr;"),k.to=s(U,"\\to ","&rarr;"),k.rarr=k.rightarrow=s(H,"\\rightarrow ","&rarr;"),k.implies=s(U,"\\Rightarrow ","&rArr;"),k.rArr=k.Rightarrow=s(H,"\\Rightarrow ","&rArr;"),k.gets=s(U,"\\gets ","&larr;"),k.larr=k.leftarrow=s(H,"\\leftarrow ","&larr;"),k.impliedby=s(U,"\\Leftarrow ","&lArr;"),k.lArr=k.Leftarrow=s(H,"\\Leftarrow ","&lArr;"),k.harr=k.lrarr=k.leftrightarrow=s(H,"\\leftrightarrow ","&harr;"),k.iff=s(U,"\\Leftrightarrow ","&hArr;"),k.hArr=k.lrArr=k.Leftrightarrow=s(H,"\\Leftrightarrow ","&hArr;"),k.Re=k.Real=k.real=s(H,"\\Re ","&real;"),k.Im=k.imag=k.image=k.imagin=k.imaginary=k.Imaginary=s(H,"\\Im ","&image;"),k.part=k.partial=s(H,"\\partial ","&part;"),k.infty=k.infin=k.infinity=s(H,"\\infty ","&infin;"),k.pounds=s(H,"\\pounds ","&pound;"),k.alef=k.alefsym=k.aleph=k.alephsym=s(H,"\\aleph ","&alefsym;"),k.xist=k.xists=k.exist=k.exists=s(H,"\\exists ","&exist;"),k.nexists=k.nexist=s(H,"\\nexists ","&#8708;"),k.and=k.land=k.wedge=s(U,"\\wedge ","&and;"),k.or=k.lor=k.vee=s(U,"\\vee ","&or;"),k.o=k.O=k.empty=k.emptyset=k.oslash=k.Oslash=k.nothing=k.varnothing=s(U,"\\varnothing ","&empty;"),k.cup=k.union=s(U,"\\cup ","&cup;"),k.cap=k.intersect=k.intersection=s(U,"\\cap ","&cap;"),k.deg=k.degree=s(H,"\\degree ","&deg;"),k.ang=k.angle=s(H,"\\angle ","&ang;"),k.measuredangle=s(H,"\\measuredangle ","m&ang;"),St=b(H,function(t,e){t.createLeftOf=function(t){t.options.autoSubscriptNumerals&&t.parent!==t.parent.parent.sub&&(t[q]instanceof Ct&&!1!==t[q].isItalic||t[q]instanceof mt&&t[q][q]instanceof Ct&&!1!==t[q][q].isItalic)?(k._().createLeftOf(t),e.createLeftOf.call(this,t),t.insRightOf(t.parent.parent)):e.createLeftOf.call(this,t)}}),Ct=b(V,function(t,e){t.init=function(t,n){e.init.call(this,t,"<var>"+(n||t)+"</var>")},t.text=function(){var t=this.ctrlSeq;return this.isPartOfOperator?"\\"==t[0]?t=t.slice(1,t.length):" "==t[t.length-1]&&(t=t.slice(0,-1)):(!this[q]||this[q]instanceof Ct||this[q]instanceof U||"\\ "===this[q].ctrlSeq||(t="*"+t),!this[v]||this[v]instanceof U||this[v]instanceof mt||(t+="*")),t}}),_.p.autoCommands={_maxLength:0},E.autoCommands=function(t){var e,n,s,i,r;if(!/^[a-z]+(?: [a-z]+)*$/i.test(t))throw'"'+t+'" not a space-delimited list of only letters';for(e=t.split(" "),n={},s=0,i=0;i<e.length;i+=1){if(r=e[i],r.length<2)throw'autocommand "'+r+'" not minimum length of 2';if(k[r]===At)throw'"'+r+'" is a built-in operator name';n[r]=1,s=Kt(s,r.length)}return n._maxLength=s,n},Dt=b(Ct,function(t,e){function n(t){return!t||t instanceof U||t instanceof bt}t.init=function(t){return e.init.call(this,this.letter=t)},t.createLeftOf=function(t){var n,s,i,r,a;if(e.createLeftOf.apply(this,arguments),n=t.options.autoCommands,s=n._maxLength,s>0){for(i="",r=this,a=0;r instanceof Dt&&r.ctrlSeq===r.letter&&a<s;)i=r.letter+i,r=r[q],a+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(a=1,r=this;a<i.length;a+=1,r=r[q]);return O(r,this).remove(),t[q]=r[q],k[i](i).createLeftOf(t)}i=i.slice(1)}}},t.italicize=function(t){return this.isItalic=t,this.isPartOfOperator=!t,this.jQ.toggleClass("mq-operator-name",!t),this},t.finalizeTree=t.siblingDeleted=t.siblingCreated=function(t,e){e!==q&&this[v]instanceof Dt||this.autoUnItalicize(t)},t.autoUnItalicize=function(t){var e,s,i,r,a,o,l,c,u,h,p,f,d=t.autoOperatorNames;if(0!==d._maxLength){for(e=this.letter,s=this[q];s instanceof Dt;s=s[q])e=s.letter+e;for(i=this[v];i instanceof Dt;i=i[v])e+=i.letter;O(s[v]||this.parent.ends[q],i[q]||this.parent.ends[v]).each(function(t){t.italicize(!0).jQ.removeClass("mq-first mq-last mq-followed-by-supsub"),t.ctrlSeq=t.letter});t:for(r=0,a=s[v]||this.parent.ends[q];r<e.length;r+=1,a=a[v])for(o=Gt(d._maxLength,e.length-r);o>0;o-=1)if(l=e.slice(r,r+o),d.hasOwnProperty(l)){for(c=0,u=a;c<o;c+=1,u=u[v])u.italicize(!1),h=u;p=_t.hasOwnProperty(l),a.ctrlSeq=(p?"\\":"\\operatorname{")+a.ctrlSeq,h.ctrlSeq+=p?" ":"}",Lt.hasOwnProperty(l)&&h[q][q][q].jQ.addClass("mq-last"),n(a[q])||a.jQ.addClass("mq-first"),n(h[v])||(h[v]instanceof mt?(f=h[v],(f.siblingCreated=f.siblingDeleted=function(){f.jQ.toggleClass("mq-after-operator-name",!(f[v]instanceof Ot))})()):h.jQ.toggleClass("mq-last",!(h[v]instanceof Ot))),r+=o-1,a=h;continue t}}}}),_t={},Et=_.p.autoOperatorNames={_maxLength:9},Lt={limsup:1,liminf:1,projlim:1,injlim:1},function(){var t,e,n,s,i="arg deg det dim exp gcd hom inf ker lg ln log max min sup limsup liminf injlim projlim Pr".split(" ");for(t=0;t<i.length;t+=1)_t[i[t]]=Et[i[t]]=1;for(e="sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth".split(" "),t=0;t<e.length;t+=1)_t[e[t]]=1;for(n="sin cos tan sec cosec csc cotan cot ctg".split(" "),t=0;t<n.length;t+=1)Et[n[t]]=Et["arc"+n[t]]=Et[n[t]+"h"]=Et["ar"+n[t]+"h"]=Et["arc"+n[t]+"h"]=1;for(s="gcf hcf lcm proj span".split(" "),t=0;t<s.length;t+=1)Et[s[t]]=1}(),E.autoOperatorNames=function(t){var e,n,s,i,r;if(!/^[a-z]+(?: [a-z]+)*$/i.test(t))throw'"'+t+'" not a space-delimited list of only letters';for(e=t.split(" "),n={},s=0,i=0;i<e.length;i+=1){if(r=e[i],r.length<2)throw'"'+r+'" not minimum length of 2';n[r]=1,s=Kt(s,r.length)}return n._maxLength=s,n},At=b(V,function(t,e){t.init=function(t){this.ctrlSeq=t},t.createLeftOf=function(t){var e,n=this.ctrlSeq;for(e=0;e<n.length;e+=1)Dt(n.charAt(e)).createLeftOf(t)},t.parser=function(){var t,e=this.ctrlSeq,n=W();for(t=0;t<e.length;t+=1)Dt(e.charAt(t)).adopt(n,n.ends[v],0);return B.succeed(n.children())}});for(It in Et)Et.hasOwnProperty(It)&&(k[It]=At);k.operatorname=b(P,function(e){e.createLeftOf=t,e.numBlocks=function(){return 1},e.parser=function(){return N.block.map(function(t){return t.children()})}}),k.f=b(Dt,function(t,e){t.init=function(){V.p.init.call(this,this.letter="f",'<var class="mq-f">f</var>')},t.italicize=function(t){return this.jQ.html("f").toggleClass("mq-f",t),e.italicize.apply(this,arguments)}}),k[" "]=k.space=s(H,"\\ ","&nbsp;"),k["'"]=k.prime=s(H,"'","&prime;"),k["″"]=k.dprime=s(H,"″","&Prime;"),k['"']=k.doublePrime=s(H,'"',"&Prime;"),k.backslash=s(H,"\\backslash ","\\"),T["\\"]||(T["\\"]=k.backslash),k.$=s(H,"\\$","$"),Rt=b(V,function(t,e){t.init=function(t,n){e.init.call(this,t,'<span class="mq-nonSymbola">'+(n||t)+"</span>")}}),k["@"]=Rt,k["&"]=s(Rt,"\\&","&amp;"),k["%"]=s(Rt,"\\%","%"),k.alpha=k.beta=k.gamma=k.delta=k.zeta=k.eta=k.theta=k.iota=k.kappa=k.mu=k.nu=k.xi=k.rho=k.sigma=k.tau=k.chi=k.psi=k.omega=b(Ct,function(t,e){t.init=function(t){e.init.call(this,"\\"+t+" ","&"+t+";")}}),k.phi=s(Ct,"\\phi ","&#981;"),k.phiv=k.varphi=s(Ct,"\\varphi ","&phi;"),k.epsilon=s(Ct,"\\epsilon ","&#1013;"),k.epsiv=k.varepsilon=s(Ct,"\\varepsilon ","&epsilon;"),k.piv=k.varpi=s(Ct,"\\varpi ","&piv;"),k.sigmaf=k.sigmav=k.varsigma=s(Ct,"\\varsigma ","&sigmaf;"),k.thetav=k.vartheta=k.thetasym=s(Ct,"\\vartheta ","&thetasym;"),k.upsilon=k.upsi=s(Ct,"\\upsilon ","&upsilon;"),k.gammad=k.Gammad=k.digamma=s(Ct,"\\digamma ","&#989;"),k.kappav=k.varkappa=s(Ct,"\\varkappa ","&#1008;"),k.rhov=k.varrho=s(Ct,"\\varrho ","&#1009;"),k.pi=k["π"]=s(Rt,"\\pi ","&pi;"),k.lambda=s(Rt,"\\lambda ","&lambda;"),k.Upsilon=k.Upsi=k.upsih=k.Upsih=s(V,"\\Upsilon ",'<var style="font-family: serif">&upsih;</var>'),k.Gamma=k.Delta=k.Theta=k.Lambda=k.Xi=k.Pi=k.Sigma=k.Phi=k.Psi=k.Omega=b(H,function(t,e){t.init=function(t){e.init.call(this,"\\"+t+" ","&"+t+";")}}),k.forall=k["∀"]=s(H,"\\forall ","&#8704;"),zt=b(P,function(t){t.init=function(t){this.latex=t},t.createLeftOf=function(t){var e=N.parse(this.latex);e.children().adopt(t.parent,t[q],t[v]),t[q]=e.ends[v],e.jQize().insertBefore(t.jQ),e.finalizeInsert(t.options,t),e.ends[v][v].siblingCreated&&e.ends[v][v].siblingCreated(t.options,q),e.ends[q][q].siblingCreated&&e.ends[q][q].siblingCreated(t.options,v),t.parent.bubble("reflow")},t.parser=function(){var t=N.parse(this.latex).children();return B.succeed(t)}}),k["¹"]=s(zt,"^1"),k["²"]=s(zt,"^2"),k["³"]=s(zt,"^3"),k["¼"]=s(zt,"\\frac14"),k["½"]=s(zt,"\\frac12"),k["¾"]=s(zt,"\\frac34"),Mt=b(U,function(t){t.init=H.prototype.init,t.contactWeld=t.siblingCreated=t.siblingDeleted=function(t,e){function n(t){return t[q]?t[q]instanceof U||/^[,;:\(\[]$/.test(t[q].ctrlSeq)?"":"mq-binary-operator":t.parent&&t.parent.parent&&t.parent.parent.isStyleBlock()?n(t.parent.parent):""}if(e!==v)return this.jQ[0].className=n(this),this}}),k["+"]=s(Mt,"+","+"),k["–"]=k["-"]=s(Mt,"-","&minus;"),k["±"]=k.pm=k.plusmn=k.plusminus=s(Mt,"\\pm ","&plusmn;"),k.mp=k.mnplus=k.minusplus=s(Mt,"\\mp ","&#8723;"),T["*"]=k.sdot=k.cdot=s(U,"\\cdot ","&middot;","*"),Bt=b(U,function(t,e){t.init=function(t,n){this.data=t,this.strict=n;var s=n?"Strict":"";e.init.call(this,t["ctrlSeq"+s],t["html"+s],t["text"+s])},t.swap=function(t){this.strict=t;var e=t?"Strict":"";this.ctrlSeq=this.data["ctrlSeq"+e],this.jQ.html(this.data["html"+e]),this.textTemplate=[this.data["text"+e]]},t.deleteTowards=function(t,n){if(t===q&&!this.strict)return this.swap(!0),void this.bubble("reflow");e.deleteTowards.apply(this,arguments)}}),Ft={ctrlSeq:"\\le ",html:"&le;",text:"≤",ctrlSeqStrict:"<",htmlStrict:"&lt;",textStrict:"<"},Nt={ctrlSeq:"\\ge ",html:"&ge;",text:"≥",ctrlSeqStrict:">",htmlStrict:"&gt;",textStrict:">"},k["<"]=k.lt=s(Bt,Ft,!0),k[">"]=k.gt=s(Bt,Nt,!0),k["≤"]=k.le=k.leq=s(Bt,Ft,!1),k["≥"]=k.ge=k.geq=s(Bt,Nt,!1),$t=b(U,function(t,e){t.init=function(){e.init.call(this,"=","=")},t.createLeftOf=function(t){if(t[q]instanceof Bt&&t[q].strict)return t[q].swap(!1),void t[q].bubble("reflow");e.createLeftOf.apply(this,arguments)}}),k["="]=$t,k["×"]=k.times=s(U,"\\times ","&times;","[x]"),k["÷"]=k.div=k.divide=k.divides=s(U,"\\div ","&divide;","[/]"),T["~"]=k.sim=s(U,"\\sim ","~","~"),T["≁"]=k.nsim=s(U,"\\nsim ","≁","≁"),k.complement=k["∁"]=s(H,"\\complement ","&#8705;"),k.nexists=k["∄"]=s(H,"\\nexists ","&#8708;"),k.sphericalangle=k["∢"]=s(H,"\\sphericalangle ","&#8738;"),k.iint=k["∬"]=s(H,"\\iint ","&#8748;"),k.iiint=k["∭"]=s(H,"\\iiint ","&#8749;"),k.oiint=k["∯"]=s(H,"\\oiint ","&#8751;"),k.oiiint=k["∰"]=s(H,"\\oiiint ","&#8752;"),k.backsim=k["∽"]=s(H,"\\backsim ","&#8765;"),k.backsimeq=k["⋍"]=s(H,"\\backsimeq ","&#8909;"),k.eqsim=k["≂"]=s(H,"\\eqsim ","&#8770;"),k.ncong=k["≇"]=s(H,"\\ncong ","&#8775;"),k.approxeq=k["≊"]=s(H,"\\approxeq ","&#8778;"),k.bumpeq=k["≏"]=s(H,"\\bumpeq ","&#8783;"),k.Bumpeq=k["≎"]=s(H,"\\Bumpeq ","&#8782;"),k.doteqdot=k["≑"]=s(H,"\\doteqdot ","&#8785;"),k.fallingdotseq=k["≒"]=s(H,"\\fallingdotseq ","&#8786;"),k.risingdotseq=k["≓"]=s(H,"\\risingdotseq ","&#8787;"),k.eqcirc=k["≖"]=s(H,"\\eqcirc ","&#8790;"),k.circeq=k["≗"]=s(H,"\\circeq ","&#8791;"),k.triangleq=k["≜"]=s(H,"\\triangleq ","&#8796;"),k.leqq=k["≦"]=s(H,"\\leqq ","&#8806;"),k.geqq=k["≧"]=s(H,"\\geqq ","&#8807;"),k.lneqq=k["≨"]=s(H,"\\lneqq ","&#8808;"),k.gneqq=k["≩"]=s(H,"\\gneqq ","&#8809;"),k.between=k["≬"]=s(H,"\\between ","&#8812;"),k.nleq=k["≰"]=s(H,"\\nleq ","&#8816;"),k.ngeq=k["≱"]=s(H,"\\ngeq ","&#8817;"),k.lesssim=k["≲"]=s(H,"\\lesssim ","&#8818;"),k.gtrsim=k["≳"]=s(H,"\\gtrsim ","&#8819;"),k.lessgtr=k["≶"]=s(H,"\\lessgtr ","&#8822;"),k.gtrless=k["≷"]=s(H,"\\gtrless ","&#8823;"),k.preccurlyeq=k["≼"]=s(H,"\\preccurlyeq ","&#8828;"),k.succcurlyeq=k["≽"]=s(H,"\\succcurlyeq ","&#8829;"),k.precsim=k["≾"]=s(H,"\\precsim ","&#8830;"),k.succsim=k["≿"]=s(H,"\\succsim ","&#8831;"),k.nprec=k["⊀"]=s(H,"\\nprec ","&#8832;"),k.nsucc=k["⊁"]=s(H,"\\nsucc ","&#8833;"),k.subsetneq=k["⊊"]=s(H,"\\subsetneq ","&#8842;"),k.supsetneq=k["⊋"]=s(H,"\\supsetneq ","&#8843;"),k.vDash=k["⊨"]=s(H,"\\vDash ","&#8872;"),k.Vdash=k["⊩"]=s(H,"\\Vdash ","&#8873;"),k.Vvdash=k["⊪"]=s(H,"\\Vvdash ","&#8874;"),k.VDash=k["⊫"]=s(H,"\\VDash ","&#8875;"),k.nvdash=k["⊬"]=s(H,"\\nvdash ","&#8876;"),k.nvDash=k["⊭"]=s(H,"\\nvDash ","&#8877;"),k.nVdash=k["⊮"]=s(H,"\\nVdash ","&#8878;"),k.nVDash=k["⊯"]=s(H,"\\nVDash ","&#8879;"),k.vartriangleleft=k["⊲"]=s(H,"\\vartriangleleft ","&#8882;"),k.vartriangleright=k["⊳"]=s(H,"\\vartriangleright ","&#8883;"),k.trianglelefteq=k["⊴"]=s(H,"\\trianglelefteq ","&#8884;"),k.trianglerighteq=k["⊵"]=s(H,"\\trianglerighteq ","&#8885;"),k.multimap=k["⊸"]=s(H,"\\multimap ","&#8888;"),k.Subset=k["⋐"]=s(H,"\\Subset ","&#8912;"),k.Supset=k["⋑"]=s(H,"\\Supset ","&#8913;"),k.Cap=k["⋒"]=s(H,"\\Cap ","&#8914;"),k.Cup=k["⋓"]=s(H,"\\Cup ","&#8915;"),k.pitchfork=k["⋔"]=s(H,"\\pitchfork ","&#8916;"),k.lessdot=k["⋖"]=s(H,"\\lessdot ","&#8918;"),k.gtrdot=k["⋗"]=s(H,"\\gtrdot ","&#8919;"),k.lll=k["⋘"]=s(H,"\\lll ","&#8920;"),k.ggg=k["⋙"]=s(H,"\\ggg ","&#8921;"),k.lesseqgtr=k["⋚"]=s(H,"\\lesseqgtr ","&#8922;"),k.gtreqless=k["⋛"]=s(H,"\\gtreqless ","&#8923;"),k.curlyeqprec=k["⋞"]=s(H,"\\curlyeqprec ","&#8926;"),k.curlyeqsucc=k["⋟"]=s(H,"\\curlyeqsucc ","&#8927;"),k.nsim=k["≁"]=s(H,"\\nsim ","&#8769;"),k.lnsim=k["⋦"]=s(H,"\\lnsim ","&#8934;"),k.gnsim=k["⋧"]=s(H,"\\gnsim ","&#8935;"),k.precnsim=k["⋨"]=s(H,"\\precnsim ","&#8936;"),k.succnsim=k["⋩"]=s(H,"\\succnsim ","&#8937;"),k.ntriangleleft=k["⋪"]=s(H,"\\ntriangleleft ","&#8938;"),k.ntriangleright=k["⋫"]=s(H,"\\ntriangleright ","&#8939;"),k.ntrianglelefteq=k["⋬"]=s(H,"\\ntrianglelefteq ","&#8940;"),k.ntrianglerighteq=k["⋭"]=s(H,"\\ntrianglerighteq ","&#8941;"),k.blacksquare=k["∎"]=s(H,"\\blacksquare ","&#8718;"),k.colon=k["∶"]=s(H,"\\colon ","&#8758;"),k.llcorner=k["∟"]=s(H,"\\llcorner ","&#8735;"),k.dotplus=k["∔"]=s(U,"\\dotplus ","&#8724;"),k.nmid=k["∤"]=s(U,"\nmid ","&#8740;"),k.intercal=k["⊺"]=s(U,"\\intercal ","&#8890;"),k.veebar=k["⊻"]=s(U,"\\veebar ","&#8891;"),k.barwedge=k["⊼"]=s(U,"\\barwedge ","&#8892;"),k.ltimes=k["⋉"]=s(U,"\\ltimes ","&#8905;"),k.rtimes=k["⋊"]=s(U,"\\rtimes ","&#8906;"),k.leftthreetimes=k["⋋"]=s(U,"\\leftthreetimes ","&#8907;"),k.rightthreetimes=k["⋌"]=s(U,"\\rightthreetimes ","&#8908;"),k.curlyvee=k["⋎"]=s(U,"\\curlyvee ","&#8910;"),k.curlywedge=k["⋏"]=s(U,"\\curlywedge ","&#8911;"),k.circledcirc=k["⊚"]=s(U,"\\circledcirc ","&#8858;"),k.circledast=k["⊛"]=s(U,"\\circledast ","&#8859;"),k.circleddash=k["⊝"]=s(U,"\\circleddash ","&#8861;"),k.boxplus=k["⊞"]=s(U,"\\boxplus ","&#8862;"),k.boxminus=k["⊟"]=s(U,"\\boxminus ","&#8863;"),k.boxtimes=k["⊠"]=s(U,"\\boxtimes ","&#8864;"),k.boxdot=k["⊡"]=s(U,"\\boxdot ","&#8865;"),k["∂"]=k.partial,k["∃"]=k.exists,k["∅"]=k.varnothing,k["∆"]=k.triangle,k["∇"]=k.nabla,k["∈"]=k.in,k["∊"]=k.in,k["∋"]=k.ni,k["∌"]=k.notni,
13
+ k["∍"]=k.ni,k["∐"]=k.amalg,k["−"]=k["-"],k["∓"]=k.mp,k["∖"]=k.setminus,k["∘"]=k.circ,k["∙"]=k.bullet,k["∝"]=k.propto,k["∞"]=k.infty,k["∠"]=k.angle,k["∡"]=k.measuredangle,k["∣"]=k.divides,k["∥"]=k.parallel,k["∦"]=k.nparallel,k["∧"]=k.wedge,k["∨"]=k.vee,k["∩"]=k.cap,k["∪"]=k.cup,k["∮"]=k.oint,k["∴"]=k.therefore,k["∵"]=k.because,k["∼"]=k.sim,k["≀"]=k.wr,k["≃"]=k.simeq,k["≍"]=k.asymp,k["≐"]=k.doteq,k["≪"]=k.ll,k["≫"]=k.gg,k["≺"]=k.prec,k["≻"]=k.succ,k["⊂"]=k.subset,k["⊃"]=k.supset,k["⊆"]=k.subseteq,k["⊇"]=k.supseteq,k["⊈"]=k.nsubseteq,k["⊉"]=k.nsupseteq,k["⊏"]=k.sqsubset,k["⊐"]=k.sqsupset,k["⊓"]=k.sqcap,k["⊔"]=k.sqcup;k["⊖"]=k.ominus,k["⊘"]=k.oslash,k["⊙"]=k.odot,k["⊢"]=k.vdash,k["⊣"]=k.dashv,k["⊤"]=k.top,k["⊥"]=k.bot,k["⊧"]=k.models,k["⋀"]=k.wedge,k["⋁"]=k.vee,k["⋂"]=k.cap,k["⋃"]=k.cup,k["⋄"]=k.diamond,k["⋅"]=k.cdot,k["⋆"]=k.star,k["⋈"]=k.bowtie,k["⋮"]=k.vdots,k["⋯"]=k.cdots,k["⋱"]=k.ddots,Pt=c(1);for(Vt in Pt)!function(t,e){"function"==typeof e?(l[t]=function(){return o(),e.apply(this,arguments)},l[t].prototype=e.prototype):l[t]=e}(Vt,Pt[Vt])}();
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@pie-framework/mathquill",
3
+ "description": "A fork of mathquill that works with common js: Easily type math in your webapp",
4
+ "version": "1.1.2",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "license": "MPL-2.0",
9
+ "main": "build/index.js",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pie-framework/mathquill.git"
13
+ },
14
+ "files": [
15
+ "build/mathquill.{css,js,min.js}",
16
+ "build/fonts/Symbola.*",
17
+ "build/index-dev.js",
18
+ "build/index.js",
19
+ "build/jquery.global.js"
20
+ ],
21
+ "dependencies": {
22
+ "jquery": "^3.3.1"
23
+ },
24
+ "devDependencies": {
25
+ "@rollup/plugin-node-resolve": "^7.1.1",
26
+ "@rollup/plugin-commonjs": "^11.0.2",
27
+ "pjs": ">=3.1.0 <5.0.0",
28
+ "mocha": ">=2.4.1",
29
+ "uglify-js": "2.x",
30
+ "less": ">=1.5.1",
31
+ "rollup": "2.0.0-2",
32
+ "rollup-plugin-postcss": "^2.2.0"
33
+ }
34
+ }
@@ -10,7 +10,7 @@
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-element/multiple-choice": "^7.0.0",
12
12
  "@pie-framework/pie-configure-events": "^1.2.0",
13
- "@pie-lib/config-ui": "^11.0.4",
13
+ "@pie-lib/config-ui": "^11.0.6",
14
14
  "lodash": "^4.17.15",
15
15
  "prop-types": "^15.6.2",
16
16
  "react": "^16.8.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/ebsr",
3
- "version": "6.6.3-next.1082+88161cc9e",
3
+ "version": "6.6.3-next.1089+4b014ca36",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "author": "pie framework developers",
17
17
  "license": "ISC",
18
- "gitHead": "88161cc9e8a1dfceb1cd7bcfb19e7df34dec8043",
18
+ "gitHead": "4b014ca3655fa12c8f93ddd63395406f5c11744a",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },