/*
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","../../../../chunks/tslib.es6","../../../../core/Error","../../../../core/maybe","../../../../core/Logger","../../../../core/accessorSupport/ensureType","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/set","../../../../core/accessorSupport/decorators/subclass","../../../../layers/support/fieldUtils","../../../layers/support/popupUtils"],(function(e,t,r,s,o,a,p,n,i,u,c,l,h){"use strict";const y=e=>{let a=function(e){function r(){return e.apply(this,arguments)||this}t._inheritsLoose(r,e);var a=r.prototype;return a._validateFetchPopupFeatures=function(e){const{layer:t}=this,{popupEnabled:r}=t;if(!r)return new s("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:t});return h.getFetchPopupTemplate(t,e)?void 0:new s("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:t})},a.prepareFetchPopupFeatures=function(){var e=t._asyncToGenerator((function*(e){}));function r(t){return e.apply(this,arguments)}return r}(),a.fetchPopupFeatures=function(){var e=t._asyncToGenerator((function*(e,t){const r=this._validateFetchPopupFeatures(t);if(r)throw r;const s=o.isSome(t)?t.clientGraphics:null;if(!s||0===s.length)return[];const a="scene"===this.layer.type&&o.isSome(this.layer.associatedLayer)?this.layer.associatedLayer:this.layer,p=l.unpackFieldNames(this.layer.fieldsIndex,yield h.getRequiredFields(a,h.getFetchPopupTemplate(this.layer,t)));yield this.prepareFetchPopupFeatures(p);const n=new Set,i=[],u=[];for(const o of s)l.populateMissingFields(p,o,n)?u.push(o):i.push(o);return 0===u.length?i:this.whenGraphicAttributes(u,[...n]).catch((()=>u)).then((e=>i.concat(e)))}));function r(t,r){return e.apply(this,arguments)}return r}(),r}(e);return a=r.__decorate([c.subclass("esri.views.3d.layers.support.PopupSceneLayerView")],a),a};e.PopupSceneLayerView=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
