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CAAC,cAAc,CAAC,iBAAiB,CAAyB,CAAC,gBAAgB,CAAC,OAAO,EAAE,UAAqC,KAAY;IAC9I,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE;QAC1C,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;KAC7C;AACF,CAAC,CAAC,CAAC","file":"mail.js","sourcesContent":["\"use strict\"\r\ndeclare function gtag(tag: string, action: string, parameters: object);\r\nconst contact = document.forms.namedItem(\"contact\");\r\ncontact.addEventListener(\"submit\", function (this: HTMLFormElement, event: Event) {\r\n\tevent.preventDefault();\r\n\tconst controls = Array.from(this.elements) as Array;\r\n\tconst subject = (document.getElementById(\"contact-subject\") as HTMLInputElement).value;\r\n\tconst status = document.getElementById(\"contact-status\") || document.createElement(\"span\");\r\n\tif (!document.contains(status)) {\r\n\t\tstatus.id = \"contact-status\";\r\n\t\tdocument.getElementById(\"contact-send\").parentNode.appendChild(status);\r\n\t}\r\n\tstatus.innerHTML = \"Sending… This may take a few seconds.\";\r\n\tconst xhr = new XMLHttpRequest();\r\n\txhr.open(this.method, this.action);\r\n\tconst handleResponse = function (this: HTMLFormElement, event: Event) {\r\n\t\tif (xhr.status >= 200 && xhr.status <= 399) {\r\n\t\t\tgtag(\"event\", \"Send\", {\r\n\t\t\t\t\"event_category\": \"Email\",\r\n\t\t\t\t\"event_label\": subject\r\n\t\t\t});\r\n\t\t\tstatus.classList.remove(\"-error\");\r\n\t\t\tstatus.classList.add(\"-success\");\r\n\t\t\tstatus.innerHTML = \"Thanks! I’ll get back to you shortly.\";\r\n\t\t} else {\r\n\t\t\tgtag(\"event\", \"Error\", {\r\n\t\t\t\t\"event_category\": \"Email\",\r\n\t\t\t\t\"event_label\": xhr.status.toString()\r\n\t\t\t});\r\n\t\t\tconsole.error(xhr.responseText);\r\n\t\t\tstatus.classList.add(\"-error\");\r\n\t\t\tstatus.innerHTML = \"Sorry! Something went wrong. Please try again.\";\r\n\t\t\tcontrols.forEach(control => control.disabled = false);\r\n\t\t}\r\n\t};\r\n\txhr.addEventListener(\"load\", handleResponse);\r\n\txhr.addEventListener(\"error\", handleResponse);\r\n\txhr.send(new FormData(this));\r\n\tcontrols.forEach(control => control.disabled = true);\r\n});\r\nconst submit = document.getElementById(\"contact-send\") as HTMLInputElement;\r\nsubmit.disabled = !contact.checkValidity()\r\nArray.from(contact.elements).forEach((control: HTMLElement) => control.addEventListener(\"input\", function (this: HTMLElement, event: Event) {\r\n\tsubmit.disabled = !contact.checkValidity();\r\n}));\r\n(document.getElementById(\"contact-message\") as HTMLTextAreaElement).addEventListener(\"input\", function (this: HTMLTextAreaElement, event: Event) {\r\n\tif (this.scrollHeight > this.clientHeight) {\r\n\t\tthis.style.height = this.scrollHeight + \"px\";\r\n\t}\r\n});\r\n"]}