/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import{when as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{notAvailableString as s}from"../constants.js";import{DrawHeaderActions as n}from"../components/DrawHeaderActions.js";import{TooltipEditableField as r}from"../components/TooltipEditableField.js";import{TooltipField as l}from"../components/TooltipField.js";import{ValueByValue as d}from"../components/ValueByValue.js";import{TooltipContent as f}from"./TooltipContent.js";import{messageBundle as p,tsx as a,tsxFragment as m}from"../../../../widgets/support/widget.js";let c=class extends f{initialize(){this.addHandles(t(()=>this.info&&this._messagesUnits&&this._messagesTooltip&&this.fieldContext,()=>this.info.renderContext=this.fieldContext),{once:!0})}destroy(){this.info&&(this.info.renderContext=null)}_renderContent(){const{fieldContext:e,info:t,mode:i}=this,o=t.fieldsGroupedForDisplay;return o.length?a(m,null,o.map(t=>{if("left"in t&&(t.left.readOnly&&t.right.readOnly||"feedback"===i)){const i="string"==typeof t.left.title?t.left.title:t.left.title(e);return a(l,{title:i,value:a(d,{left:t.left.getFormattedValue(e)??s,right:t.right.getFormattedValue(e)??s})})}return"left"in t?a(m,null,a(r,{context:e,field:t.left,key:t.left.id,mode:i}),a(r,{context:e,field:t.right,key:t.right.id,mode:i})):a(r,{context:e,field:t,key:t.id,mode:i})})):null}get _defaultHelpMessage(){const{helpMessageExtended:e,viewType:t}=this.info;if(null==e)return null;const i="3d"===t?"helpMessages3d":"helpMessages2d";return this._messagesEditor?.[i]?.[e]}_renderActions(){const{xyMode:e,sketchOptions:t}=this.info,i=this.info.allFields.some(e=>"direction"===e.name);return a(n,{sketchOptions:t,visibleElements:{direction:"direction-distance"===e&&i}})}};e([p("esri/widgets/Editor/t9n/Editor"),i()],c.prototype,"_messagesEditor",void 0),e([i()],c.prototype,"_defaultHelpMessage",null),c=e([o("esri.views.interactive.tooltip.content.TooltipContentDynamic")],c);export{c as TooltipContentDynamic};
