| 
									
										
										
										
											2025-06-02 21:24:03 -04:00
										 |  |  |  | import { | 
					
						
							|  |  |  |  | 	LitElement, | 
					
						
							|  |  |  |  | 	css, | 
					
						
							|  |  |  |  | 	html, | 
					
						
							|  |  |  |  | 	repeat, | 
					
						
							|  |  |  |  | 	render, | 
					
						
							| 
									
										
										
										
											2025-10-22 19:39:20 -04:00
										 |  |  |  | 	unsafeCSS, | 
					
						
							| 
									
										
										
										
											2025-06-02 21:24:03 -04:00
										 |  |  |  | 	unsafeHTML, | 
					
						
							| 
									
										
										
										
											2025-10-22 19:39:20 -04:00
										 |  |  |  | 	until, | 
					
						
							| 
									
										
										
										
											2025-06-02 21:24:03 -04:00
										 |  |  |  | } from './lit-all.min.js'; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | import * as tfrpc from '/static/tfrpc.js'; | 
					
						
							|  |  |  |  | import * as tfutils from './tf-utils.js'; | 
					
						
							|  |  |  |  | import * as emojis from './emojis.js'; | 
					
						
							| 
									
										
										
										
											2025-10-22 19:39:20 -04:00
										 |  |  |  | import {styles, generate_theme} from './tf-styles.js'; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | class TfMessageElement extends LitElement { | 
					
						
							|  |  |  |  | 	static get properties() { | 
					
						
							|  |  |  |  | 		return { | 
					
						
							|  |  |  |  | 			whoami: {type: String}, | 
					
						
							|  |  |  |  | 			message: {type: Object}, | 
					
						
							|  |  |  |  | 			users: {type: Object}, | 
					
						
							| 
									
										
										
										
											2023-01-21 00:16:18 +00:00
										 |  |  |  | 			drafts: {type: Object}, | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 			format: {type: String}, | 
					
						
							| 
									
										
										
										
											2022-12-03 02:18:48 +00:00
										 |  |  |  | 			blog_data: {type: String}, | 
					
						
							| 
									
										
										
										
											2023-01-25 00:56:10 +00:00
										 |  |  |  | 			expanded: {type: Object}, | 
					
						
							| 
									
										
										
										
											2024-11-30 15:05:14 -05:00
										 |  |  |  | 			channel: {type: String}, | 
					
						
							|  |  |  |  | 			channel_unread: {type: Number}, | 
					
						
							| 
									
										
										
										
											2025-04-29 20:48:47 -04:00
										 |  |  |  | 			recent_reactions: {type: Array}, | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 			depth: {type: Number}, | 
					
						
							| 
									
										
										
										
											2023-03-29 22:02:12 +00:00
										 |  |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-04 12:24:04 -04:00
										 |  |  |  | 	static styles = styles; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	constructor() { | 
					
						
							|  |  |  |  | 		super(); | 
					
						
							|  |  |  |  | 		let self = this; | 
					
						
							|  |  |  |  | 		this.whoami = null; | 
					
						
							|  |  |  |  | 		this.message = {}; | 
					
						
							|  |  |  |  | 		this.users = {}; | 
					
						
							| 
									
										
										
										
											2023-01-21 00:16:18 +00:00
										 |  |  |  | 		this.drafts = {}; | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 		this.format = 'message'; | 
					
						
							| 
									
										
										
										
											2023-01-25 00:56:10 +00:00
										 |  |  |  | 		this.expanded = {}; | 
					
						
							| 
									
										
										
										
											2024-11-30 15:05:14 -05:00
										 |  |  |  | 		this.channel_unread = -1; | 
					
						
							| 
									
										
										
										
											2025-04-29 20:48:47 -04:00
										 |  |  |  | 		this.recent_reactions = []; | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 		this.depth = 0; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 	connectedCallback() { | 
					
						
							|  |  |  |  | 		super.connectedCallback(); | 
					
						
							|  |  |  |  | 		this._click_callback = this.document_click.bind(this); | 
					
						
							| 
									
										
										
										
											2025-09-24 11:34:34 -04:00
										 |  |  |  | 		this._blob_stored = this.blob_stored.bind(this); | 
					
						
							| 
									
										
										
										
											2025-04-07 22:35:40 -04:00
										 |  |  |  | 		document.body.addEventListener('mouseup', this._click_callback); | 
					
						
							| 
									
										
										
										
											2025-09-24 11:34:34 -04:00
										 |  |  |  | 		window.addEventListener('blob-stored', this._blob_stored); | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	disconnectedCallback() { | 
					
						
							|  |  |  |  | 		super.disconnectedCallback(); | 
					
						
							| 
									
										
										
										
											2025-09-24 11:34:34 -04:00
										 |  |  |  | 		window.removeEventListener('blob-stored', this._blob_stored); | 
					
						
							| 
									
										
										
										
											2025-04-07 22:35:40 -04:00
										 |  |  |  | 		document.body.removeEventListener('mouseup', this._click_callback); | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	document_click(event) { | 
					
						
							|  |  |  |  | 		let content = this.renderRoot.querySelector('.w3-dropdown-content'); | 
					
						
							| 
									
										
										
										
											2025-04-07 22:35:40 -04:00
										 |  |  |  | 		let target = event.target; | 
					
						
							| 
									
										
										
										
											2025-04-09 12:28:56 -04:00
										 |  |  |  | 		if (content && !content.contains(target)) { | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 			content.classList.remove('w3-show'); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-24 11:34:34 -04:00
										 |  |  |  | 	blob_stored(event) { | 
					
						
							|  |  |  |  | 		let search = `/${event.detail.id}/view`; | 
					
						
							|  |  |  |  | 		for (let img of this.shadowRoot.querySelectorAll('img')) { | 
					
						
							|  |  |  |  | 			if (img.src.indexOf(search) != -1) { | 
					
						
							|  |  |  |  | 				let src = img.src.split('?')[0]; | 
					
						
							|  |  |  |  | 				img.src = `${src}?${new Date().valueOf()}`; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	show_reply() { | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		let event = new CustomEvent('tf-draft', { | 
					
						
							|  |  |  |  | 			bubbles: true, | 
					
						
							|  |  |  |  | 			composed: true, | 
					
						
							|  |  |  |  | 			detail: { | 
					
						
							|  |  |  |  | 				id: this.message?.id, | 
					
						
							|  |  |  |  | 				draft: { | 
					
						
							|  |  |  |  | 					encrypt_to: this.message?.decrypted?.recps, | 
					
						
							|  |  |  |  | 				}, | 
					
						
							|  |  |  |  | 			}, | 
					
						
							|  |  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2023-01-21 00:16:18 +00:00
										 |  |  |  | 		this.dispatchEvent(event); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	discard_reply() { | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		this.dispatchEvent( | 
					
						
							|  |  |  |  | 			new CustomEvent('tf-draft', { | 
					
						
							|  |  |  |  | 				bubbles: true, | 
					
						
							|  |  |  |  | 				composed: true, | 
					
						
							|  |  |  |  | 				detail: {id: this.id, draft: undefined}, | 
					
						
							|  |  |  |  | 			}) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-21 14:18:06 -04:00
										 |  |  |  | 	show_reactions() { | 
					
						
							|  |  |  |  | 		let modal = document.getElementById('reactions_modal'); | 
					
						
							|  |  |  |  | 		modal.users = this.users; | 
					
						
							|  |  |  |  | 		modal.votes = this.message?.votes || []; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	render_votes() { | 
					
						
							|  |  |  |  | 		function normalize_expression(expression) { | 
					
						
							| 
									
										
										
										
											2025-05-31 10:52:07 -04:00
										 |  |  |  | 			if ( | 
					
						
							|  |  |  |  | 				expression === 'Unlike' || | 
					
						
							|  |  |  |  | 				expression === 'unlike' || | 
					
						
							|  |  |  |  | 				expression == 'undig' | 
					
						
							|  |  |  |  | 			) { | 
					
						
							| 
									
										
										
										
											2022-09-10 02:56:15 +00:00
										 |  |  |  | 				return '👎'; | 
					
						
							|  |  |  |  | 			} else if (expression === 'heart') { | 
					
						
							|  |  |  |  | 				return '❤️'; | 
					
						
							| 
									
										
										
										
											2025-06-02 12:14:06 -04:00
										 |  |  |  | 			} else if ( | 
					
						
							|  |  |  |  | 				(expression ?? '').split('').every((x) => x.charCodeAt(0) < 256) | 
					
						
							|  |  |  |  | 			) { | 
					
						
							| 
									
										
										
										
											2025-05-31 10:52:07 -04:00
										 |  |  |  | 				return '👍'; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				return expression; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2024-04-26 18:19:13 -04:00
										 |  |  |  | 		if (this.message?.votes?.length) { | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 			return html` <footer class="w3-container">
 | 
					
						
							| 
									
										
										
										
											2024-09-30 12:15:27 -04:00
										 |  |  |  | 				<div | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 					class="w3-button w3-bar" | 
					
						
							|  |  |  |  | 					style="padding: 0" | 
					
						
							| 
									
										
										
										
											2024-09-30 12:15:27 -04:00
										 |  |  |  | 					@click=${this.show_reactions} | 
					
						
							|  |  |  |  | 				> | 
					
						
							| 
									
										
										
										
											2024-09-23 12:43:48 -04:00
										 |  |  |  | 					${(this.message.votes || []).map( | 
					
						
							|  |  |  |  | 						(vote) => html`
 | 
					
						
							|  |  |  |  | 							<span | 
					
						
							|  |  |  |  | 								class="w3-bar-item w3-padding-small" | 
					
						
							| 
									
										
										
										
											2024-09-30 12:15:27 -04:00
										 |  |  |  | 								title="${this.users[vote.author]?.name ?? | 
					
						
							|  |  |  |  | 								vote.author} ${new Date(vote.timestamp)}" | 
					
						
							| 
									
										
										
										
											2024-09-23 12:43:48 -04:00
										 |  |  |  | 							> | 
					
						
							|  |  |  |  | 								${normalize_expression(vote.content.vote.expression)} | 
					
						
							|  |  |  |  | 							</span> | 
					
						
							|  |  |  |  | 						`
 | 
					
						
							|  |  |  |  | 					)} | 
					
						
							|  |  |  |  | 				</div> | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 			</footer>`; | 
					
						
							| 
									
										
										
										
											2024-04-26 18:19:13 -04:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 	render_json(value) { | 
					
						
							|  |  |  |  | 		let json = JSON.stringify(value, null, 2); | 
					
						
							|  |  |  |  | 		return html`
 | 
					
						
							|  |  |  |  | 			<pre style="white-space: pre-wrap; overflow-wrap: anywhere">${json}</pre> | 
					
						
							|  |  |  |  | 		`;
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	render_raw() { | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 		let raw = { | 
					
						
							|  |  |  |  | 			id: this.message?.id, | 
					
						
							|  |  |  |  | 			previous: this.message?.previous, | 
					
						
							|  |  |  |  | 			author: this.message?.author, | 
					
						
							|  |  |  |  | 			sequence: this.message?.sequence, | 
					
						
							|  |  |  |  | 			timestamp: this.message?.timestamp, | 
					
						
							|  |  |  |  | 			hash: this.message?.hash, | 
					
						
							|  |  |  |  | 			content: this.message?.content, | 
					
						
							|  |  |  |  | 			signature: this.message?.signature, | 
					
						
							| 
									
										
										
										
											2023-03-29 22:02:12 +00:00
										 |  |  |  | 		}; | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		return this.render_json(raw); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	vote(emoji) { | 
					
						
							| 
									
										
										
										
											2023-05-04 00:32:50 +00:00
										 |  |  |  | 		let reaction = emoji; | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 		let message = this.message.id; | 
					
						
							| 
									
										
										
										
											2025-01-15 12:34:02 -05:00
										 |  |  |  | 		tfrpc.rpc | 
					
						
							|  |  |  |  | 			.appendMessage(this.whoami, { | 
					
						
							|  |  |  |  | 				type: 'vote', | 
					
						
							|  |  |  |  | 				vote: { | 
					
						
							|  |  |  |  | 					link: message, | 
					
						
							|  |  |  |  | 					value: 1, | 
					
						
							|  |  |  |  | 					expression: reaction, | 
					
						
							|  |  |  |  | 				}, | 
					
						
							|  |  |  |  | 			}) | 
					
						
							|  |  |  |  | 			.catch(function (error) { | 
					
						
							|  |  |  |  | 				alert(error?.message); | 
					
						
							|  |  |  |  | 			}); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	react(event) { | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 		emojis.picker( | 
					
						
							|  |  |  |  | 			(x) => this.vote(x), | 
					
						
							|  |  |  |  | 			null, | 
					
						
							|  |  |  |  | 			this.whoami, | 
					
						
							|  |  |  |  | 			this.recent_reactions | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 23:49:25 +00:00
										 |  |  |  | 	show_image(link) { | 
					
						
							|  |  |  |  | 		let div = document.createElement('div'); | 
					
						
							|  |  |  |  | 		div.style.left = 0; | 
					
						
							|  |  |  |  | 		div.style.top = 0; | 
					
						
							|  |  |  |  | 		div.style.width = '100%'; | 
					
						
							|  |  |  |  | 		div.style.height = '100%'; | 
					
						
							|  |  |  |  | 		div.style.position = 'fixed'; | 
					
						
							|  |  |  |  | 		div.style.background = '#000'; | 
					
						
							|  |  |  |  | 		div.style.zIndex = 100; | 
					
						
							|  |  |  |  | 		div.style.display = 'grid'; | 
					
						
							|  |  |  |  | 		let img = document.createElement('img'); | 
					
						
							|  |  |  |  | 		img.src = link; | 
					
						
							| 
									
										
										
										
											2025-07-09 18:53:27 -04:00
										 |  |  |  | 		img.style.maxWidth = '100vw'; | 
					
						
							|  |  |  |  | 		img.style.maxHeight = '100vh'; | 
					
						
							| 
									
										
										
										
											2022-09-14 23:49:25 +00:00
										 |  |  |  | 		img.style.display = 'block'; | 
					
						
							|  |  |  |  | 		img.style.margin = 'auto'; | 
					
						
							|  |  |  |  | 		img.style.objectFit = 'contain'; | 
					
						
							| 
									
										
										
										
											2025-07-09 18:53:27 -04:00
										 |  |  |  | 		img.style.width = '100vw'; | 
					
						
							| 
									
										
										
										
											2022-09-14 23:49:25 +00:00
										 |  |  |  | 		div.appendChild(img); | 
					
						
							|  |  |  |  | 		function image_close(event) { | 
					
						
							|  |  |  |  | 			document.body.removeChild(div); | 
					
						
							|  |  |  |  | 			window.removeEventListener('keydown', image_close); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		div.onclick = image_close; | 
					
						
							|  |  |  |  | 		window.addEventListener('keydown', image_close); | 
					
						
							|  |  |  |  | 		document.body.appendChild(div); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 	body_click(event) { | 
					
						
							|  |  |  |  | 		if (event.srcElement.tagName == 'IMG') { | 
					
						
							|  |  |  |  | 			this.show_image(event.srcElement.src); | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			event.srcElement.tagName == 'DIV' && | 
					
						
							|  |  |  |  | 			event.srcElement.classList.contains('img_caption') | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2023-04-13 00:03:22 +00:00
										 |  |  |  | 			let next = event.srcElement.nextSibling; | 
					
						
							| 
									
										
										
										
											2024-05-25 08:09:44 -04:00
										 |  |  |  | 			if (next.style.display != 'none') { | 
					
						
							| 
									
										
										
										
											2023-04-13 00:03:22 +00:00
										 |  |  |  | 				next.style.display = 'none'; | 
					
						
							|  |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				next.style.display = 'block'; | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 	render_mention(mention) { | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		if (!mention?.link || typeof mention.link != 'string') { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 			return this.render_json(mention); | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			mention?.link?.startsWith('&') && | 
					
						
							|  |  |  |  | 			mention?.type?.startsWith('image/') | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 			return html`
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				<img | 
					
						
							|  |  |  |  | 					src=${'/' + mention.link + '/view'} | 
					
						
							|  |  |  |  | 					style="max-width: 128px; max-height: 128px" | 
					
						
							|  |  |  |  | 					title=${mention.name} | 
					
						
							|  |  |  |  | 					@click=${() => this.show_image('/' + mention.link + '/view')} | 
					
						
							|  |  |  |  | 				/> | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 			`;
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			mention.link?.startsWith('&') && | 
					
						
							|  |  |  |  | 			mention.name?.startsWith('audio:') | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 			return html`
 | 
					
						
							|  |  |  |  | 				<audio controls style="height: 32px"> | 
					
						
							|  |  |  |  | 					<source src=${'/' + mention.link + '/view'}></source> | 
					
						
							|  |  |  |  | 				</audio> | 
					
						
							|  |  |  |  | 			`;
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			mention.link?.startsWith('&') && | 
					
						
							|  |  |  |  | 			mention.name?.startsWith('video:') | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2022-11-30 02:37:27 +00:00
										 |  |  |  | 			return html`
 | 
					
						
							| 
									
										
										
										
											2023-03-19 23:31:08 +00:00
										 |  |  |  | 				<video controls style="max-height: 240px; max-width: 128px"> | 
					
						
							| 
									
										
										
										
											2022-11-30 02:37:27 +00:00
										 |  |  |  | 					<source src=${'/' + mention.link + '/view'}></source> | 
					
						
							|  |  |  |  | 				</video> | 
					
						
							|  |  |  |  | 			`;
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			mention.link?.startsWith('&') && | 
					
						
							|  |  |  |  | 			mention?.type === 'application/tildefriends' | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2022-10-21 23:31:32 +00:00
										 |  |  |  | 			return html` <a href=${`/${mention.link}/`}>😎 ${mention.name}</a>`; | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 		} else if (mention.link?.startsWith('%') || mention.link?.startsWith('@')) { | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 			return html` <a href=${'#' + encodeURIComponent(mention.link)}
 | 
					
						
							|  |  |  |  | 				>${mention.name}</a | 
					
						
							|  |  |  |  | 			>`;
 | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 		} else if (mention.link?.startsWith('#')) { | 
					
						
							| 
									
										
										
										
											2024-12-01 15:32:35 -05:00
										 |  |  |  | 			return html` <a href=${'#' + encodeURIComponent('#' + mention.link)}
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				>${mention.link}</a | 
					
						
							|  |  |  |  | 			>`;
 | 
					
						
							|  |  |  |  | 		} else if ( | 
					
						
							|  |  |  |  | 			Object.keys(mention).length == 2 && | 
					
						
							|  |  |  |  | 			mention.link && | 
					
						
							|  |  |  |  | 			mention.name | 
					
						
							|  |  |  |  | 		) { | 
					
						
							| 
									
										
										
										
											2022-10-21 23:31:32 +00:00
										 |  |  |  | 			return html` <a href=${`/${mention.link}/view`}>${mention.name}</a>`; | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 			return this.render_json(mention); | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render_mentions() { | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 		let mentions = this.message?.content?.mentions || []; | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		mentions = mentions.filter( | 
					
						
							| 
									
										
										
										
											2025-01-05 14:52:27 -05:00
										 |  |  |  | 			(x) => | 
					
						
							|  |  |  |  | 				this.message?.content?.text?.indexOf( | 
					
						
							|  |  |  |  | 					typeof x === 'string' ? x : x.link | 
					
						
							|  |  |  |  | 				) === -1 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 		if (mentions.length) { | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 			let self = this; | 
					
						
							|  |  |  |  | 			return html`
 | 
					
						
							| 
									
										
										
										
											2024-05-12 07:48:34 -04:00
										 |  |  |  | 				<fieldset style="padding: 0.5em; border: 1px solid black"> | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 					<legend>Mentions</legend> | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 					${mentions.map((x) => self.render_mention(x))} | 
					
						
							| 
									
										
										
										
											2022-09-14 23:33:57 +00:00
										 |  |  |  | 				</fieldset> | 
					
						
							|  |  |  |  | 			`;
 | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-21 18:58:49 +00:00
										 |  |  |  | 	total_child_messages(message) { | 
					
						
							|  |  |  |  | 		if (!message.child_messages) { | 
					
						
							|  |  |  |  | 			return 0; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		let total = message.child_messages.length; | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		for (let m of message.child_messages) { | 
					
						
							| 
									
										
										
										
											2023-01-21 18:58:49 +00:00
										 |  |  |  | 			total += this.total_child_messages(m); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return total; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 	expanded_key() { | 
					
						
							| 
									
										
										
										
											2025-10-22 12:22:09 -04:00
										 |  |  |  | 		return ( | 
					
						
							|  |  |  |  | 			this.message?.id || this.message?.messages?.map((x) => x.id).join(':') | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-26 02:08:14 +00:00
										 |  |  |  | 	set_expanded(expanded, tag) { | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 		let key = this.expanded_key(); | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		this.dispatchEvent( | 
					
						
							|  |  |  |  | 			new CustomEvent('tf-expand', { | 
					
						
							|  |  |  |  | 				bubbles: true, | 
					
						
							|  |  |  |  | 				composed: true, | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 				detail: {id: key + (tag || ''), expanded: expanded}, | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 			}) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2023-01-26 02:08:14 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	toggle_expanded(tag) { | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 		let key = this.expanded_key(); | 
					
						
							|  |  |  |  | 		this.set_expanded(!this.expanded[key + (tag || '')], tag); | 
					
						
							| 
									
										
										
										
											2023-01-25 00:56:10 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-24 12:35:36 -04:00
										 |  |  |  | 	is_expanded(tag) { | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 		let key = this.expanded_key(); | 
					
						
							|  |  |  |  | 		return this.expanded[key + (tag || '')]; | 
					
						
							| 
									
										
										
										
											2025-04-24 12:35:36 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-18 22:31:54 +00:00
										 |  |  |  | 	render_children() { | 
					
						
							|  |  |  |  | 		let self = this; | 
					
						
							| 
									
										
										
										
											2022-12-28 17:17:44 +00:00
										 |  |  |  | 		if (this.message.child_messages?.length) { | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 			if (!this.expanded[this.expanded_key()]) { | 
					
						
							| 
									
										
										
										
											2025-04-13 21:38:56 -04:00
										 |  |  |  | 				return html`
 | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 						style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 						@click=${() => self.set_expanded(true)} | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 					> | 
					
						
							| 
									
										
										
										
											2025-04-13 21:38:56 -04:00
										 |  |  |  | 						+ ${this.total_child_messages(this.message) + ' More'} | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							| 
									
										
										
										
											2025-04-16 19:27:24 -04:00
										 |  |  |  | 				`;
 | 
					
						
							| 
									
										
										
										
											2025-04-13 21:38:56 -04:00
										 |  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 				return html` <ul class="w3-container w3-margin-bottom w3-ul w3-card-4">
 | 
					
						
							| 
									
										
										
										
											2025-10-01 18:06:45 -04:00
										 |  |  |  | 					${repeat( | 
					
						
							|  |  |  |  | 						this.message.child_messages || [], | 
					
						
							|  |  |  |  | 						(x) => x.id, | 
					
						
							|  |  |  |  | 						(x) => | 
					
						
							|  |  |  |  | 							html`<li style="padding: 0">
 | 
					
						
							|  |  |  |  | 								<tf-message | 
					
						
							|  |  |  |  | 									.message=${x} | 
					
						
							|  |  |  |  | 									whoami=${this.whoami} | 
					
						
							|  |  |  |  | 									.users=${this.users} | 
					
						
							|  |  |  |  | 									.drafts=${this.drafts} | 
					
						
							|  |  |  |  | 									.expanded=${this.expanded} | 
					
						
							|  |  |  |  | 									channel=${this.channel} | 
					
						
							|  |  |  |  | 									channel_unread=${this.channel_unread} | 
					
						
							|  |  |  |  | 									.recent_reactions=${this.recent_reactions} | 
					
						
							|  |  |  |  | 									depth=${this.depth + 1} | 
					
						
							|  |  |  |  | 								></tf-message> | 
					
						
							|  |  |  |  | 							</li>` | 
					
						
							|  |  |  |  | 					)} | 
					
						
							|  |  |  |  | 					<li style="padding: 0" class="w3-margin-bottom"> | 
					
						
							|  |  |  |  | 						<button | 
					
						
							|  |  |  |  | 							class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 							style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 							@click=${() => self.set_expanded(false)} | 
					
						
							|  |  |  |  | 						> | 
					
						
							|  |  |  |  | 							Collapse | 
					
						
							|  |  |  |  | 						</button> | 
					
						
							|  |  |  |  | 					</li> | 
					
						
							|  |  |  |  | 				</ul>`; | 
					
						
							| 
									
										
										
										
											2022-12-28 17:17:44 +00:00
										 |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-12-29 15:42:12 -05:00
										 |  |  |  | 		} else { | 
					
						
							|  |  |  |  | 			return undefined; | 
					
						
							| 
									
										
										
										
											2022-10-18 22:31:54 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-01 12:56:31 -05:00
										 |  |  |  | 	mark_unread() { | 
					
						
							| 
									
										
										
										
											2024-12-05 20:47:02 -05:00
										 |  |  |  | 		this.dispatchEvent( | 
					
						
							|  |  |  |  | 			new CustomEvent('channelsetunread', { | 
					
						
							|  |  |  |  | 				bubbles: true, | 
					
						
							|  |  |  |  | 				composed: true, | 
					
						
							|  |  |  |  | 				detail: { | 
					
						
							|  |  |  |  | 					channel: this.channel, | 
					
						
							|  |  |  |  | 					unread: this.message.rowid, | 
					
						
							|  |  |  |  | 				}, | 
					
						
							|  |  |  |  | 			}) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2024-11-30 15:05:14 -05:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-22 00:27:27 +00:00
										 |  |  |  | 	render_channels() { | 
					
						
							|  |  |  |  | 		let content = this.message?.content; | 
					
						
							| 
									
										
										
										
											2023-09-02 02:06:29 +00:00
										 |  |  |  | 		if (this?.messsage?.decrypted?.type == 'post') { | 
					
						
							|  |  |  |  | 			content = this.message.decrypted; | 
					
						
							| 
									
										
										
										
											2023-06-22 00:27:27 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 		let channels = []; | 
					
						
							|  |  |  |  | 		if (typeof content.channel === 'string') { | 
					
						
							|  |  |  |  | 			channels.push(`#${content.channel}`); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		if (Array.isArray(content.mentions)) { | 
					
						
							|  |  |  |  | 			for (let mention of content.mentions) { | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				if (typeof mention?.link === 'string' && mention.link.startsWith('#')) { | 
					
						
							| 
									
										
										
										
											2023-06-22 00:27:27 +00:00
										 |  |  |  | 					channels.push(mention.link); | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 		return channels.map((x) => html`<tf-tag tag=${x}></tf-tag>`); | 
					
						
							| 
									
										
										
										
											2023-06-22 00:27:27 +00:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 	class_background() { | 
					
						
							|  |  |  |  | 		return this.message?.decrypted | 
					
						
							|  |  |  |  | 			? 'w3-pale-red' | 
					
						
							| 
									
										
										
										
											2025-06-04 20:48:04 -04:00
										 |  |  |  | 			: this.allow_unread() && this.message?.rowid >= this.channel_unread | 
					
						
							| 
									
										
										
										
											2025-06-04 12:24:04 -04:00
										 |  |  |  | 				? 'w3-theme-d2' | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				: 'w3-theme-d4'; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 	get_content() { | 
					
						
							|  |  |  |  | 		let content = this.message?.content; | 
					
						
							|  |  |  |  | 		if (this.message?.decrypted?.type == 'post') { | 
					
						
							|  |  |  |  | 			content = this.message.decrypted; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return content; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-05 17:53:47 -04:00
										 |  |  |  | 	copy_id(event) { | 
					
						
							|  |  |  |  | 		navigator.clipboard.writeText(this.message?.id); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 	toggle_menu(event) { | 
					
						
							| 
									
										
										
										
											2025-04-09 12:28:56 -04:00
										 |  |  |  | 		event.srcElement.parentNode | 
					
						
							|  |  |  |  | 			.querySelector('.w3-dropdown-content') | 
					
						
							|  |  |  |  | 			.classList.toggle('w3-show'); | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-05 17:53:47 -04:00
										 |  |  |  | 	render_menu() { | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 		let content = this.get_content(); | 
					
						
							| 
									
										
										
										
											2025-04-05 22:05:26 -04:00
										 |  |  |  | 		let formats = [['message', 'Message']]; | 
					
						
							| 
									
										
										
										
											2025-04-05 17:53:47 -04:00
										 |  |  |  | 		if (content?.type == 'post' || content?.type == 'blog') { | 
					
						
							|  |  |  |  | 			formats.push(['md', 'Markdown']); | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-04-05 17:53:47 -04:00
										 |  |  |  | 		if (this.message?.decrypted) { | 
					
						
							|  |  |  |  | 			formats.push(['decrypted', 'Decrypted']); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		formats.push(['raw', 'Raw']); | 
					
						
							|  |  |  |  | 		return html`
 | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 			<div class="w3-bar-item w3-right"> | 
					
						
							| 
									
										
										
										
											2025-04-09 12:28:56 -04:00
										 |  |  |  | 				<button class="w3-button w3-theme-d1" @click=${this.toggle_menu}> | 
					
						
							|  |  |  |  | 					% | 
					
						
							|  |  |  |  | 				</button> | 
					
						
							| 
									
										
										
										
											2025-04-05 22:05:26 -04:00
										 |  |  |  | 				<div | 
					
						
							|  |  |  |  | 					class="w3-dropdown-content w3-bar-block w3-card-4 w3-theme-l1" | 
					
						
							|  |  |  |  | 					style="right: 48px" | 
					
						
							|  |  |  |  | 				> | 
					
						
							|  |  |  |  | 					<a | 
					
						
							|  |  |  |  | 						target="_top" | 
					
						
							|  |  |  |  | 						class="w3-button w3-bar-item" | 
					
						
							|  |  |  |  | 						href=${'#' + encodeURIComponent(this.message?.id)} | 
					
						
							| 
									
										
										
										
											2025-04-07 21:39:14 -04:00
										 |  |  |  | 						>View Message</a | 
					
						
							| 
									
										
										
										
											2025-04-05 22:05:26 -04:00
										 |  |  |  | 					> | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-bar-item w3-border-bottom" | 
					
						
							|  |  |  |  | 						@click=${this.copy_id} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						Copy ID | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							| 
									
										
										
										
											2025-04-09 22:15:51 -04:00
										 |  |  |  | 					${this.drafts[this.message?.id] === undefined | 
					
						
							|  |  |  |  | 						? html`
 | 
					
						
							|  |  |  |  | 								<button class="w3-button w3-bar-item" @click=${this.show_reply}> | 
					
						
							| 
									
										
										
										
											2025-05-01 12:38:11 -04:00
										 |  |  |  | 									↩️ Reply | 
					
						
							| 
									
										
										
										
											2025-04-09 22:15:51 -04:00
										 |  |  |  | 								</button> | 
					
						
							|  |  |  |  | 							`
 | 
					
						
							|  |  |  |  | 						: undefined} | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-bar-item w3-border-bottom" | 
					
						
							|  |  |  |  | 						@click=${this.react} | 
					
						
							|  |  |  |  | 					> | 
					
						
							| 
									
										
										
										
											2025-04-09 19:02:02 -04:00
										 |  |  |  | 						👍 React | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							| 
									
										
										
										
											2025-04-05 22:05:26 -04:00
										 |  |  |  | 					${formats.map( | 
					
						
							|  |  |  |  | 						([format, name]) => html`
 | 
					
						
							|  |  |  |  | 							<button | 
					
						
							|  |  |  |  | 								class="w3-button w3-bar-item" | 
					
						
							|  |  |  |  | 								style=${format == this.format ? 'font-weight: bold' : ''} | 
					
						
							|  |  |  |  | 								@click=${() => (this.format = format)} | 
					
						
							|  |  |  |  | 							> | 
					
						
							|  |  |  |  | 								${name} | 
					
						
							|  |  |  |  | 							</button> | 
					
						
							|  |  |  |  | 						`
 | 
					
						
							|  |  |  |  | 					)} | 
					
						
							| 
									
										
										
										
											2025-04-05 17:53:47 -04:00
										 |  |  |  | 				</div> | 
					
						
							|  |  |  |  | 			</div> | 
					
						
							|  |  |  |  | 		`;
 | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render_header() { | 
					
						
							|  |  |  |  | 		let is_encrypted = this.message?.decrypted | 
					
						
							| 
									
										
										
										
											2025-01-02 16:11:04 -05:00
										 |  |  |  | 			? html`<span class="w3-bar-item">🔓</span>` | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 			: typeof this.message?.content == 'string' | 
					
						
							|  |  |  |  | 				? html`<span class="w3-bar-item">🔒</span>` | 
					
						
							|  |  |  |  | 				: undefined; | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		return html`
 | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 			<header class="w3-bar"> | 
					
						
							|  |  |  |  | 				<span class="w3-bar-item"> | 
					
						
							| 
									
										
										
										
											2025-06-04 12:24:04 -04:00
										 |  |  |  | 					${this.render_unread_icon()}<tf-user | 
					
						
							|  |  |  |  | 						id=${this.message.author} | 
					
						
							|  |  |  |  | 						.users=${this.users} | 
					
						
							|  |  |  |  | 					></tf-user> | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 				</span> | 
					
						
							| 
									
										
										
										
											2025-04-05 22:05:26 -04:00
										 |  |  |  | 				${is_encrypted} ${this.render_menu()} | 
					
						
							|  |  |  |  | 				<div class="w3-bar-item w3-right" style="text-wrap: nowrap"> | 
					
						
							|  |  |  |  | 					${new Date(this.message.timestamp).toLocaleString()} | 
					
						
							|  |  |  |  | 				</div> | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 			</header> | 
					
						
							|  |  |  |  | 		`;
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render_frame(inner) { | 
					
						
							|  |  |  |  | 		return html`
 | 
					
						
							|  |  |  |  | 			<style> | 
					
						
							|  |  |  |  | 				code { | 
					
						
							|  |  |  |  | 					white-space: pre-wrap; | 
					
						
							|  |  |  |  | 					overflow-wrap: break-word; | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				div { | 
					
						
							|  |  |  |  | 					overflow-wrap: anywhere; | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				img { | 
					
						
							|  |  |  |  | 					max-width: 100%; | 
					
						
							|  |  |  |  | 					height: auto; | 
					
						
							|  |  |  |  | 					display: block; | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 			</style> | 
					
						
							|  |  |  |  | 			<div | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 				class="w3-card-4 ${this.class_background()} w3-border-theme ${this | 
					
						
							|  |  |  |  | 					.depth == 0 | 
					
						
							|  |  |  |  | 					? 'w3-margin-top' | 
					
						
							|  |  |  |  | 					: ''}" | 
					
						
							| 
									
										
										
										
											2025-09-09 19:20:46 -04:00
										 |  |  |  | 				style="overflow-wrap: anywhere; display: block; max-width: 100%" | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 			> | 
					
						
							|  |  |  |  | 				${inner} | 
					
						
							|  |  |  |  | 			</div> | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 		`;
 | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render_small_frame(inner) { | 
					
						
							|  |  |  |  | 		let self = this; | 
					
						
							|  |  |  |  | 		return this.render_frame(html`
 | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 			${self.render_header()} | 
					
						
							|  |  |  |  | 			${self.format == 'raw' | 
					
						
							|  |  |  |  | 				? html`<div class="w3-container">${self.render_raw()}</div>` | 
					
						
							|  |  |  |  | 				: inner} | 
					
						
							|  |  |  |  | 			${self.render_votes()} | 
					
						
							|  |  |  |  | 			${(self.message.child_messages || []).map( | 
					
						
							|  |  |  |  | 				(x) => html`
 | 
					
						
							|  |  |  |  | 					<tf-message | 
					
						
							|  |  |  |  | 						.message=${x} | 
					
						
							|  |  |  |  | 						whoami=${self.whoami} | 
					
						
							|  |  |  |  | 						.users=${self.users} | 
					
						
							|  |  |  |  | 						.drafts=${self.drafts} | 
					
						
							|  |  |  |  | 						.expanded=${self.expanded} | 
					
						
							|  |  |  |  | 						channel=${self.channel} | 
					
						
							|  |  |  |  | 						channel_unread=${self.channel_unread} | 
					
						
							| 
									
										
										
										
											2025-04-29 20:48:47 -04:00
										 |  |  |  | 						.recent_reactions=${self.recent_reactions} | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 						depth=${self.depth + 1} | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 					></tf-message> | 
					
						
							|  |  |  |  | 				`
 | 
					
						
							|  |  |  |  | 			)} | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 		`);
 | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render_actions() { | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 		let content = this.get_content(); | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		let reply = | 
					
						
							|  |  |  |  | 			this.drafts[this.message?.id] !== undefined | 
					
						
							|  |  |  |  | 				? html`
 | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 						<div class="w3-section w3-container"> | 
					
						
							|  |  |  |  | 							<tf-compose | 
					
						
							|  |  |  |  | 								whoami=${this.whoami} | 
					
						
							|  |  |  |  | 								.users=${this.users} | 
					
						
							|  |  |  |  | 								root=${content.root || this.message.id} | 
					
						
							|  |  |  |  | 								branch=${this.message.id} | 
					
						
							|  |  |  |  | 								.drafts=${this.drafts} | 
					
						
							|  |  |  |  | 								@tf-discard=${this.discard_reply} | 
					
						
							|  |  |  |  | 								author=${this.message.author} | 
					
						
							|  |  |  |  | 								.recent_reactions=${this.recent_reactions} | 
					
						
							|  |  |  |  | 							></tf-compose> | 
					
						
							|  |  |  |  | 						</div> | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 					`
 | 
					
						
							| 
									
										
										
										
											2025-04-09 19:02:02 -04:00
										 |  |  |  | 				: undefined; | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		return html`
 | 
					
						
							| 
									
										
										
										
											2025-05-05 21:09:58 -04:00
										 |  |  |  | 			${reply} | 
					
						
							| 
									
										
										
										
											2025-04-16 19:27:24 -04:00
										 |  |  |  | 			<footer>${this.render_children()}</footer> | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		`;
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 	content_group_by_author() { | 
					
						
							|  |  |  |  | 		let sorted = this.message.messages | 
					
						
							|  |  |  |  | 			.map((x) => [ | 
					
						
							|  |  |  |  | 				x.author, | 
					
						
							| 
									
										
										
										
											2025-10-16 12:47:20 -04:00
										 |  |  |  | 				x.content.following && x.content.blocking | 
					
						
							|  |  |  |  | 					? 'is following and blocking' | 
					
						
							|  |  |  |  | 					: x.content.following | 
					
						
							|  |  |  |  | 						? 'is following' | 
					
						
							|  |  |  |  | 						: x.content.blocking | 
					
						
							|  |  |  |  | 							? 'is blocking' | 
					
						
							|  |  |  |  | 							: x.content.blocking !== undefined | 
					
						
							|  |  |  |  | 								? 'is no longer blocking' | 
					
						
							|  |  |  |  | 								: x.content.following !== undefined | 
					
						
							|  |  |  |  | 									? 'is no longer following' | 
					
						
							|  |  |  |  | 									: '', | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 				x.content.contact, | 
					
						
							|  |  |  |  | 				x, | 
					
						
							|  |  |  |  | 			]) | 
					
						
							|  |  |  |  | 			.sort(); | 
					
						
							|  |  |  |  | 		let result = []; | 
					
						
							|  |  |  |  | 		let last; | 
					
						
							|  |  |  |  | 		let group; | 
					
						
							|  |  |  |  | 		for (let row of sorted) { | 
					
						
							|  |  |  |  | 			if (last && last[0] == row[0] && last[1] == row[1]) { | 
					
						
							|  |  |  |  | 				group.push(row[2]); | 
					
						
							|  |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				if (group) { | 
					
						
							|  |  |  |  | 					result.push({author: last[0], action: last[1], users: group}); | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				last = row; | 
					
						
							|  |  |  |  | 				group = [row[2]]; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		if (group) { | 
					
						
							|  |  |  |  | 			result.push({author: last[0], action: last[1], users: group}); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return result; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-27 16:16:06 -04:00
										 |  |  |  | 	channel_group_by_author() { | 
					
						
							|  |  |  |  | 		let sorted = this.message.messages | 
					
						
							|  |  |  |  | 			.map((x) => [ | 
					
						
							|  |  |  |  | 				x.author, | 
					
						
							|  |  |  |  | 				x.content.subscribed ? 'subscribed to' : 'unsubscribed from', | 
					
						
							|  |  |  |  | 				x.content.channel, | 
					
						
							|  |  |  |  | 				x, | 
					
						
							|  |  |  |  | 			]) | 
					
						
							|  |  |  |  | 			.sort(); | 
					
						
							|  |  |  |  | 		let result = []; | 
					
						
							|  |  |  |  | 		let last; | 
					
						
							|  |  |  |  | 		let group; | 
					
						
							|  |  |  |  | 		for (let row of sorted) { | 
					
						
							|  |  |  |  | 			if (last && last[0] == row[0] && last[1] == row[1]) { | 
					
						
							|  |  |  |  | 				group.push(row[2]); | 
					
						
							|  |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				if (group) { | 
					
						
							|  |  |  |  | 					result.push({author: last[0], action: last[1], channels: group}); | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				last = row; | 
					
						
							|  |  |  |  | 				group = [row[2]]; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		if (group) { | 
					
						
							|  |  |  |  | 			result.push({author: last[0], action: last[1], channels: group}); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		return result; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-04 19:56:02 -04:00
										 |  |  |  | 	allow_unread() { | 
					
						
							| 
									
										
										
										
											2025-06-12 12:50:38 -04:00
										 |  |  |  | 		return ( | 
					
						
							|  |  |  |  | 			this.channel == '@' || | 
					
						
							|  |  |  |  | 			(!this.channel.startsWith('@') && !this.channel.startsWith('%')) | 
					
						
							|  |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2025-06-04 19:56:02 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-04 12:24:04 -04:00
										 |  |  |  | 	render_unread_icon() { | 
					
						
							| 
									
										
										
										
											2025-06-04 20:48:04 -04:00
										 |  |  |  | 		return this.allow_unread() && this.message?.rowid >= this.channel_unread | 
					
						
							|  |  |  |  | 			? html`✉️` | 
					
						
							|  |  |  |  | 			: undefined; | 
					
						
							| 
									
										
										
										
											2025-06-04 12:24:04 -04:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-22 19:39:20 -04:00
										 |  |  |  | 	_render() { | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 		let content = this.message?.content; | 
					
						
							| 
									
										
										
										
											2023-09-02 02:06:29 +00:00
										 |  |  |  | 		if (this.message?.decrypted?.type == 'post') { | 
					
						
							|  |  |  |  | 			content = this.message.decrypted; | 
					
						
							| 
									
										
										
										
											2023-05-17 14:10:49 +00:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 		let class_background = this.class_background(); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 		let self = this; | 
					
						
							| 
									
										
										
										
											2023-03-19 23:31:08 +00:00
										 |  |  |  | 		if (this.message?.type === 'contact_group') { | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 			if (this.expanded[this.expanded_key()]) { | 
					
						
							|  |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					<div class="w3-padding"> | 
					
						
							|  |  |  |  | 						${this.message.messages.map( | 
					
						
							|  |  |  |  | 							(x) => | 
					
						
							|  |  |  |  | 								html`<tf-message
 | 
					
						
							|  |  |  |  | 									.message=${x} | 
					
						
							|  |  |  |  | 									whoami=${this.whoami} | 
					
						
							|  |  |  |  | 									.users=${this.users} | 
					
						
							|  |  |  |  | 									.drafts=${this.drafts} | 
					
						
							|  |  |  |  | 									.expanded=${this.expanded} | 
					
						
							|  |  |  |  | 									channel=${this.channel} | 
					
						
							|  |  |  |  | 									channel_unread=${this.channel_unread} | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 									depth=${this.depth + 1} | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 								></tf-message>` | 
					
						
							|  |  |  |  | 						)} | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 						style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 						@click=${() => self.set_expanded(false)} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						Collapse | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							|  |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					<div class="w3-padding"> | 
					
						
							|  |  |  |  | 						${this.content_group_by_author().map( | 
					
						
							|  |  |  |  | 							(x) => html`
 | 
					
						
							| 
									
										
										
										
											2025-06-02 12:14:06 -04:00
										 |  |  |  | 								<div> | 
					
						
							|  |  |  |  | 									<tf-user id=${x.author} .users=${this.users}></tf-user> | 
					
						
							|  |  |  |  | 									${x.action} | 
					
						
							|  |  |  |  | 									${x.users.map( | 
					
						
							|  |  |  |  | 										(y) => html`
 | 
					
						
							| 
									
										
										
										
											2025-06-28 13:47:58 -04:00
										 |  |  |  | 											<tf-user | 
					
						
							|  |  |  |  | 												id=${y} | 
					
						
							|  |  |  |  | 												.users=${this.users} | 
					
						
							|  |  |  |  | 												icon_only="true" | 
					
						
							|  |  |  |  | 											></tf-user> | 
					
						
							| 
									
										
										
										
											2025-06-02 12:14:06 -04:00
										 |  |  |  | 										`
 | 
					
						
							|  |  |  |  | 									)} | 
					
						
							|  |  |  |  | 								</div> | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 							`
 | 
					
						
							|  |  |  |  | 						)} | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 						style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 						@click=${() => self.set_expanded(true)} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						Expand | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-09-27 16:16:06 -04:00
										 |  |  |  | 		} else if (this.message?.type === 'channel_group') { | 
					
						
							|  |  |  |  | 			if (this.expanded[this.expanded_key()]) { | 
					
						
							|  |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					<div class="w3-padding"> | 
					
						
							|  |  |  |  | 						${this.message.messages.map( | 
					
						
							|  |  |  |  | 							(x) => | 
					
						
							|  |  |  |  | 								html`<tf-message
 | 
					
						
							|  |  |  |  | 									.message=${x} | 
					
						
							|  |  |  |  | 									whoami=${this.whoami} | 
					
						
							|  |  |  |  | 									.users=${this.users} | 
					
						
							|  |  |  |  | 									.drafts=${this.drafts} | 
					
						
							|  |  |  |  | 									.expanded=${this.expanded} | 
					
						
							|  |  |  |  | 									channel=${this.channel} | 
					
						
							|  |  |  |  | 									channel_unread=${this.channel_unread} | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 									depth=${this.depth + 1} | 
					
						
							| 
									
										
										
										
											2025-09-27 16:16:06 -04:00
										 |  |  |  | 								></tf-message>` | 
					
						
							|  |  |  |  | 						)} | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 						style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 						@click=${() => self.set_expanded(false)} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						Collapse | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							|  |  |  |  | 			} else { | 
					
						
							|  |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					<div class="w3-padding"> | 
					
						
							|  |  |  |  | 						${this.channel_group_by_author().map( | 
					
						
							|  |  |  |  | 							(x) => html`
 | 
					
						
							|  |  |  |  | 								<div> | 
					
						
							|  |  |  |  | 									<tf-user id=${x.author} .users=${this.users}></tf-user> | 
					
						
							|  |  |  |  | 									${x.action} | 
					
						
							|  |  |  |  | 									${x.channels.map( | 
					
						
							|  |  |  |  | 										(y) => html` <tf-tag tag=${'#' + y}></tf-tag> ` | 
					
						
							|  |  |  |  | 									)} | 
					
						
							|  |  |  |  | 								</div> | 
					
						
							|  |  |  |  | 							`
 | 
					
						
							|  |  |  |  | 						)} | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 					<button | 
					
						
							|  |  |  |  | 						class="w3-button w3-theme-d1 w3-block w3-bar" | 
					
						
							|  |  |  |  | 						style="box-sizing: border-box" | 
					
						
							|  |  |  |  | 						@click=${() => self.set_expanded(true)} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						Expand | 
					
						
							|  |  |  |  | 					</button> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2023-03-19 23:31:08 +00:00
										 |  |  |  | 		} else if (this.message.placeholder) { | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 			return this.render_frame( | 
					
						
							| 
									
										
										
										
											2025-05-31 15:20:55 -04:00
										 |  |  |  | 				html`<div>
 | 
					
						
							| 
									
										
										
										
											2025-05-31 11:44:50 -04:00
										 |  |  |  | 					<div class="w3-bar"> | 
					
						
							| 
									
										
										
										
											2025-05-31 15:20:55 -04:00
										 |  |  |  | 						<a | 
					
						
							|  |  |  |  | 							class="w3-bar-item w3-panel w3-round-xlarge w3-theme-d1 w3-margin w3-button" | 
					
						
							|  |  |  |  | 							target="_top" | 
					
						
							|  |  |  |  | 							href=${'#' + encodeURIComponent(this.message?.id)} | 
					
						
							|  |  |  |  | 						> | 
					
						
							| 
									
										
										
										
											2025-05-31 11:44:50 -04:00
										 |  |  |  | 							This message is not currently available. | 
					
						
							| 
									
										
										
										
											2025-05-31 15:20:55 -04:00
										 |  |  |  | 						</a> | 
					
						
							| 
									
										
										
										
											2025-05-31 11:44:50 -04:00
										 |  |  |  | 						<div class="w3-bar-item w3-right"> | 
					
						
							|  |  |  |  | 							<button class="w3-button w3-theme-d1" @click=${this.toggle_menu}> | 
					
						
							|  |  |  |  | 								% | 
					
						
							|  |  |  |  | 							</button> | 
					
						
							|  |  |  |  | 							<div | 
					
						
							|  |  |  |  | 								class="w3-dropdown-content w3-bar-block w3-card-4 w3-theme-l1" | 
					
						
							|  |  |  |  | 								style="right: 48px" | 
					
						
							|  |  |  |  | 							> | 
					
						
							|  |  |  |  | 								<a | 
					
						
							|  |  |  |  | 									target="_top" | 
					
						
							|  |  |  |  | 									class="w3-button w3-bar-item" | 
					
						
							|  |  |  |  | 									href=${'#' + encodeURIComponent(this.message?.id)} | 
					
						
							|  |  |  |  | 									>View Message</a | 
					
						
							|  |  |  |  | 								> | 
					
						
							|  |  |  |  | 								<button | 
					
						
							|  |  |  |  | 									class="w3-button w3-bar-item w3-border-bottom" | 
					
						
							|  |  |  |  | 									@click=${this.copy_id} | 
					
						
							|  |  |  |  | 								> | 
					
						
							|  |  |  |  | 									Copy ID | 
					
						
							|  |  |  |  | 								</button> | 
					
						
							|  |  |  |  | 							</div> | 
					
						
							|  |  |  |  | 						</div> | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 					<div>${this.render_votes()}</div> | 
					
						
							|  |  |  |  | 					${(this.message.child_messages || []).map( | 
					
						
							|  |  |  |  | 						(x) => html`
 | 
					
						
							|  |  |  |  | 							<tf-message | 
					
						
							|  |  |  |  | 								.message=${x} | 
					
						
							|  |  |  |  | 								whoami=${this.whoami} | 
					
						
							|  |  |  |  | 								.users=${this.users} | 
					
						
							|  |  |  |  | 								.drafts=${this.drafts} | 
					
						
							|  |  |  |  | 								.expanded=${this.expanded} | 
					
						
							|  |  |  |  | 								channel=${this.channel} | 
					
						
							|  |  |  |  | 								channel_unread=${this.channel_unread} | 
					
						
							| 
									
										
										
										
											2025-10-01 12:27:04 -04:00
										 |  |  |  | 								depth=${this.depth + 1} | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 							></tf-message> | 
					
						
							|  |  |  |  | 						`
 | 
					
						
							| 
									
										
										
										
											2025-01-14 21:18:49 -05:00
										 |  |  |  | 					)} | 
					
						
							| 
									
										
										
										
											2025-01-14 21:37:11 -05:00
										 |  |  |  | 				</div>` | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 			); | 
					
						
							|  |  |  |  | 		} else if (typeof content?.type === 'string') { | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			if (content.type == 'about') { | 
					
						
							| 
									
										
										
										
											2022-12-24 18:50:01 +00:00
										 |  |  |  | 				let name; | 
					
						
							|  |  |  |  | 				let image; | 
					
						
							|  |  |  |  | 				let description; | 
					
						
							|  |  |  |  | 				if (content.name !== undefined) { | 
					
						
							| 
									
										
										
										
											2025-01-11 13:48:06 -05:00
										 |  |  |  | 					name = html`<div><b>Name:</b> ${content.name}</div>`; | 
					
						
							| 
									
										
										
										
											2022-12-24 18:50:01 +00:00
										 |  |  |  | 				} | 
					
						
							|  |  |  |  | 				if (content.image !== undefined) { | 
					
						
							|  |  |  |  | 					image = html`
 | 
					
						
							| 
									
										
										
										
											2025-05-31 16:11:13 -04:00
										 |  |  |  | 						<div @click=${this.body_click}><img src=${'/' + (typeof content.image?.link == 'string' ? content.image.link : content.image) + '/view'} style="width: 256px; height: auto"></img></div> | 
					
						
							| 
									
										
										
										
											2022-12-24 18:50:01 +00:00
										 |  |  |  | 					`;
 | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				if (content.description !== undefined) { | 
					
						
							|  |  |  |  | 					description = html`
 | 
					
						
							| 
									
										
										
										
											2025-01-11 13:48:06 -05:00
										 |  |  |  | 						<div style="flex: 1 0 50%; overflow-wrap: anywhere"> | 
					
						
							| 
									
										
										
										
											2022-12-24 18:50:01 +00:00
										 |  |  |  | 							<div>${unsafeHTML(tfutils.markdown(content.description))}</div> | 
					
						
							|  |  |  |  | 						</div> | 
					
						
							| 
									
										
										
										
											2023-03-29 22:02:12 +00:00
										 |  |  |  | 					`;
 | 
					
						
							| 
									
										
										
										
											2022-12-24 18:50:01 +00:00
										 |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				let update = | 
					
						
							|  |  |  |  | 					content.about == this.message.author | 
					
						
							| 
									
										
										
										
											2025-01-11 13:48:06 -05:00
										 |  |  |  | 						? html`<div style="font-weight: bold">Updated profile.</div>` | 
					
						
							| 
									
										
										
										
											2025-01-05 21:43:26 -05:00
										 |  |  |  | 						: html`<div style="font-weight: bold">
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 								Updated profile for | 
					
						
							|  |  |  |  | 								<tf-user id=${content.about} .users=${this.users}></tf-user>. | 
					
						
							|  |  |  |  | 							</div>`; | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				return this.render_small_frame(html`
 | 
					
						
							| 
									
										
										
										
											2025-01-05 21:43:26 -05:00
										 |  |  |  | 					<div class="w3-container"> | 
					
						
							|  |  |  |  | 						<p>${update} ${name} ${image} ${description}</p> | 
					
						
							|  |  |  |  | 					</div> | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				`);
 | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			} else if (content.type == 'contact') { | 
					
						
							| 
									
										
										
										
											2025-08-13 12:14:31 -04:00
										 |  |  |  | 				switch (this.format) { | 
					
						
							|  |  |  |  | 					case 'message': | 
					
						
							|  |  |  |  | 					default: | 
					
						
							|  |  |  |  | 						return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 							<div class="w3-bar"> | 
					
						
							|  |  |  |  | 								<div class="w3-bar-item"> | 
					
						
							|  |  |  |  | 									<tf-user | 
					
						
							|  |  |  |  | 										id=${this.message.author} | 
					
						
							|  |  |  |  | 										.users=${this.users} | 
					
						
							|  |  |  |  | 									></tf-user> | 
					
						
							|  |  |  |  | 									is | 
					
						
							|  |  |  |  | 									${content.blocking === true | 
					
						
							|  |  |  |  | 										? 'blocking' | 
					
						
							|  |  |  |  | 										: content.blocking === false | 
					
						
							|  |  |  |  | 											? 'no longer blocking' | 
					
						
							|  |  |  |  | 											: content.following === true | 
					
						
							|  |  |  |  | 												? 'following' | 
					
						
							|  |  |  |  | 												: content.following === false | 
					
						
							|  |  |  |  | 													? 'no longer following' | 
					
						
							|  |  |  |  | 													: '?'} | 
					
						
							|  |  |  |  | 									<tf-user | 
					
						
							|  |  |  |  | 										id=${this.message.content.contact} | 
					
						
							|  |  |  |  | 										.users=${this.users} | 
					
						
							|  |  |  |  | 									></tf-user> | 
					
						
							|  |  |  |  | 								</div> | 
					
						
							|  |  |  |  | 								${this.render_menu()} ${this.render_votes()} | 
					
						
							|  |  |  |  | 								${this.render_actions()} | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 							</div> | 
					
						
							| 
									
										
										
										
											2025-08-13 12:14:31 -04:00
										 |  |  |  | 						`);
 | 
					
						
							|  |  |  |  | 						break; | 
					
						
							|  |  |  |  | 					case 'raw': | 
					
						
							|  |  |  |  | 						return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 							${this.render_header()} | 
					
						
							|  |  |  |  | 							<div class="w3-container">${this.render_raw()}</div> | 
					
						
							|  |  |  |  | 							${this.render_votes()} ${this.render_actions()} | 
					
						
							| 
									
										
										
										
											2025-05-31 15:17:07 -04:00
										 |  |  |  | 						</div> | 
					
						
							| 
									
										
										
										
											2025-08-13 12:14:31 -04:00
										 |  |  |  | 						`);
 | 
					
						
							|  |  |  |  | 						break; | 
					
						
							|  |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			} else if (content.type == 'post') { | 
					
						
							|  |  |  |  | 				let self = this; | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 				let body; | 
					
						
							|  |  |  |  | 				switch (this.format) { | 
					
						
							|  |  |  |  | 					case 'raw': | 
					
						
							|  |  |  |  | 						body = this.render_raw(); | 
					
						
							|  |  |  |  | 						break; | 
					
						
							|  |  |  |  | 					case 'md': | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 						body = html`<code
 | 
					
						
							|  |  |  |  | 							style="white-space: pre-wrap; overflow-wrap: anywhere" | 
					
						
							|  |  |  |  | 							>${content.text}</code | 
					
						
							|  |  |  |  | 						>`;
 | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 						break; | 
					
						
							|  |  |  |  | 					case 'message': | 
					
						
							|  |  |  |  | 						body = unsafeHTML(tfutils.markdown(content.text)); | 
					
						
							|  |  |  |  | 						break; | 
					
						
							| 
									
										
										
										
											2024-02-16 01:09:08 +00:00
										 |  |  |  | 					case 'decrypted': | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 						body = this.render_json(content); | 
					
						
							| 
									
										
										
										
											2024-02-16 01:09:08 +00:00
										 |  |  |  | 						break; | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-11-19 02:06:23 +00:00
										 |  |  |  | 				let content_warning = html`
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 					<div | 
					
						
							| 
									
										
										
										
											2025-04-24 12:35:36 -04:00
										 |  |  |  | 						class="w3-panel w3-round-xlarge w3-theme-l4 w3" | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 						style="cursor: pointer" | 
					
						
							|  |  |  |  | 						@click=${(x) => this.toggle_expanded(':cw')} | 
					
						
							|  |  |  |  | 					> | 
					
						
							|  |  |  |  | 						<p>${content.contentWarning}</p> | 
					
						
							| 
									
										
										
										
											2025-04-27 09:53:24 -04:00
										 |  |  |  | 						<p class="w3-small"> | 
					
						
							|  |  |  |  | 							${this.is_expanded(':cw') ? 'Show less' : 'Show more'} | 
					
						
							|  |  |  |  | 						</p> | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 				`;
 | 
					
						
							|  |  |  |  | 				let content_html = html`
 | 
					
						
							|  |  |  |  | 					${this.render_channels()} | 
					
						
							|  |  |  |  | 					<div @click=${this.body_click}>${body}</div> | 
					
						
							|  |  |  |  | 					${this.render_mentions()} | 
					
						
							|  |  |  |  | 				`;
 | 
					
						
							|  |  |  |  | 				let payload = content.contentWarning | 
					
						
							|  |  |  |  | 					? self.expanded[(this.message.id || '') + ':cw'] | 
					
						
							|  |  |  |  | 						? html` ${content_warning} ${content_html} ` | 
					
						
							|  |  |  |  | 						: content_warning | 
					
						
							|  |  |  |  | 					: content_html; | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					${this.render_header()} | 
					
						
							|  |  |  |  | 					<div class="w3-container">${payload}</div> | 
					
						
							|  |  |  |  | 					${this.render_votes()} ${this.render_actions()} | 
					
						
							|  |  |  |  | 				</div> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							| 
									
										
										
										
											2023-09-06 22:35:20 +00:00
										 |  |  |  | 			} else if (content.type === 'issue') { | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 				return this.render_frame(html`
 | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 					${this.render_header()} ${content.text} ${this.render_votes()} | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 					<footer class="w3-container"> | 
					
						
							|  |  |  |  | 						<button class="w3-button w3-theme-d1" @click=${this.react}> | 
					
						
							|  |  |  |  | 							React | 
					
						
							|  |  |  |  | 						</button> | 
					
						
							|  |  |  |  | 						${this.render_children()} | 
					
						
							|  |  |  |  | 					</footer> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							| 
									
										
										
										
											2022-12-03 02:18:48 +00:00
										 |  |  |  | 			} else if (content.type === 'blog') { | 
					
						
							|  |  |  |  | 				let self = this; | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				tfrpc.rpc.get_blob(content.blog).then(function (data) { | 
					
						
							| 
									
										
										
										
											2022-12-03 02:18:48 +00:00
										 |  |  |  | 					self.blog_data = data; | 
					
						
							|  |  |  |  | 				}); | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				let payload = this.expanded[(this.message.id || '') + ':blog'] | 
					
						
							|  |  |  |  | 					? html`<div>
 | 
					
						
							|  |  |  |  | 							${this.blog_data | 
					
						
							|  |  |  |  | 								? unsafeHTML(tfutils.markdown(this.blog_data)) | 
					
						
							|  |  |  |  | 								: 'Loading...'} | 
					
						
							|  |  |  |  | 						</div>` | 
					
						
							|  |  |  |  | 					: undefined; | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 				let body; | 
					
						
							|  |  |  |  | 				switch (this.format) { | 
					
						
							|  |  |  |  | 					case 'raw': | 
					
						
							|  |  |  |  | 						body = this.render_raw(); | 
					
						
							|  |  |  |  | 						break; | 
					
						
							|  |  |  |  | 					case 'md': | 
					
						
							|  |  |  |  | 						body = content.summary; | 
					
						
							|  |  |  |  | 						break; | 
					
						
							|  |  |  |  | 					case 'message': | 
					
						
							|  |  |  |  | 						body = html`
 | 
					
						
							| 
									
										
										
										
											2022-12-03 14:58:44 +00:00
										 |  |  |  | 							<div | 
					
						
							|  |  |  |  | 								style="border: 1px solid #fff; border-radius: 1em; padding: 8px; margin: 4px; cursor: pointer" | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 								@click=${(x) => self.toggle_expanded(':blog')}> | 
					
						
							| 
									
										
										
										
											2022-12-03 14:58:44 +00:00
										 |  |  |  | 								<h2>${content.title}</h2> | 
					
						
							|  |  |  |  | 								<div style="display: flex; flex-direction: row"> | 
					
						
							|  |  |  |  | 									<img src=/${content.thumbnail}/view></img> | 
					
						
							|  |  |  |  | 									<span>${content.summary}</span> | 
					
						
							|  |  |  |  | 								</div> | 
					
						
							| 
									
										
										
										
											2022-12-03 02:18:48 +00:00
										 |  |  |  | 							</div> | 
					
						
							| 
									
										
										
										
											2022-12-03 14:58:44 +00:00
										 |  |  |  | 							${payload} | 
					
						
							| 
									
										
										
										
											2022-12-03 02:18:48 +00:00
										 |  |  |  | 						`;
 | 
					
						
							| 
									
										
										
										
											2023-08-09 23:39:17 +00:00
										 |  |  |  | 						break; | 
					
						
							|  |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2025-01-01 16:44:16 -05:00
										 |  |  |  | 				return this.render_frame(html`
 | 
					
						
							|  |  |  |  | 					${this.render_header()} | 
					
						
							|  |  |  |  | 					<div>${body}</div> | 
					
						
							|  |  |  |  | 					${this.render_mentions()} ${this.render_votes()} | 
					
						
							|  |  |  |  | 					${this.render_actions()} | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			} else if (content.type === 'pub') { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				return this.render_small_frame( | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 					html` <style>
 | 
					
						
							|  |  |  |  | 							span { | 
					
						
							|  |  |  |  | 								overflow-wrap: anywhere; | 
					
						
							|  |  |  |  | 							} | 
					
						
							|  |  |  |  | 						</style> | 
					
						
							| 
									
										
										
										
											2025-01-14 21:50:38 -05:00
										 |  |  |  | 						<div class="w3-padding"> | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 							<div> | 
					
						
							|  |  |  |  | 								🍻 | 
					
						
							|  |  |  |  | 								<tf-user | 
					
						
							|  |  |  |  | 									.users=${this.users} | 
					
						
							|  |  |  |  | 									id=${content.address.key} | 
					
						
							|  |  |  |  | 								></tf-user> | 
					
						
							|  |  |  |  | 							</div> | 
					
						
							|  |  |  |  | 							<pre>${content.address.host}:${content.address.port}</pre> | 
					
						
							| 
									
										
										
										
											2025-01-14 21:50:38 -05:00
										 |  |  |  | 						</div>` | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2022-12-07 23:37:06 +00:00
										 |  |  |  | 			} else if (content.type === 'channel') { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				return this.render_small_frame(html`
 | 
					
						
							| 
									
										
										
										
											2025-01-02 08:49:24 -05:00
										 |  |  |  | 					<div class="w3-container"> | 
					
						
							| 
									
										
										
										
											2025-01-05 21:43:26 -05:00
										 |  |  |  | 						<p> | 
					
						
							| 
									
										
										
										
											2025-01-11 13:48:06 -05:00
										 |  |  |  | 							${content.subscribed ? 'subscribed to' : 'unsubscribed from'} | 
					
						
							|  |  |  |  | 							<a href=${'#' + encodeURIComponent('#' + content.channel)} | 
					
						
							|  |  |  |  | 								>#${content.channel}</a | 
					
						
							|  |  |  |  | 							> | 
					
						
							| 
									
										
										
										
											2025-01-05 21:43:26 -05:00
										 |  |  |  | 						</p> | 
					
						
							| 
									
										
										
										
											2022-12-07 23:37:06 +00:00
										 |  |  |  | 					</div> | 
					
						
							|  |  |  |  | 				`);
 | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 			} else if (typeof this.message.content == 'string') { | 
					
						
							| 
									
										
										
										
											2023-09-02 02:06:29 +00:00
										 |  |  |  | 				if (this.message?.decrypted) { | 
					
						
							| 
									
										
										
										
											2023-11-08 01:43:58 +00:00
										 |  |  |  | 					if (this.format == 'decrypted') { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 						return this.render_small_frame( | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 							html`<span class="w3-container">🔓</span> ${this.render_json( | 
					
						
							|  |  |  |  | 									this.message.decrypted | 
					
						
							|  |  |  |  | 								)}`
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 						); | 
					
						
							| 
									
										
										
										
											2023-11-08 01:43:58 +00:00
										 |  |  |  | 					} else { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 						return this.render_small_frame( | 
					
						
							| 
									
										
										
										
											2025-01-02 16:11:04 -05:00
										 |  |  |  | 							html`<span class="w3-container">🔓</span>
 | 
					
						
							|  |  |  |  | 								<div class="w3-container">${this.message.decrypted.type}</div>` | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | 						); | 
					
						
							| 
									
										
										
										
											2023-11-08 01:43:58 +00:00
										 |  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2023-05-17 14:10:49 +00:00
										 |  |  |  | 				} else { | 
					
						
							| 
									
										
										
										
											2025-01-02 16:11:04 -05:00
										 |  |  |  | 					return this.render_small_frame(); | 
					
						
							| 
									
										
										
										
											2023-05-17 14:10:49 +00:00
										 |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				return this.render_small_frame( | 
					
						
							| 
									
										
										
										
											2025-02-02 12:27:06 -05:00
										 |  |  |  | 					html`<div class="w3-container">
 | 
					
						
							|  |  |  |  | 						<p><b>type</b>: ${content.type}</p> | 
					
						
							|  |  |  |  | 					</div>` | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 				); | 
					
						
							| 
									
										
										
										
											2022-09-25 12:33:54 +00:00
										 |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-01-04 12:41:04 -05:00
										 |  |  |  | 		} else if (typeof this.message.content == 'string') { | 
					
						
							| 
									
										
										
										
											2025-01-02 16:11:04 -05:00
										 |  |  |  | 			return this.render_small_frame(); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2025-01-01 15:45:11 -05:00
										 |  |  |  | 			return this.render_small_frame(this.render_raw()); | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2025-10-22 19:39:20 -04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	render() { | 
					
						
							|  |  |  |  | 		return html`
 | 
					
						
							|  |  |  |  | 			<style> | 
					
						
							|  |  |  |  | 				${generate_theme()} | 
					
						
							|  |  |  |  | 			</style> | 
					
						
							|  |  |  |  | 			${this._render()} | 
					
						
							|  |  |  |  | 		`;
 | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-06 23:26:43 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-24 11:09:34 -05:00
										 |  |  |  | customElements.define('tf-message', TfMessageElement); |