You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
16 KiB

4 weeks ago
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.128
*
* 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{f as g,g as j}from"./chunk-KLDIEE7M.js";import{a as i}from"./chunk-BF7B4FIR.js";import{b as n}from"./chunk-IQDUXDOM.js";import{e as b}from"./chunk-GDY26PU3.js";function F(r,o,t){return t<0&&(t+=1),t>1&&(t-=1),t*6<1?r+(o-r)*6*t:t*2<1?o:t*3<2?r+(o-r)*(2/3-t)*6:r}function e(r,o,t,f){this.red=r??1,this.green=o??1,this.blue=t??1,this.alpha=f??1}e.fromCartesian4=function(r,o){return n.typeOf.object("cartesian",r),b(o)?(o.red=r.x,o.green=r.y,o.blue=r.z,o.alpha=r.w,o):new e(r.x,r.y,r.z,r.w)};e.fromBytes=function(r,o,t,f,C){return r=e.byteToFloat(r??255),o=e.byteToFloat(o??255),t=e.byteToFloat(t??255),f=e.byteToFloat(f??255),b(C)?(C.red=r,C.green=o,C.blue=t,C.alpha=f,C):new e(r,o,t,f)};e.fromAlpha=function(r,o,t){return n.typeOf.object("color",r),n.typeOf.number("alpha",o),b(t)?(t.red=r.red,t.green=r.green,t.blue=r.blue,t.alpha=o,t):new e(r.red,r.green,r.blue,o)};var l,A,E;j.supportsTypedArrays()&&(l=new ArrayBuffer(4),A=new Uint32Array(l),E=new Uint8Array(l));e.fromRgba=function(r,o){return A[0]=r,e.fromBytes(E[0],E[1],E[2],E[3],o)};e.fromHsl=function(r,o,t,f,C){r=(r??0)%1,o=o??0,t=t??0,f=f??1;let m=t,s=t,O=t;if(o!==0){let c;t<.5?c=t*(1+o):c=t+o-t*o;let S=2*t-c;m=F(S,c,r+1/3),s=F(S,c,r),O=F(S,c,r-1/3)}return b(C)?(C.red=m,C.green=s,C.blue=O,C.alpha=f,C):new e(m,s,O,f)};e.fromRandom=function(r,o){r=r??g.EMPTY_OBJECT;let t=r.red;if(!b(t)){let s=r.minimumRed??0,O=r.maximumRed??1;n.typeOf.number.lessThanOrEquals("minimumRed",s,O),t=s+i.nextRandomNumber()*(O-s)}let f=r.green;if(!b(f)){let s=r.minimumGreen??0,O=r.maximumGreen??1;n.typeOf.number.lessThanOrEquals("minimumGreen",s,O),f=s+i.nextRandomNumber()*(O-s)}let C=r.blue;if(!b(C)){let s=r.minimumBlue??0,O=r.maximumBlue??1;n.typeOf.number.lessThanOrEquals("minimumBlue",s,O),C=s+i.nextRandomNumber()*(O-s)}let m=r.alpha;if(!b(m)){let s=r.minimumAlpha??0,O=r.maximumAlpha??1;n.typeOf.number.lessThanOrEquals("minimumAlpha",s,O),m=s+i.nextRandomNumber()*(O-s)}return b(o)?(o.red=t,o.green=f,o.blue=C,o.alpha=m,o):new e(t,f,C,m)};var a=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,z=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,p=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,R=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;e.fromCssColorString=function(r,o){n.typeOf.string("color",r),b(o)||(o=new e),r=r.trim();let t=e[r.toUpperCase()];if(b(t))return e.clone(t,o),o;let f=a.exec(r);return f!==null?(o.red=parseInt(f[1],16)/15,o.green=parseInt(f[2],16)/15,o.blue=parseInt(f[3],16)/15,o.alpha=parseInt(f[4]??"f",16)/15,o):(f=z.exec(r),f!==null?(o.red=parseInt(f[1],16)/255,o.green=parseInt(f[2],16)/255,o.blue=parseInt(f[3],16)/255,o.alpha=parseInt(f[4]??"ff",16)/255,o):(f=p.exec(r),f!==null?(o.red=parseFloat(f[1])/(f[1].substr(-1)==="%"?100:255),o.green=parseFloat(f[2])/(f[2].substr(-1)==="%"?100:255),o.blue=parseFloat(f[3])/(f[3].substr(-1)==="%"?100:255),o.alpha=parseFloat(f[4]??"1.0"),o):(f=R.exec(r),f!==null?e.fromHsl(parseFloat(f[1])/360,parseFloat(f[2])/100,parseFloat(f[3])/100,parseFloat(f[4]??"1.0"),o):(o=void 0,o))))};e.packedLength=4;e.pack=function(r,o,t){return n.typeOf.object("value",r),n.defined("array",o),t=t??0,o[t++]=r.red,o[t++]=r.green,o[t++]=r.blue,o[t]=r.alpha,o};e.unpack=function(r,o,t){return n.defined("array",r),o=o??0,b(t)||(t=new e),t.red=r[o++],t.green=r[o++],t.blue=r[o++],t.alpha=r[o],t};e.byteToFloat=function(r){return r/255};e.floatToByte=function(r){return r===1?255:r*256|0};e.clone=function(r,o){if(b(r))return b(o)?(o.red=r.red,o.green=r.green,o.blue=r.blue,o.alpha=r.alpha,o):new e(r.red,r.green,r.blue,r.alpha)};e.equals=function(r,o){return r===o||b(r)&&b(o)&&r.red===o.red&&r.green===o.green&&r.blue===o.blue&&r.alpha===o.alpha};e.equalsArray=function(r,o,t){return r.red===o[t]&&r.green===o[t+1]&&r.blue===o[t+2]&&r.alpha===o[t+3]};e.prototype.clone=function(r){return e.clone(this,r)};e.prototype.equals=function(r){return e.equals(this,r)};e.prototype.equalsEpsilon=function(r,o){return this===r||b(r)&&Math.abs(this.red-r.red)<=o