/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.122
 *
 * Copyright 2011-2022 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
import{a as L,b as x}from"./chunk-EWTFJ46X.js";import{i as R}from"./chunk-5IUXF6I3.js";import{b as d,c as O,d as g}from"./chunk-RFPX772U.js";import{a as w}from"./chunk-6KLVDWWE.js";import{b as m}from"./chunk-6P5KAIBX.js";import{e as f}from"./chunk-4FSVUTPL.js";function t(t,e,h,i){this.x=w(t,0),this.y=w(e,0),this.width=w(h,0),this.height=w(i,0)}t.packedLength=4,t.pack=function(t,e,h){return m.typeOf.object("value",t),m.defined("array",e),h=w(h,0),e[h++]=t.x,e[h++]=t.y,e[h++]=t.width,e[h]=t.height,e},t.unpack=function(e,h,i){return m.defined("array",e),h=w(h,0),f(i)||(i=new t),i.x=e[h++],i.y=e[h++],i.width=e[h++],i.height=e[h],i},t.fromPoints=function(e,h){if(f(h)||(h=new t),!f(e)||0===e.length)return h.x=0,h.y=0,h.width=0,h.height=0,h;let i=e.length,n=e[0].x,r=e[0].y,o=e[0].x,a=e[0].y;for(let t=1;t<i;t++){let h=e[t],i=h.x,f=h.y;n=Math.min(i,n),o=Math.max(i,o),r=Math.min(f,r),a=Math.max(f,a)}return h.x=n,h.y=r,h.width=o-n,h.height=a-r,h};var X=new L,Y=new d,k=new d;t.fromRectangle=function(e,h,i){if(f(i)||(i=new t),!f(e))return i.x=0,i.y=0,i.width=0,i.height=0,i;X._ellipsoid=g.default;let n=(h=w(h,X)).project(R.southwest(e,Y)),r=h.project(R.northeast(e,k));return O.subtract(r,n,r),i.x=n.x,i.y=n.y,i.width=r.x,i.height=r.y,i},t.clone=function(e,h){if(f(e))return f(h)?(h.x=e.x,h.y=e.y,h.width=e.width,h.height=e.height,h):new t(e.x,e.y,e.width,e.height)},t.union=function(e,h,i){m.typeOf.object("left",e),m.typeOf.object("right",h),f(i)||(i=new t);let n=Math.min(e.x,h.x),r=Math.min(e.y,h.y),o=Math.max(e.x+e.width,h.x+h.width),a=Math.max(e.y+e.height,h.y+h.height);return i.x=n,i.y=r,i.width=o-n,i.height=a-r,i},t.expand=function(e,h,i){m.typeOf.object("rectangle",e),m.typeOf.object("point",h),i=t.clone(e,i);let n=h.x-i.x,r=h.y-i.y;return n>i.width?i.width=n:n<0&&(i.width-=n,i.x=h.x),r>i.height?i.height=r:r<0&&(i.height-=r,i.y=h.y),i},t.intersect=function(t,e){m.typeOf.object("left",t),m.typeOf.object("right",e);let h=t.x,i=t.y,n=e.x,r=e.y;return h>n+e.width||h+t.width<n||i+t.height<r||i>r+e.height?x.OUTSIDE:x.INTERSECTING},t.equals=function(t,e){return t===e||f(t)&&f(e)&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},t.prototype.clone=function(e){return t.clone(this,e)},t.prototype.intersect=function(e){return t.intersect(this,e)},t.prototype.equals=function(e){return t.equals(this,e)};var a=t;export{a};