// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/layers/vectorTiles/views/vectorTiles/style/StyleProperty",["require","exports","../../../Color","../GeometryUtils"],function(m,n,h,l){return function(){function b(a,c,d){this.isDataDriven=!1;switch(c.type){case "number":a=!0;break;case "color":a=!0;d=b._parseColor(d);break;case "array":a="number"===c.value;break;default:a=!1}var g=d.stops&&0<d.stops.length;if(this.isDataDriven=!!d.property)if(g)switch(d.type){case "identity":this.getValue=this._buildIdentity(d,c);break;case "categorical":this.getValue=
this._buildCategorical(d,c);break;default:a&&"interval"===d.type&&(a=!1),this.getValue=a?this._buildInterpolate(d,c):this._buildInterval(d,c)}else this.getValue=this._buildIdentity(d,c);else this.getValue=g?a?this._buildZoomInterpolate(d):this._buildZoomInterval(d):this._buildSimple(d)}b.prototype._buildSimple=function(a){return function(){return a}};b.prototype._buildIdentity=function(a,c){return function(d,g){var e;g&&(e=g.values[a.property],"color"===c.type&&(e=b._parseColor(e)));return void 0!==
e?e:void 0!==a.default?a.default:c.default}};b.prototype._buildCategorical=function(a,c){var d=this;return function(g,e){var b;e&&(b=e.values[a.property]);b=d._categorical(b,a.stops);return void 0!==b?b:void 0!==a.default?a.default:c.default}};b.prototype._buildInterval=function(a,c){var d=this;return function(g,e){var b;e&&(b=e.values[a.property]);return"number"===typeof b?d._interval(b,a.stops):void 0!==a.default?a.default:c.default}};b.prototype._buildInterpolate=function(a,c){var d=this;return function(g,
e){var b;e&&(b=e.values[a.property]);return"number"===typeof b?d._interpolate(b,a.stops,a.base||1):void 0!==a.default?a.default:c.default}};b.prototype._buildZoomInterpolate=function(a){var c=this;return function(d){return c._interpolate(d,a.stops,a.base||1)}};b.prototype._buildZoomInterval=function(a){var c=this;return function(d){return c._interval(d,a.stops)}};b.prototype._categorical=function(a,c){for(var d=c.length,b=0;b<d;b++)if(c[b][0]===a)return c[b][1]};b.prototype._interval=function(a,b){for(var d=
b.length,c=0,e=0;e<d;e++)if(b[e][0]<=a)c=e;else break;return b[c][1]};b.prototype._interpolate=function(a,b,d){for(var c,e,h=b.length,f=0;f<h;f++){var k=b[f];if(k[0]<=a)c=k;else{e=k;break}}if(c&&e){f=e[0]-c[0];a-=c[0];d=1===d?a/f:(Math.pow(d,a)-1)/(Math.pow(d,f)-1);if(Array.isArray(c[1])){c=c[1];e=e[1];a=[];for(f=0;f<c.length;f++)a.push(l.interpolate(c[f],e[f],d));return a}return l.interpolate(c[1],e[1],d)}if(c)return c[1];if(e)return e[1]};b._isEmpty=function(a){for(var c in a)if(a.hasOwnProperty(c))return!1;
return!0};b._parseColor=function(a){if(Array.isArray(a))return a;if("string"===typeof a){if(a=new h(a),!this._isEmpty(a))return h.toUnitRGBA(a)}else return a&&a.default&&(a.default=b._parseColor(a.default)),a&&a.stops&&(a.stops=a.stops.map(function(a){return[a[0],b._parseColor(a[1])]})),a};return b}()});