/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.126
 *
 * 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 E}from"./chunk-HZQ2LRMY.js";import{a as Q}from"./chunk-FMJWH3RL.js";import{a as ae}from"./chunk-FZEJ65E6.js";import{b as oe,c as re,d as J}from"./chunk-SPFUTSGC.js";import{b as A,d as ie}from"./chunk-E2NX4UJ2.js";import{a as b,b as F,f as N}from"./chunk-JBPQP6LH.js";import{a as H}from"./chunk-NLPIV6OK.js";import{a as r,e as G}from"./chunk-IIT3SHXK.js";import{a as P}from"./chunk-DLCTHPIV.js";import{a as m}from"./chunk-I2ICH2LD.js";import{a as w,b as O}from"./chunk-R6A52HT4.js";import{e as a}from"./chunk-D32DZSEC.js";function T(t){this.planes=m(t,[])}var X=[new r,new r,new r];r.clone(r.UNIT_X,X[0]),r.clone(r.UNIT_Y,X[1]),r.clone(r.UNIT_Z,X[2]);var V=new r,_e=new r,fe=new Q(new r(1,0,0),0);T.fromBoundingSphere=function(t,e){if(!a(t))throw new w("boundingSphere is required.");a(e)||(e=new T);let i=X.length,n=e.planes;n.length=2*i;let o=t.center,s=t.radius,f=0;for(let u=0;u<i;++u){let t=X[u],e=n[f],i=n[f+1];a(e)||(e=n[f]=new b),a(i)||(i=n[f+1]=new b),r.multiplyByScalar(t,-s,V),r.add(o,V,V),e.x=t.x,e.y=t.y,e.z=t.z,e.w=-r.dot(t,V),r.multiplyByScalar(t,s,V),r.add(o,V,V),i.x=-t.x,i.y=-t.y,i.z=-t.z,i.w=-r.dot(r.negate(t,_e),V),f+=2}return e},T.prototype.computeVisibility=function(t){if(!a(t))throw new w("boundingVolume is required.");let e=this.planes,r=!1;for(let i=0,a=e.length;i<a;++i){let a=t.intersectPlane(Q.fromCartesian4(e[i],fe));if(a===A.OUTSIDE)return A.OUTSIDE;a===A.INTERSECTING&&(r=!0)}return r?A.INTERSECTING:A.INSIDE},T.prototype.computeVisibilityWithPlaneMask=function(t,e){if(!a(t))throw new w("boundingVolume is required.");if(!a(e))throw new w("parentPlaneMask is required.");if(e===T.MASK_OUTSIDE||e===T.MASK_INSIDE)return e;let r=T.MASK_INSIDE,i=this.planes;for(let a=0,n=i.length;a<n;++a){let n=a<31?1<<a:0;if(a<31&&!(e&n))continue;let o=t.intersectPlane(Q.fromCartesian4(i[a],fe));if(o===A.OUTSIDE)return T.MASK_OUTSIDE;o===A.INTERSECTING&&(r|=n)}return r},T.MASK_OUTSIDE=4294967295,T.MASK_INSIDE=0,T.MASK_INDETERMINATE=2147483647;var $=T;function k(t){t=m(t,m.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=m(t.near,1),this._near=this.near,this.far=m(t.far,5e8),this._far=this.far,this._cullingVolume=new $,this._orthographicMatrix=new F}function ce(t){if(!a(t.right)||!a(t.left)||!a(t.top)||!a(t.bottom)||!a(t.near)||!a(t.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");if(t.top!==t._top||t.bottom!==t._bottom||t.left!==t._left||t.right!==t._right||t.near!==t._near||t.far!==t._far){if(t.left>t.right)throw new w("right must be greater than left.");if(t.bottom>t.top)throw new w("top must be greater than bottom.");if(t.near<=0||t.near>t.far)throw new w("near must be greater than zero and less than far.");t._left=t.left,t._right=t.right,t._top=t.top,t._bottom=t.bottom,t._near=t.near,t._far=t.far,t._orthographicMatrix=F.computeOrthographicOffCenter(t.left,t.right,t.bottom,t.top,t.near,t.far,t._orthographicMatrix)}}Object.defineProperties(k.prototype,{projectionMatrix:{get:function(){return ce(this),this._orthographicMatrix}}});var me=new r,ye=new r,ge=new r,ee=new r;k.prototype.computeCullingVolume=function(t,e,i){if(!a(t))throw new w("position is required.");if(!a(e))throw new w("direction is required.");if(!a(i))throw new w("up is required.");let n=this._cullingVolume.planes,o=this.top,s=this.bottom,f=this.right,u=this.left,h=this.near,p=this.far,l=r.cross(e,i,me);r.normalize(l,l);let c=ye;r.multiplyByScalar(e,h,c),r.add(t,c,c);let m=ge;r.multiplyByScalar(l,u,m),r.add(c,m,m);let d=n[0];return a(d)||(d=n[0]=new b),d.x=l.x,d.y=l.y,d.z=l.z,d.w=-r.dot(l,m),r.multiplyByScalar(l,f,m),r.add(c,m,m),d=n[1],a(d)||(d=n[1]=new b),d.x=-l.x,d.y=-l.y,d.z=-l.z,d.w=-r.dot(r.negate(l,ee),m),r.multiplyByScalar(i,s,m),r.add(c,m,m),d=n[2],a(d)||(d=n[2]=new b),d.x=i.x,d.y=i.y,d.z=i.z,d.w=-r.dot(i,m),r.multiplyByScalar(i,o,m),r.add(c,m,m),d=n[3],a(d)||(d=n[3]=new b),d.x=-i.x,d.y=-i.y,d.z=-i.z,d.w=-r.dot(r.negate(i,ee),m),d=n[4],a(d)||(d=n[4]=new b),d.x=e.x,d.y=e.y,d.z=e.z,d.w=-r.dot(e,c),r.multiplyByScalar(e,p,m),r.add(t,m,m),d=n[5],a(d)||(d=n[5]=new b),d.x=-e.x,d.y=-e.y,d.z=-e.z,d.w=-r.dot(r.negate(e,ee),m),this._cullingVolume},k.prototype.getPixelDimensions=function(t,e,r,i,n){if(ce(this),!a(t)||!a(e))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new w("drawingBufferWidth must be greater than zero.");if(e<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!a(r))throw new w("distance is required.");if(!a(i))throw new w("pixelRatio is required.");if(i<=0)throw new w("pixelRatio must be greater than zero.");if(!a(n))throw new w("A result object is required.");let o=this.right-this.left,s=this.top-this.bottom,f=i*o/t,u=i*s/e;return n.x=f,n.y=u,n},k.prototype.clone=function(t){return a(t)||(t=new k),t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},k.prototype.equals=function(t){return a(t)&&t instanceof k&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},k.prototype.equalsEpsilon=function(t,e,r){return t===this||a(t)&&t instanceof k&&P.equalsEpsilon(this.right,t.right,e,r)&&P.equalsEpsilon(this.left,t.left,e,r)&&P.equalsEpsilon(this.top,t.top,e,r)&&P.equalsEpsilon(this.bottom,t.bottom,e,r)&&P.equalsEpsilon(this.near,t.near,e,r)&&P.equalsEpsilon(this.far,t.far,e,r)};var he=k;function z(t){t=m(t,m.EMPTY_OBJECT),this._offCenterFrustum=new he,this.width=t.width,this._width=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=m(t.near,1),this._near=this.near,this.far=m(t.far,5e8),this._far=this.far}function j(t){if(!a(t.width)||!a(t.aspectRatio)||!a(t.near)||!a(t.far))throw new w("width, aspectRatio, near, or far parameters are not set.");let e=t._offCenterFrustum;if(t.width!==t._width||t.aspectRatio!==t._aspectRatio||t.near!==t._near||t.far!==t._far){if(t.aspectRatio<0)throw new w("aspectRatio must be positive.");if(t.near<0||t.near>t.far)throw new w("near must be greater than zero and less than far.");t._aspectRatio=t.aspectRatio,t._width=t.width,t._near=t.near,t._far=t.far;let r=1/t.aspectRatio;e.right=.5*t.width,e.left=-e.right,e.top=r*e.right,e.bottom=-e.top,e.near=t.near,e.far=t.far}}z.packedLength=4,z.pack=function(t,e,r){return O.typeOf.object("value",t),O.defined("array",e),r=m(r,0),e[r++]=t.width,e[r++]=t.aspectRatio,e[r++]=t.near,e[r]=t.far,e},z.unpack=function(t,e,r){return O.defined("array",t),e=m(e,0),a(r)||(r=new z),r.width=t[e++],r.aspectRatio=t[e++],r.near=t[e++],r.far=t[e],r},Object.defineProperties(z.prototype,{projectionMatrix:{get:function(){return j(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return j(this),this._offCenterFrustum}}}),z.prototype.computeCullingVolume=function(t,e,r){return j(this),this._offCenterFrustum.computeCullingVolume(t,e,r)},z.prototype.getPixelDimensions=function(t,e,r,i,a){return j(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,a)},z.prototype.clone=function(t){return a(t)||(t=new z),t.aspectRatio=this.aspectRatio,t.width=this.width,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._width=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},z.prototype.equals=function(t){return!!(a(t)&&t instanceof z)&&(j(this),j(t),this.width===t.width&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},z.prototype.equalsEpsilon=function(t,e,r){return!!(a(t)&&t instanceof z)&&(j(this),j(t),P.equalsEpsilon(this.width,t.width,e,r)&&P.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,r)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,r))};var B=z;function S(t){t=m(t,m.EMPTY_OBJECT),this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=m(t.near,1),this._near=this.near,this.far=m(t.far,5e8),this._far=this.far,this._cullingVolume=new $,this._perspectiveMatrix=new F,this._infinitePerspective=new F}function te(t){if(!a(t.right)||!a(t.left)||!a(t.top)||!a(t.bottom)||!a(t.near)||!a(t.far))throw new w("right, left, top, bottom, near, or far parameters are not set.");let{top:e,bottom:r,right:i,left:n,near:o,far:s}=t;if(e!==t._top||r!==t._bottom||n!==t._left||i!==t._right||o!==t._near||s!==t._far){if(t.near<=0||t.near>t.far)throw new w("near must be greater than zero and less than far.");t._left=n,t._right=i,t._top=e,t._bottom=r,t._near=o,t._far=s,t._perspectiveMatrix=F.computePerspectiveOffCenter(n,i,r,e,o,s,t._perspectiveMatrix),t._infinitePerspective=F.computeInfinitePerspectiveOffCenter(n,i,r,e,o,t._infinitePerspective)}}Object.defineProperties(S.prototype,{projectionMatrix:{get:function(){return te(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return te(this),this._infinitePerspective}}});var Ce=new r,be=new r,Oe=new r,Pe=new r;S.prototype.computeCullingVolume=function(t,e,i){if(!a(t))throw new w("position is required.");if(!a(e))throw new w("direction is required.");if(!a(i))throw new w("up is required.");let n=this._cullingVolume.planes,o=this.top,s=this.bottom,f=this.right,u=this.left,h=this.near,p=this.far,l=r.cross(e,i,Ce),c=be;r.multiplyByScalar(e,h,c),r.add(t,c,c);let m=Oe;r.multiplyByScalar(e,p,m),r.add(t,m,m);let d=Pe;r.multiplyByScalar(l,u,d),r.add(c,d,d),r.subtract(d,t,d),r.normalize(d,d),r.cross(d,i,d),r.normalize(d,d);let _=n[0];return a(_)||(_=n[0]=new b),_.x=d.x,_.y=d.y,_.z=d.z,_.w=-r.dot(d,t),r.multiplyByScalar(l,f,d),r.add(c,d,d),r.subtract(d,t,d),r.cross(i,d,d),r.normalize(d,d),_=n[1],a(_)||(_=n[1]=new b),_.x=d.x,_.y=d.y,_.z=d.z,_.w=-r.dot(d,t),r.multiplyByScalar(i,s,d),r.add(c,d,d),r.subtract(d,t,d),r.cross(l,d,d),r.normalize(d,d),_=n[2],a(_)||(_=n[2]=new b),_.x=d.x,_.y=d.y,_.z=d.z,_.w=-r.dot(d,t),r.multiplyByScalar(i,o,d),r.add(c,d,d),r.subtract(d,t,d),r.cross(d,l,d),r.normalize(d,d),_=n[3],a(_)||(_=n[3]=new b),_.x=d.x,_.y=d.y,_.z=d.z,_.w=-r.dot(d,t),_=n[4],a(_)||(_=n[4]=new b),_.x=e.x,_.y=e.y,_.z=e.z,_.w=-r.dot(e,c),r.negate(e,d),_=n[5],a(_)||(_=n[5]=new b),_.x=d.x,_.y=d.y,_.z=d.z,_.w=-r.dot(d,m),this._cullingVolume},S.prototype.getPixelDimensions=function(t,e,r,i,n){if(te(this),!a(t)||!a(e))throw new w("Both drawingBufferWidth and drawingBufferHeight are required.");if(t<=0)throw new w("drawingBufferWidth must be greater than zero.");if(e<=0)throw new w("drawingBufferHeight must be greater than zero.");if(!a(r))throw new w("distance is required.");if(!a(i))throw new w("pixelRatio is required");if(i<=0)throw new w("pixelRatio must be greater than zero.");if(!a(n))throw new w("A result object is required.");let o=1/this.near,s=this.top*o,f=2*i*r*s/e;s=this.right*o;let u=2*i*r*s/t;return n.x=u,n.y=f,n},S.prototype.clone=function(t){return a(t)||(t=new S),t.right=this.right,t.left=this.left,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t._left=void 0,t._right=void 0,t._top=void 0,t._bottom=void 0,t._near=void 0,t._far=void 0,t},S.prototype.equals=function(t){return a(t)&&t instanceof S&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far},S.prototype.equalsEpsilon=function(t,e,r){return t===this||a(t)&&t instanceof S&&P.equalsEpsilon(this.right,t.right,e,r)&&P.equalsEpsilon(this.left,t.left,e,r)&&P.equalsEpsilon(this.top,t.top,e,r)&&P.equalsEpsilon(this.bottom,t.bottom,e,r)&&P.equalsEpsilon(this.near,t.near,e,r)&&P.equalsEpsilon(this.far,t.far,e,r)};var pe=S;function R(t){t=m(t,m.EMPTY_OBJECT),this._offCenterFrustum=new pe,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=m(t.near,1),this._near=this.near,this.far=m(t.far,5e8),this._far=this.far,this.xOffset=m(t.xOffset,0),this._xOffset=this.xOffset,this.yOffset=m(t.yOffset,0),this._yOffset=this.yOffset}function q(t){if(!a(t.fov)||!a(t.aspectRatio)||!a(t.near)||!a(t.far))throw new w("fov, aspectRatio, near, or far parameters are not set.");if(t.fov===t._fov&&t.aspectRatio===t._aspectRatio&&t.near===t._near&&t.far===t._far&&t.xOffset===t._xOffset&&t.yOffset===t._yOffset)return;if(O.typeOf.number.greaterThanOrEquals("fov",t.fov,0),O.typeOf.number.lessThan("fov",t.fov,Math.PI),O.typeOf.number.greaterThanOrEquals("aspectRatio",t.aspectRatio,0),O.typeOf.number.greaterThanOrEquals("near",t.near,0),t.near>t.far)throw new w("near must be less than far.");t._aspectRatio=t.aspectRatio,t._fov=t.fov,t._fovy=t.aspectRatio<=1?t.fov:2*Math.atan(Math.tan(.5*t.fov)/t.aspectRatio),t._near=t.near,t._far=t.far,t._sseDenominator=2*Math.tan(.5*t._fovy),t._xOffset=t.xOffset,t._yOffset=t.yOffset;let e=t._offCenterFrustum;e.top=t.near*Math.tan(.5*t._fovy),e.bottom=-e.top,e.right=t.aspectRatio*e.top,e.left=-e.right,e.near=t.near,e.far=t.far,e.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset}R.packedLength=6,R.pack=function(t,e,r){return O.typeOf.object("value",t),O.defined("array",e),r=m(r,0),e[r++]=t.fov,e[r++]=t.aspectRatio,e[r++]=t.near,e[r++]=t.far,e[r++]=t.xOffset,e[r]=t.yOffset,e},R.unpack=function(t,e,r){return O.defined("array",t),e=m(e,0),a(r)||(r=new R),r.fov=t[e++],r.aspectRatio=t[e++],r.near=t[e++],r.far=t[e++],r.xOffset=t[e++],r.yOffset=t[e],r},Object.defineProperties(R.prototype,{projectionMatrix:{get:function(){return q(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return q(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return q(this),this._fovy}},sseDenominator:{get:function(){return q(this),this._sseDenominator}},offCenterFrustum:{get:function(){return q(this),this._offCenterFrustum}}}),R.prototype.computeCullingVolume=function(t,e,r){return q(this),this._offCenterFrustum.computeCullingVolume(t,e,r)},R.prototype.getPixelDimensions=function(t,e,r,i,a){return q(this),this._offCenterFrustum.getPixelDimensions(t,e,r,i,a)},R.prototype.clone=function(t){return a(t)||(t=new R),t.aspectRatio=this.aspectRatio,t.fov=this.fov,t.near=this.near,t.far=this.far,t._aspectRatio=void 0,t._fov=void 0,t._near=void 0,t._far=void 0,this._offCenterFrustum.clone(t._offCenterFrustum),t},R.prototype.equals=function(t){return!!(a(t)&&t instanceof R)&&(q(this),q(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this._offCenterFrustum.equals(t._offCenterFrustum))},R.prototype.equalsEpsilon=function(t,e,r){return!!(a(t)&&t instanceof R)&&(q(this),q(t),P.equalsEpsilon(this.fov,t.fov,e,r)&&P.equalsEpsilon(this.aspectRatio,t.aspectRatio,e,r)&&this._offCenterFrustum.equalsEpsilon(t._offCenterFrustum,e,r))};var L=R,I=0,Fe=1;function U(t){O.typeOf.object("options",t),O.typeOf.object("options.frustum",t.frustum),O.typeOf.object("options.origin",t.origin),O.typeOf.object("options.orientation",t.orientation);let e,i,a=t.frustum,n=t.orientation,o=t.origin,s=m(t.vertexFormat,E.DEFAULT),f=m(t._drawNearPlane,!0);a instanceof L?(e=I,i=L.packedLength):a instanceof B&&(e=Fe,i=B.packedLength),this._frustumType=e,this._frustum=a.clone(),this._origin=r.clone(o),this._orientation=N.clone(n),this._drawNearPlane=f,this._vertexFormat=s,this._workerName="createFrustumGeometry",this.packedLength=2+i+r.packedLength+N.packedLength+E.packedLength}U.pack=function(t,e,i){O.typeOf.object("value",t),O.defined("array",e),i=m(i,0);let a=t._frustumType,n=t._frustum;return e[i++]=a,a===I?(L.pack(n,e,i),i+=L.packedLength):(B.pack(n,e,i),i+=B.packedLength),r.pack(t._origin,e,i),i+=r.packedLength,N.pack(t._orientation,e,i),i+=N.packedLength,E.pack(t._vertexFormat,e,i),i+=E.packedLength,e[i]=t._drawNearPlane?1:0,e};var xe=new L,ve=new B,ze=new N,Re=new r,Te=new E;function W(t,e,r,i,n,o,s,f){let u=t/3*2;for(let h=0;h<4;++h)a(e)&&(e[t]=o.x,e[t+1]=o.y,e[t+2]=o.z),a(r)&&(r[t]=s.x,r[t+1]=s.y,r[t+2]=s.z),a(i)&&(i[t]=f.x,i[t+1]=f.y,i[t+2]=f.z),t+=3;n[u]=0,n[u+1]=0,n[u+2]=1,n[u+3]=0,n[u+4]=1,n[u+5]=1,n[u+6]=0,n[u+7]=1}U.unpack=function(t,e,i){O.defined("array",t),e=m(e,0);let n,o=t[e++];o===I?(n=L.unpack(t,e,xe),e+=L.packedLength):(n=B.unpack(t,e,ve),e+=B.packedLength);let s=r.unpack(t,e,Re);e+=r.packedLength;let f=N.unpack(t,e,ze);e+=N.packedLength;let u=E.unpack(t,e,Te);e+=E.packedLength;let h=1===t[e];if(!a(i))return new U({frustum:n,origin:s,orientation:f,vertexFormat:u,_drawNearPlane:h});let p=o===i._frustumType?i._frustum:void 0;return i._frustum=n.clone(p),i._frustumType=o,i._origin=r.clone(s,i._origin),i._orientation=N.clone(f,i._orientation),i._vertexFormat=E.clone(u,i._vertexFormat),i._drawNearPlane=h,i};var qe=new G,Me=new F,ne=new F,se=new r,le=new r,we=new r,ke=new r,Se=new r,De=new r,u=new Array(3),Z=new Array(4);Z[0]=new b(-1,-1,1,1),Z[1]=new b(1,-1,1,1),Z[2]=new b(1,1,1,1),Z[3]=new b(-1,1,1,1);var de=new Array(4);for(let t=0;t<4;++t)de[t]=new b;U._computeNearFarPlanes=function(t,e,i,n,o,s,f,h){let p=G.fromQuaternion(e,qe),l=m(s,se),c=m(f,le),w=m(h,we);l=G.getColumn(p,0,l),c=G.getColumn(p,1,c),w=G.getColumn(p,2,w),r.normalize(l,l),r.normalize(c,c),r.normalize(w,w),r.negate(l,l);let d,_,g=F.computeView(t,w,c,l,Me),y=n.projectionMatrix;if(i===I){let t=F.multiply(y,g,ne);_=F.inverse(t,ne)}else d=F.inverseTransformation(g,ne);a(_)?(u[0]=n.near,u[1]=n.far):(u[0]=0,u[1]=n.near,u[2]=n.far);for(let m=0;m<2;++m)for(let e=0;e<4;++e){let i=b.clone(Z[e],de[e]);if(a(_)){i=F.multiplyByVector(_,i,i);let e=1/i.w;r.multiplyByScalar(i,e,i),r.subtract(i,t,i),r.normalize(i,i);let a=r.dot(w,i);r.multiplyByScalar(i,u[m]/a,i),r.add(i,t,i)}else{let t=n.offCenterFrustum;a(t)&&(n=t);let e=u[m],r=u[m+1];i.x=.5*(i.x*(n.right-n.left)+n.left+n.right),i.y=.5*(i.y*(n.top-n.bottom)+n.bottom+n.top),i.z=.5*(i.z*(e-r)-e-r),i.w=1,F.multiplyByVector(d,i,i)}o[12*m+3*e]=i.x,o[12*m+3*e+1]=i.y,o[12*m+3*e+2]=i.z}},U.createGeometry=function(t){let e=t._frustumType,i=t._frustum,n=t._origin,o=t._orientation,s=t._drawNearPlane,f=t._vertexFormat,u=s?6:5,h=new Float64Array(72);U._computeNearFarPlanes(n,o,e,i,h);let p=24;h[p]=h[12],h[p+1]=h[13],h[p+2]=h[14],h[p+3]=h[0],h[p+4]=h[1],h[p+5]=h[2],h[p+6]=h[9],h[p+7]=h[10],h[p+8]=h[11],h[p+9]=h[21],h[p+10]=h[22],h[p+11]=h[23],p+=12,h[p]=h[15],h[p+1]=h[16],h[p+2]=h[17],h[p+3]=h[3],h[p+4]=h[4],h[p+5]=h[5],h[p+6]=h[0],h[p+7]=h[1],h[p+8]=h[2],h[p+9]=h[12],h[p+10]=h[13],h[p+11]=h[14],p+=12,h[p]=h[3],h[p+1]=h[4],h[p+2]=h[5],h[p+3]=h[15],h[p+4]=h[16],h[p+5]=h[17],h[p+6]=h[18],h[p+7]=h[19],h[p+8]=h[20],h[p+9]=h[6],h[p+10]=h[7],h[p+11]=h[8],p+=12,h[p]=h[6],h[p+1]=h[7],h[p+2]=h[8],h[p+3]=h[18],h[p+4]=h[19],h[p+5]=h[20],h[p+6]=h[21],h[p+7]=h[22],h[p+8]=h[23],h[p+9]=h[9],h[p+10]=h[10],h[p+11]=h[11],s||(h=h.subarray(12));let l=new ae({position:new J({componentDatatype:H.DOUBLE,componentsPerAttribute:3,values:h})});if(a(f.normal)||a(f.tangent)||a(f.bitangent)||a(f.st)){let t=a(f.normal)?new Float32Array(12*u):void 0,e=a(f.tangent)?new Float32Array(12*u):void 0,i=a(f.bitangent)?new Float32Array(12*u):void 0,n=a(f.st)?new Float32Array(8*u):void 0,o=se,h=le,c=we,m=r.negate(o,ke),w=r.negate(h,Se),d=r.negate(c,De);p=0,s&&(W(p,t,e,i,n,d,o,h),p+=12),W(p,t,e,i,n,c,m,h),p+=12,W(p,t,e,i,n,m,d,h),p+=12,W(p,t,e,i,n,w,d,m),p+=12,W(p,t,e,i,n,o,c,h),p+=12,W(p,t,e,i,n,h,c,m),a(t)&&(l.normal=new J({componentDatatype:H.FLOAT,componentsPerAttribute:3,values:t})),a(e)&&(l.tangent=new J({componentDatatype:H.FLOAT,componentsPerAttribute:3,values:e})),a(i)&&(l.bitangent=new J({componentDatatype:H.FLOAT,componentsPerAttribute:3,values:i})),a(n)&&(l.st=new J({componentDatatype:H.FLOAT,componentsPerAttribute:2,values:n}))}let c=new Uint16Array(6*u);for(let r=0;r<u;++r){let t=6*r,e=4*r;c[t]=e,c[t+1]=e+1,c[t+2]=e+2,c[t+3]=e,c[t+4]=e+2,c[t+5]=e+3}return new re({attributes:l,indices:c,primitiveType:oe.TRIANGLES,boundingSphere:ie.fromVertices(h)})};var Vt=U;export{B as a,L as b,Vt as c};