@twick/visualizer 0.15.16 → 0.15.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/project.js CHANGED
@@ -38,7 +38,7 @@ yield* loop(10, () => rect().opacity(0).opacity(1, 1));
38
38
  // ^ iteration count
39
39
  \`\`\`
40
40
  `;d2(vM,t1());function*vM(r,t){if(typeof r!="number"&&(t=r,r=1/0),r===1/0&&bi().parent===null){ce().error({message:"Tried to execute an infinite loop in the main thread.",remarks:yM,stack:new Error().stack});return}for(let e=0;e<r;e++){const n=t(e);n?yield*n:yield}}d2(LM,t1());function*LM(r,t){const e=bi(),n=Gh().framesToSeconds(1),s=e.time()+r;let a=0;for(;s-n>e.fixed;){const o=t(a);o?yield*o:yield,a+=1}e.time(s)}function Oa(r,t){const e=Object.getPrototypeOf(r);if(e&&!e.threadable){e.threadable=!0;try{const n=typeof t=="string"?t:sL(t),s=Object.getOwnPropertyDescriptor(e,"name");(!s||s.writable)&&(e.name=n)}catch{}}}function sL(r){return Object.getPrototypeOf(r).name??null}function NQ(r,t){let e;return typeof r=="string"?(e=t(),Oa(e,r)):(e=r(),Oa(e,e)),e}d2(xM,t1());function*xM(r,...t){for(const e of t)yield e,yield*Kt(r);yield*Wo(...t)}var qo=class si{constructor(t){this.owner=t,this.dependencies=new Set,this.event=new bH,this.markDirty=()=>this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}static collectPromise(t,e=null){const n={promise:t,value:e,stack:new Error().stack},s=this.collectionStack.at(-1);return s&&(n.owner=s.owner),t.then(a=>{n.value=a,s==null||s.markDirty()}),this.promises.push(n),n}static hasPromises(){return this.promises.length>0}static async consumePromises(){const t=[...this.promises];return await Promise.all(t.map(e=>e.promise)),this.promises=this.promises.filter(e=>!t.includes(e)),t}invoke(){}startCollecting(){if(si.collectionSet.has(this))throw new Nh("A circular dependency occurred between signals.",`This can happen when signals reference each other in a loop.
41
- Try using the attached stack trace to locate said loop.`);si.collectionSet.add(this),si.collectionStack.push(this)}finishCollecting(){if(si.collectionSet.delete(this),si.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach(t=>t.unsubscribe(this.markDirty)),this.dependencies.clear()}collect(){const t=si.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){do await si.consumePromises(),this.invokable();while(si.hasPromises());return this.invokable}};qo.collectionSet=new Set;qo.collectionStack=[];qo.promises=[];var n1=qo,zu=Symbol.for("@twick/core/signals/default");function F2(r){return typeof r=="function"}function en(r,t){return F2(r)?()=>t(r()):t(r)}function x1(r){return F2(r)?r():r}var ur=class extends n1{constructor(r,t,e=void 0,n=a=>a,s={}){super(e),this.initial=r,this.interpolation=t,this.parser=n,this.tweening=!1,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),this.initial!==void 0&&(this.current=this.initial,this.markDirty(),F2(this.initial)||(this.last=this.parse(this.initial))),this.extensions={getter:this.getter.bind(this),setter:this.setter.bind(this),tweener:this.tweener.bind(this),...s}}toSignal(){return this.invokable}parse(r){return this.parser(r)}set(r){return this.extensions.setter(r),this.owner}setter(r){return r===zu&&(r=this.initial),this.current===r?this.owner:(this.current=r,this.markDirty(),this.clearDependencies(),F2(r)||(this.last=this.parse(r)),this.owner)}get(){return this.extensions.getter()}getter(){var r;if(this.event.isRaised()&&F2(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(t){ce().error({...Yv(t),inspect:(r=this.owner)==null?void 0:r.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(r,t,e=E5,n=this.interpolation){return r===void 0?this.get():t===void 0?this.set(r):this.createQueue(e,n).to(r,t)}createQueue(r,t){const e=this.get(),n=[],s=NQ("animation chain",function*(){for(;n.length>0;)yield*n.shift()});return s.to=(a,o,l=r,u=t)=>(r=l,t=u,n.push(this.tween(a,o,l,u)),s),s.back=(a,o=r,l=t)=>(r=o,t=l,n.push(this.tween(e,a,r,t)),s),s.wait=a=>(n.push(Kt(a)),s),s.run=a=>(n.push(a),s),s.do=a=>(n.push(NQ(function*(){a()})),s),s}*tween(r,t,e,n){r===zu&&(r=this.initial),this.tweening=!0,yield*this.extensions.tweener(r,t,e,n),this.set(r),this.tweening=!1}*tweener(r,t,e,n){const s=this.get();yield*rr(t,a=>{this.set(n(s,this.parse(x1(r)),e(a)))})}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return this.initial!==void 0&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}getInitial(){return this.initial}raw(){return this.current}isTweening(){return this.tweening}},Zo=class extends ur{constructor(r,t,e,n,s=void 0,a={}){var o;super(void 0,n,s,t,a),this.entries=r,this.signals=[],this.parser=t;for(const l of r){let u,h;Array.isArray(l)?([u,h]=l,(o=h.context).owner??(o.owner=this)):(u=l,h=new ur(en(e,T=>t(T)[l]),Ft,s??this.invokable).toSignal()),this.signals.push([u,h]),Object.defineProperty(this.invokable,u,{value:h})}}toSignal(){return this.invokable}parse(r){return this.parser(r)}getter(){return this.parse(Object.fromEntries(this.signals.map(([r,t])=>[r,t()])))}setter(r){if(F2(r))for(const[t,e]of this.signals)e(()=>this.parser(r())[t]);else{const t=this.parse(r);for(const[e,n]of this.signals)n(t[e])}return this.owner}reset(){for(const[,r]of this.signals)r.reset();return this.owner}save(){for(const[,r]of this.signals)r.save();return this.owner}isInitial(){for(const[,r]of this.signals)if(!r.isInitial())return!1;return!0}raw(){return Object.fromEntries(this.signals.map(([r,t])=>[r,t.context.raw()]))}},_M=class extends n1{constructor(r,t){super(t),this.factory=r,this.markDirty()}toSignal(){return this.invokable}dispose(){super.dispose(),this.last=void 0}invoke(...r){var t;if(this.event.isRaised()){this.clearDependencies(),this.startCollecting();try{this.last=this.factory(...r)}catch(e){ce().error({...Yv(e),inspect:(t=this.owner)==null?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}};function bM(r,t){return new _M(r,t).toSignal()}function M2(r,t=Yr,e){return new ur(r,t,e).toSignal()}var aL=class ji{constructor(t=0,e,n,s){if(this.top=0,this.right=0,this.bottom=0,this.left=0,t!=null){if(Array.isArray(t)&&(s=t[3],n=t[2],e=t[1],t=t[0]),typeof t=="number"){this.top=t,this.right=e!==void 0?e:t,this.bottom=n!==void 0?n:t,this.left=s!==void 0?s:e!==void 0?e:t;return}this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}static createSignal(t,e=ji.lerp){return new Zo(["top","right","bottom","left"],n=>new ji(n),t,e).toSignal()}static lerp(t,e,n){return new ji(Ft(t.top,e.top,n),Ft(t.right,e.right,n),Ft(t.bottom,e.bottom,n),Ft(t.left,e.left,n))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}lerp(t,e){return ji.lerp(this,t,e)}scale(t){return new ji(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new ji(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return ji.symbol}toString(){return`Spacing(${this.top}, ${this.right}, ${this.bottom}, ${this.left})`}toUniform(t,e){t.uniform4f(e,this.top,this.right,this.bottom,this.left)}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}};aL.symbol=Symbol.for("@twick/core/types/Spacing");var oL=aL,lL=1e-6,ze=class ie{constructor(t,e){if(this.x=0,this.y=0,t!=null){if(typeof t!="object"){this.x=t,this.y=e??t;return}if(Array.isArray(t)){this.x=t[0],this.y=t[1];return}if("width"in t){this.x=t.width,this.y=t.height;return}this.x=t.x,this.y=t.y}}static createSignal(t,e=ie.lerp,n){return new Zo(["x","y"],s=>new ie(s),t,e,n).toSignal()}static lerp(t,e,n){let s,a;return typeof n=="number"?s=a=n:(s=n.x,a=n.y),new ie(Ft(t.x,e.x,s),Ft(t.y,e.y,a))}static arcLerp(t,e,n,s=!1,a){return a??(a=t.sub(e).ctg),ie.lerp(t,e,new ie(eL(n,s,a)))}static createArcLerp(t,e){return(n,s,a)=>ie.arcLerp(n,s,a,t,e)}static polarLerp(t,e,n,s=!1,a=ie.zero){t=t.sub(a),e=e.sub(a);const o=t.degrees;let l=e.degrees;o>l!==s&&(l=l+(s?-360:360));const h=Ft(o,l,n)*Xi,T=Ft(t.magnitude,e.magnitude,n);return new ie(T*Math.cos(h)+a.x,T*Math.sin(h)+a.y)}static createPolarLerp(t=!1,e=ie.zero){return(n,s,a)=>ie.polarLerp(n,s,a,t,new ie(e))}static fromOrigin(t){const e=new ie;return t===3||(t&16?e.x=-1:t&32&&(e.x=1),t&4?e.y=-1:t&8&&(e.y=1)),e}static fromScalar(t){return new ie(t,t)}static fromRadians(t){return new ie(Math.cos(t),Math.sin(t))}static fromDegrees(t){return ie.fromRadians(t*Xi)}static radians(t,e){return Math.atan2(e,t)}static degrees(t,e){return ie.radians(t,e)*DH}static magnitude(t,e){return Math.sqrt(t*t+e*e)}static squaredMagnitude(t,e){return t*t+e*e}static angleBetween(t,e){return Math.acos(pe(-1,1,t.dot(e)/(t.magnitude*e.magnitude)))*(t.cross(e)>=0?1:-1)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return ie.magnitude(this.x,this.y)}get squaredMagnitude(){return ie.squaredMagnitude(this.x,this.y)}get normalized(){return this.scale(1/ie.magnitude(this.x,this.y))}get safe(){return new ie(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new ie(-this.x,-this.y)}get floored(){return new ie(Math.floor(this.x),Math.floor(this.y))}get perpendicular(){return new ie(this.y,-this.x)}get radians(){return ie.radians(this.x,this.y)}get degrees(){return ie.degrees(this.x,this.y)}get ctg(){return this.x/this.y}lerp(t,e){return ie.lerp(this,t,e)}getOriginOffset(t){const e=ie.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new ie(this.x*t,this.y*t)}mul(t){const e=new ie(t);return new ie(this.x*e.x,this.y*e.y)}div(t){const e=new ie(t);return new ie(this.x/e.x,this.y/e.y)}add(t){const e=new ie(t);return new ie(this.x+e.x,this.y+e.y)}sub(t){const e=new ie(t);return new ie(this.x-e.x,this.y-e.y)}dot(t){const e=new ie(t);return this.x*e.x+this.y*e.y}cross(t){const e=new ie(t);return this.x*e.y-this.y*e.x}mod(t){const e=new ie(t);return new ie(this.x%e.x,this.y%e.y)}addX(t){return new ie(this.x+t,this.y)}addY(t){return new ie(this.x,this.y+t)}toSymbol(){return ie.symbol}toString(){return`Vector2(${this.x}, ${this.y})`}toUniform(t,e){t.uniform2f(e,this.x,this.y)}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}equals(t,e=lL){return Math.abs(this.x-t.x)<=e+Number.EPSILON&&Math.abs(this.y-t.y)<=e+Number.EPSILON}};ze.symbol=Symbol.for("@twick/core/types/Vector2");ze.zero=new ze;ze.one=new ze(1,1);ze.right=new ze(1,0);ze.left=new ze(-1,0);ze.up=new ze(0,1);ze.down=new ze(0,-1);ze.top=new ze(0,-1);ze.bottom=new ze(0,1);ze.topLeft=new ze(-1,-1);ze.topRight=new ze(1,-1);ze.bottomLeft=new ze(-1,1);ze.bottomRight=new ze(1,1);var Z=ze,dn=class u2{constructor(t,e,n,s,a,o){if(this.values=new Float32Array(6),arguments.length===0){this.values=new Float32Array([1,0,0,1,0,0]);return}if(arguments.length===6){this.values[0]=t,this.values[1]=e,this.values[2]=n,this.values[3]=s,this.values[4]=a,this.values[5]=o;return}if(t instanceof DOMMatrix){this.values[0]=t.m11,this.values[1]=t.m12,this.values[2]=t.m21,this.values[3]=t.m22,this.values[4]=t.m41,this.values[5]=t.m42;return}if(t instanceof u2){this.values=t.values;return}if(Array.isArray(t)){if(t.length===2){this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=n[0],this.values[5]=n[1];return}if(t.length===3){const T=new Z(t[0]),f=new Z(t[1]),d=new Z(t[2]);this.values[0]=T.x,this.values[1]=T.y,this.values[2]=f.x,this.values[3]=f.y,this.values[4]=d.x,this.values[5]=d.y;return}this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],this.values[5]=t[5];return}const l=new Z(t),u=new Z(e),h=new Z(n);this.values[0]=l.x,this.values[1]=l.y,this.values[2]=u.x,this.values[3]=u.y,this.values[4]=h.x,this.values[5]=h.y}static fromRotation(t){return u2.identity.rotate(t)}static fromTranslation(t){return u2.identity.translate(new Z(t))}static fromScaling(t){return u2.identity.scale(new Z(t))}get x(){return new Z(this.values[0],this.values[1])}get y(){return new Z(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}get skewX(){return this.values[1]}set skewX(t){this.values[1]=t}get scaleY(){return this.values[3]}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get skewY(){return this.values[2]}set skewY(t){this.values[2]=t}get translateX(){return this.values[4]}set translateX(t){this.values[4]=t}get translateY(){return this.values[5]}set translateY(t){this.values[5]=t}get rotation(){return Z.degrees(this.values[0],this.values[1])}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get translation(){return new Z(this.values[4],this.values[5])}set translation(t){const e=new Z(t);this.values[4]=e.x,this.values[5]=e.y}get scaling(){return new Z(this.values[0],this.values[3])}set scaling(t){const e=new Z(t),n=new Z(this.values[0],this.values[1]).normalized,s=new Z(this.values[2],this.values[3]).normalized;this.values[0]=n.x*e.x,this.values[1]=n.y*e.y,this.values[2]=s.x*e.x,this.values[3]=s.y*e.y}get inverse(){const t=this.values[0],e=this.values[1],n=this.values[2],s=this.values[3],a=this.values[4],o=this.values[5];let l=t*s-e*n;return l?(l=1/l,new u2(s*l,-e*l,-n*l,t*l,(n*o-s*a)*l,(e*a-t*o)*l)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}column(t){return new Z(this.values[t*2],this.values[t*2+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],n=this.values[1],s=this.values[2],a=this.values[3],o=this.values[4],l=this.values[5],u=t.values[0],h=t.values[1],T=t.values[2],f=t.values[3],d=t.values[4],p=t.values[5];return new u2(e*u+s*h,n*u+a*h,e*T+s*f,n*T+a*f,e*d+s*p+o,n*d+a*p+l)}rotate(t,e=!0){e&&(t*=Xi);const n=this.values[0],s=this.values[1],a=this.values[2],o=this.values[3],l=this.values[4],u=this.values[5],h=Math.sin(t),T=Math.cos(t);return new u2(n*T+a*h,s*T+o*h,n*-h+a*T,s*-h+o*T,l,u)}scale(t){const e=new Z(t);return new u2(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new u2(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new Z(t);return new u2(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new u2(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new u2(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}toSymbol(){return u2.symbol}toUniform(t,e){t.uniformMatrix3x2fv(e,!1,this.values)}equals(t,e=lL){return Math.abs(this.values[0]-t.values[0])<=e+Number.EPSILON&&Math.abs(this.values[1]-t.values[1])<=e+Number.EPSILON&&Math.abs(this.values[2]-t.values[2])<=e+Number.EPSILON&&Math.abs(this.values[3]-t.values[3])<=e+Number.EPSILON&&Math.abs(this.values[4]-t.values[4])<=e+Number.EPSILON&&Math.abs(this.values[5]-t.values[5])<=e+Number.EPSILON}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}};dn.symbol=Symbol.for("@twick/core/types/Matrix2D");dn.identity=new dn(1,0,0,1,0,0);dn.zero=new dn(0,0,0,0,0,0);var A5=dn;function Q1(r,t){const e=new A5(t);return new Z(r.x*e.scaleX+r.y*e.skewY+e.translateX,r.x*e.skewX+r.y*e.scaleY+e.translateY)}function hi(r,t){const e=new A5(t);return new Z(r.x*e.scaleX+r.y*e.skewY,r.x*e.skewX+r.y*e.scaleY)}var uL=class i2{constructor(t,e=0,n=0,s=0){if(this.x=0,this.y=0,this.width=0,this.height=0,t!=null){if(typeof t=="number"){this.x=t,this.y=e,this.width=n,this.height=s;return}if(t instanceof Z){this.x=t.x,this.y=t.y,e instanceof Z&&(this.width=e.x,this.height=e.y);return}if(Array.isArray(t)){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3];return}this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}}static createSignal(t,e=i2.lerp){return new Zo(["x","y","width","height"],n=>new i2(n),t,e).toSignal()}static lerp(t,e,n){let s,a,o,l;return typeof n=="number"?s=a=o=l=n:n instanceof Z?(s=o=n.x,a=l=n.y):(s=n.x,a=n.y,o=n.width,l=n.height),new i2(Ft(t.x,e.x,s),Ft(t.y,e.y,a),Ft(t.width,e.width,o),Ft(t.height,e.height,l))}static arcLerp(t,e,n,s=!1,a){return a??(a=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),i2.lerp(t,e,new Z(eL(n,s,a)))}static fromSizeCentered(t){return new i2(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(...t){let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const o of t)o.x>s&&(s=o.x),o.x<e&&(e=o.x),o.y>a&&(a=o.y),o.y<n&&(n=o.y);return new i2(e,n,s-e,a-n)}static fromBBoxes(...t){let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const o of t){const l=o.x+o.width;l>s&&(s=l),o.x<e&&(e=o.x);const u=o.y+o.height;u>a&&(a=u),o.y<n&&(n=o.y)}return new i2(e,n,s-e,a-n)}lerp(t,e){return i2.lerp(this,t,e)}get position(){return new Z(this.x,this.y)}set position(t){this.x=t.x,this.y=t.y}get size(){return new Z(this.width,this.height)}get center(){return new Z(this.x+this.width/2,this.y+this.height/2)}get left(){return this.x}set left(t){this.width+=this.x-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get top(){return this.y}set top(t){this.height+=this.y-t,this.y=t}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get topLeft(){return this.position}get topRight(){return new Z(this.x+this.width,this.y)}get bottomLeft(){return new Z(this.x,this.y+this.height)}get bottomRight(){return new Z(this.x+this.width,this.y+this.height)}get corners(){return[this.topLeft,this.topRight,this.bottomRight,this.bottomLeft]}get pixelPerfect(){return new i2(Math.floor(this.x),Math.floor(this.y),Math.ceil(this.width+1),Math.ceil(this.height+1))}transform(t){return new i2(Q1(this.position,t),hi(this.size,t))}transformCorners(t){return this.corners.map(e=>Q1(e,t))}expand(t){const e=new oL(t),n=new i2(this);return n.left-=e.left,n.top-=e.top,n.right+=e.right,n.bottom+=e.bottom,n}addSpacing(t){return this.expand(t)}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top}intersection(t){const e=new i2;return this.intersects(t)&&(e.left=Math.max(this.left,t.left),e.top=Math.max(this.top,t.top),e.right=Math.min(this.right,t.right),e.bottom=Math.min(this.bottom,t.bottom)),e}union(t){const e=new i2;return e.left=Math.min(this.left,t.left),e.top=Math.min(this.top,t.top),e.right=Math.max(this.right,t.right),e.bottom=Math.max(this.bottom,t.bottom),e}toSymbol(){return i2.symbol}toString(){return`BBox(${this.x}, ${this.y}, ${this.width}, ${this.height})`}toUniform(t,e){t.uniform4f(e,this.x,this.y,this.width,this.height)}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}};uL.symbol=Symbol.for("@twick/core/types/Rect");var ue=uL;function SM(r){const t=r>>16&255,e=r>>8&255,n=r&255;return[t/255,e/255,n/255,1]}var cL=class y2{constructor(t){if(this.symbol=y2.symbol,t==null){this.r=0,this.g=0,this.b=0,this.a=1;return}if(t instanceof y2){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;return}if(typeof t=="string"){const e=bv(t);if(!e)throw new Error(`Invalid color string value provided: ${t}`);const n=e.mode==="rgb"?e:_5("rgb")(e);if(n){this.r=pe(0,1,n.r),this.g=pe(0,1,n.g),this.b=pe(0,1,n.b),this.a=pe(0,1,n.alpha??1);return}}if(typeof t=="number"){const[e,n,s,a]=SM(t);this.r=pe(0,1,e),this.g=pe(0,1,n),this.b=pe(0,1,s),this.a=pe(0,1,a);return}if(typeof t=="object"&&"r"in t&&"g"in t&&"b"in t){const e=t;this.r=pe(0,1,e.r/255),this.g=pe(0,1,e.g/255),this.b=pe(0,1,e.b/255),this.a=pe(0,1,e.a??1);return}throw new Error(`Invalid color value provided: ${t}`)}static lerp(t,e,n,s="lch"){const a=t instanceof y2?t:new y2(t??void 0),o=e instanceof y2?e:new y2(e??void 0),l={mode:"rgb",r:a.r,g:a.g,b:a.b},u={mode:"rgb",r:o.r,g:o.g,b:o.b},f=_H([l,u],s??"lch")(n),p=_5("rgb")(f),m=a.a+(o.a-a.a)*n,y=p?pe(0,1,p.r):0,c=p?pe(0,1,p.g):0,Q=p?pe(0,1,p.b):0;return new y2({r:y*255,g:c*255,b:Q*255,a:pe(0,1,m)})}static createLerp(t="lch"){return(e,n,s)=>y2.lerp(e,n,s,t)}static createSignal(t,e=y2.lerp){return new ur(t,e,void 0,n=>n instanceof y2?n:new y2(n)).toSignal()}toSymbol(){return this.symbol}gl(){return[this.r,this.g,this.b,this.a]}toUniform(t,e){t.uniform4fv(e,this.gl())}serialize(){const t=Math.round(this.r*255),e=Math.round(this.g*255),n=Math.round(this.b*255),s=pe(0,1,this.a).toFixed(3);return`rgba(${t}, ${e}, ${n}, ${s})`}css(){const t=Math.round(this.r*255),e=Math.round(this.g*255),n=Math.round(this.b*255);return`rgb(${t},${e},${n})`}alpha(){return this.a}hex(){return yH({mode:"rgb",r:this.r,g:this.g,b:this.b,alpha:this.a})}lerp(t,e,n="lch"){return y2.lerp(this,t,e,n)}};cL.symbol=Symbol.for("@twick/core/types/Color");var T2=cL;function EM(r,t){const e=Z.fromDegrees(r);return hi(e,t).degrees}function Wu(r,t){return Z.magnitude(t.m11,t.m12)*r}function AM(r){if(r===3)return Z.zero;let t=0;r&16?t=-1:r&32&&(t=1);let e=0;return r&4?e=-1:r&8&&(e=1),new Z(t,e)}function HM(r){return{core:r,two:r,ui:r,vitePlugin:r}}var rs={shared:{background:"FFFFFF00",range:[0,1/0],size:{x:1920,y:1080}},rendering:{exporter:{name:"@twick/core/wasm"},fps:30,resolutionScale:1,colorSpace:"srgb"},preview:{fps:30,resolutionScale:1}};function MM(r){var n,s,a;const t={...rs,...r.settings,shared:{...rs.shared,...(n=r.settings)==null?void 0:n.shared},rendering:{...rs.rendering,...(s=r.settings)==null?void 0:s.rendering},preview:{...rs.preview,...(a=r.settings)==null?void 0:a.preview}},e={...t,shared:{...t.shared,background:new T2(t.shared.background),size:new Z(t.shared.size)}};return{...r,name:r.name??"project",settings:e,plugins:[],logger:new EH,versions:HM("0.10.4")}}var r2=(r=>(r[r.Playing=0]="Playing",r[r.Rendering=1]="Rendering",r[r.Paused=2]="Paused",r[r.Presenting=3]="Presenting",r))(r2||{});function wM(r){return r&&(typeof r=="object"||typeof r=="function")&&"toPromise"in r}function hL(r){return r!==null&&typeof r=="object"&&Symbol.iterator in r&&"next"in r}var CM=`
41
+ Try using the attached stack trace to locate said loop.`);si.collectionSet.add(this),si.collectionStack.push(this)}finishCollecting(){if(si.collectionSet.delete(this),si.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach(t=>t.unsubscribe(this.markDirty)),this.dependencies.clear()}collect(){const t=si.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){do await si.consumePromises(),this.invokable();while(si.hasPromises());return this.invokable}};qo.collectionSet=new Set;qo.collectionStack=[];qo.promises=[];var n1=qo,zu=Symbol.for("@twick/core/signals/default");function F2(r){return typeof r=="function"}function en(r,t){return F2(r)?()=>t(r()):t(r)}function x1(r){return F2(r)?r():r}var ur=class extends n1{constructor(r,t,e=void 0,n=a=>a,s={}){super(e),this.initial=r,this.interpolation=t,this.parser=n,this.tweening=!1,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),this.initial!==void 0&&(this.current=this.initial,this.markDirty(),F2(this.initial)||(this.last=this.parse(this.initial))),this.extensions={getter:this.getter.bind(this),setter:this.setter.bind(this),tweener:this.tweener.bind(this),...s}}toSignal(){return this.invokable}parse(r){return this.parser(r)}set(r){return this.extensions.setter(r),this.owner}setter(r){return r===zu&&(r=this.initial),this.current===r?this.owner:(this.current=r,this.markDirty(),this.clearDependencies(),F2(r)||(this.last=this.parse(r)),this.owner)}get(){return this.extensions.getter()}getter(){var r;if(this.event.isRaised()&&F2(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(t){ce().error({...Yv(t),inspect:(r=this.owner)==null?void 0:r.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(r,t,e=E5,n=this.interpolation){return r===void 0?this.get():t===void 0?this.set(r):this.createQueue(e,n).to(r,t)}createQueue(r,t){const e=this.get(),n=[],s=NQ("animation chain",function*(){for(;n.length>0;)yield*n.shift()});return s.to=(a,o,l=r,u=t)=>(r=l,t=u,n.push(this.tween(a,o,l,u)),s),s.back=(a,o=r,l=t)=>(r=o,t=l,n.push(this.tween(e,a,r,t)),s),s.wait=a=>(n.push(Kt(a)),s),s.run=a=>(n.push(a),s),s.do=a=>(n.push(NQ(function*(){a()})),s),s}*tween(r,t,e,n){r===zu&&(r=this.initial),this.tweening=!0,yield*this.extensions.tweener(r,t,e,n),this.set(r),this.tweening=!1}*tweener(r,t,e,n){const s=this.get();yield*rr(t,a=>{this.set(n(s,this.parse(x1(r)),e(a)))})}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return this.initial!==void 0&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}getInitial(){return this.initial}raw(){return this.current}isTweening(){return this.tweening}},Zo=class extends ur{constructor(r,t,e,n,s=void 0,a={}){var o;super(void 0,n,s,t,a),this.entries=r,this.signals=[],this.parser=t;for(const l of r){let u,h;Array.isArray(l)?([u,h]=l,(o=h.context).owner??(o.owner=this)):(u=l,h=new ur(en(e,T=>t(T)[l]),Ft,s??this.invokable).toSignal()),this.signals.push([u,h]),Object.defineProperty(this.invokable,u,{value:h})}}toSignal(){return this.invokable}parse(r){return this.parser(r)}getter(){return this.parse(Object.fromEntries(this.signals.map(([r,t])=>[r,t()])))}setter(r){if(F2(r))for(const[t,e]of this.signals)e(()=>this.parser(r())[t]);else{const t=this.parse(r);for(const[e,n]of this.signals)n(t[e])}return this.owner}reset(){for(const[,r]of this.signals)r.reset();return this.owner}save(){for(const[,r]of this.signals)r.save();return this.owner}isInitial(){for(const[,r]of this.signals)if(!r.isInitial())return!1;return!0}raw(){return Object.fromEntries(this.signals.map(([r,t])=>[r,t.context.raw()]))}},_M=class extends n1{constructor(r,t){super(t),this.factory=r,this.markDirty()}toSignal(){return this.invokable}dispose(){super.dispose(),this.last=void 0}invoke(...r){var t;if(this.event.isRaised()){this.clearDependencies(),this.startCollecting();try{this.last=this.factory(...r)}catch(e){ce().error({...Yv(e),inspect:(t=this.owner)==null?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}};function bM(r,t){return new _M(r,t).toSignal()}function M2(r,t=Yr,e){return new ur(r,t,e).toSignal()}var aL=class ji{constructor(t=0,e,n,s){if(this.top=0,this.right=0,this.bottom=0,this.left=0,t!=null){if(Array.isArray(t)&&(s=t[3],n=t[2],e=t[1],t=t[0]),typeof t=="number"){this.top=t,this.right=e!==void 0?e:t,this.bottom=n!==void 0?n:t,this.left=s!==void 0?s:e!==void 0?e:t;return}this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}static createSignal(t,e=ji.lerp){return new Zo(["top","right","bottom","left"],n=>new ji(n),t,e).toSignal()}static lerp(t,e,n){return new ji(Ft(t.top,e.top,n),Ft(t.right,e.right,n),Ft(t.bottom,e.bottom,n),Ft(t.left,e.left,n))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}lerp(t,e){return ji.lerp(this,t,e)}scale(t){return new ji(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new ji(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return ji.symbol}toString(){return`Spacing(${this.top}, ${this.right}, ${this.bottom}, ${this.left})`}toUniform(t,e){t.uniform4f(e,this.top,this.right,this.bottom,this.left)}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}};aL.symbol=Symbol.for("@twick/core/types/Spacing");var oL=aL,lL=1e-6,ze=class ie{constructor(t,e){if(this.x=0,this.y=0,t!=null){if(typeof t!="object"){this.x=t,this.y=e??t;return}if(Array.isArray(t)){this.x=t[0],this.y=t[1];return}if("width"in t){this.x=t.width,this.y=t.height;return}this.x=t.x,this.y=t.y}}static createSignal(t,e=ie.lerp,n){return new Zo(["x","y"],s=>new ie(s),t,e,n).toSignal()}static lerp(t,e,n){let s,a;return typeof n=="number"?s=a=n:(s=n.x,a=n.y),new ie(Ft(t.x,e.x,s),Ft(t.y,e.y,a))}static arcLerp(t,e,n,s=!1,a){return a??(a=t.sub(e).ctg),ie.lerp(t,e,new ie(eL(n,s,a)))}static createArcLerp(t,e){return(n,s,a)=>ie.arcLerp(n,s,a,t,e)}static polarLerp(t,e,n,s=!1,a=ie.zero){t=t.sub(a),e=e.sub(a);const o=t.degrees;let l=e.degrees;o>l!==s&&(l=l+(s?-360:360));const h=Ft(o,l,n)*Xi,T=Ft(t.magnitude,e.magnitude,n);return new ie(T*Math.cos(h)+a.x,T*Math.sin(h)+a.y)}static createPolarLerp(t=!1,e=ie.zero){return(n,s,a)=>ie.polarLerp(n,s,a,t,new ie(e))}static fromOrigin(t){const e=new ie;return t===3||(t&16?e.x=-1:t&32&&(e.x=1),t&4?e.y=-1:t&8&&(e.y=1)),e}static fromScalar(t){return new ie(t,t)}static fromRadians(t){return new ie(Math.cos(t),Math.sin(t))}static fromDegrees(t){return ie.fromRadians(t*Xi)}static radians(t,e){return Math.atan2(e,t)}static degrees(t,e){return ie.radians(t,e)*DH}static magnitude(t,e){return Math.sqrt(t*t+e*e)}static squaredMagnitude(t,e){return t*t+e*e}static angleBetween(t,e){return Math.acos(pe(-1,1,t.dot(e)/(t.magnitude*e.magnitude)))*(t.cross(e)>=0?1:-1)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return ie.magnitude(this.x,this.y)}get squaredMagnitude(){return ie.squaredMagnitude(this.x,this.y)}get normalized(){return this.scale(1/ie.magnitude(this.x,this.y))}get safe(){return new ie(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new ie(-this.x,-this.y)}get floored(){return new ie(Math.floor(this.x),Math.floor(this.y))}get perpendicular(){return new ie(this.y,-this.x)}get radians(){return ie.radians(this.x,this.y)}get degrees(){return ie.degrees(this.x,this.y)}get ctg(){return this.x/this.y}lerp(t,e){return ie.lerp(this,t,e)}getOriginOffset(t){const e=ie.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new ie(this.x*t,this.y*t)}mul(t){const e=new ie(t);return new ie(this.x*e.x,this.y*e.y)}div(t){const e=new ie(t);return new ie(this.x/e.x,this.y/e.y)}add(t){const e=new ie(t);return new ie(this.x+e.x,this.y+e.y)}sub(t){const e=new ie(t);return new ie(this.x-e.x,this.y-e.y)}dot(t){const e=new ie(t);return this.x*e.x+this.y*e.y}cross(t){const e=new ie(t);return this.x*e.y-this.y*e.x}mod(t){const e=new ie(t);return new ie(this.x%e.x,this.y%e.y)}addX(t){return new ie(this.x+t,this.y)}addY(t){return new ie(this.x,this.y+t)}toSymbol(){return ie.symbol}toString(){return`Vector2(${this.x}, ${this.y})`}toUniform(t,e){t.uniform2f(e,this.x,this.y)}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}equals(t,e=lL){return Math.abs(this.x-t.x)<=e+Number.EPSILON&&Math.abs(this.y-t.y)<=e+Number.EPSILON}};ze.symbol=Symbol.for("@twick/core/types/Vector2");ze.zero=new ze;ze.one=new ze(1,1);ze.right=new ze(1,0);ze.left=new ze(-1,0);ze.up=new ze(0,1);ze.down=new ze(0,-1);ze.top=new ze(0,-1);ze.bottom=new ze(0,1);ze.topLeft=new ze(-1,-1);ze.topRight=new ze(1,-1);ze.bottomLeft=new ze(-1,1);ze.bottomRight=new ze(1,1);var Z=ze,dn=class u2{constructor(t,e,n,s,a,o){if(this.values=new Float32Array(6),arguments.length===0){this.values=new Float32Array([1,0,0,1,0,0]);return}if(arguments.length===6){this.values[0]=t,this.values[1]=e,this.values[2]=n,this.values[3]=s,this.values[4]=a,this.values[5]=o;return}if(t instanceof DOMMatrix){this.values[0]=t.m11,this.values[1]=t.m12,this.values[2]=t.m21,this.values[3]=t.m22,this.values[4]=t.m41,this.values[5]=t.m42;return}if(t instanceof u2){this.values=t.values;return}if(Array.isArray(t)){if(t.length===2){this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=n[0],this.values[5]=n[1];return}if(t.length===3){const T=new Z(t[0]),f=new Z(t[1]),d=new Z(t[2]);this.values[0]=T.x,this.values[1]=T.y,this.values[2]=f.x,this.values[3]=f.y,this.values[4]=d.x,this.values[5]=d.y;return}this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],this.values[5]=t[5];return}const l=new Z(t),u=new Z(e),h=new Z(n);this.values[0]=l.x,this.values[1]=l.y,this.values[2]=u.x,this.values[3]=u.y,this.values[4]=h.x,this.values[5]=h.y}static fromRotation(t){return u2.identity.rotate(t)}static fromTranslation(t){return u2.identity.translate(new Z(t))}static fromScaling(t){return u2.identity.scale(new Z(t))}get x(){return new Z(this.values[0],this.values[1])}get y(){return new Z(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}get skewX(){return this.values[1]}set skewX(t){this.values[1]=t}get scaleY(){return this.values[3]}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get skewY(){return this.values[2]}set skewY(t){this.values[2]=t}get translateX(){return this.values[4]}set translateX(t){this.values[4]=t}get translateY(){return this.values[5]}set translateY(t){this.values[5]=t}get rotation(){return Z.degrees(this.values[0],this.values[1])}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get translation(){return new Z(this.values[4],this.values[5])}set translation(t){const e=new Z(t);this.values[4]=e.x,this.values[5]=e.y}get scaling(){return new Z(this.values[0],this.values[3])}set scaling(t){const e=new Z(t),n=new Z(this.values[0],this.values[1]).normalized,s=new Z(this.values[2],this.values[3]).normalized;this.values[0]=n.x*e.x,this.values[1]=n.y*e.y,this.values[2]=s.x*e.x,this.values[3]=s.y*e.y}get inverse(){const t=this.values[0],e=this.values[1],n=this.values[2],s=this.values[3],a=this.values[4],o=this.values[5];let l=t*s-e*n;return l?(l=1/l,new u2(s*l,-e*l,-n*l,t*l,(n*o-s*a)*l,(e*a-t*o)*l)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}column(t){return new Z(this.values[t*2],this.values[t*2+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],n=this.values[1],s=this.values[2],a=this.values[3],o=this.values[4],l=this.values[5],u=t.values[0],h=t.values[1],T=t.values[2],f=t.values[3],d=t.values[4],p=t.values[5];return new u2(e*u+s*h,n*u+a*h,e*T+s*f,n*T+a*f,e*d+s*p+o,n*d+a*p+l)}rotate(t,e=!0){e&&(t*=Xi);const n=this.values[0],s=this.values[1],a=this.values[2],o=this.values[3],l=this.values[4],u=this.values[5],h=Math.sin(t),T=Math.cos(t);return new u2(n*T+a*h,s*T+o*h,n*-h+a*T,s*-h+o*T,l,u)}scale(t){const e=new Z(t);return new u2(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new u2(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new Z(t);return new u2(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new u2(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new u2(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}toSymbol(){return u2.symbol}toUniform(t,e){t.uniformMatrix3x2fv(e,!1,this.values)}equals(t,e=lL){return Math.abs(this.values[0]-t.values[0])<=e+Number.EPSILON&&Math.abs(this.values[1]-t.values[1])<=e+Number.EPSILON&&Math.abs(this.values[2]-t.values[2])<=e+Number.EPSILON&&Math.abs(this.values[3]-t.values[3])<=e+Number.EPSILON&&Math.abs(this.values[4]-t.values[4])<=e+Number.EPSILON&&Math.abs(this.values[5]-t.values[5])<=e+Number.EPSILON}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}};dn.symbol=Symbol.for("@twick/core/types/Matrix2D");dn.identity=new dn(1,0,0,1,0,0);dn.zero=new dn(0,0,0,0,0,0);var A5=dn;function Q1(r,t){const e=new A5(t);return new Z(r.x*e.scaleX+r.y*e.skewY+e.translateX,r.x*e.skewX+r.y*e.scaleY+e.translateY)}function hi(r,t){const e=new A5(t);return new Z(r.x*e.scaleX+r.y*e.skewY,r.x*e.skewX+r.y*e.scaleY)}var uL=class r2{constructor(t,e=0,n=0,s=0){if(this.x=0,this.y=0,this.width=0,this.height=0,t!=null){if(typeof t=="number"){this.x=t,this.y=e,this.width=n,this.height=s;return}if(t instanceof Z){this.x=t.x,this.y=t.y,e instanceof Z&&(this.width=e.x,this.height=e.y);return}if(Array.isArray(t)){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3];return}this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}}static createSignal(t,e=r2.lerp){return new Zo(["x","y","width","height"],n=>new r2(n),t,e).toSignal()}static lerp(t,e,n){let s,a,o,l;return typeof n=="number"?s=a=o=l=n:n instanceof Z?(s=o=n.x,a=l=n.y):(s=n.x,a=n.y,o=n.width,l=n.height),new r2(Ft(t.x,e.x,s),Ft(t.y,e.y,a),Ft(t.width,e.width,o),Ft(t.height,e.height,l))}static arcLerp(t,e,n,s=!1,a){return a??(a=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),r2.lerp(t,e,new Z(eL(n,s,a)))}static fromSizeCentered(t){return new r2(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(...t){let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const o of t)o.x>s&&(s=o.x),o.x<e&&(e=o.x),o.y>a&&(a=o.y),o.y<n&&(n=o.y);return new r2(e,n,s-e,a-n)}static fromBBoxes(...t){let e=1/0,n=1/0,s=-1/0,a=-1/0;for(const o of t){const l=o.x+o.width;l>s&&(s=l),o.x<e&&(e=o.x);const u=o.y+o.height;u>a&&(a=u),o.y<n&&(n=o.y)}return new r2(e,n,s-e,a-n)}lerp(t,e){return r2.lerp(this,t,e)}get position(){return new Z(this.x,this.y)}set position(t){this.x=t.x,this.y=t.y}get size(){return new Z(this.width,this.height)}get center(){return new Z(this.x+this.width/2,this.y+this.height/2)}get left(){return this.x}set left(t){this.width+=this.x-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get top(){return this.y}set top(t){this.height+=this.y-t,this.y=t}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get topLeft(){return this.position}get topRight(){return new Z(this.x+this.width,this.y)}get bottomLeft(){return new Z(this.x,this.y+this.height)}get bottomRight(){return new Z(this.x+this.width,this.y+this.height)}get corners(){return[this.topLeft,this.topRight,this.bottomRight,this.bottomLeft]}get pixelPerfect(){return new r2(Math.floor(this.x),Math.floor(this.y),Math.ceil(this.width+1),Math.ceil(this.height+1))}transform(t){return new r2(Q1(this.position,t),hi(this.size,t))}transformCorners(t){return this.corners.map(e=>Q1(e,t))}expand(t){const e=new oL(t),n=new r2(this);return n.left-=e.left,n.top-=e.top,n.right+=e.right,n.bottom+=e.bottom,n}addSpacing(t){return this.expand(t)}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top}intersection(t){const e=new r2;return this.intersects(t)&&(e.left=Math.max(this.left,t.left),e.top=Math.max(this.top,t.top),e.right=Math.min(this.right,t.right),e.bottom=Math.min(this.bottom,t.bottom)),e}union(t){const e=new r2;return e.left=Math.min(this.left,t.left),e.top=Math.min(this.top,t.top),e.right=Math.max(this.right,t.right),e.bottom=Math.max(this.bottom,t.bottom),e}toSymbol(){return r2.symbol}toString(){return`BBox(${this.x}, ${this.y}, ${this.width}, ${this.height})`}toUniform(t,e){t.uniform4f(e,this.x,this.y,this.width,this.height)}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}};uL.symbol=Symbol.for("@twick/core/types/Rect");var ue=uL;function SM(r){const t=r>>16&255,e=r>>8&255,n=r&255;return[t/255,e/255,n/255,1]}var cL=class y2{constructor(t){if(this.symbol=y2.symbol,t==null){this.r=0,this.g=0,this.b=0,this.a=1;return}if(t instanceof y2){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a;return}if(typeof t=="string"){const e=bv(t);if(!e)throw new Error(`Invalid color string value provided: ${t}`);const n=e.mode==="rgb"?e:_5("rgb")(e);if(n){this.r=pe(0,1,n.r),this.g=pe(0,1,n.g),this.b=pe(0,1,n.b),this.a=pe(0,1,n.alpha??1);return}}if(typeof t=="number"){const[e,n,s,a]=SM(t);this.r=pe(0,1,e),this.g=pe(0,1,n),this.b=pe(0,1,s),this.a=pe(0,1,a);return}if(typeof t=="object"&&"r"in t&&"g"in t&&"b"in t){const e=t;this.r=pe(0,1,e.r/255),this.g=pe(0,1,e.g/255),this.b=pe(0,1,e.b/255),this.a=pe(0,1,e.a??1);return}throw new Error(`Invalid color value provided: ${t}`)}static lerp(t,e,n,s="lch"){const a=t instanceof y2?t:new y2(t??void 0),o=e instanceof y2?e:new y2(e??void 0),l={mode:"rgb",r:a.r,g:a.g,b:a.b},u={mode:"rgb",r:o.r,g:o.g,b:o.b},f=_H([l,u],s??"lch")(n),p=_5("rgb")(f),m=a.a+(o.a-a.a)*n,y=p?pe(0,1,p.r):0,c=p?pe(0,1,p.g):0,Q=p?pe(0,1,p.b):0;return new y2({r:y*255,g:c*255,b:Q*255,a:pe(0,1,m)})}static createLerp(t="lch"){return(e,n,s)=>y2.lerp(e,n,s,t)}static createSignal(t,e=y2.lerp){return new ur(t,e,void 0,n=>n instanceof y2?n:new y2(n)).toSignal()}toSymbol(){return this.symbol}gl(){return[this.r,this.g,this.b,this.a]}toUniform(t,e){t.uniform4fv(e,this.gl())}serialize(){const t=Math.round(this.r*255),e=Math.round(this.g*255),n=Math.round(this.b*255),s=pe(0,1,this.a).toFixed(3);return`rgba(${t}, ${e}, ${n}, ${s})`}css(){const t=Math.round(this.r*255),e=Math.round(this.g*255),n=Math.round(this.b*255);return`rgb(${t},${e},${n})`}alpha(){return this.a}hex(){return yH({mode:"rgb",r:this.r,g:this.g,b:this.b,alpha:this.a})}lerp(t,e,n="lch"){return y2.lerp(this,t,e,n)}};cL.symbol=Symbol.for("@twick/core/types/Color");var T2=cL;function EM(r,t){const e=Z.fromDegrees(r);return hi(e,t).degrees}function Wu(r,t){return Z.magnitude(t.m11,t.m12)*r}function AM(r){if(r===3)return Z.zero;let t=0;r&16?t=-1:r&32&&(t=1);let e=0;return r&4?e=-1:r&8&&(e=1),new Z(t,e)}function HM(r){return{core:r,two:r,ui:r,vitePlugin:r}}var rs={shared:{background:"FFFFFF00",range:[0,1/0],size:{x:1920,y:1080}},rendering:{exporter:{name:"@twick/core/wasm"},fps:30,resolutionScale:1,colorSpace:"srgb"},preview:{fps:30,resolutionScale:1}};function MM(r){var n,s,a;const t={...rs,...r.settings,shared:{...rs.shared,...(n=r.settings)==null?void 0:n.shared},rendering:{...rs.rendering,...(s=r.settings)==null?void 0:s.rendering},preview:{...rs.preview,...(a=r.settings)==null?void 0:a.preview}},e={...t,shared:{...t.shared,background:new T2(t.shared.background),size:new Z(t.shared.size)}};return{...r,name:r.name??"project",settings:e,plugins:[],logger:new EH,versions:HM("0.10.4")}}var $1=(r=>(r[r.Playing=0]="Playing",r[r.Rendering=1]="Rendering",r[r.Paused=2]="Paused",r[r.Presenting=3]="Presenting",r))($1||{});function wM(r){return r&&(typeof r=="object"||typeof r=="function")&&"toPromise"in r}function hL(r){return r!==null&&typeof r=="object"&&Symbol.iterator in r&&"next"in r}var CM=`
42
42
  This usually happens when you mistakenly reuse a generator that is already
43
43
  running.
44
44
 
@@ -104,23 +104,23 @@ void main() {
104
104
  `,UM=class{constructor(r,t){this.scene=r,this.sharedContext=t,this.gl=null,this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.positionLocation=0,this.quadPositions=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.handleReload=()=>{this.gl&&this.updateViewport()},r.onReloaded.subscribe(this.handleReload)}setup(r){this.gl=r,this.updateViewport(),this.positionBuffer=r.createBuffer(),r.bindBuffer(r.ARRAY_BUFFER,this.positionBuffer),r.bufferData(r.ARRAY_BUFFER,this.quadPositions,r.STATIC_DRAW),r.vertexAttribPointer(this.positionLocation,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(this.positionLocation),this.sourceTexture=r.createTexture(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.sourceTexture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),this.destinationTexture=r.createTexture(),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,this.destinationTexture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)}teardown(r){r.deleteBuffer(this.positionBuffer),r.disableVertexAttribArray(this.positionLocation),r.deleteTexture(this.sourceTexture),r.deleteTexture(this.destinationTexture),this.positionBuffer=null,this.sourceTexture=null,this.destinationTexture=null,this.gl=null}updateViewport(){if(this.gl){const r=this.scene.getRealSize();this.gl.canvas.width=r.width,this.gl.canvas.height=r.height,this.gl.viewport(0,0,r.width,r.height)}}getGL(){return this.gl??this.sharedContext.borrow(this)}getProgram(r){const t=this.sharedContext.getProgram(r,NM);if(!t)return null;const e=this.scene.getRealSize(),n=this.getGL();return n.useProgram(t),n.uniform1i(n.getUniformLocation(t,PM),0),n.uniform1i(n.getUniformLocation(t,VM),1),n.uniform2f(n.getUniformLocation(t,IM),e.x,e.y),n.uniform1f(n.getUniformLocation(t,kM),this.scene.playback.deltaTime),n.uniform1f(n.getUniformLocation(t,RM),this.scene.playback.fps),t}copyTextures(r,t){this.copyTexture(t,this.sourceTexture),this.copyTexture(r,this.destinationTexture)}clear(){const r=this.getGL();r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)}render(){const r=this.getGL();r.drawArrays(r.TRIANGLE_STRIP,0,4)}copyTexture(r,t){const e=this.getGL();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.generateMipmap(e.TEXTURE_2D)}},jM=class{constructor(r){this.scene=r,this.slides=new ju([]),this.lookup=new Map,this.collisionLookup=new Set,this.current=null,this.canResume=!1,this.waitsForId=null,this.targetId=null,this.handleReload=()=>{this.lookup.clear(),this.collisionLookup.clear(),this.current=null,this.waitsForId=null,this.targetId=null},this.handleReset=()=>{this.collisionLookup.clear(),this.current=null,this.waitsForId=null},this.handleRecalculated=()=>{this.slides.current=[...this.lookup.values()]},this.scene.onReloaded.subscribe(this.handleReload),this.scene.onReset.subscribe(this.handleReset),this.scene.onRecalculated.subscribe(this.handleRecalculated)}get onChanged(){return this.slides.subscribable}setTarget(r){this.targetId=r}resume(){this.canResume=!0}isWaitingFor(r){return this.waitsForId===r}isWaiting(){return this.waitsForId!==null}didHappen(r){var t;if(this.current===null)return!1;for(const e of this.lookup.keys()){if(e===r)return!0;if(e===((t=this.current)==null?void 0:t.id))return!1}return!1}getCurrent(){return this.current}register(r,t){if(this.waitsForId!==null)throw new Error(`The animation already waits for a slide: ${this.waitsForId}.`);const e=this.toId(r);this.scene.playback.state!==3&&(this.lookup.has(e)||this.lookup.set(e,{id:e,name:r,time:t,scene:this.scene,stack:new Error().stack}),this.collisionLookup.has(r)?this.scene.logger.warn({message:`A slide named "${r}" already exists.`,stack:new Error().stack}):this.collisionLookup.add(r)),this.waitsForId=e,this.current=this.lookup.get(e)??null,this.canResume=!1}shouldWait(r){const t=this.toId(r);if(this.waitsForId!==t)throw new Error(`The animation waits for a different slide: ${this.waitsForId}.`);if(!this.lookup.get(t))throw new Error(`Could not find the "${r}" slide.`);let n=this.canResume;return this.scene.playback.state!==3&&(n=t!==this.targetId),n&&(this.waitsForId=null),!n}toId(r){return`${this.scene.name}:${r}`}},GM=class{constructor(r){this.scene=r,this.signals={},this.variables={},this.handleReset=()=>{this.signals={}},r.onReset.subscribe(this.handleReset)}get(r,t){var e;return(e=this.signals)[r]??(e[r]=M2(this.variables[r]??t)),()=>this.signals[r]()}updateSignals(r){this.variables=r,Object.keys(r).map(t=>{t in this.signals&&this.signals[t](r[t])})}},zM=class{constructor(r){this.cache=new ju({firstFrame:0,transitionDuration:0,duration:0,lastFrame:0}),this.reloaded=new t3,this.recalculated=new t3,this.thread=new ju(null),this.renderLifecycle=new t3,this.afterReset=new t3,this.lifecycleEvents=new OM(this),this.previousScene=null,this.runner=null,this.state=0,this.cached=!1,this.counters={},this.name=r.name,this.size=r.size,this.resolutionScale=r.resolutionScale,this.logger=r.logger,this.playback=r.playback,this.runnerFactory=r.config,this.creationStack=r.stack,this.experimentalFeatures=r.experimentalFeatures??!1,d2(this.runnerFactory,t1(this.name)),this.variables=new GM(this),this.shaders=new UM(this,r.sharedWebGLContext),this.slides=new jM(this),this.previousOnTop=!1}get firstFrame(){return this.cache.current.firstFrame}get lastFrame(){return this.firstFrame+this.cache.current.duration}get onCacheChanged(){return this.cache.subscribable}get onReloaded(){return this.reloaded.subscribable}get onRecalculated(){return this.recalculated.subscribable}get onThreadChanged(){return this.thread.subscribable}get onRenderLifecycle(){return this.renderLifecycle.subscribable}get onReset(){return this.afterReset.subscribable}get LifecycleEvents(){return this.logger.warn("LifecycleEvents is deprecated. Use lifecycleEvents instead."),this.lifecycleEvents}get previous(){return this.previousScene}getMediaAssets(){return[]}stopAllMedia(){}update(){}async render(r){let t=0;do t++,await n1.consumePromises(),r.save(),r.clearRect(0,0,r.canvas.width,r.canvas.height),await this.draw(r),r.restore();while(n1.hasPromises()&&t<10);t>1&&this.logger.debug(`render iterations: ${t}`)}reload({config:r,size:t,stack:e,resolutionScale:n}={}){r&&(this.runnerFactory=r),t&&(this.size=t),n&&(this.resolutionScale=n),e&&(this.creationStack=e),this.cached=!1,this.reloaded.dispatch()}async recalculate(r){const t=this.cache.current;if(t.firstFrame=this.playback.frame,t.lastFrame=t.firstFrame+t.duration,this.isCached()){r(t.lastFrame),this.cache.current={...t};return}for(t.transitionDuration=-1,await this.reset();!this.canTransitionOut();)t.transitionDuration<0&&this.state===1&&(t.transitionDuration=this.playback.frame-t.firstFrame),r(this.playback.frame+1),await this.next();t.transitionDuration===-1&&(t.transitionDuration=0),t.lastFrame=this.playback.frame,t.duration=t.lastFrame-t.firstFrame,await new Promise(e=>setTimeout(e,0)),this.cached=!0,this.cache.current={...t},this.recalculated.dispatch()}async next(){var t;if(!this.runner)return;let r=this.execute(()=>this.runner.next());for(this.update();r.value;){if(wM(r.value)){const e=await r.value.toPromise();r=this.execute(()=>this.runner.next(e))}else if(DM(r.value)){const e=await r.value;r=this.execute(()=>this.runner.next(e))}else this.logger.warn({message:"Invalid value yielded by the scene.",object:r.value}),r=this.execute(()=>this.runner.next(r.value));this.update()}if(n1.hasPromises()){const e=await n1.consumePromises();this.logger.warn({message:"Tried to access an asynchronous property before the node was ready. Make sure to yield the node before accessing the property.",stack:e[0].stack,inspect:((t=e[0].owner)==null?void 0:t.key)??void 0})}r.done&&(this.state=3)}async reset(r=null){this.counters={},this.previousScene=r,this.previousOnTop=!1,this.runner=fL(()=>this.runnerFactory(this.getView()),t=>{this.thread.current=t}),this.state=1,this.afterReset.dispatch(),await this.next()}getSize(){return this.size}getRealSize(){return this.size.mul(this.resolutionScale)}isAfterTransitionIn(){return this.state===1}canTransitionOut(){return this.state===2||this.state===3}isFinished(){return this.state===3}enterInitial(){this.state===1?this.state=0:this.logger.warn(`Scene ${this.name} entered initial in an unexpected state: ${this.state}`)}enterAfterTransitionIn(){this.state===0?this.state=1:this.logger.warn(`Scene ${this.name} transitioned in an unexpected state: ${this.state}`)}enterCanTransitionOut(){this.state===1||this.state===0?this.state=2:this.logger.warn(`Scene ${this.name} was marked as finished in an unexpected state: ${this.state}`)}isCached(){return this.cached}execute(r){let t;AH(this),OH(this.playback);try{t=r()}finally{IH(this.playback),HH(this)}return t}},WM=Object.defineProperty,qM=Object.getOwnPropertyDescriptor,k=(r,t,e,n)=>{for(var s=n>1?void 0:n?qM(t,e):t,a=r.length-1,o;a>=0;a--)(o=r[a])&&(s=(n?o(t,e,s):o(s))||s);return n&&s&&WM(t,e,s),s};function ZM(r){var t;return!!((t=r.prototype)!=null&&t.isClass)}var KM=({children:r})=>r;function Xe(r,t,e){const{ref:n,children:s,...a}=t,o=Array.isArray(s)?s.flat():s;if(r===KM)return o;if(ZM(r)){const l=new r({...a,children:o,key:e});return n==null||n(l),l}else return r({...a,ref:n,children:o,key:e})}const XM=1024;let $M=0,Xl=class{constructor(t,e){this.from=t,this.to=e}};class qe{constructor(t={}){this.id=$M++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=j2.match(t)),e=>{let n=t(e);return n===void 0?null:[this,n]}}}qe.closedBy=new qe({deserialize:r=>r.split(" ")});qe.openedBy=new qe({deserialize:r=>r.split(" ")});qe.group=new qe({deserialize:r=>r.split(" ")});qe.isolate=new qe({deserialize:r=>{if(r&&r!="rtl"&&r!="ltr"&&r!="auto")throw new RangeError("Invalid value for isolate: "+r);return r||"auto"}});qe.contextHash=new qe({perNode:!0});qe.lookAhead=new qe({perNode:!0});qe.mounted=new qe({perNode:!0});class c5{constructor(t,e,n,s=!1){this.tree=t,this.overlay=e,this.parser=n,this.bracketed=s}static get(t){return t&&t.props&&t.props[qe.mounted.id]}}const YM=Object.create(null);class j2{constructor(t,e,n,s=0){this.name=t,this.props=e,this.id=n,this.flags=s}static define(t){let e=t.props&&t.props.length?Object.create(null):YM,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new j2(t.name||"",e,t.id,n);if(t.props){for(let a of t.props)if(Array.isArray(a)||(a=a(s)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[a[0].id]=a[1]}}return s}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let e=this.prop(qe.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let s of n.split(" "))e[s]=t[n];return n=>{for(let s=n.prop(qe.group),a=-1;a<(s?s.length:0);a++){let o=e[a<0?n.name:s[a]];if(o)return o}}}}j2.none=new j2("",Object.create(null),0,8);const ns=new WeakMap,jQ=new WeakMap;var l1;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays",r[r.EnterBracketed=16]="EnterBracketed"})(l1||(l1={}));class G1{constructor(t,e,n,s,a){if(this.type=t,this.children=e,this.positions=n,this.length=s,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,l]of a)this.props[typeof o=="number"?o:o.id]=l}}toString(){let t=c5.get(this);if(t&&!t.overlay)return t.tree.toString();let e="";for(let n of this.children){let s=n.toString();s&&(e&&(e+=","),e+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e}cursor(t=0){return new Zu(this.topNode,t)}cursorAt(t,e=0,n=0){let s=ns.get(this)||this.topNode,a=new Zu(s);return a.moveTo(t,e),ns.set(this,a._tree),a}get topNode(){return new N2(this,0,0,null)}resolve(t,e=0){let n=H5(ns.get(this)||this.topNode,t,e,!1);return ns.set(this,n),n}resolveInner(t,e=0){let n=H5(jQ.get(this)||this.topNode,t,e,!0);return jQ.set(this,n),n}resolveStack(t,e=0){return ew(this,t,e)}iterate(t){let{enter:e,leave:n,from:s=0,to:a=this.length}=t,o=t.mode||0,l=(o&l1.IncludeAnonymous)>0;for(let u=this.cursor(o|l1.IncludeAnonymous);;){let h=!1;if(u.from<=a&&u.to>=s&&(!l&&u.type.isAnonymous||e(u)!==!1)){if(u.firstChild())continue;h=!0}for(;h&&n&&(l||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Zh(j2.none,this.children,this.positions,0,this.children.length,0,this.length,(e,n,s)=>new G1(this.type,e,n,s,this.propValues),t.makeTree||((e,n,s)=>new G1(j2.none,e,n,s)))}static build(t){return iw(t)}}G1.empty=new G1(j2.none,[],[],0);class Wh{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Wh(this.buffer,this.index)}}class cr{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return j2.none}toString(){let t=[];for(let e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}childString(t){let e=this.buffer[t],n=this.buffer[t+3],s=this.set.types[e],a=s.name;if(/\W/.test(a)&&!s.isError&&(a=JSON.stringify(a)),t+=4,n==t)return a;let o=[];for(;t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return a+"("+o.join(",")+")"}findChild(t,e,n,s,a){let{buffer:o}=this,l=-1;for(let u=t;u!=e&&!(QL(a,s,o[u+1],o[u+2])&&(l=u,n>0));u=o[u+3]);return l}slice(t,e,n){let s=this.buffer,a=new Uint16Array(e-t),o=0;for(let l=t,u=0;l<e;){a[u++]=s[l++],a[u++]=s[l++]-n;let h=a[u++]=s[l++]-n;a[u++]=s[l++]-t,o=Math.max(o,h)}return new cr(a,o,this.set)}}function QL(r,t,e,n){switch(r){case-2:return e<t;case-1:return n>=t&&e<t;case 0:return e<t&&n>t;case 1:return e<=t&&n>t;case 2:return n>t;case 4:return!0}}function H5(r,t,e,n){for(var s;r.from==r.to||(e<1?r.from>=t:r.from>t)||(e>-1?r.to<=t:r.to<t);){let o=!n&&r instanceof N2&&r.index<0?null:r.parent;if(!o)return r;r=o}let a=n?0:l1.IgnoreOverlays;if(n)for(let o=r,l=o.parent;l;o=l,l=o.parent)o instanceof N2&&o.index<0&&((s=l.enter(t,e,a))===null||s===void 0?void 0:s.from)!=o.from&&(r=l);for(;;){let o=r.enter(t,e,a);if(!o)return r;r=o}}class dL{cursor(t=0){return new Zu(this,t)}getChild(t,e=null,n=null){let s=GQ(this,t,e,n);return s.length?s[0]:null}getChildren(t,e=null,n=null){return GQ(this,t,e,n)}resolve(t,e=0){return H5(this,t,e,!1)}resolveInner(t,e=0){return H5(this,t,e,!0)}matchContext(t){return qu(this.parent,t)}enterUnfinishedNodesBefore(t){let e=this.childBefore(t),n=this;for(;e;){let s=e.lastChild;if(!s||s.to!=e.to)break;s.type.isError&&s.from==s.to?(n=e,e=s.prevSibling):e=s}return n}get node(){return this}get next(){return this.parent}}class N2 extends dL{constructor(t,e,n,s){super(),this._tree=t,this.from=e,this.index=n,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,e,n,s,a=0){var o;for(let l=this;;){for(let{children:u,positions:h}=l._tree,T=e>0?u.length:-1;t!=T;t+=e){let f=u[t],d=h[t]+l.from;if(!(!(a&l1.EnterBracketed&&f instanceof G1&&((o=c5.get(f))===null||o===void 0?void 0:o.overlay)===null&&(d>=n||d+f.length<=n))&&!QL(s,n,d,d+f.length))){if(f instanceof cr){if(a&l1.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,e,n-d,s);if(p>-1)return new Yi(new JM(l,f,t,d),null,p)}else if(a&l1.IncludeAnonymous||!f.type.isAnonymous||qh(f)){let p;if(!(a&l1.IgnoreMounts)&&(p=c5.get(f))&&!p.overlay)return new N2(p.tree,d,t,l);let m=new N2(f,d,t,l);return a&l1.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(e<0?f.children.length-1:0,e,n,s,a)}}}if(a&l1.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?t=l.index+e:t=e<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,e,n=0){let s;if(!(n&l1.IgnoreOverlays)&&(s=c5.get(this._tree))&&s.overlay){let a=t-this.from,o=n&l1.EnterBracketed&&s.bracketed;for(let{from:l,to:u}of s.overlay)if((e>0||o?l<=a:l<a)&&(e<0||o?u>=a:u>a))return new N2(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function GQ(r,t,e,n){let s=r.cursor(),a=[];if(!s.firstChild())return a;if(e!=null){for(let o=!1;!o;)if(o=s.type.is(e),!s.nextSibling())return a}for(;;){if(n!=null&&s.type.is(n))return a;if(s.type.is(t)&&a.push(s.node),!s.nextSibling())return n==null?a:[]}}function qu(r,t,e=t.length-1){for(let n=r;e>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[e]&&t[e]!=n.name)return!1;e--}}return!0}class JM{constructor(t,e,n,s){this.parent=t,this.buffer=e,this.index=n,this.start=s}}class Yi extends dL{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,n);return a<0?null:new Yi(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,e,n=0){if(n&l1.ExcludeBuffers)return null;let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return a<0?null:new Yi(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Yi(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Yi(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,s=this.index+4,a=n.buffer[this.index+3];if(a>s){let o=n.buffer[this.index+1];t.push(n.slice(s,a,o)),e.push(0)}return new G1(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function pL(r){if(!r.length)return null;let t=0,e=r[0];for(let a=1;a<r.length;a++){let o=r[a];(o.from>e.from||o.to<e.to)&&(e=o,t=a)}let n=e instanceof N2&&e.index<0?null:e.parent,s=r.slice();return n?s[t]=n:s.splice(t,1),new tw(s,e)}class tw{constructor(t,e){this.heads=t,this.node=e}get next(){return pL(this.heads)}}function ew(r,t,e){let n=r.resolveInner(t,e),s=null;for(let a=n instanceof N2?n:n.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(s||(s=[n])).push(o.resolve(t,e)),a=o}else{let o=c5.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let l=new N2(o.tree,o.overlay[0].from+a.from,-1,a);(s||(s=[n])).push(H5(l,t,e,!1))}}return s?pL(s):n}class Zu{get name(){return this.type.name}constructor(t,e=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=e&~l1.EnterBracketed,t instanceof N2)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let n=t._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:n,buffer:s}=this.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=n+s.buffer[t+1],this.to=n+s.buffer[t+2],!0}yield(t){return t?t instanceof N2?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));let{buffer:s}=this.buffer,a=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,n=this.mode){return this.buffer?n&l1.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&l1.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&l1.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,n=this.stack.length-1;if(t<0){let s=n<0?0:this.stack[n]+4;if(this.index!=s)return this.yieldBuf(e.findChild(s,this.index,-1,0,4))}else{let s=e.buffer[this.index+3];if(s<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(s)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,n,{buffer:s}=this;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(s.buffer.buffer[a+3]<this.index)return!1;({index:e,parent:n}=s)}else({index:e,_parent:n}=this._tree);for(;n;{index:e,_parent:n}=n)if(e>-1)for(let a=e+t,o=t<0?-1:n._tree.children.length;a!=o;a+=t){let l=n._tree.children[a];if(this.mode&l1.IncludeAnonymous||l instanceof cr||!l.type.isAnonymous||qh(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(let s=this.index,a=this.stack.length;a>=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;e=o,n=a+1;break t}s=this.stack[--a]}for(let s=n;s<this.stack.length;s++)e=new Yi(this.buffer,e,this.stack[s]);return this.bufferNode=new Yi(this.buffer,e,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,e){for(let n=0;;){let s=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&e&&e(this),s=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,s=!0}}}matchContext(t){if(!this.buffer)return qu(this.node.parent,t);let{buffer:e}=this.buffer,{types:n}=e.set;for(let s=t.length-1,a=this.stack.length-1;s>=0;a--){if(a<0)return qu(this._tree,t,s);let o=n[e.buffer[this.stack[a]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function qh(r){return r.children.some(t=>t instanceof cr||!t.type.isAnonymous||qh(t))}function iw(r){var t;let{buffer:e,nodeSet:n,maxBufferLength:s=XM,reused:a=[],minRepeatType:o=n.types.length}=r,l=Array.isArray(e)?new Wh(e,e.length):e,u=n.types,h=0,T=0;function f(x,b,S,E,A,M){let{id:D,start:I,end:P,size:R}=l,F=T,X=h;if(R<0)if(l.next(),R==-1){let N=a[D];S.push(N),E.push(I-x);return}else if(R==-3){h=D;return}else if(R==-4){T=D;return}else throw new RangeError(`Unrecognized record size: ${R}`);let st=u[D],rt,ct,U=I-x;if(P-I<=s&&(ct=c(l.pos-b,A))){let N=new Uint16Array(ct.size-ct.skip),K=l.pos-ct.size,J=N.length;for(;l.pos>K;)J=Q(ct.start,N,J);rt=new cr(N,P-ct.start,n),U=ct.start-x}else{let N=l.pos-R;l.next();let K=[],J=[],ft=D>=o?D:-1,Y=0,Qt=P;for(;l.pos>N;)ft>=0&&l.id==ft&&l.size>=0?(l.end<=Qt-s&&(m(K,J,I,Y,l.end,Qt,ft,F,X),Y=K.length,Qt=l.end),l.next()):M>2500?d(I,N,K,J):f(I,N,K,J,ft,M+1);if(ft>=0&&Y>0&&Y<K.length&&m(K,J,I,Y,I,Qt,ft,F,X),K.reverse(),J.reverse(),ft>-1&&Y>0){let W=p(st,X);rt=Zh(st,K,J,0,K.length,0,P-I,W,W)}else rt=y(st,K,J,P-I,F-P,X)}S.push(rt),E.push(U)}function d(x,b,S,E){let A=[],M=0,D=-1;for(;l.pos>b;){let{id:I,start:P,end:R,size:F}=l;if(F>4)l.next();else{if(D>-1&&P<D)break;D<0&&(D=R-s),A.push(I,P,R),M++,l.next()}}if(M){let I=new Uint16Array(M*4),P=A[A.length-2];for(let R=A.length-3,F=0;R>=0;R-=3)I[F++]=A[R],I[F++]=A[R+1]-P,I[F++]=A[R+2]-P,I[F++]=F;S.push(new cr(I,A[2]-P,n)),E.push(P-x)}}function p(x,b){return(S,E,A)=>{let M=0,D=S.length-1,I,P;if(D>=0&&(I=S[D])instanceof G1){if(!D&&I.type==x&&I.length==A)return I;(P=I.prop(qe.lookAhead))&&(M=E[D]+I.length+P)}return y(x,S,E,A,M,b)}}function m(x,b,S,E,A,M,D,I,P){let R=[],F=[];for(;x.length>E;)R.push(x.pop()),F.push(b.pop()+S-A);x.push(y(n.types[D],R,F,M-A,I-M,P)),b.push(A-S)}function y(x,b,S,E,A,M,D){if(M){let I=[qe.contextHash,M];D=D?[I].concat(D):[I]}if(A>25){let I=[qe.lookAhead,A];D=D?[I].concat(D):[I]}return new G1(x,b,S,E,D)}function c(x,b){let S=l.fork(),E=0,A=0,M=0,D=S.end-s,I={size:0,start:0,skip:0};t:for(let P=S.pos-x;S.pos>P;){let R=S.size;if(S.id==b&&R>=0){I.size=E,I.start=A,I.skip=M,M+=4,E+=4,S.next();continue}let F=S.pos-R;if(R<0||F<P||S.start<D)break;let X=S.id>=o?4:0,st=S.start;for(S.next();S.pos>F;){if(S.size<0)if(S.size==-3||S.size==-4)X+=4;else break t;else S.id>=o&&(X+=4);S.next()}A=st,E+=R,M+=X}return(b<0||E==x)&&(I.size=E,I.start=A,I.skip=M),I.size>4?I:void 0}function Q(x,b,S){let{id:E,start:A,end:M,size:D}=l;if(l.next(),D>=0&&E<o){let I=S;if(D>4){let P=l.pos-(D-4);for(;l.pos>P;)S=Q(x,b,S)}b[--S]=I,b[--S]=M-x,b[--S]=A-x,b[--S]=E}else D==-3?h=E:D==-4&&(T=E);return S}let g=[],v=[];for(;l.pos>0;)f(r.start||0,r.bufferStart||0,g,v,-1,0);let L=(t=r.length)!==null&&t!==void 0?t:g.length?v[0]+g[0].length:0;return new G1(u[r.topID],g.reverse(),v.reverse(),L)}const zQ=new WeakMap;function ca(r,t){if(!r.isAnonymous||t instanceof cr||t.type!=r)return 1;let e=zQ.get(t);if(e==null){e=1;for(let n of t.children){if(n.type!=r||!(n instanceof G1)){e=1;break}e+=ca(r,n)}zQ.set(t,e)}return e}function Zh(r,t,e,n,s,a,o,l,u){let h=0;for(let m=n;m<s;m++)h+=ca(r,t[m]);let T=Math.ceil(h*1.5/8),f=[],d=[];function p(m,y,c,Q,g){for(let v=c;v<Q;){let L=v,x=y[v],b=ca(r,m[v]);for(v++;v<Q;v++){let S=ca(r,m[v]);if(b+S>=T)break;b+=S}if(v==L+1){if(b>T){let S=m[L];p(S.children,S.positions,0,S.children.length,y[L]+g);continue}f.push(m[L])}else{let S=y[v-1]+m[v-1].length-x;f.push(Zh(r,m,y,L,v,x,S,null,u))}d.push(x+g-a)}}return p(t,e,n,s,0),(l||u)(f,d,o)}class qr{constructor(t,e,n,s,a=!1,o=!1){this.from=t,this.to=e,this.tree=n,this.offset=s,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],n=!1){let s=[new qr(0,t.length,t,0,!1,n)];for(let a of e)a.to>t.length&&s.push(a);return s}static applyChanges(t,e,n=128){if(!e.length)return t;let s=[],a=1,o=t.length?t[0]:null;for(let l=0,u=0,h=0;;l++){let T=l<e.length?e[l]:null,f=T?T.fromA:1e9;if(f-u>=n)for(;o&&o.from<f;){let d=o;if(u>=d.from||f<=d.to||h){let p=Math.max(d.from,u)-h,m=Math.min(d.to,f)-h;d=p>=m?null:new qr(p,m,d.tree,d.offset+h,l>0,!!T)}if(d&&s.push(d),o.to>f)break;o=a<t.length?t[a++]:null}if(!T)break;u=T.toA,h=T.toA-T.toB}return s}}let rw=class{startParse(t,e,n){return typeof t=="string"&&(t=new nw(t)),n=n?n.length?n.map(s=>new Xl(s.from,s.to)):[new Xl(0,0)]:[new Xl(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let s=this.startParse(t,e,n);for(;;){let a=s.advance();if(a)return a}}};class nw{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new qe({perNode:!0});let Ku=[],gL=[];(()=>{let r="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<r.length;t++)(t%2?gL:Ku).push(e=e+r[t])})();function sw(r){if(r<768)return!1;for(let t=0,e=Ku.length;;){let n=t+e>>1;if(r<Ku[n])e=n;else if(r>=gL[n])t=n+1;else return!0;if(t==e)return!1}}function WQ(r){return r>=127462&&r<=127487}const qQ=8205;function aw(r,t,e=!0,n=!0){return(e?mL:ow)(r,t,n)}function mL(r,t,e){if(t==r.length)return t;t&&yL(r.charCodeAt(t))&&vL(r.charCodeAt(t-1))&&t--;let n=$l(r,t);for(t+=ZQ(n);t<r.length;){let s=$l(r,t);if(n==qQ||s==qQ||e&&sw(s))t+=ZQ(s),n=s;else if(WQ(s)){let a=0,o=t-2;for(;o>=0&&WQ($l(r,o));)a++,o-=2;if(a%2==0)break;t+=2}else break}return t}function ow(r,t,e){for(;t>0;){let n=mL(r,t-2,e);if(n<t)return n;t--}return 0}function $l(r,t){let e=r.charCodeAt(t);if(!vL(e)||t+1==r.length)return e;let n=r.charCodeAt(t+1);return yL(n)?(e-55296<<10)+(n-56320)+65536:e}function yL(r){return r>=56320&&r<57344}function vL(r){return r>=55296&&r<56320}function ZQ(r){return r<65536?1:2}let Ie=class LL{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){[t,e]=pn(this,t,e);let s=[];return this.decompose(0,t,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(e,this.length,s,1),ha.from(s,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=pn(this,t,e);let n=[];return this.decompose(t,e,n,0),ha.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),s=new h5(this),a=new h5(t);for(let o=e,l=e;;){if(s.next(o),a.next(o),o=0,s.lineBreak!=a.lineBreak||s.done!=a.done||s.value!=a.value)return!1;if(l+=s.value.length,s.done||l>=n)return!0}}iter(t=1){return new h5(this,t)}iterRange(t,e=this.length){return new xL(this,t,e)}iterLines(t,e){let n;if(t==null)n=this.iter();else{e==null&&(e=this.lines+1);let s=this.line(t).from;n=this.iterRange(s,Math.max(s,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new _L(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?LL.empty:t.length<=32?new o1(t):ha.from(o1.split(t,[]))}};class o1 extends Ie{constructor(t,e=lw(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,s){for(let a=0;;a++){let o=this.text[a],l=s+o.length;if((e?n:l)>=t)return new uw(s,l,n,o);s=l+1,n++}}decompose(t,e,n,s){let a=t<=0&&e>=this.length?this:new o1(KQ(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(s&1){let o=n.pop(),l=Ta(a.text,o.text.slice(),0,a.length);if(l.length<=32)n.push(new o1(l,o.length+a.length));else{let u=l.length>>1;n.push(new o1(l.slice(0,u)),new o1(l.slice(u)))}}else n.push(a)}replace(t,e,n){if(!(n instanceof o1))return super.replace(t,e,n);[t,e]=pn(this,t,e);let s=Ta(this.text,Ta(n.text,KQ(this.text,0,t)),e),a=this.length+n.length-(e-t);return s.length<=32?new o1(s,a):ha.from(o1.split(s,[]),a)}sliceString(t,e=this.length,n=`
105
105
  `){[t,e]=pn(this,t,e);let s="";for(let a=0,o=0;a<=e&&o<this.text.length;o++){let l=this.text[o],u=a+l.length;a>t&&o&&(s+=n),t<u&&e>a&&(s+=l.slice(Math.max(0,t-a),e-a)),a=u+1}return s}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],s=-1;for(let a of t)n.push(a),s+=a.length+1,n.length==32&&(e.push(new o1(n,s)),n=[],s=-1);return s>-1&&e.push(new o1(n,s)),e}}let ha=class W4 extends Ie{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let n of t)this.lines+=n.lines}lineInner(t,e,n,s){for(let a=0;;a++){let o=this.children[a],l=s+o.length,u=n+o.lines-1;if((e?u:l)>=t)return o.lineInner(t,e,n,s);s=l+1,n=u+1}}decompose(t,e,n,s){for(let a=0,o=0;o<=e&&a<this.children.length;a++){let l=this.children[a],u=o+l.length;if(t<=u&&e>=o){let h=s&((o<=t?1:0)|(u>=e?2:0));o>=t&&u<=e&&!h?n.push(l):l.decompose(t-o,e-o,n,h)}o=u+1}}replace(t,e,n){if([t,e]=pn(this,t,e),n.lines<this.lines)for(let s=0,a=0;s<this.children.length;s++){let o=this.children[s],l=a+o.length;if(t>=a&&e<=l){let u=o.replace(t-a,e-a,n),h=this.lines-o.lines+u.lines;if(u.lines<h>>4&&u.lines>h>>6){let T=this.children.slice();return T[s]=u,new W4(T,this.length-(e-t)+n.length)}return super.replace(a,l,u)}a=l+1}return super.replace(t,e,n)}sliceString(t,e=this.length,n=`
106
106
  `){[t,e]=pn(this,t,e);let s="";for(let a=0,o=0;a<this.children.length&&o<=e;a++){let l=this.children[a],u=o+l.length;o>t&&a&&(s+=n),t<u&&e>o&&(s+=l.sliceString(t-o,e-o,n)),o=u+1}return s}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof W4))return 0;let n=0,[s,a,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,a+=e){if(s==o||a==l)return n;let u=this.children[s],h=t.children[a];if(u!=h)return n+u.scanIdentical(h,e);n+=u.length+1}}static from(t,e=t.reduce((n,s)=>n+s.length+1,-1)){let n=0;for(let p of t)n+=p.lines;if(n<32){let p=[];for(let m of t)m.flatten(p);return new o1(p,e)}let s=Math.max(32,n>>5),a=s<<1,o=s>>1,l=[],u=0,h=-1,T=[];function f(p){let m;if(p.lines>a&&p instanceof W4)for(let y of p.children)f(y);else p.lines>o&&(u>o||!u)?(d(),l.push(p)):p instanceof o1&&u&&(m=T[T.length-1])instanceof o1&&p.lines+m.lines<=32?(u+=p.lines,h+=p.length+1,T[T.length-1]=new o1(m.text.concat(p.text),m.length+1+p.length)):(u+p.lines>s&&d(),u+=p.lines,h+=p.length+1,T.push(p))}function d(){u!=0&&(l.push(T.length==1?T[0]:W4.from(T,h)),h=-1,u=T.length=0)}for(let p of t)f(p);return d(),l.length==1?l[0]:new W4(l,e)}};Ie.empty=new o1([""],0);function lw(r){let t=-1;for(let e of r)t+=e.length+1;return t}function Ta(r,t,e=0,n=1e9){for(let s=0,a=0,o=!0;a<r.length&&s<=n;a++){let l=r[a],u=s+l.length;u>=e&&(u>n&&(l=l.slice(0,n-s)),s<e&&(l=l.slice(e-s)),o?(t[t.length-1]+=l,o=!1):t.push(l)),s=u+1}return t}function KQ(r,t,e){return Ta(r,[""],t,e)}class h5{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof o1?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],a=this.offsets[n],o=a>>1,l=s instanceof o1?s.text.length:s.children.length;if(o==(e>0?l:0)){if(n==0)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(e>0?0:1)){if(this.offsets[n]+=e,t==0)return this.lineBreak=!0,this.value=`
107
- `,this;t--}else if(s instanceof o1){let u=s.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,u.length>Math.max(0,t))return this.value=t==0?u:e>0?u.slice(t):u.slice(0,u.length-t),this;t-=u.length}else{let u=s.children[o+(e<0?-1:0)];t>u.length?(t-=u.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(u),this.offsets.push(e>0?1:(u instanceof o1?u.text.length:u.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class xL{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new h5(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=n?s:e<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _L{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:s}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ie.prototype[Symbol.iterator]=function(){return this.iter()},h5.prototype[Symbol.iterator]=xL.prototype[Symbol.iterator]=_L.prototype[Symbol.iterator]=function(){return this});let uw=class{constructor(t,e,n,s){this.from=t,this.to=e,this.number=n,this.text=s}get length(){return this.to-this.from}};function pn(r,t,e){return t=Math.max(0,Math.min(r.length,t)),[t,Math.max(t,Math.min(r.length,e))]}function e3(r,t,e=!0,n=!0){return aw(r,t,e,n)}const Xu=/\r\n?|\n/;var S2=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(S2||(S2={}));class pi{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,n=0,s=0;e<this.sections.length;){let a=this.sections[e++],o=this.sections[e++];o<0?(t(n,s,a),s+=a):s+=o,n+=a}}iterChangedRanges(t,e=!1){$u(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],s=this.sections[e++];s<0?t.push(n,s):t.push(s,n)}return new pi(t)}composeDesc(t){return this.empty?t:t.empty?this:bL(this,t)}mapDesc(t,e=!1){return t.empty?this:Yu(this,t,e)}mapPos(t,e=-1,n=S2.Simple){let s=0,a=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],u=this.sections[o++],h=s+l;if(u<0){if(h>t)return a+(t-s);a+=l}else{if(n!=S2.Simple&&h>=t&&(n==S2.TrackDel&&s<t&&h>t||n==S2.TrackBefore&&s<t||n==S2.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==s||e<0?a:a+u;a+=u}s=h}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return a}touchesRange(t,e=t){for(let n=0,s=0;n<this.sections.length&&s<=e;){let a=this.sections[n++],o=this.sections[n++],l=s+a;if(o>=0&&s<=e&&l>=t)return s<t&&l>e?"cover":!0;s=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let n=this.sections[e++],s=this.sections[e++];t+=(t?" ":"")+n+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new pi(t)}static create(t){return new pi(t)}}class D1 extends pi{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return $u(this,(e,n,s,a,o)=>t=t.replace(s,s+(n-e),o),!1),t}mapDesc(t,e=!1){return Yu(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let s=0,a=0;s<e.length;s+=2){let o=e[s],l=e[s+1];if(l>=0){e[s]=l,e[s+1]=o;let u=s>>1;for(;n.length<u;)n.push(Ie.empty);n.push(o?t.slice(a,a+o):Ie.empty)}a+=o}return new D1(e,n)}compose(t){return this.empty?t:t.empty?this:bL(this,t,!0)}map(t,e=!1){return t.empty?this:Yu(this,t,e,!0)}iterChanges(t,e=!1){$u(this,t,e)}get desc(){return pi.create(this.sections)}filter(t){let e=[],n=[],s=[],a=new M5(this);t:for(let o=0,l=0;;){let u=o==t.length?1e9:t[o++];for(;l<u||l==u&&a.len==0;){if(a.done)break t;let T=Math.min(a.len,u-l);$1(s,T,-1);let f=a.ins==-1?-1:a.off==0?a.ins:0;$1(e,T,f),f>0&&Ji(n,e,a.text),a.forward(T),l+=T}let h=t[o++];for(;l<h;){if(a.done)break t;let T=Math.min(a.len,h-l);$1(e,T,-1),$1(s,T,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(T),l+=T}}return{changes:new D1(e,n),filtered:pi.create(s)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e],s=this.sections[e+1];s<0?t.push(n):s==0?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,n){let s=[],a=[],o=0,l=null;function u(T=!1){if(!T&&!s.length)return;o<e&&$1(s,e-o,-1);let f=new D1(s,a);l=l?l.compose(f.map(l)):f,s=[],a=[],o=0}function h(T){if(Array.isArray(T))for(let f of T)h(f);else if(T instanceof D1){if(T.length!=e)throw new RangeError(`Mismatched change set length (got ${T.length}, expected ${e})`);u(),l=l?l.compose(T.map(l)):T}else{let{from:f,to:d=f,insert:p}=T;if(f>d||f<0||d>e)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${e})`);let m=p?typeof p=="string"?Ie.of(p.split(n||Xu)):p:Ie.empty,y=m.length;if(f==d&&y==0)return;f<o&&u(),f>o&&$1(s,f-o,-1),$1(s,d-f,y),Ji(a,s,m),o=d}}return h(t),u(!l),l}static empty(t){return new D1(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let s=0;s<t.length;s++){let a=t[s];if(typeof a=="number")e.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)e.push(a[0],0);else{for(;n.length<s;)n.push(Ie.empty);n[s]=Ie.of(a.slice(1)),e.push(a[0],n[s].length)}}}return new D1(e,n)}static createSet(t,e){return new D1(t,e)}}function $1(r,t,e,n=!1){if(t==0&&e<=0)return;let s=r.length-2;s>=0&&e<=0&&e==r[s+1]?r[s]+=t:s>=0&&t==0&&r[s]==0?r[s+1]+=e:n?(r[s]+=t,r[s+1]+=e):r.push(t,e)}function Ji(r,t,e){if(e.length==0)return;let n=t.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(e);else{for(;r.length<n;)r.push(Ie.empty);r.push(e)}}function $u(r,t,e){let n=r.inserted;for(let s=0,a=0,o=0;o<r.sections.length;){let l=r.sections[o++],u=r.sections[o++];if(u<0)s+=l,a+=l;else{let h=s,T=a,f=Ie.empty;for(;h+=l,T+=u,u&&n&&(f=f.append(n[o-2>>1])),!(e||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],u=r.sections[o++];t(s,h,a,T,f),s=h,a=T}}}function Yu(r,t,e,n=!1){let s=[],a=n?[]:null,o=new M5(r),l=new M5(t);for(let u=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);$1(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!e))){let h=l.len;for($1(s,l.ins,-1);h;){let T=Math.min(o.len,h);o.ins>=0&&u<o.i&&o.len<=T&&($1(s,0,o.ins),a&&Ji(a,s,o.text),u=o.i),o.forward(T),h-=T}l.next()}else if(o.ins>=0){let h=0,T=o.len;for(;T;)if(l.ins==-1){let f=Math.min(T,l.len);h+=f,T-=f,l.forward(f)}else if(l.ins==0&&l.len<T)T-=l.len,l.next();else break;$1(s,h,u<o.i?o.ins:0),a&&u<o.i&&Ji(a,s,o.text),u=o.i,o.forward(o.len-T)}else{if(o.done&&l.done)return a?D1.createSet(s,a):pi.create(s);throw new Error("Mismatched change set lengths")}}}function bL(r,t,e=!1){let n=[],s=e?[]:null,a=new M5(r),o=new M5(t);for(let l=!1;;){if(a.done&&o.done)return s?D1.createSet(n,s):pi.create(n);if(a.ins==0)$1(n,a.len,0,l),a.next();else if(o.len==0&&!o.done)$1(n,0,o.ins,l),s&&Ji(s,n,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(a.len2,o.len),h=n.length;if(a.ins==-1){let T=o.ins==-1?-1:o.off?0:o.ins;$1(n,u,T,l),s&&T&&Ji(s,n,o.text)}else o.ins==-1?($1(n,a.off?0:a.len,u,l),s&&Ji(s,n,a.textBit(u))):($1(n,a.off?0:a.len,o.off?0:o.ins,l),s&&!o.off&&Ji(s,n,o.text));l=(a.ins>u||o.ins>=0&&o.len>u)&&(l||n.length>h),a.forward2(u),o.forward(u)}}}}class M5{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?Ie.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?Ie.empty:e[n].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class jr{constructor(t,e,n){this.from=t,this.to=e,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let n,s;return this.empty?n=s=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new jr(n,s,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return Rt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return Rt.range(this.anchor,n)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Rt.range(t.anchor,t.head)}static create(t,e,n){return new jr(t,e,n)}}class Rt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:Rt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(t.ranges[n],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Rt([this.main],0)}addRange(t,e=!0){return Rt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let n=this.ranges.slice();return n[e]=t,Rt.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Rt(t.ranges.map(e=>jr.fromJSON(e)),t.main)}static single(t,e=t){return new Rt([Rt.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<t.length;s++){let a=t[s];if(a.empty?a.from<=n:a.from<n)return Rt.normalized(t.slice(),e);n=a.to}return new Rt(t,e)}static cursor(t,e=0,n,s){return jr.create(t,t,(e==0?0:e<0?8:16)|(n==null?7:Math.min(6,n))|(s??16777215)<<6)}static range(t,e,n,s){let a=(n??16777215)<<6|(s==null?7:Math.min(6,s));return e<t?jr.create(e,t,48|a):jr.create(t,e,(e>t?8:0)|a)}static normalized(t,e=0){let n=t[e];t.sort((s,a)=>s.from-a.from),e=t.indexOf(n);for(let s=1;s<t.length;s++){let a=t[s],o=t[s-1];if(a.empty?a.from<=o.to:a.from<o.to){let l=o.from,u=Math.max(a.to,o.to);s<=e&&e--,t.splice(--s,2,a.anchor>a.head?Rt.range(u,l):Rt.range(l,u))}}return new Rt(t,e)}}function SL(r,t){for(let e of r.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Kh=0;class ne{constructor(t,e,n,s,a){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=s,this.id=Kh++,this.default=t([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(t={}){return new ne(t.combine||(e=>e),t.compareInput||((e,n)=>e===n),t.compare||(t.combine?(e,n)=>e===n:Xh),!!t.static,t.enables)}of(t){return new fa([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new fa(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new fa(t,this,2,e)}from(t,e){return e||(e=n=>n),this.compute([t],n=>e(n.field(t)))}}function Xh(r,t){return r==t||r.length==t.length&&r.every((e,n)=>e===t[n])}class fa{constructor(t,e,n,s){this.dependencies=t,this.facet=e,this.type=n,this.value=s,this.id=Kh++}dynamicSlot(t){var e;let n=this.value,s=this.facet.compareInput,a=this.id,o=t[a]>>1,l=this.type==2,u=!1,h=!1,T=[];for(let f of this.dependencies)f=="doc"?u=!0:f=="selection"?h=!0:((e=t[f.id])!==null&&e!==void 0?e:1)&1||T.push(t[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,d){if(u&&d.docChanged||h&&(d.docChanged||d.selection)||Ju(f,T)){let p=n(f);if(l?!XQ(p,f.values[o],s):!s(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,d)=>{let p,m=d.config.address[a];if(m!=null){let y=Ia(d,m);if(this.dependencies.every(c=>c instanceof ne?d.facet(c)===f.facet(c):c instanceof Q4?d.field(c,!1)==f.field(c,!1):!0)||(l?XQ(p=n(f),y,s):s(p=n(f),y)))return f.values[o]=y,0}else p=n(f);return f.values[o]=p,1}}}}function XQ(r,t,e){if(r.length!=t.length)return!1;for(let n=0;n<r.length;n++)if(!e(r[n],t[n]))return!1;return!0}function Ju(r,t){let e=!1;for(let n of t)T5(r,n)&1&&(e=!0);return e}function cw(r,t,e){let n=e.map(u=>r[u.id]),s=e.map(u=>u.type),a=n.filter(u=>!(u&1)),o=r[t.id]>>1;function l(u){let h=[];for(let T=0;T<n.length;T++){let f=Ia(u,n[T]);if(s[T]==2)for(let d of f)h.push(d);else h.push(f)}return t.combine(h)}return{create(u){for(let h of n)T5(u,h);return u.values[o]=l(u),1},update(u,h){if(!Ju(u,a))return 0;let T=l(u);return t.compare(T,u.values[o])?0:(u.values[o]=T,1)},reconfigure(u,h){let T=Ju(u,n),f=h.config.facets[t.id],d=h.facet(t);if(f&&!T&&Xh(e,f))return u.values[o]=d,0;let p=l(u);return t.compare(p,d)?(u.values[o]=d,0):(u.values[o]=p,1)}}}const ss=ne.define({static:!0});class Q4{constructor(t,e,n,s,a){this.id=t,this.createF=e,this.updateF=n,this.compareF=s,this.spec=a,this.provides=void 0}static define(t){let e=new Q4(Kh++,t.create,t.update,t.compare||((n,s)=>n===s),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(ss).find(n=>n.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:n=>(n.values[e]=this.create(n),1),update:(n,s)=>{let a=n.values[e],o=this.updateF(a,s);return this.compareF(a,o)?0:(n.values[e]=o,1)},reconfigure:(n,s)=>{let a=n.facet(ss),o=s.facet(ss),l;return(l=a.find(u=>u.field==this))&&l!=o.find(u=>u.field==this)?(n.values[e]=l.create(n),1):s.config.address[this.id]!=null?(n.values[e]=s.field(this),0):(n.values[e]=this.create(n),1)}}}init(t){return[this,ss.of({field:this,create:t})]}get extension(){return this}}const Nr={lowest:4,low:3,default:2,high:1,highest:0};function T6(r){return t=>new EL(t,r)}const hw={highest:T6(Nr.highest),high:T6(Nr.high),default:T6(Nr.default),low:T6(Nr.low),lowest:T6(Nr.lowest)};class EL{constructor(t,e){this.inner=t,this.prec=e}}class Ko{of(t){return new tc(this,t)}reconfigure(t){return Ko.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class tc{constructor(t,e){this.compartment=t,this.inner=e}}let $Q=class AL{constructor(t,e,n,s,a,o){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=s,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,n){let s=[],a=Object.create(null),o=new Map;for(let d of Tw(t,e,o))d instanceof Q4?s.push(d):(a[d.facet.id]||(a[d.facet.id]=[])).push(d);let l=Object.create(null),u=[],h=[];for(let d of s)l[d.id]=h.length<<1,h.push(p=>d.slot(p));let T=n==null?void 0:n.config.facets;for(let d in a){let p=a[d],m=p[0].facet,y=T&&T[d]||[];if(p.every(c=>c.type==0))if(l[m.id]=u.length<<1|1,Xh(y,p))u.push(n.facet(m));else{let c=m.combine(p.map(Q=>Q.value));u.push(n&&m.compare(c,n.facet(m))?n.facet(m):c)}else{for(let c of p)c.type==0?(l[c.id]=u.length<<1|1,u.push(c.value)):(l[c.id]=h.length<<1,h.push(Q=>c.dynamicSlot(Q)));l[m.id]=h.length<<1,h.push(c=>cw(c,m,p))}}let f=h.map(d=>d(l));return new AL(t,o,f,l,u,a)}};function Tw(r,t,e){let n=[[],[],[],[],[]],s=new Map;function a(o,l){let u=s.get(o);if(u!=null){if(u<=l)return;let h=n[u].indexOf(o);h>-1&&n[u].splice(h,1),o instanceof tc&&e.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)a(h,l);else if(o instanceof tc){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),a(h,l)}else if(o instanceof EL)a(o.inner,o.prec);else if(o instanceof Q4)n[l].push(o),o.provides&&a(o.provides,l);else if(o instanceof fa)n[l].push(o),o.facet.extensions&&a(o.facet.extensions,Nr.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(h,l)}}return a(r,Nr.default),n.reduce((o,l)=>o.concat(l))}function T5(r,t){if(t&1)return 2;let e=t>>1,n=r.status[e];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[e]=4;let s=r.computeSlot(r,r.config.dynamicSlots[e]);return r.status[e]=2|s}function Ia(r,t){return t&1?r.config.staticValues[t>>1]:r.values[t>>1]}const HL=ne.define(),ec=ne.define({combine:r=>r.some(t=>t),static:!0}),ML=ne.define({combine:r=>r.length?r[0]:void 0,static:!0}),wL=ne.define(),CL=ne.define(),DL=ne.define(),OL=ne.define({combine:r=>r.length?r[0]:!1});class Gn{constructor(t,e){this.type=t,this.value=e}static define(){return new fw}}class fw{of(t){return new Gn(this,t)}}class Qw{constructor(t){this.map=t}of(t){return new _1(this,t)}}class _1{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new _1(this.type,e)}is(t){return this.type==t}static define(t={}){return new Qw(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let s of t){let a=s.map(e);a&&n.push(a)}return n}}_1.reconfigure=_1.define();_1.appendConfig=_1.define();class Y1{constructor(t,e,n,s,a,o){this.startState=t,this.changes=e,this.selection=n,this.effects=s,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,n&&SL(n,e.newLength),a.some(l=>l.type==Y1.time)||(this.annotations=a.concat(Y1.time.of(Date.now())))}static create(t,e,n,s,a,o){return new Y1(t,e,n,s,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(Y1.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}Y1.time=Gn.define();Y1.userEvent=Gn.define();Y1.addToHistory=Gn.define();Y1.remote=Gn.define();function dw(r,t){let e=[];for(let n=0,s=0;;){let a,o;if(n<r.length&&(s==t.length||t[s]>=r[n]))a=r[n++],o=r[n++];else if(s<t.length)a=t[s++],o=t[s++];else return e;!e.length||e[e.length-1]<a?e.push(a,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function IL(r,t,e){var n;let s,a,o;return e?(s=t.changes,a=D1.empty(t.changes.length),o=r.changes.compose(t.changes)):(s=t.changes.map(r.changes),a=r.changes.mapDesc(t.changes,!0),o=r.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(a):(n=r.selection)===null||n===void 0?void 0:n.map(s),effects:_1.mapEffects(r.effects,s).concat(_1.mapEffects(t.effects,a)),annotations:r.annotations.length?r.annotations.concat(t.annotations):t.annotations,scrollIntoView:r.scrollIntoView||t.scrollIntoView}}function ic(r,t,e){let n=t.selection,s=rn(t.annotations);return t.userEvent&&(s=s.concat(Y1.userEvent.of(t.userEvent))),{changes:t.changes instanceof D1?t.changes:D1.of(t.changes||[],e,r.facet(ML)),selection:n&&(n instanceof Rt?n:Rt.single(n.anchor,n.head)),effects:rn(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function VL(r,t,e){let n=ic(r,t.length?t[0]:{},r.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let a=1;a<t.length;a++){t[a].filter===!1&&(e=!1);let o=!!t[a].sequential;n=IL(n,ic(r,t[a],o?n.changes.newLength:r.doc.length),o)}let s=Y1.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return gw(e?pw(s):s)}function pw(r){let t=r.startState,e=!0;for(let s of t.facet(wL)){let a=s(r);if(a===!1){e=!1;break}Array.isArray(a)&&(e=e===!0?a:dw(e,a))}if(e!==!0){let s,a;if(e===!1)a=r.changes.invertedDesc,s=D1.empty(t.doc.length);else{let o=r.changes.filter(e);s=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}r=Y1.create(t,s,r.selection&&r.selection.map(a),_1.mapEffects(r.effects,a),r.annotations,r.scrollIntoView)}let n=t.facet(CL);for(let s=n.length-1;s>=0;s--){let a=n[s](r);a instanceof Y1?r=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Y1?r=a[0]:r=VL(t,rn(a),!1)}return r}function gw(r){let t=r.startState,e=t.facet(DL),n=r;for(let s=e.length-1;s>=0;s--){let a=e[s](r);a&&Object.keys(a).length&&(n=IL(n,ic(t,a,r.changes.newLength),!0))}return n==r?r:Y1.create(t,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const mw=[];function rn(r){return r==null?mw:Array.isArray(r)?r:[r]}var Ti=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(Ti||(Ti={}));const yw=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let rc;try{rc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vw(r){if(rc)return rc.test(r);for(let t=0;t<r.length;t++){let e=r[t];if(/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||yw.test(e)))return!0}return!1}function Lw(r){return t=>{if(!/\S/.test(t))return Ti.Space;if(vw(t))return Ti.Word;for(let e=0;e<r.length;e++)if(t.indexOf(r[e])>-1)return Ti.Word;return Ti.Other}}class Oe{constructor(t,e,n,s,a,o){this.config=t,this.doc=e,this.selection=n,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)T5(this,l<<1);this.computeSlot=null}field(t,e=!0){let n=this.config.address[t.id];if(n==null){if(e)throw new RangeError("Field is not present in this state");return}return T5(this,n),Ia(this,n)}update(...t){return VL(this,t,!0)}applyTransaction(t){let e=this.config,{base:n,compartments:s}=e;for(let l of t.effects)l.is(Ko.reconfigure)?(e&&(s=new Map,e.compartments.forEach((u,h)=>s.set(h,u)),e=null),s.set(l.value.compartment,l.value.extension)):l.is(_1.reconfigure)?(e=null,n=l.value):l.is(_1.appendConfig)&&(e=null,n=rn(n).concat(l.value));let a;e?a=t.startState.values.slice():(e=$Q.resolve(n,s,this),a=new Oe(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let o=t.startState.facet(ec)?t.newSelection:t.newSelection.asSingle();new Oe(e,t.newDoc,o,a,(l,u)=>u.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:Rt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),s=this.changes(n.changes),a=[n.range],o=rn(n.effects);for(let l=1;l<e.ranges.length;l++){let u=t(e.ranges[l]),h=this.changes(u.changes),T=h.map(s);for(let d=0;d<l;d++)a[d]=a[d].map(T);let f=s.mapDesc(h,!0);a.push(u.range.map(f)),s=s.compose(T),o=_1.mapEffects(o,T).concat(_1.mapEffects(rn(u.effects),f))}return{changes:s,selection:Rt.create(a,e.mainIndex),effects:o}}changes(t=[]){return t instanceof D1?t:D1.of(t,this.doc.length,this.facet(Oe.lineSeparator))}toText(t){return Ie.of(t.split(this.facet(Oe.lineSeparator)||Xu))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(T5(this,e),Ia(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let n in t){let s=t[n];s instanceof Q4&&this.config.address[s.id]!=null&&(e[n]=s.spec.toJSON(this.field(t[n]),this))}return e}static fromJSON(t,e={},n){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(t,a)){let o=n[a],l=t[a];s.push(o.init(u=>o.spec.fromJSON(l,u)))}}return Oe.create({doc:t.doc,selection:Rt.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s})}static create(t={}){let e=$Q.resolve(t.extensions||[],new Map),n=t.doc instanceof Ie?t.doc:Ie.of((t.doc||"").split(e.staticFacet(Oe.lineSeparator)||Xu)),s=t.selection?t.selection instanceof Rt?t.selection:Rt.single(t.selection.anchor,t.selection.head):Rt.single(0);return SL(s,n.length),e.staticFacet(ec)||(s=s.asSingle()),new Oe(e,n,s,e.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Oe.tabSize)}get lineBreak(){return this.facet(Oe.lineSeparator)||`
107
+ `,this;t--}else if(s instanceof o1){let u=s.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,u.length>Math.max(0,t))return this.value=t==0?u:e>0?u.slice(t):u.slice(0,u.length-t),this;t-=u.length}else{let u=s.children[o+(e<0?-1:0)];t>u.length?(t-=u.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(u),this.offsets.push(e>0?1:(u instanceof o1?u.text.length:u.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class xL{constructor(t,e,n){this.value="",this.done=!1,this.cursor=new h5(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=n?s:e<0?s.slice(s.length-n):s.slice(0,n),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _L{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:s}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ie.prototype[Symbol.iterator]=function(){return this.iter()},h5.prototype[Symbol.iterator]=xL.prototype[Symbol.iterator]=_L.prototype[Symbol.iterator]=function(){return this});let uw=class{constructor(t,e,n,s){this.from=t,this.to=e,this.number=n,this.text=s}get length(){return this.to-this.from}};function pn(r,t,e){return t=Math.max(0,Math.min(r.length,t)),[t,Math.max(t,Math.min(r.length,e))]}function e3(r,t,e=!0,n=!0){return aw(r,t,e,n)}const Xu=/\r\n?|\n/;var S2=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(S2||(S2={}));class pi{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,n=0,s=0;e<this.sections.length;){let a=this.sections[e++],o=this.sections[e++];o<0?(t(n,s,a),s+=a):s+=o,n+=a}}iterChangedRanges(t,e=!1){$u(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],s=this.sections[e++];s<0?t.push(n,s):t.push(s,n)}return new pi(t)}composeDesc(t){return this.empty?t:t.empty?this:bL(this,t)}mapDesc(t,e=!1){return t.empty?this:Yu(this,t,e)}mapPos(t,e=-1,n=S2.Simple){let s=0,a=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],u=this.sections[o++],h=s+l;if(u<0){if(h>t)return a+(t-s);a+=l}else{if(n!=S2.Simple&&h>=t&&(n==S2.TrackDel&&s<t&&h>t||n==S2.TrackBefore&&s<t||n==S2.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==s||e<0?a:a+u;a+=u}s=h}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return a}touchesRange(t,e=t){for(let n=0,s=0;n<this.sections.length&&s<=e;){let a=this.sections[n++],o=this.sections[n++],l=s+a;if(o>=0&&s<=e&&l>=t)return s<t&&l>e?"cover":!0;s=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let n=this.sections[e++],s=this.sections[e++];t+=(t?" ":"")+n+(s>=0?":"+s:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new pi(t)}static create(t){return new pi(t)}}class D1 extends pi{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return $u(this,(e,n,s,a,o)=>t=t.replace(s,s+(n-e),o),!1),t}mapDesc(t,e=!1){return Yu(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let s=0,a=0;s<e.length;s+=2){let o=e[s],l=e[s+1];if(l>=0){e[s]=l,e[s+1]=o;let u=s>>1;for(;n.length<u;)n.push(Ie.empty);n.push(o?t.slice(a,a+o):Ie.empty)}a+=o}return new D1(e,n)}compose(t){return this.empty?t:t.empty?this:bL(this,t,!0)}map(t,e=!1){return t.empty?this:Yu(this,t,e,!0)}iterChanges(t,e=!1){$u(this,t,e)}get desc(){return pi.create(this.sections)}filter(t){let e=[],n=[],s=[],a=new M5(this);t:for(let o=0,l=0;;){let u=o==t.length?1e9:t[o++];for(;l<u||l==u&&a.len==0;){if(a.done)break t;let T=Math.min(a.len,u-l);Y1(s,T,-1);let f=a.ins==-1?-1:a.off==0?a.ins:0;Y1(e,T,f),f>0&&Ji(n,e,a.text),a.forward(T),l+=T}let h=t[o++];for(;l<h;){if(a.done)break t;let T=Math.min(a.len,h-l);Y1(e,T,-1),Y1(s,T,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(T),l+=T}}return{changes:new D1(e,n),filtered:pi.create(s)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let n=this.sections[e],s=this.sections[e+1];s<0?t.push(n):s==0?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,n){let s=[],a=[],o=0,l=null;function u(T=!1){if(!T&&!s.length)return;o<e&&Y1(s,e-o,-1);let f=new D1(s,a);l=l?l.compose(f.map(l)):f,s=[],a=[],o=0}function h(T){if(Array.isArray(T))for(let f of T)h(f);else if(T instanceof D1){if(T.length!=e)throw new RangeError(`Mismatched change set length (got ${T.length}, expected ${e})`);u(),l=l?l.compose(T.map(l)):T}else{let{from:f,to:d=f,insert:p}=T;if(f>d||f<0||d>e)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${e})`);let m=p?typeof p=="string"?Ie.of(p.split(n||Xu)):p:Ie.empty,y=m.length;if(f==d&&y==0)return;f<o&&u(),f>o&&Y1(s,f-o,-1),Y1(s,d-f,y),Ji(a,s,m),o=d}}return h(t),u(!l),l}static empty(t){return new D1(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let s=0;s<t.length;s++){let a=t[s];if(typeof a=="number")e.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)e.push(a[0],0);else{for(;n.length<s;)n.push(Ie.empty);n[s]=Ie.of(a.slice(1)),e.push(a[0],n[s].length)}}}return new D1(e,n)}static createSet(t,e){return new D1(t,e)}}function Y1(r,t,e,n=!1){if(t==0&&e<=0)return;let s=r.length-2;s>=0&&e<=0&&e==r[s+1]?r[s]+=t:s>=0&&t==0&&r[s]==0?r[s+1]+=e:n?(r[s]+=t,r[s+1]+=e):r.push(t,e)}function Ji(r,t,e){if(e.length==0)return;let n=t.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(e);else{for(;r.length<n;)r.push(Ie.empty);r.push(e)}}function $u(r,t,e){let n=r.inserted;for(let s=0,a=0,o=0;o<r.sections.length;){let l=r.sections[o++],u=r.sections[o++];if(u<0)s+=l,a+=l;else{let h=s,T=a,f=Ie.empty;for(;h+=l,T+=u,u&&n&&(f=f.append(n[o-2>>1])),!(e||o==r.sections.length||r.sections[o+1]<0);)l=r.sections[o++],u=r.sections[o++];t(s,h,a,T,f),s=h,a=T}}}function Yu(r,t,e,n=!1){let s=[],a=n?[]:null,o=new M5(r),l=new M5(t);for(let u=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Y1(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!e))){let h=l.len;for(Y1(s,l.ins,-1);h;){let T=Math.min(o.len,h);o.ins>=0&&u<o.i&&o.len<=T&&(Y1(s,0,o.ins),a&&Ji(a,s,o.text),u=o.i),o.forward(T),h-=T}l.next()}else if(o.ins>=0){let h=0,T=o.len;for(;T;)if(l.ins==-1){let f=Math.min(T,l.len);h+=f,T-=f,l.forward(f)}else if(l.ins==0&&l.len<T)T-=l.len,l.next();else break;Y1(s,h,u<o.i?o.ins:0),a&&u<o.i&&Ji(a,s,o.text),u=o.i,o.forward(o.len-T)}else{if(o.done&&l.done)return a?D1.createSet(s,a):pi.create(s);throw new Error("Mismatched change set lengths")}}}function bL(r,t,e=!1){let n=[],s=e?[]:null,a=new M5(r),o=new M5(t);for(let l=!1;;){if(a.done&&o.done)return s?D1.createSet(n,s):pi.create(n);if(a.ins==0)Y1(n,a.len,0,l),a.next();else if(o.len==0&&!o.done)Y1(n,0,o.ins,l),s&&Ji(s,n,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(a.len2,o.len),h=n.length;if(a.ins==-1){let T=o.ins==-1?-1:o.off?0:o.ins;Y1(n,u,T,l),s&&T&&Ji(s,n,o.text)}else o.ins==-1?(Y1(n,a.off?0:a.len,u,l),s&&Ji(s,n,a.textBit(u))):(Y1(n,a.off?0:a.len,o.off?0:o.ins,l),s&&!o.off&&Ji(s,n,o.text));l=(a.ins>u||o.ins>=0&&o.len>u)&&(l||n.length>h),a.forward2(u),o.forward(u)}}}}class M5{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,e=this.i-2>>1;return e>=t.length?Ie.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?Ie.empty:e[n].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class jr{constructor(t,e,n){this.from=t,this.to=e,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let n,s;return this.empty?n=s=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),n==this.from&&s==this.to?this:new jr(n,s,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return Rt.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return Rt.range(this.anchor,n)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Rt.range(t.anchor,t.head)}static create(t,e,n){return new jr(t,e,n)}}class Rt{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:Rt.create(this.ranges.map(n=>n.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(t.ranges[n],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Rt([this.main],0)}addRange(t,e=!0){return Rt.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let n=this.ranges.slice();return n[e]=t,Rt.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Rt(t.ranges.map(e=>jr.fromJSON(e)),t.main)}static single(t,e=t){return new Rt([Rt.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,s=0;s<t.length;s++){let a=t[s];if(a.empty?a.from<=n:a.from<n)return Rt.normalized(t.slice(),e);n=a.to}return new Rt(t,e)}static cursor(t,e=0,n,s){return jr.create(t,t,(e==0?0:e<0?8:16)|(n==null?7:Math.min(6,n))|(s??16777215)<<6)}static range(t,e,n,s){let a=(n??16777215)<<6|(s==null?7:Math.min(6,s));return e<t?jr.create(e,t,48|a):jr.create(t,e,(e>t?8:0)|a)}static normalized(t,e=0){let n=t[e];t.sort((s,a)=>s.from-a.from),e=t.indexOf(n);for(let s=1;s<t.length;s++){let a=t[s],o=t[s-1];if(a.empty?a.from<=o.to:a.from<o.to){let l=o.from,u=Math.max(a.to,o.to);s<=e&&e--,t.splice(--s,2,a.anchor>a.head?Rt.range(u,l):Rt.range(l,u))}}return new Rt(t,e)}}function SL(r,t){for(let e of r.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Kh=0;class ne{constructor(t,e,n,s,a){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=s,this.id=Kh++,this.default=t([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(t={}){return new ne(t.combine||(e=>e),t.compareInput||((e,n)=>e===n),t.compare||(t.combine?(e,n)=>e===n:Xh),!!t.static,t.enables)}of(t){return new fa([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new fa(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new fa(t,this,2,e)}from(t,e){return e||(e=n=>n),this.compute([t],n=>e(n.field(t)))}}function Xh(r,t){return r==t||r.length==t.length&&r.every((e,n)=>e===t[n])}class fa{constructor(t,e,n,s){this.dependencies=t,this.facet=e,this.type=n,this.value=s,this.id=Kh++}dynamicSlot(t){var e;let n=this.value,s=this.facet.compareInput,a=this.id,o=t[a]>>1,l=this.type==2,u=!1,h=!1,T=[];for(let f of this.dependencies)f=="doc"?u=!0:f=="selection"?h=!0:((e=t[f.id])!==null&&e!==void 0?e:1)&1||T.push(t[f.id]);return{create(f){return f.values[o]=n(f),1},update(f,d){if(u&&d.docChanged||h&&(d.docChanged||d.selection)||Ju(f,T)){let p=n(f);if(l?!XQ(p,f.values[o],s):!s(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,d)=>{let p,m=d.config.address[a];if(m!=null){let y=Ia(d,m);if(this.dependencies.every(c=>c instanceof ne?d.facet(c)===f.facet(c):c instanceof Q4?d.field(c,!1)==f.field(c,!1):!0)||(l?XQ(p=n(f),y,s):s(p=n(f),y)))return f.values[o]=y,0}else p=n(f);return f.values[o]=p,1}}}}function XQ(r,t,e){if(r.length!=t.length)return!1;for(let n=0;n<r.length;n++)if(!e(r[n],t[n]))return!1;return!0}function Ju(r,t){let e=!1;for(let n of t)T5(r,n)&1&&(e=!0);return e}function cw(r,t,e){let n=e.map(u=>r[u.id]),s=e.map(u=>u.type),a=n.filter(u=>!(u&1)),o=r[t.id]>>1;function l(u){let h=[];for(let T=0;T<n.length;T++){let f=Ia(u,n[T]);if(s[T]==2)for(let d of f)h.push(d);else h.push(f)}return t.combine(h)}return{create(u){for(let h of n)T5(u,h);return u.values[o]=l(u),1},update(u,h){if(!Ju(u,a))return 0;let T=l(u);return t.compare(T,u.values[o])?0:(u.values[o]=T,1)},reconfigure(u,h){let T=Ju(u,n),f=h.config.facets[t.id],d=h.facet(t);if(f&&!T&&Xh(e,f))return u.values[o]=d,0;let p=l(u);return t.compare(p,d)?(u.values[o]=d,0):(u.values[o]=p,1)}}}const ss=ne.define({static:!0});class Q4{constructor(t,e,n,s,a){this.id=t,this.createF=e,this.updateF=n,this.compareF=s,this.spec=a,this.provides=void 0}static define(t){let e=new Q4(Kh++,t.create,t.update,t.compare||((n,s)=>n===s),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(ss).find(n=>n.field==this);return((e==null?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:n=>(n.values[e]=this.create(n),1),update:(n,s)=>{let a=n.values[e],o=this.updateF(a,s);return this.compareF(a,o)?0:(n.values[e]=o,1)},reconfigure:(n,s)=>{let a=n.facet(ss),o=s.facet(ss),l;return(l=a.find(u=>u.field==this))&&l!=o.find(u=>u.field==this)?(n.values[e]=l.create(n),1):s.config.address[this.id]!=null?(n.values[e]=s.field(this),0):(n.values[e]=this.create(n),1)}}}init(t){return[this,ss.of({field:this,create:t})]}get extension(){return this}}const Nr={lowest:4,low:3,default:2,high:1,highest:0};function T6(r){return t=>new EL(t,r)}const hw={highest:T6(Nr.highest),high:T6(Nr.high),default:T6(Nr.default),low:T6(Nr.low),lowest:T6(Nr.lowest)};class EL{constructor(t,e){this.inner=t,this.prec=e}}class Ko{of(t){return new tc(this,t)}reconfigure(t){return Ko.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class tc{constructor(t,e){this.compartment=t,this.inner=e}}let $Q=class AL{constructor(t,e,n,s,a,o){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=s,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,n){let s=[],a=Object.create(null),o=new Map;for(let d of Tw(t,e,o))d instanceof Q4?s.push(d):(a[d.facet.id]||(a[d.facet.id]=[])).push(d);let l=Object.create(null),u=[],h=[];for(let d of s)l[d.id]=h.length<<1,h.push(p=>d.slot(p));let T=n==null?void 0:n.config.facets;for(let d in a){let p=a[d],m=p[0].facet,y=T&&T[d]||[];if(p.every(c=>c.type==0))if(l[m.id]=u.length<<1|1,Xh(y,p))u.push(n.facet(m));else{let c=m.combine(p.map(Q=>Q.value));u.push(n&&m.compare(c,n.facet(m))?n.facet(m):c)}else{for(let c of p)c.type==0?(l[c.id]=u.length<<1|1,u.push(c.value)):(l[c.id]=h.length<<1,h.push(Q=>c.dynamicSlot(Q)));l[m.id]=h.length<<1,h.push(c=>cw(c,m,p))}}let f=h.map(d=>d(l));return new AL(t,o,f,l,u,a)}};function Tw(r,t,e){let n=[[],[],[],[],[]],s=new Map;function a(o,l){let u=s.get(o);if(u!=null){if(u<=l)return;let h=n[u].indexOf(o);h>-1&&n[u].splice(h,1),o instanceof tc&&e.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)a(h,l);else if(o instanceof tc){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),a(h,l)}else if(o instanceof EL)a(o.inner,o.prec);else if(o instanceof Q4)n[l].push(o),o.provides&&a(o.provides,l);else if(o instanceof fa)n[l].push(o),o.facet.extensions&&a(o.facet.extensions,Nr.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(h,l)}}return a(r,Nr.default),n.reduce((o,l)=>o.concat(l))}function T5(r,t){if(t&1)return 2;let e=t>>1,n=r.status[e];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[e]=4;let s=r.computeSlot(r,r.config.dynamicSlots[e]);return r.status[e]=2|s}function Ia(r,t){return t&1?r.config.staticValues[t>>1]:r.values[t>>1]}const HL=ne.define(),ec=ne.define({combine:r=>r.some(t=>t),static:!0}),ML=ne.define({combine:r=>r.length?r[0]:void 0,static:!0}),wL=ne.define(),CL=ne.define(),DL=ne.define(),OL=ne.define({combine:r=>r.length?r[0]:!1});class Gn{constructor(t,e){this.type=t,this.value=e}static define(){return new fw}}class fw{of(t){return new Gn(this,t)}}class Qw{constructor(t){this.map=t}of(t){return new _1(this,t)}}class _1{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new _1(this.type,e)}is(t){return this.type==t}static define(t={}){return new Qw(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let s of t){let a=s.map(e);a&&n.push(a)}return n}}_1.reconfigure=_1.define();_1.appendConfig=_1.define();class J1{constructor(t,e,n,s,a,o){this.startState=t,this.changes=e,this.selection=n,this.effects=s,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,n&&SL(n,e.newLength),a.some(l=>l.type==J1.time)||(this.annotations=a.concat(J1.time.of(Date.now())))}static create(t,e,n,s,a,o){return new J1(t,e,n,s,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(J1.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}J1.time=Gn.define();J1.userEvent=Gn.define();J1.addToHistory=Gn.define();J1.remote=Gn.define();function dw(r,t){let e=[];for(let n=0,s=0;;){let a,o;if(n<r.length&&(s==t.length||t[s]>=r[n]))a=r[n++],o=r[n++];else if(s<t.length)a=t[s++],o=t[s++];else return e;!e.length||e[e.length-1]<a?e.push(a,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function IL(r,t,e){var n;let s,a,o;return e?(s=t.changes,a=D1.empty(t.changes.length),o=r.changes.compose(t.changes)):(s=t.changes.map(r.changes),a=r.changes.mapDesc(t.changes,!0),o=r.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(a):(n=r.selection)===null||n===void 0?void 0:n.map(s),effects:_1.mapEffects(r.effects,s).concat(_1.mapEffects(t.effects,a)),annotations:r.annotations.length?r.annotations.concat(t.annotations):t.annotations,scrollIntoView:r.scrollIntoView||t.scrollIntoView}}function ic(r,t,e){let n=t.selection,s=rn(t.annotations);return t.userEvent&&(s=s.concat(J1.userEvent.of(t.userEvent))),{changes:t.changes instanceof D1?t.changes:D1.of(t.changes||[],e,r.facet(ML)),selection:n&&(n instanceof Rt?n:Rt.single(n.anchor,n.head)),effects:rn(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function VL(r,t,e){let n=ic(r,t.length?t[0]:{},r.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let a=1;a<t.length;a++){t[a].filter===!1&&(e=!1);let o=!!t[a].sequential;n=IL(n,ic(r,t[a],o?n.changes.newLength:r.doc.length),o)}let s=J1.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return gw(e?pw(s):s)}function pw(r){let t=r.startState,e=!0;for(let s of t.facet(wL)){let a=s(r);if(a===!1){e=!1;break}Array.isArray(a)&&(e=e===!0?a:dw(e,a))}if(e!==!0){let s,a;if(e===!1)a=r.changes.invertedDesc,s=D1.empty(t.doc.length);else{let o=r.changes.filter(e);s=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}r=J1.create(t,s,r.selection&&r.selection.map(a),_1.mapEffects(r.effects,a),r.annotations,r.scrollIntoView)}let n=t.facet(CL);for(let s=n.length-1;s>=0;s--){let a=n[s](r);a instanceof J1?r=a:Array.isArray(a)&&a.length==1&&a[0]instanceof J1?r=a[0]:r=VL(t,rn(a),!1)}return r}function gw(r){let t=r.startState,e=t.facet(DL),n=r;for(let s=e.length-1;s>=0;s--){let a=e[s](r);a&&Object.keys(a).length&&(n=IL(n,ic(t,a,r.changes.newLength),!0))}return n==r?r:J1.create(t,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const mw=[];function rn(r){return r==null?mw:Array.isArray(r)?r:[r]}var Ti=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(Ti||(Ti={}));const yw=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let rc;try{rc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vw(r){if(rc)return rc.test(r);for(let t=0;t<r.length;t++){let e=r[t];if(/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||yw.test(e)))return!0}return!1}function Lw(r){return t=>{if(!/\S/.test(t))return Ti.Space;if(vw(t))return Ti.Word;for(let e=0;e<r.length;e++)if(t.indexOf(r[e])>-1)return Ti.Word;return Ti.Other}}class Oe{constructor(t,e,n,s,a,o){this.config=t,this.doc=e,this.selection=n,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)T5(this,l<<1);this.computeSlot=null}field(t,e=!0){let n=this.config.address[t.id];if(n==null){if(e)throw new RangeError("Field is not present in this state");return}return T5(this,n),Ia(this,n)}update(...t){return VL(this,t,!0)}applyTransaction(t){let e=this.config,{base:n,compartments:s}=e;for(let l of t.effects)l.is(Ko.reconfigure)?(e&&(s=new Map,e.compartments.forEach((u,h)=>s.set(h,u)),e=null),s.set(l.value.compartment,l.value.extension)):l.is(_1.reconfigure)?(e=null,n=l.value):l.is(_1.appendConfig)&&(e=null,n=rn(n).concat(l.value));let a;e?a=t.startState.values.slice():(e=$Q.resolve(n,s,this),a=new Oe(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(u,h)=>h.reconfigure(u,this),null).values);let o=t.startState.facet(ec)?t.newSelection:t.newSelection.asSingle();new Oe(e,t.newDoc,o,a,(l,u)=>u.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:Rt.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),s=this.changes(n.changes),a=[n.range],o=rn(n.effects);for(let l=1;l<e.ranges.length;l++){let u=t(e.ranges[l]),h=this.changes(u.changes),T=h.map(s);for(let d=0;d<l;d++)a[d]=a[d].map(T);let f=s.mapDesc(h,!0);a.push(u.range.map(f)),s=s.compose(T),o=_1.mapEffects(o,T).concat(_1.mapEffects(rn(u.effects),f))}return{changes:s,selection:Rt.create(a,e.mainIndex),effects:o}}changes(t=[]){return t instanceof D1?t:D1.of(t,this.doc.length,this.facet(Oe.lineSeparator))}toText(t){return Ie.of(t.split(this.facet(Oe.lineSeparator)||Xu))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(T5(this,e),Ia(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let n in t){let s=t[n];s instanceof Q4&&this.config.address[s.id]!=null&&(e[n]=s.spec.toJSON(this.field(t[n]),this))}return e}static fromJSON(t,e={},n){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(t,a)){let o=n[a],l=t[a];s.push(o.init(u=>o.spec.fromJSON(l,u)))}}return Oe.create({doc:t.doc,selection:Rt.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s})}static create(t={}){let e=$Q.resolve(t.extensions||[],new Map),n=t.doc instanceof Ie?t.doc:Ie.of((t.doc||"").split(e.staticFacet(Oe.lineSeparator)||Xu)),s=t.selection?t.selection instanceof Rt?t.selection:Rt.single(t.selection.anchor,t.selection.head):Rt.single(0);return SL(s,n.length),e.staticFacet(ec)||(s=s.asSingle()),new Oe(e,n,s,e.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Oe.tabSize)}get lineBreak(){return this.facet(Oe.lineSeparator)||`
108
108
  `}get readOnly(){return this.facet(OL)}phrase(t,...e){for(let n of this.facet(Oe.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(n,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>e.length?n:e[a-1]})),t}languageDataAt(t,e,n=-1){let s=[];for(let a of this.facet(HL))for(let o of a(this,e,n))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let e=this.languageDataAt("wordChars",t);return Lw(e.length?e[0]:"")}wordAt(t){let{text:e,from:n,length:s}=this.doc.lineAt(t),a=this.charCategorizer(t),o=t-n,l=t-n;for(;o>0;){let u=e3(e,o,!1);if(a(e.slice(u,o))!=Ti.Word)break;o=u}for(;l<s;){let u=e3(e,l);if(a(e.slice(l,u))!=Ti.Word)break;l=u}return o==l?null:Rt.range(o+n,l+n)}}Oe.allowMultipleSelections=ec;Oe.tabSize=ne.define({combine:r=>r.length?r[0]:4});Oe.lineSeparator=ML;Oe.readOnly=OL;Oe.phrases=ne.define({compare(r,t){let e=Object.keys(r),n=Object.keys(t);return e.length==n.length&&e.every(s=>r[s]==t[s])}});Oe.languageData=HL;Oe.changeFilter=wL;Oe.transactionFilter=CL;Oe.transactionExtender=DL;Ko.reconfigure=_1.define();class Jr{eq(t){return this==t}range(t,e=t){return w5.create(t,e,this)}}Jr.prototype.startSide=Jr.prototype.endSide=0;Jr.prototype.point=!1;Jr.prototype.mapMode=S2.TrackDel;function $h(r,t){return r==t||r.constructor==t.constructor&&r.eq(t)}class w5{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new w5(t,e,n)}}function nc(r,t){return r.from-t.from||r.value.startSide-t.value.startSide}class Yh{constructor(t,e,n,s){this.from=t,this.to=e,this.value=n,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,s=0){let a=n?this.to:this.from;for(let o=s,l=a.length;;){if(o==l)return o;let u=o+l>>1,h=a[u]-t||(n?this.value[u].endSide:this.value[u].startSide)-e;if(u==o)return h>=0?o:l;h>=0?l=u:o=u+1}}between(t,e,n,s){for(let a=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,a);a<o;a++)if(s(this.from[a]+t,this.to[a]+t,this.value[a])===!1)return!1}map(t,e){let n=[],s=[],a=[],o=-1,l=-1;for(let u=0;u<this.value.length;u++){let h=this.value[u],T=this.from[u]+t,f=this.to[u]+t,d,p;if(T==f){let m=e.mapPos(T,h.startSide,h.mapMode);if(m==null||(d=p=m,h.startSide!=h.endSide&&(p=e.mapPos(T,h.endSide),p<d)))continue}else if(d=e.mapPos(T,h.startSide),p=e.mapPos(f,h.endSide),d>p||d==p&&h.startSide>0&&h.endSide<=0)continue;(p-d||h.endSide-h.startSide)<0||(o<0&&(o=d),h.point&&(l=Math.max(l,p-d)),n.push(h),s.push(d-o),a.push(p-o))}return{mapped:n.length?new Yh(s,a,n,l):null,pos:o}}}class Me{constructor(t,e,n,s){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=s}static create(t,e,n,s){return new Me(t,e,n,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:n=!1,filterFrom:s=0,filterTo:a=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(n&&(e=e.slice().sort(nc)),this.isEmpty)return e.length?Me.of(e):this;let l=new PL(this,null,-1).goto(0),u=0,h=[],T=new Va;for(;l.value||u<e.length;)if(u<e.length&&(l.from-e[u].from||l.startSide-e[u].value.startSide)>=0){let f=e[u++];T.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(u==e.length||this.chunkEnd(l.chunkIndex)<e[u].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||a<this.chunkPos[l.chunkIndex])&&T.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||a<l.from||o(l.from,l.to,l.value))&&(T.addInner(l.from,l.to,l.value)||h.push(w5.create(l.from,l.to,l.value))),l.next());return T.finishInner(this.nextLayer.isEmpty&&!h.length?Me.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],n=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],u=this.chunk[o],h=t.touchesRange(l,l+u.length);if(h===!1)s=Math.max(s,u.maxPoint),e.push(u),n.push(t.mapPos(l));else if(h===!0){let{mapped:T,pos:f}=u.map(l,t);T&&(s=Math.max(s,T.maxPoint),e.push(T),n.push(f))}}let a=this.nextLayer.map(t);return e.length==0?a:new Me(n,e,a||Me.empty,s)}between(t,e,n){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],o=this.chunk[s];if(e>=a&&t<=a+o.length&&o.between(a,t-a,e-a,n)===!1)return}this.nextLayer.between(t,e,n)}}iter(t=0){return C5.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return C5.from(t).goto(e)}static compare(t,e,n,s,a=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),l=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),u=YQ(o,l,n),h=new f6(o,u,a),T=new f6(l,u,a);n.iterGaps((f,d,p)=>JQ(h,f,T,d,p,s)),n.empty&&n.length==0&&JQ(h,0,T,0,0,s)}static eq(t,e,n=0,s){s==null&&(s=999999999);let a=t.filter(T=>!T.isEmpty&&e.indexOf(T)<0),o=e.filter(T=>!T.isEmpty&&t.indexOf(T)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let l=YQ(a,o),u=new f6(a,l,0).goto(n),h=new f6(o,l,0).goto(n);for(;;){if(u.to!=h.to||!sc(u.active,h.active)||u.point&&(!h.point||!$h(u.point,h.point)))return!1;if(u.to>s)return!0;u.next(),h.next()}}static spans(t,e,n,s,a=-1){let o=new f6(t,null,a).goto(e),l=e,u=o.openStart;for(;;){let h=Math.min(o.to,n);if(o.point){let T=o.activeForPoint(o.to),f=o.pointFrom<e?T.length+1:o.point.startSide<0?T.length:Math.min(T.length,u);s.point(l,h,o.point,T,f,o.pointRank),u=Math.min(o.openEnd(h),T.length)}else h>l&&(s.span(l,h,o.active,u),u=o.openEnd(h));if(o.to>n)return u+(o.point&&o.to>n?1:0);l=o.to,o.next()}}static of(t,e=!1){let n=new Va;for(let s of t instanceof w5?[t]:e?xw(t):t)n.add(s.from,s.to,s.value);return n.finish()}static join(t){if(!t.length)return Me.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let s=t[n];s!=Me.empty;s=s.nextLayer)e=new Me(s.chunkPos,s.chunk,e,Math.max(s.maxPoint,e.maxPoint));return e}}Me.empty=new Me([],[],null,-1);function xw(r){if(r.length>1)for(let t=r[0],e=1;e<r.length;e++){let n=r[e];if(nc(t,n)>0)return r.slice().sort(nc);t=n}return r}Me.empty.nextLayer=Me.empty;class Va{finishChunk(t){this.chunks.push(new Yh(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new Va)).add(t,e,n)}addInner(t,e,n){let s=t-this.lastTo||n.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(Me.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=Me.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function YQ(r,t,e){let n=new Map;for(let a of r)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&n.set(a.chunk[o],a.chunkPos[o]);let s=new Set;for(let a of t)for(let o=0;o<a.chunk.length;o++){let l=n.get(a.chunk[o]);l!=null&&(e?e.mapPos(l):l)==a.chunkPos[o]&&!(e!=null&&e.touchesRange(l,l+a.chunk[o].length))&&s.add(a.chunk[o])}return s}class PL{constructor(t,e,n,s=0){this.layer=t,this.skip=e,this.minPoint=n,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class C5{constructor(t){this.heap=t}static from(t,e=null,n=-1){let s=[];for(let a=0;a<t.length;a++)for(let o=t[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&s.push(new PL(o,e,n,a));return s.length==1?s[0]:new C5(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let n=this.heap.length>>1;n>=0;n--)Yl(this.heap,n);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let n=this.heap.length>>1;n>=0;n--)Yl(this.heap,n);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Yl(this.heap,0)}}}function Yl(r,t){for(let e=r[t];;){let n=(t<<1)+1;if(n>=r.length)break;let s=r[n];if(n+1<r.length&&s.compare(r[n+1])>=0&&(s=r[n+1],n++),e.compare(s)<0)break;r[n]=e,r[t]=s,t=n}}class f6{constructor(t,e,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=C5.from(t,e,n)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){as(this.active,t),as(this.activeTo,t),as(this.activeRank,t),this.minActive=td(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:s,rank:a}=this.cursor;for(;e<this.activeRank.length&&(a-this.activeRank[e]||s-this.activeTo[e])>0;)e++;os(this.active,e,n),os(this.activeTo,e,s),os(this.activeRank,e,a),t&&os(t,e,this.cursor.from),this.minActive=td(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),n&&as(n,s)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(n),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let s=n.length-1;s>=0&&n[s]<t;s--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function JQ(r,t,e,n,s,a){r.goto(t),e.goto(n);let o=n+s,l=n,u=n-t,h=!!a.boundChange;for(let T=!1;;){let f=r.to+u-e.to,d=f||r.endSide-e.endSide,p=d<0?r.to+u:e.to,m=Math.min(p,o);if(r.point||e.point?(r.point&&e.point&&$h(r.point,e.point)&&sc(r.activeForPoint(r.to),e.activeForPoint(e.to))||a.comparePoint(l,m,r.point,e.point),T=!1):(T&&a.boundChange(l),m>l&&!sc(r.active,e.active)&&a.compareRange(l,m,r.active,e.active),h&&m<o&&(f||r.openEnd(p)!=e.openEnd(p))&&(T=!0)),p>o)break;l=p,d<=0&&r.next(),d>=0&&e.next()}}function sc(r,t){if(r.length!=t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!=t[e]&&!$h(r[e],t[e]))return!1;return!0}function as(r,t){for(let e=t,n=r.length-1;e<n;e++)r[e]=r[e+1];r.pop()}function os(r,t,e){for(let n=r.length-1;n>=t;n--)r[n+1]=r[n];r[t]=e}function td(r,t){let e=-1,n=1e9;for(let s=0;s<t.length;s++)(t[s]-n||r[s].endSide-r[e].endSide)<0&&(e=s,n=t[s]);return e}function _w(r,t,e,n){for(let s=0,a=0;;){if(a>=t)return s;if(s==r.length)break;a+=r.charCodeAt(s)==9?e-a%e:1,s=e3(r,s)}return r.length}const ac="ͼ",ed=typeof Symbol>"u"?"__"+ac:Symbol.for(ac),oc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),id=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class hr{constructor(t,e){this.rules=[];let{finish:n}=e||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,l,u,h){let T=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return u.push(o[0]+";");for(let p in l){let m=l[p];if(/&/.test(p))a(p.split(/,\s*/).map(y=>o.map(c=>y.replace(/&/,c))).reduce((y,c)=>y.concat(c)),m,u);else if(m&&typeof m=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");a(s(p),m,T,d)}else m!=null&&T.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(T.length||d)&&u.push((n&&!f&&!h?o.map(n):o).join(", ")+" {"+T.join(" ")+"}")}for(let o in t)a(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
109
109
  `)}static newName(){let t=id[ed]||1;return id[ed]=t+1,ac+t.toString(36)}static mount(t,e,n){let s=t[oc],a=n&&n.nonce;s?a&&s.setNonce(a):s=new bw(t,a),s.mount(Array.isArray(e)?e:[e],t)}}let rd=new Map;class bw{constructor(t,e){let n=t.ownerDocument||t,s=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let a=rd.get(n);if(a)return t[oc]=a;this.sheet=new s.CSSStyleSheet,rd.set(n,this)}else this.styleTag=n.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[oc]=this}mount(t,e){let n=this.sheet,s=0,a=0;for(let o=0;o<t.length;o++){let l=t[o],u=this.modules.indexOf(l);if(u<a&&u>-1&&(this.modules.splice(u,1),a--,u=-1),u==-1){if(this.modules.splice(a++,0,l),n)for(let h=0;h<l.rules.length;h++)n.insertRule(l.rules[h],s++)}else{for(;a<u;)s+=this.modules[a++].rules.length;s+=l.rules.length,a++}}if(n)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
110
- `;this.styleTag.textContent=o;let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var gn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},lc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};for(var U1=0;U1<10;U1++)gn[48+U1]=gn[96+U1]=String(U1);for(var U1=1;U1<=24;U1++)gn[U1+111]="F"+U1;for(var U1=65;U1<=90;U1++)gn[U1]=String.fromCharCode(U1+32),lc[U1]=String.fromCharCode(U1);for(var Jl in gn)lc.hasOwnProperty(Jl)||(lc[Jl]=gn[Jl]);let E2=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},uc=typeof document<"u"?document:{documentElement:{style:{}}};const cc=/Edge\/(\d+)/.exec(E2.userAgent),kL=/MSIE \d/.test(E2.userAgent),hc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E2.userAgent),Xo=!!(kL||hc||cc),nd=!Xo&&/gecko\/(\d+)/i.test(E2.userAgent),t9=!Xo&&/Chrome\/(\d+)/.exec(E2.userAgent),Sw="webkitFontSmoothing"in uc.documentElement.style,Tc=!Xo&&/Apple Computer/.test(E2.vendor),sd=Tc&&(/Mobile\/\w+/.test(E2.userAgent)||E2.maxTouchPoints>2);var Bt={mac:sd||/Mac/.test(E2.platform),ie:Xo,ie_version:kL?uc.documentMode||6:hc?+hc[1]:cc?+cc[1]:0,gecko:nd,gecko_version:nd?+(/Firefox\/(\d+)/.exec(E2.userAgent)||[0,0])[1]:0,chrome:!!t9,chrome_version:t9?+t9[1]:0,ios:sd,android:/Android\b/.test(E2.userAgent),webkit_version:Sw?+(/\bAppleWebKit\/(\d+)/.exec(E2.userAgent)||[0,0])[1]:0,safari:Tc,safari_version:Tc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(E2.userAgent)||[0,0])[1]:0,tabSize:uc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Jh(r,t){for(let e in r)e=="class"&&t.class?t.class+=" "+r.class:e=="style"&&t.style?t.style+=";"+r.style:t[e]=r[e];return t}const Pa=Object.create(null);function tT(r,t,e){if(r==t)return!0;r||(r=Pa),t||(t=Pa);let n=Object.keys(r),s=Object.keys(t);if(n.length-0!=s.length-0)return!1;for(let a of n)if(a!=e&&(s.indexOf(a)==-1||r[a]!==t[a]))return!1;return!0}function Ew(r,t){for(let e=r.attributes.length-1;e>=0;e--){let n=r.attributes[e].name;t[n]==null&&r.removeAttribute(n)}for(let e in t){let n=t[e];e=="style"?r.style.cssText=n:r.getAttribute(e)!=n&&r.setAttribute(e,n)}}function ad(r,t,e){let n=!1;if(t)for(let s in t)e&&s in e||(n=!0,s=="style"?r.style.cssText="":r.removeAttribute(s));if(e)for(let s in e)t&&t[s]==e[s]||(n=!0,s=="style"?r.style.cssText=e[s]:r.setAttribute(s,e[s]));return n}function Aw(r){let t=Object.create(null);for(let e=0;e<r.attributes.length;e++){let n=r.attributes[e];t[n.name]=n.value}return t}class $o{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var U2=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(U2||(U2={}));class J1 extends Jr{constructor(t,e,n,s){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(t){return new J5(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new t4(t,e,e,n,t.widget||null,!1)}static replace(t){let e=!!t.block,n,s;if(t.isBlockGap)n=-5e8,s=4e8;else{let{start:a,end:o}=RL(t,e);n=(a?e?-3e8:-1:5e8)-1,s=(o?e?2e8:1:-6e8)+1}return new t4(t,n,s,e,t.widget||null,!0)}static line(t){return new t0(t)}static set(t,e=!1){return Me.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}J1.none=Me.empty;class J5 extends J1{constructor(t){let{start:e,end:n}=RL(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Jh(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Pa}eq(t){return this==t||t instanceof J5&&this.tagName==t.tagName&&tT(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}J5.prototype.point=!1;class t0 extends J1{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof t0&&this.spec.class==t.spec.class&&tT(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}t0.prototype.mapMode=S2.TrackBefore;t0.prototype.point=!0;class t4 extends J1{constructor(t,e,n,s,a,o){super(e,n,a,t),this.block=s,this.isReplace=o,this.mapMode=s?e<=0?S2.TrackBefore:S2.TrackAfter:S2.TrackDel}get type(){return this.startSide!=this.endSide?U2.WidgetRange:this.startSide<=0?U2.WidgetBefore:U2.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof t4&&Hw(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}t4.prototype.point=!0;function RL(r,t=!1){let{inclusiveStart:e,inclusiveEnd:n}=r;return e==null&&(e=r.inclusive),n==null&&(n=r.inclusive),{start:e??t,end:n??t}}function Hw(r,t){return r==t||!!(r&&t&&r.compare(t))}function nn(r,t,e,n=0){let s=e.length-1;s>=0&&e[s]+n>=r?e[s]=Math.max(e[s],t):e.push(r,t)}class D5 extends Jr{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof D5&&this.tagName==t.tagName&&tT(this.attributes,t.attributes)}static create(t){return new D5(t.tagName,t.attributes||Pa)}static set(t,e=!1){return Me.of(t,e)}}D5.prototype.startSide=D5.prototype.endSide=-1;function mn(r){let t;return r.nodeType==11?t=r.getSelection?r:r.ownerDocument:t=r,t.getSelection()}function fc(r,t){return t?r==t||r.contains(t.nodeType!=1?t.parentNode:t):!1}function f5(r,t){if(!t.anchorNode)return!1;try{return fc(r,t.anchorNode)}catch{return!1}}function Qa(r){return r.nodeType==3?O5(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Q5(r,t,e,n){return e?od(r,t,e,n,-1)||od(r,t,e,n,1):!1}function Tr(r){for(var t=0;;t++)if(r=r.previousSibling,!r)return t}function ka(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}function od(r,t,e,n,s){for(;;){if(r==e&&t==n)return!0;if(t==(s<0?0:Si(r))){if(r.nodeName=="DIV")return!1;let a=r.parentNode;if(!a||a.nodeType!=1)return!1;t=Tr(r)+(s<0?0:1),r=a}else if(r.nodeType==1){if(r=r.childNodes[t+(s<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;t=s<0?Si(r):0}else return!1}}function Si(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ra(r,t){let e=t?r.left:r.right;return{left:e,right:e,top:r.top,bottom:r.bottom}}function Mw(r){let t=r.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function BL(r,t){let e=t.width/r.offsetWidth,n=t.height/r.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-r.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-r.offsetHeight)<1)&&(n=1),{scaleX:e,scaleY:n}}function ww(r,t,e,n,s,a,o,l){let u=r.ownerDocument,h=u.defaultView||window;for(let T=r,f=!1;T&&!f;)if(T.nodeType==1){let d,p=T==u.body,m=1,y=1;if(p)d=Mw(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(T).position)&&(f=!0),T.scrollHeight<=T.clientHeight&&T.scrollWidth<=T.clientWidth){T=T.assignedSlot||T.parentNode;continue}let g=T.getBoundingClientRect();({scaleX:m,scaleY:y}=BL(T,g)),d={left:g.left,right:g.left+T.clientWidth*m,top:g.top,bottom:g.top+T.clientHeight*y}}let c=0,Q=0;if(s=="nearest")t.top<d.top?(Q=t.top-(d.top+o),e>0&&t.bottom>d.bottom+Q&&(Q=t.bottom-d.bottom+o)):t.bottom>d.bottom&&(Q=t.bottom-d.bottom+o,e<0&&t.top-Q<d.top&&(Q=t.top-(d.top+o)));else{let g=t.bottom-t.top,v=d.bottom-d.top;Q=(s=="center"&&g<=v?t.top+g/2-v/2:s=="start"||s=="center"&&e<0?t.top-o:t.bottom-v+o)-d.top}if(n=="nearest"?t.left<d.left?(c=t.left-(d.left+a),e>0&&t.right>d.right+c&&(c=t.right-d.right+a)):t.right>d.right&&(c=t.right-d.right+a,e<0&&t.left<d.left+c&&(c=t.left-(d.left+a))):c=(n=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:n=="start"==l?t.left-a:t.right-(d.right-d.left)+a)-d.left,c||Q)if(p)h.scrollBy(c,Q);else{let g=0,v=0;if(Q){let L=T.scrollTop;T.scrollTop+=Q/y,v=(T.scrollTop-L)*y}if(c){let L=T.scrollLeft;T.scrollLeft+=c/m,g=(T.scrollLeft-L)*m}t={left:t.left-g,top:t.top-v,right:t.right-g,bottom:t.bottom-v},g&&Math.abs(g-c)<1&&(n="nearest"),v&&Math.abs(v-Q)<1&&(s="nearest")}if(p)break;(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)&&(t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)}),T=T.assignedSlot||T.parentNode}else if(T.nodeType==11)T=T.host;else break}function Cw(r){let t=r.ownerDocument,e,n;for(let s=r.parentNode;s&&!(s==t.body||e&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),!e&&s.scrollWidth>s.clientWidth&&(e=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:e,y:n}}class Dw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?Si(e):0),n,Math.min(t.focusOffset,n?Si(n):0))}set(t,e,n,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=s}}let Rr=null;Bt.safari&&Bt.safari_version>=26&&(Rr=!1);function FL(r){if(r.setActive)return r.setActive();if(Rr)return r.focus(Rr);let t=[];for(let e=r;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(r.focus(Rr==null?{get preventScroll(){return Rr={preventScroll:!0},!0}}:void 0),!Rr){Rr=!1;for(let e=0;e<t.length;){let n=t[e++],s=t[e++],a=t[e++];n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let ld;function O5(r,t,e=t){let n=ld||(ld=document.createRange());return n.setEnd(r,e),n.setStart(r,t),n}function sn(r,t,e,n){let s={key:t,code:t,keyCode:e,which:e,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,r.dispatchEvent(a);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,r.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Ow(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Iw(r,t){let e=t.focusNode,n=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=n)return!1;for(n=Math.min(n,Si(e));;)if(n){if(e.nodeType!=1)return!1;let s=e.childNodes[n-1];s.contentEditable=="false"?n--:(e=s,n=Si(e))}else{if(e==r)return!0;n=Tr(e),e=e.parentNode}}function NL(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}function UL(r,t){for(let e=r,n=t;;){if(e.nodeType==3&&n>0)return{node:e,offset:n};if(e.nodeType==1&&n>0){if(e.contentEditable=="false")return null;e=e.childNodes[n-1],n=Si(e)}else if(e.parentNode&&!ka(e))n=Tr(e),e=e.parentNode;else return null}}function jL(r,t){for(let e=r,n=t;;){if(e.nodeType==3&&n<e.nodeValue.length)return{node:e,offset:n};if(e.nodeType==1&&n<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[n],n=0}else if(e.parentNode&&!ka(e))n=Tr(e)+1,e=e.parentNode;else return null}}class i3{constructor(t,e,n=!0){this.node=t,this.offset=e,this.precise=n}static before(t,e){return new i3(t.parentNode,Tr(t),e)}static after(t,e){return new i3(t.parentNode,Tr(t)+1,e)}}var b1=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(b1||(b1={}));const e4=b1.LTR,eT=b1.RTL;function GL(r){let t=[];for(let e=0;e<r.length;e++)t.push(1<<+r[e]);return t}const Vw=GL("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Pw=GL("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Qc=Object.create(null),m3=[];for(let r of["()","[]","{}"]){let t=r.charCodeAt(0),e=r.charCodeAt(1);Qc[t]=e,Qc[e]=-t}function zL(r){return r<=247?Vw[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?Pw[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1}const kw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fi{get dir(){return this.level%2?eT:e4}constructor(t,e,n){this.from=t,this.to=e,this.level=n}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,n,s){let a=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==n)return o;(a<0||(s!=0?s<0?l.from<e:l.to>e:t[a].level>l.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function WL(r,t){if(r.length!=t.length)return!1;for(let e=0;e<r.length;e++){let n=r[e],s=t[e];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!WL(n.inner,s.inner))return!1}return!0}const Re=[];function Rw(r,t,e,n,s){for(let a=0;a<=n.length;a++){let o=a?n[a-1].to:t,l=a<n.length?n[a].from:e,u=a?256:s;for(let h=o,T=u,f=u;h<l;h++){let d=zL(r.charCodeAt(h));d==512?d=T:d==8&&f==4&&(d=16),Re[h]=d==4?2:d,d&7&&(f=d),T=d}for(let h=o,T=u,f=u;h<l;h++){let d=Re[h];if(d==128)h<l-1&&T==Re[h+1]&&T&24?d=Re[h]=T:Re[h]=256;else if(d==64){let p=h+1;for(;p<l&&Re[p]==64;)p++;let m=h&&T==8||p<e&&Re[p]==8?f==1?1:8:256;for(let y=h;y<p;y++)Re[y]=m;h=p-1}else d==8&&f==1&&(Re[h]=1);T=d,d&7&&(f=d)}}}function Bw(r,t,e,n,s){let a=s==1?2:1;for(let o=0,l=0,u=0;o<=n.length;o++){let h=o?n[o-1].to:t,T=o<n.length?n[o].from:e;for(let f=h,d,p,m;f<T;f++)if(p=Qc[d=r.charCodeAt(f)])if(p<0){for(let y=l-3;y>=0;y-=3)if(m3[y+1]==-p){let c=m3[y+2],Q=c&2?s:c&4?c&1?a:s:0;Q&&(Re[f]=Re[m3[y]]=Q),l=y;break}}else{if(m3.length==189)break;m3[l++]=f,m3[l++]=d,m3[l++]=u}else if((m=Re[f])==2||m==1){let y=m==s;u=y?0:1;for(let c=l-3;c>=0;c-=3){let Q=m3[c+2];if(Q&2)break;if(y)m3[c+2]|=2;else{if(Q&4)break;m3[c+2]|=4}}}}}function Fw(r,t,e,n){for(let s=0,a=n;s<=e.length;s++){let o=s?e[s-1].to:r,l=s<e.length?e[s].from:t;for(let u=o;u<l;){let h=Re[u];if(h==256){let T=u+1;for(;;)if(T==l){if(s==e.length)break;T=e[s++].to,l=s<e.length?e[s].from:t}else if(Re[T]==256)T++;else break;let f=a==1,d=(T<t?Re[T]:n)==1,p=f==d?f?1:2:n;for(let m=T,y=s,c=y?e[y-1].to:r;m>u;)m==c&&(m=e[--y].from,c=y?e[y-1].to:r),Re[--m]=p;u=T}else a=h,u++}}}function dc(r,t,e,n,s,a,o){let l=n%2?2:1;if(n%2==s%2)for(let u=t,h=0;u<e;){let T=!0,f=!1;if(h==a.length||u<a[h].from){let y=Re[u];y!=l&&(T=!1,f=y==16)}let d=!T&&l==1?[]:null,p=T?n:n+1,m=u;t:for(;;)if(h<a.length&&m==a[h].from){if(f)break t;let y=a[h];if(!T)for(let c=y.to,Q=h+1;;){if(c==e)break t;if(Q<a.length&&a[Q].from==c)c=a[Q++].to;else{if(Re[c]==l)break t;break}}if(h++,d)d.push(y);else{y.from>u&&o.push(new fi(u,y.from,p));let c=y.direction==e4!=!(p%2);pc(r,c?n+1:n,s,y.inner,y.from,y.to,o),u=y.to}m=y.to}else{if(m==e||(T?Re[m]!=l:Re[m]==l))break;m++}d?dc(r,u,m,n+1,s,d,o):u<m&&o.push(new fi(u,m,p)),u=m}else for(let u=e,h=a.length;u>t;){let T=!0,f=!1;if(!h||u>a[h-1].to){let y=Re[u-1];y!=l&&(T=!1,f=y==16)}let d=!T&&l==1?[]:null,p=T?n:n+1,m=u;t:for(;;)if(h&&m==a[h-1].to){if(f)break t;let y=a[--h];if(!T)for(let c=y.from,Q=h;;){if(c==t)break t;if(Q&&a[Q-1].to==c)c=a[--Q].from;else{if(Re[c-1]==l)break t;break}}if(d)d.push(y);else{y.to<u&&o.push(new fi(y.to,u,p));let c=y.direction==e4!=!(p%2);pc(r,c?n+1:n,s,y.inner,y.from,y.to,o),u=y.from}m=y.from}else{if(m==t||(T?Re[m-1]!=l:Re[m-1]==l))break;m--}d?dc(r,m,u,n+1,s,d,o):m<u&&o.push(new fi(m,u,p)),u=m}}function pc(r,t,e,n,s,a,o){let l=t%2?2:1;Rw(r,s,a,n,l),Bw(r,s,a,n,l),Fw(s,a,n,l),dc(r,s,a,t,e,n,o)}function Nw(r,t,e){if(!r)return[new fi(0,0,t==eT?1:0)];if(t==e4&&!e.length&&!kw.test(r))return qL(r.length);if(e.length)for(;r.length>Re.length;)Re[Re.length]=256;let n=[],s=t==e4?0:1;return pc(r,s,s,e,0,r.length,n),n}function qL(r){return[new fi(0,r,0)]}let ZL="";function Uw(r,t,e,n,s){var a;let o=n.head-r.from,l=fi.find(t,o,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),u=t[l],h=u.side(s,e);if(o==h){let d=l+=s?1:-1;if(d<0||d>=t.length)return null;u=t[l=d],o=u.side(!s,e),h=u.side(s,e)}let T=e3(r.text,o,u.forward(s,e));(T<u.from||T>u.to)&&(T=h),ZL=r.text.slice(Math.min(o,T),Math.max(o,T));let f=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return f&&T==h&&f.level+(s?0:1)<u.level?Rt.cursor(f.side(!s,e)+r.from,f.forward(s,e)?1:-1,f.level):Rt.cursor(T+r.from,u.forward(s,e)?-1:1,u.level)}function jw(r,t,e){for(let n=t;n<e;n++){let s=zL(r.charCodeAt(n));if(s==1)return e4;if(s==2||s==4)return eT}return e4}const KL=ne.define(),XL=ne.define(),$L=ne.define(),YL=ne.define(),gc=ne.define(),JL=ne.define(),tx=ne.define(),iT=ne.define(),rT=ne.define(),ex=ne.define({combine:r=>r.some(t=>t)}),Gw=ne.define({combine:r=>r.some(t=>t)}),ix=ne.define();class an{constructor(t,e="nearest",n="nearest",s=5,a=5,o=!1){this.range=t,this.y=e,this.x=n,this.yMargin=s,this.xMargin=a,this.isSnapshot=o}map(t){return t.empty?this:new an(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new an(Rt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ls=_1.define({map:(r,t)=>r.map(t)}),rx=_1.define();function O3(r,t,e){let n=r.facet(YL);n.length?n[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}const ci=ne.define({combine:r=>r.length?r[0]:!0});let zw=0;const X4=ne.define({combine(r){return r.filter((t,e)=>{for(let n=0;n<e;n++)if(r[n].plugin==t.plugin)return!1;return!0})}});class yn{constructor(t,e,n,s,a){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(X4.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(X4.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:n,eventObservers:s,provide:a,decorations:o}=e||{};return new yn(zw++,t,n,s,l=>{let u=[];return o&&u.push(Yo.of(h=>{let T=h.plugin(l);return T?o(T):J1.none})),a&&u.push(a(l)),u})}static fromClass(t,e){return yn.define((n,s)=>new t(n,s),e)}}class e9{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(n){if(O3(e.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){O3(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(n){O3(t.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const nx=ne.define(),nT=ne.define(),Yo=ne.define(),sx=ne.define(),sT=ne.define(),e0=ne.define(),ax=ne.define();function ud(r,t){let e=r.state.facet(ax);if(!e.length)return e;let n=e.map(a=>a instanceof Function?a(r):a),s=[];return Me.spans(n,t.from,t.to,{point(){},span(a,o,l,u){let h=a-t.from,T=o-t.from,f=s;for(let d=l.length-1;d>=0;d--,u--){let p=l[d].spec.bidiIsolate,m;if(p==null&&(p=jw(t.text,h,T)),u>0&&f.length&&(m=f[f.length-1]).to==h&&m.direction==p)m.to=T,f=m.inner;else{let y={from:h,to:T,direction:p,inner:[]};f.push(y),f=y.inner}}}}),s}const ox=ne.define();function lx(r){let t=0,e=0,n=0,s=0;for(let a of r.state.facet(ox)){let o=a(r);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:e,top:n,bottom:s}}const i5=ne.define();class B2{constructor(t,e,n,s){this.fromA=t,this.toA=e,this.fromB=n,this.toB=s}join(t){return new B2(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,n=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>n.toA)){if(s.toA<n.fromA)break;n=n.join(s),t.splice(e-1,1)}}return t.splice(e,0,n),t}static extendWithRanges(t,e){if(e.length==0)return t;let n=[];for(let s=0,a=0,o=0;;){let l=s<t.length?t[s].fromB:1e9,u=a<e.length?e[a]:1e9,h=Math.min(l,u);if(h==1e9)break;let T=h+o,f=h,d=T;for(;;)if(a<e.length&&e[a]<=f){let p=e[a+1];a+=2,f=Math.max(f,p);for(let m=s;m<t.length&&t[m].fromB<=f;m++)o=t[m].toA-t[m].toB;d=Math.max(d,p+o)}else if(s<t.length&&t[s].fromB<=f){let p=t[s++];f=Math.max(f,p.toB),d=Math.max(d,p.toA),o=p.toA-p.toB}else break;n.push(new B2(T,d,h,f))}return n}}class Ba{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=D1.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,o,l,u)=>s.push(new B2(a,o,l,u))),this.changedRanges=s}static create(t,e,n){return new Ba(t,e,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ww=[];class d1{constructor(t,e,n=0){this.dom=t,this.length=e,this.flags=n,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ww}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&Ew(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let n=e;for(let s of this.children){if(s==t)return n;n+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let n=Tr(this.dom),s=this.length?t>0:e>0;return new i3(this.parent.dom,n+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof t7)return t;return null}static get(t){return t.cmTile}}class Jo extends d1{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,n=null,s,a=(t==null?void 0:t.node)==e?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,s=n?n.nextSibling:e.firstChild,a&&s!=l.dom&&(a.written=!0),l.dom.parentNode==e)for(;s&&s!=l.dom;)s=cd(s);else e.insertBefore(l.dom,s);n=l.dom}for(s=n?n.nextSibling:e.firstChild,a&&s&&(a.written=!0);s;)s=cd(s);this.length=o}}function cd(r){let t=r.nextSibling;return r.parentNode.removeChild(r),t}class t7 extends Jo{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=d1.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],n=this,s=0,a=0;;)if(s==n.children.length){if(!e.length)return;n=n.parent,n.breakAfter&&a++,s=e.pop()}else{let o=n.children[s++];if(o instanceof nr)e.push(s),n=o,s=0;else{let l=a+o.length,u=t(o,a);if(u!==void 0)return u;a=l+o.breakAfter}}}resolveBlock(t,e){let n,s=-1,a,o=-1;if(this.blockTiles((l,u)=>{let h=u+l.length;if(t>=u&&t<=h){if(l.isWidget()&&e>=-1&&e<=1){if(l.flags&32)return!0;l.flags&16&&(n=void 0)}(u<t||t==h&&(e<-1?l.length:l.covers(1)))&&(!n||!l.isWidget()&&n.isWidget())&&(n=l,s=t-u),(h>t||t==u&&(e>1?l.length:l.covers(-1)))&&(!a||!l.isWidget()&&a.isWidget())&&(a=l,o=t-u)}}),!n&&!a)throw new Error("No tile at position "+t);return n&&e<0||!a?{tile:n,offset:s}:{tile:a,offset:o}}}class nr extends Jo{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let n=new nr(e||document.createElement(t.tagName),t);return e||(n.flags|=4),n}}class vn extends Jo{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,n){let s=new vn(e||document.createElement("div"),t);return(!e||!n)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,e,n){let s=null,a=-1,o=null,l=-1;function u(T,f){for(let d=0,p=0;d<T.children.length&&p<=f;d++){let m=T.children[d],y=p+m.length;y>=f&&(m.isComposite()?u(m,f-p):(!o||o.isHidden&&(e>0||n&&Zw(o,m)))&&(y>f||m.flags&32)?(o=m,l=f-p):(p<f||m.flags&16&&!m.isHidden)&&(s=m,a=f-p)),p=y}}u(this,t);let h=(e<0?s:o)||s||o;return h?{tile:h,offset:h==s?a:l}:null}coordsIn(t,e){let n=this.resolveInline(t,e,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),e):qw(this)}domIn(t,e){let n=this.resolveInline(t,e);if(n){let{tile:s,offset:a}=n;if(this.dom.contains(s.dom))return s.isText()?new i3(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:e);let o=n.tile.parent,l=!1;for(let u of o.children){if(l)return new i3(u.dom,0);u==n.tile&&(l=!0)}}return new i3(this.dom,0)}}function qw(r){let t=r.dom.lastChild;if(!t)return r.dom.getBoundingClientRect();let e=Qa(t);return e[e.length-1]||null}function Zw(r,t){let e=r.coordsIn(0,1),n=t.coordsIn(0,1);return e&&n&&n.top<e.bottom}class h2 extends Jo{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let n=new h2(e||document.createElement(t.tagName),t);return e||(n.flags|=4),n}}class Gr extends d1{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let n=this.dom.nodeValue.length;t>n&&(t=n);let s=t,a=t,o=0;t==0&&e<0||t==n&&e>=0?Bt.chrome||Bt.gecko||(t?(s--,o=1):a<n&&(a++,o=-1)):e<0?s--:a<n&&a++;let l=O5(this.dom,s,a).getClientRects();if(!l.length)return null;let u=l[(o?o<0:e>=0)?0:l.length-1];return Bt.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(l,h=>h.width)||u),o?Ra(u,o<0):u||null}static of(t,e){let n=new Gr(e||document.createTextNode(t),t);return e||(n.flags|=2),n}}class i4 extends d1{constructor(t,e,n,s){super(t,e,s),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,n){let s=this.widget.coordsAt(this.dom,t,e);if(s)return s;if(n)return Ra(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let u=l?a.length-1:0;o=a[u],!(t>0?u==0:u==a.length-1||o.top<o.bottom);u+=l?-1:1);return Ra(o,!l)}}get overrideDOMText(){if(!this.length)return Ie.empty;let{root:t}=this;if(!t)return Ie.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,n,s,a){return a||(a=t.toDOM(e),t.editable||(a.contentEditable="false")),new i4(a,n,t,s)}}class Fa extends d1{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return Ie.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Kw{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,n){let{tile:s,index:a,beforeBreak:o,parents:l}=this;for(;t||e>0;)if(s.isComposite())if(o){if(!t)break;n&&n.break(),t--,o=!1}else if(a==s.children.length){if(!t&&!l.length)break;n&&n.leave(s),o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++}else{let u=s.children[a],h=u.breakAfter;(e>0?u.length<=t:u.length<t)&&(!n||n.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!h,a++,t-=u.length):(l.push({tile:s,index:a}),s=u,a=0,n&&u.isComposite()&&n.enter(u))}else if(a==s.length)o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++;else if(t){let u=Math.min(t,s.length-a);n&&n.skip(s,a,a+u),t-=u,a+=u}else break;return this.tile=s,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Xw{constructor(t,e,n,s){this.from=t,this.to=e,this.wrapper=n,this.rank=s}}class $w{constructor(t,e,n){this.cache=t,this.root=e,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,n,s){var a;this.flushBuffer();let o=this.ensureMarks(e,n),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)){this.cache.reused.set(l,2);let u=o.children[o.children.length-1]=new Gr(l.dom,l.text+t);u.parent=o}else o.append(s||Gr.of(t,(a=this.cache.find(Gr))===null||a===void 0?void 0:a.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let n=this.curLine;n.dom!=e.line.dom&&(n.setDOM(this.cache.reused.has(e.line)?i9(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let s=n;for(let l=e.marks.length-1;l>=0;l--){let u=e.marks[l],h=s.lastChild;if(h instanceof h2&&h.mark.eq(u.mark))h.dom!=u.dom&&h.setDOM(i9(u.dom)),s=h;else{if(this.cache.reused.get(u)){let f=d1.get(u.dom);f&&f.setDOM(i9(u.dom))}let T=h2.of(u.mark,u.dom);s.append(T),s=T}this.cache.reused.set(u,2)}let a=d1.get(t.text);a&&this.cache.reused.set(a,2);let o=new Gr(t.text,t.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(t,e,n){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let a=this.ensureMarks(e,n);!s&&!(t.flags&16)&&a.append(this.getBuffer(1)),a.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,n){this.flushBuffer(),this.ensureMarks(e,n).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var n;t||(t=ux);let s=vn.start(t,e||((n=this.cache.find(vn))===null||n===void 0?void 0:n.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var n;let s=this.curLine;for(let a=t.length-1;a>=0;a--){let o=t[a],l;if(e>0&&(l=s.lastChild)&&l instanceof h2&&l.mark.eq(o))s=l,e--;else{let u=h2.of(o,(n=this.cache.find(h2,h=>h.mark.eq(o)))===null||n===void 0?void 0:n.dom);s.append(u),s=u,e=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!hd(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Bt.ios&&hd(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(r9,0,32)||new i4(r9.toDOM(),0,r9,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new Xw(t.from,t.to,t.value,t.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-e.rank||this.wrappers[n-1].to-e.to)<0;)n--;this.wrappers.splice(n,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let n of this.wrappers){let s=e.lastChild;if(n.from<this.pos&&s instanceof nr&&s.wrapper.eq(n.wrapper))e=s;else{let a=nr.of(n.wrapper,(t=this.cache.find(nr,o=>o.wrapper.eq(n.wrapper)))===null||t===void 0?void 0:t.dom);e.append(a),e=a}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),n=this.cache.find(Fa,void 0,1);return n&&(n.flags=e),n||new Fa(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Yw{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(t,s.length);return a?null:s.slice(0,l)}let e=Math.min(this.text.length,this.textOff+t),n=this.text.slice(this.textOff,e);return this.textOff=e,n}}const Na=[i4,vn,Gr,h2,Fa,nr,t7];for(let r=0;r<Na.length;r++)Na[r].bucket=r;class Jw{constructor(t){this.view=t,this.buckets=Na.map(()=>[]),this.index=Na.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,n=this.buckets[e];n.length<6?n.push(t):n[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,n=2){let s=t.bucket,a=this.buckets[s],o=this.index[s];for(let l=a.length-1;l>=0;l--){let u=(l+o)%a.length,h=a[u];if((!e||e(h))&&!this.reused.has(h))return a.splice(u,1),u<o&&this.index[s]--,this.reused.set(h,n),h}return null}findWidget(t,e,n){let s=this.buckets[0];if(s.length)for(let a=0,o=0;;a++){if(a==s.length){if(o)return null;o=1,a=0}let l=s[a];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,l.widget==t&&l.length==e&&(l.flags&497)==n?(this.reused.set(l,1),l):(this.reused.set(l,2),new i4(l.dom,e,t,l.flags&-498|n))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class tC{constructor(t,e,n,s,a){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new Jw(t),this.text=new Yw(t.state.doc),this.builder=new $w(this.cache,new t7(t,t.contentDOM),Me.iter(n)),this.cache.reused.set(e,2),this.old=new Kw(e),this.reuseWalker={skip:(o,l,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let n=e&&this.getCompositionContext(e.text);for(let s=0,a=0,o=0;;){let l=o<t.length?t[o++]:null,u=l?l.fromA:this.old.root.length;if(u>s){let h=u-s;this.preserve(h,!o,!l),s=u,a+=h}if(!l)break;e&&l.fromA<=e.range.fromA&&l.toA>=e.range.toA?(this.forward(l.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(a,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,n),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,l.toA),this.emit(e.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(a,l.toB)),a=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,n){let s=rC(this.old),a=this.openMarks;this.old.advance(t,n?1:-1,{skip:(o,l,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-l);else{let h=u>0||l<o.length?i4.of(o.widget,this.view,u-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,s,a),a=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&u==o.length?this.builder.addText(o.text,s,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,u),s,a)),a=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Fa)this.cache.add(o);else if(o instanceof h2)this.builder.ensureLine(null),this.builder.addMark(o,s,a),this.cache.reused.set(o,1),a=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof h2&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=a=0):o instanceof h2&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let n=null,s=this.builder,a=0,o=Me.spans(this.decorations,t,e,{point:(l,u,h,T,f,d)=>{if(h instanceof t4){if(this.disallowBlockEffectsFor[d]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=T.length,f>T.length)s.continueWidget(u-l);else{let p=h.widget||(h.block?Ln.block:Ln.inline),m=eC(h),y=this.cache.findWidget(p,u-l,m)||i4.of(p,this.view,u-l,m);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(n),s.addBlockWidget(y)):(s.ensureLine(n),s.addInlineWidget(y,T,f))}n=null}else n=iC(n,h);u>l&&this.text.skip(u-l)},span:(l,u,h,T)=>{for(let f=l;f<u;){let d=this.text.next(Math.min(512,u-f));d==null?(s.addLineStartIfNotCovered(n),s.addBreak(),f++):(s.ensureLine(n),s.addText(d,h,T),f+=d.length),n=null}}});s.addLineStartIfNotCovered(n),this.openWidget=o>a,this.openMarks=o}forward(t,e,n=1){e-t<=10?this.old.advance(e-t,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(t){let e=[],n=null;for(let s=t.parentNode;;s=s.parentNode){let a=d1.get(s);if(s==this.view.contentDOM)break;a instanceof h2?e.push(a):a!=null&&a.isLine()?n=a:s.nodeName=="DIV"&&!n&&s!=this.view.contentDOM?n=new vn(s,ux):e.push(h2.of(new J5({tagName:s.nodeName.toLowerCase(),attributes:Aw(s)}),s))}return{line:n,marks:e}}}function hd(r,t){let e=n=>{for(let s of n.children)if((t?s.isText():s.length)||e(s))return!0;return!1};return e(r)}function eC(r){let t=r.isReplace?(r.startSide<0?64:0)|(r.endSide>0?128:0):r.startSide>0?32:16;return r.block&&(t|=256),t}const ux={class:"cm-line"};function iC(r,t){let e=t.spec.attributes,n=t.spec.class;return!e&&!n||(r||(r={class:"cm-line"}),e&&Jh(e,r),n&&(r.class+=" "+n)),r}function rC(r){let t=[];for(let e=r.parents.length;e>1;e--){let n=e==r.parents.length?r.tile:r.parents[e].tile;n instanceof h2&&t.push(n.mark)}return t}function i9(r){let t=d1.get(r);return t&&t.setDOM(r.cloneNode()),r}class Ln extends $o{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ln.inline=new Ln("span");Ln.block=new Ln("div");const r9=new class extends $o{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Td{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=J1.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new t7(t,t.contentDOM),this.updateInner([new B2(0,0,0,t.state.doc.length)],null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:T,toA:f})=>f<this.minWidthFrom||T>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?s=this.domChanged.newSel.head:!TC(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let a=s>-1?sC(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:T,to:f}=this.hasComposition;n=new B2(T,f,t.changes.mapPos(T,-1),t.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Bt.ie||Bt.chrome)&&!a&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let u=lC(o,this.decorations,t.changes);u.length&&(n=B2.extendWithRanges(n,u));let h=cC(l,this.blockWrappers,t.changes);return h.length&&(n=B2.extendWithRanges(n,h)),a&&!n.some(T=>T.fromA<=a.range.fromA&&T.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(e||t.length){let o=this.tile,l=new tC(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=l.run(t,e),mc(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Bt.chrome||Bt.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof n9&&s.push(a.dom);n.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let n of e.effects)n.is(rx)&&(this.editContextFormatting=n.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,s=this.view.root.activeElement,a=s==n,o=!a&&!(this.view.state.facet(ci)||n.tabIndex>-1)&&f5(n,this.view.observer.selectionRange)&&!(s&&n.contains(s));if(!(a||e||o))return;let l=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,h,T;if(u.empty?T=h=this.inlineDOMNearPos(u.anchor,u.assoc||1):(T=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),h=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),Bt.gecko&&u.empty&&!this.hasComposition&&nC(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=T=new i3(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Q5(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Q5(T.node,T.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,u))&&(this.view.observer.ignore(()=>{Bt.android&&Bt.chrome&&n.contains(f.focusNode)&&hC(f.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let d=mn(this.view.root);if(d)if(u.empty){if(Bt.gecko){let p=aC(h.node,h.offset);if(p&&p!=3){let m=(p==1?UL:jL)(h.node,h.offset);m&&(h=new i3(m.node,m.offset))}}d.collapse(h.node,h.offset),u.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=u.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(T.node,T.offset)}catch{}}else{let p=document.createRange();u.anchor>u.head&&([h,T]=[T,h]),p.setEnd(T.node,T.offset),p.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==n&&(n.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,T)),this.impreciseAnchor=h.precise?null:new i3(f.anchorNode,f.anchorOffset),this.impreciseHead=T.precise?null:new i3(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Q5(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=mn(t.root),{anchorNode:s,anchorOffset:a}=t.observer.selectionRange;if(!n||!e.empty||!e.assoc||!n.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let u=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!u||!h||u.bottom>h.top)return;let T=this.domAtPos(e.head+e.assoc,e.assoc);n.collapse(T.node,T.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&n.collapse(s,a)}posFromDOM(t,e){let n=this.tile.nearest(t);if(!n)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=n.posAtStart;if(n.isComposite()){let a;if(t==n.dom)a=n.dom.childNodes[e];else{let o=Si(t)==0?0:e==0?-1:1;for(;;){let l=t.parentNode;if(l==n.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?a=t:a=t.nextSibling}if(a==n.dom.firstChild)return s;for(;a&&!d1.get(a);)a=a.nextSibling;if(!a)return s+n.length;for(let o=0,l=s;;o++){let u=n.children[o];if(u.dom==a)return l;l+=u.length+u.breakAfter}}else return n.isText()?t==n.dom?s+e:s+(e?n.length:0):s}domAtPos(t,e){let{tile:n,offset:s}=this.tile.resolveBlock(t,e);return n.isWidget()?n.domPosFor(t,e):n.domIn(s,e)}inlineDOMNearPos(t,e){let n,s=-1,a=!1,o,l=-1,u=!1;return this.tile.blockTiles((h,T)=>{if(h.isWidget()){if(h.flags&32&&T>=t)return!0;h.flags&16&&(a=!0)}else{let f=T+h.length;if(T<=t&&(n=h,s=t-T,a=f<t),f>=t&&!o&&(o=h,l=t-T,u=T>t),T>t&&o)return!0}}),!n&&!o?this.domAtPos(t,e):(a&&o?n=null:u&&n&&(o=null),n&&e<0||!o?n.domIn(s,e):o.domIn(l,e))}coordsAt(t,e){let{tile:n,offset:s}=this.tile.resolveBlock(t,e);return n.isWidget()?n.widget instanceof n9?null:n.coordsInWidget(s,e,!0):n.coordsIn(s,e)}lineAt(t,e){let{tile:n}=this.tile.resolveBlock(t,e);return n.isLine()?n:null}coordsForChar(t){let{tile:e,offset:n}=this.tile.resolveBlock(t,1);if(!e.isLine())return null;function s(a,o){if(a.isComposite())for(let l of a.children){if(l.length>=o){let u=s(l,o);if(u)return u}if(o-=l.length,o<0)break}else if(a.isText()&&o<a.length){let l=e3(a.text,o);if(l==o)return null;let u=O5(a.dom,o,l).getClientRects();for(let h=0;h<u.length;h++){let T=u[h];if(h==u.length-1||T.top<T.bottom&&T.left<T.right)return T}}return null}return s(e,n)}measureVisibleLineHeights(t){let e=[],{from:n,to:s}=t,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,u=this.view.textDirection==b1.LTR,h=0,T=(f,d,p)=>{for(let m=0;m<f.children.length&&!(d>s);m++){let y=f.children[m],c=d+y.length,Q=y.dom.getBoundingClientRect(),{height:g}=Q;if(p&&!m&&(h+=Q.top-p.top),y instanceof nr)c>n&&T(y,d,Q);else if(d>=n&&(h>0&&e.push(-h),e.push(g+h),h=0,o)){let v=y.dom.lastChild,L=v?Qa(v):[];if(L.length){let x=L[L.length-1],b=u?x.right-Q.left:Q.right-x.left;b>l&&(l=b,this.minWidth=a,this.minWidthFrom=d,this.minWidthTo=c)}}p&&m==f.children.length-1&&(h+=p.bottom-Q.bottom),d=c+y.breakAfter}};return T(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return getComputedStyle(e.dom).direction=="rtl"?b1.RTL:b1.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,u;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let T=Qa(h.dom);if(T.length!=1)return;l+=T[0].width,u=T[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:u}}});if(t)return t;let e=document.createElement("div"),n,s,a;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(e);let o=Qa(e.firstChild)[0];n=e.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,a=o&&o.height?o.height:n,e.remove()}),{lineHeight:n,charWidth:s,textHeight:a}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,s=0;;s++){let a=s==e.viewports.length?null:e.viewports[s],o=a?a.from-1:this.view.state.doc.length;if(o>n){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(J1.replace({widget:new n9(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!a)break;n=a.to+1}return J1.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Yo).map(a=>(this.dynamicDecorationMap[t++]=typeof a=="function")?a(this.view):a),n=!1,s=this.view.state.facet(sT).map((a,o)=>{let l=typeof a=="function";return l&&(n=!0),l?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[t++]=n,e.push(Me.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(sx).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(t){if(t.isSnapshot){let h=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=h.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let h of this.view.state.facet(ix))try{if(h(this.view,t.range,t))return!0}catch(T){O3(this.view.state,T,"scroll handler")}let{range:e}=t,n=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),s;if(!n)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let a=lx(this.view),o={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:l,offsetHeight:u}=this.view.scrollDOM;ww(this.view.scrollDOM,o,e.head<e.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==b1.LTR)}lineHasWidget(t){let e=n=>n.isWidget()||n.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){mc(this.tile)}}function mc(r,t){let e=t==null?void 0:t.get(r);if(e!=1){e==null&&r.destroy();for(let n of r.children)mc(n,t)}}function nC(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}function cx(r,t){let e=r.observer.selectionRange;if(!e.focusNode)return null;let n=UL(e.focusNode,e.focusOffset),s=jL(e.focusNode,e.focusOffset),a=n||s;if(s&&n&&s.node!=n.node){let l=d1.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)a=s;else if(r.docView.lastCompositionAfterCursor){let u=d1.get(n.node);!u||u.isText()&&u.text!=n.node.nodeValue||(a=s)}}if(r.docView.lastCompositionAfterCursor=a!=n,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function sC(r,t,e){let n=cx(r,e);if(!n)return null;let{node:s,from:a,to:o}=n,l=s.nodeValue;if(/[\n\r]/.test(l)||r.state.doc.sliceString(n.from,n.to)!=l)return null;let u=t.invertedDesc;return{range:new B2(u.mapPos(a),u.mapPos(o),a,o),text:s}}function aC(r,t){return r.nodeType!=1?0:(t&&r.childNodes[t-1].contentEditable=="false"?1:0)|(t<r.childNodes.length&&r.childNodes[t].contentEditable=="false"?2:0)}let oC=class{constructor(){this.changes=[]}compareRange(t,e){nn(t,e,this.changes)}comparePoint(t,e){nn(t,e,this.changes)}boundChange(t){nn(t,t,this.changes)}};function lC(r,t,e){let n=new oC;return Me.compare(r,t,e,n),n.changes}class uC{constructor(){this.changes=[]}compareRange(t,e){nn(t,e,this.changes)}comparePoint(){}boundChange(t){nn(t,t,this.changes)}}function cC(r,t,e){let n=new uC;return Me.compare(r,t,e,n),n.changes}function hC(r,t){for(let e=r;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function TC(r,t){let e=!1;return t&&r.iterChangedRanges((n,s)=>{n<t.to&&s>t.from&&(e=!0)}),e}class n9 extends $o{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function fC(r,t,e=1){let n=r.charCategorizer(t),s=r.doc.lineAt(t),a=t-s.from;if(s.length==0)return Rt.cursor(t);a==0?e=1:a==s.length&&(e=-1);let o=a,l=a;e<0?o=e3(s.text,a,!1):l=e3(s.text,a);let u=n(s.text.slice(o,l));for(;o>0;){let h=e3(s.text,o,!1);if(n(s.text.slice(h,o))!=u)break;o=h}for(;l<s.length;){let h=e3(s.text,l);if(n(s.text.slice(l,h))!=u)break;l=h}return Rt.range(o+s.from,l+s.from)}function QC(r,t,e,n,s){let a=Math.round((n-t.left)*r.defaultCharacterWidth);if(r.lineWrapping&&e.height>r.defaultLineHeight*1.5){let l=r.viewState.heightOracle.textHeight,u=Math.floor((s-e.top-(r.defaultLineHeight-l)*.5)/l);a+=u*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(e.from,e.to);return e.from+_w(o,a,r.state.tabSize)}function dC(r,t,e){let n=r.lineBlockAt(t);if(Array.isArray(n.type)){let s;for(let a of n.type){if(a.from>t)break;if(!(a.to<t)){if(a.from<t&&a.to>t)return a;(!s||a.type==U2.Text&&(s.type!=a.type||(e<0?a.from<t:a.to>t)))&&(s=a)}}return s||n}return n}function pC(r,t,e,n){let s=dC(r,t.head,t.assoc||-1),a=!n||s.type!=U2.Text||!(r.lineWrapping||s.widgetLineBreaks)?null:r.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(a){let o=r.dom.getBoundingClientRect(),l=r.textDirectionAt(s.from),u=r.posAtCoords({x:e==(l==b1.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(u!=null)return Rt.cursor(u,e?-1:1)}return Rt.cursor(e?s.to:s.from,e?-1:1)}function fd(r,t,e,n){let s=r.state.doc.lineAt(t.head),a=r.bidiSpans(s),o=r.textDirectionAt(s.from);for(let l=t,u=null;;){let h=Uw(s,a,o,l,e),T=ZL;if(!h){if(s.number==(e?r.state.doc.lines:1))return l;T=`
110
+ `;this.styleTag.textContent=o;let l=e.head||e;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var gn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},lc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};for(var U1=0;U1<10;U1++)gn[48+U1]=gn[96+U1]=String(U1);for(var U1=1;U1<=24;U1++)gn[U1+111]="F"+U1;for(var U1=65;U1<=90;U1++)gn[U1]=String.fromCharCode(U1+32),lc[U1]=String.fromCharCode(U1);for(var Jl in gn)lc.hasOwnProperty(Jl)||(lc[Jl]=gn[Jl]);let E2=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},uc=typeof document<"u"?document:{documentElement:{style:{}}};const cc=/Edge\/(\d+)/.exec(E2.userAgent),kL=/MSIE \d/.test(E2.userAgent),hc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E2.userAgent),Xo=!!(kL||hc||cc),nd=!Xo&&/gecko\/(\d+)/i.test(E2.userAgent),t9=!Xo&&/Chrome\/(\d+)/.exec(E2.userAgent),Sw="webkitFontSmoothing"in uc.documentElement.style,Tc=!Xo&&/Apple Computer/.test(E2.vendor),sd=Tc&&(/Mobile\/\w+/.test(E2.userAgent)||E2.maxTouchPoints>2);var Bt={mac:sd||/Mac/.test(E2.platform),ie:Xo,ie_version:kL?uc.documentMode||6:hc?+hc[1]:cc?+cc[1]:0,gecko:nd,gecko_version:nd?+(/Firefox\/(\d+)/.exec(E2.userAgent)||[0,0])[1]:0,chrome:!!t9,chrome_version:t9?+t9[1]:0,ios:sd,android:/Android\b/.test(E2.userAgent),webkit_version:Sw?+(/\bAppleWebKit\/(\d+)/.exec(E2.userAgent)||[0,0])[1]:0,safari:Tc,safari_version:Tc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(E2.userAgent)||[0,0])[1]:0,tabSize:uc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Jh(r,t){for(let e in r)e=="class"&&t.class?t.class+=" "+r.class:e=="style"&&t.style?t.style+=";"+r.style:t[e]=r[e];return t}const Pa=Object.create(null);function tT(r,t,e){if(r==t)return!0;r||(r=Pa),t||(t=Pa);let n=Object.keys(r),s=Object.keys(t);if(n.length-0!=s.length-0)return!1;for(let a of n)if(a!=e&&(s.indexOf(a)==-1||r[a]!==t[a]))return!1;return!0}function Ew(r,t){for(let e=r.attributes.length-1;e>=0;e--){let n=r.attributes[e].name;t[n]==null&&r.removeAttribute(n)}for(let e in t){let n=t[e];e=="style"?r.style.cssText=n:r.getAttribute(e)!=n&&r.setAttribute(e,n)}}function ad(r,t,e){let n=!1;if(t)for(let s in t)e&&s in e||(n=!0,s=="style"?r.style.cssText="":r.removeAttribute(s));if(e)for(let s in e)t&&t[s]==e[s]||(n=!0,s=="style"?r.style.cssText=e[s]:r.setAttribute(s,e[s]));return n}function Aw(r){let t=Object.create(null);for(let e=0;e<r.attributes.length;e++){let n=r.attributes[e];t[n.name]=n.value}return t}class $o{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var U2=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(U2||(U2={}));class t2 extends Jr{constructor(t,e,n,s){super(),this.startSide=t,this.endSide=e,this.widget=n,this.spec=s}get heightRelevant(){return!1}static mark(t){return new J5(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new t4(t,e,e,n,t.widget||null,!1)}static replace(t){let e=!!t.block,n,s;if(t.isBlockGap)n=-5e8,s=4e8;else{let{start:a,end:o}=RL(t,e);n=(a?e?-3e8:-1:5e8)-1,s=(o?e?2e8:1:-6e8)+1}return new t4(t,n,s,e,t.widget||null,!0)}static line(t){return new t0(t)}static set(t,e=!1){return Me.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}t2.none=Me.empty;class J5 extends t2{constructor(t){let{start:e,end:n}=RL(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?Jh(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||Pa}eq(t){return this==t||t instanceof J5&&this.tagName==t.tagName&&tT(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}J5.prototype.point=!1;class t0 extends t2{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof t0&&this.spec.class==t.spec.class&&tT(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}t0.prototype.mapMode=S2.TrackBefore;t0.prototype.point=!0;class t4 extends t2{constructor(t,e,n,s,a,o){super(e,n,a,t),this.block=s,this.isReplace=o,this.mapMode=s?e<=0?S2.TrackBefore:S2.TrackAfter:S2.TrackDel}get type(){return this.startSide!=this.endSide?U2.WidgetRange:this.startSide<=0?U2.WidgetBefore:U2.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof t4&&Hw(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}t4.prototype.point=!0;function RL(r,t=!1){let{inclusiveStart:e,inclusiveEnd:n}=r;return e==null&&(e=r.inclusive),n==null&&(n=r.inclusive),{start:e??t,end:n??t}}function Hw(r,t){return r==t||!!(r&&t&&r.compare(t))}function nn(r,t,e,n=0){let s=e.length-1;s>=0&&e[s]+n>=r?e[s]=Math.max(e[s],t):e.push(r,t)}class D5 extends Jr{constructor(t,e){super(),this.tagName=t,this.attributes=e}eq(t){return t==this||t instanceof D5&&this.tagName==t.tagName&&tT(this.attributes,t.attributes)}static create(t){return new D5(t.tagName,t.attributes||Pa)}static set(t,e=!1){return Me.of(t,e)}}D5.prototype.startSide=D5.prototype.endSide=-1;function mn(r){let t;return r.nodeType==11?t=r.getSelection?r:r.ownerDocument:t=r,t.getSelection()}function fc(r,t){return t?r==t||r.contains(t.nodeType!=1?t.parentNode:t):!1}function f5(r,t){if(!t.anchorNode)return!1;try{return fc(r,t.anchorNode)}catch{return!1}}function Qa(r){return r.nodeType==3?O5(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Q5(r,t,e,n){return e?od(r,t,e,n,-1)||od(r,t,e,n,1):!1}function Tr(r){for(var t=0;;t++)if(r=r.previousSibling,!r)return t}function ka(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}function od(r,t,e,n,s){for(;;){if(r==e&&t==n)return!0;if(t==(s<0?0:Si(r))){if(r.nodeName=="DIV")return!1;let a=r.parentNode;if(!a||a.nodeType!=1)return!1;t=Tr(r)+(s<0?0:1),r=a}else if(r.nodeType==1){if(r=r.childNodes[t+(s<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;t=s<0?Si(r):0}else return!1}}function Si(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ra(r,t){let e=t?r.left:r.right;return{left:e,right:e,top:r.top,bottom:r.bottom}}function Mw(r){let t=r.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function BL(r,t){let e=t.width/r.offsetWidth,n=t.height/r.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-r.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-r.offsetHeight)<1)&&(n=1),{scaleX:e,scaleY:n}}function ww(r,t,e,n,s,a,o,l){let u=r.ownerDocument,h=u.defaultView||window;for(let T=r,f=!1;T&&!f;)if(T.nodeType==1){let d,p=T==u.body,m=1,y=1;if(p)d=Mw(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(T).position)&&(f=!0),T.scrollHeight<=T.clientHeight&&T.scrollWidth<=T.clientWidth){T=T.assignedSlot||T.parentNode;continue}let g=T.getBoundingClientRect();({scaleX:m,scaleY:y}=BL(T,g)),d={left:g.left,right:g.left+T.clientWidth*m,top:g.top,bottom:g.top+T.clientHeight*y}}let c=0,Q=0;if(s=="nearest")t.top<d.top?(Q=t.top-(d.top+o),e>0&&t.bottom>d.bottom+Q&&(Q=t.bottom-d.bottom+o)):t.bottom>d.bottom&&(Q=t.bottom-d.bottom+o,e<0&&t.top-Q<d.top&&(Q=t.top-(d.top+o)));else{let g=t.bottom-t.top,v=d.bottom-d.top;Q=(s=="center"&&g<=v?t.top+g/2-v/2:s=="start"||s=="center"&&e<0?t.top-o:t.bottom-v+o)-d.top}if(n=="nearest"?t.left<d.left?(c=t.left-(d.left+a),e>0&&t.right>d.right+c&&(c=t.right-d.right+a)):t.right>d.right&&(c=t.right-d.right+a,e<0&&t.left<d.left+c&&(c=t.left-(d.left+a))):c=(n=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:n=="start"==l?t.left-a:t.right-(d.right-d.left)+a)-d.left,c||Q)if(p)h.scrollBy(c,Q);else{let g=0,v=0;if(Q){let L=T.scrollTop;T.scrollTop+=Q/y,v=(T.scrollTop-L)*y}if(c){let L=T.scrollLeft;T.scrollLeft+=c/m,g=(T.scrollLeft-L)*m}t={left:t.left-g,top:t.top-v,right:t.right-g,bottom:t.bottom-v},g&&Math.abs(g-c)<1&&(n="nearest"),v&&Math.abs(v-Q)<1&&(s="nearest")}if(p)break;(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)&&(t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)}),T=T.assignedSlot||T.parentNode}else if(T.nodeType==11)T=T.host;else break}function Cw(r){let t=r.ownerDocument,e,n;for(let s=r.parentNode;s&&!(s==t.body||e&&n);)if(s.nodeType==1)!n&&s.scrollHeight>s.clientHeight&&(n=s),!e&&s.scrollWidth>s.clientWidth&&(e=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:e,y:n}}class Dw{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?Si(e):0),n,Math.min(t.focusOffset,n?Si(n):0))}set(t,e,n,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=s}}let Rr=null;Bt.safari&&Bt.safari_version>=26&&(Rr=!1);function FL(r){if(r.setActive)return r.setActive();if(Rr)return r.focus(Rr);let t=[];for(let e=r;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(r.focus(Rr==null?{get preventScroll(){return Rr={preventScroll:!0},!0}}:void 0),!Rr){Rr=!1;for(let e=0;e<t.length;){let n=t[e++],s=t[e++],a=t[e++];n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let ld;function O5(r,t,e=t){let n=ld||(ld=document.createRange());return n.setEnd(r,e),n.setStart(r,t),n}function sn(r,t,e,n){let s={key:t,code:t,keyCode:e,which:e,cancelable:!0};n&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=n);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,r.dispatchEvent(a);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,r.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Ow(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Iw(r,t){let e=t.focusNode,n=t.focusOffset;if(!e||t.anchorNode!=e||t.anchorOffset!=n)return!1;for(n=Math.min(n,Si(e));;)if(n){if(e.nodeType!=1)return!1;let s=e.childNodes[n-1];s.contentEditable=="false"?n--:(e=s,n=Si(e))}else{if(e==r)return!0;n=Tr(e),e=e.parentNode}}function NL(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}function UL(r,t){for(let e=r,n=t;;){if(e.nodeType==3&&n>0)return{node:e,offset:n};if(e.nodeType==1&&n>0){if(e.contentEditable=="false")return null;e=e.childNodes[n-1],n=Si(e)}else if(e.parentNode&&!ka(e))n=Tr(e),e=e.parentNode;else return null}}function jL(r,t){for(let e=r,n=t;;){if(e.nodeType==3&&n<e.nodeValue.length)return{node:e,offset:n};if(e.nodeType==1&&n<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[n],n=0}else if(e.parentNode&&!ka(e))n=Tr(e)+1,e=e.parentNode;else return null}}class i3{constructor(t,e,n=!0){this.node=t,this.offset=e,this.precise=n}static before(t,e){return new i3(t.parentNode,Tr(t),e)}static after(t,e){return new i3(t.parentNode,Tr(t)+1,e)}}var b1=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(b1||(b1={}));const e4=b1.LTR,eT=b1.RTL;function GL(r){let t=[];for(let e=0;e<r.length;e++)t.push(1<<+r[e]);return t}const Vw=GL("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Pw=GL("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Qc=Object.create(null),m3=[];for(let r of["()","[]","{}"]){let t=r.charCodeAt(0),e=r.charCodeAt(1);Qc[t]=e,Qc[e]=-t}function zL(r){return r<=247?Vw[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?Pw[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1}const kw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fi{get dir(){return this.level%2?eT:e4}constructor(t,e,n){this.from=t,this.to=e,this.level=n}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,n,s){let a=-1;for(let o=0;o<t.length;o++){let l=t[o];if(l.from<=e&&l.to>=e){if(l.level==n)return o;(a<0||(s!=0?s<0?l.from<e:l.to>e:t[a].level>l.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function WL(r,t){if(r.length!=t.length)return!1;for(let e=0;e<r.length;e++){let n=r[e],s=t[e];if(n.from!=s.from||n.to!=s.to||n.direction!=s.direction||!WL(n.inner,s.inner))return!1}return!0}const Re=[];function Rw(r,t,e,n,s){for(let a=0;a<=n.length;a++){let o=a?n[a-1].to:t,l=a<n.length?n[a].from:e,u=a?256:s;for(let h=o,T=u,f=u;h<l;h++){let d=zL(r.charCodeAt(h));d==512?d=T:d==8&&f==4&&(d=16),Re[h]=d==4?2:d,d&7&&(f=d),T=d}for(let h=o,T=u,f=u;h<l;h++){let d=Re[h];if(d==128)h<l-1&&T==Re[h+1]&&T&24?d=Re[h]=T:Re[h]=256;else if(d==64){let p=h+1;for(;p<l&&Re[p]==64;)p++;let m=h&&T==8||p<e&&Re[p]==8?f==1?1:8:256;for(let y=h;y<p;y++)Re[y]=m;h=p-1}else d==8&&f==1&&(Re[h]=1);T=d,d&7&&(f=d)}}}function Bw(r,t,e,n,s){let a=s==1?2:1;for(let o=0,l=0,u=0;o<=n.length;o++){let h=o?n[o-1].to:t,T=o<n.length?n[o].from:e;for(let f=h,d,p,m;f<T;f++)if(p=Qc[d=r.charCodeAt(f)])if(p<0){for(let y=l-3;y>=0;y-=3)if(m3[y+1]==-p){let c=m3[y+2],Q=c&2?s:c&4?c&1?a:s:0;Q&&(Re[f]=Re[m3[y]]=Q),l=y;break}}else{if(m3.length==189)break;m3[l++]=f,m3[l++]=d,m3[l++]=u}else if((m=Re[f])==2||m==1){let y=m==s;u=y?0:1;for(let c=l-3;c>=0;c-=3){let Q=m3[c+2];if(Q&2)break;if(y)m3[c+2]|=2;else{if(Q&4)break;m3[c+2]|=4}}}}}function Fw(r,t,e,n){for(let s=0,a=n;s<=e.length;s++){let o=s?e[s-1].to:r,l=s<e.length?e[s].from:t;for(let u=o;u<l;){let h=Re[u];if(h==256){let T=u+1;for(;;)if(T==l){if(s==e.length)break;T=e[s++].to,l=s<e.length?e[s].from:t}else if(Re[T]==256)T++;else break;let f=a==1,d=(T<t?Re[T]:n)==1,p=f==d?f?1:2:n;for(let m=T,y=s,c=y?e[y-1].to:r;m>u;)m==c&&(m=e[--y].from,c=y?e[y-1].to:r),Re[--m]=p;u=T}else a=h,u++}}}function dc(r,t,e,n,s,a,o){let l=n%2?2:1;if(n%2==s%2)for(let u=t,h=0;u<e;){let T=!0,f=!1;if(h==a.length||u<a[h].from){let y=Re[u];y!=l&&(T=!1,f=y==16)}let d=!T&&l==1?[]:null,p=T?n:n+1,m=u;t:for(;;)if(h<a.length&&m==a[h].from){if(f)break t;let y=a[h];if(!T)for(let c=y.to,Q=h+1;;){if(c==e)break t;if(Q<a.length&&a[Q].from==c)c=a[Q++].to;else{if(Re[c]==l)break t;break}}if(h++,d)d.push(y);else{y.from>u&&o.push(new fi(u,y.from,p));let c=y.direction==e4!=!(p%2);pc(r,c?n+1:n,s,y.inner,y.from,y.to,o),u=y.to}m=y.to}else{if(m==e||(T?Re[m]!=l:Re[m]==l))break;m++}d?dc(r,u,m,n+1,s,d,o):u<m&&o.push(new fi(u,m,p)),u=m}else for(let u=e,h=a.length;u>t;){let T=!0,f=!1;if(!h||u>a[h-1].to){let y=Re[u-1];y!=l&&(T=!1,f=y==16)}let d=!T&&l==1?[]:null,p=T?n:n+1,m=u;t:for(;;)if(h&&m==a[h-1].to){if(f)break t;let y=a[--h];if(!T)for(let c=y.from,Q=h;;){if(c==t)break t;if(Q&&a[Q-1].to==c)c=a[--Q].from;else{if(Re[c-1]==l)break t;break}}if(d)d.push(y);else{y.to<u&&o.push(new fi(y.to,u,p));let c=y.direction==e4!=!(p%2);pc(r,c?n+1:n,s,y.inner,y.from,y.to,o),u=y.from}m=y.from}else{if(m==t||(T?Re[m-1]!=l:Re[m-1]==l))break;m--}d?dc(r,m,u,n+1,s,d,o):m<u&&o.push(new fi(m,u,p)),u=m}}function pc(r,t,e,n,s,a,o){let l=t%2?2:1;Rw(r,s,a,n,l),Bw(r,s,a,n,l),Fw(s,a,n,l),dc(r,s,a,t,e,n,o)}function Nw(r,t,e){if(!r)return[new fi(0,0,t==eT?1:0)];if(t==e4&&!e.length&&!kw.test(r))return qL(r.length);if(e.length)for(;r.length>Re.length;)Re[Re.length]=256;let n=[],s=t==e4?0:1;return pc(r,s,s,e,0,r.length,n),n}function qL(r){return[new fi(0,r,0)]}let ZL="";function Uw(r,t,e,n,s){var a;let o=n.head-r.from,l=fi.find(t,o,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),u=t[l],h=u.side(s,e);if(o==h){let d=l+=s?1:-1;if(d<0||d>=t.length)return null;u=t[l=d],o=u.side(!s,e),h=u.side(s,e)}let T=e3(r.text,o,u.forward(s,e));(T<u.from||T>u.to)&&(T=h),ZL=r.text.slice(Math.min(o,T),Math.max(o,T));let f=l==(s?t.length-1:0)?null:t[l+(s?1:-1)];return f&&T==h&&f.level+(s?0:1)<u.level?Rt.cursor(f.side(!s,e)+r.from,f.forward(s,e)?1:-1,f.level):Rt.cursor(T+r.from,u.forward(s,e)?-1:1,u.level)}function jw(r,t,e){for(let n=t;n<e;n++){let s=zL(r.charCodeAt(n));if(s==1)return e4;if(s==2||s==4)return eT}return e4}const KL=ne.define(),XL=ne.define(),$L=ne.define(),YL=ne.define(),gc=ne.define(),JL=ne.define(),tx=ne.define(),iT=ne.define(),rT=ne.define(),ex=ne.define({combine:r=>r.some(t=>t)}),Gw=ne.define({combine:r=>r.some(t=>t)}),ix=ne.define();class an{constructor(t,e="nearest",n="nearest",s=5,a=5,o=!1){this.range=t,this.y=e,this.x=n,this.yMargin=s,this.xMargin=a,this.isSnapshot=o}map(t){return t.empty?this:new an(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new an(Rt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ls=_1.define({map:(r,t)=>r.map(t)}),rx=_1.define();function O3(r,t,e){let n=r.facet(YL);n.length?n[0](t):window.onerror&&window.onerror(String(t),e,void 0,void 0,t)||(e?console.error(e+":",t):console.error(t))}const ci=ne.define({combine:r=>r.length?r[0]:!0});let zw=0;const X4=ne.define({combine(r){return r.filter((t,e)=>{for(let n=0;n<e;n++)if(r[n].plugin==t.plugin)return!1;return!0})}});class yn{constructor(t,e,n,s,a){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(X4.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(X4.of({plugin:this,arg:t}))}static define(t,e){const{eventHandlers:n,eventObservers:s,provide:a,decorations:o}=e||{};return new yn(zw++,t,n,s,l=>{let u=[];return o&&u.push(Yo.of(h=>{let T=h.plugin(l);return T?o(T):t2.none})),a&&u.push(a(l)),u})}static fromClass(t,e){return yn.define((n,s)=>new t(n,s),e)}}class e9{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(n){if(O3(e.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(e){O3(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(n){O3(t.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const nx=ne.define(),nT=ne.define(),Yo=ne.define(),sx=ne.define(),sT=ne.define(),e0=ne.define(),ax=ne.define();function ud(r,t){let e=r.state.facet(ax);if(!e.length)return e;let n=e.map(a=>a instanceof Function?a(r):a),s=[];return Me.spans(n,t.from,t.to,{point(){},span(a,o,l,u){let h=a-t.from,T=o-t.from,f=s;for(let d=l.length-1;d>=0;d--,u--){let p=l[d].spec.bidiIsolate,m;if(p==null&&(p=jw(t.text,h,T)),u>0&&f.length&&(m=f[f.length-1]).to==h&&m.direction==p)m.to=T,f=m.inner;else{let y={from:h,to:T,direction:p,inner:[]};f.push(y),f=y.inner}}}}),s}const ox=ne.define();function lx(r){let t=0,e=0,n=0,s=0;for(let a of r.state.facet(ox)){let o=a(r);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:e,top:n,bottom:s}}const i5=ne.define();class B2{constructor(t,e,n,s){this.fromA=t,this.toA=e,this.fromB=n,this.toB=s}join(t){return new B2(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,n=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>n.toA)){if(s.toA<n.fromA)break;n=n.join(s),t.splice(e-1,1)}}return t.splice(e,0,n),t}static extendWithRanges(t,e){if(e.length==0)return t;let n=[];for(let s=0,a=0,o=0;;){let l=s<t.length?t[s].fromB:1e9,u=a<e.length?e[a]:1e9,h=Math.min(l,u);if(h==1e9)break;let T=h+o,f=h,d=T;for(;;)if(a<e.length&&e[a]<=f){let p=e[a+1];a+=2,f=Math.max(f,p);for(let m=s;m<t.length&&t[m].fromB<=f;m++)o=t[m].toA-t[m].toB;d=Math.max(d,p+o)}else if(s<t.length&&t[s].fromB<=f){let p=t[s++];f=Math.max(f,p.toB),d=Math.max(d,p.toA),o=p.toA-p.toB}else break;n.push(new B2(T,d,h,f))}return n}}class Ba{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=D1.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,o,l,u)=>s.push(new B2(a,o,l,u))),this.changedRanges=s}static create(t,e,n){return new Ba(t,e,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Ww=[];class d1{constructor(t,e,n=0){this.dom=t,this.length=e,this.flags=n,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Ww}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&Ew(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,e=this.posAtStart){let n=e;for(let s of this.children){if(s==t)return n;n+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,e){return null}domPosFor(t,e){let n=Tr(this.dom),s=this.length?t>0:e>0;return new i3(this.parent.dom,n+(s?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof t7)return t;return null}static get(t){return t.cmTile}}class Jo extends d1{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let e=this.dom,n=null,s,a=(t==null?void 0:t.node)==e?t:null,o=0;for(let l of this.children){if(l.sync(t),o+=l.length+l.breakAfter,s=n?n.nextSibling:e.firstChild,a&&s!=l.dom&&(a.written=!0),l.dom.parentNode==e)for(;s&&s!=l.dom;)s=cd(s);else e.insertBefore(l.dom,s);n=l.dom}for(s=n?n.nextSibling:e.firstChild,a&&s&&(a.written=!0);s;)s=cd(s);this.length=o}}function cd(r){let t=r.nextSibling;return r.parentNode.removeChild(r),t}class t7 extends Jo{constructor(t,e){super(e),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let e=d1.get(t);if(e&&this.owns(e))return e;t=t.parentNode}}blockTiles(t){for(let e=[],n=this,s=0,a=0;;)if(s==n.children.length){if(!e.length)return;n=n.parent,n.breakAfter&&a++,s=e.pop()}else{let o=n.children[s++];if(o instanceof nr)e.push(s),n=o,s=0;else{let l=a+o.length,u=t(o,a);if(u!==void 0)return u;a=l+o.breakAfter}}}resolveBlock(t,e){let n,s=-1,a,o=-1;if(this.blockTiles((l,u)=>{let h=u+l.length;if(t>=u&&t<=h){if(l.isWidget()&&e>=-1&&e<=1){if(l.flags&32)return!0;l.flags&16&&(n=void 0)}(u<t||t==h&&(e<-1?l.length:l.covers(1)))&&(!n||!l.isWidget()&&n.isWidget())&&(n=l,s=t-u),(h>t||t==u&&(e>1?l.length:l.covers(-1)))&&(!a||!l.isWidget()&&a.isWidget())&&(a=l,o=t-u)}}),!n&&!a)throw new Error("No tile at position "+t);return n&&e<0||!a?{tile:n,offset:s}:{tile:a,offset:o}}}class nr extends Jo{constructor(t,e){super(t),this.wrapper=e}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,e){let n=new nr(e||document.createElement(t.tagName),t);return e||(n.flags|=4),n}}class vn extends Jo{constructor(t,e){super(t),this.attrs=e}isLine(){return!0}static start(t,e,n){let s=new vn(e||document.createElement("div"),t);return(!e||!n)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,e,n){let s=null,a=-1,o=null,l=-1;function u(T,f){for(let d=0,p=0;d<T.children.length&&p<=f;d++){let m=T.children[d],y=p+m.length;y>=f&&(m.isComposite()?u(m,f-p):(!o||o.isHidden&&(e>0||n&&Zw(o,m)))&&(y>f||m.flags&32)?(o=m,l=f-p):(p<f||m.flags&16&&!m.isHidden)&&(s=m,a=f-p)),p=y}}u(this,t);let h=(e<0?s:o)||s||o;return h?{tile:h,offset:h==s?a:l}:null}coordsIn(t,e){let n=this.resolveInline(t,e,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),e):qw(this)}domIn(t,e){let n=this.resolveInline(t,e);if(n){let{tile:s,offset:a}=n;if(this.dom.contains(s.dom))return s.isText()?new i3(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:e);let o=n.tile.parent,l=!1;for(let u of o.children){if(l)return new i3(u.dom,0);u==n.tile&&(l=!0)}}return new i3(this.dom,0)}}function qw(r){let t=r.dom.lastChild;if(!t)return r.dom.getBoundingClientRect();let e=Qa(t);return e[e.length-1]||null}function Zw(r,t){let e=r.coordsIn(0,1),n=t.coordsIn(0,1);return e&&n&&n.top<e.bottom}class h2 extends Jo{constructor(t,e){super(t),this.mark=e}get domAttrs(){return this.mark.attrs}static of(t,e){let n=new h2(e||document.createElement(t.tagName),t);return e||(n.flags|=4),n}}class Gr extends d1{constructor(t,e){super(t,e.length),this.text=e}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,e){let n=this.dom.nodeValue.length;t>n&&(t=n);let s=t,a=t,o=0;t==0&&e<0||t==n&&e>=0?Bt.chrome||Bt.gecko||(t?(s--,o=1):a<n&&(a++,o=-1)):e<0?s--:a<n&&a++;let l=O5(this.dom,s,a).getClientRects();if(!l.length)return null;let u=l[(o?o<0:e>=0)?0:l.length-1];return Bt.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(l,h=>h.width)||u),o?Ra(u,o<0):u||null}static of(t,e){let n=new Gr(e||document.createTextNode(t),t);return e||(n.flags|=2),n}}class i4 extends d1{constructor(t,e,n,s){super(t,e,s),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,e){return this.coordsInWidget(t,e,!1)}coordsInWidget(t,e,n){let s=this.widget.coordsAt(this.dom,t,e);if(s)return s;if(n)return Ra(this.dom.getBoundingClientRect(),this.length?t==0:e<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let u=l?a.length-1:0;o=a[u],!(t>0?u==0:u==a.length-1||o.top<o.bottom);u+=l?-1:1);return Ra(o,!l)}}get overrideDOMText(){if(!this.length)return Ie.empty;let{root:t}=this;if(!t)return Ie.empty;let e=this.posAtStart;return t.view.state.doc.slice(e,e+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,e,n,s,a){return a||(a=t.toDOM(e),t.editable||(a.contentEditable="false")),new i4(a,n,t,s)}}class Fa extends d1{constructor(t){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),super(e,0,t)}get isHidden(){return!0}get overrideDOMText(){return Ie.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Kw{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,e,n){let{tile:s,index:a,beforeBreak:o,parents:l}=this;for(;t||e>0;)if(s.isComposite())if(o){if(!t)break;n&&n.break(),t--,o=!1}else if(a==s.children.length){if(!t&&!l.length)break;n&&n.leave(s),o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++}else{let u=s.children[a],h=u.breakAfter;(e>0?u.length<=t:u.length<t)&&(!n||n.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!h,a++,t-=u.length):(l.push({tile:s,index:a}),s=u,a=0,n&&u.isComposite()&&n.enter(u))}else if(a==s.length)o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++;else if(t){let u=Math.min(t,s.length-a);n&&n.skip(s,a,a+u),t-=u,a+=u}else break;return this.tile=s,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Xw{constructor(t,e,n,s){this.from=t,this.to=e,this.wrapper=n,this.rank=s}}class $w{constructor(t,e,n){this.cache=t,this.root=e,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,e,n,s){var a;this.flushBuffer();let o=this.ensureMarks(e,n),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)){this.cache.reused.set(l,2);let u=o.children[o.children.length-1]=new Gr(l.dom,l.text+t);u.parent=o}else o.append(s||Gr.of(t,(a=this.cache.find(Gr))===null||a===void 0?void 0:a.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,e){let n=this.curLine;n.dom!=e.line.dom&&(n.setDOM(this.cache.reused.has(e.line)?i9(e.line.dom):e.line.dom),this.cache.reused.set(e.line,2));let s=n;for(let l=e.marks.length-1;l>=0;l--){let u=e.marks[l],h=s.lastChild;if(h instanceof h2&&h.mark.eq(u.mark))h.dom!=u.dom&&h.setDOM(i9(u.dom)),s=h;else{if(this.cache.reused.get(u)){let f=d1.get(u.dom);f&&f.setDOM(i9(u.dom))}let T=h2.of(u.mark,u.dom);s.append(T),s=T}this.cache.reused.set(u,2)}let a=d1.get(t.text);a&&this.cache.reused.set(a,2);let o=new Gr(t.text,t.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(t,e,n){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let a=this.ensureMarks(e,n);!s&&!(t.flags&16)&&a.append(this.getBuffer(1)),a.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,e,n){this.flushBuffer(),this.ensureMarks(e,n).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let e=this.afterWidget||this.lastBlock;e.length+=t,this.pos+=t}addLineStart(t,e){var n;t||(t=ux);let s=vn.start(t,e||((n=this.cache.find(vn))===null||n===void 0?void 0:n.dom),!!e);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,e){var n;let s=this.curLine;for(let a=t.length-1;a>=0;a--){let o=t[a],l;if(e>0&&(l=s.lastChild)&&l instanceof h2&&l.mark.eq(o))s=l,e--;else{let u=h2.of(o,(n=this.cache.find(h2,h=>h.mark.eq(o)))===null||n===void 0?void 0:n.dom);s.append(u),s=u,e=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!hd(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Bt.ios&&hd(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(r9,0,32)||new i4(r9.toDOM(),0,r9,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let e=new Xw(t.from,t.to,t.value,t.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-e.rank||this.wrappers[n-1].to-e.to)<0;)n--;this.wrappers.splice(n,0,e)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let e=this.root;for(let n of this.wrappers){let s=e.lastChild;if(n.from<this.pos&&s instanceof nr&&s.wrapper.eq(n.wrapper))e=s;else{let a=nr.of(n.wrapper,(t=this.cache.find(nr,o=>o.wrapper.eq(n.wrapper)))===null||t===void 0?void 0:t.dom);e.append(a),e=a}}return e}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let e=2|(t<0?16:32),n=this.cache.find(Fa,void 0,1);return n&&(n.flags=e),n||new Fa(e)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Yw{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:s,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(t,s.length);return a?null:s.slice(0,l)}let e=Math.min(this.text.length,this.textOff+t),n=this.text.slice(this.textOff,e);return this.textOff=e,n}}const Na=[i4,vn,Gr,h2,Fa,nr,t7];for(let r=0;r<Na.length;r++)Na[r].bucket=r;class Jw{constructor(t){this.view=t,this.buckets=Na.map(()=>[]),this.index=Na.map(()=>0),this.reused=new Map}add(t){let e=t.constructor.bucket,n=this.buckets[e];n.length<6?n.push(t):n[this.index[e]=(this.index[e]+1)%6]=t}find(t,e,n=2){let s=t.bucket,a=this.buckets[s],o=this.index[s];for(let l=a.length-1;l>=0;l--){let u=(l+o)%a.length,h=a[u];if((!e||e(h))&&!this.reused.has(h))return a.splice(u,1),u<o&&this.index[s]--,this.reused.set(h,n),h}return null}findWidget(t,e,n){let s=this.buckets[0];if(s.length)for(let a=0,o=0;;a++){if(a==s.length){if(o)return null;o=1,a=0}let l=s[a];if(!this.reused.has(l)&&(o==0?l.widget.compare(t):l.widget.constructor==t.constructor&&t.updateDOM(l.dom,this.view)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,l.widget==t&&l.length==e&&(l.flags&497)==n?(this.reused.set(l,1),l):(this.reused.set(l,2),new i4(l.dom,e,t,l.flags&-498|n))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,e=2){if(!this.reused.has(t))return this.reused.set(t,e),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class tC{constructor(t,e,n,s,a){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new Jw(t),this.text=new Yw(t.state.doc),this.builder=new $w(this.cache,new t7(t,t.contentDOM),Me.iter(n)),this.cache.reused.set(e,2),this.old=new Kw(e),this.reuseWalker={skip:(o,l,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,e){let n=e&&this.getCompositionContext(e.text);for(let s=0,a=0,o=0;;){let l=o<t.length?t[o++]:null,u=l?l.fromA:this.old.root.length;if(u>s){let h=u-s;this.preserve(h,!o,!l),s=u,a+=h}if(!l)break;e&&l.fromA<=e.range.fromA&&l.toA>=e.range.toA?(this.forward(l.fromA,e.range.fromA,e.range.fromA<e.range.toA?1:-1),this.emit(a,e.range.fromB),this.cache.clear(),this.builder.addComposition(e,n),this.text.skip(e.range.toB-e.range.fromB),this.forward(e.range.fromA,l.toA),this.emit(e.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(a,l.toB)),a=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,e,n){let s=rC(this.old),a=this.openMarks;this.old.advance(t,n?1:-1,{skip:(o,l,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-l);else{let h=u>0||l<o.length?i4.of(o.widget,this.view,u-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,s,a),a=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&u==o.length?this.builder.addText(o.text,s,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,u),s,a)),a=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Fa)this.cache.add(o);else if(o instanceof h2)this.builder.ensureLine(null),this.builder.addMark(o,s,a),this.cache.reused.set(o,1),a=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof h2&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=a=0):o instanceof h2&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,e){let n=null,s=this.builder,a=0,o=Me.spans(this.decorations,t,e,{point:(l,u,h,T,f,d)=>{if(h instanceof t4){if(this.disallowBlockEffectsFor[d]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=T.length,f>T.length)s.continueWidget(u-l);else{let p=h.widget||(h.block?Ln.block:Ln.inline),m=eC(h),y=this.cache.findWidget(p,u-l,m)||i4.of(p,this.view,u-l,m);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(n),s.addBlockWidget(y)):(s.ensureLine(n),s.addInlineWidget(y,T,f))}n=null}else n=iC(n,h);u>l&&this.text.skip(u-l)},span:(l,u,h,T)=>{for(let f=l;f<u;){let d=this.text.next(Math.min(512,u-f));d==null?(s.addLineStartIfNotCovered(n),s.addBreak(),f++):(s.ensureLine(n),s.addText(d,h,T),f+=d.length),n=null}}});s.addLineStartIfNotCovered(n),this.openWidget=o>a,this.openMarks=o}forward(t,e,n=1){e-t<=10?this.old.advance(e-t,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(e-t-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(t){let e=[],n=null;for(let s=t.parentNode;;s=s.parentNode){let a=d1.get(s);if(s==this.view.contentDOM)break;a instanceof h2?e.push(a):a!=null&&a.isLine()?n=a:s.nodeName=="DIV"&&!n&&s!=this.view.contentDOM?n=new vn(s,ux):e.push(h2.of(new J5({tagName:s.nodeName.toLowerCase(),attributes:Aw(s)}),s))}return{line:n,marks:e}}}function hd(r,t){let e=n=>{for(let s of n.children)if((t?s.isText():s.length)||e(s))return!0;return!1};return e(r)}function eC(r){let t=r.isReplace?(r.startSide<0?64:0)|(r.endSide>0?128:0):r.startSide>0?32:16;return r.block&&(t|=256),t}const ux={class:"cm-line"};function iC(r,t){let e=t.spec.attributes,n=t.spec.class;return!e&&!n||(r||(r={class:"cm-line"}),e&&Jh(e,r),n&&(r.class+=" "+n)),r}function rC(r){let t=[];for(let e=r.parents.length;e>1;e--){let n=e==r.parents.length?r.tile:r.parents[e].tile;n instanceof h2&&t.push(n.mark)}return t}function i9(r){let t=d1.get(r);return t&&t.setDOM(r.cloneNode()),r}class Ln extends $o{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ln.inline=new Ln("span");Ln.block=new Ln("div");const r9=new class extends $o{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Td{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=t2.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new t7(t,t.contentDOM),this.updateInner([new B2(0,0,0,t.state.doc.length)],null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:T,toA:f})=>f<this.minWidthFrom||T>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?s=this.domChanged.newSel.head:!TC(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let a=s>-1?sC(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:T,to:f}=this.hasComposition;n=new B2(T,f,t.changes.mapPos(T,-1),t.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Bt.ie||Bt.chrome)&&!a&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let u=lC(o,this.decorations,t.changes);u.length&&(n=B2.extendWithRanges(n,u));let h=cC(l,this.blockWrappers,t.changes);return h.length&&(n=B2.extendWithRanges(n,h)),a&&!n.some(T=>T.fromA<=a.range.fromA&&T.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(e||t.length){let o=this.tile,l=new tC(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=l.run(t,e),mc(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Bt.chrome||Bt.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof n9&&s.push(a.dom);n.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let n of e.effects)n.is(rx)&&(this.editContextFormatting=n.value)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,s=this.view.root.activeElement,a=s==n,o=!a&&!(this.view.state.facet(ci)||n.tabIndex>-1)&&f5(n,this.view.observer.selectionRange)&&!(s&&n.contains(s));if(!(a||e||o))return;let l=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,h,T;if(u.empty?T=h=this.inlineDOMNearPos(u.anchor,u.assoc||1):(T=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),h=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),Bt.gecko&&u.empty&&!this.hasComposition&&nC(h)){let d=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(d,h.node.childNodes[h.offset]||null)),h=T=new i3(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Q5(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Q5(T.node,T.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,u))&&(this.view.observer.ignore(()=>{Bt.android&&Bt.chrome&&n.contains(f.focusNode)&&hC(f.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let d=mn(this.view.root);if(d)if(u.empty){if(Bt.gecko){let p=aC(h.node,h.offset);if(p&&p!=3){let m=(p==1?UL:jL)(h.node,h.offset);m&&(h=new i3(m.node,m.offset))}}d.collapse(h.node,h.offset),u.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=u.bidiLevel)}else if(d.extend){d.collapse(h.node,h.offset);try{d.extend(T.node,T.offset)}catch{}}else{let p=document.createRange();u.anchor>u.head&&([h,T]=[T,h]),p.setEnd(T.node,T.offset),p.setStart(h.node,h.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==n&&(n.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,T)),this.impreciseAnchor=h.precise?null:new i3(f.anchorNode,f.anchorOffset),this.impreciseHead=T.precise?null:new i3(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Q5(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=mn(t.root),{anchorNode:s,anchorOffset:a}=t.observer.selectionRange;if(!n||!e.empty||!e.assoc||!n.modify)return;let o=this.lineAt(e.head,e.assoc);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let u=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!u||!h||u.bottom>h.top)return;let T=this.domAtPos(e.head+e.assoc,e.assoc);n.collapse(T.node,T.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&n.collapse(s,a)}posFromDOM(t,e){let n=this.tile.nearest(t);if(!n)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=n.posAtStart;if(n.isComposite()){let a;if(t==n.dom)a=n.dom.childNodes[e];else{let o=Si(t)==0?0:e==0?-1:1;for(;;){let l=t.parentNode;if(l==n.dom)break;o==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?o=-1:o=1),t=l}o<0?a=t:a=t.nextSibling}if(a==n.dom.firstChild)return s;for(;a&&!d1.get(a);)a=a.nextSibling;if(!a)return s+n.length;for(let o=0,l=s;;o++){let u=n.children[o];if(u.dom==a)return l;l+=u.length+u.breakAfter}}else return n.isText()?t==n.dom?s+e:s+(e?n.length:0):s}domAtPos(t,e){let{tile:n,offset:s}=this.tile.resolveBlock(t,e);return n.isWidget()?n.domPosFor(t,e):n.domIn(s,e)}inlineDOMNearPos(t,e){let n,s=-1,a=!1,o,l=-1,u=!1;return this.tile.blockTiles((h,T)=>{if(h.isWidget()){if(h.flags&32&&T>=t)return!0;h.flags&16&&(a=!0)}else{let f=T+h.length;if(T<=t&&(n=h,s=t-T,a=f<t),f>=t&&!o&&(o=h,l=t-T,u=T>t),T>t&&o)return!0}}),!n&&!o?this.domAtPos(t,e):(a&&o?n=null:u&&n&&(o=null),n&&e<0||!o?n.domIn(s,e):o.domIn(l,e))}coordsAt(t,e){let{tile:n,offset:s}=this.tile.resolveBlock(t,e);return n.isWidget()?n.widget instanceof n9?null:n.coordsInWidget(s,e,!0):n.coordsIn(s,e)}lineAt(t,e){let{tile:n}=this.tile.resolveBlock(t,e);return n.isLine()?n:null}coordsForChar(t){let{tile:e,offset:n}=this.tile.resolveBlock(t,1);if(!e.isLine())return null;function s(a,o){if(a.isComposite())for(let l of a.children){if(l.length>=o){let u=s(l,o);if(u)return u}if(o-=l.length,o<0)break}else if(a.isText()&&o<a.length){let l=e3(a.text,o);if(l==o)return null;let u=O5(a.dom,o,l).getClientRects();for(let h=0;h<u.length;h++){let T=u[h];if(h==u.length-1||T.top<T.bottom&&T.left<T.right)return T}}return null}return s(e,n)}measureVisibleLineHeights(t){let e=[],{from:n,to:s}=t,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,u=this.view.textDirection==b1.LTR,h=0,T=(f,d,p)=>{for(let m=0;m<f.children.length&&!(d>s);m++){let y=f.children[m],c=d+y.length,Q=y.dom.getBoundingClientRect(),{height:g}=Q;if(p&&!m&&(h+=Q.top-p.top),y instanceof nr)c>n&&T(y,d,Q);else if(d>=n&&(h>0&&e.push(-h),e.push(g+h),h=0,o)){let v=y.dom.lastChild,L=v?Qa(v):[];if(L.length){let x=L[L.length-1],b=u?x.right-Q.left:Q.right-x.left;b>l&&(l=b,this.minWidth=a,this.minWidthFrom=d,this.minWidthTo=c)}}p&&m==f.children.length-1&&(h+=p.bottom-Q.bottom),d=c+y.breakAfter}};return T(this.tile,0,null),e}textDirectionAt(t){let{tile:e}=this.tile.resolveBlock(t,1);return getComputedStyle(e.dom).direction=="rtl"?b1.RTL:b1.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,u;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let T=Qa(h.dom);if(T.length!=1)return;l+=T[0].width,u=T[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:u}}});if(t)return t;let e=document.createElement("div"),n,s,a;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(e);let o=Qa(e.firstChild)[0];n=e.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,a=o&&o.height?o.height:n,e.remove()}),{lineHeight:n,charWidth:s,textHeight:a}}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,s=0;;s++){let a=s==e.viewports.length?null:e.viewports[s],o=a?a.from-1:this.view.state.doc.length;if(o>n){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(t2.replace({widget:new n9(l),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!a)break;n=a.to+1}return t2.set(t)}updateDeco(){let t=1,e=this.view.state.facet(Yo).map(a=>(this.dynamicDecorationMap[t++]=typeof a=="function")?a(this.view):a),n=!1,s=this.view.state.facet(sT).map((a,o)=>{let l=typeof a=="function";return l&&(n=!0),l?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[t++]=n,e.push(Me.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(sx).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(t){if(t.isSnapshot){let h=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=h.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let h of this.view.state.facet(ix))try{if(h(this.view,t.range,t))return!0}catch(T){O3(this.view.state,T,"scroll handler")}let{range:e}=t,n=this.coordsAt(e.head,e.empty?e.assoc:e.head>e.anchor?-1:1),s;if(!n)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(n={left:Math.min(n.left,s.left),top:Math.min(n.top,s.top),right:Math.max(n.right,s.right),bottom:Math.max(n.bottom,s.bottom)});let a=lx(this.view),o={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:l,offsetHeight:u}=this.view.scrollDOM;ww(this.view.scrollDOM,o,e.head<e.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==b1.LTR)}lineHasWidget(t){let e=n=>n.isWidget()||n.children.some(e);return e(this.tile.resolveBlock(t,1).tile)}destroy(){mc(this.tile)}}function mc(r,t){let e=t==null?void 0:t.get(r);if(e!=1){e==null&&r.destroy();for(let n of r.children)mc(n,t)}}function nC(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}function cx(r,t){let e=r.observer.selectionRange;if(!e.focusNode)return null;let n=UL(e.focusNode,e.focusOffset),s=jL(e.focusNode,e.focusOffset),a=n||s;if(s&&n&&s.node!=n.node){let l=d1.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)a=s;else if(r.docView.lastCompositionAfterCursor){let u=d1.get(n.node);!u||u.isText()&&u.text!=n.node.nodeValue||(a=s)}}if(r.docView.lastCompositionAfterCursor=a!=n,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function sC(r,t,e){let n=cx(r,e);if(!n)return null;let{node:s,from:a,to:o}=n,l=s.nodeValue;if(/[\n\r]/.test(l)||r.state.doc.sliceString(n.from,n.to)!=l)return null;let u=t.invertedDesc;return{range:new B2(u.mapPos(a),u.mapPos(o),a,o),text:s}}function aC(r,t){return r.nodeType!=1?0:(t&&r.childNodes[t-1].contentEditable=="false"?1:0)|(t<r.childNodes.length&&r.childNodes[t].contentEditable=="false"?2:0)}let oC=class{constructor(){this.changes=[]}compareRange(t,e){nn(t,e,this.changes)}comparePoint(t,e){nn(t,e,this.changes)}boundChange(t){nn(t,t,this.changes)}};function lC(r,t,e){let n=new oC;return Me.compare(r,t,e,n),n.changes}class uC{constructor(){this.changes=[]}compareRange(t,e){nn(t,e,this.changes)}comparePoint(){}boundChange(t){nn(t,t,this.changes)}}function cC(r,t,e){let n=new uC;return Me.compare(r,t,e,n),n.changes}function hC(r,t){for(let e=r;e&&e!=t;e=e.assignedSlot||e.parentNode)if(e.nodeType==1&&e.contentEditable=="false")return!0;return!1}function TC(r,t){let e=!1;return t&&r.iterChangedRanges((n,s)=>{n<t.to&&s>t.from&&(e=!0)}),e}class n9 extends $o{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function fC(r,t,e=1){let n=r.charCategorizer(t),s=r.doc.lineAt(t),a=t-s.from;if(s.length==0)return Rt.cursor(t);a==0?e=1:a==s.length&&(e=-1);let o=a,l=a;e<0?o=e3(s.text,a,!1):l=e3(s.text,a);let u=n(s.text.slice(o,l));for(;o>0;){let h=e3(s.text,o,!1);if(n(s.text.slice(h,o))!=u)break;o=h}for(;l<s.length;){let h=e3(s.text,l);if(n(s.text.slice(l,h))!=u)break;l=h}return Rt.range(o+s.from,l+s.from)}function QC(r,t,e,n,s){let a=Math.round((n-t.left)*r.defaultCharacterWidth);if(r.lineWrapping&&e.height>r.defaultLineHeight*1.5){let l=r.viewState.heightOracle.textHeight,u=Math.floor((s-e.top-(r.defaultLineHeight-l)*.5)/l);a+=u*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(e.from,e.to);return e.from+_w(o,a,r.state.tabSize)}function dC(r,t,e){let n=r.lineBlockAt(t);if(Array.isArray(n.type)){let s;for(let a of n.type){if(a.from>t)break;if(!(a.to<t)){if(a.from<t&&a.to>t)return a;(!s||a.type==U2.Text&&(s.type!=a.type||(e<0?a.from<t:a.to>t)))&&(s=a)}}return s||n}return n}function pC(r,t,e,n){let s=dC(r,t.head,t.assoc||-1),a=!n||s.type!=U2.Text||!(r.lineWrapping||s.widgetLineBreaks)?null:r.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(a){let o=r.dom.getBoundingClientRect(),l=r.textDirectionAt(s.from),u=r.posAtCoords({x:e==(l==b1.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(u!=null)return Rt.cursor(u,e?-1:1)}return Rt.cursor(e?s.to:s.from,e?-1:1)}function fd(r,t,e,n){let s=r.state.doc.lineAt(t.head),a=r.bidiSpans(s),o=r.textDirectionAt(s.from);for(let l=t,u=null;;){let h=Uw(s,a,o,l,e),T=ZL;if(!h){if(s.number==(e?r.state.doc.lines:1))return l;T=`
111
111
  `,s=r.state.doc.line(s.number+(e?1:-1)),a=r.bidiSpans(s),h=r.visualLineSide(s,!e)}if(u){if(!u(T))return l}else{if(!n)return h;u=n(T)}l=h}}function gC(r,t,e){let n=r.state.charCategorizer(t),s=n(e);return a=>{let o=n(a);return s==Ti.Space&&(s=o),s==o}}function mC(r,t,e,n){let s=t.head,a=e?1:-1;if(s==(e?r.state.doc.length:0))return Rt.cursor(s,t.assoc);let o=t.goalColumn,l,u=r.contentDOM.getBoundingClientRect(),h=r.coordsAtPos(s,t.assoc||-1),T=r.documentTop;if(h)o==null&&(o=h.left-u.left),l=a<0?h.top:h.bottom;else{let m=r.viewState.lineBlockAt(s);o==null&&(o=Math.min(u.right-u.left,r.defaultCharacterWidth*(s-m.from))),l=(a<0?m.top:m.bottom)+T}let f=u.left+o,d=n??r.viewState.heightOracle.textHeight>>1,p=yc(r,{x:f,y:l+d*a},!1,a);return Rt.cursor(p.pos,p.assoc,void 0,o)}function d5(r,t,e){for(;;){let n=0;for(let s of r)s.between(t-1,t+1,(a,o,l)=>{if(t>a&&t<o){let u=n||e||(t-a<o-t?-1:1);t=u<0?a:o,n=u}});if(!n)return t}}function hx(r,t){let e=null;for(let n=0;n<t.ranges.length;n++){let s=t.ranges[n],a=null;if(s.empty){let o=d5(r,s.from,0);o!=s.from&&(a=Rt.cursor(o,-1))}else{let o=d5(r,s.from,-1),l=d5(r,s.to,1);(o!=s.from||l!=s.to)&&(a=Rt.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}a&&(e||(e=t.ranges.slice()),e[n]=a)}return e?Rt.create(e,t.mainIndex):t}function s9(r,t,e){let n=d5(r.state.facet(e0).map(s=>s(r)),e.from,t.head>e.from?-1:1);return n==e.from?e:Rt.cursor(n,n<e.from?1:-1)}class C3{constructor(t,e){this.pos=t,this.assoc=e}}function yc(r,t,e,n){let s=r.contentDOM.getBoundingClientRect(),a=s.top+r.viewState.paddingTop,{x:o,y:l}=t,u=l-a,h;for(;;){if(u<0)return new C3(0,1);if(u>r.viewState.docHeight)return new C3(r.state.doc.length,-1);if(h=r.elementAtHeight(u),n==null)break;if(h.type==U2.Text){let d=r.docView.coordsAt(n<0?h.from:h.to,n);if(d&&(n<0?d.top<=u+a:d.bottom>=u+a))break}let f=r.viewState.heightOracle.textHeight/2;u=n>0?h.bottom+f:h.top-f}if(r.viewport.from>=h.to||r.viewport.to<=h.from){if(e)return null;if(h.type==U2.Text){let f=QC(r,s,h,o,l);return new C3(f,f==h.from?1:-1)}}if(h.type!=U2.Text)return u<(h.top+h.bottom)/2?new C3(h.from,1):new C3(h.to,-1);let T=r.docView.lineAt(h.from,2);return(!T||T.length!=h.length)&&(T=r.docView.lineAt(h.from,-2)),Tx(r,T,h.from,o,l)}function Tx(r,t,e,n,s){let a=-1,o=null,l=1e9,u=1e9,h=s,T=s,f=(d,p)=>{for(let m=0;m<d.length;m++){let y=d[m];if(y.top==y.bottom)continue;let c=y.left>n?y.left-n:y.right<n?n-y.right:0,Q=y.top>s?y.top-s:y.bottom<s?s-y.bottom:0;y.top<=T&&y.bottom>=h&&(h=Math.min(y.top,h),T=Math.max(y.bottom,T),Q=0),(a<0||(Q-u||c-l)<0)&&(a>=0&&u&&l<c&&o.top<=T-2&&o.bottom>=h+2?u=0:(a=p,l=c,u=Q,o=y))}};if(t.isText()){for(let p=0;p<t.length;){let m=e3(t.text,p);if(f(O5(t.dom,p,m).getClientRects(),p),!l&&!u)break;p=m}return n>(o.left+o.right)/2==(Qd(r,a+e)==b1.LTR)?new C3(e+e3(t.text,a),-1):new C3(e+a,1)}else{if(!t.length)return new C3(e,1);for(let y=0;y<t.children.length;y++){let c=t.children[y];if(c.flags&48)continue;let Q=(c.dom.nodeType==1?c.dom:O5(c.dom,0,c.length)).getClientRects();if(f(Q,y),!l&&!u)break}let d=t.children[a],p=t.posBefore(d,e);return d.isComposite()||d.isText()?Tx(r,d,p,Math.max(o.left,Math.min(o.right,n)),s):n>(o.left+o.right)/2==(Qd(r,a+e)==b1.LTR)?new C3(p+d.length,-1):new C3(p,1)}}function Qd(r,t){let e=r.state.doc.lineAt(t);return r.bidiSpans(e)[fi.find(r.bidiSpans(e),t-e.from,-1,1)].dir}const r5="￿";class yC{constructor(t,e){this.points=t,this.view=e,this.text="",this.lineSeparator=e.state.facet(Oe.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=r5}readRange(t,e){if(!t)return this;let n=t.parentNode;for(let s=t;;){this.findPointBefore(n,s);let a=this.text.length;this.readNode(s);let o=d1.get(s),l=s.nextSibling;if(l==e){o!=null&&o.breakAfter&&!l&&n!=this.view.contentDOM&&this.lineBreak();break}let u=d1.get(l);(o&&u?o.breakAfter:(o?o.breakAfter:ka(s))||ka(l)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!LC(l,e)&&this.lineBreak(),s=l}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,l;if(this.lineSeparator?(a=e.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=s.exec(e))&&(a=l.index,o=l[0].length),this.append(e.slice(n,a<0?e.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==t&&u.pos>this.text.length&&(u.pos-=o-1);n=a+o}}readNode(t){let e=d1.get(t),n=e&&e.overrideDOMText;if(n!=null){this.findPointInside(t,n.length);for(let s=n.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(t.nodeType==3?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(vC(t,n.node,n.offset)?e:0))}}function vC(r,t,e){for(;;){if(!t||e<Si(t))return!1;if(t==r)return!0;e=Tr(t)+1,t=t.parentNode}}function LC(r,t){let e;for(;!(r==t||!r);r=r.nextSibling){let n=d1.get(r);if(!(n!=null&&n.isWidget()))return!1;n&&(e||(e=[])).push(n)}if(e)for(let n of e){let s=n.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class dd{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class xC{constructor(t,e,n,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:a,impreciseAnchor:o}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=fx(t.docView.tile,e,n,0))){let l=a||o?[]:bC(t),u=new yC(l,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=SC(l,this.bounds.from)}else{let l=t.observer.selectionRange,u=a&&a.node==l.focusNode&&a.offset==l.focusOffset||!fc(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!fc(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),T=t.viewport;if((Bt.ios||Bt.chrome)&&t.state.selection.main.empty&&u!=h&&(T.from>0||T.to<t.state.doc.length)){let f=Math.min(u,h),d=Math.max(u,h),p=T.from-f,m=T.to-d;(p==0||p==1||f==0)&&(m==0||m==-1||d==t.state.doc.length)&&(u=0,h=t.state.doc.length)}t.inputState.composing>-1&&t.state.selection.ranges.length>1?this.newSel=t.state.selection.replaceRange(Rt.range(h,u)):this.newSel=Rt.single(h,u)}}}function fx(r,t,e,n){if(r.isComposite()){let s=-1,a=-1,o=-1,l=-1;for(let u=0,h=n,T=n;u<r.children.length;u++){let f=r.children[u],d=h+f.length;if(h<t&&d>e)return fx(f,t,e,h);if(d>=t&&s==-1&&(s=u,a=h),h>e&&f.dom.parentNode==r.dom){o=u,l=T;break}T=d,h=d+f.breakAfter}return{from:a,to:l<0?n+r.length:l,startDOM:(s?r.children[s-1].dom.nextSibling:null)||r.dom.firstChild,endDOM:o<r.children.length&&o>=0?r.children[o].dom:null}}else return r.isText()?{from:n,to:n+r.length,startDOM:r.dom,endDOM:r.dom.nextSibling}:null}function Qx(r,t){let e,{newSel:n}=t,s=r.state.selection.main,a=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,u=s.from,h=null;(a===8||Bt.android&&t.text.length<l-o)&&(u=s.to,h="end");let T=dx(r.state.doc.sliceString(o,l,r5),t.text,u-o,h);T&&(Bt.chrome&&a==13&&T.toB==T.from+2&&t.text.slice(T.from,T.toB)==r5+r5&&T.toB--,e={from:o+T.from,to:o+T.toA,insert:Ie.of(t.text.slice(T.from,T.toB).split(r5))})}else n&&(!r.hasFocus&&r.state.facet(ci)||Ua(n,s))&&(n=null);if(!e&&!n)return!1;if(!e&&t.typeOver&&!s.empty&&n&&n.main.empty?e={from:s.from,to:s.to,insert:r.state.doc.slice(s.from,s.to)}:(Bt.mac||Bt.android)&&e&&e.from==e.to&&e.from==s.head-1&&/^\. ?$/.test(e.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&e.insert.length==2&&(n=Rt.single(n.main.anchor-1,n.main.head-1)),e={from:e.from,to:e.to,insert:Ie.of([e.insert.toString().replace("."," ")])}):e&&e.from>=s.from&&e.to<=s.to&&(e.from!=s.from||e.to!=s.to)&&s.to-s.from-(e.to-e.from)<=4?e={from:s.from,to:s.to,insert:r.state.doc.slice(s.from,e.from).append(e.insert).append(r.state.doc.slice(e.to,s.to))}:r.state.doc.lineAt(s.from).to<s.to&&r.docView.lineHasWidget(s.to)&&r.inputState.insertingTextAt>Date.now()-50?e={from:s.from,to:s.to,insert:r.state.toText(r.inputState.insertingText)}:Bt.chrome&&e&&e.from==e.to&&e.from==s.head&&e.insert.toString()==`
112
- `&&r.lineWrapping&&(n&&(n=Rt.single(n.main.anchor-1,n.main.head-1)),e={from:s.from,to:s.to,insert:Ie.of([" "])}),e)return aT(r,e,n,a);if(n&&!Ua(n,s)){let o=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=hx(r.state.facet(e0).map(u=>u(r)),n))),r.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function aT(r,t,e,n=-1){if(Bt.ios&&r.inputState.flushIOSKey(t))return!0;let s=r.state.selection.main;if(Bt.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&r.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&sn(r.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||n==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&sn(r.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&sn(r.contentDOM,"Delete",46)))return!0;let a=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,l=()=>o||(o=_C(r,t,e));return r.state.facet(JL).some(u=>u(r,t.from,t.to,a,l))||r.dispatch(l()),!0}function _C(r,t,e){let n,s=r.state,a=s.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let u=t.from<a.from?-1:1,h=u<0?a.from:a.to,T=d5(s.facet(e0).map(f=>f(r)),h,u);t.from==T&&(o=T)}if(o>-1)n={changes:t,selection:Rt.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&r.inputState.composing<0){let u=a.from<t.from?s.sliceDoc(a.from,t.from):"",h=a.to>t.to?s.sliceDoc(t.to,a.to):"";n=s.replaceSelection(r.state.toText(u+t.insert.sliceString(0,void 0,r.state.lineBreak)+h))}else{let u=s.changes(t),h=e&&e.main.to<=u.newLength?e.main:void 0;if(s.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let T=r.state.sliceDoc(t.from,t.to),f,d=e&&cx(r,e.main.head);if(d){let m=t.insert.length-(t.to-t.from);f={from:d.from,to:d.to-m}}else f=r.state.doc.lineAt(a.head);let p=a.to-t.to;n=s.changeByRange(m=>{if(m.from==a.from&&m.to==a.to)return{changes:u,range:h||m.map(u)};let y=m.to-p,c=y-T.length;if(r.state.sliceDoc(c,y)!=T||y>=f.from&&c<=f.to)return{range:m};let Q=s.changes({from:c,to:y,insert:t.insert}),g=m.to-a.to;return{changes:Q,range:h?Rt.range(Math.max(0,h.anchor+g),Math.max(0,h.head+g)):m.map(Q)}})}else n={changes:u,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,l+=".compose",r.inputState.compositionFirstChange&&(l+=".start",r.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:l,scrollIntoView:!0})}function dx(r,t,e,n){let s=Math.min(r.length,t.length),a=0;for(;a<s&&r.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==s&&r.length==t.length)return null;let o=r.length,l=t.length;for(;o>0&&l>0&&r.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(n=="end"){let u=Math.max(0,a-Math.min(o,l));e-=o+u-a}if(o<a&&r.length<t.length){let u=e<=a&&e>=o?a-e:0;a-=u,l=a+(l-o),o=a}else if(l<a){let u=e<=a&&e>=l?a-e:0;a-=u,o=a+(o-l),l=a}return{from:a,toA:o,toB:l}}function bC(r){let t=[];if(r.root.activeElement!=r.contentDOM)return t;let{anchorNode:e,anchorOffset:n,focusNode:s,focusOffset:a}=r.observer.selectionRange;return e&&(t.push(new dd(e,n)),(s!=e||a!=n)&&t.push(new dd(s,a))),t}function SC(r,t){if(r.length==0)return null;let e=r[0].pos,n=r.length==2?r[1].pos:e;return e>-1&&n>-1?Rt.single(e+t,n+t):null}function Ua(r,t){return t.head==r.main.head&&t.anchor==r.main.anchor}class EC{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Bt.safari&&t.contentDOM.addEventListener("input",()=>null),Bt.gecko&&UC(t.contentDOM.ownerDocument)}handleEvent(t){!VC(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,e){let n=this.handlers[t];if(n){for(let s of n.observers)s(this.view,e);for(let s of n.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=AC(t),n=this.handlers,s=this.view.contentDOM;for(let a in e)if(a!="scroll"){let o=!e[a].handlers.length,l=n[a];l&&o!=!l.handlers.length&&(s.removeEventListener(a,this.handleEvent),l=null),l||s.addEventListener(a,this.handleEvent,{passive:o})}for(let a in n)a!="scroll"&&!e[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&MC.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Bt.android&&Bt.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return Bt.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=px.find(n=>n.keyCode==t.keyCode))&&!t.ctrlKey||HC.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,sn(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:Bt.safari&&!Bt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function pd(r,t){return(e,n)=>{try{return t.call(r,n,e)}catch(s){O3(e.state,s)}}}function AC(r){let t=Object.create(null);function e(n){return t[n]||(t[n]={observers:[],handlers:[]})}for(let n of r){let s=n.spec,a=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(a)for(let l in a){let u=a[l];u&&e(l).handlers.push(pd(n.value,u))}if(o)for(let l in o){let u=o[l];u&&e(l).observers.push(pd(n.value,u))}}for(let n in r3)e(n).handlers.push(r3[n]);for(let n in G2)e(n).observers.push(G2[n]);return t}const px=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],HC="dthko",MC=[16,17,18,20,91,92,224,225],us=6;function cs(r){return Math.max(0,r)*.7+8}function wC(r,t){return Math.max(Math.abs(r.clientX-t.clientX),Math.abs(r.clientY-t.clientY))}class CC{constructor(t,e,n,s){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=Cw(t.contentDOM),this.atoms=t.state.facet(e0).map(o=>o(t));let a=t.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Oe.allowMultipleSelections)&&DC(t,e),this.dragging=IC(t,e)&&yx(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&wC(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,n=0,s=0,a=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:l}=this.scrollParents.y.getBoundingClientRect());let u=lx(this.view);t.clientX-u.left<=s+us?e=-cs(s-t.clientX):t.clientX+u.right>=o-us&&(e=cs(t.clientX-o)),t.clientY-u.top<=a+us?n=-cs(a-t.clientY):t.clientY+u.bottom>=l-us&&(n=cs(t.clientY-l)),this.setScrollSpeed(e,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:e}=this,n=hx(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!n.eq(e.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function DC(r,t){let e=r.state.facet(KL);return e.length?e[0](t):Bt.mac?t.metaKey:t.ctrlKey}function OC(r,t){let e=r.state.facet(XL);return e.length?e[0](t):Bt.mac?!t.altKey:!t.ctrlKey}function IC(r,t){let{main:e}=r.state.selection;if(e.empty)return!1;let n=mn(r.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let o=s[a];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function VC(r,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,n;e!=r.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(n=d1.get(e))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0}const r3=Object.create(null),G2=Object.create(null),gx=Bt.ie&&Bt.ie_version<15||Bt.ios&&Bt.webkit_version<604;function PC(r){let t=r.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{r.focus(),e.remove(),mx(r,e.value)},50)}function e7(r,t,e){for(let n of r.facet(t))e=n(e,r);return e}function mx(r,t){t=e7(r.state,iT,t);let{state:e}=r,n,s=1,a=e.toText(t),o=a.lines==e.selection.ranges.length;if(vc!=null&&e.selection.ranges.every(u=>u.empty)&&vc==a.toString()){let u=-1;n=e.changeByRange(h=>{let T=e.doc.lineAt(h.from);if(T.from==u)return{range:h};u=T.from;let f=e.toText((o?a.line(s++).text:t)+e.lineBreak);return{changes:{from:T.from,insert:f},range:Rt.cursor(h.from+f.length)}})}else o?n=e.changeByRange(u=>{let h=a.line(s++);return{changes:{from:u.from,to:u.to,insert:h.text},range:Rt.cursor(u.from+h.length)}}):n=e.replaceSelection(a);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}G2.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft};r3.keydown=(r,t)=>(r.inputState.setSelectionOrigin("select"),t.keyCode==27&&r.inputState.tabFocusMode!=0&&(r.inputState.tabFocusMode=Date.now()+2e3),!1);G2.touchstart=(r,t)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")};G2.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")};r3.mousedown=(r,t)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let n of r.state.facet($L))if(e=n(r,t),e)break;if(!e&&t.button==0&&(e=RC(r,t)),e){let n=!r.hasFocus;r.inputState.startMouseSelection(new CC(r,t,e,n)),n&&r.observer.ignore(()=>{FL(r.contentDOM);let a=r.root.activeElement;a&&!a.contains(r.contentDOM)&&a.blur()});let s=r.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else r.inputState.setSelectionOrigin("select.pointer");return!1};function gd(r,t,e,n){if(n==1)return Rt.cursor(t,e);if(n==2)return fC(r.state,t,e);{let s=r.docView.lineAt(t,e),a=r.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:a.from,l=s?s.posAtEnd:a.to;return l<r.state.doc.length&&l==a.to&&l++,Rt.range(o,l)}}const kC=Bt.ie&&Bt.ie_version<=11;let md=null,yd=0,vd=0;function yx(r){if(!kC)return r.detail;let t=md,e=vd;return md=r,vd=Date.now(),yd=!t||e>Date.now()-400&&Math.abs(t.clientX-r.clientX)<2&&Math.abs(t.clientY-r.clientY)<2?(yd+1)%3:1}function RC(r,t){let e=r.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),n=yx(t),s=r.state.selection;return{update(a){a.docChanged&&(e.pos=a.changes.mapPos(e.pos),s=s.map(a.changes))},get(a,o,l){let u=r.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),h,T=gd(r,u.pos,u.assoc,n);if(e.pos!=u.pos&&!o){let f=gd(r,e.pos,e.assoc,n),d=Math.min(f.from,T.from),p=Math.max(f.to,T.to);T=d<T.from?Rt.range(d,p):Rt.range(p,d)}return o?s.replaceRange(s.main.extend(T.from,T.to)):l&&n==1&&s.ranges.length>1&&(h=BC(s,u.pos))?h:l?s.addRange(T):Rt.create([T])}}}function BC(r,t){for(let e=0;e<r.ranges.length;e++){let{from:n,to:s}=r.ranges[e];if(n<=t&&s>=t)return Rt.create(r.ranges.slice(0,e).concat(r.ranges.slice(e+1)),r.mainIndex==e?0:r.mainIndex-(r.mainIndex>e?1:0))}return null}r3.dragstart=(r,t)=>{let{selection:{main:e}}=r.state;if(t.target.draggable){let s=r.docView.tile.nearest(t.target);if(s&&s.isWidget()){let a=s.posAtStart,o=a+s.length;(a>=e.to||o<=e.from)&&(e=Rt.range(a,o))}}let{inputState:n}=r;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",e7(r.state,rT,r.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};r3.dragend=r=>(r.inputState.draggedContent=null,!1);function Ld(r,t,e,n){if(e=e7(r.state,iT,e),!e)return;let s=r.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=r.inputState,o=n&&a&&OC(r,t)?{from:a.from,to:a.to}:null,l={from:s,insert:e},u=r.state.changes(o?[o,l]:l);r.focus(),r.dispatch({changes:u,selection:{anchor:u.mapPos(s,-1),head:u.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}r3.drop=(r,t)=>{if(!t.dataTransfer)return!1;if(r.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let n=Array(e.length),s=0,a=()=>{++s==e.length&&Ld(r,t,n.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=a,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),a()},l.readAsText(e[o])}return!0}else{let n=t.dataTransfer.getData("Text");if(n)return Ld(r,t,n,!0),!0}return!1};r3.paste=(r,t)=>{if(r.state.readOnly)return!0;r.observer.flush();let e=gx?null:t.clipboardData;return e?(mx(r,e.getData("text/plain")||e.getData("text/uri-list")),!0):(PC(r),!1)};function FC(r,t){let e=r.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function NC(r){let t=[],e=[],n=!1;for(let s of r.selection.ranges)s.empty||(t.push(r.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:a}of r.selection.ranges){let o=r.doc.lineAt(a);o.number>s&&(t.push(o.text),e.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),s=o.number}n=!0}return{text:e7(r,rT,t.join(r.lineBreak)),ranges:e,linewise:n}}let vc=null;r3.copy=r3.cut=(r,t)=>{let e=mn(r.root);if(e&&!f5(r.contentDOM,e))return!1;let{text:n,ranges:s,linewise:a}=NC(r.state);if(!n&&!a)return!1;vc=a?n:null,t.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let o=gx?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(FC(r,n),!1)};const vx=Gn.define();function Lx(r,t){let e=[];for(let n of r.facet(tx)){let s=n(r,t);s&&e.push(s)}return e.length?r.update({effects:e,annotations:vx.of(!0)}):null}function xx(r){setTimeout(()=>{let t=r.hasFocus;if(t!=r.inputState.notifiedFocused){let e=Lx(r.state,t);e?r.dispatch(e):r.update([])}},10)}G2.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),xx(r)};G2.blur=r=>{r.observer.clearSelectionRange(),xx(r)};G2.compositionstart=G2.compositionupdate=r=>{r.observer.editContext||(r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0))};G2.compositionend=r=>{r.observer.editContext||(r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,Bt.chrome&&Bt.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50))};G2.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()};r3.beforeinput=(r,t)=>{var e,n;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(r.inputState.insertingText=t.data,r.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&r.observer.editContext){let a=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(a&&o.length){let l=o[0],u=r.posAtDOM(l.startContainer,l.startOffset),h=r.posAtDOM(l.endContainer,l.endOffset);return aT(r,{from:u,to:h,insert:r.state.toText(a)},null),!0}}let s;if(Bt.chrome&&Bt.android&&(s=px.find(a=>a.inputType==t.inputType))&&(r.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return Bt.ios&&t.inputType=="deleteContentForward"&&r.observer.flushSoon(),Bt.safari&&t.inputType=="insertText"&&r.inputState.composing>=0&&setTimeout(()=>G2.compositionend(r,t),20),!1};const xd=new Set;function UC(r){xd.has(r)||(xd.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const _d=["pre-wrap","normal","pre-line","break-spaces"];let xn=!1;function bd(){xn=!1}class jC{constructor(t){this.lineWrapping=t,this.doc=Ie.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return _d.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n<t.length;n++){let s=t[n];s<0?n++:this.heightSamples[Math.floor(s*10)]||(e=!0,this.heightSamples[Math.floor(s*10)]=!0)}return e}refresh(t,e,n,s,a,o){let l=_d.indexOf(t)>-1,u=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=n,this.textHeight=s,this.lineLength=a,u){this.heightSamples={};for(let h=0;h<o.length;h++){let T=o[h];T<0?h++:this.heightSamples[Math.floor(T*10)]=!0}}return u}}class GC{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class J2{constructor(t,e,n,s,a){this.from=t,this.length=e,this.top=n,this.height=s,this._content=a}get type(){return typeof this._content=="number"?U2.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof t4?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new J2(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var Ge=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(Ge||(Ge={}));const da=.001;class a2{constructor(t,e,n=2){this.length=t,this.height=e,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>da&&(xn=!0),this.height=t)}replace(t,e,n){return a2.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,s){let a=this,o=n.doc;for(let l=s.length-1;l>=0;l--){let{fromA:u,toA:h,fromB:T,toB:f}=s[l],d=a.lineAt(u,Ge.ByPosNoHeight,n.setDoc(e),0,0),p=d.to>=h?d:a.lineAt(h,Ge.ByPosNoHeight,n,0,0);for(f+=p.to-h,h=p.to;l>0&&d.from<=s[l-1].toA;)u=s[l-1].fromA,T=s[l-1].fromB,l--,u<d.from&&(d=a.lineAt(u,Ge.ByPosNoHeight,n,0,0));T+=d.from-u,u=d.from;let m=oT.build(n.setDoc(o),t,T,f);a=ja(a,a.replace(u,h,m))}return a.updateHeight(n,0)}static empty(){return new _2(0,0,0)}static of(t){if(t.length==1)return t[0];let e=0,n=t.length,s=0,a=0;for(;;)if(e==n)if(s>a*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),n+=1+l.break,s-=l.size}else if(a>s*2){let l=t[n];l.break?t.splice(n,1,l.left,null,l.right):t.splice(n,1,l.left,l.right),n+=2+l.break,a-=l.size}else break;else if(s<a){let l=t[e++];l&&(s+=l.size)}else{let l=t[--n];l&&(a+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,n++),new WC(a2.of(t.slice(0,e)),o,a2.of(t.slice(n)))}}function ja(r,t){return r==t?r:(r.constructor!=t.constructor&&(xn=!0),t)}a2.prototype.size=1;const zC=J1.replace({});class _x extends a2{constructor(t,e,n){super(t,e),this.deco=n,this.spaceAbove=0}mainBlock(t,e){return new J2(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,n,s){return this.spaceAbove&&t<n+this.spaceAbove?new J2(s,0,n,this.spaceAbove,zC):this.mainBlock(n,s)}lineAt(t,e,n,s,a){let o=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,n,s,a).join(o):o}forEachLine(t,e,n,s,a,o){t<=a+this.length&&e>=a&&o(this.lineAt(0,Ge.ByPos,n,s,a))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,n=!1,s){return s&&s.from<=e&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class _2 extends _x{constructor(t,e,n){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(t,e){return new J2(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,n){let s=n[0];return n.length==1&&(s instanceof _2||s instanceof B1&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof B1?s=new _2(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):a2.of(n)}updateHeight(t,e=0,n=!1,s){return s&&s.from<=e&&s.more?this.setMeasuredHeight(s):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class B1 extends a2{constructor(t){super(t,0)}heightMetrics(t,e){let n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,a=s-n+1,o,l=0;if(t.lineWrapping){let u=Math.min(this.height,t.lineHeight*a);o=u/a,this.length>a+1&&(l=(this.height-u)/(this.length-a-1))}else o=this.height/a;return{firstLine:n,lastLine:s,perLine:o,perChar:l}}blockAt(t,e,n,s){let{firstLine:a,lastLine:o,perLine:l,perChar:u}=this.heightMetrics(e,s);if(e.lineWrapping){let h=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length)),T=e.doc.lineAt(h),f=l+T.length*u,d=Math.max(n,t-f/2);return new J2(T.from,T.length,d,f,0)}else{let h=Math.max(0,Math.min(o-a,Math.floor((t-n)/l))),{from:T,length:f}=e.doc.line(a+h);return new J2(T,f,n+l*h,l,0)}}lineAt(t,e,n,s,a){if(e==Ge.ByHeight)return this.blockAt(t,n,s,a);if(e==Ge.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(t);return new J2(p,m-p,0,0,0)}let{firstLine:o,perLine:l,perChar:u}=this.heightMetrics(n,a),h=n.doc.lineAt(t),T=l+h.length*u,f=h.number-o,d=s+l*f+u*(h.from-a-f);return new J2(h.from,h.length,Math.max(s,Math.min(d,s+this.height-T)),T,0)}forEachLine(t,e,n,s,a,o){t=Math.max(t,a),e=Math.min(e,a+this.length);let{firstLine:l,perLine:u,perChar:h}=this.heightMetrics(n,a);for(let T=t,f=s;T<=e;){let d=n.doc.lineAt(T);if(T==t){let m=d.number-l;f+=u*m+h*(t-a-m)}let p=u+h*d.length;o(new J2(d.from,d.length,f,p,0)),f+=p,T=d.to+1}}replace(t,e,n){let s=this.length-e;if(s>0){let a=n[n.length-1];a instanceof B1?n[n.length-1]=new B1(a.length+s):n.push(null,new B1(s-1))}if(t>0){let a=n[0];a instanceof B1?n[0]=new B1(t+a.length):n.unshift(new B1(t-1),null)}return a2.of(n)}decomposeLeft(t,e){e.push(new B1(t-1),null)}decomposeRight(t,e){e.push(null,new B1(this.length-t-1))}updateHeight(t,e=0,n=!1,s){let a=e+this.length;if(s&&s.from<=e+this.length&&s.more){let o=[],l=Math.max(e,s.from),u=-1;for(s.from>e&&o.push(new B1(s.from-e-1).updateHeight(t,e));l<=a&&s.more;){let T=t.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],d=0;f<0&&(d=-f,f=s.heights[s.index++]),u==-1?u=f:Math.abs(f-u)>=da&&(u=-2);let p=new _2(T,f,d);p.outdated=!1,o.push(p),l+=T+1}l<=a&&o.push(null,new B1(a-l).updateHeight(t,l));let h=a2.of(o);return(u<0||Math.abs(h.height-this.height)>=da||Math.abs(u-this.heightMetrics(t,e).perLine)>=da)&&(xn=!0),ja(this,h)}else(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class WC extends a2{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return this.flags&1}blockAt(t,e,n,s){let a=n+this.left.height;return t<a?this.left.blockAt(t,e,n,s):this.right.blockAt(t,e,a,s+this.left.length+this.break)}lineAt(t,e,n,s,a){let o=s+this.left.height,l=a+this.left.length+this.break,u=e==Ge.ByHeight?t<o:t<l,h=u?this.left.lineAt(t,e,n,s,a):this.right.lineAt(t,e,n,o,l);if(this.break||(u?h.to<l:h.from>l))return h;let T=e==Ge.ByPosNoHeight?Ge.ByPosNoHeight:Ge.ByPos;return u?h.join(this.right.lineAt(l,T,n,o,l)):this.left.lineAt(l,T,n,s,a).join(h)}forEachLine(t,e,n,s,a,o){let l=s+this.left.height,u=a+this.left.length+this.break;if(this.break)t<u&&this.left.forEachLine(t,e,n,s,a,o),e>=u&&this.right.forEachLine(t,e,n,l,u,o);else{let h=this.lineAt(u,Ge.ByPos,n,s,a);t<h.from&&this.left.forEachLine(t,h.from-1,n,s,a,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,n,l,u,o)}}replace(t,e,n){let s=this.left.length+this.break;if(e<s)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,n));let a=[];t>0&&this.decomposeLeft(t,a);let o=a.length;for(let l of n)a.push(l);if(t>0&&Sd(a,o-1),e<this.length){let l=a.length;this.decomposeRight(e,a),Sd(a,l)}return a2.of(a)}decomposeLeft(t,e){let n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(n++,t>=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,s=n+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?a2.of(this.break?[t,null,e]:[t,e]):(this.left=ja(this.left,t),this.right=ja(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,n=!1,s){let{left:a,right:o}=this,l=e+a.length+this.break,u=null;return s&&s.from<=e+a.length&&s.more?u=a=a.updateHeight(t,e,n,s):a.updateHeight(t,e,n),s&&s.from<=l+o.length&&s.more?u=o=o.updateHeight(t,l,n,s):o.updateHeight(t,l,n),u?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Sd(r,t){let e,n;r[t]==null&&(e=r[t-1])instanceof B1&&(n=r[t+1])instanceof B1&&r.splice(t-1,3,new B1(e.length+1+n.length))}const qC=5;class oT{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let n=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof _2?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new _2(n-this.pos,-1,0)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t<e||n.heightRelevant){let s=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=e-t;n.block?this.addBlock(new _x(o,s,n)):(o||a||s>=qC)&&this.addLineDeco(s,a,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new _2(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let n=new B1(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof _2)return t;let e=new _2(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof _2)&&!this.isCovered?this.nodes.push(new _2(0,-1,0)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=t;for(let s of this.nodes)s instanceof _2&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(t,e,n,s){let a=new oT(n,t);return Me.spans(e,n,s,a,0),a.finish(n)}}function ZC(r,t,e){let n=new KC;return Me.compare(r,t,e,n,0),n.changes}class KC{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,n,s){(t<e||n&&n.heightRelevant||s&&s.heightRelevant)&&nn(t,e,this.changes,5)}}function XC(r,t){let e=r.getBoundingClientRect(),n=r.ownerDocument,s=n.defaultView||window,a=Math.max(0,e.left),o=Math.min(s.innerWidth,e.right),l=Math.max(0,e.top),u=Math.min(s.innerHeight,e.bottom);for(let h=r.parentNode;h&&h!=n.body;)if(h.nodeType==1){let T=h,f=window.getComputedStyle(T);if((T.scrollHeight>T.clientHeight||T.scrollWidth>T.clientWidth)&&f.overflow!="visible"){let d=T.getBoundingClientRect();a=Math.max(a,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),u=Math.min(h==r.parentNode?s.innerHeight:u,d.bottom)}h=f.position=="absolute"||f.position=="fixed"?T.offsetParent:T.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:a-e.left,right:Math.max(a,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,u)-(e.top+t)}}function $C(r){let t=r.getBoundingClientRect(),e=r.ownerDocument.defaultView||window;return t.left<e.innerWidth&&t.right>0&&t.top<e.innerHeight&&t.bottom>0}function YC(r,t){let e=r.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class a9{constructor(t,e,n,s){this.from=t,this.to=e,this.size=n,this.displaySize=s}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let s=t[n],a=e[n];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(t,e){return J1.replace({widget:new JC(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class JC extends $o{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class Ed{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ad,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=b1.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(nT).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new jC(e),this.stateDeco=Hd(t),this.heightMap=a2.empty().applyChanges(this.stateDeco,Ie.empty,this.heightOracle.setDoc(t.doc),[new B2(0,0,0,t.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=J1.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let s=n?e.head:e.anchor;if(!t.some(({from:a,to:o})=>s>=a&&s<=o)){let{from:a,to:o}=this.lineBlockAt(s);t.push(new hs(a,o))}}return this.viewports=t.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ad:new lT(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(n5(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=Hd(this.state);let s=t.changedRanges,a=B2.extendWithRanges(s,ZC(n,this.stateDeco,t?t.changes:D1.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);bd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||xn)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=a.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<u.from||e.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,e));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,t.flags|=this.updateForViewport(),(h||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Gw)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),s=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?b1.RTL:b1.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent,l=e.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,T=0;if(l.width&&l.height){let{scaleX:L,scaleY:x}=BL(e,l);(L>.005&&Math.abs(this.scaleX-L)>.005||x>.005&&Math.abs(this.scaleY-x)>.005)&&(this.scaleX=L,this.scaleY=x,h|=16,o=u=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let p=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=NL(t.scrollDOM);let m=(this.printing?YC:XC)(e,this.paddingTop),y=m.top-this.pixelViewport.top,c=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let Q=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(Q!=this.inView&&(this.inView=Q,Q&&(u=!0)),!this.inView&&!this.scrollTarget&&!$C(t.dom))return 0;let g=l.width;if((this.contentDOMWidth!=g||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),u){let L=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(L)&&(o=!0),o||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:x,charWidth:b,textHeight:S}=t.docView.measureTextSize();o=x>0&&s.refresh(a,x,b,S,Math.max(5,g/b),L),o&&(t.docView.minWidth=0,h|=16)}y>0&&c>0?T=Math.max(y,c):y<0&&c<0&&(T=Math.min(y,c)),bd();for(let x of this.viewports){let b=x.from==this.viewport.from?L:t.docView.measureVisibleLineHeights(x);this.heightMap=(o?a2.empty().applyChanges(this.stateDeco,Ie.empty,this.heightOracle,[new B2(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new GC(x.from,b))}xn&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,T)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(T,this.scrollTarget),h|=this.updateForViewport()),(h&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,u=new hs(s.lineAt(o-n*1e3,Ge.ByHeight,a,0,0).from,s.lineAt(l+(1-n)*1e3,Ge.ByHeight,a,0,0).to);if(e){let{head:h}=e.range;if(h<u.from||h>u.to){let T=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,Ge.ByPos,a,0,0),d;e.y=="center"?d=(f.top+f.bottom)/2-T/2:e.y=="start"||e.y=="nearest"&&h<u.from?d=f.top:d=f.bottom-T,u=new hs(s.lineAt(d-1e3/2,Ge.ByHeight,a,0,0).from,s.lineAt(d+T+1e3/2,Ge.ByHeight,a,0,0).to)}}return u}mapViewport(t,e){let n=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new hs(this.heightMap.lineAt(n,Ge.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ge.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},n=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,Ge.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(e,Ge.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||s<=o-Math.max(10,Math.min(-n,250)))&&(e==this.state.doc.length||a>=l+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&a<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let n=[];for(let s of t)e.touchesRange(s.from,s.to)||n.push(new a9(e.mapPos(s.from),e.mapPos(s.to),s.size,s.displaySize));return n}ensureLineGaps(t,e){let n=this.heightOracle.lineWrapping,s=n?1e4:2e3,a=s>>1,o=s<<1;if(this.defaultTextDirection!=b1.LTR&&!n)return[];let l=[],u=(T,f,d,p)=>{if(f-T<a)return;let m=this.state.selection.main,y=[m.from];m.empty||y.push(m.to);for(let Q of y)if(Q>T&&Q<f){u(T,Q-10,d,p),u(Q+10,f,d,p);return}let c=eD(t,Q=>Q.from>=d.from&&Q.to<=d.to&&Math.abs(Q.from-T)<a&&Math.abs(Q.to-f)<a&&!y.some(g=>Q.from<g&&Q.to>g));if(!c){if(f<d.to&&e&&n&&e.visibleRanges.some(v=>v.from<=f&&v.to>=f)){let v=e.moveToLineBoundary(Rt.cursor(f),!1,!0).head;v>T&&(f=v)}let Q=this.gapSize(d,T,f,p),g=n||Q<2e6?Q:2e6;c=new a9(T,f,Q,g)}l.push(c)},h=T=>{if(T.length<o||T.type!=U2.Text)return;let f=tD(T.from,T.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(n){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,c,Q;if(d!=null){let g=fs(f,d),v=((this.visibleBottom-this.visibleTop)/2+y)/T.height;c=g-v,Q=g+v}else c=(this.visibleTop-T.top-y)/T.height,Q=(this.visibleBottom-T.top+y)/T.height;p=Ts(f,c),m=Ts(f,Q)}else{let y=f.total*this.heightOracle.charWidth,c=s*this.heightOracle.charWidth,Q=0;if(y>2e6)for(let b of t)b.from>=T.from&&b.from<T.to&&b.size!=b.displaySize&&b.from*this.heightOracle.charWidth+Q<this.pixelViewport.left&&(Q=b.size-b.displaySize);let g=this.pixelViewport.left+Q,v=this.pixelViewport.right+Q,L,x;if(d!=null){let b=fs(f,d),S=((v-g)/2+c)/y;L=b-S,x=b+S}else L=(g-c)/y,x=(v+c)/y;p=Ts(f,L),m=Ts(f,x)}p>T.from&&u(T.from,p,T,f),m<T.to&&u(m,T.to,T,f)};for(let T of this.viewportLines)Array.isArray(T.type)?T.type.forEach(h):h(T);return l}gapSize(t,e,n,s){let a=fs(s,n)-fs(s,e);return this.heightOracle.lineWrapping?t.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(t){a9.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=J1.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Me.spans(e,this.viewport.from,this.viewport.to,{span(a,o){n.push({from:a,to:o})},point(){}},20);let s=0;if(n.length!=this.visibleRanges.length)s=12;else for(let a=0;a<n.length&&!(s&8);a++){let o=this.visibleRanges[a],l=n[a];(o.from!=l.from||o.to!=l.to)&&(s|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=n,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||n5(this.heightMap.lineAt(t,Ge.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||n5(this.heightMap.lineAt(this.scaler.fromDOM(t),Ge.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return n5(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class hs{constructor(t,e){this.from=t,this.to=e}}function tD(r,t,e){let n=[],s=r,a=0;return Me.spans(e,r,t,{span(){},point(o,l){o>s&&(n.push({from:s,to:o}),a+=o-s),s=l}},20),s<t&&(n.push({from:s,to:t}),a+=t-s),{total:a,ranges:n}}function Ts({total:r,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let n=Math.floor(r*e);for(let s=0;;s++){let{from:a,to:o}=t[s],l=o-a;if(n<=l)return a+n;n-=l}}function fs(r,t){let e=0;for(let{from:n,to:s}of r.ranges){if(t<=s){e+=t-n;break}e+=s-n}return e/r.total}function eD(r,t){for(let e of r)if(t(e))return e}const Ad={toDOM(r){return r},fromDOM(r){return r},scale:1,eq(r){return r==this}};function Hd(r){let t=r.facet(Yo).filter(n=>typeof n!="function"),e=r.facet(sT).filter(n=>typeof n!="function");return e.length&&t.push(Me.join(e)),t}class lT{constructor(t,e,n){let s=0,a=0,o=0;this.viewports=n.map(({from:l,to:u})=>{let h=e.lineAt(l,Ge.ByPos,t,0,0).top,T=e.lineAt(u,Ge.ByPos,t,0,0).bottom;return s+=T-h,{from:l,to:u,top:h,bottom:T,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=o+(l.top-a)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),a=l.bottom}toDOM(t){for(let e=0,n=0,s=0;;e++){let a=e<this.viewports.length?this.viewports[e]:null;if(!a||t<a.top)return s+(t-n)*this.scale;if(t<=a.bottom)return a.domTop+(t-a.top);n=a.bottom,s=a.domBottom}}fromDOM(t){for(let e=0,n=0,s=0;;e++){let a=e<this.viewports.length?this.viewports[e]:null;if(!a||t<a.domTop)return n+(t-s)/this.scale;if(t<=a.domBottom)return a.top+(t-a.domTop);n=a.bottom,s=a.domBottom}}eq(t){return t instanceof lT?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to):!1}}function n5(r,t){if(t.scale==1)return r;let e=t.toDOM(r.top),n=t.toDOM(r.bottom);return new J2(r.from,r.length,e,n-e,Array.isArray(r._content)?r._content.map(s=>n5(s,t)):r._content)}const Qs=ne.define({combine:r=>r.join(" ")}),Lc=ne.define({combine:r=>r.indexOf(!0)>-1}),xc=hr.newName(),bx=hr.newName(),Sx=hr.newName(),Ex={"&light":"."+bx,"&dark":"."+Sx};function _c(r,t,e){return new hr(t,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return r;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):r+" "+n}})}const iD=_c("."+xc,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ex),rD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},o9=Bt.ie&&Bt.ie_version<=11;class nD{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Dw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let n of e)this.queue.push(n);(Bt.ie&&Bt.ie_version<=11||Bt.ios&&t.composing)&&e.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Bt.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Bt.chrome&&Bt.chrome_version<126)&&(this.editContext=new aD(t),t.state.facet(ci)&&(t.contentDOM.editContext=this.editContext.editContext)),o9&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(ci)?n.root.activeElement!=this.dom:!f5(this.dom,s))return;let a=s.anchorNode&&n.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Bt.ie&&Bt.ie_version<=11||Bt.android&&Bt.chrome)&&!n.state.selection.main.empty&&s.focusNode&&Q5(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=mn(t.root);if(!e)return!1;let n=Bt.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&sD(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let s=f5(this.dom,n);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Iw(this.dom,n)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(n),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let n=this.dom;n;)if(n.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=e)n.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,rD),o9&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),o9&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var n;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&sn(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,s=!1;for(let a of t){let o=this.readMutation(a);o&&(o.typeOver&&(s=!0),e==-1?{from:e,to:n}=o:(e=Math.min(o.from,e),n=Math.max(o.to,n)))}return{from:e,to:n,typeOver:s}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),s=this.selectionChanged&&f5(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new xC(this.view,t,e,n);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,s=Qx(this.view,e);return this.view.state==n&&(e.domChanged||e.newSel&&!Ua(this.view.state.selection,e.newSel.main))&&this.view.update([]),s}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty(t.type=="attributes"),t.type=="childList"){let n=Md(e,t.previousSibling||t.target.previousSibling,-1),s=Md(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(ci)!=t.state.facet(ci)&&(t.view.contentDOM.editContext=t.state.facet(ci)?this.editContext.editContext:null))}destroy(){var t,e,n;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Md(r,t,e){for(;t;){let n=d1.get(t);if(n&&n.parent==r)return n;let s=t.parentNode;t=s!=r.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function wd(r,t){let e=t.startContainer,n=t.startOffset,s=t.endContainer,a=t.endOffset,o=r.docView.domAtPos(r.state.selection.main.anchor,1);return Q5(o.node,o.offset,s,a)&&([e,n,s,a]=[s,a,e,n]),{anchorNode:e,anchorOffset:n,focusNode:s,focusOffset:a}}function sD(r,t){if(t.getComposedRanges){let s=t.getComposedRanges(r.root)[0];if(s)return wd(r,s)}let e=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),e=s.getTargetRanges()[0]}return r.contentDOM.addEventListener("beforeinput",n,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",n,!0),e?wd(r,e):null}class aD{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=n=>{let s=t.state.selection.main,{anchor:a,head:o}=s,l=this.toEditorPos(n.updateRangeStart),u=this.toEditorPos(n.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:l,drifted:!1});let h=u-l>n.text.length;l==this.from&&a<this.from?l=a:u==this.to&&a>this.to&&(u=a);let T=dx(t.state.sliceDoc(l,u),n.text,(h?s.from:s.to)-l,h?"end":null);if(!T){let d=Rt.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Ua(d,s)||t.dispatch({selection:d,userEvent:"select"});return}let f={from:T.from+l,to:T.toA+l,insert:Ie.of(n.text.slice(T.from,T.toB).split(`
113
- `))};if((Bt.mac||Bt.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:u,insert:Ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);aT(t,f,Rt.single(this.toEditorPos(n.selectionStart,d),this.toEditorPos(n.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from<f.to&&!f.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(e.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let s=[],a=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let u=t.coordsForChar(o);a=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||a||new DOMRect,s.push(a)}e.updateCharacterBounds(n.rangeStart,s)},this.handlers.textformatupdate=n=>{let s=[];for(let a of n.getTextFormats()){let o=a.underlineStyle,l=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let u=this.toEditorPos(a.rangeStart),h=this.toEditorPos(a.rangeEnd);if(u<h){let T=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(J1.mark({attributes:{style:T}}).range(u,h))}}}t.dispatch({effects:rx.of(J1.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(t.state)}};for(let n in this.handlers)e.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=mn(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,n=!1,s=this.pendingContextChange;return t.changes.iterChanges((a,o,l,u,h)=>{if(n)return;let T=h.length-(o-a);if(s&&o>=s.to)if(s.from==a&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,e+=T,this.to+=T;return}else s=null,this.revertPending(t.state);if(a+=e,o+=e,o<=this.from)this.from+=T,this.to+=T;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),h.toString()),this.to+=T}e+=T}),s&&!n&&this.revertPending(t.state),!n}update(t){let e=this.pendingContextChange,n=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(n.from,n.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let n=this.composing;return n&&n.drifted?n.editorBase+(t-n.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class be{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:n}=t;this.dispatchTransactions=t.dispatchTransactions||n&&(s=>s.forEach(a=>n(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||Ow(t.parent)||document,this.viewState=new Ed(t.state||Oe.create(t)),t.scrollTo&&t.scrollTo.is(ls)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(X4).map(s=>new e9(s));for(let s of this.plugins)s.update(this);this.observer=new nD(this),this.inputState=new EC(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Td(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...t){let e=t.length==1&&t[0]instanceof Y1?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,n=!1,s,a=this.state;for(let d of t){if(d.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=d.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,l=0,u=null;t.some(d=>d.annotation(vx))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=Lx(a,o),u||(l=1));let h=this.observer.delayedAndroidKey,T=null;if(h?(this.observer.clearDelayedAndroidKey(),T=this.observer.readChange(),(T&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(T=null)):this.observer.clear(),a.facet(Oe.phrases)!=this.state.facet(Oe.phrases))return this.setState(a);s=Ba.create(this,a,t),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of t){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;f=new an(p.empty?p:Rt.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(ls)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Ga.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(i5)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Qs)!=s.state.facet(Qs)&&(this.viewState.mustMeasureContent=!0),(e||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(gc))try{d(s)}catch(p){O3(this.state,p,"update listener")}(u||T)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),T&&!Qx(this,T)&&h.force&&sn(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Ed(t),this.plugins=t.facet(X4).map(n=>new e9(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Td(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(X4),n=t.state.facet(X4);if(e!=n){let s=[];for(let a of n){let o=e.indexOf(a);if(o<0)s.push(new e9(a));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let a of this.plugins)a.mustUpdate!=t&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);e!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(n){O3(this.state,n,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(NL(n))a=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);a=p.from,o=p.top}this.updateState=1;let u=this.viewState.measure(this);if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];u&4||([this.measureRequests,h]=[h,this.measureRequests]);let T=h.map(p=>{try{return p.read(this)}catch(m){return O3(this.state,m),Cd}}),f=Ba.create(this,this.state,[]),d=!1;f.flags|=u,e?e.flags|=u:e=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let p=0;p<h.length;p++)if(T[p]!=Cd)try{let m=h[p];m.write&&m.write(T[p],this)}catch(m){O3(this.state,m)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o;if(m>1||m<-1){s=s+m,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(gc))l(e)}get themeClasses(){return xc+" "+(this.state.facet(Lc)?Sx:bx)+" "+this.state.facet(Qs)}updateAttrs(){let t=Dd(this,nx,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ci)?"true":"false",class:"cm-content",style:`${Bt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Dd(this,nT,e);let n=this.observer.ignore(()=>{let s=ad(this.contentDOM,this.contentAttrs,e),a=ad(this.dom,this.editorAttrs,t);return s||a});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let s of n.effects)if(s.is(be.announce)){e&&(this.announceDOM.textContent=""),e=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(i5);let t=this.state.facet(be.cspNonce);hr.mount(this.root,this.styleModules.concat(iD).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(n=>n.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return s9(this,t,fd(this,t,e,n))}moveByGroup(t,e){return s9(this,t,fd(this,t,e,n=>gC(this,t.head,n)))}visualLineSide(t,e){let n=this.bidiSpans(t),s=this.textDirectionAt(t.from),a=n[e?n.length-1:0];return Rt.cursor(a.side(e,s)+t.from,a.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,n=!0){return pC(this,t,e,n)}moveVertically(t,e,n){return s9(this,t,mC(this,t,e,n))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let n=yc(this,t,e);return n&&n.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),yc(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(t),a=this.bidiSpans(s),o=a[fi.find(a,t-s.from,-1,e)];return Ra(n,o.dir==b1.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(ex)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>oD)return qL(t.length);let e=this.textDirectionAt(t.from),n;for(let a of this.bidiCache)if(a.from==t.from&&a.dir==e&&(a.fresh||WL(a.isolates,n=ud(this,t))))return a.order;n||(n=ud(this,t));let s=Nw(t.text,e,n);return this.bidiCache.push(new Ga(t.from,t.to,e,n,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Bt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{FL(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return ls.of(new an(typeof t=="number"?Rt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return ls.of(new an(Rt.cursor(n.from),"start","start",n.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return yn.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return yn.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=hr.newName(),s=[Qs.of(n),i5.of(_c(`.${n}`,t))];return e&&e.dark&&s.push(Lc.of(!0)),s}static baseTheme(t){return hw.lowest(i5.of(_c("."+xc,t,Ex)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),s=n&&d1.get(n)||d1.get(t);return((e=s==null?void 0:s.root)===null||e===void 0?void 0:e.view)||null}}be.styleModule=i5;be.inputHandler=JL;be.clipboardInputFilter=iT;be.clipboardOutputFilter=rT;be.scrollHandler=ix;be.focusChangeEffect=tx;be.perLineTextDirection=ex;be.exceptionSink=YL;be.updateListener=gc;be.editable=ci;be.mouseSelectionStyle=$L;be.dragMovesSelection=XL;be.clickAddsSelectionRange=KL;be.decorations=Yo;be.blockWrappers=sx;be.outerDecorations=sT;be.atomicRanges=e0;be.bidiIsolatedRanges=ax;be.scrollMargins=ox;be.darkTheme=Lc;be.cspNonce=ne.define({combine:r=>r.length?r[0]:""});be.contentAttributes=nT;be.editorAttributes=nx;be.lineWrapping=be.contentAttributes.of({class:"cm-lineWrapping"});be.announce=_1.define();const oD=4096,Cd={};class Ga{constructor(t,e,n,s,a,o){this.from=t,this.to=e,this.dir=n,this.isolates=s,this.fresh=a,this.order=o}static update(t,e){if(e.empty&&!t.some(a=>a.fresh))return t;let n=[],s=t.length?t[t.length-1].dir:b1.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==s&&!e.touchesRange(o.from,o.to)&&n.push(new Ga(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Dd(r,t,e){for(let n=r.state.facet(t),s=n.length-1;s>=0;s--){let a=n[s],o=typeof a=="function"?a(r):a;o&&Jh(o,e)}return e}class _n extends Jr{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}_n.prototype.elementClass="";_n.prototype.toDOM=void 0;_n.prototype.mapMode=S2.TrackBefore;_n.prototype.startSide=_n.prototype.endSide=-1;_n.prototype.point=!0;let lD=0;class R2{constructor(t,e,n,s){this.name=t,this.set=e,this.base=n,this.modified=s,this.id=lD++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let n=typeof t=="string"?t:"?";if(t instanceof R2&&(e=t),e!=null&&e.base)throw new Error("Can not derive from a modified tag");let s=new R2(n,[],null,[]);if(s.set.push(s),e)for(let a of e.set)s.set.push(a);return s}static defineModifier(t){let e=new za(t);return n=>n.modified.indexOf(e)>-1?n:za.get(n.base||n,n.modified.concat(e).sort((s,a)=>s.id-a.id))}}let uD=0;class za{constructor(t){this.name=t,this.instances=[],this.id=uD++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(l=>l.base==t&&cD(e,l.modified));if(n)return n;let s=[],a=new R2(t.name,s,t,e);for(let l of e)l.instances.push(a);let o=hD(e);for(let l of t.set)if(!l.modified.length)for(let u of o)s.push(za.get(l,u));return a}}function cD(r,t){return r.length==t.length&&r.every((e,n)=>e==t[n])}function hD(r){let t=[[]];for(let e=0;e<r.length;e++)for(let n=0,s=t.length;n<s;n++)t.push(t[n].concat(r[e]));return t.sort((e,n)=>n.length-e.length)}function TD(r){let t=Object.create(null);for(let e in r){let n=r[e];Array.isArray(n)||(n=[n]);for(let s of e.split(" "))if(s){let a=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+s);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let u=a.length-1,h=a[u];if(!h)throw new RangeError("Invalid path: "+s);let T=new Wa(n,o,u>0?a.slice(0,u):null);t[h]=T.sort(t[h])}}return fD.add(t)}const fD=new qe({combine(r,t){let e,n,s;for(;r||t;){if(!r||t&&r.depth>=t.depth?(s=t,t=t.next):(s=r,r=r.next),e&&e.mode==s.mode&&!s.context&&!e.context)continue;let a=new Wa(s.tags,s.mode,s.context);e?e.next=a:n=a,e=a}return n}});class Wa{constructor(t,e,n,s){this.tags=t,this.mode=e,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}Wa.empty=new Wa([],2,null);function Ax(r,t){let e=Object.create(null);for(let a of r)if(!Array.isArray(a.tag))e[a.tag.id]=a.class;else for(let o of a.tag)e[o.id]=a.class;let{scope:n,all:s=null}=t||{};return{style:a=>{let o=s;for(let l of a)for(let u of l.set){let h=e[u.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}const yt=R2.define,ds=yt(),zi=yt(),Od=yt(zi),Id=yt(zi),Wi=yt(),ps=yt(Wi),l9=yt(Wi),E3=yt(),Sr=yt(E3),y3=yt(),v3=yt(),bc=yt(),Q6=yt(bc),gs=yt(),lt={comment:ds,lineComment:yt(ds),blockComment:yt(ds),docComment:yt(ds),name:zi,variableName:yt(zi),typeName:Od,tagName:yt(Od),propertyName:Id,attributeName:yt(Id),className:yt(zi),labelName:yt(zi),namespace:yt(zi),macroName:yt(zi),literal:Wi,string:ps,docString:yt(ps),character:yt(ps),attributeValue:yt(ps),number:l9,integer:yt(l9),float:yt(l9),bool:yt(Wi),regexp:yt(Wi),escape:yt(Wi),color:yt(Wi),url:yt(Wi),keyword:y3,self:yt(y3),null:yt(y3),atom:yt(y3),unit:yt(y3),modifier:yt(y3),operatorKeyword:yt(y3),controlKeyword:yt(y3),definitionKeyword:yt(y3),moduleKeyword:yt(y3),operator:v3,derefOperator:yt(v3),arithmeticOperator:yt(v3),logicOperator:yt(v3),bitwiseOperator:yt(v3),compareOperator:yt(v3),updateOperator:yt(v3),definitionOperator:yt(v3),typeOperator:yt(v3),controlOperator:yt(v3),punctuation:bc,separator:yt(bc),bracket:Q6,angleBracket:yt(Q6),squareBracket:yt(Q6),paren:yt(Q6),brace:yt(Q6),content:E3,heading:Sr,heading1:yt(Sr),heading2:yt(Sr),heading3:yt(Sr),heading4:yt(Sr),heading5:yt(Sr),heading6:yt(Sr),contentSeparator:yt(E3),list:yt(E3),quote:yt(E3),emphasis:yt(E3),strong:yt(E3),link:yt(E3),monospace:yt(E3),strikethrough:yt(E3),inserted:yt(),deleted:yt(),changed:yt(),invalid:yt(),meta:gs,documentMeta:yt(gs),annotation:yt(gs),processingInstruction:yt(gs),definition:R2.defineModifier("definition"),constant:R2.defineModifier("constant"),function:R2.defineModifier("function"),standard:R2.defineModifier("standard"),local:R2.defineModifier("local"),special:R2.defineModifier("special")};for(let r in lt){let t=lt[r];t instanceof R2&&(t.name=r)}Ax([{tag:lt.link,class:"tok-link"},{tag:lt.heading,class:"tok-heading"},{tag:lt.emphasis,class:"tok-emphasis"},{tag:lt.strong,class:"tok-strong"},{tag:lt.keyword,class:"tok-keyword"},{tag:lt.atom,class:"tok-atom"},{tag:lt.bool,class:"tok-bool"},{tag:lt.url,class:"tok-url"},{tag:lt.labelName,class:"tok-labelName"},{tag:lt.inserted,class:"tok-inserted"},{tag:lt.deleted,class:"tok-deleted"},{tag:lt.literal,class:"tok-literal"},{tag:lt.string,class:"tok-string"},{tag:lt.number,class:"tok-number"},{tag:[lt.regexp,lt.escape,lt.special(lt.string)],class:"tok-string2"},{tag:lt.variableName,class:"tok-variableName"},{tag:lt.local(lt.variableName),class:"tok-variableName tok-local"},{tag:lt.definition(lt.variableName),class:"tok-variableName tok-definition"},{tag:lt.special(lt.variableName),class:"tok-variableName2"},{tag:lt.definition(lt.propertyName),class:"tok-propertyName tok-definition"},{tag:lt.typeName,class:"tok-typeName"},{tag:lt.namespace,class:"tok-namespace"},{tag:lt.className,class:"tok-className"},{tag:lt.macroName,class:"tok-macroName"},{tag:lt.propertyName,class:"tok-propertyName"},{tag:lt.operator,class:"tok-operator"},{tag:lt.comment,class:"tok-comment"},{tag:lt.meta,class:"tok-meta"},{tag:lt.invalid,class:"tok-invalid"},{tag:lt.punctuation,class:"tok-punctuation"}]);var u9;const s5=new qe,QD=new qe;class I3{constructor(t,e,n=[],s=""){this.data=t,this.name=s,Oe.prototype.hasOwnProperty("tree")||Object.defineProperty(Oe.prototype,"tree",{get(){return Sc(this)}}),this.parser=e,this.extension=[Sn.of(this),Oe.languageData.of((a,o,l)=>{let u=Vd(a,o,l),h=u.type.prop(s5);if(!h)return[];let T=a.facet(h),f=u.type.prop(QD);if(f){let d=u.resolve(o-u.from,l);for(let p of f)if(p.test(d,a)){let m=a.facet(p.facet);return p.type=="replace"?m:m.concat(T)}}return T})].concat(n)}isActiveAt(t,e,n=-1){return Vd(t,e,n).type.prop(s5)==this.data}findRegions(t){let e=t.facet(Sn);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],s=(a,o)=>{if(a.prop(s5)==this.data){n.push({from:o,to:o+a.length});return}let l=a.prop(qe.mounted);if(l){if(l.tree.prop(s5)==this.data){if(l.overlay)for(let u of l.overlay)n.push({from:u.from+o,to:u.to+o});else n.push({from:o,to:o+a.length});return}else if(l.overlay){let u=n.length;if(s(l.tree,l.overlay[0].from+o),n.length>u)return}}for(let u=0;u<a.children.length;u++){let h=a.children[u];h instanceof G1&&s(h,a.positions[u]+o)}};return s(Sc(t),0),n}get allowsNesting(){return!0}}I3.setState=_1.define();function Vd(r,t,e){let n=r.facet(Sn),s=Sc(r).topNode;if(!n||n.allowsNesting)for(let a=s;a;a=a.enter(t,e,l1.ExcludeBuffers|l1.EnterBracketed))a.type.isTop&&(s=a);return s}function Sc(r){let t=r.field(I3.state,!1);return t?t.tree:G1.empty}class dD{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let d6=null;class qa{constructor(t,e,n=[],s,a,o,l,u){this.parser=t,this.state=e,this.fragments=n,this.tree=s,this.treeLen=a,this.viewport=o,this.skipped=l,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new qa(t,e,[],G1.empty,0,n,[],null)}startParse(){return this.parser.startParse(new dD(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=G1.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(qr.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(e??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(qr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=d6;d6=this;try{return t()}finally{d6=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Pd(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:s,treeLen:a,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let u=[];if(t.iterChangedRanges((h,T,f,d)=>u.push({fromA:h,toA:T,fromB:f,toB:d})),n=qr.applyChanges(n,u),s=G1.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let T=t.mapPos(h.from,1),f=t.mapPos(h.to,-1);T<f&&l.push({from:T,to:f})}}}return new qa(this.parser,e,n,s,a,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:s,to:a}=this.skipped[n];s<t.to&&a>t.from&&(this.fragments=Pd(this.fragments,s,a),this.skipped.splice(n--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends rw{createParse(e,n,s){let a=s[0].from,o=s[s.length-1].to;return{parsedPos:a,advance(){let u=d6;if(u){for(let h of s)u.tempSkipped.push(h);t&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,t]):t)}return this.parsedPos=o,new G1(j2.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return d6}}function Pd(r,t,e){return qr.applyChanges(r,[{fromA:t,toA:e,fromB:t,toB:e}])}class bn{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new bn(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=qa.create(t.facet(Sn).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new bn(n)}}I3.state=Q4.define({create:bn.init,update(r,t){for(let e of t.effects)if(e.is(I3.setState))return e.value;return t.startState.facet(Sn)!=t.state.facet(Sn)?bn.init(t.state):r.apply(t)}});let Hx=r=>{let t=setTimeout(()=>r(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Hx=r=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(r,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const c9=typeof navigator<"u"&&(!((u9=navigator.scheduling)===null||u9===void 0)&&u9.isInputPending)?()=>navigator.scheduling.isInputPending():null,pD=yn.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(I3.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(I3.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=Hx(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:s}}=this.view,a=n.field(I3.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!c9?Math.max(25,t.timeRemaining()-5):1e9),l=a.context.treeLen<s&&n.doc.length>s+1e3,u=a.context.work(()=>c9&&c9()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-e,(u||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:I3.setState.of(new bn(a.context))})),this.chunkBudget>0&&!(u&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>O3(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Sn=ne.define({combine(r){return r.length?r[0]:null},enables:r=>[I3.state,pD,be.contentAttributes.compute([r],t=>{let e=t.facet(r);return e&&e.name?{"data-language":e.name}:{}})]});class uT{constructor(t,e){this.specs=t;let n;function s(l){let u=hr.newName();return(n||(n=Object.create(null)))["."+u]=l,u}const a=typeof e.all=="string"?e.all:e.all?s(e.all):void 0,o=e.scope;this.scope=o instanceof I3?l=>l.prop(s5)==o.data:o?l=>l==o:void 0,this.style=Ax(t.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:a}).style,this.module=n?new hr(n):null,this.themeType=e.themeType}static define(t,e){return new uT(t,e||{})}}const gD=Object.create(null),kd=[j2.none],Rd=[],Bd=Object.create(null),mD=Object.create(null);for(let[r,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])mD[r]=yD(gD,t);function h9(r,t){Rd.indexOf(r)>-1||(Rd.push(r),console.warn(t))}function yD(r,t){let e=[];for(let l of t.split(" ")){let u=[];for(let h of l.split(".")){let T=r[h]||lt[h];T?typeof T=="function"?u.length?u=u.map(T):h9(h,`Modifier ${h} used at start of tag`):u.length?h9(h,`Tag ${h} used as modifier`):u=Array.isArray(T)?T:[T]:h9(h,`Unknown highlighting tag ${h}`)}for(let h of u)e.push(h)}if(!e.length)return 0;let n=t.replace(/ /g,"_"),s=n+" "+e.map(l=>l.id),a=Bd[s];if(a)return a.id;let o=Bd[s]=j2.define({id:kd.length,name:n,props:[TD({[n]:e})]});return kd.push(o),o.id}b1.RTL,b1.LTR;var _=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vD(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zr={},i7={},ms=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i7,"__esModule",{value:!0});i7.AbstractDOMAdaptor=void 0;var LD=function(){function r(t){t===void 0&&(t=null),this.document=t}return r.prototype.node=function(t,e,n,s){var a,o;e===void 0&&(e={}),n===void 0&&(n=[]);var l=this.create(t,s);this.setAttributes(l,e);try{for(var u=ms(n),h=u.next();!h.done;h=u.next()){var T=h.value;this.append(l,T)}}catch(f){a={error:f}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l},r.prototype.setAttributes=function(t,e){var n,s,a,o,l,u;if(e.style&&typeof e.style!="string")try{for(var h=ms(Object.keys(e.style)),T=h.next();!T.done;T=h.next()){var f=T.value;this.setStyle(t,f.replace(/-([a-z])/g,function(c,Q){return Q.toUpperCase()}),e.style[f])}}catch(c){n={error:c}}finally{try{T&&!T.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}if(e.properties)try{for(var d=ms(Object.keys(e.properties)),p=d.next();!p.done;p=d.next()){var f=p.value;t[f]=e.properties[f]}}catch(c){a={error:c}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(a)throw a.error}}try{for(var m=ms(Object.keys(e)),y=m.next();!y.done;y=m.next()){var f=y.value;(f!=="style"||typeof e.style=="string")&&f!=="properties"&&this.setAttribute(t,f,e[f])}}catch(c){l={error:c}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}},r.prototype.replace=function(t,e){return this.insert(t,e),this.remove(e),e},r.prototype.childNode=function(t,e){return this.childNodes(t)[e]},r.prototype.allClasses=function(t){var e=this.getAttribute(t,"class");return e?e.replace(/ +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]},r}();i7.AbstractDOMAdaptor=LD;var Mx={},H1={};(function(r){var t=_&&_.__values||function(g){var v=typeof Symbol=="function"&&Symbol.iterator,L=v&&g[v],x=0;if(L)return L.call(g);if(g&&typeof g.length=="number")return{next:function(){return g&&x>=g.length&&(g=void 0),{value:g&&g[x++],done:!g}}};throw new TypeError(v?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(g,v){var L=typeof Symbol=="function"&&g[Symbol.iterator];if(!L)return g;var x=L.call(g),b,S=[],E;try{for(;(v===void 0||v-- >0)&&!(b=x.next()).done;)S.push(b.value)}catch(A){E={error:A}}finally{try{b&&!b.done&&(L=x.return)&&L.call(x)}finally{if(E)throw E.error}}return S},n=_&&_.__spreadArray||function(g,v,L){if(L||arguments.length===2)for(var x=0,b=v.length,S;x<b;x++)(S||!(x in v))&&(S||(S=Array.prototype.slice.call(v,0,x)),S[x]=v[x]);return g.concat(S||Array.prototype.slice.call(v))};Object.defineProperty(r,"__esModule",{value:!0}),r.lookup=r.separateOptions=r.selectOptionsFromKeys=r.selectOptions=r.userOptions=r.defaultOptions=r.insert=r.copy=r.keys=r.makeArray=r.expandable=r.Expandable=r.OPTIONS=r.REMOVE=r.APPEND=r.isObject=void 0;var s={}.constructor;function a(g){return typeof g=="object"&&g!==null&&(g.constructor===s||g.constructor===o)}r.isObject=a,r.APPEND="[+]",r.REMOVE="[-]",r.OPTIONS={invalidOption:"warn",optionError:function(g,v){if(r.OPTIONS.invalidOption==="fatal")throw new Error(g);console.warn("MathJax: "+g)}};var o=function(){function g(){}return g}();r.Expandable=o;function l(g){return Object.assign(Object.create(o.prototype),g)}r.expandable=l;function u(g){return Array.isArray(g)?g:[g]}r.makeArray=u;function h(g){return g?Object.keys(g).concat(Object.getOwnPropertySymbols(g)):[]}r.keys=h;function T(g){var v,L,x={};try{for(var b=t(h(g)),S=b.next();!S.done;S=b.next()){var E=S.value,A=Object.getOwnPropertyDescriptor(g,E),M=A.value;Array.isArray(M)?A.value=f([],M,!1):a(M)&&(A.value=T(M)),A.enumerable&&(x[E]=A)}}catch(D){v={error:D}}finally{try{S&&!S.done&&(L=b.return)&&L.call(b)}finally{if(v)throw v.error}}return Object.defineProperties(g.constructor===o?l({}):{},x)}r.copy=T;function f(g,v,L){var x,b;L===void 0&&(L=!0);var S=function(D){if(L&&g[D]===void 0&&g.constructor!==o)return typeof D=="symbol"&&(D=D.toString()),r.OPTIONS.optionError('Invalid option "'.concat(D,'" (no default value).'),D),"continue";var I=v[D],P=g[D];if(a(I)&&P!==null&&(typeof P=="object"||typeof P=="function")){var R=h(I);Array.isArray(P)&&(R.length===1&&(R[0]===r.APPEND||R[0]===r.REMOVE)&&Array.isArray(I[R[0]])||R.length===2&&R.sort().join(",")===r.APPEND+","+r.REMOVE&&Array.isArray(I[r.APPEND])&&Array.isArray(I[r.REMOVE]))?(I[r.REMOVE]&&(P=g[D]=P.filter(function(F){return I[r.REMOVE].indexOf(F)<0})),I[r.APPEND]&&(g[D]=n(n([],e(P),!1),e(I[r.APPEND]),!1))):f(P,I,L)}else Array.isArray(I)?(g[D]=[],f(g[D],I,!1)):a(I)?g[D]=T(I):g[D]=I};try{for(var E=t(h(v)),A=E.next();!A.done;A=E.next()){var M=A.value;S(M)}}catch(D){x={error:D}}finally{try{A&&!A.done&&(b=E.return)&&b.call(E)}finally{if(x)throw x.error}}return g}r.insert=f;function d(g){for(var v=[],L=1;L<arguments.length;L++)v[L-1]=arguments[L];return v.forEach(function(x){return f(g,x,!1)}),g}r.defaultOptions=d;function p(g){for(var v=[],L=1;L<arguments.length;L++)v[L-1]=arguments[L];return v.forEach(function(x){return f(g,x,!0)}),g}r.userOptions=p;function m(g){for(var v,L,x=[],b=1;b<arguments.length;b++)x[b-1]=arguments[b];var S={};try{for(var E=t(x),A=E.next();!A.done;A=E.next()){var M=A.value;g.hasOwnProperty(M)&&(S[M]=g[M])}}catch(D){v={error:D}}finally{try{A&&!A.done&&(L=E.return)&&L.call(E)}finally{if(v)throw v.error}}return S}r.selectOptions=m;function y(g,v){return m.apply(void 0,n([g],e(Object.keys(v)),!1))}r.selectOptionsFromKeys=y;function c(g){for(var v,L,x,b,S=[],E=1;E<arguments.length;E++)S[E-1]=arguments[E];var A=[];try{for(var M=t(S),D=M.next();!D.done;D=M.next()){var I=D.value,P={},R={};try{for(var F=(x=void 0,t(Object.keys(g||{}))),X=F.next();!X.done;X=F.next()){var st=X.value;(I[st]===void 0?R:P)[st]=g[st]}}catch(rt){x={error:rt}}finally{try{X&&!X.done&&(b=F.return)&&b.call(F)}finally{if(x)throw x.error}}A.push(P),g=R}}catch(rt){v={error:rt}}finally{try{D&&!D.done&&(L=M.return)&&L.call(M)}finally{if(v)throw v.error}}return A.unshift(g),A}r.separateOptions=c;function Q(g,v,L){return L===void 0&&(L=null),v.hasOwnProperty(g)?v[g]:L}r.lookup=Q})(H1);(function(r){var t=_&&_.__extends||function(){var a=function(o,l){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,h){u.__proto__=h}||function(u,h){for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(u[T]=h[T])},a(o,l)};return function(o,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");a(o,l);function u(){this.constructor=o}o.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}(),e=_&&_.__assign||function(){return e=Object.assign||function(a){for(var o,l=1,u=arguments.length;l<u;l++){o=arguments[l];for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(a[h]=o[h])}return a},e.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.NodeMixin=r.NodeMixinOptions=void 0;var n=H1;r.NodeMixinOptions={badCSS:!0,badSizes:!0};function s(a,o){var l;return o===void 0&&(o={}),o=(0,n.userOptions)((0,n.defaultOptions)({},r.NodeMixinOptions),o),l=function(u){t(h,u);function h(){for(var T=[],f=0;f<arguments.length;f++)T[f]=arguments[f];var d=u.call(this,T[0])||this,p=d.constructor;return d.options=(0,n.userOptions)((0,n.defaultOptions)({},p.OPTIONS),T[1]),d}return h.prototype.fontSize=function(T){return o.badCSS?this.options.fontSize:u.prototype.fontSize.call(this,T)},h.prototype.fontFamily=function(T){return o.badCSS?this.options.fontFamily:u.prototype.fontFamily.call(this,T)},h.prototype.nodeSize=function(T,f,d){if(f===void 0&&(f=1),d===void 0&&(d=null),!o.badSizes)return u.prototype.nodeSize.call(this,T,f,d);var p=this.textContent(T),m=Array.from(p.replace(h.cjkPattern,"")).length,y=Array.from(p).length-m;return[y*this.options.cjkCharWidth+m*this.options.unknownCharWidth,this.options.unknownCharHeight]},h.prototype.nodeBBox=function(T){return o.badSizes?{left:0,right:0,top:0,bottom:0}:u.prototype.nodeBBox.call(this,T)},h}(a),l.OPTIONS=e(e({},o.badCSS?{fontSize:16,fontFamily:"Times"}:{}),o.badSizes?{cjkCharWidth:1,unknownCharWidth:.6,unknownCharHeight:.8}:{}),l.cjkPattern=new RegExp(["[","ᄀ-ᅟ","〈〉","⺀-〾","぀-㉇","㉐-䶿","一-꓆","ꥠ-ꥼ","가-힣","豈-﫿","︐-︙","︰-﹫","!-⦆¢-₩","𛀀-𛀁","🈀-🉑","𠀀-𿿽","]"].join(""),"gu"),l}r.NodeMixin=s})(Mx);var i0={},d4={},Ec=_&&_.__assign||function(){return Ec=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ec.apply(this,arguments)},xD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},_D=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},bD=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(d4,"__esModule",{value:!0});d4.LiteElement=void 0;var SD=function(){function r(t,e,n){var s,a;e===void 0&&(e={}),n===void 0&&(n=[]),this.kind=t,this.attributes=Ec({},e),this.children=_D([],xD(n),!1);try{for(var o=bD(this.children),l=o.next();!l.done;l=o.next()){var u=l.value;u.parent=this}}catch(h){s={error:h}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(s)throw s.error}}this.styles=null}return r}();d4.LiteElement=SD;Object.defineProperty(i0,"__esModule",{value:!0});i0.LiteDocument=void 0;var T9=d4,ED=function(){function r(){this.root=new T9.LiteElement("html",{},[this.head=new T9.LiteElement("head"),this.body=new T9.LiteElement("body")]),this.type=""}return Object.defineProperty(r.prototype,"kind",{get:function(){return"#document"},enumerable:!1,configurable:!0}),r}();i0.LiteDocument=ED;var r4={},AD=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(r4,"__esModule",{value:!0});r4.LiteComment=r4.LiteText=void 0;var wx=function(){function r(t){t===void 0&&(t=""),this.value=t}return Object.defineProperty(r.prototype,"kind",{get:function(){return"#text"},enumerable:!1,configurable:!0}),r}();r4.LiteText=wx;var HD=function(r){AD(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"#comment"},enumerable:!1,configurable:!0}),t}(wx);r4.LiteComment=HD;var r7={},n7={},MD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},wD=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(n7,"__esModule",{value:!0});n7.LiteList=void 0;var CD=function(){function r(t){this.nodes=[],this.nodes=wD([],MD(t),!1)}return r.prototype.append=function(t){this.nodes.push(t)},r.prototype[Symbol.iterator]=function(){var t=0;return{next:function(){return t===this.nodes.length?{value:null,done:!0}:{value:this.nodes[t++],done:!1}}}},r}();n7.LiteList=CD;var cT={},zn={},fr={};Object.defineProperty(fr,"__esModule",{value:!0});fr.retryAfter=fr.handleRetriesFor=void 0;function DD(r){return new Promise(function t(e,n){try{e(r())}catch(s){s.retry&&s.retry instanceof Promise?s.retry.then(function(){return t(e,n)}).catch(function(a){return n(a)}):s.restart&&s.restart.isCallback?MathJax.Callback.After(function(){return t(e,n)},s.restart):n(s)}})}fr.handleRetriesFor=DD;function OD(r){var t=new Error("MathJax retry");throw t.retry=r,t}fr.retryAfter=OD;var s7={},a7={},o7={};Object.defineProperty(o7,"__esModule",{value:!0});o7.VERSION=void 0;o7.VERSION="3.2.2";var l7={},mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.PrioritizedList=void 0;var ID=function(){function r(){this.items=[],this.items=[]}return r.prototype[Symbol.iterator]=function(){var t=0,e=this.items;return{next:function(){return{value:e[t++],done:t>e.length}}}},r.prototype.add=function(t,e){e===void 0&&(e=r.DEFAULTPRIORITY);var n=this.items.length;do n--;while(n>=0&&e<this.items[n].priority);return this.items.splice(n+1,0,{item:t,priority:e}),t},r.prototype.remove=function(t){var e=this.items.length;do e--;while(e>=0&&this.items[e].item!==t);e>=0&&this.items.splice(e,1)},r.DEFAULTPRIORITY=5,r}();mr.PrioritizedList=ID;var VD=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),PD=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(l7,"__esModule",{value:!0});l7.HandlerList=void 0;var kD=mr,RD=function(r){VD(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.register=function(e){return this.add(e,e.priority)},t.prototype.unregister=function(e){this.remove(e)},t.prototype.handlesDocument=function(e){var n,s;try{for(var a=PD(this),o=a.next();!o.done;o=a.next()){var l=o.value,u=l.item;if(u.handlesDocument(e))return u}}catch(h){n={error:h}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}throw new Error("Can't find handler for document")},t.prototype.document=function(e,n){return n===void 0&&(n=null),this.handlesDocument(e).create(e,n)},t}(kD.PrioritizedList);l7.HandlerList=RD;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.mathjax=void 0;var t=o7,e=l7,n=fr;r.mathjax={version:t.VERSION,handlers:new e.HandlerList,document:function(s,a){return r.mathjax.handlers.document(s,a)},handleRetriesFor:n.handleRetriesFor,retryAfter:n.retryAfter,asyncLoad:null}})(a7);Object.defineProperty(s7,"__esModule",{value:!0});s7.asyncLoad=void 0;var Fd=a7;function BD(r){return Fd.mathjax.asyncLoad?new Promise(function(t,e){var n=Fd.mathjax.asyncLoad(r);n instanceof Promise?n.then(function(s){return t(s)}).catch(function(s){return e(s)}):t(n)}):Promise.reject("Can't load '".concat(r,"': No asyncLoad method specified"))}s7.asyncLoad=BD;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.numeric=r.translate=r.remove=r.add=r.entities=r.options=void 0;var t=fr,e=s7;r.options={loadMissingEntities:!0},r.entities={ApplyFunction:"⁡",Backslash:"∖",Because:"∵",Breve:"˘",Cap:"⋒",CenterDot:"·",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",Congruent:"≡",ContourIntegral:"∮",Coproduct:"∐",Cross:"⨯",Cup:"⋓",CupCap:"≍",Dagger:"‡",Del:"∇",Delta:"Δ",Diamond:"⋄",DifferentialD:"ⅆ",DotEqual:"≐",DoubleDot:"¨",DoubleRightTee:"⊨",DoubleVerticalBar:"∥",DownArrow:"↓",DownLeftVector:"↽",DownRightVector:"⇁",DownTee:"⊤",Downarrow:"⇓",Element:"∈",EqualTilde:"≂",Equilibrium:"⇌",Exists:"∃",ExponentialE:"ⅇ",FilledVerySmallSquare:"▪",ForAll:"∀",Gamma:"Γ",Gg:"⋙",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Hacek:"ˇ",Hat:"^",HumpDownHump:"≎",HumpEqual:"≏",Im:"ℑ",ImaginaryI:"ⅈ",Integral:"∫",Intersection:"⋂",InvisibleComma:"⁣",InvisibleTimes:"⁢",Lambda:"Λ",Larr:"↞",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDownVector:"⇃",LeftFloor:"⌊",LeftRightArrow:"↔",LeftTee:"⊣",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpVector:"↿",LeftVector:"↼",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessSlantEqual:"⩽",LessTilde:"≲",Ll:"⋘",Lleftarrow:"⇚",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lsh:"↰",MinusPlus:"∓",NestedGreaterGreater:"≫",NestedLessLess:"≪",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotPrecedes:"⊀",NotPrecedesSlantEqual:"⋠",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsSlantEqual:"⋡",NotSupersetEqual:"⊉",NotTilde:"≁",NotVerticalBar:"∤",Omega:"Ω",OverBar:"‾",OverBrace:"⏞",PartialD:"∂",Phi:"Φ",Pi:"Π",PlusMinus:"±",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",Product:"∏",Proportional:"∝",Psi:"Ψ",Rarr:"↠",Re:"ℜ",ReverseEquilibrium:"⇋",RightAngleBracket:"⟩",RightArrow:"→",RightArrowLeftArrow:"⇄",RightCeiling:"⌉",RightDownVector:"⇂",RightFloor:"⌋",RightTee:"⊢",RightTeeArrow:"↦",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpVector:"↾",RightVector:"⇀",Rightarrow:"⇒",Rrightarrow:"⇛",Rsh:"↱",Sigma:"Σ",SmallCircle:"∘",Sqrt:"√",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",Star:"⋆",Subset:"⋐",SubsetEqual:"⊆",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",SuchThat:"∋",Sum:"∑",Superset:"⊃",SupersetEqual:"⊇",Supset:"⋑",Therefore:"∴",Theta:"Θ",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",UnderBar:"_",UnderBrace:"⏟",Union:"⋃",UnionPlus:"⊎",UpArrow:"↑",UpDownArrow:"↕",UpTee:"⊥",Uparrow:"⇑",Updownarrow:"⇕",Upsilon:"Υ",Vdash:"⊩",Vee:"⋁",VerticalBar:"∣",VerticalTilde:"≀",Vvdash:"⊪",Wedge:"⋀",Xi:"Ξ",amp:"&",acute:"´",aleph:"ℵ",alpha:"α",amalg:"⨿",and:"∧",ang:"∠",angmsd:"∡",angsph:"∢",ape:"≊",backprime:"‵",backsim:"∽",backsimeq:"⋍",beta:"β",beth:"ℶ",between:"≬",bigcirc:"◯",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",blacklozenge:"⧫",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",bowtie:"⋈",boxdl:"┐",boxdr:"┌",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxur:"└",bsol:"\\",bull:"•",cap:"∩",check:"✓",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledR:"®",circledS:"Ⓢ",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",clubs:"♣",colon:":",comp:"∁",ctdot:"⋯",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cup:"∪",curarr:"↷",curlyvee:"⋎",curlywedge:"⋏",dagger:"†",daleth:"ℸ",ddarr:"⇊",deg:"°",delta:"δ",digamma:"ϝ",div:"÷",divideontimes:"⋇",dot:"˙",doteqdot:"≑",dotplus:"∔",dotsquare:"⊡",dtdot:"⋱",ecir:"≖",efDot:"≒",egs:"⪖",ell:"ℓ",els:"⪕",empty:"∅",epsi:"ε",epsiv:"ϵ",erDot:"≓",eta:"η",eth:"ð",flat:"♭",fork:"⋔",frown:"⌢",gEl:"⪌",gamma:"γ",gap:"⪆",gimel:"ℷ",gnE:"≩",gnap:"⪊",gne:"⪈",gnsim:"⋧",gt:">",gtdot:"⋗",harrw:"↭",hbar:"ℏ",hellip:"…",hookleftarrow:"↩",hookrightarrow:"↪",imath:"ı",infin:"∞",intcal:"⊺",iota:"ι",jmath:"ȷ",kappa:"κ",kappav:"ϰ",lEg:"⪋",lambda:"λ",lap:"⪅",larrlp:"↫",larrtl:"↢",lbrace:"{",lbrack:"[",le:"≤",leftleftarrows:"⇇",leftthreetimes:"⋋",lessdot:"⋖",lmoust:"⎰",lnE:"≨",lnap:"⪉",lne:"⪇",lnsim:"⋦",longmapsto:"⟼",looparrowright:"↬",lowast:"∗",loz:"◊",lt:"<",ltimes:"⋉",ltri:"◃",macr:"¯",malt:"✠",mho:"℧",mu:"μ",multimap:"⊸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",natur:"♮",nearr:"↗",nharr:"↮",nlarr:"↚",not:"¬",nrarr:"↛",nu:"ν",nvDash:"⊭",nvdash:"⊬",nwarr:"↖",omega:"ω",omicron:"ο",or:"∨",osol:"⊘",period:".",phi:"φ",phiv:"ϕ",pi:"π",piv:"ϖ",prap:"⪷",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",prime:"′",psi:"ψ",quot:'"',rarrtl:"↣",rbrace:"}",rbrack:"]",rho:"ρ",rhov:"ϱ",rightrightarrows:"⇉",rightthreetimes:"⋌",ring:"˚",rmoust:"⎱",rtimes:"⋊",rtri:"▹",scap:"⪸",scnE:"⪶",scnap:"⪺",scnsim:"⋩",sdot:"⋅",searr:"↘",sect:"§",sharp:"♯",sigma:"σ",sigmav:"ς",simne:"≆",smile:"⌣",spades:"♠",sub:"⊂",subE:"⫅",subnE:"⫋",subne:"⊊",supE:"⫆",supnE:"⫌",supne:"⊋",swarr:"↙",tau:"τ",theta:"θ",thetav:"ϑ",tilde:"˜",times:"×",triangle:"▵",triangleq:"≜",upsi:"υ",upuparrows:"⇈",veebar:"⊻",vellip:"⋮",weierp:"℘",xi:"ξ",yen:"¥",zeta:"ζ",zigrarr:"⇝",nbsp:" ",rsquo:"’",lsquo:"‘"};var n={};function s(h,T){Object.assign(r.entities,h),n[T]=!0}r.add=s;function a(h){delete r.entities[h]}r.remove=a;function o(h){return h.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/ig,l)}r.translate=o;function l(h,T){if(T.charAt(0)==="#")return u(T.slice(1));if(r.entities[T])return r.entities[T];if(r.options.loadMissingEntities){var f=T.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:T.charAt(0).toLowerCase();n[f]||(n[f]=!0,(0,t.retryAfter)((0,e.asyncLoad)("./util/entities/"+f+".js")))}return h}function u(h){var T=h.charAt(0)==="x"?parseInt(h.slice(1),16):parseInt(h);return String.fromCodePoint(T)}r.numeric=u})(zn);(function(r){var t=_&&_.__createBinding||(Object.create?function(f,d,p,m){m===void 0&&(m=p);var y=Object.getOwnPropertyDescriptor(d,p);(!y||("get"in y?!d.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return d[p]}}),Object.defineProperty(f,m,y)}:function(f,d,p,m){m===void 0&&(m=p),f[m]=d[p]}),e=_&&_.__setModuleDefault||(Object.create?function(f,d){Object.defineProperty(f,"default",{enumerable:!0,value:d})}:function(f,d){f.default=d}),n=_&&_.__importStar||function(f){if(f&&f.__esModule)return f;var d={};if(f!=null)for(var p in f)p!=="default"&&Object.prototype.hasOwnProperty.call(f,p)&&t(d,f,p);return e(d,f),d},s=_&&_.__read||function(f,d){var p=typeof Symbol=="function"&&f[Symbol.iterator];if(!p)return f;var m=p.call(f),y,c=[],Q;try{for(;(d===void 0||d-- >0)&&!(y=m.next()).done;)c.push(y.value)}catch(g){Q={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(Q)throw Q.error}}return c},a=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.LiteParser=r.PATTERNS=void 0;var o=n(zn),l=d4,u=r4,h;(function(f){f.TAGNAME="[a-z][^\\s\\n>]*",f.ATTNAME="[a-z][^\\s\\n>=]*",f.VALUE=`(?:'[^']*'|"[^"]*"|[^\\s\\n]+)`,f.VALUESPLIT=`(?:'([^']*)'|"([^"]*)"|([^\\s\\n]+))`,f.SPACE="(?:\\s|\\n)+",f.OPTIONALSPACE="(?:\\s|\\n)*",f.ATTRIBUTE=f.ATTNAME+"(?:"+f.OPTIONALSPACE+"="+f.OPTIONALSPACE+f.VALUE+")?",f.ATTRIBUTESPLIT="("+f.ATTNAME+")(?:"+f.OPTIONALSPACE+"="+f.OPTIONALSPACE+f.VALUESPLIT+")?",f.TAG="(<(?:"+f.TAGNAME+"(?:"+f.SPACE+f.ATTRIBUTE+")*"+f.OPTIONALSPACE+"/?|/"+f.TAGNAME+"|!--[^]*?--|![^]*?)(?:>|$))",f.tag=new RegExp(f.TAG,"i"),f.attr=new RegExp(f.ATTRIBUTE,"i"),f.attrsplit=new RegExp(f.ATTRIBUTESPLIT,"i")})(h=r.PATTERNS||(r.PATTERNS={}));var T=function(){function f(){}return f.prototype.parseFromString=function(d,p,m){m===void 0&&(m=null);for(var y=m.createDocument(),c=m.body(y),Q=d.replace(/<\?.*?\?>/g,"").split(h.tag);Q.length;){var g=Q.shift(),v=Q.shift();g&&this.addText(m,c,g),v&&v.charAt(v.length-1)===">"&&(v.charAt(1)==="!"?this.addComment(m,c,v):v.charAt(1)==="/"?c=this.closeTag(m,c,v):c=this.openTag(m,c,v,Q))}return this.checkDocument(m,y),y},f.prototype.addText=function(d,p,m){return m=o.translate(m),d.append(p,d.text(m))},f.prototype.addComment=function(d,p,m){return d.append(p,new u.LiteComment(m))},f.prototype.closeTag=function(d,p,m){for(var y=m.slice(2,m.length-1).toLowerCase();d.parent(p)&&d.kind(p)!==y;)p=d.parent(p);return d.parent(p)},f.prototype.openTag=function(d,p,m,y){var c=this.constructor.PCDATA,Q=this.constructor.SELF_CLOSING,g=m.match(/<(.*?)[\s\n>\/]/)[1].toLowerCase(),v=d.node(g),L=m.replace(/^<.*?[\s\n>]/,"").split(h.attrsplit);return(L.pop().match(/>$/)||L.length<5)&&(this.addAttributes(d,v,L),d.append(p,v),!Q[g]&&!m.match(/\/>$/)&&(c[g]?this.handlePCDATA(d,v,g,y):p=v)),p},f.prototype.addAttributes=function(d,p,m){for(var y=this.constructor.CDATA_ATTR;m.length;){var c=s(m.splice(0,5),5),Q=c[1],g=c[2],v=c[3],L=c[4],x=g||v||L||"";y[Q]||(x=o.translate(x)),d.setAttribute(p,Q,x)}},f.prototype.handlePCDATA=function(d,p,m,y){for(var c=[],Q="</"+m+">",g="";y.length&&g!==Q;)c.push(g),c.push(y.shift()),g=y.shift();d.append(p,d.text(c.join("")))},f.prototype.checkDocument=function(d,p){var m,y,c,Q,g=this.getOnlyChild(d,d.body(p));if(g){try{for(var v=a(d.childNodes(d.body(p))),L=v.next();!L.done;L=v.next()){var x=L.value;if(x===g)break;x instanceof u.LiteComment&&x.value.match(/^<!DOCTYPE/)&&(p.type=x.value)}}catch(E){m={error:E}}finally{try{L&&!L.done&&(y=v.return)&&y.call(v)}finally{if(m)throw m.error}}switch(d.kind(g)){case"html":try{for(var b=a(g.children),S=b.next();!S.done;S=b.next()){var x=S.value;switch(d.kind(x)){case"head":p.head=x;break;case"body":p.body=x;break}}}catch(E){c={error:E}}finally{try{S&&!S.done&&(Q=b.return)&&Q.call(b)}finally{if(c)throw c.error}}p.root=g,d.remove(g),d.parent(p.body)!==g&&d.append(g,p.body),d.parent(p.head)!==g&&d.insert(p.head,p.body);break;case"head":p.head=d.replace(g,p.head);break;case"body":p.body=d.replace(g,p.body);break}}},f.prototype.getOnlyChild=function(d,p){var m,y,c=null;try{for(var Q=a(d.childNodes(p)),g=Q.next();!g.done;g=Q.next()){var v=g.value;if(v instanceof l.LiteElement){if(c)return null;c=v}}}catch(L){m={error:L}}finally{try{g&&!g.done&&(y=Q.return)&&y.call(Q)}finally{if(m)throw m.error}}return c},f.prototype.serialize=function(d,p,m){var y=this;m===void 0&&(m=!1);var c=this.constructor.SELF_CLOSING,Q=this.constructor.CDATA_ATTR,g=d.kind(p),v=d.allAttributes(p).map(function(b){return b.name+'="'+(Q[b.name]?b.value:y.protectAttribute(b.value))+'"'}).join(" "),L=this.serializeInner(d,p,m),x="<"+g+(v?" "+v:"")+((!m||L)&&!c[g]?">".concat(L,"</").concat(g,">"):m?"/>":">");return x},f.prototype.serializeInner=function(d,p,m){var y=this;m===void 0&&(m=!1);var c=this.constructor.PCDATA;return c.hasOwnProperty(p.kind)?d.childNodes(p).map(function(Q){return d.value(Q)}).join(""):d.childNodes(p).map(function(Q){var g=d.kind(Q);return g==="#text"?y.protectHTML(d.value(Q)):g==="#comment"?Q.value:y.serialize(d,Q,m)}).join("")},f.prototype.protectAttribute=function(d){return typeof d!="string"&&(d=String(d)),d.replace(/"/g,"&quot;")},f.prototype.protectHTML=function(d){return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},f.SELF_CLOSING={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},f.PCDATA={option:!0,textarea:!0,fieldset:!0,title:!0,style:!0,script:!0},f.CDATA_ATTR={style:!0,datafld:!0,datasrc:!0,href:!0,src:!0,longdesc:!0,usemap:!0,cite:!0,datetime:!0,action:!0,axis:!0,profile:!0,content:!0,scheme:!0},f}();r.LiteParser=T})(cT);Object.defineProperty(r7,"__esModule",{value:!0});r7.LiteWindow=void 0;var FD=d4,Nd=i0,f9=n7,ND=cT,UD=function(){function r(){this.DOMParser=ND.LiteParser,this.NodeList=f9.LiteList,this.HTMLCollection=f9.LiteList,this.HTMLElement=FD.LiteElement,this.DocumentFragment=f9.LiteList,this.Document=Nd.LiteDocument,this.document=new Nd.LiteDocument}return r}();r7.LiteWindow=UD;var Wn={},z2=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},hT=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},jD=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.Styles=void 0;var p6=["top","right","bottom","left"],ys=["width","style","color"];function TT(r){for(var t=r.split(/((?:'[^']*'|"[^"]*"|,[\s\n]|[^\s\n])*)/g),e=[];t.length>1;)t.shift(),e.push(t.shift());return e}function vs(r){var t,e,n=TT(this.styles[r]);n.length===0&&n.push(""),n.length===1&&n.push(n[0]),n.length===2&&n.push(n[0]),n.length===3&&n.push(n[1]);try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value;this.setStyle(this.childName(r,o),n.shift())}}catch(l){t={error:l}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}function GD(r){var t,e,n=yr.connect[r].children,s=[];try{for(var a=z2(n),o=a.next();!o.done;o=a.next()){var l=o.value,u=this.styles[r+"-"+l];if(!u){delete this.styles[r];return}s.push(u)}}catch(h){t={error:h}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}s[3]===s[1]&&(s.pop(),s[2]===s[0]&&(s.pop(),s[1]===s[0]&&s.pop())),this.styles[r]=s.join(" ")}function zD(r){var t,e;try{for(var n=z2(yr.connect[r].children),s=n.next();!s.done;s=n.next()){var a=s.value;this.setStyle(this.childName(r,a),this.styles[r])}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}function WD(r){var t,e,n=jD([],hT(yr.connect[r].children),!1),s=this.styles[this.childName(r,n.shift())];try{for(var a=z2(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(this.styles[this.childName(r,l)]!==s){delete this.styles[r];return}}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}this.styles[r]=s}var Ud={width:/^(?:[\d.]+(?:[a-z]+)|thin|medium|thick|inherit|initial|unset)$/,style:/^(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|unset)$/};function Ls(r){var t,e,n,s,a={width:"",style:"",color:""};try{for(var o=z2(TT(this.styles[r])),l=o.next();!l.done;l=o.next()){var u=l.value;u.match(Ud.width)&&a.width===""?a.width=u:u.match(Ud.style)&&a.style===""?a.style=u:a.color=u}}catch(d){t={error:d}}finally{try{l&&!l.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}try{for(var h=z2(yr.connect[r].children),T=h.next();!T.done;T=h.next()){var f=T.value;this.setStyle(this.childName(r,f),a[f])}}catch(d){n={error:d}}finally{try{T&&!T.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}}function xs(r){var t,e,n=[];try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.styles[this.childName(r,o)];l&&n.push(l)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}n.length?this.styles[r]=n.join(" "):delete this.styles[r]}var jd={style:/^(?:normal|italic|oblique|inherit|initial|unset)$/,variant:new RegExp("^(?:"+["normal|none","inherit|initial|unset","common-ligatures|no-common-ligatures","discretionary-ligatures|no-discretionary-ligatures","historical-ligatures|no-historical-ligatures","contextual|no-contextual","(?:stylistic|character-variant|swash|ornaments|annotation)\\([^)]*\\)","small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","lining-nums|oldstyle-nums|proportional-nums|tabular-nums","diagonal-fractions|stacked-fractions","ordinal|slashed-zero","jis78|jis83|jis90|jis04|simplified|traditional","full-width|proportional-width","ruby"].join("|")+")$"),weight:/^(?:normal|bold|bolder|lighter|[1-9]00|inherit|initial|unset)$/,stretch:new RegExp("^(?:"+["normal","(?:(?:ultra|extra|semi)-)?condensed","(?:(?:semi|extra|ulta)-)?expanded","inherit|initial|unset"].join("|")+")$"),size:new RegExp("^(?:"+["xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller","[d.]+%|[d.]+[a-z]+","inherit|initial|unset"].join("|")+")(?:/(?:normal|[d.+](?:%|[a-z]+)?))?$")};function qD(r){var t,e,n,s,a=TT(this.styles[r]),o={style:"",variant:[],weight:"",stretch:"",size:"",family:"","line-height":""};try{for(var l=z2(a),u=l.next();!u.done;u=l.next()){var h=u.value;o.family=h;try{for(var T=(n=void 0,z2(Object.keys(jd))),f=T.next();!f.done;f=T.next()){var d=f.value;if((Array.isArray(o[d])||o[d]==="")&&h.match(jd[d]))if(d==="size"){var p=hT(h.split(/\//),2),m=p[0],y=p[1];o[d]=m,y&&(o["line-height"]=y)}else o.size===""&&(Array.isArray(o[d])?o[d].push(h):o[d]=h)}}catch(c){n={error:c}}finally{try{f&&!f.done&&(s=T.return)&&s.call(T)}finally{if(n)throw n.error}}}}catch(c){t={error:c}}finally{try{u&&!u.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}ZD(r,o),delete this.styles[r]}function ZD(r,t){var e,n;try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.childName(r,o);if(Array.isArray(t[o])){var u=t[o];u.length&&(this.styles[l]=u.join(" "))}else t[o]!==""&&(this.styles[l]=t[o])}}catch(h){e={error:h}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}function KD(r){}var yr=function(){function r(t){t===void 0&&(t=""),this.parse(t)}return Object.defineProperty(r.prototype,"cssText",{get:function(){var t,e,n=[];try{for(var s=z2(Object.keys(this.styles)),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.parentName(o);this.styles[l]||n.push(o+": "+this.styles[o]+";")}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n.join(" ")},enumerable:!1,configurable:!0}),r.prototype.set=function(t,e){for(t=this.normalizeName(t),this.setStyle(t,e),r.connect[t]&&!r.connect[t].combine&&(this.combineChildren(t),delete this.styles[t]);t.match(/-/)&&(t=this.parentName(t),!!r.connect[t]);)r.connect[t].combine.call(this,t)},r.prototype.get=function(t){return t=this.normalizeName(t),this.styles.hasOwnProperty(t)?this.styles[t]:""},r.prototype.setStyle=function(t,e){this.styles[t]=e,r.connect[t]&&r.connect[t].children&&r.connect[t].split.call(this,t),e===""&&delete this.styles[t]},r.prototype.combineChildren=function(t){var e,n,s=this.parentName(t);try{for(var a=z2(r.connect[t].children),o=a.next();!o.done;o=a.next()){var l=o.value,u=this.childName(s,l);r.connect[u].combine.call(this,u)}}catch(h){e={error:h}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},r.prototype.parentName=function(t){var e=t.replace(/-[^-]*$/,"");return t===e?"":e},r.prototype.childName=function(t,e){return e.match(/-/)?e:(r.connect[t]&&!r.connect[t].combine&&(e+=t.replace(/.*-/,"-"),t=this.parentName(t)),t+"-"+e)},r.prototype.normalizeName=function(t){return t.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})},r.prototype.parse=function(t){t===void 0&&(t="");var e=this.constructor.pattern;this.styles={};for(var n=t.replace(e.comment,"").split(e.style);n.length>1;){var s=hT(n.splice(0,3),3),a=s[0],o=s[1],l=s[2];if(a.match(/[^\s\n]/))return;this.set(o,l)}},r.pattern={style:/([-a-z]+)[\s\n]*:[\s\n]*((?:'[^']*'|"[^"]*"|\n|.)*?)[\s\n]*(?:;|$)/g,comment:/\/\*[^]*?\*\//g},r.connect={padding:{children:p6,split:vs,combine:GD},border:{children:p6,split:zD,combine:WD},"border-top":{children:ys,split:Ls,combine:xs},"border-right":{children:ys,split:Ls,combine:xs},"border-bottom":{children:ys,split:Ls,combine:xs},"border-left":{children:ys,split:Ls,combine:xs},"border-width":{children:p6,split:vs,combine:null},"border-style":{children:p6,split:vs,combine:null},"border-color":{children:p6,split:vs,combine:null},font:{children:["style","variant","weight","stretch","line-height","size","family"],split:qD,combine:KD}},r}();Wn.Styles=yr;var Cx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ac=_&&_.__assign||function(){return Ac=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ac.apply(this,arguments)},Gd=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},XD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},$D=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Zr,"__esModule",{value:!0});var Dx=Zr.liteAdaptor=Zr.LiteAdaptor=Zr.LiteBase=void 0,YD=i7,JD=Mx,tO=i0,zd=d4,g6=r4,eO=r7,iO=cT,Wd=Wn,Ox=function(r){Cx(t,r);function t(){var e=r.call(this)||this;return e.parser=new iO.LiteParser,e.window=new eO.LiteWindow,e}return t.prototype.parse=function(e,n){return this.parser.parseFromString(e,n,this)},t.prototype.create=function(e,n){return new zd.LiteElement(e)},t.prototype.text=function(e){return new g6.LiteText(e)},t.prototype.comment=function(e){return new g6.LiteComment(e)},t.prototype.createDocument=function(){return new tO.LiteDocument},t.prototype.head=function(e){return e.head},t.prototype.body=function(e){return e.body},t.prototype.root=function(e){return e.root},t.prototype.doctype=function(e){return e.type},t.prototype.tags=function(e,n,s){s===void 0&&(s=null);var a=[],o=[];if(s)return o;for(var l=e;l;){var u=l.kind;u!=="#text"&&u!=="#comment"&&(l=l,u===n&&o.push(l),l.children.length&&(a=l.children.concat(a))),l=a.shift()}return o},t.prototype.elementById=function(e,n){for(var s=[],a=e;a;){if(a.kind!=="#text"&&a.kind!=="#comment"){if(a=a,a.attributes.id===n)return a;a.children.length&&(s=a.children.concat(s))}a=s.shift()}return null},t.prototype.elementsByClass=function(e,n){for(var s=[],a=[],o=e;o;){if(o.kind!=="#text"&&o.kind!=="#comment"){o=o;var l=(o.attributes.class||"").trim().split(/ +/);l.includes(n)&&a.push(o),o.children.length&&(s=o.children.concat(s))}o=s.shift()}return a},t.prototype.getElements=function(e,n){var s,a,o=[],l=this.body(n);try{for(var u=Gd(e),h=u.next();!h.done;h=u.next()){var T=h.value;if(typeof T=="string")if(T.charAt(0)==="#"){var f=this.elementById(l,T.slice(1));f&&o.push(f)}else T.charAt(0)==="."?o=o.concat(this.elementsByClass(l,T.slice(1))):T.match(/^[-a-z][-a-z0-9]*$/i)&&(o=o.concat(this.tags(l,T)));else Array.isArray(T)?o=o.concat(T):T instanceof this.window.NodeList||T instanceof this.window.HTMLCollection?o=o.concat(T.nodes):o.push(T)}}catch(d){s={error:d}}finally{try{h&&!h.done&&(a=u.return)&&a.call(u)}finally{if(s)throw s.error}}return o},t.prototype.contains=function(e,n){for(;n&&n!==e;)n=this.parent(n);return!!n},t.prototype.parent=function(e){return e.parent},t.prototype.childIndex=function(e){return e.parent?e.parent.children.findIndex(function(n){return n===e}):-1},t.prototype.append=function(e,n){return n.parent&&this.remove(n),e.children.push(n),n.parent=e,n},t.prototype.insert=function(e,n){if(e.parent&&this.remove(e),n&&n.parent){var s=this.childIndex(n);n.parent.children.splice(s,0,e),e.parent=n.parent}},t.prototype.remove=function(e){var n=this.childIndex(e);return n>=0&&e.parent.children.splice(n,1),e.parent=null,e},t.prototype.replace=function(e,n){var s=this.childIndex(n);return s>=0&&(n.parent.children[s]=e,e.parent=n.parent,n.parent=null),n},t.prototype.clone=function(e){var n=this,s=new zd.LiteElement(e.kind);return s.attributes=Ac({},e.attributes),s.children=e.children.map(function(a){if(a.kind==="#text")return new g6.LiteText(a.value);if(a.kind==="#comment")return new g6.LiteComment(a.value);var o=n.clone(a);return o.parent=s,o}),s},t.prototype.split=function(e,n){var s=new g6.LiteText(e.value.slice(n));return e.value=e.value.slice(0,n),e.parent.children.splice(this.childIndex(e)+1,0,s),s.parent=e.parent,s},t.prototype.next=function(e){var n=e.parent;if(!n)return null;var s=this.childIndex(e)+1;return s>=0&&s<n.children.length?n.children[s]:null},t.prototype.previous=function(e){var n=e.parent;if(!n)return null;var s=this.childIndex(e)-1;return s>=0?n.children[s]:null},t.prototype.firstChild=function(e){return e.children[0]},t.prototype.lastChild=function(e){return e.children[e.children.length-1]},t.prototype.childNodes=function(e){return $D([],XD(e.children),!1)},t.prototype.childNode=function(e,n){return e.children[n]},t.prototype.kind=function(e){return e.kind},t.prototype.value=function(e){return e.kind==="#text"?e.value:e.kind==="#comment"?e.value.replace(/^<!(--)?((?:.|\n)*)\1>$/,"$2"):""},t.prototype.textContent=function(e){var n=this;return e.children.reduce(function(s,a){return s+(a.kind==="#text"?a.value:a.kind==="#comment"?"":n.textContent(a))},"")},t.prototype.innerHTML=function(e){return this.parser.serializeInner(this,e)},t.prototype.outerHTML=function(e){return this.parser.serialize(this,e)},t.prototype.serializeXML=function(e){return this.parser.serialize(this,e,!0)},t.prototype.setAttribute=function(e,n,s,a){a===void 0&&(a=null),typeof s!="string"&&(s=String(s)),a&&(n=a.replace(/.*\//,"")+":"+n.replace(/^.*:/,"")),e.attributes[n]=s,n==="style"&&(e.styles=null)},t.prototype.getAttribute=function(e,n){return e.attributes[n]},t.prototype.removeAttribute=function(e,n){delete e.attributes[n]},t.prototype.hasAttribute=function(e,n){return e.attributes.hasOwnProperty(n)},t.prototype.allAttributes=function(e){var n,s,a=e.attributes,o=[];try{for(var l=Gd(Object.keys(a)),u=l.next();!u.done;u=l.next()){var h=u.value;o.push({name:h,value:a[h]})}}catch(T){n={error:T}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}return o},t.prototype.addClass=function(e,n){var s=(e.attributes.class||"").split(/ /);s.find(function(a){return a===n})||(s.push(n),e.attributes.class=s.join(" "))},t.prototype.removeClass=function(e,n){var s=(e.attributes.class||"").split(/ /),a=s.findIndex(function(o){return o===n});a>=0&&(s.splice(a,1),e.attributes.class=s.join(" "))},t.prototype.hasClass=function(e,n){var s=(e.attributes.class||"").split(/ /);return!!s.find(function(a){return a===n})},t.prototype.setStyle=function(e,n,s){e.styles||(e.styles=new Wd.Styles(this.getAttribute(e,"style"))),e.styles.set(n,s),e.attributes.style=e.styles.cssText},t.prototype.getStyle=function(e,n){if(!e.styles){var s=this.getAttribute(e,"style");if(!s)return"";e.styles=new Wd.Styles(s)}return e.styles.get(n)},t.prototype.allStyles=function(e){return this.getAttribute(e,"style")},t.prototype.insertRules=function(e,n){e.children=[this.text(n.join(`
112
+ `&&r.lineWrapping&&(n&&(n=Rt.single(n.main.anchor-1,n.main.head-1)),e={from:s.from,to:s.to,insert:Ie.of([" "])}),e)return aT(r,e,n,a);if(n&&!Ua(n,s)){let o=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=hx(r.state.facet(e0).map(u=>u(r)),n))),r.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function aT(r,t,e,n=-1){if(Bt.ios&&r.inputState.flushIOSKey(t))return!0;let s=r.state.selection.main;if(Bt.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&r.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&sn(r.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||n==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&sn(r.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&sn(r.contentDOM,"Delete",46)))return!0;let a=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,l=()=>o||(o=_C(r,t,e));return r.state.facet(JL).some(u=>u(r,t.from,t.to,a,l))||r.dispatch(l()),!0}function _C(r,t,e){let n,s=r.state,a=s.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let u=t.from<a.from?-1:1,h=u<0?a.from:a.to,T=d5(s.facet(e0).map(f=>f(r)),h,u);t.from==T&&(o=T)}if(o>-1)n={changes:t,selection:Rt.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&r.inputState.composing<0){let u=a.from<t.from?s.sliceDoc(a.from,t.from):"",h=a.to>t.to?s.sliceDoc(t.to,a.to):"";n=s.replaceSelection(r.state.toText(u+t.insert.sliceString(0,void 0,r.state.lineBreak)+h))}else{let u=s.changes(t),h=e&&e.main.to<=u.newLength?e.main:void 0;if(s.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let T=r.state.sliceDoc(t.from,t.to),f,d=e&&cx(r,e.main.head);if(d){let m=t.insert.length-(t.to-t.from);f={from:d.from,to:d.to-m}}else f=r.state.doc.lineAt(a.head);let p=a.to-t.to;n=s.changeByRange(m=>{if(m.from==a.from&&m.to==a.to)return{changes:u,range:h||m.map(u)};let y=m.to-p,c=y-T.length;if(r.state.sliceDoc(c,y)!=T||y>=f.from&&c<=f.to)return{range:m};let Q=s.changes({from:c,to:y,insert:t.insert}),g=m.to-a.to;return{changes:Q,range:h?Rt.range(Math.max(0,h.anchor+g),Math.max(0,h.head+g)):m.map(Q)}})}else n={changes:u,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,l+=".compose",r.inputState.compositionFirstChange&&(l+=".start",r.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:l,scrollIntoView:!0})}function dx(r,t,e,n){let s=Math.min(r.length,t.length),a=0;for(;a<s&&r.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==s&&r.length==t.length)return null;let o=r.length,l=t.length;for(;o>0&&l>0&&r.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(n=="end"){let u=Math.max(0,a-Math.min(o,l));e-=o+u-a}if(o<a&&r.length<t.length){let u=e<=a&&e>=o?a-e:0;a-=u,l=a+(l-o),o=a}else if(l<a){let u=e<=a&&e>=l?a-e:0;a-=u,o=a+(o-l),l=a}return{from:a,toA:o,toB:l}}function bC(r){let t=[];if(r.root.activeElement!=r.contentDOM)return t;let{anchorNode:e,anchorOffset:n,focusNode:s,focusOffset:a}=r.observer.selectionRange;return e&&(t.push(new dd(e,n)),(s!=e||a!=n)&&t.push(new dd(s,a))),t}function SC(r,t){if(r.length==0)return null;let e=r[0].pos,n=r.length==2?r[1].pos:e;return e>-1&&n>-1?Rt.single(e+t,n+t):null}function Ua(r,t){return t.head==r.main.head&&t.anchor==r.main.anchor}class EC{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Bt.safari&&t.contentDOM.addEventListener("input",()=>null),Bt.gecko&&UC(t.contentDOM.ownerDocument)}handleEvent(t){!VC(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,e){let n=this.handlers[t];if(n){for(let s of n.observers)s(this.view,e);for(let s of n.handlers){if(e.defaultPrevented)break;if(s(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=AC(t),n=this.handlers,s=this.view.contentDOM;for(let a in e)if(a!="scroll"){let o=!e[a].handlers.length,l=n[a];l&&o!=!l.handlers.length&&(s.removeEventListener(a,this.handleEvent),l=null),l||s.addEventListener(a,this.handleEvent,{passive:o})}for(let a in n)a!="scroll"&&!e[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&MC.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Bt.android&&Bt.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return Bt.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&((e=px.find(n=>n.keyCode==t.keyCode))&&!t.ctrlKey||HC.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let e=this.pendingIOSKey;return!e||e.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,sn(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:Bt.safari&&!Bt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function pd(r,t){return(e,n)=>{try{return t.call(r,n,e)}catch(s){O3(e.state,s)}}}function AC(r){let t=Object.create(null);function e(n){return t[n]||(t[n]={observers:[],handlers:[]})}for(let n of r){let s=n.spec,a=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(a)for(let l in a){let u=a[l];u&&e(l).handlers.push(pd(n.value,u))}if(o)for(let l in o){let u=o[l];u&&e(l).observers.push(pd(n.value,u))}}for(let n in r3)e(n).handlers.push(r3[n]);for(let n in G2)e(n).observers.push(G2[n]);return t}const px=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],HC="dthko",MC=[16,17,18,20,91,92,224,225],us=6;function cs(r){return Math.max(0,r)*.7+8}function wC(r,t){return Math.max(Math.abs(r.clientX-t.clientX),Math.abs(r.clientY-t.clientY))}class CC{constructor(t,e,n,s){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=Cw(t.contentDOM),this.atoms=t.state.facet(e0).map(o=>o(t));let a=t.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Oe.allowMultipleSelections)&&DC(t,e),this.dragging=IC(t,e)&&yx(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&wC(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let e=0,n=0,s=0,a=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:l}=this.scrollParents.y.getBoundingClientRect());let u=lx(this.view);t.clientX-u.left<=s+us?e=-cs(s-t.clientX):t.clientX+u.right>=o-us&&(e=cs(t.clientX-o)),t.clientY-u.top<=a+us?n=-cs(a-t.clientY):t.clientY+u.bottom>=l-us&&(n=cs(t.clientY-l)),this.setScrollSpeed(e,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:e}=this,n=hx(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!n.eq(e.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function DC(r,t){let e=r.state.facet(KL);return e.length?e[0](t):Bt.mac?t.metaKey:t.ctrlKey}function OC(r,t){let e=r.state.facet(XL);return e.length?e[0](t):Bt.mac?!t.altKey:!t.ctrlKey}function IC(r,t){let{main:e}=r.state.selection;if(e.empty)return!1;let n=mn(r.root);if(!n||n.rangeCount==0)return!0;let s=n.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let o=s[a];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function VC(r,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,n;e!=r.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(n=d1.get(e))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0}const r3=Object.create(null),G2=Object.create(null),gx=Bt.ie&&Bt.ie_version<15||Bt.ios&&Bt.webkit_version<604;function PC(r){let t=r.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement("textarea"));e.style.cssText="position: fixed; left: -10000px; top: 10px",e.focus(),setTimeout(()=>{r.focus(),e.remove(),mx(r,e.value)},50)}function e7(r,t,e){for(let n of r.facet(t))e=n(e,r);return e}function mx(r,t){t=e7(r.state,iT,t);let{state:e}=r,n,s=1,a=e.toText(t),o=a.lines==e.selection.ranges.length;if(vc!=null&&e.selection.ranges.every(u=>u.empty)&&vc==a.toString()){let u=-1;n=e.changeByRange(h=>{let T=e.doc.lineAt(h.from);if(T.from==u)return{range:h};u=T.from;let f=e.toText((o?a.line(s++).text:t)+e.lineBreak);return{changes:{from:T.from,insert:f},range:Rt.cursor(h.from+f.length)}})}else o?n=e.changeByRange(u=>{let h=a.line(s++);return{changes:{from:u.from,to:u.to,insert:h.text},range:Rt.cursor(u.from+h.length)}}):n=e.replaceSelection(a);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}G2.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft};r3.keydown=(r,t)=>(r.inputState.setSelectionOrigin("select"),t.keyCode==27&&r.inputState.tabFocusMode!=0&&(r.inputState.tabFocusMode=Date.now()+2e3),!1);G2.touchstart=(r,t)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")};G2.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")};r3.mousedown=(r,t)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let n of r.state.facet($L))if(e=n(r,t),e)break;if(!e&&t.button==0&&(e=RC(r,t)),e){let n=!r.hasFocus;r.inputState.startMouseSelection(new CC(r,t,e,n)),n&&r.observer.ignore(()=>{FL(r.contentDOM);let a=r.root.activeElement;a&&!a.contains(r.contentDOM)&&a.blur()});let s=r.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else r.inputState.setSelectionOrigin("select.pointer");return!1};function gd(r,t,e,n){if(n==1)return Rt.cursor(t,e);if(n==2)return fC(r.state,t,e);{let s=r.docView.lineAt(t,e),a=r.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:a.from,l=s?s.posAtEnd:a.to;return l<r.state.doc.length&&l==a.to&&l++,Rt.range(o,l)}}const kC=Bt.ie&&Bt.ie_version<=11;let md=null,yd=0,vd=0;function yx(r){if(!kC)return r.detail;let t=md,e=vd;return md=r,vd=Date.now(),yd=!t||e>Date.now()-400&&Math.abs(t.clientX-r.clientX)<2&&Math.abs(t.clientY-r.clientY)<2?(yd+1)%3:1}function RC(r,t){let e=r.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),n=yx(t),s=r.state.selection;return{update(a){a.docChanged&&(e.pos=a.changes.mapPos(e.pos),s=s.map(a.changes))},get(a,o,l){let u=r.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),h,T=gd(r,u.pos,u.assoc,n);if(e.pos!=u.pos&&!o){let f=gd(r,e.pos,e.assoc,n),d=Math.min(f.from,T.from),p=Math.max(f.to,T.to);T=d<T.from?Rt.range(d,p):Rt.range(p,d)}return o?s.replaceRange(s.main.extend(T.from,T.to)):l&&n==1&&s.ranges.length>1&&(h=BC(s,u.pos))?h:l?s.addRange(T):Rt.create([T])}}}function BC(r,t){for(let e=0;e<r.ranges.length;e++){let{from:n,to:s}=r.ranges[e];if(n<=t&&s>=t)return Rt.create(r.ranges.slice(0,e).concat(r.ranges.slice(e+1)),r.mainIndex==e?0:r.mainIndex-(r.mainIndex>e?1:0))}return null}r3.dragstart=(r,t)=>{let{selection:{main:e}}=r.state;if(t.target.draggable){let s=r.docView.tile.nearest(t.target);if(s&&s.isWidget()){let a=s.posAtStart,o=a+s.length;(a>=e.to||o<=e.from)&&(e=Rt.range(a,o))}}let{inputState:n}=r;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData("Text",e7(r.state,rT,r.state.sliceDoc(e.from,e.to))),t.dataTransfer.effectAllowed="copyMove"),!1};r3.dragend=r=>(r.inputState.draggedContent=null,!1);function Ld(r,t,e,n){if(e=e7(r.state,iT,e),!e)return;let s=r.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=r.inputState,o=n&&a&&OC(r,t)?{from:a.from,to:a.to}:null,l={from:s,insert:e},u=r.state.changes(o?[o,l]:l);r.focus(),r.dispatch({changes:u,selection:{anchor:u.mapPos(s,-1),head:u.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),r.inputState.draggedContent=null}r3.drop=(r,t)=>{if(!t.dataTransfer)return!1;if(r.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let n=Array(e.length),s=0,a=()=>{++s==e.length&&Ld(r,t,n.filter(o=>o!=null).join(r.state.lineBreak),!1)};for(let o=0;o<e.length;o++){let l=new FileReader;l.onerror=a,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(n[o]=l.result),a()},l.readAsText(e[o])}return!0}else{let n=t.dataTransfer.getData("Text");if(n)return Ld(r,t,n,!0),!0}return!1};r3.paste=(r,t)=>{if(r.state.readOnly)return!0;r.observer.flush();let e=gx?null:t.clipboardData;return e?(mx(r,e.getData("text/plain")||e.getData("text/uri-list")),!0):(PC(r),!1)};function FC(r,t){let e=r.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function NC(r){let t=[],e=[],n=!1;for(let s of r.selection.ranges)s.empty||(t.push(r.sliceDoc(s.from,s.to)),e.push(s));if(!t.length){let s=-1;for(let{from:a}of r.selection.ranges){let o=r.doc.lineAt(a);o.number>s&&(t.push(o.text),e.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),s=o.number}n=!0}return{text:e7(r,rT,t.join(r.lineBreak)),ranges:e,linewise:n}}let vc=null;r3.copy=r3.cut=(r,t)=>{let e=mn(r.root);if(e&&!f5(r.contentDOM,e))return!1;let{text:n,ranges:s,linewise:a}=NC(r.state);if(!n&&!a)return!1;vc=a?n:null,t.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let o=gx?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(FC(r,n),!1)};const vx=Gn.define();function Lx(r,t){let e=[];for(let n of r.facet(tx)){let s=n(r,t);s&&e.push(s)}return e.length?r.update({effects:e,annotations:vx.of(!0)}):null}function xx(r){setTimeout(()=>{let t=r.hasFocus;if(t!=r.inputState.notifiedFocused){let e=Lx(r.state,t);e?r.dispatch(e):r.update([])}},10)}G2.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),xx(r)};G2.blur=r=>{r.observer.clearSelectionRange(),xx(r)};G2.compositionstart=G2.compositionupdate=r=>{r.observer.editContext||(r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0))};G2.compositionend=r=>{r.observer.editContext||(r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,Bt.chrome&&Bt.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50))};G2.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()};r3.beforeinput=(r,t)=>{var e,n;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(r.inputState.insertingText=t.data,r.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&r.observer.editContext){let a=(e=t.dataTransfer)===null||e===void 0?void 0:e.getData("text/plain"),o=t.getTargetRanges();if(a&&o.length){let l=o[0],u=r.posAtDOM(l.startContainer,l.startOffset),h=r.posAtDOM(l.endContainer,l.endOffset);return aT(r,{from:u,to:h,insert:r.state.toText(a)},null),!0}}let s;if(Bt.chrome&&Bt.android&&(s=px.find(a=>a.inputType==t.inputType))&&(r.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return Bt.ios&&t.inputType=="deleteContentForward"&&r.observer.flushSoon(),Bt.safari&&t.inputType=="insertText"&&r.inputState.composing>=0&&setTimeout(()=>G2.compositionend(r,t),20),!1};const xd=new Set;function UC(r){xd.has(r)||(xd.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const _d=["pre-wrap","normal","pre-line","break-spaces"];let xn=!1;function bd(){xn=!1}class jC{constructor(t){this.lineWrapping=t,this.doc=Ie.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return _d.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n<t.length;n++){let s=t[n];s<0?n++:this.heightSamples[Math.floor(s*10)]||(e=!0,this.heightSamples[Math.floor(s*10)]=!0)}return e}refresh(t,e,n,s,a,o){let l=_d.indexOf(t)>-1,u=Math.abs(e-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=n,this.textHeight=s,this.lineLength=a,u){this.heightSamples={};for(let h=0;h<o.length;h++){let T=o[h];T<0?h++:this.heightSamples[Math.floor(T*10)]=!0}}return u}}class GC{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class J2{constructor(t,e,n,s,a){this.from=t,this.length=e,this.top=n,this.height=s,this._content=a}get type(){return typeof this._content=="number"?U2.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof t4?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new J2(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var Ge=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(Ge||(Ge={}));const da=.001;class a2{constructor(t,e,n=2){this.length=t,this.height=e,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>da&&(xn=!0),this.height=t)}replace(t,e,n){return a2.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,s){let a=this,o=n.doc;for(let l=s.length-1;l>=0;l--){let{fromA:u,toA:h,fromB:T,toB:f}=s[l],d=a.lineAt(u,Ge.ByPosNoHeight,n.setDoc(e),0,0),p=d.to>=h?d:a.lineAt(h,Ge.ByPosNoHeight,n,0,0);for(f+=p.to-h,h=p.to;l>0&&d.from<=s[l-1].toA;)u=s[l-1].fromA,T=s[l-1].fromB,l--,u<d.from&&(d=a.lineAt(u,Ge.ByPosNoHeight,n,0,0));T+=d.from-u,u=d.from;let m=oT.build(n.setDoc(o),t,T,f);a=ja(a,a.replace(u,h,m))}return a.updateHeight(n,0)}static empty(){return new _2(0,0,0)}static of(t){if(t.length==1)return t[0];let e=0,n=t.length,s=0,a=0;for(;;)if(e==n)if(s>a*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),n+=1+l.break,s-=l.size}else if(a>s*2){let l=t[n];l.break?t.splice(n,1,l.left,null,l.right):t.splice(n,1,l.left,l.right),n+=2+l.break,a-=l.size}else break;else if(s<a){let l=t[e++];l&&(s+=l.size)}else{let l=t[--n];l&&(a+=l.size)}let o=0;return t[e-1]==null?(o=1,e--):t[e]==null&&(o=1,n++),new WC(a2.of(t.slice(0,e)),o,a2.of(t.slice(n)))}}function ja(r,t){return r==t?r:(r.constructor!=t.constructor&&(xn=!0),t)}a2.prototype.size=1;const zC=t2.replace({});class _x extends a2{constructor(t,e,n){super(t,e),this.deco=n,this.spaceAbove=0}mainBlock(t,e){return new J2(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,e,n,s){return this.spaceAbove&&t<n+this.spaceAbove?new J2(s,0,n,this.spaceAbove,zC):this.mainBlock(n,s)}lineAt(t,e,n,s,a){let o=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,n,s,a).join(o):o}forEachLine(t,e,n,s,a,o){t<=a+this.length&&e>=a&&o(this.lineAt(0,Ge.ByPos,n,s,a))}setMeasuredHeight(t){let e=t.heights[t.index++];e<0?(this.spaceAbove=-e,e=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(e)}updateHeight(t,e=0,n=!1,s){return s&&s.from<=e&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class _2 extends _x{constructor(t,e,n){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(t,e){return new J2(e,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,e,n){let s=n[0];return n.length==1&&(s instanceof _2||s instanceof B1&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof B1?s=new _2(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):a2.of(n)}updateHeight(t,e=0,n=!1,s){return s&&s.from<=e&&s.more?this.setMeasuredHeight(s):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class B1 extends a2{constructor(t){super(t,0)}heightMetrics(t,e){let n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,a=s-n+1,o,l=0;if(t.lineWrapping){let u=Math.min(this.height,t.lineHeight*a);o=u/a,this.length>a+1&&(l=(this.height-u)/(this.length-a-1))}else o=this.height/a;return{firstLine:n,lastLine:s,perLine:o,perChar:l}}blockAt(t,e,n,s){let{firstLine:a,lastLine:o,perLine:l,perChar:u}=this.heightMetrics(e,s);if(e.lineWrapping){let h=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length)),T=e.doc.lineAt(h),f=l+T.length*u,d=Math.max(n,t-f/2);return new J2(T.from,T.length,d,f,0)}else{let h=Math.max(0,Math.min(o-a,Math.floor((t-n)/l))),{from:T,length:f}=e.doc.line(a+h);return new J2(T,f,n+l*h,l,0)}}lineAt(t,e,n,s,a){if(e==Ge.ByHeight)return this.blockAt(t,n,s,a);if(e==Ge.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(t);return new J2(p,m-p,0,0,0)}let{firstLine:o,perLine:l,perChar:u}=this.heightMetrics(n,a),h=n.doc.lineAt(t),T=l+h.length*u,f=h.number-o,d=s+l*f+u*(h.from-a-f);return new J2(h.from,h.length,Math.max(s,Math.min(d,s+this.height-T)),T,0)}forEachLine(t,e,n,s,a,o){t=Math.max(t,a),e=Math.min(e,a+this.length);let{firstLine:l,perLine:u,perChar:h}=this.heightMetrics(n,a);for(let T=t,f=s;T<=e;){let d=n.doc.lineAt(T);if(T==t){let m=d.number-l;f+=u*m+h*(t-a-m)}let p=u+h*d.length;o(new J2(d.from,d.length,f,p,0)),f+=p,T=d.to+1}}replace(t,e,n){let s=this.length-e;if(s>0){let a=n[n.length-1];a instanceof B1?n[n.length-1]=new B1(a.length+s):n.push(null,new B1(s-1))}if(t>0){let a=n[0];a instanceof B1?n[0]=new B1(t+a.length):n.unshift(new B1(t-1),null)}return a2.of(n)}decomposeLeft(t,e){e.push(new B1(t-1),null)}decomposeRight(t,e){e.push(null,new B1(this.length-t-1))}updateHeight(t,e=0,n=!1,s){let a=e+this.length;if(s&&s.from<=e+this.length&&s.more){let o=[],l=Math.max(e,s.from),u=-1;for(s.from>e&&o.push(new B1(s.from-e-1).updateHeight(t,e));l<=a&&s.more;){let T=t.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],d=0;f<0&&(d=-f,f=s.heights[s.index++]),u==-1?u=f:Math.abs(f-u)>=da&&(u=-2);let p=new _2(T,f,d);p.outdated=!1,o.push(p),l+=T+1}l<=a&&o.push(null,new B1(a-l).updateHeight(t,l));let h=a2.of(o);return(u<0||Math.abs(h.height-this.height)>=da||Math.abs(u-this.heightMetrics(t,e).perLine)>=da)&&(xn=!0),ja(this,h)}else(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class WC extends a2{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return this.flags&1}blockAt(t,e,n,s){let a=n+this.left.height;return t<a?this.left.blockAt(t,e,n,s):this.right.blockAt(t,e,a,s+this.left.length+this.break)}lineAt(t,e,n,s,a){let o=s+this.left.height,l=a+this.left.length+this.break,u=e==Ge.ByHeight?t<o:t<l,h=u?this.left.lineAt(t,e,n,s,a):this.right.lineAt(t,e,n,o,l);if(this.break||(u?h.to<l:h.from>l))return h;let T=e==Ge.ByPosNoHeight?Ge.ByPosNoHeight:Ge.ByPos;return u?h.join(this.right.lineAt(l,T,n,o,l)):this.left.lineAt(l,T,n,s,a).join(h)}forEachLine(t,e,n,s,a,o){let l=s+this.left.height,u=a+this.left.length+this.break;if(this.break)t<u&&this.left.forEachLine(t,e,n,s,a,o),e>=u&&this.right.forEachLine(t,e,n,l,u,o);else{let h=this.lineAt(u,Ge.ByPos,n,s,a);t<h.from&&this.left.forEachLine(t,h.from-1,n,s,a,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,n,l,u,o)}}replace(t,e,n){let s=this.left.length+this.break;if(e<s)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,n));let a=[];t>0&&this.decomposeLeft(t,a);let o=a.length;for(let l of n)a.push(l);if(t>0&&Sd(a,o-1),e<this.length){let l=a.length;this.decomposeRight(e,a),Sd(a,l)}return a2.of(a)}decomposeLeft(t,e){let n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(n++,t>=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,s=n+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?a2.of(this.break?[t,null,e]:[t,e]):(this.left=ja(this.left,t),this.right=ja(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,n=!1,s){let{left:a,right:o}=this,l=e+a.length+this.break,u=null;return s&&s.from<=e+a.length&&s.more?u=a=a.updateHeight(t,e,n,s):a.updateHeight(t,e,n),s&&s.from<=l+o.length&&s.more?u=o=o.updateHeight(t,l,n,s):o.updateHeight(t,l,n),u?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Sd(r,t){let e,n;r[t]==null&&(e=r[t-1])instanceof B1&&(n=r[t+1])instanceof B1&&r.splice(t-1,3,new B1(e.length+1+n.length))}const qC=5;class oT{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let n=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof _2?s.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new _2(n-this.pos,-1,0)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t<e||n.heightRelevant){let s=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=e-t;n.block?this.addBlock(new _x(o,s,n)):(o||a||s>=qC)&&this.addLineDeco(s,a,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new _2(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,e){let n=new B1(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof _2)return t;let e=new _2(0,-1,0);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let s=this.ensureLine();s.length+=n,s.collapsed+=n,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof _2)&&!this.isCovered?this.nodes.push(new _2(0,-1,0)):(this.writtenTo<this.pos||e==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=t;for(let s of this.nodes)s instanceof _2&&s.updateHeight(this.oracle,n),n+=s?s.length:1;return this.nodes}static build(t,e,n,s){let a=new oT(n,t);return Me.spans(e,n,s,a,0),a.finish(n)}}function ZC(r,t,e){let n=new KC;return Me.compare(r,t,e,n,0),n.changes}class KC{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,n,s){(t<e||n&&n.heightRelevant||s&&s.heightRelevant)&&nn(t,e,this.changes,5)}}function XC(r,t){let e=r.getBoundingClientRect(),n=r.ownerDocument,s=n.defaultView||window,a=Math.max(0,e.left),o=Math.min(s.innerWidth,e.right),l=Math.max(0,e.top),u=Math.min(s.innerHeight,e.bottom);for(let h=r.parentNode;h&&h!=n.body;)if(h.nodeType==1){let T=h,f=window.getComputedStyle(T);if((T.scrollHeight>T.clientHeight||T.scrollWidth>T.clientWidth)&&f.overflow!="visible"){let d=T.getBoundingClientRect();a=Math.max(a,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),u=Math.min(h==r.parentNode?s.innerHeight:u,d.bottom)}h=f.position=="absolute"||f.position=="fixed"?T.offsetParent:T.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:a-e.left,right:Math.max(a,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,u)-(e.top+t)}}function $C(r){let t=r.getBoundingClientRect(),e=r.ownerDocument.defaultView||window;return t.left<e.innerWidth&&t.right>0&&t.top<e.innerHeight&&t.bottom>0}function YC(r,t){let e=r.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}class a9{constructor(t,e,n,s){this.from=t,this.to=e,this.size=n,this.displaySize=s}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let s=t[n],a=e[n];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(t,e){return t2.replace({widget:new JC(this.displaySize*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class JC extends $o{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class Ed{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ad,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=b1.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(nT).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new jC(e),this.stateDeco=Hd(t),this.heightMap=a2.empty().applyChanges(this.stateDeco,Ie.empty,this.heightOracle.setDoc(t.doc),[new B2(0,0,0,t.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=t2.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let s=n?e.head:e.anchor;if(!t.some(({from:a,to:o})=>s>=a&&s<=o)){let{from:a,to:o}=this.lineBlockAt(s);t.push(new hs(a,o))}}return this.viewports=t.sort((n,s)=>n.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ad:new lT(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(n5(t,this.scaler))})}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=Hd(this.state);let s=t.changedRanges,a=B2.extendWithRanges(s,ZC(n,this.stateDeco,t?t.changes:D1.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);bd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||xn)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=a.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<u.from||e.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,e));let h=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,t.flags|=this.updateForViewport(),(h||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Gw)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),s=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?b1.RTL:b1.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent,l=e.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,T=0;if(l.width&&l.height){let{scaleX:L,scaleY:x}=BL(e,l);(L>.005&&Math.abs(this.scaleX-L)>.005||x>.005&&Math.abs(this.scaleY-x)>.005)&&(this.scaleX=L,this.scaleY=x,h|=16,o=u=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,h|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=16);let p=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=NL(t.scrollDOM);let m=(this.printing?YC:XC)(e,this.paddingTop),y=m.top-this.pixelViewport.top,c=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let Q=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(Q!=this.inView&&(this.inView=Q,Q&&(u=!0)),!this.inView&&!this.scrollTarget&&!$C(t.dom))return 0;let g=l.width;if((this.contentDOMWidth!=g||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=16),u){let L=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(L)&&(o=!0),o||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:x,charWidth:b,textHeight:S}=t.docView.measureTextSize();o=x>0&&s.refresh(a,x,b,S,Math.max(5,g/b),L),o&&(t.docView.minWidth=0,h|=16)}y>0&&c>0?T=Math.max(y,c):y<0&&c<0&&(T=Math.min(y,c)),bd();for(let x of this.viewports){let b=x.from==this.viewport.from?L:t.docView.measureVisibleLineHeights(x);this.heightMap=(o?a2.empty().applyChanges(this.stateDeco,Ie.empty,this.heightOracle,[new B2(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new GC(x.from,b))}xn&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,T)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(T,this.scrollTarget),h|=this.updateForViewport()),(h&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,u=new hs(s.lineAt(o-n*1e3,Ge.ByHeight,a,0,0).from,s.lineAt(l+(1-n)*1e3,Ge.ByHeight,a,0,0).to);if(e){let{head:h}=e.range;if(h<u.from||h>u.to){let T=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,Ge.ByPos,a,0,0),d;e.y=="center"?d=(f.top+f.bottom)/2-T/2:e.y=="start"||e.y=="nearest"&&h<u.from?d=f.top:d=f.bottom-T,u=new hs(s.lineAt(d-1e3/2,Ge.ByHeight,a,0,0).from,s.lineAt(d+T+1e3/2,Ge.ByHeight,a,0,0).to)}}return u}mapViewport(t,e){let n=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new hs(this.heightMap.lineAt(n,Ge.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ge.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},n=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,Ge.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(e,Ge.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(t==0||s<=o-Math.max(10,Math.min(-n,250)))&&(e==this.state.doc.length||a>=l+Math.max(10,Math.min(n,250)))&&s>o-2*1e3&&a<l+2*1e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let n=[];for(let s of t)e.touchesRange(s.from,s.to)||n.push(new a9(e.mapPos(s.from),e.mapPos(s.to),s.size,s.displaySize));return n}ensureLineGaps(t,e){let n=this.heightOracle.lineWrapping,s=n?1e4:2e3,a=s>>1,o=s<<1;if(this.defaultTextDirection!=b1.LTR&&!n)return[];let l=[],u=(T,f,d,p)=>{if(f-T<a)return;let m=this.state.selection.main,y=[m.from];m.empty||y.push(m.to);for(let Q of y)if(Q>T&&Q<f){u(T,Q-10,d,p),u(Q+10,f,d,p);return}let c=eD(t,Q=>Q.from>=d.from&&Q.to<=d.to&&Math.abs(Q.from-T)<a&&Math.abs(Q.to-f)<a&&!y.some(g=>Q.from<g&&Q.to>g));if(!c){if(f<d.to&&e&&n&&e.visibleRanges.some(v=>v.from<=f&&v.to>=f)){let v=e.moveToLineBoundary(Rt.cursor(f),!1,!0).head;v>T&&(f=v)}let Q=this.gapSize(d,T,f,p),g=n||Q<2e6?Q:2e6;c=new a9(T,f,Q,g)}l.push(c)},h=T=>{if(T.length<o||T.type!=U2.Text)return;let f=tD(T.from,T.to,this.stateDeco);if(f.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,p,m;if(n){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,c,Q;if(d!=null){let g=fs(f,d),v=((this.visibleBottom-this.visibleTop)/2+y)/T.height;c=g-v,Q=g+v}else c=(this.visibleTop-T.top-y)/T.height,Q=(this.visibleBottom-T.top+y)/T.height;p=Ts(f,c),m=Ts(f,Q)}else{let y=f.total*this.heightOracle.charWidth,c=s*this.heightOracle.charWidth,Q=0;if(y>2e6)for(let b of t)b.from>=T.from&&b.from<T.to&&b.size!=b.displaySize&&b.from*this.heightOracle.charWidth+Q<this.pixelViewport.left&&(Q=b.size-b.displaySize);let g=this.pixelViewport.left+Q,v=this.pixelViewport.right+Q,L,x;if(d!=null){let b=fs(f,d),S=((v-g)/2+c)/y;L=b-S,x=b+S}else L=(g-c)/y,x=(v+c)/y;p=Ts(f,L),m=Ts(f,x)}p>T.from&&u(T.from,p,T,f),m<T.to&&u(m,T.to,T,f)};for(let T of this.viewportLines)Array.isArray(T.type)?T.type.forEach(h):h(T);return l}gapSize(t,e,n,s){let a=fs(s,n)-fs(s,e);return this.heightOracle.lineWrapping?t.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(t){a9.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=t2.set(t.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Me.spans(e,this.viewport.from,this.viewport.to,{span(a,o){n.push({from:a,to:o})},point(){}},20);let s=0;if(n.length!=this.visibleRanges.length)s=12;else for(let a=0;a<n.length&&!(s&8);a++){let o=this.visibleRanges[a],l=n[a];(o.from!=l.from||o.to!=l.to)&&(s|=4,t&&t.mapPos(o.from,-1)==l.from&&t.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=n,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||n5(this.heightMap.lineAt(t,Ge.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(e=>e.top<=t&&e.bottom>=t)||n5(this.heightMap.lineAt(this.scaler.fromDOM(t),Ge.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return n5(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class hs{constructor(t,e){this.from=t,this.to=e}}function tD(r,t,e){let n=[],s=r,a=0;return Me.spans(e,r,t,{span(){},point(o,l){o>s&&(n.push({from:s,to:o}),a+=o-s),s=l}},20),s<t&&(n.push({from:s,to:t}),a+=t-s),{total:a,ranges:n}}function Ts({total:r,ranges:t},e){if(e<=0)return t[0].from;if(e>=1)return t[t.length-1].to;let n=Math.floor(r*e);for(let s=0;;s++){let{from:a,to:o}=t[s],l=o-a;if(n<=l)return a+n;n-=l}}function fs(r,t){let e=0;for(let{from:n,to:s}of r.ranges){if(t<=s){e+=t-n;break}e+=s-n}return e/r.total}function eD(r,t){for(let e of r)if(t(e))return e}const Ad={toDOM(r){return r},fromDOM(r){return r},scale:1,eq(r){return r==this}};function Hd(r){let t=r.facet(Yo).filter(n=>typeof n!="function"),e=r.facet(sT).filter(n=>typeof n!="function");return e.length&&t.push(Me.join(e)),t}class lT{constructor(t,e,n){let s=0,a=0,o=0;this.viewports=n.map(({from:l,to:u})=>{let h=e.lineAt(l,Ge.ByPos,t,0,0).top,T=e.lineAt(u,Ge.ByPos,t,0,0).bottom;return s+=T-h,{from:l,to:u,top:h,bottom:T,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s);for(let l of this.viewports)l.domTop=o+(l.top-a)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),a=l.bottom}toDOM(t){for(let e=0,n=0,s=0;;e++){let a=e<this.viewports.length?this.viewports[e]:null;if(!a||t<a.top)return s+(t-n)*this.scale;if(t<=a.bottom)return a.domTop+(t-a.top);n=a.bottom,s=a.domBottom}}fromDOM(t){for(let e=0,n=0,s=0;;e++){let a=e<this.viewports.length?this.viewports[e]:null;if(!a||t<a.domTop)return n+(t-s)/this.scale;if(t<=a.domBottom)return a.top+(t-a.domTop);n=a.bottom,s=a.domBottom}}eq(t){return t instanceof lT?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to):!1}}function n5(r,t){if(t.scale==1)return r;let e=t.toDOM(r.top),n=t.toDOM(r.bottom);return new J2(r.from,r.length,e,n-e,Array.isArray(r._content)?r._content.map(s=>n5(s,t)):r._content)}const Qs=ne.define({combine:r=>r.join(" ")}),Lc=ne.define({combine:r=>r.indexOf(!0)>-1}),xc=hr.newName(),bx=hr.newName(),Sx=hr.newName(),Ex={"&light":"."+bx,"&dark":"."+Sx};function _c(r,t,e){return new hr(t,{finish(n){return/&/.test(n)?n.replace(/&\w*/,s=>{if(s=="&")return r;if(!e||!e[s])throw new RangeError(`Unsupported selector: ${s}`);return e[s]}):r+" "+n}})}const iD=_c("."+xc,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ex),rD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},o9=Bt.ie&&Bt.ie_version<=11;class nD{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Dw,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let n of e)this.queue.push(n);(Bt.ie&&Bt.ie_version<=11||Bt.ios&&t.composing)&&e.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Bt.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Bt.chrome&&Bt.chrome_version<126)&&(this.editContext=new aD(t),t.state.facet(ci)&&(t.contentDOM.editContext=this.editContext.editContext)),o9&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,n)=>e!=t[n]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,s=this.selectionRange;if(n.state.facet(ci)?n.root.activeElement!=this.dom:!f5(this.dom,s))return;let a=s.anchorNode&&n.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Bt.ie&&Bt.ie_version<=11||Bt.android&&Bt.chrome)&&!n.state.selection.main.empty&&s.focusNode&&Q5(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=mn(t.root);if(!e)return!1;let n=Bt.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&sD(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let s=f5(this.dom,n);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&Iw(this.dom,n)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(n),s&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let n=this.dom;n;)if(n.nodeType==1)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=e)n.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,rD),o9&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),o9&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var n;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&sn(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,s=!1;for(let a of t){let o=this.readMutation(a);o&&(o.typeOver&&(s=!0),e==-1?{from:e,to:n}=o:(e=Math.min(o.from,e),n=Math.max(o.to,n)))}return{from:e,to:n,typeOver:s}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),s=this.selectionChanged&&f5(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new xC(this.view,t,e,n);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,s=Qx(this.view,e);return this.view.state==n&&(e.domChanged||e.newSel&&!Ua(this.view.state.selection,e.newSel.main))&&this.view.update([]),s}readMutation(t){let e=this.view.docView.tile.nearest(t.target);if(!e||e.isWidget())return null;if(e.markDirty(t.type=="attributes"),t.type=="childList"){let n=Md(e,t.previousSibling||t.target.previousSibling,-1),s=Md(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(ci)!=t.state.facet(ci)&&(t.view.contentDOM.editContext=t.state.facet(ci)?this.editContext.editContext:null))}destroy(){var t,e,n;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Md(r,t,e){for(;t;){let n=d1.get(t);if(n&&n.parent==r)return n;let s=t.parentNode;t=s!=r.dom?s:e>0?t.nextSibling:t.previousSibling}return null}function wd(r,t){let e=t.startContainer,n=t.startOffset,s=t.endContainer,a=t.endOffset,o=r.docView.domAtPos(r.state.selection.main.anchor,1);return Q5(o.node,o.offset,s,a)&&([e,n,s,a]=[s,a,e,n]),{anchorNode:e,anchorOffset:n,focusNode:s,focusOffset:a}}function sD(r,t){if(t.getComposedRanges){let s=t.getComposedRanges(r.root)[0];if(s)return wd(r,s)}let e=null;function n(s){s.preventDefault(),s.stopImmediatePropagation(),e=s.getTargetRanges()[0]}return r.contentDOM.addEventListener("beforeinput",n,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",n,!0),e?wd(r,e):null}class aD{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=n=>{let s=t.state.selection.main,{anchor:a,head:o}=s,l=this.toEditorPos(n.updateRangeStart),u=this.toEditorPos(n.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:l,drifted:!1});let h=u-l>n.text.length;l==this.from&&a<this.from?l=a:u==this.to&&a>this.to&&(u=a);let T=dx(t.state.sliceDoc(l,u),n.text,(h?s.from:s.to)-l,h?"end":null);if(!T){let d=Rt.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Ua(d,s)||t.dispatch({selection:d,userEvent:"select"});return}let f={from:T.from+l,to:T.toA+l,insert:Ie.of(n.text.slice(T.from,T.toB).split(`
113
+ `))};if((Bt.mac||Bt.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:u,insert:Ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);aT(t,f,Rt.single(this.toEditorPos(n.selectionStart,d),this.toEditorPos(n.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from<f.to&&!f.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(e.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(e.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let s=[],a=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let u=t.coordsForChar(o);a=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||a||new DOMRect,s.push(a)}e.updateCharacterBounds(n.rangeStart,s)},this.handlers.textformatupdate=n=>{let s=[];for(let a of n.getTextFormats()){let o=a.underlineStyle,l=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let u=this.toEditorPos(a.rangeStart),h=this.toEditorPos(a.rangeEnd);if(u<h){let T=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(t2.mark({attributes:{style:T}}).range(u,h))}}}t.dispatch({effects:rx.of(t2.set(s))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(t.state)}};for(let n in this.handlers)e.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let s=mn(n.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,n=!1,s=this.pendingContextChange;return t.changes.iterChanges((a,o,l,u,h)=>{if(n)return;let T=h.length-(o-a);if(s&&o>=s.to)if(s.from==a&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,e+=T,this.to+=T;return}else s=null,this.revertPending(t.state);if(a+=e,o+=e,o<=this.from)this.from+=T,this.to+=T;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),h.toString()),this.to+=T}e+=T}),s&&!n&&this.revertPending(t.state),!n}update(t){let e=this.pendingContextChange,n=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(n.from,n.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),s=this.toContextPos(e.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(n,s)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>1e4*3)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let n=this.composing;return n&&n.drifted?n.editorBase+(t-n.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class be{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:n}=t;this.dispatchTransactions=t.dispatchTransactions||n&&(s=>s.forEach(a=>n(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||Ow(t.parent)||document,this.viewState=new Ed(t.state||Oe.create(t)),t.scrollTo&&t.scrollTo.is(ls)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(X4).map(s=>new e9(s));for(let s of this.plugins)s.update(this);this.observer=new nD(this),this.inputState=new EC(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Td(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((e=document.fonts)===null||e===void 0)&&e.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...t){let e=t.length==1&&t[0]instanceof J1?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,n=!1,s,a=this.state;for(let d of t){if(d.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=d.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,l=0,u=null;t.some(d=>d.annotation(vx))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=Lx(a,o),u||(l=1));let h=this.observer.delayedAndroidKey,T=null;if(h?(this.observer.clearDelayedAndroidKey(),T=this.observer.readChange(),(T&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(T=null)):this.observer.clear(),a.facet(Oe.phrases)!=this.state.facet(Oe.phrases))return this.setState(a);s=Ba.create(this,a,t),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of t){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;f=new an(p.empty?p:Rt.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(ls)&&(f=p.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Ga.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(i5)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Qs)!=s.state.facet(Qs)&&(this.viewState.mustMeasureContent=!0),(e||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),e&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(gc))try{d(s)}catch(p){O3(this.state,p,"update listener")}(u||T)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),T&&!Qx(this,T)&&h.force&&sn(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Ed(t),this.plugins=t.facet(X4).map(n=>new e9(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Td(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(X4),n=t.state.facet(X4);if(e!=n){let s=[];for(let a of n){let o=e.indexOf(a);if(o<0)s.push(new e9(a));else{let l=this.plugins[o];l.mustUpdate=t,s.push(l)}}for(let a of this.plugins)a.mustUpdate!=t&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);e!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(n){O3(this.state,n,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,s=n.scrollTop*this.scaleY,{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(NL(n))a=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);a=p.from,o=p.top}this.updateState=1;let u=this.viewState.measure(this);if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];u&4||([this.measureRequests,h]=[h,this.measureRequests]);let T=h.map(p=>{try{return p.read(this)}catch(m){return O3(this.state,m),Cd}}),f=Ba.create(this,this.state,[]),d=!1;f.flags|=u,e?e.flags|=u:e=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let p=0;p<h.length;p++)if(T[p]!=Cd)try{let m=h[p];m.write&&m.write(T[p],this)}catch(m){O3(this.state,m)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o;if(m>1||m<-1){s=s+m,n.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(gc))l(e)}get themeClasses(){return xc+" "+(this.state.facet(Lc)?Sx:bx)+" "+this.state.facet(Qs)}updateAttrs(){let t=Dd(this,nx,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ci)?"true":"false",class:"cm-content",style:`${Bt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Dd(this,nT,e);let n=this.observer.ignore(()=>{let s=ad(this.contentDOM,this.contentAttrs,e),a=ad(this.dom,this.editorAttrs,t);return s||a});return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let s of n.effects)if(s.is(be.announce)){e&&(this.announceDOM.textContent=""),e=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(i5);let t=this.state.facet(be.cspNonce);hr.mount(this.root,this.styleModules.concat(iD).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key){this.measureRequests[e]=t;return}}this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(e===void 0||e&&e.plugin!=t)&&this.pluginMap.set(t,e=this.plugins.find(n=>n.plugin==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return s9(this,t,fd(this,t,e,n))}moveByGroup(t,e){return s9(this,t,fd(this,t,e,n=>gC(this,t.head,n)))}visualLineSide(t,e){let n=this.bidiSpans(t),s=this.textDirectionAt(t.from),a=n[e?n.length-1:0];return Rt.cursor(a.side(e,s)+t.from,a.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,n=!0){return pC(this,t,e,n)}moveVertically(t,e,n){return s9(this,t,mC(this,t,e,n))}domAtPos(t,e=1){return this.docView.domAtPos(t,e)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){this.readMeasured();let n=yc(this,t,e);return n&&n.pos}posAndSideAtCoords(t,e=!0){return this.readMeasured(),yc(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;let s=this.state.doc.lineAt(t),a=this.bidiSpans(s),o=a[fi.find(a,t-s.from,-1,e)];return Ra(n,o.dir==b1.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(ex)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>oD)return qL(t.length);let e=this.textDirectionAt(t.from),n;for(let a of this.bidiCache)if(a.from==t.from&&a.dir==e&&(a.fresh||WL(a.isolates,n=ud(this,t))))return a.order;n||(n=ud(this,t));let s=Nw(t.text,e,n);return this.bidiCache.push(new Ga(t.from,t.to,e,n,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Bt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{FL(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return ls.of(new an(typeof t=="number"?Rt.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return ls.of(new an(Rt.cursor(n.from),"start","start",n.top-t,e,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return yn.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return yn.define(()=>({}),{eventObservers:t})}static theme(t,e){let n=hr.newName(),s=[Qs.of(n),i5.of(_c(`.${n}`,t))];return e&&e.dark&&s.push(Lc.of(!0)),s}static baseTheme(t){return hw.lowest(i5.of(_c("."+xc,t,Ex)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),s=n&&d1.get(n)||d1.get(t);return((e=s==null?void 0:s.root)===null||e===void 0?void 0:e.view)||null}}be.styleModule=i5;be.inputHandler=JL;be.clipboardInputFilter=iT;be.clipboardOutputFilter=rT;be.scrollHandler=ix;be.focusChangeEffect=tx;be.perLineTextDirection=ex;be.exceptionSink=YL;be.updateListener=gc;be.editable=ci;be.mouseSelectionStyle=$L;be.dragMovesSelection=XL;be.clickAddsSelectionRange=KL;be.decorations=Yo;be.blockWrappers=sx;be.outerDecorations=sT;be.atomicRanges=e0;be.bidiIsolatedRanges=ax;be.scrollMargins=ox;be.darkTheme=Lc;be.cspNonce=ne.define({combine:r=>r.length?r[0]:""});be.contentAttributes=nT;be.editorAttributes=nx;be.lineWrapping=be.contentAttributes.of({class:"cm-lineWrapping"});be.announce=_1.define();const oD=4096,Cd={};class Ga{constructor(t,e,n,s,a,o){this.from=t,this.to=e,this.dir=n,this.isolates=s,this.fresh=a,this.order=o}static update(t,e){if(e.empty&&!t.some(a=>a.fresh))return t;let n=[],s=t.length?t[t.length-1].dir:b1.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==s&&!e.touchesRange(o.from,o.to)&&n.push(new Ga(e.mapPos(o.from,1),e.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Dd(r,t,e){for(let n=r.state.facet(t),s=n.length-1;s>=0;s--){let a=n[s],o=typeof a=="function"?a(r):a;o&&Jh(o,e)}return e}class _n extends Jr{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}_n.prototype.elementClass="";_n.prototype.toDOM=void 0;_n.prototype.mapMode=S2.TrackBefore;_n.prototype.startSide=_n.prototype.endSide=-1;_n.prototype.point=!0;let lD=0;class R2{constructor(t,e,n,s){this.name=t,this.set=e,this.base=n,this.modified=s,this.id=lD++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let n=typeof t=="string"?t:"?";if(t instanceof R2&&(e=t),e!=null&&e.base)throw new Error("Can not derive from a modified tag");let s=new R2(n,[],null,[]);if(s.set.push(s),e)for(let a of e.set)s.set.push(a);return s}static defineModifier(t){let e=new za(t);return n=>n.modified.indexOf(e)>-1?n:za.get(n.base||n,n.modified.concat(e).sort((s,a)=>s.id-a.id))}}let uD=0;class za{constructor(t){this.name=t,this.instances=[],this.id=uD++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find(l=>l.base==t&&cD(e,l.modified));if(n)return n;let s=[],a=new R2(t.name,s,t,e);for(let l of e)l.instances.push(a);let o=hD(e);for(let l of t.set)if(!l.modified.length)for(let u of o)s.push(za.get(l,u));return a}}function cD(r,t){return r.length==t.length&&r.every((e,n)=>e==t[n])}function hD(r){let t=[[]];for(let e=0;e<r.length;e++)for(let n=0,s=t.length;n<s;n++)t.push(t[n].concat(r[e]));return t.sort((e,n)=>n.length-e.length)}function TD(r){let t=Object.create(null);for(let e in r){let n=r[e];Array.isArray(n)||(n=[n]);for(let s of e.split(" "))if(s){let a=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+s);if(a.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==s.length)break;let p=s[f++];if(f==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let u=a.length-1,h=a[u];if(!h)throw new RangeError("Invalid path: "+s);let T=new Wa(n,o,u>0?a.slice(0,u):null);t[h]=T.sort(t[h])}}return fD.add(t)}const fD=new qe({combine(r,t){let e,n,s;for(;r||t;){if(!r||t&&r.depth>=t.depth?(s=t,t=t.next):(s=r,r=r.next),e&&e.mode==s.mode&&!s.context&&!e.context)continue;let a=new Wa(s.tags,s.mode,s.context);e?e.next=a:n=a,e=a}return n}});class Wa{constructor(t,e,n,s){this.tags=t,this.mode=e,this.context=n,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}Wa.empty=new Wa([],2,null);function Ax(r,t){let e=Object.create(null);for(let a of r)if(!Array.isArray(a.tag))e[a.tag.id]=a.class;else for(let o of a.tag)e[o.id]=a.class;let{scope:n,all:s=null}=t||{};return{style:a=>{let o=s;for(let l of a)for(let u of l.set){let h=e[u.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}const yt=R2.define,ds=yt(),zi=yt(),Od=yt(zi),Id=yt(zi),Wi=yt(),ps=yt(Wi),l9=yt(Wi),E3=yt(),Sr=yt(E3),y3=yt(),v3=yt(),bc=yt(),Q6=yt(bc),gs=yt(),lt={comment:ds,lineComment:yt(ds),blockComment:yt(ds),docComment:yt(ds),name:zi,variableName:yt(zi),typeName:Od,tagName:yt(Od),propertyName:Id,attributeName:yt(Id),className:yt(zi),labelName:yt(zi),namespace:yt(zi),macroName:yt(zi),literal:Wi,string:ps,docString:yt(ps),character:yt(ps),attributeValue:yt(ps),number:l9,integer:yt(l9),float:yt(l9),bool:yt(Wi),regexp:yt(Wi),escape:yt(Wi),color:yt(Wi),url:yt(Wi),keyword:y3,self:yt(y3),null:yt(y3),atom:yt(y3),unit:yt(y3),modifier:yt(y3),operatorKeyword:yt(y3),controlKeyword:yt(y3),definitionKeyword:yt(y3),moduleKeyword:yt(y3),operator:v3,derefOperator:yt(v3),arithmeticOperator:yt(v3),logicOperator:yt(v3),bitwiseOperator:yt(v3),compareOperator:yt(v3),updateOperator:yt(v3),definitionOperator:yt(v3),typeOperator:yt(v3),controlOperator:yt(v3),punctuation:bc,separator:yt(bc),bracket:Q6,angleBracket:yt(Q6),squareBracket:yt(Q6),paren:yt(Q6),brace:yt(Q6),content:E3,heading:Sr,heading1:yt(Sr),heading2:yt(Sr),heading3:yt(Sr),heading4:yt(Sr),heading5:yt(Sr),heading6:yt(Sr),contentSeparator:yt(E3),list:yt(E3),quote:yt(E3),emphasis:yt(E3),strong:yt(E3),link:yt(E3),monospace:yt(E3),strikethrough:yt(E3),inserted:yt(),deleted:yt(),changed:yt(),invalid:yt(),meta:gs,documentMeta:yt(gs),annotation:yt(gs),processingInstruction:yt(gs),definition:R2.defineModifier("definition"),constant:R2.defineModifier("constant"),function:R2.defineModifier("function"),standard:R2.defineModifier("standard"),local:R2.defineModifier("local"),special:R2.defineModifier("special")};for(let r in lt){let t=lt[r];t instanceof R2&&(t.name=r)}Ax([{tag:lt.link,class:"tok-link"},{tag:lt.heading,class:"tok-heading"},{tag:lt.emphasis,class:"tok-emphasis"},{tag:lt.strong,class:"tok-strong"},{tag:lt.keyword,class:"tok-keyword"},{tag:lt.atom,class:"tok-atom"},{tag:lt.bool,class:"tok-bool"},{tag:lt.url,class:"tok-url"},{tag:lt.labelName,class:"tok-labelName"},{tag:lt.inserted,class:"tok-inserted"},{tag:lt.deleted,class:"tok-deleted"},{tag:lt.literal,class:"tok-literal"},{tag:lt.string,class:"tok-string"},{tag:lt.number,class:"tok-number"},{tag:[lt.regexp,lt.escape,lt.special(lt.string)],class:"tok-string2"},{tag:lt.variableName,class:"tok-variableName"},{tag:lt.local(lt.variableName),class:"tok-variableName tok-local"},{tag:lt.definition(lt.variableName),class:"tok-variableName tok-definition"},{tag:lt.special(lt.variableName),class:"tok-variableName2"},{tag:lt.definition(lt.propertyName),class:"tok-propertyName tok-definition"},{tag:lt.typeName,class:"tok-typeName"},{tag:lt.namespace,class:"tok-namespace"},{tag:lt.className,class:"tok-className"},{tag:lt.macroName,class:"tok-macroName"},{tag:lt.propertyName,class:"tok-propertyName"},{tag:lt.operator,class:"tok-operator"},{tag:lt.comment,class:"tok-comment"},{tag:lt.meta,class:"tok-meta"},{tag:lt.invalid,class:"tok-invalid"},{tag:lt.punctuation,class:"tok-punctuation"}]);var u9;const s5=new qe,QD=new qe;class I3{constructor(t,e,n=[],s=""){this.data=t,this.name=s,Oe.prototype.hasOwnProperty("tree")||Object.defineProperty(Oe.prototype,"tree",{get(){return Sc(this)}}),this.parser=e,this.extension=[Sn.of(this),Oe.languageData.of((a,o,l)=>{let u=Vd(a,o,l),h=u.type.prop(s5);if(!h)return[];let T=a.facet(h),f=u.type.prop(QD);if(f){let d=u.resolve(o-u.from,l);for(let p of f)if(p.test(d,a)){let m=a.facet(p.facet);return p.type=="replace"?m:m.concat(T)}}return T})].concat(n)}isActiveAt(t,e,n=-1){return Vd(t,e,n).type.prop(s5)==this.data}findRegions(t){let e=t.facet(Sn);if((e==null?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],s=(a,o)=>{if(a.prop(s5)==this.data){n.push({from:o,to:o+a.length});return}let l=a.prop(qe.mounted);if(l){if(l.tree.prop(s5)==this.data){if(l.overlay)for(let u of l.overlay)n.push({from:u.from+o,to:u.to+o});else n.push({from:o,to:o+a.length});return}else if(l.overlay){let u=n.length;if(s(l.tree,l.overlay[0].from+o),n.length>u)return}}for(let u=0;u<a.children.length;u++){let h=a.children[u];h instanceof G1&&s(h,a.positions[u]+o)}};return s(Sc(t),0),n}get allowsNesting(){return!0}}I3.setState=_1.define();function Vd(r,t,e){let n=r.facet(Sn),s=Sc(r).topNode;if(!n||n.allowsNesting)for(let a=s;a;a=a.enter(t,e,l1.ExcludeBuffers|l1.EnterBracketed))a.type.isTop&&(s=a);return s}function Sc(r){let t=r.field(I3.state,!1);return t?t.tree:G1.empty}class dD{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let d6=null;class qa{constructor(t,e,n=[],s,a,o,l,u){this.parser=t,this.state=e,this.fragments=n,this.tree=s,this.treeLen=a,this.viewport=o,this.skipped=l,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new qa(t,e,[],G1.empty,0,n,[],null)}startParse(){return this.parser.startParse(new dD(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=G1.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(qr.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(e??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(qr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=d6;d6=this;try{return t()}finally{d6=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Pd(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:s,treeLen:a,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let u=[];if(t.iterChangedRanges((h,T,f,d)=>u.push({fromA:h,toA:T,fromB:f,toB:d})),n=qr.applyChanges(n,u),s=G1.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let T=t.mapPos(h.from,1),f=t.mapPos(h.to,-1);T<f&&l.push({from:T,to:f})}}}return new qa(this.parser,e,n,s,a,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:s,to:a}=this.skipped[n];s<t.to&&a>t.from&&(this.fragments=Pd(this.fragments,s,a),this.skipped.splice(n--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends rw{createParse(e,n,s){let a=s[0].from,o=s[s.length-1].to;return{parsedPos:a,advance(){let u=d6;if(u){for(let h of s)u.tempSkipped.push(h);t&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,t]):t)}return this.parsedPos=o,new G1(j2.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return d6}}function Pd(r,t,e){return qr.applyChanges(r,[{fromA:t,toA:e,fromB:t,toB:e}])}class bn{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new bn(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=qa.create(t.facet(Sn).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new bn(n)}}I3.state=Q4.define({create:bn.init,update(r,t){for(let e of t.effects)if(e.is(I3.setState))return e.value;return t.startState.facet(Sn)!=t.state.facet(Sn)?bn.init(t.state):r.apply(t)}});let Hx=r=>{let t=setTimeout(()=>r(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Hx=r=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(r,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});const c9=typeof navigator<"u"&&(!((u9=navigator.scheduling)===null||u9===void 0)&&u9.isInputPending)?()=>navigator.scheduling.isInputPending():null,pD=yn.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(I3.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(I3.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=Hx(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:s}}=this.view,a=n.field(I3.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!c9?Math.max(25,t.timeRemaining()-5):1e9),l=a.context.treeLen<s&&n.doc.length>s+1e3,u=a.context.work(()=>c9&&c9()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-e,(u||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:I3.setState.of(new bn(a.context))})),this.chunkBudget>0&&!(u&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>O3(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Sn=ne.define({combine(r){return r.length?r[0]:null},enables:r=>[I3.state,pD,be.contentAttributes.compute([r],t=>{let e=t.facet(r);return e&&e.name?{"data-language":e.name}:{}})]});class uT{constructor(t,e){this.specs=t;let n;function s(l){let u=hr.newName();return(n||(n=Object.create(null)))["."+u]=l,u}const a=typeof e.all=="string"?e.all:e.all?s(e.all):void 0,o=e.scope;this.scope=o instanceof I3?l=>l.prop(s5)==o.data:o?l=>l==o:void 0,this.style=Ax(t.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:a}).style,this.module=n?new hr(n):null,this.themeType=e.themeType}static define(t,e){return new uT(t,e||{})}}const gD=Object.create(null),kd=[j2.none],Rd=[],Bd=Object.create(null),mD=Object.create(null);for(let[r,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])mD[r]=yD(gD,t);function h9(r,t){Rd.indexOf(r)>-1||(Rd.push(r),console.warn(t))}function yD(r,t){let e=[];for(let l of t.split(" ")){let u=[];for(let h of l.split(".")){let T=r[h]||lt[h];T?typeof T=="function"?u.length?u=u.map(T):h9(h,`Modifier ${h} used at start of tag`):u.length?h9(h,`Tag ${h} used as modifier`):u=Array.isArray(T)?T:[T]:h9(h,`Unknown highlighting tag ${h}`)}for(let h of u)e.push(h)}if(!e.length)return 0;let n=t.replace(/ /g,"_"),s=n+" "+e.map(l=>l.id),a=Bd[s];if(a)return a.id;let o=Bd[s]=j2.define({id:kd.length,name:n,props:[TD({[n]:e})]});return kd.push(o),o.id}b1.RTL,b1.LTR;var _=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vD(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zr={},i7={},ms=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(i7,"__esModule",{value:!0});i7.AbstractDOMAdaptor=void 0;var LD=function(){function r(t){t===void 0&&(t=null),this.document=t}return r.prototype.node=function(t,e,n,s){var a,o;e===void 0&&(e={}),n===void 0&&(n=[]);var l=this.create(t,s);this.setAttributes(l,e);try{for(var u=ms(n),h=u.next();!h.done;h=u.next()){var T=h.value;this.append(l,T)}}catch(f){a={error:f}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l},r.prototype.setAttributes=function(t,e){var n,s,a,o,l,u;if(e.style&&typeof e.style!="string")try{for(var h=ms(Object.keys(e.style)),T=h.next();!T.done;T=h.next()){var f=T.value;this.setStyle(t,f.replace(/-([a-z])/g,function(c,Q){return Q.toUpperCase()}),e.style[f])}}catch(c){n={error:c}}finally{try{T&&!T.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}if(e.properties)try{for(var d=ms(Object.keys(e.properties)),p=d.next();!p.done;p=d.next()){var f=p.value;t[f]=e.properties[f]}}catch(c){a={error:c}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(a)throw a.error}}try{for(var m=ms(Object.keys(e)),y=m.next();!y.done;y=m.next()){var f=y.value;(f!=="style"||typeof e.style=="string")&&f!=="properties"&&this.setAttribute(t,f,e[f])}}catch(c){l={error:c}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}},r.prototype.replace=function(t,e){return this.insert(t,e),this.remove(e),e},r.prototype.childNode=function(t,e){return this.childNodes(t)[e]},r.prototype.allClasses=function(t){var e=this.getAttribute(t,"class");return e?e.replace(/ +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]},r}();i7.AbstractDOMAdaptor=LD;var Mx={},H1={};(function(r){var t=_&&_.__values||function(g){var v=typeof Symbol=="function"&&Symbol.iterator,L=v&&g[v],x=0;if(L)return L.call(g);if(g&&typeof g.length=="number")return{next:function(){return g&&x>=g.length&&(g=void 0),{value:g&&g[x++],done:!g}}};throw new TypeError(v?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(g,v){var L=typeof Symbol=="function"&&g[Symbol.iterator];if(!L)return g;var x=L.call(g),b,S=[],E;try{for(;(v===void 0||v-- >0)&&!(b=x.next()).done;)S.push(b.value)}catch(A){E={error:A}}finally{try{b&&!b.done&&(L=x.return)&&L.call(x)}finally{if(E)throw E.error}}return S},n=_&&_.__spreadArray||function(g,v,L){if(L||arguments.length===2)for(var x=0,b=v.length,S;x<b;x++)(S||!(x in v))&&(S||(S=Array.prototype.slice.call(v,0,x)),S[x]=v[x]);return g.concat(S||Array.prototype.slice.call(v))};Object.defineProperty(r,"__esModule",{value:!0}),r.lookup=r.separateOptions=r.selectOptionsFromKeys=r.selectOptions=r.userOptions=r.defaultOptions=r.insert=r.copy=r.keys=r.makeArray=r.expandable=r.Expandable=r.OPTIONS=r.REMOVE=r.APPEND=r.isObject=void 0;var s={}.constructor;function a(g){return typeof g=="object"&&g!==null&&(g.constructor===s||g.constructor===o)}r.isObject=a,r.APPEND="[+]",r.REMOVE="[-]",r.OPTIONS={invalidOption:"warn",optionError:function(g,v){if(r.OPTIONS.invalidOption==="fatal")throw new Error(g);console.warn("MathJax: "+g)}};var o=function(){function g(){}return g}();r.Expandable=o;function l(g){return Object.assign(Object.create(o.prototype),g)}r.expandable=l;function u(g){return Array.isArray(g)?g:[g]}r.makeArray=u;function h(g){return g?Object.keys(g).concat(Object.getOwnPropertySymbols(g)):[]}r.keys=h;function T(g){var v,L,x={};try{for(var b=t(h(g)),S=b.next();!S.done;S=b.next()){var E=S.value,A=Object.getOwnPropertyDescriptor(g,E),M=A.value;Array.isArray(M)?A.value=f([],M,!1):a(M)&&(A.value=T(M)),A.enumerable&&(x[E]=A)}}catch(D){v={error:D}}finally{try{S&&!S.done&&(L=b.return)&&L.call(b)}finally{if(v)throw v.error}}return Object.defineProperties(g.constructor===o?l({}):{},x)}r.copy=T;function f(g,v,L){var x,b;L===void 0&&(L=!0);var S=function(D){if(L&&g[D]===void 0&&g.constructor!==o)return typeof D=="symbol"&&(D=D.toString()),r.OPTIONS.optionError('Invalid option "'.concat(D,'" (no default value).'),D),"continue";var I=v[D],P=g[D];if(a(I)&&P!==null&&(typeof P=="object"||typeof P=="function")){var R=h(I);Array.isArray(P)&&(R.length===1&&(R[0]===r.APPEND||R[0]===r.REMOVE)&&Array.isArray(I[R[0]])||R.length===2&&R.sort().join(",")===r.APPEND+","+r.REMOVE&&Array.isArray(I[r.APPEND])&&Array.isArray(I[r.REMOVE]))?(I[r.REMOVE]&&(P=g[D]=P.filter(function(F){return I[r.REMOVE].indexOf(F)<0})),I[r.APPEND]&&(g[D]=n(n([],e(P),!1),e(I[r.APPEND]),!1))):f(P,I,L)}else Array.isArray(I)?(g[D]=[],f(g[D],I,!1)):a(I)?g[D]=T(I):g[D]=I};try{for(var E=t(h(v)),A=E.next();!A.done;A=E.next()){var M=A.value;S(M)}}catch(D){x={error:D}}finally{try{A&&!A.done&&(b=E.return)&&b.call(E)}finally{if(x)throw x.error}}return g}r.insert=f;function d(g){for(var v=[],L=1;L<arguments.length;L++)v[L-1]=arguments[L];return v.forEach(function(x){return f(g,x,!1)}),g}r.defaultOptions=d;function p(g){for(var v=[],L=1;L<arguments.length;L++)v[L-1]=arguments[L];return v.forEach(function(x){return f(g,x,!0)}),g}r.userOptions=p;function m(g){for(var v,L,x=[],b=1;b<arguments.length;b++)x[b-1]=arguments[b];var S={};try{for(var E=t(x),A=E.next();!A.done;A=E.next()){var M=A.value;g.hasOwnProperty(M)&&(S[M]=g[M])}}catch(D){v={error:D}}finally{try{A&&!A.done&&(L=E.return)&&L.call(E)}finally{if(v)throw v.error}}return S}r.selectOptions=m;function y(g,v){return m.apply(void 0,n([g],e(Object.keys(v)),!1))}r.selectOptionsFromKeys=y;function c(g){for(var v,L,x,b,S=[],E=1;E<arguments.length;E++)S[E-1]=arguments[E];var A=[];try{for(var M=t(S),D=M.next();!D.done;D=M.next()){var I=D.value,P={},R={};try{for(var F=(x=void 0,t(Object.keys(g||{}))),X=F.next();!X.done;X=F.next()){var st=X.value;(I[st]===void 0?R:P)[st]=g[st]}}catch(rt){x={error:rt}}finally{try{X&&!X.done&&(b=F.return)&&b.call(F)}finally{if(x)throw x.error}}A.push(P),g=R}}catch(rt){v={error:rt}}finally{try{D&&!D.done&&(L=M.return)&&L.call(M)}finally{if(v)throw v.error}}return A.unshift(g),A}r.separateOptions=c;function Q(g,v,L){return L===void 0&&(L=null),v.hasOwnProperty(g)?v[g]:L}r.lookup=Q})(H1);(function(r){var t=_&&_.__extends||function(){var a=function(o,l){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,h){u.__proto__=h}||function(u,h){for(var T in h)Object.prototype.hasOwnProperty.call(h,T)&&(u[T]=h[T])},a(o,l)};return function(o,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");a(o,l);function u(){this.constructor=o}o.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}(),e=_&&_.__assign||function(){return e=Object.assign||function(a){for(var o,l=1,u=arguments.length;l<u;l++){o=arguments[l];for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(a[h]=o[h])}return a},e.apply(this,arguments)};Object.defineProperty(r,"__esModule",{value:!0}),r.NodeMixin=r.NodeMixinOptions=void 0;var n=H1;r.NodeMixinOptions={badCSS:!0,badSizes:!0};function s(a,o){var l;return o===void 0&&(o={}),o=(0,n.userOptions)((0,n.defaultOptions)({},r.NodeMixinOptions),o),l=function(u){t(h,u);function h(){for(var T=[],f=0;f<arguments.length;f++)T[f]=arguments[f];var d=u.call(this,T[0])||this,p=d.constructor;return d.options=(0,n.userOptions)((0,n.defaultOptions)({},p.OPTIONS),T[1]),d}return h.prototype.fontSize=function(T){return o.badCSS?this.options.fontSize:u.prototype.fontSize.call(this,T)},h.prototype.fontFamily=function(T){return o.badCSS?this.options.fontFamily:u.prototype.fontFamily.call(this,T)},h.prototype.nodeSize=function(T,f,d){if(f===void 0&&(f=1),d===void 0&&(d=null),!o.badSizes)return u.prototype.nodeSize.call(this,T,f,d);var p=this.textContent(T),m=Array.from(p.replace(h.cjkPattern,"")).length,y=Array.from(p).length-m;return[y*this.options.cjkCharWidth+m*this.options.unknownCharWidth,this.options.unknownCharHeight]},h.prototype.nodeBBox=function(T){return o.badSizes?{left:0,right:0,top:0,bottom:0}:u.prototype.nodeBBox.call(this,T)},h}(a),l.OPTIONS=e(e({},o.badCSS?{fontSize:16,fontFamily:"Times"}:{}),o.badSizes?{cjkCharWidth:1,unknownCharWidth:.6,unknownCharHeight:.8}:{}),l.cjkPattern=new RegExp(["[","ᄀ-ᅟ","〈〉","⺀-〾","぀-㉇","㉐-䶿","一-꓆","ꥠ-ꥼ","가-힣","豈-﫿","︐-︙","︰-﹫","!-⦆¢-₩","𛀀-𛀁","🈀-🉑","𠀀-𿿽","]"].join(""),"gu"),l}r.NodeMixin=s})(Mx);var i0={},d4={},Ec=_&&_.__assign||function(){return Ec=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ec.apply(this,arguments)},xD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},_D=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},bD=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(d4,"__esModule",{value:!0});d4.LiteElement=void 0;var SD=function(){function r(t,e,n){var s,a;e===void 0&&(e={}),n===void 0&&(n=[]),this.kind=t,this.attributes=Ec({},e),this.children=_D([],xD(n),!1);try{for(var o=bD(this.children),l=o.next();!l.done;l=o.next()){var u=l.value;u.parent=this}}catch(h){s={error:h}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(s)throw s.error}}this.styles=null}return r}();d4.LiteElement=SD;Object.defineProperty(i0,"__esModule",{value:!0});i0.LiteDocument=void 0;var T9=d4,ED=function(){function r(){this.root=new T9.LiteElement("html",{},[this.head=new T9.LiteElement("head"),this.body=new T9.LiteElement("body")]),this.type=""}return Object.defineProperty(r.prototype,"kind",{get:function(){return"#document"},enumerable:!1,configurable:!0}),r}();i0.LiteDocument=ED;var r4={},AD=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(r4,"__esModule",{value:!0});r4.LiteComment=r4.LiteText=void 0;var wx=function(){function r(t){t===void 0&&(t=""),this.value=t}return Object.defineProperty(r.prototype,"kind",{get:function(){return"#text"},enumerable:!1,configurable:!0}),r}();r4.LiteText=wx;var HD=function(r){AD(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"#comment"},enumerable:!1,configurable:!0}),t}(wx);r4.LiteComment=HD;var r7={},n7={},MD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},wD=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(n7,"__esModule",{value:!0});n7.LiteList=void 0;var CD=function(){function r(t){this.nodes=[],this.nodes=wD([],MD(t),!1)}return r.prototype.append=function(t){this.nodes.push(t)},r.prototype[Symbol.iterator]=function(){var t=0;return{next:function(){return t===this.nodes.length?{value:null,done:!0}:{value:this.nodes[t++],done:!1}}}},r}();n7.LiteList=CD;var cT={},zn={},fr={};Object.defineProperty(fr,"__esModule",{value:!0});fr.retryAfter=fr.handleRetriesFor=void 0;function DD(r){return new Promise(function t(e,n){try{e(r())}catch(s){s.retry&&s.retry instanceof Promise?s.retry.then(function(){return t(e,n)}).catch(function(a){return n(a)}):s.restart&&s.restart.isCallback?MathJax.Callback.After(function(){return t(e,n)},s.restart):n(s)}})}fr.handleRetriesFor=DD;function OD(r){var t=new Error("MathJax retry");throw t.retry=r,t}fr.retryAfter=OD;var s7={},a7={},o7={};Object.defineProperty(o7,"__esModule",{value:!0});o7.VERSION=void 0;o7.VERSION="3.2.2";var l7={},mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.PrioritizedList=void 0;var ID=function(){function r(){this.items=[],this.items=[]}return r.prototype[Symbol.iterator]=function(){var t=0,e=this.items;return{next:function(){return{value:e[t++],done:t>e.length}}}},r.prototype.add=function(t,e){e===void 0&&(e=r.DEFAULTPRIORITY);var n=this.items.length;do n--;while(n>=0&&e<this.items[n].priority);return this.items.splice(n+1,0,{item:t,priority:e}),t},r.prototype.remove=function(t){var e=this.items.length;do e--;while(e>=0&&this.items[e].item!==t);e>=0&&this.items.splice(e,1)},r.DEFAULTPRIORITY=5,r}();mr.PrioritizedList=ID;var VD=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),PD=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(l7,"__esModule",{value:!0});l7.HandlerList=void 0;var kD=mr,RD=function(r){VD(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.register=function(e){return this.add(e,e.priority)},t.prototype.unregister=function(e){this.remove(e)},t.prototype.handlesDocument=function(e){var n,s;try{for(var a=PD(this),o=a.next();!o.done;o=a.next()){var l=o.value,u=l.item;if(u.handlesDocument(e))return u}}catch(h){n={error:h}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}throw new Error("Can't find handler for document")},t.prototype.document=function(e,n){return n===void 0&&(n=null),this.handlesDocument(e).create(e,n)},t}(kD.PrioritizedList);l7.HandlerList=RD;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.mathjax=void 0;var t=o7,e=l7,n=fr;r.mathjax={version:t.VERSION,handlers:new e.HandlerList,document:function(s,a){return r.mathjax.handlers.document(s,a)},handleRetriesFor:n.handleRetriesFor,retryAfter:n.retryAfter,asyncLoad:null}})(a7);Object.defineProperty(s7,"__esModule",{value:!0});s7.asyncLoad=void 0;var Fd=a7;function BD(r){return Fd.mathjax.asyncLoad?new Promise(function(t,e){var n=Fd.mathjax.asyncLoad(r);n instanceof Promise?n.then(function(s){return t(s)}).catch(function(s){return e(s)}):t(n)}):Promise.reject("Can't load '".concat(r,"': No asyncLoad method specified"))}s7.asyncLoad=BD;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.numeric=r.translate=r.remove=r.add=r.entities=r.options=void 0;var t=fr,e=s7;r.options={loadMissingEntities:!0},r.entities={ApplyFunction:"⁡",Backslash:"∖",Because:"∵",Breve:"˘",Cap:"⋒",CenterDot:"·",CircleDot:"⊙",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",Congruent:"≡",ContourIntegral:"∮",Coproduct:"∐",Cross:"⨯",Cup:"⋓",CupCap:"≍",Dagger:"‡",Del:"∇",Delta:"Δ",Diamond:"⋄",DifferentialD:"ⅆ",DotEqual:"≐",DoubleDot:"¨",DoubleRightTee:"⊨",DoubleVerticalBar:"∥",DownArrow:"↓",DownLeftVector:"↽",DownRightVector:"⇁",DownTee:"⊤",Downarrow:"⇓",Element:"∈",EqualTilde:"≂",Equilibrium:"⇌",Exists:"∃",ExponentialE:"ⅇ",FilledVerySmallSquare:"▪",ForAll:"∀",Gamma:"Γ",Gg:"⋙",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Hacek:"ˇ",Hat:"^",HumpDownHump:"≎",HumpEqual:"≏",Im:"ℑ",ImaginaryI:"ⅈ",Integral:"∫",Intersection:"⋂",InvisibleComma:"⁣",InvisibleTimes:"⁢",Lambda:"Λ",Larr:"↞",LeftAngleBracket:"⟨",LeftArrow:"←",LeftArrowRightArrow:"⇆",LeftCeiling:"⌈",LeftDownVector:"⇃",LeftFloor:"⌊",LeftRightArrow:"↔",LeftTee:"⊣",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpVector:"↿",LeftVector:"↼",Leftarrow:"⇐",Leftrightarrow:"⇔",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",LessSlantEqual:"⩽",LessTilde:"≲",Ll:"⋘",Lleftarrow:"⇚",LongLeftArrow:"⟵",LongLeftRightArrow:"⟷",LongRightArrow:"⟶",Longleftarrow:"⟸",Longleftrightarrow:"⟺",Longrightarrow:"⟹",Lsh:"↰",MinusPlus:"∓",NestedGreaterGreater:"≫",NestedLessLess:"≪",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotPrecedes:"⊀",NotPrecedesSlantEqual:"⋠",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsSlantEqual:"⋡",NotSupersetEqual:"⊉",NotTilde:"≁",NotVerticalBar:"∤",Omega:"Ω",OverBar:"‾",OverBrace:"⏞",PartialD:"∂",Phi:"Φ",Pi:"Π",PlusMinus:"±",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",Product:"∏",Proportional:"∝",Psi:"Ψ",Rarr:"↠",Re:"ℜ",ReverseEquilibrium:"⇋",RightAngleBracket:"⟩",RightArrow:"→",RightArrowLeftArrow:"⇄",RightCeiling:"⌉",RightDownVector:"⇂",RightFloor:"⌋",RightTee:"⊢",RightTeeArrow:"↦",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpVector:"↾",RightVector:"⇀",Rightarrow:"⇒",Rrightarrow:"⇛",Rsh:"↱",Sigma:"Σ",SmallCircle:"∘",Sqrt:"√",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",Star:"⋆",Subset:"⋐",SubsetEqual:"⊆",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",SuchThat:"∋",Sum:"∑",Superset:"⊃",SupersetEqual:"⊇",Supset:"⋑",Therefore:"∴",Theta:"Θ",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",UnderBar:"_",UnderBrace:"⏟",Union:"⋃",UnionPlus:"⊎",UpArrow:"↑",UpDownArrow:"↕",UpTee:"⊥",Uparrow:"⇑",Updownarrow:"⇕",Upsilon:"Υ",Vdash:"⊩",Vee:"⋁",VerticalBar:"∣",VerticalTilde:"≀",Vvdash:"⊪",Wedge:"⋀",Xi:"Ξ",amp:"&",acute:"´",aleph:"ℵ",alpha:"α",amalg:"⨿",and:"∧",ang:"∠",angmsd:"∡",angsph:"∢",ape:"≊",backprime:"‵",backsim:"∽",backsimeq:"⋍",beta:"β",beth:"ℶ",between:"≬",bigcirc:"◯",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",blacklozenge:"⧫",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",bowtie:"⋈",boxdl:"┐",boxdr:"┌",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxur:"└",bsol:"\\",bull:"•",cap:"∩",check:"✓",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledR:"®",circledS:"Ⓢ",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",clubs:"♣",colon:":",comp:"∁",ctdot:"⋯",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cup:"∪",curarr:"↷",curlyvee:"⋎",curlywedge:"⋏",dagger:"†",daleth:"ℸ",ddarr:"⇊",deg:"°",delta:"δ",digamma:"ϝ",div:"÷",divideontimes:"⋇",dot:"˙",doteqdot:"≑",dotplus:"∔",dotsquare:"⊡",dtdot:"⋱",ecir:"≖",efDot:"≒",egs:"⪖",ell:"ℓ",els:"⪕",empty:"∅",epsi:"ε",epsiv:"ϵ",erDot:"≓",eta:"η",eth:"ð",flat:"♭",fork:"⋔",frown:"⌢",gEl:"⪌",gamma:"γ",gap:"⪆",gimel:"ℷ",gnE:"≩",gnap:"⪊",gne:"⪈",gnsim:"⋧",gt:">",gtdot:"⋗",harrw:"↭",hbar:"ℏ",hellip:"…",hookleftarrow:"↩",hookrightarrow:"↪",imath:"ı",infin:"∞",intcal:"⊺",iota:"ι",jmath:"ȷ",kappa:"κ",kappav:"ϰ",lEg:"⪋",lambda:"λ",lap:"⪅",larrlp:"↫",larrtl:"↢",lbrace:"{",lbrack:"[",le:"≤",leftleftarrows:"⇇",leftthreetimes:"⋋",lessdot:"⋖",lmoust:"⎰",lnE:"≨",lnap:"⪉",lne:"⪇",lnsim:"⋦",longmapsto:"⟼",looparrowright:"↬",lowast:"∗",loz:"◊",lt:"<",ltimes:"⋉",ltri:"◃",macr:"¯",malt:"✠",mho:"℧",mu:"μ",multimap:"⊸",nLeftarrow:"⇍",nLeftrightarrow:"⇎",nRightarrow:"⇏",nVDash:"⊯",nVdash:"⊮",natur:"♮",nearr:"↗",nharr:"↮",nlarr:"↚",not:"¬",nrarr:"↛",nu:"ν",nvDash:"⊭",nvdash:"⊬",nwarr:"↖",omega:"ω",omicron:"ο",or:"∨",osol:"⊘",period:".",phi:"φ",phiv:"ϕ",pi:"π",piv:"ϖ",prap:"⪷",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",prime:"′",psi:"ψ",quot:'"',rarrtl:"↣",rbrace:"}",rbrack:"]",rho:"ρ",rhov:"ϱ",rightrightarrows:"⇉",rightthreetimes:"⋌",ring:"˚",rmoust:"⎱",rtimes:"⋊",rtri:"▹",scap:"⪸",scnE:"⪶",scnap:"⪺",scnsim:"⋩",sdot:"⋅",searr:"↘",sect:"§",sharp:"♯",sigma:"σ",sigmav:"ς",simne:"≆",smile:"⌣",spades:"♠",sub:"⊂",subE:"⫅",subnE:"⫋",subne:"⊊",supE:"⫆",supnE:"⫌",supne:"⊋",swarr:"↙",tau:"τ",theta:"θ",thetav:"ϑ",tilde:"˜",times:"×",triangle:"▵",triangleq:"≜",upsi:"υ",upuparrows:"⇈",veebar:"⊻",vellip:"⋮",weierp:"℘",xi:"ξ",yen:"¥",zeta:"ζ",zigrarr:"⇝",nbsp:" ",rsquo:"’",lsquo:"‘"};var n={};function s(h,T){Object.assign(r.entities,h),n[T]=!0}r.add=s;function a(h){delete r.entities[h]}r.remove=a;function o(h){return h.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/ig,l)}r.translate=o;function l(h,T){if(T.charAt(0)==="#")return u(T.slice(1));if(r.entities[T])return r.entities[T];if(r.options.loadMissingEntities){var f=T.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:T.charAt(0).toLowerCase();n[f]||(n[f]=!0,(0,t.retryAfter)((0,e.asyncLoad)("./util/entities/"+f+".js")))}return h}function u(h){var T=h.charAt(0)==="x"?parseInt(h.slice(1),16):parseInt(h);return String.fromCodePoint(T)}r.numeric=u})(zn);(function(r){var t=_&&_.__createBinding||(Object.create?function(f,d,p,m){m===void 0&&(m=p);var y=Object.getOwnPropertyDescriptor(d,p);(!y||("get"in y?!d.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return d[p]}}),Object.defineProperty(f,m,y)}:function(f,d,p,m){m===void 0&&(m=p),f[m]=d[p]}),e=_&&_.__setModuleDefault||(Object.create?function(f,d){Object.defineProperty(f,"default",{enumerable:!0,value:d})}:function(f,d){f.default=d}),n=_&&_.__importStar||function(f){if(f&&f.__esModule)return f;var d={};if(f!=null)for(var p in f)p!=="default"&&Object.prototype.hasOwnProperty.call(f,p)&&t(d,f,p);return e(d,f),d},s=_&&_.__read||function(f,d){var p=typeof Symbol=="function"&&f[Symbol.iterator];if(!p)return f;var m=p.call(f),y,c=[],Q;try{for(;(d===void 0||d-- >0)&&!(y=m.next()).done;)c.push(y.value)}catch(g){Q={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(Q)throw Q.error}}return c},a=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.LiteParser=r.PATTERNS=void 0;var o=n(zn),l=d4,u=r4,h;(function(f){f.TAGNAME="[a-z][^\\s\\n>]*",f.ATTNAME="[a-z][^\\s\\n>=]*",f.VALUE=`(?:'[^']*'|"[^"]*"|[^\\s\\n]+)`,f.VALUESPLIT=`(?:'([^']*)'|"([^"]*)"|([^\\s\\n]+))`,f.SPACE="(?:\\s|\\n)+",f.OPTIONALSPACE="(?:\\s|\\n)*",f.ATTRIBUTE=f.ATTNAME+"(?:"+f.OPTIONALSPACE+"="+f.OPTIONALSPACE+f.VALUE+")?",f.ATTRIBUTESPLIT="("+f.ATTNAME+")(?:"+f.OPTIONALSPACE+"="+f.OPTIONALSPACE+f.VALUESPLIT+")?",f.TAG="(<(?:"+f.TAGNAME+"(?:"+f.SPACE+f.ATTRIBUTE+")*"+f.OPTIONALSPACE+"/?|/"+f.TAGNAME+"|!--[^]*?--|![^]*?)(?:>|$))",f.tag=new RegExp(f.TAG,"i"),f.attr=new RegExp(f.ATTRIBUTE,"i"),f.attrsplit=new RegExp(f.ATTRIBUTESPLIT,"i")})(h=r.PATTERNS||(r.PATTERNS={}));var T=function(){function f(){}return f.prototype.parseFromString=function(d,p,m){m===void 0&&(m=null);for(var y=m.createDocument(),c=m.body(y),Q=d.replace(/<\?.*?\?>/g,"").split(h.tag);Q.length;){var g=Q.shift(),v=Q.shift();g&&this.addText(m,c,g),v&&v.charAt(v.length-1)===">"&&(v.charAt(1)==="!"?this.addComment(m,c,v):v.charAt(1)==="/"?c=this.closeTag(m,c,v):c=this.openTag(m,c,v,Q))}return this.checkDocument(m,y),y},f.prototype.addText=function(d,p,m){return m=o.translate(m),d.append(p,d.text(m))},f.prototype.addComment=function(d,p,m){return d.append(p,new u.LiteComment(m))},f.prototype.closeTag=function(d,p,m){for(var y=m.slice(2,m.length-1).toLowerCase();d.parent(p)&&d.kind(p)!==y;)p=d.parent(p);return d.parent(p)},f.prototype.openTag=function(d,p,m,y){var c=this.constructor.PCDATA,Q=this.constructor.SELF_CLOSING,g=m.match(/<(.*?)[\s\n>\/]/)[1].toLowerCase(),v=d.node(g),L=m.replace(/^<.*?[\s\n>]/,"").split(h.attrsplit);return(L.pop().match(/>$/)||L.length<5)&&(this.addAttributes(d,v,L),d.append(p,v),!Q[g]&&!m.match(/\/>$/)&&(c[g]?this.handlePCDATA(d,v,g,y):p=v)),p},f.prototype.addAttributes=function(d,p,m){for(var y=this.constructor.CDATA_ATTR;m.length;){var c=s(m.splice(0,5),5),Q=c[1],g=c[2],v=c[3],L=c[4],x=g||v||L||"";y[Q]||(x=o.translate(x)),d.setAttribute(p,Q,x)}},f.prototype.handlePCDATA=function(d,p,m,y){for(var c=[],Q="</"+m+">",g="";y.length&&g!==Q;)c.push(g),c.push(y.shift()),g=y.shift();d.append(p,d.text(c.join("")))},f.prototype.checkDocument=function(d,p){var m,y,c,Q,g=this.getOnlyChild(d,d.body(p));if(g){try{for(var v=a(d.childNodes(d.body(p))),L=v.next();!L.done;L=v.next()){var x=L.value;if(x===g)break;x instanceof u.LiteComment&&x.value.match(/^<!DOCTYPE/)&&(p.type=x.value)}}catch(E){m={error:E}}finally{try{L&&!L.done&&(y=v.return)&&y.call(v)}finally{if(m)throw m.error}}switch(d.kind(g)){case"html":try{for(var b=a(g.children),S=b.next();!S.done;S=b.next()){var x=S.value;switch(d.kind(x)){case"head":p.head=x;break;case"body":p.body=x;break}}}catch(E){c={error:E}}finally{try{S&&!S.done&&(Q=b.return)&&Q.call(b)}finally{if(c)throw c.error}}p.root=g,d.remove(g),d.parent(p.body)!==g&&d.append(g,p.body),d.parent(p.head)!==g&&d.insert(p.head,p.body);break;case"head":p.head=d.replace(g,p.head);break;case"body":p.body=d.replace(g,p.body);break}}},f.prototype.getOnlyChild=function(d,p){var m,y,c=null;try{for(var Q=a(d.childNodes(p)),g=Q.next();!g.done;g=Q.next()){var v=g.value;if(v instanceof l.LiteElement){if(c)return null;c=v}}}catch(L){m={error:L}}finally{try{g&&!g.done&&(y=Q.return)&&y.call(Q)}finally{if(m)throw m.error}}return c},f.prototype.serialize=function(d,p,m){var y=this;m===void 0&&(m=!1);var c=this.constructor.SELF_CLOSING,Q=this.constructor.CDATA_ATTR,g=d.kind(p),v=d.allAttributes(p).map(function(b){return b.name+'="'+(Q[b.name]?b.value:y.protectAttribute(b.value))+'"'}).join(" "),L=this.serializeInner(d,p,m),x="<"+g+(v?" "+v:"")+((!m||L)&&!c[g]?">".concat(L,"</").concat(g,">"):m?"/>":">");return x},f.prototype.serializeInner=function(d,p,m){var y=this;m===void 0&&(m=!1);var c=this.constructor.PCDATA;return c.hasOwnProperty(p.kind)?d.childNodes(p).map(function(Q){return d.value(Q)}).join(""):d.childNodes(p).map(function(Q){var g=d.kind(Q);return g==="#text"?y.protectHTML(d.value(Q)):g==="#comment"?Q.value:y.serialize(d,Q,m)}).join("")},f.prototype.protectAttribute=function(d){return typeof d!="string"&&(d=String(d)),d.replace(/"/g,"&quot;")},f.prototype.protectHTML=function(d){return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},f.SELF_CLOSING={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},f.PCDATA={option:!0,textarea:!0,fieldset:!0,title:!0,style:!0,script:!0},f.CDATA_ATTR={style:!0,datafld:!0,datasrc:!0,href:!0,src:!0,longdesc:!0,usemap:!0,cite:!0,datetime:!0,action:!0,axis:!0,profile:!0,content:!0,scheme:!0},f}();r.LiteParser=T})(cT);Object.defineProperty(r7,"__esModule",{value:!0});r7.LiteWindow=void 0;var FD=d4,Nd=i0,f9=n7,ND=cT,UD=function(){function r(){this.DOMParser=ND.LiteParser,this.NodeList=f9.LiteList,this.HTMLCollection=f9.LiteList,this.HTMLElement=FD.LiteElement,this.DocumentFragment=f9.LiteList,this.Document=Nd.LiteDocument,this.document=new Nd.LiteDocument}return r}();r7.LiteWindow=UD;var Wn={},z2=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},hT=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},jD=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.Styles=void 0;var p6=["top","right","bottom","left"],ys=["width","style","color"];function TT(r){for(var t=r.split(/((?:'[^']*'|"[^"]*"|,[\s\n]|[^\s\n])*)/g),e=[];t.length>1;)t.shift(),e.push(t.shift());return e}function vs(r){var t,e,n=TT(this.styles[r]);n.length===0&&n.push(""),n.length===1&&n.push(n[0]),n.length===2&&n.push(n[0]),n.length===3&&n.push(n[1]);try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value;this.setStyle(this.childName(r,o),n.shift())}}catch(l){t={error:l}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}function GD(r){var t,e,n=yr.connect[r].children,s=[];try{for(var a=z2(n),o=a.next();!o.done;o=a.next()){var l=o.value,u=this.styles[r+"-"+l];if(!u){delete this.styles[r];return}s.push(u)}}catch(h){t={error:h}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}s[3]===s[1]&&(s.pop(),s[2]===s[0]&&(s.pop(),s[1]===s[0]&&s.pop())),this.styles[r]=s.join(" ")}function zD(r){var t,e;try{for(var n=z2(yr.connect[r].children),s=n.next();!s.done;s=n.next()){var a=s.value;this.setStyle(this.childName(r,a),this.styles[r])}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}function WD(r){var t,e,n=jD([],hT(yr.connect[r].children),!1),s=this.styles[this.childName(r,n.shift())];try{for(var a=z2(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(this.styles[this.childName(r,l)]!==s){delete this.styles[r];return}}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}this.styles[r]=s}var Ud={width:/^(?:[\d.]+(?:[a-z]+)|thin|medium|thick|inherit|initial|unset)$/,style:/^(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|unset)$/};function Ls(r){var t,e,n,s,a={width:"",style:"",color:""};try{for(var o=z2(TT(this.styles[r])),l=o.next();!l.done;l=o.next()){var u=l.value;u.match(Ud.width)&&a.width===""?a.width=u:u.match(Ud.style)&&a.style===""?a.style=u:a.color=u}}catch(d){t={error:d}}finally{try{l&&!l.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}try{for(var h=z2(yr.connect[r].children),T=h.next();!T.done;T=h.next()){var f=T.value;this.setStyle(this.childName(r,f),a[f])}}catch(d){n={error:d}}finally{try{T&&!T.done&&(s=h.return)&&s.call(h)}finally{if(n)throw n.error}}}function xs(r){var t,e,n=[];try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.styles[this.childName(r,o)];l&&n.push(l)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}n.length?this.styles[r]=n.join(" "):delete this.styles[r]}var jd={style:/^(?:normal|italic|oblique|inherit|initial|unset)$/,variant:new RegExp("^(?:"+["normal|none","inherit|initial|unset","common-ligatures|no-common-ligatures","discretionary-ligatures|no-discretionary-ligatures","historical-ligatures|no-historical-ligatures","contextual|no-contextual","(?:stylistic|character-variant|swash|ornaments|annotation)\\([^)]*\\)","small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","lining-nums|oldstyle-nums|proportional-nums|tabular-nums","diagonal-fractions|stacked-fractions","ordinal|slashed-zero","jis78|jis83|jis90|jis04|simplified|traditional","full-width|proportional-width","ruby"].join("|")+")$"),weight:/^(?:normal|bold|bolder|lighter|[1-9]00|inherit|initial|unset)$/,stretch:new RegExp("^(?:"+["normal","(?:(?:ultra|extra|semi)-)?condensed","(?:(?:semi|extra|ulta)-)?expanded","inherit|initial|unset"].join("|")+")$"),size:new RegExp("^(?:"+["xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller","[d.]+%|[d.]+[a-z]+","inherit|initial|unset"].join("|")+")(?:/(?:normal|[d.+](?:%|[a-z]+)?))?$")};function qD(r){var t,e,n,s,a=TT(this.styles[r]),o={style:"",variant:[],weight:"",stretch:"",size:"",family:"","line-height":""};try{for(var l=z2(a),u=l.next();!u.done;u=l.next()){var h=u.value;o.family=h;try{for(var T=(n=void 0,z2(Object.keys(jd))),f=T.next();!f.done;f=T.next()){var d=f.value;if((Array.isArray(o[d])||o[d]==="")&&h.match(jd[d]))if(d==="size"){var p=hT(h.split(/\//),2),m=p[0],y=p[1];o[d]=m,y&&(o["line-height"]=y)}else o.size===""&&(Array.isArray(o[d])?o[d].push(h):o[d]=h)}}catch(c){n={error:c}}finally{try{f&&!f.done&&(s=T.return)&&s.call(T)}finally{if(n)throw n.error}}}}catch(c){t={error:c}}finally{try{u&&!u.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}ZD(r,o),delete this.styles[r]}function ZD(r,t){var e,n;try{for(var s=z2(yr.connect[r].children),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.childName(r,o);if(Array.isArray(t[o])){var u=t[o];u.length&&(this.styles[l]=u.join(" "))}else t[o]!==""&&(this.styles[l]=t[o])}}catch(h){e={error:h}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}function KD(r){}var yr=function(){function r(t){t===void 0&&(t=""),this.parse(t)}return Object.defineProperty(r.prototype,"cssText",{get:function(){var t,e,n=[];try{for(var s=z2(Object.keys(this.styles)),a=s.next();!a.done;a=s.next()){var o=a.value,l=this.parentName(o);this.styles[l]||n.push(o+": "+this.styles[o]+";")}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n.join(" ")},enumerable:!1,configurable:!0}),r.prototype.set=function(t,e){for(t=this.normalizeName(t),this.setStyle(t,e),r.connect[t]&&!r.connect[t].combine&&(this.combineChildren(t),delete this.styles[t]);t.match(/-/)&&(t=this.parentName(t),!!r.connect[t]);)r.connect[t].combine.call(this,t)},r.prototype.get=function(t){return t=this.normalizeName(t),this.styles.hasOwnProperty(t)?this.styles[t]:""},r.prototype.setStyle=function(t,e){this.styles[t]=e,r.connect[t]&&r.connect[t].children&&r.connect[t].split.call(this,t),e===""&&delete this.styles[t]},r.prototype.combineChildren=function(t){var e,n,s=this.parentName(t);try{for(var a=z2(r.connect[t].children),o=a.next();!o.done;o=a.next()){var l=o.value,u=this.childName(s,l);r.connect[u].combine.call(this,u)}}catch(h){e={error:h}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},r.prototype.parentName=function(t){var e=t.replace(/-[^-]*$/,"");return t===e?"":e},r.prototype.childName=function(t,e){return e.match(/-/)?e:(r.connect[t]&&!r.connect[t].combine&&(e+=t.replace(/.*-/,"-"),t=this.parentName(t)),t+"-"+e)},r.prototype.normalizeName=function(t){return t.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})},r.prototype.parse=function(t){t===void 0&&(t="");var e=this.constructor.pattern;this.styles={};for(var n=t.replace(e.comment,"").split(e.style);n.length>1;){var s=hT(n.splice(0,3),3),a=s[0],o=s[1],l=s[2];if(a.match(/[^\s\n]/))return;this.set(o,l)}},r.pattern={style:/([-a-z]+)[\s\n]*:[\s\n]*((?:'[^']*'|"[^"]*"|\n|.)*?)[\s\n]*(?:;|$)/g,comment:/\/\*[^]*?\*\//g},r.connect={padding:{children:p6,split:vs,combine:GD},border:{children:p6,split:zD,combine:WD},"border-top":{children:ys,split:Ls,combine:xs},"border-right":{children:ys,split:Ls,combine:xs},"border-bottom":{children:ys,split:Ls,combine:xs},"border-left":{children:ys,split:Ls,combine:xs},"border-width":{children:p6,split:vs,combine:null},"border-style":{children:p6,split:vs,combine:null},"border-color":{children:p6,split:vs,combine:null},font:{children:["style","variant","weight","stretch","line-height","size","family"],split:qD,combine:KD}},r}();Wn.Styles=yr;var Cx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ac=_&&_.__assign||function(){return Ac=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ac.apply(this,arguments)},Gd=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},XD=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},$D=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Zr,"__esModule",{value:!0});var Dx=Zr.liteAdaptor=Zr.LiteAdaptor=Zr.LiteBase=void 0,YD=i7,JD=Mx,tO=i0,zd=d4,g6=r4,eO=r7,iO=cT,Wd=Wn,Ox=function(r){Cx(t,r);function t(){var e=r.call(this)||this;return e.parser=new iO.LiteParser,e.window=new eO.LiteWindow,e}return t.prototype.parse=function(e,n){return this.parser.parseFromString(e,n,this)},t.prototype.create=function(e,n){return new zd.LiteElement(e)},t.prototype.text=function(e){return new g6.LiteText(e)},t.prototype.comment=function(e){return new g6.LiteComment(e)},t.prototype.createDocument=function(){return new tO.LiteDocument},t.prototype.head=function(e){return e.head},t.prototype.body=function(e){return e.body},t.prototype.root=function(e){return e.root},t.prototype.doctype=function(e){return e.type},t.prototype.tags=function(e,n,s){s===void 0&&(s=null);var a=[],o=[];if(s)return o;for(var l=e;l;){var u=l.kind;u!=="#text"&&u!=="#comment"&&(l=l,u===n&&o.push(l),l.children.length&&(a=l.children.concat(a))),l=a.shift()}return o},t.prototype.elementById=function(e,n){for(var s=[],a=e;a;){if(a.kind!=="#text"&&a.kind!=="#comment"){if(a=a,a.attributes.id===n)return a;a.children.length&&(s=a.children.concat(s))}a=s.shift()}return null},t.prototype.elementsByClass=function(e,n){for(var s=[],a=[],o=e;o;){if(o.kind!=="#text"&&o.kind!=="#comment"){o=o;var l=(o.attributes.class||"").trim().split(/ +/);l.includes(n)&&a.push(o),o.children.length&&(s=o.children.concat(s))}o=s.shift()}return a},t.prototype.getElements=function(e,n){var s,a,o=[],l=this.body(n);try{for(var u=Gd(e),h=u.next();!h.done;h=u.next()){var T=h.value;if(typeof T=="string")if(T.charAt(0)==="#"){var f=this.elementById(l,T.slice(1));f&&o.push(f)}else T.charAt(0)==="."?o=o.concat(this.elementsByClass(l,T.slice(1))):T.match(/^[-a-z][-a-z0-9]*$/i)&&(o=o.concat(this.tags(l,T)));else Array.isArray(T)?o=o.concat(T):T instanceof this.window.NodeList||T instanceof this.window.HTMLCollection?o=o.concat(T.nodes):o.push(T)}}catch(d){s={error:d}}finally{try{h&&!h.done&&(a=u.return)&&a.call(u)}finally{if(s)throw s.error}}return o},t.prototype.contains=function(e,n){for(;n&&n!==e;)n=this.parent(n);return!!n},t.prototype.parent=function(e){return e.parent},t.prototype.childIndex=function(e){return e.parent?e.parent.children.findIndex(function(n){return n===e}):-1},t.prototype.append=function(e,n){return n.parent&&this.remove(n),e.children.push(n),n.parent=e,n},t.prototype.insert=function(e,n){if(e.parent&&this.remove(e),n&&n.parent){var s=this.childIndex(n);n.parent.children.splice(s,0,e),e.parent=n.parent}},t.prototype.remove=function(e){var n=this.childIndex(e);return n>=0&&e.parent.children.splice(n,1),e.parent=null,e},t.prototype.replace=function(e,n){var s=this.childIndex(n);return s>=0&&(n.parent.children[s]=e,e.parent=n.parent,n.parent=null),n},t.prototype.clone=function(e){var n=this,s=new zd.LiteElement(e.kind);return s.attributes=Ac({},e.attributes),s.children=e.children.map(function(a){if(a.kind==="#text")return new g6.LiteText(a.value);if(a.kind==="#comment")return new g6.LiteComment(a.value);var o=n.clone(a);return o.parent=s,o}),s},t.prototype.split=function(e,n){var s=new g6.LiteText(e.value.slice(n));return e.value=e.value.slice(0,n),e.parent.children.splice(this.childIndex(e)+1,0,s),s.parent=e.parent,s},t.prototype.next=function(e){var n=e.parent;if(!n)return null;var s=this.childIndex(e)+1;return s>=0&&s<n.children.length?n.children[s]:null},t.prototype.previous=function(e){var n=e.parent;if(!n)return null;var s=this.childIndex(e)-1;return s>=0?n.children[s]:null},t.prototype.firstChild=function(e){return e.children[0]},t.prototype.lastChild=function(e){return e.children[e.children.length-1]},t.prototype.childNodes=function(e){return $D([],XD(e.children),!1)},t.prototype.childNode=function(e,n){return e.children[n]},t.prototype.kind=function(e){return e.kind},t.prototype.value=function(e){return e.kind==="#text"?e.value:e.kind==="#comment"?e.value.replace(/^<!(--)?((?:.|\n)*)\1>$/,"$2"):""},t.prototype.textContent=function(e){var n=this;return e.children.reduce(function(s,a){return s+(a.kind==="#text"?a.value:a.kind==="#comment"?"":n.textContent(a))},"")},t.prototype.innerHTML=function(e){return this.parser.serializeInner(this,e)},t.prototype.outerHTML=function(e){return this.parser.serialize(this,e)},t.prototype.serializeXML=function(e){return this.parser.serialize(this,e,!0)},t.prototype.setAttribute=function(e,n,s,a){a===void 0&&(a=null),typeof s!="string"&&(s=String(s)),a&&(n=a.replace(/.*\//,"")+":"+n.replace(/^.*:/,"")),e.attributes[n]=s,n==="style"&&(e.styles=null)},t.prototype.getAttribute=function(e,n){return e.attributes[n]},t.prototype.removeAttribute=function(e,n){delete e.attributes[n]},t.prototype.hasAttribute=function(e,n){return e.attributes.hasOwnProperty(n)},t.prototype.allAttributes=function(e){var n,s,a=e.attributes,o=[];try{for(var l=Gd(Object.keys(a)),u=l.next();!u.done;u=l.next()){var h=u.value;o.push({name:h,value:a[h]})}}catch(T){n={error:T}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}return o},t.prototype.addClass=function(e,n){var s=(e.attributes.class||"").split(/ /);s.find(function(a){return a===n})||(s.push(n),e.attributes.class=s.join(" "))},t.prototype.removeClass=function(e,n){var s=(e.attributes.class||"").split(/ /),a=s.findIndex(function(o){return o===n});a>=0&&(s.splice(a,1),e.attributes.class=s.join(" "))},t.prototype.hasClass=function(e,n){var s=(e.attributes.class||"").split(/ /);return!!s.find(function(a){return a===n})},t.prototype.setStyle=function(e,n,s){e.styles||(e.styles=new Wd.Styles(this.getAttribute(e,"style"))),e.styles.set(n,s),e.attributes.style=e.styles.cssText},t.prototype.getStyle=function(e,n){if(!e.styles){var s=this.getAttribute(e,"style");if(!s)return"";e.styles=new Wd.Styles(s)}return e.styles.get(n)},t.prototype.allStyles=function(e){return this.getAttribute(e,"style")},t.prototype.insertRules=function(e,n){e.children=[this.text(n.join(`
114
114
 
115
115
  `)+`
116
116
 
117
117
  `+this.textContent(e))]},t.prototype.fontSize=function(e){return 0},t.prototype.fontFamily=function(e){return""},t.prototype.nodeSize=function(e,n,s){return[0,0]},t.prototype.nodeBBox=function(e){return{left:0,right:0,top:0,bottom:0}},t}(YD.AbstractDOMAdaptor);Zr.LiteBase=Ox;var Ix=function(r){Cx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}((0,JD.NodeMixin)(Ox));Zr.LiteAdaptor=Ix;function rO(r){return r===void 0&&(r=null),new Ix(null,r)}Dx=Zr.liteAdaptor=rO;var fT={},u7={},c7={},QT={},r0={},p4={},nO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),sO=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qd=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Zd=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(p4,"__esModule",{value:!0});p4.FunctionList=void 0;var aO=mr,oO=function(r){nO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.execute=function(){for(var e,n,s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];try{for(var o=sO(this),l=o.next();!l.done;l=o.next()){var u=l.value,h=u.item.apply(u,Zd([],qd(s),!1));if(h===!1)return!1}}catch(T){e={error:T}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},t.prototype.asyncExecute=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var s=-1,a=this.items;return new Promise(function(o,l){(function u(){for(var h;++s<a.length;){var T=(h=a[s]).item.apply(h,Zd([],qd(e),!1));if(T instanceof Promise){T.then(u).catch(function(f){return l(f)});return}if(T===!1){o(!1);return}}o(!0)})()})},t}(aO.PrioritizedList);p4.FunctionList=oO;Object.defineProperty(r0,"__esModule",{value:!0});r0.AbstractInputJax=void 0;var Kd=H1,Xd=p4,lO=function(){function r(t){t===void 0&&(t={}),this.adaptor=null,this.mmlFactory=null;var e=this.constructor;this.options=(0,Kd.userOptions)((0,Kd.defaultOptions)({},e.OPTIONS),t),this.preFilters=new Xd.FunctionList,this.postFilters=new Xd.FunctionList}return Object.defineProperty(r.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),r.prototype.setAdaptor=function(t){this.adaptor=t},r.prototype.setMmlFactory=function(t){this.mmlFactory=t},r.prototype.initialize=function(){},r.prototype.reset=function(){},Object.defineProperty(r.prototype,"processStrings",{get:function(){return!0},enumerable:!1,configurable:!0}),r.prototype.findMath=function(t,e){return[]},r.prototype.executeFilters=function(t,e,n,s){var a={math:e,document:n,data:s};return t.execute(a),a.data},r.NAME="generic",r.OPTIONS={},r}();r0.AbstractInputJax=lO;var n0={};Object.defineProperty(n0,"__esModule",{value:!0});n0.AbstractOutputJax=void 0;var $d=H1,uO=p4,cO=function(){function r(t){t===void 0&&(t={}),this.adaptor=null;var e=this.constructor;this.options=(0,$d.userOptions)((0,$d.defaultOptions)({},e.OPTIONS),t),this.postFilters=new uO.FunctionList}return Object.defineProperty(r.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),r.prototype.setAdaptor=function(t){this.adaptor=t},r.prototype.initialize=function(){},r.prototype.reset=function(){},r.prototype.getMetrics=function(t){},r.prototype.styleSheet=function(t){return null},r.prototype.pageElements=function(t){return null},r.prototype.executeFilters=function(t,e,n,s){var a={math:e,document:n,data:s};return t.execute(a),a.data},r.NAME="generic",r.OPTIONS={},r}();n0.AbstractOutputJax=cO;var s0={},Vx={};(function(r){var t=_&&_.__generator||function(l,u){var h={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},T,f,d,p;return p={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function m(c){return function(Q){return y([c,Q])}}function y(c){if(T)throw new TypeError("Generator is already executing.");for(;h;)try{if(T=1,f&&(d=c[0]&2?f.return:c[0]?f.throw||((d=f.return)&&d.call(f),0):f.next)&&!(d=d.call(f,c[1])).done)return d;switch(f=0,d&&(c=[c[0]&2,d.value]),c[0]){case 0:case 1:d=c;break;case 4:return h.label++,{value:c[1],done:!1};case 5:h.label++,f=c[1],c=[0];continue;case 7:c=h.ops.pop(),h.trys.pop();continue;default:if(d=h.trys,!(d=d.length>0&&d[d.length-1])&&(c[0]===6||c[0]===2)){h=0;continue}if(c[0]===3&&(!d||c[1]>d[0]&&c[1]<d[3])){h.label=c[1];break}if(c[0]===6&&h.label<d[1]){h.label=d[1],d=c;break}if(d&&h.label<d[2]){h.label=d[2],h.ops.push(c);break}d[2]&&h.ops.pop(),h.trys.pop();continue}c=u.call(l,h)}catch(Q){c=[6,Q],f=0}finally{T=d=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},e=_&&_.__read||function(l,u){var h=typeof Symbol=="function"&&l[Symbol.iterator];if(!h)return l;var T=h.call(l),f,d=[],p;try{for(;(u===void 0||u-- >0)&&!(f=T.next()).done;)d.push(f.value)}catch(m){p={error:m}}finally{try{f&&!f.done&&(h=T.return)&&h.call(T)}finally{if(p)throw p.error}}return d},n=_&&_.__spreadArray||function(l,u,h){if(h||arguments.length===2)for(var T=0,f=u.length,d;T<f;T++)(d||!(T in u))&&(d||(d=Array.prototype.slice.call(u,0,T)),d[T]=u[T]);return l.concat(d||Array.prototype.slice.call(u))},s=_&&_.__values||function(l){var u=typeof Symbol=="function"&&Symbol.iterator,h=u&&l[u],T=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&T>=l.length&&(l=void 0),{value:l&&l[T++],done:!l}}};throw new TypeError(u?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.LinkedList=r.ListItem=r.END=void 0,r.END=Symbol();var a=function(){function l(u){u===void 0&&(u=null),this.next=null,this.prev=null,this.data=u}return l}();r.ListItem=a;var o=function(){function l(){for(var u=[],h=0;h<arguments.length;h++)u[h]=arguments[h];this.list=new a(r.END),this.list.next=this.list.prev=this.list,this.push.apply(this,n([],e(u),!1))}return l.prototype.isBefore=function(u,h){return u<h},l.prototype.push=function(){for(var u,h,T=[],f=0;f<arguments.length;f++)T[f]=arguments[f];try{for(var d=s(T),p=d.next();!p.done;p=d.next()){var m=p.value,y=new a(m);y.next=this.list,y.prev=this.list.prev,this.list.prev=y,y.prev.next=y}}catch(c){u={error:c}}finally{try{p&&!p.done&&(h=d.return)&&h.call(d)}finally{if(u)throw u.error}}return this},l.prototype.pop=function(){var u=this.list.prev;return u.data===r.END?null:(this.list.prev=u.prev,u.prev.next=this.list,u.next=u.prev=null,u.data)},l.prototype.unshift=function(){for(var u,h,T=[],f=0;f<arguments.length;f++)T[f]=arguments[f];try{for(var d=s(T.slice(0).reverse()),p=d.next();!p.done;p=d.next()){var m=p.value,y=new a(m);y.next=this.list.next,y.prev=this.list,this.list.next=y,y.next.prev=y}}catch(c){u={error:c}}finally{try{p&&!p.done&&(h=d.return)&&h.call(d)}finally{if(u)throw u.error}}return this},l.prototype.shift=function(){var u=this.list.next;return u.data===r.END?null:(this.list.next=u.next,u.next.prev=this.list,u.next=u.prev=null,u.data)},l.prototype.remove=function(){for(var u,h,T=[],f=0;f<arguments.length;f++)T[f]=arguments[f];var d=new Map;try{for(var p=s(T),m=p.next();!m.done;m=p.next()){var y=m.value;d.set(y,!0)}}catch(g){u={error:g}}finally{try{m&&!m.done&&(h=p.return)&&h.call(p)}finally{if(u)throw u.error}}for(var c=this.list.next;c.data!==r.END;){var Q=c.next;d.has(c.data)&&(c.prev.next=c.next,c.next.prev=c.prev,c.next=c.prev=null),c=Q}},l.prototype.clear=function(){return this.list.next.prev=this.list.prev.next=null,this.list.next=this.list.prev=this.list,this},l.prototype[Symbol.iterator]=function(){var u;return t(this,function(h){switch(h.label){case 0:u=this.list.next,h.label=1;case 1:return u.data===r.END?[3,3]:[4,u.data];case 2:return h.sent(),u=u.next,[3,1];case 3:return[2]}})},l.prototype.reversed=function(){var u;return t(this,function(h){switch(h.label){case 0:u=this.list.prev,h.label=1;case 1:return u.data===r.END?[3,3]:[4,u.data];case 2:return h.sent(),u=u.prev,[3,1];case 3:return[2]}})},l.prototype.insert=function(u,h){h===void 0&&(h=null),h===null&&(h=this.isBefore.bind(this));for(var T=new a(u),f=this.list.next;f.data!==r.END&&h(f.data,T.data);)f=f.next;return T.prev=f.prev,T.next=f,f.prev.next=f.prev=T,this},l.prototype.sort=function(u){var h,T;u===void 0&&(u=null),u===null&&(u=this.isBefore.bind(this));var f=[];try{for(var d=s(this),p=d.next();!p.done;p=d.next()){var m=p.value;f.push(new l(m))}}catch(Q){h={error:Q}}finally{try{p&&!p.done&&(T=d.return)&&T.call(d)}finally{if(h)throw h.error}}for(this.list.next=this.list.prev=this.list;f.length>1;){var y=f.shift(),c=f.shift();y.merge(c,u),f.push(y)}return f.length&&(this.list=f[0].list),this},l.prototype.merge=function(u,h){var T,f,d,p,m;h===void 0&&(h=null),h===null&&(h=this.isBefore.bind(this));for(var y=this.list.next,c=u.list.next;y.data!==r.END&&c.data!==r.END;)h(c.data,y.data)?(T=e([y,c],2),c.prev.next=T[0],y.prev.next=T[1],f=e([y.prev,c.prev],2),c.prev=f[0],y.prev=f[1],d=e([u.list,this.list],2),this.list.prev.next=d[0],u.list.prev.next=d[1],p=e([u.list.prev,this.list.prev],2),this.list.prev=p[0],u.list.prev=p[1],m=e([c.next,y],2),y=m[0],c=m[1]):y=y.next;return c.data!==r.END&&(this.list.prev.next=u.list.next,u.list.next.prev=this.list.prev,u.list.prev.next=this.list,this.list.prev=u.list.prev,u.list.next=u.list.prev=u.list),this},l}();r.LinkedList=o})(Vx);var hO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(s0,"__esModule",{value:!0});s0.AbstractMathList=void 0;var TO=Vx,fO=function(r){hO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.isBefore=function(e,n){return e.start.i<n.start.i||e.start.i===n.start.i&&e.start.n<n.start.n},t}(TO.LinkedList);s0.AbstractMathList=fO;var qn={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.newState=r.STATE=r.AbstractMathItem=r.protoItem=void 0;function t(s,a,o,l,u,h,T){T===void 0&&(T=null);var f={open:s,math:a,close:o,n:l,start:{n:u},end:{n:h},display:T};return f}r.protoItem=t;var e=function(){function s(a,o,l,u,h){l===void 0&&(l=!0),u===void 0&&(u={i:0,n:0,delim:""}),h===void 0&&(h={i:0,n:0,delim:""}),this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={},this._state=r.STATE.UNPROCESSED,this.math=a,this.inputJax=o,this.display=l,this.start=u,this.end=h,this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={}}return Object.defineProperty(s.prototype,"isEscaped",{get:function(){return this.display===null},enumerable:!1,configurable:!0}),s.prototype.render=function(a){a.renderActions.renderMath(this,a)},s.prototype.rerender=function(a,o){o===void 0&&(o=r.STATE.RERENDER),this.state()>=o&&this.state(o-1),a.renderActions.renderMath(this,a,o)},s.prototype.convert=function(a,o){o===void 0&&(o=r.STATE.LAST),a.renderActions.renderConvert(this,a,o)},s.prototype.compile=function(a){this.state()<r.STATE.COMPILED&&(this.root=this.inputJax.compile(this,a),this.state(r.STATE.COMPILED))},s.prototype.typeset=function(a){this.state()<r.STATE.TYPESET&&(this.typesetRoot=a.outputJax[this.isEscaped?"escaped":"typeset"](this,a),this.state(r.STATE.TYPESET))},s.prototype.updateDocument=function(a){},s.prototype.removeFromDocument=function(a){},s.prototype.setMetrics=function(a,o,l,u,h){this.metrics={em:a,ex:o,containerWidth:l,lineWidth:u,scale:h}},s.prototype.state=function(a,o){return a===void 0&&(a=null),o===void 0&&(o=!1),a!=null&&(a<r.STATE.INSERTED&&this._state>=r.STATE.INSERTED&&this.removeFromDocument(o),a<r.STATE.TYPESET&&this._state>=r.STATE.TYPESET&&(this.outputData={}),a<r.STATE.COMPILED&&this._state>=r.STATE.COMPILED&&(this.inputData={}),this._state=a),this._state},s.prototype.reset=function(a){a===void 0&&(a=!1),this.state(r.STATE.UNPROCESSED,a)},s}();r.AbstractMathItem=e,r.STATE={UNPROCESSED:0,FINDMATH:10,COMPILED:20,CONVERT:100,METRICS:110,RERENDER:125,TYPESET:150,INSERTED:200,LAST:1e4};function n(s,a){if(s in r.STATE)throw Error("State "+s+" already exists");r.STATE[s]=a}r.newState=n})(qn);var h7={},T7={},Zn={},QO=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Yd=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Jd=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.AbstractFactory=void 0;var dO=function(){function r(t){var e,n;t===void 0&&(t=null),this.defaultKind="unknown",this.nodeMap=new Map,this.node={},t===null&&(t=this.constructor.defaultNodes);try{for(var s=QO(Object.keys(t)),a=s.next();!a.done;a=s.next()){var o=a.value;this.setNodeClass(o,t[o])}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}return r.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return(this.node[t]||this.node[this.defaultKind]).apply(void 0,Jd([],Yd(e),!1))},r.prototype.setNodeClass=function(t,e){this.nodeMap.set(t,e);var n=this,s=this.nodeMap.get(t);this.node[t]=function(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];return new(s.bind.apply(s,Jd([void 0,n],Yd(a),!1)))}},r.prototype.getNodeClass=function(t){return this.nodeMap.get(t)},r.prototype.deleteNodeClass=function(t){this.nodeMap.delete(t),delete this.node[t]},r.prototype.nodeIsKind=function(t,e){return t instanceof this.getNodeClass(e)},r.prototype.getKinds=function(){return Array.from(this.nodeMap.keys())},r.defaultNodes={},r}();Zn.AbstractFactory=dO;var pO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(T7,"__esModule",{value:!0});T7.AbstractNodeFactory=void 0;var gO=Zn,mO=function(r){pO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.create=function(e,n,s){return n===void 0&&(n={}),s===void 0&&(s=[]),this.node[e](n,s)},t}(gO.AbstractFactory);T7.AbstractNodeFactory=mO;var f7={},jt={},Kn={};(function(r){var t=_&&_.__values||function(n){var s=typeof Symbol=="function"&&Symbol.iterator,a=s&&n[s],o=0;if(a)return a.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.Attributes=r.INHERIT=void 0,r.INHERIT="_inherit_";var e=function(){function n(s,a){this.global=a,this.defaults=Object.create(a),this.inherited=Object.create(this.defaults),this.attributes=Object.create(this.inherited),Object.assign(this.defaults,s)}return n.prototype.set=function(s,a){this.attributes[s]=a},n.prototype.setList=function(s){Object.assign(this.attributes,s)},n.prototype.get=function(s){var a=this.attributes[s];return a===r.INHERIT&&(a=this.global[s]),a},n.prototype.getExplicit=function(s){if(this.attributes.hasOwnProperty(s))return this.attributes[s]},n.prototype.getList=function(){for(var s,a,o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];var u={};try{for(var h=t(o),T=h.next();!T.done;T=h.next()){var f=T.value;u[f]=this.get(f)}}catch(d){s={error:d}}finally{try{T&&!T.done&&(a=h.return)&&a.call(h)}finally{if(s)throw s.error}}return u},n.prototype.setInherited=function(s,a){this.inherited[s]=a},n.prototype.getInherited=function(s){return this.inherited[s]},n.prototype.getDefault=function(s){return this.defaults[s]},n.prototype.isSet=function(s){return this.attributes.hasOwnProperty(s)||this.inherited.hasOwnProperty(s)},n.prototype.hasDefault=function(s){return s in this.defaults},n.prototype.getExplicitNames=function(){return Object.keys(this.attributes)},n.prototype.getInheritedNames=function(){return Object.keys(this.inherited)},n.prototype.getDefaultNames=function(){return Object.keys(this.defaults)},n.prototype.getGlobalNames=function(){return Object.keys(this.global)},n.prototype.getAllAttributes=function(){return this.attributes},n.prototype.getAllInherited=function(){return this.inherited},n.prototype.getAllDefaults=function(){return this.defaults},n.prototype.getAllGlobals=function(){return this.global},n}();r.Attributes=e})(Kn);var En={},yO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Hc=_&&_.__assign||function(){return Hc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Hc.apply(this,arguments)},m6=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(En,"__esModule",{value:!0});En.AbstractEmptyNode=En.AbstractNode=void 0;var Px=function(){function r(t,e,n){var s,a;e===void 0&&(e={}),n===void 0&&(n=[]),this.factory=t,this.parent=null,this.properties={},this.childNodes=[];try{for(var o=m6(Object.keys(e)),l=o.next();!l.done;l=o.next()){var u=l.value;this.setProperty(u,e[u])}}catch(h){s={error:h}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(s)throw s.error}}n.length&&this.setChildren(n)}return Object.defineProperty(r.prototype,"kind",{get:function(){return"unknown"},enumerable:!1,configurable:!0}),r.prototype.setProperty=function(t,e){this.properties[t]=e},r.prototype.getProperty=function(t){return this.properties[t]},r.prototype.getPropertyNames=function(){return Object.keys(this.properties)},r.prototype.getAllProperties=function(){return this.properties},r.prototype.removeProperty=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=m6(n),o=a.next();!o.done;o=a.next()){var l=o.value;delete this.properties[l]}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.prototype.isKind=function(t){return this.factory.nodeIsKind(this,t)},r.prototype.setChildren=function(t){var e,n;this.childNodes=[];try{for(var s=m6(t),a=s.next();!a.done;a=s.next()){var o=a.value;this.appendChild(o)}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},r.prototype.appendChild=function(t){return this.childNodes.push(t),t.parent=this,t},r.prototype.replaceChild=function(t,e){var n=this.childIndex(e);return n!==null&&(this.childNodes[n]=t,t.parent=this,e.parent=null),t},r.prototype.removeChild=function(t){var e=this.childIndex(t);return e!==null&&(this.childNodes.splice(e,1),t.parent=null),t},r.prototype.childIndex=function(t){var e=this.childNodes.indexOf(t);return e===-1?null:e},r.prototype.copy=function(){var t,e,n=this.factory.create(this.kind);n.properties=Hc({},this.properties);try{for(var s=m6(this.childNodes||[]),a=s.next();!a.done;a=s.next()){var o=a.value;o&&n.appendChild(o.copy())}}catch(l){t={error:l}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n},r.prototype.findNodes=function(t){var e=[];return this.walkTree(function(n){n.isKind(t)&&e.push(n)}),e},r.prototype.walkTree=function(t,e){var n,s;t(this,e);try{for(var a=m6(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;l&&l.walkTree(t,e)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return e},r.prototype.toString=function(){return this.kind+"("+this.childNodes.join(",")+")"},r}();En.AbstractNode=Px;var vO=function(r){yO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.setChildren=function(e){},t.prototype.appendChild=function(e){return e},t.prototype.replaceChild=function(e,n){return n},t.prototype.childIndex=function(e){return null},t.prototype.walkTree=function(e,n){return e(this,n),n},t.prototype.toString=function(){return this.kind},t}(Px);En.AbstractEmptyNode=vO;(function(r){var t=_&&_.__extends||function(){var c=function(Q,g){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,L){v.__proto__=L}||function(v,L){for(var x in L)Object.prototype.hasOwnProperty.call(L,x)&&(v[x]=L[x])},c(Q,g)};return function(Q,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");c(Q,g);function v(){this.constructor=Q}Q.prototype=g===null?Object.create(g):(v.prototype=g.prototype,new v)}}(),e=_&&_.__assign||function(){return e=Object.assign||function(c){for(var Q,g=1,v=arguments.length;g<v;g++){Q=arguments[g];for(var L in Q)Object.prototype.hasOwnProperty.call(Q,L)&&(c[L]=Q[L])}return c},e.apply(this,arguments)},n=_&&_.__values||function(c){var Q=typeof Symbol=="function"&&Symbol.iterator,g=Q&&c[Q],v=0;if(g)return g.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&v>=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(Q?"Object is not iterable.":"Symbol.iterator is not defined.")},s=_&&_.__read||function(c,Q){var g=typeof Symbol=="function"&&c[Symbol.iterator];if(!g)return c;var v=g.call(c),L,x=[],b;try{for(;(Q===void 0||Q-- >0)&&!(L=v.next()).done;)x.push(L.value)}catch(S){b={error:S}}finally{try{L&&!L.done&&(g=v.return)&&g.call(v)}finally{if(b)throw b.error}}return x};Object.defineProperty(r,"__esModule",{value:!0}),r.XMLNode=r.TextNode=r.AbstractMmlEmptyNode=r.AbstractMmlBaseNode=r.AbstractMmlLayoutNode=r.AbstractMmlTokenNode=r.AbstractMmlNode=r.indentAttributes=r.TEXCLASSNAMES=r.TEXCLASS=void 0;var a=Kn,o=En;r.TEXCLASS={ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,VCENTER:8,NONE:-1},r.TEXCLASSNAMES=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"];var l=["","thinmathspace","mediummathspace","thickmathspace"],u=[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]];r.indentAttributes=["indentalign","indentalignfirst","indentshift","indentshiftfirst"];var h=function(c){t(Q,c);function Q(g,v,L){v===void 0&&(v={}),L===void 0&&(L=[]);var x=c.call(this,g)||this;return x.prevClass=null,x.prevLevel=null,x.texclass=null,x.arity<0&&(x.childNodes=[g.create("inferredMrow")],x.childNodes[0].parent=x),x.setChildren(L),x.attributes=new a.Attributes(g.getNodeClass(x.kind).defaults,g.getNodeClass("math").defaults),x.attributes.setList(v),x}return Q.prototype.copy=function(g){var v,L,x,b;g===void 0&&(g=!1);var S=this.factory.create(this.kind);if(S.properties=e({},this.properties),this.attributes){var E=this.attributes.getAllAttributes();try{for(var A=n(Object.keys(E)),M=A.next();!M.done;M=A.next()){var D=M.value;(D!=="id"||g)&&S.attributes.set(D,E[D])}}catch(X){v={error:X}}finally{try{M&&!M.done&&(L=A.return)&&L.call(A)}finally{if(v)throw v.error}}}if(this.childNodes&&this.childNodes.length){var I=this.childNodes;I.length===1&&I[0].isInferred&&(I=I[0].childNodes);try{for(var P=n(I),R=P.next();!R.done;R=P.next()){var F=R.value;F?S.appendChild(F.copy()):S.childNodes.push(null)}}catch(X){x={error:X}}finally{try{R&&!R.done&&(b=P.return)&&b.call(P)}finally{if(x)throw x.error}}}return S},Object.defineProperty(Q.prototype,"texClass",{get:function(){return this.texclass},set:function(g){this.texclass=g},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isToken",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEmbellished",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isSpacelike",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"linebreakContainer",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasNewLine",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"arity",{get:function(){return 1/0},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isInferred",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"Parent",{get:function(){for(var g=this.parent;g&&g.notParent;)g=g.Parent;return g},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"notParent",{get:function(){return!1},enumerable:!1,configurable:!0}),Q.prototype.setChildren=function(g){return this.arity<0?this.childNodes[0].setChildren(g):c.prototype.setChildren.call(this,g)},Q.prototype.appendChild=function(g){var v,L,x=this;if(this.arity<0)return this.childNodes[0].appendChild(g),g;if(g.isInferred){if(this.arity===1/0)return g.childNodes.forEach(function(M){return c.prototype.appendChild.call(x,M)}),g;var b=g;g=this.factory.create("mrow"),g.setChildren(b.childNodes),g.attributes=b.attributes;try{for(var S=n(b.getPropertyNames()),E=S.next();!E.done;E=S.next()){var A=E.value;g.setProperty(A,b.getProperty(A))}}catch(M){v={error:M}}finally{try{E&&!E.done&&(L=S.return)&&L.call(S)}finally{if(v)throw v.error}}}return c.prototype.appendChild.call(this,g)},Q.prototype.replaceChild=function(g,v){return this.arity<0?(this.childNodes[0].replaceChild(g,v),g):c.prototype.replaceChild.call(this,g,v)},Q.prototype.core=function(){return this},Q.prototype.coreMO=function(){return this},Q.prototype.coreIndex=function(){return 0},Q.prototype.childPosition=function(){for(var g,v,L=this,x=L.parent;x&&x.notParent;)L=x,x=x.parent;if(x){var b=0;try{for(var S=n(x.childNodes),E=S.next();!E.done;E=S.next()){var A=E.value;if(A===L)return b;b++}}catch(M){g={error:M}}finally{try{E&&!E.done&&(v=S.return)&&v.call(S)}finally{if(g)throw g.error}}}return null},Q.prototype.setTeXclass=function(g){return this.getPrevClass(g),this.texClass!=null?this:g},Q.prototype.updateTeXclass=function(g){g&&(this.prevClass=g.prevClass,this.prevLevel=g.prevLevel,g.prevClass=g.prevLevel=null,this.texClass=g.texClass)},Q.prototype.getPrevClass=function(g){g&&(this.prevClass=g.texClass,this.prevLevel=g.attributes.get("scriptlevel"))},Q.prototype.texSpacing=function(){var g=this.prevClass!=null?this.prevClass:r.TEXCLASS.NONE,v=this.texClass||r.TEXCLASS.ORD;if(g===r.TEXCLASS.NONE||v===r.TEXCLASS.NONE)return"";g===r.TEXCLASS.VCENTER&&(g=r.TEXCLASS.ORD),v===r.TEXCLASS.VCENTER&&(v=r.TEXCLASS.ORD);var L=u[g][v];return(this.prevLevel>0||this.attributes.get("scriptlevel")>0)&&L>=0?"":l[Math.abs(L)]},Q.prototype.hasSpacingAttributes=function(){return this.isEmbellished&&this.coreMO().hasSpacingAttributes()},Q.prototype.setInheritedAttributes=function(g,v,L,x){var b,S;g===void 0&&(g={}),v===void 0&&(v=!1),L===void 0&&(L=0),x===void 0&&(x=!1);var E=this.attributes.getAllDefaults();try{for(var A=n(Object.keys(g)),M=A.next();!M.done;M=A.next()){var D=M.value;if(E.hasOwnProperty(D)||Q.alwaysInherit.hasOwnProperty(D)){var I=s(g[D],2),P=I[0],R=I[1],F=(Q.noInherit[P]||{})[this.kind]||{};F[D]||this.attributes.setInherited(D,R)}}}catch(ct){b={error:ct}}finally{try{M&&!M.done&&(S=A.return)&&S.call(A)}finally{if(b)throw b.error}}var X=this.attributes.getExplicit("displaystyle");X===void 0&&this.attributes.setInherited("displaystyle",v);var st=this.attributes.getExplicit("scriptlevel");st===void 0&&this.attributes.setInherited("scriptlevel",L),x&&this.setProperty("texprimestyle",x);var rt=this.arity;if(rt>=0&&rt!==1/0&&(rt===1&&this.childNodes.length===0||rt!==1&&this.childNodes.length!==rt))if(rt<this.childNodes.length)this.childNodes=this.childNodes.slice(0,rt);else for(;this.childNodes.length<rt;)this.appendChild(this.factory.create("mrow"));this.setChildInheritedAttributes(g,v,L,x)},Q.prototype.setChildInheritedAttributes=function(g,v,L,x){var b,S;try{for(var E=n(this.childNodes),A=E.next();!A.done;A=E.next()){var M=A.value;M.setInheritedAttributes(g,v,L,x)}}catch(D){b={error:D}}finally{try{A&&!A.done&&(S=E.return)&&S.call(E)}finally{if(b)throw b.error}}},Q.prototype.addInheritedAttributes=function(g,v){var L,x,b=e({},g);try{for(var S=n(Object.keys(v)),E=S.next();!E.done;E=S.next()){var A=E.value;A!=="displaystyle"&&A!=="scriptlevel"&&A!=="style"&&(b[A]=[this.kind,v[A]])}}catch(M){L={error:M}}finally{try{E&&!E.done&&(x=S.return)&&x.call(S)}finally{if(L)throw L.error}}return b},Q.prototype.inheritAttributesFrom=function(g){var v=g.attributes,L=v.get("displaystyle"),x=v.get("scriptlevel"),b=v.isSet("mathsize")?{mathsize:["math",v.get("mathsize")]}:{},S=g.getProperty("texprimestyle")||!1;this.setInheritedAttributes(b,L,x,S)},Q.prototype.verifyTree=function(g){if(g===void 0&&(g=null),g!==null){this.verifyAttributes(g);var v=this.arity;g.checkArity&&v>=0&&v!==1/0&&(v===1&&this.childNodes.length===0||v!==1&&this.childNodes.length!==v)&&this.mError('Wrong number of children for "'+this.kind+'" node',g,!0),this.verifyChildren(g)}},Q.prototype.verifyAttributes=function(g){var v,L;if(g.checkAttributes){var x=this.attributes,b=[];try{for(var S=n(x.getExplicitNames()),E=S.next();!E.done;E=S.next()){var A=E.value;A.substr(0,5)!=="data-"&&x.getDefault(A)===void 0&&!A.match(/^(?:class|style|id|(?:xlink:)?href)$/)&&b.push(A)}}catch(M){v={error:M}}finally{try{E&&!E.done&&(L=S.return)&&L.call(S)}finally{if(v)throw v.error}}b.length&&this.mError("Unknown attributes for "+this.kind+" node: "+b.join(", "),g)}},Q.prototype.verifyChildren=function(g){var v,L;try{for(var x=n(this.childNodes),b=x.next();!b.done;b=x.next()){var S=b.value;S.verifyTree(g)}}catch(E){v={error:E}}finally{try{b&&!b.done&&(L=x.return)&&L.call(x)}finally{if(v)throw v.error}}},Q.prototype.mError=function(g,v,L){if(L===void 0&&(L=!1),this.parent&&this.parent.isKind("merror"))return null;var x=this.factory.create("merror");if(x.attributes.set("data-mjx-message",g),v.fullErrors||L){var b=this.factory.create("mtext"),S=this.factory.create("text");S.setText(v.fullErrors?g:this.kind),b.appendChild(S),x.appendChild(b),this.parent.replaceChild(x,this)}else this.parent.replaceChild(x,this),x.appendChild(this);return x},Q.defaults={mathbackground:a.INHERIT,mathcolor:a.INHERIT,mathsize:a.INHERIT,dir:a.INHERIT},Q.noInherit={mstyle:{mpadded:{width:!0,height:!0,depth:!0,lspace:!0,voffset:!0},mtable:{width:!0,height:!0,depth:!0,align:!0}},maligngroup:{mrow:{groupalign:!0},mtable:{groupalign:!0}}},Q.alwaysInherit={scriptminsize:!0,scriptsizemultiplier:!0},Q.verifyDefaults={checkArity:!0,checkAttributes:!1,fullErrors:!1,fixMmultiscripts:!0,fixMtables:!0},Q}(o.AbstractNode);r.AbstractMmlNode=h;var T=function(c){t(Q,c);function Q(){return c!==null&&c.apply(this,arguments)||this}return Object.defineProperty(Q.prototype,"isToken",{get:function(){return!0},enumerable:!1,configurable:!0}),Q.prototype.getText=function(){var g,v,L="";try{for(var x=n(this.childNodes),b=x.next();!b.done;b=x.next()){var S=b.value;S instanceof m&&(L+=S.getText())}}catch(E){g={error:E}}finally{try{b&&!b.done&&(v=x.return)&&v.call(x)}finally{if(g)throw g.error}}return L},Q.prototype.setChildInheritedAttributes=function(g,v,L,x){var b,S;try{for(var E=n(this.childNodes),A=E.next();!A.done;A=E.next()){var M=A.value;M instanceof h&&M.setInheritedAttributes(g,v,L,x)}}catch(D){b={error:D}}finally{try{A&&!A.done&&(S=E.return)&&S.call(E)}finally{if(b)throw b.error}}},Q.prototype.walkTree=function(g,v){var L,x;g(this,v);try{for(var b=n(this.childNodes),S=b.next();!S.done;S=b.next()){var E=S.value;E instanceof h&&E.walkTree(g,v)}}catch(A){L={error:A}}finally{try{S&&!S.done&&(x=b.return)&&x.call(b)}finally{if(L)throw L.error}}return v},Q.defaults=e(e({},h.defaults),{mathvariant:"normal",mathsize:a.INHERIT}),Q}(h);r.AbstractMmlTokenNode=T;var f=function(c){t(Q,c);function Q(){return c!==null&&c.apply(this,arguments)||this}return Object.defineProperty(Q.prototype,"isSpacelike",{get:function(){return this.childNodes[0].isSpacelike},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEmbellished",{get:function(){return this.childNodes[0].isEmbellished},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Q.prototype.core=function(){return this.childNodes[0]},Q.prototype.coreMO=function(){return this.childNodes[0].coreMO()},Q.prototype.setTeXclass=function(g){return g=this.childNodes[0].setTeXclass(g),this.updateTeXclass(this.childNodes[0]),g},Q.defaults=h.defaults,Q}(h);r.AbstractMmlLayoutNode=f;var d=function(c){t(Q,c);function Q(){return c!==null&&c.apply(this,arguments)||this}return Object.defineProperty(Q.prototype,"isEmbellished",{get:function(){return this.childNodes[0].isEmbellished},enumerable:!1,configurable:!0}),Q.prototype.core=function(){return this.childNodes[0]},Q.prototype.coreMO=function(){return this.childNodes[0].coreMO()},Q.prototype.setTeXclass=function(g){var v,L;this.getPrevClass(g),this.texClass=r.TEXCLASS.ORD;var x=this.childNodes[0];x?this.isEmbellished||x.isKind("mi")?(g=x.setTeXclass(g),this.updateTeXclass(this.core())):(x.setTeXclass(null),g=this):g=this;try{for(var b=n(this.childNodes.slice(1)),S=b.next();!S.done;S=b.next()){var E=S.value;E&&E.setTeXclass(null)}}catch(A){v={error:A}}finally{try{S&&!S.done&&(L=b.return)&&L.call(b)}finally{if(v)throw v.error}}return g},Q.defaults=h.defaults,Q}(h);r.AbstractMmlBaseNode=d;var p=function(c){t(Q,c);function Q(){return c!==null&&c.apply(this,arguments)||this}return Object.defineProperty(Q.prototype,"isToken",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEmbellished",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isSpacelike",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"linebreakContainer",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasNewLine",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isInferred",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"notParent",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"Parent",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"texClass",{get:function(){return r.TEXCLASS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"prevClass",{get:function(){return r.TEXCLASS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"prevLevel",{get:function(){return 0},enumerable:!1,configurable:!0}),Q.prototype.hasSpacingAttributes=function(){return!1},Object.defineProperty(Q.prototype,"attributes",{get:function(){return null},enumerable:!1,configurable:!0}),Q.prototype.core=function(){return this},Q.prototype.coreMO=function(){return this},Q.prototype.coreIndex=function(){return 0},Q.prototype.childPosition=function(){return 0},Q.prototype.setTeXclass=function(g){return g},Q.prototype.texSpacing=function(){return""},Q.prototype.setInheritedAttributes=function(g,v,L,x){},Q.prototype.inheritAttributesFrom=function(g){},Q.prototype.verifyTree=function(g){},Q.prototype.mError=function(g,v,L){return null},Q}(o.AbstractEmptyNode);r.AbstractMmlEmptyNode=p;var m=function(c){t(Q,c);function Q(){var g=c!==null&&c.apply(this,arguments)||this;return g.text="",g}return Object.defineProperty(Q.prototype,"kind",{get:function(){return"text"},enumerable:!1,configurable:!0}),Q.prototype.getText=function(){return this.text},Q.prototype.setText=function(g){return this.text=g,this},Q.prototype.copy=function(){return this.factory.create(this.kind).setText(this.getText())},Q.prototype.toString=function(){return this.text},Q}(p);r.TextNode=m;var y=function(c){t(Q,c);function Q(){var g=c!==null&&c.apply(this,arguments)||this;return g.xml=null,g.adaptor=null,g}return Object.defineProperty(Q.prototype,"kind",{get:function(){return"XML"},enumerable:!1,configurable:!0}),Q.prototype.getXML=function(){return this.xml},Q.prototype.setXML=function(g,v){return v===void 0&&(v=null),this.xml=g,this.adaptor=v,this},Q.prototype.getSerializedXML=function(){return this.adaptor.serializeXML(this.xml)},Q.prototype.copy=function(){return this.factory.create(this.kind).setXML(this.adaptor.clone(this.xml))},Q.prototype.toString=function(){return"XML data"},Q}(p);r.XMLNode=y})(jt);var a0={},LO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Za=_&&_.__assign||function(){return Za=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Za.apply(this,arguments)};Object.defineProperty(a0,"__esModule",{value:!0});a0.MmlMath=void 0;var tp=jt,xO=function(r){LO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"math"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){this.attributes.get("mode")==="display"&&this.attributes.setInherited("display","block"),e=this.addInheritedAttributes(e,this.attributes.getAllAttributes()),n=!!this.attributes.get("displaystyle")||!this.attributes.get("displaystyle")&&this.attributes.get("display")==="block",this.attributes.setInherited("displaystyle",n),s=this.attributes.get("scriptlevel")||this.constructor.defaults.scriptlevel,r.prototype.setChildInheritedAttributes.call(this,e,n,s,a)},t.defaults=Za(Za({},tp.AbstractMmlLayoutNode.defaults),{mathvariant:"normal",mathsize:"normal",mathcolor:"",mathbackground:"transparent",dir:"ltr",scriptlevel:0,displaystyle:!1,display:"inline",maxwidth:"",overflow:"linebreak",altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:"8px",infixlinebreakstyle:"before",lineleading:"1ex",linebreakmultchar:"⁢",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),t}(tp.AbstractMmlLayoutNode);a0.MmlMath=xO;var o0={},_O=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Mc=_&&_.__assign||function(){return Mc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Mc.apply(this,arguments)};Object.defineProperty(o0,"__esModule",{value:!0});o0.MmlMi=void 0;var _s=jt,bO=function(r){_O(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=_s.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mi"},enumerable:!1,configurable:!0}),t.prototype.setInheritedAttributes=function(e,n,s,a){e===void 0&&(e={}),n===void 0&&(n=!1),s===void 0&&(s=0),a===void 0&&(a=!1),r.prototype.setInheritedAttributes.call(this,e,n,s,a);var o=this.getText();o.match(t.singleCharacter)&&!e.mathvariant&&this.attributes.setInherited("mathvariant","italic")},t.prototype.setTeXclass=function(e){this.getPrevClass(e);var n=this.getText();return n.length>1&&n.match(t.operatorName)&&this.attributes.get("mathvariant")==="normal"&&this.getProperty("autoOP")===void 0&&this.getProperty("texClass")===void 0&&(this.texClass=_s.TEXCLASS.OP,this.setProperty("autoOP",!0)),this},t.defaults=Mc({},_s.AbstractMmlTokenNode.defaults),t.operatorName=/^[a-z][a-z0-9]*$/i,t.singleCharacter=/^[\uD800-\uDBFF]?.[\u0300-\u036F\u1AB0-\u1ABE\u1DC0-\u1DFF\u20D0-\u20EF]*$/,t}(_s.AbstractMmlTokenNode);o0.MmlMi=bO;var l0={},SO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),wc=_&&_.__assign||function(){return wc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},wc.apply(this,arguments)};Object.defineProperty(l0,"__esModule",{value:!0});l0.MmlMn=void 0;var Q9=jt,EO=function(r){SO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=Q9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mn"},enumerable:!1,configurable:!0}),t.defaults=wc({},Q9.AbstractMmlTokenNode.defaults),t}(Q9.AbstractMmlTokenNode);l0.MmlMn=EO;var g4={},dT={};(function(r){var t=_&&_.__values||function(a){var o=typeof Symbol=="function"&&Symbol.iterator,l=o&&a[o],u=0;if(l)return l.call(a);if(a&&typeof a.length=="number")return{next:function(){return a&&u>=a.length&&(a=void 0),{value:a&&a[u++],done:!a}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0}),r.OPTABLE=r.MMLSPACING=r.getRange=r.RANGES=r.MO=r.OPDEF=void 0;var e=jt;function n(a,o,l,u){return l===void 0&&(l=e.TEXCLASS.BIN),u===void 0&&(u=null),[a,o,l,u]}r.OPDEF=n,r.MO={ORD:n(0,0,e.TEXCLASS.ORD),ORD11:n(1,1,e.TEXCLASS.ORD),ORD21:n(2,1,e.TEXCLASS.ORD),ORD02:n(0,2,e.TEXCLASS.ORD),ORD55:n(5,5,e.TEXCLASS.ORD),NONE:n(0,0,e.TEXCLASS.NONE),OP:n(1,2,e.TEXCLASS.OP,{largeop:!0,movablelimits:!0,symmetric:!0}),OPFIXED:n(1,2,e.TEXCLASS.OP,{largeop:!0,movablelimits:!0}),INTEGRAL:n(0,1,e.TEXCLASS.OP,{largeop:!0,symmetric:!0}),INTEGRAL2:n(1,2,e.TEXCLASS.OP,{largeop:!0,symmetric:!0}),BIN3:n(3,3,e.TEXCLASS.BIN),BIN4:n(4,4,e.TEXCLASS.BIN),BIN01:n(0,1,e.TEXCLASS.BIN),BIN5:n(5,5,e.TEXCLASS.BIN),TALLBIN:n(4,4,e.TEXCLASS.BIN,{stretchy:!0}),BINOP:n(4,4,e.TEXCLASS.BIN,{largeop:!0,movablelimits:!0}),REL:n(5,5,e.TEXCLASS.REL),REL1:n(1,1,e.TEXCLASS.REL,{stretchy:!0}),REL4:n(4,4,e.TEXCLASS.REL),RELSTRETCH:n(5,5,e.TEXCLASS.REL,{stretchy:!0}),RELACCENT:n(5,5,e.TEXCLASS.REL,{accent:!0}),WIDEREL:n(5,5,e.TEXCLASS.REL,{accent:!0,stretchy:!0}),OPEN:n(0,0,e.TEXCLASS.OPEN,{fence:!0,stretchy:!0,symmetric:!0}),CLOSE:n(0,0,e.TEXCLASS.CLOSE,{fence:!0,stretchy:!0,symmetric:!0}),INNER:n(0,0,e.TEXCLASS.INNER),PUNCT:n(0,3,e.TEXCLASS.PUNCT),ACCENT:n(0,0,e.TEXCLASS.ORD,{accent:!0}),WIDEACCENT:n(0,0,e.TEXCLASS.ORD,{accent:!0,stretchy:!0})},r.RANGES=[[32,127,e.TEXCLASS.REL,"mo"],[160,191,e.TEXCLASS.ORD,"mo"],[192,591,e.TEXCLASS.ORD,"mi"],[688,879,e.TEXCLASS.ORD,"mo"],[880,6688,e.TEXCLASS.ORD,"mi"],[6832,6911,e.TEXCLASS.ORD,"mo"],[6912,7615,e.TEXCLASS.ORD,"mi"],[7616,7679,e.TEXCLASS.ORD,"mo"],[7680,8191,e.TEXCLASS.ORD,"mi"],[8192,8303,e.TEXCLASS.ORD,"mo"],[8304,8351,e.TEXCLASS.ORD,"mo"],[8448,8527,e.TEXCLASS.ORD,"mi"],[8528,8591,e.TEXCLASS.ORD,"mn"],[8592,8703,e.TEXCLASS.REL,"mo"],[8704,8959,e.TEXCLASS.BIN,"mo"],[8960,9215,e.TEXCLASS.ORD,"mo"],[9312,9471,e.TEXCLASS.ORD,"mn"],[9472,10223,e.TEXCLASS.ORD,"mo"],[10224,10239,e.TEXCLASS.REL,"mo"],[10240,10495,e.TEXCLASS.ORD,"mtext"],[10496,10623,e.TEXCLASS.REL,"mo"],[10624,10751,e.TEXCLASS.ORD,"mo"],[10752,11007,e.TEXCLASS.BIN,"mo"],[11008,11055,e.TEXCLASS.ORD,"mo"],[11056,11087,e.TEXCLASS.REL,"mo"],[11088,11263,e.TEXCLASS.ORD,"mo"],[11264,11744,e.TEXCLASS.ORD,"mi"],[11776,11903,e.TEXCLASS.ORD,"mo"],[11904,12255,e.TEXCLASS.ORD,"mi","normal"],[12272,12351,e.TEXCLASS.ORD,"mo"],[12352,42143,e.TEXCLASS.ORD,"mi","normal"],[42192,43055,e.TEXCLASS.ORD,"mi"],[43056,43071,e.TEXCLASS.ORD,"mn"],[43072,55295,e.TEXCLASS.ORD,"mi"],[63744,64255,e.TEXCLASS.ORD,"mi","normal"],[64256,65023,e.TEXCLASS.ORD,"mi"],[65024,65135,e.TEXCLASS.ORD,"mo"],[65136,65791,e.TEXCLASS.ORD,"mi"],[65792,65935,e.TEXCLASS.ORD,"mn"],[65936,74751,e.TEXCLASS.ORD,"mi","normal"],[74752,74879,e.TEXCLASS.ORD,"mn"],[74880,113823,e.TEXCLASS.ORD,"mi","normal"],[113824,119391,e.TEXCLASS.ORD,"mo"],[119648,119679,e.TEXCLASS.ORD,"mn"],[119808,120781,e.TEXCLASS.ORD,"mi"],[120782,120831,e.TEXCLASS.ORD,"mn"],[122624,129023,e.TEXCLASS.ORD,"mo"],[129024,129279,e.TEXCLASS.REL,"mo"],[129280,129535,e.TEXCLASS.ORD,"mo"],[131072,195103,e.TEXCLASS.ORD,"mi","normnal"]];function s(a){var o,l,u=a.codePointAt(0);try{for(var h=t(r.RANGES),T=h.next();!T.done;T=h.next()){var f=T.value;if(u<=f[1]){if(u>=f[0])return f;break}}}catch(d){o={error:d}}finally{try{T&&!T.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}return null}r.getRange=s,r.MMLSPACING=[[0,0],[1,2],[3,3],[4,4],[0,0],[0,0],[0,3]],r.OPTABLE={prefix:{"(":r.MO.OPEN,"+":r.MO.BIN01,"-":r.MO.BIN01,"[":r.MO.OPEN,"{":r.MO.OPEN,"|":r.MO.OPEN,"||":[0,0,e.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"¬":r.MO.ORD21,"±":r.MO.BIN01,"‖":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"‘":[0,0,e.TEXCLASS.OPEN,{fence:!0}],"“":[0,0,e.TEXCLASS.OPEN,{fence:!0}],"ⅅ":r.MO.ORD21,"ⅆ":n(2,0,e.TEXCLASS.ORD),"∀":r.MO.ORD21,"∂":r.MO.ORD21,"∃":r.MO.ORD21,"∄":r.MO.ORD21,"∇":r.MO.ORD21,"∏":r.MO.OP,"∐":r.MO.OP,"∑":r.MO.OP,"−":r.MO.BIN01,"∓":r.MO.BIN01,"√":[1,1,e.TEXCLASS.ORD,{stretchy:!0}],"∛":r.MO.ORD11,"∜":r.MO.ORD11,"∠":r.MO.ORD,"∡":r.MO.ORD,"∢":r.MO.ORD,"∫":r.MO.INTEGRAL,"∬":r.MO.INTEGRAL,"∭":r.MO.INTEGRAL,"∮":r.MO.INTEGRAL,"∯":r.MO.INTEGRAL,"∰":r.MO.INTEGRAL,"∱":r.MO.INTEGRAL,"∲":r.MO.INTEGRAL,"∳":r.MO.INTEGRAL,"⋀":r.MO.OP,"⋁":r.MO.OP,"⋂":r.MO.OP,"⋃":r.MO.OP,"⌈":r.MO.OPEN,"⌊":r.MO.OPEN,"〈":r.MO.OPEN,"❲":r.MO.OPEN,"⟦":r.MO.OPEN,"⟨":r.MO.OPEN,"⟪":r.MO.OPEN,"⟬":r.MO.OPEN,"⟮":r.MO.OPEN,"⦀":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"⦃":r.MO.OPEN,"⦅":r.MO.OPEN,"⦇":r.MO.OPEN,"⦉":r.MO.OPEN,"⦋":r.MO.OPEN,"⦍":r.MO.OPEN,"⦏":r.MO.OPEN,"⦑":r.MO.OPEN,"⦓":r.MO.OPEN,"⦕":r.MO.OPEN,"⦗":r.MO.OPEN,"⧼":r.MO.OPEN,"⨀":r.MO.OP,"⨁":r.MO.OP,"⨂":r.MO.OP,"⨃":r.MO.OP,"⨄":r.MO.OP,"⨅":r.MO.OP,"⨆":r.MO.OP,"⨇":r.MO.OP,"⨈":r.MO.OP,"⨉":r.MO.OP,"⨊":r.MO.OP,"⨋":r.MO.INTEGRAL2,"⨌":r.MO.INTEGRAL,"⨍":r.MO.INTEGRAL2,"⨎":r.MO.INTEGRAL2,"⨏":r.MO.INTEGRAL2,"⨐":r.MO.OP,"⨑":r.MO.OP,"⨒":r.MO.OP,"⨓":r.MO.OP,"⨔":r.MO.OP,"⨕":r.MO.INTEGRAL2,"⨖":r.MO.INTEGRAL2,"⨗":r.MO.INTEGRAL2,"⨘":r.MO.INTEGRAL2,"⨙":r.MO.INTEGRAL2,"⨚":r.MO.INTEGRAL2,"⨛":r.MO.INTEGRAL2,"⨜":r.MO.INTEGRAL2,"⫼":r.MO.OP,"⫿":r.MO.OP},postfix:{"!!":n(1,0),"!":[1,0,e.TEXCLASS.CLOSE,null],'"':r.MO.ACCENT,"&":r.MO.ORD,")":r.MO.CLOSE,"++":n(0,0),"--":n(0,0),"..":n(0,0),"...":r.MO.ORD,"'":r.MO.ACCENT,"]":r.MO.CLOSE,"^":r.MO.WIDEACCENT,_:r.MO.WIDEACCENT,"`":r.MO.ACCENT,"|":r.MO.CLOSE,"}":r.MO.CLOSE,"~":r.MO.WIDEACCENT,"||":[0,0,e.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"¨":r.MO.ACCENT,ª:r.MO.ACCENT,"¯":r.MO.WIDEACCENT,"°":r.MO.ORD,"²":r.MO.ACCENT,"³":r.MO.ACCENT,"´":r.MO.ACCENT,"¸":r.MO.ACCENT,"¹":r.MO.ACCENT,º:r.MO.ACCENT,"ˆ":r.MO.WIDEACCENT,"ˇ":r.MO.WIDEACCENT,"ˉ":r.MO.WIDEACCENT,"ˊ":r.MO.ACCENT,"ˋ":r.MO.ACCENT,"ˍ":r.MO.WIDEACCENT,"˘":r.MO.ACCENT,"˙":r.MO.ACCENT,"˚":r.MO.ACCENT,"˜":r.MO.WIDEACCENT,"˝":r.MO.ACCENT,"˷":r.MO.WIDEACCENT,"̂":r.MO.WIDEACCENT,"̑":r.MO.ACCENT,"϶":r.MO.REL,"‖":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"’":[0,0,e.TEXCLASS.CLOSE,{fence:!0}],"‚":r.MO.ACCENT,"‛":r.MO.ACCENT,"”":[0,0,e.TEXCLASS.CLOSE,{fence:!0}],"„":r.MO.ACCENT,"‟":r.MO.ACCENT,"′":r.MO.ORD,"″":r.MO.ACCENT,"‴":r.MO.ACCENT,"‵":r.MO.ACCENT,"‶":r.MO.ACCENT,"‷":r.MO.ACCENT,"‾":r.MO.WIDEACCENT,"⁗":r.MO.ACCENT,"⃛":r.MO.ACCENT,"⃜":r.MO.ACCENT,"⌉":r.MO.CLOSE,"⌋":r.MO.CLOSE,"〉":r.MO.CLOSE,"⎴":r.MO.WIDEACCENT,"⎵":r.MO.WIDEACCENT,"⏜":r.MO.WIDEACCENT,"⏝":r.MO.WIDEACCENT,"⏞":r.MO.WIDEACCENT,"⏟":r.MO.WIDEACCENT,"⏠":r.MO.WIDEACCENT,"⏡":r.MO.WIDEACCENT,"■":r.MO.BIN3,"□":r.MO.BIN3,"▪":r.MO.BIN3,"▫":r.MO.BIN3,"▭":r.MO.BIN3,"▮":r.MO.BIN3,"▯":r.MO.BIN3,"▰":r.MO.BIN3,"▱":r.MO.BIN3,"▲":r.MO.BIN4,"▴":r.MO.BIN4,"▶":r.MO.BIN4,"▷":r.MO.BIN4,"▸":r.MO.BIN4,"▼":r.MO.BIN4,"▾":r.MO.BIN4,"◀":r.MO.BIN4,"◁":r.MO.BIN4,"◂":r.MO.BIN4,"◄":r.MO.BIN4,"◅":r.MO.BIN4,"◆":r.MO.BIN4,"◇":r.MO.BIN4,"◈":r.MO.BIN4,"◉":r.MO.BIN4,"◌":r.MO.BIN4,"◍":r.MO.BIN4,"◎":r.MO.BIN4,"●":r.MO.BIN4,"◖":r.MO.BIN4,"◗":r.MO.BIN4,"◦":r.MO.BIN4,"♭":r.MO.ORD02,"♮":r.MO.ORD02,"♯":r.MO.ORD02,"❳":r.MO.CLOSE,"⟧":r.MO.CLOSE,"⟩":r.MO.CLOSE,"⟫":r.MO.CLOSE,"⟭":r.MO.CLOSE,"⟯":r.MO.CLOSE,"⦀":[0,0,e.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"⦄":r.MO.CLOSE,"⦆":r.MO.CLOSE,"⦈":r.MO.CLOSE,"⦊":r.MO.CLOSE,"⦌":r.MO.CLOSE,"⦎":r.MO.CLOSE,"⦐":r.MO.CLOSE,"⦒":r.MO.CLOSE,"⦔":r.MO.CLOSE,"⦖":r.MO.CLOSE,"⦘":r.MO.CLOSE,"⧽":r.MO.CLOSE},infix:{"!=":r.MO.BIN4,"#":r.MO.ORD,$:r.MO.ORD,"%":[3,3,e.TEXCLASS.ORD,null],"&&":r.MO.BIN4,"":r.MO.ORD,"*":r.MO.BIN3,"**":n(1,1),"*=":r.MO.BIN4,"+":r.MO.BIN4,"+=":r.MO.BIN4,",":[0,3,e.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"-":r.MO.BIN4,"-=":r.MO.BIN4,"->":r.MO.BIN5,".":[0,3,e.TEXCLASS.PUNCT,{separator:!0}],"/":r.MO.ORD11,"//":n(1,1),"/=":r.MO.BIN4,":":[1,2,e.TEXCLASS.REL,null],":=":r.MO.BIN4,";":[0,3,e.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"<":r.MO.REL,"<=":r.MO.BIN5,"<>":n(1,1),"=":r.MO.REL,"==":r.MO.BIN4,">":r.MO.REL,">=":r.MO.BIN5,"?":[1,1,e.TEXCLASS.CLOSE,null],"@":r.MO.ORD11,"\\":r.MO.ORD,"^":r.MO.ORD11,_:r.MO.ORD11,"|":[2,2,e.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"||":[2,2,e.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[2,2,e.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"±":r.MO.BIN4,"·":r.MO.BIN4,"×":r.MO.BIN4,"÷":r.MO.BIN4,"ʹ":r.MO.ORD,"̀":r.MO.ACCENT,"́":r.MO.ACCENT,"̃":r.MO.WIDEACCENT,"̄":r.MO.ACCENT,"̆":r.MO.ACCENT,"̇":r.MO.ACCENT,"̈":r.MO.ACCENT,"̌":r.MO.ACCENT,"̲":r.MO.WIDEACCENT,"̸":r.MO.REL4,"―":[0,0,e.TEXCLASS.ORD,{stretchy:!0}],"‗":[0,0,e.TEXCLASS.ORD,{stretchy:!0}],"†":r.MO.BIN3,"‡":r.MO.BIN3,"•":r.MO.BIN4,"…":r.MO.INNER,"⁃":r.MO.BIN4,"⁄":r.MO.TALLBIN,"⁡":r.MO.NONE,"⁢":r.MO.NONE,"⁣":[0,0,e.TEXCLASS.NONE,{linebreakstyle:"after",separator:!0}],"⁤":r.MO.NONE,"⃗":r.MO.ACCENT,ℑ:r.MO.ORD,ℓ:r.MO.ORD,"℘":r.MO.ORD,ℜ:r.MO.ORD,"←":r.MO.WIDEREL,"↑":r.MO.RELSTRETCH,"→":r.MO.WIDEREL,"↓":r.MO.RELSTRETCH,"↔":r.MO.WIDEREL,"↕":r.MO.RELSTRETCH,"↖":r.MO.RELSTRETCH,"↗":r.MO.RELSTRETCH,"↘":r.MO.RELSTRETCH,"↙":r.MO.RELSTRETCH,"↚":r.MO.RELACCENT,"↛":r.MO.RELACCENT,"↜":r.MO.WIDEREL,"↝":r.MO.WIDEREL,"↞":r.MO.WIDEREL,"↟":r.MO.WIDEREL,"↠":r.MO.WIDEREL,"↡":r.MO.RELSTRETCH,"↢":r.MO.WIDEREL,"↣":r.MO.WIDEREL,"↤":r.MO.WIDEREL,"↥":r.MO.RELSTRETCH,"↦":r.MO.WIDEREL,"↧":r.MO.RELSTRETCH,"↨":r.MO.RELSTRETCH,"↩":r.MO.WIDEREL,"↪":r.MO.WIDEREL,"↫":r.MO.WIDEREL,"↬":r.MO.WIDEREL,"↭":r.MO.WIDEREL,"↮":r.MO.RELACCENT,"↯":r.MO.RELSTRETCH,"↰":r.MO.RELSTRETCH,"↱":r.MO.RELSTRETCH,"↲":r.MO.RELSTRETCH,"↳":r.MO.RELSTRETCH,"↴":r.MO.RELSTRETCH,"↵":r.MO.RELSTRETCH,"↶":r.MO.RELACCENT,"↷":r.MO.RELACCENT,"↸":r.MO.REL,"↹":r.MO.WIDEREL,"↺":r.MO.REL,"↻":r.MO.REL,"↼":r.MO.WIDEREL,"↽":r.MO.WIDEREL,"↾":r.MO.RELSTRETCH,"↿":r.MO.RELSTRETCH,"⇀":r.MO.WIDEREL,"⇁":r.MO.WIDEREL,"⇂":r.MO.RELSTRETCH,"⇃":r.MO.RELSTRETCH,"⇄":r.MO.WIDEREL,"⇅":r.MO.RELSTRETCH,"⇆":r.MO.WIDEREL,"⇇":r.MO.WIDEREL,"⇈":r.MO.RELSTRETCH,"⇉":r.MO.WIDEREL,"⇊":r.MO.RELSTRETCH,"⇋":r.MO.WIDEREL,"⇌":r.MO.WIDEREL,"⇍":r.MO.RELACCENT,"⇎":r.MO.RELACCENT,"⇏":r.MO.RELACCENT,"⇐":r.MO.WIDEREL,"⇑":r.MO.RELSTRETCH,"⇒":r.MO.WIDEREL,"⇓":r.MO.RELSTRETCH,"⇔":r.MO.WIDEREL,"⇕":r.MO.RELSTRETCH,"⇖":r.MO.RELSTRETCH,"⇗":r.MO.RELSTRETCH,"⇘":r.MO.RELSTRETCH,"⇙":r.MO.RELSTRETCH,"⇚":r.MO.WIDEREL,"⇛":r.MO.WIDEREL,"⇜":r.MO.WIDEREL,"⇝":r.MO.WIDEREL,"⇞":r.MO.REL,"⇟":r.MO.REL,"⇠":r.MO.WIDEREL,"⇡":r.MO.RELSTRETCH,"⇢":r.MO.WIDEREL,"⇣":r.MO.RELSTRETCH,"⇤":r.MO.WIDEREL,"⇥":r.MO.WIDEREL,"⇦":r.MO.WIDEREL,"⇧":r.MO.RELSTRETCH,"⇨":r.MO.WIDEREL,"⇩":r.MO.RELSTRETCH,"⇪":r.MO.RELSTRETCH,"⇫":r.MO.RELSTRETCH,"⇬":r.MO.RELSTRETCH,"⇭":r.MO.RELSTRETCH,"⇮":r.MO.RELSTRETCH,"⇯":r.MO.RELSTRETCH,"⇰":r.MO.WIDEREL,"⇱":r.MO.REL,"⇲":r.MO.REL,"⇳":r.MO.RELSTRETCH,"⇴":r.MO.RELACCENT,"⇵":r.MO.RELSTRETCH,"⇶":r.MO.WIDEREL,"⇷":r.MO.RELACCENT,"⇸":r.MO.RELACCENT,"⇹":r.MO.RELACCENT,"⇺":r.MO.RELACCENT,"⇻":r.MO.RELACCENT,"⇼":r.MO.RELACCENT,"⇽":r.MO.WIDEREL,"⇾":r.MO.WIDEREL,"⇿":r.MO.WIDEREL,"∁":n(1,2,e.TEXCLASS.ORD),"∅":r.MO.ORD,"∆":r.MO.BIN3,"∈":r.MO.REL,"∉":r.MO.REL,"∊":r.MO.REL,"∋":r.MO.REL,"∌":r.MO.REL,"∍":r.MO.REL,"∎":r.MO.BIN3,"−":r.MO.BIN4,"∓":r.MO.BIN4,"∔":r.MO.BIN4,"∕":r.MO.TALLBIN,"∖":r.MO.BIN4,"∗":r.MO.BIN4,"∘":r.MO.BIN4,"∙":r.MO.BIN4,"∝":r.MO.REL,"∞":r.MO.ORD,"∟":r.MO.REL,"∣":r.MO.REL,"∤":r.MO.REL,"∥":r.MO.REL,"∦":r.MO.REL,"∧":r.MO.BIN4,"∨":r.MO.BIN4,"∩":r.MO.BIN4,"∪":r.MO.BIN4,"∴":r.MO.REL,"∵":r.MO.REL,"∶":r.MO.REL,"∷":r.MO.REL,"∸":r.MO.BIN4,"∹":r.MO.REL,"∺":r.MO.BIN4,"∻":r.MO.REL,"∼":r.MO.REL,"∽":r.MO.REL,"∽̱":r.MO.BIN3,"∾":r.MO.REL,"∿":r.MO.BIN3,"≀":r.MO.BIN4,"≁":r.MO.REL,"≂":r.MO.REL,"≂̸":r.MO.REL,"≃":r.MO.REL,"≄":r.MO.REL,"≅":r.MO.REL,"≆":r.MO.REL,"≇":r.MO.REL,"≈":r.MO.REL,"≉":r.MO.REL,"≊":r.MO.REL,"≋":r.MO.REL,"≌":r.MO.REL,"≍":r.MO.REL,"≎":r.MO.REL,"≎̸":r.MO.REL,"≏":r.MO.REL,"≏̸":r.MO.REL,"≐":r.MO.REL,"≑":r.MO.REL,"≒":r.MO.REL,"≓":r.MO.REL,"≔":r.MO.REL,"≕":r.MO.REL,"≖":r.MO.REL,"≗":r.MO.REL,"≘":r.MO.REL,"≙":r.MO.REL,"≚":r.MO.REL,"≛":r.MO.REL,"≜":r.MO.REL,"≝":r.MO.REL,"≞":r.MO.REL,"≟":r.MO.REL,"≠":r.MO.REL,"≡":r.MO.REL,"≢":r.MO.REL,"≣":r.MO.REL,"≤":r.MO.REL,"≥":r.MO.REL,"≦":r.MO.REL,"≦̸":r.MO.REL,"≧":r.MO.REL,"≨":r.MO.REL,"≩":r.MO.REL,"≪":r.MO.REL,"≪̸":r.MO.REL,"≫":r.MO.REL,"≫̸":r.MO.REL,"≬":r.MO.REL,"≭":r.MO.REL,"≮":r.MO.REL,"≯":r.MO.REL,"≰":r.MO.REL,"≱":r.MO.REL,"≲":r.MO.REL,"≳":r.MO.REL,"≴":r.MO.REL,"≵":r.MO.REL,"≶":r.MO.REL,"≷":r.MO.REL,"≸":r.MO.REL,"≹":r.MO.REL,"≺":r.MO.REL,"≻":r.MO.REL,"≼":r.MO.REL,"≽":r.MO.REL,"≾":r.MO.REL,"≿":r.MO.REL,"≿̸":r.MO.REL,"⊀":r.MO.REL,"⊁":r.MO.REL,"⊂":r.MO.REL,"⊂⃒":r.MO.REL,"⊃":r.MO.REL,"⊃⃒":r.MO.REL,"⊄":r.MO.REL,"⊅":r.MO.REL,"⊆":r.MO.REL,"⊇":r.MO.REL,"⊈":r.MO.REL,"⊉":r.MO.REL,"⊊":r.MO.REL,"⊋":r.MO.REL,"⊌":r.MO.BIN4,"⊍":r.MO.BIN4,"⊎":r.MO.BIN4,"⊏":r.MO.REL,"⊏̸":r.MO.REL,"⊐":r.MO.REL,"⊐̸":r.MO.REL,"⊑":r.MO.REL,"⊒":r.MO.REL,"⊓":r.MO.BIN4,"⊔":r.MO.BIN4,"⊕":r.MO.BIN4,"⊖":r.MO.BIN4,"⊗":r.MO.BIN4,"⊘":r.MO.BIN4,"⊙":r.MO.BIN4,"⊚":r.MO.BIN4,"⊛":r.MO.BIN4,"⊜":r.MO.BIN4,"⊝":r.MO.BIN4,"⊞":r.MO.BIN4,"⊟":r.MO.BIN4,"⊠":r.MO.BIN4,"⊡":r.MO.BIN4,"⊢":r.MO.REL,"⊣":r.MO.REL,"⊤":r.MO.ORD55,"⊥":r.MO.REL,"⊦":r.MO.REL,"⊧":r.MO.REL,"⊨":r.MO.REL,"⊩":r.MO.REL,"⊪":r.MO.REL,"⊫":r.MO.REL,"⊬":r.MO.REL,"⊭":r.MO.REL,"⊮":r.MO.REL,"⊯":r.MO.REL,"⊰":r.MO.REL,"⊱":r.MO.REL,"⊲":r.MO.REL,"⊳":r.MO.REL,"⊴":r.MO.REL,"⊵":r.MO.REL,"⊶":r.MO.REL,"⊷":r.MO.REL,"⊸":r.MO.REL,"⊹":r.MO.REL,"⊺":r.MO.BIN4,"⊻":r.MO.BIN4,"⊼":r.MO.BIN4,"⊽":r.MO.BIN4,"⊾":r.MO.BIN3,"⊿":r.MO.BIN3,"⋄":r.MO.BIN4,"⋅":r.MO.BIN4,"⋆":r.MO.BIN4,"⋇":r.MO.BIN4,"⋈":r.MO.REL,"⋉":r.MO.BIN4,"⋊":r.MO.BIN4,"⋋":r.MO.BIN4,"⋌":r.MO.BIN4,"⋍":r.MO.REL,"⋎":r.MO.BIN4,"⋏":r.MO.BIN4,"⋐":r.MO.REL,"⋑":r.MO.REL,"⋒":r.MO.BIN4,"⋓":r.MO.BIN4,"⋔":r.MO.REL,"⋕":r.MO.REL,"⋖":r.MO.REL,"⋗":r.MO.REL,"⋘":r.MO.REL,"⋙":r.MO.REL,"⋚":r.MO.REL,"⋛":r.MO.REL,"⋜":r.MO.REL,"⋝":r.MO.REL,"⋞":r.MO.REL,"⋟":r.MO.REL,"⋠":r.MO.REL,"⋡":r.MO.REL,"⋢":r.MO.REL,"⋣":r.MO.REL,"⋤":r.MO.REL,"⋥":r.MO.REL,"⋦":r.MO.REL,"⋧":r.MO.REL,"⋨":r.MO.REL,"⋩":r.MO.REL,"⋪":r.MO.REL,"⋫":r.MO.REL,"⋬":r.MO.REL,"⋭":r.MO.REL,"⋮":r.MO.ORD55,"⋯":r.MO.INNER,"⋰":r.MO.REL,"⋱":[5,5,e.TEXCLASS.INNER,null],"⋲":r.MO.REL,"⋳":r.MO.REL,"⋴":r.MO.REL,"⋵":r.MO.REL,"⋶":r.MO.REL,"⋷":r.MO.REL,"⋸":r.MO.REL,"⋹":r.MO.REL,"⋺":r.MO.REL,"⋻":r.MO.REL,"⋼":r.MO.REL,"⋽":r.MO.REL,"⋾":r.MO.REL,"⋿":r.MO.REL,"⌅":r.MO.BIN3,"⌆":r.MO.BIN3,"⌢":r.MO.REL4,"⌣":r.MO.REL4,"〈":r.MO.OPEN,"〉":r.MO.CLOSE,"⎪":r.MO.ORD,"⎯":[0,0,e.TEXCLASS.ORD,{stretchy:!0}],"⎰":r.MO.OPEN,"⎱":r.MO.CLOSE,"─":r.MO.ORD,"△":r.MO.BIN4,"▵":r.MO.BIN4,"▹":r.MO.BIN4,"▽":r.MO.BIN4,"▿":r.MO.BIN4,"◃":r.MO.BIN4,"◯":r.MO.BIN3,"♠":r.MO.ORD,"♡":r.MO.ORD,"♢":r.MO.ORD,"♣":r.MO.ORD,"❘":r.MO.REL,"⟰":r.MO.RELSTRETCH,"⟱":r.MO.RELSTRETCH,"⟵":r.MO.WIDEREL,"⟶":r.MO.WIDEREL,"⟷":r.MO.WIDEREL,"⟸":r.MO.WIDEREL,"⟹":r.MO.WIDEREL,"⟺":r.MO.WIDEREL,"⟻":r.MO.WIDEREL,"⟼":r.MO.WIDEREL,"⟽":r.MO.WIDEREL,"⟾":r.MO.WIDEREL,"⟿":r.MO.WIDEREL,"⤀":r.MO.RELACCENT,"⤁":r.MO.RELACCENT,"⤂":r.MO.RELACCENT,"⤃":r.MO.RELACCENT,"⤄":r.MO.RELACCENT,"⤅":r.MO.RELACCENT,"⤆":r.MO.RELACCENT,"⤇":r.MO.RELACCENT,"⤈":r.MO.REL,"⤉":r.MO.REL,"⤊":r.MO.RELSTRETCH,"⤋":r.MO.RELSTRETCH,"⤌":r.MO.WIDEREL,"⤍":r.MO.WIDEREL,"⤎":r.MO.WIDEREL,"⤏":r.MO.WIDEREL,"⤐":r.MO.WIDEREL,"⤑":r.MO.RELACCENT,"⤒":r.MO.RELSTRETCH,"⤓":r.MO.RELSTRETCH,"⤔":r.MO.RELACCENT,"⤕":r.MO.RELACCENT,"⤖":r.MO.RELACCENT,"⤗":r.MO.RELACCENT,"⤘":r.MO.RELACCENT,"⤙":r.MO.RELACCENT,"⤚":r.MO.RELACCENT,"⤛":r.MO.RELACCENT,"⤜":r.MO.RELACCENT,"⤝":r.MO.RELACCENT,"⤞":r.MO.RELACCENT,"⤟":r.MO.RELACCENT,"⤠":r.MO.RELACCENT,"⤡":r.MO.RELSTRETCH,"⤢":r.MO.RELSTRETCH,"⤣":r.MO.REL,"⤤":r.MO.REL,"⤥":r.MO.REL,"⤦":r.MO.REL,"⤧":r.MO.REL,"⤨":r.MO.REL,"⤩":r.MO.REL,"⤪":r.MO.REL,"⤫":r.MO.REL,"⤬":r.MO.REL,"⤭":r.MO.REL,"⤮":r.MO.REL,"⤯":r.MO.REL,"⤰":r.MO.REL,"⤱":r.MO.REL,"⤲":r.MO.REL,"⤳":r.MO.RELACCENT,"⤴":r.MO.REL,"⤵":r.MO.REL,"⤶":r.MO.REL,"⤷":r.MO.REL,"⤸":r.MO.REL,"⤹":r.MO.REL,"⤺":r.MO.RELACCENT,"⤻":r.MO.RELACCENT,"⤼":r.MO.RELACCENT,"⤽":r.MO.RELACCENT,"⤾":r.MO.REL,"⤿":r.MO.REL,"⥀":r.MO.REL,"⥁":r.MO.REL,"⥂":r.MO.RELACCENT,"⥃":r.MO.RELACCENT,"⥄":r.MO.RELACCENT,"⥅":r.MO.RELACCENT,"⥆":r.MO.RELACCENT,"⥇":r.MO.RELACCENT,"⥈":r.MO.RELACCENT,"⥉":r.MO.REL,"⥊":r.MO.RELACCENT,"⥋":r.MO.RELACCENT,"⥌":r.MO.REL,"⥍":r.MO.REL,"⥎":r.MO.WIDEREL,"⥏":r.MO.RELSTRETCH,"⥐":r.MO.WIDEREL,"⥑":r.MO.RELSTRETCH,"⥒":r.MO.WIDEREL,"⥓":r.MO.WIDEREL,"⥔":r.MO.RELSTRETCH,"⥕":r.MO.RELSTRETCH,"⥖":r.MO.RELSTRETCH,"⥗":r.MO.RELSTRETCH,"⥘":r.MO.RELSTRETCH,"⥙":r.MO.RELSTRETCH,"⥚":r.MO.WIDEREL,"⥛":r.MO.WIDEREL,"⥜":r.MO.RELSTRETCH,"⥝":r.MO.RELSTRETCH,"⥞":r.MO.WIDEREL,"⥟":r.MO.WIDEREL,"⥠":r.MO.RELSTRETCH,"⥡":r.MO.RELSTRETCH,"⥢":r.MO.RELACCENT,"⥣":r.MO.REL,"⥤":r.MO.RELACCENT,"⥥":r.MO.REL,"⥦":r.MO.RELACCENT,"⥧":r.MO.RELACCENT,"⥨":r.MO.RELACCENT,"⥩":r.MO.RELACCENT,"⥪":r.MO.RELACCENT,"⥫":r.MO.RELACCENT,"⥬":r.MO.RELACCENT,"⥭":r.MO.RELACCENT,"⥮":r.MO.RELSTRETCH,"⥯":r.MO.RELSTRETCH,"⥰":r.MO.RELACCENT,"⥱":r.MO.RELACCENT,"⥲":r.MO.RELACCENT,"⥳":r.MO.RELACCENT,"⥴":r.MO.RELACCENT,"⥵":r.MO.RELACCENT,"⥶":r.MO.RELACCENT,"⥷":r.MO.RELACCENT,"⥸":r.MO.RELACCENT,"⥹":r.MO.RELACCENT,"⥺":r.MO.RELACCENT,"⥻":r.MO.RELACCENT,"⥼":r.MO.RELACCENT,"⥽":r.MO.RELACCENT,"⥾":r.MO.REL,"⥿":r.MO.REL,"⦁":r.MO.BIN3,"⦂":r.MO.BIN3,"⦙":r.MO.BIN3,"⦚":r.MO.BIN3,"⦛":r.MO.BIN3,"⦜":r.MO.BIN3,"⦝":r.MO.BIN3,"⦞":r.MO.BIN3,"⦟":r.MO.BIN3,"⦠":r.MO.BIN3,"⦡":r.MO.BIN3,"⦢":r.MO.BIN3,"⦣":r.MO.BIN3,"⦤":r.MO.BIN3,"⦥":r.MO.BIN3,"⦦":r.MO.BIN3,"⦧":r.MO.BIN3,"⦨":r.MO.BIN3,"⦩":r.MO.BIN3,"⦪":r.MO.BIN3,"⦫":r.MO.BIN3,"⦬":r.MO.BIN3,"⦭":r.MO.BIN3,"⦮":r.MO.BIN3,"⦯":r.MO.BIN3,"⦰":r.MO.BIN3,"⦱":r.MO.BIN3,"⦲":r.MO.BIN3,"⦳":r.MO.BIN3,"⦴":r.MO.BIN3,"⦵":r.MO.BIN3,"⦶":r.MO.BIN4,"⦷":r.MO.BIN4,"⦸":r.MO.BIN4,"⦹":r.MO.BIN4,"⦺":r.MO.BIN4,"⦻":r.MO.BIN4,"⦼":r.MO.BIN4,"⦽":r.MO.BIN4,"⦾":r.MO.BIN4,"⦿":r.MO.BIN4,"⧀":r.MO.REL,"⧁":r.MO.REL,"⧂":r.MO.BIN3,"⧃":r.MO.BIN3,"⧄":r.MO.BIN4,"⧅":r.MO.BIN4,"⧆":r.MO.BIN4,"⧇":r.MO.BIN4,"⧈":r.MO.BIN4,"⧉":r.MO.BIN3,"⧊":r.MO.BIN3,"⧋":r.MO.BIN3,"⧌":r.MO.BIN3,"⧍":r.MO.BIN3,"⧎":r.MO.REL,"⧏":r.MO.REL,"⧏̸":r.MO.REL,"⧐":r.MO.REL,"⧐̸":r.MO.REL,"⧑":r.MO.REL,"⧒":r.MO.REL,"⧓":r.MO.REL,"⧔":r.MO.REL,"⧕":r.MO.REL,"⧖":r.MO.BIN4,"⧗":r.MO.BIN4,"⧘":r.MO.BIN3,"⧙":r.MO.BIN3,"⧛":r.MO.BIN3,"⧜":r.MO.BIN3,"⧝":r.MO.BIN3,"⧞":r.MO.REL,"⧟":r.MO.BIN3,"⧠":r.MO.BIN3,"⧡":r.MO.REL,"⧢":r.MO.BIN4,"⧣":r.MO.REL,"⧤":r.MO.REL,"⧥":r.MO.REL,"⧦":r.MO.REL,"⧧":r.MO.BIN3,"⧨":r.MO.BIN3,"⧩":r.MO.BIN3,"⧪":r.MO.BIN3,"⧫":r.MO.BIN3,"⧬":r.MO.BIN3,"⧭":r.MO.BIN3,"⧮":r.MO.BIN3,"⧯":r.MO.BIN3,"⧰":r.MO.BIN3,"⧱":r.MO.BIN3,"⧲":r.MO.BIN3,"⧳":r.MO.BIN3,"⧴":r.MO.REL,"⧵":r.MO.BIN4,"⧶":r.MO.BIN4,"⧷":r.MO.BIN4,"⧸":r.MO.BIN3,"⧹":r.MO.BIN3,"⧺":r.MO.BIN3,"⧻":r.MO.BIN3,"⧾":r.MO.BIN4,"⧿":r.MO.BIN4,"⨝":r.MO.BIN3,"⨞":r.MO.BIN3,"⨟":r.MO.BIN3,"⨠":r.MO.BIN3,"⨡":r.MO.BIN3,"⨢":r.MO.BIN4,"⨣":r.MO.BIN4,"⨤":r.MO.BIN4,"⨥":r.MO.BIN4,"⨦":r.MO.BIN4,"⨧":r.MO.BIN4,"⨨":r.MO.BIN4,"⨩":r.MO.BIN4,"⨪":r.MO.BIN4,"⨫":r.MO.BIN4,"⨬":r.MO.BIN4,"⨭":r.MO.BIN4,"⨮":r.MO.BIN4,"⨯":r.MO.BIN4,"⨰":r.MO.BIN4,"⨱":r.MO.BIN4,"⨲":r.MO.BIN4,"⨳":r.MO.BIN4,"⨴":r.MO.BIN4,"⨵":r.MO.BIN4,"⨶":r.MO.BIN4,"⨷":r.MO.BIN4,"⨸":r.MO.BIN4,"⨹":r.MO.BIN4,"⨺":r.MO.BIN4,"⨻":r.MO.BIN4,"⨼":r.MO.BIN4,"⨽":r.MO.BIN4,"⨾":r.MO.BIN4,"⨿":r.MO.BIN4,"⩀":r.MO.BIN4,"⩁":r.MO.BIN4,"⩂":r.MO.BIN4,"⩃":r.MO.BIN4,"⩄":r.MO.BIN4,"⩅":r.MO.BIN4,"⩆":r.MO.BIN4,"⩇":r.MO.BIN4,"⩈":r.MO.BIN4,"⩉":r.MO.BIN4,"⩊":r.MO.BIN4,"⩋":r.MO.BIN4,"⩌":r.MO.BIN4,"⩍":r.MO.BIN4,"⩎":r.MO.BIN4,"⩏":r.MO.BIN4,"⩐":r.MO.BIN4,"⩑":r.MO.BIN4,"⩒":r.MO.BIN4,"⩓":r.MO.BIN4,"⩔":r.MO.BIN4,"⩕":r.MO.BIN4,"⩖":r.MO.BIN4,"⩗":r.MO.BIN4,"⩘":r.MO.BIN4,"⩙":r.MO.REL,"⩚":r.MO.BIN4,"⩛":r.MO.BIN4,"⩜":r.MO.BIN4,"⩝":r.MO.BIN4,"⩞":r.MO.BIN4,"⩟":r.MO.BIN4,"⩠":r.MO.BIN4,"⩡":r.MO.BIN4,"⩢":r.MO.BIN4,"⩣":r.MO.BIN4,"⩤":r.MO.BIN4,"⩥":r.MO.BIN4,"⩦":r.MO.REL,"⩧":r.MO.REL,"⩨":r.MO.REL,"⩩":r.MO.REL,"⩪":r.MO.REL,"⩫":r.MO.REL,"⩬":r.MO.REL,"⩭":r.MO.REL,"⩮":r.MO.REL,"⩯":r.MO.REL,"⩰":r.MO.REL,"⩱":r.MO.BIN4,"⩲":r.MO.BIN4,"⩳":r.MO.REL,"⩴":r.MO.REL,"⩵":r.MO.REL,"⩶":r.MO.REL,"⩷":r.MO.REL,"⩸":r.MO.REL,"⩹":r.MO.REL,"⩺":r.MO.REL,"⩻":r.MO.REL,"⩼":r.MO.REL,"⩽":r.MO.REL,"⩽̸":r.MO.REL,"⩾":r.MO.REL,"⩾̸":r.MO.REL,"⩿":r.MO.REL,"⪀":r.MO.REL,"⪁":r.MO.REL,"⪂":r.MO.REL,"⪃":r.MO.REL,"⪄":r.MO.REL,"⪅":r.MO.REL,"⪆":r.MO.REL,"⪇":r.MO.REL,"⪈":r.MO.REL,"⪉":r.MO.REL,"⪊":r.MO.REL,"⪋":r.MO.REL,"⪌":r.MO.REL,"⪍":r.MO.REL,"⪎":r.MO.REL,"⪏":r.MO.REL,"⪐":r.MO.REL,"⪑":r.MO.REL,"⪒":r.MO.REL,"⪓":r.MO.REL,"⪔":r.MO.REL,"⪕":r.MO.REL,"⪖":r.MO.REL,"⪗":r.MO.REL,"⪘":r.MO.REL,"⪙":r.MO.REL,"⪚":r.MO.REL,"⪛":r.MO.REL,"⪜":r.MO.REL,"⪝":r.MO.REL,"⪞":r.MO.REL,"⪟":r.MO.REL,"⪠":r.MO.REL,"⪡":r.MO.REL,"⪡̸":r.MO.REL,"⪢":r.MO.REL,"⪢̸":r.MO.REL,"⪣":r.MO.REL,"⪤":r.MO.REL,"⪥":r.MO.REL,"⪦":r.MO.REL,"⪧":r.MO.REL,"⪨":r.MO.REL,"⪩":r.MO.REL,"⪪":r.MO.REL,"⪫":r.MO.REL,"⪬":r.MO.REL,"⪭":r.MO.REL,"⪮":r.MO.REL,"⪯":r.MO.REL,"⪯̸":r.MO.REL,"⪰":r.MO.REL,"⪰̸":r.MO.REL,"⪱":r.MO.REL,"⪲":r.MO.REL,"⪳":r.MO.REL,"⪴":r.MO.REL,"⪵":r.MO.REL,"⪶":r.MO.REL,"⪷":r.MO.REL,"⪸":r.MO.REL,"⪹":r.MO.REL,"⪺":r.MO.REL,"⪻":r.MO.REL,"⪼":r.MO.REL,"⪽":r.MO.REL,"⪾":r.MO.REL,"⪿":r.MO.REL,"⫀":r.MO.REL,"⫁":r.MO.REL,"⫂":r.MO.REL,"⫃":r.MO.REL,"⫄":r.MO.REL,"⫅":r.MO.REL,"⫆":r.MO.REL,"⫇":r.MO.REL,"⫈":r.MO.REL,"⫉":r.MO.REL,"⫊":r.MO.REL,"⫋":r.MO.REL,"⫌":r.MO.REL,"⫍":r.MO.REL,"⫎":r.MO.REL,"⫏":r.MO.REL,"⫐":r.MO.REL,"⫑":r.MO.REL,"⫒":r.MO.REL,"⫓":r.MO.REL,"⫔":r.MO.REL,"⫕":r.MO.REL,"⫖":r.MO.REL,"⫗":r.MO.REL,"⫘":r.MO.REL,"⫙":r.MO.REL,"⫚":r.MO.REL,"⫛":r.MO.REL,"⫝":r.MO.REL,"⫝̸":r.MO.REL,"⫞":r.MO.REL,"⫟":r.MO.REL,"⫠":r.MO.REL,"⫡":r.MO.REL,"⫢":r.MO.REL,"⫣":r.MO.REL,"⫤":r.MO.REL,"⫥":r.MO.REL,"⫦":r.MO.REL,"⫧":r.MO.REL,"⫨":r.MO.REL,"⫩":r.MO.REL,"⫪":r.MO.REL,"⫫":r.MO.REL,"⫬":r.MO.REL,"⫭":r.MO.REL,"⫮":r.MO.REL,"⫯":r.MO.REL,"⫰":r.MO.REL,"⫱":r.MO.REL,"⫲":r.MO.REL,"⫳":r.MO.REL,"⫴":r.MO.BIN4,"⫵":r.MO.BIN4,"⫶":r.MO.BIN4,"⫷":r.MO.REL,"⫸":r.MO.REL,"⫹":r.MO.REL,"⫺":r.MO.REL,"⫻":r.MO.BIN4,"⫽":r.MO.BIN4,"⫾":r.MO.BIN3,"⭅":r.MO.RELSTRETCH,"⭆":r.MO.RELSTRETCH,"〈":r.MO.OPEN,"〉":r.MO.CLOSE,"︷":r.MO.WIDEACCENT,"︸":r.MO.WIDEACCENT}},r.OPTABLE.infix["^"]=r.MO.WIDEREL,r.OPTABLE.infix._=r.MO.WIDEREL,r.OPTABLE.infix["⫝̸"]=r.MO.REL})(dT);var Ke={},AO=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},HO=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.split=Ke.isPercent=Ke.unicodeString=Ke.unicodeChars=Ke.quotePattern=Ke.sortLength=void 0;function MO(r,t){return r.length!==t.length?t.length-r.length:r===t?0:r<t?-1:1}Ke.sortLength=MO;function wO(r){return r.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,"\\$1")}Ke.quotePattern=wO;function CO(r){return Array.from(r).map(function(t){return t.codePointAt(0)})}Ke.unicodeChars=CO;function DO(r){return String.fromCodePoint.apply(String,HO([],AO(r),!1))}Ke.unicodeString=DO;function OO(r){return!!r.match(/%\s*$/)}Ke.isPercent=OO;function IO(r){return r.trim().split(/\s+/)}Ke.split=IO;var VO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ka=_&&_.__assign||function(){return Ka=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ka.apply(this,arguments)},ep=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},PO=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(g4,"__esModule",{value:!0});g4.MmlMo=void 0;var De=jt,d9=dT,ip=Ke,kO=function(r){VO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e._texClass=null,e.lspace=5/18,e.rspace=5/18,e}return Object.defineProperty(t.prototype,"texClass",{get:function(){if(this._texClass===null){var e=this.getText(),n=ep(this.handleExplicitForm(this.getForms()),3),s=n[0],a=n[1],o=n[2],l=this.constructor.OPTABLE,u=l[s][e]||l[a][e]||l[o][e];return u?u[2]:De.TEXCLASS.REL}return this._texClass},set:function(e){this._texClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kind",{get:function(){return"mo"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmbellished",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasNewLine",{get:function(){return this.attributes.get("linebreak")==="newline"},enumerable:!1,configurable:!0}),t.prototype.coreParent=function(){for(var e=this,n=this,s=this.factory.getNodeClass("math");n&&n.isEmbellished&&n.coreMO()===this&&!(n instanceof s);)e=n,n=n.parent;return e},t.prototype.coreText=function(e){if(!e)return"";if(e.isEmbellished)return e.coreMO().getText();for(;((e.isKind("mrow")||e.isKind("TeXAtom")&&e.texClass!==De.TEXCLASS.VCENTER||e.isKind("mstyle")||e.isKind("mphantom"))&&e.childNodes.length===1||e.isKind("munderover"))&&e.childNodes[0];)e=e.childNodes[0];return e.isToken?e.getText():""},t.prototype.hasSpacingAttributes=function(){return this.attributes.isSet("lspace")||this.attributes.isSet("rspace")},Object.defineProperty(t.prototype,"isAccent",{get:function(){var e=!1,n=this.coreParent().parent;if(n){var s=n.isKind("mover")?n.childNodes[n.over].coreMO()?"accent":"":n.isKind("munder")?n.childNodes[n.under].coreMO()?"accentunder":"":n.isKind("munderover")?this===n.childNodes[n.over].coreMO()?"accent":this===n.childNodes[n.under].coreMO()?"accentunder":"":"";if(s){var a=n.attributes.getExplicit(s);e=a!==void 0?e:this.attributes.get("accent")}}return e},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){var n=this.attributes.getList("form","fence"),s=n.form,a=n.fence;return this.getProperty("texClass")===void 0&&(this.attributes.isSet("lspace")||this.attributes.isSet("rspace"))?null:(a&&this.texClass===De.TEXCLASS.REL&&(s==="prefix"&&(this.texClass=De.TEXCLASS.OPEN),s==="postfix"&&(this.texClass=De.TEXCLASS.CLOSE)),this.adjustTeXclass(e))},t.prototype.adjustTeXclass=function(e){var n=this.texClass,s=this.prevClass;if(n===De.TEXCLASS.NONE)return e;if(e?(e.getProperty("autoOP")&&(n===De.TEXCLASS.BIN||n===De.TEXCLASS.REL)&&(s=e.texClass=De.TEXCLASS.ORD),s=this.prevClass=e.texClass||De.TEXCLASS.ORD,this.prevLevel=this.attributes.getInherited("scriptlevel")):s=this.prevClass=De.TEXCLASS.NONE,n===De.TEXCLASS.BIN&&(s===De.TEXCLASS.NONE||s===De.TEXCLASS.BIN||s===De.TEXCLASS.OP||s===De.TEXCLASS.REL||s===De.TEXCLASS.OPEN||s===De.TEXCLASS.PUNCT))this.texClass=De.TEXCLASS.ORD;else if(s===De.TEXCLASS.BIN&&(n===De.TEXCLASS.REL||n===De.TEXCLASS.CLOSE||n===De.TEXCLASS.PUNCT))e.texClass=this.prevClass=De.TEXCLASS.ORD;else if(n===De.TEXCLASS.BIN){for(var a=this,o=this.parent;o&&o.parent&&o.isEmbellished&&(o.childNodes.length===1||!o.isKind("mrow")&&o.core()===a);)a=o,o=o.parent;o.childNodes[o.childNodes.length-1]===a&&(this.texClass=De.TEXCLASS.ORD)}return this},t.prototype.setInheritedAttributes=function(e,n,s,a){e===void 0&&(e={}),n===void 0&&(n=!1),s===void 0&&(s=0),a===void 0&&(a=!1),r.prototype.setInheritedAttributes.call(this,e,n,s,a);var o=this.getText();this.checkOperatorTable(o),this.checkPseudoScripts(o),this.checkPrimes(o),this.checkMathAccent(o)},t.prototype.checkOperatorTable=function(e){var n,s,a=ep(this.handleExplicitForm(this.getForms()),3),o=a[0],l=a[1],u=a[2];this.attributes.setInherited("form",o);var h=this.constructor.OPTABLE,T=h[o][e]||h[l][e]||h[u][e];if(T){this.getProperty("texClass")===void 0&&(this.texClass=T[2]);try{for(var f=PO(Object.keys(T[3]||{})),d=f.next();!d.done;d=f.next()){var p=d.value;this.attributes.setInherited(p,T[3][p])}}catch(c){n={error:c}}finally{try{d&&!d.done&&(s=f.return)&&s.call(f)}finally{if(n)throw n.error}}this.lspace=(T[0]+1)/18,this.rspace=(T[1]+1)/18}else{var m=(0,d9.getRange)(e);if(m){this.getProperty("texClass")===void 0&&(this.texClass=m[2]);var y=this.constructor.MMLSPACING[m[2]];this.lspace=(y[0]+1)/18,this.rspace=(y[1]+1)/18}}},t.prototype.getForms=function(){for(var e=this,n=this.parent,s=this.Parent;s&&s.isEmbellished;)e=n,n=s.parent,s=s.Parent;if(n&&n.isKind("mrow")&&n.nonSpaceLength()!==1){if(n.firstNonSpace()===e)return["prefix","infix","postfix"];if(n.lastNonSpace()===e)return["postfix","infix","prefix"]}return["infix","prefix","postfix"]},t.prototype.handleExplicitForm=function(e){if(this.attributes.isSet("form")){var n=this.attributes.get("form");e=[n].concat(e.filter(function(s){return s!==n}))}return e},t.prototype.checkPseudoScripts=function(e){var n=this.constructor.pseudoScripts;if(e.match(n)){var s=this.coreParent().Parent,a=!s||!(s.isKind("msubsup")&&!s.isKind("msub"));this.setProperty("pseudoscript",a),a&&(this.attributes.setInherited("lspace",0),this.attributes.setInherited("rspace",0))}},t.prototype.checkPrimes=function(e){var n=this.constructor.primes;if(e.match(n)){var s=this.constructor.remapPrimes,a=(0,ip.unicodeString)((0,ip.unicodeChars)(e).map(function(o){return s[o]}));this.setProperty("primes",a)}},t.prototype.checkMathAccent=function(e){var n=this.Parent;if(!(this.getProperty("mathaccent")!==void 0||!n||!n.isKind("munderover"))){var s=n.childNodes[0];if(!(s.isEmbellished&&s.coreMO()===this)){var a=this.constructor.mathaccents;e.match(a)&&this.setProperty("mathaccent",!0)}}},t.defaults=Ka(Ka({},De.AbstractMmlTokenNode.defaults),{form:"infix",fence:!1,separator:!1,lspace:"thickmathspace",rspace:"thickmathspace",stretchy:!1,symmetric:!1,maxsize:"infinity",minsize:"0em",largeop:!1,movablelimits:!1,accent:!1,linebreak:"auto",lineleading:"1ex",linebreakstyle:"before",indentalign:"auto",indentshift:"0",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),t.MMLSPACING=d9.MMLSPACING,t.OPTABLE=d9.OPTABLE,t.pseudoScripts=new RegExp(["^[\"'*`","ª","°","²-´","¹","º","‘-‟","′-‷⁗","⁰ⁱ","⁴-ⁿ","₀-₎","]+$"].join("")),t.primes=new RegExp(["^[\"'`","‘-‟","]+$"].join("")),t.remapPrimes={34:8243,39:8242,96:8245,8216:8245,8217:8242,8218:8242,8219:8245,8220:8246,8221:8243,8222:8243,8223:8246},t.mathaccents=new RegExp(["^[","´́ˊ","`̀ˋ","¨̈","~̃˜","¯̄ˉ","˘̆","ˇ̌","^̂ˆ","→⃗","˙̇","˚̊","⃛","⃜","]$"].join("")),t}(De.AbstractMmlTokenNode);g4.MmlMo=kO;var u0={},RO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Cc=_&&_.__assign||function(){return Cc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Cc.apply(this,arguments)};Object.defineProperty(u0,"__esModule",{value:!0});u0.MmlMtext=void 0;var p9=jt,BO=function(r){RO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=p9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mtext"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),t.defaults=Cc({},p9.AbstractMmlTokenNode.defaults),t}(p9.AbstractMmlTokenNode);u0.MmlMtext=BO;var c0={},FO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Xa=_&&_.__assign||function(){return Xa=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Xa.apply(this,arguments)};Object.defineProperty(c0,"__esModule",{value:!0});c0.MmlMspace=void 0;var g9=jt,NO=function(r){FO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=g9.TEXCLASS.NONE,e}return t.prototype.setTeXclass=function(e){return e},Object.defineProperty(t.prototype,"kind",{get:function(){return"mspace"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasNewline",{get:function(){var e=this.attributes;return e.getExplicit("width")==null&&e.getExplicit("height")==null&&e.getExplicit("depth")==null&&e.get("linebreak")==="newline"},enumerable:!1,configurable:!0}),t.defaults=Xa(Xa({},g9.AbstractMmlTokenNode.defaults),{width:"0em",height:"0ex",depth:"0ex",linebreak:"auto"}),t}(g9.AbstractMmlTokenNode);c0.MmlMspace=NO;var h0={},UO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),$a=_&&_.__assign||function(){return $a=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},$a.apply(this,arguments)};Object.defineProperty(h0,"__esModule",{value:!0});h0.MmlMs=void 0;var m9=jt,jO=function(r){UO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=m9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"ms"},enumerable:!1,configurable:!0}),t.defaults=$a($a({},m9.AbstractMmlTokenNode.defaults),{lquote:'"',rquote:'"'}),t}(m9.AbstractMmlTokenNode);h0.MmlMs=jO;var n4={},kx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dc=_&&_.__assign||function(){return Dc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Dc.apply(this,arguments)},A4=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(n4,"__esModule",{value:!0});n4.MmlInferredMrow=n4.MmlMrow=void 0;var y9=jt,Oc=function(r){kx(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e._core=null,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mrow"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){var e,n;try{for(var s=A4(this.childNodes),a=s.next();!a.done;a=s.next()){var o=a.value;if(!o.isSpacelike)return!1}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmbellished",{get:function(){var e,n,s=!1,a=0;try{for(var o=A4(this.childNodes),l=o.next();!l.done;l=o.next()){var u=l.value;if(u){if(u.isEmbellished){if(s)return!1;s=!0,this._core=a}else if(!u.isSpacelike)return!1}a++}}catch(h){e={error:h}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return s},enumerable:!1,configurable:!0}),t.prototype.core=function(){return!this.isEmbellished||this._core==null?this:this.childNodes[this._core]},t.prototype.coreMO=function(){return!this.isEmbellished||this._core==null?this:this.childNodes[this._core].coreMO()},t.prototype.nonSpaceLength=function(){var e,n,s=0;try{for(var a=A4(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;l&&!l.isSpacelike&&s++}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return s},t.prototype.firstNonSpace=function(){var e,n;try{for(var s=A4(this.childNodes),a=s.next();!a.done;a=s.next()){var o=a.value;if(o&&!o.isSpacelike)return o}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return null},t.prototype.lastNonSpace=function(){for(var e=this.childNodes.length;--e>=0;){var n=this.childNodes[e];if(n&&!n.isSpacelike)return n}return null},t.prototype.setTeXclass=function(e){var n,s,a,o;if(this.getProperty("open")!=null||this.getProperty("close")!=null){this.getPrevClass(e),e=null;try{for(var l=A4(this.childNodes),u=l.next();!u.done;u=l.next()){var h=u.value;e=h.setTeXclass(e)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(n)throw n.error}}this.texClass==null&&(this.texClass=y9.TEXCLASS.INNER)}else{try{for(var T=A4(this.childNodes),f=T.next();!f.done;f=T.next()){var h=f.value;e=h.setTeXclass(e)}}catch(d){a={error:d}}finally{try{f&&!f.done&&(o=T.return)&&o.call(T)}finally{if(a)throw a.error}}this.childNodes[0]&&this.updateTeXclass(this.childNodes[0])}return e},t.defaults=Dc({},y9.AbstractMmlNode.defaults),t}(y9.AbstractMmlNode);n4.MmlMrow=Oc;var GO=function(r){kx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"inferredMrow"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isInferred",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"["+this.childNodes.join(",")+"]"},t.defaults=Oc.defaults,t}(Oc);n4.MmlInferredMrow=GO;var T0={},zO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ya=_&&_.__assign||function(){return Ya=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ya.apply(this,arguments)},WO=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(T0,"__esModule",{value:!0});T0.MmlMfrac=void 0;var rp=jt,qO=function(r){zO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mfrac"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){var n,s;this.getPrevClass(e);try{for(var a=WO(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;l.setTeXclass(null)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return this},t.prototype.setChildInheritedAttributes=function(e,n,s,a){(!n||s>0)&&s++,this.childNodes[0].setInheritedAttributes(e,!1,s,a),this.childNodes[1].setInheritedAttributes(e,!1,s,!0)},t.defaults=Ya(Ya({},rp.AbstractMmlBaseNode.defaults),{linethickness:"medium",numalign:"center",denomalign:"center",bevelled:!1}),t}(rp.AbstractMmlBaseNode);T0.MmlMfrac=qO;var f0={},ZO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ic=_&&_.__assign||function(){return Ic=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ic.apply(this,arguments)};Object.defineProperty(f0,"__esModule",{value:!0});f0.MmlMsqrt=void 0;var v9=jt,KO=function(r){ZO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=v9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"msqrt"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){return this.getPrevClass(e),this.childNodes[0].setTeXclass(null),this},t.prototype.setChildInheritedAttributes=function(e,n,s,a){this.childNodes[0].setInheritedAttributes(e,n,s,!0)},t.defaults=Ic({},v9.AbstractMmlNode.defaults),t}(v9.AbstractMmlNode);f0.MmlMsqrt=KO;var Q0={},XO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Vc=_&&_.__assign||function(){return Vc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Vc.apply(this,arguments)};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.MmlMroot=void 0;var L9=jt,$O=function(r){XO(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=L9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mroot"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){return this.getPrevClass(e),this.childNodes[0].setTeXclass(null),this.childNodes[1].setTeXclass(null),this},t.prototype.setChildInheritedAttributes=function(e,n,s,a){this.childNodes[0].setInheritedAttributes(e,n,s,!0),this.childNodes[1].setInheritedAttributes(e,!1,s+2,a)},t.defaults=Vc({},L9.AbstractMmlNode.defaults),t}(L9.AbstractMmlNode);Q0.MmlMroot=$O;var Q7={},YO=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ja=_&&_.__assign||function(){return Ja=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Ja.apply(this,arguments)};Object.defineProperty(Q7,"__esModule",{value:!0});Q7.MmlMstyle=void 0;var np=jt,y6=Kn,JO=function(r){YO(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mstyle"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notParent",{get:function(){return this.childNodes[0]&&this.childNodes[0].childNodes.length===1},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o=this.attributes.getExplicit("scriptlevel");o!=null&&(o=o.toString(),o.match(/^\s*[-+]/)?s+=parseInt(o):s=parseInt(o),a=!1);var l=this.attributes.getExplicit("displaystyle");l!=null&&(n=l===!0,a=!1);var u=this.attributes.getExplicit("data-cramped");u!=null&&(a=u),e=this.addInheritedAttributes(e,this.attributes.getAllAttributes()),this.childNodes[0].setInheritedAttributes(e,n,s,a)},t.defaults=Ja(Ja({},np.AbstractMmlLayoutNode.defaults),{scriptlevel:y6.INHERIT,displaystyle:y6.INHERIT,scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:"8px",mathbackground:y6.INHERIT,mathcolor:y6.INHERIT,dir:y6.INHERIT,infixlinebreakstyle:"before"}),t}(np.AbstractMmlLayoutNode);Q7.MmlMstyle=JO;var d0={},tI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Pc=_&&_.__assign||function(){return Pc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Pc.apply(this,arguments)};Object.defineProperty(d0,"__esModule",{value:!0});d0.MmlMerror=void 0;var x9=jt,eI=function(r){tI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=x9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"merror"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.defaults=Pc({},x9.AbstractMmlNode.defaults),t}(x9.AbstractMmlNode);d0.MmlMerror=eI;var p0={},iI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),to=_&&_.__assign||function(){return to=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},to.apply(this,arguments)};Object.defineProperty(p0,"__esModule",{value:!0});p0.MmlMpadded=void 0;var sp=jt,rI=function(r){iI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mpadded"},enumerable:!1,configurable:!0}),t.defaults=to(to({},sp.AbstractMmlLayoutNode.defaults),{width:"",height:"",depth:"",lspace:0,voffset:0}),t}(sp.AbstractMmlLayoutNode);p0.MmlMpadded=rI;var g0={},nI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kc=_&&_.__assign||function(){return kc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},kc.apply(this,arguments)};Object.defineProperty(g0,"__esModule",{value:!0});g0.MmlMphantom=void 0;var _9=jt,sI=function(r){nI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=_9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mphantom"},enumerable:!1,configurable:!0}),t.defaults=kc({},_9.AbstractMmlLayoutNode.defaults),t}(_9.AbstractMmlLayoutNode);g0.MmlMphantom=sI;var m0={},aI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),eo=_&&_.__assign||function(){return eo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},eo.apply(this,arguments)},ap=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(m0,"__esModule",{value:!0});m0.MmlMfenced=void 0;var v6=jt,oI=function(r){aI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=v6.TEXCLASS.INNER,e.separators=[],e.open=null,e.close=null,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mfenced"},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){this.getPrevClass(e),this.open&&(e=this.open.setTeXclass(e)),this.childNodes[0]&&(e=this.childNodes[0].setTeXclass(e));for(var n=1,s=this.childNodes.length;n<s;n++)this.separators[n-1]&&(e=this.separators[n-1].setTeXclass(e)),this.childNodes[n]&&(e=this.childNodes[n].setTeXclass(e));return this.close&&(e=this.close.setTeXclass(e)),this.updateTeXclass(this.open),e},t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o,l;this.addFakeNodes();try{for(var u=ap([this.open,this.close].concat(this.separators)),h=u.next();!h.done;h=u.next()){var T=h.value;T&&T.setInheritedAttributes(e,n,s,a)}}catch(f){o={error:f}}finally{try{h&&!h.done&&(l=u.return)&&l.call(u)}finally{if(o)throw o.error}}r.prototype.setChildInheritedAttributes.call(this,e,n,s,a)},t.prototype.addFakeNodes=function(){var e,n,s=this.attributes.getList("open","close","separators"),a=s.open,o=s.close,l=s.separators;if(a=a.replace(/[ \t\n\r]/g,""),o=o.replace(/[ \t\n\r]/g,""),l=l.replace(/[ \t\n\r]/g,""),a&&(this.open=this.fakeNode(a,{fence:!0,form:"prefix"},v6.TEXCLASS.OPEN)),l){for(;l.length<this.childNodes.length-1;)l+=l.charAt(l.length-1);var u=0;try{for(var h=ap(this.childNodes.slice(1)),T=h.next();!T.done;T=h.next()){var f=T.value;f&&this.separators.push(this.fakeNode(l.charAt(u++)))}}catch(d){e={error:d}}finally{try{T&&!T.done&&(n=h.return)&&n.call(h)}finally{if(e)throw e.error}}}o&&(this.close=this.fakeNode(o,{fence:!0,form:"postfix"},v6.TEXCLASS.CLOSE))},t.prototype.fakeNode=function(e,n,s){n===void 0&&(n={}),s===void 0&&(s=null);var a=this.factory.create("text").setText(e),o=this.factory.create("mo",n,[a]);return o.texClass=s,o.parent=this,o},t.defaults=eo(eo({},v6.AbstractMmlNode.defaults),{open:"(",close:")",separators:","}),t}(v6.AbstractMmlNode);m0.MmlMfenced=oI;var y0={},lI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),io=_&&_.__assign||function(){return io=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},io.apply(this,arguments)};Object.defineProperty(y0,"__esModule",{value:!0});y0.MmlMenclose=void 0;var b9=jt,uI=function(r){lI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=b9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"menclose"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContininer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){return e=this.childNodes[0].setTeXclass(e),this.updateTeXclass(this.childNodes[0]),e},t.defaults=io(io({},b9.AbstractMmlNode.defaults),{notation:"longdiv"}),t}(b9.AbstractMmlNode);y0.MmlMenclose=uI;var v0={},cI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ro=_&&_.__assign||function(){return ro=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},ro.apply(this,arguments)};Object.defineProperty(v0,"__esModule",{value:!0});v0.MmlMaction=void 0;var op=jt,hI=function(r){cI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"maction"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selected",{get:function(){var e=this.attributes.get("selection"),n=Math.max(1,Math.min(this.childNodes.length,e))-1;return this.childNodes[n]||this.factory.create("mrow")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmbellished",{get:function(){return this.selected.isEmbellished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){return this.selected.isSpacelike},enumerable:!1,configurable:!0}),t.prototype.core=function(){return this.selected.core()},t.prototype.coreMO=function(){return this.selected.coreMO()},t.prototype.verifyAttributes=function(e){if(r.prototype.verifyAttributes.call(this,e),this.attributes.get("actiontype")!=="toggle"&&this.attributes.getExplicit("selection")!==void 0){var n=this.attributes.getAllAttributes();delete n.selection}},t.prototype.setTeXclass=function(e){this.attributes.get("actiontype")==="tooltip"&&this.childNodes[1]&&this.childNodes[1].setTeXclass(null);var n=this.selected;return e=n.setTeXclass(e),this.updateTeXclass(n),e},t.prototype.nextToggleSelection=function(){var e=Math.max(1,this.attributes.get("selection")+1);e>this.childNodes.length&&(e=1),this.attributes.set("selection",e)},t.defaults=ro(ro({},op.AbstractMmlNode.defaults),{actiontype:"toggle",selection:1}),t}(op.AbstractMmlNode);v0.MmlMaction=hI;var B3={},pT=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),An=_&&_.__assign||function(){return An=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},An.apply(this,arguments)};Object.defineProperty(B3,"__esModule",{value:!0});B3.MmlMsup=B3.MmlMsub=B3.MmlMsubsup=void 0;var lp=jt,I5=function(r){pT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"msubsup"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 3},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"base",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sub",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sup",{get:function(){return 2},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o=this.childNodes;o[0].setInheritedAttributes(e,n,s,a),o[1].setInheritedAttributes(e,!1,s+1,a||this.sub===1),o[2]&&o[2].setInheritedAttributes(e,!1,s+1,a||this.sub===2)},t.defaults=An(An({},lp.AbstractMmlBaseNode.defaults),{subscriptshift:"",superscriptshift:""}),t}(lp.AbstractMmlBaseNode);B3.MmlMsubsup=I5;var TI=function(r){pT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"msub"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),t.defaults=An({},I5.defaults),t}(I5);B3.MmlMsub=TI;var fI=function(r){pT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"msup"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sup",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sub",{get:function(){return 2},enumerable:!1,configurable:!0}),t.defaults=An({},I5.defaults),t}(I5);B3.MmlMsup=fI;var gi={},gT=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Hn=_&&_.__assign||function(){return Hn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Hn.apply(this,arguments)};Object.defineProperty(gi,"__esModule",{value:!0});gi.MmlMover=gi.MmlMunder=gi.MmlMunderover=void 0;var up=jt,V5=function(r){gT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"munderover"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 3},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"base",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"under",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o=this.childNodes;o[0].setInheritedAttributes(e,n,s,a||!!o[this.over]);var l=!!(!n&&o[0].coreMO().attributes.get("movablelimits")),u=this.constructor.ACCENTS;o[1].setInheritedAttributes(e,!1,this.getScriptlevel(u[1],l,s),a||this.under===1),this.setInheritedAccent(1,u[1],n,s,a,l),o[2]&&(o[2].setInheritedAttributes(e,!1,this.getScriptlevel(u[2],l,s),a||this.under===2),this.setInheritedAccent(2,u[2],n,s,a,l))},t.prototype.getScriptlevel=function(e,n,s){return(n||!this.attributes.get(e))&&s++,s},t.prototype.setInheritedAccent=function(e,n,s,a,o,l){var u=this.childNodes[e];if(this.attributes.getExplicit(n)==null&&u.isEmbellished){var h=u.coreMO().attributes.get("accent");this.attributes.setInherited(n,h),h!==this.attributes.getDefault(n)&&u.setInheritedAttributes({},s,this.getScriptlevel(n,l,a),o)}},t.defaults=Hn(Hn({},up.AbstractMmlBaseNode.defaults),{accent:!1,accentunder:!1,align:"center"}),t.ACCENTS=["","accentunder","accent"],t}(up.AbstractMmlBaseNode);gi.MmlMunderover=V5;var QI=function(r){gT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"munder"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),t.defaults=Hn({},V5.defaults),t}(V5);gi.MmlMunder=QI;var dI=function(r){gT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mover"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"under",{get:function(){return 2},enumerable:!1,configurable:!0}),t.defaults=Hn({},V5.defaults),t.ACCENTS=["","accent","accentunder"],t}(V5);gi.MmlMover=dI;var mi={},mT=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),P5=_&&_.__assign||function(){return P5=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},P5.apply(this,arguments)};Object.defineProperty(mi,"__esModule",{value:!0});mi.MmlNone=mi.MmlMprescripts=mi.MmlMmultiscripts=void 0;var no=jt,cp=B3,pI=function(r){mT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mmultiscripts"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){this.childNodes[0].setInheritedAttributes(e,n,s,a);for(var o=!1,l=1,u=0;l<this.childNodes.length;l++){var h=this.childNodes[l];if(h.isKind("mprescripts")){if(!o&&(o=!0,l%2===0)){var T=this.factory.create("mrow");this.childNodes.splice(l,0,T),T.parent=this,l++}}else{var f=a||u%2===0;h.setInheritedAttributes(e,!1,s+1,f),u++}}this.childNodes.length%2===(o?1:0)&&(this.appendChild(this.factory.create("mrow")),this.childNodes[this.childNodes.length-1].setInheritedAttributes(e,!1,s+1,a))},t.prototype.verifyChildren=function(e){for(var n=!1,s=e.fixMmultiscripts,a=0;a<this.childNodes.length;a++){var o=this.childNodes[a];o.isKind("mprescripts")&&(n?o.mError(o.kind+" can only appear once in "+this.kind,e,!0):(n=!0,a%2===0&&!s&&this.mError("There must be an equal number of prescripts of each type",e)))}this.childNodes.length%2===(n?1:0)&&!s&&this.mError("There must be an equal number of scripts of each type",e),r.prototype.verifyChildren.call(this,e)},t.defaults=P5({},cp.MmlMsubsup.defaults),t}(cp.MmlMsubsup);mi.MmlMmultiscripts=pI;var gI=function(r){mT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mprescripts"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),t.prototype.verifyTree=function(e){r.prototype.verifyTree.call(this,e),this.parent&&!this.parent.isKind("mmultiscripts")&&this.mError(this.kind+" must be a child of mmultiscripts",e,!0)},t.defaults=P5({},no.AbstractMmlNode.defaults),t}(no.AbstractMmlNode);mi.MmlMprescripts=gI;var mI=function(r){mT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"none"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),t.prototype.verifyTree=function(e){r.prototype.verifyTree.call(this,e),this.parent&&!this.parent.isKind("mmultiscripts")&&this.mError(this.kind+" must be a child of mmultiscripts",e,!0)},t.defaults=P5({},no.AbstractMmlNode.defaults),t}(no.AbstractMmlNode);mi.MmlNone=mI;var L0={},yI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),so=_&&_.__assign||function(){return so=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},so.apply(this,arguments)},bs=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(L0,"__esModule",{value:!0});L0.MmlMtable=void 0;var Ss=jt,vI=Ke,LI=function(r){yI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.properties={useHeight:!0},e.texclass=Ss.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mtable"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setInheritedAttributes=function(e,n,s,a){var o,l;try{for(var u=bs(Ss.indentAttributes),h=u.next();!h.done;h=u.next()){var T=h.value;e[T]&&this.attributes.setInherited(T,e[T][1]),this.attributes.getExplicit(T)!==void 0&&delete this.attributes.getAllAttributes()[T]}}catch(f){o={error:f}}finally{try{h&&!h.done&&(l=u.return)&&l.call(u)}finally{if(o)throw o.error}}r.prototype.setInheritedAttributes.call(this,e,n,s,a)},t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o,l,u,h;try{for(var T=bs(this.childNodes),f=T.next();!f.done;f=T.next()){var d=f.value;d.isKind("mtr")||this.replaceChild(this.factory.create("mtr"),d).appendChild(d)}}catch(Q){o={error:Q}}finally{try{f&&!f.done&&(l=T.return)&&l.call(T)}finally{if(o)throw o.error}}s=this.getProperty("scriptlevel")||s,n=!!(this.attributes.getExplicit("displaystyle")||this.attributes.getDefault("displaystyle")),e=this.addInheritedAttributes(e,{columnalign:this.attributes.get("columnalign"),rowalign:"center"});var p=this.attributes.getExplicit("data-cramped"),m=(0,vI.split)(this.attributes.get("rowalign"));try{for(var y=bs(this.childNodes),c=y.next();!c.done;c=y.next()){var d=c.value;e.rowalign[1]=m.shift()||e.rowalign[1],d.setInheritedAttributes(e,n,s,!!p)}}catch(Q){u={error:Q}}finally{try{c&&!c.done&&(h=y.return)&&h.call(y)}finally{if(u)throw u.error}}},t.prototype.verifyChildren=function(e){for(var n=null,s=this.factory,a=0;a<this.childNodes.length;a++){var o=this.childNodes[a];if(o.isKind("mtr"))n=null;else{var l=o.isKind("mtd");if(n?(this.removeChild(o),a--):n=this.replaceChild(s.create("mtr"),o),n.appendChild(l?o:s.create("mtd",{},[o])),!e.fixMtables){o.parent.removeChild(o),o.parent=this,l&&n.appendChild(s.create("mtd"));var u=o.mError("Children of "+this.kind+" must be mtr or mlabeledtr",e,l);n.childNodes[n.childNodes.length-1].appendChild(u)}}}r.prototype.verifyChildren.call(this,e)},t.prototype.setTeXclass=function(e){var n,s;this.getPrevClass(e);try{for(var a=bs(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;l.setTeXclass(null)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return this},t.defaults=so(so({},Ss.AbstractMmlNode.defaults),{align:"axis",rowalign:"baseline",columnalign:"center",groupalign:"{left}",alignmentscope:!0,columnwidth:"auto",width:"auto",rowspacing:"1ex",columnspacing:".8em",rowlines:"none",columnlines:"none",frame:"none",framespacing:"0.4em 0.5ex",equalrows:!1,equalcolumns:!1,displaystyle:!1,side:"right",minlabelspacing:"0.8em"}),t}(Ss.AbstractMmlNode);L0.MmlMtable=LI;var s4={},Rx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ao=_&&_.__assign||function(){return ao=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},ao.apply(this,arguments)},Es=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s4,"__esModule",{value:!0});s4.MmlMlabeledtr=s4.MmlMtr=void 0;var hp=jt,S9=Kn,xI=Ke,Bx=function(r){Rx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mtr"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){var o,l,u,h;try{for(var T=Es(this.childNodes),f=T.next();!f.done;f=T.next()){var d=f.value;d.isKind("mtd")||this.replaceChild(this.factory.create("mtd"),d).appendChild(d)}}catch(c){o={error:c}}finally{try{f&&!f.done&&(l=T.return)&&l.call(T)}finally{if(o)throw o.error}}var p=(0,xI.split)(this.attributes.get("columnalign"));this.arity===1&&p.unshift(this.parent.attributes.get("side")),e=this.addInheritedAttributes(e,{rowalign:this.attributes.get("rowalign"),columnalign:"center"});try{for(var m=Es(this.childNodes),y=m.next();!y.done;y=m.next()){var d=y.value;e.columnalign[1]=p.shift()||e.columnalign[1],d.setInheritedAttributes(e,n,s,a)}}catch(c){u={error:c}}finally{try{y&&!y.done&&(h=m.return)&&h.call(m)}finally{if(u)throw u.error}}},t.prototype.verifyChildren=function(e){var n,s;if(this.parent&&!this.parent.isKind("mtable")){this.mError(this.kind+" can only be a child of an mtable",e,!0);return}try{for(var a=Es(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;if(!l.isKind("mtd")){var u=this.replaceChild(this.factory.create("mtd"),l);u.appendChild(l),e.fixMtables||l.mError("Children of "+this.kind+" must be mtd",e)}}}catch(h){n={error:h}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}r.prototype.verifyChildren.call(this,e)},t.prototype.setTeXclass=function(e){var n,s;this.getPrevClass(e);try{for(var a=Es(this.childNodes),o=a.next();!o.done;o=a.next()){var l=o.value;l.setTeXclass(null)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return this},t.defaults=ao(ao({},hp.AbstractMmlNode.defaults),{rowalign:S9.INHERIT,columnalign:S9.INHERIT,groupalign:S9.INHERIT}),t}(hp.AbstractMmlNode);s4.MmlMtr=Bx;var _I=function(r){Rx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mlabeledtr"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),t}(Bx);s4.MmlMlabeledtr=_I;var x0={},bI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),oo=_&&_.__assign||function(){return oo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},oo.apply(this,arguments)};Object.defineProperty(x0,"__esModule",{value:!0});x0.MmlMtd=void 0;var Tp=jt,E9=Kn,SI=function(r){bI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mtd"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.verifyChildren=function(e){if(this.parent&&!this.parent.isKind("mtr")){this.mError(this.kind+" can only be a child of an mtr or mlabeledtr",e,!0);return}r.prototype.verifyChildren.call(this,e)},t.prototype.setTeXclass=function(e){return this.getPrevClass(e),this.childNodes[0].setTeXclass(null),this},t.defaults=oo(oo({},Tp.AbstractMmlBaseNode.defaults),{rowspan:1,columnspan:1,rowalign:E9.INHERIT,columnalign:E9.INHERIT,groupalign:E9.INHERIT}),t}(Tp.AbstractMmlBaseNode);x0.MmlMtd=SI;var d7={},EI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),lo=_&&_.__assign||function(){return lo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},lo.apply(this,arguments)};Object.defineProperty(d7,"__esModule",{value:!0});d7.MmlMaligngroup=void 0;var fp=jt,AI=Kn,HI=function(r){EI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"maligngroup"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(e,n,s,a){e=this.addInheritedAttributes(e,this.attributes.getAllAttributes()),r.prototype.setChildInheritedAttributes.call(this,e,n,s,a)},t.defaults=lo(lo({},fp.AbstractMmlLayoutNode.defaults),{groupalign:AI.INHERIT}),t}(fp.AbstractMmlLayoutNode);d7.MmlMaligngroup=HI;var p7={},MI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),uo=_&&_.__assign||function(){return uo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},uo.apply(this,arguments)};Object.defineProperty(p7,"__esModule",{value:!0});p7.MmlMalignmark=void 0;var Qp=jt,wI=function(r){MI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"malignmark"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),t.defaults=uo(uo({},Qp.AbstractMmlNode.defaults),{edge:"left"}),t}(Qp.AbstractMmlNode);p7.MmlMalignmark=wI;var _0={},CI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),co=_&&_.__assign||function(){return co=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},co.apply(this,arguments)};Object.defineProperty(_0,"__esModule",{value:!0});_0.MmlMglyph=void 0;var A9=jt,DI=function(r){CI(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.texclass=A9.TEXCLASS.ORD,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"mglyph"},enumerable:!1,configurable:!0}),t.prototype.verifyAttributes=function(e){var n=this.attributes.getList("src","fontfamily","index"),s=n.src,a=n.fontfamily,o=n.index;s===""&&(a===""||o==="")?this.mError("mglyph must have either src or fontfamily and index attributes",e,!0):r.prototype.verifyAttributes.call(this,e)},t.defaults=co(co({},A9.AbstractMmlTokenNode.defaults),{alt:"",src:"",index:"",width:"auto",height:"auto",valign:"0em"}),t}(A9.AbstractMmlTokenNode);_0.MmlMglyph=DI;var yi={},yT=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),a4=_&&_.__assign||function(){return a4=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},a4.apply(this,arguments)};Object.defineProperty(yi,"__esModule",{value:!0});yi.MmlAnnotation=yi.MmlAnnotationXML=yi.MmlSemantics=void 0;var ho=jt,OI=function(r){yT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"semantics"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.defaults=a4(a4({},ho.AbstractMmlBaseNode.defaults),{definitionUrl:null,encoding:null}),t}(ho.AbstractMmlBaseNode);yi.MmlSemantics=OI;var Rc=function(r){yT(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"annotation-xml"},enumerable:!1,configurable:!0}),t.prototype.setChildInheritedAttributes=function(){},t.defaults=a4(a4({},ho.AbstractMmlNode.defaults),{definitionUrl:null,encoding:null,cd:"mathmlkeys",name:"",src:null}),t}(ho.AbstractMmlNode);yi.MmlAnnotationXML=Rc;var II=function(r){yT(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.properties={isChars:!0},e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"annotation"},enumerable:!1,configurable:!0}),t.defaults=a4({},Rc.defaults),t}(Rc);yi.MmlAnnotation=II;var b0={},VI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Bc=_&&_.__assign||function(){return Bc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Bc.apply(this,arguments)};Object.defineProperty(b0,"__esModule",{value:!0});b0.TeXAtom=void 0;var H9=jt,PI=g4,Fx=function(r){VI(t,r);function t(e,n,s){var a=r.call(this,e,n,s)||this;return a.texclass=H9.TEXCLASS.ORD,a.setProperty("texClass",a.texClass),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"TeXAtom"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notParent",{get:function(){return this.childNodes[0]&&this.childNodes[0].childNodes.length===1},enumerable:!1,configurable:!0}),t.prototype.setTeXclass=function(e){return this.childNodes[0].setTeXclass(null),this.adjustTeXclass(e)},t.prototype.adjustTeXclass=function(e){return e},t.defaults=Bc({},H9.AbstractMmlBaseNode.defaults),t}(H9.AbstractMmlBaseNode);b0.TeXAtom=Fx;Fx.prototype.adjustTeXclass=PI.MmlMo.prototype.adjustTeXclass;var g7={},kI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Fc=_&&_.__assign||function(){return Fc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Fc.apply(this,arguments)};Object.defineProperty(g7,"__esModule",{value:!0});g7.MathChoice=void 0;var dp=jt,RI=function(r){kI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"MathChoice"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"arity",{get:function(){return 4},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.setInheritedAttributes=function(e,n,s,a){var o=n?0:Math.max(0,Math.min(s,2))+1,l=this.childNodes[o]||this.factory.create("mrow");this.parent.replaceChild(l,this),l.setInheritedAttributes(e,n,s,a)},t.defaults=Fc({},dp.AbstractMmlBaseNode.defaults),t}(dp.AbstractMmlBaseNode);g7.MathChoice=RI;var ee;Object.defineProperty(f7,"__esModule",{value:!0});f7.MML=void 0;var As=jt,pp=a0,gp=o0,mp=l0,yp=g4,vp=u0,Lp=c0,xp=h0,Hs=n4,_p=T0,bp=f0,Sp=Q0,Ep=Q7,Ap=d0,Hp=p0,Mp=g0,wp=m0,Cp=y0,Dp=v0,H4=B3,M4=gi,w4=mi,Op=L0,Ms=s4,Ip=x0,Vp=d7,Pp=p7,kp=_0,C4=yi,Rp=b0,Bp=g7;f7.MML=(ee={},ee[pp.MmlMath.prototype.kind]=pp.MmlMath,ee[gp.MmlMi.prototype.kind]=gp.MmlMi,ee[mp.MmlMn.prototype.kind]=mp.MmlMn,ee[yp.MmlMo.prototype.kind]=yp.MmlMo,ee[vp.MmlMtext.prototype.kind]=vp.MmlMtext,ee[Lp.MmlMspace.prototype.kind]=Lp.MmlMspace,ee[xp.MmlMs.prototype.kind]=xp.MmlMs,ee[Hs.MmlMrow.prototype.kind]=Hs.MmlMrow,ee[Hs.MmlInferredMrow.prototype.kind]=Hs.MmlInferredMrow,ee[_p.MmlMfrac.prototype.kind]=_p.MmlMfrac,ee[bp.MmlMsqrt.prototype.kind]=bp.MmlMsqrt,ee[Sp.MmlMroot.prototype.kind]=Sp.MmlMroot,ee[Ep.MmlMstyle.prototype.kind]=Ep.MmlMstyle,ee[Ap.MmlMerror.prototype.kind]=Ap.MmlMerror,ee[Hp.MmlMpadded.prototype.kind]=Hp.MmlMpadded,ee[Mp.MmlMphantom.prototype.kind]=Mp.MmlMphantom,ee[wp.MmlMfenced.prototype.kind]=wp.MmlMfenced,ee[Cp.MmlMenclose.prototype.kind]=Cp.MmlMenclose,ee[Dp.MmlMaction.prototype.kind]=Dp.MmlMaction,ee[H4.MmlMsub.prototype.kind]=H4.MmlMsub,ee[H4.MmlMsup.prototype.kind]=H4.MmlMsup,ee[H4.MmlMsubsup.prototype.kind]=H4.MmlMsubsup,ee[M4.MmlMunder.prototype.kind]=M4.MmlMunder,ee[M4.MmlMover.prototype.kind]=M4.MmlMover,ee[M4.MmlMunderover.prototype.kind]=M4.MmlMunderover,ee[w4.MmlMmultiscripts.prototype.kind]=w4.MmlMmultiscripts,ee[w4.MmlMprescripts.prototype.kind]=w4.MmlMprescripts,ee[w4.MmlNone.prototype.kind]=w4.MmlNone,ee[Op.MmlMtable.prototype.kind]=Op.MmlMtable,ee[Ms.MmlMlabeledtr.prototype.kind]=Ms.MmlMlabeledtr,ee[Ms.MmlMtr.prototype.kind]=Ms.MmlMtr,ee[Ip.MmlMtd.prototype.kind]=Ip.MmlMtd,ee[Vp.MmlMaligngroup.prototype.kind]=Vp.MmlMaligngroup,ee[Pp.MmlMalignmark.prototype.kind]=Pp.MmlMalignmark,ee[kp.MmlMglyph.prototype.kind]=kp.MmlMglyph,ee[C4.MmlSemantics.prototype.kind]=C4.MmlSemantics,ee[C4.MmlAnnotation.prototype.kind]=C4.MmlAnnotation,ee[C4.MmlAnnotationXML.prototype.kind]=C4.MmlAnnotationXML,ee[Rp.TeXAtom.prototype.kind]=Rp.TeXAtom,ee[Bp.MathChoice.prototype.kind]=Bp.MathChoice,ee[As.TextNode.prototype.kind]=As.TextNode,ee[As.XMLNode.prototype.kind]=As.XMLNode,ee);var BI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(h7,"__esModule",{value:!0});h7.MmlFactory=void 0;var FI=T7,NI=f7,UI=function(r){BI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"MML",{get:function(){return this.node},enumerable:!1,configurable:!0}),t.defaultNodes=NI.MML,t}(FI.AbstractNodeFactory);h7.MmlFactory=UI;var Mn={},jI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),GI=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zI=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},WI=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.BitFieldClass=Mn.BitField=void 0;var Nx=function(){function r(){this.bits=0}return r.allocate=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=GI(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(this.has(l))throw new Error("Bit already allocated for "+l);if(this.next===r.MAXBIT)throw new Error("Maximum number of bits already allocated");this.names.set(l,this.next),this.next<<=1}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.has=function(t){return this.names.has(t)},r.prototype.set=function(t){this.bits|=this.getBit(t)},r.prototype.clear=function(t){this.bits&=~this.getBit(t)},r.prototype.isSet=function(t){return!!(this.bits&this.getBit(t))},r.prototype.reset=function(){this.bits=0},r.prototype.getBit=function(t){var e=this.constructor.names.get(t);if(!e)throw new Error("Unknown bit-field name: "+t);return e},r.MAXBIT=1<<31,r.next=1,r.names=new Map,r}();Mn.BitField=Nx;function qI(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=function(n){jI(s,n);function s(){return n!==null&&n.apply(this,arguments)||this}return s}(Nx);return e.allocate.apply(e,WI([],zI(r),!1)),e}Mn.BitFieldClass=qI;(function(r){var t=_&&_.__extends||function(){var v=function(L,x){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,S){b.__proto__=S}||function(b,S){for(var E in S)Object.prototype.hasOwnProperty.call(S,E)&&(b[E]=S[E])},v(L,x)};return function(L,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");v(L,x);function b(){this.constructor=L}L.prototype=x===null?Object.create(x):(b.prototype=x.prototype,new b)}}(),e=_&&_.__values||function(v){var L=typeof Symbol=="function"&&Symbol.iterator,x=L&&v[L],b=0;if(x)return x.call(v);if(v&&typeof v.length=="number")return{next:function(){return v&&b>=v.length&&(v=void 0),{value:v&&v[b++],done:!v}}};throw new TypeError(L?"Object is not iterable.":"Symbol.iterator is not defined.")},n=_&&_.__read||function(v,L){var x=typeof Symbol=="function"&&v[Symbol.iterator];if(!x)return v;var b=x.call(v),S,E=[],A;try{for(;(L===void 0||L-- >0)&&!(S=b.next()).done;)E.push(S.value)}catch(M){A={error:M}}finally{try{S&&!S.done&&(x=b.return)&&x.call(b)}finally{if(A)throw A.error}}return E},s=_&&_.__spreadArray||function(v,L,x){if(x||arguments.length===2)for(var b=0,S=L.length,E;b<S;b++)(E||!(b in L))&&(E||(E=Array.prototype.slice.call(L,0,b)),E[b]=L[b]);return v.concat(E||Array.prototype.slice.call(L))};Object.defineProperty(r,"__esModule",{value:!0}),r.AbstractMathDocument=r.resetAllOptions=r.resetOptions=r.RenderList=void 0;var a=H1,o=r0,l=n0,u=s0,h=qn,T=h7,f=Mn,d=mr,p=function(v){t(L,v);function L(){return v!==null&&v.apply(this,arguments)||this}return L.create=function(x){var b,S,E=new this;try{for(var A=e(Object.keys(x)),M=A.next();!M.done;M=A.next()){var D=M.value,I=n(this.action(D,x[D]),2),P=I[0],R=I[1];R&&E.add(P,R)}}catch(F){b={error:F}}finally{try{M&&!M.done&&(S=A.return)&&S.call(A)}finally{if(b)throw b.error}}return E},L.action=function(x,b){var S,E,A,M,D,I,P=!0,R=b[0];if(b.length===1||typeof b[1]=="boolean")b.length===2&&(P=b[1]),S=n(this.methodActions(x),2),D=S[0],I=S[1];else if(typeof b[1]=="string")if(typeof b[2]=="string"){b.length===4&&(P=b[3]);var F=n(b.slice(1),2),X=F[0],st=F[1];E=n(this.methodActions(X,st),2),D=E[0],I=E[1]}else b.length===3&&(P=b[2]),A=n(this.methodActions(b[1]),2),D=A[0],I=A[1];else b.length===4&&(P=b[3]),M=n(b.slice(1),2),D=M[0],I=M[1];return[{id:x,renderDoc:D,renderMath:I,convert:P},R]},L.methodActions=function(x,b){return b===void 0&&(b=x),[function(S){return x&&S[x](),!1},function(S,E){return b&&S[b](E),!1}]},L.prototype.renderDoc=function(x,b){var S,E;b===void 0&&(b=h.STATE.UNPROCESSED);try{for(var A=e(this.items),M=A.next();!M.done;M=A.next()){var D=M.value;if(D.priority>=b&&D.item.renderDoc(x))return}}catch(I){S={error:I}}finally{try{M&&!M.done&&(E=A.return)&&E.call(A)}finally{if(S)throw S.error}}},L.prototype.renderMath=function(x,b,S){var E,A;S===void 0&&(S=h.STATE.UNPROCESSED);try{for(var M=e(this.items),D=M.next();!D.done;D=M.next()){var I=D.value;if(I.priority>=S&&I.item.renderMath(x,b))return}}catch(P){E={error:P}}finally{try{D&&!D.done&&(A=M.return)&&A.call(M)}finally{if(E)throw E.error}}},L.prototype.renderConvert=function(x,b,S){var E,A;S===void 0&&(S=h.STATE.LAST);try{for(var M=e(this.items),D=M.next();!D.done;D=M.next()){var I=D.value;if(I.priority>S||I.item.convert&&I.item.renderMath(x,b))return}}catch(P){E={error:P}}finally{try{D&&!D.done&&(A=M.return)&&A.call(M)}finally{if(E)throw E.error}}},L.prototype.findID=function(x){var b,S;try{for(var E=e(this.items),A=E.next();!A.done;A=E.next()){var M=A.value;if(M.item.id===x)return M.item}}catch(D){b={error:D}}finally{try{A&&!A.done&&(S=E.return)&&S.call(E)}finally{if(b)throw b.error}}return null},L}(d.PrioritizedList);r.RenderList=p,r.resetOptions={all:!1,processed:!1,inputJax:null,outputJax:null},r.resetAllOptions={all:!0,processed:!0,inputJax:[],outputJax:[]};var m=function(v){t(L,v);function L(){return v!==null&&v.apply(this,arguments)||this}return L.prototype.compile=function(x){return null},L}(o.AbstractInputJax),y=function(v){t(L,v);function L(){return v!==null&&v.apply(this,arguments)||this}return L.prototype.typeset=function(x,b){return null},L.prototype.escaped=function(x,b){return null},L}(l.AbstractOutputJax),c=function(v){t(L,v);function L(){return v!==null&&v.apply(this,arguments)||this}return L}(u.AbstractMathList),Q=function(v){t(L,v);function L(){return v!==null&&v.apply(this,arguments)||this}return L}(h.AbstractMathItem),g=function(){function v(L,x,b){var S=this,E=this.constructor;this.document=L,this.options=(0,a.userOptions)((0,a.defaultOptions)({},E.OPTIONS),b),this.math=new(this.options.MathList||c),this.renderActions=p.create(this.options.renderActions),this.processed=new v.ProcessBits,this.outputJax=this.options.OutputJax||new y;var A=this.options.InputJax||[new m];Array.isArray(A)||(A=[A]),this.inputJax=A,this.adaptor=x,this.outputJax.setAdaptor(x),this.inputJax.map(function(M){return M.setAdaptor(x)}),this.mmlFactory=this.options.MmlFactory||new T.MmlFactory,this.inputJax.map(function(M){return M.setMmlFactory(S.mmlFactory)}),this.outputJax.initialize(),this.inputJax.map(function(M){return M.initialize()})}return Object.defineProperty(v.prototype,"kind",{get:function(){return this.constructor.KIND},enumerable:!1,configurable:!0}),v.prototype.addRenderAction=function(L){for(var x=[],b=1;b<arguments.length;b++)x[b-1]=arguments[b];var S=n(p.action(L,x),2),E=S[0],A=S[1];this.renderActions.add(E,A)},v.prototype.removeRenderAction=function(L){var x=this.renderActions.findID(L);x&&this.renderActions.remove(x)},v.prototype.render=function(){return this.renderActions.renderDoc(this),this},v.prototype.rerender=function(L){return L===void 0&&(L=h.STATE.RERENDER),this.state(L-1),this.render(),this},v.prototype.convert=function(L,x){x===void 0&&(x={});var b=(0,a.userOptions)({format:this.inputJax[0].name,display:!0,end:h.STATE.LAST,em:16,ex:8,containerWidth:null,lineWidth:1e6,scale:1,family:""},x),S=b.format,E=b.display,A=b.end,M=b.ex,D=b.em,I=b.containerWidth,P=b.lineWidth,R=b.scale,F=b.family;I===null&&(I=80*M);var X=this.inputJax.reduce(function(rt,ct){return ct.name===S?ct:rt},null),st=new this.options.MathItem(L,X,E);return st.start.node=this.adaptor.body(this.document),st.setMetrics(D,M,I,P,R),this.outputJax.options.mtextInheritFont&&(st.outputData.mtextFamily=F),this.outputJax.options.merrorInheritFont&&(st.outputData.merrorFamily=F),st.convert(this,A),st.typesetRoot||st.root},v.prototype.findMath=function(L){return this.processed.set("findMath"),this},v.prototype.compile=function(){var L,x,b,S;if(!this.processed.isSet("compile")){var E=[];try{for(var A=e(this.math),M=A.next();!M.done;M=A.next()){var D=M.value;this.compileMath(D),D.inputData.recompile!==void 0&&E.push(D)}}catch(F){L={error:F}}finally{try{M&&!M.done&&(x=A.return)&&x.call(A)}finally{if(L)throw L.error}}try{for(var I=e(E),P=I.next();!P.done;P=I.next()){var D=P.value,R=D.inputData.recompile;D.state(R.state),D.inputData.recompile=R,this.compileMath(D)}}catch(F){b={error:F}}finally{try{P&&!P.done&&(S=I.return)&&S.call(I)}finally{if(b)throw b.error}}this.processed.set("compile")}return this},v.prototype.compileMath=function(L){try{L.compile(this)}catch(x){if(x.retry||x.restart)throw x;this.options.compileError(this,L,x),L.inputData.error=x}},v.prototype.compileError=function(L,x){L.root=this.mmlFactory.create("math",null,[this.mmlFactory.create("merror",{"data-mjx-error":x.message,title:x.message},[this.mmlFactory.create("mtext",null,[this.mmlFactory.create("text").setText("Math input error")])])]),L.display&&L.root.attributes.set("display","block"),L.inputData.error=x.message},v.prototype.typeset=function(){var L,x;if(!this.processed.isSet("typeset")){try{for(var b=e(this.math),S=b.next();!S.done;S=b.next()){var E=S.value;try{E.typeset(this)}catch(A){if(A.retry||A.restart)throw A;this.options.typesetError(this,E,A),E.outputData.error=A}}}catch(A){L={error:A}}finally{try{S&&!S.done&&(x=b.return)&&x.call(b)}finally{if(L)throw L.error}}this.processed.set("typeset")}return this},v.prototype.typesetError=function(L,x){L.typesetRoot=this.adaptor.node("mjx-container",{class:"MathJax mjx-output-error",jax:this.outputJax.name},[this.adaptor.node("span",{"data-mjx-error":x.message,title:x.message,style:{color:"red","background-color":"yellow","line-height":"normal"}},[this.adaptor.text("Math output error")])]),L.display&&this.adaptor.setAttributes(L.typesetRoot,{style:{display:"block",margin:"1em 0","text-align":"center"}}),L.outputData.error=x.message},v.prototype.getMetrics=function(){return this.processed.isSet("getMetrics")||(this.outputJax.getMetrics(this),this.processed.set("getMetrics")),this},v.prototype.updateDocument=function(){var L,x;if(!this.processed.isSet("updateDocument")){try{for(var b=e(this.math.reversed()),S=b.next();!S.done;S=b.next()){var E=S.value;E.updateDocument(this)}}catch(A){L={error:A}}finally{try{S&&!S.done&&(x=b.return)&&x.call(b)}finally{if(L)throw L.error}}this.processed.set("updateDocument")}return this},v.prototype.removeFromDocument=function(L){return this},v.prototype.state=function(L,x){var b,S;x===void 0&&(x=!1);try{for(var E=e(this.math),A=E.next();!A.done;A=E.next()){var M=A.value;M.state(L,x)}}catch(D){b={error:D}}finally{try{A&&!A.done&&(S=E.return)&&S.call(E)}finally{if(b)throw b.error}}return L<h.STATE.INSERTED&&this.processed.clear("updateDocument"),L<h.STATE.TYPESET&&(this.processed.clear("typeset"),this.processed.clear("getMetrics")),L<h.STATE.COMPILED&&this.processed.clear("compile"),this},v.prototype.reset=function(L){var x;return L===void 0&&(L={processed:!0}),L=(0,a.userOptions)(Object.assign({},r.resetOptions),L),L.all&&Object.assign(L,r.resetAllOptions),L.processed&&this.processed.reset(),L.inputJax&&this.inputJax.forEach(function(b){return b.reset.apply(b,s([],n(L.inputJax),!1))}),L.outputJax&&(x=this.outputJax).reset.apply(x,s([],n(L.outputJax),!1)),this},v.prototype.clear=function(){return this.reset(),this.math.clear(),this},v.prototype.concat=function(L){return this.math.merge(L),this},v.prototype.clearMathItemsWithin=function(L){var x,b=this.getMathItemsWithin(L);return(x=this.math).remove.apply(x,s([],n(b),!1)),b},v.prototype.getMathItemsWithin=function(L){var x,b,S,E;Array.isArray(L)||(L=[L]);var A=this.adaptor,M=[],D=A.getElements(L,this.document);try{t:for(var I=e(this.math),P=I.next();!P.done;P=I.next()){var R=P.value;try{for(var F=(S=void 0,e(D)),X=F.next();!X.done;X=F.next()){var st=X.value;if(R.start.node&&A.contains(st,R.start.node)){M.push(R);continue t}}}catch(rt){S={error:rt}}finally{try{X&&!X.done&&(E=F.return)&&E.call(F)}finally{if(S)throw S.error}}}}catch(rt){x={error:rt}}finally{try{P&&!P.done&&(b=I.return)&&b.call(I)}finally{if(x)throw x.error}}return M},v.KIND="MathDocument",v.OPTIONS={OutputJax:null,InputJax:null,MmlFactory:null,MathList:c,MathItem:Q,compileError:function(L,x,b){L.compileError(x,b)},typesetError:function(L,x,b){L.typesetError(x,b)},renderActions:(0,a.expandable)({find:[h.STATE.FINDMATH,"findMath","",!1],compile:[h.STATE.COMPILED],metrics:[h.STATE.METRICS,"getMetrics","",!1],typeset:[h.STATE.TYPESET],update:[h.STATE.INSERTED,"updateDocument",!1]})},v.ProcessBits=(0,f.BitFieldClass)("findMath","compile","getMetrics","typeset","updateDocument"),v}();r.AbstractMathDocument=g})(QT);var ZI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(c7,"__esModule",{value:!0});c7.AbstractHandler=void 0;var KI=QT,XI=function(r){ZI(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(KI.AbstractMathDocument),$I=function(){function r(t,e){e===void 0&&(e=5),this.documentClass=XI,this.adaptor=t,this.priority=e}return Object.defineProperty(r.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),r.prototype.handlesDocument=function(t){return!1},r.prototype.create=function(t,e){return new this.documentClass(t,this.adaptor,e)},r.NAME="generic",r}();c7.AbstractHandler=$I;var m7={},y7={},YI=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(y7,"__esModule",{value:!0});y7.HTMLMathItem=void 0;var ws=qn,JI=function(r){YI(t,r);function t(e,n,s,a,o){return s===void 0&&(s=!0),a===void 0&&(a={node:null,n:0,delim:""}),o===void 0&&(o={node:null,n:0,delim:""}),r.call(this,e,n,s,a,o)||this}return Object.defineProperty(t.prototype,"adaptor",{get:function(){return this.inputJax.adaptor},enumerable:!1,configurable:!0}),t.prototype.updateDocument=function(e){if(this.state()<ws.STATE.INSERTED){if(this.inputJax.processStrings){var n=this.start.node;if(n===this.end.node)this.end.n&&this.end.n<this.adaptor.value(this.end.node).length&&this.adaptor.split(this.end.node,this.end.n),this.start.n&&(n=this.adaptor.split(this.start.node,this.start.n)),this.adaptor.replace(this.typesetRoot,n);else{for(this.start.n&&(n=this.adaptor.split(n,this.start.n));n!==this.end.node;){var s=this.adaptor.next(n);this.adaptor.remove(n),n=s}this.adaptor.insert(this.typesetRoot,n),this.end.n<this.adaptor.value(n).length&&this.adaptor.split(n,this.end.n),this.adaptor.remove(n)}}else this.adaptor.replace(this.typesetRoot,this.start.node);this.start.node=this.end.node=this.typesetRoot,this.start.n=this.end.n=0,this.state(ws.STATE.INSERTED)}},t.prototype.updateStyleSheet=function(e){e.addStyleSheet()},t.prototype.removeFromDocument=function(e){if(e===void 0&&(e=!1),this.state()>=ws.STATE.TYPESET){var n=this.adaptor,s=this.start.node,a=n.text("");if(e){var o=this.start.delim+this.math+this.end.delim;if(this.inputJax.processStrings)a=n.text(o);else{var l=n.parse(o,"text/html");a=n.firstChild(n.body(l))}}n.parent(s)&&n.replace(a,s),this.start.node=this.end.node=a,this.start.n=this.end.n=0}},t}(ws.AbstractMathItem);y7.HTMLMathItem=JI;var v7={},tV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(v7,"__esModule",{value:!0});v7.HTMLMathList=void 0;var eV=s0,iV=function(r){tV(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(eV.AbstractMathList);v7.HTMLMathList=iV;var L7={},Fp=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a};Object.defineProperty(L7,"__esModule",{value:!0});L7.HTMLDomStrings=void 0;var L6=H1,rV=function(){function r(t){t===void 0&&(t=null);var e=this.constructor;this.options=(0,L6.userOptions)((0,L6.defaultOptions)({},e.OPTIONS),t),this.init(),this.getPatterns()}return r.prototype.init=function(){this.strings=[],this.string="",this.snodes=[],this.nodes=[],this.stack=[]},r.prototype.getPatterns=function(){var t=(0,L6.makeArray)(this.options.skipHtmlTags),e=(0,L6.makeArray)(this.options.ignoreHtmlClass),n=(0,L6.makeArray)(this.options.processHtmlClass);this.skipHtmlTags=new RegExp("^(?:"+t.join("|")+")$","i"),this.ignoreHtmlClass=new RegExp("(?:^| )(?:"+e.join("|")+")(?: |$)"),this.processHtmlClass=new RegExp("(?:^| )(?:"+n+")(?: |$)")},r.prototype.pushString=function(){this.string.match(/\S/)&&(this.strings.push(this.string),this.nodes.push(this.snodes)),this.string="",this.snodes=[]},r.prototype.extendString=function(t,e){this.snodes.push([t,e.length]),this.string+=e},r.prototype.handleText=function(t,e){return e||this.extendString(t,this.adaptor.value(t)),this.adaptor.next(t)},r.prototype.handleTag=function(t,e){if(!e){var n=this.options.includeHtmlTags[this.adaptor.kind(t)];this.extendString(t,n)}return this.adaptor.next(t)},r.prototype.handleContainer=function(t,e){this.pushString();var n=this.adaptor.getAttribute(t,"class")||"",s=this.adaptor.kind(t)||"",a=this.processHtmlClass.exec(n),o=t;return this.adaptor.firstChild(t)&&!this.adaptor.getAttribute(t,"data-MJX")&&(a||!this.skipHtmlTags.exec(s))?(this.adaptor.next(t)&&this.stack.push([this.adaptor.next(t),e]),o=this.adaptor.firstChild(t),e=(e||this.ignoreHtmlClass.exec(n))&&!a):o=this.adaptor.next(t),[o,e]},r.prototype.handleOther=function(t,e){return this.pushString(),this.adaptor.next(t)},r.prototype.find=function(t){var e,n;this.init();for(var s=this.adaptor.next(t),a=!1,o=this.options.includeHtmlTags;t&&t!==s;){var l=this.adaptor.kind(t);l==="#text"?t=this.handleText(t,a):o.hasOwnProperty(l)?t=this.handleTag(t,a):l?(e=Fp(this.handleContainer(t,a),2),t=e[0],a=e[1]):t=this.handleOther(t,a),!t&&this.stack.length&&(this.pushString(),n=Fp(this.stack.pop(),2),t=n[0],a=n[1])}this.pushString();var u=[this.strings,this.nodes];return this.init(),u},r.OPTIONS={skipHtmlTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml"],includeHtmlTags:{br:`
118
- `,wbr:"","#comment":""},ignoreHtmlClass:"mathjax_ignore",processHtmlClass:"mathjax_process"},r}();L7.HTMLDomStrings=rV;var nV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),$4=_&&_.__assign||function(){return $4=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},$4.apply(this,arguments)},Cs=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Er=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(m7,"__esModule",{value:!0});m7.HTMLDocument=void 0;var M9=QT,w9=H1,sV=y7,aV=v7,Np=L7,C9=qn,oV=function(r){nV(t,r);function t(e,n,s){var a=this,o=Cs((0,w9.separateOptions)(s,Np.HTMLDomStrings.OPTIONS),2),l=o[0],u=o[1];return a=r.call(this,e,n,l)||this,a.domStrings=a.options.DomStrings||new Np.HTMLDomStrings(u),a.domStrings.adaptor=n,a.styles=[],a}return t.prototype.findPosition=function(e,n,s,a){var o,l,u=this.adaptor;try{for(var h=Er(a[e]),T=h.next();!T.done;T=h.next()){var f=T.value,d=Cs(f,2),p=d[0],m=d[1];if(n<=m&&u.kind(p)==="#text")return{node:p,n:Math.max(n,0),delim:s};n-=m}}catch(y){o={error:y}}finally{try{T&&!T.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}return{node:null,n:0,delim:s}},t.prototype.mathItem=function(e,n,s){var a=e.math,o=this.findPosition(e.n,e.start.n,e.open,s),l=this.findPosition(e.n,e.end.n,e.close,s);return new this.options.MathItem(a,n,e.display,o,l)},t.prototype.findMath=function(e){var n,s,a,o,l,u,h,T,f;if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,e=(0,w9.userOptions)({elements:this.options.elements||[this.adaptor.body(this.document)]},e);try{for(var d=Er(this.adaptor.getElements(e.elements,this.document)),p=d.next();!p.done;p=d.next()){var m=p.value,y=Cs([null,null],2),c=y[0],Q=y[1];try{for(var g=(a=void 0,Er(this.inputJax)),v=g.next();!v.done;v=g.next()){var L=v.value,x=new this.options.MathList;if(L.processStrings){c===null&&(l=Cs(this.domStrings.find(m),2),c=l[0],Q=l[1]);try{for(var b=(u=void 0,Er(L.findMath(c))),S=b.next();!S.done;S=b.next()){var E=S.value;x.push(this.mathItem(E,L,Q))}}catch(I){u={error:I}}finally{try{S&&!S.done&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}}else try{for(var A=(T=void 0,Er(L.findMath(m))),M=A.next();!M.done;M=A.next()){var E=M.value,D=new this.options.MathItem(E.math,L,E.display,E.start,E.end);x.push(D)}}catch(I){T={error:I}}finally{try{M&&!M.done&&(f=A.return)&&f.call(A)}finally{if(T)throw T.error}}this.math.merge(x)}}catch(I){a={error:I}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}}}catch(I){n={error:I}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(n)throw n.error}}this.processed.set("findMath")}return this},t.prototype.updateDocument=function(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),r.prototype.updateDocument.call(this),this.processed.set("updateDocument")),this},t.prototype.addPageElements=function(){var e=this.adaptor.body(this.document),n=this.documentPageElements();n&&this.adaptor.append(e,n)},t.prototype.addStyleSheet=function(){var e=this.documentStyleSheet(),n=this.adaptor;if(e&&!n.parent(e)){var s=n.head(this.document),a=this.findSheet(s,n.getAttribute(e,"id"));a?n.replace(e,a):n.append(s,e)}},t.prototype.findSheet=function(e,n){var s,a;if(n)try{for(var o=Er(this.adaptor.tags(e,"style")),l=o.next();!l.done;l=o.next()){var u=l.value;if(this.adaptor.getAttribute(u,"id")===n)return u}}catch(h){s={error:h}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(s)throw s.error}}return null},t.prototype.removeFromDocument=function(e){var n,s;if(e===void 0&&(e=!1),this.processed.isSet("updateDocument"))try{for(var a=Er(this.math),o=a.next();!o.done;o=a.next()){var l=o.value;l.state()>=C9.STATE.INSERTED&&l.state(C9.STATE.TYPESET,e)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return this.processed.clear("updateDocument"),this},t.prototype.documentStyleSheet=function(){return this.outputJax.styleSheet(this)},t.prototype.documentPageElements=function(){return this.outputJax.pageElements(this)},t.prototype.addStyles=function(e){this.styles.push(e)},t.prototype.getStyles=function(){return this.styles},t.KIND="HTML",t.OPTIONS=$4($4({},M9.AbstractMathDocument.OPTIONS),{renderActions:(0,w9.expandable)($4($4({},M9.AbstractMathDocument.OPTIONS.renderActions),{styles:[C9.STATE.INSERTED+1,"","updateStyleSheet",!1]})),MathList:aV.HTMLMathList,MathItem:sV.HTMLMathItem,DomStrings:null}),t}(M9.AbstractMathDocument);m7.HTMLDocument=oV;var lV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(u7,"__esModule",{value:!0});u7.HTMLHandler=void 0;var uV=c7,cV=m7,hV=function(r){lV(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.documentClass=cV.HTMLDocument,e}return t.prototype.handlesDocument=function(e){var n=this.adaptor;if(typeof e=="string")try{e=n.parse(e,"text/html")}catch{}return e instanceof n.window.Document||e instanceof n.window.HTMLElement||e instanceof n.window.DocumentFragment},t.prototype.create=function(e,n){var s=this.adaptor;if(typeof e=="string")e=s.parse(e,"text/html");else if(e instanceof s.window.HTMLElement||e instanceof s.window.DocumentFragment){var a=e;e=s.parse("","text/html"),s.append(s.body(e),a)}return r.prototype.create.call(this,e,n)},t}(uV.AbstractHandler);u7.HTMLHandler=hV;Object.defineProperty(fT,"__esModule",{value:!0});var Ux=fT.RegisterHTMLHandler=void 0,TV=a7,fV=u7;function QV(r){var t=new fV.HTMLHandler(r);return TV.mathjax.handlers.register(t),t}Ux=fT.RegisterHTMLHandler=QV;var vT={},x7={},_7={};Object.defineProperty(_7,"__esModule",{value:!0});_7.AbstractFindMath=void 0;var Up=H1,dV=function(){function r(t){var e=this.constructor;this.options=(0,Up.userOptions)((0,Up.defaultOptions)({},e.OPTIONS),t)}return r.OPTIONS={},r}();_7.AbstractFindMath=dV;var pV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jp=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a};Object.defineProperty(x7,"__esModule",{value:!0});x7.FindTeX=void 0;var gV=_7,Ds=Ke,D9=qn,mV=function(r){pV(t,r);function t(e){var n=r.call(this,e)||this;return n.getPatterns(),n}return t.prototype.getPatterns=function(){var e=this,n=this.options,s=[],a=[],o=[];this.end={},this.env=this.sub=0;var l=1;n.inlineMath.forEach(function(u){return e.addPattern(s,u,!1)}),n.displayMath.forEach(function(u){return e.addPattern(s,u,!0)}),s.length&&a.push(s.sort(Ds.sortLength).join("|")),n.processEnvironments&&(a.push("\\\\begin\\s*\\{([^}]*)\\}"),this.env=l,l++),n.processEscapes&&o.push("\\\\([\\\\$])"),n.processRefs&&o.push("(\\\\(?:eq)?ref\\s*\\{[^}]*\\})"),o.length&&(a.push("("+o.join("|")+")"),this.sub=l),this.start=new RegExp(a.join("|"),"g"),this.hasPatterns=a.length>0},t.prototype.addPattern=function(e,n,s){var a=jp(n,2),o=a[0],l=a[1];e.push((0,Ds.quotePattern)(o)),this.end[o]=[l,s,this.endPattern(l)]},t.prototype.endPattern=function(e,n){return new RegExp((n||(0,Ds.quotePattern)(e))+"|\\\\(?:[a-zA-Z]|.)|[{}]","g")},t.prototype.findEnd=function(e,n,s,a){for(var o=jp(a,3),l=o[0],u=o[1],h=o[2],T=h.lastIndex=s.index+s[0].length,f,d=0;f=h.exec(e);){if((f[1]||f[0])===l&&d===0)return(0,D9.protoItem)(s[0],e.substr(T,f.index-T),f[0],n,s.index,f.index+f[0].length,u);f[0]==="{"?d++:f[0]==="}"&&d&&d--}return null},t.prototype.findMathInString=function(e,n,s){var a,o;for(this.start.lastIndex=0;a=this.start.exec(s);){if(a[this.env]!==void 0&&this.env){var l="\\\\end\\s*(\\{"+(0,Ds.quotePattern)(a[this.env])+"\\})";o=this.findEnd(s,n,a,["{"+a[this.env]+"}",!0,this.endPattern(null,l)]),o&&(o.math=o.open+o.math+o.close,o.open=o.close="")}else if(a[this.sub]!==void 0&&this.sub){var u=a[this.sub],l=a.index+a[this.sub].length;u.length===2?o=(0,D9.protoItem)("",u.substr(1),"",n,a.index,l):o=(0,D9.protoItem)("",u,"",n,a.index,l,!1)}else o=this.findEnd(s,n,a,this.end[a[0]]);o&&(e.push(o),this.start.lastIndex=o.end.n)}},t.prototype.findMath=function(e){var n=[];if(this.hasPatterns)for(var s=0,a=e.length;s<a;s++)this.findMathInString(n,s,e[s]);return n},t.OPTIONS={inlineMath:[["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,processEnvironments:!0,processRefs:!0},t}(gV.AbstractFindMath);x7.FindTeX=mV;var LT={},Ne={},O9=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},yV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},vV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Ne,"__esModule",{value:!0});var Gp=jt,LV=g4,Nc;(function(r){var t=new Map([["autoOP",!0],["fnOP",!0],["movesupsub",!0],["subsupOK",!0],["texprimestyle",!0],["useHeight",!0],["variantForm",!0],["withDelims",!0],["mathaccent",!0],["open",!0],["close",!0]]);function e(S){return String.fromCodePoint(parseInt(S,16))}r.createEntity=e;function n(S){return S.childNodes}r.getChildren=n;function s(S){return S.getText()}r.getText=s;function a(S,E){var A,M;try{for(var D=O9(E),I=D.next();!I.done;I=D.next()){var P=I.value;S.appendChild(P)}}catch(R){A={error:R}}finally{try{I&&!I.done&&(M=D.return)&&M.call(D)}finally{if(A)throw A.error}}}r.appendChildren=a;function o(S,E,A){S.attributes.set(E,A)}r.setAttribute=o;function l(S,E,A){S.setProperty(E,A)}r.setProperty=l;function u(S,E){var A,M;try{for(var D=O9(Object.keys(E)),I=D.next();!I.done;I=D.next()){var P=I.value,R=E[P];P==="texClass"?(S.texClass=R,S.setProperty(P,R)):P==="movablelimits"?(S.setProperty("movablelimits",R),(S.isKind("mo")||S.isKind("mstyle"))&&S.attributes.set("movablelimits",R)):P==="inferred"||(t.has(P)?S.setProperty(P,R):S.attributes.set(P,R))}}catch(F){A={error:F}}finally{try{I&&!I.done&&(M=D.return)&&M.call(D)}finally{if(A)throw A.error}}}r.setProperties=u;function h(S,E){return S.getProperty(E)}r.getProperty=h;function T(S,E){return S.attributes.get(E)}r.getAttribute=T;function f(S){for(var E=[],A=1;A<arguments.length;A++)E[A-1]=arguments[A];S.removeProperty.apply(S,vV([],yV(E),!1))}r.removeProperties=f;function d(S,E){return S.childNodes[E]}r.getChildAt=d;function p(S,E,A){var M=S.childNodes;M[E]=A,A&&(A.parent=S)}r.setChild=p;function m(S,E){for(var A=S.childNodes,M=0;M<A.length;M++)p(E,M,A[M])}r.copyChildren=m;function y(S,E){E.attributes=S.attributes,u(E,S.getAllProperties())}r.copyAttributes=y;function c(S,E){return S.isKind(E)}r.isType=c;function Q(S){return S.isEmbellished}r.isEmbellished=Q;function g(S){return S.texClass}r.getTexClass=g;function v(S){return S.coreMO()}r.getCoreMO=v;function L(S){return S instanceof Gp.AbstractMmlNode||S instanceof Gp.AbstractMmlEmptyNode}r.isNode=L;function x(S){return S.isInferred}r.isInferred=x;function b(S){var E,A;if(!c(S,"mo"))return null;var M=S,D=M.getForms();try{for(var I=O9(D),P=I.next();!P.done;P=I.next()){var R=P.value,F=LV.MmlMo.OPTABLE[R][M.getText()];if(F)return F}}catch(X){E={error:X}}finally{try{P&&!P.done&&(A=I.return)&&A.call(I)}finally{if(E)throw E.error}}return null}r.getForm=b})(Nc||(Nc={}));Ne.default=Nc;var Ar=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(LT,"__esModule",{value:!0});var zp=jt,R1=xV(Ne),Uc;(function(r){r.cleanStretchy=function(a){var o,l,u=a.data;try{for(var h=Ar(u.getList("fixStretchy")),T=h.next();!T.done;T=h.next()){var f=T.value;if(R1.default.getProperty(f,"fixStretchy")){var d=R1.default.getForm(f);d&&d[3]&&d[3].stretchy&&R1.default.setAttribute(f,"stretchy",!1);var p=f.parent;if(!R1.default.getTexClass(f)&&(!d||!d[2])){var m=u.nodeFactory.create("node","TeXAtom",[f]);p.replaceChild(m,f),m.inheritAttributesFrom(f)}R1.default.removeProperties(f,"fixStretchy")}}}catch(y){o={error:y}}finally{try{T&&!T.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}},r.cleanAttributes=function(a){var o=a.data.root;o.walkTree(function(l,u){var h,T,f=l.attributes;if(f){var d=new Set((f.get("mjx-keep-attrs")||"").split(/ /));delete f.getAllAttributes()["mjx-keep-attrs"];try{for(var p=Ar(f.getExplicitNames()),m=p.next();!m.done;m=p.next()){var y=m.value;!d.has(y)&&f.attributes[y]===l.attributes.getInherited(y)&&delete f.attributes[y]}}catch(c){h={error:c}}finally{try{m&&!m.done&&(T=p.return)&&T.call(p)}finally{if(h)throw h.error}}}},{})},r.combineRelations=function(a){var o,l,u,h,T=[];try{for(var f=Ar(a.data.getList("mo")),d=f.next();!d.done;d=f.next()){var p=d.value;if(!(p.getProperty("relationsCombined")||!p.parent||p.parent&&!R1.default.isType(p.parent,"mrow")||R1.default.getTexClass(p)!==zp.TEXCLASS.REL)){for(var m=p.parent,y=void 0,c=m.childNodes,Q=c.indexOf(p)+1,g=R1.default.getProperty(p,"variantForm");Q<c.length&&(y=c[Q])&&R1.default.isType(y,"mo")&&R1.default.getTexClass(y)===zp.TEXCLASS.REL;)if(g===R1.default.getProperty(y,"variantForm")&&e(p,y)){R1.default.appendChildren(p,R1.default.getChildren(y)),t(["stretchy","rspace"],p,y);try{for(var v=(u=void 0,Ar(y.getPropertyNames())),L=v.next();!L.done;L=v.next()){var x=L.value;p.setProperty(x,y.getProperty(x))}}catch(b){u={error:b}}finally{try{L&&!L.done&&(h=v.return)&&h.call(v)}finally{if(u)throw u.error}}c.splice(Q,1),T.push(y),y.parent=null,y.setProperty("relationsCombined",!0)}else{p.attributes.getExplicit("rspace")==null&&R1.default.setAttribute(p,"rspace","0pt"),y.attributes.getExplicit("lspace")==null&&R1.default.setAttribute(y,"lspace","0pt");break}p.attributes.setInherited("form",p.getForms()[0])}}}catch(b){o={error:b}}finally{try{d&&!d.done&&(l=f.return)&&l.call(f)}finally{if(o)throw o.error}}a.data.removeFromList("mo",T)};var t=function(a,o,l){var u=o.attributes,h=l.attributes;a.forEach(function(T){var f=h.getExplicit(T);f!=null&&u.set(T,f)})},e=function(a,o){var l,u,h=function(Q,g){var v=Q.getExplicitNames();return v.filter(function(L){return L!==g&&(L!=="stretchy"||Q.getExplicit("stretchy"))})},T=a.attributes,f=o.attributes,d=h(T,"lspace"),p=h(f,"rspace");if(d.length!==p.length)return!1;try{for(var m=Ar(d),y=m.next();!y.done;y=m.next()){var c=y.value;if(T.getExplicit(c)!==f.getExplicit(c))return!1}}catch(Q){l={error:Q}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}return!0},n=function(a,o,l){var u,h,T=[];try{for(var f=Ar(a.getList("m"+o+l)),d=f.next();!d.done;d=f.next()){var p=d.value,m=p.childNodes;if(!(m[p[o]]&&m[p[l]])){var y=p.parent,c=m[p[o]]?a.nodeFactory.create("node","m"+o,[m[p.base],m[p[o]]]):a.nodeFactory.create("node","m"+l,[m[p.base],m[p[l]]]);R1.default.copyAttributes(p,c),y?y.replaceChild(c,p):a.root=c,T.push(p)}}}catch(Q){u={error:Q}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}a.removeFromList("m"+o+l,T)};r.cleanSubSup=function(a){var o=a.data;o.error||(n(o,"sub","sup"),n(o,"under","over"))};var s=function(a,o,l){var u,h,T=[];try{for(var f=Ar(a.getList(o)),d=f.next();!d.done;d=f.next()){var p=d.value;if(!p.attributes.get("displaystyle")){var m=p.childNodes[p.base],y=m.coreMO();if(m.getProperty("movablelimits")&&!y.attributes.getExplicit("movablelimits")){var c=a.nodeFactory.create("node",l,p.childNodes);R1.default.copyAttributes(p,c),p.parent?p.parent.replaceChild(c,p):a.root=c,T.push(p)}}}}catch(Q){u={error:Q}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}a.removeFromList(o,T)};r.moveLimits=function(a){var o=a.data;s(o,"munderover","msubsup"),s(o,"munder","msub"),s(o,"mover","msup")},r.setInherited=function(a){a.data.root.setInheritedAttributes({},a.math.display,0,!1)}})(Uc||(Uc={}));LT.default=Uc;var Os={},Is={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});var _V=function(){function r(t,e){for(var n=[],s=2;s<arguments.length;s++)n[s-2]=arguments[s];this.id=t,this.message=r.processString(e,n)}return r.processString=function(t,e){for(var n=t.split(r.pattern),s=1,a=n.length;s<a;s+=2){var o=n[s].charAt(0);if(o>="0"&&o<="9")n[s]=e[parseInt(n[s],10)-1],typeof n[s]=="number"&&(n[s]=n[s].toString());else if(o==="{")if(o=n[s].substr(1),o>="0"&&o<="9")n[s]=e[parseInt(n[s].substr(1,n[s].length-2),10)-1],typeof n[s]=="number"&&(n[s]=n[s].toString());else{var l=n[s].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);l&&(n[s]="%"+n[s])}n[s]==null&&(n[s]="???")}return n.join("")},r.pattern=/%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%\{\d+\}|%.|[^\}])*)+\}|.)/g,r}();Le.default=_V;var Wp;function Ue(){if(Wp)return Is;Wp=1;var r=_&&_.__read||function(h,T){var f=typeof Symbol=="function"&&h[Symbol.iterator];if(!f)return h;var d=f.call(h),p,m=[],y;try{for(;(T===void 0||T-- >0)&&!(p=d.next()).done;)m.push(p.value)}catch(c){y={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(y)throw y.error}}return m},t=_&&_.__values||function(h){var T=typeof Symbol=="function"&&Symbol.iterator,f=T&&h[T],d=0;if(f)return f.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&d>=h.length&&(h=void 0),{value:h&&h[d++],done:!h}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(Is,"__esModule",{value:!0});var n=jt,s=e(Ne),a=e(t2()),o=e(Le),l=zn,u;return function(h){var T=7.2,f=72,d={em:function(W){return W},ex:function(W){return W*.43},pt:function(W){return W/10},pc:function(W){return W*1.2},px:function(W){return W*T/f},in:function(W){return W*T},cm:function(W){return W*T/2.54},mm:function(W){return W*T/25.4},mu:function(W){return W/18}},p="([-+]?([.,]\\d+|\\d+([.,]\\d*)?))",m="(pt|em|ex|mu|px|mm|cm|in|pc)",y=RegExp("^\\s*"+p+"\\s*"+m+"\\s*$"),c=RegExp("^\\s*"+p+"\\s*"+m+" ?");function Q(W,$){$===void 0&&($=!1);var Lt=W.match($?c:y);return Lt?g([Lt[1].replace(/,/,"."),Lt[4],Lt[0].length]):[null,null,0]}h.matchDimen=Q;function g(W){var $=r(W,3),Lt=$[0],wt=$[1],At=$[2];if(wt!=="mu")return[Lt,wt,At];var zt=L(d[wt](parseFloat(Lt||"1")));return[zt.slice(0,-2),"em",At]}function v(W){var $=r(Q(W),2),Lt=$[0],wt=$[1],At=parseFloat(Lt||"1"),zt=d[wt];return zt?zt(At):0}h.dimen2em=v;function L(W){return Math.abs(W)<6e-4?"0em":W.toFixed(3).replace(/\.?0+$/,"")+"em"}h.Em=L;function x(){for(var W=[],$=0;$<arguments.length;$++)W[$]=arguments[$];return W.map(function(Lt){return L(Lt)}).join(" ")}h.cols=x;function b(W,$,Lt,wt,At,zt){At===void 0&&(At=""),zt===void 0&&(zt="");var Ot=W.nodeFactory,It=Ot.create("node","mrow",[],{open:$,close:wt,texClass:n.TEXCLASS.INNER}),Ut;if(At)Ut=new a.default("\\"+At+"l"+$,W.parser.stack.env,W).mml();else{var Et=Ot.create("text",$);Ut=Ot.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:n.TEXCLASS.OPEN},Et)}if(s.default.appendChildren(It,[Ut,Lt]),At)Ut=new a.default("\\"+At+"r"+wt,W.parser.stack.env,W).mml();else{var ae=Ot.create("text",wt);Ut=Ot.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:n.TEXCLASS.CLOSE},ae)}return zt&&Ut.attributes.set("mathcolor",zt),s.default.appendChildren(It,[Ut]),It}h.fenced=b;function S(W,$,Lt,wt){var At=W.nodeFactory.create("node","mrow",[],{open:$,close:wt,texClass:n.TEXCLASS.ORD});return $&&s.default.appendChildren(At,[E(W,$,"l")]),s.default.isType(Lt,"mrow")?s.default.appendChildren(At,s.default.getChildren(Lt)):s.default.appendChildren(At,[Lt]),wt&&s.default.appendChildren(At,[E(W,wt,"r")]),At}h.fixedFence=S;function E(W,$,Lt){($==="{"||$==="}")&&($="\\"+$);var wt="{\\bigg"+Lt+" "+$+"}",At="{\\big"+Lt+" "+$+"}";return new a.default("\\mathchoice"+wt+At+At+At,{},W).mml()}h.mathPalette=E;function A(W,$){for(var Lt=0,wt=$.length;Lt<wt;Lt++){var At=$[Lt];if(At&&!s.default.isType(At,"mspace")&&(!s.default.isType(At,"TeXAtom")||s.default.getChildren(At)[0]&&s.default.getChildren(s.default.getChildren(At)[0]).length)){if(s.default.isEmbellished(At)||s.default.isType(At,"TeXAtom")&&s.default.getTexClass(At)===n.TEXCLASS.REL){var zt=W.nodeFactory.create("node","mi");$.unshift(zt)}break}}}h.fixInitialMO=A;function M(W,$,Lt,wt){if(W.configuration.options.internalMath)return W.configuration.options.internalMath(W,$,Lt,wt);var At=wt||W.stack.env.font,zt=At?{mathvariant:At}:{},Ot=[],It=0,Ut=0,Et,ae,xt="",Ee=0;if($.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)){for(;It<$.length;)if(Et=$.charAt(It++),Et==="$")xt==="$"&&Ee===0?(ae=W.create("node","TeXAtom",[new a.default($.slice(Ut,It-1),{},W.configuration).mml()]),Ot.push(ae),xt="",Ut=It):xt===""&&(Ut<It-1&&Ot.push(D(W,$.slice(Ut,It-1),zt)),xt="$",Ut=It);else if(Et==="{"&&xt!=="")Ee++;else if(Et==="}")if(xt==="}"&&Ee===0){var je=new a.default($.slice(Ut,It),{},W.configuration).mml();ae=W.create("node","TeXAtom",[je],zt),Ot.push(ae),xt="",Ut=It}else xt!==""&&Ee&&Ee--;else if(Et==="\\")if(xt===""&&$.substr(It).match(/^(eq)?ref\s*\{/)){var Z1=RegExp["$&"].length;Ut<It-1&&Ot.push(D(W,$.slice(Ut,It-1),zt)),xt="}",Ut=It-1,It+=Z1}else Et=$.charAt(It++),Et==="("&&xt===""?(Ut<It-2&&Ot.push(D(W,$.slice(Ut,It-2),zt)),xt=")",Ut=It):Et===")"&&xt===")"&&Ee===0?(ae=W.create("node","TeXAtom",[new a.default($.slice(Ut,It-2),{},W.configuration).mml()]),Ot.push(ae),xt="",Ut=It):Et.match(/[${}\\]/)&&xt===""&&(It--,$=$.substr(0,It-1)+$.substr(It));if(xt!=="")throw new o.default("MathNotTerminated","Math not terminated in text box")}return Ut<$.length&&Ot.push(D(W,$.slice(Ut),zt)),Lt!=null?Ot=[W.create("node","mstyle",Ot,{displaystyle:!1,scriptlevel:Lt})]:Ot.length>1&&(Ot=[W.create("node","mrow",Ot)]),Ot}h.internalMath=M;function D(W,$,Lt){$=$.replace(/^\s+/,l.entities.nbsp).replace(/\s+$/,l.entities.nbsp);var wt=W.create("text",$);return W.create("node","mtext",[],Lt,wt)}h.internalText=D;function I(W,$,Lt,wt,At){if(h.checkMovableLimits($),s.default.isType($,"munderover")&&s.default.isEmbellished($)){s.default.setProperties(s.default.getCoreMO($),{lspace:0,rspace:0});var zt=W.create("node","mo",[],{rspace:0});$=W.create("node","mrow",[zt,$])}var Ot=W.create("node","munderover",[$]);s.default.setChild(Ot,wt==="over"?Ot.over:Ot.under,Lt);var It=Ot;return At&&(It=W.create("node","TeXAtom",[Ot],{texClass:n.TEXCLASS.OP,movesupsub:!0})),s.default.setProperty(It,"subsupOK",!0),It}h.underOver=I;function P(W){var $=s.default.isType(W,"mo")?s.default.getForm(W):null;(s.default.getProperty(W,"movablelimits")||$&&$[3]&&$[3].movablelimits)&&s.default.setProperties(W,{movablelimits:!1})}h.checkMovableLimits=P;function R(W){if(typeof W!="string")return W;var $=W.trim();return $.match(/\\$/)&&W.match(/ $/)&&($+=" "),$}h.trimSpaces=R;function F(W,$){return $=h.trimSpaces($||""),$==="t"?W.arraydef.align="baseline 1":$==="b"?W.arraydef.align="baseline -1":$==="c"?W.arraydef.align="axis":$&&(W.arraydef.align=$),W}h.setArrayAlign=F;function X(W,$,Lt){for(var wt="",At="",zt=0;zt<Lt.length;){var Ot=Lt.charAt(zt++);if(Ot==="\\")wt+=Ot+Lt.charAt(zt++);else if(Ot==="#")if(Ot=Lt.charAt(zt++),Ot==="#")wt+=Ot;else{if(!Ot.match(/[1-9]/)||parseInt(Ot,10)>$.length)throw new o.default("IllegalMacroParam","Illegal macro parameter reference");At=st(W,st(W,At,wt),$[parseInt(Ot,10)-1]),wt=""}else wt+=Ot}return st(W,At,wt)}h.substituteArgs=X;function st(W,$,Lt){if(Lt.match(/^[a-z]/i)&&$.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&($+=" "),$.length+Lt.length>W.configuration.options.maxBuffer)throw new o.default("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return $+Lt}h.addArgs=st;function rt(W,$){if($===void 0&&($=!0),!(++W.macroCount<=W.configuration.options.maxMacros))throw $?new o.default("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new o.default("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")}h.checkMaxMacros=rt;function ct(W){if(W.stack.global.eqnenv)throw new o.default("ErroneousNestingEq","Erroneous nesting of equation structures");W.stack.global.eqnenv=!0}h.checkEqnEnv=ct;function U(W,$){var Lt=W.copy(),wt=$.configuration;return Lt.walkTree(function(At){var zt,Ot;wt.addNode(At.kind,At);var It=(At.getProperty("in-lists")||"").split(/,/);try{for(var Ut=t(It),Et=Ut.next();!Et.done;Et=Ut.next()){var ae=Et.value;ae&&wt.addNode(ae,At)}}catch(xt){zt={error:xt}}finally{try{Et&&!Et.done&&(Ot=Ut.return)&&Ot.call(Ut)}finally{if(zt)throw zt.error}}}),Lt}h.copyNode=U;function N(W,$,Lt){return Lt}h.MmlFilterAttribute=N;function K(W){var $=W.stack.env.font;return $?{mathvariant:$}:{}}h.getFontDef=K;function J(W,$,Lt){var wt,At;$===void 0&&($=null),Lt===void 0&&(Lt=!1);var zt=ft(W);if($)try{for(var Ot=t(Object.keys(zt)),It=Ot.next();!It.done;It=Ot.next()){var Ut=It.value;if(!$.hasOwnProperty(Ut)){if(Lt)throw new o.default("InvalidOption","Invalid option: %1",Ut);delete zt[Ut]}}}catch(Et){wt={error:Et}}finally{try{It&&!It.done&&(At=Ot.return)&&At.call(Ot)}finally{if(wt)throw wt.error}}return zt}h.keyvalOptions=J;function ft(W){for(var $,Lt,wt={},At=W,zt,Ot,It;At;)$=r(Qt(At,["=",","]),3),Ot=$[0],zt=$[1],At=$[2],zt==="="?(Lt=r(Qt(At,[","]),3),It=Lt[0],zt=Lt[1],At=Lt[2],It=It==="false"||It==="true"?JSON.parse(It):It,wt[Ot]=It):Ot&&(wt[Ot]=!0);return wt}function Y(W,$){for(;$>0;)W=W.trim().slice(1,-1),$--;return W.trim()}function Qt(W,$){for(var Lt=W.length,wt=0,At="",zt=0,Ot=0,It=!0,Ut=!1;zt<Lt;){var Et=W[zt++];switch(Et){case" ":break;case"{":It?Ot++:(Ut=!1,Ot>wt&&(Ot=wt)),wt++;break;case"}":wt&&wt--,(It||Ut)&&(Ot--,Ut=!0),It=!1;break;default:if(!wt&&$.indexOf(Et)!==-1)return[Ut?"true":Y(At,Ot),Et,W.slice(zt)];It=!1,Ut=!1}At+=Et}if(wt)throw new o.default("ExtraOpenMissingClose","Extra open brace or missing close brace");return[Ut?"true":Y(At,Ot),"",W.slice(zt)]}}(u||(u={})),Is.default=u,Is}var b7={},bV=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qp=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},SV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},EV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(b7,"__esModule",{value:!0});var AV=EV(Ne),HV=function(){function r(t,e,n){this._factory=t,this._env=e,this.global={},this.stack=[],this.global={isInner:n},this.stack=[this._factory.create("start",this.global)],e&&(this.stack[0].env=e),this.env=this.stack[0].env}return Object.defineProperty(r.prototype,"env",{get:function(){return this._env},set:function(t){this._env=t},enumerable:!1,configurable:!0}),r.prototype.Push=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=bV(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(l){var u=AV.default.isNode(l)?this._factory.create("mml",l):l;u.global=this.global;var h=qp(this.stack.length?this.Top().checkItem(u):[null,!0],2),T=h[0],f=h[1];if(f){if(T){this.Pop(),this.Push.apply(this,SV([],qp(T),!1));continue}this.stack.push(u),u.env?(u.copyEnv&&Object.assign(u.env,this.env),this.env=u.env):u.env=this.env}}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.prototype.Pop=function(){var t=this.stack.pop();return t.isOpen||delete t.env,this.env=this.stack.length?this.Top().env:{},t},r.prototype.Top=function(t){return t===void 0&&(t=1),this.stack.length<t?null:this.stack[this.stack.length-t]},r.prototype.Prev=function(t){var e=this.Top();return t?e.First:e.Pop()},r.prototype.toString=function(){return`stack[
118
+ `,wbr:"","#comment":""},ignoreHtmlClass:"mathjax_ignore",processHtmlClass:"mathjax_process"},r}();L7.HTMLDomStrings=rV;var nV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),$4=_&&_.__assign||function(){return $4=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},$4.apply(this,arguments)},Cs=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Er=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(m7,"__esModule",{value:!0});m7.HTMLDocument=void 0;var M9=QT,w9=H1,sV=y7,aV=v7,Np=L7,C9=qn,oV=function(r){nV(t,r);function t(e,n,s){var a=this,o=Cs((0,w9.separateOptions)(s,Np.HTMLDomStrings.OPTIONS),2),l=o[0],u=o[1];return a=r.call(this,e,n,l)||this,a.domStrings=a.options.DomStrings||new Np.HTMLDomStrings(u),a.domStrings.adaptor=n,a.styles=[],a}return t.prototype.findPosition=function(e,n,s,a){var o,l,u=this.adaptor;try{for(var h=Er(a[e]),T=h.next();!T.done;T=h.next()){var f=T.value,d=Cs(f,2),p=d[0],m=d[1];if(n<=m&&u.kind(p)==="#text")return{node:p,n:Math.max(n,0),delim:s};n-=m}}catch(y){o={error:y}}finally{try{T&&!T.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}return{node:null,n:0,delim:s}},t.prototype.mathItem=function(e,n,s){var a=e.math,o=this.findPosition(e.n,e.start.n,e.open,s),l=this.findPosition(e.n,e.end.n,e.close,s);return new this.options.MathItem(a,n,e.display,o,l)},t.prototype.findMath=function(e){var n,s,a,o,l,u,h,T,f;if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,e=(0,w9.userOptions)({elements:this.options.elements||[this.adaptor.body(this.document)]},e);try{for(var d=Er(this.adaptor.getElements(e.elements,this.document)),p=d.next();!p.done;p=d.next()){var m=p.value,y=Cs([null,null],2),c=y[0],Q=y[1];try{for(var g=(a=void 0,Er(this.inputJax)),v=g.next();!v.done;v=g.next()){var L=v.value,x=new this.options.MathList;if(L.processStrings){c===null&&(l=Cs(this.domStrings.find(m),2),c=l[0],Q=l[1]);try{for(var b=(u=void 0,Er(L.findMath(c))),S=b.next();!S.done;S=b.next()){var E=S.value;x.push(this.mathItem(E,L,Q))}}catch(I){u={error:I}}finally{try{S&&!S.done&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}}else try{for(var A=(T=void 0,Er(L.findMath(m))),M=A.next();!M.done;M=A.next()){var E=M.value,D=new this.options.MathItem(E.math,L,E.display,E.start,E.end);x.push(D)}}catch(I){T={error:I}}finally{try{M&&!M.done&&(f=A.return)&&f.call(A)}finally{if(T)throw T.error}}this.math.merge(x)}}catch(I){a={error:I}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}}}catch(I){n={error:I}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(n)throw n.error}}this.processed.set("findMath")}return this},t.prototype.updateDocument=function(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),r.prototype.updateDocument.call(this),this.processed.set("updateDocument")),this},t.prototype.addPageElements=function(){var e=this.adaptor.body(this.document),n=this.documentPageElements();n&&this.adaptor.append(e,n)},t.prototype.addStyleSheet=function(){var e=this.documentStyleSheet(),n=this.adaptor;if(e&&!n.parent(e)){var s=n.head(this.document),a=this.findSheet(s,n.getAttribute(e,"id"));a?n.replace(e,a):n.append(s,e)}},t.prototype.findSheet=function(e,n){var s,a;if(n)try{for(var o=Er(this.adaptor.tags(e,"style")),l=o.next();!l.done;l=o.next()){var u=l.value;if(this.adaptor.getAttribute(u,"id")===n)return u}}catch(h){s={error:h}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(s)throw s.error}}return null},t.prototype.removeFromDocument=function(e){var n,s;if(e===void 0&&(e=!1),this.processed.isSet("updateDocument"))try{for(var a=Er(this.math),o=a.next();!o.done;o=a.next()){var l=o.value;l.state()>=C9.STATE.INSERTED&&l.state(C9.STATE.TYPESET,e)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return this.processed.clear("updateDocument"),this},t.prototype.documentStyleSheet=function(){return this.outputJax.styleSheet(this)},t.prototype.documentPageElements=function(){return this.outputJax.pageElements(this)},t.prototype.addStyles=function(e){this.styles.push(e)},t.prototype.getStyles=function(){return this.styles},t.KIND="HTML",t.OPTIONS=$4($4({},M9.AbstractMathDocument.OPTIONS),{renderActions:(0,w9.expandable)($4($4({},M9.AbstractMathDocument.OPTIONS.renderActions),{styles:[C9.STATE.INSERTED+1,"","updateStyleSheet",!1]})),MathList:aV.HTMLMathList,MathItem:sV.HTMLMathItem,DomStrings:null}),t}(M9.AbstractMathDocument);m7.HTMLDocument=oV;var lV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(u7,"__esModule",{value:!0});u7.HTMLHandler=void 0;var uV=c7,cV=m7,hV=function(r){lV(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.documentClass=cV.HTMLDocument,e}return t.prototype.handlesDocument=function(e){var n=this.adaptor;if(typeof e=="string")try{e=n.parse(e,"text/html")}catch{}return e instanceof n.window.Document||e instanceof n.window.HTMLElement||e instanceof n.window.DocumentFragment},t.prototype.create=function(e,n){var s=this.adaptor;if(typeof e=="string")e=s.parse(e,"text/html");else if(e instanceof s.window.HTMLElement||e instanceof s.window.DocumentFragment){var a=e;e=s.parse("","text/html"),s.append(s.body(e),a)}return r.prototype.create.call(this,e,n)},t}(uV.AbstractHandler);u7.HTMLHandler=hV;Object.defineProperty(fT,"__esModule",{value:!0});var Ux=fT.RegisterHTMLHandler=void 0,TV=a7,fV=u7;function QV(r){var t=new fV.HTMLHandler(r);return TV.mathjax.handlers.register(t),t}Ux=fT.RegisterHTMLHandler=QV;var vT={},x7={},_7={};Object.defineProperty(_7,"__esModule",{value:!0});_7.AbstractFindMath=void 0;var Up=H1,dV=function(){function r(t){var e=this.constructor;this.options=(0,Up.userOptions)((0,Up.defaultOptions)({},e.OPTIONS),t)}return r.OPTIONS={},r}();_7.AbstractFindMath=dV;var pV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jp=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a};Object.defineProperty(x7,"__esModule",{value:!0});x7.FindTeX=void 0;var gV=_7,Ds=Ke,D9=qn,mV=function(r){pV(t,r);function t(e){var n=r.call(this,e)||this;return n.getPatterns(),n}return t.prototype.getPatterns=function(){var e=this,n=this.options,s=[],a=[],o=[];this.end={},this.env=this.sub=0;var l=1;n.inlineMath.forEach(function(u){return e.addPattern(s,u,!1)}),n.displayMath.forEach(function(u){return e.addPattern(s,u,!0)}),s.length&&a.push(s.sort(Ds.sortLength).join("|")),n.processEnvironments&&(a.push("\\\\begin\\s*\\{([^}]*)\\}"),this.env=l,l++),n.processEscapes&&o.push("\\\\([\\\\$])"),n.processRefs&&o.push("(\\\\(?:eq)?ref\\s*\\{[^}]*\\})"),o.length&&(a.push("("+o.join("|")+")"),this.sub=l),this.start=new RegExp(a.join("|"),"g"),this.hasPatterns=a.length>0},t.prototype.addPattern=function(e,n,s){var a=jp(n,2),o=a[0],l=a[1];e.push((0,Ds.quotePattern)(o)),this.end[o]=[l,s,this.endPattern(l)]},t.prototype.endPattern=function(e,n){return new RegExp((n||(0,Ds.quotePattern)(e))+"|\\\\(?:[a-zA-Z]|.)|[{}]","g")},t.prototype.findEnd=function(e,n,s,a){for(var o=jp(a,3),l=o[0],u=o[1],h=o[2],T=h.lastIndex=s.index+s[0].length,f,d=0;f=h.exec(e);){if((f[1]||f[0])===l&&d===0)return(0,D9.protoItem)(s[0],e.substr(T,f.index-T),f[0],n,s.index,f.index+f[0].length,u);f[0]==="{"?d++:f[0]==="}"&&d&&d--}return null},t.prototype.findMathInString=function(e,n,s){var a,o;for(this.start.lastIndex=0;a=this.start.exec(s);){if(a[this.env]!==void 0&&this.env){var l="\\\\end\\s*(\\{"+(0,Ds.quotePattern)(a[this.env])+"\\})";o=this.findEnd(s,n,a,["{"+a[this.env]+"}",!0,this.endPattern(null,l)]),o&&(o.math=o.open+o.math+o.close,o.open=o.close="")}else if(a[this.sub]!==void 0&&this.sub){var u=a[this.sub],l=a.index+a[this.sub].length;u.length===2?o=(0,D9.protoItem)("",u.substr(1),"",n,a.index,l):o=(0,D9.protoItem)("",u,"",n,a.index,l,!1)}else o=this.findEnd(s,n,a,this.end[a[0]]);o&&(e.push(o),this.start.lastIndex=o.end.n)}},t.prototype.findMath=function(e){var n=[];if(this.hasPatterns)for(var s=0,a=e.length;s<a;s++)this.findMathInString(n,s,e[s]);return n},t.OPTIONS={inlineMath:[["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,processEnvironments:!0,processRefs:!0},t}(gV.AbstractFindMath);x7.FindTeX=mV;var LT={},Ne={},O9=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},yV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},vV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Ne,"__esModule",{value:!0});var Gp=jt,LV=g4,Nc;(function(r){var t=new Map([["autoOP",!0],["fnOP",!0],["movesupsub",!0],["subsupOK",!0],["texprimestyle",!0],["useHeight",!0],["variantForm",!0],["withDelims",!0],["mathaccent",!0],["open",!0],["close",!0]]);function e(S){return String.fromCodePoint(parseInt(S,16))}r.createEntity=e;function n(S){return S.childNodes}r.getChildren=n;function s(S){return S.getText()}r.getText=s;function a(S,E){var A,M;try{for(var D=O9(E),I=D.next();!I.done;I=D.next()){var P=I.value;S.appendChild(P)}}catch(R){A={error:R}}finally{try{I&&!I.done&&(M=D.return)&&M.call(D)}finally{if(A)throw A.error}}}r.appendChildren=a;function o(S,E,A){S.attributes.set(E,A)}r.setAttribute=o;function l(S,E,A){S.setProperty(E,A)}r.setProperty=l;function u(S,E){var A,M;try{for(var D=O9(Object.keys(E)),I=D.next();!I.done;I=D.next()){var P=I.value,R=E[P];P==="texClass"?(S.texClass=R,S.setProperty(P,R)):P==="movablelimits"?(S.setProperty("movablelimits",R),(S.isKind("mo")||S.isKind("mstyle"))&&S.attributes.set("movablelimits",R)):P==="inferred"||(t.has(P)?S.setProperty(P,R):S.attributes.set(P,R))}}catch(F){A={error:F}}finally{try{I&&!I.done&&(M=D.return)&&M.call(D)}finally{if(A)throw A.error}}}r.setProperties=u;function h(S,E){return S.getProperty(E)}r.getProperty=h;function T(S,E){return S.attributes.get(E)}r.getAttribute=T;function f(S){for(var E=[],A=1;A<arguments.length;A++)E[A-1]=arguments[A];S.removeProperty.apply(S,vV([],yV(E),!1))}r.removeProperties=f;function d(S,E){return S.childNodes[E]}r.getChildAt=d;function p(S,E,A){var M=S.childNodes;M[E]=A,A&&(A.parent=S)}r.setChild=p;function m(S,E){for(var A=S.childNodes,M=0;M<A.length;M++)p(E,M,A[M])}r.copyChildren=m;function y(S,E){E.attributes=S.attributes,u(E,S.getAllProperties())}r.copyAttributes=y;function c(S,E){return S.isKind(E)}r.isType=c;function Q(S){return S.isEmbellished}r.isEmbellished=Q;function g(S){return S.texClass}r.getTexClass=g;function v(S){return S.coreMO()}r.getCoreMO=v;function L(S){return S instanceof Gp.AbstractMmlNode||S instanceof Gp.AbstractMmlEmptyNode}r.isNode=L;function x(S){return S.isInferred}r.isInferred=x;function b(S){var E,A;if(!c(S,"mo"))return null;var M=S,D=M.getForms();try{for(var I=O9(D),P=I.next();!P.done;P=I.next()){var R=P.value,F=LV.MmlMo.OPTABLE[R][M.getText()];if(F)return F}}catch(X){E={error:X}}finally{try{P&&!P.done&&(A=I.return)&&A.call(I)}finally{if(E)throw E.error}}return null}r.getForm=b})(Nc||(Nc={}));Ne.default=Nc;var Ar=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(LT,"__esModule",{value:!0});var zp=jt,R1=xV(Ne),Uc;(function(r){r.cleanStretchy=function(a){var o,l,u=a.data;try{for(var h=Ar(u.getList("fixStretchy")),T=h.next();!T.done;T=h.next()){var f=T.value;if(R1.default.getProperty(f,"fixStretchy")){var d=R1.default.getForm(f);d&&d[3]&&d[3].stretchy&&R1.default.setAttribute(f,"stretchy",!1);var p=f.parent;if(!R1.default.getTexClass(f)&&(!d||!d[2])){var m=u.nodeFactory.create("node","TeXAtom",[f]);p.replaceChild(m,f),m.inheritAttributesFrom(f)}R1.default.removeProperties(f,"fixStretchy")}}}catch(y){o={error:y}}finally{try{T&&!T.done&&(l=h.return)&&l.call(h)}finally{if(o)throw o.error}}},r.cleanAttributes=function(a){var o=a.data.root;o.walkTree(function(l,u){var h,T,f=l.attributes;if(f){var d=new Set((f.get("mjx-keep-attrs")||"").split(/ /));delete f.getAllAttributes()["mjx-keep-attrs"];try{for(var p=Ar(f.getExplicitNames()),m=p.next();!m.done;m=p.next()){var y=m.value;!d.has(y)&&f.attributes[y]===l.attributes.getInherited(y)&&delete f.attributes[y]}}catch(c){h={error:c}}finally{try{m&&!m.done&&(T=p.return)&&T.call(p)}finally{if(h)throw h.error}}}},{})},r.combineRelations=function(a){var o,l,u,h,T=[];try{for(var f=Ar(a.data.getList("mo")),d=f.next();!d.done;d=f.next()){var p=d.value;if(!(p.getProperty("relationsCombined")||!p.parent||p.parent&&!R1.default.isType(p.parent,"mrow")||R1.default.getTexClass(p)!==zp.TEXCLASS.REL)){for(var m=p.parent,y=void 0,c=m.childNodes,Q=c.indexOf(p)+1,g=R1.default.getProperty(p,"variantForm");Q<c.length&&(y=c[Q])&&R1.default.isType(y,"mo")&&R1.default.getTexClass(y)===zp.TEXCLASS.REL;)if(g===R1.default.getProperty(y,"variantForm")&&e(p,y)){R1.default.appendChildren(p,R1.default.getChildren(y)),t(["stretchy","rspace"],p,y);try{for(var v=(u=void 0,Ar(y.getPropertyNames())),L=v.next();!L.done;L=v.next()){var x=L.value;p.setProperty(x,y.getProperty(x))}}catch(b){u={error:b}}finally{try{L&&!L.done&&(h=v.return)&&h.call(v)}finally{if(u)throw u.error}}c.splice(Q,1),T.push(y),y.parent=null,y.setProperty("relationsCombined",!0)}else{p.attributes.getExplicit("rspace")==null&&R1.default.setAttribute(p,"rspace","0pt"),y.attributes.getExplicit("lspace")==null&&R1.default.setAttribute(y,"lspace","0pt");break}p.attributes.setInherited("form",p.getForms()[0])}}}catch(b){o={error:b}}finally{try{d&&!d.done&&(l=f.return)&&l.call(f)}finally{if(o)throw o.error}}a.data.removeFromList("mo",T)};var t=function(a,o,l){var u=o.attributes,h=l.attributes;a.forEach(function(T){var f=h.getExplicit(T);f!=null&&u.set(T,f)})},e=function(a,o){var l,u,h=function(Q,g){var v=Q.getExplicitNames();return v.filter(function(L){return L!==g&&(L!=="stretchy"||Q.getExplicit("stretchy"))})},T=a.attributes,f=o.attributes,d=h(T,"lspace"),p=h(f,"rspace");if(d.length!==p.length)return!1;try{for(var m=Ar(d),y=m.next();!y.done;y=m.next()){var c=y.value;if(T.getExplicit(c)!==f.getExplicit(c))return!1}}catch(Q){l={error:Q}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(l)throw l.error}}return!0},n=function(a,o,l){var u,h,T=[];try{for(var f=Ar(a.getList("m"+o+l)),d=f.next();!d.done;d=f.next()){var p=d.value,m=p.childNodes;if(!(m[p[o]]&&m[p[l]])){var y=p.parent,c=m[p[o]]?a.nodeFactory.create("node","m"+o,[m[p.base],m[p[o]]]):a.nodeFactory.create("node","m"+l,[m[p.base],m[p[l]]]);R1.default.copyAttributes(p,c),y?y.replaceChild(c,p):a.root=c,T.push(p)}}}catch(Q){u={error:Q}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}a.removeFromList("m"+o+l,T)};r.cleanSubSup=function(a){var o=a.data;o.error||(n(o,"sub","sup"),n(o,"under","over"))};var s=function(a,o,l){var u,h,T=[];try{for(var f=Ar(a.getList(o)),d=f.next();!d.done;d=f.next()){var p=d.value;if(!p.attributes.get("displaystyle")){var m=p.childNodes[p.base],y=m.coreMO();if(m.getProperty("movablelimits")&&!y.attributes.getExplicit("movablelimits")){var c=a.nodeFactory.create("node",l,p.childNodes);R1.default.copyAttributes(p,c),p.parent?p.parent.replaceChild(c,p):a.root=c,T.push(p)}}}}catch(Q){u={error:Q}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}a.removeFromList(o,T)};r.moveLimits=function(a){var o=a.data;s(o,"munderover","msubsup"),s(o,"munder","msub"),s(o,"mover","msup")},r.setInherited=function(a){a.data.root.setInheritedAttributes({},a.math.display,0,!1)}})(Uc||(Uc={}));LT.default=Uc;var Os={},Is={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});var _V=function(){function r(t,e){for(var n=[],s=2;s<arguments.length;s++)n[s-2]=arguments[s];this.id=t,this.message=r.processString(e,n)}return r.processString=function(t,e){for(var n=t.split(r.pattern),s=1,a=n.length;s<a;s+=2){var o=n[s].charAt(0);if(o>="0"&&o<="9")n[s]=e[parseInt(n[s],10)-1],typeof n[s]=="number"&&(n[s]=n[s].toString());else if(o==="{")if(o=n[s].substr(1),o>="0"&&o<="9")n[s]=e[parseInt(n[s].substr(1,n[s].length-2),10)-1],typeof n[s]=="number"&&(n[s]=n[s].toString());else{var l=n[s].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);l&&(n[s]="%"+n[s])}n[s]==null&&(n[s]="???")}return n.join("")},r.pattern=/%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%\{\d+\}|%.|[^\}])*)+\}|.)/g,r}();Le.default=_V;var Wp;function Ue(){if(Wp)return Is;Wp=1;var r=_&&_.__read||function(h,T){var f=typeof Symbol=="function"&&h[Symbol.iterator];if(!f)return h;var d=f.call(h),p,m=[],y;try{for(;(T===void 0||T-- >0)&&!(p=d.next()).done;)m.push(p.value)}catch(c){y={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(y)throw y.error}}return m},t=_&&_.__values||function(h){var T=typeof Symbol=="function"&&Symbol.iterator,f=T&&h[T],d=0;if(f)return f.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&d>=h.length&&(h=void 0),{value:h&&h[d++],done:!h}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(Is,"__esModule",{value:!0});var n=jt,s=e(Ne),a=e(e2()),o=e(Le),l=zn,u;return function(h){var T=7.2,f=72,d={em:function(W){return W},ex:function(W){return W*.43},pt:function(W){return W/10},pc:function(W){return W*1.2},px:function(W){return W*T/f},in:function(W){return W*T},cm:function(W){return W*T/2.54},mm:function(W){return W*T/25.4},mu:function(W){return W/18}},p="([-+]?([.,]\\d+|\\d+([.,]\\d*)?))",m="(pt|em|ex|mu|px|mm|cm|in|pc)",y=RegExp("^\\s*"+p+"\\s*"+m+"\\s*$"),c=RegExp("^\\s*"+p+"\\s*"+m+" ?");function Q(W,$){$===void 0&&($=!1);var Lt=W.match($?c:y);return Lt?g([Lt[1].replace(/,/,"."),Lt[4],Lt[0].length]):[null,null,0]}h.matchDimen=Q;function g(W){var $=r(W,3),Lt=$[0],wt=$[1],At=$[2];if(wt!=="mu")return[Lt,wt,At];var zt=L(d[wt](parseFloat(Lt||"1")));return[zt.slice(0,-2),"em",At]}function v(W){var $=r(Q(W),2),Lt=$[0],wt=$[1],At=parseFloat(Lt||"1"),zt=d[wt];return zt?zt(At):0}h.dimen2em=v;function L(W){return Math.abs(W)<6e-4?"0em":W.toFixed(3).replace(/\.?0+$/,"")+"em"}h.Em=L;function x(){for(var W=[],$=0;$<arguments.length;$++)W[$]=arguments[$];return W.map(function(Lt){return L(Lt)}).join(" ")}h.cols=x;function b(W,$,Lt,wt,At,zt){At===void 0&&(At=""),zt===void 0&&(zt="");var Ot=W.nodeFactory,It=Ot.create("node","mrow",[],{open:$,close:wt,texClass:n.TEXCLASS.INNER}),Ut;if(At)Ut=new a.default("\\"+At+"l"+$,W.parser.stack.env,W).mml();else{var Et=Ot.create("text",$);Ut=Ot.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:n.TEXCLASS.OPEN},Et)}if(s.default.appendChildren(It,[Ut,Lt]),At)Ut=new a.default("\\"+At+"r"+wt,W.parser.stack.env,W).mml();else{var ae=Ot.create("text",wt);Ut=Ot.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:n.TEXCLASS.CLOSE},ae)}return zt&&Ut.attributes.set("mathcolor",zt),s.default.appendChildren(It,[Ut]),It}h.fenced=b;function S(W,$,Lt,wt){var At=W.nodeFactory.create("node","mrow",[],{open:$,close:wt,texClass:n.TEXCLASS.ORD});return $&&s.default.appendChildren(At,[E(W,$,"l")]),s.default.isType(Lt,"mrow")?s.default.appendChildren(At,s.default.getChildren(Lt)):s.default.appendChildren(At,[Lt]),wt&&s.default.appendChildren(At,[E(W,wt,"r")]),At}h.fixedFence=S;function E(W,$,Lt){($==="{"||$==="}")&&($="\\"+$);var wt="{\\bigg"+Lt+" "+$+"}",At="{\\big"+Lt+" "+$+"}";return new a.default("\\mathchoice"+wt+At+At+At,{},W).mml()}h.mathPalette=E;function A(W,$){for(var Lt=0,wt=$.length;Lt<wt;Lt++){var At=$[Lt];if(At&&!s.default.isType(At,"mspace")&&(!s.default.isType(At,"TeXAtom")||s.default.getChildren(At)[0]&&s.default.getChildren(s.default.getChildren(At)[0]).length)){if(s.default.isEmbellished(At)||s.default.isType(At,"TeXAtom")&&s.default.getTexClass(At)===n.TEXCLASS.REL){var zt=W.nodeFactory.create("node","mi");$.unshift(zt)}break}}}h.fixInitialMO=A;function M(W,$,Lt,wt){if(W.configuration.options.internalMath)return W.configuration.options.internalMath(W,$,Lt,wt);var At=wt||W.stack.env.font,zt=At?{mathvariant:At}:{},Ot=[],It=0,Ut=0,Et,ae,xt="",Ee=0;if($.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)){for(;It<$.length;)if(Et=$.charAt(It++),Et==="$")xt==="$"&&Ee===0?(ae=W.create("node","TeXAtom",[new a.default($.slice(Ut,It-1),{},W.configuration).mml()]),Ot.push(ae),xt="",Ut=It):xt===""&&(Ut<It-1&&Ot.push(D(W,$.slice(Ut,It-1),zt)),xt="$",Ut=It);else if(Et==="{"&&xt!=="")Ee++;else if(Et==="}")if(xt==="}"&&Ee===0){var je=new a.default($.slice(Ut,It),{},W.configuration).mml();ae=W.create("node","TeXAtom",[je],zt),Ot.push(ae),xt="",Ut=It}else xt!==""&&Ee&&Ee--;else if(Et==="\\")if(xt===""&&$.substr(It).match(/^(eq)?ref\s*\{/)){var Z1=RegExp["$&"].length;Ut<It-1&&Ot.push(D(W,$.slice(Ut,It-1),zt)),xt="}",Ut=It-1,It+=Z1}else Et=$.charAt(It++),Et==="("&&xt===""?(Ut<It-2&&Ot.push(D(W,$.slice(Ut,It-2),zt)),xt=")",Ut=It):Et===")"&&xt===")"&&Ee===0?(ae=W.create("node","TeXAtom",[new a.default($.slice(Ut,It-2),{},W.configuration).mml()]),Ot.push(ae),xt="",Ut=It):Et.match(/[${}\\]/)&&xt===""&&(It--,$=$.substr(0,It-1)+$.substr(It));if(xt!=="")throw new o.default("MathNotTerminated","Math not terminated in text box")}return Ut<$.length&&Ot.push(D(W,$.slice(Ut),zt)),Lt!=null?Ot=[W.create("node","mstyle",Ot,{displaystyle:!1,scriptlevel:Lt})]:Ot.length>1&&(Ot=[W.create("node","mrow",Ot)]),Ot}h.internalMath=M;function D(W,$,Lt){$=$.replace(/^\s+/,l.entities.nbsp).replace(/\s+$/,l.entities.nbsp);var wt=W.create("text",$);return W.create("node","mtext",[],Lt,wt)}h.internalText=D;function I(W,$,Lt,wt,At){if(h.checkMovableLimits($),s.default.isType($,"munderover")&&s.default.isEmbellished($)){s.default.setProperties(s.default.getCoreMO($),{lspace:0,rspace:0});var zt=W.create("node","mo",[],{rspace:0});$=W.create("node","mrow",[zt,$])}var Ot=W.create("node","munderover",[$]);s.default.setChild(Ot,wt==="over"?Ot.over:Ot.under,Lt);var It=Ot;return At&&(It=W.create("node","TeXAtom",[Ot],{texClass:n.TEXCLASS.OP,movesupsub:!0})),s.default.setProperty(It,"subsupOK",!0),It}h.underOver=I;function P(W){var $=s.default.isType(W,"mo")?s.default.getForm(W):null;(s.default.getProperty(W,"movablelimits")||$&&$[3]&&$[3].movablelimits)&&s.default.setProperties(W,{movablelimits:!1})}h.checkMovableLimits=P;function R(W){if(typeof W!="string")return W;var $=W.trim();return $.match(/\\$/)&&W.match(/ $/)&&($+=" "),$}h.trimSpaces=R;function F(W,$){return $=h.trimSpaces($||""),$==="t"?W.arraydef.align="baseline 1":$==="b"?W.arraydef.align="baseline -1":$==="c"?W.arraydef.align="axis":$&&(W.arraydef.align=$),W}h.setArrayAlign=F;function X(W,$,Lt){for(var wt="",At="",zt=0;zt<Lt.length;){var Ot=Lt.charAt(zt++);if(Ot==="\\")wt+=Ot+Lt.charAt(zt++);else if(Ot==="#")if(Ot=Lt.charAt(zt++),Ot==="#")wt+=Ot;else{if(!Ot.match(/[1-9]/)||parseInt(Ot,10)>$.length)throw new o.default("IllegalMacroParam","Illegal macro parameter reference");At=st(W,st(W,At,wt),$[parseInt(Ot,10)-1]),wt=""}else wt+=Ot}return st(W,At,wt)}h.substituteArgs=X;function st(W,$,Lt){if(Lt.match(/^[a-z]/i)&&$.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&($+=" "),$.length+Lt.length>W.configuration.options.maxBuffer)throw new o.default("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return $+Lt}h.addArgs=st;function rt(W,$){if($===void 0&&($=!0),!(++W.macroCount<=W.configuration.options.maxMacros))throw $?new o.default("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new o.default("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")}h.checkMaxMacros=rt;function ct(W){if(W.stack.global.eqnenv)throw new o.default("ErroneousNestingEq","Erroneous nesting of equation structures");W.stack.global.eqnenv=!0}h.checkEqnEnv=ct;function U(W,$){var Lt=W.copy(),wt=$.configuration;return Lt.walkTree(function(At){var zt,Ot;wt.addNode(At.kind,At);var It=(At.getProperty("in-lists")||"").split(/,/);try{for(var Ut=t(It),Et=Ut.next();!Et.done;Et=Ut.next()){var ae=Et.value;ae&&wt.addNode(ae,At)}}catch(xt){zt={error:xt}}finally{try{Et&&!Et.done&&(Ot=Ut.return)&&Ot.call(Ut)}finally{if(zt)throw zt.error}}}),Lt}h.copyNode=U;function N(W,$,Lt){return Lt}h.MmlFilterAttribute=N;function K(W){var $=W.stack.env.font;return $?{mathvariant:$}:{}}h.getFontDef=K;function J(W,$,Lt){var wt,At;$===void 0&&($=null),Lt===void 0&&(Lt=!1);var zt=ft(W);if($)try{for(var Ot=t(Object.keys(zt)),It=Ot.next();!It.done;It=Ot.next()){var Ut=It.value;if(!$.hasOwnProperty(Ut)){if(Lt)throw new o.default("InvalidOption","Invalid option: %1",Ut);delete zt[Ut]}}}catch(Et){wt={error:Et}}finally{try{It&&!It.done&&(At=Ot.return)&&At.call(Ot)}finally{if(wt)throw wt.error}}return zt}h.keyvalOptions=J;function ft(W){for(var $,Lt,wt={},At=W,zt,Ot,It;At;)$=r(Qt(At,["=",","]),3),Ot=$[0],zt=$[1],At=$[2],zt==="="?(Lt=r(Qt(At,[","]),3),It=Lt[0],zt=Lt[1],At=Lt[2],It=It==="false"||It==="true"?JSON.parse(It):It,wt[Ot]=It):Ot&&(wt[Ot]=!0);return wt}function Y(W,$){for(;$>0;)W=W.trim().slice(1,-1),$--;return W.trim()}function Qt(W,$){for(var Lt=W.length,wt=0,At="",zt=0,Ot=0,It=!0,Ut=!1;zt<Lt;){var Et=W[zt++];switch(Et){case" ":break;case"{":It?Ot++:(Ut=!1,Ot>wt&&(Ot=wt)),wt++;break;case"}":wt&&wt--,(It||Ut)&&(Ot--,Ut=!0),It=!1;break;default:if(!wt&&$.indexOf(Et)!==-1)return[Ut?"true":Y(At,Ot),Et,W.slice(zt)];It=!1,Ut=!1}At+=Et}if(wt)throw new o.default("ExtraOpenMissingClose","Extra open brace or missing close brace");return[Ut?"true":Y(At,Ot),"",W.slice(zt)]}}(u||(u={})),Is.default=u,Is}var b7={},bV=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qp=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},SV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},EV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(b7,"__esModule",{value:!0});var AV=EV(Ne),HV=function(){function r(t,e,n){this._factory=t,this._env=e,this.global={},this.stack=[],this.global={isInner:n},this.stack=[this._factory.create("start",this.global)],e&&(this.stack[0].env=e),this.env=this.stack[0].env}return Object.defineProperty(r.prototype,"env",{get:function(){return this._env},set:function(t){this._env=t},enumerable:!1,configurable:!0}),r.prototype.Push=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=bV(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(l){var u=AV.default.isNode(l)?this._factory.create("mml",l):l;u.global=this.global;var h=qp(this.stack.length?this.Top().checkItem(u):[null,!0],2),T=h[0],f=h[1];if(f){if(T){this.Pop(),this.Push.apply(this,SV([],qp(T),!1));continue}this.stack.push(u),u.env?(u.copyEnv&&Object.assign(u.env,this.env),this.env=u.env):u.env=this.env}}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.prototype.Pop=function(){var t=this.stack.pop();return t.isOpen||delete t.env,this.env=this.stack.length?this.Top().env:{},t},r.prototype.Top=function(t){return t===void 0&&(t=1),this.stack.length<t?null:this.stack[this.stack.length-t]},r.prototype.Prev=function(t){var e=this.Top();return t?e.First:e.Pop()},r.prototype.toString=function(){return`stack[
119
119
  `+this.stack.join(`
120
120
  `)+`
121
- ]`},r}();b7.default=HV;var Zp;function t2(){if(Zp)return Os;Zp=1;var r=_&&_.__values||function(h){var T=typeof Symbol=="function"&&Symbol.iterator,f=T&&h[T],d=0;if(f)return f.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&d>=h.length&&(h=void 0),{value:h&&h[d++],done:!h}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},t=_&&_.__read||function(h,T){var f=typeof Symbol=="function"&&h[Symbol.iterator];if(!f)return h;var d=f.call(h),p,m=[],y;try{for(;(T===void 0||T-- >0)&&!(p=d.next()).done;)m.push(p.value)}catch(c){y={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(y)throw y.error}}return m},e=_&&_.__spreadArray||function(h,T,f){if(f||arguments.length===2)for(var d=0,p=T.length,m;d<p;d++)(m||!(d in T))&&(m||(m=Array.prototype.slice.call(T,0,d)),m[d]=T[d]);return h.concat(m||Array.prototype.slice.call(T))},n=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(Os,"__esModule",{value:!0});var s=n(Ue()),a=n(b7),o=n(Le),l=jt,u=function(){function h(T,f,d){var p,m;this._string=T,this.configuration=d,this.macroCount=0,this.i=0,this.currentCS="";var y=f.hasOwnProperty("isInner"),c=f.isInner;delete f.isInner;var Q;if(f){Q={};try{for(var g=r(Object.keys(f)),v=g.next();!v.done;v=g.next()){var L=v.value;Q[L]=f[L]}}catch(x){p={error:x}}finally{try{v&&!v.done&&(m=g.return)&&m.call(g)}finally{if(p)throw p.error}}}this.configuration.pushParser(this),this.stack=new a.default(this.itemFactory,Q,y?c:!0),this.Parse(),this.Push(this.itemFactory.create("stop"))}return Object.defineProperty(h.prototype,"options",{get:function(){return this.configuration.options},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"itemFactory",{get:function(){return this.configuration.itemFactory},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tags",{get:function(){return this.configuration.tags},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"string",{get:function(){return this._string},set:function(T){this._string=T},enumerable:!1,configurable:!0}),h.prototype.parse=function(T,f){return this.configuration.handlers.get(T).parse(f)},h.prototype.lookup=function(T,f){return this.configuration.handlers.get(T).lookup(f)},h.prototype.contains=function(T,f){return this.configuration.handlers.get(T).contains(f)},h.prototype.toString=function(){var T,f,d="";try{for(var p=r(Array.from(this.configuration.handlers.keys())),m=p.next();!m.done;m=p.next()){var y=m.value;d+=y+": "+this.configuration.handlers.get(y)+`
122
- `}}catch(c){T={error:c}}finally{try{m&&!m.done&&(f=p.return)&&f.call(p)}finally{if(T)throw T.error}}return d},h.prototype.Parse=function(){for(var T;this.i<this.string.length;)T=this.getCodePoint(),this.i+=T.length,this.parse("character",[this,T])},h.prototype.Push=function(T){T instanceof l.AbstractMmlNode&&T.isInferred?this.PushAll(T.childNodes):this.stack.Push(T)},h.prototype.PushAll=function(T){var f,d;try{for(var p=r(T),m=p.next();!m.done;m=p.next()){var y=m.value;this.stack.Push(y)}}catch(c){f={error:c}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(f)throw f.error}}},h.prototype.mml=function(){if(!this.stack.Top().isKind("mml"))return null;var T=this.stack.Top().First;return this.configuration.popParser(),T},h.prototype.convertDelimiter=function(T){var f=this.lookup("delimiter",T);return f?f.char:null},h.prototype.getCodePoint=function(){var T=this.string.codePointAt(this.i);return T===void 0?"":String.fromCodePoint(T)},h.prototype.nextIsSpace=function(){return!!this.string.charAt(this.i).match(/\s/)},h.prototype.GetNext=function(){for(;this.nextIsSpace();)this.i++;return this.getCodePoint()},h.prototype.GetCS=function(){var T=this.string.slice(this.i).match(/^(([a-z]+) ?|[\uD800-\uDBFF].|.)/i);return T?(this.i+=T[0].length,T[2]||T[1]):(this.i++," ")},h.prototype.GetArgument=function(T,f){switch(this.GetNext()){case"":if(!f)throw new o.default("MissingArgFor","Missing argument for %1",this.currentCS);return null;case"}":if(!f)throw new o.default("ExtraCloseMissingOpen","Extra close brace or missing open brace");return null;case"\\":return this.i++,"\\"+this.GetCS();case"{":for(var d=++this.i,p=1;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"\\":this.i++;break;case"{":p++;break;case"}":if(--p===0)return this.string.slice(d,this.i-1);break}throw new o.default("MissingCloseBrace","Missing close brace")}var m=this.getCodePoint();return this.i+=m.length,m},h.prototype.GetBrackets=function(T,f){if(this.GetNext()!=="[")return f;for(var d=++this.i,p=0;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"{":p++;break;case"\\":this.i++;break;case"}":if(p--<=0)throw new o.default("ExtraCloseLooking","Extra close brace while looking for %1","']'");break;case"]":if(p===0)return this.string.slice(d,this.i-1);break}throw new o.default("MissingCloseBracket","Could not find closing ']' for argument to %1",this.currentCS)},h.prototype.GetDelimiter=function(T,f){var d=this.GetNext();if(this.i+=d.length,this.i<=this.string.length&&(d==="\\"?d+=this.GetCS():d==="{"&&f&&(this.i--,d=this.GetArgument(T).trim()),this.contains("delimiter",d)))return this.convertDelimiter(d);throw new o.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},h.prototype.GetDimen=function(T){if(this.GetNext()==="{"){var f=this.GetArgument(T),d=t(s.default.matchDimen(f),2),p=d[0],m=d[1];if(p)return p+m}else{var f=this.string.slice(this.i),y=t(s.default.matchDimen(f,!0),3),p=y[0],m=y[1],c=y[2];if(p)return this.i+=c,p+m}throw new o.default("MissingDimOrUnits","Missing dimension or its units for %1",this.currentCS)},h.prototype.GetUpTo=function(T,f){for(;this.nextIsSpace();)this.i++;for(var d=this.i,p=0;this.i<this.string.length;){var m=this.i,y=this.GetNext();switch(this.i+=y.length,y){case"\\":y+=this.GetCS();break;case"{":p++;break;case"}":if(p===0)throw new o.default("ExtraCloseLooking","Extra close brace while looking for %1",f);p--;break}if(p===0&&y===f)return this.string.slice(d,m)}throw new o.default("TokenNotFoundForCommand","Could not find %1 for %2",f,this.currentCS)},h.prototype.ParseArg=function(T){return new h(this.GetArgument(T),this.stack.env,this.configuration).mml()},h.prototype.ParseUpTo=function(T,f){return new h(this.GetUpTo(T,f),this.stack.env,this.configuration).mml()},h.prototype.GetDelimiterArg=function(T){var f=s.default.trimSpaces(this.GetArgument(T));if(f==="")return null;if(this.contains("delimiter",f))return f;throw new o.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},h.prototype.GetStar=function(){var T=this.GetNext()==="*";return T&&this.i++,T},h.prototype.create=function(T){for(var f,d=[],p=1;p<arguments.length;p++)d[p-1]=arguments[p];return(f=this.configuration.nodeFactory).create.apply(f,e([T],t(d),!1))},h}();return Os.default=u,Os}var S7={},xT={},n3={},MV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jc=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Kp=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},wV=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},CV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(n3,"__esModule",{value:!0});n3.BaseItem=n3.MmlStack=void 0;var Xp=CV(Le),jx=function(){function r(t){this._nodes=t}return Object.defineProperty(r.prototype,"nodes",{get:function(){return this._nodes},enumerable:!1,configurable:!0}),r.prototype.Push=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(t=this._nodes).push.apply(t,Kp([],jc(e),!1))},r.prototype.Pop=function(){return this._nodes.pop()},Object.defineProperty(r.prototype,"First",{get:function(){return this._nodes[this.Size()-1]},set:function(t){this._nodes[this.Size()-1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Last",{get:function(){return this._nodes[0]},set:function(t){this._nodes[0]=t},enumerable:!1,configurable:!0}),r.prototype.Peek=function(t){return t==null&&(t=1),this._nodes.slice(this.Size()-t)},r.prototype.Size=function(){return this._nodes.length},r.prototype.Clear=function(){this._nodes=[]},r.prototype.toMml=function(t,e){return t===void 0&&(t=!0),this._nodes.length===1&&!e?this.First:this.create("node",t?"inferredMrow":"mrow",this._nodes,{})},r.prototype.create=function(t){for(var e,n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];return(e=this.factory.configuration.nodeFactory).create.apply(e,Kp([t],jc(n),!1))},r}();n3.MmlStack=jx;var DV=function(r){MV(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,n)||this;return a.factory=e,a.global={},a._properties={},a.isOpen&&(a._env={}),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"base"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"env",{get:function(){return this._env},set:function(e){this._env=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"copyEnv",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getProperty=function(e){return this._properties[e]},t.prototype.setProperty=function(e,n){return this._properties[e]=n,this},Object.defineProperty(t.prototype,"isOpen",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isFinal",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.isKind=function(e){return e===this.kind},t.prototype.checkItem=function(e){if(e.isKind("over")&&this.isOpen&&(e.setProperty("num",this.toMml(!1)),this.Clear()),e.isKind("cell")&&this.isOpen){if(e.getProperty("linebreak"))return t.fail;throw new Xp.default("Misplaced","Misplaced %1",e.getName())}if(e.isClose&&this.getErrors(e.kind)){var n=jc(this.getErrors(e.kind),2),s=n[0],a=n[1];throw new Xp.default(s,a,e.getName())}return e.isFinal?(this.Push(e.First),t.fail):t.success},t.prototype.clearEnv=function(){var e,n;try{for(var s=wV(Object.keys(this.env)),a=s.next();!a.done;a=s.next()){var o=a.value;delete this.env[o]}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},t.prototype.setProperties=function(e){return Object.assign(this._properties,e),this},t.prototype.getName=function(){return this.getProperty("name")},t.prototype.toString=function(){return this.kind+"["+this.nodes.join("; ")+"]"},t.prototype.getErrors=function(e){var n=this.constructor;return(n.errors||{})[e]||t.errors[e]},t.fail=[null,!1],t.success=[null,!0],t.errors={end:["MissingBeginExtraEnd","Missing \\begin{%1} or extra \\end{%1}"],close:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],right:["MissingLeftExtraRight","Missing \\left or extra \\right"],middle:["ExtraMiddle","Extra \\middle"]},t}(jx);n3.BaseItem=DV;var Gx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),I9;Object.defineProperty(xT,"__esModule",{value:!0});var OV=n3,IV=Zn,$p=function(r){Gx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(OV.BaseItem),VV=function(r){Gx(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.defaultKind="dummy",e.configuration=null,e}return t.DefaultStackItems=(I9={},I9[$p.prototype.kind]=$p,I9),t}(IV.AbstractFactory);xT.default=VV;var Xn={},PV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},kV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},RV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.NodeFactory=void 0;var BV=RV(Ne),FV=function(){function r(){this.mmlFactory=null,this.factory={node:r.createNode,token:r.createToken,text:r.createText,error:r.createError}}return r.createNode=function(t,e,n,s,a){n===void 0&&(n=[]),s===void 0&&(s={});var o=t.mmlFactory.create(e);return o.setChildren(n),a&&o.appendChild(a),BV.default.setProperties(o,s),o},r.createToken=function(t,e,n,s){n===void 0&&(n={}),s===void 0&&(s="");var a=t.create("text",s);return t.create("node",e,[],n,a)},r.createText=function(t,e){return e==null?null:t.mmlFactory.create("text").setText(e)},r.createError=function(t,e){var n=t.create("text",e),s=t.create("node","mtext",[],{},n),a=t.create("node","merror",[s],{"data-mjx-error":e});return a},r.prototype.setMmlFactory=function(t){this.mmlFactory=t},r.prototype.set=function(t,e){this.factory[t]=e},r.prototype.setCreators=function(t){for(var e in t)this.set(e,t[e])},r.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var s=this.factory[t]||this.factory.node,a=s.apply(void 0,kV([this,e[0]],PV(e.slice(1)),!1));return t==="node"&&this.configuration.addNode(e[0],a),a},r.prototype.get=function(t){return this.factory[t]},r}();Xn.NodeFactory=FV;var NV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},UV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},Yp=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zx=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(S7,"__esModule",{value:!0});var jV=zx(xT),GV=Xn,Jp=zx(Ne),tg=H1,zV=function(){function r(t,e){e===void 0&&(e=[]),this.options={},this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new GV.NodeFactory,this.nodeFactory.configuration=this,this.nodeFactory.setCreators(t.nodes),this.itemFactory=new jV.default(t.items),this.itemFactory.configuration=this,tg.defaultOptions.apply(void 0,UV([this.options],NV(e),!1)),(0,tg.defaultOptions)(this.options,t.options)}return r.prototype.pushParser=function(t){this.parsers.unshift(t)},r.prototype.popParser=function(){this.parsers.shift()},Object.defineProperty(r.prototype,"parser",{get:function(){return this.parsers[0]},enumerable:!1,configurable:!0}),r.prototype.clear=function(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()},r.prototype.addNode=function(t,e){var n=this.nodeLists[t];if(n||(n=this.nodeLists[t]=[]),n.push(e),e.kind!==t){var s=Jp.default.getProperty(e,"in-lists")||"",a=(s?s.split(/,/):[]).concat(t).join(",");Jp.default.setProperty(e,"in-lists",a)}},r.prototype.getList=function(t){var e,n,s=this.nodeLists[t]||[],a=[];try{for(var o=Yp(s),l=o.next();!l.done;l=o.next()){var u=l.value;this.inTree(u)&&a.push(u)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return this.nodeLists[t]=a,a},r.prototype.removeFromList=function(t,e){var n,s,a=this.nodeLists[t]||[];try{for(var o=Yp(e),l=o.next();!l.done;l=o.next()){var u=l.value,h=a.indexOf(u);h>=0&&a.splice(h,1)}}catch(T){n={error:T}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}},r.prototype.inTree=function(t){for(;t&&t!==this.root;)t=t.parent;return!!t},r}();S7.default=zV;var Hi={};(function(r){var t=_&&_.__extends||function(){var T=function(f,d){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y])},T(f,d)};return function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");T(f,d);function p(){this.constructor=f}f.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}}(),e=_&&_.__values||function(T){var f=typeof Symbol=="function"&&Symbol.iterator,d=f&&T[f],p=0;if(d)return d.call(T);if(T&&typeof T.length=="number")return{next:function(){return T&&p>=T.length&&(T=void 0),{value:T&&T[p++],done:!T}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},n=_&&_.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(r,"__esModule",{value:!0}),r.TagsFactory=r.AllTags=r.NoTags=r.AbstractTags=r.TagInfo=r.Label=void 0;var s=n(t2()),a=function(){function T(f,d){f===void 0&&(f="???"),d===void 0&&(d=""),this.tag=f,this.id=d}return T}();r.Label=a;var o=function(){function T(f,d,p,m,y,c,Q,g){f===void 0&&(f=""),d===void 0&&(d=!1),p===void 0&&(p=!1),m===void 0&&(m=null),y===void 0&&(y=""),c===void 0&&(c=""),Q===void 0&&(Q=!1),g===void 0&&(g=""),this.env=f,this.taggable=d,this.defaultTags=p,this.tag=m,this.tagId=y,this.tagFormat=c,this.noTag=Q,this.labelId=g}return T}();r.TagInfo=o;var l=function(){function T(){this.counter=0,this.allCounter=0,this.configuration=null,this.ids={},this.allIds={},this.labels={},this.allLabels={},this.redo=!1,this.refUpdate=!1,this.currentTag=new o,this.history=[],this.stack=[],this.enTag=function(f,d){var p=this.configuration.nodeFactory,m=p.create("node","mtd",[f]),y=p.create("node","mlabeledtr",[d,m]),c=p.create("node","mtable",[y],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0});return c}}return T.prototype.start=function(f,d,p){this.currentTag&&this.stack.push(this.currentTag),this.currentTag=new o(f,d,p)},Object.defineProperty(T.prototype,"env",{get:function(){return this.currentTag.env},enumerable:!1,configurable:!0}),T.prototype.end=function(){this.history.push(this.currentTag),this.currentTag=this.stack.pop()},T.prototype.tag=function(f,d){this.currentTag.tag=f,this.currentTag.tagFormat=d?f:this.formatTag(f),this.currentTag.noTag=!1},T.prototype.notag=function(){this.tag("",!0),this.currentTag.noTag=!0},Object.defineProperty(T.prototype,"noTag",{get:function(){return this.currentTag.noTag},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"label",{get:function(){return this.currentTag.labelId},set:function(f){this.currentTag.labelId=f},enumerable:!1,configurable:!0}),T.prototype.formatUrl=function(f,d){return d+"#"+encodeURIComponent(f)},T.prototype.formatTag=function(f){return"("+f+")"},T.prototype.formatId=function(f){return"mjx-eqn:"+f.replace(/\s/g,"_")},T.prototype.formatNumber=function(f){return f.toString()},T.prototype.autoTag=function(){this.currentTag.tag==null&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))},T.prototype.clearTag=function(){this.label="",this.tag(null,!0),this.currentTag.tagId=""},T.prototype.getTag=function(f){if(f===void 0&&(f=!1),f)return this.autoTag(),this.makeTag();var d=this.currentTag;return d.taggable&&!d.noTag&&(d.defaultTags&&this.autoTag(),d.tag)?this.makeTag():null},T.prototype.resetTag=function(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()},T.prototype.reset=function(f){f===void 0&&(f=0),this.resetTag(),this.counter=this.allCounter=f,this.allLabels={},this.allIds={}},T.prototype.startEquation=function(f){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new o("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;var d=f.inputData.recompile;d&&(this.refUpdate=!0,this.counter=d.counter)},T.prototype.finishEquation=function(f){this.redo&&(f.inputData.recompile={state:f.state(),counter:this.allCounter}),this.refUpdate||(this.allCounter=this.counter),Object.assign(this.allIds,this.ids),Object.assign(this.allLabels,this.labels)},T.prototype.finalize=function(f,d){if(!d.display||this.currentTag.env||this.currentTag.tag==null)return f;var p=this.makeTag(),m=this.enTag(f,p);return m},T.prototype.makeId=function(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds?this.label||this.currentTag.tag:this.currentTag.tag)},T.prototype.makeTag=function(){this.makeId(),this.label&&(this.labels[this.label]=new a(this.currentTag.tag,this.currentTag.tagId));var f=new s.default("\\text{"+this.currentTag.tagFormat+"}",{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[f],{id:this.currentTag.tagId})},T}();r.AbstractTags=l;var u=function(T){t(f,T);function f(){return T!==null&&T.apply(this,arguments)||this}return f.prototype.autoTag=function(){},f.prototype.getTag=function(){return this.currentTag.tag?T.prototype.getTag.call(this):null},f}(l);r.NoTags=u;var h=function(T){t(f,T);function f(){return T!==null&&T.apply(this,arguments)||this}return f.prototype.finalize=function(d,p){if(!p.display||this.history.find(function(y){return y.taggable}))return d;var m=this.getTag(!0);return this.enTag(d,m)},f}(l);r.AllTags=h,function(T){var f=new Map([["none",u],["all",h]]),d="none";T.OPTIONS={tags:d,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1},T.add=function(p,m){f.set(p,m)},T.addTags=function(p){var m,y;try{for(var c=e(Object.keys(p)),Q=c.next();!Q.done;Q=c.next()){var g=Q.value;T.add(g,p[g])}}catch(v){m={error:v}}finally{try{Q&&!Q.done&&(y=c.return)&&y.call(c)}finally{if(m)throw m.error}}},T.create=function(p){var m=f.get(p)||f.get(d);if(!m)throw Error("Unknown tags class");return new m},T.setDefault=function(p){d=p},T.getDefault=function(){return T.create(d)}}(r.TagsFactory||(r.TagsFactory={}))})(Hi);var he={},S0={};(function(r){var t=_&&_.__values||function(u){var h=typeof Symbol=="function"&&Symbol.iterator,T=h&&u[h],f=0;if(T)return T.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&f>=u.length&&(u=void 0),{value:u&&u[f++],done:!u}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(u,h){var T=typeof Symbol=="function"&&u[Symbol.iterator];if(!T)return u;var f=T.call(u),d,p=[],m;try{for(;(h===void 0||h-- >0)&&!(d=f.next()).done;)p.push(d.value)}catch(y){m={error:y}}finally{try{d&&!d.done&&(T=f.return)&&T.call(f)}finally{if(m)throw m.error}}return p};Object.defineProperty(r,"__esModule",{value:!0}),r.SubHandlers=r.SubHandler=r.MapHandler=void 0;var n=mr,s=p4,a;(function(u){var h=new Map;u.register=function(T){h.set(T.name,T)},u.getMap=function(T){return h.get(T)}})(a=r.MapHandler||(r.MapHandler={}));var o=function(){function u(){this._configuration=new n.PrioritizedList,this._fallback=new s.FunctionList}return u.prototype.add=function(h,T,f){var d,p;f===void 0&&(f=n.PrioritizedList.DEFAULTPRIORITY);try{for(var m=t(h.slice().reverse()),y=m.next();!y.done;y=m.next()){var c=y.value,Q=a.getMap(c);if(!Q){this.warn("Configuration "+c+" not found! Omitted.");return}this._configuration.add(Q,f)}}catch(g){d={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}T&&this._fallback.add(T,f)},u.prototype.parse=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item,y=m.parse(h);if(y)return y}}catch(v){T={error:v}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}var c=e(h,2),Q=c[0],g=c[1];Array.from(this._fallback)[0].item(Q,g)},u.prototype.lookup=function(h){var T=this.applicable(h);return T?T.lookup(h):null},u.prototype.contains=function(h){return!!this.applicable(h)},u.prototype.toString=function(){var h,T,f=[];try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;f.push(m.name)}}catch(y){h={error:y}}finally{try{p&&!p.done&&(T=d.return)&&T.call(d)}finally{if(h)throw h.error}}return f.join(", ")},u.prototype.applicable=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;if(m.contains(h))return m}}catch(y){T={error:y}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.retrieve=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;if(m.name===h)return m}}catch(y){T={error:y}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.warn=function(h){console.log("TexParser Warning: "+h)},u}();r.SubHandler=o;var l=function(){function u(){this.map=new Map}return u.prototype.add=function(h,T,f){var d,p;f===void 0&&(f=n.PrioritizedList.DEFAULTPRIORITY);try{for(var m=t(Object.keys(h)),y=m.next();!y.done;y=m.next()){var c=y.value,Q=c,g=this.get(Q);g||(g=new o,this.set(Q,g)),g.add(h[Q],T[Q],f)}}catch(v){d={error:v}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}},u.prototype.set=function(h,T){this.map.set(h,T)},u.prototype.get=function(h){return this.map.get(h)},u.prototype.retrieve=function(h){var T,f;try{for(var d=t(this.map.values()),p=d.next();!p.done;p=d.next()){var m=p.value,y=m.retrieve(h);if(y)return y}}catch(c){T={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.keys=function(){return this.map.keys()},u}();r.SubHandlers=l})(S0);(function(r){var t=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(f,d){var p=typeof Symbol=="function"&&f[Symbol.iterator];if(!p)return f;var m=p.call(f),y,c=[],Q;try{for(;(d===void 0||d-- >0)&&!(y=m.next()).done;)c.push(y.value)}catch(g){Q={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(Q)throw Q.error}}return c};Object.defineProperty(r,"__esModule",{value:!0}),r.ParserConfiguration=r.ConfigurationHandler=r.Configuration=void 0;var n=H1,s=S0,a=p4,o=mr,l=Hi,u=function(){function f(d,p,m,y,c,Q,g,v,L,x,b,S,E){p===void 0&&(p={}),m===void 0&&(m={}),y===void 0&&(y={}),c===void 0&&(c={}),Q===void 0&&(Q={}),g===void 0&&(g={}),v===void 0&&(v=[]),L===void 0&&(L=[]),x===void 0&&(x=null),b===void 0&&(b=null),this.name=d,this.handler=p,this.fallback=m,this.items=y,this.tags=c,this.options=Q,this.nodes=g,this.preprocessors=v,this.postprocessors=L,this.initMethod=x,this.configMethod=b,this.priority=S,this.parser=E,this.handler=Object.assign({character:[],delimiter:[],macro:[],environment:[]},p)}return f.makeProcessor=function(d,p){return Array.isArray(d)?d:[d,p]},f._create=function(d,p){var m=this;p===void 0&&(p={});var y=p.priority||o.PrioritizedList.DEFAULTPRIORITY,c=p.init?this.makeProcessor(p.init,y):null,Q=p.config?this.makeProcessor(p.config,y):null,g=(p.preprocessors||[]).map(function(x){return m.makeProcessor(x,y)}),v=(p.postprocessors||[]).map(function(x){return m.makeProcessor(x,y)}),L=p.parser||"tex";return new f(d,p.handler||{},p.fallback||{},p.items||{},p.tags||{},p.options||{},p.nodes||{},g,v,c,Q,y,L)},f.create=function(d,p){p===void 0&&(p={});var m=f._create(d,p);return h.set(d,m),m},f.local=function(d){return d===void 0&&(d={}),f._create("",d)},Object.defineProperty(f.prototype,"init",{get:function(){return this.initMethod?this.initMethod[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"config",{get:function(){return this.configMethod?this.configMethod[0]:null},enumerable:!1,configurable:!0}),f}();r.Configuration=u;var h;(function(f){var d=new Map;f.set=function(p,m){d.set(p,m)},f.get=function(p){return d.get(p)},f.keys=function(){return d.keys()}})(h=r.ConfigurationHandler||(r.ConfigurationHandler={}));var T=function(){function f(d,p){var m,y,c,Q;p===void 0&&(p=["tex"]),this.initMethod=new a.FunctionList,this.configMethod=new a.FunctionList,this.configurations=new o.PrioritizedList,this.parsers=[],this.handlers=new s.SubHandlers,this.items={},this.tags={},this.options={},this.nodes={},this.parsers=p;try{for(var g=t(d.slice().reverse()),v=g.next();!v.done;v=g.next()){var L=v.value;this.addPackage(L)}}catch(M){m={error:M}}finally{try{v&&!v.done&&(y=g.return)&&y.call(g)}finally{if(m)throw m.error}}try{for(var x=t(this.configurations),b=x.next();!b.done;b=x.next()){var S=b.value,E=S.item,A=S.priority;this.append(E,A)}}catch(M){c={error:M}}finally{try{b&&!b.done&&(Q=x.return)&&Q.call(x)}finally{if(c)throw c.error}}}return f.prototype.init=function(){this.initMethod.execute(this)},f.prototype.config=function(d){var p,m;this.configMethod.execute(this,d);try{for(var y=t(this.configurations),c=y.next();!c.done;c=y.next()){var Q=c.value;this.addFilters(d,Q.item)}}catch(g){p={error:g}}finally{try{c&&!c.done&&(m=y.return)&&m.call(y)}finally{if(p)throw p.error}}},f.prototype.addPackage=function(d){var p=typeof d=="string"?d:d[0],m=this.getPackage(p);m&&this.configurations.add(m,typeof d=="string"?m.priority:d[1])},f.prototype.add=function(d,p,m){var y,c;m===void 0&&(m={});var Q=this.getPackage(d);this.append(Q),this.configurations.add(Q,Q.priority),this.init();var g=p.parseOptions;g.nodeFactory.setCreators(Q.nodes);try{for(var v=t(Object.keys(Q.items)),L=v.next();!L.done;L=v.next()){var x=L.value;g.itemFactory.setNodeClass(x,Q.items[x])}}catch(b){y={error:b}}finally{try{L&&!L.done&&(c=v.return)&&c.call(v)}finally{if(y)throw y.error}}l.TagsFactory.addTags(Q.tags),(0,n.defaultOptions)(g.options,Q.options),(0,n.userOptions)(g.options,m),this.addFilters(p,Q),Q.config&&Q.config(this,p)},f.prototype.getPackage=function(d){var p=h.get(d);if(p&&this.parsers.indexOf(p.parser)<0)throw Error("Package ".concat(d," doesn't target the proper parser"));return p},f.prototype.append=function(d,p){p=p||d.priority,d.initMethod&&this.initMethod.add(d.initMethod[0],d.initMethod[1]),d.configMethod&&this.configMethod.add(d.configMethod[0],d.configMethod[1]),this.handlers.add(d.handler,d.fallback,p),Object.assign(this.items,d.items),Object.assign(this.tags,d.tags),(0,n.defaultOptions)(this.options,d.options),Object.assign(this.nodes,d.nodes)},f.prototype.addFilters=function(d,p){var m,y,c,Q;try{for(var g=t(p.preprocessors),v=g.next();!v.done;v=g.next()){var L=e(v.value,2),x=L[0],b=L[1];d.preFilters.add(x,b)}}catch(D){m={error:D}}finally{try{v&&!v.done&&(y=g.return)&&y.call(g)}finally{if(m)throw m.error}}try{for(var S=t(p.postprocessors),E=S.next();!E.done;E=S.next()){var A=e(E.value,2),M=A[0],b=A[1];d.postFilters.add(M,b)}}catch(D){c={error:D}}finally{try{E&&!E.done&&(Q=S.return)&&Q.call(S)}finally{if(c)throw c.error}}},f}();r.ParserConfiguration=T})(he);var sr={},Gt={},s3={};Object.defineProperty(s3,"__esModule",{value:!0});s3.Macro=s3.Symbol=void 0;var WV=function(){function r(t,e,n){this._symbol=t,this._char=e,this._attributes=n}return Object.defineProperty(r.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"char",{get:function(){return this._char},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"attributes",{get:function(){return this._attributes},enumerable:!1,configurable:!0}),r}();s3.Symbol=WV;var qV=function(){function r(t,e,n){n===void 0&&(n=[]),this._symbol=t,this._func=e,this._args=n}return Object.defineProperty(r.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"func",{get:function(){return this._func},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"args",{get:function(){return this._args},enumerable:!1,configurable:!0}),r}();s3.Macro=qV;var m4=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),vi=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Wx=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qx=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Gt,"__esModule",{value:!0});Gt.EnvironmentMap=Gt.CommandMap=Gt.MacroMap=Gt.DelimiterMap=Gt.CharacterMap=Gt.AbstractParseMap=Gt.RegExpMap=Gt.AbstractSymbolMap=Gt.parseResult=void 0;var Zx=s3,ZV=S0;function E0(r){return r===void 0?!0:r}Gt.parseResult=E0;var _T=function(){function r(t,e){this._name=t,this._parser=e,ZV.MapHandler.register(this)}return Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r.prototype.parserFor=function(t){return this.contains(t)?this.parser:null},r.prototype.parse=function(t){var e=vi(t,2),n=e[0],s=e[1],a=this.parserFor(s),o=this.lookup(s);return a&&o?E0(a(n,o)):null},Object.defineProperty(r.prototype,"parser",{get:function(){return this._parser},set:function(t){this._parser=t},enumerable:!1,configurable:!0}),r}();Gt.AbstractSymbolMap=_T;var KV=function(r){m4(t,r);function t(e,n,s){var a=r.call(this,e,n)||this;return a._regExp=s,a}return t.prototype.contains=function(e){return this._regExp.test(e)},t.prototype.lookup=function(e){return this.contains(e)?e:null},t}(_T);Gt.RegExpMap=KV;var bT=function(r){m4(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.map=new Map,e}return t.prototype.lookup=function(e){return this.map.get(e)},t.prototype.contains=function(e){return this.map.has(e)},t.prototype.add=function(e,n){this.map.set(e,n)},t.prototype.remove=function(e){this.map.delete(e)},t}(_T);Gt.AbstractParseMap=bT;var Kx=function(r){m4(t,r);function t(e,n,s){var a,o,l=r.call(this,e,n)||this;try{for(var u=Wx(Object.keys(s)),h=u.next();!h.done;h=u.next()){var T=h.value,f=s[T],d=vi(typeof f=="string"?[f,null]:f,2),p=d[0],m=d[1],y=new Zx.Symbol(T,p,m);l.add(T,y)}}catch(c){a={error:c}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l}return t}(bT);Gt.CharacterMap=Kx;var XV=function(r){m4(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1];return r.prototype.parse.call(this,[s,"\\"+a])},t}(Kx);Gt.DelimiterMap=XV;var ST=function(r){m4(t,r);function t(e,n,s){var a,o,l=r.call(this,e,null)||this;try{for(var u=Wx(Object.keys(n)),h=u.next();!h.done;h=u.next()){var T=h.value,f=n[T],d=vi(typeof f=="string"?[f]:f),p=d[0],m=d.slice(1),y=new Zx.Macro(T,s[p],m);l.add(T,y)}}catch(c){a={error:c}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l}return t.prototype.parserFor=function(e){var n=this.lookup(e);return n?n.func:null},t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);return!o||!l?null:E0(l.apply(void 0,qx([s,o.symbol],vi(o.args),!1)))},t}(bT);Gt.MacroMap=ST;var $V=function(r){m4(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);if(!o||!l)return null;var u=s.currentCS;s.currentCS="\\"+a;var h=l.apply(void 0,qx([s,"\\"+o.symbol],vi(o.args),!1));return s.currentCS=u,E0(h)},t}(ST);Gt.CommandMap=$V;var YV=function(r){m4(t,r);function t(e,n,s,a){var o=r.call(this,e,s,a)||this;return o.parser=n,o}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);return!o||!l?null:E0(this.parser(s,o.symbol,l,o.args))},t}(ST);Gt.EnvironmentMap=YV;var Nt={},e1=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),To=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Gc=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},ET=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.EquationItem=Nt.EqnArrayItem=Nt.ArrayItem=Nt.DotsItem=Nt.NonscriptItem=Nt.NotItem=Nt.FnItem=Nt.MmlItem=Nt.CellItem=Nt.PositionItem=Nt.StyleItem=Nt.EndItem=Nt.BeginItem=Nt.RightItem=Nt.Middle=Nt.LeftItem=Nt.OverItem=Nt.SubsupItem=Nt.PrimeItem=Nt.CloseItem=Nt.OpenItem=Nt.StopItem=Nt.StartItem=void 0;var JV=S0,tP=zn,wn=jt,Qr=ET(Le),Ki=ET(Ue()),ge=ET(Ne),ve=n3,eP=function(r){e1(t,r);function t(e,n){var s=r.call(this,e)||this;return s.global=n,s}return Object.defineProperty(t.prototype,"kind",{get:function(){return"start"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("stop")){var n=this.toMml();return this.global.isInner||(n=this.factory.configuration.tags.finalize(n,this.env)),[[this.factory.create("mml",n)],!0]}return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.StartItem=eP;var iP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"stop"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.StopItem=iP;var rP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"open"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("close")){var n=this.toMml(),s=this.create("node","TeXAtom",[n]);return[[this.factory.create("mml",s)],!0]}return r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["ExtraOpenMissingClose","Extra open brace or missing close brace"]}),t}(ve.BaseItem);Nt.OpenItem=rP;var nP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"close"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.CloseItem=nP;var sP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"prime"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n=To(this.Peek(2),2),s=n[0],a=n[1];if(!ge.default.isType(s,"msubsup")||ge.default.isType(s,"msup")){var o=this.create("node","msup",[s,a]);return[[o,e],!0]}return ge.default.setChild(s,s.sup,a),[[s,e],!0]},t}(ve.BaseItem);Nt.PrimeItem=sP;var aP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"subsup"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;var n=this.First,s=this.getProperty("position");if(e.isKind("mml")){if(this.getProperty("primes"))if(s!==2)ge.default.setChild(n,2,this.getProperty("primes"));else{ge.default.setProperty(this.getProperty("primes"),"variantForm",!0);var a=this.create("node","mrow",[this.getProperty("primes"),e.First]);e.First=a}ge.default.setChild(n,s,e.First),this.getProperty("movesupsub")!=null&&ge.default.setProperty(n,"movesupsub",this.getProperty("movesupsub"));var o=this.factory.create("mml",n);return[[o],!0]}if(r.prototype.checkItem.call(this,e)[1]){var l=this.getErrors(["","sub","sup"][s]);throw new(Qr.default.bind.apply(Qr.default,Gc([void 0,l[0],l[1]],To(l.splice(2)),!1)))}return null},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["MissingScript","Missing superscript or subscript argument"],sup:["MissingOpenForSup","Missing open brace for superscript"],sub:["MissingOpenForSub","Missing open brace for subscript"]}),t}(ve.BaseItem);Nt.SubsupItem=aP;var oP=function(r){e1(t,r);function t(e){var n=r.call(this,e)||this;return n.setProperty("name","\\over"),n}return Object.defineProperty(t.prototype,"kind",{get:function(){return"over"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("over"))throw new Qr.default("AmbiguousUseOf","Ambiguous use of %1",e.getName());if(e.isClose){var n=this.create("node","mfrac",[this.getProperty("num"),this.toMml(!1)]);return this.getProperty("thickness")!=null&&ge.default.setAttribute(n,"linethickness",this.getProperty("thickness")),(this.getProperty("open")||this.getProperty("close"))&&(ge.default.setProperty(n,"withDelims",!0),n=Ki.default.fixedFence(this.factory.configuration,this.getProperty("open"),n,this.getProperty("close"))),[[this.factory.create("mml",n),e],!0]}return r.prototype.checkItem.call(this,e)},t.prototype.toString=function(){return"over["+this.getProperty("num")+" / "+this.nodes.join("; ")+"]"},t}(ve.BaseItem);Nt.OverItem=oP;var lP=function(r){e1(t,r);function t(e,n){var s=r.call(this,e)||this;return s.setProperty("delim",n),s}return Object.defineProperty(t.prototype,"kind",{get:function(){return"left"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("right"))return[[this.factory.create("mml",Ki.default.fenced(this.factory.configuration,this.getProperty("delim"),this.toMml(),e.getProperty("delim"),"",e.getProperty("color")))],!0];if(e.isKind("middle")){var n={stretchy:!0};return e.getProperty("color")&&(n.mathcolor=e.getProperty("color")),this.Push(this.create("node","TeXAtom",[],{texClass:wn.TEXCLASS.CLOSE}),this.create("token","mo",n,e.getProperty("delim")),this.create("node","TeXAtom",[],{texClass:wn.TEXCLASS.OPEN})),this.env={},[[this],!0]}return r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["ExtraLeftMissingRight","Extra \\left or missing \\right"]}),t}(ve.BaseItem);Nt.LeftItem=lP;var uP=function(r){e1(t,r);function t(e,n,s){var a=r.call(this,e)||this;return a.setProperty("delim",n),s&&a.setProperty("color",s),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"middle"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.Middle=uP;var cP=function(r){e1(t,r);function t(e,n,s){var a=r.call(this,e)||this;return a.setProperty("delim",n),s&&a.setProperty("color",s),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"right"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.RightItem=cP;var hP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"begin"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new Qr.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return this.getProperty("end")?ve.BaseItem.fail:[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new Qr.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.BeginItem=hP;var TP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"end"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.EndItem=TP;var fP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"style"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(!e.isClose)return r.prototype.checkItem.call(this,e);var n=this.create("node","mstyle",this.nodes,this.getProperty("styles"));return[[this.factory.create("mml",n),e],!0]},t}(ve.BaseItem);Nt.StyleItem=fP;var QP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"position"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isClose)throw new Qr.default("MissingBoxFor","Missing box for %1",this.getName());if(e.isFinal){var n=e.toMml();switch(this.getProperty("move")){case"vertical":return n=this.create("node","mpadded",[n],{height:this.getProperty("dh"),depth:this.getProperty("dd"),voffset:this.getProperty("dh")}),[[this.factory.create("mml",n)],!0];case"horizontal":return[[this.factory.create("mml",this.getProperty("left")),e,this.factory.create("mml",this.getProperty("right"))],!0]}}return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.PositionItem=QP;var dP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"cell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.CellItem=dP;var pP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"isFinal",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kind",{get:function(){return"mml"},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.MmlItem=pP;var gP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"fn"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n=this.First;if(n){if(e.isOpen)return ve.BaseItem.success;if(!e.isKind("fn")){var s=e.First;if(!e.isKind("mml")||!s)return[[n,e],!0];if(ge.default.isType(s,"mstyle")&&s.childNodes.length&&ge.default.isType(s.childNodes[0].childNodes[0],"mspace")||ge.default.isType(s,"mspace"))return[[n,e],!0];ge.default.isEmbellished(s)&&(s=ge.default.getCoreMO(s));var a=ge.default.getForm(s);if(a!=null&&[0,0,1,1,0,1,1,0,0,0][a[2]])return[[n,e],!0]}var o=this.create("token","mo",{texClass:wn.TEXCLASS.NONE},tP.entities.ApplyFunction);return[[n,o,e],!0]}return r.prototype.checkItem.apply(this,arguments)},t}(ve.BaseItem);Nt.FnItem=gP;var mP=function(r){e1(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.remap=JV.MapHandler.getMap("not_remap"),e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"not"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n,s,a;if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;if(e.isKind("mml")&&(ge.default.isType(e.First,"mo")||ge.default.isType(e.First,"mi")||ge.default.isType(e.First,"mtext"))&&(n=e.First,s=ge.default.getText(n),s.length===1&&!ge.default.getProperty(n,"movesupsub")&&ge.default.getChildren(n).length===1))return this.remap.contains(s)?(a=this.create("text",this.remap.lookup(s).char),ge.default.setChild(n,0,a)):(a=this.create("text","̸"),ge.default.appendChildren(n,[a])),[[e],!0];a=this.create("text","⧸");var o=this.create("node","mtext",[],{},a),l=this.create("node","mpadded",[o],{width:0});return n=this.create("node","TeXAtom",[l],{texClass:wn.TEXCLASS.REL}),[[n,e],!0]},t}(ve.BaseItem);Nt.NotItem=mP;var yP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"nonscript"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("mml")&&e.Size()===1){var n=e.First;if(n.isKind("mstyle")&&n.notParent&&(n=ge.default.getChildren(ge.default.getChildren(n)[0])[0]),n.isKind("mspace")){if(n!==e.First){var s=this.create("node","mrow",[e.Pop()]);e.Push(s)}this.factory.configuration.addNode("nonscript",e.First)}}return[[e],!0]},t}(ve.BaseItem);Nt.NonscriptItem=yP;var vP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"dots"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;var n=this.getProperty("ldots"),s=e.First;if(e.isKind("mml")&&ge.default.isEmbellished(s)){var a=ge.default.getTexClass(ge.default.getCoreMO(s));(a===wn.TEXCLASS.BIN||a===wn.TEXCLASS.REL)&&(n=this.getProperty("cdots"))}return[[n,e],!0]},t}(ve.BaseItem);Nt.DotsItem=vP;var Xx=function(r){e1(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.table=[],e.row=[],e.frame=[],e.hfill=[],e.arraydef={},e.dashed=!1,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"array"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"copyEnv",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isClose&&!e.isKind("over")){if(e.getProperty("isEntry"))return this.EndEntry(),this.clearEnv(),ve.BaseItem.fail;if(e.getProperty("isCR"))return this.EndEntry(),this.EndRow(),this.clearEnv(),ve.BaseItem.fail;this.EndTable(),this.clearEnv();var n=this.factory.create("mml",this.createMml());if(this.getProperty("requireClose")){if(e.isKind("close"))return[[n],!0];throw new Qr.default("MissingCloseBrace","Missing close brace")}return[[n,e],!0]}return r.prototype.checkItem.call(this,e)},t.prototype.createMml=function(){var e=this.arraydef.scriptlevel;delete this.arraydef.scriptlevel;var n=this.create("node","mtable",this.table,this.arraydef);return e&&n.setProperty("scriptlevel",e),this.frame.length===4?ge.default.setAttribute(n,"frame",this.dashed?"dashed":"solid"):this.frame.length&&(this.arraydef.rowlines&&(this.arraydef.rowlines=this.arraydef.rowlines.replace(/none( none)+$/,"none")),ge.default.setAttribute(n,"frame",""),n=this.create("node","menclose",[n],{notation:this.frame.join(" ")}),((this.arraydef.columnlines||"none")!=="none"||(this.arraydef.rowlines||"none")!=="none")&&ge.default.setAttribute(n,"data-padding",0)),(this.getProperty("open")||this.getProperty("close"))&&(n=Ki.default.fenced(this.factory.configuration,this.getProperty("open"),n,this.getProperty("close"))),n},t.prototype.EndEntry=function(){var e=this.create("node","mtd",this.nodes);this.hfill.length&&(this.hfill[0]===0&&ge.default.setAttribute(e,"columnalign","right"),this.hfill[this.hfill.length-1]===this.Size()&&ge.default.setAttribute(e,"columnalign",ge.default.getAttribute(e,"columnalign")?"center":"left")),this.row.push(e),this.Clear(),this.hfill=[]},t.prototype.EndRow=function(){var e;this.getProperty("isNumbered")&&this.row.length===3?(this.row.unshift(this.row.pop()),e=this.create("node","mlabeledtr",this.row)):e=this.create("node","mtr",this.row),this.table.push(e),this.row=[]},t.prototype.EndTable=function(){(this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.checkLines()},t.prototype.checkLines=function(){if(this.arraydef.rowlines){var e=this.arraydef.rowlines.split(/ /);e.length===this.table.length?(this.frame.push("bottom"),e.pop(),this.arraydef.rowlines=e.join(" ")):e.length<this.table.length-1&&(this.arraydef.rowlines+=" none")}if(this.getProperty("rowspacing")){for(var n=this.arraydef.rowspacing.split(/ /);n.length<this.table.length;)n.push(this.getProperty("rowspacing")+"em");this.arraydef.rowspacing=n.join(" ")}},t.prototype.addRowSpacing=function(e){if(this.arraydef.rowspacing){var n=this.arraydef.rowspacing.split(/ /);if(!this.getProperty("rowspacing")){var s=Ki.default.dimen2em(n[0]);this.setProperty("rowspacing",s)}for(var a=this.getProperty("rowspacing");n.length<this.table.length;)n.push(Ki.default.Em(a));n[this.table.length-1]=Ki.default.Em(Math.max(0,a+Ki.default.dimen2em(e))),this.arraydef.rowspacing=n.join(" ")}},t}(ve.BaseItem);Nt.ArrayItem=Xx;var LP=function(r){e1(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.maxrow=0,a.factory.configuration.tags.start(n[0],n[2],n[1]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"eqnarray"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){this.row.length&&Ki.default.fixInitialMO(this.factory.configuration,this.nodes);var e=this.create("node","mtd",this.nodes);this.row.push(e),this.Clear()},t.prototype.EndRow=function(){this.row.length>this.maxrow&&(this.maxrow=this.row.length);var e="mtr",n=this.factory.configuration.tags.getTag();n&&(this.row=[n].concat(this.row),e="mlabeledtr"),this.factory.configuration.tags.clearTag();var s=this.create("node",e,this.row);this.table.push(s),this.row=[]},t.prototype.EndTable=function(){r.prototype.EndTable.call(this),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1)},t.prototype.extendArray=function(e,n){if(this.arraydef[e]){var s=this.arraydef[e].split(/ /),a=Gc([],To(s),!1);if(a.length>1){for(;a.length<n;)a.push.apply(a,Gc([],To(s),!1));this.arraydef[e]=a.slice(0,n).join(" ")}}},t}(Xx);Nt.EqnArrayItem=LP;var xP=function(r){e1(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.factory.configuration.tags.start("equation",!0,n[0]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"equation"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){var n=this.toMml(),s=this.factory.configuration.tags.getTag();return this.factory.configuration.tags.end(),[[s?this.factory.configuration.tags.enTag(n,s):n,e],!0]}if(e.isKind("stop"))throw new Qr.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.EquationItem=xP;var q1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.TexConstant=void 0,function(t){t.Variant={NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALLIGRAPHIC:"-tex-calligraphic",BOLDCALLIGRAPHIC:"-tex-bold-calligraphic",OLDSTYLE:"-tex-oldstyle",BOLDOLDSTYLE:"-tex-bold-oldstyle",MATHITALIC:"-tex-mathit"},t.Form={PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},t.LineBreak={AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},t.LineBreakStyle={BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},t.IndentAlign={LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},t.IndentShift={INDENTSHIFT:"indentshift"},t.LineThickness={THIN:"thin",MEDIUM:"medium",THICK:"thick"},t.Notation={LONGDIV:"longdiv",ACTUARIAL:"actuarial",PHASORANGLE:"phasorangle",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",NORTHEASTARROW:"northeastarrow",MADRUWB:"madruwb",UPDIAGONALARROW:"updiagonalarrow"},t.Align={TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},t.Lines={NONE:"none",SOLID:"solid",DASHED:"dashed"},t.Side={LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},t.Width={AUTO:"auto",FIT:"fit"},t.Actiontype={TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},t.Overflow={LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},t.Unit={EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"}}(r.TexConstant||(r.TexConstant={}))})(q1);var p2={},G3={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.px=r.emRounded=r.em=r.percent=r.length2em=r.MATHSPACE=r.RELUNITS=r.UNITS=r.BIGDIMEN=void 0,r.BIGDIMEN=1e6,r.UNITS={px:1,in:96,cm:96/2.54,mm:96/25.4},r.RELUNITS={em:1,ex:.431,pt:1/10,pc:12/10,mu:1/18},r.MATHSPACE={veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:.04,medium:.06,thick:.1,normal:1,big:2,small:1/Math.sqrt(2),infinity:r.BIGDIMEN};function t(o,l,u,h){if(l===void 0&&(l=0),u===void 0&&(u=1),h===void 0&&(h=16),typeof o!="string"&&(o=String(o)),o===""||o==null)return l;if(r.MATHSPACE[o])return r.MATHSPACE[o];var T=o.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);if(!T)return l;var f=parseFloat(T[1]||"1"),d=T[2];return r.UNITS.hasOwnProperty(d)?f*r.UNITS[d]/h/u:r.RELUNITS.hasOwnProperty(d)?f*r.RELUNITS[d]:d==="%"?f/100*l:f*l}r.length2em=t;function e(o){return(100*o).toFixed(1).replace(/\.?0+$/,"")+"%"}r.percent=e;function n(o){return Math.abs(o)<.001?"0":o.toFixed(3).replace(/\.?0+$/,"")+"em"}r.em=n;function s(o,l){return l===void 0&&(l=16),o=(Math.round(o*l)+.05)/l,Math.abs(o)<.001?"0em":o.toFixed(3).replace(/\.?0+$/,"")+"em"}r.emRounded=s;function a(o,l,u){return l===void 0&&(l=-r.BIGDIMEN),u===void 0&&(u=16),o*=u,l&&o<l&&(o=l),Math.abs(o)<.1?"0":o.toFixed(1).replace(/\.0$/,"")+"px"}r.px=a})(G3);var Cn=_&&_.__assign||function(){return Cn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Cn.apply(this,arguments)},_P=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),bP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),SP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&_P(t,r,e);return bP(t,r),t},AT=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},E7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(p2,"__esModule",{value:!0});var HT=SP(Nt),_t=E7(Ne),S1=E7(Le),A7=E7(t2()),MT=q1,c1=E7(Ue()),$n=jt,$x=Hi,Yx=G3,zc=zn,EP=H1,Vt={},AP=1.2/.85,HP={fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,class:1,href:1,style:1};Vt.Open=function(r,t){r.Push(r.itemFactory.create("open"))};Vt.Close=function(r,t){r.Push(r.itemFactory.create("close"))};Vt.Tilde=function(r,t){r.Push(r.create("token","mtext",{},zc.entities.nbsp))};Vt.Space=function(r,t){};Vt.Superscript=function(r,t){var e;r.GetNext().match(/\d/)&&(r.string=r.string.substr(0,r.i+1)+" "+r.string.substr(r.i+1));var n,s,a=r.stack.Top();a.isKind("prime")?(e=AT(a.Peek(2),2),s=e[0],n=e[1],r.stack.Pop()):(s=r.stack.Prev(),s||(s=r.create("token","mi",{},"")));var o=_t.default.getProperty(s,"movesupsub"),l=_t.default.isType(s,"msubsup")?s.sup:s.over;if(_t.default.isType(s,"msubsup")&&!_t.default.isType(s,"msup")&&_t.default.getChildAt(s,s.sup)||_t.default.isType(s,"munderover")&&!_t.default.isType(s,"mover")&&_t.default.getChildAt(s,s.over)&&!_t.default.getProperty(s,"subsupOK"))throw new S1.default("DoubleExponent","Double exponent: use braces to clarify");(!_t.default.isType(s,"msubsup")||_t.default.isType(s,"msup"))&&(o?((!_t.default.isType(s,"munderover")||_t.default.isType(s,"mover")||_t.default.getChildAt(s,s.over))&&(s=r.create("node","munderover",[s],{movesupsub:!0})),l=s.over):(s=r.create("node","msubsup",[s]),l=s.sup)),r.Push(r.itemFactory.create("subsup",s).setProperties({position:l,primes:n,movesupsub:o}))};Vt.Subscript=function(r,t){var e;r.GetNext().match(/\d/)&&(r.string=r.string.substr(0,r.i+1)+" "+r.string.substr(r.i+1));var n,s,a=r.stack.Top();a.isKind("prime")?(e=AT(a.Peek(2),2),s=e[0],n=e[1],r.stack.Pop()):(s=r.stack.Prev(),s||(s=r.create("token","mi",{},"")));var o=_t.default.getProperty(s,"movesupsub"),l=_t.default.isType(s,"msubsup")?s.sub:s.under;if(_t.default.isType(s,"msubsup")&&!_t.default.isType(s,"msup")&&_t.default.getChildAt(s,s.sub)||_t.default.isType(s,"munderover")&&!_t.default.isType(s,"mover")&&_t.default.getChildAt(s,s.under)&&!_t.default.getProperty(s,"subsupOK"))throw new S1.default("DoubleSubscripts","Double subscripts: use braces to clarify");(!_t.default.isType(s,"msubsup")||_t.default.isType(s,"msup"))&&(o?((!_t.default.isType(s,"munderover")||_t.default.isType(s,"mover")||_t.default.getChildAt(s,s.under))&&(s=r.create("node","munderover",[s],{movesupsub:!0})),l=s.under):(s=r.create("node","msubsup",[s]),l=s.sub)),r.Push(r.itemFactory.create("subsup",s).setProperties({position:l,primes:n,movesupsub:o}))};Vt.Prime=function(r,t){var e=r.stack.Prev();if(e||(e=r.create("node","mi")),_t.default.isType(e,"msubsup")&&!_t.default.isType(e,"msup")&&_t.default.getChildAt(e,e.sup))throw new S1.default("DoubleExponentPrime","Prime causes double exponent: use braces to clarify");var n="";r.i--;do n+=zc.entities.prime,r.i++,t=r.GetNext();while(t==="'"||t===zc.entities.rsquo);n=["","′","″","‴","⁗"][n.length]||n;var s=r.create("token","mo",{variantForm:!0},n);r.Push(r.itemFactory.create("prime",e,s))};Vt.Comment=function(r,t){for(;r.i<r.string.length&&r.string.charAt(r.i)!==`
123
- `;)r.i++};Vt.Hash=function(r,t){throw new S1.default("CantUseHash1","You can't use 'macro parameter character #' in math mode")};Vt.MathFont=function(r,t,e){var n=r.GetArgument(t),s=new A7.default(n,Cn(Cn({},r.stack.env),{font:e,multiLetterIdentifiers:/^[a-zA-Z]+/,noAutoOP:!0}),r.configuration).mml();r.Push(r.create("node","TeXAtom",[s]))};Vt.SetFont=function(r,t,e){r.stack.env.font=e};Vt.SetStyle=function(r,t,e,n,s){r.stack.env.style=e,r.stack.env.level=s,r.Push(r.itemFactory.create("style").setProperty("styles",{displaystyle:n,scriptlevel:s}))};Vt.SetSize=function(r,t,e){r.stack.env.size=e,r.Push(r.itemFactory.create("style").setProperty("styles",{mathsize:(0,Yx.em)(e)}))};Vt.Spacer=function(r,t,e){var n=r.create("node","mspace",[],{width:(0,Yx.em)(e)}),s=r.create("node","mstyle",[n],{scriptlevel:0});r.Push(s)};Vt.LeftRight=function(r,t){var e=t.substr(1);r.Push(r.itemFactory.create(e,r.GetDelimiter(t),r.stack.env.color))};Vt.NamedFn=function(r,t,e){e||(e=t.substr(1));var n=r.create("token","mi",{texClass:$n.TEXCLASS.OP},e);r.Push(r.itemFactory.create("fn",n))};Vt.NamedOp=function(r,t,e){e||(e=t.substr(1)),e=e.replace(/&thinsp;/," ");var n=r.create("token","mo",{movablelimits:!0,movesupsub:!0,form:MT.TexConstant.Form.PREFIX,texClass:$n.TEXCLASS.OP},e);r.Push(n)};Vt.Limits=function(r,t,e){var n=r.stack.Prev(!0);if(!n||_t.default.getTexClass(_t.default.getCoreMO(n))!==$n.TEXCLASS.OP&&_t.default.getProperty(n,"movesupsub")==null)throw new S1.default("MisplacedLimits","%1 is allowed only on operators",r.currentCS);var s=r.stack.Top(),a;_t.default.isType(n,"munderover")&&!e?(a=r.create("node","msubsup"),_t.default.copyChildren(n,a),n=s.Last=a):_t.default.isType(n,"msubsup")&&e&&(a=r.create("node","munderover"),_t.default.copyChildren(n,a),n=s.Last=a),_t.default.setProperty(n,"movesupsub",!!e),_t.default.setProperties(_t.default.getCoreMO(n),{movablelimits:!1}),(_t.default.getAttribute(n,"movablelimits")||_t.default.getProperty(n,"movablelimits"))&&_t.default.setProperties(n,{movablelimits:!1})};Vt.Over=function(r,t,e,n){var s=r.itemFactory.create("over").setProperty("name",r.currentCS);e||n?(s.setProperty("open",e),s.setProperty("close",n)):t.match(/withdelims$/)&&(s.setProperty("open",r.GetDelimiter(t)),s.setProperty("close",r.GetDelimiter(t))),t.match(/^\\above/)?s.setProperty("thickness",r.GetDimen(t)):(t.match(/^\\atop/)||e||n)&&s.setProperty("thickness",0),r.Push(s)};Vt.Frac=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.create("node","mfrac",[e,n]);r.Push(s)};Vt.Sqrt=function(r,t){var e=r.GetBrackets(t),n=r.GetArgument(t);n==="\\frac"&&(n+="{"+r.GetArgument(n)+"}{"+r.GetArgument(n)+"}");var s=new A7.default(n,r.stack.env,r.configuration).mml();e?s=r.create("node","mroot",[s,Jx(r,e)]):s=r.create("node","msqrt",[s]),r.Push(s)};function Jx(r,t){var e=r.stack.env,n=e.inRoot;e.inRoot=!0;var s=new A7.default(t,e,r.configuration),a=s.mml(),o=s.stack.global;if(o.leftRoot||o.upRoot){var l={};o.leftRoot&&(l.width=o.leftRoot),o.upRoot&&(l.voffset=o.upRoot,l.height=o.upRoot),a=r.create("node","mpadded",[a],l)}return e.inRoot=n,a}Vt.Root=function(r,t){var e=r.GetUpTo(t,"\\of"),n=r.ParseArg(t),s=r.create("node","mroot",[n,Jx(r,e)]);r.Push(s)};Vt.MoveRoot=function(r,t,e){if(!r.stack.env.inRoot)throw new S1.default("MisplacedMoveRoot","%1 can appear only within a root",r.currentCS);if(r.stack.global[e])throw new S1.default("MultipleMoveRoot","Multiple use of %1",r.currentCS);var n=r.GetArgument(t);if(!n.match(/-?[0-9]+/))throw new S1.default("IntegerArg","The argument to %1 must be an integer",r.currentCS);n=parseInt(n,10)/15+"em",n.substr(0,1)!=="-"&&(n="+"+n),r.stack.global[e]=n};Vt.Accent=function(r,t,e,n){var s=r.ParseArg(t),a=Cn(Cn({},c1.default.getFontDef(r)),{accent:!0,mathaccent:!0}),o=_t.default.createEntity(e),l=r.create("token","mo",a,o),u=l;_t.default.setAttribute(u,"stretchy",!!n);var h=_t.default.isEmbellished(s)?_t.default.getCoreMO(s):s;(_t.default.isType(h,"mo")||_t.default.getProperty(h,"movablelimits"))&&_t.default.setProperties(h,{movablelimits:!1});var T=r.create("node","munderover");_t.default.setChild(T,0,s),_t.default.setChild(T,1,null),_t.default.setChild(T,2,u);var f=r.create("node","TeXAtom",[T]);r.Push(f)};Vt.UnderOver=function(r,t,e,n){var s=_t.default.createEntity(e),a=r.create("token","mo",{stretchy:!0,accent:!0},s),o=t.charAt(1)==="o"?"over":"under",l=r.ParseArg(t);r.Push(c1.default.underOver(r,l,a,o,n))};Vt.Overset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t);c1.default.checkMovableLimits(n),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1);var s=r.create("node","mover",[n,e]);r.Push(s)};Vt.Underset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t);c1.default.checkMovableLimits(n),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1);var s=r.create("node","munder",[n,e],{accentunder:!1});r.Push(s)};Vt.Overunderset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.ParseArg(t);c1.default.checkMovableLimits(s),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1),n.isKind("mo")&&_t.default.setAttribute(n,"accent",!1);var a=r.create("node","munderover",[s,n,e],{accent:!1,accentunder:!1});r.Push(a)};Vt.TeXAtom=function(r,t,e){var n={texClass:e},s,a,o;if(e===$n.TEXCLASS.OP){n.movesupsub=n.movablelimits=!0;var l=r.GetArgument(t),u=l.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);u?(n.mathvariant=MT.TexConstant.Variant.NORMAL,a=r.create("token","mi",n,u[1])):(o=new A7.default(l,r.stack.env,r.configuration).mml(),a=r.create("node","TeXAtom",[o],n)),s=r.itemFactory.create("fn",a)}else o=r.ParseArg(t),s=r.create("node","TeXAtom",[o],n);r.Push(s)};Vt.MmlToken=function(r,t){var e=r.GetArgument(t),n=r.GetBrackets(t,"").replace(/^\s+/,""),s=r.GetArgument(t),a={},o=[],l;try{l=r.create("node",e)}catch{l=null}if(!l||!l.isToken)throw new S1.default("NotMathMLToken","%1 is not a token element",e);for(;n!=="";){var u=n.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i);if(!u)throw new S1.default("InvalidMathMLAttr","Invalid MathML attribute: %1",n);if(!l.attributes.hasDefault(u[1])&&!HP[u[1]])throw new S1.default("UnknownAttrForElement","%1 is not a recognized attribute for %2",u[1],e);var h=c1.default.MmlFilterAttribute(r,u[1],u[2].replace(/^(['"])(.*)\1$/,"$2"));h&&(h.toLowerCase()==="true"?h=!0:h.toLowerCase()==="false"&&(h=!1),a[u[1]]=h,o.push(u[1])),n=n.substr(u[0].length)}o.length&&(a["mjx-keep-attrs"]=o.join(" "));var T=r.create("text",s);l.appendChild(T),_t.default.setProperties(l,a),r.Push(l)};Vt.Strut=function(r,t){var e=r.create("node","mrow"),n=r.create("node","mpadded",[e],{height:"8.6pt",depth:"3pt",width:0});r.Push(n)};Vt.Phantom=function(r,t,e,n){var s=r.create("node","mphantom",[r.ParseArg(t)]);(e||n)&&(s=r.create("node","mpadded",[s]),n&&(_t.default.setAttribute(s,"height",0),_t.default.setAttribute(s,"depth",0)),e&&_t.default.setAttribute(s,"width",0));var a=r.create("node","TeXAtom",[s]);r.Push(a)};Vt.Smash=function(r,t){var e=c1.default.trimSpaces(r.GetBrackets(t,"")),n=r.create("node","mpadded",[r.ParseArg(t)]);switch(e){case"b":_t.default.setAttribute(n,"depth",0);break;case"t":_t.default.setAttribute(n,"height",0);break;default:_t.default.setAttribute(n,"height",0),_t.default.setAttribute(n,"depth",0)}var s=r.create("node","TeXAtom",[n]);r.Push(s)};Vt.Lap=function(r,t){var e=r.create("node","mpadded",[r.ParseArg(t)],{width:0});t==="\\llap"&&_t.default.setAttribute(e,"lspace","-1width");var n=r.create("node","TeXAtom",[e]);r.Push(n)};Vt.RaiseLower=function(r,t){var e=r.GetDimen(t),n=r.itemFactory.create("position").setProperties({name:r.currentCS,move:"vertical"});e.charAt(0)==="-"&&(e=e.slice(1),t=t.substr(1)==="raise"?"\\lower":"\\raise"),t==="\\lower"?(n.setProperty("dh","-"+e),n.setProperty("dd","+"+e)):(n.setProperty("dh","+"+e),n.setProperty("dd","-"+e)),r.Push(n)};Vt.MoveLeftRight=function(r,t){var e=r.GetDimen(t),n=e.charAt(0)==="-"?e.slice(1):"-"+e;if(t==="\\moveleft"){var s=e;e=n,n=s}r.Push(r.itemFactory.create("position").setProperties({name:r.currentCS,move:"horizontal",left:r.create("node","mspace",[],{width:e}),right:r.create("node","mspace",[],{width:n})}))};Vt.Hskip=function(r,t){var e=r.create("node","mspace",[],{width:r.GetDimen(t)});r.Push(e)};Vt.Nonscript=function(r,t){r.Push(r.itemFactory.create("nonscript"))};Vt.Rule=function(r,t,e){var n=r.GetDimen(t),s=r.GetDimen(t),a=r.GetDimen(t),o={width:n,height:s,depth:a};e!=="blank"&&(o.mathbackground=r.stack.env.color||"black");var l=r.create("node","mspace",[],o);r.Push(l)};Vt.rule=function(r,t){var e=r.GetBrackets(t),n=r.GetDimen(t),s=r.GetDimen(t),a=r.create("node","mspace",[],{width:n,height:s,mathbackground:r.stack.env.color||"black"});e&&(a=r.create("node","mpadded",[a],{voffset:e}),e.match(/^\-/)?(_t.default.setAttribute(a,"height",e),_t.default.setAttribute(a,"depth","+"+e.substr(1))):_t.default.setAttribute(a,"height","+"+e)),r.Push(a)};Vt.MakeBig=function(r,t,e,n){n*=AP;var s=String(n).replace(/(\.\d\d\d).+/,"$1")+"em",a=r.GetDelimiter(t,!0),o=r.create("token","mo",{minsize:s,maxsize:s,fence:!0,stretchy:!0,symmetric:!0},a),l=r.create("node","TeXAtom",[o],{texClass:e});r.Push(l)};Vt.BuildRel=function(r,t){var e=r.ParseUpTo(t,"\\over"),n=r.ParseArg(t),s=r.create("node","munderover");_t.default.setChild(s,0,n),_t.default.setChild(s,1,null),_t.default.setChild(s,2,e);var a=r.create("node","TeXAtom",[s],{texClass:$n.TEXCLASS.REL});r.Push(a)};Vt.HBox=function(r,t,e,n){r.PushAll(c1.default.internalMath(r,r.GetArgument(t),e,n))};Vt.FBox=function(r,t){var e=c1.default.internalMath(r,r.GetArgument(t)),n=r.create("node","menclose",e,{notation:"box"});r.Push(n)};Vt.FrameBox=function(r,t){var e=r.GetBrackets(t),n=r.GetBrackets(t)||"c",s=c1.default.internalMath(r,r.GetArgument(t));e&&(s=[r.create("node","mpadded",s,{width:e,"data-align":(0,EP.lookup)(n,{l:"left",r:"right"},"center")})]);var a=r.create("node","TeXAtom",[r.create("node","menclose",s,{notation:"box"})],{texClass:$n.TEXCLASS.ORD});r.Push(a)};Vt.Not=function(r,t){r.Push(r.itemFactory.create("not"))};Vt.Dots=function(r,t){var e=_t.default.createEntity("2026"),n=_t.default.createEntity("22EF"),s=r.create("token","mo",{stretchy:!1},e),a=r.create("token","mo",{stretchy:!1},n);r.Push(r.itemFactory.create("dots").setProperties({ldots:s,cdots:a}))};Vt.Matrix=function(r,t,e,n,s,a,o,l,u,h){var T=r.GetNext();if(T==="")throw new S1.default("MissingArgFor","Missing argument for %1",r.currentCS);T==="{"?r.i++:(r.string=T+"}"+r.string.slice(r.i+1),r.i=0);var f=r.itemFactory.create("array").setProperty("requireClose",!0);f.arraydef={rowspacing:o||"4pt",columnspacing:a||"1em"},u&&f.setProperty("isCases",!0),h&&(f.setProperty("isNumbered",!0),f.arraydef.side=h),(e||n)&&(f.setProperty("open",e),f.setProperty("close",n)),l==="D"&&(f.arraydef.displaystyle=!0),s!=null&&(f.arraydef.columnalign=s),r.Push(f)};Vt.Entry=function(r,t){r.Push(r.itemFactory.create("cell").setProperties({isEntry:!0,name:t}));var e=r.stack.Top(),n=e.getProperty("casesEnv"),s=e.getProperty("isCases");if(!(!s&&!n)){for(var a=r.string,o=0,l=-1,u=r.i,h=a.length,T=n?new RegExp("^\\\\end\\s*\\{".concat(n.replace(/\*/,"\\*"),"\\}")):null;u<h;){var f=a.charAt(u);if(f==="{")o++,u++;else if(f==="}")o===0?h=0:(o--,o===0&&l<0&&(l=u-r.i),u++);else{if(f==="&"&&o===0)throw new S1.default("ExtraAlignTab","Extra alignment tab in \\cases text");if(f==="\\"){var d=a.substr(u);d.match(/^((\\cr)[^a-zA-Z]|\\\\)/)||T&&d.match(T)?h=0:u+=2}else u++}}var p=a.substr(r.i,u-r.i);if(!p.match(/^\s*\\text[^a-zA-Z]/)||l!==p.replace(/\s+$/,"").length-1){var m=c1.default.internalMath(r,c1.default.trimSpaces(p),0);r.PushAll(m),r.i=u}}};Vt.Cr=function(r,t){r.Push(r.itemFactory.create("cell").setProperties({isCR:!0,name:t}))};Vt.CrLaTeX=function(r,t,e){e===void 0&&(e=!1);var n;if(!e&&(r.string.charAt(r.i)==="*"&&r.i++,r.string.charAt(r.i)==="[")){var s=r.GetBrackets(t,""),a=AT(c1.default.matchDimen(s),2),o=a[0],l=a[1];if(s&&!o)throw new S1.default("BracketMustBeDimension","Bracket argument to %1 must be a dimension",r.currentCS);n=o+l}r.Push(r.itemFactory.create("cell").setProperties({isCR:!0,name:t,linebreak:!0}));var u=r.stack.Top(),h;u instanceof HT.ArrayItem?n&&u.addRowSpacing(n):(n&&(h=r.create("node","mspace",[],{depth:n}),r.Push(h)),h=r.create("node","mspace",[],{linebreak:MT.TexConstant.LineBreak.NEWLINE}),r.Push(h))};Vt.HLine=function(r,t,e){e==null&&(e="solid");var n=r.stack.Top();if(!(n instanceof HT.ArrayItem)||n.Size())throw new S1.default("Misplaced","Misplaced %1",r.currentCS);if(!n.table.length)n.frame.push("top");else{for(var s=n.arraydef.rowlines?n.arraydef.rowlines.split(/ /):[];s.length<n.table.length;)s.push("none");s[n.table.length-1]=e,n.arraydef.rowlines=s.join(" ")}};Vt.HFill=function(r,t){var e=r.stack.Top();if(e instanceof HT.ArrayItem)e.hfill.push(e.Size());else throw new S1.default("UnsupportedHFill","Unsupported use of %1",r.currentCS)};Vt.BeginEnd=function(r,t){var e=r.GetArgument(t);if(e.match(/\\/i))throw new S1.default("InvalidEnv","Invalid environment name '%1'",e);var n=r.configuration.handlers.get("environment").lookup(e);if(n&&t==="\\end"){if(!n.args[0]){var s=r.itemFactory.create("end").setProperty("name",e);r.Push(s);return}r.stack.env.closing=e}c1.default.checkMaxMacros(r,!1),r.parse("environment",[r,e])};Vt.Array=function(r,t,e,n,s,a,o,l,u){s||(s=r.GetArgument("\\begin{"+t.getName()+"}"));var h=("c"+s).replace(/[^clr|:]/g,"").replace(/[^|:]([|:])+/g,"$1");s=s.replace(/[^clr]/g,"").split("").join(" "),s=s.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var T=r.itemFactory.create("array");return T.arraydef={columnalign:s,columnspacing:a||"1em",rowspacing:o||"4pt"},h.match(/[|:]/)&&(h.charAt(0).match(/[|:]/)&&(T.frame.push("left"),T.dashed=h.charAt(0)===":"),h.charAt(h.length-1).match(/[|:]/)&&T.frame.push("right"),h=h.substr(1,h.length-2),T.arraydef.columnlines=h.split("").join(" ").replace(/[^|: ]/g,"none").replace(/\|/g,"solid").replace(/:/g,"dashed")),e&&T.setProperty("open",r.convertDelimiter(e)),n&&T.setProperty("close",r.convertDelimiter(n)),(l||"").charAt(1)==="'"&&(T.arraydef["data-cramped"]=!0,l=l.charAt(0)),l==="D"?T.arraydef.displaystyle=!0:l&&(T.arraydef.displaystyle=!1),l==="S"&&(T.arraydef.scriptlevel=1),u&&(T.arraydef.useHeight=!1),r.Push(t),T};Vt.AlignedArray=function(r,t){var e=r.GetBrackets("\\begin{"+t.getName()+"}"),n=Vt.Array(r,t);return c1.default.setArrayAlign(n,e)};Vt.Equation=function(r,t,e){return r.Push(t),c1.default.checkEqnEnv(r),r.itemFactory.create("equation",e).setProperty("name",t.getName())};Vt.EqnArray=function(r,t,e,n,s,a){r.Push(t),n&&c1.default.checkEqnEnv(r),s=s.replace(/[^clr]/g,"").split("").join(" "),s=s.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var o=r.itemFactory.create("eqnarray",t.getName(),e,n,r.stack.global);return o.arraydef={displaystyle:!0,columnalign:s,columnspacing:a||"1em",rowspacing:"3pt",side:r.options.tagSide,minlabelspacing:r.options.tagIndent},o};Vt.HandleNoTag=function(r,t){r.tags.notag()};Vt.HandleLabel=function(r,t){var e=r.GetArgument(t);if(e!==""&&!r.tags.refUpdate){if(r.tags.label)throw new S1.default("MultipleCommand","Multiple %1",r.currentCS);if(r.tags.label=e,(r.tags.allLabels[e]||r.tags.labels[e])&&!r.options.ignoreDuplicateLabels)throw new S1.default("MultipleLabel","Label '%1' multiply defined",e);r.tags.labels[e]=new $x.Label}};Vt.HandleRef=function(r,t,e){var n=r.GetArgument(t),s=r.tags.allLabels[n]||r.tags.labels[n];s||(r.tags.refUpdate||(r.tags.redo=!0),s=new $x.Label);var a=s.tag;e&&(a=r.tags.formatTag(a));var o=r.create("node","mrow",c1.default.internalMath(r,a),{href:r.tags.formatUrl(s.id,r.options.baseURL),class:"MathJax_ref"});r.Push(o)};Vt.Macro=function(r,t,e,n,s){if(n){var a=[];if(s!=null){var o=r.GetBrackets(t);a.push(o??s)}for(var l=a.length;l<n;l++)a.push(r.GetArgument(t));e=c1.default.substituteArgs(r,a,e)}r.string=c1.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,c1.default.checkMaxMacros(r)};Vt.MathChoice=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.ParseArg(t),a=r.ParseArg(t);r.Push(r.create("node","MathChoice",[e,n,s,a]))};p2.default=Vt;var h3={},MP=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},wP=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},t_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(h3,"__esModule",{value:!0});var CP=t_(Ne),V9=q1,eg=t_(Ue()),Wc;(function(r){function t(h,T){var f=eg.default.getFontDef(h),d=h.stack.env;d.multiLetterIdentifiers&&d.font!==""&&(T=h.string.substr(h.i-1).match(d.multiLetterIdentifiers)[0],h.i+=T.length-1,f.mathvariant===V9.TexConstant.Variant.NORMAL&&d.noAutoOP&&T.length>1&&(f.autoOP=!1));var p=h.create("token","mi",f,T);h.Push(p)}r.variable=t;function e(h,T){var f,d=h.configuration.options.digits,p=h.string.slice(h.i-1).match(d),m=eg.default.getFontDef(h);p?(f=h.create("token","mn",m,p[0].replace(/[{}]/g,"")),h.i+=p[0].length-1):f=h.create("token","mo",m,T),h.Push(f)}r.digit=e;function n(h,T){var f=h.GetCS();h.parse("macro",[h,f])}r.controlSequence=n;function s(h,T){var f=T.attributes||{mathvariant:V9.TexConstant.Variant.ITALIC},d=h.create("token","mi",f,T.char);h.Push(d)}r.mathchar0mi=s;function a(h,T){var f=T.attributes||{};f.stretchy=!1;var d=h.create("token","mo",f,T.char);CP.default.setProperty(d,"fixStretchy",!0),h.configuration.addNode("fixStretchy",d),h.Push(d)}r.mathchar0mo=a;function o(h,T){var f=T.attributes||{mathvariant:V9.TexConstant.Variant.NORMAL};h.stack.env.font&&(f.mathvariant=h.stack.env.font);var d=h.create("token","mi",f,T.char);h.Push(d)}r.mathchar7=o;function l(h,T){var f=T.attributes||{};f=Object.assign({fence:!1,stretchy:!1},f);var d=h.create("token","mo",f,T.char);h.Push(d)}r.delimiter=l;function u(h,T,f,d){var p=d[0],m=h.itemFactory.create("begin").setProperties({name:T,end:p});m=f.apply(void 0,wP([h,m],MP(d.slice(1)),!1)),h.Push(m)}r.environment=u})(Wc||(Wc={}));h3.default=Wc;var DP=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),OP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),IP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&DP(t,r,e);return OP(t,r),t},wT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},T3=IP(Gt),gt=q1,CT=wT(p2),vr=wT(h3),VP=wT(Ue()),qt=jt,c2=G3;new T3.RegExpMap("letter",vr.default.variable,/[a-z]/i);new T3.RegExpMap("digit",vr.default.digit,/[0-9.,]/);new T3.RegExpMap("command",vr.default.controlSequence,/^\\/);new T3.MacroMap("special",{"{":"Open","}":"Close","~":"Tilde","^":"Superscript",_:"Subscript"," ":"Space"," ":"Space","\r":"Space","\n":"Space","'":"Prime","%":"Comment","&":"Entry","#":"Hash"," ":"Space","’":"Prime"},CT.default);new T3.CharacterMap("mathchar0mi",vr.default.mathchar0mi,{alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ϵ",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigma:"σ",tau:"τ",upsilon:"υ",phi:"ϕ",chi:"χ",psi:"ψ",omega:"ω",varepsilon:"ε",vartheta:"ϑ",varpi:"ϖ",varrho:"ϱ",varsigma:"ς",varphi:"φ",S:["§",{mathvariant:gt.TexConstant.Variant.NORMAL}],aleph:["ℵ",{mathvariant:gt.TexConstant.Variant.NORMAL}],hbar:["ℏ",{variantForm:!0}],imath:"ı",jmath:"ȷ",ell:"ℓ",wp:["℘",{mathvariant:gt.TexConstant.Variant.NORMAL}],Re:["ℜ",{mathvariant:gt.TexConstant.Variant.NORMAL}],Im:["ℑ",{mathvariant:gt.TexConstant.Variant.NORMAL}],partial:["∂",{mathvariant:gt.TexConstant.Variant.ITALIC}],infty:["∞",{mathvariant:gt.TexConstant.Variant.NORMAL}],prime:["′",{variantForm:!0}],emptyset:["∅",{mathvariant:gt.TexConstant.Variant.NORMAL}],nabla:["∇",{mathvariant:gt.TexConstant.Variant.NORMAL}],top:["⊤",{mathvariant:gt.TexConstant.Variant.NORMAL}],bot:["⊥",{mathvariant:gt.TexConstant.Variant.NORMAL}],angle:["∠",{mathvariant:gt.TexConstant.Variant.NORMAL}],triangle:["△",{mathvariant:gt.TexConstant.Variant.NORMAL}],backslash:["∖",{mathvariant:gt.TexConstant.Variant.NORMAL}],forall:["∀",{mathvariant:gt.TexConstant.Variant.NORMAL}],exists:["∃",{mathvariant:gt.TexConstant.Variant.NORMAL}],neg:["¬",{mathvariant:gt.TexConstant.Variant.NORMAL}],lnot:["¬",{mathvariant:gt.TexConstant.Variant.NORMAL}],flat:["♭",{mathvariant:gt.TexConstant.Variant.NORMAL}],natural:["♮",{mathvariant:gt.TexConstant.Variant.NORMAL}],sharp:["♯",{mathvariant:gt.TexConstant.Variant.NORMAL}],clubsuit:["♣",{mathvariant:gt.TexConstant.Variant.NORMAL}],diamondsuit:["♢",{mathvariant:gt.TexConstant.Variant.NORMAL}],heartsuit:["♡",{mathvariant:gt.TexConstant.Variant.NORMAL}],spadesuit:["♠",{mathvariant:gt.TexConstant.Variant.NORMAL}]});new T3.CharacterMap("mathchar0mo",vr.default.mathchar0mo,{surd:"√",coprod:["∐",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigvee:["⋁",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigwedge:["⋀",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],biguplus:["⨄",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigcap:["⋂",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigcup:["⋃",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],int:["∫",{texClass:qt.TEXCLASS.OP}],intop:["∫",{texClass:qt.TEXCLASS.OP,movesupsub:!0,movablelimits:!0}],iint:["∬",{texClass:qt.TEXCLASS.OP}],iiint:["∭",{texClass:qt.TEXCLASS.OP}],prod:["∏",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],sum:["∑",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigotimes:["⨂",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigoplus:["⨁",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigodot:["⨀",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],oint:["∮",{texClass:qt.TEXCLASS.OP}],bigsqcup:["⨆",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],smallint:["∫",{largeop:!1}],triangleleft:"◃",triangleright:"▹",bigtriangleup:"△",bigtriangledown:"▽",wedge:"∧",land:"∧",vee:"∨",lor:"∨",cap:"∩",cup:"∪",ddagger:"‡",dagger:"†",sqcap:"⊓",sqcup:"⊔",uplus:"⊎",amalg:"⨿",diamond:"⋄",bullet:"∙",wr:"≀",div:"÷",divsymbol:"÷",odot:["⊙",{largeop:!1}],oslash:["⊘",{largeop:!1}],otimes:["⊗",{largeop:!1}],ominus:["⊖",{largeop:!1}],oplus:["⊕",{largeop:!1}],mp:"∓",pm:"±",circ:"∘",bigcirc:"◯",setminus:"∖",cdot:"⋅",ast:"∗",times:"×",star:"⋆",propto:"∝",sqsubseteq:"⊑",sqsupseteq:"⊒",parallel:"∥",mid:"∣",dashv:"⊣",vdash:"⊢",leq:"≤",le:"≤",geq:"≥",ge:"≥",lt:"<",gt:">",succ:"≻",prec:"≺",approx:"≈",succeq:"⪰",preceq:"⪯",supset:"⊃",subset:"⊂",supseteq:"⊇",subseteq:"⊆",in:"∈",ni:"∋",notin:"∉",owns:"∋",gg:"≫",ll:"≪",sim:"∼",simeq:"≃",perp:"⊥",equiv:"≡",asymp:"≍",smile:"⌣",frown:"⌢",ne:"≠",neq:"≠",cong:"≅",doteq:"≐",bowtie:"⋈",models:"⊨",notChar:"⧸",Leftrightarrow:"⇔",Leftarrow:"⇐",Rightarrow:"⇒",leftrightarrow:"↔",leftarrow:"←",gets:"←",rightarrow:"→",to:["→",{accent:!1}],mapsto:"↦",leftharpoonup:"↼",leftharpoondown:"↽",rightharpoonup:"⇀",rightharpoondown:"⇁",nearrow:"↗",searrow:"↘",nwarrow:"↖",swarrow:"↙",rightleftharpoons:"⇌",hookrightarrow:"↪",hookleftarrow:"↩",longleftarrow:"⟵",Longleftarrow:"⟸",longrightarrow:"⟶",Longrightarrow:"⟹",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",ldots:"…",cdots:"⋯",vdots:"⋮",ddots:"⋱",dotsc:"…",dotsb:"⋯",dotsm:"⋯",dotsi:"⋯",dotso:"…",ldotp:[".",{texClass:qt.TEXCLASS.PUNCT}],cdotp:["⋅",{texClass:qt.TEXCLASS.PUNCT}],colon:[":",{texClass:qt.TEXCLASS.PUNCT}]});new T3.CharacterMap("mathchar7",vr.default.mathchar7,{Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Upsilon:"Υ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"});new T3.DelimiterMap("delimiter",vr.default.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"⟨",">":"⟩","\\lt":"⟨","\\gt":"⟩","/":"/","|":["|",{texClass:qt.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"⎰","\\rmoustache":"⎱","\\lgroup":"⟮","\\rgroup":"⟯","\\arrowvert":"⏐","\\Arrowvert":"‖","\\bracevert":"⎪","\\Vert":["‖",{texClass:qt.TEXCLASS.ORD}],"\\|":["‖",{texClass:qt.TEXCLASS.ORD}],"\\vert":["|",{texClass:qt.TEXCLASS.ORD}],"\\uparrow":"↑","\\downarrow":"↓","\\updownarrow":"↕","\\Uparrow":"⇑","\\Downarrow":"⇓","\\Updownarrow":"⇕","\\backslash":"\\","\\rangle":"⟩","\\langle":"⟨","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"⌉","\\lceil":"⌈","\\rfloor":"⌋","\\lfloor":"⌊","\\lbrack":"[","\\rbrack":"]"});new T3.CommandMap("macros",{displaystyle:["SetStyle","D",!0,0],textstyle:["SetStyle","T",!1,0],scriptstyle:["SetStyle","S",!1,1],scriptscriptstyle:["SetStyle","SS",!1,2],rm:["SetFont",gt.TexConstant.Variant.NORMAL],mit:["SetFont",gt.TexConstant.Variant.ITALIC],oldstyle:["SetFont",gt.TexConstant.Variant.OLDSTYLE],cal:["SetFont",gt.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont",gt.TexConstant.Variant.MATHITALIC],bf:["SetFont",gt.TexConstant.Variant.BOLD],bbFont:["SetFont",gt.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",gt.TexConstant.Variant.SCRIPT],frak:["SetFont",gt.TexConstant.Variant.FRAKTUR],sf:["SetFont",gt.TexConstant.Variant.SANSSERIF],tt:["SetFont",gt.TexConstant.Variant.MONOSPACE],mathrm:["MathFont",gt.TexConstant.Variant.NORMAL],mathup:["MathFont",gt.TexConstant.Variant.NORMAL],mathnormal:["MathFont",""],mathbf:["MathFont",gt.TexConstant.Variant.BOLD],mathbfup:["MathFont",gt.TexConstant.Variant.BOLD],mathit:["MathFont",gt.TexConstant.Variant.MATHITALIC],mathbfit:["MathFont",gt.TexConstant.Variant.BOLDITALIC],mathbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],Bbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],mathfrak:["MathFont",gt.TexConstant.Variant.FRAKTUR],mathbffrak:["MathFont",gt.TexConstant.Variant.BOLDFRAKTUR],mathscr:["MathFont",gt.TexConstant.Variant.SCRIPT],mathbfscr:["MathFont",gt.TexConstant.Variant.BOLDSCRIPT],mathsf:["MathFont",gt.TexConstant.Variant.SANSSERIF],mathsfup:["MathFont",gt.TexConstant.Variant.SANSSERIF],mathbfsf:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],mathbfsfup:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],mathsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFITALIC],mathbfsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFBOLDITALIC],mathtt:["MathFont",gt.TexConstant.Variant.MONOSPACE],mathcal:["MathFont",gt.TexConstant.Variant.CALLIGRAPHIC],mathbfcal:["MathFont",gt.TexConstant.Variant.BOLDCALLIGRAPHIC],symrm:["MathFont",gt.TexConstant.Variant.NORMAL],symup:["MathFont",gt.TexConstant.Variant.NORMAL],symnormal:["MathFont",""],symbf:["MathFont",gt.TexConstant.Variant.BOLD],symbfup:["MathFont",gt.TexConstant.Variant.BOLD],symit:["MathFont",gt.TexConstant.Variant.ITALIC],symbfit:["MathFont",gt.TexConstant.Variant.BOLDITALIC],symbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],symfrak:["MathFont",gt.TexConstant.Variant.FRAKTUR],symbffrak:["MathFont",gt.TexConstant.Variant.BOLDFRAKTUR],symscr:["MathFont",gt.TexConstant.Variant.SCRIPT],symbfscr:["MathFont",gt.TexConstant.Variant.BOLDSCRIPT],symsf:["MathFont",gt.TexConstant.Variant.SANSSERIF],symsfup:["MathFont",gt.TexConstant.Variant.SANSSERIF],symbfsf:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],symbfsfup:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],symsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFITALIC],symbfsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFBOLDITALIC],symtt:["MathFont",gt.TexConstant.Variant.MONOSPACE],symcal:["MathFont",gt.TexConstant.Variant.CALLIGRAPHIC],symbfcal:["MathFont",gt.TexConstant.Variant.BOLDCALLIGRAPHIC],textrm:["HBox",null,gt.TexConstant.Variant.NORMAL],textup:["HBox",null,gt.TexConstant.Variant.NORMAL],textnormal:["HBox"],textit:["HBox",null,gt.TexConstant.Variant.ITALIC],textbf:["HBox",null,gt.TexConstant.Variant.BOLD],textsf:["HBox",null,gt.TexConstant.Variant.SANSSERIF],texttt:["HBox",null,gt.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:"NamedFn",arccos:"NamedFn",arctan:"NamedFn",arg:"NamedFn",cos:"NamedFn",cosh:"NamedFn",cot:"NamedFn",coth:"NamedFn",csc:"NamedFn",deg:"NamedFn",det:"NamedOp",dim:"NamedFn",exp:"NamedFn",gcd:"NamedOp",hom:"NamedFn",inf:"NamedOp",ker:"NamedFn",lg:"NamedFn",lim:"NamedOp",liminf:["NamedOp","lim&thinsp;inf"],limsup:["NamedOp","lim&thinsp;sup"],ln:"NamedFn",log:"NamedFn",max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:"NamedFn",sin:"NamedFn",sinh:"NamedFn",sup:"NamedOp",tan:"NamedFn",tanh:"NamedFn",limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","2015"],underline:["UnderOver","2015"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overparen:["UnderOver","23DC"],underparen:["UnderOver","23DD"],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",overunderset:"Overunderset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:["Macro","\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"LeftRight",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",c2.MATHSPACE.thinmathspace],":":["Spacer",c2.MATHSPACE.mediummathspace],">":["Spacer",c2.MATHSPACE.mediummathspace],";":["Spacer",c2.MATHSPACE.thickmathspace],"!":["Spacer",c2.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",c2.MATHSPACE.thinmathspace],negthinspace:["Spacer",c2.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],nonscript:"Nonscript",big:["MakeBig",qt.TEXCLASS.ORD,.85],Big:["MakeBig",qt.TEXCLASS.ORD,1.15],bigg:["MakeBig",qt.TEXCLASS.ORD,1.45],Bigg:["MakeBig",qt.TEXCLASS.ORD,1.75],bigl:["MakeBig",qt.TEXCLASS.OPEN,.85],Bigl:["MakeBig",qt.TEXCLASS.OPEN,1.15],biggl:["MakeBig",qt.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",qt.TEXCLASS.OPEN,1.75],bigr:["MakeBig",qt.TEXCLASS.CLOSE,.85],Bigr:["MakeBig",qt.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",qt.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",qt.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",qt.TEXCLASS.REL,.85],Bigm:["MakeBig",qt.TEXCLASS.REL,1.15],biggm:["MakeBig",qt.TEXCLASS.REL,1.45],Biggm:["MakeBig",qt.TEXCLASS.REL,1.75],mathord:["TeXAtom",qt.TEXCLASS.ORD],mathop:["TeXAtom",qt.TEXCLASS.OP],mathopen:["TeXAtom",qt.TEXCLASS.OPEN],mathclose:["TeXAtom",qt.TEXCLASS.CLOSE],mathbin:["TeXAtom",qt.TEXCLASS.BIN],mathrel:["TeXAtom",qt.TEXCLASS.REL],mathpunct:["TeXAtom",qt.TEXCLASS.PUNCT],mathinner:["TeXAtom",qt.TEXCLASS.INNER],vcenter:["TeXAtom",qt.TEXCLASS.VCENTER],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],framebox:"FrameBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,!0],eqalign:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:["CrLaTeX",!0],hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D",null,"right"],leqalignno:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D",null,"left"],hfill:"HFill",hfil:"HFill",hfilll:"HFill",bmod:["Macro",'\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde"," ":"Tilde",begin:"BeginEnd",end:"BeginEnd",label:"HandleLabel",ref:"HandleRef",nonumber:"HandleNoTag",mathchoice:"MathChoice",mmlToken:"MmlToken"},CT.default);new T3.EnvironmentMap("environment",vr.default.environment,{array:["AlignedArray"],equation:["Equation",null,!0],eqnarray:["EqnArray",null,!0,!0,"rcl",VP.default.cols(0,c2.MATHSPACE.thickmathspace),".5em"]},CT.default);new T3.CharacterMap("not_remap",null,{"←":"↚","→":"↛","↔":"↮","⇐":"⇍","⇒":"⇏","⇔":"⇎","∈":"∉","∋":"∌","∣":"∤","∥":"∦","∼":"≁","~":"≁","≃":"≄","≅":"≇","≈":"≉","≍":"≭","=":"≠","≡":"≢","<":"≮",">":"≯","≤":"≰","≥":"≱","≲":"≴","≳":"≵","≶":"≸","≷":"≹","≺":"⊀","≻":"⊁","⊂":"⊄","⊃":"⊅","⊆":"⊈","⊇":"⊉","⊢":"⊬","⊨":"⊭","⊩":"⊮","⊫":"⊯","≼":"⋠","≽":"⋡","⊑":"⋢","⊒":"⋣","⊲":"⋪","⊳":"⋫","⊴":"⋬","⊵":"⋭","∃":"∄"});var PP=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kP=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),RP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),BP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&kP(t,r,e);return RP(t,r),t},FP=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},e_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},We;Object.defineProperty(sr,"__esModule",{value:!0});sr.BaseConfiguration=sr.BaseTags=sr.Other=void 0;var NP=he,UP=S0,i_=e_(Le),jP=e_(Ne),GP=Gt,Jt=BP(Nt),zP=Hi,WP=dT;new GP.CharacterMap("remap",null,{"-":"−","*":"∗","`":"‘"});function r_(r,t){var e=r.stack.env.font,n=e?{mathvariant:r.stack.env.font}:{},s=UP.MapHandler.getMap("remap").lookup(t),a=(0,WP.getRange)(t),o=a?a[3]:"mo",l=r.create("token",o,n,s?s.char:t);a[4]&&l.attributes.set("mathvariant",a[4]),o==="mo"&&(jP.default.setProperty(l,"fixStretchy",!0),r.configuration.addNode("fixStretchy",l)),r.Push(l)}sr.Other=r_;function qP(r,t){throw new i_.default("UndefinedControlSequence","Undefined control sequence %1","\\"+t)}function ZP(r,t){throw new i_.default("UnknownEnv","Unknown environment '%1'",t)}function KP(r){var t,e,n=r.data;try{for(var s=FP(n.getList("nonscript")),a=s.next();!a.done;a=s.next()){var o=a.value;if(o.attributes.get("scriptlevel")>0){var l=o.parent;if(l.childNodes.splice(l.childIndex(o),1),n.removeFromList(o.kind,[o]),o.isKind("mrow")){var u=o.childNodes[0];n.removeFromList("mstyle",[u]),n.removeFromList("mspace",u.childNodes[0].childNodes)}}else o.isKind("mrow")&&(o.parent.replaceChild(o.childNodes[0],o),n.removeFromList("mrow",[o]))}}catch(h){t={error:h}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}var n_=function(r){PP(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(zP.AbstractTags);sr.BaseTags=n_;sr.BaseConfiguration=NP.Configuration.create("base",{handler:{character:["command","special","letter","digit"],delimiter:["delimiter"],macro:["delimiter","macros","mathchar0mi","mathchar0mo","mathchar7"],environment:["environment"]},fallback:{character:r_,macro:qP,environment:ZP},items:(We={},We[Jt.StartItem.prototype.kind]=Jt.StartItem,We[Jt.StopItem.prototype.kind]=Jt.StopItem,We[Jt.OpenItem.prototype.kind]=Jt.OpenItem,We[Jt.CloseItem.prototype.kind]=Jt.CloseItem,We[Jt.PrimeItem.prototype.kind]=Jt.PrimeItem,We[Jt.SubsupItem.prototype.kind]=Jt.SubsupItem,We[Jt.OverItem.prototype.kind]=Jt.OverItem,We[Jt.LeftItem.prototype.kind]=Jt.LeftItem,We[Jt.Middle.prototype.kind]=Jt.Middle,We[Jt.RightItem.prototype.kind]=Jt.RightItem,We[Jt.BeginItem.prototype.kind]=Jt.BeginItem,We[Jt.EndItem.prototype.kind]=Jt.EndItem,We[Jt.StyleItem.prototype.kind]=Jt.StyleItem,We[Jt.PositionItem.prototype.kind]=Jt.PositionItem,We[Jt.CellItem.prototype.kind]=Jt.CellItem,We[Jt.MmlItem.prototype.kind]=Jt.MmlItem,We[Jt.FnItem.prototype.kind]=Jt.FnItem,We[Jt.NotItem.prototype.kind]=Jt.NotItem,We[Jt.NonscriptItem.prototype.kind]=Jt.NonscriptItem,We[Jt.DotsItem.prototype.kind]=Jt.DotsItem,We[Jt.ArrayItem.prototype.kind]=Jt.ArrayItem,We[Jt.EqnArrayItem.prototype.kind]=Jt.EqnArrayItem,We[Jt.EquationItem.prototype.kind]=Jt.EquationItem,We),options:{maxMacros:1e3,baseURL:typeof document>"u"||document.getElementsByTagName("base").length===0?"":String(document.location).replace(/#.*$/,"")},tags:{base:n_},postprocessors:[[KP,-4]]});var XP=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),fo=_&&_.__assign||function(){return fo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},fo.apply(this,arguments)},$P=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},A0=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(vT,"__esModule",{value:!0});var s_=vT.TeX=void 0,ig=r0,rg=H1,ng=x7,D4=A0(LT),sg=A0(Ne),YP=A0(t2()),JP=A0(Le),tk=A0(S7),Vs=Hi,ek=he,ik=function(r){XP(t,r);function t(e){e===void 0&&(e={});var n=this,s=$P((0,rg.separateOptions)(e,t.OPTIONS,ng.FindTeX.OPTIONS),3),a=s[0],o=s[1],l=s[2];n=r.call(this,o)||this,n.findTeX=n.options.FindTeX||new ng.FindTeX(l);var u=n.options.packages,h=n.configuration=t.configure(u),T=n._parseOptions=new tk.default(h,[n.options,Vs.TagsFactory.OPTIONS]);return(0,rg.userOptions)(T.options,a),h.config(n),t.tags(T,h),n.postFilters.add(D4.default.cleanSubSup,-6),n.postFilters.add(D4.default.setInherited,-5),n.postFilters.add(D4.default.moveLimits,-4),n.postFilters.add(D4.default.cleanStretchy,-3),n.postFilters.add(D4.default.cleanAttributes,-2),n.postFilters.add(D4.default.combineRelations,-1),n}return t.configure=function(e){var n=new ek.ParserConfiguration(e,["tex"]);return n.init(),n},t.tags=function(e,n){Vs.TagsFactory.addTags(n.tags),Vs.TagsFactory.setDefault(e.options.tags),e.tags=Vs.TagsFactory.getDefault(),e.tags.configuration=e},t.prototype.setMmlFactory=function(e){r.prototype.setMmlFactory.call(this,e),this._parseOptions.nodeFactory.setMmlFactory(e)},Object.defineProperty(t.prototype,"parseOptions",{get:function(){return this._parseOptions},enumerable:!1,configurable:!0}),t.prototype.reset=function(e){e===void 0&&(e=0),this.parseOptions.tags.reset(e)},t.prototype.compile=function(e,n){this.parseOptions.clear(),this.executeFilters(this.preFilters,e,n,this.parseOptions);var s=e.display;this.latex=e.math;var a;this.parseOptions.tags.startEquation(e);var o;try{var l=new YP.default(this.latex,{display:s,isInner:!1},this.parseOptions);a=l.mml(),o=l.stack.global}catch(u){if(!(u instanceof JP.default))throw u;this.parseOptions.error=!0,a=this.options.formatError(this,u)}return a=this.parseOptions.nodeFactory.create("node","math",[a]),o!=null&&o.indentalign&&sg.default.setAttribute(a,"indentalign",o.indentalign),s&&sg.default.setAttribute(a,"display","block"),this.parseOptions.tags.finishEquation(e),this.parseOptions.root=a,this.executeFilters(this.postFilters,e,n,this.parseOptions),this.mathNode=this.parseOptions.root,this.mathNode},t.prototype.findMath=function(e){return this.findTeX.findMath(e)},t.prototype.formatError=function(e){var n=e.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",n,e.id,this.latex)},t.NAME="TeX",t.OPTIONS=fo(fo({},ig.AbstractInputJax.OPTIONS),{FindTeX:null,packages:["base"],digits:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,maxBuffer:5*1024,formatError:function(e,n){return e.formatError(n)}}),t}(ig.AbstractInputJax);s_=vT.TeX=ik;var DT={},rk={};(function(r){var t=_&&_.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.ActionConfiguration=r.ActionMethods=void 0;var e=he,n=t(t2()),s=Gt,a=t(p2);r.ActionMethods={},r.ActionMethods.Macro=a.default.Macro,r.ActionMethods.Toggle=function(o,l){for(var u=[],h;(h=o.GetArgument(l))!=="\\endtoggle";)u.push(new n.default(h,o.stack.env,o.configuration).mml());o.Push(o.create("node","maction",u,{actiontype:"toggle"}))},r.ActionMethods.Mathtip=function(o,l){var u=o.ParseArg(l),h=o.ParseArg(l);o.Push(o.create("node","maction",[u,h],{actiontype:"tooltip"}))},new s.CommandMap("action-macros",{toggle:"Toggle",mathtip:"Mathtip",texttip:["Macro","\\mathtip{#1}{\\text{#2}}",2]},r.ActionMethods),r.ActionConfiguration=e.Configuration.create("action",{handler:{macro:["action-macros"]}})})(rk);var Dn={},o4={},a_=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),qc=_&&_.__assign||function(){return qc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},qc.apply(this,arguments)},OT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(o4,"__esModule",{value:!0});o4.FlalignItem=o4.MultlineItem=void 0;var o_=Nt,nk=OT(Ue()),P2=OT(Ne),l_=OT(Le),P9=q1,sk=function(r){a_(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.factory.configuration.tags.start("multline",!0,n[0]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"multline"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){this.table.length&&nk.default.fixInitialMO(this.factory.configuration,this.nodes);var e=this.getProperty("shove"),n=this.create("node","mtd",this.nodes,e?{columnalign:e}:{});this.setProperty("shove",null),this.row.push(n),this.Clear()},t.prototype.EndRow=function(){if(this.row.length!==1)throw new l_.default("MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline");var e=this.create("node","mtr",this.row);this.table.push(e),this.row=[]},t.prototype.EndTable=function(){if(r.prototype.EndTable.call(this),this.table.length){var e=this.table.length-1,n=-1;P2.default.getAttribute(P2.default.getChildren(this.table[0])[0],"columnalign")||P2.default.setAttribute(P2.default.getChildren(this.table[0])[0],"columnalign",P9.TexConstant.Align.LEFT),P2.default.getAttribute(P2.default.getChildren(this.table[e])[0],"columnalign")||P2.default.setAttribute(P2.default.getChildren(this.table[e])[0],"columnalign",P9.TexConstant.Align.RIGHT);var s=this.factory.configuration.tags.getTag();if(s){n=this.arraydef.side===P9.TexConstant.Align.LEFT?0:this.table.length-1;var a=this.table[n],o=this.create("node","mlabeledtr",[s].concat(P2.default.getChildren(a)));P2.default.copyAttributes(a,o),this.table[n]=o}}this.factory.configuration.tags.end()},t}(o_.ArrayItem);o4.MultlineItem=sk;var ak=function(r){a_(t,r);function t(e,n,s,a,o){var l=r.call(this,e)||this;return l.name=n,l.numbered=s,l.padded=a,l.center=o,l.factory.configuration.tags.start(n,s,s),l}return Object.defineProperty(t.prototype,"kind",{get:function(){return"flalign"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){r.prototype.EndEntry.call(this);var e=this.getProperty("xalignat");if(e&&this.row.length>e)throw new l_.default("XalignOverflow","Extra %1 in row of %2","&",this.name)},t.prototype.EndRow=function(){for(var e,n=this.row,s=this.getProperty("xalignat");n.length<s;)n.push(this.create("node","mtd"));for(this.row=[],this.padded&&this.row.push(this.create("node","mtd"));e=n.shift();)this.row.push(e),e=n.shift(),e&&this.row.push(e),(n.length||this.padded)&&this.row.push(this.create("node","mtd"));this.row.length>this.maxrow&&(this.maxrow=this.row.length),r.prototype.EndRow.call(this);var a=this.table[this.table.length-1];if(this.getProperty("zeroWidthLabel")&&a.isKind("mlabeledtr")){var o=P2.default.getChildren(a)[0],l=this.factory.configuration.options.tagSide,u=qc({width:0},l==="right"?{lspace:"-1width"}:{}),h=this.create("node","mpadded",P2.default.getChildren(o),u);o.setChildren([h])}},t.prototype.EndTable=function(){if(r.prototype.EndTable.call(this),this.center&&this.maxrow<=2){var e=this.arraydef;delete e.width,delete this.global.indentalign}},t}(o_.EqnArrayItem);o4.FlalignItem=ak;var Yn={};(function(r){var t=_&&_.__assign||function(){return t=Object.assign||function(y){for(var c,Q=1,g=arguments.length;Q<g;Q++){c=arguments[Q];for(var v in c)Object.prototype.hasOwnProperty.call(c,v)&&(y[v]=c[v])}return y},t.apply(this,arguments)},e=_&&_.__read||function(y,c){var Q=typeof Symbol=="function"&&y[Symbol.iterator];if(!Q)return y;var g=Q.call(y),v,L=[],x;try{for(;(c===void 0||c-- >0)&&!(v=g.next()).done;)L.push(v.value)}catch(b){x={error:b}}finally{try{v&&!v.done&&(Q=g.return)&&Q.call(g)}finally{if(x)throw x.error}}return L},n=_&&_.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(r,"__esModule",{value:!0}),r.NEW_OPS=r.AmsMethods=void 0;var s=n(Ue()),a=n(h3),o=n(Ne),l=q1,u=n(t2()),h=n(Le),T=s3,f=n(p2),d=jt;r.AmsMethods={},r.AmsMethods.AmsEqnArray=function(y,c,Q,g,v,L,x){var b=y.GetBrackets("\\begin{"+c.getName()+"}"),S=f.default.EqnArray(y,c,Q,g,v,L,x);return s.default.setArrayAlign(S,b)},r.AmsMethods.AlignAt=function(y,c,Q,g){var v=c.getName(),L,x,b="",S=[];if(g||(x=y.GetBrackets("\\begin{"+v+"}")),L=y.GetArgument("\\begin{"+v+"}"),L.match(/[^0-9]/))throw new h.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+v+"}");for(var E=parseInt(L,10);E>0;)b+="rl",S.push("0em 0em"),E--;var A=S.join(" ");if(g)return r.AmsMethods.EqnArray(y,c,Q,g,b,A);var M=r.AmsMethods.EqnArray(y,c,Q,g,b,A);return s.default.setArrayAlign(M,x)},r.AmsMethods.Multline=function(y,c,Q){y.Push(c),s.default.checkEqnEnv(y);var g=y.itemFactory.create("multline",Q,y.stack);return g.arraydef={displaystyle:!0,rowspacing:".5em",columnspacing:"100%",width:y.options.ams.multlineWidth,side:y.options.tagSide,minlabelspacing:y.options.tagIndent,framespacing:y.options.ams.multlineIndent+" 0",frame:"","data-width-includes-label":!0},g},r.AmsMethods.XalignAt=function(y,c,Q,g){var v=y.GetArgument("\\begin{"+c.getName()+"}");if(v.match(/[^0-9]/))throw new h.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+c.getName()+"}");var L=g?"crl":"rlc",x=g?"fit auto auto":"auto auto fit",b=r.AmsMethods.FlalignArray(y,c,Q,g,!1,L,x,!0);return b.setProperty("xalignat",2*parseInt(v)),b},r.AmsMethods.FlalignArray=function(y,c,Q,g,v,L,x,b){b===void 0&&(b=!1),y.Push(c),s.default.checkEqnEnv(y),L=L.split("").join(" ").replace(/r/g,"right").replace(/l/g,"left").replace(/c/g,"center");var S=y.itemFactory.create("flalign",c.getName(),Q,g,v,y.stack);return S.arraydef={width:"100%",displaystyle:!0,columnalign:L,columnspacing:"0em",columnwidth:x,rowspacing:"3pt",side:y.options.tagSide,minlabelspacing:b?"0":y.options.tagIndent,"data-width-includes-label":!0},S.setProperty("zeroWidthLabel",b),S},r.NEW_OPS="ams-declare-ops",r.AmsMethods.HandleDeclareOp=function(y,c){var Q=y.GetStar()?"*":"",g=s.default.trimSpaces(y.GetArgument(c));g.charAt(0)==="\\"&&(g=g.substr(1));var v=y.GetArgument(c);y.configuration.handlers.retrieve(r.NEW_OPS).add(g,new T.Macro(g,r.AmsMethods.Macro,["\\operatorname".concat(Q,"{").concat(v,"}")]))},r.AmsMethods.HandleOperatorName=function(y,c){var Q=y.GetStar(),g=s.default.trimSpaces(y.GetArgument(c)),v=new u.default(g,t(t({},y.stack.env),{font:l.TexConstant.Variant.NORMAL,multiLetterIdentifiers:/^[-*a-z]+/i,operatorLetters:!0}),y.configuration).mml();if(v.isKind("mi")||(v=y.create("node","TeXAtom",[v])),o.default.setProperties(v,{movesupsub:Q,movablelimits:!0,texClass:d.TEXCLASS.OP}),!Q){var L=y.GetNext(),x=y.i;L==="\\"&&++y.i&&y.GetCS()!=="limits"&&(y.i=x)}y.Push(v)},r.AmsMethods.SideSet=function(y,c){var Q=e(p(y.ParseArg(c)),2),g=Q[0],v=Q[1],L=e(p(y.ParseArg(c)),2),x=L[0],b=L[1],S=y.ParseArg(c),E=S;g&&(v?g.replaceChild(y.create("node","mphantom",[y.create("node","mpadded",[s.default.copyNode(S,y)],{width:0})]),o.default.getChildAt(g,0)):(E=y.create("node","mmultiscripts",[S]),x&&o.default.appendChildren(E,[o.default.getChildAt(x,1)||y.create("node","none"),o.default.getChildAt(x,2)||y.create("node","none")]),o.default.setProperty(E,"scriptalign","left"),o.default.appendChildren(E,[y.create("node","mprescripts"),o.default.getChildAt(g,1)||y.create("node","none"),o.default.getChildAt(g,2)||y.create("node","none")]))),x&&E===S&&(x.replaceChild(S,o.default.getChildAt(x,0)),E=x);var A=y.create("node","TeXAtom",[],{texClass:d.TEXCLASS.OP,movesupsub:!0,movablelimits:!0});v&&(g&&A.appendChild(g),A.appendChild(v)),A.appendChild(E),b&&A.appendChild(b),y.Push(A)};function p(y){if(!y||y.isInferred&&y.childNodes.length===0)return[null,null];if(y.isKind("msubsup")&&m(y))return[y,null];var c=o.default.getChildAt(y,0);return y.isInferred&&c&&m(c)?(y.childNodes.splice(0,1),[c,y]):[null,y]}function m(y){var c=y.childNodes[0];return c&&c.isKind("mi")&&c.getText()===""}r.AmsMethods.operatorLetter=function(y,c){return y.stack.env.operatorLetters?a.default.variable(y,c):!1},r.AmsMethods.MultiIntegral=function(y,c,Q){var g=y.GetNext();if(g==="\\"){var v=y.i;g=y.GetArgument(c),y.i=v,g==="\\limits"&&(c==="\\idotsint"?Q="\\!\\!\\mathop{\\,\\,"+Q+"}":Q="\\!\\!\\!\\mathop{\\,\\,\\,"+Q+"}")}y.string=Q+" "+y.string.slice(y.i),y.i=0},r.AmsMethods.xArrow=function(y,c,Q,g,v){var L={width:"+"+s.default.Em((g+v)/18),lspace:s.default.Em(g/18)},x=y.GetBrackets(c),b=y.ParseArg(c),S=y.create("node","mspace",[],{depth:".25em"}),E=y.create("token","mo",{stretchy:!0,texClass:d.TEXCLASS.REL},String.fromCodePoint(Q));E=y.create("node","mstyle",[E],{scriptlevel:0});var A=y.create("node","munderover",[E]),M=y.create("node","mpadded",[b,S],L);if(o.default.setAttribute(M,"voffset","-.2em"),o.default.setAttribute(M,"height","-.2em"),o.default.setChild(A,A.over,M),x){var D=new u.default(x,y.stack.env,y.configuration).mml(),I=y.create("node","mspace",[],{height:".75em"});M=y.create("node","mpadded",[D,I],L),o.default.setAttribute(M,"voffset",".15em"),o.default.setAttribute(M,"depth","-.15em"),o.default.setChild(A,A.under,M)}o.default.setProperty(A,"subsupOK",!0),y.Push(A)},r.AmsMethods.HandleShove=function(y,c,Q){var g=y.stack.Top();if(g.kind!=="multline")throw new h.default("CommandOnlyAllowedInEnv","%1 only allowed in %2 environment",y.currentCS,"multline");if(g.Size())throw new h.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",y.currentCS);g.setProperty("shove",Q)},r.AmsMethods.CFrac=function(y,c){var Q=s.default.trimSpaces(y.GetBrackets(c,"")),g=y.GetArgument(c),v=y.GetArgument(c),L={l:l.TexConstant.Align.LEFT,r:l.TexConstant.Align.RIGHT,"":""},x=new u.default("\\strut\\textstyle{"+g+"}",y.stack.env,y.configuration).mml(),b=new u.default("\\strut\\textstyle{"+v+"}",y.stack.env,y.configuration).mml(),S=y.create("node","mfrac",[x,b]);if(Q=L[Q],Q==null)throw new h.default("IllegalAlign","Illegal alignment specified in %1",y.currentCS);Q&&o.default.setProperties(S,{numalign:Q,denomalign:Q}),y.Push(S)},r.AmsMethods.Genfrac=function(y,c,Q,g,v,L){Q==null&&(Q=y.GetDelimiterArg(c)),g==null&&(g=y.GetDelimiterArg(c)),v==null&&(v=y.GetArgument(c)),L==null&&(L=s.default.trimSpaces(y.GetArgument(c)));var x=y.ParseArg(c),b=y.ParseArg(c),S=y.create("node","mfrac",[x,b]);if(v!==""&&o.default.setAttribute(S,"linethickness",v),(Q||g)&&(o.default.setProperty(S,"withDelims",!0),S=s.default.fixedFence(y.configuration,Q,S,g)),L!==""){var E=parseInt(L,10),A=["D","T","S","SS"][E];if(A==null)throw new h.default("BadMathStyleFor","Bad math style for %1",y.currentCS);S=y.create("node","mstyle",[S]),A==="D"?o.default.setProperties(S,{displaystyle:!0,scriptlevel:0}):o.default.setProperties(S,{displaystyle:!1,scriptlevel:E-1})}y.Push(S)},r.AmsMethods.HandleTag=function(y,c){if(!y.tags.currentTag.taggable&&y.tags.env)throw new h.default("CommandNotAllowedInEnv","%1 not allowed in %2 environment",y.currentCS,y.tags.env);if(y.tags.currentTag.tag)throw new h.default("MultipleCommand","Multiple %1",y.currentCS);var Q=y.GetStar(),g=s.default.trimSpaces(y.GetArgument(c));y.tags.tag(g,Q)},r.AmsMethods.HandleNoTag=f.default.HandleNoTag,r.AmsMethods.HandleRef=f.default.HandleRef,r.AmsMethods.Macro=f.default.Macro,r.AmsMethods.Accent=f.default.Accent,r.AmsMethods.Tilde=f.default.Tilde,r.AmsMethods.Array=f.default.Array,r.AmsMethods.Spacer=f.default.Spacer,r.AmsMethods.NamedOp=f.default.NamedOp,r.AmsMethods.EqnArray=f.default.EqnArray,r.AmsMethods.Equation=f.default.Equation})(Yn);var ok=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),lk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),uk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&ok(t,r,e);return lk(t,r),t},u_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},H7=Yn,Mi=uk(Gt),X1=q1,Jn=u_(h3),Hr=u_(Ue()),a5=jt,Zc=G3;new Mi.CharacterMap("AMSmath-mathchar0mo",Jn.default.mathchar0mo,{iiiint:["⨌",{texClass:a5.TEXCLASS.OP}]});new Mi.RegExpMap("AMSmath-operatorLetter",H7.AmsMethods.operatorLetter,/[-*]/i);new Mi.CommandMap("AMSmath-macros",{mathring:["Accent","02DA"],nobreakspace:"Tilde",negmedspace:["Spacer",Zc.MATHSPACE.negativemediummathspace],negthickspace:["Spacer",Zc.MATHSPACE.negativethickmathspace],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Accent","20DB"],ddddot:["Accent","20DC"],sideset:"SideSet",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",eqref:["HandleRef",!0],substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["NamedOp","inj&thinsp;lim"],projlim:["NamedOp","proj&thinsp;lim"],varliminf:["Macro","\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:["Macro","\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","","1"],dfrac:["Genfrac","","","","0"],binom:["Genfrac","(",")","0",""],tbinom:["Genfrac","(",")","0","1"],dbinom:["Genfrac","(",")","0","0"],cfrac:"CFrac",shoveleft:["HandleShove",X1.TexConstant.Align.LEFT],shoveright:["HandleShove",X1.TexConstant.Align.RIGHT],xrightarrow:["xArrow",8594,5,10],xleftarrow:["xArrow",8592,10,5]},H7.AmsMethods);new Mi.EnvironmentMap("AMSmath-environment",Jn.default.environment,{"equation*":["Equation",null,!1],"eqnarray*":["EqnArray",null,!1,!0,"rcl",Hr.default.cols(0,Zc.MATHSPACE.thickmathspace),".5em"],align:["EqnArray",null,!0,!0,"rl",Hr.default.cols(0,2)],"align*":["EqnArray",null,!1,!0,"rl",Hr.default.cols(0,2)],multline:["Multline",null,!0],"multline*":["Multline",null,!1],split:["EqnArray",null,!1,!1,"rl",Hr.default.cols(0)],gather:["EqnArray",null,!0,!0,"c"],"gather*":["EqnArray",null,!1,!0,"c"],alignat:["AlignAt",null,!0,!0],"alignat*":["AlignAt",null,!1,!0],alignedat:["AlignAt",null,!1,!1],aligned:["AmsEqnArray",null,null,null,"rl",Hr.default.cols(0,2),".5em","D"],gathered:["AmsEqnArray",null,null,null,"c",null,".5em","D"],xalignat:["XalignAt",null,!0,!0],"xalignat*":["XalignAt",null,!1,!0],xxalignat:["XalignAt",null,!1,!1],flalign:["FlalignArray",null,!0,!1,!0,"rlc","auto auto fit"],"flalign*":["FlalignArray",null,!1,!1,!0,"rlc","auto auto fit"],subarray:["Array",null,null,null,null,Hr.default.cols(0),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",Hr.default.cols(1/3),".2em","S",1],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".2em","T"]},H7.AmsMethods);new Mi.DelimiterMap("AMSmath-delimiter",Jn.default.delimiter,{"\\lvert":["|",{texClass:a5.TEXCLASS.OPEN}],"\\rvert":["|",{texClass:a5.TEXCLASS.CLOSE}],"\\lVert":["‖",{texClass:a5.TEXCLASS.OPEN}],"\\rVert":["‖",{texClass:a5.TEXCLASS.CLOSE}]});new Mi.CharacterMap("AMSsymbols-mathchar0mi",Jn.default.mathchar0mi,{digamma:"ϝ",varkappa:"ϰ",varGamma:["Γ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varDelta:["Δ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varTheta:["Θ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varLambda:["Λ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varXi:["Ξ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPi:["Π",{mathvariant:X1.TexConstant.Variant.ITALIC}],varSigma:["Σ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varUpsilon:["Υ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPhi:["Φ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPsi:["Ψ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varOmega:["Ω",{mathvariant:X1.TexConstant.Variant.ITALIC}],beth:"ℶ",gimel:"ℷ",daleth:"ℸ",backprime:["‵",{variantForm:!0}],hslash:"ℏ",varnothing:["∅",{variantForm:!0}],blacktriangle:"▴",triangledown:["▽",{variantForm:!0}],blacktriangledown:"▾",square:"◻",Box:"◻",blacksquare:"◼",lozenge:"◊",Diamond:"◊",blacklozenge:"⧫",circledS:["Ⓢ",{mathvariant:X1.TexConstant.Variant.NORMAL}],bigstar:"★",sphericalangle:"∢",measuredangle:"∡",nexists:"∄",complement:"∁",mho:"℧",eth:["ð",{mathvariant:X1.TexConstant.Variant.NORMAL}],Finv:"Ⅎ",diagup:"╱",Game:"⅁",diagdown:"╲",Bbbk:["k",{mathvariant:X1.TexConstant.Variant.DOUBLESTRUCK}],yen:"¥",circledR:"®",checkmark:"✓",maltese:"✠"});new Mi.CharacterMap("AMSsymbols-mathchar0mo",Jn.default.mathchar0mo,{dotplus:"∔",ltimes:"⋉",smallsetminus:["∖",{variantForm:!0}],rtimes:"⋊",Cap:"⋒",doublecap:"⋒",leftthreetimes:"⋋",Cup:"⋓",doublecup:"⋓",rightthreetimes:"⋌",barwedge:"⊼",curlywedge:"⋏",veebar:"⊻",curlyvee:"⋎",doublebarwedge:"⩞",boxminus:"⊟",circleddash:"⊝",boxtimes:"⊠",circledast:"⊛",boxdot:"⊡",circledcirc:"⊚",boxplus:"⊞",centerdot:["⋅",{variantForm:!0}],divideontimes:"⋇",intercal:"⊺",leqq:"≦",geqq:"≧",leqslant:"⩽",geqslant:"⩾",eqslantless:"⪕",eqslantgtr:"⪖",lesssim:"≲",gtrsim:"≳",lessapprox:"⪅",gtrapprox:"⪆",approxeq:"≊",lessdot:"⋖",gtrdot:"⋗",lll:"⋘",llless:"⋘",ggg:"⋙",gggtr:"⋙",lessgtr:"≶",gtrless:"≷",lesseqgtr:"⋚",gtreqless:"⋛",lesseqqgtr:"⪋",gtreqqless:"⪌",doteqdot:"≑",Doteq:"≑",eqcirc:"≖",risingdotseq:"≓",circeq:"≗",fallingdotseq:"≒",triangleq:"≜",backsim:"∽",thicksim:["∼",{variantForm:!0}],backsimeq:"⋍",thickapprox:["≈",{variantForm:!0}],subseteqq:"⫅",supseteqq:"⫆",Subset:"⋐",Supset:"⋑",sqsubset:"⊏",sqsupset:"⊐",preccurlyeq:"≼",succcurlyeq:"≽",curlyeqprec:"⋞",curlyeqsucc:"⋟",precsim:"≾",succsim:"≿",precapprox:"⪷",succapprox:"⪸",vartriangleleft:"⊲",lhd:"⊲",vartriangleright:"⊳",rhd:"⊳",trianglelefteq:"⊴",unlhd:"⊴",trianglerighteq:"⊵",unrhd:"⊵",vDash:["⊨",{variantForm:!0}],Vdash:"⊩",Vvdash:"⊪",smallsmile:["⌣",{variantForm:!0}],shortmid:["∣",{variantForm:!0}],smallfrown:["⌢",{variantForm:!0}],shortparallel:["∥",{variantForm:!0}],bumpeq:"≏",between:"≬",Bumpeq:"≎",pitchfork:"⋔",varpropto:["∝",{variantForm:!0}],backepsilon:"∍",blacktriangleleft:"◂",blacktriangleright:"▸",therefore:"∴",because:"∵",eqsim:"≂",vartriangle:["△",{variantForm:!0}],Join:"⋈",nless:"≮",ngtr:"≯",nleq:"≰",ngeq:"≱",nleqslant:["⪇",{variantForm:!0}],ngeqslant:["⪈",{variantForm:!0}],nleqq:["≰",{variantForm:!0}],ngeqq:["≱",{variantForm:!0}],lneq:"⪇",gneq:"⪈",lneqq:"≨",gneqq:"≩",lvertneqq:["≨",{variantForm:!0}],gvertneqq:["≩",{variantForm:!0}],lnsim:"⋦",gnsim:"⋧",lnapprox:"⪉",gnapprox:"⪊",nprec:"⊀",nsucc:"⊁",npreceq:["⋠",{variantForm:!0}],nsucceq:["⋡",{variantForm:!0}],precneqq:"⪵",succneqq:"⪶",precnsim:"⋨",succnsim:"⋩",precnapprox:"⪹",succnapprox:"⪺",nsim:"≁",ncong:"≇",nshortmid:["∤",{variantForm:!0}],nshortparallel:["∦",{variantForm:!0}],nmid:"∤",nparallel:"∦",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",ntriangleleft:"⋪",ntriangleright:"⋫",ntrianglelefteq:"⋬",ntrianglerighteq:"⋭",nsubseteq:"⊈",nsupseteq:"⊉",nsubseteqq:["⊈",{variantForm:!0}],nsupseteqq:["⊉",{variantForm:!0}],subsetneq:"⊊",supsetneq:"⊋",varsubsetneq:["⊊",{variantForm:!0}],varsupsetneq:["⊋",{variantForm:!0}],subsetneqq:"⫋",supsetneqq:"⫌",varsubsetneqq:["⫋",{variantForm:!0}],varsupsetneqq:["⫌",{variantForm:!0}],leftleftarrows:"⇇",rightrightarrows:"⇉",leftrightarrows:"⇆",rightleftarrows:"⇄",Lleftarrow:"⇚",Rrightarrow:"⇛",twoheadleftarrow:"↞",twoheadrightarrow:"↠",leftarrowtail:"↢",rightarrowtail:"↣",looparrowleft:"↫",looparrowright:"↬",leftrightharpoons:"⇋",rightleftharpoons:["⇌",{variantForm:!0}],curvearrowleft:"↶",curvearrowright:"↷",circlearrowleft:"↺",circlearrowright:"↻",Lsh:"↰",Rsh:"↱",upuparrows:"⇈",downdownarrows:"⇊",upharpoonleft:"↿",upharpoonright:"↾",downharpoonleft:"⇃",restriction:"↾",multimap:"⊸",downharpoonright:"⇂",leftrightsquigarrow:"↭",rightsquigarrow:"⇝",leadsto:"⇝",dashrightarrow:"⇢",dashleftarrow:"⇠",nleftarrow:"↚",nrightarrow:"↛",nLeftarrow:"⇍",nRightarrow:"⇏",nleftrightarrow:"↮",nLeftrightarrow:"⇎"});new Mi.DelimiterMap("AMSsymbols-delimiter",Jn.default.delimiter,{"\\ulcorner":"⌜","\\urcorner":"⌝","\\llcorner":"⌞","\\lrcorner":"⌟"});new Mi.CommandMap("AMSsymbols-macros",{implies:["Macro","\\;\\Longrightarrow\\;"],impliedby:["Macro","\\;\\Longleftarrow\\;"]},H7.AmsMethods);var ck=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ps;Object.defineProperty(Dn,"__esModule",{value:!0});Dn.AmsConfiguration=Dn.AmsTags=void 0;var c_=he,ks=o4,hk=Hi,ag=Yn,Tk=Gt,h_=function(r){ck(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(hk.AbstractTags);Dn.AmsTags=h_;var fk=function(r){new Tk.CommandMap(ag.NEW_OPS,{},{}),r.append(c_.Configuration.local({handler:{macro:[ag.NEW_OPS]},priority:-1}))};Dn.AmsConfiguration=c_.Configuration.create("ams",{handler:{character:["AMSmath-operatorLetter"],delimiter:["AMSsymbols-delimiter","AMSmath-delimiter"],macro:["AMSsymbols-mathchar0mi","AMSsymbols-mathchar0mo","AMSsymbols-delimiter","AMSsymbols-macros","AMSmath-mathchar0mo","AMSmath-macros","AMSmath-delimiter"],environment:["AMSmath-environment"]},items:(Ps={},Ps[ks.MultlineItem.prototype.kind]=ks.MultlineItem,Ps[ks.FlalignItem.prototype.kind]=ks.FlalignItem,Ps),tags:{ams:h_},init:fk,config:function(r,t){t.parseOptions.options.multlineWidth&&(t.parseOptions.options.ams.multlineWidth=t.parseOptions.options.multlineWidth),delete t.parseOptions.options.multlineWidth},options:{multlineWidth:"",ams:{multlineWidth:"100%",multlineIndent:"1em"}}});var IT={},VT={},T_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(VT,"__esModule",{value:!0});var Rs=T_(t2()),Qk=sr,dk=jt,O4=T_(Ne),Qi={};Qi.CD=function(r,t){r.Push(t);var e=r.itemFactory.create("array"),n=r.configuration.options.amscd;return e.setProperties({minw:r.stack.env.CD_minw||n.harrowsize,minh:r.stack.env.CD_minh||n.varrowsize}),e.arraydef={columnalign:"center",columnspacing:n.colspace,rowspacing:n.rowspace,displaystyle:!0},e};Qi.arrow=function(r,t){var e=r.string.charAt(r.i);if(e.match(/[><VA.|=]/))r.i++;else return(0,Qk.Other)(r,t);var n=r.stack.Top();(!n.isKind("array")||n.Size())&&(Qi.cell(r,t),n=r.stack.Top());for(var s=n,a=s.table.length%2===1,o=(s.row.length+(a?0:1))%2;o;)Qi.cell(r,t),o--;var l,u={minsize:s.getProperty("minw"),stretchy:!0},h={minsize:s.getProperty("minh"),stretchy:!0,symmetric:!0,lspace:0,rspace:0};if(e!==".")if(e==="|")l=r.create("token","mo",h,"∥");else if(e==="=")l=r.create("token","mo",u,"=");else{var T={">":"→","<":"←",V:"↓",A:"↑"}[e],f=r.GetUpTo(t+e,e),d=r.GetUpTo(t+e,e);if(e===">"||e==="<"){if(l=r.create("token","mo",u,T),f||(f="\\kern "+s.getProperty("minw")),f||d){var p={width:"+.67em",lspace:".33em"};if(l=r.create("node","munderover",[l]),f){var m=new Rs.default(f,r.stack.env,r.configuration).mml(),y=r.create("node","mpadded",[m],p);O4.default.setAttribute(y,"voffset",".1em"),O4.default.setChild(l,l.over,y)}if(d){var c=new Rs.default(d,r.stack.env,r.configuration).mml();O4.default.setChild(l,l.under,r.create("node","mpadded",[c],p))}r.configuration.options.amscd.hideHorizontalLabels&&(l=r.create("node","mpadded",l,{depth:0,height:".67em"}))}}else{var Q=r.create("token","mo",h,T);l=Q,(f||d)&&(l=r.create("node","mrow"),f&&O4.default.appendChildren(l,[new Rs.default("\\scriptstyle\\llap{"+f+"}",r.stack.env,r.configuration).mml()]),Q.texClass=dk.TEXCLASS.ORD,O4.default.appendChildren(l,[Q]),d&&O4.default.appendChildren(l,[new Rs.default("\\scriptstyle\\rlap{"+d+"}",r.stack.env,r.configuration).mml()]))}}l&&r.Push(l),Qi.cell(r,t)};Qi.cell=function(r,t){var e=r.stack.Top();(e.table||[]).length%2===0&&(e.row||[]).length===0&&r.Push(r.create("node","mpadded",[],{height:"8.5pt",depth:"2pt"})),r.Push(r.itemFactory.create("cell").setProperties({isEntry:!0,name:t}))};Qi.minCDarrowwidth=function(r,t){r.stack.env.CD_minw=r.GetDimen(t)};Qi.minCDarrowheight=function(r,t){r.stack.env.CD_minh=r.GetDimen(t)};VT.default=Qi;var pk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),gk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),mk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&pk(t,r,e);return gk(t,r),t},f_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},PT=mk(Gt),yk=f_(h3),kT=f_(VT);new PT.EnvironmentMap("amscd_environment",yk.default.environment,{CD:"CD"},kT.default);new PT.CommandMap("amscd_macros",{minCDarrowwidth:"minCDarrowwidth",minCDarrowheight:"minCDarrowheight"},kT.default);new PT.MacroMap("amscd_special",{"@":"arrow"},kT.default);Object.defineProperty(IT,"__esModule",{value:!0});IT.AmsCdConfiguration=void 0;var vk=he;IT.AmsCdConfiguration=vk.Configuration.create("amscd",{handler:{character:["amscd_special"],macro:["amscd_macros"],environment:["amscd_environment"]},options:{amscd:{colspace:"5pt",rowspace:"5pt",harrowsize:"2.75em",varrowsize:"1.75em",hideHorizontalLabels:!1}}});var Lk={};(function(r){var t=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.BboxConfiguration=r.BboxMethods=void 0;var e=he,n=Gt,s=t(Le);r.BboxMethods={},r.BboxMethods.BBox=function(l,u){for(var h=l.GetBrackets(u,""),T=l.ParseArg(u),f=h.split(/,/),d,p,m,y=0,c=f.length;y<c;y++){var Q=f[y].trim(),g=Q.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);if(g){if(d)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Padding",u);var v=o(g[1]+g[3]);v&&(d={height:"+"+v,depth:"+"+v,lspace:v,width:"+"+2*parseInt(g[1],10)+g[3]})}else if(Q.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)){if(p)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Background",u);p=Q}else if(Q.match(/^[-a-z]+:/i)){if(m)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Style",u);m=a(Q)}else if(Q!=="")throw new s.default("InvalidBBoxProperty",`"%1" doesn't look like a color, a padding dimension, or a style`,Q)}d&&(T=l.create("node","mpadded",[T],d)),(p||m)&&(d={},p&&Object.assign(d,{mathbackground:p}),m&&Object.assign(d,{style:m}),T=l.create("node","mstyle",[T],d)),l.Push(T)};var a=function(l){return l},o=function(l){return l};new n.CommandMap("bbox",{bbox:"BBox"},r.BboxMethods),r.BboxConfiguration=e.Configuration.create("bbox",{handler:{macro:["bbox"]}})})(Lk);var xk={};(function(r){var t=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(r,"__esModule",{value:!0}),r.BoldsymbolConfiguration=r.rewriteBoldTokens=r.createBoldToken=r.BoldsymbolMethods=void 0;var n=he,s=e(Ne),a=q1,o=Gt,l=Xn,u={};u[a.TexConstant.Variant.NORMAL]=a.TexConstant.Variant.BOLD,u[a.TexConstant.Variant.ITALIC]=a.TexConstant.Variant.BOLDITALIC,u[a.TexConstant.Variant.FRAKTUR]=a.TexConstant.Variant.BOLDFRAKTUR,u[a.TexConstant.Variant.SCRIPT]=a.TexConstant.Variant.BOLDSCRIPT,u[a.TexConstant.Variant.SANSSERIF]=a.TexConstant.Variant.BOLDSANSSERIF,u["-tex-calligraphic"]="-tex-bold-calligraphic",u["-tex-oldstyle"]="-tex-bold-oldstyle",u["-tex-mathit"]=a.TexConstant.Variant.BOLDITALIC,r.BoldsymbolMethods={},r.BoldsymbolMethods.Boldsymbol=function(f,d){var p=f.stack.env.boldsymbol;f.stack.env.boldsymbol=!0;var m=f.ParseArg(d);f.stack.env.boldsymbol=p,f.Push(m)},new o.CommandMap("boldsymbol",{boldsymbol:"Boldsymbol"},r.BoldsymbolMethods);function h(f,d,p,m){var y=l.NodeFactory.createToken(f,d,p,m);return d!=="mtext"&&f.configuration.parser.stack.env.boldsymbol&&(s.default.setProperty(y,"fixBold",!0),f.configuration.addNode("fixBold",y)),y}r.createBoldToken=h;function T(f){var d,p;try{for(var m=t(f.data.getList("fixBold")),y=m.next();!y.done;y=m.next()){var c=y.value;if(s.default.getProperty(c,"fixBold")){var Q=s.default.getAttribute(c,"mathvariant");Q==null?s.default.setAttribute(c,"mathvariant",a.TexConstant.Variant.BOLD):s.default.setAttribute(c,"mathvariant",u[Q]||Q),s.default.removeProperties(c,"fixBold")}}}catch(g){d={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}}r.rewriteBoldTokens=T,r.BoldsymbolConfiguration=n.Configuration.create("boldsymbol",{handler:{macro:["boldsymbol"]},nodes:{token:h},postprocessors:[T]})})(xk);var RT={},M7={},_k=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),bk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(M7,"__esModule",{value:!0});M7.BraketItem=void 0;var og=n3,k9=jt,Sk=bk(Ue()),Ek=function(r){_k(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"braket"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){return e.isKind("close")?[[this.factory.create("mml",this.toMml())],!0]:e.isKind("mml")?(this.Push(e.toMml()),this.getProperty("single")?[[this.toMml()],!0]:og.BaseItem.fail):r.prototype.checkItem.call(this,e)},t.prototype.toMml=function(){var e=r.prototype.toMml.call(this),n=this.getProperty("open"),s=this.getProperty("close");if(this.getProperty("stretchy"))return Sk.default.fenced(this.factory.configuration,n,e,s);var a={fence:!0,stretchy:!1,symmetric:!0,texClass:k9.TEXCLASS.OPEN},o=this.create("token","mo",a,n);a.texClass=k9.TEXCLASS.CLOSE;var l=this.create("token","mo",a,s),u=this.create("node","mrow",[o,e,l],{open:n,close:s,texClass:k9.TEXCLASS.INNER});return u},t}(og.BaseItem);M7.BraketItem=Ek;var BT={},Q_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(BT,"__esModule",{value:!0});var Ak=Q_(p2),R9=jt,Hk=Q_(Le),w7={};w7.Macro=Ak.default.Macro;w7.Braket=function(r,t,e,n,s,a){var o=r.GetNext();if(o==="")throw new Hk.default("MissingArgFor","Missing argument for %1",r.currentCS);var l=!0;o==="{"&&(r.i++,l=!1),r.Push(r.itemFactory.create("braket").setProperties({barmax:a,barcount:0,open:e,close:n,stretchy:s,single:l}))};w7.Bar=function(r,t){var e=t==="|"?"|":"∥",n=r.stack.Top();if(n.kind!=="braket"||n.getProperty("barcount")>=n.getProperty("barmax")){var s=r.create("token","mo",{texClass:R9.TEXCLASS.ORD,stretchy:!1},e);r.Push(s);return}e==="|"&&r.GetNext()==="|"&&(r.i++,e="∥");var a=n.getProperty("stretchy");if(!a){var o=r.create("token","mo",{stretchy:!1,braketbar:!0},e);r.Push(o);return}var l=r.create("node","TeXAtom",[],{texClass:R9.TEXCLASS.CLOSE});r.Push(l),n.setProperty("barcount",n.getProperty("barcount")+1),l=r.create("token","mo",{stretchy:!0,braketbar:!0},e),r.Push(l),l=r.create("node","TeXAtom",[],{texClass:R9.TEXCLASS.OPEN}),r.Push(l)};BT.default=w7;var Mk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},d_=Gt,p_=Mk(BT);new d_.CommandMap("Braket-macros",{bra:["Macro","{\\langle {#1} \\vert}",1],ket:["Macro","{\\vert {#1} \\rangle}",1],braket:["Braket","⟨","⟩",!1,1/0],set:["Braket","{","}",!1,1],Bra:["Macro","{\\left\\langle {#1} \\right\\vert}",1],Ket:["Macro","{\\left\\vert {#1} \\right\\rangle}",1],Braket:["Braket","⟨","⟩",!0,1/0],Set:["Braket","{","}",!0,1],ketbra:["Macro","{\\vert {#1} \\rangle\\langle {#2} \\vert}",2],Ketbra:["Macro","{\\left\\vert {#1} \\right\\rangle\\left\\langle {#2} \\right\\vert}",2],"|":"Bar"},p_.default);new d_.MacroMap("Braket-characters",{"|":"Bar"},p_.default);var B9;Object.defineProperty(RT,"__esModule",{value:!0});RT.BraketConfiguration=void 0;var wk=he,lg=M7;RT.BraketConfiguration=wk.Configuration.create("braket",{handler:{character:["Braket-characters"],macro:["Braket-macros"]},items:(B9={},B9[lg.BraketItem.prototype.kind]=lg.BraketItem,B9)});var FT={},C7={},D7={};(function(r){var t=_&&_.__read||function(U,N){var K=typeof Symbol=="function"&&U[Symbol.iterator];if(!K)return U;var J=K.call(U),ft,Y=[],Qt;try{for(;(N===void 0||N-- >0)&&!(ft=J.next()).done;)Y.push(ft.value)}catch(W){Qt={error:W}}finally{try{ft&&!ft.done&&(K=J.return)&&K.call(J)}finally{if(Qt)throw Qt.error}}return Y},e=_&&_.__values||function(U){var N=typeof Symbol=="function"&&Symbol.iterator,K=N&&U[N],J=0;if(K)return K.call(U);if(U&&typeof U.length=="number")return{next:function(){return U&&J>=U.length&&(U=void 0),{value:U&&U[J++],done:!U}}};throw new TypeError(N?"Object is not iterable.":"Symbol.iterator is not defined.")},n=_&&_.__importDefault||function(U){return U&&U.__esModule?U:{default:U}},s;Object.defineProperty(r,"__esModule",{value:!0}),r.clearDocument=r.saveDocument=r.makeBsprAttributes=r.removeProperty=r.getProperty=r.setProperty=r.balanceRules=void 0;var a=n(Ne),o=n(Ue()),l=null,u=null,h=function(U){u.root=U;var N=l.outputJax.getBBox(u,l).w;return N},T=function(U){for(var N=0;U&&!a.default.isType(U,"mtable");){if(a.default.isType(U,"text"))return null;if(a.default.isType(U,"mrow")){U=U.childNodes[0],N=0;continue}U=U.parent.childNodes[N],N++}return U},f=function(U,N){return U.childNodes[N==="up"?1:0].childNodes[0].childNodes[0].childNodes[0].childNodes[0]},d=function(U,N){return U.childNodes[N].childNodes[0].childNodes[0]},p=function(U){return d(U,0)},m=function(U){return d(U,U.childNodes.length-1)},y=function(U,N){return U.childNodes[N==="up"?0:1].childNodes[0].childNodes[0].childNodes[0]},c=function(U){for(;U&&!a.default.isType(U,"mtd");)U=U.parent;return U},Q=function(U){return U.parent.childNodes[U.parent.childNodes.indexOf(U)+1]},g=function(U){for(;U&&(0,r.getProperty)(U,"inference")==null;)U=U.parent;return U},v=function(U,N,K){K===void 0&&(K=!1);var J=0;if(U===N)return J;if(U!==N.parent){var ft=U.childNodes,Y=K?ft.length-1:0;a.default.isType(ft[Y],"mspace")&&(J+=h(ft[Y])),U=N.parent}if(U===N)return J;var Qt=U.childNodes,W=K?Qt.length-1:0;return Qt[W]!==N&&(J+=h(Qt[W])),J},L=function(U,N){N===void 0&&(N=!1);var K=T(U),J=y(K,(0,r.getProperty)(K,"inferenceRule")),ft=v(U,K,N),Y=h(K),Qt=h(J);return ft+(Y-Qt)/2},x=function(U,N,K,J){if(J===void 0&&(J=!1),(0,r.getProperty)(N,"inferenceRule")||(0,r.getProperty)(N,"labelledRule")){var ft=U.nodeFactory.create("node","mrow");N.parent.replaceChild(ft,N),ft.setChildren([N]),b(N,ft),N=ft}var Y=J?N.childNodes.length-1:0,Qt=N.childNodes[Y];if(a.default.isType(Qt,"mspace")){a.default.setAttribute(Qt,"width",o.default.Em(o.default.dimen2em(a.default.getAttribute(Qt,"width"))+K));return}if(Qt=U.nodeFactory.create("node","mspace",[],{width:o.default.Em(K)}),J){N.appendChild(Qt);return}Qt.parent=N,N.childNodes.unshift(Qt)},b=function(U,N){var K=["inference","proof","maxAdjust","labelledRule"];K.forEach(function(J){var ft=(0,r.getProperty)(U,J);ft!=null&&((0,r.setProperty)(N,J,ft),(0,r.removeProperty)(U,J))})},S=function(U){var N=U.nodeLists.sequent;if(N)for(var K=N.length-1,J=void 0;J=N[K];K--){if((0,r.getProperty)(J,"sequentProcessed")){(0,r.removeProperty)(J,"sequentProcessed");continue}var ft=[],Y=g(J);if((0,r.getProperty)(Y,"inference")===1){for(ft.push(J);(0,r.getProperty)(Y,"inference")===1;){Y=T(Y);var Qt=p(f(Y,(0,r.getProperty)(Y,"inferenceRule"))),W=(0,r.getProperty)(Qt,"inferenceRule")?y(Qt,(0,r.getProperty)(Qt,"inferenceRule")):Qt;(0,r.getProperty)(W,"sequent")&&(J=W.childNodes[0],ft.push(J),(0,r.setProperty)(J,"sequentProcessed",!0)),Y=Qt}A(U,ft)}}},E=function(U,N,K,J,ft){var Y=U.nodeFactory.create("node","mspace",[],{width:o.default.Em(ft)});if(J==="left"){var Qt=N.childNodes[K].childNodes[0];Y.parent=Qt,Qt.childNodes.unshift(Y)}else N.childNodes[K].appendChild(Y);(0,r.setProperty)(N.parent,"sequentAdjust_"+J,ft)},A=function(U,N){for(var K=N.pop();N.length;){var J=N.pop(),ft=t(M(K,J),2),Y=ft[0],Qt=ft[1];(0,r.getProperty)(K.parent,"axiom")&&(E(U,Y<0?K:J,0,"left",Math.abs(Y)),E(U,Qt<0?K:J,2,"right",Math.abs(Qt))),K=J}},M=function(U,N){var K=h(U.childNodes[2]),J=h(N.childNodes[2]),ft=h(U.childNodes[0]),Y=h(N.childNodes[0]),Qt=ft-Y,W=K-J;return[Qt,W]},D=function(U){var N,K;u=new U.document.options.MathItem("",null,U.math.display);var J=U.data;S(J);var ft=J.nodeLists.inference||[];try{for(var Y=e(ft),Qt=Y.next();!Qt.done;Qt=Y.next()){var W=Qt.value,$=(0,r.getProperty)(W,"proof"),Lt=T(W),wt=f(Lt,(0,r.getProperty)(Lt,"inferenceRule")),At=p(wt);if((0,r.getProperty)(At,"inference")){var zt=L(At);if(zt){x(J,At,-zt);var Ot=v(W,Lt,!1);x(J,W,zt-Ot)}}var It=m(wt);if((0,r.getProperty)(It,"inference")!=null){var Ut=L(It,!0);x(J,It,-Ut,!0);var Et=v(W,Lt,!0),ae=(0,r.getProperty)(W,"maxAdjust");ae!=null&&(Ut=Math.max(Ut,ae));var xt=void 0;if($||!(xt=c(W))){x(J,(0,r.getProperty)(W,"proof")?W:W.parent,Ut-Et,!0);continue}var Ee=Q(xt);if(Ee){var je=J.nodeFactory.create("node","mspace",[],{width:Ut-Et+"em"});Ee.appendChild(je),W.removeProperty("maxAdjust");continue}var Z1=g(xt);Z1&&(Ut=(0,r.getProperty)(Z1,"maxAdjust")?Math.max((0,r.getProperty)(Z1,"maxAdjust"),Ut):Ut,(0,r.setProperty)(Z1,"maxAdjust",Ut))}}}catch(O2){N={error:O2}}finally{try{Qt&&!Qt.done&&(K=Y.return)&&K.call(Y)}finally{if(N)throw N.error}}};r.balanceRules=D;var I="bspr_",P=(s={},s[I+"maxAdjust"]=!0,s),R=function(U,N,K){a.default.setProperty(U,I+N,K)};r.setProperty=R;var F=function(U,N){return a.default.getProperty(U,I+N)};r.getProperty=F;var X=function(U,N){U.removeProperty(I+N)};r.removeProperty=X;var st=function(U){U.data.root.walkTree(function(N,K){var J=[];N.getPropertyNames().forEach(function(ft){!P[ft]&&ft.match(RegExp("^"+I))&&J.push(ft+":"+N.getProperty(ft))}),J.length&&a.default.setAttribute(N,"semantics",J.join(";"))})};r.makeBsprAttributes=st;var rt=function(U){if(l=U.document,!("getBBox"in l.outputJax))throw Error("The bussproofs extension requires an output jax with a getBBox() method")};r.saveDocument=rt;var ct=function(U){l=null};r.clearDocument=ct})(D7);var Ck=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),Ok=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Ik=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&Dk(t,r,e);return Ok(t,r),t},g_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(C7,"__esModule",{value:!0});C7.ProofTreeItem=void 0;var Vk=g_(Le),ug=n3,Pk=g_(b7),kk=Ik(D7),Rk=function(r){Ck(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.leftLabel=null,e.rigthLabel=null,e.innerStack=new Pk.default(e.factory,{},!0),e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"proofTree"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")&&e.getName()==="prooftree"){var n=this.toMml();return kk.setProperty(n,"proof",!0),[[this.factory.create("mml",n),e],!0]}if(e.isKind("stop"))throw new Vk.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return this.innerStack.Push(e),ug.BaseItem.fail},t.prototype.toMml=function(){var e=r.prototype.toMml.call(this),n=this.innerStack.Top();if(n.isKind("start")&&!n.Size())return e;this.innerStack.Push(this.factory.create("stop"));var s=this.innerStack.Top().toMml();return this.create("node","mrow",[s,e],{})},t}(ug.BaseItem);C7.ProofTreeItem=Rk;var NT={},Bk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),Fk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Nk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&Bk(t,r,e);return Fk(t,r),t},m_=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},cg=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},UT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(NT,"__esModule",{value:!0});var a3=UT(Le),F9=UT(t2()),Kc=UT(Ue()),di=Nk(D7),z3={};z3.Prooftree=function(r,t){r.Push(t);var e=r.itemFactory.create("proofTree").setProperties({name:t.getName(),line:"solid",currentLine:"solid",rootAtTop:!1});return e};z3.Axiom=function(r,t){var e=r.stack.Top();if(e.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=y_(r,r.GetArgument(t));di.setProperty(n,"axiom",!0),e.Push(n)};var y_=function(r,t){var e=Kc.default.internalMath(r,Kc.default.trimSpaces(t),0);if(!e[0].childNodes[0].childNodes.length)return r.create("node","mrow",[]);var n=r.create("node","mspace",[],{width:".5ex"}),s=r.create("node","mspace",[],{width:".5ex"});return r.create("node","mrow",cg(cg([n],m_(e),!1),[s],!1))};z3.Inference=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<e)throw new a3.default("BadProofTree","Proof tree badly specified.");var s=n.getProperty("rootAtTop"),a=e===1&&!n.Peek()[0].childNodes.length?0:e,o=[];do o.length&&o.unshift(r.create("node","mtd",[],{})),o.unshift(r.create("node","mtd",[n.Pop()],{rowalign:s?"top":"bottom"})),e--;while(e>0);var l=r.create("node","mtr",o,{}),u=r.create("node","mtable",[l],{framespacing:"0 0"}),h=y_(r,r.GetArgument(t)),T=n.getProperty("currentLine");T!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var f=v_(r,u,[h],n.getProperty("left"),n.getProperty("right"),T,s);n.setProperty("left",null),n.setProperty("right",null),di.setProperty(f,"inference",a),r.configuration.addNode("inference",f),n.Push(f)};function v_(r,t,e,n,s,a,o){var l=r.create("node","mtr",[r.create("node","mtd",[t],{})],{}),u=r.create("node","mtr",[r.create("node","mtd",e,{})],{}),h=r.create("node","mtable",o?[u,l]:[l,u],{align:"top 2",rowlines:a,framespacing:"0 0"});di.setProperty(h,"inferenceRule",o?"up":"down");var T,f;n&&(T=r.create("node","mpadded",[n],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),di.setProperty(T,"prooflabel","left")),s&&(f=r.create("node","mpadded",[s],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),di.setProperty(f,"prooflabel","right"));var d,p;if(n&&s)d=[T,h,f],p="both";else if(n)d=[T,h],p="left";else if(s)d=[h,f],p="right";else return h;return h=r.create("node","mrow",d),di.setProperty(h,"labelledRule",p),h}z3.Label=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var s=Kc.default.internalMath(r,r.GetArgument(t),0),a=s.length>1?r.create("node","mrow",s,{}):s[0];n.setProperty(e,a)};z3.SetLine=function(r,t,e,n){var s=r.stack.Top();if(s.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");s.setProperty("currentLine",e),n&&s.setProperty("line",e)};z3.RootAtTop=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");n.setProperty("rootAtTop",e)};z3.AxiomF=function(r,t){var e=r.stack.Top();if(e.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=L_(r,t);di.setProperty(n,"axiom",!0),e.Push(n)};function L_(r,t){var e=r.GetNext();if(e!=="$")throw new a3.default("IllegalUseOfCommand","Use of %1 does not match it's definition.",t);r.i++;var n=r.GetUpTo(t,"$");if(n.indexOf("\\fCenter")===-1)throw new a3.default("IllegalUseOfCommand","Missing \\fCenter in %1.",t);var s=m_(n.split("\\fCenter"),2),a=s[0],o=s[1],l=new F9.default(a,r.stack.env,r.configuration).mml(),u=new F9.default(o,r.stack.env,r.configuration).mml(),h=new F9.default("\\fCenter",r.stack.env,r.configuration).mml(),T=r.create("node","mtd",[l],{}),f=r.create("node","mtd",[h],{}),d=r.create("node","mtd",[u],{}),p=r.create("node","mtr",[T,f,d],{}),m=r.create("node","mtable",[p],{columnspacing:".5ex",columnalign:"center 2"});return di.setProperty(m,"sequent",!0),r.configuration.addNode("sequent",p),m}z3.FCenter=function(r,t){};z3.InferenceF=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<e)throw new a3.default("BadProofTree","Proof tree badly specified.");var s=n.getProperty("rootAtTop"),a=e===1&&!n.Peek()[0].childNodes.length?0:e,o=[];do o.length&&o.unshift(r.create("node","mtd",[],{})),o.unshift(r.create("node","mtd",[n.Pop()],{rowalign:s?"top":"bottom"})),e--;while(e>0);var l=r.create("node","mtr",o,{}),u=r.create("node","mtable",[l],{framespacing:"0 0"}),h=L_(r,t),T=n.getProperty("currentLine");T!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var f=v_(r,u,[h],n.getProperty("left"),n.getProperty("right"),T,s);n.setProperty("left",null),n.setProperty("right",null),di.setProperty(f,"inference",a),r.configuration.addNode("inference",f),n.Push(f)};NT.default=z3;var x_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},__=x_(NT),Uk=x_(h3),b_=Gt;new b_.CommandMap("Bussproofs-macros",{AxiomC:"Axiom",UnaryInfC:["Inference",1],BinaryInfC:["Inference",2],TrinaryInfC:["Inference",3],QuaternaryInfC:["Inference",4],QuinaryInfC:["Inference",5],RightLabel:["Label","right"],LeftLabel:["Label","left"],AXC:"Axiom",UIC:["Inference",1],BIC:["Inference",2],TIC:["Inference",3],RL:["Label","right"],LL:["Label","left"],noLine:["SetLine","none",!1],singleLine:["SetLine","solid",!1],solidLine:["SetLine","solid",!1],dashedLine:["SetLine","dashed",!1],alwaysNoLine:["SetLine","none",!0],alwaysSingleLine:["SetLine","solid",!0],alwaysSolidLine:["SetLine","solid",!0],alwaysDashedLine:["SetLine","dashed",!0],rootAtTop:["RootAtTop",!0],alwaysRootAtTop:["RootAtTop",!0],rootAtBottom:["RootAtTop",!1],alwaysRootAtBottom:["RootAtTop",!1],fCenter:"FCenter",Axiom:"AxiomF",UnaryInf:["InferenceF",1],BinaryInf:["InferenceF",2],TrinaryInf:["InferenceF",3],QuaternaryInf:["InferenceF",4],QuinaryInf:["InferenceF",5]},__.default);new b_.EnvironmentMap("Bussproofs-environments",Uk.default.environment,{prooftree:["Prooftree",null,!1]},__.default);var N9;Object.defineProperty(FT,"__esModule",{value:!0});FT.BussproofsConfiguration=void 0;var jk=he,hg=C7,Bs=D7;FT.BussproofsConfiguration=jk.Configuration.create("bussproofs",{handler:{macro:["Bussproofs-macros"],environment:["Bussproofs-environments"]},items:(N9={},N9[hg.ProofTreeItem.prototype.kind]=hg.ProofTreeItem,N9),preprocessors:[[Bs.saveDocument,1]],postprocessors:[[Bs.clearDocument,3],[Bs.makeBsprAttributes,2],[Bs.balanceRules,1]]});var Gk={},S_={};(function(r){var t=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(r,"__esModule",{value:!0}),r.EncloseConfiguration=r.EncloseMethods=r.ENCLOSE_OPTIONS=void 0;var e=he,n=Gt,s=t(Ue());r.ENCLOSE_OPTIONS={"data-arrowhead":1,color:1,mathcolor:1,background:1,mathbackground:1,"data-padding":1,"data-thickness":1},r.EncloseMethods={},r.EncloseMethods.Enclose=function(a,o){var l=a.GetArgument(o).replace(/,/g," "),u=a.GetBrackets(o,""),h=a.ParseArg(o),T=s.default.keyvalOptions(u,r.ENCLOSE_OPTIONS);T.notation=l,a.Push(a.create("node","menclose",[h],T))},new n.CommandMap("enclose",{enclose:"Enclose"},r.EncloseMethods),r.EncloseConfiguration=e.Configuration.create("enclose",{handler:{macro:["enclose"]}})})(S_);(function(r){var t=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.CancelConfiguration=r.CancelMethods=void 0;var e=he,n=q1,s=Gt,a=t(Ue()),o=S_;r.CancelMethods={},r.CancelMethods.Cancel=function(l,u,h){var T=l.GetBrackets(u,""),f=l.ParseArg(u),d=a.default.keyvalOptions(T,o.ENCLOSE_OPTIONS);d.notation=h,l.Push(l.create("node","menclose",[f],d))},r.CancelMethods.CancelTo=function(l,u){var h=l.GetBrackets(u,""),T=l.ParseArg(u),f=l.ParseArg(u),d=a.default.keyvalOptions(h,o.ENCLOSE_OPTIONS);d.notation=[n.TexConstant.Notation.UPDIAGONALSTRIKE,n.TexConstant.Notation.UPDIAGONALARROW,n.TexConstant.Notation.NORTHEASTARROW].join(" "),T=l.create("node","mpadded",[T],{depth:"-.1em",height:"+.1em",voffset:".1em"}),l.Push(l.create("node","msup",[l.create("node","menclose",[f],d),T]))},new s.CommandMap("cancel",{cancel:["Cancel",n.TexConstant.Notation.UPDIAGONALSTRIKE],bcancel:["Cancel",n.TexConstant.Notation.DOWNDIAGONALSTRIKE],xcancel:["Cancel",n.TexConstant.Notation.UPDIAGONALSTRIKE+" "+n.TexConstant.Notation.DOWNDIAGONALSTRIKE],cancelto:"CancelTo"},r.CancelMethods),r.CancelConfiguration=e.Configuration.create("cancel",{handler:{macro:["cancel"]}})})(Gk);var zk={},jT={};(function(r){var t=_&&_.__read||function(l,u){var h=typeof Symbol=="function"&&l[Symbol.iterator];if(!h)return l;var T=h.call(l),f,d=[],p;try{for(;(u===void 0||u-- >0)&&!(f=T.next()).done;)d.push(f.value)}catch(m){p={error:m}}finally{try{f&&!f.done&&(h=T.return)&&h.call(T)}finally{if(p)throw p.error}}return d},e=_&&_.__spreadArray||function(l,u,h){if(h||arguments.length===2)for(var T=0,f=u.length,d;T<f;T++)(d||!(T in u))&&(d||(d=Array.prototype.slice.call(u,0,T)),d[T]=u[T]);return l.concat(d||Array.prototype.slice.call(u))},n=_&&_.__values||function(l){var u=typeof Symbol=="function"&&Symbol.iterator,h=u&&l[u],T=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&T>=l.length&&(l=void 0),{value:l&&l[T++],done:!l}}};throw new TypeError(u?"Object is not iterable.":"Symbol.iterator is not defined.")},s=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.EmpheqUtil=void 0;var a=s(Ue()),o=s(t2());r.EmpheqUtil={environment:function(l,u,h,T){var f=T[0],d=l.itemFactory.create(f+"-begin").setProperties({name:u,end:f});l.Push(h.apply(void 0,e([l,d],t(T.slice(1)),!1)))},splitOptions:function(l,u){return u===void 0&&(u=null),a.default.keyvalOptions(l,u,!0)},columnCount:function(l){var u,h,T=0;try{for(var f=n(l.childNodes),d=f.next();!d.done;d=f.next()){var p=d.value,m=p.childNodes.length-(p.isKind("mlabeledtr")?1:0);m>T&&(T=m)}}catch(y){u={error:y}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}return T},cellBlock:function(l,u,h,T){var f,d,p=h.create("node","mpadded",[],{height:0,depth:0,voffset:"-1height"}),m=new o.default(l,h.stack.env,h.configuration),y=m.mml();T&&m.configuration.tags.label&&(m.configuration.tags.currentTag.env=T,m.configuration.tags.getTag(!0));try{for(var c=n(y.isInferred?y.childNodes:[y]),Q=c.next();!Q.done;Q=c.next()){var g=Q.value;p.appendChild(g)}}catch(v){f={error:v}}finally{try{Q&&!Q.done&&(d=c.return)&&d.call(c)}finally{if(f)throw f.error}}return p.appendChild(h.create("node","mphantom",[h.create("node","mpadded",[u],{width:0})])),p},topRowTable:function(l,u){var h=a.default.copyNode(l,u);return h.setChildren(h.childNodes.slice(0,1)),h.attributes.set("align","baseline 1"),l.factory.create("mphantom",{},[u.create("node","mpadded",[h],{width:0})])},rowspanCell:function(l,u,h,T,f){l.appendChild(T.create("node","mpadded",[this.cellBlock(u,a.default.copyNode(h,T),T,f),this.topRowTable(h,T)],{height:0,depth:0,voffset:"height"}))},left:function(l,u,h,T,f){var d,p;f===void 0&&(f=""),l.attributes.set("columnalign","right "+(l.attributes.get("columnalign")||"")),l.attributes.set("columnspacing","0em "+(l.attributes.get("columnspacing")||""));var m;try{for(var y=n(l.childNodes.slice(0).reverse()),c=y.next();!c.done;c=y.next()){var Q=c.value;m=T.create("node","mtd"),Q.childNodes.unshift(m),m.parent=Q,Q.isKind("mlabeledtr")&&(Q.childNodes[0]=Q.childNodes[1],Q.childNodes[1]=m)}}catch(g){d={error:g}}finally{try{c&&!c.done&&(p=y.return)&&p.call(y)}finally{if(d)throw d.error}}this.rowspanCell(m,h,u,T,f)},right:function(l,u,h,T,f){f===void 0&&(f=""),l.childNodes.length===0&&l.appendChild(T.create("node","mtr"));for(var d=r.EmpheqUtil.columnCount(l),p=l.childNodes[0];p.childNodes.length<d;)p.appendChild(T.create("node","mtd"));var m=p.appendChild(T.create("node","mtd"));r.EmpheqUtil.rowspanCell(m,h,u,T,f),l.attributes.set("columnalign",(l.attributes.get("columnalign")||"").split(/ /).slice(0,d).join(" ")+" left"),l.attributes.set("columnspacing",(l.attributes.get("columnspacing")||"").split(/ /).slice(0,d-1).join(" ")+" 0em")},adjustTable:function(l,u){var h=l.getProperty("left"),T=l.getProperty("right");if(h||T){var f=l.Last,d=a.default.copyNode(f,u);h&&this.left(f,d,h,u),T&&this.right(f,d,T,u)}},allowEnv:{equation:!0,align:!0,gather:!0,flalign:!0,alignat:!0,multline:!0},checkEnv:function(l){return this.allowEnv.hasOwnProperty(l.replace(/\*$/,""))||!1}}})(jT);(function(r){var t=_&&_.__extends||function(){var m=function(y,c){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,g){Q.__proto__=g}||function(Q,g){for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(Q[v]=g[v])},m(y,c)};return function(y,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");m(y,c);function Q(){this.constructor=y}y.prototype=c===null?Object.create(c):(Q.prototype=c.prototype,new Q)}}(),e=_&&_.__importDefault||function(m){return m&&m.__esModule?m:{default:m}},n;Object.defineProperty(r,"__esModule",{value:!0}),r.CasesConfiguration=r.CasesMethods=r.CasesTags=r.CasesBeginItem=void 0;var s=he,a=Gt,o=e(Ue()),l=e(p2),u=e(Le),h=Nt,T=Dn,f=jT,d=function(m){t(y,m);function y(){return m!==null&&m.apply(this,arguments)||this}return Object.defineProperty(y.prototype,"kind",{get:function(){return"cases-begin"},enumerable:!1,configurable:!0}),y.prototype.checkItem=function(c){return c.isKind("end")&&c.getName()===this.getName()&&this.getProperty("end")?(this.setProperty("end",!1),[[],!0]):m.prototype.checkItem.call(this,c)},y}(h.BeginItem);r.CasesBeginItem=d;var p=function(m){t(y,m);function y(){var c=m!==null&&m.apply(this,arguments)||this;return c.subcounter=0,c}return y.prototype.start=function(c,Q,g){this.subcounter=0,m.prototype.start.call(this,c,Q,g)},y.prototype.autoTag=function(){this.currentTag.tag==null&&(this.currentTag.env==="subnumcases"?(this.subcounter===0&&this.counter++,this.subcounter++,this.tag(this.formatNumber(this.counter,this.subcounter),!1)):((this.subcounter===0||this.currentTag.env!=="numcases-left")&&this.counter++,this.tag(this.formatNumber(this.counter),!1)))},y.prototype.formatNumber=function(c,Q){return Q===void 0&&(Q=null),c.toString()+(Q===null?"":String.fromCharCode(96+Q))},y}(T.AmsTags);r.CasesTags=p,r.CasesMethods={NumCases:function(m,y){if(m.stack.env.closing===y.getName()){delete m.stack.env.closing,m.Push(m.itemFactory.create("end").setProperty("name",y.getName()));var c=m.stack.Top(),Q=c.Last,g=o.default.copyNode(Q,m),v=c.getProperty("left");return f.EmpheqUtil.left(Q,g,v+"\\empheqlbrace\\,",m,"numcases-left"),m.Push(m.itemFactory.create("end").setProperty("name",y.getName())),null}else{var v=m.GetArgument("\\begin{"+y.getName()+"}");y.setProperty("left",v);var L=l.default.EqnArray(m,y,!0,!0,"ll");return L.arraydef.displaystyle=!1,L.arraydef.rowspacing=".2em",L.setProperty("numCases",!0),m.Push(y),L}},Entry:function(m,y){if(!m.stack.Top().getProperty("numCases"))return l.default.Entry(m,y);m.Push(m.itemFactory.create("cell").setProperties({isEntry:!0,name:y}));for(var c=m.string,Q=0,g=m.i,v=c.length;g<v;){var L=c.charAt(g);if(L==="{")Q++,g++;else if(L==="}"){if(Q===0)break;Q--,g++}else{if(L==="&"&&Q===0)throw new u.default("ExtraCasesAlignTab","Extra alignment tab in text for numcase environment");if(L==="\\"&&Q===0){var x=(c.slice(g+1).match(/^[a-z]+|./i)||[])[0];if(x==="\\"||x==="cr"||x==="end"||x==="label")break;g+=x.length}else g++}}var b=c.substr(m.i,g-m.i).replace(/^\s*/,"");m.PushAll(o.default.internalMath(m,b,0)),m.i=g}},new a.EnvironmentMap("cases-env",f.EmpheqUtil.environment,{numcases:["NumCases","cases"],subnumcases:["NumCases","cases"]},r.CasesMethods),new a.MacroMap("cases-macros",{"&":"Entry"},r.CasesMethods),r.CasesConfiguration=s.Configuration.create("cases",{handler:{environment:["cases-env"],character:["cases-macros"]},items:(n={},n[d.prototype.kind]=d,n),tags:{cases:p}})})(zk);var k5={},Wk=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},GT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(k5,"__esModule",{value:!0});k5.CenternotConfiguration=k5.filterCenterOver=void 0;var qk=he,Tg=GT(t2()),fg=GT(Ne),Zk=Gt,Kk=GT(p2);new Zk.CommandMap("centernot",{centerOver:"CenterOver",centernot:["Macro","\\centerOver{#1}{{⧸}}",1]},{CenterOver:function(r,t){var e="{"+r.GetArgument(t)+"}",n=r.ParseArg(t),s=new Tg.default(e,r.stack.env,r.configuration).mml(),a=r.create("node","TeXAtom",[new Tg.default(e,r.stack.env,r.configuration).mml(),r.create("node","mpadded",[r.create("node","mpadded",[n],{width:0,lspace:"-.5width"}),r.create("node","mphantom",[s])],{width:0,lspace:"-.5width"})]);r.configuration.addNode("centerOver",s),r.Push(a)},Macro:Kk.default.Macro});function E_(r){var t,e,n=r.data;try{for(var s=Wk(n.getList("centerOver")),a=s.next();!a.done;a=s.next()){var o=a.value,l=fg.default.getTexClass(o.childNodes[0].childNodes[0]);l!==null&&fg.default.setProperties(o.parent.parent.parent.parent.parent.parent,{texClass:l})}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}k5.filterCenterOver=E_;k5.CenternotConfiguration=qk.Configuration.create("centernot",{handler:{macro:["centernot"]},postprocessors:[E_]});var zT={},A_={};(function(r){var t=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(r,"__esModule",{value:!0}),r.ColorMethods=void 0;var e=t(Ne),n=t(Ue());function s(a){var o="+".concat(a),l=a.replace(/^.*?([a-z]*)$/,"$1"),u=2*parseFloat(o);return{width:"+".concat(u).concat(l),height:o,depth:o,lspace:a}}r.ColorMethods={},r.ColorMethods.Color=function(a,o){var l=a.GetBrackets(o,""),u=a.GetArgument(o),h=a.configuration.packageData.get("color").model,T=h.getColor(l,u),f=a.itemFactory.create("style").setProperties({styles:{mathcolor:T}});a.stack.env.color=T,a.Push(f)},r.ColorMethods.TextColor=function(a,o){var l=a.GetBrackets(o,""),u=a.GetArgument(o),h=a.configuration.packageData.get("color").model,T=h.getColor(l,u),f=a.stack.env.color;a.stack.env.color=T;var d=a.ParseArg(o);f?a.stack.env.color=f:delete a.stack.env.color;var p=a.create("node","mstyle",[d],{mathcolor:T});a.Push(p)},r.ColorMethods.DefineColor=function(a,o){var l=a.GetArgument(o),u=a.GetArgument(o),h=a.GetArgument(o),T=a.configuration.packageData.get("color").model;T.defineColor(u,l,h)},r.ColorMethods.ColorBox=function(a,o){var l=a.GetArgument(o),u=n.default.internalMath(a,a.GetArgument(o)),h=a.configuration.packageData.get("color").model,T=a.create("node","mpadded",u,{mathbackground:h.getColor("named",l)});e.default.setProperties(T,s(a.options.color.padding)),a.Push(T)},r.ColorMethods.FColorBox=function(a,o){var l=a.GetArgument(o),u=a.GetArgument(o),h=n.default.internalMath(a,a.GetArgument(o)),T=a.options.color,f=a.configuration.packageData.get("color").model,d=a.create("node","mpadded",h,{mathbackground:f.getColor("named",u),style:"border: ".concat(T.borderWidth," solid ").concat(f.getColor("named",l))});e.default.setProperties(d,s(T.padding)),a.Push(d)}})(A_);var O7={},I7={};Object.defineProperty(I7,"__esModule",{value:!0});I7.COLORS=void 0;I7.COLORS=new Map([["Apricot","#FBB982"],["Aquamarine","#00B5BE"],["Bittersweet","#C04F17"],["Black","#221E1F"],["Blue","#2D2F92"],["BlueGreen","#00B3B8"],["BlueViolet","#473992"],["BrickRed","#B6321C"],["Brown","#792500"],["BurntOrange","#F7921D"],["CadetBlue","#74729A"],["CarnationPink","#F282B4"],["Cerulean","#00A2E3"],["CornflowerBlue","#41B0E4"],["Cyan","#00AEEF"],["Dandelion","#FDBC42"],["DarkOrchid","#A4538A"],["Emerald","#00A99D"],["ForestGreen","#009B55"],["Fuchsia","#8C368C"],["Goldenrod","#FFDF42"],["Gray","#949698"],["Green","#00A64F"],["GreenYellow","#DFE674"],["JungleGreen","#00A99A"],["Lavender","#F49EC4"],["LimeGreen","#8DC73E"],["Magenta","#EC008C"],["Mahogany","#A9341F"],["Maroon","#AF3235"],["Melon","#F89E7B"],["MidnightBlue","#006795"],["Mulberry","#A93C93"],["NavyBlue","#006EB8"],["OliveGreen","#3C8031"],["Orange","#F58137"],["OrangeRed","#ED135A"],["Orchid","#AF72B0"],["Peach","#F7965A"],["Periwinkle","#7977B8"],["PineGreen","#008B72"],["Plum","#92268F"],["ProcessBlue","#00B0F0"],["Purple","#99479B"],["RawSienna","#974006"],["Red","#ED1B23"],["RedOrange","#F26035"],["RedViolet","#A1246B"],["Rhodamine","#EF559F"],["RoyalBlue","#0071BC"],["RoyalPurple","#613F99"],["RubineRed","#ED017D"],["Salmon","#F69289"],["SeaGreen","#3FBC9D"],["Sepia","#671800"],["SkyBlue","#46C5DD"],["SpringGreen","#C6DC67"],["Tan","#DA9D76"],["TealBlue","#00AEB3"],["Thistle","#D883B7"],["Turquoise","#00B4CE"],["Violet","#58429B"],["VioletRed","#EF58A0"],["White","#FFFFFF"],["WildStrawberry","#EE2967"],["Yellow","#FFF200"],["YellowGreen","#98CC70"],["YellowOrange","#FAA21A"]]);var H_=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(O7,"__esModule",{value:!0});O7.ColorModel=void 0;var Li=Xk(Le),Qg=I7,R5=new Map,$k=function(){function r(){this.userColors=new Map}return r.prototype.normalizeColor=function(t,e){if(!t||t==="named")return e;if(R5.has(t)){var n=R5.get(t);return n(e)}throw new Li.default("UndefinedColorModel","Color model '%1' not defined",t)},r.prototype.getColor=function(t,e){return!t||t==="named"?this.getColorByName(e):this.normalizeColor(t,e)},r.prototype.getColorByName=function(t){return this.userColors.has(t)?this.userColors.get(t):Qg.COLORS.has(t)?Qg.COLORS.get(t):t},r.prototype.defineColor=function(t,e,n){var s=this.normalizeColor(t,n);this.userColors.set(e,s)},r}();O7.ColorModel=$k;R5.set("rgb",function(r){var t,e,n=r.trim().split(/\s*,\s*/),s="#";if(n.length!==3)throw new Li.default("ModelArg1","Color values for the %1 model require 3 numbers","rgb");try{for(var a=H_(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(!l.match(/^(\d+(\.\d*)?|\.\d+)$/))throw new Li.default("InvalidDecimalNumber","Invalid decimal number");var u=parseFloat(l);if(u<0||u>1)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","rgb","0","1");var h=Math.floor(u*255).toString(16);h.length<2&&(h="0"+h),s+=h}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return s});R5.set("RGB",function(r){var t,e,n=r.trim().split(/\s*,\s*/),s="#";if(n.length!==3)throw new Li.default("ModelArg1","Color values for the %1 model require 3 numbers","RGB");try{for(var a=H_(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(!l.match(/^\d+$/))throw new Li.default("InvalidNumber","Invalid number");var u=parseInt(l);if(u>255)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","RGB","0","255");var h=u.toString(16);h.length<2&&(h="0"+h),s+=h}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return s});R5.set("gray",function(r){if(!r.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/))throw new Li.default("InvalidDecimalNumber","Invalid decimal number");var t=parseFloat(r);if(t<0||t>1)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","gray","0","1");var e=Math.floor(t*255).toString(16);return e.length<2&&(e="0"+e),"#".concat(e).concat(e).concat(e)});Object.defineProperty(zT,"__esModule",{value:!0});zT.ColorConfiguration=void 0;var Yk=Gt,Jk=he,tR=A_,eR=O7;new Yk.CommandMap("color",{color:"Color",textcolor:"TextColor",definecolor:"DefineColor",colorbox:"ColorBox",fcolorbox:"FColorBox"},tR.ColorMethods);var iR=function(r,t){t.parseOptions.packageData.set("color",{model:new eR.ColorModel})};zT.ColorConfiguration=Jk.Configuration.create("color",{handler:{macro:["color"]},options:{color:{padding:"5px",borderWidth:"2px"}},config:iR});var rR={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ColorConfiguration=r.ColorV2Methods=void 0;var t=Gt,e=he;r.ColorV2Methods={Color:function(n,s){var a=n.GetArgument(s),o=n.stack.env.color;n.stack.env.color=a;var l=n.ParseArg(s);o?n.stack.env.color=o:delete n.stack.env.color;var u=n.create("node","mstyle",[l],{mathcolor:a});n.Push(u)}},new t.CommandMap("colorv2",{color:"Color"},r.ColorV2Methods),r.ColorConfiguration=e.Configuration.create("colorv2",{handler:{macro:["colorv2"]}})})(rR);var B5={},nR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),sR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B5,"__esModule",{value:!0});B5.ColortblConfiguration=B5.ColorArrayItem=void 0;var aR=Nt,M_=he,oR=Gt,U9=sR(Le),WT=function(r){nR(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.color={cell:"",row:"",col:[]},e.hasColor=!1,e}return t.prototype.EndEntry=function(){r.prototype.EndEntry.call(this);var e=this.row[this.row.length-1],n=this.color.cell||this.color.row||this.color.col[this.row.length-1];n&&(e.attributes.set("mathbackground",n),this.color.cell="",this.hasColor=!0)},t.prototype.EndRow=function(){r.prototype.EndRow.call(this),this.color.row=""},t.prototype.createMml=function(){var e=r.prototype.createMml.call(this),n=e.isKind("mrow")?e.childNodes[1]:e;return n.isKind("menclose")&&(n=n.childNodes[0].childNodes[0]),this.hasColor&&n.attributes.get("frame")==="none"&&n.attributes.set("frame",""),e},t}(aR.ArrayItem);B5.ColorArrayItem=WT;new oR.CommandMap("colortbl",{cellcolor:["TableColor","cell"],rowcolor:["TableColor","row"],columncolor:["TableColor","col"]},{TableColor:function(r,t,e){var n=r.configuration.packageData.get("color").model,s=r.GetBrackets(t,""),a=n.getColor(s,r.GetArgument(t)),o=r.stack.Top();if(!(o instanceof WT))throw new U9.default("UnsupportedTableColor","Unsupported use of %1",r.currentCS);if(e==="col"){if(o.table.length)throw new U9.default("ColumnColorNotTop","%1 must be in the top row",t);o.color.col[o.row.length]=a,r.GetBrackets(t,"")&&r.GetBrackets(t,"")}else if(o.color[e]=a,e==="row"&&(o.Size()||o.row.length))throw new U9.default("RowColorNotFirst","%1 must be at the beginning of a row",t)}});var lR=function(r,t){t.parseOptions.packageData.has("color")||M_.ConfigurationHandler.get("color").config(r,t)};B5.ColortblConfiguration=M_.Configuration.create("colortbl",{handler:{macro:["colortbl"]},items:{array:WT},priority:10,config:[lR,10]});var qT={},H0={},t6={},w_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t6,"__esModule",{value:!0});var j9=w_(Ue()),Mr=w_(Le),Fs=s3,Xc;(function(r){function t(d,p){var m=[d,p.char];if(p.attributes)for(var y in p.attributes)m.push(y),m.push(p.attributes[y]);return m}r.disassembleSymbol=t;function e(d){for(var p=d[0],m=d[1],y={},c=2;c<d.length;c=c+2)y[d[c]]=d[c+1];return new Fs.Symbol(p,m,y)}r.assembleSymbol=e;function n(d,p){var m=d.GetNext();if(m!=="\\")throw new Mr.default("MissingCS","%1 must be followed by a control sequence",p);var y=j9.default.trimSpaces(d.GetArgument(p));return y.substr(1)}r.GetCSname=n;function s(d,p){var m=j9.default.trimSpaces(d.GetArgument(p));if(m.charAt(0)==="\\"&&(m=m.substr(1)),!m.match(/^(.|[a-z]+)$/i))throw new Mr.default("IllegalControlSequenceName","Illegal control sequence name for %1",p);return m}r.GetCsNameArgument=s;function a(d,p){var m=d.GetBrackets(p);if(m&&(m=j9.default.trimSpaces(m),!m.match(/^[0-9]+$/)))throw new Mr.default("IllegalParamNumber","Illegal number of parameters specified in %1",p);return m}r.GetArgCount=a;function o(d,p,m){for(var y=d.GetNext(),c=[],Q=0,g=d.i;d.i<d.string.length;){if(y=d.GetNext(),y==="#"){if(g!==d.i&&(c[Q]=d.string.substr(g,d.i-g)),y=d.string.charAt(++d.i),!y.match(/^[1-9]$/))throw new Mr.default("CantUseHash2","Illegal use of # in template for %1",m);if(parseInt(y)!==++Q)throw new Mr.default("SequentialParam","Parameters for %1 must be numbered sequentially",m);g=d.i+1}else if(y==="{")return g!==d.i&&(c[Q]=d.string.substr(g,d.i-g)),c.length>0?[Q.toString()].concat(c):Q;d.i++}throw new Mr.default("MissingReplacementString","Missing replacement string for definition of %1",p)}r.GetTemplate=o;function l(d,p,m){if(m==null)return d.GetArgument(p);for(var y=d.i,c=0,Q=0;d.i<d.string.length;){var g=d.string.charAt(d.i);if(g==="{")d.i===y&&(Q=1),d.GetArgument(p),c=d.i-y;else{if(u(d,m))return Q&&(y++,c-=2),d.string.substr(y,c);if(g==="\\"){d.i++,c++,Q=0;var v=d.string.substr(d.i).match(/[a-z]+|./i);v&&(d.i+=v[0].length,c=d.i-y)}else d.i++,c++,Q=0}}throw new Mr.default("RunawayArgument","Runaway argument for %1?",p)}r.GetParameter=l;function u(d,p){return d.string.substr(d.i,p.length)!==p||p.match(/\\[a-z]+$/i)&&d.string.charAt(d.i+p.length).match(/[a-z]/i)?0:(d.i+=p.length,1)}r.MatchParam=u;function h(d,p,m,y){var c=d.configuration.handlers,Q=c.retrieve(r.NEW_DELIMITER);Q.add(p,new Fs.Symbol(p,m,y))}r.addDelimiter=h;function T(d,p,m,y,c){c===void 0&&(c="");var Q=d.configuration.handlers,g=Q.retrieve(r.NEW_COMMAND);g.add(p,new Fs.Macro(c||p,m,y))}r.addMacro=T;function f(d,p,m,y){var c=d.configuration.handlers,Q=c.retrieve(r.NEW_ENVIRONMENT);Q.add(p,new Fs.Macro(p,m,y))}r.addEnvironment=f,r.NEW_DELIMITER="new-Delimiter",r.NEW_COMMAND="new-Command",r.NEW_ENVIRONMENT="new-Environment"})(Xc||(Xc={}));t6.default=Xc;var uR=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),cR=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),hR=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&uR(t,r,e);return cR(t,r),t},V7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(H0,"__esModule",{value:!0});var TR=V7(Le),fR=hR(Gt),QR=V7(p2),Kr=V7(Ue()),h1=V7(t6),C2={};C2.NewCommand=function(r,t){var e=h1.default.GetCsNameArgument(r,t),n=h1.default.GetArgCount(r,t),s=r.GetBrackets(t),a=r.GetArgument(t);h1.default.addMacro(r,e,C2.Macro,[a,n,s])};C2.NewEnvironment=function(r,t){var e=Kr.default.trimSpaces(r.GetArgument(t)),n=h1.default.GetArgCount(r,t),s=r.GetBrackets(t),a=r.GetArgument(t),o=r.GetArgument(t);h1.default.addEnvironment(r,e,C2.BeginEnv,[!0,a,o,n,s])};C2.MacroDef=function(r,t){var e=h1.default.GetCSname(r,t),n=h1.default.GetTemplate(r,t,"\\"+e),s=r.GetArgument(t);n instanceof Array?h1.default.addMacro(r,e,C2.MacroWithTemplate,[s].concat(n)):h1.default.addMacro(r,e,C2.Macro,[s,n])};C2.Let=function(r,t){var e=h1.default.GetCSname(r,t),n=r.GetNext();n==="="&&(r.i++,n=r.GetNext());var s=r.configuration.handlers;if(n==="\\"){t=h1.default.GetCSname(r,t);var a=s.get("delimiter").lookup("\\"+t);if(a){h1.default.addDelimiter(r,"\\"+e,a.char,a.attributes);return}var o=s.get("macro").applicable(t);if(!o)return;if(o instanceof fR.MacroMap){var l=o.lookup(t);h1.default.addMacro(r,e,l.func,l.args,l.symbol);return}a=o.lookup(t);var u=h1.default.disassembleSymbol(e,a),h=function(f,d){for(var p=[],m=2;m<arguments.length;m++)p[m-2]=arguments[m];var y=h1.default.assembleSymbol(p);return o.parser(f,y)};h1.default.addMacro(r,e,h,u);return}r.i++;var T=s.get("delimiter").lookup(n);if(T){h1.default.addDelimiter(r,"\\"+e,T.char,T.attributes);return}h1.default.addMacro(r,e,C2.Macro,[n])};C2.MacroWithTemplate=function(r,t,e,n){for(var s=[],a=4;a<arguments.length;a++)s[a-4]=arguments[a];var o=parseInt(n,10);if(o){var l=[];if(r.GetNext(),s[0]&&!h1.default.MatchParam(r,s[0]))throw new TR.default("MismatchUseDef","Use of %1 doesn't match its definition",t);for(var u=0;u<o;u++)l.push(h1.default.GetParameter(r,t,s[u+1]));e=Kr.default.substituteArgs(r,l,e)}r.string=Kr.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,Kr.default.checkMaxMacros(r)};C2.BeginEnv=function(r,t,e,n,s,a){if(t.getProperty("end")&&r.stack.env.closing===t.getName()){delete r.stack.env.closing;var o=r.string.slice(r.i);return r.string=n,r.i=0,r.Parse(),r.string=o,r.i=0,r.itemFactory.create("end").setProperty("name",t.getName())}if(s){var l=[];if(a!=null){var u=r.GetBrackets("\\begin{"+t.getName()+"}");l.push(u??a)}for(var h=l.length;h<s;h++)l.push(r.GetArgument("\\begin{"+t.getName()+"}"));e=Kr.default.substituteArgs(r,l,e),n=Kr.default.substituteArgs(r,[],n)}return r.string=Kr.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,r.itemFactory.create("beginEnv").setProperty("name",t.getName())};C2.Macro=QR.default.Macro;H0.default=C2;var M0={},dR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),pR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(M0,"__esModule",{value:!0});M0.BeginEnvItem=void 0;var dg=pR(Le),gR=n3,mR=function(r){dR(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"beginEnv"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new dg.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new dg.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(gR.BaseItem);M0.BeginEnvItem=mR;var C_=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},D_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},G9;Object.defineProperty(qT,"__esModule",{value:!0});qT.ConfigMacrosConfiguration=void 0;var O_=he,pg=H1,gg=Gt,yR=D_(h3),$c=s3,Yc=D_(H0),mg=M0,Jc="configmacros-map",th="configmacros-env-map";function vR(r){new gg.CommandMap(Jc,{},{}),new gg.EnvironmentMap(th,yR.default.environment,{},{}),r.append(O_.Configuration.local({handler:{macro:[Jc],environment:[th]},priority:3}))}function LR(r,t){xR(t),_R(t)}function xR(r){var t,e,n=r.parseOptions.handlers.retrieve(Jc),s=r.parseOptions.options.macros;try{for(var a=C_(Object.keys(s)),o=a.next();!o.done;o=a.next()){var l=o.value,u=typeof s[l]=="string"?[s[l]]:s[l],h=Array.isArray(u[2])?new $c.Macro(l,Yc.default.MacroWithTemplate,u.slice(0,2).concat(u[2])):new $c.Macro(l,Yc.default.Macro,u);n.add(l,h)}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}function _R(r){var t,e,n=r.parseOptions.handlers.retrieve(th),s=r.parseOptions.options.environments;try{for(var a=C_(Object.keys(s)),o=a.next();!o.done;o=a.next()){var l=o.value;n.add(l,new $c.Macro(l,Yc.default.BeginEnv,[!0].concat(s[l])))}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}qT.ConfigMacrosConfiguration=O_.Configuration.create("configmacros",{init:vR,config:LR,items:(G9={},G9[mg.BeginEnvItem.prototype.kind]=mg.BeginEnvItem,G9),options:{macros:(0,pg.expandable)({}),environments:(0,pg.expandable)({})}});var bR={};(function(r){var t=_&&_.__extends||function(){var d=function(p,m){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,c){y.__proto__=c}||function(y,c){for(var Q in c)Object.prototype.hasOwnProperty.call(c,Q)&&(y[Q]=c[Q])},d(p,m)};return function(p,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");d(p,m);function y(){this.constructor=p}p.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),e=_&&_.__read||function(d,p){var m=typeof Symbol=="function"&&d[Symbol.iterator];if(!m)return d;var y=m.call(d),c,Q=[],g;try{for(;(p===void 0||p-- >0)&&!(c=y.next()).done;)Q.push(c.value)}catch(v){g={error:v}}finally{try{c&&!c.done&&(m=y.return)&&m.call(y)}finally{if(g)throw g.error}}return Q},n=_&&_.__importDefault||function(d){return d&&d.__esModule?d:{default:d}},s;Object.defineProperty(r,"__esModule",{value:!0}),r.EmpheqConfiguration=r.EmpheqMethods=r.EmpheqBeginItem=void 0;var a=he,o=Gt,l=n(Ue()),u=n(Le),h=Nt,T=jT,f=function(d){t(p,d);function p(){return d!==null&&d.apply(this,arguments)||this}return Object.defineProperty(p.prototype,"kind",{get:function(){return"empheq-begin"},enumerable:!1,configurable:!0}),p.prototype.checkItem=function(m){return m.isKind("end")&&m.getName()===this.getName()&&this.setProperty("end",!1),d.prototype.checkItem.call(this,m)},p}(h.BeginItem);r.EmpheqBeginItem=f,r.EmpheqMethods={Empheq:function(d,p){if(d.stack.env.closing===p.getName()){delete d.stack.env.closing,d.Push(d.itemFactory.create("end").setProperty("name",d.stack.global.empheq)),d.stack.global.empheq="";var m=d.stack.Top();T.EmpheqUtil.adjustTable(m,d),d.Push(d.itemFactory.create("end").setProperty("name","empheq"))}else{l.default.checkEqnEnv(d),delete d.stack.global.eqnenv;var y=d.GetBrackets("\\begin{"+p.getName()+"}")||"",c=e((d.GetArgument("\\begin{"+p.getName()+"}")||"").split(/=/),2),Q=c[0],g=c[1];if(!T.EmpheqUtil.checkEnv(Q))throw new u.default("UnknownEnv",'Unknown environment "%1"',Q);y&&p.setProperties(T.EmpheqUtil.splitOptions(y,{left:1,right:1})),d.stack.global.empheq=Q,d.string="\\begin{"+Q+"}"+(g?"{"+g+"}":"")+d.string.slice(d.i),d.i=0,d.Push(p)}},EmpheqMO:function(d,p,m){d.Push(d.create("token","mo",{},m))},EmpheqDelim:function(d,p){var m=d.GetDelimiter(p);d.Push(d.create("token","mo",{stretchy:!0,symmetric:!0},m))}},new o.EnvironmentMap("empheq-env",T.EmpheqUtil.environment,{empheq:["Empheq","empheq"]},r.EmpheqMethods),new o.CommandMap("empheq-macros",{empheqlbrace:["EmpheqMO","{"],empheqrbrace:["EmpheqMO","}"],empheqlbrack:["EmpheqMO","["],empheqrbrack:["EmpheqMO","]"],empheqlangle:["EmpheqMO","⟨"],empheqrangle:["EmpheqMO","⟩"],empheqlparen:["EmpheqMO","("],empheqrparen:["EmpheqMO",")"],empheqlvert:["EmpheqMO","|"],empheqrvert:["EmpheqMO","|"],empheqlVert:["EmpheqMO","‖"],empheqrVert:["EmpheqMO","‖"],empheqlfloor:["EmpheqMO","⌊"],empheqrfloor:["EmpheqMO","⌋"],empheqlceil:["EmpheqMO","⌈"],empheqrceil:["EmpheqMO","⌉"],empheqbiglbrace:["EmpheqMO","{"],empheqbigrbrace:["EmpheqMO","}"],empheqbiglbrack:["EmpheqMO","["],empheqbigrbrack:["EmpheqMO","]"],empheqbiglangle:["EmpheqMO","⟨"],empheqbigrangle:["EmpheqMO","⟩"],empheqbiglparen:["EmpheqMO","("],empheqbigrparen:["EmpheqMO",")"],empheqbiglvert:["EmpheqMO","|"],empheqbigrvert:["EmpheqMO","|"],empheqbiglVert:["EmpheqMO","‖"],empheqbigrVert:["EmpheqMO","‖"],empheqbiglfloor:["EmpheqMO","⌊"],empheqbigrfloor:["EmpheqMO","⌋"],empheqbiglceil:["EmpheqMO","⌈"],empheqbigrceil:["EmpheqMO","⌉"],empheql:"EmpheqDelim",empheqr:"EmpheqDelim",empheqbigl:"EmpheqDelim",empheqbigr:"EmpheqDelim"},r.EmpheqMethods),r.EmpheqConfiguration=a.Configuration.create("empheq",{handler:{macro:["empheq-macros"],environment:["empheq-env"]},items:(s={},s[f.prototype.kind]=f,s)})})(bR);var SR={},P7={},ER=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},AR=ER(H0),HR=Gt;new HR.CommandMap("Newcommand-macros",{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"},AR.default);var MR=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),wR=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),CR=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&MR(t,r,e);return wR(t,r),t},I_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},z9;Object.defineProperty(P7,"__esModule",{value:!0});P7.NewcommandConfiguration=void 0;var V_=he,yg=M0,wr=I_(t6),vg=I_(h3),W9=CR(Gt),DR=function(r){new W9.DelimiterMap(wr.default.NEW_DELIMITER,vg.default.delimiter,{}),new W9.CommandMap(wr.default.NEW_COMMAND,{},{}),new W9.EnvironmentMap(wr.default.NEW_ENVIRONMENT,vg.default.environment,{},{}),r.append(V_.Configuration.local({handler:{character:[],delimiter:[wr.default.NEW_DELIMITER],macro:[wr.default.NEW_DELIMITER,wr.default.NEW_COMMAND],environment:[wr.default.NEW_ENVIRONMENT]},priority:-1}))};P7.NewcommandConfiguration=V_.Configuration.create("newcommand",{handler:{macro:["Newcommand-macros"]},items:(z9={},z9[yg.BeginEnvItem.prototype.kind]=yg.BeginEnvItem,z9),options:{maxMacros:1e3},init:DR});(function(r){var t=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(r,"__esModule",{value:!0}),r.ExtpfeilConfiguration=r.ExtpfeilMethods=void 0;var e=he,n=Gt,s=Yn,a=t(t6),o=P7,l=t(Le);r.ExtpfeilMethods={},r.ExtpfeilMethods.xArrow=s.AmsMethods.xArrow,r.ExtpfeilMethods.NewExtArrow=function(h,T){var f=h.GetArgument(T),d=h.GetArgument(T),p=h.GetArgument(T);if(!f.match(/^\\([a-z]+|.)$/i))throw new l.default("NewextarrowArg1","First argument to %1 must be a control sequence name",T);if(!d.match(/^(\d+),(\d+)$/))throw new l.default("NewextarrowArg2","Second argument to %1 must be two integers separated by a comma",T);if(!p.match(/^(\d+|0x[0-9A-F]+)$/i))throw new l.default("NewextarrowArg3","Third argument to %1 must be a unicode character number",T);f=f.substr(1);var m=d.split(",");a.default.addMacro(h,f,r.ExtpfeilMethods.xArrow,[parseInt(p),parseInt(m[0]),parseInt(m[1])])},new n.CommandMap("extpfeil",{xtwoheadrightarrow:["xArrow",8608,12,16],xtwoheadleftarrow:["xArrow",8606,17,13],xmapsto:["xArrow",8614,6,7],xlongequal:["xArrow",61,7,7],xtofrom:["xArrow",8644,12,12],Newextarrow:"NewExtArrow"},r.ExtpfeilMethods);var u=function(h){o.NewcommandConfiguration.init(h)};r.ExtpfeilConfiguration=e.Configuration.create("extpfeil",{handler:{macro:["extpfeil"]},init:u})})(SR);var ZT={};Object.defineProperty(ZT,"__esModule",{value:!0});ZT.GensymbConfiguration=void 0;var OR=he,IR=q1,VR=Gt;function PR(r,t){var e=t.attributes||{};e.mathvariant=IR.TexConstant.Variant.NORMAL,e.class="MathML-Unit";var n=r.create("token","mi",e,t.char);r.Push(n)}new VR.CharacterMap("gensymb-symbols",PR,{ohm:"Ω",degree:"°",celsius:"℃",perthousand:"‰",micro:"µ"});ZT.GensymbConfiguration=OR.Configuration.create("gensymb",{handler:{macro:["gensymb-symbols"]}});var KT={},XT={},kR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(XT,"__esModule",{value:!0});var V3=kR(Ne),w0={};w0.Href=function(r,t){var e=r.GetArgument(t),n=k7(r,t);V3.default.setAttribute(n,"href",e),r.Push(n)};w0.Class=function(r,t){var e=r.GetArgument(t),n=k7(r,t),s=V3.default.getAttribute(n,"class");s&&(e=s+" "+e),V3.default.setAttribute(n,"class",e),r.Push(n)};w0.Style=function(r,t){var e=r.GetArgument(t),n=k7(r,t),s=V3.default.getAttribute(n,"style");s&&(e.charAt(e.length-1)!==";"&&(e+=";"),e=s+" "+e),V3.default.setAttribute(n,"style",e),r.Push(n)};w0.Id=function(r,t){var e=r.GetArgument(t),n=k7(r,t);V3.default.setAttribute(n,"id",e),r.Push(n)};var k7=function(r,t){var e=r.ParseArg(t);if(!V3.default.isInferred(e))return e;var n=V3.default.getChildren(e);if(n.length===1)return n[0];var s=r.create("node","mrow");return V3.default.copyChildren(e,s),V3.default.copyAttributes(e,s),s};XT.default=w0;var RR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(KT,"__esModule",{value:!0});KT.HtmlConfiguration=void 0;var BR=he,FR=Gt,NR=RR(XT);new FR.CommandMap("html_macros",{href:"Href",class:"Class",style:"Style",cssId:"Id"},NR.default);KT.HtmlConfiguration=BR.Configuration.create("html",{handler:{macro:["html_macros"]}});var q9={},Z9={},K9={},x6={},Lg;function P_(){if(Lg)return x6;Lg=1;var r=_&&_.__read||function(T,f){var d=typeof Symbol=="function"&&T[Symbol.iterator];if(!d)return T;var p=d.call(T),m,y=[],c;try{for(;(f===void 0||f-- >0)&&!(m=p.next()).done;)y.push(m.value)}catch(Q){c={error:Q}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(c)throw c.error}}return y},t=_&&_.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(x6,"__esModule",{value:!0}),x6.MathtoolsUtil=void 0;var e=Nt,n=t(Ue()),s=t(t2()),a=t(Le),o=s3,l=H1,u=k_(),h=R_();return x6.MathtoolsUtil={setDisplayLevel:function(T,f){if(f){var d=r((0,l.lookup)(f,{"\\displaystyle":[!0,0],"\\textstyle":[!1,0],"\\scriptstyle":[!1,1],"\\scriptscriptstyle":[!1,2]},[null,null]),2),p=d[0],m=d[1];p!==null&&(T.attributes.set("displaystyle",p),T.attributes.set("scriptlevel",m))}},checkAlignment:function(T,f){var d=T.stack.Top();if(d.kind!==e.EqnArrayItem.prototype.kind)throw new a.default("NotInAlignment","%1 can only be used in aligment environments",f);return d},addPairedDelims:function(T,f,d){var p=T.handlers.retrieve(h.PAIREDDELIMS);p.add(f,new o.Macro(f,u.MathtoolsMethods.PairedDelimiters,d))},spreadLines:function(T,f){if(T.isKind("mtable")){var d=T.attributes.get("rowspacing");if(d){var p=n.default.dimen2em(f);d=d.split(/ /).map(function(m){return n.default.Em(Math.max(0,n.default.dimen2em(m)+p))}).join(" ")}else d=f;T.attributes.set("rowspacing",d)}},plusOrMinus:function(T,f){if(f=f.trim(),!f.match(/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)$/))throw new a.default("NotANumber","Argument to %1 is not a number",T);return f.match(/^[-+]/)?f:"+"+f},getScript:function(T,f,d){var p=n.default.trimSpaces(T.GetArgument(f));if(p==="")return T.create("node","none");var m=T.options.mathtools["prescript-".concat(d,"-format")];return m&&(p="".concat(m,"{").concat(p,"}")),new s.default(p,T.stack.env,T.configuration).mml()}},x6}var xg;function k_(){return xg||(xg=1,function(r){var t=_&&_.__assign||function(){return t=Object.assign||function(Q){for(var g,v=1,L=arguments.length;v<L;v++){g=arguments[v];for(var x in g)Object.prototype.hasOwnProperty.call(g,x)&&(Q[x]=g[x])}return Q},t.apply(this,arguments)},e=_&&_.__read||function(Q,g){var v=typeof Symbol=="function"&&Q[Symbol.iterator];if(!v)return Q;var L=v.call(Q),x,b=[],S;try{for(;(g===void 0||g-- >0)&&!(x=L.next()).done;)b.push(x.value)}catch(E){S={error:E}}finally{try{x&&!x.done&&(v=L.return)&&v.call(L)}finally{if(S)throw S.error}}return b},n=_&&_.__values||function(Q){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&Q[g],L=0;if(v)return v.call(Q);if(Q&&typeof Q.length=="number")return{next:function(){return Q&&L>=Q.length&&(Q=void 0),{value:Q&&Q[L++],done:!Q}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")},s=_&&_.__importDefault||function(Q){return Q&&Q.__esModule?Q:{default:Q}};Object.defineProperty(r,"__esModule",{value:!0}),r.MathtoolsMethods=void 0;var a=s(Ue()),o=Yn,l=s(p2),u=s(t2()),h=s(Le),T=s(Ne),f=jt,d=G3,p=H1,m=s(t6),y=s(H0),c=P_();r.MathtoolsMethods={MtMatrix:function(Q,g,v,L){var x=Q.GetBrackets("\\begin{".concat(g.getName(),"}"),"c");return r.MathtoolsMethods.Array(Q,g,v,L,x)},MtSmallMatrix:function(Q,g,v,L,x){return x||(x=Q.GetBrackets("\\begin{".concat(g.getName(),"}"),Q.options.mathtools["smallmatrix-align"])),r.MathtoolsMethods.Array(Q,g,v,L,x,a.default.Em(1/3),".2em","S",1)},MtMultlined:function(Q,g){var v,L="\\begin{".concat(g.getName(),"}"),x=Q.GetBrackets(L,Q.options.mathtools["multlined-pos"]||"c"),b=x?Q.GetBrackets(L,""):"";x&&!x.match(/^[cbt]$/)&&(v=e([x,b],2),b=v[0],x=v[1]),Q.Push(g);var S=Q.itemFactory.create("multlined",Q,g);return S.arraydef={displaystyle:!0,rowspacing:".5em",width:b||"auto",columnwidth:"100%"},a.default.setArrayAlign(S,x||"c")},HandleShove:function(Q,g,v){var L=Q.stack.Top();if(L.kind!=="multline"&&L.kind!=="multlined")throw new h.default("CommandInMultlined","%1 can only appear within the multline or multlined environments",g);if(L.Size())throw new h.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",g);L.setProperty("shove",v);var x=Q.GetBrackets(g),b=Q.ParseArg(g);if(x){var S=Q.create("node","mrow",[]),E=Q.create("node","mspace",[],{width:x});v==="left"?(S.appendChild(E),S.appendChild(b)):(S.appendChild(b),S.appendChild(E)),b=S}Q.Push(b)},SpreadLines:function(Q,g){var v,L;if(Q.stack.env.closing===g.getName()){delete Q.stack.env.closing;var x=Q.stack.Pop(),b=x.toMml(),S=x.getProperty("spread");if(b.isInferred)try{for(var E=n(T.default.getChildren(b)),A=E.next();!A.done;A=E.next()){var M=A.value;c.MathtoolsUtil.spreadLines(M,S)}}catch(D){v={error:D}}finally{try{A&&!A.done&&(L=E.return)&&L.call(E)}finally{if(v)throw v.error}}else c.MathtoolsUtil.spreadLines(b,S);Q.Push(b)}else{var S=Q.GetDimen("\\begin{".concat(g.getName(),"}"));g.setProperty("spread",S),Q.Push(g)}},Cases:function(Q,g,v,L,x){var b=Q.itemFactory.create("array").setProperty("casesEnv",g.getName());return b.arraydef={rowspacing:".2em",columnspacing:"1em",columnalign:"left"},x==="D"&&(b.arraydef.displaystyle=!0),b.setProperties({open:v,close:L}),Q.Push(g),b},MathLap:function(Q,g,v,L){var x=Q.GetBrackets(g,"").trim(),b=Q.create("node","mstyle",[Q.create("node","mpadded",[Q.ParseArg(g)],t({width:0},v==="r"?{}:{lspace:v==="l"?"-1width":"-.5width"}))],{"data-cramped":L});c.MathtoolsUtil.setDisplayLevel(b,x),Q.Push(Q.create("node","TeXAtom",[b]))},Cramped:function(Q,g){var v=Q.GetBrackets(g,"").trim(),L=Q.ParseArg(g),x=Q.create("node","mstyle",[L],{"data-cramped":!0});c.MathtoolsUtil.setDisplayLevel(x,v),Q.Push(x)},MtLap:function(Q,g,v){var L=a.default.internalMath(Q,Q.GetArgument(g),0),x=Q.create("node","mpadded",L,{width:0});v!=="r"&&T.default.setAttribute(x,"lspace",v==="l"?"-1width":"-.5width"),Q.Push(x)},MathMakeBox:function(Q,g){var v=Q.GetBrackets(g),L=Q.GetBrackets(g,"c"),x=Q.create("node","mpadded",[Q.ParseArg(g)]);v&&T.default.setAttribute(x,"width",v);var b=(0,p.lookup)(L,{c:"center",r:"right"},"");b&&T.default.setAttribute(x,"data-align",b),Q.Push(x)},MathMBox:function(Q,g){Q.Push(Q.create("node","mrow",[Q.ParseArg(g)]))},UnderOverBracket:function(Q,g){var v=(0,d.length2em)(Q.GetBrackets(g,".1em"),.1),L=Q.GetBrackets(g,".2em"),x=Q.GetArgument(g),b=e(g.charAt(1)==="o"?["over","accent","bottom"]:["under","accentunder","top"],3),S=b[0],E=b[1],A=b[2],M=(0,d.em)(v),D=new u.default(x,Q.stack.env,Q.configuration).mml(),I=new u.default(x,Q.stack.env,Q.configuration).mml(),P=Q.create("node","mpadded",[Q.create("node","mphantom",[I])],{style:"border: ".concat(M," solid; border-").concat(A,": none"),height:L,depth:0}),R=a.default.underOver(Q,D,P,S,!0),F=T.default.getChildAt(T.default.getChildAt(R,0),0);T.default.setAttribute(F,E,!0),Q.Push(R)},Aboxed:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.row.length%2===1&&v.row.push(Q.create("node","mtd",[]));var L=Q.GetArgument(g),x=Q.string.substr(Q.i);Q.string=L+"&&\\endAboxed",Q.i=0;var b=Q.GetUpTo(g,"&"),S=Q.GetUpTo(g,"&");Q.GetUpTo(g,"\\endAboxed");var E=a.default.substituteArgs(Q,[b,S],"\\rlap{\\boxed{#1{}#2}}\\kern.267em\\phantom{#1}&\\phantom{{}#2}\\kern.267em");Q.string=E+x,Q.i=0},ArrowBetweenLines:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);if(v.Size()||v.row.length)throw new h.default("BetweenLines","%1 must be on a row by itself",g);var L=Q.GetStar(),x=Q.GetBrackets(g,"\\Updownarrow");L&&(v.EndEntry(),v.EndEntry());var b=L?"\\quad"+x:x+"\\quad",S=new u.default(b,Q.stack.env,Q.configuration).mml();Q.Push(S),v.EndEntry(),v.EndRow()},VDotsWithin:function(Q,g){var v=Q.stack.Top(),L=v.getProperty("flushspaceabove")===v.table.length,x="\\mmlToken{mi}{}"+Q.GetArgument(g)+"\\mmlToken{mi}{}",b=new u.default(x,Q.stack.env,Q.configuration).mml(),S=Q.create("node","mpadded",[Q.create("node","mpadded",[Q.create("node","mo",[Q.create("text","⋮")])],t({width:0,lspace:"-.5width"},L?{height:"-.6em",voffset:"-.18em"}:{})),Q.create("node","mphantom",[b])],{lspace:".5width"});Q.Push(S)},ShortVDotsWithin:function(Q,g){var v=Q.stack.Top(),L=Q.GetStar();r.MathtoolsMethods.FlushSpaceAbove(Q,"\\MTFlushSpaceAbove"),!L&&v.EndEntry(),r.MathtoolsMethods.VDotsWithin(Q,"\\vdotswithin"),L&&v.EndEntry(),r.MathtoolsMethods.FlushSpaceBelow(Q,"\\MTFlushSpaceBelow")},FlushSpaceAbove:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.setProperty("flushspaceabove",v.table.length),v.addRowSpacing("-"+Q.options.mathtools.shortvdotsadjustabove)},FlushSpaceBelow:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.Size()&&v.EndEntry(),v.EndRow(),v.addRowSpacing("-"+Q.options.mathtools.shortvdotsadjustbelow)},PairedDelimiters:function(Q,g,v,L,x,b,S,E){x===void 0&&(x="#1"),b===void 0&&(b=1),S===void 0&&(S=""),E===void 0&&(E="");var A=Q.GetStar(),M=A?"":Q.GetBrackets(g),D=e(A?["\\left","\\right"]:M?[M+"l",M+"r"]:["",""],2),I=D[0],P=D[1],R=A?"\\middle":M||"";if(b){for(var F=[],X=F.length;X<b;X++)F.push(Q.GetArgument(g));S=a.default.substituteArgs(Q,F,S),x=a.default.substituteArgs(Q,F,x),E=a.default.substituteArgs(Q,F,E)}x=x.replace(/\\delimsize/g,R),Q.string=[S,I,v,x,P,L,E,Q.string.substr(Q.i)].reduce(function(st,rt){return a.default.addArgs(Q,st,rt)},""),Q.i=0,a.default.checkMaxMacros(Q)},DeclarePairedDelimiter:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=Q.GetArgument(g),x=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[L,x])},DeclarePairedDelimiterX:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=m.default.GetArgCount(Q,g),x=Q.GetArgument(g),b=Q.GetArgument(g),S=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[x,b,S,L])},DeclarePairedDelimiterXPP:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=m.default.GetArgCount(Q,g),x=Q.GetArgument(g),b=Q.GetArgument(g),S=Q.GetArgument(g),E=Q.GetArgument(g),A=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[b,S,A,L,x,E])},CenterColon:function(Q,g,v,L,x){L===void 0&&(L=!1),x===void 0&&(x=!1);var b=Q.options.mathtools,S=Q.create("token","mo",{},":");if(v&&(b.centercolon||L)){var E=b["centercolon-offset"];S=Q.create("node","mpadded",[S],t({voffset:E,height:"+".concat(E),depth:"-".concat(E)},x?{width:b["thincolon-dw"],lspace:b["thincolon-dx"]}:{}))}Q.Push(S)},Relation:function(Q,g,v,L){var x=Q.options.mathtools;x["use-unicode"]&&L?Q.Push(Q.create("token","mo",{texClass:f.TEXCLASS.REL},L)):(v="\\mathrel{"+v.replace(/:/g,"\\MTThinColon").replace(/-/g,"\\mathrel{-}")+"}",Q.string=a.default.addArgs(Q,v,Q.string.substr(Q.i)),Q.i=0)},NArrow:function(Q,g,v,L){Q.Push(Q.create("node","TeXAtom",[Q.create("token","mtext",{},v),Q.create("node","mpadded",[Q.create("node","mpadded",[Q.create("node","menclose",[Q.create("node","mspace",[],{height:".2em",depth:0,width:".4em"})],{notation:"updiagonalstrike","data-thickness":".05em","data-padding":0})],{width:0,lspace:"-.5width",voffset:L}),Q.create("node","mphantom",[Q.create("token","mtext",{},v)])],{width:0,lspace:"-.5width"})],{texClass:f.TEXCLASS.REL}))},SplitFrac:function(Q,g,v){var L=Q.ParseArg(g),x=Q.ParseArg(g);Q.Push(Q.create("node","mstyle",[Q.create("node","mfrac",[Q.create("node","mstyle",[L,Q.create("token","mi"),Q.create("token","mspace",{width:"1em"})],{scriptlevel:0}),Q.create("node","mstyle",[Q.create("token","mspace",{width:"1em"}),Q.create("token","mi"),x],{scriptlevel:0})],{linethickness:0,numalign:"left",denomalign:"right"})],{displaystyle:v,scriptlevel:0}))},XMathStrut:function(Q,g){var v=Q.GetBrackets(g),L=Q.GetArgument(g);L=c.MathtoolsUtil.plusOrMinus(g,L),v=c.MathtoolsUtil.plusOrMinus(g,v||L),Q.Push(Q.create("node","TeXAtom",[Q.create("node","mpadded",[Q.create("node","mphantom",[Q.create("token","mo",{stretchy:!1},"(")])],{width:0,height:L+"height",depth:v+"depth"})],{texClass:f.TEXCLASS.ORD}))},Prescript:function(Q,g){var v=c.MathtoolsUtil.getScript(Q,g,"sup"),L=c.MathtoolsUtil.getScript(Q,g,"sub"),x=c.MathtoolsUtil.getScript(Q,g,"arg");if(T.default.isType(v,"none")&&T.default.isType(L,"none")){Q.Push(x);return}var b=Q.create("node","mmultiscripts",[x]);T.default.getChildren(b).push(null,null),T.default.appendChildren(b,[Q.create("node","mprescripts"),L,v]),b.setProperty("fixPrescript",!0),Q.Push(b)},NewTagForm:function(Q,g,v){v===void 0&&(v=!1);var L=Q.tags;if(!("mtFormats"in L))throw new h.default("TagsNotMT","%1 can only be used with ams or mathtools tags",g);var x=Q.GetArgument(g).trim();if(!x)throw new h.default("InvalidTagFormID","Tag form name can't be empty");var b=Q.GetBrackets(g,""),S=Q.GetArgument(g),E=Q.GetArgument(g);if(!v&&L.mtFormats.has(x))throw new h.default("DuplicateTagForm","Duplicate tag form: %1",x);L.mtFormats.set(x,[S,E,b])},UseTagForm:function(Q,g){var v=Q.tags;if(!("mtFormats"in v))throw new h.default("TagsNotMT","%1 can only be used with ams or mathtools tags",g);var L=Q.GetArgument(g).trim();if(!L){v.mtCurrent=null;return}if(!v.mtFormats.has(L))throw new h.default("UndefinedTagForm","Undefined tag form: %1",L);v.mtCurrent=v.mtFormats.get(L)},SetOptions:function(Q,g){var v,L,x=Q.options.mathtools;if(!x["allow-mathtoolsset"])throw new h.default("ForbiddenMathtoolsSet","%1 is disabled",g);var b={};Object.keys(x).forEach(function(I){I!=="pariedDelimiters"&&I!=="tagforms"&&I!=="allow-mathtoolsset"&&(b[I]=1)});var S=Q.GetArgument(g),E=a.default.keyvalOptions(S,b,!0);try{for(var A=n(Object.keys(E)),M=A.next();!M.done;M=A.next()){var D=M.value;x[D]=E[D]}}catch(I){v={error:I}}finally{try{M&&!M.done&&(L=A.return)&&L.call(A)}finally{if(v)throw v.error}}},Array:l.default.Array,Macro:l.default.Macro,xArrow:o.AmsMethods.xArrow,HandleRef:o.AmsMethods.HandleRef,AmsEqnArray:o.AmsMethods.AmsEqnArray,MacroWithTemplate:y.default.MacroWithTemplate}}(K9)),K9}var _g;function UR(){if(_g)return Z9;_g=1;var r=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Z9,"__esModule",{value:!0});var t=r(h3),e=Gt,n=q1,s=k_();return new e.CommandMap("mathtools-macros",{shoveleft:["HandleShove",n.TexConstant.Align.LEFT],shoveright:["HandleShove",n.TexConstant.Align.RIGHT],xleftrightarrow:["xArrow",8596,10,10],xLeftarrow:["xArrow",8656,12,7],xRightarrow:["xArrow",8658,7,12],xLeftrightarrow:["xArrow",8660,12,12],xhookleftarrow:["xArrow",8617,10,5],xhookrightarrow:["xArrow",8618,5,10],xmapsto:["xArrow",8614,10,10],xrightharpoondown:["xArrow",8641,5,10],xleftharpoondown:["xArrow",8637,10,5],xrightleftharpoons:["xArrow",8652,10,10],xrightharpoonup:["xArrow",8640,5,10],xleftharpoonup:["xArrow",8636,10,5],xleftrightharpoons:["xArrow",8651,10,10],mathllap:["MathLap","l",!1],mathrlap:["MathLap","r",!1],mathclap:["MathLap","c",!1],clap:["MtLap","c"],textllap:["MtLap","l"],textrlap:["MtLap","r"],textclap:["MtLap","c"],cramped:"Cramped",crampedllap:["MathLap","l",!0],crampedrlap:["MathLap","r",!0],crampedclap:["MathLap","c",!0],crampedsubstack:["Macro","\\begin{crampedsubarray}{c}#1\\end{crampedsubarray}",1],mathmbox:"MathMBox",mathmakebox:"MathMakeBox",overbracket:"UnderOverBracket",underbracket:"UnderOverBracket",refeq:"HandleRef",MoveEqLeft:["Macro","\\hspace{#1em}&\\hspace{-#1em}",1,"2"],Aboxed:"Aboxed",ArrowBetweenLines:"ArrowBetweenLines",vdotswithin:"VDotsWithin",shortvdotswithin:"ShortVDotsWithin",MTFlushSpaceAbove:"FlushSpaceAbove",MTFlushSpaceBelow:"FlushSpaceBelow",DeclarePairedDelimiter:"DeclarePairedDelimiter",DeclarePairedDelimiterX:"DeclarePairedDelimiterX",DeclarePairedDelimiterXPP:"DeclarePairedDelimiterXPP",DeclarePairedDelimiters:"DeclarePairedDelimiter",DeclarePairedDelimitersX:"DeclarePairedDelimiterX",DeclarePairedDelimitersXPP:"DeclarePairedDelimiterXPP",centercolon:["CenterColon",!0,!0],ordinarycolon:["CenterColon",!1],MTThinColon:["CenterColon",!0,!0,!0],coloneqq:["Relation",":=","≔"],Coloneqq:["Relation","::=","⩴"],coloneq:["Relation",":-"],Coloneq:["Relation","::-"],eqqcolon:["Relation","=:","≕"],Eqqcolon:["Relation","=::"],eqcolon:["Relation","-:","∹"],Eqcolon:["Relation","-::"],colonapprox:["Relation",":\\approx"],Colonapprox:["Relation","::\\approx"],colonsim:["Relation",":\\sim"],Colonsim:["Relation","::\\sim"],dblcolon:["Relation","::","∷"],nuparrow:["NArrow","↑",".06em"],ndownarrow:["NArrow","↓",".25em"],bigtimes:["Macro","\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}"],splitfrac:["SplitFrac",!1],splitdfrac:["SplitFrac",!0],xmathstrut:"XMathStrut",prescript:"Prescript",newtagform:["NewTagForm",!1],renewtagform:["NewTagForm",!0],usetagform:"UseTagForm",adjustlimits:["MacroWithTemplate","\\mathop{{#1}\\vphantom{{#3}}}_{{#2}\\vphantom{{#4}}}\\mathop{{#3}\\vphantom{{#1}}}_{{#4}\\vphantom{{#2}}}",4,,"_",,"_"],mathtoolsset:"SetOptions"},s.MathtoolsMethods),new e.EnvironmentMap("mathtools-environments",t.default.environment,{dcases:["Array",null,"\\{","","ll",null,".2em","D"],rcases:["Array",null,"","\\}","ll",null,".2em"],drcases:["Array",null,"","\\}","ll",null,".2em","D"],"dcases*":["Cases",null,"{","","D"],"rcases*":["Cases",null,"","}"],"drcases*":["Cases",null,"","}","D"],"cases*":["Cases",null,"{",""],"matrix*":["MtMatrix",null,null,null],"pmatrix*":["MtMatrix",null,"(",")"],"bmatrix*":["MtMatrix",null,"[","]"],"Bmatrix*":["MtMatrix",null,"\\{","\\}"],"vmatrix*":["MtMatrix",null,"\\vert","\\vert"],"Vmatrix*":["MtMatrix",null,"\\Vert","\\Vert"],"smallmatrix*":["MtSmallMatrix",null,null,null],psmallmatrix:["MtSmallMatrix",null,"(",")","c"],"psmallmatrix*":["MtSmallMatrix",null,"(",")"],bsmallmatrix:["MtSmallMatrix",null,"[","]","c"],"bsmallmatrix*":["MtSmallMatrix",null,"[","]"],Bsmallmatrix:["MtSmallMatrix",null,"\\{","\\}","c"],"Bsmallmatrix*":["MtSmallMatrix",null,"\\{","\\}"],vsmallmatrix:["MtSmallMatrix",null,"\\vert","\\vert","c"],"vsmallmatrix*":["MtSmallMatrix",null,"\\vert","\\vert"],Vsmallmatrix:["MtSmallMatrix",null,"\\Vert","\\Vert","c"],"Vsmallmatrix*":["MtSmallMatrix",null,"\\Vert","\\Vert"],crampedsubarray:["Array",null,null,null,null,"0em","0.1em","S'",1],multlined:"MtMultlined",spreadlines:["SpreadLines",!0],lgathered:["AmsEqnArray",null,null,null,"l",null,".5em","D"],rgathered:["AmsEqnArray",null,null,null,"r",null,".5em","D"]},s.MathtoolsMethods),new e.DelimiterMap("mathtools-delimiters",t.default.delimiter,{"\\lparen":"(","\\rparen":")"}),new e.CommandMap("mathtools-characters",{":":["CenterColon",!0]},s.MathtoolsMethods),Z9}var R7={},jR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),GR=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zR=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},WR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(R7,"__esModule",{value:!0});R7.MathtoolsTagFormat=void 0;var qR=WR(Le),X9=Hi,bg=0;function ZR(r,t){var e=t.parseOptions.options.tags;e!=="base"&&r.tags.hasOwnProperty(e)&&X9.TagsFactory.add(e,r.tags[e]);var n=X9.TagsFactory.create(t.parseOptions.options.tags).constructor,s=function(o){jR(l,o);function l(){var u,h,T=o.call(this)||this;T.mtFormats=new Map,T.mtCurrent=null;var f=t.parseOptions.options.mathtools.tagforms;try{for(var d=GR(Object.keys(f)),p=d.next();!p.done;p=d.next()){var m=p.value;if(!Array.isArray(f[m])||f[m].length!==3)throw new qR.default("InvalidTagFormDef",'The tag form definition for "%1" should be an array fo three strings',m);T.mtFormats.set(m,f[m])}}catch(y){u={error:y}}finally{try{p&&!p.done&&(h=d.return)&&h.call(d)}finally{if(u)throw u.error}}return T}return l.prototype.formatTag=function(u){if(this.mtCurrent){var h=zR(this.mtCurrent,3),T=h[0],f=h[1],d=h[2];return d?"".concat(T).concat(d,"{").concat(u,"}").concat(f):"".concat(T).concat(u).concat(f)}return o.prototype.formatTag.call(this,u)},l}(n);bg++;var a="MathtoolsTags-"+bg;X9.TagsFactory.add(a,s),t.parseOptions.options.tags=a}R7.MathtoolsTagFormat=ZR;var B7={},KR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),XR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B7,"__esModule",{value:!0});B7.MultlinedItem=void 0;var $R=o4,I4=XR(Ne),Sg=q1,YR=function(r){KR(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"multlined"},enumerable:!1,configurable:!0}),t.prototype.EndTable=function(){if((this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.table.length>1){var e=this.factory.configuration.options.mathtools,n=e.multlinegap,s=e["firstline-afterskip"]||n,a=e["lastline-preskip"]||n,o=I4.default.getChildren(this.table[0])[0];I4.default.getAttribute(o,"columnalign")!==Sg.TexConstant.Align.RIGHT&&o.appendChild(this.create("node","mspace",[],{width:s}));var l=I4.default.getChildren(this.table[this.table.length-1])[0];if(I4.default.getAttribute(l,"columnalign")!==Sg.TexConstant.Align.LEFT){var u=I4.default.getChildren(l)[0];u.childNodes.unshift(null);var h=this.create("node","mspace",[],{width:a});I4.default.setChild(u,0,h)}}r.prototype.EndTable.call(this)},t}($R.MultlineItem);B7.MultlinedItem=YR;var Eg;function R_(){return Eg||(Eg=1,function(r){var t=_&&_.__values||function(m){var y=typeof Symbol=="function"&&Symbol.iterator,c=y&&m[y],Q=0;if(c)return c.call(m);if(m&&typeof m.length=="number")return{next:function(){return m&&Q>=m.length&&(m=void 0),{value:m&&m[Q++],done:!m}}};throw new TypeError(y?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(m){return m&&m.__esModule?m:{default:m}},n;Object.defineProperty(r,"__esModule",{value:!0}),r.MathtoolsConfiguration=r.fixPrescripts=r.PAIREDDELIMS=void 0;var s=he,a=Gt,o=e(Ne),l=H1;UR();var u=P_(),h=R7,T=B7;r.PAIREDDELIMS="mathtools-paired-delims";function f(m){new a.CommandMap(r.PAIREDDELIMS,{},{}),m.append(s.Configuration.local({handler:{macro:[r.PAIREDDELIMS]},priority:-5}))}function d(m,y){var c,Q,g=y.parseOptions,v=g.options.mathtools.pairedDelimiters;try{for(var L=t(Object.keys(v)),x=L.next();!x.done;x=L.next()){var b=x.value;u.MathtoolsUtil.addPairedDelims(g,b,v[b])}}catch(S){c={error:S}}finally{try{x&&!x.done&&(Q=L.return)&&Q.call(L)}finally{if(c)throw c.error}}(0,h.MathtoolsTagFormat)(m,y)}function p(m){var y,c,Q,g,v,L,x=m.data;try{for(var b=t(x.getList("mmultiscripts")),S=b.next();!S.done;S=b.next()){var E=S.value;if(E.getProperty("fixPrescript")){var A=o.default.getChildren(E),M=0;try{for(var D=(Q=void 0,t([1,2])),I=D.next();!I.done;I=D.next()){var P=I.value;A[P]||(o.default.setChild(E,P,x.nodeFactory.create("node","none")),M++)}}catch(X){Q={error:X}}finally{try{I&&!I.done&&(g=D.return)&&g.call(D)}finally{if(Q)throw Q.error}}try{for(var R=(v=void 0,t([4,5])),F=R.next();!F.done;F=R.next()){var P=F.value;o.default.isType(A[P],"mrow")&&o.default.getChildren(A[P]).length===0&&o.default.setChild(E,P,x.nodeFactory.create("node","none"))}}catch(X){v={error:X}}finally{try{F&&!F.done&&(L=R.return)&&L.call(R)}finally{if(v)throw v.error}}M===2&&A.splice(1,2)}}}catch(X){y={error:X}}finally{try{S&&!S.done&&(c=b.return)&&c.call(b)}finally{if(y)throw y.error}}}r.fixPrescripts=p,r.MathtoolsConfiguration=s.Configuration.create("mathtools",{handler:{macro:["mathtools-macros","mathtools-delimiters"],environment:["mathtools-environments"],delimiter:["mathtools-delimiters"],character:["mathtools-characters"]},items:(n={},n[T.MultlinedItem.prototype.kind]=T.MultlinedItem,n),init:f,config:d,postprocessors:[[p,-6]],options:{mathtools:{multlinegap:"1em","multlined-pos":"c","firstline-afterskip":"","lastline-preskip":"","smallmatrix-align":"c",shortvdotsadjustabove:".2em",shortvdotsadjustbelow:".2em",centercolon:!1,"centercolon-offset":".04em","thincolon-dx":"-.04em","thincolon-dw":"-.08em","use-unicode":!1,"prescript-sub-format":"","prescript-sup-format":"","prescript-arg-format":"","allow-mathtoolsset":!0,pairedDelimiters:(0,l.expandable)({}),tagforms:(0,l.expandable)({})}}})}(q9)),q9}var $T={},F7={};/*!
121
+ ]`},r}();b7.default=HV;var Zp;function e2(){if(Zp)return Os;Zp=1;var r=_&&_.__values||function(h){var T=typeof Symbol=="function"&&Symbol.iterator,f=T&&h[T],d=0;if(f)return f.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&d>=h.length&&(h=void 0),{value:h&&h[d++],done:!h}}};throw new TypeError(T?"Object is not iterable.":"Symbol.iterator is not defined.")},t=_&&_.__read||function(h,T){var f=typeof Symbol=="function"&&h[Symbol.iterator];if(!f)return h;var d=f.call(h),p,m=[],y;try{for(;(T===void 0||T-- >0)&&!(p=d.next()).done;)m.push(p.value)}catch(c){y={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(y)throw y.error}}return m},e=_&&_.__spreadArray||function(h,T,f){if(f||arguments.length===2)for(var d=0,p=T.length,m;d<p;d++)(m||!(d in T))&&(m||(m=Array.prototype.slice.call(T,0,d)),m[d]=T[d]);return h.concat(m||Array.prototype.slice.call(T))},n=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(Os,"__esModule",{value:!0});var s=n(Ue()),a=n(b7),o=n(Le),l=jt,u=function(){function h(T,f,d){var p,m;this._string=T,this.configuration=d,this.macroCount=0,this.i=0,this.currentCS="";var y=f.hasOwnProperty("isInner"),c=f.isInner;delete f.isInner;var Q;if(f){Q={};try{for(var g=r(Object.keys(f)),v=g.next();!v.done;v=g.next()){var L=v.value;Q[L]=f[L]}}catch(x){p={error:x}}finally{try{v&&!v.done&&(m=g.return)&&m.call(g)}finally{if(p)throw p.error}}}this.configuration.pushParser(this),this.stack=new a.default(this.itemFactory,Q,y?c:!0),this.Parse(),this.Push(this.itemFactory.create("stop"))}return Object.defineProperty(h.prototype,"options",{get:function(){return this.configuration.options},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"itemFactory",{get:function(){return this.configuration.itemFactory},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"tags",{get:function(){return this.configuration.tags},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"string",{get:function(){return this._string},set:function(T){this._string=T},enumerable:!1,configurable:!0}),h.prototype.parse=function(T,f){return this.configuration.handlers.get(T).parse(f)},h.prototype.lookup=function(T,f){return this.configuration.handlers.get(T).lookup(f)},h.prototype.contains=function(T,f){return this.configuration.handlers.get(T).contains(f)},h.prototype.toString=function(){var T,f,d="";try{for(var p=r(Array.from(this.configuration.handlers.keys())),m=p.next();!m.done;m=p.next()){var y=m.value;d+=y+": "+this.configuration.handlers.get(y)+`
122
+ `}}catch(c){T={error:c}}finally{try{m&&!m.done&&(f=p.return)&&f.call(p)}finally{if(T)throw T.error}}return d},h.prototype.Parse=function(){for(var T;this.i<this.string.length;)T=this.getCodePoint(),this.i+=T.length,this.parse("character",[this,T])},h.prototype.Push=function(T){T instanceof l.AbstractMmlNode&&T.isInferred?this.PushAll(T.childNodes):this.stack.Push(T)},h.prototype.PushAll=function(T){var f,d;try{for(var p=r(T),m=p.next();!m.done;m=p.next()){var y=m.value;this.stack.Push(y)}}catch(c){f={error:c}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(f)throw f.error}}},h.prototype.mml=function(){if(!this.stack.Top().isKind("mml"))return null;var T=this.stack.Top().First;return this.configuration.popParser(),T},h.prototype.convertDelimiter=function(T){var f=this.lookup("delimiter",T);return f?f.char:null},h.prototype.getCodePoint=function(){var T=this.string.codePointAt(this.i);return T===void 0?"":String.fromCodePoint(T)},h.prototype.nextIsSpace=function(){return!!this.string.charAt(this.i).match(/\s/)},h.prototype.GetNext=function(){for(;this.nextIsSpace();)this.i++;return this.getCodePoint()},h.prototype.GetCS=function(){var T=this.string.slice(this.i).match(/^(([a-z]+) ?|[\uD800-\uDBFF].|.)/i);return T?(this.i+=T[0].length,T[2]||T[1]):(this.i++," ")},h.prototype.GetArgument=function(T,f){switch(this.GetNext()){case"":if(!f)throw new o.default("MissingArgFor","Missing argument for %1",this.currentCS);return null;case"}":if(!f)throw new o.default("ExtraCloseMissingOpen","Extra close brace or missing open brace");return null;case"\\":return this.i++,"\\"+this.GetCS();case"{":for(var d=++this.i,p=1;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"\\":this.i++;break;case"{":p++;break;case"}":if(--p===0)return this.string.slice(d,this.i-1);break}throw new o.default("MissingCloseBrace","Missing close brace")}var m=this.getCodePoint();return this.i+=m.length,m},h.prototype.GetBrackets=function(T,f){if(this.GetNext()!=="[")return f;for(var d=++this.i,p=0;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"{":p++;break;case"\\":this.i++;break;case"}":if(p--<=0)throw new o.default("ExtraCloseLooking","Extra close brace while looking for %1","']'");break;case"]":if(p===0)return this.string.slice(d,this.i-1);break}throw new o.default("MissingCloseBracket","Could not find closing ']' for argument to %1",this.currentCS)},h.prototype.GetDelimiter=function(T,f){var d=this.GetNext();if(this.i+=d.length,this.i<=this.string.length&&(d==="\\"?d+=this.GetCS():d==="{"&&f&&(this.i--,d=this.GetArgument(T).trim()),this.contains("delimiter",d)))return this.convertDelimiter(d);throw new o.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},h.prototype.GetDimen=function(T){if(this.GetNext()==="{"){var f=this.GetArgument(T),d=t(s.default.matchDimen(f),2),p=d[0],m=d[1];if(p)return p+m}else{var f=this.string.slice(this.i),y=t(s.default.matchDimen(f,!0),3),p=y[0],m=y[1],c=y[2];if(p)return this.i+=c,p+m}throw new o.default("MissingDimOrUnits","Missing dimension or its units for %1",this.currentCS)},h.prototype.GetUpTo=function(T,f){for(;this.nextIsSpace();)this.i++;for(var d=this.i,p=0;this.i<this.string.length;){var m=this.i,y=this.GetNext();switch(this.i+=y.length,y){case"\\":y+=this.GetCS();break;case"{":p++;break;case"}":if(p===0)throw new o.default("ExtraCloseLooking","Extra close brace while looking for %1",f);p--;break}if(p===0&&y===f)return this.string.slice(d,m)}throw new o.default("TokenNotFoundForCommand","Could not find %1 for %2",f,this.currentCS)},h.prototype.ParseArg=function(T){return new h(this.GetArgument(T),this.stack.env,this.configuration).mml()},h.prototype.ParseUpTo=function(T,f){return new h(this.GetUpTo(T,f),this.stack.env,this.configuration).mml()},h.prototype.GetDelimiterArg=function(T){var f=s.default.trimSpaces(this.GetArgument(T));if(f==="")return null;if(this.contains("delimiter",f))return f;throw new o.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},h.prototype.GetStar=function(){var T=this.GetNext()==="*";return T&&this.i++,T},h.prototype.create=function(T){for(var f,d=[],p=1;p<arguments.length;p++)d[p-1]=arguments[p];return(f=this.configuration.nodeFactory).create.apply(f,e([T],t(d),!1))},h}();return Os.default=u,Os}var S7={},xT={},n3={},MV=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),jc=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Kp=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},wV=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},CV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(n3,"__esModule",{value:!0});n3.BaseItem=n3.MmlStack=void 0;var Xp=CV(Le),jx=function(){function r(t){this._nodes=t}return Object.defineProperty(r.prototype,"nodes",{get:function(){return this._nodes},enumerable:!1,configurable:!0}),r.prototype.Push=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(t=this._nodes).push.apply(t,Kp([],jc(e),!1))},r.prototype.Pop=function(){return this._nodes.pop()},Object.defineProperty(r.prototype,"First",{get:function(){return this._nodes[this.Size()-1]},set:function(t){this._nodes[this.Size()-1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Last",{get:function(){return this._nodes[0]},set:function(t){this._nodes[0]=t},enumerable:!1,configurable:!0}),r.prototype.Peek=function(t){return t==null&&(t=1),this._nodes.slice(this.Size()-t)},r.prototype.Size=function(){return this._nodes.length},r.prototype.Clear=function(){this._nodes=[]},r.prototype.toMml=function(t,e){return t===void 0&&(t=!0),this._nodes.length===1&&!e?this.First:this.create("node",t?"inferredMrow":"mrow",this._nodes,{})},r.prototype.create=function(t){for(var e,n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];return(e=this.factory.configuration.nodeFactory).create.apply(e,Kp([t],jc(n),!1))},r}();n3.MmlStack=jx;var DV=function(r){MV(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,n)||this;return a.factory=e,a.global={},a._properties={},a.isOpen&&(a._env={}),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"base"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"env",{get:function(){return this._env},set:function(e){this._env=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"copyEnv",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getProperty=function(e){return this._properties[e]},t.prototype.setProperty=function(e,n){return this._properties[e]=n,this},Object.defineProperty(t.prototype,"isOpen",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isFinal",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.isKind=function(e){return e===this.kind},t.prototype.checkItem=function(e){if(e.isKind("over")&&this.isOpen&&(e.setProperty("num",this.toMml(!1)),this.Clear()),e.isKind("cell")&&this.isOpen){if(e.getProperty("linebreak"))return t.fail;throw new Xp.default("Misplaced","Misplaced %1",e.getName())}if(e.isClose&&this.getErrors(e.kind)){var n=jc(this.getErrors(e.kind),2),s=n[0],a=n[1];throw new Xp.default(s,a,e.getName())}return e.isFinal?(this.Push(e.First),t.fail):t.success},t.prototype.clearEnv=function(){var e,n;try{for(var s=wV(Object.keys(this.env)),a=s.next();!a.done;a=s.next()){var o=a.value;delete this.env[o]}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},t.prototype.setProperties=function(e){return Object.assign(this._properties,e),this},t.prototype.getName=function(){return this.getProperty("name")},t.prototype.toString=function(){return this.kind+"["+this.nodes.join("; ")+"]"},t.prototype.getErrors=function(e){var n=this.constructor;return(n.errors||{})[e]||t.errors[e]},t.fail=[null,!1],t.success=[null,!0],t.errors={end:["MissingBeginExtraEnd","Missing \\begin{%1} or extra \\end{%1}"],close:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],right:["MissingLeftExtraRight","Missing \\left or extra \\right"],middle:["ExtraMiddle","Extra \\middle"]},t}(jx);n3.BaseItem=DV;var Gx=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),I9;Object.defineProperty(xT,"__esModule",{value:!0});var OV=n3,IV=Zn,$p=function(r){Gx(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(OV.BaseItem),VV=function(r){Gx(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.defaultKind="dummy",e.configuration=null,e}return t.DefaultStackItems=(I9={},I9[$p.prototype.kind]=$p,I9),t}(IV.AbstractFactory);xT.default=VV;var Xn={},PV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},kV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},RV=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.NodeFactory=void 0;var BV=RV(Ne),FV=function(){function r(){this.mmlFactory=null,this.factory={node:r.createNode,token:r.createToken,text:r.createText,error:r.createError}}return r.createNode=function(t,e,n,s,a){n===void 0&&(n=[]),s===void 0&&(s={});var o=t.mmlFactory.create(e);return o.setChildren(n),a&&o.appendChild(a),BV.default.setProperties(o,s),o},r.createToken=function(t,e,n,s){n===void 0&&(n={}),s===void 0&&(s="");var a=t.create("text",s);return t.create("node",e,[],n,a)},r.createText=function(t,e){return e==null?null:t.mmlFactory.create("text").setText(e)},r.createError=function(t,e){var n=t.create("text",e),s=t.create("node","mtext",[],{},n),a=t.create("node","merror",[s],{"data-mjx-error":e});return a},r.prototype.setMmlFactory=function(t){this.mmlFactory=t},r.prototype.set=function(t,e){this.factory[t]=e},r.prototype.setCreators=function(t){for(var e in t)this.set(e,t[e])},r.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var s=this.factory[t]||this.factory.node,a=s.apply(void 0,kV([this,e[0]],PV(e.slice(1)),!1));return t==="node"&&this.configuration.addNode(e[0],a),a},r.prototype.get=function(t){return this.factory[t]},r}();Xn.NodeFactory=FV;var NV=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},UV=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},Yp=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zx=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(S7,"__esModule",{value:!0});var jV=zx(xT),GV=Xn,Jp=zx(Ne),tg=H1,zV=function(){function r(t,e){e===void 0&&(e=[]),this.options={},this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new GV.NodeFactory,this.nodeFactory.configuration=this,this.nodeFactory.setCreators(t.nodes),this.itemFactory=new jV.default(t.items),this.itemFactory.configuration=this,tg.defaultOptions.apply(void 0,UV([this.options],NV(e),!1)),(0,tg.defaultOptions)(this.options,t.options)}return r.prototype.pushParser=function(t){this.parsers.unshift(t)},r.prototype.popParser=function(){this.parsers.shift()},Object.defineProperty(r.prototype,"parser",{get:function(){return this.parsers[0]},enumerable:!1,configurable:!0}),r.prototype.clear=function(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()},r.prototype.addNode=function(t,e){var n=this.nodeLists[t];if(n||(n=this.nodeLists[t]=[]),n.push(e),e.kind!==t){var s=Jp.default.getProperty(e,"in-lists")||"",a=(s?s.split(/,/):[]).concat(t).join(",");Jp.default.setProperty(e,"in-lists",a)}},r.prototype.getList=function(t){var e,n,s=this.nodeLists[t]||[],a=[];try{for(var o=Yp(s),l=o.next();!l.done;l=o.next()){var u=l.value;this.inTree(u)&&a.push(u)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return this.nodeLists[t]=a,a},r.prototype.removeFromList=function(t,e){var n,s,a=this.nodeLists[t]||[];try{for(var o=Yp(e),l=o.next();!l.done;l=o.next()){var u=l.value,h=a.indexOf(u);h>=0&&a.splice(h,1)}}catch(T){n={error:T}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}},r.prototype.inTree=function(t){for(;t&&t!==this.root;)t=t.parent;return!!t},r}();S7.default=zV;var Hi={};(function(r){var t=_&&_.__extends||function(){var T=function(f,d){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(p[y]=m[y])},T(f,d)};return function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");T(f,d);function p(){this.constructor=f}f.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}}(),e=_&&_.__values||function(T){var f=typeof Symbol=="function"&&Symbol.iterator,d=f&&T[f],p=0;if(d)return d.call(T);if(T&&typeof T.length=="number")return{next:function(){return T&&p>=T.length&&(T=void 0),{value:T&&T[p++],done:!T}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},n=_&&_.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(r,"__esModule",{value:!0}),r.TagsFactory=r.AllTags=r.NoTags=r.AbstractTags=r.TagInfo=r.Label=void 0;var s=n(e2()),a=function(){function T(f,d){f===void 0&&(f="???"),d===void 0&&(d=""),this.tag=f,this.id=d}return T}();r.Label=a;var o=function(){function T(f,d,p,m,y,c,Q,g){f===void 0&&(f=""),d===void 0&&(d=!1),p===void 0&&(p=!1),m===void 0&&(m=null),y===void 0&&(y=""),c===void 0&&(c=""),Q===void 0&&(Q=!1),g===void 0&&(g=""),this.env=f,this.taggable=d,this.defaultTags=p,this.tag=m,this.tagId=y,this.tagFormat=c,this.noTag=Q,this.labelId=g}return T}();r.TagInfo=o;var l=function(){function T(){this.counter=0,this.allCounter=0,this.configuration=null,this.ids={},this.allIds={},this.labels={},this.allLabels={},this.redo=!1,this.refUpdate=!1,this.currentTag=new o,this.history=[],this.stack=[],this.enTag=function(f,d){var p=this.configuration.nodeFactory,m=p.create("node","mtd",[f]),y=p.create("node","mlabeledtr",[d,m]),c=p.create("node","mtable",[y],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0});return c}}return T.prototype.start=function(f,d,p){this.currentTag&&this.stack.push(this.currentTag),this.currentTag=new o(f,d,p)},Object.defineProperty(T.prototype,"env",{get:function(){return this.currentTag.env},enumerable:!1,configurable:!0}),T.prototype.end=function(){this.history.push(this.currentTag),this.currentTag=this.stack.pop()},T.prototype.tag=function(f,d){this.currentTag.tag=f,this.currentTag.tagFormat=d?f:this.formatTag(f),this.currentTag.noTag=!1},T.prototype.notag=function(){this.tag("",!0),this.currentTag.noTag=!0},Object.defineProperty(T.prototype,"noTag",{get:function(){return this.currentTag.noTag},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"label",{get:function(){return this.currentTag.labelId},set:function(f){this.currentTag.labelId=f},enumerable:!1,configurable:!0}),T.prototype.formatUrl=function(f,d){return d+"#"+encodeURIComponent(f)},T.prototype.formatTag=function(f){return"("+f+")"},T.prototype.formatId=function(f){return"mjx-eqn:"+f.replace(/\s/g,"_")},T.prototype.formatNumber=function(f){return f.toString()},T.prototype.autoTag=function(){this.currentTag.tag==null&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))},T.prototype.clearTag=function(){this.label="",this.tag(null,!0),this.currentTag.tagId=""},T.prototype.getTag=function(f){if(f===void 0&&(f=!1),f)return this.autoTag(),this.makeTag();var d=this.currentTag;return d.taggable&&!d.noTag&&(d.defaultTags&&this.autoTag(),d.tag)?this.makeTag():null},T.prototype.resetTag=function(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()},T.prototype.reset=function(f){f===void 0&&(f=0),this.resetTag(),this.counter=this.allCounter=f,this.allLabels={},this.allIds={}},T.prototype.startEquation=function(f){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new o("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;var d=f.inputData.recompile;d&&(this.refUpdate=!0,this.counter=d.counter)},T.prototype.finishEquation=function(f){this.redo&&(f.inputData.recompile={state:f.state(),counter:this.allCounter}),this.refUpdate||(this.allCounter=this.counter),Object.assign(this.allIds,this.ids),Object.assign(this.allLabels,this.labels)},T.prototype.finalize=function(f,d){if(!d.display||this.currentTag.env||this.currentTag.tag==null)return f;var p=this.makeTag(),m=this.enTag(f,p);return m},T.prototype.makeId=function(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds?this.label||this.currentTag.tag:this.currentTag.tag)},T.prototype.makeTag=function(){this.makeId(),this.label&&(this.labels[this.label]=new a(this.currentTag.tag,this.currentTag.tagId));var f=new s.default("\\text{"+this.currentTag.tagFormat+"}",{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[f],{id:this.currentTag.tagId})},T}();r.AbstractTags=l;var u=function(T){t(f,T);function f(){return T!==null&&T.apply(this,arguments)||this}return f.prototype.autoTag=function(){},f.prototype.getTag=function(){return this.currentTag.tag?T.prototype.getTag.call(this):null},f}(l);r.NoTags=u;var h=function(T){t(f,T);function f(){return T!==null&&T.apply(this,arguments)||this}return f.prototype.finalize=function(d,p){if(!p.display||this.history.find(function(y){return y.taggable}))return d;var m=this.getTag(!0);return this.enTag(d,m)},f}(l);r.AllTags=h,function(T){var f=new Map([["none",u],["all",h]]),d="none";T.OPTIONS={tags:d,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1},T.add=function(p,m){f.set(p,m)},T.addTags=function(p){var m,y;try{for(var c=e(Object.keys(p)),Q=c.next();!Q.done;Q=c.next()){var g=Q.value;T.add(g,p[g])}}catch(v){m={error:v}}finally{try{Q&&!Q.done&&(y=c.return)&&y.call(c)}finally{if(m)throw m.error}}},T.create=function(p){var m=f.get(p)||f.get(d);if(!m)throw Error("Unknown tags class");return new m},T.setDefault=function(p){d=p},T.getDefault=function(){return T.create(d)}}(r.TagsFactory||(r.TagsFactory={}))})(Hi);var he={},S0={};(function(r){var t=_&&_.__values||function(u){var h=typeof Symbol=="function"&&Symbol.iterator,T=h&&u[h],f=0;if(T)return T.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&f>=u.length&&(u=void 0),{value:u&&u[f++],done:!u}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(u,h){var T=typeof Symbol=="function"&&u[Symbol.iterator];if(!T)return u;var f=T.call(u),d,p=[],m;try{for(;(h===void 0||h-- >0)&&!(d=f.next()).done;)p.push(d.value)}catch(y){m={error:y}}finally{try{d&&!d.done&&(T=f.return)&&T.call(f)}finally{if(m)throw m.error}}return p};Object.defineProperty(r,"__esModule",{value:!0}),r.SubHandlers=r.SubHandler=r.MapHandler=void 0;var n=mr,s=p4,a;(function(u){var h=new Map;u.register=function(T){h.set(T.name,T)},u.getMap=function(T){return h.get(T)}})(a=r.MapHandler||(r.MapHandler={}));var o=function(){function u(){this._configuration=new n.PrioritizedList,this._fallback=new s.FunctionList}return u.prototype.add=function(h,T,f){var d,p;f===void 0&&(f=n.PrioritizedList.DEFAULTPRIORITY);try{for(var m=t(h.slice().reverse()),y=m.next();!y.done;y=m.next()){var c=y.value,Q=a.getMap(c);if(!Q){this.warn("Configuration "+c+" not found! Omitted.");return}this._configuration.add(Q,f)}}catch(g){d={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}T&&this._fallback.add(T,f)},u.prototype.parse=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item,y=m.parse(h);if(y)return y}}catch(v){T={error:v}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}var c=e(h,2),Q=c[0],g=c[1];Array.from(this._fallback)[0].item(Q,g)},u.prototype.lookup=function(h){var T=this.applicable(h);return T?T.lookup(h):null},u.prototype.contains=function(h){return!!this.applicable(h)},u.prototype.toString=function(){var h,T,f=[];try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;f.push(m.name)}}catch(y){h={error:y}}finally{try{p&&!p.done&&(T=d.return)&&T.call(d)}finally{if(h)throw h.error}}return f.join(", ")},u.prototype.applicable=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;if(m.contains(h))return m}}catch(y){T={error:y}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.retrieve=function(h){var T,f;try{for(var d=t(this._configuration),p=d.next();!p.done;p=d.next()){var m=p.value.item;if(m.name===h)return m}}catch(y){T={error:y}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.warn=function(h){console.log("TexParser Warning: "+h)},u}();r.SubHandler=o;var l=function(){function u(){this.map=new Map}return u.prototype.add=function(h,T,f){var d,p;f===void 0&&(f=n.PrioritizedList.DEFAULTPRIORITY);try{for(var m=t(Object.keys(h)),y=m.next();!y.done;y=m.next()){var c=y.value,Q=c,g=this.get(Q);g||(g=new o,this.set(Q,g)),g.add(h[Q],T[Q],f)}}catch(v){d={error:v}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}},u.prototype.set=function(h,T){this.map.set(h,T)},u.prototype.get=function(h){return this.map.get(h)},u.prototype.retrieve=function(h){var T,f;try{for(var d=t(this.map.values()),p=d.next();!p.done;p=d.next()){var m=p.value,y=m.retrieve(h);if(y)return y}}catch(c){T={error:c}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(T)throw T.error}}return null},u.prototype.keys=function(){return this.map.keys()},u}();r.SubHandlers=l})(S0);(function(r){var t=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__read||function(f,d){var p=typeof Symbol=="function"&&f[Symbol.iterator];if(!p)return f;var m=p.call(f),y,c=[],Q;try{for(;(d===void 0||d-- >0)&&!(y=m.next()).done;)c.push(y.value)}catch(g){Q={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(Q)throw Q.error}}return c};Object.defineProperty(r,"__esModule",{value:!0}),r.ParserConfiguration=r.ConfigurationHandler=r.Configuration=void 0;var n=H1,s=S0,a=p4,o=mr,l=Hi,u=function(){function f(d,p,m,y,c,Q,g,v,L,x,b,S,E){p===void 0&&(p={}),m===void 0&&(m={}),y===void 0&&(y={}),c===void 0&&(c={}),Q===void 0&&(Q={}),g===void 0&&(g={}),v===void 0&&(v=[]),L===void 0&&(L=[]),x===void 0&&(x=null),b===void 0&&(b=null),this.name=d,this.handler=p,this.fallback=m,this.items=y,this.tags=c,this.options=Q,this.nodes=g,this.preprocessors=v,this.postprocessors=L,this.initMethod=x,this.configMethod=b,this.priority=S,this.parser=E,this.handler=Object.assign({character:[],delimiter:[],macro:[],environment:[]},p)}return f.makeProcessor=function(d,p){return Array.isArray(d)?d:[d,p]},f._create=function(d,p){var m=this;p===void 0&&(p={});var y=p.priority||o.PrioritizedList.DEFAULTPRIORITY,c=p.init?this.makeProcessor(p.init,y):null,Q=p.config?this.makeProcessor(p.config,y):null,g=(p.preprocessors||[]).map(function(x){return m.makeProcessor(x,y)}),v=(p.postprocessors||[]).map(function(x){return m.makeProcessor(x,y)}),L=p.parser||"tex";return new f(d,p.handler||{},p.fallback||{},p.items||{},p.tags||{},p.options||{},p.nodes||{},g,v,c,Q,y,L)},f.create=function(d,p){p===void 0&&(p={});var m=f._create(d,p);return h.set(d,m),m},f.local=function(d){return d===void 0&&(d={}),f._create("",d)},Object.defineProperty(f.prototype,"init",{get:function(){return this.initMethod?this.initMethod[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"config",{get:function(){return this.configMethod?this.configMethod[0]:null},enumerable:!1,configurable:!0}),f}();r.Configuration=u;var h;(function(f){var d=new Map;f.set=function(p,m){d.set(p,m)},f.get=function(p){return d.get(p)},f.keys=function(){return d.keys()}})(h=r.ConfigurationHandler||(r.ConfigurationHandler={}));var T=function(){function f(d,p){var m,y,c,Q;p===void 0&&(p=["tex"]),this.initMethod=new a.FunctionList,this.configMethod=new a.FunctionList,this.configurations=new o.PrioritizedList,this.parsers=[],this.handlers=new s.SubHandlers,this.items={},this.tags={},this.options={},this.nodes={},this.parsers=p;try{for(var g=t(d.slice().reverse()),v=g.next();!v.done;v=g.next()){var L=v.value;this.addPackage(L)}}catch(M){m={error:M}}finally{try{v&&!v.done&&(y=g.return)&&y.call(g)}finally{if(m)throw m.error}}try{for(var x=t(this.configurations),b=x.next();!b.done;b=x.next()){var S=b.value,E=S.item,A=S.priority;this.append(E,A)}}catch(M){c={error:M}}finally{try{b&&!b.done&&(Q=x.return)&&Q.call(x)}finally{if(c)throw c.error}}}return f.prototype.init=function(){this.initMethod.execute(this)},f.prototype.config=function(d){var p,m;this.configMethod.execute(this,d);try{for(var y=t(this.configurations),c=y.next();!c.done;c=y.next()){var Q=c.value;this.addFilters(d,Q.item)}}catch(g){p={error:g}}finally{try{c&&!c.done&&(m=y.return)&&m.call(y)}finally{if(p)throw p.error}}},f.prototype.addPackage=function(d){var p=typeof d=="string"?d:d[0],m=this.getPackage(p);m&&this.configurations.add(m,typeof d=="string"?m.priority:d[1])},f.prototype.add=function(d,p,m){var y,c;m===void 0&&(m={});var Q=this.getPackage(d);this.append(Q),this.configurations.add(Q,Q.priority),this.init();var g=p.parseOptions;g.nodeFactory.setCreators(Q.nodes);try{for(var v=t(Object.keys(Q.items)),L=v.next();!L.done;L=v.next()){var x=L.value;g.itemFactory.setNodeClass(x,Q.items[x])}}catch(b){y={error:b}}finally{try{L&&!L.done&&(c=v.return)&&c.call(v)}finally{if(y)throw y.error}}l.TagsFactory.addTags(Q.tags),(0,n.defaultOptions)(g.options,Q.options),(0,n.userOptions)(g.options,m),this.addFilters(p,Q),Q.config&&Q.config(this,p)},f.prototype.getPackage=function(d){var p=h.get(d);if(p&&this.parsers.indexOf(p.parser)<0)throw Error("Package ".concat(d," doesn't target the proper parser"));return p},f.prototype.append=function(d,p){p=p||d.priority,d.initMethod&&this.initMethod.add(d.initMethod[0],d.initMethod[1]),d.configMethod&&this.configMethod.add(d.configMethod[0],d.configMethod[1]),this.handlers.add(d.handler,d.fallback,p),Object.assign(this.items,d.items),Object.assign(this.tags,d.tags),(0,n.defaultOptions)(this.options,d.options),Object.assign(this.nodes,d.nodes)},f.prototype.addFilters=function(d,p){var m,y,c,Q;try{for(var g=t(p.preprocessors),v=g.next();!v.done;v=g.next()){var L=e(v.value,2),x=L[0],b=L[1];d.preFilters.add(x,b)}}catch(D){m={error:D}}finally{try{v&&!v.done&&(y=g.return)&&y.call(g)}finally{if(m)throw m.error}}try{for(var S=t(p.postprocessors),E=S.next();!E.done;E=S.next()){var A=e(E.value,2),M=A[0],b=A[1];d.postFilters.add(M,b)}}catch(D){c={error:D}}finally{try{E&&!E.done&&(Q=S.return)&&Q.call(S)}finally{if(c)throw c.error}}},f}();r.ParserConfiguration=T})(he);var sr={},Gt={},s3={};Object.defineProperty(s3,"__esModule",{value:!0});s3.Macro=s3.Symbol=void 0;var WV=function(){function r(t,e,n){this._symbol=t,this._char=e,this._attributes=n}return Object.defineProperty(r.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"char",{get:function(){return this._char},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"attributes",{get:function(){return this._attributes},enumerable:!1,configurable:!0}),r}();s3.Symbol=WV;var qV=function(){function r(t,e,n){n===void 0&&(n=[]),this._symbol=t,this._func=e,this._args=n}return Object.defineProperty(r.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"func",{get:function(){return this._func},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"args",{get:function(){return this._args},enumerable:!1,configurable:!0}),r}();s3.Macro=qV;var m4=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),vi=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Wx=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},qx=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))};Object.defineProperty(Gt,"__esModule",{value:!0});Gt.EnvironmentMap=Gt.CommandMap=Gt.MacroMap=Gt.DelimiterMap=Gt.CharacterMap=Gt.AbstractParseMap=Gt.RegExpMap=Gt.AbstractSymbolMap=Gt.parseResult=void 0;var Zx=s3,ZV=S0;function E0(r){return r===void 0?!0:r}Gt.parseResult=E0;var _T=function(){function r(t,e){this._name=t,this._parser=e,ZV.MapHandler.register(this)}return Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r.prototype.parserFor=function(t){return this.contains(t)?this.parser:null},r.prototype.parse=function(t){var e=vi(t,2),n=e[0],s=e[1],a=this.parserFor(s),o=this.lookup(s);return a&&o?E0(a(n,o)):null},Object.defineProperty(r.prototype,"parser",{get:function(){return this._parser},set:function(t){this._parser=t},enumerable:!1,configurable:!0}),r}();Gt.AbstractSymbolMap=_T;var KV=function(r){m4(t,r);function t(e,n,s){var a=r.call(this,e,n)||this;return a._regExp=s,a}return t.prototype.contains=function(e){return this._regExp.test(e)},t.prototype.lookup=function(e){return this.contains(e)?e:null},t}(_T);Gt.RegExpMap=KV;var bT=function(r){m4(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.map=new Map,e}return t.prototype.lookup=function(e){return this.map.get(e)},t.prototype.contains=function(e){return this.map.has(e)},t.prototype.add=function(e,n){this.map.set(e,n)},t.prototype.remove=function(e){this.map.delete(e)},t}(_T);Gt.AbstractParseMap=bT;var Kx=function(r){m4(t,r);function t(e,n,s){var a,o,l=r.call(this,e,n)||this;try{for(var u=Wx(Object.keys(s)),h=u.next();!h.done;h=u.next()){var T=h.value,f=s[T],d=vi(typeof f=="string"?[f,null]:f,2),p=d[0],m=d[1],y=new Zx.Symbol(T,p,m);l.add(T,y)}}catch(c){a={error:c}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l}return t}(bT);Gt.CharacterMap=Kx;var XV=function(r){m4(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1];return r.prototype.parse.call(this,[s,"\\"+a])},t}(Kx);Gt.DelimiterMap=XV;var ST=function(r){m4(t,r);function t(e,n,s){var a,o,l=r.call(this,e,null)||this;try{for(var u=Wx(Object.keys(n)),h=u.next();!h.done;h=u.next()){var T=h.value,f=n[T],d=vi(typeof f=="string"?[f]:f),p=d[0],m=d.slice(1),y=new Zx.Macro(T,s[p],m);l.add(T,y)}}catch(c){a={error:c}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(a)throw a.error}}return l}return t.prototype.parserFor=function(e){var n=this.lookup(e);return n?n.func:null},t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);return!o||!l?null:E0(l.apply(void 0,qx([s,o.symbol],vi(o.args),!1)))},t}(bT);Gt.MacroMap=ST;var $V=function(r){m4(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);if(!o||!l)return null;var u=s.currentCS;s.currentCS="\\"+a;var h=l.apply(void 0,qx([s,"\\"+o.symbol],vi(o.args),!1));return s.currentCS=u,E0(h)},t}(ST);Gt.CommandMap=$V;var YV=function(r){m4(t,r);function t(e,n,s,a){var o=r.call(this,e,s,a)||this;return o.parser=n,o}return t.prototype.parse=function(e){var n=vi(e,2),s=n[0],a=n[1],o=this.lookup(a),l=this.parserFor(a);return!o||!l?null:E0(this.parser(s,o.symbol,l,o.args))},t}(ST);Gt.EnvironmentMap=YV;var Nt={},e1=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),To=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},Gc=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},ET=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.EquationItem=Nt.EqnArrayItem=Nt.ArrayItem=Nt.DotsItem=Nt.NonscriptItem=Nt.NotItem=Nt.FnItem=Nt.MmlItem=Nt.CellItem=Nt.PositionItem=Nt.StyleItem=Nt.EndItem=Nt.BeginItem=Nt.RightItem=Nt.Middle=Nt.LeftItem=Nt.OverItem=Nt.SubsupItem=Nt.PrimeItem=Nt.CloseItem=Nt.OpenItem=Nt.StopItem=Nt.StartItem=void 0;var JV=S0,tP=zn,wn=jt,Qr=ET(Le),Ki=ET(Ue()),ge=ET(Ne),ve=n3,eP=function(r){e1(t,r);function t(e,n){var s=r.call(this,e)||this;return s.global=n,s}return Object.defineProperty(t.prototype,"kind",{get:function(){return"start"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("stop")){var n=this.toMml();return this.global.isInner||(n=this.factory.configuration.tags.finalize(n,this.env)),[[this.factory.create("mml",n)],!0]}return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.StartItem=eP;var iP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"stop"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.StopItem=iP;var rP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"open"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("close")){var n=this.toMml(),s=this.create("node","TeXAtom",[n]);return[[this.factory.create("mml",s)],!0]}return r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["ExtraOpenMissingClose","Extra open brace or missing close brace"]}),t}(ve.BaseItem);Nt.OpenItem=rP;var nP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"close"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.CloseItem=nP;var sP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"prime"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n=To(this.Peek(2),2),s=n[0],a=n[1];if(!ge.default.isType(s,"msubsup")||ge.default.isType(s,"msup")){var o=this.create("node","msup",[s,a]);return[[o,e],!0]}return ge.default.setChild(s,s.sup,a),[[s,e],!0]},t}(ve.BaseItem);Nt.PrimeItem=sP;var aP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"subsup"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;var n=this.First,s=this.getProperty("position");if(e.isKind("mml")){if(this.getProperty("primes"))if(s!==2)ge.default.setChild(n,2,this.getProperty("primes"));else{ge.default.setProperty(this.getProperty("primes"),"variantForm",!0);var a=this.create("node","mrow",[this.getProperty("primes"),e.First]);e.First=a}ge.default.setChild(n,s,e.First),this.getProperty("movesupsub")!=null&&ge.default.setProperty(n,"movesupsub",this.getProperty("movesupsub"));var o=this.factory.create("mml",n);return[[o],!0]}if(r.prototype.checkItem.call(this,e)[1]){var l=this.getErrors(["","sub","sup"][s]);throw new(Qr.default.bind.apply(Qr.default,Gc([void 0,l[0],l[1]],To(l.splice(2)),!1)))}return null},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["MissingScript","Missing superscript or subscript argument"],sup:["MissingOpenForSup","Missing open brace for superscript"],sub:["MissingOpenForSub","Missing open brace for subscript"]}),t}(ve.BaseItem);Nt.SubsupItem=aP;var oP=function(r){e1(t,r);function t(e){var n=r.call(this,e)||this;return n.setProperty("name","\\over"),n}return Object.defineProperty(t.prototype,"kind",{get:function(){return"over"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("over"))throw new Qr.default("AmbiguousUseOf","Ambiguous use of %1",e.getName());if(e.isClose){var n=this.create("node","mfrac",[this.getProperty("num"),this.toMml(!1)]);return this.getProperty("thickness")!=null&&ge.default.setAttribute(n,"linethickness",this.getProperty("thickness")),(this.getProperty("open")||this.getProperty("close"))&&(ge.default.setProperty(n,"withDelims",!0),n=Ki.default.fixedFence(this.factory.configuration,this.getProperty("open"),n,this.getProperty("close"))),[[this.factory.create("mml",n),e],!0]}return r.prototype.checkItem.call(this,e)},t.prototype.toString=function(){return"over["+this.getProperty("num")+" / "+this.nodes.join("; ")+"]"},t}(ve.BaseItem);Nt.OverItem=oP;var lP=function(r){e1(t,r);function t(e,n){var s=r.call(this,e)||this;return s.setProperty("delim",n),s}return Object.defineProperty(t.prototype,"kind",{get:function(){return"left"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("right"))return[[this.factory.create("mml",Ki.default.fenced(this.factory.configuration,this.getProperty("delim"),this.toMml(),e.getProperty("delim"),"",e.getProperty("color")))],!0];if(e.isKind("middle")){var n={stretchy:!0};return e.getProperty("color")&&(n.mathcolor=e.getProperty("color")),this.Push(this.create("node","TeXAtom",[],{texClass:wn.TEXCLASS.CLOSE}),this.create("token","mo",n,e.getProperty("delim")),this.create("node","TeXAtom",[],{texClass:wn.TEXCLASS.OPEN})),this.env={},[[this],!0]}return r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(ve.BaseItem.errors),{stop:["ExtraLeftMissingRight","Extra \\left or missing \\right"]}),t}(ve.BaseItem);Nt.LeftItem=lP;var uP=function(r){e1(t,r);function t(e,n,s){var a=r.call(this,e)||this;return a.setProperty("delim",n),s&&a.setProperty("color",s),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"middle"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.Middle=uP;var cP=function(r){e1(t,r);function t(e,n,s){var a=r.call(this,e)||this;return a.setProperty("delim",n),s&&a.setProperty("color",s),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"right"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.RightItem=cP;var hP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"begin"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new Qr.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return this.getProperty("end")?ve.BaseItem.fail:[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new Qr.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.BeginItem=hP;var TP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"end"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.EndItem=TP;var fP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"style"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(!e.isClose)return r.prototype.checkItem.call(this,e);var n=this.create("node","mstyle",this.nodes,this.getProperty("styles"));return[[this.factory.create("mml",n),e],!0]},t}(ve.BaseItem);Nt.StyleItem=fP;var QP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"position"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isClose)throw new Qr.default("MissingBoxFor","Missing box for %1",this.getName());if(e.isFinal){var n=e.toMml();switch(this.getProperty("move")){case"vertical":return n=this.create("node","mpadded",[n],{height:this.getProperty("dh"),depth:this.getProperty("dd"),voffset:this.getProperty("dh")}),[[this.factory.create("mml",n)],!0];case"horizontal":return[[this.factory.create("mml",this.getProperty("left")),e,this.factory.create("mml",this.getProperty("right"))],!0]}}return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.PositionItem=QP;var dP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"cell"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.CellItem=dP;var pP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"isFinal",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kind",{get:function(){return"mml"},enumerable:!1,configurable:!0}),t}(ve.BaseItem);Nt.MmlItem=pP;var gP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"fn"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n=this.First;if(n){if(e.isOpen)return ve.BaseItem.success;if(!e.isKind("fn")){var s=e.First;if(!e.isKind("mml")||!s)return[[n,e],!0];if(ge.default.isType(s,"mstyle")&&s.childNodes.length&&ge.default.isType(s.childNodes[0].childNodes[0],"mspace")||ge.default.isType(s,"mspace"))return[[n,e],!0];ge.default.isEmbellished(s)&&(s=ge.default.getCoreMO(s));var a=ge.default.getForm(s);if(a!=null&&[0,0,1,1,0,1,1,0,0,0][a[2]])return[[n,e],!0]}var o=this.create("token","mo",{texClass:wn.TEXCLASS.NONE},tP.entities.ApplyFunction);return[[n,o,e],!0]}return r.prototype.checkItem.apply(this,arguments)},t}(ve.BaseItem);Nt.FnItem=gP;var mP=function(r){e1(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.remap=JV.MapHandler.getMap("not_remap"),e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"not"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){var n,s,a;if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;if(e.isKind("mml")&&(ge.default.isType(e.First,"mo")||ge.default.isType(e.First,"mi")||ge.default.isType(e.First,"mtext"))&&(n=e.First,s=ge.default.getText(n),s.length===1&&!ge.default.getProperty(n,"movesupsub")&&ge.default.getChildren(n).length===1))return this.remap.contains(s)?(a=this.create("text",this.remap.lookup(s).char),ge.default.setChild(n,0,a)):(a=this.create("text","̸"),ge.default.appendChildren(n,[a])),[[e],!0];a=this.create("text","⧸");var o=this.create("node","mtext",[],{},a),l=this.create("node","mpadded",[o],{width:0});return n=this.create("node","TeXAtom",[l],{texClass:wn.TEXCLASS.REL}),[[n,e],!0]},t}(ve.BaseItem);Nt.NotItem=mP;var yP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"nonscript"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("mml")&&e.Size()===1){var n=e.First;if(n.isKind("mstyle")&&n.notParent&&(n=ge.default.getChildren(ge.default.getChildren(n)[0])[0]),n.isKind("mspace")){if(n!==e.First){var s=this.create("node","mrow",[e.Pop()]);e.Push(s)}this.factory.configuration.addNode("nonscript",e.First)}}return[[e],!0]},t}(ve.BaseItem);Nt.NonscriptItem=yP;var vP=function(r){e1(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"dots"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("open")||e.isKind("left"))return ve.BaseItem.success;var n=this.getProperty("ldots"),s=e.First;if(e.isKind("mml")&&ge.default.isEmbellished(s)){var a=ge.default.getTexClass(ge.default.getCoreMO(s));(a===wn.TEXCLASS.BIN||a===wn.TEXCLASS.REL)&&(n=this.getProperty("cdots"))}return[[n,e],!0]},t}(ve.BaseItem);Nt.DotsItem=vP;var Xx=function(r){e1(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.table=[],e.row=[],e.frame=[],e.hfill=[],e.arraydef={},e.dashed=!1,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"array"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"copyEnv",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isClose&&!e.isKind("over")){if(e.getProperty("isEntry"))return this.EndEntry(),this.clearEnv(),ve.BaseItem.fail;if(e.getProperty("isCR"))return this.EndEntry(),this.EndRow(),this.clearEnv(),ve.BaseItem.fail;this.EndTable(),this.clearEnv();var n=this.factory.create("mml",this.createMml());if(this.getProperty("requireClose")){if(e.isKind("close"))return[[n],!0];throw new Qr.default("MissingCloseBrace","Missing close brace")}return[[n,e],!0]}return r.prototype.checkItem.call(this,e)},t.prototype.createMml=function(){var e=this.arraydef.scriptlevel;delete this.arraydef.scriptlevel;var n=this.create("node","mtable",this.table,this.arraydef);return e&&n.setProperty("scriptlevel",e),this.frame.length===4?ge.default.setAttribute(n,"frame",this.dashed?"dashed":"solid"):this.frame.length&&(this.arraydef.rowlines&&(this.arraydef.rowlines=this.arraydef.rowlines.replace(/none( none)+$/,"none")),ge.default.setAttribute(n,"frame",""),n=this.create("node","menclose",[n],{notation:this.frame.join(" ")}),((this.arraydef.columnlines||"none")!=="none"||(this.arraydef.rowlines||"none")!=="none")&&ge.default.setAttribute(n,"data-padding",0)),(this.getProperty("open")||this.getProperty("close"))&&(n=Ki.default.fenced(this.factory.configuration,this.getProperty("open"),n,this.getProperty("close"))),n},t.prototype.EndEntry=function(){var e=this.create("node","mtd",this.nodes);this.hfill.length&&(this.hfill[0]===0&&ge.default.setAttribute(e,"columnalign","right"),this.hfill[this.hfill.length-1]===this.Size()&&ge.default.setAttribute(e,"columnalign",ge.default.getAttribute(e,"columnalign")?"center":"left")),this.row.push(e),this.Clear(),this.hfill=[]},t.prototype.EndRow=function(){var e;this.getProperty("isNumbered")&&this.row.length===3?(this.row.unshift(this.row.pop()),e=this.create("node","mlabeledtr",this.row)):e=this.create("node","mtr",this.row),this.table.push(e),this.row=[]},t.prototype.EndTable=function(){(this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.checkLines()},t.prototype.checkLines=function(){if(this.arraydef.rowlines){var e=this.arraydef.rowlines.split(/ /);e.length===this.table.length?(this.frame.push("bottom"),e.pop(),this.arraydef.rowlines=e.join(" ")):e.length<this.table.length-1&&(this.arraydef.rowlines+=" none")}if(this.getProperty("rowspacing")){for(var n=this.arraydef.rowspacing.split(/ /);n.length<this.table.length;)n.push(this.getProperty("rowspacing")+"em");this.arraydef.rowspacing=n.join(" ")}},t.prototype.addRowSpacing=function(e){if(this.arraydef.rowspacing){var n=this.arraydef.rowspacing.split(/ /);if(!this.getProperty("rowspacing")){var s=Ki.default.dimen2em(n[0]);this.setProperty("rowspacing",s)}for(var a=this.getProperty("rowspacing");n.length<this.table.length;)n.push(Ki.default.Em(a));n[this.table.length-1]=Ki.default.Em(Math.max(0,a+Ki.default.dimen2em(e))),this.arraydef.rowspacing=n.join(" ")}},t}(ve.BaseItem);Nt.ArrayItem=Xx;var LP=function(r){e1(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.maxrow=0,a.factory.configuration.tags.start(n[0],n[2],n[1]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"eqnarray"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){this.row.length&&Ki.default.fixInitialMO(this.factory.configuration,this.nodes);var e=this.create("node","mtd",this.nodes);this.row.push(e),this.Clear()},t.prototype.EndRow=function(){this.row.length>this.maxrow&&(this.maxrow=this.row.length);var e="mtr",n=this.factory.configuration.tags.getTag();n&&(this.row=[n].concat(this.row),e="mlabeledtr"),this.factory.configuration.tags.clearTag();var s=this.create("node",e,this.row);this.table.push(s),this.row=[]},t.prototype.EndTable=function(){r.prototype.EndTable.call(this),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1)},t.prototype.extendArray=function(e,n){if(this.arraydef[e]){var s=this.arraydef[e].split(/ /),a=Gc([],To(s),!1);if(a.length>1){for(;a.length<n;)a.push.apply(a,Gc([],To(s),!1));this.arraydef[e]=a.slice(0,n).join(" ")}}},t}(Xx);Nt.EqnArrayItem=LP;var xP=function(r){e1(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.factory.configuration.tags.start("equation",!0,n[0]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"equation"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){var n=this.toMml(),s=this.factory.configuration.tags.getTag();return this.factory.configuration.tags.end(),[[s?this.factory.configuration.tags.enTag(n,s):n,e],!0]}if(e.isKind("stop"))throw new Qr.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(ve.BaseItem);Nt.EquationItem=xP;var q1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.TexConstant=void 0,function(t){t.Variant={NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALLIGRAPHIC:"-tex-calligraphic",BOLDCALLIGRAPHIC:"-tex-bold-calligraphic",OLDSTYLE:"-tex-oldstyle",BOLDOLDSTYLE:"-tex-bold-oldstyle",MATHITALIC:"-tex-mathit"},t.Form={PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},t.LineBreak={AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},t.LineBreakStyle={BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},t.IndentAlign={LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},t.IndentShift={INDENTSHIFT:"indentshift"},t.LineThickness={THIN:"thin",MEDIUM:"medium",THICK:"thick"},t.Notation={LONGDIV:"longdiv",ACTUARIAL:"actuarial",PHASORANGLE:"phasorangle",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",NORTHEASTARROW:"northeastarrow",MADRUWB:"madruwb",UPDIAGONALARROW:"updiagonalarrow"},t.Align={TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},t.Lines={NONE:"none",SOLID:"solid",DASHED:"dashed"},t.Side={LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},t.Width={AUTO:"auto",FIT:"fit"},t.Actiontype={TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},t.Overflow={LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},t.Unit={EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"}}(r.TexConstant||(r.TexConstant={}))})(q1);var p2={},G3={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.px=r.emRounded=r.em=r.percent=r.length2em=r.MATHSPACE=r.RELUNITS=r.UNITS=r.BIGDIMEN=void 0,r.BIGDIMEN=1e6,r.UNITS={px:1,in:96,cm:96/2.54,mm:96/25.4},r.RELUNITS={em:1,ex:.431,pt:1/10,pc:12/10,mu:1/18},r.MATHSPACE={veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:.04,medium:.06,thick:.1,normal:1,big:2,small:1/Math.sqrt(2),infinity:r.BIGDIMEN};function t(o,l,u,h){if(l===void 0&&(l=0),u===void 0&&(u=1),h===void 0&&(h=16),typeof o!="string"&&(o=String(o)),o===""||o==null)return l;if(r.MATHSPACE[o])return r.MATHSPACE[o];var T=o.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);if(!T)return l;var f=parseFloat(T[1]||"1"),d=T[2];return r.UNITS.hasOwnProperty(d)?f*r.UNITS[d]/h/u:r.RELUNITS.hasOwnProperty(d)?f*r.RELUNITS[d]:d==="%"?f/100*l:f*l}r.length2em=t;function e(o){return(100*o).toFixed(1).replace(/\.?0+$/,"")+"%"}r.percent=e;function n(o){return Math.abs(o)<.001?"0":o.toFixed(3).replace(/\.?0+$/,"")+"em"}r.em=n;function s(o,l){return l===void 0&&(l=16),o=(Math.round(o*l)+.05)/l,Math.abs(o)<.001?"0em":o.toFixed(3).replace(/\.?0+$/,"")+"em"}r.emRounded=s;function a(o,l,u){return l===void 0&&(l=-r.BIGDIMEN),u===void 0&&(u=16),o*=u,l&&o<l&&(o=l),Math.abs(o)<.1?"0":o.toFixed(1).replace(/\.0$/,"")+"px"}r.px=a})(G3);var Cn=_&&_.__assign||function(){return Cn=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},Cn.apply(this,arguments)},_P=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),bP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),SP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&_P(t,r,e);return bP(t,r),t},AT=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},E7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(p2,"__esModule",{value:!0});var HT=SP(Nt),_t=E7(Ne),S1=E7(Le),A7=E7(e2()),MT=q1,h1=E7(Ue()),$n=jt,$x=Hi,Yx=G3,zc=zn,EP=H1,Vt={},AP=1.2/.85,HP={fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,class:1,href:1,style:1};Vt.Open=function(r,t){r.Push(r.itemFactory.create("open"))};Vt.Close=function(r,t){r.Push(r.itemFactory.create("close"))};Vt.Tilde=function(r,t){r.Push(r.create("token","mtext",{},zc.entities.nbsp))};Vt.Space=function(r,t){};Vt.Superscript=function(r,t){var e;r.GetNext().match(/\d/)&&(r.string=r.string.substr(0,r.i+1)+" "+r.string.substr(r.i+1));var n,s,a=r.stack.Top();a.isKind("prime")?(e=AT(a.Peek(2),2),s=e[0],n=e[1],r.stack.Pop()):(s=r.stack.Prev(),s||(s=r.create("token","mi",{},"")));var o=_t.default.getProperty(s,"movesupsub"),l=_t.default.isType(s,"msubsup")?s.sup:s.over;if(_t.default.isType(s,"msubsup")&&!_t.default.isType(s,"msup")&&_t.default.getChildAt(s,s.sup)||_t.default.isType(s,"munderover")&&!_t.default.isType(s,"mover")&&_t.default.getChildAt(s,s.over)&&!_t.default.getProperty(s,"subsupOK"))throw new S1.default("DoubleExponent","Double exponent: use braces to clarify");(!_t.default.isType(s,"msubsup")||_t.default.isType(s,"msup"))&&(o?((!_t.default.isType(s,"munderover")||_t.default.isType(s,"mover")||_t.default.getChildAt(s,s.over))&&(s=r.create("node","munderover",[s],{movesupsub:!0})),l=s.over):(s=r.create("node","msubsup",[s]),l=s.sup)),r.Push(r.itemFactory.create("subsup",s).setProperties({position:l,primes:n,movesupsub:o}))};Vt.Subscript=function(r,t){var e;r.GetNext().match(/\d/)&&(r.string=r.string.substr(0,r.i+1)+" "+r.string.substr(r.i+1));var n,s,a=r.stack.Top();a.isKind("prime")?(e=AT(a.Peek(2),2),s=e[0],n=e[1],r.stack.Pop()):(s=r.stack.Prev(),s||(s=r.create("token","mi",{},"")));var o=_t.default.getProperty(s,"movesupsub"),l=_t.default.isType(s,"msubsup")?s.sub:s.under;if(_t.default.isType(s,"msubsup")&&!_t.default.isType(s,"msup")&&_t.default.getChildAt(s,s.sub)||_t.default.isType(s,"munderover")&&!_t.default.isType(s,"mover")&&_t.default.getChildAt(s,s.under)&&!_t.default.getProperty(s,"subsupOK"))throw new S1.default("DoubleSubscripts","Double subscripts: use braces to clarify");(!_t.default.isType(s,"msubsup")||_t.default.isType(s,"msup"))&&(o?((!_t.default.isType(s,"munderover")||_t.default.isType(s,"mover")||_t.default.getChildAt(s,s.under))&&(s=r.create("node","munderover",[s],{movesupsub:!0})),l=s.under):(s=r.create("node","msubsup",[s]),l=s.sub)),r.Push(r.itemFactory.create("subsup",s).setProperties({position:l,primes:n,movesupsub:o}))};Vt.Prime=function(r,t){var e=r.stack.Prev();if(e||(e=r.create("node","mi")),_t.default.isType(e,"msubsup")&&!_t.default.isType(e,"msup")&&_t.default.getChildAt(e,e.sup))throw new S1.default("DoubleExponentPrime","Prime causes double exponent: use braces to clarify");var n="";r.i--;do n+=zc.entities.prime,r.i++,t=r.GetNext();while(t==="'"||t===zc.entities.rsquo);n=["","′","″","‴","⁗"][n.length]||n;var s=r.create("token","mo",{variantForm:!0},n);r.Push(r.itemFactory.create("prime",e,s))};Vt.Comment=function(r,t){for(;r.i<r.string.length&&r.string.charAt(r.i)!==`
123
+ `;)r.i++};Vt.Hash=function(r,t){throw new S1.default("CantUseHash1","You can't use 'macro parameter character #' in math mode")};Vt.MathFont=function(r,t,e){var n=r.GetArgument(t),s=new A7.default(n,Cn(Cn({},r.stack.env),{font:e,multiLetterIdentifiers:/^[a-zA-Z]+/,noAutoOP:!0}),r.configuration).mml();r.Push(r.create("node","TeXAtom",[s]))};Vt.SetFont=function(r,t,e){r.stack.env.font=e};Vt.SetStyle=function(r,t,e,n,s){r.stack.env.style=e,r.stack.env.level=s,r.Push(r.itemFactory.create("style").setProperty("styles",{displaystyle:n,scriptlevel:s}))};Vt.SetSize=function(r,t,e){r.stack.env.size=e,r.Push(r.itemFactory.create("style").setProperty("styles",{mathsize:(0,Yx.em)(e)}))};Vt.Spacer=function(r,t,e){var n=r.create("node","mspace",[],{width:(0,Yx.em)(e)}),s=r.create("node","mstyle",[n],{scriptlevel:0});r.Push(s)};Vt.LeftRight=function(r,t){var e=t.substr(1);r.Push(r.itemFactory.create(e,r.GetDelimiter(t),r.stack.env.color))};Vt.NamedFn=function(r,t,e){e||(e=t.substr(1));var n=r.create("token","mi",{texClass:$n.TEXCLASS.OP},e);r.Push(r.itemFactory.create("fn",n))};Vt.NamedOp=function(r,t,e){e||(e=t.substr(1)),e=e.replace(/&thinsp;/," ");var n=r.create("token","mo",{movablelimits:!0,movesupsub:!0,form:MT.TexConstant.Form.PREFIX,texClass:$n.TEXCLASS.OP},e);r.Push(n)};Vt.Limits=function(r,t,e){var n=r.stack.Prev(!0);if(!n||_t.default.getTexClass(_t.default.getCoreMO(n))!==$n.TEXCLASS.OP&&_t.default.getProperty(n,"movesupsub")==null)throw new S1.default("MisplacedLimits","%1 is allowed only on operators",r.currentCS);var s=r.stack.Top(),a;_t.default.isType(n,"munderover")&&!e?(a=r.create("node","msubsup"),_t.default.copyChildren(n,a),n=s.Last=a):_t.default.isType(n,"msubsup")&&e&&(a=r.create("node","munderover"),_t.default.copyChildren(n,a),n=s.Last=a),_t.default.setProperty(n,"movesupsub",!!e),_t.default.setProperties(_t.default.getCoreMO(n),{movablelimits:!1}),(_t.default.getAttribute(n,"movablelimits")||_t.default.getProperty(n,"movablelimits"))&&_t.default.setProperties(n,{movablelimits:!1})};Vt.Over=function(r,t,e,n){var s=r.itemFactory.create("over").setProperty("name",r.currentCS);e||n?(s.setProperty("open",e),s.setProperty("close",n)):t.match(/withdelims$/)&&(s.setProperty("open",r.GetDelimiter(t)),s.setProperty("close",r.GetDelimiter(t))),t.match(/^\\above/)?s.setProperty("thickness",r.GetDimen(t)):(t.match(/^\\atop/)||e||n)&&s.setProperty("thickness",0),r.Push(s)};Vt.Frac=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.create("node","mfrac",[e,n]);r.Push(s)};Vt.Sqrt=function(r,t){var e=r.GetBrackets(t),n=r.GetArgument(t);n==="\\frac"&&(n+="{"+r.GetArgument(n)+"}{"+r.GetArgument(n)+"}");var s=new A7.default(n,r.stack.env,r.configuration).mml();e?s=r.create("node","mroot",[s,Jx(r,e)]):s=r.create("node","msqrt",[s]),r.Push(s)};function Jx(r,t){var e=r.stack.env,n=e.inRoot;e.inRoot=!0;var s=new A7.default(t,e,r.configuration),a=s.mml(),o=s.stack.global;if(o.leftRoot||o.upRoot){var l={};o.leftRoot&&(l.width=o.leftRoot),o.upRoot&&(l.voffset=o.upRoot,l.height=o.upRoot),a=r.create("node","mpadded",[a],l)}return e.inRoot=n,a}Vt.Root=function(r,t){var e=r.GetUpTo(t,"\\of"),n=r.ParseArg(t),s=r.create("node","mroot",[n,Jx(r,e)]);r.Push(s)};Vt.MoveRoot=function(r,t,e){if(!r.stack.env.inRoot)throw new S1.default("MisplacedMoveRoot","%1 can appear only within a root",r.currentCS);if(r.stack.global[e])throw new S1.default("MultipleMoveRoot","Multiple use of %1",r.currentCS);var n=r.GetArgument(t);if(!n.match(/-?[0-9]+/))throw new S1.default("IntegerArg","The argument to %1 must be an integer",r.currentCS);n=parseInt(n,10)/15+"em",n.substr(0,1)!=="-"&&(n="+"+n),r.stack.global[e]=n};Vt.Accent=function(r,t,e,n){var s=r.ParseArg(t),a=Cn(Cn({},h1.default.getFontDef(r)),{accent:!0,mathaccent:!0}),o=_t.default.createEntity(e),l=r.create("token","mo",a,o),u=l;_t.default.setAttribute(u,"stretchy",!!n);var h=_t.default.isEmbellished(s)?_t.default.getCoreMO(s):s;(_t.default.isType(h,"mo")||_t.default.getProperty(h,"movablelimits"))&&_t.default.setProperties(h,{movablelimits:!1});var T=r.create("node","munderover");_t.default.setChild(T,0,s),_t.default.setChild(T,1,null),_t.default.setChild(T,2,u);var f=r.create("node","TeXAtom",[T]);r.Push(f)};Vt.UnderOver=function(r,t,e,n){var s=_t.default.createEntity(e),a=r.create("token","mo",{stretchy:!0,accent:!0},s),o=t.charAt(1)==="o"?"over":"under",l=r.ParseArg(t);r.Push(h1.default.underOver(r,l,a,o,n))};Vt.Overset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t);h1.default.checkMovableLimits(n),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1);var s=r.create("node","mover",[n,e]);r.Push(s)};Vt.Underset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t);h1.default.checkMovableLimits(n),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1);var s=r.create("node","munder",[n,e],{accentunder:!1});r.Push(s)};Vt.Overunderset=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.ParseArg(t);h1.default.checkMovableLimits(s),e.isKind("mo")&&_t.default.setAttribute(e,"accent",!1),n.isKind("mo")&&_t.default.setAttribute(n,"accent",!1);var a=r.create("node","munderover",[s,n,e],{accent:!1,accentunder:!1});r.Push(a)};Vt.TeXAtom=function(r,t,e){var n={texClass:e},s,a,o;if(e===$n.TEXCLASS.OP){n.movesupsub=n.movablelimits=!0;var l=r.GetArgument(t),u=l.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);u?(n.mathvariant=MT.TexConstant.Variant.NORMAL,a=r.create("token","mi",n,u[1])):(o=new A7.default(l,r.stack.env,r.configuration).mml(),a=r.create("node","TeXAtom",[o],n)),s=r.itemFactory.create("fn",a)}else o=r.ParseArg(t),s=r.create("node","TeXAtom",[o],n);r.Push(s)};Vt.MmlToken=function(r,t){var e=r.GetArgument(t),n=r.GetBrackets(t,"").replace(/^\s+/,""),s=r.GetArgument(t),a={},o=[],l;try{l=r.create("node",e)}catch{l=null}if(!l||!l.isToken)throw new S1.default("NotMathMLToken","%1 is not a token element",e);for(;n!=="";){var u=n.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i);if(!u)throw new S1.default("InvalidMathMLAttr","Invalid MathML attribute: %1",n);if(!l.attributes.hasDefault(u[1])&&!HP[u[1]])throw new S1.default("UnknownAttrForElement","%1 is not a recognized attribute for %2",u[1],e);var h=h1.default.MmlFilterAttribute(r,u[1],u[2].replace(/^(['"])(.*)\1$/,"$2"));h&&(h.toLowerCase()==="true"?h=!0:h.toLowerCase()==="false"&&(h=!1),a[u[1]]=h,o.push(u[1])),n=n.substr(u[0].length)}o.length&&(a["mjx-keep-attrs"]=o.join(" "));var T=r.create("text",s);l.appendChild(T),_t.default.setProperties(l,a),r.Push(l)};Vt.Strut=function(r,t){var e=r.create("node","mrow"),n=r.create("node","mpadded",[e],{height:"8.6pt",depth:"3pt",width:0});r.Push(n)};Vt.Phantom=function(r,t,e,n){var s=r.create("node","mphantom",[r.ParseArg(t)]);(e||n)&&(s=r.create("node","mpadded",[s]),n&&(_t.default.setAttribute(s,"height",0),_t.default.setAttribute(s,"depth",0)),e&&_t.default.setAttribute(s,"width",0));var a=r.create("node","TeXAtom",[s]);r.Push(a)};Vt.Smash=function(r,t){var e=h1.default.trimSpaces(r.GetBrackets(t,"")),n=r.create("node","mpadded",[r.ParseArg(t)]);switch(e){case"b":_t.default.setAttribute(n,"depth",0);break;case"t":_t.default.setAttribute(n,"height",0);break;default:_t.default.setAttribute(n,"height",0),_t.default.setAttribute(n,"depth",0)}var s=r.create("node","TeXAtom",[n]);r.Push(s)};Vt.Lap=function(r,t){var e=r.create("node","mpadded",[r.ParseArg(t)],{width:0});t==="\\llap"&&_t.default.setAttribute(e,"lspace","-1width");var n=r.create("node","TeXAtom",[e]);r.Push(n)};Vt.RaiseLower=function(r,t){var e=r.GetDimen(t),n=r.itemFactory.create("position").setProperties({name:r.currentCS,move:"vertical"});e.charAt(0)==="-"&&(e=e.slice(1),t=t.substr(1)==="raise"?"\\lower":"\\raise"),t==="\\lower"?(n.setProperty("dh","-"+e),n.setProperty("dd","+"+e)):(n.setProperty("dh","+"+e),n.setProperty("dd","-"+e)),r.Push(n)};Vt.MoveLeftRight=function(r,t){var e=r.GetDimen(t),n=e.charAt(0)==="-"?e.slice(1):"-"+e;if(t==="\\moveleft"){var s=e;e=n,n=s}r.Push(r.itemFactory.create("position").setProperties({name:r.currentCS,move:"horizontal",left:r.create("node","mspace",[],{width:e}),right:r.create("node","mspace",[],{width:n})}))};Vt.Hskip=function(r,t){var e=r.create("node","mspace",[],{width:r.GetDimen(t)});r.Push(e)};Vt.Nonscript=function(r,t){r.Push(r.itemFactory.create("nonscript"))};Vt.Rule=function(r,t,e){var n=r.GetDimen(t),s=r.GetDimen(t),a=r.GetDimen(t),o={width:n,height:s,depth:a};e!=="blank"&&(o.mathbackground=r.stack.env.color||"black");var l=r.create("node","mspace",[],o);r.Push(l)};Vt.rule=function(r,t){var e=r.GetBrackets(t),n=r.GetDimen(t),s=r.GetDimen(t),a=r.create("node","mspace",[],{width:n,height:s,mathbackground:r.stack.env.color||"black"});e&&(a=r.create("node","mpadded",[a],{voffset:e}),e.match(/^\-/)?(_t.default.setAttribute(a,"height",e),_t.default.setAttribute(a,"depth","+"+e.substr(1))):_t.default.setAttribute(a,"height","+"+e)),r.Push(a)};Vt.MakeBig=function(r,t,e,n){n*=AP;var s=String(n).replace(/(\.\d\d\d).+/,"$1")+"em",a=r.GetDelimiter(t,!0),o=r.create("token","mo",{minsize:s,maxsize:s,fence:!0,stretchy:!0,symmetric:!0},a),l=r.create("node","TeXAtom",[o],{texClass:e});r.Push(l)};Vt.BuildRel=function(r,t){var e=r.ParseUpTo(t,"\\over"),n=r.ParseArg(t),s=r.create("node","munderover");_t.default.setChild(s,0,n),_t.default.setChild(s,1,null),_t.default.setChild(s,2,e);var a=r.create("node","TeXAtom",[s],{texClass:$n.TEXCLASS.REL});r.Push(a)};Vt.HBox=function(r,t,e,n){r.PushAll(h1.default.internalMath(r,r.GetArgument(t),e,n))};Vt.FBox=function(r,t){var e=h1.default.internalMath(r,r.GetArgument(t)),n=r.create("node","menclose",e,{notation:"box"});r.Push(n)};Vt.FrameBox=function(r,t){var e=r.GetBrackets(t),n=r.GetBrackets(t)||"c",s=h1.default.internalMath(r,r.GetArgument(t));e&&(s=[r.create("node","mpadded",s,{width:e,"data-align":(0,EP.lookup)(n,{l:"left",r:"right"},"center")})]);var a=r.create("node","TeXAtom",[r.create("node","menclose",s,{notation:"box"})],{texClass:$n.TEXCLASS.ORD});r.Push(a)};Vt.Not=function(r,t){r.Push(r.itemFactory.create("not"))};Vt.Dots=function(r,t){var e=_t.default.createEntity("2026"),n=_t.default.createEntity("22EF"),s=r.create("token","mo",{stretchy:!1},e),a=r.create("token","mo",{stretchy:!1},n);r.Push(r.itemFactory.create("dots").setProperties({ldots:s,cdots:a}))};Vt.Matrix=function(r,t,e,n,s,a,o,l,u,h){var T=r.GetNext();if(T==="")throw new S1.default("MissingArgFor","Missing argument for %1",r.currentCS);T==="{"?r.i++:(r.string=T+"}"+r.string.slice(r.i+1),r.i=0);var f=r.itemFactory.create("array").setProperty("requireClose",!0);f.arraydef={rowspacing:o||"4pt",columnspacing:a||"1em"},u&&f.setProperty("isCases",!0),h&&(f.setProperty("isNumbered",!0),f.arraydef.side=h),(e||n)&&(f.setProperty("open",e),f.setProperty("close",n)),l==="D"&&(f.arraydef.displaystyle=!0),s!=null&&(f.arraydef.columnalign=s),r.Push(f)};Vt.Entry=function(r,t){r.Push(r.itemFactory.create("cell").setProperties({isEntry:!0,name:t}));var e=r.stack.Top(),n=e.getProperty("casesEnv"),s=e.getProperty("isCases");if(!(!s&&!n)){for(var a=r.string,o=0,l=-1,u=r.i,h=a.length,T=n?new RegExp("^\\\\end\\s*\\{".concat(n.replace(/\*/,"\\*"),"\\}")):null;u<h;){var f=a.charAt(u);if(f==="{")o++,u++;else if(f==="}")o===0?h=0:(o--,o===0&&l<0&&(l=u-r.i),u++);else{if(f==="&"&&o===0)throw new S1.default("ExtraAlignTab","Extra alignment tab in \\cases text");if(f==="\\"){var d=a.substr(u);d.match(/^((\\cr)[^a-zA-Z]|\\\\)/)||T&&d.match(T)?h=0:u+=2}else u++}}var p=a.substr(r.i,u-r.i);if(!p.match(/^\s*\\text[^a-zA-Z]/)||l!==p.replace(/\s+$/,"").length-1){var m=h1.default.internalMath(r,h1.default.trimSpaces(p),0);r.PushAll(m),r.i=u}}};Vt.Cr=function(r,t){r.Push(r.itemFactory.create("cell").setProperties({isCR:!0,name:t}))};Vt.CrLaTeX=function(r,t,e){e===void 0&&(e=!1);var n;if(!e&&(r.string.charAt(r.i)==="*"&&r.i++,r.string.charAt(r.i)==="[")){var s=r.GetBrackets(t,""),a=AT(h1.default.matchDimen(s),2),o=a[0],l=a[1];if(s&&!o)throw new S1.default("BracketMustBeDimension","Bracket argument to %1 must be a dimension",r.currentCS);n=o+l}r.Push(r.itemFactory.create("cell").setProperties({isCR:!0,name:t,linebreak:!0}));var u=r.stack.Top(),h;u instanceof HT.ArrayItem?n&&u.addRowSpacing(n):(n&&(h=r.create("node","mspace",[],{depth:n}),r.Push(h)),h=r.create("node","mspace",[],{linebreak:MT.TexConstant.LineBreak.NEWLINE}),r.Push(h))};Vt.HLine=function(r,t,e){e==null&&(e="solid");var n=r.stack.Top();if(!(n instanceof HT.ArrayItem)||n.Size())throw new S1.default("Misplaced","Misplaced %1",r.currentCS);if(!n.table.length)n.frame.push("top");else{for(var s=n.arraydef.rowlines?n.arraydef.rowlines.split(/ /):[];s.length<n.table.length;)s.push("none");s[n.table.length-1]=e,n.arraydef.rowlines=s.join(" ")}};Vt.HFill=function(r,t){var e=r.stack.Top();if(e instanceof HT.ArrayItem)e.hfill.push(e.Size());else throw new S1.default("UnsupportedHFill","Unsupported use of %1",r.currentCS)};Vt.BeginEnd=function(r,t){var e=r.GetArgument(t);if(e.match(/\\/i))throw new S1.default("InvalidEnv","Invalid environment name '%1'",e);var n=r.configuration.handlers.get("environment").lookup(e);if(n&&t==="\\end"){if(!n.args[0]){var s=r.itemFactory.create("end").setProperty("name",e);r.Push(s);return}r.stack.env.closing=e}h1.default.checkMaxMacros(r,!1),r.parse("environment",[r,e])};Vt.Array=function(r,t,e,n,s,a,o,l,u){s||(s=r.GetArgument("\\begin{"+t.getName()+"}"));var h=("c"+s).replace(/[^clr|:]/g,"").replace(/[^|:]([|:])+/g,"$1");s=s.replace(/[^clr]/g,"").split("").join(" "),s=s.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var T=r.itemFactory.create("array");return T.arraydef={columnalign:s,columnspacing:a||"1em",rowspacing:o||"4pt"},h.match(/[|:]/)&&(h.charAt(0).match(/[|:]/)&&(T.frame.push("left"),T.dashed=h.charAt(0)===":"),h.charAt(h.length-1).match(/[|:]/)&&T.frame.push("right"),h=h.substr(1,h.length-2),T.arraydef.columnlines=h.split("").join(" ").replace(/[^|: ]/g,"none").replace(/\|/g,"solid").replace(/:/g,"dashed")),e&&T.setProperty("open",r.convertDelimiter(e)),n&&T.setProperty("close",r.convertDelimiter(n)),(l||"").charAt(1)==="'"&&(T.arraydef["data-cramped"]=!0,l=l.charAt(0)),l==="D"?T.arraydef.displaystyle=!0:l&&(T.arraydef.displaystyle=!1),l==="S"&&(T.arraydef.scriptlevel=1),u&&(T.arraydef.useHeight=!1),r.Push(t),T};Vt.AlignedArray=function(r,t){var e=r.GetBrackets("\\begin{"+t.getName()+"}"),n=Vt.Array(r,t);return h1.default.setArrayAlign(n,e)};Vt.Equation=function(r,t,e){return r.Push(t),h1.default.checkEqnEnv(r),r.itemFactory.create("equation",e).setProperty("name",t.getName())};Vt.EqnArray=function(r,t,e,n,s,a){r.Push(t),n&&h1.default.checkEqnEnv(r),s=s.replace(/[^clr]/g,"").split("").join(" "),s=s.replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var o=r.itemFactory.create("eqnarray",t.getName(),e,n,r.stack.global);return o.arraydef={displaystyle:!0,columnalign:s,columnspacing:a||"1em",rowspacing:"3pt",side:r.options.tagSide,minlabelspacing:r.options.tagIndent},o};Vt.HandleNoTag=function(r,t){r.tags.notag()};Vt.HandleLabel=function(r,t){var e=r.GetArgument(t);if(e!==""&&!r.tags.refUpdate){if(r.tags.label)throw new S1.default("MultipleCommand","Multiple %1",r.currentCS);if(r.tags.label=e,(r.tags.allLabels[e]||r.tags.labels[e])&&!r.options.ignoreDuplicateLabels)throw new S1.default("MultipleLabel","Label '%1' multiply defined",e);r.tags.labels[e]=new $x.Label}};Vt.HandleRef=function(r,t,e){var n=r.GetArgument(t),s=r.tags.allLabels[n]||r.tags.labels[n];s||(r.tags.refUpdate||(r.tags.redo=!0),s=new $x.Label);var a=s.tag;e&&(a=r.tags.formatTag(a));var o=r.create("node","mrow",h1.default.internalMath(r,a),{href:r.tags.formatUrl(s.id,r.options.baseURL),class:"MathJax_ref"});r.Push(o)};Vt.Macro=function(r,t,e,n,s){if(n){var a=[];if(s!=null){var o=r.GetBrackets(t);a.push(o??s)}for(var l=a.length;l<n;l++)a.push(r.GetArgument(t));e=h1.default.substituteArgs(r,a,e)}r.string=h1.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,h1.default.checkMaxMacros(r)};Vt.MathChoice=function(r,t){var e=r.ParseArg(t),n=r.ParseArg(t),s=r.ParseArg(t),a=r.ParseArg(t);r.Push(r.create("node","MathChoice",[e,n,s,a]))};p2.default=Vt;var h3={},MP=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},wP=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},t_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(h3,"__esModule",{value:!0});var CP=t_(Ne),V9=q1,eg=t_(Ue()),Wc;(function(r){function t(h,T){var f=eg.default.getFontDef(h),d=h.stack.env;d.multiLetterIdentifiers&&d.font!==""&&(T=h.string.substr(h.i-1).match(d.multiLetterIdentifiers)[0],h.i+=T.length-1,f.mathvariant===V9.TexConstant.Variant.NORMAL&&d.noAutoOP&&T.length>1&&(f.autoOP=!1));var p=h.create("token","mi",f,T);h.Push(p)}r.variable=t;function e(h,T){var f,d=h.configuration.options.digits,p=h.string.slice(h.i-1).match(d),m=eg.default.getFontDef(h);p?(f=h.create("token","mn",m,p[0].replace(/[{}]/g,"")),h.i+=p[0].length-1):f=h.create("token","mo",m,T),h.Push(f)}r.digit=e;function n(h,T){var f=h.GetCS();h.parse("macro",[h,f])}r.controlSequence=n;function s(h,T){var f=T.attributes||{mathvariant:V9.TexConstant.Variant.ITALIC},d=h.create("token","mi",f,T.char);h.Push(d)}r.mathchar0mi=s;function a(h,T){var f=T.attributes||{};f.stretchy=!1;var d=h.create("token","mo",f,T.char);CP.default.setProperty(d,"fixStretchy",!0),h.configuration.addNode("fixStretchy",d),h.Push(d)}r.mathchar0mo=a;function o(h,T){var f=T.attributes||{mathvariant:V9.TexConstant.Variant.NORMAL};h.stack.env.font&&(f.mathvariant=h.stack.env.font);var d=h.create("token","mi",f,T.char);h.Push(d)}r.mathchar7=o;function l(h,T){var f=T.attributes||{};f=Object.assign({fence:!1,stretchy:!1},f);var d=h.create("token","mo",f,T.char);h.Push(d)}r.delimiter=l;function u(h,T,f,d){var p=d[0],m=h.itemFactory.create("begin").setProperties({name:T,end:p});m=f.apply(void 0,wP([h,m],MP(d.slice(1)),!1)),h.Push(m)}r.environment=u})(Wc||(Wc={}));h3.default=Wc;var DP=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),OP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),IP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&DP(t,r,e);return OP(t,r),t},wT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},T3=IP(Gt),gt=q1,CT=wT(p2),vr=wT(h3),VP=wT(Ue()),qt=jt,c2=G3;new T3.RegExpMap("letter",vr.default.variable,/[a-z]/i);new T3.RegExpMap("digit",vr.default.digit,/[0-9.,]/);new T3.RegExpMap("command",vr.default.controlSequence,/^\\/);new T3.MacroMap("special",{"{":"Open","}":"Close","~":"Tilde","^":"Superscript",_:"Subscript"," ":"Space"," ":"Space","\r":"Space","\n":"Space","'":"Prime","%":"Comment","&":"Entry","#":"Hash"," ":"Space","’":"Prime"},CT.default);new T3.CharacterMap("mathchar0mi",vr.default.mathchar0mi,{alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ϵ",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigma:"σ",tau:"τ",upsilon:"υ",phi:"ϕ",chi:"χ",psi:"ψ",omega:"ω",varepsilon:"ε",vartheta:"ϑ",varpi:"ϖ",varrho:"ϱ",varsigma:"ς",varphi:"φ",S:["§",{mathvariant:gt.TexConstant.Variant.NORMAL}],aleph:["ℵ",{mathvariant:gt.TexConstant.Variant.NORMAL}],hbar:["ℏ",{variantForm:!0}],imath:"ı",jmath:"ȷ",ell:"ℓ",wp:["℘",{mathvariant:gt.TexConstant.Variant.NORMAL}],Re:["ℜ",{mathvariant:gt.TexConstant.Variant.NORMAL}],Im:["ℑ",{mathvariant:gt.TexConstant.Variant.NORMAL}],partial:["∂",{mathvariant:gt.TexConstant.Variant.ITALIC}],infty:["∞",{mathvariant:gt.TexConstant.Variant.NORMAL}],prime:["′",{variantForm:!0}],emptyset:["∅",{mathvariant:gt.TexConstant.Variant.NORMAL}],nabla:["∇",{mathvariant:gt.TexConstant.Variant.NORMAL}],top:["⊤",{mathvariant:gt.TexConstant.Variant.NORMAL}],bot:["⊥",{mathvariant:gt.TexConstant.Variant.NORMAL}],angle:["∠",{mathvariant:gt.TexConstant.Variant.NORMAL}],triangle:["△",{mathvariant:gt.TexConstant.Variant.NORMAL}],backslash:["∖",{mathvariant:gt.TexConstant.Variant.NORMAL}],forall:["∀",{mathvariant:gt.TexConstant.Variant.NORMAL}],exists:["∃",{mathvariant:gt.TexConstant.Variant.NORMAL}],neg:["¬",{mathvariant:gt.TexConstant.Variant.NORMAL}],lnot:["¬",{mathvariant:gt.TexConstant.Variant.NORMAL}],flat:["♭",{mathvariant:gt.TexConstant.Variant.NORMAL}],natural:["♮",{mathvariant:gt.TexConstant.Variant.NORMAL}],sharp:["♯",{mathvariant:gt.TexConstant.Variant.NORMAL}],clubsuit:["♣",{mathvariant:gt.TexConstant.Variant.NORMAL}],diamondsuit:["♢",{mathvariant:gt.TexConstant.Variant.NORMAL}],heartsuit:["♡",{mathvariant:gt.TexConstant.Variant.NORMAL}],spadesuit:["♠",{mathvariant:gt.TexConstant.Variant.NORMAL}]});new T3.CharacterMap("mathchar0mo",vr.default.mathchar0mo,{surd:"√",coprod:["∐",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigvee:["⋁",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigwedge:["⋀",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],biguplus:["⨄",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigcap:["⋂",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigcup:["⋃",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],int:["∫",{texClass:qt.TEXCLASS.OP}],intop:["∫",{texClass:qt.TEXCLASS.OP,movesupsub:!0,movablelimits:!0}],iint:["∬",{texClass:qt.TEXCLASS.OP}],iiint:["∭",{texClass:qt.TEXCLASS.OP}],prod:["∏",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],sum:["∑",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigotimes:["⨂",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigoplus:["⨁",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],bigodot:["⨀",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],oint:["∮",{texClass:qt.TEXCLASS.OP}],bigsqcup:["⨆",{texClass:qt.TEXCLASS.OP,movesupsub:!0}],smallint:["∫",{largeop:!1}],triangleleft:"◃",triangleright:"▹",bigtriangleup:"△",bigtriangledown:"▽",wedge:"∧",land:"∧",vee:"∨",lor:"∨",cap:"∩",cup:"∪",ddagger:"‡",dagger:"†",sqcap:"⊓",sqcup:"⊔",uplus:"⊎",amalg:"⨿",diamond:"⋄",bullet:"∙",wr:"≀",div:"÷",divsymbol:"÷",odot:["⊙",{largeop:!1}],oslash:["⊘",{largeop:!1}],otimes:["⊗",{largeop:!1}],ominus:["⊖",{largeop:!1}],oplus:["⊕",{largeop:!1}],mp:"∓",pm:"±",circ:"∘",bigcirc:"◯",setminus:"∖",cdot:"⋅",ast:"∗",times:"×",star:"⋆",propto:"∝",sqsubseteq:"⊑",sqsupseteq:"⊒",parallel:"∥",mid:"∣",dashv:"⊣",vdash:"⊢",leq:"≤",le:"≤",geq:"≥",ge:"≥",lt:"<",gt:">",succ:"≻",prec:"≺",approx:"≈",succeq:"⪰",preceq:"⪯",supset:"⊃",subset:"⊂",supseteq:"⊇",subseteq:"⊆",in:"∈",ni:"∋",notin:"∉",owns:"∋",gg:"≫",ll:"≪",sim:"∼",simeq:"≃",perp:"⊥",equiv:"≡",asymp:"≍",smile:"⌣",frown:"⌢",ne:"≠",neq:"≠",cong:"≅",doteq:"≐",bowtie:"⋈",models:"⊨",notChar:"⧸",Leftrightarrow:"⇔",Leftarrow:"⇐",Rightarrow:"⇒",leftrightarrow:"↔",leftarrow:"←",gets:"←",rightarrow:"→",to:["→",{accent:!1}],mapsto:"↦",leftharpoonup:"↼",leftharpoondown:"↽",rightharpoonup:"⇀",rightharpoondown:"⇁",nearrow:"↗",searrow:"↘",nwarrow:"↖",swarrow:"↙",rightleftharpoons:"⇌",hookrightarrow:"↪",hookleftarrow:"↩",longleftarrow:"⟵",Longleftarrow:"⟸",longrightarrow:"⟶",Longrightarrow:"⟹",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",ldots:"…",cdots:"⋯",vdots:"⋮",ddots:"⋱",dotsc:"…",dotsb:"⋯",dotsm:"⋯",dotsi:"⋯",dotso:"…",ldotp:[".",{texClass:qt.TEXCLASS.PUNCT}],cdotp:["⋅",{texClass:qt.TEXCLASS.PUNCT}],colon:[":",{texClass:qt.TEXCLASS.PUNCT}]});new T3.CharacterMap("mathchar7",vr.default.mathchar7,{Gamma:"Γ",Delta:"Δ",Theta:"Θ",Lambda:"Λ",Xi:"Ξ",Pi:"Π",Sigma:"Σ",Upsilon:"Υ",Phi:"Φ",Psi:"Ψ",Omega:"Ω",_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"});new T3.DelimiterMap("delimiter",vr.default.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"⟨",">":"⟩","\\lt":"⟨","\\gt":"⟩","/":"/","|":["|",{texClass:qt.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"⎰","\\rmoustache":"⎱","\\lgroup":"⟮","\\rgroup":"⟯","\\arrowvert":"⏐","\\Arrowvert":"‖","\\bracevert":"⎪","\\Vert":["‖",{texClass:qt.TEXCLASS.ORD}],"\\|":["‖",{texClass:qt.TEXCLASS.ORD}],"\\vert":["|",{texClass:qt.TEXCLASS.ORD}],"\\uparrow":"↑","\\downarrow":"↓","\\updownarrow":"↕","\\Uparrow":"⇑","\\Downarrow":"⇓","\\Updownarrow":"⇕","\\backslash":"\\","\\rangle":"⟩","\\langle":"⟨","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"⌉","\\lceil":"⌈","\\rfloor":"⌋","\\lfloor":"⌊","\\lbrack":"[","\\rbrack":"]"});new T3.CommandMap("macros",{displaystyle:["SetStyle","D",!0,0],textstyle:["SetStyle","T",!1,0],scriptstyle:["SetStyle","S",!1,1],scriptscriptstyle:["SetStyle","SS",!1,2],rm:["SetFont",gt.TexConstant.Variant.NORMAL],mit:["SetFont",gt.TexConstant.Variant.ITALIC],oldstyle:["SetFont",gt.TexConstant.Variant.OLDSTYLE],cal:["SetFont",gt.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont",gt.TexConstant.Variant.MATHITALIC],bf:["SetFont",gt.TexConstant.Variant.BOLD],bbFont:["SetFont",gt.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",gt.TexConstant.Variant.SCRIPT],frak:["SetFont",gt.TexConstant.Variant.FRAKTUR],sf:["SetFont",gt.TexConstant.Variant.SANSSERIF],tt:["SetFont",gt.TexConstant.Variant.MONOSPACE],mathrm:["MathFont",gt.TexConstant.Variant.NORMAL],mathup:["MathFont",gt.TexConstant.Variant.NORMAL],mathnormal:["MathFont",""],mathbf:["MathFont",gt.TexConstant.Variant.BOLD],mathbfup:["MathFont",gt.TexConstant.Variant.BOLD],mathit:["MathFont",gt.TexConstant.Variant.MATHITALIC],mathbfit:["MathFont",gt.TexConstant.Variant.BOLDITALIC],mathbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],Bbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],mathfrak:["MathFont",gt.TexConstant.Variant.FRAKTUR],mathbffrak:["MathFont",gt.TexConstant.Variant.BOLDFRAKTUR],mathscr:["MathFont",gt.TexConstant.Variant.SCRIPT],mathbfscr:["MathFont",gt.TexConstant.Variant.BOLDSCRIPT],mathsf:["MathFont",gt.TexConstant.Variant.SANSSERIF],mathsfup:["MathFont",gt.TexConstant.Variant.SANSSERIF],mathbfsf:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],mathbfsfup:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],mathsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFITALIC],mathbfsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFBOLDITALIC],mathtt:["MathFont",gt.TexConstant.Variant.MONOSPACE],mathcal:["MathFont",gt.TexConstant.Variant.CALLIGRAPHIC],mathbfcal:["MathFont",gt.TexConstant.Variant.BOLDCALLIGRAPHIC],symrm:["MathFont",gt.TexConstant.Variant.NORMAL],symup:["MathFont",gt.TexConstant.Variant.NORMAL],symnormal:["MathFont",""],symbf:["MathFont",gt.TexConstant.Variant.BOLD],symbfup:["MathFont",gt.TexConstant.Variant.BOLD],symit:["MathFont",gt.TexConstant.Variant.ITALIC],symbfit:["MathFont",gt.TexConstant.Variant.BOLDITALIC],symbb:["MathFont",gt.TexConstant.Variant.DOUBLESTRUCK],symfrak:["MathFont",gt.TexConstant.Variant.FRAKTUR],symbffrak:["MathFont",gt.TexConstant.Variant.BOLDFRAKTUR],symscr:["MathFont",gt.TexConstant.Variant.SCRIPT],symbfscr:["MathFont",gt.TexConstant.Variant.BOLDSCRIPT],symsf:["MathFont",gt.TexConstant.Variant.SANSSERIF],symsfup:["MathFont",gt.TexConstant.Variant.SANSSERIF],symbfsf:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],symbfsfup:["MathFont",gt.TexConstant.Variant.BOLDSANSSERIF],symsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFITALIC],symbfsfit:["MathFont",gt.TexConstant.Variant.SANSSERIFBOLDITALIC],symtt:["MathFont",gt.TexConstant.Variant.MONOSPACE],symcal:["MathFont",gt.TexConstant.Variant.CALLIGRAPHIC],symbfcal:["MathFont",gt.TexConstant.Variant.BOLDCALLIGRAPHIC],textrm:["HBox",null,gt.TexConstant.Variant.NORMAL],textup:["HBox",null,gt.TexConstant.Variant.NORMAL],textnormal:["HBox"],textit:["HBox",null,gt.TexConstant.Variant.ITALIC],textbf:["HBox",null,gt.TexConstant.Variant.BOLD],textsf:["HBox",null,gt.TexConstant.Variant.SANSSERIF],texttt:["HBox",null,gt.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:"NamedFn",arccos:"NamedFn",arctan:"NamedFn",arg:"NamedFn",cos:"NamedFn",cosh:"NamedFn",cot:"NamedFn",coth:"NamedFn",csc:"NamedFn",deg:"NamedFn",det:"NamedOp",dim:"NamedFn",exp:"NamedFn",gcd:"NamedOp",hom:"NamedFn",inf:"NamedOp",ker:"NamedFn",lg:"NamedFn",lim:"NamedOp",liminf:["NamedOp","lim&thinsp;inf"],limsup:["NamedOp","lim&thinsp;sup"],ln:"NamedFn",log:"NamedFn",max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:"NamedFn",sin:"NamedFn",sinh:"NamedFn",sup:"NamedOp",tan:"NamedFn",tanh:"NamedFn",limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","2015"],underline:["UnderOver","2015"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overparen:["UnderOver","23DC"],underparen:["UnderOver","23DD"],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",overunderset:"Overunderset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:["Macro","\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"LeftRight",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",c2.MATHSPACE.thinmathspace],":":["Spacer",c2.MATHSPACE.mediummathspace],">":["Spacer",c2.MATHSPACE.mediummathspace],";":["Spacer",c2.MATHSPACE.thickmathspace],"!":["Spacer",c2.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",c2.MATHSPACE.thinmathspace],negthinspace:["Spacer",c2.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],nonscript:"Nonscript",big:["MakeBig",qt.TEXCLASS.ORD,.85],Big:["MakeBig",qt.TEXCLASS.ORD,1.15],bigg:["MakeBig",qt.TEXCLASS.ORD,1.45],Bigg:["MakeBig",qt.TEXCLASS.ORD,1.75],bigl:["MakeBig",qt.TEXCLASS.OPEN,.85],Bigl:["MakeBig",qt.TEXCLASS.OPEN,1.15],biggl:["MakeBig",qt.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",qt.TEXCLASS.OPEN,1.75],bigr:["MakeBig",qt.TEXCLASS.CLOSE,.85],Bigr:["MakeBig",qt.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",qt.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",qt.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",qt.TEXCLASS.REL,.85],Bigm:["MakeBig",qt.TEXCLASS.REL,1.15],biggm:["MakeBig",qt.TEXCLASS.REL,1.45],Biggm:["MakeBig",qt.TEXCLASS.REL,1.75],mathord:["TeXAtom",qt.TEXCLASS.ORD],mathop:["TeXAtom",qt.TEXCLASS.OP],mathopen:["TeXAtom",qt.TEXCLASS.OPEN],mathclose:["TeXAtom",qt.TEXCLASS.CLOSE],mathbin:["TeXAtom",qt.TEXCLASS.BIN],mathrel:["TeXAtom",qt.TEXCLASS.REL],mathpunct:["TeXAtom",qt.TEXCLASS.PUNCT],mathinner:["TeXAtom",qt.TEXCLASS.INNER],vcenter:["TeXAtom",qt.TEXCLASS.VCENTER],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],framebox:"FrameBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,!0],eqalign:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:["CrLaTeX",!0],hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D",null,"right"],leqalignno:["Matrix",null,null,"right left",(0,c2.em)(c2.MATHSPACE.thickmathspace),".5em","D",null,"left"],hfill:"HFill",hfil:"HFill",hfilll:"HFill",bmod:["Macro",'\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde"," ":"Tilde",begin:"BeginEnd",end:"BeginEnd",label:"HandleLabel",ref:"HandleRef",nonumber:"HandleNoTag",mathchoice:"MathChoice",mmlToken:"MmlToken"},CT.default);new T3.EnvironmentMap("environment",vr.default.environment,{array:["AlignedArray"],equation:["Equation",null,!0],eqnarray:["EqnArray",null,!0,!0,"rcl",VP.default.cols(0,c2.MATHSPACE.thickmathspace),".5em"]},CT.default);new T3.CharacterMap("not_remap",null,{"←":"↚","→":"↛","↔":"↮","⇐":"⇍","⇒":"⇏","⇔":"⇎","∈":"∉","∋":"∌","∣":"∤","∥":"∦","∼":"≁","~":"≁","≃":"≄","≅":"≇","≈":"≉","≍":"≭","=":"≠","≡":"≢","<":"≮",">":"≯","≤":"≰","≥":"≱","≲":"≴","≳":"≵","≶":"≸","≷":"≹","≺":"⊀","≻":"⊁","⊂":"⊄","⊃":"⊅","⊆":"⊈","⊇":"⊉","⊢":"⊬","⊨":"⊭","⊩":"⊮","⊫":"⊯","≼":"⋠","≽":"⋡","⊑":"⋢","⊒":"⋣","⊲":"⋪","⊳":"⋫","⊴":"⋬","⊵":"⋭","∃":"∄"});var PP=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),kP=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),RP=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),BP=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&kP(t,r,e);return RP(t,r),t},FP=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},e_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},We;Object.defineProperty(sr,"__esModule",{value:!0});sr.BaseConfiguration=sr.BaseTags=sr.Other=void 0;var NP=he,UP=S0,i_=e_(Le),jP=e_(Ne),GP=Gt,Jt=BP(Nt),zP=Hi,WP=dT;new GP.CharacterMap("remap",null,{"-":"−","*":"∗","`":"‘"});function r_(r,t){var e=r.stack.env.font,n=e?{mathvariant:r.stack.env.font}:{},s=UP.MapHandler.getMap("remap").lookup(t),a=(0,WP.getRange)(t),o=a?a[3]:"mo",l=r.create("token",o,n,s?s.char:t);a[4]&&l.attributes.set("mathvariant",a[4]),o==="mo"&&(jP.default.setProperty(l,"fixStretchy",!0),r.configuration.addNode("fixStretchy",l)),r.Push(l)}sr.Other=r_;function qP(r,t){throw new i_.default("UndefinedControlSequence","Undefined control sequence %1","\\"+t)}function ZP(r,t){throw new i_.default("UnknownEnv","Unknown environment '%1'",t)}function KP(r){var t,e,n=r.data;try{for(var s=FP(n.getList("nonscript")),a=s.next();!a.done;a=s.next()){var o=a.value;if(o.attributes.get("scriptlevel")>0){var l=o.parent;if(l.childNodes.splice(l.childIndex(o),1),n.removeFromList(o.kind,[o]),o.isKind("mrow")){var u=o.childNodes[0];n.removeFromList("mstyle",[u]),n.removeFromList("mspace",u.childNodes[0].childNodes)}}else o.isKind("mrow")&&(o.parent.replaceChild(o.childNodes[0],o),n.removeFromList("mrow",[o]))}}catch(h){t={error:h}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}var n_=function(r){PP(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(zP.AbstractTags);sr.BaseTags=n_;sr.BaseConfiguration=NP.Configuration.create("base",{handler:{character:["command","special","letter","digit"],delimiter:["delimiter"],macro:["delimiter","macros","mathchar0mi","mathchar0mo","mathchar7"],environment:["environment"]},fallback:{character:r_,macro:qP,environment:ZP},items:(We={},We[Jt.StartItem.prototype.kind]=Jt.StartItem,We[Jt.StopItem.prototype.kind]=Jt.StopItem,We[Jt.OpenItem.prototype.kind]=Jt.OpenItem,We[Jt.CloseItem.prototype.kind]=Jt.CloseItem,We[Jt.PrimeItem.prototype.kind]=Jt.PrimeItem,We[Jt.SubsupItem.prototype.kind]=Jt.SubsupItem,We[Jt.OverItem.prototype.kind]=Jt.OverItem,We[Jt.LeftItem.prototype.kind]=Jt.LeftItem,We[Jt.Middle.prototype.kind]=Jt.Middle,We[Jt.RightItem.prototype.kind]=Jt.RightItem,We[Jt.BeginItem.prototype.kind]=Jt.BeginItem,We[Jt.EndItem.prototype.kind]=Jt.EndItem,We[Jt.StyleItem.prototype.kind]=Jt.StyleItem,We[Jt.PositionItem.prototype.kind]=Jt.PositionItem,We[Jt.CellItem.prototype.kind]=Jt.CellItem,We[Jt.MmlItem.prototype.kind]=Jt.MmlItem,We[Jt.FnItem.prototype.kind]=Jt.FnItem,We[Jt.NotItem.prototype.kind]=Jt.NotItem,We[Jt.NonscriptItem.prototype.kind]=Jt.NonscriptItem,We[Jt.DotsItem.prototype.kind]=Jt.DotsItem,We[Jt.ArrayItem.prototype.kind]=Jt.ArrayItem,We[Jt.EqnArrayItem.prototype.kind]=Jt.EqnArrayItem,We[Jt.EquationItem.prototype.kind]=Jt.EquationItem,We),options:{maxMacros:1e3,baseURL:typeof document>"u"||document.getElementsByTagName("base").length===0?"":String(document.location).replace(/#.*$/,"")},tags:{base:n_},postprocessors:[[KP,-4]]});var XP=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),fo=_&&_.__assign||function(){return fo=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},fo.apply(this,arguments)},$P=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},A0=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(vT,"__esModule",{value:!0});var s_=vT.TeX=void 0,ig=r0,rg=H1,ng=x7,D4=A0(LT),sg=A0(Ne),YP=A0(e2()),JP=A0(Le),tk=A0(S7),Vs=Hi,ek=he,ik=function(r){XP(t,r);function t(e){e===void 0&&(e={});var n=this,s=$P((0,rg.separateOptions)(e,t.OPTIONS,ng.FindTeX.OPTIONS),3),a=s[0],o=s[1],l=s[2];n=r.call(this,o)||this,n.findTeX=n.options.FindTeX||new ng.FindTeX(l);var u=n.options.packages,h=n.configuration=t.configure(u),T=n._parseOptions=new tk.default(h,[n.options,Vs.TagsFactory.OPTIONS]);return(0,rg.userOptions)(T.options,a),h.config(n),t.tags(T,h),n.postFilters.add(D4.default.cleanSubSup,-6),n.postFilters.add(D4.default.setInherited,-5),n.postFilters.add(D4.default.moveLimits,-4),n.postFilters.add(D4.default.cleanStretchy,-3),n.postFilters.add(D4.default.cleanAttributes,-2),n.postFilters.add(D4.default.combineRelations,-1),n}return t.configure=function(e){var n=new ek.ParserConfiguration(e,["tex"]);return n.init(),n},t.tags=function(e,n){Vs.TagsFactory.addTags(n.tags),Vs.TagsFactory.setDefault(e.options.tags),e.tags=Vs.TagsFactory.getDefault(),e.tags.configuration=e},t.prototype.setMmlFactory=function(e){r.prototype.setMmlFactory.call(this,e),this._parseOptions.nodeFactory.setMmlFactory(e)},Object.defineProperty(t.prototype,"parseOptions",{get:function(){return this._parseOptions},enumerable:!1,configurable:!0}),t.prototype.reset=function(e){e===void 0&&(e=0),this.parseOptions.tags.reset(e)},t.prototype.compile=function(e,n){this.parseOptions.clear(),this.executeFilters(this.preFilters,e,n,this.parseOptions);var s=e.display;this.latex=e.math;var a;this.parseOptions.tags.startEquation(e);var o;try{var l=new YP.default(this.latex,{display:s,isInner:!1},this.parseOptions);a=l.mml(),o=l.stack.global}catch(u){if(!(u instanceof JP.default))throw u;this.parseOptions.error=!0,a=this.options.formatError(this,u)}return a=this.parseOptions.nodeFactory.create("node","math",[a]),o!=null&&o.indentalign&&sg.default.setAttribute(a,"indentalign",o.indentalign),s&&sg.default.setAttribute(a,"display","block"),this.parseOptions.tags.finishEquation(e),this.parseOptions.root=a,this.executeFilters(this.postFilters,e,n,this.parseOptions),this.mathNode=this.parseOptions.root,this.mathNode},t.prototype.findMath=function(e){return this.findTeX.findMath(e)},t.prototype.formatError=function(e){var n=e.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",n,e.id,this.latex)},t.NAME="TeX",t.OPTIONS=fo(fo({},ig.AbstractInputJax.OPTIONS),{FindTeX:null,packages:["base"],digits:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,maxBuffer:5*1024,formatError:function(e,n){return e.formatError(n)}}),t}(ig.AbstractInputJax);s_=vT.TeX=ik;var DT={},rk={};(function(r){var t=_&&_.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.ActionConfiguration=r.ActionMethods=void 0;var e=he,n=t(e2()),s=Gt,a=t(p2);r.ActionMethods={},r.ActionMethods.Macro=a.default.Macro,r.ActionMethods.Toggle=function(o,l){for(var u=[],h;(h=o.GetArgument(l))!=="\\endtoggle";)u.push(new n.default(h,o.stack.env,o.configuration).mml());o.Push(o.create("node","maction",u,{actiontype:"toggle"}))},r.ActionMethods.Mathtip=function(o,l){var u=o.ParseArg(l),h=o.ParseArg(l);o.Push(o.create("node","maction",[u,h],{actiontype:"tooltip"}))},new s.CommandMap("action-macros",{toggle:"Toggle",mathtip:"Mathtip",texttip:["Macro","\\mathtip{#1}{\\text{#2}}",2]},r.ActionMethods),r.ActionConfiguration=e.Configuration.create("action",{handler:{macro:["action-macros"]}})})(rk);var Dn={},o4={},a_=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),qc=_&&_.__assign||function(){return qc=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},qc.apply(this,arguments)},OT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(o4,"__esModule",{value:!0});o4.FlalignItem=o4.MultlineItem=void 0;var o_=Nt,nk=OT(Ue()),P2=OT(Ne),l_=OT(Le),P9=q1,sk=function(r){a_(t,r);function t(e){for(var n=[],s=1;s<arguments.length;s++)n[s-1]=arguments[s];var a=r.call(this,e)||this;return a.factory.configuration.tags.start("multline",!0,n[0]),a}return Object.defineProperty(t.prototype,"kind",{get:function(){return"multline"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){this.table.length&&nk.default.fixInitialMO(this.factory.configuration,this.nodes);var e=this.getProperty("shove"),n=this.create("node","mtd",this.nodes,e?{columnalign:e}:{});this.setProperty("shove",null),this.row.push(n),this.Clear()},t.prototype.EndRow=function(){if(this.row.length!==1)throw new l_.default("MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline");var e=this.create("node","mtr",this.row);this.table.push(e),this.row=[]},t.prototype.EndTable=function(){if(r.prototype.EndTable.call(this),this.table.length){var e=this.table.length-1,n=-1;P2.default.getAttribute(P2.default.getChildren(this.table[0])[0],"columnalign")||P2.default.setAttribute(P2.default.getChildren(this.table[0])[0],"columnalign",P9.TexConstant.Align.LEFT),P2.default.getAttribute(P2.default.getChildren(this.table[e])[0],"columnalign")||P2.default.setAttribute(P2.default.getChildren(this.table[e])[0],"columnalign",P9.TexConstant.Align.RIGHT);var s=this.factory.configuration.tags.getTag();if(s){n=this.arraydef.side===P9.TexConstant.Align.LEFT?0:this.table.length-1;var a=this.table[n],o=this.create("node","mlabeledtr",[s].concat(P2.default.getChildren(a)));P2.default.copyAttributes(a,o),this.table[n]=o}}this.factory.configuration.tags.end()},t}(o_.ArrayItem);o4.MultlineItem=sk;var ak=function(r){a_(t,r);function t(e,n,s,a,o){var l=r.call(this,e)||this;return l.name=n,l.numbered=s,l.padded=a,l.center=o,l.factory.configuration.tags.start(n,s,s),l}return Object.defineProperty(t.prototype,"kind",{get:function(){return"flalign"},enumerable:!1,configurable:!0}),t.prototype.EndEntry=function(){r.prototype.EndEntry.call(this);var e=this.getProperty("xalignat");if(e&&this.row.length>e)throw new l_.default("XalignOverflow","Extra %1 in row of %2","&",this.name)},t.prototype.EndRow=function(){for(var e,n=this.row,s=this.getProperty("xalignat");n.length<s;)n.push(this.create("node","mtd"));for(this.row=[],this.padded&&this.row.push(this.create("node","mtd"));e=n.shift();)this.row.push(e),e=n.shift(),e&&this.row.push(e),(n.length||this.padded)&&this.row.push(this.create("node","mtd"));this.row.length>this.maxrow&&(this.maxrow=this.row.length),r.prototype.EndRow.call(this);var a=this.table[this.table.length-1];if(this.getProperty("zeroWidthLabel")&&a.isKind("mlabeledtr")){var o=P2.default.getChildren(a)[0],l=this.factory.configuration.options.tagSide,u=qc({width:0},l==="right"?{lspace:"-1width"}:{}),h=this.create("node","mpadded",P2.default.getChildren(o),u);o.setChildren([h])}},t.prototype.EndTable=function(){if(r.prototype.EndTable.call(this),this.center&&this.maxrow<=2){var e=this.arraydef;delete e.width,delete this.global.indentalign}},t}(o_.EqnArrayItem);o4.FlalignItem=ak;var Yn={};(function(r){var t=_&&_.__assign||function(){return t=Object.assign||function(y){for(var c,Q=1,g=arguments.length;Q<g;Q++){c=arguments[Q];for(var v in c)Object.prototype.hasOwnProperty.call(c,v)&&(y[v]=c[v])}return y},t.apply(this,arguments)},e=_&&_.__read||function(y,c){var Q=typeof Symbol=="function"&&y[Symbol.iterator];if(!Q)return y;var g=Q.call(y),v,L=[],x;try{for(;(c===void 0||c-- >0)&&!(v=g.next()).done;)L.push(v.value)}catch(b){x={error:b}}finally{try{v&&!v.done&&(Q=g.return)&&Q.call(g)}finally{if(x)throw x.error}}return L},n=_&&_.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(r,"__esModule",{value:!0}),r.NEW_OPS=r.AmsMethods=void 0;var s=n(Ue()),a=n(h3),o=n(Ne),l=q1,u=n(e2()),h=n(Le),T=s3,f=n(p2),d=jt;r.AmsMethods={},r.AmsMethods.AmsEqnArray=function(y,c,Q,g,v,L,x){var b=y.GetBrackets("\\begin{"+c.getName()+"}"),S=f.default.EqnArray(y,c,Q,g,v,L,x);return s.default.setArrayAlign(S,b)},r.AmsMethods.AlignAt=function(y,c,Q,g){var v=c.getName(),L,x,b="",S=[];if(g||(x=y.GetBrackets("\\begin{"+v+"}")),L=y.GetArgument("\\begin{"+v+"}"),L.match(/[^0-9]/))throw new h.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+v+"}");for(var E=parseInt(L,10);E>0;)b+="rl",S.push("0em 0em"),E--;var A=S.join(" ");if(g)return r.AmsMethods.EqnArray(y,c,Q,g,b,A);var M=r.AmsMethods.EqnArray(y,c,Q,g,b,A);return s.default.setArrayAlign(M,x)},r.AmsMethods.Multline=function(y,c,Q){y.Push(c),s.default.checkEqnEnv(y);var g=y.itemFactory.create("multline",Q,y.stack);return g.arraydef={displaystyle:!0,rowspacing:".5em",columnspacing:"100%",width:y.options.ams.multlineWidth,side:y.options.tagSide,minlabelspacing:y.options.tagIndent,framespacing:y.options.ams.multlineIndent+" 0",frame:"","data-width-includes-label":!0},g},r.AmsMethods.XalignAt=function(y,c,Q,g){var v=y.GetArgument("\\begin{"+c.getName()+"}");if(v.match(/[^0-9]/))throw new h.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+c.getName()+"}");var L=g?"crl":"rlc",x=g?"fit auto auto":"auto auto fit",b=r.AmsMethods.FlalignArray(y,c,Q,g,!1,L,x,!0);return b.setProperty("xalignat",2*parseInt(v)),b},r.AmsMethods.FlalignArray=function(y,c,Q,g,v,L,x,b){b===void 0&&(b=!1),y.Push(c),s.default.checkEqnEnv(y),L=L.split("").join(" ").replace(/r/g,"right").replace(/l/g,"left").replace(/c/g,"center");var S=y.itemFactory.create("flalign",c.getName(),Q,g,v,y.stack);return S.arraydef={width:"100%",displaystyle:!0,columnalign:L,columnspacing:"0em",columnwidth:x,rowspacing:"3pt",side:y.options.tagSide,minlabelspacing:b?"0":y.options.tagIndent,"data-width-includes-label":!0},S.setProperty("zeroWidthLabel",b),S},r.NEW_OPS="ams-declare-ops",r.AmsMethods.HandleDeclareOp=function(y,c){var Q=y.GetStar()?"*":"",g=s.default.trimSpaces(y.GetArgument(c));g.charAt(0)==="\\"&&(g=g.substr(1));var v=y.GetArgument(c);y.configuration.handlers.retrieve(r.NEW_OPS).add(g,new T.Macro(g,r.AmsMethods.Macro,["\\operatorname".concat(Q,"{").concat(v,"}")]))},r.AmsMethods.HandleOperatorName=function(y,c){var Q=y.GetStar(),g=s.default.trimSpaces(y.GetArgument(c)),v=new u.default(g,t(t({},y.stack.env),{font:l.TexConstant.Variant.NORMAL,multiLetterIdentifiers:/^[-*a-z]+/i,operatorLetters:!0}),y.configuration).mml();if(v.isKind("mi")||(v=y.create("node","TeXAtom",[v])),o.default.setProperties(v,{movesupsub:Q,movablelimits:!0,texClass:d.TEXCLASS.OP}),!Q){var L=y.GetNext(),x=y.i;L==="\\"&&++y.i&&y.GetCS()!=="limits"&&(y.i=x)}y.Push(v)},r.AmsMethods.SideSet=function(y,c){var Q=e(p(y.ParseArg(c)),2),g=Q[0],v=Q[1],L=e(p(y.ParseArg(c)),2),x=L[0],b=L[1],S=y.ParseArg(c),E=S;g&&(v?g.replaceChild(y.create("node","mphantom",[y.create("node","mpadded",[s.default.copyNode(S,y)],{width:0})]),o.default.getChildAt(g,0)):(E=y.create("node","mmultiscripts",[S]),x&&o.default.appendChildren(E,[o.default.getChildAt(x,1)||y.create("node","none"),o.default.getChildAt(x,2)||y.create("node","none")]),o.default.setProperty(E,"scriptalign","left"),o.default.appendChildren(E,[y.create("node","mprescripts"),o.default.getChildAt(g,1)||y.create("node","none"),o.default.getChildAt(g,2)||y.create("node","none")]))),x&&E===S&&(x.replaceChild(S,o.default.getChildAt(x,0)),E=x);var A=y.create("node","TeXAtom",[],{texClass:d.TEXCLASS.OP,movesupsub:!0,movablelimits:!0});v&&(g&&A.appendChild(g),A.appendChild(v)),A.appendChild(E),b&&A.appendChild(b),y.Push(A)};function p(y){if(!y||y.isInferred&&y.childNodes.length===0)return[null,null];if(y.isKind("msubsup")&&m(y))return[y,null];var c=o.default.getChildAt(y,0);return y.isInferred&&c&&m(c)?(y.childNodes.splice(0,1),[c,y]):[null,y]}function m(y){var c=y.childNodes[0];return c&&c.isKind("mi")&&c.getText()===""}r.AmsMethods.operatorLetter=function(y,c){return y.stack.env.operatorLetters?a.default.variable(y,c):!1},r.AmsMethods.MultiIntegral=function(y,c,Q){var g=y.GetNext();if(g==="\\"){var v=y.i;g=y.GetArgument(c),y.i=v,g==="\\limits"&&(c==="\\idotsint"?Q="\\!\\!\\mathop{\\,\\,"+Q+"}":Q="\\!\\!\\!\\mathop{\\,\\,\\,"+Q+"}")}y.string=Q+" "+y.string.slice(y.i),y.i=0},r.AmsMethods.xArrow=function(y,c,Q,g,v){var L={width:"+"+s.default.Em((g+v)/18),lspace:s.default.Em(g/18)},x=y.GetBrackets(c),b=y.ParseArg(c),S=y.create("node","mspace",[],{depth:".25em"}),E=y.create("token","mo",{stretchy:!0,texClass:d.TEXCLASS.REL},String.fromCodePoint(Q));E=y.create("node","mstyle",[E],{scriptlevel:0});var A=y.create("node","munderover",[E]),M=y.create("node","mpadded",[b,S],L);if(o.default.setAttribute(M,"voffset","-.2em"),o.default.setAttribute(M,"height","-.2em"),o.default.setChild(A,A.over,M),x){var D=new u.default(x,y.stack.env,y.configuration).mml(),I=y.create("node","mspace",[],{height:".75em"});M=y.create("node","mpadded",[D,I],L),o.default.setAttribute(M,"voffset",".15em"),o.default.setAttribute(M,"depth","-.15em"),o.default.setChild(A,A.under,M)}o.default.setProperty(A,"subsupOK",!0),y.Push(A)},r.AmsMethods.HandleShove=function(y,c,Q){var g=y.stack.Top();if(g.kind!=="multline")throw new h.default("CommandOnlyAllowedInEnv","%1 only allowed in %2 environment",y.currentCS,"multline");if(g.Size())throw new h.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",y.currentCS);g.setProperty("shove",Q)},r.AmsMethods.CFrac=function(y,c){var Q=s.default.trimSpaces(y.GetBrackets(c,"")),g=y.GetArgument(c),v=y.GetArgument(c),L={l:l.TexConstant.Align.LEFT,r:l.TexConstant.Align.RIGHT,"":""},x=new u.default("\\strut\\textstyle{"+g+"}",y.stack.env,y.configuration).mml(),b=new u.default("\\strut\\textstyle{"+v+"}",y.stack.env,y.configuration).mml(),S=y.create("node","mfrac",[x,b]);if(Q=L[Q],Q==null)throw new h.default("IllegalAlign","Illegal alignment specified in %1",y.currentCS);Q&&o.default.setProperties(S,{numalign:Q,denomalign:Q}),y.Push(S)},r.AmsMethods.Genfrac=function(y,c,Q,g,v,L){Q==null&&(Q=y.GetDelimiterArg(c)),g==null&&(g=y.GetDelimiterArg(c)),v==null&&(v=y.GetArgument(c)),L==null&&(L=s.default.trimSpaces(y.GetArgument(c)));var x=y.ParseArg(c),b=y.ParseArg(c),S=y.create("node","mfrac",[x,b]);if(v!==""&&o.default.setAttribute(S,"linethickness",v),(Q||g)&&(o.default.setProperty(S,"withDelims",!0),S=s.default.fixedFence(y.configuration,Q,S,g)),L!==""){var E=parseInt(L,10),A=["D","T","S","SS"][E];if(A==null)throw new h.default("BadMathStyleFor","Bad math style for %1",y.currentCS);S=y.create("node","mstyle",[S]),A==="D"?o.default.setProperties(S,{displaystyle:!0,scriptlevel:0}):o.default.setProperties(S,{displaystyle:!1,scriptlevel:E-1})}y.Push(S)},r.AmsMethods.HandleTag=function(y,c){if(!y.tags.currentTag.taggable&&y.tags.env)throw new h.default("CommandNotAllowedInEnv","%1 not allowed in %2 environment",y.currentCS,y.tags.env);if(y.tags.currentTag.tag)throw new h.default("MultipleCommand","Multiple %1",y.currentCS);var Q=y.GetStar(),g=s.default.trimSpaces(y.GetArgument(c));y.tags.tag(g,Q)},r.AmsMethods.HandleNoTag=f.default.HandleNoTag,r.AmsMethods.HandleRef=f.default.HandleRef,r.AmsMethods.Macro=f.default.Macro,r.AmsMethods.Accent=f.default.Accent,r.AmsMethods.Tilde=f.default.Tilde,r.AmsMethods.Array=f.default.Array,r.AmsMethods.Spacer=f.default.Spacer,r.AmsMethods.NamedOp=f.default.NamedOp,r.AmsMethods.EqnArray=f.default.EqnArray,r.AmsMethods.Equation=f.default.Equation})(Yn);var ok=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),lk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),uk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&ok(t,r,e);return lk(t,r),t},u_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},H7=Yn,Mi=uk(Gt),X1=q1,Jn=u_(h3),Hr=u_(Ue()),a5=jt,Zc=G3;new Mi.CharacterMap("AMSmath-mathchar0mo",Jn.default.mathchar0mo,{iiiint:["⨌",{texClass:a5.TEXCLASS.OP}]});new Mi.RegExpMap("AMSmath-operatorLetter",H7.AmsMethods.operatorLetter,/[-*]/i);new Mi.CommandMap("AMSmath-macros",{mathring:["Accent","02DA"],nobreakspace:"Tilde",negmedspace:["Spacer",Zc.MATHSPACE.negativemediummathspace],negthickspace:["Spacer",Zc.MATHSPACE.negativethickmathspace],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Accent","20DB"],ddddot:["Accent","20DC"],sideset:"SideSet",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",eqref:["HandleRef",!0],substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["NamedOp","inj&thinsp;lim"],projlim:["NamedOp","proj&thinsp;lim"],varliminf:["Macro","\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:["Macro","\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","","1"],dfrac:["Genfrac","","","","0"],binom:["Genfrac","(",")","0",""],tbinom:["Genfrac","(",")","0","1"],dbinom:["Genfrac","(",")","0","0"],cfrac:"CFrac",shoveleft:["HandleShove",X1.TexConstant.Align.LEFT],shoveright:["HandleShove",X1.TexConstant.Align.RIGHT],xrightarrow:["xArrow",8594,5,10],xleftarrow:["xArrow",8592,10,5]},H7.AmsMethods);new Mi.EnvironmentMap("AMSmath-environment",Jn.default.environment,{"equation*":["Equation",null,!1],"eqnarray*":["EqnArray",null,!1,!0,"rcl",Hr.default.cols(0,Zc.MATHSPACE.thickmathspace),".5em"],align:["EqnArray",null,!0,!0,"rl",Hr.default.cols(0,2)],"align*":["EqnArray",null,!1,!0,"rl",Hr.default.cols(0,2)],multline:["Multline",null,!0],"multline*":["Multline",null,!1],split:["EqnArray",null,!1,!1,"rl",Hr.default.cols(0)],gather:["EqnArray",null,!0,!0,"c"],"gather*":["EqnArray",null,!1,!0,"c"],alignat:["AlignAt",null,!0,!0],"alignat*":["AlignAt",null,!1,!0],alignedat:["AlignAt",null,!1,!1],aligned:["AmsEqnArray",null,null,null,"rl",Hr.default.cols(0,2),".5em","D"],gathered:["AmsEqnArray",null,null,null,"c",null,".5em","D"],xalignat:["XalignAt",null,!0,!0],"xalignat*":["XalignAt",null,!1,!0],xxalignat:["XalignAt",null,!1,!1],flalign:["FlalignArray",null,!0,!1,!0,"rlc","auto auto fit"],"flalign*":["FlalignArray",null,!1,!1,!0,"rlc","auto auto fit"],subarray:["Array",null,null,null,null,Hr.default.cols(0),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",Hr.default.cols(1/3),".2em","S",1],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".2em","T"]},H7.AmsMethods);new Mi.DelimiterMap("AMSmath-delimiter",Jn.default.delimiter,{"\\lvert":["|",{texClass:a5.TEXCLASS.OPEN}],"\\rvert":["|",{texClass:a5.TEXCLASS.CLOSE}],"\\lVert":["‖",{texClass:a5.TEXCLASS.OPEN}],"\\rVert":["‖",{texClass:a5.TEXCLASS.CLOSE}]});new Mi.CharacterMap("AMSsymbols-mathchar0mi",Jn.default.mathchar0mi,{digamma:"ϝ",varkappa:"ϰ",varGamma:["Γ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varDelta:["Δ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varTheta:["Θ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varLambda:["Λ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varXi:["Ξ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPi:["Π",{mathvariant:X1.TexConstant.Variant.ITALIC}],varSigma:["Σ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varUpsilon:["Υ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPhi:["Φ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varPsi:["Ψ",{mathvariant:X1.TexConstant.Variant.ITALIC}],varOmega:["Ω",{mathvariant:X1.TexConstant.Variant.ITALIC}],beth:"ℶ",gimel:"ℷ",daleth:"ℸ",backprime:["‵",{variantForm:!0}],hslash:"ℏ",varnothing:["∅",{variantForm:!0}],blacktriangle:"▴",triangledown:["▽",{variantForm:!0}],blacktriangledown:"▾",square:"◻",Box:"◻",blacksquare:"◼",lozenge:"◊",Diamond:"◊",blacklozenge:"⧫",circledS:["Ⓢ",{mathvariant:X1.TexConstant.Variant.NORMAL}],bigstar:"★",sphericalangle:"∢",measuredangle:"∡",nexists:"∄",complement:"∁",mho:"℧",eth:["ð",{mathvariant:X1.TexConstant.Variant.NORMAL}],Finv:"Ⅎ",diagup:"╱",Game:"⅁",diagdown:"╲",Bbbk:["k",{mathvariant:X1.TexConstant.Variant.DOUBLESTRUCK}],yen:"¥",circledR:"®",checkmark:"✓",maltese:"✠"});new Mi.CharacterMap("AMSsymbols-mathchar0mo",Jn.default.mathchar0mo,{dotplus:"∔",ltimes:"⋉",smallsetminus:["∖",{variantForm:!0}],rtimes:"⋊",Cap:"⋒",doublecap:"⋒",leftthreetimes:"⋋",Cup:"⋓",doublecup:"⋓",rightthreetimes:"⋌",barwedge:"⊼",curlywedge:"⋏",veebar:"⊻",curlyvee:"⋎",doublebarwedge:"⩞",boxminus:"⊟",circleddash:"⊝",boxtimes:"⊠",circledast:"⊛",boxdot:"⊡",circledcirc:"⊚",boxplus:"⊞",centerdot:["⋅",{variantForm:!0}],divideontimes:"⋇",intercal:"⊺",leqq:"≦",geqq:"≧",leqslant:"⩽",geqslant:"⩾",eqslantless:"⪕",eqslantgtr:"⪖",lesssim:"≲",gtrsim:"≳",lessapprox:"⪅",gtrapprox:"⪆",approxeq:"≊",lessdot:"⋖",gtrdot:"⋗",lll:"⋘",llless:"⋘",ggg:"⋙",gggtr:"⋙",lessgtr:"≶",gtrless:"≷",lesseqgtr:"⋚",gtreqless:"⋛",lesseqqgtr:"⪋",gtreqqless:"⪌",doteqdot:"≑",Doteq:"≑",eqcirc:"≖",risingdotseq:"≓",circeq:"≗",fallingdotseq:"≒",triangleq:"≜",backsim:"∽",thicksim:["∼",{variantForm:!0}],backsimeq:"⋍",thickapprox:["≈",{variantForm:!0}],subseteqq:"⫅",supseteqq:"⫆",Subset:"⋐",Supset:"⋑",sqsubset:"⊏",sqsupset:"⊐",preccurlyeq:"≼",succcurlyeq:"≽",curlyeqprec:"⋞",curlyeqsucc:"⋟",precsim:"≾",succsim:"≿",precapprox:"⪷",succapprox:"⪸",vartriangleleft:"⊲",lhd:"⊲",vartriangleright:"⊳",rhd:"⊳",trianglelefteq:"⊴",unlhd:"⊴",trianglerighteq:"⊵",unrhd:"⊵",vDash:["⊨",{variantForm:!0}],Vdash:"⊩",Vvdash:"⊪",smallsmile:["⌣",{variantForm:!0}],shortmid:["∣",{variantForm:!0}],smallfrown:["⌢",{variantForm:!0}],shortparallel:["∥",{variantForm:!0}],bumpeq:"≏",between:"≬",Bumpeq:"≎",pitchfork:"⋔",varpropto:["∝",{variantForm:!0}],backepsilon:"∍",blacktriangleleft:"◂",blacktriangleright:"▸",therefore:"∴",because:"∵",eqsim:"≂",vartriangle:["△",{variantForm:!0}],Join:"⋈",nless:"≮",ngtr:"≯",nleq:"≰",ngeq:"≱",nleqslant:["⪇",{variantForm:!0}],ngeqslant:["⪈",{variantForm:!0}],nleqq:["≰",{variantForm:!0}],ngeqq:["≱",{variantForm:!0}],lneq:"⪇",gneq:"⪈",lneqq:"≨",gneqq:"≩",lvertneqq:["≨",{variantForm:!0}],gvertneqq:["≩",{variantForm:!0}],lnsim:"⋦",gnsim:"⋧",lnapprox:"⪉",gnapprox:"⪊",nprec:"⊀",nsucc:"⊁",npreceq:["⋠",{variantForm:!0}],nsucceq:["⋡",{variantForm:!0}],precneqq:"⪵",succneqq:"⪶",precnsim:"⋨",succnsim:"⋩",precnapprox:"⪹",succnapprox:"⪺",nsim:"≁",ncong:"≇",nshortmid:["∤",{variantForm:!0}],nshortparallel:["∦",{variantForm:!0}],nmid:"∤",nparallel:"∦",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",ntriangleleft:"⋪",ntriangleright:"⋫",ntrianglelefteq:"⋬",ntrianglerighteq:"⋭",nsubseteq:"⊈",nsupseteq:"⊉",nsubseteqq:["⊈",{variantForm:!0}],nsupseteqq:["⊉",{variantForm:!0}],subsetneq:"⊊",supsetneq:"⊋",varsubsetneq:["⊊",{variantForm:!0}],varsupsetneq:["⊋",{variantForm:!0}],subsetneqq:"⫋",supsetneqq:"⫌",varsubsetneqq:["⫋",{variantForm:!0}],varsupsetneqq:["⫌",{variantForm:!0}],leftleftarrows:"⇇",rightrightarrows:"⇉",leftrightarrows:"⇆",rightleftarrows:"⇄",Lleftarrow:"⇚",Rrightarrow:"⇛",twoheadleftarrow:"↞",twoheadrightarrow:"↠",leftarrowtail:"↢",rightarrowtail:"↣",looparrowleft:"↫",looparrowright:"↬",leftrightharpoons:"⇋",rightleftharpoons:["⇌",{variantForm:!0}],curvearrowleft:"↶",curvearrowright:"↷",circlearrowleft:"↺",circlearrowright:"↻",Lsh:"↰",Rsh:"↱",upuparrows:"⇈",downdownarrows:"⇊",upharpoonleft:"↿",upharpoonright:"↾",downharpoonleft:"⇃",restriction:"↾",multimap:"⊸",downharpoonright:"⇂",leftrightsquigarrow:"↭",rightsquigarrow:"⇝",leadsto:"⇝",dashrightarrow:"⇢",dashleftarrow:"⇠",nleftarrow:"↚",nrightarrow:"↛",nLeftarrow:"⇍",nRightarrow:"⇏",nleftrightarrow:"↮",nLeftrightarrow:"⇎"});new Mi.DelimiterMap("AMSsymbols-delimiter",Jn.default.delimiter,{"\\ulcorner":"⌜","\\urcorner":"⌝","\\llcorner":"⌞","\\lrcorner":"⌟"});new Mi.CommandMap("AMSsymbols-macros",{implies:["Macro","\\;\\Longrightarrow\\;"],impliedby:["Macro","\\;\\Longleftarrow\\;"]},H7.AmsMethods);var ck=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ps;Object.defineProperty(Dn,"__esModule",{value:!0});Dn.AmsConfiguration=Dn.AmsTags=void 0;var c_=he,ks=o4,hk=Hi,ag=Yn,Tk=Gt,h_=function(r){ck(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(hk.AbstractTags);Dn.AmsTags=h_;var fk=function(r){new Tk.CommandMap(ag.NEW_OPS,{},{}),r.append(c_.Configuration.local({handler:{macro:[ag.NEW_OPS]},priority:-1}))};Dn.AmsConfiguration=c_.Configuration.create("ams",{handler:{character:["AMSmath-operatorLetter"],delimiter:["AMSsymbols-delimiter","AMSmath-delimiter"],macro:["AMSsymbols-mathchar0mi","AMSsymbols-mathchar0mo","AMSsymbols-delimiter","AMSsymbols-macros","AMSmath-mathchar0mo","AMSmath-macros","AMSmath-delimiter"],environment:["AMSmath-environment"]},items:(Ps={},Ps[ks.MultlineItem.prototype.kind]=ks.MultlineItem,Ps[ks.FlalignItem.prototype.kind]=ks.FlalignItem,Ps),tags:{ams:h_},init:fk,config:function(r,t){t.parseOptions.options.multlineWidth&&(t.parseOptions.options.ams.multlineWidth=t.parseOptions.options.multlineWidth),delete t.parseOptions.options.multlineWidth},options:{multlineWidth:"",ams:{multlineWidth:"100%",multlineIndent:"1em"}}});var IT={},VT={},T_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(VT,"__esModule",{value:!0});var Rs=T_(e2()),Qk=sr,dk=jt,O4=T_(Ne),Qi={};Qi.CD=function(r,t){r.Push(t);var e=r.itemFactory.create("array"),n=r.configuration.options.amscd;return e.setProperties({minw:r.stack.env.CD_minw||n.harrowsize,minh:r.stack.env.CD_minh||n.varrowsize}),e.arraydef={columnalign:"center",columnspacing:n.colspace,rowspacing:n.rowspace,displaystyle:!0},e};Qi.arrow=function(r,t){var e=r.string.charAt(r.i);if(e.match(/[><VA.|=]/))r.i++;else return(0,Qk.Other)(r,t);var n=r.stack.Top();(!n.isKind("array")||n.Size())&&(Qi.cell(r,t),n=r.stack.Top());for(var s=n,a=s.table.length%2===1,o=(s.row.length+(a?0:1))%2;o;)Qi.cell(r,t),o--;var l,u={minsize:s.getProperty("minw"),stretchy:!0},h={minsize:s.getProperty("minh"),stretchy:!0,symmetric:!0,lspace:0,rspace:0};if(e!==".")if(e==="|")l=r.create("token","mo",h,"∥");else if(e==="=")l=r.create("token","mo",u,"=");else{var T={">":"→","<":"←",V:"↓",A:"↑"}[e],f=r.GetUpTo(t+e,e),d=r.GetUpTo(t+e,e);if(e===">"||e==="<"){if(l=r.create("token","mo",u,T),f||(f="\\kern "+s.getProperty("minw")),f||d){var p={width:"+.67em",lspace:".33em"};if(l=r.create("node","munderover",[l]),f){var m=new Rs.default(f,r.stack.env,r.configuration).mml(),y=r.create("node","mpadded",[m],p);O4.default.setAttribute(y,"voffset",".1em"),O4.default.setChild(l,l.over,y)}if(d){var c=new Rs.default(d,r.stack.env,r.configuration).mml();O4.default.setChild(l,l.under,r.create("node","mpadded",[c],p))}r.configuration.options.amscd.hideHorizontalLabels&&(l=r.create("node","mpadded",l,{depth:0,height:".67em"}))}}else{var Q=r.create("token","mo",h,T);l=Q,(f||d)&&(l=r.create("node","mrow"),f&&O4.default.appendChildren(l,[new Rs.default("\\scriptstyle\\llap{"+f+"}",r.stack.env,r.configuration).mml()]),Q.texClass=dk.TEXCLASS.ORD,O4.default.appendChildren(l,[Q]),d&&O4.default.appendChildren(l,[new Rs.default("\\scriptstyle\\rlap{"+d+"}",r.stack.env,r.configuration).mml()]))}}l&&r.Push(l),Qi.cell(r,t)};Qi.cell=function(r,t){var e=r.stack.Top();(e.table||[]).length%2===0&&(e.row||[]).length===0&&r.Push(r.create("node","mpadded",[],{height:"8.5pt",depth:"2pt"})),r.Push(r.itemFactory.create("cell").setProperties({isEntry:!0,name:t}))};Qi.minCDarrowwidth=function(r,t){r.stack.env.CD_minw=r.GetDimen(t)};Qi.minCDarrowheight=function(r,t){r.stack.env.CD_minh=r.GetDimen(t)};VT.default=Qi;var pk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),gk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),mk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&pk(t,r,e);return gk(t,r),t},f_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},PT=mk(Gt),yk=f_(h3),kT=f_(VT);new PT.EnvironmentMap("amscd_environment",yk.default.environment,{CD:"CD"},kT.default);new PT.CommandMap("amscd_macros",{minCDarrowwidth:"minCDarrowwidth",minCDarrowheight:"minCDarrowheight"},kT.default);new PT.MacroMap("amscd_special",{"@":"arrow"},kT.default);Object.defineProperty(IT,"__esModule",{value:!0});IT.AmsCdConfiguration=void 0;var vk=he;IT.AmsCdConfiguration=vk.Configuration.create("amscd",{handler:{character:["amscd_special"],macro:["amscd_macros"],environment:["amscd_environment"]},options:{amscd:{colspace:"5pt",rowspace:"5pt",harrowsize:"2.75em",varrowsize:"1.75em",hideHorizontalLabels:!1}}});var Lk={};(function(r){var t=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.BboxConfiguration=r.BboxMethods=void 0;var e=he,n=Gt,s=t(Le);r.BboxMethods={},r.BboxMethods.BBox=function(l,u){for(var h=l.GetBrackets(u,""),T=l.ParseArg(u),f=h.split(/,/),d,p,m,y=0,c=f.length;y<c;y++){var Q=f[y].trim(),g=Q.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);if(g){if(d)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Padding",u);var v=o(g[1]+g[3]);v&&(d={height:"+"+v,depth:"+"+v,lspace:v,width:"+"+2*parseInt(g[1],10)+g[3]})}else if(Q.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)){if(p)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Background",u);p=Q}else if(Q.match(/^[-a-z]+:/i)){if(m)throw new s.default("MultipleBBoxProperty","%1 specified twice in %2","Style",u);m=a(Q)}else if(Q!=="")throw new s.default("InvalidBBoxProperty",`"%1" doesn't look like a color, a padding dimension, or a style`,Q)}d&&(T=l.create("node","mpadded",[T],d)),(p||m)&&(d={},p&&Object.assign(d,{mathbackground:p}),m&&Object.assign(d,{style:m}),T=l.create("node","mstyle",[T],d)),l.Push(T)};var a=function(l){return l},o=function(l){return l};new n.CommandMap("bbox",{bbox:"BBox"},r.BboxMethods),r.BboxConfiguration=e.Configuration.create("bbox",{handler:{macro:["bbox"]}})})(Lk);var xk={};(function(r){var t=_&&_.__values||function(f){var d=typeof Symbol=="function"&&Symbol.iterator,p=d&&f[d],m=0;if(p)return p.call(f);if(f&&typeof f.length=="number")return{next:function(){return f&&m>=f.length&&(f=void 0),{value:f&&f[m++],done:!f}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(r,"__esModule",{value:!0}),r.BoldsymbolConfiguration=r.rewriteBoldTokens=r.createBoldToken=r.BoldsymbolMethods=void 0;var n=he,s=e(Ne),a=q1,o=Gt,l=Xn,u={};u[a.TexConstant.Variant.NORMAL]=a.TexConstant.Variant.BOLD,u[a.TexConstant.Variant.ITALIC]=a.TexConstant.Variant.BOLDITALIC,u[a.TexConstant.Variant.FRAKTUR]=a.TexConstant.Variant.BOLDFRAKTUR,u[a.TexConstant.Variant.SCRIPT]=a.TexConstant.Variant.BOLDSCRIPT,u[a.TexConstant.Variant.SANSSERIF]=a.TexConstant.Variant.BOLDSANSSERIF,u["-tex-calligraphic"]="-tex-bold-calligraphic",u["-tex-oldstyle"]="-tex-bold-oldstyle",u["-tex-mathit"]=a.TexConstant.Variant.BOLDITALIC,r.BoldsymbolMethods={},r.BoldsymbolMethods.Boldsymbol=function(f,d){var p=f.stack.env.boldsymbol;f.stack.env.boldsymbol=!0;var m=f.ParseArg(d);f.stack.env.boldsymbol=p,f.Push(m)},new o.CommandMap("boldsymbol",{boldsymbol:"Boldsymbol"},r.BoldsymbolMethods);function h(f,d,p,m){var y=l.NodeFactory.createToken(f,d,p,m);return d!=="mtext"&&f.configuration.parser.stack.env.boldsymbol&&(s.default.setProperty(y,"fixBold",!0),f.configuration.addNode("fixBold",y)),y}r.createBoldToken=h;function T(f){var d,p;try{for(var m=t(f.data.getList("fixBold")),y=m.next();!y.done;y=m.next()){var c=y.value;if(s.default.getProperty(c,"fixBold")){var Q=s.default.getAttribute(c,"mathvariant");Q==null?s.default.setAttribute(c,"mathvariant",a.TexConstant.Variant.BOLD):s.default.setAttribute(c,"mathvariant",u[Q]||Q),s.default.removeProperties(c,"fixBold")}}}catch(g){d={error:g}}finally{try{y&&!y.done&&(p=m.return)&&p.call(m)}finally{if(d)throw d.error}}}r.rewriteBoldTokens=T,r.BoldsymbolConfiguration=n.Configuration.create("boldsymbol",{handler:{macro:["boldsymbol"]},nodes:{token:h},postprocessors:[T]})})(xk);var RT={},M7={},_k=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),bk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(M7,"__esModule",{value:!0});M7.BraketItem=void 0;var og=n3,k9=jt,Sk=bk(Ue()),Ek=function(r){_k(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"braket"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){return e.isKind("close")?[[this.factory.create("mml",this.toMml())],!0]:e.isKind("mml")?(this.Push(e.toMml()),this.getProperty("single")?[[this.toMml()],!0]:og.BaseItem.fail):r.prototype.checkItem.call(this,e)},t.prototype.toMml=function(){var e=r.prototype.toMml.call(this),n=this.getProperty("open"),s=this.getProperty("close");if(this.getProperty("stretchy"))return Sk.default.fenced(this.factory.configuration,n,e,s);var a={fence:!0,stretchy:!1,symmetric:!0,texClass:k9.TEXCLASS.OPEN},o=this.create("token","mo",a,n);a.texClass=k9.TEXCLASS.CLOSE;var l=this.create("token","mo",a,s),u=this.create("node","mrow",[o,e,l],{open:n,close:s,texClass:k9.TEXCLASS.INNER});return u},t}(og.BaseItem);M7.BraketItem=Ek;var BT={},Q_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(BT,"__esModule",{value:!0});var Ak=Q_(p2),R9=jt,Hk=Q_(Le),w7={};w7.Macro=Ak.default.Macro;w7.Braket=function(r,t,e,n,s,a){var o=r.GetNext();if(o==="")throw new Hk.default("MissingArgFor","Missing argument for %1",r.currentCS);var l=!0;o==="{"&&(r.i++,l=!1),r.Push(r.itemFactory.create("braket").setProperties({barmax:a,barcount:0,open:e,close:n,stretchy:s,single:l}))};w7.Bar=function(r,t){var e=t==="|"?"|":"∥",n=r.stack.Top();if(n.kind!=="braket"||n.getProperty("barcount")>=n.getProperty("barmax")){var s=r.create("token","mo",{texClass:R9.TEXCLASS.ORD,stretchy:!1},e);r.Push(s);return}e==="|"&&r.GetNext()==="|"&&(r.i++,e="∥");var a=n.getProperty("stretchy");if(!a){var o=r.create("token","mo",{stretchy:!1,braketbar:!0},e);r.Push(o);return}var l=r.create("node","TeXAtom",[],{texClass:R9.TEXCLASS.CLOSE});r.Push(l),n.setProperty("barcount",n.getProperty("barcount")+1),l=r.create("token","mo",{stretchy:!0,braketbar:!0},e),r.Push(l),l=r.create("node","TeXAtom",[],{texClass:R9.TEXCLASS.OPEN}),r.Push(l)};BT.default=w7;var Mk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},d_=Gt,p_=Mk(BT);new d_.CommandMap("Braket-macros",{bra:["Macro","{\\langle {#1} \\vert}",1],ket:["Macro","{\\vert {#1} \\rangle}",1],braket:["Braket","⟨","⟩",!1,1/0],set:["Braket","{","}",!1,1],Bra:["Macro","{\\left\\langle {#1} \\right\\vert}",1],Ket:["Macro","{\\left\\vert {#1} \\right\\rangle}",1],Braket:["Braket","⟨","⟩",!0,1/0],Set:["Braket","{","}",!0,1],ketbra:["Macro","{\\vert {#1} \\rangle\\langle {#2} \\vert}",2],Ketbra:["Macro","{\\left\\vert {#1} \\right\\rangle\\left\\langle {#2} \\right\\vert}",2],"|":"Bar"},p_.default);new d_.MacroMap("Braket-characters",{"|":"Bar"},p_.default);var B9;Object.defineProperty(RT,"__esModule",{value:!0});RT.BraketConfiguration=void 0;var wk=he,lg=M7;RT.BraketConfiguration=wk.Configuration.create("braket",{handler:{character:["Braket-characters"],macro:["Braket-macros"]},items:(B9={},B9[lg.BraketItem.prototype.kind]=lg.BraketItem,B9)});var FT={},C7={},D7={};(function(r){var t=_&&_.__read||function(U,N){var K=typeof Symbol=="function"&&U[Symbol.iterator];if(!K)return U;var J=K.call(U),ft,Y=[],Qt;try{for(;(N===void 0||N-- >0)&&!(ft=J.next()).done;)Y.push(ft.value)}catch(W){Qt={error:W}}finally{try{ft&&!ft.done&&(K=J.return)&&K.call(J)}finally{if(Qt)throw Qt.error}}return Y},e=_&&_.__values||function(U){var N=typeof Symbol=="function"&&Symbol.iterator,K=N&&U[N],J=0;if(K)return K.call(U);if(U&&typeof U.length=="number")return{next:function(){return U&&J>=U.length&&(U=void 0),{value:U&&U[J++],done:!U}}};throw new TypeError(N?"Object is not iterable.":"Symbol.iterator is not defined.")},n=_&&_.__importDefault||function(U){return U&&U.__esModule?U:{default:U}},s;Object.defineProperty(r,"__esModule",{value:!0}),r.clearDocument=r.saveDocument=r.makeBsprAttributes=r.removeProperty=r.getProperty=r.setProperty=r.balanceRules=void 0;var a=n(Ne),o=n(Ue()),l=null,u=null,h=function(U){u.root=U;var N=l.outputJax.getBBox(u,l).w;return N},T=function(U){for(var N=0;U&&!a.default.isType(U,"mtable");){if(a.default.isType(U,"text"))return null;if(a.default.isType(U,"mrow")){U=U.childNodes[0],N=0;continue}U=U.parent.childNodes[N],N++}return U},f=function(U,N){return U.childNodes[N==="up"?1:0].childNodes[0].childNodes[0].childNodes[0].childNodes[0]},d=function(U,N){return U.childNodes[N].childNodes[0].childNodes[0]},p=function(U){return d(U,0)},m=function(U){return d(U,U.childNodes.length-1)},y=function(U,N){return U.childNodes[N==="up"?0:1].childNodes[0].childNodes[0].childNodes[0]},c=function(U){for(;U&&!a.default.isType(U,"mtd");)U=U.parent;return U},Q=function(U){return U.parent.childNodes[U.parent.childNodes.indexOf(U)+1]},g=function(U){for(;U&&(0,r.getProperty)(U,"inference")==null;)U=U.parent;return U},v=function(U,N,K){K===void 0&&(K=!1);var J=0;if(U===N)return J;if(U!==N.parent){var ft=U.childNodes,Y=K?ft.length-1:0;a.default.isType(ft[Y],"mspace")&&(J+=h(ft[Y])),U=N.parent}if(U===N)return J;var Qt=U.childNodes,W=K?Qt.length-1:0;return Qt[W]!==N&&(J+=h(Qt[W])),J},L=function(U,N){N===void 0&&(N=!1);var K=T(U),J=y(K,(0,r.getProperty)(K,"inferenceRule")),ft=v(U,K,N),Y=h(K),Qt=h(J);return ft+(Y-Qt)/2},x=function(U,N,K,J){if(J===void 0&&(J=!1),(0,r.getProperty)(N,"inferenceRule")||(0,r.getProperty)(N,"labelledRule")){var ft=U.nodeFactory.create("node","mrow");N.parent.replaceChild(ft,N),ft.setChildren([N]),b(N,ft),N=ft}var Y=J?N.childNodes.length-1:0,Qt=N.childNodes[Y];if(a.default.isType(Qt,"mspace")){a.default.setAttribute(Qt,"width",o.default.Em(o.default.dimen2em(a.default.getAttribute(Qt,"width"))+K));return}if(Qt=U.nodeFactory.create("node","mspace",[],{width:o.default.Em(K)}),J){N.appendChild(Qt);return}Qt.parent=N,N.childNodes.unshift(Qt)},b=function(U,N){var K=["inference","proof","maxAdjust","labelledRule"];K.forEach(function(J){var ft=(0,r.getProperty)(U,J);ft!=null&&((0,r.setProperty)(N,J,ft),(0,r.removeProperty)(U,J))})},S=function(U){var N=U.nodeLists.sequent;if(N)for(var K=N.length-1,J=void 0;J=N[K];K--){if((0,r.getProperty)(J,"sequentProcessed")){(0,r.removeProperty)(J,"sequentProcessed");continue}var ft=[],Y=g(J);if((0,r.getProperty)(Y,"inference")===1){for(ft.push(J);(0,r.getProperty)(Y,"inference")===1;){Y=T(Y);var Qt=p(f(Y,(0,r.getProperty)(Y,"inferenceRule"))),W=(0,r.getProperty)(Qt,"inferenceRule")?y(Qt,(0,r.getProperty)(Qt,"inferenceRule")):Qt;(0,r.getProperty)(W,"sequent")&&(J=W.childNodes[0],ft.push(J),(0,r.setProperty)(J,"sequentProcessed",!0)),Y=Qt}A(U,ft)}}},E=function(U,N,K,J,ft){var Y=U.nodeFactory.create("node","mspace",[],{width:o.default.Em(ft)});if(J==="left"){var Qt=N.childNodes[K].childNodes[0];Y.parent=Qt,Qt.childNodes.unshift(Y)}else N.childNodes[K].appendChild(Y);(0,r.setProperty)(N.parent,"sequentAdjust_"+J,ft)},A=function(U,N){for(var K=N.pop();N.length;){var J=N.pop(),ft=t(M(K,J),2),Y=ft[0],Qt=ft[1];(0,r.getProperty)(K.parent,"axiom")&&(E(U,Y<0?K:J,0,"left",Math.abs(Y)),E(U,Qt<0?K:J,2,"right",Math.abs(Qt))),K=J}},M=function(U,N){var K=h(U.childNodes[2]),J=h(N.childNodes[2]),ft=h(U.childNodes[0]),Y=h(N.childNodes[0]),Qt=ft-Y,W=K-J;return[Qt,W]},D=function(U){var N,K;u=new U.document.options.MathItem("",null,U.math.display);var J=U.data;S(J);var ft=J.nodeLists.inference||[];try{for(var Y=e(ft),Qt=Y.next();!Qt.done;Qt=Y.next()){var W=Qt.value,$=(0,r.getProperty)(W,"proof"),Lt=T(W),wt=f(Lt,(0,r.getProperty)(Lt,"inferenceRule")),At=p(wt);if((0,r.getProperty)(At,"inference")){var zt=L(At);if(zt){x(J,At,-zt);var Ot=v(W,Lt,!1);x(J,W,zt-Ot)}}var It=m(wt);if((0,r.getProperty)(It,"inference")!=null){var Ut=L(It,!0);x(J,It,-Ut,!0);var Et=v(W,Lt,!0),ae=(0,r.getProperty)(W,"maxAdjust");ae!=null&&(Ut=Math.max(Ut,ae));var xt=void 0;if($||!(xt=c(W))){x(J,(0,r.getProperty)(W,"proof")?W:W.parent,Ut-Et,!0);continue}var Ee=Q(xt);if(Ee){var je=J.nodeFactory.create("node","mspace",[],{width:Ut-Et+"em"});Ee.appendChild(je),W.removeProperty("maxAdjust");continue}var Z1=g(xt);Z1&&(Ut=(0,r.getProperty)(Z1,"maxAdjust")?Math.max((0,r.getProperty)(Z1,"maxAdjust"),Ut):Ut,(0,r.setProperty)(Z1,"maxAdjust",Ut))}}}catch(O2){N={error:O2}}finally{try{Qt&&!Qt.done&&(K=Y.return)&&K.call(Y)}finally{if(N)throw N.error}}};r.balanceRules=D;var I="bspr_",P=(s={},s[I+"maxAdjust"]=!0,s),R=function(U,N,K){a.default.setProperty(U,I+N,K)};r.setProperty=R;var F=function(U,N){return a.default.getProperty(U,I+N)};r.getProperty=F;var X=function(U,N){U.removeProperty(I+N)};r.removeProperty=X;var st=function(U){U.data.root.walkTree(function(N,K){var J=[];N.getPropertyNames().forEach(function(ft){!P[ft]&&ft.match(RegExp("^"+I))&&J.push(ft+":"+N.getProperty(ft))}),J.length&&a.default.setAttribute(N,"semantics",J.join(";"))})};r.makeBsprAttributes=st;var rt=function(U){if(l=U.document,!("getBBox"in l.outputJax))throw Error("The bussproofs extension requires an output jax with a getBBox() method")};r.saveDocument=rt;var ct=function(U){l=null};r.clearDocument=ct})(D7);var Ck=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Dk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),Ok=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Ik=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&Dk(t,r,e);return Ok(t,r),t},g_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(C7,"__esModule",{value:!0});C7.ProofTreeItem=void 0;var Vk=g_(Le),ug=n3,Pk=g_(b7),kk=Ik(D7),Rk=function(r){Ck(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.leftLabel=null,e.rigthLabel=null,e.innerStack=new Pk.default(e.factory,{},!0),e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"proofTree"},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")&&e.getName()==="prooftree"){var n=this.toMml();return kk.setProperty(n,"proof",!0),[[this.factory.create("mml",n),e],!0]}if(e.isKind("stop"))throw new Vk.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return this.innerStack.Push(e),ug.BaseItem.fail},t.prototype.toMml=function(){var e=r.prototype.toMml.call(this),n=this.innerStack.Top();if(n.isKind("start")&&!n.Size())return e;this.innerStack.Push(this.factory.create("stop"));var s=this.innerStack.Top().toMml();return this.create("node","mrow",[s,e],{})},t}(ug.BaseItem);C7.ProofTreeItem=Rk;var NT={},Bk=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),Fk=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Nk=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&Bk(t,r,e);return Fk(t,r),t},m_=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},cg=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},UT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(NT,"__esModule",{value:!0});var a3=UT(Le),F9=UT(e2()),Kc=UT(Ue()),di=Nk(D7),z3={};z3.Prooftree=function(r,t){r.Push(t);var e=r.itemFactory.create("proofTree").setProperties({name:t.getName(),line:"solid",currentLine:"solid",rootAtTop:!1});return e};z3.Axiom=function(r,t){var e=r.stack.Top();if(e.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=y_(r,r.GetArgument(t));di.setProperty(n,"axiom",!0),e.Push(n)};var y_=function(r,t){var e=Kc.default.internalMath(r,Kc.default.trimSpaces(t),0);if(!e[0].childNodes[0].childNodes.length)return r.create("node","mrow",[]);var n=r.create("node","mspace",[],{width:".5ex"}),s=r.create("node","mspace",[],{width:".5ex"});return r.create("node","mrow",cg(cg([n],m_(e),!1),[s],!1))};z3.Inference=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<e)throw new a3.default("BadProofTree","Proof tree badly specified.");var s=n.getProperty("rootAtTop"),a=e===1&&!n.Peek()[0].childNodes.length?0:e,o=[];do o.length&&o.unshift(r.create("node","mtd",[],{})),o.unshift(r.create("node","mtd",[n.Pop()],{rowalign:s?"top":"bottom"})),e--;while(e>0);var l=r.create("node","mtr",o,{}),u=r.create("node","mtable",[l],{framespacing:"0 0"}),h=y_(r,r.GetArgument(t)),T=n.getProperty("currentLine");T!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var f=v_(r,u,[h],n.getProperty("left"),n.getProperty("right"),T,s);n.setProperty("left",null),n.setProperty("right",null),di.setProperty(f,"inference",a),r.configuration.addNode("inference",f),n.Push(f)};function v_(r,t,e,n,s,a,o){var l=r.create("node","mtr",[r.create("node","mtd",[t],{})],{}),u=r.create("node","mtr",[r.create("node","mtd",e,{})],{}),h=r.create("node","mtable",o?[u,l]:[l,u],{align:"top 2",rowlines:a,framespacing:"0 0"});di.setProperty(h,"inferenceRule",o?"up":"down");var T,f;n&&(T=r.create("node","mpadded",[n],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),di.setProperty(T,"prooflabel","left")),s&&(f=r.create("node","mpadded",[s],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),di.setProperty(f,"prooflabel","right"));var d,p;if(n&&s)d=[T,h,f],p="both";else if(n)d=[T,h],p="left";else if(s)d=[h,f],p="right";else return h;return h=r.create("node","mrow",d),di.setProperty(h,"labelledRule",p),h}z3.Label=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var s=Kc.default.internalMath(r,r.GetArgument(t),0),a=s.length>1?r.create("node","mrow",s,{}):s[0];n.setProperty(e,a)};z3.SetLine=function(r,t,e,n){var s=r.stack.Top();if(s.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");s.setProperty("currentLine",e),n&&s.setProperty("line",e)};z3.RootAtTop=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");n.setProperty("rootAtTop",e)};z3.AxiomF=function(r,t){var e=r.stack.Top();if(e.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=L_(r,t);di.setProperty(n,"axiom",!0),e.Push(n)};function L_(r,t){var e=r.GetNext();if(e!=="$")throw new a3.default("IllegalUseOfCommand","Use of %1 does not match it's definition.",t);r.i++;var n=r.GetUpTo(t,"$");if(n.indexOf("\\fCenter")===-1)throw new a3.default("IllegalUseOfCommand","Missing \\fCenter in %1.",t);var s=m_(n.split("\\fCenter"),2),a=s[0],o=s[1],l=new F9.default(a,r.stack.env,r.configuration).mml(),u=new F9.default(o,r.stack.env,r.configuration).mml(),h=new F9.default("\\fCenter",r.stack.env,r.configuration).mml(),T=r.create("node","mtd",[l],{}),f=r.create("node","mtd",[h],{}),d=r.create("node","mtd",[u],{}),p=r.create("node","mtr",[T,f,d],{}),m=r.create("node","mtable",[p],{columnspacing:".5ex",columnalign:"center 2"});return di.setProperty(m,"sequent",!0),r.configuration.addNode("sequent",p),m}z3.FCenter=function(r,t){};z3.InferenceF=function(r,t,e){var n=r.stack.Top();if(n.kind!=="proofTree")throw new a3.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<e)throw new a3.default("BadProofTree","Proof tree badly specified.");var s=n.getProperty("rootAtTop"),a=e===1&&!n.Peek()[0].childNodes.length?0:e,o=[];do o.length&&o.unshift(r.create("node","mtd",[],{})),o.unshift(r.create("node","mtd",[n.Pop()],{rowalign:s?"top":"bottom"})),e--;while(e>0);var l=r.create("node","mtr",o,{}),u=r.create("node","mtable",[l],{framespacing:"0 0"}),h=L_(r,t),T=n.getProperty("currentLine");T!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var f=v_(r,u,[h],n.getProperty("left"),n.getProperty("right"),T,s);n.setProperty("left",null),n.setProperty("right",null),di.setProperty(f,"inference",a),r.configuration.addNode("inference",f),n.Push(f)};NT.default=z3;var x_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},__=x_(NT),Uk=x_(h3),b_=Gt;new b_.CommandMap("Bussproofs-macros",{AxiomC:"Axiom",UnaryInfC:["Inference",1],BinaryInfC:["Inference",2],TrinaryInfC:["Inference",3],QuaternaryInfC:["Inference",4],QuinaryInfC:["Inference",5],RightLabel:["Label","right"],LeftLabel:["Label","left"],AXC:"Axiom",UIC:["Inference",1],BIC:["Inference",2],TIC:["Inference",3],RL:["Label","right"],LL:["Label","left"],noLine:["SetLine","none",!1],singleLine:["SetLine","solid",!1],solidLine:["SetLine","solid",!1],dashedLine:["SetLine","dashed",!1],alwaysNoLine:["SetLine","none",!0],alwaysSingleLine:["SetLine","solid",!0],alwaysSolidLine:["SetLine","solid",!0],alwaysDashedLine:["SetLine","dashed",!0],rootAtTop:["RootAtTop",!0],alwaysRootAtTop:["RootAtTop",!0],rootAtBottom:["RootAtTop",!1],alwaysRootAtBottom:["RootAtTop",!1],fCenter:"FCenter",Axiom:"AxiomF",UnaryInf:["InferenceF",1],BinaryInf:["InferenceF",2],TrinaryInf:["InferenceF",3],QuaternaryInf:["InferenceF",4],QuinaryInf:["InferenceF",5]},__.default);new b_.EnvironmentMap("Bussproofs-environments",Uk.default.environment,{prooftree:["Prooftree",null,!1]},__.default);var N9;Object.defineProperty(FT,"__esModule",{value:!0});FT.BussproofsConfiguration=void 0;var jk=he,hg=C7,Bs=D7;FT.BussproofsConfiguration=jk.Configuration.create("bussproofs",{handler:{macro:["Bussproofs-macros"],environment:["Bussproofs-environments"]},items:(N9={},N9[hg.ProofTreeItem.prototype.kind]=hg.ProofTreeItem,N9),preprocessors:[[Bs.saveDocument,1]],postprocessors:[[Bs.clearDocument,3],[Bs.makeBsprAttributes,2],[Bs.balanceRules,1]]});var Gk={},S_={};(function(r){var t=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(r,"__esModule",{value:!0}),r.EncloseConfiguration=r.EncloseMethods=r.ENCLOSE_OPTIONS=void 0;var e=he,n=Gt,s=t(Ue());r.ENCLOSE_OPTIONS={"data-arrowhead":1,color:1,mathcolor:1,background:1,mathbackground:1,"data-padding":1,"data-thickness":1},r.EncloseMethods={},r.EncloseMethods.Enclose=function(a,o){var l=a.GetArgument(o).replace(/,/g," "),u=a.GetBrackets(o,""),h=a.ParseArg(o),T=s.default.keyvalOptions(u,r.ENCLOSE_OPTIONS);T.notation=l,a.Push(a.create("node","menclose",[h],T))},new n.CommandMap("enclose",{enclose:"Enclose"},r.EncloseMethods),r.EncloseConfiguration=e.Configuration.create("enclose",{handler:{macro:["enclose"]}})})(S_);(function(r){var t=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.CancelConfiguration=r.CancelMethods=void 0;var e=he,n=q1,s=Gt,a=t(Ue()),o=S_;r.CancelMethods={},r.CancelMethods.Cancel=function(l,u,h){var T=l.GetBrackets(u,""),f=l.ParseArg(u),d=a.default.keyvalOptions(T,o.ENCLOSE_OPTIONS);d.notation=h,l.Push(l.create("node","menclose",[f],d))},r.CancelMethods.CancelTo=function(l,u){var h=l.GetBrackets(u,""),T=l.ParseArg(u),f=l.ParseArg(u),d=a.default.keyvalOptions(h,o.ENCLOSE_OPTIONS);d.notation=[n.TexConstant.Notation.UPDIAGONALSTRIKE,n.TexConstant.Notation.UPDIAGONALARROW,n.TexConstant.Notation.NORTHEASTARROW].join(" "),T=l.create("node","mpadded",[T],{depth:"-.1em",height:"+.1em",voffset:".1em"}),l.Push(l.create("node","msup",[l.create("node","menclose",[f],d),T]))},new s.CommandMap("cancel",{cancel:["Cancel",n.TexConstant.Notation.UPDIAGONALSTRIKE],bcancel:["Cancel",n.TexConstant.Notation.DOWNDIAGONALSTRIKE],xcancel:["Cancel",n.TexConstant.Notation.UPDIAGONALSTRIKE+" "+n.TexConstant.Notation.DOWNDIAGONALSTRIKE],cancelto:"CancelTo"},r.CancelMethods),r.CancelConfiguration=e.Configuration.create("cancel",{handler:{macro:["cancel"]}})})(Gk);var zk={},jT={};(function(r){var t=_&&_.__read||function(l,u){var h=typeof Symbol=="function"&&l[Symbol.iterator];if(!h)return l;var T=h.call(l),f,d=[],p;try{for(;(u===void 0||u-- >0)&&!(f=T.next()).done;)d.push(f.value)}catch(m){p={error:m}}finally{try{f&&!f.done&&(h=T.return)&&h.call(T)}finally{if(p)throw p.error}}return d},e=_&&_.__spreadArray||function(l,u,h){if(h||arguments.length===2)for(var T=0,f=u.length,d;T<f;T++)(d||!(T in u))&&(d||(d=Array.prototype.slice.call(u,0,T)),d[T]=u[T]);return l.concat(d||Array.prototype.slice.call(u))},n=_&&_.__values||function(l){var u=typeof Symbol=="function"&&Symbol.iterator,h=u&&l[u],T=0;if(h)return h.call(l);if(l&&typeof l.length=="number")return{next:function(){return l&&T>=l.length&&(l=void 0),{value:l&&l[T++],done:!l}}};throw new TypeError(u?"Object is not iterable.":"Symbol.iterator is not defined.")},s=_&&_.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(r,"__esModule",{value:!0}),r.EmpheqUtil=void 0;var a=s(Ue()),o=s(e2());r.EmpheqUtil={environment:function(l,u,h,T){var f=T[0],d=l.itemFactory.create(f+"-begin").setProperties({name:u,end:f});l.Push(h.apply(void 0,e([l,d],t(T.slice(1)),!1)))},splitOptions:function(l,u){return u===void 0&&(u=null),a.default.keyvalOptions(l,u,!0)},columnCount:function(l){var u,h,T=0;try{for(var f=n(l.childNodes),d=f.next();!d.done;d=f.next()){var p=d.value,m=p.childNodes.length-(p.isKind("mlabeledtr")?1:0);m>T&&(T=m)}}catch(y){u={error:y}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(u)throw u.error}}return T},cellBlock:function(l,u,h,T){var f,d,p=h.create("node","mpadded",[],{height:0,depth:0,voffset:"-1height"}),m=new o.default(l,h.stack.env,h.configuration),y=m.mml();T&&m.configuration.tags.label&&(m.configuration.tags.currentTag.env=T,m.configuration.tags.getTag(!0));try{for(var c=n(y.isInferred?y.childNodes:[y]),Q=c.next();!Q.done;Q=c.next()){var g=Q.value;p.appendChild(g)}}catch(v){f={error:v}}finally{try{Q&&!Q.done&&(d=c.return)&&d.call(c)}finally{if(f)throw f.error}}return p.appendChild(h.create("node","mphantom",[h.create("node","mpadded",[u],{width:0})])),p},topRowTable:function(l,u){var h=a.default.copyNode(l,u);return h.setChildren(h.childNodes.slice(0,1)),h.attributes.set("align","baseline 1"),l.factory.create("mphantom",{},[u.create("node","mpadded",[h],{width:0})])},rowspanCell:function(l,u,h,T,f){l.appendChild(T.create("node","mpadded",[this.cellBlock(u,a.default.copyNode(h,T),T,f),this.topRowTable(h,T)],{height:0,depth:0,voffset:"height"}))},left:function(l,u,h,T,f){var d,p;f===void 0&&(f=""),l.attributes.set("columnalign","right "+(l.attributes.get("columnalign")||"")),l.attributes.set("columnspacing","0em "+(l.attributes.get("columnspacing")||""));var m;try{for(var y=n(l.childNodes.slice(0).reverse()),c=y.next();!c.done;c=y.next()){var Q=c.value;m=T.create("node","mtd"),Q.childNodes.unshift(m),m.parent=Q,Q.isKind("mlabeledtr")&&(Q.childNodes[0]=Q.childNodes[1],Q.childNodes[1]=m)}}catch(g){d={error:g}}finally{try{c&&!c.done&&(p=y.return)&&p.call(y)}finally{if(d)throw d.error}}this.rowspanCell(m,h,u,T,f)},right:function(l,u,h,T,f){f===void 0&&(f=""),l.childNodes.length===0&&l.appendChild(T.create("node","mtr"));for(var d=r.EmpheqUtil.columnCount(l),p=l.childNodes[0];p.childNodes.length<d;)p.appendChild(T.create("node","mtd"));var m=p.appendChild(T.create("node","mtd"));r.EmpheqUtil.rowspanCell(m,h,u,T,f),l.attributes.set("columnalign",(l.attributes.get("columnalign")||"").split(/ /).slice(0,d).join(" ")+" left"),l.attributes.set("columnspacing",(l.attributes.get("columnspacing")||"").split(/ /).slice(0,d-1).join(" ")+" 0em")},adjustTable:function(l,u){var h=l.getProperty("left"),T=l.getProperty("right");if(h||T){var f=l.Last,d=a.default.copyNode(f,u);h&&this.left(f,d,h,u),T&&this.right(f,d,T,u)}},allowEnv:{equation:!0,align:!0,gather:!0,flalign:!0,alignat:!0,multline:!0},checkEnv:function(l){return this.allowEnv.hasOwnProperty(l.replace(/\*$/,""))||!1}}})(jT);(function(r){var t=_&&_.__extends||function(){var m=function(y,c){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,g){Q.__proto__=g}||function(Q,g){for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(Q[v]=g[v])},m(y,c)};return function(y,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");m(y,c);function Q(){this.constructor=y}y.prototype=c===null?Object.create(c):(Q.prototype=c.prototype,new Q)}}(),e=_&&_.__importDefault||function(m){return m&&m.__esModule?m:{default:m}},n;Object.defineProperty(r,"__esModule",{value:!0}),r.CasesConfiguration=r.CasesMethods=r.CasesTags=r.CasesBeginItem=void 0;var s=he,a=Gt,o=e(Ue()),l=e(p2),u=e(Le),h=Nt,T=Dn,f=jT,d=function(m){t(y,m);function y(){return m!==null&&m.apply(this,arguments)||this}return Object.defineProperty(y.prototype,"kind",{get:function(){return"cases-begin"},enumerable:!1,configurable:!0}),y.prototype.checkItem=function(c){return c.isKind("end")&&c.getName()===this.getName()&&this.getProperty("end")?(this.setProperty("end",!1),[[],!0]):m.prototype.checkItem.call(this,c)},y}(h.BeginItem);r.CasesBeginItem=d;var p=function(m){t(y,m);function y(){var c=m!==null&&m.apply(this,arguments)||this;return c.subcounter=0,c}return y.prototype.start=function(c,Q,g){this.subcounter=0,m.prototype.start.call(this,c,Q,g)},y.prototype.autoTag=function(){this.currentTag.tag==null&&(this.currentTag.env==="subnumcases"?(this.subcounter===0&&this.counter++,this.subcounter++,this.tag(this.formatNumber(this.counter,this.subcounter),!1)):((this.subcounter===0||this.currentTag.env!=="numcases-left")&&this.counter++,this.tag(this.formatNumber(this.counter),!1)))},y.prototype.formatNumber=function(c,Q){return Q===void 0&&(Q=null),c.toString()+(Q===null?"":String.fromCharCode(96+Q))},y}(T.AmsTags);r.CasesTags=p,r.CasesMethods={NumCases:function(m,y){if(m.stack.env.closing===y.getName()){delete m.stack.env.closing,m.Push(m.itemFactory.create("end").setProperty("name",y.getName()));var c=m.stack.Top(),Q=c.Last,g=o.default.copyNode(Q,m),v=c.getProperty("left");return f.EmpheqUtil.left(Q,g,v+"\\empheqlbrace\\,",m,"numcases-left"),m.Push(m.itemFactory.create("end").setProperty("name",y.getName())),null}else{var v=m.GetArgument("\\begin{"+y.getName()+"}");y.setProperty("left",v);var L=l.default.EqnArray(m,y,!0,!0,"ll");return L.arraydef.displaystyle=!1,L.arraydef.rowspacing=".2em",L.setProperty("numCases",!0),m.Push(y),L}},Entry:function(m,y){if(!m.stack.Top().getProperty("numCases"))return l.default.Entry(m,y);m.Push(m.itemFactory.create("cell").setProperties({isEntry:!0,name:y}));for(var c=m.string,Q=0,g=m.i,v=c.length;g<v;){var L=c.charAt(g);if(L==="{")Q++,g++;else if(L==="}"){if(Q===0)break;Q--,g++}else{if(L==="&"&&Q===0)throw new u.default("ExtraCasesAlignTab","Extra alignment tab in text for numcase environment");if(L==="\\"&&Q===0){var x=(c.slice(g+1).match(/^[a-z]+|./i)||[])[0];if(x==="\\"||x==="cr"||x==="end"||x==="label")break;g+=x.length}else g++}}var b=c.substr(m.i,g-m.i).replace(/^\s*/,"");m.PushAll(o.default.internalMath(m,b,0)),m.i=g}},new a.EnvironmentMap("cases-env",f.EmpheqUtil.environment,{numcases:["NumCases","cases"],subnumcases:["NumCases","cases"]},r.CasesMethods),new a.MacroMap("cases-macros",{"&":"Entry"},r.CasesMethods),r.CasesConfiguration=s.Configuration.create("cases",{handler:{environment:["cases-env"],character:["cases-macros"]},items:(n={},n[d.prototype.kind]=d,n),tags:{cases:p}})})(zk);var k5={},Wk=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},GT=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(k5,"__esModule",{value:!0});k5.CenternotConfiguration=k5.filterCenterOver=void 0;var qk=he,Tg=GT(e2()),fg=GT(Ne),Zk=Gt,Kk=GT(p2);new Zk.CommandMap("centernot",{centerOver:"CenterOver",centernot:["Macro","\\centerOver{#1}{{⧸}}",1]},{CenterOver:function(r,t){var e="{"+r.GetArgument(t)+"}",n=r.ParseArg(t),s=new Tg.default(e,r.stack.env,r.configuration).mml(),a=r.create("node","TeXAtom",[new Tg.default(e,r.stack.env,r.configuration).mml(),r.create("node","mpadded",[r.create("node","mpadded",[n],{width:0,lspace:"-.5width"}),r.create("node","mphantom",[s])],{width:0,lspace:"-.5width"})]);r.configuration.addNode("centerOver",s),r.Push(a)},Macro:Kk.default.Macro});function E_(r){var t,e,n=r.data;try{for(var s=Wk(n.getList("centerOver")),a=s.next();!a.done;a=s.next()){var o=a.value,l=fg.default.getTexClass(o.childNodes[0].childNodes[0]);l!==null&&fg.default.setProperties(o.parent.parent.parent.parent.parent.parent,{texClass:l})}}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}k5.filterCenterOver=E_;k5.CenternotConfiguration=qk.Configuration.create("centernot",{handler:{macro:["centernot"]},postprocessors:[E_]});var zT={},A_={};(function(r){var t=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(r,"__esModule",{value:!0}),r.ColorMethods=void 0;var e=t(Ne),n=t(Ue());function s(a){var o="+".concat(a),l=a.replace(/^.*?([a-z]*)$/,"$1"),u=2*parseFloat(o);return{width:"+".concat(u).concat(l),height:o,depth:o,lspace:a}}r.ColorMethods={},r.ColorMethods.Color=function(a,o){var l=a.GetBrackets(o,""),u=a.GetArgument(o),h=a.configuration.packageData.get("color").model,T=h.getColor(l,u),f=a.itemFactory.create("style").setProperties({styles:{mathcolor:T}});a.stack.env.color=T,a.Push(f)},r.ColorMethods.TextColor=function(a,o){var l=a.GetBrackets(o,""),u=a.GetArgument(o),h=a.configuration.packageData.get("color").model,T=h.getColor(l,u),f=a.stack.env.color;a.stack.env.color=T;var d=a.ParseArg(o);f?a.stack.env.color=f:delete a.stack.env.color;var p=a.create("node","mstyle",[d],{mathcolor:T});a.Push(p)},r.ColorMethods.DefineColor=function(a,o){var l=a.GetArgument(o),u=a.GetArgument(o),h=a.GetArgument(o),T=a.configuration.packageData.get("color").model;T.defineColor(u,l,h)},r.ColorMethods.ColorBox=function(a,o){var l=a.GetArgument(o),u=n.default.internalMath(a,a.GetArgument(o)),h=a.configuration.packageData.get("color").model,T=a.create("node","mpadded",u,{mathbackground:h.getColor("named",l)});e.default.setProperties(T,s(a.options.color.padding)),a.Push(T)},r.ColorMethods.FColorBox=function(a,o){var l=a.GetArgument(o),u=a.GetArgument(o),h=n.default.internalMath(a,a.GetArgument(o)),T=a.options.color,f=a.configuration.packageData.get("color").model,d=a.create("node","mpadded",h,{mathbackground:f.getColor("named",u),style:"border: ".concat(T.borderWidth," solid ").concat(f.getColor("named",l))});e.default.setProperties(d,s(T.padding)),a.Push(d)}})(A_);var O7={},I7={};Object.defineProperty(I7,"__esModule",{value:!0});I7.COLORS=void 0;I7.COLORS=new Map([["Apricot","#FBB982"],["Aquamarine","#00B5BE"],["Bittersweet","#C04F17"],["Black","#221E1F"],["Blue","#2D2F92"],["BlueGreen","#00B3B8"],["BlueViolet","#473992"],["BrickRed","#B6321C"],["Brown","#792500"],["BurntOrange","#F7921D"],["CadetBlue","#74729A"],["CarnationPink","#F282B4"],["Cerulean","#00A2E3"],["CornflowerBlue","#41B0E4"],["Cyan","#00AEEF"],["Dandelion","#FDBC42"],["DarkOrchid","#A4538A"],["Emerald","#00A99D"],["ForestGreen","#009B55"],["Fuchsia","#8C368C"],["Goldenrod","#FFDF42"],["Gray","#949698"],["Green","#00A64F"],["GreenYellow","#DFE674"],["JungleGreen","#00A99A"],["Lavender","#F49EC4"],["LimeGreen","#8DC73E"],["Magenta","#EC008C"],["Mahogany","#A9341F"],["Maroon","#AF3235"],["Melon","#F89E7B"],["MidnightBlue","#006795"],["Mulberry","#A93C93"],["NavyBlue","#006EB8"],["OliveGreen","#3C8031"],["Orange","#F58137"],["OrangeRed","#ED135A"],["Orchid","#AF72B0"],["Peach","#F7965A"],["Periwinkle","#7977B8"],["PineGreen","#008B72"],["Plum","#92268F"],["ProcessBlue","#00B0F0"],["Purple","#99479B"],["RawSienna","#974006"],["Red","#ED1B23"],["RedOrange","#F26035"],["RedViolet","#A1246B"],["Rhodamine","#EF559F"],["RoyalBlue","#0071BC"],["RoyalPurple","#613F99"],["RubineRed","#ED017D"],["Salmon","#F69289"],["SeaGreen","#3FBC9D"],["Sepia","#671800"],["SkyBlue","#46C5DD"],["SpringGreen","#C6DC67"],["Tan","#DA9D76"],["TealBlue","#00AEB3"],["Thistle","#D883B7"],["Turquoise","#00B4CE"],["Violet","#58429B"],["VioletRed","#EF58A0"],["White","#FFFFFF"],["WildStrawberry","#EE2967"],["Yellow","#FFF200"],["YellowGreen","#98CC70"],["YellowOrange","#FAA21A"]]);var H_=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xk=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(O7,"__esModule",{value:!0});O7.ColorModel=void 0;var Li=Xk(Le),Qg=I7,R5=new Map,$k=function(){function r(){this.userColors=new Map}return r.prototype.normalizeColor=function(t,e){if(!t||t==="named")return e;if(R5.has(t)){var n=R5.get(t);return n(e)}throw new Li.default("UndefinedColorModel","Color model '%1' not defined",t)},r.prototype.getColor=function(t,e){return!t||t==="named"?this.getColorByName(e):this.normalizeColor(t,e)},r.prototype.getColorByName=function(t){return this.userColors.has(t)?this.userColors.get(t):Qg.COLORS.has(t)?Qg.COLORS.get(t):t},r.prototype.defineColor=function(t,e,n){var s=this.normalizeColor(t,n);this.userColors.set(e,s)},r}();O7.ColorModel=$k;R5.set("rgb",function(r){var t,e,n=r.trim().split(/\s*,\s*/),s="#";if(n.length!==3)throw new Li.default("ModelArg1","Color values for the %1 model require 3 numbers","rgb");try{for(var a=H_(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(!l.match(/^(\d+(\.\d*)?|\.\d+)$/))throw new Li.default("InvalidDecimalNumber","Invalid decimal number");var u=parseFloat(l);if(u<0||u>1)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","rgb","0","1");var h=Math.floor(u*255).toString(16);h.length<2&&(h="0"+h),s+=h}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return s});R5.set("RGB",function(r){var t,e,n=r.trim().split(/\s*,\s*/),s="#";if(n.length!==3)throw new Li.default("ModelArg1","Color values for the %1 model require 3 numbers","RGB");try{for(var a=H_(n),o=a.next();!o.done;o=a.next()){var l=o.value;if(!l.match(/^\d+$/))throw new Li.default("InvalidNumber","Invalid number");var u=parseInt(l);if(u>255)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","RGB","0","255");var h=u.toString(16);h.length<2&&(h="0"+h),s+=h}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return s});R5.set("gray",function(r){if(!r.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/))throw new Li.default("InvalidDecimalNumber","Invalid decimal number");var t=parseFloat(r);if(t<0||t>1)throw new Li.default("ModelArg2","Color values for the %1 model must be between %2 and %3","gray","0","1");var e=Math.floor(t*255).toString(16);return e.length<2&&(e="0"+e),"#".concat(e).concat(e).concat(e)});Object.defineProperty(zT,"__esModule",{value:!0});zT.ColorConfiguration=void 0;var Yk=Gt,Jk=he,tR=A_,eR=O7;new Yk.CommandMap("color",{color:"Color",textcolor:"TextColor",definecolor:"DefineColor",colorbox:"ColorBox",fcolorbox:"FColorBox"},tR.ColorMethods);var iR=function(r,t){t.parseOptions.packageData.set("color",{model:new eR.ColorModel})};zT.ColorConfiguration=Jk.Configuration.create("color",{handler:{macro:["color"]},options:{color:{padding:"5px",borderWidth:"2px"}},config:iR});var rR={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ColorConfiguration=r.ColorV2Methods=void 0;var t=Gt,e=he;r.ColorV2Methods={Color:function(n,s){var a=n.GetArgument(s),o=n.stack.env.color;n.stack.env.color=a;var l=n.ParseArg(s);o?n.stack.env.color=o:delete n.stack.env.color;var u=n.create("node","mstyle",[l],{mathcolor:a});n.Push(u)}},new t.CommandMap("colorv2",{color:"Color"},r.ColorV2Methods),r.ColorConfiguration=e.Configuration.create("colorv2",{handler:{macro:["colorv2"]}})})(rR);var B5={},nR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),sR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B5,"__esModule",{value:!0});B5.ColortblConfiguration=B5.ColorArrayItem=void 0;var aR=Nt,M_=he,oR=Gt,U9=sR(Le),WT=function(r){nR(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.color={cell:"",row:"",col:[]},e.hasColor=!1,e}return t.prototype.EndEntry=function(){r.prototype.EndEntry.call(this);var e=this.row[this.row.length-1],n=this.color.cell||this.color.row||this.color.col[this.row.length-1];n&&(e.attributes.set("mathbackground",n),this.color.cell="",this.hasColor=!0)},t.prototype.EndRow=function(){r.prototype.EndRow.call(this),this.color.row=""},t.prototype.createMml=function(){var e=r.prototype.createMml.call(this),n=e.isKind("mrow")?e.childNodes[1]:e;return n.isKind("menclose")&&(n=n.childNodes[0].childNodes[0]),this.hasColor&&n.attributes.get("frame")==="none"&&n.attributes.set("frame",""),e},t}(aR.ArrayItem);B5.ColorArrayItem=WT;new oR.CommandMap("colortbl",{cellcolor:["TableColor","cell"],rowcolor:["TableColor","row"],columncolor:["TableColor","col"]},{TableColor:function(r,t,e){var n=r.configuration.packageData.get("color").model,s=r.GetBrackets(t,""),a=n.getColor(s,r.GetArgument(t)),o=r.stack.Top();if(!(o instanceof WT))throw new U9.default("UnsupportedTableColor","Unsupported use of %1",r.currentCS);if(e==="col"){if(o.table.length)throw new U9.default("ColumnColorNotTop","%1 must be in the top row",t);o.color.col[o.row.length]=a,r.GetBrackets(t,"")&&r.GetBrackets(t,"")}else if(o.color[e]=a,e==="row"&&(o.Size()||o.row.length))throw new U9.default("RowColorNotFirst","%1 must be at the beginning of a row",t)}});var lR=function(r,t){t.parseOptions.packageData.has("color")||M_.ConfigurationHandler.get("color").config(r,t)};B5.ColortblConfiguration=M_.Configuration.create("colortbl",{handler:{macro:["colortbl"]},items:{array:WT},priority:10,config:[lR,10]});var qT={},H0={},t6={},w_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(t6,"__esModule",{value:!0});var j9=w_(Ue()),Mr=w_(Le),Fs=s3,Xc;(function(r){function t(d,p){var m=[d,p.char];if(p.attributes)for(var y in p.attributes)m.push(y),m.push(p.attributes[y]);return m}r.disassembleSymbol=t;function e(d){for(var p=d[0],m=d[1],y={},c=2;c<d.length;c=c+2)y[d[c]]=d[c+1];return new Fs.Symbol(p,m,y)}r.assembleSymbol=e;function n(d,p){var m=d.GetNext();if(m!=="\\")throw new Mr.default("MissingCS","%1 must be followed by a control sequence",p);var y=j9.default.trimSpaces(d.GetArgument(p));return y.substr(1)}r.GetCSname=n;function s(d,p){var m=j9.default.trimSpaces(d.GetArgument(p));if(m.charAt(0)==="\\"&&(m=m.substr(1)),!m.match(/^(.|[a-z]+)$/i))throw new Mr.default("IllegalControlSequenceName","Illegal control sequence name for %1",p);return m}r.GetCsNameArgument=s;function a(d,p){var m=d.GetBrackets(p);if(m&&(m=j9.default.trimSpaces(m),!m.match(/^[0-9]+$/)))throw new Mr.default("IllegalParamNumber","Illegal number of parameters specified in %1",p);return m}r.GetArgCount=a;function o(d,p,m){for(var y=d.GetNext(),c=[],Q=0,g=d.i;d.i<d.string.length;){if(y=d.GetNext(),y==="#"){if(g!==d.i&&(c[Q]=d.string.substr(g,d.i-g)),y=d.string.charAt(++d.i),!y.match(/^[1-9]$/))throw new Mr.default("CantUseHash2","Illegal use of # in template for %1",m);if(parseInt(y)!==++Q)throw new Mr.default("SequentialParam","Parameters for %1 must be numbered sequentially",m);g=d.i+1}else if(y==="{")return g!==d.i&&(c[Q]=d.string.substr(g,d.i-g)),c.length>0?[Q.toString()].concat(c):Q;d.i++}throw new Mr.default("MissingReplacementString","Missing replacement string for definition of %1",p)}r.GetTemplate=o;function l(d,p,m){if(m==null)return d.GetArgument(p);for(var y=d.i,c=0,Q=0;d.i<d.string.length;){var g=d.string.charAt(d.i);if(g==="{")d.i===y&&(Q=1),d.GetArgument(p),c=d.i-y;else{if(u(d,m))return Q&&(y++,c-=2),d.string.substr(y,c);if(g==="\\"){d.i++,c++,Q=0;var v=d.string.substr(d.i).match(/[a-z]+|./i);v&&(d.i+=v[0].length,c=d.i-y)}else d.i++,c++,Q=0}}throw new Mr.default("RunawayArgument","Runaway argument for %1?",p)}r.GetParameter=l;function u(d,p){return d.string.substr(d.i,p.length)!==p||p.match(/\\[a-z]+$/i)&&d.string.charAt(d.i+p.length).match(/[a-z]/i)?0:(d.i+=p.length,1)}r.MatchParam=u;function h(d,p,m,y){var c=d.configuration.handlers,Q=c.retrieve(r.NEW_DELIMITER);Q.add(p,new Fs.Symbol(p,m,y))}r.addDelimiter=h;function T(d,p,m,y,c){c===void 0&&(c="");var Q=d.configuration.handlers,g=Q.retrieve(r.NEW_COMMAND);g.add(p,new Fs.Macro(c||p,m,y))}r.addMacro=T;function f(d,p,m,y){var c=d.configuration.handlers,Q=c.retrieve(r.NEW_ENVIRONMENT);Q.add(p,new Fs.Macro(p,m,y))}r.addEnvironment=f,r.NEW_DELIMITER="new-Delimiter",r.NEW_COMMAND="new-Command",r.NEW_ENVIRONMENT="new-Environment"})(Xc||(Xc={}));t6.default=Xc;var uR=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),cR=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),hR=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&uR(t,r,e);return cR(t,r),t},V7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(H0,"__esModule",{value:!0});var TR=V7(Le),fR=hR(Gt),QR=V7(p2),Kr=V7(Ue()),T1=V7(t6),C2={};C2.NewCommand=function(r,t){var e=T1.default.GetCsNameArgument(r,t),n=T1.default.GetArgCount(r,t),s=r.GetBrackets(t),a=r.GetArgument(t);T1.default.addMacro(r,e,C2.Macro,[a,n,s])};C2.NewEnvironment=function(r,t){var e=Kr.default.trimSpaces(r.GetArgument(t)),n=T1.default.GetArgCount(r,t),s=r.GetBrackets(t),a=r.GetArgument(t),o=r.GetArgument(t);T1.default.addEnvironment(r,e,C2.BeginEnv,[!0,a,o,n,s])};C2.MacroDef=function(r,t){var e=T1.default.GetCSname(r,t),n=T1.default.GetTemplate(r,t,"\\"+e),s=r.GetArgument(t);n instanceof Array?T1.default.addMacro(r,e,C2.MacroWithTemplate,[s].concat(n)):T1.default.addMacro(r,e,C2.Macro,[s,n])};C2.Let=function(r,t){var e=T1.default.GetCSname(r,t),n=r.GetNext();n==="="&&(r.i++,n=r.GetNext());var s=r.configuration.handlers;if(n==="\\"){t=T1.default.GetCSname(r,t);var a=s.get("delimiter").lookup("\\"+t);if(a){T1.default.addDelimiter(r,"\\"+e,a.char,a.attributes);return}var o=s.get("macro").applicable(t);if(!o)return;if(o instanceof fR.MacroMap){var l=o.lookup(t);T1.default.addMacro(r,e,l.func,l.args,l.symbol);return}a=o.lookup(t);var u=T1.default.disassembleSymbol(e,a),h=function(f,d){for(var p=[],m=2;m<arguments.length;m++)p[m-2]=arguments[m];var y=T1.default.assembleSymbol(p);return o.parser(f,y)};T1.default.addMacro(r,e,h,u);return}r.i++;var T=s.get("delimiter").lookup(n);if(T){T1.default.addDelimiter(r,"\\"+e,T.char,T.attributes);return}T1.default.addMacro(r,e,C2.Macro,[n])};C2.MacroWithTemplate=function(r,t,e,n){for(var s=[],a=4;a<arguments.length;a++)s[a-4]=arguments[a];var o=parseInt(n,10);if(o){var l=[];if(r.GetNext(),s[0]&&!T1.default.MatchParam(r,s[0]))throw new TR.default("MismatchUseDef","Use of %1 doesn't match its definition",t);for(var u=0;u<o;u++)l.push(T1.default.GetParameter(r,t,s[u+1]));e=Kr.default.substituteArgs(r,l,e)}r.string=Kr.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,Kr.default.checkMaxMacros(r)};C2.BeginEnv=function(r,t,e,n,s,a){if(t.getProperty("end")&&r.stack.env.closing===t.getName()){delete r.stack.env.closing;var o=r.string.slice(r.i);return r.string=n,r.i=0,r.Parse(),r.string=o,r.i=0,r.itemFactory.create("end").setProperty("name",t.getName())}if(s){var l=[];if(a!=null){var u=r.GetBrackets("\\begin{"+t.getName()+"}");l.push(u??a)}for(var h=l.length;h<s;h++)l.push(r.GetArgument("\\begin{"+t.getName()+"}"));e=Kr.default.substituteArgs(r,l,e),n=Kr.default.substituteArgs(r,[],n)}return r.string=Kr.default.addArgs(r,e,r.string.slice(r.i)),r.i=0,r.itemFactory.create("beginEnv").setProperty("name",t.getName())};C2.Macro=QR.default.Macro;H0.default=C2;var M0={},dR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),pR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(M0,"__esModule",{value:!0});M0.BeginEnvItem=void 0;var dg=pR(Le),gR=n3,mR=function(r){dR(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"beginEnv"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new dg.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new dg.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return r.prototype.checkItem.call(this,e)},t}(gR.BaseItem);M0.BeginEnvItem=mR;var C_=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},D_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},G9;Object.defineProperty(qT,"__esModule",{value:!0});qT.ConfigMacrosConfiguration=void 0;var O_=he,pg=H1,gg=Gt,yR=D_(h3),$c=s3,Yc=D_(H0),mg=M0,Jc="configmacros-map",th="configmacros-env-map";function vR(r){new gg.CommandMap(Jc,{},{}),new gg.EnvironmentMap(th,yR.default.environment,{},{}),r.append(O_.Configuration.local({handler:{macro:[Jc],environment:[th]},priority:3}))}function LR(r,t){xR(t),_R(t)}function xR(r){var t,e,n=r.parseOptions.handlers.retrieve(Jc),s=r.parseOptions.options.macros;try{for(var a=C_(Object.keys(s)),o=a.next();!o.done;o=a.next()){var l=o.value,u=typeof s[l]=="string"?[s[l]]:s[l],h=Array.isArray(u[2])?new $c.Macro(l,Yc.default.MacroWithTemplate,u.slice(0,2).concat(u[2])):new $c.Macro(l,Yc.default.Macro,u);n.add(l,h)}}catch(T){t={error:T}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}function _R(r){var t,e,n=r.parseOptions.handlers.retrieve(th),s=r.parseOptions.options.environments;try{for(var a=C_(Object.keys(s)),o=a.next();!o.done;o=a.next()){var l=o.value;n.add(l,new $c.Macro(l,Yc.default.BeginEnv,[!0].concat(s[l])))}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}qT.ConfigMacrosConfiguration=O_.Configuration.create("configmacros",{init:vR,config:LR,items:(G9={},G9[mg.BeginEnvItem.prototype.kind]=mg.BeginEnvItem,G9),options:{macros:(0,pg.expandable)({}),environments:(0,pg.expandable)({})}});var bR={};(function(r){var t=_&&_.__extends||function(){var d=function(p,m){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,c){y.__proto__=c}||function(y,c){for(var Q in c)Object.prototype.hasOwnProperty.call(c,Q)&&(y[Q]=c[Q])},d(p,m)};return function(p,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");d(p,m);function y(){this.constructor=p}p.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),e=_&&_.__read||function(d,p){var m=typeof Symbol=="function"&&d[Symbol.iterator];if(!m)return d;var y=m.call(d),c,Q=[],g;try{for(;(p===void 0||p-- >0)&&!(c=y.next()).done;)Q.push(c.value)}catch(v){g={error:v}}finally{try{c&&!c.done&&(m=y.return)&&m.call(y)}finally{if(g)throw g.error}}return Q},n=_&&_.__importDefault||function(d){return d&&d.__esModule?d:{default:d}},s;Object.defineProperty(r,"__esModule",{value:!0}),r.EmpheqConfiguration=r.EmpheqMethods=r.EmpheqBeginItem=void 0;var a=he,o=Gt,l=n(Ue()),u=n(Le),h=Nt,T=jT,f=function(d){t(p,d);function p(){return d!==null&&d.apply(this,arguments)||this}return Object.defineProperty(p.prototype,"kind",{get:function(){return"empheq-begin"},enumerable:!1,configurable:!0}),p.prototype.checkItem=function(m){return m.isKind("end")&&m.getName()===this.getName()&&this.setProperty("end",!1),d.prototype.checkItem.call(this,m)},p}(h.BeginItem);r.EmpheqBeginItem=f,r.EmpheqMethods={Empheq:function(d,p){if(d.stack.env.closing===p.getName()){delete d.stack.env.closing,d.Push(d.itemFactory.create("end").setProperty("name",d.stack.global.empheq)),d.stack.global.empheq="";var m=d.stack.Top();T.EmpheqUtil.adjustTable(m,d),d.Push(d.itemFactory.create("end").setProperty("name","empheq"))}else{l.default.checkEqnEnv(d),delete d.stack.global.eqnenv;var y=d.GetBrackets("\\begin{"+p.getName()+"}")||"",c=e((d.GetArgument("\\begin{"+p.getName()+"}")||"").split(/=/),2),Q=c[0],g=c[1];if(!T.EmpheqUtil.checkEnv(Q))throw new u.default("UnknownEnv",'Unknown environment "%1"',Q);y&&p.setProperties(T.EmpheqUtil.splitOptions(y,{left:1,right:1})),d.stack.global.empheq=Q,d.string="\\begin{"+Q+"}"+(g?"{"+g+"}":"")+d.string.slice(d.i),d.i=0,d.Push(p)}},EmpheqMO:function(d,p,m){d.Push(d.create("token","mo",{},m))},EmpheqDelim:function(d,p){var m=d.GetDelimiter(p);d.Push(d.create("token","mo",{stretchy:!0,symmetric:!0},m))}},new o.EnvironmentMap("empheq-env",T.EmpheqUtil.environment,{empheq:["Empheq","empheq"]},r.EmpheqMethods),new o.CommandMap("empheq-macros",{empheqlbrace:["EmpheqMO","{"],empheqrbrace:["EmpheqMO","}"],empheqlbrack:["EmpheqMO","["],empheqrbrack:["EmpheqMO","]"],empheqlangle:["EmpheqMO","⟨"],empheqrangle:["EmpheqMO","⟩"],empheqlparen:["EmpheqMO","("],empheqrparen:["EmpheqMO",")"],empheqlvert:["EmpheqMO","|"],empheqrvert:["EmpheqMO","|"],empheqlVert:["EmpheqMO","‖"],empheqrVert:["EmpheqMO","‖"],empheqlfloor:["EmpheqMO","⌊"],empheqrfloor:["EmpheqMO","⌋"],empheqlceil:["EmpheqMO","⌈"],empheqrceil:["EmpheqMO","⌉"],empheqbiglbrace:["EmpheqMO","{"],empheqbigrbrace:["EmpheqMO","}"],empheqbiglbrack:["EmpheqMO","["],empheqbigrbrack:["EmpheqMO","]"],empheqbiglangle:["EmpheqMO","⟨"],empheqbigrangle:["EmpheqMO","⟩"],empheqbiglparen:["EmpheqMO","("],empheqbigrparen:["EmpheqMO",")"],empheqbiglvert:["EmpheqMO","|"],empheqbigrvert:["EmpheqMO","|"],empheqbiglVert:["EmpheqMO","‖"],empheqbigrVert:["EmpheqMO","‖"],empheqbiglfloor:["EmpheqMO","⌊"],empheqbigrfloor:["EmpheqMO","⌋"],empheqbiglceil:["EmpheqMO","⌈"],empheqbigrceil:["EmpheqMO","⌉"],empheql:"EmpheqDelim",empheqr:"EmpheqDelim",empheqbigl:"EmpheqDelim",empheqbigr:"EmpheqDelim"},r.EmpheqMethods),r.EmpheqConfiguration=a.Configuration.create("empheq",{handler:{macro:["empheq-macros"],environment:["empheq-env"]},items:(s={},s[f.prototype.kind]=f,s)})})(bR);var SR={},P7={},ER=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},AR=ER(H0),HR=Gt;new HR.CommandMap("Newcommand-macros",{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"},AR.default);var MR=_&&_.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,s)}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),wR=_&&_.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),CR=_&&_.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.prototype.hasOwnProperty.call(r,e)&&MR(t,r,e);return wR(t,r),t},I_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},z9;Object.defineProperty(P7,"__esModule",{value:!0});P7.NewcommandConfiguration=void 0;var V_=he,yg=M0,wr=I_(t6),vg=I_(h3),W9=CR(Gt),DR=function(r){new W9.DelimiterMap(wr.default.NEW_DELIMITER,vg.default.delimiter,{}),new W9.CommandMap(wr.default.NEW_COMMAND,{},{}),new W9.EnvironmentMap(wr.default.NEW_ENVIRONMENT,vg.default.environment,{},{}),r.append(V_.Configuration.local({handler:{character:[],delimiter:[wr.default.NEW_DELIMITER],macro:[wr.default.NEW_DELIMITER,wr.default.NEW_COMMAND],environment:[wr.default.NEW_ENVIRONMENT]},priority:-1}))};P7.NewcommandConfiguration=V_.Configuration.create("newcommand",{handler:{macro:["Newcommand-macros"]},items:(z9={},z9[yg.BeginEnvItem.prototype.kind]=yg.BeginEnvItem,z9),options:{maxMacros:1e3},init:DR});(function(r){var t=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(r,"__esModule",{value:!0}),r.ExtpfeilConfiguration=r.ExtpfeilMethods=void 0;var e=he,n=Gt,s=Yn,a=t(t6),o=P7,l=t(Le);r.ExtpfeilMethods={},r.ExtpfeilMethods.xArrow=s.AmsMethods.xArrow,r.ExtpfeilMethods.NewExtArrow=function(h,T){var f=h.GetArgument(T),d=h.GetArgument(T),p=h.GetArgument(T);if(!f.match(/^\\([a-z]+|.)$/i))throw new l.default("NewextarrowArg1","First argument to %1 must be a control sequence name",T);if(!d.match(/^(\d+),(\d+)$/))throw new l.default("NewextarrowArg2","Second argument to %1 must be two integers separated by a comma",T);if(!p.match(/^(\d+|0x[0-9A-F]+)$/i))throw new l.default("NewextarrowArg3","Third argument to %1 must be a unicode character number",T);f=f.substr(1);var m=d.split(",");a.default.addMacro(h,f,r.ExtpfeilMethods.xArrow,[parseInt(p),parseInt(m[0]),parseInt(m[1])])},new n.CommandMap("extpfeil",{xtwoheadrightarrow:["xArrow",8608,12,16],xtwoheadleftarrow:["xArrow",8606,17,13],xmapsto:["xArrow",8614,6,7],xlongequal:["xArrow",61,7,7],xtofrom:["xArrow",8644,12,12],Newextarrow:"NewExtArrow"},r.ExtpfeilMethods);var u=function(h){o.NewcommandConfiguration.init(h)};r.ExtpfeilConfiguration=e.Configuration.create("extpfeil",{handler:{macro:["extpfeil"]},init:u})})(SR);var ZT={};Object.defineProperty(ZT,"__esModule",{value:!0});ZT.GensymbConfiguration=void 0;var OR=he,IR=q1,VR=Gt;function PR(r,t){var e=t.attributes||{};e.mathvariant=IR.TexConstant.Variant.NORMAL,e.class="MathML-Unit";var n=r.create("token","mi",e,t.char);r.Push(n)}new VR.CharacterMap("gensymb-symbols",PR,{ohm:"Ω",degree:"°",celsius:"℃",perthousand:"‰",micro:"µ"});ZT.GensymbConfiguration=OR.Configuration.create("gensymb",{handler:{macro:["gensymb-symbols"]}});var KT={},XT={},kR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(XT,"__esModule",{value:!0});var V3=kR(Ne),w0={};w0.Href=function(r,t){var e=r.GetArgument(t),n=k7(r,t);V3.default.setAttribute(n,"href",e),r.Push(n)};w0.Class=function(r,t){var e=r.GetArgument(t),n=k7(r,t),s=V3.default.getAttribute(n,"class");s&&(e=s+" "+e),V3.default.setAttribute(n,"class",e),r.Push(n)};w0.Style=function(r,t){var e=r.GetArgument(t),n=k7(r,t),s=V3.default.getAttribute(n,"style");s&&(e.charAt(e.length-1)!==";"&&(e+=";"),e=s+" "+e),V3.default.setAttribute(n,"style",e),r.Push(n)};w0.Id=function(r,t){var e=r.GetArgument(t),n=k7(r,t);V3.default.setAttribute(n,"id",e),r.Push(n)};var k7=function(r,t){var e=r.ParseArg(t);if(!V3.default.isInferred(e))return e;var n=V3.default.getChildren(e);if(n.length===1)return n[0];var s=r.create("node","mrow");return V3.default.copyChildren(e,s),V3.default.copyAttributes(e,s),s};XT.default=w0;var RR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(KT,"__esModule",{value:!0});KT.HtmlConfiguration=void 0;var BR=he,FR=Gt,NR=RR(XT);new FR.CommandMap("html_macros",{href:"Href",class:"Class",style:"Style",cssId:"Id"},NR.default);KT.HtmlConfiguration=BR.Configuration.create("html",{handler:{macro:["html_macros"]}});var q9={},Z9={},K9={},x6={},Lg;function P_(){if(Lg)return x6;Lg=1;var r=_&&_.__read||function(T,f){var d=typeof Symbol=="function"&&T[Symbol.iterator];if(!d)return T;var p=d.call(T),m,y=[],c;try{for(;(f===void 0||f-- >0)&&!(m=p.next()).done;)y.push(m.value)}catch(Q){c={error:Q}}finally{try{m&&!m.done&&(d=p.return)&&d.call(p)}finally{if(c)throw c.error}}return y},t=_&&_.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(x6,"__esModule",{value:!0}),x6.MathtoolsUtil=void 0;var e=Nt,n=t(Ue()),s=t(e2()),a=t(Le),o=s3,l=H1,u=k_(),h=R_();return x6.MathtoolsUtil={setDisplayLevel:function(T,f){if(f){var d=r((0,l.lookup)(f,{"\\displaystyle":[!0,0],"\\textstyle":[!1,0],"\\scriptstyle":[!1,1],"\\scriptscriptstyle":[!1,2]},[null,null]),2),p=d[0],m=d[1];p!==null&&(T.attributes.set("displaystyle",p),T.attributes.set("scriptlevel",m))}},checkAlignment:function(T,f){var d=T.stack.Top();if(d.kind!==e.EqnArrayItem.prototype.kind)throw new a.default("NotInAlignment","%1 can only be used in aligment environments",f);return d},addPairedDelims:function(T,f,d){var p=T.handlers.retrieve(h.PAIREDDELIMS);p.add(f,new o.Macro(f,u.MathtoolsMethods.PairedDelimiters,d))},spreadLines:function(T,f){if(T.isKind("mtable")){var d=T.attributes.get("rowspacing");if(d){var p=n.default.dimen2em(f);d=d.split(/ /).map(function(m){return n.default.Em(Math.max(0,n.default.dimen2em(m)+p))}).join(" ")}else d=f;T.attributes.set("rowspacing",d)}},plusOrMinus:function(T,f){if(f=f.trim(),!f.match(/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)$/))throw new a.default("NotANumber","Argument to %1 is not a number",T);return f.match(/^[-+]/)?f:"+"+f},getScript:function(T,f,d){var p=n.default.trimSpaces(T.GetArgument(f));if(p==="")return T.create("node","none");var m=T.options.mathtools["prescript-".concat(d,"-format")];return m&&(p="".concat(m,"{").concat(p,"}")),new s.default(p,T.stack.env,T.configuration).mml()}},x6}var xg;function k_(){return xg||(xg=1,function(r){var t=_&&_.__assign||function(){return t=Object.assign||function(Q){for(var g,v=1,L=arguments.length;v<L;v++){g=arguments[v];for(var x in g)Object.prototype.hasOwnProperty.call(g,x)&&(Q[x]=g[x])}return Q},t.apply(this,arguments)},e=_&&_.__read||function(Q,g){var v=typeof Symbol=="function"&&Q[Symbol.iterator];if(!v)return Q;var L=v.call(Q),x,b=[],S;try{for(;(g===void 0||g-- >0)&&!(x=L.next()).done;)b.push(x.value)}catch(E){S={error:E}}finally{try{x&&!x.done&&(v=L.return)&&v.call(L)}finally{if(S)throw S.error}}return b},n=_&&_.__values||function(Q){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&Q[g],L=0;if(v)return v.call(Q);if(Q&&typeof Q.length=="number")return{next:function(){return Q&&L>=Q.length&&(Q=void 0),{value:Q&&Q[L++],done:!Q}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")},s=_&&_.__importDefault||function(Q){return Q&&Q.__esModule?Q:{default:Q}};Object.defineProperty(r,"__esModule",{value:!0}),r.MathtoolsMethods=void 0;var a=s(Ue()),o=Yn,l=s(p2),u=s(e2()),h=s(Le),T=s(Ne),f=jt,d=G3,p=H1,m=s(t6),y=s(H0),c=P_();r.MathtoolsMethods={MtMatrix:function(Q,g,v,L){var x=Q.GetBrackets("\\begin{".concat(g.getName(),"}"),"c");return r.MathtoolsMethods.Array(Q,g,v,L,x)},MtSmallMatrix:function(Q,g,v,L,x){return x||(x=Q.GetBrackets("\\begin{".concat(g.getName(),"}"),Q.options.mathtools["smallmatrix-align"])),r.MathtoolsMethods.Array(Q,g,v,L,x,a.default.Em(1/3),".2em","S",1)},MtMultlined:function(Q,g){var v,L="\\begin{".concat(g.getName(),"}"),x=Q.GetBrackets(L,Q.options.mathtools["multlined-pos"]||"c"),b=x?Q.GetBrackets(L,""):"";x&&!x.match(/^[cbt]$/)&&(v=e([x,b],2),b=v[0],x=v[1]),Q.Push(g);var S=Q.itemFactory.create("multlined",Q,g);return S.arraydef={displaystyle:!0,rowspacing:".5em",width:b||"auto",columnwidth:"100%"},a.default.setArrayAlign(S,x||"c")},HandleShove:function(Q,g,v){var L=Q.stack.Top();if(L.kind!=="multline"&&L.kind!=="multlined")throw new h.default("CommandInMultlined","%1 can only appear within the multline or multlined environments",g);if(L.Size())throw new h.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",g);L.setProperty("shove",v);var x=Q.GetBrackets(g),b=Q.ParseArg(g);if(x){var S=Q.create("node","mrow",[]),E=Q.create("node","mspace",[],{width:x});v==="left"?(S.appendChild(E),S.appendChild(b)):(S.appendChild(b),S.appendChild(E)),b=S}Q.Push(b)},SpreadLines:function(Q,g){var v,L;if(Q.stack.env.closing===g.getName()){delete Q.stack.env.closing;var x=Q.stack.Pop(),b=x.toMml(),S=x.getProperty("spread");if(b.isInferred)try{for(var E=n(T.default.getChildren(b)),A=E.next();!A.done;A=E.next()){var M=A.value;c.MathtoolsUtil.spreadLines(M,S)}}catch(D){v={error:D}}finally{try{A&&!A.done&&(L=E.return)&&L.call(E)}finally{if(v)throw v.error}}else c.MathtoolsUtil.spreadLines(b,S);Q.Push(b)}else{var S=Q.GetDimen("\\begin{".concat(g.getName(),"}"));g.setProperty("spread",S),Q.Push(g)}},Cases:function(Q,g,v,L,x){var b=Q.itemFactory.create("array").setProperty("casesEnv",g.getName());return b.arraydef={rowspacing:".2em",columnspacing:"1em",columnalign:"left"},x==="D"&&(b.arraydef.displaystyle=!0),b.setProperties({open:v,close:L}),Q.Push(g),b},MathLap:function(Q,g,v,L){var x=Q.GetBrackets(g,"").trim(),b=Q.create("node","mstyle",[Q.create("node","mpadded",[Q.ParseArg(g)],t({width:0},v==="r"?{}:{lspace:v==="l"?"-1width":"-.5width"}))],{"data-cramped":L});c.MathtoolsUtil.setDisplayLevel(b,x),Q.Push(Q.create("node","TeXAtom",[b]))},Cramped:function(Q,g){var v=Q.GetBrackets(g,"").trim(),L=Q.ParseArg(g),x=Q.create("node","mstyle",[L],{"data-cramped":!0});c.MathtoolsUtil.setDisplayLevel(x,v),Q.Push(x)},MtLap:function(Q,g,v){var L=a.default.internalMath(Q,Q.GetArgument(g),0),x=Q.create("node","mpadded",L,{width:0});v!=="r"&&T.default.setAttribute(x,"lspace",v==="l"?"-1width":"-.5width"),Q.Push(x)},MathMakeBox:function(Q,g){var v=Q.GetBrackets(g),L=Q.GetBrackets(g,"c"),x=Q.create("node","mpadded",[Q.ParseArg(g)]);v&&T.default.setAttribute(x,"width",v);var b=(0,p.lookup)(L,{c:"center",r:"right"},"");b&&T.default.setAttribute(x,"data-align",b),Q.Push(x)},MathMBox:function(Q,g){Q.Push(Q.create("node","mrow",[Q.ParseArg(g)]))},UnderOverBracket:function(Q,g){var v=(0,d.length2em)(Q.GetBrackets(g,".1em"),.1),L=Q.GetBrackets(g,".2em"),x=Q.GetArgument(g),b=e(g.charAt(1)==="o"?["over","accent","bottom"]:["under","accentunder","top"],3),S=b[0],E=b[1],A=b[2],M=(0,d.em)(v),D=new u.default(x,Q.stack.env,Q.configuration).mml(),I=new u.default(x,Q.stack.env,Q.configuration).mml(),P=Q.create("node","mpadded",[Q.create("node","mphantom",[I])],{style:"border: ".concat(M," solid; border-").concat(A,": none"),height:L,depth:0}),R=a.default.underOver(Q,D,P,S,!0),F=T.default.getChildAt(T.default.getChildAt(R,0),0);T.default.setAttribute(F,E,!0),Q.Push(R)},Aboxed:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.row.length%2===1&&v.row.push(Q.create("node","mtd",[]));var L=Q.GetArgument(g),x=Q.string.substr(Q.i);Q.string=L+"&&\\endAboxed",Q.i=0;var b=Q.GetUpTo(g,"&"),S=Q.GetUpTo(g,"&");Q.GetUpTo(g,"\\endAboxed");var E=a.default.substituteArgs(Q,[b,S],"\\rlap{\\boxed{#1{}#2}}\\kern.267em\\phantom{#1}&\\phantom{{}#2}\\kern.267em");Q.string=E+x,Q.i=0},ArrowBetweenLines:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);if(v.Size()||v.row.length)throw new h.default("BetweenLines","%1 must be on a row by itself",g);var L=Q.GetStar(),x=Q.GetBrackets(g,"\\Updownarrow");L&&(v.EndEntry(),v.EndEntry());var b=L?"\\quad"+x:x+"\\quad",S=new u.default(b,Q.stack.env,Q.configuration).mml();Q.Push(S),v.EndEntry(),v.EndRow()},VDotsWithin:function(Q,g){var v=Q.stack.Top(),L=v.getProperty("flushspaceabove")===v.table.length,x="\\mmlToken{mi}{}"+Q.GetArgument(g)+"\\mmlToken{mi}{}",b=new u.default(x,Q.stack.env,Q.configuration).mml(),S=Q.create("node","mpadded",[Q.create("node","mpadded",[Q.create("node","mo",[Q.create("text","⋮")])],t({width:0,lspace:"-.5width"},L?{height:"-.6em",voffset:"-.18em"}:{})),Q.create("node","mphantom",[b])],{lspace:".5width"});Q.Push(S)},ShortVDotsWithin:function(Q,g){var v=Q.stack.Top(),L=Q.GetStar();r.MathtoolsMethods.FlushSpaceAbove(Q,"\\MTFlushSpaceAbove"),!L&&v.EndEntry(),r.MathtoolsMethods.VDotsWithin(Q,"\\vdotswithin"),L&&v.EndEntry(),r.MathtoolsMethods.FlushSpaceBelow(Q,"\\MTFlushSpaceBelow")},FlushSpaceAbove:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.setProperty("flushspaceabove",v.table.length),v.addRowSpacing("-"+Q.options.mathtools.shortvdotsadjustabove)},FlushSpaceBelow:function(Q,g){var v=c.MathtoolsUtil.checkAlignment(Q,g);v.Size()&&v.EndEntry(),v.EndRow(),v.addRowSpacing("-"+Q.options.mathtools.shortvdotsadjustbelow)},PairedDelimiters:function(Q,g,v,L,x,b,S,E){x===void 0&&(x="#1"),b===void 0&&(b=1),S===void 0&&(S=""),E===void 0&&(E="");var A=Q.GetStar(),M=A?"":Q.GetBrackets(g),D=e(A?["\\left","\\right"]:M?[M+"l",M+"r"]:["",""],2),I=D[0],P=D[1],R=A?"\\middle":M||"";if(b){for(var F=[],X=F.length;X<b;X++)F.push(Q.GetArgument(g));S=a.default.substituteArgs(Q,F,S),x=a.default.substituteArgs(Q,F,x),E=a.default.substituteArgs(Q,F,E)}x=x.replace(/\\delimsize/g,R),Q.string=[S,I,v,x,P,L,E,Q.string.substr(Q.i)].reduce(function(st,rt){return a.default.addArgs(Q,st,rt)},""),Q.i=0,a.default.checkMaxMacros(Q)},DeclarePairedDelimiter:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=Q.GetArgument(g),x=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[L,x])},DeclarePairedDelimiterX:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=m.default.GetArgCount(Q,g),x=Q.GetArgument(g),b=Q.GetArgument(g),S=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[x,b,S,L])},DeclarePairedDelimiterXPP:function(Q,g){var v=m.default.GetCsNameArgument(Q,g),L=m.default.GetArgCount(Q,g),x=Q.GetArgument(g),b=Q.GetArgument(g),S=Q.GetArgument(g),E=Q.GetArgument(g),A=Q.GetArgument(g);c.MathtoolsUtil.addPairedDelims(Q.configuration,v,[b,S,A,L,x,E])},CenterColon:function(Q,g,v,L,x){L===void 0&&(L=!1),x===void 0&&(x=!1);var b=Q.options.mathtools,S=Q.create("token","mo",{},":");if(v&&(b.centercolon||L)){var E=b["centercolon-offset"];S=Q.create("node","mpadded",[S],t({voffset:E,height:"+".concat(E),depth:"-".concat(E)},x?{width:b["thincolon-dw"],lspace:b["thincolon-dx"]}:{}))}Q.Push(S)},Relation:function(Q,g,v,L){var x=Q.options.mathtools;x["use-unicode"]&&L?Q.Push(Q.create("token","mo",{texClass:f.TEXCLASS.REL},L)):(v="\\mathrel{"+v.replace(/:/g,"\\MTThinColon").replace(/-/g,"\\mathrel{-}")+"}",Q.string=a.default.addArgs(Q,v,Q.string.substr(Q.i)),Q.i=0)},NArrow:function(Q,g,v,L){Q.Push(Q.create("node","TeXAtom",[Q.create("token","mtext",{},v),Q.create("node","mpadded",[Q.create("node","mpadded",[Q.create("node","menclose",[Q.create("node","mspace",[],{height:".2em",depth:0,width:".4em"})],{notation:"updiagonalstrike","data-thickness":".05em","data-padding":0})],{width:0,lspace:"-.5width",voffset:L}),Q.create("node","mphantom",[Q.create("token","mtext",{},v)])],{width:0,lspace:"-.5width"})],{texClass:f.TEXCLASS.REL}))},SplitFrac:function(Q,g,v){var L=Q.ParseArg(g),x=Q.ParseArg(g);Q.Push(Q.create("node","mstyle",[Q.create("node","mfrac",[Q.create("node","mstyle",[L,Q.create("token","mi"),Q.create("token","mspace",{width:"1em"})],{scriptlevel:0}),Q.create("node","mstyle",[Q.create("token","mspace",{width:"1em"}),Q.create("token","mi"),x],{scriptlevel:0})],{linethickness:0,numalign:"left",denomalign:"right"})],{displaystyle:v,scriptlevel:0}))},XMathStrut:function(Q,g){var v=Q.GetBrackets(g),L=Q.GetArgument(g);L=c.MathtoolsUtil.plusOrMinus(g,L),v=c.MathtoolsUtil.plusOrMinus(g,v||L),Q.Push(Q.create("node","TeXAtom",[Q.create("node","mpadded",[Q.create("node","mphantom",[Q.create("token","mo",{stretchy:!1},"(")])],{width:0,height:L+"height",depth:v+"depth"})],{texClass:f.TEXCLASS.ORD}))},Prescript:function(Q,g){var v=c.MathtoolsUtil.getScript(Q,g,"sup"),L=c.MathtoolsUtil.getScript(Q,g,"sub"),x=c.MathtoolsUtil.getScript(Q,g,"arg");if(T.default.isType(v,"none")&&T.default.isType(L,"none")){Q.Push(x);return}var b=Q.create("node","mmultiscripts",[x]);T.default.getChildren(b).push(null,null),T.default.appendChildren(b,[Q.create("node","mprescripts"),L,v]),b.setProperty("fixPrescript",!0),Q.Push(b)},NewTagForm:function(Q,g,v){v===void 0&&(v=!1);var L=Q.tags;if(!("mtFormats"in L))throw new h.default("TagsNotMT","%1 can only be used with ams or mathtools tags",g);var x=Q.GetArgument(g).trim();if(!x)throw new h.default("InvalidTagFormID","Tag form name can't be empty");var b=Q.GetBrackets(g,""),S=Q.GetArgument(g),E=Q.GetArgument(g);if(!v&&L.mtFormats.has(x))throw new h.default("DuplicateTagForm","Duplicate tag form: %1",x);L.mtFormats.set(x,[S,E,b])},UseTagForm:function(Q,g){var v=Q.tags;if(!("mtFormats"in v))throw new h.default("TagsNotMT","%1 can only be used with ams or mathtools tags",g);var L=Q.GetArgument(g).trim();if(!L){v.mtCurrent=null;return}if(!v.mtFormats.has(L))throw new h.default("UndefinedTagForm","Undefined tag form: %1",L);v.mtCurrent=v.mtFormats.get(L)},SetOptions:function(Q,g){var v,L,x=Q.options.mathtools;if(!x["allow-mathtoolsset"])throw new h.default("ForbiddenMathtoolsSet","%1 is disabled",g);var b={};Object.keys(x).forEach(function(I){I!=="pariedDelimiters"&&I!=="tagforms"&&I!=="allow-mathtoolsset"&&(b[I]=1)});var S=Q.GetArgument(g),E=a.default.keyvalOptions(S,b,!0);try{for(var A=n(Object.keys(E)),M=A.next();!M.done;M=A.next()){var D=M.value;x[D]=E[D]}}catch(I){v={error:I}}finally{try{M&&!M.done&&(L=A.return)&&L.call(A)}finally{if(v)throw v.error}}},Array:l.default.Array,Macro:l.default.Macro,xArrow:o.AmsMethods.xArrow,HandleRef:o.AmsMethods.HandleRef,AmsEqnArray:o.AmsMethods.AmsEqnArray,MacroWithTemplate:y.default.MacroWithTemplate}}(K9)),K9}var _g;function UR(){if(_g)return Z9;_g=1;var r=_&&_.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Z9,"__esModule",{value:!0});var t=r(h3),e=Gt,n=q1,s=k_();return new e.CommandMap("mathtools-macros",{shoveleft:["HandleShove",n.TexConstant.Align.LEFT],shoveright:["HandleShove",n.TexConstant.Align.RIGHT],xleftrightarrow:["xArrow",8596,10,10],xLeftarrow:["xArrow",8656,12,7],xRightarrow:["xArrow",8658,7,12],xLeftrightarrow:["xArrow",8660,12,12],xhookleftarrow:["xArrow",8617,10,5],xhookrightarrow:["xArrow",8618,5,10],xmapsto:["xArrow",8614,10,10],xrightharpoondown:["xArrow",8641,5,10],xleftharpoondown:["xArrow",8637,10,5],xrightleftharpoons:["xArrow",8652,10,10],xrightharpoonup:["xArrow",8640,5,10],xleftharpoonup:["xArrow",8636,10,5],xleftrightharpoons:["xArrow",8651,10,10],mathllap:["MathLap","l",!1],mathrlap:["MathLap","r",!1],mathclap:["MathLap","c",!1],clap:["MtLap","c"],textllap:["MtLap","l"],textrlap:["MtLap","r"],textclap:["MtLap","c"],cramped:"Cramped",crampedllap:["MathLap","l",!0],crampedrlap:["MathLap","r",!0],crampedclap:["MathLap","c",!0],crampedsubstack:["Macro","\\begin{crampedsubarray}{c}#1\\end{crampedsubarray}",1],mathmbox:"MathMBox",mathmakebox:"MathMakeBox",overbracket:"UnderOverBracket",underbracket:"UnderOverBracket",refeq:"HandleRef",MoveEqLeft:["Macro","\\hspace{#1em}&\\hspace{-#1em}",1,"2"],Aboxed:"Aboxed",ArrowBetweenLines:"ArrowBetweenLines",vdotswithin:"VDotsWithin",shortvdotswithin:"ShortVDotsWithin",MTFlushSpaceAbove:"FlushSpaceAbove",MTFlushSpaceBelow:"FlushSpaceBelow",DeclarePairedDelimiter:"DeclarePairedDelimiter",DeclarePairedDelimiterX:"DeclarePairedDelimiterX",DeclarePairedDelimiterXPP:"DeclarePairedDelimiterXPP",DeclarePairedDelimiters:"DeclarePairedDelimiter",DeclarePairedDelimitersX:"DeclarePairedDelimiterX",DeclarePairedDelimitersXPP:"DeclarePairedDelimiterXPP",centercolon:["CenterColon",!0,!0],ordinarycolon:["CenterColon",!1],MTThinColon:["CenterColon",!0,!0,!0],coloneqq:["Relation",":=","≔"],Coloneqq:["Relation","::=","⩴"],coloneq:["Relation",":-"],Coloneq:["Relation","::-"],eqqcolon:["Relation","=:","≕"],Eqqcolon:["Relation","=::"],eqcolon:["Relation","-:","∹"],Eqcolon:["Relation","-::"],colonapprox:["Relation",":\\approx"],Colonapprox:["Relation","::\\approx"],colonsim:["Relation",":\\sim"],Colonsim:["Relation","::\\sim"],dblcolon:["Relation","::","∷"],nuparrow:["NArrow","↑",".06em"],ndownarrow:["NArrow","↓",".25em"],bigtimes:["Macro","\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}"],splitfrac:["SplitFrac",!1],splitdfrac:["SplitFrac",!0],xmathstrut:"XMathStrut",prescript:"Prescript",newtagform:["NewTagForm",!1],renewtagform:["NewTagForm",!0],usetagform:"UseTagForm",adjustlimits:["MacroWithTemplate","\\mathop{{#1}\\vphantom{{#3}}}_{{#2}\\vphantom{{#4}}}\\mathop{{#3}\\vphantom{{#1}}}_{{#4}\\vphantom{{#2}}}",4,,"_",,"_"],mathtoolsset:"SetOptions"},s.MathtoolsMethods),new e.EnvironmentMap("mathtools-environments",t.default.environment,{dcases:["Array",null,"\\{","","ll",null,".2em","D"],rcases:["Array",null,"","\\}","ll",null,".2em"],drcases:["Array",null,"","\\}","ll",null,".2em","D"],"dcases*":["Cases",null,"{","","D"],"rcases*":["Cases",null,"","}"],"drcases*":["Cases",null,"","}","D"],"cases*":["Cases",null,"{",""],"matrix*":["MtMatrix",null,null,null],"pmatrix*":["MtMatrix",null,"(",")"],"bmatrix*":["MtMatrix",null,"[","]"],"Bmatrix*":["MtMatrix",null,"\\{","\\}"],"vmatrix*":["MtMatrix",null,"\\vert","\\vert"],"Vmatrix*":["MtMatrix",null,"\\Vert","\\Vert"],"smallmatrix*":["MtSmallMatrix",null,null,null],psmallmatrix:["MtSmallMatrix",null,"(",")","c"],"psmallmatrix*":["MtSmallMatrix",null,"(",")"],bsmallmatrix:["MtSmallMatrix",null,"[","]","c"],"bsmallmatrix*":["MtSmallMatrix",null,"[","]"],Bsmallmatrix:["MtSmallMatrix",null,"\\{","\\}","c"],"Bsmallmatrix*":["MtSmallMatrix",null,"\\{","\\}"],vsmallmatrix:["MtSmallMatrix",null,"\\vert","\\vert","c"],"vsmallmatrix*":["MtSmallMatrix",null,"\\vert","\\vert"],Vsmallmatrix:["MtSmallMatrix",null,"\\Vert","\\Vert","c"],"Vsmallmatrix*":["MtSmallMatrix",null,"\\Vert","\\Vert"],crampedsubarray:["Array",null,null,null,null,"0em","0.1em","S'",1],multlined:"MtMultlined",spreadlines:["SpreadLines",!0],lgathered:["AmsEqnArray",null,null,null,"l",null,".5em","D"],rgathered:["AmsEqnArray",null,null,null,"r",null,".5em","D"]},s.MathtoolsMethods),new e.DelimiterMap("mathtools-delimiters",t.default.delimiter,{"\\lparen":"(","\\rparen":")"}),new e.CommandMap("mathtools-characters",{":":["CenterColon",!0]},s.MathtoolsMethods),Z9}var R7={},jR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),GR=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},zR=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},WR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(R7,"__esModule",{value:!0});R7.MathtoolsTagFormat=void 0;var qR=WR(Le),X9=Hi,bg=0;function ZR(r,t){var e=t.parseOptions.options.tags;e!=="base"&&r.tags.hasOwnProperty(e)&&X9.TagsFactory.add(e,r.tags[e]);var n=X9.TagsFactory.create(t.parseOptions.options.tags).constructor,s=function(o){jR(l,o);function l(){var u,h,T=o.call(this)||this;T.mtFormats=new Map,T.mtCurrent=null;var f=t.parseOptions.options.mathtools.tagforms;try{for(var d=GR(Object.keys(f)),p=d.next();!p.done;p=d.next()){var m=p.value;if(!Array.isArray(f[m])||f[m].length!==3)throw new qR.default("InvalidTagFormDef",'The tag form definition for "%1" should be an array fo three strings',m);T.mtFormats.set(m,f[m])}}catch(y){u={error:y}}finally{try{p&&!p.done&&(h=d.return)&&h.call(d)}finally{if(u)throw u.error}}return T}return l.prototype.formatTag=function(u){if(this.mtCurrent){var h=zR(this.mtCurrent,3),T=h[0],f=h[1],d=h[2];return d?"".concat(T).concat(d,"{").concat(u,"}").concat(f):"".concat(T).concat(u).concat(f)}return o.prototype.formatTag.call(this,u)},l}(n);bg++;var a="MathtoolsTags-"+bg;X9.TagsFactory.add(a,s),t.parseOptions.options.tags=a}R7.MathtoolsTagFormat=ZR;var B7={},KR=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),XR=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(B7,"__esModule",{value:!0});B7.MultlinedItem=void 0;var $R=o4,I4=XR(Ne),Sg=q1,YR=function(r){KR(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"kind",{get:function(){return"multlined"},enumerable:!1,configurable:!0}),t.prototype.EndTable=function(){if((this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.table.length>1){var e=this.factory.configuration.options.mathtools,n=e.multlinegap,s=e["firstline-afterskip"]||n,a=e["lastline-preskip"]||n,o=I4.default.getChildren(this.table[0])[0];I4.default.getAttribute(o,"columnalign")!==Sg.TexConstant.Align.RIGHT&&o.appendChild(this.create("node","mspace",[],{width:s}));var l=I4.default.getChildren(this.table[this.table.length-1])[0];if(I4.default.getAttribute(l,"columnalign")!==Sg.TexConstant.Align.LEFT){var u=I4.default.getChildren(l)[0];u.childNodes.unshift(null);var h=this.create("node","mspace",[],{width:a});I4.default.setChild(u,0,h)}}r.prototype.EndTable.call(this)},t}($R.MultlineItem);B7.MultlinedItem=YR;var Eg;function R_(){return Eg||(Eg=1,function(r){var t=_&&_.__values||function(m){var y=typeof Symbol=="function"&&Symbol.iterator,c=y&&m[y],Q=0;if(c)return c.call(m);if(m&&typeof m.length=="number")return{next:function(){return m&&Q>=m.length&&(m=void 0),{value:m&&m[Q++],done:!m}}};throw new TypeError(y?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(m){return m&&m.__esModule?m:{default:m}},n;Object.defineProperty(r,"__esModule",{value:!0}),r.MathtoolsConfiguration=r.fixPrescripts=r.PAIREDDELIMS=void 0;var s=he,a=Gt,o=e(Ne),l=H1;UR();var u=P_(),h=R7,T=B7;r.PAIREDDELIMS="mathtools-paired-delims";function f(m){new a.CommandMap(r.PAIREDDELIMS,{},{}),m.append(s.Configuration.local({handler:{macro:[r.PAIREDDELIMS]},priority:-5}))}function d(m,y){var c,Q,g=y.parseOptions,v=g.options.mathtools.pairedDelimiters;try{for(var L=t(Object.keys(v)),x=L.next();!x.done;x=L.next()){var b=x.value;u.MathtoolsUtil.addPairedDelims(g,b,v[b])}}catch(S){c={error:S}}finally{try{x&&!x.done&&(Q=L.return)&&Q.call(L)}finally{if(c)throw c.error}}(0,h.MathtoolsTagFormat)(m,y)}function p(m){var y,c,Q,g,v,L,x=m.data;try{for(var b=t(x.getList("mmultiscripts")),S=b.next();!S.done;S=b.next()){var E=S.value;if(E.getProperty("fixPrescript")){var A=o.default.getChildren(E),M=0;try{for(var D=(Q=void 0,t([1,2])),I=D.next();!I.done;I=D.next()){var P=I.value;A[P]||(o.default.setChild(E,P,x.nodeFactory.create("node","none")),M++)}}catch(X){Q={error:X}}finally{try{I&&!I.done&&(g=D.return)&&g.call(D)}finally{if(Q)throw Q.error}}try{for(var R=(v=void 0,t([4,5])),F=R.next();!F.done;F=R.next()){var P=F.value;o.default.isType(A[P],"mrow")&&o.default.getChildren(A[P]).length===0&&o.default.setChild(E,P,x.nodeFactory.create("node","none"))}}catch(X){v={error:X}}finally{try{F&&!F.done&&(L=R.return)&&L.call(R)}finally{if(v)throw v.error}}M===2&&A.splice(1,2)}}}catch(X){y={error:X}}finally{try{S&&!S.done&&(c=b.return)&&c.call(b)}finally{if(y)throw y.error}}}r.fixPrescripts=p,r.MathtoolsConfiguration=s.Configuration.create("mathtools",{handler:{macro:["mathtools-macros","mathtools-delimiters"],environment:["mathtools-environments"],delimiter:["mathtools-delimiters"],character:["mathtools-characters"]},items:(n={},n[T.MultlinedItem.prototype.kind]=T.MultlinedItem,n),init:f,config:d,postprocessors:[[p,-6]],options:{mathtools:{multlinegap:"1em","multlined-pos":"c","firstline-afterskip":"","lastline-preskip":"","smallmatrix-align":"c",shortvdotsadjustabove:".2em",shortvdotsadjustbelow:".2em",centercolon:!1,"centercolon-offset":".04em","thincolon-dx":"-.04em","thincolon-dw":"-.08em","use-unicode":!1,"prescript-sub-format":"","prescript-sup-format":"","prescript-arg-format":"","allow-mathtoolsset":!0,pairedDelimiters:(0,l.expandable)({}),tagforms:(0,l.expandable)({})}}})}(q9)),q9}var $T={},F7={};/*!
124
124
  *************************************************************************
125
125
  *
126
126
  * mhchemParser.ts
@@ -151,8 +151,8 @@ void main() {
151
151
  *
152
152
  * https://github.com/mhchem/mhchemParser
153
153
  *
154
- */Object.defineProperty(F7,"__esModule",{value:!0});F7.mhchemParser=void 0;var JR=function(){function r(){}return r.toTex=function(t,e){return ke.go(Tt.go(t,e),e!=="tex")},r}();F7.mhchemParser=JR;function o2(r){var t,e,n={};for(t in r)for(e in r[t]){var s=e.split("|");r[t][e].stateArray=s;for(var a=0;a<s.length;a++)n[s[a]]=[]}for(t in r)for(e in r[t])for(var s=r[t][e].stateArray||[],a=0;a<s.length;a++){var o=r[t][e];o.action_=[].concat(o.action_);for(var l=0;l<o.action_.length;l++)typeof o.action_[l]=="string"&&(o.action_[l]={type_:o.action_[l]});for(var u=t.split("|"),h=0;h<u.length;h++)if(s[a]==="*"){var T=void 0;for(T in n)n[T].push({pattern:u[h],task:o})}else n[s[a]].push({pattern:u[h],task:o})}return n}var Tt={go:function(r,t){if(!r)return[];t===void 0&&(t="ce");var e="0",n={};n.parenthesisLevel=0,r=r.replace(/\n/g," "),r=r.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),r=r.replace(/[\u2026]/g,"...");for(var s,a=10,o=[];;){s!==r?(a=10,s=r):a--;var l=Tt.stateMachines[t],u=l.transitions[e]||l.transitions["*"];t:for(var h=0;h<u.length;h++){var T=Tt.patterns.match_(u[h].pattern,r);if(T){for(var f=u[h].task,d=0;d<f.action_.length;d++){var p=void 0;if(l.actions[f.action_[d].type_])p=l.actions[f.action_[d].type_](n,T.match_,f.action_[d].option);else if(Tt.actions[f.action_[d].type_])p=Tt.actions[f.action_[d].type_](n,T.match_,f.action_[d].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+f.action_[d].type_+")"];Tt.concatArray(o,p)}if(e=f.nextState||e,r.length>0){if(f.revisit||(r=T.remainder),!f.toContinue)break t}else return o}}if(a<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(r,t){if(t)if(Array.isArray(t))for(var e=0;e<t.length;e++)r.push(t[e]);else r.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(r){var t=r.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.slice(1),remainder:r.substr(t[0].length)}:null},"(-)(9)^(-9)":/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/,"state of aggregation $":function(r){var t=Tt.patterns.findObserveGroups(r,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var e=r.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return e?{match_:e[0],remainder:r.substr(e[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". __* ":/^([.\u22C5\u00B7\u2022]|[*])\s*/,"...":/^\.\.\.(?=$|[^.])/,"^{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"^{","","","}")},"^($...$)":function(r){return Tt.patterns.findObserveGroups(r,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"_{","","","}")},"_($...$)":function(r){return Tt.patterns.findObserveGroups(r,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}^":/^\{\}(?=\^)/,"{}":/^\{\}/,"{...}":function(r){return Tt.patterns.findObserveGroups(r,"","{","}","")},"{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"{","","","}")},"$...$":function(r){return Tt.patterns.findObserveGroups(r,"","$","$","")},"${(...)}$__$(...)$":function(r){return Tt.patterns.findObserveGroups(r,"${","","","}$")||Tt.patterns.findObserveGroups(r,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(r){return Tt.patterns.findObserveGroups(r,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\color{","","","}")},"\\color{(...)}{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\color{","","","}","{","","","}")||Tt.patterns.findObserveGroups(r,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\ce{","","","}")},"\\pu{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\pu{","","","}")},oxidation$:/^(?:[+-][IVX]+|(?:\\pm|\$\\pm\$|\+-|\+\/-)\s*0)$/,"d-oxidation$":/^(?:[+-]?[IVX]+|(?:\\pm|\$\\pm\$|\+-|\+\/-)\s*0)$/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(r){var t;if(t=r.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),t)return{match_:t[0],remainder:r.substr(t[0].length)};var e=Tt.patterns.findObserveGroups(r,"","$","$","");return e&&(t=e.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),t)?{match_:t[0],remainder:r.substr(t[0].length)}:null},amount2:function(r){return this.amount(r)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(r){if(r.match(/^\([a-z]+\)$/))return null;var t=r.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:r.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(r,t,e,n,s,a,o,l,u,h){var T=function(Q,g){if(typeof g=="string")return Q.indexOf(g)!==0?null:g;var v=Q.match(g);return v?v[0]:null},f=function(Q,g,v){for(var L=0;g<Q.length;){var x=Q.charAt(g),b=T(Q.substr(g),v);if(b!==null&&L===0)return{endMatchBegin:g,endMatchEnd:g+b.length};if(x==="{")L++;else if(x==="}"){if(L===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];L--}g++}return L>0,null},d=T(r,t);if(d===null||(r=r.substr(d.length),d=T(r,e),d===null))return null;var p=f(r,d.length,n||s);if(p===null)return null;var m=r.substring(0,n?p.endMatchEnd:p.endMatchBegin);if(a||o){var y=this.findObserveGroups(r.substr(p.endMatchEnd),a,o,l,u);if(y===null)return null;var c=[m,y.match_];return{match_:h?c.join(""):c,remainder:y.remainder}}else return{match_:m,remainder:r.substr(p.endMatchEnd)}},match_:function(r,t){var e=Tt.patterns.patterns[r];if(e===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+r+")"];if(typeof e=="function")return Tt.patterns.patterns[r](t);var n=t.match(e);return n?n.length>2?{match_:n.slice(1),remainder:t.substr(n[0].length)}:{match_:n[1]||n[0],remainder:t.substr(n[0].length)}:null}},actions:{"a=":function(r,t){r.a=(r.a||"")+t},"b=":function(r,t){r.b=(r.b||"")+t},"p=":function(r,t){r.p=(r.p||"")+t},"o=":function(r,t){r.o=(r.o||"")+t},"o=+p1":function(r,t,e){r.o=(r.o||"")+e},"q=":function(r,t){r.q=(r.q||"")+t},"d=":function(r,t){r.d=(r.d||"")+t},"rm=":function(r,t){r.rm=(r.rm||"")+t},"text=":function(r,t){r.text_=(r.text_||"")+t},insert:function(r,t,e){return{type_:e}},"insert+p1":function(r,t,e){return{type_:e,p1:t}},"insert+p1+p2":function(r,t,e){return{type_:e,p1:t[0],p2:t[1]}},copy:function(r,t){return t},write:function(r,t,e){return e},rm:function(r,t){return{type_:"rm",p1:t}},text:function(r,t){return Tt.go(t,"text")},"tex-math":function(r,t){return Tt.go(t,"tex-math")},"tex-math tight":function(r,t){return Tt.go(t,"tex-math tight")},bond:function(r,t,e){return{type_:"bond",kind_:e||t}},"color0-output":function(r,t){return{type_:"color0",color:t}},ce:function(r,t){return Tt.go(t,"ce")},pu:function(r,t){return Tt.go(t,"pu")},"1/2":function(r,t){var e=[];t.match(/^[+\-]/)&&(e.push(t.substr(0,1)),t=t.substr(1));var n=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return n[1]=n[1].replace(/\$/g,""),e.push({type_:"frac",p1:n[1],p2:n[2]}),n[3]&&(n[3]=n[3].replace(/\$/g,""),e.push({type_:"tex-math",p1:n[3]})),e},"9,9":function(r,t){return Tt.go(t,"9,9")}},stateMachines:{tex:{transitions:o2({empty:{0:{action_:"copy"}},"\\ce{(...)}":{0:{action_:[{type_:"write",option:"{"},"ce",{type_:"write",option:"}"}]}},"\\pu{(...)}":{0:{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},else:{0:{action_:"copy"}}}),actions:{}},ce:{transitions:o2({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{action_:[]}},space:{a:{action_:[],nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". __* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{action_:[]}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}^":{"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"tinySkip"}],nextState:"1"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}],nextState:"3"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(r,t){var e;if((r.d||"").match(/^[1-9][0-9]*$/)){var n=r.d;r.d=void 0,e=this.output(r),e.push({type_:"tinySkip"}),r.b=n}else e=this.output(r);return Tt.actions["o="](r,t),e},"d= kv":function(r,t){r.d=t,r.dType="kv"},"charge or bond":function(r,t){if(r.beginsWithBond){var e=[];return Tt.concatArray(e,this.output(r)),Tt.concatArray(e,Tt.actions.bond(r,t,"-")),e}else{r.d=t;return}},"- after o/d":function(r,t,e){var n=Tt.patterns.match_("orbital",r.o||""),s=Tt.patterns.match_("one lowercase greek letter $",r.o||""),a=Tt.patterns.match_("one lowercase latin letter $",r.o||""),o=Tt.patterns.match_("$one lowercase latin letter$ $",r.o||""),l=t==="-"&&(n&&n.remainder===""||s||a||o);l&&!r.a&&!r.b&&!r.p&&!r.d&&!r.q&&!n&&a&&(r.o="$"+r.o+"$");var u=[];return l?(Tt.concatArray(u,this.output(r)),u.push({type_:"hyphen"})):(n=Tt.patterns.match_("digits",r.d||""),e&&n&&n.remainder===""?(Tt.concatArray(u,Tt.actions["d="](r,t)),Tt.concatArray(u,this.output(r))):(Tt.concatArray(u,this.output(r)),Tt.concatArray(u,Tt.actions.bond(r,t,"-")))),u},"a to o":function(r){r.o=r.a,r.a=void 0},"sb=true":function(r){r.sb=!0},"sb=false":function(r){r.sb=!1},"beginsWithBond=true":function(r){r.beginsWithBond=!0},"beginsWithBond=false":function(r){r.beginsWithBond=!1},"parenthesisLevel++":function(r){r.parenthesisLevel++},"parenthesisLevel--":function(r){r.parenthesisLevel--},"state of aggregation":function(r,t){return{type_:"state of aggregation",p1:Tt.go(t,"o")}},comma:function(r,t){var e=t.replace(/\s*$/,""),n=e!==t;return n&&r.parenthesisLevel===0?{type_:"comma enumeration L",p1:e}:{type_:"comma enumeration M",p1:e}},output:function(r,t,e){var n;if(!r.r)n=[],!r.a&&!r.b&&!r.p&&!r.o&&!r.q&&!r.d&&!e||(r.sb&&n.push({type_:"entitySkip"}),!r.o&&!r.q&&!r.d&&!r.b&&!r.p&&e!==2?(r.o=r.a,r.a=void 0):!r.o&&!r.q&&!r.d&&(r.b||r.p)?(r.o=r.a,r.d=r.b,r.q=r.p,r.a=r.b=r.p=void 0):r.o&&r.dType==="kv"&&Tt.patterns.match_("d-oxidation$",r.d||"")?r.dType="oxidation":r.o&&r.dType==="kv"&&!r.q&&(r.dType=void 0),n.push({type_:"chemfive",a:Tt.go(r.a,"a"),b:Tt.go(r.b,"bd"),p:Tt.go(r.p,"pq"),o:Tt.go(r.o,"o"),q:Tt.go(r.q,"pq"),d:Tt.go(r.d,r.dType==="oxidation"?"oxidation":"bd"),dType:r.dType}));else{var s=void 0;r.rdt==="M"?s=Tt.go(r.rd,"tex-math"):r.rdt==="T"?s=[{type_:"text",p1:r.rd||""}]:s=Tt.go(r.rd,"ce");var a=void 0;r.rqt==="M"?a=Tt.go(r.rq,"tex-math"):r.rqt==="T"?a=[{type_:"text",p1:r.rq||""}]:a=Tt.go(r.rq,"ce"),n={type_:"arrow",r:r.r,rd:s,rq:a}}for(var o in r)o!=="parenthesisLevel"&&o!=="beginsWithBond"&&delete r[o];return n},"oxidation-output":function(r,t){var e=["{"];return Tt.concatArray(e,Tt.go(t,"oxidation")),e.push("}"),e},"frac-output":function(r,t){return{type_:"frac-ce",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"overset-output":function(r,t){return{type_:"overset",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"underset-output":function(r,t){return{type_:"underset",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"underbrace-output":function(r,t){return{type_:"underbrace",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"ce")}},"r=":function(r,t){r.r=t},"rdt=":function(r,t){r.rdt=t},"rd=":function(r,t){r.rd=t},"rqt=":function(r,t){r.rqt=t},"rq=":function(r,t){r.rq=t},operator:function(r,t,e){return{type_:"operator",kind_:e||t}}}},a:{transitions:o2({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:o2({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:[{type_:"write",option:"{"},"text",{type_:"write",option:"}"}]}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:o2({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(r){if(r.text_){var t={type_:"text",p1:r.text_};for(var e in r)delete r[e];return t}}}},pq:{transitions:o2({empty:{"*":{action_:[]}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{action_:[],nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(r,t){return{type_:"state of aggregation subscript",p1:Tt.go(t,"o")}},"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"pq")}}}},bd:{transitions:o2({empty:{"*":{action_:[]}},x$:{0:{action_:[],nextState:"!f",revisit:!0}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"bd")}}}},oxidation:{transitions:o2({empty:{"*":{action_:"roman-numeral"}},"pm-operator":{"*":{action_:{type_:"o=+p1",option:"\\pm"}}},else:{"*":{action_:"o="}}}),actions:{"roman-numeral":function(r){return{type_:"roman numeral",p1:r.o||""}}}},"tex-math":{transitions:o2({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(r){if(r.o){var t={type_:"tex-math",p1:r.o};for(var e in r)delete r[e];return t}}}},"tex-math tight":{transitions:o2({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(r,t){r.o=(r.o||"")+"{"+t+"}"},output:function(r){if(r.o){var t={type_:"tex-math",p1:r.o};for(var e in r)delete r[e];return t}}}},"9,9":{transitions:o2({empty:{"*":{action_:[]}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:o2({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{action_:[]}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(r,t){var e=[];return t[0]==="+-"||t[0]==="+/-"?e.push("\\pm "):t[0]&&e.push(t[0]),t[1]&&(Tt.concatArray(e,Tt.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?Tt.concatArray(e,Tt.go(t[2],"pu-9,9")):e.push(t[2])),(t[3]||t[4])&&(t[3]==="e"||t[4]==="*"?e.push({type_:"cdot"}):e.push({type_:"times"}))),t[5]&&e.push("10^{"+t[5]+"}"),e},"number^":function(r,t){var e=[];return t[0]==="+-"||t[0]==="+/-"?e.push("\\pm "):t[0]&&e.push(t[0]),Tt.concatArray(e,Tt.go(t[1],"pu-9,9")),e.push("^{"+t[2]+"}"),e},operator:function(r,t,e){return{type_:"operator",kind_:e||t}},space:function(){return{type_:"pu-space-1"}},output:function(r){var t,e=Tt.patterns.match_("{(...)}",r.d||"");e&&e.remainder===""&&(r.d=e.match_);var n=Tt.patterns.match_("{(...)}",r.q||"");if(n&&n.remainder===""&&(r.q=n.match_),r.d&&(r.d=r.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.d=r.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),r.q){r.q=r.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.q=r.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var s={d:Tt.go(r.d,"pu"),q:Tt.go(r.q,"pu")};r.o==="//"?t={type_:"pu-frac",p1:s.d,p2:s.q}:(t=s.d,s.d.length>1||s.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),Tt.concatArray(t,s.q))}else t=Tt.go(r.d,"pu-2");for(var a in r)delete r[a];return t}}},"pu-2":{transitions:o2({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(r,t){r.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(r){var t=[];if(r.rm){var e=Tt.patterns.match_("{(...)}",r.rm||"");e&&e.remainder===""?t=Tt.go(e.match_,"pu"):t={type_:"rm",p1:r.rm}}for(var n in r)delete r[n];return t}}},"pu-9,9":{transitions:o2({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(r){var t=[];if(r.text_=r.text_||"",r.text_.length>4){var e=r.text_.length%3;e===0&&(e=3);for(var n=r.text_.length-3;n>0;n-=3)t.push(r.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(r.text_.substr(0,e)),t.reverse()}else t.push(r.text_);for(var s in r)delete r[s];return t},"output-o":function(r){var t=[];if(r.text_=r.text_||"",r.text_.length>4){var e=r.text_.length-3,n=void 0;for(n=0;n<e;n+=3)t.push(r.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(r.text_.substr(n))}else t.push(r.text_);for(var s in r)delete r[s];return t}}}}},ke={go:function(r,t){if(!r)return"";for(var e="",n=!1,s=0;s<r.length;s++){var a=r[s];typeof a=="string"?e+=a:(e+=ke._go2(a),a.type_==="1st-level escape"&&(n=!0))}return t&&!n&&e&&(e="{"+e+"}"),e},_goInner:function(r){return ke.go(r,!1)},_go2:function(r){var t;switch(r.type_){case"chemfive":t="";var e={a:ke._goInner(r.a),b:ke._goInner(r.b),p:ke._goInner(r.p),o:ke._goInner(r.o),q:ke._goInner(r.q),d:ke._goInner(r.d)};e.a&&(e.a.match(/^[+\-]/)&&(e.a="{"+e.a+"}"),t+=e.a+"\\,"),(e.b||e.p)&&(t+="{\\vphantom{A}}",t+="^{\\hphantom{"+(e.b||"")+"}}_{\\hphantom{"+(e.p||"")+"}}",t+="\\mkern-1.5mu",t+="{\\vphantom{A}}",t+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(e.b||"")+"}}",t+="_{\\vphantom{2}\\llap{\\smash[t]{"+(e.p||"")+"}}}"),e.o&&(e.o.match(/^[+\-]/)&&(e.o="{"+e.o+"}"),t+=e.o),r.dType==="kv"?((e.d||e.q)&&(t+="{\\vphantom{A}}"),e.d&&(t+="^{"+e.d+"}"),e.q&&(t+="_{\\smash[t]{"+e.q+"}}")):r.dType==="oxidation"?(e.d&&(t+="{\\vphantom{A}}",t+="^{"+e.d+"}"),e.q&&(t+="{\\vphantom{A}}",t+="_{\\smash[t]{"+e.q+"}}")):(e.q&&(t+="{\\vphantom{A}}",t+="_{\\smash[t]{"+e.q+"}}"),e.d&&(t+="{\\vphantom{A}}",t+="^{"+e.d+"}"));break;case"rm":t="\\mathrm{"+r.p1+"}";break;case"text":r.p1.match(/[\^_]/)?(r.p1=r.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+r.p1+"}"):t="\\text{"+r.p1+"}";break;case"roman numeral":t="\\mathrm{"+r.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+ke._goInner(r.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+ke._goInner(r.p1);break;case"bond":if(t=ke._getBond(r.kind_),!t)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+r.kind_+")"];break;case"frac":var n="\\frac{"+r.p1+"}{"+r.p2+"}";t="\\mathchoice{\\textstyle"+n+"}{"+n+"}{"+n+"}{"+n+"}";break;case"pu-frac":var s="\\frac{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";t="\\mathchoice{\\textstyle"+s+"}{"+s+"}{"+s+"}{"+s+"}";break;case"tex-math":t=r.p1+" ";break;case"frac-ce":t="\\frac{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"overset":t="\\overset{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"underset":t="\\underset{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"underbrace":t="\\underbrace{"+ke._goInner(r.p1)+"}_{"+ke._goInner(r.p2)+"}";break;case"color":t="{\\color{"+r.color1+"}{"+ke._goInner(r.color2)+"}}";break;case"color0":t="\\color{"+r.color+"}";break;case"arrow":var a={rd:ke._goInner(r.rd),rq:ke._goInner(r.rq)},o=ke._getArrow(r.r);a.rd||a.rq?r.r==="<=>"||r.r==="<=>>"||r.r==="<<=>"||r.r==="<-->"?(o="\\long"+o,a.rd&&(o="\\overset{"+a.rd+"}{"+o+"}"),a.rq&&(r.r==="<-->"?o="\\underset{\\lower2mu{"+a.rq+"}}{"+o+"}":o="\\underset{\\lower6mu{"+a.rq+"}}{"+o+"}"),o=" {}\\mathrel{"+o+"}{} "):(a.rq&&(o+="[{"+a.rq+"}]"),o+="{"+a.rd+"}",o=" {}\\mathrel{\\x"+o+"}{} "):o=" {}\\mathrel{\\long"+o+"}{} ",t=o;break;case"operator":t=ke._getOperator(r.kind_);break;case"1st-level escape":t=r.p1+" ";break;case"space":t=" ";break;case"tinySkip":t="\\mkern2mu";break;case"entitySkip":t="~";break;case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+r.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+r.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+r.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(r){switch(r){case"->":return"rightarrow";case"→":return"rightarrow";case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"⇌":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(r){switch(r){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(r){switch(r){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}},B_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty($T,"__esModule",{value:!0});$T.MhchemConfiguration=void 0;var tB=he,eB=Gt,iB=B_(Le),rB=B_(p2),nB=Yn,sB=F7,N7={};N7.Macro=rB.default.Macro;N7.xArrow=nB.AmsMethods.xArrow;N7.Machine=function(r,t,e){var n=r.GetArgument(t),s;try{s=sB.mhchemParser.toTex(n,e)}catch(a){throw new iB.default(a[0],a[1])}r.string=s+r.string.substr(r.i),r.i=0};new eB.CommandMap("mhchem",{ce:["Machine","ce"],pu:["Machine","pu"],longrightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longRightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],longLeftrightharpoons:["Macro","\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longleftrightarrows:["Macro","\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}"],tripledash:["Macro","\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"],xleftrightarrow:["xArrow",8596,6,6],xrightleftharpoons:["xArrow",8652,5,7],xRightleftharpoons:["xArrow",8652,5,7],xLeftrightharpoons:["xArrow",8652,5,7]},N7);$T.MhchemConfiguration=tB.Configuration.create("mhchem",{handler:{macro:["mhchem"]}});var YT={};Object.defineProperty(YT,"__esModule",{value:!0});YT.NoErrorsConfiguration=void 0;var aB=he;function oB(r,t,e,n){var s=r.create("token","mtext",{},n.replace(/\n/g," ")),a=r.create("node","merror",[s],{"data-mjx-error":t,title:t});return a}YT.NoErrorsConfiguration=aB.Configuration.create("noerrors",{nodes:{error:oB}});var JT={},lB=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(JT,"__esModule",{value:!0});JT.NoUndefinedConfiguration=void 0;var uB=he;function cB(r,t){var e,n,s=r.create("text","\\"+t),a=r.options.noundefined||{},o={};try{for(var l=lB(["color","background","size"]),u=l.next();!u.done;u=l.next()){var h=u.value;a[h]&&(o["math"+h]=a[h])}}catch(T){e={error:T}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}r.Push(r.create("node","mtext",[],o,s))}JT.NoUndefinedConfiguration=uB.Configuration.create("noundefined",{fallback:{macro:cB},options:{noundefined:{color:"red",background:"",size:""}},priority:3});var tf={},U7={},hB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ef=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(U7,"__esModule",{value:!0});U7.AutoOpen=void 0;var Ag=n3,TB=ef(Ue()),fB=ef(Ne),QB=ef(t2()),dB=function(r){hB(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.openCount=0,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"auto open"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.toMml=function(){var e=this.factory.configuration.parser,n=this.getProperty("right");if(this.getProperty("smash")){var s=r.prototype.toMml.call(this),a=e.create("node","mpadded",[s],{height:0,depth:0});this.Clear(),this.Push(e.create("node","TeXAtom",[a]))}n&&this.Push(new QB.default(n,e.stack.env,e.configuration).mml());var o=TB.default.fenced(this.factory.configuration,this.getProperty("open"),r.prototype.toMml.call(this),this.getProperty("close"),this.getProperty("big"));return fB.default.removeProperties(o,"open","close","texClass"),o},t.prototype.checkItem=function(e){if(e.isKind("mml")&&e.Size()===1){var n=e.toMml();n.isKind("mo")&&n.getText()===this.getProperty("open")&&this.openCount++}var s=e.getProperty("autoclose");return s&&s===this.getProperty("close")&&!this.openCount--?this.getProperty("ignore")?(this.Clear(),[[],!0]):[[this.toMml()],!0]:r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(Ag.BaseItem.errors),{stop:["ExtraOrMissingDelims","Extra open or missing close delimiter"]}),t}(Ag.BaseItem);U7.AutoOpen=dB;var rf={},pB=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},C0=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rf,"__esModule",{value:!0});var nf=C0(p2),P1=C0(t2()),On=C0(Le),sf=jt,p5=C0(Ue()),eh=C0(Ne),gB=Xn,Ce={},F_={"(":")","[":"]","{":"}","|":"|"},N_=/^(b|B)i(g{1,2})$/;Ce.Quantity=function(r,t,e,n,s,a,o){e===void 0&&(e="("),n===void 0&&(n=")"),s===void 0&&(s=!1),a===void 0&&(a=""),o===void 0&&(o="");var l=s?r.GetStar():!1,u=r.GetNext(),h=r.i,T=null;if(u==="\\"){if(r.i++,T=r.GetCS(),!T.match(N_)){var f=r.create("node","mrow");r.Push(p5.default.fenced(r.configuration,e,f,n)),r.i=h;return}u=r.GetNext()}var d=F_[u];if(s&&u!=="{")throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);if(!d){var f=r.create("node","mrow");r.Push(p5.default.fenced(r.configuration,e,f,n)),r.i=h;return}if(a){var p=r.create("token","mi",{texClass:sf.TEXCLASS.OP},a);o&&eh.default.setAttribute(p,"mathvariant",o),r.Push(r.itemFactory.create("fn",p))}if(u==="{"){var m=r.GetArgument(t);u=s?e:"\\{",d=s?n:"\\}",m=l?u+" "+m+" "+d:T?"\\"+T+"l"+u+" "+m+" \\"+T+"r"+d:"\\left"+u+" "+m+" \\right"+d,r.Push(new P1.default(m,r.stack.env,r.configuration).mml());return}s&&(u=e,d=n),r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:u,close:d,big:T}))};Ce.Eval=function(r,t){var e=r.GetStar(),n=r.GetNext();if(n==="{"){var s=r.GetArgument(t),a="\\left. "+(e?"\\smash{"+s+"}":s)+" \\vphantom{\\int}\\right|";r.string=r.string.slice(0,r.i)+a+r.string.slice(r.i);return}if(n==="("||n==="["){r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:n,close:"|",smash:e,right:"\\vphantom{\\int}"}));return}throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS)};Ce.Commutator=function(r,t,e,n){e===void 0&&(e="["),n===void 0&&(n="]");var s=r.GetStar(),a=r.GetNext(),o=null;if(a==="\\"){if(r.i++,o=r.GetCS(),!o.match(N_))throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);a=r.GetNext()}if(a!=="{")throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);var l=r.GetArgument(t),u=r.GetArgument(t),h=l+","+u;h=s?e+" "+h+" "+n:o?"\\"+o+"l"+e+" "+h+" \\"+o+"r"+n:"\\left"+e+" "+h+" \\right"+n,r.Push(new P1.default(h,r.stack.env,r.configuration).mml())};var mB=[65,90],yB=[97,122],vB=[913,937],LB=[945,969],xB=[48,57];function _6(r,t){return r>=t[0]&&r<=t[1]}function _B(r,t,e,n){var s=r.configuration.parser,a=gB.NodeFactory.createToken(r,t,e,n),o=n.codePointAt(0);return n.length===1&&!s.stack.env.font&&s.stack.env.vectorFont&&(_6(o,mB)||_6(o,yB)||_6(o,vB)||_6(o,xB)||_6(o,LB)&&s.stack.env.vectorStar||eh.default.getAttribute(a,"accent"))&&eh.default.setAttribute(a,"mathvariant",s.stack.env.vectorFont),a}Ce.VectorBold=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=r.configuration.nodeFactory.get("token"),a=r.stack.env.font;delete r.stack.env.font,r.configuration.nodeFactory.set("token",_B),r.stack.env.vectorFont=e?"bold-italic":"bold",r.stack.env.vectorStar=e;var o=new P1.default(n,r.stack.env,r.configuration).mml();a&&(r.stack.env.font=a),delete r.stack.env.vectorFont,delete r.stack.env.vectorStar,r.configuration.nodeFactory.set("token",s),r.Push(o)};Ce.StarMacro=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];var a=r.GetStar(),o=[];if(e)for(var l=o.length;l<e;l++)o.push(r.GetArgument(t));var u=n.join(a?"*":"");u=p5.default.substituteArgs(r,o,u),r.string=p5.default.addArgs(r,u,r.string.slice(r.i)),r.i=0,p5.default.checkMaxMacros(r)};var U_=function(r,t,e,n,s){var a=new P1.default(n,r.stack.env,r.configuration).mml();r.Push(r.itemFactory.create(t,a));var o=r.GetNext(),l=F_[o];if(l){var u="",h="",T="",f=s.indexOf(o)!==-1;if(o==="{"){T=r.GetArgument(e),u=f?"\\left\\{":"",h=f?"\\right\\}":"";var d=u+" "+T+" "+h;r.string=d+r.string.slice(r.i),r.i=0;return}f&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:o,close:l})))}};Ce.OperatorApplication=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];U_(r,"fn",t,e,n)};Ce.VectorOperator=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];U_(r,"mml",t,e,n)};Ce.Expression=function(r,t,e,n){e===void 0&&(e=!0),n===void 0&&(n=""),n=n||t.slice(1);var s=e?r.GetBrackets(t):null,a=r.create("token","mi",{texClass:sf.TEXCLASS.OP},n);if(s){var o=new P1.default(s,r.stack.env,r.configuration).mml();a=r.create("node","msup",[a,o])}r.Push(r.itemFactory.create("fn",a)),r.GetNext()==="("&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")"})))};Ce.Qqtext=function(r,t,e){var n=r.GetStar(),s=e||r.GetArgument(t),a=(n?"":"\\quad")+"\\text{"+s+"}\\quad ";r.string=r.string.slice(0,r.i)+a+r.string.slice(r.i)};Ce.Differential=function(r,t,e){var n=r.GetBrackets(t),s=n!=null?"^{"+n+"}":" ",a=r.GetNext()==="(",o=r.GetNext()==="{",l=e+s;if(!(a||o)){l+=r.GetArgument(t,!0)||"";var u=new P1.default(l,r.stack.env,r.configuration).mml();r.Push(u);return}if(o){l+=r.GetArgument(t);var u=new P1.default(l,r.stack.env,r.configuration).mml();r.Push(r.create("node","TeXAtom",[u],{texClass:sf.TEXCLASS.OP}));return}r.Push(new P1.default(l,r.stack.env,r.configuration).mml()),r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")"}))};Ce.Derivative=function(r,t,e,n){var s=r.GetStar(),a=r.GetBrackets(t),o=1,l=[];for(l.push(r.GetArgument(t));r.GetNext()==="{"&&o<e;)l.push(r.GetArgument(t)),o++;var u=!1,h=" ",T=" ";e>2&&l.length>2?(h="^{"+(l.length-1)+"}",u=!0):a!=null&&(e>2&&l.length>1&&(u=!0),h="^{"+a+"}",T=h);for(var f=s?"\\flatfrac":"\\frac",d=l.length>1?l[0]:"",p=l.length>1?l[1]:l[0],m="",y=2,c=void 0;c=l[y];y++)m+=n+" "+c;var Q=f+"{"+n+h+d+"}{"+n+" "+p+T+" "+m+"}";r.Push(new P1.default(Q,r.stack.env,r.configuration).mml()),r.GetNext()==="("&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")",ignore:u})))};Ce.Bra=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s="",a=!1,o=!1;if(r.GetNext()==="\\"){var l=r.i;r.i++;var u=r.GetCS(),h=r.lookup("macro",u);h&&h.symbol==="ket"?(a=!0,l=r.i,o=r.GetStar(),r.GetNext()==="{"?s=r.GetArgument(u,!0):(r.i=l,o=!1)):r.i=l}var T="";a?T=e||o?"\\langle{".concat(n,"}\\vert{").concat(s,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(s,"}\\right\\rangle"):T=e||o?"\\langle{".concat(n,"}\\vert"):"\\left\\langle{".concat(n,"}\\right\\vert{").concat(s,"}"),r.Push(new P1.default(T,r.stack.env,r.configuration).mml())};Ce.Ket=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=e?"\\vert{".concat(n,"}\\rangle"):"\\left\\vert{".concat(n,"}\\right\\rangle");r.Push(new P1.default(s,r.stack.env,r.configuration).mml())};Ce.BraKet=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=null;r.GetNext()==="{"&&(s=r.GetArgument(t,!0));var a="";s==null?a=e?"\\langle{".concat(n,"}\\vert{").concat(n,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(n,"}\\right\\rangle"):a=e?"\\langle{".concat(n,"}\\vert{").concat(s,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(s,"}\\right\\rangle"),r.Push(new P1.default(a,r.stack.env,r.configuration).mml())};Ce.KetBra=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=null;r.GetNext()==="{"&&(s=r.GetArgument(t,!0));var a="";s==null?a=e?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(n,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(n,"}\\right\\vert"):a=e?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(s,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(s,"}\\right\\vert"),r.Push(new P1.default(a,r.stack.env,r.configuration).mml())};function j_(r,t,e){var n=pB(r,3),s=n[0],a=n[1],o=n[2];return t&&e?"\\left\\langle{".concat(s,"}\\middle\\vert{").concat(a,"}\\middle\\vert{").concat(o,"}\\right\\rangle"):t?"\\langle{".concat(s,"}\\vert{").concat(a,"}\\vert{").concat(o,"}\\rangle"):"\\left\\langle{".concat(s,"}\\right\\vert{").concat(a,"}\\left\\vert{").concat(o,"}\\right\\rangle")}Ce.Expectation=function(r,t){var e=r.GetStar(),n=e&&r.GetStar(),s=r.GetArgument(t),a=null;r.GetNext()==="{"&&(a=r.GetArgument(t,!0));var o=s&&a?j_([a,s,a],e,n):e?"\\langle {".concat(s,"} \\rangle"):"\\left\\langle {".concat(s,"} \\right\\rangle");r.Push(new P1.default(o,r.stack.env,r.configuration).mml())};Ce.MatrixElement=function(r,t){var e=r.GetStar(),n=e&&r.GetStar(),s=r.GetArgument(t),a=r.GetArgument(t),o=r.GetArgument(t),l=j_([s,a,o],e,n);r.Push(new P1.default(l,r.stack.env,r.configuration).mml())};Ce.MatrixQuantity=function(r,t,e){var n=r.GetStar(),s=r.GetNext(),a=e?"smallmatrix":"array",o="",l="",u="";switch(s){case"{":o=r.GetArgument(t);break;case"(":r.i++,l=n?"\\lgroup":"(",u=n?"\\rgroup":")",o=r.GetUpTo(t,")");break;case"[":r.i++,l="[",u="]",o=r.GetUpTo(t,"]");break;case"|":r.i++,l="|",u="|",o=r.GetUpTo(t,"|");break;default:l="(",u=")";break}var h=(l?"\\left":"")+l+"\\begin{"+a+"}{} "+o+"\\end{"+a+"}"+(l?"\\right":"")+u;r.Push(new P1.default(h,r.stack.env,r.configuration).mml())};Ce.IdentityMatrix=function(r,t){var e=r.GetArgument(t),n=parseInt(e,10);if(isNaN(n))throw new On.default("InvalidNumber","Invalid number");if(n<=1){r.string="1"+r.string.slice(r.i),r.i=0;return}for(var s=Array(n).fill("0"),a=[],o=0;o<n;o++){var l=s.slice();l[o]="1",a.push(l.join(" & "))}r.string=a.join("\\\\ ")+r.string.slice(r.i),r.i=0};Ce.XMatrix=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=r.GetArgument(t),a=r.GetArgument(t),o=parseInt(s,10),l=parseInt(a,10);if(isNaN(o)||isNaN(l)||l.toString()!==a||o.toString()!==s)throw new On.default("InvalidNumber","Invalid number");if(o=o<1?1:o,l=l<1?1:l,!e){var u=Array(l).fill(n).join(" & "),h=Array(o).fill(u).join("\\\\ ");r.string=h+r.string.slice(r.i),r.i=0;return}var T="";if(o===1&&l===1)T=n;else if(o===1){for(var u=[],f=1;f<=l;f++)u.push("".concat(n,"_{").concat(f,"}"));T=u.join(" & ")}else if(l===1){for(var u=[],f=1;f<=o;f++)u.push("".concat(n,"_{").concat(f,"}"));T=u.join("\\\\ ")}else{for(var d=[],f=1;f<=o;f++){for(var u=[],p=1;p<=l;p++)u.push("".concat(n,"_{{").concat(f,"}{").concat(p,"}}"));d.push(u.join(" & "))}T=d.join("\\\\ ")}r.string=T+r.string.slice(r.i),r.i=0};Ce.PauliMatrix=function(r,t){var e=r.GetArgument(t),n=e.slice(1);switch(e[0]){case"0":n+=" 1 & 0\\\\ 0 & 1";break;case"1":case"x":n+=" 0 & 1\\\\ 1 & 0";break;case"2":case"y":n+=" 0 & -i\\\\ i & 0";break;case"3":case"z":n+=" 1 & 0\\\\ 0 & -1";break}r.string=n+r.string.slice(r.i),r.i=0};Ce.DiagonalMatrix=function(r,t,e){if(r.GetNext()==="{"){var n=r.i;r.GetArgument(t);var s=r.i;r.i=n+1;for(var a=[],o="",l=r.i;l<s;){try{o=r.GetUpTo(t,",")}catch{r.i=s,a.push(r.string.slice(l,s-1));break}if(r.i>=s){a.push(r.string.slice(l,s));break}l=r.i,a.push(o)}r.string=bB(a,e)+r.string.slice(s),r.i=0}};function bB(r,t){for(var e=r.length,n=[],s=0;s<e;s++)n.push(Array(t?e-s:s+1).join("&")+"\\mqty{"+r[s]+"}");return n.join("\\\\ ")}Ce.AutoClose=function(r,t,e){var n=r.create("token","mo",{stretchy:!1},t),s=r.itemFactory.create("mml",n).setProperties({autoclose:t});r.Push(s)};Ce.Vnabla=function(r,t){var e=r.options.physics.arrowdel?"\\vec{\\gradientnabla}":"{\\gradientnabla}";return r.Push(new P1.default(e,r.stack.env,r.configuration).mml())};Ce.DiffD=function(r,t){var e=r.options.physics.italicdiff?"d":"{\\rm d}";return r.Push(new P1.default(e,r.stack.env,r.configuration).mml())};Ce.Macro=nf.default.Macro;Ce.NamedFn=nf.default.NamedFn;Ce.Array=nf.default.Array;rf.default=Ce;var G_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},f3=Gt,wi=G_(rf),on=q1,af=G_(h3),SB=jt;new f3.CommandMap("Physics-automatic-bracing-macros",{quantity:"Quantity",qty:"Quantity",pqty:["Quantity","(",")",!0],bqty:["Quantity","[","]",!0],vqty:["Quantity","|","|",!0],Bqty:["Quantity","\\{","\\}",!0],absolutevalue:["Quantity","|","|",!0],abs:["Quantity","|","|",!0],norm:["Quantity","\\|","\\|",!0],evaluated:"Eval",eval:"Eval",order:["Quantity","(",")",!0,"O",on.TexConstant.Variant.CALLIGRAPHIC],commutator:"Commutator",comm:"Commutator",anticommutator:["Commutator","\\{","\\}"],acomm:["Commutator","\\{","\\}"],poissonbracket:["Commutator","\\{","\\}"],pb:["Commutator","\\{","\\}"]},wi.default);new f3.CharacterMap("Physics-vector-mo",af.default.mathchar0mo,{dotproduct:["⋅",{mathvariant:on.TexConstant.Variant.BOLD}],vdot:["⋅",{mathvariant:on.TexConstant.Variant.BOLD}],crossproduct:"×",cross:"×",cp:"×",gradientnabla:["∇",{mathvariant:on.TexConstant.Variant.BOLD}]});new f3.CharacterMap("Physics-vector-mi",af.default.mathchar0mi,{real:["ℜ",{mathvariant:on.TexConstant.Variant.NORMAL}],imaginary:["ℑ",{mathvariant:on.TexConstant.Variant.NORMAL}]});new f3.CommandMap("Physics-vector-macros",{vnabla:"Vnabla",vectorbold:"VectorBold",vb:"VectorBold",vectorarrow:["StarMacro",1,"\\vec{\\vb","{#1}}"],va:["StarMacro",1,"\\vec{\\vb","{#1}}"],vectorunit:["StarMacro",1,"\\hat{\\vb","{#1}}"],vu:["StarMacro",1,"\\hat{\\vb","{#1}}"],gradient:["OperatorApplication","\\vnabla","(","["],grad:["OperatorApplication","\\vnabla","(","["],divergence:["VectorOperator","\\vnabla\\vdot","(","["],div:["VectorOperator","\\vnabla\\vdot","(","["],curl:["VectorOperator","\\vnabla\\crossproduct","(","["],laplacian:["OperatorApplication","\\nabla^2","(","["]},wi.default);new f3.CommandMap("Physics-expressions-macros",{sin:"Expression",sinh:"Expression",arcsin:"Expression",asin:"Expression",cos:"Expression",cosh:"Expression",arccos:"Expression",acos:"Expression",tan:"Expression",tanh:"Expression",arctan:"Expression",atan:"Expression",csc:"Expression",csch:"Expression",arccsc:"Expression",acsc:"Expression",sec:"Expression",sech:"Expression",arcsec:"Expression",asec:"Expression",cot:"Expression",coth:"Expression",arccot:"Expression",acot:"Expression",exp:["Expression",!1],log:"Expression",ln:"Expression",det:["Expression",!1],Pr:["Expression",!1],tr:["Expression",!1],trace:["Expression",!1,"tr"],Tr:["Expression",!1],Trace:["Expression",!1,"Tr"],rank:"NamedFn",erf:["Expression",!1],Residue:["Macro","\\mathrm{Res}"],Res:["OperatorApplication","\\Residue","(","[","{"],principalvalue:["OperatorApplication","{\\cal P}"],pv:["OperatorApplication","{\\cal P}"],PV:["OperatorApplication","{\\rm P.V.}"],Re:["OperatorApplication","\\mathrm{Re}","{"],Im:["OperatorApplication","\\mathrm{Im}","{"],sine:["NamedFn","sin"],hypsine:["NamedFn","sinh"],arcsine:["NamedFn","arcsin"],asine:["NamedFn","asin"],cosine:["NamedFn","cos"],hypcosine:["NamedFn","cosh"],arccosine:["NamedFn","arccos"],acosine:["NamedFn","acos"],tangent:["NamedFn","tan"],hyptangent:["NamedFn","tanh"],arctangent:["NamedFn","arctan"],atangent:["NamedFn","atan"],cosecant:["NamedFn","csc"],hypcosecant:["NamedFn","csch"],arccosecant:["NamedFn","arccsc"],acosecant:["NamedFn","acsc"],secant:["NamedFn","sec"],hypsecant:["NamedFn","sech"],arcsecant:["NamedFn","arcsec"],asecant:["NamedFn","asec"],cotangent:["NamedFn","cot"],hypcotangent:["NamedFn","coth"],arccotangent:["NamedFn","arccot"],acotangent:["NamedFn","acot"],exponential:["NamedFn","exp"],logarithm:["NamedFn","log"],naturallogarithm:["NamedFn","ln"],determinant:["NamedFn","det"],Probability:["NamedFn","Pr"]},wi.default);new f3.CommandMap("Physics-quick-quad-macros",{qqtext:"Qqtext",qq:"Qqtext",qcomma:["Macro","\\qqtext*{,}"],qc:["Macro","\\qqtext*{,}"],qcc:["Qqtext","c.c."],qif:["Qqtext","if"],qthen:["Qqtext","then"],qelse:["Qqtext","else"],qotherwise:["Qqtext","otherwise"],qunless:["Qqtext","unless"],qgiven:["Qqtext","given"],qusing:["Qqtext","using"],qassume:["Qqtext","assume"],qsince:["Qqtext","since"],qlet:["Qqtext","let"],qfor:["Qqtext","for"],qall:["Qqtext","all"],qeven:["Qqtext","even"],qodd:["Qqtext","odd"],qinteger:["Qqtext","integer"],qand:["Qqtext","and"],qor:["Qqtext","or"],qas:["Qqtext","as"],qin:["Qqtext","in"]},wi.default);new f3.CommandMap("Physics-derivative-macros",{diffd:"DiffD",flatfrac:["Macro","\\left.#1\\middle/#2\\right.",2],differential:["Differential","\\diffd"],dd:["Differential","\\diffd"],variation:["Differential","\\delta"],var:["Differential","\\delta"],derivative:["Derivative",2,"\\diffd"],dv:["Derivative",2,"\\diffd"],partialderivative:["Derivative",3,"\\partial"],pderivative:["Derivative",3,"\\partial"],pdv:["Derivative",3,"\\partial"],functionalderivative:["Derivative",2,"\\delta"],fderivative:["Derivative",2,"\\delta"],fdv:["Derivative",2,"\\delta"]},wi.default);new f3.CommandMap("Physics-bra-ket-macros",{bra:"Bra",ket:"Ket",innerproduct:"BraKet",ip:"BraKet",braket:"BraKet",outerproduct:"KetBra",dyad:"KetBra",ketbra:"KetBra",op:"KetBra",expectationvalue:"Expectation",expval:"Expectation",ev:"Expectation",matrixelement:"MatrixElement",matrixel:"MatrixElement",mel:"MatrixElement"},wi.default);new f3.CommandMap("Physics-matrix-macros",{matrixquantity:"MatrixQuantity",mqty:"MatrixQuantity",pmqty:["Macro","\\mqty(#1)",1],Pmqty:["Macro","\\mqty*(#1)",1],bmqty:["Macro","\\mqty[#1]",1],vmqty:["Macro","\\mqty|#1|",1],smallmatrixquantity:["MatrixQuantity",!0],smqty:["MatrixQuantity",!0],spmqty:["Macro","\\smqty(#1)",1],sPmqty:["Macro","\\smqty*(#1)",1],sbmqty:["Macro","\\smqty[#1]",1],svmqty:["Macro","\\smqty|#1|",1],matrixdeterminant:["Macro","\\vmqty{#1}",1],mdet:["Macro","\\vmqty{#1}",1],smdet:["Macro","\\svmqty{#1}",1],identitymatrix:"IdentityMatrix",imat:"IdentityMatrix",xmatrix:"XMatrix",xmat:"XMatrix",zeromatrix:["Macro","\\xmat{0}{#1}{#2}",2],zmat:["Macro","\\xmat{0}{#1}{#2}",2],paulimatrix:"PauliMatrix",pmat:"PauliMatrix",diagonalmatrix:"DiagonalMatrix",dmat:"DiagonalMatrix",antidiagonalmatrix:["DiagonalMatrix",!0],admat:["DiagonalMatrix",!0]},wi.default);new f3.EnvironmentMap("Physics-aux-envs",af.default.environment,{smallmatrix:["Array",null,null,null,"c","0.333em",".2em","S",1]},wi.default);new f3.MacroMap("Physics-characters",{"|":["AutoClose",SB.TEXCLASS.ORD],")":"AutoClose","]":"AutoClose"},wi.default);var $9;Object.defineProperty(tf,"__esModule",{value:!0});tf.PhysicsConfiguration=void 0;var EB=he,Hg=U7;tf.PhysicsConfiguration=EB.Configuration.create("physics",{handler:{macro:["Physics-automatic-bracing-macros","Physics-vector-macros","Physics-vector-mo","Physics-vector-mi","Physics-derivative-macros","Physics-expressions-macros","Physics-quick-quad-macros","Physics-bra-ket-macros","Physics-matrix-macros"],character:["Physics-characters"],environment:["Physics-aux-envs"]},items:($9={},$9[Hg.AutoOpen.prototype.kind]=Hg.AutoOpen,$9),options:{physics:{italicdiff:!1,arrowdel:!1}}});var AB={};(function(r){var t=_&&_.__values||function(d){var p=typeof Symbol=="function"&&Symbol.iterator,m=p&&d[p],y=0;if(m)return m.call(d);if(d&&typeof d.length=="number")return{next:function(){return d&&y>=d.length&&(d=void 0),{value:d&&d[y++],done:!d}}};throw new TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(r,"__esModule",{value:!0}),r.SetOptionsConfiguration=r.SetOptionsUtil=void 0;var n=he,s=Gt,a=e(Le),o=e(Ue()),l=s3,u=e(p2),h=H1;r.SetOptionsUtil={filterPackage:function(d,p){if(p!=="tex"&&!n.ConfigurationHandler.get(p))throw new a.default("NotAPackage","Not a defined package: %1",p);var m=d.options.setoptions,y=m.allowOptions[p];if(y===void 0&&!m.allowPackageDefault||y===!1)throw new a.default("PackageNotSettable",`Options can't be set for package "%1"`,p);return!0},filterOption:function(d,p,m){var y,c=d.options.setoptions,Q=c.allowOptions[p]||{},g=Q.hasOwnProperty(m)&&!(0,h.isObject)(Q[m])?Q[m]:null;if(g===!1||g===null&&!c.allowOptionsDefault)throw new a.default("OptionNotSettable",'Option "%1" is not allowed to be set',m);if(!(!((y=p==="tex"?d.options:d.options[p])===null||y===void 0)&&y.hasOwnProperty(m)))throw p==="tex"?new a.default("InvalidTexOption",'Invalid TeX option "%1"',m):new a.default("InvalidOptionKey",'Invalid option "%1" for package "%2"',m,p);return!0},filterValue:function(d,p,m,y){return y}};var T=new s.CommandMap("setoptions",{setOptions:"SetOptions"},{SetOptions:function(d,p){var m,y,c=d.GetBrackets(p)||"tex",Q=o.default.keyvalOptions(d.GetArgument(p)),g=d.options.setoptions;if(g.filterPackage(d,c))try{for(var v=t(Object.keys(Q)),L=v.next();!L.done;L=v.next()){var x=L.value;g.filterOption(d,c,x)&&((c==="tex"?d.options:d.options[c])[x]=g.filterValue(d,c,x,Q[x]))}}catch(b){m={error:b}}finally{try{L&&!L.done&&(y=v.return)&&y.call(v)}finally{if(m)throw m.error}}}});function f(d,p){var m=p.parseOptions.handlers.get("macro").lookup("require");m&&(T.add("Require",new l.Macro("Require",m._func)),T.add("require",new l.Macro("require",u.default.Macro,["\\Require{#2}\\setOptions[#2]{#1}",2,""])))}r.SetOptionsConfiguration=n.Configuration.create("setoptions",{handler:{macro:["setoptions"]},config:f,priority:3,options:{setoptions:{filterPackage:r.SetOptionsUtil.filterPackage,filterOption:r.SetOptionsUtil.filterOption,filterValue:r.SetOptionsUtil.filterValue,allowPackageDefault:!0,allowOptionsDefault:!0,allowOptions:(0,h.expandable)({tex:{FindTeX:!1,formatError:!1,package:!1,baseURL:!1,tags:!1,maxBuffer:!1,maxMaxros:!1,macros:!1,environments:!1},setoptions:!1,autoload:!1,require:!1,configmacros:!1,tagformat:!1})}}})})(AB);var F5={},HB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(F5,"__esModule",{value:!0});F5.TagFormatConfiguration=F5.tagformatConfig=void 0;var MB=he,Y9=Hi,Mg=0;function z_(r,t){var e=t.parseOptions.options.tags;e!=="base"&&r.tags.hasOwnProperty(e)&&Y9.TagsFactory.add(e,r.tags[e]);var n=Y9.TagsFactory.create(t.parseOptions.options.tags).constructor,s=function(o){HB(l,o);function l(){return o!==null&&o.apply(this,arguments)||this}return l.prototype.formatNumber=function(u){return t.parseOptions.options.tagformat.number(u)},l.prototype.formatTag=function(u){return t.parseOptions.options.tagformat.tag(u)},l.prototype.formatId=function(u){return t.parseOptions.options.tagformat.id(u)},l.prototype.formatUrl=function(u,h){return t.parseOptions.options.tagformat.url(u,h)},l}(n);Mg++;var a="configTags-"+Mg;Y9.TagsFactory.add(a,s),t.parseOptions.options.tags=a}F5.tagformatConfig=z_;F5.TagFormatConfiguration=MB.Configuration.create("tagformat",{config:[z_,10],options:{tagformat:{number:function(r){return r.toString()},tag:function(r){return"("+r+")"},id:function(r){return"mjx-eqn:"+r.replace(/\s/g,"_")},url:function(r,t){return t+"#"+encodeURIComponent(r)}}}});var of={},e6={},W_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e6,"__esModule",{value:!0});e6.TextMacrosMethods=void 0;var wB=W_(t2()),CB=fr,V4=W_(p2);e6.TextMacrosMethods={Comment:function(r,t){for(;r.i<r.string.length&&r.string.charAt(r.i)!==`
155
- `;)r.i++;r.i++},Math:function(r,t){r.saveText();for(var e=r.i,n,s,a=0;s=r.GetNext();)switch(n=r.i++,s){case"\\":var o=r.GetCS();o===")"&&(s="\\(");case"$":if(a===0&&t===s){var l=r.texParser.configuration,u=new wB.default(r.string.substr(e,n-e),r.stack.env,l).mml();r.PushMath(u);return}break;case"{":a++;break;case"}":a===0&&r.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace"),a--;break}r.Error("MathNotTerminated","Math-mode is not properly terminated")},MathModeOnly:function(r,t){r.Error("MathModeOnly","'%1' allowed only in math mode",t)},Misplaced:function(r,t){r.Error("Misplaced","'%1' can not be used here",t)},OpenBrace:function(r,t){var e=r.stack.env;r.envStack.push(e),r.stack.env=Object.assign({},e)},CloseBrace:function(r,t){r.envStack.length?(r.saveText(),r.stack.env=r.envStack.pop()):r.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace")},OpenQuote:function(r,t){r.string.charAt(r.i)===t?(r.text+="“",r.i++):r.text+="‘"},CloseQuote:function(r,t){r.string.charAt(r.i)===t?(r.text+="”",r.i++):r.text+="’"},Tilde:function(r,t){r.text+=" "},Space:function(r,t){for(r.text+=" ";r.GetNext().match(/\s/);)r.i++},SelfQuote:function(r,t){r.text+=t.substr(1)},Insert:function(r,t,e){r.text+=e},Accent:function(r,t,e){var n=r.ParseArg(t),s=r.create("token","mo",{},e);r.addAttributes(s),r.Push(r.create("node","mover",[n,s]))},Emph:function(r,t){var e=r.stack.env.mathvariant==="-tex-mathit"?"normal":"-tex-mathit";r.Push(r.ParseTextArg(t,{mathvariant:e}))},SetFont:function(r,t,e){r.saveText(),r.stack.env.mathvariant=e},SetSize:function(r,t,e){r.saveText(),r.stack.env.mathsize=e},CheckAutoload:function(r,t){var e=r.configuration.packageData.get("autoload"),n=r.texParser;t=t.slice(1);var s=n.lookup("macro",t);if(!s||e&&s._func===e.Autoload){if(n.parse("macro",[n,t]),!s)return;(0,CB.retryAfter)(Promise.resolve())}n.parse("macro",[r,t])},Macro:V4.default.Macro,Spacer:V4.default.Spacer,Hskip:V4.default.Hskip,rule:V4.default.rule,Rule:V4.default.Rule,HandleRef:V4.default.HandleRef};var D0={},DB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),wg=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},OB=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},IB=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},j7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(D0,"__esModule",{value:!0});D0.TextParser=void 0;var VB=j7(t2()),Cg=j7(Le),PB=j7(Ue()),kB=jt,Dg=j7(Ne),Og=Nt,RB=function(r){DB(t,r);function t(e,n,s,a){var o=r.call(this,e,n,s)||this;return o.level=a,o}return Object.defineProperty(t.prototype,"texParser",{get:function(){return this.configuration.packageData.get("textmacros").texParser},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tags",{get:function(){return this.texParser.tags},enumerable:!1,configurable:!0}),t.prototype.mml=function(){return this.level!=null?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):this.nodes.length===1?this.nodes[0]:this.create("node","mrow",this.nodes)},t.prototype.Parse=function(){this.text="",this.nodes=[],this.envStack=[],r.prototype.Parse.call(this)},t.prototype.saveText=function(){if(this.text){var e=this.stack.env.mathvariant,n=PB.default.internalText(this,this.text,e?{mathvariant:e}:{});this.text="",this.Push(n)}},t.prototype.Push=function(e){if(this.text&&this.saveText(),e instanceof Og.StopItem)return r.prototype.Push.call(this,e);if(e instanceof Og.StyleItem){this.stack.env.mathcolor=this.stack.env.color;return}e instanceof kB.AbstractMmlNode&&(this.addAttributes(e),this.nodes.push(e))},t.prototype.PushMath=function(e){var n,s,a=this.stack.env;e.isKind("TeXAtom")||(e=this.create("node","TeXAtom",[e]));try{for(var o=wg(["mathsize","mathcolor"]),l=o.next();!l.done;l=o.next()){var u=l.value;a[u]&&!e.attributes.getExplicit(u)&&(!e.isToken&&!e.isKind("mstyle")&&(e=this.create("node","mstyle",[e])),Dg.default.setAttribute(e,u,a[u]))}}catch(h){n={error:h}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}e.isInferred&&(e=this.create("node","mrow",e.childNodes)),this.nodes.push(e)},t.prototype.addAttributes=function(e){var n,s,a=this.stack.env;if(e.isToken)try{for(var o=wg(["mathsize","mathcolor","mathvariant"]),l=o.next();!l.done;l=o.next()){var u=l.value;a[u]&&!e.attributes.getExplicit(u)&&Dg.default.setAttribute(e,u,a[u])}}catch(h){n={error:h}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}},t.prototype.ParseTextArg=function(e,n){var s=this.GetArgument(e);return n=Object.assign(Object.assign({},this.stack.env),n),new t(s,n,this.configuration).mml()},t.prototype.ParseArg=function(e){return new t(this.GetArgument(e),this.stack.env,this.configuration).mml()},t.prototype.Error=function(e,n){for(var s=[],a=2;a<arguments.length;a++)s[a-2]=arguments[a];throw new(Cg.default.bind.apply(Cg.default,IB([void 0,e,n],OB(s),!1)))},t}(VB.default);D0.TextParser=RB;var BB=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},FB=Gt,V2=q1,NB=e6,UB=BB(Ue()),jB=D0;new FB.CommandMap("textcomp-macros",{textasciicircum:["Insert","^"],textasciitilde:["Insert","~"],textasteriskcentered:["Insert","*"],textbackslash:["Insert","\\"],textbar:["Insert","|"],textbraceleft:["Insert","{"],textbraceright:["Insert","}"],textbullet:["Insert","•"],textdagger:["Insert","†"],textdaggerdbl:["Insert","‡"],textellipsis:["Insert","…"],textemdash:["Insert","—"],textendash:["Insert","–"],textexclamdown:["Insert","¡"],textgreater:["Insert",">"],textless:["Insert","<"],textordfeminine:["Insert","ª"],textordmasculine:["Insert","º"],textparagraph:["Insert","¶"],textperiodcentered:["Insert","·"],textquestiondown:["Insert","¿"],textquotedblleft:["Insert","“"],textquotedblright:["Insert","”"],textquoteleft:["Insert","‘"],textquoteright:["Insert","’"],textsection:["Insert","§"],textunderscore:["Insert","_"],textvisiblespace:["Insert","␣"],textacutedbl:["Insert","˝"],textasciiacute:["Insert","´"],textasciibreve:["Insert","˘"],textasciicaron:["Insert","ˇ"],textasciidieresis:["Insert","¨"],textasciimacron:["Insert","¯"],textgravedbl:["Insert","˵"],texttildelow:["Insert","˷"],textbaht:["Insert","฿"],textcent:["Insert","¢"],textcolonmonetary:["Insert","₡"],textcurrency:["Insert","¤"],textdollar:["Insert","$"],textdong:["Insert","₫"],texteuro:["Insert","€"],textflorin:["Insert","ƒ"],textguarani:["Insert","₲"],textlira:["Insert","₤"],textnaira:["Insert","₦"],textpeso:["Insert","₱"],textsterling:["Insert","£"],textwon:["Insert","₩"],textyen:["Insert","¥"],textcircledP:["Insert","℗"],textcompwordmark:["Insert","‌"],textcopyleft:["Insert","🄯"],textcopyright:["Insert","©"],textregistered:["Insert","®"],textservicemark:["Insert","℠"],texttrademark:["Insert","™"],textbardbl:["Insert","‖"],textbigcircle:["Insert","◯"],textblank:["Insert","␢"],textbrokenbar:["Insert","¦"],textdiscount:["Insert","⁒"],textestimated:["Insert","℮"],textinterrobang:["Insert","‽"],textinterrobangdown:["Insert","⸘"],textmusicalnote:["Insert","♪"],textnumero:["Insert","№"],textopenbullet:["Insert","◦"],textpertenthousand:["Insert","‱"],textperthousand:["Insert","‰"],textrecipe:["Insert","℞"],textreferencemark:["Insert","※"],textlangle:["Insert","〈"],textrangle:["Insert","〉"],textlbrackdbl:["Insert","⟦"],textrbrackdbl:["Insert","⟧"],textlquill:["Insert","⁅"],textrquill:["Insert","⁆"],textcelsius:["Insert","℃"],textdegree:["Insert","°"],textdiv:["Insert","÷"],textdownarrow:["Insert","↓"],textfractionsolidus:["Insert","⁄"],textleftarrow:["Insert","←"],textlnot:["Insert","¬"],textmho:["Insert","℧"],textminus:["Insert","−"],textmu:["Insert","µ"],textohm:["Insert","Ω"],textonehalf:["Insert","½"],textonequarter:["Insert","¼"],textonesuperior:["Insert","¹"],textpm:["Insert","±"],textrightarrow:["Insert","→"],textsurd:["Insert","√"],textthreequarters:["Insert","¾"],textthreesuperior:["Insert","³"],texttimes:["Insert","×"],texttwosuperior:["Insert","²"],textuparrow:["Insert","↑"],textborn:["Insert","*"],textdied:["Insert","†"],textdivorced:["Insert","⚮"],textmarried:["Insert","⚭"],textcentoldstyle:["Insert","¢",V2.TexConstant.Variant.OLDSTYLE],textdollaroldstyle:["Insert","$",V2.TexConstant.Variant.OLDSTYLE],textzerooldstyle:["Insert","0",V2.TexConstant.Variant.OLDSTYLE],textoneoldstyle:["Insert","1",V2.TexConstant.Variant.OLDSTYLE],texttwooldstyle:["Insert","2",V2.TexConstant.Variant.OLDSTYLE],textthreeoldstyle:["Insert","3",V2.TexConstant.Variant.OLDSTYLE],textfouroldstyle:["Insert","4",V2.TexConstant.Variant.OLDSTYLE],textfiveoldstyle:["Insert","5",V2.TexConstant.Variant.OLDSTYLE],textsixoldstyle:["Insert","6",V2.TexConstant.Variant.OLDSTYLE],textsevenoldstyle:["Insert","7",V2.TexConstant.Variant.OLDSTYLE],texteightoldstyle:["Insert","8",V2.TexConstant.Variant.OLDSTYLE],textnineoldstyle:["Insert","9",V2.TexConstant.Variant.OLDSTYLE]},{Insert:function(r,t,e,n){if(r instanceof jB.TextParser){if(!n){NB.TextMacrosMethods.Insert(r,t,e);return}r.saveText()}r.Push(UB.default.internalText(r,e,n?{mathvariant:n}:{}))}});Object.defineProperty(of,"__esModule",{value:!0});of.TextcompConfiguration=void 0;var GB=he;of.TextcompConfiguration=GB.Configuration.create("textcomp",{handler:{macro:["textcomp-macros"]}});var N5={},q_=Gt,L3=q1,Z_=e6,Cr=G3;new q_.MacroMap("text-special",{$:"Math","%":"Comment","^":"MathModeOnly",_:"MathModeOnly","&":"Misplaced","#":"Misplaced","~":"Tilde"," ":"Space"," ":"Space","\r":"Space","\n":"Space"," ":"Tilde","{":"OpenBrace","}":"CloseBrace","`":"OpenQuote","'":"CloseQuote"},Z_.TextMacrosMethods);new q_.CommandMap("text-macros",{"(":"Math",$:"SelfQuote",_:"SelfQuote","%":"SelfQuote","{":"SelfQuote","}":"SelfQuote"," ":"SelfQuote","&":"SelfQuote","#":"SelfQuote","\\":"SelfQuote","'":["Accent","´"],"’":["Accent","´"],"`":["Accent","`"],"‘":["Accent","`"],"^":["Accent","^"],'"':["Accent","¨"],"~":["Accent","~"],"=":["Accent","¯"],".":["Accent","˙"],u:["Accent","˘"],v:["Accent","ˇ"],emph:"Emph",rm:["SetFont",L3.TexConstant.Variant.NORMAL],mit:["SetFont",L3.TexConstant.Variant.ITALIC],oldstyle:["SetFont",L3.TexConstant.Variant.OLDSTYLE],cal:["SetFont",L3.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",L3.TexConstant.Variant.BOLD],bbFont:["SetFont",L3.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",L3.TexConstant.Variant.SCRIPT],frak:["SetFont",L3.TexConstant.Variant.FRAKTUR],sf:["SetFont",L3.TexConstant.Variant.SANSSERIF],tt:["SetFont",L3.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],Bbb:["Macro","{\\bbFont #1}",1],textnormal:["Macro","{\\rm #1}",1],textup:["Macro","{\\rm #1}",1],textrm:["Macro","{\\rm #1}",1],textit:["Macro","{\\it #1}",1],textbf:["Macro","{\\bf #1}",1],textsf:["Macro","{\\sf #1}",1],texttt:["Macro","{\\tt #1}",1],dagger:["Insert","†"],ddagger:["Insert","‡"],S:["Insert","§"],",":["Spacer",Cr.MATHSPACE.thinmathspace],":":["Spacer",Cr.MATHSPACE.mediummathspace],">":["Spacer",Cr.MATHSPACE.mediummathspace],";":["Spacer",Cr.MATHSPACE.thickmathspace],"!":["Spacer",Cr.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",Cr.MATHSPACE.thinmathspace],negthinspace:["Spacer",Cr.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],color:"CheckAutoload",textcolor:"CheckAutoload",colorbox:"CheckAutoload",fcolorbox:"CheckAutoload",href:"CheckAutoload",style:"CheckAutoload",class:"CheckAutoload",cssId:"CheckAutoload",unicode:"CheckAutoload",ref:["HandleRef",!1],eqref:["HandleRef",!0]},Z_.TextMacrosMethods);var zB=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},P4;Object.defineProperty(N5,"__esModule",{value:!0});N5.TextMacrosConfiguration=N5.TextBaseConfiguration=void 0;var ih=he,WB=zB(S7),Ig=Hi,ki=Nt,Vg=D0,qB=e6;N5.TextBaseConfiguration=ih.Configuration.create("text-base",{parser:"text",handler:{character:["command","text-special"],macro:["text-macros"]},fallback:{character:function(r,t){r.text+=t},macro:function(r,t){var e=r.texParser,n=e.lookup("macro",t);n&&n._func!==qB.TextMacrosMethods.Macro&&r.Error("MathMacro","%1 is only supported in math mode","\\"+t),e.parse("macro",[r,t])}},items:(P4={},P4[ki.StartItem.prototype.kind]=ki.StartItem,P4[ki.StopItem.prototype.kind]=ki.StopItem,P4[ki.MmlItem.prototype.kind]=ki.MmlItem,P4[ki.StyleItem.prototype.kind]=ki.StyleItem,P4)});function ZB(r,t,e,n){var s=r.configuration.packageData.get("textmacros");return r instanceof Vg.TextParser||(s.texParser=r),[new Vg.TextParser(t,n?{mathvariant:n}:{},s.parseOptions,e).mml()]}N5.TextMacrosConfiguration=ih.Configuration.create("textmacros",{config:function(r,t){var e=new ih.ParserConfiguration(t.parseOptions.options.textmacros.packages,["tex","text"]);e.init();var n=new WB.default(e,[]);n.options=t.parseOptions.options,e.config(t),Ig.TagsFactory.addTags(e.tags),n.tags=Ig.TagsFactory.getDefault(),n.tags.configuration=n,n.packageData=t.parseOptions.packageData,n.packageData.set("textmacros",{parseOptions:n,jax:t,texParser:null}),n.options.internalMath=ZB},preprocessors:[function(r){var t=r.data.packageData.get("textmacros");t.parseOptions.nodeFactory.setMmlFactory(t.jax.mmlFactory)}],options:{textmacros:{packages:["text-base"]}}});var lf={};Object.defineProperty(lf,"__esModule",{value:!0});lf.UpgreekConfiguration=void 0;var KB=he,XB=Gt,$B=q1;function YB(r,t){var e=t.attributes||{};e.mathvariant=$B.TexConstant.Variant.NORMAL;var n=r.create("token","mi",e,t.char);r.Push(n)}new XB.CharacterMap("upgreek",YB,{upalpha:"α",upbeta:"β",upgamma:"γ",updelta:"δ",upepsilon:"ϵ",upzeta:"ζ",upeta:"η",uptheta:"θ",upiota:"ι",upkappa:"κ",uplambda:"λ",upmu:"μ",upnu:"ν",upxi:"ξ",upomicron:"ο",uppi:"π",uprho:"ρ",upsigma:"σ",uptau:"τ",upupsilon:"υ",upphi:"ϕ",upchi:"χ",uppsi:"ψ",upomega:"ω",upvarepsilon:"ε",upvartheta:"ϑ",upvarpi:"ϖ",upvarrho:"ϱ",upvarsigma:"ς",upvarphi:"φ",Upgamma:"Γ",Updelta:"Δ",Uptheta:"Θ",Uplambda:"Λ",Upxi:"Ξ",Uppi:"Π",Upsigma:"Σ",Upupsilon:"Υ",Upphi:"Φ",Uppsi:"Ψ",Upomega:"Ω"});lf.UpgreekConfiguration=KB.Configuration.create("upgreek",{handler:{macro:["upgreek"]}});var JB={};(function(r){var t=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeConfiguration=r.UnicodeMethods=void 0;var e=he,n=t(Le),s=Gt,a=t(Ue()),o=t(Ne),l=zn;r.UnicodeMethods={};var u={};r.UnicodeMethods.Unicode=function(h,T){var f=h.GetBrackets(T),d=null,p=null;f&&(f.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)?(d=f.replace(/ /g,"").split(/,/),p=h.GetBrackets(T)):p=f);var m=a.default.trimSpaces(h.GetArgument(T)).replace(/^0x/,"x");if(!m.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/))throw new n.default("BadUnicode","Argument to \\unicode must be a number");var y=parseInt(m.match(/^x/)?"0"+m:m);u[y]?p||(p=u[y][2]):u[y]=[800,200,p,y],d&&(u[y][0]=Math.floor(parseFloat(d[0])*1e3),u[y][1]=Math.floor(parseFloat(d[1])*1e3));var c=h.stack.env.font,Q={};p?(u[y][2]=Q.fontfamily=p.replace(/'/g,"'"),c&&(c.match(/bold/)&&(Q.fontweight="bold"),c.match(/italic|-mathit/)&&(Q.fontstyle="italic"))):c&&(Q.mathvariant=c);var g=h.create("token","mtext",Q,(0,l.numeric)(m));o.default.setProperty(g,"unicode",!0),h.Push(g)},new s.CommandMap("unicode",{unicode:"Unicode"},r.UnicodeMethods),r.UnicodeConfiguration=e.Configuration.create("unicode",{handler:{macro:["unicode"]}})})(JB);var tF={};(function(r){var t=_&&_.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.VerbConfiguration=r.VerbMethods=void 0;var e=he,n=q1,s=Gt,a=t(Le);r.VerbMethods={},r.VerbMethods.Verb=function(o,l){var u=o.GetNext(),h=++o.i;if(u==="")throw new a.default("MissingArgFor","Missing argument for %1",l);for(;o.i<o.string.length&&o.string.charAt(o.i)!==u;)o.i++;if(o.i===o.string.length)throw new a.default("NoClosingDelim","Can't find closing delimiter for %1",o.currentCS);var T=o.string.slice(h,o.i).replace(/ /g," ");o.i++,o.Push(o.create("token","mtext",{mathvariant:n.TexConstant.Variant.MONOSPACE},T))},new s.CommandMap("verb",{verb:"Verb"},r.VerbMethods),r.VerbConfiguration=e.Configuration.create("verb",{handler:{macro:["verb"]}})})(tF);Object.defineProperty(DT,"__esModule",{value:!0});var K_=DT.AllPackages=void 0;R_();typeof MathJax<"u"&&MathJax.loader&&MathJax.loader.preLoad("[tex]/action","[tex]/ams","[tex]/amscd","[tex]/bbox","[tex]/boldsymbol","[tex]/braket","[tex]/bussproofs","[tex]/cancel","[tex]/cases","[tex]/centernot","[tex]/color","[tex]/colorv2","[tex]/colortbl","[tex]/empheq","[tex]/enclose","[tex]/extpfeil","[tex]/gensymb","[tex]/html","[tex]/mathtools","[tex]/mhchem","[tex]/newcommand","[tex]/noerrors","[tex]/noundefined","[tex]/physics","[tex]/upgreek","[tex]/unicode","[tex]/verb","[tex]/configmacros","[tex]/tagformat","[tex]/textcomp","[tex]/textmacros","[tex]/setoptions");K_=DT.AllPackages=["base","action","ams","amscd","bbox","boldsymbol","braket","bussproofs","cancel","cases","centernot","color","colortbl","empheq","enclose","extpfeil","gensymb","html","mathtools","mhchem","newcommand","noerrors","noundefined","upgreek","unicode","verb","configmacros","tagformat","textcomp","textmacros"];var J9={},G7={},z7={},Ns=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(z7,"__esModule",{value:!0});z7.CssStyles=void 0;var eF=function(){function r(t){t===void 0&&(t=null),this.styles={},this.addStyles(t)}return Object.defineProperty(r.prototype,"cssText",{get:function(){return this.getStyleString()},enumerable:!1,configurable:!0}),r.prototype.addStyles=function(t){var e,n;if(t)try{for(var s=Ns(Object.keys(t)),a=s.next();!a.done;a=s.next()){var o=a.value;this.styles[o]||(this.styles[o]={}),Object.assign(this.styles[o],t[o])}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},r.prototype.removeStyles=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=Ns(n),o=a.next();!o.done;o=a.next()){var l=o.value;delete this.styles[l]}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.prototype.clear=function(){this.styles={}},r.prototype.getStyleString=function(){return this.getStyleRules().join(`
154
+ */Object.defineProperty(F7,"__esModule",{value:!0});F7.mhchemParser=void 0;var JR=function(){function r(){}return r.toTex=function(t,e){return ke.go(Tt.go(t,e),e!=="tex")},r}();F7.mhchemParser=JR;function o2(r){var t,e,n={};for(t in r)for(e in r[t]){var s=e.split("|");r[t][e].stateArray=s;for(var a=0;a<s.length;a++)n[s[a]]=[]}for(t in r)for(e in r[t])for(var s=r[t][e].stateArray||[],a=0;a<s.length;a++){var o=r[t][e];o.action_=[].concat(o.action_);for(var l=0;l<o.action_.length;l++)typeof o.action_[l]=="string"&&(o.action_[l]={type_:o.action_[l]});for(var u=t.split("|"),h=0;h<u.length;h++)if(s[a]==="*"){var T=void 0;for(T in n)n[T].push({pattern:u[h],task:o})}else n[s[a]].push({pattern:u[h],task:o})}return n}var Tt={go:function(r,t){if(!r)return[];t===void 0&&(t="ce");var e="0",n={};n.parenthesisLevel=0,r=r.replace(/\n/g," "),r=r.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),r=r.replace(/[\u2026]/g,"...");for(var s,a=10,o=[];;){s!==r?(a=10,s=r):a--;var l=Tt.stateMachines[t],u=l.transitions[e]||l.transitions["*"];t:for(var h=0;h<u.length;h++){var T=Tt.patterns.match_(u[h].pattern,r);if(T){for(var f=u[h].task,d=0;d<f.action_.length;d++){var p=void 0;if(l.actions[f.action_[d].type_])p=l.actions[f.action_[d].type_](n,T.match_,f.action_[d].option);else if(Tt.actions[f.action_[d].type_])p=Tt.actions[f.action_[d].type_](n,T.match_,f.action_[d].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+f.action_[d].type_+")"];Tt.concatArray(o,p)}if(e=f.nextState||e,r.length>0){if(f.revisit||(r=T.remainder),!f.toContinue)break t}else return o}}if(a<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(r,t){if(t)if(Array.isArray(t))for(var e=0;e<t.length;e++)r.push(t[e]);else r.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(r){var t=r.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.slice(1),remainder:r.substr(t[0].length)}:null},"(-)(9)^(-9)":/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/,"state of aggregation $":function(r){var t=Tt.patterns.findObserveGroups(r,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var e=r.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return e?{match_:e[0],remainder:r.substr(e[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". __* ":/^([.\u22C5\u00B7\u2022]|[*])\s*/,"...":/^\.\.\.(?=$|[^.])/,"^{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"^{","","","}")},"^($...$)":function(r){return Tt.patterns.findObserveGroups(r,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"_{","","","}")},"_($...$)":function(r){return Tt.patterns.findObserveGroups(r,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}^":/^\{\}(?=\^)/,"{}":/^\{\}/,"{...}":function(r){return Tt.patterns.findObserveGroups(r,"","{","}","")},"{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"{","","","}")},"$...$":function(r){return Tt.patterns.findObserveGroups(r,"","$","$","")},"${(...)}$__$(...)$":function(r){return Tt.patterns.findObserveGroups(r,"${","","","}$")||Tt.patterns.findObserveGroups(r,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(r){return Tt.patterns.findObserveGroups(r,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(r){return Tt.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(r){return Tt.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\color{","","","}")},"\\color{(...)}{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\color{","","","}","{","","","}")||Tt.patterns.findObserveGroups(r,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\ce{","","","}")},"\\pu{(...)}":function(r){return Tt.patterns.findObserveGroups(r,"\\pu{","","","}")},oxidation$:/^(?:[+-][IVX]+|(?:\\pm|\$\\pm\$|\+-|\+\/-)\s*0)$/,"d-oxidation$":/^(?:[+-]?[IVX]+|(?:\\pm|\$\\pm\$|\+-|\+\/-)\s*0)$/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(r){var t;if(t=r.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),t)return{match_:t[0],remainder:r.substr(t[0].length)};var e=Tt.patterns.findObserveGroups(r,"","$","$","");return e&&(t=e.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),t)?{match_:t[0],remainder:r.substr(t[0].length)}:null},amount2:function(r){return this.amount(r)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(r){if(r.match(/^\([a-z]+\)$/))return null;var t=r.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:r.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(r,t,e,n,s,a,o,l,u,h){var T=function(Q,g){if(typeof g=="string")return Q.indexOf(g)!==0?null:g;var v=Q.match(g);return v?v[0]:null},f=function(Q,g,v){for(var L=0;g<Q.length;){var x=Q.charAt(g),b=T(Q.substr(g),v);if(b!==null&&L===0)return{endMatchBegin:g,endMatchEnd:g+b.length};if(x==="{")L++;else if(x==="}"){if(L===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];L--}g++}return L>0,null},d=T(r,t);if(d===null||(r=r.substr(d.length),d=T(r,e),d===null))return null;var p=f(r,d.length,n||s);if(p===null)return null;var m=r.substring(0,n?p.endMatchEnd:p.endMatchBegin);if(a||o){var y=this.findObserveGroups(r.substr(p.endMatchEnd),a,o,l,u);if(y===null)return null;var c=[m,y.match_];return{match_:h?c.join(""):c,remainder:y.remainder}}else return{match_:m,remainder:r.substr(p.endMatchEnd)}},match_:function(r,t){var e=Tt.patterns.patterns[r];if(e===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+r+")"];if(typeof e=="function")return Tt.patterns.patterns[r](t);var n=t.match(e);return n?n.length>2?{match_:n.slice(1),remainder:t.substr(n[0].length)}:{match_:n[1]||n[0],remainder:t.substr(n[0].length)}:null}},actions:{"a=":function(r,t){r.a=(r.a||"")+t},"b=":function(r,t){r.b=(r.b||"")+t},"p=":function(r,t){r.p=(r.p||"")+t},"o=":function(r,t){r.o=(r.o||"")+t},"o=+p1":function(r,t,e){r.o=(r.o||"")+e},"q=":function(r,t){r.q=(r.q||"")+t},"d=":function(r,t){r.d=(r.d||"")+t},"rm=":function(r,t){r.rm=(r.rm||"")+t},"text=":function(r,t){r.text_=(r.text_||"")+t},insert:function(r,t,e){return{type_:e}},"insert+p1":function(r,t,e){return{type_:e,p1:t}},"insert+p1+p2":function(r,t,e){return{type_:e,p1:t[0],p2:t[1]}},copy:function(r,t){return t},write:function(r,t,e){return e},rm:function(r,t){return{type_:"rm",p1:t}},text:function(r,t){return Tt.go(t,"text")},"tex-math":function(r,t){return Tt.go(t,"tex-math")},"tex-math tight":function(r,t){return Tt.go(t,"tex-math tight")},bond:function(r,t,e){return{type_:"bond",kind_:e||t}},"color0-output":function(r,t){return{type_:"color0",color:t}},ce:function(r,t){return Tt.go(t,"ce")},pu:function(r,t){return Tt.go(t,"pu")},"1/2":function(r,t){var e=[];t.match(/^[+\-]/)&&(e.push(t.substr(0,1)),t=t.substr(1));var n=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return n[1]=n[1].replace(/\$/g,""),e.push({type_:"frac",p1:n[1],p2:n[2]}),n[3]&&(n[3]=n[3].replace(/\$/g,""),e.push({type_:"tex-math",p1:n[3]})),e},"9,9":function(r,t){return Tt.go(t,"9,9")}},stateMachines:{tex:{transitions:o2({empty:{0:{action_:"copy"}},"\\ce{(...)}":{0:{action_:[{type_:"write",option:"{"},"ce",{type_:"write",option:"}"}]}},"\\pu{(...)}":{0:{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},else:{0:{action_:"copy"}}}),actions:{}},ce:{transitions:o2({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{action_:[]}},space:{a:{action_:[],nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". __* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{action_:[]}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}^":{"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"tinySkip"}],nextState:"1"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}],nextState:"3"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(r,t){var e;if((r.d||"").match(/^[1-9][0-9]*$/)){var n=r.d;r.d=void 0,e=this.output(r),e.push({type_:"tinySkip"}),r.b=n}else e=this.output(r);return Tt.actions["o="](r,t),e},"d= kv":function(r,t){r.d=t,r.dType="kv"},"charge or bond":function(r,t){if(r.beginsWithBond){var e=[];return Tt.concatArray(e,this.output(r)),Tt.concatArray(e,Tt.actions.bond(r,t,"-")),e}else{r.d=t;return}},"- after o/d":function(r,t,e){var n=Tt.patterns.match_("orbital",r.o||""),s=Tt.patterns.match_("one lowercase greek letter $",r.o||""),a=Tt.patterns.match_("one lowercase latin letter $",r.o||""),o=Tt.patterns.match_("$one lowercase latin letter$ $",r.o||""),l=t==="-"&&(n&&n.remainder===""||s||a||o);l&&!r.a&&!r.b&&!r.p&&!r.d&&!r.q&&!n&&a&&(r.o="$"+r.o+"$");var u=[];return l?(Tt.concatArray(u,this.output(r)),u.push({type_:"hyphen"})):(n=Tt.patterns.match_("digits",r.d||""),e&&n&&n.remainder===""?(Tt.concatArray(u,Tt.actions["d="](r,t)),Tt.concatArray(u,this.output(r))):(Tt.concatArray(u,this.output(r)),Tt.concatArray(u,Tt.actions.bond(r,t,"-")))),u},"a to o":function(r){r.o=r.a,r.a=void 0},"sb=true":function(r){r.sb=!0},"sb=false":function(r){r.sb=!1},"beginsWithBond=true":function(r){r.beginsWithBond=!0},"beginsWithBond=false":function(r){r.beginsWithBond=!1},"parenthesisLevel++":function(r){r.parenthesisLevel++},"parenthesisLevel--":function(r){r.parenthesisLevel--},"state of aggregation":function(r,t){return{type_:"state of aggregation",p1:Tt.go(t,"o")}},comma:function(r,t){var e=t.replace(/\s*$/,""),n=e!==t;return n&&r.parenthesisLevel===0?{type_:"comma enumeration L",p1:e}:{type_:"comma enumeration M",p1:e}},output:function(r,t,e){var n;if(!r.r)n=[],!r.a&&!r.b&&!r.p&&!r.o&&!r.q&&!r.d&&!e||(r.sb&&n.push({type_:"entitySkip"}),!r.o&&!r.q&&!r.d&&!r.b&&!r.p&&e!==2?(r.o=r.a,r.a=void 0):!r.o&&!r.q&&!r.d&&(r.b||r.p)?(r.o=r.a,r.d=r.b,r.q=r.p,r.a=r.b=r.p=void 0):r.o&&r.dType==="kv"&&Tt.patterns.match_("d-oxidation$",r.d||"")?r.dType="oxidation":r.o&&r.dType==="kv"&&!r.q&&(r.dType=void 0),n.push({type_:"chemfive",a:Tt.go(r.a,"a"),b:Tt.go(r.b,"bd"),p:Tt.go(r.p,"pq"),o:Tt.go(r.o,"o"),q:Tt.go(r.q,"pq"),d:Tt.go(r.d,r.dType==="oxidation"?"oxidation":"bd"),dType:r.dType}));else{var s=void 0;r.rdt==="M"?s=Tt.go(r.rd,"tex-math"):r.rdt==="T"?s=[{type_:"text",p1:r.rd||""}]:s=Tt.go(r.rd,"ce");var a=void 0;r.rqt==="M"?a=Tt.go(r.rq,"tex-math"):r.rqt==="T"?a=[{type_:"text",p1:r.rq||""}]:a=Tt.go(r.rq,"ce"),n={type_:"arrow",r:r.r,rd:s,rq:a}}for(var o in r)o!=="parenthesisLevel"&&o!=="beginsWithBond"&&delete r[o];return n},"oxidation-output":function(r,t){var e=["{"];return Tt.concatArray(e,Tt.go(t,"oxidation")),e.push("}"),e},"frac-output":function(r,t){return{type_:"frac-ce",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"overset-output":function(r,t){return{type_:"overset",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"underset-output":function(r,t){return{type_:"underset",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"underbrace-output":function(r,t){return{type_:"underbrace",p1:Tt.go(t[0],"ce"),p2:Tt.go(t[1],"ce")}},"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"ce")}},"r=":function(r,t){r.r=t},"rdt=":function(r,t){r.rdt=t},"rd=":function(r,t){r.rd=t},"rqt=":function(r,t){r.rqt=t},"rq=":function(r,t){r.rq=t},operator:function(r,t,e){return{type_:"operator",kind_:e||t}}}},a:{transitions:o2({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:o2({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:[{type_:"write",option:"{"},"text",{type_:"write",option:"}"}]}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:o2({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(r){if(r.text_){var t={type_:"text",p1:r.text_};for(var e in r)delete r[e];return t}}}},pq:{transitions:o2({empty:{"*":{action_:[]}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{action_:[],nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(r,t){return{type_:"state of aggregation subscript",p1:Tt.go(t,"o")}},"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"pq")}}}},bd:{transitions:o2({empty:{"*":{action_:[]}},x$:{0:{action_:[],nextState:"!f",revisit:!0}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(r,t){return{type_:"color",color1:t[0],color2:Tt.go(t[1],"bd")}}}},oxidation:{transitions:o2({empty:{"*":{action_:"roman-numeral"}},"pm-operator":{"*":{action_:{type_:"o=+p1",option:"\\pm"}}},else:{"*":{action_:"o="}}}),actions:{"roman-numeral":function(r){return{type_:"roman numeral",p1:r.o||""}}}},"tex-math":{transitions:o2({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(r){if(r.o){var t={type_:"tex-math",p1:r.o};for(var e in r)delete r[e];return t}}}},"tex-math tight":{transitions:o2({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(r,t){r.o=(r.o||"")+"{"+t+"}"},output:function(r){if(r.o){var t={type_:"tex-math",p1:r.o};for(var e in r)delete r[e];return t}}}},"9,9":{transitions:o2({empty:{"*":{action_:[]}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:o2({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{action_:[]}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(r,t){var e=[];return t[0]==="+-"||t[0]==="+/-"?e.push("\\pm "):t[0]&&e.push(t[0]),t[1]&&(Tt.concatArray(e,Tt.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?Tt.concatArray(e,Tt.go(t[2],"pu-9,9")):e.push(t[2])),(t[3]||t[4])&&(t[3]==="e"||t[4]==="*"?e.push({type_:"cdot"}):e.push({type_:"times"}))),t[5]&&e.push("10^{"+t[5]+"}"),e},"number^":function(r,t){var e=[];return t[0]==="+-"||t[0]==="+/-"?e.push("\\pm "):t[0]&&e.push(t[0]),Tt.concatArray(e,Tt.go(t[1],"pu-9,9")),e.push("^{"+t[2]+"}"),e},operator:function(r,t,e){return{type_:"operator",kind_:e||t}},space:function(){return{type_:"pu-space-1"}},output:function(r){var t,e=Tt.patterns.match_("{(...)}",r.d||"");e&&e.remainder===""&&(r.d=e.match_);var n=Tt.patterns.match_("{(...)}",r.q||"");if(n&&n.remainder===""&&(r.q=n.match_),r.d&&(r.d=r.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.d=r.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),r.q){r.q=r.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.q=r.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var s={d:Tt.go(r.d,"pu"),q:Tt.go(r.q,"pu")};r.o==="//"?t={type_:"pu-frac",p1:s.d,p2:s.q}:(t=s.d,s.d.length>1||s.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),Tt.concatArray(t,s.q))}else t=Tt.go(r.d,"pu-2");for(var a in r)delete r[a];return t}}},"pu-2":{transitions:o2({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(r,t){r.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(r){var t=[];if(r.rm){var e=Tt.patterns.match_("{(...)}",r.rm||"");e&&e.remainder===""?t=Tt.go(e.match_,"pu"):t={type_:"rm",p1:r.rm}}for(var n in r)delete r[n];return t}}},"pu-9,9":{transitions:o2({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(r){var t=[];if(r.text_=r.text_||"",r.text_.length>4){var e=r.text_.length%3;e===0&&(e=3);for(var n=r.text_.length-3;n>0;n-=3)t.push(r.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(r.text_.substr(0,e)),t.reverse()}else t.push(r.text_);for(var s in r)delete r[s];return t},"output-o":function(r){var t=[];if(r.text_=r.text_||"",r.text_.length>4){var e=r.text_.length-3,n=void 0;for(n=0;n<e;n+=3)t.push(r.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(r.text_.substr(n))}else t.push(r.text_);for(var s in r)delete r[s];return t}}}}},ke={go:function(r,t){if(!r)return"";for(var e="",n=!1,s=0;s<r.length;s++){var a=r[s];typeof a=="string"?e+=a:(e+=ke._go2(a),a.type_==="1st-level escape"&&(n=!0))}return t&&!n&&e&&(e="{"+e+"}"),e},_goInner:function(r){return ke.go(r,!1)},_go2:function(r){var t;switch(r.type_){case"chemfive":t="";var e={a:ke._goInner(r.a),b:ke._goInner(r.b),p:ke._goInner(r.p),o:ke._goInner(r.o),q:ke._goInner(r.q),d:ke._goInner(r.d)};e.a&&(e.a.match(/^[+\-]/)&&(e.a="{"+e.a+"}"),t+=e.a+"\\,"),(e.b||e.p)&&(t+="{\\vphantom{A}}",t+="^{\\hphantom{"+(e.b||"")+"}}_{\\hphantom{"+(e.p||"")+"}}",t+="\\mkern-1.5mu",t+="{\\vphantom{A}}",t+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(e.b||"")+"}}",t+="_{\\vphantom{2}\\llap{\\smash[t]{"+(e.p||"")+"}}}"),e.o&&(e.o.match(/^[+\-]/)&&(e.o="{"+e.o+"}"),t+=e.o),r.dType==="kv"?((e.d||e.q)&&(t+="{\\vphantom{A}}"),e.d&&(t+="^{"+e.d+"}"),e.q&&(t+="_{\\smash[t]{"+e.q+"}}")):r.dType==="oxidation"?(e.d&&(t+="{\\vphantom{A}}",t+="^{"+e.d+"}"),e.q&&(t+="{\\vphantom{A}}",t+="_{\\smash[t]{"+e.q+"}}")):(e.q&&(t+="{\\vphantom{A}}",t+="_{\\smash[t]{"+e.q+"}}"),e.d&&(t+="{\\vphantom{A}}",t+="^{"+e.d+"}"));break;case"rm":t="\\mathrm{"+r.p1+"}";break;case"text":r.p1.match(/[\^_]/)?(r.p1=r.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+r.p1+"}"):t="\\text{"+r.p1+"}";break;case"roman numeral":t="\\mathrm{"+r.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+ke._goInner(r.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+ke._goInner(r.p1);break;case"bond":if(t=ke._getBond(r.kind_),!t)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+r.kind_+")"];break;case"frac":var n="\\frac{"+r.p1+"}{"+r.p2+"}";t="\\mathchoice{\\textstyle"+n+"}{"+n+"}{"+n+"}{"+n+"}";break;case"pu-frac":var s="\\frac{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";t="\\mathchoice{\\textstyle"+s+"}{"+s+"}{"+s+"}{"+s+"}";break;case"tex-math":t=r.p1+" ";break;case"frac-ce":t="\\frac{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"overset":t="\\overset{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"underset":t="\\underset{"+ke._goInner(r.p1)+"}{"+ke._goInner(r.p2)+"}";break;case"underbrace":t="\\underbrace{"+ke._goInner(r.p1)+"}_{"+ke._goInner(r.p2)+"}";break;case"color":t="{\\color{"+r.color1+"}{"+ke._goInner(r.color2)+"}}";break;case"color0":t="\\color{"+r.color+"}";break;case"arrow":var a={rd:ke._goInner(r.rd),rq:ke._goInner(r.rq)},o=ke._getArrow(r.r);a.rd||a.rq?r.r==="<=>"||r.r==="<=>>"||r.r==="<<=>"||r.r==="<-->"?(o="\\long"+o,a.rd&&(o="\\overset{"+a.rd+"}{"+o+"}"),a.rq&&(r.r==="<-->"?o="\\underset{\\lower2mu{"+a.rq+"}}{"+o+"}":o="\\underset{\\lower6mu{"+a.rq+"}}{"+o+"}"),o=" {}\\mathrel{"+o+"}{} "):(a.rq&&(o+="[{"+a.rq+"}]"),o+="{"+a.rd+"}",o=" {}\\mathrel{\\x"+o+"}{} "):o=" {}\\mathrel{\\long"+o+"}{} ",t=o;break;case"operator":t=ke._getOperator(r.kind_);break;case"1st-level escape":t=r.p1+" ";break;case"space":t=" ";break;case"tinySkip":t="\\mkern2mu";break;case"entitySkip":t="~";break;case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+r.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+r.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+r.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(r){switch(r){case"->":return"rightarrow";case"→":return"rightarrow";case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"⇌":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(r){switch(r){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(r){switch(r){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}},B_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty($T,"__esModule",{value:!0});$T.MhchemConfiguration=void 0;var tB=he,eB=Gt,iB=B_(Le),rB=B_(p2),nB=Yn,sB=F7,N7={};N7.Macro=rB.default.Macro;N7.xArrow=nB.AmsMethods.xArrow;N7.Machine=function(r,t,e){var n=r.GetArgument(t),s;try{s=sB.mhchemParser.toTex(n,e)}catch(a){throw new iB.default(a[0],a[1])}r.string=s+r.string.substr(r.i),r.i=0};new eB.CommandMap("mhchem",{ce:["Machine","ce"],pu:["Machine","pu"],longrightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longRightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],longLeftrightharpoons:["Macro","\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longleftrightarrows:["Macro","\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}"],tripledash:["Macro","\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"],xleftrightarrow:["xArrow",8596,6,6],xrightleftharpoons:["xArrow",8652,5,7],xRightleftharpoons:["xArrow",8652,5,7],xLeftrightharpoons:["xArrow",8652,5,7]},N7);$T.MhchemConfiguration=tB.Configuration.create("mhchem",{handler:{macro:["mhchem"]}});var YT={};Object.defineProperty(YT,"__esModule",{value:!0});YT.NoErrorsConfiguration=void 0;var aB=he;function oB(r,t,e,n){var s=r.create("token","mtext",{},n.replace(/\n/g," ")),a=r.create("node","merror",[s],{"data-mjx-error":t,title:t});return a}YT.NoErrorsConfiguration=aB.Configuration.create("noerrors",{nodes:{error:oB}});var JT={},lB=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(JT,"__esModule",{value:!0});JT.NoUndefinedConfiguration=void 0;var uB=he;function cB(r,t){var e,n,s=r.create("text","\\"+t),a=r.options.noundefined||{},o={};try{for(var l=lB(["color","background","size"]),u=l.next();!u.done;u=l.next()){var h=u.value;a[h]&&(o["math"+h]=a[h])}}catch(T){e={error:T}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}r.Push(r.create("node","mtext",[],o,s))}JT.NoUndefinedConfiguration=uB.Configuration.create("noundefined",{fallback:{macro:cB},options:{noundefined:{color:"red",background:"",size:""}},priority:3});var tf={},U7={},hB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ef=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(U7,"__esModule",{value:!0});U7.AutoOpen=void 0;var Ag=n3,TB=ef(Ue()),fB=ef(Ne),QB=ef(e2()),dB=function(r){hB(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.openCount=0,e}return Object.defineProperty(t.prototype,"kind",{get:function(){return"auto open"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.toMml=function(){var e=this.factory.configuration.parser,n=this.getProperty("right");if(this.getProperty("smash")){var s=r.prototype.toMml.call(this),a=e.create("node","mpadded",[s],{height:0,depth:0});this.Clear(),this.Push(e.create("node","TeXAtom",[a]))}n&&this.Push(new QB.default(n,e.stack.env,e.configuration).mml());var o=TB.default.fenced(this.factory.configuration,this.getProperty("open"),r.prototype.toMml.call(this),this.getProperty("close"),this.getProperty("big"));return fB.default.removeProperties(o,"open","close","texClass"),o},t.prototype.checkItem=function(e){if(e.isKind("mml")&&e.Size()===1){var n=e.toMml();n.isKind("mo")&&n.getText()===this.getProperty("open")&&this.openCount++}var s=e.getProperty("autoclose");return s&&s===this.getProperty("close")&&!this.openCount--?this.getProperty("ignore")?(this.Clear(),[[],!0]):[[this.toMml()],!0]:r.prototype.checkItem.call(this,e)},t.errors=Object.assign(Object.create(Ag.BaseItem.errors),{stop:["ExtraOrMissingDelims","Extra open or missing close delimiter"]}),t}(Ag.BaseItem);U7.AutoOpen=dB;var rf={},pB=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},C0=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rf,"__esModule",{value:!0});var nf=C0(p2),P1=C0(e2()),On=C0(Le),sf=jt,p5=C0(Ue()),eh=C0(Ne),gB=Xn,Ce={},F_={"(":")","[":"]","{":"}","|":"|"},N_=/^(b|B)i(g{1,2})$/;Ce.Quantity=function(r,t,e,n,s,a,o){e===void 0&&(e="("),n===void 0&&(n=")"),s===void 0&&(s=!1),a===void 0&&(a=""),o===void 0&&(o="");var l=s?r.GetStar():!1,u=r.GetNext(),h=r.i,T=null;if(u==="\\"){if(r.i++,T=r.GetCS(),!T.match(N_)){var f=r.create("node","mrow");r.Push(p5.default.fenced(r.configuration,e,f,n)),r.i=h;return}u=r.GetNext()}var d=F_[u];if(s&&u!=="{")throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);if(!d){var f=r.create("node","mrow");r.Push(p5.default.fenced(r.configuration,e,f,n)),r.i=h;return}if(a){var p=r.create("token","mi",{texClass:sf.TEXCLASS.OP},a);o&&eh.default.setAttribute(p,"mathvariant",o),r.Push(r.itemFactory.create("fn",p))}if(u==="{"){var m=r.GetArgument(t);u=s?e:"\\{",d=s?n:"\\}",m=l?u+" "+m+" "+d:T?"\\"+T+"l"+u+" "+m+" \\"+T+"r"+d:"\\left"+u+" "+m+" \\right"+d,r.Push(new P1.default(m,r.stack.env,r.configuration).mml());return}s&&(u=e,d=n),r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:u,close:d,big:T}))};Ce.Eval=function(r,t){var e=r.GetStar(),n=r.GetNext();if(n==="{"){var s=r.GetArgument(t),a="\\left. "+(e?"\\smash{"+s+"}":s)+" \\vphantom{\\int}\\right|";r.string=r.string.slice(0,r.i)+a+r.string.slice(r.i);return}if(n==="("||n==="["){r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:n,close:"|",smash:e,right:"\\vphantom{\\int}"}));return}throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS)};Ce.Commutator=function(r,t,e,n){e===void 0&&(e="["),n===void 0&&(n="]");var s=r.GetStar(),a=r.GetNext(),o=null;if(a==="\\"){if(r.i++,o=r.GetCS(),!o.match(N_))throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);a=r.GetNext()}if(a!=="{")throw new On.default("MissingArgFor","Missing argument for %1",r.currentCS);var l=r.GetArgument(t),u=r.GetArgument(t),h=l+","+u;h=s?e+" "+h+" "+n:o?"\\"+o+"l"+e+" "+h+" \\"+o+"r"+n:"\\left"+e+" "+h+" \\right"+n,r.Push(new P1.default(h,r.stack.env,r.configuration).mml())};var mB=[65,90],yB=[97,122],vB=[913,937],LB=[945,969],xB=[48,57];function _6(r,t){return r>=t[0]&&r<=t[1]}function _B(r,t,e,n){var s=r.configuration.parser,a=gB.NodeFactory.createToken(r,t,e,n),o=n.codePointAt(0);return n.length===1&&!s.stack.env.font&&s.stack.env.vectorFont&&(_6(o,mB)||_6(o,yB)||_6(o,vB)||_6(o,xB)||_6(o,LB)&&s.stack.env.vectorStar||eh.default.getAttribute(a,"accent"))&&eh.default.setAttribute(a,"mathvariant",s.stack.env.vectorFont),a}Ce.VectorBold=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=r.configuration.nodeFactory.get("token"),a=r.stack.env.font;delete r.stack.env.font,r.configuration.nodeFactory.set("token",_B),r.stack.env.vectorFont=e?"bold-italic":"bold",r.stack.env.vectorStar=e;var o=new P1.default(n,r.stack.env,r.configuration).mml();a&&(r.stack.env.font=a),delete r.stack.env.vectorFont,delete r.stack.env.vectorStar,r.configuration.nodeFactory.set("token",s),r.Push(o)};Ce.StarMacro=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];var a=r.GetStar(),o=[];if(e)for(var l=o.length;l<e;l++)o.push(r.GetArgument(t));var u=n.join(a?"*":"");u=p5.default.substituteArgs(r,o,u),r.string=p5.default.addArgs(r,u,r.string.slice(r.i)),r.i=0,p5.default.checkMaxMacros(r)};var U_=function(r,t,e,n,s){var a=new P1.default(n,r.stack.env,r.configuration).mml();r.Push(r.itemFactory.create(t,a));var o=r.GetNext(),l=F_[o];if(l){var u="",h="",T="",f=s.indexOf(o)!==-1;if(o==="{"){T=r.GetArgument(e),u=f?"\\left\\{":"",h=f?"\\right\\}":"";var d=u+" "+T+" "+h;r.string=d+r.string.slice(r.i),r.i=0;return}f&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:o,close:l})))}};Ce.OperatorApplication=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];U_(r,"fn",t,e,n)};Ce.VectorOperator=function(r,t,e){for(var n=[],s=3;s<arguments.length;s++)n[s-3]=arguments[s];U_(r,"mml",t,e,n)};Ce.Expression=function(r,t,e,n){e===void 0&&(e=!0),n===void 0&&(n=""),n=n||t.slice(1);var s=e?r.GetBrackets(t):null,a=r.create("token","mi",{texClass:sf.TEXCLASS.OP},n);if(s){var o=new P1.default(s,r.stack.env,r.configuration).mml();a=r.create("node","msup",[a,o])}r.Push(r.itemFactory.create("fn",a)),r.GetNext()==="("&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")"})))};Ce.Qqtext=function(r,t,e){var n=r.GetStar(),s=e||r.GetArgument(t),a=(n?"":"\\quad")+"\\text{"+s+"}\\quad ";r.string=r.string.slice(0,r.i)+a+r.string.slice(r.i)};Ce.Differential=function(r,t,e){var n=r.GetBrackets(t),s=n!=null?"^{"+n+"}":" ",a=r.GetNext()==="(",o=r.GetNext()==="{",l=e+s;if(!(a||o)){l+=r.GetArgument(t,!0)||"";var u=new P1.default(l,r.stack.env,r.configuration).mml();r.Push(u);return}if(o){l+=r.GetArgument(t);var u=new P1.default(l,r.stack.env,r.configuration).mml();r.Push(r.create("node","TeXAtom",[u],{texClass:sf.TEXCLASS.OP}));return}r.Push(new P1.default(l,r.stack.env,r.configuration).mml()),r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")"}))};Ce.Derivative=function(r,t,e,n){var s=r.GetStar(),a=r.GetBrackets(t),o=1,l=[];for(l.push(r.GetArgument(t));r.GetNext()==="{"&&o<e;)l.push(r.GetArgument(t)),o++;var u=!1,h=" ",T=" ";e>2&&l.length>2?(h="^{"+(l.length-1)+"}",u=!0):a!=null&&(e>2&&l.length>1&&(u=!0),h="^{"+a+"}",T=h);for(var f=s?"\\flatfrac":"\\frac",d=l.length>1?l[0]:"",p=l.length>1?l[1]:l[0],m="",y=2,c=void 0;c=l[y];y++)m+=n+" "+c;var Q=f+"{"+n+h+d+"}{"+n+" "+p+T+" "+m+"}";r.Push(new P1.default(Q,r.stack.env,r.configuration).mml()),r.GetNext()==="("&&(r.i++,r.Push(r.itemFactory.create("auto open").setProperties({open:"(",close:")",ignore:u})))};Ce.Bra=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s="",a=!1,o=!1;if(r.GetNext()==="\\"){var l=r.i;r.i++;var u=r.GetCS(),h=r.lookup("macro",u);h&&h.symbol==="ket"?(a=!0,l=r.i,o=r.GetStar(),r.GetNext()==="{"?s=r.GetArgument(u,!0):(r.i=l,o=!1)):r.i=l}var T="";a?T=e||o?"\\langle{".concat(n,"}\\vert{").concat(s,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(s,"}\\right\\rangle"):T=e||o?"\\langle{".concat(n,"}\\vert"):"\\left\\langle{".concat(n,"}\\right\\vert{").concat(s,"}"),r.Push(new P1.default(T,r.stack.env,r.configuration).mml())};Ce.Ket=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=e?"\\vert{".concat(n,"}\\rangle"):"\\left\\vert{".concat(n,"}\\right\\rangle");r.Push(new P1.default(s,r.stack.env,r.configuration).mml())};Ce.BraKet=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=null;r.GetNext()==="{"&&(s=r.GetArgument(t,!0));var a="";s==null?a=e?"\\langle{".concat(n,"}\\vert{").concat(n,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(n,"}\\right\\rangle"):a=e?"\\langle{".concat(n,"}\\vert{").concat(s,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(s,"}\\right\\rangle"),r.Push(new P1.default(a,r.stack.env,r.configuration).mml())};Ce.KetBra=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=null;r.GetNext()==="{"&&(s=r.GetArgument(t,!0));var a="";s==null?a=e?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(n,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(n,"}\\right\\vert"):a=e?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(s,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(s,"}\\right\\vert"),r.Push(new P1.default(a,r.stack.env,r.configuration).mml())};function j_(r,t,e){var n=pB(r,3),s=n[0],a=n[1],o=n[2];return t&&e?"\\left\\langle{".concat(s,"}\\middle\\vert{").concat(a,"}\\middle\\vert{").concat(o,"}\\right\\rangle"):t?"\\langle{".concat(s,"}\\vert{").concat(a,"}\\vert{").concat(o,"}\\rangle"):"\\left\\langle{".concat(s,"}\\right\\vert{").concat(a,"}\\left\\vert{").concat(o,"}\\right\\rangle")}Ce.Expectation=function(r,t){var e=r.GetStar(),n=e&&r.GetStar(),s=r.GetArgument(t),a=null;r.GetNext()==="{"&&(a=r.GetArgument(t,!0));var o=s&&a?j_([a,s,a],e,n):e?"\\langle {".concat(s,"} \\rangle"):"\\left\\langle {".concat(s,"} \\right\\rangle");r.Push(new P1.default(o,r.stack.env,r.configuration).mml())};Ce.MatrixElement=function(r,t){var e=r.GetStar(),n=e&&r.GetStar(),s=r.GetArgument(t),a=r.GetArgument(t),o=r.GetArgument(t),l=j_([s,a,o],e,n);r.Push(new P1.default(l,r.stack.env,r.configuration).mml())};Ce.MatrixQuantity=function(r,t,e){var n=r.GetStar(),s=r.GetNext(),a=e?"smallmatrix":"array",o="",l="",u="";switch(s){case"{":o=r.GetArgument(t);break;case"(":r.i++,l=n?"\\lgroup":"(",u=n?"\\rgroup":")",o=r.GetUpTo(t,")");break;case"[":r.i++,l="[",u="]",o=r.GetUpTo(t,"]");break;case"|":r.i++,l="|",u="|",o=r.GetUpTo(t,"|");break;default:l="(",u=")";break}var h=(l?"\\left":"")+l+"\\begin{"+a+"}{} "+o+"\\end{"+a+"}"+(l?"\\right":"")+u;r.Push(new P1.default(h,r.stack.env,r.configuration).mml())};Ce.IdentityMatrix=function(r,t){var e=r.GetArgument(t),n=parseInt(e,10);if(isNaN(n))throw new On.default("InvalidNumber","Invalid number");if(n<=1){r.string="1"+r.string.slice(r.i),r.i=0;return}for(var s=Array(n).fill("0"),a=[],o=0;o<n;o++){var l=s.slice();l[o]="1",a.push(l.join(" & "))}r.string=a.join("\\\\ ")+r.string.slice(r.i),r.i=0};Ce.XMatrix=function(r,t){var e=r.GetStar(),n=r.GetArgument(t),s=r.GetArgument(t),a=r.GetArgument(t),o=parseInt(s,10),l=parseInt(a,10);if(isNaN(o)||isNaN(l)||l.toString()!==a||o.toString()!==s)throw new On.default("InvalidNumber","Invalid number");if(o=o<1?1:o,l=l<1?1:l,!e){var u=Array(l).fill(n).join(" & "),h=Array(o).fill(u).join("\\\\ ");r.string=h+r.string.slice(r.i),r.i=0;return}var T="";if(o===1&&l===1)T=n;else if(o===1){for(var u=[],f=1;f<=l;f++)u.push("".concat(n,"_{").concat(f,"}"));T=u.join(" & ")}else if(l===1){for(var u=[],f=1;f<=o;f++)u.push("".concat(n,"_{").concat(f,"}"));T=u.join("\\\\ ")}else{for(var d=[],f=1;f<=o;f++){for(var u=[],p=1;p<=l;p++)u.push("".concat(n,"_{{").concat(f,"}{").concat(p,"}}"));d.push(u.join(" & "))}T=d.join("\\\\ ")}r.string=T+r.string.slice(r.i),r.i=0};Ce.PauliMatrix=function(r,t){var e=r.GetArgument(t),n=e.slice(1);switch(e[0]){case"0":n+=" 1 & 0\\\\ 0 & 1";break;case"1":case"x":n+=" 0 & 1\\\\ 1 & 0";break;case"2":case"y":n+=" 0 & -i\\\\ i & 0";break;case"3":case"z":n+=" 1 & 0\\\\ 0 & -1";break}r.string=n+r.string.slice(r.i),r.i=0};Ce.DiagonalMatrix=function(r,t,e){if(r.GetNext()==="{"){var n=r.i;r.GetArgument(t);var s=r.i;r.i=n+1;for(var a=[],o="",l=r.i;l<s;){try{o=r.GetUpTo(t,",")}catch{r.i=s,a.push(r.string.slice(l,s-1));break}if(r.i>=s){a.push(r.string.slice(l,s));break}l=r.i,a.push(o)}r.string=bB(a,e)+r.string.slice(s),r.i=0}};function bB(r,t){for(var e=r.length,n=[],s=0;s<e;s++)n.push(Array(t?e-s:s+1).join("&")+"\\mqty{"+r[s]+"}");return n.join("\\\\ ")}Ce.AutoClose=function(r,t,e){var n=r.create("token","mo",{stretchy:!1},t),s=r.itemFactory.create("mml",n).setProperties({autoclose:t});r.Push(s)};Ce.Vnabla=function(r,t){var e=r.options.physics.arrowdel?"\\vec{\\gradientnabla}":"{\\gradientnabla}";return r.Push(new P1.default(e,r.stack.env,r.configuration).mml())};Ce.DiffD=function(r,t){var e=r.options.physics.italicdiff?"d":"{\\rm d}";return r.Push(new P1.default(e,r.stack.env,r.configuration).mml())};Ce.Macro=nf.default.Macro;Ce.NamedFn=nf.default.NamedFn;Ce.Array=nf.default.Array;rf.default=Ce;var G_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},f3=Gt,wi=G_(rf),on=q1,af=G_(h3),SB=jt;new f3.CommandMap("Physics-automatic-bracing-macros",{quantity:"Quantity",qty:"Quantity",pqty:["Quantity","(",")",!0],bqty:["Quantity","[","]",!0],vqty:["Quantity","|","|",!0],Bqty:["Quantity","\\{","\\}",!0],absolutevalue:["Quantity","|","|",!0],abs:["Quantity","|","|",!0],norm:["Quantity","\\|","\\|",!0],evaluated:"Eval",eval:"Eval",order:["Quantity","(",")",!0,"O",on.TexConstant.Variant.CALLIGRAPHIC],commutator:"Commutator",comm:"Commutator",anticommutator:["Commutator","\\{","\\}"],acomm:["Commutator","\\{","\\}"],poissonbracket:["Commutator","\\{","\\}"],pb:["Commutator","\\{","\\}"]},wi.default);new f3.CharacterMap("Physics-vector-mo",af.default.mathchar0mo,{dotproduct:["⋅",{mathvariant:on.TexConstant.Variant.BOLD}],vdot:["⋅",{mathvariant:on.TexConstant.Variant.BOLD}],crossproduct:"×",cross:"×",cp:"×",gradientnabla:["∇",{mathvariant:on.TexConstant.Variant.BOLD}]});new f3.CharacterMap("Physics-vector-mi",af.default.mathchar0mi,{real:["ℜ",{mathvariant:on.TexConstant.Variant.NORMAL}],imaginary:["ℑ",{mathvariant:on.TexConstant.Variant.NORMAL}]});new f3.CommandMap("Physics-vector-macros",{vnabla:"Vnabla",vectorbold:"VectorBold",vb:"VectorBold",vectorarrow:["StarMacro",1,"\\vec{\\vb","{#1}}"],va:["StarMacro",1,"\\vec{\\vb","{#1}}"],vectorunit:["StarMacro",1,"\\hat{\\vb","{#1}}"],vu:["StarMacro",1,"\\hat{\\vb","{#1}}"],gradient:["OperatorApplication","\\vnabla","(","["],grad:["OperatorApplication","\\vnabla","(","["],divergence:["VectorOperator","\\vnabla\\vdot","(","["],div:["VectorOperator","\\vnabla\\vdot","(","["],curl:["VectorOperator","\\vnabla\\crossproduct","(","["],laplacian:["OperatorApplication","\\nabla^2","(","["]},wi.default);new f3.CommandMap("Physics-expressions-macros",{sin:"Expression",sinh:"Expression",arcsin:"Expression",asin:"Expression",cos:"Expression",cosh:"Expression",arccos:"Expression",acos:"Expression",tan:"Expression",tanh:"Expression",arctan:"Expression",atan:"Expression",csc:"Expression",csch:"Expression",arccsc:"Expression",acsc:"Expression",sec:"Expression",sech:"Expression",arcsec:"Expression",asec:"Expression",cot:"Expression",coth:"Expression",arccot:"Expression",acot:"Expression",exp:["Expression",!1],log:"Expression",ln:"Expression",det:["Expression",!1],Pr:["Expression",!1],tr:["Expression",!1],trace:["Expression",!1,"tr"],Tr:["Expression",!1],Trace:["Expression",!1,"Tr"],rank:"NamedFn",erf:["Expression",!1],Residue:["Macro","\\mathrm{Res}"],Res:["OperatorApplication","\\Residue","(","[","{"],principalvalue:["OperatorApplication","{\\cal P}"],pv:["OperatorApplication","{\\cal P}"],PV:["OperatorApplication","{\\rm P.V.}"],Re:["OperatorApplication","\\mathrm{Re}","{"],Im:["OperatorApplication","\\mathrm{Im}","{"],sine:["NamedFn","sin"],hypsine:["NamedFn","sinh"],arcsine:["NamedFn","arcsin"],asine:["NamedFn","asin"],cosine:["NamedFn","cos"],hypcosine:["NamedFn","cosh"],arccosine:["NamedFn","arccos"],acosine:["NamedFn","acos"],tangent:["NamedFn","tan"],hyptangent:["NamedFn","tanh"],arctangent:["NamedFn","arctan"],atangent:["NamedFn","atan"],cosecant:["NamedFn","csc"],hypcosecant:["NamedFn","csch"],arccosecant:["NamedFn","arccsc"],acosecant:["NamedFn","acsc"],secant:["NamedFn","sec"],hypsecant:["NamedFn","sech"],arcsecant:["NamedFn","arcsec"],asecant:["NamedFn","asec"],cotangent:["NamedFn","cot"],hypcotangent:["NamedFn","coth"],arccotangent:["NamedFn","arccot"],acotangent:["NamedFn","acot"],exponential:["NamedFn","exp"],logarithm:["NamedFn","log"],naturallogarithm:["NamedFn","ln"],determinant:["NamedFn","det"],Probability:["NamedFn","Pr"]},wi.default);new f3.CommandMap("Physics-quick-quad-macros",{qqtext:"Qqtext",qq:"Qqtext",qcomma:["Macro","\\qqtext*{,}"],qc:["Macro","\\qqtext*{,}"],qcc:["Qqtext","c.c."],qif:["Qqtext","if"],qthen:["Qqtext","then"],qelse:["Qqtext","else"],qotherwise:["Qqtext","otherwise"],qunless:["Qqtext","unless"],qgiven:["Qqtext","given"],qusing:["Qqtext","using"],qassume:["Qqtext","assume"],qsince:["Qqtext","since"],qlet:["Qqtext","let"],qfor:["Qqtext","for"],qall:["Qqtext","all"],qeven:["Qqtext","even"],qodd:["Qqtext","odd"],qinteger:["Qqtext","integer"],qand:["Qqtext","and"],qor:["Qqtext","or"],qas:["Qqtext","as"],qin:["Qqtext","in"]},wi.default);new f3.CommandMap("Physics-derivative-macros",{diffd:"DiffD",flatfrac:["Macro","\\left.#1\\middle/#2\\right.",2],differential:["Differential","\\diffd"],dd:["Differential","\\diffd"],variation:["Differential","\\delta"],var:["Differential","\\delta"],derivative:["Derivative",2,"\\diffd"],dv:["Derivative",2,"\\diffd"],partialderivative:["Derivative",3,"\\partial"],pderivative:["Derivative",3,"\\partial"],pdv:["Derivative",3,"\\partial"],functionalderivative:["Derivative",2,"\\delta"],fderivative:["Derivative",2,"\\delta"],fdv:["Derivative",2,"\\delta"]},wi.default);new f3.CommandMap("Physics-bra-ket-macros",{bra:"Bra",ket:"Ket",innerproduct:"BraKet",ip:"BraKet",braket:"BraKet",outerproduct:"KetBra",dyad:"KetBra",ketbra:"KetBra",op:"KetBra",expectationvalue:"Expectation",expval:"Expectation",ev:"Expectation",matrixelement:"MatrixElement",matrixel:"MatrixElement",mel:"MatrixElement"},wi.default);new f3.CommandMap("Physics-matrix-macros",{matrixquantity:"MatrixQuantity",mqty:"MatrixQuantity",pmqty:["Macro","\\mqty(#1)",1],Pmqty:["Macro","\\mqty*(#1)",1],bmqty:["Macro","\\mqty[#1]",1],vmqty:["Macro","\\mqty|#1|",1],smallmatrixquantity:["MatrixQuantity",!0],smqty:["MatrixQuantity",!0],spmqty:["Macro","\\smqty(#1)",1],sPmqty:["Macro","\\smqty*(#1)",1],sbmqty:["Macro","\\smqty[#1]",1],svmqty:["Macro","\\smqty|#1|",1],matrixdeterminant:["Macro","\\vmqty{#1}",1],mdet:["Macro","\\vmqty{#1}",1],smdet:["Macro","\\svmqty{#1}",1],identitymatrix:"IdentityMatrix",imat:"IdentityMatrix",xmatrix:"XMatrix",xmat:"XMatrix",zeromatrix:["Macro","\\xmat{0}{#1}{#2}",2],zmat:["Macro","\\xmat{0}{#1}{#2}",2],paulimatrix:"PauliMatrix",pmat:"PauliMatrix",diagonalmatrix:"DiagonalMatrix",dmat:"DiagonalMatrix",antidiagonalmatrix:["DiagonalMatrix",!0],admat:["DiagonalMatrix",!0]},wi.default);new f3.EnvironmentMap("Physics-aux-envs",af.default.environment,{smallmatrix:["Array",null,null,null,"c","0.333em",".2em","S",1]},wi.default);new f3.MacroMap("Physics-characters",{"|":["AutoClose",SB.TEXCLASS.ORD],")":"AutoClose","]":"AutoClose"},wi.default);var $9;Object.defineProperty(tf,"__esModule",{value:!0});tf.PhysicsConfiguration=void 0;var EB=he,Hg=U7;tf.PhysicsConfiguration=EB.Configuration.create("physics",{handler:{macro:["Physics-automatic-bracing-macros","Physics-vector-macros","Physics-vector-mo","Physics-vector-mi","Physics-derivative-macros","Physics-expressions-macros","Physics-quick-quad-macros","Physics-bra-ket-macros","Physics-matrix-macros"],character:["Physics-characters"],environment:["Physics-aux-envs"]},items:($9={},$9[Hg.AutoOpen.prototype.kind]=Hg.AutoOpen,$9),options:{physics:{italicdiff:!1,arrowdel:!1}}});var AB={};(function(r){var t=_&&_.__values||function(d){var p=typeof Symbol=="function"&&Symbol.iterator,m=p&&d[p],y=0;if(m)return m.call(d);if(d&&typeof d.length=="number")return{next:function(){return d&&y>=d.length&&(d=void 0),{value:d&&d[y++],done:!d}}};throw new TypeError(p?"Object is not iterable.":"Symbol.iterator is not defined.")},e=_&&_.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(r,"__esModule",{value:!0}),r.SetOptionsConfiguration=r.SetOptionsUtil=void 0;var n=he,s=Gt,a=e(Le),o=e(Ue()),l=s3,u=e(p2),h=H1;r.SetOptionsUtil={filterPackage:function(d,p){if(p!=="tex"&&!n.ConfigurationHandler.get(p))throw new a.default("NotAPackage","Not a defined package: %1",p);var m=d.options.setoptions,y=m.allowOptions[p];if(y===void 0&&!m.allowPackageDefault||y===!1)throw new a.default("PackageNotSettable",`Options can't be set for package "%1"`,p);return!0},filterOption:function(d,p,m){var y,c=d.options.setoptions,Q=c.allowOptions[p]||{},g=Q.hasOwnProperty(m)&&!(0,h.isObject)(Q[m])?Q[m]:null;if(g===!1||g===null&&!c.allowOptionsDefault)throw new a.default("OptionNotSettable",'Option "%1" is not allowed to be set',m);if(!(!((y=p==="tex"?d.options:d.options[p])===null||y===void 0)&&y.hasOwnProperty(m)))throw p==="tex"?new a.default("InvalidTexOption",'Invalid TeX option "%1"',m):new a.default("InvalidOptionKey",'Invalid option "%1" for package "%2"',m,p);return!0},filterValue:function(d,p,m,y){return y}};var T=new s.CommandMap("setoptions",{setOptions:"SetOptions"},{SetOptions:function(d,p){var m,y,c=d.GetBrackets(p)||"tex",Q=o.default.keyvalOptions(d.GetArgument(p)),g=d.options.setoptions;if(g.filterPackage(d,c))try{for(var v=t(Object.keys(Q)),L=v.next();!L.done;L=v.next()){var x=L.value;g.filterOption(d,c,x)&&((c==="tex"?d.options:d.options[c])[x]=g.filterValue(d,c,x,Q[x]))}}catch(b){m={error:b}}finally{try{L&&!L.done&&(y=v.return)&&y.call(v)}finally{if(m)throw m.error}}}});function f(d,p){var m=p.parseOptions.handlers.get("macro").lookup("require");m&&(T.add("Require",new l.Macro("Require",m._func)),T.add("require",new l.Macro("require",u.default.Macro,["\\Require{#2}\\setOptions[#2]{#1}",2,""])))}r.SetOptionsConfiguration=n.Configuration.create("setoptions",{handler:{macro:["setoptions"]},config:f,priority:3,options:{setoptions:{filterPackage:r.SetOptionsUtil.filterPackage,filterOption:r.SetOptionsUtil.filterOption,filterValue:r.SetOptionsUtil.filterValue,allowPackageDefault:!0,allowOptionsDefault:!0,allowOptions:(0,h.expandable)({tex:{FindTeX:!1,formatError:!1,package:!1,baseURL:!1,tags:!1,maxBuffer:!1,maxMaxros:!1,macros:!1,environments:!1},setoptions:!1,autoload:!1,require:!1,configmacros:!1,tagformat:!1})}}})})(AB);var F5={},HB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();Object.defineProperty(F5,"__esModule",{value:!0});F5.TagFormatConfiguration=F5.tagformatConfig=void 0;var MB=he,Y9=Hi,Mg=0;function z_(r,t){var e=t.parseOptions.options.tags;e!=="base"&&r.tags.hasOwnProperty(e)&&Y9.TagsFactory.add(e,r.tags[e]);var n=Y9.TagsFactory.create(t.parseOptions.options.tags).constructor,s=function(o){HB(l,o);function l(){return o!==null&&o.apply(this,arguments)||this}return l.prototype.formatNumber=function(u){return t.parseOptions.options.tagformat.number(u)},l.prototype.formatTag=function(u){return t.parseOptions.options.tagformat.tag(u)},l.prototype.formatId=function(u){return t.parseOptions.options.tagformat.id(u)},l.prototype.formatUrl=function(u,h){return t.parseOptions.options.tagformat.url(u,h)},l}(n);Mg++;var a="configTags-"+Mg;Y9.TagsFactory.add(a,s),t.parseOptions.options.tags=a}F5.tagformatConfig=z_;F5.TagFormatConfiguration=MB.Configuration.create("tagformat",{config:[z_,10],options:{tagformat:{number:function(r){return r.toString()},tag:function(r){return"("+r+")"},id:function(r){return"mjx-eqn:"+r.replace(/\s/g,"_")},url:function(r,t){return t+"#"+encodeURIComponent(r)}}}});var of={},e6={},W_=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e6,"__esModule",{value:!0});e6.TextMacrosMethods=void 0;var wB=W_(e2()),CB=fr,V4=W_(p2);e6.TextMacrosMethods={Comment:function(r,t){for(;r.i<r.string.length&&r.string.charAt(r.i)!==`
155
+ `;)r.i++;r.i++},Math:function(r,t){r.saveText();for(var e=r.i,n,s,a=0;s=r.GetNext();)switch(n=r.i++,s){case"\\":var o=r.GetCS();o===")"&&(s="\\(");case"$":if(a===0&&t===s){var l=r.texParser.configuration,u=new wB.default(r.string.substr(e,n-e),r.stack.env,l).mml();r.PushMath(u);return}break;case"{":a++;break;case"}":a===0&&r.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace"),a--;break}r.Error("MathNotTerminated","Math-mode is not properly terminated")},MathModeOnly:function(r,t){r.Error("MathModeOnly","'%1' allowed only in math mode",t)},Misplaced:function(r,t){r.Error("Misplaced","'%1' can not be used here",t)},OpenBrace:function(r,t){var e=r.stack.env;r.envStack.push(e),r.stack.env=Object.assign({},e)},CloseBrace:function(r,t){r.envStack.length?(r.saveText(),r.stack.env=r.envStack.pop()):r.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace")},OpenQuote:function(r,t){r.string.charAt(r.i)===t?(r.text+="“",r.i++):r.text+="‘"},CloseQuote:function(r,t){r.string.charAt(r.i)===t?(r.text+="”",r.i++):r.text+="’"},Tilde:function(r,t){r.text+=" "},Space:function(r,t){for(r.text+=" ";r.GetNext().match(/\s/);)r.i++},SelfQuote:function(r,t){r.text+=t.substr(1)},Insert:function(r,t,e){r.text+=e},Accent:function(r,t,e){var n=r.ParseArg(t),s=r.create("token","mo",{},e);r.addAttributes(s),r.Push(r.create("node","mover",[n,s]))},Emph:function(r,t){var e=r.stack.env.mathvariant==="-tex-mathit"?"normal":"-tex-mathit";r.Push(r.ParseTextArg(t,{mathvariant:e}))},SetFont:function(r,t,e){r.saveText(),r.stack.env.mathvariant=e},SetSize:function(r,t,e){r.saveText(),r.stack.env.mathsize=e},CheckAutoload:function(r,t){var e=r.configuration.packageData.get("autoload"),n=r.texParser;t=t.slice(1);var s=n.lookup("macro",t);if(!s||e&&s._func===e.Autoload){if(n.parse("macro",[n,t]),!s)return;(0,CB.retryAfter)(Promise.resolve())}n.parse("macro",[r,t])},Macro:V4.default.Macro,Spacer:V4.default.Spacer,Hskip:V4.default.Hskip,rule:V4.default.rule,Rule:V4.default.Rule,HandleRef:V4.default.HandleRef};var D0={},DB=_&&_.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),wg=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},OB=_&&_.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],o;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){o={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return a},IB=_&&_.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},j7=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(D0,"__esModule",{value:!0});D0.TextParser=void 0;var VB=j7(e2()),Cg=j7(Le),PB=j7(Ue()),kB=jt,Dg=j7(Ne),Og=Nt,RB=function(r){DB(t,r);function t(e,n,s,a){var o=r.call(this,e,n,s)||this;return o.level=a,o}return Object.defineProperty(t.prototype,"texParser",{get:function(){return this.configuration.packageData.get("textmacros").texParser},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tags",{get:function(){return this.texParser.tags},enumerable:!1,configurable:!0}),t.prototype.mml=function(){return this.level!=null?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):this.nodes.length===1?this.nodes[0]:this.create("node","mrow",this.nodes)},t.prototype.Parse=function(){this.text="",this.nodes=[],this.envStack=[],r.prototype.Parse.call(this)},t.prototype.saveText=function(){if(this.text){var e=this.stack.env.mathvariant,n=PB.default.internalText(this,this.text,e?{mathvariant:e}:{});this.text="",this.Push(n)}},t.prototype.Push=function(e){if(this.text&&this.saveText(),e instanceof Og.StopItem)return r.prototype.Push.call(this,e);if(e instanceof Og.StyleItem){this.stack.env.mathcolor=this.stack.env.color;return}e instanceof kB.AbstractMmlNode&&(this.addAttributes(e),this.nodes.push(e))},t.prototype.PushMath=function(e){var n,s,a=this.stack.env;e.isKind("TeXAtom")||(e=this.create("node","TeXAtom",[e]));try{for(var o=wg(["mathsize","mathcolor"]),l=o.next();!l.done;l=o.next()){var u=l.value;a[u]&&!e.attributes.getExplicit(u)&&(!e.isToken&&!e.isKind("mstyle")&&(e=this.create("node","mstyle",[e])),Dg.default.setAttribute(e,u,a[u]))}}catch(h){n={error:h}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}e.isInferred&&(e=this.create("node","mrow",e.childNodes)),this.nodes.push(e)},t.prototype.addAttributes=function(e){var n,s,a=this.stack.env;if(e.isToken)try{for(var o=wg(["mathsize","mathcolor","mathvariant"]),l=o.next();!l.done;l=o.next()){var u=l.value;a[u]&&!e.attributes.getExplicit(u)&&Dg.default.setAttribute(e,u,a[u])}}catch(h){n={error:h}}finally{try{l&&!l.done&&(s=o.return)&&s.call(o)}finally{if(n)throw n.error}}},t.prototype.ParseTextArg=function(e,n){var s=this.GetArgument(e);return n=Object.assign(Object.assign({},this.stack.env),n),new t(s,n,this.configuration).mml()},t.prototype.ParseArg=function(e){return new t(this.GetArgument(e),this.stack.env,this.configuration).mml()},t.prototype.Error=function(e,n){for(var s=[],a=2;a<arguments.length;a++)s[a-2]=arguments[a];throw new(Cg.default.bind.apply(Cg.default,IB([void 0,e,n],OB(s),!1)))},t}(VB.default);D0.TextParser=RB;var BB=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},FB=Gt,V2=q1,NB=e6,UB=BB(Ue()),jB=D0;new FB.CommandMap("textcomp-macros",{textasciicircum:["Insert","^"],textasciitilde:["Insert","~"],textasteriskcentered:["Insert","*"],textbackslash:["Insert","\\"],textbar:["Insert","|"],textbraceleft:["Insert","{"],textbraceright:["Insert","}"],textbullet:["Insert","•"],textdagger:["Insert","†"],textdaggerdbl:["Insert","‡"],textellipsis:["Insert","…"],textemdash:["Insert","—"],textendash:["Insert","–"],textexclamdown:["Insert","¡"],textgreater:["Insert",">"],textless:["Insert","<"],textordfeminine:["Insert","ª"],textordmasculine:["Insert","º"],textparagraph:["Insert","¶"],textperiodcentered:["Insert","·"],textquestiondown:["Insert","¿"],textquotedblleft:["Insert","“"],textquotedblright:["Insert","”"],textquoteleft:["Insert","‘"],textquoteright:["Insert","’"],textsection:["Insert","§"],textunderscore:["Insert","_"],textvisiblespace:["Insert","␣"],textacutedbl:["Insert","˝"],textasciiacute:["Insert","´"],textasciibreve:["Insert","˘"],textasciicaron:["Insert","ˇ"],textasciidieresis:["Insert","¨"],textasciimacron:["Insert","¯"],textgravedbl:["Insert","˵"],texttildelow:["Insert","˷"],textbaht:["Insert","฿"],textcent:["Insert","¢"],textcolonmonetary:["Insert","₡"],textcurrency:["Insert","¤"],textdollar:["Insert","$"],textdong:["Insert","₫"],texteuro:["Insert","€"],textflorin:["Insert","ƒ"],textguarani:["Insert","₲"],textlira:["Insert","₤"],textnaira:["Insert","₦"],textpeso:["Insert","₱"],textsterling:["Insert","£"],textwon:["Insert","₩"],textyen:["Insert","¥"],textcircledP:["Insert","℗"],textcompwordmark:["Insert","‌"],textcopyleft:["Insert","🄯"],textcopyright:["Insert","©"],textregistered:["Insert","®"],textservicemark:["Insert","℠"],texttrademark:["Insert","™"],textbardbl:["Insert","‖"],textbigcircle:["Insert","◯"],textblank:["Insert","␢"],textbrokenbar:["Insert","¦"],textdiscount:["Insert","⁒"],textestimated:["Insert","℮"],textinterrobang:["Insert","‽"],textinterrobangdown:["Insert","⸘"],textmusicalnote:["Insert","♪"],textnumero:["Insert","№"],textopenbullet:["Insert","◦"],textpertenthousand:["Insert","‱"],textperthousand:["Insert","‰"],textrecipe:["Insert","℞"],textreferencemark:["Insert","※"],textlangle:["Insert","〈"],textrangle:["Insert","〉"],textlbrackdbl:["Insert","⟦"],textrbrackdbl:["Insert","⟧"],textlquill:["Insert","⁅"],textrquill:["Insert","⁆"],textcelsius:["Insert","℃"],textdegree:["Insert","°"],textdiv:["Insert","÷"],textdownarrow:["Insert","↓"],textfractionsolidus:["Insert","⁄"],textleftarrow:["Insert","←"],textlnot:["Insert","¬"],textmho:["Insert","℧"],textminus:["Insert","−"],textmu:["Insert","µ"],textohm:["Insert","Ω"],textonehalf:["Insert","½"],textonequarter:["Insert","¼"],textonesuperior:["Insert","¹"],textpm:["Insert","±"],textrightarrow:["Insert","→"],textsurd:["Insert","√"],textthreequarters:["Insert","¾"],textthreesuperior:["Insert","³"],texttimes:["Insert","×"],texttwosuperior:["Insert","²"],textuparrow:["Insert","↑"],textborn:["Insert","*"],textdied:["Insert","†"],textdivorced:["Insert","⚮"],textmarried:["Insert","⚭"],textcentoldstyle:["Insert","¢",V2.TexConstant.Variant.OLDSTYLE],textdollaroldstyle:["Insert","$",V2.TexConstant.Variant.OLDSTYLE],textzerooldstyle:["Insert","0",V2.TexConstant.Variant.OLDSTYLE],textoneoldstyle:["Insert","1",V2.TexConstant.Variant.OLDSTYLE],texttwooldstyle:["Insert","2",V2.TexConstant.Variant.OLDSTYLE],textthreeoldstyle:["Insert","3",V2.TexConstant.Variant.OLDSTYLE],textfouroldstyle:["Insert","4",V2.TexConstant.Variant.OLDSTYLE],textfiveoldstyle:["Insert","5",V2.TexConstant.Variant.OLDSTYLE],textsixoldstyle:["Insert","6",V2.TexConstant.Variant.OLDSTYLE],textsevenoldstyle:["Insert","7",V2.TexConstant.Variant.OLDSTYLE],texteightoldstyle:["Insert","8",V2.TexConstant.Variant.OLDSTYLE],textnineoldstyle:["Insert","9",V2.TexConstant.Variant.OLDSTYLE]},{Insert:function(r,t,e,n){if(r instanceof jB.TextParser){if(!n){NB.TextMacrosMethods.Insert(r,t,e);return}r.saveText()}r.Push(UB.default.internalText(r,e,n?{mathvariant:n}:{}))}});Object.defineProperty(of,"__esModule",{value:!0});of.TextcompConfiguration=void 0;var GB=he;of.TextcompConfiguration=GB.Configuration.create("textcomp",{handler:{macro:["textcomp-macros"]}});var N5={},q_=Gt,L3=q1,Z_=e6,Cr=G3;new q_.MacroMap("text-special",{$:"Math","%":"Comment","^":"MathModeOnly",_:"MathModeOnly","&":"Misplaced","#":"Misplaced","~":"Tilde"," ":"Space"," ":"Space","\r":"Space","\n":"Space"," ":"Tilde","{":"OpenBrace","}":"CloseBrace","`":"OpenQuote","'":"CloseQuote"},Z_.TextMacrosMethods);new q_.CommandMap("text-macros",{"(":"Math",$:"SelfQuote",_:"SelfQuote","%":"SelfQuote","{":"SelfQuote","}":"SelfQuote"," ":"SelfQuote","&":"SelfQuote","#":"SelfQuote","\\":"SelfQuote","'":["Accent","´"],"’":["Accent","´"],"`":["Accent","`"],"‘":["Accent","`"],"^":["Accent","^"],'"':["Accent","¨"],"~":["Accent","~"],"=":["Accent","¯"],".":["Accent","˙"],u:["Accent","˘"],v:["Accent","ˇ"],emph:"Emph",rm:["SetFont",L3.TexConstant.Variant.NORMAL],mit:["SetFont",L3.TexConstant.Variant.ITALIC],oldstyle:["SetFont",L3.TexConstant.Variant.OLDSTYLE],cal:["SetFont",L3.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",L3.TexConstant.Variant.BOLD],bbFont:["SetFont",L3.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",L3.TexConstant.Variant.SCRIPT],frak:["SetFont",L3.TexConstant.Variant.FRAKTUR],sf:["SetFont",L3.TexConstant.Variant.SANSSERIF],tt:["SetFont",L3.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],Bbb:["Macro","{\\bbFont #1}",1],textnormal:["Macro","{\\rm #1}",1],textup:["Macro","{\\rm #1}",1],textrm:["Macro","{\\rm #1}",1],textit:["Macro","{\\it #1}",1],textbf:["Macro","{\\bf #1}",1],textsf:["Macro","{\\sf #1}",1],texttt:["Macro","{\\tt #1}",1],dagger:["Insert","†"],ddagger:["Insert","‡"],S:["Insert","§"],",":["Spacer",Cr.MATHSPACE.thinmathspace],":":["Spacer",Cr.MATHSPACE.mediummathspace],">":["Spacer",Cr.MATHSPACE.mediummathspace],";":["Spacer",Cr.MATHSPACE.thickmathspace],"!":["Spacer",Cr.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",Cr.MATHSPACE.thinmathspace],negthinspace:["Spacer",Cr.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],color:"CheckAutoload",textcolor:"CheckAutoload",colorbox:"CheckAutoload",fcolorbox:"CheckAutoload",href:"CheckAutoload",style:"CheckAutoload",class:"CheckAutoload",cssId:"CheckAutoload",unicode:"CheckAutoload",ref:["HandleRef",!1],eqref:["HandleRef",!0]},Z_.TextMacrosMethods);var zB=_&&_.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},P4;Object.defineProperty(N5,"__esModule",{value:!0});N5.TextMacrosConfiguration=N5.TextBaseConfiguration=void 0;var ih=he,WB=zB(S7),Ig=Hi,ki=Nt,Vg=D0,qB=e6;N5.TextBaseConfiguration=ih.Configuration.create("text-base",{parser:"text",handler:{character:["command","text-special"],macro:["text-macros"]},fallback:{character:function(r,t){r.text+=t},macro:function(r,t){var e=r.texParser,n=e.lookup("macro",t);n&&n._func!==qB.TextMacrosMethods.Macro&&r.Error("MathMacro","%1 is only supported in math mode","\\"+t),e.parse("macro",[r,t])}},items:(P4={},P4[ki.StartItem.prototype.kind]=ki.StartItem,P4[ki.StopItem.prototype.kind]=ki.StopItem,P4[ki.MmlItem.prototype.kind]=ki.MmlItem,P4[ki.StyleItem.prototype.kind]=ki.StyleItem,P4)});function ZB(r,t,e,n){var s=r.configuration.packageData.get("textmacros");return r instanceof Vg.TextParser||(s.texParser=r),[new Vg.TextParser(t,n?{mathvariant:n}:{},s.parseOptions,e).mml()]}N5.TextMacrosConfiguration=ih.Configuration.create("textmacros",{config:function(r,t){var e=new ih.ParserConfiguration(t.parseOptions.options.textmacros.packages,["tex","text"]);e.init();var n=new WB.default(e,[]);n.options=t.parseOptions.options,e.config(t),Ig.TagsFactory.addTags(e.tags),n.tags=Ig.TagsFactory.getDefault(),n.tags.configuration=n,n.packageData=t.parseOptions.packageData,n.packageData.set("textmacros",{parseOptions:n,jax:t,texParser:null}),n.options.internalMath=ZB},preprocessors:[function(r){var t=r.data.packageData.get("textmacros");t.parseOptions.nodeFactory.setMmlFactory(t.jax.mmlFactory)}],options:{textmacros:{packages:["text-base"]}}});var lf={};Object.defineProperty(lf,"__esModule",{value:!0});lf.UpgreekConfiguration=void 0;var KB=he,XB=Gt,$B=q1;function YB(r,t){var e=t.attributes||{};e.mathvariant=$B.TexConstant.Variant.NORMAL;var n=r.create("token","mi",e,t.char);r.Push(n)}new XB.CharacterMap("upgreek",YB,{upalpha:"α",upbeta:"β",upgamma:"γ",updelta:"δ",upepsilon:"ϵ",upzeta:"ζ",upeta:"η",uptheta:"θ",upiota:"ι",upkappa:"κ",uplambda:"λ",upmu:"μ",upnu:"ν",upxi:"ξ",upomicron:"ο",uppi:"π",uprho:"ρ",upsigma:"σ",uptau:"τ",upupsilon:"υ",upphi:"ϕ",upchi:"χ",uppsi:"ψ",upomega:"ω",upvarepsilon:"ε",upvartheta:"ϑ",upvarpi:"ϖ",upvarrho:"ϱ",upvarsigma:"ς",upvarphi:"φ",Upgamma:"Γ",Updelta:"Δ",Uptheta:"Θ",Uplambda:"Λ",Upxi:"Ξ",Uppi:"Π",Upsigma:"Σ",Upupsilon:"Υ",Upphi:"Φ",Uppsi:"Ψ",Upomega:"Ω"});lf.UpgreekConfiguration=KB.Configuration.create("upgreek",{handler:{macro:["upgreek"]}});var JB={};(function(r){var t=_&&_.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeConfiguration=r.UnicodeMethods=void 0;var e=he,n=t(Le),s=Gt,a=t(Ue()),o=t(Ne),l=zn;r.UnicodeMethods={};var u={};r.UnicodeMethods.Unicode=function(h,T){var f=h.GetBrackets(T),d=null,p=null;f&&(f.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)?(d=f.replace(/ /g,"").split(/,/),p=h.GetBrackets(T)):p=f);var m=a.default.trimSpaces(h.GetArgument(T)).replace(/^0x/,"x");if(!m.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/))throw new n.default("BadUnicode","Argument to \\unicode must be a number");var y=parseInt(m.match(/^x/)?"0"+m:m);u[y]?p||(p=u[y][2]):u[y]=[800,200,p,y],d&&(u[y][0]=Math.floor(parseFloat(d[0])*1e3),u[y][1]=Math.floor(parseFloat(d[1])*1e3));var c=h.stack.env.font,Q={};p?(u[y][2]=Q.fontfamily=p.replace(/'/g,"'"),c&&(c.match(/bold/)&&(Q.fontweight="bold"),c.match(/italic|-mathit/)&&(Q.fontstyle="italic"))):c&&(Q.mathvariant=c);var g=h.create("token","mtext",Q,(0,l.numeric)(m));o.default.setProperty(g,"unicode",!0),h.Push(g)},new s.CommandMap("unicode",{unicode:"Unicode"},r.UnicodeMethods),r.UnicodeConfiguration=e.Configuration.create("unicode",{handler:{macro:["unicode"]}})})(JB);var tF={};(function(r){var t=_&&_.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.VerbConfiguration=r.VerbMethods=void 0;var e=he,n=q1,s=Gt,a=t(Le);r.VerbMethods={},r.VerbMethods.Verb=function(o,l){var u=o.GetNext(),h=++o.i;if(u==="")throw new a.default("MissingArgFor","Missing argument for %1",l);for(;o.i<o.string.length&&o.string.charAt(o.i)!==u;)o.i++;if(o.i===o.string.length)throw new a.default("NoClosingDelim","Can't find closing delimiter for %1",o.currentCS);var T=o.string.slice(h,o.i).replace(/ /g," ");o.i++,o.Push(o.create("token","mtext",{mathvariant:n.TexConstant.Variant.MONOSPACE},T))},new s.CommandMap("verb",{verb:"Verb"},r.VerbMethods),r.VerbConfiguration=e.Configuration.create("verb",{handler:{macro:["verb"]}})})(tF);Object.defineProperty(DT,"__esModule",{value:!0});var K_=DT.AllPackages=void 0;R_();typeof MathJax<"u"&&MathJax.loader&&MathJax.loader.preLoad("[tex]/action","[tex]/ams","[tex]/amscd","[tex]/bbox","[tex]/boldsymbol","[tex]/braket","[tex]/bussproofs","[tex]/cancel","[tex]/cases","[tex]/centernot","[tex]/color","[tex]/colorv2","[tex]/colortbl","[tex]/empheq","[tex]/enclose","[tex]/extpfeil","[tex]/gensymb","[tex]/html","[tex]/mathtools","[tex]/mhchem","[tex]/newcommand","[tex]/noerrors","[tex]/noundefined","[tex]/physics","[tex]/upgreek","[tex]/unicode","[tex]/verb","[tex]/configmacros","[tex]/tagformat","[tex]/textcomp","[tex]/textmacros","[tex]/setoptions");K_=DT.AllPackages=["base","action","ams","amscd","bbox","boldsymbol","braket","bussproofs","cancel","cases","centernot","color","colortbl","empheq","enclose","extpfeil","gensymb","html","mathtools","mhchem","newcommand","noerrors","noundefined","upgreek","unicode","verb","configmacros","tagformat","textcomp","textmacros"];var J9={},G7={},z7={},Ns=_&&_.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(z7,"__esModule",{value:!0});z7.CssStyles=void 0;var eF=function(){function r(t){t===void 0&&(t=null),this.styles={},this.addStyles(t)}return Object.defineProperty(r.prototype,"cssText",{get:function(){return this.getStyleString()},enumerable:!1,configurable:!0}),r.prototype.addStyles=function(t){var e,n;if(t)try{for(var s=Ns(Object.keys(t)),a=s.next();!a.done;a=s.next()){var o=a.value;this.styles[o]||(this.styles[o]={}),Object.assign(this.styles[o],t[o])}}catch(l){e={error:l}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},r.prototype.removeStyles=function(){for(var t,e,n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];try{for(var a=Ns(n),o=a.next();!o.done;o=a.next()){var l=o.value;delete this.styles[l]}}catch(u){t={error:u}}finally{try{o&&!o.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}},r.prototype.clear=function(){this.styles={}},r.prototype.getStyleString=function(){return this.getStyleRules().join(`
156
156
 
157
157
  `)},r.prototype.getStyleRules=function(){var t,e,n=Object.keys(this.styles),s=new Array(n.length),a=0;try{for(var o=Ns(n),l=o.next();!l.done;l=o.next()){var u=l.value;s[a++]=u+` {
158
158
  `+this.getStyleDefString(this.styles[u])+`
@@ -225,7 +225,7 @@ Schedule: ${u.map(y=>X2(y))} pos: ${this.timelinePos}`),T.length&&this.log(`Remo
225
225
  `){h<l?(p+=`
226
226
  `,L+1<y.length&&T.push(y.slice(L+1))):T.push(y.slice(L)),d=!0;break}}f!==-1&&(p+=x),x===`
227
227
  `?(u++,h=0):h++}f===-1&&T.push(m)}if(f===-1){f=T.length+1;const m=s-u,y=m>0?a:a-h;T.push(`
228
- `.repeat(m)+" ".repeat(y),"")}return T[f]=p,[T,f]}var Ah=class extends ur{constructor(r,t,e){super(r,Yr,t),this.highlighter=e,this.progress=M2(0),Object.defineProperty(this.invokable,"edit",{value:this.edit.bind(this)}),Object.defineProperty(this.invokable,"append",{value:this.append.bind(this)}),Object.defineProperty(this.invokable,"prepend",{value:this.prepend.bind(this)}),Object.defineProperty(this.invokable,"insert",{value:this.insert.bind(this)}),Object.defineProperty(this.invokable,"remove",{value:this.remove.bind(this)}),Object.defineProperty(this.invokable,"replace",{value:this.replace.bind(this)})}*tweener(r,t,e){let n=_K;const s=x1(this.highlighter);s&&(yield(async()=>{do await n1.consumePromises(),s.initialize();while(n1.hasPromises())})(),n=a=>s.tokenize(a)),this.progress(0),this.set({progress:this.progress,fragments:fK(this.get(),this.parse(x1(r)),n)}),yield*this.progress(1,t,e),this.set(r)}edit(r=.6){return(t,...e)=>this.editTween(Du(t,...e),r)}append(r=.6,t){if(typeof r=="string")if(t===void 0){const n=this.get();return this.set({progress:0,fragments:[...n.fragments,r]})}else return this.appendTween(r,t);const e=r;return(n,...s)=>this.append(v5(Du(n,...s),!0),e)}prepend(r=.6,t){if(typeof r=="string")if(t===void 0){const n=this.get();return this.set({progress:0,fragments:[r,...n.fragments]})}else return this.prependTween(r,t);const e=r;return(n,...s)=>this.prepend(v5(Du(n,...s),!0),e)}insert(r,t,e){return this.replace([r,r],t,e)}remove(r,t){return this.replace(r,"",t)}replace(r,t,e){if(e===void 0){const n=this.get(),[s,a]=Yy(r,n.fragments);return s[a]=t,this.set({progress:n.progress,fragments:s})}else return this.replaceTween(r,t,e)}*replaceTween(r,t,e){let n=this.get();const[s,a]=Yy(r,n.fragments),o=M2(0),l={progress:o,fragments:[aK(s[a],t)]};s[a]=l,this.set({progress:n.progress,fragments:s}),yield*o(1,e),n=this.get(),this.set({progress:n.progress,fragments:n.fragments.map(u=>u===l?t:u)}),o.context.dispose()}*editTween(r,t){this.progress(0),this.set({progress:this.progress,fragments:r}),yield*this.progress(1,t);const e=this.get();this.set({progress:0,fragments:e.fragments.map(n=>r.includes(n)?v5(n,!0):n)})}*appendTween(r,t){let e=this.get();const n=M2(0),s={progress:n,fragments:[Zy(r)]};this.set({progress:e.progress,fragments:[...e.fragments,s]}),yield*n(1,t),e=this.get(),this.set({progress:e.progress,fragments:e.fragments.map(a=>a===s?r:a)}),n.context.dispose()}*prependTween(r,t){let e=this.get();const n=M2(0),s={progress:n,fragments:[Zy(r)]};this.set({progress:e.progress,fragments:[s,...e.fragments]}),yield*n(1,t),e=this.get(),this.set({progress:e.progress,fragments:e.fragments.map(a=>a===s?r:a)}),n.context.dispose()}parse(r){return oK(r)}toSignal(){return this.invokable}};function bK(){return(r,t)=>{const e=Tl(r,t);i6(r,n=>{n[t]=new Ah(e.default??[],n).toSignal()})}}uT.define([{tag:lt.keyword,color:"#5e81ac"},{tag:[lt.name,lt.deleted,lt.character,lt.propertyName,lt.macroName],color:"#88c0d0"},{tag:[lt.variableName],color:"#8fbcbb"},{tag:[lt.function(lt.variableName)],color:"#8fbcbb"},{tag:[lt.labelName],color:"#81a1c1"},{tag:[lt.color,lt.constant(lt.name),lt.standard(lt.name)],color:"#5e81ac"},{tag:[lt.definition(lt.name),lt.separator],color:"#a3be8c"},{tag:[lt.brace],color:"#8fbcbb"},{tag:[lt.annotation],color:"#d30102"},{tag:[lt.number,lt.changed,lt.annotation,lt.modifier,lt.self,lt.namespace],color:"#b48ead"},{tag:[lt.typeName,lt.className],color:"#ECEFF4"},{tag:[lt.operator,lt.operatorKeyword],color:"#a3be8c"},{tag:[lt.tagName],color:"#b48ead"},{tag:[lt.squareBracket],color:"#ECEFF4"},{tag:[lt.angleBracket],color:"#ECEFF4"},{tag:[lt.attributeName],color:"#eceff4"},{tag:[lt.regexp],color:"#5e81ac"},{tag:[lt.quote],color:"#b48ead"},{tag:[lt.string],color:"#a3be8c"},{tag:lt.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[lt.url,lt.escape,lt.special(lt.string)],color:"#8fbcbb"},{tag:[lt.meta],color:"#88c0d0"},{tag:[lt.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[lt.comment],color:"#4c566a",fontStyle:"italic"},{tag:lt.strong,fontWeight:"bold",color:"#5e81ac"},{tag:lt.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:lt.strikethrough,textDecoration:"line-through"},{tag:lt.heading,fontWeight:"bold",color:"#5e81ac"},{tag:lt.special(lt.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:lt.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[lt.heading2,lt.heading3,lt.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[lt.heading5,lt.heading6],color:"#5e81ac"},{tag:[lt.atom,lt.bool,lt.special(lt.variableName)],color:"#d08770"},{tag:[lt.processingInstruction,lt.inserted],color:"#8fbcbb"},{tag:[lt.contentSeparator],color:"#ebcb8b"},{tag:lt.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}]);var fl=class{},zS=class extends fl{constructor(r,t,e,n,s){super(),this.center=r,this.radius=t,this.from=e,this.to=n,this.counter=s,this.angle=Math.acos(pe(-1,1,e.dot(n))),this.length=Math.abs(this.angle*t);const a=new Z(1,1).scale(t);this.points=[r.sub(a),r.add(a)]}get arcLength(){return this.length}draw(r,t,e){const n=this.counter?-1:1,s=this.from.radians+t*this.angle*n,a=this.to.radians-(1-e)*this.angle*n;Math.abs(this.angle)>1e-4&&r.arc(this.center.x,this.center.y,this.radius,s,a,this.counter);const o=Z.fromRadians(s),l=Z.fromRadians(a);return[{position:this.center.add(o.scale(this.radius)),tangent:this.counter?o:o.flipped,normal:this.counter?o.flipped:o},{position:this.center.add(l.scale(this.radius)),tangent:this.counter?l.flipped:l,normal:this.counter?l.flipped:l}]}getPoint(r){const t=this.counter?-1:1,e=this.from.radians+r*this.angle*t,n=Z.fromRadians(e);return{position:this.center.add(n.scale(this.radius)),tangent:this.counter?n:n.flipped,normal:this.counter?n:n.flipped}}},Y6=class A3{constructor(t,e,n,s){this.c0=t,this.c1=e??0,this.c2=n??0,this.c3=s??0}static constant(t){return new A3(t)}static linear(t,e){return new A3(t,e)}static quadratic(t,e,n){return new A3(t,e,n)}static cubic(t,e,n,s){return new A3(t,e,n,s)}get degree(){return this.c3!==0?3:this.c2!==0?2:this.c1!==0?1:0}differentiate(t=1){switch(t){case 0:return this;case 1:return new A3(this.c1,2*this.c2,3*this.c3,0);case 2:return new A3(2*this.c2,6*this.c3,0,0);case 3:return new A3(6*this.c3,0,0,0);default:throw new Error("Unsupported derivative")}}eval(t,e=0){return e!==0?this.differentiate(e).eval(t):this.c3*(t*t*t)+this.c2*(t*t)+this.c1*t+this.c0}split(t){const e=1-t,n=new A3(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),s=new A3(this.eval(0),e*this.differentiate(1).eval(t),e*e/2*this.differentiate(2).eval(t),e*e*e/6*this.differentiate(3).eval(t));return[n,s]}roots(){switch(this.degree){case 3:return this.solveCubicRoots();case 2:return this.solveQuadraticRoots();case 1:return this.solveLinearRoot();case 0:return[];default:throw new Error(`Unsupported polynomial degree: ${this.degree}`)}}localExtrema(){return this.differentiate().roots()}localExtrema01(){const t=this.localExtrema(),e=[];for(let n=0;n<t.length;n++){const s=t[n];s>=0&&s<=1&&e.push(t[n])}return e}outputRange01(){let t=[this.eval(0),this.eval(1)];const e=n=>{t[1]>t[0]?t=[Math.min(t[0],n),Math.max(t[1],n)]:t=[Math.min(t[1],n),Math.max(t[0],n)]};return this.localExtrema01().forEach(n=>e(this.eval(n))),t}solveCubicRoots(){const t=this.c0,e=this.c1,n=this.c2,s=this.c3,a=t*t,o=t*n,l=e*e,u=(3*o-l)/(3*a),h=(2*l*e-9*o*e+27*a*s)/(27*a*t),T=this.solveDepressedCubicRoots(u,h),f=d=>d-e/(3*t);switch(T.length){case 1:return[f(T[0])];case 2:return[f(T[0]),f(T[1])];case 3:return[f(T[0]),f(T[1]),f(T[2])];default:return[]}}solveDepressedCubicRoots(t,e){if(this.almostZero(t))return[Math.cbrt(-e)];const n=Math.PI*2,s=4*t*t*t+27*e*e;if(s<1e-5){const a=2*Math.sqrt(-t/3),o=3*e/(2*t)*Math.sqrt(-3/t),l=u=>a*Math.cos(1/3*Math.acos(pe(-1,1,o))-n/3*u);return o>=.9999?[l(0),l(2)]:o<=-.9999?[l(1),l(2)]:[l(0),l(1),l(2)]}if(s>0&&t<0){const a=.3333333333333333*Math.acosh(-3*Math.abs(e)/(2*t)*Math.sqrt(-3/t));return[-2*Math.sign(e)*Math.sqrt(-t/3)*Math.cosh(a)]}if(t>0){const a=.3333333333333333*Math.asinh(3*e/(2*t)*Math.sqrt(3/t));return[-2*Math.sqrt(t/3)*Math.sinh(a)]}return[]}solveQuadraticRoots(){const t=this.c2,e=this.c1,n=this.c0,s=e*e-4*t*n;if(this.almostZero(s))return[-e/(2*t)];if(s>=0){const a=Math.sqrt(s),o=(-e-a)/(2*t),l=(-e+a)/(2*t);return[Math.min(o,l),Math.max(o,l)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}},WS=class ba{constructor(t,e,n,s){this.c0=t,this.c1=e,this.c2=n,this.c3=s,t instanceof Y6?(this.x=t,this.y=e):s!==void 0?(this.x=new Y6(t.x,e.x,n.x,s.x),this.y=new Y6(t.y,e.y,n.y,s.y)):(this.x=new Y6(t.x,e.x,n.x),this.y=new Y6(t.y,e.y,n.y))}eval(t,e=0){return new Z(this.x.differentiate(e).eval(t),this.y.differentiate(e).eval(t))}split(t){const[e,n]=this.x.split(t),[s,a]=this.y.split(t);return[new ba(e,s),new ba(n,a)]}differentiate(t=1){return new ba(this.x.differentiate(t),this.y.differentiate(t))}evalDerivative(t){return this.differentiate().eval(t)}getBounds(){const t=this.x.outputRange01(),e=this.y.outputRange01();return ue.fromPoints(new Z(Math.min(...t),Math.max(...e)),new Z(Math.max(...t),Math.min(...e)))}},SK=class{constructor(r,t=20){this.curve=r,this.sampledDistances=[],this.resample(t)}resample(r){this.sampledDistances=[0];let t=0,e=this.curve.eval(0).position;for(let n=1;n<r;n++){const s=n/(r-1),a=this.curve.eval(s),o=e.sub(a.position).magnitude;t+=o,this.sampledDistances.push(t),e=a.position}this.sampledDistances[this.sampledDistances.length-1]=this.curve.arcLength}pointAtDistance(r){return this.curve.eval(this.distanceToT(r))}distanceToT(r){const t=this.sampledDistances.length;r=pe(0,this.curve.arcLength,r);for(let e=0;e<t;e++){const n=this.sampledDistances[e],s=this.sampledDistances[e+1];if(r>=n&&r<=s)return $v(n,s,e/(t-1),(e+1)/(t-1),r)}return 1}},qS=class extends fl{constructor(r,t){super(),this.curve=r,this.length=t,this.pointSampler=new SK(this)}get arcLength(){return this.length}getBBox(){return this.curve.getBounds()}eval(r){const t=this.tangent(r);return{position:this.curve.eval(r),tangent:t,normal:t.perpendicular}}getPoint(r){const t=this.pointSampler.pointAtDistance(this.arcLength*r);return{position:t.position,tangent:t.tangent,normal:t.tangent.perpendicular}}transformPoints(r){return this.points.map(t=>Q1(t,r))}tangent(r){return this.curve.evalDerivative(r).normalized}draw(r,t=0,e=1,n=!0){let s=null,a=t,o=e,l=this.points;if(t!==0||e!==1){const T=this.length*t,f=this.length*e;a=this.pointSampler.distanceToT(T),o=this.pointSampler.distanceToT(f);const d=(o-a)/(1-a),[,p]=this.split(a);[s]=p.split(d),l=s.points}n&&L1(r,l[0]),(s??this).doDraw(r);const u=this.tangent(a),h=this.tangent(o);return[{position:l[0],tangent:u,normal:u.perpendicular},{position:l.at(-1),tangent:h,normal:h.perpendicular}]}},ZS=class Z4 extends qS{constructor(t,e,n,s){super(new WS(t,t.flipped.add(e).scale(3),t.scale(3).sub(e.scale(6)).add(n.scale(3)),t.flipped.add(e.scale(3)).sub(n.scale(3)).add(s)),Z4.getLength(t,e,n,s)),this.p0=t,this.p1=e,this.p2=n,this.p3=s}get points(){return[this.p0,this.p1,this.p2,this.p3]}split(t){const e=new Z(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),n=new Z(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),s=new Z(this.p2.x+(this.p3.x-this.p2.x)*t,this.p2.y+(this.p3.y-this.p2.y)*t),a=new Z(e.x+(n.x-e.x)*t,e.y+(n.y-e.y)*t),o=new Z(n.x+(s.x-n.x)*t,n.y+(s.y-n.y)*t),l=new Z(a.x+(o.x-a.x)*t,a.y+(o.y-a.y)*t),u=new Z4(this.p0,e,a,l),h=new Z4(l,o,s,this.p3);return[u,h]}doDraw(t){Ff(t,this.p1,this.p2,this.p3)}static getLength(t,e,n,s){return Z4.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${n.x} ${n.y} ${s.x} ${s.y}`),Z4.el.getTotalLength()}};k([jn(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],ZS,"el",2);var _i=ZS,s2=class extends fl{constructor(r,t){super(),this.from=r,this.to=t,this.vector=t.sub(r),this.length=this.vector.magnitude,this.normal=this.vector.perpendicular.normalized.safe,this.points=[r,t]}get arcLength(){return this.length}draw(r,t=0,e=1,n=!1){const s=this.from.add(this.vector.scale(t)),a=this.from.add(this.vector.scale(e));return n&&L1(r,s),V1(r,a),[{position:s,tangent:this.normal.flipped,normal:this.normal},{position:a,tangent:this.normal,normal:this.normal}]}getPoint(r){return{position:this.from.add(this.vector.scale(r)),tangent:this.normal.flipped,normal:this.normal}}};function EK(r,t,e,n){const s={arcLength:0,segments:[],minSin:1},a=tr(t.top,t.right,t.left,r),o=tr(t.right,t.top,t.bottom,r),l=tr(t.bottom,t.left,t.right,r),u=tr(t.left,t.bottom,t.top,r);let h=new Z(r.left+a,r.top),T=new Z(r.right-o,r.top);return J4(s,new s2(h,T)),h=new Z(r.right,r.top+o),T=new Z(r.right,r.bottom-l),o>0&&oa(s,h.addX(-o),o,Z.down,Z.right,e,n),J4(s,new s2(h,T)),h=new Z(r.right-l,r.bottom),T=new Z(r.left+u,r.bottom),l>0&&oa(s,h.addY(-l),l,Z.right,Z.up,e,n),J4(s,new s2(h,T)),h=new Z(r.left,r.bottom-u),T=new Z(r.left,r.top+a),u>0&&oa(s,h.addX(u),u,Z.up,Z.left,e,n),J4(s,new s2(h,T)),h=new Z(r.left+a,r.top),a>0&&oa(s,h.addY(a),a,Z.left,Z.down,e,n),s}function J4(r,t){r.segments.push(t),r.arcLength+=t.arcLength}function oa(r,t,e,n,s,a,o){const l=t.add(n.scale(e)),u=t.add(s.scale(e));a?J4(r,new _i(l,l.add(s.scale(o*e)),u.add(n.scale(o*e)),u)):J4(r,new zS(t,e,n,s,!1))}function Ql(r){return(t,e)=>{Bf({top:r?`${r}Top`:"top",right:r?`${r}Right`:"right",bottom:r?`${r}Bottom`:"bottom",left:r?`${r}Left`:"left"})(t,e),v4(oL)(t,e)}}function Hh(r,t){const e=pe(0,r.arcLength,t);let n=0;for(const s of r.segments){const a=n;if(n+=s.arcLength,n>=e){const o=(e-a)/s.arcLength;return s.getPoint(pe(0,1,o))}}return{position:Z.zero,tangent:Z.up,normal:Z.up}}function AK(r){let t;return r?typeof r=="string"?t=[{fragment:r}]:Array.isArray(r)?t=r.map(e=>typeof e=="string"?{fragment:e}:e):t=[r]:t=[],!S5().experimentalFeatures&&t.length>0&&(t=[],ce().log({...Jv("Node uses experimental shaders."),inspect:this.key})),t}function Sa(){return S5()}var Xt=class{constructor({children:r,spawner:t,key:e,...n}){this.compositeOverride=M2(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=M2(null),this.properties=BS(this);const s=Sa();[this.key,this.unregister]=s.registerNode(this,e),this.view2D=s.getView(),this.creationStack=new Error().stack,kf(this,n),t&&ce().warn({message:"Node.spawner() has been deprecated.",remarks:"Use <code>Node.children()</code> instead.",inspect:this.key,stack:new Error().stack}),this.children(t??r)}get x(){return this.position.x}get y(){return this.position.y}getAbsolutePosition(){const r=this.localToWorld();return new Z(r.m41,r.m42)}setAbsolutePosition(r){this.position(en(r,t=>Q1(new Z(t),this.worldToParent())))}getAbsoluteRotation(){const r=this.localToWorld();return Z.degrees(r.m11,r.m12)}setAbsoluteRotation(r){this.rotation(en(r,t=>EM(t,this.worldToParent())))}getAbsoluteScale(){const r=this.localToWorld();return new Z(Z.magnitude(r.m11,r.m12),Z.magnitude(r.m21,r.m22))}setAbsoluteScale(r){this.scale(en(r,t=>this.getRelativeScale(new Z(t))))}getRelativeScale(r){var e;const t=((e=this.parent())==null?void 0:e.absoluteScale())??Z.one;return r.div(t)}*tweenCompositeOperation(r,t,e){const n=x1(r);n==="source-over"?(yield*this.compositeOverride(1,t,e),this.compositeOverride(0),this.compositeOperation(n)):(this.compositeOperation(n),this.compositeOverride(1),yield*this.compositeOverride(0,t,e))}absoluteOpacity(){var r;return(((r=this.parent())==null?void 0:r.absoluteOpacity())??1)*this.opacity()}hasFilters(){return!!this.filters().find(r=>r.isActive())}hasShadow(){return!!this.shadowColor()&&(this.shadowBlur()>0||this.shadowOffset.x()!==0||this.shadowOffset.y()!==0)}filterString(){let r="";const t=this.compositeToWorld();for(const e of this.filters())e.isActive()&&(r+=" "+e.serialize(t));return r}getSpawner(){return this.children()}setSpawner(r){this.children(r)}setChildren(r){if(this.children.context.raw()!==r){if(this.children.context.setter(r),!F2(r))this.spawnChildren(!1,r);else if(!this.hasSpawnedChildren)for(const t of this.realChildren)t.parent(null)}}getChildren(){return this.children.context.getter(),this.spawnedChildren()}spawnedChildren(){const r=this.children.context.getter();return F2(this.children.context.raw())&&this.spawnChildren(!0,r),this.realChildren}sortedChildren(){return[...this.children()].sort((r,t)=>Math.sign(r.zIndex()-t.zIndex()))}localToWorld(){const r=this.parent();return r?r.localToWorld().multiply(this.localToParent()):this.localToParent()}worldToLocal(){return this.localToWorld().inverse()}worldToParent(){var r;return((r=this.parent())==null?void 0:r.worldToLocal())??new DOMMatrix}localToParent(){const r=new DOMMatrix;return r.translateSelf(this.x(),this.y()),r.rotateSelf(0,0,this.rotation()),r.scaleSelf(this.scale.x(),this.scale.y()),r.skewXSelf(this.skew.x()),r.skewYSelf(this.skew.y()),r}compositeToWorld(){var r;return((r=this.compositeRoot())==null?void 0:r.localToWorld())??new DOMMatrix}compositeRoot(){var r;return this.composite()?this:((r=this.parent())==null?void 0:r.compositeRoot())??null}compositeToLocal(){const r=this.compositeRoot();if(r){const t=this.worldToLocal();return t.m44=1,r.localToWorld().multiply(t)}return new DOMMatrix}view(){return this.view2D}add(r){return this.insert(r,1/0)}insert(r,t=0){const e=Array.isArray(r)?r:[r];if(e.length===0)return this;const n=this.children(),s=n.slice(0,t);for(const a of e)a instanceof Xt&&(s.push(a),a.remove(),a.parent(this));return s.push(...n.slice(t)),this.setParsedChildren(s),this}remove(){const r=this.parent();return r===null?this:(r.removeChild(this),this.parent(null),this)}move(r=1){const t=this.parent();if(r===0||!t)return this;const e=t.children(),n=[];if(r>0)for(let s=0;s<e.length;s++){const a=e[s];if(a===this){const o=s+r;for(;s<o&&s+1<e.length;s++)n[s]=e[s+1]}n[s]=a}else for(let s=e.length-1;s>=0;s--){const a=e[s];if(a===this){const o=s+r;for(;s>o&&s>0;s--)n[s]=e[s-1]}n[s]=a}return t.setParsedChildren(n),this}moveUp(){return this.move(1)}moveDown(){return this.move(-1)}moveToTop(){return this.move(1/0)}moveToBottom(){return this.move(-1/0)}moveTo(r){const t=this.parent();if(!t)return this;const e=t.children().indexOf(this),n=r-e;return this.move(n)}moveBelow(r,t=!1){const e=this.parent();if(!e)return this;if(r.parent()!==e)return ce().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const n=e.children(),s=n.indexOf(this),a=n.indexOf(r);if(!t&&s<a)return this;const o=a-s-1;return this.move(o)}moveAbove(r,t=!1){const e=this.parent();if(!e)return this;if(r.parent()!==e)return ce().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const n=e.children(),s=n.indexOf(this),a=n.indexOf(r);if(!t&&s>a)return this;const o=a-s+1;return this.move(o)}reparent(r){const t=this.absolutePosition(),e=this.absoluteRotation(),n=this.absoluteScale();r.add(this),this.absolutePosition(t),this.absoluteRotation(e),this.absoluteScale(n)}removeChildren(){for(const r of this.realChildren)r.parent(null);this.setParsedChildren([])}peekChildren(){return this.realChildren}findAll(r){const t=[],e=this.reversedChildren();for(;e.length>0;){const n=e.pop();r(n)&&t.push(n);const s=n.children();for(let a=s.length-1;a>=0;a--)e.push(s[a])}return t}findFirst(r){const t=this.reversedChildren();for(;t.length>0;){const e=t.pop();if(r(e))return e;const n=e.children();for(let s=n.length-1;s>=0;s--)t.push(n[s])}return null}findLast(r){const t=[],e=this.reversedChildren();for(;e.length>0;){const n=e.pop();t.push(n);const s=n.children();for(let a=s.length-1;a>=0;a--)e.push(s[a])}for(;t.length>0;){const n=t.pop();if(r(n))return n}return null}findAncestor(r){let t=this.parent();for(;t;){if(r(t))return t;t=t.parent()}return null}childAs(r){return this.children()[r]??null}childrenAs(){return this.children()}parentAs(){return this.parent()??null}dispose(){if(this.unregister){this.stateStack=[],this.unregister(),this.unregister=null;for(const{signal:r}of this)r==null||r.context.dispose();for(const r of this.realChildren)r.dispose()}}clone(r={}){const t={...r};F2(this.children.context.raw())?t.children??(t.children=this.children.context.raw()):this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.clone())));for(const{key:e,meta:n,signal:s}of this)if(!(!n.cloneable||e in t))if(n.compound)for(const[a,o]of n.compoundEntries){if(o in t)continue;const l=s[a];l.context.isInitial()||(t[o]=l.context.raw())}else s.context.isInitial()||(t[e]=s.context.raw());return this.instantiate(t)}snapshotClone(r={}){const t={...this.getState(),...r};return this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.snapshotClone()))),this.instantiate(t)}reactiveClone(r={}){const t={...r};this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.reactiveClone())));for(const{key:e,meta:n,signal:s}of this)!n.cloneable||e in t||(t[e]=()=>s());return this.instantiate(t)}instantiate(r={}){return new this.constructor(r)}setParsedChildren(r){this.children.context.setter(r),this.realChildren=r}spawnChildren(r,t){const e=this.parseChildren(t),n=new Set;for(const s of e){const a=s.parent.context.raw();a&&a!==this&&a.removeChild(s),n.add(s.key),s.parent(this)}for(const s of this.realChildren)n.has(s.key)||s.parent(null);this.hasSpawnedChildren=r,this.realChildren=e}parseChildren(r){const t=[],e=Array.isArray(r)?r:[r];for(const n of e)n instanceof Xt&&t.push(n);return t}removeChild(r){this.setParsedChildren(this.children().filter(t=>t!==r))}requiresCache(){return this.cache()||this.opacity()<1||this.compositeOperation()!=="source-over"||this.hasFilters()||this.hasShadow()||this.shaders().length>0}cacheCanvas(){const r=document.createElement("canvas").getContext("2d");if(!r)throw new Error("Could not create a cache canvas");return r}async cachedCanvas(){const r=this.cacheCanvas(),t=this.worldSpaceCacheBBox(),e=this.localToWorld();return r.canvas.width=t.width,r.canvas.height=t.height,r.setTransform(e.a,e.b,e.c,e.d,e.e-t.x,e.f-t.y),await this.draw(r),r}getCacheBBox(){return new ue}cacheBBox(){const r=this.getCacheBBox(),t=this.children(),e=this.cachePadding();if(t.length===0)return r.addSpacing(e);const n=r.corners;for(const a of t){const o=a.fullCacheBBox(),l=a.localToParent();n.push(...o.corners.map(u=>Q1(u,l)))}return ue.fromPoints(...n).addSpacing(e)}fullCacheBBox(){const r=this.compositeToLocal(),t=hi(this.shadowOffset(),r),e=Wu(this.shadowBlur(),r),n=this.cacheBBox().expand(this.filters.blur()*2+e);return t.x<0?(n.x+=t.x,n.width-=t.x):n.width+=t.x,t.y<0?(n.y+=t.y,n.height-=t.y):n.height+=t.y,n}worldSpaceCacheBBox(){const r=ue.fromSizeCentered(this.view().size()),t=ue.fromPoints(...r.transformCorners(this.view().localToWorld())),e=ue.fromPoints(...this.cacheBBox().transformCorners(this.localToWorld())).pixelPerfect.expand(2);return t.intersection(e)}parentWorldSpaceCacheBBox(){var r;return((r=this.findAncestor(t=>t.requiresCache()))==null?void 0:r.worldSpaceCacheBBox())??new ue(Z.zero,Sa().getSize())}setupDrawFromCache(r){if(r.globalCompositeOperation=this.compositeOperation(),r.globalAlpha*=this.opacity(),this.hasFilters()&&(r.filter=this.filterString()),this.hasShadow()){const e=this.compositeToWorld(),n=hi(this.shadowOffset(),e),s=Wu(this.shadowBlur(),e);r.shadowColor=this.shadowColor().serialize(),r.shadowBlur=s,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y}const t=this.worldToLocal();r.transform(t.a,t.b,t.c,t.d,t.e,t.f)}renderFromSource(r,t,e,n){this.setupDrawFromCache(r);const s=this.compositeOverride();r.drawImage(t,e,n),s>0&&(r.save(),r.globalAlpha*=s,r.globalCompositeOperation="source-over",r.drawImage(t,e,n),r.restore())}shaderCanvas(r,t){var T,f;const e=this.shaders();if(e.length===0)return null;const n=Sa(),s=n.getRealSize(),a=this.parentWorldSpaceCacheBBox(),o=new DOMMatrix().scaleSelf(s.width/a.width,s.height/-a.height).translateSelf(a.x/-s.width,a.y/s.height-1),l=this.worldSpaceCacheBBox(),u=new DOMMatrix().scaleSelf(s.width/l.width,s.height/-l.height).translateSelf(l.x/-s.width,l.y/s.height-1).invertSelf(),h=n.shaders.getGL();n.shaders.copyTextures(r,t),n.shaders.clear();for(const d of e){const p=n.shaders.getProgram(d.fragment);if(p){if(d.uniforms)for(const[m,y]of Object.entries(d.uniforms)){const c=h.getUniformLocation(p,m);if(c===null)continue;const Q=x1(y);typeof Q=="number"?h.uniform1f(c,Q):"toUniform"in Q?Q.toUniform(h,c):Q.length===1?h.uniform1f(c,Q[0]):Q.length===2?h.uniform2f(c,Q[0],Q[1]):Q.length===3?h.uniform3f(c,Q[0],Q[1],Q[2]):Q.length===4&&h.uniform4f(c,Q[0],Q[1],Q[2],Q[3])}h.uniform1f(h.getUniformLocation(p,UQ),this.view2D.globalTime()),h.uniform1i(h.getUniformLocation(p,UQ),n.playback.frame),h.uniformMatrix4fv(h.getUniformLocation(p,BM),!1,u.toFloat32Array()),h.uniformMatrix4fv(h.getUniformLocation(p,FM),!1,o.toFloat32Array()),(T=d.setup)==null||T.call(d,h,p),n.shaders.render(),(f=d.teardown)==null||f.call(d,h,p)}}return h.canvas}async render(r){if(!(this.absoluteOpacity()<=0)){if(r.save(),this.transformContext(r),this.requiresCache()){const t=this.worldSpaceCacheBBox();if(t.width!==0&&t.height!==0){const e=(await this.cachedCanvas()).canvas,n=this.shaderCanvas(r.canvas,e);n?this.renderFromSource(r,n,0,0):this.renderFromSource(r,e,t.position.x,t.position.y)}}else await this.draw(r);r.restore()}}async draw(r){await this.drawChildren(r)}async drawChildren(r){for(const t of this.sortedChildren())await t.render(r)}drawOverlay(r,t){const e=this.cacheBBox().transformCorners(t),n=this.getCacheBBox().transformCorners(t);r.strokeStyle="white",r.lineWidth=1,r.beginPath(),A2(r,e),r.closePath(),r.stroke(),r.strokeStyle="blue",r.beginPath(),A2(r,n),r.closePath(),r.stroke()}transformContext(r){const t=this.localToParent();r.transform(t.a,t.b,t.c,t.d,t.e,t.f)}hit(r){let t=null;const e=Q1(r,this.localToParent().inverse()),n=this.children();for(let s=n.length-1;s>=0&&(t=n[s].hit(e),!t);s--);return t}collectAsyncResources(){for(const r of this.children())r.collectAsyncResources()}async toPromise(){do await n1.consumePromises(),this.collectAsyncResources();while(n1.hasPromises());return this}getState(){const r={};for(const{key:t,meta:e,signal:n}of this)!e.cloneable||t in r||(r[t]=n());return r}applyState(r,t,e=E5){if(t===void 0)for(const s in r){const a=this.signalByKey(s);a&&a(r[s])}const n=[];for(const s in r){const a=this.signalByKey(s);r[s]!==a.context.raw()&&n.push(a(r[s],t,e))}return xe(...n)}save(){this.stateStack.push(this.getState())}restore(r,t=E5){const e=this.stateStack.pop();if(e!==void 0)return this.applyState(e,r,t)}*[Symbol.iterator](){for(const r in this.properties){const t=this.properties[r],e=this.signalByKey(r);yield{meta:t,signal:e,key:r}}}signalByKey(r){return this[r]}reversedChildren(){const r=this.children(),t=[];for(let e=r.length-1;e>=0;e--)t.push(r[e]);return t}};k([M1()],Xt.prototype,"position",2);k([v4(Z),L4(!1),ot()],Xt.prototype,"absolutePosition",2);k([dt(0),ot()],Xt.prototype,"rotation",2);k([L4(!1),ot()],Xt.prototype,"absoluteRotation",2);k([dt(Z.one),M1("scale")],Xt.prototype,"scale",2);k([dt(Z.zero),M1("skew")],Xt.prototype,"skew",2);k([v4(Z),L4(!1),ot()],Xt.prototype,"absoluteScale",2);k([dt(0),ot()],Xt.prototype,"zIndex",2);k([dt(!1),ot()],Xt.prototype,"cache",2);k([Ql("cachePadding")],Xt.prototype,"cachePadding",2);k([dt(!1),ot()],Xt.prototype,"composite",2);k([dt("source-over"),ot()],Xt.prototype,"compositeOperation",2);k([t1()],Xt.prototype,"tweenCompositeOperation",1);k([dt(1),O0(r=>pe(0,1,r)),ot()],Xt.prototype,"opacity",2);k([vt()],Xt.prototype,"absoluteOpacity",1);k([vK()],Xt.prototype,"filters",2);k([dt("#0000"),GS()],Xt.prototype,"shadowColor",2);k([dt(0),ot()],Xt.prototype,"shadowBlur",2);k([M1("shadowOffset")],Xt.prototype,"shadowOffset",2);k([dt([]),O0(AK),ot()],Xt.prototype,"shaders",2);k([vt()],Xt.prototype,"hasFilters",1);k([vt()],Xt.prototype,"hasShadow",1);k([vt()],Xt.prototype,"filterString",1);k([FS(!1),L4(!1),ot()],Xt.prototype,"spawner",2);k([FS(!1),L4(!1),ot()],Xt.prototype,"children",2);k([vt()],Xt.prototype,"spawnedChildren",1);k([vt()],Xt.prototype,"sortedChildren",1);k([vt()],Xt.prototype,"localToWorld",1);k([vt()],Xt.prototype,"worldToLocal",1);k([vt()],Xt.prototype,"worldToParent",1);k([vt()],Xt.prototype,"localToParent",1);k([vt()],Xt.prototype,"compositeToWorld",1);k([vt()],Xt.prototype,"compositeRoot",1);k([vt()],Xt.prototype,"compositeToLocal",1);k([vt()],Xt.prototype,"cacheCanvas",1);k([vt()],Xt.prototype,"cachedCanvas",1);k([vt()],Xt.prototype,"cacheBBox",1);k([vt()],Xt.prototype,"fullCacheBBox",1);k([vt()],Xt.prototype,"worldSpaceCacheBBox",1);k([vt()],Xt.prototype,"parentWorldSpaceCacheBBox",1);Xt=k([k1("Node")],Xt);Xt.prototype.isClass=!0;var Ht=class extends Xt{get columnGap(){return this.gap.x}get rowGap(){return this.gap.y}getX(){return this.isLayoutRoot()?this.x.context.getter():this.computedPosition().x}setX(r){this.x.context.setter(r)}getY(){return this.isLayoutRoot()?this.y.context.getter():this.computedPosition().y}setY(r){this.y.context.setter(r)}get width(){return this.size.x}get height(){return this.size.y}getWidth(){return this.computedSize().width}setWidth(r){this.width.context.setter(r)}*tweenWidth(r,t,e,n){const s=this.desiredSize().x,a=typeof s!="number"||typeof r!="number";let o;a?o=this.size.x():o=s;let l;a?(this.size.x(r),l=this.size.x()):l=r,this.size.x(o),a&&this.lockSize(),yield*rr(t,u=>this.size.x(n(o,l,e(u)))),this.size.x(r),a&&this.releaseSize()}getHeight(){return this.computedSize().height}setHeight(r){this.height.context.setter(r)}*tweenHeight(r,t,e,n){const s=this.desiredSize().y,a=typeof s!="number"||typeof r!="number";let o;a?o=this.size.y():o=s;let l;a?(this.size.y(r),l=this.size.y()):l=r,this.size.y(o),a&&this.lockSize(),yield*rr(t,u=>this.size.y(n(o,l,e(u)))),this.size.y(r),a&&this.releaseSize()}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}*tweenSize(r,t,e,n){const s=this.desiredSize();let a;typeof s.x!="number"||typeof s.y!="number"?a=this.size():a=new Z(s);let o;typeof r=="object"&&typeof r.x=="number"&&typeof r.y=="number"?o=new Z(r):(this.size(r),o=this.size()),this.size(a),this.lockSize(),yield*rr(t,l=>this.size(n(a,o,e(l)))),this.releaseSize(),this.size(r)}constructor(r){super(r),this.element.dataset.motionCanvasKey=this.key}lockSize(){this.sizeLockCounter(this.sizeLockCounter()+1)}releaseSize(){this.sizeLockCounter(this.sizeLockCounter()-1)}parentTransform(){return this.findAncestor(US(Ht))}anchorPosition(){const r=this.computedSize(),t=this.offset();return r.scale(.5).mul(t)}layoutEnabled(){var r;return this.layout()??((r=this.parentTransform())==null?void 0:r.layoutEnabled())??!1}isLayoutRoot(){var r;return!this.layoutEnabled()||!((r=this.parentTransform())!=null&&r.layoutEnabled())}localToParent(){const r=super.localToParent(),t=this.offset();if(!t.exactlyEquals(Z.zero)){const e=this.size().mul(t).scale(-.5);r.translateSelf(e.x,e.y)}return r}scalingRotationMatrix(){const r=new DOMMatrix;r.rotateSelf(0,0,this.rotation()),r.scaleSelf(this.scale.x(),this.scale.y());const t=this.offset();if(!t.exactlyEquals(Z.zero)){const e=this.size().mul(t).scale(-.5);r.translateSelf(e.x,e.y)}return r}getComputedLayout(){return new ue(this.element.getBoundingClientRect())}computedPosition(){this.requestLayoutUpdate();const r=this.getComputedLayout(),t=new Z(r.x+r.width/2*this.offset.x(),r.y+r.height/2*this.offset.y()),e=this.parentTransform();if(e){const n=e.getComputedLayout();t.x-=n.x+(n.width-r.width)/2,t.y-=n.y+(n.height-r.height)/2}return t}computedSize(){return this.requestLayoutUpdate(),this.getComputedLayout().size}requestLayoutUpdate(){const r=this.parentTransform();this.appendedToView()?(r==null||r.requestFontUpdate(),this.updateLayout()):r.requestLayoutUpdate()}appendedToView(){const r=this.isLayoutRoot();return r&&this.view().element.append(this.element),r}updateLayout(){if(this.applyFont(),this.applyFlex(),this.layoutEnabled()){const r=this.layoutChildren();for(const t of r)t.updateLayout()}}layoutChildren(){const r=[...this.children()],t=[],e=[];for(;r.length;){const n=r.shift();n instanceof Ht?n.layoutEnabled()&&(t.push(n),e.push(n.element)):n&&r.unshift(...n.children())}return this.element.replaceChildren(...e),t}requestFontUpdate(){var r;this.appendedToView(),(r=this.parentTransform())==null||r.requestFontUpdate(),this.applyFont()}getCacheBBox(){return ue.fromSizeCentered(this.computedSize())}async draw(r){var t;if(await((t=document.fonts)==null?void 0:t.ready),this.clip()){const e=this.computedSize();if(e.width===0||e.height===0)return;r.beginPath(),r.rect(e.width/-2,e.height/-2,e.width,e.height),r.closePath(),r.clip()}await this.drawChildren(r)}drawOverlay(r,t){const e=this.computedSize(),n=e.mul(this.offset()).scale(.5),s=Q1(n,t),a=ue.fromSizeCentered(e),o=a.transformCorners(t),l=a.addSpacing(this.padding().scale(-1)).transformCorners(t),u=a.addSpacing(this.margin()).transformCorners(t);r.beginPath(),A2(r,u),A2(r,o),r.closePath(),r.fillStyle="rgba(255,193,125,0.6)",r.fill("evenodd"),r.beginPath(),A2(r,o),A2(r,l),r.closePath(),r.fillStyle="rgba(180,255,147,0.6)",r.fill("evenodd"),r.beginPath(),A2(r,o),r.closePath(),r.lineWidth=1,r.strokeStyle="white",r.stroke(),r.beginPath(),r6(r,s),r.stroke()}getOriginDelta(r){const t=this.computedSize().scale(.5),e=this.offset().mul(t);return r===c3.Middle?e.flipped:AM(r).mul(t).sub(e)}moveOffset(r){const t=this.computedSize().scale(.5),e=this.offset().mul(t),n=r.mul(t);this.offset(r),this.position(this.position().add(n).sub(e))}parsePixels(r){return r===null?"":`${r}px`}parseLength(r){return r===null?"":typeof r=="string"?r:`${r}px`}applyFlex(){this.element.style.position=this.isLayoutRoot()?"absolute":"relative";const r=this.desiredSize();this.element.style.width=this.parseLength(r.x),this.element.style.height=this.parseLength(r.y),this.element.style.maxWidth=this.parseLength(this.maxWidth()),this.element.style.minWidth=this.parseLength(this.minWidth()),this.element.style.maxHeight=this.parseLength(this.maxHeight()),this.element.style.minHeight=this.parseLength(this.minHeight()),this.element.style.aspectRatio=this.ratio()===null?"":this.ratio().toString(),this.element.style.marginTop=this.parsePixels(this.margin.top()),this.element.style.marginBottom=this.parsePixels(this.margin.bottom()),this.element.style.marginLeft=this.parsePixels(this.margin.left()),this.element.style.marginRight=this.parsePixels(this.margin.right()),this.element.style.paddingTop=this.parsePixels(this.padding.top()),this.element.style.paddingBottom=this.parsePixels(this.padding.bottom()),this.element.style.paddingLeft=this.parsePixels(this.padding.left()),this.element.style.paddingRight=this.parsePixels(this.padding.right()),this.element.style.flexDirection=this.direction(),this.element.style.flexBasis=this.parseLength(this.basis()),this.element.style.flexWrap=this.wrap(),this.element.style.justifyContent=this.justifyContent(),this.element.style.alignContent=this.alignContent(),this.element.style.alignItems=this.alignItems(),this.element.style.alignSelf=this.alignSelf(),this.element.style.columnGap=this.parseLength(this.gap.x()),this.element.style.rowGap=this.parseLength(this.gap.y()),this.sizeLockCounter()>0?(this.element.style.flexGrow="0",this.element.style.flexShrink="0"):(this.element.style.flexGrow=this.grow().toString(),this.element.style.flexShrink=this.shrink().toString())}applyFont(){if((document.fonts?Array.from(document.fonts).filter(e=>e.status==="loading"):[]).length>0&&n1.collectPromise((async()=>{var e;await((e=document.fonts)==null?void 0:e.ready)})()),this.element.style.fontFamily=this.fontFamily.isInitial()?"":this.fontFamily(),this.element.style.fontSize=this.fontSize.isInitial()?"":`${this.fontSize()}px`,this.element.style.fontStyle=this.fontStyle.isInitial()?"":this.fontStyle(),this.lineHeight.isInitial())this.element.style.lineHeight="";else{const e=this.lineHeight();this.element.style.lineHeight=typeof e=="string"?(parseFloat(e)/100).toString():`${e}px`}if(this.element.style.fontWeight=this.fontWeight.isInitial()?"":this.fontWeight().toString(),this.element.style.letterSpacing=this.letterSpacing.isInitial()?"":`${this.letterSpacing()}px`,this.element.style.textAlign=this.textAlign.isInitial()?"":this.textAlign(),this.textWrap.isInitial()){this.element.style.whiteSpace="";return}const t=this.textWrap();if(typeof t=="boolean"){this.element.style.whiteSpace=t?"normal":"nowrap";return}if(t==="pre"){this.element.style.whiteSpace=t;return}if(t==="balance"){this.element.style.whiteSpace="normal",this.element.style.textWrap=t;return}}dispose(){var r;super.dispose(),(r=this.sizeLockCounter)==null||r.context.dispose(),this.element&&(this.element.remove(),this.element.innerHTML=""),this.element=null,this.styles=null}hit(r){const t=Q1(r,this.localToParent().inverse());return this.cacheBBox().includes(t)?super.hit(r)??this:null}};k([dt(null),Rf(VH),ot()],Ht.prototype,"layout",2);k([dt(null),ot()],Ht.prototype,"maxWidth",2);k([dt(null),ot()],Ht.prototype,"maxHeight",2);k([dt(null),ot()],Ht.prototype,"minWidth",2);k([dt(null),ot()],Ht.prototype,"minHeight",2);k([dt(null),ot()],Ht.prototype,"ratio",2);k([Ql("margin")],Ht.prototype,"margin",2);k([Ql("padding")],Ht.prototype,"padding",2);k([dt("row"),ot()],Ht.prototype,"direction",2);k([dt(null),ot()],Ht.prototype,"basis",2);k([dt(0),ot()],Ht.prototype,"grow",2);k([dt(1),ot()],Ht.prototype,"shrink",2);k([dt("nowrap"),ot()],Ht.prototype,"wrap",2);k([dt("start"),ot()],Ht.prototype,"justifyContent",2);k([dt("normal"),ot()],Ht.prototype,"alignContent",2);k([dt("stretch"),ot()],Ht.prototype,"alignItems",2);k([dt("auto"),ot()],Ht.prototype,"alignSelf",2);k([dt(0),M1({x:"columnGap",y:"rowGap"})],Ht.prototype,"gap",2);k([Lr("font-family"),ot()],Ht.prototype,"fontFamily",2);k([Lr("font-size",parseFloat),ot()],Ht.prototype,"fontSize",2);k([Lr("font-style"),ot()],Ht.prototype,"fontStyle",2);k([Lr("font-weight",parseInt),ot()],Ht.prototype,"fontWeight",2);k([Lr("line-height",parseFloat),ot()],Ht.prototype,"lineHeight",2);k([Lr("letter-spacing",r=>r==="normal"?0:parseFloat(r)),ot()],Ht.prototype,"letterSpacing",2);k([Lr("white-space",r=>r==="pre"?"pre":r==="normal"),ot()],Ht.prototype,"textWrap",2);k([dt("inherit"),ot()],Ht.prototype,"textDirection",2);k([Lr("text-align"),ot()],Ht.prototype,"textAlign",2);k([dt({x:null,y:null}),M1({x:"width",y:"height"})],Ht.prototype,"size",2);k([t1()],Ht.prototype,"tweenWidth",1);k([t1()],Ht.prototype,"tweenHeight",1);k([vt()],Ht.prototype,"desiredSize",1);k([t1()],Ht.prototype,"tweenSize",1);k([M1("offset")],Ht.prototype,"offset",2);k([Ci(c3.Middle)],Ht.prototype,"middle",2);k([Ci(c3.Top)],Ht.prototype,"top",2);k([Ci(c3.Bottom)],Ht.prototype,"bottom",2);k([Ci(c3.Left)],Ht.prototype,"left",2);k([Ci(c3.Right)],Ht.prototype,"right",2);k([Ci(c3.TopLeft)],Ht.prototype,"topLeft",2);k([Ci(c3.TopRight)],Ht.prototype,"topRight",2);k([Ci(c3.BottomLeft)],Ht.prototype,"bottomLeft",2);k([Ci(c3.BottomRight)],Ht.prototype,"bottomRight",2);k([dt(!1),ot()],Ht.prototype,"clip",2);k([dt(0),ot()],Ht.prototype,"sizeLockCounter",2);k([vt()],Ht.prototype,"parentTransform",1);k([vt()],Ht.prototype,"anchorPosition",1);k([vt()],Ht.prototype,"layoutEnabled",1);k([vt()],Ht.prototype,"isLayoutRoot",1);k([vt()],Ht.prototype,"scalingRotationMatrix",1);k([vt()],Ht.prototype,"computedPosition",1);k([vt()],Ht.prototype,"computedSize",1);k([vt()],Ht.prototype,"requestLayoutUpdate",1);k([vt()],Ht.prototype,"appendedToView",1);k([vt()],Ht.prototype,"updateLayout",1);k([vt()],Ht.prototype,"layoutChildren",1);k([vt()],Ht.prototype,"requestFontUpdate",1);k([vt()],Ht.prototype,"applyFlex",1);k([vt()],Ht.prototype,"applyFont",1);Ht=k([k1("Layout")],Ht);function Ci(r){return(t,e)=>{ot()(t,e),L4(!1)(t,e);const n=y4(t,e);n.parser=s=>new Z(s),n.getter=function(){const s=this.computedSize().getOriginOffset(r);return Q1(s,this.localToParent())},n.setter=function(s){return this.position(en(s,a=>{const o=this.getOriginDelta(r);return hi(o,this.scalingRotationMatrix()).flipped.add(a)})),this}}}i6(Ht.prototype,r=>{r.element=document.createElement("div"),r.element.style.display="flex",r.element.style.boxSizing="border-box",r.styles=getComputedStyle(r.element)});var s1=class extends Ht{constructor(r){super(r),this.rippleStrength=M2(0)}rippleSize(){return iL(this.rippleStrength(),0,50)}applyText(r){r.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(r){r.fillStyle=Eh(this.fill(),r),r.strokeStyle=Eh(this.stroke(),r),r.lineWidth=this.lineWidth(),r.lineJoin=this.lineJoin(),r.lineCap=this.lineCap(),r.setLineDash(this.lineDash()),r.lineDashOffset=this.lineDashOffset(),this.antialiased()||(r.filter="url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxmaWx0ZXIgaWQ9ImZpbHRlciIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJpZGVudGl0eSIvPjxmZUZ1bmNHIHR5cGU9ImlkZW50aXR5Ii8+PGZlRnVuY0IgdHlwZT0iaWRlbnRpdHkiLz48ZmVGdW5jQSB0eXBlPSJkaXNjcmV0ZSIgdGFibGVWYWx1ZXM9IjAgMSIvPjwvZmVDb21wb25lbnRUcmFuc2Zlcj48L2ZpbHRlcj48L3N2Zz4=#filter)")}async draw(r){this.drawShape(r),this.clip()&&r.clip(this.getPath()),await this.drawChildren(r)}drawShape(r){const t=this.getPath(),e=this.lineWidth()>0&&this.stroke()!==null,n=this.fill()!==null;r.save(),this.applyStyle(r),this.drawRipple(r),this.strokeFirst()?(e&&r.stroke(t),n&&r.fill(t)):(n&&r.fill(t),e&&r.stroke(t)),r.restore()}getCacheBBox(){return super.getCacheBBox().expand(this.lineWidth()/2)}getPath(){return new Path2D}getRipplePath(){return new Path2D}drawRipple(r){const t=this.rippleStrength();if(t>0){const e=this.getRipplePath();r.save(),r.globalAlpha*=Ft(.54,0,t),r.fill(e),r.restore()}}*ripple(r=1){this.rippleStrength(0),yield*this.rippleStrength(1,r,rL),this.rippleStrength(0)}};k([jS()],s1.prototype,"fill",2);k([jS()],s1.prototype,"stroke",2);k([dt(!1),ot()],s1.prototype,"strokeFirst",2);k([dt(0),ot()],s1.prototype,"lineWidth",2);k([dt("miter"),ot()],s1.prototype,"lineJoin",2);k([dt("butt"),ot()],s1.prototype,"lineCap",2);k([dt([]),ot()],s1.prototype,"lineDash",2);k([dt(0),ot()],s1.prototype,"lineDashOffset",2);k([dt(!0),ot()],s1.prototype,"antialiased",2);k([vt()],s1.prototype,"rippleSize",1);k([vt()],s1.prototype,"getPath",1);k([t1()],s1.prototype,"ripple",1);s1=k([k1("Shape")],s1);var p1=class extends s1{constructor(r){super(r),this.canHaveSubpath=!1}desiredSize(){return this.childrenBBox().size}percentageToDistance(r){return pe(0,this.baseArcLength(),this.startOffset()+this.offsetArcLength()*r)}distanceToPercentage(r){return(r-this.startOffset())/this.offsetArcLength()}baseArcLength(){return this.profile().arcLength}offsetArcLength(){const r=this.startOffset(),t=this.endOffset(),e=this.baseArcLength();return pe(0,e,e-r-t)}arcLength(){return this.offsetArcLength()*Math.abs(this.start()-this.end())}completion(){return Math.abs(this.start()-this.end())}processSubpath(r,t,e){}curveDrawingInfo(){const r=new Path2D;let t=new Path2D;const e=this.profile();let n=this.percentageToDistance(this.start()),s=this.percentageToDistance(this.end());n>s&&([n,s]=[s,n]);const a=s-n,o=Math.min(a/2,this.arrowSize());this.startArrow()&&(n+=o/2),this.endArrow()&&(s-=o/2);let l=0,u=null,h=null,T=null,f=null;for(const d of e.segments){const p=l;if(l+=d.arcLength,l<n)continue;const m=(n-p)/d.arcLength,y=(s-p)/d.arcLength,c=pe(0,1,m),Q=pe(0,1,y);this.canHaveSubpath&&T&&!d.getPoint(0).position.equals(T)&&(r.addPath(t),this.processSubpath(t,u,T),t=new Path2D,u=null);const[g,v]=d.draw(t,c,Q,u===null);if(u===null&&(u=g.position,h=g.normal.flipped.perpendicular),T=v.position,f=v.normal.flipped.perpendicular,l>s)break}return this.closed()&&this.start.isInitial()&&this.end.isInitial()&&this.startOffset.isInitial()&&this.endOffset.isInitial()&&t.closePath(),this.processSubpath(t,u,T),r.addPath(t),{startPoint:u??Z.zero,startTangent:h??Z.right,endPoint:T??Z.zero,endTangent:f??Z.right,arrowSize:o,path:r,startOffset:n}}getPointAtDistance(r){return Hh(this.profile(),r+this.startOffset())}getPointAtPercentage(r){return Hh(this.profile(),this.percentageToDistance(r))}getComputedLayout(){return this.offsetComputedLayout(super.getComputedLayout())}offsetComputedLayout(r){return r.position=r.position.sub(this.childrenBBox().center),r}getPath(){return this.curveDrawingInfo().path}getCacheBBox(){const r=this.childrenBBox(),t=this.startArrow()||this.endArrow()?this.arrowSize():0,e=this.lineWidth(),n=this.lineWidthCoefficient();return r.expand(Math.max(0,t,e*n))}lineWidthCoefficient(){return this.lineCap()==="square"?.5*1.4143:.5}requiresProfile(){return!this.start.isInitial()||!this.startOffset.isInitial()||!this.startArrow.isInitial()||!this.end.isInitial()||!this.endOffset.isInitial()||!this.endArrow.isInitial()}drawShape(r){super.drawShape(r),(this.startArrow()||this.endArrow())&&this.drawArrows(r)}drawArrows(r){const{startPoint:t,startTangent:e,endPoint:n,endTangent:s,arrowSize:a}=this.curveDrawingInfo();a<.001||(r.save(),r.beginPath(),this.endArrow()&&this.drawArrow(r,n,s.flipped,a),this.startArrow()&&this.drawArrow(r,t,e,a),r.fillStyle=Eh(this.stroke(),r),r.closePath(),r.fill(),r.restore())}drawArrow(r,t,e,n){const s=e.perpendicular,a=t.add(e.scale(-n/2));L1(r,a),V1(r,a.add(e.add(s).scale(n))),V1(r,a.add(e.sub(s).scale(n))),V1(r,a),r.closePath()}};k([dt(!1),ot()],p1.prototype,"closed",2);k([dt(0),ot()],p1.prototype,"start",2);k([dt(0),ot()],p1.prototype,"startOffset",2);k([dt(!1),ot()],p1.prototype,"startArrow",2);k([dt(1),ot()],p1.prototype,"end",2);k([dt(0),ot()],p1.prototype,"endOffset",2);k([dt(!1),ot()],p1.prototype,"endArrow",2);k([dt(24),ot()],p1.prototype,"arrowSize",2);k([vt()],p1.prototype,"arcLength",1);k([vt()],p1.prototype,"curveDrawingInfo",1);p1=k([k1("Curve")],p1);var E1=class extends p1{constructor(r){super(r)}profile(){return EK(this.childrenBBox(),this.radius(),this.smoothCorners(),this.cornerSharpness())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(r){return r}childrenBBox(){return ue.fromSizeCentered(this.computedSize())}getPath(){if(this.requiresProfile())return this.curveDrawingInfo().path;const r=new Path2D,t=this.radius(),e=this.smoothCorners(),n=this.cornerSharpness(),s=ue.fromSizeCentered(this.size());return $y(r,s,t,e,n),r}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}getRipplePath(){const r=new Path2D,t=this.rippleSize(),e=this.radius().addScalar(t),n=this.smoothCorners(),s=this.cornerSharpness(),a=ue.fromSizeCentered(this.size()).expand(t);return $y(r,a,e,n,s),r}};k([Ql("radius")],E1.prototype,"radius",2);k([dt(!1),ot()],E1.prototype,"smoothCorners",2);k([dt(.6),ot()],E1.prototype,"cornerSharpness",2);k([vt()],E1.prototype,"profile",1);E1=k([k1("Rect")],E1);var HK="\nThe `playbackRate` of a `Video` cannot be reactive.\n\nMake sure to use a concrete value and not a function:\n\n```ts wrong\nvideo.playbackRate(() => 7);\n```\n\n```ts correct\nvideo.playbackRate(7);\n```\n\nIf you're using a signal, extract its value before passing it to the property:\n\n```ts wrong\nvideo.playbackRate(mySignal);\n```\n\n```ts correct\nvideo.playbackRate(mySignal());\n```\n",T1=class extends E1{constructor(r){super(r),this.lastTime=-1,this.isSchedulingPlay=!1,this.awaitCanPlay()||this.scheduleSeek(this.time()),r.play&&this.play(),this.volume=r.volume??1,this.awaitCanPlay()||this.setVolume(this.volume)}isPlaying(){return this.playing()}getCurrentTime(){return this.clampTime(this.time())}getDuration(){try{const r=this.mediaElement(),t=r instanceof HTMLVideoElement,e=r instanceof HTMLAudioElement;return this.isIOS()&&(t||e)?2:r.duration}catch{return 0}}getVolume(){return this.volume}getUrl(){try{return this.mediaElement().src}catch{return this.src()}}dispose(){this.playing(!1),this.time.save(),this.remove(),super.dispose()}completion(){return this.clampTime(this.time())/this.getDuration()}setCurrentTime(r){try{const t=this.mediaElement();if(t.readyState<2)return;t.currentTime=r,this.lastTime=r,t.seeking&&n1.collectPromise(new Promise(e=>{const n=()=>{e(),t.removeEventListener("seeked",n)};t.addEventListener("seeked",n)}))}catch{this.lastTime=r}}setVolume(r){r<0&&console.warn("volumes cannot be negative - the value will be clamped to 0."),this.volume=r;try{const t=this.mediaElement();if(t.volume=Math.min(Math.max(r,0),1),r>1){if(this.allowVolumeAmplificationInPreview()){this.amplify(t,r);return}console.warn(`you have set the volume of node ${this.key} to ${r} - your video will be exported with the correct volume, but the browser does not support volumes higher than 1 by default. To enable volume amplification in the preview, set the "allowVolumeAmplificationInPreview" of your <Video/> or <Audio/> tag to true. Note that amplification for previews will not work if you use autoplay within the player due to browser autoplay policies: https://developer.chrome.com/blog/autoplay/#webaudio.`)}}catch{}}amplify(r,t){const e=`${this.src()}/${this.key}`;if(T1.amplificationPool[e]){T1.amplificationPool[e].gainNode.gain.value=t;return}const n=new AudioContext,s=n.createMediaElementSource(r),a=n.createGain();if(a.gain.value=t,s.connect(a),a.connect(n.destination),T1.amplificationPool[e]={audioContext:n,sourceNode:s,gainNode:a},typeof window>"u"||n.state!=="suspended")return;const o=()=>{T1.amplificationPool[e].audioContext.resume(),window.removeEventListener("click",o)};window.addEventListener("click",o)}setPlaybackRate(r){let t;if(F2(r)?(t=r(),ce().warn({message:"Invalid value set as the playback rate",remarks:HK,inspect:this.key,stack:new Error().stack})):t=r,this.playbackRate.context.setter(t),this.playing())if(t===0)this.pause();else{const e=bi().time,n=e(),s=this.time();this.time(()=>this.clampTime(s+(e()-n)*t))}}scheduleSeek(r){setTimeout(()=>{try{const t=this.mediaElement();this.waitForCanPlay(t,()=>{t.currentTime=r})}catch{setTimeout(()=>this.scheduleSeek(r),50)}},0)}waitForCanPlay(r,t){if(r.readyState>=3){t();return}const e=()=>{t(),r.removeEventListener("canplay",e),r.removeEventListener("canplaythrough",e)},n=()=>{var o;const s=this.getErrorReason((o=r.error)==null?void 0:o.code),a=this.src();console.error(`Error loading video: src="${a}", ${s}`),console.error(`Media element src: "${r.src}"`),r.removeEventListener("error",n),r.removeEventListener("canplay",e),r.removeEventListener("canplaythrough",e)};r.addEventListener("canplay",e),r.addEventListener("canplaythrough",e),r.addEventListener("error",n)}waitForCanPlayNecessary(r){return r.readyState>=2?!1:this.awaitCanPlay()||this.view().playbackState()===r2.Rendering}play(){this.playing(!0),this.schedulePlay()}schedulePlay(){if(this.isSchedulingPlay)return;this.isSchedulingPlay=!0;let r=null;try{r=bi().time}catch{this.isSchedulingPlay=!1,this.simplePlay();return}setTimeout(()=>{if(!this.playing()){this.isSchedulingPlay=!1;return}setTimeout(()=>{try{const e=this.mediaElement();this.waitForCanPlay(e,()=>{this.playing()&&r&&this.actuallyPlay(e,r),this.isSchedulingPlay=!1})}catch{this.isSchedulingPlay=!1,setTimeout(()=>this.schedulePlay(),100)}},10)},0)}simplePlay(){setTimeout(()=>{try{const r=this.mediaElement();if(!r.src||r.src.includes("undefined"))return;if(r.paused&&this.playing()){r.playbackRate=this.playbackRate();const t=r.play();t!==void 0&&t.then(()=>{}).catch(e=>{e.name!=="AbortError"&&console.warn("Error in simple play:",e),this.view().playbackState()!==r2.Rendering&&this.playing(!1)})}}catch{return}},10)}actuallyPlay(r,t){if(!this.playing())return;if(r.playbackRate=this.playbackRate(),r.paused){const s=r.play();s!==void 0&&s.then(()=>{}).catch(a=>{a.name!=="AbortError"&&console.warn("Error playing media:",a),this.view().playbackState()!==r2.Rendering&&this.playing(!1)})}const e=t(),n=r.currentTime;this.time(()=>this.clampTime(n+(t()-e)*this.playbackRate()))}pause(){this.playing(!1),this.time.save(),setTimeout(()=>{try{this.mediaElement().pause()}catch{}},0)}clampTime(r){const t=this.getDuration();return this.loop()&&(r%=t),pe(0,t,r)}collectAsyncResources(){super.collectAsyncResources(),this.seekedMedia(),this.setVolume(this.volume)}autoPlayBasedOnTwick(){const r=this.view().playbackState(),t=r===r2.Playing||r===r2.Presenting||r===r2.Rendering;t&&!this.playing()?(r===r2.Rendering&&this.playing(!0),this.play()):!t&&this.playing()&&this.pause()}getErrorReason(r){let t;switch(r){case 1:t="MEDIA_ERR_ABORTED";break;case 2:t="MEDIA_ERR_NETWORK. This might be a 404 error.";break;case 3:t="MEDIA_ERR_DECODE. This might be an issue with your video file.";break;case 4:t="MEDIA_ERR_SRC_NOT_SUPPORTED. If you are sure that the path to the video is correct, this might be a CORS error.";break;default:t="UNKNOWN"}return t}isIOS(){return typeof navigator>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}};T1.amplificationPool={};k([dt(""),ot()],T1.prototype,"src",2);k([dt(!1),ot()],T1.prototype,"loop",2);k([dt(1),ot()],T1.prototype,"playbackRate",2);k([dt(0),ot()],T1.prototype,"time",2);k([dt(!1),ot()],T1.prototype,"playing",2);k([dt(!0),ot()],T1.prototype,"awaitCanPlay",2);k([dt(!1),ot()],T1.prototype,"allowVolumeAmplificationInPreview",2);k([vt()],T1.prototype,"completion",1);k([vt()],T1.prototype,"amplify",1);T1=k([k1("Media")],T1);var w2=class extends T1{constructor(r){super(r)}mediaElement(){return this.audio()}seekedMedia(){return this.seekedAudio()}fastSeekedMedia(){return this.fastSeekedAudio()}audio(){const r=this.src(),t=`${this.key}/${r||"pending"}`;let e=w2.pool[t];if(!e)e=document.createElement("audio"),e.crossOrigin="anonymous",r&&r!=="undefined"&&(e.src=r),w2.pool[t]=e;else if(r&&r!=="undefined"&&e.src!==r){e.src=r,delete w2.pool[t];const s=`${this.key}/${r}`;w2.pool[s]=e}return(!r||r==="undefined")&&n1.collectPromise(new Promise(s=>{const a=()=>{const o=this.src();o&&o!=="undefined"?s():setTimeout(a,10)};a()})),this.waitForCanPlayNecessary(e)&&n1.collectPromise(new Promise(s=>{this.waitForCanPlay(e,s)})),e}seekedAudio(){const r=this.audio();if(r.addEventListener("ended",()=>{this.pause()}),!(this.time()<r.duration))return this.pause(),r;const t=this.clampTime(this.time());return r.playbackRate=this.playbackRate(),r.paused||r.pause(),this.lastTime===t||this.setCurrentTime(t),r}fastSeekedAudio(){const r=this.audio();if(!(this.time()<r.duration))return this.pause(),r;const t=this.clampTime(this.time());if(r.playbackRate=this.playbackRate(),this.lastTime===t)return r;const e=this.playing()&&t<r.duration&&r.playbackRate>0;return e?r.paused&&n1.collectPromise(r.play()):r.paused||r.pause(),Math.abs(r.currentTime-t)>.3?this.setCurrentTime(t):e||(r.currentTime=t),r}async draw(r){this.autoPlayBasedOnTwick();const t=this.view().playbackState();t===r2.Playing||t===r2.Presenting?this.fastSeekedAudio():this.seekedAudio(),r.save(),r.restore(),await this.drawChildren(r)}};w2.pool={};k([vt()],w2.prototype,"audio",1);k([vt()],w2.prototype,"seekedAudio",1);k([vt()],w2.prototype,"fastSeekedAudio",1);w2=k([k1("Audio")],w2);var Uf=class extends p1{profile(){const r=this.segment();return{segments:[r],arcLength:r.arcLength,minSin:0}}childrenBBox(){return ue.fromPoints(...this.segment().points)}desiredSize(){return this.segment().getBBox().size}offsetComputedLayout(r){return r.position=r.position.sub(this.segment().getBBox().center),r}drawOverlay(r,t){const e=this.computedSize(),n=this.childrenBBox().transformCorners(t),s=e.mul(this.offset()).scale(.5),a=Q1(s,t),o=this.overlayInfo(t);r.lineWidth=1,r.strokeStyle="white",r.fillStyle="white",r.stroke(o.curve),r.fillStyle="white",r.globalAlpha=.5,r.beginPath(),r.stroke(o.handleLines),r.globalAlpha=1,r.lineWidth=2;for(const l of[o.startPoint,o.endPoint])L1(r,l),r.beginPath(),xi(r,l,4),r.closePath(),r.stroke(),r.fill();r.fillStyle="black";for(const l of o.controlPoints)L1(r,l),r.beginPath(),xi(r,l,4),r.closePath(),r.fill(),r.stroke();r.lineWidth=1,r.beginPath(),r6(r,a),r.stroke(),r.beginPath(),A2(r,n),r.closePath(),r.stroke()}};k([vt()],Uf.prototype,"childrenBBox",1);var KS=class K4 extends qS{constructor(t,e,n){super(new WS(t,t.flipped.add(e).scale(2),t.sub(e.scale(2)).add(n)),K4.getLength(t,e,n)),this.p0=t,this.p1=e,this.p2=n}get points(){return[this.p0,this.p1,this.p2]}split(t){const e=new Z(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),n=new Z(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),s=new Z(e.x+(n.x-e.x)*t,e.y+(n.y-e.y)*t),a=new K4(this.p0,e,s),o=new K4(s,n,this.p2);return[a,o]}static getLength(t,e,n){return K4.el.setAttribute("d",`M ${t.x} ${t.y} Q ${e.x} ${e.y} ${n.x} ${n.y}`),K4.el.getTotalLength()}doDraw(t){Nf(t,this.p1,this.p2)}};k([jn(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],KS,"el",2);var L5=KS;function Jy(r){return r instanceof _i}function MK(r,t,e,n){if(r.auto.start===0&&r.auto.end===0)return;const s=r.position.sub(t.position).magnitude,a=e.position.sub(r.position).magnitude,o=n*s/(s+a),l=n-o,u=new Z(r.position.x-o*(e.position.x-t.position.x),r.position.y-o*(e.position.y-t.position.y)),h=new Z(r.position.x+l*(e.position.x-t.position.x),r.position.y+l*(e.position.y-t.position.y));r.startHandle=r.startHandle.lerp(u,r.auto.start),r.endHandle=r.endHandle.lerp(h,r.auto.end)}function wK(r){for(let t=0;t<r.segments.length;t++){const e=r.segments[t],n=r.segments[(t+1)%r.segments.length];if(!Jy(e)||!Jy(n))continue;const s=e.p2.sub(e.p3).normalized.safe,a=n.p1.sub(n.p0).normalized.safe,o=s.dot(a);if(!(1-Math.abs(o)>1e-4))continue;const u=Math.acos(pe(-1,1,o)),h=Math.sin(u/2);r.minSin=Math.min(r.minSin,Math.abs(h))}}function z4(r,t,e,n,s){const a=s!==void 0?new _i(t,e,n,s):new L5(t,e,n);r.segments.push(a),r.arcLength+=a.arcLength}function CK(r,t,e){const n={segments:[],arcLength:0,minSin:1},s=r.length;for(let h=0;h<s;h++){const T=(h-1+s)%s,f=(h+1)%s;MK(r[h],r[T],r[f],e)}const a=r[0],o=r[1];!t&&a.auto.start===1&&a.auto.end===1?z4(n,a.position,o.startHandle,o.position):z4(n,a.position,a.endHandle,o.startHandle,o.position);for(let h=1;h<s-2;h++){const T=r[h],f=r[h+1];z4(n,T.position,T.endHandle,f.startHandle,f.position)}const l=r.at(-1),u=r.at(-2);return r.length>2&&(!t&&l.auto.start===1&&l.auto.end===1?z4(n,u.position,u.endHandle,l.position):z4(n,u.position,u.endHandle,l.startHandle,l.position)),t&&z4(n,l.position,l.endHandle,a.startHandle,a.position),wK(n),n}var o3=class extends E1{constructor(r){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...r}),this.view2D=this,o3.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}async render(r){this.computedSize(),this.computedPosition(),await super.render(r)}findKey(r){return Sa().getNode(r)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};k([dt(r2.Paused),ot()],o3.prototype,"playbackState",2);k([dt(0),ot()],o3.prototype,"globalTime",2);k([dt(0),ot()],o3.prototype,"fps",2);k([ot()],o3.prototype,"assetHash",2);k([jn(()=>{const r="twick-2d-frame";let t=document.querySelector(`#${r}`);return t||(t=document.createElement("div"),t.id=r,t.style.position="absolute",t.style.pointerEvents="none",t.style.top="0",t.style.left="0",t.style.fontFeatureSettings="normal",t.style.opacity="0",t.style.overflow="hidden",document.body.prepend(t)),t.shadowRoot??t.attachShadow({mode:"open"})})],o3,"shadowRoot",2);o3=k([k1("View2D")],o3);var XS=class Ea extends fl{constructor(t,e,n,s,a,o){super(),this.startPoint=t,this.radius=e,this.xAxisRotationDegree=n,this.largeArcFlag=s,this.sweepFlag=a,this.endPoint=o,this.xAxisRotation=this.xAxisRotationDegree*Xi,this.radius=new Z(Math.abs(e.x),Math.abs(e.y));const l=A5.fromRotation(-n).domMatrix,u=hi(t.sub(o).div(2),l),h=u.x*u.x/(e.x*e.x)+u.y*u.y/(e.y*e.y);if(h>1){const y=Math.sqrt(h);e.x=y*e.x,e.y=y*e.y}const T=new Z(e.ctg*u.y,e.perpendicular.ctg*u.x).scale(Math.sqrt(1/(u.x*u.x/(e.x*e.x)+u.y*u.y/(e.y*e.y))-1)*(s===a?-1:1));this.xAxisRotationMatrix=A5.fromRotation(n).domMatrix;const f=hi(T,this.xAxisRotationMatrix);this.center=f.add(t.add(o).div(2));const d=u.sub(T).div(e),p=u.scale(-1).sub(T).div(e);this.startAngle=d.radians,this.deltaAngle=Z.angleBetween(d,p)%(Math.PI*2),this.sweepFlag===0&&this.deltaAngle>0&&(this.deltaAngle-=Math.PI*2),this.sweepFlag===1&&this.deltaAngle<0&&(this.deltaAngle+=Math.PI*2),Ea.el.setAttribute("d",`M ${this.startPoint.x} ${this.startPoint.y} A ${this.radius.x} ${this.radius.y} ${this.xAxisRotationDegree} ${this.largeArcFlag} ${this.sweepFlag} ${this.endPoint.x} ${this.endPoint.y}`),this.length=Ea.el.getTotalLength();const m=new ue(Ea.el.getBBox());this.points=[m.topLeft,m.bottomRight]}getAnglePosition(t){return hi(this.radius.mul(Z.fromRadians(t)),this.xAxisRotationMatrix).add(this.center)}getAngleDerivative(t){const e=new Z(-this.radius.x*Math.sin(t),this.radius.y*Math.cos(t));return hi(e,this.xAxisRotationMatrix)}draw(t,e,n,s){const a=this.startAngle+this.deltaAngle*e,o=this.startAngle+this.deltaAngle*n,l=this.getPoint(e),u=this.getPoint(n);return s&&t.moveTo(l.position.x,l.position.y),t.ellipse(this.center.x,this.center.y,this.radius.x,this.radius.y,this.xAxisRotation,a,o,this.sweepFlag===0),[l,u]}getPoint(t){const e=this.startAngle+t*this.deltaAngle,n=this.getAngleDerivative(e).normalized;return{position:t===0?this.startPoint:t===1?this.endPoint:this.getAnglePosition(e),tangent:n,normal:n.perpendicular}}get arcLength(){return this.length}};k([jn(()=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","path");return r.appendChild(t),o3.shadowRoot.appendChild(r),t})],XS,"el",2);var $S=XS;function DK(r,t,e,n,s=!1){const a={arcLength:0,minSin:1,segments:[]};if(e<t){const T=Math.floor((t-e)/(Math.PI*2))+1;e+=Math.PI*2*T}else if(e>t+Math.PI*2){const T=Math.floor((e-t)/(Math.PI*2));e-=Math.PI*2*T}const o=(t+e)/2,l=r.mul(Z.fromRadians(t)),u=r.mul(Z.fromRadians(e)),h=r.mul(Z.fromRadians(o)).scale(s?-1:1);return n&&Mh(a,new s2(Z.zero,l)),tv(a,r,l,h,t,o,s),tv(a,r,h,u,o,e,s),n&&Mh(a,new s2(u,Z.zero)),a}function Mh(r,t){r.segments.push(t),r.arcLength+=t.arcLength}function tv(r,t,e,n,s,a,o){const l=Math.abs(s-a)<=180?1:0,u=s>a?0:1,h=o?0:1;Mh(r,new $S(e,t,0,0,l^h^u,n))}function jf(r,t,e){const n={arcLength:0,segments:[],minSin:1};if(r.length===0)return n;if(e){const o=r[0].add(r[r.length-1]).scale(.5);r=[o,...r,o]}let s=r[0];for(let o=2;o<r.length;o++){const l=r[o-2],u=r[o-1],h=r[o],T=l.sub(u),f=h.sub(u),d=T.normalized.safe,p=f.normalized.safe,m=Math.acos(pe(-1,1,d.dot(p))),y=Math.tan(m/2),c=Math.sin(m/2),Q=Math.min(t,y*T.magnitude*(o===2?1:.5),y*f.magnitude*(o===r.length-1?1:.5)),g=c===0?0:Q/c,v=y===0?0:Q/y,L=d.add(p).scale(1/2).normalized.safe.scale(g).add(u),x=d.perpendicular.dot(p)<0,b=new s2(s,u.add(d.scale(v))),S=new zS(L,Q,d.perpendicular.scale(x?1:-1),p.perpendicular.scale(x?-1:1),x);b.arcLength>0&&(n.segments.push(b),n.arcLength+=b.arcLength),S.arcLength>0&&(n.segments.push(S),n.arcLength+=S.arcLength),n.minSin=Math.min(n.minSin,Math.abs(c)),s=u.add(p.scale(v))}const a=new s2(s,r[r.length-1]);return a.arcLength>0&&(n.segments.push(a),n.arcLength+=a.arcLength),n}var gr=class extends p1{constructor(r){super(r)}profile(){return DK(this.size().scale(.5),this.startAngle()*Xi,this.endAngle()*Xi,this.closed(),this.counterclockwise())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(r){return r}childrenBBox(){return ue.fromSizeCentered(this.computedSize())}getPath(){return this.requiresProfile()?this.curveDrawingInfo().path:this.createPath()}getRipplePath(){return this.createPath(this.rippleSize())}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}createPath(r=0){const t=new Path2D,e=this.startAngle()*Xi;let n=this.endAngle()*Xi;const s=this.size().scale(.5).add(r),a=this.closed();if(n>e+Math.PI*2){const o=Math.floor((n-e)/(Math.PI*2));n-=Math.PI*2*o}return a&&t.moveTo(0,0),t.ellipse(0,0,s.x,s.y,0,e,n,this.counterclockwise()),a&&t.closePath(),t}};k([dt(0),ot()],gr.prototype,"startAngle",2);k([dt(360),ot()],gr.prototype,"endAngle",2);k([dt(!1),ot()],gr.prototype,"counterclockwise",2);k([vt()],gr.prototype,"profile",1);gr=k([k1("Circle")],gr);var l3=class extends s1{constructor(r){super({fontFamily:"monospace",...r}),this.oldSelection=null,this.selectionProgress=M2(null)}static createSignal(r,t){return new Ah(r,void 0,t).toSignal()}setDrawHooks(r){!S5().experimentalFeatures&&r!==this.drawHooks.context.getInitial()?ce().log({...Jv("Code uses experimental draw hooks."),inspect:this.key}):this.drawHooks.context.setter(r)}*tweenSelection(r,t,e){this.oldSelection=this.selection(),this.selection(r),this.selectionProgress(0),yield*this.selectionProgress(1,t,e),this.selectionProgress(null),this.oldSelection=null}parsed(){return $r(this.code(),r=>x1(r.progress)>.5)}highlighterCache(){const r=this.highlighter();if(!r||!r.initialize())return null;const t=this.code(),e=$r(t,!1),n=$r(t,!0);return{before:r.prepare(e),after:r.prepare(n)}}get cursor(){return this.cursorCache??(this.cursorCache=new hK(this)),this.cursorCache}createSignal(r){return new Ah(r,this,this.highlighter).toSignal()}findAllRanges(r){return Ou(this.parsed(),r)}findFirstRange(r){return Ou(this.parsed(),r,1)[0]??[[0,0],[0,0]]}findLastRange(r){return Ou(this.parsed(),r).at(-1)??[[0,0],[0,0]]}getPointBbox(r){const[t,e]=r,n=this.drawingInfo();let s;for(const o of n.fragments){if(o.cursor.y<t){s=o;continue}if(o.cursor.y===t&&o.cursor.x<e){s=o;continue}break}if(!s)return new ue;const a=this.computedSize();return new ue(s.position.sub(a.scale(.5)).addX(s.characterSize.x*(e-s.cursor.x)),s.characterSize)}getSelectionBbox(r){const t=this.computedSize(),e=RS(r),n=this.drawingInfo(),s=[];let a=null,o=0,l=0;for(const u of n.fragments){u.cursor.y!==o&&(o=u.cursor.y,a&&(s.push(a),a=null)),l=u.cursor.x;for(let h=0;h<u.text.length;h++){if(bh([o,l],e)){const T=new ue(u.position.sub(t.scale(.5)).addX(u.characterSize.x*(l-u.cursor.x)),u.characterSize);a?a=a.union(T):a=T}else a&&(s.push(a),a=null);l++}}return a&&s.push(a),s}drawingInfo(){this.requestFontUpdate();const r=this.cacheCanvas(),t=this.code();r.save(),this.applyStyle(r),this.applyText(r),this.cursor.setupDraw(r),this.cursor.drawScope(t);const e=this.cursor.getDrawingInfo();return r.restore(),e}desiredSize(){this.requestFontUpdate();const r=this.cacheCanvas(),t=this.code();r.save(),this.applyStyle(r),this.applyText(r),this.cursor.setupMeasure(r),this.cursor.measureSize(t);const e=this.cursor.getSize();return r.restore(),e}async draw(r){this.requestFontUpdate(),this.applyStyle(r),this.applyText(r);const t=this.computedSize(),e=this.drawingInfo();r.save(),r.translate(-t.width/2,-t.height/2+e.verticalOffset);const n=this.drawHooks();for(const s of e.fragments)r.save(),r.globalAlpha*=s.alpha,n.token(r,s.text,s.position,s.fill,s.time),r.restore();r.restore(),await this.drawChildren(r)}applyText(r){super.applyText(r),r.font=this.styles.font,r.textBaseline="top","letterSpacing"in r&&(r.letterSpacing=this.styles.letterSpacing)}collectAsyncResources(){var r;super.collectAsyncResources(),(r=this.highlighter())==null||r.initialize()}};l3.defaultHighlighter=null;k([dt(()=>l3.defaultHighlighter),ot()],l3.prototype,"highlighter",2);k([bK()],l3.prototype,"code",2);k([dt({token(r,t,e,n,s){r.fillStyle=n,r.globalAlpha*=Ft(.2,1,s),r.fillText(t,e.x,e.y)}}),ot()],l3.prototype,"drawHooks",2);k([dt(uK(0,1/0)),O0(RS),ot()],l3.prototype,"selection",2);k([vt()],l3.prototype,"parsed",1);k([vt()],l3.prototype,"highlighterCache",1);k([vt()],l3.prototype,"drawingInfo",1);l3=k([k1("CodeBlock")],l3);var V0=class extends Uf{constructor(r){super(r)}segment(){return new _i(this.p0(),this.p1(),this.p2(),this.p3())}overlayInfo(r){const[t,e,n,s]=this.segment().transformPoints(r),a=new Path2D;L1(a,t),Ff(a,e,n,s);const o=new Path2D;return L1(o,t),V1(o,e),L1(o,n),V1(o,s),{curve:a,startPoint:t,endPoint:s,controlPoints:[e,n],handleLines:o}}};k([M1("p0")],V0.prototype,"p0",2);k([M1("p1")],V0.prototype,"p1",2);k([M1("p2")],V0.prototype,"p2",2);k([M1("p3")],V0.prototype,"p3",2);k([vt()],V0.prototype,"segment",1);var K5=class extends s1{constructor(r){super(r)}drawShape(r){r.save(),this.applyStyle(r),this.drawRipple(r);const t=this.spacing(),e=this.computedSize().scale(.5),n=e.div(t).floored;for(let s=-n.x;s<=n.x;s++){const[a,o]=this.mapPoints(-e.height,e.height);r.beginPath(),r.moveTo(t.x*s,a),r.lineTo(t.x*s,o),r.stroke()}for(let s=-n.y;s<=n.y;s++){const[a,o]=this.mapPoints(-e.width,e.width);r.beginPath(),r.moveTo(a,t.y*s),r.lineTo(o,t.y*s),r.stroke()}r.restore()}mapPoints(r,t){let e=Ft(r,t,this.start()),n=Ft(r,t,this.end());return n<e&&([e,n]=[n,e]),[e,n]}};k([dt(80),M1("spacing")],K5.prototype,"spacing",2);k([dt(0),ot()],K5.prototype,"start",2);k([dt(1),ot()],K5.prototype,"end",2);K5=k([k1("Grid")],K5);var OK=`
228
+ `.repeat(m)+" ".repeat(y),"")}return T[f]=p,[T,f]}var Ah=class extends ur{constructor(r,t,e){super(r,Yr,t),this.highlighter=e,this.progress=M2(0),Object.defineProperty(this.invokable,"edit",{value:this.edit.bind(this)}),Object.defineProperty(this.invokable,"append",{value:this.append.bind(this)}),Object.defineProperty(this.invokable,"prepend",{value:this.prepend.bind(this)}),Object.defineProperty(this.invokable,"insert",{value:this.insert.bind(this)}),Object.defineProperty(this.invokable,"remove",{value:this.remove.bind(this)}),Object.defineProperty(this.invokable,"replace",{value:this.replace.bind(this)})}*tweener(r,t,e){let n=_K;const s=x1(this.highlighter);s&&(yield(async()=>{do await n1.consumePromises(),s.initialize();while(n1.hasPromises())})(),n=a=>s.tokenize(a)),this.progress(0),this.set({progress:this.progress,fragments:fK(this.get(),this.parse(x1(r)),n)}),yield*this.progress(1,t,e),this.set(r)}edit(r=.6){return(t,...e)=>this.editTween(Du(t,...e),r)}append(r=.6,t){if(typeof r=="string")if(t===void 0){const n=this.get();return this.set({progress:0,fragments:[...n.fragments,r]})}else return this.appendTween(r,t);const e=r;return(n,...s)=>this.append(v5(Du(n,...s),!0),e)}prepend(r=.6,t){if(typeof r=="string")if(t===void 0){const n=this.get();return this.set({progress:0,fragments:[r,...n.fragments]})}else return this.prependTween(r,t);const e=r;return(n,...s)=>this.prepend(v5(Du(n,...s),!0),e)}insert(r,t,e){return this.replace([r,r],t,e)}remove(r,t){return this.replace(r,"",t)}replace(r,t,e){if(e===void 0){const n=this.get(),[s,a]=Yy(r,n.fragments);return s[a]=t,this.set({progress:n.progress,fragments:s})}else return this.replaceTween(r,t,e)}*replaceTween(r,t,e){let n=this.get();const[s,a]=Yy(r,n.fragments),o=M2(0),l={progress:o,fragments:[aK(s[a],t)]};s[a]=l,this.set({progress:n.progress,fragments:s}),yield*o(1,e),n=this.get(),this.set({progress:n.progress,fragments:n.fragments.map(u=>u===l?t:u)}),o.context.dispose()}*editTween(r,t){this.progress(0),this.set({progress:this.progress,fragments:r}),yield*this.progress(1,t);const e=this.get();this.set({progress:0,fragments:e.fragments.map(n=>r.includes(n)?v5(n,!0):n)})}*appendTween(r,t){let e=this.get();const n=M2(0),s={progress:n,fragments:[Zy(r)]};this.set({progress:e.progress,fragments:[...e.fragments,s]}),yield*n(1,t),e=this.get(),this.set({progress:e.progress,fragments:e.fragments.map(a=>a===s?r:a)}),n.context.dispose()}*prependTween(r,t){let e=this.get();const n=M2(0),s={progress:n,fragments:[Zy(r)]};this.set({progress:e.progress,fragments:[s,...e.fragments]}),yield*n(1,t),e=this.get(),this.set({progress:e.progress,fragments:e.fragments.map(a=>a===s?r:a)}),n.context.dispose()}parse(r){return oK(r)}toSignal(){return this.invokable}};function bK(){return(r,t)=>{const e=Tl(r,t);i6(r,n=>{n[t]=new Ah(e.default??[],n).toSignal()})}}uT.define([{tag:lt.keyword,color:"#5e81ac"},{tag:[lt.name,lt.deleted,lt.character,lt.propertyName,lt.macroName],color:"#88c0d0"},{tag:[lt.variableName],color:"#8fbcbb"},{tag:[lt.function(lt.variableName)],color:"#8fbcbb"},{tag:[lt.labelName],color:"#81a1c1"},{tag:[lt.color,lt.constant(lt.name),lt.standard(lt.name)],color:"#5e81ac"},{tag:[lt.definition(lt.name),lt.separator],color:"#a3be8c"},{tag:[lt.brace],color:"#8fbcbb"},{tag:[lt.annotation],color:"#d30102"},{tag:[lt.number,lt.changed,lt.annotation,lt.modifier,lt.self,lt.namespace],color:"#b48ead"},{tag:[lt.typeName,lt.className],color:"#ECEFF4"},{tag:[lt.operator,lt.operatorKeyword],color:"#a3be8c"},{tag:[lt.tagName],color:"#b48ead"},{tag:[lt.squareBracket],color:"#ECEFF4"},{tag:[lt.angleBracket],color:"#ECEFF4"},{tag:[lt.attributeName],color:"#eceff4"},{tag:[lt.regexp],color:"#5e81ac"},{tag:[lt.quote],color:"#b48ead"},{tag:[lt.string],color:"#a3be8c"},{tag:lt.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[lt.url,lt.escape,lt.special(lt.string)],color:"#8fbcbb"},{tag:[lt.meta],color:"#88c0d0"},{tag:[lt.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[lt.comment],color:"#4c566a",fontStyle:"italic"},{tag:lt.strong,fontWeight:"bold",color:"#5e81ac"},{tag:lt.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:lt.strikethrough,textDecoration:"line-through"},{tag:lt.heading,fontWeight:"bold",color:"#5e81ac"},{tag:lt.special(lt.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:lt.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[lt.heading2,lt.heading3,lt.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[lt.heading5,lt.heading6],color:"#5e81ac"},{tag:[lt.atom,lt.bool,lt.special(lt.variableName)],color:"#d08770"},{tag:[lt.processingInstruction,lt.inserted],color:"#8fbcbb"},{tag:[lt.contentSeparator],color:"#ebcb8b"},{tag:lt.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}]);var fl=class{},zS=class extends fl{constructor(r,t,e,n,s){super(),this.center=r,this.radius=t,this.from=e,this.to=n,this.counter=s,this.angle=Math.acos(pe(-1,1,e.dot(n))),this.length=Math.abs(this.angle*t);const a=new Z(1,1).scale(t);this.points=[r.sub(a),r.add(a)]}get arcLength(){return this.length}draw(r,t,e){const n=this.counter?-1:1,s=this.from.radians+t*this.angle*n,a=this.to.radians-(1-e)*this.angle*n;Math.abs(this.angle)>1e-4&&r.arc(this.center.x,this.center.y,this.radius,s,a,this.counter);const o=Z.fromRadians(s),l=Z.fromRadians(a);return[{position:this.center.add(o.scale(this.radius)),tangent:this.counter?o:o.flipped,normal:this.counter?o.flipped:o},{position:this.center.add(l.scale(this.radius)),tangent:this.counter?l.flipped:l,normal:this.counter?l.flipped:l}]}getPoint(r){const t=this.counter?-1:1,e=this.from.radians+r*this.angle*t,n=Z.fromRadians(e);return{position:this.center.add(n.scale(this.radius)),tangent:this.counter?n:n.flipped,normal:this.counter?n:n.flipped}}},Y6=class A3{constructor(t,e,n,s){this.c0=t,this.c1=e??0,this.c2=n??0,this.c3=s??0}static constant(t){return new A3(t)}static linear(t,e){return new A3(t,e)}static quadratic(t,e,n){return new A3(t,e,n)}static cubic(t,e,n,s){return new A3(t,e,n,s)}get degree(){return this.c3!==0?3:this.c2!==0?2:this.c1!==0?1:0}differentiate(t=1){switch(t){case 0:return this;case 1:return new A3(this.c1,2*this.c2,3*this.c3,0);case 2:return new A3(2*this.c2,6*this.c3,0,0);case 3:return new A3(6*this.c3,0,0,0);default:throw new Error("Unsupported derivative")}}eval(t,e=0){return e!==0?this.differentiate(e).eval(t):this.c3*(t*t*t)+this.c2*(t*t)+this.c1*t+this.c0}split(t){const e=1-t,n=new A3(this.c0,this.c1*t,this.c2*t*t,this.c3*t*t*t),s=new A3(this.eval(0),e*this.differentiate(1).eval(t),e*e/2*this.differentiate(2).eval(t),e*e*e/6*this.differentiate(3).eval(t));return[n,s]}roots(){switch(this.degree){case 3:return this.solveCubicRoots();case 2:return this.solveQuadraticRoots();case 1:return this.solveLinearRoot();case 0:return[];default:throw new Error(`Unsupported polynomial degree: ${this.degree}`)}}localExtrema(){return this.differentiate().roots()}localExtrema01(){const t=this.localExtrema(),e=[];for(let n=0;n<t.length;n++){const s=t[n];s>=0&&s<=1&&e.push(t[n])}return e}outputRange01(){let t=[this.eval(0),this.eval(1)];const e=n=>{t[1]>t[0]?t=[Math.min(t[0],n),Math.max(t[1],n)]:t=[Math.min(t[1],n),Math.max(t[0],n)]};return this.localExtrema01().forEach(n=>e(this.eval(n))),t}solveCubicRoots(){const t=this.c0,e=this.c1,n=this.c2,s=this.c3,a=t*t,o=t*n,l=e*e,u=(3*o-l)/(3*a),h=(2*l*e-9*o*e+27*a*s)/(27*a*t),T=this.solveDepressedCubicRoots(u,h),f=d=>d-e/(3*t);switch(T.length){case 1:return[f(T[0])];case 2:return[f(T[0]),f(T[1])];case 3:return[f(T[0]),f(T[1]),f(T[2])];default:return[]}}solveDepressedCubicRoots(t,e){if(this.almostZero(t))return[Math.cbrt(-e)];const n=Math.PI*2,s=4*t*t*t+27*e*e;if(s<1e-5){const a=2*Math.sqrt(-t/3),o=3*e/(2*t)*Math.sqrt(-3/t),l=u=>a*Math.cos(1/3*Math.acos(pe(-1,1,o))-n/3*u);return o>=.9999?[l(0),l(2)]:o<=-.9999?[l(1),l(2)]:[l(0),l(1),l(2)]}if(s>0&&t<0){const a=.3333333333333333*Math.acosh(-3*Math.abs(e)/(2*t)*Math.sqrt(-3/t));return[-2*Math.sign(e)*Math.sqrt(-t/3)*Math.cosh(a)]}if(t>0){const a=.3333333333333333*Math.asinh(3*e/(2*t)*Math.sqrt(3/t));return[-2*Math.sqrt(t/3)*Math.sinh(a)]}return[]}solveQuadraticRoots(){const t=this.c2,e=this.c1,n=this.c0,s=e*e-4*t*n;if(this.almostZero(s))return[-e/(2*t)];if(s>=0){const a=Math.sqrt(s),o=(-e-a)/(2*t),l=(-e+a)/(2*t);return[Math.min(o,l),Math.max(o,l)]}return[]}solveLinearRoot(){return[-this.c0/this.c1]}almostZero(t){return Math.abs(0-t)<=Number.EPSILON}},WS=class ba{constructor(t,e,n,s){this.c0=t,this.c1=e,this.c2=n,this.c3=s,t instanceof Y6?(this.x=t,this.y=e):s!==void 0?(this.x=new Y6(t.x,e.x,n.x,s.x),this.y=new Y6(t.y,e.y,n.y,s.y)):(this.x=new Y6(t.x,e.x,n.x),this.y=new Y6(t.y,e.y,n.y))}eval(t,e=0){return new Z(this.x.differentiate(e).eval(t),this.y.differentiate(e).eval(t))}split(t){const[e,n]=this.x.split(t),[s,a]=this.y.split(t);return[new ba(e,s),new ba(n,a)]}differentiate(t=1){return new ba(this.x.differentiate(t),this.y.differentiate(t))}evalDerivative(t){return this.differentiate().eval(t)}getBounds(){const t=this.x.outputRange01(),e=this.y.outputRange01();return ue.fromPoints(new Z(Math.min(...t),Math.max(...e)),new Z(Math.max(...t),Math.min(...e)))}},SK=class{constructor(r,t=20){this.curve=r,this.sampledDistances=[],this.resample(t)}resample(r){this.sampledDistances=[0];let t=0,e=this.curve.eval(0).position;for(let n=1;n<r;n++){const s=n/(r-1),a=this.curve.eval(s),o=e.sub(a.position).magnitude;t+=o,this.sampledDistances.push(t),e=a.position}this.sampledDistances[this.sampledDistances.length-1]=this.curve.arcLength}pointAtDistance(r){return this.curve.eval(this.distanceToT(r))}distanceToT(r){const t=this.sampledDistances.length;r=pe(0,this.curve.arcLength,r);for(let e=0;e<t;e++){const n=this.sampledDistances[e],s=this.sampledDistances[e+1];if(r>=n&&r<=s)return $v(n,s,e/(t-1),(e+1)/(t-1),r)}return 1}},qS=class extends fl{constructor(r,t){super(),this.curve=r,this.length=t,this.pointSampler=new SK(this)}get arcLength(){return this.length}getBBox(){return this.curve.getBounds()}eval(r){const t=this.tangent(r);return{position:this.curve.eval(r),tangent:t,normal:t.perpendicular}}getPoint(r){const t=this.pointSampler.pointAtDistance(this.arcLength*r);return{position:t.position,tangent:t.tangent,normal:t.tangent.perpendicular}}transformPoints(r){return this.points.map(t=>Q1(t,r))}tangent(r){return this.curve.evalDerivative(r).normalized}draw(r,t=0,e=1,n=!0){let s=null,a=t,o=e,l=this.points;if(t!==0||e!==1){const T=this.length*t,f=this.length*e;a=this.pointSampler.distanceToT(T),o=this.pointSampler.distanceToT(f);const d=(o-a)/(1-a),[,p]=this.split(a);[s]=p.split(d),l=s.points}n&&L1(r,l[0]),(s??this).doDraw(r);const u=this.tangent(a),h=this.tangent(o);return[{position:l[0],tangent:u,normal:u.perpendicular},{position:l.at(-1),tangent:h,normal:h.perpendicular}]}},ZS=class Z4 extends qS{constructor(t,e,n,s){super(new WS(t,t.flipped.add(e).scale(3),t.scale(3).sub(e.scale(6)).add(n.scale(3)),t.flipped.add(e.scale(3)).sub(n.scale(3)).add(s)),Z4.getLength(t,e,n,s)),this.p0=t,this.p1=e,this.p2=n,this.p3=s}get points(){return[this.p0,this.p1,this.p2,this.p3]}split(t){const e=new Z(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),n=new Z(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),s=new Z(this.p2.x+(this.p3.x-this.p2.x)*t,this.p2.y+(this.p3.y-this.p2.y)*t),a=new Z(e.x+(n.x-e.x)*t,e.y+(n.y-e.y)*t),o=new Z(n.x+(s.x-n.x)*t,n.y+(s.y-n.y)*t),l=new Z(a.x+(o.x-a.x)*t,a.y+(o.y-a.y)*t),u=new Z4(this.p0,e,a,l),h=new Z4(l,o,s,this.p3);return[u,h]}doDraw(t){Ff(t,this.p1,this.p2,this.p3)}static getLength(t,e,n,s){return Z4.el.setAttribute("d",`M ${t.x} ${t.y} C ${e.x} ${e.y} ${n.x} ${n.y} ${s.x} ${s.y}`),Z4.el.getTotalLength()}};k([jn(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],ZS,"el",2);var _i=ZS,s2=class extends fl{constructor(r,t){super(),this.from=r,this.to=t,this.vector=t.sub(r),this.length=this.vector.magnitude,this.normal=this.vector.perpendicular.normalized.safe,this.points=[r,t]}get arcLength(){return this.length}draw(r,t=0,e=1,n=!1){const s=this.from.add(this.vector.scale(t)),a=this.from.add(this.vector.scale(e));return n&&L1(r,s),V1(r,a),[{position:s,tangent:this.normal.flipped,normal:this.normal},{position:a,tangent:this.normal,normal:this.normal}]}getPoint(r){return{position:this.from.add(this.vector.scale(r)),tangent:this.normal.flipped,normal:this.normal}}};function EK(r,t,e,n){const s={arcLength:0,segments:[],minSin:1},a=tr(t.top,t.right,t.left,r),o=tr(t.right,t.top,t.bottom,r),l=tr(t.bottom,t.left,t.right,r),u=tr(t.left,t.bottom,t.top,r);let h=new Z(r.left+a,r.top),T=new Z(r.right-o,r.top);return J4(s,new s2(h,T)),h=new Z(r.right,r.top+o),T=new Z(r.right,r.bottom-l),o>0&&oa(s,h.addX(-o),o,Z.down,Z.right,e,n),J4(s,new s2(h,T)),h=new Z(r.right-l,r.bottom),T=new Z(r.left+u,r.bottom),l>0&&oa(s,h.addY(-l),l,Z.right,Z.up,e,n),J4(s,new s2(h,T)),h=new Z(r.left,r.bottom-u),T=new Z(r.left,r.top+a),u>0&&oa(s,h.addX(u),u,Z.up,Z.left,e,n),J4(s,new s2(h,T)),h=new Z(r.left+a,r.top),a>0&&oa(s,h.addY(a),a,Z.left,Z.down,e,n),s}function J4(r,t){r.segments.push(t),r.arcLength+=t.arcLength}function oa(r,t,e,n,s,a,o){const l=t.add(n.scale(e)),u=t.add(s.scale(e));a?J4(r,new _i(l,l.add(s.scale(o*e)),u.add(n.scale(o*e)),u)):J4(r,new zS(t,e,n,s,!1))}function Ql(r){return(t,e)=>{Bf({top:r?`${r}Top`:"top",right:r?`${r}Right`:"right",bottom:r?`${r}Bottom`:"bottom",left:r?`${r}Left`:"left"})(t,e),v4(oL)(t,e)}}function Hh(r,t){const e=pe(0,r.arcLength,t);let n=0;for(const s of r.segments){const a=n;if(n+=s.arcLength,n>=e){const o=(e-a)/s.arcLength;return s.getPoint(pe(0,1,o))}}return{position:Z.zero,tangent:Z.up,normal:Z.up}}function AK(r){let t;return r?typeof r=="string"?t=[{fragment:r}]:Array.isArray(r)?t=r.map(e=>typeof e=="string"?{fragment:e}:e):t=[r]:t=[],!S5().experimentalFeatures&&t.length>0&&(t=[],ce().log({...Jv("Node uses experimental shaders."),inspect:this.key})),t}function Sa(){return S5()}var Xt=class{constructor({children:r,spawner:t,key:e,...n}){this.compositeOverride=M2(0),this.stateStack=[],this.realChildren=[],this.hasSpawnedChildren=!1,this.parent=M2(null),this.properties=BS(this);const s=Sa();[this.key,this.unregister]=s.registerNode(this,e),this.view2D=s.getView(),this.creationStack=new Error().stack,kf(this,n),t&&ce().warn({message:"Node.spawner() has been deprecated.",remarks:"Use <code>Node.children()</code> instead.",inspect:this.key,stack:new Error().stack}),this.children(t??r)}get x(){return this.position.x}get y(){return this.position.y}getAbsolutePosition(){const r=this.localToWorld();return new Z(r.m41,r.m42)}setAbsolutePosition(r){this.position(en(r,t=>Q1(new Z(t),this.worldToParent())))}getAbsoluteRotation(){const r=this.localToWorld();return Z.degrees(r.m11,r.m12)}setAbsoluteRotation(r){this.rotation(en(r,t=>EM(t,this.worldToParent())))}getAbsoluteScale(){const r=this.localToWorld();return new Z(Z.magnitude(r.m11,r.m12),Z.magnitude(r.m21,r.m22))}setAbsoluteScale(r){this.scale(en(r,t=>this.getRelativeScale(new Z(t))))}getRelativeScale(r){var e;const t=((e=this.parent())==null?void 0:e.absoluteScale())??Z.one;return r.div(t)}*tweenCompositeOperation(r,t,e){const n=x1(r);n==="source-over"?(yield*this.compositeOverride(1,t,e),this.compositeOverride(0),this.compositeOperation(n)):(this.compositeOperation(n),this.compositeOverride(1),yield*this.compositeOverride(0,t,e))}absoluteOpacity(){var r;return(((r=this.parent())==null?void 0:r.absoluteOpacity())??1)*this.opacity()}hasFilters(){return!!this.filters().find(r=>r.isActive())}hasShadow(){return!!this.shadowColor()&&(this.shadowBlur()>0||this.shadowOffset.x()!==0||this.shadowOffset.y()!==0)}filterString(){let r="";const t=this.compositeToWorld();for(const e of this.filters())e.isActive()&&(r+=" "+e.serialize(t));return r}getSpawner(){return this.children()}setSpawner(r){this.children(r)}setChildren(r){if(this.children.context.raw()!==r){if(this.children.context.setter(r),!F2(r))this.spawnChildren(!1,r);else if(!this.hasSpawnedChildren)for(const t of this.realChildren)t.parent(null)}}getChildren(){return this.children.context.getter(),this.spawnedChildren()}spawnedChildren(){const r=this.children.context.getter();return F2(this.children.context.raw())&&this.spawnChildren(!0,r),this.realChildren}sortedChildren(){return[...this.children()].sort((r,t)=>Math.sign(r.zIndex()-t.zIndex()))}localToWorld(){const r=this.parent();return r?r.localToWorld().multiply(this.localToParent()):this.localToParent()}worldToLocal(){return this.localToWorld().inverse()}worldToParent(){var r;return((r=this.parent())==null?void 0:r.worldToLocal())??new DOMMatrix}localToParent(){const r=new DOMMatrix;return r.translateSelf(this.x(),this.y()),r.rotateSelf(0,0,this.rotation()),r.scaleSelf(this.scale.x(),this.scale.y()),r.skewXSelf(this.skew.x()),r.skewYSelf(this.skew.y()),r}compositeToWorld(){var r;return((r=this.compositeRoot())==null?void 0:r.localToWorld())??new DOMMatrix}compositeRoot(){var r;return this.composite()?this:((r=this.parent())==null?void 0:r.compositeRoot())??null}compositeToLocal(){const r=this.compositeRoot();if(r){const t=this.worldToLocal();return t.m44=1,r.localToWorld().multiply(t)}return new DOMMatrix}view(){return this.view2D}add(r){return this.insert(r,1/0)}insert(r,t=0){const e=Array.isArray(r)?r:[r];if(e.length===0)return this;const n=this.children(),s=n.slice(0,t);for(const a of e)a instanceof Xt&&(s.push(a),a.remove(),a.parent(this));return s.push(...n.slice(t)),this.setParsedChildren(s),this}remove(){const r=this.parent();return r===null?this:(r.removeChild(this),this.parent(null),this)}move(r=1){const t=this.parent();if(r===0||!t)return this;const e=t.children(),n=[];if(r>0)for(let s=0;s<e.length;s++){const a=e[s];if(a===this){const o=s+r;for(;s<o&&s+1<e.length;s++)n[s]=e[s+1]}n[s]=a}else for(let s=e.length-1;s>=0;s--){const a=e[s];if(a===this){const o=s+r;for(;s>o&&s>0;s--)n[s]=e[s-1]}n[s]=a}return t.setParsedChildren(n),this}moveUp(){return this.move(1)}moveDown(){return this.move(-1)}moveToTop(){return this.move(1/0)}moveToBottom(){return this.move(-1/0)}moveTo(r){const t=this.parent();if(!t)return this;const e=t.children().indexOf(this),n=r-e;return this.move(n)}moveBelow(r,t=!1){const e=this.parent();if(!e)return this;if(r.parent()!==e)return ce().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const n=e.children(),s=n.indexOf(this),a=n.indexOf(r);if(!t&&s<a)return this;const o=a-s-1;return this.move(o)}moveAbove(r,t=!1){const e=this.parent();if(!e)return this;if(r.parent()!==e)return ce().error("Cannot position nodes relative to each other if they don't belong to the same parent."),this;const n=e.children(),s=n.indexOf(this),a=n.indexOf(r);if(!t&&s>a)return this;const o=a-s+1;return this.move(o)}reparent(r){const t=this.absolutePosition(),e=this.absoluteRotation(),n=this.absoluteScale();r.add(this),this.absolutePosition(t),this.absoluteRotation(e),this.absoluteScale(n)}removeChildren(){for(const r of this.realChildren)r.parent(null);this.setParsedChildren([])}peekChildren(){return this.realChildren}findAll(r){const t=[],e=this.reversedChildren();for(;e.length>0;){const n=e.pop();r(n)&&t.push(n);const s=n.children();for(let a=s.length-1;a>=0;a--)e.push(s[a])}return t}findFirst(r){const t=this.reversedChildren();for(;t.length>0;){const e=t.pop();if(r(e))return e;const n=e.children();for(let s=n.length-1;s>=0;s--)t.push(n[s])}return null}findLast(r){const t=[],e=this.reversedChildren();for(;e.length>0;){const n=e.pop();t.push(n);const s=n.children();for(let a=s.length-1;a>=0;a--)e.push(s[a])}for(;t.length>0;){const n=t.pop();if(r(n))return n}return null}findAncestor(r){let t=this.parent();for(;t;){if(r(t))return t;t=t.parent()}return null}childAs(r){return this.children()[r]??null}childrenAs(){return this.children()}parentAs(){return this.parent()??null}dispose(){if(this.unregister){this.stateStack=[],this.unregister(),this.unregister=null;for(const{signal:r}of this)r==null||r.context.dispose();for(const r of this.realChildren)r.dispose()}}clone(r={}){const t={...r};F2(this.children.context.raw())?t.children??(t.children=this.children.context.raw()):this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.clone())));for(const{key:e,meta:n,signal:s}of this)if(!(!n.cloneable||e in t))if(n.compound)for(const[a,o]of n.compoundEntries){if(o in t)continue;const l=s[a];l.context.isInitial()||(t[o]=l.context.raw())}else s.context.isInitial()||(t[e]=s.context.raw());return this.instantiate(t)}snapshotClone(r={}){const t={...this.getState(),...r};return this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.snapshotClone()))),this.instantiate(t)}reactiveClone(r={}){const t={...r};this.children().length>0&&(t.children??(t.children=this.children().map(e=>e.reactiveClone())));for(const{key:e,meta:n,signal:s}of this)!n.cloneable||e in t||(t[e]=()=>s());return this.instantiate(t)}instantiate(r={}){return new this.constructor(r)}setParsedChildren(r){this.children.context.setter(r),this.realChildren=r}spawnChildren(r,t){const e=this.parseChildren(t),n=new Set;for(const s of e){const a=s.parent.context.raw();a&&a!==this&&a.removeChild(s),n.add(s.key),s.parent(this)}for(const s of this.realChildren)n.has(s.key)||s.parent(null);this.hasSpawnedChildren=r,this.realChildren=e}parseChildren(r){const t=[],e=Array.isArray(r)?r:[r];for(const n of e)n instanceof Xt&&t.push(n);return t}removeChild(r){this.setParsedChildren(this.children().filter(t=>t!==r))}requiresCache(){return this.cache()||this.opacity()<1||this.compositeOperation()!=="source-over"||this.hasFilters()||this.hasShadow()||this.shaders().length>0}cacheCanvas(){const r=document.createElement("canvas").getContext("2d");if(!r)throw new Error("Could not create a cache canvas");return r}async cachedCanvas(){const r=this.cacheCanvas(),t=this.worldSpaceCacheBBox(),e=this.localToWorld();return r.canvas.width=t.width,r.canvas.height=t.height,r.setTransform(e.a,e.b,e.c,e.d,e.e-t.x,e.f-t.y),await this.draw(r),r}getCacheBBox(){return new ue}cacheBBox(){const r=this.getCacheBBox(),t=this.children(),e=this.cachePadding();if(t.length===0)return r.addSpacing(e);const n=r.corners;for(const a of t){const o=a.fullCacheBBox(),l=a.localToParent();n.push(...o.corners.map(u=>Q1(u,l)))}return ue.fromPoints(...n).addSpacing(e)}fullCacheBBox(){const r=this.compositeToLocal(),t=hi(this.shadowOffset(),r),e=Wu(this.shadowBlur(),r),n=this.cacheBBox().expand(this.filters.blur()*2+e);return t.x<0?(n.x+=t.x,n.width-=t.x):n.width+=t.x,t.y<0?(n.y+=t.y,n.height-=t.y):n.height+=t.y,n}worldSpaceCacheBBox(){const r=ue.fromSizeCentered(this.view().size()),t=ue.fromPoints(...r.transformCorners(this.view().localToWorld())),e=ue.fromPoints(...this.cacheBBox().transformCorners(this.localToWorld())).pixelPerfect.expand(2);return t.intersection(e)}parentWorldSpaceCacheBBox(){var r;return((r=this.findAncestor(t=>t.requiresCache()))==null?void 0:r.worldSpaceCacheBBox())??new ue(Z.zero,Sa().getSize())}setupDrawFromCache(r){if(r.globalCompositeOperation=this.compositeOperation(),r.globalAlpha*=this.opacity(),this.hasFilters()&&(r.filter=this.filterString()),this.hasShadow()){const e=this.compositeToWorld(),n=hi(this.shadowOffset(),e),s=Wu(this.shadowBlur(),e);r.shadowColor=this.shadowColor().serialize(),r.shadowBlur=s,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y}const t=this.worldToLocal();r.transform(t.a,t.b,t.c,t.d,t.e,t.f)}renderFromSource(r,t,e,n){this.setupDrawFromCache(r);const s=this.compositeOverride();r.drawImage(t,e,n),s>0&&(r.save(),r.globalAlpha*=s,r.globalCompositeOperation="source-over",r.drawImage(t,e,n),r.restore())}shaderCanvas(r,t){var T,f;const e=this.shaders();if(e.length===0)return null;const n=Sa(),s=n.getRealSize(),a=this.parentWorldSpaceCacheBBox(),o=new DOMMatrix().scaleSelf(s.width/a.width,s.height/-a.height).translateSelf(a.x/-s.width,a.y/s.height-1),l=this.worldSpaceCacheBBox(),u=new DOMMatrix().scaleSelf(s.width/l.width,s.height/-l.height).translateSelf(l.x/-s.width,l.y/s.height-1).invertSelf(),h=n.shaders.getGL();n.shaders.copyTextures(r,t),n.shaders.clear();for(const d of e){const p=n.shaders.getProgram(d.fragment);if(p){if(d.uniforms)for(const[m,y]of Object.entries(d.uniforms)){const c=h.getUniformLocation(p,m);if(c===null)continue;const Q=x1(y);typeof Q=="number"?h.uniform1f(c,Q):"toUniform"in Q?Q.toUniform(h,c):Q.length===1?h.uniform1f(c,Q[0]):Q.length===2?h.uniform2f(c,Q[0],Q[1]):Q.length===3?h.uniform3f(c,Q[0],Q[1],Q[2]):Q.length===4&&h.uniform4f(c,Q[0],Q[1],Q[2],Q[3])}h.uniform1f(h.getUniformLocation(p,UQ),this.view2D.globalTime()),h.uniform1i(h.getUniformLocation(p,UQ),n.playback.frame),h.uniformMatrix4fv(h.getUniformLocation(p,BM),!1,u.toFloat32Array()),h.uniformMatrix4fv(h.getUniformLocation(p,FM),!1,o.toFloat32Array()),(T=d.setup)==null||T.call(d,h,p),n.shaders.render(),(f=d.teardown)==null||f.call(d,h,p)}}return h.canvas}async render(r){if(!(this.absoluteOpacity()<=0)){if(r.save(),this.transformContext(r),this.requiresCache()){const t=this.worldSpaceCacheBBox();if(t.width!==0&&t.height!==0){const e=(await this.cachedCanvas()).canvas,n=this.shaderCanvas(r.canvas,e);n?this.renderFromSource(r,n,0,0):this.renderFromSource(r,e,t.position.x,t.position.y)}}else await this.draw(r);r.restore()}}async draw(r){await this.drawChildren(r)}async drawChildren(r){for(const t of this.sortedChildren())await t.render(r)}drawOverlay(r,t){const e=this.cacheBBox().transformCorners(t),n=this.getCacheBBox().transformCorners(t);r.strokeStyle="white",r.lineWidth=1,r.beginPath(),A2(r,e),r.closePath(),r.stroke(),r.strokeStyle="blue",r.beginPath(),A2(r,n),r.closePath(),r.stroke()}transformContext(r){const t=this.localToParent();r.transform(t.a,t.b,t.c,t.d,t.e,t.f)}hit(r){let t=null;const e=Q1(r,this.localToParent().inverse()),n=this.children();for(let s=n.length-1;s>=0&&(t=n[s].hit(e),!t);s--);return t}collectAsyncResources(){for(const r of this.children())r.collectAsyncResources()}async toPromise(){do await n1.consumePromises(),this.collectAsyncResources();while(n1.hasPromises());return this}getState(){const r={};for(const{key:t,meta:e,signal:n}of this)!e.cloneable||t in r||(r[t]=n());return r}applyState(r,t,e=E5){if(t===void 0)for(const s in r){const a=this.signalByKey(s);a&&a(r[s])}const n=[];for(const s in r){const a=this.signalByKey(s);r[s]!==a.context.raw()&&n.push(a(r[s],t,e))}return xe(...n)}save(){this.stateStack.push(this.getState())}restore(r,t=E5){const e=this.stateStack.pop();if(e!==void 0)return this.applyState(e,r,t)}*[Symbol.iterator](){for(const r in this.properties){const t=this.properties[r],e=this.signalByKey(r);yield{meta:t,signal:e,key:r}}}signalByKey(r){return this[r]}reversedChildren(){const r=this.children(),t=[];for(let e=r.length-1;e>=0;e--)t.push(r[e]);return t}};k([M1()],Xt.prototype,"position",2);k([v4(Z),L4(!1),ot()],Xt.prototype,"absolutePosition",2);k([dt(0),ot()],Xt.prototype,"rotation",2);k([L4(!1),ot()],Xt.prototype,"absoluteRotation",2);k([dt(Z.one),M1("scale")],Xt.prototype,"scale",2);k([dt(Z.zero),M1("skew")],Xt.prototype,"skew",2);k([v4(Z),L4(!1),ot()],Xt.prototype,"absoluteScale",2);k([dt(0),ot()],Xt.prototype,"zIndex",2);k([dt(!1),ot()],Xt.prototype,"cache",2);k([Ql("cachePadding")],Xt.prototype,"cachePadding",2);k([dt(!1),ot()],Xt.prototype,"composite",2);k([dt("source-over"),ot()],Xt.prototype,"compositeOperation",2);k([t1()],Xt.prototype,"tweenCompositeOperation",1);k([dt(1),O0(r=>pe(0,1,r)),ot()],Xt.prototype,"opacity",2);k([vt()],Xt.prototype,"absoluteOpacity",1);k([vK()],Xt.prototype,"filters",2);k([dt("#0000"),GS()],Xt.prototype,"shadowColor",2);k([dt(0),ot()],Xt.prototype,"shadowBlur",2);k([M1("shadowOffset")],Xt.prototype,"shadowOffset",2);k([dt([]),O0(AK),ot()],Xt.prototype,"shaders",2);k([vt()],Xt.prototype,"hasFilters",1);k([vt()],Xt.prototype,"hasShadow",1);k([vt()],Xt.prototype,"filterString",1);k([FS(!1),L4(!1),ot()],Xt.prototype,"spawner",2);k([FS(!1),L4(!1),ot()],Xt.prototype,"children",2);k([vt()],Xt.prototype,"spawnedChildren",1);k([vt()],Xt.prototype,"sortedChildren",1);k([vt()],Xt.prototype,"localToWorld",1);k([vt()],Xt.prototype,"worldToLocal",1);k([vt()],Xt.prototype,"worldToParent",1);k([vt()],Xt.prototype,"localToParent",1);k([vt()],Xt.prototype,"compositeToWorld",1);k([vt()],Xt.prototype,"compositeRoot",1);k([vt()],Xt.prototype,"compositeToLocal",1);k([vt()],Xt.prototype,"cacheCanvas",1);k([vt()],Xt.prototype,"cachedCanvas",1);k([vt()],Xt.prototype,"cacheBBox",1);k([vt()],Xt.prototype,"fullCacheBBox",1);k([vt()],Xt.prototype,"worldSpaceCacheBBox",1);k([vt()],Xt.prototype,"parentWorldSpaceCacheBBox",1);Xt=k([k1("Node")],Xt);Xt.prototype.isClass=!0;var Ht=class extends Xt{get columnGap(){return this.gap.x}get rowGap(){return this.gap.y}getX(){return this.isLayoutRoot()?this.x.context.getter():this.computedPosition().x}setX(r){this.x.context.setter(r)}getY(){return this.isLayoutRoot()?this.y.context.getter():this.computedPosition().y}setY(r){this.y.context.setter(r)}get width(){return this.size.x}get height(){return this.size.y}getWidth(){return this.computedSize().width}setWidth(r){this.width.context.setter(r)}*tweenWidth(r,t,e,n){const s=this.desiredSize().x,a=typeof s!="number"||typeof r!="number";let o;a?o=this.size.x():o=s;let l;a?(this.size.x(r),l=this.size.x()):l=r,this.size.x(o),a&&this.lockSize(),yield*rr(t,u=>this.size.x(n(o,l,e(u)))),this.size.x(r),a&&this.releaseSize()}getHeight(){return this.computedSize().height}setHeight(r){this.height.context.setter(r)}*tweenHeight(r,t,e,n){const s=this.desiredSize().y,a=typeof s!="number"||typeof r!="number";let o;a?o=this.size.y():o=s;let l;a?(this.size.y(r),l=this.size.y()):l=r,this.size.y(o),a&&this.lockSize(),yield*rr(t,u=>this.size.y(n(o,l,e(u)))),this.size.y(r),a&&this.releaseSize()}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}*tweenSize(r,t,e,n){const s=this.desiredSize();let a;typeof s.x!="number"||typeof s.y!="number"?a=this.size():a=new Z(s);let o;typeof r=="object"&&typeof r.x=="number"&&typeof r.y=="number"?o=new Z(r):(this.size(r),o=this.size()),this.size(a),this.lockSize(),yield*rr(t,l=>this.size(n(a,o,e(l)))),this.releaseSize(),this.size(r)}constructor(r){super(r),this.element.dataset.motionCanvasKey=this.key}lockSize(){this.sizeLockCounter(this.sizeLockCounter()+1)}releaseSize(){this.sizeLockCounter(this.sizeLockCounter()-1)}parentTransform(){return this.findAncestor(US(Ht))}anchorPosition(){const r=this.computedSize(),t=this.offset();return r.scale(.5).mul(t)}layoutEnabled(){var r;return this.layout()??((r=this.parentTransform())==null?void 0:r.layoutEnabled())??!1}isLayoutRoot(){var r;return!this.layoutEnabled()||!((r=this.parentTransform())!=null&&r.layoutEnabled())}localToParent(){const r=super.localToParent(),t=this.offset();if(!t.exactlyEquals(Z.zero)){const e=this.size().mul(t).scale(-.5);r.translateSelf(e.x,e.y)}return r}scalingRotationMatrix(){const r=new DOMMatrix;r.rotateSelf(0,0,this.rotation()),r.scaleSelf(this.scale.x(),this.scale.y());const t=this.offset();if(!t.exactlyEquals(Z.zero)){const e=this.size().mul(t).scale(-.5);r.translateSelf(e.x,e.y)}return r}getComputedLayout(){return new ue(this.element.getBoundingClientRect())}computedPosition(){this.requestLayoutUpdate();const r=this.getComputedLayout(),t=new Z(r.x+r.width/2*this.offset.x(),r.y+r.height/2*this.offset.y()),e=this.parentTransform();if(e){const n=e.getComputedLayout();t.x-=n.x+(n.width-r.width)/2,t.y-=n.y+(n.height-r.height)/2}return t}computedSize(){return this.requestLayoutUpdate(),this.getComputedLayout().size}requestLayoutUpdate(){const r=this.parentTransform();this.appendedToView()?(r==null||r.requestFontUpdate(),this.updateLayout()):r.requestLayoutUpdate()}appendedToView(){const r=this.isLayoutRoot();return r&&this.view().element.append(this.element),r}updateLayout(){if(this.applyFont(),this.applyFlex(),this.layoutEnabled()){const r=this.layoutChildren();for(const t of r)t.updateLayout()}}layoutChildren(){const r=[...this.children()],t=[],e=[];for(;r.length;){const n=r.shift();n instanceof Ht?n.layoutEnabled()&&(t.push(n),e.push(n.element)):n&&r.unshift(...n.children())}return this.element.replaceChildren(...e),t}requestFontUpdate(){var r;this.appendedToView(),(r=this.parentTransform())==null||r.requestFontUpdate(),this.applyFont()}getCacheBBox(){return ue.fromSizeCentered(this.computedSize())}async draw(r){var t;if(await((t=document.fonts)==null?void 0:t.ready),this.clip()){const e=this.computedSize();if(e.width===0||e.height===0)return;r.beginPath(),r.rect(e.width/-2,e.height/-2,e.width,e.height),r.closePath(),r.clip()}await this.drawChildren(r)}drawOverlay(r,t){const e=this.computedSize(),n=e.mul(this.offset()).scale(.5),s=Q1(n,t),a=ue.fromSizeCentered(e),o=a.transformCorners(t),l=a.addSpacing(this.padding().scale(-1)).transformCorners(t),u=a.addSpacing(this.margin()).transformCorners(t);r.beginPath(),A2(r,u),A2(r,o),r.closePath(),r.fillStyle="rgba(255,193,125,0.6)",r.fill("evenodd"),r.beginPath(),A2(r,o),A2(r,l),r.closePath(),r.fillStyle="rgba(180,255,147,0.6)",r.fill("evenodd"),r.beginPath(),A2(r,o),r.closePath(),r.lineWidth=1,r.strokeStyle="white",r.stroke(),r.beginPath(),r6(r,s),r.stroke()}getOriginDelta(r){const t=this.computedSize().scale(.5),e=this.offset().mul(t);return r===c3.Middle?e.flipped:AM(r).mul(t).sub(e)}moveOffset(r){const t=this.computedSize().scale(.5),e=this.offset().mul(t),n=r.mul(t);this.offset(r),this.position(this.position().add(n).sub(e))}parsePixels(r){return r===null?"":`${r}px`}parseLength(r){return r===null?"":typeof r=="string"?r:`${r}px`}applyFlex(){this.element.style.position=this.isLayoutRoot()?"absolute":"relative";const r=this.desiredSize();this.element.style.width=this.parseLength(r.x),this.element.style.height=this.parseLength(r.y),this.element.style.maxWidth=this.parseLength(this.maxWidth()),this.element.style.minWidth=this.parseLength(this.minWidth()),this.element.style.maxHeight=this.parseLength(this.maxHeight()),this.element.style.minHeight=this.parseLength(this.minHeight()),this.element.style.aspectRatio=this.ratio()===null?"":this.ratio().toString(),this.element.style.marginTop=this.parsePixels(this.margin.top()),this.element.style.marginBottom=this.parsePixels(this.margin.bottom()),this.element.style.marginLeft=this.parsePixels(this.margin.left()),this.element.style.marginRight=this.parsePixels(this.margin.right()),this.element.style.paddingTop=this.parsePixels(this.padding.top()),this.element.style.paddingBottom=this.parsePixels(this.padding.bottom()),this.element.style.paddingLeft=this.parsePixels(this.padding.left()),this.element.style.paddingRight=this.parsePixels(this.padding.right()),this.element.style.flexDirection=this.direction(),this.element.style.flexBasis=this.parseLength(this.basis()),this.element.style.flexWrap=this.wrap(),this.element.style.justifyContent=this.justifyContent(),this.element.style.alignContent=this.alignContent(),this.element.style.alignItems=this.alignItems(),this.element.style.alignSelf=this.alignSelf(),this.element.style.columnGap=this.parseLength(this.gap.x()),this.element.style.rowGap=this.parseLength(this.gap.y()),this.sizeLockCounter()>0?(this.element.style.flexGrow="0",this.element.style.flexShrink="0"):(this.element.style.flexGrow=this.grow().toString(),this.element.style.flexShrink=this.shrink().toString())}applyFont(){if((document.fonts?Array.from(document.fonts).filter(e=>e.status==="loading"):[]).length>0&&n1.collectPromise((async()=>{var e;await((e=document.fonts)==null?void 0:e.ready)})()),this.element.style.fontFamily=this.fontFamily.isInitial()?"":this.fontFamily(),this.element.style.fontSize=this.fontSize.isInitial()?"":`${this.fontSize()}px`,this.element.style.fontStyle=this.fontStyle.isInitial()?"":this.fontStyle(),this.lineHeight.isInitial())this.element.style.lineHeight="";else{const e=this.lineHeight();this.element.style.lineHeight=typeof e=="string"?(parseFloat(e)/100).toString():`${e}px`}if(this.element.style.fontWeight=this.fontWeight.isInitial()?"":this.fontWeight().toString(),this.element.style.letterSpacing=this.letterSpacing.isInitial()?"":`${this.letterSpacing()}px`,this.element.style.textAlign=this.textAlign.isInitial()?"":this.textAlign(),this.textWrap.isInitial()){this.element.style.whiteSpace="";return}const t=this.textWrap();if(typeof t=="boolean"){this.element.style.whiteSpace=t?"normal":"nowrap";return}if(t==="pre"){this.element.style.whiteSpace=t;return}if(t==="balance"){this.element.style.whiteSpace="normal",this.element.style.textWrap=t;return}}dispose(){var r;super.dispose(),(r=this.sizeLockCounter)==null||r.context.dispose(),this.element&&(this.element.remove(),this.element.innerHTML=""),this.element=null,this.styles=null}hit(r){const t=Q1(r,this.localToParent().inverse());return this.cacheBBox().includes(t)?super.hit(r)??this:null}};k([dt(null),Rf(VH),ot()],Ht.prototype,"layout",2);k([dt(null),ot()],Ht.prototype,"maxWidth",2);k([dt(null),ot()],Ht.prototype,"maxHeight",2);k([dt(null),ot()],Ht.prototype,"minWidth",2);k([dt(null),ot()],Ht.prototype,"minHeight",2);k([dt(null),ot()],Ht.prototype,"ratio",2);k([Ql("margin")],Ht.prototype,"margin",2);k([Ql("padding")],Ht.prototype,"padding",2);k([dt("row"),ot()],Ht.prototype,"direction",2);k([dt(null),ot()],Ht.prototype,"basis",2);k([dt(0),ot()],Ht.prototype,"grow",2);k([dt(1),ot()],Ht.prototype,"shrink",2);k([dt("nowrap"),ot()],Ht.prototype,"wrap",2);k([dt("start"),ot()],Ht.prototype,"justifyContent",2);k([dt("normal"),ot()],Ht.prototype,"alignContent",2);k([dt("stretch"),ot()],Ht.prototype,"alignItems",2);k([dt("auto"),ot()],Ht.prototype,"alignSelf",2);k([dt(0),M1({x:"columnGap",y:"rowGap"})],Ht.prototype,"gap",2);k([Lr("font-family"),ot()],Ht.prototype,"fontFamily",2);k([Lr("font-size",parseFloat),ot()],Ht.prototype,"fontSize",2);k([Lr("font-style"),ot()],Ht.prototype,"fontStyle",2);k([Lr("font-weight",parseInt),ot()],Ht.prototype,"fontWeight",2);k([Lr("line-height",parseFloat),ot()],Ht.prototype,"lineHeight",2);k([Lr("letter-spacing",r=>r==="normal"?0:parseFloat(r)),ot()],Ht.prototype,"letterSpacing",2);k([Lr("white-space",r=>r==="pre"?"pre":r==="normal"),ot()],Ht.prototype,"textWrap",2);k([dt("inherit"),ot()],Ht.prototype,"textDirection",2);k([Lr("text-align"),ot()],Ht.prototype,"textAlign",2);k([dt({x:null,y:null}),M1({x:"width",y:"height"})],Ht.prototype,"size",2);k([t1()],Ht.prototype,"tweenWidth",1);k([t1()],Ht.prototype,"tweenHeight",1);k([vt()],Ht.prototype,"desiredSize",1);k([t1()],Ht.prototype,"tweenSize",1);k([M1("offset")],Ht.prototype,"offset",2);k([Ci(c3.Middle)],Ht.prototype,"middle",2);k([Ci(c3.Top)],Ht.prototype,"top",2);k([Ci(c3.Bottom)],Ht.prototype,"bottom",2);k([Ci(c3.Left)],Ht.prototype,"left",2);k([Ci(c3.Right)],Ht.prototype,"right",2);k([Ci(c3.TopLeft)],Ht.prototype,"topLeft",2);k([Ci(c3.TopRight)],Ht.prototype,"topRight",2);k([Ci(c3.BottomLeft)],Ht.prototype,"bottomLeft",2);k([Ci(c3.BottomRight)],Ht.prototype,"bottomRight",2);k([dt(!1),ot()],Ht.prototype,"clip",2);k([dt(0),ot()],Ht.prototype,"sizeLockCounter",2);k([vt()],Ht.prototype,"parentTransform",1);k([vt()],Ht.prototype,"anchorPosition",1);k([vt()],Ht.prototype,"layoutEnabled",1);k([vt()],Ht.prototype,"isLayoutRoot",1);k([vt()],Ht.prototype,"scalingRotationMatrix",1);k([vt()],Ht.prototype,"computedPosition",1);k([vt()],Ht.prototype,"computedSize",1);k([vt()],Ht.prototype,"requestLayoutUpdate",1);k([vt()],Ht.prototype,"appendedToView",1);k([vt()],Ht.prototype,"updateLayout",1);k([vt()],Ht.prototype,"layoutChildren",1);k([vt()],Ht.prototype,"requestFontUpdate",1);k([vt()],Ht.prototype,"applyFlex",1);k([vt()],Ht.prototype,"applyFont",1);Ht=k([k1("Layout")],Ht);function Ci(r){return(t,e)=>{ot()(t,e),L4(!1)(t,e);const n=y4(t,e);n.parser=s=>new Z(s),n.getter=function(){const s=this.computedSize().getOriginOffset(r);return Q1(s,this.localToParent())},n.setter=function(s){return this.position(en(s,a=>{const o=this.getOriginDelta(r);return hi(o,this.scalingRotationMatrix()).flipped.add(a)})),this}}}i6(Ht.prototype,r=>{r.element=document.createElement("div"),r.element.style.display="flex",r.element.style.boxSizing="border-box",r.styles=getComputedStyle(r.element)});var s1=class extends Ht{constructor(r){super(r),this.rippleStrength=M2(0)}rippleSize(){return iL(this.rippleStrength(),0,50)}applyText(r){r.direction=this.textDirection(),this.element.dir=this.textDirection()}applyStyle(r){r.fillStyle=Eh(this.fill(),r),r.strokeStyle=Eh(this.stroke(),r),r.lineWidth=this.lineWidth(),r.lineJoin=this.lineJoin(),r.lineCap=this.lineCap(),r.setLineDash(this.lineDash()),r.lineDashOffset=this.lineDashOffset(),this.antialiased()||(r.filter="url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxmaWx0ZXIgaWQ9ImZpbHRlciIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIj48ZmVDb21wb25lbnRUcmFuc2Zlcj48ZmVGdW5jUiB0eXBlPSJpZGVudGl0eSIvPjxmZUZ1bmNHIHR5cGU9ImlkZW50aXR5Ii8+PGZlRnVuY0IgdHlwZT0iaWRlbnRpdHkiLz48ZmVGdW5jQSB0eXBlPSJkaXNjcmV0ZSIgdGFibGVWYWx1ZXM9IjAgMSIvPjwvZmVDb21wb25lbnRUcmFuc2Zlcj48L2ZpbHRlcj48L3N2Zz4=#filter)")}async draw(r){this.drawShape(r),this.clip()&&r.clip(this.getPath()),await this.drawChildren(r)}drawShape(r){const t=this.getPath(),e=this.lineWidth()>0&&this.stroke()!==null,n=this.fill()!==null;r.save(),this.applyStyle(r),this.drawRipple(r),this.strokeFirst()?(e&&r.stroke(t),n&&r.fill(t)):(n&&r.fill(t),e&&r.stroke(t)),r.restore()}getCacheBBox(){return super.getCacheBBox().expand(this.lineWidth()/2)}getPath(){return new Path2D}getRipplePath(){return new Path2D}drawRipple(r){const t=this.rippleStrength();if(t>0){const e=this.getRipplePath();r.save(),r.globalAlpha*=Ft(.54,0,t),r.fill(e),r.restore()}}*ripple(r=1){this.rippleStrength(0),yield*this.rippleStrength(1,r,rL),this.rippleStrength(0)}};k([jS()],s1.prototype,"fill",2);k([jS()],s1.prototype,"stroke",2);k([dt(!1),ot()],s1.prototype,"strokeFirst",2);k([dt(0),ot()],s1.prototype,"lineWidth",2);k([dt("miter"),ot()],s1.prototype,"lineJoin",2);k([dt("butt"),ot()],s1.prototype,"lineCap",2);k([dt([]),ot()],s1.prototype,"lineDash",2);k([dt(0),ot()],s1.prototype,"lineDashOffset",2);k([dt(!0),ot()],s1.prototype,"antialiased",2);k([vt()],s1.prototype,"rippleSize",1);k([vt()],s1.prototype,"getPath",1);k([t1()],s1.prototype,"ripple",1);s1=k([k1("Shape")],s1);var p1=class extends s1{constructor(r){super(r),this.canHaveSubpath=!1}desiredSize(){return this.childrenBBox().size}percentageToDistance(r){return pe(0,this.baseArcLength(),this.startOffset()+this.offsetArcLength()*r)}distanceToPercentage(r){return(r-this.startOffset())/this.offsetArcLength()}baseArcLength(){return this.profile().arcLength}offsetArcLength(){const r=this.startOffset(),t=this.endOffset(),e=this.baseArcLength();return pe(0,e,e-r-t)}arcLength(){return this.offsetArcLength()*Math.abs(this.start()-this.end())}completion(){return Math.abs(this.start()-this.end())}processSubpath(r,t,e){}curveDrawingInfo(){const r=new Path2D;let t=new Path2D;const e=this.profile();let n=this.percentageToDistance(this.start()),s=this.percentageToDistance(this.end());n>s&&([n,s]=[s,n]);const a=s-n,o=Math.min(a/2,this.arrowSize());this.startArrow()&&(n+=o/2),this.endArrow()&&(s-=o/2);let l=0,u=null,h=null,T=null,f=null;for(const d of e.segments){const p=l;if(l+=d.arcLength,l<n)continue;const m=(n-p)/d.arcLength,y=(s-p)/d.arcLength,c=pe(0,1,m),Q=pe(0,1,y);this.canHaveSubpath&&T&&!d.getPoint(0).position.equals(T)&&(r.addPath(t),this.processSubpath(t,u,T),t=new Path2D,u=null);const[g,v]=d.draw(t,c,Q,u===null);if(u===null&&(u=g.position,h=g.normal.flipped.perpendicular),T=v.position,f=v.normal.flipped.perpendicular,l>s)break}return this.closed()&&this.start.isInitial()&&this.end.isInitial()&&this.startOffset.isInitial()&&this.endOffset.isInitial()&&t.closePath(),this.processSubpath(t,u,T),r.addPath(t),{startPoint:u??Z.zero,startTangent:h??Z.right,endPoint:T??Z.zero,endTangent:f??Z.right,arrowSize:o,path:r,startOffset:n}}getPointAtDistance(r){return Hh(this.profile(),r+this.startOffset())}getPointAtPercentage(r){return Hh(this.profile(),this.percentageToDistance(r))}getComputedLayout(){return this.offsetComputedLayout(super.getComputedLayout())}offsetComputedLayout(r){return r.position=r.position.sub(this.childrenBBox().center),r}getPath(){return this.curveDrawingInfo().path}getCacheBBox(){const r=this.childrenBBox(),t=this.startArrow()||this.endArrow()?this.arrowSize():0,e=this.lineWidth(),n=this.lineWidthCoefficient();return r.expand(Math.max(0,t,e*n))}lineWidthCoefficient(){return this.lineCap()==="square"?.5*1.4143:.5}requiresProfile(){return!this.start.isInitial()||!this.startOffset.isInitial()||!this.startArrow.isInitial()||!this.end.isInitial()||!this.endOffset.isInitial()||!this.endArrow.isInitial()}drawShape(r){super.drawShape(r),(this.startArrow()||this.endArrow())&&this.drawArrows(r)}drawArrows(r){const{startPoint:t,startTangent:e,endPoint:n,endTangent:s,arrowSize:a}=this.curveDrawingInfo();a<.001||(r.save(),r.beginPath(),this.endArrow()&&this.drawArrow(r,n,s.flipped,a),this.startArrow()&&this.drawArrow(r,t,e,a),r.fillStyle=Eh(this.stroke(),r),r.closePath(),r.fill(),r.restore())}drawArrow(r,t,e,n){const s=e.perpendicular,a=t.add(e.scale(-n/2));L1(r,a),V1(r,a.add(e.add(s).scale(n))),V1(r,a.add(e.sub(s).scale(n))),V1(r,a),r.closePath()}};k([dt(!1),ot()],p1.prototype,"closed",2);k([dt(0),ot()],p1.prototype,"start",2);k([dt(0),ot()],p1.prototype,"startOffset",2);k([dt(!1),ot()],p1.prototype,"startArrow",2);k([dt(1),ot()],p1.prototype,"end",2);k([dt(0),ot()],p1.prototype,"endOffset",2);k([dt(!1),ot()],p1.prototype,"endArrow",2);k([dt(24),ot()],p1.prototype,"arrowSize",2);k([vt()],p1.prototype,"arcLength",1);k([vt()],p1.prototype,"curveDrawingInfo",1);p1=k([k1("Curve")],p1);var E1=class extends p1{constructor(r){super(r)}profile(){return EK(this.childrenBBox(),this.radius(),this.smoothCorners(),this.cornerSharpness())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(r){return r}childrenBBox(){return ue.fromSizeCentered(this.computedSize())}getPath(){if(this.requiresProfile())return this.curveDrawingInfo().path;const r=new Path2D,t=this.radius(),e=this.smoothCorners(),n=this.cornerSharpness(),s=ue.fromSizeCentered(this.size());return $y(r,s,t,e,n),r}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}getRipplePath(){const r=new Path2D,t=this.rippleSize(),e=this.radius().addScalar(t),n=this.smoothCorners(),s=this.cornerSharpness(),a=ue.fromSizeCentered(this.size()).expand(t);return $y(r,a,e,n,s),r}};k([Ql("radius")],E1.prototype,"radius",2);k([dt(!1),ot()],E1.prototype,"smoothCorners",2);k([dt(.6),ot()],E1.prototype,"cornerSharpness",2);k([vt()],E1.prototype,"profile",1);E1=k([k1("Rect")],E1);var HK="\nThe `playbackRate` of a `Video` cannot be reactive.\n\nMake sure to use a concrete value and not a function:\n\n```ts wrong\nvideo.playbackRate(() => 7);\n```\n\n```ts correct\nvideo.playbackRate(7);\n```\n\nIf you're using a signal, extract its value before passing it to the property:\n\n```ts wrong\nvideo.playbackRate(mySignal);\n```\n\n```ts correct\nvideo.playbackRate(mySignal());\n```\n",c1=class extends E1{constructor(r){super(r),this.lastTime=-1,this.isSchedulingPlay=!1,this.trimStart=0,this.awaitCanPlay()||setTimeout(()=>this.scheduleSeek(this.time()),0),r.play&&this.play(),this.volume=r.volume??1,this.clipStart=r.clipStart,this.trimStart=r.trimStart??0,this.awaitCanPlay()||this.setVolume(this.volume)}isPlaying(){return this.playing()}getCurrentTime(){return this.clampTime(this.time())}getDuration(){try{const r=this.mediaElement(),t=r instanceof HTMLVideoElement,e=r instanceof HTMLAudioElement;return this.isIOS()&&(t||e)?2:r.duration}catch{return 0}}getVolume(){return this.volume}getUrl(){try{return this.mediaElement().src}catch{return this.src()}}dispose(){this.playing(!1),this.time.save(),this.remove(),super.dispose()}completion(){return this.clampTime(this.time())/this.getDuration()}syncToCurrentTime(r,t){let e;r!==void 0&&this.clipStart!==void 0?e=this.trimStart+(r-this.clipStart)*this.playbackRate():e=r??this.time();const n=this.setCurrentTime(e,{skipCollectPromise:(t==null?void 0:t.waitForSeek)??!0});if(t!=null&&t.waitForSeek)return n}setCurrentTime(r,t){try{const e=this.mediaElement(),n=this.key??"media";if(e.readyState<2)return this.lastTime=r,this.time(r),new Promise(a=>{this.waitForCanPlay(e,()=>{e.currentTime=r,this.lastTime=r,this.time(r);const o=()=>{e.removeEventListener("seeked",o),a()};e.seeking?e.addEventListener("seeked",o):a()})});e.currentTime=r,this.lastTime=r,this.time(r);const s=e.seeking?new Promise(a=>{const o=()=>{a(),e.removeEventListener("seeked",o)};e.addEventListener("seeked",o)}):Promise.resolve();return e.seeking&&!(t!=null&&t.skipCollectPromise)&&n1.collectPromise(s),s}catch{return this.lastTime=r,this.time(r),Promise.resolve()}}setVolume(r){r<0&&console.warn("volumes cannot be negative - the value will be clamped to 0."),this.volume=r;try{const t=this.mediaElement();if(t.volume=Math.min(Math.max(r,0),1),r>1){if(this.allowVolumeAmplificationInPreview()){this.amplify(t,r);return}console.warn(`you have set the volume of node ${this.key} to ${r} - your video will be exported with the correct volume, but the browser does not support volumes higher than 1 by default. To enable volume amplification in the preview, set the "allowVolumeAmplificationInPreview" of your <Video/> or <Audio/> tag to true. Note that amplification for previews will not work if you use autoplay within the player due to browser autoplay policies: https://developer.chrome.com/blog/autoplay/#webaudio.`)}}catch{}}amplify(r,t){const e=`${this.src()}/${this.key}`;if(c1.amplificationPool[e]){c1.amplificationPool[e].gainNode.gain.value=t;return}const n=new AudioContext,s=n.createMediaElementSource(r),a=n.createGain();if(a.gain.value=t,s.connect(a),a.connect(n.destination),c1.amplificationPool[e]={audioContext:n,sourceNode:s,gainNode:a},typeof window>"u"||n.state!=="suspended")return;const o=()=>{c1.amplificationPool[e].audioContext.resume(),window.removeEventListener("click",o)};window.addEventListener("click",o)}setPlaybackRate(r){let t;if(F2(r)?(t=r(),ce().warn({message:"Invalid value set as the playback rate",remarks:HK,inspect:this.key,stack:new Error().stack})):t=r,this.playbackRate.context.setter(t),this.playing())if(t===0)this.pause();else{const e=bi().time,n=e(),s=this.time();this.time(()=>this.clampTime(s+(e()-n)*t))}}scheduleSeek(r){setTimeout(()=>{try{const t=this.mediaElement();this.waitForCanPlay(t,()=>{t.currentTime=r})}catch{setTimeout(()=>this.scheduleSeek(r),50)}},0)}waitForCanPlay(r,t){if(r.readyState>=3){t();return}const e=()=>{t(),r.removeEventListener("canplay",e),r.removeEventListener("canplaythrough",e)},n=()=>{var o;const s=this.getErrorReason((o=r.error)==null?void 0:o.code),a=this.src();console.error(`Error loading video: src="${a}", ${s}`),console.error(`Media element src: "${r.src}"`),r.removeEventListener("error",n),r.removeEventListener("canplay",e),r.removeEventListener("canplaythrough",e)};r.addEventListener("canplay",e),r.addEventListener("canplaythrough",e),r.addEventListener("error",n)}waitForCanPlayNecessary(r){return r.readyState>=2?!1:this.awaitCanPlay()||this.view().playbackState()===$1.Rendering}play(){this.playing(!0),this.schedulePlay()}schedulePlay(){if(this.isSchedulingPlay)return;this.isSchedulingPlay=!0;let r=null;try{r=bi().time}catch{this.isSchedulingPlay=!1,this.simplePlay();return}setTimeout(()=>{if(!this.playing()){this.isSchedulingPlay=!1;return}setTimeout(()=>{try{const e=this.mediaElement();this.waitForCanPlay(e,()=>{this.playing()&&r&&this.actuallyPlay(e,r),this.isSchedulingPlay=!1})}catch{this.isSchedulingPlay=!1,setTimeout(()=>this.schedulePlay(),100)}},10)},0)}simplePlay(){setTimeout(()=>{try{const r=this.mediaElement();if(!r.src||r.src.includes("undefined"))return;if(r.paused&&this.playing()){r.playbackRate=this.playbackRate();const t=r.play();t!==void 0&&t.then(()=>{}).catch(e=>{e.name!=="AbortError"&&console.warn("Error in simple play:",e),this.view().playbackState()!==$1.Rendering&&this.playing(!1)})}}catch{return}},10)}actuallyPlay(r,t){if(!this.playing())return;if(r.playbackRate=this.playbackRate(),r.paused){const s=r.play();s!==void 0&&s.then(()=>{}).catch(a=>{a.name!=="AbortError"&&console.warn("Error playing media:",a),this.view().playbackState()!==$1.Rendering&&this.playing(!1)})}const e=t(),n=r.currentTime;this.time(()=>this.clampTime(n+(t()-e)*this.playbackRate()))}pause(){this.playing(!1),this.time.save(),setTimeout(()=>{try{this.mediaElement().pause()}catch{}},0)}clampTime(r){const t=this.getDuration();return this.loop()&&(r%=t),pe(0,t,r)}collectAsyncResources(){super.collectAsyncResources(),this.seekedMedia(),this.setVolume(this.volume)}autoPlayBasedOnTwick(){const r=this.view().playbackState(),t=r===$1.Playing||r===$1.Presenting||r===$1.Rendering;t&&!this.playing()?(r===$1.Rendering&&this.playing(!0),this.play()):!t&&this.playing()&&this.pause()}getErrorReason(r){let t;switch(r){case 1:t="MEDIA_ERR_ABORTED";break;case 2:t="MEDIA_ERR_NETWORK. This might be a 404 error.";break;case 3:t="MEDIA_ERR_DECODE. This might be an issue with your video file.";break;case 4:t="MEDIA_ERR_SRC_NOT_SUPPORTED. If you are sure that the path to the video is correct, this might be a CORS error.";break;default:t="UNKNOWN"}return t}isIOS(){return typeof navigator>"u"?!1:/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}};c1.amplificationPool={};k([dt(""),ot()],c1.prototype,"src",2);k([dt(!1),ot()],c1.prototype,"loop",2);k([dt(1),ot()],c1.prototype,"playbackRate",2);k([dt(0),ot()],c1.prototype,"time",2);k([dt(!1),ot()],c1.prototype,"playing",2);k([dt(!0),ot()],c1.prototype,"awaitCanPlay",2);k([dt(!1),ot()],c1.prototype,"allowVolumeAmplificationInPreview",2);k([vt()],c1.prototype,"completion",1);k([vt()],c1.prototype,"amplify",1);c1=k([k1("Media")],c1);var w2=class extends c1{constructor(r){super(r)}mediaElement(){return this.audio()}seekedMedia(){return this.seekedAudio()}fastSeekedMedia(){return this.fastSeekedAudio()}audio(){const r=this.src(),t=`${this.key}/${r||"pending"}`;let e=w2.pool[t];if(!e)e=document.createElement("audio"),e.crossOrigin="anonymous",r&&r!=="undefined"&&(e.src=r),w2.pool[t]=e;else if(r&&r!=="undefined"&&e.src!==r){e.src=r,delete w2.pool[t];const s=`${this.key}/${r}`;w2.pool[s]=e}return(!r||r==="undefined")&&n1.collectPromise(new Promise(s=>{const a=()=>{const o=this.src();o&&o!=="undefined"?s():setTimeout(a,10)};a()})),this.waitForCanPlayNecessary(e)&&n1.collectPromise(new Promise(s=>{this.waitForCanPlay(e,s)})),e}seekedAudio(){const r=this.audio();if(r.addEventListener("ended",()=>{this.pause()}),!(this.time()<r.duration))return this.pause(),r;const t=this.clampTime(this.time());return r.playbackRate=this.playbackRate(),r.paused||r.pause(),this.lastTime===t||this.setCurrentTime(t),r}fastSeekedAudio(){const r=this.audio();if(!(this.time()<r.duration))return this.pause(),r;const t=this.clampTime(this.time());if(r.playbackRate=this.playbackRate(),this.lastTime===t)return r;const e=this.playing()&&t<r.duration&&r.playbackRate>0;return e?r.paused&&n1.collectPromise(r.play()):r.paused||r.pause(),Math.abs(r.currentTime-t)>.3?this.setCurrentTime(t):e||(r.currentTime=t),r}async draw(r){this.autoPlayBasedOnTwick();const t=this.view().playbackState();t===$1.Playing||t===$1.Presenting?this.fastSeekedAudio():this.seekedAudio(),r.save(),r.restore(),await this.drawChildren(r)}};w2.pool={};k([vt()],w2.prototype,"audio",1);k([vt()],w2.prototype,"seekedAudio",1);k([vt()],w2.prototype,"fastSeekedAudio",1);w2=k([k1("Audio")],w2);var Uf=class extends p1{profile(){const r=this.segment();return{segments:[r],arcLength:r.arcLength,minSin:0}}childrenBBox(){return ue.fromPoints(...this.segment().points)}desiredSize(){return this.segment().getBBox().size}offsetComputedLayout(r){return r.position=r.position.sub(this.segment().getBBox().center),r}drawOverlay(r,t){const e=this.computedSize(),n=this.childrenBBox().transformCorners(t),s=e.mul(this.offset()).scale(.5),a=Q1(s,t),o=this.overlayInfo(t);r.lineWidth=1,r.strokeStyle="white",r.fillStyle="white",r.stroke(o.curve),r.fillStyle="white",r.globalAlpha=.5,r.beginPath(),r.stroke(o.handleLines),r.globalAlpha=1,r.lineWidth=2;for(const l of[o.startPoint,o.endPoint])L1(r,l),r.beginPath(),xi(r,l,4),r.closePath(),r.stroke(),r.fill();r.fillStyle="black";for(const l of o.controlPoints)L1(r,l),r.beginPath(),xi(r,l,4),r.closePath(),r.fill(),r.stroke();r.lineWidth=1,r.beginPath(),r6(r,a),r.stroke(),r.beginPath(),A2(r,n),r.closePath(),r.stroke()}};k([vt()],Uf.prototype,"childrenBBox",1);var KS=class K4 extends qS{constructor(t,e,n){super(new WS(t,t.flipped.add(e).scale(2),t.sub(e.scale(2)).add(n)),K4.getLength(t,e,n)),this.p0=t,this.p1=e,this.p2=n}get points(){return[this.p0,this.p1,this.p2]}split(t){const e=new Z(this.p0.x+(this.p1.x-this.p0.x)*t,this.p0.y+(this.p1.y-this.p0.y)*t),n=new Z(this.p1.x+(this.p2.x-this.p1.x)*t,this.p1.y+(this.p2.y-this.p1.y)*t),s=new Z(e.x+(n.x-e.x)*t,e.y+(n.y-e.y)*t),a=new K4(this.p0,e,s),o=new K4(s,n,this.p2);return[a,o]}static getLength(t,e,n){return K4.el.setAttribute("d",`M ${t.x} ${t.y} Q ${e.x} ${e.y} ${n.x} ${n.y}`),K4.el.getTotalLength()}doDraw(t){Nf(t,this.p1,this.p2)}};k([jn(()=>document.createElementNS("http://www.w3.org/2000/svg","path"))],KS,"el",2);var L5=KS;function Jy(r){return r instanceof _i}function MK(r,t,e,n){if(r.auto.start===0&&r.auto.end===0)return;const s=r.position.sub(t.position).magnitude,a=e.position.sub(r.position).magnitude,o=n*s/(s+a),l=n-o,u=new Z(r.position.x-o*(e.position.x-t.position.x),r.position.y-o*(e.position.y-t.position.y)),h=new Z(r.position.x+l*(e.position.x-t.position.x),r.position.y+l*(e.position.y-t.position.y));r.startHandle=r.startHandle.lerp(u,r.auto.start),r.endHandle=r.endHandle.lerp(h,r.auto.end)}function wK(r){for(let t=0;t<r.segments.length;t++){const e=r.segments[t],n=r.segments[(t+1)%r.segments.length];if(!Jy(e)||!Jy(n))continue;const s=e.p2.sub(e.p3).normalized.safe,a=n.p1.sub(n.p0).normalized.safe,o=s.dot(a);if(!(1-Math.abs(o)>1e-4))continue;const u=Math.acos(pe(-1,1,o)),h=Math.sin(u/2);r.minSin=Math.min(r.minSin,Math.abs(h))}}function z4(r,t,e,n,s){const a=s!==void 0?new _i(t,e,n,s):new L5(t,e,n);r.segments.push(a),r.arcLength+=a.arcLength}function CK(r,t,e){const n={segments:[],arcLength:0,minSin:1},s=r.length;for(let h=0;h<s;h++){const T=(h-1+s)%s,f=(h+1)%s;MK(r[h],r[T],r[f],e)}const a=r[0],o=r[1];!t&&a.auto.start===1&&a.auto.end===1?z4(n,a.position,o.startHandle,o.position):z4(n,a.position,a.endHandle,o.startHandle,o.position);for(let h=1;h<s-2;h++){const T=r[h],f=r[h+1];z4(n,T.position,T.endHandle,f.startHandle,f.position)}const l=r.at(-1),u=r.at(-2);return r.length>2&&(!t&&l.auto.start===1&&l.auto.end===1?z4(n,u.position,u.endHandle,l.position):z4(n,u.position,u.endHandle,l.startHandle,l.position)),t&&z4(n,l.position,l.endHandle,a.startHandle,a.position),wK(n),n}var o3=class extends E1{constructor(r){super({composite:!0,fontFamily:"Roboto",fontSize:48,lineHeight:"120%",textWrap:!1,fontStyle:"normal",...r}),this.view2D=this,o3.shadowRoot.append(this.element),this.applyFlex()}dispose(){this.removeChildren(),super.dispose()}async render(r){this.computedSize(),this.computedPosition(),await super.render(r)}findKey(r){return Sa().getNode(r)??null}requestLayoutUpdate(){this.updateLayout()}requestFontUpdate(){this.applyFont()}view(){return this}};k([dt($1.Paused),ot()],o3.prototype,"playbackState",2);k([dt(0),ot()],o3.prototype,"globalTime",2);k([dt(0),ot()],o3.prototype,"fps",2);k([ot()],o3.prototype,"assetHash",2);k([jn(()=>{const r="twick-2d-frame";let t=document.querySelector(`#${r}`);return t||(t=document.createElement("div"),t.id=r,t.style.position="absolute",t.style.pointerEvents="none",t.style.top="0",t.style.left="0",t.style.fontFeatureSettings="normal",t.style.opacity="0",t.style.overflow="hidden",document.body.prepend(t)),t.shadowRoot??t.attachShadow({mode:"open"})})],o3,"shadowRoot",2);o3=k([k1("View2D")],o3);var XS=class Ea extends fl{constructor(t,e,n,s,a,o){super(),this.startPoint=t,this.radius=e,this.xAxisRotationDegree=n,this.largeArcFlag=s,this.sweepFlag=a,this.endPoint=o,this.xAxisRotation=this.xAxisRotationDegree*Xi,this.radius=new Z(Math.abs(e.x),Math.abs(e.y));const l=A5.fromRotation(-n).domMatrix,u=hi(t.sub(o).div(2),l),h=u.x*u.x/(e.x*e.x)+u.y*u.y/(e.y*e.y);if(h>1){const y=Math.sqrt(h);e.x=y*e.x,e.y=y*e.y}const T=new Z(e.ctg*u.y,e.perpendicular.ctg*u.x).scale(Math.sqrt(1/(u.x*u.x/(e.x*e.x)+u.y*u.y/(e.y*e.y))-1)*(s===a?-1:1));this.xAxisRotationMatrix=A5.fromRotation(n).domMatrix;const f=hi(T,this.xAxisRotationMatrix);this.center=f.add(t.add(o).div(2));const d=u.sub(T).div(e),p=u.scale(-1).sub(T).div(e);this.startAngle=d.radians,this.deltaAngle=Z.angleBetween(d,p)%(Math.PI*2),this.sweepFlag===0&&this.deltaAngle>0&&(this.deltaAngle-=Math.PI*2),this.sweepFlag===1&&this.deltaAngle<0&&(this.deltaAngle+=Math.PI*2),Ea.el.setAttribute("d",`M ${this.startPoint.x} ${this.startPoint.y} A ${this.radius.x} ${this.radius.y} ${this.xAxisRotationDegree} ${this.largeArcFlag} ${this.sweepFlag} ${this.endPoint.x} ${this.endPoint.y}`),this.length=Ea.el.getTotalLength();const m=new ue(Ea.el.getBBox());this.points=[m.topLeft,m.bottomRight]}getAnglePosition(t){return hi(this.radius.mul(Z.fromRadians(t)),this.xAxisRotationMatrix).add(this.center)}getAngleDerivative(t){const e=new Z(-this.radius.x*Math.sin(t),this.radius.y*Math.cos(t));return hi(e,this.xAxisRotationMatrix)}draw(t,e,n,s){const a=this.startAngle+this.deltaAngle*e,o=this.startAngle+this.deltaAngle*n,l=this.getPoint(e),u=this.getPoint(n);return s&&t.moveTo(l.position.x,l.position.y),t.ellipse(this.center.x,this.center.y,this.radius.x,this.radius.y,this.xAxisRotation,a,o,this.sweepFlag===0),[l,u]}getPoint(t){const e=this.startAngle+t*this.deltaAngle,n=this.getAngleDerivative(e).normalized;return{position:t===0?this.startPoint:t===1?this.endPoint:this.getAnglePosition(e),tangent:n,normal:n.perpendicular}}get arcLength(){return this.length}};k([jn(()=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","path");return r.appendChild(t),o3.shadowRoot.appendChild(r),t})],XS,"el",2);var $S=XS;function DK(r,t,e,n,s=!1){const a={arcLength:0,minSin:1,segments:[]};if(e<t){const T=Math.floor((t-e)/(Math.PI*2))+1;e+=Math.PI*2*T}else if(e>t+Math.PI*2){const T=Math.floor((e-t)/(Math.PI*2));e-=Math.PI*2*T}const o=(t+e)/2,l=r.mul(Z.fromRadians(t)),u=r.mul(Z.fromRadians(e)),h=r.mul(Z.fromRadians(o)).scale(s?-1:1);return n&&Mh(a,new s2(Z.zero,l)),tv(a,r,l,h,t,o,s),tv(a,r,h,u,o,e,s),n&&Mh(a,new s2(u,Z.zero)),a}function Mh(r,t){r.segments.push(t),r.arcLength+=t.arcLength}function tv(r,t,e,n,s,a,o){const l=Math.abs(s-a)<=180?1:0,u=s>a?0:1,h=o?0:1;Mh(r,new $S(e,t,0,0,l^h^u,n))}function jf(r,t,e){const n={arcLength:0,segments:[],minSin:1};if(r.length===0)return n;if(e){const o=r[0].add(r[r.length-1]).scale(.5);r=[o,...r,o]}let s=r[0];for(let o=2;o<r.length;o++){const l=r[o-2],u=r[o-1],h=r[o],T=l.sub(u),f=h.sub(u),d=T.normalized.safe,p=f.normalized.safe,m=Math.acos(pe(-1,1,d.dot(p))),y=Math.tan(m/2),c=Math.sin(m/2),Q=Math.min(t,y*T.magnitude*(o===2?1:.5),y*f.magnitude*(o===r.length-1?1:.5)),g=c===0?0:Q/c,v=y===0?0:Q/y,L=d.add(p).scale(1/2).normalized.safe.scale(g).add(u),x=d.perpendicular.dot(p)<0,b=new s2(s,u.add(d.scale(v))),S=new zS(L,Q,d.perpendicular.scale(x?1:-1),p.perpendicular.scale(x?-1:1),x);b.arcLength>0&&(n.segments.push(b),n.arcLength+=b.arcLength),S.arcLength>0&&(n.segments.push(S),n.arcLength+=S.arcLength),n.minSin=Math.min(n.minSin,Math.abs(c)),s=u.add(p.scale(v))}const a=new s2(s,r[r.length-1]);return a.arcLength>0&&(n.segments.push(a),n.arcLength+=a.arcLength),n}var gr=class extends p1{constructor(r){super(r)}profile(){return DK(this.size().scale(.5),this.startAngle()*Xi,this.endAngle()*Xi,this.closed(),this.counterclockwise())}desiredSize(){return{x:this.width.context.getter(),y:this.height.context.getter()}}offsetComputedLayout(r){return r}childrenBBox(){return ue.fromSizeCentered(this.computedSize())}getPath(){return this.requiresProfile()?this.curveDrawingInfo().path:this.createPath()}getRipplePath(){return this.createPath(this.rippleSize())}getCacheBBox(){return super.getCacheBBox().expand(this.rippleSize())}createPath(r=0){const t=new Path2D,e=this.startAngle()*Xi;let n=this.endAngle()*Xi;const s=this.size().scale(.5).add(r),a=this.closed();if(n>e+Math.PI*2){const o=Math.floor((n-e)/(Math.PI*2));n-=Math.PI*2*o}return a&&t.moveTo(0,0),t.ellipse(0,0,s.x,s.y,0,e,n,this.counterclockwise()),a&&t.closePath(),t}};k([dt(0),ot()],gr.prototype,"startAngle",2);k([dt(360),ot()],gr.prototype,"endAngle",2);k([dt(!1),ot()],gr.prototype,"counterclockwise",2);k([vt()],gr.prototype,"profile",1);gr=k([k1("Circle")],gr);var l3=class extends s1{constructor(r){super({fontFamily:"monospace",...r}),this.oldSelection=null,this.selectionProgress=M2(null)}static createSignal(r,t){return new Ah(r,void 0,t).toSignal()}setDrawHooks(r){!S5().experimentalFeatures&&r!==this.drawHooks.context.getInitial()?ce().log({...Jv("Code uses experimental draw hooks."),inspect:this.key}):this.drawHooks.context.setter(r)}*tweenSelection(r,t,e){this.oldSelection=this.selection(),this.selection(r),this.selectionProgress(0),yield*this.selectionProgress(1,t,e),this.selectionProgress(null),this.oldSelection=null}parsed(){return $r(this.code(),r=>x1(r.progress)>.5)}highlighterCache(){const r=this.highlighter();if(!r||!r.initialize())return null;const t=this.code(),e=$r(t,!1),n=$r(t,!0);return{before:r.prepare(e),after:r.prepare(n)}}get cursor(){return this.cursorCache??(this.cursorCache=new hK(this)),this.cursorCache}createSignal(r){return new Ah(r,this,this.highlighter).toSignal()}findAllRanges(r){return Ou(this.parsed(),r)}findFirstRange(r){return Ou(this.parsed(),r,1)[0]??[[0,0],[0,0]]}findLastRange(r){return Ou(this.parsed(),r).at(-1)??[[0,0],[0,0]]}getPointBbox(r){const[t,e]=r,n=this.drawingInfo();let s;for(const o of n.fragments){if(o.cursor.y<t){s=o;continue}if(o.cursor.y===t&&o.cursor.x<e){s=o;continue}break}if(!s)return new ue;const a=this.computedSize();return new ue(s.position.sub(a.scale(.5)).addX(s.characterSize.x*(e-s.cursor.x)),s.characterSize)}getSelectionBbox(r){const t=this.computedSize(),e=RS(r),n=this.drawingInfo(),s=[];let a=null,o=0,l=0;for(const u of n.fragments){u.cursor.y!==o&&(o=u.cursor.y,a&&(s.push(a),a=null)),l=u.cursor.x;for(let h=0;h<u.text.length;h++){if(bh([o,l],e)){const T=new ue(u.position.sub(t.scale(.5)).addX(u.characterSize.x*(l-u.cursor.x)),u.characterSize);a?a=a.union(T):a=T}else a&&(s.push(a),a=null);l++}}return a&&s.push(a),s}drawingInfo(){this.requestFontUpdate();const r=this.cacheCanvas(),t=this.code();r.save(),this.applyStyle(r),this.applyText(r),this.cursor.setupDraw(r),this.cursor.drawScope(t);const e=this.cursor.getDrawingInfo();return r.restore(),e}desiredSize(){this.requestFontUpdate();const r=this.cacheCanvas(),t=this.code();r.save(),this.applyStyle(r),this.applyText(r),this.cursor.setupMeasure(r),this.cursor.measureSize(t);const e=this.cursor.getSize();return r.restore(),e}async draw(r){this.requestFontUpdate(),this.applyStyle(r),this.applyText(r);const t=this.computedSize(),e=this.drawingInfo();r.save(),r.translate(-t.width/2,-t.height/2+e.verticalOffset);const n=this.drawHooks();for(const s of e.fragments)r.save(),r.globalAlpha*=s.alpha,n.token(r,s.text,s.position,s.fill,s.time),r.restore();r.restore(),await this.drawChildren(r)}applyText(r){super.applyText(r),r.font=this.styles.font,r.textBaseline="top","letterSpacing"in r&&(r.letterSpacing=this.styles.letterSpacing)}collectAsyncResources(){var r;super.collectAsyncResources(),(r=this.highlighter())==null||r.initialize()}};l3.defaultHighlighter=null;k([dt(()=>l3.defaultHighlighter),ot()],l3.prototype,"highlighter",2);k([bK()],l3.prototype,"code",2);k([dt({token(r,t,e,n,s){r.fillStyle=n,r.globalAlpha*=Ft(.2,1,s),r.fillText(t,e.x,e.y)}}),ot()],l3.prototype,"drawHooks",2);k([dt(uK(0,1/0)),O0(RS),ot()],l3.prototype,"selection",2);k([vt()],l3.prototype,"parsed",1);k([vt()],l3.prototype,"highlighterCache",1);k([vt()],l3.prototype,"drawingInfo",1);l3=k([k1("CodeBlock")],l3);var V0=class extends Uf{constructor(r){super(r)}segment(){return new _i(this.p0(),this.p1(),this.p2(),this.p3())}overlayInfo(r){const[t,e,n,s]=this.segment().transformPoints(r),a=new Path2D;L1(a,t),Ff(a,e,n,s);const o=new Path2D;return L1(o,t),V1(o,e),L1(o,n),V1(o,s),{curve:a,startPoint:t,endPoint:s,controlPoints:[e,n],handleLines:o}}};k([M1("p0")],V0.prototype,"p0",2);k([M1("p1")],V0.prototype,"p1",2);k([M1("p2")],V0.prototype,"p2",2);k([M1("p3")],V0.prototype,"p3",2);k([vt()],V0.prototype,"segment",1);var K5=class extends s1{constructor(r){super(r)}drawShape(r){r.save(),this.applyStyle(r),this.drawRipple(r);const t=this.spacing(),e=this.computedSize().scale(.5),n=e.div(t).floored;for(let s=-n.x;s<=n.x;s++){const[a,o]=this.mapPoints(-e.height,e.height);r.beginPath(),r.moveTo(t.x*s,a),r.lineTo(t.x*s,o),r.stroke()}for(let s=-n.y;s<=n.y;s++){const[a,o]=this.mapPoints(-e.width,e.width);r.beginPath(),r.moveTo(a,t.y*s),r.lineTo(o,t.y*s),r.stroke()}r.restore()}mapPoints(r,t){let e=Ft(r,t,this.start()),n=Ft(r,t,this.end());return n<e&&([e,n]=[n,e]),[e,n]}};k([dt(80),M1("spacing")],K5.prototype,"spacing",2);k([dt(0),ot()],K5.prototype,"start",2);k([dt(1),ot()],K5.prototype,"end",2);K5=k([k1("Grid")],K5);var OK=`
229
229
  The image won't be visible unless you specify a source:
230
230
 
231
231
  \`\`\`tsx
@@ -306,4 +306,4 @@ as children to the spline using the \`Knot\` component:
306
306
  \`\`\`
307
307
  `,n6=class extends p1{constructor(r){super(r),(r.children===void 0||!Array.isArray(r.children)||r.children.length<2)&&(r.points===void 0||r.points.length<2)&&r.spawner===void 0&&ce().warn({message:"Insufficient number of knots specified for spline. A spline needs at least two knots.",remarks:GK,inspect:this.key})}profile(){return CK(this.knots(),this.closed(),this.smoothness())}knots(){const r=this.points();return r?r.map(t=>{const e=new Z(x1(t));return{position:e,startHandle:e,endHandle:e,auto:{start:1,end:1}}}):this.children().filter(this.isKnot).map(t=>t.points())}childrenBBox(){const r=this.profile().segments.flatMap(t=>t.points);return ue.fromPoints(...r)}lineWidthCoefficient(){const r=this.lineJoin();let t=super.lineWidthCoefficient();if(r!=="miter")return t;const{minSin:e}=this.profile();return e>0&&(t=Math.max(t,.5/e)),t}desiredSize(){return this.getTightBBox().size}offsetComputedLayout(r){return r.position=r.position.sub(this.getTightBBox().center),r}getTightBBox(){const r=this.profile().segments.map(t=>t.getBBox());return ue.fromBBoxes(...r)}drawOverlay(r,t){const e=this.computedSize(),n=this.childrenBBox().transformCorners(t),s=e.mul(this.offset()).scale(.5),a=Q1(s,t),o=this.profile().segments;r.lineWidth=1,r.strokeStyle="white",r.fillStyle="white";const l=new Path2D;for(let u=0;u<o.length;u++){const h=o[u],[T,f,d,p]=h.transformPoints(t);L1(l,T),h instanceof _i?Ff(l,f,d,p):Nf(l,f,d)}r.stroke(l);for(let u=0;u<o.length;u++){const h=o[u];r.fillStyle="white";const[T,f,d,p]=h.transformPoints(t),m=new Path2D;r.globalAlpha=.5,L1(m,T),V1(m,f),h instanceof _i?(L1(m,d),V1(m,p),r.beginPath(),r.stroke(m)):(V1(m,d),r.beginPath(),r.stroke(m)),r.globalAlpha=1,r.lineWidth=2,L1(r,T),r.beginPath(),xi(r,T,4),r.closePath(),r.stroke(),r.fill(),u===o.length-1&&p!==void 0&&(L1(r,p),r.beginPath(),xi(r,p,4),r.closePath(),r.stroke(),r.fill()),r.fillStyle="black";for(const y of[f,d])y.magnitude>0&&(L1(r,y),r.beginPath(),xi(r,y,4),r.closePath(),r.fill(),r.stroke())}r.lineWidth=1,r.beginPath(),r6(r,a),r.stroke(),r.beginPath(),A2(r,n),r.closePath(),r.stroke()}isKnot(r){return r instanceof P0}};k([dt(.4),ot()],n6.prototype,"smoothness",2);k([dt(null),ot()],n6.prototype,"points",2);k([vt()],n6.prototype,"profile",1);k([vt()],n6.prototype,"knots",1);k([vt()],n6.prototype,"childrenBBox",1);k([vt()],n6.prototype,"getTightBBox",1);function uv(r){const t=new Map;let e;for(const[n,s]of r.entries()){const a=t.get(s.id)??[];t.has(s.id)||t.set(s.id,a),a.push({before:e,current:s,beforeIdIndex:e?t.get(e.id).length-1:-1,currentIndex:n}),e=s}return t}function zK(r,t){const e={inserted:[],deleted:[],transformed:[]},n=uv(r),s=uv(t);for(const[a,o]of n.entries()){const l=s.get(a);if(l){s.delete(a);for(let u=0;u<Math.max(o.length,l.length);u++){const h=u>=o.length,T=u>=l.length,f=h?o[o.length-1]:o[u],d=T?l[l.length-1]:l[u];e.transformed.push({insert:h,remove:T,from:f,to:d})}}else for(const u of o)e.deleted.push(u)}for(const a of s.values())for(const o of a)e.inserted.push(o);return e}function WK(r,t,e){function n(a){let o=-1;const l=a.before?r.findIndex(({id:u})=>{var h;return u===((h=a.before)==null?void 0:h.id)&&(o++,o===a.beforeIdIndex)}):0;r.splice(l+1,0,a.current)}const s={inserted:t.inserted.map(a=>({item:a,order:a.currentIndex}))};for(const a of t.transformed){if(!a.insert)continue;const o=a.from;a.from={...a.to,current:e(o.current)},s.inserted.push({item:a.from,order:a.to.currentIndex})}s.inserted.sort((a,o)=>a.order-o.order);for(const a of s.inserted)n(a.item);return s}var x4=class de extends s1{constructor(t){super(t),this.lastTweenTargetSrc=null,this.lastTweenTargetDocument=null,this.wrapper=new Xt({}),this.wrapper.children(this.documentNodes),this.wrapper.scale(this.wrapperScale),this.add(this.wrapper)}getChildrenById(t){return this.document().nodes.filter(e=>e.id===t).map(({shape:e})=>e)}desiredSize(){const t=this.document().size,e=this.calculateWrapperScale(t,super.desiredSize());return t.mul(e)}getCurrentSize(){return{x:this.width.isInitial()?null:this.width(),y:this.height.isInitial()?null:this.height()}}calculateWrapperScale(t,e){const n=new Z(1,1);return e.x&&e.y?(n.x=e.x/t.width,n.y=e.y/t.height):e.x&&!e.y?(n.x=e.x/t.width,n.y=n.x):!e.x&&e.y&&(n.y=e.y/t.height,n.x=n.y),n}buildDocument(t){return{size:t.size,nodes:t.nodes.map(e=>this.buildShape(e))}}buildShape({id:t,type:e,props:n,children:s}){return{id:t,shape:new e({children:s==null?void 0:s.map(a=>this.buildShape(a).shape),...this.processElementStyle(n)})}}parseSVG(t){return this.buildDocument(de.parseSVGData(t))}*generateTransformer(t,e,n,s){yield t.position(e.position(),n,s),yield t.scale(e.scale(),n,s),yield t.rotation(e.rotation(),n,s),t instanceof fn&&e instanceof fn&&t.data()!==e.data()&&(yield t.data(e.data(),n,s)),t instanceof Ht&&e instanceof Ht&&(yield t.size(e.size(),n,s)),t instanceof s1&&e instanceof s1&&(yield t.fill(e.fill(),n,s),yield t.stroke(e.stroke(),n,s),yield t.lineWidth(e.lineWidth(),n,s));const a=t.children(),o=e.children();for(let l=0;l<a.length;l++)yield*this.generateTransformer(a[l],o[l],n,s)}*tweenSvg(t,e,n){const s=F2(t)?t():t,a=this.parseSVG(s),o=this.document(),l=zK(o.nodes,a.nodes);this.lastTweenTargetSrc=s,this.lastTweenTargetDocument=a,WK(o.nodes,l,({shape:Q,...g})=>({...g,shape:Q.clone()})),this.wrapper.children(o.nodes.map(Q=>Q.shape));for(const Q of o.nodes)Q.shape.parent(this.wrapper);const u=.2,h=.8,T=.15,f=[],d=(h-u)*e,p=u*e;for(const Q of l.transformed)f.push(...this.generateTransformer(Q.from.current.shape,Q.to.current.shape,d,n));const m=this.width.isInitial(),y=this.height.isInitial();this.wrapper.scale(this.calculateWrapperScale(o.size,this.getCurrentSize()));const c=rr(e,Q=>{const g=n(Q),v=ua(u,h,0,1,g),L=this.wrapper.scale();m&&this.width(Gu(v,o.size.x,a.size.x)*L.x),y&&this.height(Gu(v,o.size.y,a.size.y)*L.y);const x=ua(0,u+T,1,0,g);for(const{current:S}of l.deleted)S.shape.opacity(x);const b=ua(h-T,1,0,1,g);for(const{current:S}of l.inserted)S.shape.opacity(b)},()=>{this.wrapper.children(this.documentNodes),m&&this.width.reset(),y&&this.height.reset();for(const{current:Q}of l.deleted)Q.shape.dispose();for(const{from:Q}of l.transformed)Q.current.shape.dispose();this.wrapper.scale(this.wrapperScale)});yield*xe(this.wrapper.scale(this.calculateWrapperScale(a.size,this.getCurrentSize()),e,n),c,$i(p,xe(...f)))}wrapperScale(){return this.calculateWrapperScale(this.document().size,this.getCurrentSize())}document(){try{const t=this.svg();return this.lastTweenTargetDocument&&t===this.lastTweenTargetSrc?this.lastTweenTargetDocument:this.parseSVG(t)}finally{this.lastTweenTargetSrc=null,this.lastTweenTargetDocument=null}}documentNodes(){return this.document().nodes.map(t=>t.shape)}processElementStyle({fill:t,stroke:e,...n}){return{fill:t==="currentColor"?this.fill:de.processSVGColor(t),stroke:e==="currentColor"?this.stroke:de.processSVGColor(e),...n}}static parseSVGData(t){const e=de.svgNodesPool[t];if(e&&(e.size.x>0||e.size.y>0))return e;de.containerElement.innerHTML=t;const n=de.containerElement.querySelector("svg");if(!n)return ce().error({message:"Invalid SVG",object:t}),{size:new Z(0,0),nodes:[]};let s=new ue,a=new Z;const o=n.hasAttribute("viewBox"),l=n.hasAttribute("width")||n.hasAttribute("height");if(o){const{x:p,y:m,width:y,height:c}=n.viewBox.baseVal;s=new ue(p,m,y,c),l||(a=s.size)}l&&(a=new Z(n.width.baseVal.value,n.height.baseVal.value),o||(s=new ue(0,0,a.width,a.height))),!o&&!l&&(s=new ue(n.getBBox()),a=s.size);const u=a.div(s.size),h=s.center,T=new DOMMatrix().scaleSelf(u.x,u.y).translateSelf(-h.x,-h.y),f=Array.from(de.extractGroupNodes(n,n,T,{})),d={size:a,nodes:f};return de.svgNodesPool[t]=d,d}static getMatrixTransformation(t){const e=new A5(t),n=e.translation,s=e.rotation,a={x:e.x.magnitude,y:e.y.magnitude};return e.determinant<0&&(e.values[0]<e.values[3]?a.x=-a.x:a.y=-a.y),{position:n,rotation:s,scale:a}}static processSVGColor(t){return t==="transparent"||t==="none"?null:t}static getElementTransformation(t,e){const n=t.transform.baseVal.consolidate();return(n?e.multiply(n.matrix):e).translate(de.parseNumberAttribute(t,"x"),de.parseNumberAttribute(t,"y"))}static parseLineCap(t){return t?t==="butt"||t==="round"||t==="square"?t:(ce().warn(`SVG: invalid line cap "${t}"`),null):null}static parseLineJoin(t){return t?t==="bevel"||t==="miter"||t==="round"?t:(t==="arcs"||t==="miter-clip"?ce().warn(`SVG: line join is not supported "${t}"`):ce().warn(`SVG: invalid line join "${t}"`),null):null}static parseLineDash(t){if(!t)return null;const e=t.split(/,|\s+/);return e.findIndex(n=>n.endsWith("%"))>0?(ce().warn("SVG: percentage line dash are ignored"),null):e.map(n=>parseFloat(n))}static parseDashOffset(t){if(!t)return null;const e=t.trim();return e.endsWith("%")&&ce().warn("SVG: percentage line dash offset are ignored"),parseFloat(e)}static parseOpacity(t){return t?t.endsWith("%")?parseFloat(t)/100:parseFloat(t):null}static getElementStyle(t,e){return{fill:t.getAttribute("fill")??e.fill,stroke:t.getAttribute("stroke")??e.stroke,lineWidth:t.hasAttribute("stroke-width")?parseFloat(t.getAttribute("stroke-width")):e.lineWidth,lineCap:this.parseLineCap(t.getAttribute("stroke-linecap"))??e.lineCap,lineJoin:this.parseLineJoin(t.getAttribute("stroke-linejoin"))??e.lineJoin,lineDash:this.parseLineDash(t.getAttribute("stroke-dasharray"))??e.lineDash,lineDashOffset:this.parseDashOffset(t.getAttribute("stroke-dashoffset"))??e.lineDashOffset,opacity:this.parseOpacity(t.getAttribute("opacity"))??e.opacity,layout:!1}}static*extractGroupNodes(t,e,n,s){for(const a of t.children)a instanceof SVGGraphicsElement&&(yield*this.extractElementNodes(a,e,n,s))}static parseNumberAttribute(t,e){return parseFloat(t.getAttribute(e)??"0")}static*extractElementNodes(t,e,n,s){const a=de.getElementTransformation(t,n),o=de.getElementStyle(t,s),l=t.id??"";if(t.tagName==="g")yield*de.extractGroupNodes(t,e,a,o);else if(t.tagName==="use"){const u=e.querySelector(t.href.baseVal);if(!(u instanceof SVGGraphicsElement)){ce().warn(`invalid SVG use tag. element "${t.outerHTML}"`);return}yield*de.extractElementNodes(u,e,a,s)}else if(t.tagName==="path"){const u=t.getAttribute("d");if(!u){ce().warn("blank path data at "+t.id);return}const h=a;yield{id:l||"path",type:fn,props:{data:u,tweenAlignPath:!0,...de.getMatrixTransformation(h),...o}}}else if(t.tagName==="rect"){const u=de.parseNumberAttribute(t,"width"),h=de.parseNumberAttribute(t,"height"),T=de.parseNumberAttribute(t,"rx"),f=de.parseNumberAttribute(t,"ry"),p=new ue(0,0,u,h).center,m=a.translate(p.x,p.y);yield{id:l||"rect",type:E1,props:{width:u,height:h,radius:[T,f],...de.getMatrixTransformation(m),...o}}}else if(["circle","ellipse"].includes(t.tagName)){const u=de.parseNumberAttribute(t,"cx"),h=de.parseNumberAttribute(t,"cy"),T=t.tagName==="circle"?de.parseNumberAttribute(t,"r")*2:[de.parseNumberAttribute(t,"rx")*2,de.parseNumberAttribute(t,"ry")*2],f=a.translate(u,h);yield{id:l||t.tagName,type:gr,props:{size:T,...o,...de.getMatrixTransformation(f)}}}else if(["line","polyline","polygon"].includes(t.tagName)){const h=(t.tagName==="line"?["x1","y1","x2","y2"].map(T=>de.parseNumberAttribute(t,T)):t.getAttribute("points").match(/-?[\d.e+-]+/g).map(T=>parseFloat(T))).reduce((T,f)=>{let d=T.at(-1);return(!d||d.length===2)&&(d=[],T.push(d)),d.push(f),T},[]);t.tagName==="polygon"&&h.push(h[0]),yield{id:l||t.tagName,type:u3,props:{points:h,...o,...de.getMatrixTransformation(a)}}}else if(t.tagName==="image"){const u=de.parseNumberAttribute(t,"x"),h=de.parseNumberAttribute(t,"y"),T=de.parseNumberAttribute(t,"width"),f=de.parseNumberAttribute(t,"height"),d=t.getAttribute("href")??"",m=new ue(u,h,T,f).center,y=a.translate(m.x,m.y);yield{id:l||t.tagName,type:W1,props:{src:d,...o,...de.getMatrixTransformation(y)}}}}};x4.svgNodesPool={};k([ot()],x4.prototype,"svg",2);k([t1()],x4.prototype,"tweenSvg",1);k([vt()],x4.prototype,"wrapperScale",1);k([vt()],x4.prototype,"document",1);k([vt()],x4.prototype,"documentNodes",1);k([jn(()=>{const r=document.createElement("div");return o3.shadowRoot.appendChild(r),r})],x4,"containerElement",2);var eE=Symbol("Txt"),H2=class extends s1{constructor({children:r,...t}){super(t),r&&this.text(r)}parentTxt(){const r=this.parent();return!r||!(eE in r)?null:r}async draw(r){var u;this.requestFontUpdate(),this.applyStyle(r),await((u=document.fonts)==null?void 0:u.ready),this.applyText(r),r.font=this.styles.font,r.textBaseline="bottom","letterSpacing"in r&&(r.letterSpacing=`${this.letterSpacing()}px`);const t=r.measureText("").fontBoundingBoxAscent,e=this.element.getBoundingClientRect(),{width:n,height:s}=this.size(),a=document.createRange();let o="";const l=new ue;for(const h of this.element.childNodes){if(!h.textContent)continue;a.selectNodeContents(h);const T=a.getBoundingClientRect(),f=n/-2+T.left-e.left,d=s/-2+T.top-e.top+t;l.y===d?(l.width+=T.width,o+=h.textContent):(await this.drawText(r,o,l),l.x=f,l.y=d,l.width=T.width,l.height=T.height,o=h.textContent)}await this.drawText(r,o,l)}async drawText(r,t,e){const n=e.y;t=t.replace(/\s+/g," "),this.lineWidth()<=0?r.fillText(t,e.x,n):this.strokeFirst()?(r.strokeText(t,e.x,n),r.fillText(t,e.x,n)):(r.fillText(t,e.x,n),r.strokeText(t,e.x,n))}getCacheBBox(){const r=this.computedSize(),t=document.createRange();t.selectNodeContents(this.element);const e=t.getBoundingClientRect(),n=this.lineWidth(),s=this.lineJoin()==="miter"?.5*10:.5;return new ue(-r.width/2,-r.height/2,e.width,e.height).expand([0,this.fontSize()*.5]).expand(n*s)}applyFlex(){super.applyFlex(),this.element.style.display="inline"}updateLayout(){if(this.applyFont(),this.applyFlex(),this.justifyContent.isInitial()&&(this.element.style.justifyContent=this.styles.getPropertyValue("text-align")),this.styles.whiteSpace!=="nowrap"&&this.styles.whiteSpace!=="pre")if(this.element.innerText="",H2.segmenter)for(const t of H2.segmenter.segment(this.text()))this.element.appendChild(document.createTextNode(t.segment));else for(const t of this.text().split(""))this.element.appendChild(document.createTextNode(t));else if(this.styles.whiteSpace==="pre"){this.element.innerText="";for(const t of this.text().split(`
308
308
  `))this.element.appendChild(document.createTextNode(t+`
309
- `))}else this.element.innerText=this.text()}};k([dt(""),Rf(tL),ot()],H2.prototype,"text",2);k([vt()],H2.prototype,"parentTxt",1);k([jn(()=>{try{return new Intl.Segmenter(void 0,{granularity:"grapheme"})}catch{return null}})],H2,"segmenter",2);H2=k([k1("TxtLeaf")],H2);["fill","stroke","lineWidth","strokeFirst","lineCap","lineJoin","lineDash","lineDashOffset"].forEach(r=>{H2.prototype[`get${Wr(r)}`]=function(){var t;return((t=this.parentTxt())==null?void 0:t[r]())??this[r].context.getInitial()}});var cv,hv,I1=class extends(hv=s1,cv=eE,hv){constructor({children:r,text:t,...e}){super(e),this[cv]=!0,this.children(t??r)}static b(r){return new I1({...r,fontWeight:700})}static i(r){return new I1({...r,fontStyle:"italic"})}getText(){return this.innerText()}setText(r){const t=this.children();let e=null;for(let n=0;n<t.length;n++){const s=t[n];e===null&&s instanceof H2?e=s:s.parent(null)}e===null?(e=new H2({text:r}),e.parent(this)):e.text(r),this.setParsedChildren([e])}setChildren(r){this.children.context.raw()!==r&&(typeof r=="string"?this.text(r):super.setChildren(r))}*tweenText(r,t,e,n){var h;yield(h=document.fonts)==null?void 0:h.ready;const s=this.children();(s.length!==1||!(s[0]instanceof H2))&&this.text.save();const a=this.childAs(0),o=a.text.context.raw(),l=this.size.context.raw();a.text(r);const u=this.size();a.text(o??zu),this.height()===0&&this.height(u.height),yield*xe(this.size(u,t,e),a.text(r,t,e,n)),this.children.context.setter(r),this.size(l)}getLayout(){return!0}innerText(){const r=this.childrenAs();let t="";for(const e of r)t+=e.text();return t}parentTxt(){const r=this.parent();return r instanceof I1?r:null}parseChildren(r){const t=[],e=Array.isArray(r)?r:[r];for(const n of e)n instanceof I1||n instanceof H2?t.push(n):typeof n=="string"&&t.push(new H2({text:n}));return t}applyFlex(){super.applyFlex(),this.element.style.display=this.findAncestor(US(I1))?"inline":"block"}async draw(r){var t;await((t=document.fonts)==null?void 0:t.ready),await this.drawChildren(r)}};k([dt(""),ot()],I1.prototype,"text",2);k([t1()],I1.prototype,"tweenText",1);k([vt()],I1.prototype,"innerText",1);k([vt()],I1.prototype,"parentTxt",1);I1=k([k1("Txt")],I1);["fill","stroke","lineWidth","strokeFirst","lineCap","lineJoin","lineDash","lineDashOffset"].forEach(r=>{I1.prototype[`getDefault${Wr(r)}`]=function(t){var e;return((e=this.parentTxt())==null?void 0:e[r]())??t}});var Tv=class{constructor(r,t,e,n=0){this.segment=r,this.sourceFps=t,this.targetFps=e,this.sum=n,this.framesRequested=0}async getNextFrame(){var t;const r=this.sourceFps/this.targetFps;if(this.sum+=r,this.framesRequested+=1,this.sum<1&&this.lastFrame)return this.lastFrame;for(;this.sum>=2;){const e=await this.segment.getNextFrame();if(!e)return;e.close(),this.sum-=1}if(this.sum>=1||!this.lastFrame){this.sum-=1;const e=await this.segment.getNextFrame();return e?((t=this.lastFrame)==null||t.close(),this.lastFrame=e,e):void 0}throw new Error("Unreachable code")}getLastFrame(){return this.lastFrame}getSum(){return this.sum}getSegment(){return this.segment}getTime(r){return(this.framesRequested-r)/this.targetFps}},iE=class{constructor(r,t,e=0){this.file=r,this.setStatus=t,this.offset=e}write(r){const t=new ArrayBuffer(r.byteLength);new Uint8Array(t).set(r),t.fileStart=this.offset,this.offset+=t.byteLength,this.setStatus("fetch",(this.offset/1024**2).toFixed(1)+" MiB"),this.file.appendBuffer(t)}close(){this.setStatus("fetch","Done"),this.file.flush()}},qK=30,fv=class{constructor(r,t,e,n,s=0){this.done=!1,this.currentFramePastSegmentEndTime=!1,this.abortController=new AbortController,this.responseFinished=!1,this.framesProcessed=0,this.framesDue=0,this.frameBuffer=[],this.encodedChunkQueue=[],this.readMore=async()=>{},this.uri=r,this.file=t,this.file.onSamples=this.onSamples.bind(this),this.edit=e[n],this.startTime=s;const a=Math.floor(this.startTime*this.edit.fps);this.framesProcessed+=a,this.decoder=new VideoDecoder({output:this.onFrame.bind(this),error(o){console.error(o)}})}async start(r){if(this.edit.mediaTime===-1){this.done=!0,this.responseFinished=!0,this.decoder.close();const u=this.edit.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale,h=Math.ceil(u*this.edit.fps),T=this.file.getInfo().videoTracks[0].track_height,f=this.file.getInfo().videoTracks[0].track_width,d=T*f*4,p=new ArrayBuffer(d),m=new Uint8Array(p);m.fill(0),this.frameBuffer=Array.from({length:h},()=>new VideoFrame(m,{timestamp:0,duration:1/this.edit.fps,codedHeight:T,codedWidth:f,format:"BGRA"}));return}this.decoder.configure(r);const t=this.file.getInfo().videoTracks[0],e=this.file.getTrackById(t.id),n=this.edit.mediaTime,s=this.startTime*t.timescale,o=(n+s)/t.timescale,l=this.file.seekTrack(o,!0,e);this.readMore=await this.startStreamingAtOffset(this.file,this.uri,l.offset)}async startStreamingAtOffset(r,t,e){return fetch(t,{headers:{Range:`bytes=${e}-`},signal:this.abortController.signal}).then(async n=>{if(!n.body)throw new Error("Response body is null");const s=n.body.getReader(),a=new iE(r,()=>{},e);return async()=>s.read().then(({done:o,value:l})=>{if(o){this.responseFinished=!0,this.abortController.abort(),a.close();return}a.write(l)})})}onSamples(r,t,e){for(const n of e){const s=new EncodedVideoChunk({type:n.is_sync?"key":"delta",timestamp:1e6*n.cts/n.timescale,duration:1e6*n.duration/n.timescale,data:n.data});this.framesDue++,this.encodedChunkQueue.push(s);const a=this.file.getInfo().videoTracks[0],o=this.file.getTrackById(a.id);this.file.releaseSample(o,n.number)}}async decodeChunks(){for(;this.encodedChunkQueue.length>0&&this.decoder.decodeQueueSize<qK;){const r=this.encodedChunkQueue.shift();r&&this.decoder.decode(r)}if(this.done){this.currentFramePastSegmentEndTime=!0;return}if(this.responseFinished&&this.encodedChunkQueue.length===0){await this.flushDecoderWithRetry(),this.currentFramePastSegmentEndTime=!0;return}}async flushDecoderWithRetry(r=3,t=2e3){for(let e=0;e<r;e++){if(this.decoder.decodeQueueSize===0)return;try{await Promise.race([this.decoder.flush(),new Promise((n,s)=>setTimeout(()=>s(new Error("Flush timeout")),t))])}catch(n){if(e===r)throw n}}}async onFrame(r){this.framesDue--;const t=this.edit.mediaTime/this.file.getInfo().videoTracks[0].timescale,e=this.startTime+t,n=r.timestamp/1e6;if(n<e){r.close();return}const s=this.edit.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale,a=t+s;if(n>a){r.close(),this.done=!0,await this.decoder.flush();return}this.frameBuffer.push(r)}async populateBuffer(){for(;this.frameBuffer.length===0&&!this.currentFramePastSegmentEndTime;)this.responseFinished||await this.readMore(),await this.decodeChunks(),await new Promise(r=>setTimeout(r,0));if(this.frameBuffer.length===0&&this.framesDue>0){let r=200;for(;this.frameBuffer.length===0;)if(await new Promise(t=>setTimeout(t,10)),r--,this.done||r===0)return}}async getNextFrame(){await this.populateBuffer();const r=this.frameBuffer.shift();return r&&this.framesProcessed++,r}async close(){this.abortController.abort(),this.frameBuffer.forEach(r=>r.close());try{this.decoder.state==="configured"&&(await this.decoder.flush(),this.decoder.close())}catch{}}getFramesProcessed(){return this.framesProcessed}getStartTime(){return this.startTime}};function ZK(r,t){const e=r.getTrackById(t.id);for(const n of e.mdia.minf.stbl.stsd.entries){const s=n.avcC||n.hvcC||n.vpcC||n.av1C;if(s){const a=new Co.DataStream(void 0,0,Co.DataStream.BIG_ENDIAN);return s.write(a),new Uint8Array(a.buffer,8)}}throw new Error("avcC, hvcC, vpcC, or av1C box not found")}function KK(r){return{mediaTime:r.media_time,segmentDuration:r.segment_duration,mediaRateInteger:r.media_rate_integer,mediaRateFraction:r.media_rate_fraction}}async function XK(r){return new Promise((t,e)=>{const n=Co.createFile();let s=!1;const a=new AbortController;return n.onReady=o=>{var p;s=!0,a.abort();const l=o.videoTracks[0];if(!l){e("No video track found");return}const u={codec:l.codec.startsWith("vp08")?"vp8":l.codec,codedHeight:l.video.height,codedWidth:l.video.width,description:ZK(n,l)},h={mediaTime:0,segmentDuration:l.duration,mediaRateInteger:1,mediaRateFraction:0},T=(p=l.edits)==null?void 0:p.map(m=>KK(m)),d=(T!=null&&T.length?T:[h]).map(m=>{const y=l.duration/l.timescale,c=m.segmentDuration/l.movie_timescale,Q=l.nb_samples*(c/y),g=m.mediaRateInteger+m.mediaRateFraction/65535,v=Q/c*g;return{...m,fps:v}});n.setExtractionOptions(l.id),n.start(),t({file:n,edits:d,config:u})},n.onError=o=>e(o),fetch(r,{signal:a.signal}).then(async o=>{if(!o.ok){e(`HTTP ${o.status}: ${o.statusText}`);return}if(!o.body){e("Response body is null");return}const l=o.body.getReader(),u=new iE(n,()=>{});let h=0;for(;!s;)await l.read().then(({done:T,value:f})=>{if(T){n.flush(),a.abort(),s||e("Could not find moov box in video file");return}h+=f.byteLength,u.write(f)})}).catch(o=>e(o))})}var $K=class{constructor(r,t,e){this.edits=[],this.nextSegment=0,this.uri=r,this.targetFps=t,this.startTime=e}async start(){const{file:r,edits:t,config:e}=await XK(this.uri);this.file=r,this.edits=t,this.decoderConfig=e}async getNextFrame(){var t;if(!this.sampler){let e=this.startTime;for(;this.nextSegment<this.edits.length;){const s=this.getSecondDurationOfSegment(this.edits[this.nextSegment]);if(e<s)break;e-=s,this.nextSegment++}if(this.nextSegment>=this.edits.length)throw new Error(`Timestamp ${this.startTime} is outside of the video, max timestamp is ${this.getDuration()}`);const n=new fv(this.uri,this.file,this.edits,this.nextSegment,e);await n.start(this.decoderConfig),this.sampler=new Tv(n,this.edits[this.nextSegment].fps,this.targetFps,0),this.nextSegment++}let r=await this.sampler.getNextFrame();for(;!r&&this.nextSegment<this.edits.length;){this.sampler.getSegment().close(),(t=this.sampler.getLastFrame())==null||t.close();const e=new fv(this.uri,this.file,this.edits,this.nextSegment,0);await e.start(this.decoderConfig),this.sampler=new Tv(e,this.edits[this.nextSegment].fps,this.targetFps,this.sampler.getSum()),this.nextSegment++,r=await this.sampler.getNextFrame()}if(!r&&(r=this.sampler.getLastFrame(),await this.sampler.getSegment().close(),!r))throw new Error("There are no frames in the video.");return r}getSecondDurationOfSegment(r){const t=r.mediaRateInteger+r.mediaRateFraction/65535;return r.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale/t}getDuration(){return this.edits.reduce((r,t)=>r+this.getSecondDurationOfSegment(t),0)}getTimeSubtractingFrames(r){const t=this.edits.slice(0,this.nextSegment-1).reduce((s,a)=>s+this.getSecondDurationOfSegment(a),0);if(!this.sampler)throw new Error("No current segment");const e=this.sampler.getSegment().getStartTime(),n=this.sampler.getTime(r);return t+e+n}getTime(){return this.getTimeSubtractingFrames(0)}getLastTime(){return this.getTimeSubtractingFrames(1)}getLastFrame(){var r;return(r=this.sampler)==null?void 0:r.getLastFrame()}close(){var r,t,e;(r=this.sampler)==null||r.getSegment().close(),(e=(t=this.sampler)==null?void 0:t.getLastFrame())==null||e.close(),this.file.flush()}},YK=class{constructor(r){this.src=r,this.lastTime=-1,this.video=document.createElement("video"),this.video.crossOrigin="anonymous",this.video.preload="auto",this.video.src=r,this.video.muted=!0,this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0})}async start(){return new Promise((r,t)=>{const e=setTimeout(()=>{t(new Error("Timeout loading video metadata"))},3e4);this.video.addEventListener("loadedmetadata",()=>{clearTimeout(e),this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,r()},{once:!0}),this.video.addEventListener("error",()=>{clearTimeout(e),t(new Error("Failed to load video"))},{once:!0})})}async getFrameAt(r){return Math.abs(this.video.currentTime-r)>.016&&await this.seekTo(r),this.ctx.drawImage(this.video,0,0),createImageBitmap(this.canvas)}async seekTo(r){return new Promise((t,e)=>{const n=setTimeout(()=>{e(new Error(`Seek timeout at ${r}s`))},5e3),s=()=>{clearTimeout(n),this.video.removeEventListener("seeked",s),t()};this.video.addEventListener("seeked",s,{once:!0}),this.video.currentTime=r})}getDuration(){return this.video.duration||0}getTime(){return this.video.currentTime}getLastTime(){return this.lastTime}close(){this.video.src="",this.video.load()}},Oo=new Map;async function Iu(r,t,e,n){const s=t+"-"+r;let a=Oo.get(s);return a||(a=new YK(t),await a.start(),Oo.set(s,a)),a.getFrameAt(e)}function JK(r,t){const e=t+"-"+r,n=Oo.get(e);n&&(n.close(),Oo.delete(e))}var Ur=new Map,x5=new Set;async function tX(r,t){const e=t+"-"+r,n=Ur.get(e);n&&(n.close(),Ur.delete(e)),x5.has(e)&&(JK(r,t),x5.delete(e))}async function eX(r,t,e,n){const s=t+"-"+r;if(x5.has(s))return Iu(r,t,e);let a=Ur.get(s);const o=1/n,l=a==null?void 0:a.getDuration();l&&e>l&&(e=l);const u=a&&Math.abs(e-a.getLastTime())<o/2;if(a&&u){const h=a.getLastFrame();if(!h)throw new Error("No last frame");return h}if(a&&e+o<a.getTime()&&(a.close(),Ur.delete(s),a=void 0),a&&e>a.getTime()+o*1.5&&(a.close(),Ur.delete(s),a=void 0),!a){a=new $K(t,n,e);try{await a.start()}catch{return x5.add(s),Iu(r,t,e)}const h=a.getDuration();if(h===0)return a.close(),Ur.delete(s),x5.add(s),Iu(r,t,e);if(h>0&&e>h)throw new Error(`Requested time ${e}s exceeds video duration ${h}s`);Ur.set(s,a)}return a.getNextFrame()}var v1=class extends T1{constructor(r){super(r),this.detectedFileType="unknown",this.fileTypeWasDetected=!1,this.lastFrame=null}createVideoElement(r,t){const e=document.createElement("video");if(e.crossOrigin="anonymous",r&&r!=="undefined"){try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const a=new D3;a.loadSource(r),a.attachMedia(e)}else e.src=r}catch{e.src=r}const n=()=>{const s=e.error;if(s&&(s.code===4||s.code===2)){e.removeEventListener("error",n);const a=`${t}_no_cors`;let o=v1.pool[a];if(!o){o=document.createElement("video"),o.crossOrigin=null;try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const u=new D3;u.loadSource(r),u.attachMedia(o)}else o.src=r}catch{o.src=r}v1.pool[a]=o}v1.pool[t]=o}};e.addEventListener("error",n,{once:!0})}return e}desiredSize(){const r=super.desiredSize();if(r.x===null&&r.y===null){const t=this.video();return{x:t.videoWidth,y:t.videoHeight}}return r}mediaElement(){return this.video()}seekedMedia(){return this.seekedVideo()}fastSeekedMedia(){return this.fastSeekedVideo()}getCacheKey(r){if(!r||r==="undefined")return`${this.key}/pending`;try{return new URL(r,window.location.origin).href.split("#")[0]}catch{return r}}video(){const r=this.src(),t=this.getCacheKey(r);let e=v1.pool[t];if(!e)e=this.createVideoElement(r,t),v1.pool[t]=e;else if(r&&r!=="undefined"){const s=l=>{try{return new URL(l,window.location.origin).href.split("#")[0]}catch{return l}},a=s(r);if((e.src?s(e.src):"")!==a)try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const u=new D3;u.loadSource(r),u.attachMedia(e)}else e.src=r}catch{e.src=r}}return(!r||r==="undefined")&&n1.collectPromise(new Promise(s=>{const a=()=>{const o=this.src();o&&o!=="undefined"?s():setTimeout(a,10)};a()})),this.waitForCanPlayNecessary(e)&&n1.collectPromise(new Promise(s=>{this.waitForCanPlay(e,s)})),e}seekedVideo(){const r=this.video(),t=this.clampTime(this.time());return r.playbackRate=this.playbackRate(),r.paused||r.pause(),this.lastTime===t||this.setCurrentTime(t),r}fastSeekedVideo(){const r=this.video(),t=this.clampTime(this.time());if(r.playbackRate=this.playbackRate(),this.lastTime===t)return r;const e=this.playing()&&t<r.duration&&r.playbackRate>0;return e?r.paused&&n1.collectPromise(r.play()):r.paused||r.pause(),Math.abs(r.currentTime-t)>1?this.setCurrentTime(t):e||(r.currentTime=t),r}async webcodecSeekedVideo(){const r=this.video(),t=this.clampTime(this.time());if(r.playbackRate=this.playbackRate(),this.lastFrame&&this.lastTime===t)return this.lastFrame;const e=this.view().fps()/this.playbackRate();return eX(this.key,r.src,t,e)}async ffmpegSeekedVideo(){const r=this.video(),t=this.clampTime(this.time()),e=this.getDuration();if(r.playbackRate=this.playbackRate(),this.lastFrame&&this.lastTime===t)return this.lastFrame;const n=this.view().fps()/this.playbackRate();if(!v1.imageCommunication)throw new Error("ServerSeekedVideo can only be used with HMR.");const s=await v1.imageCommunication.getFrame(this.key,r.src,t,e,n);return this.lastFrame=s,this.lastTime=t,s}async seekFunction(){const r=this.view().playbackState();return r===r2.Playing||r===r2.Presenting?this.fastSeekedVideo():r===r2.Paused?this.seekedVideo():this.decoder()==="slow"?this.seekedVideo():this.decoder()==="ffmpeg"?this.ffmpegSeekedVideo():this.decoder()==="web"?this.webcodecSeekedVideo():(this.fileTypeWasDetected||this.detectFileType(),this.detectedFileType==="webm"?this.ffmpegSeekedVideo():this.detectedFileType==="hls"?this.seekedVideo():this.webcodecSeekedVideo())}async draw(r){this.autoPlayBasedOnTwick(),this.drawShape(r);const t=this.alpha();if(t>0){const e=await this.seekFunction(),n=ue.fromSizeCentered(this.computedSize());r.save(),r.clip(this.getPath()),t<1&&(r.globalAlpha*=t),r.imageSmoothingEnabled=this.smoothing(),NS(r,e,n),r.restore()}this.clip()&&r.clip(this.getPath()),await this.drawChildren(r)}applyFlex(){super.applyFlex();try{const r=this.video();r&&r.videoWidth>0&&r.videoHeight>0&&(this.element.style.aspectRatio=(this.ratio()??r.videoWidth/r.videoHeight).toString())}catch{}}remove(){return super.remove(),tX(this.key,this.src()),this}handleUnknownFileType(r){console.warn(`WARNING: Could not detect file type of video (${r}), will default to using mp4 decoder. If your video file is not an mp4 file, this will lead to an error - to fix this, reencode your video as an mp4 file (better performance) or specify a different decoder: https://docs.re.video/common-issues/slow-rendering#use-mp4-decoder`),this.detectedFileType="unknown",this.fileTypeWasDetected=!0}detectFileType(){return n1.collectPromise((async()=>{var s;const r=this.src(),t=(s=r.split("?")[0].split(".").pop())==null?void 0:s.toLowerCase();if(t==="mp4"||t==="webm"||t==="mov"){this.detectedFileType=t,this.fileTypeWasDetected=!0;return}if(t==="m3u8"){this.detectedFileType="hls",this.fileTypeWasDetected=!0;return}if(!r.startsWith("http://")&&!r.startsWith("https://")){this.handleUnknownFileType(r);return}const n=(await fetch(r,{method:"HEAD"})).headers.get("Content-Type");if(!n){this.handleUnknownFileType(r);return}if(n.includes("video/mp4")){this.detectedFileType="mp4",this.fileTypeWasDetected=!0;return}if(n.includes("video/webm")){this.detectedFileType="webm",this.fileTypeWasDetected=!0;return}if(n.includes("video/quicktime")){this.detectedFileType="mov",this.fileTypeWasDetected=!0;return}if(n.includes("application/vnd.apple.mpegurl")||n.includes("application/x-mpegURL")){this.detectedFileType="hls",this.fileTypeWasDetected=!0;return}this.handleUnknownFileType(r)})())}};v1.pool={};v1.imageCommunication=null;k([dt(1),ot()],v1.prototype,"alpha",2);k([dt(!0),ot()],v1.prototype,"smoothing",2);k([dt(null),ot()],v1.prototype,"decoder",2);k([vt()],v1.prototype,"video",1);k([vt()],v1.prototype,"seekedVideo",1);k([vt()],v1.prototype,"fastSeekedVideo",1);v1=k([k1("Video")],v1);var iX=class extends zM{constructor(r){super(r),this.view=null,this.registeredNodes=new Map,this.nodeCounters=new Map,this.assetHash=Date.now().toString(),this.recreateView()}getView(){return this.view}next(){var r;return(r=this.getView())==null||r.playbackState(this.playback.state).globalTime(this.playback.time),super.next()}async draw(r){r.save(),this.renderLifecycle.dispatch([e5.BeforeRender,r]),r.save(),this.renderLifecycle.dispatch([e5.BeginRender,r]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time).fps(this.playback.fps),await this.getView().render(r),this.renderLifecycle.dispatch([e5.FinishRender,r]),r.restore(),this.renderLifecycle.dispatch([e5.AfterRender,r]),r.restore()}reset(r){for(const t of this.registeredNodes.keys())try{this.registeredNodes.get(t).dispose()}catch(e){this.logger.error(e)}return this.registeredNodes.clear(),this.registeredNodes=new Map,this.nodeCounters.clear(),this.recreateView(),super.reset(r)}inspectPosition(r,t){const e=this.getNodeByPosition(r,t);return e==null?void 0:e.key}getNodeByPosition(r,t){return this.execute(()=>this.getView().hit(new Z(r,t))??null)}validateInspection(r){var t;return((t=this.getNode(r))==null?void 0:t.key)??null}inspectAttributes(r){const t=this.getNode(r);if(!t)return null;const e={stack:t.creationStack,key:t.key};for(const{key:n,meta:s,signal:a}of t)s.inspectable&&(e[n]=a());return e}drawOverlay(r,t,e){const n=this.getNode(r);n&&this.execute(()=>{n.drawOverlay(e,t.multiply(n.localToWorld()))})}transformMousePosition(r,t){return Q1(new Z(r,t),this.getView().localToParent().inverse())}registerNode(r,t){var a;const e=((a=r.constructor)==null?void 0:a.name)??"unknown",n=(this.nodeCounters.get(e)??0)+1;this.nodeCounters.set(e,n),t&&this.registeredNodes.has(t)&&(ce().error({message:`Duplicated node key: "${t}".`,inspect:t,stack:new Error().stack}),t=void 0),t??(t=`${this.name}/${e}[${n}]`),this.registeredNodes.set(t,r);const s=this.registeredNodes;return[t,()=>s.delete(t)]}getNode(r){return typeof r!="string"?null:this.registeredNodes.get(r)??null}*getDetachedNodes(){for(const r of this.registeredNodes.values())!r.parent()&&r!==this.view&&(yield r)}getMediaAssets(){const t=this.playback.state===r2.Rendering,e=Array.from(this.registeredNodes.values()).filter(l=>l instanceof v1),n=Array.from(this.registeredNodes.values()).filter(l=>l instanceof w2);t&&(e.forEach(l=>{const u=l.src();u&&u!=="undefined"&&!l.isPlaying()&&l.playing(!0)}),n.forEach(l=>{const u=l.src();u&&u!=="undefined"&&!l.isPlaying()&&l.playing(!0)}));const s=e.filter(l=>l.isPlaying()),a=n.filter(l=>l.isPlaying()),o=[];return o.push(...s.map(l=>({key:l.key,type:"video",src:l.src(),decoder:l.decoder(),playbackRate:typeof l.playbackRate=="function"?l.playbackRate():l.playbackRate,volume:l.getVolume(),currentTime:l.getCurrentTime(),duration:l.getDuration()}))),o.push(...a.map(l=>({key:l.key,type:"audio",src:l.src(),playbackRate:typeof l.playbackRate=="function"?l.playbackRate():l.playbackRate,volume:l.getVolume(),currentTime:l.getCurrentTime(),duration:l.getDuration()}))),o}stopAllMedia(){const r=Array.from(this.registeredNodes.values()).filter(t=>t instanceof T1).filter(t=>t.isPlaying());for(const t of r)t.dispose()}adjustVolume(r){const t=Array.from(this.registeredNodes.values()).filter(e=>e instanceof T1);for(const e of t)e.setVolume(e.getVolume()*r)}recreateView(){this.execute(()=>{const r=this.getSize();this.view=new o3({position:r.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:r})})}};function rX(r,t){return{klass:iX,name:r,config:t,stack:new Error().stack,plugins:["@twick/2d/editor"]}}const rE="#000000",nE={x:0,y:0},er="easeInOut",t5={VIDEO:"video",AUDIO:"audio",CAPTION:"caption",SCENE:"scene",ELEMENT:"element"},Qv={highlight_bg:{rect:{alignItems:"center",gap:2},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,shadowOffset:[-3,3],shadowColor:"#000000",fill:"#ffffff",fontFamily:"Bangers",bgColor:"#444444",bgOffsetWidth:30,bgOffsetHeight:8,fontSize:46}},word_by_word:{rect:{alignItems:"center",justifyContent:"center",gap:8},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,strokeFirst:!0,shadowOffset:[-2,2],shadowColor:"#000000",shadowBlur:5,fontFamily:"Bangers",fill:"#FFFFFF",bgOffsetWidth:20,bgOffsetHeight:10,fontSize:46}},word_by_word_with_bg:{rect:{alignItems:"center",gap:8,padding:[10,20],radius:10},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,strokeFirst:!0,shadowOffset:[-2,2],shadowColor:"#000000",shadowBlur:5,fontFamily:"Bangers",fill:"#FFFFFF",bgOffsetWidth:20,bgOffsetHeight:10,fontSize:46}}},nX={text:"#000000",bgColor:"#444444"},sX={family:"Poppins",size:48,weight:400},aX="#FFFFFF00",dv={VIDEO:"video",IMAGE:"image"},Vu={CONTAIN:"contain",COVER:"cover",FILL:"fill"},e2={SATURATED:"saturated",BRIGHT:"bright",VIBRANT:"vibrant",RETRO:"retro",BLACK_WHITE:"blackWhite",COOL:"cool",WARM:"warm",CINEMATIC:"cinematic",SOFT_GLOW:"softGlow",MOODY:"moody",DREAMY:"dreamy",INVERTED:"inverted",VINTAGE:"vintage",DRAMATIC:"dramatic",FADED:"faded"},pv={PLAYER_UPDATE:"twick:playerUpdate"};function k0(r,t){console.log(`[Visualizer] ${r}`,t||"")}const oX={name:"audio",*create({containerRef:r,element:t,view:e}){const n=Je();yield*Kt(t==null?void 0:t.s),yield r().add(Xe(w2,{ref:n,play:!0,...t.props},t.id)),yield*Kt(Math.max(0,t.e-t.s)),yield n().play(!1),yield n().remove()}};function lX({t:r,s:t,e}){const n=r.split(" "),s=e-t,a=n.join("").length;let o=t;return n.map(l=>{const u=l.length/a*s,h=o,T=h+u;return o=T,{t:l,s:parseFloat(h.toFixed(2)),e:parseFloat(T.toFixed(2))}})}const Wf=r=>{let t=r.replace(/^#/,"");if(t.length===3&&(t=t.split("").map(o=>o+o).join("")),t.length!==6)throw new Error("Invalid hex color");const e=parseInt(t,16),n=e>>16&255,s=e>>8&255,a=e&255;return{r:n,g:s,b:a}},uX={name:"caption",*create({containerRef:r,caption:t,containerProps:e}){var o,l,u,h,T,f;const n=lX(t);let s=0;n!=null&&n.length&&(s=n[0].s);let a={refs:[],props:[],idx:0,prevTime:s};r().maxWidth((e==null?void 0:e.maxWidth)??"95%"),r().wrap((e==null?void 0:e.wrap)??"wrap"),r().justifyContent((e==null?void 0:e.justifyContent)??"center"),r().alignItems((e==null?void 0:e.alignItems)??"center");for(const d of n){a.props.push(t.props);const p=Je(),m=t.props;if(r().add(Xe(I1,{ref:p,...m,text:d.t,opacity:0})),t.capStyle=="highlight_bg"){const y=Je(),c=Je(),Q=new T2({...Wf(m.colors.bgColor),a:(m==null?void 0:m.bgOpacity)??1});r().add(Xe(E1,{ref:y,fill:Q,width:p().width()+(m.bgOffsetWidth??30),height:p().height()+(m.bgOffsetHeight??10),margin:m.bgMargin??[0,-5],radius:m.bgRadius??10,padding:m.bgPadding??[0,15],opacity:0,alignItems:"center",justifyContent:"center",layout:!0,children:Xe(I1,{ref:c,...m,text:d.t})})),p().remove(),a.refs.push({bgRef:y,textRef:c})}else a.refs.push({textRef:p});a.prevTime=d.e,a.idx=a.idx+1}a.prevTime=s,a.idx=0;for(const d of n)t.capStyle=="highlight_bg"?(yield*(l=(o=a.refs[a.idx])==null?void 0:o.bgRef)==null?void 0:l.call(o).opacity(1,0),yield*Kt(Math.max(0,d.e-d.s)),yield*(h=(u=a.refs[a.idx])==null?void 0:u.bgRef)==null?void 0:h.call(u).fill(aX,0)):(yield*(f=(T=a.refs[a.idx])==null?void 0:T.textRef)==null?void 0:f.call(T).opacity(1,0),yield*Kt(Math.max(0,d.e-d.s))),a.prevTime=d.e,a.idx=a.idx+1}},cX={name:"elastic",*run({elementRef:r,duration:t,delay:e}){e&&(yield*Kt(e)),r().scale(0),yield*r().scale(1,t,nL)}},hX={name:"erase",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size();r().setText(""),r().size(a),r().textAlign("left"),e&&(yield*Kt(e));let o=(t-n)/s.length;yield*Kt(o);for(let l=s.length;l>=0;l--)yield*Kt(o),r().setText(s.substring(0,l))}},TX={name:"stream-word",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size(),o=s.split(" ");r().setText(""),r().size(a),e&&(yield*Kt(e)),r().textAlign("left");let l=(t-n)/o.length;for(let u=0;u<o.length;u++)yield*Kt(l),r().setText(o.slice(0,u+1).join(" "))}},fX={name:"typewriter",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size();r().setText(""),r().size(a),r().textAlign("left"),e&&(yield*Kt(e));let o=(t-n)/s.length;yield*Kt(o);for(let l=0;l<s.length;l++)yield*Kt(o),r().setText(s.substring(0,l+1))}};class QX{constructor(){this.effects=new Map}register(t){this.effects.set(t.name,t)}get(t){return this.effects.get(t)}list(){return Array.from(this.effects.keys())}}const dX=()=>{l5.register(fX),l5.register(TX),l5.register(hX),l5.register(cX)},l5=new QX;dX();const pX={name:"blur",*run({elementRef:r,containerRef:t,interval:e,duration:n,intensity:s=25,animate:a}){const o=t??r;let l=Math.min(e,n);a==="enter"?(o().filters.blur(s),yield*o().filters.blur(0,l)):a==="exit"?(yield*Kt(n-l),yield*o().filters.blur(s,l)):a==="both"&&(l=Math.min(e,n/2),o().filters.blur(s),yield*o().filters.blur(0,l),yield*Kt(n-l),yield*o().filters.blur(s,l))}};function R3(r){switch(r){case"easeInSine":return kH;case"easeOutSine":return RH;case"easeInOutSine":return Gu;case"easeInQuad":return BH;case"easeOutQuad":return FH;case"easeInOutQuad":return NH;case"easeInCubic":return UH;case"easeOutCubic":return jH;case"easeInOutCubic":return E5;case"easeInQuart":return GH;case"easeOutQuart":return zH;case"easeInOutQuart":return WH;case"easeInQuint":return qH;case"easeOutQuint":return ZH;case"easeInOutQuint":return KH;case"easeInExpo":return XH;case"easeOutExpo":return iL;case"easeInOutExpo":return $H;case"easeInCirc":return YH;case"easeOutCirc":return JH;case"easeInOutCirc":return tM;case"easeInBack":return uM;case"easeOutBack":return cM;case"easeInOutBack":return hM;case"easeInElastic":return dM;case"easeOutElastic":return nL;case"easeInOutElastic":return pM;case"easeInBounce":return TM;case"easeOutBounce":return fM;case"easeInOutBounce":return QM;default:return rL}}const gX={name:"breathe",*run({elementRef:r,containerRef:t,mode:e,duration:n,intensity:s=.5}){const a=t??r,o=a().scale();e==="in"&&(yield*a().scale(new Z(o.x*s,o.y*s),n,R3("easeInSine"))),e==="out"&&(a().scale(new Z(o.x*s,o.y*s)),yield*a().scale(new Z(o.x,o.y),n,R3("easeOutSine")))}},mX={name:"fade",*run({elementRef:r,containerRef:t,interval:e,duration:n,animate:s}){const a=t??r;let o=Math.min(e,n);s==="enter"?(a().opacity(0),yield*a().opacity(1,o)):s==="exit"?(yield*Kt(n-o),yield*a().opacity(0,o)):s==="both"&&(o=Math.min(e,n/2),a().opacity(0),yield*a().opacity(1,o),yield*Kt(n-o),yield*a().opacity(0,o))}},yX={name:"photo-rise",*run({elementRef:r,containerRef:t,direction:e,duration:n,intensity:s=200}){if(t){const a=r().position();e==="up"?(r().y(a.y+s),yield*r().y(a.y,n)):e==="down"?(r().y(a.y-s),yield*r().y(a.y,n)):e==="left"?(r().x(a.x+s),yield*r().x(a.x,n)):e==="right"&&(r().x(a.x-s),yield*r().x(a.x,n))}}},vX={name:"photo-zoom",*run({elementRef:r,containerRef:t,mode:e,duration:n,intensity:s=1.5}){if(t){const a=r().scale();e==="in"&&(yield r().scale(new Z(a.x*s,a.y*s)),yield*r().scale(new Z(a.x,a.y),n)),e==="out"&&(r().scale(new Z(a.x,a.y)),yield*r().scale(new Z(a.x*s,a.y*s),n))}}},LX={name:"rise",*run({elementRef:r,containerRef:t,interval:e=.25,duration:n,animate:s,direction:a,intensity:o=200}){const l=t??r,u=l().position();let h=Math.min(e,n);s==="enter"?(l().opacity(0),a==="up"?(l().y(u.y+o),yield*xe(l().opacity(1,h/4),l().y(u.y,h))):a==="down"&&(l().y(u.y-o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)))):s==="exit"?(yield*Kt(n-h),a==="up"?yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y-o,h)):a==="down"&&(yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y+o,h)))):s==="both"&&(h=Math.min(e,n/2),l().opacity(0),a==="up"?(l().y(u.y+o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)),yield*Kt(n-h),yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y-o,h))):a==="down"&&(l().y(u.y-o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)),yield*Kt(n-h),yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y+o,h))))}},xX={name:"succession",*run({elementRef:r,containerRef:t,interval:e,duration:n,animate:s}){const a=t??r,o=a().scale();let l=Math.min(e,n);s==="enter"?(a().opacity(0),a().scale(new Z(o.x/2,o.y/2)),yield*xe(a().scale(o,l),a().opacity(1,l/2))):s==="exit"?(yield*Kt(n-l),yield*xe(a().scale(new Z(o.x/2,o.y/2),l),$i(l/2,a().opacity(0,l/2)))):s==="both"&&(l=Math.min(e,n/2),a().opacity(0),a().scale(new Z(o.x/2,o.y/2)),yield*xe(a().scale(o,l),a().opacity(1,l/2)),yield*Kt(n-l),yield*xe(a().scale(new Z(o.x/2,o.y/2),l),$i(l/2,a().opacity(0,l/2))))}};class _X{constructor(){this.animations=new Map}register(t){this.animations.set(t.name,t)}get(t){return this.animations.get(t)}list(){return Array.from(this.animations.keys())}}const bX=()=>{Gi.register(mX),Gi.register(LX),Gi.register(gX),Gi.register(xX),Gi.register(pX),Gi.register(vX),Gi.register(yX)},Gi=new _X;bX();const SX={name:"circle",*run({containerRef:r,elementRef:t,initFrameState:e,frameEffect:n}){yield*Kt(n.s);const s=n.props,a=[];a.push(r().size({x:s.frameSize[0],y:s.frameSize[1]},s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().position(s.framePosition??{x:0,y:0},s.transitionDuration,R3(s.transitionEasing??er))),a.push(t().position(s.elementPosition??nE,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().radius(s.frameSize[0]/2,s.transitionDuration,R3(s.transitionEasing??er))),s.objectFit&&a.push(R0({elementRef:t,containerSize:{x:s.frameSize[0],y:s.frameSize[1]},elementSize:e.element.size,objectFit:s.objectFit})),yield*xe(...a)}},EX={name:"rect",*run({containerRef:r,elementRef:t,initFrameState:e,frameEffect:n}){yield*Kt(n.s);const s=n.props,a=[];a.push(r().size(s.frameSize,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().position(s.framePosition??{x:0,y:0},s.transitionDuration,R3(s.transitionEasing??er))),a.push(t().position(s.elementPosition??nE,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().radius(s.radius??0,s.transitionDuration,R3(s.transitionEasing??er))),s.objectFit&&a.push(R0({elementRef:t,containerSize:{x:s.frameSize[0],y:s.frameSize[1]},elementSize:e.element.size,objectFit:s.objectFit})),yield*xe(...a)}};class AX{constructor(){this.frameEffects=new Map}register(t){this.frameEffects.set(t.name,t)}get(t){return this.frameEffects.get(t)}list(){return Array.from(this.frameEffects.keys())}}const HX=()=>{wh.register(SX),wh.register(EX)},wh=new AX;HX();function*R0({containerSize:r,elementSize:t,elementRef:e,objectFit:n}){const s=r.x/r.y,a=t.x/t.y;switch(n){case Vu.CONTAIN:a>s?(yield e().size({x:r.x,y:r.x/a}),yield e().scale(r.x/t.x,r.x*a/t.y)):(yield e().size({x:r.y*a,y:r.y}),yield e().scale(r.y*a/t.x,r.y/t.y));break;case Vu.COVER:a>s?(yield e().size({x:r.y*a,y:r.y}),yield e().scale(r.y*a/t.x,r.y/t.y)):(yield e().size({x:r.x,y:r.x/a}),yield e().scale(r.x/t.x,r.x*a/t.y));break;case Vu.FILL:yield e().size(r),yield e().scale(r.x/t.x,r.x/t.y);break}}function*gv({elementRef:r,element:t}){if(yield r(),t.textEffect){const e=l5.get(t.textEffect.name);e&&(yield*e.run({elementRef:r,duration:t.e-t.s,...t.textEffect}))}}function*Bn({elementRef:r,containerRef:t,element:e,view:n}){if(yield r(),e.animation){const s=Gi.get(e.animation.name);s&&(yield*s.run({elementRef:r,containerRef:t,view:n,duration:e.e-e.s,...e.animation}))}}function*sE({containerRef:r,elementRef:t,element:e}){var s;const n=MX({containerRef:r,elementRef:t});for(let a=0;a<((s=e==null?void 0:e.frameEffects)==null?void 0:s.length);a++){const o=e.frameEffects[a],l=a===e.frameEffects.length-1||e.frameEffects[a+1].s!==o.e,u=wh.get(o.name);u&&(yield*u.run({containerRef:r,elementRef:t,initFrameState:n,frameEffect:o}),l&&(yield*wX({containerRef:r,elementRef:t,duration:o.e-o.s,element:e,initProps:n})))}}function MX({containerRef:r,elementRef:t}){return{frame:{size:r().size(),pos:r().position(),radius:r().radius(),scale:r().scale(),rotation:r().rotation()},element:{size:r().size(),pos:t().position(),scale:t().scale()}}}function*wX({containerRef:r,elementRef:t,duration:e,element:n,initProps:s}){yield*Kt(e),k0(`restoreFrameState: ${JSON.stringify(s)}`);let a=[];a.push(r().size(s.frame.size)),a.push(r().position(s.frame.pos)),a.push(r().scale(s.frame.scale)),a.push(r().rotation(s.frame.rotation)),a.push(r().radius(s.frame.radius)),a.push(t().size(s.element.size)),a.push(t().position(s.element.pos)),a.push(t().scale(s.element.scale)),a.push(R0({elementRef:t,containerSize:s.frame.size,elementSize:s.element.size,objectFit:n.objectFit??"none"})),yield*xe(...a)}const CX={name:"circle",*create({containerRef:r,element:t,view:e}){const n=Je();yield*Kt(t==null?void 0:t.s),yield r().add(Xe(gr,{ref:n,...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}},aE=(r,t)=>{switch(t){case e2.SATURATED:r().filters.saturate(1.4),r().filters.contrast(1.1);break;case e2.BRIGHT:r().filters.brightness(1.3),r().filters.contrast(1.05);break;case e2.VIBRANT:r().filters.saturate(1.6),r().filters.brightness(1.15),r().filters.contrast(1.1);break;case e2.RETRO:r().filters.sepia(.8),r().filters.contrast(1.3),r().filters.brightness(.85),r().filters.saturate(.8);break;case e2.BLACK_WHITE:r().filters.grayscale(1),r().filters.contrast(1.25),r().filters.brightness(1.05);break;case e2.COOL:r().filters.hue(15),r().filters.brightness(1.1),r().filters.saturate(1.3),r().filters.contrast(1.05);break;case e2.WARM:r().filters.hue(-15),r().filters.brightness(1.15),r().filters.saturate(1.3),r().filters.contrast(1.05);break;case e2.CINEMATIC:r().filters.contrast(1.4),r().filters.brightness(.95),r().filters.saturate(.85),r().filters.sepia(.2);break;case e2.SOFT_GLOW:r().filters.brightness(1.2),r().filters.contrast(.95),r().filters.blur(1.2),r().filters.saturate(1.1);break;case e2.MOODY:r().filters.brightness(1.05),r().filters.contrast(1.4),r().filters.saturate(.65),r().filters.sepia(.2);break;case e2.DREAMY:r().filters.brightness(1.3),r().filters.blur(2),r().filters.saturate(1.4),r().filters.contrast(.95);break;case e2.INVERTED:r().filters.invert(1),r().filters.hue(180);break;case e2.VINTAGE:r().filters.sepia(.4),r().filters.saturate(1.4),r().filters.contrast(1.2),r().filters.brightness(1.1);break;case e2.DRAMATIC:r().filters.contrast(1.5),r().filters.brightness(.9),r().filters.saturate(1.2);break;case e2.FADED:r().filters.opacity(.9),r().filters.brightness(1.2),r().filters.saturate(.8),r().filters.contrast(.9);break}},oE={name:"image",*create({containerRef:r,element:t,view:e}){var a;yield*Kt(t==null?void 0:t.s);const n=Je(),s=Je();yield r().add(Xe(E1,{ref:n,...t.frame,children:Xe(W1,{ref:s,...t.props},`child-${t.id}`)},t.id)),n()&&(yield R0({elementRef:s,containerSize:n().size(),elementSize:s().size(),objectFit:t.objectFit}),(a=t==null?void 0:t.props)!=null&&a.mediaFilter&&aE(s,t.props.mediaFilter),yield*xe(Bn({elementRef:s,containerRef:n,element:t,view:e}),sE({containerRef:n,elementRef:s,element:t}),Kt(Math.max(0,t.e-t.s))),yield s().remove(),yield n().remove())}},DX={name:"rect",*create({containerRef:r,element:t,view:e}){const n=Je();yield*Kt(t==null?void 0:t.s),k0(`RectElement: ${JSON.stringify(t)}`),yield r().add(Xe(E1,{ref:n,...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}},lE={name:"video",*create({containerRef:r,element:t,view:e}){var a;yield*Kt(t==null?void 0:t.s);const n=Je(),s=Je();yield r().add(Xe(E1,{ref:n,...t.frame,children:Xe(v1,{ref:s,play:!0,...t.props},`child-${t.id}`)},t.id)),n()&&(yield R0({elementRef:s,containerSize:n().size(),elementSize:s().size(),objectFit:t.objectFit}),(a=t==null?void 0:t.props)!=null&&a.mediaFilter&&aE(s,t.props.mediaFilter),yield*xe(Bn({elementRef:s,containerRef:n,element:t,view:e}),sE({containerRef:n,elementRef:s,element:t}),Kt(Math.max(0,t.e-t.s))),yield s().play(!1),yield s().remove(),yield n().remove())}},OX={name:"scene",*create({containerRef:r,element:t,view:e}){yield*Kt(t==null?void 0:t.s);const n=Je();k0(`SceneElement: ${JSON.stringify(t)}`),yield r().add(Xe(E1,{ref:n,fill:t.backgroundColor??rE,size:"100%"})),t.type===dv.IMAGE?yield*oE.create({containerRef:r,element:t,view:e}):t.type===dv.VIDEO&&(yield*lE.create({containerRef:r,element:t,view:e})),yield n().remove()}},IX={name:"text",*create({containerRef:r,element:t,view:e}){var a,o,l,u,h,T,f,d;const n=Je(),s=((a=t.props)==null?void 0:a.backgroundColor)!=null&&t.props.backgroundColor!=="";if(yield*Kt(t==null?void 0:t.s),s){const p=Je(),m=Je(),y=Je();yield r().add(Xe(I1,{ref:p,text:t.t,textWrap:((o=t.props)==null?void 0:o.textWrap)??!0,textAlign:((l=t.props)==null?void 0:l.textAlign)??"center",opacity:0,...t.props},`${t.id}-measure`));const c=new T2({...Wf(t.props.backgroundColor),a:((u=t.props)==null?void 0:u.backgroundOpacity)??1}),Q=20;yield r().add(Xe(E1,{ref:m,fill:c,width:p().width()+Q,height:p().height()+4,padding:[0,Q/2],alignItems:"center",justifyContent:"center",layout:!0,children:Xe(I1,{ref:y,text:t.t,textWrap:((h=t.props)==null?void 0:h.textWrap)??!0,textAlign:((T=t.props)==null?void 0:T.textAlign)??"center",...t.props})},t.id)),p().remove(),yield*xe(Bn({elementRef:m,element:t,view:e}),gv({elementRef:y,element:t}),Kt(Math.max(0,t.e-t.s))),yield m().remove()}else yield r().add(Xe(I1,{ref:n,text:t.t,textWrap:((f=t.props)==null?void 0:f.textWrap)??!0,textAlign:((d=t.props)==null?void 0:d.textAlign)??"center",...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),gv({elementRef:n,element:t}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}};class VX{constructor(){this.elements=new Map}register(t){this.elements.set(t.name,t)}get(t){return this.elements.get(t)}list(){return Array.from(this.elements.keys())}}const PX=()=>{k2.register(lE),k2.register(uX),k2.register(OX),k2.register(oE),k2.register(IX),k2.register(oX),k2.register(CX),k2.register(DX)},k2=new VX;PX();const kX={name:"text",*render({view:r,watermark:t,duration:e}){const n=t.props;if(!(n!=null&&n.text))return;const s=t.position??{x:0,y:0},a=(t.rotation??0)*(Math.PI/180),o=t.opacity??1,l=Je();r.add(Xe(I1,{ref:l,text:n.text,x:s.x,y:s.y,rotation:a,opacity:o,fontSize:n.fontSize??24,fontFamily:n.fontFamily??"Arial",fill:n.fill??"#ffffff",stroke:n.stroke,lineWidth:n.lineWidth??n.strokeWidth??0,textAlign:n.textAlign??"center",fontWeight:n.fontWeight??400,fontStyle:n.fontStyle??"normal"})),yield*Kt(e)}},RX={name:"image",*render({view:r,watermark:t,duration:e}){const n=t.props;if(!(n!=null&&n.src))return;const s=t.position??{x:0,y:0},a=(t.rotation??0)*(Math.PI/180),o=t.opacity??1,l=Je();r.add(Xe(W1,{ref:l,src:n.src,x:s.x,y:s.y,width:n.width,height:n.height,rotation:a,opacity:o})),yield*Kt(e)}};class BX{constructor(){this.renderers=new Map}register(t){this.renderers.set(t.name,t)}get(t){return this.renderers.get(t)}list(){return Array.from(this.renderers.keys())}}const Ch=new BX;function FX(){Ch.register(kX),Ch.register(RX)}FX();function*NX({view:r,track:t}){var s;const e=Je();let n=0;r.add(Xe(Ht,{size:"100%",ref:e}));for(const a of t.elements||[])yield*Kt((a==null?void 0:a.s)-n),yield*(s=k2.get("video"))==null?void 0:s.create({containerRef:e,element:a,view:r}),n=a.e;yield e().remove()}function*UX({view:r,track:t}){let e=0;for(const n of t.elements){const s=Je();yield*Kt((n==null?void 0:n.s)-e),e=n==null?void 0:n.e,k0(`Adding audio element ${n.id}`),r.add(Xe(w2,{ref:s,...n.props},n.id)),yield*Kt(Math.max(0,n.e-n.s)),yield s().playing(!1),yield s().remove()}}function*jX({view:r,track:t}){var l;let e=0;const n=Je();r.add(Xe(Ht,{size:"100%",ref:n}));const s=t==null?void 0:t.props,a=(s==null?void 0:s.applyToAll)??!1,o=(Qv[(s==null?void 0:s.capStyle)??""]||{}).word||{};for(const u of t.elements){const h=u.props,T=(Qv[(h==null?void 0:h.capStyle)??(s==null?void 0:s.capStyle)??""]||{}).rect||{},f={...T,justifyContent:T.justifyContent,alignItems:T.alignItems},d=a?s==null?void 0:s.colors:(h==null?void 0:h.colors)??(s==null?void 0:s.colors)??nX,p={...o,...(s==null?void 0:s.captionProps)||{},colors:d,font:a?s==null?void 0:s.font:(h==null?void 0:h.font)??(s==null?void 0:s.font)??sX,fill:d.text,bgColor:d.bgColor,bgOpacity:(s==null?void 0:s.bgOpacity)??1};yield*Kt((u==null?void 0:u.s)-e);const m=Je();if(n().add(Xe(E1,{ref:m,...f,x:a?s==null?void 0:s.x:(h==null?void 0:h.x)??(s==null?void 0:s.x),y:a?s==null?void 0:s.y:(h==null?void 0:h.y)??(s==null?void 0:s.y),layout:!0},u.id)),(s==null?void 0:s.capStyle)==="word_by_word_with_bg"){const y=new T2({...Wf(p.bgColor),a:(p==null?void 0:p.bgOpacity)??1});m().fill(y)}yield*(l=k2.get("caption"))==null?void 0:l.create({containerRef:m,caption:{...u,t:u.t??"",capStyle:(h==null?void 0:h.capStyle)??(s==null?void 0:s.capStyle),props:p},view:r}),e=u.e,yield m().remove()}}function*GX({view:r,track:t}){var n;const e=Je();r.add(Xe(Ht,{size:"100%",ref:e}));for(const s of t.elements||[])yield*(n=k2.get("scene"))==null?void 0:n.create({containerRef:e,element:s,view:r,containerProps:t.containerProps});yield e().remove()}function*zX({view:r,track:t}){var s;const e=Je();r.add(Xe(Ht,{size:"100%",ref:e}));const n=[];try{for(const a of t.elements)n.push((s=k2.get(a.type))==null?void 0:s.create({containerRef:e,element:a,view:r}))}catch(a){k0("Error creating element track",a)}yield*xe(...n),yield e().remove()}function*WX({view:r,watermark:t,duration:e}){if(e<=0)return;yield*Kt(.001);const n=Ch.get(t.type);n&&(yield*n.render({view:r,watermark:t,duration:e}))}const mv=(r,t)=>{if(typeof window<"u"){const e=new CustomEvent(r,t);return window.dispatchEvent(e)}},qX=rX("scene",function*(r){var n;const t=S5().variables.get("input",null)(),e=S5().variables.get("playerId",null)();if(t)if(yield r.add(Xe(E1,{fill:t.backgroundColor??rE,size:"100%"})),t.tracks){const s=[];for(const a of t.tracks)switch(a.type){case t5.VIDEO:s.push(NX({view:r,track:a}));break;case t5.AUDIO:s.push(UX({view:r,track:a}));break;case t5.CAPTION:s.push(jX({view:r,track:a}));break;case t5.SCENE:s.push(GX({view:r,track:a}));break;case t5.ELEMENT:s.push(zX({view:r,track:a}));break}if(t.watermark){const a=((n=t.tracks)==null?void 0:n.length)>0?Math.max(0,...t.tracks.flatMap(o=>o.elements||[]).map(o=>o.e)):10;s.push(WX({view:r,watermark:t.watermark,duration:a}))}yield*xe(...s),mv(pv.PLAYER_UPDATE,{detail:{status:"ready",playerId:e,message:"All elements created"}})}else mv(pv.PLAYER_UPDATE,{detail:{status:"ready",playerId:e,message:"No elements to create"}})}),i$=MM({scenes:[qX]});export{i$ as default};
309
+ `))}else this.element.innerText=this.text()}};k([dt(""),Rf(tL),ot()],H2.prototype,"text",2);k([vt()],H2.prototype,"parentTxt",1);k([jn(()=>{try{return new Intl.Segmenter(void 0,{granularity:"grapheme"})}catch{return null}})],H2,"segmenter",2);H2=k([k1("TxtLeaf")],H2);["fill","stroke","lineWidth","strokeFirst","lineCap","lineJoin","lineDash","lineDashOffset"].forEach(r=>{H2.prototype[`get${Wr(r)}`]=function(){var t;return((t=this.parentTxt())==null?void 0:t[r]())??this[r].context.getInitial()}});var cv,hv,I1=class extends(hv=s1,cv=eE,hv){constructor({children:r,text:t,...e}){super(e),this[cv]=!0,this.children(t??r)}static b(r){return new I1({...r,fontWeight:700})}static i(r){return new I1({...r,fontStyle:"italic"})}getText(){return this.innerText()}setText(r){const t=this.children();let e=null;for(let n=0;n<t.length;n++){const s=t[n];e===null&&s instanceof H2?e=s:s.parent(null)}e===null?(e=new H2({text:r}),e.parent(this)):e.text(r),this.setParsedChildren([e])}setChildren(r){this.children.context.raw()!==r&&(typeof r=="string"?this.text(r):super.setChildren(r))}*tweenText(r,t,e,n){var h;yield(h=document.fonts)==null?void 0:h.ready;const s=this.children();(s.length!==1||!(s[0]instanceof H2))&&this.text.save();const a=this.childAs(0),o=a.text.context.raw(),l=this.size.context.raw();a.text(r);const u=this.size();a.text(o??zu),this.height()===0&&this.height(u.height),yield*xe(this.size(u,t,e),a.text(r,t,e,n)),this.children.context.setter(r),this.size(l)}getLayout(){return!0}innerText(){const r=this.childrenAs();let t="";for(const e of r)t+=e.text();return t}parentTxt(){const r=this.parent();return r instanceof I1?r:null}parseChildren(r){const t=[],e=Array.isArray(r)?r:[r];for(const n of e)n instanceof I1||n instanceof H2?t.push(n):typeof n=="string"&&t.push(new H2({text:n}));return t}applyFlex(){super.applyFlex(),this.element.style.display=this.findAncestor(US(I1))?"inline":"block"}async draw(r){var t;await((t=document.fonts)==null?void 0:t.ready),await this.drawChildren(r)}};k([dt(""),ot()],I1.prototype,"text",2);k([t1()],I1.prototype,"tweenText",1);k([vt()],I1.prototype,"innerText",1);k([vt()],I1.prototype,"parentTxt",1);I1=k([k1("Txt")],I1);["fill","stroke","lineWidth","strokeFirst","lineCap","lineJoin","lineDash","lineDashOffset"].forEach(r=>{I1.prototype[`getDefault${Wr(r)}`]=function(t){var e;return((e=this.parentTxt())==null?void 0:e[r]())??t}});var Tv=class{constructor(r,t,e,n=0){this.segment=r,this.sourceFps=t,this.targetFps=e,this.sum=n,this.framesRequested=0}async getNextFrame(){var t;const r=this.sourceFps/this.targetFps;if(this.sum+=r,this.framesRequested+=1,this.sum<1&&this.lastFrame)return this.lastFrame;for(;this.sum>=2;){const e=await this.segment.getNextFrame();if(!e)return;e.close(),this.sum-=1}if(this.sum>=1||!this.lastFrame){this.sum-=1;const e=await this.segment.getNextFrame();return e?((t=this.lastFrame)==null||t.close(),this.lastFrame=e,e):void 0}throw new Error("Unreachable code")}getLastFrame(){return this.lastFrame}getSum(){return this.sum}getSegment(){return this.segment}getTime(r){return(this.framesRequested-r)/this.targetFps}},iE=class{constructor(r,t,e=0){this.file=r,this.setStatus=t,this.offset=e}write(r){const t=new ArrayBuffer(r.byteLength);new Uint8Array(t).set(r),t.fileStart=this.offset,this.offset+=t.byteLength,this.setStatus("fetch",(this.offset/1024**2).toFixed(1)+" MiB"),this.file.appendBuffer(t)}close(){this.setStatus("fetch","Done"),this.file.flush()}},qK=30,fv=class{constructor(r,t,e,n,s=0){this.done=!1,this.currentFramePastSegmentEndTime=!1,this.abortController=new AbortController,this.responseFinished=!1,this.framesProcessed=0,this.framesDue=0,this.frameBuffer=[],this.encodedChunkQueue=[],this.readMore=async()=>{},this.uri=r,this.file=t,this.file.onSamples=this.onSamples.bind(this),this.edit=e[n],this.startTime=s;const a=Math.floor(this.startTime*this.edit.fps);this.framesProcessed+=a,this.decoder=new VideoDecoder({output:this.onFrame.bind(this),error(o){console.error(o)}})}async start(r){if(this.edit.mediaTime===-1){this.done=!0,this.responseFinished=!0,this.decoder.close();const u=this.edit.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale,h=Math.ceil(u*this.edit.fps),T=this.file.getInfo().videoTracks[0].track_height,f=this.file.getInfo().videoTracks[0].track_width,d=T*f*4,p=new ArrayBuffer(d),m=new Uint8Array(p);m.fill(0),this.frameBuffer=Array.from({length:h},()=>new VideoFrame(m,{timestamp:0,duration:1/this.edit.fps,codedHeight:T,codedWidth:f,format:"BGRA"}));return}this.decoder.configure(r);const t=this.file.getInfo().videoTracks[0],e=this.file.getTrackById(t.id),n=this.edit.mediaTime,s=this.startTime*t.timescale,o=(n+s)/t.timescale,l=this.file.seekTrack(o,!0,e);this.readMore=await this.startStreamingAtOffset(this.file,this.uri,l.offset)}async startStreamingAtOffset(r,t,e){return fetch(t,{headers:{Range:`bytes=${e}-`},signal:this.abortController.signal}).then(async n=>{if(!n.body)throw new Error("Response body is null");const s=n.body.getReader(),a=new iE(r,()=>{},e);return async()=>s.read().then(({done:o,value:l})=>{if(o){this.responseFinished=!0,this.abortController.abort(),a.close();return}a.write(l)})})}onSamples(r,t,e){for(const n of e){const s=new EncodedVideoChunk({type:n.is_sync?"key":"delta",timestamp:1e6*n.cts/n.timescale,duration:1e6*n.duration/n.timescale,data:n.data});this.framesDue++,this.encodedChunkQueue.push(s);const a=this.file.getInfo().videoTracks[0],o=this.file.getTrackById(a.id);this.file.releaseSample(o,n.number)}}async decodeChunks(){for(;this.encodedChunkQueue.length>0&&this.decoder.decodeQueueSize<qK;){const r=this.encodedChunkQueue.shift();r&&this.decoder.decode(r)}if(this.done){this.currentFramePastSegmentEndTime=!0;return}if(this.responseFinished&&this.encodedChunkQueue.length===0){await this.flushDecoderWithRetry(),this.currentFramePastSegmentEndTime=!0;return}}async flushDecoderWithRetry(r=3,t=2e3){for(let e=0;e<r;e++){if(this.decoder.decodeQueueSize===0)return;try{await Promise.race([this.decoder.flush(),new Promise((n,s)=>setTimeout(()=>s(new Error("Flush timeout")),t))])}catch(n){if(e===r)throw n}}}async onFrame(r){this.framesDue--;const t=this.edit.mediaTime/this.file.getInfo().videoTracks[0].timescale,e=this.startTime+t,n=r.timestamp/1e6;if(n<e){r.close();return}const s=this.edit.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale,a=t+s;if(n>a){r.close(),this.done=!0,await this.decoder.flush();return}this.frameBuffer.push(r)}async populateBuffer(){for(;this.frameBuffer.length===0&&!this.currentFramePastSegmentEndTime;)this.responseFinished||await this.readMore(),await this.decodeChunks(),await new Promise(r=>setTimeout(r,0));if(this.frameBuffer.length===0&&this.framesDue>0){let r=200;for(;this.frameBuffer.length===0;)if(await new Promise(t=>setTimeout(t,10)),r--,this.done||r===0)return}}async getNextFrame(){await this.populateBuffer();const r=this.frameBuffer.shift();return r&&this.framesProcessed++,r}async close(){this.abortController.abort(),this.frameBuffer.forEach(r=>r.close());try{this.decoder.state==="configured"&&(await this.decoder.flush(),this.decoder.close())}catch{}}getFramesProcessed(){return this.framesProcessed}getStartTime(){return this.startTime}};function ZK(r,t){const e=r.getTrackById(t.id);for(const n of e.mdia.minf.stbl.stsd.entries){const s=n.avcC||n.hvcC||n.vpcC||n.av1C;if(s){const a=new Co.DataStream(void 0,0,Co.DataStream.BIG_ENDIAN);return s.write(a),new Uint8Array(a.buffer,8)}}throw new Error("avcC, hvcC, vpcC, or av1C box not found")}function KK(r){return{mediaTime:r.media_time,segmentDuration:r.segment_duration,mediaRateInteger:r.media_rate_integer,mediaRateFraction:r.media_rate_fraction}}async function XK(r){return new Promise((t,e)=>{const n=Co.createFile();let s=!1;const a=new AbortController;return n.onReady=o=>{var p;s=!0,a.abort();const l=o.videoTracks[0];if(!l){e("No video track found");return}const u={codec:l.codec.startsWith("vp08")?"vp8":l.codec,codedHeight:l.video.height,codedWidth:l.video.width,description:ZK(n,l)},h={mediaTime:0,segmentDuration:l.duration,mediaRateInteger:1,mediaRateFraction:0},T=(p=l.edits)==null?void 0:p.map(m=>KK(m)),d=(T!=null&&T.length?T:[h]).map(m=>{const y=l.duration/l.timescale,c=m.segmentDuration/l.movie_timescale,Q=l.nb_samples*(c/y),g=m.mediaRateInteger+m.mediaRateFraction/65535,v=Q/c*g;return{...m,fps:v}});n.setExtractionOptions(l.id),n.start(),t({file:n,edits:d,config:u})},n.onError=o=>e(o),fetch(r,{signal:a.signal}).then(async o=>{if(!o.ok){e(`HTTP ${o.status}: ${o.statusText}`);return}if(!o.body){e("Response body is null");return}const l=o.body.getReader(),u=new iE(n,()=>{});let h=0;for(;!s;)await l.read().then(({done:T,value:f})=>{if(T){n.flush(),a.abort(),s||e("Could not find moov box in video file");return}h+=f.byteLength,u.write(f)})}).catch(o=>e(o))})}var $K=class{constructor(r,t,e){this.edits=[],this.nextSegment=0,this.uri=r,this.targetFps=t,this.startTime=e}async start(){const{file:r,edits:t,config:e}=await XK(this.uri);this.file=r,this.edits=t,this.decoderConfig=e}async getNextFrame(){var t;if(!this.sampler){let e=this.startTime;for(;this.nextSegment<this.edits.length;){const s=this.getSecondDurationOfSegment(this.edits[this.nextSegment]);if(e<s)break;e-=s,this.nextSegment++}if(this.nextSegment>=this.edits.length)throw new Error(`Timestamp ${this.startTime} is outside of the video, max timestamp is ${this.getDuration()}`);const n=new fv(this.uri,this.file,this.edits,this.nextSegment,e);await n.start(this.decoderConfig),this.sampler=new Tv(n,this.edits[this.nextSegment].fps,this.targetFps,0),this.nextSegment++}let r=await this.sampler.getNextFrame();for(;!r&&this.nextSegment<this.edits.length;){this.sampler.getSegment().close(),(t=this.sampler.getLastFrame())==null||t.close();const e=new fv(this.uri,this.file,this.edits,this.nextSegment,0);await e.start(this.decoderConfig),this.sampler=new Tv(e,this.edits[this.nextSegment].fps,this.targetFps,this.sampler.getSum()),this.nextSegment++,r=await this.sampler.getNextFrame()}if(!r&&(r=this.sampler.getLastFrame(),await this.sampler.getSegment().close(),!r))throw new Error("There are no frames in the video.");return r}getSecondDurationOfSegment(r){const t=r.mediaRateInteger+r.mediaRateFraction/65535;return r.segmentDuration/this.file.getInfo().videoTracks[0].movie_timescale/t}getDuration(){return this.edits.reduce((r,t)=>r+this.getSecondDurationOfSegment(t),0)}getTimeSubtractingFrames(r){const t=this.edits.slice(0,this.nextSegment-1).reduce((s,a)=>s+this.getSecondDurationOfSegment(a),0);if(!this.sampler)throw new Error("No current segment");const e=this.sampler.getSegment().getStartTime(),n=this.sampler.getTime(r);return t+e+n}getTime(){return this.getTimeSubtractingFrames(0)}getLastTime(){return this.getTimeSubtractingFrames(1)}getLastFrame(){var r;return(r=this.sampler)==null?void 0:r.getLastFrame()}close(){var r,t,e;(r=this.sampler)==null||r.getSegment().close(),(e=(t=this.sampler)==null?void 0:t.getLastFrame())==null||e.close(),this.file.flush()}},YK=class{constructor(r){this.src=r,this.lastTime=-1,this.video=document.createElement("video"),this.video.crossOrigin="anonymous",this.video.preload="auto",this.video.src=r,this.video.muted=!0,this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0})}async start(){return new Promise((r,t)=>{const e=setTimeout(()=>{t(new Error("Timeout loading video metadata"))},3e4);this.video.addEventListener("loadedmetadata",()=>{clearTimeout(e),this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,r()},{once:!0}),this.video.addEventListener("error",()=>{clearTimeout(e),t(new Error("Failed to load video"))},{once:!0})})}async getFrameAt(r){return Math.abs(this.video.currentTime-r)>.016&&await this.seekTo(r),this.ctx.drawImage(this.video,0,0),createImageBitmap(this.canvas)}async seekTo(r){return new Promise((t,e)=>{const n=setTimeout(()=>{e(new Error(`Seek timeout at ${r}s`))},5e3),s=()=>{clearTimeout(n),this.video.removeEventListener("seeked",s),t()};this.video.addEventListener("seeked",s,{once:!0}),this.video.currentTime=r})}getDuration(){return this.video.duration||0}getTime(){return this.video.currentTime}getLastTime(){return this.lastTime}close(){this.video.src="",this.video.load()}},Oo=new Map;async function Iu(r,t,e,n){const s=t+"-"+r;let a=Oo.get(s);return a||(a=new YK(t),await a.start(),Oo.set(s,a)),a.getFrameAt(e)}function JK(r,t){const e=t+"-"+r,n=Oo.get(e);n&&(n.close(),Oo.delete(e))}var Ur=new Map,x5=new Set;async function tX(r,t){const e=t+"-"+r,n=Ur.get(e);n&&(n.close(),Ur.delete(e)),x5.has(e)&&(JK(r,t),x5.delete(e))}async function eX(r,t,e,n){const s=t+"-"+r;if(x5.has(s))return Iu(r,t,e);let a=Ur.get(s);const o=1/n,l=a==null?void 0:a.getDuration();l&&e>l&&(e=l);const u=a&&Math.abs(e-a.getLastTime())<o/2;if(a&&u){const h=a.getLastFrame();if(!h)throw new Error("No last frame");return h}if(a&&e+o<a.getTime()&&(a.close(),Ur.delete(s),a=void 0),a&&e>a.getTime()+o*1.5&&(a.close(),Ur.delete(s),a=void 0),!a){a=new $K(t,n,e);try{await a.start()}catch{return x5.add(s),Iu(r,t,e)}const h=a.getDuration();if(h===0)return a.close(),Ur.delete(s),x5.add(s),Iu(r,t,e);if(h>0&&e>h)throw new Error(`Requested time ${e}s exceeds video duration ${h}s`);Ur.set(s,a)}return a.getNextFrame()}var v1=class extends c1{constructor(r){super(r),this.detectedFileType="unknown",this.fileTypeWasDetected=!1,this.lastFrame=null}createVideoElement(r,t){const e=document.createElement("video");if(e.crossOrigin="anonymous",r&&r!=="undefined"){try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const a=new D3;a.loadSource(r),a.attachMedia(e)}else e.src=r}catch{e.src=r}const n=()=>{const s=e.error;if(s&&(s.code===4||s.code===2)){e.removeEventListener("error",n);const a=`${t}_no_cors`;let o=v1.pool[a];if(!o){o=document.createElement("video"),o.crossOrigin=null;try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const u=new D3;u.loadSource(r),u.attachMedia(o)}else o.src=r}catch{o.src=r}v1.pool[a]=o}v1.pool[t]=o}};e.addEventListener("error",n,{once:!0})}return e}desiredSize(){const r=super.desiredSize();if(r.x===null&&r.y===null){const t=this.video();return{x:t.videoWidth,y:t.videoHeight}}return r}mediaElement(){return this.video()}seekedMedia(){return this.seekedVideo()}fastSeekedMedia(){return this.fastSeekedVideo()}getCacheKey(r){if(!r||r==="undefined")return`${this.key}/pending`;try{return new URL(r,window.location.origin).href.split("#")[0]}catch{return r}}video(){const r=this.src(),t=this.getCacheKey(r);let e=v1.pool[t];if(!e)e=this.createVideoElement(r,t),v1.pool[t]=e;else if(r&&r!=="undefined"){const s=l=>{try{return new URL(l,window.location.origin).href.split("#")[0]}catch{return l}},a=s(r);if((e.src?s(e.src):"")!==a)try{if(new URL(r,window.location.origin).pathname.endsWith(".m3u8")){const u=new D3;u.loadSource(r),u.attachMedia(e)}else e.src=r}catch{e.src=r}}return(!r||r==="undefined")&&n1.collectPromise(new Promise(s=>{const a=()=>{const o=this.src();o&&o!=="undefined"?s():setTimeout(a,10)};a()})),this.waitForCanPlayNecessary(e)&&n1.collectPromise(new Promise(s=>{this.waitForCanPlay(e,s)})),e}seekedVideo(){const r=this.video(),t=this.clampTime(this.time());return r.playbackRate=this.playbackRate(),r.paused||r.pause(),this.lastTime===t||this.setCurrentTime(t),r}fastSeekedVideo(){const r=this.video(),t=this.clampTime(this.time()),e=this.playing()&&t<r.duration&&r.playbackRate>0,n=t<.5&&r.currentTime>1&&Math.abs(r.currentTime-this.lastTime)<.5,s=Math.abs(r.currentTime-t)>1;return r.playbackRate=this.playbackRate(),this.lastTime===t||(e?r.paused&&n1.collectPromise(r.play()):r.paused||r.pause(),n||(s?this.setCurrentTime(t):e||this.setCurrentTime(t))),r}async webcodecSeekedVideo(){const r=this.video(),t=this.clampTime(this.time());if(r.playbackRate=this.playbackRate(),this.lastFrame&&this.lastTime===t)return this.lastFrame;const e=this.view().fps()/this.playbackRate();return eX(this.key,r.src,t,e)}async ffmpegSeekedVideo(){const r=this.video(),t=this.clampTime(this.time()),e=this.getDuration();if(r.playbackRate=this.playbackRate(),this.lastFrame&&this.lastTime===t)return this.lastFrame;const n=this.view().fps()/this.playbackRate();if(!v1.imageCommunication)throw new Error("ServerSeekedVideo can only be used with HMR.");const s=await v1.imageCommunication.getFrame(this.key,r.src,t,e,n);return this.lastFrame=s,this.lastTime=t,s}async seekFunction(){const r=this.view().playbackState();return r===$1.Playing||r===$1.Presenting?this.fastSeekedVideo():r===$1.Paused?this.seekedVideo():this.decoder()==="slow"?this.seekedVideo():this.decoder()==="ffmpeg"?this.ffmpegSeekedVideo():this.decoder()==="web"?this.webcodecSeekedVideo():(this.fileTypeWasDetected||this.detectFileType(),this.detectedFileType==="webm"?this.ffmpegSeekedVideo():this.detectedFileType==="hls"?this.seekedVideo():this.webcodecSeekedVideo())}async draw(r){this.autoPlayBasedOnTwick(),this.drawShape(r);const t=this.alpha();if(t>0){const e=await this.seekFunction(),n=ue.fromSizeCentered(this.computedSize());r.save(),r.clip(this.getPath()),t<1&&(r.globalAlpha*=t),r.imageSmoothingEnabled=this.smoothing(),NS(r,e,n),r.restore()}this.clip()&&r.clip(this.getPath()),await this.drawChildren(r)}applyFlex(){super.applyFlex();try{const r=this.video();r&&r.videoWidth>0&&r.videoHeight>0&&(this.element.style.aspectRatio=(this.ratio()??r.videoWidth/r.videoHeight).toString())}catch{}}remove(){return super.remove(),tX(this.key,this.src()),this}handleUnknownFileType(r){console.warn(`WARNING: Could not detect file type of video (${r}), will default to using mp4 decoder. If your video file is not an mp4 file, this will lead to an error - to fix this, reencode your video as an mp4 file (better performance) or specify a different decoder: https://docs.re.video/common-issues/slow-rendering#use-mp4-decoder`),this.detectedFileType="unknown",this.fileTypeWasDetected=!0}detectFileType(){return n1.collectPromise((async()=>{var s;const r=this.src(),t=(s=r.split("?")[0].split(".").pop())==null?void 0:s.toLowerCase();if(t==="mp4"||t==="webm"||t==="mov"){this.detectedFileType=t,this.fileTypeWasDetected=!0;return}if(t==="m3u8"){this.detectedFileType="hls",this.fileTypeWasDetected=!0;return}if(!r.startsWith("http://")&&!r.startsWith("https://")){this.handleUnknownFileType(r);return}const n=(await fetch(r,{method:"HEAD"})).headers.get("Content-Type");if(!n){this.handleUnknownFileType(r);return}if(n.includes("video/mp4")){this.detectedFileType="mp4",this.fileTypeWasDetected=!0;return}if(n.includes("video/webm")){this.detectedFileType="webm",this.fileTypeWasDetected=!0;return}if(n.includes("video/quicktime")){this.detectedFileType="mov",this.fileTypeWasDetected=!0;return}if(n.includes("application/vnd.apple.mpegurl")||n.includes("application/x-mpegURL")){this.detectedFileType="hls",this.fileTypeWasDetected=!0;return}this.handleUnknownFileType(r)})())}};v1.pool={};v1.imageCommunication=null;k([dt(1),ot()],v1.prototype,"alpha",2);k([dt(!0),ot()],v1.prototype,"smoothing",2);k([dt(null),ot()],v1.prototype,"decoder",2);k([vt()],v1.prototype,"video",1);k([vt()],v1.prototype,"seekedVideo",1);k([vt()],v1.prototype,"fastSeekedVideo",1);v1=k([k1("Video")],v1);var iX=class extends zM{constructor(r){super(r),this.view=null,this.registeredNodes=new Map,this.nodeCounters=new Map,this.assetHash=Date.now().toString(),this.recreateView()}getView(){return this.view}next(){var r;return(r=this.getView())==null||r.playbackState(this.playback.state).globalTime(this.playback.time),super.next()}async draw(r){r.save(),this.renderLifecycle.dispatch([e5.BeforeRender,r]),r.save(),this.renderLifecycle.dispatch([e5.BeginRender,r]),this.getView().playbackState(this.playback.state).globalTime(this.playback.time).fps(this.playback.fps),this.playback.state===$1.Paused&&await this.syncAllMediaToCurrentTime(!0),await this.getView().render(r),this.renderLifecycle.dispatch([e5.FinishRender,r]),r.restore(),this.renderLifecycle.dispatch([e5.AfterRender,r]),r.restore()}reset(r){for(const t of this.registeredNodes.keys())try{this.registeredNodes.get(t).dispose()}catch(e){this.logger.error(e)}return this.registeredNodes.clear(),this.registeredNodes=new Map,this.nodeCounters.clear(),this.recreateView(),super.reset(r)}inspectPosition(r,t){const e=this.getNodeByPosition(r,t);return e==null?void 0:e.key}getNodeByPosition(r,t){return this.execute(()=>this.getView().hit(new Z(r,t))??null)}validateInspection(r){var t;return((t=this.getNode(r))==null?void 0:t.key)??null}inspectAttributes(r){const t=this.getNode(r);if(!t)return null;const e={stack:t.creationStack,key:t.key};for(const{key:n,meta:s,signal:a}of t)s.inspectable&&(e[n]=a());return e}drawOverlay(r,t,e){const n=this.getNode(r);n&&this.execute(()=>{n.drawOverlay(e,t.multiply(n.localToWorld()))})}transformMousePosition(r,t){return Q1(new Z(r,t),this.getView().localToParent().inverse())}registerNode(r,t){var a;const e=((a=r.constructor)==null?void 0:a.name)??"unknown",n=(this.nodeCounters.get(e)??0)+1;this.nodeCounters.set(e,n),t&&this.registeredNodes.has(t)&&(ce().error({message:`Duplicated node key: "${t}".`,inspect:t,stack:new Error().stack}),t=void 0),t??(t=`${this.name}/${e}[${n}]`),this.registeredNodes.set(t,r);const s=this.registeredNodes;return[t,()=>s.delete(t)]}getNode(r){return typeof r!="string"?null:this.registeredNodes.get(r)??null}*getDetachedNodes(){for(const r of this.registeredNodes.values())!r.parent()&&r!==this.view&&(yield r)}getMediaAssets(){const t=this.playback.state===$1.Rendering,e=Array.from(this.registeredNodes.values()).filter(l=>l instanceof v1),n=Array.from(this.registeredNodes.values()).filter(l=>l instanceof w2);t&&(e.forEach(l=>{const u=l.src();u&&u!=="undefined"&&!l.isPlaying()&&l.playing(!0)}),n.forEach(l=>{const u=l.src();u&&u!=="undefined"&&!l.isPlaying()&&l.playing(!0)}));const s=e.filter(l=>l.isPlaying()),a=n.filter(l=>l.isPlaying()),o=[];return o.push(...s.map(l=>({key:l.key,type:"video",src:l.src(),decoder:l.decoder(),playbackRate:typeof l.playbackRate=="function"?l.playbackRate():l.playbackRate,volume:l.getVolume(),currentTime:l.getCurrentTime(),duration:l.getDuration()}))),o.push(...a.map(l=>({key:l.key,type:"audio",src:l.src(),playbackRate:typeof l.playbackRate=="function"?l.playbackRate():l.playbackRate,volume:l.getVolume(),currentTime:l.getCurrentTime(),duration:l.getDuration()}))),o}async syncAllMediaToCurrentTime(r){const t=this.playback.time,n=Array.from(this.registeredNodes.values()).filter(s=>s instanceof c1).map(s=>{try{return s.syncToCurrentTime(t,{waitForSeek:r})}catch(a){this.logger.warn({message:`syncAllMediaToCurrentTime: skipped node ${s.key??"unknown"}`,object:a});return}});if(r){const s=n.filter(a=>a!==void 0);await Promise.all(s)}}stopAllMedia(){const r=Array.from(this.registeredNodes.values()).filter(t=>t instanceof c1).filter(t=>t.isPlaying());for(const t of r)t.dispose()}adjustVolume(r){const t=Array.from(this.registeredNodes.values()).filter(e=>e instanceof c1);for(const e of t)e.setVolume(e.getVolume()*r)}recreateView(){this.execute(()=>{const r=this.getSize();this.view=new o3({position:r.scale(this.resolutionScale/2),scale:this.resolutionScale,assetHash:this.assetHash,size:r})})}};function rX(r,t){return{klass:iX,name:r,config:t,stack:new Error().stack,plugins:["@twick/2d/editor"]}}const rE="#000000",nE={x:0,y:0},er="easeInOut",t5={VIDEO:"video",AUDIO:"audio",CAPTION:"caption",SCENE:"scene",ELEMENT:"element"},Qv={highlight_bg:{rect:{alignItems:"center",gap:2},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,shadowOffset:[-3,3],shadowColor:"#000000",fill:"#ffffff",fontFamily:"Bangers",bgColor:"#444444",bgOffsetWidth:30,bgOffsetHeight:8,fontSize:46}},word_by_word:{rect:{alignItems:"center",justifyContent:"center",gap:8},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,strokeFirst:!0,shadowOffset:[-2,2],shadowColor:"#000000",shadowBlur:5,fontFamily:"Bangers",fill:"#FFFFFF",bgOffsetWidth:20,bgOffsetHeight:10,fontSize:46}},word_by_word_with_bg:{rect:{alignItems:"center",gap:8,padding:[10,20],radius:10},word:{lineWidth:.35,stroke:"#000000",fontWeight:700,strokeFirst:!0,shadowOffset:[-2,2],shadowColor:"#000000",shadowBlur:5,fontFamily:"Bangers",fill:"#FFFFFF",bgOffsetWidth:20,bgOffsetHeight:10,fontSize:46}}},nX={text:"#000000",bgColor:"#444444"},sX={family:"Poppins",size:48,weight:400},aX="#FFFFFF00",dv={VIDEO:"video",IMAGE:"image"},Vu={CONTAIN:"contain",COVER:"cover",FILL:"fill"},i2={SATURATED:"saturated",BRIGHT:"bright",VIBRANT:"vibrant",RETRO:"retro",BLACK_WHITE:"blackWhite",COOL:"cool",WARM:"warm",CINEMATIC:"cinematic",SOFT_GLOW:"softGlow",MOODY:"moody",DREAMY:"dreamy",INVERTED:"inverted",VINTAGE:"vintage",DRAMATIC:"dramatic",FADED:"faded"},pv={PLAYER_UPDATE:"twick:playerUpdate"};function k0(r,t){console.log(`[Visualizer] ${r}`,t||"")}const oX={name:"audio",*create({containerRef:r,element:t,view:e}){var l,u;const n=Je();yield*Kt(t==null?void 0:t.s);const s=((l=t.props)==null?void 0:l.time)??0,a=((u=t.props)==null?void 0:u.playbackRate)??1,o=(s+(e.globalTime()-t.s))*a;yield r().add(Xe(w2,{ref:n,play:!0,...t.props,time:o,clipStart:t.s,trimStart:s},t.id)),yield*Kt(Math.max(0,t.e-t.s)),yield n().play(!1),yield n().remove()}};function lX({t:r,s:t,e}){const n=r.split(" "),s=e-t,a=n.join("").length;let o=t;return n.map(l=>{const u=l.length/a*s,h=o,T=h+u;return o=T,{t:l,s:parseFloat(h.toFixed(2)),e:parseFloat(T.toFixed(2))}})}const Wf=r=>{let t=r.replace(/^#/,"");if(t.length===3&&(t=t.split("").map(o=>o+o).join("")),t.length!==6)throw new Error("Invalid hex color");const e=parseInt(t,16),n=e>>16&255,s=e>>8&255,a=e&255;return{r:n,g:s,b:a}},uX={name:"caption",*create({containerRef:r,caption:t,containerProps:e}){var o,l,u,h,T,f;const n=lX(t);let s=0;n!=null&&n.length&&(s=n[0].s);let a={refs:[],props:[],idx:0,prevTime:s};r().maxWidth((e==null?void 0:e.maxWidth)??"95%"),r().wrap((e==null?void 0:e.wrap)??"wrap"),r().justifyContent((e==null?void 0:e.justifyContent)??"center"),r().alignItems((e==null?void 0:e.alignItems)??"center");for(const d of n){a.props.push(t.props);const p=Je(),m=t.props;if(r().add(Xe(I1,{ref:p,...m,text:d.t,opacity:0})),t.capStyle=="highlight_bg"){const y=Je(),c=Je(),Q=new T2({...Wf(m.colors.bgColor),a:(m==null?void 0:m.bgOpacity)??1});r().add(Xe(E1,{ref:y,fill:Q,width:p().width()+(m.bgOffsetWidth??30),height:p().height()+(m.bgOffsetHeight??10),margin:m.bgMargin??[0,-5],radius:m.bgRadius??10,padding:m.bgPadding??[0,15],opacity:0,alignItems:"center",justifyContent:"center",layout:!0,children:Xe(I1,{ref:c,...m,text:d.t})})),p().remove(),a.refs.push({bgRef:y,textRef:c})}else a.refs.push({textRef:p});a.prevTime=d.e,a.idx=a.idx+1}a.prevTime=s,a.idx=0;for(const d of n)t.capStyle=="highlight_bg"?(yield*(l=(o=a.refs[a.idx])==null?void 0:o.bgRef)==null?void 0:l.call(o).opacity(1,0),yield*Kt(Math.max(0,d.e-d.s)),yield*(h=(u=a.refs[a.idx])==null?void 0:u.bgRef)==null?void 0:h.call(u).fill(aX,0)):(yield*(f=(T=a.refs[a.idx])==null?void 0:T.textRef)==null?void 0:f.call(T).opacity(1,0),yield*Kt(Math.max(0,d.e-d.s))),a.prevTime=d.e,a.idx=a.idx+1}},cX={name:"elastic",*run({elementRef:r,duration:t,delay:e}){e&&(yield*Kt(e)),r().scale(0),yield*r().scale(1,t,nL)}},hX={name:"erase",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size();r().setText(""),r().size(a),r().textAlign("left"),e&&(yield*Kt(e));let o=(t-n)/s.length;yield*Kt(o);for(let l=s.length;l>=0;l--)yield*Kt(o),r().setText(s.substring(0,l))}},TX={name:"stream-word",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size(),o=s.split(" ");r().setText(""),r().size(a),e&&(yield*Kt(e)),r().textAlign("left");let l=(t-n)/o.length;for(let u=0;u<o.length;u++)yield*Kt(l),r().setText(o.slice(0,u+1).join(" "))}},fX={name:"typewriter",*run({elementRef:r,duration:t,delay:e,bufferTime:n=.1}){const s=r().text(),a=r().size();r().setText(""),r().size(a),r().textAlign("left"),e&&(yield*Kt(e));let o=(t-n)/s.length;yield*Kt(o);for(let l=0;l<s.length;l++)yield*Kt(o),r().setText(s.substring(0,l+1))}};class QX{constructor(){this.effects=new Map}register(t){this.effects.set(t.name,t)}get(t){return this.effects.get(t)}list(){return Array.from(this.effects.keys())}}const dX=()=>{l5.register(fX),l5.register(TX),l5.register(hX),l5.register(cX)},l5=new QX;dX();const pX={name:"blur",*run({elementRef:r,containerRef:t,interval:e,duration:n,intensity:s=25,animate:a}){const o=t??r;let l=Math.min(e,n);a==="enter"?(o().filters.blur(s),yield*o().filters.blur(0,l)):a==="exit"?(yield*Kt(n-l),yield*o().filters.blur(s,l)):a==="both"&&(l=Math.min(e,n/2),o().filters.blur(s),yield*o().filters.blur(0,l),yield*Kt(n-l),yield*o().filters.blur(s,l))}};function R3(r){switch(r){case"easeInSine":return kH;case"easeOutSine":return RH;case"easeInOutSine":return Gu;case"easeInQuad":return BH;case"easeOutQuad":return FH;case"easeInOutQuad":return NH;case"easeInCubic":return UH;case"easeOutCubic":return jH;case"easeInOutCubic":return E5;case"easeInQuart":return GH;case"easeOutQuart":return zH;case"easeInOutQuart":return WH;case"easeInQuint":return qH;case"easeOutQuint":return ZH;case"easeInOutQuint":return KH;case"easeInExpo":return XH;case"easeOutExpo":return iL;case"easeInOutExpo":return $H;case"easeInCirc":return YH;case"easeOutCirc":return JH;case"easeInOutCirc":return tM;case"easeInBack":return uM;case"easeOutBack":return cM;case"easeInOutBack":return hM;case"easeInElastic":return dM;case"easeOutElastic":return nL;case"easeInOutElastic":return pM;case"easeInBounce":return TM;case"easeOutBounce":return fM;case"easeInOutBounce":return QM;default:return rL}}const gX={name:"breathe",*run({elementRef:r,containerRef:t,mode:e,duration:n,intensity:s=.5}){const a=t??r,o=a().scale();e==="in"&&(yield*a().scale(new Z(o.x*s,o.y*s),n,R3("easeInSine"))),e==="out"&&(a().scale(new Z(o.x*s,o.y*s)),yield*a().scale(new Z(o.x,o.y),n,R3("easeOutSine")))}},mX={name:"fade",*run({elementRef:r,containerRef:t,interval:e,duration:n,animate:s}){const a=t??r;let o=Math.min(e,n);s==="enter"?(a().opacity(0),yield*a().opacity(1,o)):s==="exit"?(yield*Kt(n-o),yield*a().opacity(0,o)):s==="both"&&(o=Math.min(e,n/2),a().opacity(0),yield*a().opacity(1,o),yield*Kt(n-o),yield*a().opacity(0,o))}},yX={name:"photo-rise",*run({elementRef:r,containerRef:t,direction:e,duration:n,intensity:s=200}){if(t){const a=r().position();e==="up"?(r().y(a.y+s),yield*r().y(a.y,n)):e==="down"?(r().y(a.y-s),yield*r().y(a.y,n)):e==="left"?(r().x(a.x+s),yield*r().x(a.x,n)):e==="right"&&(r().x(a.x-s),yield*r().x(a.x,n))}}},vX={name:"photo-zoom",*run({elementRef:r,containerRef:t,mode:e,duration:n,intensity:s=1.5}){if(t){const a=r().scale();e==="in"&&(yield r().scale(new Z(a.x*s,a.y*s)),yield*r().scale(new Z(a.x,a.y),n)),e==="out"&&(r().scale(new Z(a.x,a.y)),yield*r().scale(new Z(a.x*s,a.y*s),n))}}},LX={name:"rise",*run({elementRef:r,containerRef:t,interval:e=.25,duration:n,animate:s,direction:a,intensity:o=200}){const l=t??r,u=l().position();let h=Math.min(e,n);s==="enter"?(l().opacity(0),a==="up"?(l().y(u.y+o),yield*xe(l().opacity(1,h/4),l().y(u.y,h))):a==="down"&&(l().y(u.y-o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)))):s==="exit"?(yield*Kt(n-h),a==="up"?yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y-o,h)):a==="down"&&(yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y+o,h)))):s==="both"&&(h=Math.min(e,n/2),l().opacity(0),a==="up"?(l().y(u.y+o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)),yield*Kt(n-h),yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y-o,h))):a==="down"&&(l().y(u.y-o),yield*xe(l().opacity(1,h/4),l().y(u.y,h)),yield*Kt(n-h),yield*xe($i(3*h/4,l().opacity(0,h/4)),l().y(u.y+o,h))))}},xX={name:"succession",*run({elementRef:r,containerRef:t,interval:e,duration:n,animate:s}){const a=t??r,o=a().scale();let l=Math.min(e,n);s==="enter"?(a().opacity(0),a().scale(new Z(o.x/2,o.y/2)),yield*xe(a().scale(o,l),a().opacity(1,l/2))):s==="exit"?(yield*Kt(n-l),yield*xe(a().scale(new Z(o.x/2,o.y/2),l),$i(l/2,a().opacity(0,l/2)))):s==="both"&&(l=Math.min(e,n/2),a().opacity(0),a().scale(new Z(o.x/2,o.y/2)),yield*xe(a().scale(o,l),a().opacity(1,l/2)),yield*Kt(n-l),yield*xe(a().scale(new Z(o.x/2,o.y/2),l),$i(l/2,a().opacity(0,l/2))))}};class _X{constructor(){this.animations=new Map}register(t){this.animations.set(t.name,t)}get(t){return this.animations.get(t)}list(){return Array.from(this.animations.keys())}}const bX=()=>{Gi.register(mX),Gi.register(LX),Gi.register(gX),Gi.register(xX),Gi.register(pX),Gi.register(vX),Gi.register(yX)},Gi=new _X;bX();const SX={name:"circle",*run({containerRef:r,elementRef:t,initFrameState:e,frameEffect:n}){yield*Kt(n.s);const s=n.props,a=[];a.push(r().size({x:s.frameSize[0],y:s.frameSize[1]},s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().position(s.framePosition??{x:0,y:0},s.transitionDuration,R3(s.transitionEasing??er))),a.push(t().position(s.elementPosition??nE,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().radius(s.frameSize[0]/2,s.transitionDuration,R3(s.transitionEasing??er))),s.objectFit&&a.push(R0({elementRef:t,containerSize:{x:s.frameSize[0],y:s.frameSize[1]},elementSize:e.element.size,objectFit:s.objectFit})),yield*xe(...a)}},EX={name:"rect",*run({containerRef:r,elementRef:t,initFrameState:e,frameEffect:n}){yield*Kt(n.s);const s=n.props,a=[];a.push(r().size(s.frameSize,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().position(s.framePosition??{x:0,y:0},s.transitionDuration,R3(s.transitionEasing??er))),a.push(t().position(s.elementPosition??nE,s.transitionDuration,R3(s.transitionEasing??er))),a.push(r().radius(s.radius??0,s.transitionDuration,R3(s.transitionEasing??er))),s.objectFit&&a.push(R0({elementRef:t,containerSize:{x:s.frameSize[0],y:s.frameSize[1]},elementSize:e.element.size,objectFit:s.objectFit})),yield*xe(...a)}};class AX{constructor(){this.frameEffects=new Map}register(t){this.frameEffects.set(t.name,t)}get(t){return this.frameEffects.get(t)}list(){return Array.from(this.frameEffects.keys())}}const HX=()=>{wh.register(SX),wh.register(EX)},wh=new AX;HX();function*R0({containerSize:r,elementSize:t,elementRef:e,objectFit:n}){const s=r.x/r.y,a=t.x/t.y;switch(n){case Vu.CONTAIN:a>s?(yield e().size({x:r.x,y:r.x/a}),yield e().scale(r.x/t.x,r.x*a/t.y)):(yield e().size({x:r.y*a,y:r.y}),yield e().scale(r.y*a/t.x,r.y/t.y));break;case Vu.COVER:a>s?(yield e().size({x:r.y*a,y:r.y}),yield e().scale(r.y*a/t.x,r.y/t.y)):(yield e().size({x:r.x,y:r.x/a}),yield e().scale(r.x/t.x,r.x*a/t.y));break;case Vu.FILL:yield e().size(r),yield e().scale(r.x/t.x,r.x/t.y);break}}function*gv({elementRef:r,element:t}){if(yield r(),t.textEffect){const e=l5.get(t.textEffect.name);e&&(yield*e.run({elementRef:r,duration:t.e-t.s,...t.textEffect}))}}function*Bn({elementRef:r,containerRef:t,element:e,view:n}){if(yield r(),e.animation){const s=Gi.get(e.animation.name);s&&(yield*s.run({elementRef:r,containerRef:t,view:n,duration:e.e-e.s,...e.animation}))}}function*sE({containerRef:r,elementRef:t,element:e}){var s;const n=MX({containerRef:r,elementRef:t});for(let a=0;a<((s=e==null?void 0:e.frameEffects)==null?void 0:s.length);a++){const o=e.frameEffects[a],l=a===e.frameEffects.length-1||e.frameEffects[a+1].s!==o.e,u=wh.get(o.name);u&&(yield*u.run({containerRef:r,elementRef:t,initFrameState:n,frameEffect:o}),l&&(yield*wX({containerRef:r,elementRef:t,duration:o.e-o.s,element:e,initProps:n})))}}function MX({containerRef:r,elementRef:t}){return{frame:{size:r().size(),pos:r().position(),radius:r().radius(),scale:r().scale(),rotation:r().rotation()},element:{size:r().size(),pos:t().position(),scale:t().scale()}}}function*wX({containerRef:r,elementRef:t,duration:e,element:n,initProps:s}){yield*Kt(e),k0(`restoreFrameState: ${JSON.stringify(s)}`);let a=[];a.push(r().size(s.frame.size)),a.push(r().position(s.frame.pos)),a.push(r().scale(s.frame.scale)),a.push(r().rotation(s.frame.rotation)),a.push(r().radius(s.frame.radius)),a.push(t().size(s.element.size)),a.push(t().position(s.element.pos)),a.push(t().scale(s.element.scale)),a.push(R0({elementRef:t,containerSize:s.frame.size,elementSize:s.element.size,objectFit:n.objectFit??"none"})),yield*xe(...a)}const CX={name:"circle",*create({containerRef:r,element:t,view:e}){const n=Je();yield*Kt(t==null?void 0:t.s),yield r().add(Xe(gr,{ref:n,...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}},aE=(r,t)=>{switch(t){case i2.SATURATED:r().filters.saturate(1.4),r().filters.contrast(1.1);break;case i2.BRIGHT:r().filters.brightness(1.3),r().filters.contrast(1.05);break;case i2.VIBRANT:r().filters.saturate(1.6),r().filters.brightness(1.15),r().filters.contrast(1.1);break;case i2.RETRO:r().filters.sepia(.8),r().filters.contrast(1.3),r().filters.brightness(.85),r().filters.saturate(.8);break;case i2.BLACK_WHITE:r().filters.grayscale(1),r().filters.contrast(1.25),r().filters.brightness(1.05);break;case i2.COOL:r().filters.hue(15),r().filters.brightness(1.1),r().filters.saturate(1.3),r().filters.contrast(1.05);break;case i2.WARM:r().filters.hue(-15),r().filters.brightness(1.15),r().filters.saturate(1.3),r().filters.contrast(1.05);break;case i2.CINEMATIC:r().filters.contrast(1.4),r().filters.brightness(.95),r().filters.saturate(.85),r().filters.sepia(.2);break;case i2.SOFT_GLOW:r().filters.brightness(1.2),r().filters.contrast(.95),r().filters.blur(1.2),r().filters.saturate(1.1);break;case i2.MOODY:r().filters.brightness(1.05),r().filters.contrast(1.4),r().filters.saturate(.65),r().filters.sepia(.2);break;case i2.DREAMY:r().filters.brightness(1.3),r().filters.blur(2),r().filters.saturate(1.4),r().filters.contrast(.95);break;case i2.INVERTED:r().filters.invert(1),r().filters.hue(180);break;case i2.VINTAGE:r().filters.sepia(.4),r().filters.saturate(1.4),r().filters.contrast(1.2),r().filters.brightness(1.1);break;case i2.DRAMATIC:r().filters.contrast(1.5),r().filters.brightness(.9),r().filters.saturate(1.2);break;case i2.FADED:r().filters.opacity(.9),r().filters.brightness(1.2),r().filters.saturate(.8),r().filters.contrast(.9);break}},oE={name:"image",*create({containerRef:r,element:t,view:e}){var a;yield*Kt(t==null?void 0:t.s);const n=Je(),s=Je();yield r().add(Xe(E1,{ref:n,...t.frame,children:Xe(W1,{ref:s,...t.props},`child-${t.id}`)},t.id)),n()&&(yield R0({elementRef:s,containerSize:n().size(),elementSize:s().size(),objectFit:t.objectFit}),(a=t==null?void 0:t.props)!=null&&a.mediaFilter&&aE(s,t.props.mediaFilter),yield*xe(Bn({elementRef:s,containerRef:n,element:t,view:e}),sE({containerRef:n,elementRef:s,element:t}),Kt(Math.max(0,t.e-t.s))),yield s().remove(),yield n().remove())}},DX={name:"rect",*create({containerRef:r,element:t,view:e}){const n=Je();yield*Kt(t==null?void 0:t.s),k0(`RectElement: ${JSON.stringify(t)}`),yield r().add(Xe(E1,{ref:n,...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}},lE={name:"video",*create({containerRef:r,element:t,view:e}){var u,h,T;yield*Kt(t==null?void 0:t.s);const n=Je(),s=Je(),a=((u=t.props)==null?void 0:u.time)??0,o=((h=t.props)==null?void 0:h.playbackRate)??1,l=(a+(e.globalTime()-t.s))*o;yield r().add(Xe(E1,{ref:n,...t.frame,children:Xe(v1,{ref:s,play:!0,...t.props,time:l,clipStart:t.s,trimStart:a},`child-${t.id}`)},t.id)),n()&&(yield R0({elementRef:s,containerSize:n().size(),elementSize:s().size(),objectFit:t.objectFit}),(T=t==null?void 0:t.props)!=null&&T.mediaFilter&&aE(s,t.props.mediaFilter),yield*xe(Bn({elementRef:s,containerRef:n,element:t,view:e}),sE({containerRef:n,elementRef:s,element:t}),Kt(Math.max(0,t.e-t.s))),yield s().play(!1),yield s().remove(),yield n().remove())}},OX={name:"scene",*create({containerRef:r,element:t,view:e}){yield*Kt(t==null?void 0:t.s);const n=Je();k0(`SceneElement: ${JSON.stringify(t)}`),yield r().add(Xe(E1,{ref:n,fill:t.backgroundColor??rE,size:"100%"})),t.type===dv.IMAGE?yield*oE.create({containerRef:r,element:t,view:e}):t.type===dv.VIDEO&&(yield*lE.create({containerRef:r,element:t,view:e})),yield n().remove()}},IX={name:"text",*create({containerRef:r,element:t,view:e}){var a,o,l,u,h,T,f,d;const n=Je(),s=((a=t.props)==null?void 0:a.backgroundColor)!=null&&t.props.backgroundColor!=="";if(yield*Kt(t==null?void 0:t.s),s){const p=Je(),m=Je(),y=Je();yield r().add(Xe(I1,{ref:p,text:t.t,textWrap:((o=t.props)==null?void 0:o.textWrap)??!0,textAlign:((l=t.props)==null?void 0:l.textAlign)??"center",opacity:0,...t.props},`${t.id}-measure`));const c=new T2({...Wf(t.props.backgroundColor),a:((u=t.props)==null?void 0:u.backgroundOpacity)??1}),Q=20;yield r().add(Xe(E1,{ref:m,fill:c,width:p().width()+Q,height:p().height()+4,padding:[0,Q/2],alignItems:"center",justifyContent:"center",layout:!0,children:Xe(I1,{ref:y,text:t.t,textWrap:((h=t.props)==null?void 0:h.textWrap)??!0,textAlign:((T=t.props)==null?void 0:T.textAlign)??"center",...t.props})},t.id)),p().remove(),yield*xe(Bn({elementRef:m,element:t,view:e}),gv({elementRef:y,element:t}),Kt(Math.max(0,t.e-t.s))),yield m().remove()}else yield r().add(Xe(I1,{ref:n,text:t.t,textWrap:((f=t.props)==null?void 0:f.textWrap)??!0,textAlign:((d=t.props)==null?void 0:d.textAlign)??"center",...t.props},t.id)),yield*xe(Bn({elementRef:n,element:t,view:e}),gv({elementRef:n,element:t}),Kt(Math.max(0,t.e-t.s))),yield n().remove()}};class VX{constructor(){this.elements=new Map}register(t){this.elements.set(t.name,t)}get(t){return this.elements.get(t)}list(){return Array.from(this.elements.keys())}}const PX=()=>{k2.register(lE),k2.register(uX),k2.register(OX),k2.register(oE),k2.register(IX),k2.register(oX),k2.register(CX),k2.register(DX)},k2=new VX;PX();const kX={name:"text",*render({view:r,watermark:t,duration:e}){const n=t.props;if(!(n!=null&&n.text))return;const s=t.position??{x:0,y:0},a=(t.rotation??0)*(Math.PI/180),o=t.opacity??1,l=Je();r.add(Xe(I1,{ref:l,text:n.text,x:s.x,y:s.y,rotation:a,opacity:o,fontSize:n.fontSize??24,fontFamily:n.fontFamily??"Arial",fill:n.fill??"#ffffff",stroke:n.stroke,lineWidth:n.lineWidth??n.strokeWidth??0,textAlign:n.textAlign??"center",fontWeight:n.fontWeight??400,fontStyle:n.fontStyle??"normal"})),yield*Kt(e)}},RX={name:"image",*render({view:r,watermark:t,duration:e}){const n=t.props;if(!(n!=null&&n.src))return;const s=t.position??{x:0,y:0},a=(t.rotation??0)*(Math.PI/180),o=t.opacity??1,l=Je();r.add(Xe(W1,{ref:l,src:n.src,x:s.x,y:s.y,width:n.width,height:n.height,rotation:a,opacity:o})),yield*Kt(e)}};class BX{constructor(){this.renderers=new Map}register(t){this.renderers.set(t.name,t)}get(t){return this.renderers.get(t)}list(){return Array.from(this.renderers.keys())}}const Ch=new BX;function FX(){Ch.register(kX),Ch.register(RX)}FX();function*NX({view:r,track:t}){var s;const e=Je();let n=0;r.add(Xe(Ht,{size:"100%",ref:e}));for(const a of t.elements||[])yield*Kt((a==null?void 0:a.s)-n),yield*(s=k2.get("video"))==null?void 0:s.create({containerRef:e,element:a,view:r}),n=a.e;yield e().remove()}function*UX({view:r,track:t}){let e=0;for(const n of t.elements){const s=Je();yield*Kt((n==null?void 0:n.s)-e),e=n==null?void 0:n.e,k0(`Adding audio element ${n.id}`),r.add(Xe(w2,{ref:s,...n.props},n.id)),yield*Kt(Math.max(0,n.e-n.s)),yield s().playing(!1),yield s().remove()}}function*jX({view:r,track:t}){var l;let e=0;const n=Je();r.add(Xe(Ht,{size:"100%",ref:n}));const s=t==null?void 0:t.props,a=(s==null?void 0:s.applyToAll)??!1,o=(Qv[(s==null?void 0:s.capStyle)??""]||{}).word||{};for(const u of t.elements){const h=u.props,T=(Qv[(h==null?void 0:h.capStyle)??(s==null?void 0:s.capStyle)??""]||{}).rect||{},f={...T,justifyContent:T.justifyContent,alignItems:T.alignItems},d=a?s==null?void 0:s.colors:(h==null?void 0:h.colors)??(s==null?void 0:s.colors)??nX,p={...o,...(s==null?void 0:s.captionProps)||{},colors:d,font:a?s==null?void 0:s.font:(h==null?void 0:h.font)??(s==null?void 0:s.font)??sX,fill:d.text,bgColor:d.bgColor,bgOpacity:(s==null?void 0:s.bgOpacity)??1};yield*Kt((u==null?void 0:u.s)-e);const m=Je();if(n().add(Xe(E1,{ref:m,...f,x:a?s==null?void 0:s.x:(h==null?void 0:h.x)??(s==null?void 0:s.x),y:a?s==null?void 0:s.y:(h==null?void 0:h.y)??(s==null?void 0:s.y),layout:!0},u.id)),(s==null?void 0:s.capStyle)==="word_by_word_with_bg"){const y=new T2({...Wf(p.bgColor),a:(p==null?void 0:p.bgOpacity)??1});m().fill(y)}yield*(l=k2.get("caption"))==null?void 0:l.create({containerRef:m,caption:{...u,t:u.t??"",capStyle:(h==null?void 0:h.capStyle)??(s==null?void 0:s.capStyle),props:p},view:r}),e=u.e,yield m().remove()}}function*GX({view:r,track:t}){var n;const e=Je();r.add(Xe(Ht,{size:"100%",ref:e}));for(const s of t.elements||[])yield*(n=k2.get("scene"))==null?void 0:n.create({containerRef:e,element:s,view:r,containerProps:t.containerProps});yield e().remove()}function*zX({view:r,track:t}){var s;const e=Je();r.add(Xe(Ht,{size:"100%",ref:e}));const n=[];try{for(const a of t.elements)n.push((s=k2.get(a.type))==null?void 0:s.create({containerRef:e,element:a,view:r}))}catch(a){k0("Error creating element track",a)}yield*xe(...n),yield e().remove()}function*WX({view:r,watermark:t,duration:e}){if(e<=0)return;yield*Kt(.001);const n=Ch.get(t.type);n&&(yield*n.render({view:r,watermark:t,duration:e}))}const mv=(r,t)=>{if(typeof window<"u"){const e=new CustomEvent(r,t);return window.dispatchEvent(e)}},qX=rX("scene",function*(r){var n;const t=S5().variables.get("input",null)(),e=S5().variables.get("playerId",null)();if(t)if(yield r.add(Xe(E1,{fill:t.backgroundColor??rE,size:"100%"})),t.tracks){const s=[];for(const a of t.tracks)switch(a.type){case t5.VIDEO:s.push(NX({view:r,track:a}));break;case t5.AUDIO:s.push(UX({view:r,track:a}));break;case t5.CAPTION:s.push(jX({view:r,track:a}));break;case t5.SCENE:s.push(GX({view:r,track:a}));break;case t5.ELEMENT:s.push(zX({view:r,track:a}));break}if(t.watermark){const a=((n=t.tracks)==null?void 0:n.length)>0?Math.max(0,...t.tracks.flatMap(o=>o.elements||[]).map(o=>o.e)):10;s.push(WX({view:r,watermark:t.watermark,duration:a}))}yield*xe(...s),mv(pv.PLAYER_UPDATE,{detail:{status:"ready",playerId:e,message:"All elements created"}})}else mv(pv.PLAYER_UPDATE,{detail:{status:"ready",playerId:e,message:"No elements to create"}})}),i$=MM({scenes:[qX]});export{i$ as default};