function onReplyDialogOpen() {
	setTimeout(() => {
		let main = document.querySelector('main[role="main"]');
		let replyBtn;

		if (main) {
			replyBtn = main.querySelector('div[data-testid="tweetButton"]');
			let width = main.offsetWidth;
			// let ele = document.createElement('div');
			// ele.innerText = 'Tag 3 friends to complete the task';
			// ele.style.cssText = `width: ${width}px; height: 38px; color: #fff; font-weight: 600;
			// font-size: 16px; display: flex; align-items: center; justify-content: center; background: #1D9BF0;
			// opacity: 0.8; position: absolute; top: 0px; left: 50%; transform: translateX(-50%); z-index: 1000`;

			// main.appendChild(ele);
		}

		if (main && replyBtn) {
			console.log('main && replyBtn ...');
			replyBtn.addEventListener('click', function () {
				let content = main.querySelector(
					'textarea[data-testid]',
				).textContent;
				console.log('comtent...', content);
				const len = content.split('@').length;
				if (len && len - 1 >= 3) {
					window.ReactNativeWebView.postMessage(
						JSON.stringify({
							actionType: 'commentSuccess',
						}),
					);
					// fetchAddFinishEvent({
					//     eventType: params.type,
					//     luckdropId: params.taskLuckdropId,
					// }).then(res => {
					//     if (res.code == 0) {
					//         cb && cb();
					//     }
					// });
				}
				// reportReplyResult(eleList, params, () => {
				// 	// 上報完成
				// 	contentMessageCenter.send({
				// 		info: {
				// 			actionType: 'CONTENT_RED_PACKET_REPLY_RASK_FINSH',
				// 			iframeId: params.iframeId,
				// 		},
				// 		data: { postId: params.postId },
				// 	});
				// });
			});
		}
	}, 1000);
}

export { onReplyDialogOpen };
