/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import t from"../geometry/Polygon.js";const n=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,r="screenUtils.toPt: input not recognized!",i=96;function e(t){return t?t/72*i:0}function u(t){return t?72*t/i:0}function o(t){if("string"==typeof t){const i=t.match(n);if(i){const n=Number(i[1]),r=i[3]&&i[3].toLowerCase(),e=t.startsWith("-"),o="px"===r?u(n):n;return e?-o:o}return console.warn(r),null}return t}function c(t=0,n=0){return{x:t,y:n}}function h(t=0,n=0,r=0,i=0){return{x:t,y:n,width:r,height:i}}function y(t){return t?c(t.x,t.y):null}function f(t=0,n=0){return[t,n]}function x(t=0,n=0){return{x:t,y:n}}function a(t=0,n=0){return m([t,n])}function s(t=0,n=0,r=0){return g([t,n,r])}function m(t){return t}function g(t){return t}function l(t){return t}function p(t,n){return n?(n.x=t[0],n.y=t[1],n):{x:t[0],y:t[1]}}function d(t,n){return n?(n[0]=t.x,n[1]=t.y,n.length>2&&(n[2]=0),n):[t.x,t.y]}function w(t,n){return t===n||null==t&&null==n||t?.x===n?.x&&t?.y===n?.y}function M(t){return t&&"x"in t&&"y"in t&&"width"in t&&"height"in t}function b(t){return t&&"x"in t&&"y"in t&&!M(t)}function N(t,n){return!(t.x+t.width<n.x||n.x+n.width<t.x||t.y+t.height<n.y||n.y+n.height<t.y)}function F(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)}function A(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)}function P(n,r){const{x:i,y:e,width:u,height:o}=r,h=n.toMap(c(i,e)),y=n.toMap(c(i+u,e)),f=n.toMap(c(i+u,e+o)),x=n.toMap(c(i,e+o));return new t({rings:[[h.toArray(),y.toArray(),f.toArray(),x.toArray(),h.toArray()]],spatialReference:h.spatialReference})}function R(t,n,r){const i=Math.max(0,t.x),e=Math.max(0,t.y),u=Math.min(n,t.x+t.width)-i,o=Math.min(r,t.y+t.height)-e;return{x:i,y:e,width:Math.max(0,u),height:Math.max(0,o)}}export{m as castRenderScreenPointArray,g as castRenderScreenPointArray3,l as castScreenPointArray,R as clipRectToView,y as cloneScreenPoint,x as createRenderScreenPoint,a as createRenderScreenPointArray,s as createRenderScreenPointArray3,c as createScreenPoint,f as createScreenPointArray,h as createScreenRect,b as isScreenPoint,M as isScreenRect,F as isValidScreenPoint,A as isValidScreenRect,e as pt2px,u as px2pt,p as screenPointArrayToObject,w as screenPointEqual,d as screenPointObjectToArray,N as screenRectIntersects,P as screenRectToPolygon,o as toPt};
