@@ -1602,19 +1600,18 @@ class ChatPage extends LitElement {
@@ -1624,7 +1621,7 @@ class ChatPage extends LitElement {
{
- this.removeAttachment();
+ this.removeAttachment()
}}
style=${this.attachment && !this.isUploadingAttachment ? "visibility: visible; z-index: 50" : "visibility: hidden; z-index: -100"}>
@@ -1655,18 +1652,18 @@ class ChatPage extends LitElement {
@@ -1685,9 +1682,9 @@ class ChatPage extends LitElement {
{
- this.openForwardOpen = false;
- this.forwardActiveChatHeadUrl = {};
- this.requestUpdate();
+ this.openForwardOpen = false
+ this.forwardActiveChatHeadUrl = {}
+ this.requestUpdate()
}}
style=${this.openForwardOpen ? "display: block" : "display: none"}>
@@ -1705,8 +1702,8 @@ class ChatPage extends LitElement {
placeholder="${translate("chatpage.cchange7")}"
@keydown=${() => {
if (this.forwardActiveChatHeadUrl.selected) {
- this.forwardActiveChatHeadUrl = {};
- this.requestUpdate();
+ this.forwardActiveChatHeadUrl = {}
+ this.requestUpdate()
}
}
}
@@ -1744,10 +1741,10 @@ class ChatPage extends LitElement {
icon="vaadin:close-big"
slot="icon"
@click=${() => {
- this.userFound = [];
- this.forwardActiveChatHeadUrl = {};
- this.requestUpdate();
- this.shadowRoot.getElementById("sendTo").value = "";
+ this.userFound = []
+ this.forwardActiveChatHeadUrl = {}
+ this.requestUpdate()
+ this.shadowRoot.getElementById("sendTo").value = ""
}}>
@@ -1763,8 +1760,8 @@ class ChatPage extends LitElement {
this.forwardActiveChatHeadUrl = {
...this.forwardActiveChatHeadUrl,
url: val
- };
- this.userFound = [];
+ }
+ this.userFound = []
}}
chatInfo=${JSON.stringify(item)}>
`
@@ -1775,9 +1772,9 @@ class ChatPage extends LitElement {
@@ -1799,13 +1796,13 @@ class ChatPage extends LitElement {
url: `direct/${result.owner}`,
name: result.name,
selected: true
- };
- this.userFound = [];
- this.userFoundModalOpen = false;
+ }
+ this.userFound = []
+ this.userFoundModalOpen = false
}}
.closeFunc=${() => {
- this.userFoundModalOpen = false;
- this.userFound = [];
+ this.userFoundModalOpen = false
+ this.userFound = []
}}
.searchResults=${this.userFound}
?isOpen=${this.userFoundModalOpen}
@@ -1816,7 +1813,7 @@ class ChatPage extends LitElement {
{
- this.setOpenTipUser(false);
+ this.setOpenTipUser(false)
}}
zIndex=${55}
style=${this.openTipUser ? "display: block;" : "display: none;"}>
@@ -1828,9 +1825,9 @@ class ChatPage extends LitElement {
{
- this.setOpenUserInfo(false);
- this.setUserName("");
- this.setSelectedHead({});
+ this.setOpenUserInfo(false)
+ this.setUserName("")
+ this.setSelectedHead({})
}}
style=${this.openUserInfo ? "display: block" : "display: none"
}>
@@ -1866,8 +1863,8 @@ class ChatPage extends LitElement {
try {
const getMembers = await parentEpml.request("apiCall", {
type: "api",
- url: `/groups/members/${groupId}?onlyAdmins=false&limit=20&offset=${this.pageNumber * 20}`,
- });
+ url: `/groups/members/${groupId}?onlyAdmins=false&limit=20&offset=${this.pageNumber * 20}`
+ })
const getMembersWithName = (getMembers.members || []).map(async (member) => {
let memberItem = member
@@ -1889,18 +1886,16 @@ class ChatPage extends LitElement {
}
}
-
-
async connectedCallback() {
- super.connectedCallback();
+ super.connectedCallback()
await this.initUpdate()
- this.webWorker = new WebWorker();
- this.webWorkerFile = new WebWorkerFile();
- await this.getUpdateCompleteTextEditor();
+ this.webWorker = new WebWorker()
+ this.webWorkerFile = new WebWorkerFile()
+ await this.getUpdateCompleteTextEditor()
- const elementChatId = this.shadowRoot.getElementById('_chatEditorDOM').shadowRoot.getElementById('_chatEditorDOM');
- const elementChatImageId = this.shadowRoot.getElementById('chatTextCaption').shadowRoot.getElementById('newChat');
- const elementChatAttachmentId = this.shadowRoot.getElementById('chatAttachmentId').shadowRoot.getElementById('newAttachmentChat');
+ const elementChatId = this.shadowRoot.getElementById('_chatEditorDOM').shadowRoot.getElementById('_chatEditorDOM')
+ const elementChatImageId = this.shadowRoot.getElementById('chatTextCaption').shadowRoot.getElementById('newChat')
+ const elementChatAttachmentId = this.shadowRoot.getElementById('chatAttachmentId').shadowRoot.getElementById('newAttachmentChat')
this.editor = new Editor({
onUpdate: () => {
this.shadowRoot.getElementById('_chatEditorDOM').getMessageSize(this.editor.getJSON())
@@ -1933,10 +1928,7 @@ class ChatPage extends LitElement {
this.editor.commands.newlineInCode()
])
}
-
}
-
-
}
}
})
@@ -1998,8 +1990,10 @@ class ChatPage extends LitElement {
})
]
})
- document.addEventListener('keydown', this.initialChat);
- document.addEventListener('paste', this.pasteImage);
+
+ document.addEventListener('keydown', this.initialChat)
+ document.addEventListener('paste', this.pasteImage)
+
if (this.chatId) {
window.parent.reduxStore.dispatch(window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
@@ -2022,33 +2016,33 @@ class ChatPage extends LitElement {
} else {
this.isPageVisible = false
}
- });
- };
+ })
+ }
let options = {
root: null,
rootMargin: '0px',
threshold: 0.5
- };
+ }
// Create the observer with the callback function and options
- this.observer = new IntersectionObserver(callback, options);
+ this.observer = new IntersectionObserver(callback, options)
const mainContainer = this.shadowRoot.querySelector('.main-container')
- this.observer.observe(mainContainer);
+ this.observer.observe(mainContainer)
}
disconnectedCallback() {
- super.disconnectedCallback();
+ super.disconnectedCallback()
if (this.webSocket) {
this.webSocket.close(1000, 'switch chat')
this.webSocket = ''
}
if (this.webWorker) {
- this.webWorker.terminate();
+ this.webWorker.terminate()
}
if (this.webWorkerFile) {
- this.webWorkerFile.terminate();
+ this.webWorkerFile.terminate()
}
if (this.editor) {
this.editor.destroy()
@@ -2057,19 +2051,18 @@ class ChatPage extends LitElement {
this.editorImage.destroy()
}
if (this.observer) {
- this.observer.disconnect();
+ this.observer.disconnect()
}
- document.removeEventListener('keydown', this.initialChat);
- document.removeEventListener('paste', this.pasteImage);
+ document.removeEventListener('keydown', this.initialChat)
+ document.removeEventListener('paste', this.pasteImage)
+
if (this.chatId) {
window.parent.reduxStore.dispatch(window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
timestamp: Date.now()
}))
-
}
-
}
initialChat(e) {
@@ -2085,43 +2078,41 @@ class ChatPage extends LitElement {
}
}
-
async pasteImage(e) {
- const event = e;
+ const event = e
const handleTransferIntoURL = (dataTransfer) => {
try {
- const [firstItem] = dataTransfer.items;
- const blob = firstItem.getAsFile();
- return blob;
+ const [firstItem] = dataTransfer.items
+ const blob = firstItem.getAsFile()
+ return blob
} catch (error) {
- console.log(error);
}
}
if (event.clipboardData) {
const blobFound = handleTransferIntoURL(event.clipboardData)
if (blobFound) {
- this.insertImage(blobFound);
- return;
+ this.insertImage(blobFound)
+ return
} else {
- const item_list = await navigator.clipboard.read();
- let image_type;
+ const item_list = await navigator.clipboard.read()
+ let image_type
const item = item_list.find(item =>
item.types.some(type => {
if (type.startsWith('image/')) {
- image_type = type;
- return true;
+ image_type = type
+ return true
}
})
- );
+ )
if (item) {
try {
- const blob = item && await item.getType(image_type);
+ const blob = item && await item.getType(image_type)
let file = new File([blob], "name", {
type: image_type
- });
- this.insertImage(file);
+ })
+ this.insertImage(file)
} catch (error) {
- console.error(error);
+ console.error(error)
let errorMsg = get("chatpage.cchange81")
parentEpml.request('showSnackBar', `${errorMsg}`)
}
@@ -2145,18 +2136,15 @@ class ChatPage extends LitElement {
findElement.classList.remove('blink-bg')
}, 2000)
}
-
return
}
+
if ((message.timestamp - this.messagesRendered[0].timestamp) > 86400000) {
let errorMsg = get("chatpage.cchange66")
parentEpml.request('showSnackBar', `${errorMsg}`)
return
}
-
-
-
if ((message.timestamp - this.messagesRendered[0].timestamp) < 86400000) {
const findOriginalMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(clickedOnMessage.signature)
if (findOriginalMessage) {
@@ -2195,16 +2183,15 @@ class ChatPage extends LitElement {
parentEpml.request('showSnackBar', `${errorMsg}`)
}
-
}
async userSearch() {
- const nameValue = this.shadowRoot.getElementById('sendTo').value;
+ const nameValue = this.shadowRoot.getElementById('sendTo').value
if (!nameValue) {
- this.userFound = [];
- this.userFoundModalOpen = false;
- this.loading = false;
- return;
+ this.userFound = []
+ this.userFoundModalOpen = false
+ this.loading = false
+ return
}
try {
const result = await parentEpml.request('apiCall', {
@@ -2212,19 +2199,18 @@ class ChatPage extends LitElement {
url: `/names/${nameValue}`
})
if (result.error === 401) {
- this.loading = false;
- this.userFound = [];
- this.loading = false;
+ this.userFound = []
+ this.loading = false
} else {
this.userFound = [
...this.userFound,
result,
- ];
+ ]
}
- this.userFoundModalOpen = true;
+ this.userFoundModalOpen = true
} catch (error) {
- this.loading = false;
- let err4string = get("chatpage.cchange35");
+ this.loading = false
+ let err4string = get("chatpage.cchange35")
parentEpml.request('showSnackBar', `${err4string}`)
}
}
@@ -2235,12 +2221,12 @@ class ChatPage extends LitElement {
}
async sendForwardMessage() {
- let parsedMessageObj = {};
+ let parsedMessageObj = {}
try {
- parsedMessageObj = JSON.parse(this.forwardedMessage);
+ parsedMessageObj = JSON.parse(this.forwardedMessage)
}
catch (error) {
- parsedMessageObj = {};
+ parsedMessageObj = {}
}
try {
@@ -2249,45 +2235,43 @@ class ChatPage extends LitElement {
type: 'forward'
}
delete message.reactions
- const stringifyMessageObject = JSON.stringify(message);
+ const stringifyMessageObject = JSON.stringify(message)
this.sendMessage(stringifyMessageObject, undefined, '', true)
} catch (error) {
}
}
showLastMessageRefScroller(props) {
- this.lastMessageRefVisible = props;
+ this.lastMessageRefVisible = props
}
-
insertFile(file) {
if (file.type.includes('image')) {
- this.imageFile = file;
- this.currentEditor = 'newChat';
- return;
+ this.imageFile = file
+ this.currentEditor = 'newChat'
+ return
} else {
- this.attachment = file;
- this.currentEditor = "newAttachmentChat";
- return;
+ this.attachment = file
+ this.currentEditor = "newAttachmentChat"
+ return
}
- // parentEpml.request('showSnackBar', get("chatpage.cchange28"));
}
removeImage() {
- this.imageFile = null;
- this.resetChatEditor();
- this.currentEditor = '_chatEditorDOM';
+ this.imageFile = null
+ this.resetChatEditor()
+ this.currentEditor = '_chatEditorDOM'
}
removeAttachment() {
- this.attachment = null;
- this.resetChatEditor();
- this.currentEditor = '_chatEditorDOM';
+ this.attachment = null
+ this.resetChatEditor()
+ this.currentEditor = '_chatEditorDOM'
}
changeMsgInput(id) {
- this.chatMessageInput = this.shadowRoot.getElementById(id);
- this.initChatEditor();
+ this.chatMessageInput = this.shadowRoot.getElementById(id)
+ this.initChatEditor()
}
async initUpdate() {
@@ -2316,41 +2300,44 @@ class ChatPage extends LitElement {
this.fetchChatMessages(this._chatId)
}
})
- };
+ }
setTimeout(() => {
- const isRecipient = this.chatId.includes('direct') === true ? true : false;
- this.chatId.includes('direct') === true ? this.isReceipient = true : this.isReceipient = false;
- this._chatId = this.chatId.split('/')[1];
- const mstring = get("chatpage.cchange8");
- const placeholder = isRecipient === true ? `Message ${this._chatId}` : `${mstring}`;
- this.chatEditorPlaceholder = placeholder;
+ const isRecipient = this.chatId.includes('direct') === true ? true : false
+ this.chatId.includes('direct') === true ? this.isReceipient = true : this.isReceipient = false
+ this._chatId = this.chatId.split('/')[1]
+ const mstring = get("chatpage.cchange8")
+ const placeholder = isRecipient === true ? `Message ${this._chatId}` : `${mstring}`
+ this.chatEditorPlaceholder = placeholder
- isRecipient ? getAddressPublicKey() : this.fetchChatMessages(this._chatId);
+ isRecipient ? getAddressPublicKey() : this.fetchChatMessages(this._chatId)
// Init ChatEditor
- // this.initChatEditor();
+ // this.initChatEditor()
}, 100)
- const isRecipient = this.chatId.includes('direct') === true ? true : false;
- const groupId = this.chatId.split('/')[1];
+ const isRecipient = this.chatId.includes('direct') === true ? true : false
+ const groupId = this.chatId.split('/')[1]
if (!isRecipient && groupId.toString() !== '0') {
try {
const getMembers = await parentEpml.request("apiCall", {
type: "api",
- url: `/groups/members/${groupId}?onlyAdmins=false&limit=20&offset=0`,
- });
+ url: `/groups/members/${groupId}?onlyAdmins=false&limit=20&offset=0`
+ })
+
const getMembersAdmins = await parentEpml.request("apiCall", {
type: "api",
- url: `/groups/members/${groupId}?onlyAdmins=true&limit=20`,
- });
+ url: `/groups/members/${groupId}?onlyAdmins=true&limit=20`
+ })
+
const getGroupInfo = await parentEpml.request("apiCall", {
type: "api",
- url: `/groups/${groupId}`,
- });
+ url: `/groups/${groupId}`
+ })
+
const getMembersAdminsWithName = (getMembersAdmins.members || []).map(async (member) => {
let memberItem = member
try {
@@ -2361,10 +2348,11 @@ class ChatPage extends LitElement {
}
} catch (error) {
}
-
return memberItem
})
+
const membersAdminsWithName = await Promise.all(getMembersAdminsWithName)
+
const getMembersWithName = (getMembers.members || []).map(async (member) => {
let memberItem = member
try {
@@ -2375,7 +2363,6 @@ class ChatPage extends LitElement {
}
} catch (error) {
}
-
return memberItem
})
const membersWithName = await Promise.all(getMembersWithName)
@@ -2385,15 +2372,23 @@ class ChatPage extends LitElement {
} catch (error) {
}
}
-
-
}
async firstUpdated() {
+ this.changeTheme()
+
window.addEventListener('storage', () => {
- const checkLanguage = localStorage.getItem('qortalLanguage');
- use(checkLanguage);
- this.userLanguage = checkLanguage;
+ const checkLanguage = localStorage.getItem('qortalLanguage')
+ const checkTheme = localStorage.getItem('qortalTheme')
+
+ this.userLanguage = checkLanguage
+
+ if (checkTheme === 'dark') {
+ this.theme = 'dark'
+ } else {
+ this.theme = 'light'
+ }
+ document.querySelector('html').setAttribute('theme', this.theme)
})
parentEpml.ready().then(() => {
@@ -2408,9 +2403,8 @@ class ChatPage extends LitElement {
}).then(res => {
this.balance = res
})
-
})
- parentEpml.imReady();
+ parentEpml.imReady()
const isEnabledChatEnter = localStorage.getItem('isEnabledChatEnter')
@@ -2420,17 +2414,25 @@ class ChatPage extends LitElement {
}
+ changeTheme() {
+ const checkTheme = localStorage.getItem('qortalTheme')
+ if (checkTheme === 'dark') {
+ this.theme = 'dark'
+ } else {
+ this.theme = 'light'
+ }
+ document.querySelector('html').setAttribute('theme', this.theme)
+ }
+
async updated(changedProperties) {
if (changedProperties && changedProperties.has('userLanguage')) {
const userLang = changedProperties.get('userLanguage')
if (userLang) {
- await new Promise(r => setTimeout(r, 100));
- this.chatEditorPlaceholder = this.isReceipient === true ? `Message ${this._chatId}` : `${get("chatpage.cchange8")}`;
+ await new Promise(r => setTimeout(r, 100))
+ this.chatEditorPlaceholder = this.isReceipient === true ? `Message ${this._chatId}` : `${get("chatpage.cchange8")}`
}
}
-
-
if (changedProperties && changedProperties.has('isLoading')) {
if (this.isLoading === true && this.currentEditor === '_chatEditorDOM' && this.editor && this.editor.setEditable) {
this.editor.setEditable(false)
@@ -2445,8 +2447,8 @@ class ChatPage extends LitElement {
try {
const getNames = await parentEpml.request("apiCall", {
type: "api",
- url: `/names/address/${recipient}`,
- });
+ url: `/names/address/${recipient}`
+ })
if (Array.isArray(getNames) && getNames.length > 0) {
return getNames[0].name
@@ -2464,8 +2466,8 @@ class ChatPage extends LitElement {
try {
const getNames = await parentEpml.request("apiCall", {
type: "api",
- url: `/names/address/${recipient}`,
- });
+ url: `/names/address/${recipient}`
+ })
if (Array.isArray(getNames) && getNames.length > 0) {
return getNames[0].name
@@ -2479,65 +2481,66 @@ class ChatPage extends LitElement {
}
let userName = ""
if (this.isReceipient) {
- userName = await getName(this._chatId);
+ userName = await getName(this._chatId)
}
- const mstring = get("chatpage.cchange8");
- const placeholder = this.isReceipient === true ? `Message ${userName ? userName : this._chatId}` : `${mstring}`;
- return placeholder;
+ const mstring = get("chatpage.cchange8")
+ const placeholder = this.isReceipient === true ? `Message ${userName ? userName : this._chatId}` : `${mstring}`
+ return placeholder
}
renderChatScroller() {
return html`
this.setRepliedToMessageObj(val)}
- .setEditedMessageObj=${(val) => this.setEditedMessageObj(val)}
- .sendMessage=${(val) => this._sendMessage(val)}
- .sendMessageForward=${(messageText, typeMessage, chatReference, isForward, forwardParams) => this.sendMessage(messageText, typeMessage, chatReference, isForward, forwardParams)}
- .showLastMessageRefScroller=${(val) => this.showLastMessageRefScroller(val)}
- .emojiPicker=${this.emojiPicker}
- ?isLoadingMessages=${this.isLoadingOldMessages}
- .setIsLoadingMessages=${(val) => this.setIsLoadingMessages(val)}
- .setForwardProperties=${(forwardedMessage) => this.setForwardProperties(forwardedMessage)}
- .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
- .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
- .setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
- .setUserName=${(val) => this.setUserName(val)}
- .setSelectedHead=${(val) => this.setSelectedHead(val)}
- ?openTipUser=${this.openTipUser}
- .selectedHead=${this.selectedHead}
- .goToRepliedMessage=${(val, val2) => this.goToRepliedMessage(val, val2)}
- .getOldMessageAfter=${(val) => this.getOldMessageAfter(val)}
+ chatId=${this.chatId}
+ .messages=${this.messagesRendered}
+ .escapeHTML=${escape}
+ .getOldMessage=${this.getOldMessage}
+ .setRepliedToMessageObj=${(val) => this.setRepliedToMessageObj(val)}
+ .setEditedMessageObj=${(val) => this.setEditedMessageObj(val)}
+ .sendMessage=${(val) => this._sendMessage(val)}
+ .sendMessageForward=${(messageText, typeMessage, chatReference, isForward, forwardParams) => this.sendMessage(messageText, typeMessage, chatReference, isForward, forwardParams)}
+ .showLastMessageRefScroller=${(val) => this.showLastMessageRefScroller(val)}
+ .emojiPicker=${this.emojiPicker}
+ ?isLoadingMessages=${this.isLoadingOldMessages}
+ .setIsLoadingMessages=${(val) => this.setIsLoadingMessages(val)}
+ .setForwardProperties=${(forwardedMessage) => this.setForwardProperties(forwardedMessage)}
+ .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)}
+ .setOpenTipUser=${(val) => this.setOpenTipUser(val)}
+ .setOpenUserInfo=${(val) => this.setOpenUserInfo(val)}
+ .setUserName=${(val) => this.setUserName(val)}
+ .setSelectedHead=${(val) => this.setSelectedHead(val)}
+ ?openTipUser=${this.openTipUser}
+ .selectedHead=${this.selectedHead}
+ .goToRepliedMessage=${(val, val2) => this.goToRepliedMessage(val, val2)}
+ .getOldMessageAfter=${(val) => this.getOldMessageAfter(val)}
>
`
}
+
setIsLoadingMessages(val) {
this.isLoadingOldMessages = val
}
+
async getUpdateComplete() {
- await super.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelectorAll('chat-scroller'));
- await Promise.all(marginElements.map(el => el.updateComplete));
- return true;
+ await super.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelectorAll('chat-scroller'))
+ await Promise.all(marginElements.map(el => el.updateComplete))
+ return true
}
async getUpdateCompleteTextEditor() {
- await super.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelectorAll('chat-text-editor'));
- await Promise.all(marginElements.map(el => el.updateComplete));
- const marginElements2 = Array.from(this.shadowRoot.querySelectorAll('wrapper-modal'));
- await Promise.all(marginElements2.map(el => el.updateComplete));
- return true;
+ await super.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelectorAll('chat-text-editor'))
+ await Promise.all(marginElements.map(el => el.updateComplete))
+ const marginElements2 = Array.from(this.shadowRoot.querySelectorAll('wrapper-modal'))
+ await Promise.all(marginElements2.map(el => el.updateComplete))
+ return true
}
updatePlaceholder(editor, text) {
editor.extensionManager.extensions.forEach((extension) => {
if (extension.name === "placeholder") {
-
extension.options["placeholder"] = text
editor.commands.focus('end')
}
@@ -2549,14 +2552,13 @@ class ChatPage extends LitElement {
if (this.isReceipient) {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=${limit}&reverse=true&before=${before}&after=${after}&haschatreference=false&encoding=BASE64`,
- });
+ url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=${limit}&reverse=true&before=${before}&after=${after}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
})
-
const replacedMessages = await replaceMessagesEdited({
decodedMessages: decodeMsgs,
parentEpml,
@@ -2564,28 +2566,24 @@ class ChatPage extends LitElement {
decodeMessageFunc: this.decodeMessage,
_publicKey: this._publicKey
})
+
this.messagesRendered = [...replacedMessages, ...this.messagesRendered].sort(function (a, b) {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement');
+ await this.getUpdateComplete()
+ const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement')
if (viewElement) {
viewElement.scrollTop = 200
}
-
-
-
-
-
} else {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=${limit}&reverse=true&before=${before}&after=${after}&haschatreference=false&encoding=BASE64`,
- });
-
+ url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=${limit}&reverse=true&before=${before}&after=${after}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
@@ -2603,35 +2601,28 @@ class ChatPage extends LitElement {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement');
+ await this.getUpdateComplete()
+ const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement')
if (viewElement) {
viewElement.scrollTop = 200
}
-
-
-
-
-
}
}
-
async getOldMessage(scrollElement) {
-
if (this.isReceipient) {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=20&reverse=true&before=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`,
- });
+ url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=20&reverse=true&before=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
})
-
const replacedMessages = await replaceMessagesEdited({
decodedMessages: decodeMsgs,
parentEpml,
@@ -2639,27 +2630,26 @@ class ChatPage extends LitElement {
decodeMessageFunc: this.decodeMessage,
_publicKey: this._publicKey
})
+
this.messagesRendered = [...replacedMessages, ...this.messagesRendered].sort(function (a, b) {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
+ await this.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'))
const findElement = marginElements.find((item) => item.messageObj.signature === scrollElement.messageObj.signature)
if (findElement) {
- findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
+ findElement.scrollIntoView({ behavior: 'auto', block: 'center' })
}
-
-
} else {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=20&reverse=true&before=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`,
- });
-
+ url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=20&reverse=true&before=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
@@ -2677,32 +2667,29 @@ class ChatPage extends LitElement {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
+ await this.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'))
const findElement = marginElements.find((item) => item.messageObj.signature === scrollElement.messageObj.signature)
if (findElement) {
- findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
+ findElement.scrollIntoView({ behavior: 'auto', block: 'center' })
}
-
-
}
}
async getOldMessageAfter(scrollElement) {
-
if (this.isReceipient) {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=20&reverse=true&afer=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`,
- });
+ url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=20&reverse=true&afer=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
})
-
const replacedMessages = await replaceMessagesEdited({
decodedMessages: decodeMsgs,
parentEpml,
@@ -2710,27 +2697,26 @@ class ChatPage extends LitElement {
decodeMessageFunc: this.decodeMessage,
_publicKey: this._publicKey
})
+
this.messagesRendered = [...this.messagesRendered, ...replacedMessages].sort(function (a, b) {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
+ await this.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'))
const findElement = marginElements.find((item) => item.messageObj.signature === scrollElement.messageObj.signature)
if (findElement) {
- findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
+ findElement.scrollIntoView({ behavior: 'auto', block: 'center' })
}
-
-
} else {
const getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=20&reverse=true&after=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`,
- });
-
+ url: `/chat/messages?txGroupId=${Number(this._chatId)}&limit=20&reverse=true&after=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`
+ })
const decodeMsgs = getInitialMessages.map((eachMessage) => {
return this.decodeMessage(eachMessage)
@@ -2748,16 +2734,15 @@ class ChatPage extends LitElement {
return a.timestamp
- b.timestamp
})
+
this.isLoadingOldMessages = false
- await this.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'));
+ await this.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template'))
const findElement = marginElements.find((item) => item.messageObj.signature === scrollElement.messageObj.signature)
if (findElement) {
- findElement.scrollIntoView({ behavior: 'auto', block: 'center' });
+ findElement.scrollIntoView({ behavior: 'auto', block: 'center' })
}
-
-
}
}
@@ -2776,7 +2761,7 @@ class ChatPage extends LitElement {
}
})
if (isInitial) {
- this.chatEditorPlaceholder = await this.renderPlaceholder();
+ this.chatEditorPlaceholder = await this.renderPlaceholder()
const replacedMessages = await replaceMessagesEdited({
decodedMessages: decodedMessages,
parentEpml,
@@ -2791,10 +2776,10 @@ class ChatPage extends LitElement {
})
// TODO: Determine number of initial messages by screen height...
- this.messagesRendered = this._messages;
- this.isLoadingMessages = false;
+ this.messagesRendered = this._messages
+ this.isLoadingMessages = false
- setTimeout(() => this.downElementObserver(), 500);
+ setTimeout(() => this.downElementObserver(), 500)
} else {
const replacedMessages = await replaceMessagesEdited({
decodedMessages: decodedMessages,
@@ -2808,7 +2793,9 @@ class ChatPage extends LitElement {
const renderEachMessage = replacedMessages.map(async (msg) => {
await this.renderNewMessage(msg)
})
+
await Promise.all(renderEachMessage)
+
if (this.chatId && this.isPageVisible) {
window.parent.reduxStore.dispatch(window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
@@ -2828,33 +2815,31 @@ class ChatPage extends LitElement {
setRepliedToMessageObj(messageObj) {
this.editor.commands.focus('end')
- this.repliedToMessageObj = { ...messageObj };
- this.editedMessageObj = null;
- this.requestUpdate();
+ this.repliedToMessageObj = { ...messageObj }
+ this.editedMessageObj = null
+ this.requestUpdate()
}
// set edited message in chat editor
setEditedMessageObj(messageObj) {
this.editor.commands.focus('end')
- this.editedMessageObj = { ...messageObj };
- this.repliedToMessageObj = null;
- this.requestUpdate();
+ this.editedMessageObj = { ...messageObj }
+ this.repliedToMessageObj = null
+ this.requestUpdate()
}
closeEditMessageContainer() {
- this.editedMessageObj = null;
- this.isEditMessageOpen = !this.isEditMessageOpen;
+ this.editedMessageObj = null
+ this.isEditMessageOpen = !this.isEditMessageOpen
this.editor.commands.setContent('')
}
closeRepliedToContainer() {
- this.repliedToMessageObj = null;
- this.requestUpdate();
+ this.repliedToMessageObj = null
+ this.requestUpdate()
}
-
-
/**
* New Message Template implementation, takes in a message object.
* @param { Object } messageObj
@@ -2872,32 +2857,32 @@ class ChatPage extends LitElement {
sender: newMessagesRendered[findOriginalMessageIndex].sender, editedTimestamp: newMessage.timestamp
}
this.messagesRendered = newMessagesRendered
- await this.getUpdateComplete();
+ await this.getUpdateComplete()
}
-
return
}
- const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement');
+
+ const viewElement = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement')
if (newMessage.sender === this.selectedAddress.address) {
this.messagesRendered = [...this.messagesRendered, newMessage]
- await this.getUpdateComplete();
+ await this.getUpdateComplete()
- viewElement.scrollTop = viewElement.scrollHeight;
+ viewElement.scrollTop = viewElement.scrollHeight
} else if (this.isUserDown) {
// Append the message and scroll to the bottom if user is down the page
this.messagesRendered = [...this.messagesRendered, newMessage]
- await this.getUpdateComplete();
+ await this.getUpdateComplete()
- viewElement.scrollTop = viewElement.scrollHeight;
+ viewElement.scrollTop = viewElement.scrollHeight
} else {
this.messagesRendered = [...this.messagesRendered, newMessage]
- await this.getUpdateComplete();
+ await this.getUpdateComplete()
- this.showNewMessageBar();
+ this.showNewMessageBar()
}
}
@@ -2907,41 +2892,39 @@ class ChatPage extends LitElement {
*
*/
decodeMessage(encodedMessageObj, isReceipient, _publicKey) {
- let isReceipientVar;
- let _publicKeyVar;
+ let isReceipientVar
+ let _publicKeyVar
try {
- isReceipientVar = this.isReceipient === undefined ? isReceipient : this.isReceipient;
- _publicKeyVar = this._publicKey === undefined ? _publicKey : this._publicKey;
+ isReceipientVar = this.isReceipient === undefined ? isReceipient : this.isReceipient
+ _publicKeyVar = this._publicKey === undefined ? _publicKey : this._publicKey
} catch (error) {
- isReceipientVar = isReceipient;
- _publicKeyVar = _publicKey;
+ isReceipientVar = isReceipient
+ _publicKeyVar = _publicKey
}
- let decodedMessageObj = {};
+ let decodedMessageObj = {}
if (isReceipientVar === true) {
// direct chat
if (encodedMessageObj.isEncrypted === true && _publicKeyVar.hasPubKey === true && encodedMessageObj.data) {
- let decodedMessage = window.parent.decryptChatMessageBase64(encodedMessageObj.data, window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey, _publicKeyVar.key, encodedMessageObj.reference);
- decodedMessageObj = { ...encodedMessageObj, decodedMessage };
+ let decodedMessage = window.parent.decryptChatMessageBase64(encodedMessageObj.data, window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey, _publicKeyVar.key, encodedMessageObj.reference)
+ decodedMessageObj = { ...encodedMessageObj, decodedMessage }
} else if (encodedMessageObj.isEncrypted === false && encodedMessageObj.data) {
- let decodedMessage = window.parent.Base64.decode(encodedMessageObj.data);
- decodedMessageObj = { ...encodedMessageObj, decodedMessage };
+ let decodedMessage = window.parent.Base64.decode(encodedMessageObj.data)
+ decodedMessageObj = { ...encodedMessageObj, decodedMessage }
} else {
- decodedMessageObj = { ...encodedMessageObj, decodedMessage: "Cannot Decrypt Message!" };
+ decodedMessageObj = { ...encodedMessageObj, decodedMessage: "Cannot Decrypt Message!" }
}
} else {
// group chat
- let decodedMessage = window.parent.Base64.decode(encodedMessageObj.data);
- decodedMessageObj = { ...encodedMessageObj, decodedMessage };
+ let decodedMessage = window.parent.Base64.decode(encodedMessageObj.data)
+ decodedMessageObj = { ...encodedMessageObj, decodedMessage }
}
-
- return decodedMessageObj;
+ return decodedMessageObj
}
async fetchChatMessages(chatId) {
-
const initDirect = async (cid, noInitial) => {
let timeoutId
let initial = 0
@@ -2954,15 +2937,13 @@ class ChatPage extends LitElement {
let directSocketLink
if (window.parent.location.protocol === "https:") {
-
- directSocketLink = `wss://${nodeUrl}/websockets/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&encoding=BASE64&limit=1`;
+ directSocketLink = `wss://${nodeUrl}/websockets/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&encoding=BASE64&limit=1`
} else {
-
// Fallback to http
- directSocketLink = `ws://${nodeUrl}/websockets/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&encoding=BASE64&limit=1`;
+ directSocketLink = `ws://${nodeUrl}/websockets/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&encoding=BASE64&limit=1`
}
- this.webSocket = new WebSocket(directSocketLink);
+ this.webSocket = new WebSocket(directSocketLink)
// Open Connection
this.webSocket.onopen = () => {
setTimeout(pingDirectSocket, 50)
@@ -2971,7 +2952,7 @@ class ChatPage extends LitElement {
// Message Event
this.webSocket.onmessage = async (e) => {
if (e.data === 'pong') {
- clearTimeout(timeoutId);
+ clearTimeout(timeoutId)
directSocketTimeout = setTimeout(pingDirectSocket, 45000)
return
}
@@ -2983,16 +2964,14 @@ class ChatPage extends LitElement {
const lastMessage = cachedData[cachedData.length - 1]
const newMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&limit=20&reverse=true&after=${lastMessage.timestamp}&haschatreference=false&encoding=BASE64`,
- });
+ url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&limit=20&reverse=true&after=${lastMessage.timestamp}&haschatreference=false&encoding=BASE64`
+ })
getInitialMessages = [...cachedData, ...newMessages].slice(-20)
} else {
getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&limit=20&reverse=true&haschatreference=false&encoding=BASE64`,
- });
-
-
+ url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&limit=20&reverse=true&haschatreference=false&encoding=BASE64`
+ })
}
this.processMessages(getInitialMessages, true)
@@ -3005,10 +2984,7 @@ class ChatPage extends LitElement {
this.processMessages(JSON.parse(e.data), false)
}
} catch (error) {
-
}
-
-
}
}
@@ -3027,17 +3003,17 @@ class ChatPage extends LitElement {
const pingDirectSocket = () => {
this.webSocket.send('ping')
timeoutId = setTimeout(() => {
- this.webSocket.close();
+ this.webSocket.close()
clearTimeout(directSocketTimeout)
- }, 5000);
+ }, 5000)
}
+ }
-
- };
const restartDirectWebSocket = () => {
const noInitial = true
setTimeout(() => initDirect(chatId, noInitial), 50)
}
+
const restartGroupWebSocket = () => {
const noInitial = true
let groupChatId = Number(chatId)
@@ -3058,32 +3034,29 @@ class ChatPage extends LitElement {
let groupSocketLink
if (window.parent.location.protocol === "https:") {
-
- groupSocketLink = `wss://${nodeUrl}/websockets/chat/messages?txGroupId=${groupId}&encoding=BASE64&limit=1`;
+ groupSocketLink = `wss://${nodeUrl}/websockets/chat/messages?txGroupId=${groupId}&encoding=BASE64&limit=1`
} else {
-
// Fallback to http
- groupSocketLink = `ws://${nodeUrl}/websockets/chat/messages?txGroupId=${groupId}&encoding=BASE64&limit=1`;
+ groupSocketLink = `ws://${nodeUrl}/websockets/chat/messages?txGroupId=${groupId}&encoding=BASE64&limit=1`
}
- this.webSocket = new WebSocket(groupSocketLink);
+ this.webSocket = new WebSocket(groupSocketLink)
// Open Connection
this.webSocket.onopen = () => {
-
setTimeout(pingGroupSocket, 50)
}
// Message Event
this.webSocket.onmessage = async (e) => {
if (e.data === 'pong') {
- clearTimeout(timeoutId);
+ clearTimeout(timeoutId)
groupSocketTimeout = setTimeout(pingGroupSocket, 45000)
return
}
if (initial === 0) {
if (noInitial) return
- const cachedData = null;
+ const cachedData = null
let getInitialMessages = []
if (cachedData && cachedData.length !== 0) {
@@ -3091,18 +3064,16 @@ class ChatPage extends LitElement {
const newMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?txGroupId=${groupId}&limit=20&reverse=true&after=${lastMessage.timestamp}&haschatreference=false&encoding=BASE64`,
- });
+ url: `/chat/messages?txGroupId=${groupId}&limit=20&reverse=true&after=${lastMessage.timestamp}&haschatreference=false&encoding=BASE64`
+ })
getInitialMessages = [...cachedData, ...newMessages].slice(-20)
} else {
getInitialMessages = await parentEpml.request('apiCall', {
type: 'api',
- url: `/chat/messages?txGroupId=${groupId}&limit=20&reverse=true&haschatreference=false&encoding=BASE64`,
- });
-
+ url: `/chat/messages?txGroupId=${groupId}&limit=20&reverse=true&haschatreference=false&encoding=BASE64`
+ })
}
-
this.processMessages(getInitialMessages, true)
initial = initial + 1
@@ -3112,10 +3083,7 @@ class ChatPage extends LitElement {
this.processMessages(JSON.parse(e.data), false)
}
} catch (error) {
-
}
-
-
}
}
@@ -3129,33 +3097,28 @@ class ChatPage extends LitElement {
// Error Event
this.webSocket.onerror = () => {
clearTimeout(groupSocketTimeout)
- this.webSocket.close();
+ this.webSocket.close()
}
const pingGroupSocket = () => {
this.webSocket.send('ping')
timeoutId = setTimeout(() => {
- this.webSocket.close();
+ this.webSocket.close()
clearTimeout(groupSocketTimeout)
- }, 5000); // Close the WebSocket connection if no pong message is received within 5 seconds.
+ }, 5000) // Close the WebSocket connection if no pong message is received within 5 seconds.
}
-
- };
-
+ }
if (chatId !== undefined) {
-
if (this.isReceipient) {
initDirect(chatId)
} else {
let groupChatId = Number(chatId)
initGroup(groupChatId)
}
-
} else {
// ... Render a nice "Error, Go Back" component.
}
-
// Add to the messages... TODO: Save messages to localstorage and fetch from it to make it persistent...
}
@@ -3196,7 +3159,7 @@ class ChatPage extends LitElement {
}
if (!hasPublicKey || !this._publicKey.hasPubKey) {
- let err4string = get("chatpage.cchange39");
+ let err4string = get("chatpage.cchange39")
parentEpml.request('showSnackBar', `${err4string}`)
return
}
@@ -3209,16 +3172,16 @@ class ChatPage extends LitElement {
// need whole original message object, transform the data and put it in local storage
// create new var called repliedToData and use that to modify the UI
// find specific object property in local
- let typeMessage = 'regular';
- this.isLoading = true;
+ let typeMessage = 'regular'
+ this.isLoading = true
const trimmedMessage = msg
const getName = async (recipient) => {
try {
const getNames = await parentEpml.request("apiCall", {
type: "api",
- url: `/names/address/${recipient}`,
- });
+ url: `/names/address/${recipient}`
+ })
if (Array.isArray(getNames) && getNames.length > 0) {
return getNames[0].name
@@ -3236,35 +3199,35 @@ class ChatPage extends LitElement {
const userName = outSideMsg.name
const identifier = outSideMsg.identifier
let compressedFile = ''
- var str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg==";
+ var str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg=="
if (this.webWorkerFile) {
- this.webWorkerFile.terminate();
- this.webWorkerFile = null;
+ this.webWorkerFile.terminate()
+ this.webWorkerFile = null
}
- this.webWorkerFile = new WebWorkerFile();
+ this.webWorkerFile = new WebWorkerFile()
const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => {
- const byteCharacters = atob(b64Data);
- const byteArrays = [];
+ const byteCharacters = atob(b64Data)
+ const byteArrays = []
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
- const slice = byteCharacters.slice(offset, offset + sliceSize);
+ const slice = byteCharacters.slice(offset, offset + sliceSize)
- const byteNumbers = new Array(slice.length);
+ const byteNumbers = new Array(slice.length)
for (let i = 0; i < slice.length; i++) {
- byteNumbers[i] = slice.charCodeAt(i);
+ byteNumbers[i] = slice.charCodeAt(i)
}
- const byteArray = new Uint8Array(byteNumbers);
- byteArrays.push(byteArray);
+ const byteArray = new Uint8Array(byteNumbers)
+ byteArrays.push(byteArray)
}
- const blob = new Blob(byteArrays, { type: contentType });
- return blob;
+ const blob = new Blob(byteArrays, { type: contentType })
+ return blob
}
- const blob = b64toBlob(str, 'image/png');
+ const blob = b64toBlob(str, 'image/png')
await new Promise(resolve => {
new Compressor(blob, {
quality: 0.6,
@@ -3272,13 +3235,12 @@ class ChatPage extends LitElement {
success(result) {
const file = new File([result], "name", {
type: 'image/png'
- });
+ })
- compressedFile = file;
- resolve();
+ compressedFile = file
+ resolve()
},
error(err) {
- console.log(err.message);
},
})
})
@@ -3296,65 +3258,64 @@ class ChatPage extends LitElement {
})
this.isDeletingImage = false
} catch (error) {
- this.isLoading = false;
+ this.isLoading = false
return
}
- typeMessage = 'edit';
- let chatReference = outSideMsg.editedMessageObj.signature;
+ typeMessage = 'edit'
+ let chatReference = outSideMsg.editedMessageObj.signature
if (outSideMsg.editedMessageObj.chatReference) {
- chatReference = outSideMsg.editedMessageObj.chatReference;
+ chatReference = outSideMsg.editedMessageObj.chatReference
}
- let message = "";
+ let message = ""
try {
- const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage);
- message = parsedMessageObj;
-
+ const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage)
+ message = parsedMessageObj
} catch (error) {
- message = outSideMsg.editedMessageObj.decodedMessage;
+ message = outSideMsg.editedMessageObj.decodedMessage
}
const messageObject = {
...message,
isImageDeleted: true
}
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage, chatReference);
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage, chatReference)
} else if (outSideMsg && outSideMsg.type === 'deleteAttachment') {
- this.isDeletingAttachment = true;
+ this.isDeletingAttachment = true
let compressedFile = ''
- var str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg==";
- const userName = outSideMsg.name;
- const identifier = outSideMsg.identifier;
+ var str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg=="
+ const userName = outSideMsg.name
+ const identifier = outSideMsg.identifier
if (this.webWorkerFile) {
- this.webWorkerFile.terminate();
- this.webWorkerFile = null;
+ this.webWorkerFile.terminate()
+ this.webWorkerFile = null
}
- this.webWorkerFile = new WebWorkerFile();
+ this.webWorkerFile = new WebWorkerFile()
const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => {
- const byteCharacters = atob(b64Data);
- const byteArrays = [];
+ const byteCharacters = atob(b64Data)
+ const byteArrays = []
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
- const slice = byteCharacters.slice(offset, offset + sliceSize);
+ const slice = byteCharacters.slice(offset, offset + sliceSize)
- const byteNumbers = new Array(slice.length);
+ const byteNumbers = new Array(slice.length)
for (let i = 0; i < slice.length; i++) {
- byteNumbers[i] = slice.charCodeAt(i);
+ byteNumbers[i] = slice.charCodeAt(i)
}
- const byteArray = new Uint8Array(byteNumbers);
- byteArrays.push(byteArray);
+ const byteArray = new Uint8Array(byteNumbers)
+ byteArrays.push(byteArray)
}
- const blob = new Blob(byteArrays, { type: contentType });
- return blob;
+ const blob = new Blob(byteArrays, { type: contentType })
+ return blob
}
- const blob = b64toBlob(str, 'image/png');
+ const blob = b64toBlob(str, 'image/png')
await new Promise(resolve => {
new Compressor(blob, {
quality: 0.6,
@@ -3362,13 +3323,12 @@ class ChatPage extends LitElement {
success(result) {
const file = new File([result], "name", {
type: 'image/png'
- });
+ })
- compressedFile = file;
- resolve();
+ compressedFile = file
+ resolve()
},
error(err) {
- console.log(err.message);
},
})
})
@@ -3387,52 +3347,52 @@ class ChatPage extends LitElement {
})
this.isDeletingAttachment = false
} catch (error) {
- this.isLoading = false;
+ this.isLoading = false
return
}
- typeMessage = 'edit';
- let chatReference = outSideMsg.editedMessageObj.signature;
+ typeMessage = 'edit'
+ let chatReference = outSideMsg.editedMessageObj.signature
if (outSideMsg.editedMessageObj.chatReference) {
- chatReference = outSideMsg.editedMessageObj.chatReference;
+ chatReference = outSideMsg.editedMessageObj.chatReference
}
- let message = "";
+ let message = ""
try {
- const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage);
- message = parsedMessageObj;
+ const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage)
+ message = parsedMessageObj
} catch (error) {
- message = outSideMsg.editedMessageObj.decodedMessage;
+ message = outSideMsg.editedMessageObj.decodedMessage
}
const messageObject = {
...message,
isAttachmentDeleted: true
}
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage, chatReference);
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage, chatReference)
} else if (outSideMsg && outSideMsg.type === 'image') {
- this.isUploadingImage = true;
- const userName = await getName(this.selectedAddress.address);
+ this.isUploadingImage = true
+ const userName = await getName(this.selectedAddress.address)
if (!userName) {
- parentEpml.request('showSnackBar', get("chatpage.cchange27"));
- this.isLoading = false;
- this.isUploadingImage = false;
- this.imageFile = null;
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange27"))
+ this.isLoading = false
+ this.isUploadingImage = false
+ this.imageFile = null
+ return
}
if (this.webWorkerFile) {
- this.webWorkerFile.terminate();
- this.webWorkerFile = null;
+ this.webWorkerFile.terminate()
+ this.webWorkerFile = null
}
- this.webWorkerFile = new WebWorkerFile();
+ this.webWorkerFile = new WebWorkerFile()
const image = this.imageFile
- const id = this.uid();
- const identifier = `qchat_${id}`;
- let compressedFile = '';
+ const id = this.uid()
+ const identifier = `qchat_${id}`
+ let compressedFile = ''
await new Promise(resolve => {
new Compressor(image, {
quality: .6,
@@ -3440,21 +3400,20 @@ class ChatPage extends LitElement {
success(result) {
const file = new File([result], "name", {
type: image.type
- });
+ })
compressedFile = file
resolve()
},
error(err) {
- console.log(err.message);
},
})
})
- const fileSize = compressedFile.size;
+ const fileSize = compressedFile.size
if (fileSize > 500000) {
- parentEpml.request('showSnackBar', get("chatpage.cchange26"));
- this.isLoading = false;
- this.isUploadingImage = false;
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange26"))
+ this.isLoading = false
+ this.isUploadingImage = false
+ return
}
try {
await publishData({
@@ -3467,14 +3426,13 @@ class ChatPage extends LitElement {
uploadType: 'file',
selectedAddress: this.selectedAddress,
worker: this.webWorkerFile
- });
- this.isUploadingImage = false;
- this.removeImage();
+ })
+ this.isUploadingImage = false
+ this.removeImage()
} catch (error) {
- console.error(error);
- this.isLoading = false;
- this.isUploadingImage = false;
- return;
+ this.isLoading = false
+ this.isUploadingImage = false
+ return
}
const messageObject = {
@@ -3487,15 +3445,15 @@ class ChatPage extends LitElement {
isImageDeleted: false,
repliedTo: '',
version: 3
- };
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage);
+ }
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage)
} else if (outSideMsg && outSideMsg.type === 'gif') {
- const userName = await getName(this.selectedAddress.address);
+ const userName = await getName(this.selectedAddress.address)
if (!userName) {
- parentEpml.request('showSnackBar', get("chatpage.cchange27"));
- this.isLoading = false;
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange27"))
+ this.isLoading = false
+ return
}
const messageObject = {
@@ -3508,35 +3466,34 @@ class ChatPage extends LitElement {
}],
repliedTo: '',
version: 3
- };
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage);
+ }
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage)
} else if (outSideMsg && outSideMsg.type === 'attachment') {
- this.isUploadingAttachment = true;
- const userName = await getName(this.selectedAddress.address);
+ this.isUploadingAttachment = true
+ const userName = await getName(this.selectedAddress.address)
if (!userName) {
- parentEpml.request('showSnackBar', get("chatpage.cchange27"));
- this.isLoading = false;
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange27"))
+ this.isLoading = false
+ return
}
if (this.webWorkerFile) {
- this.webWorkerFile.terminate();
- this.webWorkerFile = null;
+ this.webWorkerFile.terminate()
+ this.webWorkerFile = null
}
- this.webWorkerFile = new WebWorkerFile();
+ this.webWorkerFile = new WebWorkerFile()
-
- const attachment = this.attachment;
- const id = this.uid();
- const identifier = `qchat_${id}`;
- const fileSize = attachment.size;
+ const attachment = this.attachment
+ const id = this.uid()
+ const identifier = `qchat_${id}`
+ const fileSize = attachment.size
if (fileSize > 1000000) {
- parentEpml.request('showSnackBar', get("chatpage.cchange77"));
- this.isLoading = false;
- this.isUploadingAttachment = false;
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange77"))
+ this.isLoading = false
+ this.isUploadingAttachment = false
+ return
}
try {
await publishData({
@@ -3549,14 +3506,13 @@ class ChatPage extends LitElement {
uploadType: 'file',
selectedAddress: this.selectedAddress,
worker: this.webWorkerFile
- });
- this.isUploadingAttachment = false;
- this.removeAttachment();
+ })
+ this.isUploadingAttachment = false
+ this.removeAttachment()
} catch (error) {
- console.error(error);
- this.isLoading = false;
- this.isUploadingAttachment = false;
- return;
+ this.isLoading = false
+ this.isUploadingAttachment = false
+ return
}
const messageObject = {
messageText: trimmedMessage,
@@ -3570,26 +3526,25 @@ class ChatPage extends LitElement {
isAttachmentDeleted: false,
repliedTo: '',
version: 3
- };
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage);
+ }
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage)
} else if (outSideMsg && outSideMsg.type === 'reaction') {
- const userName = await getName(this.selectedAddress.address);
- typeMessage = 'edit';
- let chatReference = outSideMsg.editedMessageObj.signature;
+ const userName = await getName(this.selectedAddress.address)
+ typeMessage = 'edit'
+ let chatReference = outSideMsg.editedMessageObj.signature
if (outSideMsg.editedMessageObj.chatReference) {
- chatReference = outSideMsg.editedMessageObj.chatReference;
+ chatReference = outSideMsg.editedMessageObj.chatReference
}
- let message = "";
+ let message = ""
try {
- const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage);
- message = parsedMessageObj;
-
+ const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage)
+ message = parsedMessageObj
} catch (error) {
- message = outSideMsg.editedMessageObj.decodedMessage;
+ message = outSideMsg.editedMessageObj.decodedMessage
}
let reactions = message.reactions || []
@@ -3628,25 +3583,23 @@ class ChatPage extends LitElement {
reactions
}
const stringifyMessageObject = JSON.stringify(messageObject)
- this.sendMessage(stringifyMessageObject, typeMessage, chatReference);
+ this.sendMessage(stringifyMessageObject, typeMessage, chatReference)
} else if (/^\s*$/.test(trimmedMessage)) {
- this.isLoading = false;
-
- }
- else if (this.repliedToMessageObj) {
- let chatReference = this.repliedToMessageObj.signature;
+ this.isLoading = false
+ } else if (this.repliedToMessageObj) {
+ let chatReference = this.repliedToMessageObj.signature
if (this.repliedToMessageObj.chatReference) {
- chatReference = this.repliedToMessageObj.chatReference;
+ chatReference = this.repliedToMessageObj.chatReference
}
- typeMessage = 'reply';
+ typeMessage = 'reply'
const messageObject = {
messageText: trimmedMessage,
images: [''],
repliedTo: chatReference,
version: 3
}
- const stringifyMessageObject = JSON.stringify(messageObject);
- this.sendMessage(stringifyMessageObject, typeMessage);
+ const stringifyMessageObject = JSON.stringify(messageObject)
+ this.sendMessage(stringifyMessageObject, typeMessage)
} else if (this.editedMessageObj) {
typeMessage = 'edit'
let chatReference = this.editedMessageObj.signature
@@ -3669,7 +3622,7 @@ class ChatPage extends LitElement {
isEdited: true
}
const stringifyMessageObject = JSON.stringify(messageObject)
- this.sendMessage(stringifyMessageObject, typeMessage, chatReference);
+ this.sendMessage(stringifyMessageObject, typeMessage, chatReference)
} else {
const messageObject = {
messageText: trimmedMessage,
@@ -3684,17 +3637,17 @@ class ChatPage extends LitElement {
this.myTrimmedMeassage = stringifyMessageObject
this.shadowRoot.getElementById('confirmDialog').open()
} else {
- this.sendMessage(stringifyMessageObject, typeMessage);
+ this.sendMessage(stringifyMessageObject, typeMessage)
}
}
}
async sendMessage(messageText, typeMessage, chatReference, isForward) {
- this.isLoading = true;
+ this.isLoading = true
- let _reference = new Uint8Array(64);
- window.crypto.getRandomValues(_reference);
- let reference = window.parent.Base58.encode(_reference);
+ let _reference = new Uint8Array(64)
+ window.crypto.getRandomValues(_reference)
+ let reference = window.parent.Base58.encode(_reference)
const sendMessageRequest = async () => {
if (this.isReceipient === true) {
let chatResponse = await parentEpml.request('chat', {
@@ -3712,8 +3665,7 @@ class ChatPage extends LitElement {
isEncrypted: 1,
isText: 1
}
- });
-
+ })
_computePow(chatResponse)
} else {
let groupResponse = await parentEpml.request('chat', {
@@ -3731,27 +3683,26 @@ class ChatPage extends LitElement {
isEncrypted: 0, // Set default to not encrypted for groups
isText: 1
}
- });
-
+ })
_computePow(groupResponse)
}
- };
+ }
const sendForwardRequest = async () => {
-
- const userInput = this.shadowRoot.getElementById("sendTo").value.trim();
+ const userInput = this.shadowRoot.getElementById("sendTo").value.trim()
if (!userInput && !this.forwardActiveChatHeadUrl.url) {
- let err4string = get("chatpage.cchange65");
- getSendChatResponse(false, true, err4string);
+ let err4string = get("chatpage.cchange65")
+ getSendChatResponse(false, true, err4string)
return
}
+
let publicKey = {
hasPubKey: false,
key: ''
- };
+ }
if (this.forwardActiveChatHeadUrl.url) {
- const activeChatHeadAddress = this.forwardActiveChatHeadUrl.url.split('/')[1];
+ const activeChatHeadAddress = this.forwardActiveChatHeadUrl.url.split('/')[1]
try {
const res = await parentEpml.request('apiCall', {
type: 'api',
@@ -3769,90 +3720,88 @@ class ChatPage extends LitElement {
publicKey.hasPubKey = false
}
} catch (error) {
- console.error(error);
}
}
if (!this.forwardActiveChatHeadUrl.selected && this.shadowRoot.getElementById("sendTo").value !== "") {
-
try {
- let userPubkey = "";
+ let userPubkey = ""
const validatedAddress = await parentEpml.request('apiCall', {
type: 'api',
url: `/addresses/validate/${userInput}`
- });
+ })
const validatedUsername = await parentEpml.request('apiCall', {
type: 'api',
url: `/names/${userInput}`
- });
+ })
if (validatedAddress && validatedUsername.name) {
userPubkey = await parentEpml.request('apiCall', {
type: 'api',
url: `/addresses/publickey/${validatedUsername.owner}`
- });
+ })
this.forwardActiveChatHeadUrl = {
...this.forwardActiveChatHeadUrl,
url: `direct/${validatedUsername.owner}`,
name: validatedUsername.name,
selected: true
- };
+ }
} else
if (!validatedAddress && (validatedUsername && !validatedUsername.error)) {
userPubkey = await parentEpml.request('apiCall', {
type: 'api',
url: `/addresses/publickey/${validatedUsername.owner}`
- });
+ })
+
this.forwardActiveChatHeadUrl = {
...this.forwardActiveChatHeadUrl,
url: `direct/${validatedUsername.owner}`,
name: validatedUsername.name,
selected: true
- };
+ }
} else if (validatedAddress && !validatedUsername.name) {
userPubkey = await parentEpml.request('apiCall', {
type: 'api',
url: `/addresses/publickey/${userInput}`
- });
+ })
+
this.forwardActiveChatHeadUrl = {
...this.forwardActiveChatHeadUrl,
url: `direct/${userInput}`,
name: "",
selected: true
- };
+ }
} else if (!validatedAddress && !validatedUsername.name) {
- let err4string = get("chatpage.cchange62");
- // parentEpml.request('showSnackBar', `${err4string}`);
- getSendChatResponse(false, true, err4string);
- return;
+ let err4string = get("chatpage.cchange62")
+ getSendChatResponse(false, true, err4string)
+ return
}
if (userPubkey.error === 102) {
- publicKey.key = '';
- publicKey.hasPubKey = false;
+ publicKey.key = ''
+ publicKey.hasPubKey = false
} else if (userPubkey !== false) {
- publicKey.key = userPubkey;
- publicKey.hasPubKey = true;
+ publicKey.key = userPubkey
+ publicKey.hasPubKey = true
} else {
- publicKey.key = '';
- publicKey.hasPubKey = false;
+ publicKey.key = ''
+ publicKey.hasPubKey = false
}
} catch (error) {
- console.error(error);
}
}
- const isRecipient = this.forwardActiveChatHeadUrl.url.includes('direct') === true ? true : false;
+ const isRecipient = this.forwardActiveChatHeadUrl.url.includes('direct') === true ? true : false
- const recipientAddress = this.forwardActiveChatHeadUrl.url.split('/')[1];
- this.openForwardOpen = false;
+ const recipientAddress = this.forwardActiveChatHeadUrl.url.split('/')[1]
+ this.openForwardOpen = false
if (isRecipient === true) {
if (!publicKey.hasPubKey) {
- let err4string = get("chatpage.cchange39");
- parentEpml.request('showSnackBar', `${err4string}`);
- getSendChatResponse(false);
- return;
+ let err4string = get("chatpage.cchange39")
+ parentEpml.request('showSnackBar', `${err4string}`)
+ getSendChatResponse(false)
+ return
}
let chatResponse = await parentEpml.request('chat', {
type: 18,
@@ -3869,8 +3818,7 @@ class ChatPage extends LitElement {
isEncrypted: 1,
isText: 1
}
- });
-
+ })
_computePow(chatResponse, true)
} else {
let groupResponse = await parentEpml.request('chat', {
@@ -3888,52 +3836,51 @@ class ChatPage extends LitElement {
isEncrypted: 0, // Set default to not encrypted for groups
isText: 1
}
- });
-
+ })
_computePow(groupResponse, true)
}
- };
+ }
const _computePow = async (chatBytes, isForward) => {
- const difficulty = this.balance < 4 ? 18 : 8;
+ const difficulty = this.balance < 4 ? 18 : 8
const path = window.parent.location.origin + '/memory-pow/memory-pow.wasm.full'
- let worker;
+ let worker
if (this.webWorker) {
- worker = this.webWorker;
+ worker = this.webWorker
} else {
- this.webWorker = new WebWorker();
+ this.webWorker = new WebWorker()
}
- let nonce = null;
+ let nonce = null
- let chatBytesArray = null;
+ let chatBytesArray = null
await new Promise((res) => {
- worker.postMessage({ chatBytes, path, difficulty });
+ worker.postMessage({ chatBytes, path, difficulty })
worker.onmessage = e => {
- chatBytesArray = e.data.chatBytesArray;
- nonce = e.data.nonce;
- res();
+ chatBytesArray = e.data.chatBytesArray
+ nonce = e.data.nonce
+ res()
}
- });
+ })
let _response = await parentEpml.request('sign_chat', {
nonce: this.selectedAddress.nonce,
chatBytesArray: chatBytesArray,
chatNonce: nonce
- });
+ })
- getSendChatResponse(_response, isForward);
- };
+ getSendChatResponse(_response, isForward)
+ }
const getSendChatResponse = (response, isForward, customErrorMessage) => {
if (response === true) {
this.resetChatEditor()
if (isForward) {
- let successString = get("blockpage.bcchange15");
- parentEpml.request('showSnackBar', `${successString}`);
+ let successString = get("blockpage.bcchange15")
+ parentEpml.request('showSnackBar', `${successString}`)
}
this.closeEditMessageContainer()
@@ -3945,24 +3892,24 @@ class ChatPage extends LitElement {
selected: false
}
} else if (response.error) {
- parentEpml.request('showSnackBar', response.message);
+ parentEpml.request('showSnackBar', response.message)
} else {
- let err2string = get("chatpage.cchange21");
- parentEpml.request('showSnackBar', `${customErrorMessage || err2string}`);
+ let err2string = get("chatpage.cchange21")
+ parentEpml.request('showSnackBar', `${customErrorMessage || err2string}`)
}
if (isForward && response !== true) {
- this.isLoading = false;
+ this.isLoading = false
return
}
- this.isLoading = false;
+ this.isLoading = false
- };
+ }
if (isForward) {
- sendForwardRequest();
- return;
+ sendForwardRequest()
+ return
}
- sendMessageRequest();
+ sendMessageRequest()
}
/**
@@ -3970,11 +3917,10 @@ class ChatPage extends LitElement {
* @param { Boolean } isDown
*/
setIsUserDown(isDown) {
- this.isUserDown = isDown;
+ this.isUserDown = isDown
}
_downObserverhandler(entries) {
-
if (entries[0].isIntersecting) {
this.setIsUserDown(true)
@@ -3986,7 +3932,7 @@ class ChatPage extends LitElement {
}
downElementObserver() {
- const downObserver = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('downObserver');
+ const downObserver = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('downObserver')
const options = {
root: this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById('viewElement'),
@@ -3998,19 +3944,16 @@ class ChatPage extends LitElement {
}
pasteToTextBox(textarea) {
-
// Return focus to the window
window.focus()
navigator.clipboard.readText().then(clipboardText => {
-
textarea.value += clipboardText
textarea.focus()
- });
+ })
}
pasteMenu(event) {
-
let eventObject = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
parentEpml.request('openFramePasteMenu', eventObject)
}
diff --git a/plugins/plugins/core/components/ChatRightPanel.js b/plugins/plugins/core/components/ChatRightPanel.js
index a63bc8c5..fac86ebf 100644
--- a/plugins/plugins/core/components/ChatRightPanel.js
+++ b/plugins/plugins/core/components/ChatRightPanel.js
@@ -1,6 +1,5 @@
import { LitElement, html, css } from "lit";
import { render } from "lit/html.js";
-import { get, translate } from "lit-translate";
import { Epml } from "../../../epml";
import { getUserNameFromAddress } from "../../utils/getUserNameFromAddress";
import snackbar from "./snackbar.js";
@@ -13,6 +12,9 @@ import '@vaadin/button';
import "./WrapperModal";
import "./TipUser"
import "./UserInfo/UserInfo";
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
class ChatRightPanel extends LitElement {
static get properties() {
diff --git a/plugins/plugins/core/components/ChatScroller.js b/plugins/plugins/core/components/ChatScroller.js
index 8757b25f..f5ee24de 100644
--- a/plugins/plugins/core/components/ChatScroller.js
+++ b/plugins/plugins/core/components/ChatScroller.js
@@ -1,57 +1,63 @@
-import { LitElement, html, css } from 'lit';
-import { render } from 'lit/html.js';
-import { repeat } from 'lit/directives/repeat.js';
-import { translate, get } from 'lit-translate';
-import { unsafeHTML } from 'lit/directives/unsafe-html.js';
+import { LitElement, html, css } from 'lit'
+import { render } from 'lit/html.js'
+import { repeat } from 'lit/directives/repeat.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+import { unsafeHTML } from 'lit/directives/unsafe-html.js'
import { chatStyles } from './ChatScroller-css.js'
-import { Epml } from "../../../epml";
-import { cropAddress } from "../../utils/cropAddress";
-import { roundToNearestDecimal } from '../../utils/roundToNearestDecimal.js';
-import './LevelFounder.js';
-import './NameMenu.js';
-import './ChatModals.js';
-import './WrapperModal';
-import "./UserInfo/UserInfo";
-import '@vaadin/icons';
-import '@vaadin/icon';
-import '@vaadin/tooltip';
-import '@material/mwc-button';
-import '@material/mwc-dialog';
-import '@material/mwc-icon';
-import { EmojiPicker } from 'emoji-picker-js';
-import { generateHTML } from '@tiptap/core';
-import axios from "axios";
-import StarterKit from '@tiptap/starter-kit'
-import Underline from '@tiptap/extension-underline';
+import { Epml } from '../../../epml'
+import { cropAddress } from "../../utils/cropAddress"
+import { roundToNearestDecimal } from '../../utils/roundToNearestDecimal.js'
+import { EmojiPicker } from 'emoji-picker-js'
+import { generateHTML } from '@tiptap/core'
+import isElectron from 'is-electron'
+
+import axios from 'axios'
import Highlight from '@tiptap/extension-highlight'
-import ShortUniqueId from 'short-unique-id';
+import ShortUniqueId from 'short-unique-id'
+import StarterKit from '@tiptap/starter-kit'
+import Underline from '@tiptap/extension-underline'
+
+import './ChatModals.js'
+import './LevelFounder.js'
+import './NameMenu.js'
+import './UserInfo/UserInfo.js'
+import './WrapperModal'
+
+import '@material/mwc-button'
+import '@material/mwc-dialog'
+import '@material/mwc-icon'
+import '@vaadin/icon'
+import '@vaadin/icons'
+import '@vaadin/tooltip'
+
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
+
let toggledMessage = {}
const uid = new ShortUniqueId()
const getApiKey = () => {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- let apiKey = myNode.apiKey;
- return apiKey;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ let apiKey = myNode.apiKey
+ return apiKey
}
const extractComponents = async (url) => {
if (!url.startsWith("qortal://")) {
- return null;
+ return null
}
- url = url.replace(/^(qortal\:\/\/)/, "");
+ url = url.replace(/^(qortal\:\/\/)/, "")
if (url.includes("/")) {
- let parts = url.split("/");
- const service = parts[0].toUpperCase();
- parts.shift();
- const name = parts[0];
- parts.shift();
- let identifier;
+ let parts = url.split("/")
+ const service = parts[0].toUpperCase()
+ parts.shift()
+ const name = parts[0]
+ parts.shift()
+ let identifier
if (parts.length > 0) {
- identifier = parts[0]; // Do not shift yet
+ identifier = parts[0] // Do not shift yet
// Check if a resource exists with this service, name and identifier combination
let responseObj = await parentEpml.request('apiCall', {
url: `/arbitrary/resource/status/${service}/${name}/${identifier}?apiKey=${getApiKey()}`
@@ -59,48 +65,48 @@ const extractComponents = async (url) => {
if (responseObj.totalChunkCount > 0) {
// Identifier exists, so don't include it in the path
- parts.shift();
+ parts.shift()
}
else {
- identifier = null;
+ identifier = null
}
}
- const path = parts.join("/");
+ const path = parts.join("/")
- const components = {};
- components["service"] = service;
- components["name"] = name;
- components["identifier"] = identifier;
- components["path"] = path;
- return components;
+ const components = {}
+ components["service"] = service
+ components["name"] = name
+ components["identifier"] = identifier
+ components["path"] = path
+ return components
}
- return null;
+ return null
}
function processText(input) {
- const linkRegex = /(qortal:\/\/\S+)/g;
+ const linkRegex = /(qortal:\/\/\S+)/g
function processNode(node) {
if (node.nodeType === Node.TEXT_NODE) {
- const parts = node.textContent.split(linkRegex);
+ const parts = node.textContent.split(linkRegex)
if (parts.length > 1) {
- const fragment = document.createDocumentFragment();
+ const fragment = document.createDocumentFragment()
parts.forEach((part) => {
if (part.startsWith('qortal://')) {
- const link = document.createElement('span');
+ const link = document.createElement('span')
// Store the URL in a data attribute
- link.setAttribute('data-url', part);
- link.textContent = part;
- link.style.color = 'var(--nav-text-color)';
- link.style.textDecoration = 'underline';
+ link.setAttribute('data-url', part)
+ link.textContent = part
+ link.style.color = 'var(--nav-text-color)'
+ link.style.textDecoration = 'underline'
link.style.cursor = 'pointer'
link.addEventListener('click', async (e) => {
- e.preventDefault();
+ e.preventDefault()
try {
const res = await extractComponents(part)
if (!res) return
@@ -134,34 +140,36 @@ function processText(input) {
console.log({ error })
}
- });
+ })
- fragment.appendChild(link);
+ fragment.appendChild(link)
} else {
- const textNode = document.createTextNode(part);
- fragment.appendChild(textNode);
+ const textNode = document.createTextNode(part)
+ fragment.appendChild(textNode)
}
- });
+ })
- node.replaceWith(fragment);
+ node.replaceWith(fragment)
}
} else {
for (const childNode of Array.from(node.childNodes)) {
- processNode(childNode);
+ processNode(childNode)
}
}
}
- const wrapper = document.createElement('div');
- wrapper.innerHTML = input;
+ const wrapper = document.createElement('div')
+ wrapper.innerHTML = input
- processNode(wrapper);
+ processNode(wrapper)
return wrapper
}
+
class ChatScroller extends LitElement {
static get properties() {
return {
+ theme: { type: String, reflect: true },
getNewMessage: { attribute: false },
getOldMessage: { attribute: false },
escapeHTML: { attribute: false },
@@ -193,7 +201,7 @@ class ChatScroller extends LitElement {
}
static get styles() {
- return [chatStyles];
+ return [chatStyles]
}
constructor() {
@@ -203,9 +211,10 @@ class ChatScroller extends LitElement {
this._downObserverHandler = this._downObserverHandler.bind(this)
this.myAddress = window.parent.reduxStore.getState().app.selectedAddress.address
this.hideMessages = JSON.parse(localStorage.getItem("MessageBlockedAddresses") || "[]")
- this.openTipUser = false;
- this.openUserInfo = false;
+ this.openTipUser = false
+ this.openUserInfo = false
this.listSeenMessages = []
+ this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
}
addSeenMessage(val) {
@@ -214,42 +223,41 @@ class ChatScroller extends LitElement {
render() {
let formattedMessages = this.messages.reduce((messageArray, message, index) => {
- const lastGroupedMessage = messageArray[messageArray.length - 1];
- let timestamp;
- let sender;
- let repliedToData;
- let firstMessageInChat;
+ const lastGroupedMessage = messageArray[messageArray.length - 1]
+ let timestamp
+ let sender
+ let repliedToData
+ let firstMessageInChat
if (index === 0) {
- firstMessageInChat = true;
+ firstMessageInChat = true
} else {
- firstMessageInChat = false;
+ firstMessageInChat = false
}
message = { ...message, firstMessageInChat }
if (lastGroupedMessage) {
- timestamp = lastGroupedMessage.timestamp;
- sender = lastGroupedMessage.sender;
- repliedToData = lastGroupedMessage.repliedToData;
+ timestamp = lastGroupedMessage.timestamp
+ sender = lastGroupedMessage.sender
+ repliedToData = lastGroupedMessage.repliedToData
}
- const isSameGroup = Math.abs(timestamp - message.timestamp) < 600000 && sender === message.sender && !repliedToData;
+ const isSameGroup = Math.abs(timestamp - message.timestamp) < 600000 && sender === message.sender && !repliedToData
if (isSameGroup) {
messageArray[messageArray.length - 1].messages = [
...(messageArray[messageArray.length - 1].messages || []),
message
- ];
+ ]
} else {
messageArray.push({
messages: [message],
...message
- });
+ })
}
- return messageArray;
+ return messageArray
}, [])
-
return html`
${this.isLoadingMessages ? html`
`;
+ const emojiHtmlString = `
`
this.chatEditor.insertEmoji(emojiHtmlString);
- });
+ })
- this.emojiPickerHandler.addEventListener('click', () => this.emojiPicker.togglePicker(this.emojiPickerHandler));
+ this.emojiPickerHandler.addEventListener('click', () => this.emojiPicker.togglePicker(this.emojiPickerHandler))
- await this.updateComplete;
- this.initChatEditor();
+ await this.updateComplete
+ this.initChatEditor()
}
async updated(changedProperties) {
@@ -348,12 +349,12 @@ class ChatTextEditor extends LitElement {
}
}
if (changedProperties && changedProperties.has('placeholder')) {
- const captionEditor = this.shadowRoot.getElementById(this.iframeId).contentWindow.document.getElementById('chatbarId');
- captionEditor.setAttribute('data-placeholder', this.placeholder);
+ const captionEditor = this.shadowRoot.getElementById(this.iframeId).contentWindow.document.getElementById('chatbarId')
+ captionEditor.setAttribute('data-placeholder', this.placeholder)
}
if (changedProperties && changedProperties.has("imageFile")) {
- this.chatMessageInput = "newChat";
+ this.chatMessageInput = "newChat"
}
}
@@ -365,12 +366,12 @@ class ChatTextEditor extends LitElement {
sendMessageFunc(props) {
if (this.chatMessageSize > 1000 ) {
- parentEpml.request('showSnackBar', get("chatpage.cchange29"));
- return;
+ parentEpml.request('showSnackBar', get("chatpage.cchange29"))
+ return
};
- this.chatMessageSize = 0;
- this.chatEditor.updateMirror();
- this._sendMessage(props);
+ this.chatMessageSize = 0
+ this.chatEditor.updateMirror()
+ this._sendMessage(props)
}
getMessageSize(message){
diff --git a/plugins/plugins/core/components/ChatTextEditor.js b/plugins/plugins/core/components/ChatTextEditor.js
index 105811da..123df641 100644
--- a/plugins/plugins/core/components/ChatTextEditor.js
+++ b/plugins/plugins/core/components/ChatTextEditor.js
@@ -1,13 +1,13 @@
import { LitElement, html, css } from "lit";
-import { get, translate } from 'lit-translate';
-
-import { EmojiPicker } from 'emoji-picker-js';
-import { Epml } from '../../../epml.js';
+import { render } from 'lit/html.js'
+import { EmojiPicker } from 'emoji-picker-js'
+import { Epml } from '../../../epml.js'
import '@material/mwc-icon'
import '@material/mwc-checkbox'
-// import { addAutoLoadImageChat } from "../../../../qortal-ui-core/src/redux/app/app-actions.js";
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
-const parentEpml = new Epml({ type: 'WINDOW', source: window.parent });
class ChatTextEditor extends LitElement {
static get properties() {
return {
@@ -589,11 +589,11 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b
const checkTheme = localStorage.getItem('qortalTheme');
const chatbar = this.shadowRoot.querySelector('.element')
if (checkTheme === 'dark') {
- this.theme = 'dark';
+ this.theme = 'dark'
chatbar.style.cssText = "color:#ffffff;"
} else {
- this.theme = 'light';
+ this.theme = 'light'
chatbar.style.cssText = "color:#080808;"
}
diff --git a/plugins/plugins/core/components/ChatWelcomePage.js b/plugins/plugins/core/components/ChatWelcomePage.js
index 9ba5f212..1deb25d1 100644
--- a/plugins/plugins/core/components/ChatWelcomePage.js
+++ b/plugins/plugins/core/components/ChatWelcomePage.js
@@ -2,10 +2,7 @@ import { LitElement, html, css } from 'lit'
import { render } from 'lit/html.js'
import { Epml } from '../../../epml.js'
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
-
-registerTranslateConfig({
- loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
-})
+import isElectron from 'is-electron'
import '@material/mwc-icon'
import '@material/mwc-button'
@@ -13,6 +10,10 @@ import '@material/mwc-dialog'
import '@polymer/paper-spinner/paper-spinner-lite.js'
import '@vaadin/grid'
+registerTranslateConfig({
+ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
+})
+
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
class ChatWelcomePage extends LitElement {
@@ -258,10 +259,16 @@ class ChatWelcomePage extends LitElement {
firstUpdated() {
this.changeTheme()
+ this.changeLanguage()
+
+ this.clearConsole()
+ setInterval(() => {
+ this.clearConsole()
+ }, 60000)
const stopKeyEventPropagation = (e) => {
- e.stopPropagation();
- return false;
+ e.stopPropagation()
+ return false
}
this.shadowRoot.getElementById('sendTo').addEventListener('keydown', stopKeyEventPropagation);
@@ -290,8 +297,6 @@ class ChatWelcomePage extends LitElement {
document.querySelector('html').setAttribute('theme', this.theme)
})
- let configLoaded = false
-
parentEpml.ready().then(() => {
parentEpml.subscribe('selected_address', async selectedAddress => {
this.selectedAddress = {}
@@ -309,19 +314,26 @@ class ChatWelcomePage extends LitElement {
parentEpml.imReady()
}
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
+ }
+
changeTheme() {
const checkTheme = localStorage.getItem('qortalTheme')
if (checkTheme === 'dark') {
- this.theme = 'dark';
+ this.theme = 'dark'
} else {
- this.theme = 'light';
+ this.theme = 'light'
}
- document.querySelector('html').setAttribute('theme', this.theme);
+ document.querySelector('html').setAttribute('theme', this.theme)
}
changeLanguage() {
const checkLanguage = localStorage.getItem('qortalLanguage')
-
if (checkLanguage === null || checkLanguage.length === 0) {
localStorage.setItem('qortalLanguage', 'us')
use('us')
@@ -343,7 +355,7 @@ class ChatWelcomePage extends LitElement {
} else {
this.sendMessage();
}
- };
+ }
async sendMessage() {
this.isLoading = true;
diff --git a/plugins/plugins/core/components/ImageComponent.js b/plugins/plugins/core/components/ImageComponent.js
index af03aadc..cb35702c 100644
--- a/plugins/plugins/core/components/ImageComponent.js
+++ b/plugins/plugins/core/components/ImageComponent.js
@@ -1,6 +1,6 @@
-import { LitElement, html, css } from 'lit';
-import { translate, get } from 'lit-translate';
-import { render } from 'lit/html.js';
+import { LitElement, html, css } from 'lit'
+import { render } from 'lit/html.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
export class ImageComponent extends LitElement {
@@ -48,52 +48,51 @@ border: 1px solid var(--mdc-theme-primary );
}
constructor() {
- super();
- this.attempts = 0;
- this.maxAttempts = 5;
+ super()
+ this.attempts = 0
+ this.maxAttempts = 5
}
getApiKey() {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- let apiKey = myNode.apiKey;
- return apiKey;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ let apiKey = myNode.apiKey
+ return apiKey
}
async _fetchImage() {
this.attempts++;
- if (this.attempts > this.maxAttempts) return;
+ if (this.attempts > this.maxAttempts) return
await new Promise((res) => {
setTimeout(() => {
- res();
+ res()
}, 1000)
- });
+ })
try {
- const response = await fetch(this.gif.url);
- const data = await response.json();
- console.log({data});
+ const response = await fetch(this.gif.url)
+ const data = await response.json()
if (data.ok) {
- this.error = false;
+ this.error = false
this.gif = {
...this.gif,
url: data.src
};
this.requestUpdate();
} else if (!data.ok || data.error) {
- this.error = true;
+ this.error = true
} else {
- this.error = false;
+ this.error = false
}
} catch (error) {
- this.error = true;
- console.error(error);
- this._fetchImage();
+ this.error = true
+ console.error(error)
+ this._fetchImage()
}
}
render() {
if (this.error && this.attempts <= this.maxAttempts) {
setTimeout(() => {
- this._fetchImage();
- }, 1000);
+ this._fetchImage()
+ }, 1000)
}
return html`
${this.gif && !this.error
@@ -124,4 +123,4 @@ alt=${this.alt}
}
}
-customElements.define('image-component', ImageComponent);
+customElements.define('image-component', ImageComponent)
diff --git a/plugins/plugins/core/components/LevelFounder.js b/plugins/plugins/core/components/LevelFounder.js
index bab9cd8e..ade53a0f 100644
--- a/plugins/plugins/core/components/LevelFounder.js
+++ b/plugins/plugins/core/components/LevelFounder.js
@@ -3,11 +3,6 @@ import { render } from 'lit/html.js'
import { Epml } from '../../../epml.js'
import snackbar from './snackbar.js'
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
-
-registerTranslateConfig({
- loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
-})
-
import '@polymer/paper-tooltip/paper-tooltip.js'
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
@@ -15,8 +10,8 @@ const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
class LevelFounder extends LitElement {
static get properties() {
return {
- checkleveladdress: { type: String, attribute: true },
- selectedAddress: { type: Object },
+ checkleveladdress: { type: String },
+ selectedAddress: { type: String },
config: { type: Object },
memberInfo: { type: Array }
}
@@ -106,16 +101,8 @@ class LevelFounder extends LitElement {
}
firstUpdated() {
- this.changeLanguage()
this.checkAddressInfo()
- window.addEventListener('storage', () => {
- const checkLanguage = localStorage.getItem('qortalLanguage')
- use(checkLanguage)
- })
-
- let configLoaded = false
-
parentEpml.ready().then(() => {
parentEpml.subscribe('selected_address', async selectedAddress => {
this.selectedAddress = {}
@@ -127,17 +114,6 @@ class LevelFounder extends LitElement {
parentEpml.imReady()
}
- changeLanguage() {
- const checkLanguage = localStorage.getItem('qortalLanguage')
-
- if (checkLanguage === null || checkLanguage.length === 0) {
- localStorage.setItem('qortalLanguage', 'us')
- use('us')
- } else {
- use(checkLanguage)
- }
- }
-
async checkAddressInfo() {
let toCheck = this.checkleveladdress
const memberInfo = await parentEpml.request('apiCall', {
@@ -147,23 +123,23 @@ class LevelFounder extends LitElement {
}
renderFounder() {
- let adressfounder = this.memberInfo.flags;
+ let adressfounder = this.memberInfo.flags
if (adressfounder === 1) {
return html `
F
FOUNDER
`
} else {
- return null;
+ return html ``
}
}
renderLevel() {
- let adresslevel = this.memberInfo.level;
+ let adresslevel = this.memberInfo.level
return adresslevel ? html `
- ${translate("mintingpage.mchange27")} ${adresslevel}
+ ${translate("mintingpage.mchange27")} ${adresslevel}
` : ''
}
@@ -174,9 +150,9 @@ class LevelFounder extends LitElement {
}
getApiKey() {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- let apiKey = myNode.apiKey;
- return apiKey;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ let apiKey = myNode.apiKey
+ return apiKey
}
}
diff --git a/plugins/plugins/core/components/NameMenu.js b/plugins/plugins/core/components/NameMenu.js
index fc37ee4b..c4359637 100644
--- a/plugins/plugins/core/components/NameMenu.js
+++ b/plugins/plugins/core/components/NameMenu.js
@@ -3,11 +3,6 @@ import { render } from 'lit/html.js'
import { Epml } from '../../../epml.js'
import snackbar from './snackbar.js'
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
-
-registerTranslateConfig({
- loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
-})
-
import '@material/mwc-snackbar'
import '@material/mwc-button'
import '@material/mwc-dialog'
@@ -250,17 +245,12 @@ class NameMenu extends LitElement {
}
firstUpdated() {
- this.getChatBlockedAdresses();
+ this.getChatBlockedAdresses()
setInterval(() => {
- this.getChatBlockedAdresses();
+ this.getChatBlockedAdresses()
}, 60000)
- window.addEventListener('storage', () => {
- const checkLanguage = localStorage.getItem('qortalLanguage');
- use(checkLanguage);
- })
-
window.onclick = function(event) {
if (!event.target.matches('.block')) {
var dropdowns = document.getElementsByClassName('dropdown-content');
@@ -275,12 +265,12 @@ class NameMenu extends LitElement {
}
const stopKeyEventPropagation = (e) => {
- e.stopPropagation();
- return false;
+ e.stopPropagation()
+ return false
}
- this.shadowRoot.getElementById('sendTo').addEventListener('keydown', stopKeyEventPropagation);
- this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation);
+ this.shadowRoot.getElementById('sendTo').addEventListener('keydown', stopKeyEventPropagation)
+ this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation)
const getDataFromURL = () => {
let tempUrl = document.location.href
@@ -309,17 +299,6 @@ class NameMenu extends LitElement {
parentEpml.imReady()
}
- changeLanguage() {
- const checkLanguage = localStorage.getItem('qortalLanguage')
-
- if (checkLanguage === null || checkLanguage.length === 0) {
- localStorage.setItem('qortalLanguage', 'us')
- use('us')
- } else {
- use(checkLanguage)
- }
- }
-
myMenu() {
this.shadowRoot.getElementById('myDropdown').classList.toggle('showList')
this.shadowRoot.querySelector('#blockNameDialog').close()
diff --git a/plugins/plugins/core/components/TimeAgo.js b/plugins/plugins/core/components/TimeAgo.js
index 66164179..180c6a06 100644
--- a/plugins/plugins/core/components/TimeAgo.js
+++ b/plugins/plugins/core/components/TimeAgo.js
@@ -24,11 +24,11 @@ class TimeAgo extends LitElement {
}
});
- this.shadowRoot.querySelector('time-ago').setAttribute('title', '');
+ this.shadowRoot.querySelector('time-ago').setAttribute('title', '')
}
constructor() {
- super();
+ super()
this.timestamp = 0
this.timeIso = ''
this.format = ''
@@ -41,7 +41,7 @@ class TimeAgo extends LitElement {
}
renderTime(timestamp) {
- timestamp === undefined ? this.timeIso = '' : this.timeIso = new Date(timestamp).toISOString();
+ timestamp === undefined ? this.timeIso = '' : this.timeIso = new Date(timestamp).toISOString()
}
firstUpdated() {
diff --git a/plugins/plugins/core/components/TipUser.js b/plugins/plugins/core/components/TipUser.js
index eabbc102..d7b79b7f 100644
--- a/plugins/plugins/core/components/TipUser.js
+++ b/plugins/plugins/core/components/TipUser.js
@@ -1,10 +1,10 @@
-import { LitElement, html } from 'lit';
-import { render } from 'lit/html.js';
-import { get, translate } from 'lit-translate';
-import { tipUserStyles } from './TipUser-css.js';
-import { Epml } from '../../../epml';
-import '@vaadin/button';
-import '@polymer/paper-progress/paper-progress.js';
+import { LitElement, html } from 'lit'
+import { render } from 'lit/html.js'
+import { tipUserStyles } from './TipUser-css.js'
+import { Epml } from '../../../epml'
+import '@vaadin/button'
+import '@polymer/paper-progress/paper-progress.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
const parentEpml = new Epml({ type: "WINDOW", source: window.parent });
@@ -34,15 +34,15 @@ export class TipUser extends LitElement {
static styles = [tipUserStyles]
async firstUpdated() {
- await this.fetchWalletDetails();
+ await this.fetchWalletDetails()
}
updated(changedProperties) {
if (changedProperties && changedProperties.has("closeTipUser")) {
if (this.closeTipUser) {
- this.shadowRoot.getElementById("amountInput").value = "";
- this.errorMessage = "";
- this.successMessage = "";
+ this.shadowRoot.getElementById("amountInput").value = ""
+ this.errorMessage = ""
+ this.successMessage = ""
}
}
}
@@ -52,7 +52,7 @@ export class TipUser extends LitElement {
type: "api",
url: `/addresses/lastreference/${this.myAddress.address}`,
})
- return myRef;
+ return myRef
}
renderSuccessText() {
@@ -64,9 +64,9 @@ export class TipUser extends LitElement {
}
getApiKey() {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- let apiKey = myNode.apiKey;
- return apiKey;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ let apiKey = myNode.apiKey
+ return apiKey
}
async fetchWalletDetails() {
@@ -78,85 +78,85 @@ export class TipUser extends LitElement {
let snack4string = get("chatpage.cchange48")
parentEpml.request('showSnackBar', `${snack4string}`)
} else {
- this.walletBalance = Number(res).toFixed(8);
+ this.walletBalance = Number(res).toFixed(8)
}
})
}
async sendQort() {
- const amount = this.shadowRoot.getElementById("amountInput").value;
- let recipient = this.userName;
- this.sendMoneyLoading = true;
- this.btnDisable = true;
+ const amount = this.shadowRoot.getElementById("amountInput").value
+ let recipient = this.userName
+ this.sendMoneyLoading = true
+ this.btnDisable = true
if (parseFloat(amount) + parseFloat(0.001) > parseFloat(this.walletBalance)) {
- this.sendMoneyLoading = false;
- this.btnDisable = false;
- let snack1string = get("chatpage.cchange51");
- parentEpml.request('showSnackBar', `${snack1string}`);
- return false;
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ let snack1string = get("chatpage.cchange51")
+ parentEpml.request('showSnackBar', `${snack1string}`)
+ return false
}
if (parseFloat(amount) <= 0) {
- this.sendMoneyLoading = false;
- this.btnDisable = false;
- let snack2string = get("chatpage.cchange52");
- parentEpml.request('showSnackBar', `${snack2string}`);
- return false;
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ let snack2string = get("chatpage.cchange52")
+ parentEpml.request('showSnackBar', `${snack2string}`)
+ return false
}
if (recipient.length === 0) {
- this.sendMoneyLoading = false;
- this.btnDisable = false;
- let snack3string = get("chatpage.cchange53");
- parentEpml.request('showSnackBar', `${snack3string}`);
- return false;
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ let snack3string = get("chatpage.cchange53")
+ parentEpml.request('showSnackBar', `${snack3string}`)
+ return false
}
const validateName = async (receiverName) => {
- let myRes;
+ let myRes
let myNameRes = await parentEpml.request('apiCall', {
type: 'api',
url: `/names/${receiverName}`,
})
if (myNameRes.error === 401) {
- myRes = false;
+ myRes = false
} else {
- myRes = myNameRes;
+ myRes = myNameRes
}
return myRes;
}
const validateAddress = async (receiverAddress) => {
- let myAddress = await window.parent.validateAddress(receiverAddress);
- return myAddress;
+ let myAddress = await window.parent.validateAddress(receiverAddress)
+ return myAddress
}
const validateReceiver = async (recipient) => {
- let lastRef = await this.getLastRef();
- let isAddress;
+ let lastRef = await this.getLastRef()
+ let isAddress
try {
- isAddress = await validateAddress(recipient);
+ isAddress = await validateAddress(recipient)
} catch (err) {
- isAddress = false;
+ isAddress = false
}
if (isAddress) {
- let myTransaction = await makeTransactionRequest(recipient, lastRef);
- getTxnRequestResponse(myTransaction);
+ let myTransaction = await makeTransactionRequest(recipient, lastRef)
+ getTxnRequestResponse(myTransaction)
} else {
- let myNameRes = await validateName(recipient);
+ let myNameRes = await validateName(recipient)
if (myNameRes !== false) {
let myNameAddress = myNameRes.owner
let myTransaction = await makeTransactionRequest(myNameAddress, lastRef)
getTxnRequestResponse(myTransaction)
} else {
console.error(this.renderReceiverText())
- this.errorMessage = this.renderReceiverText();
- this.sendMoneyLoading = false;
- this.btnDisable = false;
+ this.errorMessage = this.renderReceiverText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
}
}
}
@@ -169,23 +169,23 @@ export class TipUser extends LitElement {
});
if (getNames?.length > 0 ) {
- return getNames[0].name;
+ return getNames[0].name
} else {
- return '';
+ return ''
}
} catch (error) {
- return "";
+ return ""
}
}
const makeTransactionRequest = async (receiver, lastRef) => {
- let myReceiver = receiver;
- let mylastRef = lastRef;
- let dialogamount = get("transactions.amount");
- let dialogAddress = get("login.address");
- let dialogName = get("login.name");
- let dialogto = get("transactions.to");
- let recipientName = await getName(myReceiver);
+ let myReceiver = receiver
+ let mylastRef = lastRef
+ let dialogamount = get("transactions.amount")
+ let dialogAddress = get("login.address")
+ let dialogName = get("login.name")
+ let dialogto = get("transactions.to")
+ let recipientName = await getName(myReceiver)
let myTxnrequest = await parentEpml.request('transaction', {
type: 2,
nonce: this.myAddress.nonce,
@@ -201,33 +201,33 @@ export class TipUser extends LitElement {
dialogName
},
})
- return myTxnrequest;
+ return myTxnrequest
}
const getTxnRequestResponse = (txnResponse) => {
if (txnResponse.success === false && txnResponse.message) {
- this.errorMessage = txnResponse.message;
- this.sendMoneyLoading = false;
- this.btnDisable = false;
- throw new Error(txnResponse);
+ this.errorMessage = txnResponse.message
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(txnResponse)
} else if (txnResponse.success === true && !txnResponse.data.error) {
- this.shadowRoot.getElementById('amountInput').value = '';
- this.errorMessage = '';
- this.successMessage = this.renderSuccessText();
- this.sendMoneyLoading = false;
- this.btnDisable = false;
+ this.shadowRoot.getElementById('amountInput').value = ''
+ this.errorMessage = ''
+ this.successMessage = this.renderSuccessText()
+ this.sendMoneyLoading = false
+ this.btnDisable = false
setTimeout(() => {
- this.setOpenTipUser(false);
- this.successMessage = "";
- }, 3000);
+ this.setOpenTipUser(false)
+ this.successMessage = ""
+ }, 3000)
} else {
- this.errorMessage = txnResponse.data.message;
- this.sendMoneyLoading = false;
- this.btnDisable = false;
- throw new Error(txnResponse);
+ this.errorMessage = txnResponse.data.message
+ this.sendMoneyLoading = false
+ this.btnDisable = false
+ throw new Error(txnResponse)
}
}
- validateReceiver(recipient);
+ validateReceiver(recipient)
}
render() {
@@ -274,4 +274,4 @@ export class TipUser extends LitElement {
`;
}
}
-customElements.define('tip-user', TipUser);
+customElements.define('tip-user', TipUser)
diff --git a/plugins/plugins/core/components/ToolTip.js b/plugins/plugins/core/components/ToolTip.js
index 2994a00e..d70f25fd 100644
--- a/plugins/plugins/core/components/ToolTip.js
+++ b/plugins/plugins/core/components/ToolTip.js
@@ -1,5 +1,6 @@
import { LitElement, html, css } from 'lit'
import { Epml } from '../../../epml.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
diff --git a/plugins/plugins/core/components/UserInfo/UserInfo.js b/plugins/plugins/core/components/UserInfo/UserInfo.js
index ea8fe4de..6a44e408 100644
--- a/plugins/plugins/core/components/UserInfo/UserInfo.js
+++ b/plugins/plugins/core/components/UserInfo/UserInfo.js
@@ -1,119 +1,110 @@
-import { LitElement, html } from 'lit';
-import { render } from 'lit/html.js';
-import { translate } from 'lit-translate';
-import { userInfoStyles } from './UserInfo-css.js';
-import { Epml } from '../../../../epml';
-import '@vaadin/button';
-import '@polymer/paper-progress/paper-progress.js';
-import { cropAddress } from '../../../utils/cropAddress.js';
+import { LitElement, html } from 'lit'
+import { render } from 'lit/html.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+import { userInfoStyles } from './UserInfo-css.js'
+import { Epml } from '../../../../epml'
+import { cropAddress } from '../../../utils/cropAddress.js'
+
+import '@polymer/paper-progress/paper-progress.js'
+import '@vaadin/button'
+
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
export class UserInfo extends LitElement {
- static get properties() {
- return {
- setOpenUserInfo: { attribute: false },
- setOpenTipUser: { attribute: false },
- setOpenPrivateMessage: { attribute: false },
- userName: { type: String },
- selectedHead: { type: Object },
- isImageLoaded: { type: Boolean }
+ static get properties() {
+ return {
+ setOpenUserInfo: { attribute: false },
+ setOpenTipUser: { attribute: false },
+ setOpenPrivateMessage: { attribute: false },
+ userName: { type: String },
+ selectedHead: { type: Object },
+ isImageLoaded: { type: Boolean }
}
- }
+ }
- constructor() {
- super()
- this.isImageLoaded = false
- this.selectedHead = {}
- this.imageFetches = 0
+ constructor() {
+ super()
+ this.isImageLoaded = false
+ this.selectedHead = {}
+ this.imageFetches = 0
+ }
+
+ static styles = [userInfoStyles]
+
+ createImage(imageUrl) {
+ const imageHTMLRes = new Image()
+ imageHTMLRes.src = imageUrl
+ imageHTMLRes.classList.add("user-info-avatar")
+ imageHTMLRes.onload = () => {
+ this.isImageLoaded = true
+ }
+ imageHTMLRes.onerror = () => {
+ if (this.imageFetches < 4) {
+ setTimeout(() => {
+ this.imageFetches = this.imageFetches + 1
+ imageHTMLRes.src = imageUrl;
+ }, 10000)
+ } else {
+ this.isImageLoaded = false
+ }
+ }
+ return imageHTMLRes
+ }
+
+
+ render() {
+ let avatarImg = ""
+ if (this.selectedHead && this.selectedHead.name) {
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ const avatarUrl = `${nodeUrl}/arbitrary/THUMBNAIL/${this.selectedHead.name}/qortal_avatar?async=true&apiKey=${myNode.apiKey}`
+ avatarImg = this.createImage(avatarUrl)
+ }
+ return html`
+ 2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=W}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,o){const n=this.strings;let s=!1;if(void 0===n)e=R(this,e,t,0),s=!b(e)||e!==this._$AH&&e!==V,s&&(this._$AH=e);else{const o=e;let r,a;for(e=n[0],r=0;r{var o,n;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:t;let r=s._$litPart$;if(void 0===r){const e=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;s._$litPart$=r=new J(t.insertBefore(x(),e),e,void 0,null!=i?i:{})}return r._$AI(e),r};var ne,se;let re=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=oe(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return V}};re.finalized=!0,re._$litElement$=!0,null===(ne=globalThis.litElementHydrateSupport)||void 0===ne||ne.call(globalThis,{LitElement:re});const ae=globalThis.litElementPolyfillSupport;function le(e=!1){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(e){}if(e){const e=`[Passive Events Support] "passive" option is ${t?"":"not "}supported by your browser.`;t?console.info(e):console.warn(e)}return t}function he(e){return["touchstart","touchmove","touchenter","touchend","touchleave","wheel","mousewheel"].includes(e)}null==ae||ae({LitElement:re}),(null!==(se=globalThis.litElementVersions)&&void 0!==se?se:globalThis.litElementVersions=[]).push("3.3.2");class me{static prepareOutgoingData(e){return JSON.stringify(e)}constructor(e){if(!e)throw new Error("Source must be spcified");if(!this.constructor.type)throw new Error("Type not defined");if(this.constructor.name||console.warn("No name provided"),this.constructor.description||console.warn("No description provided"),!this.sendMessage)throw new Error("A new target requires a sendMessage method")}}const ce={},de={};class pe{static registerPlugin(e,t){return e.init(pe,t),pe}static registerTargetType(e,t){if(e in de)throw new Error("Target type has already been registered");if(!(t.prototype instanceof me))throw new Error("Target constructors must inherit from the Target base class");return de[e]=t,pe}static registerEpmlMessageType(e,t){return ce[e]=t,pe}registerPlugin(e){return e.init(this),this}static handleMessage(e,t){const i=pe.prepareIncomingData(e);"EpmlMessageType"in i&&ce[i.EpmlMessageType](i,t,this)}static prepareIncomingData(e){return"string"!=typeof e?e:JSON.parse(e)}static createTargets(e){Array.isArray(e)||(e=[e]);const t=[];for(const i of e)void 0===i.allowObjects&&(i.allowObjects=!1),t.push(...pe.createTarget(i));return t}static createTarget(e){if(!de[e.type])throw new Error(`Target type '${e.type}' not registered`);let t=new de[e.type](e.source);Array.isArray(t)||(t=[t]);for(const i of t)i.allowObjects=e.allowObjects;return t}constructor(e){this.targets=this.constructor.createTargets(e)}}var je=(e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t};const Pe=15,we="EPML_READY_STATE_CHECK",ue="EPML_READY_STATE_CHECK_RESPONSE",fe={},Me={init:(e,t)=>{if(e.prototype.ready)throw new Error("Epml.prototype.ready is already defined");if(e.prototype.imReady)throw new Error("Epml.prototype.imReady is already defined");e.prototype.ready=ye,e.prototype.resetReadyCheck=ge,e.prototype.imReady=Ke,e.registerEpmlMessageType(we,Ze),e.registerEpmlMessageType(ue,xe)}};function Ze(e,t){t._i_am_ready&&t.sendMessage({EpmlMessageType:ue,requestID:e.requestID})}function Ke(){for(const e of this.targets)e._i_am_ready=!0}function ye(){return this._ready_plugin=this._ready_plugin||{},this._ready_plugin.pendingReadyResolves=this._ready_plugin.pendingReadyResolves?this._ready_plugin.pendingReadyResolves:[],this._pending_ready_checking||(this._pending_ready_checking=!0,De.call(this,this.targets).then((()=>{this._ready_plugin.pendingReadyResolves.forEach((e=>e()))}))),new Promise((e=>{this._ready_plugin.isReady?e():this._ready_plugin.pendingReadyResolves.push(e)}))}function ge(){this._ready_plugin=this._ready_plugin||{},this._ready_plugin.isReady=!1}function De(e){return this._ready_plugin=this._ready_plugin||{},this._ready_plugin.pendingReadyResolves=[],Promise.all(e.map((e=>new Promise(((t,i)=>{const o=je(),n=setInterval((()=>{e.sendMessage({EpmlMessageType:we,requestID:o})}),Pe);fe[o]=()=>{clearInterval(n),t()}}))))).then((()=>{this._ready_plugin.isReady=!0}))}function xe(e,t){t._ready_plugin=t._ready_plugin||{},t._ready_plugin._is_ready=!0,fe[e.requestID]()}const be=new Map;class ve extends me{static get sources(){return Array.from(be.keys())}static get targets(){return Array.from(be.values())}static getTargetFromSource(e){return be.get(e)}static hasTarget(e){return be.has(e)}static get type(){return"WINDOW"}static get name(){return"Content window plugin"}static get description(){return"Allows Epml to communicate with iframes and popup windows."}static test(e){return"object"==typeof e&&e===e.self}isFrom(e){}constructor(e){if(super(e),be.has(e))return be.get(e);if(!this.constructor.test(e))throw new Error("Source can not be used with target");this._source=e,this._sourceOrigin="*",be.set(e,this)}get source(){return this._source}sendMessage(e){e=me.prepareOutgoingData(e),this._source.postMessage(e,this._sourceOrigin)}}var Ye={init:function(e){!function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else{if(!e.attachEvent)throw new Error("Could not bind event.");e.attachEvent("on"+t,i)}}(window,"message",(t=>{ve.hasTarget(t.source)&&e.handleMessage(t.data,ve.getTargetFromSource(t.source))})),e.registerTargetType(ve.type,ve)}};const Se="REQUEST",Te="REQUEST_RESPONSE",Xe=new Map,Ee={},ke={init:(e,t)=>{if(e.prototype.request)throw new Error("Epml.prototype.request is already defined");if(e.prototype.route)throw new Error("Empl.prototype.route is already defined");e.prototype.request=ze,e.prototype.route=Oe,e.registerEpmlMessageType(Se,Ae),e.registerEpmlMessageType(Te,Ge)}},ze=function(e,t,i){return Promise.all(this.targets.map((o=>{const n=je(),s={EpmlMessageType:Se,requestOrResponse:"request",requestID:n,requestType:e,data:t};return o.sendMessage(s),new Promise(((e,t)=>{let o;i&&(o=setTimeout((()=>{delete Ee[n],t(new Error("Request timed out"))}),i)),Ee[n]=(...t)=>{o&&clearTimeout(o),e(...t)}}))}))).then((e=>{if(1===this.targets.length)return e[0]}))};function Ge(e,t,i){if(e.requestID in Ee){const t=e.data;Ee[e.requestID](t)}else console.warn("requestID not found in pendingRequests")}function Ae(e,t){if(!Xe.has(t))return void console.warn("Route does not exist - missing target");const i=Xe.get(t)[e.requestType];i?i(e,t):console.warn("Route does not exist")}function Oe(e,t){if(this.routes||(this.routes={}),!this.routes[e])for(const i of this.targets){Xe.has(i)||Xe.set(i,{});Xe.get(i)[e]=(e,i)=>{Promise.resolve(t(e)).catch((e=>e instanceof Error?e.message:e)).then((t=>{i.sendMessage({data:t,EpmlMessageType:Te,requestOrResponse:"request",requestID:e.requestID})}))}}}const Ce="PROXY_MESSAGE",Ne=new class{constructor(e){this._map=e||new Map,this._revMap=new Map,this._map.forEach(((e,t)=>{this._revMap.set(t,e)}))}values(){return this._map.values()}entries(){return this._map.entries()}push(e,t){this._map.set(e,t),this._revMap.set(t,e)}getByKey(e){return this._map.get(e)}getByValue(e){return this._revMap.get(e)}hasKey(e){return this._map.has(e)}hasValue(e){return this._revMap.has(e)}deleteByKey(e){const t=this._map.get(e);this._map.delete(e),this._revMap.delete(t)}deleteByValue(e){const t=this._revMap.get(e);this._map.delete(t),this._revMap.delete(e)}};class Ve extends me{static get proxySources(){return Ne}static get sources(){for(const[e,t]of Ne)for(const[e]of t);Array.from(Ne.entries()).map(((e,t)=>({proxy:e,target:Array.from(t.keys())[0]})))}static get targets(){return Array.from(Ne.values())}static getTargetFromSource(e){return Ne.getByValue(e)}static hasTarget(e){return Ne.hasValue(e)}static get type(){return"PROXY"}static get name(){return"Proxy target"}static get description(){return"Uses other target, and proxies requests, allowing things like iframes to communicate through their host"}static test(e){return"object"==typeof e&&e.proxy instanceof this.Epml}isFrom(e){}constructor(e){if(super(e),this.constructor.proxySources.push(e.id,this),!this.constructor.test(e))throw new Error("Source can not be used with target");this._source=e}get source(){return this._source}sendMessage(e){const t=je();e=me.prepareOutgoingData(e),e={EpmlMessageType:Ce,state:"TRANSIT",requestID:t,target:this._source.target,message:e,id:this._source.id},this._source.proxy.targets[0].sendMessage(e)}}const We=Ve.proxySources;let _e;var Ie={init:function(e){Object.defineProperty(Ve,"Epml",{get:()=>e}),_e=e,e.registerTargetType(Ve.type,Ve),e.registerProxyInstance=Ue,e.registerEpmlMessageType(Ce,He)}};function He(e,t){if("TRANSIT"===e.state){const t=We.getByKey(e.target);if(!t)return void console.warn(`Target ${e.target} not registered.`);e.state="DELIVERY",t.targets.forEach((t=>t.sendMessage(e)))}else if("DELIVERY"===e.state){if(!We.getByKey(e.target))return void console.warn(`Target ${e.target} not registered.`);const t=We.getByKey(e.target);_e.handleMessage(e.message,t)}}function Ue(e,t){We.hasKey(e)&&console.warn(`${e} is already defined. Overwriting...`),We.push(e,t)}new Map;const Re="STREAM_UPDATE",Fe={};class Je{static get streams(){return Fe}constructor(e,t=(()=>{})){if(this._name=e,this.targets=[],this._subscriptionFn=t,e in Fe)return console.warn(`Stream with name ${e} already exists! Returning it instead`),Fe[e];Fe[e]=this}async subscribe(e){e in this.targets&&console.info("Target is already subscribed to this stream");const t=await this._subscriptionFn();this._sendMessage(t,e),this.targets.push(e)}_sendMessage(e,t){t.sendMessage({data:me.prepareOutgoingData(e),EpmlMessageType:Re,streamName:this._name})}emit(e){this.targets.forEach((t=>this._sendMessage(e,t)))}}const Le="JOIN_STREAM",Be={},Qe={init:(e,t)=>{if(e.prototype.subscribe)throw new Error("Epml.prototype.subscribe is already defined");if(e.prototype.createStream)throw new Error("Empl.prototype.createStream is already defined");e.prototype.subscribe=qe,e.registerEpmlMessageType(Le,$e),e.registerEpmlMessageType(Re,et)}},$e=function(e,t){const i=e.data.name,o=Je.streams[i];o?o.subscribe(t):console.warn(`No stream with name ${i}`,this)},qe=function(e,t){this.targets.forEach((t=>{t.sendMessage({EpmlMessageType:Le,data:{name:e}})})),Be[e]=Be[e]||[],Be[e].push(t)},et=function(e,t){Be[e.streamName].forEach((t=>t(e.data)))};pe.registerPlugin(ke),pe.registerPlugin(Me),pe.registerPlugin(Ye),pe.registerPlugin(Qe),pe.registerPlugin(Ie),pe.allowProxying=!0;const tt="langChanged";function it(e,t,i){return Object.entries(nt(t||{})).reduce(((e,[t,i])=>e.replace(new RegExp(`{{[ ]*${t}[ ]*}}`,"gm"),String(nt(i)))),e)}function ot(e,t){const i=e.split(".");let o=t.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function nt(e){return"function"==typeof e?e():e}let st={loader:()=>Promise.resolve({}),empty:e=>`[${e}]`,lookup:ot,interpolate:it,translationCache:{}};function rt(e){return st=Object.assign(Object.assign({},st),e)}function at(e,t,i=st){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=e,strings:i.strings=t},window.dispatchEvent(new CustomEvent(tt,{detail:o}))}async function lt(e,t=st){const i=await t.loader(e,t);t.translationCache={},at(e,i,t)}function ht(e,t,i=st){let o=i.translationCache[e]||(i.translationCache[e]=i.lookup(e,i)||i.empty(e,i));return null!=(t=null!=t?nt(t):null)?i.interpolate(o,t,i):o}const mt=1,ct=2,dt=e=>(...t)=>({_$litDirective$:e,values:t});let pt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:jt}=te,Pt={HTML:1,SVG:2},wt=(e,t)=>void 0===t?void 0!==(null==e?void 0:e._$litType$):(null==e?void 0:e._$litType$)===t,ut=()=>document.createComment(""),ft=(e,t,i)=>{var o;const n=e._$AA.parentNode,s=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=n.insertBefore(ut(),s),o=n.insertBefore(ut(),s);i=new jt(t,o,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,a=r!==e;if(a){let t;null===(o=i._$AQ)||void 0===o||o.call(i,e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==s||a){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;n.insertBefore(e,s),e=t}}}return i},Mt=(e,t,i=e)=>(e._$AI(t,i),e),Zt={},Kt=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let i=e._$AA;const o=e._$AB.nextSibling;for(;i!==o;){const e=i.nextSibling;i.remove(),i=e}},yt=(e,t)=>{var i,o;const n=e._$AN;if(void 0===n)return!1;for(const e of n)null===(o=(i=e)._$AO)||void 0===o||o.call(i,t,!1),yt(e,t);return!0},gt=e=>{let t,i;do{if(void 0===(t=e._$AM))break;i=t._$AN,i.delete(e),e=t}while(0===(null==i?void 0:i.size))},Dt=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(void 0===i)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),vt(t)}};function xt(e){void 0!==this._$AN?(gt(this),this._$AM=e,Dt(this)):this._$AM=e}function bt(e,t=!1,i=0){const o=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(o))for(let e=i;e{var t,i,o,n;e.type==ct&&(null!==(t=(o=e)._$AP)&&void 0!==t||(o._$AP=bt),null!==(i=(n=e)._$AQ)&&void 0!==i||(n._$AQ=xt))};let Yt=class extends pt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),Dt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,o;e!==this.isConnected&&(this.isConnected=e,e?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),t&&(yt(this,e),gt(this))}setValue(e){if((e=>void 0===e.strings)(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};class St extends Yt{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(e){return this.getValue=e,this.subscribe(),this.getValue()}langChanged(e){this.setValue(this.getValue(e))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(e,t){const i=t=>e(t.detail);return window.addEventListener(tt,i,t),()=>window.removeEventListener(tt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const Tt=dt(class extends St{render(e,t,i){return this.renderValue((()=>ht(e,t,i)))}});let Xt=class extends pt{constructor(e){if(super(e),this.et=W,e.type!==ct)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===W||null==e)return this.ft=void 0,this.et=e;if(e===V)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.et)return this.ft;this.et=e;const t=[e];return t.raw=t,this.ft={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Xt.directiveName="unsafeHTML",Xt.resultType=1;const Et=dt(Xt),kt=s`
- * {
- --mdc-theme-primary: rgb(3, 169, 244);
- --mdc-theme-secondary: var(--mdc-theme-primary);
- --paper-input-container-focus-color: var(--mdc-theme-primary);
- --mdc-theme-surface: var(--white);
- --mdc-dialog-content-ink-color: var(--black);
- --lumo-primary-text-color: rgb(0, 167, 245);
- --lumo-primary-color-50pct: rgba(0, 167, 245, 0.5);
- --lumo-primary-color-10pct: rgba(0, 167, 245, 0.1);
- --lumo-primary-color: hsl(199, 100%, 48%);
- --lumo-base-color: var(--white);
- --lumo-body-text-color: var(--black);
- --_lumo-grid-border-color: var(--border);
- --_lumo-grid-secondary-border-color: var(--border2);
- --mdc-dialog-min-width: 750px;
- }
-
- paper-spinner-lite {
- height: 24px;
- width: 24px;
- --paper-spinner-color: var(--mdc-theme-primary);
- --paper-spinner-stroke-width: 2px;
- }
-
- *,
- *:before,
- *:after {
- box-sizing: border-box;
- }
-
- ul {
- list-style: none;
- padding: 0;
- }
-
- .container {
- margin: 0 auto;
- width: 100%;
- background: var(--white);
- }
-
- .people-list {
- width: 20vw;
- float: left;
- height: 100vh;
- overflow-y: hidden;
- border-right: 3px #ddd solid;
- }
-
- .people-list .blockedusers {
- z-index: 1;
- position: absolute;
- bottom: 0;
- width: 20vw;
- background: var(--white);
- border-right: 3px #ddd solid;
- display: flex;
- justify-content: space-between;
- gap: 15px;
- flex-direction: column;
- padding: 5px 30px 0 30px;
- }
-
- .groups-button-container {
- position: relative;
- }
-
- .groups-button {
- width: 100%;
- background-color: rgb(116, 69, 240);
- border: none;
- color: white;
- font-weight: bold;
- font-family: 'Roboto';
- letter-spacing: 0.8px;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 5px;
- gap: 10px;
- padding: 5px 8px;
- transition: all 0.1s ease-in-out;
- }
-
- .groups-button-notif {
- position: absolute;
- top: -10px;
- right: -8px;
- width: 25px;
- border-radius: 50%;
- height: 25px;
- font-weight: bold;
- display: flex;
- align-items: center;
- justify-content: center;
- font-family: Montserrat, sans-serif;
- font-size: 16px;
- font-weight: bold;
- color: black;
- background-color: rgb(51, 213, 0);
- user-select: none;
- transition: all 0.3s ease-in-out 0s;
- }
-
- .groups-button-notif:hover {
- cursor: auto;
- box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
- }
-
- .groups-button-notif:hover + .groups-button-notif-number {
- display: block;
- opacity: 1;
- animation: fadeIn 0.6s;
-}
-
-@keyframes fadeIn {
- from {
- opacity: 0;
- top: -10px;
- }
-
- to {
- opacity: 1;
- top: -60px;
- }
-}
-
- .groups-button-notif-number {
- position: absolute;
- transform: translateX(-50%);
- left: 50%;
- width: 150px;
- text-align: center;
- border-radius: 3px;
- padding: 5px 10px;
- background-color: white;
- color: black;
- font-family: Roboto, sans-serif;
- letter-spacing: 0.3px;
- font-weight: 300;
- display: none;
- opacity: 0;
- top: -60px;
- box-shadow: rgb(216 216 216 / 25%) 0px 6px 12px -2px, rgb(0 0 0 / 30%) 0px 3px 7px -3px;
- }
-
- .groups-button:hover {
- cursor: pointer;
- filter: brightness(120%);
- }
-
- .people-list .search {
- padding-top: 20px;
- padding-left: 20px;
- padding-right: 20px;
- }
-
- .center {
- margin: 0;
- position: absolute;
- padding-top: 12px;
- left: 50%;
- -ms-transform: translateX(-50%);
- transform: translateX(-50%);
- }
-
- .people-list .create-chat {
- border-radius: 5px;
- border: none;
- display: inline-block;
- padding: 14px;
- color: #fff;
- background: var(--tradehead);
- width: 100%;
- font-size: 15px;
- text-align: center;
- cursor: pointer;
- }
-
- .people-list .create-chat:hover {
- opacity: .8;
- box-shadow: 0 3px 5px rgba(0, 0, 0, .2);
- }
-
- .people-list ul {
- padding: 0px 0px 60px 0px;
- height: 85vh;
- overflow-y: auto;
- overflow-x: hidden;
- }
-
- .people-list ul::-webkit-scrollbar-track {
- background-color: whitesmoke;
- border-radius: 7px;
- }
-
- .people-list ul::-webkit-scrollbar {
- width: 6px;
- border-radius: 7px;
- background-color: whitesmoke;
- }
-
- .people-list ul::-webkit-scrollbar-thumb {
- background-color: rgb(180, 176, 176);
- border-radius: 7px;
- transition: all 0.3s ease-in-out;
- }
-
- .chat {
- width: 80vw;
- height: 100vh;
- float: left;
- background: var(--white);
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
- color: #434651;
- box-sizing: border-box;
- }
-
- .chat .new-message-bar {
- display: flex;
- flex: 0 1 auto;
- align-items: center;
- justify-content: space-between;
- padding: 0px 25px;
- font-size: 14px;
- font-weight: 500;
- top: 0;
- position: absolute;
- left: 20vw;
- right: 0;
- z-index: 5;
- background: var(--tradehead);
- color: var(--white);
- border-radius: 0 0 8px 8px;
- min-height: 25px;
- transition: opacity .15s;
- text-transform: capitalize;
- opacity: .85;
- cursor: pointer;
- }
-
- .chat .new-message-bar:hover {
- opacity: .75;
- transform: translateY(-1px);
- box-shadow: 0 3px 7px rgba(0, 0, 0, .2);
- }
-
- .hide-new-message-bar {
- display: none !important;
- }
-
- .chat .chat-history {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 100%;
- left: 20vw;
- border-bottom: 2px solid var(--white);
- overflow-y: hidden;
- height: 100vh;
- box-sizing: border-box;
- }
-
- .chat .chat-message {
- padding: 10px;
- height: 10%;
- display: inline-block;
- width: 100%;
- background-color: #eee;
- }
-
- .chat .chat-message textarea {
- width: 90%;
- border: none;
- font-size: 16px;
- padding: 10px 20px;
- border-radius: 5px;
- resize: none;
- }
-
- .chat .chat-message button {
- float: right;
- color: #94c2ed;
- font-size: 16px;
- text-transform: uppercase;
- border: none;
- cursor: pointer;
- font-weight: bold;
- background: #f2f5f8;
- padding: 10px;
- margin-top: 4px;
- margin-right: 4px;
- }
-
- .chat .chat-message button:hover {
- color: #75b1e8;
- }
-
- .online,
- .offline,
- .me {
- margin-right: 3px;
- font-size: 10px;
- }
-
- .clearfix:after {
- visibility: hidden;
- display: block;
- font-size: 0;
- content: " ";
- clear: both;
- height: 0;
- }
-
- .red {
- --mdc-theme-primary: red;
- }
-
- h2 {
- margin:0;
- }
-
- h2, h3, h4, h5 {
- color: var(--black);
- font-weight: 400;
- }
-
- [hidden] {
- display: hidden !important;
- visibility: none !important;
- }
-
- .details {
- display: flex;
- font-size: 18px;
- }
-
- .title {
- font-weight:600;
- font-size:12px;
- line-height: 32px;
- opacity: 0.66;
- }
-
- .textarea {
- width: 100%;
- border: none;
- display: inline-block;
- font-size: 16px;
- padding: 10px 20px;
- border-radius: 5px;
- height: 120px;
- resize: none;
- background: #eee;
- }
-
- .dialog-container {
- position: relative;
- display: flex;
- align-items: center;
- flex-direction: column;
- padding: 0 10px;
- gap: 10px;
- height: 100%;
- }
-
- .dialog-header {
- color: var(--chat-bubble-msg-color);
- }
-
- .dialog-subheader {
- color: var(--chat-bubble-msg-color);
- }
-
- .modal-button-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- }
-
- .modal-button {
- font-family: Roboto, sans-serif;
- font-size: 16px;
- color: var(--mdc-theme-primary);
- background-color: transparent;
- padding: 8px 10px;
- border-radius: 5px;
- border: none;
- transition: all 0.3s ease-in-out;
- }
-
- .modal-button-red {
- font-family: Roboto, sans-serif;
- font-size: 16px;
- color: #F44336;
- background-color: transparent;
- padding: 8px 10px;
- border-radius: 5px;
- border: none;
- transition: all 0.3s ease-in-out;
- }
-
- .modal-button-red:hover {
- cursor: pointer;
- background-color: #f4433663;
- }
-
- .modal-button:hover {
- cursor: pointer;
- background-color: #03a8f475;
- }
-
- .name-input {
- width: 100%;
- outline: 0;
- border-width: 0 0 2px;
- border-color: var(--mdc-theme-primary);
- background-color: transparent;
- padding: 10px;
- font-family: Roboto, sans-serif;
- font-size: 15px;
- color: var(--chat-bubble-msg-color);
- box-sizing: border-box;
- }
-
- .name-input::selection {
- background-color: var(--mdc-theme-primary);
- color: white;
- }
-
- .name-input::placeholder {
- opacity: 0.9;
- color: var(--black);
- }
-
- .search-field {
- width: 100%;
- position: relative;
- }
-
- .search-icon {
- position: absolute;
- right: 3px;
- color: var(--chat-bubble-msg-color);
- transition: all 0.3s ease-in-out;
- background: none;
- border-radius: 50%;
- padding: 6px 3px;
- font-size: 21px;
- }
-
- .search-icon:hover {
- cursor: pointer;
- background: #d7d7d75c;
- }
-
- .search-results-div {
- position: absolute;
- top: 25px;
- right: 25px;
- }
-
- .user-verified {
- position: absolute;
- top: 0;
- right: 5px;
- display: flex;
- align-items: center;
- gap: 10px;
- color: #04aa2e;
- font-size: 13px;
- }
-`;var zt=null;try{var Gt="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||"function"==typeof require&&require("worker_threads");zt=Gt.Worker}catch(pY){}function At(e,t,i){var o=void 0===t?null:t,n=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==i&&i),s=n.indexOf("\n",10)+1,r=n.substring(s)+(o?"//# sourceMappingURL="+o:"");return function(e){return new zt(r,Object.assign({},e,{eval:!0}))}}function Ot(e,t,i){var o=void 0===t?null:t,n=function(e,t){var i=atob(e);if(t){for(var o=new Uint8Array(i.length),n=0,s=i.length;n{const o=new Map;for(let n=t;n<=i;n++)o.set(e[n],n);return o},_t=dt(class extends pt{constructor(e){if(super(e),e.type!==ct)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let o;void 0===i?i=t:void 0!==t&&(o=t);const n=[],s=[];let r=0;for(const t of e)n[r]=o?o(t,r):r,s[r]=i(t,r),r++;return{values:s,keys:n}}render(e,t,i){return this.dt(e,t,i).values}update(e,[t,i,o]){var n;const s=(e=>e._$AH)(e),{values:r,keys:a}=this.dt(t,i,o);if(!Array.isArray(s))return this.ht=a,r;const l=null!==(n=this.ht)&&void 0!==n?n:this.ht=[],h=[];let m,c,d=0,p=s.length-1,j=0,P=r.length-1;for(;d<=p&&j<=P;)if(null===s[d])d++;else if(null===s[p])p--;else if(l[d]===a[j])h[j]=Mt(s[d],r[j]),d++,j++;else if(l[p]===a[P])h[P]=Mt(s[p],r[P]),p--,P--;else if(l[d]===a[P])h[P]=Mt(s[d],r[P]),ft(e,h[P+1],s[d]),d++,P--;else if(l[p]===a[j])h[j]=Mt(s[p],r[j]),ft(e,s[d],s[p]),p--,j++;else if(void 0===m&&(m=Wt(a,j,P),c=Wt(l,d,p)),m.has(l[d]))if(m.has(l[p])){const t=c.get(a[j]),i=void 0!==t?s[t]:null;if(null===i){const t=ft(e,s[d]);Mt(t,r[j]),h[j]=t}else h[j]=Mt(i,r[j]),ft(e,s[d],i),s[t]=null;j++}else Kt(s[p]),p--;else Kt(s[d]),d++;for(;j<=P;){const t=ft(e,h[P+1]);Mt(t,r[j]),h[j++]=t}for(;d<=p;){const e=s[d++];null!==e&&Kt(e)}return this.ht=a,((e,t=Zt)=>{e._$AH=t})(e,h),V}});var It=function(e,t){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},It(e,t)};function Ht(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}It(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Ut=function(){return Ut=Object.assign||function(e){for(var t,i=1,o=arguments.length;i=0;a--)(n=e[a])&&(r=(s<3?n(r):s>3?n(t,i,r):n(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r}function Ft(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],o=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}const Jt=e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:i,elements:o}=t;return{kind:i,elements:o,finisher(t){customElements.define(e,t)}}})(e,t),Lt=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(i){i.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}};function Bt(e){return(t,i)=>void 0!==i?((e,t,i)=>{t.constructor.createProperty(i,e)})(e,t,i):Lt(e,t)}function Qt(e){return Bt({...e,state:!0})}const $t=({finisher:e,descriptor:t})=>(i,o)=>{var n;if(void 0===o){const o=null!==(n=i.originalKey)&&void 0!==n?n:i.key,s=null!=t?{kind:"method",placement:"prototype",key:o,descriptor:t(i.key)}:{...i,key:o};return null!=e&&(s.finisher=function(t){e(t,o)}),s}{const n=i.constructor;void 0!==t&&Object.defineProperty(i,o,t(o)),null==e||e(n,o)}};function qt(e){return $t({finisher:(t,i)=>{Object.assign(t.prototype[i],e)}})}function ei(e,t){return $t({descriptor:i=>{const o={get(){var t,i;return null!==(i=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(t){const t="symbol"==typeof i?Symbol():"__"+i;o.get=function(){var i,o;return void 0===this[t]&&(this[t]=null!==(o=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(e))&&void 0!==o?o:null),this[t]}}return o}})}function ti(e){return $t({descriptor:t=>({async get(){var t;return await this.updateComplete,null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e)},enumerable:!0,configurable:!0})})}var ii;null===(ii=window.HTMLSlotElement)||void 0===ii||ii.prototype.assignedElements;const oi=s`:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`;let ni=class extends re{render(){return C` `}};function si(e,t){return(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,t)}function ri(e){return{addClass:t=>{e.classList.add(t)},removeClass:t=>{e.classList.remove(t)},hasClass:t=>e.classList.contains(t)}}ni.styles=[oi],ni=Rt([Jt("mwc-icon")],ni);const ai=()=>{},li={get passive(){return!1}};document.addEventListener("x",ai,li),document.removeEventListener("x",ai);class hi extends re{click(){if(this.mdcRoot)return this.mdcRoot.focus(),void this.mdcRoot.click();super.click()}createFoundation(){void 0!==this.mdcFoundation&&this.mdcFoundation.destroy(),this.mdcFoundationClass&&(this.mdcFoundation=new this.mdcFoundationClass(this.createAdapter()),this.mdcFoundation.init())}firstUpdated(){this.createFoundation()}}var mi=function(){function e(e){void 0===e&&(e={}),this.adapter=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),ci={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},di={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},pi={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300};var ji=["touchstart","pointerdown","mousedown","keydown"],Pi=["touchend","pointerup","mouseup","contextmenu"],wi=[],ui=function(e){function t(i){var o=e.call(this,Ut(Ut({},t.defaultAdapter),i))||this;return o.activationAnimationHasEnded=!1,o.activationTimer=0,o.fgDeactivationRemovalTimer=0,o.fgScale="0",o.frame={width:0,height:0},o.initialSize=0,o.layoutFrame=0,o.maxRadius=0,o.unboundedCoords={left:0,top:0},o.activationState=o.defaultActivationState(),o.activationTimerCallback=function(){o.activationAnimationHasEnded=!0,o.runDeactivationUXLogicIfReady()},o.activateHandler=function(e){o.activateImpl(e)},o.deactivateHandler=function(){o.deactivateImpl()},o.focusHandler=function(){o.handleFocus()},o.blurHandler=function(){o.handleBlur()},o.resizeHandler=function(){o.layout()},o}return Ht(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return ci},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return di},enumerable:!1,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return pi},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!1,configurable:!0}),t.prototype.init=function(){var e=this,i=this.supportsPressRipple();if(this.registerRootHandlers(i),i){var o=t.cssClasses,n=o.ROOT,s=o.UNBOUNDED;requestAnimationFrame((function(){e.adapter.addClass(n),e.adapter.isUnbounded()&&(e.adapter.addClass(s),e.layoutInternal())}))}},t.prototype.destroy=function(){var e=this;if(this.supportsPressRipple()){this.activationTimer&&(clearTimeout(this.activationTimer),this.activationTimer=0,this.adapter.removeClass(t.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer&&(clearTimeout(this.fgDeactivationRemovalTimer),this.fgDeactivationRemovalTimer=0,this.adapter.removeClass(t.cssClasses.FG_DEACTIVATION));var i=t.cssClasses,o=i.ROOT,n=i.UNBOUNDED;requestAnimationFrame((function(){e.adapter.removeClass(o),e.adapter.removeClass(n),e.removeCssVars()}))}this.deregisterRootHandlers(),this.deregisterDeactivationHandlers()},t.prototype.activate=function(e){this.activateImpl(e)},t.prototype.deactivate=function(){this.deactivateImpl()},t.prototype.layout=function(){var e=this;this.layoutFrame&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame((function(){e.layoutInternal(),e.layoutFrame=0}))},t.prototype.setUnbounded=function(e){var i=t.cssClasses.UNBOUNDED;e?this.adapter.addClass(i):this.adapter.removeClass(i)},t.prototype.handleFocus=function(){var e=this;requestAnimationFrame((function(){return e.adapter.addClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.handleBlur=function(){var e=this;requestAnimationFrame((function(){return e.adapter.removeClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.supportsPressRipple=function(){return this.adapter.browserSupportsCssVars()},t.prototype.defaultActivationState=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},t.prototype.registerRootHandlers=function(e){var t,i;if(e){try{for(var o=Ft(ji),n=o.next();!n.done;n=o.next()){var s=n.value;this.adapter.registerInteractionHandler(s,this.activateHandler)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}this.adapter.isUnbounded()&&this.adapter.registerResizeHandler(this.resizeHandler)}this.adapter.registerInteractionHandler("focus",this.focusHandler),this.adapter.registerInteractionHandler("blur",this.blurHandler)},t.prototype.registerDeactivationHandlers=function(e){var t,i;if("keydown"===e.type)this.adapter.registerInteractionHandler("keyup",this.deactivateHandler);else try{for(var o=Ft(Pi),n=o.next();!n.done;n=o.next()){var s=n.value;this.adapter.registerDocumentInteractionHandler(s,this.deactivateHandler)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}},t.prototype.deregisterRootHandlers=function(){var e,t;try{for(var i=Ft(ji),o=i.next();!o.done;o=i.next()){var n=o.value;this.adapter.deregisterInteractionHandler(n,this.activateHandler)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}this.adapter.deregisterInteractionHandler("focus",this.focusHandler),this.adapter.deregisterInteractionHandler("blur",this.blurHandler),this.adapter.isUnbounded()&&this.adapter.deregisterResizeHandler(this.resizeHandler)},t.prototype.deregisterDeactivationHandlers=function(){var e,t;this.adapter.deregisterInteractionHandler("keyup",this.deactivateHandler);try{for(var i=Ft(Pi),o=i.next();!o.done;o=i.next()){var n=o.value;this.adapter.deregisterDocumentInteractionHandler(n,this.deactivateHandler)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype.removeCssVars=function(){var e=this,i=t.strings;Object.keys(i).forEach((function(t){0===t.indexOf("VAR_")&&e.adapter.updateCssVariable(i[t],null)}))},t.prototype.activateImpl=function(e){var t=this;if(!this.adapter.isSurfaceDisabled()){var i=this.activationState;if(!i.isActivated){var o=this.previousActivationEvent;if(!(o&&void 0!==e&&o.type!==e.type))i.isActivated=!0,i.isProgrammatic=void 0===e,i.activationEvent=e,i.wasActivatedByPointer=!i.isProgrammatic&&(void 0!==e&&("mousedown"===e.type||"touchstart"===e.type||"pointerdown"===e.type)),void 0!==e&&wi.length>0&&wi.some((function(e){return t.adapter.containsEventTarget(e)}))?this.resetActivationState():(void 0!==e&&(wi.push(e.target),this.registerDeactivationHandlers(e)),i.wasElementMadeActive=this.checkElementMadeActive(e),i.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame((function(){wi=[],i.wasElementMadeActive||void 0===e||" "!==e.key&&32!==e.keyCode||(i.wasElementMadeActive=t.checkElementMadeActive(e),i.wasElementMadeActive&&t.animateActivation()),i.wasElementMadeActive||(t.activationState=t.defaultActivationState())})))}}},t.prototype.checkElementMadeActive=function(e){return void 0===e||"keydown"!==e.type||this.adapter.isSurfaceActive()},t.prototype.animateActivation=function(){var e=this,i=t.strings,o=i.VAR_FG_TRANSLATE_START,n=i.VAR_FG_TRANSLATE_END,s=t.cssClasses,r=s.FG_DEACTIVATION,a=s.FG_ACTIVATION,l=t.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var h="",m="";if(!this.adapter.isUnbounded()){var c=this.getFgTranslationCoordinates(),d=c.startPoint,p=c.endPoint;h=d.x+"px, "+d.y+"px",m=p.x+"px, "+p.y+"px"}this.adapter.updateCssVariable(o,h),this.adapter.updateCssVariable(n,m),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(r),this.adapter.computeBoundingRect(),this.adapter.addClass(a),this.activationTimer=setTimeout((function(){e.activationTimerCallback()}),l)},t.prototype.getFgTranslationCoordinates=function(){var e,t=this.activationState,i=t.activationEvent;return e=t.wasActivatedByPointer?function(e,t,i){if(!e)return{x:0,y:0};var o,n,s=t.x,r=t.y,a=s+i.left,l=r+i.top;if("touchstart"===e.type){var h=e;o=h.changedTouches[0].pageX-a,n=h.changedTouches[0].pageY-l}else{var m=e;o=m.pageX-a,n=m.pageY-l}return{x:o,y:n}}(i,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):{x:this.frame.width/2,y:this.frame.height/2},{startPoint:e={x:e.x-this.initialSize/2,y:e.y-this.initialSize/2},endPoint:{x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2}}},t.prototype.runDeactivationUXLogicIfReady=function(){var e=this,i=t.cssClasses.FG_DEACTIVATION,o=this.activationState,n=o.hasDeactivationUXRun,s=o.isActivated;(n||!s)&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(i),this.fgDeactivationRemovalTimer=setTimeout((function(){e.adapter.removeClass(i)}),pi.FG_DEACTIVATION_MS))},t.prototype.rmBoundedActivationClasses=function(){var e=t.cssClasses.FG_ACTIVATION;this.adapter.removeClass(e),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},t.prototype.resetActivationState=function(){var e=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout((function(){return e.previousActivationEvent=void 0}),t.numbers.TAP_DELAY_MS)},t.prototype.deactivateImpl=function(){var e=this,t=this.activationState;if(t.isActivated){var i=Ut({},t);t.isProgrammatic?(requestAnimationFrame((function(){e.animateDeactivation(i)})),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame((function(){e.activationState.hasDeactivationUXRun=!0,e.animateDeactivation(i),e.resetActivationState()})))}},t.prototype.animateDeactivation=function(e){var t=e.wasActivatedByPointer,i=e.wasElementMadeActive;(t||i)&&this.runDeactivationUXLogicIfReady()},t.prototype.layoutInternal=function(){var e=this;this.frame=this.adapter.computeBoundingRect();var i=Math.max(this.frame.height,this.frame.width);this.maxRadius=this.adapter.isUnbounded()?i:Math.sqrt(Math.pow(e.frame.width,2)+Math.pow(e.frame.height,2))+t.numbers.PADDING;var o=Math.floor(i*t.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&o%2!=0?this.initialSize=o-1:this.initialSize=o,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},t.prototype.updateLayoutCssVars=function(){var e=t.strings,i=e.VAR_FG_SIZE,o=e.VAR_LEFT,n=e.VAR_TOP,s=e.VAR_FG_SCALE;this.adapter.updateCssVariable(i,this.initialSize+"px"),this.adapter.updateCssVariable(s,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(o,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(n,this.unboundedCoords.top+"px"))},t}(mi),fi=ui;const Mi=dt(class extends pt{constructor(e){var t;if(super(e),e.type!==mt||"class"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){var i,o;if(void 0===this.it){this.it=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!(null===(i=this.nt)||void 0===i?void 0:i.has(e))&&this.it.add(e);return this.render(t)}const n=e.element.classList;this.it.forEach((e=>{e in t||(n.remove(e),this.it.delete(e))}));for(const e in t){const i=!!t[e];i===this.it.has(e)||(null===(o=this.nt)||void 0===o?void 0:o.has(e))||(i?(n.add(e),this.it.add(e)):(n.remove(e),this.it.delete(e)))}return V}}),Zi="important",Ki=" !"+Zi,yi=dt(class extends pt{constructor(e){var t;if(super(e),e.type!==mt||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ut){this.ut=new Set;for(const e in t)this.ut.add(e);return this.render(t)}this.ut.forEach((e=>{null==t[e]&&(this.ut.delete(e),e.includes("-")?i.removeProperty(e):i[e]="")}));for(const e in t){const o=t[e];if(null!=o){this.ut.add(e);const t="string"==typeof o&&o.endsWith(Ki);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?Zi:""):i[e]=o}}return V}});class gi extends hi{constructor(){super(...arguments),this.primary=!1,this.accent=!1,this.unbounded=!1,this.disabled=!1,this.activated=!1,this.selected=!1,this.internalUseStateLayerCustomProperties=!1,this.hovering=!1,this.bgFocused=!1,this.fgActivation=!1,this.fgDeactivation=!1,this.fgScale="",this.fgSize="",this.translateStart="",this.translateEnd="",this.leftPos="",this.topPos="",this.mdcFoundationClass=fi}get isActive(){return si(this.parentElement||this,":active")}createAdapter(){return{browserSupportsCssVars:()=>!0,isUnbounded:()=>this.unbounded,isSurfaceActive:()=>this.isActive,isSurfaceDisabled:()=>this.disabled,addClass:e=>{switch(e){case"mdc-ripple-upgraded--background-focused":this.bgFocused=!0;break;case"mdc-ripple-upgraded--foreground-activation":this.fgActivation=!0;break;case"mdc-ripple-upgraded--foreground-deactivation":this.fgDeactivation=!0}},removeClass:e=>{switch(e){case"mdc-ripple-upgraded--background-focused":this.bgFocused=!1;break;case"mdc-ripple-upgraded--foreground-activation":this.fgActivation=!1;break;case"mdc-ripple-upgraded--foreground-deactivation":this.fgDeactivation=!1}},containsEventTarget:()=>!0,registerInteractionHandler:()=>{},deregisterInteractionHandler:()=>{},registerDocumentInteractionHandler:()=>{},deregisterDocumentInteractionHandler:()=>{},registerResizeHandler:()=>{},deregisterResizeHandler:()=>{},updateCssVariable:(e,t)=>{switch(e){case"--mdc-ripple-fg-scale":this.fgScale=t;break;case"--mdc-ripple-fg-size":this.fgSize=t;break;case"--mdc-ripple-fg-translate-end":this.translateEnd=t;break;case"--mdc-ripple-fg-translate-start":this.translateStart=t;break;case"--mdc-ripple-left":this.leftPos=t;break;case"--mdc-ripple-top":this.topPos=t}},computeBoundingRect:()=>(this.parentElement||this).getBoundingClientRect(),getWindowPageOffset:()=>({x:window.pageXOffset,y:window.pageYOffset})}}startPress(e){this.waitForFoundation((()=>{this.mdcFoundation.activate(e)}))}endPress(){this.waitForFoundation((()=>{this.mdcFoundation.deactivate()}))}startFocus(){this.waitForFoundation((()=>{this.mdcFoundation.handleFocus()}))}endFocus(){this.waitForFoundation((()=>{this.mdcFoundation.handleBlur()}))}startHover(){this.hovering=!0}endHover(){this.hovering=!1}waitForFoundation(e){this.mdcFoundation?e():this.updateComplete.then(e)}update(e){e.has("disabled")&&this.disabled&&this.endHover(),super.update(e)}render(){const e=this.activated&&(this.primary||!this.accent),t=this.selected&&(this.primary||!this.accent),i={"mdc-ripple-surface--accent":this.accent,"mdc-ripple-surface--primary--activated":e,"mdc-ripple-surface--accent--activated":this.accent&&this.activated,"mdc-ripple-surface--primary--selected":t,"mdc-ripple-surface--accent--selected":this.accent&&this.selected,"mdc-ripple-surface--disabled":this.disabled,"mdc-ripple-surface--hover":this.hovering,"mdc-ripple-surface--primary":this.primary,"mdc-ripple-surface--selected":this.selected,"mdc-ripple-upgraded--background-focused":this.bgFocused,"mdc-ripple-upgraded--foreground-activation":this.fgActivation,"mdc-ripple-upgraded--foreground-deactivation":this.fgDeactivation,"mdc-ripple-upgraded--unbounded":this.unbounded,"mdc-ripple-surface--internal-use-state-layer-custom-properties":this.internalUseStateLayerCustomProperties};return C`
- `}}Rt([ei(".mdc-ripple-surface")],gi.prototype,"mdcRoot",void 0),Rt([Bt({type:Boolean})],gi.prototype,"primary",void 0),Rt([Bt({type:Boolean})],gi.prototype,"accent",void 0),Rt([Bt({type:Boolean})],gi.prototype,"unbounded",void 0),Rt([Bt({type:Boolean})],gi.prototype,"disabled",void 0),Rt([Bt({type:Boolean})],gi.prototype,"activated",void 0),Rt([Bt({type:Boolean})],gi.prototype,"selected",void 0),Rt([Bt({type:Boolean})],gi.prototype,"internalUseStateLayerCustomProperties",void 0),Rt([Qt()],gi.prototype,"hovering",void 0),Rt([Qt()],gi.prototype,"bgFocused",void 0),Rt([Qt()],gi.prototype,"fgActivation",void 0),Rt([Qt()],gi.prototype,"fgDeactivation",void 0),Rt([Qt()],gi.prototype,"fgScale",void 0),Rt([Qt()],gi.prototype,"fgSize",void 0),Rt([Qt()],gi.prototype,"translateStart",void 0),Rt([Qt()],gi.prototype,"translateEnd",void 0),Rt([Qt()],gi.prototype,"leftPos",void 0),Rt([Qt()],gi.prototype,"topPos",void 0);const Di=s`.mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}.mdc-ripple-surface--internal-use-state-layer-custom-properties::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties::after{background-color:#000;background-color:var(--mdc-ripple-hover-state-layer-color, #000)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:hover::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-state-layer-opacity, 0.04)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}`;let xi=class extends gi{};function bi(e,t,i){if(void 0!==t)return function(e,t,i){const o=e.constructor;if(!i){const e=`__${t}`;if(!(i=o.getPropertyDescriptor(t,e)))throw new Error("@ariaProperty must be used after a @property decorator")}const n=i;let s="";if(!n.set)throw new Error(`@ariaProperty requires a setter for ${t}`);if(e.dispatchWizEvent)return i;const r={configurable:!0,enumerable:!0,set(e){if(""===s){const e=o.getPropertyOptions(t);s="string"==typeof e.attribute?e.attribute:t}this.hasAttribute(s)&&this.removeAttribute(s),n.set.call(this,e)}};return n.get&&(r.get=function(){return n.get.call(this)}),r}(e,t,i);throw new Error("@ariaProperty only supports TypeScript Decorators")}xi.styles=[Di],xi=Rt([Jt("mwc-ripple")],xi);class vi{constructor(e){this.startPress=t=>{e().then((e=>{e&&e.startPress(t)}))},this.endPress=()=>{e().then((e=>{e&&e.endPress()}))},this.startFocus=()=>{e().then((e=>{e&&e.startFocus()}))},this.endFocus=()=>{e().then((e=>{e&&e.endFocus()}))},this.startHover=()=>{e().then((e=>{e&&e.startHover()}))},this.endHover=()=>{e().then((e=>{e&&e.endHover()}))}}}const Yi=e=>null!=e?e:W;class Si extends re{constructor(){super(...arguments),this.raised=!1,this.unelevated=!1,this.outlined=!1,this.dense=!1,this.disabled=!1,this.trailingIcon=!1,this.fullwidth=!1,this.icon="",this.label="",this.expandContent=!1,this.shouldRenderRipple=!1,this.rippleHandlers=new vi((()=>(this.shouldRenderRipple=!0,this.ripple)))}renderOverlay(){return C``}renderRipple(){const e=this.raised||this.unelevated;return this.shouldRenderRipple?C` `:""}focus(){const e=this.buttonElement;e&&(this.rippleHandlers.startFocus(),e.focus())}blur(){const e=this.buttonElement;e&&(this.rippleHandlers.endFocus(),e.blur())}getRenderClasses(){return{"mdc-button--raised":this.raised,"mdc-button--unelevated":this.unelevated,"mdc-button--outlined":this.outlined,"mdc-button--dense":this.dense}}render(){return C`
- `}renderIcon(){return C`
-
- ${this.icon}
- `}handleRippleActivate(e){const t=()=>{window.removeEventListener("mouseup",t),this.handleRippleDeactivate()};window.addEventListener("mouseup",t),this.rippleHandlers.startPress(e)}handleRippleDeactivate(){this.rippleHandlers.endPress()}handleRippleMouseEnter(){this.rippleHandlers.startHover()}handleRippleMouseLeave(){this.rippleHandlers.endHover()}handleRippleFocus(){this.rippleHandlers.startFocus()}handleRippleBlur(){this.rippleHandlers.endFocus()}}Si.shadowRootOptions={mode:"open",delegatesFocus:!0},Rt([bi,Bt({type:String,attribute:"aria-haspopup"})],Si.prototype,"ariaHasPopup",void 0),Rt([Bt({type:Boolean,reflect:!0})],Si.prototype,"raised",void 0),Rt([Bt({type:Boolean,reflect:!0})],Si.prototype,"unelevated",void 0),Rt([Bt({type:Boolean,reflect:!0})],Si.prototype,"outlined",void 0),Rt([Bt({type:Boolean})],Si.prototype,"dense",void 0),Rt([Bt({type:Boolean,reflect:!0})],Si.prototype,"disabled",void 0),Rt([Bt({type:Boolean,attribute:"trailingicon"})],Si.prototype,"trailingIcon",void 0),Rt([Bt({type:Boolean,reflect:!0})],Si.prototype,"fullwidth",void 0),Rt([Bt({type:String})],Si.prototype,"icon",void 0),Rt([Bt({type:String})],Si.prototype,"label",void 0),Rt([Bt({type:Boolean})],Si.prototype,"expandContent",void 0),Rt([ei("#button")],Si.prototype,"buttonElement",void 0),Rt([ti("mwc-ripple")],Si.prototype,"ripple",void 0),Rt([Qt()],Si.prototype,"shouldRenderRipple",void 0),Rt([qt({passive:!0})],Si.prototype,"handleRippleActivate",null);const Ti=s`.mdc-button{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase)}.mdc-touch-target-wrapper{display:inline}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;user-select:none;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:transparent}.mdc-button .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top}[dir=rtl] .mdc-button .mdc-button__icon,.mdc-button .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.mdc-button .mdc-button__label{position:relative}.mdc-button .mdc-button__focus-ring{display:none}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{pointer-events:none;border:2px solid transparent;border-radius:6px;box-sizing:content-box;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc( 100% + 4px );width:calc( 100% + 4px );display:block}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{border-color:CanvasText}}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{content:"";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc(100% + 4px);width:calc(100% + 4px)}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{border-color:CanvasText}}.mdc-button .mdc-button__touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}.mdc-button__label+.mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .mdc-button__label+.mdc-button__icon,.mdc-button__label+.mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}svg.mdc-button__icon{fill:currentColor}.mdc-button--touch{margin-top:6px;margin-bottom:6px}.mdc-button{padding:0 8px 0 8px}.mdc-button--unelevated{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--unelevated.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--unelevated.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--raised{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--raised.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--raised.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--outlined{border-style:solid;transition:border 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--outlined .mdc-button__ripple{border-style:solid;border-color:transparent}.mdc-button{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised,.mdc-button--unelevated{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){background-color:#6200ee;background-color:var(--mdc-theme-primary, #6200ee)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{background-color:rgba(0, 0, 0, 0.12)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){color:#fff;color:var(--mdc-theme-on-primary, #fff)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--raised .mdc-button__icon,.mdc-button--unelevated .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--raised .mdc-button__ripple,.mdc-button--unelevated .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px);padding:0 15px 0 15px;border-width:1px}.mdc-button--outlined:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button--outlined:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--outlined .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--outlined .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined:disabled{border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined.mdc-button--icon-trailing{padding:0 11px 0 15px}.mdc-button--outlined.mdc-button--icon-leading{padding:0 15px 0 11px}.mdc-button--outlined .mdc-button__ripple{top:-1px;left:-1px;bottom:-1px;right:-1px;border-width:1px}.mdc-button--outlined .mdc-button__touch{left:calc(-1 * 1px);width:calc(100% + 2 * 1px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12);transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--raised:hover,.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2),0px 4px 5px 0px rgba(0, 0, 0, 0.14),0px 1px 10px 0px rgba(0,0,0,.12)}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12)}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2),0px 0px 0px 0px rgba(0, 0, 0, 0.14),0px 0px 0px 0px rgba(0,0,0,.12)}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:transparent;vertical-align:top}:host([fullwidth]){width:100%}:host([raised]),:host([unelevated]){--mdc-ripple-color:#fff;--mdc-ripple-focus-opacity:0.24;--mdc-ripple-hover-opacity:0.08;--mdc-ripple-press-opacity:0.24}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon,.leading-icon ::slotted(*),.leading-icon .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top;font-size:1.125rem;height:1.125rem;width:1.125rem}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,[dir=rtl] .leading-icon ::slotted(*),[dir=rtl] .leading-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl],.leading-icon ::slotted(*[dir=rtl]),.leading-icon .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}.slot-container{display:inline-flex;align-items:center;justify-content:center}.slot-container.flex{flex:auto}.mdc-button{flex:auto;overflow:hidden;padding-left:8px;padding-left:var(--mdc-button-horizontal-padding, 8px);padding-right:8px;padding-right:var(--mdc-button-horizontal-padding, 8px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-focus, var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)))}.mdc-button--raised:hover{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-active, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12))}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-disabled, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised,.mdc-button--unelevated{padding-left:16px;padding-left:var(--mdc-button-horizontal-padding, 16px);padding-right:16px;padding-right:var(--mdc-button-horizontal-padding, 16px)}.mdc-button--outlined{border-width:1px;border-width:var(--mdc-button-outline-width, 1px);padding-left:calc(16px - 1px);padding-left:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px));padding-right:calc(16px - 1px);padding-right:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px))}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-outline-color, rgba(0, 0, 0, 0.12))}.mdc-button--outlined .ripple{top:calc(-1 * 1px);top:calc(-1 * var(--mdc-button-outline-width, 1px));left:calc(-1 * 1px);left:calc(-1 * var(--mdc-button-outline-width, 1px));right:initial;right:initial;border-width:1px;border-width:var(--mdc-button-outline-width, 1px);border-style:solid;border-color:transparent}[dir=rtl] .mdc-button--outlined .ripple,.mdc-button--outlined .ripple[dir=rtl]{left:initial;left:initial;right:calc(-1 * 1px);right:calc(-1 * var(--mdc-button-outline-width, 1px))}.mdc-button--dense{height:28px;margin-top:0;margin-bottom:0}.mdc-button--dense .mdc-button__touch{height:100%}:host([disabled]){pointer-events:none}:host([disabled]) .mdc-button{color:rgba(0, 0, 0, 0.38);color:var(--mdc-button-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-button--raised,:host([disabled]) .mdc-button--unelevated{background-color:rgba(0, 0, 0, 0.12);background-color:var(--mdc-button-disabled-fill-color, rgba(0, 0, 0, 0.12))}:host([disabled]) .mdc-button--outlined{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-disabled-outline-color, rgba(0, 0, 0, 0.12))}`;let Xi=class extends Si{};Xi.styles=[Ti],Xi=Rt([Jt("mwc-button")],Xi),(()=>{var e,t,i;const o=Symbol(),n=Symbol(),s=Symbol(),r=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),m=Symbol(),c=Symbol(),d=Symbol(),p=Symbol(),j=Symbol(),P=Symbol();class w{constructor(){this[e]=[],this[t]=[],this[i]=new Set}destructor(){this[c](this[s]);const e=this;e[o]=null,e[s]=null,e[n]=null}get top(){const e=this[o];return e[e.length-1]||null}push(e){e&&e!==this.top&&(this.remove(e),this[l](e),this[o].push(e))}remove(e){const t=this[o].indexOf(e);return-1!==t&&(this[o].splice(t,1),t===this[o].length&&this[l](this.top),!0)}pop(){const e=this.top;return e&&this.remove(e),e}has(e){return-1!==this[o].indexOf(e)}[(e=o,t=s,i=n,l)](e){const t=this[n],i=this[s];if(!e)return this[c](i),t.clear(),void(this[s]=[]);const o=this[d](e);if(o[o.length-1].parentNode!==document.body)throw Error("Non-connected element cannot be a blocking element");this[s]=o;const r=this[p](e);if(!i.length)return void this[m](o,r,t);let a=i.length-1,l=o.length-1;for(;a>0&&l>0&&i[a]===o[l];)a--,l--;i[a]!==o[l]&&this[h](i[a],o[l]),a>0&&this[c](i.slice(0,a)),l>0&&this[m](o.slice(0,l),r,null)}[h](e,t){const i=e[r];this[j](e)&&!e.inert&&(e.inert=!0,i.add(e)),i.has(t)&&(t.inert=!1,i.delete(t)),t[a]=e[a],t[r]=i,e[a]=void 0,e[r]=void 0}[c](e){for(const t of e){t[a].disconnect(),t[a]=void 0;const e=t[r];for(const t of e)t.inert=!1;t[r]=void 0}}[m](e,t,i){for(const o of e){const e=o.parentNode,n=e.children,s=new Set;for(let e=0;e(t,i)=>{if(t.constructor._observers){if(!t.constructor.hasOwnProperty("_observers")){const e=t.constructor._observers;t.constructor._observers=new Map,e.forEach(((e,i)=>t.constructor._observers.set(i,e)))}}else{t.constructor._observers=new Map;const e=t.updated;t.updated=function(t){e.call(this,t),t.forEach(((e,t)=>{const i=this.constructor._observers.get(t);void 0!==i&&i.call(this,this[t],e)}))}}t.constructor._observers.set(i,e)},_i=document.$blockingElements;class Ii extends hi{constructor(){super(...arguments),this.hideActions=!1,this.stacked=!1,this.heading="",this.scrimClickAction="close",this.escapeKeyAction="close",this.open=!1,this.defaultAction="close",this.actionAttribute="dialogAction",this.initialFocusAttribute="dialogInitialFocus",this.initialSupressDefaultPressSelector="",this.mdcFoundationClass=Ni,this.boundHandleClick=null,this.boundHandleKeydown=null,this.boundHandleDocumentKeydown=null}set suppressDefaultPressSelector(e){this.mdcFoundation?this.mdcFoundation.setSuppressDefaultPressSelector(e):this.initialSupressDefaultPressSelector=e}get suppressDefaultPressSelector(){return this.mdcFoundation?this.mdcFoundation.getSuppressDefaultPressSelector():this.initialSupressDefaultPressSelector}get primaryButton(){let e=this.primarySlot.assignedNodes();e=e.filter((e=>e instanceof HTMLElement));const t=e[0];return t||null}emitNotification(e,t){const i=new CustomEvent(e,{detail:t?{action:t}:{}});this.dispatchEvent(i)}getInitialFocusEl(){const e=`[${this.initialFocusAttribute}]`,t=this.querySelector(e);if(t)return t;const i=this.primarySlot.assignedNodes({flatten:!0}),o=this.searchNodeTreesForAttribute(i,this.initialFocusAttribute);if(o)return o;const n=this.secondarySlot.assignedNodes({flatten:!0}),s=this.searchNodeTreesForAttribute(n,this.initialFocusAttribute);if(s)return s;const r=this.contentSlot.assignedNodes({flatten:!0});return this.searchNodeTreesForAttribute(r,this.initialFocusAttribute)}searchNodeTreesForAttribute(e,t){for(const i of e)if(i instanceof HTMLElement){if(i.hasAttribute(t))return i;{const e=i.querySelector(`[${t}]`);if(e)return e}}return null}createAdapter(){return Object.assign(Object.assign({},ri(this.mdcRoot)),{addBodyClass:()=>document.body.style.overflow="hidden",removeBodyClass:()=>document.body.style.overflow="",areButtonsStacked:()=>this.stacked,clickDefaultButton:()=>{const e=this.primaryButton;e&&e.click()},eventTargetMatches:(e,t)=>!!e&&si(e,t),getActionFromEvent:e=>{if(!e.target)return"";const t=function(e,t){if(e.closest)return e.closest(t);for(var i=e;i;){if(si(i,t))return i;i=i.parentElement}return null}(e.target,`[${this.actionAttribute}]`);return t&&t.getAttribute(this.actionAttribute)},getInitialFocusEl:()=>this.getInitialFocusEl(),isContentScrollable:()=>{const e=this.contentElement;return!!e&&e.scrollHeight>e.offsetHeight},notifyClosed:e=>this.emitNotification("closed",e),notifyClosing:e=>{this.closingDueToDisconnect||(this.open=!1),this.emitNotification("closing",e)},notifyOpened:()=>this.emitNotification("opened"),notifyOpening:()=>{this.open=!0,this.emitNotification("opening")},reverseButtons:()=>{},releaseFocus:()=>{_i.remove(this)},trapFocus:e=>{this.isConnected&&(_i.push(this),e&&e.focus())},registerContentEventHandler:(e,t)=>{this.contentElement.addEventListener(e,t)},deregisterContentEventHandler:(e,t)=>{this.contentElement.removeEventListener(e,t)},isScrollableContentAtTop:()=>{const e=this.contentElement;return!!e&&0===e.scrollTop},isScrollableContentAtBottom:()=>{const e=this.contentElement;return!!e&&Math.ceil(e.scrollHeight-e.scrollTop)===e.clientHeight},registerWindowEventHandler:(e,t)=>{window.addEventListener(e,t,Vi())},deregisterWindowEventHandler:(e,t)=>{window.removeEventListener(e,t,Vi())}})}render(){const e={[Gi.STACKED]:this.stacked};let t=C``;this.heading&&(t=this.renderHeading());const i={"mdc-dialog__actions":!this.hideActions};return C`
- {":root"===e.selector&&(e.selector="html"),this.transformRule(e)})),e.textContent=uo(t),t}transformRules(e,t){this._currentElement=t,Mo(e,(e=>{this.transformRule(e)})),this._currentElement=null}transformRule(e){e.cssText=this.transformCssText(e.parsedCssText,e),":root"===e.selector&&(e.selector=":host > *")}transformCssText(e,t){return e=e.replace(ho,((e,i,o,n)=>this._produceCssProperties(e,i,o,n,t))),this._consumeCssProperties(e,t)}_getInitialValueForProperty(e){return this._measureElement||(this._measureElement=document.createElement("meta"),this._measureElement.setAttribute("apply-shim-measure",""),this._measureElement.style.all="initial",document.head.appendChild(this._measureElement)),window.getComputedStyle(this._measureElement).getPropertyValue(e)}_fallbacksFromPreviousRules(e){let t=e;for(;t.parent;)t=t.parent;const i={};let o=!1;return Mo(t,(t=>{o=o||t===e,o||t.selector===e.selector&&Object.assign(i,this._cssTextToMap(t.parsedCssText))})),i}_consumeCssProperties(e,t){let i=null;for(;i=mo.exec(e);){let o=i[0],n=i[1],s=i.index,r=s+o.indexOf("@apply"),a=s+o.length,l=e.slice(0,r),h=e.slice(a),m=t?this._fallbacksFromPreviousRules(t):{};Object.assign(m,this._cssTextToMap(l));let c=this._atApplyToCssProperties(n,m);e=`${l}${c}${h}`,mo.lastIndex=s+c.length}return e}_atApplyToCssProperties(e,t){e=e.replace(bo,"");let i=[],o=this._map.get(e);if(o||(this._map.set(e,{}),o=this._map.get(e)),o){let n,s,r;this._currentElement&&(o.dependants[this._currentElement]=!0);const a=o.properties;for(n in a)r=t&&t[n],s=[n,": var(",e,So,n],r&&s.push(",",r.replace(Yo,"")),s.push(")"),Yo.test(a[n])&&s.push(" !important"),i.push(s.join(""))}return i.join("; ")}_replaceInitialOrInherit(e,t){let i=vo.exec(t);return i&&(t=i[1]?this._getInitialValueForProperty(e):"apply-shim-inherit"),t}_cssTextToMap(e,t=!1){let i,o,n=e.split(";"),s={};for(let e,r,a=0;a1&&(i=r[0].trim(),o=r.slice(1).join(":"),t&&(o=this._replaceInitialOrInherit(i,o)),s[i]=o));return s}_invalidateMixinEntry(e){if(Xo)for(let t in e.dependants)t!==this._currentElement&&Xo(t)}_produceCssProperties(e,t,i,o,n){if(i&&Zo(i,((e,t)=>{t&&this._map.get(t)&&(o=`@apply ${t};`)})),!o)return e;let s=this._consumeCssProperties(""+o,n),r=e.slice(0,e.indexOf("--")),a=this._cssTextToMap(s,!0),l=a,h=this._map.get(t),m=h&&h.properties;m?l=Object.assign(Object.create(m),a):this._map.set(t,l);let c,d,p=[],j=!1;for(c in l)d=a[c],void 0===d&&(d="initial"),m&&!(c in m)&&(j=!0),p.push(`${t}${So}${c}: ${d}`);return j&&this._invalidateMixinEntry(h),h&&(h.properties=l),i&&(r=`${e};${r}`),`${r}${p.join("; ")};`}}Eo.prototype.detectMixin=Eo.prototype.detectMixin,Eo.prototype.transformStyle=Eo.prototype.transformStyle,Eo.prototype.transformCustomStyle=Eo.prototype.transformCustomStyle,Eo.prototype.transformRules=Eo.prototype.transformRules,Eo.prototype.transformRule=Eo.prototype.transformRule,Eo.prototype.transformTemplate=Eo.prototype.transformTemplate,Eo.prototype._separator=So,Object.defineProperty(Eo.prototype,"invalidCallback",{get:()=>Xo,set(e){Xo=e}});const ko={},zo="_applyShimCurrentVersion",Go="_applyShimNextVersion",Ao="_applyShimValidatingVersion",Oo=Promise.resolve();function Co(e){let t=ko[e];t&&function(e){e[zo]=e[zo]||0,e[Ao]=e[Ao]||0,e[Go]=(e[Go]||0)+1}(t)}function No(e){return e[zo]===e[Go]}let Vo,Wo=null,_o=window.HTMLImports&&window.HTMLImports.whenReady||null;function Io(e){requestAnimationFrame((function(){_o?_o(e):(Wo||(Wo=new Promise((e=>{Vo=e})),"complete"===document.readyState?Vo():document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&Vo()}))),Wo.then((function(){e&&e()})))}))}const Ho="__seenByShadyCSS",Uo="__shadyCSSCachedStyle";let Ro=null,Fo=null,Jo=class{constructor(){this.customStyles=[],this.enqueued=!1,Io((()=>{window.ShadyCSS.flushCustomStyles&&window.ShadyCSS.flushCustomStyles()}))}enqueueDocumentValidation(){!this.enqueued&&Fo&&(this.enqueued=!0,Io(Fo))}addCustomStyle(e){e[Ho]||(e[Ho]=!0,this.customStyles.push(e),this.enqueueDocumentValidation())}getStyleForCustomStyle(e){if(e[Uo])return e[Uo];let t;return t=e.getStyle?e.getStyle():e,t}processStyles(){const e=this.customStyles;for(let t=0;tRo,set(e){Ro=e}},validateCallback:{get:()=>Fo,set(e){let t=!1;Fo||(t=!0),Fo=e,t&&this.enqueueDocumentValidation()}}});const Lo=new Eo;class Bo{constructor(){this.customStyleInterface=null,Lo.invalidCallback=Co}ensure(){this.customStyleInterface||window.ShadyCSS.CustomStyleInterface&&(this.customStyleInterface=window.ShadyCSS.CustomStyleInterface,this.customStyleInterface.transformCallback=e=>{Lo.transformCustomStyle(e)},this.customStyleInterface.validateCallback=()=>{requestAnimationFrame((()=>{this.customStyleInterface.enqueued&&this.flushCustomStyles()}))})}prepareTemplate(e,t){if(this.ensure(),go(e))return;ko[t]=e;let i=Lo.transformTemplate(e,t);e._styleAst=i}flushCustomStyles(){if(this.ensure(),!this.customStyleInterface)return;let e=this.customStyleInterface.processStyles();if(this.customStyleInterface.enqueued){for(let t=0;t-1?i=t:(o=t,i=e.getAttribute&&e.getAttribute("is")||""):(i=e.is,o=e.extends),{is:i,typeExtension:o}}(e),i=ko[t];if((!i||!go(i))&&i&&!No(i)){(function(e){return!No(e)&&e[Ao]===e[Go]})(i)||(this.prepareTemplate(i,t),function(e){e[Ao]=e[Go],e._validating||(e._validating=!0,Oo.then((function(){e[zo]=e[Go],e._validating=!1})))}(i));let o=e.shadowRoot;if(o){let e=o.querySelector("style");e&&(e.__cssRules=i._styleAst,e.textContent=uo(i._styleAst))}}}styleDocument(e){this.ensure(),this.styleSubtree(document.body,e)}}if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){const e=new Bo;let t=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate(t,i,o){e.flushCustomStyles(),e.prepareTemplate(t,i)},prepareTemplateStyles(e,t,i){window.ShadyCSS.prepareTemplate(e,t,i)},prepareTemplateDom(e,t){},styleSubtree(t,i){e.flushCustomStyles(),e.styleSubtree(t,i)},styleElement(t){e.flushCustomStyles(),e.styleElement(t)},styleDocument(t){e.flushCustomStyles(),e.styleDocument(t)},getComputedStyleValue:(e,t)=>xo(e,t),flushCustomStyles(){e.flushCustomStyles()},nativeCss:Qi,nativeShadow:Ri,cssBuild:Ji,disableRuntime:Bi},t&&(window.ShadyCSS.CustomStyleInterface=t)}window.ShadyCSS.ApplyShim=Lo,window.JSCompiler_renameProperty=function(e,t){return e};let Qo,$o,qo=/(url\()([^)]*)(\))/g,en=/(^\/[^\/])|(^#)|(^[\w-\d]*:)/;function tn(e,t){if(e&&en.test(e))return e;if("//"===e)return e;if(void 0===Qo){Qo=!1;try{const e=new URL("b","http://a");e.pathname="c%20d",Qo="http://a/c%20d"===e.href}catch(e){}}if(t||(t=document.baseURI||window.location.href),Qo)try{return new URL(e,t).href}catch(t){return e}return $o||($o=document.implementation.createHTMLDocument("temp"),$o.base=$o.createElement("base"),$o.head.appendChild($o.base),$o.anchor=$o.createElement("a"),$o.body.appendChild($o.anchor)),$o.base.href=t,$o.anchor.href=e,$o.anchor.href||e}function on(e,t){return e.replace(qo,(function(e,i,o,n){return i+"'"+tn(o.replace(/["']/g,""),t)+"'"+n}))}function nn(e){return e.substring(0,e.lastIndexOf("/")+1)}const sn=!window.ShadyDOM||!window.ShadyDOM.inUse;Boolean(!window.ShadyCSS||window.ShadyCSS.nativeCss);const rn=sn&&"adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype&&(()=>{try{const e=new CSSStyleSheet;e.replaceSync("");const t=document.createElement("div");return t.attachShadow({mode:"open"}),t.shadowRoot.adoptedStyleSheets=[e],t.shadowRoot.adoptedStyleSheets[0]===e}catch(e){return!1}})();let an=window.Polymer&&window.Polymer.rootPath||nn(document.baseURI||window.location.href),ln=window.Polymer&&window.Polymer.sanitizeDOMValue||void 0,hn=window.Polymer&&window.Polymer.setPassiveTouchGestures||!1,mn=window.Polymer&&window.Polymer.strictTemplatePolicy||!1,cn=window.Polymer&&window.Polymer.allowTemplateFromDomModule||!1,dn=window.Polymer&&window.Polymer.legacyOptimizations||!1,pn=window.Polymer&&window.Polymer.legacyWarnings||!1,jn=window.Polymer&&window.Polymer.syncInitialRender||!1,Pn=window.Polymer&&window.Polymer.legacyUndefined||!1,wn=window.Polymer&&window.Polymer.orderedComputed||!1,un=!0;let fn=window.Polymer&&window.Polymer.removeNestedTemplates||!1,Mn=window.Polymer&&window.Polymer.fastDomIf||!1,Zn=window.Polymer&&window.Polymer.suppressTemplateNotifications||!1,Kn=window.Polymer&&window.Polymer.legacyNoObservedAttributes||!1,yn=window.Polymer&&window.Polymer.useAdoptedStyleSheetsWithBuiltCSS||!1,gn=0;const Dn=function(e){let t=e.__mixinApplications;t||(t=new WeakMap,e.__mixinApplications=t);let i=gn++;return function(o){let n=o.__mixinSet;if(n&&n[i])return o;let s=t,r=s.get(o);if(!r){r=e(o),s.set(o,r);let t=Object.create(r.__mixinSet||n||null);t[i]=!0,r.__mixinSet=t}return r}};let xn={},bn={};function vn(e,t){xn[e]=bn[e.toLowerCase()]=t}function Yn(e){return xn[e]||bn[e.toLowerCase()]}class Sn extends HTMLElement{static get observedAttributes(){return["id"]}static import(e,t){if(e){let i=Yn(e);return i&&t?i.querySelector(t):i}return null}attributeChangedCallback(e,t,i,o){t!==i&&this.register()}get assetpath(){if(!this.__assetpath){const e=window.HTMLImports&&HTMLImports.importForElement?HTMLImports.importForElement(this)||document:this.ownerDocument,t=tn(this.getAttribute("assetpath")||"",e.baseURI);this.__assetpath=nn(t)}return this.__assetpath}register(e){if(e=e||this.id){if(mn&&void 0!==Yn(e))throw vn(e,null),new Error(`strictTemplatePolicy: dom-module ${e} re-registered`);this.id=e,vn(e,this),(t=this).querySelector("style")&&console.warn("dom-module %s has style outside template",t.id)}var t}}Sn.prototype.modules=xn,customElements.define("dom-module",Sn);const Tn="link[rel=import][type~=css]",Xn="include",En="shady-unscoped";function kn(e){return Sn.import(e)}function zn(e){const t=on((e.body?e.body:e).textContent,e.baseURI),i=document.createElement("style");return i.textContent=t,i}function Gn(e){const t=e.trim().split(/\s+/),i=[];for(let e=0;eShadyDOM.patch(e):e=>e;function Wn(e){return e.indexOf(".")>=0}function _n(e){let t=e.indexOf(".");return-1===t?e:e.slice(0,t)}function In(e,t){return 0===e.indexOf(t+".")}function Hn(e,t){return 0===t.indexOf(e+".")}function Un(e,t,i){return t+i.slice(e.length)}function Rn(e){if(Array.isArray(e)){let t=[];for(let i=0;i1){for(let e=0;ee[1].toUpperCase())))}function es(e){return Bn[e]||(Bn[e]=e.replace($n,"-$1").toLowerCase())}let ts=0,is=0,ns=[],ss=0,rs=!1,as=document.createTextNode("");new window.MutationObserver((function(){rs=!1;const e=ns.length;for(let t=0;t{throw e}))}}ns.splice(0,e),is+=e})).observe(as,{characterData:!0});const ls={after:e=>({run:t=>window.setTimeout(t,e),cancel(e){window.clearTimeout(e)}}),run:(e,t)=>window.setTimeout(e,t),cancel(e){window.clearTimeout(e)}},hs={run:e=>(rs||(rs=!0,as.textContent=ss++),ns.push(e),ts++),cancel(e){const t=e-is;if(t>=0){if(!ns[t])throw new Error("invalid async handle: "+e);ns[t]=null}}},ms=hs,cs=Dn((e=>class extends e{static createProperties(e){const t=this.prototype;for(let i in e)i in t||t._createPropertyAccessor(i)}static attributeNameForProperty(e){return e.toLowerCase()}static typeForProperty(e){}_createPropertyAccessor(e,t){this._addPropertyToAttributeMap(e),this.hasOwnProperty(JSCompiler_renameProperty("__dataHasAccessor",this))||(this.__dataHasAccessor=Object.assign({},this.__dataHasAccessor)),this.__dataHasAccessor[e]||(this.__dataHasAccessor[e]=!0,this._definePropertyAccessor(e,t))}_addPropertyToAttributeMap(e){this.hasOwnProperty(JSCompiler_renameProperty("__dataAttributes",this))||(this.__dataAttributes=Object.assign({},this.__dataAttributes));let t=this.__dataAttributes[e];return t||(t=this.constructor.attributeNameForProperty(e),this.__dataAttributes[t]=e),t}_definePropertyAccessor(e,t){Object.defineProperty(this,e,{get(){return this.__data[e]},set:t?function(){}:function(t){this._setPendingProperty(e,t,!0)&&this._invalidateProperties()}})}constructor(){super(),this.__dataEnabled=!1,this.__dataReady=!1,this.__dataInvalid=!1,this.__data={},this.__dataPending=null,this.__dataOld=null,this.__dataInstanceProps=null,this.__dataCounter=0,this.__serializing=!1,this._initializeProperties()}ready(){this.__dataReady=!0,this._flushProperties()}_initializeProperties(){for(let e in this.__dataHasAccessor)this.hasOwnProperty(e)&&(this.__dataInstanceProps=this.__dataInstanceProps||{},this.__dataInstanceProps[e]=this[e],delete this[e])}_initializeInstanceProperties(e){Object.assign(this,e)}_setProperty(e,t){this._setPendingProperty(e,t)&&this._invalidateProperties()}_getProperty(e){return this.__data[e]}_setPendingProperty(e,t,i){let o=this.__data[e],n=this._shouldPropertyChange(e,t,o);return n&&(this.__dataPending||(this.__dataPending={},this.__dataOld={}),this.__dataOld&&!(e in this.__dataOld)&&(this.__dataOld[e]=o),this.__data[e]=t,this.__dataPending[e]=t),n}_isPropertyPending(e){return!(!this.__dataPending||!this.__dataPending.hasOwnProperty(e))}_invalidateProperties(){!this.__dataInvalid&&this.__dataReady&&(this.__dataInvalid=!0,ms.run((()=>{this.__dataInvalid&&(this.__dataInvalid=!1,this._flushProperties())})))}_enableProperties(){this.__dataEnabled||(this.__dataEnabled=!0,this.__dataInstanceProps&&(this._initializeInstanceProperties(this.__dataInstanceProps),this.__dataInstanceProps=null),this.ready())}_flushProperties(){this.__dataCounter++;const e=this.__data,t=this.__dataPending,i=this.__dataOld;this._shouldPropertiesChange(e,t,i)&&(this.__dataPending=null,this.__dataOld=null,this._propertiesChanged(e,t,i)),this.__dataCounter--}_shouldPropertiesChange(e,t,i){return Boolean(t)}_propertiesChanged(e,t,i){}_shouldPropertyChange(e,t,i){return i!==t&&(i==i||t==t)}attributeChangedCallback(e,t,i,o){t!==i&&this._attributeToProperty(e,i),super.attributeChangedCallback&&super.attributeChangedCallback(e,t,i,o)}_attributeToProperty(e,t,i){if(!this.__serializing){const o=this.__dataAttributes,n=o&&o[e]||e;this[n]=this._deserializeValue(t,i||this.constructor.typeForProperty(n))}}_propertyToAttribute(e,t,i){this.__serializing=!0,i=arguments.length<3?this[e]:i,this._valueToNodeAttribute(this,i,t||this.constructor.attributeNameForProperty(e)),this.__serializing=!1}_valueToNodeAttribute(e,t,i){const o=this._serializeValue(t);"class"!==i&&"name"!==i&&"slot"!==i||(e=Vn(e)),void 0===o?e.removeAttribute(i):e.setAttribute(i,""===o&&window.trustedTypes?window.trustedTypes.emptyScript:o)}_serializeValue(e){return"boolean"==typeof e?e?"":void 0:null!=e?e.toString():void 0}_deserializeValue(e,t){switch(t){case Boolean:return null!==e;case Number:return Number(e);default:return e}}})),ds={};let ps=HTMLElement.prototype;for(;ps;){let e=Object.getOwnPropertyNames(ps);for(let t=0;ttrustedTypes.isHTML(e)||trustedTypes.isScript(e)||trustedTypes.isScriptURL(e):()=>!1;const Ps=Dn((e=>{const t=cs(e);return class extends t{static createPropertiesForAttributes(){let e=this.observedAttributes;for(let t=0;t{const e=window.trustedTypes&&window.trustedTypes.createPolicy("polymer-template-event-attribute-policy",{createScript:e=>e});return(t,i,o)=>{const n=i.getAttribute(o);e&&o.startsWith("on-")?t.setAttribute(o,e.createScript(n,o)):t.setAttribute(o,n)}})();function Ks(e){let t=e.getAttribute("is");if(t&&ws[t]){let i=e;for(i.removeAttribute("is"),e=i.ownerDocument.createElement(t),i.parentNode.replaceChild(e,i),e.appendChild(i);i.attributes.length;){const{name:t}=i.attributes[0];Zs(e,i,t),i.removeAttribute(t)}}return e}function ys(e,t){let i=t.parentInfo&&ys(e,t.parentInfo);if(!i)return e;for(let e=i.firstChild,o=0;e;e=e.nextSibling)if(t.parentIndex===o++)return e}function gs(e,t,i,o){o.id&&(t[o.id]=i)}function Ds(e,t,i){if(i.events&&i.events.length)for(let o,n=0,s=i.events;nclass extends e{static _parseTemplate(e,t){if(!e._templateInfo){let i=e._templateInfo={};i.nodeInfoList=[],i.nestedTemplate=Boolean(t),i.stripWhiteSpace=t&&t.stripWhiteSpace||e.hasAttribute&&e.hasAttribute("strip-whitespace"),this._parseTemplateContent(e,i,{parent:null})}return e._templateInfo}static _parseTemplateContent(e,t,i){return this._parseTemplateNode(e.content,t,i)}static _parseTemplateNode(e,t,i){let o=!1,n=e;return"template"!=n.localName||n.hasAttribute("preserve-content")?"slot"===n.localName&&(t.hasInsertionPoint=!0):o=this._parseTemplateNestedTemplate(n,t,i)||o,Ms(n),n.firstChild&&this._parseTemplateChildNodes(n,t,i),n.hasAttributes&&n.hasAttributes()&&(o=this._parseTemplateNodeAttributes(n,t,i)||o),o||i.noted}static _parseTemplateChildNodes(e,t,i){if("script"!==e.localName&&"style"!==e.localName)for(let o,n=e.firstChild,s=0;n;n=o){if("template"==n.localName&&(n=Ks(n)),o=n.nextSibling,n.nodeType===Node.TEXT_NODE){let i=o;for(;i&&i.nodeType===Node.TEXT_NODE;)n.textContent+=i.textContent,o=i.nextSibling,e.removeChild(i),i=o;if(t.stripWhiteSpace&&!n.textContent.trim()){e.removeChild(n);continue}}let r={parentIndex:s,parentInfo:i};this._parseTemplateNode(n,t,r)&&(r.infoIndex=t.nodeInfoList.push(r)-1),n.parentNode&&s++}}static _parseTemplateNestedTemplate(e,t,i){let o=e,n=this._parseTemplate(o,t);return(n.content=o.content.ownerDocument.createDocumentFragment()).appendChild(o.content),i.templateInfo=n,!0}static _parseTemplateNodeAttributes(e,t,i){let o=!1,n=Array.from(e.attributes);for(let s,r=n.length-1;s=n[r];r--)o=this._parseTemplateNodeAttribute(e,t,i,s.name,s.value)||o;return o}static _parseTemplateNodeAttribute(e,t,i,o,n){return"on-"===o.slice(0,3)?(e.removeAttribute(o),i.events=i.events||[],i.events.push({name:o.slice(3),value:n}),!0):"id"===o&&(i.id=n,!0)}static _contentForTemplate(e){let t=e._templateInfo;return t&&t.content||e.content}_stampTemplate(e,t){e&&!e.content&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(e);let i=(t=t||this.constructor._parseTemplate(e)).nodeInfoList,o=t.content||e.content,n=document.importNode(o,!0);n.__noInsertionPoint=!t.hasInsertionPoint;let s=n.nodeList=new Array(i.length);n.$={};for(let e,o=0,r=i.length;o!e.literal)).length+(o.dynamicFn?1:0)}for(let e in o)t[e]||n.push(e);return{counts:i,ready:n,total:s}}(e);for(;o=s.shift();){t.set(o,t.size);const e=i[o];e&&e.forEach((e=>{const t=e.info.methodInfo;--r,0==--n[t]&&s.push(t)}))}if(0!==r){const t=e;console.warn(`Computed graph for ${t.localName} incomplete; circular?`)}e.constructor.__orderedComputedDeps=t}return t}(e),r=[];for(let e in t)Is(e,n,r,s,o);let a;for(;a=r.shift();)Hs(e,"",t,i,a)&&Is(a.methodInfo,n,r,s,o);Object.assign(i,e.__dataOld),Object.assign(t,e.__dataPending),e.__dataPending=null}else{let s=t;for(;ks(e,n,s,i,o);)Object.assign(i,e.__dataOld),Object.assign(t,e.__dataPending),s=e.__dataPending,e.__dataPending=null}}const _s=(e,t,i)=>{let o=0,n=t.length-1,s=-1;for(;o<=n;){const r=o+n>>1,a=i.get(t[r].methodInfo)-i.get(e.methodInfo);if(a<0)o=r+1;else{if(!(a>0)){s=r;break}n=r-1}}s<0&&(s=n+1),t.splice(s,0,e)},Is=(e,t,i,o,n)=>{const s=t[n?_n(e):e];if(s)for(let t=0;th.source.length&&"property"==l.kind&&!l.isCompound&&a.__isPropertyEffectsClient&&a.__dataHasAccessor&&a.__dataHasAccessor[l.target]){let o=i[t];t=Un(h.source,l.target,t),a._setPendingPropertyOrPath(t,o,!1,!0)&&e._enqueueClient(a)}else{let r=n.evaluator._evaluateBinding(e,h,t,i,o,s);r!==Ys&&function(e,t,i,o,n){n=function(e,t,i,o){if(i.isCompound){let n=e.__dataCompoundStorage[i.target];n[o.compoundIndex]=t,t=n.join("")}"attribute"!==i.kind&&("textContent"!==i.target&&("value"!==i.target||"input"!==e.localName&&"textarea"!==e.localName)||(t=null==t?"":t));return t}(t,n,i,o),ln&&(n=ln(n,i.target,i.kind,t));if("attribute"==i.kind)e._valueToNodeAttribute(t,n,i.target);else{let o=i.target;t.__isPropertyEffectsClient&&t.__dataHasAccessor&&t.__dataHasAccessor[o]?t[Ss.READ_ONLY]&&t[Ss.READ_ONLY][o]||t._setPendingProperty(o,n)&&e._enqueueClient(t):e._setUnmanagedPropertyToNode(t,o,n)}}(e,a,l,h,r)}}function Js(e,t){if(t.isCompound){let i=e.__dataCompoundStorage||(e.__dataCompoundStorage={}),o=t.parts,n=new Array(o.length);for(let e=0;e="0"&&o<="9"&&(o="#"),o){case"'":case'"':i.value=t.slice(1,-1),i.literal=!0;break;case"#":i.value=Number(t),i.literal=!0}return i.literal||(i.rootProperty=_n(t),i.structured=Wn(t),i.structured&&(i.wildcard=".*"==t.slice(-2),i.wildcard&&(i.name=t.slice(0,-2)))),i}function sr(e,t,i){let o=Jn(e,i);return void 0===o&&(o=t[i]),o}function rr(e,t,i,o){const n={indexSplices:o};Pn&&!e._overrideLegacyUndefined&&(t.splices=n),e.notifyPath(i+".splices",n),e.notifyPath(i+".length",t.length),Pn&&!e._overrideLegacyUndefined&&(n.indexSplices=[])}function ar(e,t,i,o,n,s){rr(e,t,i,[{index:o,addedCount:n,removed:s,object:t,type:"splice"}])}const lr=Dn((e=>{const t=bs(Ps(e));return class extends t{constructor(){super(),this.__isPropertyEffectsClient=!0,this.__dataClientsReady,this.__dataPendingClients,this.__dataToNotify,this.__dataLinkedPaths,this.__dataHasPaths,this.__dataCompoundStorage,this.__dataHost,this.__dataTemp,this.__dataClientsInitialized,this.__data,this.__dataPending,this.__dataOld,this.__computeEffects,this.__computeInfo,this.__reflectEffects,this.__notifyEffects,this.__propagateEffects,this.__observeEffects,this.__readOnly,this.__templateInfo,this._overrideLegacyUndefined}get PROPERTY_EFFECT_TYPES(){return Ss}_initializeProperties(){super._initializeProperties(),this._registerHost(),this.__dataClientsReady=!1,this.__dataPendingClients=null,this.__dataToNotify=null,this.__dataLinkedPaths=null,this.__dataHasPaths=!1,this.__dataCompoundStorage=this.__dataCompoundStorage||null,this.__dataHost=this.__dataHost||null,this.__dataTemp={},this.__dataClientsInitialized=!1}_registerHost(){if(hr.length){let e=hr[hr.length-1];e._enqueueClient(this),this.__dataHost=e}}_initializeProtoProperties(e){this.__data=Object.create(e),this.__dataPending=Object.create(e),this.__dataOld={}}_initializeInstanceProperties(e){let t=this[Ss.READ_ONLY];for(let i in e)t&&t[i]||(this.__dataPending=this.__dataPending||{},this.__dataOld=this.__dataOld||{},this.__data[i]=this.__dataPending[i]=e[i])}_addPropertyEffect(e,t,i){this._createPropertyAccessor(e,t==Ss.READ_ONLY);let o=Es(this,t,!0)[e];o||(o=this[t][e]=[]),o.push(i)}_removePropertyEffect(e,t,i){let o=Es(this,t,!0)[e],n=o.indexOf(i);n>=0&&o.splice(n,1)}_hasPropertyEffect(e,t){let i=this[t];return Boolean(i&&i[e])}_hasReadOnlyEffect(e){return this._hasPropertyEffect(e,Ss.READ_ONLY)}_hasNotifyEffect(e){return this._hasPropertyEffect(e,Ss.NOTIFY)}_hasReflectEffect(e){return this._hasPropertyEffect(e,Ss.REFLECT)}_hasComputedEffect(e){return this._hasPropertyEffect(e,Ss.COMPUTE)}_setPendingPropertyOrPath(e,t,i,o){if(o||_n(Array.isArray(e)?e[0]:e)!==e){if(!o){let i=Jn(this,e);if(!(e=Ln(this,e,t))||!super._shouldPropertyChange(e,t,i))return!1}if(this.__dataHasPaths=!0,this._setPendingProperty(e,t,i))return function(e,t,i){let o=e.__dataLinkedPaths;if(o){let n;for(let s in o){let r=o[s];Hn(s,t)?(n=Un(s,r,t),e._setPendingPropertyOrPath(n,i,!0,!0)):Hn(r,t)&&(n=Un(r,s,t),e._setPendingPropertyOrPath(n,i,!0,!0))}}}(this,e,t),!0}else{if(this.__dataHasAccessor&&this.__dataHasAccessor[e])return this._setPendingProperty(e,t,i);this[e]=t}return!1}_setUnmanagedPropertyToNode(e,t,i){i===e[t]&&"object"!=typeof i||("className"===t&&(e=Vn(e)),e[t]=i)}_setPendingProperty(e,t,i){let o=this.__dataHasPaths&&Wn(e),n=o?this.__dataTemp:this.__data;return!!this._shouldPropertyChange(e,t,n[e])&&(this.__dataPending||(this.__dataPending={},this.__dataOld={}),e in this.__dataOld||(this.__dataOld[e]=this.__data[e]),o?this.__dataTemp[e]=t:this.__data[e]=t,this.__dataPending[e]=t,(o||this[Ss.NOTIFY]&&this[Ss.NOTIFY][e])&&(this.__dataToNotify=this.__dataToNotify||{},this.__dataToNotify[e]=i),!0)}_setProperty(e,t){this._setPendingProperty(e,t,!0)&&this._invalidateProperties()}_invalidateProperties(){this.__dataReady&&this._flushProperties()}_enqueueClient(e){this.__dataPendingClients=this.__dataPendingClients||[],e!==this&&this.__dataPendingClients.push(e)}_flushClients(){this.__dataClientsReady?this.__enableOrFlushClients():(this.__dataClientsReady=!0,this._readyClients(),this.__dataReady=!0)}__enableOrFlushClients(){let e=this.__dataPendingClients;if(e){this.__dataPendingClients=null;for(let t=0;t{ks(this,e.propertyEffects,t,i,o,e.nodeList);for(let n=e.firstChild;n;n=n.nextSibling)this._runEffectsForTemplate(n,t,i,o)};e.runEffects?e.runEffects(n,t,o):n(t,o)}linkPaths(e,t){e=Rn(e),t=Rn(t),this.__dataLinkedPaths=this.__dataLinkedPaths||{},this.__dataLinkedPaths[e]=t}unlinkPaths(e){e=Rn(e),this.__dataLinkedPaths&&delete this.__dataLinkedPaths[e]}notifySplices(e,t){let i={path:""};rr(this,Jn(this,e,i),i.path,t)}get(e,t){return Jn(t||this,e)}set(e,t,i){i?Ln(i,e,t):this[Ss.READ_ONLY]&&this[Ss.READ_ONLY][e]||this._setPendingPropertyOrPath(e,t,!0)&&this._invalidateProperties()}push(e,...t){let i={path:""},o=Jn(this,e,i),n=o.length,s=o.push(...t);return t.length&&ar(this,o,i.path,n,t.length,[]),s}pop(e){let t={path:""},i=Jn(this,e,t),o=Boolean(i.length),n=i.pop();return o&&ar(this,i,t.path,i.length,0,[n]),n}splice(e,t,i,...o){let n,s={path:""},r=Jn(this,e,s);return t<0?t=r.length-Math.floor(-t):t&&(t=Math.floor(t)),n=2===arguments.length?r.splice(t):r.splice(t,i,...o),(o.length||n.length)&&ar(this,r,s.path,t,o.length,n),n}shift(e){let t={path:""},i=Jn(this,e,t),o=Boolean(i.length),n=i.shift();return o&&ar(this,i,t.path,0,0,[n]),n}unshift(e,...t){let i={path:""},o=Jn(this,e,i),n=o.unshift(...t);return t.length&&ar(this,o,i.path,0,t.length,[]),n}notifyPath(e,t){let i;if(1==arguments.length){let o={path:""};t=Jn(this,e,o),i=o.path}else i=Array.isArray(e)?Rn(e):e;this._setPendingPropertyOrPath(i,t,!0,!0)&&this._invalidateProperties()}_createReadOnlyProperty(e,t){var i;this._addPropertyEffect(e,Ss.READ_ONLY),t&&(this["_set"+(i=e,i[0].toUpperCase()+i.substring(1))]=function(t){this._setProperty(e,t)})}_createPropertyObserver(e,t,i){let o={property:e,method:t,dynamicFn:Boolean(i)};this._addPropertyEffect(e,Ss.OBSERVE,{fn:As,info:o,trigger:{name:e}}),i&&this._addPropertyEffect(t,Ss.OBSERVE,{fn:As,info:o,trigger:{name:t}})}_createMethodObserver(e,t){let i=or(e);if(!i)throw new Error("Malformed observer expression '"+e+"'");Bs(this,i,Ss.OBSERVE,Qs,null,t)}_createNotifyingProperty(e){this._addPropertyEffect(e,Ss.NOTIFY,{fn:Ns,info:{eventName:es(e)+"-changed",property:e}})}_createReflectedProperty(e){let t=this.constructor.attributeNameForProperty(e);"-"===t[0]?console.warn("Property "+e+" cannot be reflected to attribute "+t+' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.'):this._addPropertyEffect(e,Ss.REFLECT,{fn:Vs,info:{attrName:t}})}_createComputedProperty(e,t,i){let o=or(t);if(!o)throw new Error("Malformed computed expression '"+t+"'");const n=Bs(this,o,Ss.COMPUTE,Hs,e,i);Es(this,Ts)[e]=n}_marshalArgs(e,t,i){const o=this.__data,n=[];for(let s=0,r=e.length;s1)return Ys;n[s]=h}return n}static addPropertyEffect(e,t,i){this.prototype._addPropertyEffect(e,t,i)}static createPropertyObserver(e,t,i){this.prototype._createPropertyObserver(e,t,i)}static createMethodObserver(e,t){this.prototype._createMethodObserver(e,t)}static createNotifyingProperty(e){this.prototype._createNotifyingProperty(e)}static createReadOnlyProperty(e,t){this.prototype._createReadOnlyProperty(e,t)}static createReflectedProperty(e){this.prototype._createReflectedProperty(e)}static createComputedProperty(e,t,i){this.prototype._createComputedProperty(e,t,i)}static bindTemplate(e){return this.prototype._bindTemplate(e)}_bindTemplate(e,t){let i=this.constructor._parseTemplate(e),o=this.__preBoundTemplateInfo==i;if(!o)for(let e in i.propertyEffects)this._createPropertyAccessor(e);if(t)if(i=Object.create(i),i.wasPreBound=o,this.__templateInfo){const t=e._parentTemplateInfo||this.__templateInfo,o=t.lastChild;i.parent=t,t.lastChild=i,i.previousSibling=o,o?o.nextSibling=i:t.firstChild=i}else this.__templateInfo=i;else this.__preBoundTemplateInfo=i;return i}static _addTemplatePropertyEffect(e,t,i){(e.hostProps=e.hostProps||{})[t]=!0;let o=e.propertyEffects=e.propertyEffects||{};(o[t]=o[t]||[]).push(i)}_stampTemplate(e,t){t=t||this._bindTemplate(e,!0),hr.push(this);let i=super._stampTemplate(e,t);if(hr.pop(),t.nodeList=i.nodeList,!t.wasPreBound){let e=t.childNodes=[];for(let t=i.firstChild;t;t=t.nextSibling)e.push(t)}return i.templateInfo=t,function(e,t){let{nodeList:i,nodeInfoList:o}=t;if(o.length)for(let t=0;tn&&o.push({literal:e.slice(n,i.index)});let s=i[1][0],r=Boolean(i[2]),a=i[3].trim(),l=!1,h="",m=-1;"{"==s&&(m=a.indexOf("::"))>0&&(h=a.substring(m+2),a=a.substring(0,m),l=!0);let c=or(a),d=[];if(c){let{args:e,methodName:i}=c;for(let t=0;t{const t=cs(e);function i(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof n?t:null}function o(e){if(!e.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",e))){let t=null;if(e.hasOwnProperty(JSCompiler_renameProperty("properties",e))){const i=e.properties;i&&(t=function(e){const t={};for(let i in e){const o=e[i];t[i]="function"==typeof o?{type:o}:o}return t}(i))}e.__ownProperties=t}return e.__ownProperties}class n extends t{static get observedAttributes(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__observedAttributes",this))){this.prototype;const e=this._properties;this.__observedAttributes=e?Object.keys(e).map((e=>this.prototype._addPropertyToAttributeMap(e))):[]}return this.__observedAttributes}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const e=i(this);e&&e.finalize(),this.__finalized=!0,this._finalizeClass()}}static _finalizeClass(){const e=o(this);e&&this.createProperties(e)}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const e=i(this);this.__properties=Object.assign({},e&&e._properties,o(this))}return this.__properties}static typeForProperty(e){const t=this._properties[e];return t&&t.type}_initializeProperties(){this.constructor.finalize(),super._initializeProperties()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._enableProperties()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback()}}return n})),cr=window.ShadyCSS&&window.ShadyCSS.cssBuild,dr=Dn((e=>{const t=mr(lr(e));function i(e,t,i,o){i.computed&&(i.readOnly=!0),i.computed&&(e._hasReadOnlyEffect(t)?console.warn(`Cannot redefine computed property '${t}'.`):e._createComputedProperty(t,i.computed,o)),i.readOnly&&!e._hasReadOnlyEffect(t)?e._createReadOnlyProperty(t,!i.computed):!1===i.readOnly&&e._hasReadOnlyEffect(t)&&console.warn(`Cannot make readOnly property '${t}' non-readOnly.`),i.reflectToAttribute&&!e._hasReflectEffect(t)?e._createReflectedProperty(t):!1===i.reflectToAttribute&&e._hasReflectEffect(t)&&console.warn(`Cannot make reflected property '${t}' non-reflected.`),i.notify&&!e._hasNotifyEffect(t)?e._createNotifyingProperty(t):!1===i.notify&&e._hasNotifyEffect(t)&&console.warn(`Cannot make notify property '${t}' non-notify.`),i.observer&&e._createPropertyObserver(t,i.observer,o[i.observer]),e._addPropertyToAttributeMap(t)}function o(e,t,i,o){if(!cr){const n=t.content.querySelectorAll("style"),s=On(t),r=function(e){let t=kn(e);return t?Cn(t):[]}(i),a=t.content.firstElementChild;for(let i=0;i{t+=e.textContent,e.parentNode.removeChild(e)})),e._styleSheet=new CSSStyleSheet,e._styleSheet.replaceSync(t)}}}return class extends t{static get polymerElementVersion(){return"3.5.1"}static _finalizeClass(){t._finalizeClass.call(this);const e=((i=this).hasOwnProperty(JSCompiler_renameProperty("__ownObservers",i))||(i.__ownObservers=i.hasOwnProperty(JSCompiler_renameProperty("observers",i))?i.observers:null),i.__ownObservers);var i;e&&this.createObservers(e,this._properties),this._prepareTemplate()}static _prepareTemplate(){let e=this.template;e&&("string"==typeof e?(console.error("template getter must return HTMLTemplateElement"),e=null):dn||(e=e.cloneNode(!0))),this.prototype._template=e}static createProperties(e){for(let t in e)i(this.prototype,t,e[t],e)}static createObservers(e,t){const i=this.prototype;for(let o=0;o{this._timer=null,jr.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),jr.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}static debounce(t,i,o){return t instanceof e?t._cancelAsync():t=new e,t.setConfig(i,o),t}},jr=new Set;const Pr=function(e){jr.add(e)},wr=function(){const e=Boolean(jr.size);return jr.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e};let ur="string"==typeof document.head.style.touchAction,fr="__polymerGestures",Mr="__polymerGesturesHandled",Zr="__polymerGesturesTouchAction",Kr=["mousedown","mousemove","mouseup","click"],yr=[0,1,4,2],gr=function(){try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(e){return!1}}();function Dr(e){return Kr.indexOf(e)>-1}let xr=!1;function br(e){if(!Dr(e)&&"touchend"!==e)return ur&&xr&&hn?{passive:!0}:void 0}!function(){try{let e=Object.defineProperty({},"passive",{get(){xr=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}();let vr=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);const Yr=[],Sr={button:!0,input:!0,keygen:!0,meter:!0,output:!0,textarea:!0,progress:!0,select:!0},Tr={button:!0,command:!0,fieldset:!0,input:!0,keygen:!0,optgroup:!0,option:!0,select:!0,textarea:!0};function Xr(e){let t=Array.prototype.slice.call(e.labels||[]);if(!t.length){t=[];try{let i=e.getRootNode();if(e.id){let o=i.querySelectorAll(`label[for = '${e.id}']`);for(let e=0;e-1}if(o[e]===Gr.mouse.target)return}if(t)return;e.preventDefault(),e.stopPropagation()}};function kr(e){let t=vr?["click"]:Kr;for(let i,o=0;oe.composedPath&&e.composedPath()||[],Nr={},Vr=[];function Wr(e){const t=Cr(e);return t.length>0?t[0]:e.target}function _r(e){let t,i=e.type,o=e.currentTarget[fr];if(!o)return;let n=o[i];if(n){if(!e[Mr]&&(e[Mr]={},"touch"===i.slice(0,5))){let t=e.changedTouches[0];if("touchstart"===i&&1===e.touches.length&&(Gr.touch.id=t.identifier),Gr.touch.id!==t.identifier)return;ur||"touchstart"!==i&&"touchmove"!==i||function(e){let t=e.changedTouches[0],i=e.type;if("touchstart"===i)Gr.touch.x=t.clientX,Gr.touch.y=t.clientY,Gr.touch.scrollDecided=!1;else if("touchmove"===i){if(Gr.touch.scrollDecided)return;Gr.touch.scrollDecided=!0;let i=function(e){let t="auto",i=Cr(e);for(let e,o=0;on:"pan-y"===i&&(o=n>s)),o?e.preventDefault():Jr("track")}}(e)}if(t=e[Mr],!t.skip){for(let i,o=0;o-1&&i.reset&&i.reset();for(let o,s=0;s{e.style.touchAction=t})),e[Zr]=t}function Fr(e,t,i){let o=new Event(t,{bubbles:!0,cancelable:!0,composed:!0});if(o.detail=i,Vn(e).dispatchEvent(o),o.defaultPrevented){let e=i.preventer||i.sourceEvent;e&&e.preventDefault&&e.preventDefault()}}function Jr(e){let t=function(e){for(let t,i=0;i=5||n>=5}function Qr(e,t,i){if(!t)return;let o,n=e.moves[e.moves.length-2],s=e.moves[e.moves.length-1],r=s.x-e.x,a=s.y-e.y,l=0;n&&(o=s.x-n.x,l=s.y-n.y),Fr(t,"track",{state:e.state,x:i.clientX,y:i.clientY,dx:r,dy:a,ddx:o,ddy:l,sourceEvent:i,hover:function(){return function(e,t){let i=document.elementFromPoint(e,t),o=i;for(;o&&o.shadowRoot&&!window.ShadyDOM;){let n=o;if(o=o.shadowRoot.elementFromPoint(e,t),n===o)break;o&&(i=o)}return i}(i.clientX,i.clientY)}})}function $r(e,t,i){let o=Math.abs(t.clientX-e.x),n=Math.abs(t.clientY-e.y),s=Wr(i||t);!s||Tr[s.localName]&&s.hasAttribute("disabled")||(isNaN(o)||isNaN(n)||o<=25&&n<=25||function(e){if("click"===e.type){if(0===e.detail)return!0;let t=Wr(e);if(!t.nodeType||t.nodeType!==Node.ELEMENT_NODE)return!0;let i=t.getBoundingClientRect(),o=e.pageX,n=e.pageY;return!(o>=i.left&&o<=i.right&&n>=i.top&&n<=i.bottom)}return!1}(t))&&(e.prevent||Fr(s,"tap",{x:t.clientX,y:t.clientY,sourceEvent:t,preventer:i}))}Ur({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset:function(){Or(this.info)},mousedown:function(e){if(!zr(e))return;let t=Wr(e),i=this;Ar(this.info,(function(e){zr(e)||(Lr("up",t,e),Or(i.info))}),(function(e){zr(e)&&Lr("up",t,e),Or(i.info)})),Lr("down",t,e)},touchstart:function(e){Lr("down",Wr(e),e.changedTouches[0],e)},touchend:function(e){Lr("up",Wr(e),e.changedTouches[0],e)}}),Ur({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:!1,moves:[],addMove:function(e){this.moves.length>2&&this.moves.shift(),this.moves.push(e)},movefn:null,upfn:null,prevent:!1},reset:function(){this.info.state="start",this.info.started=!1,this.info.moves=[],this.info.x=0,this.info.y=0,this.info.prevent=!1,Or(this.info)},mousedown:function(e){if(!zr(e))return;let t=Wr(e),i=this,o=function(e){let o=e.clientX,n=e.clientY;Br(i.info,o,n)&&(i.info.state=i.info.started?"mouseup"===e.type?"end":"track":"start","start"===i.info.state&&Jr("tap"),i.info.addMove({x:o,y:n}),zr(e)||(i.info.state="end",Or(i.info)),t&&Qr(i.info,t,e),i.info.started=!0)};Ar(this.info,o,(function(e){i.info.started&&o(e),Or(i.info)})),this.info.x=e.clientX,this.info.y=e.clientY},touchstart:function(e){let t=e.changedTouches[0];this.info.x=t.clientX,this.info.y=t.clientY},touchmove:function(e){let t=Wr(e),i=e.changedTouches[0],o=i.clientX,n=i.clientY;Br(this.info,o,n)&&("start"===this.info.state&&Jr("tap"),this.info.addMove({x:o,y:n}),Qr(this.info,t,i),this.info.state="track",this.info.started=!0)},touchend:function(e){let t=Wr(e),i=e.changedTouches[0];this.info.started&&(this.info.state="end",this.info.addMove({x:i.clientX,y:i.clientY}),Qr(this.info,t,i))}}),Ur({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:!1},reset:function(){this.info.x=NaN,this.info.y=NaN,this.info.prevent=!1},mousedown:function(e){zr(e)&&(this.info.x=e.clientX,this.info.y=e.clientY)},click:function(e){zr(e)&&$r(this.info,e)},touchstart:function(e){const t=e.changedTouches[0];this.info.x=t.clientX,this.info.y=t.clientY},touchend:function(e){$r(this.info,e.changedTouches[0],e)}});const qr=Dn((e=>class extends e{_addEventListenerToNode(e,t,i){Ir(e,t,i)||super._addEventListenerToNode(e,t,i)}_removeEventListenerFromNode(e,t,i){Hr(e,t,i)||super._removeEventListenerFromNode(e,t,i)}})),ea=/:host\(:dir\((ltr|rtl)\)\)/g,ta=/([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g,ia=/:dir\((?:ltr|rtl)\)/,oa=Boolean(window.ShadyDOM&&window.ShadyDOM.inUse),na=[];let sa=null,ra="";function aa(){ra=document.documentElement.getAttribute("dir")}function la(e){if(!e.__autoDirOptOut){e.setAttribute("dir",ra)}}function ha(){aa(),ra=document.documentElement.getAttribute("dir");for(let e=0;e{oa||sa||(aa(),sa=new MutationObserver(ha),sa.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]}));const t=Ps(e);class i extends t{static _processStyleText(e,i){return e=t._processStyleText.call(this,e,i),!oa&&ia.test(e)&&(e=this._replaceDirInCssText(e),this.__activateDir=!0),e}static _replaceDirInCssText(e){let t=e;return t=t.replace(ea,':host([dir="$1"])'),t=t.replace(ta,':host([dir="$2"]) $1'),t}constructor(){super(),this.__autoDirOptOut=!1}ready(){super.ready(),this.__autoDirOptOut=this.hasAttribute("dir")}connectedCallback(){t.prototype.connectedCallback&&super.connectedCallback(),this.constructor.__activateDir&&(sa&&sa.takeRecords().length&&ha(),na.push(this),la(this))}disconnectedCallback(){if(t.prototype.disconnectedCallback&&super.disconnectedCallback(),this.constructor.__activateDir){const e=na.indexOf(this);e>-1&&na.splice(e,1)}}}return i.__activateDir=!1,i}));let ca=!1,da=[],pa=[];function ja(){ca=!0,requestAnimationFrame((function(){ca=!1,function(e){for(;e.length;)Pa(e.shift())}(da),setTimeout((function(){!function(e){for(let t=0,i=e.length;t{throw e}))}}function wa(){document.body.removeAttribute("unresolved")}function ua(e,t,i){return{index:e,removed:t,addedCount:i}}"interactive"===document.readyState||"complete"===document.readyState?wa():window.addEventListener("DOMContentLoaded",wa);const fa=0,Ma=1,Za=2,Ka=3;function ya(e,t,i,o,n,s){let r,a=0,l=0,h=Math.min(i-t,s-n);if(0==t&&0==n&&(a=function(e,t,i){for(let o=0;o0||i>0;){if(0==t){n.push(Za),i--;continue}if(0==i){n.push(Ka),t--;continue}let s,r=e[t-1][i-1],a=e[t-1][i],l=e[t][i-1];s=axa(e)?Vn(e).assignedNodes({flatten:!0}):[e])).reduce(((e,t)=>e.concat(t)),[])}constructor(e,t){this._shadyChildrenObserver=null,this._nativeChildrenObserver=null,this._connected=!1,this._target=e,this.callback=t,this._effectiveNodes=[],this._observer=null,this._scheduled=!1,this._boundSchedule=()=>{this._schedule()},this.connect(),this._schedule()}connect(){xa(this._target)?this._listenSlots([this._target]):Vn(this._target).children&&(this._listenSlots(Vn(this._target).children),window.ShadyDOM?this._shadyChildrenObserver=window.ShadyDOM.observeChildren(this._target,(e=>{this._processMutations(e)})):(this._nativeChildrenObserver=new MutationObserver((e=>{this._processMutations(e)})),this._nativeChildrenObserver.observe(this._target,{childList:!0}))),this._connected=!0}disconnect(){xa(this._target)?this._unlistenSlots([this._target]):Vn(this._target).children&&(this._unlistenSlots(Vn(this._target).children),window.ShadyDOM&&this._shadyChildrenObserver?(window.ShadyDOM.unobserveChildren(this._shadyChildrenObserver),this._shadyChildrenObserver=null):this._nativeChildrenObserver&&(this._nativeChildrenObserver.disconnect(),this._nativeChildrenObserver=null)),this._connected=!1}_schedule(){this._scheduled||(this._scheduled=!0,hs.run((()=>this.flush())))}_processMutations(e){this._processSlotMutations(e),this.flush()}_processSlotMutations(e){if(e)for(let t=0;t{"activeElement"!=t&&(e.prototype[t]=Xa.prototype[t])})),Ea(e.prototype,["classList"]),za=e,Object.defineProperties(ka.prototype,{localTarget:{get(){const e=this.event.currentTarget,t=e&&Ga(e).getOwnerRoot(),i=this.path;for(let e=0;e{for(;e;){const t=Object.getOwnPropertyDescriptor(e,"observedAttributes");if(t)return t.get;e=Object.getPrototypeOf(e.prototype).constructor}return()=>[]};Dn((e=>{const t=dr(e);let i=Va(t);return class extends t{constructor(){super(),this.__isUpgradeDisabled}static get observedAttributes(){return i.call(this).concat(Na)}_initializeProperties(){this.hasAttribute(Na)?this.__isUpgradeDisabled=!0:super._initializeProperties()}_enableProperties(){this.__isUpgradeDisabled||super._enableProperties()}_canApplyPropertyDefault(e){return super._canApplyPropertyDefault(e)&&!(this.__isUpgradeDisabled&&this._isPropertyPending(e))}attributeChangedCallback(e,t,i,o){e==Na?this.__isUpgradeDisabled&&null==i&&(super._initializeProperties(),this.__isUpgradeDisabled=!1,Vn(this).isConnected&&super.connectedCallback()):super.attributeChangedCallback(e,t,i,o)}connectedCallback(){this.__isUpgradeDisabled||super.connectedCallback()}disconnectedCallback(){this.__isUpgradeDisabled||super.disconnectedCallback()}}}));const Wa="disable-upgrade";let _a=window.ShadyCSS;const Ia=Dn((e=>{const t=qr(dr(e)),i=cr?t:ma(t),o=Va(i),n={x:"pan-x",y:"pan-y",none:"none",all:"auto"};class s extends i{constructor(){super(),this.isAttached,this.__boundListeners,this._debouncers,this.__isUpgradeDisabled,this.__needsAttributesAtConnected,this._legacyForceObservedAttributes}static get importMeta(){return this.prototype.importMeta}created(){}__attributeReaction(e,t,i){(this.__dataAttributes&&this.__dataAttributes[e]||e===Wa)&&this.attributeChangedCallback(e,t,i,null)}setAttribute(e,t){if(Kn&&!this._legacyForceObservedAttributes){const i=this.getAttribute(e);super.setAttribute(e,t),this.__attributeReaction(e,i,String(t))}else super.setAttribute(e,t)}removeAttribute(e){if(Kn&&!this._legacyForceObservedAttributes){const t=this.getAttribute(e);super.removeAttribute(e),this.__attributeReaction(e,t,null)}else super.removeAttribute(e)}static get observedAttributes(){return Kn&&!this.prototype._legacyForceObservedAttributes?(this.hasOwnProperty(JSCompiler_renameProperty("__observedAttributes",this))||(this.__observedAttributes=[],this.prototype),this.__observedAttributes):o.call(this).concat(Wa)}_enableProperties(){this.__isUpgradeDisabled||super._enableProperties()}_canApplyPropertyDefault(e){return super._canApplyPropertyDefault(e)&&!(this.__isUpgradeDisabled&&this._isPropertyPending(e))}connectedCallback(){this.__needsAttributesAtConnected&&this._takeAttributes(),this.__isUpgradeDisabled||(super.connectedCallback(),this.isAttached=!0,this.attached())}attached(){}disconnectedCallback(){this.__isUpgradeDisabled||(super.disconnectedCallback(),this.isAttached=!1,this.detached())}detached(){}attributeChangedCallback(e,t,i,o){t!==i&&(e==Wa?this.__isUpgradeDisabled&&null==i&&(this._initializeProperties(),this.__isUpgradeDisabled=!1,Vn(this).isConnected&&this.connectedCallback()):(super.attributeChangedCallback(e,t,i,o),this.attributeChanged(e,t,i)))}attributeChanged(e,t,i){}_initializeProperties(){if(dn&&this.hasAttribute(Wa))this.__isUpgradeDisabled=!0;else{let e=Object.getPrototypeOf(this);e.hasOwnProperty(JSCompiler_renameProperty("__hasRegisterFinished",e))||(this._registered(),e.__hasRegisterFinished=!0),super._initializeProperties(),this.root=this,this.created(),Kn&&!this._legacyForceObservedAttributes&&(this.hasAttributes()?this._takeAttributes():this.parentNode||(this.__needsAttributesAtConnected=!0)),this._applyListeners()}}_takeAttributes(){const e=this.attributes;for(let t=0,i=e.length;t{if(!Ca(e,n))return;const t=Array.from(Aa.nativeMethods.querySelectorAll.call(e,"*"));t.push(e);for(let e=0;e{for(let t=0;t0?ls.after(i):hs,t.bind(this))}isDebouncerActive(e){this._debouncers=this._debouncers||{};let t=this._debouncers[e];return!(!t||!t.isActive())}flushDebouncer(e){this._debouncers=this._debouncers||{};let t=this._debouncers[e];t&&t.flush()}cancelDebouncer(e){this._debouncers=this._debouncers||{};let t=this._debouncers[e];t&&t.cancel()}async(e,t){return t>0?ls.run(e.bind(this),t):~hs.run(e.bind(this))}cancelAsync(e){e<0?hs.cancel(~e):ls.cancel(e)}create(e,t){let i=document.createElement(e);if(t)if(i.setProperties)i.setProperties(t);else for(let e in t)i[e]=t[e];return i}elementMatches(e,t){return Ta(t||this,e)}toggleAttribute(e,t){let i=this;return 3===arguments.length&&(i=arguments[2]),1==arguments.length&&(t=!i.hasAttribute(e)),t?(Vn(i).setAttribute(e,""),!0):(Vn(i).removeAttribute(e),!1)}toggleClass(e,t,i){i=i||this,1==arguments.length&&(t=!i.classList.contains(e)),t?i.classList.add(e):i.classList.remove(e)}transform(e,t){(t=t||this).style.webkitTransform=e,t.style.transform=e}translate3d(e,t,i,o){o=o||this,this.transform("translate3d("+e+","+t+","+i+")",o)}arrayDelete(e,t){let i;if(Array.isArray(e)){if(i=e.indexOf(t),i>=0)return e.splice(i,1)}else{if(i=Jn(this,e).indexOf(t),i>=0)return this.splice(e,i,1)}return null}_logger(e,t){switch(Array.isArray(t)&&1===t.length&&Array.isArray(t[0])&&(t=t[0]),e){case"log":case"warn":case"error":console[e](...t)}}_log(...e){this._logger("log",e)}_warn(...e){this._logger("warn",e)}_error(...e){this._logger("error",e)}_logf(e,...t){return["[%s::%s]",this.is,e,...t]}}return s.prototype.is="",s})),Ha={attached:!0,detached:!0,ready:!0,created:!0,beforeRegister:!0,registered:!0,attributeChanged:!0,listeners:!0,hostAttributes:!0},Ua={attached:!0,detached:!0,ready:!0,created:!0,beforeRegister:!0,registered:!0,attributeChanged:!0,behaviors:!0,_noAccessors:!0},Ra=Object.assign({listeners:!0,hostAttributes:!0,properties:!0,observers:!0},Ua);function Fa(e,t,i,o){!function(e,t,i){const o=e._noAccessors,n=Object.getOwnPropertyNames(e);for(let s=0;s=0;o--){let n=e[o];n?Array.isArray(n)?Ja(n,t):t.indexOf(n)<0&&(!i||i.indexOf(n)<0)&&t.unshift(n):console.warn("behavior is null, check for missing or 404 import")}return t}function La(e,t){for(const i in t){const o=e[i],n=t[i];e[i]=!("value"in n)&&o&&"value"in o?Object.assign({value:o.value},n):n}}const Ba=Ia(HTMLElement);function Qa(e,t,i){let o;const n={};class s extends t{static _finalizeClass(){if(this.hasOwnProperty(JSCompiler_renameProperty("generatedFrom",this))){if(o)for(let e,t=0;t=0;t--){const i=e[t];for(let e in i)this._ensureAttribute(e,i[e])}super._ensureAttributes()}ready(){super.ready();let e=n.ready;if(e)for(let t=0;t{o&&function(e,t,i){for(let o=0;oclass extends e{_shouldPropertyChange(e,t,i){return qa(this,e,t,i,!0)}})),tl=Dn((e=>class extends e{static get properties(){return{mutableData:Boolean}}_shouldPropertyChange(e,t,i){return qa(this,e,t,i,this.mutableData)}}));el._mutablePropertyChange=qa;let il=null;function ol(){return il}ol.prototype=Object.create(HTMLTemplateElement.prototype,{constructor:{value:ol,writable:!0}});const nl=lr(ol),sl=el(nl);const rl=lr(class{});function al(e,t){for(let i=0;i{e.model=this,i(e)}));else{let o=this.__dataHost.__dataHost;o&&o._addEventListenerToNode(e,t,i)}}_showHideChildren(e){al(e,this.children)}_setUnmanagedPropertyToNode(e,t,i){e.__hideTemplateChildren__&&e.nodeType==Node.TEXT_NODE&&"textContent"==t?e.__polymerTextContent__=i:super._setUnmanagedPropertyToNode(e,t,i)}get parentModel(){let e=this.__parentModel;if(!e){let t;e=this;do{e=e.__dataHost.__dataHost}while((t=e.__templatizeOptions)&&!t.parentModel);this.__parentModel=e}return e}dispatchEvent(e){return!0}}ll.prototype.__dataHost,ll.prototype.__templatizeOptions,ll.prototype._methodHost,ll.prototype.__templatizeOwner,ll.prototype.__hostProps;const hl=el(ll);function ml(e){let t=e.__dataHost;return t&&t._methodHost||t}function cl(e,t,i){let o=i.mutableData?hl:ll;Pl.mixin&&(o=Pl.mixin(o));let n=class extends o{};return n.prototype.__templatizeOptions=i,n.prototype._bindTemplate(e),function(e,t,i,o){let n=i.hostProps||{};for(let t in o.instanceProps){delete n[t];let i=o.notifyInstanceProp;i&&e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:jl(t,i)})}if(o.forwardHostProp&&t.__dataHost)for(let t in n)i.hasHostProps||(i.hasHostProps=!0),e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:function(e,t,i){e.__dataHost._setPendingPropertyOrPath("_host_"+t,i[t],!0,!0)}})}(n,e,t,i),n}function dl(e,t,i,o){let n=i.forwardHostProp;if(n&&t.hasHostProps){const s="template"==e.localName;let r=t.templatizeTemplateClass;if(!r){if(s){let e=i.mutableData?sl:nl;class o extends e{}r=t.templatizeTemplateClass=o}else{const i=e.constructor;class o extends i{}r=t.templatizeTemplateClass=o}let a=t.hostProps;for(let e in a)r.prototype._addPropertyEffect("_host_"+e,r.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,{fn:pl(e,n)}),r.prototype._createNotifyingProperty("_host_"+e);pn&&o&&function(e,t,i){const o=i.constructor._properties,{propertyEffects:n}=e,{instanceProps:s}=t;for(let e in n)if(!(o[e]||s&&s[e])){const t=n[e];for(let i=0;i can only be templatized once");e.__templatizeOwner=t;let o=(t?t.constructor:ll)._parseTemplate(e),n=o.templatizeInstanceClass;n||(n=cl(e,o,i),o.templatizeInstanceClass=n);const s=ml(e);dl(e,o,i,s);let r=class extends n{};return r.prototype._methodHost=s,r.prototype.__dataHost=e,r.prototype.__templatizeOwner=t,r.prototype.__hostProps=o.hostProps,r}let wl=!1;function ul(){if(dn&&!sn){if(!wl){wl=!0;const e=document.createElement("style");e.textContent="dom-bind,dom-if,dom-repeat{display:none;}",document.head.appendChild(e)}return!0}return!1}const fl=qr(tl(lr(HTMLElement)));customElements.define("dom-bind",class extends fl{static get observedAttributes(){return["mutable-data"]}constructor(){if(super(),mn)throw new Error("strictTemplatePolicy: dom-bind not allowed");this.root=null,this.$=null,this.__children=null}attributeChangedCallback(e,t,i,o){this.mutableData=!0}connectedCallback(){ul()||(this.style.display="none"),this.render()}disconnectedCallback(){this.__removeChildren()}__insertChildren(){Vn(Vn(this).parentNode).insertBefore(this.root,this)}__removeChildren(){if(this.__children)for(let e=0;e{if(e=this.querySelector("template"),!e)throw new Error("dom-bind requires a child");t.disconnect(),this.render()}));return void t.observe(this,{childList:!0})}this.root=this._stampTemplate(e),this.$=this.root.$,this.__children=[];for(let e=this.root.firstChild;e;e=e.nextSibling)this.__children[this.__children.length]=e;this._enableProperties()}this.__insertChildren(),this.dispatchEvent(new CustomEvent("dom-change",{bubbles:!0,composed:!0}))}});const Ml=window.trustedTypes&&trustedTypes.createPolicy("polymer-html-literal",{createHTML:e=>e});class Zl{constructor(e,t){gl(e,t);const i=t.reduce(((t,i,o)=>t+Kl(i)+e[o+1]),e[0]);this.value=i.toString()}toString(){return this.value}}function Kl(e){if(e instanceof Zl)return e.value;throw new Error(`non-literal value passed to Polymer's htmlLiteral function: ${e}`)}const yl=function(e,...t){gl(e,t);const i=document.createElement("template");let o=t.reduce(((t,i,o)=>t+function(e){if(e instanceof HTMLTemplateElement)return e.innerHTML;if(e instanceof Zl)return Kl(e);throw new Error(`non-template value passed to Polymer's html function: ${e}`)}(i)+e[o+1]),e[0]);return Ml&&(o=Ml.createHTML(o)),i.innerHTML=o,i},gl=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(e.raw)||t.length!==e.length-1)throw new TypeError("Invalid call to the html template tag")},Dl=dr(HTMLElement),xl=tl(Dl);class bl extends xl{static get is(){return"dom-repeat"}static get template(){return null}static get properties(){return{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},itemsIndexAs:{type:String,value:"itemsIndex"},sort:{type:Function,observer:"__sortChanged"},filter:{type:Function,observer:"__filterChanged"},observe:{type:String,observer:"__observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:!Zn,readOnly:!0},initialCount:{type:Number},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"__computeFrameTime(targetFramerate)"},notifyDomChange:{type:Boolean},reuseChunkedInstances:{type:Boolean}}}static get observers(){return["__itemsChanged(items.*)"]}constructor(){super(),this.__instances=[],this.__renderDebouncer=null,this.__itemsIdxToInstIdx={},this.__chunkCount=null,this.__renderStartTime=null,this.__itemsArrayChanged=!1,this.__shouldMeasureChunk=!1,this.__shouldContinueChunking=!1,this.__chunkingId=0,this.__sortFn=null,this.__filterFn=null,this.__observePaths=null,this.__ctor=null,this.__isDetached=!0,this.template=null,this._templateInfo}disconnectedCallback(){super.disconnectedCallback(),this.__isDetached=!0;for(let e=0;e{if(!this.querySelector("template"))throw new Error("dom-repeat requires a child");e.disconnect(),this.__render()}));return e.observe(this,{childList:!0}),!1}let i={};i[this.as]=!0,i[this.indexAs]=!0,i[this.itemsIndexAs]=!0,this.__ctor=Pl(t,this,{mutableData:this.mutableData,parentModel:!0,instanceProps:i,forwardHostProp:function(e,t){let i=this.__instances;for(let o,n=0;n0?ls.after(t):hs,e.bind(this)),Pr(this.__renderDebouncer)}render(){this.__debounceRender(this.__render),va()}__render(){if(!this.__ensureTemplatized())return;let e=this.items||[];const t=this.__sortAndFilterItems(e),i=this.__calculateLimit(t.length);this.__updateInstances(e,i,t),this.initialCount&&(this.__shouldMeasureChunk||this.__shouldContinueChunking)&&(cancelAnimationFrame(this.__chunkingId),this.__chunkingId=requestAnimationFrame((()=>{this.__chunkingId=null,this.__continueChunking()}))),this._setRenderedItemCount(this.__instances.length),Zn&&!this.notifyDomChange||this.dispatchEvent(new CustomEvent("dom-change",{bubbles:!0,composed:!0}))}__sortAndFilterItems(e){let t=new Array(e.length);for(let i=0;ithis.__filterFn(e[t],i,o)))),this.__sortFn&&t.sort(((t,i)=>this.__sortFn(e[t],e[i]))),t}__calculateLimit(e){let t=e;const i=this.__instances.length;if(this.initialCount){let o;!this.__chunkCount||this.__itemsArrayChanged&&!this.reuseChunkedInstances?(t=Math.min(e,this.initialCount),o=Math.max(t-i,0),this.__chunkCount=o||1):(o=Math.min(Math.max(e-i,0),this.__chunkCount),t=Math.min(i+o,e)),this.__shouldMeasureChunk=o===this.__chunkCount,this.__shouldContinueChunking=t=n;e--)this.__detachAndRemoveInstance(e)}__detachInstance(e){let t=this.__instances[e];const i=Vn(t.root);for(let e=0;ethis.__render())),Pr(this.__renderDebouncer)}disconnectedCallback(){super.disconnectedCallback();const e=Vn(this).parentNode;e&&(e.nodeType!=Node.DOCUMENT_FRAGMENT_NODE||Vn(e).host)||this.__teardownInstance()}connectedCallback(){super.connectedCallback(),ul()||(this.style.display="none"),this.if&&this.__debounceRender()}__ensureTemplate(){if(!this.__template){const e=this;let t=e._templateInfo?e:Vn(e).querySelector("template");if(!t){let e=new MutationObserver((()=>{if(!Vn(this).querySelector("template"))throw new Error("dom-if requires a child");e.disconnect(),this.__render()}));return e.observe(this,{childList:!0}),!1}this.__template=t}return!0}__ensureInstance(){let e=Vn(this).parentNode;if(this.__hasInstance()){let t=this.__getInstanceNodes();if(t&&t.length){if(Vn(this).previousSibling!==t[t.length-1])for(let i,o=0;o{let o=this.__syncInfo;if(this.if)o&&(this.__syncInfo=null,this._showHideChildren(),t=Object.assign(o.changedProps,t)),e(t,i);else if(this.__instance)if(o||(o=this.__syncInfo={runEffects:e,changedProps:{}}),i)for(const e in t){const t=_n(e);o.changedProps[t]=this.__dataHost[t]}else Object.assign(o.changedProps,t)},this.__instance=t._stampTemplate(this.__template,i),Vn(e).insertBefore(this.__instance,this)}__syncHostProperties(){const e=this.__syncInfo;e&&(this.__syncInfo=null,e.runEffects(e.changedProps,!1))}__teardownInstance(){const e=this.__dataHost||this;this.__instance&&(e._removeBoundDom(this.__instance),this.__instance=null,this.__syncInfo=null)}_showHideChildren(){const e=this.__hideTemplateChildren__||!this.if;this.__instance&&Boolean(this.__instance.__hidden)!==e&&(this.__instance.__hidden=e,al(e,this.__instance.templateInfo.childNodes)),e||this.__syncHostProperties()}}:class extends vl{constructor(){super(),this.__ctor=null,this.__instance=null,this.__invalidProps=null}__hasInstance(){return Boolean(this.__instance)}__getInstanceNodes(){return this.__instance.children}__createAndInsertInstance(e){this.__ctor||(this.__ctor=Pl(this.__template,this,{mutableData:!0,forwardHostProp:function(e,t){this.__instance&&(this.if?this.__instance.forwardHostProp(e,t):(this.__invalidProps=this.__invalidProps||Object.create(null),this.__invalidProps[_n(e)]=!0))}})),this.__instance=new this.__ctor,Vn(e).insertBefore(this.__instance.root,this)}__teardownInstance(){if(this.__instance){let e=this.__instance.children;if(e&&e.length){let t=Vn(e[0]).parentNode;if(t){t=Vn(t);for(let i,o=0;o{let t=dr(e);return class extends t{static get properties(){return{items:{type:Array},multi:{type:Boolean,value:!1},selected:{type:Object,notify:!0},selectedItem:{type:Object,notify:!0},toggle:{type:Boolean,value:!1}}}static get observers(){return["__updateSelection(multi, items.*)"]}constructor(){super(),this.__lastItems=null,this.__lastMulti=null,this.__selectedMap=null}__updateSelection(e,t){let i=t.path;if(i==JSCompiler_renameProperty("items",this)){let i=t.base||[],o=this.__lastItems;if(e!==this.__lastMulti&&this.clearSelection(),o){let e=ga(i,o);this.__applySplices(e)}this.__lastItems=i,this.__lastMulti=e}else if(t.path==`${JSCompiler_renameProperty("items",this)}.splices`)this.__applySplices(t.value.indexSplices);else{let e=i.slice(`${JSCompiler_renameProperty("items",this)}.`.length),t=parseInt(e,10);e.indexOf(".")<0&&e==t&&this.__deselectChangedIdx(t)}}__applySplices(e){let t=this.__selectedMap;for(let i=0;i{e=o.index+o.removed.length?t.set(i,e+o.addedCount-o.removed.length):t.set(i,-1))}));for(let e=0;e{e<0?(this.multi?this.splice(JSCompiler_renameProperty("selected",this),i,1):this.selected=this.selectedItem=null,t.delete(o)):i++}))}__updateLinks(){if(this.__dataLinkedPaths={},this.multi){let e=0;this.__selectedMap.forEach((t=>{t>=0&&this.linkPaths(`${JSCompiler_renameProperty("items",this)}.${t}`,`${JSCompiler_renameProperty("selected",this)}.${e++}`)}))}else this.__selectedMap.forEach((e=>{this.linkPaths(JSCompiler_renameProperty("selected",this),`${JSCompiler_renameProperty("items",this)}.${e}`),this.linkPaths(JSCompiler_renameProperty("selectedItem",this),`${JSCompiler_renameProperty("items",this)}.${e}`)}))}clearSelection(){this.__dataLinkedPaths={},this.__selectedMap=new Map,this.selected=this.multi?[]:null,this.selectedItem=null}isSelected(e){return this.__selectedMap.has(e)}isIndexSelected(e){return this.isSelected(this.items[e])}__deselectChangedIdx(e){let t=this.__selectedIndexForItemIndex(e);if(t>=0){let e=0;this.__selectedMap.forEach(((i,o)=>{t==e++&&this.deselect(o)}))}}__selectedIndexForItemIndex(e){let t=this.__dataLinkedPaths[`${JSCompiler_renameProperty("items",this)}.${e}`];if(t)return parseInt(t.slice(`${JSCompiler_renameProperty("selected",this)}.`.length),10)}deselect(e){let t=this.__selectedMap.get(e);if(t>=0){let i;this.__selectedMap.delete(e),this.multi&&(i=this.__selectedIndexForItemIndex(t)),this.__updateLinks(),this.multi?this.splice(JSCompiler_renameProperty("selected",this),i,1):this.selected=this.selectedItem=null}}deselectIndex(e){this.deselect(this.items[e])}select(e){this.selectIndex(this.items.indexOf(e))}selectIndex(e){let t=this.items[e];this.isSelected(t)?this.toggle&&this.deselectIndex(e):(this.multi||this.__selectedMap.clear(),this.__selectedMap.set(t,e),this.__updateLinks(),this.multi?this.push(JSCompiler_renameProperty("selected",this),t):this.selected=this.selectedItem=t)}}})),Tl=Sl(Dl);class Xl extends Tl{static get is(){return"array-selector"}static get template(){return null}}customElements.define(Xl.is,Xl);const El=new Jo;window.ShadyCSS||(window.ShadyCSS={prepareTemplate(e,t,i){},prepareTemplateDom(e,t){},prepareTemplateStyles(e,t,i){},styleSubtree(e,t){El.processStyles(),Do(e,t)},styleElement(e){El.processStyles()},styleDocument(e){El.processStyles(),Do(document.body,e)},getComputedStyleValue:(e,t)=>xo(e,t),flushCustomStyles(){},nativeCss:Qi,nativeShadow:Ri,cssBuild:Ji,disableRuntime:Bi}),window.ShadyCSS.CustomStyleInterface=El;const kl="include",zl=window.ShadyCSS.CustomStyleInterface;class Gl extends HTMLElement{constructor(){super(),this._style=null,zl.addCustomStyle(this)}getStyle(){if(this._style)return this._style;const e=this.querySelector("style");if(!e)return null;this._style=e;const t=e.getAttribute(kl);return t&&(e.removeAttribute(kl),e.textContent=function(e){let t=e.trim().split(/\s+/),i="";for(let e=0;e
-
-
-`;Al.setAttribute("style","display: none;"),document.head.appendChild(Al.content);const Ol=document.createElement("template");Ol.setAttribute("style","display: none;"),Ol.innerHTML="\n \n \n \n ",document.head.appendChild(Ol.content);const Cl={properties:{active:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"__activeChanged"},alt:{type:String,value:"loading",observer:"__altChanged"},__coolingDown:{type:Boolean,value:!1}},__computeContainerClasses:function(e,t){return[e||t?"active":"",t?"cooldown":""].join(" ")},__activeChanged:function(e,t){this.__setAriaHidden(!e),this.__coolingDown=!e&&t},__altChanged:function(e){"loading"===e?this.alt=this.getAttribute("aria-label")||e:(this.__setAriaHidden(""===e),this.setAttribute("aria-label",e))},__setAriaHidden:function(e){var t="aria-hidden";e?this.setAttribute(t,"true"):this.removeAttribute(t)},__reset:function(){this.active=!1,this.__coolingDown=!1}},Nl=yl`
-
-
- {throw e}))}}jh.splice(0,e),ph+=e})).observe(uh,{characterData:!0});const fh={after:e=>({run:t=>window.setTimeout(t,e),cancel(e){window.clearTimeout(e)}}),run:(e,t)=>window.setTimeout(e,t),cancel(e){window.clearTimeout(e)}},Mh={run:e=>window.requestAnimationFrame(e),cancel(e){window.cancelAnimationFrame(e)}},Zh={run:e=>window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,16),cancel(e){window.cancelIdleCallback?window.cancelIdleCallback(e):window.clearTimeout(e)}},Kh={run(e){wh||(wh=!0,uh.textContent=Ph,Ph+=1),jh.push(e);const t=dh;return dh+=1,t},cancel(e){const t=e-ph;if(t>=0){if(!jh[t])throw new Error(`invalid async handle: ${e}`);jh[t]=null}}},yh=new Set;class gh{static debounce(e,t,i){return e instanceof gh?e._cancelAsync():e=new gh,e.setConfig(t,i),e}constructor(){this._asyncModule=null,this._callback=null,this._timer=null}setConfig(e,t){this._asyncModule=e,this._callback=t,this._timer=this._asyncModule.run((()=>{this._timer=null,yh.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),yh.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}}function Dh(e){yh.add(e)}function xh(){const e=Boolean(yh.size);return yh.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e}const bh=()=>{let e;do{e=xh()}while(e)},vh=[];function Yh(e,t,i=e.getAttribute("dir")){t?e.setAttribute("dir",t):null!=i&&e.removeAttribute("dir")}function Sh(){return document.documentElement.getAttribute("dir")}const Th=new MutationObserver((function(){const e=Sh();vh.forEach((t=>{Yh(t,e)}))}));Th.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const Xh=e=>class extends e{static get properties(){return{dir:{type:String,value:"",reflectToAttribute:!0,converter:{fromAttribute:e=>e||"",toAttribute:e=>""===e?null:e}}}}get __isRTL(){return"rtl"===this.getAttribute("dir")}connectedCallback(){super.connectedCallback(),this.hasAttribute("dir")&&!this.__restoreSubscription||(this.__subscribe(),Yh(this,Sh(),null))}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"dir"!==e)return;const o=Sh(),n=i===o&&-1===vh.indexOf(this),s=!i&&t&&-1===vh.indexOf(this),r=i!==o&&t===o;n||s?(this.__subscribe(),Yh(this,o,i)):r&&this.__unsubscribe()}disconnectedCallback(){super.disconnectedCallback(),this.__restoreSubscription=vh.includes(this),this.__unsubscribe()}_valueToNodeAttribute(e,t,i){("dir"!==i||""!==t||e.hasAttribute("dir"))&&super._valueToNodeAttribute(e,t,i)}_attributeToProperty(e,t,i){"dir"!==e||t?super._attributeToProperty(e,t,i):this.dir=""}__subscribe(){vh.includes(this)||vh.push(this)}__unsubscribe(){vh.includes(this)&&vh.splice(vh.indexOf(this),1)}};let Eh;un=!1,window.Vaadin||(window.Vaadin={}),window.Vaadin.registrations||(window.Vaadin.registrations=[]),window.Vaadin.developmentModeCallback||(window.Vaadin.developmentModeCallback={}),window.Vaadin.developmentModeCallback["vaadin-usage-statistics"]=function(){mh(ch)};const kh=new Set,zh=e=>class extends(Xh(e)){static get version(){return"24.0.4"}static finalize(){super.finalize();const{is:e}=this;e&&!kh.has(e)&&(window.Vaadin.registrations.push(this),kh.add(e),window.Vaadin.developmentModeCallback&&(Eh=gh.debounce(Eh,Zh,(()=>{window.Vaadin.developmentModeCallback["vaadin-usage-statistics"]()})),Dh(Eh)))}constructor(){super(),null===document.doctype&&console.warn('Vaadin components require the "standards mode" declaration. Please add to the HTML document.')}};function Gh(e){return e?new Set(e.split(" ")):new Set}function Ah(e){return[...e].join(" ")}function Oh(e,t,i){const o=Gh(e.getAttribute(t));o.add(i),e.setAttribute(t,Ah(o))}function Ch(e,t,i){const o=Gh(e.getAttribute(t));o.delete(i),0!==o.size?e.setAttribute(t,Ah(o)):e.removeAttribute(t)}let Nh=0;function Vh(){return Nh++}class Wh extends EventTarget{static generateId(e,t){return`${t||"default"}-${e.localName}-${Vh()}`}constructor(e,t,i,o={}){super();const{initializer:n,multiple:s,observe:r,useUniqueId:a}=o;this.host=e,this.slotName=t,this.tagName=i,this.observe="boolean"!=typeof r||r,this.multiple="boolean"==typeof s&&s,this.slotInitializer=n,s&&(this.nodes=[]),a&&(this.defaultId=this.constructor.generateId(e,t))}hostConnected(){this.initialized||(this.multiple?this.initMultiple():this.initSingle(),this.observe&&this.observeSlot(),this.initialized=!0)}initSingle(){let e=this.getSlotChild();e?(this.node=e,this.initAddedNode(e)):(e=this.attachDefaultNode(),this.initNode(e))}initMultiple(){const e=this.getSlotChildren();if(0===e.length){const e=this.attachDefaultNode();this.nodes=[e],this.initNode(e)}else this.nodes=e,e.forEach((e=>{this.initAddedNode(e)}))}attachDefaultNode(){const{host:e,slotName:t,tagName:i}=this;let o=this.defaultNode;return!o&&i&&(o=document.createElement(i),o instanceof Element&&(""!==t&&o.setAttribute("slot",t),this.node=o,this.defaultNode=o)),o&&e.appendChild(o),o}getSlotChildren(){const{slotName:e}=this;return Array.from(this.host.childNodes).filter((t=>t.nodeType===Node.ELEMENT_NODE&&t.slot===e||t.nodeType===Node.TEXT_NODE&&t.textContent.trim()&&""===e))}getSlotChild(){return this.getSlotChildren()[0]}initNode(e){const{slotInitializer:t}=this;t&&t(e,this.host)}initCustomNode(e){}teardownNode(e){}initAddedNode(e){e!==this.defaultNode&&(this.initCustomNode(e),this.initNode(e))}observeSlot(){const{slotName:e}=this,t=""===e?"slot:not([name])":`slot[name=${e}]`,i=this.host.shadowRoot.querySelector(t);this.__slotObserver=new ba(i,(e=>{const t=this.multiple?this.nodes:[this.node],i=e.addedNodes.filter((e=>!function(e){return e.nodeType===Node.TEXT_NODE&&""===e.textContent.trim()}(e)&&!t.includes(e)));e.removedNodes.length&&e.removedNodes.forEach((e=>{this.teardownNode(e)})),i&&i.length>0&&(t.forEach((e=>{e&&e.isConnected&&e.parentNode.removeChild(e)})),this.multiple?(this.nodes=i,i.forEach((e=>{this.initAddedNode(e)}))):(this.node=i[0],this.initAddedNode(this.node)))}))}}class _h extends Wh{constructor(e){super(e,"tooltip"),this.setTarget(e)}initCustomNode(e){e.target=this.target,void 0!==this.context&&(e.context=this.context),void 0!==this.manual&&(e.manual=this.manual),void 0!==this.opened&&(e.opened=this.opened),void 0!==this.position&&(e._position=this.position),void 0!==this.shouldShow&&(e.shouldShow=this.shouldShow)}setContext(e){this.context=e;const t=this.node;t&&(t.context=e)}setManual(e){this.manual=e;const t=this.node;t&&(t.manual=e)}setOpened(e){this.opened=e;const t=this.node;t&&(t.opened=e)}setPosition(e){this.position=e;const t=this.node;t&&(t._position=e)}setShouldShow(e){this.shouldShow=e;const t=this.node;t&&(t.shouldShow=e)}setTarget(e){this.target=e;const t=this.node;t&&(t.target=e)}}const Ih=Dn((e=>class extends e{static get properties(){return{disabled:{type:Boolean,value:!1,observer:"_disabledChanged",reflectToAttribute:!0}}}_disabledChanged(e){this._setAriaDisabled(e)}_setAriaDisabled(e){e?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}click(){this.disabled||super.click()}})),Hh=!1,Uh=e=>e,Rh="string"==typeof document.head.style.touchAction,Fh="__polymerGestures",Jh="__polymerGesturesHandled",Lh="__polymerGesturesTouchAction",Bh=["mousedown","mousemove","mouseup","click"],Qh=[0,1,4,2],$h=function(){try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(e){return!1}}();function qh(e){return Bh.indexOf(e)>-1}let em=!1;function tm(e){if(!qh(e)&&"touchend"!==e)return Rh&&em&&Hh?{passive:!0}:void 0}!function(){try{const e=Object.defineProperty({},"passive",{get(){em=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}();const im=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/u),om={button:!0,command:!0,fieldset:!0,input:!0,keygen:!0,optgroup:!0,option:!0,select:!0,textarea:!0};function nm(e){const t=e.type;if(!qh(t))return!1;if("mousemove"===t){let t=void 0===e.buttons?1:e.buttons;return e instanceof window.MouseEvent&&!$h&&(t=Qh[e.which]||0),Boolean(1&t)}return 0===(void 0===e.button?0:e.button)}const sm={mouse:{target:null,mouseIgnoreJob:null},touch:{x:0,y:0,id:-1,scrollDecided:!1}};function rm(e,t,i){e.movefn=t,e.upfn=i,document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}function am(e){document.removeEventListener("mousemove",e.movefn),document.removeEventListener("mouseup",e.upfn),e.movefn=null,e.upfn=null}const lm=window.ShadyDOM&&window.ShadyDOM.noPatch?window.ShadyDOM.composedPath:e=>e.composedPath&&e.composedPath()||[],hm={},mm=[];function cm(e){const t=lm(e);return t.length>0?t[0]:e.target}function dm(e){const t=e.type,i=e.currentTarget[Fh];if(!i)return;const o=i[t];if(!o)return;if(!e[Jh]&&(e[Jh]={},t.startsWith("touch"))){const i=e.changedTouches[0];if("touchstart"===t&&1===e.touches.length&&(sm.touch.id=i.identifier),sm.touch.id!==i.identifier)return;Rh||"touchstart"!==t&&"touchmove"!==t||function(e){const t=e.changedTouches[0],i=e.type;if("touchstart"===i)sm.touch.x=t.clientX,sm.touch.y=t.clientY,sm.touch.scrollDecided=!1;else if("touchmove"===i){if(sm.touch.scrollDecided)return;sm.touch.scrollDecided=!0;const i=function(e){let t="auto";const i=lm(e);for(let e,o=0;on:"pan-y"===i&&(o=n>s)),o?e.preventDefault():wm("track")}}(e)}const n=e[Jh];if(!n.skip){for(let t,i=0;i-1&&t.reset&&t.reset();for(let i,s=0;s{e.style.touchAction=t}));e[Lh]=t}(e,o.touchAction)}(e,t,i),!0)}function jm(e){mm.push(e),e.emits.forEach((t=>{hm[t]=e}))}function Pm(e,t,i){const o=new Event(t,{bubbles:!0,cancelable:!0,composed:!0});if(o.detail=i,Uh(e).dispatchEvent(o),o.defaultPrevented){const e=i.preventer||i.sourceEvent;e&&e.preventDefault&&e.preventDefault()}}function wm(e){const t=function(e){for(let t,i=0;iwm(e)})}function fm(e,t,i){if(e.prevent)return!1;if(e.started)return!0;const o=Math.abs(e.x-t),n=Math.abs(e.y-i);return o>=5||n>=5}function Mm(e,t,i){if(!t)return;const o=e.moves[e.moves.length-2],n=e.moves[e.moves.length-1],s=n.x-e.x,r=n.y-e.y;let a,l=0;o&&(a=n.x-o.x,l=n.y-o.y),Pm(t,"track",{state:e.state,x:i.clientX,y:i.clientY,dx:s,dy:r,ddx:a,ddy:l,sourceEvent:i,hover:()=>function(e,t){let i=document.elementFromPoint(e,t),o=i;for(;o&&o.shadowRoot&&!window.ShadyDOM;){const n=o;if(o=o.shadowRoot.elementFromPoint(e,t),n===o)break;o&&(i=o)}return i}(i.clientX,i.clientY)})}function Zm(e,t,i){const o=Math.abs(t.clientX-e.x),n=Math.abs(t.clientY-e.y),s=cm(i||t);!s||om[s.localName]&&s.hasAttribute("disabled")||(isNaN(o)||isNaN(n)||o<=25&&n<=25||function(e){if("click"===e.type){if(0===e.detail)return!0;const t=cm(e);if(!t.nodeType||t.nodeType!==Node.ELEMENT_NODE)return!0;const i=t.getBoundingClientRect(),o=e.pageX,n=e.pageY;return!(o>=i.left&&o<=i.right&&n>=i.top&&n<=i.bottom)}return!1}(t))&&(e.prevent||Pm(s,"tap",{x:t.clientX,y:t.clientY,sourceEvent:t,preventer:i}))}jm({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset(){am(this.info)},mousedown(e){if(!nm(e))return;const t=cm(e),i=this;rm(this.info,(e=>{nm(e)||(um("up",t,e),am(i.info))}),(e=>{nm(e)&&um("up",t,e),am(i.info)})),um("down",t,e)},touchstart(e){um("down",cm(e),e.changedTouches[0],e)},touchend(e){um("up",cm(e),e.changedTouches[0],e)}}),jm({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:!1,moves:[],addMove(e){this.moves.length>2&&this.moves.shift(),this.moves.push(e)},movefn:null,upfn:null,prevent:!1},reset(){this.info.state="start",this.info.started=!1,this.info.moves=[],this.info.x=0,this.info.y=0,this.info.prevent=!1,am(this.info)},mousedown(e){if(!nm(e))return;const t=cm(e),i=this,o=e=>{const o=e.clientX,n=e.clientY;fm(i.info,o,n)&&(i.info.state=i.info.started?"mouseup"===e.type?"end":"track":"start","start"===i.info.state&&wm("tap"),i.info.addMove({x:o,y:n}),nm(e)||(i.info.state="end",am(i.info)),t&&Mm(i.info,t,e),i.info.started=!0)};rm(this.info,o,(e=>{i.info.started&&o(e),am(i.info)})),this.info.x=e.clientX,this.info.y=e.clientY},touchstart(e){const t=e.changedTouches[0];this.info.x=t.clientX,this.info.y=t.clientY},touchmove(e){const t=cm(e),i=e.changedTouches[0],o=i.clientX,n=i.clientY;fm(this.info,o,n)&&("start"===this.info.state&&wm("tap"),this.info.addMove({x:o,y:n}),Mm(this.info,t,i),this.info.state="track",this.info.started=!0)},touchend(e){const t=cm(e),i=e.changedTouches[0];this.info.started&&(this.info.state="end",this.info.addMove({x:i.clientX,y:i.clientY}),Mm(this.info,t,i))}}),jm({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:!1},reset(){this.info.x=NaN,this.info.y=NaN,this.info.prevent=!1},mousedown(e){nm(e)&&(this.info.x=e.clientX,this.info.y=e.clientY)},click(e){nm(e)&&Zm(this.info,e)},touchstart(e){const t=e.changedTouches[0];this.info.x=t.clientX,this.info.y=t.clientY},touchend(e){Zm(this.info,e.changedTouches[0],e)}});const Km=Dn((e=>class extends e{ready(){super.ready(),this.addEventListener("keydown",(e=>{this._onKeyDown(e)})),this.addEventListener("keyup",(e=>{this._onKeyUp(e)}))}_onKeyDown(e){switch(e.key){case"Enter":this._onEnter(e);break;case"Escape":this._onEscape(e)}}_onKeyUp(e){}_onEnter(e){}_onEscape(e){}})),ym=e=>class extends(Ih(Km(e))){get _activeKeys(){return[" "]}ready(){super.ready(),pm(this,"down",(e=>{this._shouldSetActive(e)&&this._setActive(!0)})),pm(this,"up",(()=>{this._setActive(!1)}))}disconnectedCallback(){super.disconnectedCallback(),this._setActive(!1)}_shouldSetActive(e){return!this.disabled}_onKeyDown(e){super._onKeyDown(e),this._shouldSetActive(e)&&this._activeKeys.includes(e.key)&&(this._setActive(!0),document.addEventListener("keyup",(e=>{this._activeKeys.includes(e.key)&&this._setActive(!1)}),{once:!0}))}_setActive(e){this.toggleAttribute("active",e)}};let gm=!1;function Dm(){return gm}function xm(e,t){const i=Math.max(e.tabIndex,0),o=Math.max(t.tabIndex,0);return 0===i||0===o?o>i:i>o}function bm(e){const t=e.length;if(t<2)return e;const i=Math.ceil(t/2);return function(e,t){const i=[];for(;e.length>0&&t.length>0;)xm(e[0],t[0])?i.push(t.shift()):i.push(e.shift());return i.concat(e,t)}(bm(e.slice(0,i)),bm(e.slice(i)))}function vm(e){return e.getRootNode().activeElement===e}function Ym(e,t){if(e.nodeType!==Node.ELEMENT_NODE||function(e){const t=e.style;if("hidden"===t.visibility||"none"===t.display)return!0;const i=window.getComputedStyle(e);return"hidden"===i.visibility||"none"===i.display}(e))return!1;const i=e,o=function(e){if(!function(e){return!e.matches('[tabindex="-1"]')&&(e.matches("input, select, textarea, button, object")?e.matches(":not([disabled])"):e.matches("a[href], area[href], iframe, [tabindex], [contentEditable]"))}(e))return-1;const t=e.getAttribute("tabindex")||0;return Number(t)}(i);let n=o>0;o>=0&&t.push(i);let s=[];return s="slot"===i.localName?i.assignedNodes({flatten:!0}):(i.shadowRoot||i).children,[...s].forEach((e=>{n=Ym(e,t)||n})),n}window.addEventListener("keydown",(()=>{gm=!0}),{capture:!0}),window.addEventListener("mousedown",(()=>{gm=!1}),{capture:!0});const Sm=Dn((e=>class extends e{get _keyboardActive(){return Dm()}ready(){this.addEventListener("focusin",(e=>{this._shouldSetFocus(e)&&this._setFocused(!0)})),this.addEventListener("focusout",(e=>{this._shouldRemoveFocus(e)&&this._setFocused(!1)})),super.ready()}disconnectedCallback(){super.disconnectedCallback(),this.hasAttribute("focused")&&this._setFocused(!1)}_setFocused(e){this.toggleAttribute("focused",e),this.toggleAttribute("focus-ring",e&&this._keyboardActive)}_shouldSetFocus(e){return!0}_shouldRemoveFocus(e){return!0}})),Tm=e=>class extends(Ih(e)){static get properties(){return{tabindex:{type:Number,reflectToAttribute:!0,observer:"_tabindexChanged"},_lastTabIndex:{type:Number}}}_disabledChanged(e,t){super._disabledChanged(e,t),e?(void 0!==this.tabindex&&(this._lastTabIndex=this.tabindex),this.tabindex=-1):t&&(this.tabindex=this._lastTabIndex)}_tabindexChanged(e){this.disabled&&-1!==e&&(this._lastTabIndex=e,this.tabindex=-1)}},Xm=Dn((e=>class extends(Sm(Tm(e))){static get properties(){return{autofocus:{type:Boolean},focusElement:{type:Object,readOnly:!0,observer:"_focusElementChanged"},_lastTabIndex:{value:0}}}constructor(){super(),this._boundOnBlur=this._onBlur.bind(this),this._boundOnFocus=this._onFocus.bind(this)}ready(){super.ready(),this.autofocus&&!this.disabled&&requestAnimationFrame((()=>{this.focus(),this.setAttribute("focus-ring","")}))}focus(){this.focusElement&&!this.disabled&&(this.focusElement.focus(),this._setFocused(!0))}blur(){this.focusElement&&(this.focusElement.blur(),this._setFocused(!1))}click(){this.focusElement&&!this.disabled&&this.focusElement.click()}_focusElementChanged(e,t){e?(e.disabled=this.disabled,this._addFocusListeners(e),this.__forwardTabIndex(this.tabindex)):t&&this._removeFocusListeners(t)}_addFocusListeners(e){e.addEventListener("blur",this._boundOnBlur),e.addEventListener("focus",this._boundOnFocus)}_removeFocusListeners(e){e.removeEventListener("blur",this._boundOnBlur),e.removeEventListener("focus",this._boundOnFocus)}_onFocus(e){e.stopPropagation(),this.dispatchEvent(new Event("focus"))}_onBlur(e){e.stopPropagation(),this.dispatchEvent(new Event("blur"))}_shouldSetFocus(e){return e.target===this.focusElement}_disabledChanged(e,t){super._disabledChanged(e,t),this.focusElement&&(this.focusElement.disabled=e),e&&this.blur()}_tabindexChanged(e){this.__forwardTabIndex(e)}__forwardTabIndex(e){void 0!==e&&this.focusElement&&(this.focusElement.tabIndex=e,-1!==e&&(this.tabindex=void 0)),this.disabled&&e&&(-1!==e&&(this._lastTabIndex=e),this.tabindex=void 0)}})),Em=Dn((e=>class extends e{static get properties(){return{stateTarget:{type:Object,observer:"_stateTargetChanged"}}}static get delegateAttrs(){return[]}static get delegateProps(){return[]}ready(){super.ready(),this._createDelegateAttrsObserver(),this._createDelegatePropsObserver()}_stateTargetChanged(e){e&&(this._ensureAttrsDelegated(),this._ensurePropsDelegated())}_createDelegateAttrsObserver(){this._createMethodObserver(`_delegateAttrsChanged(${this.constructor.delegateAttrs.join(", ")})`)}_createDelegatePropsObserver(){this._createMethodObserver(`_delegatePropsChanged(${this.constructor.delegateProps.join(", ")})`)}_ensureAttrsDelegated(){this.constructor.delegateAttrs.forEach((e=>{this._delegateAttribute(e,this[e])}))}_ensurePropsDelegated(){this.constructor.delegateProps.forEach((e=>{this._delegateProperty(e,this[e])}))}_delegateAttrsChanged(...e){this.constructor.delegateAttrs.forEach(((t,i)=>{this._delegateAttribute(t,e[i])}))}_delegatePropsChanged(...e){this.constructor.delegateProps.forEach(((t,i)=>{this._delegateProperty(t,e[i])}))}_delegateAttribute(e,t){this.stateTarget&&("invalid"===e&&this._delegateAttribute("aria-invalid",!!t&&"true"),"boolean"==typeof t?this.stateTarget.toggleAttribute(e,t):t?this.stateTarget.setAttribute(e,t):this.stateTarget.removeAttribute(e))}_delegateProperty(e,t){this.stateTarget&&(this.stateTarget[e]=t)}})),km=Dn((e=>class extends e{static get properties(){return{inputElement:{type:Object,readOnly:!0,observer:"_inputElementChanged"},type:{type:String,readOnly:!0},value:{type:String,value:"",observer:"_valueChanged",notify:!0},_hasInputValue:{type:Boolean,value:!1,observer:"_hasInputValueChanged"}}}constructor(){super(),this._boundOnInput=this.__onInput.bind(this),this._boundOnChange=this._onChange.bind(this)}get _hasValue(){return null!=this.value&&""!==this.value}get _inputElementValueProperty(){return"value"}get _inputElementValue(){return this.inputElement?this.inputElement[this._inputElementValueProperty]:void 0}set _inputElementValue(e){this.inputElement&&(this.inputElement[this._inputElementValueProperty]=e)}clear(){this._hasInputValue=!1,this.value="",this._inputElementValue=""}_addInputListeners(e){e.addEventListener("input",this._boundOnInput),e.addEventListener("change",this._boundOnChange)}_removeInputListeners(e){e.removeEventListener("input",this._boundOnInput),e.removeEventListener("change",this._boundOnChange)}_forwardInputValue(e){this.inputElement&&(this._inputElementValue=null!=e?e:"")}_inputElementChanged(e,t){e?this._addInputListeners(e):t&&this._removeInputListeners(t)}_hasInputValueChanged(e,t){(e||t)&&this.dispatchEvent(new CustomEvent("has-input-value-changed"))}__onInput(e){this._setHasInputValue(e),this._onInput(e)}_onInput(e){const t=e.composedPath()[0];this.__userInput=e.isTrusted,this.value=t.value,this.__userInput=!1}_onChange(e){}_toggleHasValue(e){this.toggleAttribute("has-value",e)}_valueChanged(e,t){this._toggleHasValue(this._hasValue),""===e&&void 0===t||this.__userInput||this._forwardInputValue(e)}_setHasInputValue(e){const t=e.composedPath()[0];this._hasInputValue=t.value.length>0}})),zm=Dn((e=>class extends(Em(Ih(km(e)))){static get properties(){return{checked:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0}}}static get delegateProps(){return[...super.delegateProps,"checked"]}_onChange(e){const t=e.target;this._toggleChecked(t.checked),vm(t)||t.focus()}_toggleChecked(e){this.checked=e}}));class Gm extends Wh{constructor(e,t){super(e,"input","input",{initializer:(e,i)=>{i.value&&e.setAttribute("value",i.value),i.type&&e.setAttribute("type",i.type),e.id=this.defaultId,"function"==typeof t&&t(e)},useUniqueId:!0})}}const Am=Dn((e=>class extends e{constructor(){super(),this.__controllers=new Set}connectedCallback(){super.connectedCallback(),this.__controllers.forEach((e=>{e.hostConnected&&e.hostConnected()}))}disconnectedCallback(){super.disconnectedCallback(),this.__controllers.forEach((e=>{e.hostDisconnected&&e.hostDisconnected()}))}addController(e){this.__controllers.add(e),void 0!==this.$&&this.isConnected&&e.hostConnected&&e.hostConnected()}removeController(e){this.__controllers.delete(e)}}));class Om extends Wh{constructor(e,t,i,o={}){super(e,t,i,{...o,useUniqueId:!0})}initCustomNode(e){this.__updateNodeId(e),this.__notifyChange(e)}teardownNode(e){const t=this.getSlotChild();t&&t!==this.defaultNode?this.__notifyChange(t):(this.restoreDefaultNode(),this.updateDefaultNode(this.node))}attachDefaultNode(){const e=super.attachDefaultNode();return e&&this.__updateNodeId(e),e}restoreDefaultNode(){}updateDefaultNode(e){this.__notifyChange(e)}observeNode(e){this.__nodeObserver&&this.__nodeObserver.disconnect(),this.__nodeObserver=new MutationObserver((e=>{e.forEach((e=>{const t=e.target,i=t===this.node;"attributes"===e.type?i&&this.__updateNodeId(t):(i||t.parentElement===this.node)&&this.__notifyChange(this.node)}))})),this.__nodeObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0,subtree:!0,characterData:!0})}__hasContent(e){return!!e&&(e.nodeType===Node.ELEMENT_NODE&&(customElements.get(e.localName)||e.children.length>0)||e.textContent&&""!==e.textContent.trim())}__notifyChange(e){this.dispatchEvent(new CustomEvent("slot-content-changed",{detail:{hasContent:this.__hasContent(e),node:e}}))}__updateNodeId(e){const t=!this.nodes||e===this.nodes[0];e.nodeType===Node.ELEMENT_NODE&&t&&!e.id&&(e.id=this.defaultId)}}class Cm extends Om{constructor(e){super(e,"label","label")}setLabel(e){this.label=e;this.getSlotChild()||this.restoreDefaultNode(),this.node===this.defaultNode&&this.updateDefaultNode(this.node)}restoreDefaultNode(){const{label:e}=this;if(e&&""!==e.trim()){const e=this.attachDefaultNode();this.observeNode(e)}}updateDefaultNode(e){e&&(e.textContent=this.label),super.updateDefaultNode(e)}initCustomNode(e){super.initCustomNode(e),this.observeNode(e)}}const Nm=Dn((e=>class extends(Am(e)){static get properties(){return{label:{type:String,observer:"_labelChanged"}}}constructor(){super(),this._labelController=new Cm(this),this._labelController.addEventListener("slot-content-changed",(e=>{this.toggleAttribute("has-label",e.detail.hasContent)}))}get _labelId(){const e=this._labelNode;return e&&e.id}get _labelNode(){return this._labelController.node}ready(){super.ready(),this.addController(this._labelController)}_labelChanged(e){this._labelController.setLabel(e)}}));class Vm{constructor(e,t){this.input=e,this.__preventDuplicateLabelClick=this.__preventDuplicateLabelClick.bind(this),t.addEventListener("slot-content-changed",(e=>{this.__initLabel(e.detail.node)})),this.__initLabel(t.node)}__initLabel(e){e&&(e.addEventListener("click",this.__preventDuplicateLabelClick),this.input&&e.setAttribute("for",this.input.id))}__preventDuplicateLabelClick(){const e=t=>{t.stopImmediatePropagation(),this.input.removeEventListener("click",e)};this.input.addEventListener("click",e)}}const Wm=e=>class extends(Nm(zm(Xm(ym(e))))){static get properties(){return{indeterminate:{type:Boolean,notify:!0,value:!1,reflectToAttribute:!0},name:{type:String,value:""}}}static get delegateProps(){return[...super.delegateProps,"indeterminate"]}static get delegateAttrs(){return[...super.delegateAttrs,"name"]}constructor(){super(),this._setType("checkbox"),this.value="on"}ready(){super.ready(),this.addController(new Gm(this,(e=>{this._setInputElement(e),this._setFocusElement(e),this.stateTarget=e,this.ariaTarget=e}))),this.addController(new Vm(this.inputElement,this._labelController))}_shouldSetActive(e){return"a"!==e.target.localName&&super._shouldSetActive(e)}_toggleChecked(e){this.indeterminate&&(this.indeterminate=!1),super._toggleChecked(e)}};Hl("vaadin-checkbox",s`
- :host {
- display: inline-block;
- }
-
- :host([hidden]) {
- display: none !important;
- }
-
- :host([disabled]) {
- -webkit-tap-highlight-color: transparent;
- }
-
- .vaadin-checkbox-container {
- display: grid;
- grid-template-columns: auto 1fr;
- align-items: baseline;
- }
-
- [part='checkbox'],
- ::slotted(input),
- ::slotted(label) {
- grid-row: 1;
- }
-
- [part='checkbox'],
- ::slotted(input) {
- grid-column: 1;
- }
-
- [part='checkbox'] {
- width: var(--vaadin-checkbox-size, 1em);
- height: var(--vaadin-checkbox-size, 1em);
- }
-
- [part='checkbox']::before {
- display: block;
- content: '\\202F';
- line-height: var(--vaadin-checkbox-size, 1em);
- contain: paint;
- }
-
- /* visually hidden */
- ::slotted(input) {
- opacity: 0;
- cursor: inherit;
- margin: 0;
- align-self: stretch;
- -webkit-appearance: none;
- }
-`,{moduleId:"vaadin-checkbox-styles"});let _m=class extends(Wm(zh(Ll(Dl)))){static get is(){return"vaadin-checkbox"}static get template(){return yl`
-
- `}ready(){super.ready(),this._tooltipController=new _h(this),this.addController(this._tooltipController)}};function Im(e){window.Vaadin&&window.Vaadin.templateRendererCallback?window.Vaadin.templateRendererCallback(e):e.querySelector("template")&&console.warn(`WARNING: inside <${e.localName}> is no longer supported. Import @vaadin/polymer-legacy-adapter/template-renderer.js to enable compatibility.`)}function Hm(e){return Array.from(e.querySelectorAll('[part~="cell"]:not([part~="details-cell"])'))}function Um(e,t){[...e.children].forEach(t)}function Rm(e,t,i){switch(typeof i){case"boolean":e.toggleAttribute(t,i);break;case"string":e.setAttribute(t,i);break;default:e.removeAttribute(t)}}function Fm(e,t,i){t||""===t?Oh(e,"part",i):Ch(e,"part",i)}function Jm(e,t,i){e.forEach((e=>{Fm(e,i,t)}))}function Lm(e,t){const i=Hm(e);Object.entries(t).forEach((([t,o])=>{Rm(e,t,o);const n=`${t}-row`;Fm(e,o,n),Jm(i,`${n}-cell`,o)}))}function Bm(e,t){const i=Hm(e);Object.entries(t).forEach((([t,o])=>{const n=e.getAttribute(t);if(Rm(e,t,o),n){const o=`${t}-${n}-row`;Fm(e,!1,o),Jm(i,`${o}-cell`,!1)}if(o){const n=`${t}-${o}-row`;Fm(e,o,n),Jm(i,`${n}-cell`,o)}}))}function Qm(e,t,i,o,n){Rm(e,t,i),n&&Fm(e,!1,n),Fm(e,i,o||`${t}-cell`)}customElements.define(_m.is,_m),Hl("vaadin-grid",s`
- :host {
- font-family: var(--lumo-font-family);
- font-size: var(--lumo-font-size-m);
- line-height: var(--lumo-line-height-s);
- color: var(--lumo-body-text-color);
- background-color: var(--lumo-base-color);
- box-sizing: border-box;
- -webkit-text-size-adjust: 100%;
- -webkit-tap-highlight-color: transparent;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-
- /* For internal use only */
- --_lumo-grid-border-color: var(--lumo-contrast-20pct);
- --_lumo-grid-secondary-border-color: var(--lumo-contrast-10pct);
- --_lumo-grid-border-width: 1px;
- --_lumo-grid-selected-row-color: var(--lumo-primary-color-10pct);
- }
-
- /* No (outer) border */
-
- :host(:not([theme~='no-border'])) {
- border: var(--_lumo-grid-border-width) solid var(--_lumo-grid-border-color);
- }
-
- :host([disabled]) {
- opacity: 0.7;
- }
-
- /* Cell styles */
-
- [part~='cell'] {
- min-height: var(--lumo-size-m);
- background-color: var(--lumo-base-color);
- }
-
- [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- cursor: default;
- padding: var(--lumo-space-xs) var(--lumo-space-m);
- }
-
- /* Apply row borders by default and introduce the "no-row-borders" variant */
- :host(:not([theme~='no-row-borders'])) [part~='cell']:not([part~='details-cell']) {
- border-top: var(--_lumo-grid-border-width) solid var(--_lumo-grid-secondary-border-color);
- }
-
- /* Hide first body row top border */
- :host(:not([theme~='no-row-borders'])) [part~='first-row'] [part~='cell']:not([part~='details-cell']) {
- border-top: 0;
- min-height: calc(var(--lumo-size-m) - var(--_lumo-grid-border-width));
- }
-
- /* Focus-ring */
-
- [part~='row'] {
- position: relative;
- }
-
- [part~='row']:focus,
- [part~='focused-cell']:focus {
- outline: none;
- }
-
- :host([navigating]) [part~='row']:focus::before,
- :host([navigating]) [part~='focused-cell']:focus::before {
- content: '';
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- pointer-events: none;
- box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
- }
-
- :host([navigating]) [part~='row']:focus::before {
- transform: translateX(calc(-1 * var(--_grid-horizontal-scroll-position)));
- z-index: 3;
- }
-
- /* Drag and Drop styles */
- :host([dragover])::after {
- content: '';
- position: absolute;
- z-index: 100;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- pointer-events: none;
- box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct);
- }
-
- [part~='row'][dragover] {
- z-index: 100 !important;
- }
-
- [part~='row'][dragover] [part~='cell'] {
- overflow: visible;
- }
-
- [part~='row'][dragover] [part~='cell']::after {
- content: '';
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- height: calc(var(--_lumo-grid-border-width) + 2px);
- pointer-events: none;
- background: var(--lumo-primary-color-50pct);
- }
-
- [part~='row'][dragover] [part~='cell'][last-frozen]::after {
- right: -1px;
- }
-
- :host([theme~='no-row-borders']) [dragover] [part~='cell']::after {
- height: 2px;
- }
-
- [part~='row'][dragover='below'] [part~='cell']::after {
- top: 100%;
- bottom: auto;
- margin-top: -1px;
- }
-
- :host([all-rows-visible]) [part~='last-row'][dragover='below'] [part~='cell']::after {
- height: 1px;
- }
-
- [part~='row'][dragover='above'] [part~='cell']::after {
- top: auto;
- bottom: 100%;
- margin-bottom: -1px;
- }
-
- [part~='row'][details-opened][dragover='below'] [part~='cell']:not([part~='details-cell'])::after,
- [part~='row'][details-opened][dragover='above'] [part~='details-cell']::after {
- display: none;
- }
-
- [part~='row'][dragover][dragover='on-top'] [part~='cell']::after {
- height: 100%;
- opacity: 0.5;
- }
-
- [part~='row'][dragstart] [part~='cell'] {
- border: none !important;
- box-shadow: none !important;
- }
-
- [part~='row'][dragstart] [part~='cell'][last-column] {
- border-radius: 0 var(--lumo-border-radius-s) var(--lumo-border-radius-s) 0;
- }
-
- [part~='row'][dragstart] [part~='cell'][first-column] {
- border-radius: var(--lumo-border-radius-s) 0 0 var(--lumo-border-radius-s);
- }
-
- #scroller [part~='row'][dragstart]:not([dragstart=''])::after {
- display: block;
- position: absolute;
- left: var(--_grid-drag-start-x);
- top: var(--_grid-drag-start-y);
- z-index: 100;
- content: attr(dragstart);
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
- padding: calc(var(--lumo-space-xs) * 0.8);
- color: var(--lumo-error-contrast-color);
- background-color: var(--lumo-error-color);
- border-radius: var(--lumo-border-radius-m);
- font-family: var(--lumo-font-family);
- font-size: var(--lumo-font-size-xxs);
- line-height: 1;
- font-weight: 500;
- text-transform: initial;
- letter-spacing: initial;
- min-width: calc(var(--lumo-size-s) * 0.7);
- text-align: center;
- }
-
- /* Headers and footers */
-
- [part~='header-cell'] ::slotted(vaadin-grid-cell-content),
- [part~='footer-cell'] ::slotted(vaadin-grid-cell-content),
- [part~='reorder-ghost'] {
- font-size: var(--lumo-font-size-s);
- font-weight: 500;
- }
-
- [part~='footer-cell'] ::slotted(vaadin-grid-cell-content) {
- font-weight: 400;
- }
-
- [part~='row']:only-child [part~='header-cell'] {
- min-height: var(--lumo-size-xl);
- }
-
- /* Header borders */
-
- /* Hide first header row top border */
- :host(:not([theme~='no-row-borders'])) [part~='row']:first-child [part~='header-cell'] {
- border-top: 0;
- }
-
- [part~='row']:last-child [part~='header-cell'] {
- border-bottom: var(--_lumo-grid-border-width) solid transparent;
- }
-
- :host(:not([theme~='no-row-borders'])) [part~='row']:last-child [part~='header-cell'] {
- border-bottom-color: var(--_lumo-grid-secondary-border-color);
- }
-
- /* Overflow uses a stronger border color */
- :host([overflow~='top']) [part~='row']:last-child [part~='header-cell'] {
- border-bottom-color: var(--_lumo-grid-border-color);
- }
-
- /* Footer borders */
-
- [part~='row']:first-child [part~='footer-cell'] {
- border-top: var(--_lumo-grid-border-width) solid transparent;
- }
-
- :host(:not([theme~='no-row-borders'])) [part~='row']:first-child [part~='footer-cell'] {
- border-top-color: var(--_lumo-grid-secondary-border-color);
- }
-
- /* Overflow uses a stronger border color */
- :host([overflow~='bottom']) [part~='row']:first-child [part~='footer-cell'] {
- border-top-color: var(--_lumo-grid-border-color);
- }
-
- /* Column reordering */
-
- :host([reordering]) [part~='cell'] {
- background: linear-gradient(var(--lumo-shade-20pct), var(--lumo-shade-20pct)) var(--lumo-base-color);
- }
-
- :host([reordering]) [part~='cell'][reorder-status='allowed'] {
- background: var(--lumo-base-color);
- }
-
- :host([reordering]) [part~='cell'][reorder-status='dragging'] {
- background: linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct)) var(--lumo-base-color);
- }
-
- [part~='reorder-ghost'] {
- opacity: 0.85;
- box-shadow: var(--lumo-box-shadow-s);
- /* TODO Use the same styles as for the cell element (reorder-ghost copies styles from the cell element) */
- padding: var(--lumo-space-s) var(--lumo-space-m) !important;
- }
-
- /* Column resizing */
-
- [part='resize-handle'] {
- width: 3px;
- background-color: var(--lumo-primary-color-50pct);
- opacity: 0;
- transition: opacity 0.2s;
- }
-
- :host(:not([reordering])) *:not([column-resizing]) [part~='cell']:hover [part='resize-handle'],
- [part='resize-handle']:active {
- opacity: 1;
- transition-delay: 0.15s;
- }
-
- /* Column borders */
-
- :host([theme~='column-borders']) [part~='cell']:not([last-column]):not([part~='details-cell']) {
- border-right: var(--_lumo-grid-border-width) solid var(--_lumo-grid-secondary-border-color);
- }
-
- /* Frozen columns */
-
- [last-frozen] {
- border-right: var(--_lumo-grid-border-width) solid transparent;
- overflow: hidden;
- }
-
- :host([overflow~='start']) [part~='cell'][last-frozen]:not([part~='details-cell']) {
- border-right-color: var(--_lumo-grid-border-color);
- }
-
- [first-frozen-to-end] {
- border-left: var(--_lumo-grid-border-width) solid transparent;
- }
-
- :host([overflow~='end']) [part~='cell'][first-frozen-to-end]:not([part~='details-cell']) {
- border-left-color: var(--_lumo-grid-border-color);
- }
-
- /* Row stripes */
-
- :host([theme~='row-stripes']) [part~='even-row'] [part~='body-cell'],
- :host([theme~='row-stripes']) [part~='even-row'] [part~='details-cell'] {
- background-image: linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
- background-repeat: repeat-x;
- }
-
- /* Selected row */
-
- /* Raise the selected rows above unselected rows (so that box-shadow can cover unselected rows) */
- :host(:not([reordering])) [part~='row'][selected] {
- z-index: 1;
- }
-
- :host(:not([reordering])) [part~='row'][selected] [part~='body-cell']:not([part~='details-cell']) {
- background-image: linear-gradient(var(--_lumo-grid-selected-row-color), var(--_lumo-grid-selected-row-color));
- background-repeat: repeat;
- }
-
- /* Cover the border of an unselected row */
- :host(:not([theme~='no-row-borders'])) [part~='row'][selected] [part~='cell']:not([part~='details-cell']) {
- box-shadow: 0 var(--_lumo-grid-border-width) 0 0 var(--_lumo-grid-selected-row-color);
- }
-
- /* Compact */
-
- :host([theme~='compact']) [part~='row']:only-child [part~='header-cell'] {
- min-height: var(--lumo-size-m);
- }
-
- :host([theme~='compact']) [part~='cell'] {
- min-height: var(--lumo-size-s);
- }
-
- :host([theme~='compact']) [part~='first-row'] [part~='cell']:not([part~='details-cell']) {
- min-height: calc(var(--lumo-size-s) - var(--_lumo-grid-border-width));
- }
-
- :host([theme~='compact']) [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- padding: var(--lumo-space-xs) var(--lumo-space-s);
- }
-
- /* Wrap cell contents */
-
- :host([theme~='wrap-cell-content']) [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- white-space: normal;
- }
-
- /* RTL specific styles */
-
- :host([dir='rtl']) [part~='row'][dragstart] [part~='cell'][last-column] {
- border-radius: var(--lumo-border-radius-s) 0 0 var(--lumo-border-radius-s);
- }
-
- :host([dir='rtl']) [part~='row'][dragstart] [part~='cell'][first-column] {
- border-radius: 0 var(--lumo-border-radius-s) var(--lumo-border-radius-s) 0;
- }
-
- :host([dir='rtl'][theme~='column-borders']) [part~='cell']:not([last-column]):not([part~='details-cell']) {
- border-right: none;
- border-left: var(--_lumo-grid-border-width) solid var(--_lumo-grid-secondary-border-color);
- }
-
- :host([dir='rtl']) [last-frozen] {
- border-right: none;
- border-left: var(--_lumo-grid-border-width) solid transparent;
- }
-
- :host([dir='rtl']) [first-frozen-to-end] {
- border-left: none;
- border-right: var(--_lumo-grid-border-width) solid transparent;
- }
-
- :host([dir='rtl'][overflow~='start']) [part~='cell'][last-frozen]:not([part~='details-cell']) {
- border-left-color: var(--_lumo-grid-border-color);
- }
-
- :host([dir='rtl'][overflow~='end']) [part~='cell'][first-frozen-to-end]:not([part~='details-cell']) {
- border-right-color: var(--_lumo-grid-border-color);
- }
- `,{moduleId:"lumo-grid"});const $m=e=>class extends e{static get properties(){return{resizable:{type:Boolean,value(){if("vaadin-grid-column-group"===this.localName)return;const e=this.parentNode;return e&&"vaadin-grid-column-group"===e.localName&&e.resizable||!1}},frozen:{type:Boolean,value:!1},frozenToEnd:{type:Boolean,value:!1},hidden:{type:Boolean,value:!1},header:{type:String},textAlign:{type:String},_lastFrozen:{type:Boolean,value:!1},_firstFrozenToEnd:{type:Boolean,value:!1},_order:Number,_reorderStatus:Boolean,_emptyCells:Array,_headerCell:Object,_footerCell:Object,_grid:Object,__initialized:{type:Boolean,value:!0},headerRenderer:Function,_headerRenderer:{type:Function,computed:"_computeHeaderRenderer(headerRenderer, header, __initialized)"},footerRenderer:Function,_footerRenderer:{type:Function,computed:"_computeFooterRenderer(footerRenderer, __initialized)"},__gridColumnElement:{type:Boolean,value:!0}}}static get observers(){return["_widthChanged(width, _headerCell, _footerCell, _cells.*)","_frozenChanged(frozen, _headerCell, _footerCell, _cells.*)","_frozenToEndChanged(frozenToEnd, _headerCell, _footerCell, _cells.*)","_flexGrowChanged(flexGrow, _headerCell, _footerCell, _cells.*)","_textAlignChanged(textAlign, _cells.*, _headerCell, _footerCell)","_orderChanged(_order, _headerCell, _footerCell, _cells.*)","_lastFrozenChanged(_lastFrozen)","_firstFrozenToEndChanged(_firstFrozenToEnd)","_onRendererOrBindingChanged(_renderer, _cells, _cells.*, path)","_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header)","_onFooterRendererOrBindingChanged(_footerRenderer, _footerCell)","_resizableChanged(resizable, _headerCell)","_reorderStatusChanged(_reorderStatus, _headerCell, _footerCell, _cells.*)","_hiddenChanged(hidden, _headerCell, _footerCell, _cells.*)"]}get _grid(){return this._gridValue||(this._gridValue=this._findHostGrid()),this._gridValue}get _allCells(){return[].concat(this._cells||[]).concat(this._emptyCells||[]).concat(this._headerCell).concat(this._footerCell).filter((e=>e))}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>{this._grid&&this._allCells.forEach((e=>{e._content.parentNode||this._grid.appendChild(e._content)}))}))}disconnectedCallback(){super.disconnectedCallback(),requestAnimationFrame((()=>{this._grid||this._allCells.forEach((e=>{e._content.parentNode&&e._content.parentNode.removeChild(e._content)}))})),this._gridValue=void 0}ready(){super.ready(),Im(this)}_findHostGrid(){let e=this;for(;e&&!/^vaadin.*grid(-pro)?$/u.test(e.localName);)e=e.assignedSlot?e.assignedSlot.parentNode:e.parentNode;return e||void 0}_renderHeaderAndFooter(){this._renderHeaderCellContent(this._headerRenderer,this._headerCell),this._renderFooterCellContent(this._footerRenderer,this._footerCell)}_flexGrowChanged(e){this.parentElement&&this.parentElement._columnPropChanged&&this.parentElement._columnPropChanged("flexGrow"),this._allCells.forEach((t=>{t.style.flexGrow=e}))}_orderChanged(e){this._allCells.forEach((t=>{t.style.order=e}))}_widthChanged(e){this.parentElement&&this.parentElement._columnPropChanged&&this.parentElement._columnPropChanged("width"),this._allCells.forEach((t=>{t.style.width=e}))}_frozenChanged(e){this.parentElement&&this.parentElement._columnPropChanged&&this.parentElement._columnPropChanged("frozen",e),this._allCells.forEach((t=>{Qm(t,"frozen",e)})),this._grid&&this._grid._frozenCellsChanged&&this._grid._frozenCellsChanged()}_frozenToEndChanged(e){this.parentElement&&this.parentElement._columnPropChanged&&this.parentElement._columnPropChanged("frozenToEnd",e),this._allCells.forEach((t=>{this._grid&&t.parentElement===this._grid.$.sizer||Qm(t,"frozen-to-end",e)})),this._grid&&this._grid._frozenCellsChanged&&this._grid._frozenCellsChanged()}_lastFrozenChanged(e){this._allCells.forEach((t=>{Qm(t,"last-frozen",e)})),this.parentElement&&this.parentElement._columnPropChanged&&(this.parentElement._lastFrozen=e)}_firstFrozenToEndChanged(e){this._allCells.forEach((t=>{this._grid&&t.parentElement===this._grid.$.sizer||Qm(t,"first-frozen-to-end",e)})),this.parentElement&&this.parentElement._columnPropChanged&&(this.parentElement._firstFrozenToEnd=e)}_generateHeader(e){return e.substr(e.lastIndexOf(".")+1).replace(/([A-Z])/gu,"-$1").toLowerCase().replace(/-/gu," ").replace(/^./u,(e=>e.toUpperCase()))}_reorderStatusChanged(e){const t=this.__previousReorderStatus,i=t?`reorder-${t}-cell`:"",o=`reorder-${e}-cell`;this._allCells.forEach((t=>{Qm(t,"reorder-status",e,o,i)})),this.__previousReorderStatus=e}_resizableChanged(e,t){void 0!==e&&void 0!==t&&t&&[t].concat(this._emptyCells).forEach((t=>{if(t){const i=t.querySelector('[part~="resize-handle"]');if(i&&t.removeChild(i),e){const e=document.createElement("div");e.setAttribute("part","resize-handle"),t.appendChild(e)}}}))}_textAlignChanged(e){if(void 0===e)return;if(-1===["start","end","center"].indexOf(e))return void console.warn('textAlign can only be set as "start", "end" or "center"');let t;"ltr"===getComputedStyle(this._grid).direction?"start"===e?t="left":"end"===e&&(t="right"):"start"===e?t="right":"end"===e&&(t="left"),this._allCells.forEach((i=>{i._content.style.textAlign=e,getComputedStyle(i._content).textAlign!==e&&(i._content.style.textAlign=t)}))}_hiddenChanged(e){this.parentElement&&this.parentElement._columnPropChanged&&this.parentElement._columnPropChanged("hidden",e),!!e!=!!this._previousHidden&&this._grid&&(!0===e&&this._allCells.forEach((e=>{e._content.parentNode&&e._content.parentNode.removeChild(e._content)})),this._grid._debouncerHiddenChanged=gh.debounce(this._grid._debouncerHiddenChanged,Mh,(()=>{this._grid&&this._grid._renderColumnTree&&this._grid._renderColumnTree(this._grid._columnTree)})),this._grid._debounceUpdateFrozenColumn&&this._grid._debounceUpdateFrozenColumn(),this._grid._resetKeyboardNavigation&&this._grid._resetKeyboardNavigation()),this._previousHidden=e}_runRenderer(e,t,i){const o=[t._content,this];i&&i.item&&o.push(i),e.apply(this,o)}__renderCellsContent(e,t){!this.hidden&&this._grid&&t.forEach((t=>{if(!t.parentElement)return;const i=this._grid.__getRowModel(t.parentElement);e&&(t._renderer!==e&&this._clearCellContent(t),t._renderer=e,(i.item||e===this._headerRenderer||e===this._footerRenderer)&&this._runRenderer(e,t,i))}))}_clearCellContent(e){e._content.innerHTML="",delete e._content._$litPart$}_renderHeaderCellContent(e,t){t&&e&&(this.__renderCellsContent(e,[t]),this._grid&&t.parentElement&&this._grid.__debounceUpdateHeaderFooterRowVisibility(t.parentElement))}_onHeaderRendererOrBindingChanged(e,t,...i){this._renderHeaderCellContent(e,t)}_renderBodyCellsContent(e,t){t&&e&&this.__renderCellsContent(e,t)}_onRendererOrBindingChanged(e,t,...i){this._renderBodyCellsContent(e,t)}_renderFooterCellContent(e,t){t&&e&&(this.__renderCellsContent(e,[t]),this._grid&&t.parentElement&&this._grid.__debounceUpdateHeaderFooterRowVisibility(t.parentElement))}_onFooterRendererOrBindingChanged(e,t){this._renderFooterCellContent(e,t)}__setTextContent(e,t){e.textContent!==t&&(e.textContent=t)}__textHeaderRenderer(){this.__setTextContent(this._headerCell._content,this.header)}_defaultHeaderRenderer(){this.path&&this.__setTextContent(this._headerCell._content,this._generateHeader(this.path))}_defaultRenderer(e,t,{item:i}){this.path&&this.__setTextContent(e,this.get(this.path,i))}_defaultFooterRenderer(){}_computeHeaderRenderer(e,t){return e||(null!=t?this.__textHeaderRenderer:this._defaultHeaderRenderer)}_computeRenderer(e){return e||this._defaultRenderer}_computeFooterRenderer(e){return e||this._defaultFooterRenderer}};class qm extends($m(Xh(Dl))){static get is(){return"vaadin-grid-column"}static get properties(){return{width:{type:String,value:"100px"},flexGrow:{type:Number,value:1},renderer:Function,_renderer:{type:Function,computed:"_computeRenderer(renderer, __initialized)"},path:{type:String},autoWidth:{type:Boolean,value:!1},_focusButtonMode:{type:Boolean,value:!1},_cells:Array}}}customElements.define(qm.is,qm),Hl("vaadin-grid",s`
- @keyframes vaadin-grid-appear {
- to {
- opacity: 1;
- }
- }
-
- :host {
- display: block;
- animation: 1ms vaadin-grid-appear;
- height: 400px;
- flex: 1 1 auto;
- align-self: stretch;
- position: relative;
- }
-
- :host([hidden]) {
- display: none !important;
- }
-
- :host([disabled]) {
- pointer-events: none;
- }
-
- #scroller {
- display: block;
- transform: translateY(0);
- width: auto;
- height: auto;
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- }
-
- :host([all-rows-visible]) {
- height: auto;
- align-self: flex-start;
- flex-grow: 0;
- width: 100%;
- }
-
- :host([all-rows-visible]) #scroller {
- width: 100%;
- height: 100%;
- position: relative;
- }
-
- :host([all-rows-visible]) #items {
- min-height: 1px;
- }
-
- #table {
- display: flex;
- flex-direction: column;
- width: 100%;
- height: 100%;
- overflow: auto;
- position: relative;
- outline: none;
- /* Workaround for a Desktop Safari bug: new stacking context here prevents the scrollbar from getting hidden */
- z-index: 0;
- }
-
- #header,
- #footer {
- display: block;
- position: -webkit-sticky;
- position: sticky;
- left: 0;
- overflow: visible;
- width: 100%;
- z-index: 1;
- }
-
- #header {
- top: 0;
- }
-
- th {
- text-align: inherit;
- }
-
- /* Safari doesn't work with "inherit" */
- [safari] th {
- text-align: initial;
- }
-
- #footer {
- bottom: 0;
- }
-
- #items {
- flex-grow: 1;
- flex-shrink: 0;
- display: block;
- position: -webkit-sticky;
- position: sticky;
- width: 100%;
- left: 0;
- overflow: visible;
- }
-
- [part~='row'] {
- display: flex;
- width: 100%;
- box-sizing: border-box;
- margin: 0;
- }
-
- [part~='row'][loading] [part~='body-cell'] ::slotted(vaadin-grid-cell-content) {
- opacity: 0;
- }
-
- #items [part~='row'] {
- position: absolute;
- }
-
- #items [part~='row']:empty {
- height: 100%;
- }
-
- [part~='cell']:not([part~='details-cell']) {
- flex-shrink: 0;
- flex-grow: 1;
- box-sizing: border-box;
- display: flex;
- width: 100%;
- position: relative;
- align-items: center;
- padding: 0;
- white-space: nowrap;
- }
-
- [part~='cell'] > [tabindex] {
- display: flex;
- align-items: inherit;
- outline: none;
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- }
-
- [part~='details-cell'] {
- position: absolute;
- bottom: 0;
- width: 100%;
- box-sizing: border-box;
- padding: 0;
- }
-
- [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- display: block;
- width: 100%;
- box-sizing: border-box;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- [hidden] {
- display: none !important;
- }
-
- [frozen],
- [frozen-to-end] {
- z-index: 2;
- will-change: transform;
- }
-
- [no-scrollbars][safari] #table,
- [no-scrollbars][firefox] #table {
- overflow: hidden;
- }
-
- /* Reordering styles */
- :host([reordering]) [part~='cell'] ::slotted(vaadin-grid-cell-content),
- :host([reordering]) [part~='resize-handle'],
- #scroller[no-content-pointer-events] [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- pointer-events: none;
- }
-
- [part~='reorder-ghost'] {
- visibility: hidden;
- position: fixed;
- pointer-events: none;
- opacity: 0.5;
-
- /* Prevent overflowing the grid in Firefox */
- top: 0;
- left: 0;
- }
-
- :host([reordering]) {
- -moz-user-select: none;
- -webkit-user-select: none;
- user-select: none;
- }
-
- /* Resizing styles */
- [part~='resize-handle'] {
- position: absolute;
- top: 0;
- right: 0;
- height: 100%;
- cursor: col-resize;
- z-index: 1;
- }
-
- [part~='resize-handle']::before {
- position: absolute;
- content: '';
- height: 100%;
- width: 35px;
- transform: translateX(-50%);
- }
-
- [last-column] [part~='resize-handle']::before,
- [last-frozen] [part~='resize-handle']::before {
- width: 18px;
- transform: none;
- right: 0;
- }
-
- [frozen-to-end] [part~='resize-handle'] {
- left: 0;
- right: auto;
- }
-
- [frozen-to-end] [part~='resize-handle']::before {
- left: 0;
- right: auto;
- }
-
- [first-frozen-to-end] [part~='resize-handle']::before {
- width: 18px;
- transform: none;
- }
-
- [first-frozen-to-end] {
- margin-inline-start: auto;
- }
-
- /* Hide resize handle if scrolled to end */
- :host(:not([overflow~='end'])) [first-frozen-to-end] [part~='resize-handle'] {
- display: none;
- }
-
- #scroller[column-resizing] {
- -ms-user-select: none;
- -moz-user-select: none;
- -webkit-user-select: none;
- user-select: none;
- }
-
- /* Sizer styles */
- #sizer {
- display: flex;
- position: absolute;
- visibility: hidden;
- }
-
- #sizer [part~='details-cell'] {
- display: none !important;
- }
-
- #sizer [part~='cell'][hidden] {
- display: none !important;
- }
-
- #sizer [part~='cell'] {
- display: block;
- flex-shrink: 0;
- line-height: 0;
- height: 0 !important;
- min-height: 0 !important;
- max-height: 0 !important;
- padding: 0 !important;
- border: none !important;
- }
-
- #sizer [part~='cell']::before {
- content: '-';
- }
-
- #sizer [part~='cell'] ::slotted(vaadin-grid-cell-content) {
- display: none !important;
- }
-
- /* RTL specific styles */
-
- :host([dir='rtl']) #items,
- :host([dir='rtl']) #header,
- :host([dir='rtl']) #footer {
- left: auto;
- }
-
- :host([dir='rtl']) [part~='reorder-ghost'] {
- left: auto;
- right: 0;
- }
-
- :host([dir='rtl']) [part~='resize-handle'] {
- left: 0;
- right: auto;
- }
-
- :host([dir='rtl']) [part~='resize-handle']::before {
- transform: translateX(50%);
- }
-
- :host([dir='rtl']) [last-column] [part~='resize-handle']::before,
- :host([dir='rtl']) [last-frozen] [part~='resize-handle']::before {
- left: 0;
- right: auto;
- }
-
- :host([dir='rtl']) [frozen-to-end] [part~='resize-handle'] {
- right: 0;
- left: auto;
- }
-
- :host([dir='rtl']) [frozen-to-end] [part~='resize-handle']::before {
- right: 0;
- left: auto;
- }
- `,{moduleId:"vaadin-grid-styles"});const ec=e=>e.test(navigator.userAgent),tc=e=>e.test(navigator.platform),ic=ec(/Android/u),oc=ec(/Chrome/u)&&/Google Inc/u.test(navigator.vendor);const nc=ec(/Firefox/u),sc=tc(/^iPad/u)||tc(/^Mac/u)&&navigator.maxTouchPoints>1,rc=tc(/^iPhone/u)||sc,ac=ec(/^((?!chrome|android).)*safari/iu),lc=(()=>{try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}})(),hc=navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/u),mc=hc&&hc[1]>=8,cc={_ratio:.5,_scrollerPaddingTop:0,_scrollPosition:0,_physicalSize:0,_physicalAverage:0,_physicalAverageCount:0,_physicalTop:0,_virtualCount:0,_estScrollHeight:0,_scrollHeight:0,_viewportHeight:0,_viewportWidth:0,_physicalItems:null,_physicalSizes:null,_firstVisibleIndexVal:null,_lastVisibleIndexVal:null,_maxPages:2,_templateCost:0,get _physicalBottom(){return this._physicalTop+this._physicalSize},get _scrollBottom(){return this._scrollPosition+this._viewportHeight},get _virtualEnd(){return this._virtualStart+this._physicalCount-1},get _hiddenContentSize(){return this._physicalSize-this._viewportHeight},get _maxScrollTop(){return this._estScrollHeight-this._viewportHeight+this._scrollOffset},get _maxVirtualStart(){const e=this._virtualCount;return Math.max(0,e-this._physicalCount)},get _virtualStart(){return this._virtualStartVal||0},set _virtualStart(e){e=this._clamp(e,0,this._maxVirtualStart),this._virtualStartVal=e},get _physicalStart(){return this._physicalStartVal||0},set _physicalStart(e){(e%=this._physicalCount)<0&&(e=this._physicalCount+e),this._physicalStartVal=e},get _physicalEnd(){return(this._physicalStart+this._physicalCount-1)%this._physicalCount},get _physicalCount(){return this._physicalCountVal||0},set _physicalCount(e){this._physicalCountVal=e},get _optPhysicalSize(){return 0===this._viewportHeight?1/0:this._viewportHeight*this._maxPages},get _isVisible(){return Boolean(this.offsetWidth||this.offsetHeight)},get firstVisibleIndex(){let e=this._firstVisibleIndexVal;if(null==e){let t=this._physicalTop+this._scrollOffset;e=this._iterateItems(((e,i)=>{if(t+=this._getPhysicalSizeIncrement(e),t>this._scrollPosition)return i}))||0,this._firstVisibleIndexVal=e}return e},get lastVisibleIndex(){let e=this._lastVisibleIndexVal;if(null==e){let t=this._physicalTop+this._scrollOffset;this._iterateItems(((i,o)=>{t=0;if(this._scrollPosition=e,this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,Math.abs(t)>this._physicalSize&&this._physicalSize>0){t-=this._scrollOffset;const e=Math.round(t/this._physicalAverage);this._virtualStart+=e,this._physicalStart+=e,this._physicalTop=Math.min(Math.floor(this._virtualStart)*this._physicalAverage,this._scrollPosition),this._update()}else if(this._physicalCount>0){const e=this._getReusables(i);i?(this._physicalTop=e.physicalTop,this._virtualStart+=e.indexes.length,this._physicalStart+=e.indexes.length):(this._virtualStart-=e.indexes.length,this._physicalStart-=e.indexes.length),this._update(e.indexes,i?null:e.indexes),this._debounce("_increasePoolIfNeeded",this._increasePoolIfNeeded.bind(this,0),Kh)}},_getReusables(e){let t,i,o;const n=[],s=this._hiddenContentSize*this._ratio,r=this._virtualStart,a=this._virtualEnd,l=this._physicalCount;let h=this._physicalTop+this._scrollOffset;const m=this._physicalBottom+this._scrollOffset,c=this._scrollPosition,d=this._scrollBottom;for(e?(t=this._physicalStart,i=c-h):(t=this._physicalEnd,i=m-d);o=this._getPhysicalSizeIncrement(t),i-=o,!(n.length>=l||i<=s);)if(e){if(a+n.length+1>=this._virtualCount)break;if(h+o>=c-this._scrollOffset)break;n.push(t),h+=o,t=(t+1)%l}else{if(r-n.length<=0)break;if(h+this._physicalSize-o<=d)break;n.push(t),h-=o,t=0===t?l-1:t-1}return{indexes:n,physicalTop:h-this._scrollOffset}},_update(e,t){if(!(e&&0===e.length||0===this._physicalCount)){if(this._assignModels(e),this._updateMetrics(e),t)for(;t.length;){const e=t.pop();this._physicalTop-=this._getPhysicalSizeIncrement(e)}this._positionItems(),this._updateScrollerSize()}},_isClientFull(){return 0!==this._scrollBottom&&this._physicalBottom-1>=this._scrollBottom&&this._physicalTop<=this._scrollPosition},_increasePoolIfNeeded(e){const t=this._clamp(this._physicalCount+e,3,this._virtualCount-this._virtualStart)-this._physicalCount;let i=Math.round(.5*this._physicalCount);if(!(t<0)){if(t>0){const e=window.performance.now();[].push.apply(this._physicalItems,this._createPool(t));for(let e=0;ethis._physicalEnd&&this._isIndexRendered(this._focusedVirtualIndex)&&this._getPhysicalIndex(this._focusedVirtualIndex)=this._virtualCount-1||0===i||(this._isClientFull()?this._physicalSize0&&(this.updateViewportBoundaries(),this._increasePoolIfNeeded(3))},_itemsChanged(e){"items"===e.path&&(this._virtualStart=0,this._physicalTop=0,this._virtualCount=this.items?this.items.length:0,this._physicalIndexForKey={},this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,this._physicalItems||(this._physicalItems=[]),this._physicalSizes||(this._physicalSizes=[]),this._physicalStart=0,this._scrollTop>this._scrollOffset&&this._resetScrollPosition(0),this._debounce("_render",this._render,Mh))},_iterateItems(e,t){let i,o,n,s;if(2===arguments.length&&t){for(s=0;s=this._physicalStart?this._virtualStart+(e-this._physicalStart):this._virtualStart+(this._physicalCount-this._physicalStart)+e},_positionItems(){this._adjustScrollPosition();let e=this._physicalTop;this._iterateItems((t=>{this.translate3d(0,`${e}px`,0,this._physicalItems[t]),e+=this._physicalSizes[t]}))},_getPhysicalSizeIncrement(e){return this._physicalSizes[e]},_adjustScrollPosition(){const e=0===this._virtualStart?this._physicalTop:Math.min(this._scrollPosition+this._physicalTop,0);if(0!==e){this._physicalTop-=e;const t=this._scrollPosition;!mc&&t>0&&this._resetScrollPosition(t-e)}},_resetScrollPosition(e){this.scrollTarget&&e>=0&&(this._scrollTop=e,this._scrollPosition=this._scrollTop)},_updateScrollerSize(e){const t=this._physicalBottom+Math.max(this._virtualCount-this._physicalCount-this._virtualStart,0)*this._physicalAverage;this._estScrollHeight=t,(e||0===this._scrollHeight||this._scrollPosition>=t-this._physicalSize||Math.abs(t-this._scrollHeight)>=this._viewportHeight)&&(this.$.items.style.height=`${t}px`,this._scrollHeight=t)},scrollToIndex(e){if("number"!=typeof e||e<0||e>this.items.length-1)return;if(bh(),0===this._physicalCount)return;e=this._clamp(e,0,this._virtualCount-1),(!this._isIndexRendered(e)||e>=this._maxVirtualStart)&&(this._virtualStart=e-1),this._assignModels(),this._updateMetrics(),this._physicalTop=this._virtualStart*this._physicalAverage;let t=this._physicalStart,i=this._virtualStart,o=0;const n=this._hiddenContentSize;for(;i{this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,this._isVisible?(this.updateViewportBoundaries(),this.toggleScrollListener(!0),this._resetAverage(),this._render()):this.toggleScrollListener(!1)}),Mh)},_isIndexRendered(e){return e>=this._virtualStart&&e<=this._virtualEnd},_getPhysicalIndex(e){return(this._physicalStart+(e-this._virtualStart))%this._physicalCount},_clamp:(e,t,i)=>Math.min(i,Math.max(t,e)),_debounce(e,t,i){this._debouncers||(this._debouncers={}),this._debouncers[e]=gh.debounce(this._debouncers[e],i,t.bind(this)),Dh(this._debouncers[e])}},dc=1e3;class pc{constructor({createElements:e,updateElement:t,scrollTarget:i,scrollContainer:o,elementsContainer:n,reorderElements:s}){this.isAttached=!0,this._vidxOffset=0,this.createElements=e,this.updateElement=t,this.scrollTarget=i,this.scrollContainer=o,this.elementsContainer=n||o,this.reorderElements=s,this._maxPages=1.3,this.__placeholderHeight=200,this.__elementHeightQueue=Array(10),this.timeouts={SCROLL_REORDER:500,IGNORE_WHEEL:500,FIX_INVALID_ITEM_POSITIONING:100},this.__resizeObserver=new ResizeObserver((()=>this._resizeHandler())),"visible"===getComputedStyle(this.scrollTarget).overflow&&(this.scrollTarget.style.overflow="auto"),"static"===getComputedStyle(this.scrollContainer).position&&(this.scrollContainer.style.position="relative"),this.__resizeObserver.observe(this.scrollTarget),this.scrollTarget.addEventListener("scroll",(()=>this._scrollHandler())),this._scrollLineHeight=this._getScrollLineHeight(),this.scrollTarget.addEventListener("wheel",(e=>this.__onWheel(e))),this.reorderElements&&(this.scrollTarget.addEventListener("mousedown",(()=>{this.__mouseDown=!0})),this.scrollTarget.addEventListener("mouseup",(()=>{this.__mouseDown=!1,this.__pendingReorder&&this.__reorderElements()})))}get scrollOffset(){return 0}get adjustedFirstVisibleIndex(){return this.firstVisibleIndex+this._vidxOffset}get adjustedLastVisibleIndex(){return this.lastVisibleIndex+this._vidxOffset}scrollToIndex(e){if("number"!=typeof e||isNaN(e)||0===this.size||!this.scrollTarget.offsetHeight)return;e=this._clamp(e,0,this.size-1);const t=this.__getVisibleElements().length;let i=Math.floor(e/this.size*this._virtualCount);this._virtualCount-i{i.__virtualIndex>=e&&i.__virtualIndex<=t&&this.__updateElement(i,i.__virtualIndex,!0)}))}_updateMetrics(e){bh();let t=0,i=0;const o=this._physicalAverageCount,n=this._physicalAverage;this._iterateItems(((e,o)=>{i+=this._physicalSizes[e],this._physicalSizes[e]=Math.ceil(this.__getBorderBoxHeight(this._physicalItems[e])),t+=this._physicalSizes[e],this._physicalAverageCount+=this._physicalSizes[e]?1:0}),e),this._physicalSize=this._physicalSize+t-i,this._physicalAverageCount!==o&&(this._physicalAverage=Math.round((n*o+t)/this._physicalAverageCount))}__getBorderBoxHeight(e){const t=getComputedStyle(e),i=parseFloat(t.height)||0;if("border-box"===t.boxSizing)return i;return i+(parseFloat(t.paddingBottom)||0)+(parseFloat(t.paddingTop)||0)+(parseFloat(t.borderBottomWidth)||0)+(parseFloat(t.borderTopWidth)||0)}__updateElement(e,t,i){e.style.paddingTop&&(e.style.paddingTop=""),this.__preventElementUpdates||e.__lastUpdatedIndex===t&&!i||(this.updateElement(e,t),e.__lastUpdatedIndex=t);const o=e.offsetHeight;if(0===o)e.style.paddingTop=`${this.__placeholderHeight}px`,requestAnimationFrame((()=>this._resizeHandler()));else{this.__elementHeightQueue.push(o),this.__elementHeightQueue.shift();const e=this.__elementHeightQueue.filter((e=>void 0!==e));this.__placeholderHeight=Math.round(e.reduce(((e,t)=>e+t),0)/e.length)}}__getIndexScrollOffset(e){const t=this.__getVisibleElements().find((t=>t.__virtualIndex===e));return t?this.scrollTarget.getBoundingClientRect().top-t.getBoundingClientRect().top:void 0}get size(){return this.__size}set size(e){if(e===this.size)return;let t,i;if(this.__fixInvalidItemPositioningDebouncer&&this.__fixInvalidItemPositioningDebouncer.cancel(),this._debouncers&&this._debouncers._increasePoolIfNeeded&&this._debouncers._increasePoolIfNeeded.cancel(),this.__preventElementUpdates=!0,e>0&&(t=this.adjustedFirstVisibleIndex,i=this.__getIndexScrollOffset(t)),this.__size=e,this._itemsChanged({path:"items"}),bh(),e>0){t=Math.min(t,e-1),this.scrollToIndex(t);const o=this.__getIndexScrollOffset(t);void 0!==i&&void 0!==o&&(this._scrollTop+=i-o)}this.elementsContainer.children.length||requestAnimationFrame((()=>this._resizeHandler())),this.__preventElementUpdates=!1,this._resizeHandler(),bh()}get _scrollTop(){return this.scrollTarget.scrollTop}set _scrollTop(e){this.scrollTarget.scrollTop=e}get items(){return{length:Math.min(this.size,1e5)}}get offsetHeight(){return this.scrollTarget.offsetHeight}get $(){return{items:this.scrollContainer}}updateViewportBoundaries(){const e=window.getComputedStyle(this.scrollTarget);this._scrollerPaddingTop=this.scrollTarget===this?0:parseInt(e["padding-top"],10),this._isRTL=Boolean("rtl"===e.direction),this._viewportWidth=this.elementsContainer.offsetWidth,this._viewportHeight=this.scrollTarget.offsetHeight,this._scrollPageHeight=this._viewportHeight-this._scrollLineHeight,this.grid&&this._updateGridMetrics()}setAttribute(){}_createPool(e){const t=this.createElements(e),i=document.createDocumentFragment();return t.forEach((e=>{e.style.position="absolute",i.appendChild(e),this.__resizeObserver.observe(e)})),this.elementsContainer.appendChild(i),t}_assignModels(e){this._iterateItems(((e,t)=>{const i=this._physicalItems[e];i.hidden=t>=this.size,i.hidden?delete i.__lastUpdatedIndex:(i.__virtualIndex=t+(this._vidxOffset||0),this.__updateElement(i,i.__virtualIndex))}),e)}_isClientFull(){return setTimeout((()=>{this.__clientFull=!0})),this.__clientFull||super._isClientFull()}translate3d(e,t,i,o){o.style.transform=`translateY(${t})`}toggleScrollListener(){}_scrollHandler(){this._adjustVirtualIndexOffset(this._scrollTop-(this.__previousScrollTop||0));const e=this.scrollTarget.scrollTop-this._scrollPosition;if(super._scrollHandler(),0!==this._physicalCount){const t=e>=0,i=this._getReusables(!t);i.indexes.length&&(this._physicalTop=i.physicalTop,t?(this._virtualStart-=i.indexes.length,this._physicalStart-=i.indexes.length):(this._virtualStart+=i.indexes.length,this._physicalStart+=i.indexes.length),this._resizeHandler())}e&&(this.__fixInvalidItemPositioningDebouncer=gh.debounce(this.__fixInvalidItemPositioningDebouncer,fh.after(this.timeouts.FIX_INVALID_ITEM_POSITIONING),(()=>this.__fixInvalidItemPositioning()))),this.reorderElements&&(this.__scrollReorderDebouncer=gh.debounce(this.__scrollReorderDebouncer,fh.after(this.timeouts.SCROLL_REORDER),(()=>this.__reorderElements()))),this.__previousScrollTop=this._scrollTop,0===this._scrollTop&&0!==this.firstVisibleIndex&&Math.abs(e)>0&&this.scrollToIndex(0)}__fixInvalidItemPositioning(){if(!this.scrollTarget.isConnected)return;const e=this._physicalTop>this._scrollTop,t=this._physicalBottom{this._wheelAnimationFrame=!1}));const i=Math.abs(e.deltaX)+Math.abs(t);this._canScroll(this.scrollTarget,e.deltaX,t)?(e.preventDefault(),this.scrollTarget.scrollTop+=t,this.scrollTarget.scrollLeft+=e.deltaX,this._hasResidualMomentum=!0,this._ignoreNewWheel=!0,this._debouncerIgnoreNewWheel=gh.debounce(this._debouncerIgnoreNewWheel,fh.after(this.timeouts.IGNORE_WHEEL),(()=>{this._ignoreNewWheel=!1}))):this._hasResidualMomentum&&i<=this._previousMomentum||this._ignoreNewWheel?e.preventDefault():i>this._previousMomentum&&(this._hasResidualMomentum=!1),this._previousMomentum=i}_hasScrolledAncestor(e,t,i){return e!==this.scrollTarget&&e!==this.scrollTarget.getRootNode().host&&(!(!this._canScroll(e,t,i)||-1===["auto","scroll"].indexOf(getComputedStyle(e).overflow))||(e!==this&&e.parentElement?this._hasScrolledAncestor(e.parentElement,t,i):void 0))}_canScroll(e,t,i){return i>0&&e.scrollTop0||t>0&&e.scrollLeft0}_getScrollLineHeight(){const e=document.createElement("div");e.style.fontSize="initial",e.style.display="none",document.body.appendChild(e);const t=window.getComputedStyle(e).fontSize;return document.body.removeChild(e),t?window.parseInt(t):void 0}__getVisibleElements(){return Array.from(this.elementsContainer.children).filter((e=>!e.hidden))}__reorderElements(){if(this.__mouseDown)return void(this.__pendingReorder=!0);this.__pendingReorder=!1;const e=this._virtualStart+(this._vidxOffset||0),t=this.__getVisibleElements(),i=t.find((e=>e.contains(this.elementsContainer.getRootNode().activeElement)||e.contains(this.scrollTarget.getRootNode().activeElement)))||t[0];if(!i)return;const o=i.__virtualIndex-e,n=t.indexOf(i)-o;if(n>0)for(let e=0;e{this.scrollTarget.style.transform=e}))}}_adjustVirtualIndexOffset(e){if(this._virtualCount>=this.size)this._vidxOffset=0;else if(this.__skipNextVirtualIndexAdjust)this.__skipNextVirtualIndexAdjust=!1;else if(Math.abs(e)>1e4){const e=this._scrollTop/(this.scrollTarget.scrollHeight-this.scrollTarget.offsetHeight),t=e*this.size;this._vidxOffset=Math.round(t-e*this._virtualCount)}else{const e=this._vidxOffset,t=dc,i=100;0===this._scrollTop?(this._vidxOffset=0,e!==this._vidxOffset&&super.scrollToIndex(0)):this.firstVisibleIndex0&&(this._vidxOffset-=Math.min(this._vidxOffset,i),super.scrollToIndex(this.firstVisibleIndex+(e-this._vidxOffset)));const o=this.size-this._virtualCount;this._scrollTop>=this._maxScrollTop&&this._maxScrollTop>0?(this._vidxOffset=o,e!==this._vidxOffset&&super.scrollToIndex(this._virtualCount-1)):this.firstVisibleIndex>this._virtualCount-t&&this._vidxOffsetclass extends e{static get observers(){return["_a11yUpdateGridSize(size, _columnTree, _columnTree.*)"]}_a11yGetHeaderRowCount(e){return e.filter((e=>e.some((e=>e.headerRenderer||e.path||e.header)))).length}_a11yGetFooterRowCount(e){return e.filter((e=>e.some((e=>e.headerRenderer)))).length}_a11yUpdateGridSize(e,t){if(void 0===e||void 0===t)return;const i=t[t.length-1];this.$.table.setAttribute("aria-rowcount",e+this._a11yGetHeaderRowCount(t)+this._a11yGetFooterRowCount(t)),this.$.table.setAttribute("aria-colcount",i&&i.length||0),this._a11yUpdateHeaderRows(),this._a11yUpdateFooterRows()}_a11yUpdateHeaderRows(){Um(this.$.header,((e,t)=>{e.setAttribute("aria-rowindex",t+1)}))}_a11yUpdateFooterRows(){Um(this.$.footer,((e,t)=>{e.setAttribute("aria-rowindex",this._a11yGetHeaderRowCount(this._columnTree)+this.size+t+1)}))}_a11yUpdateRowRowindex(e,t){e.setAttribute("aria-rowindex",t+this._a11yGetHeaderRowCount(this._columnTree)+1)}_a11yUpdateRowSelected(e,t){e.setAttribute("aria-selected",Boolean(t)),Um(e,(e=>{e.setAttribute("aria-selected",Boolean(t))}))}_a11yUpdateRowExpanded(e){this.__isRowExpandable(e)?e.setAttribute("aria-expanded","false"):this.__isRowCollapsible(e)?e.setAttribute("aria-expanded","true"):e.removeAttribute("aria-expanded")}_a11yUpdateRowLevel(e,t){t>0||this.__isRowCollapsible(e)||this.__isRowExpandable(e)?e.setAttribute("aria-level",t+1):e.removeAttribute("aria-level")}_a11ySetRowDetailsCell(e,t){Um(e,(e=>{e!==t&&e.setAttribute("aria-controls",t.id)}))}_a11yUpdateCellColspan(e,t){e.setAttribute("aria-colspan",Number(t))}_a11yUpdateSorters(){Array.from(this.querySelectorAll("vaadin-grid-sorter")).forEach((e=>{let t=e.parentNode;for(;t&&"vaadin-grid-cell-content"!==t.localName;)t=t.parentNode;if(t&&t.assignedSlot){t.assignedSlot.parentNode.setAttribute("aria-sort",{asc:"ascending",desc:"descending"}[String(e.direction)]||"none")}}))}},wc=e=>class extends e{static get properties(){return{activeItem:{type:Object,notify:!0,value:null}}}ready(){super.ready(),this.$.scroller.addEventListener("click",this._onClick.bind(this)),this.addEventListener("cell-activate",this._activateItem.bind(this)),this.addEventListener("row-activate",this._activateItem.bind(this))}_activateItem(e){const t=e.detail.model,i=t?t.item:null;i&&(this.activeItem=this._itemsEqual(this.activeItem,i)?null:i)}_onClick(e){if(e.defaultPrevented)return;const t=e.composedPath(),i=t[t.indexOf(this.$.table)-3];if(!i||i.getAttribute("part").indexOf("details-cell")>-1)return;const o=i._content,n=this.getRootNode().activeElement;o.contains(n)||this._isFocusable(e.target)||e.target instanceof HTMLLabelElement||this.dispatchEvent(new CustomEvent("cell-activate",{detail:{model:this.__getRowModel(i.parentElement)}}))}_isFocusable(e){return(e=>{if(!e.parentNode)return!1;const t=Array.from(e.parentNode.querySelectorAll("[tabindex], button, input, select, textarea, object, iframe, a[href], area[href]")).filter((e=>{const t=e.getAttribute("part");return!(t&&t.includes("body-cell"))})).includes(e);return!e.disabled&&t&&e.offsetParent&&"hidden"!==getComputedStyle(e).visibility})(e)}};function uc(e,t){return e.split(".").reduce(((e,t)=>e[t]),t)}function fc(e,t,i){if(0===i.length)return!1;let o=!0;return e.forEach((({path:e})=>{if(!e||-1===e.indexOf("."))return;void 0===uc(e.replace(/\.[^.]*$/u,""),i[0])&&(console.warn(`Path "${e}" used for ${t} does not exist in all of the items, ${t} is disabled.`),o=!1)})),o}function Mc(e){return[void 0,null].indexOf(e)>=0?"":isNaN(e)?e.toString():e}function Zc(e,t){return(e=Mc(e))<(t=Mc(t))?-1:e>t?1:0}const Kc=e=>(t,i)=>{let o=e?[...e]:[];t.filters&&fc(t.filters,"filtering",o)&&(o=function(e,t){return e.filter((e=>t.every((t=>{const i=Mc(uc(t.path,e)),o=Mc(t.value).toString().toLowerCase();return i.toString().toLowerCase().includes(o)}))))}(o,t.filters)),Array.isArray(t.sortOrders)&&t.sortOrders.length&&fc(t.sortOrders,"sorting",o)&&(o=function(e,t){return e.sort(((e,i)=>t.map((t=>"asc"===t.direction?Zc(uc(t.path,e),uc(t.path,i)):"desc"===t.direction?Zc(uc(t.path,i),uc(t.path,e)):0)).reduce(((e,t)=>0!==e?e:t),0)))}(o,t.sortOrders));const n=Math.min(o.length,t.pageSize),s=t.page*n,r=s+n;i(o.slice(s,r),o.length)},yc=e=>class extends e{static get properties(){return{items:Array}}static get observers(){return["__dataProviderOrItemsChanged(dataProvider, items, isAttached, items.*, _filters, _sorters)"]}__setArrayDataProvider(e){const t=Kc(this.items);t.__items=e,this.setProperties({_arrayDataProvider:t,size:e.length,dataProvider:t})}__dataProviderOrItemsChanged(e,t,i){i&&(this._arrayDataProvider?e!==this._arrayDataProvider?this.setProperties({_arrayDataProvider:void 0,items:void 0}):t?this._arrayDataProvider.__items===t?(this.clearCache(),this.size=this._effectiveSize):this.__setArrayDataProvider(t):(this.setProperties({_arrayDataProvider:void 0,dataProvider:void 0,size:0}),this.clearCache()):t&&this.__setArrayDataProvider(t))}},gc=e=>class extends e{static get properties(){return{columnReorderingAllowed:{type:Boolean,value:!1},_orderBaseScope:{type:Number,value:1e7}}}static get observers(){return["_updateOrders(_columnTree)"]}ready(){super.ready(),pm(this,"track",this._onTrackEvent),this._reorderGhost=this.shadowRoot.querySelector('[part="reorder-ghost"]'),this.addEventListener("touchstart",this._onTouchStart.bind(this)),this.addEventListener("touchmove",this._onTouchMove.bind(this)),this.addEventListener("touchend",this._onTouchEnd.bind(this)),this.addEventListener("contextmenu",this._onContextMenu.bind(this))}_onContextMenu(e){this.hasAttribute("reordering")&&(e.preventDefault(),lc||this._onTrackEnd())}_onTouchStart(e){this._startTouchReorderTimeout=setTimeout((()=>{this._onTrackStart({detail:{x:e.touches[0].clientX,y:e.touches[0].clientY}})}),100)}_onTouchMove(e){this._draggedColumn&&e.preventDefault(),clearTimeout(this._startTouchReorderTimeout)}_onTouchEnd(){clearTimeout(this._startTouchReorderTimeout),this._onTrackEnd()}_onTrackEvent(e){if("start"===e.detail.state){const t=e.composedPath(),i=t[t.indexOf(this.$.header)-2];if(!i||!i._content)return;if(i._content.contains(this.getRootNode().activeElement))return;if(this.$.scroller.hasAttribute("column-resizing"))return;this._touchDevice||this._onTrackStart(e)}else"track"===e.detail.state?this._onTrack(e):"end"===e.detail.state&&this._onTrackEnd(e)}_onTrackStart(e){if(!this.columnReorderingAllowed)return;const t=e.composedPath&&e.composedPath();if(t&&t.some((e=>e.hasAttribute&&e.hasAttribute("draggable"))))return;const i=this._cellFromPoint(e.detail.x,e.detail.y);if(i&&i.getAttribute("part").includes("header-cell")){for(this.toggleAttribute("reordering",!0),this._draggedColumn=i._column;1===this._draggedColumn.parentElement.childElementCount;)this._draggedColumn=this._draggedColumn.parentElement;this._setSiblingsReorderStatus(this._draggedColumn,"allowed"),this._draggedColumn._reorderStatus="dragging",this._updateGhost(i),this._reorderGhost.style.visibility="visible",this._updateGhostPosition(e.detail.x,this._touchDevice?e.detail.y-50:e.detail.y),this._autoScroller()}}_onTrack(e){if(!this._draggedColumn)return;const t=this._cellFromPoint(e.detail.x,e.detail.y);if(!t)return;const i=this._getTargetColumn(t,this._draggedColumn);if(this._isSwapAllowed(this._draggedColumn,i)&&this._isSwappableByPosition(i,e.detail.x)){const e=this._columnTree.findIndex((e=>e.includes(i))),t=this._getColumnsInOrder(e),o=t.indexOf(this._draggedColumn),n=t.indexOf(i),s=o!e.hidden)).sort(((e,t)=>e._order-t._order))}_cellFromPoint(e=0,t=0){this._draggedColumn||this.$.scroller.toggleAttribute("no-content-pointer-events",!0);const i=this.shadowRoot.elementFromPoint(e,t);if(this.$.scroller.toggleAttribute("no-content-pointer-events",!1),i&&i._column)return i}_updateGhostPosition(e,t){const i=this._reorderGhost.getBoundingClientRect(),o=e-i.width/2,n=t-i.height/2,s=parseInt(this._reorderGhost._left||0),r=parseInt(this._reorderGhost._top||0);this._reorderGhost._left=s-(i.left-o),this._reorderGhost._top=r-(i.top-n),this._reorderGhost.style.transform=`translate(${this._reorderGhost._left}px, ${this._reorderGhost._top}px)`}_updateGhost(e){const t=this._reorderGhost;t.textContent=e._content.innerText;const i=window.getComputedStyle(e);return["boxSizing","display","width","height","background","alignItems","padding","border","flex-direction","overflow"].forEach((e=>{t.style[e]=i[e]})),t}_updateOrders(e){void 0!==e&&(e[0].forEach((e=>{e._order=0})),function(e,t,i){let o=1;e.forEach((e=>{o%10==0&&(o+=1),e._order=i+o*t,o+=1}))}(e[0],this._orderBaseScope,0))}_setSiblingsReorderStatus(e,t){Um(e.parentNode,(i=>{/column/u.test(i.localName)&&this._isSwapAllowed(i,e)&&(i._reorderStatus=t)}))}_autoScroller(){if(this._lastDragClientX){const e=this._lastDragClientX-this.getBoundingClientRect().right+50,t=this.getBoundingClientRect().left-this._lastDragClientX+50;e>0?this.$.table.scrollLeft+=e/10:t>0&&(this.$.table.scrollLeft-=t/10)}this._draggedColumn&&setTimeout((()=>this._autoScroller()),10)}_isSwapAllowed(e,t){if(e&&t){const i=e!==t,o=e.parentElement===t.parentElement,n=e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd||!e.frozen&&!e.frozenToEnd&&!t.frozen&&!t.frozenToEnd;return i&&o&&n}}_isSwappableByPosition(e,t){const i=Array.from(this.$.header.querySelectorAll('tr:not([hidden]) [part~="cell"]')).find((t=>e.contains(t._column))),o=this.$.header.querySelector("tr:not([hidden]) [reorder-status=dragging]").getBoundingClientRect(),n=i.getBoundingClientRect();return n.left>o.left?t>n.right-o.width:tclass extends e{ready(){super.ready();const e=this.$.scroller;pm(e,"track",this._onHeaderTrack.bind(this)),e.addEventListener("touchmove",(t=>e.hasAttribute("column-resizing")&&t.preventDefault())),e.addEventListener("contextmenu",(e=>"resize-handle"===e.target.getAttribute("part")&&e.preventDefault())),e.addEventListener("mousedown",(e=>"resize-handle"===e.target.getAttribute("part")&&e.preventDefault()))}_onHeaderTrack(e){const t=e.target;if("resize-handle"===t.getAttribute("part")){let i=t.parentElement._column;for(this.$.scroller.toggleAttribute("column-resizing",!0);"vaadin-grid-column-group"===i.localName;)i=i._childColumns.slice(0).sort(((e,t)=>e._order-t._order)).filter((e=>!e.hidden)).pop();const o=this.__isRTL,n=e.detail.x,s=Array.from(this.$.header.querySelectorAll('[part~="row"]:last-child [part~="cell"]')),r=s.find((e=>e._column===i));if(r.offsetWidth){const e=getComputedStyle(r._content),t=10+parseInt(e.paddingLeft)+parseInt(e.paddingRight)+parseInt(e.borderLeftWidth)+parseInt(e.borderRightWidth)+parseInt(e.marginLeft)+parseInt(e.marginRight);let s;const a=r.offsetWidth,l=r.getBoundingClientRect();s=r.hasAttribute("frozen-to-end")?a+(o?n-l.right:l.left-n):a+(o?l.left-n:n-l.right),i.width=`${Math.max(t,s)}px`,i.flexGrow=0}s.sort(((e,t)=>e._column._order-t._column._order)).forEach(((e,t,i)=>{tthis.$.table.offsetWidth){const e=a.getBoundingClientRect(),t=n-(o?e.right:e.left);(o&&t<=0||!o&&t>=0)&&(this.$.table.scrollLeft+=t)}"end"===e.detail.state&&(this.$.scroller.toggleAttribute("column-resizing",!1),this.dispatchEvent(new CustomEvent("column-resize",{detail:{resizedColumn:i}}))),this._resizeHandler()}}},xc=class e{constructor(e,t,i){this.grid=e,this.parentCache=t,this.parentItem=i,this.itemCaches={},this.items={},this.effectiveSize=0,this.size=0,this.pendingRequests={}}isLoading(){return Boolean(Object.keys(this.pendingRequests).length||Object.keys(this.itemCaches).filter((e=>this.itemCaches[e].isLoading()))[0])}getItemForIndex(e){const{cache:t,scaledIndex:i}=this.getCacheAndIndex(e);return t.items[i]}updateSize(){this.effectiveSize=!this.parentItem||this.grid._isExpanded(this.parentItem)?this.size+Object.keys(this.itemCaches).reduce(((e,t)=>{const i=this.itemCaches[t];return i.updateSize(),e+i.effectiveSize}),0):0}ensureSubCacheForScaledIndex(t){if(!this.itemCaches[t]){const i=new e(this.grid,this,this.items[t]);this.itemCaches[t]=i,this.grid._loadPage(0,i)}}getCacheAndIndex(e){let t=e;for(const[e,i]of Object.entries(this.itemCaches)){const o=Number(e);if(t<=o)return{cache:this,scaledIndex:t};if(t<=o+i.effectiveSize)return i.getCacheAndIndex(t-o-1);t-=i.effectiveSize}return{cache:this,scaledIndex:t}}},bc=e=>class extends e{static get properties(){return{size:{type:Number,notify:!0},pageSize:{type:Number,value:50,observer:"_pageSizeChanged"},dataProvider:{type:Object,notify:!0,observer:"_dataProviderChanged"},loading:{type:Boolean,notify:!0,readOnly:!0,reflectToAttribute:!0},_cache:{type:Object,value(){return new xc(this)}},_hasData:{type:Boolean,value:!1},itemHasChildrenPath:{type:String,value:"children",observer:"__itemHasChildrenPathChanged"},itemIdPath:{type:String,value:null},expandedItems:{type:Object,notify:!0,value:()=>[]},__expandedKeys:{type:Object,computed:"__computeExpandedKeys(itemIdPath, expandedItems.*)"}}}static get observers(){return["_sizeChanged(size)","_expandedItemsChanged(expandedItems.*)"]}_sizeChanged(e){const t=e-this._cache.size;this._cache.size+=t,this._cache.effectiveSize+=t,this._effectiveSize=this._cache.effectiveSize}__itemHasChildrenPathChanged(e,t){(t||"children"!==e)&&this.requestContentUpdate()}_getItem(e,t){if(e>=this._effectiveSize)return;t.index=e;const{cache:i,scaledIndex:o}=this._cache.getCacheAndIndex(e),n=i.items[o];n?(this.__updateLoading(t,!1),this._updateItem(t,n),this._isExpanded(n)&&i.ensureSubCacheForScaledIndex(o)):(this.__updateLoading(t,!0),this._loadPage(this._getPageForIndex(o),i))}__updateLoading(e,t){const i=Hm(e);Rm(e,"loading",t),Jm(i,"loading-row-cell",t)}getItemId(e){return this.itemIdPath?this.get(this.itemIdPath,e):e}_isExpanded(e){return this.__expandedKeys.has(this.getItemId(e))}_expandedItemsChanged(){this._cache.updateSize(),this._effectiveSize=this._cache.effectiveSize,this.__updateVisibleRows()}__computeExpandedKeys(e,t){const i=t.base||[],o=new Set;return i.forEach((e=>{o.add(this.getItemId(e))})),o}expandItem(e){this._isExpanded(e)||(this.expandedItems=[...this.expandedItems,e])}collapseItem(e){this._isExpanded(e)&&(this.expandedItems=this.expandedItems.filter((t=>!this._itemsEqual(t,e))))}_getIndexLevel(e){let{cache:t}=this._cache.getCacheAndIndex(e),i=0;for(;t.parentCache;)t=t.parentCache,i+=1;return i}_loadPage(e,t){if(!t.pendingRequests[e]&&this.dataProvider){this._setLoading(!0),t.pendingRequests[e]=!0;const i={page:e,pageSize:this.pageSize,sortOrders:this._mapSorters(),filters:this._mapFilters(),parentItem:t.parentItem};this.dataProvider(i,((o,n)=>{void 0!==n?t.size=n:i.parentItem&&(t.size=o.length);const s=Array.from(this.$.items.children).map((e=>e._item));o.forEach(((i,o)=>{const n=e*this.pageSize+o;t.items[n]=i,this._isExpanded(i)&&s.indexOf(i)>-1&&t.ensureSubCacheForScaledIndex(n)})),this._hasData=!0,delete t.pendingRequests[e],this._debouncerApplyCachedData=gh.debounce(this._debouncerApplyCachedData,fh.after(0),(()=>{this._setLoading(!1),this._cache.updateSize(),this._effectiveSize=this._cache.effectiveSize,this._getVisibleRows().forEach((e=>{this._cache.getItemForIndex(e.index)&&this._getItem(e.index,e)})),this.__scrollToPendingIndex()})),this._cache.isLoading()||this._debouncerApplyCachedData.flush(),this.__itemsReceived()}))}}_getPageForIndex(e){return Math.floor(e/this.pageSize)}clearCache(){this._cache=new xc(this),this._cache.size=this.size||0,this._cache.updateSize(),this._hasData=!1,this.__updateVisibleRows(),this._effectiveSize||this._loadPage(0,this._cache)}_pageSizeChanged(e,t){void 0!==t&&e!==t&&this.clearCache()}_checkSize(){void 0===this.size&&0===this._effectiveSize&&console.warn("The needs the total number of items in order to display rows, which you can specify either by setting the `size` property, or by providing it to the second argument of the `dataProvider` function `callback` call.")}_dataProviderChanged(e,t){void 0!==t&&this.clearCache(),this._ensureFirstPageLoaded(),this._debouncerCheckSize=gh.debounce(this._debouncerCheckSize,fh.after(2e3),this._checkSize.bind(this))}_ensureFirstPageLoaded(){this._hasData||this._loadPage(0,this._cache)}_itemsEqual(e,t){return this.getItemId(e)===this.getItemId(t)}_getItemIndexInArray(e,t){let i=-1;return t.forEach(((t,o)=>{this._itemsEqual(t,e)&&(i=o)})),i}scrollToIndex(e){super.scrollToIndex(e),isNaN(e)||!this._cache.isLoading()&&this.clientHeight||(this.__pendingScrollToIndex=e)}__scrollToPendingIndex(){if(this.__pendingScrollToIndex&&this.$.items.children.length){const e=this.__pendingScrollToIndex;delete this.__pendingScrollToIndex,this.scrollToIndex(e)}}},vc="between",Yc="on-top-or-between",Sc="on-grid",Tc="on-top",Xc="above",Ec="below",kc="empty",zc=!("draggable"in document.createElement("div")),Gc=e=>class extends e{static get properties(){return{dropMode:String,rowsDraggable:Boolean,dragFilter:Function,dropFilter:Function,__dndAutoScrollThreshold:{value:50}}}static get observers(){return["_dragDropAccessChanged(rowsDraggable, dropMode, dragFilter, dropFilter, loading)"]}ready(){super.ready(),this.$.table.addEventListener("dragstart",this._onDragStart.bind(this)),this.$.table.addEventListener("dragend",this._onDragEnd.bind(this)),this.$.table.addEventListener("dragover",this._onDragOver.bind(this)),this.$.table.addEventListener("dragleave",this._onDragLeave.bind(this)),this.$.table.addEventListener("drop",this._onDrop.bind(this)),this.$.table.addEventListener("dragenter",(e=>{this.dropMode&&(e.preventDefault(),e.stopPropagation())}))}_onDragStart(e){if(this.rowsDraggable){let t=e.target;if("vaadin-grid-cell-content"===t.localName&&(t=t.assignedSlot.parentNode.parentNode),t.parentNode!==this.$.items)return;if(e.stopPropagation(),this.toggleAttribute("dragging-rows",!0),this._safari){const e=t.style.transform;t.style.top=/translateY\((.*)\)/u.exec(e)[1],t.style.transform="none",requestAnimationFrame((()=>{t.style.top="",t.style.transform=e}))}const i=t.getBoundingClientRect();zc?e.dataTransfer.setDragImage(t):e.dataTransfer.setDragImage(t,e.clientX-i.left,e.clientY-i.top);let o=[t];this._isSelected(t._item)&&(o=this.__getViewportRows().filter((e=>this._isSelected(e._item))).filter((e=>!this.dragFilter||this.dragFilter(this.__getRowModel(e))))),e.dataTransfer.setData("text",this.__formatDefaultTransferData(o)),Lm(t,{dragstart:o.length>1?`${o.length}`:""}),this.style.setProperty("--_grid-drag-start-x",e.clientX-i.left+20+"px"),this.style.setProperty("--_grid-drag-start-y",e.clientY-i.top+10+"px"),requestAnimationFrame((()=>{Lm(t,{dragstart:!1}),this.style.setProperty("--_grid-drag-start-x",""),this.style.setProperty("--_grid-drag-start-y","")}));const n=new CustomEvent("grid-dragstart",{detail:{draggedItems:o.map((e=>e._item)),setDragData:(t,i)=>e.dataTransfer.setData(t,i),setDraggedItemsCount:e=>t.setAttribute("dragstart",e)}});n.originalEvent=e,this.dispatchEvent(n)}}_onDragEnd(e){this.toggleAttribute("dragging-rows",!1),e.stopPropagation();const t=new CustomEvent("grid-dragend");t.originalEvent=e,this.dispatchEvent(t)}_onDragLeave(e){e.stopPropagation(),this._clearDragStyles()}_onDragOver(e){if(this.dropMode){if(this._dropLocation=void 0,this._dragOverItem=void 0,this.__dndAutoScroll(e.clientY))return void this._clearDragStyles();let t=e.composedPath().find((e=>"tr"===e.localName));if(this._effectiveSize&&this.dropMode!==Sc)if(t&&t.parentNode===this.$.items){const i=t.getBoundingClientRect();if(this._dropLocation=Tc,this.dropMode===vc){const t=e.clientY-i.topi.height/3*2&&(this._dropLocation=Ec))}else{if(t)return;if(this.dropMode!==vc&&this.dropMode!==Yc)return;t=Array.from(this.$.items.children).filter((e=>!e.hidden)).pop(),this._dropLocation=Ec}else this._dropLocation=kc;if(t&&t.hasAttribute("drop-disabled"))return void(this._dropLocation=void 0);e.stopPropagation(),e.preventDefault(),this._dropLocation===kc?this.toggleAttribute("dragover",!0):t?(this._dragOverItem=t._item,t.getAttribute("dragover")!==this._dropLocation&&Bm(t,{dragover:this._dropLocation})):this._clearDragStyles()}}__dndAutoScroll(e){if(this.__dndAutoScrolling)return!0;const t=this.$.header.getBoundingClientRect().bottom,i=this.$.footer.getBoundingClientRect().top,o=t-e+this.__dndAutoScrollThreshold,n=e-i+this.__dndAutoScrollThreshold;let s=0;if(n>0?s=2*n:o>0&&(s=2*-o),s){const e=this.$.table.scrollTop;this.$.table.scrollTop+=s;if(e!==this.$.table.scrollTop)return this.__dndAutoScrolling=!0,setTimeout((()=>{this.__dndAutoScrolling=!1}),20),!0}}__getViewportRows(){const e=this.$.header.getBoundingClientRect().bottom,t=this.$.footer.getBoundingClientRect().top;return Array.from(this.$.items.children).filter((i=>{const o=i.getBoundingClientRect();return o.bottom>e&&o.top{Bm(e,{dragover:null})}))}_onDrop(e){if(this.dropMode){e.stopPropagation(),e.preventDefault();const t=e.dataTransfer.types&&Array.from(e.dataTransfer.types).map((t=>({type:t,data:e.dataTransfer.getData(t)})));this._clearDragStyles();const i=new CustomEvent("grid-drop",{bubbles:e.bubbles,cancelable:e.cancelable,detail:{dropTargetItem:this._dragOverItem,dropLocation:this._dropLocation,dragData:t}});i.originalEvent=e,this.dispatchEvent(i)}}__formatDefaultTransferData(e){return e.map((e=>Array.from(e.children).filter((e=>!e.hidden&&-1===e.getAttribute("part").indexOf("details-cell"))).sort(((e,t)=>e._column._order>t._column._order?1:-1)).map((e=>e._content.textContent.trim())).filter((e=>e)).join("\t"))).join("\n")}_dragDropAccessChanged(){this.filterDragAndDrop()}filterDragAndDrop(){Um(this.$.items,(e=>{e.hidden||this._filterDragAndDrop(e,this.__getRowModel(e))}))}_filterDragAndDrop(e,t){const i=this.loading||e.hasAttribute("loading"),o=!this.rowsDraggable||i||this.dragFilter&&!this.dragFilter(t),n=!this.dropMode||i||this.dropFilter&&!this.dropFilter(t);Um(e,(e=>{o?e._content.removeAttribute("draggable"):e._content.setAttribute("draggable",!0)})),Lm(e,{"drag-disabled":!!o,"drop-disabled":!!n})}};function Ac(e,t){if(!e||!t||e.length!==t.length)return!1;for(let i=0,o=e.length;iclass extends e{static get properties(){return{_columnTree:Object}}ready(){super.ready(),this._addNodeObserver()}_hasColumnGroups(e){return e.some((e=>"vaadin-grid-column-group"===e.localName))}_getChildColumns(e){return ba.getFlattenedNodes(e).filter(this._isColumnElement)}_flattenColumnGroups(e){return e.map((e=>"vaadin-grid-column-group"===e.localName?this._getChildColumns(e):[e])).reduce(((e,t)=>e.concat(t)),[])}_getColumnTree(){const e=ba.getFlattenedNodes(this).filter(this._isColumnElement),t=[e];let i=e;for(;this._hasColumnGroups(i);)i=this._flattenColumnGroups(i),t.push(i);return t}_updateColumnTree(){const e=this._getColumnTree();Ac(e,this._columnTree)||(this._columnTree=e)}_addNodeObserver(){this._observer=new ba(this,(e=>{const t=e=>e.filter(this._isColumnElement).length>0;if(t(e.addedNodes)||t(e.removedNodes)){const t=e.removedNodes.flatMap((e=>e._allCells)),i=e=>t.filter((t=>t._content.contains(e))).length;this.__removeSorters(this._sorters.filter(i)),this.__removeFilters(this._filters.filter(i)),this._updateColumnTree()}this._debouncerCheckImports=gh.debounce(this._debouncerCheckImports,fh.after(2e3),this._checkImports.bind(this)),this._ensureFirstPageLoaded()}))}_checkImports(){["vaadin-grid-column-group","vaadin-grid-filter","vaadin-grid-filter-column","vaadin-grid-tree-toggle","vaadin-grid-selection-column","vaadin-grid-sort-column","vaadin-grid-sorter"].forEach((e=>{const t=this.querySelector(e);!t||t instanceof Dl||console.warn(`Make sure you have imported the required module for <${e}> element.`)}))}_updateFirstAndLastColumn(){Array.from(this.shadowRoot.querySelectorAll("tr")).forEach((e=>this._updateFirstAndLastColumnForRow(e)))}_updateFirstAndLastColumnForRow(e){Array.from(e.querySelectorAll('[part~="cell"]:not([part~="details-cell"])')).sort(((e,t)=>e._column._order-t._column._order)).forEach(((e,t,i)=>{Qm(e,"first-column",0===t),Qm(e,"last-column",t===i.length-1)}))}_isColumnElement(e){return e.nodeType===Node.ELEMENT_NODE&&/\bcolumn\b/u.test(e.localName)}},Cc=e=>class extends e{getEventContext(e){const t={},i=e.__composedPath||e.composedPath(),o=i[i.indexOf(this.$.table)-3];return o?(t.section=["body","header","footer","details"].find((e=>o.getAttribute("part").indexOf(e)>-1)),o._column&&(t.column=o._column),"body"!==t.section&&"details"!==t.section||Object.assign(t,this.__getRowModel(o.parentElement)),t):t}},Nc=e=>class extends e{static get properties(){return{_filters:{type:Array,value:()=>[]}}}ready(){super.ready(),this.addEventListener("filter-changed",this._filterChanged.bind(this))}_filterChanged(e){e.stopPropagation(),this.__addFilter(e.target),this.__applyFilters()}__removeFilters(e){0!==e.length&&(this._filters=this._filters.filter((t=>e.indexOf(t)<0)),this.__applyFilters())}__addFilter(e){-1===this._filters.indexOf(e)&&this._filters.push(e)}__applyFilters(){this.dataProvider&&this.isAttached&&this.clearCache()}_mapFilters(){return this._filters.map((e=>({path:e.path,value:e.value})))}},Vc=e=>class extends e{static get properties(){return{_headerFocusable:{type:Object,observer:"_focusableChanged"},_itemsFocusable:{type:Object,observer:"_focusableChanged"},_footerFocusable:{type:Object,observer:"_focusableChanged"},_navigatingIsHidden:Boolean,_focusedItemIndex:{type:Number,value:0},_focusedColumnOrder:Number,_focusedCell:{type:Object,observer:"_focusedCellChanged"},interacting:{type:Boolean,value:!1,reflectToAttribute:!0,readOnly:!0,observer:"_interactingChanged"}}}get __rowFocusMode(){return this.__isRow(this._itemsFocusable)||this.__isRow(this._headerFocusable)||this.__isRow(this._footerFocusable)}set __rowFocusMode(e){["_itemsFocusable","_footerFocusable","_headerFocusable"].forEach((t=>{const i=this[t];if(e){const e=i&&i.parentElement;this.__isCell(i)?this[t]=e:this.__isCell(e)&&(this[t]=e.parentElement)}else if(!e&&this.__isRow(i)){const e=i.firstElementChild;this[t]=e._focusButton||e}}))}ready(){super.ready(),this._ios||this._android||(this.addEventListener("keydown",this._onKeyDown),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut),this.$.table.addEventListener("focusin",this._onContentFocusIn.bind(this)),this.addEventListener("mousedown",(()=>{this.toggleAttribute("navigating",!1),this._isMousedown=!0,this._focusedColumnOrder=void 0})),this.addEventListener("mouseup",(()=>{this._isMousedown=!1})))}_focusableChanged(e,t){t&&t.setAttribute("tabindex","-1"),e&&this._updateGridSectionFocusTarget(e)}_focusedCellChanged(e,t){t&&Ch(t,"part","focused-cell"),e&&Oh(e,"part","focused-cell")}_interactingChanged(){this._updateGridSectionFocusTarget(this._headerFocusable),this._updateGridSectionFocusTarget(this._itemsFocusable),this._updateGridSectionFocusTarget(this._footerFocusable)}__updateItemsFocusable(){if(!this._itemsFocusable)return;const e=this.shadowRoot.activeElement===this._itemsFocusable;this._getVisibleRows().forEach((e=>{if(e.index===this._focusedItemIndex)if(this.__rowFocusMode)this._itemsFocusable=e;else{let t=this._itemsFocusable.parentElement,i=this._itemsFocusable;if(t){this.__isCell(t)&&(i=t,t=t.parentElement);const o=[...t.children].indexOf(i);this._itemsFocusable=this.__getFocusable(e,e.children[o])}}})),e&&this._itemsFocusable.focus()}_onKeyDown(e){const t=e.key;let i;switch(t){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"PageUp":case"PageDown":case"Home":case"End":i="Navigation";break;case"Enter":case"Escape":case"F2":i="Interaction";break;case"Tab":i="Tab";break;case" ":i="Space"}this._detectInteracting(e),this.interacting&&"Interaction"!==i&&(i=void 0),i&&this[`_on${i}KeyDown`](e,t)}_ensureScrolledToIndex(e){[...this.$.items.children].find((t=>t.index===e))?this.__scrollIntoViewport(e):this.scrollToIndex(e)}__isRowExpandable(e){if(this.itemHasChildrenPath){const t=e._item;return t&&this.get(this.itemHasChildrenPath,t)&&!this._isExpanded(t)}}__isRowCollapsible(e){return this._isExpanded(e._item)}__isDetailsCell(e){return e.matches('[part~="details-cell"]')}__isCell(e){return e instanceof HTMLTableCellElement}__isRow(e){return e instanceof HTMLTableRowElement}__getIndexOfChildElement(e){return Array.prototype.indexOf.call(e.parentNode.children,e)}_onNavigationKeyDown(e,t){e.preventDefault();const i=this._lastVisibleIndex-this._firstVisibleIndex-1,o=this.__isRTL;let n=0,s=0;switch(t){case"ArrowRight":n=o?-1:1;break;case"ArrowLeft":n=o?1:-1;break;case"Home":this.__rowFocusMode||e.ctrlKey?s=-1/0:n=-1/0;break;case"End":this.__rowFocusMode||e.ctrlKey?s=1/0:n=1/0;break;case"ArrowDown":s=1;break;case"ArrowUp":s=-1;break;case"PageDown":s=i;break;case"PageUp":s=-i}const r=e.composedPath().find((e=>this.__isRow(e))),a=e.composedPath().find((e=>this.__isCell(e)));if(this.__rowFocusMode&&!r||!this.__rowFocusMode&&!a)return;const l=o?"ArrowRight":"ArrowLeft";if(t===(o?"ArrowLeft":"ArrowRight")){if(this.__rowFocusMode)return this.__isRowExpandable(r)?void this.expandItem(r._item):(this.__rowFocusMode=!1,void this._onCellNavigation(r.firstElementChild,0,0))}else if(t===l)if(this.__rowFocusMode){if(this.__isRowCollapsible(r))return void this.collapseItem(r._item)}else{const e=[...r.children].sort(((e,t)=>e._order-t._order));if(a===e[0]||this.__isDetailsCell(a))return this.__rowFocusMode=!0,void this._onRowNavigation(r,0)}this.__rowFocusMode?this._onRowNavigation(r,s):this._onCellNavigation(a,n,s)}_onRowNavigation(e,t){const{dstRow:i}=this.__navigateRows(t,e);i&&i.focus()}__getIndexInGroup(e,t){return e.parentNode===this.$.items?void 0!==t?t:e.index:this.__getIndexOfChildElement(e)}__navigateRows(e,t,i){const o=this.__getIndexInGroup(t,this._focusedItemIndex),n=t.parentNode,s=(n===this.$.items?this._effectiveSize:n.children.length)-1;let r=Math.max(0,Math.min(o+e,s));if(n!==this.$.items){if(r>o)for(;r0&&n.children[r].hidden;)r-=1;return this.toggleAttribute("navigating",!0),{dstRow:n.children[r]}}let a=!1;if(i){const s=this.__isDetailsCell(i);if(n===this.$.items){const i=t._item,n=this._cache.getItemForIndex(r);a=s?0===e:1===e&&this._isDetailsOpened(i)||-1===e&&r!==o&&this._isDetailsOpened(n),a!==s&&(1===e&&a||-1===e&&!a)&&(r=o)}}return this._ensureScrolledToIndex(r),this._focusedItemIndex=r,this.toggleAttribute("navigating",!0),{dstRow:[...n.children].find((e=>!e.hidden&&e.index===r)),dstIsRowDetails:a}}_onCellNavigation(e,t,i){const o=e.parentNode,{dstRow:n,dstIsRowDetails:s}=this.__navigateRows(i,o,e);if(!n)return;const r=this.__getIndexOfChildElement(e),a=this.__isDetailsCell(e),l=o.parentNode,h=this.__getIndexInGroup(o,this._focusedItemIndex);if(void 0===this._focusedColumnOrder&&(this._focusedColumnOrder=a?0:this._getColumns(l,h).filter((e=>!e.hidden))[r]._order),s){[...n.children].find((e=>this.__isDetailsCell(e))).focus()}else{const e=this.__getIndexInGroup(n,this._focusedItemIndex),o=this._getColumns(l,e).filter((e=>!e.hidden)),s=o.map((e=>e._order)).sort(((e,t)=>e-t)),r=s.length-1,h=s.indexOf(s.slice(0).sort(((e,t)=>Math.abs(e-this._focusedColumnOrder)-Math.abs(t-this._focusedColumnOrder)))[0]),m=0===i&&a?h:Math.max(0,Math.min(h+t,r));m!==h&&(this._focusedColumnOrder=void 0);const c=o.reduce(((e,t,i)=>(e[t._order]=i,e)),{}),d=c[s[m]],p=n.children[d];this._scrollHorizontallyToCell(p),p.focus()}}_onInteractionKeyDown(e,t){const i=e.composedPath()[0],o="input"===i.localName&&!/^(button|checkbox|color|file|image|radio|range|reset|submit)$/iu.test(i.type);let n;switch(t){case"Enter":n=!this.interacting||!o;break;case"Escape":n=!1;break;case"F2":n=!this.interacting}const{cell:s}=this._getGridEventLocation(e);if(this.interacting!==n&&null!==s)if(n){const t=s._content.querySelector("[focus-target]")||[...s._content.querySelectorAll("*")].find((e=>this._isFocusable(e)));t&&(e.preventDefault(),t.focus(),this._setInteracting(!0),this.toggleAttribute("navigating",!1))}else e.preventDefault(),this._focusedColumnOrder=void 0,s.focus(),this._setInteracting(!1),this.toggleAttribute("navigating",!0);"Escape"===t&&this._hideTooltip(!0)}_predictFocusStepTarget(e,t){const i=[this.$.table,this._headerFocusable,this._itemsFocusable,this._footerFocusable,this.$.focusexit];let o=i.indexOf(e);for(o+=t;o>=0&&o<=i.length-1;){let e=i[o];if(e&&!this.__rowFocusMode&&(e=i[o].parentNode),e&&!e.hidden)break;o+=t}return i[o]}_onTabKeyDown(e){const t=this._predictFocusStepTarget(e.composedPath()[0],e.shiftKey?-1:1);if(t){if(e.stopPropagation(),t===this.$.table)this.$.table.focus();else if(t===this.$.focusexit)this.$.focusexit.focus();else if(t===this._itemsFocusable){let i=t;const o=this.__isRow(t)?t:t.parentNode;if(this._ensureScrolledToIndex(this._focusedItemIndex),o.index!==this._focusedItemIndex&&this.__isCell(t)){const e=Array.from(o.children).indexOf(this._itemsFocusable),t=Array.from(this.$.items.children).find((e=>!e.hidden&&e.index===this._focusedItemIndex));t&&(i=t.children[e])}e.preventDefault(),i.focus()}else e.preventDefault(),t.focus();this.toggleAttribute("navigating",!0)}}_onSpaceKeyDown(e){e.preventDefault();const t=e.composedPath()[0],i=this.__isRow(t);!i&&t._content&&t._content.firstElementChild||this.dispatchEvent(new CustomEvent(i?"row-activate":"cell-activate",{detail:{model:this.__getRowModel(i?t:t.parentElement)}}))}_onKeyUp(e){if(!/^( |SpaceBar)$/u.test(e.key)||this.interacting)return;e.preventDefault();const t=e.composedPath()[0];if(t._content&&t._content.firstElementChild){const i=this.hasAttribute("navigating");t._content.firstElementChild.dispatchEvent(new MouseEvent("click",{shiftKey:e.shiftKey,bubbles:!0,composed:!0,cancelable:!0})),this.toggleAttribute("navigating",i)}}_onFocusIn(e){this._isMousedown||this.toggleAttribute("navigating",!0);const t=e.composedPath()[0];t===this.$.table||t===this.$.focusexit?(this._predictFocusStepTarget(t,t===this.$.table?1:-1).focus(),this._setInteracting(!1)):this._detectInteracting(e)}_onFocusOut(e){this.toggleAttribute("navigating",!1),this._detectInteracting(e),this._hideTooltip(),this._focusedCell=null}_onContentFocusIn(e){const{section:t,cell:i,row:o}=this._getGridEventLocation(e);if(i||this.__rowFocusMode){if(this._detectInteracting(e),t&&(i||o))if(this._activeRowGroup=t,this.$.header===t?this._headerFocusable=this.__getFocusable(o,i):this.$.items===t?this._itemsFocusable=this.__getFocusable(o,i):this.$.footer===t&&(this._footerFocusable=this.__getFocusable(o,i)),i){const t=this.getEventContext(e);i.dispatchEvent(new CustomEvent("cell-focus",{bubbles:!0,composed:!0,detail:{context:t}})),this._focusedCell=i._focusButton||i,Dm()&&e.target===i&&this._showTooltip(e)}else this._focusedCell=null;this._detectFocusedItemIndex(e)}}__getFocusable(e,t){return this.__rowFocusMode?e:t._focusButton||t}_detectInteracting(e){const t=e.composedPath().some((e=>"vaadin-grid-cell-content"===e.localName));this._setInteracting(t),this.__updateHorizontalScrollPosition()}_detectFocusedItemIndex(e){const{section:t,row:i}=this._getGridEventLocation(e);t===this.$.items&&(this._focusedItemIndex=i.index)}_updateGridSectionFocusTarget(e){if(!e)return;const t=this._getGridSectionFromFocusTarget(e),i=this.interacting&&t===this._activeRowGroup;e.tabIndex=i?-1:0}_preventScrollerRotatingCellFocus(e,t){e.index===this._focusedItemIndex&&this.hasAttribute("navigating")&&this._activeRowGroup===this.$.items&&(this._navigatingIsHidden=!0,this.toggleAttribute("navigating",!1)),t===this._focusedItemIndex&&this._navigatingIsHidden&&(this._navigatingIsHidden=!1,this.toggleAttribute("navigating",!0))}_getColumns(e,t){let i=this._columnTree.length-1;return e===this.$.header?i=t:e===this.$.footer&&(i=this._columnTree.length-1-t),this._columnTree[i]}__isValidFocusable(e){return this.$.table.contains(e)&&e.offsetHeight}_resetKeyboardNavigation(){if(["header","footer"].forEach((e=>{if(!this.__isValidFocusable(this[`_${e}Focusable`])){const t=[...this.$[e].children].find((e=>e.offsetHeight)),i=t?[...t.children].find((e=>!e.hidden)):null;t&&i&&(this[`_${e}Focusable`]=this.__getFocusable(t,i))}})),!this.__isValidFocusable(this._itemsFocusable)&&this.$.items.firstElementChild){const e=this.__getFirstVisibleItem(),t=e?[...e.children].find((e=>!e.hidden)):null;t&&e&&(delete this._focusedColumnOrder,this._itemsFocusable=this.__getFocusable(e,t))}else this.__updateItemsFocusable()}_scrollHorizontallyToCell(e){if(e.hasAttribute("frozen")||e.hasAttribute("frozen-to-end")||this.__isDetailsCell(e))return;const t=e.getBoundingClientRect(),i=e.parentNode,o=Array.from(i.children).indexOf(e),n=this.$.table.getBoundingClientRect();let s=n.left,r=n.right;for(let e=o-1;e>=0;e--){const t=i.children[e];if(!t.hasAttribute("hidden")&&!this.__isDetailsCell(t)&&(t.hasAttribute("frozen")||t.hasAttribute("frozen-to-end"))){s=t.getBoundingClientRect().right;break}}for(let e=o+1;er&&(this.$.table.scrollLeft+=Math.round(t.right-r))}_getGridEventLocation(e){const t=e.composedPath(),i=t.indexOf(this.$.table);return{section:i>=1?t[i-1]:null,row:i>=2?t[i-2]:null,cell:i>=3?t[i-3]:null}}_getGridSectionFromFocusTarget(e){return e===this._headerFocusable?this.$.header:e===this._itemsFocusable?this.$.items:e===this._footerFocusable?this.$.footer:null}},Wc=e=>class extends e{static get properties(){return{detailsOpenedItems:{type:Array,value:()=>[]},rowDetailsRenderer:Function,_detailsCells:{type:Array}}}static get observers(){return["_detailsOpenedItemsChanged(detailsOpenedItems.*, rowDetailsRenderer)","_rowDetailsRendererChanged(rowDetailsRenderer)"]}ready(){super.ready(),this._detailsCellResizeObserver=new ResizeObserver((e=>{e.forEach((({target:e})=>{this._updateDetailsCellHeight(e.parentElement)})),this.__virtualizer.__adapter._resizeHandler()}))}_rowDetailsRendererChanged(e){e&&this._columnTree&&Um(this.$.items,(e=>{if(!e.querySelector("[part~=details-cell]")){this._updateRow(e,this._columnTree[this._columnTree.length-1]);const t=this._isDetailsOpened(e._item);this._toggleDetailsCell(e,t)}}))}_detailsOpenedItemsChanged(e,t){"detailsOpenedItems.length"!==e.path&&e.value&&Um(this.$.items,(e=>{(e.hasAttribute("details-opened")||t&&this._isDetailsOpened(e._item))&&this._updateItem(e,e._item)}))}_configureDetailsCell(e){e.setAttribute("part","cell details-cell"),e.toggleAttribute("frozen",!0),this._detailsCellResizeObserver.observe(e)}_toggleDetailsCell(e,t){const i=e.querySelector('[part~="details-cell"]');i&&(i.hidden=!t,i.hidden||this.rowDetailsRenderer&&(i._renderer=this.rowDetailsRenderer))}_updateDetailsCellHeight(e){const t=e.querySelector('[part~="details-cell"]');t&&(t.hidden?e.style.removeProperty("padding-bottom"):e.style.setProperty("padding-bottom",`${t.offsetHeight}px`))}_updateDetailsCellHeights(){Um(this.$.items,(e=>{this._updateDetailsCellHeight(e)}))}_isDetailsOpened(e){return this.detailsOpenedItems&&-1!==this._getItemIndexInArray(e,this.detailsOpenedItems)}openItemDetails(e){this._isDetailsOpened(e)||(this.detailsOpenedItems=[...this.detailsOpenedItems,e])}closeItemDetails(e){this._isDetailsOpened(e)&&(this.detailsOpenedItems=this.detailsOpenedItems.filter((t=>!this._itemsEqual(t,e))))}};function _c(e,t){const{scrollLeft:i}=e;return"rtl"!==t?i:e.scrollWidth-e.clientWidth+i}const Ic=new ResizeObserver((e=>{setTimeout((()=>{e.forEach((e=>{e.target.resizables?e.target.resizables.forEach((t=>{t._onResize(e.contentRect)})):e.target._onResize(e.contentRect)}))}))})),Hc=Dn((e=>class extends e{get _observeParent(){return!1}connectedCallback(){if(super.connectedCallback(),Ic.observe(this),this._observeParent){const e=this.parentNode instanceof ShadowRoot?this.parentNode.host:this.parentNode;e.resizables||(e.resizables=new Set,Ic.observe(e)),e.resizables.add(this),this.__parent=e}}disconnectedCallback(){super.disconnectedCallback(),Ic.unobserve(this);const e=this.__parent;if(this._observeParent&&e){const t=e.resizables;t&&(t.delete(this),0===t.size&&Ic.unobserve(e)),this.__parent=null}}_onResize(e){}})),Uc=500,Rc=e=>class extends(Hc(e)){static get properties(){return{_frozenCells:{type:Array,value:()=>[]},_frozenToEndCells:{type:Array,value:()=>[]},_rowWithFocusedElement:Element}}get _scrollLeft(){return this.$.table.scrollLeft}get _scrollTop(){return this.$.table.scrollTop}set _scrollTop(e){this.$.table.scrollTop=e}ready(){super.ready(),this.scrollTarget=this.$.table,this.$.items.addEventListener("focusin",(e=>{const t=e.composedPath().indexOf(this.$.items);this._rowWithFocusedElement=e.composedPath()[t-1]})),this.$.items.addEventListener("focusout",(()=>{this._rowWithFocusedElement=void 0})),this.$.table.addEventListener("scroll",(()=>this._afterScroll()))}_onResize(){this._updateOverflow(),this.__updateHorizontalScrollPosition()}scrollToIndex(e){e=Math.min(this._effectiveSize-1,Math.max(0,e)),this.__virtualizer.scrollToIndex(e),this.__scrollIntoViewport(e)}__scrollIntoViewport(e){const t=[...this.$.items.children].find((t=>t.index===e));if(t){const e=t.getBoundingClientRect(),i=this.$.footer.getBoundingClientRect().top,o=this.$.header.getBoundingClientRect().bottom;e.bottom>i?this.$.table.scrollTop+=e.bottom-i:e.topthis.$.scroller.toggleAttribute("scrolling",!0)))),this._debounceScrolling=gh.debounce(this._debounceScrolling,fh.after(Uc),(()=>{cancelAnimationFrame(this._scrollingFrame),delete this._scrollingFrame,this.$.scroller.toggleAttribute("scrolling",!1)}))}_afterScroll(){this.__updateHorizontalScrollPosition(),this.hasAttribute("reordering")||this._scheduleScrolling(),this.hasAttribute("navigating")||this._hideTooltip(!0),this._updateOverflow()}_updateOverflow(){this._debounceOverflow=gh.debounce(this._debounceOverflow,Mh,(()=>{this.__doUpdateOverflow()}))}__doUpdateOverflow(){let e="";const t=this.$.table;t.scrollTop0&&(e+=" top");const i=_c(t,this.getAttribute("dir"));i>0&&(e+=" start"),i"start"===e?"end":"start"))),t.scrollLeft0&&(e+=" left");const o=e.trim();o.length>0&&this.getAttribute("overflow")!==o?this.setAttribute("overflow",o):0===o.length&&this.hasAttribute("overflow")&&this.removeAttribute("overflow")}_frozenCellsChanged(){this._debouncerCacheElements=gh.debounce(this._debouncerCacheElements,Kh,(()=>{Array.from(this.shadowRoot.querySelectorAll('[part~="cell"]')).forEach((e=>{e.style.transform=""})),this._frozenCells=Array.prototype.slice.call(this.$.table.querySelectorAll("[frozen]")),this._frozenToEndCells=Array.prototype.slice.call(this.$.table.querySelectorAll("[frozen-to-end]")),this.__updateHorizontalScrollPosition()})),this._debounceUpdateFrozenColumn()}_debounceUpdateFrozenColumn(){this.__debounceUpdateFrozenColumn=gh.debounce(this.__debounceUpdateFrozenColumn,Kh,(()=>this._updateFrozenColumn()))}_updateFrozenColumn(){if(!this._columnTree)return;const e=this._columnTree[this._columnTree.length-1].slice(0);let t,i;e.sort(((e,t)=>e._order-t._order));for(let o=0;o{e.style.transform=r}));const a=`translate(${this.__isRTL?o:i+t-e}px, 0)`;this._frozenToEndCells.forEach((e=>{e.style.transform=a})),this.hasAttribute("navigating")&&this.__rowFocusMode&&this.$.table.style.setProperty("--_grid-horizontal-scroll-position",-s+"px")}},Fc=e=>class extends e{static get properties(){return{selectedItems:{type:Object,notify:!0,value:()=>[]},__selectedKeys:{type:Object,computed:"__computeSelectedKeys(itemIdPath, selectedItems.*)"}}}static get observers(){return["__selectedItemsChanged(itemIdPath, selectedItems.*)"]}_isSelected(e){return this.__selectedKeys.has(this.getItemId(e))}selectItem(e){this._isSelected(e)||(this.selectedItems=[...this.selectedItems,e])}deselectItem(e){this._isSelected(e)&&(this.selectedItems=this.selectedItems.filter((t=>!this._itemsEqual(t,e))))}_toggleItem(e){this._isSelected(e)?this.deselectItem(e):this.selectItem(e)}__selectedItemsChanged(){this.requestContentUpdate()}__computeSelectedKeys(e,t){const i=t.base||[],o=new Set;return i.forEach((e=>{o.add(this.getItemId(e))})),o}};let Jc="prepend";const Lc=e=>class extends e{static get properties(){return{multiSort:{type:Boolean,value:!1},multiSortPriority:{type:String,value:()=>Jc},multiSortOnShiftClick:{type:Boolean,value:!1},_sorters:{type:Array,value:()=>[]},_previousSorters:{type:Array,value:()=>[]}}}static setDefaultMultiSortPriority(e){Jc=["append","prepend"].includes(e)?e:"prepend"}ready(){super.ready(),this.addEventListener("sorter-changed",this._onSorterChanged)}_onSorterChanged(e){const t=e.target;e.stopPropagation(),t._grid=this,this.__updateSorter(t,e.detail.shiftClick,e.detail.fromSorterClick),this.__applySorters()}__removeSorters(e){0!==e.length&&(this._sorters=this._sorters.filter((t=>e.indexOf(t)<0)),this.multiSort&&this.__updateSortOrders(),this.__applySorters())}__updateSortOrders(){this._sorters.forEach(((e,t)=>{e._order=this._sorters.length>1?t:null}))}__appendSorter(e){e.direction?this._sorters.includes(e)||this._sorters.push(e):this._removeArrayItem(this._sorters,e),this.__updateSortOrders()}__prependSorter(e){this._removeArrayItem(this._sorters,e),e.direction&&this._sorters.unshift(e),this.__updateSortOrders()}__updateSorter(e,t,i){if(e.direction||-1!==this._sorters.indexOf(e))if(e._order=null,this.multiSort&&(!this.multiSortOnShiftClick||!i)||this.multiSortOnShiftClick&&t)"append"===this.multiSortPriority?this.__appendSorter(e):this.__prependSorter(e);else if(e.direction||this.multiSortOnShiftClick){const t=this._sorters.filter((t=>t!==e));this._sorters=e.direction?[e]:[],t.forEach((e=>{e._order=null,e.direction=null}))}}__applySorters(){this.dataProvider&&this.isAttached&&JSON.stringify(this._previousSorters)!==JSON.stringify(this._mapSorters())&&this.clearCache(),this._a11yUpdateSorters(),this._previousSorters=this._mapSorters()}_mapSorters(){return this._sorters.map((e=>({path:e.path,direction:e.direction})))}_removeArrayItem(e,t){const i=e.indexOf(t);i>-1&&e.splice(i,1)}},Bc=e=>class extends e{static get properties(){return{cellClassNameGenerator:Function,cellPartNameGenerator:Function}}static get observers(){return["__cellClassNameGeneratorChanged(cellClassNameGenerator)","__cellPartNameGeneratorChanged(cellPartNameGenerator)"]}__cellClassNameGeneratorChanged(){this.generateCellClassNames()}__cellPartNameGeneratorChanged(){this.generateCellPartNames()}generateCellClassNames(){Um(this.$.items,(e=>{e.hidden||e.hasAttribute("loading")||this._generateCellClassNames(e,this.__getRowModel(e))}))}generateCellPartNames(){Um(this.$.items,(e=>{e.hidden||e.hasAttribute("loading")||this._generateCellPartNames(e,this.__getRowModel(e))}))}_generateCellClassNames(e,t){Um(e,(e=>{if(e.__generatedClasses&&e.__generatedClasses.forEach((t=>e.classList.remove(t))),this.cellClassNameGenerator){const i=this.cellClassNameGenerator(e._column,t);e.__generatedClasses=i&&i.split(" ").filter((e=>e.length>0)),e.__generatedClasses&&e.__generatedClasses.forEach((t=>e.classList.add(t)))}}))}_generateCellPartNames(e,t){Um(e,(e=>{if(e.__generatedParts&&e.__generatedParts.forEach((t=>{Fm(e,null,t)})),this.cellPartNameGenerator){const i=this.cellPartNameGenerator(e._column,t);e.__generatedParts=i&&i.split(" ").filter((e=>e.length>0)),e.__generatedParts&&e.__generatedParts.forEach((t=>{Fm(e,!0,t)}))}}))}};class Qc extends(zh(Ll(bc(yc(Oc(wc(Rc(Fc(Lc(Wc(Vc(Pc(Nc(gc(Dc(Am(Cc(Gc(Bc(Tm(Dl))))))))))))))))))))){static get template(){return yl`
-
-
-
- `}static get is(){return"vaadin-grid"}static get observers(){return["_columnTreeChanged(_columnTree, _columnTree.*)","_effectiveSizeChanged(_effectiveSize, __virtualizer, _hasData, _columnTree)"]}static get properties(){return{_safari:{type:Boolean,value:ac},_ios:{type:Boolean,value:rc},_firefox:{type:Boolean,value:nc},_android:{type:Boolean,value:ic},_touchDevice:{type:Boolean,value:lc},allRowsVisible:{type:Boolean,value:!1,reflectToAttribute:!0},_recalculateColumnWidthOnceLoadingFinished:{type:Boolean,value:!0},isAttached:{value:!1},__gridElement:{type:Boolean,value:!0}}}constructor(){super(),this.addEventListener("animationend",this._onAnimationEnd)}get _firstVisibleIndex(){const e=this.__getFirstVisibleItem();return e?e.index:void 0}get _lastVisibleIndex(){const e=this.__getLastVisibleItem();return e?e.index:void 0}connectedCallback(){super.connectedCallback(),this.isAttached=!0,this.recalculateColumnWidths()}disconnectedCallback(){super.disconnectedCallback(),this.isAttached=!1,this._hideTooltip(!0)}__getFirstVisibleItem(){return this._getVisibleRows().find((e=>this._isInViewport(e)))}__getLastVisibleItem(){return this._getVisibleRows().reverse().find((e=>this._isInViewport(e)))}_isInViewport(e){const t=this.$.table.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.$.header.getBoundingClientRect().height,n=this.$.footer.getBoundingClientRect().height;return i.bottom>t.top+o&&i.top!e.hidden)).sort(((e,t)=>e.index-t.index))}ready(){super.ready(),this.__virtualizer=new jc({createElements:this._createScrollerRows.bind(this),updateElement:this._updateScrollerItem.bind(this),scrollContainer:this.$.items,scrollTarget:this.$.table,reorderElements:!0}),new ResizeObserver((()=>setTimeout((()=>this.__updateFooterPositioning())))).observe(this.$.footer),Im(this),this._tooltipController=new _h(this),this.addController(this._tooltipController),this._tooltipController.setManual(!0)}__getBodyCellCoordinates(e){if(this.$.items.contains(e)&&"td"===e.localName)return{item:e.parentElement._item,column:e._column}}__focusBodyCell({item:e,column:t}){const i=this._getVisibleRows().find((t=>t._item===e)),o=i&&[...i.children].find((e=>e._column===t));o&&o.focus()}_effectiveSizeChanged(e,t,i,o){if(t&&i&&o){const i=this.shadowRoot.activeElement,o=this.__getBodyCellCoordinates(i),n=t.size||0;t.size=e,t.update(n-1,n-1),ee.clientHeight)).length}__itemsReceived(){this._recalculateColumnWidthOnceLoadingFinished&&!this._cache.isLoading()&&this.__hasRowsWithClientHeight()&&(this._recalculateColumnWidthOnceLoadingFinished=!1,this.recalculateColumnWidths())}__getIntrinsicWidth(e){if(this.__intrinsicWidthCache.has(e))return this.__intrinsicWidthCache.get(e);const t=this.__calculateIntrinsicWidth(e);return this.__intrinsicWidthCache.set(e,t),t}__calculateIntrinsicWidth(e){const t=e.width,i=e.flexGrow;e.width="auto",e.flexGrow=0;const o=e._allCells.filter((e=>!this.$.items.contains(e)||this._isInViewport(e.parentElement))).reduce(((e,t)=>Math.max(e,t.offsetWidth+1)),0);return e.flexGrow=i,e.width=t,o}__getDistributedWidth(e,t){if(null==e||e===this)return 0;const i=Math.max(this.__getIntrinsicWidth(e),this.__getDistributedWidth(e.parentElement,e));if(!t)return i;const o=i,n=e._visibleChildColumns.map((e=>this.__getIntrinsicWidth(e))).reduce(((e,t)=>e+t),0),s=Math.max(0,o-n),r=this.__getIntrinsicWidth(t)/n*s;return this.__getIntrinsicWidth(t)+r}_recalculateColumnWidths(e){this.__virtualizer.flush(),[...this.$.header.children,...this.$.footer.children].forEach((e=>{e.__debounceUpdateHeaderFooterRowVisibility&&e.__debounceUpdateHeaderFooterRowVisibility.flush()})),this._debouncerHiddenChanged&&this._debouncerHiddenChanged.flush(),this.__intrinsicWidthCache=new Map,e.forEach((e=>{e.width=`${this.__getDistributedWidth(e)}px`}))}recalculateColumnWidths(){if(this._columnTree)if(this._cache.isLoading())this._recalculateColumnWidthOnceLoadingFinished=!0;else{const e=this._getColumns().filter((e=>!e.hidden&&e.autoWidth));this._recalculateColumnWidths(e)}}_createScrollerRows(e){const t=[];for(let i=0;ie.isConnected&&e.notifyPath&&e.notifyPath("_cells.*",e._cells))),i=this,o=()=>{this._updateFirstAndLastColumn(),this._resetKeyboardNavigation(),this._afterScroll(),this.__itemsReceived()},ca||ja(),da.push([i,o,n]),t}_createCell(e,t){const i=`vaadin-grid-cell-content-${this._contentIndex=this._contentIndex+1||0}`,o=document.createElement("vaadin-grid-cell-content");o.setAttribute("slot",i);const n=document.createElement(e);n.id=i.replace("-content-","-"),n.setAttribute("role","td"===e?"gridcell":"columnheader"),ic||rc||(n.addEventListener("mouseenter",(e=>{this.$.scroller.hasAttribute("scrolling")||this._showTooltip(e)})),n.addEventListener("mouseleave",(()=>{this._hideTooltip()})),n.addEventListener("mousedown",(()=>{this._hideTooltip(!0)})));const s=document.createElement("slot");if(s.setAttribute("name",i),t&&t._focusButtonMode){const e=document.createElement("div");e.setAttribute("role","button"),e.setAttribute("tabindex","-1"),n.appendChild(e),n._focusButton=e,n.focus=function(){n._focusButton.focus()},e.appendChild(s)}else n.setAttribute("tabindex","-1"),n.appendChild(s);return n._content=o,o.addEventListener("mousedown",(()=>{if(oc){const e=t=>{const i=o.contains(this.getRootNode().activeElement),s=t.composedPath().includes(o);!i&&s&&n.focus(),document.removeEventListener("mouseup",e,!0)};document.addEventListener("mouseup",e,!0)}else setTimeout((()=>{o.contains(this.getRootNode().activeElement)||n.focus()}))})),n}_updateRow(e,t,i="body",o=!1,n=!1){const s=document.createDocumentFragment();Um(e,(e=>{e._vacant=!0})),e.innerHTML="",t.filter((e=>!e.hidden)).forEach(((t,r,a)=>{let l;if("body"===i){if(t._cells||(t._cells=[]),l=t._cells.find((e=>e._vacant)),l||(l=this._createCell("td",t),t._cells.push(l)),l.setAttribute("part","cell body-cell"),e.appendChild(l),r===a.length-1&&this.rowDetailsRenderer){this._detailsCells||(this._detailsCells=[]);const t=this._detailsCells.find((e=>e._vacant))||this._createCell("td");-1===this._detailsCells.indexOf(t)&&this._detailsCells.push(t),t._content.parentElement||s.appendChild(t._content),this._configureDetailsCell(t),e.appendChild(t),this._a11ySetRowDetailsCell(e,t),t._vacant=!1}t.notifyPath&&!n&&t.notifyPath("_cells.*",t._cells)}else{const n="header"===i?"th":"td";o||"vaadin-grid-column-group"===t.localName?(l=t[`_${i}Cell`]||this._createCell(n),l._column=t,e.appendChild(l),t[`_${i}Cell`]=l):(t._emptyCells||(t._emptyCells=[]),l=t._emptyCells.find((e=>e._vacant))||this._createCell(n),l._column=t,e.appendChild(l),-1===t._emptyCells.indexOf(l)&&t._emptyCells.push(l)),l.setAttribute("part",`cell ${i}-cell`)}l._content.parentElement||s.appendChild(l._content),l._vacant=!1,l._column=t})),"body"!==i&&this.__debounceUpdateHeaderFooterRowVisibility(e),this.appendChild(s),this._frozenCellsChanged(),this._updateFirstAndLastColumnForRow(e)}__debounceUpdateHeaderFooterRowVisibility(e){e.__debounceUpdateHeaderFooterRowVisibility=gh.debounce(e.__debounceUpdateHeaderFooterRowVisibility,Kh,(()=>this.__updateHeaderFooterRowVisibility(e)))}__updateHeaderFooterRowVisibility(e){if(!e)return;const t=Array.from(e.children).filter((t=>{const i=t._column;if(i._emptyCells&&i._emptyCells.indexOf(t)>-1)return!1;if(e.parentElement===this.$.header){if(i.headerRenderer)return!0;if(null===i.header)return!1;if(i.path||void 0!==i.header)return!0}else if(i.footerRenderer)return!0;return!1}));e.hidden!==!t.length&&(e.hidden=!t.length),this._resetKeyboardNavigation()}_updateScrollerItem(e,t){this._preventScrollerRotatingCellFocus(e,t),this._columnTree&&(this._updateRowOrderParts(e,t),this._a11yUpdateRowRowindex(e,t),this._getItem(t,e))}_columnTreeChanged(e){this._renderColumnTree(e),this.recalculateColumnWidths()}_updateRowOrderParts(e,t=e.index){Lm(e,{first:0===t,last:t===this._effectiveSize-1,odd:t%2!=0,even:t%2==0})}_updateRowStateParts(e,{expanded:t,selected:i,detailsOpened:o}){Lm(e,{expanded:t,selected:i,"details-opened":o})}_renderColumnTree(e){for(Um(this.$.items,(t=>{this._updateRow(t,e[e.length-1],"body",!1,!0);const i=this.__getRowModel(t);this._updateRowOrderParts(t),this._updateRowStateParts(t,i),this._filterDragAndDrop(t,i)}));this.$.header.children.lengthe.length;)this.$.header.removeChild(this.$.header.firstElementChild),this.$.footer.removeChild(this.$.footer.firstElementChild);Um(this.$.header,((t,i,o)=>{this._updateRow(t,e[i],"header",i===e.length-1);const n=Hm(t);Jm(n,"first-header-row-cell",0===i),Jm(n,"last-header-row-cell",i===o.length-1)})),Um(this.$.footer,((t,i,o)=>{this._updateRow(t,e[e.length-1-i],"footer",0===i);const n=Hm(t);Jm(n,"first-footer-row-cell",0===i),Jm(n,"last-footer-row-cell",i===o.length-1)})),this._updateRow(this.$.sizer,e[e.length-1]),this._resizeHandler(),this._frozenCellsChanged(),this._updateFirstAndLastColumn(),this._resetKeyboardNavigation(),this._a11yUpdateHeaderRows(),this._a11yUpdateFooterRows(),this.__updateFooterPositioning(),this.generateCellClassNames(),this.generateCellPartNames()}__updateFooterPositioning(){this._firefox&&parseFloat(navigator.userAgent.match(/Firefox\/(\d{2,3}.\d)/u)[1])<99&&(this.$.items.style.paddingBottom=0,this.allRowsVisible||(this.$.items.style.paddingBottom=`${this.$.footer.offsetHeight}px`))}_updateItem(e,t){e._item=t;const i=this.__getRowModel(e);this._toggleDetailsCell(e,i.detailsOpened),this._a11yUpdateRowLevel(e,i.level),this._a11yUpdateRowSelected(e,i.selected),this._updateRowStateParts(e,i),this._generateCellClassNames(e,i),this._generateCellPartNames(e,i),this._filterDragAndDrop(e,i),Um(e,(e=>{if(e._renderer){const t=e._column||this;e._renderer.call(t,e._content,t,i)}})),this._updateDetailsCellHeight(e),this._a11yUpdateRowExpanded(e,i.expanded)}_resizeHandler(){this._updateDetailsCellHeights(),this.__updateFooterPositioning(),this.__updateHorizontalScrollPosition()}_onAnimationEnd(e){0===e.animationName.indexOf("vaadin-grid-appear")&&(e.stopPropagation(),this.__itemsReceived(),requestAnimationFrame((()=>{this.__scrollToPendingIndex()})))}__getRowModel(e){return{index:e.index,item:e._item,level:this._getIndexLevel(e.index),expanded:this._isExpanded(e._item),selected:this._isSelected(e._item),detailsOpened:!!this.rowDetailsRenderer&&this._isDetailsOpened(e._item)}}_showTooltip(e){const t=this._tooltipController.node;t&&t.isConnected&&(this._tooltipController.setTarget(e.target),this._tooltipController.setContext(this.getEventContext(e)),t._stateController.open({focus:"focusin"===e.type,hover:"mouseenter"===e.type}))}_hideTooltip(e){const t=this._tooltipController.node;t&&t._stateController.close(e)}requestContentUpdate(){this._columnTree&&(this._columnTree.forEach((e=>{e.forEach((e=>{e._renderHeaderAndFooter&&e._renderHeaderAndFooter()}))})),this.__updateVisibleRows())}__updateVisibleRows(e,t){this.__virtualizer&&this.__virtualizer.update(e,t)}}customElements.define(Qc.is,Qc),rt({loader:e=>fetch(`/language/${e}.json`).then((e=>e.json()))});const $c=new pe({type:"WINDOW",source:window.parent});window.customElements.define("chat-welcome-page",class extends re{static get properties(){return{selectedAddress:{type:Object},config:{type:Object},myAddress:{type:Object,reflect:!0},messages:{type:Array},btnDisable:{type:Boolean},isLoading:{type:Boolean},balance:{type:Number},theme:{type:String,reflect:!0},setOpenPrivateMessage:{attribute:!1}}}static get styles(){return s`
- * {
- --mdc-theme-primary: rgb(3, 169, 244);
- --paper-input-container-focus-color: var(--mdc-theme-primary);
- --lumo-primary-text-color: rgb(0, 167, 245);
- --lumo-primary-color-50pct: rgba(0, 167, 245, 0.5);
- --lumo-primary-color-10pct: rgba(0, 167, 245, 0.1);
- --lumo-primary-color: hsl(199, 100%, 48%);
- --lumo-base-color: var(--white);
- --lumo-body-text-color: var(--black);
- }
-
- @keyframes moveInBottom {
- 0% {
- opacity: 0;
- transform: translateY(30px);
- }
-
- 100% {
- opacity: 1;
- transform: translate(0);
- }
- }
-
- paper-spinner-lite{
- height: 24px;
- width: 24px;
- --paper-spinner-color: var(--mdc-theme-primary);
- --paper-spinner-stroke-width: 2px;
- }
-
- .welcome-title {
- display: block;
- overflow: hidden;
- font-size: 40px;
- color: var(--black);
- font-weight: 400;
- text-align: center;
- white-space: pre-wrap;
- overflow-wrap: break-word;
- word-break: break-word;
- cursor: inherit;
- margin-top: 2rem;
- }
-
- .sub-main {
- position: relative;
- text-align: center;
- }
-
- .center-box {
- position: absolute;
- top: 45%;
- left: 50%;
- transform: translate(-50%, 0%);
- text-align: center;
- }
-
- .img-icon {
- font-size: 150px;
- color: var(--black);
- }
-
- .start-chat {
- display: inline-flex;
- flex-direction: column;
- justify-content: center;
- align-content: center;
- border: none;
- border-radius: 20px;
- padding-left: 25px;
- padding-right: 25px;
- color: var(--white);
- background: var(--tradehead);
- width: 50%;
- font-size: 17px;
- cursor: pointer;
- height: 50px;
- margin-top: 1rem;
- text-transform: uppercase;
- text-decoration: none;
- transition: all .2s;
- position: relative;
- animation: moveInBottom .3s ease-out .50s;
- animation-fill-mode: backwards;
- }
-
- .start-chat:hover {
- transform: translateY(-3px);
- box-shadow: 0 10px 20px rgba(0, 0, 0, .2);
- }
-
- .start-chat::after {
- content: "";
- display: inline-flex;
- height: 100%;
- width: 100%;
- border-radius: 100px;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- transition: all .4s;
- }
-
- .red {
- --mdc-theme-primary: red;
- }
-
- h2 {
- margin:0;
- }
-
- h2, h3, h4, h5 {
- color:# var(--black);
- font-weight: 400;
- }
-
- [hidden] {
- display: hidden !important;
- visibility: none !important;
- }
-
- .details {
- display: flex;
- font-size: 18px;
- }
-
- .title {
- font-weight:600;
- font-size:12px;
- line-height: 32px;
- opacity: 0.66;
- }
-
- .input {
- width: 90%;
- border: none;
- display: inline-block;
- font-size: 16px;
- padding: 10px 20px;
- border-radius: 5px;
- resize: none;
- background: #eee;
- }
-
- .textarea {
- width: 90%;
- border: none;
- display: inline-block;
- font-size: 16px;
- padding: 10px 20px;
- border-radius: 5px;
- height: 120px;
- resize: none;
- background: #eee;
- }
- `}constructor(){super(),this.selectedAddress=window.parent.reduxStore.getState().app.selectedAddress.address,this.myAddress={},this.balance=1,this.messages=[],this.btnDisable=!1,this.isLoading=!1,this.theme=localStorage.getItem("qortalTheme")?localStorage.getItem("qortalTheme"):"light"}render(){return C`
- =43)}})).catch((function(){return!1}))}function y(e){return"boolean"==typeof P?h.resolve(P):K(e).then((function(e){return P=e}))}function g(e){var t=w[e.name],i={};i.promise=new h((function(e,t){i.resolve=e,i.reject=t})),t.deferredOperations.push(i),t.dbReady?t.dbReady=t.dbReady.then((function(){return i.promise})):t.dbReady=i.promise}function D(e){var t=w[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function x(e,t){var i=w[e.name].deferredOperations.pop();if(i)return i.reject(t),i.promise}function b(e,t){return new h((function(i,o){if(w[e.name]=w[e.name]||A(),e.db){if(!t)return i(e.db);g(e),e.db.close()}var n=[e.name];t&&n.push(e.version);var s=r.open.apply(r,n);t&&(s.onupgradeneeded=function(t){var i=s.result;try{i.createObjectStore(e.storeName),t.oldVersion<=1&&i.createObjectStore(j)}catch(i){if("ConstraintError"!==i.name)throw i;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),o(s.error)},s.onsuccess=function(){var t=s.result;t.onversionchange=function(e){e.target.close()},i(t),D(e)}}))}function v(e){return b(e,!1)}function Y(e){return b(e,!0)}function S(e,t){if(!e.db)return!0;var i=!e.db.objectStoreNames.contains(e.storeName),o=e.versione.db.version;if(o&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||i){if(i){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function T(e){return new h((function(t,i){var o=new FileReader;o.onerror=i,o.onloadend=function(i){var o=btoa(i.target.result||"");t({__local_forage_encoded_blob:!0,data:o,type:e.type})},o.readAsBinaryString(e)}))}function X(e){return l([Z(atob(e.data))],{type:e.type})}function E(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,i=t._initReady().then((function(){var e=w[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(i,e,e),i}function z(e){g(e);for(var t=w[e.name],i=t.forages,o=0;o0&&(!e.db||"InvalidStateError"===n.name||"NotFoundError"===n.name))return h.resolve().then((function(){if(!e.db||"NotFoundError"===n.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),Y(e)})).then((function(){return z(e).then((function(){G(e,t,i,o-1)}))})).catch(i);i(n)}}function A(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function O(e){var t=this,i={db:null};if(e)for(var o in e)i[o]=e[o];var n=w[i.name];n||(n=A(),w[i.name]=n),n.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var s=[];function r(){return h.resolve()}for(var a=0;a>4,m[l++]=(15&o)<<4|n>>2,m[l++]=(3&n)<<6|63&s;return h}function je(e){var t,i=new Uint8Array(e),o="";for(t=0;t>2],o+=L[(3&i[t])<<4|i[t+1]>>4],o+=L[(15&i[t+1])<<2|i[t+2]>>6],o+=L[63&i[t+2]];return i.length%3==2?o=o.substring(0,o.length-1)+"=":i.length%3==1&&(o=o.substring(0,o.length-2)+"=="),o}function Pe(e,t){var i="";if(e&&(i=de.call(e)),e&&("[object ArrayBuffer]"===i||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var o,n=$;e instanceof ArrayBuffer?(o=e,n+=ee):(o=e.buffer,"[object Int8Array]"===i?n+=ie:"[object Uint8Array]"===i?n+=oe:"[object Uint8ClampedArray]"===i?n+=ne:"[object Int16Array]"===i?n+=se:"[object Uint16Array]"===i?n+=ae:"[object Int32Array]"===i?n+=re:"[object Uint32Array]"===i?n+=le:"[object Float32Array]"===i?n+=he:"[object Float64Array]"===i?n+=me:t(new Error("Failed to get type for BinaryArray"))),t(n+je(o))}else if("[object Blob]"===i){var s=new FileReader;s.onload=function(){var i=B+e.type+"~"+je(this.result);t($+te+i)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(i){console.error("Couldn't convert value into a JSON string: ",e),t(null,i)}}function we(e){if(e.substring(0,q)!==$)return JSON.parse(e);var t,i=e.substring(ce),o=e.substring(q,ce);if(o===te&&Q.test(i)){var n=i.match(Q);t=n[1],i=i.substring(n[0].length)}var s=pe(i);switch(o){case ee:return s;case te:return l([s],{type:t});case ie:return new Int8Array(s);case oe:return new Uint8Array(s);case ne:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case re:return new Int32Array(s);case le:return new Uint32Array(s);case he:return new Float32Array(s);case me:return new Float64Array(s);default:throw new Error("Unkown type: "+o)}}var ue={serialize:Pe,deserialize:we,stringToBuffer:pe,bufferToString:je};function fe(e,t,i,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,o)}function Me(e){var t=this,i={db:null};if(e)for(var o in e)i[o]="string"!=typeof e[o]?e[o].toString():e[o];var n=new h((function(e,o){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(e){return o(e)}i.db.transaction((function(n){fe(n,i,(function(){t._dbInfo=i,e()}),(function(e,t){o(t)}))}),o)}));return i.serializer=ue,n}function Ze(e,t,i,o,n,s){e.executeSql(i,o,n,(function(e,r){r.code===r.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,r):fe(e,t,(function(){e.executeSql(i,o,n,s)}),s)}),s):s(e,r)}),s)}function Ke(e,t){var i=this;e=d(e);var o=new h((function(t,o){i.ready().then((function(){var n=i._dbInfo;n.db.transaction((function(i){Ze(i,n,"SELECT * FROM "+n.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,i){var o=i.rows.length?i.rows.item(0).value:null;o&&(o=n.serializer.deserialize(o)),t(o)}),(function(e,t){o(t)}))}))})).catch(o)}));return m(o,t),o}function ye(e,t){var i=this,o=new h((function(t,o){i.ready().then((function(){var n=i._dbInfo;n.db.transaction((function(i){Ze(i,n,"SELECT * FROM "+n.storeName,[],(function(i,o){for(var s=o.rows,r=s.length,a=0;a0)return void s(ge.apply(n,[e,a,i,o-1]));r(t)}}))}))})).catch(r)}));return m(s,i),s}function De(e,t,i){return ge.apply(this,[e,t,i,1])}function xe(e,t){var i=this;e=d(e);var o=new h((function(t,o){i.ready().then((function(){var n=i._dbInfo;n.db.transaction((function(i){Ze(i,n,"DELETE FROM "+n.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){o(t)}))}))})).catch(o)}));return m(o,t),o}function be(e){var t=this,i=new h((function(e,i){t.ready().then((function(){var o=t._dbInfo;o.db.transaction((function(t){Ze(t,o,"DELETE FROM "+o.storeName,[],(function(){e()}),(function(e,t){i(t)}))}))})).catch(i)}));return m(i,e),i}function ve(e){var t=this,i=new h((function(e,i){t.ready().then((function(){var o=t._dbInfo;o.db.transaction((function(t){Ze(t,o,"SELECT COUNT(key) as c FROM "+o.storeName,[],(function(t,i){var o=i.rows.item(0).c;e(o)}),(function(e,t){i(t)}))}))})).catch(i)}));return m(i,e),i}function Ye(e,t){var i=this,o=new h((function(t,o){i.ready().then((function(){var n=i._dbInfo;n.db.transaction((function(i){Ze(i,n,"SELECT key FROM "+n.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,i){var o=i.rows.length?i.rows.item(0).key:null;t(o)}),(function(e,t){o(t)}))}))})).catch(o)}));return m(o,t),o}function Se(e){var t=this,i=new h((function(e,i){t.ready().then((function(){var o=t._dbInfo;o.db.transaction((function(t){Ze(t,o,"SELECT key FROM "+o.storeName,[],(function(t,i){for(var o=[],n=0;n '__WebKitDatabaseInfoTable__'",[],(function(i,o){for(var n=[],s=0;s0}function Oe(e){var t=this,i={};if(e)for(var o in e)i[o]=e[o];return i.keyPrefix=ze(e,t._defaultConfig),Ae()?(t._dbInfo=i,i.serializer=ue,h.resolve()):h.reject()}function Ce(e){var t=this,i=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,i=localStorage.length-1;i>=0;i--){var o=localStorage.key(i);0===o.indexOf(e)&&localStorage.removeItem(o)}}));return m(i,e),i}function Ne(e,t){var i=this;e=d(e);var o=i.ready().then((function(){var t=i._dbInfo,o=localStorage.getItem(t.keyPrefix+e);return o&&(o=t.serializer.deserialize(o)),o}));return m(o,t),o}function Ve(e,t){var i=this,o=i.ready().then((function(){for(var t=i._dbInfo,o=t.keyPrefix,n=o.length,s=localStorage.length,r=1,a=0;a=0;t--){var i=localStorage.key(t);0===i.indexOf(e)&&localStorage.removeItem(i)}})):h.reject("Invalid arguments"),m(o,t),o}var Fe={_driver:"localStorageWrapper",_initStorage:Oe,_support:ke(),iterate:Ve,getItem:Ne,setItem:Ue,removeItem:He,clear:Ce,length:Ie,key:We,keys:_e,dropInstance:Re},Je=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Le=function(e,t){for(var i=e.length,o=0;o{this.openDialogImage=!0},t.onload=()=>{this.isImageLoaded=!0},t.onerror=()=>{this.imageFetches<4?setTimeout((()=>{this.imageFetches=this.imageFetches+1,t.src=e}),750):this.isImageLoaded=!1},t}render(){let e="",t=!1;if(this.chatInfo.name){const t=window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node],i=`${t.protocol+"://"+t.domain+":"+t.port}/arbitrary/THUMBNAIL/${this.chatInfo.name}/qortal_avatar?async=true&apiKey=${t.apiKey}`;e=this.createImage(i)}return this.lastReadMessageTimestamp&&this.chatInfo.timestamp&&this.lastReadMessageTimestampthis.getUrl(this.chatInfo.url)} class="clearfix ${this.activeChatHeadUrl===this.chatInfo.url?"active":""}">
- ${this.isImageLoaded?C`${e}`:C``}
- ${this.isImageLoaded||this.chatInfo.name||this.chatInfo.groupName?C``:C`account_circle `}
- ${!this.isImageLoaded&&this.chatInfo.name?C`>1}},fd.from=function(e){if(e instanceof fd)return e;var t=[];if(e)for(var i in e)t.push(i,e[i]);return new fd(t)};class Kd{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;te&&!1!==i(a,o+r,n||null,s)&&a.content.size){let n=r+1;a.nodesBetween(Math.max(0,e-n),Math.min(a.content.size,t-n),i,o+n)}r=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,o){let n="",s=!0;return this.nodesBetween(e,t,((r,a)=>{r.isText?(n+=r.text.slice(Math.max(e,a)-a,t-a),s=!i):r.isLeaf?(o?n+="function"==typeof o?o(r):o:r.type.spec.leafText&&(n+=r.type.spec.leafText(r)),s=!i):!s&&r.isBlock&&(n+=i,s=!0)}),0),n}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,o=this.content.slice(),n=0;for(t.isText&&t.sameMarkup(i)&&(o[o.length-1]=t.withText(t.text+i.text),n=1);ne)for(let n=0,s=0;se&&((st)&&(r=r.isText?r.cut(Math.max(0,e-s),Math.min(r.text.length,t-s)):r.cut(Math.max(0,e-s-1),Math.min(r.content.size,t-s-1))),i.push(r),o+=r.nodeSize),s=a}return new Kd(i,o)}cutByIndex(e,t){return e==t?Kd.empty:0==e&&t==this.content.length?this:new Kd(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let o=this.content.slice(),n=this.size+t.nodeSize-i.nodeSize;return o[e]=t,new Kd(o,n)}addToStart(e){return new Kd([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Kd(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,o=0;;i++){let n=o+this.child(i).nodeSize;if(n>=e)return n==e||t>0?gd(i+1,n):gd(i,o);o=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Kd.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Kd(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Kd.empty;let t,i=0;for(let o=0;othis.type.rank&&(t||(t=e.slice(0,o)),t.push(this),i=!0),t&&t.push(n)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank)),i}};xd.none=[];class bd extends Error{}class vd{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=Sd(this.content,e+this.openStart,t);return i&&new vd(i,this.openStart,this.openEnd)}removeBetween(e,t){return new vd(Yd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return vd.empty;let i=t.openStart||0,o=t.openEnd||0;if("number"!=typeof i||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new vd(Kd.fromJSON(e,t.content),i,o)}static maxOpen(e,t=!0){let i=0,o=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)i++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)o++;return new vd(e,i,o)}}function Yd(e,t,i){let{index:o,offset:n}=e.findIndex(t),s=e.maybeChild(o),{index:r,offset:a}=e.findIndex(i);if(n==t||s.isText){if(a!=i&&!e.child(r).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(i))}if(o!=r)throw new RangeError("Removing non-flat range");return e.replaceChild(o,s.copy(Yd(s.content,t-n-1,i-n-1)))}function Sd(e,t,i,o){let{index:n,offset:s}=e.findIndex(t),r=e.maybeChild(n);if(s==t||r.isText)return o&&!o.canReplace(n,n,i)?null:e.cut(0,t).append(i).append(e.cut(t));let a=Sd(r.content,t-s-1,i);return a&&e.replaceChild(n,r.copy(a))}function Td(e,t,i){if(i.openStart>e.depth)throw new bd("Inserted content deeper than insertion position");if(e.depth-i.openStart!=t.depth-i.openEnd)throw new bd("Inconsistent open depths");return Xd(e,t,i,0)}function Xd(e,t,i,o){let n=e.index(o),s=e.node(o);if(n==t.index(o)&&o=0;e--)o=t.node(e).copy(Kd.from(o));return{start:o.resolveNoCache(e.openStart+i),end:o.resolveNoCache(o.content.size-e.openEnd-i)}}(i,e);return Ad(s,Od(e,n,r,t,o))}{let o=e.parent,n=o.content;return Ad(o,n.cut(0,e.parentOffset).append(i.content).append(n.cut(t.parentOffset)))}}return Ad(s,Cd(e,t,o))}function Ed(e,t){if(!t.type.compatibleContent(e.type))throw new bd("Cannot join "+t.type.name+" onto "+e.type.name)}function kd(e,t,i){let o=e.node(i);return Ed(o,t.node(i)),o}function zd(e,t){let i=t.length-1;i>=0&&e.isText&&e.sameMarkup(t[i])?t[i]=e.withText(t[i].text+e.text):t.push(e)}function Gd(e,t,i,o){let n=(t||e).node(i),s=0,r=t?t.index(i):n.childCount;e&&(s=e.index(i),e.depth>i?s++:e.textOffset&&(zd(e.nodeAfter,o),s++));for(let e=s;en&&kd(e,t,n+1),r=o.depth>n&&kd(i,o,n+1),a=[];return Gd(null,e,n,a),s&&r&&t.index(n)==i.index(n)?(Ed(s,r),zd(Ad(s,Od(e,t,i,o,n+1)),a)):(s&&zd(Ad(s,Cd(e,t,n+1)),a),Gd(t,i,n,a),r&&zd(Ad(r,Cd(i,o,n+1)),a)),Gd(o,null,n,a),new Kd(a)}function Cd(e,t,i){let o=[];if(Gd(null,e,i,o),e.depth>i){zd(Ad(kd(e,t,i+1),Cd(e,t,i+1)),o)}return Gd(t,null,i,o),new Kd(o)}vd.empty=new vd(Kd.empty,0,0);class Nd{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],o=e.child(t);return i?e.child(t).cut(i):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[3*t],o=0==t?0:this.path[3*t-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new Id(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],o=0,n=t;for(let t=e;;){let{index:e,offset:s}=t.content.findIndex(n),r=n-s;if(i.push(t,e,o+s),!r)break;if(t=t.child(e),t.isText)break;n=r-1,o+=s+1}return new Nd(t,i,n)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,(e=>(i.isInSet(e.marks)&&(o=!0),!o))),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Fd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=Kd.empty,o=0,n=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,o,n),r=s&&s.matchFragment(this.content,t);if(!r||!r.validEnd)return!1;for(let e=o;ee.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let o=Kd.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,i)}};Ud.prototype.text=void 0;class Rd extends Ud{constructor(e,t,i,o){if(super(e,t,null,o),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Fd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Rd(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Rd(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Fd(e,t){for(let i=e.length-1;i>=0;i--)t=e[i].type.name+"("+t+")";return t}class Jd{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new Ld(e,t);if(null==i.next)return Jd.empty;let o=Bd(i);i.next&&i.err("Unexpected trailing text");let n=function(e){let t=Object.create(null);return i(ip(e,0));function i(o){let n=[];o.forEach((t=>{e[t].forEach((({term:t,to:i})=>{if(!t)return;let o;for(let e=0;e{o||n.push([t,o=[]]),-1==o.indexOf(e)&&o.push(e)}))}))}));let s=t[o.join(",")]=new Jd(o.indexOf(e.length-1)>-1);for(let e=0;ee.to=t))}function s(e,t){if("choice"==e.type)return e.exprs.reduce(((e,i)=>e.concat(s(i,t))),[]);if("seq"!=e.type){if("star"==e.type){let r=i();return o(t,r),n(s(e.expr,r),r),[o(r)]}if("plus"==e.type){let r=i();return n(s(e.expr,t),r),n(s(e.expr,r),r),[o(r)]}if("opt"==e.type)return[o(t)].concat(s(e.expr,t));if("range"==e.type){let r=t;for(let t=0;te.createAndFill())));for(let e=0;e=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(i){e.push(i);for(let o=0;o{let o=i+(t.validEnd?"*":" ")+" ";for(let i=0;i"+e.indexOf(t.next[i].next);return o})).join("\n")}}Jd.empty=new Jd(!0);class Ld{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Bd(e){let t=[];do{t.push(Qd(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Qd(e){let t=[];do{t.push($d(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function $d(e){let t=function(e){if(e.eat("(")){let t=Bd(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let i=e.nodeTypes,o=i[t];if(o)return[o];let n=[];for(let e in i){let o=i[e];o.groups.indexOf(t)>-1&&n.push(o)}0==n.length&&e.err("No node type or group '"+t+"' found");return n}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=ep(e,t)}return t}function qd(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function ep(e,t){let i=qd(e),o=i;return e.eat(",")&&(o="}"!=e.next?qd(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:i,max:o,expr:t}}function tp(e,t){return t-e}function ip(e,t){let i=[];return function t(o){let n=e[o];if(1==n.length&&!n[0].term)return t(n[0].to);i.push(o);for(let e=0;e-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;to[t]=new e(t,i,n)));let n=i.spec.topNode||"doc";if(!o[n])throw new RangeError("Schema is missing its top node type ('"+n+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let e in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};class ap{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class lp{constructor(e,t,i,o){this.name=e,this.rank=t,this.schema=i,this.spec=o,this.attrs=sp(o.attrs),this.excluded=null;let n=op(this.attrs);this.instance=n?new xd(this,n):null}create(e=null){return!e&&this.instance?this.instance:new xd(this,np(this.attrs,e))}static compile(e,t){let i=Object.create(null),o=0;return e.forEach(((e,n)=>i[e]=new lp(e,o++,t,n))),i}removeFromSet(e){for(var t=0;t-1}}class hp{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=fd.from(e.nodes),t.marks=fd.from(e.marks||{}),this.nodes=rp.compile(this.spec.nodes,this),this.marks=lp.compile(this.spec.marks,this);let i=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],o=t.spec.content||"",n=t.spec.marks;t.contentMatch=i[o]||(i[o]=Jd.parse(o,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==n?null:n?mp(this,n.split(" ")):""!=n&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],i=t.spec.excludes;t.excluded=null==i?[t]:""==i?[]:mp(this,i.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,o){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof rp))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,i,o)}text(e,t){let i=this.nodes.text;return new Rd(i,i.defaultAttrs,e,xd.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Ud.fromJSON(this,e)}markFromJSON(e){return xd.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function mp(e,t){let i=[];for(let o=0;o-1)&&i.push(r=o)}if(!r)throw new SyntaxError("Unknown mark type: '"+t[o]+"'")}return i}class cp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let i=e.nodes[t.node];return i.contentMatch.matchType(i)}))}parse(e,t={}){let i=new up(this,t,!1);return i.addAll(e,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new up(this,t,!0);return i.addAll(e,t.from,t.to),vd.maxOpen(i.finish())}matchTag(e,t,i){for(let o=i?this.tags.indexOf(i)+1:0;oe.length&&(61!=s.charCodeAt(e.length)||s.slice(e.length+1)!=t))){if(o.getAttrs){let e=o.getAttrs(t);if(!1===e)continue;o.attrs=e||void 0}return o}}}static schemaRules(e){let t=[];function i(e){let i=null==e.priority?50:e.priority,o=0;for(;o{i(e=Mp(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)}))}for(let t in e.nodes){let o=e.nodes[t].spec.parseDOM;o&&o.forEach((e=>{i(e=Mp(e)),e.node||e.ignore||e.mark||(e.node=t)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new cp(e,cp.schemaRules(e)))}}const dp={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},pp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jp={ol:!0,ul:!0};function Pp(e,t,i){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&i}class wp{constructor(e,t,i,o,n,s,r){this.type=e,this.attrs=t,this.marks=i,this.pendingMarks=o,this.solid=n,this.options=r,this.content=[],this.activeMarks=xd.none,this.stashMarks=[],this.match=s||(4&r?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Kd.from(e));if(!t){let t,i=this.type.contentMatch;return(t=i.findWrapping(e.type))?(this.match=i,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let i=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-e[0].length))}}let t=Kd.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Kd.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,i=this.pendingMarks;t{s.clearMark(e)&&(i=e.addToSet(i))})):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),!1!==s.consuming)break;n=s}return[t,i]}addElementByRule(e,t,i){let o,n,s;if(t.node)n=this.parser.schema.nodes[t.node],n.isLeaf?this.insertNode(n.create(t.attrs))||this.leafFallback(e):o=this.enter(n,t.attrs||null,t.preserveWhitespace);else{s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s)}let r=this.top;if(n&&n.isLeaf)this.findInside(e);else if(i)this.addElement(e,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let i=e;"string"==typeof t.contentElement?i=e.querySelector(t.contentElement):"function"==typeof t.contentElement?i=t.contentElement(e):t.contentElement&&(i=t.contentElement),this.findAround(e,i,!0),this.addAll(i)}o&&this.sync(r)&&this.open--,s&&this.removePendingMark(s,r)}addAll(e,t,i){let o=t||0;for(let n=t?e.childNodes[t]:e.firstChild,s=null==i?null:e.childNodes[i];n!=s;n=n.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(n);this.findAtPoint(e,o)}findPlace(e){let t,i;for(let o=this.open;o>=0;o--){let n=this.nodes[o],s=n.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,i=n,!s.length))break;if(n.solid)break}if(!t)return!1;this.sync(i);for(let e=0;ethis.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let t=i.length-1;t>=0;t--)e+=i[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,o=!(this.isOpen||i&&i.parent.type!=this.nodes[0].type),n=-(i?i.depth+1:0)+(o?0:1),s=(e,r)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;r>=n;r--)if(s(e-1,r))return!0;return!1}{let e=r>0||0==r&&o?this.nodes[r].type:i&&r>=n?i.node(r-n).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;r--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(e){let t=function(e,t){for(let i=0;i=0;i--){let o=this.nodes[i];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let t=o.popFromStashMark(e);t&&o.type&&o.type.allowsMarkType(t.type)&&(o.activeMarks=t.addToSet(o.activeMarks))}if(o==t)break}}}function fp(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Mp(e){let t={};for(let i in e)t[i]=e[i];return t}function Zp(e,t){let i=t.schema.nodes;for(let o in i){let n=i[o];if(!n.allowsMarkType(e))continue;let s=[],r=e=>{s.push(e);for(let i=0;i{if(n.length||e.marks.length){let i=0,s=0;for(;i=0;o--){let n=this.serializeMark(e.marks[o],e.isInline,t);n&&((n.contentDOM||n.dom).appendChild(i),i=n.dom)}return i}serializeMark(e,t,i={}){let o=this.marks[e.type.name];return o&&Kp.renderSpec(gp(i),o(e,t))}static renderSpec(e,t,i=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,n=t[0],s=n.indexOf(" ");s>0&&(i=n.slice(0,s),n=n.slice(s+1));let r=i?e.createElementNS(i,n):e.createElement(n),a=t[1],l=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){l=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?r.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):r.setAttribute(e,a[e])}}for(let n=l;nl)throw new RangeError("Content hole must be the only child of its parent node");return{dom:r,contentDOM:r}}{let{dom:t,contentDOM:n}=Kp.renderSpec(e,s,i);if(r.appendChild(t),n){if(o)throw new RangeError("Multiple content holes");o=n}}}return{dom:r,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Kp(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=yp(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return yp(e.marks)}}function yp(e){let t={};for(let i in e){let o=e[i].spec.toDOM;o&&(t[i]=o)}return t}function gp(e){return e.document||window.document}const Dp=Math.pow(2,16);function xp(e){return 65535&e}class bp{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class vp{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&vp.empty)return vp.empty}recover(e){let t=0,i=xp(e);if(!this.inverted)for(let e=0;ee)break;let l=this.ranges[r+n],h=this.ranges[r+s],m=a+l;if(e<=m){let n=a+o+((l?e==a?-1:e==m?1:t:t)<0?0:h);if(i)return n;let s=e==(t<0?a:m)?null:r/3+(e-a)*Dp,c=e==a?2:e==m?1:4;return(t<0?e!=a:e!=m)&&(c|=8),new bp(n,c,s)}o+=h-l}return i?e+o:new bp(e+o,0,null)}touches(e,t){let i=0,o=xp(t),n=this.inverted?2:1,s=this.inverted?1:2;for(let t=0;te)break;let a=this.ranges[t+n];if(e<=r+a&&t==3*o)return!0;i+=this.ranges[t+s]-a}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let o=0,n=0;o=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=o&&o>t?i-o-1:void 0)}}invert(){let e=new Yp;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;ii&&te.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),o),t.openStart,t.openEnd);return Xp.fromReplace(e,this.from,this.to,n)}invert(){return new zp(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new kp(t.pos,i.pos,this.mark)}merge(e){return e instanceof kp&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kp(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kp(t.from,t.to,e.markFromJSON(t.mark))}}Tp.jsonID("addMark",kp);class zp extends Tp{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new vd(Ep(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return Xp.fromReplace(e,this.from,this.to,i)}invert(){return new kp(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new zp(t.pos,i.pos,this.mark)}merge(e){return e instanceof zp&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zp(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zp(t.from,t.to,e.markFromJSON(t.mark))}}Tp.jsonID("removeMark",zp);class Gp extends Tp{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Xp.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Xp.fromReplace(e,this.pos,this.pos+1,new vd(Kd.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let i=0;ii.pos?null:new Cp(t.pos,i.pos,o,n,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Cp(t.from,t.to,t.gapFrom,t.gapTo,vd.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Np(e,t,i){let o=e.resolve(t),n=i-t,s=o.depth;for(;n>0&&s>0&&o.indexAfter(s)==o.node(s).childCount;)s--,n--;if(n>0){let e=o.node(s).maybeChild(o.indexAfter(s));for(;n>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,n--}}return!1}function Vp(e,t,i){return(0==t||e.canReplace(t,e.childCount))&&(i==e.childCount||e.canReplace(0,i))}function Wp(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let i=e.depth;;--i){let o=e.$from.node(i),n=e.$from.index(i),s=e.$to.indexAfter(i);if(is;e--,t--){let i=n.node(e),s=n.index(e);if(i.type.spec.isolating)return!1;let r=i.content.cutByIndex(s,i.childCount),a=o&&o[t]||i;if(a!=i&&(r=r.replaceChild(0,a.type.create(a.attrs))),!i.canReplace(s+1,i.childCount)||!a.type.validContent(r))return!1}let a=n.indexAfter(s),l=o&&o[0];return n.node(s).canReplaceWith(a,a,l?l.type:n.node(s+1).type)}function Up(e,t){let i=e.resolve(t),o=i.index();return Rp(i.nodeBefore,i.nodeAfter)&&i.parent.canReplace(o,o+1)}function Rp(e,t){return!(!e||!t||e.isLeaf||!e.canAppend(t))}function Fp(e,t,i=-1){let o=e.resolve(t);for(let e=o.depth;;e--){let n,s,r=o.index(e);if(e==o.depth?(n=o.nodeBefore,s=o.nodeAfter):i>0?(n=o.node(e+1),r++,s=o.node(e).maybeChild(r)):(n=o.node(e).maybeChild(r-1),s=o.node(e+1)),n&&!n.isTextblock&&Rp(n,s)&&o.node(e).canReplace(r,r+1))return t;if(0==e)break;t=i<0?o.before(e):o.after(e)}}function Jp(e,t,i){let o=e.resolve(t);if(!i.content.size)return t;let n=i.content;for(let e=0;e=0;t--){let i=t==o.depth?0:o.pos<=(o.start(t+1)+o.end(t+1))/2?-1:1,s=o.index(t)+(i>0?1:0),r=o.node(t),a=!1;if(1==e)a=r.canReplace(s,s,n);else{let e=r.contentMatchAt(s).findWrapping(n.firstChild.type);a=e&&r.canReplaceWith(s,s,e[0])}if(a)return 0==i?o.pos:i<0?o.before(t+1):o.after(t+1)}return null}function Lp(e,t,i=t,o=vd.empty){if(t==i&&!o.size)return null;let n=e.resolve(t),s=e.resolve(i);return Bp(n,s,o)?new Op(t,i,o):new Qp(n,s,o).fit()}function Bp(e,t,i){return!i.openStart&&!i.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),i.content)}Tp.jsonID("replaceAround",Cp);class Qp{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=Kd.empty;for(let t=0;t<=e.depth;t++){let i=e.node(t);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Kd.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,o=this.close(e<0?this.$to:i.doc.resolve(e));if(!o)return null;let n=this.placed,s=i.depth,r=o.depth;for(;s&&r&&1==n.childCount;)n=n.firstChild.content,s--,r--;let a=new vd(n,s,r);return e>-1?new Cp(i.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||i.pos!=this.$to.pos?new Op(i.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,o=this.unplaced.openEnd;i1&&(o=0),n.type.spec.isolating&&o<=i){e=i;break}t=n.content}for(let t=1;t<=2;t++)for(let i=1==t?e:this.unplaced.openStart;i>=0;i--){let e,o=null;i?(o=ej(this.unplaced.content,i-1).firstChild,e=o.content):e=this.unplaced.content;let n=e.firstChild;for(let e=this.depth;e>=0;e--){let s,{type:r,match:a}=this.frontier[e],l=null;if(1==t&&(n?a.matchType(n.type)||(l=a.fillBefore(Kd.from(n),!1)):o&&r.compatibleContent(o.type)))return{sliceDepth:i,frontierDepth:e,parent:o,inject:l};if(2==t&&n&&(s=a.findWrapping(n.type)))return{sliceDepth:i,frontierDepth:e,parent:o,wrap:s};if(o&&a.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,o=ej(e,t);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new vd(e,t+1,Math.max(i,o.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,o=ej(e,t);if(o.childCount<=1&&t>0){let n=e.size-t<=t+o.size;this.unplaced=new vd($p(e,t-1,1),t-1,n?t-1:i)}else this.unplaced=new vd($p(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:o,wrap:n}){for(;this.depth>t;)this.closeFrontierNode();if(n)for(let e=0;e1||0==a||e.content.size)&&(m=t,h.push(tj(e.mark(c.allowedMarks(e.marks)),1==l?a:0,l==r.childCount?d:-1)))}let p=l==r.childCount;p||(d=-1),this.placed=qp(this.placed,t,Kd.from(h)),this.frontier[t].match=m,p&&d<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=r;e1&&o==this.$to.end(--i);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:o}=this.frontier[t],n=t=0;i--){let{match:t,type:o}=this.frontier[i],n=ij(e,i,o,t,!0);if(!n||n.childCount)continue e}return{depth:t,fit:s,move:n?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qp(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let t=e.node(i),o=t.type.contentMatch.fillBefore(t.content,!0,e.index(i));this.openFrontierNode(t.type,t.attrs,o)}return e}openFrontierNode(e,t=null,i){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=qp(this.placed,this.depth,Kd.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Kd.empty,!0);e.childCount&&(this.placed=qp(this.placed,this.frontier.length,e))}}function $p(e,t,i){return 0==t?e.cutByIndex(i,e.childCount):e.replaceChild(0,e.firstChild.copy($p(e.firstChild.content,t-1,i)))}function qp(e,t,i){return 0==t?e.append(i):e.replaceChild(e.childCount-1,e.lastChild.copy(qp(e.lastChild.content,t-1,i)))}function ej(e,t){for(let i=0;i1&&(o=o.replaceChild(0,tj(o.firstChild,t-1,1==o.childCount?i-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),i<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(Kd.empty,!0)))),e.copy(o)}function ij(e,t,i,o,n){let s=e.node(t),r=n?e.indexAfter(t):e.index(t);if(r==s.childCount&&!i.compatibleContent(s.type))return null;let a=o.fillBefore(s.content,!0,r);return a&&!function(e,t,i){for(let o=i;oo){let t=n.contentMatchAt(0),i=t.fillBefore(e).append(e);e=i.append(t.matchFragment(i).fillBefore(Kd.empty,!0))}return e}function sj(e,t){let i=[];for(let o=Math.min(e.depth,t.depth);o>=0;o--){let n=e.start(o);if(nt.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(n==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==n-1)&&i.push(o)}return i}class rj extends Tp{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return Xp.fail("No node at attribute step's position");let i=Object.create(null);for(let e in t.attrs)i[e]=t.attrs[e];i[this.attr]=this.value;let o=t.type.create(i,null,t.marks);return Xp.fromReplace(e,this.pos,this.pos+1,new vd(Kd.from(o),0,t.isLeaf?0:1))}getMap(){return vp.empty}invert(e){return new rj(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new rj(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new rj(t.pos,t.attr,t.value)}}Tp.jsonID("attr",rj);let aj=class extends Error{};aj=function e(t){let i=Error.call(this,t);return i.__proto__=e.prototype,i},(aj.prototype=Object.create(Error.prototype)).constructor=aj,aj.prototype.name="TransformError";class lj{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Yp}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new aj(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=vd.empty){let o=Lp(this.doc,e,t,i);return o&&this.step(o),this}replaceWith(e,t,i){return this.replace(e,t,new vd(Kd.from(i),0,0))}delete(e,t){return this.replace(e,t,vd.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return function(e,t,i,o){if(!o.size)return e.deleteRange(t,i);let n=e.doc.resolve(t),s=e.doc.resolve(i);if(Bp(n,s,o))return e.step(new Op(t,i,o));let r=sj(n,e.doc.resolve(i));0==r[r.length-1]&&r.pop();let a=-(n.depth+1);r.unshift(a);for(let e=n.depth,t=n.pos-1;e>0;e--,t--){let i=n.node(e).type.spec;if(i.defining||i.definingAsContext||i.isolating)break;r.indexOf(e)>-1?a=e:n.before(e)==t&&r.splice(1,0,-e)}let l=r.indexOf(a),h=[],m=o.openStart;for(let e=o.content,t=0;;t++){let i=e.firstChild;if(h.push(i),t==o.openStart)break;e=i.content}for(let e=m-1;e>=0;e--){let t=h[e].type,i=oj(t);if(i&&n.node(l).type!=t)m=e;else if(i||!t.isTextblock)break}for(let t=o.openStart;t>=0;t--){let a=(t+m+1)%(o.openStart+1),c=h[a];if(c)for(let t=0;t=0&&(e.replace(t,i,o),!(e.steps.length>c));a--){let e=r[a];e<0||(t=n.before(e),i=s.after(e))}}(this,e,t,i),this}replaceRangeWith(e,t,i){return function(e,t,i,o){if(!o.isInline&&t==i&&e.doc.resolve(t).parent.content.size){let n=function(e,t,i){let o=e.resolve(t);if(o.parent.canReplaceWith(o.index(),o.index(),i))return t;if(0==o.parentOffset)for(let e=o.depth-1;e>=0;e--){let t=o.index(e);if(o.node(e).canReplaceWith(t,t,i))return o.before(e+1);if(t>0)return null}if(o.parentOffset==o.parent.content.size)for(let e=o.depth-1;e>=0;e--){let t=o.indexAfter(e);if(o.node(e).canReplaceWith(t,t,i))return o.after(e+1);if(t0&&(r||o.node(i-1).canReplace(o.index(i-1),n.indexAfter(i-1))))return e.delete(o.before(i),n.after(i))}for(let s=1;s<=o.depth&&s<=n.depth;s++)if(t-o.start(s)==o.depth-s&&i>o.end(s)&&n.end(s)-i!=n.depth-s)return e.delete(o.before(s),i);e.delete(t,i)}(this,e,t),this}lift(e,t){return function(e,t,i){let{$from:o,$to:n,depth:s}=t,r=o.before(s+1),a=n.after(s+1),l=r,h=a,m=Kd.empty,c=0;for(let e=s,t=!1;e>i;e--)t||o.index(e)>0?(t=!0,m=Kd.from(o.node(e).copy(m)),c++):l--;let d=Kd.empty,p=0;for(let e=s,t=!1;e>i;e--)t||n.after(e+1)=0;e--){if(o.size){let t=i[e].type.contentMatch.matchFragment(o);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=Kd.from(i[e].type.create(i[e].attrs,o))}let n=t.start,s=t.end;e.step(new Cp(n,s,n,s,new vd(o,0,0),i.length,!0))}(this,e,t),this}setBlockType(e,t=e,i,o=null){return function(e,t,i,o,n){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,i,((t,i)=>{if(t.isTextblock&&!t.hasMarkup(o,n)&&function(e,t,i){let o=e.resolve(t),n=o.index();return o.parent.canReplaceWith(n,n+1,i)}(e.doc,e.mapping.slice(s).map(i),o)){e.clearIncompatible(e.mapping.slice(s).map(i,1),o);let r=e.mapping.slice(s),a=r.map(i,1),l=r.map(i+t.nodeSize,1);return e.step(new Cp(a,l,a+1,l-1,new vd(Kd.from(o.create(n,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,i,o),this}setNodeMarkup(e,t,i=null,o){return function(e,t,i,o,n){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");i||(i=s.type);let r=i.create(o,null,n||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,r);if(!i.validContent(s.content))throw new RangeError("Invalid content for node type "+i.name);e.step(new Cp(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new vd(Kd.from(r),0,0),1,!0))}(this,e,t,i,o),this}setNodeAttribute(e,t,i){return this.step(new rj(e,t,i)),this}addNodeMark(e,t){return this.step(new Gp(e,t)),this}removeNodeMark(e,t){if(!(t instanceof xd)){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(i.marks)))return this}return this.step(new Ap(e,t)),this}split(e,t=1,i){return function(e,t,i=1,o){let n=e.doc.resolve(t),s=Kd.empty,r=Kd.empty;for(let e=n.depth,t=n.depth-i,a=i-1;e>t;e--,a--){s=Kd.from(n.node(e).copy(s));let t=o&&o[a];r=Kd.from(t?t.type.create(t.attrs,r):n.node(e).copy(r))}e.step(new Op(t,t,new vd(s.append(r),i,i),!0))}(this,e,t,i),this}addMark(e,t,i){return function(e,t,i,o){let n,s,r=[],a=[];e.doc.nodesBetween(t,i,((e,l,h)=>{if(!e.isInline)return;let m=e.marks;if(!o.isInSet(m)&&h.type.allowsMarkType(o.type)){let h=Math.max(l,t),c=Math.min(l+e.nodeSize,i),d=o.addToSet(m);for(let e=0;ee.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,i),this}removeMark(e,t,i){return function(e,t,i,o){let n=[],s=0;e.doc.nodesBetween(t,i,((e,r)=>{if(!e.isInline)return;s++;let a=null;if(o instanceof lp){let t,i=e.marks;for(;t=o.isInSet(i);)(a||(a=[])).push(t),i=t.removeFromSet(i)}else o?o.isInSet(e.marks)&&(a=[o]):a=e.marks;if(a&&a.length){let o=Math.min(r+e.nodeSize,i);for(let e=0;ee.step(new zp(t.from,t.to,t.style))))}(this,e,t,i),this}clearIncompatible(e,t,i){return function(e,t,i,o=i.contentMatch){let n=e.doc.nodeAt(t),s=[],r=t+1;for(let t=0;t=0;t--)e.step(s[t])}(this,e,t,i),this}}const hj=Object.create(null);class mj{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new cj(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;o--){let n=t<0?Zj(e.node(0),e.node(o),e.before(o+1),e.index(o),t,i):Zj(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,i);if(n)return n}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new fj(e.node(0))}static atStart(e){return Zj(e,e,0,0,1)||new fj(e)}static atEnd(e){return Zj(e,e,e.content.size,e.childCount,-1)||new fj(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=hj[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in hj)throw new RangeError("Duplicate use of selection JSON ID "+e);return hj[e]=t,t.prototype.jsonID=e,t}getBookmark(){return jj.between(this.$anchor,this.$head).getBookmark()}}mj.prototype.visible=!0;class cj{constructor(e,t){this.$from=e,this.$to=t}}let dj=!1;function pj(e){dj||e.parent.inlineContent||(dj=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class jj extends mj{constructor(e,t=e){pj(e),pj(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return mj.near(i);let o=e.resolve(t.map(this.anchor));return new jj(o.parent.inlineContent?o:i,i)}replace(e,t=vd.empty){if(super.replace(e,t),t==vd.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof jj&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Pj(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new jj(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let o=e.resolve(t);return new this(o,i==t?o:e.resolve(i))}static between(e,t,i){let o=e.pos-t.pos;if(i&&!o||(i=o>=0?1:-1),!t.parent.inlineContent){let e=mj.findFrom(t,i,!0)||mj.findFrom(t,-i,!0);if(!e)return mj.near(t,i);t=e.$head}return e.parent.inlineContent||(0==o||(e=(mj.findFrom(e,-i,!0)||mj.findFrom(e,i,!0)).$anchor).posnew fj(e)};function Zj(e,t,i,o,n,s=!1){if(t.inlineContent)return jj.create(e,i);for(let r=o-(n>0?0:1);n>0?r=0;r+=n){let o=t.child(r);if(o.isAtom){if(!s&&wj.isSelectable(o))return wj.create(e,i-(n<0?o.nodeSize:0))}else{let t=Zj(e,o,i+n,n<0?o.childCount:0,n,s);if(t)return t}i+=o.nodeSize*n}return null}function Kj(e,t,i){let o=e.steps.length-1;if(o{null==n&&(n=o)})),e.setSelection(mj.near(e.doc.resolve(n),i)))}class yj extends lj{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return xd.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||xd.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let o=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(null==i&&(i=t),i=null==i?t:i,!e)return this.deleteRange(t,i);let n=this.storedMarks;if(!n){let e=this.doc.resolve(t);n=i==t?e.marks():e.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,o.text(e,n)),this.selection.empty||this.setSelection(mj.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function gj(e,t){return t&&e?e.bind(t):e}class Dj{constructor(e,t,i){this.name=e,this.init=gj(t.init,i),this.apply=gj(t.apply,i)}}const xj=[new Dj("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Dj("selection",{init:(e,t)=>e.selection||mj.atStart(t.doc),apply:e=>e.selection}),new Dj("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,i,o)=>o.selection.$cursor?e.storedMarks:null}),new Dj("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class bj{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xj.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Dj(e.key,e.spec.state,e))}))}}class vj{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let i=0;ie.toJSON()))),e&&"object"==typeof e)for(let i in e){if("doc"==i||"selection"==i)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[i],n=o.spec.state;n&&n.toJSON&&(t[i]=n.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new bj(e.schema,e.plugins),n=new vj(o);return o.fields.forEach((o=>{if("doc"==o.name)n.doc=Ud.fromJSON(e.schema,t.doc);else if("selection"==o.name)n.selection=mj.fromJSON(n.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(n.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let s in i){let r=i[s],a=r.spec.state;if(r.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,s))return void(n[o.name]=a.fromJSON.call(r,e,t[s],n))}n[o.name]=o.init(e,n)}})),n}}function Yj(e,t,i){for(let o in e){let n=e[o];n instanceof Function?n=n.bind(t):"handleDOMEvents"==o&&(n=Yj(n,t,{})),i[o]=n}return i}class Sj{constructor(e){this.spec=e,this.props={},e.props&&Yj(e.props,this,this.props),this.key=e.key?e.key.key:Xj("plugin")}getState(e){return e[this.key]}}const Tj=Object.create(null);function Xj(e){return e in Tj?e+"$"+ ++Tj[e]:(Tj[e]=0,e+"$")}class Ej{constructor(e="key"){this.key=Xj(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const kj=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},zj=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Gj=null;const Aj=function(e,t,i){let o=Gj||(Gj=document.createRange());return o.setEnd(e,null==i?e.nodeValue.length:i),o.setStart(e,t||0),o},Oj=function(e,t,i,o){return i&&(Nj(e,t,i,o,-1)||Nj(e,t,i,o,1))},Cj=/^(img|br|input|textarea|hr)$/i;function Nj(e,t,i,o,n){for(;;){if(e==i&&t==o)return!0;if(t==(n<0?0:Vj(e))){let i=e.parentNode;if(!i||1!=i.nodeType||Wj(e)||Cj.test(e.nodeName)||"false"==e.contentEditable)return!1;t=kj(e)+(n<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(n<0?-1:0)]).contentEditable)return!1;t=n<0?Vj(e):0}}}function Vj(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Wj(e){let t;for(let i=e;i&&!(t=i.pmViewDesc);i=i.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const _j=function(e){return e.focusNode&&Oj(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ij(e,t){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=e,i.key=i.code=t,i}const Hj="undefined"!=typeof navigator?navigator:null,Uj="undefined"!=typeof document?document:null,Rj=Hj&&Hj.userAgent||"",Fj=/Edge\/(\d+)/.exec(Rj),Jj=/MSIE \d/.exec(Rj),Lj=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rj),Bj=!!(Jj||Lj||Fj),Qj=Jj?document.documentMode:Lj?+Lj[1]:Fj?+Fj[1]:0,$j=!Bj&&/gecko\/(\d+)/i.test(Rj);$j&&(/Firefox\/(\d+)/.exec(Rj)||[0,0])[1];const qj=!Bj&&/Chrome\/(\d+)/.exec(Rj),eP=!!qj,tP=qj?+qj[1]:0,iP=!Bj&&!!Hj&&/Apple Computer/.test(Hj.vendor),oP=iP&&(/Mobile\/\w+/.test(Rj)||!!Hj&&Hj.maxTouchPoints>2),nP=oP||!!Hj&&/Mac/.test(Hj.platform),sP=!!Hj&&/Win/.test(Hj.platform),rP=/Android \d/.test(Rj),aP=!!Uj&&"webkitFontSmoothing"in Uj.documentElement.style,lP=aP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function hP(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function mP(e,t){return"number"==typeof e?e:e[t]}function cP(e){let t=e.getBoundingClientRect(),i=t.width/e.offsetWidth||1,o=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*i,top:t.top,bottom:t.top+e.clientHeight*o}}function dP(e,t,i){let o=e.someProp("scrollThreshold")||0,n=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let r=i||e.dom;r;r=zj(r)){if(1!=r.nodeType)continue;let e=r,i=e==s.body,a=i?hP(s):cP(e),l=0,h=0;if(t.topa.bottom-mP(o,"bottom")&&(h=t.bottom-a.bottom+mP(n,"bottom")),t.lefta.right-mP(o,"right")&&(l=t.right-a.right+mP(n,"right")),l||h)if(i)s.defaultView.scrollBy(l,h);else{let i=e.scrollLeft,o=e.scrollTop;h&&(e.scrollTop+=h),l&&(e.scrollLeft+=l);let n=e.scrollLeft-i,s=e.scrollTop-o;t={left:t.left-n,top:t.top-s,right:t.right-n,bottom:t.bottom-s}}if(i)break}}function pP(e){let t=[],i=e.ownerDocument;for(let o=e;o&&(t.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),e!=i);o=zj(o));return t}function jP(e,t){for(let i=0;i=h){l=Math.max(p.bottom,l),h=Math.min(p.top,h);let e=p.left>t.left?p.left-t.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!n&&p.left<=t.left&&p.right>=t.left&&(n=m,s={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!i&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=c+1)}}return!i&&n&&(i=n,o=s,r=0),i&&3==i.nodeType?function(e,t){let i=e.nodeValue.length,o=document.createRange();for(let n=0;n=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}(i,o):!i||r&&1==i.nodeType?{node:e,offset:a}:wP(i,o)}function uP(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function fP(e,t,i){let o=e.childNodes.length;if(o&&i.topt.top&&n++}i==e.dom&&n==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?r=e.state.doc.content.size:0!=n&&1==i.nodeType&&"BR"==i.childNodes[n-1].nodeName||(r=function(e,t,i,o){let n=-1;for(let i=t,s=!1;i!=e.dom;){let t=e.docView.nearestDesc(i,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!s||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!s&&(s=!0,e.left>o.left||e.top>o.top?n=t.posBefore:(e.right-1?n:e.docView.posFromDOM(t,i,-1)}(e,i,n,t))}null==r&&(r=function(e,t,i){let{node:o,offset:n}=wP(t,i),s=-1;if(1==o.nodeType&&!o.firstChild){let e=o.getBoundingClientRect();s=e.left!=e.right&&i.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(o,n,s)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:r,inside:l?l.posAtStart-l.border:-1}}function ZP(e){return e.top=0&&n==o.nodeValue.length?(e--,s=1):i<0?e--:t++,DP(KP(Aj(o,e,t),s),s<0)}{let e=KP(Aj(o,n,n),i);if($j&&n&&/\s/.test(o.nodeValue[n-1])&&n=0)}if(null==s&&n&&(i<0||n==Vj(o))){let e=o.childNodes[n-1],t=3==e.nodeType?Aj(e,Vj(e)-(r?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return DP(KP(t,1),!1)}if(null==s&&n=0)}function DP(e,t){if(0==e.width)return e;let i=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:i,right:i}}function xP(e,t){if(0==e.height)return e;let i=t?e.top:e.bottom;return{top:i,bottom:i,left:e.left,right:e.right}}function bP(e,t,i){let o=e.state,n=e.root.activeElement;o!=t&&e.updateState(t),n!=e.dom&&e.focus();try{return i()}finally{o!=t&&e.updateState(o),n!=e.dom&&n&&n.focus()}}const vP=/[\u0590-\u08ac]/;let YP=null,SP=null,TP=!1;function XP(e,t,i){return YP==t&&SP==i?TP:(YP=t,SP=i,TP="up"==i||"down"==i?function(e,t,i){let o=t.selection,n="up"==i?o.$from:o.$to;return bP(e,t,(()=>{let{node:t}=e.docView.domFromPos(n.pos,"up"==i?-1:1);for(;;){let i=e.docView.nearestDesc(t,!0);if(!i)break;if(i.node.isBlock){t=i.contentDOM||i.dom;break}t=i.dom.parentNode}let o=gP(e,n.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Aj(e,0,e.nodeValue.length).getClientRects()}for(let e=0;en.top+1&&("up"==i?o.top-n.top>2*(n.bottom-o.top):n.bottom-o.bottom>2*(o.bottom-n.top)))return!1}}return!0}))}(e,t,i):function(e,t,i){let{$head:o}=t.selection;if(!o.parent.isTextblock)return!1;let n=o.parentOffset,s=!n,r=n==o.parent.content.size,a=e.domSelection();return vP.test(o.parent.textContent)&&a.modify?bP(e,t,(()=>{let{focusNode:t,focusOffset:n,anchorNode:s,anchorOffset:r}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",i,"character");let h=o.depth?e.docView.domAfterPos(o.before()):e.dom,{focusNode:m,focusOffset:c}=e.domSelectionRange(),d=m&&!h.contains(1==m.nodeType?m:m.parentNode)||t==m&&n==c;try{a.collapse(s,r),t&&(t!=s||n!=r)&&a.extend&&a.extend(t,n)}catch(e){}return null!=l&&(a.caretBidiLevel=l),d})):"left"==i||"backward"==i?s:r}(e,t,i))}class EP{constructor(e,t,i,o){this.parent=e,this.children=t,this.dom=i,this.contentDOM=o,this.dirty=0,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tkj(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!1;break}if(t.previousSibling)break}if(null==o&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!0;break}if(t.nextSibling)break}}return(null==o?i>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,o=e;o;o=o.parentNode){let n,s=this.getDesc(o);if(s&&(!t||s.node)){if(!i||!(n=s.nodeDOM)||(1==n.nodeType?n.contains(1==e.nodeType?e:e.parentNode):n==e))return s;i=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,i){for(let o=e;o;o=o.parentNode){let n=this.getDesc(o);if(n)return n.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;te||n instanceof NP){o=e-t;break}t=s}if(o)return this.children[i].domFromPos(o-this.children[i].border,t);for(let e;i&&!(e=this.children[i-1]).size&&e instanceof kP&&e.side>=0;i--);if(t<=0){let e,o=!0;for(;e=i?this.children[i-1]:null,e&&e.dom.parentNode!=this.contentDOM;i--,o=!1);return e&&t&&o&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?kj(e.dom)+1:0}}{let e,o=!0;for(;e=i=n&&t<=a-i.border&&i.node&&i.contentDOM&&this.contentDOM.contains(i.contentDOM))return i.parseRange(e,t,n);e=s;for(let t=r;t>0;t--){let i=this.children[t-1];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(1)){o=kj(i.dom)+1;break}e-=i.size}-1==o&&(o=0)}if(o>-1&&(a>t||r==this.children.length-1)){t=a;for(let e=r+1;ea&&st){let e=r;r=a,a=e}let i=document.createRange();i.setEnd(a.node,a.offset),i.setStart(r.node,r.offset),l.removeAllRanges(),l.addRange(i)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let i=0,o=0;o=i:ei){let o=i+n.border,r=s-n.border;if(e>=o&&t<=r)return this.dirty=e==i||t==s?2:1,void(e!=o||t!=r||!n.contentLost&&n.dom.parentNode==this.contentDOM?n.markDirty(e-o,t-o):n.dirty=3);n.dirty=n.dom!=n.contentDOM||n.dom.parentNode!=this.contentDOM||n.children.length?3:2}i=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=1==e?2:1;t.dirtyn?n.parent?n.parent.posBeforeChild(n):void 0:o))),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,n=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class zP extends EP{constructor(e,t,i,o){super(e,[],t,null),this.textDOM=i,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class GP extends EP{constructor(e,t,i,o){super(e,[],i,o),this.mark=t}static create(e,t,i,o){let n=o.nodeViews[t.type.name],s=n&&n(t,o,i);return s&&s.dom||(s=Kp.renderSpec(document,t.type.spec.toDOM(t,i))),new GP(e,t,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty0&&(n=$P(n,0,e,i));for(let e=0;er?r.parent?r.parent.posBeforeChild(r):void 0:s),i,o),h=l&&l.dom,m=l&&l.contentDOM;if(t.isText)if(h){if(3!=h.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else h=document.createTextNode(t.text);else h||({dom:h,contentDOM:m}=Kp.renderSpec(document,t.type.spec.toDOM(t)));m||t.isText||"BR"==h.nodeName||(h.hasAttribute("contenteditable")||(h.contentEditable="false"),t.type.spec.draggable&&(h.draggable=!0));let c=h;return h=FP(h,i,t),l?r=new VP(e,t,i,o,h,m||null,c,l,n,s+1):t.isText?new CP(e,t,i,o,h,c,n):new AP(e,t,i,o,h,m||null,c,n,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Kd.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,i){return 0==this.dirty&&e.eq(this.node)&&JP(t,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let i=this.node.inlineContent,o=t,n=e.composing?this.localCompositionInfo(e,t):null,s=n&&n.pos>-1?n:null,r=n&&n.pos<0,a=new BP(this,s&&s.node,e);!function(e,t,i,o){let n=t.locals(e),s=0;if(0==n.length){for(let i=0;is;)a.push(n[r++]);let d=s+m.nodeSize;if(m.isText){let e=d;r!e.inline)):a.slice();o(m,p,t.forChild(s,m),c),s=d}}(this.node,this.innerDeco,((t,n,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,i,e):t.type.side>=0&&!s&&a.syncToMarks(n==this.node.childCount?xd.none:this.node.child(n).marks,i,e),a.placeWidget(t,e,o)}),((t,s,l,h)=>{let m;a.syncToMarks(t.marks,i,e),a.findNodeMatch(t,s,l,h)||r&&e.state.selection.from>o&&e.state.selection.to-1&&a.updateNodeAt(t,s,l,m,e)||a.updateNextNode(t,s,l,e,h,o)||a.addNode(t,s,l,e,o),o+=t.nodeSize})),a.syncToMarks([],i,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),WP(this.contentDOM,this.children,e),oP&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:i,to:o}=e.state.selection;if(!(e.state.selection instanceof jj)||it+this.node.content.size)return null;let n=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=Vj(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t=i){let e=a=0&&e+t.length+a>=i)return a+e;if(i==o&&l.length>=o+t.length-a&&l.slice(o-a,o-a+t.length)==t)return o}}return-1}(this.node.content,e,i-t,o-t);return n<0?null:{node:s,pos:n,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:o}){if(this.getDesc(t))return;let n=t;for(;n.parentNode!=this.contentDOM;n=n.parentNode){for(;n.previousSibling;)n.parentNode.removeChild(n.previousSibling);for(;n.nextSibling;)n.parentNode.removeChild(n.nextSibling);n.pmViewDesc&&(n.pmViewDesc=void 0)}let s=new zP(this,n,t,o);e.input.compositionNodes.push(s),this.children=$P(this.children,i,i+o.length,e,s)}update(e,t,i,o){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,i,o),!0)}updateInner(e,t,i,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(JP(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=UP(this.dom,this.nodeDOM,HP(this.outerDeco,this.node,t),HP(e,this.node,t)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function OP(e,t,i,o,n){FP(o,t,e);let s=new AP(void 0,e,t,i,o,o,o,n,0);return s.contentDOM&&s.updateChildren(n,0),s}class CP extends AP{constructor(e,t,i,o,n,s,r){super(e,t,i,o,n,null,s,r,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,i,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,i){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,i)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,i){let o=this.node.cut(e,t),n=document.createTextNode(o.text);return new CP(this.parent,o,this.outerDeco,this.innerDeco,n,n,i)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class NP extends EP{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class VP extends AP{constructor(e,t,i,o,n,s,r,a,l,h){super(e,t,i,o,n,s,r,l,h),this.spec=a}update(e,t,i,o){if(3==this.dirty)return!1;if(this.spec.update){let n=this.spec.update(e,t,i);return n&&this.updateInner(e,t,i,o),n}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,i,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,o){this.spec.setSelection?this.spec.setSelection(e,t,i):super.setSelection(e,t,i,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function WP(e,t,i){let o=e.firstChild,n=!1;for(let s=0;s0;){let a;for(;;)if(o){let e=i.children[o-1];if(!(e instanceof GP)){a=e,o--;break}i=e,o=e.children.length}else{if(i==t)break e;o=i.parent.children.indexOf(i),i=i.parent}let l=a.node;if(l){if(l!=e.child(n-1))break;--n,s.set(a,n),r.push(a)}}return{index:n,matched:s,matches:r.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let i=e;i>1,s=Math.min(n,e.length);for(;o-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let o=GP.create(this.top,e[n],t,i);this.top.children.splice(this.index,0,o),this.top=o,this.changed=!0}this.index=0,n++}}findNodeMatch(e,t,i,o){let n,s=-1;if(o>=this.preMatch.index&&(n=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&n.matchesNode(e,t,i))s=this.top.children.indexOf(n,this.index);else for(let o=this.index,n=Math.min(this.top.children.length,o+5);o=i||m<=t?s.push(l):(hi&&s.push(l.slice(i-h,l.size,o)))}return s}function qP(e,t=null){let i=e.domSelectionRange(),o=e.state.doc;if(!i.focusNode)return null;let n=e.docView.nearestDesc(i.focusNode),s=n&&0==n.size,r=e.docView.posFromDOM(i.focusNode,i.focusOffset,1);if(r<0)return null;let a,l,h=o.resolve(r);if(_j(i)){for(a=h;n&&!n.node;)n=n.parent;let e=n.node;if(n&&e.isAtom&&wj.isSelectable(e)&&n.parent&&(!e.isInline||!function(e,t,i){for(let o=0==t,n=t==Vj(e);o||n;){if(e==i)return!0;let t=kj(e);if(!(e=e.parentNode))return!1;o=o&&0==t,n=n&&t==Vj(e)}}(i.focusNode,i.focusOffset,n.dom))){let e=n.posBefore;l=new wj(r==e?h:o.resolve(e))}}else{let t=e.docView.posFromDOM(i.anchorNode,i.anchorOffset,1);if(t<0)return null;a=o.resolve(t)}if(!l){l=lw(e,a,h,"pointer"==t||e.state.selection.head{i.anchorNode==o&&i.anchorOffset==n||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{ew(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const iw=iP||eP&&tP<63;function ow(e,t){let{node:i,offset:o}=e.docView.domFromPos(t,0),n=oo(e,t,i)))||jj.between(t,i,o)}function hw(e){return!(e.editable&&!e.hasFocus())&&mw(e)}function mw(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function cw(e,t){let{$anchor:i,$head:o}=e.selection,n=t>0?i.max(o):i.min(o),s=n.parent.inlineContent?n.depth?e.doc.resolve(t>0?n.after():n.before()):null:n;return s&&mj.findFrom(s,t)}function dw(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function pw(e,t,i){let o=e.state.selection;if(!(o instanceof jj)){if(o instanceof wj&&o.node.isInline)return dw(e,new jj(t>0?o.$to:o.$from));{let i=cw(e.state,t);return!!i&&dw(e,i)}}if(!o.empty||i.indexOf("s")>-1)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let i=cw(e.state,t);return!!(i&&i instanceof wj)&&dw(e,i)}if(!(nP&&i.indexOf("m")>-1)){let i,n=o.$head,s=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!s||s.isText)return!1;let r=t<0?n.pos-s.nodeSize:n.pos;return!!(s.isAtom||(i=e.docView.descAt(r))&&!i.contentDOM)&&(wj.isSelectable(s)?dw(e,new wj(t<0?e.state.doc.resolve(n.pos-s.nodeSize):n)):!!aP&&dw(e,new jj(e.state.doc.resolve(t<0?r:r+s.nodeSize))))}}function jw(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Pw(e){let t=e.pmViewDesc;return t&&0==t.size&&(e.nextSibling||"BR"!=e.nodeName)}function ww(e,t){return t<0?function(e){let t=e.domSelectionRange(),i=t.focusNode,o=t.focusOffset;if(!i)return;let n,s,r=!1;$j&&1==i.nodeType&&o0){if(1!=i.nodeType)break;{let e=i.childNodes[o-1];if(Pw(e))n=i,s=--o;else{if(3!=e.nodeType)break;i=e,o=i.nodeValue.length}}}else{if(fw(i))break;{let t=i.previousSibling;for(;t&&Pw(t);)n=i.parentNode,s=kj(t),t=t.previousSibling;if(t)i=t,o=jw(i);else{if(i=i.parentNode,i==e.dom)break;o=0}}}r?Mw(e,i,o):n&&Mw(e,n,s)}(e):uw(e)}function uw(e){let t=e.domSelectionRange(),i=t.focusNode,o=t.focusOffset;if(!i)return;let n,s,r=jw(i);for(;;)if(o{e.state==n&&tw(e)}),50)}function Zw(e,t){let i=e.state.doc.resolve(t);if(!eP&&!sP&&i.parent.inlineContent){let o=e.coordsAtPos(t);if(t>i.start()){let i=e.coordsAtPos(t-1),n=(i.top+i.bottom)/2;if(n>o.top&&n1)return i.lefto.top&&n1)return i.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Kw(e,t,i){let o=e.state.selection;if(o instanceof jj&&!o.empty||i.indexOf("s")>-1)return!1;if(nP&&i.indexOf("m")>-1)return!1;let{$from:n,$to:s}=o;if(!n.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let i=cw(e.state,t);if(i&&i instanceof wj)return dw(e,i)}if(!n.parent.inlineContent){let i=t<0?n:s,r=o instanceof fj?mj.near(i,t):mj.findFrom(i,t);return!!r&&dw(e,r)}return!1}function yw(e,t){if(!(e.state.selection instanceof jj))return!0;let{$head:i,$anchor:o,empty:n}=e.state.selection;if(!i.sameParent(o))return!0;if(!n)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!i.textOffset&&(t<0?i.nodeBefore:i.nodeAfter);if(s&&!s.isText){let o=e.state.tr;return t<0?o.delete(i.pos-s.nodeSize,i.pos):o.delete(i.pos,i.pos+s.nodeSize),e.dispatch(o),!0}return!1}function gw(e,t,i){e.domObserver.stop(),t.contentEditable=i,e.domObserver.start()}function Dw(e,t){let i=t.keyCode,o=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==i||nP&&72==i&&"c"==o)return yw(e,-1)||ww(e,-1);if(46==i||nP&&68==i&&"c"==o)return yw(e,1)||ww(e,1);if(13==i||27==i)return!0;if(37==i||nP&&66==i&&"c"==o){let t=37==i?"ltr"==Zw(e,e.state.selection.from)?-1:1:-1;return pw(e,t,o)||ww(e,t)}if(39==i||nP&&70==i&&"c"==o){let t=39==i?"ltr"==Zw(e,e.state.selection.from)?1:-1:1;return pw(e,t,o)||ww(e,t)}return 38==i||nP&&80==i&&"c"==o?Kw(e,-1,o)||ww(e,-1):40==i||nP&&78==i&&"c"==o?function(e){if(!iP||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:i}=e.domSelectionRange();if(t&&1==t.nodeType&&0==i&&t.firstChild&&"false"==t.firstChild.contentEditable){let i=t.firstChild;gw(e,i,"true"),setTimeout((()=>gw(e,i,"false")),20)}return!1}(e)||Kw(e,1,o)||uw(e):o==(nP?"m":"c")&&(66==i||73==i||89==i||90==i)}function xw(e,t){e.someProp("transformCopied",(i=>{t=i(t,e)}));let i=[],{content:o,openStart:n,openEnd:s}=t;for(;n>1&&s>1&&1==o.childCount&&1==o.firstChild.childCount;){n--,s--;let e=o.firstChild;i.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),o=e.content}let r=e.someProp("clipboardSerializer")||Kp.fromSchema(e.state.schema),a=Gw(),l=a.createElement("div");l.appendChild(r.serializeFragment(o,{document:a}));let h,m=l.firstChild,c=0;for(;m&&1==m.nodeType&&(h=kw[m.nodeName.toLowerCase()]);){for(let e=h.length-1;e>=0;e--){let t=a.createElement(h[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),c++}m=l.firstChild}m&&1==m.nodeType&&m.setAttribute("data-pm-slice",`${n} ${s}${c?` -${c}`:""} ${JSON.stringify(i)}`);let d=e.someProp("clipboardTextSerializer",(i=>i(t,e)))||t.content.textBetween(0,t.content.size,"\n\n");return{dom:l,text:d}}function bw(e,t,i,o,n){let s,r,a=n.parent.type.spec.code;if(!i&&!t)return null;let l=t&&(o||a||!i);if(l){if(e.someProp("transformPastedText",(i=>{t=i(t,a||o,e)})),a)return t?new vd(Kd.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):vd.empty;let i=e.someProp("clipboardTextParser",(i=>i(t,n,o,e)));if(i)r=i;else{let i=n.marks(),{schema:o}=e.state,r=Kp.fromSchema(o);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(r.serializeNode(o.text(e,i)))}))}}else e.someProp("transformPastedHTML",(t=>{i=t(i,e)})),s=function(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let i,o=Gw().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e);(i=n&&kw[n[1].toLowerCase()])&&(e=i.map((e=>"<"+e+">")).join("")+e+i.map((e=>""+e+">")).reverse().join(""));if(o.innerHTML=e,i)for(let e=0;e0;e--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!r){let t=e.someProp("clipboardParser")||e.someProp("domParser")||cp.fromSchema(e.state.schema);r=t.parseSlice(s,{preserveWhitespace:!(!l&&!m),context:n,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||vw.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(m)r=function(e,t){if(!e.size)return e;let i,o=e.content.firstChild.type.schema;try{i=JSON.parse(t)}catch(t){return e}let{content:n,openStart:s,openEnd:r}=e;for(let e=i.length-2;e>=0;e-=2){let t=o.nodes[i[e]];if(!t||t.hasRequiredAttrs())break;n=Kd.from(t.create(i[e+1],n)),s++,r++}return new vd(n,s,r)}(Ew(r,+m[1],+m[2]),m[4]);else if(r=vd.maxOpen(function(e,t){if(e.childCount<2)return e;for(let i=t.depth;i>=0;i--){let o,n=t.node(i).contentMatchAt(t.index(i)),s=[];if(e.forEach((e=>{if(!s)return;let t,i=n.findWrapping(e.type);if(!i)return s=null;if(t=s.length&&o.length&&Sw(i,o,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=Tw(s[s.length-1],o.length));let t=Yw(e,i);s.push(t),n=n.matchType(t.type),o=i}})),s)return Kd.from(s)}return e}(r.content,n),!0),r.openStart||r.openEnd){let e=0,t=0;for(let t=r.content.firstChild;e{r=t(r,e)})),r}const vw=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Yw(e,t,i=0){for(let o=t.length-1;o>=i;o--)e=t[o].create(null,Kd.from(e));return e}function Sw(e,t,i,o,n){if(n=i&&(a=t<0?r.contentMatchAt(0).fillBefore(a,e.childCount>1||s<=n).append(a):a.append(r.contentMatchAt(r.childCount).fillBefore(Kd.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,r.copy(a))}function Ew(e,t,i){return t{for(let i in t)e.input.eventHandlers[i]||e.dom.addEventListener(i,e.input.eventHandlers[i]=t=>_w(e,t))}))}function _w(e,t){return e.someProp("handleDOMEvents",(i=>{let o=i[t.type];return!!o&&(o(e,t)||t.defaultPrevented)}))}function Iw(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let i=t.target;i!=e.dom;i=i.parentNode)if(!i||11==i.nodeType||i.pmViewDesc&&i.pmViewDesc.stopEvent(t))return!1;return!0}function Hw(e){return{left:e.clientX,top:e.clientY}}function Uw(e,t,i,o,n){if(-1==o)return!1;let s=e.state.doc.resolve(o);for(let o=s.depth+1;o>0;o--)if(e.someProp(t,(t=>o>s.depth?t(e,i,s.nodeAfter,s.before(o),n,!0):t(e,i,s.node(o),s.before(o),n,!1))))return!0;return!1}function Rw(e,t,i){e.focused||e.focus();let o=e.state.tr.setSelection(t);"pointer"==i&&o.setMeta("pointer",!0),e.dispatch(o)}function Fw(e,t,i,o,n){return Uw(e,"handleClickOn",t,i,o)||e.someProp("handleClick",(i=>i(e,t,o)))||(n?function(e,t){if(-1==t)return!1;let i,o,n=e.state.selection;n instanceof wj&&(i=n.node);let s=e.state.doc.resolve(t);for(let e=s.depth+1;e>0;e--){let t=e>s.depth?s.nodeAfter:s.node(e);if(wj.isSelectable(t)){o=i&&n.$from.depth>0&&e>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?s.before(n.$from.depth):s.before(e);break}}return null!=o&&(Rw(e,wj.create(e.state.doc,o),"pointer"),!0)}(e,i):function(e,t){if(-1==t)return!1;let i=e.state.doc.resolve(t),o=i.nodeAfter;return!!(o&&o.isAtom&&wj.isSelectable(o))&&(Rw(e,new wj(i),"pointer"),!0)}(e,i))}function Jw(e,t,i,o){return Uw(e,"handleDoubleClickOn",t,i,o)||e.someProp("handleDoubleClick",(i=>i(e,t,o)))}function Lw(e,t,i,o){return Uw(e,"handleTripleClickOn",t,i,o)||e.someProp("handleTripleClick",(i=>i(e,t,o)))||function(e,t,i){if(0!=i.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(Rw(e,jj.create(o,0,o.content.size),"pointer"),!0);let n=o.resolve(t);for(let t=n.depth+1;t>0;t--){let i=t>n.depth?n.nodeAfter:n.node(t),s=n.before(t);if(i.inlineContent)Rw(e,jj.create(o,s+1,s+1+i.content.size),"pointer");else{if(!wj.isSelectable(i))continue;Rw(e,wj.create(o,s),"pointer")}return!0}}(e,i,o)}function Bw(e){return ou(e)}Ow.keydown=(e,t)=>{let i=t;if(e.input.shiftKey=16==i.keyCode||i.shiftKey,!qw(e,i)&&(e.input.lastKeyCode=i.keyCode,e.input.lastKeyCodeTime=Date.now(),!rP||!eP||13!=i.keyCode))if(229!=i.keyCode&&e.domObserver.forceFlush(),!oP||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)e.someProp("handleKeyDown",(t=>t(e,i)))||Dw(e,i)?i.preventDefault():Vw(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,Ij(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},Ow.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Ow.keypress=(e,t)=>{let i=t;if(qw(e,i)||!i.charCode||i.ctrlKey&&!i.altKey||nP&&i.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,i))))return void i.preventDefault();let o=e.state.selection;if(!(o instanceof jj&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(i.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(i=>i(e,o.$from.pos,o.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),i.preventDefault()}};const Qw=nP?"metaKey":"ctrlKey";Aw.mousedown=(e,t)=>{let i=t;e.input.shiftKey=i.shiftKey;let o=Bw(e),n=Date.now(),s="singleClick";n-e.input.lastClick.time<500&&function(e,t){let i=t.x-e.clientX,o=t.y-e.clientY;return i*i+o*o<100}(i,e.input.lastClick)&&!i[Qw]&&("singleClick"==e.input.lastClick.type?s="doubleClick":"doubleClick"==e.input.lastClick.type&&(s="tripleClick")),e.input.lastClick={time:n,x:i.clientX,y:i.clientY,type:s};let r=e.posAtCoords(Hw(i));r&&("singleClick"==s?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new $w(e,r,i,!!o)):("doubleClick"==s?Jw:Lw)(e,r.pos,r.inside,i)?i.preventDefault():Vw(e,"pointer"))};class $w{constructor(e,t,i,o){let n,s;if(this.view=e,this.pos=t,this.event=i,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[Qw],this.allowDefault=i.shiftKey,t.inside>-1)n=e.state.doc.nodeAt(t.inside),s=t.inside;else{let i=e.state.doc.resolve(t.pos);n=i.parent,s=i.depth?i.before():0}const r=o?null:i.target,a=r?e.docView.nearestDesc(r,!0):null;this.target=a?a.dom:null;let{selection:l}=e.state;(0==i.button&&n.type.spec.draggable&&!1!==n.type.spec.selectable||l instanceof wj&&l.from<=s&&l.to>s)&&(this.mightDrag={node:n,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!$j||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Vw(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>tw(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Hw(e))),this.updateAllowDefault(e),this.allowDefault||!t?Vw(this.view,"pointer"):Fw(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||iP&&this.mightDrag&&!this.mightDrag.node.isAtom||eP&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Rw(this.view,mj.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Vw(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vw(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function qw(e,t){return!!e.composing||!!(iP&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Aw.touchstart=e=>{e.input.lastTouch=Date.now(),Bw(e),Vw(e,"pointer")},Aw.touchmove=e=>{e.input.lastTouch=Date.now(),Vw(e,"pointer")},Aw.contextmenu=e=>Bw(e);const eu=rP?5e3:-1;function tu(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>ou(e)),t))}function iu(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ou(e,t=!1){if(!(rP&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),iu(e),t||e.docView&&e.docView.dirty){let t=qP(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}Ow.compositionstart=Ow.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,i=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!i.textOffset&&i.parentOffset&&i.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||i.marks(),ou(e,!0),e.markCursor=null;else if(ou(e),$j&&t.selection.empty&&i.parentOffset&&!i.textOffset&&i.nodeBefore.marks.length){let t=e.domSelectionRange();for(let i=t.focusNode,o=t.focusOffset;i&&1==i.nodeType&&0!=o;){let t=o<0?i.lastChild:i.childNodes[o-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}i=t,o=-1}}e.input.composing=!0}tu(e,eu)},Ow.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionID++,tu(e,20))};const nu=Bj&&Qj<15||oP&&lP<604;function su(e,t,i,o,n){let s=bw(e,t,i,o,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,n,s||vd.empty))))return!0;if(!s)return!1;let r=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),a=r?e.state.tr.replaceSelectionWith(r,e.input.shiftKey):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Aw.copy=Ow.cut=(e,t)=>{let i=t,o=e.state.selection,n="cut"==i.type;if(o.empty)return;let s=nu?null:i.clipboardData,r=o.content(),{dom:a,text:l}=xw(e,r);s?(i.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let i=e.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(t),i.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),n=document.createRange();n.selectNodeContents(t),e.dom.blur(),o.removeAllRanges(),o.addRange(n),setTimeout((()=>{i.parentNode&&i.parentNode.removeChild(i),e.focus()}),50)}(e,a),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ow.paste=(e,t)=>{let i=t;if(e.composing&&!rP)return;let o=nu?null:i.clipboardData;o&&su(e,o.getData("text/plain"),o.getData("text/html"),e.input.shiftKey,i)?i.preventDefault():function(e,t){if(!e.dom.parentNode)return;let i=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,o=e.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((()=>{e.focus(),o.parentNode&&o.parentNode.removeChild(o),i?su(e,o.value,null,e.input.shiftKey,t):su(e,o.textContent,o.innerHTML,e.input.shiftKey,t)}),50)}(e,i)};class ru{constructor(e,t){this.slice=e,this.move=t}}const au=nP?"altKey":"ctrlKey";Aw.dragstart=(e,t)=>{let i=t,o=e.input.mouseDown;if(o&&o.done(),!i.dataTransfer)return;let n=e.state.selection,s=n.empty?null:e.posAtCoords(Hw(i));if(s&&s.pos>=n.from&&s.pos<=(n instanceof wj?n.to-1:n.to));else if(o&&o.mightDrag)e.dispatch(e.state.tr.setSelection(wj.create(e.state.doc,o.mightDrag.pos)));else if(i.target&&1==i.target.nodeType){let t=e.docView.nearestDesc(i.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&e.dispatch(e.state.tr.setSelection(wj.create(e.state.doc,t.posBefore)))}let r=e.state.selection.content(),{dom:a,text:l}=xw(e,r);i.dataTransfer.clearData(),i.dataTransfer.setData(nu?"Text":"text/html",a.innerHTML),i.dataTransfer.effectAllowed="copyMove",nu||i.dataTransfer.setData("text/plain",l),e.dragging=new ru(r,!i[au])},Aw.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},Ow.dragover=Ow.dragenter=(e,t)=>t.preventDefault(),Ow.drop=(e,t)=>{let i=t,o=e.dragging;if(e.dragging=null,!i.dataTransfer)return;let n=e.posAtCoords(Hw(i));if(!n)return;let s=e.state.doc.resolve(n.pos),r=o&&o.slice;r?e.someProp("transformPasted",(t=>{r=t(r,e)})):r=bw(e,i.dataTransfer.getData(nu?"Text":"text/plain"),nu?null:i.dataTransfer.getData("text/html"),!1,s);let a=!(!o||i[au]);if(e.someProp("handleDrop",(t=>t(e,i,r||vd.empty,a))))return void i.preventDefault();if(!r)return;i.preventDefault();let l=r?Jp(e.state.doc,s.pos,r):s.pos;null==l&&(l=s.pos);let h=e.state.tr;a&&h.deleteSelection();let m=h.mapping.map(l),c=0==r.openStart&&0==r.openEnd&&1==r.content.childCount,d=h.doc;if(c?h.replaceRangeWith(m,m,r.content.firstChild):h.replaceRange(m,m,r),h.doc.eq(d))return;let p=h.doc.resolve(m);if(c&&wj.isSelectable(r.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(r.content.firstChild))h.setSelection(new wj(p));else{let t=h.mapping.map(l);h.mapping.maps[h.mapping.maps.length-1].forEach(((e,i,o,n)=>t=n)),h.setSelection(lw(e,p,h.doc.resolve(t)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))},Aw.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&tw(e)}),20))},Aw.blur=(e,t)=>{let i=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),i.relatedTarget&&e.dom.contains(i.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Aw.beforeinput=(e,t)=>{if(eP&&rP&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,Ij(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())}),50)}};for(let e in Ow)Aw[e]=Ow[e];function lu(e,t){if(e==t)return!0;for(let i in e)if(e[i]!==t[i])return!1;for(let i in t)if(!(i in e))return!1;return!0}class hu{constructor(e,t){this.toDOM=e,this.spec=t||ju,this.side=this.spec.side||0}map(e,t,i,o){let{pos:n,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new du(n-i,n-i,this)}valid(){return!0}eq(e){return this==e||e instanceof hu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&lu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class mu{constructor(e,t){this.attrs=e,this.spec=t||ju}map(e,t,i,o){let n=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-i,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-i;return n>=s?null:new du(n,s,this)}valid(e,t){return t.from=e&&(!n||n(r.spec))&&i.push(r.copy(r.from+o,r.to+o))}for(let s=0;se){let r=this.children[s]+1;this.children[s+2].findInner(e-r,t-r,i,o+r,n)}}map(e,t,i){return this==wu||0==e.maps.length?this:this.mapInner(e,t,0,0,i||ju)}mapInner(e,t,i,o,n){let s;for(let r=0;r{let l=r-s-(i-e);for(let r=0;rh+t-o)continue;let m=a[r]+t-o;i>=m?a[r+1]=e<=m?-2:-1:s>=n&&l&&(a[r]+=l,a[r+1]+=l)}o+=l})),t=i.maps[e].map(t,-1)}let l=!1;for(let t=0;t=o.content.size){l=!0;continue}let c=i.map(e[t+1]+s,-1)-n,{index:d,offset:p}=o.content.findIndex(m),j=o.maybeChild(d);if(j&&p==m&&p+j.nodeSize==c){let o=a[t+2].mapInner(i,j,h+1,e[t]+s+1,r);o!=wu?(a[t]=m,a[t+1]=c,a[t+2]=o):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,i,o,n,s,r){function a(e,t){for(let s=0;s{let r,a=s+i;if(r=Mu(t,e,a)){for(o||(o=this.children.slice());ns&&t.to=e){this.children[t]==e&&(i=this.children[t+2]);break}let n=e+1,s=n+t.content.size;for(let e=0;en&&t.type instanceof mu){let e=Math.max(n,t.from)-n,i=Math.min(s,t.to)-n;ei.map(e,t,ju)));return uu.from(i)}forChild(e,t){if(t.isLeaf)return Pu.empty;let i=[];for(let o=0;oe instanceof Pu))?e:e.reduce(((e,t)=>e.concat(t instanceof Pu?t:t.members)),[]))}}}function fu(e,t){if(!t||!e.length)return e;let i=[];for(let o=0;oi&&t.to{let a=Mu(e,t,r+i);if(a){s=!0;let e=Ku(a,t,i+r+1,o);e!=wu&&n.push(r,r+t.nodeSize,e)}}));let r=fu(s?Zu(e):e,-i).sort(yu);for(let e=0;e0;)t++;e.splice(t,0,i)}function xu(e){let t=[];return e.someProp("decorations",(i=>{let o=i(e.state);o&&o!=wu&&t.push(o)})),e.cursorWrapper&&t.push(Pu.create(e.state.doc,[e.cursorWrapper.deco])),uu.from(t)}const bu={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},vu=Bj&&Qj<=11;class Yu{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Su{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Yu,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),vu&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bu)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(hw(this.view)){if(this.suppressingSelectionUpdates)return tw(this.view);if(Bj&&Qj<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Oj(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,i=new Set;for(let t=e.focusNode;t;t=zj(t))i.add(t);for(let o=e.anchorNode;o;o=zj(o))if(i.has(o)){t=o;break}let o=t&&this.view.docView.nearestDesc(t);return o&&o.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let i=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&hw(e)&&!this.ignoreSelectionChange(i),n=-1,s=-1,r=!1,a=[];if(e.editable)for(let e=0;e1){let e=a.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],i=e[1];t.parentNode&&t.parentNode.parentNode==i.parentNode?i.remove():t.remove()}}let l=null;n<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(n>-1&&(e.docView.markDirty(n,s),function(e){if(Tu.has(e))return;if(Tu.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=$j,Xu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Xu=!0}}(e)),this.handleDOMChange(n,s,r,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||tw(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(i==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!i||i.ignoreMutation(e))return null;if("childList"==e.type){for(let i=0;iDate.now()-50?e.input.lastSelectionOrigin:null,i=qP(e,t);if(i&&!e.state.selection.eq(i)){if(eP&&rP&&13===e.input.lastKeyCode&&Date.now()-100t(e,Ij(13,"Enter")))))return;let o=e.state.tr.setSelection(i);"pointer"==t?o.setMeta("pointer",!0):"key"==t&&o.scrollIntoView(),e.composing&&o.setMeta("composition",e.input.compositionID),e.dispatch(o)}return}let s=e.state.doc.resolve(t),r=s.sharedDepth(i);t=s.before(r+1),i=e.state.doc.resolve(i).after(r+1);let a,l,h=e.state.selection,m=function(e,t,i){let o,{node:n,fromOffset:s,toOffset:r,from:a,to:l}=e.docView.parseRange(t,i),h=e.domSelectionRange(),m=h.anchorNode;if(m&&e.dom.contains(1==m.nodeType?m:m.parentNode)&&(o=[{node:m,offset:h.anchorOffset}],_j(h)||o.push({node:h.focusNode,offset:h.focusOffset})),eP&&8===e.input.lastKeyCode)for(let e=r;e>s;e--){let t=n.childNodes[e-1],i=t.pmViewDesc;if("BR"==t.nodeName&&!i){r=e;break}if(!i||i.size)break}let c=e.state.doc,d=e.someProp("domParser")||cp.fromSchema(e.state.schema),p=c.resolve(a),j=null,P=d.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:r,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:o,ruleFromNode:Eu,context:p});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),j={anchor:e+a,head:t+a}}return{doc:P,sel:j,from:a,to:l}}(e,t,i),c=e.state.doc,d=c.slice(m.from,m.to);8===e.input.lastKeyCode&&Date.now()-100=r?s-o:0,a=s+(a-r),r=s}else if(a=a?s-o:0,r=s+(r-a),a=s}return{start:s,endA:r,endB:a}}(d.content,m.doc.content,m.from,a,l);if((oP&&e.input.lastIOSEnter>Date.now()-225||rP)&&n.some((e=>1==e.nodeType&&!ku.test(e.nodeName)))&&(!p||p.endA>=p.endB)&&e.someProp("handleKeyDown",(t=>t(e,Ij(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!p){if(!(o&&h instanceof jj&&!h.empty&&h.$head.sameParent(h.$anchor))||e.composing||m.sel&&m.sel.anchor!=m.sel.head){if(m.sel){let t=Gu(e,e.state.doc,m.sel);if(t&&!t.eq(e.state.selection)){let i=e.state.tr.setSelection(t);e.composing&&i.setMeta("composition",e.input.compositionID),e.dispatch(i)}}return}p={start:h.from,endA:h.to,endB:h.to}}if(eP&&e.cursorWrapper&&m.sel&&m.sel.anchor==e.cursorWrapper.deco.from&&m.sel.head==m.sel.anchor){let e=p.endB-p.start;m.sel={anchor:m.sel.anchor+e,head:m.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.frome.state.selection.from&&p.start<=e.state.selection.from+2&&e.state.selection.from>=m.from?p.start=e.state.selection.from:p.endA=e.state.selection.to-2&&e.state.selection.to<=m.to&&(p.endB+=e.state.selection.to-p.endA,p.endA=e.state.selection.to)),Bj&&Qj<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>m.from&&" "==m.doc.textBetween(p.start-m.from-1,p.start-m.from+1)&&(p.start--,p.endA--,p.endB--);let j,P=m.doc.resolveNoCache(p.start-m.from),w=m.doc.resolveNoCache(p.endB-m.from),u=c.resolve(p.start),f=P.sameParent(w)&&P.parent.inlineContent&&u.end()>=p.endA;if((oP&&e.input.lastIOSEnter>Date.now()-225&&(!f||n.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!f&&P.post(e,Ij(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>p.start&&function(e,t,i,o,n){if(!o.parent.isTextblock||i-t<=n.pos-o.pos||Au(o,!0,!1)i||Au(r,!0,!1)t(e,Ij(8,"Backspace")))))return void(rP&&eP&&e.domObserver.suppressSelectionUpdates());eP&&rP&&p.endB==p.start&&(e.input.lastAndroidDelete=Date.now()),rP&&!f&&P.start()!=w.start()&&0==w.parentOffset&&P.depth==w.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==p.endA&&(p.endB-=2,w=m.doc.resolveNoCache(p.endB-m.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,Ij(13,"Enter"))}))}),20));let M,Z,K,y=p.start,g=p.endA;if(f)if(P.pos==w.pos)Bj&&Qj<=11&&0==P.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>tw(e)),20)),M=e.state.tr.delete(y,g),Z=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(K=function(e,t){let i,o,n,s=e.firstChild.marks,r=t.firstChild.marks,a=s,l=r;for(let e=0;ee.mark(o.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;o=l[0],i="remove",n=e=>e.mark(o.removeFromSet(e.marks))}let h=[];for(let e=0;ei(e,y,g,t))))return;M=e.state.tr.insertText(t,y,g)}if(M||(M=e.state.tr.replace(y,g,m.doc.slice(p.start-m.from,p.endB-m.from))),m.sel){let t=Gu(e,M.doc,m.sel);t&&!(eP&&rP&&e.composing&&t.empty&&(p.start!=p.endB||e.input.lastAndroidDeletet.content.size?null:lw(e,t.resolve(i.anchor),t.resolve(i.head))}function Au(e,t,i){let o=e.depth,n=t?e.end():e.pos;for(;o>0&&(t||e.indexAfter(o)==e.node(o).childCount);)o--,n++,t=!1;if(i){let t=e.node(o).maybeChild(e.indexAfter(o));for(;t&&!t.isLeaf;)t=t.firstChild,n++}return n}class Ou{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Nw,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(_u),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Vu(this),Nu(this),this.nodeViews=Wu(this),this.docView=OP(this.state.doc,Cu(this),xu(this),this.dom,this),this.domObserver=new Su(this,((e,t,i,o)=>zu(this,e,t,i,o))),this.domObserver.start(),function(e){for(let t in Aw){let i=Aw[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Iw(e,t)||_w(e,t)||!e.editable&&t.type in Ow||i(e,t)},Cw[t]?{passive:!0}:void 0)}iP&&e.dom.addEventListener("input",(()=>null)),Ww(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ww(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_u),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let i=this.state,o=!1,n=!1;e.storedMarks&&this.composing&&(iu(this),n=!0),this.state=e;let s=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Wu(this);(function(e,t){let i=0,o=0;for(let o in e){if(e[o]!=t[o])return!0;i++}for(let e in t)o++;return i!=o})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ww(this),this.editable=Vu(this),Nu(this);let r=xu(this),a=Cu(this),l=i.plugins==e.plugins||i.doc.eq(e.doc)?e.scrollToSelection>i.scrollToSelection?"to selection":"preserve":"reset",h=o||!this.docView.matchesNode(e.doc,a,r);!h&&e.selection.eq(i.selection)||(n=!0);let m="preserve"==l&&n&&null==this.dom.style.overflowAnchor&&function(e){let t,i,o=e.dom.getBoundingClientRect(),n=Math.max(0,o.top);for(let s=(o.left+o.right)/2,r=n+1;r=n-20){t=o,i=a.top;break}}return{refDOM:t,refTop:i,stack:pP(e.dom)}}(this);if(n){this.domObserver.stop();let t=h&&(Bj||eP)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&function(e,t){let i=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(i)!=t.$anchor.start(i)}(i.selection,e.selection);if(h){let i=eP?this.trackWrites=this.domSelectionRange().focusNode:null;!o&&this.docView.update(e.doc,a,r,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=OP(e.doc,a,r,this.dom,this)),i&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),i=e.domSelectionRange();return Oj(t.node,t.offset,i.anchorNode,i.anchorOffset)}(this))?tw(this,t):(rw(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():m&&function({refDOM:e,refTop:t,stack:i}){let o=e?e.getBoundingClientRect().top:0;jP(i,0==o?0:o-t)}(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof wj){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&dP(this,t.getBoundingClientRect(),e)}else dP(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t
@@ -312,37 +320,72 @@ class ChatScroller extends LitElement {
return true
}
// Only update element if prop1 changed.
- return changedProperties.has('messages');
+ return changedProperties.has('messages')
}
async getUpdateComplete() {
- await super.getUpdateComplete();
- const marginElements = Array.from(this.shadowRoot.querySelectorAll('message-template'));
- await Promise.all(marginElements.map(el => el.updateComplete));
- return true;
+ await super.getUpdateComplete()
+ const marginElements = Array.from(this.shadowRoot.querySelectorAll('message-template'))
+ await Promise.all(marginElements.map(el => el.updateComplete))
+ return true
}
setToggledMessage(message) {
- toggledMessage = message;
+ toggledMessage = message
}
async firstUpdated() {
- this.emojiPicker.on('emoji', selection => {
+ this.changeTheme()
+ window.addEventListener('storage', () => {
+ const checkTheme = localStorage.getItem('qortalTheme')
+
+ if (checkTheme === 'dark') {
+ this.theme = 'dark'
+ } else {
+ this.theme = 'light'
+ }
+ document.querySelector('html').setAttribute('theme', this.theme)
+ })
+
+ this.emojiPicker.on('emoji', selection => {
this.sendMessage({
type: 'reaction',
editedMessageObj: toggledMessage,
reaction: selection.emoji,
})
- });
- this.viewElement = this.shadowRoot.getElementById('viewElement');
- this.upObserverElement = this.shadowRoot.getElementById('upObserver');
- this.downObserverElement = this.shadowRoot.getElementById('downObserver');
+ })
+ this.viewElement = this.shadowRoot.getElementById('viewElement')
+ this.upObserverElement = this.shadowRoot.getElementById('upObserver')
+ this.downObserverElement = this.shadowRoot.getElementById('downObserver')
// Intialize Observers
- this.upElementObserver();
- this.downElementObserver();
- await this.getUpdateComplete();
- this.viewElement.scrollTop = this.viewElement.scrollHeight + 50;
+ this.upElementObserver()
+ this.downElementObserver()
+ await this.getUpdateComplete()
+ this.viewElement.scrollTop = this.viewElement.scrollHeight + 50
+
+ this.clearConsole()
+ setInterval(() => {
+ this.clearConsole()
+ }, 60000)
+ }
+
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
+ }
+
+ changeTheme() {
+ const checkTheme = localStorage.getItem('qortalTheme')
+ if (checkTheme === 'dark') {
+ this.theme = 'dark'
+ } else {
+ this.theme = 'light'
+ }
+ document.querySelector('html').setAttribute('theme', this.theme)
}
_getOldMessage(_scrollElement) {
@@ -358,19 +401,19 @@ class ChatScroller extends LitElement {
if (this.messages.length < 20) {
return
}
- this.setIsLoadingMessages(true);
- let _scrollElement = entries[0].target.nextElementSibling;
- this._getOldMessage(_scrollElement);
+ this.setIsLoadingMessages(true)
+ let _scrollElement = entries[0].target.nextElementSibling
+ this._getOldMessage(_scrollElement)
}
}
_downObserverHandler(entries) {
if (!entries[0].isIntersecting) {
- let _scrollElement = entries[0].target.previousElementSibling;
- // this._getOldMessageAfter(_scrollElement);
- this.showLastMessageRefScroller(true);
+ let _scrollElement = entries[0].target.previousElementSibling
+ // this._getOldMessageAfter(_scrollElement)
+ this.showLastMessageRefScroller(true)
} else {
- this.showLastMessageRefScroller(false);
+ this.showLastMessageRefScroller(false)
}
}
@@ -379,9 +422,9 @@ class ChatScroller extends LitElement {
root: this.viewElement,
rootMargin: '0px',
threshold: 1
- };
- const observer = new IntersectionObserver(this._upObserverhandler, options);
- observer.observe(this.upObserverElement);
+ }
+ const observer = new IntersectionObserver(this._upObserverhandler, options)
+ observer.observe(this.upObserverElement)
}
downElementObserver() {
@@ -391,12 +434,12 @@ class ChatScroller extends LitElement {
threshold: 1
}
// identify an element to observe
- const elementToObserve = this.downObserverElement;
+ const elementToObserve = this.downObserverElement
// passing it a callback function
- const observer = new IntersectionObserver(this._downObserverHandler, options);
+ const observer = new IntersectionObserver(this._downObserverHandler, options)
// call `observe()` on that MutationObserver instance,
// passing it the element to observe, and the options object
- observer.observe(elementToObserve);
+ observer.observe(elementToObserve)
}
}
@@ -437,12 +480,12 @@ class MessageTemplate extends LitElement {
goToRepliedMessage: { attribute: false },
listSeenMessages: { type: Array },
addSeenMessage: { attribute: false },
- chatId: { type: String },
+ chatId: { type: String }
}
}
constructor() {
- super();
+ super()
this.messageObj = {}
this.openDialogPrivateMessage = false
this.openDialogBlockUser = false
@@ -461,7 +504,7 @@ class MessageTemplate extends LitElement {
}
static get styles() {
- return [chatStyles];
+ return [chatStyles]
}
@@ -485,26 +528,26 @@ class MessageTemplate extends LitElement {
showBlockIconFunc(bool) {
if (bool) {
- this.showBlockAddressIcon = true;
+ this.showBlockAddressIcon = true
} else {
- this.showBlockAddressIcon = false;
+ this.showBlockAddressIcon = false
}
}
async downloadAttachment(attachment) {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
try {
axios.get(`${nodeUrl}/arbitrary/QCHAT_ATTACHMENT/${attachment.name}/${attachment.identifier}?apiKey=${myNode.apiKey}`, { responseType: 'blob' })
.then(response => {
- let filename = attachment.attachmentName;
- let blob = new Blob([response.data], { type: "application/octet-stream" });
- this.saveFileToDisk(blob, filename);
+ let filename = attachment.attachmentName
+ let blob = new Blob([response.data], { type: "application/octet-stream" })
+ this.saveFileToDisk(blob, filename)
})
} catch (error) {
- console.error(error);
+ console.error(error)
}
}
@@ -533,31 +576,43 @@ class MessageTemplate extends LitElement {
this.viewImage = true
}
- const tooltips = this.shadowRoot.querySelectorAll('vaadin-tooltip');
+ const tooltips = this.shadowRoot.querySelectorAll('vaadin-tooltip')
tooltips.forEach(tooltip => {
- const overlay = tooltip.shadowRoot.querySelector('vaadin-tooltip-overlay');
- overlay.shadowRoot.getElementById("overlay").style.cssText = "background-color: transparent; box-shadow: rgb(50 50 93 / 25%) 0px 2px 5px -1px, rgb(0 0 0 / 30%) 0px 1px 3px -1px";
- overlay.shadowRoot.getElementById('content').style.cssText = "background-color: var(--reactions-tooltip-bg); color: var(--chat-bubble-msg-color); text-align: center; padding: 20px 10px; border-radius: 8px; font-family: Roboto, sans-serif; letter-spacing: 0.3px; font-weight: 300; font-size: 13.5px; transition: all 0.3s ease-in-out;";
- });
+ const overlay = tooltip.shadowRoot.querySelector('vaadin-tooltip-overlay')
+ overlay.shadowRoot.getElementById("overlay").style.cssText = "background-color: transparent; box-shadow: rgb(50 50 93 / 25%) 0px 2px 5px -1px, rgb(0 0 0 / 30%) 0px 1px 3px -1px"
+ overlay.shadowRoot.getElementById('content').style.cssText = "background-color: var(--reactions-tooltip-bg); color: var(--chat-bubble-msg-color); text-align: center; padding: 20px 10px; border-radius: 8px; font-family: Roboto, sans-serif; letter-spacing: 0.3px; font-weight: 300; font-size: 13.5px; transition: all 0.3s ease-in-out;"
+ })
+ this.clearConsole()
+ setInterval(() => {
+ this.clearConsole()
+ }, 60000)
+ }
+
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
}
render() {
- const hidemsg = this.hideMessages;
- let message = "";
+ const hidemsg = this.hideMessages
+ let message = ""
let messageVersion2 = ""
let messageVersion2WithLink = null
- let reactions = [];
- let repliedToData = null;
- let image = null;
- let gif = null;
- let isImageDeleted = false;
- let isAttachmentDeleted = false;
- let version = 0;
+ let reactions = []
+ let repliedToData = null
+ let image = null
+ let gif = null
+ let isImageDeleted = false
+ let isAttachmentDeleted = false
+ let version = 0
let isForwarded = false
let isEdited = false
- let attachment = null;
+ let attachment = null
try {
- const parsedMessageObj = JSON.parse(this.messageObj.decodedMessage);
+ const parsedMessageObj = JSON.parse(this.messageObj.decodedMessage)
if (+parsedMessageObj.version > 1 && parsedMessageObj.messageText) {
messageVersion2 = generateHTML(parsedMessageObj.messageText, [
StarterKit,
@@ -568,121 +623,122 @@ class MessageTemplate extends LitElement {
messageVersion2WithLink = processText(messageVersion2)
}
- message = parsedMessageObj.messageText;
- repliedToData = this.messageObj.repliedToData;
- isImageDeleted = parsedMessageObj.isImageDeleted;
- isAttachmentDeleted = parsedMessageObj.isAttachmentDeleted;
- // reactions = parsedMessageObj.reactions || [];
- version = parsedMessageObj.version;
- isForwarded = parsedMessageObj.type === 'forward';
- isEdited = parsedMessageObj.isEdited && true;
+ message = parsedMessageObj.messageText
+ repliedToData = this.messageObj.repliedToData
+ isImageDeleted = parsedMessageObj.isImageDeleted
+ isAttachmentDeleted = parsedMessageObj.isAttachmentDeleted
+ // reactions = parsedMessageObj.reactions || []
+ version = parsedMessageObj.version
+ isForwarded = parsedMessageObj.type === 'forward'
+ isEdited = parsedMessageObj.isEdited && true
if (parsedMessageObj.attachments && Array.isArray(parsedMessageObj.attachments) && parsedMessageObj.attachments.length > 0) {
- attachment = parsedMessageObj.attachments[0];
+ attachment = parsedMessageObj.attachments[0]
}
if (parsedMessageObj.images && Array.isArray(parsedMessageObj.images) && parsedMessageObj.images.length > 0) {
- image = parsedMessageObj.images[0];
+ image = parsedMessageObj.images[0]
}
if (parsedMessageObj.gifs && Array.isArray(parsedMessageObj.gifs) && parsedMessageObj.gifs.length > 0) {
- gif = parsedMessageObj.gifs[0];
+ gif = parsedMessageObj.gifs[0]
}
} catch (error) {
- message = this.messageObj.decodedMessage;
+ message = this.messageObj.decodedMessage
}
- let avatarImg = '';
- let imageHTML = '';
- let imageHTMLDialog = '';
- let imageUrl = '';
- let gifHTML = '';
- let gifHTMLDialog = '';
- let gifUrl = '';
- let nameMenu = '';
- let levelFounder = '';
- let hideit = hidemsg.includes(this.messageObj.sender);
+ let avatarImg = ''
+ let imageHTML = ''
+ let imageHTMLDialog = ''
+ let imageUrl = ''
+ let gifHTML = ''
+ let gifHTMLDialog = ''
+ let gifUrl = ''
+ let nameMenu = ''
+ let levelFounder = ''
+ let hideit = hidemsg.includes(this.messageObj.sender)
let forwarded = ''
let edited = ''
- levelFounder = html` `;
+ levelFounder = html` `
+
if (this.messageObj.senderName) {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
- const avatarUrl = `${nodeUrl}/arbitrary/THUMBNAIL/${this.messageObj.senderName}/qortal_avatar?async=true&apiKey=${myNode.apiKey}`;
- avatarImg = html`
`;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ const avatarUrl = `${nodeUrl}/arbitrary/THUMBNAIL/${this.messageObj.senderName}/qortal_avatar?async=true&apiKey=${myNode.apiKey}`
+ avatarImg = html`
`
} else {
avatarImg = html`
`
}
const createImage = (imageUrl) => {
- const imageHTMLRes = new Image();
- imageHTMLRes.src = imageUrl;
- imageHTMLRes.style = "max-width:45vh; max-height:40vh; border-radius: 5px; cursor: pointer";
+ const imageHTMLRes = new Image()
+ imageHTMLRes.src = imageUrl
+ imageHTMLRes.style = "max-width:45vh; max-height:40vh; border-radius: 5px; cursor: pointer;"
imageHTMLRes.onclick = () => {
- this.openDialogImage = true;
+ this.openDialogImage = true
}
imageHTMLRes.onload = () => {
- this.isImageLoaded = true;
+ this.isImageLoaded = true
}
imageHTMLRes.onerror = () => {
if (this.imageFetches < 4) {
setTimeout(() => {
- this.imageFetches = this.imageFetches + 1;
- imageHTMLRes.src = imageUrl;
- }, 2000);
+ this.imageFetches = this.imageFetches + 1
+ imageHTMLRes.src = imageUrl
+ }, 10000)
} else {
setTimeout(() => {
- this.imageFetches = this.imageFetches + 1;
- imageHTMLRes.src = imageUrl;
- }, 6000);
+ this.imageFetches = this.imageFetches + 1
+ imageHTMLRes.src = imageUrl
+ }, 15000)
}
- };
- return imageHTMLRes;
+ }
+ return imageHTMLRes
}
const createGif = (gif) => {
- const gifHTMLRes = new Image();
- gifHTMLRes.src = gif;
- gifHTMLRes.style = "max-width:45vh; max-height:40vh; border-radius: 5px; cursor: pointer";
+ const gifHTMLRes = new Image()
+ gifHTMLRes.src = gif
+ gifHTMLRes.style = "max-width:45vh; max-height:40vh; border-radius: 5px; cursor: pointer;"
gifHTMLRes.onclick = () => {
- this.openDialogGif = true;
+ this.openDialogGif = true
}
gifHTMLRes.onload = () => {
- this.isGifLoaded = true;
+ this.isGifLoaded = true
}
gifHTMLRes.onerror = () => {
if (this.gifFetches < 4) {
setTimeout(() => {
- this.gifFetches = this.gifFetches + 1;
- gifHTMLRes.src = gif;
- }, 500);
+ this.gifFetches = this.gifFetches + 1
+ gifHTMLRes.src = gif
+ }, 10000)
} else {
- gifHTMLRes.src = '/img/chain.png';
- gifHTMLRes.style = "max-width:45vh; max-height:20vh; border-radius: 5px; filter: opacity(0.5)";
+ gifHTMLRes.src = '/img/chain.png'
+ gifHTMLRes.style = "max-width:45vh; max-height:20vh; border-radius: 5px; filter: opacity(0.5);"
gifHTMLRes.onclick = () => { }
this.isGifLoaded = true
}
- };
- return gifHTMLRes;
+ }
+ return gifHTMLRes
}
if (image) {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
- imageUrl = `${nodeUrl}/arbitrary/${image.service}/${image.name}/${image.identifier}?async=true&apiKey=${myNode.apiKey}`;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ imageUrl = `${nodeUrl}/arbitrary/${image.service}/${image.name}/${image.identifier}?async=true&apiKey=${myNode.apiKey}`
if (this.viewImage || this.myAddress === this.messageObj.sender) {
- imageHTML = createImage(imageUrl);
+ imageHTML = createImage(imageUrl)
imageHTMLDialog = createImage(imageUrl)
- imageHTMLDialog.style = "height: auto; max-height: 80vh; width: auto; max-width: 80vw; object-fit: contain; border-radius: 5px";
+ imageHTMLDialog.style = "height: auto; max-height: 80vh; width: auto; max-width: 80vw; object-fit: contain; border-radius: 5px;"
}
}
if (gif) {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
- gifUrl = `${nodeUrl}/arbitrary/${gif.service}/${gif.name}/${gif.identifier}?filepath=${gif.filePath}&apiKey=${myNode.apiKey}`;
+ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
+ const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
+ gifUrl = `${nodeUrl}/arbitrary/${gif.service}/${gif.name}/${gif.identifier}?filepath=${gif.filePath}&apiKey=${myNode.apiKey}`
if (this.viewImage || this.myAddress === this.messageObj.sender) {
- gifHTML = createGif(gifUrl);
+ gifHTML = createGif(gifUrl)
gifHTMLDialog = createGif(gifUrl)
- gifHTMLDialog.style = "height: auto; max-height: 80vh; width: auto; max-width: 80vw; object-fit: contain; border-radius: 5px";
+ gifHTMLDialog.style = "height: auto; max-height: 80vh; width: auto; max-width: 80vw; object-fit: contain; border-radius: 5px;"
}
}
@@ -690,27 +746,29 @@ class MessageTemplate extends LitElement {
${this.messageObj.senderName ? this.messageObj.senderName : cropAddress(this.messageObj.sender)}
- `;
+ `
+
forwarded = html`
-
- ${translate("blockpage.bcchange17")}
-
- `;
+
+ ${translate("blockpage.bcchange17")}
+
+ `
edited = html`
-
- ${translate("chatpage.cchange68")}
-
- `;
+
+ ${translate("chatpage.cchange68")}
+
+ `
if (repliedToData) {
try {
- const parsedMsg = JSON.parse(repliedToData.decodedMessage);
- repliedToData.decodedMessage = parsedMsg;
+ const parsedMsg = JSON.parse(repliedToData.decodedMessage)
+ repliedToData.decodedMessage = parsedMsg
} catch (error) {
}
}
+
let repliedToMessageText = ''
if (repliedToData && repliedToData.decodedMessage && repliedToData.decodedMessage.messageText) {
try {
@@ -724,16 +782,16 @@ class MessageTemplate extends LitElement {
}
}
+
let replacedMessage = ''
if (message && +version < 2) {
const escapedMessage = this.escapeHTML(message)
if (escapedMessage) {
- replacedMessage = escapedMessage.replace(new RegExp('\r?\n', 'g'), '
'); + replacedMessage = escapedMessage.replace(new RegExp('\r?\n', 'g'), '
') } } - return hideit ? html`` : html` {
- if (this.myAddress === this.messageObj.sender) return;
- this.setOpenUserInfo(true);
- this.setUserName(this.messageObj);
+ if (this.myAddress === this.messageObj.sender) return
+ this.setOpenUserInfo(true)
+ this.setUserName(this.messageObj)
}} class="message-data-avatar">
${avatarImg}
@@ -789,9 +847,9 @@ class MessageTemplate extends LitElement {
{
- if (this.myAddress === this.messageObj.sender) return;
- this.setOpenUserInfo(true);
- this.setUserName(this.messageObj);
+ if (this.myAddress === this.messageObj.sender) return
+ this.setOpenUserInfo(true)
+ this.setUserName(this.messageObj)
}}
class="message-data-name">
${nameMenu}
@@ -844,13 +902,13 @@ class MessageTemplate extends LitElement {
}}
class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')}
style=${this.isFirstMessage && "margin-top: 10px;"}>
- ![](/img/incognito.png)
'); + replacedMessage = escapedMessage.replace(new RegExp('\r?\n', 'g'), '
') } } - return hideit ? html`` : html`
+
` : html``}
${!this.isImageLoaded && image && this.viewImage ? html`
-
${translate("chatpage.cchange40")}
+
@@ -863,7 +921,7 @@ class MessageTemplate extends LitElement {
${this.myAddress === this.messageObj.sender ? html`
{
- this.openDeleteImage = true;
+ this.openDeleteImage = true
}}
class="image-delete-icon" icon="vaadin:close" slot="icon">
` : ''}
@@ -879,7 +937,7 @@ class MessageTemplate extends LitElement {
}}
class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')}
style=${this.isFirstMessage && "margin-top: 10px;"}>
- {
- e.stopPropagation();
- this.openDeleteAttachment = true;
+ e.stopPropagation()
+ this.openDeleteAttachment = true
}}
class="image-delete-icon" icon="vaadin:close" slot="icon">
@@ -1128,7 +1186,7 @@ class MessageTemplate extends LitElement {
hideActions
?open=${this.openDeleteImage}
@closed=${() => {
- this.openDeleteImage = false;
+ this.openDeleteImage = false
}}>
@@ -1351,7 +1409,7 @@ class ChatMenu extends LitElement {
this.versionErrorSnack()
return
}
- this.setEditedMessageObj(this.originalMessage);
+ this.setEditedMessageObj(this.originalMessage)
}}>
@@ -1363,9 +1421,9 @@ class ChatMenu extends LitElement {
class=${`menu-icon ${!this.firstMessageInChat ? "tooltip" : ""}`}
data-text="${translate("blockpage.bcchange18")}"
@click=${(e) => {
- e.preventDefault();
- this.setUserName(this.originalMessage);
- this.setOpenTipUser(true);
+ e.preventDefault()
+ this.setUserName(this.originalMessage)
+ this.setOpenTipUser(true)
}}>
diff --git a/plugins/plugins/core/components/ChatSearchResults.js b/plugins/plugins/core/components/ChatSearchResults.js
new file mode 100644
index 00000000..b8b19cb5
--- /dev/null
+++ b/plugins/plugins/core/components/ChatSearchResults.js
@@ -0,0 +1,72 @@
+import { LitElement, html } from 'lit'
+import { render } from 'lit/html.js'
+import { Epml } from '../../../epml.js'
+import { chatSearchResultsStyles } from './ChatSearchResults-css.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+import '@vaadin/icon'
+import '@vaadin/icons'
+
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
+
+export class ChatSearchResults extends LitElement {
+ static get properties() {
+ return {
+ onClickFunc: { attribute: false },
+ closeFunc: { attribute: false },
+ searchResults: { type: Array },
+ isOpen: { type: Boolean },
+ loading: { type: Boolean }
+ }
+ }
+
+ static styles = [chatSearchResultsStyles]
+
+ render() {
+ return html`
+
+
@@ -917,8 +975,8 @@ class MessageTemplate extends LitElement {
? html`
${translate("gifs.gchange25")}
${translate("chatpage.cchange78")}
@@ -1153,7 +1211,7 @@ class MessageTemplate extends LitElement { hideActions ?open=${this.openDeleteAttachment} @closed=${() => { - this.openDeleteAttachment = false; + this.openDeleteAttachment = false }}>${translate("chatpage.cchange79")}
@@ -1182,7 +1240,7 @@ class MessageTemplate extends LitElement { } } -window.customElements.define('message-template', MessageTemplate); +window.customElements.define('message-template', MessageTemplate) class ChatMenu extends LitElement { static get properties() { @@ -1207,18 +1265,18 @@ class ChatMenu extends LitElement { setOpenPrivateMessage: { attribute: false }, setOpenTipUser: { attribute: false }, setUserName: { attribute: false }, - gif: { type: Boolean }, + gif: { type: Boolean } } } constructor() { - super(); - this.showPrivateMessageModal = () => { }; - this.showBlockUserModal = () => { }; + super() + this.showPrivateMessageModal = () => { } + this.showBlockUserModal = () => { } } static get styles() { - return [chatStyles]; + return [chatStyles] } // Copy address to clipboard @@ -1246,7 +1304,7 @@ class ChatMenu extends LitElement { key: '' } try { - parsedMessageObj = JSON.parse(this.originalMessage.decodedMessage); + parsedMessageObj = JSON.parse(this.originalMessage.decodedMessage) } catch (error) { parsedMessageObj = {} @@ -1335,7 +1393,7 @@ class ChatMenu extends LitElement { this.versionErrorSnack() return } - this.setRepliedToMessageObj({ ...this.originalMessage, version: this.version }); + this.setRepliedToMessageObj({ ...this.originalMessage, version: this.version }) }}">
+ this.closeFunc()}
+ icon="vaadin:close-small"
+ slot="icon"
+ class="close-icon"
+ >
+
+ ${this.loading ? (
+ html`
+
+ `
+ }
+}
+customElements.define('chat-search-results', ChatSearchResults)
diff --git a/plugins/plugins/core/components/ChatSelect.js b/plugins/plugins/core/components/ChatSelect.js
index 4ea0fe03..99cb28d0 100644
--- a/plugins/plugins/core/components/ChatSelect.js
+++ b/plugins/plugins/core/components/ChatSelect.js
@@ -1,4 +1,5 @@
import { LitElement, html, css } from 'lit'
+import { render } from 'lit/html.js'
import { Epml } from '../../../epml.js'
import '@material/mwc-icon'
diff --git a/plugins/plugins/core/components/ChatSideNavHeads.js b/plugins/plugins/core/components/ChatSideNavHeads.js
index b0798399..61003f7a 100644
--- a/plugins/plugins/core/components/ChatSideNavHeads.js
+++ b/plugins/plugins/core/components/ChatSideNavHeads.js
@@ -1,6 +1,7 @@
import { LitElement, html, css } from 'lit'
+import { render } from 'lit/html.js'
import { Epml } from '../../../epml.js'
-
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
import '@material/mwc-icon'
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
@@ -176,7 +177,7 @@ class ChatSideNavHeads extends LitElement {
this.config = JSON.parse(c)
})
})
- parentEpml.imReady();
+ parentEpml.imReady()
}
shouldUpdate(changedProperties) {
diff --git a/plugins/plugins/core/components/ChatTextEditor copy.js b/plugins/plugins/core/components/ChatTextEditor copy.js
index dfc572bc..c7a3ecdc 100644
--- a/plugins/plugins/core/components/ChatTextEditor copy.js
+++ b/plugins/plugins/core/components/ChatTextEditor copy.js
@@ -1,11 +1,12 @@
-import { LitElement, html, css } from "lit";
-import { get } from 'lit-translate';
-import { escape, unescape } from 'html-escaper';
-import { EmojiPicker } from 'emoji-picker-js';
-import { inputKeyCodes } from '../../utils/keyCodes.js';
-import { Epml } from '../../../epml.js';
+import { LitElement, html, css } from "lit"
+import { escape, unescape } from 'html-escaper'
+import { EmojiPicker } from 'emoji-picker-js'
+import { inputKeyCodes } from '../../utils/keyCodes.js'
+import { Epml } from '../../../epml.js'
+import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
+
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
-const parentEpml = new Epml({ type: 'WINDOW', source: window.parent });
class ChatTextEditor extends LitElement {
static get properties() {
return {
@@ -298,13 +299,13 @@ class ChatTextEditor extends LitElement {
}
window.addEventListener('storage', () => {
- const checkTheme = localStorage.getItem('qortalTheme');
- const chatbar = this.shadowRoot.getElementById(this.iframeId).contentWindow.document.getElementById('chatbarId');
+ const checkTheme = localStorage.getItem('qortalTheme')
+ const chatbar = this.shadowRoot.getElementById(this.iframeId).contentWindow.document.getElementById('chatbarId')
if (checkTheme === 'dark') {
- this.theme = 'dark';
+ this.theme = 'dark'
chatbar.style.cssText = "color:#ffffff;"
} else {
- this.theme = 'light';
+ this.theme = 'light'
chatbar.style.cssText = "color:#080808;"
}
})
@@ -323,18 +324,18 @@ class ChatTextEditor extends LitElement {
boxShadow: 'rgba(4, 4, 5, 0.15) 0px 0px 0px 1px, rgba(0, 0, 0, 0.24) 0px 8px 16px 0px',
zIndex: 100
- });
+ })
this.emojiPicker.on('emoji', selection => {
- const emojiHtmlString = `
+
+
+ `
+ ) : (
+ html`
+ ${translate("chatpage.cchange36")}
+ +
+ ${this.searchResults.length === 0 ? (
+ html`
+ `
+ )}
+ ${translate("chatpage.cchange37")}
` + ) : ( + html` + ${this.searchResults.map((result) => { + return ( + html` + {
+ this.shadowRoot.querySelector(".chat-result-card").classList.add("active");
+ this.onClickFunc(result);
+ }}>
+
+ `
+ )}
+ )}
+ `
+ )}
+ + ${result.name} +
+![${`badge-${adresslevel}`}](${`/img/badges/level-${adresslevel}.png`})
+ {
+ this.setOpenUserInfo(false)
+ }}
+ >
+
+ ${this.isImageLoaded ? html`
+ `
+ }
}
- static styles = [userInfoStyles]
-
- createImage(imageUrl) {
- const imageHTMLRes = new Image();
- imageHTMLRes.src = imageUrl;
- imageHTMLRes.classList.add("user-info-avatar");
- imageHTMLRes.onload = () => {
- this.isImageLoaded = true;
- }
- imageHTMLRes.onerror = () => {
- if (this.imageFetches < 4) {
- setTimeout(() => {
- this.imageFetches = this.imageFetches + 1;
- imageHTMLRes.src = imageUrl;
- }, 500);
- } else {
- this.isImageLoaded = false
- }
- };
- return imageHTMLRes;
- }
-
-
- render() {
- let avatarImg = "";
- if (this.selectedHead && this.selectedHead.name) {
- const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port;
- const avatarUrl = `${nodeUrl}/arbitrary/THUMBNAIL/${this.selectedHead.name}/qortal_avatar?async=true&apiKey=${myNode.apiKey}`;
- avatarImg = this.createImage(avatarUrl);
- }
- return html`
- ${avatarImg}
` : html``}
+ ${!this.isImageLoaded && this.selectedHead && this.selectedHead.name ? html`
+
+
+ ` : ""}
+ ${!this.isImageLoaded && this.selectedHead && !this.selectedHead.name ? html`
+
+ ${this.selectedHead.name.charAt(0)}
+
+
+
+
`
+ : ""}
+ ![avatar](/img/incognito.png)
+ ${this.selectedHead && this.selectedHead.name ? this.selectedHead.name : this.selectedHead ? cropAddress(this.selectedHead.address) : null}
+
+ {
+ this.setOpenPrivateMessage({
+ name: this.userName,
+ open: true
+ })
+ this.setOpenUserInfo(false)
+ }}">
+ ${translate("chatpage.cchange58")}
+
+ {
+ this.setOpenTipUser(true)
+ this.setOpenUserInfo(false)
+ }}>
+ ${translate("chatpage.cchange59")}
+
+
- {
- this.setOpenUserInfo(false)
- }}>
-
- ${this.isImageLoaded ?
- html`
-
- `
- }
-}
-customElements.define('user-info', UserInfo);
+customElements.define('user-info', UserInfo)
diff --git a/plugins/plugins/core/components/WrapperModal.js b/plugins/plugins/core/components/WrapperModal.js
index bcb85e5b..e4d5f162 100644
--- a/plugins/plugins/core/components/WrapperModal.js
+++ b/plugins/plugins/core/components/WrapperModal.js
@@ -1,33 +1,32 @@
-import { LitElement, html } from 'lit';
-import { render } from 'lit/html.js';
+import { LitElement, html } from 'lit'
+import { render } from 'lit/html.js'
import { wrapperModalStyles } from './WrapperModal-css.js'
export class WrapperModal extends LitElement {
- static get properties() {
- return {
- customStyle: {type: String},
- onClickFunc: { attribute: false },
- zIndex: {type: Number}
+ static get properties() {
+ return {
+ customStyle: {type: String},
+ onClickFunc: { attribute: false },
+ zIndex: {type: Number}
+ }
}
- }
- static styles = [wrapperModalStyles]
+ static styles = [wrapperModalStyles]
- render() {
- return html`
-
- ${avatarImg}
-
` :
- html``}
- ${!this.isImageLoaded && this.selectedHead && this.selectedHead.name ?
- html`
-
-
- `
- : ""}
- ${!this.isImageLoaded && this.selectedHead && !this.selectedHead.name ?
- html`
-
- ${this.selectedHead.name.charAt(0)}
-
-
-
-
`
- : ""}
- ![avatar](/img/incognito.png)
- ${this.selectedHead && this.selectedHead.name ? this.selectedHead.name : this.selectedHead ? cropAddress(this.selectedHead.address) : null}
-
- {
- this.setOpenPrivateMessage({
- name: this.userName,
- open: true
- })
- this.setOpenUserInfo(false);
- }
- }">
- ${translate("chatpage.cchange58")}
-
- {
- this.setOpenTipUser(true);
- this.setOpenUserInfo(false);
- }}>
- ${translate("chatpage.cchange59")}
-
-
-
- `;
- }
+ render() {
+ return html`
+ {
- this.onClickFunc();
- }}>
-
-
-
-
-
+
+ `
+ }
}
-customElements.define('wrapper-modal', WrapperModal);
+customElements.define('wrapper-modal', WrapperModal)
diff --git a/plugins/plugins/core/components/qdn-action-encryption.js b/plugins/plugins/core/components/qdn-action-encryption.js
index e9bd4f1d..0da5ca8e 100644
--- a/plugins/plugins/core/components/qdn-action-encryption.js
+++ b/plugins/plugins/core/components/qdn-action-encryption.js
@@ -107,7 +107,217 @@ export const encryptData = ({ data64, recipientPublicKey }) => {
recipientPublicKey
}
} catch (error) {
- console.log({ error })
throw new Error("Error in encrypting data")
}
-}
\ No newline at end of file
+}
+
+export const encryptDataGroup = ({ data64, publicKeys }) => {
+ const userPublicKey = window.parent.reduxStore.getState().app.selectedAddress.base58PublicKey
+ let combinedPublicKeys = publicKeys
+ if (userPublicKey) {
+ combinedPublicKeys = [...publicKeys, userPublicKey]
+ }
+
+ const publicKeysDuplicateFree = [...new Set(combinedPublicKeys)];
+ const Uint8ArrayData = base64ToUint8Array(data64)
+
+ if (!(Uint8ArrayData instanceof Uint8Array)) {
+ throw new Error("The Uint8ArrayData you've submitted is invalid")
+ }
+
+ try {
+ const privateKey = window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey
+ if (!privateKey) {
+ throw new Error("Unable to retrieve keys")
+ }
+
+ // Generate a random symmetric key for the message.
+ const messageKey = new Uint8Array(32);
+ window.crypto.getRandomValues(messageKey);
+
+ const nonce = new Uint8Array(24);
+ window.crypto.getRandomValues(nonce);
+
+ // Encrypt the data with the symmetric key.
+ const encryptedData = nacl.secretbox(Uint8ArrayData, nonce, messageKey);
+
+ // Generate a keyNonce outside of the loop.
+ const keyNonce = new Uint8Array(24);
+ window.crypto.getRandomValues(keyNonce);
+
+ // Encrypt the symmetric key for each recipient.
+ let encryptedKeys = [];
+ publicKeysDuplicateFree.forEach((recipientPublicKey) => {
+ const publicKeyUnit8Array = window.parent.Base58.decode(recipientPublicKey)
+
+ const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
+ const convertedPublicKey = ed2curve.convertPublicKey(publicKeyUnit8Array)
+
+ const sharedSecret = new Uint8Array(32)
+ // the length of the sharedSecret will be 32 + 16
+ // When you're encrypting data using nacl.secretbox, it's adding an authentication tag to the result, which is 16 bytes long. This tag is used for verifying the integrity and authenticity of the data when it is decrypted
+
+ nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
+
+ // Encrypt the symmetric key with the shared secret.
+ const encryptedKey = nacl.secretbox(messageKey, keyNonce, sharedSecret);
+
+ encryptedKeys.push(encryptedKey);
+ });
+ const str = "qortalGroupEncryptedData";
+ const strEncoder = new TextEncoder();
+ const strUint8Array = strEncoder.encode(str);
+
+ // Convert sender's public key to Uint8Array and add to the message
+ const senderPublicKeyUint8Array = window.parent.Base58.decode(userPublicKey);
+
+ // Combine all data into a single Uint8Array.
+ // Calculate size of combinedData
+ let combinedDataSize = strUint8Array.length + nonce.length + keyNonce.length + senderPublicKeyUint8Array.length + encryptedData.length + 4;
+ let encryptedKeysSize = 0;
+
+ encryptedKeys.forEach((key) => {
+ encryptedKeysSize += key.length;
+ });
+
+ combinedDataSize += encryptedKeysSize;
+
+ let combinedData = new Uint8Array(combinedDataSize);
+
+ combinedData.set(strUint8Array);
+ combinedData.set(nonce, strUint8Array.length);
+ combinedData.set(keyNonce, strUint8Array.length + nonce.length);
+ combinedData.set(senderPublicKeyUint8Array, strUint8Array.length + nonce.length + keyNonce.length);
+ combinedData.set(encryptedData, strUint8Array.length + nonce.length + keyNonce.length + senderPublicKeyUint8Array.length);
+
+ // Initialize offset for encryptedKeys
+ let encryptedKeysOffset = strUint8Array.length + nonce.length + keyNonce.length + senderPublicKeyUint8Array.length + encryptedData.length;
+ encryptedKeys.forEach((key) => {
+ combinedData.set(key, encryptedKeysOffset);
+ encryptedKeysOffset += key.length;
+ });
+ const countArray = new Uint8Array(new Uint32Array([publicKeysDuplicateFree.length]).buffer);
+ combinedData.set(countArray, combinedData.length - 4);
+ const uint8arrayToData64 = uint8ArrayToBase64(combinedData)
+ return uint8arrayToData64;
+
+ } catch (error) {
+ throw new Error("Error in encrypting data")
+ }
+}
+
+
+export function uint8ArrayStartsWith(uint8Array, string) {
+ const stringEncoder = new TextEncoder();
+ const stringUint8Array = stringEncoder.encode(string);
+
+ if (uint8Array.length < stringUint8Array.length) {
+ return false;
+ }
+
+ for (let i = 0; i < stringUint8Array.length; i++) {
+ if (uint8Array[i] !== stringUint8Array[i]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+export function decryptDeprecatedSingle(uint8Array, publicKey) {
+ const combinedData = uint8Array
+ const str = "qortalEncryptedData";
+ const strEncoder = new TextEncoder();
+ const strUint8Array = strEncoder.encode(str);
+
+ const strData = combinedData.slice(0, strUint8Array.length);
+ const nonce = combinedData.slice(strUint8Array.length, strUint8Array.length + 24);
+ const _encryptedData = combinedData.slice(strUint8Array.length + 24);
+
+ const privateKey = window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey
+ const _publicKey = window.parent.Base58.decode(publicKey)
+
+ if (!privateKey || !_publicKey) {
+
+ throw new Error("Unable to retrieve keys")
+ }
+
+ const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
+ const convertedPublicKey = ed2curve.convertPublicKey(_publicKey)
+ const sharedSecret = new Uint8Array(32);
+ nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
+
+ const _chatEncryptionSeed = new window.parent.Sha256().process(sharedSecret).finish().result
+ const _decryptedData = nacl.secretbox.open(_encryptedData, nonce, _chatEncryptionSeed)
+ if (!_decryptedData) {
+ throw new Error("Unable to decrypt")
+ }
+ const decryptedDataToBase64 = uint8ArrayToBase64(_decryptedData)
+ return decryptedDataToBase64
+}
+
+export function decryptGroupData(data64EncryptedData) {
+ const allCombined = base64ToUint8Array(data64EncryptedData);
+ const str = "qortalGroupEncryptedData";
+ const strEncoder = new TextEncoder();
+ const strUint8Array = strEncoder.encode(str);
+
+ // Extract the nonce
+ const nonceStartPosition = strUint8Array.length;
+ const nonceEndPosition = nonceStartPosition + 24; // Nonce is 24 bytes
+ const nonce = allCombined.slice(nonceStartPosition, nonceEndPosition);
+
+ // Extract the shared keyNonce
+ const keyNonceStartPosition = nonceEndPosition;
+ const keyNonceEndPosition = keyNonceStartPosition + 24; // Nonce is 24 bytes
+ const keyNonce = allCombined.slice(keyNonceStartPosition, keyNonceEndPosition);
+
+ // Extract the sender's public key
+ const senderPublicKeyStartPosition = keyNonceEndPosition;
+ const senderPublicKeyEndPosition = senderPublicKeyStartPosition + 32; // Public keys are 32 bytes
+ const senderPublicKey = allCombined.slice(senderPublicKeyStartPosition, senderPublicKeyEndPosition);
+
+ // Calculate count first
+ const countStartPosition = allCombined.length - 4; // 4 bytes before the end, since count is stored in Uint32 (4 bytes)
+ const countArray = allCombined.slice(countStartPosition, countStartPosition + 4);
+ const count = new Uint32Array(countArray.buffer)[0];
+
+ // Then use count to calculate encryptedData
+ const encryptedDataStartPosition = senderPublicKeyEndPosition; // start position of encryptedData
+ const encryptedDataEndPosition = allCombined.length - ((count * (32 + 16)) + 4);
+ const encryptedData = allCombined.slice(encryptedDataStartPosition, encryptedDataEndPosition);
+
+ // Extract the encrypted keys
+ // 32+16 = 48
+ const combinedKeys = allCombined.slice(encryptedDataEndPosition, encryptedDataEndPosition + (count * 48));
+ const privateKey = window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey
+
+ if (!privateKey) {
+ throw new Error("Unable to retrieve keys")
+ }
+
+ const convertedPrivateKey = ed2curve.convertSecretKey(privateKey)
+ const convertedSenderPublicKey = ed2curve.convertPublicKey(senderPublicKey)
+ const sharedSecret = new Uint8Array(32)
+ nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedSenderPublicKey)
+ for (let i = 0; i < count; i++) {
+ const encryptedKey = combinedKeys.slice(i * 48, (i + 1) * 48);
+
+ // Decrypt the symmetric key.
+ const decryptedKey = nacl.secretbox.open(encryptedKey, keyNonce, sharedSecret);
+
+ // If decryption was successful, decryptedKey will not be null.
+ if (decryptedKey) {
+ // Decrypt the data using the symmetric key.
+ const decryptedData = nacl.secretbox.open(encryptedData, nonce, decryptedKey);
+
+ // If decryption was successful, decryptedData will not be null.
+ if (decryptedData) {
+
+ return decryptedData
+ }
+ }
+ }
+
+ throw new Error("Unable to decrypt data")
+}
diff --git a/plugins/plugins/core/components/qdn-action-types.js b/plugins/plugins/core/components/qdn-action-types.js
index e5e9d9c8..fd337ad1 100644
--- a/plugins/plugins/core/components/qdn-action-types.js
+++ b/plugins/plugins/core/components/qdn-action-types.js
@@ -43,6 +43,9 @@ export const ENCRYPT_DATA = 'ENCRYPT_DATA'
// DECRYPT_DATA
export const DECRYPT_DATA = 'DECRYPT_DATA'
+// DECRYPT_DATA_GROUP
+export const DECRYPT_DATA_GROUP = 'DECRYPT_DATA_GROUP'
+
// SAVE_FILE
export const SAVE_FILE = 'SAVE_FILE'
diff --git a/plugins/plugins/core/components/qortal-info-view.js b/plugins/plugins/core/components/qortal-info-view.js
index 080e71aa..c212e8c7 100644
--- a/plugins/plugins/core/components/qortal-info-view.js
+++ b/plugins/plugins/core/components/qortal-info-view.js
@@ -1,7 +1,6 @@
import { LitElement, html, css } from 'lit'
import { render } from 'lit/html.js'
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
-
import '@polymer/paper-dialog/paper-dialog.js'
import '@material/mwc-button'
import '@material/mwc-icon'
diff --git a/plugins/plugins/core/group-management/group-management.src.js b/plugins/plugins/core/group-management/group-management.src.js
index 7e1e7f57..bd35cc58 100644
--- a/plugins/plugins/core/group-management/group-management.src.js
+++ b/plugins/plugins/core/group-management/group-management.src.js
@@ -1849,6 +1849,18 @@ class GroupManagement extends LitElement {
})
})
parentEpml.imReady()
+ this.clearConsole()
+ setInterval(() => {
+ this.clearConsole()
+ }, 60000)
+ }
+
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
}
changeTheme() {
diff --git a/plugins/plugins/core/main.src.js b/plugins/plugins/core/main.src.js
index 884b949c..56daa295 100644
--- a/plugins/plugins/core/main.src.js
+++ b/plugins/plugins/core/main.src.js
@@ -1,8 +1,8 @@
import { parentEpml } from './connect.js';
import './streams/streams.js';
-let config = {};
-let haveRegisteredNodeManagement = false;
+let config = {}
+let haveRegisteredNodeManagement = false
parentEpml.ready().then(() => {
// pluginUrlsConf
@@ -186,20 +186,20 @@ parentEpml.ready().then(() => {
];
const registerPlugins = (pluginInfo) => {
- parentEpml.request('registerUrl', pluginInfo);
+ parentEpml.request('registerUrl', pluginInfo)
};
const checkNode =
window.parent.reduxStore.getState().app.nodeConfig.knownNodes[
window.parent.reduxStore.getState().app.nodeConfig.node
- ];
+ ]
parentEpml.subscribe('config', (c) => {
- config = JSON.parse(c);
+ config = JSON.parse(c)
// Only register node management if node management is enabled and it hasn't already been registered
if (!haveRegisteredNodeManagement && checkNode.enableManagement) {
- haveRegisteredNodeManagement = true;
+ haveRegisteredNodeManagement = true
let nodeManagementConf = {
url: 'node-management',
@@ -213,10 +213,10 @@ parentEpml.ready().then(() => {
parent: false,
};
- let _pluginUrlsConf = [...pluginUrlsConf, nodeManagementConf];
- registerPlugins(_pluginUrlsConf);
+ let _pluginUrlsConf = [...pluginUrlsConf, nodeManagementConf]
+ registerPlugins(_pluginUrlsConf)
} else {
- registerPlugins(pluginUrlsConf);
+ registerPlugins(pluginUrlsConf)
}
- });
-});
\ No newline at end of file
+ })
+})
\ No newline at end of file
diff --git a/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js b/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js
index 7b38cd56..7b9de6e1 100644
--- a/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js
+++ b/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js
@@ -1,6 +1,10 @@
import { LitElement, html, css } from 'lit'
+import { render } from 'lit/html.js'
+import { Epml } from '../../../../epml.js'
import isElectron from 'is-electron'
+const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
+
class ChainMessaging extends LitElement {
static get properties() {
return {
@@ -44,12 +48,18 @@ class ChainMessaging extends LitElement {
}
firstUpdated() {
-
this.changeTheme()
- setInterval(() => {
- this.changeTheme();
- }, 100)
+ window.addEventListener('storage', () => {
+ const checkTheme = localStorage.getItem('qortalTheme')
+
+ if (checkTheme === 'dark') {
+ this.theme = 'dark'
+ } else {
+ this.theme = 'light'
+ }
+ document.querySelector('html').setAttribute('theme', this.theme)
+ })
if (!isElectron()) {
} else {
@@ -60,6 +70,14 @@ class ChainMessaging extends LitElement {
}
}
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
+ }
+
changeTheme() {
const checkTheme = localStorage.getItem('qortalTheme')
if (checkTheme === 'dark') {
diff --git a/plugins/plugins/core/messaging/messaging.src.js b/plugins/plugins/core/messaging/messaging.src.js
index 8a3b093f..cf7316ac 100644
--- a/plugins/plugins/core/messaging/messaging.src.js
+++ b/plugins/plugins/core/messaging/messaging.src.js
@@ -138,13 +138,8 @@ class Messaging extends LitElement {
}
firstUpdated() {
-
this.changeTheme()
- setInterval(() => {
- this.changeTheme();
- }, 100)
-
if (!isElectron()) {
} else {
window.addEventListener('contextmenu', (event) => {
@@ -170,6 +165,18 @@ class Messaging extends LitElement {
})
})
parentEpml.imReady()
+ this.clearConsole()
+ setInterval(() => {
+ this.clearConsole()
+ }, 60000)
+ }
+
+ clearConsole() {
+ if (!isElectron()) {
+ } else {
+ console.clear()
+ window.parent.electronAPI.clearCache()
+ }
}
changeTheme() {
diff --git a/plugins/plugins/core/messaging/q-chat/q-chat.js b/plugins/plugins/core/messaging/q-chat/q-chat.js
deleted file mode 100644
index 18e1257f..00000000
--- a/plugins/plugins/core/messaging/q-chat/q-chat.js
+++ /dev/null
@@ -1,9654 +0,0 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e=window,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;let n=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=o.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&o.set(i,e))}return e}toString(){return this.cssText}};const s=(e,...t)=>{const o=1===e.length?e[0]:t.reduce(((t,i,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1]),e[0]);return new n(o,e,i)},r=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new n("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var a;const l=window,h=l.trustedTypes,m=h?h.emptyScript:"",c=l.reactiveElementPolyfillSupport,d={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},p=(e,t)=>t!==e&&(t==t||e==e),j={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:p};let P=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const o=this._$Ep(i,t);void 0!==o&&(this._$Ev.set(o,i),e.push(o))})),e}static createProperty(e,t=j){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,o=this.getPropertyDescriptor(e,i,t);void 0!==o&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(o){const n=this[e];this[t]=o,this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||j}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var i;const o=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,o)=>{t?i.adoptedStyleSheets=o.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):o.forEach((t=>{const o=document.createElement("style"),n=e.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=t.cssText,i.appendChild(o)}))})(o,this.constructor.elementStyles),o}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=j){var o;const n=this.constructor._$Ep(e,i);if(void 0!==n&&!0===i.reflect){const s=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:d).toAttribute(t,i.type);this._$El=e,null==s?this.removeAttribute(n):this.setAttribute(n,s),this._$El=null}}_$AK(e,t){var i;const o=this.constructor,n=o._$Ev.get(e);if(void 0!==n&&this._$El!==n){const e=o.getPropertyOptions(n),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(i=e.converter)||void 0===i?void 0:i.fromAttribute)?e.converter:d;this._$El=n,this[n]=s.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,i){let o=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||p)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(i)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};var w;P.finalized=!0,P.elementProperties=new Map,P.elementStyles=[],P.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:P}),(null!==(a=l.reactiveElementVersions)&&void 0!==a?a:l.reactiveElementVersions=[]).push("1.6.1");const u=window,f=u.trustedTypes,M=f?f.createPolicy("lit-html",{createHTML:e=>e}):void 0,Z="$lit$",K=`lit$${(Math.random()+"").slice(9)}$`,y="?"+K,g=`<${y}>`,D=document,x=()=>D.createComment(""),b=e=>null===e||"object"!=typeof e&&"function"!=typeof e,v=Array.isArray,Y=e=>v(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),S="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,X=/-->/g,E=/>/g,k=RegExp(`>|${S}(?:([^\\s"'>=/]+)(${S}*=${S}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,G=/"/g,A=/^(?:script|style|textarea|title)$/i,O=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),C=O(1),N=O(2),V=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),_=new WeakMap,I=D.createTreeWalker(D,129,null,!1),H=(e,t)=>{const i=e.length-1,o=[];let n,s=2===t?"":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==M?M.createHTML(a):a,o]};let U=class e{constructor({strings:t,_$litType$:i},o){let n;this.parts=[];let s=0,r=0;const a=t.length-1,l=this.parts,[h,m]=H(t,i);if(this.el=e.createElement(h,o),I.currentNode=this.el.content,2===i){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=I.nextNode())&&l.length0){n.textContent=f?f.emptyScript:"";for(let i=0;i { this.onClickFunc() }}
+ >
+
+
+
+
+
-
`}renderHeading(){return C`
-
-
-
-
- ${t}
-
-
-
-
-
- ${this.heading}
`}firstUpdated(){super.firstUpdated(),this.mdcFoundation.setAutoStackButtons(!0),this.initialSupressDefaultPressSelector?this.suppressDefaultPressSelector=this.initialSupressDefaultPressSelector:this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,"mwc-textarea","mwc-menu mwc-list-item","mwc-select mwc-list-item"].join(", "),this.boundHandleClick=this.mdcFoundation.handleClick.bind(this.mdcFoundation),this.boundHandleKeydown=this.mdcFoundation.handleKeydown.bind(this.mdcFoundation),this.boundHandleDocumentKeydown=this.mdcFoundation.handleDocumentKeydown.bind(this.mdcFoundation)}connectedCallback(){super.connectedCallback(),this.open&&this.mdcFoundation&&!this.mdcFoundation.isOpen()&&(this.setEventListeners(),this.mdcFoundation.open())}disconnectedCallback(){super.disconnectedCallback(),this.open&&this.mdcFoundation&&(this.removeEventListeners(),this.closingDueToDisconnect=!0,this.mdcFoundation.close(this.currentAction||this.defaultAction),this.closingDueToDisconnect=!1,this.currentAction=void 0,_i.remove(this))}forceLayout(){this.mdcFoundation.layout()}focus(){const e=this.getInitialFocusEl();e&&e.focus()}blur(){if(!this.shadowRoot)return;const e=this.shadowRoot.activeElement;if(e)e instanceof HTMLElement&&e.blur();else{const e=this.getRootNode(),t=e instanceof Document?e.activeElement:null;t instanceof HTMLElement&&t.blur()}}setEventListeners(){this.boundHandleClick&&this.mdcRoot.addEventListener("click",this.boundHandleClick),this.boundHandleKeydown&&this.mdcRoot.addEventListener("keydown",this.boundHandleKeydown,Vi()),this.boundHandleDocumentKeydown&&document.addEventListener("keydown",this.boundHandleDocumentKeydown,Vi())}removeEventListeners(){this.boundHandleClick&&this.mdcRoot.removeEventListener("click",this.boundHandleClick),this.boundHandleKeydown&&this.mdcRoot.removeEventListener("keydown",this.boundHandleKeydown),this.boundHandleDocumentKeydown&&document.removeEventListener("keydown",this.boundHandleDocumentKeydown)}close(){this.open=!1}show(){this.open=!0}}Rt([ei(".mdc-dialog")],Ii.prototype,"mdcRoot",void 0),Rt([ei('slot[name="primaryAction"]')],Ii.prototype,"primarySlot",void 0),Rt([ei('slot[name="secondaryAction"]')],Ii.prototype,"secondarySlot",void 0),Rt([ei("#contentSlot")],Ii.prototype,"contentSlot",void 0),Rt([ei(".mdc-dialog__content")],Ii.prototype,"contentElement",void 0),Rt([ei(".mdc-container")],Ii.prototype,"conatinerElement",void 0),Rt([Bt({type:Boolean})],Ii.prototype,"hideActions",void 0),Rt([Bt({type:Boolean}),Wi((function(){this.forceLayout()}))],Ii.prototype,"stacked",void 0),Rt([Bt({type:String})],Ii.prototype,"heading",void 0),Rt([Bt({type:String}),Wi((function(e){this.mdcFoundation.setScrimClickAction(e)}))],Ii.prototype,"scrimClickAction",void 0),Rt([Bt({type:String}),Wi((function(e){this.mdcFoundation.setEscapeKeyAction(e)}))],Ii.prototype,"escapeKeyAction",void 0),Rt([Bt({type:Boolean,reflect:!0}),Wi((function(e){this.mdcFoundation&&this.isConnected&&(e?(this.setEventListeners(),this.mdcFoundation.open()):(this.removeEventListeners(),this.mdcFoundation.close(this.currentAction||this.defaultAction),this.currentAction=void 0))}))],Ii.prototype,"open",void 0),Rt([Bt()],Ii.prototype,"defaultAction",void 0),Rt([Bt()],Ii.prototype,"actionAttribute",void 0),Rt([Bt()],Ii.prototype,"initialFocusAttribute",void 0);const Hi=s`.mdc-dialog .mdc-dialog__surface{background-color:#fff;background-color:var(--mdc-theme-surface, #fff)}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(0,0,0,.32)}.mdc-dialog .mdc-dialog__surface-scrim{background-color:rgba(0,0,0,.32)}.mdc-dialog .mdc-dialog__title{color:rgba(0,0,0,.87)}.mdc-dialog .mdc-dialog__content{color:rgba(0,0,0,.6)}.mdc-dialog .mdc-dialog__close{color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::after{background-color:#000;background-color:var(--mdc-ripple-color, var(--mdc-theme-on-surface, #000))}.mdc-dialog .mdc-dialog__close:hover .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close.mdc-ripple-surface--hover .mdc-icon-button__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded--background-focused .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):focus .mdc-icon-button__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded) .mdc-icon-button__ripple::after{transition:opacity 150ms linear}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):active .mdc-icon-button__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title,.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions,.mdc-dialog.mdc-dialog--scrollable.mdc-dialog-scroll-divider-footer .mdc-dialog__actions{border-color:rgba(0,0,0,.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:0}.mdc-dialog.mdc-dialog-scroll-divider-header.mdc-dialog--fullscreen .mdc-dialog__header{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12)}.mdc-dialog .mdc-dialog__surface{border-radius:4px;border-radius:var(--mdc-shape-medium, 4px)}.mdc-dialog__surface{box-shadow:0px 11px 15px -7px rgba(0, 0, 0, 0.2),0px 24px 38px 3px rgba(0, 0, 0, 0.14),0px 9px 46px 8px rgba(0,0,0,.12)}.mdc-dialog__title{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-headline6-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1.25rem;font-size:var(--mdc-typography-headline6-font-size, 1.25rem);line-height:2rem;line-height:var(--mdc-typography-headline6-line-height, 2rem);font-weight:500;font-weight:var(--mdc-typography-headline6-font-weight, 500);letter-spacing:0.0125em;letter-spacing:var(--mdc-typography-headline6-letter-spacing, 0.0125em);text-decoration:inherit;text-decoration:var(--mdc-typography-headline6-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-headline6-text-transform, inherit)}.mdc-dialog__content{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-body1-font-size, 1rem);line-height:1.5rem;line-height:var(--mdc-typography-body1-line-height, 1.5rem);font-weight:400;font-weight:var(--mdc-typography-body1-font-weight, 400);letter-spacing:0.03125em;letter-spacing:var(--mdc-typography-body1-letter-spacing, 0.03125em);text-decoration:inherit;text-decoration:var(--mdc-typography-body1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body1-text-transform, inherit)}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-dialog,.mdc-dialog__scrim{position:fixed;top:0;left:0;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:100%}.mdc-dialog{display:none;z-index:7;z-index:var(--mdc-dialog-z-index, 7)}.mdc-dialog .mdc-dialog__content{padding:20px 24px 20px 24px}.mdc-dialog .mdc-dialog__surface{min-width:280px}@media(max-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:calc(100vw - 32px)}}@media(min-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:560px}}.mdc-dialog .mdc-dialog__surface{max-height:calc(100% - 32px)}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-width:none}@media(max-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px;width:560px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media(max-width: 720px)and (max-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 112px)}}@media(max-width: 720px)and (min-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:560px}}@media(max-width: 720px)and (max-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:calc(100vh - 160px)}}@media(max-width: 720px)and (min-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px}}@media(max-width: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media(max-width: 720px)and (max-height: 400px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media(max-width: 600px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media(min-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 400px)}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}.mdc-dialog.mdc-dialog__scrim--hidden .mdc-dialog__scrim{opacity:0}.mdc-dialog__scrim{opacity:0;z-index:-1}.mdc-dialog__container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;transform:scale(0.8);opacity:0;pointer-events:none}.mdc-dialog__surface{position:relative;display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;max-width:100%;max-height:100%;pointer-events:auto;overflow-y:auto}.mdc-dialog__surface .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}[dir=rtl] .mdc-dialog__surface,.mdc-dialog__surface[dir=rtl]{text-align:right}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-dialog__surface{outline:2px solid windowText}}.mdc-dialog__surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid transparent;border-radius:inherit;content:"";pointer-events:none}@media screen and (forced-colors: active){.mdc-dialog__surface::before{border-color:CanvasText}}@media screen and (-ms-high-contrast: active),screen and (-ms-high-contrast: none){.mdc-dialog__surface::before{content:none}}.mdc-dialog__title{display:block;margin-top:0;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:0 24px 9px}.mdc-dialog__title::before{display:inline-block;width:0;height:40px;content:"";vertical-align:0}[dir=rtl] .mdc-dialog__title,.mdc-dialog__title[dir=rtl]{text-align:right}.mdc-dialog--scrollable .mdc-dialog__title{margin-bottom:1px;padding-bottom:15px}.mdc-dialog--fullscreen .mdc-dialog__header{align-items:baseline;border-bottom:1px solid transparent;display:inline-flex;justify-content:space-between;padding:0 24px 9px;z-index:1}@media screen and (forced-colors: active){.mdc-dialog--fullscreen .mdc-dialog__header{border-bottom-color:CanvasText}}.mdc-dialog--fullscreen .mdc-dialog__header .mdc-dialog__close{right:-12px}.mdc-dialog--fullscreen .mdc-dialog__title{margin-bottom:0;padding:0;border-bottom:0}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:0;margin-bottom:0}.mdc-dialog--fullscreen .mdc-dialog__close{top:5px}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__actions{border-top:1px solid transparent}@media screen and (forced-colors: active){.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__actions{border-top-color:CanvasText}}.mdc-dialog__content{flex-grow:1;box-sizing:border-box;margin:0;overflow:auto}.mdc-dialog__content>:first-child{margin-top:0}.mdc-dialog__content>:last-child{margin-bottom:0}.mdc-dialog__title+.mdc-dialog__content,.mdc-dialog__header+.mdc-dialog__content{padding-top:0}.mdc-dialog--scrollable .mdc-dialog__title+.mdc-dialog__content{padding-top:8px;padding-bottom:8px}.mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:6px 0 0}.mdc-dialog--scrollable .mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:0}.mdc-dialog__actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;justify-content:flex-end;box-sizing:border-box;min-height:52px;margin:0;padding:8px;border-top:1px solid transparent}@media screen and (forced-colors: active){.mdc-dialog__actions{border-top-color:CanvasText}}.mdc-dialog--stacked .mdc-dialog__actions{flex-direction:column;align-items:flex-end}.mdc-dialog__button{margin-left:8px;margin-right:0;max-width:100%;text-align:right}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{margin-left:0;margin-right:8px}.mdc-dialog__button:first-child{margin-left:0;margin-right:0}[dir=rtl] .mdc-dialog__button:first-child,.mdc-dialog__button:first-child[dir=rtl]{margin-left:0;margin-right:0}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{text-align:left}.mdc-dialog--stacked .mdc-dialog__button:not(:first-child){margin-top:12px}.mdc-dialog--open,.mdc-dialog--opening,.mdc-dialog--closing{display:flex}.mdc-dialog--opening .mdc-dialog__scrim{transition:opacity 150ms linear}.mdc-dialog--opening .mdc-dialog__container{transition:opacity 75ms linear,transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-dialog--closing .mdc-dialog__scrim,.mdc-dialog--closing .mdc-dialog__container{transition:opacity 75ms linear}.mdc-dialog--closing .mdc-dialog__container{transform:none}.mdc-dialog--open .mdc-dialog__scrim{opacity:1}.mdc-dialog--open .mdc-dialog__container{transform:none;opacity:1}.mdc-dialog--open.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim{opacity:1;z-index:1}.mdc-dialog--open.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{transition:opacity 75ms linear}.mdc-dialog--open.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim{transition:opacity 150ms linear}.mdc-dialog__surface-scrim{display:none;opacity:0;position:absolute;width:100%;height:100%}.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{display:block}.mdc-dialog-scroll-lock{overflow:hidden}.mdc-dialog--no-content-padding .mdc-dialog__content{padding:0}.mdc-dialog--sheet .mdc-dialog__close{right:12px;top:9px;position:absolute;z-index:1}#actions:not(.mdc-dialog__actions){display:none}.mdc-dialog__surface{box-shadow:var(--mdc-dialog-box-shadow, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12))}@media(min-width: 560px){.mdc-dialog .mdc-dialog__surface{max-width:560px;max-width:var(--mdc-dialog-max-width, 560px)}}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(0, 0, 0, 0.32);background-color:var(--mdc-dialog-scrim-color, rgba(0, 0, 0, 0.32))}.mdc-dialog .mdc-dialog__title{color:rgba(0, 0, 0, 0.87);color:var(--mdc-dialog-heading-ink-color, rgba(0, 0, 0, 0.87))}.mdc-dialog .mdc-dialog__content{color:rgba(0, 0, 0, 0.6);color:var(--mdc-dialog-content-ink-color, rgba(0, 0, 0, 0.6))}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title,.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12))}.mdc-dialog .mdc-dialog__surface{min-width:280px;min-width:var(--mdc-dialog-min-width, 280px)}.mdc-dialog .mdc-dialog__surface{max-height:var(--mdc-dialog-max-height, calc(100% - 32px))}#actions ::slotted(*){margin-left:8px;margin-right:0;max-width:100%;text-align:right}[dir=rtl] #actions ::slotted(*),#actions ::slotted(*[dir=rtl]){margin-left:0;margin-right:8px}[dir=rtl] #actions ::slotted(*),#actions ::slotted(*[dir=rtl]){text-align:left}.mdc-dialog--stacked #actions{flex-direction:column-reverse}.mdc-dialog--stacked #actions *:not(:last-child) ::slotted(*){flex-basis:.000000001px;margin-top:12px}`;let Ui=class extends Ii{};Ui.styles=[Hi],Ui=Rt([Jt("mwc-dialog")],Ui);const Ri=!(window.ShadyDOM&&window.ShadyDOM.inUse);let Fi,Ji;function Li(e){Fi=(!e||!e.shimcssproperties)&&(Ri||Boolean(!navigator.userAgent.match(/AppleWebKit\/601|Edge\/15/)&&window.CSS&&CSS.supports&&CSS.supports("box-shadow","0 0 0 var(--foo)")))}window.ShadyCSS&&void 0!==window.ShadyCSS.cssBuild&&(Ji=window.ShadyCSS.cssBuild);const Bi=Boolean(window.ShadyCSS&&window.ShadyCSS.disableRuntime);window.ShadyCSS&&void 0!==window.ShadyCSS.nativeCss?Fi=window.ShadyCSS.nativeCss:window.ShadyCSS?(Li(window.ShadyCSS),window.ShadyCSS=void 0):Li(window.WebComponents&&window.WebComponents.flags);const Qi=Fi;class $i{constructor(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""}}function qi(e){return eo(function(e){let t=new $i;t.start=0,t.end=e.length;let i=t;for(let o=0,n=e.length;o
-
-`;Nl.setAttribute("strip-whitespace",""),$a({_template:Nl,is:"paper-spinner-lite",behaviors:[Cl]});class Vl extends HTMLElement{static get version(){return"24.0.4"}}customElements.define("vaadin-lumo-styles",Vl);const Wl=e=>class extends e{static get properties(){return{_theme:{type:String,readOnly:!0}}}static get observedAttributes(){return[...super.observedAttributes,"theme"]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),"theme"===e&&this._set_theme(i)}},_l=[];function Il(e){return e&&Object.prototype.hasOwnProperty.call(e,"__themes")}function Hl(e,t,i={}){var o;e&&(o=e,Il(customElements.get(o))&&console.warn(`The custom element definition for "${e}"\n was finalized before a style module was registered.\n Make sure to add component specific style modules before\n importing the corresponding custom element.`)),t=function(e=[]){return[e].flat(1/0).filter((e=>e instanceof n||(console.warn("An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`."),!1)))}(t),window.Vaadin&&window.Vaadin.styleModules?window.Vaadin.styleModules.registerStyles(e,t,i):_l.push({themeFor:e,styles:t,include:i.include,moduleId:i.moduleId})}function Ul(){return window.Vaadin&&window.Vaadin.styleModules?window.Vaadin.styleModules.getAllThemes():_l}function Rl(e=""){let t=0;return e.startsWith("lumo-")||e.startsWith("material-")?t=1:e.startsWith("vaadin-")&&(t=2),t}function Fl(e){const t=[];return e.include&&[].concat(e.include).forEach((e=>{const i=Ul().find((t=>t.moduleId===e));i?t.push(...Fl(i),...i.styles):console.warn(`Included moduleId ${e} not found in style registry`)}),e.styles),t}function Jl(e){const t=`${e}-default-theme`,i=Ul().filter((i=>i.moduleId!==t&&function(e,t){return(e||"").split(" ").some((e=>new RegExp(`^${e.split("*").join(".*")}$`,"u").test(t)))}(i.themeFor,e))).map((e=>({...e,styles:[...Fl(e),...e.styles],includePriority:Rl(e.moduleId)}))).sort(((e,t)=>t.includePriority-e.includePriority));return i.length>0?i:Ul().filter((e=>e.moduleId===t))}const Ll=e=>class extends(Wl(e)){static finalize(){if(super.finalize(),this.elementStyles)return;const e=this.prototype._template;e&&!Il(this)&&function(e,t){const i=document.createElement("style");i.innerHTML=e.map((e=>e.cssText)).join("\n"),t.content.appendChild(i)}(this.getStylesForThis(),e)}static finalizeStyles(e){const t=this.getStylesForThis();return e?[...super.finalizeStyles(e),...t]:t}static getStylesForThis(){const e=Object.getPrototypeOf(this.prototype),t=(e?e.constructor.__themes:[])||[];this.__themes=[...t,...Jl(this.is)];const i=this.__themes.flatMap((e=>e.styles));return i.filter(((e,t)=>t===i.lastIndexOf(e)))}},Bl=s`
- :host {
- /* Base (background) */
- --lumo-base-color: #fff;
-
- /* Tint */
- --lumo-tint-5pct: hsla(0, 0%, 100%, 0.3);
- --lumo-tint-10pct: hsla(0, 0%, 100%, 0.37);
- --lumo-tint-20pct: hsla(0, 0%, 100%, 0.44);
- --lumo-tint-30pct: hsla(0, 0%, 100%, 0.5);
- --lumo-tint-40pct: hsla(0, 0%, 100%, 0.57);
- --lumo-tint-50pct: hsla(0, 0%, 100%, 0.64);
- --lumo-tint-60pct: hsla(0, 0%, 100%, 0.7);
- --lumo-tint-70pct: hsla(0, 0%, 100%, 0.77);
- --lumo-tint-80pct: hsla(0, 0%, 100%, 0.84);
- --lumo-tint-90pct: hsla(0, 0%, 100%, 0.9);
- --lumo-tint: #fff;
-
- /* Shade */
- --lumo-shade-5pct: hsla(214, 61%, 25%, 0.05);
- --lumo-shade-10pct: hsla(214, 57%, 24%, 0.1);
- --lumo-shade-20pct: hsla(214, 53%, 23%, 0.16);
- --lumo-shade-30pct: hsla(214, 50%, 22%, 0.26);
- --lumo-shade-40pct: hsla(214, 47%, 21%, 0.38);
- --lumo-shade-50pct: hsla(214, 45%, 20%, 0.52);
- --lumo-shade-60pct: hsla(214, 43%, 19%, 0.6);
- --lumo-shade-70pct: hsla(214, 42%, 18%, 0.69);
- --lumo-shade-80pct: hsla(214, 41%, 17%, 0.83);
- --lumo-shade-90pct: hsla(214, 40%, 16%, 0.94);
- --lumo-shade: hsl(214, 35%, 15%);
-
- /* Contrast */
- --lumo-contrast-5pct: var(--lumo-shade-5pct);
- --lumo-contrast-10pct: var(--lumo-shade-10pct);
- --lumo-contrast-20pct: var(--lumo-shade-20pct);
- --lumo-contrast-30pct: var(--lumo-shade-30pct);
- --lumo-contrast-40pct: var(--lumo-shade-40pct);
- --lumo-contrast-50pct: var(--lumo-shade-50pct);
- --lumo-contrast-60pct: var(--lumo-shade-60pct);
- --lumo-contrast-70pct: var(--lumo-shade-70pct);
- --lumo-contrast-80pct: var(--lumo-shade-80pct);
- --lumo-contrast-90pct: var(--lumo-shade-90pct);
- --lumo-contrast: var(--lumo-shade);
-
- /* Text */
- --lumo-header-text-color: var(--lumo-contrast);
- --lumo-body-text-color: var(--lumo-contrast-90pct);
- --lumo-secondary-text-color: var(--lumo-contrast-70pct);
- --lumo-tertiary-text-color: var(--lumo-contrast-50pct);
- --lumo-disabled-text-color: var(--lumo-contrast-30pct);
-
- /* Primary */
- --lumo-primary-color: hsl(214, 100%, 48%);
- --lumo-primary-color-50pct: hsla(214, 100%, 49%, 0.76);
- --lumo-primary-color-10pct: hsla(214, 100%, 60%, 0.13);
- --lumo-primary-text-color: hsl(214, 100%, 43%);
- --lumo-primary-contrast-color: #fff;
-
- /* Error */
- --lumo-error-color: hsl(3, 85%, 48%);
- --lumo-error-color-50pct: hsla(3, 85%, 49%, 0.5);
- --lumo-error-color-10pct: hsla(3, 85%, 49%, 0.1);
- --lumo-error-text-color: hsl(3, 89%, 42%);
- --lumo-error-contrast-color: #fff;
-
- /* Success */
- --lumo-success-color: hsl(145, 72%, 30%);
- --lumo-success-color-50pct: hsla(145, 72%, 31%, 0.5);
- --lumo-success-color-10pct: hsla(145, 72%, 31%, 0.1);
- --lumo-success-text-color: hsl(145, 85%, 25%);
- --lumo-success-contrast-color: #fff;
- }
-`,Ql=document.createElement("template");Ql.innerHTML=``,document.head.appendChild(Ql.content);Hl("",s`
- [theme~='dark'] {
- /* Base (background) */
- --lumo-base-color: hsl(214, 35%, 21%);
-
- /* Tint */
- --lumo-tint-5pct: hsla(214, 65%, 85%, 0.06);
- --lumo-tint-10pct: hsla(214, 60%, 80%, 0.14);
- --lumo-tint-20pct: hsla(214, 64%, 82%, 0.23);
- --lumo-tint-30pct: hsla(214, 69%, 84%, 0.32);
- --lumo-tint-40pct: hsla(214, 73%, 86%, 0.41);
- --lumo-tint-50pct: hsla(214, 78%, 88%, 0.5);
- --lumo-tint-60pct: hsla(214, 82%, 90%, 0.58);
- --lumo-tint-70pct: hsla(214, 87%, 92%, 0.69);
- --lumo-tint-80pct: hsla(214, 91%, 94%, 0.8);
- --lumo-tint-90pct: hsla(214, 96%, 96%, 0.9);
- --lumo-tint: hsl(214, 100%, 98%);
-
- /* Shade */
- --lumo-shade-5pct: hsla(214, 0%, 0%, 0.07);
- --lumo-shade-10pct: hsla(214, 4%, 2%, 0.15);
- --lumo-shade-20pct: hsla(214, 8%, 4%, 0.23);
- --lumo-shade-30pct: hsla(214, 12%, 6%, 0.32);
- --lumo-shade-40pct: hsla(214, 16%, 8%, 0.41);
- --lumo-shade-50pct: hsla(214, 20%, 10%, 0.5);
- --lumo-shade-60pct: hsla(214, 24%, 12%, 0.6);
- --lumo-shade-70pct: hsla(214, 28%, 13%, 0.7);
- --lumo-shade-80pct: hsla(214, 32%, 13%, 0.8);
- --lumo-shade-90pct: hsla(214, 33%, 13%, 0.9);
- --lumo-shade: hsl(214, 33%, 13%);
-
- /* Contrast */
- --lumo-contrast-5pct: var(--lumo-tint-5pct);
- --lumo-contrast-10pct: var(--lumo-tint-10pct);
- --lumo-contrast-20pct: var(--lumo-tint-20pct);
- --lumo-contrast-30pct: var(--lumo-tint-30pct);
- --lumo-contrast-40pct: var(--lumo-tint-40pct);
- --lumo-contrast-50pct: var(--lumo-tint-50pct);
- --lumo-contrast-60pct: var(--lumo-tint-60pct);
- --lumo-contrast-70pct: var(--lumo-tint-70pct);
- --lumo-contrast-80pct: var(--lumo-tint-80pct);
- --lumo-contrast-90pct: var(--lumo-tint-90pct);
- --lumo-contrast: var(--lumo-tint);
-
- /* Text */
- --lumo-header-text-color: var(--lumo-contrast);
- --lumo-body-text-color: var(--lumo-contrast-90pct);
- --lumo-secondary-text-color: var(--lumo-contrast-70pct);
- --lumo-tertiary-text-color: var(--lumo-contrast-50pct);
- --lumo-disabled-text-color: var(--lumo-contrast-30pct);
-
- /* Primary */
- --lumo-primary-color: hsl(214, 90%, 48%);
- --lumo-primary-color-50pct: hsla(214, 90%, 70%, 0.69);
- --lumo-primary-color-10pct: hsla(214, 90%, 55%, 0.13);
- --lumo-primary-text-color: hsl(214, 90%, 77%);
- --lumo-primary-contrast-color: #fff;
-
- /* Error */
- --lumo-error-color: hsl(3, 79%, 49%);
- --lumo-error-color-50pct: hsla(3, 75%, 62%, 0.5);
- --lumo-error-color-10pct: hsla(3, 75%, 62%, 0.14);
- --lumo-error-text-color: hsl(3, 100%, 80%);
-
- /* Success */
- --lumo-success-color: hsl(145, 72%, 30%);
- --lumo-success-color-50pct: hsla(145, 92%, 51%, 0.5);
- --lumo-success-color-10pct: hsla(145, 92%, 51%, 0.1);
- --lumo-success-text-color: hsl(145, 85%, 46%);
- }
-
- html {
- color: var(--lumo-body-text-color);
- background-color: var(--lumo-base-color);
- color-scheme: light;
- }
-
- [theme~='dark'] {
- color: var(--lumo-body-text-color);
- background-color: var(--lumo-base-color);
- color-scheme: dark;
- }
-
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
- color: var(--lumo-header-text-color);
- }
-
- a:where(:any-link) {
- color: var(--lumo-primary-text-color);
- }
-
- a:not(:any-link) {
- color: var(--lumo-disabled-text-color);
- }
-
- blockquote {
- color: var(--lumo-secondary-text-color);
- }
-
- code,
- pre {
- background-color: var(--lumo-contrast-10pct);
- border-radius: var(--lumo-border-radius-m);
- }
-`,{moduleId:"lumo-color"});const $l=document.createElement("template");$l.innerHTML='\n \n',document.head.appendChild($l.content);const ql=s`
- :host {
- --lumo-size-xs: 1.625rem;
- --lumo-size-s: 1.875rem;
- --lumo-size-m: 2.25rem;
- --lumo-size-l: 2.75rem;
- --lumo-size-xl: 3.5rem;
-
- /* Icons */
- --lumo-icon-size-s: 1.25em;
- --lumo-icon-size-m: 1.5em;
- --lumo-icon-size-l: 2.25em;
- /* For backwards compatibility */
- --lumo-icon-size: var(--lumo-icon-size-m);
- }
-`,eh=document.createElement("template");eh.innerHTML=``,document.head.appendChild(eh.content);const th=s`
- :host {
- /* Square */
- --lumo-space-xs: 0.25rem;
- --lumo-space-s: 0.5rem;
- --lumo-space-m: 1rem;
- --lumo-space-l: 1.5rem;
- --lumo-space-xl: 2.5rem;
-
- /* Wide */
- --lumo-space-wide-xs: calc(var(--lumo-space-xs) / 2) var(--lumo-space-xs);
- --lumo-space-wide-s: calc(var(--lumo-space-s) / 2) var(--lumo-space-s);
- --lumo-space-wide-m: calc(var(--lumo-space-m) / 2) var(--lumo-space-m);
- --lumo-space-wide-l: calc(var(--lumo-space-l) / 2) var(--lumo-space-l);
- --lumo-space-wide-xl: calc(var(--lumo-space-xl) / 2) var(--lumo-space-xl);
-
- /* Tall */
- --lumo-space-tall-xs: var(--lumo-space-xs) calc(var(--lumo-space-xs) / 2);
- --lumo-space-tall-s: var(--lumo-space-s) calc(var(--lumo-space-s) / 2);
- --lumo-space-tall-m: var(--lumo-space-m) calc(var(--lumo-space-m) / 2);
- --lumo-space-tall-l: var(--lumo-space-l) calc(var(--lumo-space-l) / 2);
- --lumo-space-tall-xl: var(--lumo-space-xl) calc(var(--lumo-space-xl) / 2);
- }
-`,ih=document.createElement("template");ih.innerHTML=``,document.head.appendChild(ih.content);const oh=s`
- :host {
- /* Border radius */
- --lumo-border-radius-s: 0.25em; /* Checkbox, badge, date-picker year indicator, etc */
- --lumo-border-radius-m: var(--lumo-border-radius, 0.25em); /* Button, text field, menu overlay, etc */
- --lumo-border-radius-l: 0.5em; /* Dialog, notification, etc */
-
- /* Shadow */
- --lumo-box-shadow-xs: 0 1px 4px -1px var(--lumo-shade-50pct);
- --lumo-box-shadow-s: 0 2px 4px -1px var(--lumo-shade-20pct), 0 3px 12px -1px var(--lumo-shade-30pct);
- --lumo-box-shadow-m: 0 2px 6px -1px var(--lumo-shade-20pct), 0 8px 24px -4px var(--lumo-shade-40pct);
- --lumo-box-shadow-l: 0 3px 18px -2px var(--lumo-shade-20pct), 0 12px 48px -6px var(--lumo-shade-40pct);
- --lumo-box-shadow-xl: 0 4px 24px -3px var(--lumo-shade-20pct), 0 18px 64px -8px var(--lumo-shade-40pct);
-
- /* Clickable element cursor */
- --lumo-clickable-cursor: default;
- }
-`;s`
- html {
- --vaadin-checkbox-size: calc(var(--lumo-size-m) / 2);
- --vaadin-radio-button-size: calc(var(--lumo-size-m) / 2);
- --vaadin-input-field-border-radius: var(--lumo-border-radius-m);
- }
-`;const nh=document.createElement("template");nh.innerHTML=``,document.head.appendChild(nh.content);const sh=s`
- :host {
- /* prettier-ignore */
- --lumo-font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
-
- /* Font sizes */
- --lumo-font-size-xxs: 0.75rem;
- --lumo-font-size-xs: 0.8125rem;
- --lumo-font-size-s: 0.875rem;
- --lumo-font-size-m: 1rem;
- --lumo-font-size-l: 1.125rem;
- --lumo-font-size-xl: 1.375rem;
- --lumo-font-size-xxl: 1.75rem;
- --lumo-font-size-xxxl: 2.5rem;
-
- /* Line heights */
- --lumo-line-height-xs: 1.25;
- --lumo-line-height-s: 1.375;
- --lumo-line-height-m: 1.625;
- }
-`;Hl("",s`
- body,
- :host {
- font-family: var(--lumo-font-family);
- font-size: var(--lumo-font-size-m);
- line-height: var(--lumo-line-height-m);
- -webkit-text-size-adjust: 100%;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
-
- small,
- [theme~='font-size-s'] {
- font-size: var(--lumo-font-size-s);
- line-height: var(--lumo-line-height-s);
- }
-
- [theme~='font-size-xs'] {
- font-size: var(--lumo-font-size-xs);
- line-height: var(--lumo-line-height-xs);
- }
-
- :where(h1, h2, h3, h4, h5, h6) {
- font-weight: 600;
- line-height: var(--lumo-line-height-xs);
- margin-block: 0;
- }
-
- :where(h1) {
- font-size: var(--lumo-font-size-xxxl);
- }
-
- :where(h2) {
- font-size: var(--lumo-font-size-xxl);
- }
-
- :where(h3) {
- font-size: var(--lumo-font-size-xl);
- }
-
- :where(h4) {
- font-size: var(--lumo-font-size-l);
- }
-
- :where(h5) {
- font-size: var(--lumo-font-size-m);
- }
-
- :where(h6) {
- font-size: var(--lumo-font-size-xs);
- text-transform: uppercase;
- letter-spacing: 0.03em;
- }
-
- p,
- blockquote {
- margin-top: 0.5em;
- margin-bottom: 0.75em;
- }
-
- a {
- text-decoration: none;
- }
-
- a:where(:any-link):hover {
- text-decoration: underline;
- }
-
- hr {
- display: block;
- align-self: stretch;
- height: 1px;
- border: 0;
- padding: 0;
- margin: var(--lumo-space-s) calc(var(--lumo-border-radius-m) / 2);
- background-color: var(--lumo-contrast-10pct);
- }
-
- blockquote {
- border-left: 2px solid var(--lumo-contrast-30pct);
- }
-
- b,
- strong {
- font-weight: 600;
- }
-
- /* RTL specific styles */
- blockquote[dir='rtl'] {
- border-left: none;
- border-right: 2px solid var(--lumo-contrast-30pct);
- }
-`,{moduleId:"lumo-typography"});const rh=document.createElement("template");rh.innerHTML=``,document.head.appendChild(rh.content),Hl("vaadin-checkbox",s`
- :host {
- color: var(--lumo-body-text-color);
- font-size: var(--lumo-font-size-m);
- font-family: var(--lumo-font-family);
- line-height: var(--lumo-line-height-s);
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- -webkit-tap-highlight-color: transparent;
- -webkit-user-select: none;
- -moz-user-select: none;
- user-select: none;
- cursor: default;
- outline: none;
- --_checkbox-size: var(--vaadin-checkbox-size, calc(var(--lumo-size-m) / 2));
- }
-
- :host([has-label]) ::slotted(label) {
- padding-block: var(--lumo-space-xs);
- padding-inline: var(--lumo-space-xs) var(--lumo-space-s);
- }
-
- [part='checkbox'] {
- width: var(--_checkbox-size);
- height: var(--_checkbox-size);
- margin: var(--lumo-space-xs);
- position: relative;
- border-radius: var(--lumo-border-radius-s);
- background-color: var(--lumo-contrast-20pct);
- transition: transform 0.2s cubic-bezier(0.12, 0.32, 0.54, 2), background-color 0.15s;
- cursor: var(--lumo-clickable-cursor);
- }
-
- :host([indeterminate]) [part='checkbox'],
- :host([checked]) [part='checkbox'] {
- background-color: var(--lumo-primary-color);
- }
-
- /* Checkmark */
- [part='checkbox']::after {
- pointer-events: none;
- font-family: 'lumo-icons';
- content: var(--lumo-icons-checkmark);
- color: var(--lumo-primary-contrast-color);
- font-size: calc(var(--_checkbox-size) + 2px);
- line-height: 1;
- position: absolute;
- top: -1px;
- left: -1px;
- contain: content;
- opacity: 0;
- }
-
- :host([checked]) [part='checkbox']::after {
- opacity: 1;
- }
-
- /* Indeterminate checkmark */
- :host([indeterminate]) [part='checkbox']::after {
- content: '';
- opacity: 1;
- top: 45%;
- height: 10%;
- left: 22%;
- right: 22%;
- width: auto;
- border: 0;
- background-color: var(--lumo-primary-contrast-color);
- }
-
- /* Focus ring */
- :host([focus-ring]) [part='checkbox'] {
- box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
- }
-
- /* Disabled */
- :host([disabled]) {
- pointer-events: none;
- color: var(--lumo-disabled-text-color);
- }
-
- :host([disabled]) ::slotted(label) {
- color: inherit;
- }
-
- :host([disabled]) [part='checkbox'] {
- background-color: var(--lumo-contrast-10pct);
- }
-
- :host([disabled]) [part='checkbox']::after {
- color: var(--lumo-contrast-30pct);
- }
-
- :host([indeterminate][disabled]) [part='checkbox']::after {
- background-color: var(--lumo-contrast-30pct);
- }
-
- /* RTL specific styles */
- :host([dir='rtl'][has-label]) ::slotted(label) {
- padding: var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-xs) var(--lumo-space-s);
- }
-
- /* Used for activation "halo" */
- [part='checkbox']::before {
- pointer-events: none;
- color: transparent;
- width: 100%;
- height: 100%;
- line-height: var(--_checkbox-size);
- border-radius: inherit;
- background-color: inherit;
- transform: scale(1.4);
- opacity: 0;
- transition: transform 0.1s, opacity 0.8s;
- }
-
- /* Hover */
- :host(:not([checked]):not([indeterminate]):not([disabled]):hover) [part='checkbox'] {
- background-color: var(--lumo-contrast-30pct);
- }
-
- /* Disable hover for touch devices */
- @media (pointer: coarse) {
- :host(:not([checked]):not([indeterminate]):not([disabled]):hover) [part='checkbox'] {
- background-color: var(--lumo-contrast-20pct);
- }
- }
-
- /* Active */
- :host([active]) [part='checkbox'] {
- transform: scale(0.9);
- transition-duration: 0.05s;
- }
-
- :host([active][checked]) [part='checkbox'] {
- transform: scale(1.1);
- }
-
- :host([active]:not([checked])) [part='checkbox']::before {
- transition-duration: 0.01s, 0.01s;
- transform: scale(0);
- opacity: 0.4;
- }
- `,{moduleId:"lumo-checkbox"});const ah=/\/\*[\*!]\s+vaadin-dev-mode:start([\s\S]*)vaadin-dev-mode:end\s+\*\*\//i,lh=window.Vaadin&&window.Vaadin.Flow&&window.Vaadin.Flow.clients;function hh(e,t){if("function"!=typeof e)return;const i=ah.exec(e.toString());if(i)try{e=new Function(i[1])}catch(e){console.log("vaadin-development-mode-detector: uncommentAndRun() failed",e)}return e(t)}window.Vaadin=window.Vaadin||{};const mh=function(e,t){if(window.Vaadin.developmentMode)return hh(e,t)};function ch(){}void 0===window.Vaadin.developmentMode&&(window.Vaadin.developmentMode=function(){try{return!!localStorage.getItem("vaadin.developmentmode.force")||["localhost","127.0.0.1"].indexOf(window.location.hostname)>=0&&(lh?!(lh&&Object.keys(lh).map((e=>lh[e])).filter((e=>e.productionMode)).length>0):!hh((function(){return!0})))}catch(e){return!1}}());let dh=0,ph=0;const jh=[];let Ph=0,wh=!1;const uh=document.createTextNode("");new window.MutationObserver((function(){wh=!1;const e=jh.length;for(let t=0;t
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {this._sendMessage()}}>
- ${Tt("welcomepage.wcchange6")}
-
- ${Tt("general.close")}
-
-
-
- `}firstUpdated(){this.changeTheme();const e=e=>(e.stopPropagation(),!1);this.shadowRoot.getElementById("sendTo").addEventListener("keydown",e),this.shadowRoot.getElementById("messageBox").addEventListener("keydown",e),window.addEventListener("storage",(()=>{const e=localStorage.getItem("qortalLanguage"),t=localStorage.getItem("qortalTheme");lt(e),this.theme="dark"===t?"dark":"light",document.querySelector("html").setAttribute("theme",this.theme)})),$c.ready().then((()=>{$c.subscribe("selected_address",(async e=>{this.selectedAddress={},(e=JSON.parse(e))&&0!==Object.entries(e).length&&(this.selectedAddress=e)})),$c.request("apiCall",{url:`/addresses/balance/${window.parent.reduxStore.getState().app.selectedAddress.address}`}).then((e=>{this.balance=e}))})),$c.imReady()}changeTheme(){const e=localStorage.getItem("qortalTheme");this.theme="dark"===e?"dark":"light",document.querySelector("html").setAttribute("theme",this.theme)}changeLanguage(){const e=localStorage.getItem("qortalLanguage");null===e||0===e.length?(localStorage.setItem("qortalLanguage","us"),lt("us")):lt(e)}_sendMessage(){this.isLoading=!0;const e=this.shadowRoot.getElementById("sendTo").value,t=this.shadowRoot.getElementById("messageBox").value;0===e.length||0===t.length?this.isLoading=!1:this.sendMessage()}async sendMessage(){this.isLoading=!0;const e=this.shadowRoot.getElementById("sendTo").value,t=this.shadowRoot.getElementById("messageBox"),i=t.value;let o;const n=await(async e=>{let t,i=await $c.request("apiCall",{type:"api",url:`/names/${e}`});return t=401!==i.error&&i,t})(e);o=n?n.owner:e;let s=new Uint8Array(64);window.crypto.getRandomValues(s);let r=Date.now(),a=window.parent.Base58.encode(s);const l=async(e,t)=>{const n={messageText:i,images:[""],repliedTo:"",version:3},s=JSON.stringify(n);let l=await $c.request("chat",{type:18,nonce:this.selectedAddress.nonce,params:{timestamp:r,recipient:o,recipientPublicKey:t,hasChatReference:0,message:s,lastReference:a,proofOfWorkNonce:0,isEncrypted:e,isText:1}});h(l)},h=async e=>{const t=Object.keys(e).map((function(t){return e[t]})),i=new Uint8Array(t),o=(new window.parent.Sha256).process(i).finish().result,n=window.parent.sbrk(32,window.parent.heap);new Uint8Array(window.parent.memory.buffer,n,32).set(o);const s=this.balance<4?18:8,r=8388608,a=window.parent.sbrk(r,window.parent.heap);let l=window.parent.computePow(n,a,r,s),h=await $c.request("sign_chat",{nonce:this.selectedAddress.nonce,chatBytesArray:i,chatNonce:l});m(h)},m=e=>{if(!0===e){t.value="";let e=ht("welcomepage.wcchange8");$c.request("showSnackBar",`${e}`),this.isLoading=!1}else if(e.error)$c.request("showSnackBar",e.message),this.isLoading=!1;else{let e=ht("welcomepage.wcchange9");$c.request("showSnackBar",`${e}`),this.isLoading=!1}};(async()=>{let e,t,i=await $c.request("apiCall",{type:"api",url:`/addresses/publickey/${o}`});if(102===i.error){t=!1;let e=ht("welcomepage.wcchange7");$c.request("showSnackBar",`${e}`),this.isLoading=!1}else!1!==i?(e=1,t=i,l(e,t)):(e=0,t=this.selectedAddress.address,l(e,t))})()}_textMenu(e){const t=()=>{var e="";return void 0!==window.getSelection?e=window.getSelection().toString():void 0!==this.shadowRoot.selection&&"Text"==this.shadowRoot.selection.type&&(e=this.shadowRoot.selection.createRange().text),e};(()=>{let i=t();if(i&&"string"==typeof i){let t={selectedText:i,eventObject:{pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY},isFrame:!0};$c.request("openCopyTextMenu",t)}})()}_textArea(e){13!==e.keyCode||e.shiftKey||this._sendMessage()}isEmptyArray(e){return!e||0===e.length}getApiKey(){return window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node].apiKey}});var qc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ed(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function td(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var id={exports:{}};!function(e,t){e.exports=function e(t,i,o){function n(r,a){if(!i[r]){if(!t[r]){if(!a&&td)return td(r);if(s)return s(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var h=i[r]={exports:{}};t[r][0].call(h.exports,(function(e){var i=t[r][1][e];return n(i||e)}),h,h.exports,e,t,i,o)}return i[r].exports}for(var s=td,r=0;r
- ${Tt("welcomepage.wcchange1")}
-
-
- -
-
-
-
-
- chat
- ${this.myAddress.address} -
- - ${this.myAddress.address} -
this.setOpenPrivateMessage({name:"",open:!0})}">
- ${Tt("welcomepage.wcchange2")}
-
-
-
-
-
- ${Tt("welcomepage.wcchange2")}
--
${Tt("welcomepage.wcchange3")}
- - -- -
- -${this.chatInfo.name.charAt(0)}
`:""}
- ${!this.isImageLoaded&&this.chatInfo.groupName?C`${this.chatInfo.groupName.charAt(0)}
`:""}
-
-
-
-
- `}async firstUpdated(){this.lastReadMessageTimestamp=await sd.getItem(this.chatInfo.url)||0,nd.ready().then((()=>{nd.subscribe("selected_address",(async e=>{this.selectedAddress={},(e=JSON.parse(e))&&0!==Object.entries(e).length&&(this.selectedAddress=e)})),nd.subscribe("chat_last_seen",(async e=>{const t=JSON.parse(e).find((e=>e.key===this.chatInfo.url));t&&this.lastReadMessageTimestamp!==t.timestamp&&(this.lastReadMessageTimestamp=t.timestamp,this.requestUpdate())})),nd.subscribe("config",(e=>{this.config=JSON.parse(e)}))})),nd.imReady()}shouldUpdate(e){if(e.has("activeChatHeadUrl"))return!0;if(e.has("lastReadMessageTimestamp"))return!0;if(e.has("chatInfo")){return e.get("chatInfo").address!==this.chatInfo.address&&(this.isImageLoaded=!1,this.requestUpdate()),!0}return!1}getUrl(e){this.setActiveChatHeadUrl(e)}onPageNavigation(e){nd.request("setPageUrl",e)}});const rd=new WeakMap;let ad=0;const ld=new Map,hd=new WeakSet,md=()=>new Promise((e=>requestAnimationFrame(e))),cd=(e,t)=>{const i=e-t;return 0===i?void 0:i},dd=(e,t)=>{const i=e/t;return 1===i?void 0:i},pd={left:(e,t)=>{const i=cd(e,t);return{value:i,transform:i&&`translateX(${i}px)`}},top:(e,t)=>{const i=cd(e,t);return{value:i,transform:i&&`translateY(${i}px)`}},width:(e,t)=>{const i=dd(e,t);return{value:i,transform:i&&`scaleX(${i})`}},height:(e,t)=>{const i=dd(e,t);return{value:i,transform:i&&`scaleY(${i})`}}},jd={duration:333,easing:"ease-in-out"},Pd=["left","top","width","height","opacity","color","background"],wd=new WeakMap;const ud=dt(class extends Yt{constructor(e){if(super(e),this.t=null,this.i=null,this.o=!0,this.shouldLog=!1,e.type===ct)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){var e;null===(e=this.resolveFinished)||void 0===e||e.call(this),this.finished=new Promise((e=>{this.h=e}))}async resolveFinished(){var e;null===(e=this.h)||void 0===e||e.call(this),this.h=void 0}render(e){return W}getController(){return rd.get(this.l)}isDisabled(){var e;return this.options.disabled||(null===(e=this.getController())||void 0===e?void 0:e.disabled)}update(e,[t]){var i;const o=void 0===this.l;return o&&(this.l=null===(i=e.options)||void 0===i?void 0:i.host,this.l.addController(this),this.element=e.element,wd.set(this.element,this)),this.optionsOrCallback=t,(o||"function"!=typeof t)&&this.u(t),this.render(t)}u(e){var t,i;e=null!=e?e:{};const o=this.getController();void 0!==o&&((e={...o.defaultOptions,...e}).keyframeOptions={...o.defaultOptions.keyframeOptions,...e.keyframeOptions}),null!==(t=(i=e).properties)&&void 0!==t||(i.properties=Pd),this.options=e}v(){const e={},t=this.element.getBoundingClientRect(),i=getComputedStyle(this.element);return this.options.properties.forEach((o=>{var n;const s=null!==(n=t[o])&&void 0!==n?n:pd[o]?void 0:i[o],r=Number(s);e[o]=isNaN(r)?s+"":r})),e}p(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((e,t)=>{if(Array.isArray(e)){if(Array.isArray(t)&&t.length===e.length&&e.every(((e,i)=>e===t[i])))return!1}else if(t===e)return!1;return!0})(e,this.m)),this.o=this.l.hasUpdated&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.o&&(this.m=Array.isArray(e)?Array.from(e):e),this.o}hostUpdate(){var e;"function"==typeof this.optionsOrCallback&&this.u(this.optionsOrCallback()),this.p()&&(this.g=this.v(),this.t=null!==(e=this.t)&&void 0!==e?e:this.element.parentNode,this.i=this.element.nextSibling)}async hostUpdated(){if(!this.o||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let e;this.prepare(),await md;const t=this._(),i=this.A(this.options.keyframeOptions,t),o=this.v();if(void 0!==this.g){const{from:i,to:n}=this.O(this.g,o,t);this.log("measured",[this.g,o,i,n]),e=this.calculateKeyframes(i,n)}else{const i=ld.get(this.options.inId);if(i){ld.delete(this.options.inId);const{from:n,to:s}=this.O(i,o,t);e=this.calculateKeyframes(n,s),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,ad++,e.forEach((e=>e.zIndex=ad))}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,i)}resetStyles(){var e;void 0!==this.P&&(this.element.setAttribute("style",null!==(e=this.P)&&void 0!==e?e:""),this.P=void 0)}commitStyles(){var e,t;this.P=this.element.getAttribute("style"),null===(e=this.webAnimation)||void 0===e||e.commitStyles(),null===(t=this.webAnimation)||void 0===t||t.cancel()}reconnected(){}async disconnected(){var e;if(!this.o)return;if(void 0!==this.options.id&&ld.set(this.options.id,this.g),void 0===this.options.out)return;if(this.prepare(),await md(),null===(e=this.t)||void 0===e?void 0:e.isConnected){const e=this.i&&this.i.parentNode===this.t?this.i:null;if(this.t.insertBefore(this.element,e),this.options.stabilizeOut){const e=this.v();this.log("stabilizing out");const t=this.g.left-e.left,i=this.g.top-e.top;!("static"===getComputedStyle(this.element).position)||0===t&&0===i||(this.element.style.position="relative"),0!==t&&(this.element.style.left=t+"px"),0!==i&&(this.element.style.top=i+"px")}}const t=this.A(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){var e,t;null===(t=(e=this.options).onStart)||void 0===t||t.call(e,this)}didFinish(e){var t,i;e&&(null===(i=(t=this.options).onComplete)||void 0===i||i.call(t,this)),this.g=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}_(){const e=[];for(let t=this.element.parentNode;t;t=null==t?void 0:t.parentNode){const i=wd.get(t);i&&!i.isDisabled()&&i&&e.push(i)}return e}get isHostRendered(){const e=hd.has(this.l);return e||this.l.updateComplete.then((()=>{hd.add(this.l)})),e}A(e,t=this._()){const i={...jd};return t.forEach((e=>Object.assign(i,e.options.keyframeOptions))),Object.assign(i,e),i}O(e,t,i){e={...e},t={...t};const o=i.map((e=>e.animatingProperties)).filter((e=>void 0!==e));let n=1,s=1;return void 0!==o&&(o.forEach((e=>{e.width&&(n/=e.width),e.height&&(s/=e.height)})),void 0!==e.left&&void 0!==t.left&&(e.left=n*e.left,t.left=n*t.left),void 0!==e.top&&void 0!==t.top&&(e.top=s*e.top,t.top=s*t.top)),{from:e,to:t}}calculateKeyframes(e,t,i=!1){var o;const n={},s={};let r=!1;const a={};for(const i in t){const l=e[i],h=t[i];if(i in pd){const e=pd[i];if(void 0===l||void 0===h)continue;const t=e(l,h);void 0!==t.transform&&(a[i]=t.value,r=!0,n.transform=`${null!==(o=n.transform)&&void 0!==o?o:""} ${t.transform}`)}else l!==h&&void 0!==l&&void 0!==h&&(r=!0,n[i]=l,s[i]=h)}return n.transformOrigin=s.transformOrigin=i?"center center":"top left",this.animatingProperties=a,r?[n,s]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let i=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),void 0!==e)){this.log("animate",[e,t]),i=!0,this.webAnimation=this.element.animate(e,t);const o=this.getController();null==o||o.add(this);try{await this.webAnimation.finished}catch(e){}null==o||o.remove(this)}return this.didFinish(i),i}isAnimating(){var e,t;return"running"===(null===(e=this.webAnimation)||void 0===e?void 0:e.playState)||(null===(t=this.webAnimation)||void 0===t?void 0:t.pending)}log(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}});function fd(e){this.content=e}function Md(e,t,i){for(let o=0;;o++){if(o==e.childCount||o==t.childCount)return e.childCount==t.childCount?null:i;let n=e.child(o),s=t.child(o);if(n!=s){if(!n.sameMarkup(s))return i;if(n.isText&&n.text!=s.text){for(let e=0;n.text[e]==s.text[e];e++)i++;return i}if(n.content.size||s.content.size){let e=Md(n.content,s.content,i+1);if(null!=e)return e}i+=n.nodeSize}else i+=n.nodeSize}}function Zd(e,t,i,o){for(let n=e.childCount,s=t.childCount;;){if(0==n||0==s)return n==s?null:{a:i,b:o};let r=e.child(--n),a=t.child(--s),l=r.nodeSize;if(r!=a){if(!r.sameMarkup(a))return{a:i,b:o};if(r.isText&&r.text!=a.text){let e=0,t=Math.min(r.text.length,a.text.length);for(;e
-
- ${this.chatInfo.groupName?this.chatInfo.groupName:void 0!==this.chatInfo.name?this.chatInfo.name:this.chatInfo.address.substr(0,15)} ${void 0!==this.chatInfo.groupId?"lock_open":"lock"}
-
-
-
-
-
-
-
- ${Tt("chatpage.cchange90")}
-
-