stemcmicro
Version:
Computer Algebra System in TypeScript
3 lines • 693 kB
JavaScript
import{native_sym as t,Native as e,is_native as n,code_from_native_sym as r,log as s,multiply as i,real as o,exp as a}from"math-expression-native";export{NATIVE_MAX,NATIVE_MIN,Native,code_from_native_sym,is_native_sym,native_sym}from"math-expression-native";import{Err as u,is_rat as c,is_flt as l,is_str as h,create_sym as f,is_boo as p,Flt as d,negOne as m,BigInteger as g,create_int as x,create_rat as y,Rat as w,Boo as E,is_sym as v,is_num as D,is_tensor as b,imu as A,one as S,is_uom as k,zero as _,Tensor as F,Sym as C,is_err as T,is_blade as M,is_hyp as O,is_keyword as N,is_imu as L,Str as B,create_keyword_ns as q,assert_sym as I,create_tensor as P,Map as R,assert_tensor as U,booT as $,booF as z,create_algebra as W,create_flt as X,assert_num as K,QQ as H,is_lambda as J,Uom as G,Cell as V,Lambda as j,create_str as Q,et as Z,epsilon as Y,Hyp as tt,is_map as et,is_tag as nt,is_jsobject as rt,create_boo as st,JsObject as it,assert_jsobject as ot,is_cell as at,assert_str as ut,assert_map as ct,assert_cell as lt,assert_rat as ht,assert_flt as ft,create_hyp as pt,Keyword as dt,booU as mt,bigInt as gt,Char as xt,Set as yt,create_sym_ns as wt,Tag as Et,Timestamp as vt,Uuid as Dt}from"math-expression-atoms";import{is_nil as bt,items_to_cons as At,is_atom as St,nil as kt,is_cons as _t,car as Ft,cdr as Ct,cons as Tt,assert_cons_or_nil as Mt,pos_end_items_to_cons as Ot,assert_cons as Nt,is_singleton as Lt}from"math-expression-tree";import{SIGN_GT as Bt,SIGN_LT as qt,SIGN_EQ as It}from"math-expression-context";function Pt(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function Rt(t,e,n,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(t,n):s?s.value=n:e.set(t,n),n}function Ut(t,e,n,r){return bt(t),new u(t,r,e,n)}var $t;"function"==typeof SuppressedError&&SuppressedError;class zt{constructor(t,e){this.message=t,this.argList=e,this.name="Localizable",this.type="localizable",$t.set(this,1),e.addRef()}addRef(){var t;Rt(this,$t,(t=Pt(this,$t,"f"),++t),"f")}release(){var t;Rt(this,$t,(t=Pt(this,$t,"f"),--t),"f"),0===Pt(this,$t,"f")&&this.argList.release()}contains(t){throw new Error("Method not implemented.")}equals(t){return this===t||!!Wt(t)&&(this.message.key===t.message.key&&this.argList.equals(t.argList))}get iscons(){return!1}get isnil(){return!1}toString(){return`Localizable(${JSON.stringify(this.message)}, ${this.argList})`}}function Wt(t){return t instanceof zt}function Xt(t,...e){const n=At(...e);try{const e=new zt(t,n);try{return Ut(e)}finally{e.release()}}finally{n.release()}}$t=new WeakMap;const Kt={Hello_World:Ht(0,"",""),Operator_0_cannot_be_applied_to_types_1_and_2:Ht(1e3,"Operator_0_cannot_be_applied_to_types_1_and_2_1000","Operator '{0}' cannot be applied to types '{1}' and '{2}'."),Property_0_does_not_exist_on_type_1:Ht(1001,"Property_0_does_not_exist_on_type_1_1001","Property '{0}' does not exist on type '{1}'."),Division_by_zero:Ht(1002,"Division_by_zero_1002","Division by zero.")};function Ht(t,e,n){return{code:t,key:e,text:n}}function Jt(t){return t.geq(Number.MIN_SAFE_INTEGER)&&t.leq(Number.MAX_SAFE_INTEGER)}function Gt(t){return c(t)&&t.isInteger()}class Vt extends Error{constructor(t){super(),this.name="ProgrammingError","string"==typeof t&&(this.message=t)}}function jt(t){return c(t)?t.isInteger()&&Jt(t.a)?t.a.toJSNumber():NaN:l(t)&&Math.floor(t.d)===t.d?t.d:NaN}function Qt(t){if(St(t)){if(h(t))return t.str;throw new Vt(`${t}: ${t.type}`)}throw new Vt(`${t}`)}const Zt=-1,Yt=0,te=1,ee=0,ne=1;function re(t){return(t&ne)===ne}const se=["Blade","Boo","Cell","Flt","Imu","Map","Rat","Sym","Tensor","Uom"];var ie;function oe(t){return t>0}function ae(t){return"boolean"==typeof t&&t?1:0}!function(t){t[t.canonicalize=0]="canonicalize",t[t.convertSinToCos=1]="convertSinToCos",t[t.convertCosToSin=2]="convertCosToSin",t[t.familiarize=3]="familiarize",t[t.expanding=4]="expanding",t[t.expandAbsSum=5]="expandAbsSum",t[t.expandCosSum=6]="expandCosSum",t[t.expandPowSum=7]="expandPowSum",t[t.expandSinSum=8]="expandSinSum",t[t.evaluatingAsFloat=9]="evaluatingAsFloat",t[t.complexAsClock=10]="complexAsClock",t[t.complexAsPolar=11]="complexAsPolar",t[t.complexAsRectangular=12]="complexAsRectangular",t[t.convertExpToTrig=13]="convertExpToTrig",t[t.convertTrigToExp=14]="convertTrigToExp",t[t.keepZeroTermsInSums=15]="keepZeroTermsInSums",t[t.factoring=16]="factoring",t[t.renderFloatAsEcmaScript=17]="renderFloatAsEcmaScript",t[t.useCaretForExponentiation=18]="useCaretForExponentiation",t[t.useIntegersForPredicates=19]="useIntegersForPredicates",t[t.useParenForTensors=20]="useParenForTensors",t[t.depth=21]="depth",t[t.drawing=22]="drawing",t[t.nonstop=23]="nonstop",t[t.forceFixedPrintout=24]="forceFixedPrintout",t[t.maxFixedPrintoutDigits=25]="maxFixedPrintoutDigits",t[t.printMode=26]="printMode",t[t.codeGen=27]="codeGen"}(ie||(ie={}));const ue=1,ce=2,le=[ue,ce],he=ue|ce,fe=ue|ce;let pe=class{constructor(t){this.extension=t}create(t){return new this.extension(t)}};function de(t){return new pe(t)}function me(t,e){return t.equals(e)?(e.addRef(),[ee,e]):(t.addRef(),[ne,t])}var ge,xe;class ye{constructor(t,e,n){this.handler=t,ge.set(this,void 0),xe.set(this,void 0),Rt(this,ge,e,"f"),Rt(this,xe,n,"f")}get hash(){return Pt(this,ge,"f")}get name(){return Pt(this,ge,"f")}iscons(){return!1}operator(){throw new Vt}isKind(t){return!!St(t)&&Pt(this,xe,"f").call(this,t)}toHumanString(n,r){return Qt(this.handler.dispatch(n,t(e.human),kt,r))}toInfixString(n,r){return Qt(this.handler.dispatch(n,t(e.infix),kt,r))}toLatexString(n,r){return Qt(this.handler.dispatch(n,t(e.latex),kt,r))}toListString(n,r){return Qt(this.handler.dispatch(n,t(e.sexpr),kt,r))}evaluate(t,e,n){throw new Error("evaluate method not implemented.")}transform(t,e){const n=this.valueOf(t,e);try{return me(n,t)}finally{n.release()}}valueOf(t,e){return this.dispatch(t,f("valueof"),kt,e)}binL(t,e,n,r){return this.handler.binL(t,e,n,r)}binR(t,e,n,r){return this.handler.binR(t,e,n,r)}dispatch(t,e,n,r){const s=this.handler.dispatch(t,e,n,r);return bt(s)?Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type)):s}subst(t,e,n,r){throw new Error("subst method not implemented.")}test(t,e,n){const r=this.handler.dispatch(t,e,kt,n);if(p(r))return r.isTrue();throw Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}}ge=new WeakMap,xe=new WeakMap;class we{constructor(t,e,n){this.builder=t,this.type=e,this.guard=n}create(t){return new ye(this.builder.create(),this.type,this.guard)}}class Ee{constructor(t){this.handler=t}get hash(){throw new Error("Method not implemented.")}get name(){throw new Error("Method not implemented.")}iscons(){throw new Error("Method not implemented.")}operator(){throw new Error("Method not implemented.")}isKind(t,e){throw new Error("Method not implemented.")}subst(t,e,n,r){throw new Error("Method not implemented.")}toHumanString(t,e){throw new Error("Method not implemented.")}toInfixString(t,e){throw new Error("Method not implemented.")}toLatexString(t,e){throw new Error("Method not implemented.")}toListString(t,e){throw new Error("Method not implemented.")}evaluate(t,e,n){throw new Error("Method not implemented.")}transform(t,e){throw new Error("Method not implemented.")}valueOf(t,e){throw new Error("Method not implemented.")}test(t,e,n){return this.handler.test(t,e,n)}binL(t,e,n,r){return this.handler.binL(t,e,n,r)}binR(t,e,n,r){return this.handler.binR(t,e,n,r)}dispatch(t,e,n,r){return this.handler.dispatch(t,e,n,r)}}function ve(t,e,n){return t===De.d?De:t===be.d?be:t===_e.d?_e:t===Ae.d?Ae:t===Fe.d?Fe:new d(t,e,n)}const De=new d(0),be=new d(1),Ae=new d(2),Se=new d(Math.PI);new d(1e-6);const ke=new d(Math.E),_e=new d(-1),Fe=new d(-2),Ce=t(e.add),Te=t(e.cos),Me=t(e.tan),Oe=t(e.subtract),Ne=t(e.multiply),Le=t(e.divide),Be=t(e.pow),qe=t(e.outer),Ie=t(e.inner),Pe=t(e.inv),Re=t(e.lco),Ue=t(e.rco),$e=t(e.sin);t(e.succ),t(e.pred),t(e.E);const ze=t(e.PI),We=t(e.factorial);t(e.iszero),t(e.testlt),t(e.testgt),t(e.testle),f(":"),t(e.tau);const Xe=t(e.IMU);var Ke;!function(t){t[t.Ascii=0]="Ascii",t[t.Human=1]="Human",t[t.Infix=2]="Infix",t[t.LaTeX=3]="LaTeX",t[t.SExpr=4]="SExpr",t[t.EcmaScript=5]="EcmaScript"}(Ke||(Ke={}));const He=new class{constructor(){this.tos=0,this.stack=[]}};function Je(t){throw Ge(0),new Error(`Stop: ${t}`)}function Ge(t){if(He.tos<=t)He.tos=t;else for(;He.tos>t;)He.stack[He.tos]=null,He.tos--}function Ve(t,e,n){n.pushDirective(ie.expanding,0);try{return t(e,n)}finally{n.popDirective()}}function je(t,e,n){n.pushDirective(ie.expanding,1);try{return t(e,n)}finally{n.popDirective()}}function Qe(t,e,n,r){r.pushDirective(ie.expanding,1);try{return t(e,n,r)}finally{r.popDirective()}}class Ze{static NegOne(t){return t.getDirective(ie.evaluatingAsFloat)?_e:m}static PI(t){return t.getDirective(ie.evaluatingAsFloat)?Se:ze}}function Ye(t,e){return t.multiply(e)}function tn(t,e){return t.divide(e)}function en(t,e){return t.mod(e)}function nn(t,e){const n=t.divmod(e);return[n.quotient,n.remainder]}function rn(t,e){return t.pow(e)}function sn(t){return t instanceof d}const on=1e7,an=9007199254740992;function un(t){return-an<t&&t<an}function cn(t){return t>0?Math.floor(t):Math.ceil(t)}const ln=1<<30;function hn(t){if(t instanceof g){const e=t.value|BigInt(ln);return e&-e}throw new Error}function fn(t,e){return t=xn(t),e=xn(e),t.greater(e)?t:e}function pn(t,e){return t=xn(t),e=xn(e),t.lesser(e)?t:e}function dn(t,e){if(t=xn(t).abs(),e=xn(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;let n,r=yn[1];for(;t.isEven()&&e.isEven();)n=pn(hn(t),hn(e)),t=t.divide(n),e=e.divide(n),r=r.multiply(n);for(;t.isEven();)t=t.divide(hn(t));do{let n;for(;e.isEven();)e=e.divide(hn(e));t.greater(e)&&(n=e,e=t,t=n),e=e.subtract(t)}while(!e.isZero());return r.isUnit()?t:t.multiply(r)}const mn=function(t,e,n,r){n=n||"0123456789abcdefghijklmnopqrstuvwxyz";let s=String(t);r||(s=s.toLowerCase(),n=n.toLowerCase());const i=s.length,o=Math.abs(e),a={};for(let t=0;t<n.length;t++)a[n[t]]=t;for(let t=0;t<i;t++){const n=s[t];if("-"!==n&&(n in a&&a[n]>=o)){if("1"===n&&1===o)continue;throw new Error(n+" is not a valid digit in base "+e+".")}}const u=xn(e),c=[],l="-"===s[0];for(let t=l?1:0;t<s.length;t++){const e=s[t];if(e in a)c.push(xn(a[e]));else{if("<"!==e)throw new Error(e+" is not a valid character");{const e=t;do{t++}while(">"!==s[t]&&t<s.length);c.push(xn(s.slice(e+1,t)))}}}return gn(c,u,l)};function gn(t,e,n){let r=yn[0],s=yn[1];for(let n=t.length-1;n>=0;n--)r=r.add(t[n].multiply(s)),s=s.multiply(e);return n?r.negate():r}function xn(t){return"number"==typeof t?function(t){return new g(BigInt(t))}(t):"string"==typeof t?function(t){if(un(+t)){const e=+t;if(e===cn(e))return new g(BigInt(e));throw new Error("Invalid integer: "+t)}const e="-"===t[0];e&&(t=t.slice(1));const n=t.split(/e/i);if(n.length>2)throw new Error("Invalid integer: "+n.join("e"));if(2===n.length){let e=n[1];"+"===e[0]&&(e=e.slice(1));let r=+e;if(r!==cn(r)||!un(r))throw new Error("Invalid integer: "+r+" is not a valid exponent.");let s=n[0];const i=s.indexOf(".");if(i>=0&&(r-=s.length-i-1,s=s.slice(0,i)+s.slice(i+1)),r<0)throw new Error("Cannot include negative exponent part for integers");s+=new Array(r+1).join("0"),t=s}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);return new g(BigInt(e?"-"+t:t))}(t):"bigint"==typeof t?new g(t):t}const yn=[];function wn(t,e,n,r){return void 0===t?yn[0]:void 0!==e&&(10!=+e||n)?mn(t,e,n,r):xn(t)}for(let t=0;t<1e3;t++)yn[t]=xn(t),t>0&&(yn[-t]=xn(-t));wn.one=yn[1],wn.zero=yn[0],wn.minusOne=yn[-1],wn.max=fn,wn.min=pn,wn.gcd=dn,wn.lcm=function(t,e){return t=xn(t).abs(),e=xn(e).abs(),t.divide(dn(t,e)).multiply(e)},wn.isInstance=function(t){return t instanceof g},wn.randBetween=function(t,e,n){const r=xn(t),s=xn(e),i=n||Math.random,o=pn(r,s),a=function(t,e){const n=En(e);if(n.isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(n.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};const e=[];if(t.isNegative())return{value:e.concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};const n=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:e.concat.apply([],n),isNegative:!1}}let r=!1;t.isNegative()&&n.isPositive()&&(r=!0,t=t.abs());if(n.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:r};const s=[];let i=t;for(;i.isNegative()||i.compareAbs(n)>=0;){const t=i.divmod(n);i=t.quotient;let e=t.remainder;e.isNegative()&&(e=n.minus(e).abs(),i=i.next()),s.push(e.toJSNumber())}return s.push(i.toJSNumber()),{value:s.reverse(),isNegative:r}}(fn(r,s).subtract(o).add(1),on).value,u=[];let c=!0;for(let t=0;t<a.length;t++){const e=c?a[t]+(t+1<a.length?a[t+1]/on:0):on,n=cn(i()*e);u.push(n),n<a[t]&&(c=!1)}return o.add(wn.fromArray(u,on,!1))},wn.fromArray=function(t,e,n){return gn(t.map(xn),xn(e||10),n)};const En=wn,vn=x(0),Dn=vn.succ(),bn=x(2),An=x(3),Sn=x(4),kn=x(5),_n=x(6),Fn=x(7),Cn=x(8),Tn=x(9),Mn=x(10),On=Mn.succ(),Nn=Dn.neg();bn.neg(),An.neg();const Ln=Sn.neg();kn.neg(),_n.neg(),Fn.neg(),Cn.neg(),Tn.neg(),Mn.neg(),On.neg();const Bn=y(1,2);Bn.neg();const qn=y(1,3);function In(t){return En(t)}function Pn(t,e){if(t.isPositive()){if(e.isNegative())return t.multiply(En(-1))}else if(e.isPositive())return t.multiply(En(-1));return t}function Rn(t,e){return t.isPositive()?t:t.multiply(En(-1))}function Un(t){const e=tn(t.a,t.b);return new w(e,En.one)}function $n(t){return c(t)?t.numer():Dn}function zn(t){return c(t)?t.denom():Dn}function Wn(t,e){return new w(En(t),En(e))}function Xn(t){return c(t)||sn(t)?t.toNumber():0}function Kn(t){return new w(function(t){let e;if(0===t||1===t)return e=En(1),e;e=En(2);let n=En(0);if(3<=t)for(let r=3;r<=t;r++)n=En(r),e=Ye(e,n);return e}(t),En.one)}function Hn(t,e){if(c(t)&&c(e))return t.compare(e);const n=(l(t),t.toNumber()),r=(l(e),e.toNumber());return n<r?Zt:n>r?te:Yt}function Jn(t,e){return Hn(t,e)===Zt}function Gn(t){return t instanceof E}const Vn=t(e.isone);function jn(t,e){const n=At(Vn,t);try{const t=e.valueOf(n);try{if(Gn(t))return t.isTrue();if(c(t))return!t.isZero();throw new Vt(`${t}`)}finally{t.release()}}finally{n.release()}}const Qn=t(e.multiply);function Zn(t,...e){const n=At(Qn,...e);try{return t.valueOf(n)}finally{n.release()}}function Yn(t,e){const n=Zn(t,x(-1),e);try{return t.valueOf(n)}finally{n.release()}}const tr=!0,er=t(e.add);f("adj"),f("algebra");const nr=f("and"),rr=f("approxratio"),sr=f("arccos"),ir=f("arccosh"),or=f("arcsin"),ar=f("arcsinh"),ur=f("arctan"),cr=f("arctanh");f("atomize");const lr=f("besselj"),hr=f("bessely");f("binding");const fr=f("binomial"),pr=f("ceiling"),dr=f("check"),mr=f("choose");t(e.circexp);const gr=f("clear"),xr=f("clearall");f("clearpatterns");const yr=f("coeff");f("cofactor"),f("compare"),f("compare-factors"),f("compare-terms");const wr=t(e.component),Er=t(e.condense),vr=f("contract"),Dr=Te,br=f("cosh");f("decomp");const Ar=f("defint");f("denominator");const Sr=f("det"),kr=f("dim"),_r=f("dirac");f("divide"),f("divisors");const Fr=f("do"),Cr=f("dot");f("draw"),f("dsolve");const Tr=f("eigen"),Mr=f("eigenval"),Or=f("eigenvec");f("equal");const Nr=f("erf"),Lr=f("erfc"),Br=f("eval"),qr=t(e.exp),Ir=t(e.expand);f("expcos");const Pr=t(e.factor),Rr=We;f("factorpoly");const Ur=t(e.float),$r=f("floor"),zr=t(e.fn),Wr=f("for"),Xr=t(e.function),Kr=f("gamma"),Hr=t(e.gcd),Jr=t(e.hermite),Gr=t(e.hilbert);f("if");const Vr=t(e.imag);t(e.inner);const jr=t(e.integral),Qr=Pe;f("invg"),f("isinteger");const Zr=t(e.isprime),Yr=f("laguerre");f("laplace");const ts=f("lcm");t(e.lco);const es=f("legendre"),ns=f("let"),rs=t(e.log),ss=Ne;t(e.not),f("nroots"),f("number"),f("numerator");const is=f("operator"),os=f("or");t(e.outer);const as=f("pattern");t(e.polar);const us=Be,cs=f("printLeaveEAlone"),ls=f("printLeaveXAlone");f("print");const hs=f("product"),fs=f("quote");f("quotient");const ps=f("rank");t(e.rco);const ds=t(e.real),ms=t(e.isreal),gs=f("round");t(e.rect),f("roots");const xs=t(e.assign),ys=f("sgn"),ws=$e,Es=f("sinh");f("shape");const vs=f("sqrt");f("stop"),t(e.subst),f("-");const Ds=f("sum"),bs=Me,As=f("tanh"),Ss=t(e.taylor),ks=t(e.test),_s=t(e.testge),Fs=t(e.testgt),Cs=t(e.testle),Ts=t(e.testlt),Ms=f("transpose"),Os=f("unit"),Ns=f("uom");t(e.zero),f("lastPrint");const Ls=f("lastAsciiPrint"),Bs=f("lastInfixPrint"),qs=f("lastLatexPrint"),Is=f("lastSexprPrint"),Ps=f("lastHumanPrint");f("autoexpand"),f("autofactor");const Rs=f("bake");f("trace");const Us=f("$METAA"),$s=f("$METAB"),zs=f("$METAX"),Ws=f("$SECRETX");f("version"),f("a"),f("b"),f("c");const Xs=f("d"),Ks=f("i"),Hs=f("j");f("n"),f("r");const Js=f("s"),Gs=f("t"),Vs=f("x"),js=f("y"),Qs=f("z"),Zs=f("I");f("a_"),f("b_"),f("x_");f("$C1"),f("$C2"),f("$C3"),f("$C4"),f("$C5"),f("$C6");const Ys=1e4,ti=24,ei=function(){const t=[2];let e=3;for(;t.length<Ys;){let n=0;const r=Math.sqrt(e);for(;n<t.length&&t[n]<=r;){if(e%t[n]==0){n=-1;break}n++}-1!==n&&t.push(e),e+=2}return t[Ys]=0,t}(),ni=7488,ri=String.fromCharCode(183);function si(t){return t.isZero()?0:t.isPositive()?1:-1}function ii(t,e){return t.equals(e)}function oi(t){return t.contains(Vs)?Vs:t.contains(js)?js:t.contains(Qs)?Qs:t.contains(Gs)?Gs:t.contains(Js)?Js:Vs}function ai(t){return _t(t)?[...t].length:0}function ui(t){return l(t)||c(t)}function ci(t){return ui(t)&&t.isNegative()}function li(t,e){const n=t.car;return!!v(n)&&n.equalsSym(e)}const hi=t(e.abs);function fi(t){return _t(t)&&li(t,hi)}function pi(t){return _t(t)&&function(t){return li(t,Ce)}(t)}function di(t){return _t(t)&&li(t,Ne)}function mi(t){return _t(t)&&v(t.opr)&&n(t.opr,e.pow)}function gi(t){return _t(t)&&li(t,We)}function xi(t){return _t(t)&&li(t,qe)}function yi(t){return!!_t(t)&&(!!li(t,Ie)||!!li(t,Cr))}function wi(t){return _t(t)&&li(t,Ms)}function Ei(t){return _t(t)&&li(t,Qr)}function vi(t){return!(!D(t)&&!Zs.equals(t))||!!b(t)&&t.everyElement(vi)}function Di(t){return Zs.equals(t)}function bi(t){return Ft(Ft(t))}function Ai(t){return Ft(Ct(t))}function Si(t){return Ct(Ct(t))}function ki(t){return Ft(Ft(Ct(t)))}function _i(t){return Ft(Ct(Ct(t)))}function Fi(t){return Ct(Ft(Ct(t)))}function Ci(t){return Ft(Ct(Ft(Ct(t))))}function Ti(t){return Ft(Ct(Ct(Ct(t))))}function Mi(t){return Ft(Ct(Ct(Ct(Ct(t)))))}function Oi(t){return c(t)?1===si(t.a):!!l(t)&&t.d>0}function Ni(t){return c(t)?ii(t.a,2)&&ii(t.b,1):!!l(t)&&2===t.d}function Li(t){return!!D(t)&&t.isMinusOne()}function Bi(t,e){return jn(t,e)||Li(t)}function qi(t,e){return null==e&&(e=oi(t)),!(!function(t,e){return function(t,e){return di(t)?t.tail().every((t=>Ii(t,e))):Ii(t,e)}(t,e)}(t,e)||1!==function(...t){return t.reduce(((t,e)=>t+Number(e)),0)}(t.contains(Vs),t.contains(js),t.contains(Qs)))&&e}function Ii(t,e){if(mi(t)){const n=t.base,r=t.expo;return c(r)&&r.isPositiveInteger()&&Ri(n,e)}return Ri(t,e)}function Pi(t,e){return!!t.contains(e)&&Ri(t,e)}function Ri(t,e){return pi(t)?t.tail().every((t=>Ui(t,e))):Ui(t,e)}function Ui(t,e){return di(t)?t.tail().every((t=>$i(t,e))):$i(t,e)}function $i(t,e){if(t.equals(e))return!0;if(mi(t)&&t.base.equals(e)){const e=t.expo;return c(e)&&e.isPositiveInteger()}return!t.contains(e)}function zi(t){if(mi(t)){const e=t.expo;if(c(e)&&ci(t.base))return!0}return!1}function Wi(t,e){return di(t)&&3===ai(t)&&l(Ai(t))&&zi(_i(t))||e.equals(t,A)}function Xi(t){if(di(t)&&3===ai(t)){if(D(Ai(t))&&_i(t).equals(A))return!0;if(t.equals(A))return!0;if(zi(_i(t)))return!0}return!1}function Ki(t){if(pi(t)){if(3===ai(t)){const e=Ai(t);if(D(e)&&(Xi(_i(t))||Xi(t)))return!0}}return!1}function Hi(t){return Gt(t)&&t.a.isEven()}function Ji(t){return c(t)&&t.isFraction()}function Gi(t,e){return null!==t&&(c(t)?ii(t.a,e)&&ii(t.b,1):!!l(t)&&t.d===e)}function Vi(t,e,n){return c(t)?t.numer().isIntegerNumber(e)&&t.denom().isIntegerNumber(n):!!l(t)&&t.d===e/n}function ji(t){return Vi(t,1,2)}function Qi(t){return Vi(t,-1,2)}function Zi(t){return!(!l(t)&&!Ur.equals(t))||!!_t(t)&&[...t].some(Zi)}function Yi(t,e){const n=e.valueOf(t);try{return ui(n)?function(t){if(t.isZero())return Xt(Kt.Division_by_zero);if(sn(t))return t.inv();if(c(t))return t.inv();throw new Error}(n):e.valueOf(At(Be,n,Nn))}finally{n.release()}}function to(t,e,n){return r=function(t,e,n,r){const s=At(t,e,n);try{return r.valueOf(s)}finally{s.release()}}(Ne,t,e,n),r;var r}function eo(t,e,n){return function(t,e,n,r){r.pushDirective(ie.expanding,0);try{return t(e,n,r)}finally{r.popDirective()}}(to,t,e,n)}function no(t,e){if(t.length>1){let n=t[0];for(let r=1;r<t.length;r++)n=Zn(e,n,t[r]);return n}return 1===t.length?t[0]:S}function ro(t,e){e.pushDirective(ie.factoring,1);try{return no(t,e)}finally{e.popDirective()}}function so(t){return!!ci(t)||di(t)&&ci(t.argList.head)}function io(t){return!(!pi(t)||!so(t.argList.head))||so(t)}const oo=t(e.add);function ao(t,...e){const n=At(oo,...e);try{return t.valueOf(n)}finally{n.release()}}const uo=t(e.float);function co(t,e){const n=At(uo,t);try{return e.valueOf(n)}finally{n.release()}}function lo(t,e,n){if(c(e)&&e.isOne())return t;if(l(e)&&e.isOne())return co(t,n);if(k(e)&&e.isOne())return Zn(n,t,e.inv());if(St(t)&&St(e),D(t)&&D(e))return function(t,e){return c(t)&&c(e)?t.div(e):e.isZero()?Xt(Kt.Division_by_zero):ve((sn(t)?t.d:t.toNumber())/(sn(e)?e.d:e.toNumber()))}(t,e);{const r=Yi(e,n);try{return Zn(n,t,r)}finally{r.release()}}}function ho(t,e,n){n.pushDirective(ie.expanding,1);try{return lo(t,e,n)}finally{n.popDirective()}}const fo=t(e.pow);function po(t,e,n){const r=At(fo,e,n);try{return t.valueOf(r)}finally{r.release()}}function mo(t,e,n){const r=Yn(t,n);try{return ao(t,e,r)}finally{r.release()}}class go extends Error{constructor(t){super(t),this.name="SystemError",console.warn(t,(new Error).stack)}}function xo(t){if(_t(t))return t;throw new go}function yo(t,e,n,r){if(t.equals(e))return n;if(_t(t)){const s=t.car,i=t.cdr,o=s.contains(e),a=i.contains(e);if(o){const t=yo(s,e,n,r);if(a){const s=yo(i,e,n,r);return Tt(t,Mt(s))}return Tt(t,i)}if(a){const t=yo(i,e,n,r);return Tt(s,Mt(t))}return t}if(St(t)){const s=r.handlerFor(t);return s?s.subst(t,e,n,r):t}return kt}function wo(t,e){const n=Yn(e,A),r=yo(t,A,n,e);return e.valueOf(r)}const Eo=t(e.testeq);function vo(t,e,n){const r=At(Eo,t,e);try{return n.valueOf(r)}finally{r.release()}}const Do=t(e.iszero);function bo(t,e){const n=At(Do,t);try{const t=e.valueOf(n);try{if(Gn(t))return t.isTrue();if(c(t))return!t.isZero();throw new Vt}finally{t.release()}}finally{n.release()}}const Ao=t(e.rect);function So(t,e){const n=At(Ao,t);try{return e.valueOf(n)}finally{n.release()}}var ko,_o;function Fo(t){if(function(t){return _t(t)||St(t)}(t))return t;throw new Vt}class Co{constructor(){ko.set(this,[]),_o.set(this,1)}addRef(){var t;Rt(this,_o,(t=Pt(this,_o,"f"),++t),"f")}release(){var t;if(Rt(this,_o,(t=Pt(this,_o,"f"),--t),"f"),0==Pt(this,_o,"f"))for(let t=0;t<Pt(this,ko,"f").length;t++)Pt(this,ko,"f")[t].release()}push(t){Fo(t),t.addRef(),Pt(this,ko,"f").push(t)}get elements(){return Pt(this,ko,"f").map((t=>(t.addRef(),t)))}}function To(t,e){t=Ct(t);let n=e.valueOf(Ft(t));return _t(t)&&(n=t.tail().reduce(((t,n)=>Mo(t,e.valueOf(n),e)),n)),n}function Mo(t,e,n){return function(t,e,n){if(pi(t))return function(t,e,n){return t.tail().reduce(((t,r)=>n.add(t,Mo(r,e,n))),_)}(t,e,n);if(b(t))return function(t,e,n){return t.map((t=>Mo(t,e,n)))}(t,e,n);if(t.contains(e))return _;return t}(t,e,n)}function Oo(t){return 3===t.length}function No(t){return function(e){return li(e,t)&&Oo(e)}}function Lo(n){return No(t(e.multiply))(n)}function Bo(t,e,n){const r=new Co;let s=t;for(;;){const t=n.valueOf(yo(s,e,_,n));if(r.push(t),s=s.equals(t)?_:n.valueOf(ao(i=n,s,Yn(i,t))),s.equals(_))try{return r.elements}finally{r.release()}s.equals(e)?s=S:_t(s)&&qo(s,e)?s=s.lhs:(s=ho(s,e,n),s=n.valueOf(s))}var i}function qo(t,e){return!!Lo(t)&&t.rhs.equals(e)}function Io(n,r){const s=Po(n,r),i=s.length;return new F([i],function(n,r){const s=n.map((function(t,e){return{value:t,index:e}}));s.sort((function(n,s){const i=r.compareFn(t(e.multiply))(n.value,s.value);return r.isscalar(n.value)||r.isscalar(s.value)?i:n.index-s.index}));const i=s.map((function(t){return t.value}));return i}(s,r))}function Po(t,e){const n=[];if(D(t))n.push(...ua(jt(t)));else if(_t(t)&&pi(t))n.push(...function(t,e){const n=_t(t)?t.tail().reduce((function(t,n){return ca(t,n,e)})):Ft(t),r=[];let s=n;if(jn(s,e))return r.push(t,S),r;if(D(s))r.push(...ua(jt(s)));else if(di(s)){const t=Ct(s);D(Ft(t))?r.push(...ua(jt(Ft(t)))):r.push(Ft(t),S),_t(t)&&t.tail().forEach((t=>r.push(t,S)))}else r.push(s,S);s=Yi(s,e);const i=_t(t)?t.tail().reduce(((t,n)=>ao(e,t,Zn(e,s,n))),_):Ct(t);return r.push(i,S),r}(t,e));else if(di(t)){let e=Ct(t);if(D(Ft(e))&&(n.push(...ua(jt(Ft(e)))),e=Ct(e)),_t(e)){const t=[...e].map((t=>mi(t)?[Ai(t),_i(t)]:[t,S]));n.push(...t.flat())}}else mi(t)?n.push(Ai(t),_i(t)):n.push(t,S);const r=n.length;return n.push(S),Ro(n,0,r,e),n.slice(r)}function Ro(t,e,n,r){const s=t.pop();if(e===n)return void t.push(s);const i=t[e+0],o=jt(t[e+1]);if(!isNaN(o))for(let u=0;u<=Math.abs(o);u++)t.push(Zn(r,s,po(r,i,x(((a=o)<0?-1:a>0?1:0)*u)))),Ro(t,e+2,n,r);var a}function Uo(t,e,n){return Qe($o,t,e,n)}function $o(t,e,n){const r=lo(ca(t,e,n),t,n);return Yi(lo(r,e,n),n)}function zo(t,e){const n=e.valueOf(t.item1),r=e.valueOf(t.item2),s=e.valueOf(t.item3);return s.isnil?Wo(n,r,Vs,e):Wo(n,r,s,e)}function Wo(t,e,n,r){const s=Bo(t,n,r);let i=s.length-1;const o=Bo(e,n,r),a=o.length-1;let u=i-a,c=_;for(;u>=0;){const t=lo(s[i],o[a],r);for(let e=0;e<=a;e++)s[u+e]=mo(r,s[u+e],Zn(r,o[e],t));c=ao(r,c,Zn(r,t,po(r,n,x(u)))),i--,u--}return c}function Xo(t){if(void 0===t)throw new Error("expr must be defined.");He.stack[He.tos++]=t}function Ko(){if(0===He.tos)throw new go("stack underflow");const t=He.stack[--He.tos];return He.stack[He.tos]=null,t}function Ho(t){for(;t.length>0;)Xo(t.shift())}function Jo(t,e,n){const r=function(t,e){return t};Zi(t)&&Je("floating point numbers in polynomial");const s=Bo(t,e,n);for(let t=0;t<s.length;t++);const i=function(t,e){let n=S;for(const r of t)n=Uo(va(r,e),n,e);for(let r=0;r<t.length;r++)t[r]=Zn(e,n,t[r]);const r=Yi(n,e);return r}(s,n);for(let t=0;t<s.length;t++);let o,a,u,c="ℝ",l=null,h=s.length-1,f=i;for(;h>0;){let t=!1,i=!1;if(bo(s[0],n)?(o=S,a=_):"ℝ"===c?[i,o,a]=Go(s,h,e,o,a,n):"ℂ"===c&&([t,o]=Vo(l,s,h,n)),"ℝ"===c){if(!1===i){c="ℂ";continue}{for(u=ao(n,Zn(n,o,e),a),f=eo(f,u,n),jo(o,a,s,h,n);h&&bo(s[h],n);)h--;let t=_;for(let r=0;r<=h;r++)t=ao(n,t,Zn(n,s[r],po(n,e,x(r))));l=t}}else if("ℂ"===c){if(!1===t)break;{u=Zn(n,mo(n,o,e),mo(n,wo(o,n),e));const t=f;if(f=eo(f,u,n),null==l){let t=_;for(let r=0;r<=h;r++)t=ao(n,t,Zn(n,s[r],po(n,e,x(r))));l=t}const i=l;l=Wo(i,u,e,n);if(!vo(Zn(n,l,u),i,n)){Xo(t);const e=Ve(ga,i,n);return r(eo(Ko(),e,n))}for(let t=0;t<=h;t++)s.pop();s.push(...Bo(l,e,n)),h-=2}}}let p=_;for(let t=0;t<=h;t++)p=ao(n,p,Zn(n,s[t],po(n,e,x(t))));const d=Ve(ga,p,n);return h>0&&io(s[h])?r(eo(Ve((function(t,e){return Yn(e,t)}),f,n),Yn(n,d),n)):r(eo(f,d,n))}function Go(t,e,n,r,s,i){const o=He.tos,a=He.tos;Ho(Po(t[e],i));const u=He.tos-a,c=He.tos;Ho(Po(t[0],i));const l=He.tos-c;for(let n=0;n<u;n++)for(let u=0;u<l;u++){r=He.stack[a+n];const l=Yn(i,lo(s=He.stack[c+u],r,i));if(bo(Qo(l,t,e,i),i))return Ge(o),[!0,r,s];s=Yn(i,s);if(bo(Qo(Yn(i,l),t,e,i),i))return Ge(o),[!0,r,s]}return Ge(o),[!1,r,s]}function Vo(t,e,n,r){let s,i,o;if(n<=2)return[!1,s];const a=He.tos;if(s=So(po(r,m,Wn(2,3)),r),i=s,Xo(i),o=Qo(i,e,n,r),bo(o,r))return Ge(a),[!0,s];if(s=So(po(r,S,Wn(2,3)),r),i=s,Xo(i),o=Qo(i,e,n,r),bo(o,r))return Ge(a),[!0,s];for(let t=-10;t<=10;t++)for(let i=1;i<=5;i++){s=So(ao(r,x(t),Zn(r,x(i),A)),r);const o=s;Xo(o);if(bo(Qo(o,e,n,r),r))return Ge(a),[!0,s]}return Ge(a),[!1,s]}function jo(t,e,n,r,s){let i=_;for(let o=r;o>0;o--){const r=lo(n[o],t,s);n[o]=i,i=r,n[o-1]=mo(s,n[o-1],Zn(s,i,e))}n[0]=i}function Qo(t,e,n,r){!function(t){const e=function(t){if(Number.isInteger(t))return t;throw new Vt}(t);if(e>=0)return e;throw new Vt}(n);let s=_;for(let i=n;i>=0;i--)s=ao(r,Zn(r,s,t),e[i]);return s}function Zo(t,e){return dn(t,e)}function Yo(t){return t.isProbablePrime()}function ta(t,e){return t.compare(e)}ko=new WeakMap,_o=new WeakMap;let ea=En(0);function na(t){if(Gi(t,0)||Gi(t,1)||Gi(t,-1))return t;ea=t.a;const e=function(){const t=[];ea.isNegative()&&(ea=Rn(ea),t.push(Nn));for(let e=0;e<1e4;e++)if(t.push(...ra(e)),0===ea.compare(1))return t;return t.push(...function(){const t=[],e=In(1);let n=In(5),r=In(2),s=1,i=1;for(;;){if(Yo(ea))return t.push(sa(ea,1)),t;for(;;){let o=r.subtract(n);o=Rn(o);const a=Zo(o,ea);if(!a.equals(1)){if(t.push(sa(a,1)),0===ta(a,ea))return t;o=tn(ea,a),ea=o,o=en(n,ea),n=o,o=en(r,ea),r=o;break}0==--s&&(r=n,i*=2,s=i),o=Ye(n,n),n=o.add(e),o=en(n,ea),n=o}}}()),t}();return e.length,1===e.length?e[0]:e.length>1?Tt(ss,At(...e)):kt}function ra(t){const e=[];let n;const r=In(ei[t]);let s=0;for(;;){if(0===ea.compare(1))return s&&e.push(sa(r,s)),e;let t;if([n,t]=Array.from(nn(ea,r)),!t.isZero())break;s++,ea=n}return s&&e.push(sa(r,s)),-1===ta(n,r)&&(e.push(sa(ea,1)),ea=In(1)),e}function sa(t,e){let n=new w(t,En.one);return e>1&&(n=At(us,n,new w(In(e),En.one))),n}function ia(t,e,n,r){const s=aa(e,n,r);di(s)?t.push(...s.tail()):t.push(s)}function oa(t,e,n){return c(t)&&t.isInteger()?na(t):aa(t,e,n)}function aa(t,e,n){return t.contains(e)&&Pi(t,e)&&v(e)?Jo(t,e,n):t}function ua(t){isNaN(t)&&Je("number too big to factor");const e=[];t<0&&(t=-t);for(let n=0;n<Ys;n++){const r=ei[n];if(r>t/r)break;let s=0;for(;t%r==0;)t/=r,s++;s&&(e.push(x(r)),e.push(x(s)))}return t>1&&(e.push(x(t)),e.push(S)),e}function ca(t,e,n){return Qe(la,t,e,n)}function la(t,e,n){if(t.equals(e))return t;if(c(t)&&c(e))return t.gcd(e);const r=ha(t,e);return r?function(t,e,n,r){let s=aa(t,n,r),i=aa(e,n,r);(di(s)||di(i))&&(di(s)||(s=At(ss,s,S)),di(i)||(i=At(ss,i,S)));if(di(s)&&di(i))return fa(s,i,r);return pa(s,i,r)}(t,e,r,n):pi(t)&&pi(e)?function(t,e,n){if(xo(t),xo(e),ai(t)!==ai(e))return S;const r=_t(t)?t.tail().reduce((function(t,e){return ca(t,e,n)})):Ft(Ct(t)),s=_t(e)?e.tail().reduce((function(t,e){return ca(t,e,n)})):Ft(Ct(e)),i=lo(t,r,n),o=lo(e,s,n);if(i.equals(o))return Zn(n,i,ca(r,s,n));return S}(t,e,n):(pi(t)&&(t=da(t,n)),pi(e)&&(e=da(e,n)),di(t)?function(t,e,n){return t.tail().reduce(((t,r)=>Zn(n,t,ca(r,e,n))),S)}(t,e,n):di(e)?function(t,e,n){return e.tail().reduce(((e,r)=>Zn(n,e,ca(t,r,n))),S)}(t,e,n):di(t)&&di(e)?fa(t,e,n):pa(t,e,n))}function ha(t,e){const n=qi(t,null);return!!n&&(!!qi(e,n)&&n)}function fa(t,e,n){const r=t.rest,s=e.rest;return[...r].reduce(((t,e)=>Zn(n,t,[...s].reduce(((t,r)=>Zn(n,t,ca(e,r,n))),S))),S)}function pa(t,e,n){let r,s;if(mi(t)?(r=_i(t),t=Ai(t)):r=S,mi(e)?(s=_i(e),e=Ai(e)):s=S,!t.equals(e))return S;if(D(r)&&D(s)){return po(n,t,Hn(r,s)<0?r:s)}const i=lo(r,s,n);if(D(i)){const e=Ai(r),i=di(r)&&D(e)?e:S,o=Ai(s);return po(n,t,Hn(i,di(s)&&D(o)?o:S)<0?r:s)}const o=mo(n,r,s);if(!D(o))return S;return po(n,t,ci(o)?r:s)}function da(t,e){return t.tail().reduce((function(t,n){return ca(t,n,e)}))}function ma(t,e){return Ve(ga,t,e)}function ga(t,e){if(!pi(t))return t;const n=Yi(t.tail().reduce((function(t,n){return ca(t,n,e)})),e),r=function(t,e){return je((function(t){return e.valueOf(t)}),t,e)}(t.tail().reduce(((t,r)=>ao(e,t,eo(n,r,e))),_),e);return lo(r,n,e)}function xa(t,e){e.pushDirective(ie.factoring,1);try{return function(t,e){if(b(t))return function(t,e){if(!b(t))return t;const n=t.mapElements((function(t){return xa(t,e)}));return t.withElements(n)}(t,e);if(!pi(t))return t;const n=function(t,e){if(pi(t))return t.tail().reduce(((t,n)=>ya(n,t,e)),S);return ya(t,S,e)}(t,e);let r=_;_t(t)&&(r=t.tail().reduce(((t,r)=>ao(e,t,Zn(e,n,r))),r));const s=ma(r,e),i=lo(s,n,e);return i}(t,e)}finally{e.popDirective()}}function ya(t,e,n){return di(t)?t.tail().reduce(((t,e)=>wa(e,t,n)),e):wa(t,e,n)}function wa(t,e,n){if(!mi(t))return e;const r=t;return ci(t=_i(t))||di(t)&&ci(Ai(t))?Ea(e,Yi(r,n),n):e}function Ea(t,e,n){return lo(Zn(n,t,e),ca(t,e,n),n)}function va(t,e){if(c(t))return t.denom();if(_t(t)&&pi(t)&&(t=xa(t,e)),_t(t)){const n=t.cdr;if(di(t)&&!jn(Ft(n),e)){const n=function(t,e){const n=function(t){return function(e){return va(e,t)}}(e),r=t.map(n);return r}(t.tail(),e);return no(n,e)}if(mi(t)&&io(t.expo))return Yi(t,e)}return S}function Da(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return ba(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}function ba(t,e){return pi(t)&&(t=xa(t,e)),di(t)&&!jn(Ft(Ct(t)),e)?no(t.tail().map((function(t){return ba(t,e)})),e):c(t)?$n(t):mi(t)&&io(_i(t))?Dn:t}function Aa(t){return t instanceof C}function Sa(t){return!!Aa(t)&&ze.equalsSym(t)}const ka=t(e.E);function _a(t){if(v(t))return ka.equals(t);if(mi(t)){const e=t.lhs,n=t.rhs;return!(!D(n)||!n.isOne())&&_a(e)}return!1}const Fa=f("last"),Ca=f("tty");function Ta(t,e){let n;if(e.getDirective(ie.printMode)===Ke.EcmaScript||e.getDirective(ie.renderFloatAsEcmaScript))return`${t}`;if(e.getDirective(ie.forceFixedPrintout)){const r=e.getDirective(ie.maxFixedPrintoutDigits);n=t.toFixed(r),n=n.replace(/(\.\d*?[1-9])0+$/gm,"$1"),n=n.replace(/\.0+$/gm,""),-1===n.indexOf(".")&&(n+=".0"),parseFloat(n)!==t&&(n=t.toFixed(r)+"...")}else n=""+t,n=e.getDirective(ie.printMode)===Ke.LaTeX?/\d*\.\d*e.*/gm.test(n)?n.replace(/e(.*)/gm,"\\mathrm{e}{$1}"):n.replace(/(\d+)e(.*)/gm,"$1.0\\mathrm{e}{$2}"):/\d*\.\d*e.*/gm.test(n)?n.replace(/e(.*)/gm,"*10^($1)"):n.replace(/(\d+)e(.*)/gm,"$1.0*10^($2)");return n}function Ma(t,e,n){if(c(t)){let r="",s=t.a.toString();if(e||"-"===s[0]&&(s=s.substring(1)),n.getDirective(ie.printMode)===Ke.LaTeX&&t.isFraction()&&(s="\\frac{"+s+"}{"),r+=s,t.isFraction()){n.getDirective(ie.printMode)!==Ke.LaTeX&&(r+="/");let e=t.b.toString();n.getDirective(ie.printMode)===Ke.LaTeX&&(e+="}"),r+=e}return r}if(l(t)){const r=Ta(t.d,n);return e?r:"-"===r[0]?r.substring(1):r}throw new Error(`print_number(p = ${t})`)}function Oa(n,r){if(_t(n)){let t="";for(t+="(",t+=Oa(Ft(n),r),n=Ct(n);_t(n);)t+=" ",t+=Oa(Ft(n),r),n=Ct(n);return n!==kt&&(t+=" . ",t+=Oa(n,r)),t+=")",t}if(!St(n)){if(n.isnil){return Qt(r.handlerFor(n).dispatch(n,t(e.sexpr),kt,r))}throw new Error}{const s=r.handlerFor(n).dispatch(n,t(e.sexpr),kt,r);try{return Qt(s)}finally{s.release()}}}const Na=t(e.E),La=t(e.IMU),Ba=t(e.PI),qa=t(e.testeq),Ia=t(e.component);function Pa(t){switch(t){case Ke.Ascii:return Ls;case Ke.Human:return Ps;case Ke.LaTeX:return qs;case Ke.Infix:return Bs;case Ke.SExpr:return Is;default:throw new Vt}}function Ra(t,e){return function(t){if(c(t)&&(t.isNegative()||t.isFraction()))return!0;if(l(t)&&t.isNegative())return!0;if(pi(t))return!0;if(di(t))return!0;if(mi(t))return!0;return!1}(t)?`(${za(t,e)})`:za(t,e)}function Ua(t,e){return c(t)&&t.isFraction()||pi(t)||di(t)||mi(t)?`(${za(t,e)})`:za(t,e)}function $a(t,e,n){let r="";const s=Ai(t);let i=_i(t);return Li(i)?(r+=Ra(s,n),r):(1===e&&(r+="("),i=Yn(n,i),r+=Ya(s,i,n),1===e&&(r+=")"),r)}function za(t,e){return function(t,e){let n="";if(pi(t))for(t=Ct(t),"-"===Wa(Ft(t))&&(n+="-"),n+=Ka(Ft(t),e),t=Ct(t);_t(t);)"+"===Wa(Ft(t))?e.getDirective(ie.printMode)===Ke.Human?n+=" + ":n+="+":e.getDirective(ie.printMode)===Ke.Human?n+=" - ":n+="-",n+=Ka(Ft(t),e),t=Ct(t);else"-"===Wa(t)&&(n+="-"),n+=Ka(t,e);return n}(t,e)}function Wa(t){if(_t(t)&&di(t)){const e=Ft(t.cdr);if(D(e)&&e.isNegative())return"-"}return D(t)&&t.isNegative()?"-":"+"}function Xa(t,e){let n="",r="",s=Ct(t);Li(Ft(s))&&(s=Ct(s));let i=!1;D(Ft(s))&&(i=!0);let o=!1;e.getDirective(ie.printMode)===Ke.LaTeX&&_t(Ct(s))&&function(t){return c(t)&&t.isFraction()&&ii(t.a.abs(),1)}(Ft(s))&&(o=!0,n=Ft(s).b.toString());let a="";for(o?(r=a,a=""):a+=Ha(Ft(s),!1,!1,e),s=Ct(s);_t(s);)e.getDirective(ie.printMode)===Ke.LaTeX&&i&&bi(s).equals(us)&&D(Ft(Ct(Ft(s))))&&(Ji(Ft(Ct(Ct(Ft(s)))))||(a+=" \\cdot ")),a+=eu(e),a+=Ha(Ft(s),!1,!0,e),i=!1,D(Ft(s))&&(i=!0),s=Ct(s);return o&&(a=r+"\\frac{"+a+"}{"+n+"}"),a}function Ka(t,e){return _t(t)&&di(t)?function(t){let e=t.cdr;for(;_t(e);){if(nu(e.car))return!0;e=e.cdr}return!1}(t)?function(t,e){let n,r,s="",i=0,o=0,a=0,u=t.cdr,l=Ft(u);for(c(l)?(n=$n(l).abs(),r=zn(l),jn(n,e)||o++,jn(r,e)||a++,u=Ct(u)):(n=S,r=S);_t(u);)l=Ft(u),nu(l)?a++:o++,u=Ct(u);if(e.getDirective(ie.printMode)===Ke.LaTeX&&(s+="\\frac{"),0===o)s+="1";else for(i=0,u=Ct(t),c(Ft(u))&&(u=Ct(u)),jn(n,e)||(s+=tu(n,!1,!1,e),i=1);_t(u);)l=Ft(u),nu(l)||(i&&(s+=eu(e)),s+=tu(l,!1,!1,e),i=1),u=Ct(u);for(e.getDirective(ie.printMode)===Ke.LaTeX?s+="}{":e.getDirective(ie.printMode)===Ke.Human?s+=" / ":s+="/",a>1&&e.getDirective(ie.printMode)!==Ke.LaTeX&&(s+="("),i=0,u=Ct(t),c(Ft(u))&&(u=Ct(u)),jn(r,e)||(s+=tu(r,!1,!1,e),i=1);_t(u);)l=Ft(u),nu(l)&&(i&&(s+=eu(e)),s+=$a(l,a,e),i=1),u=Ct(u);return a>1&&e.getDirective(ie.printMode)!==Ke.LaTeX&&(s+=")"),e.getDirective(ie.printMode)===Ke.LaTeX&&(s+="}"),s}(t,e):Xa(t,e):Ha(t,!1,!1,e)}function Ha(t,e,n,r){if(_t(t)&&xi(t)){let e=t.argList;if(_t(e)){let t=Ga(e.car,!1,!1,r);for(e=e.cdr;_t(e);)t+=Ja(r),t+=Ga(Ft(e),!1,!0,r),e=e.cdr;return t}throw new Error}return Ga(t,e,n,r)}function Ja(t){return t.getDirective(ie.printMode)===Ke.LaTeX?" \\wedge ":t.getDirective(ie.printMode)===Ke.Human?" ^ ":"^"}function Ga(t,e,n,r){if(_t(t)&&yi(t)){let e=t.argList;if(_t(e)){let t=tu(e.car,!1,!1,r);for(e=e.cdr;_t(e);)t+=Va(r),t+=tu(Ft(e),!1,!0,r),e=e.cdr;return t}throw new Error}if(_t(t)&&function(t){return _t(t)&&li(t,Re)}(t)){let e=t.argList;if(_t(e)){let t=tu(e.car,!1,!1,r);for(e=e.cdr;_t(e);)t+=ja(r),t+=tu(Ft(e),!1,!0,r),e=e.cdr;return t}throw new Error}if(_t(t)&&function(t){return _t(t)&&li(t,Ue)}(t)){let e=t.argList;if(_t(e)){let t=tu(e.car,!1,!1,r);for(e=e.cdr;_t(e);)t+=Qa(r),t+=tu(Ft(e),!1,!0,r),e=e.cdr;return t}throw new Error}return tu(t,e,n,r)}function Va(t){return t.getDirective(ie.printMode)===Ke.LaTeX?" \\mid ":t.getDirective(ie.printMode)===Ke.Human?" | ":"|"}function ja(t){return t.getDirective(ie.printMode)===Ke.LaTeX?" \\ll ":t.getDirective(ie.printMode)===Ke.Human?" << ":"<<"}function Qa(t){return t.getDirective(ie.printMode)===Ke.LaTeX?" \\gg ":t.getDirective(ie.printMode)===Ke.Human?" >> ":">>"}function Za(t,e){let n="";return n+="(",n+=za(t,e),n+=")",n}function Ya(t,e,n){let r="";if(ji(e))if(Gi(t,2)){if(n.getDirective(ie.printMode)===Ke.EcmaScript)return r+="Math.SQRT2",r}else{if(n.getDirective(ie.printMode)===Ke.LaTeX)return r+="\\sqrt{",r+=za(t,n),r+="}",r;if(n.getDirective(ie.printMode)===Ke.EcmaScript)return r+="Math.sqrt(",r+=za(t,n),r+=")",r}if(Gi(n.getBinding(cs,kt),1)&&_a(t))return n.getDirective(ie.printMode)===Ke.EcmaScript?(r+="Math.exp(",r+=Ua(e,n),r+=")",r):(n.getDirective(ie.printMode)===Ke.LaTeX?(r+="e^{",r+=za(e,n),r+="}"):(r+="exp(",r+=za(e,n),r+=")"),r);if(n.getDirective(ie.printMode)===Ke.EcmaScript)return r+="Math.pow(",r+=Ra(t,n),r+=", ",r+=Ua(e,n),r+=")",r;if(function(t,e){if(v(t)){if(t.equals(f("x"))){const t=ls,n=e.getBinding(t,kt);return!(!n.equals(t)&&!n.isnil&&Gi(n,1))}return!0}return!0}(t,n)){if(!_a(t)){if(D(e)&&e.isMinusOne())return n.getDirective(ie.printMode)===Ke.LaTeX?r+="\\frac{1}{":n.getDirective(ie.printMode)===Ke.Human?r+="1 / ":r+="1/",_t(t)&&n.getDirective(ie.printMode)!==Ke.LaTeX?(r+="(",r+=za(t,n),r+=")"):r+=za(t,n),n.getDirective(ie.printMode)===Ke.LaTeX&&(r+="}"),r;if(io(e)){n.getDirective(ie.printMode)===Ke.LaTeX?r+="\\frac{1}{":n.getDirective(ie.printMode)===Ke.Human?r+="1 / ":r+="1/";const s=Yn(n,e);return _t(t)&&n.getDirective(ie.printMode)!==Ke.LaTeX?(r+="(",r+=Ya(t,s,n),r+=")"):r+=Ya(t,s,n),n.getDirective(ie.printMode)===Ke.LaTeX&&(r+="}"),r}}if(Ji(e)&&n.getDirective(ie.printMode)===Ke.LaTeX){r+="\\sqrt";const s=va(e,n);return Ni(s)||(r+="[",r+=za(s,n),r+="]"),r+="{",r+=Ya(t,e=ba(e,n),n),r+="}",r}}return n.getDirective(ie.printMode)===Ke.LaTeX&&jn(e,n)?r+=za(t,n):(mi(t)?n.getDirective(ie.printMode)!==Ke.LaTeX?(r+="(",r+=tu(t,!0,!1,n),r+=")"):r+=tu(t,!0,!1,n):ci(t)||pi(t)?(r+="(",r+=za(t,n),r+=")"):di(t)?n.getDirective(ie.printMode)!==Ke.LaTeX?(r+="(",r+=tu(t,!0,!1,n),r+=")"):r+=tu(t,!0,!1,n):xi(t)||yi(t)?(r+="(",r+=za(t,n),r+=")"):D(t)&&(Jn(t,_)||Ji(t))?(r+="(",r+=tu(t,!1,!1,n),r+=")"):r+=tu(t,!1,!1,n),n.getDirective(ie.printMode)===Ke.Human?n.getDirective(ie.useCaretForExponentiation)?r+="^":r+="**":n.getDirective(ie.printMode)===Ke.LaTeX||n.getDirective(ie.useCaretForExponentiation)?r+="^":r+="**",n.getDirective(ie.printMode)===Ke.LaTeX?za(e,n).length>1?(r+="{",r+=za(e,n),r+="}"):r+=za(e,n):_t(e)||Ji(e)||D(e)&&Jn(e,_)?(r+="(",r+=za(e,n),r+=")"):r+=tu(e,!1,!1,n)),r}function tu(r,s=!1,i=!1,o){const a=s;if(D(r)){if(i&&Jn(r,_)){let t="";return t+="(",t+=Ma(r,i,o),t+=")",t}return Ma(r,i,o)}if(St(r)){const n=o.handlerFor(r);switch(o.getDirective(ie.printMode)){case Ke.Human:return Qt(n.dispatch(r,t(e.human),kt,o));case Ke.Infix:{const s=n.dispatch(r,t(e.infix),kt,o);if(h(s))return Qt(s);throw T(s)?s:new Vt}case Ke.LaTeX:return Qt(n.dispatch(r,t(e.latex),kt,o));case Ke.SExpr:return Qt(n.dispatch(r,t(e.sexpr),kt,o));default:throw new Error(`${o.getDirective(ie.printMode)}`)}}if(_t(r)&&di(r)){let t="";return a||"-"!==Wa(r)&&o.getDirective(ie.printMode)===Ke.LaTeX||(o.getDirective(ie.printMode)===Ke.LaTeX?t+=" \\left (":t+="("),t+=za(r,o),a||"-"!==Wa(r)&&o.getDirective(ie.printMode)===Ke.LaTeX||(o.getDirective(ie.printMode)===Ke.LaTeX?t+=" \\right ) ":t+=")"),t}if(pi(r)){let t="";return a||(t+="("),t+=za(r,o),a||(t+=")"),t}if(mi(r))return Ya(r.base,r.expo,o);if(_t(r)){const t=r.opr,e=r.argList;try{if(t.equals(zr)){let t="";const n=e.item(1);try{if(o.getDirective(ie.printMode)!==Ke.EcmaScript){const n=e.item(0);try{t+="fn ";t+=Oa(n,o),t+=" -> "}finally{n.release()}}return t+=za(n,o),t}finally{n.release()}}else if(t.equals(Xr)){let t="";const n=e.item(0);try{if(o.getDirective(ie.printMode)!==Ke.EcmaScript){const n=e.item(1);try{t+="function ";t+=Oa(n,o),t+=" -> "}finally{n.release()}}return t+=za(n,o),t}finally{n.release()}}}finally{t.release(),e.release()}}if(Ft(r).equals(as)){let t="";return t+=za(ki(r),o),o.getDirective(ie.printMode)===Ke.LaTeX?t+=" \\rightarrow ":o.getDirective(ie.printMode)===Ke.Human?t+=" -> ":t+="->",t+=za(Ft(Ct(Ai(r))),o),t}if(Ft(r).equals(Ia)&&v(Ai(r))){let t="";return t+=function(t,e){let n="";if(bi(t=Ct(t)).equals(er)||bi(t).equals(ss)||bi(t).equals(us)||bi(t).equals(Rr)?n+=Za(Ft(t),e):n+=za(Ft(t),e),n+="[",t=Ct(t),_t(t))for(n+=za(Ft(t),e),t=Ct(t);_t(t);)n+=",",n+=za(Ft(t),e),t=Ct(t);return n+="]",n}(r,o),t}if(_t(r)&&gi(r))return function(t,e){let n="";return Ji(t=Ai(t))||pi(t)||di(t)||mi(t)||gi(t)?n+=Za(t,e):n+=za(t,e),n+="!",n}(r,o);if(_t(r)&&fi(r))switch(o.getDirective(ie.printMode)){case Ke.Human:case Ke.Infix:return function(t,e){let n="";return n+="abs(",n+=za(t.argList.head,e),n+=")",n}(r,o);case Ke.LaTeX:return function(t,e){let n="";return n+="\\left |",n+=za(t.argList.head,e),n+=" \\right |",n}(r,o);default:throw new Vt}else{if(Ft(r).equals(vs)&&o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";return n+="\\sqrt{",n+=za(Ai(t),e),n+="} ",n}(r,o),t}if(wi(r)){if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";return n+="{",_t(Ai(t))&&(n+="("),n+=za(Ai(t),e),_t(Ai(t))&&(n+=")"),n+="}",n+="^T",n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="";return n+="transpose(",n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(Os)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="";return n+="identity(",n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(_t(r)&&Ei(r)){if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";return n+="{",_t(Ai(t))&&(n+="("),n+=za(Ai(t),e),_t(Ai(t))&&(n+=")"),n+="}",n+="^{-1}",n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="";return n+="inv(",n+=za(Ai(t),e),n+=")",n}(r,o),t}}else{if(Ft(r).equals(fr)&&o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";return n+="\\binom{",n+=za(Ai(t),e),n+="}{",n+=za(_i(t),e),n+="} ",n}(r,o),t}if(Ft(r).equals(Ar)&&o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";const r=Ft(Ct(t)),s=t=Ct(t);let i=0;for(;_t(Ct(Ct(t)));){i++;const r=Ct(Ct(t));n+="\\int^{",n+=za(Ft(Ct(r)),e),n+="}_{",n+=za(Ft(r),e),n+="} \\! ",t=Ct(r)}n+=za(r,e),n+=" \\,",t=s;for(let r=1;r<=i;r++){const s=Ct(t);n+=" \\mathrm{d} ",n+=za(Ft(s),e),r<i&&(n+=" \\, "),t=Ct(Ct(s))}return n}(r,o),t}if(yi(r)){if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="";return n+=za(Ai(t),e),n+=" \\cdot ",n+=za(_i(t),e),n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="dot(";return n+=za(Ai(t),e),n+=", ",n+=za(_i(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(ws)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.sin(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(Dr)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.cos(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(bs)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.tan(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(or)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.asin(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(sr)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.acos(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(ur)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="Math.atan(";return n+=za(Ai(t),e),n+=")",n}(r,o),t}}else if(Ft(r).equals(Ds)){if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="\\sum_{";return n+=za(_i(t),e),n+="=",n+=za(Ti(t),e),n+="}^{",n+=za(Mi(t),e),n+="}{",n+=za(Ai(t),e),n+="}",n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){const n=Ai(t),r=_i(t),s=Ti(t),i=Mi(t);return"(function(){ var "+za(r,e)+"; var holderSum = 0; var lowerlimit = "+za(s,e)+"; var upperlimit = "+za(i,e)+"; for ("+za(r,e)+" = lowerlimit; "+za(r,e)+" < upperlimit; "+za(r,e)+"++) { holderSum += "+za(n,e)+"; } return holderSum;})()"}(r,o),t}}else if(Ft(r).equals(hs)){if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="\\prod_{";return n+=za(_i(t),e),n+="=",n+=za(Ti(t),e),n+="}^{",n+=za(Mi(t),e),n+="}{",n+=za(Ai(t),e),n+="}",n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){const n=Ai(t),r=_i(t),s=Ti(t),i=Mi(t);return"(function(){ var "+za(r,e)+"; var holderProduct = 1; var lowerlimit = "+za(s,e)+"; var upperlimit = "+za(i,e)+"; for ("+za(r,e)+" = lowerlimit; "+za(r,e)+" < upperlimit; "+za(r,e)+"++) { holderProduct *= "+za(n,e)+"; } return holderProduct;})()"}(r,o),t}}else if(Ft(r).equals(Wr)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){const n=Ai(t),r=_i(t),s=Ti(t),i=Mi(t);return"(function(){ var "+r+"; var lowerlimit = "+za(s,e)+"; var upperlimit = "+za(i,e)+"; for ("+r+" = lowerlimit; "+r+" < upperlimit; "+r+"++) { "+za(n,e)+" } })()"}(r,o),t}}else if(Ft(r).equals(Fr)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="";for(t=Ct(t);_t(t);)n+=za(Ft(t),e),t=Ct(t);return n}(r,o),t}}else if(Ft(r).equals(ks)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="(function(){";t=Ct(t);let r=0;for(;_t(t);){if(Ct(t).isnil){n+="else {",n+="return ("+za(Ft(t),e)+");,$",n+="}";break}r&&(n+=" else "),n+="if ("+za(Ft(t),e)+"){,$",n+="return ("+za(Ai(t),e)+");,$",n+="}",r++,t=Si(t)}return n+="})()",n}(r,o),t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="\\left\\{ \\begin{array}{ll}";for(t=Ct(t);_t(t);){if(Ct(t).isnil){n+="{",n+=za(Ft(t),e),n+="} & otherwise ",n+=" \\\\\\\\";break}n+="{",n+=za(Ai(t),e),n+="} & if & ",n+=za(Ft(t),e),n+=" \\\\\\\\",t=Si(t)}return n=n.substring(0,n.length-4),n+"\\end{array} \\right."}(r,o),t}}else if(Ft(r).equals(Ts)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="(("+za(Ai(r),o)+") < ("+za(_i(r),o)+"))",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="{";return n+=za(Ai(t),e),n+="}",n+=" < ",n+="{",n+=za(_i(t),e),n+"}"}(r,o),t}}else if(Ft(r).equals(Cs)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="(("+za(Ai(r),o)+") <= ("+za(_i(r),o)+"))",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="{";return n+=za(Ai(t),e),n+="}",n+=" \\leq ",n+="{",n+=za(_i(t),e),n+"}"}(r,o),t}}else if(Ft(r).equals(Fs)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="(("+za(Ai(r),o)+") > ("+za(_i(r),o)+"))",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="{";return n+=za(Ai(t),e),n+="}",n+=" > ",n+="{",n+=za(_i(t),e),n+"}"}(r,o),t}}else if(Ft(r).equals(_s)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="(("+za(Ai(r),o)+") >= ("+za(_i(r),o)+"))",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="{";return n+=za(Ai(t),e),n+="}",n+=" \\geq ",n+="{",n+=za(_i(t),e),n+"}"}(r,o),t}}else if(_t(r)&&r.opr.equals(qa)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="(("+za(Ai(r),o)+") === ("+za(_i(r),o)+"))",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=function(t,e){let n="{";return n+=za(t.lhs,e),n+="}",n+=" = ",n+="{",n+=za(t.rhs,e),n+"}"}(r,o),t}}else if(Ft(r).equals($r)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="Math.floor("+za(Ai(r),o)+"),$",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=" \\lfloor {"+za(Ai(r),o)+"} \\rfloor ,$",t}}else if(Ft(r).equals(pr)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="Math.ceiling("+za(Ai(r),o)+"),$",t}if(o.getDirective(ie.printMode)===Ke.LaTeX){let t="";return t+=" \\lceil {"+za(Ai(r),o)+"} \\rceil ,$",t}}else if(Ft(r).equals(gs)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+="Math.round("+za(Ai(r),o)+"),$",t}}else if(Ft(r).equals(xs)){if(o.getDirective(ie.printMode)===Ke.EcmaScript){let t="";return t+=function(t,e){let n="";return n+=za(Ai(t),e),n+=" = ",n+=za(_i(t),e),n+="; ",n}(r,o),t}{let t="";return t+=za(Ai(r),o),t+="=",t+=za(_i(r),o),t}}}}return function(r,s,i){if(_t(r)){let t="";if(t+=tu(r.car,!1,!1,i),(r=r.cdr).isnil)return t;if(s||(t+="("),_t(r))for(t+=za(Ft(r),i),r=Ct(r);_t(r);)t+=",",t+=za(Ft(r),i),r=Ct(r);return s||(t+=")"),t}if(St(r))if(T(r));else if(!Wt(r))throw new Vt(`${r}`);if(k(r)){let t="";return t+=r.toString(),t}if(M(r)){let t="";return t+=r.toString(),t}if(v(r)&&n(r,e.derivative))return"d";if(_a(r))return i.getDirective(ie.printMode)===Ke.EcmaScript?"Math.E":i.getDirective(ie.printMode)===Ke.LaTeX?"e":i.getSymbolPrintName(Na);if(Sa(r))return i.getDirective(ie.printMode)===Ke.LaTeX?"\\pi":i.getSymbolPrintName(Ba);if(v(r)){const n=i.handlerFor(r);return i.getDirective(ie.printMode)===Ke.Infix?Qt(n.dispatch(r,t(e.infix),kt,i)):i.getDirective(ie.printMode)===Ke.LaTeX?Qt(n.dispatch(r,t(e.latex),kt,i)):r.key()}if(O(r))return r.printname;if(N(r)){const n=i.handlerFor(r);return i.getDirective(ie.printMode)===Ke.Infix?Qt(n.dispatch(r,t(e.infix),kt,i)):i.getDirective(ie.printMode)===Ke.LaTeX?Qt(n.dispatch(r,t(e.latex),kt,i)):r.key()}if(T(r)){return Qt(i.handlerFor(r).dispatch(r,t(e.infix),kt,i))}if(L(r))return i.getDirective(ie.printMode)===Ke.LaTeX?"i":i.getSymbolPrintName(La);if(St(r)){switch(i.getDirective(ie.printMode)){case Ke.Ascii:case Ke.Human:case Ke.Infix:case Ke.LaTeX:case Ke.SExpr:}throw new Vt(`${r}: ${r.type}`)}if(r.isnil)return i.getSymbolPrintName(t(e.NIL));throw new Vt(`${r} ???`)}(r,a,o)}function eu(t){return t.getDirective(ie.printMode)===Ke.LaTeX?"":t.getDirective(ie.printMode)===Ke.Human?" ":"*"}function nu(t){if(_t(t)&&mi(t)){const e=t.cdr;if(_t(e)){if(!_a(e.car)){const t=e.cdr;if(_t(t)){return io(t.car)}}}}return!1}function ru(t,e){e.pushDirective(ie.printMode,Ke.Infix);try{return za(t,e).replace(/_/g,"\\_")}finally{e.popDirective()}}var su,iu;function ou(t){if(p(t))return t.isTrue();if(c(t)){if(t.isOne())return!0;if(t.isZero())return!1;throw new Vt(`${t}`)}throw new Vt(`${t}`)}function au(t){if(t instanceof uu)return t.context;throw new Vt((new Error).stack)}class uu{constructor(t){if(su.set(this,1),!t)throw new Vt("ctxt MUST be defined.");this.context=t,t.addRef()}addRef(){var t;Rt(this,su,(t=Pt(this,su,"f"),++t),"f")}release(){var t;Rt(this,su,(t=Pt(this,su,"f"),--t),"f"),0===Pt(this,su,"f")&&this.context.release()}hasState(t){return this.context.hasState(t)}getState(t){return this.context.getState(t)}setState(t,e){this.context.setState(t,e)}handlerFor(t){return this.context.handlerFor(t)}addAtomListener(t){throw new Error("Method not implemented.")}removeAtomListener(t){throw new Error("Method not implemented.")}getCellHost(){throw new Error("Method not implemented.")}setCellHost(t){throw new Error("Method not implemented.")}getProlog(){throw new Error("Method not implemented.")}getPrintHandler(){throw new Error("Method not implemented.")}setPrintHandler(t){throw new Error("Method not implemented.")}abs(n){const r=At(t(e.arg),n);try{return this.context.valueOf(r)}finally{r.release()}}algebra(t,e){throw new Error("Method not implemented.")}add(...n){const r=At(t(e.add),...n);try{return this.context.valueOf(r)}finally{r.release()}}arccos(n){const r=At(t(e.arccos),n);try{return this.context.valueOf(r)}finally{r.release()}}arcsin(n){const r=At(t(e.arcsin),n);try{return this.context.valueOf(r)}finally{r.release()}}arctan(n){const r=At(t(e.arctan),n);try{return this.context.valueOf(r)}finally{r.release()}}arg(n){const r=At(t(e.arg),n);try{return this.context.valueOf(r)}finally{r.release()}}clock(n){const r=At(t(e.clock),n);try{return this.context.valueOf(r)}finally{r.release()}}conj(n){const r=At(t(e.conj),n);try{return this.context.valueOf(r)}finally{r.release()}}cos(n){const r=At(t(e.cos),n);try{return this.context.valueOf(r)}finally{r.release()}}clearBindings(){throw new Error("Method not implemented.")}clearOperators(){throw new Error("Method not implemented.")}compareFn(t){return this.context.compareFn(t)}component(n,r){const s=At(t(e.component),n,r);try{return this.context.valueOf(s)}finally{s.release()}}defineEvalFunction(t,e){throw new Error("Method not implemented.")}defineFunction(t,e){throw new Error("Method not implemented.")}defineStackFunction(t,e){throw new Error("Method not implemented.")}defineKeyword(t,e){throw new Error("Method not implemented.")}defineExtension(t){throw new Error("Method not implemented.")}defineUserSymbol(t){throw new Error("Method not implemented.")}derivedEnv(){throw new Error("Method not implemented.")}divide(n,r){const s=At(t(e.divide),n,r);try{return this.context.valueOf(s)}finally{s.release()}}equals(n,r){const s=At(t(e.testeq),n,r);try{const t=au(this).valueOf(s);try{return ou(t)}finally{t.release()}}finally{s.release()}}evaluate(t,...e){throw new Error("Method not implemented.")}executeProlog(t){throw new Error("Method not implemented.")}exp(n){const r=At(t(e.exp),n);try{return this.context.valueOf(r)}finally{r.release()}}factor(n){const r=At(t(e.factor),n);try{return this.context.valueOf(r)}finally{r.release()}}factorize(t,e){throw new Error("Method not implemented.")}float(n){const r=At(t(e.float),n);try{return this.context.valueOf(r)}finally{r.release()}}getDirective(t){return this.context.getDirective(t)}getSymbolPredicates(t){return{algebraic:!1,antihermitian:!1,commutative:!1,complex:!1,extended_negative:!1,extended_nonnegative:!1,extended_nonpositive:!1,extended_nonzero:!1,extended_positive:!1,finite:!1,hermitian:!1,hypercomplex:!1,hyperreal:!1,imaginary:!1,infinite:!1,infinitesimal:!1,integer:!1,irrational:!1,negative:!1,noninteger:!1,nonnegative:!1,nonpositive:!1,nonzero:!1,positive:!1,rational:!1,real:!1,transcendental:!1,zero:!1}}getSymbolPrintName(t){throw new Error("Method not implemented.")}getSymbolUsrFunc(t){throw new Error("Method not implemented.")}getSymbolsInfo(){throw new Error("Method not implemented.")}buildOperators(){throw new Error("Method not implemented.")}im(n){const r=At(t(e.imag),n);try{return this.context.valueOf(r)}finally{r.release()}}inner(n,r){const s=At(t(e.inner),n,r);try{return this.context.valueOf(s)}finally{s.release()}}is(t,e){throw new Error("Method not implemented.")}iscomplex(n){const r=At(t(e.iscomplex),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isExpanding(){return this.context.getDirective(ie.expanding)>0}isFactoring(){throw new Error("Method not implemented.")}isimag(n){const r=At(t(e.isimag),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isinfinite(n){const r=At(t(e.isinfinite),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isinfinitesimal(n){const r=At(t(e.isinfinitesimal),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isminusone(t){throw new Error("Method not implemented.")}isnegative(t){throw new Error("Method not implemented.")}isone(t){throw new Error("Method not implemented.")}ispositive(n){const r=At(t(e.ispositive),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isreal(n){const r=At(t(e.isreal),n);try{const t=au(this).valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}isscalar(t){throw new Error("Method not implemented.")}iszero(n){const r=At(t(e.iszero),n);try{const t=this.context.valueOf(r);try{return ou(t)}finally{t.release()}}finally{r.release()}}log(n){const r=At(t(e.log),n);try{return this.context.valueOf(r)}finally{r.release()}}multiply(...n){const r=At(t(e.multiply),...n);try{return this.context.valueOf(r)}finally{r.release()}}negate(n){const r=At(t(e.multiply),x(-1),n);try{return this.context.valueOf(r)}finally{r.release()}}extensionFor(t){if(St(t))return new Ee(this.context.handlerFor(t));throw new Error("ExtensionFromExprContext.extensionFo method not implemented.")}outer(...n){const r=At(t(e.outer),...n);try{return this.context.valueOf(r)}finally{r.release()}}polar(n){const r=At(t(e.polar),n);try{return this.context.valueOf(r)}finally{r.release()}}power(n,r){const s=At(t(e.pow),n,r);try{return this.context.valueOf(s)}finally{s.release()}}re(n){const r=At(t(e.real),n);try{return this.context.valueOf(r)}finally{r.release()}}rect(n){const r=At(t(e.rect),n);try{return this.context.valueOf(r)}finally{r.release()}}remove(t){throw new Error("Method not implemented.")}pushDirective(t,e){this.context.pushDirective(t,e)}popDirective(){this.context.popDirective()}setSymbolOrder(t,e){throw new Error("Method not implemented.")}setSymbolPredicates(t,e){throw new Error("Method not implemented.")}setSymbolPrintName(t,e){throw new Error("Method not implemented.")}setSymbolUsrFunc(t,e){throw new Error("Method not implemented.")}simplify(n){const r=At(t(e.simplify),n);try{return this.context.valueOf(r)}finally{r.release()}}sin(n){const r=At(t(e.sin),n);try{return this.context.valueOf(r)}finally{r.release()}}sqrt(n){const r=At(t(e.sqrt),n);try{return this.context.valueOf(r)}finally{r.release()}}st(n){const r=At(t(e.st),n);try{return this.context.valueOf(r)}finally{r.release()}}subst(t,e,n){throw new Error("Method not implemented.")}subtract(n,r){const s=At(t(e.subtract),n,r);try{return this.context.valueOf(s)}finally{s.release()}}toInfixString(n){if(St(n)){return Qt(this.context.handlerFor(n).dispatch(n,t(e.infix),kt,this.context))}return ru(n,this.context)}toLatexString(t){throw new Error("Method not implemented.")}toSExprString(t){throw new Error("Method not implemented.")}transform(t){const e=this.context.valueOf(t);return e.equals(t)?[ee,e]:[ne,e]}valueOf(t,e){const n=au(this).valueOf(t);if(!e)return n;try{return e.push(n),kt}finally{n.release()}}hasBinding(t,e){return this.context.hasBinding(t,e)}getBinding(t,e){return this.context.getBinding(t,e)}setBinding(t,e){throw new Error("Method not implemented.")}hasUserFunction(t){return this.context.hasUserFunction(t)}getUserFunction(t){throw new Error("Method not implemented.")}setUserFunction(t,e){throw new Error("Method not implemented.")}get listeners(){throw new Error("Method not implemented.")}}su=new WeakMap;let cu=class t{constructor(t=[]){this.tos=0,iu.set(this,[]),Rt(this,iu,t,"f"),this.tos=t.length}get length(){return Pt(this,iu,"f").length}set length(t){Pt(this,iu,"f").length=t}get top(){if(Pt(this,iu,"f").length>0)return Pt(this,iu,"f")[Pt(this,iu,"f").length-1];throw new Vt}getAt(t){return Pt(this,iu,"f")[t]}setAt(t,e){Pt(this,iu,"f")[t]=e}peek(t){return Pt(this,iu,"f")[Pt(this,iu,"f").length-1-t]}push(t){this.tos++,Pt(this,iu,"f").push(t)}pushItems(t){for(;t.length>0;)this.push(t.shift())}pop(){this.tos--;const t=Pt(this,iu,"f").pop();if(t)return t;throw new Error}popItems(t){const e=[];for(let n=0;n<t;n++)e.push(this.pop());return e}rotateL(e){const n=new t;for(let t=0;t<e;t++){const t=this.pop();n.push(t)}const r=n.pop(),s=e-1;for(let t=0;t<s;t++){const t=n.pop();this.push(t)}this.push(r)}rotateR(e){const n=new t,r=this.pop(),s=e-1;for(let t=0;t<s;t++){const t=this.pop();n.push(t)}n.push(r);for(let t=0;t<e;t++){const t=n.pop();this.push(t)}}copy(){const e=Pt(this,iu,"f").slice();return new t(e)}some(t){return Pt(this,iu,"f").some(t)}splice(t,e){return"number"==typeof e?Pt(this,iu,"f").splice(t,e):Pt(this,iu,"f").splice(t)}swap(){const t=this.pop(),e=this.pop();this.push(t),this.push(e)}};var lu,hu,fu,pu;iu=new WeakMap;class du{constructor(t=[]){lu.set(this,void 0),hu.set(this,1);const e=t.length;for(let n=0;n<e;n++)t[n].addRef();Rt(this,lu,new cu(t),"f")}dupl(){const t=this.pop();try{this.push(t),this.push(t)}finally{t.release()}}head(){const t=this.pop();try{const e=Ft(t);try{this.push(e)}finally{e.release()}}finally{t.release()}}rest(){const t=this.pop();try{const e=Ct(t);try{this.push(e)}finally{e.release()}}finally{t.release()}}rotateL(t){Pt(this,lu,"f").rotateL(t)}rotateR(t){Pt(this,lu,"f").rotateR(t)}swap(){Pt(this,lu,"f").swap()}concat(t){for(let e=0;e<t.length;e++)Pt(this,lu,"f").push(t[e])}getAt(t){return Pt(this,lu,"f").getAt(t)}setAt(t,e){Pt(this,lu,"f").setAt(t,e)}splice(t,e){return"number"==typeof e?Pt(this,lu,"f").splice(t,e):Pt(this,lu,"f").splice(t)}get length(){return Pt(this,lu,"f").length}set length(t){Pt(this,lu,"f").length=t}get isatom(){return St(Pt(this,lu,"f").top)}get iscons(){return _t(Pt(this,lu,"f").top)}get istrue(){const t=Pt(this,lu,"f").top;if(p(t))return t.isTrue();throw T(t)?t:new Vt}list(t){Pt(this,lu,"f").push(kt);for(let e=0;e<t;e++){const t=Mt(Pt(this,lu,"f").pop()),e=Pt(this,lu,"f").pop();Pt(this,lu,"f").push(Tt(e,t))}}push(t){t.addRef(),Pt(this,lu,"f").push(t)}peek(){const t=this.pop();return this.push(t),t}pop(){return Pt(this,lu,"f").pop()}addRef(){var t;Rt(this,hu,(t=Pt(this,hu,"f"),++t),"f")}release(){var t;if(Rt(this,hu,(t=Pt(this,hu,"f"),--t),"f"),0===Pt(this,hu,"f")){const t=Pt(this,lu,"f").length,e=Pt(this,lu,"f").popItems(t);for(let n=0;n<t;n++)e[n].release()}}get refCount(){return Pt(this,hu,"f")}get tos(){return Pt(this,lu,"f").tos}}lu=new WeakMap,hu=new WeakMap;class mu{constructor(){fu.set(this,new cu),pu.set(this,1)}addRef(){var t;Rt(this,pu,(t=Pt(this,pu,"f"),++t),"f")}release(){var t;if(Rt(this,pu,(t=Pt(this,pu,"f"),--t),"f"),0==Pt(this,pu,"f"))for(;Pt(this,fu,"f").length>0;)Pt(this,fu,"f").pop().release()}get length(){return Pt(this,fu,"f").length}peek(t){const e=Pt(this,fu,"f").peek(t);return e.addRef(),e}push(t){t.addRef(),Pt(this,fu,"f").push(t)}pop(){return Pt(this,fu,"f").pop()}some(t){return Pt(this,fu,"f").some(t)}}function gu(t,e){if(t===e)return t;throw new go}function xu(t,e){return t.clone(e.pos,e.end)}fu=new WeakMap,pu=new WeakMap;const yu=function(t){let e=1001;return function(t){return{text:t,code:e++}}}(),wu=yu("Int"),Eu=yu("Flt"),vu=yu("Sym");yu("Keyword");const Du=yu("Function"),bu=yu("-"),Au=yu("NewLine"),Su=yu("+"),ku=yu("Str"),_u=yu(">="),Fu=yu(">>"),Cu=yu("<="),Tu=yu("<<"),Mu=yu("<"),Ou=yu(">"),Nu=yu("*"),Lu=yu("/"),Bu=yu("("),qu=yu(")"),Iu=yu("·"),Pu=yu("=="),Ru=yu("!="),Uu=yu(":"),$u=yu(":="),zu=yu("="),Wu=yu("**"),Xu=yu("^"),Ku=yu("|"),Hu=yu("End"),Ju=yu(","),Gu=yu("["),Vu=yu("]"),ju=yu("{"),Qu=yu("}"),Zu=yu("!");var Yu,tc,ec,nc,rc,sc,ic,oc,ac,uc,cc,lc,hc,fc,pc,dc,mc,gc,xc,yc,wc,Ec,vc,Dc,bc,Ac,Sc,kc;class _c{constructor(t=[]){Yu.set(this,[]),Rt(this,Yu,t,"f")}get length(){return Pt(this,Yu,"f").length}get top(){return Pt(this,Yu,"f")[Pt(this,Yu,"f").length-1]}push(t){Pt(this,Yu,"f").push(t)}pop(){return function(t){if(void 0===t)throw new Error;return t}(Pt(this,Yu,"f").pop())}}Yu=new WeakMap,function(t){t[t.idle=0]="idle",t[t.string=1]="string",t[t.escape=2]="escape",t[t.comment=3]="comment",t[t.vector=4]="vector",t[t.list=5]="list",t[t.map=6]="map",t[t.set=7]="set",t[t.tag=8]="tag"}(kc||(kc={}));const Fc={t:"\t",r:"\r",n:"\n","\\":"\\",'"':'"'},Cc=[","," ","\t","\n","\r"],Tc=/^[-+]?(0|[1-9][0-9]*)$/,Mc=/^[-+]?(0|[1-9][0-9]*)N$/,Oc=/^[-+]?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?(0|[1-9][0-9]*))?M?$/;function Nc(t){if(Array.isArray(t))return t;throw new Error}function Lc(t){if(Array.isArray(t))return t;throw new Error}function Bc(t,e){if(t===e)return e;throw new Error}function qc(t){if(Array.isArray(t))return t;throw new Error}function Ic(t){if(Pc(t))return t;throw new Error}function Pc(t){if(Array.isArray(t))return!1;if("string"==typeof t)return!1;{const e=t;return!!(Array.isArray(e.entries)&&e.buffer instanceof _c)}}class Rc{constructor(t){tc.add(this),ec.set(this,new _c),nc.set(this,kc.idle),rc.set(this,""),sc.set(this,void 0),ic.set(this,!1),oc.set(this,0),ac.set(this,!1),uc.set(this,void 0),cc.set(this,void 0),lc.set(this,void 0),hc.set(this,void 0),fc.set(this,void 0),pc.set(this,void 0),dc.set(this,void 0),mc.set(this,void 0),gc.set(this,void 0),xc.set(this,void 0),yc.set(this,void 0),wc.set(this,void 0),Ec.set(this,void 0),vc.set(this,void 0),Dc.set(this,void 0),Rt(this,uc,t.bigIntAs,"f"),Rt(this,cc,t.booAs,"f"),Rt(this,lc,t.charAs,"f"),Rt(this,hc,t.fltAs,"f"),Rt(this,fc,t.intAs,"f"),Rt(this,pc,t.keywordAs,"f"),Rt(this,dc,t.listAs,"f"),Rt(this,mc,t.mapAs,"f"),Rt(this,gc,t.nilAs,"f"),Rt(this,xc,t.setAs,"f"),Rt(this,yc,t.strAs,"f"),Rt(this,wc,t.symAs,"f"),Rt(this,Ec,t.tagAs,"f"),Rt(this,vc,t.vectorAs,"f"),Rt(this,Dc,t.tagHandlers,"f")}next(t){const e=`(${t})`,n=[];for(let t=0;t<e.length;t++){0===Pt(this,ec,"f").length&&void 0!==Pt(this,sc,"f")&&(n.push(Pt(this,sc,"f")),Rt(this,sc,void 0,"f"));const r=e[t];if(Pt(this,nc,"f")!==kc.idle)if(Pt(this,nc,"f")===kc.string){if("\\"===r){Pt(this,ec,"f").push([Pt(this,nc,"f"),Pt(this,rc,"f"),Pt(this,tc,"m",Sc).call(this,t)]),Rt(this,nc,kc.escape,"f"),Rt(this,rc,"","f");continue}if('"'===r){Rt(this,nc,kc.idle,"f"),Rt(this,sc,Pt(this,yc,"f").call(this,Pt(this,rc,"f"),Pt(this,oc,"f")-1,Pt(this,tc,"m",Sc).call(this,t)+1),"f"),Pt(this,tc,"m",bc).call(this),Rt(this,rc,"","f");continue}Rt(this,rc,Pt(this,rc,"f")+r,"f")}else if(Pt(this,nc,"f")===kc.escape){const t=Fc[r],[e,n,s]=Pt(this,ec,"f").pop();Rt(this,nc,e,"f"),Rt(this,rc,n+t,"f")}else Pt(this,nc,"f")===kc.comment&&"\n"===r&&Rt(this,nc,kc.idle,"f");else{if('"'===r){Pt(this,tc,"m",Ac).call(this,t,'"'),Pt(this,tc,"m",bc).call(this),Rt(this,nc,kc.string,"f"),Rt(this,rc,"","f");continue}if(";"===r){Rt(this,nc,kc.comment,"f");continue}if(Cc.includes(r)){Pt(this,tc,"m",Ac).call(this,t,"spaceChar"),Pt(this,tc,"m",bc).call(this);continue}if("}"===r){if(Pt(this,tc,"m",Ac).call(this,t,"}"),Pt(this,tc,"m",bc).call(this),0!==Pt(this,ec,"f").length){const[e,n,r]=Pt(this,ec,"f").pop(),s=Pt(this,tc,"m",Sc).call(this,t)+1;if(e===kc.map){const t=Ic(n).entries;Rt(this,sc,Pt(this,mc,"f").call(this,t,r,s),"f")}else{Bc(e,kc.set);const t=qc(n);Rt(this,sc,Pt(this,xc,"f").call(this,t,r,s),"f")}}Pt(this,tc,"m",bc).call(this);continue}if("]"===r){Pt(this,tc,"m",Ac).call(this,t,"]"),Pt(this,tc,"m",bc).call(this);const[e,n,r]=Pt(this,ec,"f").pop(),s=Nc(n),i=Pt(this,tc,"m",Sc).call(this,t)+1;Rt(this,sc,Pt(this,vc,"f").call(this,s,r,i),"f"),Pt(this,tc,"m",bc).call(this);continue}if(")"===r){if(Pt(this,tc,"m",Ac).call(this,t,")"),Pt(this,tc,"m",bc).call(this),0===Pt(this,ec,"f").length)return void 0!==Pt(this,sc,"f")&&n.push(Pt(this,sc,"f")),Rt(this,ac,!0,"f"),n;const[e,r,s]=Pt(this,ec,"f").pop(),i=Pt(this,tc,"m",Sc).call(this,t)+1,o=Lc(r);Rt(this,sc,Pt(this,dc,"f").call(this,o,s,i),"f"),Pt(this,tc,"m",bc).call(this);continue}if("["===r){Pt(this,tc,"m",Ac).call(this,t,"["),Pt(this,tc,"m",bc).call(this),Pt(this,ec,"f").push([kc.vector,[],Pt(this,tc,"m",Sc).call(this,t)]);continue}if("("===r){Pt(this,ic,"f")?(Pt(this,tc,"m",Ac).call(this,t,"("),Pt(this,tc,"m",bc).call(this),Pt(this,ec,"f").push([kc.list,[],Pt(this,tc,"m",Sc).call(this,t)])):Rt(this,ic,!0,"f");continue}const e=`${Pt(this,rc,"f")}${r}`;if("#_"===e){Pt(this,ec,"f").push([kc.tag,r,Pt(this,tc,"m",Sc).call(this,t)]),Rt(this,sc,void 0,"f"),Rt(this,rc,"","f");continue}if(e.endsWith("#{")){Rt(this,rc,Pt(this,rc,"f").slice(0,-1),"f"),Pt(this,tc,"m",Ac).call(this,t,"#{"),Pt(this,tc,"m",bc).call(this),Pt(this,ec,"f").push([kc.set,[],Pt(this,tc,"m",Sc).call(this,t)]),Rt(this,rc,"","f");continue}if("{"===r){Pt(this,tc,"m",Ac).call(this,t,"{"),Pt(this,tc,"m",bc).call(this);const e=Pt(this,tc,"m",Sc).call(this,t);Pt(this,ec,"f").push([kc.map,{entries:[],buffer:new _c},e]),Rt(this,rc,"","f");continue}Rt(this,rc,Pt(this,rc,"f")+r,"f")}}return n}isDone(){return Pt(this,ac,"f")}}function Uc(t,e){const n=t.indexOf(e);if(n>0){return[t.substring(n+1),t.substring(0,n)]}return[t,""]}ec=new WeakMap,nc=new WeakMap,rc=new WeakMap,sc=new WeakMap,ic=new WeakMap,oc=new WeakMap,ac=new WeakMap,uc=new WeakMap,cc=new WeakMap,lc=new WeakMap,hc=new WeakMap,fc=new WeakMap,pc=new WeakMap,dc=new WeakMap,mc=new WeakMap,gc=new WeakMap,xc=new WeakMap,yc=new WeakMap,wc=new WeakMap,Ec=new WeakMap,vc=new WeakMap,Dc=new WeakMap,tc=new WeakSet,bc=function t(){if(0===Pt(this,ec,"f").length||void 0===Pt(this,sc,"f"))return;const[e,n,r]=Pt(this,ec,"f").top;if(e===kc.vector)Nc(n).push(Pt(this,sc,"f"));else if(e===kc.list)Lc(n).push(Pt(this,sc,"f"));else if(e===kc.set)qc(n).push(Pt(this,sc,"f"));else if(e===kc.map){const t=Ic(n),e=t.entries,r=t.buffer;r.length>0?e.push([r.pop(),Pt(this,sc,"f")]):r.push(Pt(this,sc,"f"))}else if(e===kc.tag){if(Pt(this,ec,"f").pop(),"_"===n)Rt(this,sc,void 0,"f");else{const t=function(t){if(Pc(t))throw new Error;if("string"==typeof t)return t;throw new Error}(n),e=Pt(this,Dc,"f")[t];if(e)Rt(this,sc,e(Pt(this,sc,"f")),"f");else{const e=t,n=Pt(this,sc,"f");Rt(this,sc,Pt(this,Ec,"f").call(this,e,n,r,0),"f")}}return void Pt(this,tc,"m",t).call(this)}Rt(this,sc,void 0,"f")},Ac=function(t,e){const n=Pt(this,tc,"m",Sc).call(this,t);if("nil"===Pt(this,rc,"f"))Rt(this,sc,Pt(this,gc,"f").call(this,Pt(this,oc,"f"),n),"f");else if("true"===Pt(this,rc,"f"))Rt(this,sc,Pt(this,cc,"f").call(this,!0,Pt(this,oc,"f"),n),"f");else if("false"===Pt(this,rc,"f"))Rt(this,sc,Pt(this,cc,"f").call(this,!1,Pt(this,oc,"f"),n),"f");else if(":"===Pt(this,rc,"f")[0]){const t=Pt(this,rc,"f").substring(1),[e,r]=Uc(t,"/");Rt(this,sc,Pt(this,pc,"f").call(this,e,r,Pt(this,oc,"f"),n),"f")}else if("#"===Pt(this,rc,"f")[0])Pt(this,ec,"f").push([kc.tag,Pt(this,rc,"f").substring(1),Pt(this,tc,"m",Sc).call(this,t)]),Rt(this,sc,void 0,"f");else if(Tc.test(Pt(this,rc,"f")))Rt(this,sc,Pt(this,fc,"f").call(this,parseInt(Pt(this,rc,"f"),10),Pt(this,oc,"f"),n),"f");else if(Oc.test(Pt(this,rc,"f")))Rt(this,sc,Pt(this,hc,"f").call(this,parseFloat(Pt(this,rc,"f")),Pt(this,oc,"f"),n),"f");else if(Mc.test(Pt(this,rc,"f"))){const t=Pt(this,rc,"f").substring(0,Pt(this,rc,"f").length-1);Rt(this,sc,Pt(this,uc,"f").call(this,t,Pt(this,oc,"f"),n),"f")}else if("\\"===Pt(this,rc,"f")[0]){let t;t="\\space"===Pt(this,rc,"f")?" ":"\\newline"===Pt(this,rc,"f")?"\n":"\\return"===Pt(this,rc,"f")?"\r":"\\tab"===Pt(this,rc,"f")?"\t":"\\\\"===Pt(this,rc,"f")?"\\":Pt(this,rc,"f").substring(1),Rt(this,sc,Pt(this,lc,"f").call(this,t,Pt(this,oc,"f"),n),"f")}else if(""!==Pt(this,rc,"f")){const[t,e]=Uc(Pt(this,rc,"f"),"/");Rt(this,sc,Pt(this,wc,"f").call(this,t,e,Pt(this,oc,"f"),n),"f")}Rt(this,rc,"","f"),Rt(this,oc,n+1,"f")},Sc=function(t){return t-1};class $c{parse(t,e,n){const r=parseFloat(t);return new d(r,e,n)}}class zc{parse(t,e,n){const r=t[0];if("+"===r){const r=En(t.substring(1));return new w(r,En.one,e,n)}if("-"===r){const r=En(t.substring(1));return new w(r,En.one,e,n).neg()}const s=En(t);return new w(s,En.one,e,n)}}f("if"),f("nil"),f("false"),f("true"),f("undefined");const Wc=f(":=");function Xc(t){return null!=t&&(""!==t&&/^\d+$/.test(t))}function Kc(t){return null!=t&&(""!==t&&(function(t){return null!=t&&""!==t&&-1===t.search(/[^A-Za-z_]/)}(t)||Xc(t)))}let Hc=class extends Error{constructor(t,e,n){super(`${t} in range [${e}, ${n}]`)}};var Jc;const Gc={fltParser:new $c,intParser:new zc,strParser:new class{parse(t,e,n){return new B(t,e,n)}},symParser:new class{parse(t,e,n){return f(t,e,n)}},lexicon:{"+":t(e.add),"-":t(e.subtract),"*":t(e.multiply),"/":t(e.divide),"^":t(e.outer),"|":t(e.inner),">>":t(e.rco),"<<":t(e.lco),"**":t(e.pow),"<=":t(e.testle),"<":t(e.testlt),">=":t(e.testge),">":t(e.testgt),"!=":t(e.testne),"==":t(e.testeq),":=":Wc,"=":t(e.assign),abs:t(e.abs),cos:t(e.cos),exp:t(e.exp),iscomplex:t(e.iscomplex),isreal:t(e.isreal),not:t(e.not),sin:t(e.sin)},meta:{a:Us,b:$s,x:zs},parse_time_simplifications:!0};class Vc{constructor(t,e,n){this.sourceText=t,this.offset=n,Jc.set(this,void 0),this.meta_mode=!1,Rt(this,Jc,{txt:"",pos:0,end:e},"f"),this.scan_level=0,this.input_str=0}get code(){const t=Pt(this,Jc,"f").code;if(t)return t;throw new Error}peek(t){return this.sourceText.slice(Pt(this,Jc,"f").end,Pt(this,Jc,"f").end+t)}read(t){return new Vc(this.sourceText,Pt(this,Jc,"f").end+t,this.offset)}get done(){return Pt(this,Jc,"f").end===this.sourceText.length}get text(){return Pt(this,Jc,"f").txt}get pos(){return Pt(this,Jc,"f").pos+this.offset}get end(){return Pt(this,Jc,"f").end+this.offset}get scanned(){return Pt(this,Jc,"f").pos-this.input_str}get curr(){return this.sourceText.charAt(Pt(this,Jc,"f").end)}get next(){return this.sourceText[Pt(this,Jc,"f").end+1]}get_token_skip_newlines(){this.scan_level++;try{this.get_token()}finally{this.scan_level--}}get_token(){if(this.get_token_nib(),this.scan_level>0)for(;Pt(this,Jc,"f").code===Au;)this.get_token_nib()}consumeChars(t){Pt(this,Jc,"f").end+=t}currEquals(t){return this.curr===t}expect(t){if(this.code===t)return{pos:this.pos,end:this.end};this.scan_error(`${t.text} expected`)}tokenToFlt(){return Gc.fltParser.parse(Pt(this,Jc,"f").txt,Pt(this,Jc,"f").pos+this.offset,Pt(this,Jc,"f").end+this.offset)}tokenToInt(){return Gc.intParser.parse(Pt(this,Jc,"f").txt,Pt(this,Jc,"f").pos+this.offset,Pt(this,Jc,"f").end+this.offset)}tokenToStr(){return Gc.strParser.parse(Pt(this,Jc,"f").txt,Pt(this,Jc,"f").pos+this.offset,Pt(this,Jc,"f").end+this.offset)}tokenToSym(){const e=Pt(this,Jc,"f").txt,n=Pt(this,Jc,"f").pos+this.offset,s=Pt(this,Jc,"f").end+this.offset;if(this.meta_mode&&"string"==typeof Pt(this,Jc,"f").txt){const t=Gc.meta[e];if(t)return t}if(Gc.lexicon[e])return Gc.lexicon[e].clone(n,s);{const i=f(e,n,s),o=r(i);return-1!==o?t(o).clone(n,s):i}}tokenToKeyword(){const t=Pt(this,Jc,"f").txt.substring(1),[e,n]=Uc(t,"/");return q(e,n,Pt(this,Jc,"f").pos+this.offset,Pt(this,Jc,"f").end+this.offset)}get_token_nib(){for(;null!=(t=this.curr)&&(" "===t||"\t"===t||"\n"===t||"\v"===t||"\f"===t||"\r"===t);){if("\n"===this.curr||"\r"===this.curr)return Pt(this,Jc,"f").code=Au,Pt(this,Jc,"f").pos=Pt(this,Jc,"f").end,void Pt(this,Jc,"f").end++;Pt(this,Jc,"f").end++}var t;if(Pt(this,Jc,"f").pos=Pt(this,Jc,"f").end,Pt(this,Jc,"f").end===this.sourceText.length)return Pt(this,Jc,"f").txt="",void(Pt(this,Jc,"f").code=Hu);if(!function(t,e){if(Xc(t.curr)||"."===t.curr){for(;Xc(t.curr);)t.consumeChars(1);if("."===t.curr){for(t.consumeChars(1);Xc(t.curr);)t.consumeChars(1);if(t.currEquals("e")&&("+"===t.next||"-"===t.next||Xc(t.next)))for(t.consumeChars(2);Xc(t.curr);)t.consumeChars(1);return e.flt(),!0}return e.int(),!0}return!1}(this,{flt:()=>{Pt(this,Jc,"f").code=Eu,this.update_token_text(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end,this.sourceText.substring(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end))},int:()=>{Pt(this,Jc,"f").code=wu,this.update_token_text(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end,this.sourceText.substring(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end))}})){if(null!=(e=this.curr)&&-1===e.search(/[^A-Za-z]/)){for(Pt(this,Jc,"f").code=vu,Pt(this,Jc,"f").end++;Kc(this.curr);)Pt(this,Jc,"f").code=vu,Pt(this,Jc,"f").end++;return"("===this.curr?Pt(this,Jc,"f").code=Du:Pt(this,Jc,"f").code=vu,void this.update_token_text(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end,this.sourceText.substring(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end))}var e;if('"'===this.curr){Pt(this,Jc,"f").end++;let t="",e=!1;for(;'"'!==this.curr;)"\\"===this.curr?e=!0:"n"===this.curr?e?(t+="\n",e=!1):t+=this.curr:"r"===this.curr?e?(t+="\r",e=!1):t+=this.curr:"\n"===this.curr?this.scan_error(`Bad control character in string literal at position ${this.end} ${this.sourceText}`):t+=this.curr,Pt(this,Jc,"f").end===this.sourceText.length-1&&(Pt(this,Jc,"f").end++,this.scan_error("runaway string"),Pt(this,Jc,"f").end--),Pt(this,Jc,"f").end++;return Pt(this,Jc,"f").end++,Pt(this,Jc,"f").code=ku,void this.update_token_text(Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end,t)}if("#"===this.curr||"-"===this.curr&&"-"===this.next){for(;this.curr&&!this.currEquals("\n")&&!this.currEquals("\r");)Pt(this,Jc,"f").end++;return this.curr&&Pt(this,Jc,"f").end++,void(Pt(this,Jc,"f").code=Au)}switch(this.curr){case"*":return"*"===this.next?(Pt(this,Jc,"f").code=Wu,Pt(this,Jc,"f").txt="**",void(Pt(this,Jc,"f").end+=2)):(Pt(this,Jc,"f").txt="*",Pt(this,Jc,"f").code=Nu,void(Pt(this,Jc,"f").end+=1));case":":return"="===this.next?(Pt(this,Jc,"f").code=$u,Pt(this,Jc,"f").txt=":=",void(Pt(this,Jc,"f").end+=2)):(Pt(this,Jc,"f").code=Uu,Pt(this,Jc,"f").txt=":",void(Pt(this,Jc,"f").end+=1));case"=":return"="===this.next?(Pt(this,Jc,"f").code=Pu,Pt(this,Jc,"f").txt="==",void(Pt(this,Jc,"f").end+=2)):(Pt(this,Jc,"f").code=zu,Pt(this,Jc,"f").txt="=",void(Pt(this,Jc,"f").end+=1));case">":switch(this.next){case"=":return Pt(this,Jc,"f").code=_u,Pt(this,Jc,"f").txt=">=",void(Pt(this,Jc,"f").end+=2);case">":return Pt(this,Jc,"f").code=Fu,Pt(this,Jc,"f").txt=">>",void(Pt(this,Jc,"f").end+=2);default:return Pt(this,Jc,"f").code=Ou,Pt(this,Jc,"f").txt=">",void(Pt(this,Jc,"f").end+=1)}case"<":switch(this.next){case"=":return Pt(this,Jc,"f").code=Cu,Pt(this,Jc,"f").txt="<=",void(Pt(this,Jc,"f").end+=2);case"<":return Pt(this,Jc,"f").code=Tu,Pt(this,Jc,"f").txt="<<",void(Pt(this,Jc,"f").end+=2);default:return Pt(this,Jc,"f").code=Mu,Pt(this,Jc,"f").txt="<",void(Pt(this,Jc,"f").end+=1)}case"!":return"="===this.next?(Pt(this,Jc,"f").code=Ru,Pt(this,Jc,"f").txt="!=",void(Pt(this,Jc,"f").end+=2)):(Pt(this,Jc,"f").code=Zu,Pt(this,Jc,"f").txt="!",void(Pt(this,Jc,"f").end+=1));case"(":return this.next,Pt(this,Jc,"f").code=Bu,Pt(this,Jc,"f").txt="(",void(Pt(this,Jc,"f").end+=1);case")":return this.next,Pt(this,Jc,"f").code=qu,Pt(this,Jc,"f").txt=")",void(Pt(this,Jc,"f").end+=1);case",":return this.next,Pt(this,Jc,"f").code=Ju,Pt(this,Jc,"f").txt=",",void(Pt(this,Jc,"f").end+=1);case"[":return this.next,Pt(this,Jc,"f").code=Gu,Pt(this,Jc,"f").txt="[",void(Pt(this,Jc,"f").end+=1);case"]":return this.next,Pt(this,Jc,"f").code=Vu,Pt(this,Jc,"f").txt="]",void(Pt(this,Jc,"f").end+=1);case"{":return this.next,Pt(this,Jc,"f").code=ju,Pt(this,Jc,"f").txt="{",void(Pt(this,Jc,"f").end+=1);case"}":return this.next,Pt(this,Jc,"f").code=Qu,Pt(this,Jc,"f").txt="}",void(Pt(this,Jc,"f").end+=1)}if("+"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=Su,void(Pt(this,Jc,"f").end+=1);if("-"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=bu,void(Pt(this,Jc,"f").end+=1);if("^"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=Xu,void(Pt(this,Jc,"f").end+=1);if("|"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=Ku,void(Pt(this,Jc,"f").end+=1);if("/"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=Lu,void(Pt(this,Jc,"f").end+=1);if("·"===this.curr)return Pt(this,Jc,"f").txt=this.curr,Pt(this,Jc,"f").code=Iu,void(Pt(this,Jc,"f").end+=1);throw Pt(this,Jc,"f").txt=this.sourceText[Pt(this,Jc,"f").end++],new Error(`text = ${Pt(this,Jc,"f").txt}`)}}update_token_text(t,e,n){Pt(this,Jc,"f").txt=n}scan_error(t){throw new Hc(t,Pt(this,Jc,"f").pos,Pt(this,Jc,"f").end)}tokenCharCode(){const t=this.munge(Pt(this,Jc,"f"));if("string"==typeof t)return t.charCodeAt(0)}munge(t){const e=t.code;return"object"==typeof e&&"number"==typeof e.code?e.code:t.txt}get parse_time_simplifications(){return Gc.parse_time_simplifications}}function jc(n){return c(n)||l(n)?n.isZero()?Xt(Kt.Division_by_zero):n.inv():At(t(e.pow).clone(n.pos,n.end),n,m)}Jc=new WeakMap;const Qc=t(e.multiply);function Zc(t){return c(t)||sn(t)?t.neg():At(Qc.clone(t.pos,t.end),Nn,t)}const Yc=t(e.assign),tl=t(e.factorial),el=t(e.inner),nl=t(e.lco),rl=t(e.multiply),sl=t(e.outer),il=t(e.pow),ol=t(e.rco);function al(t){if("number"==typeof t){if(isNaN(t))throw new Error(`pos ${t} is not a number.`);return t}return Number.MAX_SAFE_INTEGER}function ul(t){if("number"==typeof t){if(isNaN(t))throw new Error(`end ${t} is not a number.`);return t}return Number.MIN_SAFE_INTEGER}const cl=t(e.component);function ll(t,e,n){const r=new Vc(t,0,e);if(r.get_token_skip_newlines(),r.code===Hu)return[0,kt];const s=dl(r,n);return[r.scanned,s]}function hl(t,e){const n=new Vc(t,0,0);return n.meta_mode=!0,n.get_token(),n.code===Hu?kt:dl(n,e)}function fl(t){return t===$u}function pl(t){return fl(t)||function(t){return t===zu}(t)}function dl(t,e){const n=function(t,e){return t};let r=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;const i=ml(t,e);if(r=Math.min(al(i.pos),r),s=Math.max(ul(i.end),s),pl(t.code)){const o=t.tokenToSym();r=Math.min(al(o.pos),r),s=Math.max(ul(o.end),r);const a=fl(t.code);t.get_token_skip_newlines();const u=ml(t,e);if(r=Math.min(al(u.pos),r),s=Math.max(ul(u.end),s),a){const t=At(fs.clone(o.pos,o.end),u);return n(Ot(r,s,Yc.clone(o.pos,o.end),i,t))}return n(Ot(r,s,Yc.clone(o.pos,o.end),i,u))}return n(i)}function ml(t,e){const n=function(t,e){return t};let r=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;const i=xl(t,e);if(r=Math.min(al(i.pos),r),s=Math.max(ul(i.end),s),function(t){switch(t){case Pu:case Ru:case Cu:case _u:case Mu:case Ou:return!0;default:return!1}}(t.code)){const o=t.tokenToSym();r=Math.min(al(o.pos),r),s=Math.max(ul(o.end),s),t.get_token_skip_newlines();const a=xl(t,e);r=Math.min(al(a.pos),r),s=Math.max(ul(a.end),s);return n(Ot(r,s,o,i,a))}return n(i)}function gl(t){switch(t){case Su:case bu:return!0;default:return!1}}function xl(n,r){return r.explicitAssocAdd?function(n,r){const s=function(t,e){return t};let i=El(n,r);for(;gl(n.code);)switch(n.code){case Su:{const s=xu(t(e.add),n.tokenToSym());n.get_token(),i=At(s,i,El(n,r));break}default:{gu(n.code,bu);const s=xu(t(e.add),n.tokenToSym());n.get_token(),i=At(s,i,Zc(El(n,r)));break}}return s(i)}(n,r):function(n,r){const s=[t(e.add)];let i=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;switch(n.code){case Su:{const t=n.tokenToSym();i=Math.min(al(t.pos),i),o=Math.max(ul(t.end),o),n.get_token_skip_newlines();const e=El(n,r);i=Math.min(al(e.pos),i),o=Math.max(ul(e.end),o),s.push(e);break}case bu:{const t=n.tokenToSym();i=Math.min(al(t.pos),i),o=Math.max(ul(t.end),o),n.get_token_skip_newlines();const e=El(n,r);i=Math.min(al(e.pos),i),o=Math.max(ul(e.end),o);const a=yl(e);a.pos=al(e.pos),a.end=al(e.end),s.push(a);break}default:{const t=El(n,r);i=Math.min(al(t.pos),i),o=Math.max(ul(t.end),o),s.push(t)}}for(;n.code===Su||n.code===bu;)if(n.code===Su){const t=n.tokenToSym();i=Math.min(al(t.pos),i),o=Math.max(ul(t.end),o),n.get_token_skip_newlines();const e=El(n,r);i=Math.min(al(e.pos),i),o=Math.max(ul(e.end),o),s.push(e)}else{const t=n.tokenToSym();i=Math.min(al(t.pos),i),o=Math.max(ul(t.end),o),n.get_token_skip_newlines();const e=El(n,r);i=Math.min(al(e.pos),i),o=Math.max(ul(e.end),o),s.push(yl(e))}if(2===s.length){const t=s[1];return t.pos=al(i),t.end=ul(o),t}return Ot(i,o,...s)}(n,r)}function yl(t){return D(t)?t.neg():Ot(al(t.pos),ul(t.end),rl,t,m)}function wl(t){switch(t){case Nu:case Lu:return!0}return!1}function El(t,e){return e.explicitAssocMul?function(t,e){const n=function(t,e){return t};let r=Dl(t,e);for(;wl(t.code);)switch(t.code){case Nu:{const n=xu(rl,t.tokenToSym());t.get_token(),r=At(n,r,Dl(t,e));break}case Lu:if(c(r)&&r.isOne()){t.get_token();const n=Dl(t,e);try{r=jc(n)}finally{n.release()}}else{const n=xu(rl,t.tokenToSym());t.get_token();const s=Dl(t,e);try{const t=jc(s);r=At(n,r,t),t.release()}finally{s.release()}}break;default:throw new Error(`${JSON.stringify(t)}`)}return n(r)}(t,e):function(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;const s=Dl(t,e);try{n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r);const i=new mu;try{for(i.push(s);wl(t.code);)if(t.code===Nu){t.get_token_skip_newlines();const s=Dl(t,e);try{n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),i.push(s)}finally{s.release()}}else if(t.code===Lu){vl(i),t.get_token_skip_newlines();const s=Dl(t,e);try{n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r);const t=jc(s);i.push(t),t.release()}finally{s.release()}}else{const s=Dl(t,e);try{n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),i.push(s)}finally{s.release()}}if(0===i.length)return S;if(1==i.length){const t=i.pop();return t.pos=al(n),t.end=ul(r),t}{const t=[];try{for(;i.length>0;){const e=i.pop();t.push(e)}return t.reverse(),Ot(n,r,rl,...t)}finally{for(let e=0;e<t.length;e++)t[e].release();t.length=0}}}finally{i.release()}}finally{s.release()}}(t,e)}function vl(t){if(t.length>0){const e=t.peek(t.length-1);try{c(e)&&e.isOne()&&t.pop().release()}finally{e.release()}}}function Dl(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,s=bl(t,e);for(n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r);i=t.code,o=e.useCaretForExponentiation,i===Xu&&!o;){const i=xu(sl,t.tokenToSym());n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),t.get_token();const o=bl(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),s=At(i,s,o),s.pos=al(n),s.end=ul(r)}var i,o;return s.pos=al(n),s.end=ul(r),s}function bl(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,s=Al(t,e);for(n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r);(i=t.code)===Tu||i===Fu||i===Ku||i===Iu;)switch(t.code){case Tu:{const i=xu(nl,t.tokenToSym());t.get_token();const o=Al(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),s=At(i,s,o),s.pos=al(n),s.end=ul(r);break}case Fu:{const i=xu(ol,t.tokenToSym());t.get_token();const o=Al(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),s=At(i,s,o),s.pos=al(n),s.end=ul(r);break}case Ku:{const i=xu(el,t.tokenToSym());t.get_token();const o=Al(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),s=At(i,s,o),s.pos=al(n),s.end=ul(r);break}default:{t.expect(Iu);const i=xu(el,t.tokenToSym());t.get_token();const o=Al(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),s=At(i,s,o),s.pos=al(n),s.end=ul(r);break}}var i;return s.pos=al(n),s.end=ul(r),s}function Al(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;const s=[],i=Sl(t,e);for(n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),s.push(i);o=t.code,e.useCaretForExponentiation?o===Xu:o===Wu;){s.push(t.tokenToSym()),t.get_token();const i=Sl(t,e);n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),s.push(i)}for(var o;s.length>0;){const t=s.pop();if(!(s.length>0))return t.pos=al(n),t.end=ul(r),t;{const e=I(s.pop()),n=s.pop();s.push(At(xu(il,e),n,t))}}throw new Error}function Sl(t,e){switch(t.code){case Su:{let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const i=Sl(t,e);return n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),i.pos=al(n),i.end=ul(r),i}case bu:{let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const i=Sl(t,e);return n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),i.pos=al(n),i.end=ul(r),Zc(i)}default:return function(t,e){const n=t.code;return n===Bu?e.useParenForTensors?Bl(t,e):Nl(t,e):function(t,e){let n=al(Number.MAX_SAFE_INTEGER),r=ul(Number.MIN_SAFE_INTEGER);const s=function(t,e){const n=t.code;if(n===Bu)return e.useParenForTensors?[!1,Bl(t,e)]:[!1,Nl(t,e)];if(n===vu){if("true"===t.text){t.pos,t.end;const e=new E(!0,al(t.pos),ul(t.end));return t.get_token(),[!1,e]}if("false"===t.text){const e=new E(!1,al(t.pos),ul(t.end));return t.get_token(),[!1,e]}return[!1,Tl(t)]}if(n===Du)return[!1,Ml(t,e)];if(n===Gu&&!e.useParenForTensors)return[!1,Bl(t,e)];if(n===ju)return[!1,Ll(t,e)];if(n===wu)return[!0,_l(t)];if(n===Eu)return[!0,kl(t)];if(n===ku)return[!1,Fl(t)];t.scan_error(`Unexpected token ${JSON.stringify(n.text)}`)}(t,e),i=s[0];let o=s[1];n=al(Math.min(al(o.pos),n)),r=ul(Math.max(ul(o.end),r));for(;t.code===Gu||t.code===Bu&&!i;)t.code===Gu?(o=Cl(o,t,e),n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r)):t.code===Bu&&(o=Ol(o,t,e),n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r));for(;t.code===Zu;)t.get_token(),o=At(tl,o);for(;t.tokenCharCode()===ni;)t.get_token(),o=At(Ms,o);return o.pos=al(n),o.end=ul(r),o}(t,e)}(t,e)}}function kl(t){const e=t.tokenToFlt();return t.get_token(),e}function _l(t){const e=t.tokenToInt();return t.get_token(),e}function Fl(t){const e=t.tokenToStr();return t.get_token(),e}function Cl(t,e,n){let r=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;e.expect(Gu);const i=e.tokenToSym();r=Math.min(al(i.pos),r),s=Math.max(ul(i.end),s),e.get_token();const o=[cl,t];if(e.code!==Vu){const t=xl(e,n);for(r=Math.min(al(t.pos),r),s=Math.max(ul(t.end),s),o.push(t);e.code===Ju;){e.expect(Ju);const t=e.tokenToSym();r=Math.min(al(t.pos),r),s=Math.max(ul(t.end),s),e.get_token();const i=xl(e,n);r=Math.min(al(i.pos),r),s=Math.max(ul(i.end),s),o.push(i)}}e.expect(Vu);const a=e.tokenToSym();return r=Math.min(al(a.pos),r),s=Math.max(ul(a.end),s),e.get_token(),Ot(al(r),ul(s),...o)}function Tl(t){t.expect(vu);const e=t.tokenToSym();return t.get_token(),e}function Ml(t,e){t.expect(Du);let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r);const i=[s];t.get_token(),t.expect(Bu);const o=t.tokenToSym();if(n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),t.get_token(),t.code!==qu)for(i.push(dl(t,e));t.code===Ju;){t.expect(Ju);const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const o=dl(t,e);n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),i.push(o)}t.expect(qu);const a=t.tokenToSym();return n=Math.min(al(a.pos),n),r=Math.max(ul(a.end),r),t.get_token(),Ot(al(n),ul(r),...i)}function Ol(t,e,n){let r=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;const i=[t];e.expect(Bu);const o=e.tokenToSym();if(r=Math.min(al(o.pos),r),s=Math.max(ul(o.end),s),e.get_token(),e.code!==qu){const t=dl(e,n);for(r=Math.min(al(t.pos),r),s=Math.max(ul(t.end),s),i.push(t);e.code===Ju;){e.expect(Ju);const t=e.tokenToSym();r=Math.min(al(t.pos),r),s=Math.max(ul(t.end),s),e.get_token();const o=dl(e,n);r=Math.min(al(o.pos),r),s=Math.max(ul(o.end),s),i.push(o)}}e.expect(qu);const a=e.tokenToSym();return r=Math.min(al(a.pos),r),s=Math.max(ul(a.end),s),e.get_token(),Ot(al(r),al(s),...i)}function Nl(t,e){t.expect(Bu),t.get_token();const n=dl(t,e);return t.expect(qu),t.get_token(),n}function Ll(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;t.expect(ju);const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const i=[];if(t.code!=Qu){const s=I(Tl(t));n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),i.push(q(s.localName,s.namespace,s.pos,s.end)),t.expect(Uu);const o=t.tokenToSym();n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),t.get_token();const a=dl(t,e);for(n=Math.min(al(a.pos),n),r=Math.max(ul(a.end),r),i.push(a);t.code===Ju;){t.expect(Ju);const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const o=I(Tl(t));n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),i.push(q(o.localName,o.namespace,o.pos,o.end)),t.expect(Uu);const a=t.tokenToSym();n=Math.min(al(a.pos),n),r=Math.max(ul(a.end),r),t.get_token();const u=dl(t,e);n=Math.min(al(u.pos),n),r=Math.max(ul(u.end),r),i.push(u)}}t.expect(Qu);const o=t.tokenToSym();n=Math.min(al(o.pos),n),r=Math.max(ul(o.end),r),t.get_token();const a=[],u=i.length/2;for(let t=0;t<u;t++){const e=i[2*t],n=i[2*t+1];a.push([e,n])}return new R(a,al(n),ul(r))}function Bl(t,e){let n=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;e.useParenForTensors?t.expect(Bu):t.expect(Gu);const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const i=dl(t,e);n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r);const o=[i];for(;t.code===Ju;){const s=t.tokenToSym();n=Math.min(al(s.pos),n),r=Math.max(ul(s.end),r),t.get_token();const i=dl(t,e);n=Math.min(al(i.pos),n),r=Math.max(ul(i.end),r),o.push(i)}e.useParenForTensors?t.expect(qu):t.expect(Vu);const a=t.tokenToSym();return n=Math.min(al(a.pos),n),r=Math.max(ul(a.end),r),t.get_token(),P(o,al(n),ul(r))}const ql=t(e.exp);function Il(t,e){const n=At(ql,t);try{return e.valueOf(n)}finally{n.release()}}function Pl(t,e){return je(Rl,t,e)}function Rl(t,e){const n=function(t,e){return t},r=Pi(t,Js),s=Pi(t,Gs),i=Pi(t,Vs),o=Pi(t,js),a=Pi(t,Qs);if(!r||s||i||o||a){if(r||!s||i||o||a){if(r||s||!i||o||a){if(r||s||i||!o||a){if(r||s||i||o||!a){if(_t(t)&&!Ft(t).equals(Wr)){const r=At(Ft(t),...t.tail().map((function(t){return Pl(t,e)})));return n(r)}return n(t)}return n($l(t,Qs,e))}return n($l(t,js,e))}return n($l(t,Vs,e))}return n($l(t,Gs,e))}return n($l(t,Js,e))}function Ul(t,e,n){return Pi(t,e)?$l(t,e,n):_t(t)?At(Ft(t),...t.tail().map((t=>Ul(t,e,n)))):t}function $l(t,e,n){const r=Bo(t,e,n),s=[];for(let t=r.length-1;t>=0;t--){const i=zl(t,r[t],e,n);s.push(...i)}if(s.length>1)return Tt(er,At(...s));if(s.length>0)return s[0];throw new go}function zl(t,e,n,r){if(bo(e,r))return[];if(0===t)return _t(e)&&pi(e)?e.tail():[e];const s=[];return di(e)?s.push(...e.tail()):Gi(e,1)||s.push(e),1===t?s.push(n):s.push(At(us,n,x(t))),s.length>1?[At(ss,...s)]:s}function Wl(t,e){if(c(t)){if(c(e))return t.mul(e);return ve(t.toNumber()*e.d)}if(c(e)){return ve(t.d*e.toNumber())}return t.mul(e)}function Xl(t,e){if(c(t)){if(c(e))return t.add(e);return ve(t.toNumber()+e.d)}if(c(e)){return ve(t.d+e.toNumber())}return t.add(e)}function Kl(n,r){const s=function(n,r){const s=n.map((function(t,e){return{value:t,index:e}})),i=r.compareFn(t(e.add));s.sort((function(t,e){return i(t.value,e.value)}));const o=s.map((function(t){return t.value}));return o}(n,r);return function(t,e){let n=0,r=_;for(;n<t.length-1;){const s=t[n],i=t[n+1];if(b(s)&&b(i)){const r=ao(e,s,i);kt!==r&&(t.splice(n,2,r),n--),n++;continue}if(b(s)||b(i)){n++;continue}if(D(s)&&D(i)){const o=Xl(s,i);bo(o,e)?(r=Wl(r,o),t.splice(n,2)):t.splice(n,2,o),n--,n++;continue}if(D(s)||D(i)){n++;continue}const o=Hl(s),a=o.denorm,u=o.lhs,c=o.rhs,l=Hl(i),h=l.lhs,f=l.rhs;if(!c.equals(f)){n++;continue}const p=Xl(u,h);if(bo(p,e)){t.splice(n,2),n--,n++;continue}const d=c,m=Zn(e,p,a?Tt(Ne,Mt(d)):d);t.splice(n,2,m),n--,n++}return t.length>0?t.length>1?Tt(Ce,At(...t)):t[0]:r}(s,r)}function Hl(t){if(_t(t)&&di(t)){const e=t.cdr,n=Ft(e);if(D(n)){const t=Ct(e);if(Ct(t).isnil){return{denorm:!1,lhs:n,rhs:Ft(t)}}return{denorm:!0,lhs:n,rhs:t}}return{denorm:!0,lhs:S,rhs:e}}return{denorm:!1,lhs:S,rhs:t}}function Jl(t,e,n){if(_t(e)&&pi(e)){e.tail().forEach((function(e){Jl(t,e,n)}))}else bo(e,n)?n.getDirective(ie.keepZeroTermsInSums)&&t.push(e):t.push(e)}function Gl(t,e){const n=[];for(const r of t)Jl(n,r,e);return Kl(n,e)}function Vl(t,e,n,r){if(!e.contains(n))return[e];if(pi(e))return function(t,e,n,r){let s=Ct(e);const i=[];for(;_t(s);)(Ft(s).contains(n)||t)&&i.push(...Vl(t,Ft(s),n,r)),s=Ct(s);const o=Mt(Ct(e)),a=[...o].filter((t=>!t.contains(n)));if(a.length){const t=Gl(a,r);c=t,(u=i).length>0&&c.equals(u[u.length-1])||u.push(c),i.push(Yn(r,t))}var u,c;return i}(t,e,n,r);if(di(e))return function(t,e,n,r){let s=Ct(e);const i=[];for(;_t(s);)(Ft(s).contains(n)||t)&&i.push(...Vl(t,Ft(s),n,r)),s=Ct(s);s=Ct(e);const o=[];for(;_t(s);){const t=Ft(s);t.contains(n)||(o.length<1||!t.equals(o[o.length-1]))&&o.push(t),s=Ct(s)}o.length>0&&i.push(no(o,r));return i}(t,e,n,r);let s=Ct(e);const i=[];for(;_t(s);)i.push(...Vl(t,Ft(s),n,r)),s=Ct(s);return i}function jl(t,e,n,r,s){const i=function(t){return{METAA:t.getBinding(Us,kt),METAB:t.getBinding($s,kt),METAX:t.getBinding(zs,kt)}}(s);try{s.setBinding(zs,e);const i=Vl(r,Ul(t,e,s),e,s);let o=!1,a=kt;if(r);else for(const e of function(t){if(Array.isArray(t))return t;throw new Error}(n))if(e){const n=Nt(hl(e,{useCaretForExponentiation:!1,useParenForTensors:!1,explicitAssocAdd:!1,explicitAssocMul:!1,explicitAssocExt:!1}));try{const e=n.argList;try{const u=e.head;try{a=Ai(e);const c=Ct(Ct(Ct(n)));if(Ql([S,...i],r,t,u,c,s)){o=!0;break}}finally{u.release()}}finally{e.release()}}finally{n.release()}}if(o){return[s.valueOf(a),o]}return[r?t:kt,o]}finally{!function(t,e){e.setBinding(zs,t.METAX),e.setBinding($s,t.METAB),e.setBinding(Us,t.METAA)}(i,s)}}function Ql(t,e,n,r,s,i){for(const e of t){i.setBinding(Us,e);for(const e of t){i.setBinding($s,e);let t=s;for(;_t(t);){if(bo(i.valueOf(t.head),i))break;t=t.cdr}if(_t(t))continue;const o=i.valueOf(r);i.pushDirective(ie.expandPowSum,1);try{if(bo(mo(i,n,o),i))return!0}finally{i.popDirective()}}}return!1}function Zl(t,e){U(t);if(kx(t)){const n=t.copyElements();return n.every((t=>D(t)))?function(t,e){const n=t.dim(0),r=t.copyElements(),s=function(t,e,n){let r=S;for(let s=0;s<e-1;s++){if(vo(th(t,e,s,s),_,n)){let i=0;for(i=s+1;i<e&&vo(th(t,e,i,s),_,n);i++);if(i===e){r=_;break}for(let n=s;n<e;n++){const r=th(t,e,s,n);eh(t,e,s,n,th(t,e,i,n)),eh(t,e,i,n,r)}r=Yn(n,r)}r=Zn(n,r,th(t,e,s,s));for(let r=s+1;r<e;r++){const i=Yn(n,lo(th(t,e,r,s),th(t,e,s,s),n));eh(t,e,r,s,_);for(let o=s+1;o<e;o++){eh(t,e,r,o,ao(n,Zn(n,th(t,e,s,o),i),th(t,e,r,o)))}}}return Zn(n,r,th(t,e,e-1,e-1))}(r,n,e);return s}(t,e):Yl(n,t.dim(0),e)}return At(Sr,t)}function Yl(t,e,n){if(0===e)return S;let r=0;const s=[];for(let t=0;t<e;t++)s[t]=t,s[t+e]=0,s[t+e+e]=1;let i=1,o=_;for(;;){let a=x(i);for(let r=0;r<e;r++){a=Zn(n,a,t[e*s[r]+r])}o=ao(n,o,a);let u=e-1,c=0,l=!1;for(;;)if(r=s[e+u]+s[e+e+u],r<0)s[e+e+u]=-s[e+e+u],u--;else{if(r!==u+1)break;if(0===u){l=!0;break}c++,s[e+e+u]=-s[e+e+u],u--}if(l)break;const h=s[u-s[e+u]+c];s[u-s[e+u]+c]=s[u-r+c],s[u-r+c]=h,s[e+u]=r,i=1===i?-1:1}return o}function th(t,e,n,r){return t[e*n+r]}function eh(t,e,n,r,s){t[e*n+r]=s}var nh;class rh{constructor(t,e){this.env=t,this.ctrl=e,nh.set(this,1),this.env.addRef()}addRef(){var t;Rt(this,nh,(t=Pt(this,nh,"f"),++t),"f")}release(){var t;Rt(this,nh,(t=Pt(this,nh,"f"),--t),"f"),0===Pt(this,nh,"f")&&this.env.release()}hasState(t){return this.env.hasState(t)}getState(t){return this.env.getState(t)}setState(t,e){this.env.setState(t,e)}clearBindings(){this.env.clearBindings()}compareFn(t){return this.ctrl.compareFn(t)}executeProlog(t){this.env.executeProlog(t)}getDirective(t){return this.ctrl.getDirective(t)}pushDirective(t,e){this.ctrl.pushDirective(t,e)}popDirective(){this.ctrl.popDirective()}handlerFor(t){return this.env.handlerFor(t)}hasBinding(t,e){return this.env.hasBinding(t,e)}getBinding(t,e){return this.env.getBinding(t,e)}setBinding(t,e){this.env.setBinding(t,e)}hasUserFunction(t){return this.env.hasUserFunction(t)}getUserFunction(t){return this.env.getUserFunction(t)}setUserFunction(t,e){this.env.setUserFunction(t,e)}defineUserSymbol(t){this.env.defineUserSymbol(t)}valueOf(t){const e=new du;try{return e.push(t),wm(this.env,this.ctrl,e),e.pop()}finally{e.release()}}getSymbolPrintName(t){return this.ctrl.getSymbolPrintName(t)}}function sh(t){return li(t,Ne)}function ih(t,e){return sh(t)?oh(t.argList,e):0}function oh(t,e){if(t.isnil)return 0;return e(t.car)?1+oh(t.argList,e):oh(t.argList,e)}function ah(t){return!!M(t)||!(!_t(t)||!sh(t)||1!==ih(t,M))}nh=new WeakMap;const uh=t(e.abs);function ch(t,e){const n=At(uh,t);try{return e.valueOf(n)}finally{n.release()}}const lh=t(e.arg);var hh,fh,ph,dh;function mh(t){return function(e){return function(t,e){const n=function(t,e){const n=At(lh,t);try{return e.valueOf(n)}finally{n.release()}}(t,e),r=ch(t,e);try{return new xh(r,n,t)}finally{n.release(),r.release()}}(e,t)}}function gh(t){return function(e,n){return function(t,e,n){const r=t.arg,s=e.arg;try{switch(n(r,s)){case qt:return qt;case Bt:return Bt;default:{const r=t.mag,s=e.mag;try{return n(r,s)}finally{r.release(),s.release()}}}}finally{r.release(),s.release()}}(e,n,t)}}class xh{constructor(t,e,n){hh.set(this,void 0),fh.set(this,void 0),ph.set(this,void 0),dh.set(this,1),Rt(this,hh,t,"f"),Rt(this,fh,e,"f"),Rt(this,ph,n,"f"),Pt(this,hh,"f").addRef(),Pt(this,fh,"f").addRef(),Pt(this,ph,"f").addRef()}get mag(){return Pt(this,hh,"f").addRef(),Pt(this,hh,"f")}get arg(){return Pt(this,fh,"f").addRef(),Pt(this,fh,"f")}get orig(){return Pt(this,ph,"f").addRef(),Pt(this,ph,"f")}toString(){return l(Pt(this,hh,"f"))&&l(Pt(this,fh,"f"))?`(${Pt(this,hh,"f").d}, ${Pt(this,fh,"f").d})`:`(${Pt(this,hh,"f")}, ${Pt(this,fh,"f")})`}addRef(){var t;Rt(this,dh,(t=Pt(this,dh,"f"),++t),"f")}release(){var t;Rt(this,dh,(t=Pt(this,dh,"f"),--t),"f"),0===Pt(this,dh,"f")&&(Pt(this,hh,"f").release(),Pt(this,fh,"f").release(),Pt(this,ph,"f").release())}}function yh(t,e,n){const r=t.argList;try{const s=r.map((t=>n.valueOf(t)));try{const r=t.opr,i=t.argList;try{if(s.equals(i))return e(i,n);{const t=Tt(r,s);try{return n.valueOf(t)}finally{t.release()}}}finally{r.release(),i.release()}}finally{s.release()}}finally{r.release()}}function wh(t){return t instanceof B}function Eh(t,e){if("boolean"!=typeof t)throw new Error(`The value parameter (${JSON.stringify(t)}) must be a boolean.`);return e.getDirective(ie.useIntegersForPredicates)?t?Dn:vn:t?$:z}function vh(t,e){return!(bt(n=t)||!c(n)&&!l(n)&&!v(n));var n}hh=new WeakMap,fh=new WeakMap,ph=new WeakMap,dh=new WeakMap;const Dh=t(e.grade);function bh(t,e,n){if(St(t)){const r=n.handlerFor(t),s=At(x(e));try{return r.dispatch(t,Dh,s,n)}finally{s.release()}}if(M(t)){return t.extractGrade(e)}if(v(t))return 0===e?t:_;if(l(t))return 0===e?t:_;if(c(t))return 0===e?t:_;if(_t(t)&&Lo(t)){const r=t.lhs,s=t.rhs;if(vh(r))return Zn(n,r,bh(s,e,n));if(vh(s))return Zn(n,bh(r,e,n),s);throw new Error(`extractGrade ${r} * ${s}`)}throw new Error(`extractGrade(arg => ${t}, grade => ${e}) function not implemented.`)}function Ah(t,e,n){return jn(e,n)?t:Tt(Ne,At(t,e))}class Sh{constructor(t,e){this.dimensions=t,this.$=e}get"ε"(){return X(1e-6)}get one(){return S}get zero(){return _}abs(){throw new Error("abs Method not implemented.")}add(t,e){if(jn(t,this.$)){if(jn(e,this.$))return x(2);throw new Error("add Method not implemented.")}throw new Error("add Method not implemented.")}sub(t,e){throw new Error("sub Method not implemented.")}eq(t,e){throw new Error("eq Method not implemented.")}ne(t,e){throw new Error("ne Method not implemented.")}le(t,e){throw new Error("le Method not implemented.")}lt(t,e){throw new Error("lt Method not implemented.")}ge(t,e){throw new Error("ge Method not implemented.")}gt(t,e){throw new Error("gt Method not implemented.")}max(t,e){throw new Error("max Method not implemented.")}min(t,e){throw new Error("min Method not implemented.")}mul(t,e){return Zn(this.$,t,e)}div(t,e){throw new Error("div Method not implemented.")}neg(t){if(c(t))return t.neg();throw new Error(`neg ${t} Method not implemented.`)}asString(t){throw new Error("asString Method not implemented.")}cos(t){throw new Error("cos Method not implemented.")}isField(t){if(c(t))return!0;if(l(t))return!0;if(M(t))return!1;throw new Error("isField method not implemented.")}isOne(t){throw new Error("isOne Method not implemented.")}isZero(t){return bo(t,this.$)}sin(t){throw new Error("sin Method not implemented.")}sqrt(t){throw new Error("sqrt Method not implemented.")}isDimension(t){throw new Error("isDimension Method not implemented.")}dim(t){throw new Error("dim Method not implemented.")}sum(t){if(1===t.length){const e=t[0],n=e.weight,r=e.blade;return Zn(this.$,n,r)}if(2===t.length){const e=Ah(t[0].blade,t[0].weight,this.$),n=Ah(t[1].blade,t[1].weight,this.$);return Tt(Ce,At(e,n))}throw new Error(`sum of ${t.length} terms Method not implemented.`)}extractGrade(t,e){return bh(t,e,this.$)}treeAdd(t,e){throw new Error("treeAdd Method not implemented.")}treeLco(t,e){if(M(t)&&M(e))return t.lshift(e);throw new Error(`treeLco(lhs=${t}, rhs=${e}) Method not implemented.`)}treeMul(t,e){throw new Error("treeMul Method not implemented.")}treeScp(t,e){throw new Error("treeScp Method not implemented.")}treeSqrt(t){throw new Error("treeSqrt Method not implemented.")}treeZero(){return _}scalarCoordinate(t){throw new Error("scalarCoordinate Method not implemented.")}bladeToTree(t){return t}weightToTree(t){return t}}function kh(t,e,n){const r=new Sh(t.length,n),s=W(t,r,e),i=t.length,o=new Array(i);for(let t=0;t<i;t++)o[t]=s.unit(t);return o}function _h(t,e,n,r){const s=t.argList;try{const t=s.head;try{r.push(t),wm(e,n,r);let i=s.rest;try{for(;_t(i);){const t=i.head;try{r.push(t),wm(e,n,r),Fh(e,n,r);const s=i.rest;i.release(),i=s}finally{t.release()}}}finally{i.release()}}finally{t.release()}}finally{s.release()}}function Fh(t,e,n){const r=n.pop(),s=n.pop();try{if(!qm(s)||!qm(r))return n.push(s),n.push(r),void Um(t,e,n);s.ndim!==r.ndim&&hg("hadamard");const i=s.ndim;for(let t=0;t<i;t++)s.dims[t]!==r.dims[t]&&hg("hadamard");const o=gp(s);try{const i=o.nelem;for(let a=0;a<i;a++)n.push(s.elems[a]),n.push(r.elems[a]),Um(t,e,n),o.elems[a]=n.pop();n.push(o)}finally{o.release()}}finally{s.release(),r.release()}}function Ch(t,e,n){return c(t)?t.equalsRat(y(e,n)):!!l(t)&&t.d===e/n}function Th(t,e){return Ch(t,e,1)}function Mh(t){return Th(t,-1)}function Oh(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),Nh(e,n,r)}function Nh(t,e,n){const r=Jm(n);try{if(St(r)){if(L(r))return void tg(S,n);if(b(r))return void tg(Sd(r,Nh,t,e,n),n)}tg(r,n),zd(t,e,n),Lh(t,e,n),tg(r,n),td(t,e,n),Lh(t,e,n),xp(t,e,n)}finally{r.release()}}function Lh(n,r,s){const i=Jm(s);try{if(St(i)){if(D(i))return tg(i,s),void wp(n,r,s);if(L(i))return void tg(S,s);if(v(i))return void tg(i,s);if(k(i))return void tg(i,s)}if(Ft(i).equals(us)&&Mh(Ai(i)))return void ng(1,s);if(_t(i)&&i.opr.equals(us)&&i.base.equals(t(e.E)))return tg(_i(i),s),Yd(n,r,s),void sd(n,r,s);if(Ft(i).equals(ss)){let t=Ct(i);const e=s.length;for(;_t(t);)tg(Ft(t),s),Nh(n,r,s),t=Ct(t);return void $m(s.length-e,n,r,s)}if(_t(i)&&Ft(i).equals(er)){tg(i,s),em(n,r,s);const t=Jm(s);try{tg(t,s),Yd(n,r,s);const e=Jm(s);try{tg(t,s),gd(n,r,s);const i=Jm(s);try{return tg(e,s),tg(e,s),Um(n,r,s),tg(i,s),tg(i,s),Um(n,r,s),Ep(n,r,s),sg(1,2,s),void Gd(n,r,s)}finally{i.release()}}finally{e.release()}}finally{t.release()}}tg(i,s)}finally{i.release()}}function Bh(t,e,n){const r=[],s=n.length-t;for(let t=0;t<s;t++){const t=n.pop();r.push(t)}r.reverse();for(let t=0;t<s;t++){const s=r[t];try{qh(n,s,e,e)}finally{s.release()}}}function qh(t,e,n,r){if(_t(e)){const s=e.head,i=e.rest;try{if(!v(s))throw new Vt;if(s.equalsSym(n)&&s.equalsSym(r)){const r=e.tail();for(let e=0;e<r.length;e++){const i=r[e];try{qh(t,i,n,s)}finally{i.release()}}}else{const r=t.length;qh(t,s,n,s);const i=e.tail();for(let e=0;e<i.length;e++){const r=i[e];try{qh(t,r,n,s)}finally{r.release()}}const o=t.length;Pm(o-r,t)}}finally{s.release(),i.release()}}else St(e)&&t.push(e)}function Ih(t,e){return t.eq(e)}function Ph(t){if(t.isNegative())return t.negate().toString();return t.toString()}var Rh,Uh;function $h(t){let e=0;for(;_t(t);)e++,t=Ct(t);return e}function zh(t){if(Ft(t).equals(er)){if(3!==$h(t))return!1;if(!l(Ai(t)))return!1;t=_i(t)}return!!Ft(t).equals(ss)&&(3===$h(t)&&(!!l(Ai(t))&&(t=_i(t),!!Ft(t).equals(us)&&(!!Mh(Ai(t))&&!!Ch(_i(t),1,2)))))}function Wh(t){return t.isFraction()}function Xh(t){return t.isInteger()}function Kh(t){return t.isNegative()}function Hh(t){if(D(t)&&t.isNegative())return!0;if(!(_t(t)&&v(t.opr)&&n(t.opr,e.multiply)))return!1;{const e=t.argList;try{const t=e.head;try{return D(t)&&t.isNegative()}finally{t.release()}}finally{e.release()}}}function Jh(t){return Th(t,1)}function Gh(t){return t.isPositiveInteger()}!function(t){t[t.BLACK=1]="BLACK",t[t.BLUE=2]="BLUE",t[t.RED=3]="RED"}(Rh||(Rh={}));class Vh{constructor(t){this.env=t,Uh.set(this,1),this.env.addRef()}addRef(){var t;Rt(this,Uh,(t=Pt(this,Uh,"f"),++t),"f")}release(){var t;Rt(this,Uh,(t=Pt(this,Uh,"f"),--t),"f"),0===Pt(this,Uh,"f")&&this.env.release()}hasState(t){return this.env.hasState(t)}getState(t){return this.env.getState(t)}setState(t,e){this.env.setState(t,e)}getSymbolPrintName(t){throw new Error("Method not implemented.")}handlerFor(t){return this.env.handlerFor(t)}clearBindings(){throw new Error("Method not implemented.")}compareFn(t){throw new Error("Method not implemented.")}executeProlog(t){throw new Error("Method not implemented.")}hasBinding(t,e){throw new Error("Method not implemented.")}getBinding(t,e){throw new Error("Method not implemented.")}setBinding(t,e){throw new Error("Method not implemented.")}hasUserFunction(t){throw new Error("Method not implemented.")}getUserFunction(t){throw new Error("Method not implemented.")}setUserFunction(t,e){throw new Error("Method not implemented.")}defineUserSymbol(t){throw new Error("Method not implemented.")}valueOf(t){throw new Error("Method not implemented.")}getDirective(t){throw new Error("Method not implemented.")}pushDirective(t,e){throw new Error("Method not implemented.")}popDirective(){throw new Error("Method not implemented.")}}function jh(n,r){if(St(n)){return r.handlerFor(n).test(n,t(e.iszero),new Vh(r))}return!1}Uh=new WeakMap;const Qh=t(e.abs),Zh=t(e.arccos),Yh=t(e.arccosh),tf=t(e.arcsin),ef=t(e.arcsinh),nf=t(e.arctan),rf=t(e.arctanh);f("ceiling");const sf=t(e.cos),of=t(e.cosh),af=f("derivative"),uf=f("erf"),cf=f("erfc"),lf=f("expcos"),hf=f("expcosh"),ff=f("expsin"),pf=f("expsinh"),df=f("exptan"),mf=f("exptanh");f("factorial");const gf=f("floor"),xf=f("integral"),yf=t(e.log),wf=f("mod");f("sgn");const Ef=t(e.sin),vf=t(e.sinh),Df=t(e.tan),bf=t(e.tanh);f("testeq"),f("testge"),f("testgt"),f("testle"),f("testlt"),f("tty");const Af=t(e.add),Sf=t(e.multiply),kf=t(e.pow);t(e.component),t(e.assign);const _f=f("last"),Ff=t(e.E),Cf=t(e.PI);f("trace");const Tf=f("d"),Mf=f("x");f("$a"),f("$b"),f("$x");const Of=f("$1"),Nf=f("$2"),Lf=f("$3"),Bf=f("$4"),qf=f("$5"),If=f("$6"),Pf=f("$7"),Rf=f("$8"),Uf=f("$9");function $f(){return new F([],[])}function zf(t,e){const n=$f();return n.dims[0]=t,n.dims[1]=e,n}function Wf(t){const e=$f();return e.dims[0]=t,e}function Xf(t){return new g(BigInt(t))}function Kf(t){return t.isZero()}function Hf(t){return t.isOdd()}function Jf(t){return t.toJSNumber()}const Gf=new g(BigInt(Number.MAX_SAFE_INTEGER)),Vf=new g(BigInt(Number.MIN_SAFE_INTEGER));function jf(t){return!(!t.geq(Vf)||!t.leq(Gf))}function Qf(t,e,n,r){Kf(e)&&(t=1,Ih(n,1)||(n=Xf(1)));tg(new w(t>0?e:e.negate(),n),r)}function Zf(t,e){return t.compare(e)}function Yf(t,e){return t.divide(e)}function tp(t,e){return t.mod(e)}function ep(t,e){if(e.isNegative())throw new Error(`bignum_pow(u=${t}, v=${e}): v must be positive.`);return t.pow(e)}function np(t){return Ft(Ct(Ft(Ct(Ct(t)))))}function rp(t){return Ft(Ct(Ct(Ct(t))))}function sp(t){return Ft(Ct(Ct(t)))}function ip(t){return Ft(Ct(t))}function op(t,e,n){let r=Jm(n);const s=Jm(n);if(Ft(r).equals(Af)){const i=n.length;for(r=Ct(r);_t(r);)tg(s,n),tg(Ft(r),n),Um(t,e,n),r=Ct(r);vp(n.length-i,t,e,n)}else tg(s,n),tg(r,n),Um(t,e,n)}function ap(t){return Ct(Ct(t))}function up(t,e){if(t===e)return It;if(t.isnil)return qt;if(e.isnil)return Bt;if(D(t)&&D(e))return function(t,e){if(c(t)&&c(e))return t.compare(e);const n=Gm(t),r=Gm(e);if(n<r)return qt;if(n>r)return Bt;return It}(t,e);if(D(t))return qt;if(D(e))return Bt;if(h(t)&&h(e))return cp(t.str,e.str);if(h(t))return qt;if(h(e))return Bt;if(v(t)&&v(e))return t.compare(e);if(v(t))return qt;if(v(e))return Bt;if(b(t)&&qm(e))return function(t,e){const n=t.ndim-e.ndim;if(n)return n>0?1:n<0?-1:0;for(let n=0;n<t.ndim;n++){const r=t.dims[n]-e.dims[n];if(r)return r>0?1:r<0?-1:0}for(let n=0;n<t.nelem;n++){const r=up(t.elems[n],e.elems[n]);if(r)return r}return 0}(t,e);if(b(t))return qt;if(b(e))return Bt;for(;_t(t)&&_t(e);){const n=up(Ft(t),Ft(e));if(n)return n;t=Ct(t),e=Ct(e)}return _t(e)?qt:_t(t)?Bt:k(t)&&k(e)?cp(t.toString(),e.toString()):k(t)?qt:k(e)?Bt:It}function cp(t,e){return t<e?-1:t>e?1:0}function lp(t,e,n,r){!function(t,e){const n=(t,e)=>{return r=e,_t(n=t)&&n.opr.equals(kf)&&(n=n.base),_t(r)&&r.opr.equals(kf)&&(r=r.base),up(n,r);var n,r},r=e.splice(t),s=r.sort(n);e.concat(s)}(t,r);let s=r.length;for(let i=t;i<s-1;i++)hp(i,i+1,e,n,r)&&(r.splice(i+1,1),i--,s--)}function hp(t,e,n,r,s){let i,o,a,u;const c=s.getAt(t),h=s.getAt(e);return _t(c)&&c.opr.equals(kf)?(i=c.base,o=c.expo):(i=c,o=mg),Ft(h).equals(kf)?(a=ip(h),u=sp(h)):(a=h,u=mg),yp(i,a)?(l(a)&&(i=a),tg(kf,s),tg(i,s),tg(o,s),tg(u,s),Ep(n,r,s),Pm(3,s),s.setAt(t,Jm(s)),1):0}function fp(t,e,n){let r=n.length;for(let s=t;s<r;s++){const t=n.getAt(s);D(t)?D(e)?(Wm(e,t,n),e=Jm(n),n.splice(s,1),s--,r--):(n.splice(s,1),s--,r--):T(t)&&(e=t,n.splice(s,1),s--,r--)}return e}function pp(t,e){if(!qm(t)&&!qm(e))return 1;if(!qm(t)||!qm(e))return 0;const n=t.ndim;if(n!==e.ndim)return 0;for(let r=0;r<n;r++)if(t.dims[r]!==e.dims[r])return 0;return 1}function dp(t){if(bt(t))return 0;if(!_t(t))return 1;{const e=t.head,n=t.rest;try{return dp(e)+dp(n)}finally{e.release(),n.release()}}}function mp(t){const e=Mt(Jm(t)),n=Jm(t);try{tg(Tt(n,e),t)}finally{n.release(),e.release()}}function gp(t){const e=$f(),n=t.ndim;for(let r=0;r<n;r++)e.dims[r]=t.dims[r];const r=t.nelem;for(let n=0;n<r;n++)e.elems[n]=t.elems[n];return e}function xp(t,e,n){ig(t,e,n),$m(2,t,e,n)}function yp(t,e){return 0===up(t,e)}function wp(t,e,n){const r=Jm(n);try{if(St(r)){const s=t.handlerFor(r).dispatch(r,Qh,kt,new rh(t,e));try{return void n.push(s)}finally{s.release()}}tg(r,n),tg(r,n),Gp(t,e,n),Um(t,e,n),sg(1,2,n),Gd(t,e,n);const s=Jm(n);tg(s,n),hd(t,e,n);const i=Jm(n);if(l(i))return tg(s,n),void(Kh(i)&&Xm(t,e,n));if(Ft(r).equals(kf)&&Hh(sp(r)))return tg(r,n),ig(t,e,n),wp(t,e,n),void ig(t,e,n);if(Ft(r).equals(Sf)){const s=n.length;let i=Ct(r);for(;_t(i);)tg(Ft(i),n),wp(t,e,n),i=Ct(i);return void $m(n.length-s,t,e,n)}if(Hh(r)||Ft(r).equals(Af)&&Hh(ip(r))){tg(r,n),Xm(t,e,n);const s=Jm(n);tg(Qh,n),tg(s,n),Pm(2,n)}else tg(Qh,n),tg(r,n),Pm(2,n)}finally{r.release()}}function Ep(t,e,n){vp(2,t,e,n)}function vp(t,e,n,r){if(t<0)throw new Vt(`n => ${t}`);const s=r.length-t;Bh(s,Af,r);const i=function(t,e,n,r){let s=dg;for(let i=t;i<r.length;i++){const t=r.getAt(i);b(t)&&(b(s)?(tg(s,r),tg(t,r),Dp(e,n,r),s=U(Jm(r))):s=t,r.splice(i,1),i--)}return s}(s,e,n,r);bp(s,e,n,r),function(t,e,n,r){let s=0;for(let i=t;i<r.length;i++){const t=r.getAt(i);if(Sp(t)){tg(t,r),wm(e,n,r);const o=Jm(r);yp(t,o)||(r.setAt(i,o),s++)}}return s}(s,e,n,r)&&bp(s,e,n,r);const o=r.length-s;if(0!==o){if(o>1&&(Pm(o,r),r.push(Af),r.swap(),mp(r)),qm(i)){const t=r.pop(),s=gp(i),o=s.nelem;for(let i=0;i<o;i++)r.push(s.elems[i]),r.push(t),vp(2,e,n,r),s.elems[i]=Jm(r);r.push(s)}}else r.push(i)}function Dp(t,e,n){const r=Jm(n),s=Jm(n);pp(s,r)||hg("incompatible tensor arithmetic");const i=gp(s),o=i.nelem;for(let a=0;a<o;a++)tg(s.elems[a],n),tg(r.elems[a],n),vp(2,t,e,n),i.elems[a]=Jm(n);tg(i,n)}function bp(n,r,s,i){!function(n,r,s){const i=r.compareFn(t(e.add)),o=s.splice(n).sort(i);s.concat(o)}(n,s,i);for(let t=n;t<i.length-1;t++)Ap(t,t+1,r,s,i)&&(jh(i.getAt(t),r)?i.splice(t,2):i.splice(t+1,1),t--);n<i.length&&jh(i.getAt(i.length-1),r)&&i.pop()}function Ap(t,e,n,r,s){const i=s.getAt(t),o=s.getAt(e);if(St(i)&&St(o),jh(o,n))return!0;if(jh(i,n))return s.setAt(t,o),!0;if(D(i)&&D(o))return kp(i,o,s),s.setAt(t,Jm(s)),!0;if(D(i)||D(o))return!1;let a=mg,u=mg,c=0,h=i;if(Ft(i).equals(Sf)){h=Ct(i),c=1;const t=Ft(h);D(t)&&(a=t,h=Ct(h),Ct(h).isnil&&(h=Ft(h),c=0))}let f=o;if(Ft(o).equals(Sf)){f=Ct(o);const t=Ft(f);D(t)&&(u=t,f=Ct(f),Ct(f).isnil&&(f=Ft(f)))}return!!yp(h,f)&&(kp(a,u,s),a=K(Jm(s)),jh(a,n)?(s.setAt(t,a),!0):(Jh(a)&&!l(a)?c?(tg(Sf,s),tg(h,s),mp(s)):tg(h,s):c?(tg(Sf,s),tg(a,s),tg(h,s),mp(s),mp(s)):(tg(Sf,s),tg(a,s),tg(h,s),Pm(3,s)),s.setAt(t,Jm(s)),!0))}function Sp(t){return Ft(t).equals(Sf)&&D(ip(t))&&Nm(sp(t))}function kp(t,e,n){if(c(t)&&c(e))return void function(t,e,n){const r=t.add(e);tg(r,n)}(t,e,n);eg(Gm(t)+Gm(e),n)}function _p(t,e,n,r){tg(ip(t),r),wm(e,n,r),Fp(e,n,r)}function Fp(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Fp(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(l(r)){let t=r.toNumber();if(-1<=t&&t<=1)return t=Math.acos(t),void eg(t,n)}if(l(r)||zh(r))return eg(1,n),tg(r,n),tg(r,n),Um(t,e,n),fg(t,e,n),um(t,e,n),tg(A,n),Um(t,e,n),tg(r,n),Ep(t,e,n),Ad(t,e,n),tg(A,n),Um(t,e,n),void Xm(t,e,n);if(Om(r))return sg(1,4,n),tg(Cf,n),void Um(t,e,n);if(3===$h(s=r)&&Ft(s).equals(Sf)&&Mh(ip(s))&&Om(sp(s)))return sg(3,4,n),tg(Cf,n),void Um(t,e,n);var s;if(jh(r,t))return sg(1,2,n),tg(Cf,n),void Um(t,e,n);if(Ch(r,1,2))return sg(1,3,n),tg(Cf,n),void Um(t,e,n);if(!Jh(r))return Ch(r,-1,2)?(sg(2,3,n),tg(Cf,n),void Um(t,e,n)):void(Mh(r)?tg(Cf,n):(tg(Zh,n),tg(r,n),Pm(2,n)));ng(0,n)}}function Cp(t,e,n,r){tg(ip(t),r),wm(e,n,r),Tp(e,n,r)}function Tp(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Tp(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(l(r)){let t=r.toNumber();if(t>=1)return t=Math.acosh(t),void eg(t,n)}if(l(r)||zh(r))return tg(r,n),tg(r,n),Um(t,e,n),eg(-1,n),Ep(t,e,n),um(t,e,n),tg(r,n),Ep(t,e,n),void Ad(t,e,n);Jh(r)?ng(0,n):Ft(r).equals(of)?tg(ip(r),n):(tg(Yh,n),tg(r,n),Pm(2,n))}}function Mp(t,e,n,r){tg(ip(t),r),wm(e,n,r),Op(e,n,r)}function Op(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Op(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(l(r)){let t=r.toNumber();if(-1<=t&&t<=1)return t=Math.asin(t),void eg(t,n)}if(l(r)||zh(r))return tg(A,n),Xm(t,e,n),tg(A,n),tg(r,n),Um(t,e,n),eg(1,n),tg(r,n),tg(r,n),Um(t,e,n),fg(t,e,n),um(t,e,n),Ep(t,e,n),Ad(t,e,n),void Um(t,e,n);if(Hh(r))return tg(r,n),Xm(t,e,n),Op(t,e,n),void Xm(t,e,n);if(Om(r))return sg(1,4,n),tg(Cf,n),void Um(t,e,n);if(jh(r,t))ng(0,n);else{if(Ch(r,1,2))return sg(1,6,n),tg(Cf,n),void Um(t,e,n);if(Jh(r))return sg(1,2,n),tg(Cf,n),void Um(t,e,n);tg(tf,n),tg(r,n),Pm(2,n)}}}function Np(t,e,n,r){tg(ip(t),r),wm(e,n,r),Lp(e,n,r)}function Lp(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Lp(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(l(r)){let t=r.toNumber();return t=Math.asinh(t),void eg(t,n)}if(zh(r))return tg(r,n),tg(r,n),Um(t,e,n),eg(1,n),Ep(t,e,n),um(t,e,n),tg(r,n),Ep(t,e,n),void Ad(t,e,n);if(!jh(r,t))return Hh(r)?(tg(r,n),Xm(t,e,n),Lp(t,e,n),void Xm(t,e,n)):void(Ft(r).equals(vf)?tg(ip(r),n):(tg(ef,n),tg(r,n),Pm(2,n)));tg(r,n)}}function Bp(t,e,n,r){const s=t.item1,i=t.item2;tg(s,r),wm(e,n,r),_t(ap(t))?(tg(i,r),wm(e,n,r)):ng(1,r),qp(e,n,r)}function qp(t,e,n){const r=Jm(n),s=Jm(n);if(b(s)){const i=gp(s),o=i.nelem;for(let s=0;s<o;s++)tg(i.elems[s],n),tg(r,n),qp(t,e,n),i.elems[s]=Jm(n);tg(i,n)}else if(D(r)&&D(s))!function(t,e,n,r,s){if(jh(t,n)&&jh(e,n))return tg(nf,s),ng(0,s),ng(0,s),void Pm(3,s);if(D(t)&&D(e)&&(l(t)||l(e)))return void eg(Math.atan2(e.toNumber(),t.toNumber()),s);if(jh(e,n))return void(Kh(t)?tg(Cf,s):ng(0,s));if(jh(t,n))return Kh(e)?sg(-1,2,s):sg(1,2,s),tg(Cf,s),void Um(n,r,s);tg(e,s),tg(t,s),xp(n,r,s),wp(n,r,s);const i=Jm(s);tg(i,s),zd(n,r,s),Kh(e)&&Xm(n,r,s);const o=Jm(s);tg(i,s),td(n,r,s),Kh(t)&&Xm(n,r,s);const a=Jm(s);if(0!==Zf(a.a,o.a)||0!==Zf(a.b,o.b))return void(Kh(o)?(tg(nf,s),tg(o,s),Xm(n,r,s),tg(a,s),Pm(3,s),Xm(n,r,s)):(tg(nf,s),tg(o,s),tg(a,s),Pm(3,s)));Kh(a)?Kh(o)?sg(-3,4,s):sg(3,4,s):Kh(o)?sg(-1,4,s):sg(1,4,s);tg(Cf,s),Um(n,r,s)}(r,s,t,e,n);else{if(!jh(r,t)&&(zh(r)||zh(s))){tg(s,n),tg(r,n),xp(t,e,n);const i=Jm(n);return eg(-.5,n),tg(A,n),Um(t,e,n),tg(A,n),tg(i,n),fg(t,e,n),tg(A,n),tg(i,n),Ep(t,e,n),xp(t,e,n),Ad(t,e,n),void Um(t,e,n)}if(Hh(s))return tg(s,n),Xm(t,e,n),tg(r,n),qp(t,e,n),void Xm(t,e,n);Ft(s).equals(Df)&&Jh(r)?tg(ip(s),n):(tg(nf,n),tg(s,n),tg(r,n),Pm(3,n))}}function Ip(t,e,n,r){tg(ip(t),r),wm(e,n,r),Pp(e,n,r)}function Pp(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Pp(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(Jh(r)||Mh(r))return tg(rf,n),tg(r,n),void Pm(2,n);if(l(r)){let t=r.toNumber();if(-1<t&&t<1)return t=Math.atanh(t),void eg(t,n)}if(l(r)||zh(r))return eg(1,n),tg(r,n),Ep(t,e,n),Ad(t,e,n),eg(1,n),tg(r,n),fg(t,e,n),Ad(t,e,n),fg(t,e,n),eg(.5,n),void Um(t,e,n);if(!jh(r,t))return Hh(r)?(tg(r,n),Xm(t,e,n),Pp(t,e,n),void Xm(t,e,n)):void(Ft(r).equals(bf)?tg(ip(r),n):(tg(rf,n),tg(r,n),Pm(2,n)));ng(0,n)}}function Rp(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),Up(e,n,r)}function Up(t,e,n){const r=Jm(n);try{if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Up(t,e,n),s.elems[r]=Jm(n);return void tg(s,n)}tg(r,n),zd(t,e,n),$p(t,e,n),tg(r,n),td(t,e,n),$p(t,e,n),fg(t,e,n),Tm(r)&&hd(t,e,n)}finally{r.release()}}function $p(r,s,i){const o=Jm(i);try{if(St(o)){const n=r.handlerFor(o),a=new rh(r,s);try{const r=n.dispatch(o,t(e.arg),kt,a);try{return void i.push(r)}finally{r.release()}}finally{a.release()}}if(c(o))return void(o.isZero()?i.push(Ut(new B("arg of zero (0) is undefined"))):Kh(o)?(tg(Cf,i),Xm(r,s,i)):ng(0,i));if(l(o))return void(o.isZero()?i.push(Ut(new B("arg of zero (0.0) is undefined"))):Kh(o)?eg(-Math.PI,i):eg(0,i));if(_t(o)){const a=o.opr;try{if(v(a)&&n(a,e.pow)){const n=o.base;try{if(Mh(n)){const n=o.expo;try{return i.push(t(e.PI)),i.push(n),void Um(r,s,i)}finally{n.release()}}}finally{n.release()}}}finally{a.release()}}if(_t(o)&&o.opr.equals(kf)&&ip(o).equals(Ff))return tg(sp(o),i),void gd(r,s,i);if(Ft(o).equals(Sf)){const n=i.length;let a=Ct(o);for(;_t(a);)tg(Ft(a),i),Up(r,s,i),a=Ct(a);return vp(i.length-n,r,s,i),void function(n,r,s){const i=new rh(n,r),o=bn,a=m,u=a.add(o);try{for(s.push(t(e.PI)),xp(n,r,s),s.dupl(),rg(e.testgt,s),s.swap(),s.push(u),Pm(3,s),wm(n,r,s);s.istrue;)s.pop().release(),s.push(o),fg(n,r,s),s.dupl(),rg(e.testgt,s),s.swap(),s.push(u),Pm(3,s),wm(n,r,s);for(s.pop().release(),s.dupl(),rg(e.testle,s),s.swap(),s.push(a),Pm(3,s),wm(n,r,s);s.istrue;)s.pop().release(),s.push(o),vp(2,n,r,s),s.dupl(),rg(e.testle,s),s.swap(),s.push(a),Pm(3,s),wm(n,r,s);s.pop().release(),s.push(t(e.PI)),$m(2,n,r,s)}finally{i.release()}}(r,s,i)}if(Ft(o).equals(Af)){tg(o,i),em(r,s,i);const t=Jm(i);tg(t,i),Yd(r,s,i);const e=Jm(i);tg(t,i),gd(r,s,i);return tg(Jm(i),i),tg(e,i),void qp(r,s,i)}ng(0,i)}finally{o.release()}}function zp(t,e,n,r){tg(_m(I(ip(t)),kt,e),r)}function Wp(t,e,n,r){tg(ip(t),r),wm(e,n,r),Xp(e,n,r)}function Xp(t,e,n){Kp(n),wm(t,e,n)}function Kp(t){let e=Jm(t);if(b(e)){const n=gp(e),r=n.nelem;for(let e=0;e<r;e++)tg(n.elems[e],t),Kp(t),n.elems[e]=Jm(t);tg(n,t)}else{if(Ft(e).equals(sf))return tg(lf,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(Ft(e).equals(Ef))return tg(ff,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(Ft(e).equals(Df))return tg(df,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(Ft(e).equals(of))return tg(hf,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(Ft(e).equals(vf))return tg(pf,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(Ft(e).equals(bf))return tg(mf,t),tg(ip(e),t),Kp(t),void Pm(2,t);if(_t(e)){const n=t.length;for(tg(Ft(e),t),e=Ct(e);_t(e);)tg(Ft(e),t),Kp(t),e=Ct(e);Pm(t.length-n,t)}else tg(e,t)}}function Hp(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),Jp(e,n,r)}function Jp(t,e,n){const r=Jm(n);try{if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Jp(t,e,n),s.elems[r]=Jm(n);return void tg(s,n)}tg(r,n),Nh(t,e,n),ng(-1,n),tg(r,n),Up(t,e,n),tg(Cf,n),xp(t,e,n),Gd(t,e,n),Um(t,e,n)}finally{r.release()}}function Gp(t,e,n){Vp(t,e,n),wm(t,e,n)}function Vp(n,r,s){const i=Jm(s);try{if(b(i)){const t=gp(i),e=t.nelem;for(let i=0;i<e;i++)tg(t.elems[i],s),Vp(n,r,s),t.elems[i]=Jm(s);return void tg(t,s)}if(L(i))return tg(t(e.multiply),s),ng(-1,s),tg(i,s),void Pm(3,s);if(Ft(i).equals(kf)&&Mh(ip(i)))return tg(kf,s),ng(-1,s),tg(sp(i),s),Xm(n,r,s),void Pm(3,s);if(_t(i)){const t=s.length;tg(Ft(i),s);let e=Ct(i);for(;_t(e);)tg(Ft(e),s),Vp(n,r,s),e=Ct(e);return void Pm(s.length-t,s)}tg(i,s)}finally{i.release()}}function jp(t,e,n,r){tg(ip(t),r),wm(e,n,r),Qp(e,n,r)}function Qp(t,e,n){const r=Jm(n);if(b(r))return void tg(Sd(r,Qp,t,e,n),n);if(l(r)){let t=r.toNumber();return t=Math.cos(t),void eg(t,n)}if(zh(r))return eg(.5,n),tg(A,n),tg(r,n),Um(t,e,n),sd(t,e,n),tg(A,n),Xm(t,e,n),tg(r,n),Um(t,e,n),sd(t,e,n),Ep(t,e,n),void Um(t,e,n);if(Hh(r))return tg(r,n),Xm(t,e,n),void Qp(t,e,n);if(_t(r)&&Ft(r).equals(Af))return void function(t,e,n,r){let s=Ct(t);for(;_t(s);){ng(2,r),tg(Ft(s),r),Um(e,n,r),tg(Cf,r),xp(e,n,r);let i=Jm(r);if(c(i)&&Xh(i))return tg(t,r),tg(Ft(s),r),fg(e,n,r),i=Jm(r),tg(i,r),Qp(e,n,r),tg(Ft(s),r),Qp(e,n,r),Um(e,n,r),tg(i,r),sm(e,n,r),tg(Ft(s),r),sm(e,n,r),Um(e,n,r),void fg(e,n,r);s=Ct(s)}tg(sf,r),tg(t,r),Pm(2,r)}(r,t,e,n);if(Ft(r).equals(nf)){const s=sp(r),i=ip(r);return tg(s,n),tg(s,n),tg(s,n),Um(t,e,n),tg(i,n),tg(i,n),Um(t,e,n),Ep(t,e,n),sg(-1,2,n),Gd(t,e,n),void Um(t,e,n)}if(Ft(r).equals(tf))return ng(1,n),tg(ip(r),n),ng(2,n),Gd(t,e,n),fg(t,e,n),sg(1,2,n),void Gd(t,e,n);tg(r,n),tg(Cf,n),xp(t,e,n);let s=Jm(n);if(!D(s))return tg(sf,n),tg(r,n),void Pm(2,n);if(l(s)){let t=s.toNumber();return t=Math.cos(t*Math.PI),void eg(t,n)}if(tg(s,n),ng(180,n),Um(t,e,n),s=Jm(n),!c(s)||!Xh(s))return tg(sf,n),tg(r,n),void Pm(2,n);tg(s,n),ng(360,n),Td(t,e,n);switch(jm(n)){case 90:case 270:ng(0,n);break;case 60:case 300:sg(1,2,n);break;case 120:case 240:sg(-1,2,n);break;case 45:case 315:sg(1,2,n),ng(2,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 135:case 225:sg(-1,2,n),ng(2,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 30:case 330:sg(1,2,n),ng(3,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 150:case 210:sg(-1,2,n),ng(3,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 0:ng(1,n);break;case 180:ng(-1,n);break;default:tg(sf,n),tg(r,n),Pm(2,n)}}function Zp(t,e,n,r){tg(ip(t),r),wm(e,n,r),Yp(e,n,r)}function Yp(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),Yp(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else{if(l(r)){let t=r.toNumber();return t=Math.cosh(t),void eg(t,n)}if(zh(r))return sg(1,2,n),tg(r,n),sd(t,e,n),tg(r,n),Xm(t,e,n),sd(t,e,n),Ep(t,e,n),void Um(t,e,n);if(!jh(r,t))return Hh(r)?(tg(r,n),Xm(t,e,n),void Yp(t,e,n)):void(Ft(r).equals(Yh)?tg(ip(r),n):(tg(of,n),tg(r,n),Pm(2,n)));ng(1,n)}}function td(t,e,n){const r=Jm(n);if(c(r)){const t=r.denom();return n.push(t),void t.release()}let s=r,i=mg;for(;bm(s,t,e,n);){const r=Jm(n);tg(r,n),tg(s,n),op(t,e,n),s=Jm(n),tg(r,n),tg(i,n),op(t,e,n),i=Jm(n)}tg(i,n)}function ed(t,e,n){const r=Jm(n),s=Jm(n);b(s)?b(r)?function(t,e,n,r,s){let i=t.nelem;const o=e.nelem,a=$f();for(let u=0;u<i;u++)for(let i=0;i<o;i++)tg(t.elems[u],s),tg(e.elems[i],s),ed(n,r,s),a.elems[o*u+i]=Jm(s);let u=0;i=t.ndim;for(let e=0;e<i;e++)a.dims[u++]=t.dims[e];i=e.ndim;for(let t=0;t<i;t++)a.dims[u++]=e.dims[t];tg(a,s)}(s,r,t,e,n):function(t,e,n,r,s){const i=gp(t),o=t.nelem;for(let a=0;a<o;a++)tg(t.elems[a],s),tg(e,s),ed(n,r,s),i.elems[a]=Jm(s);tg(i,s)}(s,r,t,e,n):b(r)?function(t,e,n,r,s){const i=gp(e),o=e.nelem;for(let a=0;a<o;a++)tg(t,s),tg(e.elems[a],s),ed(n,r,s),i.elems[a]=Jm(s);tg(i,s)}(s,r,t,e,n):function(t,e,n,r,s){v(e)?n.hasUserFunction(e)||hg(`derivative: symbol '${e.key()}' must have user function.`):hg("derivative: symbol expected.");if(yp(t,e))return void ng(1,s);if(!_t(t))return void ng(0,s);if(Ft(t).equals(Af))return void function(t,e,n,r,s){const i=s.length;t=Ct(t);for(;_t(t);)tg(Ft(t),s),tg(e,s),ed(n,r,s),t=Ct(t);vp(s.length-i,n,r,s)}(t,e,n,r,s);if(Ft(t).equals(Sf))return void function(t,e,n,r,s){const i=$h(t)-1;for(let o=0;o<i;o++){let a=Ct(t);for(let t=0;t<i;t++)tg(Ft(a),s),o===t&&(tg(e,s),ed(n,r,s)),a=Ct(a);$m(i,n,r,s)}vp(i,n,r,s)}(t,e,n,r,s);if(Ft(t).equals(kf))return void function(t,e,n,r,s){if(D(ip(t))&&D(sp(t)))return void ng(0,s);tg(sp(t),s),tg(ip(t),s),xp(n,r,s),tg(ip(t),s),tg(e,s),ed(n,r,s),Um(n,r,s),tg(ip(t),s),Ad(n,r,s),tg(sp(t),s),tg(e,s),ed(n,r,s),Um(n,r,s),Ep(n,r,s),tg(t,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(af))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s);const i=Jm(s);Ft(i).equals(af)?(tg(af,s),tg(af,s),tg(ip(i),s),!function(t,e){return up(t,e)<0}(sp(i),sp(t))?(tg(sp(t),s),Pm(3,s),tg(sp(i),s)):(tg(sp(i),s),Pm(3,s),tg(sp(t),s)),Pm(3,s)):(tg(i,s),tg(sp(t),s),ed(n,r,s))}(t,e,n,r,s);if(Ft(t).equals(yf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),xp(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(Ef))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),Qp(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(sf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),sm(n,r,s),Um(n,r,s),Xm(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(Df))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),Qp(n,r,s),ng(-2,s),Gd(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(tf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),ng(1,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),fg(n,r,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(Zh))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),ng(1,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),fg(n,r,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s),Xm(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(nf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),ng(1,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),Ep(n,r,s),ig(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(vf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),Yp(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(of))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),om(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(bf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),Yp(n,r,s),ng(-2,s),Gd(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(ef))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),ng(1,s),Ep(n,r,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(Yh))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),ng(-1,s),Ep(n,r,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(rf))return void function(t,e,n,r,s){tg(ip(t),s),tg(e,s),ed(n,r,s),ng(1,s),tg(ip(t),s),ng(2,s),Gd(n,r,s),fg(n,r,s),ig(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(uf))return void function(t,e,n,r,s){tg(ip(t),s),ng(2,s),Gd(n,r,s),ng(-1,s),Um(n,r,s),sd(n,r,s),tg(Cf,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s),ng(2,s),Um(n,r,s),tg(ip(t),s),tg(e,s),ed(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(cf))return void function(t,e,n,r,s){tg(ip(t),s),ng(2,s),Gd(n,r,s),ng(-1,s),Um(n,r,s),sd(n,r,s),tg(Cf,s),sg(-1,2,s),Gd(n,r,s),Um(n,r,s),ng(-2,s),Um(n,r,s),tg(ip(t),s),tg(e,s),ed(n,r,s),Um(n,r,s)}(t,e,n,r,s);if(Ft(t).equals(xf)&&sp(t).equals(e))return void tg(ip(t),s);!function(t,e,n){const r=Ct(t);r.isnil||km(r,e)?(tg(af,n),tg(t,n),tg(e,n),Pm(3,n)):ng(0,n)}(t,e,s)}(s,r,t,e,n)}function nd(t,e,n){const r=Jm(n);if(!qm(r))return void tg(r,n);Bm(r)||hg("det: square matrix expected");const s=r.dims[0];switch(s){case 1:return void tg(r.elems[0],n);case 2:return tg(r.elems[0],n),tg(r.elems[3],n),Um(t,e,n),tg(r.elems[1],n),tg(r.elems[2],n),Um(t,e,n),void fg(t,e,n);case 3:return tg(r.elems[0],n),tg(r.elems[4],n),tg(r.elems[8],n),$m(3,t,e,n),tg(r.elems[1],n),tg(r.elems[5],n),tg(r.elems[6],n),$m(3,t,e,n),tg(r.elems[2],n),tg(r.elems[3],n),tg(r.elems[7],n),$m(3,t,e,n),ng(-1,n),tg(r.elems[2],n),tg(r.elems[4],n),tg(r.elems[6],n),$m(4,t,e,n),ng(-1,n),tg(r.elems[1],n),tg(r.elems[3],n),tg(r.elems[8],n),$m(4,t,e,n),ng(-1,n),tg(r.elems[0],n),tg(r.elems[5],n),tg(r.elems[7],n),$m(4,t,e,n),void vp(6,t,e,n)}const i=zf(s-1,s-1),o=n.length;for(let o=0;o<s;o++){if(jh(r.elems[o],t))continue;let a=0;for(let t=1;t<s;t++)for(let e=0;e<s;e++)e!==o&&(i.elems[a++]=r.elems[s*t+e]);tg(i,n),nd(t,e,n),tg(r.elems[o],n),Um(t,e,n),o%2&&Xm(t,e,n)}const a=n.length-o;0===a?ng(0,n):vp(a,t,e,n)}function rd(t,e,n,r){tg(ip(t),r),wm(e,n,r),sd(e,n,r)}function sd(t,e,n){tg(Ff,n),pg(n),Gd(t,e,n)}function id(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){const r=Jm(n);tg(A,n),tg(r,n),Um(t,e,n),sd(t,e,n),sg(1,2,n),Um(t,e,n),tg(A,n),Xm(t,e,n),tg(r,n),Um(t,e,n),sd(t,e,n),sg(1,2,n),Um(t,e,n),Ep(t,e,n)}(e,n,r)}function od(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){const r=Jm(n);tg(r,n),sd(t,e,n),tg(r,n),Xm(t,e,n),sd(t,e,n),Ep(t,e,n),sg(1,2,n),Um(t,e,n)}(e,n,r)}function ad(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){const r=Jm(n);tg(A,n),tg(r,n),Um(t,e,n),sd(t,e,n),tg(A,n),xp(t,e,n),sg(1,2,n),Um(t,e,n),tg(A,n),Xm(t,e,n),tg(r,n),Um(t,e,n),sd(t,e,n),tg(A,n),xp(t,e,n),sg(1,2,n),Um(t,e,n),fg(t,e,n)}(e,n,r)}function ud(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){const r=Jm(n);tg(r,n),sd(t,e,n),tg(r,n),Xm(t,e,n),sd(t,e,n),fg(t,e,n),sg(1,2,n),Um(t,e,n)}(e,n,r)}function cd(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){ng(2,n),tg(A,n),$m(3,t,e,n),sd(t,e,n);const r=Jm(n);tg(A,n),tg(A,n),tg(r,n),Um(t,e,n),fg(t,e,n),tg(r,n),ng(1,n),Ep(t,e,n),xp(t,e,n)}(e,n,r)}function ld(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){ng(2,n),Um(t,e,n),sd(t,e,n);const r=Jm(n);tg(r,n),ng(1,n),fg(t,e,n),tg(r,n),ng(1,n),Ep(t,e,n),xp(t,e,n)}(e,n,r)}function hd(t,e,n){fd(n),wm(t,e,n),fd(n),wm(t,e,n)}function fd(t){const e=Jm(t);try{if(b(e)){const n=gp(e),r=n.nelem;for(let e=0;e<r;e++)tg(n.elems[e],t),fd(t),n.elems[e]=Jm(t);return void tg(n,t)}if(e.equals(Cf))return void eg(Math.PI,t);if(e.equals(Ff))return void eg(Math.E,t);if(c(e))return void eg(e.toNumber(),t);if(Ft(e).equals(kf)&&ip(e).equals(Ff))return tg(kf,t),tg(Ff,t),tg(sp(e),t),fd(t),void Pm(3,t);if(Ft(e).equals(kf)&&Mh(ip(e)))return tg(Sf,t),eg(1,t),tg(kf,t),tg(ip(e),t),tg(sp(e),t),fd(t),Pm(3,t),void Pm(3,t);if(_t(e)){const n=t.length;t.push(e),t.head();let r=e.rest;for(;_t(r);)t.push(r),t.head(),fd(t),r=r.rest;return void Pm(t.length-n,t)}tg(e,t)}finally{e.release()}}function pd(t,e,n,r){const s=t.argList;try{r.push(s),r.head(),wm(e,n,r),dd(e,n,r)}finally{s.release()}}function dd(t,e,n){const r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),dd(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else if(c(r)&&Xh(r))tg(r,n);else if(c(r)){const s=Yf(r.a,r.b),i=Xf(1);Kh(r)?(Qf(-1,s,i,n),ng(-1,n),Ep(t,e,n)):Qf(1,s,i,n)}else{if(l(r)){let t=r.toNumber();return t=Math.floor(t),void eg(t,n)}tg(gf,n),tg(r,n),Pm(2,n)}}function md(t,e,n,r){tg(ip(t),r),wm(e,n,r),gd(e,n,r)}function gd(t,e,n){let r=Jm(n);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],n),gd(t,e,n),s.elems[r]=Jm(n);tg(s,n)}else tg(r,n),em(t,e,n),r=Jm(n),sg(-1,2,n),tg(A,n),tg(r,n),tg(r,n),Gp(t,e,n),fg(t,e,n),$m(3,t,e,n)}function xd(t,e,n,r){let s=ip(t),i=ap(t);const o=r.length;for(;_t(i);)tg(Ft(i),r),wm(e,n,r),i=Ct(i);if(v(s)&&e.hasUserFunction(s)){const t=_m(s,kt,e),i=r.length-o;if(b(t)&&i<=t.ndim)return s=t,yd(t,o,r),void wm(e,n,r)}if(tg(s,r),wm(e,n,r),s=Jm(r),!qm(s))return r.splice(o),void tg(s,r);yd(s,o,r)}function yd(t,e,n){const r=t.ndim,s=n.length-e,i=r-s;i<0&&hg("index error");let o=0;for(let r=0;r<s;r++){tg(n.getAt(e+r),n);const s=jm(n);(s<1||s>t.dims[r])&&hg("index error"),o=o*t.dims[r]+s-1}if(n.splice(e),0===i)return void tg(t.elems[o],n);let a=1;for(let e=s;e<r;e++)a*=t.dims[e];o*=a;const u=$f();for(let e=0;e<a;e++)u.elems[e]=t.elems[o+e];for(let e=0;e<i;e++)u.dims[e]=t.dims[s+e];tg(u,n)}function wd(t,e,n){let r,s=Jm(n),i=Jm(n);if(!qm(i)&&!qm(s))return tg(i,n),tg(s,n),void Um(t,e,n);if(b(i)&&!qm(s)&&(r=i,i=s,s=r),!qm(i)&&qm(s)){const r=gp(s),o=r.nelem;for(let s=0;s<o;s++)tg(i,n),tg(r.elems[s],n),Um(t,e,n),r.elems[s]=Jm(n);return void tg(r,n)}if(!b(i)||!qm(s))throw new Error;let o=i.ndim-1;const a=i.dims[o],u=s.dims[0];a!==u&&hg("inner: dimension err");const c=i.ndim+s.ndim-2,l=i.nelem/a,h=s.nelem/u;r=$f();for(let o=0;o<l;o++)for(let u=0;u<h;u++){for(let r=0;r<a;r++)tg(i.elems[o*a+r],n),tg(s.elems[r*h+u],n),Um(t,e,n);vp(a,t,e,n),r.elems[o*h+u]=Jm(n)}if(0===c)return void tg(r.elems[0],n);o=0;let f=i.ndim-1;for(let t=0;t<f;t++)r.dims[o++]=i.dims[t];f=s.ndim;for(let t=1;t<f;t++)r.dims[o++]=s.dims[t];tg(r,n)}function Ed(t,e,n,r){tg(ip(t),r),wm(e,n,r),function(t,e,n){const r=Jm(n);if(!qm(r))return tg(r,n),void ig(t,e,n);Bm(r)||hg("inv: square matrix expected");tg(r,n),function(t,e,n){const r=Jm(n);if(!qm(r))return void ng(1,n);Bm(r)||hg("adj: square matrix expected");const s=r.dims[0],i=zf(s,s);if(2===s)return i.elems[0]=r.elems[3],tg(r.elems[1],n),Xm(t,e,n),i.elems[1]=Jm(n),tg(r.elems[2],n),Xm(t,e,n),i.elems[2]=Jm(n),i.elems[3]=r.elems[0],void tg(i,n);const o=zf(s-1,s-1);for(let a=0;a<s;a++)for(let u=0;u<s;u++){let c=0;for(let t=0;t<s;t++)for(let e=0;e<s;e++)t!==a&&e!==u&&(o.elems[c++]=r.elems[s*t+e]);tg(o,n),nd(t,e,n),(a+u)%2&&Xm(t,e,n),i.elems[s*u+a]=Jm(n)}tg(i,n)}(t,e,n),tg(r,n),nd(t,e,n),xp(t,e,n)}(e,n,r)}function vd(t,e,n,r){const s=t.argList;try{tg(s.head,r),wm(e,n,r);let t=s.rest;for(;_t(t);){tg(t.head,r),wm(e,n,r),Dd(e,n,r),t=t.rest}}finally{s.release()}}function Dd(t,e,n){const r=Jm(n),s=Jm(n);if(!qm(s)||!qm(r))return tg(s,n),tg(r,n),void Um(t,e,n);(s.ndim>2||r.ndim>2)&&hg("kronecker");const i=s.dims[0],o=1===s.ndim?1:s.dims[1],a=r.dims[0],u=1===r.ndim?1:r.dims[1],c=$f();let l=0;for(let h=0;h<i;h++)for(let i=0;i<a;i++)for(let a=0;a<o;a++)for(let f=0;f<u;f++)tg(s.elems[o*h+a],n),tg(r.elems[u*i+f],n),Um(t,e,n),c.elems[l++]=Jm(n);c.dims[0]=i*a,o*u>1&&(c.dims[1]=o*u),tg(c,n)}function bd(t,e,n,r){const s=t.argList;try{const t=s.head;try{r.push(t),wm(e,n,r),Ad(e,n,r)}finally{t.release()}}finally{s.release()}}function Ad(t,r,s){let i=Jm(s);if(b(i))tg(Sd(i,Ad,t,r,s),s);else{if(jh(i,t))return tg(yf,s),ng(0,s),void Pm(2,s);if(l(i)){const t=i.toNumber();if(t>0)return void eg(Math.log(t),s)}if(l(i)||zh(i))return tg(i,s),Nh(t,r,s),Ad(t,r,s),tg(i,s),Up(t,r,s),tg(A,s),Um(t,r,s),void Ep(t,r,s);if(Jh(i))ng(0,s);else if(i.equals(Ff))ng(1,s);else{if(D(i)&&Kh(i))return tg(i,s),Xm(t,r,s),Ad(t,r,s),tg(A,s),tg(Cf,s),Um(t,r,s),void Ep(t,r,s);if(c(i)){const o=s.length;tg(i,s),vm(t,r,s);for(let i=o;i<s.length;i++){const o=s.getAt(i);_t(o)&&v(o.opr)&&n(o.opr,e.pow)?(tg(o.expo,s),tg(yf,s),tg(o.base,s),Pm(2,s),Um(t,r,s)):(tg(yf,s),tg(o,s),Pm(2,s)),s.setAt(i,Jm(s))}vp(s.length-o,t,r,s)}else{if(Ft(i).equals(kf))return tg(sp(i),s),tg(ip(i),s),Ad(t,r,s),void Um(t,r,s);if(Ft(i).equals(Sf)){const e=s.length;for(i=Ct(i);_t(i);)tg(Ft(i),s),Ad(t,r,s),i=Ct(i);vp(s.length-e,t,r,s)}else tg(yf,s),tg(i,s),Pm(2,s)}}}}function Sd(t,e,n,r,s){const i=gp(t),o=i.nelem;for(let t=0;t<o;t++)tg(i.elems[t],s),e(n,r,s),i.elems[t]=Jm(s);return i}function kd(t,e,n,r){tg(ip(t),r),wm(e,n,r);const s=Jm(r);tg(sp(t),r),wm(e,n,r);const i=jm(r);tg(rp(t),r),wm(e,n,r);const o=jm(r);qm(s)&&2===s.ndim&&s.dims[0]===s.dims[1]||hg("minor"),(i<1||i>s.dims[0]||o<0||o>s.dims[1])&&hg("minor"),tg(s,r),Fd(i,o,r),nd(e,n,r)}function _d(t,e,n,r){tg(ip(t),r),wm(e,n,r);const s=Jm(r);tg(sp(t),r),wm(e,n,r);const i=jm(r);tg(rp(t),r),wm(e,n,r);const o=jm(r);qm(s)&&2===s.ndim||hg("minormatrix: matrix expected"),(i<1||i>s.dims[0]||o<0||o>s.dims[1])&&hg("minormatrix: index err"),tg(s,r),Fd(i,o,r)}function Fd(t,e,n){const r=Jm(n),s=r.dims[0],i=r.dims[1];if(2===s&&2===i)return void tg(1===t?1===e?r.elems[3]:r.elems[2]:1===e?r.elems[1]:r.elems[0],n);let o;2===s?o=Wf(i-1):2===i?o=Wf(s-1):s>2&&i>2?o=zf(s-1,i-1):hg("minormatrix is undefined."),t--,e--;let a=0;for(let n=0;n<s;n++)if(n!==t)for(let t=0;t<i;t++)t!==e&&(o.elems[a++]=r.elems[i*n+t]);tg(o,n)}function Cd(t,e,n,r){tg(ip(t),r),wm(e,n,r),tg(sp(t),r),wm(e,n,r),Td(e,n,r)}function Td(t,e,n){const r=Jm(n),s=Jm(n);if(b(s)){const i=gp(s),o=i.nelem;for(let a=0;a<o;a++)tg(i.elems[a],n),tg(r,n),Td(t,e,n),s.elems[a]=Jm(n);return void tg(s,n)}if(!D(s)||!D(r)||jh(r,t))return tg(wf,n),tg(s,n),tg(r,n),void Pm(3,n);if(c(s)&&c(r))return void function(t,e,n,r,s){if(Xh(t)&&Xh(e))return void Md(t,e,s);tg(t,s),tg(t,s),tg(e,s),xp(n,r,s),wp(n,r,s),dd(n,r,s),tg(e,s),Um(n,r,s),t.sign===e.sign&&Xm(n,r,s);Ep(n,r,s)}(s,r,t,e,n);eg(s.toNumber()%r.toNumber(),n)}function Md(t,e,n){const r=tp(t.a,e.a),s=Xf(1);Qf(t.sign,r,s,n)}function Od(t,e,n,r){n.pushDirective(ie.expanding,0);try{tg(ip(t),r),wm(e,n,r)}finally{n.popDirective()}}function Nd(t,e,n){if(e.getDirective(ie.nonstop)){const t=Jm(n);try{return void tg(kt,n)}finally{t.release()}}e.pushDirective(ie.nonstop,1);try{!function(t,e,n){const r=n.length-1,s=og.length;try{wm(t,e,n)}catch(t){n.splice(r),og.splice(s),tg(kt,n)}}(t,e,n)}finally{e.popDirective()}}const Ld=1e-6,Bd=1e-9;function qd(t,e,n,r){if(r.push(t),r.rest(),r.dupl(),r.head(),wm(e,n,r),r.swap(),r.rest(),r.head(),wm(e,n,r),r.isatom);else{if(r.iscons)throw new Vt;{r.pop().release();const t=r.pop(),e=oi(t);try{r.push(t),r.push(e)}finally{t.release(),e.release()}}}!function(t,e,n){const r=Jm(n),s=Jm(n);try{const i=[],o=[],a=[],u=[],c=n.length;!function(t,e,n,r,s){for(;;){tg(t,s),tg(e,s),ng(0,s),cm(s),wm(n,r,s);const i=Jm(s);if(tg(i,s),tg(t,s),tg(i,s),fg(n,r,s),jh(t=Jm(s),n))break;tg(t,s),tg(e,s),xp(n,r,s),t=Jm(s)}}(s,r,t,e,n);let h=n.length-c;for(let r=0;r<h;r++){tg(n.getAt(c+r),n),Yd(t,e,n),hd(t,e,n);const s=Jm(n);tg(n.getAt(c+r),n),gd(t,e,n),hd(t,e,n);const a=Jm(n);l(s)&&l(a)||hg("nroots: coeffs"),i[r]=s.d,o[r]=a.d}n.splice(c);const f=i[h-1],p=o[h-1],d=f*f+p*p;for(let t=0;t<h-1;t++){const e=(i[t]*f+o[t]*p)/d,n=(o[t]*f-i[t]*p)/d;i[t]=e,o[t]=n}for(i[h-1]=1,o[h-1]=0;h>1;){Id(i,o,h,a,u);let r=a[0],s=u[0];Math.abs(r)<Ld*Math.abs(s)&&(r=0),Math.abs(s)<Ld*Math.abs(r)&&(s=0),eg(r,n),eg(s,n),tg(A,n),Um(t,e,n),Ep(t,e,n),Rd(i,o,h,r,s),h--}if(h=n.length-c,0===h)return void tg(kt,n);if(1===h)return;!function(t,e,n,r){const s=(t,e)=>up(t,e),i=r.splice(r.length-t),o=new rh(e,n);try{const t=i.map(mh(o));for(let t=0;t<i.length;t++)i[t].release();t.sort(gh(s));const e=t.map((function(t){return t.orig}));for(let e=0;e<t.length;e++)t[e].release();r.concat(e);for(let t=0;t<e.length;t++)e[t].release()}finally{o.release()}}(h,t,e,n);const m=Wf(h);for(let t=0;t<h;t++)m.elems[t]=n.getAt(c+t);n.splice(c),tg(m,n)}finally{r.release(),s.release()}}(e,n,r)}function Id(t,e,n,r,s){const i=[],o=[];if(0===t[0]&&0===e[0])return r[0]=0,void(s[0]=0);for(let a=0;a<100;a++){let a=$d(),u=$d();Pd(t,e,n,a,u,i,o);let c=i[0],l=o[0],h=a,f=u,p=c,d=l;a=$d(),u=$d();for(let m=0;m<1e3;m++){if(Pd(t,e,n,a,u,i,o),c=i[0],l=o[0],Ud(c,l)<Bd)return r[0]=a,void(s[0]=u);if(Ud(c,l)<Ud(p,d)){let t=a,e=u;a=h,u=f,h=t,f=e,t=c,e=l,c=p,l=d,p=t,d=e}const m=h-a,g=f-u,x=p-c,y=d-l,w=x*x+y*y;if(0===w)break;const E=(m*x+g*y)/w,v=(g*x-m*y)/w;a=h-(E*p-v*d),u=f-(E*d+v*p)}}hg("nroots: convergence error")}function Pd(t,e,n,r,s,i,o){let a=t[n-1],u=e[n-1];for(let i=n-2;i>=0;i--){const n=r*u+s*a;a=r*a-s*u+t[i],u=n+e[i]}i[0]=a,o[0]=u}function Rd(t,e,n,r,s){for(let i=n-1;i>0;i--)t[i-1]+=t[i]*r-e[i]*s,e[i-1]+=e[i]*r+t[i]*s;Ud(t[0],e[0])>Ld&&hg("nroots: residual error");for(let r=0;r<n-1;r++)t[r]=t[r+1],e[r]=e[r+1]}function Ud(t,e){return Math.sqrt(t*t+e*e)}function $d(){return 4*Math.random()-2}function zd(t,e,n){const r=Jm(n);if(c(r)){const t=r.numer();return n.push(t),void t.release()}let s=r;for(;bm(s,t,e,n);)tg(s,n),op(t,e,n),s=Jm(n);tg(s,n)}function Wd(t,e,n,r){const s=new rh(e,n);try{const e=yh(t,((e,s)=>{for(r.push(mg),r.push(e);r.iscons;)r.dupl(),r.rest(),r.rotateR(3),r.head(),Xd(t,s,n,r),r.swap();return r.pop().release(),r.pop()}),s);r.push(e),e.release()}finally{s.release()}}function Xd(t,n,r,s){!function(t,e,n,r,s,i){const o=Jm(i),a=Jm(i);try{if(Oo(e)&&function(t,e){const n=t.opr;try{return!!v(n)&&n.id===e}finally{n.release()}}(e,t)){const t=e.lhs,u=e.rhs;try{if(a.equals(t)&&o.equals(u))return i.push(a),i.push(o),void n(r,s,i)}finally{t.release(),u.release()}}rg(t,i),i.push(a),i.push(o),Pm(3,i),wm(r,s,i)}finally{a.release(),o.release()}}(e.outer,t,Kd,n,r,s)}function Kd(n,r,s){const i=Jm(s),o=Jm(s);try{if(St(o)){if(St(i)){const a=new rh(n,r);try{const n=function(t,e,n,r){const s=r.handlerFor(e),i=r.handlerFor(n),o=s.binL(e,t,n,r);if(bt(o)){const s=i.binR(n,t,e,r);return bt(s)?Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,t,f(e.type),f(n.type)):s}return o}(t(e.outer),o,i,a);return void s.push(n)}finally{a.release()}}}else if(St(i));else if(ah(o)&&ah(i))throw new Vt(`outer ${o} ${i}`);if(!qm(o)||!qm(i)){if(tg(o,s),tg(i,s),ah(o)&&ah(i))throw new Vt(`outer ${o} ${i}`);return void Um(n,r,s)}const a=o.nelem,u=i.nelem,c=$f();for(let t=0;t<a;t++)for(let e=0;e<u;e++)tg(o.elems[t],s),tg(i.elems[e],s),Um(n,r,s),c.elems[t*u+e]=Jm(s);let l=0;const h=o.ndim;for(let t=0;t<h;t++)c.dims[l++]=o.dims[t];const p=i.ndim;for(let t=0;t<p;t++)c.dims[l++]=i.dims[t];tg(c,s)}finally{o.release(),i.release()}}function Hd(t,e,n,r){tg(ip(t),r),wm(e,n,r),Jd(e,n,r)}function Jd(t,e,n){const r=Jm(n);if(b(r))return void tg(Sd(r,Jd,t,e,n),n);tg(r,n),Nh(t,e,n),tg(A,n),tg(r,n),Up(t,e,n);const s=Jm(n);l(s)?(eg(s.d/Math.PI,n),tg(Cf,n),$m(3,t,e,n)):(tg(s,n),$m(2,t,e,n)),sd(t,e,n),Um(t,e,n)}function Gd(n,r,s){const[i,o]=function(t){const e=Jm(t),n=Jm(t);if(v(n)&&l(e)){if(n.equals(Ff))return[X(Math.E),e];if(n.equals(Cf))return[X(Math.PI),e]}return[n,e]}(s);try{if(St(i)&&k(i)&&c(o))return void s.push(i.pow(H.valueOf(o.numer().toNumber(),o.denom().toNumber())));if(b(i)&&qm(o))return tg(kf,s),tg(i,s),tg(o,s),void Pm(3,s);if(b(o)){const t=gp(o),e=t.nelem;for(let o=0;o<e;o++)tg(i,s),tg(t.elems[o],s),Gd(n,r,s),t.elems[o]=Jm(s);return void tg(t,s)}if(b(i)){const t=gp(i),e=t.nelem;for(let i=0;i<e;i++)tg(t.elems[i],s),tg(o,s),Gd(n,r,s),t.elems[i]=Jm(s);return void tg(t,s)}if(D(i)&&D(o))return void function(t,e,n,r,s){if(jh(e,n))return void ng(1,s);if(jh(t,n)){if(!Kh(e))return void ng(0,s);{const t=Xt(Kt.Division_by_zero);try{return void s.push(t)}finally{t.release()}}}if(Jh(t))return void ng(1,s);if(Jh(e))return void tg(t,s);if(l(t)||l(e))return void function(t,e,n,r,s){const i=t.toNumber(),o=e.toNumber();if(i>0||o===Math.floor(o)){return void eg(Math.pow(i,o),s)}if(Qm(e,n,r,s),-1===i)return;const a=Math.pow(-i,o);eg(a,s),Um(n,r,s)}(t,e,n,r,s);if(Xh(e)){if(e.isNegative()){const n=e.a.negate(),r=ep(t.a,n),i=ep(t.b,n);tg(new w(i,r),s)}else{const n=e.a,r=ep(t.a,n),i=ep(t.b,n);tg(new w(r,i),s)}return}const i=s.length;tg(kf,s),tg(t,s),tg(e,s),Pm(3,s),vm(n,r,s);let o=s.length-i;for(let a=0;a<o;a++){const o=s.getAt(i+a);Ft(o).equals(kf)&&(Ym(t=ip(o),e=sp(o),n,r,s),s.setAt(i+a,Jm(s)))}let a=mg;for(let t=i;t<s.length;t++){const e=s.getAt(t);D(e)&&(tg(a,s),tg(e,s),Um(n,r,s),a=Jm(s),s.splice(t,1),t--)}o=s.length-i,0!==o&&Jh(a)||(tg(a,s),o++);if(1===o)return;lg(i,r,s),Pm(o,s),tg(Sf,s),pg(s),mp(s)}(i,o,n,r,s);if(jh(o,n))return void ng(1,s);if(jh(i,n))return tg(kf,s),tg(i,s),tg(o,s),void Pm(3,s);if(Jh(i))return void ng(1,s);if(Jh(o))return void tg(i,s);if(L(i)&&c(o)&&Xh(o)){if(o.isEven()){return o.mul(Bn).isEven()?void s.push(mg):void s.push(m)}if(o.isOdd()){return o.succ().mul(Bn).isEven()?(s.push(A),void Xm(n,r,s)):void s.push(A)}}if(c(i)&&Xh(i)){const t=s.length;tg(i,s),vm(n,r,s);const e=s.length-t;for(let i=0;i<e;i++){const e=s.getAt(t+i);Ft(e).equals(kf)?(tg(kf,s),tg(ip(e),s),tg(sp(e),s),tg(o,s),Um(n,r,s),Pm(3,s)):(tg(kf,s),tg(e,s),tg(o,s),Pm(3,s)),s.setAt(t+i,Jm(s))}return void(e>1&&(lg(t,r,s),Pm(e,s),tg(Sf,s),pg(s),mp(s)))}if(c(i)&&Wh(i))return tg(i,s),zd(n,r,s),tg(o,s),Gd(n,r,s),tg(i,s),td(n,r,s),tg(o,s),Xm(n,r,s),Gd(n,r,s),void Um(n,r,s);if(i.equals(Ff))return void Zm(o,n,r,s);if(Ft(i).equals(Af))return void function(n,r,s,i,o){if(a=n,(Mm(a)||3===$h(a)&&Ft(a).equals(Af)&&D(ip(a))&&Mm(sp(a)))&&D(r))return void function(t,e,n,r,s){let i,o;Ft(t).equals(Af)?(i=ip(t),o=function(t){return Ft(Ft(Ct(Ct(t))))}(t).equals(Sf)?np(t):mg):Ft(t).equals(Sf)?(i=dg,o=ip(t)):(i=dg,o=mg);if(l(i)||l(o)||l(e))return void function(t,e,n,r,s,i,o){tg(n,o);let a=Vm(o);tg(r,o);let u=Vm(o);tg(e,o);const c=Vm(o);let l=Math.sqrt(a*a+u*u),h=Math.atan2(u,a);l=Math.pow(l,c),h*=c,a=l*Math.cos(h),u=l*Math.sin(h),eg(a,o),eg(u,o),tg(A,o),Um(s,i,o),Ep(s,i,o)}(0,e,i,o,n,r,s);if(!c(e)||!Xh(e))return void function(t,e,n,r,s,i,o){tg(n,o),tg(n,o),Um(s,i,o),tg(r,o),tg(r,o),Um(s,i,o),Ep(s,i,o),sg(1,2,o),tg(e,o),Um(s,i,o),Gd(s,i,o),tg(r,o),tg(n,o),qp(s,i,o),tg(Cf,o),xp(s,i,o),tg(e,o),Um(s,i,o),e=Jm(o),Qm(e,s,i,o),Um(s,i,o)}(0,e,i,o,n,r,s);if(!Lm(e))return tg(kf,s),tg(t,s),tg(e,s),void Pm(3,s);tg(e,s);const a=jm(s);a>0?function(t,e,n,r,s,i){let o=t,a=e;for(let u=1;u<n;u++)tg(o,i),tg(t,i),Um(r,s,i),tg(a,i),tg(e,i),Um(r,s,i),fg(r,s,i),tg(o,i),tg(e,i),Um(r,s,i),tg(a,i),tg(t,i),Um(r,s,i),Ep(r,s,i),a=Jm(i),o=Jm(i);tg(o,i),tg(A,i),tg(a,i),Um(r,s,i),Ep(r,s,i)}(i,o,a,n,r,s):a<0?function(t,e,n,r,s,i){tg(t,i),tg(t,i),Um(r,s,i),tg(e,i),tg(e,i),Um(r,s,i),Ep(r,s,i);const o=Jm(i);tg(t,i),tg(o,i),xp(r,s,i),t=Jm(i),tg(e,i),Xm(r,s,i),tg(o,i),xp(r,s,i),e=Jm(i);let a=t,u=e;for(let o=1;o<n;o++)tg(a,i),tg(t,i),Um(r,s,i),tg(u,i),tg(e,i),Um(r,s,i),fg(r,s,i),tg(a,i),tg(e,i),Um(r,s,i),tg(u,i),tg(t,i),Um(r,s,i),Ep(r,s,i),u=Jm(i),a=Jm(i);tg(a,i),tg(A,i),tg(u,i),Um(r,s,i),Ep(r,s,i)}(i,o,-a,n,r,s):ng(1,s)}(n,r,s,i,o);var a;if(0===i.getDirective(ie.expanding)||!Lm(r)||D(r)&&Kh(r))return void o.push(At(t(e.pow),n,r));tg(r,o);const u=jm(o),h=o.length;let f=Ct(n);for(;_t(f);){let t=Ct(n);for(;_t(t);)tg(Ft(f),o),tg(Ft(t),o),Um(s,i,o),t=Ct(t);f=Ct(f)}vp(o.length-h,s,i,o);for(let t=2;t<u;t++)tg(n,o),Um(s,i,o)}(i,o,n,r,s);if(Ft(i).equals(Sf)){const t=s.length;let e=Ct(i);for(;_t(e);)tg(Ft(e),s),tg(o,s),Gd(n,r,s),e=Ct(e);return void $m(s.length-t,n,r,s)}if(mi(i)){const t=i.base,e=i.expo,a=o;return tg(t,s),tg(e,s),tg(a,s),function(t,e,n){e.pushDirective(ie.expanding,1);try{Um(t,e,n)}finally{e.popDirective()}}(n,r,s),void Gd(n,r,s)}s.push(t(e.pow)),s.push(i),s.push(o),Pm(3,s)}finally{o.release(),i.release()}}function Vd(t,e,n,r){const s=t.argList;try{const t=s.item0;try{r.push(t),wm(e,n,r);const s=Jm(r);try{b(s)?ng(s.rank,r):ng(0,r)}finally{s.release()}}finally{t.release()}}finally{s.release()}}function jd(t,e,n,r){tg(ip(t),r),wm(e,n,r),Qd(e,n,r)}function Qd(t,e,n){let r=Jm(n);if(b(r))return void tg(Sd(r,Qd,t,e,n),n);let s=mg;for(;bm(r,t,e,n);){const i=Jm(n);tg(i,n),tg(r,n),op(t,e,n),r=Jm(n),tg(i,n),tg(s,n),zm(t,e,n),s=Jm(n)}tg(r,n),tg(s,n),ig(t,e,n),zm(t,e,n)}function Zd(t,e,n,r){tg(ip(t),r),wm(e,n,r),Yd(e,n,r)}function Yd(t,e,n){const r=Jm(n);try{if(St(r)&&b(r))return void tg(Sd(r,Yd,t,e,n),n);n.push(r),em(t,e,n),n.dupl(),Gp(t,e,n),Ep(t,e,n),sg(1,2,n),Um(t,e,n)}finally{r.release()}}function tm(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),em(e,n,r)}function em(t,e,n){const r=Jm(n);try{if(b(r))return void tg(Sd(r,em,t,e,n),n);if(Ft(r).equals(Af)){let s=Ct(r);const i=n.length;for(;_t(s);)tg(Ft(s),n),em(t,e,n),s=Ct(s);return void vp(n.length-i,t,e,n)}if(Ft(r).equals(Sf)){let s=Ct(r);const i=n.length;for(;_t(s);)tg(Ft(s),n),em(t,e,n),s=Ct(s);return void $m(n.length-i,t,e,n)}if(!_t(r)||!Ft(r).equals(kf))return void tg(r,n);{const s=r.base,i=r.expo;if(Ft(i).equals(Af)){let r=Ct(i);const o=n.length;for(;_t(r);)tg(kf,n),tg(s,n),tg(Ft(r),n),Pm(3,n),em(t,e,n),r=Ct(r);return void $m(n.length-o,t,e,n)}tg(r,n),Nh(t,e,n),tg(r,n),Up(t,e,n);const o=Jm(n);tg(o,n),Qp(t,e,n),tg(A,n),tg(o,n),sm(t,e,n),Um(t,e,n),Ep(t,e,n),Um(t,e,n)}}finally{r.release()}}function nm(t,e,n){const r=Jm(n);b(r)?function(t,e,n,r){tg(t=gp(t),r);const s=t.nelem;for(let i=0;i<s;i++)tg(t.elems[i],r),nm(e,n,r),t.elems[i]=Jm(r)}(r,t,e,n):function(t,e,n,r){if(!_t(t))return void tg(t,r);const s=r.length;tg(Ft(t),r),t=Ct(t);for(;_t(t);)tg(Ft(t),r),nm(e,n,r),t=Ct(t);Pm(r.length-s,r),wm(e,n,r),function(t,e,n){let r,s=Jm(n);if(!_t(s))return void tg(s,n);if(Ft(s).equals(Af)){if(tg(s,n),Qd(t,e,n),r=Jm(n),Ft(r).equals(Af))return void tg(s,n)}else r=s;tg(r,n),zd(t,e,n);let i=Jm(n);tg(r,n),td(t,e,n),wm(t,e,n);let o=Jm(n);Ft(o).equals(Af)&&(tg(o,n),Qd(t,e,n),r=Jm(n),Ft(r).equals(Af)||(tg(r,n),td(t,e,n),wm(t,e,n),tg(i,n),Um(t,e,n),i=Jm(n),tg(r,n),zd(t,e,n),o=Jm(n)));if(!Ft(i).equals(Af)||!Ft(o).equals(Af)||$h(i)!==$h(o))return tg(i,n),tg(o,n),xp(t,e,n),r=Jm(n),dp(r)<dp(s)&&(s=r),void tg(s,n);tg(ip(i),n),tg(ip(o),n),xp(t,e,n);const a=Jm(n);tg(a,n),tg(o,n),Um(t,e,n),tg(i,n),fg(t,e,n),r=Jm(n),jh(r,t)&&(s=a);tg(s,n)}(e,n,r),function(t,e,n){const r=Jm(n);if(!_t(r))return void tg(r,n);tg(r,n),Xp(t,e,n),Qd(t,e,n),wm(t,e,n);const s=Jm(n);if(dp(s)<dp(r))return void tg(s,n);tg(r,n)}(e,n,r),function(t,e,n){const r=Jm(n);if(!Ft(r).equals(Af)||Im(r,t)||!km(r,A))return void tg(r,n);tg(r,n),Jd(t,e,n);const s=Jm(n);if(!_t(s))return void tg(s,n);tg(r,n)}(e,n,r)}(r,t,e,n)}function rm(t,e,n,r){tg(ip(t),r),wm(e,n,r),sm(e,n,r)}function sm(t,e,n){const r=Jm(n);if(b(r))return void tg(Sd(r,sm,t,e,n),n);if(l(r)){let t=r.toNumber();return t=Math.sin(t),void eg(t,n)}if(zh(r))return eg(-.5,n),tg(A,n),Um(t,e,n),tg(A,n),tg(r,n),Um(t,e,n),sd(t,e,n),tg(A,n),Xm(t,e,n),tg(r,n),Um(t,e,n),sd(t,e,n),fg(t,e,n),void Um(t,e,n);if(Hh(r))return tg(r,n),Xm(t,e,n),sm(t,e,n),void Xm(t,e,n);if(Ft(r).equals(Af))return void function(t,e,n,r){let s=Ct(t);for(;_t(s);){ng(2,r),tg(Ft(s),r),Um(e,n,r),tg(Cf,r),xp(e,n,r);let i=Jm(r);if(c(i)&&Xh(i))return tg(t,r),tg(Ft(s),r),fg(e,n,r),i=Jm(r),tg(i,r),sm(e,n,r),tg(Ft(s),r),Qp(e,n,r),Um(e,n,r),tg(i,r),Qp(e,n,r),tg(Ft(s),r),sm(e,n,r),Um(e,n,r),void Ep(e,n,r);s=Ct(s)}tg(Ef,r),tg(t,r),Pm(2,r)}(r,t,e,n);if(Ft(r).equals(nf)){const s=sp(r),i=ip(r);return tg(i,n),tg(s,n),tg(s,n),Um(t,e,n),tg(i,n),tg(i,n),Um(t,e,n),Ep(t,e,n),sg(-1,2,n),Gd(t,e,n),void Um(t,e,n)}if(Ft(r).equals(Zh))return ng(1,n),tg(ip(r),n),ng(2,n),Gd(t,e,n),fg(t,e,n),sg(1,2,n),void Gd(t,e,n);tg(r,n),tg(Cf,n),xp(t,e,n);let s=Jm(n);if(!D(s))return tg(Ef,n),tg(r,n),void Pm(2,n);if(l(s)){let t=s.toNumber();return t=Math.sin(t*Math.PI),void eg(t,n)}if(tg(s,n),ng(180,n),Um(t,e,n),s=Jm(n),!c(s)||!Xh(s))return tg(Ef,n),tg(r,n),void Pm(2,n);tg(s,n),ng(360,n),Td(t,e,n);switch(jm(n)){case 0:case 180:ng(0,n);break;case 30:case 150:sg(1,2,n);break;case 210:case 330:sg(-1,2,n);break;case 45:case 135:sg(1,2,n),ng(2,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 225:case 315:sg(-1,2,n),ng(2,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 60:case 120:sg(1,2,n),ng(3,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 240:case 300:sg(-1,2,n),ng(3,n),sg(1,2,n),Gd(t,e,n),Um(t,e,n);break;case 90:ng(1,n);break;case 270:ng(-1,n);break;default:tg(Ef,n),tg(r,n),Pm(2,n)}}function im(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),om(e,n,r)}function om(t,e,n){const r=Jm(n);if(b(r))tg(Sd(r,om,t,e,n),n);else if(l(r))eg(Math.sinh(r.toNumber()),n);else{if(zh(r))return sg(1,2,n),tg(r,n),sd(t,e,n),tg(r,n),Xm(t,e,n),sd(t,e,n),fg(t,e,n),void Um(t,e,n);if(!jh(r,t))return Hh(r)?(tg(r,n),Xm(t,e,n),om(t,e,n),void Xm(t,e,n)):void(Ft(r).equals(ef)?tg(ip(r),n):(tg(vf,n),tg(r,n),Pm(2,n)));ng(0,n)}}function am(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),um(e,n,r)}function um(t,e,n){sg(1,2,n),Gd(t,e,n)}function cm(t){const e=Jm(t),n=Jm(t);if(n.isnil||e.isnil)return;let r=Jm(t);if(b(r)){const s=gp(r),i=s.nelem;for(let r=0;r<i;r++)tg(s.elems[r],t),tg(n,t),tg(e,t),cm(t),s.elems[r]=Jm(t);tg(s,t)}else if(yp(r,n))tg(e,t);else if(_t(r)){const s=t.length;for(;_t(r);)tg(Ft(r),t),tg(n,t),tg(e,t),cm(t),r=Ct(r);Pm(t.length-s,t)}else tg(r,t)}function lm(t,e,n,r){const s=(t=gp(t)).nelem;for(let i=0;i<s;i++)tg(t.elems[i],r),wm(e,n,r),t.elems[i]=Jm(r);tg(t,r),function(t){const e=Jm(t);if(!qm(e))return void tg(e,t);const n=e.ndim,r=e.nelem;let s=e.elems[0];for(let t=1;t<r;t++){pp(s,e.elems[t])||hg("tensor dimensions")}if(!qm(s))return void tg(e,t);const i=s.ndim,o=s.nelem,a=$f();let u=0;for(let t=0;t<n;t++)a.dims[u++]=e.dims[t];for(let t=0;t<i;t++)a.dims[u++]=s.dims[t];u=0;for(let t=0;t<r;t++){s=e.elems[t];for(let t=0;t<o;t++)a.elems[u++]=s.elems[t]}tg(a,t)}(r)}function hm(t,e,n,r){dm(t,e,n,r)>=0?tg(Eh(!0,n),r):tg(Eh(!1,n),r)}function fm(t,e,n,r){dm(t,e,n,r)>0?tg(Eh(!0,n),r):tg(Eh(!1,n),r)}function pm(t,e,n,r){dm(t,e,n,r)<0?tg(Eh(!0,n),r):tg(Eh(!1,n),r)}function dm(t,e,n,r){r.push(t),r.rest(),r.dupl(),r.head(),wm(e,n,r),r.swap(),r.rest(),r.head(),wm(e,n,r),fg(e,n,r),nm(e,n,r),hd(e,n,r);const s=Jm(r);try{return jh(s,e)?It:(D(s)||hg("compare err"),Kh(s)?qt:Bt)}finally{s.release()}}function mm(t,e,n,r){tg(ip(t),r),wm(e,n,r);const s=Jm(r);if(tg(s,r),qm(s)&&!(s.ndim<2))if(t=ap(t),_t(t))for(;_t(t);){tg(Ft(t),r),wm(e,n,r);const s=jm(r);tg(ip(t),r),wm(e,n,r);gm(s,jm(r),r),t=ap(t)}else gm(1,2,r)}function gm(t,e,n){const r=[],s=Jm(n),i=s.ndim,o=s.nelem;(t<1||t>i||e<1||e>i)&&hg("transpose: index error"),t--,e--;const a=gp(s);a.dims[t]=s.dims[e],a.dims[e]=s.dims[t];for(let t=0;t<i;t++)r[t]=0;for(let n=0;n<o;n++){let o=0;for(let n=0;n<i;n++)o=n===t?o*s.dims[e]+r[e]:n===e?o*s.dims[t]+r[t]:o*s.dims[n]+r[n];a.elems[o]=s.elems[n];for(let t=i-1;t>=0&&!(++r[t]<s.dims[t]);t--)r[t]=0}tg(a,n)}function xm(t,e,n,r){tg(ip(t),r),wm(e,n,r);const s=jm(r);if(s<1&&hg("unit: index err"),1===s)return void ng(1,r);const i=zf(s,s);for(let t=0;t<s;t++)for(let e=0;e<s;e++)i.elems[s*t+e]=t===e?mg:dg;tg(i,r)}function ym(t,e,n,r){const s=I(t.head),i=Fm(s,e);try{if(i.isnil){if(s.equals(Tf)){n.pushDirective(ie.expanding,n.getDirective(ie.expanding)+1);try{!function(t,e,n,r){if(tg(ip(t),r),wm(e,n,r),t=ap(t),!_t(t))return tg(Mf,r),void ed(e,n,r);let s,i=0,o=kt;for(;_t(t)||i;)if(i?(s=o,i=0):(tg(Ft(t),r),wm(e,n,r),s=Jm(r),t=Ct(t)),D(s)){tg(s,r);const t=jm(r);tg(Mf,r),s=Jm(r);for(let i=0;i<t;i++)tg(s,r),ed(e,n,r)}else{if(_t(t)){if(tg(Ft(t),r),wm(e,n,r),o=Jm(r),t=Ct(t),D(o)){tg(o,r);const t=jm(r);for(let i=0;i<t;i++)tg(s,r),ed(e,n,r);continue}i=1}tg(s,r),ed(e,n,r)}}(t,e,n,r)}finally{n.popDirective()}return}const i=r.length;tg(s,r);let o=t.rest;for(;_t(o);)tg(o.head,r),wm(e,n,r),o=o.rest;return void Pm(r.length-i,r)}tg(i,r);let o=t.rest;try{for(let t=0;t<9;t++){const t=o.head;try{r.push(t),wm(e,n,r);const s=o.rest;o.release(),o=s}finally{t.release()}}}finally{o.release()}ag(Of,e),ag(Nf,e),ag(Lf,e),ag(Bf,e),ag(qf,e),ag(If,e),ag(Pf,e),ag(Rf,e),ag(Uf,e);try{cg(Uf,Jm(r),kt,e),cg(Rf,Jm(r),kt,e),cg(Pf,Jm(r),kt,e),cg(If,Jm(r),kt,e),cg(qf,Jm(r),kt,e),cg(Bf,Jm(r),kt,e),cg(Lf,Jm(r),kt,e),cg(Nf,Jm(r),kt,e),cg(Of,Jm(r),kt,e),wm(e,n,r)}finally{ug(e),ug(e),ug(e),ug(e),ug(e),ug(e),ug(e),ug(e),ug(e)}}finally{s.release(),i.release()}}function wm(t,e,n){e.pushDirective(ie.depth,e.getDirective(ie.depth)+1);try{200===e.getDirective(ie.depth)&&hg("circular definition?");const r=Jm(n);try{if(_t(r)){const s=r.opr;try{if(v(s)){if(t.hasBinding(s,r)){e.pushDirective(ie.expanding,e.getDirective(ie.expanding)+1);try{const i=t.getBinding(s,r);try{if(St(i)||_t(i)||bt(i),J(i)){const s=new rh(t,e),o=(0,i.body)(r.rest,s);try{n.push(o)}finally{o.release()}}else n.push(i)}finally{i.release()}}finally{e.popDirective()}return}if(t.hasUserFunction(s))return void ym(r,t,e,n)}}finally{s.release()}return void tg(r,n)}if(v(r))return t.hasBinding(r,kt)?(tg(r,n),tg(_f,n),Pm(2,n),void wm(t,e,n)):t.hasUserFunction(r)?void function(t,e,n,r){const s=_m(I(t),kt,e);t.equals(s)?tg(t,r):(tg(s,r),wm(e,n,r))}(r,t,e,n):void tg(r,n);if(b(r))return void lm(r,t,e,n);tg(r,n)}finally{r.release()}}finally{e.popDirective()}}function Em(t,e,n,r,s){if(!jf(t)){if(Qf(1,t,Xf(1),s),Jh(e))return;return tg(kf,s),pg(s),tg(e,s),void Pm(3,s)}const i=s.length;let o=Jf(t);!function(t,e){if(t=Math.abs(t),t<2)return;for(let n=0;n<Dm.length;n++){const r=Dm[n];let s=0;for(;t%r==0;)t/=r,s++;if(0!==s&&(ng(r,e),ng(s,e),1===t))return}ng(t,e),ng(1,e)}(o,s),o=(s.length-i)/2;for(let t=0;t<o;t++){const o=s.getAt(i+2*t+0);let a=s.getAt(i+2*t+1);tg(a,s),tg(e,s),Um(n,r,s),a=Jm(s),Jh(a)?s.setAt(i+t,o):(tg(kf,s),tg(o,s),tg(a,s),Pm(3,s),s.setAt(i+t,Jm(s)))}s.splice(i+o)}function vm(t,e,n){const r=Jm(n);if(Ft(r).equals(kf)){const s=ip(r),i=sp(r);if(!c(s)||!c(i))return void tg(r,n);if(Mh(s))return void tg(r,n);Kh(s)&&(tg(kf,n),ng(-1,n),tg(i,n),Pm(3,n));const o=s.a,a=s.b;if(Ih(o,1)||Em(o,i,t,e,n),!Ih(a,1)){tg(i,n),Xm(t,e,n);Em(a,Jm(n),t,e,n)}return}if(!c(r)||jh(r,t)||Jh(r)||Mh(r))return void tg(r,n);Kh(r)&&ng(-1,n);const s=r.a,i=r.b;Ih(s,1)||Em(s,mg,t,e,n),Ih(i,1)||Em(i,gg,t,e,n)}const Dm=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973,10007,10009,10037,10039,10061,10067,10069,10079,10091,10093,10099,10103,10111,10133,10139,10141,10151,10159,10163,10169,10177,10181,10193,10211,10223,10243,10247,10253,10259,10267,10271,10273,10289,10301,10303,10313,10321,10331,10333,10337,10343,10357,10369,10391,10399,10427,10429,10433,10453,10457,10459,10463,10477,10487,10499,10501,10513,10529,10531,10559,10567,10589,10597,10601,10607,10613,10627,10631,10639,10651,10657,10663,10667,10687,10691,10709,10711,10723,10729,10733,10739,10753,10771,10781,10789,10799,10831,10837,10847,10853,10859,10861,10867,10883,10889,10891,10903,10909,10937,10939,10949,10957,10973,10979,10987,10993,11003,11027,11047,11057,11059,11069,11071,11083,11087,11093,11113,11117,11119,11131,11149,11159,11161,11171,11173,11177,11197,11213,11239,11243,11251,11257,11261,11273,11279,11287,11299,11311,11317,11321,11329,11351,11353,11369,11383,11393,11399,11411,11423,11437,11443,11447,11467,11471,11483,11489,11491,11497,11503,11519,11527,11549,11551,11579,11587,11593,11597,11617,11621,11633,11657,11677,11681,11689,11699,11701,11717,11719,11731,11743,11777,11779,11783,11789,11801,11807,11813,11821,11827,11831,11833,11839,11863,11867,11887,11897,11903,11909,11923,11927,11933,11939,11941,11953,11959,11969,11971,11981,11987,12007,12011,12037,12041,12043,12049,12071,12073,12097,12101,12107,12109,12113,12119,12143,12149,12157,12161,12163,12197,12203,12211,12227,12239,12241,12251,12253,12263,12269,12277,12281,12289,12301,12323,12329,12343,12347,12373,12377,12379,12391,12401,12409,12413,12421,12433,12437,12451,12457,12473,12479,12487,12491,12497,12503,12511,12517,12527,12539,12541,12547,12553,12569,12577,12583,12589,12601,12611,12613,12619,12637,12641,12647,12653,12659,12671,12689,12697,12703,12713,12721,12739,12743,12757,12763,12781,12791,12799,12809,12821,12823,12829,12841,12853,12889,12893,12899,12907,12911,12917,12919,12923,12941,12953,12959,12967,12973,12979,12983,13001,13003,13007,13009,13033,13037,13043,13049,13063,13093,13099,13103,13109,13121,13127,13147,13151,13159,13163,13171,13177,13183,13187,13217,13219,13229,13241,13249,13259,13267,13291,13297,13309,13313,13327,13331,13337,13339,13367,13381,13397,13399,13411,13417,13421,13441,13451,13457,13463,13469,13477,13487,13499,13513,13523,13537,13553,13567,13577,13591,13597,13613,13619,13627,13633,13649,13669,13679,13681,13687,13691,13693,13697,13709,13711,13721,13723,13729,13751,13757,13759,13763,13781,13789,13799,13807,13829,13831,13841,13859,13873,13877,13879,13883,13901,13903,13907,13913,13921,13931,13933,13963,13967,13997,13999,14009,14011,14029,14033,14051,14057,14071,14081,14083,14087,14107,14143,14149,14153,14159,14173,14177,14197,14207,14221,14243,14249,14251,14281,14293,14303,14321,14323,14327,14341,14347,14369,14387,14389,14401,14407,14411,14419,14423,14431,14437,14447,14449,14461,14479,14489,14503,14519,14533,14537,14543,14549,14551,14557,14561,14563,14591,14593,14621,14627,14629,14633,14639,14653,14657,14669,14683,14699,14713,14717,14723,14731,14737,14741,14747,14753,14759,14767,14771,14779,14783,14797,14813,14821,14827,14831,14843,14851,14867,14869,14879,14887,14891,14897,14923,14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073,15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187,15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289,15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391,15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527,15541,15551,15559,15569,15581,15583,15601,15607,15619,15629,15641,15643,15647,15649,15661,15667,15671,15679,15683,15727,15731,15733,15737,15739,15749,15761,15767,15773,15787,15791,15797,15803,15809,15817,15823,15859,15877,15881,15887,15889,15901,15907,15913,15919,15923,15937,15959,15971,15973,15991,16001,16007,16033,16057,16061,16063,16067,16069,16073,16087,16091,16097,16103,16111,16127,16139,16141,16183,16187,16189,16193,16217,16223,16229,16231,16249,16253,16267,16273,16301,16319,16333,16339,16349,16361,16363,16369,16381,16411,16417,16421,16427,16433,16447,16451,16453,16477,16481,16487,16493,16519,16529,16547,16553,16561,16567,16573,16603,16607,16619,16631,16633,16649,16651,16657,16661,16673,16691,16693,16699,16703,16729,16741,16747,16759,16763,16787,16811,16823,16829,16831,16843,16871,16879,16883,16889,16901,16903,16921,16927,16931,16937,16943,16963,16979,16981,16987,16993,17011,17021,17027,17029,17033,17041,17047,17053,17077,17093,17099,17107,17117,17123,17137,17159,17167,17183,17189,17191,17203,17207,17209,17231,17239,17257,17291,17293,17299,17317,17321,17327,17333,17341,17351,17359,17377,17383,17387,17389,17393,17401,17417,17419,17431,17443,17449,17467,17471,17477,17483,17489,17491,17497,17509,17519,17539,17551,17569,17573,17579,17581,17597,17599,17609,17623,17627,17657,17659,17669,17681,17683,17707,17713,17729,17737,17747,17749,17761,17783,17789,17791,17807,17827,17837,17839,17851,17863,17881,17891,17903,17909,17911,17921,17923,17929,17939,17957,17959,17971,17977,17981,17987,17989,18013,18041,18043,18047,18049,18059,18061,18077,18089,18097,18119,18121,18127,18131,18133,18143,18149,18169,18181,18191,18199,18211,18217,18223,18229,18233,18251,18253,18257,18269,18287,18289,18301,18307,18311,18313,18329,18341,18353,18367,18371,18379,18397,18401,18413,18427,18433,18439,18443,18451,18457,18461,18481,18493,18503,18517,18521,18523,18539,18541,18553,18583,18587,18593,18617,18637,18661,18671,18679,18691,18701,18713,18719,18731,18743,18749,18757,18773,18787,18793,18797,18803,18839,18859,18869,18899,18911,18913,18917,18919,18947,18959,18973,18979,19001,19009,19013,19031,19037,19051,19069,19073,19079,19081,19087,19121,19139,19141,19157,19163,19181,19183,19207,19211,19213,19219,19231,19237,19249,19259,19267,19273,19289,19301,19309,19319,19333,19373,19379,19381,19387,19391,19403,19417,19421,19423,19427,19429,19433,19441,19447,19457,19463,19469,19471,19477,19483,19489,19501,19507,19531,19541,19543,19553,19559,19571,19577,19583,19597,19603,19609,19661,19681,19687,19697,19699,19709,19717,19727,19739,19751,19753,19759,19763,19777,19793,19801,19813,19819,19841,19843,19853,19861,19867,19889,19891,19913,19919,19927,19937,19949,19961,19963,19973,19979,19991,19993,19997,20011,20021,20023,20029,20047,20051,20063,20071,20089,20101,20107,20113,20117,20123,20129,20143,20147,20149,20161,20173,20177,20183,20201,20219,20231,20233,20249,20261,20269,20287,20297,20323,20327,20333,20341,20347,20353,20357,20359,20369,20389,20393,20399,20407,20411,20431,20441,20443,20477,20479,20483,20507,20509,20521,20533,20543,20549,20551,20563,20593,20599,20611,20627,20639,20641,20663,20681,20693,20707,20717,20719,20731,20743,20747,20749,20753,20759,20771,20773,20789,20807,20809,20849,20857,20873,20879,20887,20897,20899,20903,20921,20929,20939,20947,20959,20963,20981,20983,21001,21011,21013,21017,21019,21023,21031,21059,21061,21067,21089,21101,21107,21121,21139,21143,21149,21157,21163,21169,21179,21187,21191,21193,21211,21221,21227,21247,21269,21277,21283,21313,21317,21319,21323,21341,21347,21377,21379,21383,21391,21397,21401,21407,21419,21433,21467,21481,21487,21491,21493,21499,21503,21517,21521,21523,21529,21557,21559,21563,21569,21577,21587,21589,21599,21601,21611,21613,21617,21647,21649,21661,21673,21683,21701,21713,21727,21737,21739,21751,21757,21767,21773,21787,21799,21803,21817,21821,21839,21841,21851,21859,21863,21871,21881,21893,21911,21929,21937,21943,21961,21977,21991,21997,22003,22013,22027,22031,22037,22039,22051,22063,22067,22073,22079,22091,22093,22109,22111,22123,22129,22133,22147,22153,22157,22159,22171,22189,22193,22229,22247,22259,22271,22273,22277,22279,22283,22291,22303,22307,22343,22349,22367,22369,22381,22391,22397,22409,22433,22441,22447,22453,22469,22481,22483,22501,22511,22531,22541,22543,22549,22567,22571,22573,22613,22619,22621,22637,22639,22643,22651,22669,22679,22691,22697,22699,22709,22717,22721,22727,22739,22741,22751,22769,22777,22783,22787,22807,22811,22817,22853,22859,22861,22871,22877,22901,22907,22921,22937,22943,22961,22963,22973,22993,23003,23011,23017,23021,23027,23029,23039,23041,23053,23057,23059,23063,23071,23081,23087,23099,23117,23131,23143,23159,23167,23173,23189,23197,23201,23203,23209,23227,23251,23269,23279,23291,23293,23297,23311,23321,23327,23333,23339,23357,23369,23371,23399,23417,23431,23447,23459,23473,23497,23509,23531,23537,23539,23549,23557,23561,23563,23567,23581,23593,23599,23603,23609,23623,23627,23629,23633,23663,23669,23671,23677,23687,23689,23719,23741,23743,23747,23753,23761,23767,23773,23789,23801,23813,23819,23827,23831,23833,23857,23869,23873,23879,23887,23893,23899,23909,23911,23917,23929,23957,23971,23977,23981,23993,24001,24007,24019,24023,24029,24043,24049,24061,24071,24077,24083,24091,24097,24103,24107,24109,24113,24121,24133,24137,24151,24169,24179,24181,24197,24203,24223,24229,24239,24247,24251,24281,24317,24329,24337,24359,24371,24373,24379,24391,24407,24413,24419,24421,24439,24443,24469,24473,24481,24499,24509,24517,24527,24533,24547,24551,24571,24593,24611,24623,24631,24659,24671,24677,24683,24691,24697,24709,24733,24749,24763,24767,24781,24793,24799,24809,24821,24841,24847,24851,24859,24877,24889,24907,24917,24919,24923,24943,24953,24967,24971,24977,24979,24989,25013,25031,25033,25037,25057,25073,25087,25097,25111,25117,25121,25127,25147,25153,25163,25169,25171,25183,25189,25219,25229,25237,25243,25247,25253,25261,25301,25303,25307,25309,25321,25339,25343,25349,25357,25367,25373,25391,25409,25411,25423,25439,25447,25453,25457,25463,25469,25471,25523,25537,25541,25561,25577,25579,25583,25589,25601,25603,25609,25621,25633,25639,25643,25657,25667,25673,25679,25693,25703,25717,25733,25741,25747,25759,25763,25771,25793,25799,25801,25819,25841,25847,25849,25867,25873,25889,25903,25913,25919,25931,25933,25939,25943,25951,25969,25981,25997,25999,26003,26017,26021,26029,26041,26053,26083,26099,26107,26111,26113,26119,26141,26153,26161,26171,26177,26183,26189,26203,26209,26227,26237,26249,26251,26261,26263,26267,26293,26297,26309,26317,26321,26339,26347,26357,26371,26387,26393,26399,26407,26417,26423,26431,26437,26449,26459,26479,26489,26497,26501,26513,26539,26557,26561,26573,26591,26597,26627,26633,26641,26647,26669,26681,26683,26687,26693,26699,26701,26711,26713,26717,26723,26729,26731,26737,26759,26777,26783,26801,26813,26821,26833,26839,26849,26861,26863,26879,26881,26891,26893,26903,26921,26927,26947,26951,26953,26959,26981,26987,26993,27011,27017,27031,27043,27059,27061,27067,27073,27077,27091,27103,27107,27109,27127,27143,27179,27191,27197,27211,27239,27241,27253,27259,27271,27277,27281,27283,27299,27329,27337,27361,27367,27397,27407,27409,27427,27431,27437,27449,27457,27479,27481,27487,27509,27527,27529,27539,27541,27551,27581,27583,27611,27617,27631,27647,27653,27673,27689,27691,27697,27701,27733,27737,27739,27743,27749,27751,27763,27767,27773,27779,27791,27793,27799,27803,27809,27817,27823,27827,27847,27851,27883,27893,27901,27917,27919,27941,27943,27947,27953,27961,27967,27983,27997,28001,28019,28027,28031,28051,28057,28069,28081,28087,28097,28099,28109,28111,28123,28151,28163,28181,28183,28201,28211,28219,28229,28277,28279,28283,28289,28297,28307,28309,28319,28349,28351,28387,28393,28403,28409,28411,28429,28433,28439,28447,28463,28477,28493,28499,28513,28517,28537,28541,28547,28549,28559,28571,28573,28579,28591,28597,28603,28607,28619,28621,28627,28631,28643,28649,28657,28661,28663,28669,28687,28697,28703,28711,28723,28729,28751,28753,28759,28771,28789,28793,28807,28813,28817,28837,28843,28859,28867,28871,28879,28901,28909,28921,28927,28933,28949,28961,28979,29009,29017,29021,29023,29027,29033,29059,29063,29077,29101,29123,29129,29131,29137,29147,29153,29167,29173,29179,29191,29201,29207,29209,29221,29231,29243,29251,29269,29287,29297,29303,29311,29327,29333,29339,29347,29363,29383,29387,29389,29399,29401,29411,29423,29429,29437,29443,29453,29473,29483,29501,29527,29531,29537,29567,29569,29573,29581,29587,29599,29611,29629,29633,29641,29663,29669,29671,29683,29717,29723,29741,29753,29759,29761,29789,29803,29819,29833,29837,29851,29863,29867,29873,29879,29881,29917,29921,29927,29947,29959,29983,29989,30011,30013,30029,30047,30059,30071,30089,30091,30097,30103,30109,30113,30119,30133,30137,30139,30161,30169,30181,30187,30197,30203,30211,30223,30241,30253,30259,30269,30271,30293,30307,30313,30319,30323,30341,30347,30367,30389,30391,30403,30427,30431,30449,30467,30469,30491,30493,30497,30509,30517,30529,30539,30553,30557,30559,30577,30593,30631,30637,30643,30649,30661,30671,30677,30689,30697,30703,30707,30713,30727,30757,30763,30773,30781,30803,30809,30817,30829,30839,30841,30851,30853,30859,30869,30871,30881,30893,30911,30931,30937,30941,30949,30971,30977,30983,31013,31019,31033,31039,31051,31063,31069,31079,31081,31091,31121,31123,31139,31147,31151,31153,31159,31177,31181,31183,31189,31193,31219,31223,31231,31237,31247,31249,31253,31259,31267,31271,31277,31307,31319,31321,31327,31333,31337,31357,31379,31387,31391,31393,31397,31469,31477,31481,31489,31511,31513,31517,31531,31541,31543,31547,31567,31573,31583,31601,31607,31627,31643,31649,31657,31663,31667,31687,31699,31721,31723,31727,31729,31741,31751,31769,31771,31793,31799,31817,31847,31849,31859,31873,31883,31891,31907,31957,31963,31973,31981,31991,32003,32009,32027,32029,32051,32057,32059,32063,32069,32077,32083,32089,32099,32117,32119,32141,32143,32159,32173,32183,32189,32191,32203,32213,32233,32237,32251,32257,32261,32297,32299,32303,32309,32321,32323,32327,32341,32353,32359,32363,32369,32371,32377,32381,32401,32411,32413,32423,32429,32441,32443,32467,32479,32491,32497,32503,32507,32531,32533,32537,32561,32563,32569,32573,32579,32587,32603,32609,32611,32621,32633,32647,32653,32687,32693,32707,32713,32717,32719,32749,32771,32779,32783,32789,32797,32801,32803,32831,32833,32839,32843,32869,32887,32909,32911,32917,32933,32939,32941,32957,32969,32971,32983,32987,32993,32999,33013,33023,33029,33037,33049,33053,33071,33073,33083,33091,33107,33113,33119,33149,33151,33161,33179,33181,33191,33199,33203,33211,33223,33247,33287,33289,33301,33311,33317,33329,33331,33343,33347,33349,33353,33359,33377,33391,33403,33409,33413,33427,33457,33461,33469,33479,33487,33493,33503,33521,33529,33533,33547,33563,33569,33577,33581,33587,33589,33599,33601,33613,33617,33619,33623,33629,33637,33641,33647,33679,33703,33713,33721,33739,33749,33751,33757,33767,33769,33773,33791,33797,33809,33811,33827,33829,33851,33857,33863,33871,33889,33893,33911,33923,33931,33937,33941,33961,33967,33997,34019,34031,34033,34039,34057,34061,34123,34127,34129,34141,34147,34157,34159,34171,34183,34211,34213,34217,34231,34253,34259,34261,34267,34273,34283,34297,34301,34303,34313,34319,34327,34337,34351,34361,34367,34369,34381,34403,34421,34429,34439,34457,34469,34471,34483,34487,34499,34501,34511,34513,34519,34537,34543,34549,34583,34589,34591,34603,34607,34613,34631,34649,34651,34667,34673,34679,34687,34693,34703,34721,34729,34739,34747,34757,34759,34763,34781,34807,34819,34841,34843,34847,34849,34871,34877,34883,34897,34913,34919,34939,34949,34961,34963,34981,35023,35027,35051,35053,35059,35069,35081,35083,35089,35099,35107,35111,35117,35129,35141,35149,35153,35159,35171,35201,35221,35227,35251,35257,35267,35279,35281,35291,35311,35317,35323,35327,35339,35353,35363,35381,35393,35401,35407,35419,35423,35437,35447,35449,35461,35491,35507,35509,35521,35527,35531,35533,35537,35543,35569,35573,35591,35593,35597,35603,35617,35671,35677,35729,35731,35747,35753,35759,35771,35797,35801,35803,35809,35831,35837,35839,35851,35863,35869,35879,35897,35899,35911,35923,35933,35951,35963,35969,35977,35983,35993,35999,36007,36011,36013,36017,36037,36061,36067,36073,36083,36097,36107,36109,36131,36137,36151,36161,36187,36191,36209,36217,36229,36241,36251,36263,36269,36277,36293,36299,36307,36313,36319,36341,36343,36353,36373,36383,36389,36433,36451,36457,36467,36469,36473,36479,36493,36497,36523,36527,36529,36541,36551,36559,36563,36571,36583,36587,36599,36607,36629,36637,36643,36653,36671,36677,36683,36691,36697,36709,36713,36721,36739,36749,36761,36767,36779,36781,36787,36791,36793,36809,36821,36833,36847,36857,36871,36877,36887,36899,36901,36913,36919,36923,36929,36931,36943,36947,36973,36979,36997,37003,37013,37019,37021,37039,37049,37057,37061,37087,37097,37117,37123,37139,37159,37171,37181,37189,37199,37201,37217,37223,37243,37253,37273,37277,37307,37309,37313,37321,37337,37339,37357,37361,37363,37369,37379,37397,37409,37423,37441,37447,37463,37483,37489,37493,37501,37507,37511,37517,37529,37537,37547,37549,37561,37567,37571,37573,37579,37589,37591,37607,37619,37633,37643,37649,37657,37663,37691,37693,37699,37717,37747,37781,37783,37799,37811,37813,37831,37847,37853,37861,37871,37879,37889,37897,37907,37951,37957,37963,37967,37987,37991,37993,37997,38011,38039,38047,38053,38069,38083,38113,38119,38149,38153,38167,38177,38183,38189,38197,38201,38219,38231,38237,38239,38261,38273,38281,38287,38299,38303,38317,38321,38327,38329,38333,38351,38371,38377,38393,38431,38447,38449,38453,38459,38461,38501,38543,38557,38561,38567,38569,38593,38603,38609,38611,38629,38639,38651,38653,38669,38671,38677,38693,38699,38707,38711,38713,38723,38729,38737,38747,38749,38767,38783,38791,38803,38821,38833,38839,38851,38861,38867,38873,38891,38903,38917,38921,38923,38933,38953,38959,38971,38977,38993,39019,39023,39041,39043,39047,39079,39089,39097,39103,39107,39113,39119,39133,39139,39157,39161,39163,39181,39191,39199,39209,39217,39227,39229,39233,39239,39241,39251,39293,39301,39313,39317,39323,39341,39343,39359,39367,39371,39373,39383,39397,39409,39419,39439,39443,39451,39461,39499,39503,39509,39511,39521,39541,39551,39563,39569,39581,39607,39619,39623,39631,39659,39667,39671,39679,39703,39709,39719,39727,39733,39749,39761,39769,39779,39791,39799,39821,39827,39829,39839,39841,39847,39857,39863,39869,39877,39883,39887,39901,39929,39937,39953,39971,39979,39983,39989,40009,40013,40031,40037,40039,40063,40087,40093,40099,40111,40123,40127,40129,40151,40153,40163,40169,40177,40189,40193,40213,40231,40237,40241,40253,40277,40283,40289,40343,40351,40357,40361,40387,40423,40427,40429,40433,40459,40471,40483,40487,40493,40499,40507,40519,40529,40531,40543,40559,40577,40583,40591,40597,40609,40627,40637,40639,40693,40697,40699,40709,40739,40751,40759,40763,40771,40787,40801,40813,40819,40823,40829,40841,40847,40849,40853,40867,40879,40883,40897,40903,40927,40933,40939,40949,40961,40973,40993,41011,41017,41023,41039,41047,41051,41057,41077,41081,41113,41117,41131,41141,41143,41149,41161,41177,41179,41183,41189,41201,41203,41213,41221,41227,41231,41233,41243,41257,41263,41269,41281,41299,41333,41341,41351,41357,41381,41387,41389,41399,41411,41413,41443,41453,41467,41479,41491,41507,41513,41519,41521,41539,41543,41549,41579,41593,41597,41603,41609,41611,41617,41621,41627,41641,41647,41651,41659,41669,41681,41687,41719,41729,41737,41759,41761,41771,41777,41801,41809,41813,41843,41849,41851,41863,41879,41887,41893,41897,41903,41911,41927,41941,41947,41953,41957,41959,41969,41981,41983,41999,42013,42017,42019,42023,42043,42061,42071,42073,42083,42089,42101,42131,42139,42157,42169,42179,42181,42187,42193,42197,42209,42221,42223,42227,42239,42257,42281,42283,42293,42299,42307,42323,42331,42337,42349,42359,42373,42379,42391,42397,42403,42407,42409,42433,42437,42443,42451,42457,42461,42463,42467,42473,42487,42491,42499,42509,42533,42557,42569,42571,42577,42589,42611,42641,42643,42649,42667,42677,42683,42689,42697,42701,42703,42709,42719,42727,42737,42743,42751,42767,42773,42787,42793,42797,42821,42829,42839,42841,42853,42859,42863,42899,42901,42923,42929,42937,42943,42953,42961,42967,42979,42989,43003,43013,43019,43037,43049,43051,43063,43067,43093,43103,43117,43133,43151,43159,43177,43189,43201,43207,43223,43237,43261,43271,43283,43291,43313,43319,43321,43331,43391,43397,43399,43403,43411,43427,43441,43451,43457,43481,43487,43499,43517,43541,43543,43573,43577,43579,43591,43597,43607,43609,43613,43627,43633,43649,43651,43661,43669,43691,43711,43717,43721,43753,43759,43777,43781,43783,43787,43789,43793,43801,43853,43867,43889,43891,43913,43933,43943,43951,43961,43963,43969,43973,43987,43991,43997,44017,44021,44027,44029,44041,44053,44059,44071,44087,44089,44101,44111,44119,44123,44129,44131,44159,44171,44179,44189,44201,44203,44207,44221,44249,44257,44263,44267,44269,44273,44279,44281,44293,44351,44357,44371,44381,44383,44389,44417,44449,44453,44483,44491,44497,44501,44507,44519,44531,44533,44537,44543,44549,44563,44579,44587,44617,44621,44623,44633,44641,44647,44651,44657,44683,44687,44699,44701,44711,44729,44741,44753,44771,44773,44777,44789,44797,44809,44819,44839,44843,44851,44867,44879,44887,44893,44909,44917,44927,44939,44953,44959,44963,44971,44983,44987,45007,45013,45053,45061,45077,45083,45119,45121,45127,45131,45137,45139,45161,45179,45181,45191,45197,45233,45247,45259,45263,45281,45289,45293,45307,45317,45319,45329,45337,45341,45343,45361,45377,45389,45403,45413,45427,45433,45439,45481,45491,45497,45503,45523,45533,45541,45553,45557,45569,45587,45589,45599,45613,45631,45641,45659,45667,45673,45677,45691,45697,45707,45737,45751,45757,45763,45767,45779,45817,45821,45823,45827,45833,45841,45853,45863,45869,45887,45893,45943,45949,45953,45959,45971,45979,45989,46021,46027,46049,46051,46061,46073,46091,46093,46099,46103,46133,46141,46147,46153,46171,46181,46183,46187,46199,46219,46229,46237,46261,46271,46273,46279,46301,46307,46309,46327,46337];function bm(t,e,n,r){if(Ft(t).equals(Af)){for(t=Ct(t);_t(t);){if(Am(Ft(t),e,n,r))return 1;t=Ct(t)}return 0}return Am(t,e,n,r)}function Am(t,e,n,r){if(Ft(t).equals(Sf)){for(t=Ct(t);_t(t);){if(Sm(Ft(t),e,n,r))return 1;t=Ct(t)}return 0}return Sm(t,e,n,r)}function Sm(t,e,n,r){if(c(t)&&t.isInteger())return 0;if(c(t))return tg(t,r),td(e,n,r),1;if(_t(t)&&mi(t)){const s=t.base,i=t.expo;if(Mh(i)){if(!Mh(s))return tg(s,r),1}else if(!Mh(s)&&Hh(i))return tg(kf,r),tg(s,r),tg(i,r),Xm(e,n,r),Pm(3,r),1}return 0}function km(t,e){if(yp(t,e))return 1;if(b(t)){const n=t.nelem;for(let r=0;r<n;r++)if(km(t.elems[r],e))return 1;return 0}for(;_t(t);){if(km(Ft(t),e))return 1;t=Ct(t)}return 0}function _m(t,e,n){v(t)||hg(`get_binding(${t}) argument must be a Sym.`);const r=n.getBinding(t,e);return null==r||r.isnil?t:r}function Fm(t,e){if(e.hasUserFunction(t)){const n=e.getUserFunction(t);return null==n?kt:n}return kt}function Cm(t,e,n,r){if(_t(t)&&t.opr.equals(Sf)){if(3===t.length){const e=t.lhs,n=t.rhs;try{if(e.equals(Cf)&&n.equals(A))return 1;if(e.equals(A)&&n.equals(Cf))return 1}finally{e.release(),n.release()}}return 4===$h(t)&&D(ip(t))&&L(sp(t))&&rp(t).equals(Cf)?(t=ip(t),D(t)&&Kh(t)?1:(tg(t,r),sg(-1,2,r),Ep(e,n,r),t=Jm(r),D(t)&&Kh(t)?0:1)):0}return 0}function Tm(t){if(l(t))return 1;if(_t(t))for(t=Ct(t);_t(t);){if(Tm(Ft(t)))return 1;t=Ct(t)}return 0}function Mm(t){return L(t)||3===$h(t)&&Ft(t).equals(Sf)&&D(ip(t))&&L(sp(t))}function Om(t){return Ft(t).equals(kf)&&Th(ip(t),2)&&Ch(sp(t),-1,2)}function Nm(t){if(Ft(t).equals(kf)){const e=ip(t),n=sp(t);return c(e)&&Gh(e)&&c(n)&&Wh(n)}return!1}function Lm(t){return c(t)&&Xh(t)?jf(t.a):!!l(t)&&(t.d===Math.floor(t.d)&&Math.abs(t.d)<=2147483647)}function Bm(t){return qm(t)&&2===t.ndim&&t.dims[0]===t.dims[1]}function qm(t){return b(t)}function Im(t,e){if(v(t)&&e.hasUserFunction(t)&&!t.equalsSym(Cf)&&!t.equalsSym(Ff))return 1;if(_t(t))for(t=Ct(t);_t(t);){if(Im(Ft(t),e))return 1;t=Ct(t)}return 0}function Pm(t,e){tg(kt,e);for(let n=0;n<t;n++)mp(e)}function Rm(t,e){return e.hasBinding(t,kt)||e.defineUserSymbol(t),t}function Um(t,e,n){$m(2,t,e,n)}function $m(n,r,s,i){if(n<2)return;const o=i.length-n;Bh(o,Sf,i);const a=function(t,e){let n=kt,r=e.length;for(let s=t;s<r;s++){const t=e.getAt(s);k(t)&&(n=k(n)?n.mul(t):t,e.splice(s,1),s--,r--)}return n}(o,i);k(a)&&tg(a,i);const u=function(n,r,s,i){let o=kt,a=i.length;for(let u=n;u<a;u++){const n=i.getAt(u);try{if(!M(n))continue;bt(o)?o=n:(tg(t(e.multiply),i),tg(o,i),tg(n,i),Pm(3,i),wm(r,s,i),o=i.pop()),i.splice(u,1),u--,a--}finally{n.release()}}return o}(o,r,s,i);c(u)&&u.isOne()||bt(u)||tg(u,i);const h=function(t,e,n,r){let s=kt,i=r.length;for(let o=t;o<i;o++){const t=r.getAt(o);qm(t)&&(b(s)?(tg(s,r),tg(t,r),Fh(e,n,r),s=Jm(r)):s=t,r.splice(o,1),o--,i--)}return s}(o,r,s,i);!function(t,e,n,r){const s=fp(t,mg,r);if(T(s))return r.splice(t),void tg(s,r);if(jh(s,e)||t===r.length)return r.splice(t),void tg(s,r);lp(t,e,n,r),Hm(t,e,n,r),lp(t,e,n,r),Hm(t,e,n,r);const i=fp(t,s,r);if(T(i))return r.splice(t),void tg(i,r);if(jh(i,e)||t===r.length)return r.splice(t),void tg(i,r);const o=function(t,e,n,r,s){if(!function(t,e){const n=e.length;for(let r=t;r<n;r++)if(Nm(e.getAt(r)))return 1;return 0}(t,s))return e;return c(e)?function(t,e,n,r,s){if(Jh(e)||Mh(e))return e;tg(e,s),wp(n,r,s);let i=Jm(s);tg(i,s),zd(n,r,s);let o=Jm(s);tg(i,s),td(n,r,s);let a=Jm(s),u=0;const c=s.length;for(let e=t;e<c;e++){if(i=s.getAt(e),!Nm(i))continue;const t=ip(i),c=sp(i);if(D(c)&&Kh(c)){Md(o,t,s);jh(Jm(s),n)&&(tg(o,s),tg(t,s),xp(n,r,s),o=Jm(s),tg(kf,s),tg(t,s),ng(1,s),tg(c,s),Ep(n,r,s),Pm(3,s),s.setAt(e,Jm(s)),u++)}else{Md(a,t,s);jh(Jm(s),n)&&(tg(a,s),tg(t,s),xp(n,r,s),a=Jm(s),tg(kf,s),tg(t,s),ng(-1,s),tg(c,s),Ep(n,r,s),Pm(3,s),s.setAt(e,Jm(s)),u++)}}u&&(tg(o,s),tg(a,s),xp(n,r,s),Kh(e)&&Xm(n,r,s),e=Jm(s));return e}(t,e,n,r,s):function(t,e,n){let r=e.d,s=n.length;for(let e=t;e<s;e++){const t=n.getAt(e);if(Nm(t)){tg(ip(t),n);const i=Vm(n);tg(sp(t),n);const o=Vm(n);r*=Math.pow(i,o),n.splice(e,1),e--,s--}}eg(r,n);const i=Jm(n);return i}(t,e,s)}(t,i,e,n,r);Jh(o)&&!l(o)||tg(o,r);n.getDirective(ie.expanding)&&function(t,e,n,r){let s,i=r.length;if(i-t<2)return;let o=kt;for(s=t;s<i&&(o=r.getAt(s),!Ft(o).equals(Af));s++);if(s===i)return;r.splice(s,1),i=r.length-t,i>1&&(lg(t,n,r),Pm(i,r),tg(Sf,r),pg(r),mp(r));const a=Jm(r);for(o=Ct(o);_t(o);)tg(a,r),tg(Ft(o),r),Um(e,n,r),o=Ct(o);vp(r.length-t,e,n,r)}(t,e,n,r);const a=r.length-t;switch(a){case 0:ng(1,r);break;case 1:break;default:lg(t,n,r),Pm(a,r),tg(Sf,r),pg(r),mp(r)}}(o,r,s,i),b(h)&&(tg(h,i),wd(r,s,i))}function zm(t,e,n){e.pushDirective(ie.expanding,0);try{Um(t,e,n)}finally{e.popDirective()}}function Wm(t,e,n){if(c(t)&&c(e))return void function(t,e,n){const r=t.mul(e);tg(r,n)}(t,e,n);eg(t.toNumber()*e.toNumber(),n)}function Xm(t,e,n){ng(-1,n),$m(2,t,e,n)}function Km(t,e,n,r){if(3===$h(t))return void ng(-1,r);const s=ip(t);c(s)?function(t,e,n,r){tg(t,r),ng(2,r),Td(e,n,r),t=Jm(r),D(t)&&Kh(t)&&(tg(t,r),ng(2,r),Ep(e,n,r),t=Jm(r));tg(t,r),ng(2,r),Um(e,n,r),dd(e,n,r);const s=jm(r);switch(tg(t,r),ng(s,r),sg(-1,2,r),Um(e,n,r),Ep(e,n,r),t=Jm(r),s){case 0:jh(t,e)?ng(1,r):(tg(kf,r),tg(Ff,r),tg(Sf,r),tg(t,r),tg(A,r),tg(Cf,r),Pm(4,r),Pm(3,r));break;case 1:jh(t,e)?tg(A,r):(tg(Sf,r),tg(A,r),tg(kf,r),tg(Ff,r),tg(Sf,r),tg(t,r),tg(A,r),tg(Cf,r),Pm(4,r),Pm(3,r),Pm(3,r));break;case 2:jh(t,e)?ng(-1,r):(tg(Sf,r),ng(-1,r),tg(kf,r),tg(Ff,r),tg(Sf,r),tg(t,r),tg(A,r),tg(Cf,r),Pm(4,r),Pm(3,r),Pm(3,r));break;case 3:jh(t,e)?(tg(Sf,r),ng(-1,r),tg(A,r),Pm(3,r)):(tg(Sf,r),ng(-1,r),tg(A,r),tg(kf,r),tg(Ff,r),tg(Sf,r),tg(t,r),tg(A,r),tg(Cf,r),Pm(4,r),Pm(3,r),Pm(4,r))}}(s,e,n,r):function(t,e){let n=t.d;n%=2,n<0&&(n+=2);const r=Math.floor(2*n),s=n-r/2;switch(r){case 0:0===s?ng(1,e):(tg(kf,e),tg(Ff,e),tg(Sf,e),eg(s,e),tg(A,e),tg(Cf,e),Pm(4,e),Pm(3,e));break;case 1:0===s?tg(A,e):(tg(Sf,e),tg(A,e),tg(kf,e),tg(Ff,e),tg(Sf,e),eg(s,e),tg(A,e),tg(Cf,e),Pm(4,e),Pm(3,e),Pm(3,e));break;case 2:0===s?ng(-1,e):(tg(Sf,e),ng(-1,e),tg(kf,e),tg(Ff,e),tg(Sf,e),eg(s,e),tg(A,e),tg(Cf,e),Pm(4,e),Pm(3,e),Pm(3,e));break;case 3:0===s?(tg(Sf,e),ng(-1,e),tg(A,e),Pm(3,e)):(tg(Sf,e),ng(-1,e),tg(A,e),tg(kf,e),tg(Ff,e),tg(Sf,e),eg(s,e),tg(A,e),tg(Cf,e),Pm(4,e),Pm(3,e),Pm(4,e))}}(s,r)}function Hm(t,e,n,r){const s=r.length;for(let i=t;i<s;i++){let t=r.getAt(i);if(Ft(t).equals(kf))if(tg(ip(t),r),tg(sp(t),r),Gd(e,n,r),t=Jm(r),Ft(t).equals(Sf))for(t=Ct(t),r.setAt(i,Ft(t)),t=Ct(t);_t(t);)tg(Ft(t),r),t=Ct(t);else r.setAt(i,t)}}function Jm(t){return t.pop()}function Gm(t){if(D(t))return t.toNumber();throw new Vt(`assert_num_to_number() number expected ${t} `)}function Vm(t){const e=Jm(t);try{if(D(e))return e.toNumber();hg("pop_double() number expected")}finally{e.release()}}function jm(t){const e=Jm(t);try{if(Lm(e)||hg("small integer expected"),c(e)){const t=Jf(e.a);return Kh(e)?-t:t}if(l(e))return e.d;throw new Vt}finally{e.release()}}function Qm(t,e,n,r){if(Ch(t,1,2))tg(A,r);else if(c(t)&&Hf(t.b))Hf(t.a)?ng(-1,r):ng(1,r);else if(c(t))!function(t,e,n,r){tg(t,r),ng(2,r),Td(e,n,r);let s=Jm(r);D(s)&&Kh(s)&&(tg(s,r),ng(2,r),Ep(e,n,r),s=Jm(r));tg(s,r),ng(2,r),Um(e,n,r),dd(e,n,r);const i=jm(r);switch(tg(s,r),ng(i,r),sg(-1,2,r),Um(e,n,r),Ep(e,n,r),s=Jm(r),i){case 0:jh(s,e)?ng(1,r):(tg(kf,r),ng(-1,r),tg(s,r),Pm(3,r));break;case 1:jh(s,e)?tg(A,r):(tg(Sf,r),ng(-1,r),tg(kf,r),ng(-1,r),tg(s,r),sg(-1,2,r),Ep(e,n,r),Pm(3,r),Pm(3,r));break;case 2:jh(s,e)?ng(-1,r):(tg(Sf,r),ng(-1,r),tg(kf,r),ng(-1,r),tg(s,r),Pm(3,r),Pm(3,r));break;case 3:jh(s,e)?(tg(Sf,r),ng(-1,r),tg(A,r),Pm(3,r)):(tg(kf,r),ng(-1,r),tg(s,r),sg(-1,2,r),Ep(e,n,r),Pm(3,r))}}(t,e,n,r);else{if(l(t))return function(t,e){let n=t.d;n%=2,n<0&&(n+=2);const r=Math.floor(2*n),s=n-r/2;switch(r){case 0:0===s?ng(1,e):(tg(kf,e),ng(-1,e),eg(s,e),Pm(3,e));break;case 1:0===s?tg(A,e):(tg(Sf,e),ng(-1,e),tg(kf,e),ng(-1,e),eg(s-.5,e),Pm(3,e),Pm(3,e));break;case 2:0===s?ng(-1,e):(tg(Sf,e),ng(-1,e),tg(kf,e),ng(-1,e),eg(s,e),Pm(3,e),Pm(3,e));break;case 3:0===s?(tg(Sf,e),ng(-1,e),tg(A,e),Pm(3,e)):(tg(kf,e),ng(-1,e),eg(s-.5,e),Pm(3,e))}}(t,r),void em(e,n,r);tg(kf,r),ng(-1,r),tg(t,r),Pm(3,r)}}function Zm(t,e,n,r){let s,i;return zh(t)?(Ft(t).equals(Af)?(s=ip(t).d,i=np(t).d):(s=0,i=ip(t).d),eg(Math.exp(s),r),eg(i,r),Qp(e,n,r),tg(A,r),eg(i,r),sm(e,n,r),Um(e,n,r),Ep(e,n,r),void Um(e,n,r)):_t(t)&&t.opr.equals(yf)?(tg(t,r),r.rest(),r.head(),void tg(ip(t),r)):void(function(t,e,n,r){if(Ft(t).equals(Af)){for(t=Ct(t);_t(t);){if(Cm(Ft(t),e,n,r))return 1;t=Ct(t)}return 0}return Cm(t,e,n,r)}(t,e,n,r)?function(t,e,n,r){if(Ft(t).equals(Af)){const s=r.length;let i=Ct(t);for(;_t(i);)Cm(t=Ft(i),e,n,r)?Km(t,e,n,r):(tg(kf,r),tg(Ff,r),tg(t,r),Pm(3,r)),i=Ct(i);$m(r.length-s,e,n,r)}else Km(t,e,n,r)}(t,e,n,r):(tg(kf,r),tg(Ff,r),tg(t,r),Pm(3,r)))}function Ym(t,e,n,r,s){if(Mh(t)){Qm(e,n,r,s);let t=Jm(s);if(Ft(t).equals(Sf))for(t=Ct(t);_t(t);)tg(Ft(t),s),t=Ct(t);else tg(t,s);return}if(Xh(e)){const n=ep(t.a,e.a),r=Xf(1);return void(Kh(e)?Qf(1,r,n,s):Qf(1,n,r,s))}const i=Yf(e.a,e.b),o=tp(e.a,e.b);if(!Kf(i)){const n=ep(t.a,i),r=Xf(1);Kh(e)?Qf(1,r,n,s):Qf(1,n,r,s)}if("number"==typeof Jf(t.a))return tg(kf,s),tg(t,s),Qf(e.sign,o,e.b,s),void Pm(3,s);const a=(u=t.a,c=e.b,u.pow(new g(BigInt(1)).divide(c)));var u,c;if(null===a)return tg(kf,s),tg(t,s),Qf(e.sign,o,e.b,s),void Pm(3,s);const l=ep(a,o);Kh(e)?Qf(1,Xf(1),l,s):Qf(1,l,Xf(1),s)}function tg(t,e){e.push(t)}function eg(t,e){const n=new d(t);try{e.push(n)}finally{n.release()}}function ng(t,e){sg(t,1,e)}function rg(e,n){const r=t(e);try{n.push(r)}finally{r.release()}}function sg(t,e,n){const r=y(t,e);try{tg(r,n)}finally{r.release()}}function ig(t,e,n){ng(-1,n),Gd(t,e,n)}const og=new du;function ag(t,e){const n=_m(t,kt,e),r=Fm(t,e);try{og.push(t),og.push(n),og.push(r)}finally{n.release(),r.release()}}function ug(t){const e=og.pop(),n=og.pop(),r=I(og.pop());try{cg(r,n,e,t)}finally{e.release(),n.release(),r.release()}}function cg(t,e,n,r){r.setBinding(t,e),r.setUserFunction(t,n)}function lg(n,r,s){const i=r.compareFn(t(e.multiply)),o=s.splice(n).sort(i);s.concat(o)}function hg(t){throw new Error(t)}function fg(t,e,n){Xm(t,e,n),vp(2,t,e,n)}function pg(t){const e=Jm(t),n=Jm(t);try{tg(e,t),tg(n,t)}finally{n.release(),e.release()}}const dg=x(0),mg=x(1),gg=x(-1),xg=G.KILOGRAM.mul(G.METER).div(G.SECOND).div(G.SECOND),yg=xg.mul(G.METER),wg=yg.div(G.SECOND),Eg=yg.div(G.COULOMB),vg=xg.div(G.COULOMB).div(G.METER.div(G.SECOND)),Dg=Eg.div(G.AMPERE),bg=G.ONE,Ag=G.COULOMB.div(Eg),Sg=Dg.mul(G.SECOND),kg=Sg.mul(G.AMPERE),_g=G.ONE.div(G.SECOND),Fg=yg.div(G.METER.pow(H.valueOf(3,1))),Cg=G.ONE.div(Dg),Tg=["ampere","candela","coulomb","farad","henry","hertz","joule","kelvin","kilogram","meter","metre","mole","newton","ohm","one","pascal","second","siemens","tesla","volt","watt","weber"],Mg=new Map;function Og(t){if(Mg.has(t))return Mg.get(t);throw new Error(`Unknown name ${t}`)}Mg.set("ampere",G.AMPERE),Mg.set("candela",G.CANDELA),Mg.set("coulomb",G.COULOMB),Mg.set("farad",Ag),Mg.set("henry",Sg),Mg.set("hertz",_g),Mg.set("joule",yg),Mg.set("kelvin",G.KELVIN),Mg.set("kilogram",G.KILOGRAM),Mg.set("meter",G.METER),Mg.set("metre",G.METER),Mg.set("mole",G.MOLE),Mg.set("newton",xg),Mg.set("ohm",Dg),Mg.set("one",bg),Mg.set("pascal",Fg),Mg.set("second",G.SECOND),Mg.set("siemens",Cg),Mg.set("tesla",vg),Mg.set("volt",Eg),Mg.set("watt",wg),Mg.set("weber",kg);const Ng=0,Lg=1,Bg=2;function qg(t){if(St(t))return t.type;throw new Error(`${t} is not an atom`)}const Ig=new class{reaction(t,e){}reset(t,e,n){}deref(t,e){}},Pg=new V(kt,Ig);const Rg=qg(Z),Ug=qg($),$g=qg(Pg);qg(new R([])),qg(Ut(kt));const zg=qg(X(1)),Wg=qg(Y),Xg=qg(A),Kg=qg(new j((function(){return kt}),"???")),Hg=qg(x(1)),Jg=qg(Q("")),Gg=qg(f("x")),Vg=qg(P([])),jg=qg(Og("kilogram")),Qg="U",Zg="Nil";function Yg(t,e,n){return`(${t.key()} ${e} ${n})`}function tx(t,e,n){return`(${t.key()} ${e} (${n.key()}))`}function ex(t,e,n){return`(${t.key()} (${e.key()}) ${n})`}function nx(t,e){return`(${t.key()} ${e})`}function rx(t,e){return`(${t.key()} (${e.key()}))`}function sx(t){return`(${t.key()})`}function ix(t){const e=[],n=ax(t,0);if(e.push(ox(n)),n.kind===Lg)3===n.parts.length&&(e.push(ox({kind:Lg,parts:[n.parts[0],n.parts[1],Qg]})),e.push(ox({kind:Lg,parts:[n.parts[0],Qg,n.parts[2]]})),e.push(ox({kind:Lg,parts:[n.parts[0],Qg,Qg]})),e.push(ox({kind:Lg,parts:[n.parts[0]]}))),2===n.parts.length&&(e.push(ox({kind:Lg,parts:[n.parts[0],Qg]})),e.push(ox({kind:Lg,parts:[n.parts[0]]})));return e}function ox(t){switch(t.kind){case Lg:return`(${t.parts.join(" ")})`;case Bg:return t.parts[0];default:return Zg}}function ax(t,e){if(_t(t)){if(0===e){if(3===t.length){const n=t.opr,r=t.lhs,s=t.rhs;return{kind:Lg,parts:[ux(n),ox(ax(r,e+1)),ox(ax(s,e+1))]}}if(2===t.length){const n=t.opr,r=t.arg;return{kind:Lg,parts:[ux(n),ox(ax(r,e+1))]}}if(v(t.head))return{kind:Lg,parts:[ux(t.head)]};if(c(t.head))return{kind:Lg,parts:[ux(t.head)]};throw new Error(`${t}`)}return{kind:Lg,parts:[ux(t.opr)]}}if(St(t))return{kind:Bg,parts:[qg(t)]};if(bt(t))return{kind:Ng,parts:[Zg]};throw new Error(`hash_string(${t})`)}function ux(t){if(v(t))return t.key();if(c(t))return qg(t);if(N(t))return t.toString();if(h(t))return qg(t);throw new Error(`hash_arg(arg=${t})`)}const cx=t(e.simplify);function lx(t,e){const n=At(cx,t);try{return e.valueOf(n)}finally{n.release()}}function hx(t,e){return jt(e.valueOf(t))}function fx(t,e){const n=e.valueOf(Ai(t));if(b(n)&&kx(n)){const r=n.dim(0),s=hx(_i(t),e);(s<1||s>r)&&Je("cofactor: 2nd arg: row index expected");const i=hx(Ti(t),e);return(i<1||i>r)&&Je("cofactor: 3rd arg: column index expected"),px(n,s-1,i-1,e)}Je("cofactor: 1st arg: square matrix expected")}function px(t,e,n,r){const s=t.dim(0),i=[];for(let r=0;r<s;r++)for(let o=0;o<s;o++)r!==e&&o!==n&&i.push(t.elem(s*r+o));const o=Yl(i,s-1,r);return(e+n)%2?Yn(r,o):o}const dx=t(e.abs),mx=t(e.add),gx=t(e.isone),xx=t(e.multiply);function yx(t,e,n){return t.sameDimensions(e)?t.map((function(t,r){return function(t,e,n){const r=At(mx,t,e);try{return n.valueOf(r)}finally{r.release()}}(t,e.elem(r),n)})):kt}const wx=de(class{constructor(){}test(t,e,n){if(e.equalsSym(gx)){if(1===(r=t).ndim&&_x(r)){const e=t.dim(0);for(let r=0;r<e;r++){const s=t.elem(e*r);if(0===r){if(!jn(s,n))return!1}else if(!bo(s,n))return!1}return!0}if(kx(t)){const e=t.dim(0);for(let r=0;r<e;r++)for(let s=0;s<e;s++){const i=t.elem(e*r+s);if(r===s){if(!jn(i,n))return!1}else if(!bo(i,n))return!1}return!0}return!1}var r;throw new Error(`${this.name}.test(${t},${e}) method not implemented.`)}binL(t,e,n,r){if(e.equalsSym(mx)){if(St(n)&&b(n))return yx(t,n,r)}else if(e.equalsSym(xx)&&St(n)){if(n instanceof tt)return t.map((t=>Zn(r,t,n)));if(k(n))return t.map((t=>Zn(r,t,n)))}return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:{const e=new du;return t.ndim>1?(e.push(dx),e.push(t),e.list(2),e.pop()):(e.push(t),e.push(t),Gp(s,s,e),wd(s,s,e),sg(1,2,e),Gd(s,s,e),e.pop())}case e.adj:return bx(t,s);case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s));case e.simplify:return t.map((t=>lx(t,s)))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Vt}get hash(){return Vg}get name(){return"TensorExtension"}isKind(t){return b(t)}subst(t,e,n,r){if(b(e)&&t.equals(e))return n;const s=t.mapElements((t=>yo(t,e,n,r)));return function(t,e,n){const r=t.length;for(let s=0;s<r;s++)if(!n.equals(t[s],e[s]))return!1;return!0}(t.copyElements(),s,r)?t:t.withElements(s)}toHumanString(t,e){e.pushDirective(ie.printMode,Ke.Human);try{return Ex(t,e)}finally{e.popDirective()}}toInfixString(t,e){e.pushDirective(ie.printMode,Ke.Infix);try{return Ex(t,e)}finally{e.popDirective()}}toLatexString(t,e){return function(t,e){return t.ndim<=2?Dx(!0,t,0,0,e)[1]:""}(t,e)}toListString(t,e){e.pushDirective(ie.printMode,Ke.SExpr);try{return Ex(t,e)}finally{e.popDirective()}}evaluate(t,e,n){return this.transform(Tt(t,e),n)}simplify(t,e){return t.map((function(t){return lx(t,e)}))}transform(t,e){if(this.isKind(t)){const n=t.mapElements((function(t){return e.valueOf(t)})),r=t.withElements(n);return[!r.equals(t)?ne:ee,r]}return[ee,t]}valueOf(t,e){const n=t.mapElements((function(t){return e.valueOf(t)}));return t.withElements(n)}});function Ex(t,e){return vx(t,0,0,e)[1]}function vx(t,e,n,r){let s="";const i=r.getDirective(ie.useParenForTensors);if(s+=i?"(":"[",e<t.ndim-1)for(let i=0;i<t.dim(e);i++){let o;[n,o]=Array.from(vx(t,e+1,n,r)),s+=o,i!==t.dim(e)-1&&(r.getDirective(ie.printMode)===Ke.SExpr?s+=" ":s+=",")}else for(let i=0;i<t.dim(e);i++)s+=za(t.elem(n),r),i!==t.dim(e)-1&&(r.getDirective(ie.printMode)===Ke.SExpr?s+=" ":s+=","),n++;return s+=i?")":"]",[n,s]}function Dx(t,e,n,r,s){let i="";if(t&&(i+="\\begin{bmatrix} "),n<e.ndim-1)for(let t=0;t<e.dim(n);t++){let o;[r,o]=Array.from(Dx(!1,e,n+1,r,s)),i+=o,t!==e.dim(n)-1&&(i+=" \\\\ ")}else for(let t=0;t<e.dim(n);t++)i+=za(e.elem(r),s),t!==e.dim(n)-1&&(i+=" & "),r++;return t&&(i+=" \\end{bmatrix}"),[r,i]}function bx(t,e){const n=function(t){if(kx(t))return t.dim(0);throw new Vt}(t),r=new Array(t.nelem);for(let s=0;s<n;s++)for(let i=0;i<n;i++)r[n*i+s]=px(t,s,i,e);return t.withElements(r)}function Ax(t,e){if(_t(t)&&Ei(t))return t.argList;if(Di(t))return t;if(e.isExpanding()&&yi(t)){const n=(_t(t)?t.tail():[]).map((function(t){return Ax(t,e)}));for(let t=n.length-1;t>0;t--)n[t-1]=e.inner(n[t],n[t-1]);return n[0]}if(!b(t)||!kx(t))return At(Qr,t);if(vi(t))return function(t,e){const n=t.dim(0),r=new Array(n*n);r.fill(_);for(let t=0;t<n;t++)r[t*n+t]=S;const s=function(t,e,n,r){for(let s=0;s<n;s++){if(r.equals(e[n*s+s],_)){let i=0;for(i=s+1;i<n&&r.equals(e[n*i+s],_);i++);i===n&&Je("inverse of singular matrix");for(let r=0;r<n;r++){let o=e[n*s+r];e[n*s+r]=e[n*i+r],e[n*i+r]=o,o=t[n*s+r],t[n*s+r]=t[n*i+r],t[n*i+r]=o}}const i=e[n*s+s];for(let o=0;o<n;o++)o>s&&(e[n*s+o]=lo(e[n*s+o],i,r)),t[n*s+o]=lo(t[n*s+o],i,r);for(let i=0;i<n;i++){if(i===s)continue;const o=e[n*i+s];for(let a=0;a<n;a++)a>s&&(e[n*i+a]=r.subtract(e[n*i+a],r.multiply(e[n*s+a],o))),t[n*i+a]=r.subtract(t[n*i+a],r.multiply(t[n*s+a],o))}}return t}(r,t.copyElements(),n,e);return new F([n,n],s)}(t,e);const n=Zl(t,e);return e.iszero(n)&&Je("inverse of singular matrix"),lo(bx(t,e),n,e)}function Sx(t,e){const n=new Array(t);for(let r=0;r<t;r++)n[r]=e;return n}function kx(t){return 2===t.ndim&&_x(t)}function _x(t){const e=t.ndim;if(e>0){const n=t.dim(0);for(let r=0;r<e;r++)if(t.dim(r)!==n)return!1;return!0}return!0}function Fx(t,e,n){const r=t.ndim-1;if(t.dim(0)!==t.dim(r))return At(us,t,e);let s=jt(e);if(isNaN(s))return At(us,t,e);if(0===s){if(2!==t.ndim)throw new Error("power(tensor,0) with tensor rank not equal to 2");s=t.dim(0);const e=[s,s],n=function(t,e,n){const r=Sx(t*t,n);for(let n=0;n<t;n++)r[t*n+n]=e;return r}(s,S,_);return new F(e,n)}let i=t;s<0&&(s=-s,i=Ax(i,n));let o=i;for(let t=1;t<s&&(o=n.inner(o,i),!n.iszero(o));t++);return o}function Cx(t,e){return l(t)||c(t)?e.iszero(t)?S:_:mi(t)?At(_r,t.base):io(t)?At(_r,e.negate(t)):((io(t)||_t(t)&&pi(t)&&io(Ai(t)))&&(t=e.negate(t)),At(_r,t))}function Tx(t,e,n){return function(t,e,n){const r=jt(e);if(sn(t)&&!isNaN(r)){return ve(function(t,e){throw new Error("Not implemented")}(0,t.d))}if(n.iszero(t)&&n.iszero(e))return S;if(n.iszero(t)&&!isNaN(r))return _;if(c(e)&&ii(e.b,2)){if(ii(e.a,1)){const e=n.getDirective(ie.evaluatingAsFloat)?ve(2/Math.PI):lo(bn,ze,n);return n.multiply(n.power(lo(e,t,n),Bn),n.sin(t))}if(ii(e.a,-1)){const e=n.getDirective(ie.evaluatingAsFloat)?ve(2/Math.PI):lo(bn,ze,n);return n.multiply(n.power(lo(e,t,n),Bn),n.cos(t))}const r=x(si(e.a));return n.subtract(n.multiply(n.multiply(lo(bn,t,n),e.sub(r)),Tx(t,n.subtract(e,r),n)),Tx(t,n.subtract(e,bn.mul(r)),n))}if(io(t))return n.multiply(n.multiply(n.power(n.negate(t),e),n.power(t,n.negate(e))),At(lr,n.negate(t),e));if(io(e))return n.multiply(n.power(m,e),At(lr,t,n.negate(e)));return At(lr,t,e)}(t,e,n)}function Mx(t,e,n){return function(t,e,n){const r=jt(e);if(l(t)&&!isNaN(r)){const e=function(t,e){throw new Error("Not implemented")}(0,t.d);return X(e)}if(io(e))return n.multiply(n.power(m,e),At(hr,t,n.negate(e)));return At(hr,t,e)}(t,e,n)}function Ox(t,e){if(Ft(t).equals(ir))return Ai(t);if(sn(t)){let e=Math.cosh(t.d);return Math.abs(e)<1e-10&&(e=0),ve(e)}return e.iszero(t)?Dn:At(br,t)}function Nx(t,e,n){return function(t,e,n){const r=jt(e);if(r<0||isNaN(r))return At(Jr,t,e);if(Aa(t))return Lx(r,t,n);return n.valueOf(yo(Lx(r,Ws,n),Ws,t,n))}(t,e,n)}function Lx(t,e,n){let r=_,s=S;for(let i=0;i<t;i++){const t=r;r=s,s=n.multiply(n.subtract(n.multiply(e,r),n.multiply(x(i),t)),bn)}return s}const Bx=t(e.add);function qx(t,e){return t===e?0:t>e?1:-1}function Ix(t){return t instanceof B}class Px{constructor(){}test(t,e,n){return!1}binL(t,e,n,r){return e.equalsSym(Bx)&&St(n)&&Ix(n)?Q(t.str+n.str):kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Jg}get name(){return"StrExtension"}valueOf(t,e){return t}isKind(t){return Ix(t)}subst(t,e,n){return Ix(e)&&t.equals(e)?n:t}toAsciiString(t){return JSON.stringify(t.str)}toHumanString(t){return JSON.stringify(t.str)}toInfixString(t){return JSON.stringify(t.str)}toLatexString(t){return JSON.stringify(t.str)}toListString(t){return JSON.stringify(t.str)}toString(){return this.name}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return Ix(t)?[2,t]:[ee,t]}}const Rx=new Px,Ux=de(Px),$x=1e4;class zx{constructor(){this.c=0,this.x=0,this.y=0}}const Wx=[];for(let t=0;t<$x;t++)Wx[t]=new zx;let Xx=0,Kx=0,Hx=0;function Jx(t){let e="";return e+=t,e}function Gx(t){return Jx(t)}function Vx(t,e){Xx=0,Kx=0,Hx=0,function(t,e){if(_t(t)&&t.opr.equals(xs))return Qx(Ai(t),e),fy(" = "),void Qx(_i(t),e);b(t)?function(t,e,n){let r=0,s=0,i=0;if(t.ndim>2)return void Ey(t,e,n);const o=t.dim(0);r=2===t.ndim?t.dim(1):1;const a=o*r;if(a>my)return void Ey(t,e,n);const u=Hx;for(let e=0;e<a;e++)xy[e].index=Xx,xy[e].x=Hx,Qx(t.elem(e),n),xy[e].count=Xx-xy[e].index,[xy[e].h,xy[e].w,xy[e].y]=ly(xy[e].index,Xx);let c=0,l=0;for(let t=0;t<a;t++)xy[t].h>c&&(c=xy[t].h),xy[t].w>l&&(l=xy[t].w);const h=o*c+(o-1)*wy,f=r*l+(r-1)*yy,p=-h/2;for(let t=0;t<o;t++)for(let e=0;e<r;e++){const n=t*r+e;s=u-xy[n].x,i=p-xy[n].y,cy(xy[n].index,xy[n].index+xy[n].count,s,i),s=0,e>0&&(s=e*(l+yy)),i=0,t>0&&(i=t*(c+wy)),s+=(l-xy[n].w)/2,i+=(c-xy[n].h)/2,cy(xy[n].index,xy[n].index+xy[n].count,s,i)}Hx=u+f}(t,hy,e):Qx(t,e)}(t,e);const[n,r,s]=ly(0,Xx);return r>100?za(t,e):function(t){let e="";const n=t.slice(0,Xx).sort(dy),r=t.slice(Xx),s=n.concat(r);let i=0,{y:o}=s[0];for(let t=0;t<Xx;t++){for(;s[t].y>o;)e+=Gx("\n"),i=0,o++;for(;s[t].x>i;)e+=Jx(" "),i++;e+=Jx(s[t].c),i++}return e}(Wx)}function jx(t){if(Kx>0)return!1;if(Ji(t))return!0;if(!di(t))return!1;if(Ji(Ai(t)))return!0;for(;_t(t);){if(ty(Ft(t)))return!0;t=Ct(t)}return!1}function Qx(t,e){if(pi(t))for(t=Ct(t),Zx(Ft(t))&&(hy("-"),jx(Ft(t))&&hy(" ")),Yx(Ft(t),e),t=Ct(t);_t(t);)Zx(Ft(t))?(hy(" "),hy("-"),hy(" ")):(hy(" "),hy("+"),hy(" ")),Yx(Ft(t),e),t=Ct(t);else Zx(t)&&(hy("-"),jx(t)&&hy(" ")),Yx(t,e)}function Zx(t){return!!ci(t)||!(!di(t)||!ci(Ai(t)))}function Yx(t,e){if(di(t)){const n=function(t){let e=0;t=Ct(t);for(;_t(t);){ty(Ft(t))&&e++,t=Ct(t)}return e}(t);n&&0===Kx?function(t,e,n){let r,s,i=0,o=0,a=0,u=0,h=0,f=S,p=S;const d=Ai(t);c(d)&&(f=$n(d).abs(),p=zn(d));l(d)&&(f=d.abs());u=f.isOne()?0:1,r=Ct(t),D(Ft(r))&&(r=Ct(r));for(;_t(r);)s=Ft(r),ty(s)||u++,r=Ct(r);h=Hx,o=Xx,i=0,f.isOne()||(py(f,0,n),i++);r=Ct(t),D(Ft(r))&&(r=Ct(r));for(;_t(r);)s=Ft(r),ty(s)||(i>0&&hy(" "),1===u?Qx(s,n):ny(s,n),i++),r=Ct(r);0===i&&hy("1");a=Xx,i=0,p.isOne()||(py(p,0,n),i++,e++);r=Ct(t),c(Ft(r))&&(r=Ct(r));for(;_t(r);)s=Ft(r),ty(s)&&(i>0&&hy(" "),sy(s,e,n),i++),r=Ct(r);ay(h,o,a)}(t,n,e):function(t,e,n){if(0===e)for(t=Ct(t),(jn(Ft(t),n)||Li(Ft(t)))&&(t=Ct(t)),ny(Ft(t),n),t=Ct(t);_t(t);)hy(" "),ny(Ft(t),n),t=Ct(t);else!function(t,e){let n=S;t=Ct(t);const r=t.head;c(r)?(n=$n(r).abs(),t=Ct(t)):l(r)&&(n=r.abs(),t=Ct(t));let s=0;jn(n,e)||(py(n,0,e),s++);for(;_t(t);)ty(Ft(t))||(s>0&&hy(" "),ny(Ft(t),e),s++),t=Ct(t);0===s&&hy("1")}(t,n),hy("/"),e>1||Ji(Ai(t))?(hy("("),ey(t,n),hy(")")):ey(t,n)}(t,n,e)}else ny(t,e)}function ty(t){const e=Ai(t);return mi(t)&&_a(e)&&Zx(_i(t))}function ey(t,e){let n=0,r=t.argList;const s=r.head;try{if(Ji(s)){py(s.denom(),0,e),n++,r=Ct(r)}for(;_t(r);)ty(Ft(r))&&(n>0&&hy(" "),sy(Ft(r),0,e),n++),r=Ct(r)}finally{s.release()}}function ny(r,s){b(r)?Ey(r,hy,s):l(r)?py(r,0,s):pi(r)||di(r)?iy(r,s):mi(r)?function(t,e){let n=0,r=0,s=0;const i=Ai(t);if(_a(i))return fy("exp("),Qx(_i(t),e),void hy(")");if(Kx>0)return void(Li(_i(t))?(hy("1"),hy("/"),ry(Ai(t))?ny(Ai(t),e):iy(Ai(t),e)):(ry(Ai(t))?ny(Ai(t),e):iy(Ai(t),e),e.getDirective(ie.useCaretForExponentiation)?hy("^"):(hy("*"),hy("*")),ry(_i(t))?ny(_i(t),e):iy(_i(t),e)));if(Zx(_i(t)))return s=Hx,n=Xx,hy("1"),r=Xx,sy(t,1,e),void ay(s,n,r);n=Xx,ry(Ai(t))?ny(Ai(t),e):iy(Ai(t),e);r=Xx,Kx++,Qx(_i(t),e),Kx--,uy(n,r)}(r,s):_t(r)?function(t,r){const s=t.opr;try{if(v(s)&&n(s,e.component)&&v(Ai(t)))return void function(t,e){t=Ct(t),bi(t).equals(er)||bi(t).equals(ss)||bi(t).equals(us)||bi(t).equals(Rr)?iy(Ft(t),e):Qx(Ft(t),e);if(hy("["),t=Ct(t),_t(t))for(Qx(Ft(t),e),t=Ct(t);_t(t);)hy(","),Qx(Ft(t),e),t=Ct(t);hy("]")}(t,r);if(v(s)&&n(s,e.factorial))return void function(t,e){t=Ai(t),Ji(t)||pi(t)||di(t)||mi(t)||gi(t)?iy(t,e):Qx(t,e);hy("!")}(t,r);v(s)&&n(s,e.derivative)?hy("d"):oy(Ft(t),r),hy("(");let i=t.cdr;if(_t(i))for(Qx(i.head,r),i=i.cdr;_t(i);)hy(","),Qx(i.head,r),i=i.cdr;hy(")")}finally{s.release()}}(r,s):D(r)?0===Kx?function(t,e){c(t)&&function(t,e){const n=t.numer().abs(),r=t.denom();if(r.isOne())return void py(n,0,e);const s=Hx,i=Xx;py(n,0,e);const o=Xx;py(r,0,e),ay(s,i,o)}(t,e);l(t)&&function(t,e){const n=t.abs();py(n,0,e)}(t,e)}(r,s):py(r,0,s):v(r)?oy(r,s):h(r)?function(t){const e=Rx.toAsciiString(t);for(let t=0;t<e.length;t++)hy(e[t])}(r):M(r)?function(t){const e=t.toInfixString();for(let t=0;t<e.length;t++)hy(e[t])}(r):k(r)?function(t){const e=t.toString(10,!1);for(let t=0;t<e.length;t++)hy(e[t])}(r):St(r)&&function(n,r,s){const i=s.handlerFor(n),o=Qt(i.dispatch(n,t(e.ascii),kt,s));for(let t=0;t<o.length;t++)r(o[t])}(r,hy,s)}function ry(t){return!(!_t(t)||pi(t)||di(t)||mi(t))||(!!v(t)||!Ji(t)&&(!ci(t)&&!!D(t)))}function sy(t,e,n){let r=0,s=0;Li(_i(t))?1===e?Qx(Ai(t),n):ny(Ai(t),n):(r=Xx,ry(Ai(t))?ny(Ai(t),n):iy(Ai(t),n),s=Xx,Kx++,function(t,e){if(pi(t))for(t=Ct(t),Yx(Ft(t),e),t=Ct(t);_t(t);)Zx(Ft(t))?(hy(" "),hy("-"),hy(" ")):(hy(" "),hy("+"),hy(" ")),Yx(Ft(t),e),t=Ct(t);else Yx(t,e)}(_i(t),n),Kx--,uy(r,s))}function iy(t,e){hy("("),Qx(t,e),hy(")")}function oy(t,e){if(_a(t))return void fy("exp(1)");const n=e.getSymbolPrintName(t);for(let t=0;t<n.length;t++)hy(n[t])}function ay(t,e,n){let r=0,s=0;const[i,o,a]=ly(e,n),[u,c,l]=ly(n,Xx);r=c>o?(c-o)/2:0,r++;s=-(a+i-1)-1,cy(e,n,r,s),r=c>o?-o:(o-c)/2-o,r++,s=1-l,cy(n,Xx,r,s);let h=0;h=c>o?c:o,h+=2,Hx=t;for(let t=0;t<h;t++)hy("-")}function uy(t,e){let n=0,r=0,s=0,i=0,o=0,a=0,u=0;[r,s,i]=ly(t,e),[o,a,u]=ly(e,Xx),n=-u-o+1,n+=i-1,cy(e,Xx,0,n)}function cy(t,e,n,r){for(let s=t;s<e;s++)Wx[s].x+=n,Wx[s].y+=r}function ly(t,e){let n=Wx[t].x,r=Wx[t].x,s=Wx[t].y,i=Wx[t].y;for(let o=t+1;o<e;o++)Wx[o].x<n&&(n=Wx[o].x),Wx[o].x>r&&(r=Wx[o].x),Wx[o].y<s&&(s=Wx[o].y),Wx[o].y>i&&(i=Wx[o].y);return[i-s+1,r-n+1,s]}function hy(t){if(Xx!==$x)return Wx[Xx].c=t,Wx[Xx].x=Hx,Wx[Xx].y=0,Xx++,Hx++}function fy(t){for(let e=0;e<t.length;e++)hy(t[e])}function py(t,e,n){if(c(t)){let n=t.a.toString();"-"===n[0]&&0===e&&(n=n.substring(1));for(let t=0;t<n.length;t++)hy(n[t]);if(n=t.b.toString(),"1"===n)return;hy("/");for(let t=0;t<n.length;t++)hy(n[t])}else if(l(t)){let r=Ta(t.d,n);"-"===r[0]&&0===e&&(r=r.substring(1));for(let t=0;t<r.length;t++)hy(r[t])}}function dy(t,e){return t.y<e.y?-1:t.y>e.y?1:t.x<e.x?-1:t.x>e.x?1:0}const my=100;class gy{constructor(){this.x=0,this.y=0,this.h=0,this.w=0,this.index=0,this.count=0}}const xy=[];for(let t=0;t<1e4;t++)xy[t]=new gy;const yy=3,wy=1;function Ey(t,e,n){vy(t,0,0,e,n)}function vy(t,e,n,r,s){r("(");for(let i=0;i<t.dim(e);i++)e+1===t.ndim?(Qx(t.elem(n),s),n+=1):n=vy(t,e+1,n,r,s),i+1<t.dim(e)&&r(",");return r(")"),n}function Dy(t,e){e.pushDirective(ie.printMode,Ke.Human);try{return za(t,e).replace(/_/g,"\\_")}finally{e.popDirective()}}function by(t,e){e.pushDirective(ie.printMode,Ke.LaTeX);try{return za(t,e).replace(/_/g,"\\_")}finally{e.popDirective()}}class Ay{constructor(t){this.name=t}compareFactors(t,e){throw new Error("AbtractExtension.compareFcators method not implemented.")}compareTerms(t,e){throw new Error("AbtractExtension compareTerms method not implemented.")}subst(t,e,n,r){if(t.equals(e))return n;if(_t(t)){const s=t.opr,i=yo(s,e,n,r);if(i.equals(s)){const i=t.lhs,o=t.rhs,a=yo(i,e,n,r),u=yo(o,e,n,r);return i.equals(a)&&o.equals(u)?t:At(s,a,u)}{const s=t.lhs,o=t.rhs;return At(i,yo(s,e,n,r),yo(o,e,n,r))}}if(v(t))return v(e)&&t.equalsSym(e)?n:t;throw new go}toAsciiString(t,e){return Vx(t,e)}toHumanString(t,e){return Dy(t,e)}toInfixString(t,e){return ru(t,e)}toLatexString(t,e){return by(t,e)}toListString(t,e){return Oa(t,e)}}var Sy,ky,_y;class Fy extends Ay{constructor(t,e){super(t),this.opr=e,Sy.set(this,void 0),ky.set(this,void 0),Rt(this,Sy,`(${e.key()})`,"f"),Rt(this,ky,e,"f")}get hash(){return Pt(this,Sy,"f")}iscons(){return!0}operator(){return Pt(this,ky,"f")}evaluate(t,e,n){const r=Tt(this.opr,e);try{return this.transform(r,n)}finally{r.release()}}binL(t,e,n,r){throw new Error("Method not implemented.")}binR(t,e,n,r){throw new Error("Method not implemented.")}dispatch(t,e,n,r){throw new Error("Method not implemented.")}test(t,e,n){throw new Error("Method not implemented.")}valueOf(t,e){return this.transform(t,e)[1]}isKind(t,e){return!!_t(t)&&t.opr.equals(this.opr)}}Sy=new WeakMap,ky=new WeakMap;class Cy extends Fy{constructor(t,e,n){super(t,e),this.guard=n}test(t,e){throw new Error("Method not implemented.")}isKind(t,e){return!!this.match(t,e)}match(t,e){if(_t(t)&&2===t.length){const n=t.opr,r=t.item(1);return v(n)&&this.opr.equalsSym(n)&&this.guard(r,e)?t:void 0}}transform(t,e){const n=this.match(t,e);if(n){const t=e.valueOf(n.arg);return t.equals(n.arg)?this.transform1(n.opr,n.arg,n,e):[ne,e.valueOf(At(n.opr,t))]}return[ee,t]}}function Ty(t){return My(t,"is_any(expr)","expr"),!0}function My(t,e,n){if(null==t)throw new Error(`${e}: Expecting ${n} to be a U but got ${t}.`);const r=t;return r.iscons||r.isnil,r}let Oy=class extends Cy{constructor(){super("sgn_any",ys,Ty),_y.set(this,void 0),Rt(this,_y,nx(this.opr,Qg),"f")}get hash(){return Pt(this,_y,"f")}isKind(t,e){return!!super.isKind(t,e)&&!l(t)}transform1(t,e,n,r){return[ne,Ly(e,r)]}};_y=new WeakMap;const Ny=new class{create(){return new Oy}};function Ly(t,e){const n=t,r=e.abs(t);return e.divide(n,r)}const By=t(e.clock);const qy=t(e.inner);function Iy(t,e,n){const r=At(qy,t,e);try{return n.valueOf(r)}finally{r.release()}}const Py=t(e.polar);function Ry(t,e,n,r){switch(r.compareFn(t)(e,n)){case qt:return At(t,e,n);case Bt:return At(t,n,e);default:return At(t,e,n)}}function Uy(t){const e=t;if(sh(e)){const t=e.cdr;return t.isnil?S:t.cdr.isnil?t.car:e}return e}function $y(t,e){return _t(t)?sh(t)?Uy(Tt(t.opr,zy(t.argList,e))):t:e(t)?Dn:t}function zy(t,e){if(t.isnil)return t;{const n=t.car;return e(n)?zy(t.argList,e):Tt(n,zy(t.argList,e))}}const Wy=t=>!M(t);function Xy(t){if(M(t))return t;if(_t(t)&&sh(t)&&1===ih(t,M)){const e=$y(t,Wy);if(M(e))return e;throw new Error}throw new Error}function Ky(t,e,n){if(e>0){const r=t,s=Ky(t,e-1,n);try{return Zn(n,r,s)}finally{r.release(),s.release()}}else{if(!(e<0))return S;{const r=t.rev(),s=Zn(n,t,r);try{const t=lo(r,s,n);if(!ah(t))return po(n,t,x(-e));{const r=Xy(t),s=$y(t,M);try{const t=po(n,s,x(-e)),i=Ky(r,-e,n);try{return Zn(n,t,i)}finally{t.release(),i.release()}}finally{r.release(),s.release()}}}finally{r.release(),s.release()}}}}const Hy=t(e.multiply),Jy=t(e.sqrt);function Gy(t,e){const n=t.bitmap,r=e.bitmap;return n<r?Zt:n>r?te:Yt}const Vy=de(class{constructor(){}test(t,e,n){return!1}binL(n,r,s,i){switch(r.id){case e.add:if(St(s)&&M(s))return n.add(s);break;case e.multiply:if(St(s)){if(M(s))return n.mul(s);if(T(s))return s;if(l(s))return s.isZero()?s:Ry(Hy,n,s,i);if(O(s))return Ry(Hy,n,s,i);if(L(s))return Ry(Hy,n,s,i);if(c(s))return Ry(Hy,n,s,i);if(v(s))return Ry(Hy,n,s,i);if(b(s))return s.map((t=>Zn(i,n,t)));if(k(s))return Ry(Hy,n,s,i)}break;case e.outer:if(St(s)){if(l(s))return s.isZero()?s:Ry(Hy,n,s,i);if(c(s))return s.isZero()?s:s.isOne()?n:Ry(Hy,n,s,i);if(k(s))return Ry(Hy,n,s,i)}break;case e.pow:if(St(s)&&c(s))return function(n,r,s){if(r.isInteger())return Ky(n,r.toNumber(),s);{const i=r.numer(),o=r.denom();try{const r=Ky(n,i.toNumber(),s),a=S.div(o);try{return At(t(e.pow),r,a)}finally{r.release(),a.release()}}finally{i.release(),o.release()}}}(n,s,i)}return kt}binR(t,n,r,s){switch(n.id){case e.multiply:if(St(r)){if(O(r))return Ry(Hy,r,t,s);if(c(r))return Ry(Hy,r,t,s);if(b(r))return r.map((e=>Zn(s,e,t)));if(k(r))return Ry(Hy,r,t,s)}break;case e.outer:if(St(r)){if(M(r))return r.wedge(t);if(l(r))return Ry(Hy,r,t,s);if(c(r))return r.isZero()?r:r.isOne()?t:Ry(Hy,r,t,s);if(k(r))return Ry(Hy,r,t,s)}throw new Vt(`${t} ${r}`)}return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:{const e=At(Jy,t.scp(t));try{return s.valueOf(e)}finally{e.release()}}case e.grade:{const e=r.head;try{if(c(e)&&e.isInteger())return t.extractGrade(e.toNumber())}finally{e.release()}break}case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Rg}get name(){return"BladeExtension"}get dependencies(){return["Blade"]}isKind(t){return M(t)}subst(t,e,n){return M(e)&&t.equals(e)?n:t}toAsciiString(t){return t.toInfixString()}toHumanString(t){return t.toInfixString()}toInfixString(t){return t.toInfixString()}toLatexString(t){return t.toLatexString()}toListString(t){return t.toListString()}toString(){return this.name}evaluate(t,e){throw new Vt}transform(t){return[2,t]}valueOf(t){return t}});function jy(t,e){return Sa(t)&&Sa(e)?Yt:Sa(t)?Zt:Sa(e)?te:t.compare(e)}function Qy(t,e){if(t.ndim<e.ndim)return Zt;if(t.ndim>e.ndim)return te;const n=t.ndim;for(let r=0;r<n;r++){if(t.dim(r)<e.dim(r))return Zt;if(t.dim(r)>e.dim(r))return te}const r=t.nelem;for(let n=0;n<r;n++)switch(Zy(t.elem(n),e.elem(n))){case te:return te;case Zt:return Zt;default:continue}return Yt}function Zy(t,e){if(t===e)return It;if(t.isnil&&e.isnil)return It;if(t.isnil)return qt;if(e.isnil)return Bt;if(D(t)&&D(e))return Hn(t,e);if(D(t))return qt;if(D(e))return Bt;if(h(t)&&h(e))return qx(t.str,e.str);if(h(t))return qt;if(h(e))return Bt;if(v(t)&&v(e))return jy(t,e);if(v(t))return qt;if(v(e))return Bt;if(b(t)&&b(e))return Qy(t,e);if(b(t))return qt;if(b(e))return Bt;if(k(t)&&k(e))return It;if(k(t))return Bt;if(k(e))return qt;if(M(t)&&M(e))return Gy(t,e);if(M(t))return Bt;if(M(e))return qt;if(L(t)&&L(e))return It;if(L(t))return Bt;if(L(e))return qt;for(;_t(t)&&_t(e);){const n=Zy(Ft(t),Ft(e));if(n!==It)return n;t=Ct(t),e=Ct(e)}return _t(e)?qt:_t(t)?Bt:It}function Yy(t,e){e.pushDirective(ie.evaluatingAsFloat,1);try{return e.valueOf(tw(e.valueOf(t),e))}finally{e.popDirective()}}function tw(t,e){return _t(t)?e.valueOf(At(...t.map((function(t){return tw(t,e)})))):b(t)?t.map((function(t){return tw(t,e)})):c(t)?ve(t.toNumber()):Sa(t)?Se:_a(t)?ke:t}function ew(t,e){return Yy(e.valueOf(ch(e.valueOf(t),e)),e)}const nw=t(e.testeq);function rw(t,e){const n=Ai(t);let r;if(Ft(n).equals(nw)||Ft(n).equals(xs))r=mo(e,e.valueOf(Ai(n)),e.valueOf(_i(n)));else{const t=e.valueOf(n);r=Ft(t).equals(nw)||Ft(t).equals(xs)?mo(e,e.valueOf(Ai(t)),e.valueOf(_i(t))):t}const s=e.valueOf(_i(t)),i=s.isnil?oi(r):s;if(Pi(r,i))return iw(r,i,e);Je("roots: 1st argument is not a polynomial in the variable "+e.toInfixString(i))}function sw(t,e,n){const r=Bo(t,e,n),s=r[r.length-1];return r.map((t=>lo(t,s,n)))}function iw(t,e,n){const r=sw(t,e,n);r.forEach((function(t){}));const s=[];if(function(t,e){return!(t.length<=2)&&!bo(t[0],e)&&t.slice(1,t.length-1).every((t=>bo(t,e)))}(r,n)){const t=r.length,e=r[0],i=function(t,e,n,r){t-=1;const s=lo(po(r,n,Wn(1,t)),po(r,e,Wn(1,t)),r),i=[];if(t%2==0){for(let e=1;e<=t;e+=2){const n=Zn(r,s,po(r,m,Wn(e,t)));i.push(n),i.push(Yn(r,n))}return i}for(let e=1;e<=t;e++){let n=Zn(r,s,po(r,m,Wn(e,t)));e%2==0&&(n=Yn(r,n)),i.push(n)}return i}(t,r.pop(),e,n);s.push(...i)}else{const r=function(t,e,n){const r=sw(t,e,n);if(r.some((t=>Ki(t)))){if(di(t)){const r=t.tail().map((t=>ow(t,e,n)));return r.flat()}return ow(t,e,n)}{const r=aa(t,e,n);if(di(r)){const t=r.tail().map((t=>ow(t,e,n)));return t.flat()}return ow(r,e,n)}}(t,e,n);s.push(...r)}const i=s.length;if(0===i&&Je("roots: the polynomial is not factorable, try nroots"),1===i)return new F([1],s);s.sort((function(t,e){return Zy(t,e)}));return new F([i],s)}function ow(t,e,n){if(mi(t)){const r=t.base;if(Pi(r,e)){const s=t.expo;if(c(s)&&s.isPositiveInteger()){return aw(sw(r,e,n),n)}}}if(Pi(t,e)){return aw(sw(t,e,n),n)}return[]}function aw(t,e){t.forEach((function(t){}));const n=t.length;if(2===n){return function(t,e,n){return[Yn(n,lo(e,t,n))]}(t.pop(),t.pop(),e)}if(3===n){return function(t,e,n,r){const s=po(r,mo(r,po(r,e,bn),Zn(r,Zn(r,Sn,t),n)),Bn),i=lo(mo(r,s,e),Zn(r,t,bn),r),o=Zn(r,lo(Yn(r,ao(r,s,e)),t,r),Bn);return[i,o]}(t.pop(),t.pop(),t.pop(),e)}if(4===n){return function(t,e,n,r,s){const i=Zn(s,Zn(s,n,n),n),o=Zn(s,e,e),a=Zn(s,o,e),u=Zn(s,Zn(s,a,r),Ln),c=Zn(s,a,bn),l=Zn(s,An,t),h=Zn(s,Zn(s,t,t),r),f=Zn(s,h,x(27)),p=Zn(s,Zn(s,h,r),x(-27)),d=Zn(s,Zn(s,t,n),e),m=Zn(s,Zn(s,t,n),An),g=Zn(s,Ln,Zn(s,t,i)),y=Yn(s,Zn(s,d,Tn)),w=Zn(s,Zn(s,d,r),x(18)),E=mo(s,o,m),v=Zn(s,o,Zn(s,n,n)),D=lo(Yn(s,e),l,s),b=Zn(s,po(s,E,An),Sn),k=ew(qw(E,s),s),_=ew(qw(Gl([w,u,v,g,p],s),s),s),F=Gl([c,y,f],s),C=qw(po(s,mo(s,po(s,F,bn),b),Bn),s);if(bo(_,s)){return function(t,e,n,r,s,i){const{R_DELTA0_toBeCheckedIfZero:o,R_m_b_over_3a:a,R_DELTA0:u,R_b3:c,R_a_b_c:l}=s;if(bo(o,i))return[a];const h=lo(mo(i,Zn(i,t,Zn(i,r,Tn)),Zn(i,e,n)),Zn(i,u,bn),i),f=Yn(i,c),p=Yn(i,Zn(i,t,Zn(i,t,Zn(i,r,Tn)))),d=Zn(i,l,Sn),m=lo(Gl([d,p,f],i),Zn(i,t,u),i);return[h,h,m]}(t,e,n,r,{R_DELTA0_toBeCheckedIfZero:k,R_m_b_over_3a:D,R_DELTA0:E,R_b3:a,R_a_b_c:d},s)}let T=!1,M=!1,O=kt;for(;!T;){O=qw(po(s,Zn(s,ao(s,M?Yn(s,C):C,F),Bn),qn),s);bo(ew(qw(O,s),s),s)?M=!0:T=!0}const N=Zn(s,Zn(s,O,l),bn),L=Zn(s,A,po(s,An,Bn)),B=ao(s,S,L),q=mo(s,S,L),I=lo(O,l,s),P=D,R=Yn(s,I),U=Yn(s,lo(E,Zn(s,O,l),s)),$=qw(Gl([P,R,U],s),s),z=D,W=lo(Zn(s,I,B),bn,s),X=lo(Zn(s,q,E),N,s),K=qw(Gl([z,W,X],s),s),H=D,J=lo(Zn(s,I,q),bn,s),G=lo(Zn(s,B,E),N,s),V=qw(Gl([H,J,G],s),s);return[$,K,V]}(t.pop(),t.pop(),t.pop(),t.pop(),e)}if(5===n){return function(t,e,n,r,s,i){if(bo(e,i)&&bo(r,i)&&!bo(n,i)&&!bo(s,i))return function(t,e,n,r,s,i){const o=iw(ao(i,Zn(i,t,po(i,Ws,bn)),ao(i,Zn(i,n,Ws),s)),Ws,i),a=[];for(const t of o.copyElements())a.push(qw(po(i,t,Bn),i)),a.push(qw(Yn(i,po(i,t,Bn)),i));return a}(t,0,n,0,s,i);return bo(e,i)?function(t,e,n,r,s,i){const o=n,a=r,u=s,c=Zn(i,Wn(5,2),o),l=mo(i,Zn(i,bn,po(i,o,bn)),u),h=ao(i,Zn(i,Wn(-1,2),Zn(i,o,u)),ao(i,lo(po(i,o,An),bn,i),Zn(i,Wn(-1,8),po(i,a,bn)))),f=ao(i,po(i,Ws,An),ao(i,Zn(i,c,po(i,Ws,bn)),ao(i,Zn(i,l,Ws),h))),p=iw(f,Ws,i);let d=kt;for(const t of p.copyElements()){if(!bo(ew(ao(i,Zn(i,t,bn),o),i),i)){d=t;break}}const m=qw(po(i,ao(i,Zn(i,d,bn),o),Bn),i),g=qw(lo(Zn(i,a,bn),m,i),i),x=ao(i,Zn(i,o,An),Zn(i,d,bn)),y=qw(po(i,Yn(i,ao(i,x,g)),Bn),i),w=lo(ao(i,m,y),bn,i),E=qw(po(i,Yn(i,ao(i,x,g)),Bn),i),v=lo(mo(i,m,E),bn,i),D=qw(po(i,Yn(i,mo(i,x,g)),Bn),i),b=lo(ao(i,Yn(i,m),D),bn,i),A=qw(po(i,Yn(i,mo(i,x,g)),Bn),i),S=lo(mo(i,Yn(i,m),A),bn,i);return[w,v,b,S]}(0,0,n,r,s,i):function(t,e,n,r,s,i){const o=lo(ao(i,Zn(i,Cn,Zn(i,n,t)),Zn(i,x(-3),po(i,e,bn))),Zn(i,Cn,po(i,t,bn)),i),a=lo(ao(i,po(i,e,An),ao(i,Zn(i,Ln,Zn(i,t,Zn(i,e,n))),Zn(i,Cn,Zn(i,r,po(i,t,bn))))),Zn(i,Cn,po(i,t,An)),i),u=Zn(i,Zn(i,t,t),t),c=Zn(i,e,e),l=Zn(i,Zn(i,t,t),r),h=lo(ao(i,Zn(i,po(i,e,Sn),x(-3)),ao(i,Zn(i,x(256),Zn(i,u,s)),ao(i,Zn(i,x(-64),Zn(i,l,e)),Zn(i,x(16),Zn(i,c,Zn(i,t,n)))))),Zn(i,x(256),po(i,t,Sn)),i),f=po(i,Ws,Sn),p=Zn(i,o,po(i,Ws,bn)),d=Zn(i,a,Ws),m=qw(Gl([f,p,d,h],i),i),g=iw(m,Ws,i);return g.mapElements((n=>qw(mo(i,n,lo(e,Zn(i,Sn,t),i)),i)))}(t,e,n,r,s,i)}(t.pop(),t.pop(),t.pop(),t.pop(),t.pop(),e)}return[]}const uw=t=>t.reduce(((t,e)=>t+e),0);function cw(t){let e;if(_t(t)){const n=[...t];e=uw(n.map(cw))+n.length}else e=1;return e}function lw(t,e,n){if(!_t(e))return St(e)?(n.handlerFor(e),v(e)&&t.equalsSym(e)?1:0):0;{const r=e.head,s=e.rest;try{return lw(t,r,n)+lw(t,s,n)}finally{r.release(),s.release()}}}function hw(t){const e=jt(t);return e<0||isNaN(e)?At(Rr,t):Kn(e)}function fw(t,e){if(pi(t)){return Gl(t.tail().map((function(t){return pw(t,e)})),e)}return pw(t,e)}function pw(t,e){if(!di(t))return t;const n=t.tail();for(;dw(n,e););return ro(n,e)}function dw(t,e){for(let n=0;n<t.length;n++){const r=t[n];for(let s=0;s<t.length;s++){if(n===s)continue;const i=t[s];if(gi(r)&&mi(i)&&Li(_i(i))&&vo(Ai(r),Ai(i),e))return t[n]=hw(mo(e,Ai(r),Dn)),t[s]=Dn,!0;if(mi(i)&&Li(_i(i))&&ki(i).equals(Rr)&&vo(r,Ci(i),e))return t[n]=Yi(hw(ao(e,r,Nn)),e),t[s]=Dn,!0;if(gi(i)){if(jn(mo(e,r,Ai(i)),e))return t[n]=hw(r),t[s]=Dn,!0}if(mi(r)&&Li(_i(r))&&mi(i)&&Li(_i(i))&&ki(i).equals(Rr)){if(jn(mo(e,Ai(r),Ai(Ai(i))),e))return t[n]=Yi(hw(Ai(r)),e),t[s]=Dn,!0}if(gi(r)&&mi(i)&&Li(_i(i))&&ki(i).equals(Rr)){const o=mo(e,Ai(r),Ai(Ai(i)));if(jn(o,e))return t[n]=Ai(r),t[s]=Dn,!0;if(Li(o))return t[n]=Yi(Ai(Ai(i)),e),t[s]=Dn,!0;if(Gi(o,2))return t[n]=Ai(r),t[s]=ao(e,Ai(r),Nn),!0;if(Gi(o,-2))return t[n]=Yi(Ai(Ai(i)),e),t[s]=Yi(ao(e,Ai(Ai(i)),Nn),e),!0}}}return!1}function mw(t){return function(t){const e=t.opr;return!!Aa(e)&&Be.equalsSym(e)}(t)&&Oo(t)}const gw=t(e.conj);const xw=t(e.cos);const yw=t(e.isreal);function ww(t,e){const n=At(yw,t);try{const t=e.valueOf(n);try{if(Gn(t))return t.isTrue();if(c(t))return!t.isZero();throw new Vt(`${t}`)}finally{t.release()}}finally{n.release()}}function Ew(t,e,n){const r=s(t);try{const t=i(e,r);try{const e=o(t);try{const t=a(e);try{return n.valueOf(t)}finally{t.release()}}finally{e.release()}}finally{t.release()}}finally{r.release()}}const vw=t(e.imag);function Dw(t,e){const n=At(vw,t);try{return e.valueOf(n)}finally{n.release()}}const bw=t(e.log);function Aw(t,e,n){const r=function(t,e){const n=At(bw,t);try{return e.valueOf(n)}finally{n.release()}}(t,n);try{const t=Zn(n,e,r);try{return Dw(t,n)}finally{t.release()}}finally{r.release()}}const Sw=t(e.add),kw=t(e.exp),_w=t(e.imag),Fw=t(e.multiply),Cw=t(e.pow),Tw=t(e.real);function Mw(t,e){const n=function(t,e){return t};if(ww(t,e))return n(t);if(c(t))return t;if(Aa(t))return ww(t,e)?t:At(Tw,t);if(pi(t)){const r=t.argList.map((function(t){return Mw(t,e)}));return n(e.valueOf(Tt(Sw,r)))}if(mi(t)){const r=t.lhs,s=t.rhs;if(r.contains(A)){if(c(s)&&s.isInteger()&&s.isNegative()){const t=wo(r,e),i=e.valueOf(At(Cw,r,s.succ())),o=e.valueOf(t),a=lo(e.valueOf(At(Fw,i,o)),e.valueOf(At(Fw,r,t)),e);return n(e.valueOf(At(Tw,a)))}throw new Error("Power")}{const t=Ew(r,s,e),i=function(t,e){const n=At(xw,t);try{return e.valueOf(n)}finally{n.release()}}(Aw(r,s,e),e);return n(Zn(e,t,i))}}if(di(t)){const n=[],r=[];[...t.argList].forEach((function(t){if(ww(t,e))n.push(t);else if(Aa(t)){const e=At(Tw,t),n=At(_w,t),s=At(Fw,A,n),i=At(Sw,e,s);r.push(i)}else if(t.equals(A))r.push(t);else if(mi(t)){const s=t.base,i=t.expo;if(c(i)&&i.isMinusOne()){const t=function(t,e){const n=At(gw,t);try{return e.valueOf(n)}finally{n.release()}}(s,e),n=e.valueOf(At(Fw,t,s)),i=e.valueOf(At(Cw,n,Nn)),o=Zn(e,t,i);r.push(o)}else{const t=Ew(s,i,e),o=Aw(s,i,e),a=e.valueOf(At(Fw,A,o)),u=e.valueOf(At(kw,a));n.push(t),r.push(u)}}else{if(!_t(t)||!Aa(t.opr))throw new Error(`${t}`);r.push(t)}}));const s=Ow(n,e),i=Ow(r,e),o=e.valueOf(At(Tw,i));return e.valueOf(At(Fw,s,o))}return t.equals(A)?vn:n(t)}function Ow(t,e){return t.length>1?e.valueOf(At(Fw,...t)):1===t.length?e.valueOf(t[0]):Dn}function Nw(t){return t.getDirective(ie.expanding)>0}function Lw(t,e,n,r){let s=0;const i=Array(ti).fill(0),o=Array(ti).fill(0);if(D(t))return t;if((jn(e,r)&&Ni(n)||jn(n,r)&&Ni(e))&&Di(t))return t;if(wi(t)){const s=Ft(Ct(Ct(t))),i=Ft(Ct(Ct(Ct(t))));if(vo(s,n,r)&&vo(i,e,r)||vo(i,n,r)&&vo(s,e,r)||vo(s,kt,r)&&vo(i,kt,r)&&(jn(n,r)&&Ni(e)||jn(e,r)&&Ni(n)))return Ft(Ct(t))}if(Nw(r)&&pi(t))return t.tail().reduce(((t,s)=>ao(r,t,Lw(s,e,n,r))),_);if(Nw(r)&&di(t))return t.tail().reduce(((t,s)=>Zn(r,t,Lw(s,e,n,r))),S);if(Nw(r)&&yi(t)){const s=[];return _t(t)&&s.push(...t.tail().map((t=>[t,e,n]))),s.reverse(),s.reduce(((t,e)=>Iy(t,Lw(e[0],e[1],e[2],r),r)),Zs)}if(!b(t))return bo(t,r)?_:jn(e,r)&&Ni(n)||jn(n,r)&&Ni(e)?At(Ms,t):At(Ms,t,e,n);const{ndim:a,nelem:u}=t;if(1===a)return t;let c=jt(e),l=jt(n);(c<1||c>a||l<1||l>a)&&Je("transpose: index out of range"),c--,l--;const h=new Array(u),f=t.copyDimensions();f[c]=t.dim(l),f[l]=t.dim(c);for(let e=0;e<a;e++)i[e]=0,o[e]=t.dim(e);for(let e=0;e<u;e++){s=i[c],i[c]=i[l],i[l]=s,s=o[c],o[c]=o[l],o[l]=s;let n=0;for(let t=0;t<a;t++)n=n*o[t]+i[t];s=i[c],i[c]=i[l],i[l]=s,s=o[c],o[c]=o[l],o[l]=s,h[n]=t.elem(e);for(let t=a-1;t>=0&&!(++i[t]<o[t]);t--)i[t]=0}return new F(f,h)}function Bw(t,e,n,r){r.pushDirective(ie.factoring,1);try{return Lw(t,e,n,r)}finally{r.popDirective()}}function qw(n,r){if(bt(n))return n;const s=function(t){if(t.hasState("simplify"))return t.getState("simplify");{const e=new mu;return t.setState("simplify",e),e}}(r);try{const i=function(t){return t};if(s.some((t=>t.equals(n))))return i(n);s.push(n);try{if(St(n)){return i(r.handlerFor(n).dispatch(n,t(e.simplify),kt,r))}const s=function(t,e){const n=Ft(t);if((n.equals(ss)||yi(t))&&Ft(Ft(Ct(t))).equals(Ms)&&Ft(Ft(Ct(Ct(t)))).equals(Ms)){const r=Ai(Ft(Ct(t))),s=Ai(Ft(Ct(Ct(t))));let i;i=n.equals(ss)?Zn(e,r,s):yi(t)?Iy(s,r,e):Ko();const o=Bw(i,S,bn,e);cw(o)<cw(t)&&(t=o)}return t}(function(t,e){if(t.contains(Rr)){const n=fw(t,e),r=fw(xa(t,e),e);return cw(n)<cw(r)?n:r}return t}(n,r),r),o=function(t,e){if(!_t(t)||!pi(t))return t;const n=xa(t,e);cw(n)<cw(t)&&(t=n);return t}(s,r),a=function(t,e){const n=xa(Yn(e,xa(Yn(e,xa(t,e)),e)),e);return cw(n)<cw(t)?n:(t.addRef(),n.release(),t)}(function(t,e){if(!_t(t)||!pi(t))return t;const n=ma(t,e);cw(n)<=cw(t)&&(t=n);return t}(o,r),r),u=function(t,e){if(bo(t,e))return t;const n=xa(t,e),r=Yi(n,e),s=xa(r,e),i=Yi(s,e),o=xa(i,e);return cw(o)<cw(t)?o:t}(a,r),c=Iw(u,r),l=function(t,e){const n=Rw(t,e),r=e.valueOf(n);cw(r)<cw(t)&&(t=r);return t}(function(t,e){if(!_t(t)||!pi(t))return t;let n=Ct(t);_t(n)&&(n=[...n].reduce(((t,n)=>Pw(ao(e,t,qw(n,e)),e)),_));cw(n)<cw(t)&&(t=n);return t}(c,r),r);if(tr){const[t,e]=function(t,e){const[n,r]=$w(t,e),s=Ve(ga,n,e),i=dp(n)<dp(s)?n:s;return me(lw(us,n,e)<lw(us,i,e)?n:i,t)}(l,r);if(!e.equals(l))return i(qw(e,r))}const h=function(t,e){if(!t.contains(ws)&&!t.contains(Dr))return t;const n=e.valueOf(t);try{const r=function(t,e){const n=At(By,t);try{return e.valueOf(n)}finally{n.release()}}(n,e);return cw(r)<cw(t)?r:(t.addRef(),r.release(),t)}finally{n.release()}}(l,r);return i(Pw(h,r))}finally{s.pop().release()}}finally{}}function Iw(t,e){const n=function(t,e){return t};if(!t.contains(ws)&&!t.contains(Dr))return n(t);const r=function(t,e){e.pushDirective(ie.convertSinToCos,1);try{return e.valueOf(t)}finally{e.popDirective()}}(t,e),s=function(t,e){e.pushDirective(ie.convertCosToSin,1);try{return e.valueOf(t)}finally{e.popDirective()}}(t,e),i=cw(t),o=cw(r),a=cw(s),u=Uw(t),c=Uw(r),l=Uw(s);return n(a<o||l<c?a<i||l<u?s:t:o<i||c<u?r:t)}function Pw(t,e){const n=va(t,e);if(Bi(n,e))return t;const r=ba(t,e);if(Bi(r,e))return t;const s=ha(r,n);if(s){const i=oa(ca(r,n,e),s,e);if(Bi(i,e))return t;const o=oa(r,s,e),a=Yi(i,e),u=ma(lo(qw(eo(o,a,e),e),qw(eo(oa(n,s,e),a,e),e),e),e);return cw(u)<cw(t)?u:t}return t}function Rw(t,e){if(L(t))return t;if(Ft(t).equals(us)&&Li(Ai(t))){return So(function(t,e){const n=At(Py,t);try{return e.valueOf(n)}finally{n.release()}}(po(e,Yn(e,S),Rw(_i(t),e)),e),e)}if(_t(t)){const n=[];for(;_t(t);)n.push(Rw(Ft(t),e)),t=Ct(t);return At(...n)}return t}function Uw(t){return _t(t)&&pi(t)?ai(t)-1:1}function $w(t,e){return _t(t)?mw(t)?function(t,e){const n=t.lhs,r=t.rhs;if(D(r)&&r.isMinusOne()||!Ft(n).equals(er)||!c(r)||!r.isFraction()||!Vi(r,1,3)&&!Vi(r,1,2))return[t,ee];const s=Ai(n);$w(s,e);const i=_i(n);$w(i,e);let o=0,a=n;for(;kt!==Ct(a);)o++,a=Ct(a);if(o>2)return[t,ee];const{commonBases:u,termsThatAreNotPowers:l}=function(t,e){let n=null;const r=[],s=[];if(di(t)){let i=Ct(t);if(_t(i))for(;_t(i);){const t=Ft(i);if(mi(t)){const s=Ai(t),i=_i(t);Vi(i,1,2)&&(null==n?(n=i,r.push(s)):vo(i,n,e)&&r.push(s))}else s.push(t);i=Ct(i)}}else if(mi(t)){const e=Ai(t),s=_i(t);null==n&&Vi(s,1,2)&&(n=s,r.push(e))}return{commonBases:r,termsThatAreNotPowers:s}}(i,e);if(0===u.length)return[t,ee];const h=(t,n)=>Zn(e,t,n),f=s,p=u.reduce(h,S),d=l.reduce(h,S);let m=kt;if(Vi(r,1,3)){const n=lo(Zn(e,Yn(e,f),p),d,e),r=Xn(Yy(Mw(n,e),e));if(Math.abs(r)>Math.pow(2,32))return[t,ee];const s=Zn(e,An,p),i=Xn(Yy(Mw(s,e),e));if(Math.abs(i)>Math.pow(2,32))return[t,ee];const o=Zn(e,s,Ws),a=lo(Zn(e,x(-3),f),d,e),u=Xn(Yy(Mw(a,e),e));if(Math.abs(u)>Math.pow(2,32))return[t,ee];m=Gl([n,o,Zn(e,a,po(e,Ws,bn)),Zn(e,S,po(e,Ws,An))],e)}else if(Vi(r,1,2)){const n=Xn(Yy(Mw(p,e),e));if(Math.abs(n)>Math.pow(2,32))return[t,ee];const r=lo(Zn(e,x(-2),f),d,e),s=Xn(Yy(Mw(r,e),e));if(Math.abs(s)>Math.pow(2,32))return[t,ee];m=ao(e,p,ao(e,Zn(e,r,Ws),Zn(e,S,po(e,Ws,bn))))}const g=iw(m,Ws,e);if(0===g.ndim)return[t,ee];const y=g.filterElements((t=>!t.contains(us)));if(0===y.length)return[t,ee];const w=[],E=[];for(const t of Array.from(y)){const n=Xn(Yy(Mw(t,e),e));w.push(t),E.push(n)}const v=E.indexOf(Math.max.apply(Math,E)),b=w[v];if(!Vi(r,1,3)&&!Vi(r,1,2))return[t,ee];if(Vi(r,1,3)){const t=po(e,lo(f,ao(e,po(e,b,An),Zn(e,Zn(e,An,p),b)),e),qn),n=Zn(e,t,b);return[qw(ao(e,Zn(e,t,po(e,p,Bn)),n),e),ne]}if(Vi(r,1,2)){const t=po(e,lo(f,ao(e,po(e,b,bn),p),e),Bn),n=Zn(e,t,b),r=qw(ao(e,Zn(e,t,po(e,p,Bn)),n),e);if(!ci(Yy(Mw(r,e),e)))return[r,ne];return[qw(ao(e,Zn(e,Yn(e,t),po(e,p,Bn)),Yn(e,n)),e),ne]}return[kt,ne]}(t,e):function(t,e){let n=ee;const r=[];if(_t(t)){const s=Array.from(t).map((t=>{if(!n){let r;return[r,n]=$w(t,e),r}return t}));r.push(...s)}return[At(...r),n]}(t,e):[t,ee]}function zw(r,s,i){if(Aa(s))return function(r,s,i){if(r.equals(s))return S;if(!_t(r))return _;if(fi(r))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,Ly(Ai(t),n))}(r,s,i);if(pi(r))return function(t,e,n){const r=t.argList;try{return Gl([...r.map((t=>Ww(t,e,n)))],n)}finally{r.release()}}(r,s,i);const o=Ft(r);if(Aa(o)&&n(o,e.multiply))return function(t,e,n){const r=ai(t)-1,s=[];for(let i=0;i<r;i++){const o=[];let a=Ct(t);for(let t=0;t<r;t++){const r=Ft(a);i===t?o.push(Ww(r,e,n)):o.push(r),a=Ct(a)}s.push(no(o,n))}return Gl(s,n)}(r,s,i);if(Aa(o)&&n(o,e.pow))return function(t,e,n){const r=t.base,s=t.expo,i=n.divide(s,r),o=Ww(r,e,n),a=n.log(r),u=Ww(s,e,n);return n.multiply(n.add(n.multiply(i,o),n.multiply(a,u)),t)}(r,s,i);if(Aa(o)&&n(o,e.derivative))return function(r,s,i){const o=Ww(Ai(r),s,i);if(_t(o)){const s=o.opr;try{if(Aa(s)&&n(s,e.derivative)){const n=_i(o),s=_i(r),a=Ai(o);return i.compareFn(Ce)(n,s)<0?At(t(e.derivative),At(t(e.derivative),a,n),s):At(t(e.derivative),At(t(e.derivative),a,s),n)}}finally{s.release()}}return Ww(o,_i(r),i)}(r,s,i);if(Aa(o)&&n(o,e.log))return function(t,e,n){const r=Ww(Ai(t),e,n);return lo(r,Ai(t),n)}(r,s,i);if(Aa(o)&&n(o,e.sin))return function(t,e,n){const r=t.argList.head,s=Ww(r,e,n);return n.multiply(s,n.cos(r))}(r,s,i);if(Aa(o)&&n(o,e.cos))return function(t,e,n){const r=t.argList.head,s=Ww(r,e,n);return n.negate(n.multiply(s,n.sin(r)))}(r,s,i);if(Aa(o)&&n(o,e.exp))return function(t,e,n){const r=t.argList.head,s=Ww(r,e,n);return n.multiply(s,n.exp(r))}(r,s,i);if(Aa(o)&&n(o,e.tan))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,n.power(n.cos(Ai(t)),x(-2)))}(r,s,i);if(o.equals(or))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,n.power(n.subtract(S,n.power(Ai(t),bn)),Wn(-1,2)))}(r,s,i);if(o.equals(sr))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.negate(n.multiply(r,n.power(n.subtract(S,n.power(Ai(t),bn)),Wn(-1,2))))}(r,s,i);if(o.equals(ur))return function(t,e,n){const r=Ww(Ai(t),e,n),s=Yi(n.add(S,n.power(Ai(t),bn)),n);return qw(n.multiply(r,s),n)}(r,s,i);if(o.equals(Es))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,Ox(Ai(t),n))}(r,s,i);if(o.equals(br))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,function(t,e){if(Ft(t).equals(ar))return Ai(t);if(sn(t)){let e=Math.sinh(t.d);return Math.abs(e)<1e-10&&(e=0),ve(e)}return e.iszero(t)?vn:At(Es,t)}(Ai(t),n))}(r,s,i);if(o.equals(As))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,n.power(Ox(Ai(t),n),x(-2)))}(r,s,i);if(o.equals(ar))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,n.power(n.add(n.power(Ai(t),bn),S),Wn(-1,2)))}(r,s,i);if(o.equals(ir))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(r,n.power(n.add(n.power(Ai(t),bn),m),Wn(-1,2)))}(r,s,i);if(o.equals(cr))return function(t,e,n){const r=Ww(Ai(t),e,n),s=Yi(n.subtract(S,n.power(Ai(t),bn)),n);return n.multiply(r,s)}(r,s,i);if(o.equals(ys))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(r,Cx(Ai(t),n)),bn)}(r,s,i);if(o.equals(Jr))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(r,n.multiply(bn,_i(t))),Nx(Ai(t),n.add(_i(t),m),n))}(r,s,i);if(o.equals(Nr))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(n.multiply(n.exp(n.multiply(n.power(Ai(t),bn),m)),n.power(Ze.PI(n),Wn(-1,2))),bn),r)}(r,s,i);if(o.equals(Lr))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(n.multiply(n.exp(n.multiply(n.power(Ai(t),bn),m)),n.power(Ze.PI(n),Wn(-1,2))),x(-2)),r)}(r,s,i);if(o.equals(lr))return function(t,e,n){if(n.iszero(_i(t)))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(r,Tx(Ai(t),S,n)),m)}(t,e,n);return function(t,e,n){const r=Ww(Ai(t),e,n),s=n.add(_i(t),m),i=n.multiply(_i(t),m),o=Tx(Ai(t),s,n),a=lo(i,Ai(t),n),u=Tx(Ai(t),_i(t),n),c=n.multiply(a,u),l=n.add(o,c);return n.multiply(r,l)}(t,e,n)}(r,s,i);if(o.equals(hr))return function(t,e,n){if(n.iszero(_i(t)))return function(t,e,n){const r=Ww(Ai(t),e,n);return n.multiply(n.multiply(r,Tx(Ai(t),S,n)),m)}(t,e,n);return function(t,e,n){const r=Ww(Ai(t),e,n),s=n.add(_i(t),m),i=n.multiply(_i(t),m),o=lo(i,Ai(t),n),a=Mx(Ai(t),_i(t),n),u=Mx(Ai(t),s,n),c=n.multiply(o,a),l=n.add(u,c);return n.multiply(r,l)}(t,e,n)}(r,s,i);if(r.opr.equals(jr)&&_i(r).equals(s))return r.argList.head;return function(n,r,s){const i=n.argList;return i.contains(r)||i.isnil?At(t(e.derivative),n,r):_}(r,s)}(r,s,i);const o=yo(r,s,Ws,i);return yo(Ww(o,Ws,i),Ws,s,i)}function Ww(n,r,s){if(ui(r))throw new go("undefined function");return b(n)?b(r)?function(n,r,s){if(n.ndim+1>=ti)return At(t(e.derivative),n,r);const i=n.copyDimensions();i.push(r.dim(0));const o=n.nelem,a=r.nelem,u=new Array(o*a);for(let t=0;t<o;t++)for(let e=0;e<a;e++)u[t*a+e]=Ww(n.elem(t),r.elem(e),s);return new F(i,u)}(n,r,s):function(t,e,n){const r=t.mapElements((t=>Ww(t,e,n)));return t.withElements(r)}(n,r,s):b(r)?function(t,e,n){const r=[e.dim(0)],s=e.mapElements((e=>Ww(t,e,n)));return new F(r,s)}(n,r,s):zw(n,r,s)}function Xw(t,e){let n=0;const r=t.argList,s=function(t,e){e.pushDirective(ie.expandPowSum,0);try{return e.valueOf(t)}finally{e.popDirective()}}(r.head,e);let i,o,a=Ct(r);const u=e.valueOf(Ft(a));u.isnil?(i=oi(s),o=kt):ui(u)?(i=oi(s),o=u):(i=u,a=Ct(a),o=e.valueOf(Ft(a)));let c=s;for(;;){ui(o)?(n=jt(o),isNaN(n)&&Je("nth integral: check n")):n=1;let t=s;if(n>=0)for(let r=0;r<n;r++)t=Kw(t,i,e);else{n=-n;for(let r=0;r<n;r++)t=Ww(t,i,e)}if(c=t,bt(o))break;if(ui(o)){if(a=Ct(a),o=e.valueOf(Ft(a)),bt(o))break;ui(o)||(i=o,a=Ct(a),o=e.valueOf(Ft(a)))}else i=o,a=Ct(a),o=e.valueOf(Ft(a))}return c}function Kw(t,e,n){let r;return r=pi(t)?function(t,e,n){t=Ct(t);let r=Kw(Ft(t),e,n);_t(t)&&(r=t.tail().reduce(((t,r)=>ao(n,t,Kw(r,e,n))),r));return r}(t,e,n):di(t)?function(t,e,n){const[r,s]=function(t,e,n){const r=Ct(t);if(_t(r)){let t=S,s=t;for(const i of r)i.contains(e)?s=Zn(n,s,i):t=Zn(n,t,i);return[t,s]}return[S,S]}(t,e,n);return Zn(n,r,Hw(s,e,n))}(t,e,n):Hw(t,e,n),r.contains(jr)&&Je("integral: sorry, could not find a solution"),n.valueOf(qw(r,n))}function Hw(t,e,n){const r=Gw(t,e,n).toFixed(6),s=jw[r];if(Array.isArray(s)){const[r,i]=jl(t,e,s,!1,n);return bt(r)?At(jr,t,e):r}return At(jr,t,e)}const Jw={x:.95532,constexp:1.43762,constant:1.1441659362941434,constbase:1.2036412230421882,sin:1.7330548251830322,arcsin:1.6483368529465805,cos:1.0586721236863401,arccos:1.8405225918106694,tan:1.1224943776292506,arctan:1.1297397925394963,sinh:1.8176164926060079,cosh:1.9404934661708022,tanh:1.6421307715103122,log:1.477443701354924,erf:1.0825269225702916};function Gw(t,e,n){if(Aa(t))return Aa(e)&&t.equals(e)?Jw.x:Jw.constant;if(_t(t)){const r=t.car;if(Aa(r)){if(r.equals(er))return function(t,e,n){const r={};for(;_t(t);){const s=Ft(t);t=Ct(t);let i=0;i=s.contains(e)?Gw(s,e,n):Jw.constant,r[i.toFixed(6)]=!0}let s=0;for(const t of Object.keys(r||{}))s+=Number(t);return s}(t.argList,e,n);if(r.equals(ss))return function(t,e,n){let r=1;_t(t)&&[...t].forEach((t=>{t.contains(e)&&(r*=Gw(t,e,n))}));return r}(t.argList,e,n);if(r.equals(us))return Vw(t.base,t.expo,e,n);if(r.equals(qr))return Vw(Il(Dn,n),t.argList.head,e,n);if(r.equals(vs))return Vw(t.argList.head,ve(.5),e,n)}return function(t,e,n){if(!Ai(t).contains(e))return Jw.constant;const r=t.car;if(Aa(r)){const s=Gw(Ft(t.cdr),e,n),i=r.key(),o=Jw[i];if(!o)throw new Error("Unsupported function "+i);return Math.pow(o,s)}throw new Error("is_sym(car(u)) MUST be true.")}(t,e,n)}return Jw.constant}function Vw(t,e,n,r){let s=Jw.constant,i=Jw.constexp;if(t.contains(n)&&(s=Gw(t,n,r)),e.contains(n))i=Gw(e,n,r);else{if(s===Jw.constant)return Jw.constant;Li(e)?i=-1:ji(e)?i=.5:Qi(e)?i=-.5:Vi(e,2,1)?i=2:Vi(e,-2,1)&&(i=-2)}return Math.pow(s,i)}const jw={1.144166:["f(a,a*x)"],"1.046770":["f(1/x,log(x))"],"0.936400":["f(x**a,x**(a+1)/(a+1))"],1.095727:["f(x**(-2),-x**(-1))"],1.023118:["f(x**(-1/2),2*x**(1/2))"],.977405:["f(x**(1/2),2/3*x**(3/2))"],"0.955320":["f(x,x**2/2)"],.912636:["f(x**2,x**3/3)"],1.137302:["f(exp(a*x),1/a*exp(a*x))","f(a**x,a**x/log(a),or(not(number(a)),a>0))"],1.326774:["f(exp(a*x+b),1/a*exp(a*x+b))"],1.080259:["f(x*exp(a*x**2),exp(a*x**2)/(2*a))"],1.260228:["f(x*exp(a*x**2+b),exp(a*x**2+b)/(2*a))"],1.451902:["f(log(a*x),x*log(a*x)-x)"],.486192:["f(1/(a+x**2),1/sqrt(a)*arctan(x/sqrt(a)),or(not(number(a)),a>0))","f(1/(a-x**2),1/sqrt(a)*arctanh(x/sqrt(a)))","f(1/(a+b*x**2),1/sqrt(a*b)*arctan(x*sqrt(a*b)/a),or(not(number(a*b)),a*b>0))","f(1/(a+b*x**2),1/(2*sqrt(-a*b))*log((a+x*sqrt(-a*b))/(a-x*sqrt(-a*b))),or(not(number(a*b)),a*b<0))"],.697274:["f(1/sqrt(a-x**2),arcsin(x/(sqrt(a))))","f(1/sqrt(a+x**2),log(x+sqrt(a+x**2)))","f(1/sqrt(x**2+a),log(x+sqrt(x**2+a)))"],.476307:["f(1/(a+b*x),1/b*log(a+b*x))"],.226868:["f(1/(a+b*x)**2,-1/(b*(a+b*x)))"],2.904531:["f(1/(a+b*x)**3,-1/(2*b)*1/(a+b*x)**2)"],.455026:["f(x/(a+b*x),x/b-a*log(a+b*x)/b/b)"],.216732:["f(x/(a+b*x)**2,1/b**2*(log(a+b*x)+a/(a+b*x)))"],.434695:["f(x**2/(a+b*x),1/b**2*(1/2*(a+b*x)**2-2*a*(a+b*x)+a**2*log(a+b*x)))"],.207048:["f(x**2/(a+b*x)**2,1/b**3*(a+b*x-2*a*log(a+b*x)-a**2/(a+b*x)))"],2.650781:["f(x**2/(a+b*x)**3,1/b**3*(log(a+b*x)+2*a/(a+b*x)-1/2*a**2/(a+b*x)**2))"],.498584:["f(1/x*1/(a+b*x),-1/a*log((a+b*x)/x))"],.237479:["f(1/x*1/(a+b*x)**2,1/a*1/(a+b*x)-1/a**2*log((a+b*x)/x))"],3.040375:["f(1/x*1/(a+b*x)**3,1/a**3*(1/2*((2*a+b*x)/(a+b*x))**2+log(x/(a+b*x))))"],.521902:["f(1/x**2*1/(a+b*x),-1/(a*x)+b/a**2*log((a+b*x)/x))"],.446014:["f(1/x**3*1/(a+b*x),(2*b*x-a)/(2*a**2*x**2)+b**2/a**3*log(x/(a+b*x)))"],.248586:["f(1/x**2*1/(a+b*x)**2,-(a+2*b*x)/(a**2*x*(a+b*x))+2*b/a**3*log((a+b*x)/x))"],.464469:["f(x/(a+b*x**2),1/2*1/b*log(a+b*x**2))"],.443716:["f(x**2/(a+b*x**2),x/b-a/b*integral(1/(a+b*x**2),x))"],.236382:["f(1/(a+b*x**2)**2,x/(2*a*(a+b*x**2))+1/2*1/a*integral(1/(a+b*x**2),x))"],.508931:["f(1/x*1/(a+b*x**2),1/2*1/a*log(x**2/(a+b*x**2)))"],.532733:["f(1/x**2*1/(a+b*x**2),-1/(a*x)-b/a*integral(1/(a+b*x**2),x))"],.480638:["f(1/(a+b*x**3),1/3*1/a*(a/b)**(1/3)*(1/2*log(((a/b)**(1/3)+x)**3/(a+b*x**3))+sqrt(3)*arctan((2*x-(a/b)**(1/3))*(a/b)**(-1/3)/sqrt(3))))"],.438648:["f(x**2/(a+b*x**3),1/3*1/b*log(a+b*x**3))"],.459164:["f(x/(a+b*x**4),1/2*sqrt(b/a)/b*arctan(x**2*sqrt(b/a)),or(not(number(a*b)),a*b>0))","f(x/(a+b*x**4),1/4*sqrt(-b/a)/b*log((x**2-sqrt(-a/b))/(x**2+sqrt(-a/b))),or(not(number(a*b)),a*b<0))"],"0.450070":["f(x**3/(a+b*x**4),1/4*1/b*log(a+b*x**4))"],"1.448960":["f(sqrt(a+b*x),2/3*1/b*sqrt((a+b*x)**3))"],1.384221:["f(x*sqrt(a+b*x),-2*(2*a-3*b*x)*sqrt((a+b*x)**3)/15/b**2)"],1.322374:["f(x**2*sqrt(a+b*x),2*(8*a**2-12*a*b*x+15*b**2*x**2)*sqrt((a+b*x)**3)/105/b**3)"],1.516728:["f(sqrt(a+b*x)/x,2*sqrt(a+b*x)+a*integral(1/x*1/sqrt(a+b*x),x))"],1.587665:["f(sqrt(a+b*x)/x**2,-sqrt(a+b*x)/x+b/2*integral(1/x*1/sqrt(a+b*x),x))"],"0.690150":["f(1/sqrt(a+b*x),2*sqrt(a+b*x)/b)"],.659314:["f(x/sqrt(a+b*x),-2/3*(2*a-b*x)*sqrt(a+b*x)/b**2)"],.629856:["f(x**2/sqrt(a+b*x),2/15*(8*a**2-4*a*b*x+3*b**2*x**2)*sqrt(a+b*x)/b**3)"],.722428:["f(1/x*1/sqrt(a+b*x),1/sqrt(a)*log((sqrt(a+b*x)-sqrt(a))/(sqrt(a+b*x)+sqrt(a))),or(not(number(a)),a>0))","f(1/x*1/sqrt(a+b*x),2/sqrt(-a)*arctan(sqrt(-(a+b*x)/a)),or(not(number(a)),a<0))"],.756216:["f(1/x**2*1/sqrt(a+b*x),-sqrt(a+b*x)/a/x-1/2*b/a*integral(1/x*1/sqrt(a+b*x),x))"],1.434156:["f(sqrt(x**2+a),1/2*(x*sqrt(x**2+a)+a*log(x+sqrt(x**2+a))))","f(sqrt(a-x**2),1/2*(x*sqrt(a-x**2)+a*arcsin(x/sqrt(abs(a)))))","f(sqrt(a*x**2+b),x*sqrt(a*x**2+b)/2+b*log(x*sqrt(a)+sqrt(a*x**2+b))/2/sqrt(a),and(number(a),a>0))","f(sqrt(a*x**2+b),x*sqrt(a*x**2+b)/2+b*arcsin(x*sqrt(-a/b))/2/sqrt(-a),and(number(a),a<0))"],.729886:["f(1/x*1/sqrt(x**2+a),arcsec(x/sqrt(-a))/sqrt(-a),or(not(number(a)),a<0))","f(1/x*1/sqrt(x**2+a),-1/sqrt(a)*log((sqrt(a)+sqrt(x**2+a))/x),or(not(number(a)),a>0))","f(1/x*1/sqrt(a-x**2),-1/sqrt(a)*log((sqrt(a)+sqrt(a-x**2))/x),or(not(number(a)),a>0))"],"1.501230":["f(sqrt(x**2+a)/x,sqrt(x**2+a)-sqrt(a)*log((sqrt(a)+sqrt(x**2+a))/x),or(not(number(a)),a>0))","f(sqrt(x**2+a)/x,sqrt(x**2+a)-sqrt(-a)*arcsec(x/sqrt(-a)),or(not(number(a)),a<0))","f(sqrt(a-x**2)/x,sqrt(a-x**2)-sqrt(a)*log((sqrt(a)+sqrt(a-x**2))/x),or(not(number(a)),a>0))"],"0.666120":["f(x/sqrt(x**2+a),sqrt(x**2+a))","f(x/sqrt(a-x**2),-sqrt(a-x**2))"],1.370077:["f(x*sqrt(x**2+a),1/3*sqrt((x**2+a)**3))","f(x*sqrt(a-x**2),-1/3*sqrt((a-x**2)**3))"],1.730087:["f(sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),1/4*(x*sqrt((x**2+a**(1/3))**3)+3/2*a**(1/3)*x*sqrt(x**2+a**(1/3))+3/2*a**(2/3)*log(x+sqrt(x**2+a**(1/3)))))","f(sqrt(-a+x**6-3*a**(1/3)*x**4+3*a**(2/3)*x**2),1/4*(x*sqrt((x**2-a**(1/3))**3)-3/2*a**(1/3)*x*sqrt(x**2-a**(1/3))+3/2*a**(2/3)*log(x+sqrt(x**2-a**(1/3)))))"],.578006:["f(1/sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),x/a**(1/3)/sqrt(x**2+a**(1/3)))"],"0.552180":["f(x/sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),-1/sqrt(x**2+a**(1/3)))"],1.652787:["f(x*sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),1/5*sqrt((x**2+a**(1/3))**5))"],1.308862:["f(x**2*sqrt(x**2+a),1/4*x*sqrt((x**2+a)**3)-1/8*a*x*sqrt(x**2+a)-1/8*a**2*log(x+sqrt(x**2+a)))","f(x**2*sqrt(a-x**2),-x/4*sqrt((a-x**2)**3)+1/8*a*(x*sqrt(a-x**2)+a*arcsin(x/sqrt(a))),or(not(number(a)),a>0))"],1.342944:["f(x**3*sqrt(x**2+a),(1/5*x**2-2/15*a)*sqrt((x**2+a)**3),and(number(a),a>0))","f(x**3*sqrt(x**2+a),sqrt((x**2+a)**5)/5-a*sqrt((x**2+a)**3)/3,and(number(a),a<0))","f(x**3*sqrt(a-x**2),(-1/5*x**2-2/15*a)*sqrt((a-x**2)**3),or(not(number(a)),a>0))","f(sqrt(a-x**2)/x**3,-1/2*sqrt(a-x**2)/x**2+1/2*log((sqrt(a)+sqrt(a-x**2))/x)/sqrt(a),or(not(number(a)),a>0))","f(sqrt(a-x**2)/x**4,-1/3*sqrt((a-x**2)**3)/a/x**3,or(not(number(a)),a>0))"],.636358:["f(x**2/sqrt(x**2+a),1/2*x*sqrt(x**2+a)-1/2*a*log(x+sqrt(x**2+a)))","f(x**2/sqrt(a-x**2),-x/2*sqrt(a-x**2)+a/2*arcsin(x/sqrt(a)),or(not(number(a)),a>0))"],.652928:["f(x**3/sqrt(x**2+a),1/3*sqrt((x**2+a)**3)-a*sqrt(x**2+a))","f(1/x**3*1/sqrt(x**2+a),-1/2*sqrt(x**2+a)/a/x**2+1/2*log((sqrt(a)+sqrt(x**2+a))/x)/a**(3/2),or(not(number(a)),a>0))","f(1/x**3*1/sqrt(x**2-a),1/2*sqrt(x**2-a)/a/x**2+1/2*1/(a**(3/2))*arcsec(x/(a**(1/2))),or(not(number(a)),a>0))"],.764022:["f(1/x**2*1/sqrt(x**2+a),-sqrt(x**2+a)/a/x)","f(1/x**2*1/sqrt(a-x**2),-sqrt(a-x**2)/a/x,or(not(number(a)),a>0))"],"1.578940":["f(x**2*sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),1/6*x*sqrt((x**2+a**(1/3))**5)-1/24*a**(1/3)*x*sqrt((x**2+a**(1/3))**3)-1/16*a**(2/3)*x*sqrt(x**2+a**(1/3))-1/16*a*log(x+sqrt(x**2+a**(1/3))),or(not(number(a)),a>0))","f(x**2*sqrt(-a-3*a**(1/3)*x**4+3*a**(2/3)*x**2+x**6),1/6*x*sqrt((x**2-a**(1/3))**5)+1/24*a**(1/3)*x*sqrt((x**2-a**(1/3))**3)-1/16*a**(2/3)*x*sqrt(x**2-a**(1/3))+1/16*a*log(x+sqrt(x**2-a**(1/3))),or(not(number(a)),a>0))"],1.620055:["f(x**3*sqrt(a+x**6+3*a**(1/3)*x**4+3*a**(2/3)*x**2),1/7*sqrt((x**2+a**(1/3))**7)-1/5*a**(1/3)*sqrt((x**2+a**(1/3))**5),or(not(number(a)),a>0))","f(x**3*sqrt(-a-3*a**(1/3)*x**4+3*a**(2/3)*x**2+x**6),1/7*sqrt((x**2-a**(1/3))**7)+1/5*a**(1/3)*sqrt((x**2-a**(1/3))**5),or(not(number(a)),a>0))"],.332117:["f(1/(x-a)/sqrt(x**2-a**2),-sqrt(x**2-a**2)/a/(x-a))","f(1/(x+a)/sqrt(x**2-a**2),sqrt(x**2-a**2)/a/(x+a))"],1.571443:["f(sqrt(a-x**2)/x**2,-sqrt(a-x**2)/x-arcsin(x/sqrt(a)),or(not(number(a)),a>0))"],1.690994:["f(sin(a*x),-cos(a*x)/a)"],1.055979:["f(cos(a*x),sin(a*x)/a)"],1.116714:["f(tan(a*x),-log(cos(a*x))/a)"],.895484:["f(1/tan(a*x),log(sin(a*x))/a)"],.946989:["f(1/cos(a*x),log(tan(pi/4+a*x/2))/a)"],.591368:["f(1/sin(a*x),log(tan(a*x/2))/a)"],2.859462:["f(sin(a*x)**2,x/2-sin(2*a*x)/(4*a))"],"2.128050":["f(sin(a*x)**3,-cos(a*x)*(sin(a*x)**2+2)/(3*a))","f(sin(a*x)**4,3/8*x-sin(2*a*x)/(4*a)+sin(4*a*x)/(32*a))"],1.115091:["f(cos(a*x)**2,x/2+sin(2*a*x)/(4*a))"],1.081452:["f(cos(a*x)**3,sin(a*x)*(cos(a*x)**2+2)/(3*a))","f(cos(a*x)**4,3/8*x+sin(2*a*x)/(4*a)+sin(4*a*x)/(32*a))"],.349716:["f(1/sin(a*x)**2,-1/(a*tan(a*x)))"],.896788:["f(1/cos(a*x)**2,tan(a*x)/a)"],1.785654:["f(sin(a*x)*cos(a*x),sin(a*x)**2/(2*a))"],"3.188560":["f(sin(a*x)**2*cos(a*x)**2,-sin(4*a*x)/(32*a)+x/8)"],1.516463:["f(sin(a*x)/cos(a*x)**2,1/(a*cos(a*x)))"],2.707879:["f(sin(a*x)**2/cos(a*x),(log(tan(pi/4+a*x/2))-sin(a*x))/a)"],.369293:["f(cos(a*x)/sin(a*x)**2,-1/(a*sin(a*x)))"],.560019:["f(1/(sin(a*x)*cos(a*x)),log(tan(a*x))/a)"],.530332:["f(1/(sin(a*x)*cos(a*x)**2),(1/cos(a*x)+log(tan(a*x/2)))/a)"],.331177:["f(1/(sin(a*x)**2*cos(a*x)),(log(tan(pi/4+a*x/2))-1/sin(a*x))/a)"],.313621:["f(1/(sin(a*x)**2*cos(a*x)**2),-2/(a*tan(2*a*x)))"],3.172365:["f(sin(a+b*x),-cos(a+b*x)/b)"],1.127162:["f(cos(a+b*x),sin(a+b*x)/b)"],.352714:["f(1/(b+b*sin(a*x)),-tan(pi/4-a*x/2)/a/b)","f(1/(b-b*sin(a*x)),tan(pi/4+a*x/2)/a/b)","f(1/(a+b*sin(x)),1/sqrt(b**2-a**2)*log((a*tan(x/2)+b-sqrt(b**2-a**2))/(a*tan(x/2)+b+sqrt(b**2-a**2))),b**2-a**2)"],.454515:["f(1/(b+b*cos(a*x)),tan(a*x/2)/a/b)","f(1/(b-b*cos(a*x)),-1/tan(a*x/2)/a/b)","f(1/(a+b*cos(x)),1/sqrt(b**2-a**2)*log((sqrt(b**2-a**2)*tan(x/2)+a+b)/(sqrt(b**2-a**2)*tan(x/2)-a-b)),b**2-a**2)"],1.615441:["f(x*sin(a*x),sin(a*x)/a**2-x*cos(a*x)/a)"],1.543263:["f(x**2*sin(a*x),2*x*sin(a*x)/a**2-(a**2*x**2-2)*cos(a*x)/a**3)"],1.008798:["f(x*cos(a*x),cos(a*x)/a**2+x*sin(a*x)/a)"],.963724:["f(x**2*cos(a*x),2*x*cos(a*x)/a**2+(a**2*x**2-2)*sin(a*x)/a**3)"],1.611938:["f(arcsin(a*x),x*arcsin(a*x)+sqrt(1-a**2*x**2)/a)"],1.791033:["f(arccos(a*x),x*arccos(a*x)-sqrt(1-a**2*x**2)/a)"],1.123599:["f(arctan(a*x),x*arctan(a*x)-1/2*log(1+a**2*x**2)/a)"],1.387031:["f(x*log(a*x),x**2*log(a*x)/2-x**2/4)"],1.325058:["f(x**2*log(a*x),x**3*log(a*x)/3-1/9*x**3)"],2.108018:["f(log(x)**2,x*log(x)**2-2*x*log(x)+2*x)"],.403214:["f(1/x*1/(a+log(x)),log(a+log(x)))"],2.269268:["f(log(a*x+b),(a*x+b)*log(a*x+b)/a-x)"],2.486498:["f(log(a*x+b)/x**2,a/b*log(x)-(a*x+b)*log(a*x+b)/b/x)"],1.769733:["f(sinh(x),cosh(x))"],1.883858:["f(cosh(x),sinh(x))"],"1.606140":["f(tanh(x),log(cosh(x)))"],1.690661:["f(x*sinh(x),x*cosh(x)-sinh(x))"],1.799688:["f(x*cosh(x),x*sinh(x)-cosh(x))"],3.131954:["f(sinh(x)**2,sinh(2*x)/4-x/2)"],2.579685:["f(tanh(x)**2,x-tanh(x))"],3.548923:["f(cosh(x)**2,sinh(2*x)/4+x/2)"],1.058866:["f(x**3*exp(a*x**2),exp(a*x**2)*(x**2/a-1/(a**2))/2)"],"1.235270":["f(x**3*exp(a*x**2+b),exp(a*x**2)*exp(b)*(x**2/a-1/(a**2))/2)"],1.130783:["f(exp(a*x**2),-i*sqrt(pi)*erf(i*sqrt(a)*x)/sqrt(a)/2)"],1.078698:["f(erf(a*x),x*erf(a*x)+exp(-a**2*x**2)/a/sqrt(pi))"],"2.573650":["f(x**2*(1-x**2)**(3/2),(x*sqrt(1-x**2)*(-8*x**4+14*x**2-3)+3*arcsin(x))/48)","f(x**2*(1-x**2)**(5/2),(x*sqrt(1-x**2)*(48*x**6-136*x**4+118*x**2-15)+15*arcsin(x))/384)"],2.640666:["f(x**4*(1-x**2)**(3/2),(-x*sqrt(1-x**2)*(16*x**6-24*x**4+2*x**2+3)+3*arcsin(x))/128)"],1.086487:["f(x*exp(a*x),exp(a*x)*(a*x-1)/(a**2))"],1.267493:["f(x*exp(a*x+b),exp(a*x+b)*(a*x-1)/(a**2))"],1.037943:["f(x**2*exp(a*x),exp(a*x)*(a**2*x**2-2*a*x+2)/(a**3))"],1.210862:["f(x**2*exp(a*x+b),exp(a*x+b)*(a**2*x**2-2*a*x+2)/(a**3))"],"1.064970":["f(x**3*exp(a*x),exp(a*x)*x**3/a-3/a*integral(x**2*exp(a*x),x))"],1.242392:["f(x**3*exp(a*x+b),exp(a*x+b)*x**3/a-3/a*integral(x**2*exp(a*x+b),x))"]};function Qw(t,e){let n,r,s=e.valueOf(Ft(t.cdr)),i=Ct(t.cdr);const o=e.valueOf(Ft(i));for(kt.equals(o)?(n=oi(s),r=kt):ui(o)?(n=oi(s),r=o):(n=o,i=Ct(i),r=e.valueOf(Ft(i)));;){let t;if(ui(r)){if(t=jt(r),isNaN(t))throw new Error("nth derivative: check n")}else t=1;let o=s;if(t>=0)for(let r=0;r<t;r++)o=Ww(o,n,e);else{t=-t;for(let r=0;r<t;r++)o=Kw(o,n,e)}if(s=o,r.isnil)break;if(ui(r)){if(i=Ct(i),r=e.valueOf(Ft(i)),r.isnil)break;ui(r)||(n=r,i=Ct(i),r=e.valueOf(Ft(i)))}else n=r,i=Ct(i),r=e.valueOf(Ft(i))}return s}function Zw(t,e){if(Ft(t).equals(Xs)&&e.getBinding(Xs,kt).equals(Xs)){return Qw(t,e)}const n=e.valueOf(Ft(t));D(n)?Je("expected function invocation, found multiplication instead. Use '*' symbol explicitly for multiplication."):b(n)?Je("expected function invocation, found tensor product instead. Use 'dot/inner' explicitly."):h(n)&&Je("expected function, found string instead.");const r=Ft(Ct(n)),s=Ft(Ct(Ct(n))),i=Ct(t);if(!Ft(n).equals(Xr)||n.equals(Ft(t))){const t=new du,r=t.tos;t.push(n);let s=i;for(;_t(s);)t.push(e.valueOf(Ft(s))),s=Ct(s);return t.list(t.tos-r),t.pop()}let o=s,a=i;const u=new du,c=u.tos;for(;_t(o)&&_t(a);)u.push(Ft(o)),u.push(Ft(a)),o=Ct(o),a=Ct(a);u.list(u.tos-c);const l=u.pop();return u.push(r),_t(l)&&(u.push(l),Yw(u,e)),e.valueOf(u.pop())}function Yw(t,e){let n=0;const r=t.pop();let s=t.pop();if(b(s))return n=function(t,e,n,r){let s=0;const i=t.mapElements((t=>(n.push(t),n.push(e),s+=Yw(n,r),n.pop())));return n.push(t.withElements(i)),s}(s,r,t,e),n;if(_t(s)){const i=t.tos;for(Ft(s).equals(Ft(r))?t.push(At(Br,Ft(Ct(r)))):t.push(Ft(s)),s=Ct(s);_t(s);)t.push(Ft(s)),t.push(r),n+=Yw(t,e),s=Ct(s);return t.list(t.tos-i),n}if(!v(s))return t.push(s),0;let i=r;for(;_t(i);){if(s.equals(Ft(i)))return t.push(Ai(i)),1;i=Si(i)}return i=e.getBinding(s,kt),t.push(i),s!==i&&(t.push(r),n=Yw(t,e),0===n&&(t.pop(),t.push(s))),n}function tE(t,e,n){return function(t,e,n){const r=kh(t,e,n);return new F([t.length],r)}(function(t){if(b(t))return t.mapElements((function(t){if(v(t))return t;if(D(t))return t;if(c(t)&&t.isInteger())return t;throw new Error(`${t} must be an integer.`)}));throw new Error("must be a tensor.")}(t),function(t){if(b(t))return t.mapElements((function(t){if(wh(t))return t.str;throw new Error("must be a string.")}));throw new Error("must be a tensor.")}(e),n)}function eE(t,e){let n=t,r=e;n.addRef(),r.addRef();try{const t=new du;try{const e=t.tos;for(;_t(n)||_t(r);){const e=n.head,s=r.head;try{t.push(e),t.push(s),n.release(),n=n.cdr,r.release(),r=r.cdr}finally{e.release(),s.release()}}return t.list(t.tos-e),function(t){if(_t(t))return t;if(bt(t))return kt;throw new Vt}(t.pop())}finally{t.release()}}finally{n.release(),r.release()}}function nE(t){return D(t)?Je("expected function invocation, found multiplication instead. Use '*' symbol explicitly for multiplication."):b(t)?Je("expected function invocation, found tensor product instead. Use 'dot/inner' explicitly."):h(t)&&Je("expected function, found string instead."),function(t){if(_t(t))return t;throw new Error}(t)}function rE(t){if(!_t(t))return!1;{const e=t.opr;try{return e.equals(zr)}finally{e.release()}}}function sE(t,e){const n=t.opr;try{if(n.equals(Xs)&&e.getBinding(Xs,kt).equals(Xs))return Qw(t,e);const r=rE(n)?n:e.valueOf(n);try{if(!rE(r)){const n=new du,s=n.tos;n.push(r);let i=t.argList;for(;_t(i);)n.push(e.valueOf(Ft(i))),i=Ct(i);return n.list(n.tos-s),n.pop()}const n=nE(r),s=U(n.item(1)),i=At(...s.elems),o=n.item(2),a=t.argList;try{const t=eE(i,a);return _t(t)?function(t,e,n){const r=new du;try{return r.push(t),r.push(e),iE(r,n),n.valueOf(r.pop())}finally{r.release()}}(o,t,e):e.valueOf(o)}finally{s.release(),i.release(),o.release(),a.release()}}finally{r.release()}}finally{n.release()}}function iE(t,e){let n=0;const r=t.pop();let s=t.pop();if(b(s))return n=function(t,e,n,r){let s=0;const i=t.mapElements((t=>(n.push(t),n.push(e),s+=iE(n,r),n.pop())));return n.push(t.withElements(i)),s}(s,r,t,e),n;if(_t(s)){const i=t.tos;for(Ft(s).equals(Ft(r))?t.push(At(Br,Ft(Ct(r)))):t.push(Ft(s)),s=Ct(s);_t(s);)t.push(Ft(s)),t.push(r),n+=iE(t,e),s=Ct(s);return t.list(t.tos-i),n}if(!v(s))return t.push(s),0;let i=r;for(;_t(i);){if(s.equals(Ft(i)))return t.push(Ai(i)),1;i=Si(i)}return i=e.getBinding(s,kt),t.push(i),s!==i&&(t.push(r),n=iE(t,e),0===n&&(t.pop(),t.push(s))),n}function oE(t,e){for(let n=0;n<t.length;n++){aE(t[n],e)}}function aE(t,e){const[n,r]=ll(t,0,{useCaretForExponentiation:oe(e.getDirective(ie.useCaretForExponentiation)),useParenForTensors:oe(e.getDirective(ie.useParenForTensors)),explicitAssocAdd:!1,explicitAssocMul:!1,explicitAssocExt:!1});try{if(n>0){e.pushDirective(ie.expanding,1);try{e.valueOf(r)}finally{e.popDirective()}}}catch(e){throw e instanceof Error?new Error(`Unable to compute the value of definition ${JSON.stringify(t)}. Cause: ${e.message}. Stack: ${e.stack}`):new Error(`Unable to compute the value of definition ${JSON.stringify(t)}. Cause: ${e}`)}}function uE(t){if(v(t))return t;throw new Vt("Ex")}const cE=Object.freeze({antihermitian:!1,algebraic:!0,commutative:!0,complex:!0,extended_negative:!1,extended_nonnegative:!0,extended_nonpositive:!1,extended_nonzero:!0,extended_positive:!0,finite:!0,hermitian:!0,hypercomplex:!0,hyperreal:!0,imaginary:!1,infinite:!1,infinitesimal:!1,integer:!1,irrational:!1,negative:!1,noninteger:!1,nonnegative:!0,nonpositive:!1,nonzero:!0,positive:!0,rational:!0,real:!0,transcendental:!1,zero:!1});var lE,hE;class fE{constructor(){lE.set(this,new Map),hE.set(this,1)}has(t){return Pt(this,lE,"f").has(t)}get(t){if(Pt(this,lE,"f").has(t)){const e=Pt(this,lE,"f").get(t);return e.addRef(),e}throw new Vt}set(t,e){e.addRef(),Pt(this,lE,"f").set(t,e)}addRef(){var t;Rt(this,hE,(t=Pt(this,hE,"f"),++t),"f")}release(){var t;if(Rt(this,hE,(t=Pt(this,hE,"f"),--t),"f"),0===Pt(this,hE,"f"))for(const[t,e]of Pt(this,lE,"f").entries())e.release()}}function pE(t,e){if(_t(t)){e.beginCons(t);try{for(const n of t)pE(n,e)}finally{e.endCons(t)}}else if(p(t))e.boo(t);else if(l(t))e.flt(t);else if(N(t))e.keyword(t);else if(et(t)){e.beginMap(t);try{for(const n of t.entries)pE(n[0],e),pE(n[1],e)}finally{e.endMap(t)}}else if(c(t))e.rat(t);else if(v(t))e.sym(t);else if(h(t))e.str(t);else if(nt(t))e.tag(t);else if(b(t)){e.beginTensor(t);try{for(const n of t.elems)pE(n,e)}finally{e.endTensor(t)}}else St(t)?e.atom(t):bt(t)&&e.nil(t)}function dE(t,e){const n=ki(t),r=Fi(t);let s=_i(t);Aa(n)||Je("function name?"),Ft(s).equals(Br)&&(s=e.valueOf(Ai(s)));const i=At(Xr,s,r);return e.setBinding(n,i),kt}function mE(t,e){const n=Ci(t);if(!v(n))throw new Error("indexed assignment: expected a symbol name");const r=He.tos;Xo(e.valueOf(_i(t)));const s=Fi(t);_t(s)&&Ho([...s].map((function(t){return e.valueOf(t)}))),function(t){t<3&&Je("error in indexed assign");const e=He.tos-t,n=He.stack[e],r=He.stack[e+1];b(r)||Je("error in indexed assign: assigning to something that is not a tensor");const s=t-2;s>r.ndim&&Je("error in indexed assign");let i=0;for(let t=0;t<s;t++){const n=jt(He.stack[e+t+2]);(n<1||n>r.dim(t))&&Je("error in indexed assign\n"),i=i*r.dim(t)+n-1}for(let t=s;t<r.ndim;t++)i=i*r.dim(t)+0;const o=r.copyDimensions(),a=r.copyElements();if(r.ndim===s)return b(n)&&Je("error in indexed assign"),a[i]=n,Ge(He.tos-t),void Xo(new F(o,a));b(n)||Je("error in indexed assign"),r.ndim-s!==n.ndim&&Je("error in indexed assign");for(let t=0;t<n.ndim;t++)o[s+t]!==n.dim(t)&&Je("error in indexed assign");for(let t=0;t<n.nelem;t++)a[i+t]=n.elem(t);Ge(He.tos-t),Xo(new F(o,a))}(He.tos-r);const i=Ko();return e.setBinding(n,i),kt}function gE(t){if(function(t){const e=t.car;return!(!v(e)||!Oo(t))}(t))return t;throw new Error}function xE(t,e,n){const r=gE(t),s=r.lhs;if(_t(s))return s.opr.equals(wr)?(e.pop(),void(e.top.value=mE(r,n.$))):(e.pop(),void(e.top.value=dE(r,n.$)));if(v(s)||Je("symbol assignment: error in symbol"),n.firstTime)return n.firstTime=!1,new KW(r.rhs,n.$);e.pop();const i=n.$;i.setBinding(s,n.value),i.setUserFunction(s,kt),e.top.value=kt}lE=new WeakMap,hE=new WeakMap;class yE extends Fy{constructor(t,e,n,r){super(t,e),this.guardL=n,this.guardR=r}isKind(t,e){return!!this.match(t,e)}match(t,e){try{if(_t(t)&&3===t.length){const n=t.opr,r=t.item(1),s=t.item(2);return v(n)&&this.opr.equalsSym(n)&&this.guardL(r,e)&&this.guardR(s,e)?t:void 0}return}catch(t){throw new Error(`${this.name} + ${t}`)}}transform(t,e){const n=this.match(t,e);if(n){const[t,r]=e.transform(n.lhs),[s,i]=e.transform(n.rhs);return re(t)||re(s)?[ne,e.valueOf(At(n.opr,r,i))]:this.transform2(n.opr,n.lhs,n.rhs,n,e)}return[ee,t]}}const wE=t(e.component);function EE(t,e){return vE(t.lhs,t.rhs,t,e)}function vE(t,e,n,r){if(ki(n).equals(wE))return mE(n,r);if(_t(t))return dE(n,r),kt;v(t)||Je("symbol assignment: error in symbol");return function(t,e,n,r){return r.setBinding(t,e),r.setSymbolUsrFunc(t,n),kt}(t,r.valueOf(e),kt,r)}const DE=de(class extends yE{constructor(t){super("assign_any_any",xs,Ty,Ty),this.config=t}transform(t,e){const n=this.match(t,e);return n?this.transform2(n.opr,n.lhs,n.rhs,n,e):[ee,t]}transform2(t,e,n,r,s){return[ne,EE(r,s)]}});var bE;function AE(t,e){const n=t.argList;try{const t=n.item(0);try{const r=e.valueOf(t);try{if(rt(r)){const t=r.obj,e=n.tail();let s=t;for(let t=0;t<e.length;t++){const n=e[t];if(!v(n))throw console.warn("prop",`${n}`),new Vt;{const t=n.key();if(!t.startsWith("-"))throw console.warn("key",`${t}`),new Vt;s=s[t.slice(1)]}}if("boolean"==typeof s)return st(s);if("number"==typeof s)return X(s);if("string"==typeof s)return new B(s);throw console.warn("EcmaScript to U",`${s}`),new Vt}throw console.warn("val0",`${r}`),new Vt}finally{r.release()}}finally{t.release()}}finally{n.release()}}bE=new WeakMap;const SE=de(class extends Fy{constructor(t){super("dotdot",f("..")),this.config=t,bE.set(this,void 0),Rt(this,bE,sx(this.opr),"f")}get hash(){return Pt(this,bE,"f")}evaluate(t){throw new Vt}valueOf(t,e){return AE(t,e)}transform(t,e){const n=AE(t,e);return[n.equals(t)?ee:ne,((t,e)=>e)(0,n)]}});var kE;class _E{constructor(t){this.config=t,kE.set(this,qg(new it({})))}test(t,e){throw new Error(`${this.name}.test(${t},${e}) method not implemented.`)}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,e,n,r){return Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Pt(this,kE,"f")}get name(){return"JsObjectExtension"}valueOf(t,e){return ot(t),t}isKind(t,e){return rt(t)}subst(t,e,n){return ot(t),rt(e)&&t.equals(e)?n:t}toHumanString(t){return ot(t),t.toString()}toInfixString(t){return ot(t),t.toString()}toLatexString(t){return ot(t),t.toString()}toListString(t){return ot(t),t.toString()}evaluate(t,e){throw ot(t),new Vt}transform(t){return ot(t),[2,t]}}kE=new WeakMap;const FE=de(_E);function CE(t,e){const n=U(t.item(1)),r=t.item(2);try{const t=e.derivedEnv(),s=n.elems,i=s.length/2;for(let e=0;e<i;e++){const n=I(s[2*e]),r=t.valueOf(s[2*e+1]);t.setBinding(n,r)}return t.valueOf(r)}finally{n.release(),r.release()}}var TE,ME,OE,NE,LE,BE,qE,IE,PE,RE;class UE{constructor(t,e){TE.set(this,void 0),ME.set(this,void 0),OE.set(this,new Map),NE.set(this,new Map),this.listeners=[],LE.set(this,1),Rt(this,TE,t,"f"),Pt(this,TE,"f").addRef(),Rt(this,ME,e,"f")}addRef(){var t;Rt(this,LE,(t=Pt(this,LE,"f"),++t),"f")}release(){var t;Rt(this,LE,(t=Pt(this,LE,"f"),--t),"f"),0===Pt(this,LE,"f")&&Pt(this,TE,"f").release()}hasState(t){return Pt(this,TE,"f").hasState(t)}getState(t){return Pt(this,TE,"f").getState(t)}setState(t,e){Pt(this,TE,"f").setState(t,e)}addAtomListener(t){Pt(this,TE,"f").addAtomListener(t)}removeAtomListener(t){Pt(this,TE,"f").removeAtomListener(t)}getCellHost(){return Pt(this,TE,"f").getCellHost()}setCellHost(t){Pt(this,TE,"f").setCellHost(t)}getProlog(){throw new Error("getProlog method not implemented.")}getPrintHandler(){return Pt(this,TE,"f").getPrintHandler()}setPrintHandler(t){Pt(this,TE,"f").setPrintHandler(t)}abs(t){throw new Error("abs method not implemented.")}algebra(t,e){throw new Error("algebra method not implemented.")}add(...t){throw new Error("add method not implemented.")}arccos(t){throw new Error("arccos method not implemented.")}arcsin(t){throw new Error("arcsin method not implemented.")}arctan(t){throw new Error("arctan method not implemented.")}arg(t){throw new Error("arg method not implemented.")}buildOperators(){Pt(this,TE,"f").buildOperators()}clock(t){throw new Error("clock method not implemented.")}conj(t){throw new Error("conj method not implemented.")}cos(t){throw new Error("cos method not implemented.")}clearBindings(){Pt(this,OE,"f").clear(),Pt(this,TE,"f").clearBindings()}clearOperators(){Pt(this,TE,"f").clearOperators()}compareFn(t){return Pt(this,TE,"f").compareFn(t)}component(t,e){throw new Error("component method not implemented.")}defineEvalFunction(t,e){Pt(this,TE,"f").defineEvalFunction(t,e)}defineFunction(t,e){throw new Error("defineFunction method not implemented.")}defineStackFunction(t,e){Pt(this,TE,"f").defineStackFunction(t,e)}defineKeyword(t,e){Pt(this,TE,"f").defineKeyword(t,e)}defineExtension(t,e){Pt(this,TE,"f").defineExtension(t,e)}defineUserSymbol(t){Pt(this,TE,"f").defineUserSymbol(t)}derivedEnv(){return new UE(this,Pt(this,ME,"f"))}divide(t,e){throw new Error("divide method not implemented.")}equals(t,e){throw new Error("equals method not implemented.")}evaluate(t,...e){throw new Error("evaluate method not implemented.")}executeProlog(t){throw new Error("executeProlog method not implemented.")}exp(t){throw new Error("exp method not implemented.")}factor(t){throw new Error("factor method not implemented.")}factorize(t,e){throw new Error("factorize method not implemented.")}float(t){throw new Error("float method not implemented.")}getDirective(t){return Pt(this,TE,"f").getDirective(t)}getSymbolPredicates(t){throw new Error("getSymbolPredicates method not implemented.")}getSymbolPrintName(t){return Pt(this,TE,"f").getSymbolPrintName(t)}getSymbolUsrFunc(t){throw new Error("getSymbolYsrFunc method not implemented.")}getSymbolsInfo(){return Pt(this,TE,"f").getSymbolsInfo()}handlerFor(t){return Pt(this,TE,"f").handlerFor(t)}im(t){throw new Error("im method not implemented.")}inner(t,e){throw new Error("inner method not implemented.")}is(t,e){throw new Error("is method not implemented.")}iscomplex(t){throw new Error("iscomplex method not implemented.")}isExpanding(){throw new Error("isExpanding method not implemented.")}isFactoring(){throw new Error("isFactorin method not implemented.")}isimag(t){throw new Error("isimag method not implemented.")}isinfinite(t){throw new Error("isinfinite method not implemented.")}isinfinitesimal(t){throw new Error("isinfinitesimal method not implemented.")}isminusone(t){throw new Error("isminusone method not implemented.")}isnegative(t){throw new Error("isnegative method not implemented.")}isone(t){if(bt(t))return!1;throw new Error(`isone ${t} method not implemented.`)}ispositive(t){throw new Error("ispositive method not implemented.")}isreal(t){throw new Error("isreal method not implemented.")}isscalar(t){throw new Error("iscalar method not implemented.")}iszero(t){if(l(t))return t.isZero();if(bt(t))return!1;throw new Error(`iszero ${t} method not implemented.`)}log(t){throw new Error("log method not implemented.")}multiply(...t){throw new Error("multiply method not implemented.")}negate(t){throw new Error("negate method not implemented.")}extensionFor(t){throw new Error("extensionFor method not implemented.")}outer(...t){throw new Error("outer method not implemented.")}polar(t){throw new Error("polar method not implemented.")}power(t,e){throw new Error("power method not implemented.")}re(t){throw new Error("re method not implemented.")}rect(t){throw new Error("rect method not implemented.")}remove(t){throw new Error("remove method not implemented.")}pushDirective(t,e){Pt(this,TE,"f").pushDirective(t,e)}popDirective(){Pt(this,TE,"f").popDirective()}setSymbolOrder(t,e){Pt(this,TE,"f").setSymbolOrder(t,e)}setSymbolPredicates(t,e){throw new Error("setSymbolPredicates method not implemented.")}setSymbolPrintName(t,e){throw new Error("setSymbolPrintName method not implemented.")}setSymbolUsrFunc(t,e){Pt(this,NE,"f").set(t.key(),e)}simplify(t){throw new Error("simplify method not implemented.")}sin(t){throw new Error("sin method not implemented.")}sqrt(t){throw new Error("sqrt method not implemented.")}st(t){throw new Error("st method not implemented.")}subst(t,e,n){throw new Error("subst method not implemented.")}subtract(t,e){throw new Error("subtract method not implemented.")}toInfixString(t){return Pt(this,TE,"f").toInfixString(t)}toLatexString(t){return Pt(this,TE,"f").toLatexString(t)}toSExprString(t){return Pt(this,TE,"f").toSExprString(t)}transform(t){const e=this.valueOf(t);try{return e.equals(t)?(t.addRef(),[ee,t]):(e.addRef(),[ne,e])}finally{e.release()}}valueOf(t,e){if(e)throw new Vt("TODO: DerivedEnv.valueOf");if(_t(t)){const e=t.opr;try{const n=f("..");if(v(e))return e.equals(xs)?vE(t.lhs,t.rhs,gE(t),this):e.equals(wr)?Pt(this,TE,"f").valueOf(t):e.equals(n)?AE(t,this):e.equals(ns)?CE(t,this):Pt(this,TE,"f").valueOf(function(t,e,n){const r=[...e].map((t=>n.valueOf(t)));return At(t,...r)}(e,t.argList,this))}finally{e.release()}}else if(St(t)){if(p(t))return t;if(l(t))return t;if(rt(t)){return new _E(Pt(this,ME,"f")).valueOf(t,this)}if(N(t))return t;if(et(t))return Pt(this,TE,"f").valueOf(t);if(c(t))return t;if(h(t))return t;if(v(t)){const e=t.key();return Pt(this,OE,"f").has(e)?Pt(this,OE,"f").get(e):Pt(this,TE,"f").valueOf(t)}if(b(t))return Pt(this,TE,"f").valueOf(t);{const e=Pt(this,TE,"f").extensionFor(t);return e?e.valueOf(t,this):t}}throw new Error(`DerivedEnv.valueOf ${t} method not implemented.`)}getBinding(t,e){const n=t.key();return Pt(this,OE,"f").has(n)?Pt(this,OE,"f").get(n):Pt(this,TE,"f").getBinding(t,e)}getUserFunction(t){throw new Error("getUserFunction method not implemented.")}hasBinding(t,e){return Pt(this,TE,"f").hasBinding(t,e)}hasUserFunction(t){return!!Pt(this,NE,"f").has(t.key())||Pt(this,TE,"f").hasUserFunction(t)}setBinding(t,e){Pt(this,OE,"f").set(t.key(),e)}setUserFunction(t,e){Pt(this,NE,"f").set(t.key(),e)}}TE=new WeakMap,ME=new WeakMap,OE=new WeakMap,NE=new WeakMap,LE=new WeakMap;class $E{constructor(){BE.set(this,new cu),Pt(this,BE,"f").push(function(){const t={};return zE(t,ie.complexAsClock,0),zE(t,ie.complexAsPolar,0),zE(t,ie.complexAsRectangular,0),zE(t,ie.convertExpToTrig,0),zE(t,ie.convertTrigToExp,0),zE(t,ie.evaluatingAsFloat,0),zE(t,ie.expanding,1),zE(t,ie.expandAbsSum,0),zE(t,ie.expandCosSum,0),zE(t,ie.expandPowSum,1),zE(t,ie.expandSinSum,0),zE(t,ie.factoring,0),zE(t,ie.keepZeroTermsInSums,0),zE(t,ie.renderFloatAsEcmaScript,0),zE(t,ie.useCaretForExponentiation,0),zE(t,ie.useParenForTensors,0),zE(t,ie.depth,0),zE(t,ie.drawing,0),zE(t,ie.nonstop,0),zE(t,ie.forceFixedPrintout,1),zE(t,ie.maxFixedPrintoutDigits,6),zE(t,ie.printMode,Ke.Human),zE(t,ie.codeGen,0),Object.freeze(t)}())}push(t,e){const n=function(t){return{...t}}(Pt(this,BE,"f").top);zE(n,t,e);const r=Object.freeze(n);Pt(this,BE,"f").push(r)}pop(){Pt(this,BE,"f").pop()}get(t){return Pt(this,BE,"f").top[t]}}function zE(t,e,n){switch(e){case ie.canonicalize:n&&(t[ie.familiarize]=0);break;case ie.familiarize:n&&(t[ie.canonicalize]=0);break;case ie.expanding:t[ie.factoring]=n?0:1;break;case ie.factoring:t[ie.expanding]=n?0:1;break;case ie.complexAsClock:n&&(zE(t,ie.complexAsPolar,0),zE(t,ie.complexAsRectangular,0));break;case ie.complexAsPolar:n&&(zE(t,ie.complexAsClock,0),zE(t,ie.complexAsRectangular,0),t[ie.convertExpToTrig]=0);break;case ie.complexAsRectangular:n&&(zE(t,ie.complexAsClock,0),zE(t,ie.complexAsPolar,0));break;case ie.convertCosToSin:n&&(t[ie.convertSinToCos]=0);break;case ie.convertSinToCos:n&&(t[ie.convertCosToSin]=0);break;case ie.convertExpToTrig:n&&(t[ie.convertTrigToExp]=0,t[ie.complexAsPolar]=0);break;case ie.convertTrigToExp:n&&(t[ie.convertExpToTrig]=0)}t[e]=n}BE=new WeakMap;class WE{print(...t){}}class XE{constructor(t,e){this.config=e,qE.set(this,void 0),Rt(this,qE,I(t),"f")}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,e,n,r){return Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}test(t,r,s){if(n(r,e.iszero))return!1;throw new Error(`AbstractKeywordExtension.test ${t} ${r} method not implemented.`)}keyword(){return Pt(this,qE,"f")}iscons(){return!1}operator(){throw new Vt}isKind(t){return!!v(t)&&t.equalsSym(Pt(this,qE,"f"))}subst(t,e,n,r){throw new Error("Keyword.subst Symbol Method not implemented.")}toHumanString(t,e){return t.key()}toInfixString(t,e){return t.key()}toLatexString(t,e){throw new Error("Keyword.toLatexString Symbol Method not implemented.")}toListString(t,e){return Pt(this,qE,"f").key()}evaluate(t,e,n){return this.transform(Tt(t,e),n)}transform(t,e){throw new Error("Keyword.transform Symbol Method not implemented.")}valueOf(t,e){throw new Error(`Keyword.valueOf(${t.key()}) Symbol Method not implemented.`)}}qE=new WeakMap;let KE=class{constructor(t,e){IE.set(this,void 0),PE.set(this,void 0),Rt(this,IE,t,"f"),Rt(this,PE,e,"f")}create(t){return new HE(Pt(this,IE,"f"),Pt(this,PE,"f"),t)}};IE=new WeakMap,PE=new WeakMap;class HE extends XE{constructor(t,e,n){super(t,n),this.config=n,RE.set(this,void 0),Rt(this,RE,e,"f")}get hash(){return Gg}get name(){return this.keyword().key()}transform(t,e){return Aa(t)&&t.equalsSym(this.keyword())?(Pt(this,RE,"f").call(this,e),[ne,kt]):[ee,t]}}var JE,GE,VE,jE,QE;RE=new WeakMap;class ZE{constructor(t,e,n){this.opr=t,this.hash=e,this.evaluator=n}create(){return new YE(this.opr,this.hash,this.evaluator)}}class YE extends Fy{constructor(t,e,n){super(t.key(),t),this.evaluator=n,JE.set(this,void 0),Rt(this,JE,e,"f")}get hash(){return Pt(this,JE,"f")}transform(t,e){const n=this.evaluator(t,e);return[n.equals(t)?ee:ne,((t,e)=>e)(0,n)]}}function tv(t,e){const n=sx(t);return new ZE(t,n,e)}JE=new WeakMap;class ev{constructor(t){this.atom=t}get hash(){return qg(this.atom)}get name(){return this.atom.type}iscons(){return!1}operator(){throw new Vt}isKind(t){return!!St(t)&&t.type===this.atom.type}toHumanString(t,e){return`${t}`}toInfixString(t,e){return`${t}`}toLatexString(t,e){return`${t}`}toListString(t,e){return`${t}`}evaluate(t,e,n){throw new Error("evaluate method not implemented.")}transform(t,e){return me(this.valueOf(t,e),t)}valueOf(t,e){return t}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,e,n,r){return Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}subst(t,e,n,r){return t}test(t,e,n){return!1}}class nv{constructor(t){this.$=t,this.name="unknown"}binL(t,e,n,r){throw new Error("Method not implemented.")}binR(t,e,n,r){throw new Error("Method not implemented.")}dispatch(t,e,n,r){throw new Error("Method not implemented.")}test(t,e){throw new Error("Method not implemented.")}iscons(){return!0}operator(){throw new Error}get hash(){throw new Error("UnknownConsExtension.hash Method not implemented.")}isKind(t){throw new Error("UnknownConsExtension.isKind Method not implemented.")}subst(t,e,n){throw new Error("UnknownConsExtension.subst Method not implemented.")}toHumanString(t){throw new Error(`${t.toString()} is not defined.`)}toInfixString(t){throw new Error(`${t.toString()} is not defined.`)}toLatexString(t){throw new Error(`${t.toString()} is not defined.`)}toListString(t){const e=this.$;return`(${[...t].map((t=>e.toSExprString(t))).join(" ")})`}evaluate(t,e){throw new Error("UnknownConsExtension. Method not implemented.")}transform(t){throw new Error("UnknownConsExtension. Method not implemented.")}valueOf(t){throw new Error("UnknownConsExtension. Method not implemented.")}}const rv=t(e.add),sv=t(e.multiply),iv=t(e.pow),ov=t(e.iscomplex),av=t(e.isimag),uv=t(e.isinfinite),cv=t(e.isinfinitesimal),lv=t(e.isnegative),hv=t(e.ispositive),fv=t(e.isreal),pv=t(e.iszero);class dv{constructor(t,e,n){this.expr=t,this.scope=e,this.target=n}}class mv{constructor(t){GE.set(this,void 0),this.sources=[],Rt(this,GE,t,"f")}atom(t){throw new Error("atom method not implemented.")}beginCons(t){const r=t.opr;try{if(v(r)&&n(r,e.deref)){const e=t.arg,n=Pt(this,GE,"f").valueOf(e);at(n)&&this.sources.push(n)}}finally{r.release()}}endCons(t){}beginTensor(t){}endTensor(t){}beginMap(t){}endMap(t){}boo(t){}flt(t){}keyword(t){}rat(t){}str(t){}sym(t){}tag(t){}nil(t){}}GE=new WeakMap;class gv{constructor(){VE.set(this,new Map),jE.set(this,void 0),QE.set(this,[])}addAtomListener(t){Pt(this,QE,"f").push(t)}removeAtomListener(t){const e=Pt(this,QE,"f").indexOf(t);e>-1&&Pt(this,QE,"f").splice(e,1)}setScope(t){Rt(this,jE,t,"f")}reaction(t,e){const n=new mv(Pt(this,jE,"f"));pE(t,n);const r=n.sources;for(let n=0;n<r.length;n++){const s=r[n],i=new dv(t,Pt(this,jE,"f"),e);Pt(this,VE,"f").has(s.id)?Pt(this,VE,"f").get(s.id)?.push(i):Pt(this,VE,"f").set(s.id,[i])}}reset(t,e,n){for(let r=0;r<Pt(this,QE,"f").length;r++){const s=Pt(this,QE,"f")[r];try{s.reset(t,e,n)}catch(t){}}const r=n.id;if(Pt(this,VE,"f").has(r)){const t=Pt(this,VE,"f").get(r);for(let e=0;e<t.length;e++){const n=t[e],r=n.expr,s=n.scope,i=n.target,o=s.valueOf(r);i.reset(o)}}}deref(t,e){}}function xv(n){const r=function(t){if(t)return{allowUndeclaredVars:"number"==typeof t.allowUndeclaredVars?t.allowUndeclaredVars:eX.Nil,assumes:t.assumes?t.assumes:{},dependencies:Array.isArray(t.dependencies)?t.dependencies:[],enable:Array.isArray(t.enable)?t.enable:[],disable:Array.isArray(t.disable)?t.disable:[],noOptimize:"boolean"==typeof t.noOptimize&&t.noOptimize,useCaretForExponentiation:"boolean"==typeof t.useCaretForExponentiation&&t.useCaretForExponentiation,useDerivativeShorthandLowerD:"boolean"==typeof t.useDerivativeShorthandLowerD&&t.useDerivativeShorthandLowerD,useIntegersForPredicates:"boolean"==typeof t.useIntegersForPredicates&&t.useIntegersForPredicates,useParenForTensors:"boolean"==typeof t.useParenForTensors&&t.useParenForTensors};return{allowUndeclaredVars:eX.Nil,assumes:{},dependencies:[],enable:[],disable:[],noOptimize:!1,useCaretForExponentiation:!1,useDerivativeShorthandLowerD:!1,useIntegersForPredicates:!1,useParenForTensors:!1}}(n),s=[],i=function(){const t=new Map,e=new Map,n=new Map,r=new Map;return{clear(){t.clear(),e.clear(),n.clear(),r.clear()},getProps:e=>t.get(e.key())||cE,setProps(e,n){const s=e.key();if(n){const i=Object.freeze(Object.assign({...this.getProps(e)},function(t){const e={...t};return"boolean"==typeof e.infinite&&e.infinite&&(e.finite=!1,e.infinitesimal=!1,e.integer=!1,e.nonzero=!0,e.real=!1,e.zero=!1),"boolean"==typeof e.infinitesimal&&e.infinitesimal&&(e.finite=!0,e.infinite=!1,e.nonzero=!0,e.real=!1),"boolean"==typeof e.negative&&(e.positive=!1,e.nonnegative=!1,e.zero=!1,e.nonzero=!0),"boolean"==typeof e.zero&&e.zero&&(e.infinitesimal=!0,e.integer=!0,e.nonzero=!1,e.negative=!1,e.positive=!1),e}(n)));t.set(s,i),r.set(s,e)}else t.delete(s)},hasBinding:t=>(uE(t),e.has(t.key())),getBinding:t=>e.get(t.key())||kt,getUserFunction:t=>n.get(t.key())||kt,hasUserFunction:t=>n.has(t.key()),setBinding(t,n){uE(t);const s=t.key();e.set(s,n),r.set(s,t)},setUserFunction(t,e){uE(t);const s=t.key();bt(e)?n.delete(s):(n.set(s,e),r.set(s,t))},entries(){const t=[];return e.forEach((function(e,n){const s=r.get(n);if(!s)throw new Error;bt(e)||t.push({sym:s,value:e})})),t},delete(n){const s=n.key();t.delete(s),e.delete(s),r.delete(s)}}}(),o=new Map,a=[],u=[];for(const t of le)u[t]={};const h=[];for(const t of le)h[t]={};let d=new WE;const g=new $E,x={},y={};function w(){if(g.get(ie.expanding)){const t=u[ue];if(void 0===t)throw new Vt;return t}if(g.get(ie.factoring)){const t=u[ce];if(void 0===t)throw new Vt;return t}return{}}function E(){if(g.get(ie.expanding)){const t=h[ue];if(t)return t;throw new Vt}if(g.get(ie.factoring)){const t=h[ce];if(t)return t;throw new Vt}return{}}function D(t){const e=qg(t),n=w()[e];if(Array.isArray(n)&&n.length>0){for(const e of n)if(e.isKind(t,F))return e;throw new go(`No matching operator for hash ${e}`)}return new ev(t)}function b(){const t=kt.name,e=w()[t];if(Array.isArray(e)&&e.length>0){for(const t of e)if(t.isKind(kt,F))return t;throw new go(`No matching operator for hash ${t}`)}}const A=new gv,S=[],k=new fE;let _=1;const F={get listeners(){return S},addRef(){_++},release(){_--,0===_&&k.release()},hasState:t=>k.has(t),getState:t=>k.get(t),setState(t,e){k.set(t,e)},addAtomListener(t){A.addAtomListener(t)},removeAtomListener(t){A.removeAtomListener(t)},getCellHost:()=>(A.setScope(F),A),setCellHost(t){throw new Vt},getBinding(t,e){if(I(t),i.hasBinding(t))return i.getBinding(t);{const n=E()[t.key()];if(Array.isArray(n)&&n.length>0){const r=function(t,e){return bt(e)?[sx(t)]:ix(e)}(t,e);for(let s=0;s<r.length;s++){const i=r[s];for(let r=0;r<n.length;r++)if(n[r].hash===i){const s=Ev(t,e,n[r]);return new j(s,i)}}}switch(r.allowUndeclaredVars){case eX.Err:return Ut(new B(`Use of undeclared Var ${t.key()}.`));case eX.Nil:return t;default:throw new Error("Unexpected config.allowUndeclaredVars")}}},hasBinding(t){if(i.hasBinding(t))return!0;{const e=E()[t.key()];return!!(Array.isArray(e)&&e.length>0)}},setBinding(t,e){i.setBinding(t,e)},getUserFunction:t=>F.getSymbolUsrFunc(t),hasUserFunction:t=>o.has(t.key()),setUserFunction:(t,e)=>F.setSymbolUsrFunc(t,e),getPrintHandler:()=>d,setPrintHandler(t){d=t||new WE},abs:t=>F.evaluate(e.abs,t),algebra:(t,e)=>tE(t,e,F),add:(...t)=>F.evaluate(e.add,...t),arccos:t=>F.evaluate(e.arccos,t),arcsin:t=>F.evaluate(e.arcsin,t),arctan:t=>F.evaluate(e.arctan,t),arg:t=>F.evaluate(e.arg,t),clearOperators(){a.length=0;for(const t of le){const e=u[t];for(const t in e)e[t]=[];const n=h[t];for(const t in n)n[t]=[]}},defineEvalFunction(t,e){F.defineExtension(tv(t,e),!1)},defineFunction(t,e){const n=function(t){if(_t(t)){const e=t.head;if(v(e))return e;throw new Error}throw new Error}(t),r=function(t){if(_t(t)){const e=t.head;if(v(e))return sx(e);throw new Error}throw new Error}(t);F.setBinding(n,new j(e,r))},defineStackFunction(t,e){F.defineExtension(tv(t,function(t){return function(e,n){const r=new du;return t(e,n,n,r),r.pop()}}(e)),!1)},defineKeyword(t,e){F.defineExtension(function(t,e){return new KE(t,e)}(t,e),!1)},defineUserSymbol(t,e=!1){var n;o.set(t.key(),t),F.defineKeyword(t,(n=t,t=>{const e=t.getBinding(n,kt);return bt(e)||n.equals(e)?n:t.valueOf(e)})),e&&F.buildOperators()},defineExtension(t,e=!1){a.push(t),e&&F.buildOperators()},divide:(t,e)=>F.multiply(t,F.power(e,m)),clearBindings(){i.clear()},compareFn(t){const e=y[t.key()];if(e)return function(t,n){return e.compare(t,n,F)};throw new Vt(`${t} missing compareFn`)},component:(t,n)=>F.evaluate(e.component,t,n),clock:t=>F.evaluate(e.clock,t),conj:t=>F.evaluate(e.conj,t),cos:t=>F.evaluate(e.cos,t),derivedEnv(){return new UE(this,r)},evaluate(e,...n){const r=At(...n),s=Tt(t(e),r);return F.valueOf(s)},executeProlog(t){oE(t,F)},exp:t=>F.evaluate(e.exp,t),factor:t=>F.evaluate(e.factor,t),float:t=>F.evaluate(e.float,t),getSymbolPredicates:t=>i.getProps(t),getSymbolUsrFunc:t=>i.getUserFunction(t),getSymbolsInfo:()=>i.entries(),buildOperators(){for(const t of a){const e=t.create(r);if(yv(e.dependencies,r.dependencies)){const t="number"==typeof e.phases?e.phases:he;for(const n of le)if(t&n){if(!e.hash)throw new go("operator MUST have a 'hash' property.");{const t=u[n];Array.isArray(t[e.hash])?t[e.hash].push(e):t[e.hash]=[e]}if(e.iscons()){const t=e.operator();try{const r=t.key(),s=h[n];Array.isArray(s[r])?s[r].push(e):s[r]=[e]}finally{t.release()}}}}}a.length=0;for(const t of le){const e=h[t];for(const t in e){const n=e[t],r=new Map;for(let e=0;e<n.length;e++){const s=n[e].operator();r.has(t)||r.set(t,s)}r.forEach((function(t,e){if(!(Array.isArray(n)&&n.length>0))throw new Vt;sx(t);for(let t=0;t<n.length;t++)n[t].hash}))}const n=u[t];for(const t in n){const e=n[t];for(const t of e);}}},is(t,e){const n=At(t,e),r=F.valueOf(n);return p(r)?r.isTrue():!!c(r)&&r.isOne()},iscomplex:t=>F.is(ov,t),isExpanding:()=>g.get(ie.expanding)>0,isFactoring:()=>g.get(ie.factoring)>0,isimag:t=>!bt(t)&&(!c(t)&&(!l(t)&&F.is(av,t))),isinfinite:t=>F.is(uv,t),isinfinitesimal:t=>F.is(cv,t),isminusone:t=>!bt(t)&&((c(t)||!!l(t))&&t.isMinusOne()),isnegative:t=>F.is(lv,t),isone:t=>!t.isnil&&((c(t)||!!l(t))&&t.isOne()),ispositive:t=>F.is(hv,t),isreal:t=>F.is(fv,t),isscalar:t=>!bt(t)&&(!!c(t)||(!!l(t)||!!v(t))),iszero:t=>F.is(pv,t),equals:(t,e)=>t.equals(e),factorize:(t,e)=>t.contains(e)&&Pi(t,e)&&v(e)?Jo(t,e,F):t,getDirective:t=>g.get(t),getSymbolPrintName(t){const e=x[t.key()];return"string"==typeof e?e:t.key()},im:t=>F.evaluate(e.imag,t),inner(n,r){const s=F.valueOf(n),i=F.valueOf(r),o=At(t(e.inner),s,i);return F.valueOf(o)},log:t=>F.evaluate(e.log,t),multiply:(...t)=>F.evaluate(e.multiply,...t),negate:t=>F.multiply(m,t),handlerFor(t){if(St(t))return D(t);if(bt(t))return b();throw new Vt(`${t}`)},extensionFor(t){if(!_t(t)){if(St(t))return D(t);if(bt(t))return b();throw new Vt}{const e=t.head;try{if(_t(e))throw new Error(`${t}`);const n=ix(t);for(const e of n){const n=w()[e];if(Array.isArray(n))for(const e of n)if(e.isKind(t,F))return e}return new nv(F)}finally{e.release()}}},outer:(...t)=>F.evaluate(e.outer,...t),polar:t=>F.evaluate(e.polar,t),power:(t,n)=>F.evaluate(e.pow,t,n),getProlog:()=>s,re:t=>F.evaluate(e.real,t),rect:t=>F.evaluate(e.rect,t),remove(t){i.delete(t)},pushDirective(t,e){g.push(t,e)},popDirective(){g.pop()},setSymbolOrder(t,e){y[t.key()]=e},setSymbolPredicates(t,e){i.setProps(t,e)},setSymbolPrintName(t,e){x[t.key()]=e},setSymbolUsrFunc(t,e){"string"==typeof t?i.setUserFunction(f(t),e):i.setUserFunction(t,e)},simplify:t=>F.evaluate(e.simplify,t),sin:t=>F.evaluate(e.sin,t),sqrt:t=>F.evaluate(e.sqrt,t),st:t=>F.evaluate(e.st,t),subst:(t,n,r)=>F.evaluate(e.subst,t,n,r),subtract:(t,e)=>F.add(t,F.negate(e)),toInfixString(t){const e=F.extensionFor(t);return e?e.toInfixString(t,F):`${t}`},toLatexString(t){const e=F.extensionFor(t);return e?e.toLatexString(t,F):`${t}`},toSExprString(t){const e=F.extensionFor(t);if(e)return e.toListString(t,F);throw new Error(`No operator found for expression with name ${JSON.stringify(t.name)}`)},transform(t){if(_t(t)){const e=t.opr;if(_t(e)){const n=e.opr;try{if(n.equals(zr)){const e=sE(t,F);return[ne,e]}throw console.warn("head",`${e}`),console.warn("expr",`${t}`),new Vt}finally{n.release()}}else if(v(e)){if(i.hasBinding(e)){const n=F.getBinding(e,t);if(J(n))return me(n.body(t.argList,F),t)}}else if(c(e)){const n=w().Rat,r=wv(t.argList,n,F);if(r)return r.evaluate(e,t.argList,F);console.warn(`No unique operators found for Rat from ${n.length} choice(s).`)}const n=w(),r=ix(t);for(const e of r){const r=n[e];if(Array.isArray(r)){const e=wv(t,r,F);if(e){return e.transform(t,F)}}else if(_t(t)){const e=t.opr;if(v(e)&&i.hasBinding(e)){const n=F.getBinding(e,t);if(!bt(n)&&_t(n)){if(n.opr.equals(zr)){const e=sE(t,F);return[ne,e]}if(n.opr.equals(Xr)){const e=Zw(t,F);return[ne,e]}}}}}if(v(e)){const n=t.arg;try{if(St(n)){const r=F.handlerFor(n).dispatch(n,e,kt,F);try{return me(r,t)}finally{r.release()}}}finally{n.release()}}return[ee,t]}if(bt(t))return[ee,t];{const e=F.extensionFor(t);return e?e.transform(t,F):[ee,t]}},valueOf(t,e){{const n=F.transform(t)[1];if(!e)return n;try{return e.push(n),kt}finally{n.release()}}if(_t(t)){const n=t.opr;if(v(n)){const r=F.getBinding(n,t);if(J(r)){const n=r.body(t.argList,F);if(!e)return n;try{return e.push(n),kt}finally{n.release()}}}else if(c(n)){const r=w().Rat,s=wv(t.argList,r,F);if(s){const t=s.valueOf(n,F);if(!e)return t;try{return e.push(t),kt}finally{t.release()}}else console.warn(`No unique operators found for Rat from ${r.length} choice(s).`)}const r=w(),s=ix(t);for(const i of s){const s=r[i];if(Array.isArray(s)){const n=wv(t,s,F);if(n){const r=n.valueOf(t,F);if(!e)return r;try{return e.push(r),kt}finally{r.release()}}}else if(_t(t)&&v(n)){const r=F.getBinding(n,t);if(!bt(r)&&_t(r)){if(r.opr.equals(zr))throw new Error("TODO B");if(r.opr.equals(Xr)){const n=Zw(t,F);if(!e)return n;try{return e.push(n),kt}finally{n.release()}}}}}return e?(e.push(t),kt):t}if(bt(t))return e?(e.push(t),kt):t;{const n=F.extensionFor(t);if(!n)return e?(e.push(t),kt):t;{const r=n.valueOf(t,F);if(!e)return r;try{return e.push(r),kt}finally{r.release()}}}}};F.setSymbolPrintName(rv,"+"),F.setSymbolPrintName(sv,"*"),F.setSymbolPrintName(iv,"pow"),F.setSymbolPrintName(t(e.rco),">>"),F.setSymbolPrintName(t(e.lco),"<<"),F.setSymbolPrintName(t(e.inner),"|"),F.setSymbolPrintName(t(e.outer),"^"),F.setSymbolPrintName(t(e.abs),"abs"),F.setSymbolPrintName(t(e.E),"e"),F.setSymbolPrintName(t(e.PI),"pi"),F.setSymbolPrintName(t(e.NIL),"()"),F.setSymbolPrintName(t(e.IMU),"i"),F.setSymbolPrintName(t(e.exp),"exp"),F.getDirective(ie.useCaretForExponentiation)!==ae(r.useCaretForExponentiation)&&F.pushDirective(ie.useCaretForExponentiation,ae(r.useCaretForExponentiation)),F.getDirective(ie.useIntegersForPredicates)!==ae(r.useIntegersForPredicates)&&F.pushDirective(ie.useIntegersForPredicates,ae(r.useIntegersForPredicates)),F.getDirective(ie.useParenForTensors)!==ae(r.useParenForTensors)&&F.pushDirective(ie.useParenForTensors,ae(r.useParenForTensors));for(const t of r.enable)1!==F.getDirective(t)&&F.pushDirective(t,1);for(const t of r.disable)0!==F.getDirective(t)&&F.pushDirective(t,0);return F}function yv(t,e){if(Array.isArray(t)){for(const n of t)if(n.startsWith("~")){const t=n.substring(1);if(e.indexOf(t)>=0)return!1}else if(e.indexOf(n)<0)return!1;return!0}return!0}function wv(t,e,n){const r=[];for(const s of e)s.isKind(t,n)&&r.push(s);if(1===r.length)return r[0];if(r.length>0){return r[0]}}function Ev(t,e,n){return(r,s)=>{const i=new uu(s);return bt(e)?n.valueOf(Tt(t,r),i):n.valueOf(e,i)}}function vv(t,e){return Dv(e.valueOf(t.argList.head),e)}function Dv(t,e){if(b(t))return t.map((function(t){return Dv(t,e)}));if(l(t))return function(t,e){const n=Yy(t,e);if(l(n)){const t=n.d,e=t.toString().split(".");if(2===e.length){const n=e[1].length,r=function(t,e){if(isNaN(t))return[0,0];if(t===1/0)return[1,0];if(t===-1/0)return[-1,0];const n=t<0?-1:1;if(t=Math.abs(t),Math.abs(t-Math.floor(t))<e){return[t*n,1]}if(t<1e-19){return[n,1e19]}if(t>1e19){return[1e19*n,1]}let r,s=t,i=0,o=1;for(;;){s=1/(s-Math.floor(s));const n=o;if(o=o*Math.floor(s)+i,i=n,r=Math.floor(t*o+.5),!(Math.abs(t-r/o)>e)||s===Math.floor(s))break}return r*=n,[r,o]}(t,1/Math.pow(10,n));return Wn(r[0],r[1])}return x(t)}return At(rr,n)}(t,e);if(_t(t)){const n=t.head,r=t.argList;return Tt(Dv(n,e),Mt(Dv(r,e)))}return t}VE=new WeakMap,jE=new WeakMap,QE=new WeakMap;class bv{compare(t,e,n){if(h(t)&&h(e))return Yt;if(mi(t)){const r=t.base;return this.compare(r,e,n)}if(mi(e)){const r=e.base;return this.compare(t,r,n)}if(t===e||t.equals(e))return Yt;if(bt(t)&&bt(e))return Yt;if(bt(t))return Zt;if(bt(e))return te;if(D(t)&&D(e))return Hn(t,e);if(D(t))return Zt;if(D(e))return te;if(L(t)&&L(e))return Yt;if(L(t))return Zt;if(L(e))return te;if(v(t)&&v(e))return jy(t,e);if(v(t))return Zt;if(v(e))return te;if(b(t)&&b(e))return Qy(t,e);if(b(t))return Zt;if(b(e))return te;for(;_t(t)&&_t(e);){const n=Zy(Ft(t),Ft(e));if(n!==Yt)return n;t=Ct(t),e=Ct(e)}return _t(t)?Zt:_t(e)?te:O(t)&&O(e)?qx(t.printname,e.printname):O(t)?Zt:O(e)?te:M(t)&&M(e)?Yt:M(t)?Zt:M(e)?te:h(t)?h(e)?qx(t.str,e.str):Zt:h(e)?te:k(t)&&k(e)?Yt:k(t)?Zt:k(e)?te:Yt}}function Av(t){if(_t(t)){const e=t;if(sh(e)){const t=e.cdr;if(bt(t))return Dn;{const e=t.car;return ui(e)?e:Dn}}return Dn}return Dn}function Sv(t){if(_t(t)){const e=t;if(sh(e)){const t=e.cdr;if(bt(t))return Dn;if(ui(t.car)){const n=t.cdr;return Uy(Tt(e.opr,n))}return e}return e}return t}class kv{compare(t,e,n){const r=Sv(t),s=Sv(e);if(wh(r)&&wh(s))return Yt;if(p(r)||p(s))return Yt;switch(function(t,e,n){if(t.equals(e))return Yt;if(ah(t)&&ah(e)){const r=Xy(t),s=Xy(e);if(r.equals(t)&&s.equals(e))return Gy(r,s);switch(_v(r,s,n)){case te:return te;case Zt:return Zt;default:return _v($y(t,M),$y(e,M),n)}}if(ah(t))return te;if(ah(e))return Zt;if(Fv(t)&&Fv(e))return _v($y(t,L),$y(e,L),n);if(Fv(t))return te;if(Fv(e))return Zt;if(ui(t)&&ui(e))return Yt;if(b(t)&&b(e)){if(t.ndim<e.ndim)return Zt;if(t.ndim>e.ndim)return te;const n=t.ndim;for(let r=0;r<n;r++){if(t.dim(r)<e.dim(r))return Zt;if(t.dim(r)>e.dim(r))return te}return Yt}const r=Sv(t),s=Sv(e);return r.equals(t)&&s.equals(e)?Zy(r,s):_v(r,s,n)}(r,s,n)){case te:return te;case Zt:return Zt;case Yt:return Hn(Av(t),Av(e))}}}function _v(n,r,s){return s.compareFn(t(e.add))(n,r)}function Fv(t){return!!L(t)||!(!_t(t)||!sh(t)||1!==ih(t,L))}function Cv(t,e){const n=t.cdr,r=function(t,e,n){if(!function(t,e){return!(ui(t)&&Hn(t,vn)<0)&&(!(ui(e)&&Hn(e,vn)<0)&&!(ui(t)&&ui(e)&&Hn(t,e)<0))}(t,e))return vn;return lo(lo(hw(t),hw(e),n),hw(n.subtract(t,e)),n)}(e.valueOf(Ft(n)),e.valueOf(Ai(n)),e);return r}function Tv(t){return t.clearBindings(),t.executeProlog(t.getProlog()),kt}function Mv(t,e){let n=t.argList;for(;_t(n);){const t=Ft(n);v(t)?e.remove(t):Je("symbol error"),n=Ct(n)}return kt}function Ov(t){if(_t(t)&&v(t.opr)&&n(t.opr,e.pow)){const e=_i(t);if(D(e)&&Kh(e))return 1}return c(t)&&!Ih(t.b,1)?1:0}function Nv(t){let e=0;for(t=Ct(t);_t(t);)Ov(Ft(t))&&e++,t=Ct(t);return e}function Lv(t){for(t=t.argList;_t(t);){const r=Ft(t);if(_t(r)&&v(r.opr)&&n(r.opr,e.pow)){const t=r.expo;if(c(t)&&Kh(t))return 1}t=Ct(t)}return 0}function Bv(t){return(t=Math.abs(t))>0&&t<1e-4?t.toExponential(5):t.toPrecision(6)}function qv(t){if(_t(t)&&v(t.opr)&&n(t.opr,e.pow)){const e=t.expo;if(D(e)&&e.isNegative())return!1}return!c(t)||!Ih(t.a,1)}function Iv(t){return n(t,e.PI)?"pi":"Ω"===t.key()?"Omega":t.key()}const Pv=t(e.add),Rv=t(e.assign),Uv=t(e.multiply),$v=t(e.derivative),zv=t(e.factorial),Wv=t(e.component),Xv=t(e.pow),Kv=t(e.testeq),Hv=t(e.testge),Jv=t(e.testgt),Gv=t(e.testle),Vv=t(e.testlt),jv=t(e.E);function Qv(t,e,n,r,s){aD("(",r,s),Zv(t,e,n,r,s),aD(")",r,s)}function Zv(t,e,n,r,s){_t(t)?(Hh(t)||Ft(t).equals(Pv)&&Hh(Ai(t)))&&aD("-",r,s):Hh(t)&&aD("-",r,s),Ft(t).equals(Pv)?function(t,e,n,r,s){Yv(Ai(t),e,n,r,s),t=Si(t);for(;_t(t);)Hh(Ft(t))?aD(" - ",r,s):aD(" + ",r,s),Yv(Ft(t),e,n,r,s),t=Ct(t)}(t,e,n,r,s):Yv(t,e,n,r,s)}function Yv(t,e,n,r,s){_t(t)&&t.opr.equals(Uv)?function(t,e,n,r,s){if(Lv(t))return function(t,e,n,r,s){let i=0;t=Ct(t);for(;_t(t);){const o=Ft(t);if(t=Ct(t),qv(o))if(++i>1&&aD(" ",r,s),c(o)){aD(Ph(o.a),r,s)}else tD(o,e,n,r,s)}0===i&&aD("1",r,s)}(t,e,n,r,s),aD(" / ",r,s),void function(t,e,n,r,s){const i=Nv(t);i>1&&aD("(",r,s);let o=0;t=Ct(t);for(;_t(t);){let i=Ft(t);if(t=Ct(t),Ov(i))if(++o>1&&aD(" ",r,s),c(i)){aD(Ph(i.b),r,s)}else Mh(_i(i))?(i=Ai(i),tD(i,e,n,r,s)):(sD(Ai(i),e,n,r,s),r.useCaretForExponentiation?aD("^",r,s):aD("**",r,s),iD(_i(i),r,s))}i>1&&aD(")",r,s)}(t,e,n,r,s);t=Ct(t),Mh(Ft(t))&&(t=Ct(t));tD(Ft(t),e,n,r,s),t=Ct(t);for(;_t(t);)aD(" ",r,s),tD(Ft(t),e,n,r,s),t=Ct(t)}(t,e,n,r,s):tD(t,e,n,r,s)}function tD(n,r,s,i,o){if(c(n))nD(n,i,o);else if(l(n))rD(n,i,o);else if(v(n))n.equalsSym(jv)?aD("exp(1)",i,o):aD(Iv(n),i,o);else if(h(n))aD(n.str,i,o);else if(b(n))!function(t,e,n,r,s){oD(t,0,0,e,n,r,s)}(n,r,s,i,o);else if(St(n))!function(n,r,s,i,o){const a=new rh(r,s);try{const s=r.handlerFor(n).dispatch(n,t(e.infix),kt,a);try{if(!h(s))throw T(s)?s:new Vt;aD(Qt(s),i,o)}finally{s.release()}}finally{a.release()}}(n,r,s,i,o);else if(_t(n)&&(n.opr.equals(Pv)||n.opr.equals(Uv)))Qv(n,r,s,i,o);else if(_t(n)&&n.opr.equals(Xv))!function(t,e,n,r,s){if(Ai(t).equals(jv))return aD("exp(",r,s),Zv(_i(t),e,n,r,s),void aD(")",r,s);if(L(t))return void aD("i",r,s);const i=_i(t);if(D(i)&&Kh(i))return void function(t,e,n,r,s){aD("1 / ",r,s),Mh(_i(t))?tD(t=Ai(t),e,n,r,s):(sD(Ai(t),e,n,r,s),r.useCaretForExponentiation?aD("^",r,s):aD("**",r,s),iD(_i(t),r,s))}(t,e,n,r,s);sD(Ai(t),e,n,r,s),r.useCaretForExponentiation?aD("^",r,s):aD("**",r,s);t=_i(t),D(t)?iD(t,r,s):_t(t)&&(t.opr.equals(Pv)||t.opr.equals(Uv)||t.opr.equals(Xv)||t.opr.equals(zv))?Qv(t,e,n,r,s):Zv(t,e,n,r,s)}(n,r,s,i,o);else if(Ft(n).equals(zv))!function(t,e,n,r,s){sD(Ai(t),e,n,r,s),aD("!",r,s)}(n,r,s,i,o);else{if(!Ft(n).equals(Wv)){if(Ft(n).equals($v))return aD("d",i,o),void eD(n,r,s,i,o);if(_t(n)&&n.opr.equals(Rv)){const t=n.lhs,e=n.rhs;return Zv(t,r,s,i,o),aD(" = ",i,o),void Zv(e,r,s,i,o)}return Ft(n).equals(Kv)?(Zv(Ai(n),r,s,i,o),aD(" == ",i,o),void Zv(_i(n),r,s,i,o)):Ft(n).equals(Hv)?(Zv(Ai(n),r,s,i,o),aD(" >= ",i,o),void Zv(_i(n),r,s,i,o)):Ft(n).equals(Jv)?(Zv(Ai(n),r,s,i,o),aD(" > ",i,o),void Zv(_i(n),r,s,i,o)):Ft(n).equals(Gv)?(Zv(Ai(n),r,s,i,o),aD(" <= ",i,o),void Zv(_i(n),r,s,i,o)):Ft(n).equals(Vv)?(Zv(Ai(n),r,s,i,o),aD(" < ",i,o),void Zv(_i(n),r,s,i,o)):_t(n)?(sD(Ft(n),r,s,i,o),void eD(n,r,s,i,o)):void(bt(n)?aD("nil",i,o):aD(" ? ",i,o))}!function(t,e,n,r,s){if(sD(Ai(t),e,n,r,s),aD("[",r,s),t=Si(t),_t(t))for(Zv(Ft(t),e,n,r,s),t=Ct(t);_t(t);)aD(",",r,s),Zv(Ft(t),e,n,r,s),t=Ct(t);aD("]",r,s)}(n,r,s,i,o)}}function eD(t,e,n,r,s){if(aD("(",r,s),t=Ct(t),_t(t))for(Zv(Ft(t),e,n,r,s),t=Ct(t);_t(t);)aD(",",r,s),Zv(Ft(t),e,n,r,s),t=Ct(t);aD(")",r,s)}function nD(t,e,n){if(aD(Ph(t.a),e,n),t.isInteger())return;aD("/",e,n);aD(Ph(t.b),e,n)}function rD(t,e,n){const r=Bv(t.d);let s=0;for(;s<r.length&&"."!==r.charAt(s)&&"E"!==r.charAt(s)&&"e"!==r.charAt(s);)s++;if(aD(r.substring(0,s),e,n),"."===r.charAt(s)){const t=s++;for(;s<r.length&&"E"!==r.charAt(s)&&"e"!==r.charAt(s);)s++;let i=s;for(;"0"===r.charAt(i-1);)i--;i-t>1&&aD(r.substring(t,i),e,n)}if("E"===r.charAt(s)||"e"===r.charAt(s))if(s++,aD(" 10^",e,n),"-"===r.charAt(s)){for(aD("(-",e,n),s++;"0"===r.charAt(s);)s++;aD(r.substring(s),e,n),aD(")",e,n)}else{for("+"===r.charAt(s)&&s++;"0"===r.charAt(s);)s++;aD(r.substring(s),e,n)}}function sD(t,e,n,r,s){D(t)?function(t,e,n,r,s){c(t)&&Gh(t)?nD(t,r,s):Qv(t,e,n,r,s)}(t,e,n,r,s):_t(t)&&(t.opr.equals(Pv)||t.opr.equals(Uv)||t.opr.equals(Xv)||t.opr.equals(zv))?Qv(t,e,n,r,s):Zv(t,e,n,r,s)}function iD(t,e,n){if(l(t))return aD("(",e,n),rD(t,e,n),void aD(")",e,n);c(t)&&Xh(t)?nD(t,e,n):(aD("(",e,n),nD(t,e,n),aD(")",e,n))}function oD(t,e,n,r,s,i,o){if(e===t.ndim)return void Zv(t.elems[n],r,s,i,o);let a=1,u=t.ndim;for(let n=e+1;n<u;n++)a*=t.dims[n];i.useParenForTensors?aD("(",i,o):aD("[",i,o),u=t.dims[e];for(let c=0;c<u;c++)oD(t,e+1,n,r,s,i,o),c<u-1&&aD(",",i,o),n+=a;i.useParenForTensors?aD(")",i,o):aD("]",i,o)}function aD(t,e,n){n.push(t)}function uD(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r);const s=r.pop();try{const t=[];Zv(s,e,n,{useCaretForExponentiation:!!(i={}).useCaretForExponentiation,useParenForTensors:!!i.useParenForTensors},t);!function(t,e){const n=new B(t);try{tg(n,e)}finally{n.release()}}(t.join(""),r)}finally{s.release()}var i}function cD(t,e){const n=t.argList;try{const t=n.item0,r=n.item1;try{const n=e.valueOf(t),s=e.valueOf(r);return s.isnil?lD(n,oi(n)):lD(n,s)}finally{t.release(),r.release()}}finally{n.release()}}function lD(t,e){return hD(t,e,_)}function hD(t,e,n){if(t.equals(e))return n.isZero()?S:n;if(_t(t)){if(mi(t)){const r=t.base,s=t.expo;return r.equals(e)&&D(s)&&Hn(n,s)<0?s:n}return t.tail().reduce((function(t,n){return hD(n,e,t)}),n)}return n}function fD(t,e){const n=e.valueOf(Ai(t));return function(t,e,n){const r=lD(t,e);return Mo(lo(t,n.power(e,r),n),e,n)}(n,(t=e.valueOf(_i(t))).isnil?oi(n):t,e)}function pD(t,e){const n=t.argList;try{const r=Ft(n);if(!_t(r)&&v(Ai(r))){const n=t.car;if(v(n)){return e.getBinding(n,kt)}return kt}return r}finally{n.release()}}function dD(t,e,n){return yh(t,((t,n)=>{const r=t.item0;try{return e(r,n)}finally{r.release()}}),n)}const mD=t(e.real);function gD(t,e){const n=At(mD,t);try{return e.valueOf(n)}finally{n.release()}}function xD(t,e,n){if(L(t))return!1;const r=_i(e);if(mi(t)&&!Gt(r)&&Ai(t).contains(A))return!0;if(mi(t)&&Gi(Ai(t),-1)&&!Gt(r))return!0;if(b(t)){for(let n=0;n<t.nelem;n++)if(xD(t.elem(n),e))return!0;return!1}return!!_t(t)&&[...t].some((t=>xD(t,e)))}function yD(t,e){if(_t(t)){if(mi(t)){const e=t.cdr;if(_t(e)){if(_a(e.car)){const t=e.argList;if(_t(t)){return t.car.contains(A)}}}}return[...t].some((function(t){return yD(t)}))}if(b(t)){for(let e=0;e<t.nelem;e++)if(yD(t.elem(e)))return!0;return!1}return!1}const wD=t(e.abs);function ED(t,e){if(St(t))return e.handlerFor(t).dispatch(t,wD,kt,e);const n=ba(t,e),r=va(t,e);try{const t=vD(n,e),s=vD(r,e);try{return lo(t,s,e)}finally{t.release(),s.release()}}finally{n.release(),r.release()}}function vD(t,e){const n=function(t,e){return t};if(bo(t,e))return n(t);if(jn(t,e))return n(t);if(D(t)&&t.isNegative())return n(Yn(e,t));if(Oi(t))return n(t);if(Sa(t))return n(t);if(L(t))return n(S);if(_t(t)&&pi(t)&&(xD(t,t)||yD(t)||t.contains(A))){const r=So(t,e),s=gD(r,e),i=Dw(r,e),o=po(e,s,bn),a=po(e,i,bn),u=ao(e,o,a);return n(Iw(po(e,u,Bn),e))}if(_t(t)&&mi(t)&&Gi(Ft(t.cdr),-1))return n(e.getDirective(ie.evaluatingAsFloat)?be:S);if(_t(t)&&mi(t)){const r=Ai(t),s=_i(t);if(D(s)){if(Oi(s)){const t=ED(r,e);return n(po(e,t,s))}if(c(s)&&D(r)&&!r.isNegative())return n(po(e,r,s))}}const r=Ai(t);if(mi(t)&&_a(r))return n(Il(gD(_i(t),e),e));if(_t(t)&&di(t)){const r=(t,n)=>Zn(e,t,n);return n(t.tail().map((t=>vD(t,e))).reduce(r))}if(_t(t)&&fi(t))return n(t);if(b(t)){const r=function(t,e){if(1!==t.ndim)throw new Error("abs(tensor) with tensor rank > 1");const n=qw(t,e);return e.valueOf(qw(po(e,Iy(n,wo(n,e),e),Bn),e))}(t,e);return n(r)}if(io(t)||_t(t)&&pi(t)&&io(Ai(t))){const r=Yn(e,t);return n(At(wD,r))}return _t(t)&&pi(t),n(At(wD,t))}function DD(t,e){return dD(t,ED,e)}var bD;bD=new WeakMap;const AD=de(class extends yE{constructor(t){super("add_2_rat_uom",Ce,c,k),this.config=t,bD.set(this,void 0),Rt(this,bD,Yg(Ce,Hg,jg),"f")}get hash(){return Pt(this,bD,"f")}transform2(t,e,n,r,s){throw new TypeError(s.toInfixString(r))}}),SD=t(e.add);function kD(t,e){return yh(t,_D,e)}function _D(t,e){const n=[],r=[...t];if(r.some((t=>l(t)&&t.isZero())))for(const t of r)FD(n,Yy(t,e));else for(const t of r)FD(n,e.valueOf(t));return function(t,e){const n=e.compareFn(SD);for(let r=0;r<10&&!(t.length<2);r++){const r=function(t,e){if(D(t)&&D(e))return Yt;const r=Sv(t),s=Sv(e);if(b(r)&&b(s)){if(r.ndim<s.ndim)return Zt;if(r.ndim>s.ndim)return te;const t=r.ndim;for(let e=0;e<t;e++){if(r.dim(e)<s.dim(e))return Zt;if(r.dim(e)>s.dim(e))return te}return Yt}if(ah(r)&&ah(s)){switch(Gy(Xy(r),Xy(s))){case Zt:return Zt;case te:return te;default:switch(n($y(r,M),$y(s,M))){case Zt:return Zt;case te:return te;case Yt:return Yt}}}return n(r,s)};t.sort(r),CD(t,e)}switch(t.length){case 0:return _;case 1:return t[0];default:return t.unshift(SD),At(...t)}}(n,e)}function FD(t,e){pi(e)?t.push(...e.tail()):D(e)&&e.isZero()||t.push(e)}function CD(n,r){let s=!1,i=0;for(;i<n.length-1;){let u=n[i],c=n[i+1];if(St(u)&&St(c)){const t=r.handlerFor(u),e=r.handlerFor(c),s=t.binL(u,SD,c,r);if(bt(s)){const t=e.binR(c,SD,u,r);if(bt(t)){const t=Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,SD,f(u.type),f(c.type));n.splice(i,2,t);continue}if(!pi(t)){n.splice(i,2,t);continue}}else if(!pi(s)){n.splice(i,2,s);continue}}if(b(u)&&b(c)){const t=yx(u,c,r);bt(t)||(n.splice(i,2,t),i--),i++;continue}if(b(u)||b(c)){i++;continue}if(D(u)&&D(c)){const t=Xl(u,c);t.isZero()?2===n.length?n.splice(i,2,t):(l(t)&&(s=!0),n.splice(i,2)):n.splice(i,2,t),i--,i++;continue}if(D(u)||D(c)){i++;continue}let h=S,p=S,d=0;if(di(u)&&(u=Ct(u),d=1,D(Ft(u))&&(h=Ft(u),u=Ct(u),bt(Ct(u))&&(u=Ft(u),d=0))),di(c)&&(c=Ct(c),D(Ft(c))&&(p=Ft(c),c=Ct(c),bt(Ct(c))&&(c=Ft(c)))),!u.equals(c)){i++;continue}if(h=Xl(h,p),a=r,function(t){return D(t)&&t.isZero()}(o=h)||function(n,r){if(b(n)){return r.handlerFor(n).test(n,t(e.zero),r)}return!1}(o,a)){n.splice(i,2),i--,i++;continue}const m=d?Tt(Ne,Mt(u)):u;n.splice(i,2,Zn(r,h,m)),i--,i++}var o,a;if(s)for(let t=0;t<n.length;t++)n[t]=co(n[t],r)}const TD=t(e.adj);function MD(t,e){return dD(t,OD,e)}function OD(t,e){if(St(t)){return e.handlerFor(t).dispatch(t,TD,kt,e)}throw new Error("adj argument MUST be an atom.")}var ND;let LD=class extends yE{constructor(){super("algebra_2_tensor_tensor",f("algebra"),b,b),ND.set(this,void 0),this.dependencies=["Blade"],Rt(this,ND,Yg(f("algebra"),Vg,Vg),"f")}get hash(){return Pt(this,ND,"f")}valueOf(t,e){const n=t.argList;try{const t=n.item(0),r=n.item(1);try{const n=e.valueOf(t),s=e.valueOf(r);try{const t=U(n);return tE(t,U(s),e)}finally{n.release(),s.release()}}finally{t.release(),r.release()}}finally{n.release()}}transform2(t,e,n,r,s){return[ne,tE(e,n,s)]}};ND=new WeakMap;const BD=new class{create(){return new LD}};var qD;qD=new WeakMap;const ID=de(class extends yE{constructor(t){super("assign_sym_any",xs,v,Ty),this.config=t,qD.set(this,void 0),Rt(this,qD,Yg(xs,Gg,Qg),"f")}get hash(){return Pt(this,qD,"f")}transform(t,e){const n=this.match(t,e);if(n){const[t,r]=e.transform(n.rhs);return re(t)?[ne,e.valueOf(At(n.opr,n.lhs,r))]:this.transform2(n.opr,n.lhs,n.rhs,n,e)}return[ee,t]}transform2(t,e,n,r,s){return s.setBinding(e,n),[ne,kt]}valueOf(t,e){const n=t.lhs,r=t.rhs;try{const t=e.valueOf(r);try{return e.setBinding(n,t),kt}finally{t.release()}}finally{n.release(),r.release()}}}),PD=t(e.isone),RD=t(e.iszero);const UD=de(class{constructor(){}test(t,e,n){if(e.equalsSym(PD)){const r=t.deref();try{if(St(r))return n.handlerFor(r).test(r,e,n)}finally{r.release()}}else if(e.equalsSym(RD)){const r=t.deref();try{if(St(r))return n.handlerFor(r).test(r,e,n)}finally{r.release()}}return!1}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,e,n,r){return Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return $g}get name(){return"CellExtension"}get dependencies(){return["Cell"]}isKind(t){return at(t)}subst(t,e,n){return t.equals(e)?n:t}toHumanString(t){throw new Vt}toInfixString(t){throw new Vt}toLatexString(t){throw new Vt}toListString(t){throw new Vt}evaluate(t,e,n){return n.transform(Tt(t,e))}transform(t){return[2,t]}valueOf(t){return t}});var $D;$D=new WeakMap;const zD=de(class extends Cy{constructor(n){super("atom",t(e.atom),Ty),this.config=n,$D.set(this,void 0),Rt(this,$D,sx(this.opr),"f")}get hash(){return Pt(this,$D,"f")}transform(t,e){const n=function(t,e){const n=t.arg;try{const t=e.valueOf(n);try{return new V(t,e.getCellHost())}finally{t.release()}}finally{n.release()}return kt}(t,e);return[!n.equals(t)?ne:2,n]}transform1(t,e,n){throw new Error("TODO")}});var WD;WD=new WeakMap;const XD=de(class extends Fy{constructor(t){super("besselj",lr),this.config=t,WD.set(this,void 0),Rt(this,WD,sx(this.opr),"f")}get hash(){return Pt(this,WD,"f")}transform(t,e){const n=function(t,e){return Tx(e.valueOf(Ai(t)),e.valueOf(_i(t)),e)}(t,e);return[!n.equals(t)?ne:2,n]}});var KD;KD=new WeakMap;const HD=de(class extends Fy{constructor(t){super("bessely",hr),this.config=t,KD.set(this,void 0),Rt(this,KD,sx(this.opr),"f")}get hash(){return Pt(this,KD,"f")}transform(t,e){const n=function(t,e){return Mx(e.valueOf(Ai(t)),e.valueOf(_i(t)),e)}(t,e);return[!n.equals(t)?ne:2,n]}});function JD(t,e){const n=function(t,e,n){return function(t,e,n){if(!function(t,e,n){return(!ui(t)||!Jn(t,vn))&&((!ui(e)||!Jn(e,vn))&&!(ui(t)&&ui(e)&&Jn(t,e)))}(t,e))return vn;return lo(lo(hw(t),hw(e),n),hw(n.subtract(t,e)),n)}(t,e,n)}(e.valueOf(Ai(t)),e.valueOf(_i(t)),e);return n}var GD;let VD=class extends Fy{constructor(){super("binomial",fr),GD.set(this,void 0),Rt(this,GD,sx(this.opr),"f")}get hash(){return Pt(this,GD,"f")}transform(t,e){const n=JD(t,e);return[!n.equals(t)?ne:2,n]}};GD=new WeakMap;const jD=new class{create(){return new VD}},QD=t(e.add);const ZD=de(class{constructor(){this.dependencies=["Boo"]}test(t,e,n){return!1}binL(t,e,n,r){return e.equalsSym(QD)&&St(n)?Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,QD,f(t.type),f(n.type)):kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Ug}get name(){return"BooExtension"}evaluate(t,e,n){throw new Vt}transform(t){return me(t,t)}valueOf(t){return t}isKind(t){return p(t)}subst(t,e,n,r){return t}toAsciiString(t){return t.equals($)?"true":"false"}toHumanString(t){return t.equals($)?"true":"false"}toInfixString(t){return t.equals($)?"true":"false"}toLatexString(t){return t.equals($)?"true":"false"}toListString(t){return t.equals($)?"true":"false"}});class YD extends Cy{constructor(){super("ceiling_cons",f("ceiling"),_t)}transform1(t,e,n){return[ee,n]}}const tb=new class{create(){return new YD}};const eb=de(class extends Cy{constructor(t){super("ceiling_flt",f("ceiling"),l),this.config=t}transform1(t,e){return[ne,X(Math.ceil(e.d))]}});const nb=de(class extends Cy{constructor(t){super("ceiling_rat",f("ceiling"),c),this.config=t}transform1(t,e){return[ne,e.ceiling()]}}),rb=t(e.testeq);function sb(t){if(_t(t)&&t.head.equals(xs)){const e=t.argList,n=e.head,r=e.cdr.head;return At(rb,n,r)}return t}function ib(t,e){const n=e.valueOf(sb(t));if(p(n))return!!n.isTrue()||!n.isFalse()&&null;if(e.iszero(n))return!1;if(vi(n))return!0;const r=Yy(n,e);if(e.iszero(r))return!1;if(vi(r))return!0;if(r.contains(A)){const t=e.valueOf(sb(ew(r,e)));if(e.iszero(t))return!1;if(vi(t))return!0}return null}function ob(t,e){const n=t.argList.head,r=ib(e.valueOf(sb(n)),e);if("boolean"==typeof r)return x(Number(r));if(r)throw new Error;return t}var ab;let ub=class extends Fy{constructor(){super("coeff",yr),ab.set(this,void 0),this.phases=fe,Rt(this,ab,sx(this.opr),"f")}get hash(){return Pt(this,ab,"f")}transform(t,e){const n=function(t,e){const n=e.valueOf(t.item1);let r=e.valueOf(t.item2),s=e.valueOf(t.item3);return kt.equals(s)&&(s=r,r=Vs),Mo(lo(n,e.power(r,s),e),r,e)}(t,e);return[!n.equals(t)?ne:2,n]}};ab=new WeakMap;const cb=new class{create(){return new ub}};function lb(t,e){const n=Bo(e.valueOf(t.item1),e.valueOf(t.item2),e);return P(n)}var hb;const fb=t(e.complex);hb=new WeakMap;const pb=de(class extends yE{constructor(t){super("complex_2_any_any",fb,Ty,Ty),this.config=t,hb.set(this,void 0),Rt(this,hb,Yg(fb,Qg,Qg),"f")}get hash(){return Pt(this,hb,"f")}transform2(t,e,n,r,s){return[ne,s.add(e,s.multiply(A,n))]}});var db;db=new WeakMap;const mb=de(class extends Fy{constructor(t){super("condense",Er),this.config=t,db.set(this,void 0),this.phases=ue,Rt(this,db,sx(this.opr),"f")}get hash(){return Pt(this,db,"f")}transform(t,e){const n=function(t,e){return ma(e.valueOf(Ai(t)),e)}(t,e);return[!n.equals(t)?ne:2,n]}}),gb=f("listform");function xb(t,e){const n=At(gb,t);try{return ut(e.valueOf(n)).str}finally{n.release()}}function yb(t,e){return"-"===Wa(t)?`-${Ka(t,e)}`:Ka(t,e)}const wb=de(class{constructor(){}binL(t,e,n,r){throw new Error(`${this.name}.binL(${t},${e}) method not implemented.`)}binR(t,e,n,r){throw new Error(`${this.name}.binR(${t},${e}) method not implemented.`)}dispatch(t,e,n,r){throw new Error("Method not implemented.")}test(t,e){throw new Error(`${this.name}.test(${t},${e}) method not implemented.`)}iscons(){return!1}operator(){throw new Error}get hash(){return"Cons"}get name(){return"ConsExtension"}compareFactors(t,e,n){throw new Error("Cons Method not implemented.")}isKind(t){return!!_t(t)}subst(t,e,n,r){throw new Error(`expr = ${t} oldExpr = ${e} newExpr = ${n}`)}toHumanString(t,e){return yb(t,e)}toInfixString(t,e){return yb(t,e)}toLatexString(t,e){return yb(t,e)}toListString(t,e){let n="";n+="(",n+=xb(t.car,e);let r=t.cdr;for(;_t(r);)n+=" ",n+=xb(r.car,e),r=r.cdr;return r!==kt&&(n+=" . ",n+=xb(r,e)),n+=")",n}evaluate(t,e,n){return this.transform(Tt(t,e),n)}transform(t,e){return[ee,t]}valueOf(t,e){const n=function(t,e){return t},r=t.car;if(v(r))return t;{const s=e.extensionFor(r);return bt(t.cdr)?n(s?s.valueOf(r,e):r):n(t)}}});function Eb(t,e){const n=e.valueOf(t.argList.head);let r,s;kt.equals(Si(t))?(r=Dn,s=bn):(r=e.valueOf(_i(t)),s=e.valueOf(Ti(t)));const i=function(t,e,n,r){const s=[],i=[];if(!b(t))return r.iszero(t)||Je("contract: tensor expected, 1st arg is not a tensor"),vn;let o=jt(e),a=jt(n);const{ndim:u}=t;(o<1||o>u||a<1||a>u||o===a||t.dim(o-1)!==t.dim(a-1))&&Je("contract: index out of range");o--,a--;const c=t.dim(o);let l=1;for(let e=0;e<u;e++)e!==o&&e!==a&&(l*=t.dim(e));const h=new Array(u-2),f=new Array(l);let p=0;for(let e=0;e<u;e++)e!==o&&e!==a&&(h[p++]=t.dim(e));const d=t.copyElements(),m=f;for(let e=0;e<u;e++)s[e]=0,i[e]=t.dim(e);for(let t=0;t<l;t++){let e=vn;for(let t=0;t<c;t++){s[o]=t,s[a]=t;let n=0;for(let t=0;t<u;t++)n=n*i[t]+s[t];e=r.add(e,d[n])}m[t]=e;for(let t=u-1;t>=0;t--)if(t!==o&&t!==a){if(++s[t]<i[t])break;s[t]=0}}if(1===l)return m[0];return new F(h,f)}(n,r,s,e);return i}var vb;vb=new WeakMap;const Db=de(class extends Fy{constructor(t){super("contract",vr),this.config=t,vb.set(this,void 0),this.dependencies=[],Rt(this,vb,sx(this.opr),"f")}get hash(){return Pt(this,vb,"f")}transform(t,e){const n=Eb(t,e);return[!n.equals(t)?ne:2,n]}}),bb=f("cross");const Ab=de(class extends yE{constructor(t){super("cross_any_any",bb,Ty,Ty),this.config=t}valueOf(t,e){const n=t.opr,r=t.lhs,s=t.rhs;try{const i=e.valueOf(r),o=e.valueOf(s);if(ah(i)){const t=Xy(i);if(!t.equals(i)){const r=$y(i,M),s=e.valueOf(At(n,t,o));return e.valueOf(At(Ne,r,s))}}if(ah(o)){const t=Xy(o);if(!t.equals(o)){const r=$y(o,M),s=e.valueOf(At(n,i,t));return e.valueOf(At(Ne,s,r))}}return t}finally{n.release(),r.release(),s.release()}}transform2(t,e,n,r,s){if(ah(e)){const r=Xy(e);if(!r.equals(e)){const i=$y(e,M),o=s.valueOf(At(t,r,n)),a=s.valueOf(At(Ne,i,o));return[ne,a]}}if(ah(n)){const r=Xy(n);if(!r.equals(n)){const i=$y(n,M),o=s.valueOf(At(t,e,r)),a=s.valueOf(At(Ne,o,i));return[ne,a]}}return[ee,r]}});var Sb;function kb(t,e,n){const r=n.valueOf(t.wedge(e));if(M(r))return n.valueOf(At(Ne,Nn,r.dual()));if(c(r))return r;if(_t(r)&&(Lo(s=r)&&M(s.lhs)&&c(s.rhs))){const t=r.lhs,e=r.rhs;return n.valueOf(At(Ne,Nn.mul(e),t.dual()))}var s;if(_t(r)&&function(t){return Lo(t)&&c(t.lhs)&&M(t.rhs)}(r)){const t=r.lhs,e=r.rhs;return n.valueOf(At(Ne,Nn.mul(t),e.dual()))}throw new Error(`${n.toSExprString(r)}`)}let _b=class extends yE{constructor(){super("cross_blade_blade",bb,M,M),Sb.set(this,void 0),this.dependencies=["Blade"],Rt(this,Sb,Yg(bb,Rg,Rg),"f")}get hash(){return Pt(this,Sb,"f")}valueOf(t,e){return function(t,e){const n=t.lhs,r=t.rhs;try{return kb(n,r,e)}finally{n.release(),r.release()}}(t,e)}transform2(t,e,n,r,s){const i=kb(e,n,s);return i.equals(r)?[ee,i]:[ne,i]}};Sb=new WeakMap;const Fb=new class{create(){return new _b}};function Cb(t){const e=t.argList;try{switch(e.length){case 1:return[I(e.item(0)),kt,kt];case 2:return[I(e.item(0)),kt,e.item(1)];case 3:return[I(e.item(0)),e.item(1),e.item(2)];default:throw new Error("Unexpected number of arguments for def Special Form.")}}finally{e.release()}}function Tb(t,e){const n=t.argList,[r,s,i]=Cb(t);try{return function(t,e){return e.setBinding(t,kt),kt}(r,e)}finally{n.release(),r.release(),s.release(),i.release()}}const Mb=de(class extends Cy{constructor(n){super("def [symbol]",t(e.def),v),this.config=n}valueOf(t,e){return Tb(t,e)}transform(t,e){const n=Tb(t,e);return[ne,n]}transform1(t,e,n){throw new Vt}});class Ob extends Fy{constructor(t,e,n,r,s){super(t,e),this.guardA=n,this.guardB=r,this.guardC=s}isKind(t,e){return!!this.match(t,e)}match(t,e){try{if(!_t(t)||4!==t.length)return;{const n=t.opr,r=t.item(1),s=t.item(2),i=t.item(3);try{return v(n)&&this.opr.equalsSym(n)&&this.guardA(r,e)&&this.guardB(s,e)&&this.guardC(i,e)?t:void 0}finally{n.release(),r.release(),s.release(),i.release()}}}catch(t){throw new Error(`${this.name} + ${t}`)}}transform(t,e){const n=this.match(t,e);if(n){const t=n.item(1),r=n.item(2),s=n.item(3);try{const[i,o]=e.transform(t),[a,u]=e.transform(r),[c,l]=e.transform(s);try{if(!(re(i)||re(a)||re(c)))return this.transform3(n.opr,t,r,s,n,e);{const t=At(n.opr,o,u,l);try{return[ne,e.valueOf(t)]}finally{t.release()}}}finally{o.release(),u.release(),l.release()}}finally{t.release(),r.release(),s.release()}}return[ee,t]}}const Nb=f("def");function Lb(t,e){const n=t.argList,[r,s,i]=Cb(t);try{const t=e.valueOf(i);try{return function(t,e,n,r){return v(t)?(r.setBinding(t,n),kt):Ut(new B("First argument to def must be a symbol."))}(r,ut(s),t,e)}finally{t.release()}}finally{n.release(),r.release(),s.release(),i.release()}}const Bb=de(class extends Ob{constructor(){super("def [symbol doc-string init]",Nb,v,h,Ty)}valueOf(t,e){return Lb(t,e)}transform(t,e){const n=Lb(t,e);return[ne,n]}transform3(t,e,n,r,s){throw new Error}});function qb(t,e){const n=t.argList,[r,s,i]=Cb(t);try{const t=e.valueOf(i);try{return function(t,e,n){return v(t)?(n.setBinding(t,e),kt):Ut(new B("First argument to def must be a symbol."))}(r,t,e)}finally{t.release()}}finally{n.release(),r.release(),s.release(),i.release()}}const Ib=de(class extends yE{constructor(n){super("def [symbol init]",t(e.def),v,Ty),this.config=n}valueOf(t,e){return qb(t,e)}transform(t,e){const n=qb(t,e);return[ne,n]}transform2(t,e,n,r){throw new Error}});function Pb(t,e){let n=e.valueOf(Ai(t)),r=Si(t);for(;_t(r);){const t=e.valueOf(Ft(r));r=Ct(r);const s=e.valueOf(Ft(r));r=Ct(r);const i=e.valueOf(Ft(r));r=Ct(r),n=Kw(n,t,e);const o=e.valueOf(yo(n,t,i,e)),a=e.valueOf(yo(n,t,s,e));n=e.subtract(o,a)}return n}var Rb;function Ub(n,r){try{const[s,i,o,a,u,c]=function(t){const e=t.argList;try{const t=I(e.item(0)),n=e.item(1),r=e.item(2),s=e.length;switch(s){case 3:return[t,kt,kt,U(n),kt,r];case 4:{const s=e.item(3);if(h(n))return[t,n,kt,U(r),kt,s];if(et(n))return[t,kt,ct(n),U(r),kt,s];throw Ut(new B("Unexpected item 1 for defn"))}case 5:{const s=e.item(3),i=e.item(4);if(h(n))return b(r)?[t,n,kt,U(r),s,i]:[t,n,r,U(s),kt,i];if(et(n))return[t,kt,n,U(r),s,i];throw Ut(new B(`Unexpected item 1 ${n} for defn`))}case 6:{const s=e.item(3),i=e.item(4),o=e.item(5);if(h(n))return[t,n,r,U(s),i,o];throw Ut(new B(`Unexpected item 1 ${n} for defn`))}default:throw Ut(new B(`Unexpected number of arguments (${s}) for defn`))}}finally{e.release()}}(n);try{const n=t(e.def),i=t(e.fn);try{return r.valueOf(At(n,s,At(i,a,c)))}finally{n.release(),i.release()}}finally{s.release(),i.release(),o.release(),a.release(),u.release(),c.release()}}catch(t){if(T(t))return t;throw t}}Rb=new WeakMap;const $b=de(class extends Fy{constructor(n){super("defn",t(e.defn)),this.config=n,Rb.set(this,void 0),Rt(this,Rb,sx(this.opr),"f")}get hash(){return Pt(this,Rb,"f")}transform(t,e){const n=Ub(t,e);return[!n.equals(t)?ne:2,n]}});function zb(t,e){return va(e.valueOf(Ai(t)),e)}var Wb;Wb=new WeakMap;const Xb=de(class extends Cy{constructor(n){super("deref",t(e.deref),Ty),this.config=n,Wb.set(this,void 0),Rt(this,Wb,sx(this.opr),"f")}get hash(){return Pt(this,Wb,"f")}transform(t,e){const n=function(t,e){const n=t.arg;try{const t=e.valueOf(n);try{return lt(t).deref()}finally{t.release()}}finally{n.release()}}(t,e);return[!n.equals(t)?ne:2,n]}transform1(t,e,n){throw new Error("TODO")}});const Kb=de(class extends Fy{constructor(t){super("d-to-derivative",f("d")),this.config=t}transform(n,r){if(_t(n)&&function(t,e){const n=e.opr;return!!v(n)&&t.equalsSym(n)}(this.opr,n)){const s=At(t(e.derivative),...n.tail());return[ne,r.valueOf(s)]}return[ee,n]}}),Hb=t(e.det);function Jb(t,e){return dD(t,Gb,e)}function Gb(t,e){return b(t)?Zl(t,e):Xt(Kt.Property_0_does_not_exist_on_type_1,Hb,f(function(t){return St(t)?t.type:_t(t)?"cons":"nil"}(t)))}var Vb,jb;function Qb(t){if(et(t))return t;throw new Error}Vb=new WeakMap,jb=new WeakMap;const Zb=de(class{constructor(){Vb.set(this,Qb(new R([]))),jb.set(this,qg(Qb(Pt(this,Vb,"f")))),this.dependencies=["Map"]}test(t,e,n){return!1}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Pt(this,jb,"f")}get name(){return"DictionaryExtension"}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[et(t)?2:ee,t]}valueOf(t,e){throw new Error("DictionaryExtension.valueOf() method not implemented.")}isKind(t){return et(t)}subst(t,e,n){return this.isKind(e)&&t.equals(e)?n:t}toAsciiString(t,e){throw new Error("DictionaryExtension.toAsciiString() method not implemented.")}toHumanString(t,e){throw new Error("DictionaryExtension.toInfixString() method not implemented.")}toInfixString(t,e){throw new Error("DictionaryExtension.toInfixString() method not implemented.")}toLatexString(t,e){return function(t,e){let n="";return n+="\\begin{lstlisting}[language=python]",n+=" \\end{lstlisting}",n}()}toListString(t,e){e.pushDirective(ie.printMode,Ke.SExpr);try{return function(t,e){let n="";n+="{";try{const r=t.entries,s=r.length,i=[];for(let t=0;t<s;t++){const n=r[t][0],s=r[t][1],o=xb(n,e),a=xb(s,e);i.push(`${o} ${a}`)}n+=i.join(" ")}finally{n+="}"}return n}(t,e)}finally{e.popDirective()}}});function Yb(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return function(t,e){if(St(t)&&v(t))return new tt(`d${t.key()}`,t.pos,t.end);throw new Vt("TODO: differential")}(n)}finally{n.release()}}finally{t.release()}}finally{n.release()}}var tA;tA=new WeakMap;const eA=de(class extends Fy{constructor(t){super("dim",kr),this.config=t,tA.set(this,void 0),Rt(this,tA,sx(this.opr),"f")}get hash(){return Pt(this,tA,"f")}transform(t,e){const n=function(t,e){const n=e.valueOf(Ai(t)),r=_t(Si(t))?hx(_i(t),e):1;return b(n)?r<1||r>n.ndim?t:x(n.dim(r-1)):S}(t,e);return[!n.equals(t)?ne:2,n]}});var nA;nA=new WeakMap;const rA=de(class extends Fy{constructor(t){super("dirac",_r),this.config=t,nA.set(this,void 0),Rt(this,nA,sx(this.opr),"f")}get hash(){return Pt(this,nA,"f")}transform(t,e){const n=function(t,e){return Cx(e.valueOf(Ai(t)),e)}(t,e);return[!n.equals(t)?ne:2,n]}});var sA,iA,oA;class aA extends yE{constructor(t,e){super(`'${t.key()}' left-distributive over '${e.key()}'`,t,Ty,function(t){return function(e){return _t(e)&&li(e,t)}}(e)),sA.set(this,void 0),this.phases=ue,Rt(this,sA,tx(t,Qg,e),"f")}get hash(){return Pt(this,sA,"f")}transform2(t,e,n,r,s){const i=n.opr;try{const o=n.rest;try{const n=o.map((function(n){const r=At(t,e,n);try{return s.valueOf(r)}finally{r.release()}}));try{const t=Tt(i,n);try{const e=s.valueOf(t);try{return me(e,r)}finally{e.release()}}finally{t.release()}}finally{n.release()}}finally{o.release()}}finally{i.release()}}}sA=new WeakMap;class uA extends yE{constructor(t,e){super(`'${t.key()}' right-distributive over '${e.key()}'`,t,function(t){return function(e){return _t(e)&&li(e,t)}}(e),Ty),iA.set(this,void 0),this.phases=ue,Rt(this,iA,ex(t,e,Qg),"f")}get hash(){return Pt(this,iA,"f")}transform2(t,e,n,r,s){const i=e.opr;try{const o=e.rest;try{const e=o.map((e=>{const r=At(t,e,n);try{return s.valueOf(r)}finally{r.release()}}));try{const t=Tt(i,e);try{const e=s.valueOf(t);try{return me(e,r)}finally{e.release()}}finally{t.release()}}finally{e.release()}}finally{o.release()}}finally{i.release()}}}iA=new WeakMap;class cA{constructor(t,e){this.upper=t,this.lower=e}create(){return new aA(this.upper,this.lower)}}class lA{constructor(t,e){this.upper=t,this.lower=e}create(){return new uA(this.upper,this.lower)}}function hA(t,e){return new cA(t,e)}function fA(t,e){return new lA(t,e)}function pA(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return Io(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}oA=new WeakMap;const dA=de(class extends Fy{constructor(t){super("do",Fr),this.config=t,oA.set(this,void 0),Rt(this,oA,sx(this.opr),"f")}get hash(){return Pt(this,oA,"f")}transform(t,e){const n=function(t,e){let n=Ft(t),r=Ct(t);for(;_t(r);)n=e.valueOf(Ft(r)),r=Ct(r);return n}(t,e);return[!n.equals(t)?ne:2,n]}});var mA,gA;const xA=t(e.add),yA=t(e.assign),wA=t(e.derivative),EA=t(e.factorial),vA=t(e.component),DA=t(e.multiply),bA=t(e.pow),AA=t(e.testeq),SA=t(e.testge),kA=t(e.testgt),_A=t(e.testle),FA=t(e.testlt),CA=t(e.E),TA=12,MA=10,OA=.09,NA=.07,LA=40,BA=41,qA=60,IA=61,PA=62,RA=102,UA=110,$A=177,zA=178,WA=179,XA=180,KA=181,HA=1,JA=2,GA=3,VA=4,jA=5,QA=6,ZA=7,YA=8,tS=9,eS=10,nS=24,rS=18,sS=1356,iS=443,oS=916,aS=1,uS=2,cS=3,lS=4;function hS(t,e){e.push(kt);for(let n=0;n<t;n++)fS(e)}function fS(t){const e=Mt(t.pop()),n=t.pop();t.push(Tt(n,e))}function pS(t){switch(t){case aS:case uS:return sS*nS/2048;case cS:case lS:return sS*rS/2048;default:throw new Error}}function dS(t){switch(t){case aS:case uS:return iS*nS/2048;case cS:case lS:return iS*rS/2048;default:throw new Error}}const mS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],gS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function xS(t,e){switch(t){case aS:case cS:return dS(t)*mS[e];case uS:case lS:return dS(t)*gS[e];default:throw new Error}}const yS=[909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,512,682,836,1024,1024,1706,1593,369,682,682,1024,1155,512,682,512,569,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,569,569,1155,1155,1155,909,1886,1479,1366,1366,1479,1251,1139,1479,1479,682,797,1479,1251,1821,1479,1479,1139,1479,1366,1139,1251,1479,1479,1933,1479,1479,1251,682,569,682,961,1024,682,909,1024,909,1024,909,682,1024,1024,569,569,1024,569,1593,1024,1024,1024,1024,682,797,569,1024,1024,1479,1024,1024,909,983,410,983,1108,1593,1479,1366,1184,1253,1251,1251,1479,1479,682,1479,1485,1821,1479,1317,1479,1479,1139,1192,1251,1479,1497,1479,1511,1522,1073,1042,905,965,860,848,1071,981,551,1032,993,1098,926,913,1024,1034,1022,1104,823,1014,1182,909,1282,1348,1024,1155,1155,1155,1124,1124,1012,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909,909],wS=[1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,512,682,860,1024,1024,1706,1593,438,682,682,1024,1382,512,682,512,569,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,682,682,1382,1382,1382,1024,1884,1251,1251,1366,1479,1251,1251,1479,1479,682,909,1366,1139,1706,1366,1479,1251,1479,1251,1024,1139,1479,1251,1706,1251,1139,1139,797,569,797,864,1024,682,1024,1024,909,1024,909,569,1024,1024,569,569,909,569,1479,1024,1024,1024,1024,797,797,569,1024,909,1366,909,909,797,819,563,819,1108,1593,1251,1251,1165,1253,1251,1139,1479,1479,682,1366,1237,1706,1366,1309,1479,1479,1251,1217,1139,1139,1559,1251,1440,1481,1075,1020,807,952,807,829,1016,1006,569,983,887,1028,909,877,1024,1026,983,1010,733,940,1133,901,1272,1446,1024,1382,1382,1382,1124,1124,1012,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024];function ES(t,e){switch(t){case aS:return nS*yS[e]/2048;case uS:return nS*wS[e]/2048;case cS:return rS*yS[e]/2048;case lS:return rS*wS[e]/2048;default:throw new Error}}function vS(t){return pS(t)/2}let DS;function bS(){DS=1}class AS{constructor(){mA.set(this,new du),gA.set(this,1)}addRef(){var t;Rt(this,gA,(t=Pt(this,gA,"f"),++t),"f")}release(){var t;Rt(this,gA,(t=Pt(this,gA,"f"),--t),"f"),0===Pt(this,gA,"f")&&Pt(this,mA,"f").release()}get isatom(){return Pt(this,mA,"f").isatom}get iscons(){return Pt(this,mA,"f").iscons}get istrue(){return Pt(this,mA,"f").istrue}dupl(){Pt(this,mA,"f").dupl()}head(){Pt(this,mA,"f").head()}rest(){Pt(this,mA,"f").rest()}rotateL(t){Pt(this,mA,"f").rotateL(t)}rotateR(t){Pt(this,mA,"f").rotateR(t)}swap(){Pt(this,mA,"f").swap()}get frameLength(){throw new Error("Method not implemented.")}frameSplice(t,e){throw new Error("Method not implemented.")}framePush(t){throw new Error("Method not implemented.")}get length(){return Pt(this,mA,"f").length}set length(t){Pt(this,mA,"f").length=t}concat(t){throw new Error("concat method not implemented.")}peek(){const t=this.pop();return this.push(t),t}push(t){Pt(this,mA,"f").push(t)}pop(){return Pt(this,mA,"f").pop()}getAt(t){return Pt(this,mA,"f").getAt(t)}setAt(t,e){Pt(this,mA,"f").setAt(t,e)}splice(t,e){return"number"==typeof e?Pt(this,mA,"f").splice(t,e):Pt(this,mA,"f").splice(t)}fpop(){throw new Error("fpop method not implemented.")}}function SS(t,e,n){const r=new AS;try{DS=0,kS(t,e,r,n);const s=r.pop(),i=nk(s),o=rk(s),a=sk(s),u=10,c=Math.round(i+10),l=Math.round(i+o+20),h=Math.round(a+20),f="height='"+l+"'",p="width='"+h+"'",d=[];return d.push("<svg "+f+p+">"),ak(u,c,s,d),d.push("</svg>"),d.join("")}finally{r.release()}}function kS(t,e,n,r){const s=n.length;_S(t,e,n,r),QS(s,n)}function _S(t,e,n,r){(Hh(t)||Ft(t).equals(xA)&&Hh(Ai(t)))&&(RS(zA,n),VS(n)),Ft(t).equals(xA)?function(t,e,n,r){t=Ct(t),JS(Ft(t),e,n,r),t=Ct(t);for(;_t(t);)Hh(Ft(t))?NS(zA,n):NS($A,n),JS(Ft(t),e,n,r),t=Ct(t)}(t,e,n,r):JS(t,e,n,r)}function FS(t,e,n,r){if(t=Ct(t),!_t(t))return US("(",n),void US(")",n);const s=n.length;for(_S(Ft(t),e,n,r),t=Ct(t);_t(t);)US(",",n),VS(n),_S(Ft(t),e,n,r),t=Ct(t);QS(s,n),ZS(n)}function CS(t,e,n,r){D(t)&&Kh(t)||c(t)&&Wh(t)||l(t)||Ft(t).equals(xA)||Ft(t).equals(DA)||Ft(t).equals(bA)?$S(t,e,n,r):_S(t,e,n,r)}function TS(t,e){let n,r;const s=Bv(t.d);let i=0;for(;i<s.length&&"."!==s.charAt(i)&&"E"!==s.charAt(i)&&"e"!==s.charAt(i);)i++;if(US(s.substring(0,i),e),"."===s.charAt(i)){for(n=i++;i<s.length&&"E"!==s.charAt(i)&&"e"!==s.charAt(i);)i++;for(r=i;"0"===s.charAt(r-1);)r--;r-n>1&&US(s.substring(n,r),e)}if("E"!==s.charAt(i)&&"e"!==s.charAt(i))return;i++,RS(WA,e),US("10",e),DS++;const o=e.length;for("+"===s.charAt(i)?i++:"-"===s.charAt(i)&&(RS(zA,e),VS(e),i++);"0"===s.charAt(i);)i++;US(s.substring(i),e),QS(o,e),DS--,YS(e)}function MS(n,r,s,i){if(c(n))!function(t,e){if(t.isInteger()){return void US(Ph(t.a),e)}DS++;let n=e.length,r=Ph(t.a);US(r,e),QS(n,e),n=e.length,r=Ph(t.b),US(r,e),QS(n,e),DS--,jS(e)}(n,s);else if(l(n))TS(n,s);else if(v(n))zS(n,s);else if(h(n))!function(t,e){US(Rx.toHumanString(t),e)}(n,s);else if(b(n))!function(t,e,n,r){t.ndim%2==1?function(t,e,n,r){let s=1,i=t.ndim;for(let e=1;e<i;e++)s*=t.dims[e];i=t.dims[0];for(let o=0;o<i;o++)qS(t,1,o*s,e,n,r);tk(i,1,n)}(t,e,n,r):qS(t,0,0,e,n,r)}(n,r,s,i);else if(k(n))!function(t,e){const n=t.toInfixString();zS(f(n),e)}(n,s);else if(p(n))!function(t,e){t.isTrue()?US("true",e):t.isFalse()?US("false",e):US("fuzzy",e)}(n,s);else if(M(n))!function(t,e){US(t.toInfixString(),e)}(n,s);else if(L(n))!function(t,e,n){n.useImaginaryI?BS("i",e):n.useImaginaryJ?BS("j",e):BS("i",e)}(0,s,i);else if(_t(n))Ft(n).equals(bA)?function(t,e,n,r){if(Ai(t).equals(CA))return US("exp",n),void FS(Ct(t),e,n,r);if(L(t)){if(r.useImaginaryJ)return void BS("j",n);if(r.useImaginaryI)return void BS("i",n)}const s=_i(t);if(D(s)&&Kh(s))return void function(t,e,n,r){US("1",n);const s=n.length;Mh(_i(t))?_S(Ai(t),e,n,r):(CS(Ai(t),e,n,r),PS(_i(t),n));QS(s,n),jS(n)}(t,e,n,r);CS(Ai(t),e,n,r),function(t,e,n,r){!D(t)||Kh(t)?(DS++,kS(t,e,n,r),DS--,YS(n)):PS(t,n)}(_i(t),e,n,r)}(n,r,s,i):Ft(n).equals(xA)||Ft(n).equals(DA)?$S(n,r,s,i):function(t,e,n,r){if(Ft(t).equals(wA))return US("d",n),void FS(t,e,n,r);if(Ft(t).equals(EA)){const s=Ai(t);return c(s)&&Gh(s)||v(s)?_S(s,e,n,r):$S(s,e,n,r),void US("!",n)}if(Ft(t).equals(vA)){const s=Ct(t),i=Ft(s);return v(i)?zS(i,n):$S(i,e,n,r),void function(t,e,n,r){if(US("[",n),t=Ct(t),_t(t))for(_S(Ft(t),e,n,r),t=Ct(t);_t(t);)US(",",n),VS(n),_S(Ft(t),e,n,r),t=Ct(t);US("]",n)}(s,e,n,r)}if(_t(t)&&(t.opr.equals(yA)||t.opr.equals(AA)))return _S(Ai(t),e,n,r),NS(IA,n),void _S(_i(t),e,n,r);if(Ft(t).equals(SA))return _S(Ai(t),e,n,r),NS(XA,n),void _S(_i(t),e,n,r);if(Ft(t).equals(kA))return _S(Ai(t),e,n,r),NS(PA,n),void _S(_i(t),e,n,r);if(Ft(t).equals(_A))return _S(Ai(t),e,n,r),NS(KA,n),void _S(_i(t),e,n,r);if(Ft(t).equals(FA))return _S(Ai(t),e,n,r),NS(qA,n),void _S(_i(t),e,n,r);const s=Ft(t);v(s)?zS(s,n):$S(s,e,n,r);FS(t,e,n,r)}(n,r,s,i);else{if(bt(n))throw new Error;St(n)&&function(n,r,s){const i=r.handlerFor(n),o=i.dispatch(n,t(e.infix),kt,r);try{US(Qt(o),s)}finally{o.release()}}(n,r,s)}}function OS(t,e,n,r){!function(t,e,n,r){const s=n.length,i=function(t){let e=0;t=Ct(t);for(;_t(t);)qv(Ft(t))&&e++,t=Ct(t);return e}(t);t=Ct(t);for(;_t(t);){const o=Ft(t);if(t=Ct(t),qv(o))if(n.length>s&&IS(n),c(o)){US(Ph(o.a),n)}else Ft(o).equals(xA)&&1===i?_S(o,e,n,r):MS(o,e,n,r)}n.length===s&&US("1",n);QS(s,n)}(t,e,n,r),function(t,e,n,r){const s=n.length,i=Nv(t);for(t=Ct(t);_t(t);){let o=Ft(t);t=Ct(t),Ov(o)&&(n.length>s&&IS(n),c(o)?US(Ph(o.b),n):Mh(_i(o))?(o=Ai(o),Ft(o).equals(xA)&&1===i?_S(o,e,n,r):MS(o,e,n,r)):(CS(Ai(o),e,n,r),PS(_i(o),n)))}QS(s,n)}(t,e,n,r),jS(n)}function NS(t,e){GS(e),RS(t,e),GS(e)}function LS(t,e){let n;n=0===DS?uS:lS;const r=pS(n),s=xS(n,t),i=ES(n,t);e.push(X(JA)),e.push(X(r)),e.push(X(s)),e.push(X(i)),e.push(X(n)),e.push(X(t)),hS(6,e),t===RA&&VS(e)}function BS(t,e){for(let n=0;n<t.length;n++)LS(t.charCodeAt(n),e)}function qS(t,e,n,r,s,i){if(e===t.ndim)return void kS(t.elems[n],r,s,i);let o=1,a=t.ndim;for(let n=e+2;n<a;n++)o*=t.dims[n];a=t.dims[e];const u=t.dims[e+1];for(let c=0;c<a;c++)for(let a=0;a<u;a++)qS(t,e+2,n+(c*u+a)*o,r,s,i);tk(a,u,s)}function IS(t){let e;e=0===DS?.5*ES(aS,UA):.5*ES(cS,UA),t.push(X(HA)),t.push(X(0)),t.push(X(0)),t.push(X(e)),hS(4,t)}function PS(t,e){DS++;const n=e.length;if(c(t)){let n=Ph(t.a);US(n,e),Wh(t)&&(US("/",e),n=Ph(t.b),US(n,e))}else TS(t,e);QS(n,e),DS--,YS(e)}function RS(t,e){let n;n=0===DS?aS:cS;const r=pS(n),s=xS(n,t),i=ES(n,t);e.push(X(JA)),e.push(X(r)),e.push(X(s)),e.push(X(i)),e.push(X(n)),e.push(X(t)),hS(6,e)}function US(t,e){for(let n=0;n<t.length;n++)RS(t.charCodeAt(n),e)}function $S(t,e,n,r){kS(t,e,n,r),ZS(n)}function zS(t,r){if(n(t,e.PI))WS("pi",r);else{if("Ω"!==t.key())return function(t,e){if(t.equalsSym(CA))return void US("exp(1)",e);const n=Iv(t);US(n,e)}(t,r);WS("Omega",r)}}function WS(t,e){let n=HS(t,0,e);if(n===t.length)return;DS++;const r=e.length;for(;n<t.length;)n=HS(t,n,e);QS(r,e),DS--,function(t){const e=t.pop();let n;n=0===DS?aS:cS;const r=ES(n,UA)/6,s=pS(n);let i=rk(e);const o=r+sk(e),a=r,u=s/2;i+=u,t.push(X(jA)),t.push(X(s)),t.push(X(i)),t.push(X(o)),t.push(X(a)),t.push(X(u)),t.push(e),hS(7,t)}(e)}mA=new WeakMap,gA=new WeakMap;const XS=["Alpha","Beta","Gamma","Delta","Epsilon","Zeta","Eta","Theta","Iota","Kappa","Lambda","Mu","Nu","Xi","Omicron","Pi","Rho","Sigma","Tau","Upsilon","Phi","Chi","Psi","Omega","alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega","hbar"],KS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0];function HS(t,e,n){let r,s="";const i=XS.length;for(r=0;r<i&&(s=XS[r],!t.startsWith(s,e));r++);if(r===i)return!function(t){const e=t.charCodeAt(0);return e>=48&&e<=57}(t.charAt(e))?LS(t.charCodeAt(e),n):RS(t.charCodeAt(e),n),e+1;const o=r+128;return KS[r]?LS(o,n):RS(o,n),e+s.length}function JS(t,e,n,r){_t(t)&&t.opr.equals(DA)?function(t,e,n,r){if(Lv(t))return void OS(t,e,n,r);t=Ct(t),Mh(Ft(t))&&!l(Ft(t))&&(t=Ct(t));MS(Ft(t),e,n,r),t=Ct(t);for(;_t(t);)IS(n),MS(Ft(t),e,n,r),t=Ct(t)}(t,e,n,r):MS(t,e,n,r)}function GS(t){let e;e=ES(0===DS?aS:cS,UA),t.push(X(HA)),t.push(X(0)),t.push(X(0)),t.push(X(e)),hS(4,t)}function VS(t){let e;e=0===DS?.25*ES(aS,UA):.25*ES(cS,UA),t.push(X(HA)),t.push(X(0)),t.push(X(0)),t.push(X(e)),hS(4,t)}function jS(t){const e=t.pop(),n=t.pop();let r,s,i=nk(n)+rk(n),o=nk(e)+rk(e),a=Math.max(sk(n),sk(e));0===DS?(r=YA,s=aS):(r=tS,s=cS);const u=vS(s),c=.75*u;i+=c+u,o+=c-u,a+=ES(s,UA)/2,t.push(X(r)),t.push(X(i)),t.push(X(o)),t.push(X(a)),t.push(n),t.push(e),hS(6,t)}function QS(t,e){if(e.length-t==1)return;let n,r=0,s=0,i=0;for(let o=t;o<e.length;o++)n=e.getAt(o),r=Math.max(r,nk(n)),s=Math.max(s,rk(n)),i+=sk(n);hS(e.length-t,e),n=e.pop(),e.push(X(GA)),e.push(X(r)),e.push(X(s)),e.push(X(i)),e.push(n),hS(5,e)}function ZS(t){const e=t.pop();let n,r,s=nk(e),i=rk(e),o=sk(e);if(0===DS?(n=QA,r=aS):(n=ZA,r=cS),s=Math.max(s,pS(r)),i=Math.max(i,dS(r)),s>pS(r)||i>dS(r)){const t=vS(r);s=Math.max(s,i+2*t)+.5*t,i=s-2*t}o+=2*ES(r,LA),t.push(X(n)),t.push(X(s)),t.push(X(i)),t.push(X(o)),t.push(e),hS(5,t)}function YS(t){const e=t.pop(),n=t.pop();let r;r=0===DS?aS:cS;const s=ES(r,UA)/6;let i=nk(e),o=rk(e),a=s+sk(e),u=nk(n);u-=(i+o)/2,u=Math.max(u,function(t){switch(t){case aS:case uS:return oS*nS/2048;case cS:case lS:return oS*rS/2048;default:throw new Error}}(r));let c=s;const l=-(u+o);i=u+i+o,o=0,ek(n)===jA&&(c=-sk(n)+s,a=Math.max(0,a-sk(n))),t.push(n),t.push(X(VA)),t.push(X(i)),t.push(X(o)),t.push(X(a)),t.push(X(c)),t.push(X(l)),t.push(e),hS(7,t)}function tk(t,e,n){let r=0,s=0;const i=n.length-t*e;for(let s=0;s<t;s++){let t=0;for(let r=0;r<e;r++){const o=n.getAt(i+s*e+r);t=Math.max(t,nk(o))}n.push(X(t)),r+=t}hS(t,n);const o=n.pop();for(let s=0;s<t;s++){let t=0;for(let r=0;r<e;r++){const o=n.getAt(i+s*e+r);t=Math.max(t,rk(o))}n.push(X(t)),r+=t}hS(t,n);const a=n.pop();for(let r=0;r<e;r++){let o=0;for(let s=0;s<t;s++){const t=n.getAt(i+s*e+r);o=Math.max(o,sk(t))}n.push(X(o)),s+=o}hS(e,n);const u=n.pop();r+=2*t*MA,s+=2*e*TA;const c=r/2+vS(aS),l=r-c,h=s+2*ES(aS,LA);hS(t*e,n);const f=n.pop();n.push(X(eS)),n.push(X(c)),n.push(X(l)),n.push(X(h)),n.push(X(t)),n.push(X(e)),n.push(f),n.push(o),n.push(a),n.push(u),hS(10,n)}function ek(t){return Ft(t).d}function nk(t){return Ai(t).d}function rk(t){return _i(t).d}function sk(t){return Ti(t).d}function ik(t){return Ft(t).d}function ok(t){return Ai(t).d}function ak(t,e,n,r){if(isNaN(t))throw new Error("x is NaN");if(isNaN(e))throw new Error("y is NaN");const s=ek(n),i=nk(n),o=rk(n),a=sk(n),u=Ct(Ct(Ct(Ct(n))));let c,l;switch(s){case HA:break;case JA:c=ik(u),l=ok(u),lk(t,e,c,l,r);break;case GA:{let n=Ft(u);for(;_t(n);)ak(t,e,Ft(n),r),t+=sk(Ft(n)),n=Ct(n);break}case VA:case jA:ak(t+ik(u),e+ok(u),_i(u),r);break;case QA:hk(t,e,i,o,a,nS*OA,aS,r);ak(t+ES(aS,LA),e,Ft(u),r);break;case ZA:hk(t,e,i,o,a,rS*OA,cS,r);ak(t+ES(cS,LA),e,Ft(u),r);break;case YA:pk(t,e,i,o,a,nS*NA,aS,u,r);break;case tS:pk(t,e,i,o,a,rS*NA,cS,u,r);break;case eS:hk(t,e,i,o,a,1.2*nS*OA,aS,r);!function(t,e,n,r){const s=ik(n),i=ok(n);n=Si(n);let o=Ft(n),a=Ai(n),u=_i(n);for(let c=0;c<s;c++){const s=ik(a),c=ik(u);e+=MA+s;let l=0,h=Ti(n);for(let n=0;n<i;n++){const n=ik(h),s=sk(Ft(o));ak(t+l+TA+(n-s)/2,e,Ft(o),r),l+=n+2*TA,o=Ct(o),h=Ct(h)}e+=c+MA,a=Ct(a),u=Ct(u)}}(t+ES(aS,LA),e-i,u,r);break}}const uk=["Α","Β","Γ","Δ","Ε","Ζ","Η","Θ","Ι","Κ","Λ","Μ","Ν","Ξ","Ο","Π","Ρ","Σ","Τ","Υ","Φ","Χ","Ψ","Ω","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","σ","τ","υ","φ","χ","ψ","ω","ℏ","+","−","×","≥","≤"],ck=183;function lk(t,e,n,r,s){let i,o;switch(i=r===ck?"·":r<32||r>181?"?":34===r?""":38===r?"&":60===r?"<":62===r?">":r<128?String.fromCharCode(r):uk[r-128],o='<text style=\'font-family:"Times New Roman";',n){case aS:o+="font-size:"+nS+"px;";break;case uS:o+="font-size:"+nS+"px;font-style:italic;";break;case cS:o+="font-size:"+rS+"px;";break;case lS:o+="font-size:"+rS+"px;font-style:italic;"}o+=`' ${"x='"+t+"'"} ${"y='"+e+"'"}>${i}</text>`,s.push(o)}function hk(t,e,n,r,s,i,o,a){const u=pS(o),c=xS(o,LA),l=ES(o,LA);n>u||r>c?(function(t,e,n,r,s,i,o){const a=Math.round(t+.5*s),u=a+Math.round(.5*s),c=Math.round(e-n),l=Math.round(e+r);fk(a,c,a,l,i,o),fk(a,c,u,c,i,o),fk(a,l,u,l,i,o)}(t,e,n,r,l,i,a),function(t,e,n,r,s,i,o){const a=Math.round(t+.5*s),u=a-Math.round(.5*s),c=Math.round(e-n),l=Math.round(e+r);fk(a,c,a,l,i,o),fk(a,c,u,c,i,o),fk(a,l,u,l,i,o)}(t+s-l,e,n,r,l,i,a)):(lk(t,e,o,LA,a),lk(t+s-l,e,o,BA,a))}function fk(t,e,n,r,s,i){const o="<line "+("x1='"+t+"'")+("y1='"+e+"'")+("x2='"+n+"'")+("y2='"+r+"'")+"style='stroke:black;stroke-width:"+s+"'/>";i.push(o)}function pk(t,e,n,r,s,i,o,a,u){let c=vS(o);fk(t,e-c,t+s,e-c,i,u);let l=(s-sk(Ft(a)))/2;c=n-nk(Ft(a)),ak(t+l,e-c,Ft(a),u),a=Ct(a),l=(s-sk(Ft(a)))/2,c=r-rk(Ft(a)),ak(t+l,e+c,Ft(a),u)}const dk=f("i"),mk=f("j"),gk=200,xk=100,yk=10,wk=40,Ek=30,vk=15;function Dk(t){return function(e,n,r,s){if(Nt(e),r.getDirective(ie.drawing));else{const i=new rh(n,r);r.pushDirective(ie.drawing,1);try{const[o,a,u,c]=function(t,e,n,r){r.push(t),r.dupl(),r.head();const s=r.pop();r.rest(),r.dupl(),r.head();const i=I(r.pop());r.rest(),r.dupl(),r.head(),wm(e,n,r);const o=r.pop();r.rest(),r.pop();try{return o.isnil?[s,i,Sk+1,!0]:[s,i,ht(o).toNumber(),!1]}finally{o.release()}}(e.argList,n,r,s);ag(I(a),n);try{const e={tmax:+Math.PI,tmin:-Math.PI,xmax:10,xmin:-10,ymax:10,ymin:-10};!function(t,e,n,r){r.tmin=-Math.PI,r.tmax=+Math.PI;let s=Rm(f("trange"),t);if(n.push(s),Nd(t,e,n),hd(t,e,n),s=n.pop(),!b(s)||1!==s.ndim||2!==s.dims[0])return;const i=s.elems[0],o=s.elems[1];if(!D(i)||!D(o))return;r.tmin=i.toNumber(),r.tmax=o.toNumber()}(n,r,s,e),function(t,e,n,r){r.xmin=-10,r.xmax=10;let s=Rm(f("xrange"),t);if(n.push(s),Nd(t,e,n),hd(t,e,n),s=n.pop(),!b(s)||1!==s.ndim||2!==s.dims[0])return;const i=s.elems[0],o=s.elems[1];if(!D(i)||!D(o))return;r.xmin=i.toNumber(),r.xmax=o.toNumber()}(n,r,s,e),function(t,e,n,r){r.ymin=-10,r.ymax=10;let s=Rm(f("yrange"),t);if(n.push(s),Nd(t,e,n),hd(t,e,n),s=n.pop(),!b(s)||1!==s.ndim||2!==s.dims[0])return;const i=s.elems[0],o=s.elems[1];if(!D(i)||!D(o))return;r.ymin=i.toNumber(),r.ymax=o.toNumber()}(n,r,s,e),function(t,e,n,r,s,i){cg(e,X(i.tmin),kt,n),s.push(t),Nd(n,r,s);const o=s.pop();b(o)||(i.tmin=i.xmin,i.tmax=i.xmax)}(o,I(a),n,r,s,e);const l=[];!function(t,e,n,r,s,i,o,a){const u=n-1;for(let c=0;c<n;c++){bk(t,e,a.tmin+(a.tmax-a.tmin)*c/u,r,s,i,o,a)}}(o,a,u,l,n,r,s,e),c&&function(t,e,n,r,s,i,o){const a=n.length-1;for(let u=0;u<a;u++){const a=n[u].t,c=n[u+1].t,l=n[u].x,h=n[u+1].x,f=n[u].y,p=n[u+1].y;if(!_k(l,f)&&!_k(h,p))continue;const d=c-a,m=h-l,g=p-f,x=Math.floor(Math.sqrt(m*m+g*g));for(let u=1;u<x;u++){bk(t,e,a+d*u/x,n,r,s,i,o)}}}(o,a,l,n,r,s,e);const h=[];!function(t,e,n,r,s,i){const o="height='"+(yk+kk+wk)+"'",a="width='"+(gk+Sk+xk)+"'";i.push("<svg "+o+a+">"),function(t,e){const n=0,r=Sk*(0-t.xmin)/(t.xmax-t.xmin),s=kk-kk*(n-t.ymin)/(t.ymax-t.ymin);r>0&&r<Sk&&Ak(r,0,r,kk,.5,e);s>0&&s<kk&&Ak(0,s,Sk,s,.5,e)}(r,i),function(t,e){const n=0,r=Sk,s=0,i=kk;Ak(n,s,r,s,.5,e),Ak(n,i,r,i,.5,e),Ak(n,s,n,i,.5,e),Ak(r,s,r,i,.5,e)}(0,i),function(t,e,n,r,s){bS(),kS(new d(n.ymax),t,e,r);const i=e.pop();let o=gk-sk(i)-vk,a=yk+nk(i);ak(o,a,i,s),bS(),kS(new d(n.ymin),t,e,r);const u=e.pop();o=gk-sk(u)-vk,a=yk+kk,ak(o,a,u,s),bS(),kS(new d(n.xmin),t,e,r);const c=e.pop();o=gk-sk(c)/2,a=yk+kk+Ek,ak(o,a,c,s),bS(),kS(new d(n.xmax),t,e,r);const l=e.pop();o=gk+Sk-sk(l)/2,a=yk+kk+Ek,ak(o,a,l,s)}(e,n,r,s,i),function(t,e,n){const r=t.length;for(let e=0;e<r;e++){const r=t[e].x,s=t[e].y;if(_k(r,s)){const t=`cx='${r+gk}'`,e=`cy='${kk-s+yk}'`;n.push(`<circle ${t} ${e} r='1.5' style='stroke:black;fill:black'/>`)}}}(t,0,i),i.push("</svg>")}(l,i,s,e,{useImaginaryI:L(_m(dk,kt,n)),useImaginaryJ:L(_m(mk,kt,n))},h);!function(t,e){for(const n of e.listeners)n.output(t)}(h.join(""),t)}finally{ug(n)}}finally{r.popDirective()}}s.push(kt)}}function bk(t,e,n,r,s,i,o,a){o.push(t),wm(s,i,o);const u=o.pop();try{let t=X(n);cg(I(e),t,kt,s),o.push(u),wm(s,i,o);const c=o.pop();if(T(c))return;{o.push(c),hd(s,i,o);let e=o.pop();try{if(b(e)&&(t=e.elems[0],e=e.elems[1]),!D(t)||!D(e))return;const s=t.toNumber(),i=e.toNumber();if(!isFinite(s)||!isFinite(i))return;const o=Sk*(s-a.xmin)/(a.xmax-a.xmin),u={t:n,x:o,y:kk*(i-a.ymin)/(a.ymax-a.ymin)};r.push(u)}finally{e.release()}}}finally{u.release()}}function Ak(t,e,n,r,s,i){const o="x1='"+(t+=gk)+"'",a="x2='"+(n+=gk)+"'",u="y1='"+(e+=yk)+"'",c="y2='"+(r+=yk)+"'";i.push(`<line ${o} ${u} ${a} ${c} style='stroke:black;stroke-width:${s}'/>`)}const Sk=300,kk=300;function _k(t,e){return t>-.5&&t<Sk+.5&&e>-.5&&e<kk+.5}function Fk(t,e){const n=Dk(e),r=new du;return n(t,e,e,r),r.pop()}let Ck=0;const Tk=[],Mk=[];function Ok(t,e){return function(t,e){const{arg:n,invalid:r}=Lk(t,e);if(r)return At(Mr,r);const[s,i]=Bk(Mr,n);return s}(t,e)}function Nk(t,e){return function(t,e){const{arg:n,invalid:r}=Lk(t,e);if(r)return At(Or,r);const[s,i]=Bk(Or,n);return i}(t,e)}function Lk(t,e){if(t=e.valueOf(Yy(e.valueOf(Ai(t)),e)),!b(t))return{invalid:t};2===t.ndim&&t.dim(0)===t.dim(1)||Je("eigen: argument is not a square matrix"),Ck=t.dim(0),function(t){for(let e=0;e<Ck;e++)for(let n=0;n<Ck;n++)if(!sn(t.elem(Ck*e+n)))return!1;return!0}(t)||Je("eigen: matrix is not numerical");for(let e=0;e<Ck-1;e++)for(let n=e+1;n<Ck;n++){const r=t.elem(Ck*e+n),s=t.elem(Ck*n+e);Math.abs(r.d-s.d)>1e-10&&Je("eigen: matrix is not symmetrical")}return{arg:t}}function Bk(t,e){for(let t=0;t<Ck*Ck;t++)Tk[t]=0;for(let t=0;t<Ck*Ck;t++)Mk[t]=0;for(let t=0;t<Ck;t++){Tk[Ck*t+t]=e.elem(Ck*t+t).d;for(let n=t+1;n<Ck;n++)Tk[Ck*t+n]=e.elem(Ck*t+n).d,Tk[Ck*n+t]=e.elem(Ck*t+n).d}for(let t=0;t<Ck;t++){Mk[Ck*t+t]=1;for(let e=t+1;e<Ck;e++)Mk[Ck*t+e]=0,Mk[Ck*e+t]=0}let n=0;for(n=0;n<100&&0!==qk();n++);const r=e.copyDimensions(),s=e.copyElements();if(t.equals(Tr)||t.equals(Mr))for(let t=0;t<Ck;t++)for(let e=0;e<Ck;e++)s[Ck*t+e]=ve(Tk[Ck*t+e]);const i=e.copyDimensions(),o=e.copyElements();if(t.equals(Tr)||t.equals(Or))for(let t=0;t<Ck;t++)for(let e=0;e<Ck;e++)o[Ck*t+e]=ve(Mk[Ck*t+e]);return[new F(r,s),new F(i,o)]}function qk(){let t=0;for(let e=0;e<Ck-1;e++)for(let n=e+1;n<Ck;n++)0!==Tk[Ck*e+n]&&(Ik(e,n),t++);return t}function Ik(t,e){const n=.5*(Tk[Ck*t+t]-Tk[Ck*e+e])/Tk[Ck*t+e];let r=1/(Math.abs(n)+Math.sqrt(n*n+1));n<0&&(r=-r);const s=1/Math.sqrt(r*r+1),i=r*s;for(let n=0;n<Ck;n++){const r=Tk[Ck*t+n],o=Tk[Ck*e+n];Tk[Ck*t+n]=s*r+i*o,Tk[Ck*e+n]=s*o-i*r}for(let n=0;n<Ck;n++){const r=Tk[Ck*n+t],o=Tk[Ck*n+e];Tk[Ck*n+t]=s*r+i*o,Tk[Ck*n+e]=s*o-i*r}for(let n=0;n<Ck;n++){const r=Mk[Ck*t+n],o=Mk[Ck*e+n];Mk[Ck*t+n]=s*r+i*o,Mk[Ck*e+n]=s*o-i*r}Tk[Ck*t+e]=0,Tk[Ck*e+t]=0}var Pk;Pk=new WeakMap;const Rk=de(class extends Fy{constructor(t){super("eigenval",Mr),this.config=t,Pk.set(this,void 0),Rt(this,Pk,sx(this.opr),"f")}get hash(){return Pt(this,Pk,"f")}transform(t,e){const n=Ok(t,e);return[!n.equals(t)?ne:2,n]}});var Uk;Uk=new WeakMap;const $k=de(class extends Fy{constructor(t){super("eigenvec",Or),this.config=t,Uk.set(this,void 0),Rt(this,Uk,sx(this.opr),"f")}get hash(){return Pt(this,Uk,"f")}transform(t,e){const n=Nk(t,e);return[!n.equals(t)?ne:2,n]}});var zk;zk=new WeakMap;const Wk=de(class extends Fy{constructor(t){super("eigen",Tr),this.config=t,zk.set(this,void 0),Rt(this,zk,sx(this.opr),"f")}get hash(){return Pt(this,zk,"f")}transform(t,e){const n=function(t,e){const{arg:n}=Lk(t,e);n||Je("eigen: argument is not a square matrix");const[r,s]=Bk(Tr,n);return e.setBinding(f("D"),r),e.setBinding(f("Q"),s),kt}(t,e);return[!n.equals(t)?ne:2,n]}});function Xk(t){if(0===t)return 1;const e=Math.abs(t),n=1/(1+.5*e),r=n*Math.exp(-e*e-1.26551223+n*(1.00002368+n*(.37409196+n*(.09678418+n*(n*(.27886807+n*(n*(1.48851587+n*(.17087277*n-.82215223))-1.13520398))-.18628806)))));return t>=0?r:2-r}var Kk;Kk=new WeakMap;const Hk=de(class extends Fy{constructor(t){super("erf",Nr),this.config=t,Kk.set(this,void 0),Rt(this,Kk,sx(this.opr),"f")}get hash(){return Pt(this,Kk,"f")}transform(t,e){const n=function(t,e){if(l(t))return X(1-Xk(t.d));if(e.iszero(t))return _;if(io(t))return e.negate(At(Nr,e.negate(t)));return At(Nr,t)}(e.valueOf(Ai(t)),e);return[!n.equals(t)?ne:2,n]}});var Jk;Jk=new WeakMap;const Gk=de(class extends Fy{constructor(){super("erfc",Lr),Jk.set(this,void 0),Rt(this,Jk,sx(this.opr),"f")}get hash(){return Pt(this,Jk,"f")}transform(t,e){const n=function(t,e){if(l(t)){const e=Xk(t.d);return X(e)}if(e.iszero(t))return S;return At(Lr,t)}(e.valueOf(Ai(t)),e);return[!n.equals(t)?ne:2,n]}}),Vk=t(e.infix);function jk(t,e){const n=At(Vk,t);try{return ut(e.valueOf(n)).str}finally{n.release()}}var Qk;function Zk(t){return t.originalMessage}Qk=new WeakMap;const Yk=de(class{constructor(){Qk.set(this,qg(Ut(kt)))}get hash(){return Pt(this,Qk,"f")}get name(){return"ErrExtension"}test(t,r){if(n(r,e.iszero))return!1;throw new Error(`${this.name}.test(${t},${r}) method not implemented.`)}binL(t,e,n,r){return t}binR(t,e,n,r){return t}dispatch(t,n,r,s){switch(n.id){case e.grade:return t;case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Vt}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[t instanceof u?2:ee,t]}valueOf(t,e){throw new Error("ErrExtension.valueOf method not implemented.")}isKind(t){return T(t)}subst(t,e,n){return this.isKind(e)&&t.equals(e)?n:t}toAsciiString(t,e){const n=Zk(t);try{return jk(n,e)}finally{n.release()}}toHumanString(t,e){const n=Zk(t);try{return jk(n,e)}finally{n.release()}}toInfixString(t,e){const n=Zk(t);try{return jk(n,e)}finally{n.release()}}toLatexString(t,e){const n=Zk(t);try{return jk(n,e)}finally{n.release()}}toListString(t,e){const n=Zk(t);try{return jk(n,e)}finally{n.release()}}});function t_(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),function(t,e,n){const r=Jm(n);try{n.push(Ut(r))}finally{r.release()}}(0,0,r)}var e_;e_=new WeakMap;const n_=de(class extends Fy{constructor(){super("eval",Br),e_.set(this,void 0),Rt(this,e_,sx(this.opr),"f")}get hash(){return Pt(this,e_,"f")}transform(t,e){const n=function(t,e){const n=t.argList;try{const t=n.head;let r=n.rest;try{let n=e.valueOf(t);try{for(;_t(r);){const t=r.item0,s=r.item1;try{const i=e.valueOf(t),o=e.valueOf(s);try{n=yo(n,i,o,e),r=Si(r)}finally{i.release(),o.release()}}finally{t.release(),s.release()}}return e.valueOf(n)}finally{n.release()}}finally{t.release(),r.release()}}finally{n.release()}}(t,e);return[ne,n]}});function r_(t){const e=[];return pi(t)?t.tail().forEach((t=>e.push(...s_(t)))):e.push(...s_(t)),e}function s_(t){return di(t)?t.tail():[t]}function i_(t,e,n){if(b(t))return function(t,e,n){return t.map((function(t){return i_(t,e,n)}))}(t,e,n);if(pi(t))return t.tail().reduce(((t,r)=>n.add(t,i_(r,e,n))),_);let r=ba(t,n),s=va(t,n);if([s,r]=function(t,e,n,r){const s=[...r_(t),...r_(e)];let i=0;for(let t=0;t<s.length;t++){const e=s[t];if(!mi(e))continue;if(!Ai(e).equals(n))continue;const r=jt(_i(e));isNaN(r)||r<i&&(i=r)}if(0===i)return[t,e];return t=r.multiply(t,r.power(n,x(-i))),e=r.multiply(e,r.power(n,x(-i))),[t,e]}(s,r,e,n),(Bi(r,n)||Bi(s,n))&&(!Pi(s,e)||Bi(s,n)))return t;const i=Wo(r,s,e,n);if(r=n.subtract(r,n.multiply(s,i)),n.iszero(r))return i;s=aa(s,e,n);const o=function(t,e,n){const r=[];di(t)?t.tail().forEach((s=>r.push(...o_(t,s,e,n)))):r.push(...o_(t,t,e,n));const s=r.length;if(1===s)return r[0];const i=[s,s],o=new Array(s*s);for(let t=0;t<s;t++)for(let i=0;i<s;i++){const a=n.power(e,x(t)),u=ho(r[i],a,n);o[s*t+i]=Mo(u,e,n)}return new F(i,o)}(s,e,n);let a;if(r=function(t,e,n,r){if(!b(e))return t;const s=e.dim(0),i=[s],o=new Array(s);for(let e=0;e<s;e++){const s=ho(t,r.power(n,x(e)),r);o[e]=Mo(s,n,r)}return new F(i,o)}(r,o,e,n),s=function(t,e,n,r){if(!b(e))return Yi(t,r);let s=[];di(t)?t.tail().forEach((t=>{s.push(...u_(t,n,r))})):s=u_(t,n,r);const i=s.length;return new F([i],s)}(s,o,e,n),b(o)){const t=je(Ax,o,n);a=n.inner(n.inner(t,r),s)}else{const t=ho(r,o,n);a=n.multiply(t,s)}return n.add(a,i)}function o_(t,e,n,r){let s,i=0;if(!e.contains(n))return[];const o=Qe(a_,t,e,r);mi(e)?(i=jt(e.expo),s=e.base):(i=1,s=e);const a=[],u=jt(lD(s,n));for(let t=0;t<i;t++)for(let e=0;e<u;e++){const i=Qe(to,o,r.power(s,x(t)),r),u=Qe(to,i,r.power(n,x(e)),r);a.push(u)}return a}function a_(t,e,n){let r=S;if(di(t)){const s=[];t.tail().forEach((t=>{t.equals(e)||s.push(n.valueOf(t))})),r=no(s,n)}return r}function u_(t,e,n){let r=1;if(!t.contains(e))return[];mi(t)&&(r=jt(t.expo),t=t.base);const s=[],i=jt(lD(t,e));for(let o=r;o>0;o--)for(let r=0;r<i;r++){const i=Yi(n.power(t,x(o)),n),a=n.power(e,x(r));s.push(n.multiply(i,a))}return s}var c_;c_=new WeakMap;const l_=de(class extends Fy{constructor(){super("expand",Ir),c_.set(this,void 0),Rt(this,c_,sx(this.opr),"f")}get hash(){return Pt(this,c_,"f")}transform(t,e){const n=function(t,e){const n=t.argList,r=e.valueOf(n.head),s=e.valueOf(n.argList.head),i=r;return i_(i,s.isnil?oi(i):s,e)}(t,e);return[n.equals(t)?ee:ne,n]}});var h_;function f_(t,e){const n=e.valueOf(t.item1),r=function(t,e,n){const r=t.item2;if(r.isnil)return oi(e);{const t=n.valueOf(r);return t.isnil?oi(e):t}}(t,n,e),s=function(t,e){const n=t.item3;return n.isnil?kt:e.valueOf(n)}(t,e);return[n,r,s]}function p_(t,e){const[n,r,s]=f_(t,e),i=oa(n,r,e);return _t(s)?[...s].reduce(((t,n)=>function(t,e,n){if(di(t)){const r=[];return t.tail().forEach((t=>ia(r,t,e,n))),ro(r,n)}const r=[];return ia(r,t,e,n),r[0]}(t,e.valueOf(n),e)),i):i}h_=new WeakMap;const d_=de(class extends Fy{constructor(n){super("factor",t(e.factor)),this.config=n,h_.set(this,void 0),Rt(this,h_,sx(this.opr),"f")}get hash(){return Pt(this,h_,"f")}transform(t,e){const n=p_(t,e);return[!n.equals(t)?ne:2,n]}});var m_;m_=new WeakMap;const g_=de(class extends Fy{constructor(t){super("factorial",Rr),this.config=t,m_.set(this,void 0),Rt(this,m_,sx(this.opr),"f")}get hash(){return Pt(this,m_,"f")}transform(t,e){const n=function(t,e){return hw(e.valueOf(Ai(t)))}(t,e);return[!n.equals(t)?ne:2,n]}});var x_;x_=new WeakMap;const y_=de(class extends Fy{constructor(t){super("float",Ur),this.config=t,x_.set(this,void 0),Rt(this,x_,sx(this.opr),"f")}get hash(){return Pt(this,x_,"f")}transform(t,e){const n=function(t,e){const n=Ai(t),r=Yy(e.valueOf(n),e);return e.valueOf(r)}(t,e);return[n.equals(t)?ee:ne,n]}});var w_;const E_=t(e.add),v_=t(e.isone),D_=t(e.iszero),b_=t(e.multiply),A_=t(e.pow);w_=new WeakMap;const S_=de(class{constructor(){w_.set(this,qg(ft(be)))}get hash(){return Pt(this,w_,"f")}get name(){return"FltExtension"}test(t,e){return e.equalsSym(v_)?t.isOne():!!e.equalsSym(D_)&&t.isZero()}binL(t,n,r,s){switch(n.id){case e.add:if(St(r)){if(p(r))return Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,E_,f(t.type),f(r.type));if(l(r))return t.add(r);if(c(r))return ve(t.toNumber()+r.toNumber());if(v(r))return Ry(E_,t,r,s);if(T(r))return r}break;case e.multiply:if(St(r)){if(M(r))return t.isZero()?t:Ry(b_,t,r,s);if(T(r))return r;if(l(r))return t.mul(r);if(O(r))return t.isZero()?t:Ry(b_,t,r,s);if(L(r))return t.isZero()?t:Ry(b_,t,r,s);if(c(r))return ve(t.toNumber()*r.toNumber());if(v(r))return t.isZero()?t:Ry(b_,t,r,s);if(b(r))return t.isZero()?r.map((()=>t)):r.map((e=>Zn(s,t,e)));if(k(r))return t.isZero()?t:Ry(b_,t,r,s)}break;case e.pow:if(St(r)){if(l(r))return ve(Math.pow(t.toNumber(),r.toNumber()));if(c(r))return ve(Math.pow(t.toNumber(),r.toNumber()));if(v(r))return At(A_,t,r)}}return kt}binR(t,e,n,r){if(e.equalsSym(E_)){if(St(n)){if(l(n))return n.add(t);if(c(n))return ve(n.toNumber()+t.toNumber())}}else if(e.equalsSym(b_)&&St(n)){if(O(n))return t.isZero()?t:Ry(b_,n,t,r);if(b(n))return n.map((e=>Zn(r,e,t)));if(k(n))return t.isZero()?t:Ry(b_,n,t,r)}return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:return t.abs();case e.grade:{const e=r.head;try{return bo(e,s)?t:De}finally{e.release()}}case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get dependencies(){return["Flt"]}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[t instanceof d?2:ee,t]}isKind(t){return l(t)}subst(t,e,n){return l(e)&&t.equals(e)?n:t}toAsciiString(t,e){return Ta(t.d,e)}toHumanString(t,e){return Ta(t.d,e)}toInfixString(t,e){return Ta(t.d,e)}toLatexString(t,e){return Ta(t.d,e)}toListString(t,e){return Ta(t.d,e)}valueOf(t){return t}});var k_;k_=new WeakMap;const __=de(class extends Fy{constructor(t){super("for",Wr),this.config=t,k_.set(this,void 0),Rt(this,k_,sx(this.opr),"f")}get hash(){return Pt(this,k_,"f")}transform(t,e){const n=function(t,e){const n=_i(t);v(n)||Je("for: 2nd arg should be the variable to loop over");const r=hx(Ti(t),e);if(isNaN(r))return t;const s=hx(Mi(t),e);if(isNaN(s))return t;const i=e.getBinding(n,kt);try{for(let i=r;i<=s;i++)e.setBinding(n,x(i)),e.valueOf(Ai(t))}finally{e.setBinding(n,i)}return kt}(t,e);return[!n.equals(t)?ne:2,n]}});function F_(t,e){return function(t,e){if(c(t)&&ii(t.a,1)&&ii(t.b,2))return e.power(Ze.PI(e),Bn);if(c(t)&&ii(t.a,3)&&ii(t.b,2))return e.multiply(e.power(Ze.PI(e),Bn),Bn);if(io(t))return lo(e.multiply(Ze.PI(e),Nn),e.multiply(e.multiply(e.sin(e.multiply(Ze.PI(e),t)),t),F_(e.negate(t),e)),e);if(pi(t))return function(t,e){const n=Ct(t);if(c(Ft(n))&&ii(Ft(n).a,1)&&ii(Ft(n).b,1))return e.multiply(Ai(n),F_(Ai(n),e));if(c(Ft(n))&&ii(Ft(n).a,-1)&&ii(Ft(n).b,1))return lo(F_(Ai(n),e),e.add(Ai(n),Nn),e);return At(Kr,t)}(t,e);return At(Kr,t)}(t,e)}var C_;let T_=class extends Fy{constructor(t){super("gamma",Kr),this.config=t,C_.set(this,void 0),Rt(this,C_,sx(this.opr),"f")}get hash(){return Pt(this,C_,"f")}transform(t,e){const n=function(t,e){return F_(e.valueOf(Ai(t)),e)}(t,e);return[!n.equals(t)?ne:2,n]}};C_=new WeakMap;const M_=new class{create(t){return new T_(t)}};var O_;let N_=class extends Fy{constructor(){super("gcd",Hr),O_.set(this,void 0),Rt(this,O_,sx(this.opr),"f")}get hash(){return Pt(this,O_,"f")}transform(t,e){const n=function(t,e){t=Ct(t);let n=e.valueOf(Ft(t));return _t(t)&&(n=t.tail().reduce(((t,n)=>ca(t,e.valueOf(n),e)),n)),n}(t,e);return[!n.equals(t)?ne:2,n]}};O_=new WeakMap;const L_=new class{create(){return new N_}},B_=t(e.grade);function q_(t,e){const n=t.argList;try{const t=n.item0,r=n.item1;try{const n=e.valueOf(t),s=e.valueOf(r);try{return function(t,e,n){if(St(t)){const r=n.handlerFor(t),s=At(e);try{return r.dispatch(t,B_,s,n)}finally{s.release()}}return t}(n,s,e)}finally{n.release(),s.release()}}finally{t.release(),r.release()}}finally{n.release()}}function I_(t,e){if(e>0){const n=t.argList;return _t(n)?I_(n,e-1):n}return t.car}var P_;P_=new WeakMap;const R_=de(class extends Fy{constructor(){super("hermite",Jr),P_.set(this,void 0),Rt(this,P_,sx(this.opr),"f")}get hash(){return Pt(this,P_,"f")}transform(t,e){if(e.isExpanding()){const n=function(t,e){return Nx(e.valueOf(I_(t,1)),e.valueOf(I_(t,2)),e)}(t,e);return[!n.equals(t)?ne:2,n]}return[ee,t]}});function U_(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return function(t,e){const n=jt(t);if(n<0)return At(Gr,t);const r=[n,n],s=new Array(n*n);for(let t=0;t<n;t++)for(let r=0;r<n;r++)s[t*n+r]=Yi(x(t+r+1),e);return new F(r,s)}(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}var $_;const z_=t(e.multiply);$_=new WeakMap;const W_=de(class{constructor(){$_.set(this,qg(function(t){if(O(t))return t;throw new Error}(Y)))}test(t,e,n){return!1}binL(t,e,n,r){if(e.equalsSym(z_)){if(O(n))return Ry(z_,t,n,r);if(b(n))return n.map((e=>Zn(r,t,e)));if(k(n))return Ry(z_,t,n,r)}return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.infix:return Q(this.toInfixString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Pt(this,$_,"f")}get name(){return"HypExtension"}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[t instanceof tt?2:ee,t]}valueOf(t,e){throw new Error("Hyp Method not implemented.")}isKind(t){return O(t)}subst(t,e,n){return this.isKind(e)&&t.equals(e)?n:t}toHumanString(t){return t.printname}toInfixString(t){return t.printname}toLatexString(t){return t.printname}toListString(t){return t.printname}});var X_;const K_=t(e.infinitesimal);X_=new WeakMap;const H_=de(class extends Cy{constructor(t){super("infinitesimal",K_,h),this.config=t,X_.set(this,void 0),Rt(this,X_,nx(K_,Jg),"f")}get hash(){return Pt(this,X_,"f")}transform1(t,e){return[ne,pt(e.str)]}}),J_=t(e.isone),G_=t(e.iszero),V_=t(e.multiply),j_=t(e.PI),Q_=t(e.pow),Z_=At(V_,m,A);const Y_=de(class{constructor(){}binL(t,e,n,r){if(e.equalsSym(V_)){if(St(n)){if(M(n))return Ry(V_,t,n,r);if(T(n))return n;if(l(n))return n.isZero()?n:Ry(V_,t,n,r);if(O(n))return Ry(V_,t,n,r);if(L(n))return m;if(c(n))return Ry(V_,t,n,r);if(v(n))return Ry(V_,t,n,r);if(b(n))return n.map((e=>Zn(r,t,e)));if(k(n))return Ry(V_,t,n,r)}}else if(e.equalsSym(Q_)&&St(n)&&c(n)){if(n.isEven()){return n.mul(Bn).isEven()?S:m}if(n.isOdd()){return n.succ().mul(Bn).isEven()?Z_:A}{const t=n.numer(),e=n.denom(),s=function(t,e,n){const r=At(Q_,e,m),s=At(V_,t,r);return n.valueOf(s)}(t,At(V_,bn,e),r),i=At(Q_,m,s);return r.valueOf(i)}}return kt}binR(t,e,n,r){if(e.equalsSym(V_)&&St(n)){if(O(n))return Ry(V_,n,t,r);if(b(n))return n.map((e=>Zn(r,e,t)));if(k(n))return Ry(V_,n,t,r)}return kt}dispatch(t,n,r,s){switch(n.id){case e.arg:return Ry(V_,Bn,j_,s);case e.infix:return Q(this.toInfixString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}test(t,e){if(e.equalsSym(J_))return!1;if(e.equalsSym(G_))return!1;throw new Error(`ImuExtension.test ${e} method not implemented.`)}iscons(){return!1}operator(){throw new Error}get hash(){return Xg}get name(){return"ImuExtension"}isKind(t){return A.equals(t)}isnil(t){return!1}subst(t,e,n){return t.equals(e)?n:t}toHumanString(t){return"i"}toInfixString(t){return"i"}toLatexString(t){return"\\imath"}toListString(t,e){return e.getSymbolPrintName(Xe)}toString(){return this.name}evaluate(t,e){return[2,Tt(t,e)]}transform(t){return[2,this.valueOf(t)]}valueOf(t){return t}});function tF(t,e){const n=[];n.push(Ft(Ct(t)));Ft(Ct(Ct(t))).isnil&&Je("pattern needs at least a template and a transformed version");let r=Ct(Ct(t));for(;kt!==r;)n.push(Ft(r)),r=Ct(r);if(n.length>2){let t=At(Ie,n[n.length-2],n[n.length-1]);for(let e=2;e<n.length;e++)t=At(Ie,n[n.length-e-1],t);return tF(t,e)}let s=[];eF(t,s);let i=[];for(let t=0;t<s.length;t++)s[t].equals(Zs)||i.push(s[t]);if(s=i,i=[],s.length>1){let t=0;for(let n=0;n<s.length&&n+t+1<=s.length-1;n++){if(vi(s[n+t])||vi(s[n+t+1]))i.push(s[n+t]);else{const r=e.valueOf(s[n+t+1]),o=Ax(e.valueOf(s[n+t]),e),a=e.subtract(o,r);e.iszero(a)?t+=1:i.push(s[n+t])}if(n+t===s.length-2&&i.push(s[s.length-1]),n+t>=s.length-1)break}s=i}if(0===s.length)return Zs;t=(t=At(Ie,...s)).argList;let o=e.valueOf(Ft(t));return _t(t)&&(o=t.tail().reduce(((t,n)=>e.inner(t,e.valueOf(n))),o)),o}function eF(t,e){if(_t(t)){if(!Ct(t).isnil)return yi(t)?(eF(Ft(Ct(t)),e),void eF(Ct(Ct(t)),e)):void nF(t,e);eF(Ft(t),e)}else nF(t,e)}function nF(t,e){kt!==t&&e.push(t)}var rF;function sF(t,e){const n=t.lhs,r=t.rhs;try{const t=e.valueOf(n),s=e.valueOf(r);try{return function(t,e,n){const r=(t,e)=>e;if(ah(t)&&ah(e)){if(M(t)&&M(e))return r("A",At(Ie,t,e));{const s=Xy(t),i=$y(t,M),o=Xy(e),a=$y(e,M),u=n.valueOf(At(Ie,i,a)),c=n.valueOf(At(Ie,s,o));return r("B",n.valueOf(At(Ne,u,c)))}}return r("C",n.valueOf(At(Ne,t,e)))}(t,s,e)}finally{t.release(),s.release()}}finally{n.release(),r.release()}}class iF extends yE{constructor(){super("inner_product",Ie,Ty,Ty),rF.set(this,void 0),Rt(this,rF,Yg(Ie,Qg,Qg),"f")}get hash(){return Pt(this,rF,"f")}valueOf(t,e){return sF(t,e)}transform2(t,e,n,r,s){const i=(t,e)=>e;if(ah(e)&&ah(n)){if(M(e)&&M(n))return[ee,i(0,r)];{const r=Xy(e),o=$y(e,M),a=Xy(n),u=$y(n,M),c=s.valueOf(At(t,o,u)),l=s.valueOf(At(t,r,a)),h=s.valueOf(At(Ne,c,l));return[ne,i(0,h)]}}{const t=s.valueOf(At(Ne,e,n));return[ee,i(0,t)]}}}rF=new WeakMap;const oF=new class{create(){return new iF}};var aF;aF=new WeakMap;const uF=de(class extends yE{constructor(){super("inner_2_any_imu",Ie,Ty,L),aF.set(this,void 0),Rt(this,aF,Yg(Ie,Qg,Xg),"f")}get hash(){return Pt(this,aF,"f")}transform2(t,e,n,r,s){const i=e,o=n,a=s.valueOf(At(t,S,i)),u=s.valueOf(At(Ne,a,o));return[ne,u]}});var cF;cF=new WeakMap;const lF=de(class extends yE{constructor(t){super("inner_2_any_rat",Ie,Ty,c),this.config=t,cF.set(this,void 0),Rt(this,cF,Yg(Ie,Qg,Hg),"f")}get hash(){return Pt(this,cF,"f")}transform2(t,e,n,r){return n.isOne()?[ne,e]:[ne,At(Ne.clone(t.pos,t.end),e,n)]}});function hF(t,e){return!jn(t,e)&&ww(t,e)}const fF=de(class extends yE{constructor(t){super("inner_2_any_real",Ie,Ty,hF),this.config=t}transform2(t,e,n,r,s){const i=s.valueOf(At(t,e,S)),o=s.valueOf(At(Ne,i,n));return[ne,o]}});var pF;pF=new WeakMap;const dF=de(class extends yE{constructor(t){super("inner_2_blade_blade",Ie,M,M),this.config=t,pF.set(this,void 0),Rt(this,pF,Yg(Ie,Rg,Rg),"f")}get hash(){return Pt(this,pF,"f")}transform2(t,e,n,r,s){return[ne,s.valueOf(e.scp(n))]}});var mF;mF=new WeakMap;const gF=de(class extends yE{constructor(t){super("inner_2_imu_any",Ie,L,Ty),this.config=t,mF.set(this,void 0),Rt(this,mF,Yg(Ie,Xg,Qg),"f")}get hash(){return Pt(this,mF,"f")}transform2(t,e,n,r,s){const i=e,o=n,a=s.negate(i),u=s.valueOf(At(t,S,o)),c=s.valueOf(At(Ne,a,u));return[ne,c]}});var xF;xF=new WeakMap;const yF=de(class extends yE{constructor(t){super("inner_2_imu_imu",Ie,L,L),this.config=t,xF.set(this,void 0),Rt(this,xF,Yg(Ie,Xg,Xg),"f")}get hash(){return Pt(this,xF,"f")}transform2(t,e,n){return[ne,S]}});var wF;wF=new WeakMap;const EF=de(class extends yE{constructor(t){super("inner_2_imu_rat",Ie,L,c),this.config=t,wF.set(this,void 0),Rt(this,wF,ex(Ie,Be,Hg),"f")}get hash(){return Pt(this,wF,"f")}transform2(t,e,n,r,s){return[ne,s.negate(At(Ne.clone(t.pos,t.end),e,n))]}});var vF;vF=new WeakMap;const DF=de(class extends yE{constructor(t){super("inner_2_num_num",Ie,D,D),this.config=t,vF.set(this,void 0),Rt(this,vF,Yg(Ie,Hg,Hg),"f")}get hash(){return Pt(this,vF,"f")}transform2(t,e,n){return[ne,Wl(e,n)]}});var bF;function AF(t,e){const n=t.lhs,r=t.rhs;try{const t=e.valueOf(r);try{return function(t,e,n){if(t.isZero())return _.addRef(),_;if(t.isOne())return e.addRef(),e;{const r=At(Ne,t,e);try{return n.valueOf(r)}finally{r.release()}}}(n,r,e)}finally{t.release()}}finally{n.release(),r.release()}}bF=new WeakMap;const SF=de(class extends yE{constructor(t){super("inner_2_rat_any",Ie,c,Ty),this.config=t,bF.set(this,void 0),Rt(this,bF,Yg(Ie,Hg,Qg),"f")}get hash(){return Pt(this,bF,"f")}valueOf(t,e){return AF(t,e)}transform2(t,e,n,r,s){const i=AF(r,s);return[ne,i]}});var kF;kF=new WeakMap;const _F=de(class extends yE{constructor(t){super("inner_2_rat_imu",Ie,c,L),this.config=t,kF.set(this,void 0),Rt(this,kF,Yg(Ie,Hg,Xg),"f")}get hash(){return Pt(this,kF,"f")}transform2(t,e,n){return[ne,At(Ne.clone(t.pos,t.end),e,n)]}});var FF;FF=new WeakMap;const CF=de(class extends yE{constructor(t){super("inner_2_rat_sym",Ie,c,v),this.config=t,FF.set(this,void 0),Rt(this,FF,Yg(Ie,Hg,Gg),"f")}get hash(){return Pt(this,FF,"f")}transform2(t,e,n){return[ne,At(Ne.clone(t.pos,t.end),e,n)]}});function TF(t,e){return!jn(t,e)&&ww(t,e)}const MF=de(class extends yE{constructor(t){super("inner_2_real_any",Ie,TF,Ty),this.config=t,this.phases=ue}transform2(t,e,n,r,s){const i=s.valueOf(At(t,S,n)),o=s.valueOf(At(Ne,e,i));return[ne,o]}});var OF;OF=new WeakMap;const NF=de(class extends yE{constructor(t){super("inner_2_sym_sym",Ie,v,v),this.config=t,OF.set(this,void 0),Rt(this,OF,Yg(Ie,Gg,Gg),"f")}get hash(){return Pt(this,OF,"f")}transform2(t,e,n,r,s){return[ne,s.valueOf(At(Ne.clone(t.pos,t.end),e,n))]}});const LF=de(class extends yE{constructor(t){super("inner_2_vec_scalar",Ie,M,vh),this.config=t}transform2(t,e,n,r){return[ne,_]}});var BF;BF=new WeakMap;const qF=de(class extends Fy{constructor(t){super("integral_varargs",jr),this.config=t,BF.set(this,void 0),Rt(this,BF,sx(this.opr),"f")}get hash(){return Pt(this,BF,"f")}transform(t,e){const n=Xw(t,e);return[!n.equals(t)?ne:2,n]}});var IF;IF=new WeakMap;const PF=de(class extends Cy{constructor(t){super("inv_any",Pe,Ty),this.config=t,IF.set(this,void 0),Rt(this,IF,nx(Pe,Qg),"f")}get hash(){return Pt(this,IF,"f")}transform1(t,e,n,r){const s=Ax(e,r);return[!s.equals(n)?ne:ee,s]}});var RF;class UF extends Cy{constructor(t,e){super(`${t}∘${e}`,t,_t),this.innerOpr=e,RF.set(this,void 0),Rt(this,RF,nx(this.opr,Qg),"f")}get hash(){return Pt(this,RF,"f")}isKind(t,e){if(super.isKind(t,e)){const e=t.arg;return!!_t(e)&&e.opr.equals(this.innerOpr)}return!1}}RF=new WeakMap;const $F=t(e.inv);const zF=de(class extends UF{constructor(t){super($F,$F),this.config=t}transform1(t,e,n){const r=e.argList.head;return[ne,r]}});var WF;const XF=t(e.iscomplex);WF=new WeakMap;const KF=de(class extends Cy{constructor(t){super("is_complex_any",XF,Ty),this.config=t,WF.set(this,void 0),Rt(this,WF,nx(this.opr,Qg),"f")}get hash(){return Pt(this,WF,"f")}transform1(t,e,n){return[ee,n]}});var HF;const JF=t(e.iscomplex);HF=new WeakMap;const GF=de(class extends Cy{constructor(t){super("is_complex_sym",JF,v),this.config=t,HF.set(this,void 0),Rt(this,HF,nx(this.opr,Gg),"f")}get hash(){return Pt(this,HF,"f")}transform1(t,e,n,r){const s=r.getSymbolPredicates(e);return[ne,st(s.complex)]}});class VF extends Cy{constructor(t,e,n,r){super(t,e,n),this.config=r,this.predT=r.useIntegersForPredicates?S:$,this.predF=r.useIntegersForPredicates?_:z}asPredicateValue(t){return t?this.predT:this.predF}transform1(t,e,n,r){return[ne,this.asPredicateValue(this.compute(e,r))]}}var jF;const QF=t(e.isinfinitesimal);jF=new WeakMap;const ZF=de(class extends VF{constructor(t){super("isinfinitesimal_any",QF,Ty,t),this.config=t,jF.set(this,void 0),Rt(this,jF,nx(this.opr,Qg),"f")}get hash(){return Pt(this,jF,"f")}compute(){return!1}});var YF;const tC=t(e.isinfinitesimal);YF=new WeakMap;const eC=de(class extends VF{constructor(t){super("infinitesimal_hyp",tC,O,t),this.config=t,YF.set(this,void 0),Rt(this,YF,nx(this.opr,Wg),"f")}get hash(){return Pt(this,YF,"f")}compute(){return!0}});class nC extends UF{constructor(t,e,n){super(t,e),this.config=n,this.predT=n.useIntegersForPredicates?S:$,this.predF=n.useIntegersForPredicates?_:z}asPredicateValue(t){return t?this.predT:this.predF}transform1(t,e,n,r){return[ne,this.asPredicateValue(this.compute(e,r))]}}const rC=t(e.isinfinitesimal),sC=t(e.multiply);const iC=de(class extends nC{constructor(t){super(rC,sC,t),this.config=t}compute(t,e){return[...t.argList].some((function(t){return e.isinfinitesimal(t)}))}});var oC;const aC=t(e.isinfinitesimal);oC=new WeakMap;const uC=de(class extends VF{constructor(t){super("isinfinitesimal_rat",aC,c,t),this.config=t,oC.set(this,void 0),Rt(this,oC,nx(this.opr,Hg),"f")}get hash(){return Pt(this,oC,"f")}compute(t){return t.isZero()}});var cC;const lC=t(e.isinfinitesimal);cC=new WeakMap;const hC=de(class extends VF{constructor(t){super("infinitesimal_sym",lC,v,t),this.config=t,cC.set(this,void 0),Rt(this,cC,nx(this.opr,Gg),"f")}get hash(){return Pt(this,cC,"f")}compute(t,e){return e.getSymbolPredicates(t).infinitesimal}}),fC=t(e.isone);function pC(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return function(t,e){if(St(t)){const n=e.handlerFor(t).test(t,fC,e);return st(n)}return z}(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}var dC;const mC=t(e.ispositive);dC=new WeakMap;const gC=de(class extends VF{constructor(t){super("ispositive_any",mC,Ty,t),this.config=t,dC.set(this,void 0),Rt(this,dC,nx(this.opr,Qg),"f")}get hash(){return Pt(this,dC,"f")}compute(){return!1}}),xC=t(e.exp),yC=t(e.ispositive);const wC=de(class extends nC{constructor(t){super(yC,xC,t),this.config=t}compute(t,e){return e.isreal(t)}});var EC;const vC=t(e.ispositive);EC=new WeakMap;const DC=de(class extends VF{constructor(t){super("ispositive_flt",vC,l,t),this.config=t,EC.set(this,void 0),Rt(this,EC,nx(this.opr,zg),"f")}get hash(){return Pt(this,EC,"f")}compute(t){return t.isPositive()}});var bC;const AC=t(e.ispositive);bC=new WeakMap;const SC=de(class extends VF{constructor(t){super("ispositive_rat",AC,c,t),this.config=t,bC.set(this,void 0),Rt(this,bC,nx(this.opr,Hg),"f")}get hash(){return Pt(this,bC,"f")}compute(t){return t.isPositive()}});var kC;let _C=class extends VF{constructor(t,e,n){super("ispositive_sym",t,v,n),this.opr=t,this.which=e,this.config=n,kC.set(this,void 0),Rt(this,kC,nx(this.opr,Gg),"f")}get hash(){return Pt(this,kC,"f")}compute(t,e){const n=e.getSymbolPredicates(t);return this.which(n)}};kC=new WeakMap;const FC=new class{constructor(t,e){this.predicate=t,this.which=e}create(t){return new _C(this.predicate,this.which,t)}}(t(e.ispositive),(t=>t.positive));function CC(t,e){return function(t){if(c(t)&&t.isNonNegativeInteger()&&Yo(t.a))return Dn;return vn}(e.valueOf(Ai(t)))}var TC;TC=new WeakMap;const MC=de(class extends Fy{constructor(t){super("isprime",Zr),this.config=t,TC.set(this,void 0),Rt(this,TC,sx(this.opr),"f")}get hash(){return Pt(this,TC,"f")}transform(t,e){const n=CC(t,e);return[!n.equals(t)?ne:2,n]}}),OC=t(e.pow),NC=t(e.isreal);const LC=de(class extends UF{constructor(t){super(NC,OC),this.config=t}isKind(t,e){if(super.isKind(t,e)){const e=t.argList.head.expo;return c(e)&&e.isMinusOne()}return!1}transform1(t,e,n,r){const s=e.lhs;return[ne,Eh(r.isreal(s),r)]}}),BC=t(e.abs),qC=t(e.isreal);const IC=de(class extends nC{constructor(t){super(qC,BC,t),this.config=t}compute(){return!0}}),PC=t(e.add),RC=t(e.isreal);const UC=de(class extends nC{constructor(t){super(RC,PC,t),this.config=t}compute(t,e){return[...t.argList].every((function(t){return e.isreal(t)}))}});var $C;$C=new WeakMap;const zC=de(class extends Cy{constructor(t){super("is_real_any",ms,Ty),this.config=t,$C.set(this,void 0),Rt(this,$C,nx(this.opr,Qg),"f")}get hash(){return Pt(this,$C,"f")}transform1(t,e,n){return[ne,z]}}),WC=t(e.isreal),XC=t(e.cos);let KC=class{constructor(t){this.innerOpr=t}create(){return new HC(this.innerOpr)}},HC=class extends UF{constructor(t){super(WC,t)}transform1(t,e,n,r){const s=e.argList.head;return[ne,st(r.isreal(s))]}};function JC(t){return new KC(t)}const GC=JC(XC);var VC;VC=new WeakMap;const jC=de(class extends VF{constructor(n){super("is_real_flt",t(e.isreal),l,n),this.config=n,VC.set(this,void 0),Rt(this,VC,nx(this.opr,zg),"f")}get hash(){return Pt(this,VC,"f")}compute(){return!0}});const QC=de(class extends UF{constructor(t){super(ms,Vr),this.config=t}transform1(t,e){return[ne,$]}});var ZC,YC;ZC=new WeakMap,YC=new WeakMap;const tT=de(class extends Cy{constructor(n){super("is_real_imu",t(e.isreal),L),this.config=n,ZC.set(this,void 0),YC.set(this,void 0),Rt(this,ZC,nx(this.opr,Xg),"f"),Rt(this,YC,n.useIntegersForPredicates?_:z,"f")}get hash(){return Pt(this,ZC,"f")}transform1(t,e){return[ne,Pt(this,YC,"f")]}});var eT,nT;eT=new WeakMap,nT=new WeakMap;const rT=de(class extends UF{constructor(n){super(t(e.isreal),t(e.multiply)),this.config=n,eT.set(this,void 0),nT.set(this,void 0),Rt(this,eT,n.useIntegersForPredicates?S:$,"f"),Rt(this,nT,n.useIntegersForPredicates?_:z,"f")}transform1(t,e,n,r){return[...e.argList].every((function(t){return r.isreal(t)}))?[ne,Pt(this,eT,"f")]:[ne,Pt(this,nT,"f")]}}),sT=t(e.pow),iT=t(e.isreal);const oT=de(class extends UF{constructor(t){super(iT,sT),this.config=t}isKind(t,e){if(super.isKind(t,e)){const e=t.argList.head,n=e.lhs,r=e.rhs;return _a(n)&&v(r)}return!1}transform1(t,e,n,r){const s=I(e.rhs);return r.isreal(s)?[ne,Eh(!0,r)]:[ne,Eh(!1,r)]}}),aT=t(e.pow),uT=t(e.isreal);const cT=de(class extends UF{constructor(t){super(uT,aT),this.config=t}isKind(t,e){if(super.isKind(t,e)){const e=t.argList.head,n=e.lhs,r=e.rhs;return L(n)&&c(r)}return!1}transform1(t,e,n){const r=ht(e.rhs),s=r.numer();return r.denom().isOne()&&s.div(Sn).isInteger()?[ne,$]:[ne,z]}}),lT=t(e.PI),hT=t(e.pow),fT=t(e.isreal);const pT=de(class extends UF{constructor(t){super(fT,hT),this.config=t}isKind(t,e){if(super.isKind(t,e)){const e=t.argList.head,n=e.lhs,r=e.rhs;return c(n)&&c(r)}return!1}transform1(t,e,n,r){const s=ht(e.lhs);if(s.isMinusOne()){const t=ht(e.rhs),n=r.sin(r.multiply(t,lT));return r.iszero(n)?[ne,$]:[ne,z]}return s.isPositive()?[ne,$]:[ne,z]}}),dT=t(e.pow),mT=t(e.isreal);const gT=de(class extends UF{constructor(t){super(mT,dT),this.config=t}isKind(t,e){if(super.isKind(t,e)){const e=t.argList.head,n=e.lhs,r=e.rhs;return v(n)&&c(r)}return!1}transform1(t,e,n,r){const s=I(e.lhs),i=ht(e.rhs),o=i.numer(),a=i.denom();if(r.isreal(s))if(o.div(bn).isInteger()){if(a.isOne())return[ne,Eh(!0,r)]}else if(o.isMinusOne()&&a.isOne())return[ne,Eh(r.isreal(s),r)];return[ne,Eh(!1,r)]}});var xT,yT;xT=new WeakMap,yT=new WeakMap;const wT=de(class extends Cy{constructor(t){super("is_real_rat",ms,c),this.config=t,xT.set(this,void 0),yT.set(this,void 0),Rt(this,xT,nx(this.opr,Hg),"f"),Rt(this,yT,t.useIntegersForPredicates?S:$,"f")}get hash(){return Pt(this,xT,"f")}transform1(){return[ne,Pt(this,yT,"f")]}});const ET=de(class extends UF{constructor(t){super(ms,ds),this.config=t}transform1(t,e,n,r){return[ne,Eh(!0,r)]}}),vT=t(e.sin);const DT=de(class extends UF{constructor(t){super(ms,vT),this.config=t}transform1(t,e,n,r){const s=e.argList.head;return[ne,Eh(r.isreal(s),r)]}});var bT;let AT=class{constructor(t){this.predicate=t}create(){return new ST(this.predicate)}};class ST extends Cy{constructor(t){super(`${t.key()}(sym: ${Gg}) => ${Ug}`,t,v),bT.set(this,void 0),Rt(this,bT,nx(this.opr,Gg),"f")}get hash(){return Pt(this,bT,"f")}transform1(t,e,n,r){const s=r.getSymbolPredicates(e);return[ne,st(s.real)]}}var kT;bT=new WeakMap;const _T=t(e.iszero);kT=new WeakMap;const FT=de(class extends Cy{constructor(t){super("iszero_any",_T,Ty),this.config=t,kT.set(this,void 0),Rt(this,kT,nx(this.opr,Qg),"f")}get hash(){return Pt(this,kT,"f")}transform1(t,e,n,r){if(St(e)){const t=r.handlerFor(e);return[ee,Eh(t.test(e,_T,r),r)]}return[ee,z]}});var CT;function TT(t,e){return Eh(t.isZero(),e)}CT=new WeakMap;const MT=de(class extends Cy{constructor(n){super("iszero_flt",t(e.iszero),l),this.config=n,CT.set(this,void 0),Rt(this,CT,nx(this.opr,zg),"f")}get hash(){return Pt(this,CT,"f")}valueOf(t,e){return function(t,e){const n=t.arg;try{return TT(n,e)}finally{n.release()}}(t,e)}transform1(t,e,n,r){return[ne,TT(e,r)]}});var OT;function NT(t,e){return Eh(t.isZero(),e)}OT=new WeakMap;const LT=de(class extends Cy{constructor(n){super("iszero_rat",t(e.iszero),c),this.config=n,OT.set(this,void 0),Rt(this,OT,nx(this.opr,Hg),"f")}get hash(){return Pt(this,OT,"f")}valueOf(t,e){return function(t,e){const n=t.arg;try{return NT(n,e)}finally{n.release()}}(t,e)}transform1(t,e,n,r){return[ne,NT(e,r)]}});var BT;const qT=t(e.iszero);BT=new WeakMap;const IT=de(class extends Cy{constructor(t){super("iszero_sym",qT,v),this.config=t,BT.set(this,void 0),Rt(this,BT,nx(this.opr,Gg),"f")}get hash(){return Pt(this,BT,"f")}transform1(t,e,n,r){const s=r.getSymbolPredicates(e);return[ne,Eh(s.zero,r)]}});var PT;function RT(t,e){const n=t.nelem;for(let r=0;r<n;r++)if(!e.iszero(t.elems[r]))return Eh(!1,e);return Eh(!0,e)}PT=new WeakMap;const UT=de(class extends Cy{constructor(n){super("iszero_tensor",t(e.iszero),b),this.config=n,PT.set(this,void 0),Rt(this,PT,nx(this.opr,Vg),"f")}get hash(){return Pt(this,PT,"f")}valueOf(t,e){return function(t,e){const n=t.arg;try{return RT(n,e)}finally{n.release()}}(t,e)}transform1(t,e,n,r){return[ne,RT(e,r)]}});var $T;$T=new WeakMap;const zT=de(class{constructor(){$T.set(this,qg(new dt("a","ns")))}test(t,e){return!1}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Pt(this,$T,"f")}get name(){return"KeywordExtension"}valueOf(t){return function(t){if(N(t))return t;throw new Error}(t),t}isKind(t){return!!N(t)}subst(t,e,n){return N(e)&&t.equals(e)?n:t}toAsciiString(t){return t.key()}toHumanString(t){return t.key()}toInfixString(t){return t.key()}toLatexString(t){return t.key()}toListString(t){return t.key()}evaluate(t,e,n){throw new Error("Method not implemented.")}transform(t){return[ee,t]}});function WT(t,e){const n=e.valueOf(Ai(t)),r=e.valueOf(_i(t)),s=e.valueOf(Ti(t));return function(t,e,n,r){const s=jt(e);if(s<0||isNaN(s))return At(Yr,t,e,n);if(Aa(t))return XT(s,t,n,r);return r.valueOf(yo(XT(s,Ws,n,r),Ws,t,r))}(n,r,s.isnil?_:s,e)}function XT(t,e,n,r){let s=_,i=S;for(let o=0;o<t;o++){const t=lo(r.subtract(r.multiply(r.add(r.subtract(x(2*o+1),e),n),i),r.multiply(r.add(x(o),n),s)),x(o+1),r);s=i,i=t}return i}var KT;KT=new WeakMap;const HT=de(class extends Fy{constructor(){super("laguerre",Yr),KT.set(this,void 0),Rt(this,KT,sx(this.opr),"f")}get hash(){return Pt(this,KT,"f")}transform(t,e){const n=WT(t,e);return[!n.equals(t)?ne:2,n]}});const JT=de(class{get hash(){return Kg}get name(){return"LambdaExtension"}iscons(){return!1}operator(){throw new Vt}isKind(t,e){return J(t)}toHumanString(t,e){throw new Error("LambdaExtension.toHumanString method not implemented.")}toInfixString(t,e){throw new Error("LambdaExtension.toInfixString method not implemented.")}toLatexString(t,e){throw new Error("LambdaExtension.toLatexString method not implemented.")}toListString(t,e){throw new Error("LambdaExtension.toListString method not implemented.")}evaluate(t,e,n){throw new Error("LambdaExtension.evaluate method not implemented.")}transform(t){const e=this.valueOf(t);try{return me(e,t)}finally{e.release()}}valueOf(t){return t}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,e,n,r){return Xt(Kt.Property_0_does_not_exist_on_type_1,e,f(t.type))}subst(t,e,n,r){throw new Error("LambdaExtension.subst method not implemented.")}test(t,e,n){throw new Error("LambdaExtension.test method not implemented.")}});var GT;GT=new WeakMap;const VT=de(class extends Fy{constructor(){super("lcm",ts),GT.set(this,void 0),Rt(this,GT,sx(this.opr),"f")}get hash(){return Pt(this,GT,"f")}transform(t,e){const n=function(t,e){t=Ct(t);let n=e.valueOf(Ft(t));return _t(t)&&(n=t.tail().reduce(((t,n)=>Uo(t,e.valueOf(n),e)),n)),n}(t,e);return[!n.equals(t)?ne:2,n]}});let jT=class extends yE{constructor(){super("lco_2_any_any",Re,Ty,Ty)}isKind(t,e){if(super.isKind(t,e)){const e=t.lhs,n=t.rhs;return!M(e)||!M(n)}return!1}transform2(t,e,n,r,s){if(di(e)&&ah(e)){const t=Xy(e),r=$y(e,M),i=s.valueOf(At(Re,t,n)),o=s.valueOf(At(Ne,r,i));return[ne,o]}if(di(n)&&ah(n)){const t=Xy(n),r=$y(n,M),i=s.valueOf(At(Re,e,t)),o=s.valueOf(At(Ne,r,i));return[ne,o]}return[ee,r]}};const QT=new class{create(){return new jT}};var ZT;let YT=class extends yE{constructor(){super("lco_2_blade_blade",t(e.lco),M,M),ZT.set(this,void 0),Rt(this,ZT,Yg(this.opr,Rg,Rg),"f")}get hash(){return Pt(this,ZT,"f")}transform2(t,e,n,r,s){return[ne,s.valueOf(e.lshift(n))]}};ZT=new WeakMap;const tM=new class{create(){return new YT}};function eM(t,e){return e.power(t,bn)}function nM(t,e){const n=e.valueOf(Ai(t)),r=e.valueOf(_i(t)),s=e.valueOf(Ti(t));return function(t,e,n,r){return function(t,e,n,r){const s=jt(e),i=jt(n);if(s<0||isNaN(s)||i<0||isNaN(i))return At(es,t,e,n);let o;if(Aa(t))o=rM(s,i,t,r);else{const e=rM(s,i,Ws,r);o=r.valueOf(yo(e,Ws,t,r))}return o=function(t,e,n,r){if(0===e)return;let s=r.subtract(S,eM(n,r));Ft(n).equals(Dr)?s=eM(r.sin(Ai(n)),r):Ft(n).equals(ws)&&(s=eM(r.cos(Ai(n)),r));let i=r.multiply(t,r.power(s,r.multiply(x(e),Bn)));e%2&&(i=r.negate(i));return i}(o,i,t,r)||o,o}(t,e,n,r)}(n,r,s.isnil?_:s,e)}function rM(t,e,n,r){let s=_,i=S;for(let e=0;e<t;e++){const t=lo(r.subtract(r.multiply(r.multiply(x(2*e+1),n),i),r.multiply(x(e),s)),x(e+1),r);s=i,i=t}for(let t=0;t<e;t++)i=Ww(i,n,r);return i}var sM;sM=new WeakMap;const iM=de(class extends Fy{constructor(){super("legendre",es),sM.set(this,void 0),Rt(this,sM,sx(this.opr),"f")}get hash(){return Pt(this,sM,"f")}transform(t,e){const n=nM(t,e);return[!n.equals(t)?ne:2,n]}});var oM;const aM=t(e.let);oM=new WeakMap;const uM=de(class extends Fy{constructor(){super("(let [binding*] body)",aM),oM.set(this,void 0),Rt(this,oM,sx(this.opr),"f")}get hash(){return Pt(this,oM,"f")}transform(t,e){const n=CE(t,e);return[!n.equals(t)?ne:2,n]}});function cM(t){return new B(t)}var lM;const hM=new zt(Kt.Hello_World,kt);function fM(n,r,s){return n.replace(/{(\d+)}/g,((n,i)=>{const o=r.item(parseInt(i));try{const n=s.handlerFor(o).dispatch(o,t(e.infix),kt,s);try{return Qt(n)}finally{n.release()}}finally{o.release()}}))}lM=new WeakMap;const pM=de(class{constructor(){lM.set(this,qg(hM))}get hash(){return Pt(this,lM,"f")}get name(){return"RatExtension"}iscons(){return!1}operator(){throw new Vt}isKind(t,e){return Wt(t)}toHumanString(t,e){const n=t.message.text,r=t.argList;try{return fM(n,r,e)}finally{r.release()}}toInfixString(t,e){const n=t.message.text,r=t.argList;try{return fM(n,r,e)}finally{r.release()}}toLatexString(t,e){throw new Error("Method not implemented.")}toListString(t,e){throw new Error("Method not implemented.")}evaluate(t,e,n){throw new Error("Method not implemented.")}transform(t,e){throw new Error("Method not implemented.")}valueOf(t,e){throw new Error("Method not implemented.")}binL(t,e,n,r){throw new Error("Method not implemented.")}binR(t,e,n,r){throw new Error("Method not implemented.")}dispatch(t,n,r,s){return n.id===e.infix?cM(this.toInfixString(t,s)):Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}subst(t,e,n,r){throw new Error("Method not implemented.")}test(t,e,n){throw new Error("Method not implemented.")}});function dM(t){return!!k(t)||!(!_t(t)||!sh(t)||1!==ih(t,k))}const mM=t=>!k(t);function gM(t){if(k(t))return t;if(_t(t)&&sh(t)&&1===ih(t,k)){const e=$y(t,mM);if(k(e))return e;throw new Error}throw new Error}const xM=t(e.multiply);function yM(t,e){return yh(t,wM,e)}function wM(t,e){if(t.isnil)return S;{const n=t.car,r=t.cdr;return _t(r)?[...r].reduce(((t,n)=>EM(t,n,e)),n):n}}function EM(n,r,s){const i=function(t,e){return t};if(St(n)&&St(r)){const t=s.handlerFor(n),e=s.handlerFor(r),o=t.binL(n,xM,r,s);if(bt(o)){const t=e.binR(r,xM,n,s);if(bt(t)){return i(Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,xM,f(n.type),f(r.type)))}if(!di(t))return i(t)}else if(!di(o))return i(o)}return D(n)&&D(r)?i(Wl(n,r)):i(function(n,r,s){const i=function(t,e){return t};if(c(n)){if(n.isZero())return i(n);if(n.isOne())return i(r)}if(l(n)&&n.isZero())return i(n);if(c(r)){if(r.isZero())return i(_);if(r.isOne())return i(n)}if(l(r)&&r.isZero())return i(_);if(pi(n))return Nw(s)?i(n.tail().reduce(((t,e)=>ao(s,t,Zn(s,e,r))),_)):di(r)?i(At(t(e.multiply),n,...r.tail())):i(At(t(e.multiply),n,r));if(pi(r))return Nw(s)?i(r.tail().reduce(((t,e)=>ao(s,t,Zn(s,n,e))),_)):di(n)?i(At(t(e.multiply),...n.tail(),r)):i(At(t(e.multiply),n,r));if(ah(n)&&ah(r)){const t=Xy(n),e=Xy(r),o=t.mul(e),a=$y(n,M),u=$y(r,M);return i(Zn(s,Zn(s,a,u),o))}if(dM(n)&&dM(r)){const t=gM(n),e=gM(r),o=t.mul(e),a=$y(n,k),u=$y(r,k);return i(Zn(s,Zn(s,a,u),o))}if(k(n)&&k(r))return i(n.mul(r));if(!b(n)&&b(r))return i(r.map((t=>Zn(s,n,t))));if(b(n)&&!b(r))return i(n.map((t=>Zn(s,t,r))));let o=di(n)?n.cdr:At(n),a=di(r)?r.cdr:At(r);const u=[],h=o.head,f=a.head;D(h)&&D(f)?(u.push(Wl(h,f)),o=o.cdr,a=a.cdr):D(h)?(u.push(h),o=o.cdr):D(f)?(u.push(f),a=a.cdr):u.push(S);const p=s.compareFn(Ne);for(;_t(o)&&_t(a);){const t=o.car,e=a.car;if(_t(t)&&Ft(t).equals(is)&&_t(e)&&Ft(e).equals(is)){u.push(Tt(is,DM(Ct(t),Ct(e)))),o=o.cdr,a=a.cdr;continue}const[n,r]=vM(t),[i,c]=vM(e);if(n.equals(i))AM(u,n,r,c,s),o=o.cdr,a=a.cdr;else switch(p(t,e)){case Zt:u.push(t),o=o.cdr;break;case te:u.push(e),a=a.cdr;break;default:throw new Error(`baseL => ${n} expoL => ${r} baseR => ${i} expoR => ${c}`)}}_t(o)&&u.push(...o);_t(a)&&u.push(...a);if(Nw(s))for(let t=0;t<u.length;t++)if(pi(u[t]))return i(bM(u,s));const d=u.length;if(1===d){return i(SM(u.pop()))}const m=u[0];if(c(m)&&m.isOne()){if(2===d){return i(SM(u.pop()))}u.splice(0,1),u.sort(p);return i(At(Ne,...u))}const g=Tt(t(e.multiply),At(...u));return i(g)}(n,r,s))}function vM(t){return mi(t)?[t.base,t.expo]:[t,S]}function DM(t,e){const n=[];return _t(t)&&n.push(...t),_t(e)&&n.push(...e),At(...n)}function bM(t,e){if(1===t.length)return t[0];if(0===t.length)return S;let n=t[0];for(let r=1;r<t.length;r++)n=EM(n,t[r],e);return n}function AM(t,e,n,r,s){const i=ao(s,n,r);try{const n=po(s,e,i);try{!function(t,e){if(D(e))t[0]=Wl(kM(t[0]),e);else if(di(e)){const n=e.argList,r=n.head;if(D(r)&&bt(Si(n))){const n=e.rhs;t[0]=Wl(kM(t[0]),r),t.push(n)}else t.push(e)}else t.push(e)}(t,n)}finally{n.release()}}finally{i.release()}}function SM(t){if(void 0===t)throw new Error;return t}function kM(t){if(D(t))return t;throw new Error}var _M;_M=new WeakMap;const FM=de(class extends yE{constructor(n){super("mul_2_blade_blade",t(e.multiply),M,M),this.config=n,_M.set(this,void 0),Rt(this,_M,Yg(t(e.multiply),Rg,Rg),"f")}get hash(){return Pt(this,_M,"f")}transform2(t,e,n,r,s){return[ne,s.valueOf(e.mul(n))]}});class CM extends yE{constructor(t,e,n,r,s){super(t,e,n,r),this.cross=s}match(t,e){const n=super.match(t,e);if(n&&this.cross(n.lhs,n.rhs,n,e))return n}transform(t,e){const n=this.match(t,e);if(n){const[t,r]=e.transform(n.lhs),[s,i]=e.transform(n.rhs);return re(t)||re(s)?[ne,e.valueOf(At(n.opr,r,i))]:this.transform2(n.opr,n.lhs,n.rhs,n,e)}return[ee,t]}}function TM(t,e,n){const r=t.dim(t.ndim-1);r!==e.dim(0)&&Je("inner: tensor dimension check");const s=t.ndim+e.ndim-2;s>ti&&Je("inner: rank of result exceeds maximum");const i=t.sliceDimensions(0,t.ndim-1).reduce(((t,e)=>t*e),1),o=e.sliceDimensions(1).reduce(((t,e)=>t*e),1),a=Sx(i*o,vn);for(let s=0;s<i;s++)for(let i=0;i<r;i++)if(!n.iszero(t.elem(s*r+i)))for(let u=0;u<o;u++)a[s*o+u]=n.add(n.multiply(t.elem(s*r+i),e.elem(i*o+u)),a[s*o+u]);if(0===s)return a[0];{const n=[...t.sliceDimensions(0,t.ndim-1),...e.sliceDimensions(1,e.ndim)];return new F(n,a)}}var MM;MM=new WeakMap;const OM=de(class extends CM{constructor(n){super("mul_2_tensor_tensor",t(e.multiply),b,b,(function(t,e){return!0})),this.config=n,MM.set(this,void 0),this.dependencies=[],Rt(this,MM,Yg(t(e.multiply),Vg,Vg),"f")}get hash(){return Pt(this,MM,"f")}transform2(t,e,n,r,s){return[ne,TM(e,n,s)]}});const NM=de(class{constructor(){}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){return n.id===e.sexpr?Q(this.toListString()):Xt(Kt.Property_0_does_not_exist_on_type_1,n,f("nil"))}test(t,e){return!1}iscons(){return!1}operator(){throw new Error}get hash(){return Zg}get name(){return"NilExtension"}isKind(t){return kt.equals(t)}isnil(t){throw new Error}subst(t,e,n){return t.equals(e)?n:t}toAsciiString(){return"nil"}toHumanString(){return"nil"}toInfixString(){return"nil"}toLatexString(){return"nil"}toListString(){return"()"}evaluate(t){return this.transform(Tt(kt,t))}transform(t){return kt.equals(t)?[2,kt]:[ee,t]}valueOf(t){return kt}}),LM=t(e.not),BM=t(e.testeq);function qM(t,e){return function(t,e){const n=t;t=Ct(t);for(;_t(t);){if(Ct(t).isnil)return e.valueOf(Ft(t));const r=ib(e.valueOf(sb(Ft(t))),e);if(null==r)return n;if(r)return e.valueOf(Ai(t));t=Si(t)}return vn}(t,e)}function IM(t,e){const n=t.argList;return e.valueOf(At(LM,Tt(BM,n)))}function PM(t,e){const n=t,r=e.valueOf(n.lhs),s=e.valueOf(n.rhs);let i=ib(e.valueOf(sb(e.subtract(r,s))),e);if(i)return Eh(!1,e);if(null!=i&&!i)return Eh(!0,e);const o=qw(r,e),a=qw(s,e);return i=ib(e.subtract(o,a),e),i?Eh(!1,e):null==i||i?mt:Eh(!0,e)}function RM(t,e){const n=t,r=function(t,e){const n=qw(e.valueOf(t.lhs),e),r=qw(e.valueOf(t.rhs),e);let s=mo(e,n,r);c(s)||sn(s)||(s=e.valueOf(Yy(s,e)));if(bo(s,e))return Yt;return c(s)||sn(s)?s.isNegative()?Zt:te:null}(t,e);return null==r?n:Eh(r<=0,e)}function UM(t,e){const n=ib(e.valueOf(sb(t.argList.head)),e);return null==n?t:Eh(!n,e)}function $M(t,e){let n=Ct(t),r=!1;for(;_t(n);){const t=ib(e.valueOf(sb(Ft(n))),e);if(null==t)r=!0,n=Ct(n);else if(t)n=Ct(n);else if(!t)return Eh(!1,e)}return r?t:Eh(!0,e)}var zM;zM=new WeakMap;const WM=de(class extends Fy{constructor(t){super("or",os),this.config=t,zM.set(this,void 0),Rt(this,zM,sx(this.opr),"f")}get hash(){return Pt(this,zM,"f")}transform(t,e){const n=function(t,e){const n=t;let r=Ct(n),s=!1;for(;_t(r);){const t=ib(e.valueOf(sb(Ft(r))),e);if(null==t)s=!0,r=Ct(r);else{if(t)return Eh(!0,e);t||(r=Ct(r))}}return s?n:Eh(!1,e)}(t,e);return[!n.equals(t)?ne:2,n]}});var XM;XM=new WeakMap;const KM=de(class extends yE{constructor(){super("outer_2_blade_blade",qe,M,M),XM.set(this,void 0),this.dependencies=["Blade"],Rt(this,XM,Yg(qe,Rg,Rg),"f")}get hash(){return Pt(this,XM,"f")}transform2(t,e,n,r){const s=e.wedge(n);try{return me(s,r)}finally{s.release()}}});var HM;const JM=Yg(qe,Rg,sx(Ne));HM=new WeakMap;const GM=de(class extends yE{constructor(){super(JM,qe,M,di),HM.set(this,void 0),Rt(this,HM,JM,"f")}get hash(){return Pt(this,HM,"f")}transform2(t,e,n,r,s){if(ah(n)){const t=Xy(n),i=Zn(s,$y(n,M),e.wedge(t));try{return me(i,r)}finally{i.release()}}else{const t=Zn(s,e,n);try{return me(t,r)}finally{t.release()}}}});var VM;const jM=Yg(qe,sx(Ne),Rg);VM=new WeakMap;const QM=de(class extends yE{constructor(){super(jM,qe,di,M),VM.set(this,void 0),Rt(this,VM,jM,"f")}get hash(){return Pt(this,VM,"f")}transform2(t,e,n,r,s){if(ah(e)){const t=Xy(e),i=Zn(s,$y(e,M),t.wedge(n));try{return me(i,r)}finally{i.release()}}else{const t=Zn(s,e,n);try{return me(t,r)}finally{t.release()}}}});var ZM;const YM=Yg(qe,sx(Ne),sx(Ne));ZM=new WeakMap;const tO=de(class extends yE{constructor(){super(YM,qe,di,di),ZM.set(this,void 0),Rt(this,ZM,YM,"f")}get hash(){return Pt(this,ZM,"f")}transform2(t,e,n,r,s){if(ah(e)&&ah(n)){const t=Xy(e),i=$y(e,M),o=Xy(n),a=Zn(s,i,$y(n,M),t.wedge(o));try{return me(a,r)}finally{a.release()}}else{const t=Zn(s,e,n);try{return me(t,r)}finally{t.release()}}}});var eO;function nO(t,e,n){t.ndim+e.ndim>ti&&Je("outer: rank of result exceeds maximum");const r=[...t.copyDimensions(),...e.copyDimensions()],s=[];let i=0;for(let r=0;r<t.nelem;r++)for(let o=0;o<e.nelem;o++)s[i++]=n.multiply(t.elem(r),e.elem(o));return new F(r,s)}eO=new WeakMap;const rO=de(class extends yE{constructor(){super("outer_2_tensor_tensor",qe,b,b),eO.set(this,void 0),this.dependencies=[],Rt(this,eO,Yg(qe,Vg,Vg),"f")}get hash(){return Pt(this,eO,"f")}transform2(t,e,n,r,s){return[ne,nO(e,n,s)]}});var sO;sO=new WeakMap;const iO=de(class extends Cy{constructor(t){super("pred_any",f("pred"),Ty),this.config=t,this.name="pred_any",sO.set(this,void 0),Rt(this,sO,nx(this.opr,Qg),"f")}get hash(){return Pt(this,sO,"f")}transform1(t,e,n){return[ee,n]}});var oO;oO=new WeakMap;const aO=de(class extends Cy{constructor(t){super("pred_rat",f("pred"),c),this.config=t,oO.set(this,void 0),Rt(this,oO,nx(this.opr,Hg),"f")}get hash(){return Pt(this,oO,"f")}transform1(t,e){return[ne,e.pred()]}});function uO(t,e,n){switch(e){case Ke.Ascii:return Vx(t,n);case Ke.Human:return Dy(t,n);case Ke.Infix:return ru(t,n);case Ke.LaTeX:return by(t,n);case Ke.SExpr:return Oa(t,n);default:throw new Vt}}function cO(t,e,n){const r=JSON.stringify(t),[s,i]=ll(r,0,{useCaretForExponentiation:oe(n.getDirective(ie.useCaretForExponentiation)),useParenForTensors:oe(n.getDirective(ie.useParenForTensors)),explicitAssocAdd:!1,explicitAssocMul:!1,explicitAssocExt:!1});if(s===r.length){const t=ut(i);n.setBinding(e,t)}}class lO extends XE{constructor(t,e,n){super(t,n),this.printMode=e,this.config=n}get hash(){return Gg}get name(){return this.keyword().key()}transform(t,e){if(v(t)&&t.equalsSym(this.keyword())){const t=this.printMode();e.pushDirective(ie.printMode,this.printMode());try{const n=uO(e.getBinding(Fa,kt),t,e);return e.getPrintHandler().print(n),cO(n,Pa(t),e),[ne,kt]}finally{e.popDirective()}}return[ee,t]}}let hO=class{constructor(t,e){this.keyword=t,this.printMode=e}create(t){return new lO(f(this.keyword),this.printMode,t)}};function fO(t,e){return new hO(t,e)}var pO;class dO extends Cy{constructor(t,e){super(t,f(t),Ty),this.printMode=e,pO.set(this,void 0),Rt(this,pO,nx(this.opr,Qg),"f")}get hash(){return Pt(this,pO,"f")}transform1(t,e,n,r){const s=At(e);if(_t(s)){const t=function(t,e,n){const r=[];let s=t;for(;_t(s);){const t=n.valueOf(s.car);n.pushDirective(ie.printMode,e);try{if(e===Ke.Infix){const s=za(t,n);r.push(s),cO(s,Pa(e),n)}else if(e===Ke.Human){const s=za(t,n);r.push(s),cO(s,Pa(e),n)}else if(e===Ke.Ascii){const s=Vx(t,n);r.push(s),cO(s,Pa(e),n)}else if(e===Ke.LaTeX){const s=za(t,n);r.push(s),cO(s,Pa(e),n)}else if(e===Ke.SExpr){const s=Oa(t,n);r.push(s),cO(s,Pa(e),n)}}finally{n.popDirective()}s=s.argList}return r}(s,this.printMode(),r);r.getPrintHandler().print(...t)}return[ne,kt]}}pO=new WeakMap;let mO=class{constructor(t,e){this.opr=t,this.printMode=e}create(){return new dO(this.opr,this.printMode)}};function gO(t,e){return new mO(t,e)}var xO;xO=new WeakMap;const yO=de(class extends Fy{constructor(){super("product",hs),xO.set(this,void 0),Rt(this,xO,sx(this.opr),"f")}get hash(){return Pt(this,xO,"f")}transform(t,e){const n=function(t,e){const n=Ai(t),r=_i(t);v(r)||Je("product: 2nd arg?");const s=hx(Ti(t),e);if(isNaN(s))return t;const i=hx(Mi(t),e);if(isNaN(i))return t;const o=e.getBinding(r,kt);try{let t=S;for(let o=s;o<=i;o++){e.setBinding(r,x(o));const s=e.valueOf(n);t=e.multiply(t,s)}return t}finally{e.setBinding(r,o)}}(t,e);return[!n.equals(t)?ne:2,n]}});function wO(t){return My(t,"eval_quote(expr)","expr"),t.arg}function EO(t,e){const n=new du;return n.push(t),n.rest(),n.head(),wm(e,e,n),function(t){const e=t.pop();try{b(e)?t.push(x(e.rank)):t.push(_)}finally{e.release()}}(n),n.pop()}function vO(t,e,n){const r=Un(e),s=mo(n,e,r);let i;bo(s,n)||(i=At(us,t,s));const o=jt(r);if(isNaN(o)){const e=At(us,t,r);return i?[i,e]:[e]}if(0===o)return[i];const a=function(t,e){let n=rn(t.a,Math.abs(e)),r=rn(t.b,Math.abs(e));if(e<0){const t=n;n=r,r=t,n=Pn(n,r),r=Rn(r)}return new w(n,r)}(t,o);return i?[i,a]:[a]}t(e.E),t(e.exp);const DO=t(e.PI),bO=t(e.pow);function AO(t,e,n){const r=function(t,e){return t};if(t.isOne()||e.isZero())return r(S);if(t.isMinusOne()&&e.isHalf()){if(n.getDirective(ie.complexAsClock))return r(At(bO,t,e));if(n.getDirective(ie.complexAsPolar)){return r(Il(Zn(n,Bn,A,DO),n))}return r(A)}if(t.isZero()){if(ci(e)){const t=Xt(Kt.Division_by_zero);try{return r(t)}finally{t.release()}}return r(_)}if(e.isOne())return r(t);let s,i,o=0;if(Gt(e)){if(o=jt(e),isNaN(o))return r(At(bO,t,e));if(s=rn(t.a,Math.abs(o)),i=rn(t.b,Math.abs(o)),o<0){const t=s;s=i,i=t,s=Pn(s,i),i=function(t){return t.isNegative()?t.multiply(En(-1)):t}(i)}return r(new w(s,i))}if(Li(t))return r(function(t,e){if(Gt(t))return t.a.isOdd()?m:S;let n=Un(t);ci(t)&&(n=n.add(m));const r=mo(e,t,n);let s=At(bO,m,r);n.a.isOdd()&&(s=Yn(e,s));return s}(e,n));if(ci(t))return r(Zn(n,AO(t.neg(),e,n),AO(m,e,n)));if(!Gt(t)){const s=t.numer(),i=t.denom(),o=e;return r(Zn(n,AO(s,o,n),AO(i,o.neg(),n)))}if(Jt(t.a))return r(function(t,e,n){const r=ua(jt(t)),s=r,i=s.length;for(let t=0;t<i;t+=2)s.push(...vO(r[t],Zn(n,s[t+1],e),n));return no(s.slice(i),n)}(t,e,n));if(!Jt(e.a)||!Jt(e.b))return r(At(bO,t,e));const{a:a,b:u}=e;return s=function(t,e){t=t.abs(),0===e&&Je("root index is zero");let n=0;for(;t.shiftRight(n).toJSNumber()>0;)n++;if(0===n)return In(0);n=Math.floor((n-1)/e);const r=Math.floor(n/32+1);let s=En(r);for(let t=0;t<r;t++)s=s.and(En(1).shiftLeft(t).not());for(;n>=0;){switch(s=s.or(En(1).shiftLeft(n)),ta(rn(s,e),t)){case 0:return s;case 1:s=s.and(En(1).shiftLeft(n).not())}n--}return 0}(t.a,u.toJSNumber()),0===s?r(At(bO,t,e)):(i=rn(s,a),r(e.a.isNegative()?new w(gt.one,i):new w(i,gt.one)))}var SO;const kO=t(e.add),_O=t(e.isone),FO=t(e.iszero),CO=t(e.multiply),TO=t(e.PI),MO=t(e.pow);function OO(t,e,n){return t.isZero()?t:t.isOne()?e:Ry(CO,t,e,n)}SO=new WeakMap;const NO=de(class{constructor(){SO.set(this,qg(ht(S)))}test(t,e,n){if(e.equalsSym(_O))return t.isOne();if(e.equalsSym(FO))return t.isZero();throw new Error(`${this.name}.test(${t},${e}) method not implemented.`)}binL(t,n,r,s){switch(n.id){case e.add:if(St(r)){if(p(r))return Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,kO,f(t.type),f(r.type));if(M(r))return Ry(kO,t,r,s);if(l(r))return X(t.toNumber()+r.toNumber());if(L(r))return Ry(kO,t,r,s);if(c(r))return t.add(r);if(v(r))return Ry(kO,t,r,s);if(T(r))return r}break;case e.multiply:if(St(r)){if(M(r))return OO(t,r,s);if(T(r))return r;if(l(r))return Wl(t,r);if(O(r))return OO(t,r,s);if(L(r))return OO(t,r,s);if(c(r))return t.mul(r);if(v(r))return OO(t,r,s);if(b(r))return t.isZero()?r.map((()=>t)):t.isOne()?r.map((t=>t)):r.map((e=>Zn(s,t,e)));if(k(r))return OO(t,r,s)}break;case e.outer:if(St(r)){if(l(r))return Wl(t,r);if(c(r))return t.mul(r);if(v(r))return OO(t,r,s);if(k(r))return OO(t,r,s)}break;case e.pow:if(St(r)){if(c(r))return AO(t,r,s);if(v(r))return t.isOne()?t:At(MO,t,r)}}return kt}binR(t,e,n,r){if(e.equalsSym(CO)&&St(n)){if(O(n))return Ry(CO,n,t,r);if(b(n))return n.map((e=>Zn(r,e,t)));if(k(n))return Ry(CO,n,t,r)}return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:return t.abs();case e.arg:return t.isZero()?Ut(new B("arg of zero (0) is undefined")):t.isNegative()?TO:_;case e.grade:{const e=r.head;try{return bo(e,s)?t:_}finally{e.release()}}case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Vt}get hash(){return Pt(this,SO,"f")}get name(){return"RatExtension"}isKind(t,e){return _t(t)&&Lt(t)?this.isKind(t.head,e):t instanceof w}subst(t,e,n){return c(e)&&t.equals(e)?n:t}toAsciiString(t){return t.toInfixString()}toHumanString(t){return t.toInfixString()}toInfixString(t){return t.toInfixString()}toLatexString(t){return t.toInfixString()}toListString(t){return t.toListString()}evaluate(t,e,n){throw new Vt}toString(){return this.name}transform(t,e){return me(this.valueOf(t,e),t)}valueOf(t,e){return e.getDirective(ie.evaluatingAsFloat)?X(t.toNumber()):t}});var LO;LO=new WeakMap;const BO=de(class extends yE{constructor(t){super("rco_2_any_any",Ue,Ty,Ty),this.config=t,LO.set(this,void 0),Rt(this,LO,Yg(Ue,Qg,Qg),"f")}get hash(){return Pt(this,LO,"f")}transform2(t,e,n,r){return[ee,r]}});function qO(t,e){return _t(t)&&Lo(t)&&vh(t.lhs)}var IO;IO=new WeakMap;const PO=de(class extends yE{constructor(t){super("rco_2_any_mul_2_scalar_any",Ue,Ty,qO),this.config=t,IO.set(this,void 0),Rt(this,IO,tx(Ue,Qg,Ne),"f")}get hash(){return Pt(this,IO,"f")}transform2(t,e,n,r,s){const i=e,o=n.lhs,a=n.rhs,u=s.valueOf(At(t,i,a)),c=s.valueOf(At(n.opr,o,u));return[ne,c]}});var RO;RO=new WeakMap;const UO=de(class extends yE{constructor(t){super("rco_2_blade_blade",Ue,M,M),this.config=t,RO.set(this,void 0),Rt(this,RO,Yg(Ue,Rg,Rg),"f")}get hash(){return Pt(this,RO,"f")}transform2(t,e,n){return[ne,e.rshift(n)]}});var $O;$O=new WeakMap;const zO=de(class extends yE{constructor(){super("rco_2_mul_2_scalar_any_any",Ue,qO,Ty),$O.set(this,void 0),Rt(this,$O,ex(Ue,Ne,Qg),"f")}get hash(){return Pt(this,$O,"f")}transform2(t,e,n,r,s){const i=e.lhs,o=e.rhs,a=n,u=s.valueOf(At(t,o,a)),c=s.valueOf(At(e.opr,i,u));return[ne,c]}});var WO;WO=new WeakMap;const XO=de(class extends Cy{constructor(t){super("reaction",f("reaction"),Ty),this.config=t,WO.set(this,void 0),Rt(this,WO,nx(f("reaction"),Qg),"f")}get hash(){return Pt(this,WO,"f")}valueOf(t,e){return function(t,e){const n=t.argList.item(0);try{const t=e.getCellHost(),r=new V(kt,t);return t.reaction(n,r),r}finally{n.release()}}(t,e)}transform(t,e){return me(this.valueOf(t,e),t)}transform1(t,e,n){throw new Vt}});var KO;KO=new WeakMap;const HO=de(class extends yE{constructor(t){super("reset!",f("reset!"),Ty,Ty),this.config=t,KO.set(this,void 0),Rt(this,KO,Yg(f("reset!"),Qg,Qg),"f")}get hash(){return Pt(this,KO,"f")}transform2(t,e,n,r,s){const i=function(t,e){const n=t.lhs,r=t.rhs;try{const t=lt(e.valueOf(n)),s=e.valueOf(r);try{return t.reset(s),kt}finally{t.release(),s.release()}}finally{n.release(),r.release()}}(r,s);return[ne,i]}}),JO=t(e.PI);function GO(t,e,n,r){tg(Ai(t),r),wm(e,n,r);const s=Jm(r);(!qm(s)||s.ndim>1||s.nelem>32768||s.nelem&s.nelem-1)&&hg("rotate error 1 first argument is not a vector or dimension error");let i=0;for(t=Si(t);_t(t);){_t(Ct(t))||hg("rotate error 2 unexpected end of argument list");const o=Ft(t);tg(Ai(t),r),wm(e,n,r);let a=jm(r);if((a>14||1<<a>=s.nelem)&&hg("rotate error 3 qubit number format or range"),t=Si(t),o.equals(f("C")))i|=1<<a;else if(o.equals(f("H")))VO(s,i,a,e,n,r),i=0;else if(o.equals(f("P"))){_t(t)||hg("rotate error 2 unexpected end of argument list"),tg(Ft(t),r),t=Ct(t),wm(e,n,r),tg(A,r),Um(e,n,r),sd(e,n,r);jO(s,Jm(r),i,a,e,n,r),i=0}else if(o.equals(f("Q")))eN(s,a,e,n,r),i=0;else if(o.equals(f("V")))nN(s,a,e,n,r),i=0;else if(o.equals(f("W"))){const o=a;_t(t)||hg("rotate error 2 unexpected end of argument list"),tg(Ft(t),r),t=Ct(t),wm(e,n,r),a=jm(r),(a>14||1<<a>=s.nelem)&&hg("rotate error 3 qubit number format or range"),QO(s,i,o,a,r),i=0}else o.equals(f("X"))?(ZO(s,i,a,r),i=0):o.equals(f("Y"))?(YO(s,i,a,e,n,r),i=0):o.equals(f("Z"))?(tN(s,i,a,e,n,r),i=0):hg("rotate error 4 unknown rotation code")}tg(s,r)}function VO(t,e,n,r,s,i){n=1<<n;for(let o=0;o<t.nelem;o++)(o&e)===e&&o&n&&(tg(t.elems[o^n],i),tg(t.elems[o],i),Ep(r,s,i),sg(1,2,i),um(r,s,i),Um(r,s,i),tg(t.elems[o^n],i),tg(t.elems[o],i),fg(r,s,i),sg(1,2,i),um(r,s,i),Um(r,s,i),t.elems[o]=Jm(i),t.elems[o^n]=Jm(i))}function jO(t,e,n,r,s,i,o){r=1<<r;for(let a=0;a<t.nelem;a++)(a&n)===n&&a&r&&(tg(t.elems[a],o),tg(e,o),Um(s,i,o),t.elems[a]=Jm(o))}function QO(t,e,n,r,s){n=1<<n,r=1<<r;for(let i=0;i<t.nelem;i++)(i&e)===e&&i&n&&!(i&r)&&(tg(t.elems[i],s),tg(t.elems[i^n^r],s),t.elems[i]=Jm(s),t.elems[i^n^r]=Jm(s))}function ZO(t,e,n,r){n=1<<n;for(let s=0;s<t.nelem;s++)(s&e)===e&&s&n&&(tg(t.elems[s^n],r),tg(t.elems[s],r),t.elems[s^n]=Jm(r),t.elems[s]=Jm(r))}function YO(t,e,n,r,s,i){n=1<<n;for(let o=0;o<t.nelem;o++)(o&e)===e&&o&n&&(tg(A,i),Xm(r,s,i),tg(t.elems[o^n],i),Um(r,s,i),tg(A,i),tg(t.elems[o],i),Um(r,s,i),t.elems[o^n]=Jm(i),t.elems[o]=Jm(i))}function tN(t,e,n,r,s,i){n=1<<n;for(let o=0;o<t.nelem;o++)(o&e)===e&&o&n&&(tg(t.elems[o],i),Xm(r,s,i),t.elems[o]=Jm(i))}function eN(t,e,n,r,s){for(let i=e;i>=0;i--){VO(t,0,i,n,r,s);for(let e=0;e<i;e++){sg(1,2,s),ng(i-e,s),Gd(n,r,s),tg(A,s),tg(JO,s),wm(n,r,s),$m(3,n,r,s),sd(n,r,s);jO(t,Jm(s),1<<e,i,n,r,s)}}for(let n=0;n<(e+1)/2;n++)QO(t,0,n,e-n,s)}function nN(t,e,n,r,s){for(let n=0;n<(e+1)/2;n++)QO(t,0,n,e-n,s);for(let i=0;i<=e;i++){for(let e=i-1;e>=0;e--){sg(1,2,s),ng(i-e,s),Gd(n,r,s),tg(A,s),tg(JO,s),wm(n,r,s),$m(3,n,r,s),Xm(n,r,s),sd(n,r,s);jO(t,Jm(s),1<<e,i,n,r,s)}VO(t,0,i,n,r,s)}}function rN(t,e){return function(t,e){if(!D(t))return At(gs,t);if(l(t))return X(Math.round(t.d));if(Gt(t))return t;const n=Yy(t,e);return l(n)?x(Math.round(n.d)):n}(e.valueOf(Ai(t)),e)}const sN=de(class extends XE{constructor(t){super(Fa,t),this.config=t}get hash(){return Gg}get name(){return"ScriptLast"}transform(t,e){const n=e.getBinding(Fa,kt);try{return me(n,t)}finally{n.release()}}});var iN;class oN extends Cy{constructor(){super("sgn_flt",ys,l),iN.set(this,void 0),Rt(this,iN,nx(this.opr,zg),"f")}get hash(){return Pt(this,iN,"f")}transform1(t,e){return[ne,uN(e)]}}iN=new WeakMap;const aN=new class{create(){return new oN}};function uN(t){return t.d>0?S:0===t.d?_:m}var cN;class lN extends Cy{constructor(){super("sgn_rat",ys,c),cN.set(this,void 0),Rt(this,cN,nx(this.opr,Hg),"f")}get hash(){return Pt(this,cN,"f")}transform1(t,e){return[ne,fN(e)]}}cN=new WeakMap;const hN=new class{create(){return new lN}};function fN(t){const e=Ye(t.a,t.b);return e.isNegative()?Nn:e.isZero()?vn:Dn}function pN(t,e){const n=function(t,e){if(!b(t))return e.iszero(t)||Je("transpose: tensor expected, 1st arg is not a tensor"),_;const{ndim:n}=t,r=new Array(n),s=[n];for(let e=0;e<n;e++)r[e]=x(t.dim(e));return new F(s,r)}(e.valueOf(Ai(t)),e);return n}function dN(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return qw(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}function mN(t,e,n,r){r.push(t),r.rest(),r.head(),wm(e,n,r),function(t,e,n){const r=n.pop();try{if(St(r)){if(O(r))return void n.push(_);throw new Vt(`st(${r})`)}n.push(r)}finally{r.release()}}(0,0,r)}function gN(t,e){return function(n,r){return t(n,r)&&e(n,r)}}function xN(t,e,n){return function(r,s){return No(t)(r)&&e(r.lhs,s)&&n(r.rhs,s)}}const yN=t(e.st);var wN;const EN=gN(_t,xN(Ce,Ty,O));wN=new WeakMap;const vN=de(class extends Cy{constructor(t){super("st_add_2_any_hyp",yN,EN),this.config=t,wN.set(this,void 0),this.phases=ue,Rt(this,wN,rx(yN,Ce),"f")}get hash(){return Pt(this,wN,"f")}transform1(t,e,n,r){const s=e.lhs,i=r.valueOf(At(yN,s));return[ne,i]}});var DN;DN=new WeakMap;const bN=de(class extends Cy{constructor(t){super("st_any",yN,Ty),this.config=t,DN.set(this,void 0),Rt(this,DN,nx(yN,Qg),"f")}get hash(){return Pt(this,DN,"f")}transform1(t,e,n,r){return r.isreal(e)?[ne,e]:[ee,n]}});var AN;AN=new WeakMap;const SN=de(class extends Cy{constructor(t){super("st_hyp",yN,O),this.config=t,AN.set(this,void 0),Rt(this,AN,nx(yN,Wg),"f")}get hash(){return Pt(this,AN,"f")}transform1(t,e,n){return[ne,_]}});var kN;const _N=gN(_t,xN(Ne,c,Ty));kN=new WeakMap;const FN=de(class extends Cy{constructor(t){super("st_mul_2_rat_any",yN,_N),this.config=t,kN.set(this,void 0),this.phases=ue,Rt(this,kN,rx(yN,Ne),"f")}get hash(){return Pt(this,kN,"f")}transform1(t,e,n,r){const s=e.lhs,i=e.rhs,o=r.valueOf(At(t,i)),a=r.valueOf(At(e.opr,s,o));return[ne,a]}});var CN;CN=new WeakMap;const TN=de(class extends Cy{constructor(){super("st_rat",yN,c),CN.set(this,void 0),Rt(this,CN,nx(yN,Qg),"f")}get hash(){return Pt(this,CN,"f")}transform1(t,e){return[ne,e]}});var MN;MN=new WeakMap;const ON=de(class extends Cy{constructor(t){super("st_sym",yN,v),MN.set(this,void 0),Rt(this,MN,nx(yN,Qg),"f")}get hash(){return Pt(this,MN,"f")}transform1(t,e){return[ne,e]}});function NN(t,e){const n=t.argList,r=e.valueOf(n.item(0)),s=e.valueOf(n.item(1)),i=e.valueOf(n.item(2));return e.valueOf(yo(i,s,r,e))}var LN;class BN extends Cy{constructor(){super("succ_any",f("succ"),Ty),LN.set(this,void 0),Rt(this,LN,nx(this.opr,Qg),"f")}get hash(){return Pt(this,LN,"f")}transform1(t,e,n){return[ee,n]}}LN=new WeakMap;const qN=new class{create(){return new BN}};var IN;class PN extends Cy{constructor(){super("succ_rat",f("succ"),c),IN.set(this,void 0),Rt(this,IN,nx(this.opr,Hg),"f")}get hash(){return Pt(this,IN,"f")}transform1(t,e,n){return[ne,e.succ()]}}IN=new WeakMap;const RN=new class{create(){return new PN}};function UN(t,e){const n=function(t,e,n,r,s,i){v(e)||Je("sum: 2nd arg?");const o=hx(n,i);if(isNaN(o))return s;const a=hx(r,i);if(isNaN(a))return s;const u=i.getBinding(e,kt);try{let n=_;for(let r=o;r<=a;r++)i.setBinding(e,x(r)),n=i.add(n,i.valueOf(t));return n}finally{i.setBinding(e,u)}}(I_(t,1),I_(t,2),I_(t,3),I_(t,4),t,e);return n}var $N;const zN=t(e.abs),WN=t(e.add),XN=t(e.multiply),KN=t(e.outer),HN=t(e.pow),JN=t(e.isone),GN=t(e.iszero);function VN(t){if(v(t))return t;throw new Error}$N=new WeakMap;const jN=de(class{constructor(){$N.set(this,qg(VN(f("foo"))))}test(t,e,n){return e.equalsSym(JN)||e.equalsSym(GN),!1}binL(t,n,r,s){switch(n.id){case e.add:if(St(r)){if(T(r))return r;if(v(r))return Ry(WN,t,r,s)}break;case e.multiply:if(St(r)){if(M(r))return Ry(XN,t,r,s);if(T(r))return r;if(l(r))return r.isZero()?r:Ry(XN,co(t,s),r,s);if(O(r))return Ry(XN,t,r,s);if(L(r))return Ry(XN,t,r,s);if(c(r))return r.isOne()?s.valueOf(t):Ry(XN,t,r,s);if(v(r))return Ry(XN,t,r,s);if(b(r))return r.map((e=>Zn(s,t,e)));if(k(r))return Ry(XN,t,r,s)}break;case e.outer:if(St(r)&&v(r))return Ry(KN,t,r,s);break;case e.pow:if(St(r)){if(c(r))return r.isZero()?S:r.isOne()?t:At(HN,t,r);if(l(r))return r.isZero()?S:r.isOne()?t:At(HN,t,r);if(v(r))return At(HN,t,r)}}return kt}binR(t,e,n,r){if(e.equalsSym(XN)&&St(n)){if(O(n))return Ry(XN,n,t,r);if(b(n))return n.map((e=>Zn(r,e,t)));if(k(n))return Ry(XN,n,t,r)}return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:return At(zN,t);case e.grade:{const e=r.head;try{return bo(e,s)?t:_}finally{e.release()}}case e.ascii:return cM(this.toAsciiString(t,s));case e.human:return cM(this.toHumanString(t,s));case e.infix:return cM(this.toInfixString(t,s));case e.latex:return cM(this.toLatexString(t,s));case e.sexpr:return cM(this.toListString(t,s));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Error}get hash(){return Pt(this,$N,"f")}get name(){return"SymExtension"}valueOf(t,e){if(VN(t),Sa(t)&&e.getDirective(ie.evaluatingAsFloat))return Se;const n=e.getBinding(t,kt);return bt(n)||n.equals(t)?t:e.valueOf(n)}isKind(t){return!!v(t)}subst(t,e,n){return v(e)&&t.equals(e)?n:t}toAsciiString(t,e){return e.getSymbolPrintName(t)}toHumanString(t,e){return e.getSymbolPrintName(t)}toInfixString(t,e){return e.getSymbolPrintName(t)}toLatexString(t,e){return e.getSymbolPrintName(t)}toListString(t,e){const n=e.getSymbolPrintName(t);return n||t.key()}toString(){return this.name}evaluate(t,e){throw new Vt}transform(t,e){const n=function(t,e,n){if(n.hasBinding(t,e)){const r=n.getBinding(t,e);return bt(r)||t.equals(r)?[ee,r]:[ne,r]}{const r=n.getBinding(t,e);return t.equals(r)?[ee,r]:[ne,r]}}(t,kt,e);return n}});const QN=de(class{constructor(t){this.config=t}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}test(t,e){throw new Error("Method not implemented.")}iscons(){return!1}operator(){throw new Error}get hash(){return Gg}get name(){return"SymMathAdd"}isKind(t){return!!v(t)&&Ce.equalsSym(t)}subst(t,e,n){return t.equals(e)?n:t}toAsciiString(t,e){return"+"}toHumanString(t,e){return"+"}toInfixString(t,e){return"+"}toLatexString(t,e){return"+"}toListString(t,e){return e.getSymbolPrintName(Ce)}evaluate(t,e,n){return n.transform(Tt(t,e))}transform(t){return v(t)&&Ce.equalsSym(t)?[2,t]:[ee,t]}valueOf(t){return t}});const ZN=de(class{constructor(t){this.config=t}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return cM(this.toAsciiString(t,s));case e.human:return cM(this.toHumanString(t,s));case e.infix:return cM(this.toInfixString(t,s));case e.latex:return cM(this.toLatexString(t,s));case e.sexpr:return cM(this.toListString(t,s))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}test(t,e){throw new Error("Method not implemented.")}iscons(){return!1}operator(){throw new Error}get hash(){return Gg}get name(){return"SymMathMul"}evaluate(t,e,n){return n.transform(Tt(t,e))}transform(t){return[this.isKind(t)?2:ee,t]}isKind(t){return v(t)&&Ne.equals(t)}subst(t,e,n){return t.equals(e)?n:t}toAsciiString(t,e){return e.getSymbolPrintName(Ne)}toHumanString(t,e){return"*"}toInfixString(t,e){return"*"}toLatexString(t,e){return"*"}toListString(t,e){return e.getSymbolPrintName(Ne)}valueOf(t){return I(this.transform(t)[1])}}),YN=t(e.iszero),tL=t(e.multiply),eL=t(e.pow);const nL=de(class{constructor(){}binL(t,e,n,r){if(e.equalsSym(tL)){if(St(n)){if(M(n))return Ry(tL,t,n,r);if(T(n))return n;if(l(n))return X(Math.PI*n.toNumber());if(O(n))return Ry(tL,t,n,r);if(L(n))return Ry(tL,t,n,r);if(c(n))return Ry(tL,t,n,r);if(v(n))return Ry(tL,t,n,r);if(b(n))return n.map((e=>Zn(r,t,e)));if(k(n))return Ry(tL,t,n,r)}}else if(e.equalsSym(eL)&&St(n)&&c(n))return n.isZero()?S:n.isOne()?t:At(eL,t,n);return kt}binR(t,e,n,r){if(e.equalsSym(tL)&&St(n)){if(O(n))return Ry(tL,n,t,r);if(b(n))return n.map((e=>Zn(r,e,t)));if(k(n))return Ry(tL,n,t,r)}return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString());case e.sexpr:return Q(this.toListString(t,s));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}test(t,e){if(e.equalsSym(YN))return!1;throw new Error(`SymMathPi.test ${e} Method not implemented.`)}iscons(){return!1}operator(){throw new Error}get hash(){return Gg}get name(){return"SymMathPi"}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[this.isKind(t)?2:ee,t]}isKind(t){return Sa(t)}subst(t,e,n){return t.equals(e)?n:t}toAsciiString(t,e){return e.getSymbolPrintName(ze)}toHumanString(t,e){return e.getSymbolPrintName(ze)}toInfixString(t,e){return e.getSymbolPrintName(ze)}toLatexString(){return"\\pi"}toListString(t,e){return e.getSymbolPrintName(ze)}valueOf(t){return I(this.transform(t)[1])}}),rL=t(e.pow);const sL=de(class{constructor(t){this.config=t}binL(t,e,n,r){return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.ascii:return Q(this.toAsciiString(t,s));case e.human:return Q(this.toHumanString(t,s));case e.infix:return Q(this.toInfixString(t,s));case e.latex:return Q(this.toLatexString(t,s));case e.sexpr:return Q(this.toListString(t,s))}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}test(t,e){throw new Error("Method not implemented.")}iscons(){return!1}operator(){throw new Error}get hash(){return Gg}get name(){return"SymMathPow"}evaluate(t,e){return this.transform(Tt(t,e))}transform(t){return[this.isKind(t)?2:ee,t]}isKind(t){return v(t)&&rL.equals(t)}subst(t,e,n){return t.equals(e)?n:t}toAsciiString(t,e){return e.getDirective(ie.useCaretForExponentiation)?"^":"**"}toHumanString(t,e){return e.getDirective(ie.useCaretForExponentiation)?"^":"**"}toInfixString(t,e){return e.getDirective(ie.useCaretForExponentiation)?"^":"**"}toLatexString(t,e){return" ^ "}toListString(t,e){return e.getSymbolPrintName(rL)}valueOf(t){return I(this.transform(t)[1])}});var iL;const oL=t(e.symbol);iL=new WeakMap;const aL=de(class extends Fy{constructor(t){super("symbol_varargs",oL),this.config=t,iL.set(this,void 0),Rt(this,iL,sx(this.opr),"f")}get hash(){return Pt(this,iL,"f")}transform(t,e){const n=t.argList,r=e.valueOf(n.head);if(h(r)){const t=n.cdr.head;if(bt(t))return[ne,f(r.str)];if(b(t)){const n=function(t){if(b(t))return t.mapElements((function(t){if(Gn(t))return t.isTrue();if(wh(t))return t.str;throw new Error(`must be a ${Ug} or ${Jg}.`)}));throw new Error("must be a tensor.")}(t),s=f(r.str);return e.setSymbolPredicates(s,function(t){const e={},n=function(t){const e=[],n=t.length/2;for(let r=0;r<n;r++){const n=t[2*r+0],s=t[2*r+1];if("string"!=typeof n)throw new Error;if("boolean"!=typeof s)throw new Error;e.push([n,s])}return e}(t);for(const[t,r]of n)switch(t){case"finite":e.finite=r;break;case"infinite":e.infinite=r;break;default:throw new Error(`Unexpected predicate: ${JSON.stringify(t)}`)}return e}(n)),[ne,s]}throw new Error(`predicates must be a ${Vg}`)}throw new Error(`description must be a ${Jg}`)}});function uL(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{return cL(n,e)}finally{n.release()}}finally{t.release()}}finally{n.release()}}function cL(t,e){if(Ft(t).equals(ur))return Ai(t);if(l(t)){let e=Math.tan(t.d);return Math.abs(e)<1e-10&&(e=0),X(e)}if(io(t))return Yn(e,cL(Yn(e,t),e));const n=function(t,e){const n=Zn(e,t,x(180));try{const t=lo(n,Ze.PI(e),e);try{return jt(t)}finally{t.release()}}finally{n.release()}}(t,e);if(n<0||isNaN(n))return At(bs,t);switch(n%360){case 0:case 180:return _;case 30:case 210:return Zn(e,qn,po(e,An,Bn));case 150:case 330:return Zn(e,Wn(-1,3),po(e,An,Bn));case 45:case 225:return S;case 135:case 315:return m;case 60:case 240:return po(e,An,Bn);case 120:case 300:return Yn(e,po(e,An,Bn));default:return At(bs,t)}}function lL(t,e){return function(t,e){if(Ft(t).equals(cr))return Ai(t);if(l(t)){let e=Math.tanh(t.d);return Math.abs(e)<1e-10&&(e=0),X(e)}if(e.iszero(t))return _;return At(As,t)}(e.valueOf(Ai(t)),e)}const hL=t(e.PI),fL=t(e.tau);function pL(t,e){const n=e.multiply(bn,hL);return e.multiply(n,t)}const dL=de(class extends Cy{constructor(t){super("tau_any",fL,Ty),this.config=t}transform1(t,e,n,r){return[ne,pL(e,r)]}});function mL(t,e){const n=t.argList;try{const r=e.valueOf(t.item(1)),s=n.length>=2?e.valueOf(t.item(2)):kt,i=s.isnil?oi(r):s,o=n.length>=3?e.valueOf(t.item(3)):kt,a=o.isnil?x(24):o,u=n.length>=4?e.valueOf(t.item(4)):kt;return function(t,e,n,r,s){const i=jt(n);if(isNaN(i))return At(Ss,t,e,n,r);const o=s.subtract(e,r);let a=t,u=S,c=s.valueOf(yo(a,e,r,s));for(let t=1;t<=i&&(a=Ww(a,e,s),!s.iszero(a));t++){u=s.multiply(u,o);const n=s.valueOf(yo(a,e,r,s)),i=lo(s.multiply(n,u),hw(x(t)),s);c=s.add(c,i)}return c}(r,i,a,u.isnil?_:u,e)}finally{n.release()}}function gL(t,e){const n=t.argList;try{const t=n.head;try{const n=e.valueOf(t);try{if(_t(n))return f("cons");if(St(n))return f(n.type);if(n.isnil)return f("nil");throw new Vt}finally{n.release()}}finally{t.release()}}finally{n.release()}}function xL(t,e,n,r){tg(Ai(t),r),wm(e,n,r);const s=Jm(r);if(h(s)){const t=s.str;if(function(t){return Mg.has(t)}(t)){tg(Og(t),r)}else hg("")}else hg("")}const yL=t(e.multiply);const wL=de(class{constructor(){}test(){return!1}binL(t,n,r,s){switch(n.id){case e.add:if(St(r)&&k(r)&&t.equals(r)){const e=At(yL,bn,t);try{return s.valueOf(e)}finally{e.release()}}break;case e.multiply:if(St(r)){if(O(r))return Ry(yL,t,r,s);if(b(r))return r.map((e=>Zn(s,t,e)));if(k(r))return s.valueOf(t.mul(r))}break;case e.pow:if(St(r)&&c(r)){const e=r.numer(),n=r.denom(),s=H.valueOf(e.toNumber(),n.toNumber());return t.pow(s)}}return kt}binR(t,e,n,r){return kt}dispatch(t,n,r,s){switch(n.id){case e.abs:return t;case e.ascii:return Q(this.toAsciiString(t));case e.human:return Q(this.toHumanString(t));case e.infix:return Q(this.toInfixString(t));case e.latex:return Q(this.toLatexString(t));case e.sexpr:return Q(this.toListString(t));case e.simplify:return t}return Xt(Kt.Property_0_does_not_exist_on_type_1,n,f(t.type))}iscons(){return!1}operator(){throw new Vt}get hash(){return jg}get name(){return"UomExtension"}get dependencies(){return["Uom"]}valueOf(t){return t}isKind(t){return k(t)}subst(t,e,n){return k(e)&&t.equals(e)?n:t}toAsciiString(t){return t.toInfixString()}toHumanString(t){return t.toInfixString()}toInfixString(t){return t.isOne()?"1":t.toInfixString()}toLatexString(t){return t.toInfixString()}toListString(t){return t.toString(10,!1)}toString(){return this.name}evaluate(t,e){throw new Vt}transform(t){return t.isOne()?[ne,x(1)]:[2,t]}});function EL(t,e){return function(t,e){const n=Array(ti).fill(0);let r=1,s=0;for(const i of t.tail()){const t=hx(i,e);if(t<1||isNaN(t))return vn;r*=t,n[s++]=t}if(0===s)return vn;const i=new Array(s);for(let t=0;t<s;t++)i[t]=n[t];const o=Sx(r,vn);return new F(i,o)}(t,e)}function vL(t,e){return function(t){const e=jt(t);(e<1||e>Ys)&&Je("prime: Argument out of range.");const n=ei[e-1];return x(n)}(e.valueOf(t.argList.head))}function DL(t,e){const n=e.valueOf(Ai(t));return n.contains(A)?wo(n,e):e.clock(wo(e.polar(n),e))}function bL(t,e){let n=0;if(!di(t))return 0;if(e.equals(Ai(t),A))return Sa(_i(t))?3!==ai(t)?0:2:0;if(!D(Ai(t)))return 0;if(!e.equals(_i(t),A))return 0;if(!Sa(Ti(t)))return 0;if(4!==ai(t))return 0;let r=jt(e.multiply(Ai(t),bn));if(isNaN(r))return 0;switch(r<1&&(n=1,r=-r),r%4){case 0:r=1;break;case 1:r=n?4:3;break;case 2:r=2;break;case 3:r=n?3:4}return r}function AL(t,e,n){const r=ai(e)-1,s=[];let i=Ct(e);for(let e=0;e<r;e++){for(let r=0;r<=t;r++)s[e*(t+1)+r]=n.power(Ft(i),x(r));i=Ct(i)}const o=[];for(let t=0;t<r;t++)o[t]=0;return SL(r,t,o,0,t,s,hw(x(t)),_,n)}function SL(t,e,n,r,s,i,o,a,u){if(r<t-1){for(let c=0;c<=s;c++)n[r]=c,a=SL(t,e,n,r+1,s-c,i,o,a,u);return a}n[r]=s;let c=o;for(let e=0;e<t;e++)c=lo(c,hw(x(n[e])),u);for(let r=0;r<t;r++)c=u.multiply(c,i[r*(e+1)+n[r]]);return u.add(a,c)}function kL(t){const e=ai(t)-1,n=[];let r=Ct(t);for(let t=0;t<e;t++)n.push(Ft(r)),r=Ct(r);return n}function _L(n,r){return At(t(e.pow),n,r)}const FL=t(e.pow);function CL(t,e,n){const r=[],s=t.length,i=e.length;for(let o=0;o<s;o++)for(let s=0;s<i;s++){const i=n.multiply(t[o],e[s]);r.push(i)}return r}function TL(r,s,i){if(null==r)throw new Vt("base must be defined.");if(null==s)throw new Vt("expo must be defined.");if(bt(r))throw new Vt("base MUST be something.");if(bt(s))throw new Vt("expo MUST be something.");const o=function(t,e){return t};if(St(r)&&St(s)){const t=i.extensionFor(r),e=i.extensionFor(s),n=t.binL(r,FL,s,i);if(bt(n)){const t=e.binR(s,FL,r,i);if(bt(t)){return o(Xt(Kt.Operator_0_cannot_be_applied_to_types_1_and_2,FL,f(r.type),f(s.type)))}return o(t)}return o(n)}if(jn(r,i)||bo(s,i)){return o(i.getDirective(ie.evaluatingAsFloat)?be:S)}if(i.equals(s,S))return o(r);if(Li(r)&&Li(s)){return o(i.negate(i.getDirective(ie.evaluatingAsFloat)?be:S))}if(Li(r)&&ji(s))return i.getDirective(ie.complexAsClock)?At(FL,r,s):o(A);if(Li(r)&&Qi(s)){if(i.getDirective(ie.complexAsClock))return At(FL,r,s);return o(i.negate(A))}if(Li(r)&&!l(r)&&c(s)&&!Gt(s)&&Oi(s)&&!i.getDirective(ie.evaluatingAsFloat)){if(s.numer().compare(s.denom())<0)return o(At(FL,r,s));{const t=At(ss,r,At(FL,r,Wn(s.a.mod(s.b),s.b)));return o(i.valueOf(t))}}if(c(r)&&c(s)){return o(AO(r,s,i))}if(D(r)&&D(s)){const t=function(t,e,n){if(0===t&&e<0)return Xt(Kt.Division_by_zero);if(t>=0||e%1==0)return X(Math.pow(t,e));const r=Math.pow(Math.abs(t),e),s=Math.PI*e;let i=0,o=0;return e%.5==0?(i=0,o=Math.sin(s)):(i=Math.cos(s),o=Math.sin(s)),ao(n,X(i*r),Zn(n,X(o*r),A))}(Xn(r),Xn(s),i);return o(t)}if(b(r)){return o(Fx(r,s,i))}if(M(r)&&c(s)&&s.isMinusOne()){const t=r.rev();return o(i.divide(t,i.multiply(r,t)))}if(k(r)){if(c(s)){const t=H.valueOf(s.a.toJSNumber(),s.b.toJSNumber());return o(r.pow(t))}if(l(s)&&s.isInteger()){const t=H.valueOf(s.d,1);return o(r.pow(t))}}if(_t(r)&&fi(r)&&Hi(s)){const t=r.argList.head;if(i.isreal(t)){return o(i.power(t,s))}}if(_a(r)&&Ft(s).equals(rs)){return o(Ai(s))}if(_a(r)&&l(s)){return o(X(Math.exp(s.d)))}if(_a(r)){const t=new du;return Zm(s,i,i,t),o(t.pop())}if(di(r)){const t=r.argList;if(_t(t)){const e=t.car;let n=i.power(e,s);if(_t(t)){n=t.tail().reduce(((t,e)=>i.multiply(t,i.power(e,s))),n)}return o(n)}return o(S)}if(mi(r)){const t=r.base,e=r.expo,n=s;if(i.ispositive(t)){const r=Qe(to,e,n,i);return o(i.valueOf(_L(t,r)))}if(c(e)&&e.isNegative()&&e.isInteger()&&c(n)&&n.isNegative()&&n.isInteger()){const r=e.mul(n);return o(i.valueOf(_L(t,r)))}}if(i.getDirective(ie.expandPowSum)&&_t(r)&&v(r.opr)&&n(r.opr,e.add)&&D(s)&&function(t){if(c(t))return!(!Gt(t)||!Jt(t.a));if(l(t))return Math.floor(t.d)===t.d;throw new Error}(s))if(s.isOne());else if(s.isMinusOne());else if(s.isZero());else if(s.isPositive()){const n=kL(r);if(n.every((t=>i.isreal(t)))){return o(AL(jt(s),r,i))}if(c(s)&&s.isInteger()){let r=s,a=[S];for(;r.isNonNegativeInteger();)a=CL(a,n,i),r=r.pred();return o(i.valueOf(At(t(e.add),...a)))}}else if(s.isNegative()){if(kL(r).every(i.isreal)){const t=jt(s);return o(i.divide(S,AL(-t,r,i)))}}if(i.getDirective(ie.convertSinToCos)&&_t(r)&&Ft(r).equals(ws)&&Hi(s)){const t=r.argList.head,e=i.multiply(s,Bn);return o(i.power(i.subtract(S,i.power(i.cos(t),bn)),e))}if(i.getDirective(ie.convertCosToSin)&&_t(r)&&Ft(r).equals(Dr)&&Hi(s)){const t=r.argList.head,e=i.multiply(s,Bn);return o(i.power(i.subtract(S,i.power(i.sin(t),bn)),e))}if(Ki(r)){if(Gt(s)){const t=wo(r,i);let e=lo(t,i.multiply(t,r),i);return Bi(s,i)||(e=i.power(e,i.negate(s))),o(e)}if(D(s)){const t=i.getDirective(ie.evaluatingAsFloat)||function(t,e){return pi(t)&&3===ai(t)&&l(Ai(t))&&Wi(_i(t),e)||Wi(t,e)}(r,i)&&l(s)?X(Math.PI):ze;let e=i.multiply(i.power(i.abs(r),s),i.power(m,i.divide(i.multiply(i.arg(r),s),t)));return e.contains(ur)&&(e=At(FL,r,s)),o(e)}}const a=function(t,e){let n=bL(t,e);switch(n){case 0:break;case 1:return S;case 2:return m;case 3:return A;case 4:return e.negate(A)}if(pi(t)){let r,s=Ct(t);for(;_t(s)&&(n=bL(Ft(s),e),!n);)s=Ct(s);switch(n){case 0:return;case 1:r=S;break;case 2:r=m;break;case 3:r=A;break;case 4:r=e.negate(A)}return e.multiply(r,e.exp(e.subtract(t,Ft(s))))}}(s,i);return void 0!==a?o(a):function(t,e){return!!function(t,e){return c(e)&&e.isMinusOne()}(0,e)&&io(t)}(r,s)?o(i.negate(i.power(i.negate(r),s))):o(At(FL,r,s))}function ML(n,r){const s=n.base,i=n.expo;if(bt(s))throw new Vt("base MUST be something.");if(bt(i))throw new Vt("expo MUST be something.");try{const n=r.valueOf(i),o=r.valueOf(s);try{return o.equals(s)&&n.equals(i)?TL(o,n,r):r.valueOf(At(t(e.pow),o,n))}finally{o.release(),n.release()}}finally{s.release(),i.release()}}function OL(n,r){const s=t(e.add),i=t(e.inner),o=t(e.lco),a=t(e.multiply),u=t(e.outer),c=t(e.rco),l=t(e.cos),h=t(e.exp),p=t(e.factorial),d=t(e.filter),m=t(e.leading),g=t(e.lookup),x=t(e.prime),y=t(e.test);n.setSymbolOrder(s,new kv),n.setSymbolOrder(a,new bv),n.setSymbolOrder(u,new bv),n.defineExtension(AD),n.defineEvalFunction(s,kD),n.defineEvalFunction(t(e.pow),ML),n.defineExtension(hA(a,s)),n.defineExtension(fA(a,s)),n.defineExtension(FM),n.defineExtension(OM),n.defineEvalFunction(a,yM),n.defineEvalFunction(rr,vv),n.defineExtension(jD),n.defineEvalFunction(dr,ob),n.defineEvalFunction(mr,Cv),n.defineEvalFunction(gr,Mv),n.defineKeyword(xr,Tv),n.defineEvalFunction(t(e.conj),DL),n.defineEvalFunction(t(e.deg),cD),n.defineKeyword(Pr,(function(t){const e=t.getBinding(Fa,kt),n=t.factor(e);t.setBinding(Fa,n);const r=uO(n,t.getDirective(ie.printMode),t);t.getPrintHandler().print(r),cO(r,Pa(t.getDirective(ie.printMode)),t)})),n.defineEvalFunction(d,To),n.defineExtension(M_),n.defineExtension(L_),n.defineExtension(R_),n.defineStackFunction(t(e.infix),uD),n.defineExtension(hA(i,s)),n.defineExtension(fA(i,s)),n.defineExtension(DF),n.defineExtension(_F),n.defineExtension(CF),n.defineExtension(SF),n.defineExtension(EF),n.defineExtension(yF),n.defineExtension(gF),n.defineExtension(NF),n.defineExtension(LF),n.defineExtension(dF),n.defineExtension(MF),n.defineExtension(fF),n.defineExtension(lF),n.defineExtension(uF),n.defineExtension(oF),n.defineStackFunction(t(e.kronecker),vd),n.defineExtension(HT),n.defineExtension(VT),n.defineEvalFunction(m,fD),n.defineExtension(tM),n.defineExtension(hA(o,s)),n.defineExtension(fA(o,s)),n.defineExtension(QT),n.defineExtension(iM),n.defineExtension(uM),n.defineStackFunction(t(e.log),bd),n.defineStackFunction(t(e.mag),Oh),n.defineEvalFunction(g,pD),n.defineStackFunction(t(e.mod),Cd),n.defineStackFunction(t(e.noexpand),Od),n.defineExtension(KM),n.defineExtension(rO),n.defineExtension(hA(u,s)),n.defineExtension(fA(u,s)),n.defineExtension(QM),n.defineExtension(GM),n.defineExtension(tO),n.defineStackFunction(u,Wd),n.defineEvalFunction(x,vL),n.defineEvalFunction(ps,EO),n.defineStackFunction(ps,Vd),n.defineExtension(UO),n.defineExtension(hA(c,s)),n.defineExtension(fA(c,s)),n.defineExtension(zO),n.defineExtension(PO),n.defineExtension(BO),n.defineExtension(ZD),n.defineExtension(NO),n.defineExtension(S_),n.defineExtension(Ux),n.defineExtension(FE),n.defineExtension(pM),n.defineEvalFunction(t(e.abs),DD),n.defineEvalFunction(t(e.adj),MD),n.defineExtension(BD),n.defineEvalFunction(nr,$M),n.defineStackFunction(t(e.arccos),_p),n.defineStackFunction(t(e.arccosh),Cp),n.defineStackFunction(t(e.arcsin),Mp),n.defineStackFunction(t(e.arcsinh),Np),n.defineStackFunction(t(e.arctan),Bp),n.defineStackFunction(t(e.arctanh),Ip),n.defineStackFunction(t(e.arg),Rp),n.defineExtension(ID),n.defineExtension(DE),n.defineExtension(zD),n.defineExtension(XO),n.defineExtension(XD),n.defineExtension(HD),n.defineStackFunction(t(e.binding),zp),n.defineExtension(eb),n.defineExtension(nb),n.defineExtension(tb),n.defineStackFunction(t(e.circexp),Wp),n.defineStackFunction(t(e.clock),Hp),n.defineExtension(cb),n.defineEvalFunction(t(e.coefficients),lb),n.defineEvalFunction(t(e.cofactor),fx),n.defineExtension(pb),n.defineExtension(mb),n.defineExtension(Db),n.defineStackFunction(t(e.cos),jp),n.defineStackFunction(t(e.cosh),Zp),n.defineExtension(Fb),n.defineExtension(hA(bb,s)),n.defineExtension(fA(bb,s)),n.defineExtension(Ab),n.defineExtension(Mb),n.defineExtension(Ib),n.defineExtension(Bb),n.defineEvalFunction(t(e.defint),Pb),n.defineEvalFunction(t(e.denominator),zb),n.defineExtension($b),n.defineExtension(Xb),r.useDerivativeShorthandLowerD&&n.defineExtension(Kb),n.defineEvalFunction(t(e.derivative),Qw),n.defineEvalFunction(t(e.det),Jb),n.defineExtension(SE),n.defineEvalFunction(f("differential"),Yb),n.defineExtension(eA),n.defineExtension(rA),n.defineEvalFunction(f("divisors"),pA),n.defineExtension(dA),n.defineEvalFunction(Cr,tF),n.defineEvalFunction(t(e.draw),Fk),n.defineExtension(Wk),n.defineExtension(Rk),n.defineExtension($k),n.defineExtension(Hk),n.defineExtension(Gk),n.defineStackFunction(f("error"),t_),n.defineExtension(n_),n.defineStackFunction(t(e.exp),rd),n.defineExtension(l_),n.defineStackFunction(t(e.expcos),id),n.defineStackFunction(t(e.expcosh),od),n.defineStackFunction(t(e.expsin),ad),n.defineStackFunction(t(e.expsinh),ud),n.defineStackFunction(t(e.exptan),cd),n.defineStackFunction(t(e.exptanh),ld),n.defineExtension(d_),n.defineExtension(g_),n.defineExtension(y_),n.defineStackFunction(t(e.floor),pd),n.defineExtension(__),n.defineEvalFunction(t(e.grade),q_),n.defineStackFunction(t(e.hadamard),_h),n.defineEvalFunction(t(e.hilbert),U_),n.defineStackFunction(t(e.imag),md),n.defineStackFunction(t(e.component),xd),n.defineExtension(H_),n.defineExtension(qF),n.defineExtension(zF),n.defineExtension(PF),n.defineStackFunction(t(e.inv),Ed),n.defineExtension(GF),n.defineExtension(KF),n.defineExtension(eC),n.defineExtension(iC),n.defineExtension(uC),n.defineExtension(hC),n.defineExtension(ZF),n.defineEvalFunction(t(e.isone),pC),n.defineExtension(wC),n.defineExtension(DC),n.defineExtension(SC),n.defineExtension(FC),n.defineExtension(gC),n.defineExtension(MC),n.defineExtension(IC),n.defineExtension(UC),n.defineExtension(JC(l)),n.defineExtension(JC(h)),n.defineExtension(JC(p)),n.defineExtension(GC),n.defineExtension(jC),n.defineExtension(QC),n.defineExtension(tT),n.defineExtension(rT),n.defineExtension(oT),n.defineExtension(pT),n.defineExtension(gT),n.defineExtension(cT),n.defineExtension(LC),n.defineExtension(wT),n.defineExtension(ET),n.defineExtension(DT),n.defineExtension(new AT(ms)),n.defineExtension(zC),n.defineExtension(MT),n.defineExtension(LT),n.defineExtension(IT),n.defineExtension(UT),n.defineExtension(FT),n.defineStackFunction(t(e.minor),kd),n.defineStackFunction(t(e.minormatrix),_d),n.defineEvalFunction(t(e.not),UM),n.defineEvalFunction(t(e.numerator),Da),n.defineStackFunction(t(e.nroots),qd),n.defineExtension(WM),n.defineExtension(aO),n.defineExtension(iO),n.defineStackFunction(t(e.polar),Hd),n.defineExtension(gO("print",(()=>n.getDirective(ie.printMode)))),n.defineExtension(gO("printascii",(()=>Ke.Ascii))),n.defineExtension(gO("printhuman",(()=>Ke.Human))),n.defineExtension(gO("printinfix",(()=>Ke.Infix))),n.defineExtension(gO("printlatex",(()=>Ke.LaTeX))),n.defineExtension(gO("printsexpr",(()=>Ke.SExpr))),n.defineExtension(fO("print",(()=>n.getDirective(ie.printMode)))),n.defineExtension(fO("printascii",(()=>Ke.Ascii))),n.defineExtension(fO("printhuman",(()=>Ke.Human))),n.defineExtension(fO("printinfix",(()=>Ke.Infix))),n.defineExtension(fO("printlatex",(()=>Ke.LaTeX))),n.defineExtension(fO("printsexpr",(()=>Ke.SExpr))),n.defineExtension(yO),n.defineEvalFunction(fs,wO),n.defineEvalFunction(t(e.quotient),zo),n.defineStackFunction(t(e.rationalize),jd),n.defineStackFunction(t(e.real),Zd),n.defineStackFunction(t(e.rect),tm),n.defineExtension(HO),n.defineEvalFunction(t(e.roots),rw),n.defineEvalFunction(t(e.round),rN),n.defineStackFunction(t(e.rotate),GO),n.defineExtension(sN),n.defineExtension(aN),n.defineExtension(hN),n.defineExtension(Ny),n.defineEvalFunction(t(e.shape),pN),n.defineEvalFunction(t(e.simplify),dN),n.defineStackFunction(t(e.sin),rm),n.defineStackFunction(t(e.sinh),im),n.defineExtension(RN),n.defineExtension(qN),n.defineStackFunction(t(e.sqrt),am),n.defineExtension(bN),n.defineExtension(vN),n.defineExtension(FN),n.defineExtension(TN),n.defineExtension(ON),n.defineExtension(SN),n.defineStackFunction(t(e.st),mN),n.defineEvalFunction(t(e.subst),NN),n.defineEvalFunction(t(e.sum),UN),n.defineExtension(aL),n.defineEvalFunction(t(e.taylor),mL),n.defineEvalFunction(t(e.tan),uL),n.defineEvalFunction(t(e.tanh),lL),n.defineExtension(dL),n.defineEvalFunction(t(e.typeof),gL),n.defineEvalFunction(y,qM),n.defineEvalFunction(t(e.testeq),PM),n.defineEvalFunction(t(e.testle),RM),n.defineStackFunction(t(e.testlt),pm),n.defineStackFunction(t(e.testge),hm),n.defineStackFunction(t(e.testgt),fm),n.defineEvalFunction(t(e.testne),IM),n.defineStackFunction(t(e.transpose),mm),n.defineExtension(QN),n.defineExtension(ZN),n.defineExtension(sL),n.defineExtension(nL),n.defineExtension(jN),n.defineExtension(wx),n.defineExtension(Vy),n.defineExtension(UD),n.defineExtension(wL),n.defineExtension(W_),n.defineExtension(Yk),n.defineExtension(Y_),n.defineExtension(zT),n.defineExtension(JT),n.defineExtension(Zb),n.defineStackFunction(t(e.unit),xm),n.defineStackFunction(Ns,xL),n.defineEvalFunction(t(e.zero),EL),n.defineExtension(NM),n.defineExtension(wb)}function NL(t,e={}){const n=function(t){return t?{useCaretForExponentiation:!!t.useCaretForExponentiation,useParenForTensors:!!t.useParenForTensors,explicitAssocAdd:!!t.explicitAssocAdd,explicitAssocExt:!!t.explicitAssocExt,explicitAssocMul:!!t.explicitAssocMul}:{useCaretForExponentiation:!1,useParenForTensors:!1,explicitAssocAdd:!1,explicitAssocExt:!1,explicitAssocMul:!1}}(e),r=function(t){let e=t;return e=e.replace(new RegExp(String.fromCharCode(8901),"g"),ri),e=e.replace(new RegExp(String.fromCharCode(8226),"g"),ri),e=e.replace(new RegExp(String.fromCharCode(12539),"g"),ri),e=e.replace(new RegExp(String.fromCharCode(55296),"g"),ri),e=e.replace(new RegExp(String.fromCharCode(65381),"g"),ri),e}(t);let s,i=0,o=0;const a=[],u=[];for(;;){if(e.catchExceptions)try{[i,s]=LL(r,o,n)}catch(t){t instanceof Error?u.push(t):u.push(new Error(`${t}`)),Ge(0);break}else[i,s]=LL(r,o,n);if(i>0&&a.push(s),0===i)break;if(i===t.length)break;o+=i}return{trees:a,errors:u}}function LL(t,e,n){return ll(t.substring(e),e,{useCaretForExponentiation:n.useCaretForExponentiation,useParenForTensors:n.useParenForTensors,explicitAssocAdd:n.explicitAssocAdd,explicitAssocExt:n.explicitAssocExt,explicitAssocMul:n.explicitAssocMul})}function BL(t,e){if(!t)throw new Error("ASSERT: "+e)}const qL={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",ArrowParameterPlaceHolder:"ArrowParameterPlaceholder",AwaitExpression:"AwaitExpression",BlockComment:"BlockComment",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Import:"Import",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",LineComment:"LineComment",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};function IL(t){return WL(t)||jL(t)||TB(t)||JB(t)||VB(t)||YB(t)||oq(t)}function PL(t){return function(t){return t.every(IL)}(t)?t:t.map((t=>function(t){if(IL(t))return t;throw new Error(`assert_function_parameter ${t.type}`)}(t)))}class RL{type;leadingComments;trailingComments;innerComments;range;loc;constructor(t){this.type=t}}class UL extends RL{elements;constructor(t){super(qL.ArrayExpression),this.elements=t,BL($L(this),this.type)}}function $L(t){return t.type===qL.ArrayExpression}class zL extends RL{elements;constructor(t){super(qL.ArrayPattern),this.elements=t,BL(WL(this),this.type)}}function WL(t){return t.type===qL.ArrayPattern}class XL extends RL{id;params;body;generator;expression;async;constructor(t,e,n){super(qL.ArrowFunctionExpression),this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=n,this.async=!1,BL(this.type===qL.ArrowFunctionExpression,this.type)}}class KL extends RL{params;async;constructor(t,e){super(qL.ArrowParameterPlaceHolder),this.params=t,this.async=e,BL(HL(this),this.type)}}function HL(t){return t.type===qL.ArrowParameterPlaceHolder}class JL extends RL{operator;left;right;constructor(t,e,n){super(qL.AssignmentExpression),this.operator=t,this.left=e,this.right=n,BL(GL(this),this.type)}}function GL(t){return t.type===qL.AssignmentExpression}class VL extends RL{left;right;constructor(t,e){super(qL.AssignmentPattern),this.left=t,this.right=e,BL(jL(this),this.type)}}function jL(t){return t.type===qL.AssignmentPattern}class QL{type;id;params;body;generator;expression;async;constructor(t,e,n){this.type=qL.ArrowFunctionExpression,this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=n,this.async=!0}}class ZL{type;id;params;body;generator;expression;async;constructor(t,e,n,r){this.type=qL.FunctionDeclaration,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!0}}class YL{type;argument;constructor(t){this.type=qL.AwaitExpression,this.argument=t}}class tB extends RL{operator;left;right;constructor(t,e,n){super(function(t){return function(t){return"||"===t||"&&"===t||"??"===t}(t)?qL.LogicalExpression:qL.BinaryExpression}(t)),this.operator=t,this.left=e,this.right=n,BL(eB(this),this.type)}}function eB(t){return t.type===qL.BinaryExpression||t.type===qL.LogicalExpression}class nB extends RL{body;constructor(t){super(qL.BlockStatement),this.body=t,BL(rB(this),this.type)}}function rB(t){return t.type===qL.BlockStatement}let sB=class extends RL{label;constructor(t){super(qL.BreakStatement),this.label=t,BL(this.type===qL.BreakStatement,this.type)}};class iB extends RL{callee;arguments;optional;constructor(t,e,n){super(qL.CallExpression),this.callee=t,this.arguments=e,this.optional=n,BL(oB(this),this.type)}}function oB(t){return t.type===qL.CallExpression}class aB{type;param;body;constructor(t,e){this.type=qL.CatchClause,this.param=t,this.body=e}}class uB{type;expression;constructor(t){this.type=qL.ChainExpression,this.expression=t}}class cB{type;body;constructor(t){this.type=qL.ClassBody,this.body=t}}class lB{type;id;superClass;body;constructor(t,e,n){this.type=qL.ClassDeclaration,this.id=t,this.superClass=e,this.body=n}}class hB{type;id;superClass;body;constructor(t,e,n){this.type=qL.ClassExpression,this.id=t,this.superClass=e,this.body=n}}class fB{type;test;consequent;alternate;constructor(t,e,n){this.type=qL.ConditionalExpression,this.test=t,this.consequent=e,this.alternate=n}}let pB=class{type;label;constructor(t){this.type=qL.ContinueStatement,this.label=t}};class dB{type;constructor(){this.type=qL.DebuggerStatement}}class mB{type;expression;directive;constructor(t,e){this.type=qL.ExpressionStatement,this.expression=t,this.directive=e}}class gB{type;body;test;constructor(t,e){this.type=qL.DoWhileStatement,this.body=t,this.test=e}}class xB{type;constructor(){this.type=qL.EmptyStatement}}class yB{type;source;constructor(t){this.type=qL.ExportAllDeclaration,this.source=t}}class wB{type;declaration;constructor(t){this.type=qL.ExportDefaultDeclaration,this.declaration=t}}class EB{type;declaration;specifiers;source;constructor(t,e,n){this.type=qL.ExportNamedDeclaration,this.declaration=t,this.specifiers=e,this.source=n}}class vB{type;exported;local;constructor(t,e){this.type=qL.ExportSpecifier,this.exported=e,this.local=t}}let DB=class extends RL{expression;constructor(t){super(qL.ExpressionStatement),this.expression=t,BL(bB(this),this.type)}};function bB(t){return t.type===qL.ExpressionStatement}class AB{type;left;right;body;each;constructor(t,e,n){this.type=qL.ForInStatement,this.left=t,this.right=e,this.body=n,this.each=!1}}class SB{type;await;left;right;body;constructor(t,e,n,r){this.type=qL.ForOfStatement,this.await=r,this.left=t,this.right=e,this.body=n}}let kB=class{type;init;test;update;body;constructor(t,e,n,r){this.type=qL.ForStatement,this.init=t,this.test=e,this.update=n,this.body=r}};class _B extends RL{id;params;body;generator;expression;async;constructor(t,e,n,r){super(qL.FunctionDeclaration),this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!1,BL(this.type===qL.FunctionDeclaration,this.type)}}class FB extends RL{id;params;body;generator;expression;async;constructor(t,e,n,r,s){super(qL.FunctionExpression),this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=s,BL(this.type===qL.FunctionExpression,this.type)}}class CB extends RL{name;constructor(t){super(qL.Identifier),this.name=t,BL(TB(this),this.type)}}function TB(t){return t.type===qL.Identifier}let MB=class{type;test;consequent;alternate;constructor(t,e,n){this.type=qL.IfStatement,this.test=t,this.consequent=e,this.alternate=n}};class OB{type;constructor(){this.type=qL.Import}}class NB{type;specifiers;source;constructor(t,e){this.type=qL.ImportDeclaration,this.specifiers=t,this.source=e}}class LB{type;local;constructor(t){this.type=qL.ImportDefaultSpecifier,this.local=t}}class BB{type;local;constructor(t){this.type=qL.ImportNamespaceSpecifier,this.local=t}}class qB{type;local;imported;constructor(t,e){this.type=qL.ImportSpecifier,this.local=t,this.imported=e}}class IB extends RL{label;body;constructor(t,e){super(qL.LabeledStatement),this.label=t,this.body=e,BL(this.type===qL.LabeledStatement,this.type)}}class PB extends RL{value;raw;constructor(t,e){super(qL.Literal),this.value=t,this.raw=e,BL(RB(this),this.type)}}function RB(t){return t.type===qL.Literal}class UB extends RL{computed;object;property;optional;constructor(t,e,n,r){super(qL.MemberExpression),this.computed=r,this.object=t,this.property=e,this.optional=n,BL($B(this),this.type)}}function $B(t){return t.type===qL.MemberExpression}class zB{type;meta;property;constructor(t,e){this.type=qL.MetaProperty,this.meta=t,this.property=e}}class WB extends RL{key;computed;value;kind;static;constructor(t,e,n,r,s){super(qL.MethodDefinition),this.key=t,this.computed=e,this.value=n,this.kind=r,this.static=s,BL(this.type===qL.MethodDefinition,this.type)}}let XB=class extends RL{body;sourceType;comments;tokens;errors;constructor(t){var e;super(qL.Program),this.body=t,this.sourceType="module",BL(!!nq(e=this)&&"module"===e.sourceType,this.type)}};class KB{type;callee;arguments;constructor(t,e){this.type=qL.NewExpression,this.callee=t,this.arguments=e}}class HB extends RL{properties;constructor(t){super(qL.ObjectExpression),this.properties=t,BL(JB(this),this.type)}}function JB(t){return t.type===qL.ObjectExpression}class GB extends RL{properties;constructor(t){super(qL.ObjectPattern),this.properties=t,BL(VB(this),this.type)}}function VB(t){return t.type===qL.ObjectPattern}class jB extends RL{key;computed;value;kind;method;shorthand;constructor(t,e,n,r,s,i){super(qL.Property),this.key=e,this.computed=n,this.value=r,this.kind=t,this.method=s,this.shorthand=i,BL(this.type===qL.Property,this.type)}}class QB{type;value;raw;regex;constructor(t,e,n,r){this.type=qL.Literal,this.value=t,this.raw=e,this.regex={pattern:n,flags:r}}}class ZB extends RL{argument;constructor(t){super(qL.RestElement),this.argument=t,BL(YB(this),this.type)}}function YB(t){return t.type===qL.RestElement}let tq=class extends RL{argument;constructor(t){super(qL.ReturnStatement),this.argument=t,BL(this.type===qL.ReturnStatement,this.type)}};class eq extends RL{body;sourceType;comments;tokens;errors;constructor(t){var e;super(qL.Program),this.body=t,this.sourceType="script",BL(nq(e=this)&&"script"===e.sourceType,this.type)}}function nq(t){return t.type===qL.Program}class rq extends RL{expressions;constructor(t){super(qL.SequenceExpression),this.expressions=t,BL(sq(this),this.type)}}function sq(t){return t.type===qL.SequenceExpression}class iq extends RL{argument;constructor(t){super(qL.SpreadElement),this.argument=t,BL(oq(this),this.type)}}function oq(t){return t.type===qL.SpreadElement}class aq{type;constructor(){this.type=qL.Super}}class uq{type;test;consequent;constructor(t,e){this.type=qL.SwitchCase,this.test=t,this.consequent=e}}class cq{type;discriminant;cases;constructor(t,e){this.type=qL.SwitchStatement,this.discriminant=t,this.cases=e}}class lq{type;tag;quasi;constructor(t,e){this.type=qL.TaggedTemplateExpression,this.tag=t,this.quasi=e}}class hq{type;value;tail;constructor(t,e){this.type=qL.TemplateElement,this.value=t,this.tail=e}}class fq{type;quasis;expressions;constructor(t,e){this.type=qL.TemplateLiteral,this.quasis=t,this.expressions=e}}class pq extends RL{constructor(){super(qL.ThisExpression),BL(this.type===qL.ThisExpression,this.type)}}class dq{type;argument;constructor(t){this.type=qL.ThrowStatement,this.argument=t}}class mq{type;block;handler;finalizer;constructor(t,e,n){this.type=qL.TryStatement,this.block=t,this.handler=e,this.finalizer=n}}class gq extends RL{operator;argument;prefix;constructor(t,e){super(qL.UnaryExpression),this.operator=t,this.argument=e,this.prefix=!0,BL(xq(this),this.type)}}function xq(t){return t.type===qL.UnaryExpression}class yq extends RL{operator;argument;prefix;constructor(t,e,n){super(qL.UpdateExpression),this.operator=t,this.argument=e,this.prefix=n,BL(this.type===qL.UpdateExpression,this.type)}}class wq extends RL{declarations;kind;constructor(t,e){super(qL.VariableDeclaration),this.declarations=t,this.kind=e,BL(Eq(this),this.type)}}function Eq(t){return t.type===qL.VariableDeclaration}class vq extends RL{id;init;constructor(t,e){super(qL.VariableDeclarator),this.id=t,this.init=e,BL(Dq(this),this.type)}}function Dq(t){return t.type===qL.VariableDeclarator}let bq=class{type;test;body;constructor(t,e){this.type=qL.WhileStatement,this.test=t,this.body=e}},Aq=class{type;object;body;constructor(t,e){this.type=qL.WithStatement,this.object=t,this.body=e}};class Sq extends RL{argument;delegate;constructor(t,e){super(qL.YieldExpression),this.argument=t,this.delegate=e,BL(kq(this),this.type)}}function kq(t){return t.type===qL.YieldExpression}class _q{errors;tolerant;constructor(){this.errors=[],this.tolerant=!1}recordError(t){this.errors.push(t)}tolerate(t){if(!this.tolerant)throw t;this.recordError(t)}constructError(t,e){let n=new Error(t);try{throw n}catch(t){Object.create&&Object.defineProperty&&(n=Object.create(t),Object.defineProperty(n,"column",{value:e}))}return n}createError(t,e,n,r){const s="Line "+e+": "+r,i=this.constructError(s,n);return i.index=t,i.lineNumber=e,i.description=r,i}throwError(t,e,n,r){throw this.createError(t,e,n,r)}tolerateError(t,e,n,r){const s=this.createError(t,e,n,r);if(!this.tolerant)throw s;this.recordError(s)}}const Fq="Async functions can only be declared at the top level or inside a block.",Cq="Unexpected token",Tq="Getter must not have any formal parameters",Mq="Setter must have exactly one formal parameter",Oq="Setter function argument must not be a rest parameter",Nq="Cannot use 'import.meta' outside a module",Lq="Class constructor may not be an async method",Bq="Class constructor may not be an accessor",qq="Missing initializer in %0 declaration",Iq="Unexpected token =",Pq="Unexpected token =",Rq="Duplicate binding %0",Uq="A class may only have one constructor",$q="Duplicate parameter name not allowed in this context",zq="Duplicate __proto__ fields are not allowed in object literals",Wq="%0 loop variable declaration may not have an initializer",Xq="Generator declarations are not allowed in legacy contexts",Kq="Illegal break statement",Hq="Illegal continue statement",Jq="Unexpected token",Gq="Unexpected token",Vq="Illegal 'use strict' directive in function with non-simple parameter list",jq="Illegal return statement",Qq="Keyword must not contain escaped characters",Zq="Invalid hexadecimal escape sequence",Yq="Invalid left-hand side in assignment",tI="Invalid left-hand side in for-in",eI="Invalid left-hand side in for-loop",nI="Unexpected token",rI="Invalid regular expression",sI="Invalid tagged template on optional chain",iI="Invalid Unicode escape sequence",oI="let is disallowed as a lexically bound name",aI="Unexpected token",uI="More than one default clause in switch statement",cI="Illegal newline after throw",lI="Unexpected token",hI="Missing catch or finally after try",fI="Rest parameter must be last formal parameter",pI="Unexpected token",dI="%0 '%1' has already been declared",mI="Classes may not have static property named prototype",gI="Catch variable may not be eval or arguments in strict mode",xI="Delete of an unqualified identifier in strict mode.",yI="In strict mode code, functions can only be declared at top level or inside a block",wI="Function name may not be eval or arguments in strict mode",EI="Assignment to eval or arguments is not allowed in strict mode",vI="Postfix increment/decrement may not have eval or arguments operand in strict mode",DI="Prefix increment/decrement may not have eval or arguments operand in strict mode",bI="Strict mode code may not include a with statement",AI="Octal literals are not allowed in strict mode.",SI="Parameter name eval or arguments is not allowed in strict mode",kI="Use of future reserved word in strict mode",_I="Variable name may not be eval or arguments in strict mode",FI="Octal literals are not allowed in template strings.",CI="\\8 and \\9 are not allowed in template strings.",TI="Unexpected end of input",MI="Unexpected identifier",OI="Unexpected number",NI="Unexpected reserved word",LI="Unexpected string",BI="'super' keyword unexpected here",qI="Unexpected quasi %0",II="Unexpected token %0",PI="Unexpected token ILLEGAL",RI="Undefined label '%0'",UI="Invalid regular expression: missing /",$I={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},zI={fromCodePoint:t=>t<65536?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10))+String.fromCharCode(56320+(t-65536&1023)),isWhiteSpace:t=>32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0,isLineTerminator:t=>10===t||13===t||8232===t||8233===t,isIdentifierStart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&$I.NonAsciiIdentifierStart.test(zI.fromCodePoint(t)),isIdentifierPart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&$I.NonAsciiIdentifierPart.test(zI.fromCodePoint(t)),isDecimalDigit:t=>t>=48&&t<=57,isDecimalDigitChar:t=>1===t.length&&zI.isDecimalDigit(t.charCodeAt(0)),isHexDigit:t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,isOctalDigit:t=>t>=48&&t<=55};function WI(t){return"0123456789abcdef".indexOf(t.toLowerCase())}function XI(t){return"01234567".indexOf(t)}class KI{source;errorHandler;trackComment;isModule;index;lineNumber;lineStart;curlyStack;length;constructor(t,e){this.source=t,this.errorHandler=e,this.trackComment=!1,this.isModule=!1,this.length=t.length,this.index=0,this.lineNumber=t.length>0?1:0,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart,this.curlyStack=t.curlyStack}eof(){return this.index>=this.length}throwUnexpectedToken(t=PI){return this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}tolerateUnexpectedToken(t=PI){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}skipSingleLineComment(t){let e,n,r=[];for(this.trackComment&&(r=[],e=this.index-t,n={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{}});!this.eof();){const s=this.source.charCodeAt(this.index);if(++this.index,zI.isLineTerminator(s)){if(this.trackComment&&n){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};const s={multiLine:!1,slice:[e+t,this.index-1],range:[e,this.index-1],loc:n};r.push(s)}return 13===s&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}if(this.trackComment&&n){n.end={line:this.lineNumber,column:this.index-this.lineStart};const s={multiLine:!1,slice:[e+t,this.index],range:[e,this.index],loc:n};r.push(s)}return r}skipMultiLineComment(){let t,e,n=[];for(this.trackComment&&(n=[],t=this.index-2,e={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){const r=this.source.charCodeAt(this.index);if(zI.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment&&e){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:e};n.push(r)}return n}++this.index}else++this.index}if(this.trackComment&&e){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:e};n.push(r)}return this.tolerateUnexpectedToken(),n}scanComments(){let t;this.trackComment&&(t=[]);let e=0===this.index;for(;!this.eof();){let n=this.source.charCodeAt(this.index);if(zI.isWhiteSpace(n))++this.index;else if(zI.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,e=!0;else if(47===n)if(n=this.source.charCodeAt(this.index+1),47===n){this.index+=2;const n=this.skipSingleLineComment(2);this.trackComment&&Array.isArray(t)&&(t=t.concat(n)),e=!0}else{if(42!==n)break;{this.index+=2;const e=this.skipMultiLineComment();this.trackComment&&Array.isArray(t)&&(t=t.concat(e))}}else if(e&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;{this.index+=3;const e=this.skipSingleLineComment(3);this.trackComment&&Array.isArray(t)&&(t=t.concat(e))}}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;{this.index+=4;const e=this.skipSingleLineComment(4);this.trackComment&&Array.isArray(t)&&(t=t.concat(e))}}}return t}isFutureReservedWord(t){switch(t){case"enum":case"export":case"import":case"super":return!0;default:return!1}}isStrictModeReservedWord(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}isRestrictedWord(t){return"eval"===t||"arguments"===t}isKeyword(t){switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}codePointAt(t){let e=this.source.charCodeAt(t);if(e>=55296&&e<=56319){const n=this.source.charCodeAt(t+1);if(n>=56320&&n<=57343){e=1024*(e-55296)+n-56320+65536}}return e}scanHexEscape(t){const e="u"===t?4:2;let n=0;for(let t=0;t<e;++t){if(this.eof()||!zI.isHexDigit(this.source.charCodeAt(this.index)))return null;n=16*n+WI(this.source[this.index++])}return String.fromCharCode(n)}tryToScanUnicodeCodePointEscape(){let t=this.source[this.index],e=0;if("}"===t)return null;for(;!this.eof()&&(t=this.source[this.index++],zI.isHexDigit(t.charCodeAt(0)));)e=16*e+WI(t);return e>1114111||"}"!==t?null:zI.fromCodePoint(e)}scanUnicodeCodePointEscape(){const t=this.tryToScanUnicodeCodePointEscape();return null===t?this.throwUnexpectedToken():t}getIdentifier(){const t=this.index++;for(;!this.eof();){const e=this.source.charCodeAt(this.index);if(92===e)return this.index=t,this.getComplexIdentifier();if(e>=55296&&e<57343)return this.index=t,this.getComplexIdentifier();if(!zI.isIdentifierPart(e))break;++this.index}return this.source.slice(t,this.index)}getComplexIdentifier(){let t,e=this.codePointAt(this.index),n=zI.fromCodePoint(e);for(this.index+=n.length,92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&zI.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken()),n=t);!this.eof()&&(e=this.codePointAt(this.index),zI.isIdentifierPart(e));)t=zI.fromCodePoint(e),n+=t,this.index+=t.length,92===e&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&zI.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken()),n+=t);return n}octalToDecimal(t){let e="0"!==t,n=XI(t);return!this.eof()&&zI.isOctalDigit(this.source.charCodeAt(this.index))&&(e=!0,n=8*n+XI(this.source[this.index++]),"0123".indexOf(t)>=0&&!this.eof()&&zI.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+XI(this.source[this.index++]))),{code:n,octal:e}}scanIdentifier(){let t;const e=this.index,n=92===this.source.charCodeAt(e)?this.getComplexIdentifier():this.getIdentifier();if(t=1===n.length?3:this.isKeyword(n)?4:"null"===n?5:"true"===n||"false"===n?1:3,3!==t&&e+n.length!==this.index){const t=this.index;this.index=e,this.tolerateUnexpectedToken(Qq),this.index=t}return{type:t,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}scanPunctuator(){const t=this.index;let e=this.source[this.index];switch(e){case"(":case"{":"{"===e&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,e="...");break;case"}":++this.index,this.curlyStack.pop();break;case"?":++this.index,"?"===this.source[this.index]&&(++this.index,e="??"),"."!==this.source[this.index]||/^\d$/.test(this.source[this.index+1])||(++this.index,e="?.");break;case")":case";":case",":case"[":case"]":case":":case"~":++this.index;break;default:e=this.source.substr(this.index,4),">>>="===e?this.index+=4:(e=e.substr(0,3),"==="===e||"!=="===e||">>>"===e||"<<="===e||">>="===e||"**="===e?this.index+=3:(e=e.substr(0,2),"&&"===e||"||"===e||"??"===e||"=="===e||"!="===e||"+="===e||"-="===e||"*="===e||"/="===e||"++"===e||"--"===e||"<<"===e||">>"===e||"&="===e||"|="===e||"^="===e||"%="===e||"<="===e||">="===e||"=>"===e||"**"===e?this.index+=2:(e=this.source[this.index],"<>=!+-*%&|^/".indexOf(e)>=0&&++this.index)))}return this.index===t&&this.throwUnexpectedToken(),{type:7,value:e,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanHexLiteral(t){let e="";for(;!this.eof()&&zI.isHexDigit(this.source.charCodeAt(this.index));)e+=this.source[this.index++];return 0===e.length&&this.throwUnexpectedToken(),zI.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+e,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanBinaryLiteral(t){let e,n="";for(;!this.eof()&&(e=this.source[this.index],"0"===e||"1"===e);)n+=this.source[this.index++];if(0===n.length&&this.throwUnexpectedToken(),!this.eof()){const t=this.source.charCodeAt(this.index);(zI.isIdentifierStart(t)||zI.isDecimalDigit(t))&&this.throwUnexpectedToken()}return{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanOctalLiteral(t,e){let n="",r=!1;for(zI.isOctalDigit(t.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&zI.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return r||0!==n.length||this.throwUnexpectedToken(),(zI.isIdentifierStart(this.source.charCodeAt(this.index))||zI.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}}isImplicitOctalLiteral(){for(let t=this.index+1;t<this.length;++t){const e=this.source[t];if("8"===e||"9"===e)return!1;if(!zI.isOctalDigit(e.charCodeAt(0)))return!0}return!0}scanNumericLiteral(){const t=this.index;let e=this.source[t];BL(zI.isDecimalDigit(e.charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point");let n="";if("."!==e){if(n=this.source[this.index++],e=this.source[this.index],"0"===n){if("x"===e||"X"===e)return++this.index,this.scanHexLiteral(t);if("b"===e||"B"===e)return++this.index,this.scanBinaryLiteral(t);if("o"===e||"O"===e)return this.scanOctalLiteral(e,t);if(e&&zI.isOctalDigit(e.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(e,t)}for(;zI.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];e=this.source[this.index]}if("."===e){for(n+=this.source[this.index++];zI.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];e=this.source[this.index]}if("e"===e||"E"===e)if(n+=this.source[this.index++],e=this.source[this.index],"+"!==e&&"-"!==e||(n+=this.source[this.index++]),zI.isDecimalDigit(this.source.charCodeAt(this.index)))for(;zI.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];else this.throwUnexpectedToken();return zI.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseFloat(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanStringLiteral(){const t=this.index;let e=this.source[t];BL("'"===e||'"'===e,"String literal must starts with a quote"),++this.index;let n=!1,r="";for(;!this.eof();){let t=this.source[this.index++];if(t===e){e="";break}if("\\"===t)if(t=this.source[this.index++],t&&zI.isLineTerminator(t.charCodeAt(0)))++this.lineNumber,"\r"===t&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(t){case"u":if("{"===this.source[this.index])++this.index,r+=this.scanUnicodeCodePointEscape();else{const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(),r+=e}break;case"x":{const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(Zq),r+=e;break}case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;case"8":case"9":r+=t,this.tolerateUnexpectedToken();break;default:if(t&&zI.isOctalDigit(t.charCodeAt(0))){const e=this.octalToDecimal(t);n=e.octal||n,r+=String.fromCharCode(e.code)}else r+=t}else{if(zI.isLineTerminator(t.charCodeAt(0)))break;r+=t}}return""!==e&&(this.index=t,this.throwUnexpectedToken()),{type:8,value:r,octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanTemplate(){let t="",e=!1;const n=this.index,r="`"===this.source[n];let s=!1,i=null,o=2;for(++this.index;!this.eof();){let n=this.source[this.index++];if("`"===n){o=1,s=!0,e=!0;break}if("$"===n){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,e=!0;break}t+=n}else{if(null!==i)continue;if("\\"===n)if(n=this.source[this.index++],zI.isLineTerminator(n.charCodeAt(0)))++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":if("{"===this.source[this.index]){++this.index;const e=this.tryToScanUnicodeCodePointEscape();null===e?i="u":t+=e}else{const e=this.scanHexEscape(n);null===e?i="u":t+=e}break;case"x":{const e=this.scanHexEscape(n);null===e?i="x":t+=e;break}case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:"0"===n?zI.isDecimalDigit(this.source.charCodeAt(this.index))?i="0":t+="\0":zI.isDecimalDigitChar(n)?i=n:t+=n}else zI.isLineTerminator(n.charCodeAt(0))?(++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,t+="\n"):t+=n}}return e||this.throwUnexpectedToken(),r||this.curlyStack.pop(),{type:10,value:this.source.slice(n+1,this.index-o),cooked:null===i?t:null,head:r,tail:s,notEscapeSequenceHead:i,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}testRegExp(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,((t,e,n)=>{const r=parseInt(e||n,16);return r>1114111&&this.throwUnexpectedToken(rI),r<=65535?String.fromCharCode(r):""})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,""));try{RegExp(n)}catch(t){this.throwUnexpectedToken(rI)}try{return new RegExp(t,e)}catch(t){return null}}scanRegExpBody(){let t=this.source[this.index];BL("/"===t,"Regular expression literal must start with a slash");let e=this.source[this.index++],n=!1,r=!1;for(;!this.eof();)if(t=this.source[this.index++],e+=t,"\\"===t)t=this.source[this.index++],zI.isLineTerminator(t.charCodeAt(0))&&this.throwUnexpectedToken(UI),e+=t;else if(zI.isLineTerminator(t.charCodeAt(0)))this.throwUnexpectedToken(UI);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||this.throwUnexpectedToken(UI),e.substr(1,e.length-2)}scanRegExpFlags(){let t="",e="";for(;!this.eof();){let n=this.source[this.index];if(!zI.isIdentifierPart(n.charCodeAt(0)))break;if(++this.index,"\\"!==n||this.eof())e+=n,t+=n;else if(n=this.source[this.index],"u"===n){++this.index;let n=this.index;const r=this.scanHexEscape("u");if(null!==r)for(e+=r,t+="\\u";n<this.index;++n)t+=this.source[n];else this.index=n,e+="u",t+="\\u";this.tolerateUnexpectedToken()}else t+="\\",this.tolerateUnexpectedToken()}return e}scanRegExp(){const t=this.index,e=this.scanRegExpBody(),n=this.scanRegExpFlags();return{type:9,value:"",pattern:e,flags:n,regex:this.testRegExp(e,n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}lex(){if(this.eof())return{type:2,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const t=this.source.charCodeAt(this.index);return zI.isIdentifierStart(t)?this.scanIdentifier():40===t||41===t||59===t?this.scanPunctuator():39===t||34===t?this.scanStringLiteral():46===t?zI.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():zI.isDecimalDigit(t)?this.scanNumericLiteral():96===t||125===t&&"${"===this.curlyStack[this.curlyStack.length-1]?this.scanTemplate():t>=55296&&t<57343&&zI.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}}const HI={};function JI(t){if(function(t){return"string"==typeof t||"number"==typeof t||null===t}(t))return t;throw new Error("assert_raw_token_value")}function GI(t){if("string"==typeof t)return t;throw new Error}function VI(t){const e=GI(t);switch(e){case"+":case"-":case"*":case"/":case"|":case"^":case"**":case"&":case"<":case">":case"<=":case">=":case"===":case"!==":case"==":case"!=":case"<<":case">>":case"||":case"&&":case"??":case">>>":case"%":case"in":case"instanceof":return e;default:throw new Error(`opr: '${t}'`)}}HI[1]="Boolean",HI[2]="<end>",HI[3]="Identifier",HI[4]="Keyword",HI[5]="Null",HI[6]="Numeric",HI[7]="Punctuator",HI[8]="String",HI[9]="RegularExpression",HI[10]="Template",HI[11]="JSXIdentifier",HI[12]="JSXText";class jI extends RL{value;constructor(t){super(qL.BlockComment),this.value=t}}class QI extends RL{value;constructor(t){super(qL.LineComment),this.value=t}}function ZI(t){return t.type===qL.LineComment}const YI={")":0,";":0,",":0,"=":0,"]":0,"??":5,"||":6,"&&":7,"|":8,"^":9,"&":10,"==":11,"!=":11,"===":11,"!==":11,"<":12,">":12,"<=":12,">=":12,"<<":13,">>":13,">>>":13,"+":14,"-":14,"*":15,"/":15,"%":15};let tP=class{config;delegate;errorHandler;scanner;operatorPrecedence;lookahead;hasLineTerminator;context;tokens;startMarker;lastMarker;constructor(t,e={},n){var r;if(this.config={range:"boolean"==typeof e.range&&e.range,loc:"boolean"==typeof e.loc&&e.loc,source:null,tokens:"boolean"==typeof e.tokens&&e.tokens,comment:"boolean"==typeof e.comment&&e.comment,tolerant:"boolean"==typeof e.tolerant&&e.tolerant},this.config.loc&&e.source&&null!==e.source&&(this.config.source=String(e.source)),this.delegate=n,this.errorHandler=new _q,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new KI(t,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence=(r=YI,{...r}),e.operatorPrecedence){const t=Object.keys(this.operatorPrecedence);for(const n of t){const t=e.operatorPrecedence(n);"number"==typeof t&&(this.operatorPrecedence[n]=t)}}this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,isAsync:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,inClassConstructor:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,((t,e)=>(BL(e<n.length,"Message reference must be in range"),n[e]))),s=this.lastMarker.index,i=this.lastMarker.line,o=this.lastMarker.column+1;throw this.errorHandler.createError(s,i,o,r)}tolerateError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,((t,e)=>(BL(e<n.length,"Message reference must be in range"),n[e]))),s=this.lastMarker.index,i=this.scanner.lineNumber,o=this.lastMarker.column+1;this.errorHandler.tolerateError(s,i,o,r)}unexpectedTokenError(t,e){let n=e||II;if(t?(e||(n=2===t.type?TI:3===t.type?MI:6===t.type?OI:8===t.type?LI:10===t.type?qI:II,4===t.type&&(this.scanner.isFutureReservedWord(t.value)?n=NI:this.context.strict&&this.scanner.isStrictModeReservedWord(t.value)&&(n=kI))),n=n.replace("%0",t.value)):n=n.replace("%0","ILLEGAL"),t&&"number"==typeof t.lineNumber){const e=t.start,r=t.lineNumber,s=this.lastMarker.index-this.lastMarker.column,i=t.start-s+1;return this.errorHandler.createError(e,r,i,n)}{const t=this.lastMarker.index,e=this.lastMarker.line,r=this.lastMarker.column+1;return this.errorHandler.createError(t,e,r,n)}}throwUnexpectedToken(t,e){throw this.unexpectedTokenError(t,e)}tolerateUnexpectedToken(t,e){this.errorHandler.tolerate(this.unexpectedTokenError(t,e))}tolerateInvalidLoopStatement(){(this.matchKeyword("class")||this.matchKeyword("function"))&&this.tolerateError(II,this.lookahead)}collectComments(){if(this.config.comment){const n=this.scanner.scanComments();if(Array.isArray(n)&&n.length>0&&this.delegate)for(let r=0;r<n.length;++r){const s=n[r],i=(t=s.multiLine,e=this.scanner.source.slice(s.slice[0],s.slice[1]),t?new jI(e):new QI(e));this.config.range&&(i.range=s.range),this.config.loc&&(i.loc=s.loc);const o={start:{line:s.loc.start.line,column:s.loc.start.column,offset:s.range[0]},end:{line:s.loc.end.line,column:s.loc.end.column,offset:s.range[1]}};this.delegate(i,o)}}else this.scanner.scanComments();var t,e}getTokenRaw(t){return this.scanner.source.slice(t.start,t.end)}convertToken(t){const e={type:HI[t.type],value:this.getTokenRaw(t)};if(this.config.range&&(e.range=[t.start,t.end]),this.config.loc&&(e.loc={start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),9===t.type){const n=t.pattern,r=t.flags;e.regex={pattern:n,flags:r}}return e}nextToken(){const t=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.collectComments(),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart);const e=this.scanner.lex();return this.hasLineTerminator=t.lineNumber!==e.lineNumber,e&&this.context.strict&&3===e.type&&this.scanner.isStrictModeReservedWord(e.value)&&(e.type=4),this.lookahead=e,this.config.tokens&&2!==e.type&&this.tokens.push(this.convertToken(e)),t}nextRegexToken(){this.collectComments();const t=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(t))),this.lookahead=t,this.nextToken(),t}createNode(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}startNode(t,e=0){let n=t.start-t.lineStart,r=t.lineNumber;return n<0&&(n+=e,r--),{index:t.start,line:r,column:n}}finalize(t,e){if(this.config.range&&(e.range=[t.index,this.lastMarker.index]),this.config.loc&&(e.loc={start:{line:t.line,column:t.column},end:{line:this.lastMarker.line,column:this.lastMarker.column}},this.config.source&&(e.loc.source=this.config.source)),this.delegate){const n={start:{line:t.line,column:t.column,offset:t.index},end:{line:this.lastMarker.line,column:this.lastMarker.column,offset:this.lastMarker.index}};this.delegate(e,n)}return e}expect(t){const e=this.nextToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}expectCommaSeparator(){if(this.config.tolerant){const t=this.lookahead;7===t.type&&","===t.value?this.nextToken():7===t.type&&";"===t.value?(this.nextToken(),this.tolerateUnexpectedToken(t)):this.tolerateUnexpectedToken(t,II)}else this.expect(",")}expectKeyword(t){const e=this.nextToken();4===e.type&&e.value===t||this.throwUnexpectedToken(e)}match(t){return 7===this.lookahead.type&&this.lookahead.value===t}matchKeyword(t){return 4===this.lookahead.type&&this.lookahead.value===t}matchContextualKeyword(t){return 3===this.lookahead.type&&this.lookahead.value===t}matchAssign(){if(7!==this.lookahead.type)return!1;const t=this.lookahead.value;return"="===t||"*="===t||"**="===t||"/="===t||"%="===t||"+="===t||"-="===t||"<<="===t||">>="===t||">>>="===t||"&="===t||"^="===t||"|="===t}isolateCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const s=t.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=e,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,s}inheritCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const s=t.call(this);return this.context.isBindingElement=this.context.isBindingElement&&e,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,s}consumeSemicolon(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)}parsePrimaryExpression(){const t=this.createNode();let e,n,r;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.isAsync)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(t,new CB(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,AI),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new PB(n.value,r));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new PB("true"===n.value,r));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new PB(null,r));break;case 10:e=this.parseTemplateLiteral({isTagged:!1});break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,n=this.nextRegexToken(),r=this.getTokenRaw(n),e=this.finalize(t,new QB(n.regex,r,n.pattern,n.flags));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(t,new CB(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(t,new pq)):this.matchKeyword("class")?e=this.parseClassExpression():this.matchImportCall()?e=this.parseImportCall():this.matchImportMeta()?(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,Nq),e=this.parseImportMeta()):e=this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e}parseSpreadElement(){const t=this.createNode();this.expect("...");const e=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(t,new iq(e))}parseArrayInitializer(){const t=this.createNode(),e=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),e.push(null);else if(this.match("...")){const t=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),e.push(t)}else e.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(t,new UL(e))}parsePropertyMethod(t){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=t.simple;const r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&t.firstRestricted&&this.tolerateUnexpectedToken(t.firstRestricted,t.message),this.context.strict&&t.stricted&&this.tolerateUnexpectedToken(t.stricted,t.message),this.context.strict=e,this.context.allowStrictDirective=n,r}parsePropertyMethodFunction(t){const e=this.createNode(),n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters(),s=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(e,new FB(null,r.params,s,t,!1))}parsePropertyMethodAsyncFunction(t){const e=this.createNode(),n=this.context.allowYield,r=this.context.isAsync;this.context.allowYield=!1,this.context.isAsync=!0;const s=this.parseFormalParameters(),i=this.parsePropertyMethod(s);return this.context.allowYield=n,this.context.isAsync=r,this.finalize(e,new FB(null,s.params,i,t,!0))}parseObjectPropertyKey(){const t=this.createNode(),e=this.nextToken();let n;switch(e.type){case 8:case 6:{this.context.strict&&e.octal&&this.tolerateUnexpectedToken(e,AI);const r=this.getTokenRaw(e);n=this.finalize(t,new PB(e.value,r));break}case 3:case 1:case 5:case 4:n=this.finalize(t,new CB(GI(e.value)));break;case 7:"["===e.value?(n=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):n=this.throwUnexpectedToken(e);break;default:n=this.throwUnexpectedToken(e)}return n}isPropertyKey(t,e){return!!t&&(TB(t)&&t.name===e||RB(t)&&t.value===e)}parseObjectProperty(t){const e=this.createNode(),n=this.lookahead;let r,s=null,i=null,o=!1,a=!1,u=!1,c=!1,l=!1;if(3===n.type){const t=GI(n.value);this.nextToken(),o=this.match("["),c=!(this.hasLineTerminator||"async"!==t||this.match(":")||this.match("(")||this.match(",")),l=this.match("*"),l&&this.nextToken(),s=c?this.parseObjectPropertyKey():this.finalize(e,new CB(t))}else this.match("*")?this.nextToken():(o=this.match("["),s=this.parseObjectPropertyKey());const h=this.qualifiedPropertyName(this.lookahead);if(3===n.type&&!c&&"get"===n.value&&h)r="get",o=this.match("["),s=this.parseObjectPropertyKey(),this.context.allowYield=!1,i=this.parseGetterMethod();else if(3===n.type&&!c&&"set"===n.value&&h)r="set",o=this.match("["),s=this.parseObjectPropertyKey(),i=this.parseSetterMethod();else if(7===n.type&&"*"===n.value&&h)r="init",o=this.match("["),s=this.parseObjectPropertyKey(),i=this.parseGeneratorMethod(),a=!0;else if(s||this.throwUnexpectedToken(this.lookahead),r="init",this.match(":")&&!c)!o&&this.isPropertyKey(s,"__proto__")&&(t.value&&this.tolerateError(zq),t.value=!0),this.nextToken(),i=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))i=c?this.parsePropertyMethodAsyncFunction(l):this.parsePropertyMethodFunction(l),a=!0;else if(3===n.type){const t=this.finalize(e,new CB(GI(n.value)));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),u=!0;const n=this.isolateCoverGrammar(this.parseAssignmentExpression);i=this.finalize(e,new VL(t,n))}else u=!0,i=t}else this.throwUnexpectedToken(this.nextToken());return this.finalize(e,new jB(r,s,o,i,a,u))}parseObjectInitializer(){const t=this.createNode();this.expect("{");const e=[],n={value:!1};for(;!this.match("}");)e.push(this.match("...")?this.parseSpreadElement():this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(t,new HB(e))}throwTemplateLiteralEarlyErrors(t){switch(t.notEscapeSequenceHead){case"u":return this.throwUnexpectedToken(t,iI);case"x":return this.throwUnexpectedToken(t,Zq);case"8":case"9":return this.throwUnexpectedToken(t,CI);default:return this.throwUnexpectedToken(t,FI)}}parseTemplateHead(t){BL(this.lookahead.head,"Template literal must start with a template head");const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,s=n.cooked;return this.finalize(e,new hq({raw:r,cooked:s},n.tail))}parseTemplateElement(t){10!==this.lookahead.type&&this.throwUnexpectedToken();const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,s=n.cooked;return this.finalize(e,new hq({raw:r,cooked:s},n.tail))}parseTemplateLiteral(t){const e=this.createNode(),n=[],r=[];let s=this.parseTemplateHead(t);for(r.push(s);!s.tail;)n.push(this.parseExpression()),s=this.parseTemplateElement(t),r.push(s);return this.finalize(e,new fq(r,n))}reinterpretExpressionAsPattern(t){if(TB(t)||$B(t)||YB(t)||jL(t));else{if(oq(t))return t.type=qL.RestElement,void this.reinterpretExpressionAsPattern(t.argument);if($L(t)){t.type=qL.ArrayPattern;for(let e=0;e<t.elements.length;e++)null!==t.elements[e]&&this.reinterpretExpressionAsPattern(t.elements[e])}else if(JB(t)){t.type=qL.ObjectPattern;for(let e=0;e<t.properties.length;e++){const n=t.properties[e];this.reinterpretExpressionAsPattern(oq(n)?n:n.value)}}else GL(t)&&(t.type=qL.AssignmentPattern,delete t.operator,this.reinterpretExpressionAsPattern(t.left))}}parseGroupExpression(){if(this.expect("("),this.match(")"))return this.nextToken(),this.match("=>")||this.expect("=>"),new KL([],!1);{const t=this.lookahead,e=[];if(this.match("...")){const t=this.parseRestElement(e);return this.expect(")"),this.match("=>")||this.expect("=>"),new KL([t],!1)}{let n=!1;this.context.isBindingElement=!0;let r=this.inheritCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){const s=[];for(this.context.isAssignmentTarget=!1,s.push(r);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(let t=0;t<s.length;t++)this.reinterpretExpressionAsPattern(s[t]);n=!0,r=new KL(s,!1)}else if(this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),s.push(this.parseRestElement(e)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(let t=0;t<s.length;t++)this.reinterpretExpressionAsPattern(s[t]);n=!0,r=new KL(s,!1)}else s.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(n)break}n||(r=this.finalize(this.startNode(t),new rq(s)))}if(!n){if(this.expect(")"),this.match("=>")&&(TB(r)&&"yield"===r.name&&(n=!0,r=new KL([r],!1)),!n)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),sq(r))for(let t=0;t<r.expressions.length;t++)this.reinterpretExpressionAsPattern(r.expressions[t]);else this.reinterpretExpressionAsPattern(r);const t=sq(r)?r.expressions:[r];r=new KL(t,!1)}this.context.isBindingElement=!1}return r}}}parseArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}isIdentifierName(t){return 3===t.type||4===t.type||1===t.type||5===t.type}parseIdentifierName(){const t=this.createNode(),e=this.nextToken();return this.isIdentifierName(e)||this.throwUnexpectedToken(e),this.finalize(t,new CB(GI(e.value)))}parseNewExpression(){const t=this.createNode(),e=this.parseIdentifierName();if(BL("new"===e.name,"New expression must start with `new`"),this.match(".")){if(this.nextToken(),3===this.lookahead.type&&this.context.inFunctionBody&&"target"===this.lookahead.value){const n=this.parseIdentifierName(),r=new zB(e,n);return this.finalize(t,r)}this.throwUnexpectedToken(this.lookahead)}else{if(!this.matchKeyword("import")){const e=this.isolateCoverGrammar(this.parseLeftHandSideExpression),n=this.match("(")?this.parseArguments():[],r=new KB(e,n);return this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.finalize(t,r)}this.throwUnexpectedToken(this.lookahead)}}parseAsyncArgument(){const t=this.parseAssignmentExpression();return this.context.firstCoverInitializedNameError=null,t}parseAsyncArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAsyncArgument);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}matchImportCall(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();this.scanner.restoreState(e),t=7===n.type&&"("===n.value}return t}parseImportCall(){const t=this.createNode();return this.expectKeyword("import"),this.finalize(t,new OB)}matchImportMeta(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();if(7===n.type&&"."===n.value){this.scanner.scanComments();const e=this.scanner.lex();t=3===e.type&&"meta"===e.value,t&&e.end-e.start!=4&&this.tolerateUnexpectedToken(e,Qq)}else t=!1;this.scanner.restoreState(e)}return t}parseImportMeta(){const t=this.createNode(),e=this.parseIdentifierName();this.expect(".");const n=this.parseIdentifierName();return this.context.isAssignmentTarget=!1,this.finalize(t,new zB(e,n))}parseLeftHandSideExpressionAllowCall(){const t=this.lookahead,e=this.matchContextualKeyword("async"),n=this.context.allowIn;let r;this.context.allowIn=!0;const s=this.matchKeyword("super");if(s&&this.context.inFunctionBody){const t=this.createNode();this.nextToken(),r=this.finalize(t,new aq),this.match("(")||this.match(".")||this.match("[")||this.throwUnexpectedToken(this.lookahead)}else r=this.parseNewOrPrimaryExpression();s&&this.match("(")&&!this.context.inClassConstructor&&this.tolerateError(BI);let i=!1;for(;;){let n=!1;if(this.match("?.")&&(n=!0,i=!0,this.expect("?.")),this.match("(")){const s=e&&t.lineNumber===this.lookahead.lineNumber;this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;const i=s?this.parseAsyncArguments():this.parseArguments();if(r.type===qL.Import&&1!==i.length&&this.tolerateError(Cq),r=this.finalize(this.startNode(t),new iB(r,i,n)),s&&this.match("=>")){for(let t=0;t<i.length;++t)this.reinterpretExpressionAsPattern(i[t]);r=new KL(i,!0)}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,this.expect("[");const e=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),r=this.finalize(this.startNode(t),new UB(r,e,n,!0))}else if(10===this.lookahead.type&&this.lookahead.head){n&&this.throwUnexpectedToken(this.lookahead),i&&this.throwError(sI);const e=this.parseTemplateLiteral({isTagged:!0});r=this.finalize(this.startNode(t),new lq(r,e))}else{if(!this.match(".")&&!n)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,n||this.expect(".");const e=this.parseIdentifierName();r=this.finalize(this.startNode(t),new UB(r,e,n,!1))}}}return this.context.allowIn=n,i?new uB(r):r}parseSuper(){const t=this.createNode();return this.expectKeyword("super"),this.match("[")||this.match(".")||this.throwUnexpectedToken(this.lookahead),this.finalize(t,new aq)}parseNewOrPrimaryExpression(){return this.matchKeyword("new")?this.inheritCoverGrammar(this.parseNewExpression):this.inheritCoverGrammar(this.parsePrimaryExpression)}parseSuperOrNewOrPrimaryExpression(){return this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.parseNewOrPrimaryExpression()}parseLeftHandSideExpression(){BL(this.context.allowIn,"callee of new expression always allow in keyword.");const t=this.startNode(this.lookahead);let e=this.parseSuperOrNewOrPrimaryExpression(),n=!1;for(;;){let r=!1;if(this.match("?.")&&(r=!0,n=!0,this.expect("?.")),this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,this.expect("[");const n=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),e=this.finalize(t,new UB(e,n,r,!0))}else if(10===this.lookahead.type&&this.lookahead.head){r&&this.throwUnexpectedToken(this.lookahead),n&&this.throwError(sI);const s=this.parseTemplateLiteral({isTagged:!0});e=this.finalize(t,new lq(e,s))}else{if(!this.match(".")&&!r)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,r||this.expect(".");const n=this.parseIdentifierName();e=this.finalize(t,new UB(e,n,r,!1))}}}return n?new uB(e):e}parseUpdateExpression(){const t=this.lookahead;if(this.match("++")||this.match("--")){const e=this.startNode(t),n=this.nextToken(),r=this.inheritCoverGrammar(this.parseUnaryExpression);this.context.strict&&TB(r)&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(DI),this.context.isAssignmentTarget||this.tolerateError(Yq);const s=!0,i=this.finalize(e,new yq(GI(n.value),r,s));return this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,i}{const e=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);if(!this.hasLineTerminator&&7===this.lookahead.type&&(this.match("++")||this.match("--"))){this.context.strict&&TB(e)&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(vI),this.context.isAssignmentTarget||this.tolerateError(Yq),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=this.nextToken().value,r=!1;return this.finalize(this.startNode(t),new yq(GI(n),e,r))}return e}}parseAwaitExpression(){const t=this.createNode();this.nextToken();const e=this.parseUnaryExpression();return this.finalize(t,new YL(e))}matchUnaryOp(){return this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")}parseUnaryExpression(){if(this.matchUnaryOp()){const t=this.startNode(this.lookahead),e=this.nextToken(),n=this.inheritCoverGrammar(this.parseUnaryExpression),r=this.finalize(t,new gq(function(t){const e=GI(t);switch(e){case"+":case"-":case"~":case"!":case"delete":case"typeof":case"void":return e;default:throw new Error}}(e.value),n));return this.context.strict&&"delete"===r.operator&&TB(r.argument)&&this.tolerateError(xI),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,r}return this.context.isAsync&&this.matchContextualKeyword("await")?this.parseAwaitExpression():this.parseUpdateExpression()}parseExponentiationExpression(){const t=this.lookahead,e=this.inheritCoverGrammar(this.parseUnaryExpression);if(!xq(e)&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=e,r=this.isolateCoverGrammar(this.parseExponentiationExpression);return this.finalize(this.startNode(t),new tB(VI("**"),n,r))}return e}binaryPrecedence(t){const e=t.value;return 7===t.type?this.operatorPrecedence[e]||0:4===t.type&&("instanceof"===e||this.context.allowIn&&"in"===e)?12:0}parseBinaryExpression(){const t=this.lookahead;let e=this.inheritCoverGrammar(this.parseExponentiationExpression),n=!0,r=!0;const s=t=>{"&&"!==t.value&&"||"!==t.value||(r=!1),"??"===t.value&&(n=!1)},i=this.lookahead;let o=this.binaryPrecedence(i);if(o>0){s(i),this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const a=[t,this.lookahead];let u=e,c=this.isolateCoverGrammar(this.parseExponentiationExpression);const l=[u,i.value,c],h=[o];for(;o=this.binaryPrecedence(this.lookahead),!(o<=0);){for((n||"&&"!==this.lookahead.value&&"||"!==this.lookahead.value)&&(r||"??"!==this.lookahead.value)||this.throwUnexpectedToken(this.lookahead),s(this.lookahead);l.length>2&&o<=h[h.length-1];){c=l.pop();const t=VI(JI(l.pop()));h.pop(),u=l.pop(),a.pop();const e=a[a.length-1],n=this.startNode(e,e.lineStart);l.push(this.finalize(n,new tB(t,u,c)))}l.push(this.nextToken().value),h.push(o),a.push(this.lookahead),l.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}let f=l.length-1;e=l[f];let p=a.pop();for(;f>1;){const t=a.pop(),n=p&&p.lineStart,r=this.startNode(t,n),s=JI(l[f-1]);e=this.finalize(r,new tB(VI(s),l[f-2],e)),f-=2,p=t}}return e}parseConditionalExpression(){const t=this.lookahead,e=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();const n=this.context.allowIn;this.context.allowIn=!0;const r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");const s=this.isolateCoverGrammar(this.parseAssignmentExpression),i=this.finalize(this.startNode(t),new fB(e,r,s));return this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,i}return e}checkPatternParam(t,e){if(e){if(TB(e))this.validateParam(t,e,e.name);else if(YB(e))this.checkPatternParam(t,e.argument);else if(jL(e))this.checkPatternParam(t,e.left);else if(WL(e))for(let n=0;n<e.elements.length;n++)null!==e.elements[n]&&this.checkPatternParam(t,e.elements[n]);else if(VB(e))for(let n=0;n<e.properties.length;n++){const r=e.properties[n];YB(r)?this.checkPatternParam(t,r):this.checkPatternParam(t,r.value)}t.simple=t.simple&&TB(e)}else t.simple=!1}reinterpretAsCoverParams(t){if(TB(t))return[[t],!1];if(HL(t))return[t.params,t.async];throw new Error("reinterpretAsCoverParams")}reinterpretAsCoverFormalsList(t){if(TB(t));else if(!HL(t))return null;const[e,n]=this.reinterpretAsCoverParams(t),r={simple:!0,params:[],paramSet:{}};for(let t=0;t<e.length;++t){const s=e[t];if(jL(s)){if(kq(s.right)){s.right.argument&&this.throwUnexpectedToken(this.lookahead);const t=s.right;t.type=qL.Identifier,t.name="yield",delete t.argument,delete t.delegate}}else n&&TB(s)&&"await"===s.name&&this.throwUnexpectedToken(this.lookahead);this.checkPatternParam(r,s),e[t]=s}if(this.context.strict||!this.context.allowYield)for(let t=0;t<e.length;++t){kq(e[t])&&this.throwUnexpectedToken(this.lookahead)}if(r.hasDuplicateParameterNames){const t=this.context.strict?r.stricted:r.firstRestricted;this.throwUnexpectedToken(t,$q)}return{simple:r.simple,params:PL(e),stricted:r.stricted,firstRestricted:r.firstRestricted,message:r.message}}parseAssignmentExpression(){if(!this.context.allowYield&&this.matchKeyword("yield"))return this.parseYieldExpression();{const t=this.lookahead;let e=t,n=this.parseConditionalExpression();if(3===e.type&&e.lineNumber===this.lookahead.lineNumber&&"async"===e.value&&(3===this.lookahead.type||this.matchKeyword("yield"))){const t=this.parsePrimaryExpression();this.reinterpretExpressionAsPattern(t),n=new KL([t],!0)}if(HL(n)||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=!!HL(n)&&n.async,r=this.reinterpretAsCoverFormalsList(n);if(r){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;const s=this.context.strict,i=this.context.allowStrictDirective;this.context.allowStrictDirective=r.simple;const o=this.context.allowYield,a=this.context.isAsync;this.context.allowYield=!0,this.context.isAsync=e;const u=this.startNode(t);let c;if(this.expect("=>"),this.match("{")){const t=this.context.allowIn;this.context.allowIn=!0,c=this.parseFunctionSourceElements(),this.context.allowIn=t}else c=this.isolateCoverGrammar(this.parseAssignmentExpression);const l=c.type!==qL.BlockStatement;this.context.strict&&r.firstRestricted&&this.throwUnexpectedToken(r.firstRestricted,r.message),this.context.strict&&r.stricted&&this.tolerateUnexpectedToken(r.stricted,r.message),n=e?this.finalize(u,new QL(r.params,c,l)):this.finalize(u,new XL(r.params,c,l)),this.context.strict=s,this.context.allowStrictDirective=i,this.context.allowYield=o,this.context.isAsync=a}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(Yq),this.context.strict&&n.type===qL.Identifier){const t=n;this.scanner.isRestrictedWord(t.name)&&this.tolerateUnexpectedToken(e,EI),this.scanner.isStrictModeReservedWord(t.name)&&this.tolerateUnexpectedToken(e,kI)}this.match("=")?this.reinterpretExpressionAsPattern(n):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),e=this.nextToken();const r=e.value,s=this.isolateCoverGrammar(this.parseAssignmentExpression);n=this.finalize(this.startNode(t),new JL(r,n,s)),this.context.firstCoverInitializedNameError=null}return n}}parseExpression(){const t=this.lookahead,e=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){const n=[];for(n.push(e);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));return this.finalize(this.startNode(t),new rq(n))}return e}parseStatementListItem(){if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4!==this.lookahead.type)return this.parseStatement();switch(this.lookahead.value){case"export":return this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,Jq),this.parseExportDeclaration();case"import":return this.matchImportCall()?this.parseExpressionStatement():this.matchImportMeta()?this.parseStatement():(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,Gq),this.parseImportDeclaration());case"const":return this.parseLexicalDeclaration({inFor:!1});case"function":return this.parseFunctionDeclaration();case"class":return this.parseClassDeclaration();case"let":return this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();default:return this.parseStatement()}}parseBlock(){const t=this.createNode();this.expect("{");const e=[];for(;!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new nB(e))}parseLexicalBinding(t,e){const n=this.createNode(),r=this.parsePattern([],t);this.context.strict&&r.type===qL.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(_I);let s=null;return"const"===t?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(qq,"const")):(!e.inFor&&r.type!==qL.Identifier||this.match("="))&&(this.expect("="),s=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new vq(r,s))}parseBindingList(t,e){const n=[this.parseLexicalBinding(t,e)];for(;this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(t,e));return n}isLexicalDeclaration(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.scanner.lex();return this.scanner.restoreState(t),3===e.type||7===e.type&&"["===e.value||7===e.type&&"{"===e.value||4===e.type&&"let"===e.value||4===e.type&&"yield"===e.value}parseLexicalDeclaration(t){const e=this.createNode(),n=this.nextToken().value;BL("let"===n||"const"===n,"Lexical declaration must be either let or const");const r=this.parseBindingList(n,t);return this.consumeSemicolon(),this.finalize(e,new wq(r,n))}parseBindingRestElement(t,e){const n=this.createNode();this.expect("...");const r=this.parsePattern(t,e);return this.finalize(n,new ZB(r))}parseArrayPattern(t,e){const n=this.createNode();this.expect("[");const r=[];for(;!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(t,e));break}r.push(this.parsePatternWithDefault(t,e)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new zL(r))}parsePropertyPattern(t,e){const n=this.createNode();let r=!1,s=!1;let i,o;if(3===this.lookahead.type){const r=this.lookahead;i=this.parseVariableIdentifier();const a=this.finalize(n,new CB(GI(r.value)));if(this.match("=")){t.push(r),s=!0,this.nextToken();const e=this.parseAssignmentExpression();o=this.finalize(this.startNode(r),new VL(a,e))}else this.match(":")?(this.expect(":"),o=this.parsePatternWithDefault(t,e)):(t.push(r),s=!0,o=a)}else r=this.match("["),i=this.parseObjectPropertyKey(),this.expect(":"),o=this.parsePatternWithDefault(t,e);return this.finalize(n,new jB("init",i,r,o,!1,s))}parseRestProperty(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(Pq),this.match("}")||this.throwError(pI),this.finalize(e,new ZB(n))}parseObjectPattern(t,e){const n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.match("...")?this.parseRestProperty(t):this.parsePropertyPattern(t,e)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new GB(r))}parsePattern(t,e){return this.match("[")?this.parseArrayPattern(t,e):this.match("{")?this.parseObjectPattern(t,e):(!this.matchKeyword("let")||"const"!==e&&"let"!==e||this.tolerateUnexpectedToken(this.lookahead,oI),t.push(this.lookahead),this.parseVariableIdentifier(e))}parsePatternWithDefault(t,e){const n=this.lookahead,r=this.parsePattern(t,e);if(this.match("=")){this.nextToken();const t=this.context.allowYield;this.context.allowYield=!0;const e=this.isolateCoverGrammar(this.parseAssignmentExpression);return this.context.allowYield=t,this.finalize(this.startNode(n),new VL(r,e))}return r}parseVariableIdentifier(t){const e=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,kI):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,kI):(this.context.strict||"let"!==n.value||"var"!==t)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.isAsync)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(e,new CB(GI(n.value)))}parseVariableDeclaration(t){const e=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===qL.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(_I);let r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===qL.Identifier||t.inFor||this.expect("="),this.finalize(e,new vq(n,r))}parseVariableDeclarationList(t){const e={inFor:t.inFor},n=[];for(n.push(this.parseVariableDeclaration(e));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(e));return n}parseVariableStatement(){const t=this.createNode();this.expectKeyword("var");const e=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(t,new wq(e,"var"))}parseEmptyStatement(){const t=this.createNode();return this.expect(";"),this.finalize(t,new xB)}parseExpressionStatement(){const t=this.createNode(),e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new DB(e))}parseIfClause(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(yI),this.parseStatement()}parseIfStatement(){const t=this.createNode();let e,n=null;this.expectKeyword("if"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new xB)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new MB(r,e,n))}parseDoWhileStatement(){const t=this.createNode();this.expectKeyword("do"),this.tolerateInvalidLoopStatement();const e=this.context.inIteration;this.context.inIteration=!0;const n=this.parseStatement();this.context.inIteration=e,this.expectKeyword("while"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new gB(n,r))}parseWhileStatement(){const t=this.createNode();this.expectKeyword("while"),this.expect("(");const e=this.parseExpression();if(!this.match(")")&&this.config.tolerant){this.tolerateUnexpectedToken(this.nextToken());const n=this.finalize(this.createNode(),new xB);return this.finalize(t,new bq(e,n))}{this.expect(")");const n=this.context.inIteration;this.context.inIteration=!0;const r=this.parseStatement();return this.context.inIteration=n,this.finalize(t,new bq(e,r))}}parseForStatement(){let t,e,n=null,r=null,s=null,i=!0,o=!1;const a=this.createNode();if(this.expectKeyword("for"),this.matchContextualKeyword("await")&&(this.context.isAsync||this.tolerateUnexpectedToken(this.lookahead),o=!0,this.nextToken()),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){const r=this.createNode();this.nextToken();const s=this.context.allowIn;this.context.allowIn=!1;const a=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=s,!o&&1===a.length&&this.matchKeyword("in")){const s=a[0];s.init&&(s.id.type===qL.ArrayPattern||s.id.type===qL.ObjectPattern||this.context.strict)&&this.tolerateError(Wq,"for-in"),t=this.finalize(r,new wq(a,"var")),this.nextToken(),e=this.parseExpression(),n=null}else 1===a.length&&null===a[0].init&&this.matchContextualKeyword("of")?(t=this.finalize(r,new wq(a,"var")),this.nextToken(),e=this.parseAssignmentExpression(),n=null,i=!1):(n=this.finalize(r,new wq(a,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){const r=this.createNode(),s=GI(this.nextToken().value);if(this.context.strict||"in"!==this.lookahead.value){const o=this.context.allowIn;this.context.allowIn=!1;const a=this.parseBindingList(s,{inFor:!0});this.context.allowIn=o,1===a.length&&null===a[0].init&&this.matchKeyword("in")?(t=this.finalize(r,new wq(a,s)),this.nextToken(),e=this.parseExpression(),n=null):1===a.length&&null===a[0].init&&this.matchContextualKeyword("of")?(t=this.finalize(r,new wq(a,s)),this.nextToken(),e=this.parseAssignmentExpression(),n=null,i=!1):(this.consumeSemicolon(),n=this.finalize(r,new wq(a,s)))}else t=this.finalize(r,new CB(s)),this.nextToken(),e=this.parseExpression(),n=null}else{const r=this.lookahead,s=this.context.isBindingElement,o=this.context.isAssignmentTarget,a=this.context.firstCoverInitializedNameError,u=this.context.allowIn;if(this.context.allowIn=!1,n=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=u,this.matchKeyword("in"))this.context.isAssignmentTarget&&n.type!==qL.AssignmentExpression||this.tolerateError(tI),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseExpression(),n=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&n.type!==qL.AssignmentExpression||this.tolerateError(eI),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseAssignmentExpression(),n=null,i=!1;else{if(this.context.isBindingElement=s,this.context.isAssignmentTarget=o,this.context.firstCoverInitializedNameError=a,this.match(",")){const t=[n];for(;this.match(",");)this.nextToken(),t.push(this.isolateCoverGrammar(this.parseAssignmentExpression));n=this.finalize(this.startNode(r),new rq(t))}this.expect(";")}}void 0===t&&(this.match(";")||(r=this.isolateCoverGrammar(this.parseExpression)),this.expect(";"),this.match(")")||(s=this.isolateCoverGrammar(this.parseExpression)));const u=this.parseBodyStatement();return void 0===t?this.finalize(a,new kB(n,r,s,u)):i?this.finalize(a,new AB(t,e,u)):this.finalize(a,new SB(t,e,u,o))}parseBodyStatement(){if(!this.match(")")&&this.config.tolerant)return this.tolerateUnexpectedToken(this.nextToken()),this.finalize(this.createNode(),new xB);{this.expect(")");const t=this.context.inIteration;this.context.inIteration=!0;try{return this.isolateCoverGrammar(this.parseStatement)}finally{this.context.inIteration=t}}}parseContinueStatement(){const t=this.createNode();this.expectKeyword("continue");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier();e=t;const n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(RI,t.name)}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.throwError(Hq),this.finalize(t,new pB(e))}parseBreakStatement(){const t=this.createNode();this.expectKeyword("break");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier(),n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(RI,t.name),e=t}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.context.inSwitch||this.throwError(Kq),this.finalize(t,new sB(e))}parseReturnStatement(){this.context.inFunctionBody||this.tolerateError(jq);const t=this.createNode();this.expectKeyword("return");const e=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&2!==this.lookahead.type||8===this.lookahead.type||10===this.lookahead.type?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(t,new tq(e))}parseWithStatement(){this.context.strict&&this.tolerateError(bI);const t=this.createNode();this.expectKeyword("with"),this.expect("(");const e=this.parseExpression();if(!this.match(")")&&this.config.tolerant){this.tolerateUnexpectedToken(this.nextToken());const n=this.finalize(this.createNode(),new xB);return this.finalize(t,new Aq(e,n))}{this.expect(")");const n=this.parseStatement();return this.finalize(t,new Aq(e,n))}}parseSwitchCase(){const t=this.createNode();let e;this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");const n=[];for(;!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new uq(e,n))}parseSwitchStatement(){const t=this.createNode();this.expectKeyword("switch"),this.expect("(");const e=this.parseExpression();this.expect(")");const n=this.context.inSwitch;this.context.inSwitch=!0;const r=[];let s=!1;for(this.expect("{");!this.match("}");){const t=this.parseSwitchCase();null===t.test&&(s&&this.throwError(uI),s=!0),r.push(t)}return this.expect("}"),this.context.inSwitch=n,this.finalize(t,new cq(e,r))}parseLabelledStatement(){const t=this.createNode(),e=this.parseExpression();if(TB(e)&&this.match(":")){this.nextToken();const n="$"+e.name;let r;if(Object.prototype.hasOwnProperty.call(this.context.labelSet,n)&&this.throwError(dI,"Label",e.name),this.context.labelSet[n]=!0,this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),r=this.parseClassDeclaration();else if(this.matchKeyword("function")){const t=this.lookahead,e=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(t,yI):e.generator&&this.tolerateUnexpectedToken(t,Xq),r=e}else r=this.parseStatement();return delete this.context.labelSet[n],this.finalize(t,new IB(e,r))}return this.consumeSemicolon(),this.finalize(t,new DB(e))}parseThrowStatement(){const t=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(cI);const e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new dq(e))}parseCatchClause(){const t=this.createNode();this.expectKeyword("catch");let e=null;if(this.match("(")){this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);const t=[];e=this.parsePattern(t);const n={};for(let e=0;e<t.length;e++){const r="$"+t[e].value;Object.prototype.hasOwnProperty.call(n,r)&&this.tolerateError(Rq,t[e].value),n[r]=!0}this.context.strict&&e.type===qL.Identifier&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(gI),this.expect(")")}const n=this.parseBlock();return this.finalize(t,new aB(e,n))}parseFinallyClause(){return this.expectKeyword("finally"),this.parseBlock()}parseTryStatement(){const t=this.createNode();this.expectKeyword("try");const e=this.parseBlock(),n=this.matchKeyword("catch")?this.parseCatchClause():null,r=this.matchKeyword("finally")?this.parseFinallyClause():null;return n||r||this.throwError(hI),this.finalize(t,new mq(e,n,r))}parseDebuggerStatement(){const t=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(t,new dB)}parseStatement(){let t;switch(this.lookahead.type){case 1:case 5:case 6:case 8:case 10:case 9:t=this.parseExpressionStatement();break;case 7:{const e=this.lookahead.value;t="{"===e?this.parseBlock():"("===e?this.parseExpressionStatement():";"===e?this.parseEmptyStatement():this.parseExpressionStatement();break}case 3:t=this.matchAsyncFunction()?this.parseFunctionDeclaration():this.parseLabelledStatement();break;case 4:switch(this.lookahead.value){case"break":t=this.parseBreakStatement();break;case"continue":t=this.parseContinueStatement();break;case"debugger":t=this.parseDebuggerStatement();break;case"do":t=this.parseDoWhileStatement();break;case"for":t=this.parseForStatement();break;case"function":t=this.parseFunctionDeclaration();break;case"if":t=this.parseIfStatement();break;case"return":t=this.parseReturnStatement();break;case"switch":t=this.parseSwitchStatement();break;case"throw":t=this.parseThrowStatement();break;case"try":t=this.parseTryStatement();break;case"var":t=this.parseVariableStatement();break;case"while":t=this.parseWhileStatement();break;case"with":t=this.parseWithStatement();break;default:t=this.parseExpressionStatement()}break;default:t=this.throwUnexpectedToken(this.lookahead)}return t}parseFunctionSourceElements(){const t=this.createNode();this.expect("{");const e=this.parseDirectivePrologues(),n=this.context.labelSet,r=this.context.inIteration,s=this.context.inSwitch,i=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;2!==this.lookahead.type&&!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=n,this.context.inIteration=r,this.context.inSwitch=s,this.context.inFunctionBody=i,this.finalize(t,new nB(e))}validateParam(t,e,n){const r="$"+n;this.context.strict?(this.scanner.isRestrictedWord(n)&&(t.stricted=e,t.message=SI),Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)):t.firstRestricted||(this.scanner.isRestrictedWord(n)?(t.firstRestricted=e,t.message=SI):this.scanner.isStrictModeReservedWord(n)?(t.firstRestricted=e,t.message=kI):Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)),"function"==typeof Object.defineProperty?Object.defineProperty(t.paramSet,r,{value:!0,enumerable:!0,writable:!0,configurable:!0}):t.paramSet?t.paramSet[r]=!0:t.paramSet={key:!0}}parseRestElement(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(Iq),this.match(")")||this.throwError(fI),this.finalize(e,new ZB(n))}parseFormalParameter(t){const e=[],n=this.match("...")?this.parseRestElement(e):this.parsePatternWithDefault(e);for(let n=0;n<e.length;n++)this.validateParam(t,e[n],GI(e[n].value));t.simple=t.simple&&n instanceof CB,t.params.push(n)}parseFormalParameters(t){const e={simple:!0,hasDuplicateParameterNames:!1,params:[],firstRestricted:t};if(this.expect("("),!this.match(")"))for(e.paramSet={};2!==this.lookahead.type&&(this.parseFormalParameter(e),!this.match(")"))&&(this.expect(","),!this.match(")")););return this.expect(")"),e.hasDuplicateParameterNames&&(this.context.strict||this.context.isAsync||!e.simple)&&this.throwError($q),{simple:e.simple,params:e.params,stricted:e.stricted,firstRestricted:e.firstRestricted,message:e.message}}matchAsyncFunction(){const t=this.matchContextualKeyword("async");if(!t)return t;{const t=this.scanner.saveState();this.scanner.scanComments();try{const e=this.scanner.lex();return t.lineNumber===e.lineNumber&&4===e.type&&"function"===e.value}finally{this.scanner.restoreState(t)}}}parseFunctionDeclaration(t){const e=this.createNode(),n=this.matchContextualKeyword("async");n&&(this.context.inIteration&&this.tolerateError(Fq),this.nextToken()),this.expectKeyword("function");const r=this.match("*");let s;r&&this.nextToken();let i,o=null;if(!t||!this.match("(")){const t=this.lookahead;o=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,wI):this.scanner.isRestrictedWord(t.value)?(i=t,s=wI):this.scanner.isStrictModeReservedWord(t.value)&&(i=t,s=kI)}const a=this.context.isAsync,u=this.context.allowYield;this.context.isAsync=n,this.context.allowYield=!r;const c=this.parseFormalParameters(i),l=c.params,h=c.stricted;i=c.firstRestricted,c.message&&(s=c.message);const f=this.context.strict,p=this.context.allowStrictDirective;this.context.allowStrictDirective=c.simple;const d=this.parseFunctionSourceElements();return this.context.strict&&i&&this.throwUnexpectedToken(i,s),this.context.strict&&h&&this.tolerateUnexpectedToken(h,s),this.context.strict=f,this.context.allowStrictDirective=p,this.context.isAsync=a,this.context.allowYield=u,n?this.finalize(e,new ZL(o,l,d,r)):this.finalize(e,new _B(o,l,d,r))}parseFunctionExpression(){const t=this.createNode(),e=this.matchContextualKeyword("async");e&&this.nextToken(),this.expectKeyword("function");const n=this.match("*");let r;n&&this.nextToken();let s,i=null;const o=this.context.isAsync,a=this.context.allowYield;if(this.context.isAsync=e,this.context.allowYield=!n,!this.match("(")){const t=this.lookahead;i=this.context.strict||n||!this.matchKeyword("yield")?this.parseVariableIdentifier():this.parseIdentifierName(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,wI):this.scanner.isRestrictedWord(t.value)?(s=t,r=wI):this.scanner.isStrictModeReservedWord(t.value)&&(s=t,r=kI)}const u=this.parseFormalParameters(s),c=u.params,l=u.stricted;s=u.firstRestricted,u.message&&(r=u.message);const h=this.context.strict,f=this.context.allowStrictDirective;this.context.allowStrictDirective=u.simple;const p=this.parseFunctionSourceElements();return this.context.strict&&s&&this.throwUnexpectedToken(s,r),this.context.strict&&l&&this.tolerateUnexpectedToken(l,r),this.context.strict=h,this.context.allowStrictDirective=f,this.context.isAsync=o,this.context.allowYield=a,this.finalize(t,new FB(i,c,p,n,e))}parseDirective(){const t=this.lookahead,e=this.createNode(),n=this.parseExpression(),r=n.type===qL.Literal?this.getTokenRaw(t).slice(1,-1):null;return this.consumeSemicolon(),this.finalize(e,r?new mB(n,r):new DB(n))}parseDirectivePrologues(){let t=null;const e=[];for(;;){const n=this.lookahead;if(8!==n.type)break;const r=this.parseDirective();e.push(r);const s=r.directive;if("string"!=typeof s)break;"use strict"===s?(this.context.strict=!0,t&&this.tolerateUnexpectedToken(t,AI),this.context.allowStrictDirective||this.tolerateUnexpectedToken(n,Vq)):!t&&n.octal&&(t=n)}return e}qualifiedPropertyName(t){switch(t.type){case 3:case 8:case 1:case 5:case 6:case 4:return!0;case 7:return"["===t.value}return!1}parseGetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();r.params.length>0&&this.tolerateError(Tq);const s=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new FB(null,r.params,s,e,!1))}parseSetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();1!==r.params.length?this.tolerateError(Mq):r.params[0]instanceof ZB&&this.tolerateError(Oq);const s=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new FB(null,r.params,s,e,!1))}parseGeneratorMethod(){const t=this.createNode(),e=this.context.allowYield;this.context.allowYield=!0;const n=this.parseFormalParameters();this.context.allowYield=!1;const r=this.parsePropertyMethod(n);return this.context.allowYield=e,this.finalize(t,new FB(null,n.params,r,!0,!1))}isStartOfExpression(){let t=!0;const e=this.lookahead.value;switch(this.lookahead.type){case 7:t="["===e||"("===e||"{"===e||"+"===e||"-"===e||"!"===e||"~"===e||"++"===e||"--"===e||"/"===e||"/="===e;break;case 4:t="class"===e||"delete"===e||"function"===e||"let"===e||"new"===e||"super"===e||"this"===e||"typeof"===e||"void"===e||"yield"===e}return t}parseYieldExpression(){const t=this.createNode();this.expectKeyword("yield");let e=null,n=!1;if(!this.hasLineTerminator){const t=this.context.allowYield;this.context.allowYield=!1,n=this.match("*"),n?(this.nextToken(),e=this.parseAssignmentExpression()):this.isStartOfExpression()&&(e=this.parseAssignmentExpression()),this.context.allowYield=t}return this.finalize(t,new Sq(e,n))}parseClassElement(t){let e=this.lookahead;const n=this.createNode();let r="",s=null,i=null,o=!1,a=!1,u=!1,c=!1,l=!1;if(this.match("*"))this.nextToken();else{o=this.match("["),s=this.parseObjectPropertyKey();if("static"===s.name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(e=this.lookahead,u=!0,o=this.match("["),this.match("*")?this.nextToken():s=this.parseObjectPropertyKey()),3===e.type&&!this.hasLineTerminator&&"async"===e.value){const t=this.lookahead.value;":"!==t&&"("!==t&&(c=!0,l=this.match("*"),l&&this.nextToken(),e=this.lookahead,o=this.match("["),s=this.parseObjectPropertyKey(),3===e.type&&"constructor"===e.value&&this.tolerateUnexpectedToken(e,Lq))}}const h=this.qualifiedPropertyName(this.lookahead);if(3===e.type?"get"===e.value&&h?(r="get",o=this.match("["),s=this.parseObjectPropertyKey(),this.context.allowYield=!1,i=this.parseGetterMethod()):"set"===e.value&&h&&(r="set",o=this.match("["),s=this.parseObjectPropertyKey(),i=this.parseSetterMethod()):7===e.type&&"*"===e.value&&h&&(r="init",o=this.match("["),s=this.parseObjectPropertyKey(),i=this.parseGeneratorMethod(),a=!0),!r&&s&&this.match("(")){const t=this.context.inClassConstructor;this.context.inClassConstructor="constructor"===e.value,r="init",i=c?this.parsePropertyMethodAsyncFunction(l):this.parsePropertyMethodFunction(l),this.context.inClassConstructor=t,a=!0}return r||this.throwUnexpectedToken(this.lookahead),"init"===r&&(r="method"),o||(u&&this.isPropertyKey(s,"prototype")&&this.throwUnexpectedToken(e,mI),!u&&this.isPropertyKey(s,"constructor")&&(("method"!==r||!a||i&&i.generator)&&this.throwUnexpectedToken(e,Bq),t.value?this.throwUnexpectedToken(e,Uq):t.value=!0,r="constructor")),this.finalize(n,new WB(s,o,i,r,u))}parseClassElementList(){const t=[],e={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():t.push(this.parseClassElement(e));return this.expect("}"),t}parseClassBody(){const t=this.createNode(),e=this.parseClassElementList();return this.finalize(t,new cB(e))}parseClassDeclaration(t){const e=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");const r=t&&3!==this.lookahead.type?null:this.parseVariableIdentifier();let s=null;this.matchKeyword("extends")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));const i=this.parseClassBody();return this.context.strict=n,this.finalize(e,new lB(r,s,i))}parseClassExpression(){const t=this.createNode(),e=this.context.strict;this.context.strict=!0,this.expectKeyword("class");const n=3===this.lookahead.type?this.parseVariableIdentifier():null;let r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));const s=this.parseClassBody();return this.context.strict=e,this.finalize(t,new hB(n,r,s))}parseModule(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new XB(e))}parseScript(){const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new eq(e))}parseModuleSpecifier(){const t=this.createNode();8!==this.lookahead.type&&this.throwError(nI);const e=this.nextToken(),n=this.getTokenRaw(e);return this.finalize(t,new PB(e.value,n))}parseImportSpecifier(){const t=this.createNode();let e,n;return 3===this.lookahead.type?(e=this.parseVariableIdentifier(),n=e,this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseVariableIdentifier())):(e=this.parseIdentifierName(),n=e,this.matchContextualKeyword("as")?(this.nextToken(),n=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(t,new qB(n,e))}parseNamedImports(){this.expect("{");const t=[];for(;!this.match("}");)t.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),t}parseImportDefaultSpecifier(){const t=this.createNode(),e=this.parseIdentifierName();return this.finalize(t,new LB(e))}parseImportNamespaceSpecifier(){const t=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(lI),this.nextToken();const e=this.parseIdentifierName();return this.finalize(t,new BB(e))}parseImportDeclaration(){this.context.inFunctionBody&&this.throwError(Gq);const t=this.createNode();let e;this.expectKeyword("import");let n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){const t=this.lookahead.value?II:aI;this.throwError(t,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(t,new NB(n,e))}parseExportSpecifier(){const t=this.createNode(),e=this.parseIdentifierName();let n=e;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(t,new vB(e,n))}parseExportDeclaration(){this.context.inFunctionBody&&this.throwError(Jq);const t=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default")){if(this.nextToken(),this.matchKeyword("function")){const e=this.parseFunctionDeclaration(!0);return this.finalize(t,new wB(e))}if(this.matchKeyword("class")){const e=this.parseClassDeclaration(!0);return this.finalize(t,new wB(e))}if(this.matchContextualKeyword("async")){const e=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();return this.finalize(t,new wB(e))}{this.matchContextualKeyword("from")&&this.throwError(II,this.lookahead.value);const e=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();return this.consumeSemicolon(),this.finalize(t,new wB(e))}}if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){const t=this.lookahead.value?II:aI;this.throwError(t,this.lookahead.value)}this.nextToken();const e=this.parseModuleSpecifier();return this.consumeSemicolon(),this.finalize(t,new yB(e))}if(4!==this.lookahead.type){if(this.matchAsyncFunction()){const e=this.parseFunctionDeclaration();return this.finalize(t,new EB(e,[],null))}{const e=[];let n=null,r=!1;for(this.expect("{");!this.match("}");)r=r||this.matchKeyword("default"),e.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),n=this.parseModuleSpecifier(),this.consumeSemicolon();else if(r){const t=this.lookahead.value?II:aI;this.throwError(t,this.lookahead.value)}else this.consumeSemicolon();return this.finalize(t,new EB(null,e,n))}}switch(this.lookahead.value){case"let":case"const":{const e=this.parseLexicalDeclaration({inFor:!1});return this.finalize(t,new EB(e,[],null))}case"var":{const e=this.parseVariableStatement();return this.finalize(t,new EB(e,[],null))}case"class":{const e=this.parseClassDeclaration();return this.finalize(t,new EB(e,[],null))}case"function":{const e=this.parseFunctionDeclaration();return this.finalize(t,new EB(e,[],null))}default:this.throwUnexpectedToken(this.lookahead)}}};class eP{attach;comments;stack;leading;trailing;constructor(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}insertInnerComments(t,e){if(rB(t)&&0===t.body.length){const n=[];for(let t=this.leading.length-1;t>=0;--t){const r=this.leading[t];e.end.offset>=r.start&&(n.unshift(r.comment),this.leading.splice(t,1),this.trailing.splice(t,1))}n.length&&(t.innerComments=n)}}findTrailingComments(t){let e=[];if(this.trailing.length>0){for(let n=this.trailing.length-1;n>=0;--n){const r=this.trailing[n];r.start>=t.end.offset&&e.unshift(r.comment)}return this.trailing.length=0,e}const n=this.stack[this.stack.length-1];if(n&&n.node.trailingComments){const r=n.node.trailingComments[0];r&&Array.isArray(r.range)&&r.range[0]>=t.end.offset&&(e=n.node.trailingComments,delete n.node.trailingComments)}return e}findLeadingComments(t){const e=[];let n;for(;this.stack.length>0;){const e=this.stack[this.stack.length-1];if(!(e&&e.start>=t.start.offset))break;n=e.node,this.stack.pop()}if(n){if(n.leadingComments){for(let r=(n.leadingComments?n.leadingComments.length:0)-1;r>=0;--r){const s=n.leadingComments[r];Array.isArray(s.range)&&s.range[1]<=t.start.offset&&(e.unshift(s),n.leadingComments.splice(r,1))}}return n.leadingComments&&0===n.leadingComments.length&&delete n.leadingComments,e}for(let n=this.leading.length-1;n>=0;--n){const r=this.leading[n];r.start<=t.start.offset&&(e.unshift(r.comment),this.leading.splice(n,1))}return e}visitNode(t,e){if(nq(t)&&t.body.length>0)return;this.insertInnerComments(t,e);const n=this.findTrailingComments(e),r=this.findLeadingComments(e);Array.isArray(r)&&r.length>0&&(t.leadingComments=r),n.length>0&&(t.trailingComments=n),this.stack.push({node:t,start:e.start.offset})}visitComment(t,e){const n=ZI(t)?"Line":"Block",r={type:n,value:t.value};if(t.range&&(r.range=t.range),t.loc&&(r.loc=t.loc),this.comments.push(r),this.attach){const r={comment:{type:n,value:t.value,range:[e.start.offset,e.end.offset]},start:e.start.offset};t.loc&&(r.comment.loc=t.loc),this.leading.push(r),this.trailing.push(r)}}visit(t,e){ZI(t)?this.visitComment(t,e):!function(t){return t.type==qL.BlockComment}(t)?this.attach&&this.visitNode(t,e):this.visitComment(t,e)}}const nP="JSXAttribute",rP="JSXClosingElement",sP="JSXClosingFragment",iP="JSXElement",oP="JSXEmptyExpression",aP="JSXExpressionContainer",uP="JSXIdentifier",cP="JSXMemberExpression",lP="JSXNamespacedName",hP="JSXOpeningElement",fP="JSXOpeningFragment",pP="JSXSpreadAttribute",dP="JSXText";class mP{type;name;constructor(t){this.type=rP,this.name=t}}class gP{type;constructor(){this.type=sP}}class xP{type;openingElement;children;closingElement;constructor(t,e,n){this.type=iP,this.openingElement=t,this.children=e,this.closingElement=n}}class yP{type;constructor(){this.type=oP}}class wP{type;expression;constructor(t){this.type=aP,this.expression=t}}class EP{type;name;constructor(t){this.type=uP,this.name=t}}class vP{type;object;property;constructor(t,e){this.type=cP,this.object=t,this.property=e}}class DP{type;name;value;constructor(t,e){this.type=nP,this.name=t,this.value=e}}class bP{type;namespace;name;constructor(t,e){this.type=lP,this.namespace=t,this.name=e}}class AP{type;name;selfClosing;attributes;constructor(t,e,n){this.type=hP,this.name=t,this.selfClosing=e,this.attributes=n}}class SP{type;selfClosing;constructor(t){this.type=fP,this.selfClosing=t}}class kP{type;argument;constructor(t){this.type=pP,this.argument=t}}class _P{type;value;raw;constructor(t,e){this.type=dP,this.value=t,this.raw=e}}const FP={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"};function CP(t){switch(t.type){case uP:return t.name;case lP:{const e=t;return CP(e.namespace)+":"+CP(e.name)}case cP:{const e=t;return CP(e.object)+"."+CP(e.property)}default:throw new Error("getQualifiedElementName")}}class TP extends tP{constructor(t,e,n){super(t,e,n)}parsePrimaryExpression(){return this.match("<")?this.parseJSXRoot():super.parsePrimaryExpression()}startJSX(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column}finishJSX(){return this.nextToken()}reenterJSX(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()}createJSXNode(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}createJSXChildNode(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}scanXHTMLEntity(t){let e="&",n=!0,r=!1,s=!1,i=!1;for(;!this.scanner.eof()&&n&&!r;){const o=this.scanner.source[this.scanner.index];if(o===t)break;if(r=";"===o,e+=o,++this.scanner.index,!r)switch(e.length){case 2:s="#"===o;break;case 3:s&&(i="x"===o,n=i||zI.isDecimalDigit(o.charCodeAt(0)),s=s&&!i);break;default:n=n&&!(s&&!zI.isDecimalDigit(o.charCodeAt(0))),n=n&&!(i&&!zI.isHexDigit(o.charCodeAt(0)))}}if(n&&r&&e.length>2){const t=e.substr(1,e.length-2);s&&t.length>1?e=String.fromCharCode(parseInt(t.substr(1),10)):i&&t.length>2?e=String.fromCharCode(parseInt("0"+t.substr(1),16)):s||i||!FP[t]||(e=FP[t])}return e}lexJSX(){const t=this.scanner.source.charCodeAt(this.scanner.index);if(60===t||62===t||47===t||58===t||61===t||123===t||125===t){return{type:7,value:this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===t||39===t){const t=this.scanner.index,e=this.scanner.source[this.scanner.index++];let n="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index++];if(t===e)break;n+="&"===t?this.scanXHTMLEntity(e):t}return{type:8,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===t){const t=this.scanner.source.charCodeAt(this.scanner.index+1),e=this.scanner.source.charCodeAt(this.scanner.index+2),n=46===t&&46===e?"...":".",r=this.scanner.index;return this.scanner.index+=n.length,{type:7,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(96===t)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(zI.isIdentifierStart(t)&&92!==t){const t=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){const t=this.scanner.source.charCodeAt(this.scanner.index);if(zI.isIdentifierPart(t)&&92!==t)++this.scanner.index;else{if(45!==t)break;++this.scanner.index}}return{type:11,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()}nextJSXToken(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(t)),t}nextJSXText(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.scanner.index;let e="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index];if("{"===t||"<"===t)break;++this.scanner.index,e+=t,zI.isLineTerminator(t.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===t&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;const n={type:12,value:e,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index};return e.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n}peekJSXToken(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.lexJSX();return this.scanner.restoreState(t),e}expectJSX(t){const e=this.nextJSXToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}matchJSX(t){const e=this.peekJSXToken();return 7===e.type&&e.value===t}parseJSXIdentifier(){const t=this.createJSXNode(),e=this.nextJSXToken();return 11!==e.type&&this.throwUnexpectedToken(e),this.finalize(t,new EP(e.value))}parseJSXElementName(){const t=this.createJSXNode(),e=this.parseJSXIdentifier();if(this.matchJSX(":")){const n=e;this.expectJSX(":");const r=this.parseJSXIdentifier();return this.finalize(t,new bP(n,r))}if(this.matchJSX(".")){let n=e;for(;this.matchJSX(".");){this.expectJSX(".");const e=this.parseJSXIdentifier();n=this.finalize(t,new vP(n,e))}return n}return e}parseJSXAttributeName(){const t=this.createJSXNode();let e;const n=this.parseJSXIdentifier();if(this.matchJSX(":")){const r=n;this.expectJSX(":");const s=this.parseJSXIdentifier();e=this.finalize(t,new bP(r,s))}else e=n;return e}parseJSXStringLiteralAttribute(){const t=this.createJSXNode(),e=this.nextJSXToken();8!==e.type&&this.throwUnexpectedToken(e);const n=this.getTokenRaw(e);return this.finalize(t,new PB(e.value,n))}parseJSXExpressionAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new wP(e))}parseJSXAttributeValue(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()}parseJSXNameValueAttribute(){const t=this.createJSXNode(),e=this.parseJSXAttributeName();let n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(t,new DP(e,n))}parseJSXSpreadAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new kP(e))}parseJSXAttributes(){const t=[];for(;!this.matchJSX("/")&&!this.matchJSX(">");){const e=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();t.push(e)}return t}parseJSXOpeningElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new SP(!1));const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new AP(e,r,n))}parseJSXBoundaryElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){if(this.expectJSX("/"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new gP);const e=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(t,new mP(e))}const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new AP(e,r,n))}parseJSXEmptyExpression(){const t=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(t,new yP)}parseJSXExpressionContainer(){const t=this.createJSXNode();let e;return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new wP(e))}parseJSXChildren(){const t=[];for(;!this.scanner.eof();){const e=this.createJSXChildNode(),n=this.nextJSXText();if(n.start<n.end){const r=this.getTokenRaw(n),s=this.finalize(e,new _P(n.value,r));t.push(s)}if("{"!==this.scanner.source[this.scanner.index])break;{const e=this.parseJSXExpressionContainer();t.push(e)}}return t}parseComplexJSXElement(t){const e=[];for(;!this.scanner.eof();){t.children=t.children.concat(this.parseJSXChildren());const n=this.createJSXChildNode(),r=this.parseJSXBoundaryElement();if(r.type===hP){const s=r;if(s.selfClosing){const e=this.finalize(n,new xP(s,[],null));t.children.push(e)}else e.push(t),t={node:n,opening:s,closing:null,children:[]}}if(r.type===rP){t.closing=r;const n=CP(t.opening.name);if(n!==CP(t.closing.name)&&this.tolerateError("Expected corresponding JSX closing tag for %0",n),!(e.length>0))break;{const n=this.finalize(t.node,new xP(t.opening,t.children,t.closing));(t=e[e.length-1]).children.push(n),e.pop()}}if(r.type===sP){if(t.closing=r,t.opening.type===fP)break;this.tolerateError("Expected corresponding JSX closing tag for jsx fragment")}}return t}parseJSXElement(){const t=this.createJSXNode(),e=this.parseJSXOpeningElement();let n=[],r=null;if(!e.selfClosing){const s=this.parseComplexJSXElement({node:t,opening:e,closing:r,children:n});n=s.children,r=s.closing}return this.finalize(t,new xP(e,n,r))}parseJSXRoot(){this.config.tokens&&this.tokens.pop(),this.startJSX();const t=this.parseJSXElement();return this.finishJSX(),t}isStartOfExpression(){return super.isStartOfExpression()||this.match("<")}}var MP,OP=$L,NP=GL,LP=eB,BP=oB,qP=bB,IP=TB,PP=RB,RP=$B,UP=nq,$P=sq,zP=xq,WP=Eq,XP=Dq,KP=function(t,e={},n){const r=e||{};return r.sourceType="script",function(t,e,n){let r=null;const s=(t,e)=>{n&&n(t,e),r&&r.visit(t,e)};let i="function"==typeof n?s:void 0,o=!1;if(e){o="boolean"==typeof e.comment&&e.comment;const t="boolean"==typeof e.attachComment&&e.attachComment;(o||t)&&(r=new eP,r.attach=t,e.comment=!0,i=s)}let a,u=!1;e&&"string"==typeof e.sourceType&&(u="module"===e.sourceType),a=e&&"boolean"==typeof e.jsx&&e.jsx?new TP(t,e,i):new tP(t,e,i);const c=u?a.parseModule():a.parseScript();return o&&r&&(c.comments=r.comments),a.config.tokens&&(c.tokens=a.tokens),a.config.tolerant&&(c.errors=a.errorHandler.errors),c}(t,r,n)};function HP(t){switch(t){case")":case";":case",":case"=":case"]":return 0;case"??":return 5;case"||":return 6;case"&&":return 7;case"&":return 10;case"==":case"!=":case"===":case"!==":return 11;case"<":case">":case"<=":case">=":return 12;case">>>":return 13;case"+":case"-":return 14;case"*":case"/":return 15;case"^":return 16;case"|":return 17;case"<<":case">>":return 18;case"%":return 19;default:throw new Error}}function JP(t,e,n,r){e(t)}function GP(n){const r={attachComment:!1,comment:!1,jsx:!1,loc:!1,range:!1,operatorPrecedence:HP},s=new du;try{const i=function(n){if(IP(n))s.push(f(n.name));else if(LP(n)){s.push(function(n){switch(n){case"+":return t(e.add);case"-":return t(e.subtract);case"*":return t(e.multiply);case"/":return t(e.divide);case"|":return t(e.inner);case"^":return t(e.outer);case"<<":return t(e.lco);case">>":return t(e.rco);case"**":return t(e.pow);default:throw new Error(n)}}(n.operator)),JP(n.left,i),JP(n.right,i);const r=s.pop(),o=s.pop(),a=s.pop();if(Aa(a))switch(a.id){case e.divide:{const n=At(t(e.pow),r,y(-1));s.push(At(t(e.multiply),o,n));break}case e.subtract:{const n=At(t(e.multiply),y(-1),r);s.push(At(t(e.add),o,n));break}default:s.push(At(a,o,r))}}else if(PP(n))if("number"==typeof n.value)Number.isInteger(n.value)?n.raw.indexOf(".")>0?s.push(X(n.value)):s.push(y(n.value)):s.push(X(n.value));else if("string"==typeof n.value)s.push(Q(n.value));else if("boolean"==typeof n.value)s.push(st(n.value));else{if("object"!=typeof n.value)throw new Error;null===n.value&&s.push(kt)}else if(NP(n)){s.push(t(e.assign)),JP(n.left,i),JP(n.right,i);const r=s.pop(),o=s.pop(),a=s.pop();s.push(At(a,o,r))}else if(BP(n)){const t=[];JP(n.callee,i),t.push(s.pop()),n.arguments.forEach((e=>{JP(e,i),t.push(s.pop())})),s.push(At(...t))}else if(WP(n))n.declarations.forEach((t=>{JP(t,i)}));else if(XP(n))if(s.push(t(e.def)),JP(n.id,i),n.init){JP(n.init,i);const r=s.pop(),o=s.pop(),a=At(t(e.assign),o,r),u=s.pop();s.push(At(u,a))}else{const t=s.pop(),e=s.pop();s.push(At(e,t))}else if(OP(n)){const t=[];n.elements.forEach((e=>{e&&(JP(e,i),t.push(s.pop()))})),s.push(P(t))}else if(RP(n)){JP(n.object,i);const r=s.pop();JP(n.property,i);const o=s.pop();if(_t(o)){const n=Tt(r,o),i=Tt(t(e.component),n);s.push(i)}else if(St(o)){const n=At(r,o),i=Tt(t(e.component),n);s.push(i)}}else if($P(n)){const t=[];n.expressions.forEach((e=>{JP(e,i),t.push(s.pop())})),s.push(At(...t))}else if(zP(n)){JP(n.argument,i);const r=s.pop();switch(n.operator){case"-":{const n=At(t(e.multiply),x(-1),r);s.push(n);break}default:throw new Error(`${n.operator}`)}}else if(qP(n))JP(n.expression,i);else{if(!UP(n))throw new Error(n.type);n.body.forEach((t=>{JP(t,i)}))}return n},o=KP(n,r);JP(o,i);const a=[];for(;s.length>0;)a.push(s.pop());return a.reverse(),{trees:a,errors:[]}}finally{s.release()}}function VP(t,e){if(!t)throw new Error(e)}function jP(t){VP(!1,t)}function QP(t){return"number"==typeof t}function ZP(t){return VP(void 0!==t),Array.isArray(t.children)?t.children.length:0}function YP(t,e){return VP(void 0!==e&&e>=0),tR(t)[e]}function tR(t){if(VP(void 0!==t),t.children)return t.children;throw new Error("node does not have any children")}function eR(t){return t.length-1}!function(t){t[t.T_ENDMARKER=0]="T_ENDMARKER",t[t.T_NAME=1]="T_NAME",t[t.T_NUMBER=2]="T_NUMBER",t[t.T_STRING=3]="T_STRING",t[t.T_NEWLINE=4]="T_NEWLINE",t[t.T_INDENT=5]="T_INDENT",t[t.T_DEDENT=6]="T_DEDENT",t[t.T_LPAR=7]="T_LPAR",t[t.T_RPAR=8]="T_RPAR",t[t.T_LSQB=9]="T_LSQB",t[t.T_RSQB=10]="T_RSQB",t[t.T_COLON=11]="T_COLON",t[t.T_COMMA=12]="T_COMMA",t[t.T_SEMI=13]="T_SEMI",t[t.T_PLUS=14]="T_PLUS",t[t.T_MINUS=15]="T_MINUS",t[t.T_STAR=16]="T_STAR",t[t.T_SLASH=17]="T_SLASH",t[t.T_VBAR=18]="T_VBAR",t[t.T_AMPER=19]="T_AMPER",t[t.T_LESS=20]="T_LESS",t[t.T_GREATER=21]="T_GREATER",t[t.T_EQUAL=22]="T_EQUAL",t[t.T_DOT=23]="T_DOT",t[t.T_PERCENT=24]="T_PERCENT",t[t.T_BACKQUOTE=25]="T_BACKQUOTE",t[t.T_LBRACE=26]="T_LBRACE",t[t.T_RBRACE=27]="T_RBRACE",t[t.T_EQEQUAL=28]="T_EQEQUAL",t[t.T_NOTEQUAL=29]="T_NOTEQUAL",t[t.T_LESSEQUAL=30]="T_LESSEQUAL",t[t.T_GREATEREQUAL=31]="T_GREATEREQUAL",t[t.T_TILDE=32]="T_TILDE",t[t.T_CIRCUMFLEX=33]="T_CIRCUMFLEX",t[t.T_LEFTSHIFT=34]="T_LEFTSHIFT",t[t.T_RIGHTSHIFT=35]="T_RIGHTSHIFT",t[t.T_DOUBLESTAR=36]="T_DOUBLESTAR",t[t.T_PLUSEQUAL=37]="T_PLUSEQUAL",t[t.T_MINEQUAL=38]="T_MINEQUAL",t[t.T_STAREQUAL=39]="T_STAREQUAL",t[t.T_SLASHEQUAL=40]="T_SLASHEQUAL",t[t.T_PERCENTEQUAL=41]="T_PERCENTEQUAL",t[t.T_AMPEREQUAL=42]="T_AMPEREQUAL",t[t.T_VBAREQUAL=43]="T_VBAREQUAL",t[t.T_CIRCUMFLEXEQUAL=44]="T_CIRCUMFLEXEQUAL",t[t.T_LEFTSHIFTEQUAL=45]="T_LEFTSHIFTEQUAL",t[t.T_RIGHTSHIFTEQUAL=46]="T_RIGHTSHIFTEQUAL",t[t.T_DOUBLESTAREQUAL=47]="T_DOUBLESTAREQUAL",t[t.T_DOUBLESLASH=48]="T_DOUBLESLASH",t[t.T_DOUBLESLASHEQUAL=49]="T_DOUBLESLASHEQUAL",t[t.T_AT=50]="T_AT",t[t.T_ATEQUAL=51]="T_ATEQUAL",t[t.T_OP=52]="T_OP",t[t.T_COMMENT=53]="T_COMMENT",t[t.T_NL=54]="T_NL",t[t.T_RARROW=55]="T_RARROW",t[t.T_AWAIT=56]="T_AWAIT",t[t.T_ASYNC=57]="T_ASYNC",t[t.T_ERRORTOKEN=58]="T_ERRORTOKEN",t[t.T_N_TOKENS=59]="T_N_TOKENS",t[t.T_NT_OFFSET=256]="T_NT_OFFSET"}(MP||(MP={}));const nR={"(":MP.T_LPAR,")":MP.T_RPAR,"[":MP.T_LSQB,"]":MP.T_RSQB,":":MP.T_COLON,",":MP.T_COMMA,";":MP.T_SEMI,"+":MP.T_PLUS,"-":MP.T_MINUS,"*":MP.T_STAR,"/":MP.T_SLASH,"|":MP.T_VBAR,"&":MP.T_AMPER,"<":MP.T_LESS,">":MP.T_GREATER,"=":MP.T_EQUAL,".":MP.T_DOT,"%":MP.T_PERCENT,"`":MP.T_BACKQUOTE,"{":MP.T_LBRACE,"}":MP.T_RBRACE,"@":MP.T_AT,"==":MP.T_EQEQUAL,"!=":MP.T_NOTEQUAL,"<>":MP.T_NOTEQUAL,"<=":MP.T_LESSEQUAL,">=":MP.T_GREATEREQUAL,"~":MP.T_TILDE,"^":MP.T_CIRCUMFLEX,"<<":MP.T_LEFTSHIFT,">>":MP.T_RIGHTSHIFT,"**":MP.T_DOUBLESTAR,"+=":MP.T_PLUSEQUAL,"-=":MP.T_MINEQUAL,"*=":MP.T_STAREQUAL,"/=":MP.T_SLASHEQUAL,"%=":MP.T_PERCENTEQUAL,"&=":MP.T_AMPEREQUAL,"|=":MP.T_VBAREQUAL,"^=":MP.T_CIRCUMFLEXEQUAL,"<<=":MP.T_LEFTSHIFTEQUAL,">>=":MP.T_RIGHTSHIFTEQUAL,"**=":MP.T_DOUBLESTAREQUAL,"//":MP.T_DOUBLESLASH,"//=":MP.T_DOUBLESLASHEQUAL,"->":MP.T_RARROW},rR={sym:{AndExpr:257,ArithmeticExpr:258,AtomExpr:259,BitwiseAndExpr:260,BitwiseOrExpr:261,BitwiseXorExpr:262,ComparisonExpr:263,ExprList:264,ExprStmt:265,GeometricExpr:266,GlobalStmt:267,IfExpr:268,ImportList:269,ImportSpecifier:270,LambdaExpr:271,ModuleSpecifier:272,NonLocalStmt:273,NotExpr:274,OrExpr:275,PowerExpr:276,ShiftExpr:277,UnaryExpr:278,YieldExpr:279,annasign:280,arglist:281,argument:282,assert_stmt:283,augassign:284,break_stmt:285,classdef:286,comp_op:287,compound_stmt:288,continue_stmt:289,decorated:290,decorator:291,decorators:292,del_stmt:293,dictmaker:294,dotted_as_name:295,dotted_as_names:296,dotted_name:297,encoding_decl:298,eval_input:299,except_clause:300,exec_stmt:301,file_input:302,flow_stmt:303,for_stmt:304,fpdef:305,fplist:306,funcdef:307,gen_for:308,gen_if:309,gen_iter:310,if_stmt:311,import_from:312,import_name:313,import_stmt:314,list_for:315,list_if:316,list_iter:317,listmaker:318,old_LambdaExpr:319,old_test:320,parameters:321,pass_stmt:322,print_stmt:323,raise_stmt:324,return_stmt:325,simple_stmt:326,single_input:256,sliceop:327,small_stmt:328,stmt:329,subscript:330,subscriptlist:331,suite:332,testlist:333,testlist1:334,testlist_gexp:335,testlist_safe:336,trailer:337,try_stmt:338,varargslist:339,while_stmt:340,with_stmt:341,with_var:342,yield_stmt:343},number2symbol:{256:"single_input",257:"AndExpr",258:"ArithmeticExpr",259:"AtomExpr",260:"BitwiseAndExpr",261:"BitwiseOrExpr",262:"BitwiseXorExpr",263:"ComparisonExpr",264:"ExprList",265:"ExprStmt",266:"GeometricExpr",267:"GlobalStmt",268:"IfExpr",269:"ImportList",270:"ImportSpecifier",271:"LambdaExpr",272:"ModuleSpecifier",273:"NonLocalStmt",274:"NotExpr",275:"OrExpr",276:"PowerExpr",277:"ShiftExpr",278:"UnaryExpr",279:"YieldExpr",280:"annasign",281:"arglist",282:"argument",283:"assert_stmt",284:"augassign",285:"break_stmt",286:"classdef",287:"comp_op",288:"compound_stmt",289:"continue_stmt",290:"decorated",291:"decorator",292:"decorators",293:"del_stmt",294:"dictmaker",295:"dotted_as_name",296:"dotted_as_names",297:"dotted_name",298:"encoding_decl",299:"eval_input",300:"except_clause",301:"exec_stmt",302:"file_input",303:"flow_stmt",304:"for_stmt",305:"fpdef",306:"fplist",307:"funcdef",308:"gen_for",309:"gen_if",310:"gen_iter",311:"if_stmt",312:"import_from",313:"import_name",314:"import_stmt",315:"list_for",316:"list_if",317:"list_iter",318:"listmaker",319:"old_LambdaExpr",320:"old_test",321:"parameters",322:"pass_stmt",323:"print_stmt",324:"raise_stmt",325:"return_stmt",326:"simple_stmt",327:"sliceop",328:"small_stmt",329:"stmt",330:"subscript",331:"subscriptlist",332:"suite",333:"testlist",334:"testlist1",335:"testlist_gexp",336:"testlist_safe",337:"trailer",338:"try_stmt",339:"varargslist",340:"while_stmt",341:"with_stmt",342:"with_var",343:"yield_stmt"},dfas:{256:[[[[1,1],[2,1],[3,2]],[[0,1]],[[1,1]]],{1:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1}],257:[[[[38,1]],[[39,0],[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],258:[[[[40,1]],[[5,0],[6,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],259:[[[[8,1],[9,2],[10,3],[11,4],[12,5],[13,5],[14,6]],[[41,7],[42,7],[43,5]],[[44,8],[45,5]],[[46,9],[47,5]],[[48,10]],[[0,5]],[[14,6],[0,6]],[[43,5]],[[45,5]],[[47,5]],[[11,5]]],{8:1,9:1,10:1,11:1,12:1,13:1,14:1}],260:[[[[49,1]],[[50,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],261:[[[[51,1]],[[52,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],262:[[[[53,1]],[[54,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],263:[[[[55,1]],[[56,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],264:[[[[55,1]],[[57,2],[0,1]],[[55,1],[0,2]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],265:[[[[58,1]],[[59,2],[60,3],[61,4],[0,1]],[[0,2]],[[41,2],[58,2]],[[41,5],[58,5]],[[61,4],[0,5]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],266:[[[[62,1]],[[63,0],[64,0],[65,0],[66,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],267:[[[[26,1]],[[12,2]],[[57,1],[0,2]]],{26:1}],268:[[[[67,1],[68,2]],[[30,3],[0,1]],[[0,2]],[[67,4]],[[69,5]],[[70,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],269:[[[[71,1]],[[57,2],[0,1]],[[71,1],[0,2]]],{12:1}],270:[[[[12,1]],[[72,2],[0,1]],[[12,3]],[[0,3]]],{12:1}],271:[[[[15,1]],[[73,2],[74,3]],[[74,3]],[[70,4]],[[0,4]]],{15:1}],272:[[[[14,1]],[[0,1]]],{14:1}],273:[[[[27,1]],[[12,2]],[[57,1],[0,2]]],{27:1}],274:[[[[4,1],[75,2]],[[38,2]],[[0,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],275:[[[[76,1]],[[77,0],[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],276:[[[[78,1]],[[79,1],[80,2],[0,1]],[[49,3]],[[0,3]]],{8:1,9:1,10:1,11:1,12:1,13:1,14:1}],277:[[[[81,1]],[[82,0],[83,0],[0,1]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],278:[[[[5,1],[6,1],[7,1],[84,2]],[[49,2]],[[0,2]]],{5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1}],279:[[[[23,1]],[[58,2],[0,1]],[[0,2]]],{23:1}],280:[[[[74,1]],[[70,2]],[[61,3],[0,2]],[[70,4]],[[0,4]]],{74:1}],281:[[[[85,1],[63,2],[80,3]],[[57,4],[0,1]],[[70,5]],[[70,6]],[[85,1],[63,2],[80,3],[0,4]],[[57,7],[0,5]],[[0,6]],[[85,5],[80,3]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,63:1,80:1}],282:[[[[70,1]],[[86,2],[61,3],[0,1]],[[0,2]],[[70,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],283:[[[[29,1]],[[70,2]],[[57,3],[0,2]],[[70,4]],[[0,4]]],{29:1}],284:[[[[87,1],[88,1],[89,1],[90,1],[91,1],[92,1],[93,1],[94,1],[95,1],[96,1],[97,1],[98,1]],[[0,1]]],{87:1,88:1,89:1,90:1,91:1,92:1,93:1,94:1,95:1,96:1,97:1,98:1}],285:[[[[19,1]],[[0,1]]],{19:1}],286:[[[[36,1]],[[12,2]],[[8,3],[74,4]],[[58,5],[43,6]],[[99,7]],[[43,6]],[[74,4]],[[0,7]]],{36:1}],287:[[[[100,1],[101,1],[102,1],[103,1],[104,1],[105,1],[105,1],[106,1],[4,2],[107,3]],[[0,1]],[[106,1]],[[4,1],[0,3]]],{4:1,100:1,101:1,102:1,103:1,104:1,105:1,106:1,107:1}],288:[[[[108,1],[109,1],[110,1],[111,1],[112,1],[113,1],[114,1],[115,1]],[[0,1]]],{30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1}],289:[[[[20,1]],[[0,1]]],{20:1}],290:[[[[116,1]],[[114,2],[113,2]],[[0,2]]],{37:1}],291:[[[[37,1]],[[117,2]],[[8,3],[1,4]],[[118,5],[43,6]],[[0,4]],[[43,6]],[[1,4]]],{37:1}],292:[[[[119,1]],[[119,1],[0,1]]],{37:1}],293:[[[[17,1]],[[120,2]],[[0,2]]],{17:1}],294:[[[[70,1]],[[74,2]],[[70,3]],[[57,4],[0,3]],[[70,1],[0,4]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],295:[[[[117,1]],[[72,2],[0,1]],[[12,3]],[[0,3]]],{12:1}],296:[[[[121,1]],[[57,0],[0,1]]],{12:1}],297:[[[[12,1]],[[122,0],[0,1]]],{12:1}],298:[[[[12,1]],[[0,1]]],{12:1}],299:[[[[58,1]],[[1,1],[123,2]],[[0,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],300:[[[[124,1]],[[70,2],[0,1]],[[72,3],[57,3],[0,2]],[[70,4]],[[0,4]]],{124:1}],301:[[[[28,1]],[[55,2]],[[106,3],[0,2]],[[70,4]],[[57,5],[0,4]],[[70,6]],[[0,6]]],{28:1}],302:[[[[1,0],[125,0],[123,1]],[[0,1]]],{1:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1,123:1}],303:[[[[126,1],[127,1],[128,1],[129,1],[130,1]],[[0,1]]],{19:1,20:1,21:1,22:1,23:1}],304:[[[[32,1]],[[120,2]],[[106,3]],[[58,4]],[[74,5]],[[99,6]],[[69,7],[0,6]],[[74,8]],[[99,9]],[[0,9]]],{32:1}],305:[[[[12,1],[8,2]],[[74,3],[0,1]],[[131,4]],[[70,5]],[[43,5]],[[0,5]]],{8:1,12:1}],306:[[[[132,1]],[[57,2],[0,1]],[[132,1],[0,2]]],{8:1,12:1}],307:[[[[35,1]],[[12,2]],[[133,3]],[[134,4],[74,5]],[[70,6]],[[99,7]],[[74,5]],[[0,7]]],{35:1}],308:[[[[32,1]],[[120,2]],[[106,3]],[[67,4]],[[135,5],[0,4]],[[0,5]]],{32:1}],309:[[[[30,1]],[[136,2]],[[135,3],[0,2]],[[0,3]]],{30:1}],310:[[[[86,1],[137,1]],[[0,1]]],{30:1,32:1}],311:[[[[30,1]],[[70,2]],[[74,3]],[[99,4]],[[138,1],[69,5],[0,4]],[[74,6]],[[99,7]],[[0,7]]],{30:1}],312:[[[[25,1]],[[139,2]],[[24,3]],[[63,4],[8,5],[140,4]],[[0,4]],[[140,6]],[[43,4]]],{25:1}],313:[[[[24,1]],[[141,2]],[[0,2]]],{24:1}],314:[[[[142,1],[143,1]],[[0,1]]],{24:1,25:1}],315:[[[[32,1]],[[120,2]],[[106,3]],[[144,4]],[[145,5],[0,4]],[[0,5]]],{32:1}],316:[[[[30,1]],[[136,2]],[[145,3],[0,2]],[[0,3]]],{30:1}],317:[[[[146,1],[147,1]],[[0,1]]],{30:1,32:1}],318:[[[[70,1]],[[146,2],[57,3],[0,1]],[[0,2]],[[70,4],[0,3]],[[57,3],[0,4]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],319:[[[[15,1]],[[73,2],[74,3]],[[74,3]],[[136,4]],[[0,4]]],{15:1}],320:[[[[67,1],[148,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],321:[[[[8,1]],[[73,2],[43,3]],[[43,3]],[[0,3]]],{8:1}],322:[[[[18,1]],[[0,1]]],{18:1}],323:[[[[16,1]],[[70,2],[83,3],[0,1]],[[57,4],[0,2]],[[70,5]],[[70,2],[0,4]],[[57,6],[0,5]],[[70,7]],[[57,8],[0,7]],[[70,7],[0,8]]],{16:1}],324:[[[[22,1]],[[70,2],[0,1]],[[57,3],[0,2]],[[70,4]],[[57,5],[0,4]],[[70,6]],[[0,6]]],{22:1}],325:[[[[21,1]],[[58,2],[0,1]],[[0,2]]],{21:1}],326:[[[[149,1]],[[150,2],[1,3]],[[149,1],[1,3]],[[0,3]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1}],327:[[[[74,1]],[[70,2],[0,1]],[[0,2]]],{74:1}],328:[[[[151,1],[152,1],[153,1],[154,1],[155,1],[156,1],[157,1],[158,1],[159,1],[160,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1}],329:[[[[2,1],[3,1]],[[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1,30:1,31:1,32:1,33:1,34:1,35:1,36:1,37:1}],330:[[[[122,1],[70,2],[74,3]],[[122,4]],[[74,3],[0,2]],[[70,5],[161,6],[0,3]],[[122,6]],[[161,6],[0,5]],[[0,6]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,74:1,122:1}],331:[[[[162,1]],[[57,2],[0,1]],[[162,1],[0,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,74:1,122:1}],332:[[[[2,1],[1,2]],[[0,1]],[[163,3]],[[125,4]],[[125,4],[164,1]]],{1:1,4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1,16:1,17:1,18:1,19:1,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:1,28:1,29:1}],333:[[[[70,1]],[[57,2],[0,1]],[[70,1],[0,2]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],334:[[[[70,1]],[[57,0],[0,1]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],335:[[[[70,1]],[[86,2],[57,3],[0,1]],[[0,2]],[[70,4],[0,3]],[[57,3],[0,4]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],336:[[[[136,1]],[[57,2],[0,1]],[[136,3]],[[57,4],[0,3]],[[136,3],[0,4]]],{4:1,5:1,6:1,7:1,8:1,9:1,10:1,11:1,12:1,13:1,14:1,15:1}],337:[[[[8,1],[9,2],[122,3]],[[118,4],[43,5]],[[165,6]],[[12,5]],[[43,5]],[[0,5]],[[45,5]]],{8:1,9:1,122:1}],338:[[[[33,1]],[[74,2]],[[99,3]],[[166,4],[167,5]],[[74,6]],[[74,7]],[[99,8]],[[99,9]],[[166,4],[69,10],[167,5],[0,8]],[[0,9]],[[74,11]],[[99,12]],[[167,5],[0,12]]],{33:1}],339:[[[[132,1],[63,2],[80,3]],[[61,4],[57,5],[0,1]],[[12,6]],[[12,7]],[[70,8]],[[132,1],[63,2],[80,3],[0,5]],[[57,9],[0,6]],[[0,7]],[[57,5],[0,8]],[[80,3]]],{8:1,12:1,63:1,80:1}],340:[[[[31,1]],[[70,2]],[[74,3]],[[99,4]],[[69,5],[0,4]],[[74,6]],[[99,7]],[[0,7]]],{31:1}],341:[[[[34,1]],[[70,2]],[[168,3],[74,4]],[[74,4]],[[99,5]],[[0,5]]],{34:1}],342:[[[[72,1]],[[55,2]],[[0,2]]],{72:1}],343:[[[[41,1]],[[0,1]]],{23:1}]},states:[[[[1,1],[2,1],[3,2]],[[0,1]],[[1,1]]],[[[38,1]],[[39,0],[0,1]]],[[[40,1]],[[5,0],[6,0],[0,1]]],[[[8,1],[9,2],[10,3],[11,4],[12,5],[13,5],[14,6]],[[41,7],[42,7],[43,5]],[[44,8],[45,5]],[[46,9],[47,5]],[[48,10]],[[0,5]],[[14,6],[0,6]],[[43,5]],[[45,5]],[[47,5]],[[11,5]]],[[[49,1]],[[50,0],[0,1]]],[[[51,1]],[[52,0],[0,1]]],[[[53,1]],[[54,0],[0,1]]],[[[55,1]],[[56,0],[0,1]]],[[[55,1]],[[57,2],[0,1]],[[55,1],[0,2]]],[[[58,1]],[[59,2],[60,3],[61,4],[0,1]],[[0,2]],[[41,2],[58,2]],[[41,5],[58,5]],[[61,4],[0,5]]],[[[62,1]],[[63,0],[64,0],[65,0],[66,0],[0,1]]],[[[26,1]],[[12,2]],[[57,1],[0,2]]],[[[67,1],[68,2]],[[30,3],[0,1]],[[0,2]],[[67,4]],[[69,5]],[[70,2]]],[[[71,1]],[[57,2],[0,1]],[[71,1],[0,2]]],[[[12,1]],[[72,2],[0,1]],[[12,3]],[[0,3]]],[[[15,1]],[[73,2],[74,3]],[[74,3]],[[70,4]],[[0,4]]],[[[14,1]],[[0,1]]],[[[27,1]],[[12,2]],[[57,1],[0,2]]],[[[4,1],[75,2]],[[38,2]],[[0,2]]],[[[76,1]],[[77,0],[0,1]]],[[[78,1]],[[79,1],[80,2],[0,1]],[[49,3]],[[0,3]]],[[[81,1]],[[82,0],[83,0],[0,1]]],[[[5,1],[6,1],[7,1],[84,2]],[[49,2]],[[0,2]]],[[[23,1]],[[58,2],[0,1]],[[0,2]]],[[[74,1]],[[70,2]],[[61,3],[0,2]],[[70,4]],[[0,4]]],[[[85,1],[63,2],[80,3]],[[57,4],[0,1]],[[70,5]],[[70,6]],[[85,1],[63,2],[80,3],[0,4]],[[57,7],[0,5]],[[0,6]],[[85,5],[80,3]]],[[[70,1]],[[86,2],[61,3],[0,1]],[[0,2]],[[70,2]]],[[[29,1]],[[70,2]],[[57,3],[0,2]],[[70,4]],[[0,4]]],[[[87,1],[88,1],[89,1],[90,1],[91,1],[92,1],[93,1],[94,1],[95,1],[96,1],[97,1],[98,1]],[[0,1]]],[[[19,1]],[[0,1]]],[[[36,1]],[[12,2]],[[8,3],[74,4]],[[58,5],[43,6]],[[99,7]],[[43,6]],[[74,4]],[[0,7]]],[[[100,1],[101,1],[102,1],[103,1],[104,1],[105,1],[105,1],[106,1],[4,2],[107,3]],[[0,1]],[[106,1]],[[4,1],[0,3]]],[[[108,1],[109,1],[110,1],[111,1],[112,1],[113,1],[114,1],[115,1]],[[0,1]]],[[[20,1]],[[0,1]]],[[[116,1]],[[114,2],[113,2]],[[0,2]]],[[[37,1]],[[117,2]],[[8,3],[1,4]],[[118,5],[43,6]],[[0,4]],[[43,6]],[[1,4]]],[[[119,1]],[[119,1],[0,1]]],[[[17,1]],[[120,2]],[[0,2]]],[[[70,1]],[[74,2]],[[70,3]],[[57,4],[0,3]],[[70,1],[0,4]]],[[[117,1]],[[72,2],[0,1]],[[12,3]],[[0,3]]],[[[121,1]],[[57,0],[0,1]]],[[[12,1]],[[122,0],[0,1]]],[[[12,1]],[[0,1]]],[[[58,1]],[[1,1],[123,2]],[[0,2]]],[[[124,1]],[[70,2],[0,1]],[[72,3],[57,3],[0,2]],[[70,4]],[[0,4]]],[[[28,1]],[[55,2]],[[106,3],[0,2]],[[70,4]],[[57,5],[0,4]],[[70,6]],[[0,6]]],[[[1,0],[125,0],[123,1]],[[0,1]]],[[[126,1],[127,1],[128,1],[129,1],[130,1]],[[0,1]]],[[[32,1]],[[120,2]],[[106,3]],[[58,4]],[[74,5]],[[99,6]],[[69,7],[0,6]],[[74,8]],[[99,9]],[[0,9]]],[[[12,1],[8,2]],[[74,3],[0,1]],[[131,4]],[[70,5]],[[43,5]],[[0,5]]],[[[132,1]],[[57,2],[0,1]],[[132,1],[0,2]]],[[[35,1]],[[12,2]],[[133,3]],[[134,4],[74,5]],[[70,6]],[[99,7]],[[74,5]],[[0,7]]],[[[32,1]],[[120,2]],[[106,3]],[[67,4]],[[135,5],[0,4]],[[0,5]]],[[[30,1]],[[136,2]],[[135,3],[0,2]],[[0,3]]],[[[86,1],[137,1]],[[0,1]]],[[[30,1]],[[70,2]],[[74,3]],[[99,4]],[[138,1],[69,5],[0,4]],[[74,6]],[[99,7]],[[0,7]]],[[[25,1]],[[139,2]],[[24,3]],[[63,4],[8,5],[140,4]],[[0,4]],[[140,6]],[[43,4]]],[[[24,1]],[[141,2]],[[0,2]]],[[[142,1],[143,1]],[[0,1]]],[[[32,1]],[[120,2]],[[106,3]],[[144,4]],[[145,5],[0,4]],[[0,5]]],[[[30,1]],[[136,2]],[[145,3],[0,2]],[[0,3]]],[[[146,1],[147,1]],[[0,1]]],[[[70,1]],[[146,2],[57,3],[0,1]],[[0,2]],[[70,4],[0,3]],[[57,3],[0,4]]],[[[15,1]],[[73,2],[74,3]],[[74,3]],[[136,4]],[[0,4]]],[[[67,1],[148,1]],[[0,1]]],[[[8,1]],[[73,2],[43,3]],[[43,3]],[[0,3]]],[[[18,1]],[[0,1]]],[[[16,1]],[[70,2],[83,3],[0,1]],[[57,4],[0,2]],[[70,5]],[[70,2],[0,4]],[[57,6],[0,5]],[[70,7]],[[57,8],[0,7]],[[70,7],[0,8]]],[[[22,1]],[[70,2],[0,1]],[[57,3],[0,2]],[[70,4]],[[57,5],[0,4]],[[70,6]],[[0,6]]],[[[21,1]],[[58,2],[0,1]],[[0,2]]],[[[149,1]],[[150,2],[1,3]],[[149,1],[1,3]],[[0,3]]],[[[74,1]],[[70,2],[0,1]],[[0,2]]],[[[151,1],[152,1],[153,1],[154,1],[155,1],[156,1],[157,1],[158,1],[159,1],[160,1]],[[0,1]]],[[[2,1],[3,1]],[[0,1]]],[[[122,1],[70,2],[74,3]],[[122,4]],[[74,3],[0,2]],[[70,5],[161,6],[0,3]],[[122,6]],[[161,6],[0,5]],[[0,6]]],[[[162,1]],[[57,2],[0,1]],[[162,1],[0,2]]],[[[2,1],[1,2]],[[0,1]],[[163,3]],[[125,4]],[[125,4],[164,1]]],[[[70,1]],[[57,2],[0,1]],[[70,1],[0,2]]],[[[70,1]],[[57,0],[0,1]]],[[[70,1]],[[86,2],[57,3],[0,1]],[[0,2]],[[70,4],[0,3]],[[57,3],[0,4]]],[[[136,1]],[[57,2],[0,1]],[[136,3]],[[57,4],[0,3]],[[136,3],[0,4]]],[[[8,1],[9,2],[122,3]],[[118,4],[43,5]],[[165,6]],[[12,5]],[[43,5]],[[0,5]],[[45,5]]],[[[33,1]],[[74,2]],[[99,3]],[[166,4],[167,5]],[[74,6]],[[74,7]],[[99,8]],[[99,9]],[[166,4],[69,10],[167,5],[0,8]],[[0,9]],[[74,11]],[[99,12]],[[167,5],[0,12]]],[[[132,1],[63,2],[80,3]],[[61,4],[57,5],[0,1]],[[12,6]],[[12,7]],[[70,8]],[[132,1],[63,2],[80,3],[0,5]],[[57,9],[0,6]],[[0,7]],[[57,5],[0,8]],[[80,3]]],[[[31,1]],[[70,2]],[[74,3]],[[99,4]],[[69,5],[0,4]],[[74,6]],[[99,7]],[[0,7]]],[[[34,1]],[[70,2]],[[168,3],[74,4]],[[74,4]],[[99,5]],[[0,5]]],[[[72,1]],[[55,2]],[[0,2]]],[[[41,1]],[[0,1]]]],labels:[[0,"EMPTY"],[4,null],[326,null],[288,null],[1,"not"],[14,null],[15,null],[32,null],[7,null],[9,null],[26,null],[25,null],[1,null],[2,null],[3,null],[1,"lambda"],[1,"print"],[1,"del"],[1,"pass"],[1,"break"],[1,"continue"],[1,"return"],[1,"raise"],[1,"yield"],[1,"import"],[1,"from"],[1,"global"],[1,"nonlocal"],[1,"exec"],[1,"assert"],[1,"if"],[1,"while"],[1,"for"],[1,"try"],[1,"with"],[1,"def"],[1,"class"],[50,null],[274,null],[1,"and"],[266,null],[279,null],[335,null],[8,null],[318,null],[10,null],[294,null],[27,null],[334,null],[278,null],[19,null],[262,null],[18,null],[260,null],[33,null],[258,null],[287,null],[12,null],[333,null],[280,null],[284,null],[22,null],[277,null],[16,null],[17,null],[24,null],[48,null],[275,null],[271,null],[1,"else"],[268,null],[270,null],[1,"as"],[339,null],[11,null],[263,null],[257,null],[1,"or"],[259,null],[337,null],[36,null],[261,null],[34,null],[35,null],[276,null],[282,null],[308,null],[37,null],[38,null],[39,null],[40,null],[41,null],[42,null],[43,null],[44,null],[45,null],[46,null],[47,null],[49,null],[332,null],[20,null],[21,null],[28,null],[31,null],[30,null],[29,null],[1,"in"],[1,"is"],[311,null],[340,null],[304,null],[338,null],[341,null],[307,null],[286,null],[290,null],[292,null],[297,null],[281,null],[291,null],[264,null],[295,null],[23,null],[0,null],[1,"except"],[329,null],[285,null],[289,null],[325,null],[324,null],[343,null],[306,null],[305,null],[321,null],[55,null],[310,null],[320,null],[309,null],[1,"elif"],[272,null],[269,null],[296,null],[313,null],[312,null],[336,null],[317,null],[315,null],[316,null],[319,null],[328,null],[13,null],[265,null],[323,null],[293,null],[322,null],[303,null],[314,null],[267,null],[273,null],[301,null],[283,null],[327,null],[330,null],[5,null],[6,null],[331,null],[300,null],[1,"finally"],[342,null]],keywords:{and:39,as:72,assert:29,break:19,class:36,continue:20,def:35,del:17,elif:138,else:69,except:124,exec:28,finally:167,for:32,from:25,global:26,if:30,import:24,in:106,is:107,lambda:15,nonlocal:27,not:4,or:77,pass:18,print:16,raise:22,return:21,try:33,while:31,with:34,yield:23},tokens:{0:123,1:12,2:13,3:14,4:1,5:163,6:164,7:8,8:43,9:9,10:45,11:74,12:57,13:150,14:5,15:6,16:63,17:64,18:52,19:50,20:100,21:101,22:61,23:122,24:65,25:11,26:10,27:47,28:102,29:105,30:104,31:103,32:7,33:54,34:82,35:83,36:80,37:87,38:88,39:89,40:90,41:91,42:92,43:93,44:94,45:95,46:96,47:97,48:66,49:98,50:37,55:134},start:256},sR={};function iR(t){const e=sR[t];return e||rR.number2symbol[t]}sR[MP.T_AMPER]="T_AMPER",sR[MP.T_AMPEREQUAL]="T_AMPEREQUAL",sR[MP.T_AT]="T_AT",sR[MP.T_BACKQUOTE]="T_BACKQUOTE",sR[MP.T_CIRCUMFLEX]="T_CIRCUMFLEX",sR[MP.T_CIRCUMFLEXEQUAL]="T_CIRCUMFLEXEQUAL",sR[MP.T_COLON]="T_COLON",sR[MP.T_COMMA]="T_COMMA",sR[MP.T_COMMENT]="T_COMMENT",sR[MP.T_DEDENT]="T_DEDENT",sR[MP.T_DOT]="T_DOT",sR[MP.T_DOUBLESLASH]="T_DOUBLESLASH",sR[MP.T_DOUBLESLASHEQUAL]="T_DOUBLESLASHEQUAL",sR[MP.T_DOUBLESTAR]="T_DOUBLESTAR",sR[MP.T_DOUBLESTAREQUAL]="T_DOUBLESTAREQUAL",sR[MP.T_ENDMARKER]="T_ENDMARKER",sR[MP.T_EQEQUAL]="T_EQEQUAL",sR[MP.T_EQUAL]="T_EQUAL",sR[MP.T_ERRORTOKEN]="T_ERRORTOKEN",sR[MP.T_GREATER]="T_GREATER",sR[MP.T_GREATEREQUAL]="T_GREATEREQUAL",sR[MP.T_INDENT]="T_INDENT",sR[MP.T_LBRACE]="T_LBRACE",sR[MP.T_LEFTSHIFT]="T_LEFTSHIFT",sR[MP.T_LEFTSHIFTEQUAL]="T_LEFTSHIFTEQUAL",sR[MP.T_LESS]="T_LESS",sR[MP.T_LESSEQUAL]="T_LESSEQUAL",sR[MP.T_LPAR]="T_LPAR",sR[MP.T_LSQB]="T_LSQB",sR[MP.T_MINEQUAL]="T_MINEQUAL",sR[MP.T_MINUS]="T_MINUS",sR[MP.T_N_TOKENS]="T_N_TOKENS",sR[MP.T_NAME]="T_NAME",sR[MP.T_NEWLINE]="T_NEWLINE",sR[MP.T_NL]="T_NL",sR[MP.T_NOTEQUAL]="T_NOTEQUAL",sR[MP.T_NT_OFFSET]="T_NT_OFFSET",sR[MP.T_NUMBER]="T_NUMBER",sR[MP.T_OP]="T_OP",sR[MP.T_PERCENT]="T_PERCENT",sR[MP.T_PERCENTEQUAL]="T_PERCENTEQUAL",sR[MP.T_PLUS]="T_PLUS",sR[MP.T_PLUSEQUAL]="T_PLUSEQUAL",sR[MP.T_RARROW]="T_RARROW",sR[MP.T_RBRACE]="T_RBRACE",sR[MP.T_RIGHTSHIFT]="T_RIGHTSHIFT",sR[MP.T_RPAR]="T_RPAR",sR[MP.T_RSQB]="T_RSQB",sR[MP.T_SEMI]="T_SEMI",sR[MP.T_SLASH]="T_SLASH",sR[MP.T_SLASHEQUAL]="T_SLASHEQUAL",sR[MP.T_STAR]="T_STAR",sR[MP.T_STAREQUAL]="T_STAREQUAL",sR[MP.T_STRING]="T_STRING",sR[MP.T_TILDE]="T_TILDE",sR[MP.T_VBAR]="T_VBAR",sR[MP.T_VBAREQUAL]="T_VBAREQUAL";class oR extends Error{constructor(t,e,n){super(t),this.lineNumber=e,this.columnNumber=n,VP(QP(e),"lineNumber must be a number"),VP(QP(n),"columnNumber must be a number")}}const aR=MP.T_COMMENT,uR=MP.T_DEDENT,cR=MP.T_ENDMARKER,lR=MP.T_ERRORTOKEN,hR=MP.T_INDENT,fR=MP.T_NAME,pR=MP.T_NEWLINE,dR=MP.T_NL,mR=MP.T_NUMBER,gR=MP.T_OP,xR=MP.T_STRING,yR=RR("0[bB][01]*","0[xX][\\da-fA-F]*[lL]?","0[oO]?[0-7]*[lL]?","[1-9]\\d*[lL]?"),wR="[eE][-+]?\\d+",ER=RR("\\d+\\.\\d*","\\.\\d+")+function(t){return RR.apply(null,arguments)+"?"}(wR),vR=RR(ER,"\\d+"+wR),DR=RR("\\d+[jJ]",vR+"[jJ]"),bR=RR(DR,vR,yR),AR=RR("[ubUB]?[rR]?'''",'[ubUB]?[rR]?"""'),SR=RR("\\*\\*=?",">>=?","<<=?","<>","!=","//=?","->","[+\\-*/%&|^=<>]=?","~"),kR=RR("\\r?\\n","[:;.,`@]"),_R=RR(SR,"[\\][(){}]",kR),FR=RR("[uUbB]?[rR]?'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*"+RR("'","\\\\\\r?\\n"),'[uUbB]?[rR]?"[^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*'+RR('"',"\\\\\\r?\\n")),CR=RR("\\\\\\r?\\n","#[^\\r\\n]*",AR,"'{3}[^]*'{3}"),TR="^"+RR(CR,bR,_R,FR,"[a-zA-Z_]\\w*"),MR=new RegExp(TR),OR=new RegExp("[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''","g"),NR=new RegExp('[^"\\\\]*(?:(?:\\\\.|"(?!""))[^"\\\\]*)*"""',"g"),LR={"'":new RegExp("^[^'\\\\]*(?:\\\\.[^'\\\\]*)*'","g"),'"':new RegExp('^[^"\\\\]*(?:\\\\.[^"\\\\]*)*"',"g"),"'''":OR,'"""':NR,"r'''":OR,'r"""':NR,"u'''":OR,'u"""':NR,"b'''":OR,'b"""':NR,"ur'''":OR,'ur"""':NR,"br'''":OR,'br"""':NR,"R'''":OR,'R"""':NR,"U'''":OR,'U"""':NR,"B'''":OR,'B"""':NR,"uR'''":OR,'uR"""':NR,"Ur'''":OR,'Ur"""':NR,"UR'''":OR,'UR"""':NR,"bR'''":OR,'bR"""':NR,"Br'''":OR,'Br"""':NR,"BR'''":OR,'BR"""':NR,r:null,R:null,u:null,U:null,b:null,B:null},BR={"'''":!0,'"""':!0,"r'''":!0,'r"""':!0,"R'''":!0,'R"""':!0,"u'''":!0,'u"""':!0,"U'''":!0,'U"""':!0,"b'''":!0,'b"""':!0,"B'''":!0,'B"""':!0,"ur'''":!0,'ur"""':!0,"Ur'''":!0,'Ur"""':!0,"uR'''":!0,'uR"""':!0,"UR'''":!0,'UR"""':!0,"br'''":!0,'br"""':!0,"Br'''":!0,'Br"""':!0,"bR'''":!0,'bR"""':!0,"BR'''":!0,'BR"""':!0},qR={"'":!0,'"':!0,"r'":!0,'r"':!0,"R'":!0,'R"':!0,"u'":!0,'u"':!0,"U'":!0,'U"':!0,"b'":!0,'b"':!0,"B'":!0,'B"':!0,"ur'":!0,'ur"':!0,"Ur'":!0,'Ur"':!0,"uR'":!0,'uR"':!0,"UR'":!0,'UR"':!0,"br'":!0,'br"':!0,"Br'":!0,'Br"':!0,"bR'":!0,'bR"':!0,"BR'":!0,'BR"':!0},IR="done";class PR{constructor(t,e){this.callback=e,this.begin=[-1,-1],this.end=[-1,-1],this.lnum=0,this.parenlev=0,this.strstart=[-1,-1],this.callback=e,this.continued=!1,this.contstr="",this.needcont=!1,this.contline=void 0,this.indents=[0],this.endprog=/.*/,this.interactive=t,this.doneFunc=function(){const t=this.begin,n=this.end;t[0]=n[0]=this.lnum,t[1]=n[1]=0;const r=this.indents.length;for(let s=1;s<r;++s)if(e(uR,"",t,n,""))return IR;return e(cR,"",t,n,"")?IR:"failed"}}generateTokens(t){let e,n,r;t||(t=""),this.lnum+=1;let s=0,i=t.length;const o=this.callback,a=this.begin;a[0]=this.lnum;const u=this.end;if(u[0]=this.lnum,this.contstr.length>0){if(!t)throw new oR("EOF in multi-line string",this.strstart[0],this.strstart[1]);if(this.endprog.lastIndex=0,e=this.endprog.test(t),!e)return this.needcont&&"\\\n"!==t.substring(t.length-2)&&"\\\r\n"!==t.substring(t.length-3)?(VP("string"==typeof this.contline),u[1]=t.length,o(lR,this.contstr+t,this.strstart,u,this.contline)?IR:(this.contstr="",this.contline=void 0,!1)):(this.contstr+=t,this.contline=this.contline+t,!1);if(s=r=this.endprog.lastIndex,u[1]=r,o(xR,this.contstr+t.substring(0,r),this.strstart,u,this.contline+t))return IR;this.contstr="",this.needcont=!1,this.contline=void 0}else if(0!==this.parenlev||this.continued){if(!t)throw new oR("EOF in multi-line statement",this.lnum,0);this.continued=!1}else{if(!t)return this.doneFunc();for(n=0;s<i;){const e=t.charAt(s);if(" "===e)n+=1;else if("\t"===e)n=8*(n/8+1);else{if("\f"!==e)break;n=0}s+=1}if(s===i)return this.doneFunc();if(-1!=="#\r\n".indexOf(t.charAt(s))){if("#"===t.charAt(s)){const e=function(t,e){let n;for(n=t.length;n>0&&-1!==e.indexOf(t.charAt(n-1));--n);return t.substring(0,n)}(t.substring(s),"\r\n"),n=s+e.length;return a[1]=s,u[1]=n,o(aR,e,a,u,t)?IR:(a[1]=n,u[1]=t.length,!!o(dR,t.substring(n),a,u,t)&&IR)}if(a[1]=s,u[1]=t.length,o(dR,t.substring(s),a,u,t))return IR;if(!this.interactive)return!1}if(-1!=="'''".indexOf(t.charAt(s))){if("'"===t.charAt(s)){const e=t.substring(s),n=s+e.length;return a[1]=s,u[1]=n,o(aR,e,a,u,t)?IR:(a[1]=n,u[1]=t.length,!!o(dR,t.substring(n),a,u,t)&&IR)}if(a[1]=s,u[1]=t.length,o(dR,t.substring(s),a,u,t))return IR;if(!this.interactive)return!1}if(n>this.indents[this.indents.length-1]&&(this.indents.push(n),a[1]=0,u[1]=s,o(hR,t.substring(0,s),a,u,t)))return IR;for(;n<this.indents[this.indents.length-1];){if(!UR(this.indents,n))throw a[1]=0,u[1]=s,$R("unindent does not match any outer indentation level",a,u);if(this.indents.splice(this.indents.length-1,1),a[1]=s,u[1]=s,o(uR,"",a,u,t))return IR}}for(;s<i;){let n=t.charAt(s);for(;" "===n||"\f"===n||"\t"===n;)s+=1,n=t.charAt(s);MR.lastIndex=0;const i=MR.exec(t.substring(s));if(i){const n=s;r=n+i[1].length,a[1]=n,u[1]=r,s=r;const c=t.substring(n,r),l=t.charAt(n);if(-1!=="0123456789".indexOf(l)||"."===l&&"."!==c){if(o(mR,c,a,u,t))return IR}else if("\r"===l||"\n"===l){let e=pR;if(this.parenlev>0&&(e=dR),o(e,c,a,u,t))return IR}else if("#"===l||"'''"===l){if(o(aR,c,a,u,t))return IR}else if(BR.hasOwnProperty(c)){if(this.endprog=LR[c],this.endprog.lastIndex=0,e=this.endprog.test(t.substring(s)),!e)return this.strstart[0]=this.lnum,this.strstart[1]=n,this.contstr=t.substring(n),this.contline=t,!1;{s=this.endprog.lastIndex+s;const e=t.substring(n,s);if(u[1]=s,o(xR,e,a,u,t))return IR}}else if(qR.hasOwnProperty(l)||qR.hasOwnProperty(c.substring(0,2))||qR.hasOwnProperty(c.substring(0,3))){if("\n"===c[c.length-1])return this.endprog=LR[l]||LR[c[1]]||LR[c[2]],VP(this.endprog instanceof RegExp),this.contstr=t.substring(n),this.needcont=!0,this.contline=t,!1;if(o(xR,c,a,u,t))return IR}else if(-1!=="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".indexOf(l)){if(o(fR,c,a,u,t))return IR}else if("\\"===l){if(u[1]=s,o(dR,c,a,u,t))return IR;this.continued=!0}else if(-1!=="([{".indexOf(l)?this.parenlev+=1:-1!==")]}".indexOf(l)&&(this.parenlev-=1),o(gR,c,a,u,t))return IR}else{if(a[1]=s,u[1]=s+1,o(lR,t.charAt(s),a,u,t))return IR;s+=1}}return!1}}function RR(t,e,n,r,s,i,o,a,u,c){return"("+Array.prototype.slice.call(arguments).join("|")+")"}function UR(t,e){let n=t.length;for(;n--;)if(t[n]===e)return!0;return!1}function $R(t,e,n,r){VP(Array.isArray(e),"begin must be an Array"),VP(Array.isArray(n),"end must be an Array");const s=new SyntaxError(t);return s.name="IndentationError",e&&(s.lineNumber=e[0],s.columnNumber=e[1]),s}class zR{constructor(t,e){this.line=t,this.column=e}get row(){return this.line-1}toString(){return`[${this.line}, ${this.column}]`}}class WR extends SyntaxError{constructor(t){super(t),this.name="ParseError"}}class XR extends WR{constructor(t,e,n){super(`Unexpected ${t} at ${JSON.stringify([e[0],e[1]+1])}`),this.tokenName=t,this.name="UnexpectedTokenError",Array.isArray(e)&&(this.begin=new zR(e[0],e[1])),Array.isArray(n)&&(this.end=new zR(n[0],n[1]))}}function KR(t,e,n){const r=new WR(t);return Array.isArray(e)&&(r.begin=new zR(e[0],e[1])),Array.isArray(n)&&(r.end=new zR(n[0],n[1])),r}class HR{constructor(t,e){VP(t,"begin must be defined"),VP(e,"end must be defined"),this.begin=t,this.end=e}toString(){return`${this.begin} to ${this.end}`}}const JR=MP.T_COMMENT,GR=MP.T_ENDMARKER,VR=MP.T_NAME,jR=MP.T_NL,QR=MP.T_NT_OFFSET,ZR=MP.T_OP;class YR{constructor(t){this.stack=[],this.used_names={},this.grammar=t}setup(t){const e={type:t=t||this.grammar.start,range:null,value:null,children:[]},n={dfa:this.grammar.dfas[t][0],beginTokens:this.grammar.dfas[t][1],stateId:0,node:e};this.stack.push(n)}addtoken(t,e,n,r,s){const i=this.classify(t,e,n,r,s),o=this.stack,a=this.grammar,u=a.dfas,c=a.labels;t:for(;;){let a=o[o.length-1],l=a.dfa;const h=l[a.stateId];for(const f of h){const h=f[0],p=f[1],d=c[h][0];if(i===h){this.shiftToken(t,e,p,n,r,s);let i=p,u=l[i];for(;1===u.length&&0===u[0][0]&&u[0][1]===i;){this.popNonTerminal();const t=o.length;if(0===t)return!0;a=o[t-1],i=a.stateId,l=a.dfa,u=l[i]}return!1}if(rU(d)){const t=u[d],e=t[0],o=t[1];if(o.hasOwnProperty(i)){this.pushNonTerminal(d,e,o,p,n,r,s);continue t}}}if(!tU(h,[GR,a.stateId])){const t=iR(a.stateId);throw new XR(t,n,r)}if(this.popNonTerminal(),0===o.length)throw KR("too much input")}}classify(t,e,n,r,s){!function(t){VP(t<QR,"terminal symbols should be less than T_NT_OFFSET")}(t);const i=this.grammar;if(t===VR){this.used_names[e]=!0;const t=i.keywords;if(t.hasOwnProperty(e)){return t[e]}}const o=i.tokens;let a;if(o.hasOwnProperty(t)&&(a=o[t]),!a)throw KR("bad token",n,r);return a}shiftToken(t,e,n,r,s,i){const o=this.stack,a=o[o.length-1],u=a.node,c={type:t,value:e,range:new HR(new zR(r[0],r[1]),new zR(s[0],s[1])),children:null};c&&u.children&&u.children.push(c),a.stateId=n}pushNonTerminal(t,e,n,r,s,i,o){const a=this.stack;a[a.length-1].stateId=r;const u=s?new zR(s[0],s[1]):null,c=i?new zR(i[0],i[1]):null,l={type:t,value:null,range:new HR(u,c),children:[]};a.push({dfa:e,beginTokens:n,stateId:0,node:l})}popNonTerminal(){const t=this.stack,e=t.pop();if(e){const n=e.node;if(n){const e=t.length;if(0!==e){const r=t[e-1].node.children;r&&r.push(n)}else this.rootNode=n,n.used_names=this.used_names}}}}function tU(t,e){let n=t.length;for(;n--;){const r=t[n];if(r[0]===e[0]&&r[1]===e[1])return!0}return!1}var eU;function nU(t,e=eU.File){const n=function(t){void 0===t&&(t=eU.File);const e=new YR(rR);switch(t){case eU.File:e.setup(rR.sym.file_input);break;case eU.Eval:e.setup(rR.sym.eval_input);break;case eU.Single:e.setup(rR.sym.single_input);break;default:throw new Error("SourceKind must be one of File, Eval, or Single.")}const n=new PR(t===eU.Single,(function(t,n,r,s,i){return r[0],r[1],t===JR||t===jR?(s[0],s[1],void n[n.length-1]):(t===ZR&&(t=nR[n]),!!e.addtoken(t,n,r,s,i)||void 0)}));return function(t){const r=n.generateTokens(t);if(r){if("done"!==r)throw KR("incomplete input");return e.rootNode}return!1}}(e),r=function(t){const e=[];"\n"!==t.substr(eR(t),1)&&(t+="\n");const n=t.split("\n"),r=n.length;for(let t=0;t<r;++t){const r=n[t]+(t===eR(n)?"":"\n");e.push(r)}return e}(t);let s=!1;for(const t of r)s=n(t);return s}function rU(t){return t>=QR}function sU(t){return{text:t,value:parseFloat(t),isFloat:function(){return!0},isInt:function(){return!1},isLong:function(){return!1},toString:function(){return t}}}function iU(t){return{value:t,isFloat:function(){return!1},isInt:function(){return!0},isLong:function(){return!1},toString:function(){return""+t}}}function oU(t,e){return{text:t,radix:e,isFloat:function(){return!1},isInt:function(){return!1},isLong:function(){return!0},toString:function(){return t}}}!function(t){t[t.File=0]="File",t[t.Eval=1]="Eval",t[t.Single=2]="Single"}(eU||(eU={}));class aU{}class uU{}class cU{}class lU{}class hU{}class fU{}class pU{}class dU{}class mU{}class gU{}class xU{}class yU{}class wU{}class EU{}class vU{}class DU{}class bU{}class AU{}class SU{}class kU{}class _U{}class FU{}class CU{}class TU{}class MU{}class OU{}class NU{}class LU{}class BU{}class qU{}class IU{}class PU{}class RU{}class UU{}class $U{constructor(t,e){this.value=t,this.range=e,VP(void 0!==t,"value must be defined.")}}class zU{constructor(){}accept(t){throw new Error(`"Expression.accept" is not implemented. this=${JSON.stringify(this,null,2)}`)}}class WU{accept(t){throw new Error('"Statement.accept" is not implemented.')}}class XU extends WU{}class KU{constructor(t){this.body=t}accept(t){t.module(this)}}class HU extends WU{constructor(t,e,n,r,s,i){super(),this.range=i,this.name=t,this.args=e,this.body=n,this.decorator_list=s,this.returnType=r}accept(t){t.functionDef(this)}}class JU{constructor(t,e){this.name=t,this.type=e||null}}class GU extends WU{constructor(t,e,n,r,s){super(),this.range=s,this.name=t,this.bases=e,this.body=n,this.decorator_list=r}accept(t){t.classDef(this)}}class VU extends WU{constructor(t,e){super(),this.range=e,this.value=t}accept(t){t.returnStatement(this)}}class jU extends WU{constructor(t,e){super(),this.range=e,this.targets=t}}class QU extends WU{constructor(t,e,n,r,s){super(),this.range=n,this.eqRange=r,this.targets=t,this.value=e,s&&(this.type=s)}accept(t){t.assign(this)}}class ZU extends WU{constructor(t,e,n,r){super(),this.range=r,this.target=t,this.op=e,this.value=n}}class YU extends WU{constructor(t,e,n){super(),this.range=n,this.value=t,this.target=e}accept(t){t.annAssign(this)}}class t$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.dest=t,this.values=e,this.nl=n}accept(t){t.print(this)}}class e$ extends WU{constructor(t,e,n,r,s){super(),this.range=s,this.target=t,this.iter=e,this.body=n,this.orelse=r}accept(t){t.forStatement(this)}}class n$ extends XU{constructor(t,e,n,r){super(),this.range=r,this.test=t,this.body=e,this.orelse=n}}class r$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.test=t,this.consequent=e,this.alternate=n}accept(t){t.ifStatement(this)}}class s$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.context_expr=t,this.optional_vars=e,this.body=n}}class i$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.type=t,this.inst=e,this.tback=n}}class o$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.body=t,this.handlers=e,this.orelse=n}}class a$ extends WU{constructor(t,e,n){super(),this.range=n,this.body=t,this.finalbody=e}}class u$ extends WU{constructor(t,e,n){super(),this.range=n,this.test=t,this.msg=e}}class c$ extends WU{constructor(t,e){super(),this.range=e,this.names=t}}class l$ extends WU{constructor(t,e,n,r){super(),this.range=r,VP("string"==typeof t.value,"module must be a string."),VP(Array.isArray(e),"names must be an Array."),this.module=t,this.names=e,this.level=n}accept(t){t.importFrom(this)}}class h$ extends WU{constructor(t,e,n,r){super(),this.range=r,this.body=t,this.globals=e,this.locals=n}}class f$ extends WU{constructor(t,e){super(),this.range=e,this.names=t}}class p$ extends WU{constructor(t,e){super(),this.range=e,this.names=t}}class d$ extends WU{constructor(t,e){super(),this.range=e,this.value=t}accept(t){t.expressionStatement(this)}}class m$ extends WU{constructor(t){super(),this.range=t}}class g$ extends WU{constructor(t){super(),this.range=t}}class x$ extends WU{constructor(t){super(),this.range=t}}class y$ extends zU{constructor(t,e,n){super(),this.range=n,this.op=t,this.values=e}}class w$ extends zU{constructor(t,e,n,r){super(),this.range=r,this.lhs=t,this.op=e.op,this.opRange=e.range,this.rhs=n}accept(t){t.binOp(this)}}class E$ extends zU{constructor(t,e,n){super(),this.op=t,this.operand=e,this.range=n,VP(t===CU||t===TU||t===_U||t===FU,"op must be defined."),VP(!!e,"operand must be defined")}accept(t){t.unaryOp(this)}}class v$ extends zU{constructor(t,e,n){super(),this.range=n,this.args=t,this.body=e}}class D$ extends zU{constructor(t,e,n,r){super(),this.range=r,this.test=t,this.body=e,this.orelse=n}}class b$ extends zU{constructor(t,e,n){super(),this.range=n,this.keys=t,this.values=e}accept(t){t.dict(this)}}class A$ extends zU{constructor(t,e,n){super(),this.range=n,this.elt=t,this.generators=e}}class S$ extends zU{constructor(t,e,n){super(),this.range=n,this.elt=t,this.generators=e}}class k$ extends zU{constructor(t,e){super(),this.range=e,this.value=t}}class _$ extends zU{constructor(t,e,n,r){super(),this.range=r,this.left=t;for(const t of e)switch(t){case MU:case OU:case BU:case qU:case NU:case LU:case RU:case UU:case IU:case PU:break;default:throw new Error(`ops must only contain CompareOperator(s) but contains ${t}`)}this.ops=e,this.comparators=n}accept(t){t.compareExpression(this)}}class F$ extends zU{constructor(t,e,n,r,s){super(),this.func=t,this.args=e,this.keywords=n,this.starargs=r,this.kwargs=s}accept(t){t.callExpression(this)}}class C$ extends zU{constructor(t){super(),this.n=t}accept(t){t.num(this)}}class T$ extends zU{constructor(t){super(),this.s=t}accept(t){t.str(this)}}class M$ extends zU{constructor(t,e,n,r){super(),this.range=r,this.value=t,this.attr=e,this.ctx=n}accept(t){t.attribute(this)}}class O$ extends zU{constructor(t,e,n,r){super(),this.range=r,this.value=t,this.slice=e,this.ctx=n}accept(t){t.subscript(this)}}class N$ extends zU{constructor(t,e){super(),this.id=t,this.ctx=e}accept(t){t.name(this)}}class L$ extends zU{constructor(t,e,n){super(),this.range=n,this.elts=t,this.ctx=e}accept(t){t.list(this)}}class B$ extends zU{constructor(t,e,n){super(),this.range=n,this.elts=t,this.ctx=e}}class q${constructor(){}}class I${constructor(t,e,n){this.lower=t,this.upper=e,this.step=n}}class P${constructor(t){this.dims=t}}class R${constructor(t){this.value=t}}class U${constructor(t,e,n,r){this.range=r,this.target=t,this.iter=e,this.ifs=n}}class $${constructor(t,e,n,r){this.range=r,this.type=t,this.name=e,this.body=n}}class z${constructor(t,e,n,r){this.args=t,this.vararg=e,this.kwarg=n,this.defaults=r}}class W${constructor(t,e){this.arg=t,this.value=e}}class X${constructor(t,e){VP("string"==typeof t.value),VP("string"==typeof e||null===e),this.name=t,this.asname=e}toString(){return`${this.name.value} as ${this.asname}`}}KU.prototype._astname="Module",KU.prototype._fields=["body",function(t){return t.body}],zU.prototype._astname="Expression",zU.prototype._fields=["body",function(t){}],HU.prototype._astname="FunctionDef",HU.prototype._fields=["name",function(t){return t.name.value},"args",function(t){return t.args},"body",function(t){return t.body},"returnType",function(t){return t.returnType},"decorator_list",function(t){return t.decorator_list}],GU.prototype._astname="ClassDef",GU.prototype._fields=["name",function(t){return t.name.value},"bases",function(t){return t.bases},"body",function(t){return t.body},"decorator_list",function(t){return t.decorator_list}],VU.prototype._astname="ReturnStatement",VU.prototype._fields=["value",function(t){return t.value}],jU.prototype._astname="DeleteStatement",jU.prototype._fields=["targets",function(t){return t.targets}],QU.prototype._astname="Assign",QU.prototype._fields=["targets",function(t){return t.targets},"value",function(t){return t.value}],ZU.prototype._astname="AugAssign",ZU.prototype._fields=["target",function(t){return t.target},"op",function(t){return t.op},"value",function(t){return t.value}],YU.prototype._astname="AnnAssign",YU.prototype._fields=["target",function(t){return t.target},"type",function(t){return t.value}],t$.prototype._astname="Print",t$.prototype._fields=["dest",function(t){return t.dest},"values",function(t){return t.values},"nl",function(t){return t.nl}],e$.prototype._astname="ForStatement",e$.prototype._fields=["target",function(t){return t.target},"iter",function(t){return t.iter},"body",function(t){return t.body},"orelse",function(t){return t.orelse}],n$.prototype._astname="WhileStatement",n$.prototype._fields=["test",function(t){return t.test},"body",function(t){return t.body},"orelse",function(t){return t.orelse}],r$.prototype._astname="IfStatement",r$.prototype._fields=["test",function(t){return t.test},"consequent",function(t){return t.consequent},"alternate",function(t){return t.alternate}],s$.prototype._astname="WithStatement",s$.prototype._fields=["context_expr",function(t){return t.context_expr},"optional_vars",function(t){return t.optional_vars},"body",function(t){return t.body}],i$.prototype._astname="Raise",i$.prototype._fields=["type",function(t){return t.type},"inst",function(t){return t.inst},"tback",function(t){return t.tback}],o$.prototype._astname="TryExcept",o$.prototype._fields=["body",function(t){return t.body},"handlers",function(t){return t.handlers},"orelse",function(t){return t.orelse}],a$.prototype._astname="TryFinally",a$.prototype._fields=["body",function(t){return t.body},"finalbody",function(t){return t.finalbody}],u$.prototype._astname="Assert",u$.prototype._fields=["test",function(t){return t.test},"msg",function(t){return t.msg}],c$.prototype._astname="Import",c$.prototype._fields=["names",function(t){return t.names}],l$.prototype._astname="ImportFrom",l$.prototype._fields=["module",function(t){return t.module.value},"names",function(t){return t.names},"level",function(t){return t.level}],h$.prototype._astname="Exec",h$.prototype._fields=["body",function(t){return t.body},"globals",function(t){return t.globals},"locals",function(t){return t.locals}],f$.prototype._astname="Global",f$.prototype._fields=["names",function(t){return t.names}],p$.prototype._astname="NonLocal",p$.prototype._fields=["names",function(t){return t.names}],d$.prototype._astname="ExpressionStatement",d$.prototype._fields=["value",function(t){return t.value}],m$.prototype._astname="Pass",m$.prototype._fields=[],g$.prototype._astname="BreakStatement",g$.prototype._fields=[],x$.prototype._astname="ContinueStatement",x$.prototype._fields=[],y$.prototype._astname="BoolOp",y$.prototype._fields=["op",function(t){return t.op},"values",function(t){return t.values}],w$.prototype._astname="BinOp",w$.prototype._fields=["lhs",function(t){return t.lhs},"op",function(t){return t.op},"rhs",function(t){return t.rhs}],E$.prototype._astname="UnaryOp",E$.prototype._fields=["op",function(t){return t.op},"operand",function(t){return t.operand}],v$.prototype._astname="Lambda",v$.prototype._fields=["args",function(t){return t.args},"body",function(t){return t.body}],D$.prototype._astname="IfExp",D$.prototype._fields=["test",function(t){return t.test},"body",function(t){return t.body},"orelse",function(t){return t.orelse}],b$.prototype._astname="Dict",b$.prototype._fields=["keys",function(t){return t.keys},"values",function(t){return t.values}],A$.prototype._astname="ListComp",A$.prototype._fields=["elt",function(t){return t.elt},"generators",function(t){return t.generators}],S$.prototype._astname="GeneratorExp",S$.prototype._fields=["elt",function(t){return t.elt},"generators",function(t){return t.generators}],k$.prototype._astname="Yield",k$.prototype._fields=["value",function(t){return t.value}],_$.prototype._astname="Compare",_$.prototype._fields=["left",function(t){return t.left},"ops",function(t){return t.ops},"comparators",function(t){return t.comparators}],F$.prototype._astname="Call",F$.prototype._fields=["func",function(t){return t.func},"args",function(t){return t.args},"keywords",function(t){return t.keywords},"starargs",function(t){return t.starargs},"kwargs",function(t){return t.kwargs}],C$.prototype._astname="Num",C$.prototype._fields=["n",function(t){return t.n.value}],T$.prototype._astname="Str",T$.prototype._fields=["s",function(t){return t.s.value}],M$.prototype._astname="Attribute",M$.prototype._fields=["value",function(t){return t.value},"attr",function(t){return t.attr.value},"ctx",function(t){return t.ctx}],O$.prototype._astname="Subscript",O$.prototype._fields=["value",function(t){return t.value},"slice",function(t){return t.slice},"ctx",function(t){return t.ctx}],N$.prototype._astname="Name",N$.prototype._fields=["id",function(t){return t.id.value},"ctx",function(t){return t.ctx}],L$.prototype._astname="List",L$.prototype._fields=["elts",function(t){return t.elts},"ctx",function(t){return t.ctx}],B$.prototype._astname="Tuple",B$.prototype._fields=["elts",function(t){return t.elts},"ctx",function(t){return t.ctx}],aU.prototype._astname="Load",aU.prototype._isenum=!0,uU.prototype._astname="Store",uU.prototype._isenum=!0,cU.prototype._astname="Del",cU.prototype._isenum=!0,lU.prototype._astname="AugLoad",lU.prototype._isenum=!0,hU.prototype._astname="AugStore",hU.prototype._isenum=!0,fU.prototype._astname="Param",fU.prototype._isenum=!0,q$.prototype._astname="Ellipsis",q$.prototype._fields=[],I$.prototype._astname="Slice",I$.prototype._fields=["lower",function(t){return t.lower},"upper",function(t){return t.upper},"step",function(t){return t.step}],P$.prototype._astname="ExtSlice",P$.prototype._fields=["dims",function(t){return t.dims}],R$.prototype._astname="Index",R$.prototype._fields=["value",function(t){return t.value}],pU.prototype._astname="And",pU.prototype._isenum=!0,dU.prototype._astname="Or",dU.prototype._isenum=!0,mU.prototype._astname="Add",mU.prototype._isenum=!0,gU.prototype._astname="Sub",gU.prototype._isenum=!0,xU.prototype._astname="Mult",xU.prototype._isenum=!0,yU.prototype._astname="Div",yU.prototype._isenum=!0,wU.prototype._astname="Mod",wU.prototype._isenum=!0,EU.prototype._astname="Pow",EU.prototype._isenum=!0,vU.prototype._astname="LShift",vU.prototype._isenum=!0,DU.prototype._astname="RShift",DU.prototype._isenum=!0,bU.prototype._astname="BitOr",bU.prototype._isenum=!0,AU.prototype._astname="BitXor",AU.prototype._isenum=!0,SU.prototype._astname="BitAnd",SU.prototype._isenum=!0,kU.prototype._astname="FloorDiv",kU.prototype._isenum=!0,_U.prototype._astname="Invert",_U.prototype._isenum=!0,FU.prototype._astname="Not",FU.prototype._isenum=!0,CU.prototype._astname="UAdd",CU.prototype._isenum=!0,TU.prototype._astname="USub",TU.prototype._isenum=!0,MU.prototype._astname="Eq",MU.prototype._isenum=!0,OU.prototype._astname="NotEq",OU.prototype._isenum=!0,NU.prototype._astname="Lt",NU.prototype._isenum=!0,LU.prototype._astname="LtE",LU.prototype._isenum=!0,BU.prototype._astname="Gt",BU.prototype._isenum=!0,qU.prototype._astname="GtE",qU.prototype._isenum=!0,IU.prototype._astname="Is",IU.prototype._isenum=!0,PU.prototype._astname="IsNot",PU.prototype._isenum=!0,RU.prototype._astname="In",RU.prototype._isenum=!0,UU.prototype._astname="NotIn",UU.prototype._isenum=!0,U$.prototype._astname="Comprehension",U$.prototype._fields=["target",function(t){return t.target},"iter",function(t){return t.iter},"ifs",function(t){return t.ifs}],$$.prototype._astname="ExceptHandler",$$.prototype._fields=["type",function(t){return t.type},"name",function(t){return t.name},"body",function(t){return t.body}],z$.prototype._astname="Arguments",z$.prototype._fields=["args",function(t){return t.args},"vararg",function(t){return t.vararg},"kwarg",function(t){return t.kwarg},"defaults",function(t){return t.defaults}],W$.prototype._astname="Keyword",W$.prototype._fields=["arg",function(t){return t.arg.value},"value",function(t){return t.value}],JU.prototype._astname="FunctionParamDef",JU.prototype._fields=["name",function(t){return t.name},"type",function(t){return t.type}],X$.prototype._astname="Alias",X$.prototype._fields=["name",function(t){return t.name.value},"asname",function(t){return t.asname}];const K$=rR.sym,H$=Math.pow(2,53);function J$(t,e){VP("string"==typeof t,"message must be a string"),VP(QP(e.begin.line),"lineNumber must be a number");const n=new SyntaxError(t);return n.lineNumber=e.begin.line,n}class G${constructor(t){this.c_encoding=t}}function V$(t,e){t.type!==e&&jP(`node must have type ${e} = ${iR(e)}, but was ${t.type} = ${iR(t.type)}.`)}function j$(t){return"string"!=typeof t&&jP("expecting string, got "+typeof t),t}function Q$(t){switch(t.type){case K$.single_input:return YP(t,0).type===MP.T_NEWLINE?0:Q$(YP(t,0));case K$.file_input:let e=0;for(let n=0;n<ZP(t);++n){const r=YP(t,n);r.type===K$.stmt&&(e+=Q$(r))}return e;case K$.stmt:return Q$(YP(t,0));case K$.compound_stmt:return 1;case K$.simple_stmt:return Math.floor(ZP(t)/2);case K$.suite:if(1===ZP(t))return Q$(YP(t,0));{let e=0;for(let n=2;n<ZP(t)-1;++n)e+=Q$(YP(t,n));return e}default:throw new Error("Non-statement found")}}function Z$(t,e,n,r){if("None"===n)throw J$("assignment to None",r);if("True"===n||"False"===n)throw J$("assignment to True or False is forbidden",r)}function Y$(t,e,n,r){VP(n!==hU&&n!==lU);let s=null,i=null;if(e instanceof M$)n===uU&&Z$(0,0,e.attr.value,r.range),e.ctx=n;else if(e instanceof N$)n===uU&&Z$(0,0,void 0,r.range),e.ctx=n;else if(e instanceof O$)e.ctx=n;else if(e instanceof L$)e.ctx=n,s=e.elts;else if(e instanceof B$){if(0===e.elts.length)throw J$("can't assign to ()",r.range);e.ctx=n,s=e.elts}else if(e instanceof v$)i="lambda";else if(e instanceof F$)i="function call";else if(e instanceof y$)i="operator";else switch(e.constructor){case y$:case w$:case E$:i="operator";break;case S$:i="generator expression";break;case k$:i="yield expression";break;case A$:i="list comprehension";break;case b$:case C$:case T$:i="literal";break;case _$:i="comparison expression";break;case D$:i="conditional expression";break;default:throw new Error("unhandled expression in assignment")}if(i)throw J$("can't "+(n===uU?"assign to":"delete")+" "+i,r.range);if(s)for(const e of s)Y$(t,e,n,r)}const tz={};function ez(t){return VP(void 0!==tz[t.type],`${t.type}`),{op:tz[t.type],range:t.range}}function nz(t,e){if(V$(e,K$.comp_op),1===ZP(e))switch((e=YP(e,0)).type){case MP.T_LESS:return NU;case MP.T_GREATER:return BU;case MP.T_EQEQUAL:return MU;case MP.T_LESSEQUAL:return LU;case MP.T_GREATEREQUAL:return qU;case MP.T_NOTEQUAL:return OU;case MP.T_NAME:if("in"===e.value)return RU;if("is"===e.value)return IU}else if(2===ZP(e)&&YP(e,0).type===MP.T_NAME){if("in"===YP(e,1).value)return UU;if("is"===YP(e,0).value)return PU}throw new Error("invalid comp_op")}function rz(t,e){VP(e.type===K$.testlist||e.type===K$.listmaker||e.type===K$.testlist_gexp||e.type===K$.testlist_safe||e.type===K$.testlist1);const n=[];for(let r=0;r<ZP(e);r+=2)VP(YP(e,r).type===K$.IfExpr||YP(e,r).type===K$.old_test),n[r/2]=Cz(t,YP(e,r));return n}function sz(t,e){V$(e,K$.suite);const n=[];let r,s=0;if(YP(e,0).type===K$.simple_stmt){let r=ZP(e=YP(e,0))-1;YP(e,r-1).type===MP.T_SEMI&&(r-=1);for(let i=0;i<r;i+=2)n[s++]=Tz(t,YP(e,i))}else for(let i=2;i<ZP(e)-1;++i){if(r=YP(e,i),V$(r,K$.stmt),1===Q$(r))n[s++]=Tz(t,r);else{r=YP(r,0),V$(r,K$.simple_stmt);for(let e=0;e<ZP(r);e+=2){if(0===ZP(YP(r,e))){VP(e+1===ZP(r));break}n[s++]=Tz(t,YP(r,e))}}}return VP(s===Q$(e)),n}function iz(t,e,n){if(V$(e,K$.except_clause),V$(n,K$.suite),1===ZP(e))return new $$(null,null,sz(t,n),e.range);if(2===ZP(e))return new $$(Cz(t,YP(e,1)),null,sz(t,n),e.range);if(4===ZP(e)){const r=Cz(t,YP(e,3));return Y$(t,r,uU,YP(e,3)),new $$(Cz(t,YP(e,1)),r,sz(t,n),e.range)}throw new Error("wrong number of children for except clause")}function oz(t,e){V$(e,K$.decorator),V$(YP(e,0),MP.T_AT),V$(YP(e,ZP(e)-1),MP.T_NEWLINE);const n=function(t,e){V$(e,K$.dotted_name);const n=YP(e,0);let r=new $U(n.value,n.range),s=new N$(r,aU);for(let t=2;t<ZP(e);t+=2){const n=YP(e,t);r=new $U(n.value,n.range),s=new M$(s,r,aU,e.range)}return s}(0,YP(e,1));return 3===ZP(e)?n:5===ZP(e)?new F$(n,[],[],null,null):dz(t,YP(e,3),n)}function az(t,e){V$(e,K$.decorated);const n=function(t,e){V$(e,K$.decorators);const n=[];for(let r=0;r<ZP(e);++r)n[r]=oz(t,YP(e,r));return n}(t,YP(e,0));VP(YP(e,1).type===K$.funcdef||YP(e,1).type===K$.classdef);let r=null;if(YP(e,1).type===K$.funcdef)r=xz(t,YP(e,1),n);else{if(YP(e,1).type!==K$.classdef)throw new Error("astForDecorated");r=yz(t,YP(e,1),n)}return r}function uz(t,e){let n=3;VP(e.type===K$.with_stmt);const r=Cz(t,YP(e,1));let s;return YP(e,2).type===K$.with_var&&(s=function(t,e){return V$(e,K$.with_var),Cz(t,YP(e,1))}(t,YP(e,2)),Y$(t,s,uU,e),n=4),new s$(r,s,sz(t,YP(e,n)),e.range)}function cz(t,e,n){V$(e,K$.ExprList);const r=[];for(let s=0;s<ZP(e);s+=2){const i=Cz(t,YP(e,s));r[s/2]=i,n&&Y$(t,i,n,YP(e,s))}return r}function lz(t,e){t:for(;;)switch(e.type){case K$.ImportSpecifier:{let t=null;const n=YP(e,0),r=j$(n.value),s=n.range;return 3===ZP(e)&&(t=YP(e,2).value),new X$(new $U(r,s),null==t?null:j$(t))}case K$.dotted_as_name:if(1===ZP(e)){e=YP(e,0);continue t}{const n=lz(t,YP(e,0));return VP(!n.asname),n.asname=j$(YP(e,2).value),n}case K$.dotted_name:if(1===ZP(e)){const t=YP(e,0),n=j$(t.value),r=t.range;return new X$(new $U(n,r),null)}{let t="";for(let n=0;n<ZP(e);n+=2)t+=YP(e,n).value+".";return new X$(new $U(t.substr(0,t.length-1),null),null)}case MP.T_STAR:return new X$(new $U("*",e.range),null);case MP.T_NAME:return new X$(new $U(e.value,e.range),null);default:throw J$(`unexpected import name ${iR(e.type)}`,e.range)}}function hz(t,e){V$(e,K$.ModuleSpecifier);const n=ZP(e);let r,s="";for(let i=0;i<n;++i){const n=YP(e,i);s+=Sz(t,n.value),r=n.range}return{value:s,range:r}}function fz(t,e){V$(e,K$.import_stmt);let n=YP(e,0);if(n.type===K$.import_name){const r=YP(n,1);V$(r,K$.dotted_as_names);const s=[];for(let e=0;e<ZP(r);e+=2)s[e/2]=lz(t,YP(r,e));return new c$(s,e.range)}if(n.type===K$.import_from){let r,s,i,o=0;for(i=1;i<ZP(n);++i){const e=YP(n,i),s=e.type;if(s===K$.dotted_name)throw J$(`unknown import statement ${iR(s)}.`,e.range);if(s===K$.ModuleSpecifier){r=hz(t,e);break}if(s!==MP.T_DOT)throw J$(`unknown import statement ${iR(s)}.`,e.range);o++}++i;let a=n;switch(YP(n,i).type){case MP.T_STAR:a=YP(n,i),s=1;break;case MP.T_LPAR:a=YP(a,i+1),s=ZP(a);break;case K$.ImportList:if(a=YP(a,i),s=ZP(a),s%2==0)throw J$("trailing comma not allowed without surrounding parentheses",a.range)}const u=[];if(a.type===MP.T_STAR)u[0]=lz(t,a);else{V$(a,K$.import_from);const e=YP(a,function(t,e){VP(void 0!==e);const n=tR(t),r=n.length;for(let t=0;t<r;t++)if(n[t].type===e)return t;return-1}(a,K$.ImportList));!function(t,e,n){V$(e,K$.ImportList);const r=ZP(e);for(let s=0;s<r;s++){const r=YP(e,s);r.type===K$.ImportSpecifier&&n.push(lz(t,r))}}(t,e,u)}return VP("string"==typeof r.value),new l$(new $U(r.value,r.range),u,o,e.range)}throw J$(`unknown import statement ${iR(n.type)}.`,n.range)}function pz(t,e){if(YP(e,0).type===MP.T_MINUS&&2===ZP(e)){const n=YP(e,1);if(n.type===K$.UnaryExpr&&1===ZP(n)){const e=YP(n,0);if(e.type===K$.PowerExpr&&1===ZP(e)){const n=YP(e,0);if(n.type===K$.AtomExpr){const e=YP(n,0);if(e.type===MP.T_NUMBER)return e.value="-"+e.value,_z(t,n)}}}}const n=Cz(t,YP(e,1));switch(YP(e,0).type){case MP.T_PLUS:return new E$(CU,n,e.range);case MP.T_MINUS:return new E$(TU,n,e.range);case MP.T_TILDE:return new E$(_U,n,e.range)}throw new Error("unhandled UnaryExpr")}function dz(t,e,n){V$(e,K$.arglist);let r=0,s=0,i=0;for(let t=0;t<ZP(e);++t){const n=YP(e,t);n.type===K$.argument&&(1===ZP(n)?r++:YP(n,1).type===K$.gen_for?i++:s++)}if(i>1||i&&(r||s))throw J$("Generator expression must be parenthesized if not sole argument",e.range);if(r+s+i>255)throw J$("more than 255 arguments",e.range);const o=[],a=[];r=0,s=0;let u=null,c=null;for(let n=0;n<ZP(e);++n){const i=YP(e,n);if(i.type===K$.argument)if(1===ZP(i)){if(s)throw J$("non-keyword arg after keyword arg",e.range);if(u)throw J$("only named arguments may follow *expression",e.range);o[r++]=Cz(t,YP(i,0))}else if(YP(i,1).type===K$.gen_for)o[r++]=Ez(t,i);else{const n=Cz(t,YP(i,0));if(n.constructor===v$)throw J$("lambda cannot contain assignment",e.range);if(n.constructor!==N$)throw J$("keyword can't be an expression",e.range);const r=n.id;Z$(0,YP(i,0),r.value,e.range);for(let t=0;t<s;++t){if(a[t].arg.value===r.value)throw J$("keyword argument repeated",e.range)}a[s++]=new W$(r,Cz(t,YP(i,2)))}else i.type===MP.T_STAR?u=Cz(t,YP(e,++n)):i.type===MP.T_DOUBLESTAR&&(c=Cz(t,YP(e,++n)))}const l=function(t){let e=[],n=[];for(const r of t)n.push(r.value),e.push(new N$(new $U(r.arg.value,r.arg.range),aU));return new b$(e,n)}(a);return 0!==l.keys.length&&o.push(l),new F$(n,o,[],u,c)}function mz(t,e,n){const r=e,s=YP(r,0),i=YP(r,1),o=YP(r,2);if(V$(r,K$.trailer),s.type===MP.T_LPAR)return 2===ZP(r)?new F$(n,[],[],null,null):dz(t,i,n);if(s.type===MP.T_DOT)return new M$(n,new $U(i.value,i.range),aU,r.range);{V$(s,MP.T_LSQB),V$(o,MP.T_RSQB);const e=i;if(1===ZP(e))return new O$(n,kz(t,YP(e,0)),aU,e.range);{let r=!0;const s=[];for(let n=0;n<ZP(e);n+=2){const i=kz(t,YP(e,n));i.constructor!==R$&&(r=!1),s[n/2]=i}if(!r)return new O$(n,new P$(s),aU,e.range);const i=[];for(let t=0;t<s.length;++t){let e=s[t];e instanceof R$?(VP(null!==e.value&&void 0!==e.value),i[t]=e.value):VP(e instanceof R$)}const o=new B$(i,aU,e.range);return new O$(n,new R$(o),aU,e.range)}}}function gz(t,e){let n,r=null,s=null;if(e.type===K$.parameters){if(2===ZP(e))return new z$([],null,null,[]);e=YP(e,1)}V$(e,K$.varargslist);const i=[],o=[];let a=!1,u=0,c=0,l=0;for(;u<ZP(e);)switch(n=YP(e,u),n.type){case K$.fpdef:let h=0,f=!1;t:for(;;){if(u+1<ZP(e)&&YP(e,u+1).type===MP.T_EQUAL)o[c++]=Cz(t,YP(e,u+2)),u+=2,a=!0;else if(a){if(f&&!h)throw J$("parenthesized arg with default",e.range);throw J$("non-default argument follows default argument",e.range)}if(3===ZP(n)&&n.children[2].type===MP.T_RPAR){if(n=YP(n,1),1!==ZP(n))throw J$("tuple parameter unpacking has been removed",e.range);f=!0,n=YP(n,0),VP(n.type===K$.fpdef);continue t}const r=YP(n,0);if(r.type===MP.T_NAME){Z$(0,0,r.value,e.range);const s=new $U(r.value,r.range),o=YP(n,2);if(o){let e=Cz(t,o);i[l++]=new JU(new N$(s,fU),e)}else i[l++]=new JU(new N$(s,fU))}if(u+=2,f)throw J$("parenthesized argument names are invalid",e.range);break}break;case MP.T_STAR:Z$(0,YP(e,u+1),YP(e,u+1).value,e.range),r=j$(YP(e,u+1).value),u+=3;break;case MP.T_DOUBLESTAR:Z$(0,YP(e,u+1),YP(e,u+1).value,e.range),s=j$(YP(e,u+1).value),u+=3;break;default:throw new Error("unexpected node in varargslist")}return new z$(i,r,s,o)}function xz(t,e,n){V$(e,K$.funcdef);const r=ZP(e);let s,i,o,a,u;return 8!==r&&6!==r?(s=YP(e,1),i=j$(s.value),Z$(0,0,i,e.range),o=gz(t,YP(e,2))):(s=YP(e,2),i=j$(s.value),Z$(0,0,i,e.range),o=gz(t,YP(e,3))),5===r?(a=sz(t,YP(e,4)),u=null):6===r?(a=sz(t,YP(e,5)),u=null):7===r?(u=Cz(t,YP(e,4)),a=sz(t,YP(e,6))):8===r?(u=Cz(t,YP(e,5)),a=sz(t,YP(e,7))):jP(`Was expecting 5, 7 or 8 children, received ${r} children`),new HU(new $U(i,s.range),o,a,u,n,e.range)}function yz(t,e,n){const r=e,s=ZP(r);let i,o,a;if(V$(r,K$.classdef),5!==s&&8!==s?7===s&&YP(r,4).type===MP.T_RPAR||(i=YP(r,1),Z$(0,0,i.value,r.range),o=j$(i.value),a=i.range):(i=YP(r,2),Z$(0,0,i.value,r.range),o=j$(i.value),a=i.range),4===s)return new GU(new $U(o,a),[],sz(t,YP(r,3)),n,r.range);7===s&&(YP(r,3).type,MP.T_RPAR);const u=YP(r,3);if(u.type===MP.T_RPAR)return new GU(new $U(o,a),[],sz(t,YP(r,5)),n,r.range);const c=function(t,e){const n=ZP(e);return VP(n>0),V$(e,K$.testlist),1===n?[Cz(t,YP(e,0))]:rz(t,e)}(t,u),l=sz(t,YP(r,6));return new GU(new $U(o,a),c,l,n,r.range)}function wz(t,e){let n,r;return 3===ZP(e)?(n=new z$([],null,null,[]),r=Cz(t,YP(e,2))):(n=gz(t,YP(e,1)),r=Cz(t,YP(e,3))),new v$(n,r,e.range)}function Ez(t,e){function n(t,e){let n=0;for(;;){if(V$(e,K$.gen_iter),YP(e,0).type===K$.gen_for)return n;if(V$(e=YP(e,0),K$.gen_if),n++,2===ZP(e))return n;e=YP(e,2)}}VP(e.type===K$.testlist_gexp||e.type===K$.argument),VP(ZP(e)>1);const r=Cz(t,YP(e,0)),s=function(t,e){let n=0,r=YP(e,1);t:for(;;){if(n++,V$(r,K$.gen_for),5!==ZP(r))return n;r=YP(r,4);e:for(;;){if(V$(r,K$.gen_iter),r=YP(r,0),r.type===K$.gen_for)continue t;if(r.type===K$.gen_if){if(3===ZP(r)){r=YP(r,2);continue e}return n}break}break}throw new Error("logic error in countGenFors")}(0,e),i=[];let o=YP(e,1);for(let e=0;e<s;++e){V$(o,K$.gen_for);const r=YP(o,1),s=cz(t,r,uU);let a,u=Cz(t,YP(o,3));if(a=1===ZP(r)?new U$(s[0],u,[]):new U$(new B$(s,uU,o.range),u,[]),5===ZP(o)){o=YP(o,4);const e=n(0,o),r=[];for(let n=0;n<e;++n)V$(o,K$.gen_iter),o=YP(o,0),V$(o,K$.gen_if),u=Cz(t,YP(o,1)),r[n]=u,3===ZP(o)&&(o=YP(o,2));o.type===K$.gen_iter&&(o=YP(o,0)),a.ifs=r}i[e]=a}return new S$(r,i,e.range)}function vz(t,e){let n=new w$(Cz(t,YP(e,0)),ez(YP(e,1)),Cz(t,YP(e,2)),e.range);const r=(ZP(e)-1)/2;for(let s=1;s<r;++s){const r=YP(e,2*s+1),i=Cz(t,YP(e,2*s+2));n=new w$(n,ez(r),i,r.range)}return n}function Dz(t,e){return VP(ZP(e)>0),e.type===K$.testlist_gexp?ZP(e)>1&&VP(YP(e,1).type!==K$.gen_for):VP(e.type===K$.testlist||e.type===K$.testlist_safe||e.type===K$.testlist1),1===ZP(e)?Cz(t,YP(e,0)):new B$(rz(t,e),aU,e.range)}function bz(t,e){const n=e;if(V$(n,K$.ExprStmt),1===ZP(n))return new d$(Dz(t,YP(n,0)),n.range);if(YP(n,1).type===K$.augassign){let e=YP(n,0);const r=Dz(t,e);switch(r.constructor){case S$:throw J$("augmented assignment to generator expression not possible",n.range);case k$:throw J$("augmented assignment to yield expression not possible",n.range);case N$:Z$(0,0,r.id.value,n.range);break;case M$:case O$:break;default:throw J$("illegal expression for augmented assignment",n.range)}let s;return Y$(t,r,uU,e),e=YP(n,2),s=e.type===K$.testlist?Dz(t,e):Cz(t,e),new ZU(r,function(t,e){switch(V$(e,K$.augassign),(e=YP(e,0)).value.charAt(0)){case"+":return mU;case"-":return gU;case"/":return"/"===e.value.charAt(1)?kU:yU;case"%":return wU;case"<":return vU;case">":return DU;case"&":return SU;case"^":return AU;case"|":return bU;case"*":return"*"===e.value.charAt(1)?EU:xU;default:throw new Error("invalid augassign")}}(0,YP(n,1)),s,n.range)}if(YP(n,1).type===K$.annasign){const e=YP(n,0),r=YP(n,1),s=Cz(t,YP(r,1)),i=YP(r,2);if(i){V$(i,MP.T_EQUAL);const o=[Dz(t,e)],a=YP(r,3);let u;return u=a.type===K$.testlist?Dz(t,a):Cz(t,a),new QU(o,u,n.range,i.range,s)}return new YU(s,Dz(t,e),n.range)}{const e=YP(n,1);V$(e,MP.T_EQUAL);const r=[],s=ZP(n);for(let e=0;e<s-2;e+=2){const s=YP(n,e);if(s.type===K$.YieldExpr)throw J$("assignment to yield expression not possible",n.range);const i=Dz(t,s);Y$(t,i,uU,YP(n,e)),r[e/2]=i}const i=YP(n,s-1);let o;return o=i.type===K$.testlist?Dz(t,i):Cz(t,i),new QU(r,o,n.range,e.range)}}function Az(t,e){return VP(5===ZP(e)),new D$(Cz(t,YP(e,2)),Cz(t,YP(e,0)),Cz(t,YP(e,4)),e.range)}function Sz(t,e){const n=function(t){return decodeURIComponent(function(t){return encodeURIComponent(t)}(t))};let r=e.charAt(0),s=!1;return"u"===r||"U"===r?r=(e=e.substr(1)).charAt(0):"r"!==r&&"R"!==r||(r=(e=e.substr(1)).charAt(0),s=!0),VP("b"!==r&&"B"!==r,"todo; haven't done b'' strings yet"),VP("'"===r||'"'===r&&e.charAt(e.length-1)===r),(e=e.substr(1,e.length-2)).length>=4&&e.charAt(0)===r&&e.charAt(1)===r&&(VP(e.charAt(e.length-1)===r&&e.charAt(e.length-2)===r),e=e.substr(2,e.length-4)),s||-1===e.indexOf("\\")?j$(n(e)):j$(function(t,e){const n=t.length;let r="";for(let e=0;e<n;++e){let n=t.charAt(e);if("\\"===n)if(++e,n=t.charAt(e),"n"===n)r+="\n";else if("\\"===n)r+="\\";else if("t"===n)r+="\t";else if("r"===n)r+="\r";else if("b"===n)r+="\b";else if("f"===n)r+="\f";else if("v"===n)r+="\v";else if("0"===n)r+="\0";else if('"'===n)r+='"';else if("'"===n)r+="'";else if("\n"===n);else if("x"===n){const n=t.charAt(++e),s=t.charAt(++e);r+=String.fromCharCode(parseInt(n+s,16))}else if("u"===n||"U"===n){const n=t.charAt(++e),s=t.charAt(++e),i=t.charAt(++e),o=t.charAt(++e);r+=String.fromCharCode(parseInt(n+s,16),parseInt(i+o,16))}else r+="\\"+n;else r+=n}return r}(e))}function kz(t,e){const n=e;V$(n,K$.subscript);let r=YP(n,0),s=null,i=null,o=null;if(r.type===MP.T_DOT)return new q$;if(1===ZP(n)&&r.type===K$.IfExpr){const e=Cz(t,r);return new R$(e)}if(r.type===K$.IfExpr&&(s=Cz(t,r)),r.type===MP.T_COLON){if(ZP(n)>1){const e=YP(n,1);e.type===K$.IfExpr&&(i=Cz(t,e))}}else if(ZP(n)>2){const e=YP(n,2);e.type===K$.IfExpr&&(i=Cz(t,e))}return r=YP(n,ZP(n)-1),r.type===K$.sliceop&&(1===ZP(r)?(r=YP(r,0),o=new N$(new $U("None",null),aU)):(r=YP(r,1),r.type===K$.IfExpr&&(o=Cz(t,r)))),new I$(s,i,o)}function _z(t,e){const n=YP(e,0);switch(n.type){case MP.T_NAME:return new N$(new $U(n.value,n.range),aU);case MP.T_STRING:return new T$(new $U(function(t,e){V$(YP(e,0),MP.T_STRING);let n="";for(let t=0;t<ZP(e);++t){const r=YP(e,t);try{n+=Sz(0,r.value)}catch(t){throw J$("invalid string (possibly contains a unicode character)",r.range)}}return n}(0,e),e.range));case MP.T_NUMBER:return new C$(new $U(function(t,e,n){const r=e.charAt(e.length-1);if("j"===r||"J"===r)throw J$("complex numbers are currently unsupported",n);if(-1!==e.indexOf("."))return sU(e);let s,i=e,o=10,a=!1;if("-"===e.charAt(0)&&(i=e.substr(1),a=!0),"0"!==i.charAt(0)||"x"!==i.charAt(1)&&"X"!==i.charAt(1)){if(-1!==e.indexOf("e")||-1!==e.indexOf("E"))return sU(e);if("0"!==i.charAt(0)||"b"!==i.charAt(1)&&"B"!==i.charAt(1))if("0"===i.charAt(0))if("0"===i)s=0;else{if("l"===r||"L"===r)return oU(e.substr(0,e.length-1),8);o=8,i=i.substring(1),"o"!==i.charAt(0)&&"O"!==i.charAt(0)||(i=i.substring(1)),s=parseInt(i,8)}else{if("l"===r||"L"===r)return oU(e.substr(0,e.length-1),o);s=parseInt(i,o)}else i=i.substring(2),s=parseInt(i,2),o=2}else i=i.substring(2),s=parseInt(i,16),o=16;return s>H$&&Math.floor(s)===s&&-1===e.indexOf("e")&&-1===e.indexOf("E")?oU(e,0):"l"===r||"L"===r?oU(e.substr(0,e.length-1),o):iU(a?-s:s)}(0,n.value,n.range),e.range));case MP.T_LPAR:{const n=YP(e,1);return n.type===MP.T_RPAR?new B$([],aU,e.range):n.type===K$.YieldExpr?Cz(t,n):ZP(n)>1&&YP(n,1).type===K$.gen_for?Ez(t,n):function(t,e){return VP(e.type===K$.testlist_gexp||e.type===K$.argument),ZP(e)>1&&YP(e,1).type===K$.gen_for?Ez(t,e):Dz(t,e)}(t,n)}case MP.T_LSQB:{const n=YP(e,1);return n.type===MP.T_RSQB?new L$([],aU,e.range):(V$(n,K$.listmaker),1===ZP(n)||YP(n,1).type===MP.T_COMMA?new L$(rz(t,n),aU,e.range):function(t,e){function n(t,e){let n=0;for(;;){if(V$(e,K$.list_iter),YP(e,0).type===K$.list_for)return n;if(V$(e=YP(e,0),K$.list_if),n++,2===ZP(e))return n;e=YP(e,2)}}V$(e,K$.listmaker),VP(ZP(e)>1);const r=Cz(t,YP(e,0)),s=function(t,e){let n=0,r=YP(e,1);t:for(;;){if(n++,V$(r,K$.list_for),5!==ZP(r))return n;r=YP(r,4);e:for(;;){if(V$(r,K$.list_iter),r=YP(r,0),r.type===K$.list_for)continue t;if(r.type===K$.list_if){if(3===ZP(r)){r=YP(r,2);continue e}return n}break}break}throw new Error("TODO: Should this be returning void 0?")}(0,e),i=[];let o=YP(e,1);for(let e=0;e<s;++e){V$(o,K$.list_for);const r=YP(o,1),s=cz(t,r,uU),a=Dz(t,YP(o,3));let u;if(u=1===ZP(r)?new U$(s[0],a,[]):new U$(new B$(s,uU,o.range),a,[]),5===ZP(o)){o=YP(o,4);const e=n(0,o),r=[];for(let n=0;n<e;++n)V$(o,K$.list_iter),o=YP(o,0),V$(o,K$.list_if),r[n]=Cz(t,YP(o,1)),3===ZP(o)&&(o=YP(o,2));o.type===K$.list_iter&&(o=YP(o,0)),u.ifs=r}i[e]=u}return new A$(r,i,e.range)}(t,n))}case MP.T_LBRACE:{const n=YP(e,1),r=ZP(n),s=[],i=[];for(let e=0;e<r;e+=4)s[e/4]=Cz(t,YP(n,e)),i[e/4]=Cz(t,YP(n,e+2));return new b$(s,i,e.range)}case MP.T_BACKQUOTE:throw J$("backquote not supported, use repr()",e.range);default:throw new Error(`unhandled atom '${iR(n.type)}'`)}}function Fz(t,e){const n=e;V$(n,K$.PowerExpr);const r=ZP(n),s=r-1;let i=_z(t,YP(n,0));if(1===r)return i;for(let e=1;e<r;++e){const r=YP(n,e);if(r.type!==K$.trailer)break;i=mz(t,r,i)}if(YP(n,s).type===K$.UnaryExpr){const e=Cz(t,YP(n,s));return new w$(i,ez(YP(n,r-2)),e,n.range)}return i}function Cz(t,e){t:for(;;)switch(e.type){case K$.IfExpr:case K$.old_test:if(YP(e,0).type===K$.LambdaExpr||YP(e,0).type===K$.old_LambdaExpr)return wz(t,YP(e,0));if(ZP(e)>1)return Az(t,e);case K$.OrExpr:case K$.AndExpr:if(1===ZP(e)){e=YP(e,0);continue t}const r=[];for(let n=0;n<ZP(e);n+=2)r[n/2]=Cz(t,YP(e,n));return"and"===YP(e,1).value?new y$(pU,r,e.range):(VP("or"===YP(e,1).value),new y$(dU,r,e.range));case K$.NotExpr:if(1===ZP(e)){e=YP(e,0);continue t}return new E$(FU,Cz(t,YP(e,1)),e.range);case K$.ComparisonExpr:if(1===ZP(e)){e=YP(e,0);continue t}{const n=[],r=[];for(let s=1;s<ZP(e);s+=2)n[(s-1)/2]=nz(0,YP(e,s)),r[(s-1)/2]=Cz(t,YP(e,s+1));return new _$(Cz(t,YP(e,0)),n,r,e.range)}case K$.ArithmeticExpr:case K$.GeometricExpr:case K$.ShiftExpr:case K$.BitwiseOrExpr:case K$.BitwiseXorExpr:case K$.BitwiseAndExpr:if(1===ZP(e)){e=YP(e,0);continue t}return vz(t,e);case K$.YieldExpr:let s=null;return 2===ZP(e)&&(s=Dz(t,YP(e,1))),new k$(s,e.range);case K$.UnaryExpr:if(1===ZP(e)){e=YP(e,0);continue t}return pz(t,e);case K$.PowerExpr:return Fz(t,e);default:throw new Error(`unhandled expr: n.type: ${e.type}, n.value: ${e.value}, n.range= ${e.range}, dump=${n=e,function t(e,n){let r="";if(rU(e.type)){if(r+=n+rR.number2symbol[e.type]+"\n",e.children)for(let s=0;s<e.children.length;++s)r+=t(e.children[s]," "+n)}else r+=n+sR[e.type]+": "+e.value+"\n";return r}(n,"")}`)}var n}function Tz(t,e){if(e.type===K$.stmt&&(VP(1===ZP(e)),e=YP(e,0)),e.type===K$.simple_stmt&&(VP(1===Q$(e)),e=YP(e,0)),e.type===K$.small_stmt)switch(V$(e,K$.small_stmt),(e=YP(e,0)).type){case K$.ExprStmt:return bz(t,e);case K$.print_stmt:return function(t,e){let n=1,r=null;V$(e,K$.print_stmt),ZP(e)>=2&&YP(e,1).type===MP.T_RIGHTSHIFT&&(r=Cz(t,YP(e,2)),n=4);const s=[];for(let r=n,i=0;r<ZP(e);r+=2,++i)s[i]=Cz(t,YP(e,r));const i=YP(e,ZP(e)-1).type!==MP.T_COMMA;return new t$(r,s,i,e.range)}(t,e);case K$.del_stmt:return function(t,e){return V$(e,K$.del_stmt),new jU(cz(t,YP(e,1),cU),e.range)}(t,e);case K$.pass_stmt:return new m$(e.range);case K$.flow_stmt:return function(t,e){V$(e,K$.flow_stmt);const n=YP(e,0);switch(n.type){case K$.break_stmt:return new g$(e.range);case K$.continue_stmt:return new x$(e.range);case K$.yield_stmt:return new d$(Cz(t,YP(n,0)),e.range);case K$.return_stmt:return 1===ZP(n)?new VU(null,e.range):new VU(Dz(t,YP(n,1)),e.range);case K$.raise_stmt:if(1===ZP(n))return new i$(null,null,null,e.range);if(2===ZP(n))return new i$(Cz(t,YP(n,1)),null,null,e.range);if(4===ZP(n))return new i$(Cz(t,YP(n,1)),Cz(t,YP(n,3)),null,e.range);if(6===ZP(n))return new i$(Cz(t,YP(n,1)),Cz(t,YP(n,3)),Cz(t,YP(n,5)),e.range);throw new Error("unhandled flow statement");default:throw new Error("unexpected flow_stmt")}}(t,e);case K$.import_stmt:return fz(t,e);case K$.GlobalStmt:return function(t,e){V$(e,K$.GlobalStmt);const n=[];for(let t=1;t<ZP(e);t+=2)n[(t-1)/2]=j$(YP(e,t).value);return new f$(n,e.range)}(0,e);case K$.NonLocalStmt:return function(t,e){V$(e,K$.NonLocalStmt);const n=[];for(let t=1;t<ZP(e);t+=2)n[(t-1)/2]=j$(YP(e,t).value);return new p$(n,e.range)}(0,e);case K$.exec_stmt:return function(t,e){let n=null,r=null;const s=ZP(e);VP(2===s||4===s||6===s),V$(e,K$.exec_stmt);const i=Cz(t,YP(e,1));return s>=4&&(n=Cz(t,YP(e,3))),6===s&&(r=Cz(t,YP(e,5))),new h$(i,n,r,e.range)}(t,e);case K$.assert_stmt:return function(t,e){if(V$(e,K$.assert_stmt),2===ZP(e))return new u$(Cz(t,YP(e,1)),null,e.range);if(4===ZP(e))return new u$(Cz(t,YP(e,1)),Cz(t,YP(e,3)),e.range);throw new Error("improper number of parts to assert stmt")}(t,e);default:throw new Error("unhandled small_stmt")}else{const n=YP(e,0);switch(V$(e,K$.compound_stmt),n.type){case K$.if_stmt:return function(t,e){if(V$(e,K$.if_stmt),4===ZP(e))return new r$(Cz(t,YP(e,1)),sz(t,YP(e,3)),[],e.range);const n=YP(e,4).value.charAt(2);if("s"===n)return new r$(Cz(t,YP(e,1)),sz(t,YP(e,3)),sz(t,YP(e,6)),e.range);if("i"===n){let n=ZP(e)-4,r=!1,s=[];YP(e,n+1).type===MP.T_NAME&&"s"===YP(e,n+1).value.charAt(2)&&(r=!0,n-=3),n/=4,r&&(s=[new r$(Cz(t,YP(e,ZP(e)-6)),sz(t,YP(e,ZP(e)-4)),sz(t,YP(e,ZP(e)-1)),YP(e,ZP(e)-6).range)],n--);for(let r=0;r<n;++r){const i=5+4*(n-r-1);s=[new r$(Cz(t,YP(e,i)),sz(t,YP(e,i+2)),s,YP(e,i).range)]}return new r$(Cz(t,YP(e,1)),sz(t,YP(e,3)),s,e.range)}throw new Error("unexpected token in 'if' statement")}(t,n);case K$.while_stmt:return function(t,e){if(V$(e,K$.while_stmt),4===ZP(e))return new n$(Cz(t,YP(e,1)),sz(t,YP(e,3)),[],e.range);if(7===ZP(e))return new n$(Cz(t,YP(e,1)),sz(t,YP(e,3)),sz(t,YP(e,6)),e.range);throw new Error("wrong number of tokens for 'while' stmt")}(t,n);case K$.for_stmt:return function(t,e){let n=[];V$(e,K$.for_stmt),9===ZP(e)&&(n=sz(t,YP(e,8)));const r=YP(e,1),s=cz(t,r,uU);let i;return i=1===ZP(r)?s[0]:new B$(s,uU,e.range),new e$(i,Dz(t,YP(e,3)),sz(t,YP(e,5)),n,e.range)}(t,n);case K$.try_stmt:return function(t,e){const n=ZP(e);let r=(n-3)/3,s=[],i=null;V$(e,K$.try_stmt);let o=sz(t,YP(e,2));if(YP(e,n-3).type===MP.T_NAME)"finally"===YP(e,n-3).value?(n>=9&&YP(e,n-6).type===MP.T_NAME&&(s=sz(t,YP(e,n-4)),r--),i=sz(t,YP(e,n-1)),r--):(s=sz(t,YP(e,n-1)),r--);else if(YP(e,n-3).type!==K$.except_clause)throw J$("malformed 'try' statement",e.range);if(r>0){const n=[];for(let s=0;s<r;++s)n[s]=iz(t,YP(e,3+3*s),YP(e,5+3*s));const a=new o$(o,n,s,e.range);if(!i)return a;o=[a]}return VP(null!==i),new a$(o,i,e.range)}(t,n);case K$.with_stmt:return uz(t,n);case K$.funcdef:return xz(t,n,[]);case K$.classdef:return yz(t,n,[]);case K$.decorated:return az(t,n);default:throw new Error("unhandled compound_stmt")}}}tz[MP.T_DOUBLESTAR]=EU,tz[MP.T_STAR]=xU,tz[MP.T_SLASH]=yU,tz[MP.T_PERCENT]=wU,tz[MP.T_PLUS]=mU,tz[MP.T_MINUS]=gU,tz[MP.T_LEFTSHIFT]=vU,tz[MP.T_RIGHTSHIFT]=DU,tz[MP.T_AMPER]=SU,tz[MP.T_CIRCUMFLEX]=AU,tz[MP.T_VBAR]=bU,tz[MP.T_DOUBLESLASH]=kU;const Mz=t(e.component);class Oz{constructor(){this.stack=[]}annAssign(t){throw new Error("Method not implemented.")}assign(t){t.targets.forEach((t=>{t.accept(this)})),t.value.accept(this);const e=this.stack.pop(),n=this.stack.pop();this.stack.push(At(xs,n,e))}attribute(t){throw new Error("Method not implemented.")}binOp(t){t.lhs.accept(this),t.rhs.accept(this);const e=this.stack.pop(),n=this.stack.pop();switch(t.op){case mU:this.stack.push(At(Ce,n,e));break;case gU:this.stack.push(At(Oe,n,e));break;case xU:this.stack.push(At(Ne,n,e));break;case yU:this.stack.push(At(Le,n,e));break;case EU:this.stack.push(At(Be,n,e));break;case AU:this.stack.push(At(qe,n,e));break;case bU:this.stack.push(At(Ie,n,e));break;case vU:this.stack.push(At(Re,n,e));break;case DU:this.stack.push(At(Ue,n,e));break;default:throw new Error(JSON.stringify(t,null,2))}}callExpression(t){const e=f(t.func.id?.value),n=[];t.args.forEach((t=>{t.accept(this),n.push(this.stack.pop())})),this.stack.push(At(e,...n))}classDef(t){throw new Error("Method not implemented.")}compareExpression(t){throw new Error("Method not implemented.")}dict(t){throw new Error("Method not implemented.")}expressionStatement(t){t.value.accept(this)}functionDef(t){const e=f(t.name.value),n=[];t.args.args.forEach((t=>{t.name.accept(this),n.push(this.stack.pop())}));const r=[];t.body.forEach((t=>{t.accept(this),r.push(this.stack.pop())}));const s=At(f("lambda"),At(...n),...r);this.stack.push(At(f("define"),e,s))}ifStatement(t){throw new Error("Method not implemented.")}importFrom(t){throw new Error("Method not implemented.")}list(t){const e=[];t.elts.forEach((t=>{t.accept(this),e.push(this.stack.pop())})),this.stack.push(P(e))}module(t){t.body.forEach((t=>{t.accept(this)}))}name(t){t.id.range,t.id.value,this.stack.push(f(t.id.value))}num(t){const e=t.n.value;if(t.n.range.begin,e.isInt())this.stack.push(x(e.value));else if(e.isFloat())this.stack.push((new $c).parse(e.text,0,0));else{if(!e.isLong())throw new Error;this.stack.push((new zc).parse(e.text,0,0))}}print(t){throw new Error("Method not implemented.")}returnStatement(t){t.value?t.value.accept(this):this.stack.push(kt)}str(t){t.s.range;const e=t.s.value;this.stack.push(new B(e,0,0))}subscript(t){t.value.accept(this);const e=this.stack.pop();if(t.slice instanceof q$)throw new Error;if(t.slice instanceof R$){t.slice.value.accept(this);const n=this.stack.pop();this.stack.push(At(Mz,e,n))}if(t.slice instanceof N$)throw new Error;if(t.slice instanceof I$)throw new Error}unaryOp(t){throw new Error("Method not implemented.")}forStatement(t){throw new Error("Method not implemented.")}}function Nz(t,e){const n=nU(t,eU.File);if("object"==typeof n){const t=function(t){const e=new G$("utf-8"),n=[];let r=0;for(let s=0;s<ZP(t)-1;++s){let i=YP(t,s);if(t.type===MP.T_NEWLINE)continue;V$(i,K$.stmt);const o=Q$(i);if(1===o)n[r++]=Tz(e,i);else{i=YP(i,0),V$(i,K$.simple_stmt);for(let t=0;t<o;++t)n[r++]=Tz(e,YP(i,2*t))}}return n}(n),e=new KU(t),r=new Oz;e.accept(r);const s=[];for(;r.stack.length>0;)s.push(r.stack.pop());return s.reverse(),{trees:s,errors:[]}}throw new Error}var Lz;function Bz(t){if(t)switch(t){case Lz.ClojureScript:return"ClojureScript";case Lz.EcmaScript:return"EcmaScript";case Lz.Eigenmath:return"Eigenmath";case Lz.PythonScript:return"PythonScript"}return"Eigenmath"}!function(t){t[t.ClojureScript=1]="ClojureScript",t[t.Eigenmath=2]="Eigenmath",t[t.EcmaScript=3]="EcmaScript",t[t.PythonScript=4]="PythonScript"}(Lz||(Lz={}));const qz=[Lz.ClojureScript,Lz.Eigenmath,Lz.PythonScript,Lz.EcmaScript];function Iz(t,e={}){return{trees:new Rc({bigIntAs:(t,e,n)=>new w(new g(BigInt(t)),gt.one,e,n),booAs:(t,e,n)=>new E(t,e,n),charAs:(t,e,n)=>new xt(t,e,n),fltAs:(t,e,n)=>new d(t,e,n),intAs:(t,e,n)=>new w(new g(BigInt(t)),gt.one,e,n),keywordAs:(t,e,n,r)=>new dt(t,e,n,r),listAs:(t,e,n)=>Ot(e,n,...t),mapAs:(t,e,n)=>new R(t,e,n),nilAs:(t,e)=>Ot(t,e),setAs:(t,e,n)=>new yt(t,e,n),strAs:(t,e,n)=>new B(t,e,n),symAs:(t,n,r,s)=>{const i=wt(t,n,r,s);if(e.lexicon){const t=i.key(),n=e.lexicon[t];if(n)return n}return i},tagAs:(t,e,n,r)=>new Et(t,e,n,r),vectorAs:(t,e,n)=>P(t,e,n),tagHandlers:{inst:t=>{if(h(t))return new vt(new Date(t.str),t.pos,t.end);throw new Error("")},uuid:t=>{if(h(t))return new Dt(t.str,t.pos,t.end);throw new Error("")}}}).next(t),errors:[]}}function Pz(t,e){const n=function(t){return t&&t.syntaxKind?t.syntaxKind:Lz.Eigenmath}(e);switch(n){case Lz.ClojureScript:return Iz(t,{lexicon:{}});case Lz.EcmaScript:return GP(t);case Lz.PythonScript:return Nz(t,function(t){if(t){if(t.useCaretForExponentiation)throw new Error("useCaretForExponentiation is not supported by the Python parser.");if(t.useParenForTensors)throw new Error("useParenForTensors is not supported by the Python parser.");return{explicitAssocAdd:t.explicitAssocAdd,explicitAssocExt:t.explicitAssocExt,explicitAssocMul:t.explicitAssocMul}}}(e));default:return NL(t,function(t){return t?{explicitAssocAdd:t.explicitAssocAdd,explicitAssocExt:t.explicitAssocExt,explicitAssocMul:t.explicitAssocMul,useCaretForExponentiation:t.useCaretForExponentiation,useParenForTensors:t.useParenForTensors}:{}}(e))}}var Rz;class Uz{constructor(t){Rz.set(this,new du([])),Pt(this,Rz,"f").push(t)}peek(){return Pt(this,Rz,"f").getAt(0)}pop(){return Pt(this,Rz,"f").pop()}push(t){Pt(this,Rz,"f").push(t)}}Rz=new WeakMap;class $z{constructor(){this.prints=[]}print(...t){this.prints.push(...t)}}const zz=t(e.circexp),Wz=t(e.clock),Xz=t(e.expand),Kz=t(e.factor),Hz=t(e.polar),Jz=t(e.rationalize),Gz=t(e.rect);function Vz(t,e,n){const{trees:r,errors:s}=Pz(t,e);if(s.length>0)return{values:[],prints:[],errors:s};const i=[],o=[];if(e.catchExceptions)try{jz(r,i,o,s,e,n)}catch(t){t instanceof Error?s.push(t):s.push(new Error(`${t}`))}else jz(r,i,o,s,e,n);return{values:i,prints:o,errors:s}}function jz(t,e,n,r,s,i){for(const o of t){const t=Qz(o,s,i);t.value&&(bt(t.value)||e.push(t.value));for(const e of t.prints)n.push(e);for(const e of t.errors)r.push(e)}}function Qz(t,e,n){const r=[],s=[],i=n.getPrintHandler(),o=new $z;n.setPrintHandler(o);try{const i=function(t,e,n){n.pushDirective(ie.useIntegersForPredicates,ae(e.useIntegersForPredicates));try{const r=function(t){const e=[];if(_t(t)){let n=t;for(;_t(n);){const t=n.opr;if(v(t)&&Zz(t)){e.push(t);const r=n.argList.head;if(_t(r)){n=r;continue}}break}}return e}(t);r.reverse(),t=function(t){if(_t(t)){let e=t;for(;_t(e);){const t=e.opr;if(v(t)&&Zz(t)){const t=e.argList.head;if(_t(t)){e=t;continue}}break}return e}return t}(t),Ge(0);const s=new Uz(t);if(e.autoExpand){n.pushDirective(ie.expanding,1);try{s.push(tW(Yz(s.pop(),r),n))}finally{n.popDirective()}}else s.push(tW(Yz(s.pop(),r),n));if(e.autoFactor){n.pushDirective(ie.factoring,1);try{s.push(tW(Yz(s.pop(),r),n))}finally{n.popDirective()}}const i=s.pop();if(kt!==i){if(s.push(i),n.hasBinding(Rs,kt)&&n.isone(n.getBinding(Rs,kt))){let t=Pl(s.pop(),n);t=tW(t,n),s.push(t)}!function(t,e,n,r){if((Ks.equals(t)||Hs.equals(t))&&L(e))return;const s=r.getSymbolsInfo();for(const t of s){const e=t.sym,s=t.value;if(L(s)){const t=yo(n.pop(),A,e,r);return void n.push(t)}}}(t,s.peek(),s,n)}else s.push(kt);return function(t,e){bt(t)||e.setBinding(Fa,t)}(s.peek(),n),s.pop()}finally{n.popDirective()}}(t,e,n);return r.push(...o.prints),{value:i,prints:r,errors:s}}finally{n.setPrintHandler(i)}}function Zz(t){return!!zz.equalsSym(t)||(!!Wz.equalsSym(t)||(!!Xz.equalsSym(t)||(!!Kz.equalsSym(t)||(!!Hz.equalsSym(t)||(!!Jz.equalsSym(t)||!!Gz.equalsSym(t))))))}function Yz(t,e){let n=t;for(const t of e)n=At(t,n);return n}function tW(t,e){const[,n]=e.transform(t);return n}function eW(t,e={useDerivativeShorthandLowerD:!1}){if(Ge(0),t.clearBindings(),t.clearOperators(),e&&e.assumes){const n=Object.keys(e.assumes);for(const r of n){const n=e.assumes[r];t.setSymbolPredicates(f(r),n)}}if(OL(t,{useDerivativeShorthandLowerD:!!e.useDerivativeShorthandLowerD}),t.buildOperators(),e&&e.prolog){if(!Array.isArray(e.prolog))throw new Error("prolog must be a string[]");oE(e.prolog,t)}}function nW(t){t.clearBindings(),t.clearOperators()}function rW(t={}){let e=1;const n=xv(function(t){const e=function(t,e){return t};if(t)return e({allowUndeclaredVars:"number"==typeof t.allowUndeclaredVars?t.allowUndeclaredVars:eX.Nil,assumes:t.assumes,dependencies:se,enable:t.enable,disable:t.disable,noOptimize:!1,useCaretForExponentiation:t.useCaretForExponentiation,useDerivativeShorthandLowerD:t.useDerivativeShorthandLowerD,useIntegersForPredicates:t.useIntegersForPredicates,useParenForTensors:t.useParenForTensors,syntaxKind:t.syntaxKind});return e({allowUndeclaredVars:eX.Nil,assumes:{},dependencies:se,enable:[],disable:[],noOptimize:!1,useCaretForExponentiation:!1,useDerivativeShorthandLowerD:!1,useIntegersForPredicates:!1,useParenForTensors:!1})}(t));switch(eW(n,t),t.syntaxKind){case Lz.ClojureScript:case Lz.Eigenmath:case Lz.PythonScript:break;default:iX(n),oX(n),aX(n),uX(n),cX(n)}return{get $(){return n},clearBindings(){n.clearBindings()},defineFunction(t,e){n.defineFunction(t,e)},getSymbolProps:t=>n.getSymbolPredicates(t),getBinding:(t,e)=>(I(t),n.getBinding(t,e)),getSymbolsInfo:()=>n.getSymbolsInfo(),evaluate(e,r){const s=function(t,e){const n={};e&&("boolean"==typeof e.autoExpand&&(n.autoExpand=e.autoExpand),"boolean"==typeof e.autoFactor&&(n.autoFactor=e.autoFactor),Array.isArray(e.disable)&&(n.disable=e.disable),Array.isArray(e.enable)&&(n.enable=e.enable));t&&("boolean"==typeof t.autoExpand&&(n.autoExpand=t.autoExpand),"boolean"==typeof t.autoFactor&&(n.autoFactor=t.autoFactor),Array.isArray(t.disable)&&(n.disable=t.disable),Array.isArray(t.enable)&&(n.enable=t.enable));return n}(r,t);return Qz(e,s,n)},executeProlog(t){oE(t,n)},executeScript(e,r){const s={};return t&&("boolean"==typeof t.catchExceptions&&(s.catchExceptions=t.catchExceptions),t.syntaxKind&&(s.syntaxKind=t.syntaxKind),"boolean"==typeof t.useIntegersForPredicates&&(s.useIntegersForPredicates=t.useIntegersForPredicates),t.disable),r&&("boolean"==typeof r.catchExceptions&&(s.catchExceptions=r.catchExceptions),r.syntaxKind&&(s.syntaxKind=r.syntaxKind),"boolean"==typeof r.useIntegersForPredicates&&(s.useIntegersForPredicates=r.useIntegersForPredicates)),Vz(e,function(t,e){return t?{catchExceptions:t.catchExceptions,syntaxKind:t.syntaxKind,useCaretForExponentiation:oe(e.getDirective(ie.useCaretForExponentiation)),useIntegersForPredicates:!!t.useIntegersForPredicates,useParenForTensors:oe(e.getDirective(ie.useParenForTensors)),explicitAssocAdd:!1,explicitAssocExt:!1,explicitAssocMul:!1}:{catchExceptions:!1,useCaretForExponentiation:!1,useIntegersForPredicates:!1,useParenForTensors:!1,explicitAssocAdd:!1,explicitAssocExt:!1,explicitAssocMul:!1}}(s,n),n)},renderAsAscii:t=>Vx(t,n),renderAsInfix:t=>ru(t,n),renderAsHuman:t=>Dy(t,n),renderAsLaTeX:t=>by(t,n),renderAsSExpr:t=>Oa(t,n),simplify:t=>qw(t,n),addRef(){e++},release(){e--,0===e&&nW(n)}}}var sW,iW,oW,aW,uW,cW,lW,hW,fW,pW,dW,mW,gW,xW,yW,wW,EW,vW,DW;class bW{constructor(t,e){this.thing=e,sW.set(this,void 0),Rt(this,sW,t,"f")}getPrintHandler(){throw new Error("Method not implemented.")}setPrintHandler(t){throw new Error("Method not implemented.")}abs(t){throw new Error("Method not implemented.")}algebra(t,e){throw new Error("Method not implemented.")}add(...t){throw new Error("Method not implemented.")}arccos(t){throw new Error("Method not implemented.")}arcsin(t){throw new Error("Method not implemented.")}arctan(t){throw new Error("Method not implemented.")}arg(t){throw new Error("Method not implemented.")}clock(t){throw new Error("Method not implemented.")}conj(t){throw new Error("Method not implemented.")}cos(t){throw new Error("Method not implemented.")}evaluate(t,...e){return Pt(this,sW,"f").evaluate(t,...e)}exp(t){throw new Error("Method not implemented.")}clearBindings(){throw new Error("Method not implemented.")}clearOperators(){throw new Error("Method not implemented.")}compareFn(t){throw new Error("Method not implemented.")}component(t,e){throw new Error("Method not implemented.")}defineConsTransformer(t,e){throw new Error("Method not implemented.")}defineFunction(t,e){throw new Error("Method not implemented.")}defineKeyword(t,e){throw new Error("Method not implemented.")}divide(t,e){throw new Error("Method not implemented.")}equals(t,e){throw new Error("Method not implemented.")}factor(t){throw new Error("Method not implemented.")}factorize(t,e){throw new Error("Method not implemented.")}float(t){throw new Error("Method not implemented.")}getDirective(t){throw new Error("Method not implemented.")}getSymbolPredicates(t){throw new Error("Method not implemented.")}getSymbolPrintName(t){throw new Error("Method not implemented.")}getBinding(t,e){return Pt(this,sW,"f").getBinding(t,e)}getUserFunction(t){return Pt(this,sW,"f").getSymbolUsrFunc(t)}getSymbolsInfo(){throw new Error("Method not implemented.")}buildOperators(){throw new Error("Method not implemented.")}im(t){throw new Error("Method not implemented.")}inner(t,e){throw new Error("Method not implemented.")}is(t,e){throw new Error("Method not implemented.")}iscomplex(t){throw new Error("Method not implemented.")}isExpanding(){throw new Error("Method not implemented.")}isFactoring(){throw new Error("Method not implemented.")}isimag(t){throw new Error("Method not implemented.")}isinfinite(t){throw new Error("Method not implemented.")}isinfinitesimal(t){throw new Error("Method not implemented.")}isminusone(t){throw new Error("Method not implemented.")}isnegative(t){throw new Error("Method not implemented.")}isone(t){throw new Error("Method not implemented.")}ispositive(t){throw new Error("Method not implemented.")}isreal(t){throw new Error("Method not implemented.")}isscalar(t){throw new Error("Method not implemented.")}hasBinding(t,e){return Pt(this,sW,"f").hasBinding(t,e)}hasUserFunction(t){return Pt(this,sW,"f").hasUserFunction(t)}iszero(t){throw new Error("Method not implemented.")}log(t){throw new Error("Method not implemented.")}multiply(...t){throw new Error("Method not implemented.")}negate(t){throw new Error("Method not implemented.")}outer(...t){throw new Error("Method not implemented.")}polar(t){throw new Error("Method not implemented.")}power(t,e){throw new Error("Method not implemented.")}re(t){throw new Error("Method not implemented.")}rect(t){throw new Error("Method not implemented.")}remove(t){throw new Error("Method not implemented.")}pushDirective(t,e){throw new Error("Method not implemented.")}popDirective(){throw new Error("Method not implemented.")}setSymbolOrder(t,e){throw new Error("Method not implemented.")}setSymbolPredicates(t,e){throw new Error("Method not implemented.")}setSymbolPrintName(t,e){throw new Error("Method not implemented.")}setBinding(t,e){Pt(this,sW,"f").setBinding(t,e)}setUserFunction(t,e){Pt(this,sW,"f").setSymbolUsrFunc(t,e)}simplify(t){throw new Error("Method not implemented.")}sin(t){throw new Error("Method not implemented.")}sqrt(t){throw new Error("Method not implemented.")}st(t){throw new Error("Method not implemented.")}subst(t,e,n){throw new Error("Method not implemented.")}subtract(t,e){throw new Error("Method not implemented.")}toInfixString(t){throw new Error("Method not implemented.")}toLatexString(t){throw new Error("Method not implemented.")}toSExprString(t){throw new Error("Method not implemented.")}transform(t){throw new Error("Method not implemented.")}valueOf(t){return Pt(this,sW,"f").valueOf(t)}}sW=new WeakMap;class AW{constructor(t,e,n){this.parentEnv=t,this.strict=e,this.thing=n}hasBinding(t,e){return this.parentEnv.hasBinding(t,e)}hasUserFunction(t){return this.parentEnv.hasUserFunction(t)}getPrintHandler(){throw new Error("Method not implemented.")}setPrintHandler(t){throw new Error("Method not implemented.")}abs(t){throw new Error("Method not implemented.")}algebra(t,e){throw new Error("Method not implemented.")}add(...t){throw new Error("Method not implemented.")}arccos(t){throw new Error("Method not implemented.")}arcsin(t){throw new Error("Method not implemented.")}arctan(t){throw new Error("Method not implemented.")}arg(t){throw new Error("Method not implemented.")}clock(t){throw new Error("Method not implemented.")}conj(t){throw new Error("Method not implemented.")}cos(t){throw new Error("Method not implemented.")}evaluate(t,...e){return this.parentEnv.evaluate(t,...e)}exp(t){throw new Error("Method not implemented.")}clearBindings(){throw new Error("Method not implemented.")}clearOperators(){throw new Error("Method not implemented.")}compareFn(t){throw new Error("Method not implemented.")}component(t,e){throw new Error("Method not implemented.")}defineConsTransformer(t,e){throw new Error("Method not implemented.")}defineFunction(t,e){throw new Error("Method not implemented.")}defineKeyword(t,e){throw new Error("Method not implemented.")}divide(t,e){throw new Error("Method not implemented.")}equals(t,e){throw new Error("Method not implemented.")}factor(t){throw new Error("Method not implemented.")}factorize(t,e){throw new Error("Method not implemented.")}float(t){throw new Error("Method not implemented.")}getDirective(t){throw new Error("Method not implemented.")}getSymbolPredicates(t){throw new Error("Method not implemented.")}getSymbolPrintName(t){throw new Error("Method not implemented.")}getBinding(t,e){return this.parentEnv.getBinding(t,e)}getUserFunction(t){throw new Error("Method not implemented.")}getSymbolsInfo(){throw new Error("Method not implemented.")}buildOperators(){throw new Error("Method not implemented.")}im(t){throw new Error("Method not implemented.")}inner(t,e){throw new Error("Method not implemented.")}is(t,e){throw new Error("Method not implemented.")}iscomplex(t){throw new Error("Method not implemented.")}isExpanding(){throw new Error("Method not implemented.")}isFactoring(){throw new Error("Method not implemented.")}isimag(t){throw new Error("Method not implemented.")}isinfinite(t){throw new Error("Method not implemented.")}isinfinitesimal(t){throw new Error("Method not implemented.")}isminusone(t){throw new Error("Method not implemented.")}isnegative(t){throw new Error("Method not implemented.")}isone(t){throw new Error("Method not implemented.")}ispositive(t){throw new Error("Method not implemented.")}isreal(t){throw new Error("Method not implemented.")}isscalar(t){throw new Error("Method not implemented.")}iszero(t){throw new Error("Method not implemented.")}log(t){throw new Error("Method not implemented.")}multiply(...t){throw new Error("Method not implemented.")}negate(t){throw new Error("Method not implemented.")}outer(...t){throw new Error("Method not implemented.")}polar(t){throw new Error("Method not implemented.")}power(t,e){throw new Error("Method not implemented.")}re(t){throw new Error("Method not implemented.")}rect(t){throw new Error("Method not implemented.")}remove(t){throw new Error("Method not implemented.")}pushDirective(t,e){throw new Error("Method not implemented.")}popDirective(){throw new Error("Method not implemented.")}setSymbolOrder(t,e){throw new Error("Method not implemented.")}setSymbolPredicates(t,e){throw new Error("Method not implemented.")}setSymbolPrintName(t,e){throw new Error("Method not implemented.")}setBinding(t,e){this.parentEnv.setBinding(t,e)}setUserFunction(t,e){this.parentEnv.setUserFunction(t,e)}simplify(t){throw new Error("Method not implemented.")}sin(t){throw new Error("Method not implemented.")}sqrt(t){throw new Error("Method not implemented.")}st(t){throw new Error("Method not implemented.")}subst(t,e,n){throw new Error("Method not implemented.")}subtract(t,e){throw new Error("Method not implemented.")}toInfixString(t){throw new Error("Method not implemented.")}toLatexString(t){throw new Error("Method not implemented.")}toSExprString(t){throw new Error("Method not implemented.")}transform(t){throw new Error("Method not implemented.")}valueOf(t){return this.parentEnv.valueOf(t)}}function SW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function kW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function _W(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function FW(t,n,r){const s=t.argList,i=s.length;r.firstTime&&(r.firstTime=!1,r.doneArg=Array(i).fill(!1),r.argValues=Array(i).fill(kt));for(let t=0;t<i;t++)if(!r.doneArg[t])return r.doneArg[t]=!0,t>0&&(r.argValues[t-1]=r.value),new KW(s.item(t),r.$);i>0&&(r.argValues[i-1]=r.value),n.pop();const o=r.$.evaluate(e.abs,...r.argValues);n.top.value=o}function CW(t,n,r){const s=t.argList,i=s.length;r.firstTime&&(r.firstTime=!1,r.doneArg=Array(i).fill(!1),r.argValues=Array(i).fill(kt));for(let t=0;t<i;t++)if(!r.doneArg[t])return r.doneArg[t]=!0,t>0&&(r.argValues[t-1]=r.value),new KW(s.item(t),r.$);i>0&&(r.argValues[i-1]=r.value),n.pop();const o=r.$.evaluate(e.add,...r.argValues);n.top.value=o}function TW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),n.done=!0,e.top.inputs=[...r],e.top.values=n.argValues}function MW(t,n,r){const s=t.argList,i=s.length;r.firstTime&&(r.firstTime=!1,r.doneArg=Array(i).fill(!1),r.argValues=Array(i).fill(kt));for(let t=0;t<i;t++)if(!r.doneArg[t])return r.doneArg[t]=!0,t>0&&(r.argValues[t-1]=r.value),new KW(s.item(t),r.$);i>0&&(r.argValues[i-1]=r.value),n.pop();const o=r.$.evaluate(e.multiply,...r.argValues);n.top.value=o}function OW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function NW(t,n,r){const s=t.argList,i=s.length;r.firstTime&&(r.firstTime=!1,r.doneArg=Array(i).fill(!1),r.argValues=Array(i).fill(kt));for(let t=0;t<i;t++)if(!r.doneArg[t])return r.doneArg[t]=!0,t>0&&(r.argValues[t-1]=r.value),new KW(s.item(t),r.$);i>0&&(r.argValues[i-1]=r.value),n.pop();const o=r.$.evaluate(e.pow,...r.argValues);n.top.value=o}function LW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function BW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function qW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function IW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function PW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function RW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}function UW(t,e,n){const r=t.argList,s=r.length;n.firstTime&&(n.firstTime=!1,n.doneArg=Array(s).fill(!1),n.argValues=Array(s).fill(kt));for(let t=0;t<s;t++)if(!n.doneArg[t])return n.doneArg[t]=!0,t>0&&(n.argValues[t-1]=n.value),new KW(r.item(t),n.$);s>0&&(n.argValues[s-1]=n.value),e.pop();const i=n.$.valueOf(At(t.opr,...n.argValues));e.top.value=i}const $W={STEP_ERROR:!0},zW=f("module");function WW(t){if(_t(t)){const e=t.opr;if(Aa(e))return e.key();throw new Error}throw new Error}class XW{constructor(t){this.proto=t,this.getter=Object.create(null),this.setter=Object.create(null),this.properties=Object.create(null),this.proto=t}}class KW{constructor(t,e){this.input=t,this.$=e,this.firstTime=!0,this.done=!1,this.doneArg=[],this.argValues=[],this.value=kt,this.inputs=[],this.values=[],this.doneCallee=0,this.doneArgs=!1}}function HW(t,e,n,r){e.pop();const s=e.top,i=s.$.valueOf(t);try{r.atom(i,t)}finally{s.value=i}}const JW=new class{atom(t,e){}};class GW{constructor(t,e,n){iW.add(this),this.POLYFILL_TIMEOUT=1e3,oW.set(this,!1),aW.set(this,void 0),uW.set(this,new cu),cW.set(this,[]),lW.set(this,void 0),hW.set(this,!1),fW.set(this,!1),pW.set(this,void 0),dW.set(this,void 0),mW.set(this,void 0),gW.set(this,void 0),xW.set(this,void 0),Rt(this,aW,this,"f"),Rt(this,lW,Object.create(null),"f"),Rt(this,gW,n,"f"),Pt(this,iW,"m",EW).call(this),Rt(this,xW,xv(function(t){if(t)return{allowUndeclaredVars:"number"==typeof t.allowUndeclaredVars?t.allowUndeclaredVars:eX.Nil,dependencies:se};return{allowUndeclaredVars:eX.Nil,dependencies:se}}(e)),"f"),eW(Pt(this,xW,"f")),Rt(this,mW,this.createScope(null,new bW(Pt(this,xW,"f"),this.createObjectProto(null))),"f"),Rt(this,dW,Pt(this,mW,"f").thing,"f"),Pt(this,iW,"m",vW).call(this);const r=new KW(t,Pt(this,mW,"f"));Pt(this,uW,"f").push(r)}createScope(t,e){const n=this.createObjectProto(null),r=new AW(e,!1,n);return e||this.initGlobal(r.thing),Pt(this,iW,"m",DW).call(this,t,r),r}createObjectProto(t){if("object"!=typeof t)throw Error("Non object prototype");return new XW(t)}defineFunction(t,e){uE(t);const n=At(t);Pt(this,xW,"f").defineFunction(n,e)}initGlobal(t){Pt(this,gW,"f")&&Pt(this,gW,"f").call(this,this,t)}run(t=JW){for(;!Pt(this,oW,"f")&&this.next(t););return Pt(this,oW,"f")}next(t=JW){const e=Pt(this,uW,"f");let n,r=Date.now()+this.POLYFILL_TIMEOUT;do{if(Pt(this,oW,"f"))return!0;let s=e.top;if(n=s.input,!s||_t(n)&&li(n,zW)&&s.done){if(!Pt(this,cW,"f").length)return!1;if(s=Pt(this,iW,"m",yW).call(this),!s)return!0}const i=Pt(this,aW,"f");Rt(this,aW,this,"f");try{if(_t(n)){const t=WW(n),r=Pt(this,lW,"f")[t];if(r){const t=r(n,e,s);t&&e.push(t)}else{const t=RW(n,e,s);t&&e.push(t)}}else if(n.isnil)e.top.value=n;else{if(!St(n))throw Error(`${n} is not a cons, nil, or atom.`);HW(n,e,0,t)}}catch(t){if(t!==$W)throw Pt(this,pW,"f")!==t&&Rt(this,pW,void 0,"f"),t}finally{Rt(this,aW,i,"f")}if(Pt(this,hW,"f"))throw Rt(this,pW,void 0,"f"),Error("Getter not supported in this context");if(Pt(this,fW,"f"))throw Rt(this,pW,void 0,"f"),Error("Setter not supported in this context");r||n.end||(r=Date.now()+this.POLYFILL_TIMEOUT)}while(!n.end&&r>Date.now());return!0}get stack(){return Pt(this,uW,"f")}addListener(t){}removeListener(t){}}var VW,jW,QW,ZW,YW,tX,eX;function nX(t,e=!1){return"boolean"==typeof t?t:e}oW=new WeakMap,aW=new WeakMap,uW=new WeakMap,cW=new WeakMap,lW=new WeakMap,hW=new WeakMap,fW=new WeakMap,pW=new WeakMap,dW=new WeakMap,mW=new WeakMap,gW=new WeakMap,xW=new WeakMap,iW=new WeakSet,yW=function(){const t=Pt(this,cW,"f")[0];if(!t||t.time>Date.now())return null;Pt(this,cW,"f").shift(),t.interval>=0&&Pt(this,iW,"m",wW).call(this,t,t.interval);const e=new KW(t.node,t.scope);return t.functionRef&&(e.doneCallee=2,e.funcThis=Pt(this,dW,"f"),e.func=t.functionRef,e.doneArgs=!0,e.arguments=t.argsArray),e},wW=function(t,e){t.time=Date.now()+e,Pt(this,cW,"f").push(t),Pt(this,cW,"f").sort((function(t,e){return t.time-e.time}))},EW=function(){Pt(this,lW,"f")[t(e.add).key()]=CW,Pt(this,lW,"f")[t(e.multiply).key()]=MW,Pt(this,lW,"f")[t(e.lco).key()]=RW,Pt(this,lW,"f")[t(e.rco).key()]=RW,Pt(this,lW,"f")["="]=xE,Pt(this,lW,"f")[t(e.testeq).key()]=LW,Pt(this,lW,"f")[t(e.testne).key()]=LW,Pt(this,lW,"f")[t(e.testge).key()]=LW,Pt(this,lW,"f")[t(e.testgt).key()]=LW,Pt(this,lW,"f")[t(e.testle).key()]=LW,Pt(this,lW,"f")[t(e.testlt).key()]=LW,Pt(this,lW,"f").module=TW,Pt(this,lW,"f").abs=FW,Pt(this,lW,"f").adj=SW,Pt(this,lW,"f").algebra=kW,Pt(this,lW,"f").and=RW,Pt(this,lW,"f").arccos=SW,Pt(this,lW,"f").arccosh=SW,Pt(this,lW,"f").arcsin=SW,Pt(this,lW,"f").arcsinh=SW,Pt(this,lW,"f").arctan=SW,Pt(this,lW,"f").arctanh=SW,Pt(this,lW,"f").arg=SW,Pt(this,lW,"f").besselj=kW,Pt(this,lW,"f").bessely=kW,Pt(this,lW,"f").ceiling=SW,Pt(this,lW,"f").choose=kW,Pt(this,lW,"f").coeff=_W,Pt(this,lW,"f").cofactor=_W,Pt(this,lW,"f")[t(e.component).key()]=_W,Pt(this,lW,"f").conj=SW,Pt(this,lW,"f").contract=RW,Pt(this,lW,"f")[t(e.cos).key()]=SW,Pt(this,lW,"f")[t(e.cosh).key()]=SW,Pt(this,lW,"f").circexp=SW,Pt(this,lW,"f").cross=kW,Pt(this,lW,"f").curl=SW,Pt(this,lW,"f").denominator=SW,Pt(this,lW,"f").det=SW,Pt(this,lW,"f").dim=kW,Pt(this,lW,"f").div=SW,Pt(this,lW,"f").do=RW,Pt(this,lW,"f").dot=RW,Pt(this,lW,"f").draw=kW,Pt(this,lW,"f").eval=RW,Pt(this,lW,"f").exp=SW,Pt(this,lW,"f").expand=kW,Pt(this,lW,"f").expcos=SW,Pt(this,lW,"f").expsin=SW,Pt(this,lW,"f").factor=RW,Pt(this,lW,"f").factorial=SW,Pt(this,lW,"f").float=SW,Pt(this,lW,"f").floor=SW,Pt(this,lW,"f").gcd=RW,Pt(this,lW,"f").hermite=kW,Pt(this,lW,"f")[t(e.inner).key()]=RW,Pt(this,lW,"f").integral=kW,Pt(this,lW,"f").inv=SW,Pt(this,lW,"f").isprime=SW,Pt(this,lW,"f")[t(e.pow).key()]=NW,Pt(this,lW,"f").laguerre=RW,Pt(this,lW,"f").lcm=RW,Pt(this,lW,"f").leading=kW,Pt(this,lW,"f").legendre=RW,Pt(this,lW,"f").log=SW,Pt(this,lW,"f").not=SW,Pt(this,lW,"f").numerator=SW,Pt(this,lW,"f").or=RW,Pt(this,lW,"f")[t(e.outer).key()]=RW,Pt(this,lW,"f").prime=SW,Pt(this,lW,"f").quotient=OW,Pt(this,lW,"f").rank=SW,Pt(this,lW,"f").rationalize=SW,Pt(this,lW,"f").rect=SW,Pt(this,lW,"f").roots=OW,Pt(this,lW,"f").shape=SW,Pt(this,lW,"f").simplify=SW,Pt(this,lW,"f")[t(e.sin).key()]=SW,Pt(this,lW,"f")[t(e.sinh).key()]=SW,Pt(this,lW,"f").sqrt=SW,Pt(this,lW,"f").subst=OW,Pt(this,lW,"f").tan=SW,Pt(this,lW,"f").tanh=SW,Pt(this,lW,"f").tau=SW,Pt(this,lW,"f").taylor=BW,Pt(this,lW,"f").test=qW,Pt(this,lW,"f").transpose=IW,Pt(this,lW,"f").unit=PW,Pt(this,lW,"f").uom=SW,Pt(this,lW,"f").zero=UW},vW=function(){},DW=function(t,e){return new Map},function(t){t[t.Last=1]="Last",t[t.TTY=2]="TTY"}(YW||(YW={})),function(t){t[t.Micro=1]="Micro",t[t.ClojureScript=2]="ClojureScript",t[t.PythonScript=3]="PythonScript"}(tX||(tX={})),function(t){t[t.Err=1]="Err",t[t.Nil=2]="Nil"}(eX||(eX={}));class rX{constructor(t){VW.set(this,void 0),Rt(this,VW,t,"f")}beginCons(t){}endCons(t){}beginTensor(t){}endTensor(t){}beginMap(t){}endMap(t){}boo(t){}keyword(t){}sym(t){Pt(this,VW,"f").hasBinding(t,kt)||Pt(this,VW,"f").defineUserSymbol(t)}rat(t){}str(t){}tag(t){}flt(t){}atom(t){}nil(t){}}function sX(t,e){return"number"==typeof t.allowUndeclaredVars?t.allowUndeclaredVars:e}function iX(n){n.setBinding(f("pi"),t(e.PI))}function oX(t){const e=kh([x(-1),x(1),x(1),x(1)],["e0","e1","e2","e3"],t);t.setBinding(f("e0"),e[0]),t.setBinding(f("e1"),e[1]),t.setBinding(f("e2"),e[2]),t.setBinding(f("e3"),e[3])}function aX(t){const e=kh([x(1),x(1),x(1)],["ex","ey","ez"],t);t.setBinding(f("ex"),e[0]),t.setBinding(f("ey"),e[1]),t.setBinding(f("ez"),e[2])}function uX(t){for(let e=0;e<Tg.length;e++)t.setBinding(f(Tg[e]),Og(Tg[e]))}function cX(t){const e=y(1,10);t.setBinding(f("deci"),e);const n=y(1,100);t.setBinding(f("centi"),n);const r=y(1,1e3);t.setBinding(f("milli"),r);const s=r.mul(r);t.setBinding(f("micro"),s);const i=s.mul(r);t.setBinding(f("nano"),i);const o=i.mul(r);t.setBinding(f("pico"),o);const a=o.mul(r);t.setBinding(f("femto"),a);const u=a.mul(r);t.setBinding(f("atto"),u);const c=y(10,1);t.setBinding(f("deka"),c);const l=y(100,1);t.setBinding(f("hecto"),l);const h=y(1e3,1);t.setBinding(f("kilo"),h);const p=h.mul(h);t.setBinding(f("mega"),p);const d=p.mul(h);t.setBinding(f("giga"),d);const m=d.mul(h);t.setBinding(f("tera"),m);const g=m.mul(h);t.setBinding(f("peta"),g);const x=g.mul(h);t.setBinding(f("exa"),x)}VW=new WeakMap;class lX{constructor(t){jW.set(this,void 0),QW.set(this,void 0),Rt(this,QW,t,"f"),Rt(this,jW,xv({allowUndeclaredVars:sX(t,eX.Nil),dependencies:se}),"f"),eW(Pt(this,jW,"f"),{allowUndeclaredVars:sX(t,eX.Nil),useDerivativeShorthandLowerD:t.useDerivativeShorthandLowerD,prolog:t.prolog}),iX(Pt(this,jW,"f")),oX(Pt(this,jW,"f")),aX(Pt(this,jW,"f")),uX(Pt(this,jW,"f")),cX(Pt(this,jW,"f"))}defineUserSymbol(t){Pt(this,jW,"f").defineUserSymbol(t)}handlerFor(t){return Pt(this,jW,"f").handlerFor(t)}clearBindings(){Pt(this,jW,"f").clearBindings()}executeProlog(t){Pt(this,jW,"f").executeProlog(t)}executeScript(t){return Vz(t,Pt(this,QW,"f"),Pt(this,jW,"f"))}hasBinding(t,e){return uE(t),Pt(this,jW,"f").hasBinding(t,e)}getBinding(t,e){return uE(t),Pt(this,jW,"f").getBinding(t,e)}setBinding(t,e){uE(t),Pt(this,jW,"f").setBinding(t,e)}hasUserFunction(t){return uE(t),Pt(this,jW,"f").hasUserFunction(t)}getUserFunction(t){return uE(t),Pt(this,jW,"f").getUserFunction(t)}defineAtomHandler(t,e,n){const r=new we(t,e,n);Pt(this,jW,"f").defineExtension(r,!1)}defineFunction(t,e){uE(t);const n=At(t);Pt(this,jW,"f").defineFunction(n,e)}parse(t,e={}){Pt(this,jW,"f").buildOperators();const n=(r=e,{...r});var r;"number"==typeof e.syntaxKind||(n.syntaxKind=Pt(this,QW,"f").syntaxKind);const{trees:s,errors:i}=Pz(t,function(t){return{catchExceptions:!1,explicitAssocAdd:t.explicitAssocAdd,explicitAssocExt:t.explicitAssocExt,explicitAssocMul:t.explicitAssocMul,syntaxKind:t.syntaxKind,useCaretForExponentiation:nX(t.useCaretForExponentiation),useParenForTensors:nX(t.useParenForTensors)}}(n)),o=new rX(Pt(this,jW,"f"));for(const t of s)pE(t,o);return{trees:s,errors:i}}parseModule(t,e={}){const{trees:n,errors:r}=this.parse(t,e);return{module:At(f("module"),...n),errors:r}}simplify(t){return qw(t,Pt(this,jW,"f"))}valueOf(t,e){const{value:n}=Qz(t,{},Pt(this,jW,"f"));if(!e)return n;try{return e.push(n),kt}finally{n.release()}}renderAsString(t,e={}){Pt(this,jW,"f").pushDirective(ie.useCaretForExponentiation,ae(e.useCaretForExponentiation)),Pt(this,jW,"f").pushDirective(ie.useParenForTensors,ae(e.useParenForTensors));try{switch(e.format){case"Ascii":return Vx(t,Pt(this,jW,"f"));case"Human":return Dy(t,Pt(this,jW,"f"));case"Infix":default:return ru(t,Pt(this,jW,"f"));case"LaTeX":return by(t,Pt(this,jW,"f"));case"SExpr":return Oa(t,Pt(this,jW,"f"));case"SVG":return SS(t,Pt(this,jW,"f"),{useImaginaryI:!1,useImaginaryJ:!1})}}finally{Pt(this,jW,"f").popDirective(),Pt(this,jW,"f").popDirective()}}release(){nW(Pt(this,jW,"f"))}setUserFunction(t,e){uE(t),Pt(this,jW,"f").setUserFunction(t,e)}symbol(t){switch(t){case YW.Last:return Fa;case YW.TTY:return Ca;default:throw new Error(`symbol(${t}) not implemented.`)}}addAtomListener(t){Pt(this,jW,"f").addAtomListener(t)}removeAtomListener(t){Pt(this,jW,"f").removeAtomListener(t)}addListener(t){Pt(this,jW,"f").listeners.push(t)}removeListener(t){}}jW=new WeakMap,QW=new WeakMap;class hX{constructor(t){ZW.set(this,void 0);const e=sX(t,eX.Err),n=xv({allowUndeclaredVars:e,dependencies:se});Rt(this,ZW,n,"f"),eW(Pt(this,ZW,"f"),{allowUndeclaredVars:e,useDerivativeShorthandLowerD:t.useDerivativeShorthandLowerD,prolog:t.prolog})}defineUserSymbol(t){Pt(this,ZW,"f").defineUserSymbol(t)}handlerFor(t){return Pt(this,ZW,"f").handlerFor(t)}clearBindings(){Pt(this,ZW,"f").clearBindings()}executeProlog(t){Pt(this,ZW,"f").executeProlog(t)}executeScript(t){return Vz(t,{},Pt(this,ZW,"f"))}hasBinding(t,e){return uE(t),Pt(this,ZW,"f").hasBinding(t,e)}hasUserFunction(t){return uE(t),Pt(this,ZW,"f").hasUserFunction(t)}getUserFunction(t){return uE(t),Pt(this,ZW,"f").getUserFunction(t)}defineAtomHandler(t,e,n){const r=new we(t,e,n);Pt(this,ZW,"f").defineExtension(r,!1)}defineFunction(t,e){uE(t);const n=At(t);Pt(this,ZW,"f").defineFunction(n,e)}parse(n,r={}){Pt(this,ZW,"f").buildOperators();const s=nX(r.useCaretForExponentiation),i=t(s?e.pow:e.outer),{trees:o,errors:a}=Iz(n,{lexicon:{"^":i,"|":t(e.inner),"<<":t(e.lco),">>":t(e.rco)}}),u=new rX(Pt(this,ZW,"f"));for(const t of o)pE(t,u);return{trees:o,errors:a}}parseModule(t,e={}){const{trees:n,errors:r}=this.parse(t,e);return{module:At(f("module"),...n),errors:r}}getBinding(t,e){return uE(t),Pt(this,ZW,"f").getBinding(t,e)}setBinding(t,e){uE(t),Pt(this,ZW,"f").setBinding(t,e)}simplify(t){return qw(t,Pt(this,ZW,"f"))}valueOf(t,e){const{value:n}=Qz(t,{},Pt(this,ZW,"f"));if(!e)return n;try{return e.push(n),kt}finally{n.release()}}renderAsString(t,e={}){My(t,"ExprEngine.renderAsString(expr, config)","expr"),Pt(this,ZW,"f").pushDirective(ie.useCaretForExponentiation,ae(e.useCaretForExponentiation)),Pt(this,ZW,"f").pushDirective(ie.useParenForTensors,ae(e.useParenForTensors));try{switch(e.format){case"Ascii":return Vx(t,Pt(this,ZW,"f"));case"Human":return Dy(t,Pt(this,ZW,"f"));case"Infix":default:return ru(t,Pt(this,ZW,"f"));case"LaTeX":return by(t,Pt(this,ZW,"f"));case"SExpr":return Oa(t,Pt(this,ZW,"f"));case"SVG":return SS(t,Pt(this,ZW,"f"),{useImaginaryI:!1,useImaginaryJ:!1})}}finally{Pt(this,ZW,"f").popDirective(),Pt(this,ZW,"f").popDirective()}}release(){nW(Pt(this,ZW,"f"))}setUserFunction(t,e){uE(t),Pt(this,ZW,"f").setUserFunction(t,e)}symbol(t){switch(t){case YW.Last:return Fa;case YW.TTY:return Ca;default:throw new Error(`symbol(${t}) not implemented.`)}}addAtomListener(t){Pt(this,ZW,"f").addAtomListener(t)}removeAtomListener(t){Pt(this,ZW,"f").removeAtomListener(t)}addListener(t){}removeListener(t){}}ZW=new WeakMap;class fX{constructor(t){}defineUserSymbol(t){throw new Error("Method not implemented.")}handlerFor(t){throw new Error("Method not implemented.")}clearBindings(){throw new Error("clearBindings method not implemented.")}executeProlog(t){throw new Error("executeProlog method not implemented.")}executeScript(t){throw new Error("PythonEngine.executeScript method not implemented.")}hasBinding(t){throw new Error("hasBinding method not implemented.")}hasUserFunction(t){throw new Error("hasUserFunction method not implemented.")}getUserFunction(t){throw new Error("getUserFunction method not implemented.")}defineAtomHandler(t,e,n){throw new Error("defineExprHandler method not implemented.")}defineFunction(t,e){throw new Error("defineFunction method not implemented.")}parse(t,e){throw new Error("parse method not implemented.")}parseModule(t,e){throw new Error("parseModule method not implemented.")}simplify(t){throw new Error("simplify method not implemented.")}valueOf(t){throw new Error("PythonEngine.valueOf method not implemented.")}getBinding(t){throw new Error("getBinding method not implemented.")}setBinding(t,e){throw new Error("setSymbol method not implemented.")}release(){throw new Error("release method not implemented.")}renderAsString(t,e){throw new Error("renderAsString method not implemented.")}setUserFunction(t,e){throw new Error("PythonEngine.setUserFunction method not implemented.")}symbol(t){throw new Error("symbol method not implemented.")}addAtomListener(t){}removeAtomListener(t){}addListener(t){throw new Error("addListener method not implemented.")}removeListener(t){throw new Error("removeListener method not implemented.")}}function pX(t={}){const e=function(t){if(t.syntaxKind)switch(t.syntaxKind){case Lz.ClojureScript:return tX.ClojureScript;case Lz.Eigenmath:case Lz.EcmaScript:return tX.Micro;case Lz.PythonScript:return tX.PythonScript}return tX.Micro}(t);switch(e){case tX.Micro:return new lX(t);case tX.ClojureScript:return new hX(t);case tX.PythonScript:return new fX(t);default:throw new Error}}export{YW as Concept,cu as Stack,KW as State,GW as Stepper,Lz as SyntaxKind,XW as Thing,eX as UndeclaredVars,pX as create_engine,rW as create_script_context,Bz as human_readable_syntax_kind,iw as roots,qz as syntaxKinds};
//# sourceMappingURL=index.min.js.map