/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../renderers/ClassBreaksRenderer","../../renderers/DictionaryRenderer","../../renderers/DotDensityRenderer","../../renderers/HeatmapRenderer","../../renderers/PieChartRenderer","../../renderers/Renderer","../../renderers/SimpleRenderer","../../renderers/UniqueValueRenderer","../../renderers/support/jsonUtils","../../core/Error","../../core/maybe","../heuristics/outline","../heuristics/sizeRange","./support/utils","../support/adapters/support/layerUtils","../symbology/location"],(function(e,r,i,n,a,o,l,s,t,m,p,u,c,y,d,b,h,f){"use strict";function T(e){return v.apply(this,arguments)}function v(){return(v=r._asyncToGenerator((function*(e){if(!e||!e.layer)throw new u("location-renderer:missing-parameters","'layer' parameter is required");const r={...e};r.symbolType=r.symbolType||"2d";const i=h.createLayerAdapter(r.layer,h.featureCapableLayerTypes);if(r.layer=i,!i)throw new u("location-renderer:invalid-parameters","'layer' must be one of these types: "+h.getLayerTypeLabels(h.featureCapableLayerTypes).join(", "));const n=c.isSome(r.signal)?{signal:r.signal}:null;yield i.load(n);const a=i.geometryType;if(r.outlineOptimizationEnabled="polygon"===a&&r.outlineOptimizationEnabled,r.sizeOptimizationEnabled=("point"===a||"multipoint"===a||"polyline"===a)&&r.sizeOptimizationEnabled,"mesh"===a)r.symbolType="3d-volumetric",r.colorMixMode=r.colorMixMode||"replace",r.edgesType=r.edgesType||"none";else{if("3d-volumetric-uniform"===r.symbolType&&"point"!==a)throw new u("location-renderer:not-supported","3d-volumetric-uniform symbols are supported for point layers only");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new u("location-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or '3d-volumetric-uniform'")}return r}))).apply(this,arguments)}function g(e,r){return w.apply(this,arguments)}function w(){return(w=r._asyncToGenerator((function*(e,r){let i=e.locationScheme,n=null,a=null;const o=yield b.getBasemapInfo(e.basemap,e.view);if(n=c.isSome(o.basemapId)?o.basemapId:null,a=c.isSome(o.basemapTheme)?o.basemapTheme:null,i)return{scheme:f.cloneScheme(i),basemapId:n,basemapTheme:a};const l=f.getSchemes({basemap:n,basemapTheme:a,geometryType:r,worldScale:e.symbolType.includes("3d-volumetric"),view:e.view});return l&&(i=l.primaryScheme,n=l.basemapId,a=l.basemapTheme),{scheme:i,basemapId:n,basemapTheme:a}}))).apply(this,arguments)}function S(e){return z.apply(this,arguments)}function z(){return(z=r._asyncToGenerator((function*(e){const r=yield T(e),i=r.layer.geometryType,n=yield g(r,i),a=n.scheme;if(!a)throw new u("location-renderer:insufficient-info","Unable to find location scheme");const{view:o,layer:l,signal:s}=r,[m,p]=yield Promise.all([r.outlineOptimizationEnabled?y({view:o,layer:l,signal:s}):null,r.sizeOptimizationEnabled?d({view:o,layer:l,signal:s}):null]),c=m&&m.opacity,h=new t({symbol:b.createSymbol(i,{type:r.symbolType,color:a.color,size:b.getSymbolSizeFromScheme(a,i),outline:b.getSymbolOutlineFromScheme(a,i,c),meshInfo:{colorMixMode:r.colorMixMode,edgesType:r.edgesType}})});return m&&m.visualVariables&&m.visualVariables.length&&(h.visualVariables=m.visualVariables.map((e=>e.clone()))),p&&p.minSize&&(h.visualVariables?h.visualVariables.push(p.minSize):h.visualVariables=[p.minSize]),{renderer:h,locationScheme:f.cloneScheme(a),basemapId:n.basemapId,basemapTheme:n.basemapTheme}}))).apply(this,arguments)}e.createRenderer=S,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
