/*
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/Accessor","../../../core/maybe","../../../core/reactiveUtils","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass","./css","./content/tooltipContentFactory","../../../widgets/support/widgetUtils"],(function(t,e,o,n,i,r,s,c,a,l,p,d,u,y){"use strict";const h={base:`${d.BASE}`};function _({container:t,contentWidget:e,screenPoint:o}){const{style:n}=t;if(i.isSome(o)&&i.isSome(e)){n.display="block";const e=y.isRTL(t),i=`translate(${Math.round(o.x)+v[0]*(e?-1:1)}px, ${Math.round(o.y)+v[1]}px)`;n.transform=e?`translate(-100%, 0) ${i}`:i}else n.display="none"}t.Tooltip=function(t){function o(e){var o;return(o=t.call(this,e)||this).info=null,o._contentContainer=(()=>{const t=document.createElement("div");return t.classList.add(h.base),t})(),o._contentWidget=null,o}e._inheritsLoose(o,t);var n=o.prototype;return n.initialize=function(){const t=this._contentContainer;this.own([r.watch((()=>{var t;return null==(t=this.view.overlay)?void 0:t.surface}),(e=>{t.remove(),i.applySome(e,(e=>e.appendChild(t)))}),r.syncAndInitial),r.watch((()=>this.info),((e,o)=>{i.isSome(this._contentWidget)&&i.isSome(e)&&i.isSome(o)&&e.type===o.type?this._contentWidget.info=e:(this._contentWidget=i.destroyMaybe(this._contentWidget),i.applySome(u.tooltipContentFactory(this,e),(e=>{this._contentWidget=e,t.appendChild(e.container)})))}),r.syncAndInitial),r.watch((()=>{var t;return{container:this._contentContainer,contentWidget:this._contentWidget,screenPoint:null==(t=this.view.inputManager)?void 0:t.latestPointerLocation}}),_,r.syncAndInitial)])},n.destroy=function(){this._contentWidget=i.destroyMaybe(this._contentWidget),this._contentContainer.remove()},n.clear=function(){this.info=null},e._createClass(o,[{key:"test",get:function(){return{contentContainer:this._contentContainer}}}]),o}(n),o.__decorate([s.property({nonNullable:!0})],t.Tooltip.prototype,"view",void 0),o.__decorate([s.property()],t.Tooltip.prototype,"info",void 0),o.__decorate([s.property()],t.Tooltip.prototype,"_contentContainer",void 0),o.__decorate([s.property()],t.Tooltip.prototype,"_contentWidget",void 0),t.Tooltip=o.__decorate([p.subclass("esri.views.interactive.tooltip.Tooltip")],t.Tooltip);const v=[20,20];Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
