/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{clamp as t}from"../../../mathUtils.js";import{getEpsilon as n,RANDOM as r}from"./common.js";function o(t,n){return t[0]=n[0],t[1]=n[1],t}function u(t,n,r){return t[0]=n,t[1]=r,t}function e(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t}function c(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t}function a(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t}function s(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t}function i(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t}function f(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t}function M(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t}function h(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t}function l(n,r,o,u){return n[0]=t(r[0],o[0],u[0]),n[1]=t(r[1],o[1],u[1]),n}function m(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t}function d(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t}function b(t,n,r,o){return t[0]=n[0]+r[0]*o,t[1]=n[1]+r[1]*o,t}function p(t,n){const r=n[0]-t[0],o=n[1]-t[1];return Math.sqrt(r*r+o*o)}function q(t,n){const r=n[0]-t[0],o=n[1]-t[1];return r*r+o*o}function x(t){const n=t[0],r=t[1];return Math.sqrt(n*n+r*r)}function g(t){const n=t[0],r=t[1];return n*n+r*r}function v(t,n){return t[0]=-n[0],t[1]=-n[1],t}function j(t,n){return t[0]=1/n[0],t[1]=1/n[1],t}function y(t,n){const r=n[0],o=n[1];let u=r*r+o*o;return u>0&&(u=1/Math.sqrt(u),t[0]=n[0]*u,t[1]=n[1]*u),t}function _(t,n){return t[0]*n[0]+t[1]*n[1]}function A(t,n,r){const o=n[0]*r[1]-n[1]*r[0];return t[0]=t[1]=0,t[2]=o,t}function P(t,n,r,o){const u=n[0],e=n[1];return t[0]=u+o*(r[0]-u),t[1]=e+o*(r[1]-e),t}function S(t,n=1){const o=2*r()*Math.PI;return t[0]=Math.cos(o)*n,t[1]=Math.sin(o)*n,t}function z(t,n,r){const o=n[0],u=n[1];return t[0]=r[0]*o+r[2]*u,t[1]=r[1]*o+r[3]*u,t}function D(t,n,r){const o=n[0],u=n[1];return t[0]=r[0]*o+r[2]*u+r[4],t[1]=r[1]*o+r[3]*u+r[5],t}function I(t,n,r){const o=n[0],u=n[1];return t[0]=r[0]*o+r[3]*u+r[6],t[1]=r[1]*o+r[4]*u+r[7],t}function L(t,n,r){const o=n[0],u=n[1];return t[0]=r[0]*o+r[4]*u+r[12],t[1]=r[1]*o+r[5]*u+r[13],t}function O(t,n,r,o){const u=n[0]-r[0],e=n[1]-r[1],c=Math.sin(o),a=Math.cos(o);return t[0]=u*a-e*c+r[0],t[1]=u*c+e*a+r[1],t}function E(t,n){const r=t[0],o=t[1],u=n[0],e=n[1];let c=r*r+o*o;c>0&&(c=1/Math.sqrt(c));let a=u*u+e*e;a>0&&(a=1/Math.sqrt(a));const s=(r*u+o*e)*c*a;return s>1?0:s<-1?Math.PI:Math.acos(s)}function T(t){return"vec2("+t[0]+", "+t[1]+")"}function U(t,n){return t[0]===n[0]&&t[1]===n[1]}function k(t,r){const o=t[0],u=t[1],e=r[0],c=r[1],a=n();return Math.abs(o-e)<=a*Math.max(1,Math.abs(o),Math.abs(e))&&Math.abs(u-c)<=a*Math.max(1,Math.abs(u),Math.abs(c))}function w(t,n,r,o,u){let e=n[0]-r[0],c=n[1]-r[1];const a=(o[0]*e+o[1]*c)*(u-1);return e=o[0]*a,c=o[1]*a,t[0]=n[0]+e,t[1]=n[1]+c,t}const B=x,C=c,F=a,G=s,H=p,J=q,K=g,N=Object.freeze(Object.defineProperty({__proto__:null,add:e,angle:E,ceil:i,clamp:l,copy:o,cross:A,dist:H,distance:p,div:G,divide:s,dot:_,equals:k,exactEquals:U,floor:f,inverse:j,len:B,length:x,lerp:P,max:h,min:M,mul:F,multiply:a,negate:v,normalize:y,projectAndScale:w,random:S,rotate:O,round:m,scale:d,scaleAndAdd:b,set:u,sqrDist:J,sqrLen:K,squaredDistance:q,squaredLength:g,str:T,sub:C,subtract:c,transformMat2:z,transformMat2d:D,transformMat3:I,transformMat4:L},Symbol.toStringTag,{value:"Module"}));export{e as add,E as angle,i as ceil,l as clamp,o as copy,A as cross,H as dist,p as distance,G as div,s as divide,_ as dot,k as equals,U as exactEquals,f as floor,j as inverse,B as len,x as length,P as lerp,h as max,M as min,F as mul,a as multiply,v as negate,y as normalize,w as projectAndScale,S as random,O as rotate,m as round,d as scale,b as scaleAndAdd,u as set,J as sqrDist,K as sqrLen,q as squaredDistance,g as squaredLength,T as str,C as sub,c as subtract,z as transformMat2,D as transformMat2d,I as transformMat3,L as transformMat4,N as v};
