ncData)||void 0===s?void 0:s.isPending)||!a&&!r&&!this.currentInputText}get isPrefilledMessageNotEdited(){return this.isPrefilledFromEntryPointOrTemplate&&this.currentInputText===this.args.prefilledMessage}get showPlaceholder(){var e,t return!(null!==(e=this.attributedTextModel)&&void 0!==e&&e.text||null!==(t=this.args.gaiMessageAsyncData)&&void 0!==t&&t.isPending)}get currentInputText(){var e return null===(e=this.attributedTextModel)||void 0===e?void 0:e.text}get isMiniPreviewRemoved(){return this.lix.getTreatmentIsEnabled("voyager.web.messaging-remove-attachment-mini-preview")}get showMiniAttachmentPreviews(){if(this.isMiniPreviewRemoved)return!1 const{composeIsFullyExpanded:e,isInMailCompose:t}=this.args return e&&!t}get formElement(){return k.default?document.getElementById(this.formId):null}get subjectDisplay(){var e return(null===(e=this.args.subject)||void 0===e?void 0:e.toString())||this.args.subject||""}set subjectDisplay(e){this.subjectDisplay=e}get isNotInmail(){return!(this.args.isInMailCompose||this.viewData.isInMailConversation)}get hasNewConversationMessageInFlight(){var e,t return(null===(e=this.messageSendRequest)||void 0===e?void 0:e.isLoading)&&!(null!==(t=this.args.conversation)&&void 0!==t&&t.entityUrn)}get enableSend(){var e return this.isValidForm&&!this.hasNewConversationMessageInFlight&&!(null!==(e=this.args.gaiMessageAsyncData)&&void 0!==e&&e.isPending)}constructor(){super(...arguments) et.add(this) Ze.add(this);(0,i.default)(this,"pageKey","flagship3_messaging_msg_form");(0,t.default)(this,"i18n",ve,this);(0,t.default)(this,"jet",_e,this);(0,t.default)(this,"lix",we,this);(0,t.default)(this,"msgDataManager",Me,this);(0,t.default)(this,"tracking",ke,this);(0,t.default)(this,"formatter",Te,this);(0,t.default)(this,"vectorMediaUpload",De,this);(0,t.default)(this,"updateMessageComposeService",Se,this);(0,t.default)(this,"messagingUserSettings",xe,this);(0,t.default)(this,"sound",Ce,this);(0,t.default)(this,"presenceAPI",Pe,this);(0,t.default)(this,"clientSensor",Ie,this);(0,t.default)(this,"interop",Ee,this);(0,t.default)(this,"attributedTextModel",Ae,this);(0,t.default)(this,"showSendConfirmationModal",Oe,this);(0,t.default)(this,"isGaiOverwriteConfirmationModalOpen",Re,this);(0,t.default)(this,"mentionsTopPosition",Ue,this);(0,t.default)(this,"messageSendRequest",Ne,this);(0,t.default)(this,"isTabbingThroughMentions",je,this);(0,t.default)(this,"isValidForm",Fe,this);(0,t.default)(this,"isOverCharLimit",ze,this);(0,t.default)(this,"conversationMentions",Le,this);(0,t.default)(this,"connectionMentionData",Ge,this);(0,t.default)(this,"showMentionAllOption",Be,this);(0,t.default)(this,"showDragAndDropUserEducationLayer",Ve,this);(0,t.default)(this,"attachmentDropErrorType",He,this);(0,t.default)(this,"attachments",qe,this);(0,t.default)(this,"messageSendInProgress",We,this);(0,t.default)(this,"membersToInvite",Ke,this);(0,t.default)(this,"mentionAll",Ye,this);(0,t.default)(this,"isSystemClipboardUsed",$e,this);(0,t.default)(this,"isPrefilledFromEntryPointOrTemplate",Qe,this);(0,i.default)(this,"formIsAnimating",!1);(0,i.default)(this,"renderContent",[]);(0,i.default)(this,"lastSeenTyping",0);(0,i.default)(this,"supportedFileAttachmentTypes","image/*,.ai,.psd,.pdf,.doc,.docx,.csv,.zip,.rar,.ppt,.pptx,.pps,.ppsx,.odt,.rtf,.xls,.xlsx,.txt,.pub,.html,.7z,.eml,.mov,.mp4");(0,i.default)(this,"supportedImageAttachmentTypes","image/*");(0,i.default)(this,"conversationUrnsThatTriggeredMCSE",new Set);(0,t.default)(this,"isGaiModuleVisible",Je,this);(0,t.default)(this,"hasEnteredGaiFlow",Xe,this) const{id:e,isOverlay:s,beforeUpload:a,conversation:r,overridePlaceholder:o,prefilledAttachments:d}=this.args this._overridePlaceholder=o this.attachments=new l.TrackedArray(d||[]) this.attachments&&this.renderContent.push(...this.attachments) this.attachmentsHandler=new M.default({beforeUpload:a,vectorMediaUpload:this.vectorMediaUpload,afterUpload:this._attachmentAdded.bind(this),tracking:this.tracking,jet:this.jet,updateUI:this._addAttachment.bind(this),clientSensor:this.clientSensor}) this.formId=e||`base-form-${(0,I.guidFor)(this)}` this.oldConvo=r this.oldConvoId=this.viewData.conversationId this.AttributedTextManager=new T.default const c=(0,n.default)(this,et,mt).call(this,r) if(c)if(this.args.isMessageEditForm&&"object"==typeof c&&c.text){const e=(0,_.default)(c,c.text,{url:!0,email:!0,hashtag:!0,goLink:this.lix.getTreatmentIsEnabled("voyager.client.staff")}) let t=0 e.forEach((e=>{if(e.mention){const i=this._getMentionsEntityByAttributeChunk(e) i&&this.AttributedTextManager.insertAttribute({entity:i,entityUrn:e.entityUrn,match:{start:t,length:e.value.length,text:e.value},tokenSelection:{start:t,end:t+e.value.length},type:(0,v.buildModel)("com.linkedin.pemberly.text.Entity",{urn:e.entityUrn,type:"Entity"})})}else this.AttributedTextManager.insertText(e.value,{start:t,end:t}) t+=e.value.length}))}else this.AttributedTextManager.insertText(c,{start:0,end:0}) this._validateForm() s&&(this.bubbleId=this.args.bubbleId) this.updateMessageComposeService.setBaseFormSubscriber(this,s)}get isExistingConversation(){return!!this.args.conversation&&!this.args.conversation.isDraft}get shouldShowGaiPermEntryPoint(){var e,t,i const{gaiRefinementOptionsAsyncData:n,gaiIntentsAsyncData:s,gaiUpsellAsyncData:a}=this.args if(null!=a&&a.isPending||null!=s&&s.isPending||null!=n&&n.isPending)return!1 const r=this.isExistingConversation?null==n||null===(e=n.value)||void 0===e?void 0:e.refinementEntryPointCTA:null==s||null===(t=s.value)||void 0===t||null===(i=t.intents)||void 0===i?void 0:i.length,o=null==a?void 0:a.value return!(!r&&!o)}get gaiInteractionTrackingPrefix(){return this.args.isInMailCompose?"msg_inmail":"msg_mebc"}_toggleExpandComposeField(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0] "function"==typeof this.args.toggleExpandComposeField&&this.args.toggleExpandComposeField(e)}_constructfileAttachment(e){return{assetUrn:e.id,byteSize:e.byteSize,mediaType:e.mediaType,name:e.name,url:e.reference}}_constructVideoAttachment(e){return{media:e.id,thumbnail:{artifacts:[{width:0,height:0}],rootUrl:""},trackingId:e.id,progressiveStreams:[{bitRate:0,height:0,mediaType:e.mediaType,size:e.byteSize,width:0,streamingLocations:[{url:e.reference}]}]}}_constructExternalMedia(e){var t,i return{entityUrn:e.id,title:e.title,media:null===(t=e.media)||void 0===t?void 0:t.gif,previewMedia:null===(i=e.media)||void 0===i?void 0:i.previewMedia}}onClick(e){const t=this._getMessageTextEditor() t.contains(e.target)&&this.AttributedTextManager.correctClickPosition(t,this.interop.nileShadowRootOutlet)}onChange(){this._validateForm()}onSubmit(e){return this._onSubmit(e)}onReSubmit(e){return this._onReSubmit(e)}checkForReset(){const{oldConvoId:e}=this if(e!==this.viewData.conversationId){var t,i null===(t=(i=this.args).onResetGaiFlow)||void 0===t||t.call(i) this.hasEnteredGaiFlow=!1 if(e){this._resetForm() this.oldConvo=this.args.conversation this.oldConvoId=this.viewData.conversationId}}this._validateForm()}willDestroy(){super.willDestroy(...arguments) this.updateMessageComposeService.removeBaseFormSubscriber(this,this.args.isOverlay)}updateMessageComposeFromService(e){e?this._updateTextarea(e):this._resetForm(!0)}focusMessageComposeFromService(){this._focusTextarea()}shouldSubmitMessage(e){const{keyCode:t,metaKey:i,ctrlKey:n,shiftKey:s,altKey:a}=e if(t===st){if(this.messagingUserSettings.pressEnterToSend&&!this.args.isInMailCompose)return!(s||a||i||n) if(i||n)return!0}return!1}_attachmentAdded(){this._validateForm() this.renderContent.push(...this.attachments.map((e=>e.isVideo&&this.msgDataManager.isMessageVideoRecipeEnabled?{video:this._constructVideoAttachment(e)}:{file:this._constructfileAttachment(e)})))}_addAttachment(e){this.attachments.push(e)}_updateTextarea(e){const t=(0,A.isPresent)(this._lastCursorPosition)?this._lastCursorPosition:this.AttributedTextManager.getCaretPosition(this._getMessageTextEditor(),this.interop.nileShadowRootOutlet) this.AttributedTextManager.insertText(e,t) this.updateAttributedTextModel() this._focusTextarea() this._validateForm()}_playSound(e){m.Sound[e]&&this.sound.play(m.Sound[e])}_onSubmit(e){e.preventDefault() let t=null if(this.formIsAnimating)return w.Promise.resolve() if(this.isGaiDraftGenerated){var i,n if(this.showSendConfirmationModal){this.showSendConfirmationModal=!1 this.tracking.fireInteractionEvent(`${this.gaiInteractionTrackingPrefix}_gai_compose_send_without_edit`) t=d.aiMessageType.AI_GENERATED}else if(!this.isGaiDraftEdited){this.showSendConfirmationModal=!0 return w.Promise.reject()}null===(i=(n=this.args).onResetGaiFlow)||void 0===i||i.call(n) this.hasEnteredGaiFlow=!1 t=t??d.aiMessageType.AI_ASSISTED}this.viewData.isGroupChatWithAddParticipantFeature&&this._handleMentionToInvite() const s=this._constructAttributedBody(this.viewData.conversationUrn) let a if(this.args.isMessageEditForm)a=this.args.submitMessage(s) else{if(!this._validateForm())return w.Promise.reject() const e={message:s.text,conversationUrn:this.viewData.conversationUrn,contextByRecipients:this.args.contextByRecipients,attributedBody:s,attachments:(this.attachments??[]).filter((e=>!e.isError)),messageReplyType:this.viewData.messageReplyType,adapterOptions:this.args.msgAdapterOptions,isSystemClipboardUsed:this.isSystemClipboardUsed,aiMessageType:t},i=this.viewData.isReplyDisabled&&this.viewData.isInMail,n=this.viewData.isRecruiterInmail;(i||n)&&this._setupInmailResponseActionPayload(e) this.args.isInMailCompose&&(e.subject=this.subjectDisplay) this.args.smpContent&&(e.smpContent=this.args.smpContent) if(this.args.update){var r e.update={id:null===(r=this.args.update)||void 0===r?void 0:r.id,type:(0,S.classNameOf)(this.args.update)}}this.messageSendInProgress=!0 const o=!!this.args.conversation&&!!this.args.conversation.entityUrn if(o){this.formIsAnimating=!0 this.delayedReset=(0,b.runTask)(this,(()=>{this._resetForm(!0) this.messageSendInProgress=!1 this.formIsAnimating=!1 this._playSound(m.Sound.MessageSent)}),(0,b.getTimeoutOrTestFallback)(400))}e.attachments=this.attachments.map((e=>e.isVideo&&this.msgDataManager.isMessageVideoRecipeEnabled?{video:this._constructVideoAttachment(e)}:{file:this._constructfileAttachment(e)})) a=this.args.submitMessage(e).then((e=>{if(e&&this.isGaiDraftGenerated){var t,i,n,s,a,r this.tracking.fireTrackingPayload(d.PREMIUM_GAI_COMPOSE_TRACKING_KEYS.GAI_DRAFT_SUBMIT,{generatedMessageTrackingId:null===(t=this.args.gaiMessageAsyncData)||void 0===t||null===(i=t.value)||void 0===i||null===(n=i.message)||void 0===n||null===(s=n.messageData)||void 0===s?void 0:s.trackingId,messagingMessageUrn:null===(a=e.messages)||void 0===a||null===(r=a.at(0))||void 0===r?void 0:r.backendUrn})}if(!(0,c.isDestroying)(this)&&!o){if(!this.isDestroying){var l,u this.messageSendInProgress=!1 null===(l=(u=this.args).cancelDraftGeneration)||void 0===l||l.call(u)}this._playSound(m.Sound.MessageSent) this._resetForm(!0)}}))}this.messageSendRequest=(0,y.load)(a) return this.messageSendRequest}baseFormAfterInsert(){const e=this._getMessageTextEditor();(0,b.addEventListener)(this,this.formElement,"paste",(t=>{e&&e.contains(t.target)&&this._handlePasteEvent(t)}));(0,b.addEventListener)(this,this.formElement,"input",(t=>{e&&e.contains(t.target)&&this._onTextEditorChange(t)})) const t=""!==this.AttributedTextManager.getModel().text.trim() this.updateAttributedTextModel(t) this._validateForm()}onFocusOut(e){if(e.target.classList.contains("msg-form__contenteditable")){const e=this.AttributedTextManager.getCaretPosition(this._getMessageTextEditor(),this.interop.nileShadowRootOutlet) this._lastCursorPosition=e this.AttributedTextManager.updateModelCursorPosition(e.start)}}onFocusIn(e){if(e.target.classList.contains("msg-form__contenteditable")){const e=""!==this.AttributedTextManager.getModel().text.trim() this.updateAttributedTextModel(e)}const t=this._getMessageTextEditor() t.contains(e.target)&&this.AttributedTextManager.correctClickPosition(t,this.interop.nileShadowRootOutlet)}_constructAttributedBody(e){var t this.AttributedTextManager.removeMentionInProgress() const i=this.AttributedTextManager.getModel() let{attributes:n}=i n=e?(0,p.createMentionAttributesWithAttributedKind)(i,e):i.attributes.map((e=>{delete e.entity return e})) let s=(i.text??"").trim() null!==(t=this.args.mandatoryMessageAttachment)&&void 0!==t&&t.length&&(s=`${s}\n${this.args.mandatoryMessageAttachment}`) return{text:s,attributes:n}}getMentionedMembers(){return this.AttributedTextManager.getModel().attributes.filter((e=>{var t return e.urn&&(null===(t=this.mentionAll)||void 0===t?void 0:t.entityUrn)!==e.urn})).map((e=>this.AttributedTextManager.EntityMap[e.urn]))}onBeforeUpload(e){let{attachment:t,isPasteEvent:i}=e this.args.beforeUpload({attachment:t,isPasteEvent:i}) this.disableForm()}updateTextarea(e){let{body:t}=e this._updateTextarea(t)}clearAndUpdateTextArea(e){let{body:t}=e this.AttributedTextManager.resetModel() this._updateTextarea(t)}updateTextareaWithEmoji(e){let{body:t,triggerData:i}=e this.updateMessageComposeService.triggerUpdateMessageCompose({bubbleId:i.bubbleId,isOverlay:this.args.isOverlay,messageText:t}) this._updateDraftMessageForConversation(this.viewData.conversationUrn,this.AttributedTextManager.getModel())}focusComposeAfterEmojiPickerClose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{} this.updateMessageComposeService.triggerFocusMessageCompose({bubbleId:e.bubbleId,isOverlay:this.args.isOverlay})}disableForm(){this.isValidForm=!1}handleGIFSend(e){this.messageSendRequest=(0,y.load)(this.args.sendGif(this._constructExternalMedia(e)).then((()=>{this.isDestroying||this._toggleExpandComposeField(!1)}))) return this.messageSendRequest.then((()=>{this.isDestroying||this._playSound(m.Sound.MessageSent)}))}handleAttachmentDropError(e){this.attachmentDropErrorType=e this._toggleExpandComposeField(!1)}dismissAttachmentDropError(){this.attachmentDropErrorType=""}onValidateForm(){this._validateForm()}onAttachmentAdded(){this._attachmentAdded()}afterDragAndDropUpload(){this._attachmentAdded() this._focusTextarea()}focusTextarea(){this._focusTextarea()}addAttachment(e){this._addAttachment(e)}removeAttachment(e){this.attachments.splice(this.attachments.findIndex((t=>t===e)),1) const t=this.renderContent.filter((t=>t.file.assetUrn===e.id));(0,ie.removeValue)(this.renderContent,t[0]) this._validateForm()}overridePlaceholderValue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null this._overridePlaceholder=e}onMentionsPickerKeyDown(e){if(!this.showMentionsPicker)return e.preventDefault() const{keyCode:t}=e switch(t){case at:this._closeMentionsDropdownUI() this._focusTextarea() e.stopPropagation() break case lt:this._arrowThroughDropdown(e,!1) break case ot:this._arrowThroughDropdown(e,!0) break case nt:this._arrowThroughDropdown(e,e.shiftKey)}}onTextEditorKeyDown(e){if(this.messageSendInProgress){(0,b.cancelTask)(this,this.delayedReset) this._resetForm(!0) this.messageSendInProgress=!1 this.formIsAnimating=!1}const{keyCode:t,shiftKey:i,ctrlKey:n,metaKey:s}=e,a=this._getMessageTextEditor(),r=this.AttributedTextManager.getCaretPosition(a,this.interop.nileShadowRootOutlet) switch(t){case dt:if(n||s){e.preventDefault() this.AttributedTextManager.handleUndoRedo(e) this.updateAttributedTextModel()}break case at:if(this.showMentionsPicker){this._closeMentionsDropdownUI() this._focusTextarea() e.stopPropagation()}break case lt:this.showMentionsPicker&&this._arrowThroughDropdown(e,!1) break case ot:this.showMentionsPicker&&this._arrowThroughDropdown(e,!0) break case nt:this.showMentionsPicker&&this._arrowThroughDropdown(e,i) break case st:if(this.showMentionsPicker&&this._getCurrentMentionValue()){var o,l,d,c,u const t=this.showMentionAllOption?this.mentionAll:(null===(o=this.conversationMentions)||void 0===o||null===(l=o[0])||void 0===l?void 0:l.editorAttribute)||(null===(d=this.viewData)||void 0===d||null===(c=d.connectionMentions)||void 0===c||null===(u=c[0])||void 0===u?void 0:u.editorAttribute) if(t){e.stopPropagation() e.preventDefault() this._selectAndAddMention(t) this._closeMentionsDropdownUI() break}}if(e.target!==a)break if(this.shouldSubmitMessage(e)){this._onSubmit(e) break}e.preventDefault() this.AttributedTextManager.insertText("\n",r) this.updateAttributedTextModel() this._scrollToCaretPosition()}}selectMentionWithKeyDown(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{} if(t.keyCode===st||t.keyCode===rt){t.stopPropagation() t.preventDefault() this._selectAndAddMention(e)}}selectMention(e){this._selectAndAddMention(e)}closeMentions(){this._closeMentionsDropdownUI()}triggerDragAndDropLayer(e){this.showDragAndDropUserEducationLayer=e}_selectAndAddMention(e){this.tracking.fireInteractionEvent(it,"SHORT_PRESS") this.AttributedTextManager.removeMentionInProgress() this.AttributedTextManager.insertAttribute(e) this.updateAttributedTextModel(!0,!0) this._closeMentionsDropdownUI()}_getMessageTextEditor(){return this.formElement.querySelector(".msg-form__contenteditable")}_getComposeScrollableArea(){return this.formElement.querySelector(".msg-form__msg-content-container--scrollable")}_focusTextarea(){const e=this._getMessageTextEditor() ""!==this.AttributedTextManager.getModel().text.trim()&&this.setCaretPosition() e&&e.focus()}_resetForm(e){let t,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1] t=e?"":(0,n.default)(this,et,mt).call(this) this.isValidForm=!1 this.attachments=new l.TrackedArray([]) this.renderContent=[] this._closeMentionsDropdownUI() this.AttributedTextManager.resetModel() this._lastCursorPosition=null t&&this.AttributedTextManager.insertText(t,{start:0,end:0}) this.formElement&&this.updateAttributedTextModel() this.attachmentDropErrorType="" this._overridePlaceholder=null i&&this._toggleExpandComposeField(!1) this.isSystemClipboardUsed=!1}_validateForm(){var e const t=this.attachments||new l.TrackedArray([]),i=t.filter((e=>{let{isUploading:t,isError:i}=e return t||i})),n=null===(e=this.attributedTextModel)||void 0===e?void 0:e.text if((null==n?void 0:n.length)>=8e3){this.isValidForm=!1 this.isOverCharLimit=!0 return!1}this.isOverCharLimit=!1 let s=((0,A.isPresent)(n)||!this.args.isInMailCompose&&(t.length>0||this.args.update||this.args.forwardedEvent))&&0===i.length this.args.validateForm&&(s=s&&this.args.validateForm(n)) const a=this.args.externallyValid;(0,A.isPresent)(a)&&(s=s&&a) this.isValidForm=s return!this.hasNewConversationMessageInFlight&&!!s}_setupInmailResponseActionPayload(e){const{isInMail:t,inmailProductType:i}=this.viewData e.inMailResponseAction=!t||"RECRUITER"!==i&&"SALES"!==i?"ACCEPT":"NONE"}_handlePasteEvent(e){let{clipboardData:t}=e if(t){const{files:i}=t this.isSystemClipboardUsed=!0 if(i&&i.length&&t.types&&t.types.length<3&&t.types.includes("Files")){e.preventDefault() if(this.args.hasResharedContent||this.args.isMessageRequestCompose)return const[t]=i t.type.match(/image/)&&this.attachmentsHandler.uploadAttachment(t,!0) return}}e.preventDefault() t&&t.getData?t=t.getData("text/plain"):k.default&&(t=window.clipboardData.getData("Text")) const i=t.replace(/(\r\n|\n\r|\r)/g,"\n"),n=this.AttributedTextManager.getCaretPosition(this._getMessageTextEditor(),this.interop.nileShadowRootOutlet) this.AttributedTextManager.insertText(i,n) this.updateAttributedTextModel() this._updateDraftMessageForConversation(this.viewData.conversationUrn,this.AttributedTextManager.getModel()) this._validateForm()}_onTextEditorChange(){const e=this._getMessageTextEditor() this.AttributedTextManager.updateModelFromHTML(e,this.interop.nileShadowRootOutlet) this.updateAttributedTextModel() if(""===this.AttributedTextManager.getModel().text.trim()){var t,i,n,s if(null!==(t=this.args.gaiMessageAsyncData)&&void 0!==t&&t.value){var a,r null===(a=(r=this.args).onResetGaiFlow)||void 0===a||a.call(r)}null!==(i=this.args.gaiIntentsAsyncData)&&void 0!==i&&null!==(n=i.value)&&void 0!==n&&null!==(s=n.intents)&&void 0!==s&&s.length||(this.hasEnteredGaiFlow=!1)}if(this.isPrefilledFromEntryPointOrTemplate&&""===this.AttributedTextManager.getModel().text.trim()){this.isPrefilledFromEntryPointOrTemplate=!1 this.clientSensor.incrementMetricCounter({metricName:"clear-templates",groupName:"messaging"})}this._updateDraftMessageForConversation(this.viewData.conversationUrn,this.AttributedTextManager.getModel()) this._triggerMentionDropdown();(0,b.debounceTask)(this,"_validateForm",(0,b.getTimeoutOrTestFallback)(150))}updateAttributedTextModel(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1] const i=this.AttributedTextManager.getModel() this.attributedTextModel=i t&&this._updateDraftMessageForConversation(this.viewData.conversationUrn,i) if(this.AttributedTextManager.didAttributesChange){const t=this._getMessageTextEditor(),i=this.AttributedTextManager.createHTMLFromModel() jSecure.setElementContent(t,i) e&&this.setCaretPosition()}}setCaretPosition(e){const t=this.AttributedTextManager.getModel(),i=this._getMessageTextEditor() this.AttributedTextManager.setCaretPosition(e||t.cursor,i,this.interop.nileShadowRootOutlet)}_arrowThroughDropdown(e,t){e.stopPropagation() e.preventDefault() const i=this.formElement.querySelector("[data-mentions-picker]"),n=this.formElement.querySelectorAll("[data-mentions-picker-option]"),s=this.formElement.querySelector("[data-mentions-picker-option]:focus") let a if(s){a=Array.from(n).indexOf(s) a=t?--a:++a}else a=t?n.length-1:1 if(n[a]&&a>0){n[a].focus() this.isTabbingThroughMentions=!0}else{i.scrollTop=0 this._focusTextarea() this.isTabbingThroughMentions=!1}}_getCurrentMentionValue(){const e=this.AttributedTextManager.getCaretPosition(this._getMessageTextEditor(),this.interop.nileShadowRootOutlet) return(this.AttributedTextManager.getTextBeforeCursor(e).match(ct)||[])[1]||""}_getCurrentMentionQuery(){return this._getCurrentMentionValue().substr(1).trim()}_triggerMentionDropdown(){const{start:e,end:t}=this.AttributedTextManager.getCaretPosition(this._getMessageTextEditor(),this.interop.nileShadowRootOutlet) if(t!==e||this.AttributedTextManager.mentionAtPosition(t))return const i=this._getCurrentMentionValue() if((0,A.isPresent)(i)){const e=t-i.length,n=this._getCurrentMentionQuery() this._fetchConversationMentions(n,{start:e,end:t}) if(n){const i=O.default.testing?0:100;(0,b.debounceTask)(this,"_fetchConnectionMentions",n,{start:e,end:t},i)}else this.tracking.fireInteractionEvent(tt,"KEYBOARD_SUBMIT") this.AttributedTextManager.removeMentionInProgress() this.AttributedTextManager.insertAttribute({mentionInProgress:!0,match:{start:e,length:i.length,text:i},tokenSelection:{start:e,end:t}}) this._setMentionsDropdownPosition()}else this._closeMentionsDropdownUI() this.updateAttributedTextModel()}_getMentionsEntityByAttributeChunk(e){const t=this.viewData.conversationParticipants,{entityUrn:i}=e,n=t.find((e=>{var t return(null===(t=e.entity)||void 0===t?void 0:t.entityUrn)===i})) return(null==n?void 0:n.entity)||void 0}_fetchConversationMentions(e,t){const i=this.viewData.conversationParticipants.filter((t=>t.fullName.toLowerCase().indexOf(e.toLowerCase())>=0)).map(((e,i)=>{const{profile:n,fullName:s,entity:a}=e,r=`@${s}` return{mentionedMemberProfile:n,editorAttribute:{index:i,tokenSelection:t,entity:a,entityUrn:a.entityUrn,match:{start:t.start,length:r.length,text:r}}}})),n=this.i18n.lookupTranslation("components/msg-ui@msg-form/base-form-feature","i18n_mention_all")() if(this._shouldShowMentionAllOption(e,n)){const e=this._createMentionAllEntity(t,n) this.mentionAll=e this.showMentionAllOption=!0}else this.showMentionAllOption=!1 this.conversationMentions=i}refreshGaiMessage(e){var t,i,n e&&"function"==typeof e.preventDefault&&e.preventDefault() ""!==(null===(t=this.AttributedTextManager)||void 0===t?void 0:t.getModel().text.trim())&&this.isGaiDraftEdited?this.isGaiOverwriteConfirmationModalOpen=!0:null===(i=(n=this.args).refreshGaiMessage)||void 0===i||i.call(n)}confirmRefetchGaiSuggestion(){var e,t this._resetForm() null===(e=(t=this.args).refreshGaiMessage)||void 0===e||e.call(t) this.tracking.fireInteractionEvent(`${this.gaiInteractionTrackingPrefix}_gai_confirm_edit_draft`) this.isGaiOverwriteConfirmationModalOpen=!1}handleSubjectUpdate(){var e,t const i=null===(e=this.args.conversation)||void 0===e||null===(t=e.draftMessage)||void 0===t?void 0:t.subject void 0!==i&&this.subjectDisplay!==i&&this._updateDraftMessageForConversation(this.viewData.conversationUrn,this.AttributedTextManager.getModel())}handlePrefilledMessageUpdate(){var e if(!this.currentInputText&&null!==(e=this.args.prefilledMessage)&&void 0!==e&&e.length&&this.args.prefilledMessage!==this.currentInputText){var t,i this._updateTextarea(this.args.prefilledMessage) null!==(t=this.args.conversation.draftMessage)&&void 0!==t&&null!==(i=t.content)&&void 0!==i&&i.text?this.isPrefilledFromEntryPointOrTemplate=!1:this.isPrefilledFromEntryPointOrTemplate=!0}}handleGaiMessageAsyncDataUpdate(){var e,t const{messageData:i}=(null===(e=this.args.gaiMessageAsyncData)||void 0===e||null===(t=e.value)||void 0===t?void 0:t.message)??{} if(i){this._resetForm(!0,!1) this.AttributedTextManager.insertText(i.body,0) this.updateAttributedTextModel(!0,!0) if(i.subject){var n,s null===(n=(s=this.args).updateGeneratedSubject)||void 0===n||n.call(s,i.subject)}this._validateForm()}}_createMentionAllEntity(e,t){const i=this.viewData.conversationUrn,n={firstName:t,lastName:"",entityUrn:i} return E.default.create({tokenSelection:e,entity:n,entityUrn:i,match:{length:t.length+1,start:e.start,text:`@${t}`}})}_shouldShowMentionAllOption(e,t){return this.viewData.isGroupChat&&t.toLowerCase().includes(e.toLowerCase())}_fetchConnectionMentions(e,t){return this.msgDataManager.fetchTypeaheadResults(e,void 0,te.VOYAGER_MESSAGING_DEGRADATION_METADATA.MENTIONS).then((i=>{this.isDestroying||e===this._getCurrentMentionQuery()&&(this.connectionMentionData={typeaheadResultsViewData:i.map((e=>new u.default({possibleRecipient:e,formatter:this.formatter}))),tokenSelection:t})}))}_closeMentionsDropdownUI(){if(this.showMentionsPicker){this.AttributedTextManager.removeMentionInProgress() this.mentionsTopPosition=!1 this.connectionMentionData=null this.conversationMentions=[] this.isTabbingThroughMentions=!1}}_setMentionsDropdownPosition(){if(!k.default)return if(!this.args.composeIsFullyExpanded){const e=this.formElement.offsetHeight this.mentionsTopPosition=`bottom: ${e}px` return}const e=this._getCaretParentOffsets() if(e){const t=20,i=this.formElement.querySelector(".msg-form__footer").offsetHeight,{scrollTop:n,offsetHeight:s}=this._getMessageTextEditor(),{caretParentOffsetTop:a,caretParentOffsetHeight:r}=e let o=Math.round(r+a+4-n) o+=this.formElement.offsetTop let l="auto" if(o>130){l=`${Math.round(s-a-r+i+t+n+4)}px` o="auto"}else o=`${o}px` this.mentionsTopPosition=`top: ${o}; bottom: ${l};`}}_scrollToCaretPosition(){const e=this._getCaretParentOffsets() if(e){const{caretParentOffsetTop:t,caretParentOffsetHeight:i}=e,n=t+i,s=this._getComposeScrollableArea(),{scrollTop:a,offsetHeight:r}=s n>a+r?s.scrollTop=n-r:t0){const e=i.getSelection().getRangeAt(0),{offsetTop:t,offsetHeight:n}=e.commonAncestorContainer.parentNode return{caretParentOffsetTop:t,caretParentOffsetHeight:n}}}}setEnterToSendSetting(e){return this.messagingUserSettings.saveEnterToSendSetting(e)}_handleMentionToInvite(){const e=this.getMentionedMembers() if(!e||!this.args.conversation)return const t=(0,f.getMembersToInviteByParticipants)(e,this.viewData.conversationParticipants);(0,A.isEmpty)(t)||(this.membersToInvite=t)}onMentionToInviteDismiss(){this.focusTextarea() this.membersToInvite=null}get viewData(){return new g.default({msgDataManager:this.msgDataManager,conversation:this.args.conversation,participants:this.msgDataManager.mailboxParticipants,formatter:this.formatter,conversationMentions:this.conversationMentions,connectionMentionData:this.connectionMentionData,forwardedMessage:this.args.forwardedEvent,i18n:this.i18n,presenceAPI:this.presenceAPI,recipients:this.args.messageRecipients})}get showMentionsPicker(){return this.conversationMentions.length||this.viewData.connectionMentions.length}handleGaiModuleVisibilityChanged(e){this.isGaiModuleVisible=e}handleGaiEntryPointClick(){var e,t,i,n,s,a if(null!==(e=this.args.gaiIntentsAsyncData)&&void 0!==e&&null!==(t=e.value)&&void 0!==t&&null!==(i=t.intents)&&void 0!==i&&i.length||null!==(n=this.args.gaiRefinementOptionsAsyncData)&&void 0!==n&&null!==(s=n.value)&&void 0!==s&&null!==(a=s.refinementOptions)&&void 0!==a&&a.length){var r,o this.hasEnteredGaiFlow=!0 null===(r=(o=this.args).onEnterGaiFlow)||void 0===r||r.call(o)}}handleDismissGaiModule(){this.hasEnteredGaiFlow=!1}}),ve=(0,s.default)(ye.prototype,"i18n",[ne],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_e=(0,s.default)(ye.prototype,"jet",[se],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),we=(0,s.default)(ye.prototype,"lix",[ae],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Me=(0,s.default)(ye.prototype,"msgDataManager",[re],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ke=(0,s.default)(ye.prototype,"tracking",[oe],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Te=(0,s.default)(ye.prototype,"formatter",[le],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),De=(0,s.default)(ye.prototype,"vectorMediaUpload",[de],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Se=(0,s.default)(ye.prototype,"updateMessageComposeService",[ce],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xe=(0,s.default)(ye.prototype,"messagingUserSettings",[ue],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ce=(0,s.default)(ye.prototype,"sound",[me],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Pe=(0,s.default)(ye.prototype,"presenceAPI",[pe],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ie=(0,s.default)(ye.prototype,"clientSensor",[ge],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ee=(0,s.default)(ye.prototype,"interop",[he],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ae=(0,s.default)(ye.prototype,"attributedTextModel",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Oe=(0,s.default)(ye.prototype,"showSendConfirmationModal",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Re=(0,s.default)(ye.prototype,"isGaiOverwriteConfirmationModalOpen",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Ue=(0,s.default)(ye.prototype,"mentionsTopPosition",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Ne=(0,s.default)(ye.prototype,"messageSendRequest",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),je=(0,s.default)(ye.prototype,"isTabbingThroughMentions",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Fe=(0,s.default)(ye.prototype,"isValidForm",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ze=(0,s.default)(ye.prototype,"isOverCharLimit",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Le=(0,s.default)(ye.prototype,"conversationMentions",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ge=(0,s.default)(ye.prototype,"connectionMentionData",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Be=(0,s.default)(ye.prototype,"showMentionAllOption",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Ve=(0,s.default)(ye.prototype,"showDragAndDropUserEducationLayer",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),He=(0,s.default)(ye.prototype,"attachmentDropErrorType",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),qe=(0,s.default)(ye.prototype,"attachments",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new l.TrackedArray([])}}),We=(0,s.default)(ye.prototype,"messageSendInProgress",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ke=(0,s.default)(ye.prototype,"membersToInvite",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ye=(0,s.default)(ye.prototype,"mentionAll",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),$e=(0,s.default)(ye.prototype,"isSystemClipboardUsed",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Qe=(0,s.default)(ye.prototype,"isPrefilledFromEntryPointOrTemplate",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),(0,s.default)(ye.prototype,"onClick",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onClick"),ye.prototype),(0,s.default)(ye.prototype,"onChange",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onChange"),ye.prototype),(0,s.default)(ye.prototype,"onSubmit",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onSubmit"),ye.prototype),(0,s.default)(ye.prototype,"onReSubmit",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onReSubmit"),ye.prototype),(0,s.default)(ye.prototype,"checkForReset",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"checkForReset"),ye.prototype),(0,s.default)(ye.prototype,"updateMessageComposeFromService",[fe],Object.getOwnPropertyDescriptor(ye.prototype,"updateMessageComposeFromService"),ye.prototype),(0,s.default)(ye.prototype,"focusMessageComposeFromService",[be],Object.getOwnPropertyDescriptor(ye.prototype,"focusMessageComposeFromService"),ye.prototype),(0,s.default)(ye.prototype,"baseFormAfterInsert",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"baseFormAfterInsert"),ye.prototype),(0,s.default)(ye.prototype,"onFocusOut",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onFocusOut"),ye.prototype),(0,s.default)(ye.prototype,"onFocusIn",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onFocusIn"),ye.prototype),(0,s.default)(ye.prototype,"onBeforeUpload",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onBeforeUpload"),ye.prototype),(0,s.default)(ye.prototype,"updateTextarea",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"updateTextarea"),ye.prototype),(0,s.default)(ye.prototype,"clearAndUpdateTextArea",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"clearAndUpdateTextArea"),ye.prototype),(0,s.default)(ye.prototype,"updateTextareaWithEmoji",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"updateTextareaWithEmoji"),ye.prototype),(0,s.default)(ye.prototype,"focusComposeAfterEmojiPickerClose",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"focusComposeAfterEmojiPickerClose"),ye.prototype),(0,s.default)(ye.prototype,"handleGIFSend",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleGIFSend"),ye.prototype),(0,s.default)(ye.prototype,"handleAttachmentDropError",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleAttachmentDropError"),ye.prototype),(0,s.default)(ye.prototype,"dismissAttachmentDropError",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"dismissAttachmentDropError"),ye.prototype),(0,s.default)(ye.prototype,"onValidateForm",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onValidateForm"),ye.prototype),(0,s.default)(ye.prototype,"onAttachmentAdded",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onAttachmentAdded"),ye.prototype),(0,s.default)(ye.prototype,"afterDragAndDropUpload",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"afterDragAndDropUpload"),ye.prototype),(0,s.default)(ye.prototype,"focusTextarea",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"focusTextarea"),ye.prototype),(0,s.default)(ye.prototype,"addAttachment",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"addAttachment"),ye.prototype),(0,s.default)(ye.prototype,"removeAttachment",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"removeAttachment"),ye.prototype),(0,s.default)(ye.prototype,"overridePlaceholderValue",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"overridePlaceholderValue"),ye.prototype),(0,s.default)(ye.prototype,"onMentionsPickerKeyDown",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onMentionsPickerKeyDown"),ye.prototype),(0,s.default)(ye.prototype,"onTextEditorKeyDown",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onTextEditorKeyDown"),ye.prototype),(0,s.default)(ye.prototype,"selectMentionWithKeyDown",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"selectMentionWithKeyDown"),ye.prototype),(0,s.default)(ye.prototype,"selectMention",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"selectMention"),ye.prototype),(0,s.default)(ye.prototype,"closeMentions",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"closeMentions"),ye.prototype),(0,s.default)(ye.prototype,"triggerDragAndDropLayer",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"triggerDragAndDropLayer"),ye.prototype),(0,s.default)(ye.prototype,"refreshGaiMessage",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"refreshGaiMessage"),ye.prototype),(0,s.default)(ye.prototype,"confirmRefetchGaiSuggestion",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"confirmRefetchGaiSuggestion"),ye.prototype),(0,s.default)(ye.prototype,"handleSubjectUpdate",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleSubjectUpdate"),ye.prototype),(0,s.default)(ye.prototype,"handlePrefilledMessageUpdate",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handlePrefilledMessageUpdate"),ye.prototype),(0,s.default)(ye.prototype,"handleGaiMessageAsyncDataUpdate",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleGaiMessageAsyncDataUpdate"),ye.prototype),(0,s.default)(ye.prototype,"setEnterToSendSetting",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"setEnterToSendSetting"),ye.prototype),(0,s.default)(ye.prototype,"onMentionToInviteDismiss",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"onMentionToInviteDismiss"),ye.prototype),(0,s.default)(ye.prototype,"viewData",[h.cached],Object.getOwnPropertyDescriptor(ye.prototype,"viewData"),ye.prototype),(0,s.default)(ye.prototype,"handleGaiModuleVisibilityChanged",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleGaiModuleVisibilityChanged"),ye.prototype),(0,s.default)(ye.prototype,"handleGaiEntryPointClick",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleGaiEntryPointClick"),ye.prototype),(0,s.default)(ye.prototype,"handleDismissGaiModule",[E.action],Object.getOwnPropertyDescriptor(ye.prototype,"handleDismissGaiModule"),ye.prototype),Je=(0,s.default)(ye.prototype,"isGaiModuleVisible",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Xe=(0,s.default)(ye.prototype,"hasEnteredGaiFlow",[C.tracked],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ye)) function ut(e){const t=`${e}::${this.args.messageComposeFlowTrackingId}` if(!this.conversationUrnsThatTriggeredMCSE.has(t)){var i this.conversationUrnsThatTriggeredMCSE.add(t) let s=null if(null!==(i=this.args.messageRecipients)&&void 0!==i&&i.length){var n s={urns:null===(n=this.args.messageRecipients)||void 0===n?void 0:n.map((e=>e.dashEntityUrn??e.entityUrn))}}const a={messageComposeFlowTrackingId:this.args.messageComposeFlowTrackingId,conversationUrn:e} s&&(a.recipientUrns=s) this.tracking.fireTrackingPayload("MessengerComposeStartEvent",a)}}function mt(){var e const{conversation:t,prefilledMessage:i}=this.args if(this.isGaiDraftGenerated)return"" if(i){this.isPrefilledFromEntryPointOrTemplate=!0 return(null==i?void 0:i.string)||i}if(t&&null!==(e=this.args.conversationTrackedAsyncData)&&void 0!==e&&e.isResolved){var n return null===(n=t.draftMessage)||void 0===n?void 0:n.content.text}return""}})) define("msg-ui/components/msg-form/primitives/character-limit-banner",["exports","@ember/template-factory","@ember/component/template-only","@ember/component","artdeco-inline-feedback/components/artdeco-inline-feedback","ember-cli-pemberly-i18n/helpers/t"],(function(e,t,i,n,s,a){"use strict" Object.defineProperty(e,"__esModule",{value:!0}) e.default=void 0 const r=(0,n.setComponentTemplate)((0,t.createTemplateFactory)({id:"kV1s+vDL",block:'[[[1,"\\n"],[1,"\\n"],[1," "],[8,[32,0],[[16,0,[29,["msg-character-limit-banner ph1 pv2\\n ",[52,[30,1],"msg-character-limit-banner__edit-form"]]]]],[["@message","@type"],[[28,[32,1],["i18n_character_limit_warning","msg-ui/components/msg-form/primitives/character-limit-banner"],null],"yield"]],null],[1,"\\n"]],["@isEditForm"],false,["if"]]',moduleName:"msg-ui/components/msg-form/primitives/character-limit-banner.gjs",scope:()=>[s.default,a.default],isStrictMode:!0}),(0,i.default)("character-limit-banner","CharacterLimitBanner")) e.default=r})) define("msg-ui/components/msg-form/primitives/message-texteditor-presenter",["exports","@ember/template-factory","@babel/runtime/helpers/esm/defineProperty","@babel/runtime/helpers/esm/applyDecoratedDescriptor","@ember/component","ember-cli-pemberly-i18n/helpers/t","global-helpers/helpers/or","@glimmer/component","msg-ui/components/messaging-gai/gai-draft-intents-feedback-panel","msg-ui/modifiers/update-position-top-from-sibling-content","msg-ui/components/messaging-gai/gai-skeleton-loader","@ember/modifier","global-modifiers/modifiers/focus","@ember/helper","@ember/object/internals","tracked-built-ins","@ember/object"],(function(e,t,i,n,s,a,r,o,l,d,c,u,m,p,g,h,f){"use strict" Object.defineProperty(e,"__esModule",{value:!0}) e.default=void 0 var b let y=(b=class extends o.default{constructor(){super(...arguments);(0,i.default)(this,"guid",(0,g.guidFor)(this));(0,i.default)(this,"gaiFeedbackTrackingIdUsed",new h.TrackedSet)}get hasGaiMessage(){var e,t,i,n const{currentInputText:s}=this.args return(null===(e=this.args.gaiMessageAsyncData)||void 0===e||null===(t=e.value)||void 0===t||null===(i=t.message)||void 0===i||null===(n=i.messageData)||void 0===n?void 0:n.body)&&s}get canProvideGaiFeedback(){return this.gaiFeedbackTrackingId&&!this.gaiFeedbackTrackingIdUsed.has(this.gaiFeedbackTrackingId)}get gaiFeedbackTrackingId(){var e,t,i,n return null===(e=this.args.gaiMessageAsyncData)||void 0===e||null===(t=e.value)||void 0===t||null===(i=t.message)||void 0===i||null===(n=i.messageData)||void 0===n?void 0:n.trackingId}handleGaiFeedbackProvided(){this.gaiFeedbackTrackingId&&this.gaiFeedbackTrackingIdUsed.add(this.gaiFeedbackTrackingId)}get isLoadingGaiMessage(){var e return null===(e=this.args.gaiMessageAsyncData)||void 0===e?void 0:e.isPending}},(0,n.default)(b.prototype,"handleGaiFeedbackProvided",[f.action],Object.getOwnPropertyDescriptor(b.prototype,"handleGaiFeedbackProvided"),b.prototype),b);(0,s.setComponentTemplate)((0,t.createTemplateFactory)({id:"VTgRx3in",block:'[[[1,"\\n"],[1," "],[10,0],[14,0,"flex-grow-1 relative"],[12],[1,"\\n"],[41,[30,0,["isLoadingGaiMessage"]],[[[1," "],[8,[32,0],[[24,0,"mb1"]],[["@onCancel","@isInMailCompose","@promptText","@recipientName"],[[30,1],[30,2],[30,3],[30,4]]],null],[1,"\\n"]],[]],null],[1,"\\n "],[11,0],[16,0,[29,["msg-form__contenteditable t-14 t-black--light t-normal flex-grow-1 full-height notranslate\\n ",[52,[30,5],"msg-form__contenteditable--slide-out"],"\\n ",[52,[30,0,["isLoadingGaiMessage"]],"msg-form__contenteditable--hidden"],"\\n ",[52,[30,0,["hasGaiMessage"]],[28,[32,1],["msg-form__gai-contenteditable-",[30,0,["guid"]]],null]]]]],[24,"contenteditable","true"],[24,"role","textbox"],[24,"dir","auto"],[24,"aria-multiline","true"],[16,"aria-placeholder",[30,6]],[16,"aria-label",[28,[32,2],["i18n_write_a_message","msg-ui/components/msg-form/primitives/message-texteditor-presenter"],null]],[4,[32,3],null,[["when"],[[28,[32,4],[[30,7],false],null]]]],[4,[32,5],["blur",[30,8]],null],[4,[32,5],["focus",[30,9]],null],[12],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["hasGaiMessage"]],[[[1," "],[8,[32,6],[[4,[32,7],null,[["siblingSelector","pixelOffset"],[".msg-form__contenteditable",12]]]],[["@trackingId","@canProvideFeedback","@onThumbsUpClick","@onSurveyFormSubmit","@isInMailCompose","@refreshDraft","@onUndo","@canUndo","@canRefresh","@onSubmitReturnFocusTo"],[[30,0,["gaiFeedbackTrackingId"]],[30,0,["canProvideGaiFeedback"]],[30,0,["handleGaiFeedbackProvided"]],[30,0,["handleGaiFeedbackProvided"]],[30,2],[30,10],[30,11],[30,12],[30,13],[28,[32,1],[".msg-form__gai-contenteditable-",[30,0,["guid"]]],null]]],null],[1,"\\n"]],[]],null],[1,"\\n "],[10,0],[14,"aria-hidden","true"],[15,0,[29,[[52,[30,14],"msg-form__placeholder"],"\\n t-14 t-black--light t-normal"]]],[15,"data-placeholder",[52,[30,15],[30,15],[28,[32,2],["i18n_write_a_message","msg-ui/components/msg-form/primitives/message-texteditor-presenter"],null]]],[12],[1,"\\n "],[13],[1,"\\n\\n "],[13],[1,"\\n "]],["@onCancelGaiMessageGeneration","@isInMailCompose","@gaiLoaderPromptText","@gaiLoaderRecipientName","@messageSendInProgress","@labelText","@focusInput","@parentBlurAction","@parentFocusAction","@refreshDraft","@onUndoGaiMessage","@canUndoGaiMessage","@canRefreshGaiMessage","@showPlaceholder","@overridePlaceholder"],false,["if"]]',moduleName:"msg-ui/components/msg-form/primitives/message-texteditor-presenter.gjs",scope:()=>[c.default,p.concat,a.default,m.default,r.default,u.on,l.default,d.default],isStrictMode:!0}),y) e.default=y})) define("msg-ui/components/msg-form/primitives/msg-content-container-presenter",["exports","@babel/runtime/helpers/esm/initializerDefineProperty","@babel/runtime/helpers/esm/defineProperty","@babel/runtime/helpers/esm/applyDecoratedDescriptor","@babel/runtime/helpers/esm/initializerWarningHelper","@ember/template-factory","@ember/component","@ember/object","ember-lifeline","@glimmer/tracking","@glimmer/component","@ember/modifier","global-helpers/helpers/optional","msg-ui/components/msg-form/primitives/message-texteditor-presenter","@ember/helper","artdeco-button/components/artdeco-button","ember-cli-pemberly-i18n/helpers/t","ember-cli-pemberly-tracking/modifiers/track-interaction","msg-ui/components/forwarded-message-presenter","marketplace-message-card/components/marketplace-message-card","update-components/components/mini-update-v2","msg-ui/components/messaging-gai/gai-inline-module","global-helpers/helpers/not"],(function(e,t,i,n,s,a,r,o,l,d,c,u,m,p,g,h,f,b,y,v,_,w,M){"use strict" Object.defineProperty(e,"__esModule",{value:!0}) e.default=void 0 var k,T e.default=(0,r.setComponentTemplate)((0,a.createTemplateFactory)({id:"XoMcXmIN",block:'[[[1,"\\n"],[1," "],[11,0],[16,0,[29,["msg-form__msg-content-container\\n ",[52,[30,1,["update"]],"msg-form__msg-content-container--has-reshare"],"\\n ",[52,[30,0,["isActive"]],"msg-form__msg-content-container--is-active"],"\\n ",[52,[30,2],"msg-form__msg-content-container--with-gai-perm-entry"]]]],[17,3],[4,[32,0],["keydown",[30,4]],null],[4,[32,0],["focusin",[28,[32,1],[[30,5]],null]],null],[12],[1,"\\n"],[1," "],[10,0],[15,0,[29,["msg-form__msg-content-container--scrollable scrollable\\n ",[52,[30,2],"msg-form__msg-content-container--inmail"],"\\n relative"]]],[12],[1,"\\n "],[8,[32,2],null,[["@addTopBorder","@classNames","@overridePlaceholder","@parentBlurAction","@parentFocusAction","@showPlaceholder","@messageSendInProgress","@refreshDraft","@isInMailCompose","@gaiMessageAsyncData","@currentInputText","@gaiLoaderPromptText","@gaiLoaderRecipientName","@onUndoGaiMessage","@canUndoGaiMessage","@canRefreshGaiMessage","@focusInput"],[true,"msg-form__message-texteditor relative flex-grow-1 display-flex",[30,6],[28,[32,3],[[30,0,["setIsActive"]],false],null],[30,0,["parentFocusAction"]],[30,7],[30,8],[30,9],[30,2],[30,10],[30,11],[30,12],[30,13],[30,14],[30,15],[