var bigintModArith=function(n){"use strict";function t(n){return n>=0?n:-n}function r(n,t){let r=BigInt(n),i=BigInt(t);if(r<=0n||i<=0n)throw new RangeError("a and b MUST be > 0");let e=0n,o=1n,u=1n,f=0n;for(;0n!==r;){const n=i/r,t=i%r,c=e-u*n,g=o-f*n;i=r,r=t,e=u,o=f,u=c,f=g}return{g:i,x:e,y:o}}function i(n,r){let i=BigInt(t(n)),e=BigInt(t(r));if(0n===i)return e;if(0n===e)return i;let o=0n;for(;0n===(1n&(i|e));)i>>=1n,e>>=1n,o++;for(;0n===(1n&i);)i>>=1n;do{for(;0n===(1n&e);)e>>=1n;if(i>e){const n=i;i=e,e=n}e-=i}while(0n!==e);return i<>=1n)>1n);return t},n.eGcd=r,n.gcd=i,n.lcm=function(n,r){const e=BigInt(n),o=BigInt(r);return 0n===e&&0n===o?BigInt(0):t(e*o)/i(e,o)},n.max=function(n,t){return n>=t?n:t},n.min=function(n,t){return n>=t?t:n},n.modInv=o,n.modPow=function n(r,i,u){const f=BigInt(u);if(f<=0n)return NaN;if(1n===f)return BigInt(0);let c=e(r,f);if((i=BigInt(i))<0n)return o(n(c,t(i),f),f);let g=1n;for(;i>0;)i%2n===1n&&(g=g*c%f),i/=2n,c=c**2n%f;return g},n.toZn=e,Object.defineProperty(n,"__esModule",{value:!0}),n}({});