/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../chunks/_rollupPluginBabelHelpers","../../../../core/asyncUtils","../../../../core/maybe","../../../../core/promiseUtils","./Graphics3DCalloutSymbolLayerFactory","./Graphics3DSymbol"],(function(t,r,e,o,l,a){"use strict";let i=function(a){function i(t,r,e){var o;return(o=a.call(this,t,r,e)||this).calloutSymbolLayer=null,o.symbol.hasVisibleCallout()&&(o.calloutSymbolLayer=l.make(o.symbol,r)),o}t._inheritsLoose(i,a);var c=i.prototype;return c.doLoad=function(){var e=t._asyncToGenerator((function*(t){const e=this.calloutSymbolLayer?r.result(this.calloutSymbolLayer.load()):null;try{yield a.prototype.doLoad.call(this,t),o.throwIfAborted(t)}catch(i){var l;throw null==(l=this.calloutSymbolLayer)||l.abortLoad(),i}e&&(yield e)}));function l(t){return e.apply(this,arguments)}return l}(),c.destroy=function(){a.prototype.destroy.call(this),this.calloutSymbolLayer=e.destroyMaybe(this.calloutSymbolLayer)},c.createGraphics3DGraphic=function(t,r){const o=a.prototype.createGraphics3DGraphic.call(this,t,r);if(e.isSome(this.calloutSymbolLayer)&&e.isSome(o)){const r=this._createCalloutGraphic(t);e.isSome(r)&&o.addAuxiliaryGraphic(r)}return o},c.globalPropertyChanged=function(t,r){return!!a.prototype.globalPropertyChanged.call(this,t,r)&&(!this.calloutSymbolLayer||this.calloutSymbolLayer.globalPropertyChanged(t,r,(t=>this._getCalloutGraphicLayer(t))))},c.updateGeometry=function(t,r){const e=a.prototype.updateGeometry.call(this,t,r);if(e&&this.calloutSymbolLayer){const e=this._getCalloutGraphicLayer(t);if(e)return this.calloutSymbolLayer.updateGeometry(e,r)}return e},c._createCalloutGraphic=function(t){const r=t.renderingInfo,e={renderer:r.renderer,symbol:r.symbol,translation:[0,0,0],centerOffset:[0,0,0,0],screenOffset:[0,0],centerOffsetUnits:"world",elevationOffset:0,materialCollection:null};return t.renderingInfo=e,this.calloutSymbolLayer.createGraphics3DGraphic(t)},c._getCalloutGraphicLayer=function(t){for(const r of t._auxiliaryGraphics)if(r.graphics3DSymbolLayer===this.calloutSymbolLayer)return r},i}(a);return i}));
