(()=>{"use strict";var t={d:(e,a)=>{for(var r in a)t.o(a,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AutoOpen:()=>v});var a={};t.r(a),t.d(a,{default:()=>V});var r={};t.r(r),t.d(r,{PhysicsConfiguration:()=>J});const n=("undefined"!=typeof window?window:global).MathJax._.components.global,i=(n.GLOBAL,n.isObject,n.combineConfig,n.combineDefaults,n.combineWithMathJax),o=(n.MathJax,MathJax._.input.tex.HandlerTypes),s=o.ConfigurationType,c=o.HandlerType,l=MathJax._.input.tex.Configuration,m=l.Configuration,u=(l.ConfigurationHandler,l.ParserConfiguration,MathJax._.input.tex.StackItem),p=(u.MmlStack,u.BaseItem),g=MathJax._.input.tex.ParseUtil,d=(g.KeyValueDef,g.KeyValueTypes,g.ParseUtil),h=MathJax._.input.tex.NodeUtil.default,x=MathJax._.input.tex.TexParser.default;class v extends p{constructor(){super(...arguments),this.openCount=0}get kind(){return"auto open"}get isOpen(){return!0}toMml(t=!0,e){if(!t)return super.toMml(t,e);const a=this.factory.configuration.parser,r=this.getProperty("right");if(this.getProperty("smash")){const t=super.toMml(),e=a.create("node","mpadded",[t],{height:0,depth:0});this.Clear(),this.Push(a.create("node","TeXAtom",[e]))}r&&this.Push(new x(r,a.stack.env,a.configuration).mml());const n=d.fenced(this.factory.configuration,this.getProperty("open"),super.toMml(),this.getProperty("close"),this.getProperty("big"));return h.removeProperties(n,"open","close","texClass"),n}closing(t){return t===this.getProperty("close")&&!this.openCount--}checkItem(t){if(t.getProperty("pre-autoclose"))return p.fail;if(t.getProperty("autoclose"))return this.getProperty("ignore")?(this.Clear(),[[],!0]):[[this.toMml()],!0];if(t.isKind("mml")&&1===t.Size()){const e=t.toMml();e.isKind("mo")&&e.getText()===this.getProperty("open")&&this.openCount++}return super.checkItem(t)}}v.errors=Object.assign(Object.create(p.errors),{stop:["ExtraOrMissingDelims","Extra open or missing close delimiter"]});const f=MathJax._.input.tex.TokenMap,y=(f.parseResult,f.AbstractTokenMap,f.RegExpMap,f.AbstractParseMap,f.CharacterMap),M=(f.DelimiterMap,f.MacroMap),P=f.CommandMap,q=f.EnvironmentMap,A=MathJax._.input.tex.base.BaseMethods,$=(A.splitAlignArray,A.default),b=MathJax._.input.tex.TexError.default,G=MathJax._.core.MmlTree.MmlNode,N=G.TEXCLASS,k=(G.TEXCLASSNAMES,G.MATHVARIANTS,G.indentAttributes,G.AbstractMmlNode,G.AbstractMmlTokenNode,G.AbstractMmlLayoutNode,G.AbstractMmlBaseNode,G.AbstractMmlEmptyNode,G.TextNode,G.XMLNode,MathJax._.input.tex.NodeFactory.NodeFactory),E={"(":")","[":"]","{":"}","|":"|"},F=/^(b|B)i(g{1,2})$/,w=[65,90],S=[97,122],C=[913,937],O=[945,969],Q=[48,57];function T(t,e){return t>=e[0]&&t<=e[1]}function D(t,e,a,r){const n=t.configuration.parser,i=k.createToken(t,e,a,r),o=r.codePointAt(0);return 1===r.length&&!n.stack.env.font&&n.stack.env.vectorFont&&(T(o,w)||T(o,S)||T(o,C)||T(o,Q)||T(o,O)&&n.stack.env.vectorStar||h.getAttribute(i,"accent"))&&h.setAttribute(i,"mathvariant",n.stack.env.vectorFont),i}function B(t,e,a,r,n){const i=new x(r,t.stack.env,t.configuration).mml();t.Push(t.itemFactory.create(e,i));const o=t.GetNext(),s=E[o];if(!s)return;let c="",l="",m="";const u=n.includes(o);if("{"===o){m=t.GetArgument(a),c=u?"\\left\\{":"",l=u?"\\right\\}":"";const e=`${c} ${m} ${l}`;return t.string=e+t.string.slice(t.i),void(t.i=0)}u&&(t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:o,close:s})))}function I([t,e,a],r,n){return r&&n?`\\left\\langle{${t}}\\middle\\vert{${e}}\\middle\\vert{${a}}\\right\\rangle`:r?`\\langle{${t}}\\vert{${e}}\\vert{${a}}\\rangle`:`\\left\\langle{${t}}\\right\\vert{${e}}\\left\\vert{${a}}\\right\\rangle`}const V={Quantity(t,e,a="(",r=")",n=!1,i="",o=""){const s=!!n&&t.GetStar();let c=t.GetNext();const l=t.i;let m=null;if("\\"===c){if(t.i++,m=t.GetCS(),!m.match(F)){const e=t.create("node","mrow");return t.Push(d.fenced(t.configuration,a,e,r)),void(t.i=l)}c=t.GetNext()}let u=E[c];if(n&&"{"!==c)throw new b("MissingArgFor","Missing argument for %1",t.currentCS);if(!u){const e=t.create("node","mrow");return t.Push(d.fenced(t.configuration,a,e,r)),void(t.i=l)}if(i){const e=t.create("token","mi",{texClass:N.OP},i);o&&h.setAttribute(e,"mathvariant",o),t.Push(t.itemFactory.create("fn",e))}if("{"===c){let i=t.GetArgument(e);return c=n?a:"\\{",u=n?r:"\\}",i=s?`${c} ${i} ${u}`:m?`\\${m}l${c} ${i} \\${m}r${u}`:`\\left${c} ${i} \\right${u}`,void t.Push(new x(i,t.stack.env,t.configuration).mml())}t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:c,close:u,big:m}))},Eval(t,e){const a=t.GetStar(),r=t.GetNext();if("("===r||"["===r)return t.i++,void t.Push(t.itemFactory.create("auto open").setProperties({open:r,close:"|",smash:a,right:"\\vphantom{\\int}"}));let n="\\left.\\vphantom{\\int}\\right|";if("{"===r){const r=t.GetArgument(e);n=`\\left.${a?`\\smash{${r}}`:r}\\vphantom{\\int}\\right|`}t.string=t.string.substring(0,t.i)+n+t.string.slice(t.i)},Commutator(t,e,a="[",r="]"){const n=t.GetStar();let i=t.GetNext(),o=null;if("\\"===i){if(t.i++,o=t.GetCS(),!o.match(F))throw new b("MissingArgFor","Missing argument for %1",t.currentCS);i=t.GetNext()}if("{"!==i)throw new b("MissingArgFor","Missing argument for %1",t.currentCS);let s=t.GetArgument(e)+","+t.GetArgument(e);s=n?`${a} ${s} ${r}`:o?`\\${o}l${a} ${s} \\${o}r${r}`:`\\left${a} ${s} \\right${r}`,t.Push(new x(s,t.stack.env,t.configuration).mml())},VectorBold(t,e){const a=t.GetStar(),r=t.GetArgument(e),n=t.configuration.nodeFactory.get("token"),i=t.stack.env.font;delete t.stack.env.font,t.configuration.nodeFactory.set("token",D),t.stack.env.vectorFont=a?"bold-italic":"bold",t.stack.env.vectorStar=a;const o=new x(r,t.stack.env,t.configuration).mml();i&&(t.stack.env.font=i),delete t.stack.env.vectorFont,delete t.stack.env.vectorStar,t.configuration.nodeFactory.set("token",n),t.Push(o)},StarMacro(t,e,a,...r){const n=t.GetStar(),i=[];if(a)for(let r=i.length;r2&&s.length>2?(l="^{"+(s.length-1)+"}",c=!0):null!=i&&(a>2&&s.length>1&&(c=!0),l=`^{${i}}`,m=l);const u=n?"\\flatfrac":"\\frac",p=s.length>1?s[0]:"",g=s.length>1?s[1]:s[0];let d="";for(let t,e=2;t=s[e];e++)d+=r+" "+t;const h=`${u}{${r}${l}${p}}{${r} ${g}${m} ${d}}`;t.Push(new x(h,t.stack.env,t.configuration).mml()),"("===t.GetNext()&&(t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:"(",close:")",ignore:c})))},Bra(t,e){const a=t.GetStar(),r=t.GetArgument(e);let n="",i=!1,o=!1;if("\\"===t.GetNext()){let e=t.i;t.i++;const a=t.GetCS(),r=t.lookup(c.MACRO,a);r&&"ket"===r.token?(i=!0,e=t.i,o=t.GetStar(),"{"===t.GetNext()?n=t.GetArgument(a,!0):(t.i=e,o=!1)):t.i=e}let s="";s=i?a||o?`\\langle{${r}}\\vert{${n}}\\rangle`:`\\left\\langle{${r}}\\middle\\vert{${n}}\\right\\rangle`:a?`\\langle{${r}}\\vert`:`\\left\\langle{${r}}\\right\\vert{${n}}`,t.Push(new x(s,t.stack.env,t.configuration).mml())},Ket(t,e){const a=t.GetStar(),r=t.GetArgument(e),n=a?`\\vert{${r}}\\rangle`:`\\left\\vert{${r}}\\right\\rangle`;t.Push(new x(n,t.stack.env,t.configuration).mml())},BraKet(t,e){const a=t.GetStar(),r=t.GetArgument(e);let n=null;"{"===t.GetNext()&&(n=t.GetArgument(e,!0));let i="";i=null==n?a?`\\langle{${r}}\\vert{${r}}\\rangle`:`\\left\\langle{${r}}\\middle\\vert{${r}}\\right\\rangle`:a?`\\langle{${r}}\\vert{${n}}\\rangle`:`\\left\\langle{${r}}\\middle\\vert{${n}}\\right\\rangle`,t.Push(new x(i,t.stack.env,t.configuration).mml())},KetBra(t,e){const a=t.GetStar(),r=t.GetArgument(e);let n=null;"{"===t.GetNext()&&(n=t.GetArgument(e,!0));let i="";i=null==n?a?`\\vert{${r}}\\rangle\\!\\langle{${r}}\\vert`:`\\left\\vert{${r}}\\middle\\rangle\\!\\middle\\langle{${r}}\\right\\vert`:a?`\\vert{${r}}\\rangle\\!\\langle{${n}}\\vert`:`\\left\\vert{${r}}\\middle\\rangle\\!\\middle\\langle{${n}}\\right\\vert`,t.Push(new x(i,t.stack.env,t.configuration).mml())},Expectation(t,e){const a=t.GetStar(),r=a&&t.GetStar(),n=t.GetArgument(e);let i=null;"{"===t.GetNext()&&(i=t.GetArgument(e,!0));const o=n&&i?I([i,n,i],a,r):a?`\\langle {${n}} \\rangle`:`\\left\\langle {${n}} \\right\\rangle`;t.Push(new x(o,t.stack.env,t.configuration).mml())},MatrixElement(t,e){const a=t.GetStar(),r=a&&t.GetStar(),n=I([t.GetArgument(e),t.GetArgument(e),t.GetArgument(e)],a,r);t.Push(new x(n,t.stack.env,t.configuration).mml())},MatrixQuantity(t,e,a){const r=t.GetStar(),n=a?"smallmatrix":"array";let i="",o="",s="";switch(t.GetNext()){case"{":i=t.GetArgument(e);break;case"(":t.i++,o=r?"\\lgroup":"(",s=r?"\\rgroup":")",i=t.GetUpTo(e,")");break;case"[":t.i++,o="[",s="]",i=t.GetUpTo(e,"]");break;case"|":t.i++,o="|",s="|",i=t.GetUpTo(e,"|");break;default:o="(",s=")"}const c=(o?"\\left":"")+`${o}\\begin{${n}}{} ${i}\\end{${n}}`+(o?"\\right":"")+s;t.Push(new x(c,t.stack.env,t.configuration).mml())},IdentityMatrix(t,e){const a=t.GetArgument(e),r=parseInt(a,10);if(isNaN(r))throw new b("InvalidNumber","Invalid number");if(r<=1)return t.string="1"+t.string.slice(t.i),void(t.i=0);const n=Array(r).fill("0"),i=[];for(let t=0;t