/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{getEpsilon as t}from"./common.js";function n(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function r(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function a(t,n,r,a,u){return t[0]=n,t[1]=r,t[2]=a,t[3]=u,t}function u(t,n){if(t===n){const r=n[1];t[1]=n[2],t[2]=r}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t}function o(t,n){const r=n[0],a=n[1],u=n[2],o=n[3];let e=r*o-u*a;return e?(e=1/e,t[0]=o*e,t[1]=-a*e,t[2]=-u*e,t[3]=r*e,t):null}function e(t,n){const r=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=r,t}function c(t){return t[0]*t[3]-t[2]*t[1]}function s(t,n,r){const a=n[0],u=n[1],o=n[2],e=n[3],c=r[0],s=r[1],i=r[2],f=r[3];return t[0]=a*c+o*s,t[1]=u*c+e*s,t[2]=a*i+o*f,t[3]=u*i+e*f,t}function i(t,n,r){const a=n[0],u=n[1],o=n[2],e=n[3],c=Math.sin(r),s=Math.cos(r);return t[0]=a*s+o*c,t[1]=u*s+e*c,t[2]=a*-c+o*s,t[3]=u*-c+e*s,t}function f(t,n,r){const a=n[0],u=n[1],o=n[2],e=n[3],c=r[0],s=r[1];return t[0]=a*c,t[1]=u*c,t[2]=o*s,t[3]=e*s,t}function l(t,n){const r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t}function M(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t}function h(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function b(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2)}function m(t,n,r,a){return t[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-t[2]*r[1],[t,n,r]}function d(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t}function p(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t}function y(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function x(n,r){const a=n[0],u=n[1],o=n[2],e=n[3],c=r[0],s=r[1],i=r[2],f=r[3],l=t();return Math.abs(a-c)<=l*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(u-s)<=l*Math.max(1,Math.abs(u),Math.abs(s))&&Math.abs(o-i)<=l*Math.max(1,Math.abs(o),Math.abs(i))&&Math.abs(e-f)<=l*Math.max(1,Math.abs(e),Math.abs(f))}function S(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t}function j(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t}const _=s,g=p,q=Object.freeze(Object.defineProperty({__proto__:null,LDU:m,add:d,adjoint:e,copy:n,determinant:c,equals:x,exactEquals:y,frob:b,fromRotation:l,fromScaling:M,identity:r,invert:o,mul:_,multiply:s,multiplyScalar:S,multiplyScalarAndAdd:j,rotate:i,scale:f,set:a,str:h,sub:g,subtract:p,transpose:u},Symbol.toStringTag,{value:"Module"}));export{m as LDU,d as add,e as adjoint,n as copy,c as determinant,x as equals,y as exactEquals,b as frob,l as fromRotation,M as fromScaling,r as identity,o as invert,q as m,_ as mul,s as multiply,S as multiplyScalar,j as multiplyScalarAndAdd,i as rotate,f as scale,a as set,h as str,g as sub,p as subtract,u as transpose};
