@theymes/sdk 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/isMobile.d.ts +1 -0
- package/dist/sdk.cjs.js +1 -1
- package/dist/sdk.esm.js +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.unity.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMobile(opts?: any): boolean;
|
package/dist/sdk.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((o=o.apply(e,t||[])).next())}))}function n(e,t){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function o(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,t){i[e].add(t)}function s(e,t){i[e].delete(t)}function a(e,t){i[e].forEach((function(e){return e.apply(void 0,t)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',p=function(e,t){return e===t||Boolean(e&&t&&"object"==typeof e&&"object"==typeof t&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every((function(e){var n=e[0],o=e[1];return p(o,t[n])})))},g="colors",f="1.2.0",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=340,v=680,b=120,w=48,k=.2,S=.2,T=.2,x="theymes_path_on_init",E={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(g);if(t){var n=JSON.parse(t);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),n)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},C=function(e){var t="/help-center";N({path:t,config:e}),D({path:t,config:e})},_=function(e){var t="/assistant";N({path:t,config:e}),D({path:t,config:e})},O=function(){!function(){var e=document.querySelector(h.sdkDialog),t=document.querySelector(h.sdkIframeWrapper);if(e){var n=function(){"widget"!==E.mode||E.forceUpdateSdkDialog?e.remove():e.style.display="none",E.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=K({animation:"start"}),setTimeout((function(){n()}),1e3*k)):n()}E.widgetButton&&W();a("close",[])}(),U()},A=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function L(t){var n,i,r,s,a,l,c=(null!=t?t:{}).config;if(!E.token||!E.domain||!E.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(s=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:E.language)&&void 0!==s?s:null,g=null!==(a=E.signedMetadataToken)&&void 0!==a?a:null,h=null!==(l=E.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:f};E.youngPlayer&&(y._youngPlayer=!0),(E.privacyMode||E.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(E.tags),!0),d,!0),b=e(e(e({},E.fields),u),y);return{token:E.token,domain:E.domain,deviceId:E.deviceId,tags:v,fields:b,language:p,signedMetadataToken:g,player:h}}function I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function R(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(E.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(E.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(E.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(E.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",I(E.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",I(E.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",I(E.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",I(E.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",I(E.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",I(E.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",I(E.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===E.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=E.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=E.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",E.nonce?'nonce="'.concat(E.nonce,'"'):"")}function P(e){var t,n=e.iframe,o=e.content,i=null===(t=n.contentWindow)||void 0===t?void 0:t.document;i&&(i.open(),i.write(o),i.close())}function D(e){var t,n,o,i=L({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(t=document.querySelector(h.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var s=null!==(n=r.querySelector(h.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");s.id=h.sdkIframeWrapper.replace("#",""),s.style.position="relative",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.opacity="0",s.style.colorScheme="auto",s.style.border="none",s.style.backgroundColor="rgb(".concat(I(E.colors.background),")"),s.style.transform=K({animation:"start"}),s.style.transition=(E.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===E.mode&&(s.style.overflow="hidden");var d=null!==(o=s.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=s.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!E.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(E.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",E.mode),i.set("origin",window.location.origin),n.language&&i.set("language",n.language);var r=B({supportViewConfig:n});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(t,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(s),s.appendChild(d),s.appendChild(p),document.body.appendChild(r)),P({iframe:d,content:R({template:l})});var f=!1,y=function(){f||(f=!0,E.networkErrorTimerId=setTimeout((function(){P({iframe:d,content:R({template:c})})}),1e4))};p.onload=y,p.onerror=function(){P({iframe:d,content:R({template:c})})},H(),a("open",[]),setTimeout((function(){s.style.opacity="1",s.style.transform=K({animation:"end"})}),100)}}function N(e){var t=e.path,n=e.config,o=null!=n?n:null;E.previousPath===t&&p(E.previousConfig,o)||(E.previousPath=t,E.previousConfig=o,M())}function M(){var e=document.querySelector(h.sdkDialog);E.sdkIsOpen?E.forceUpdateSdkDialog=!0:null==e||e.remove()}function B(e){var t=e.supportViewConfig,n={unsigned:{},signed:void 0};return t.player&&(n.unsigned.player=t.player),t.tags&&(n.unsigned.tags=t.tags),t.fields&&(n.unsigned.fields=t.fields),t.signedMetadataToken&&(n.signed=t.signedMetadataToken),n}function H(){var e=document.querySelector(h.sdkDialog),t=document.querySelector(h.sdkIframeWrapper);if(e&&t){if("widget"===E.mode){var n=Y({type:"widget"}),o=J();e.style.width=o.width,e.style.height=o.height,e.style.bottom=n.bottom,e.style.right=n.right,e.style.left=n.left,e.style.top=n.top,z()?(t.style.border="1px solid rgb(".concat(I(E.colors.border),")"),t.style.borderRadius="10px"):(t.style.border="none",t.style.borderRadius="0")}else if(t.style.border="none",t.style.borderRadius="0",E.element){var i=E.element.getBoundingClientRect(),r=i.width,s=i.height,a=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(s,"px"),e.style.top="".concat(a,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(H)}}function F(e){var t=1e3*e;E.eventsNextPollAt=new Date(Date.now()+t),E.eventsPollerTimerId=setTimeout(U,t)}function U(){return t(this,void 0,void 0,(function(){var t,i,r,s,l,c,d,u;return n(this,(function(n){switch(n.label){case 0:if($(),!E.token||!E.domain||!E.deviceId)return F(60),[2];t=E.notificationsPaused||E.sdkIsOpen?"true":"false",i="https://".concat(E.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:E.token,language:null!==(d=E.language)&&void 0!==d?d:"en",deviceId:E.deviceId,notificationsPaused:t,mode:E.mode},(null===(u=E.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:E.player.id}:{}),E.signedMetadataToken?{signedMetadataToken:E.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(s=n.sent()).ok?[3,4]:[4,X(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),E.notifications=o(o([],E.notifications,!0),l.notifications,!0),l.notifications.length>0&&q(),l.unansweredMessageCount!==E.unansweredMessageCount&&(E.unansweredMessageCount=l.unansweredMessageCount,a("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==E.unreadMessageCount&&(E.unreadMessageCount=l.unreadMessageCount,a("unreadMessageCountUpdate",[l.unreadMessageCount]),ne({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),F(l.nextPollSeconds),[3,7];case 6:return c=n.sent(),console.error("Error initializing SDK:",c),F(60),[3,7];case 7:return[2]}}))}))}function q(){var e,t,n=E.notifications[0];if(n&&!E.visibleNotification){E.visibleNotification=n;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(t=o.querySelector(h.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(T,"s ease-in-out, margin-top ").concat(T,"s ease-in-out"),o.appendChild(r),P({iframe:r,content:(i={text:n.text},R({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),j(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),n.closeAfterSeconds>0&&setTimeout((function(){G({notification:n})}),1e3*n.closeAfterSeconds)}}function j(){var e,t,n,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(n=null===(t=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===n?void 0:n.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===E.mode){var s=Y({type:"widget"}),a=J(),l="calc(".concat(a.width," - 20px)");o.style.width=a.width,o.style.height=a.height,o.style.bottom=s.bottom,o.style.right=s.right,o.style.left=s.left,o.style.top=s.top,i.style.width=l}else if(E.element){var c=E.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(j)}}function G(e){if(e.notification&&E.visibleNotification===e.notification){var t=document.querySelector(h.notificationIframe),n=document.querySelector(h.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),E.notifications=E.notifications.slice(1),E.visibleNotification=null,q()}),1e3*T))}}function W(){var e,t=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=Y({type:"button"});t.id=h.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(b,"px"),t.style.height="".concat(w,"px"),t.style.maxWidth="95%",t.style.maxHeight="95%",t.style.bottom=o.bottom,t.style.right=o.right,t.style.left=o.left,t.style.top=o.top,t.style.margin="0",t.style.padding="0",t.style.zIndex="9997",t.style.backgroundColor="transparent",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transition="opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),P({iframe:t,content:(n={unreadMessageCount:E.unreadMessageCount},R({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",I(E.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",I(E.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",I(E.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",oe()))})}}function z(){var e=E.y;return window.innerWidth>768&&window.innerHeight>v+e}function Y(e){var t=e.type,n=E.position,o=E.x,i=E.y;return z()||"widget"!==t?"top-left"===n?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===n?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===n?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function J(){return z()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function K(e){return"start"===e.animation?"game"===E.mode?"translateY(20%)":"scale(0.8)":"game"===E.mode?"translateY(0)":"scale(1)"}function X(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function V(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,s;return n(this,(function(n){switch(n.label){case 0:if(ee(),E.retryRecordRetentionTimerId&&(clearTimeout(E.retryRecordRetentionTimerId),E.retryRecordRetentionTimerId=null),E.retentionRemainingSeconds=null,E.isRetentionRecordedForSession=!0,!(e=L()))return[2];t="https://".concat(E.domain,"/api/sdk/retention"),o=B({supportViewConfig:e}),i={token:E.token,deviceId:E.deviceId,language:E.language,metadata:o},n.label=1;case 1:return n.trys.push([1,5,,6]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=n.sent()).ok?[3,4]:[4,X(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return s=n.sent(),console.error("Error tracking retention:",s),E.retryRecordRetentionTimerId=setTimeout(V,6e4),[3,6];case 6:return[2]}}))}))}function Z(){var e=new Date;if(E.sessionStatus="active",E.sessionResumeOrStartTime=e,E.sessionStartTime){var t=E.sessionStartTime.valueOf()/1e3+E.resetSessionAfterSecs;Date.now()/1e3>t&&Q()}else Q();if(null!==E.retentionRemainingSeconds&&(E.recordRetentionTimerId=setTimeout(V,1e3*E.retentionRemainingSeconds)),!E.eventsPollerTimerId)if(E.eventsNextPollAt){var n=Math.floor((E.eventsNextPollAt.valueOf()-Date.now())/1e3);n>0?F(n):U()}else U()}function Q(){E.sessionStartTime=new Date,E.retentionRemainingSeconds=E.recordRetentionAfterSecs,E.isRetentionRecordedForSession=!1,ee()}function $(){E.eventsPollerTimerId&&(clearTimeout(E.eventsPollerTimerId),E.eventsPollerTimerId=null)}function ee(){E.recordRetentionTimerId&&(clearTimeout(E.recordRetentionTimerId),E.recordRetentionTimerId=null)}function te(){U(),E.isRetentionRecordedForSession&&V()}function ne(e){var t=document.querySelector(h.sdkButtonIframe);if(t)var n=setInterval((function(){var o,i;"complete"===(null===(o=t.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(n),null===(i=null==t?void 0:t.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function oe(){var e,t,n;return null!==(n=null===(e=E.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=E.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function ie(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===E.sessionStatus?Z():e||"active"!==E.sessionStatus||function(){if(E.sessionResumeOrStartTime&&E.retentionRemainingSeconds){var e=Math.floor((Date.now()-E.sessionResumeOrStartTime.valueOf())/1e3);E.retentionRemainingSeconds-=e}E.sessionStatus="paused",$(),ee()}()}document.addEventListener("visibilitychange",ie),window.addEventListener("focus",ie),window.addEventListener("blur",ie),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(h.sdkLoaderIframe),n=document.querySelector(h.sdkIframe);E.networkErrorTimerId&&(clearTimeout(E.networkErrorTimerId),E.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)O();else if("theymes.closeNotification"===e.data.action)G({notification:E.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:E.visibleNotification},(null==(s=r.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(D({path:s.action.path}),G({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*S)),"support"===E.widgetButtonAction?C():"assistant"===E.widgetButtonAction&&_();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var t=e.key,n=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,s={value:n,expiry:Date.now()+o};r.setItem(t,JSON.stringify(s))}({key:x,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,s}),!1),A("open",(function(){E.sdkIsOpen=!0})),A("close",(function(){E.sdkIsOpen=!1})),exports.addEventListener=A,exports.addField=function(e,t){E.fields[e]=t,M()},exports.addFields=function(t){E.fields=e(e({},E.fields),t),M()},exports.addTag=function(e){E.tags.add(e),M()},exports.addTags=function(e){e.forEach((function(e){return E.tags.add(e)})),M()},exports.close=O,exports.disableLogging=function(){E.loggingEnabled=!1},exports.disableNotifications=function(){E.notificationsPaused=!0},exports.enableLogging=function(){E.loggingEnabled=!0},exports.enableNotifications=function(){E.notificationsPaused=!1,U()},exports.getFields=function(){return E.fields},exports.getLanguage=function(){return E.language},exports.getPlayer=function(){return E.player},exports.getSdkVersion=function(){return f},exports.getSignedMetadataToken=function(){return E.signedMetadataToken},exports.getTags=function(){return Array.from(E.tags)},exports.getUnansweredMessageCount=function(){return E.unansweredMessageCount},exports.getUnreadMessageCount=function(){return E.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,s,a,l,c,d,u,p,f,h,y,v,b,w;return n(this,(function(n){switch(n.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");E.token=o,E.domain=i,E.mode=r.mode,E.element="element"in r&&void 0!==r.element?r.element:E.element,E.language=null!==(u=r.language)&&void 0!==u?u:E.language,E.nonce=null!==(p=r.nonce)&&void 0!==p?p:E.nonce,E.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),E.widgetButton="button"in r&&void 0!==r.button&&null!==(f=r.button)&&void 0!==f?f:E.widgetButton,E.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:E.widgetButtonAction,E.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:E.position,E.x="x"in r&&void 0!==r.x?r.x:E.x,E.y="y"in r&&void 0!==r.y?r.y:E.y,U(),t="https://".concat(i,"/api/sdk/initialize"),s={token:o,deviceId:E.deviceId,platform:m,mode:E.mode},n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})];case 2:return(a=n.sent()).ok?[3,4]:[4,X(a)];case 3:throw n.sent();case 4:return[4,a.json()];case 5:return l=n.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(k=l.branding.colors,E.colors=e(e({},E.colors),k),localStorage.setItem(g,JSON.stringify(E.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(E.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(E.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(E.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(E.resetSessionAfterSecs=l.resetSessionAfterSecs),Z(),M(),c=function(e){var t=e.key,n=e.storage,o=void 0===n?sessionStorage:n,i=e.removeItem,r=void 0!==i&&i,s=o.getItem(t);if(!s)return null;var a=JSON.parse(s);return Date.now()>a.expiry?(sessionStorage.removeItem(t),null):(r&&o.removeItem(t),a.value)}({key:x,removeItem:!0}),c?D({path:c}):E.widgetButton&&W(),[3,7];case 6:return d=n.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},exports.isPrivacyMode=function(){return E.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return E.youngPlayer},exports.openAssistant=_,exports.openResource=function(e,t){var n="/resources/".concat(e);N({path:n,config:t}),D({path:n,config:t})},exports.openSupport=C,exports.recordRetention=function(){E.isRetentionRecordedForSession||V()},exports.removeAllFields=function(){E.fields={},M()},exports.removeAllTags=function(){E.tags.clear(),M()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.apply(void 0,e)},exports.removeField=function(e){delete E.fields[e],M()},exports.removeFields=function(e){e.forEach((function(e){return delete E.fields[e]})),M()},exports.removeTag=function(e){E.tags.delete(e),M()},exports.removeTags=function(e){e.forEach((function(e){return E.tags.delete(e)})),M()},exports.requestNotificationPermission=function(){},exports.reset=function(){E.language=null,E.tags=new Set,E.fields={},E.signedMetadataToken=null,E.player=null,M(),ne({action:"widgetButtonTextUpdate",text:oe()})},exports.setFields=function(e){E.fields=e,M()},exports.setLanguage=function(e){var t=E.language!==e;E.language=e,t&&(M(),ne({action:"widgetButtonTextUpdate",text:oe()}))},exports.setPlayer=function(e){var t,n=(null===(t=E.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);E.player=e,n&&(M(),te())},exports.setPrivacyMode=function(e){E.privacyMode=e,M()},exports.setSignedMetadataToken=function(e){var t=E.signedMetadataToken!==e;E.signedMetadataToken=e,t&&(M(),te())},exports.setTags=function(e){E.tags=new Set(e),M()},exports.setYoungPlayer=function(e){E.youngPlayer=e,M()};
|
|
1
|
+
"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((o=o.apply(e,t||[])).next())}))}function n(e,t){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function o(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,t){i[e].add(t)}function s(e,t){i[e].delete(t)}function a(e,t){i[e].forEach((function(e){return e.apply(void 0,t)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',p=function(e,t){return e===t||Boolean(e&&t&&"object"==typeof e&&"object"==typeof t&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every((function(e){var n=e[0],o=e[1];return p(o,t[n])})))},g=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,f=/CrOS/,m=/android|ipad|playbook|silk/i;var h="colors",y="1.2.2",v="web",b={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},w=340,x=680,k=500,T=120,E=48,S=.2,C=.2,_=.2,O="theymes_path_on_init",A={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(h);if(t){var n=JSON.parse(t);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),n)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},L=function(e){var t="/help-center";F({path:t,config:e}),H({path:t,config:e})},I=function(e){var t="/assistant";F({path:t,config:e}),H({path:t,config:e})},R=function(){!function(){var e=document.querySelector(b.sdkDialog),t=document.querySelector(b.sdkIframeWrapper);if(e){var n=function(){"widget"!==A.mode||A.forceUpdateSdkDialog?e.remove():e.style.display="none",A.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=Q({animation:"start"}),setTimeout((function(){n()}),1e3*S)):n()}A.widgetButton&&K();a("close",[])}(),G()},P=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function D(t){var n,i,r,s,a,l,c=(null!=t?t:{}).config;if(!A.token||!A.domain||!A.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(s=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:A.language)&&void 0!==s?s:null,g=null!==(a=A.signedMetadataToken)&&void 0!==a?a:null,f=null!==(l=A.player)&&void 0!==l?l:null,m={_platform:v,_sdkVersion:y};A.youngPlayer&&(m._youngPlayer=!0),(A.privacyMode||A.youngPlayer)&&(m._privacyMode=!0);var h=o(o([],Array.from(A.tags),!0),d,!0),b=e(e(e({},A.fields),u),m);return{token:A.token,domain:A.domain,deviceId:A.deviceId,tags:h,fields:b,language:p,signedMetadataToken:g,player:f}}function N(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function M(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",v).replace("'INSET_TOP_PLACEHOLDER'","".concat(A.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(A.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(A.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(A.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",N(A.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",N(A.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",N(A.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",N(A.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",N(A.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",N(A.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",N(A.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===A.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=A.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=A.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",A.nonce?'nonce="'.concat(A.nonce,'"'):"")}function B(e){var t,n=e.iframe,o=e.content,i=null===(t=n.contentWindow)||void 0===t?void 0:t.document;i&&(i.open(),i.write(o),i.close())}function H(e){var t,n,o,i=D({config:e.config});if(i){var r=null!==(t=document.querySelector(b.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=b.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var s=null!==(n=r.querySelector(b.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");s.id=b.sdkIframeWrapper.replace("#",""),s.style.position="relative",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.opacity="0",s.style.colorScheme="auto",s.style.border="none",s.style.backgroundColor="rgb(".concat(N(A.colors.background),")"),s.style.transform=Q({animation:"start"}),s.style.transition=(A.mode,"opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out")),"widget"===A.mode&&(s.style.overflow="hidden");var d=null!==(o=s.querySelector(b.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=b.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=s.querySelector(b.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=b.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!A.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(A.domain,"/sdk"),i=new URLSearchParams;i.set("platform",v),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",A.mode),i.set("origin",window.location.origin),n.language&&i.set("language",n.language);var r=W({supportViewConfig:n});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(t,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(s),s.appendChild(d),s.appendChild(p),document.body.appendChild(r)),B({iframe:d,content:M({template:l})});var f=!1,m=function(){f||(f=!0,A.networkErrorTimerId=setTimeout((function(){B({iframe:d,content:M({template:c})})}),1e4))};p.onload=m,p.onerror=function(){B({iframe:d,content:M({template:c})})},j(),a("open",[]),setTimeout((function(){s.style.opacity="1",s.style.transform=Q({animation:"end"})}),100)}}function F(e){var t=e.path,n=e.config,o=null!=n?n:null;A.previousPath===t&&p(A.previousConfig,o)||(A.previousPath=t,A.previousConfig=o,U())}function U(){var e=document.querySelector(b.sdkDialog);A.sdkIsOpen?A.forceUpdateSdkDialog=!0:null==e||e.remove()}function W(e){var t=e.supportViewConfig,n={unsigned:{},signed:void 0};return t.player&&(n.unsigned.player=t.player),t.tags&&(n.unsigned.tags=t.tags),t.fields&&(n.unsigned.fields=t.fields),t.signedMetadataToken&&(n.signed=t.signedMetadataToken),n}function j(){var e=document.querySelector(b.sdkDialog),t=document.querySelector(b.sdkIframeWrapper);if(e&&t)if("widget"===A.mode){var n=V({type:"widget"}),o=Z();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=n.bottom,e.style.right=n.right,e.style.left=n.left,e.style.top=n.top,X()?(t.style.border="none",t.style.borderRadius="0"):(t.style.border="1px solid rgb(".concat(N(A.colors.border),")"),t.style.borderRadius="10px")}else if(t.style.border="none",t.style.borderRadius="0",A.element){var i=A.element.getBoundingClientRect(),r=i.width,s=i.height,a=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(s,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(a,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}function q(e){var t=1e3*e;A.eventsNextPollAt=new Date(Date.now()+t),A.eventsPollerTimerId=setTimeout(G,t)}function G(){return t(this,void 0,void 0,(function(){var t,i,r,s,l,c,d,u;return n(this,(function(n){switch(n.label){case 0:if(oe(),!A.token||!A.domain||!A.deviceId)return q(60),[2];t=A.notificationsPaused||A.sdkIsOpen?"true":"false",i="https://".concat(A.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:A.token,language:null!==(d=A.language)&&void 0!==d?d:"en",deviceId:A.deviceId,notificationsPaused:t,mode:A.mode},(null===(u=A.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:A.player.id}:{}),A.signedMetadataToken?{signedMetadataToken:A.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(s=n.sent()).ok?[3,4]:[4,$(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),A.notifications=o(o([],A.notifications,!0),l.notifications,!0),l.notifications.length>0&&z(),l.unansweredMessageCount!==A.unansweredMessageCount&&(A.unansweredMessageCount=l.unansweredMessageCount,a("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==A.unreadMessageCount&&(A.unreadMessageCount=l.unreadMessageCount,a("unreadMessageCountUpdate",[l.unreadMessageCount]),se({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),q(l.nextPollSeconds),[3,7];case 6:return c=n.sent(),console.error("Error initializing SDK:",c),q(60),[3,7];case 7:return[2]}}))}))}function z(){var e,t,n=A.notifications[0];if(n&&!A.visibleNotification){A.visibleNotification=n;var o=null!==(e=document.querySelector(b.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=b.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(t=o.querySelector(b.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=b.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(_,"s ease-in-out, margin-top ").concat(_,"s ease-in-out"),o.appendChild(r),B({iframe:r,content:(i={text:n.text},M({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),Y(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),n.closeAfterSeconds>0&&setTimeout((function(){J({notification:n})}),1e3*n.closeAfterSeconds)}}function Y(){var e,t,n,o=document.querySelector(b.notificationDialog),i=document.querySelector(b.notificationIframe);if(o&&i){var r=(null===(n=null===(t=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===n?void 0:n.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===A.mode){var s=V({type:"widget"}),a=Z(),l="calc(".concat(a.width," - 20px)");o.style.width=a.width,o.style.height=a.height,o.style.maxWidth=a.maxWidth,o.style.maxHeight=a.maxHeight,o.style.bottom=s.bottom,o.style.right=s.right,o.style.left=s.left,o.style.top=s.top,i.style.width=l}else if(A.element){var c=A.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function J(e){if(e.notification&&A.visibleNotification===e.notification){var t=document.querySelector(b.notificationIframe),n=document.querySelector(b.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),A.notifications=A.notifications.slice(1),A.visibleNotification=null,z()}),1e3*_))}}function K(){var e,t=null!==(e=document.querySelector(b.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=V({type:"button"});t.id=b.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(T,"px"),t.style.height="".concat(E,"px"),t.style.maxWidth="95%",t.style.maxHeight="95%",t.style.bottom=o.bottom,t.style.right=o.right,t.style.left=o.left,t.style.top=o.top,t.style.margin="0",t.style.padding="0",t.style.zIndex="9997",t.style.backgroundColor="transparent",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transition="opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),B({iframe:t,content:(n={unreadMessageCount:A.unreadMessageCount},M({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",N(A.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",N(A.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",N(A.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ae()))})}}function X(){return!!function(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=g.test(t)&&!f.test(t)||!!e.tablet&&m.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}({tablet:!0})&&(window.innerWidth<k||window.innerHeight<k)}function V(e){var t=e.type,n=A.position,o=A.x,i=A.y;return X()&&"widget"===t?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===n?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===n?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===n?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Z(){return X()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(w,"px"),height:"".concat(x,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*A.y,"px)")}}function Q(e){return"start"===e.animation?"game"===A.mode?"translateY(20%)":"scale(0.8)":"game"===A.mode?"translateY(0)":"scale(1)"}function $(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function ee(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,s;return n(this,(function(n){switch(n.label){case 0:if(ie(),A.retryRecordRetentionTimerId&&(clearTimeout(A.retryRecordRetentionTimerId),A.retryRecordRetentionTimerId=null),A.retentionRemainingSeconds=null,A.isRetentionRecordedForSession=!0,!(e=D()))return[2];t="https://".concat(A.domain,"/api/sdk/retention"),o=W({supportViewConfig:e}),i={token:A.token,deviceId:A.deviceId,language:A.language,metadata:o},n.label=1;case 1:return n.trys.push([1,5,,6]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=n.sent()).ok?[3,4]:[4,$(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return s=n.sent(),console.error("Error tracking retention:",s),A.retryRecordRetentionTimerId=setTimeout(ee,6e4),[3,6];case 6:return[2]}}))}))}function te(){var e=new Date;if(A.sessionStatus="active",A.sessionResumeOrStartTime=e,A.sessionStartTime){var t=A.sessionStartTime.valueOf()/1e3+A.resetSessionAfterSecs;Date.now()/1e3>t&&ne()}else ne();if(null!==A.retentionRemainingSeconds&&(A.recordRetentionTimerId=setTimeout(ee,1e3*A.retentionRemainingSeconds)),!A.eventsPollerTimerId)if(A.eventsNextPollAt){var n=Math.floor((A.eventsNextPollAt.valueOf()-Date.now())/1e3);n>0?q(n):G()}else G()}function ne(){A.sessionStartTime=new Date,A.retentionRemainingSeconds=A.recordRetentionAfterSecs,A.isRetentionRecordedForSession=!1,ie()}function oe(){A.eventsPollerTimerId&&(clearTimeout(A.eventsPollerTimerId),A.eventsPollerTimerId=null)}function ie(){A.recordRetentionTimerId&&(clearTimeout(A.recordRetentionTimerId),A.recordRetentionTimerId=null)}function re(){G(),A.isRetentionRecordedForSession&&ee()}function se(e){var t=document.querySelector(b.sdkButtonIframe);if(t)var n=setInterval((function(){var o,i;"complete"===(null===(o=t.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(n),null===(i=null==t?void 0:t.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function ae(){var e,t,n;return null!==(n=null===(e=A.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=A.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function le(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===A.sessionStatus?te():e||"active"!==A.sessionStatus||function(){if(A.sessionResumeOrStartTime&&A.retentionRemainingSeconds){var e=Math.floor((Date.now()-A.sessionResumeOrStartTime.valueOf())/1e3);A.retentionRemainingSeconds-=e}A.sessionStatus="paused",oe(),ie()}()}document.addEventListener("visibilitychange",le),window.addEventListener("focus",le),window.addEventListener("blur",le),window.addEventListener("resize",j),window.addEventListener("resize",Y),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(b.sdkLoaderIframe),n=document.querySelector(b.sdkIframe);A.networkErrorTimerId&&(clearTimeout(A.networkErrorTimerId),A.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)R();else if("theymes.closeNotification"===e.data.action)J({notification:A.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:A.visibleNotification},(null==(s=r.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(H({path:s.action.path}),J({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(b.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*C)),"support"===A.widgetButtonAction?L():"assistant"===A.widgetButtonAction&&I();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var t=e.key,n=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,s={value:n,expiry:Date.now()+o};r.setItem(t,JSON.stringify(s))}({key:O,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,s}),!1),P("open",(function(){A.sdkIsOpen=!0})),P("close",(function(){A.sdkIsOpen=!1})),exports.addEventListener=P,exports.addField=function(e,t){A.fields[e]=t,U()},exports.addFields=function(t){A.fields=e(e({},A.fields),t),U()},exports.addTag=function(e){A.tags.add(e),U()},exports.addTags=function(e){e.forEach((function(e){return A.tags.add(e)})),U()},exports.close=R,exports.disableLogging=function(){A.loggingEnabled=!1},exports.disableNotifications=function(){A.notificationsPaused=!0},exports.enableLogging=function(){A.loggingEnabled=!0},exports.enableNotifications=function(){A.notificationsPaused=!1,G()},exports.getFields=function(){return A.fields},exports.getLanguage=function(){return A.language},exports.getPlayer=function(){return A.player},exports.getSdkVersion=function(){return y},exports.getSignedMetadataToken=function(){return A.signedMetadataToken},exports.getTags=function(){return Array.from(A.tags)},exports.getUnansweredMessageCount=function(){return A.unansweredMessageCount},exports.getUnreadMessageCount=function(){return A.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,s,a,l,c,d,u,p,g,f,m,y,b,w;return n(this,(function(n){switch(n.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");A.token=o,A.domain=i,A.mode=r.mode,A.element="element"in r&&void 0!==r.element?r.element:A.element,A.language=null!==(u=r.language)&&void 0!==u?u:A.language,A.nonce=null!==(p=r.nonce)&&void 0!==p?p:A.nonce,A.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),A.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:A.widgetButton,A.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(f=r.buttonAction)&&void 0!==f?f:A.widgetButtonAction,A.position="position"in r&&void 0!==r.position&&null!==(m=r.position)&&void 0!==m?m:A.position,A.x="x"in r&&void 0!==r.x?r.x:A.x,A.y="y"in r&&void 0!==r.y?r.y:A.y,G(),t="https://".concat(i,"/api/sdk/initialize"),s={token:o,deviceId:A.deviceId,platform:v,mode:A.mode},n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})];case 2:return(a=n.sent()).ok?[3,4]:[4,$(a)];case 3:throw n.sent();case 4:return[4,a.json()];case 5:return l=n.sent(),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.colors)&&(x=l.branding.colors,A.colors=e(e({},A.colors),x),localStorage.setItem(h,JSON.stringify(A.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(A.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(A.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(A.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(A.resetSessionAfterSecs=l.resetSessionAfterSecs),te(),U(),c=function(e){var t=e.key,n=e.storage,o=void 0===n?sessionStorage:n,i=e.removeItem,r=void 0!==i&&i,s=o.getItem(t);if(!s)return null;var a=JSON.parse(s);return Date.now()>a.expiry?(sessionStorage.removeItem(t),null):(r&&o.removeItem(t),a.value)}({key:O,removeItem:!0}),c?H({path:c}):A.widgetButton&&K(),[3,7];case 6:return d=n.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var x}))}))},exports.isPrivacyMode=function(){return A.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return A.youngPlayer},exports.openAssistant=I,exports.openResource=function(e,t){var n="/resources/".concat(e);F({path:n,config:t}),H({path:n,config:t})},exports.openSupport=L,exports.recordRetention=function(){A.isRetentionRecordedForSession||ee()},exports.removeAllFields=function(){A.fields={},U()},exports.removeAllTags=function(){A.tags.clear(),U()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.apply(void 0,e)},exports.removeField=function(e){delete A.fields[e],U()},exports.removeFields=function(e){e.forEach((function(e){return delete A.fields[e]})),U()},exports.removeTag=function(e){A.tags.delete(e),U()},exports.removeTags=function(e){e.forEach((function(e){return A.tags.delete(e)})),U()},exports.requestNotificationPermission=function(){},exports.reset=function(){A.language=null,A.tags=new Set,A.fields={},A.signedMetadataToken=null,A.player=null,U(),se({action:"widgetButtonTextUpdate",text:ae()})},exports.setFields=function(e){A.fields=e,U()},exports.setLanguage=function(e){var t=A.language!==e;A.language=e,t&&(U(),se({action:"widgetButtonTextUpdate",text:ae()}))},exports.setPlayer=function(e){var t,n=(null===(t=A.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);A.player=e,n&&(U(),re())},exports.setPrivacyMode=function(e){A.privacyMode=e,U()},exports.setSignedMetadataToken=function(e){var t=A.signedMetadataToken!==e;A.signedMetadataToken=e,t&&(U(),re())},exports.setTags=function(e){A.tags=new Set(e),U()},exports.setYoungPlayer=function(e){A.youngPlayer=e,U()};
|
package/dist/sdk.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach((function(e){return e.apply(void 0,n)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',p=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return p(o,n[t])})))},f="colors",g="1.2.0",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=340,v=680,b=120,w=48,k=.2,E=.2,S=.2,T="theymes_path_on_init",C={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(f);if(n){var t=JSON.parse(n);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},x=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,p,g,h,y,v,b,w;return t(this,(function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");C.token=o,C.domain=i,C.mode=r.mode,C.element="element"in r&&void 0!==r.element?r.element:C.element,C.language=null!==(u=r.language)&&void 0!==u?u:C.language,C.nonce=null!==(p=r.nonce)&&void 0!==p?p:C.nonce,C.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),C.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:C.widgetButton,C.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:C.widgetButtonAction,C.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:C.position,C.x="x"in r&&void 0!==r.x?r.x:C.x,C.y="y"in r&&void 0!==r.y?r.y:C.y,Te(),n="https://".concat(i,"/api/sdk/initialize"),a={token:o,deviceId:C.deviceId,platform:m,mode:C.mode},t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=t.sent()).ok?[3,4]:[4,De(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(k=l.branding.colors,C.colors=e(e({},C.colors),k),localStorage.setItem(f,JSON.stringify(C.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(C.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(C.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(C.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(C.resetSessionAfterSecs=l.resetSessionAfterSecs),Ne(),we(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:T,removeItem:!0}),c?ve({path:c}):C.widgetButton&&Oe(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},_=function(e){var n="/help-center";be({path:n,config:e}),ve({path:n,config:e})},O=function(e){var n="/assistant";be({path:n,config:e}),ve({path:n,config:e})},A=function(e,n){var t="/resources/".concat(e);be({path:t,config:n}),ve({path:t,config:n})},I=function(){!function(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e){var t=function(){"widget"!==C.mode||C.forceUpdateSdkDialog?e.remove():e.style.display="none",C.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=Re({animation:"start"}),setTimeout((function(){t()}),1e3*k)):t()}C.widgetButton&&Oe();s("close",[])}(),Te()},L=function(){return C.language},R=function(e){var n=C.language!==e;C.language=e,n&&(we(),Ue({action:"widgetButtonTextUpdate",text:qe()}))},D=function(){return C.signedMetadataToken},P=function(e){var n=C.signedMetadataToken!==e;C.signedMetadataToken=e,n&&(we(),Fe())},N=function(){return C.player},B=function(e){var n,t=(null===(n=C.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);C.player=e,t&&(we(),Fe())},M=function(){return Array.from(C.tags)},H=function(e){C.tags=new Set(e),we()},F=function(e){C.tags.add(e),we()},U=function(e){e.forEach((function(e){return C.tags.add(e)})),we()},q=function(e){C.tags.delete(e),we()},j=function(e){e.forEach((function(e){return C.tags.delete(e)})),we()},G=function(){C.tags.clear(),we()},W=function(){return C.fields},z=function(e){C.fields=e,we()},Y=function(e,n){C.fields[e]=n,we()},J=function(n){C.fields=e(e({},C.fields),n),we()},K=function(e){delete C.fields[e],we()},X=function(e){e.forEach((function(e){return delete C.fields[e]})),we()},V=function(){C.fields={},we()},Z=function(){C.loggingEnabled=!0},Q=function(){C.loggingEnabled=!1},$=function(){return C.youngPlayer},ee=function(e){C.youngPlayer=e,we()},ne=function(){return C.privacyMode},te=function(e){C.privacyMode=e,we()},oe=function(){return!0},ie=function(){},re=function(){C.notificationsPaused=!1,Te()},ae=function(){C.notificationsPaused=!0},se=function(){return C.unreadMessageCount},le=function(){return C.unansweredMessageCount},ce=function(){return g},de=function(){C.language=null,C.tags=new Set,C.fields={},C.signedMetadataToken=null,C.player=null,we(),Ue({action:"widgetButtonTextUpdate",text:qe()})},ue=function(){C.isRetentionRecordedForSession||Pe()},pe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},fe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ge(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!C.token||!C.domain||!C.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:C.language)&&void 0!==a?a:null,f=null!==(s=C.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=C.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:g};C.youngPlayer&&(y._youngPlayer=!0),(C.privacyMode||C.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(C.tags),!0),d,!0),b=e(e(e({},C.fields),u),y);return{token:C.token,domain:C.domain,deviceId:C.deviceId,tags:v,fields:b,language:p,signedMetadataToken:f,player:h}}function me(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function he(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(C.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(C.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(C.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(C.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",me(C.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",me(C.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",me(C.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",me(C.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",me(C.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",me(C.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",me(C.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===C.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=C.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=C.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",C.nonce?'nonce="'.concat(C.nonce,'"'):"")}function ye(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function ve(e){var n,t,o,i=ge({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(n=document.querySelector(h.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(h.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=h.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(me(C.colors.background),")"),a.style.transform=Re({animation:"start"}),a.style.transition=(C.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===C.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=a.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!C.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(C.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",C.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=ke({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(d),a.appendChild(p),document.body.appendChild(r)),ye({iframe:d,content:he({template:l})});var g=!1,y=function(){g||(g=!0,C.networkErrorTimerId=setTimeout((function(){ye({iframe:d,content:he({template:c})})}),1e4))};p.onload=y,p.onerror=function(){ye({iframe:d,content:he({template:c})})},Ee(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=Re({animation:"end"})}),100)}}function be(e){var n=e.path,t=e.config,o=null!=t?t:null;C.previousPath===n&&p(C.previousConfig,o)||(C.previousPath=n,C.previousConfig=o,we())}function we(){var e=document.querySelector(h.sdkDialog);C.sdkIsOpen?C.forceUpdateSdkDialog=!0:null==e||e.remove()}function ke(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function Ee(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e&&n){if("widget"===C.mode){var t=Ie({type:"widget"}),o=Le();e.style.width=o.width,e.style.height=o.height,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,Ae()?(n.style.border="1px solid rgb(".concat(me(C.colors.border),")"),n.style.borderRadius="10px"):(n.style.border="none",n.style.borderRadius="0")}else if(n.style.border="none",n.style.borderRadius="0",C.element){var i=C.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(Ee)}}function Se(e){var n=1e3*e;C.eventsNextPollAt=new Date(Date.now()+n),C.eventsPollerTimerId=setTimeout(Te,n)}function Te(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u;return t(this,(function(t){switch(t.label){case 0:if(Me(),!C.token||!C.domain||!C.deviceId)return Se(60),[2];n=C.notificationsPaused||C.sdkIsOpen?"true":"false",i="https://".concat(C.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:C.token,language:null!==(d=C.language)&&void 0!==d?d:"en",deviceId:C.deviceId,notificationsPaused:n,mode:C.mode},(null===(u=C.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:C.player.id}:{}),C.signedMetadataToken?{signedMetadataToken:C.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=t.sent()).ok?[3,4]:[4,De(a)];case 3:throw t.sent();case 4:return[4,a.json()];case 5:return l=t.sent(),C.notifications=o(o([],C.notifications,!0),l.notifications,!0),l.notifications.length>0&&Ce(),l.unansweredMessageCount!==C.unansweredMessageCount&&(C.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==C.unreadMessageCount&&(C.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),Ue({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),Se(l.nextPollSeconds),[3,7];case 6:return c=t.sent(),console.error("Error initializing SDK:",c),Se(60),[3,7];case 7:return[2]}}))}))}function Ce(){var e,n,t=C.notifications[0];if(t&&!C.visibleNotification){C.visibleNotification=t;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(h.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(S,"s ease-in-out, margin-top ").concat(S,"s ease-in-out"),o.appendChild(r),ye({iframe:r,content:(i={text:t.text},he({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),xe(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){_e({notification:t})}),1e3*t.closeAfterSeconds)}}function xe(){var e,n,t,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===C.mode){var a=Ie({type:"widget"}),s=Le(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(C.element){var c=C.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(xe)}}function _e(e){if(e.notification&&C.visibleNotification===e.notification){var n=document.querySelector(h.notificationIframe),t=document.querySelector(h.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),C.notifications=C.notifications.slice(1),C.visibleNotification=null,Ce()}),1e3*S))}}function Oe(){var e,n=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Ie({type:"button"});n.id=h.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(b,"px"),n.style.height="".concat(w,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),ye({iframe:n,content:(t={unreadMessageCount:C.unreadMessageCount},he({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",me(C.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",me(C.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",me(C.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",qe()))})}}function Ae(){var e=C.y;return window.innerWidth>768&&window.innerHeight>v+e}function Ie(e){var n=e.type,t=C.position,o=C.x,i=C.y;return Ae()||"widget"!==n?"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function Le(){return Ae()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function Re(e){return"start"===e.animation?"game"===C.mode?"translateY(20%)":"scale(0.8)":"game"===C.mode?"translateY(0)":"scale(1)"}function De(e){return n(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function Pe(){return n(this,void 0,void 0,(function(){var e,n,o,i,r,a;return t(this,(function(t){switch(t.label){case 0:if(He(),C.retryRecordRetentionTimerId&&(clearTimeout(C.retryRecordRetentionTimerId),C.retryRecordRetentionTimerId=null),C.retentionRemainingSeconds=null,C.isRetentionRecordedForSession=!0,!(e=ge()))return[2];n="https://".concat(C.domain,"/api/sdk/retention"),o=ke({supportViewConfig:e}),i={token:C.token,deviceId:C.deviceId,language:C.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,De(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),C.retryRecordRetentionTimerId=setTimeout(Pe,6e4),[3,6];case 6:return[2]}}))}))}function Ne(){var e=new Date;if(C.sessionStatus="active",C.sessionResumeOrStartTime=e,C.sessionStartTime){var n=C.sessionStartTime.valueOf()/1e3+C.resetSessionAfterSecs;Date.now()/1e3>n&&Be()}else Be();if(null!==C.retentionRemainingSeconds&&(C.recordRetentionTimerId=setTimeout(Pe,1e3*C.retentionRemainingSeconds)),!C.eventsPollerTimerId)if(C.eventsNextPollAt){var t=Math.floor((C.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?Se(t):Te()}else Te()}function Be(){C.sessionStartTime=new Date,C.retentionRemainingSeconds=C.recordRetentionAfterSecs,C.isRetentionRecordedForSession=!1,He()}function Me(){C.eventsPollerTimerId&&(clearTimeout(C.eventsPollerTimerId),C.eventsPollerTimerId=null)}function He(){C.recordRetentionTimerId&&(clearTimeout(C.recordRetentionTimerId),C.recordRetentionTimerId=null)}function Fe(){Te(),C.isRetentionRecordedForSession&&Pe()}function Ue(e){var n=document.querySelector(h.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function qe(){var e,n,t;return null!==(t=null===(e=C.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=C.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function je(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===C.sessionStatus?Ne():e||"active"!==C.sessionStatus||function(){if(C.sessionResumeOrStartTime&&C.retentionRemainingSeconds){var e=Math.floor((Date.now()-C.sessionResumeOrStartTime.valueOf())/1e3);C.retentionRemainingSeconds-=e}C.sessionStatus="paused",Me(),He()}()}document.addEventListener("visibilitychange",je),window.addEventListener("focus",je),window.addEventListener("blur",je),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(h.sdkLoaderIframe),t=document.querySelector(h.sdkIframe);C.networkErrorTimerId&&(clearTimeout(C.networkErrorTimerId),C.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)I();else if("theymes.closeNotification"===e.data.action)_e({notification:C.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:C.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ve({path:a.action.path}),_e({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*E)),"support"===C.widgetButtonAction?_():"assistant"===C.widgetButtonAction&&O();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:T,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),pe("open",(function(){C.sdkIsOpen=!0})),pe("close",(function(){C.sdkIsOpen=!1}));export{pe as addEventListener,Y as addField,J as addFields,F as addTag,U as addTags,I as close,Q as disableLogging,ae as disableNotifications,Z as enableLogging,re as enableNotifications,W as getFields,L as getLanguage,N as getPlayer,ce as getSdkVersion,D as getSignedMetadataToken,M as getTags,le as getUnansweredMessageCount,se as getUnreadMessageCount,x as initialize,ne as isPrivacyMode,oe as isSupported,$ as isYoungPlayer,O as openAssistant,A as openResource,_ as openSupport,ue as recordRetention,V as removeAllFields,G as removeAllTags,fe as removeEventListener,K as removeField,X as removeFields,q as removeTag,j as removeTags,ie as requestNotificationPermission,de as reset,z as setFields,R as setLanguage,B as setPlayer,te as setPrivacyMode,P as setSignedMetadataToken,H as setTags,ee as setYoungPlayer};
|
|
1
|
+
var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach((function(e){return e.apply(void 0,n)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',p=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return p(o,n[t])})))},f=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,g=/CrOS/,m=/android|ipad|playbook|silk/i;var h="colors",y="1.2.2",v="web",b={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},w=340,k=680,E=500,S=120,T=48,x=.2,C=.2,_=.2,O="theymes_path_on_init",A={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(h);if(n){var t=JSON.parse(n);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},I=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,p,f,g,m,y,b,w;return t(this,(function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");A.token=o,A.domain=i,A.mode=r.mode,A.element="element"in r&&void 0!==r.element?r.element:A.element,A.language=null!==(u=r.language)&&void 0!==u?u:A.language,A.nonce=null!==(p=r.nonce)&&void 0!==p?p:A.nonce,A.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),A.widgetButton="button"in r&&void 0!==r.button&&null!==(f=r.button)&&void 0!==f?f:A.widgetButton,A.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(g=r.buttonAction)&&void 0!==g?g:A.widgetButtonAction,A.position="position"in r&&void 0!==r.position&&null!==(m=r.position)&&void 0!==m?m:A.position,A.x="x"in r&&void 0!==r.x?r.x:A.x,A.y="y"in r&&void 0!==r.y?r.y:A.y,Oe(),n="https://".concat(i,"/api/sdk/initialize"),a={token:o,deviceId:A.deviceId,platform:v,mode:A.mode},t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=t.sent()).ok?[3,4]:[4,Me(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.colors)&&(k=l.branding.colors,A.colors=e(e({},A.colors),k),localStorage.setItem(h,JSON.stringify(A.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(A.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(A.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(A.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(A.resetSessionAfterSecs=l.resetSessionAfterSecs),Fe(),Te(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:O,removeItem:!0}),c?Ee({path:c}):A.widgetButton&&Re(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},L=function(e){var n="/help-center";Se({path:n,config:e}),Ee({path:n,config:e})},R=function(e){var n="/assistant";Se({path:n,config:e}),Ee({path:n,config:e})},D=function(e,n){var t="/resources/".concat(e);Se({path:t,config:n}),Ee({path:t,config:n})},P=function(){!function(){var e=document.querySelector(b.sdkDialog),n=document.querySelector(b.sdkIframeWrapper);if(e){var t=function(){"widget"!==A.mode||A.forceUpdateSdkDialog?e.remove():e.style.display="none",A.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=Be({animation:"start"}),setTimeout((function(){t()}),1e3*x)):t()}A.widgetButton&&Re();s("close",[])}(),Oe()},N=function(){return A.language},B=function(e){var n=A.language!==e;A.language=e,n&&(Te(),Ge({action:"widgetButtonTextUpdate",text:ze()}))},M=function(){return A.signedMetadataToken},H=function(e){var n=A.signedMetadataToken!==e;A.signedMetadataToken=e,n&&(Te(),qe())},F=function(){return A.player},U=function(e){var n,t=(null===(n=A.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);A.player=e,t&&(Te(),qe())},W=function(){return Array.from(A.tags)},j=function(e){A.tags=new Set(e),Te()},q=function(e){A.tags.add(e),Te()},G=function(e){e.forEach((function(e){return A.tags.add(e)})),Te()},z=function(e){A.tags.delete(e),Te()},Y=function(e){e.forEach((function(e){return A.tags.delete(e)})),Te()},J=function(){A.tags.clear(),Te()},K=function(){return A.fields},X=function(e){A.fields=e,Te()},V=function(e,n){A.fields[e]=n,Te()},Z=function(n){A.fields=e(e({},A.fields),n),Te()},Q=function(e){delete A.fields[e],Te()},$=function(e){e.forEach((function(e){return delete A.fields[e]})),Te()},ee=function(){A.fields={},Te()},ne=function(){A.loggingEnabled=!0},te=function(){A.loggingEnabled=!1},oe=function(){return A.youngPlayer},ie=function(e){A.youngPlayer=e,Te()},re=function(){return A.privacyMode},ae=function(e){A.privacyMode=e,Te()},se=function(){return!0},le=function(){},ce=function(){A.notificationsPaused=!1,Oe()},de=function(){A.notificationsPaused=!0},ue=function(){return A.unreadMessageCount},pe=function(){return A.unansweredMessageCount},fe=function(){return y},ge=function(){A.language=null,A.tags=new Set,A.fields={},A.signedMetadataToken=null,A.player=null,Te(),Ge({action:"widgetButtonTextUpdate",text:ze()})},me=function(){A.isRetentionRecordedForSession||He()},he=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},ye=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ve(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!A.token||!A.domain||!A.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:A.language)&&void 0!==a?a:null,f=null!==(s=A.signedMetadataToken)&&void 0!==s?s:null,g=null!==(l=A.player)&&void 0!==l?l:null,m={_platform:v,_sdkVersion:y};A.youngPlayer&&(m._youngPlayer=!0),(A.privacyMode||A.youngPlayer)&&(m._privacyMode=!0);var h=o(o([],Array.from(A.tags),!0),d,!0),b=e(e(e({},A.fields),u),m);return{token:A.token,domain:A.domain,deviceId:A.deviceId,tags:h,fields:b,language:p,signedMetadataToken:f,player:g}}function be(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function we(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",v).replace("'INSET_TOP_PLACEHOLDER'","".concat(A.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(A.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(A.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(A.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",be(A.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",be(A.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",be(A.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",be(A.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",be(A.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",be(A.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",be(A.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===A.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=A.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=A.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",A.nonce?'nonce="'.concat(A.nonce,'"'):"")}function ke(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function Ee(e){var n,t,o,i=ve({config:e.config});if(i){var r=null!==(n=document.querySelector(b.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=b.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(b.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=b.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(be(A.colors.background),")"),a.style.transform=Be({animation:"start"}),a.style.transition=(A.mode,"opacity ".concat(x,"s ease-in-out, transform ").concat(x,"s ease-in-out")),"widget"===A.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(b.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=b.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=a.querySelector(b.sdkIframe),p=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),m())}),500);p.id=b.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!A.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(A.domain,"/sdk"),i=new URLSearchParams;i.set("platform",v),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",A.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=xe({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(d),a.appendChild(p),document.body.appendChild(r)),ke({iframe:d,content:we({template:l})});var g=!1,m=function(){g||(g=!0,A.networkErrorTimerId=setTimeout((function(){ke({iframe:d,content:we({template:c})})}),1e4))};p.onload=m,p.onerror=function(){ke({iframe:d,content:we({template:c})})},Ce(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=Be({animation:"end"})}),100)}}function Se(e){var n=e.path,t=e.config,o=null!=t?t:null;A.previousPath===n&&p(A.previousConfig,o)||(A.previousPath=n,A.previousConfig=o,Te())}function Te(){var e=document.querySelector(b.sdkDialog);A.sdkIsOpen?A.forceUpdateSdkDialog=!0:null==e||e.remove()}function xe(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function Ce(){var e=document.querySelector(b.sdkDialog),n=document.querySelector(b.sdkIframeWrapper);if(e&&n)if("widget"===A.mode){var t=Pe({type:"widget"}),o=Ne();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,De()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(be(A.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",A.element){var i=A.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}function _e(e){var n=1e3*e;A.eventsNextPollAt=new Date(Date.now()+n),A.eventsPollerTimerId=setTimeout(Oe,n)}function Oe(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u;return t(this,(function(t){switch(t.label){case 0:if(We(),!A.token||!A.domain||!A.deviceId)return _e(60),[2];n=A.notificationsPaused||A.sdkIsOpen?"true":"false",i="https://".concat(A.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:A.token,language:null!==(d=A.language)&&void 0!==d?d:"en",deviceId:A.deviceId,notificationsPaused:n,mode:A.mode},(null===(u=A.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:A.player.id}:{}),A.signedMetadataToken?{signedMetadataToken:A.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=t.sent()).ok?[3,4]:[4,Me(a)];case 3:throw t.sent();case 4:return[4,a.json()];case 5:return l=t.sent(),A.notifications=o(o([],A.notifications,!0),l.notifications,!0),l.notifications.length>0&&Ae(),l.unansweredMessageCount!==A.unansweredMessageCount&&(A.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==A.unreadMessageCount&&(A.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),Ge({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),_e(l.nextPollSeconds),[3,7];case 6:return c=t.sent(),console.error("Error initializing SDK:",c),_e(60),[3,7];case 7:return[2]}}))}))}function Ae(){var e,n,t=A.notifications[0];if(t&&!A.visibleNotification){A.visibleNotification=t;var o=null!==(e=document.querySelector(b.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=b.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(b.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=b.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(_,"s ease-in-out, margin-top ").concat(_,"s ease-in-out"),o.appendChild(r),ke({iframe:r,content:(i={text:t.text},we({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),Ie(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){Le({notification:t})}),1e3*t.closeAfterSeconds)}}function Ie(){var e,n,t,o=document.querySelector(b.notificationDialog),i=document.querySelector(b.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===A.mode){var a=Pe({type:"widget"}),s=Ne(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.maxWidth=s.maxWidth,o.style.maxHeight=s.maxHeight,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(A.element){var c=A.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function Le(e){if(e.notification&&A.visibleNotification===e.notification){var n=document.querySelector(b.notificationIframe),t=document.querySelector(b.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),A.notifications=A.notifications.slice(1),A.visibleNotification=null,Ae()}),1e3*_))}}function Re(){var e,n=null!==(e=document.querySelector(b.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Pe({type:"button"});n.id=b.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(S,"px"),n.style.height="".concat(T,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),ke({iframe:n,content:(t={unreadMessageCount:A.unreadMessageCount},we({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",be(A.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",be(A.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",be(A.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ze()))})}}function De(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=f.test(n)&&!g.test(n)||!!e.tablet&&m.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<E||window.innerHeight<E)}function Pe(e){var n=e.type,t=A.position,o=A.x,i=A.y;return De()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Ne(){return De()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(w,"px"),height:"".concat(k,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*A.y,"px)")}}function Be(e){return"start"===e.animation?"game"===A.mode?"translateY(20%)":"scale(0.8)":"game"===A.mode?"translateY(0)":"scale(1)"}function Me(e){return n(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function He(){return n(this,void 0,void 0,(function(){var e,n,o,i,r,a;return t(this,(function(t){switch(t.label){case 0:if(je(),A.retryRecordRetentionTimerId&&(clearTimeout(A.retryRecordRetentionTimerId),A.retryRecordRetentionTimerId=null),A.retentionRemainingSeconds=null,A.isRetentionRecordedForSession=!0,!(e=ve()))return[2];n="https://".concat(A.domain,"/api/sdk/retention"),o=xe({supportViewConfig:e}),i={token:A.token,deviceId:A.deviceId,language:A.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,Me(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),A.retryRecordRetentionTimerId=setTimeout(He,6e4),[3,6];case 6:return[2]}}))}))}function Fe(){var e=new Date;if(A.sessionStatus="active",A.sessionResumeOrStartTime=e,A.sessionStartTime){var n=A.sessionStartTime.valueOf()/1e3+A.resetSessionAfterSecs;Date.now()/1e3>n&&Ue()}else Ue();if(null!==A.retentionRemainingSeconds&&(A.recordRetentionTimerId=setTimeout(He,1e3*A.retentionRemainingSeconds)),!A.eventsPollerTimerId)if(A.eventsNextPollAt){var t=Math.floor((A.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?_e(t):Oe()}else Oe()}function Ue(){A.sessionStartTime=new Date,A.retentionRemainingSeconds=A.recordRetentionAfterSecs,A.isRetentionRecordedForSession=!1,je()}function We(){A.eventsPollerTimerId&&(clearTimeout(A.eventsPollerTimerId),A.eventsPollerTimerId=null)}function je(){A.recordRetentionTimerId&&(clearTimeout(A.recordRetentionTimerId),A.recordRetentionTimerId=null)}function qe(){Oe(),A.isRetentionRecordedForSession&&He()}function Ge(e){var n=document.querySelector(b.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function ze(){var e,n,t;return null!==(t=null===(e=A.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=A.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function Ye(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===A.sessionStatus?Fe():e||"active"!==A.sessionStatus||function(){if(A.sessionResumeOrStartTime&&A.retentionRemainingSeconds){var e=Math.floor((Date.now()-A.sessionResumeOrStartTime.valueOf())/1e3);A.retentionRemainingSeconds-=e}A.sessionStatus="paused",We(),je()}()}document.addEventListener("visibilitychange",Ye),window.addEventListener("focus",Ye),window.addEventListener("blur",Ye),window.addEventListener("resize",Ce),window.addEventListener("resize",Ie),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(b.sdkLoaderIframe),t=document.querySelector(b.sdkIframe);A.networkErrorTimerId&&(clearTimeout(A.networkErrorTimerId),A.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)P();else if("theymes.closeNotification"===e.data.action)Le({notification:A.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:A.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(Ee({path:a.action.path}),Le({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(b.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*C)),"support"===A.widgetButtonAction?L():"assistant"===A.widgetButtonAction&&R();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:O,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),he("open",(function(){A.sdkIsOpen=!0})),he("close",(function(){A.sdkIsOpen=!1}));export{he as addEventListener,V as addField,Z as addFields,q as addTag,G as addTags,P as close,te as disableLogging,de as disableNotifications,ne as enableLogging,ce as enableNotifications,K as getFields,N as getLanguage,F as getPlayer,fe as getSdkVersion,M as getSignedMetadataToken,W as getTags,pe as getUnansweredMessageCount,ue as getUnreadMessageCount,I as initialize,re as isPrivacyMode,se as isSupported,oe as isYoungPlayer,R as openAssistant,D as openResource,L as openSupport,me as recordRetention,ee as removeAllFields,J as removeAllTags,ye as removeEventListener,Q as removeField,$ as removeFields,z as removeTag,Y as removeTags,le as requestNotificationPermission,ge as reset,X as setFields,B as setLanguage,U as setPlayer,ae as setPrivacyMode,H as setSignedMetadataToken,j as setTags,ie as setYoungPlayer};
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var theymes=function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach((function(e){return e.apply(void 0,n)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',p='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',g=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return g(o,n[t])})))},f="colors",m="1.2.0",h="web",y={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},v=340,b=680,w=120,k=48,S=.2,T=.2,E=.2,C="theymes_path_on_init",x={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(f);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},_=function(e){var n="/help-center";M({path:n,config:e}),N({path:n,config:e})},O=function(e){var n="/assistant";M({path:n,config:e}),N({path:n,config:e})},A=function(){!function(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.sdkIframeWrapper);if(e){var t=function(){"widget"!==x.mode||x.forceUpdateSdkDialog?e.remove():e.style.display="none",x.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=X({animation:"start"}),setTimeout((function(){t()}),1e3*S)):t()}x.widgetButton&&z();l("close",[])}(),q()},L=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function I(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!x.token||!x.domain||!x.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,g=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,f=null!==(l=x.player)&&void 0!==l?l:null,y={_platform:h,_sdkVersion:m};x.youngPlayer&&(y._youngPlayer=!0),(x.privacyMode||x.youngPlayer)&&(y._privacyMode=!0);var v=i(i([],Array.from(x.tags),!0),d,!0),b=n(n(n({},x.fields),u),y);return{token:x.token,domain:x.domain,deviceId:x.deviceId,tags:v,fields:b,language:p,signedMetadataToken:g,player:f}}function R(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function P(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",h).replace("'INSET_TOP_PLACEHOLDER'","".concat(x.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(x.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(x.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(x.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",R(x.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",R(x.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",R(x.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",R(x.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",R(x.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",R(x.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",R(x.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===x.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=x.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=x.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",x.nonce?'nonce="'.concat(x.nonce,'"'):"")}function D(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function N(e){var n,t,o,i=I({config:e.config});if(i){!function(){if(!document.querySelector(y.sdkStylesheet)){var e=document.createElement("style");e.id=y.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(y.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(y.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(n=document.querySelector(y.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=y.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(y.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=y.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(R(x.colors.background),")"),a.style.transform=X({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(y.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=y.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(y.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=y.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!x.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(x.domain,"/sdk"),i=new URLSearchParams;i.set("platform",h),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=H({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),D({iframe:s,content:P({template:c})});var f=!1,m=function(){f||(f=!0,x.networkErrorTimerId=setTimeout((function(){D({iframe:s,content:P({template:d})})}),1e4))};p.onload=m,p.onerror=function(){D({iframe:s,content:P({template:d})})},F(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=X({animation:"end"})}),100)}}function M(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&g(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,B())}function B(){var e=document.querySelector(y.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function H(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function F(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.sdkIframeWrapper);if(e&&n){if("widget"===x.mode){var t=J({type:"widget"}),o=K();e.style.width=o.width,e.style.height=o.height,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,Y()?(n.style.border="1px solid rgb(".concat(R(x.colors.border),")"),n.style.borderRadius="10px"):(n.style.border="none",n.style.borderRadius="0")}else if(n.style.border="none",n.style.borderRadius="0",x.element){var i=x.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(F)}}function U(e){var n=1e3*e;x.eventsNextPollAt=new Date(Date.now()+n),x.eventsPollerTimerId=setTimeout(q,n)}function q(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u;return o(this,(function(o){switch(o.label){case 0:if(ee(),!x.token||!x.domain||!x.deviceId)return U(60),[2];e=x.notificationsPaused||x.sdkIsOpen?"true":"false",t="https://".concat(x.domain,"/api/sdk/events"),r=new URLSearchParams(n(n({token:x.token,language:null!==(d=x.language)&&void 0!==d?d:"en",deviceId:x.deviceId,notificationsPaused:e,mode:x.mode},(null===(u=x.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=o.sent()).ok?[3,4]:[4,V(a)];case 3:throw o.sent();case 4:return[4,a.json()];case 5:return s=o.sent(),x.notifications=i(i([],x.notifications,!0),s.notifications,!0),s.notifications.length>0&&j(),s.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),oe({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),U(s.nextPollSeconds),[3,7];case 6:return c=o.sent(),console.error("Error initializing SDK:",c),U(60),[3,7];case 7:return[2]}}))}))}function j(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(y.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=y.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(y.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=y.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(E,"s ease-in-out, margin-top ").concat(E,"s ease-in-out"),o.appendChild(r),D({iframe:r,content:(i={text:t.text},P({template:u}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),G(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){W({notification:t})}),1e3*t.closeAfterSeconds)}}function G(){var e,n,t,o=document.querySelector(y.notificationDialog),i=document.querySelector(y.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===x.mode){var a=J({type:"widget"}),s=K(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(G)}}function W(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(y.notificationIframe),t=document.querySelector(y.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),x.notifications=x.notifications.slice(1),x.visibleNotification=null,j()}),1e3*E))}}function z(){var e,n=null!==(e=document.querySelector(y.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=J({type:"button"});n.id=y.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(w,"px"),n.style.height="".concat(k,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(T,"s ease-in-out, transform ").concat(T,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),D({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},P({template:p}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",R(x.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",R(x.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",R(x.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ie()))})}}function Y(){var e=x.y;return window.innerWidth>768&&window.innerHeight>b+e}function J(e){var n=e.type,t=x.position,o=x.x,i=x.y;return Y()||"widget"!==n?"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function K(){return Y()?{width:"".concat(v,"px"),height:"".concat(b,"px")}:{width:"100%",height:"100%"}}function X(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function V(e){return t(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function Z(){return t(this,void 0,void 0,(function(){var e,n,t,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(ne(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=I()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),t=H({supportViewConfig:e}),i={token:x.token,deviceId:x.deviceId,language:x.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,V(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),x.retryRecordRetentionTimerId=setTimeout(Z,6e4),[3,6];case 6:return[2]}}))}))}function Q(){var e=new Date;if(x.sessionStatus="active",x.sessionResumeOrStartTime=e,x.sessionStartTime){var n=x.sessionStartTime.valueOf()/1e3+x.resetSessionAfterSecs;Date.now()/1e3>n&&$()}else $();if(null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(Z,1e3*x.retentionRemainingSeconds)),!x.eventsPollerTimerId)if(x.eventsNextPollAt){var t=Math.floor((x.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?U(t):q()}else q()}function $(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,ne()}function ee(){x.eventsPollerTimerId&&(clearTimeout(x.eventsPollerTimerId),x.eventsPollerTimerId=null)}function ne(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function te(){q(),x.isRetentionRecordedForSession&&Z()}function oe(e){var n=document.querySelector(y.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function ie(){var e,n,t;return null!==(t=null===(e=x.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=x.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function re(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===x.sessionStatus?Q():e||"active"!==x.sessionStatus||function(){if(x.sessionResumeOrStartTime&&x.retentionRemainingSeconds){var e=Math.floor((Date.now()-x.sessionResumeOrStartTime.valueOf())/1e3);x.retentionRemainingSeconds-=e}x.sessionStatus="paused",ee(),ne()}()}return document.addEventListener("visibilitychange",re),window.addEventListener("focus",re),window.addEventListener("blur",re),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(y.sdkLoaderIframe),t=document.querySelector(y.sdkIframe);x.networkErrorTimerId&&(clearTimeout(x.networkErrorTimerId),x.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)A();else if("theymes.closeNotification"===e.data.action)W({notification:x.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:x.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(N({path:a.action.path}),W({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(y.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*T)),"support"===x.widgetButtonAction?_():"assistant"===x.widgetButtonAction&&O();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:C,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),L("open",(function(){x.sdkIsOpen=!0})),L("close",(function(){x.sdkIsOpen=!1})),e.addEventListener=L,e.addField=function(e,n){x.fields[e]=n,B()},e.addFields=function(e){x.fields=n(n({},x.fields),e),B()},e.addTag=function(e){x.tags.add(e),B()},e.addTags=function(e){e.forEach((function(e){return x.tags.add(e)})),B()},e.close=A,e.disableLogging=function(){x.loggingEnabled=!1},e.disableNotifications=function(){x.notificationsPaused=!0},e.enableLogging=function(){x.loggingEnabled=!0},e.enableNotifications=function(){x.notificationsPaused=!1,q()},e.getFields=function(){return x.fields},e.getLanguage=function(){return x.language},e.getPlayer=function(){return x.player},e.getSdkVersion=function(){return m},e.getSignedMetadataToken=function(){return x.signedMetadataToken},e.getTags=function(){return Array.from(x.tags)},e.getUnansweredMessageCount=function(){return x.unansweredMessageCount},e.getUnreadMessageCount=function(){return x.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,p,g,m,y,v,b,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");x.token=e,x.domain=i,x.mode=r.mode,x.element="element"in r&&void 0!==r.element?r.element:x.element,x.language=null!==(u=r.language)&&void 0!==u?u:x.language,x.nonce=null!==(p=r.nonce)&&void 0!==p?p:x.nonce,x.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),x.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(m=r.buttonAction)&&void 0!==m?m:x.widgetButtonAction,x.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:x.position,x.x="x"in r&&void 0!==r.x?r.x:x.x,x.y="y"in r&&void 0!==r.y?r.y:x.y,q(),t="https://".concat(i,"/api/sdk/initialize"),a={token:e,deviceId:x.deviceId,platform:h,mode:x.mode},o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=o.sent()).ok?[3,4]:[4,V(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(k=l.branding.colors,x.colors=n(n({},x.colors),k),localStorage.setItem(f,JSON.stringify(x.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(x.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(x.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(x.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(x.resetSessionAfterSecs=l.resetSessionAfterSecs),Q(),B(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:C,removeItem:!0}),c?N({path:c}):x.widgetButton&&z(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},e.isPrivacyMode=function(){return x.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return x.youngPlayer},e.openAssistant=O,e.openResource=function(e,n){var t="/resources/".concat(e);M({path:t,config:n}),N({path:t,config:n})},e.openSupport=_,e.recordRetention=function(){x.isRetentionRecordedForSession||Z()},e.removeAllFields=function(){x.fields={},B()},e.removeAllTags=function(){x.tags.clear(),B()},e.removeEventListener=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},e.removeField=function(e){delete x.fields[e],B()},e.removeFields=function(e){e.forEach((function(e){return delete x.fields[e]})),B()},e.removeTag=function(e){x.tags.delete(e),B()},e.removeTags=function(e){e.forEach((function(e){return x.tags.delete(e)})),B()},e.requestNotificationPermission=function(){},e.reset=function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,B(),oe({action:"widgetButtonTextUpdate",text:ie()})},e.setFields=function(e){x.fields=e,B()},e.setLanguage=function(e){var n=x.language!==e;x.language=e,n&&(B(),oe({action:"widgetButtonTextUpdate",text:ie()}))},e.setPlayer=function(e){var n,t=(null===(n=x.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);x.player=e,t&&(B(),te())},e.setPrivacyMode=function(e){x.privacyMode=e,B()},e.setSignedMetadataToken=function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,n&&(B(),te())},e.setTags=function(e){x.tags=new Set(e),B()},e.setYoungPlayer=function(e){x.youngPlayer=e,B()},e}({});
|
|
1
|
+
var theymes=function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach((function(e){return e.apply(void 0,n)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',p='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',g=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return g(o,n[t])})))},f=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,m=/CrOS/,h=/android|ipad|playbook|silk/i;var y="colors",v="1.2.2",b="web",w={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},k=340,T=680,E=500,S=120,x=48,C=.2,_=.2,O=.2,A="theymes_path_on_init",L={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(y);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},I=function(e){var n="/help-center";U({path:n,config:e}),F({path:n,config:e})},R=function(e){var n="/assistant";U({path:n,config:e}),F({path:n,config:e})},P=function(){!function(){var e=document.querySelector(w.sdkDialog),n=document.querySelector(w.sdkIframeWrapper);if(e){var t=function(){"widget"!==L.mode||L.forceUpdateSdkDialog?e.remove():e.style.display="none",L.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=$({animation:"start"}),setTimeout((function(){t()}),1e3*C)):t()}L.widgetButton&&X();l("close",[])}(),z()},D=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function N(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!L.token||!L.domain||!L.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:L.language)&&void 0!==a?a:null,g=null!==(s=L.signedMetadataToken)&&void 0!==s?s:null,f=null!==(l=L.player)&&void 0!==l?l:null,m={_platform:b,_sdkVersion:v};L.youngPlayer&&(m._youngPlayer=!0),(L.privacyMode||L.youngPlayer)&&(m._privacyMode=!0);var h=i(i([],Array.from(L.tags),!0),d,!0),y=n(n(n({},L.fields),u),m);return{token:L.token,domain:L.domain,deviceId:L.deviceId,tags:h,fields:y,language:p,signedMetadataToken:g,player:f}}function M(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function B(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",b).replace("'INSET_TOP_PLACEHOLDER'","".concat(L.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(L.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(L.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(L.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",M(L.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",M(L.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",M(L.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",M(L.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",M(L.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",M(L.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",M(L.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===L.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=L.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=L.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",L.nonce?'nonce="'.concat(L.nonce,'"'):"")}function H(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function F(e){var n,t,o,i=N({config:e.config});if(i){var r=null!==(n=document.querySelector(w.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=w.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(w.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=w.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(M(L.colors.background),")"),a.style.transform=$({animation:"start"}),a.style.transition=(L.mode,"opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out")),"widget"===L.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(w.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=w.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(w.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=w.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!L.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(L.domain,"/sdk"),i=new URLSearchParams;i.set("platform",b),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",L.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=j({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),H({iframe:s,content:B({template:c})});var f=!1,m=function(){f||(f=!0,L.networkErrorTimerId=setTimeout((function(){H({iframe:s,content:B({template:d})})}),1e4))};p.onload=m,p.onerror=function(){H({iframe:s,content:B({template:d})})},q(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=$({animation:"end"})}),100)}}function U(e){var n=e.path,t=e.config,o=null!=t?t:null;L.previousPath===n&&g(L.previousConfig,o)||(L.previousPath=n,L.previousConfig=o,W())}function W(){var e=document.querySelector(w.sdkDialog);L.sdkIsOpen?L.forceUpdateSdkDialog=!0:null==e||e.remove()}function j(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function q(){var e=document.querySelector(w.sdkDialog),n=document.querySelector(w.sdkIframeWrapper);if(e&&n)if("widget"===L.mode){var t=Z({type:"widget"}),o=Q();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,V()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(M(L.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",L.element){var i=L.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}function G(e){var n=1e3*e;L.eventsNextPollAt=new Date(Date.now()+n),L.eventsPollerTimerId=setTimeout(z,n)}function z(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u;return o(this,(function(o){switch(o.label){case 0:if(ie(),!L.token||!L.domain||!L.deviceId)return G(60),[2];e=L.notificationsPaused||L.sdkIsOpen?"true":"false",t="https://".concat(L.domain,"/api/sdk/events"),r=new URLSearchParams(n(n({token:L.token,language:null!==(d=L.language)&&void 0!==d?d:"en",deviceId:L.deviceId,notificationsPaused:e,mode:L.mode},(null===(u=L.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:L.player.id}:{}),L.signedMetadataToken?{signedMetadataToken:L.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=o.sent()).ok?[3,4]:[4,ee(a)];case 3:throw o.sent();case 4:return[4,a.json()];case 5:return s=o.sent(),L.notifications=i(i([],L.notifications,!0),s.notifications,!0),s.notifications.length>0&&Y(),s.unansweredMessageCount!==L.unansweredMessageCount&&(L.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==L.unreadMessageCount&&(L.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),se({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),G(s.nextPollSeconds),[3,7];case 6:return c=o.sent(),console.error("Error initializing SDK:",c),G(60),[3,7];case 7:return[2]}}))}))}function Y(){var e,n,t=L.notifications[0];if(t&&!L.visibleNotification){L.visibleNotification=t;var o=null!==(e=document.querySelector(w.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=w.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(w.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=w.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(O,"s ease-in-out, margin-top ").concat(O,"s ease-in-out"),o.appendChild(r),H({iframe:r,content:(i={text:t.text},B({template:u}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),J(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){K({notification:t})}),1e3*t.closeAfterSeconds)}}function J(){var e,n,t,o=document.querySelector(w.notificationDialog),i=document.querySelector(w.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===L.mode){var a=Z({type:"widget"}),s=Q(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.maxWidth=s.maxWidth,o.style.maxHeight=s.maxHeight,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(L.element){var c=L.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function K(e){if(e.notification&&L.visibleNotification===e.notification){var n=document.querySelector(w.notificationIframe),t=document.querySelector(w.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),L.notifications=L.notifications.slice(1),L.visibleNotification=null,Y()}),1e3*O))}}function X(){var e,n=null!==(e=document.querySelector(w.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Z({type:"button"});n.id=w.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(S,"px"),n.style.height="".concat(x,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(_,"s ease-in-out, transform ").concat(_,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),H({iframe:n,content:(t={unreadMessageCount:L.unreadMessageCount},B({template:p}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",M(L.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",M(L.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",M(L.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",le()))})}}function V(){return!!function(e){e||(e={});var n=e.ua;if(n||"undefined"==typeof navigator||(n=navigator.userAgent),n&&n.headers&&"string"==typeof n.headers["user-agent"]&&(n=n.headers["user-agent"]),"string"!=typeof n)return!1;var t=f.test(n)&&!m.test(n)||!!e.tablet&&h.test(n);return!t&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==n.indexOf("Macintosh")&&-1!==n.indexOf("Safari")&&(t=!0),t}({tablet:!0})&&(window.innerWidth<E||window.innerHeight<E)}function Z(e){var n=e.type,t=L.position,o=L.x,i=L.y;return V()&&"widget"===n?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Q(){return V()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(k,"px"),height:"".concat(T,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*L.y,"px)")}}function $(e){return"start"===e.animation?"game"===L.mode?"translateY(20%)":"scale(0.8)":"game"===L.mode?"translateY(0)":"scale(1)"}function ee(e){return t(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function ne(){return t(this,void 0,void 0,(function(){var e,n,t,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(re(),L.retryRecordRetentionTimerId&&(clearTimeout(L.retryRecordRetentionTimerId),L.retryRecordRetentionTimerId=null),L.retentionRemainingSeconds=null,L.isRetentionRecordedForSession=!0,!(e=N()))return[2];n="https://".concat(L.domain,"/api/sdk/retention"),t=j({supportViewConfig:e}),i={token:L.token,deviceId:L.deviceId,language:L.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,ee(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),L.retryRecordRetentionTimerId=setTimeout(ne,6e4),[3,6];case 6:return[2]}}))}))}function te(){var e=new Date;if(L.sessionStatus="active",L.sessionResumeOrStartTime=e,L.sessionStartTime){var n=L.sessionStartTime.valueOf()/1e3+L.resetSessionAfterSecs;Date.now()/1e3>n&&oe()}else oe();if(null!==L.retentionRemainingSeconds&&(L.recordRetentionTimerId=setTimeout(ne,1e3*L.retentionRemainingSeconds)),!L.eventsPollerTimerId)if(L.eventsNextPollAt){var t=Math.floor((L.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?G(t):z()}else z()}function oe(){L.sessionStartTime=new Date,L.retentionRemainingSeconds=L.recordRetentionAfterSecs,L.isRetentionRecordedForSession=!1,re()}function ie(){L.eventsPollerTimerId&&(clearTimeout(L.eventsPollerTimerId),L.eventsPollerTimerId=null)}function re(){L.recordRetentionTimerId&&(clearTimeout(L.recordRetentionTimerId),L.recordRetentionTimerId=null)}function ae(){z(),L.isRetentionRecordedForSession&&ne()}function se(e){var n=document.querySelector(w.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function le(){var e,n,t;return null!==(t=null===(e=L.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=L.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function ce(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===L.sessionStatus?te():e||"active"!==L.sessionStatus||function(){if(L.sessionResumeOrStartTime&&L.retentionRemainingSeconds){var e=Math.floor((Date.now()-L.sessionResumeOrStartTime.valueOf())/1e3);L.retentionRemainingSeconds-=e}L.sessionStatus="paused",ie(),re()}()}return document.addEventListener("visibilitychange",ce),window.addEventListener("focus",ce),window.addEventListener("blur",ce),window.addEventListener("resize",q),window.addEventListener("resize",J),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(w.sdkLoaderIframe),t=document.querySelector(w.sdkIframe);L.networkErrorTimerId&&(clearTimeout(L.networkErrorTimerId),L.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)P();else if("theymes.closeNotification"===e.data.action)K({notification:L.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:L.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(F({path:a.action.path}),K({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(w.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*_)),"support"===L.widgetButtonAction?I():"assistant"===L.widgetButtonAction&&R();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:A,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),D("open",(function(){L.sdkIsOpen=!0})),D("close",(function(){L.sdkIsOpen=!1})),e.addEventListener=D,e.addField=function(e,n){L.fields[e]=n,W()},e.addFields=function(e){L.fields=n(n({},L.fields),e),W()},e.addTag=function(e){L.tags.add(e),W()},e.addTags=function(e){e.forEach((function(e){return L.tags.add(e)})),W()},e.close=P,e.disableLogging=function(){L.loggingEnabled=!1},e.disableNotifications=function(){L.notificationsPaused=!0},e.enableLogging=function(){L.loggingEnabled=!0},e.enableNotifications=function(){L.notificationsPaused=!1,z()},e.getFields=function(){return L.fields},e.getLanguage=function(){return L.language},e.getPlayer=function(){return L.player},e.getSdkVersion=function(){return v},e.getSignedMetadataToken=function(){return L.signedMetadataToken},e.getTags=function(){return Array.from(L.tags)},e.getUnansweredMessageCount=function(){return L.unansweredMessageCount},e.getUnreadMessageCount=function(){return L.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,p,g,f,m,h,v,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");L.token=e,L.domain=i,L.mode=r.mode,L.element="element"in r&&void 0!==r.element?r.element:L.element,L.language=null!==(u=r.language)&&void 0!==u?u:L.language,L.nonce=null!==(p=r.nonce)&&void 0!==p?p:L.nonce,L.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),L.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:L.widgetButton,L.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(f=r.buttonAction)&&void 0!==f?f:L.widgetButtonAction,L.position="position"in r&&void 0!==r.position&&null!==(m=r.position)&&void 0!==m?m:L.position,L.x="x"in r&&void 0!==r.x?r.x:L.x,L.y="y"in r&&void 0!==r.y?r.y:L.y,z(),t="https://".concat(i,"/api/sdk/initialize"),a={token:e,deviceId:L.deviceId,platform:b,mode:L.mode},o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=o.sent()).ok?[3,4]:[4,ee(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(h=null==l?void 0:l.branding)||void 0===h?void 0:h.colors)&&(k=l.branding.colors,L.colors=n(n({},L.colors),k),localStorage.setItem(y,JSON.stringify(L.colors))),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.locs)&&(L.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(L.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(L.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(L.resetSessionAfterSecs=l.resetSessionAfterSecs),te(),W(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:A,removeItem:!0}),c?F({path:c}):L.widgetButton&&X(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},e.isPrivacyMode=function(){return L.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return L.youngPlayer},e.openAssistant=R,e.openResource=function(e,n){var t="/resources/".concat(e);U({path:t,config:n}),F({path:t,config:n})},e.openSupport=I,e.recordRetention=function(){L.isRetentionRecordedForSession||ne()},e.removeAllFields=function(){L.fields={},W()},e.removeAllTags=function(){L.tags.clear(),W()},e.removeEventListener=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},e.removeField=function(e){delete L.fields[e],W()},e.removeFields=function(e){e.forEach((function(e){return delete L.fields[e]})),W()},e.removeTag=function(e){L.tags.delete(e),W()},e.removeTags=function(e){e.forEach((function(e){return L.tags.delete(e)})),W()},e.requestNotificationPermission=function(){},e.reset=function(){L.language=null,L.tags=new Set,L.fields={},L.signedMetadataToken=null,L.player=null,W(),se({action:"widgetButtonTextUpdate",text:le()})},e.setFields=function(e){L.fields=e,W()},e.setLanguage=function(e){var n=L.language!==e;L.language=e,n&&(W(),se({action:"widgetButtonTextUpdate",text:le()}))},e.setPlayer=function(e){var n,t=(null===(n=L.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);L.player=e,t&&(W(),ae())},e.setPrivacyMode=function(e){L.privacyMode=e,W()},e.setSignedMetadataToken=function(e){var n=L.signedMetadataToken!==e;L.signedMetadataToken=e,n&&(W(),ae())},e.setTags=function(e){L.tags=new Set(e),W()},e.setYoungPlayer=function(e){L.youngPlayer=e,W()},e}({});
|
package/dist/sdk.unity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},n.apply(this,arguments)};function t(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function o(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,n){r[e].add(n)}function s(e,n){r[e].delete(n)}function l(e,n){r[e].forEach((function(e){return e.apply(void 0,n)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',p='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',g=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return g(o,n[t])})))},f="colors",m="1.2.0",h="web",y={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},v=340,b=680,w=120,k=48,S=.2,T=.2,E=.2,C="theymes_path_on_init",x={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(f);if(e){var t=JSON.parse(e);return n(n({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},_=function(e){var n="/help-center";M({path:n,config:e}),N({path:n,config:e})},O=function(e){var n="/assistant";M({path:n,config:e}),N({path:n,config:e})},A=function(){!function(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.sdkIframeWrapper);if(e){var t=function(){"widget"!==x.mode||x.forceUpdateSdkDialog?e.remove():e.style.display="none",x.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=X({animation:"start"}),setTimeout((function(){t()}),1e3*S)):t()}x.widgetButton&&z();l("close",[])}(),q()},L=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function I(e){var t,o,r,a,s,l,c=(null!=e?e:{}).config;if(!x.token||!x.domain||!x.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,g=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,f=null!==(l=x.player)&&void 0!==l?l:null,y={_platform:h,_sdkVersion:m};x.youngPlayer&&(y._youngPlayer=!0),(x.privacyMode||x.youngPlayer)&&(y._privacyMode=!0);var v=i(i([],Array.from(x.tags),!0),d,!0),b=n(n(n({},x.fields),u),y);return{token:x.token,domain:x.domain,deviceId:x.deviceId,tags:v,fields:b,language:p,signedMetadataToken:g,player:f}}function R(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function P(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",h).replace("'INSET_TOP_PLACEHOLDER'","".concat(x.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(x.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(x.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(x.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",R(x.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",R(x.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",R(x.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",R(x.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",R(x.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",R(x.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",R(x.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===x.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=x.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=x.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",x.nonce?'nonce="'.concat(x.nonce,'"'):"")}function D(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function N(e){var n,t,o,i=I({config:e.config});if(i){!function(){if(!document.querySelector(y.sdkStylesheet)){var e=document.createElement("style");e.id=y.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(y.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(y.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(n=document.querySelector(y.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=y.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(y.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=y.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(R(x.colors.background),")"),a.style.transform=X({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(y.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=y.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(y.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=y.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!x.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(x.domain,"/sdk"),i=new URLSearchParams;i.set("platform",h),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=H({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),D({iframe:s,content:P({template:c})});var f=!1,m=function(){f||(f=!0,x.networkErrorTimerId=setTimeout((function(){D({iframe:s,content:P({template:d})})}),1e4))};p.onload=m,p.onerror=function(){D({iframe:s,content:P({template:d})})},F(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=X({animation:"end"})}),100)}}function M(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&g(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,B())}function B(){var e=document.querySelector(y.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function H(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function F(){var e=document.querySelector(y.sdkDialog),n=document.querySelector(y.sdkIframeWrapper);if(e&&n){if("widget"===x.mode){var t=J({type:"widget"}),o=K();e.style.width=o.width,e.style.height=o.height,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,Y()?(n.style.border="1px solid rgb(".concat(R(x.colors.border),")"),n.style.borderRadius="10px"):(n.style.border="none",n.style.borderRadius="0")}else if(n.style.border="none",n.style.borderRadius="0",x.element){var i=x.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(F)}}function U(e){var n=1e3*e;x.eventsNextPollAt=new Date(Date.now()+n),x.eventsPollerTimerId=setTimeout(q,n)}function q(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u;return o(this,(function(o){switch(o.label){case 0:if(ee(),!x.token||!x.domain||!x.deviceId)return U(60),[2];e=x.notificationsPaused||x.sdkIsOpen?"true":"false",t="https://".concat(x.domain,"/api/sdk/events"),r=new URLSearchParams(n(n({token:x.token,language:null!==(d=x.language)&&void 0!==d?d:"en",deviceId:x.deviceId,notificationsPaused:e,mode:x.mode},(null===(u=x.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=o.sent()).ok?[3,4]:[4,V(a)];case 3:throw o.sent();case 4:return[4,a.json()];case 5:return s=o.sent(),x.notifications=i(i([],x.notifications,!0),s.notifications,!0),s.notifications.length>0&&j(),s.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),oe({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),U(s.nextPollSeconds),[3,7];case 6:return c=o.sent(),console.error("Error initializing SDK:",c),U(60),[3,7];case 7:return[2]}}))}))}function j(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(y.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=y.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(y.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=y.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(E,"s ease-in-out, margin-top ").concat(E,"s ease-in-out"),o.appendChild(r),D({iframe:r,content:(i={text:t.text},P({template:u}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),G(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){W({notification:t})}),1e3*t.closeAfterSeconds)}}function G(){var e,n,t,o=document.querySelector(y.notificationDialog),i=document.querySelector(y.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===x.mode){var a=J({type:"widget"}),s=K(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(G)}}function W(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(y.notificationIframe),t=document.querySelector(y.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),x.notifications=x.notifications.slice(1),x.visibleNotification=null,j()}),1e3*E))}}function z(){var e,n=null!==(e=document.querySelector(y.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=J({type:"button"});n.id=y.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(w,"px"),n.style.height="".concat(k,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(T,"s ease-in-out, transform ").concat(T,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),D({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},P({template:p}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",R(x.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",R(x.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",R(x.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ie()))})}}function Y(){var e=x.y;return window.innerWidth>768&&window.innerHeight>b+e}function J(e){var n=e.type,t=x.position,o=x.x,i=x.y;return Y()||"widget"!==n?"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function K(){return Y()?{width:"".concat(v,"px"),height:"".concat(b,"px")}:{width:"100%",height:"100%"}}function X(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function V(e){return t(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function Z(){return t(this,void 0,void 0,(function(){var e,n,t,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(ne(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=I()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),t=H({supportViewConfig:e}),i={token:x.token,deviceId:x.deviceId,language:x.language,metadata:t},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,V(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),x.retryRecordRetentionTimerId=setTimeout(Z,6e4),[3,6];case 6:return[2]}}))}))}function Q(){var e=new Date;if(x.sessionStatus="active",x.sessionResumeOrStartTime=e,x.sessionStartTime){var n=x.sessionStartTime.valueOf()/1e3+x.resetSessionAfterSecs;Date.now()/1e3>n&&$()}else $();if(null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(Z,1e3*x.retentionRemainingSeconds)),!x.eventsPollerTimerId)if(x.eventsNextPollAt){var t=Math.floor((x.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?U(t):q()}else q()}function $(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,ne()}function ee(){x.eventsPollerTimerId&&(clearTimeout(x.eventsPollerTimerId),x.eventsPollerTimerId=null)}function ne(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function te(){q(),x.isRetentionRecordedForSession&&Z()}function oe(e){var n=document.querySelector(y.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function ie(){var e,n,t;return null!==(t=null===(e=x.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=x.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function re(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===x.sessionStatus?Q():e||"active"!==x.sessionStatus||function(){if(x.sessionResumeOrStartTime&&x.retentionRemainingSeconds){var e=Math.floor((Date.now()-x.sessionResumeOrStartTime.valueOf())/1e3);x.retentionRemainingSeconds-=e}x.sessionStatus="paused",ee(),ne()}()}document.addEventListener("visibilitychange",re),window.addEventListener("focus",re),window.addEventListener("blur",re),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(y.sdkLoaderIframe),t=document.querySelector(y.sdkIframe);x.networkErrorTimerId&&(clearTimeout(x.networkErrorTimerId),x.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)A();else if("theymes.closeNotification"===e.data.action)W({notification:x.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:x.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(N({path:a.action.path}),W({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(y.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*T)),"support"===x.widgetButtonAction?_():"assistant"===x.widgetButtonAction&&O();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:C,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),L("open",(function(){x.sdkIsOpen=!0})),L("close",(function(){x.sdkIsOpen=!1})),e.addEventListener=L,e.addField=function(e,n){x.fields[e]=n,B()},e.addFields=function(e){x.fields=n(n({},x.fields),e),B()},e.addTag=function(e){x.tags.add(e),B()},e.addTags=function(e){e.forEach((function(e){return x.tags.add(e)})),B()},e.close=A,e.disableLogging=function(){x.loggingEnabled=!1},e.disableNotifications=function(){x.notificationsPaused=!0},e.enableLogging=function(){x.loggingEnabled=!0},e.enableNotifications=function(){x.notificationsPaused=!1,q()},e.getFields=function(){return x.fields},e.getLanguage=function(){return x.language},e.getPlayer=function(){return x.player},e.getSdkVersion=function(){return m},e.getSignedMetadataToken=function(){return x.signedMetadataToken},e.getTags=function(){return Array.from(x.tags)},e.getUnansweredMessageCount=function(){return x.unansweredMessageCount},e.getUnreadMessageCount=function(){return x.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,p,g,m,y,v,b,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");x.token=e,x.domain=i,x.mode=r.mode,x.element="element"in r&&void 0!==r.element?r.element:x.element,x.language=null!==(u=r.language)&&void 0!==u?u:x.language,x.nonce=null!==(p=r.nonce)&&void 0!==p?p:x.nonce,x.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),x.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(m=r.buttonAction)&&void 0!==m?m:x.widgetButtonAction,x.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:x.position,x.x="x"in r&&void 0!==r.x?r.x:x.x,x.y="y"in r&&void 0!==r.y?r.y:x.y,q(),t="https://".concat(i,"/api/sdk/initialize"),a={token:e,deviceId:x.deviceId,platform:h,mode:x.mode},o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=o.sent()).ok?[3,4]:[4,V(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(k=l.branding.colors,x.colors=n(n({},x.colors),k),localStorage.setItem(f,JSON.stringify(x.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(x.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(x.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(x.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(x.resetSessionAfterSecs=l.resetSessionAfterSecs),Q(),B(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:C,removeItem:!0}),c?N({path:c}):x.widgetButton&&z(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},e.isPrivacyMode=function(){return x.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return x.youngPlayer},e.openAssistant=O,e.openResource=function(e,n){var t="/resources/".concat(e);M({path:t,config:n}),N({path:t,config:n})},e.openSupport=_,e.recordRetention=function(){x.isRetentionRecordedForSession||Z()},e.removeAllFields=function(){x.fields={},B()},e.removeAllTags=function(){x.tags.clear(),B()},e.removeEventListener=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];s.apply(void 0,e)},e.removeField=function(e){delete x.fields[e],B()},e.removeFields=function(e){e.forEach((function(e){return delete x.fields[e]})),B()},e.removeTag=function(e){x.tags.delete(e),B()},e.removeTags=function(e){e.forEach((function(e){return x.tags.delete(e)})),B()},e.requestNotificationPermission=function(){},e.reset=function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,B(),oe({action:"widgetButtonTextUpdate",text:ie()})},e.setFields=function(e){x.fields=e,B()},e.setLanguage=function(e){var n=x.language!==e;x.language=e,n&&(B(),oe({action:"widgetButtonTextUpdate",text:ie()}))},e.setPlayer=function(e){var n,t=(null===(n=x.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);x.player=e,t&&(B(),te())},e.setPrivacyMode=function(e){x.privacyMode=e,B()},e.setSignedMetadataToken=function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,n&&(B(),te())},e.setTags=function(e){x.tags=new Set(e),B()},e.setYoungPlayer=function(e){x.youngPlayer=e,B()}}(this.theymes=this.theymes||{});
|
|
1
|
+
!function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,o){return new(n||(n=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}function o(e,t){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function a(e,t){r[e].add(t)}function s(e,t){r[e].delete(t)}function l(e,t){r[e].forEach((function(e){return e.apply(void 0,t)}))}var c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeTheymesSdk);\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script NONCE_ATTR_PLACEHOLDER>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n\n document.querySelector(\'.notification-text\').addEventListener(\'click\', notificationClicked);\n document.querySelector(\'.close-button\').addEventListener(\'click\', closeNotification);\n <\/script>\n</body>\n\n</html>',p='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </button>\n <script NONCE_ATTR_PLACEHOLDER>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n document.querySelector(\'.sdk-button\').addEventListener(\'click\', openWidget);\n window.addEventListener(\'message\', iframeSubscriber, false);\n\n updateUnreadMessageCount();\n <\/script>\n</body>\n\n</html>',g=function(e,t){return e===t||Boolean(e&&t&&"object"==typeof e&&"object"==typeof t&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every((function(e){var n=e[0],o=e[1];return g(o,t[n])})))},f=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|redmi|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,m=/CrOS/,h=/android|ipad|playbook|silk/i;var y="colors",v="1.2.2",b="web",w={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},k=340,T=680,E=500,S=120,x=48,C=.2,_=.2,O=.2,A="theymes_path_on_init",L={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(y);if(e){var n=JSON.parse(e);return t(t({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),n)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null,nonce:null},I=function(e){var t="/help-center";U({path:t,config:e}),F({path:t,config:e})},R=function(e){var t="/assistant";U({path:t,config:e}),F({path:t,config:e})},P=function(){!function(){var e=document.querySelector(w.sdkDialog),t=document.querySelector(w.sdkIframeWrapper);if(e){var n=function(){"widget"!==L.mode||L.forceUpdateSdkDialog?e.remove():e.style.display="none",L.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=$({animation:"start"}),setTimeout((function(){n()}),1e3*C)):n()}L.widgetButton&&X();l("close",[])}(),z()},D=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a.apply(void 0,e)};function N(e){var n,o,r,a,s,l,c=(null!=e?e:{}).config;if(!L.token||!L.domain||!L.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],u=null!==(o=null==c?void 0:c.fields)&&void 0!==o?o:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:L.language)&&void 0!==a?a:null,g=null!==(s=L.signedMetadataToken)&&void 0!==s?s:null,f=null!==(l=L.player)&&void 0!==l?l:null,m={_platform:b,_sdkVersion:v};L.youngPlayer&&(m._youngPlayer=!0),(L.privacyMode||L.youngPlayer)&&(m._privacyMode=!0);var h=i(i([],Array.from(L.tags),!0),d,!0),y=t(t(t({},L.fields),u),m);return{token:L.token,domain:L.domain,deviceId:L.deviceId,tags:h,fields:y,language:p,signedMetadataToken:g,player:f}}function M(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function B(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",b).replace("'INSET_TOP_PLACEHOLDER'","".concat(L.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(L.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(L.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(L.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",M(L.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",M(L.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",M(L.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",M(L.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",M(L.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",M(L.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",M(L.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===L.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=L.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=L.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",L.nonce?'nonce="'.concat(L.nonce,'"'):"")}function H(e){var t,n=e.iframe,o=e.content,i=null===(t=n.contentWindow)||void 0===t?void 0:t.document;i&&(i.open(),i.write(o),i.close())}function F(e){var t,n,o,i=N({config:e.config});if(i){var r=null!==(t=document.querySelector(w.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=w.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(n=r.querySelector(w.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");a.id=w.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(M(L.colors.background),")"),a.style.transform=$({animation:"start"}),a.style.transition=(L.mode,"opacity ".concat(C,"s ease-in-out, transform ").concat(C,"s ease-in-out")),"widget"===L.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(w.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=w.sdkLoaderIframe.replace("#",""),s.style.position="absolute",s.style.border="none",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.colorScheme="auto";var u=a.querySelector(w.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),m())}),500);p.id=w.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!L.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(L.domain,"/sdk"),i=new URLSearchParams;i.set("platform",b),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",L.mode),i.set("origin",window.location.origin),n.language&&i.set("language",n.language);var r=j({supportViewConfig:n});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(t,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(p),document.body.appendChild(r)),H({iframe:s,content:B({template:c})});var f=!1,m=function(){f||(f=!0,L.networkErrorTimerId=setTimeout((function(){H({iframe:s,content:B({template:d})})}),1e4))};p.onload=m,p.onerror=function(){H({iframe:s,content:B({template:d})})},q(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=$({animation:"end"})}),100)}}function U(e){var t=e.path,n=e.config,o=null!=n?n:null;L.previousPath===t&&g(L.previousConfig,o)||(L.previousPath=t,L.previousConfig=o,W())}function W(){var e=document.querySelector(w.sdkDialog);L.sdkIsOpen?L.forceUpdateSdkDialog=!0:null==e||e.remove()}function j(e){var t=e.supportViewConfig,n={unsigned:{},signed:void 0};return t.player&&(n.unsigned.player=t.player),t.tags&&(n.unsigned.tags=t.tags),t.fields&&(n.unsigned.fields=t.fields),t.signedMetadataToken&&(n.signed=t.signedMetadataToken),n}function q(){var e=document.querySelector(w.sdkDialog),t=document.querySelector(w.sdkIframeWrapper);if(e&&t)if("widget"===L.mode){var n=Z({type:"widget"}),o=Q();e.style.width=o.width,e.style.height=o.height,e.style.maxWidth=o.maxWidth,e.style.maxHeight=o.maxHeight,e.style.bottom=n.bottom,e.style.right=n.right,e.style.left=n.left,e.style.top=n.top,V()?(t.style.border="none",t.style.borderRadius="0"):(t.style.border="1px solid rgb(".concat(M(L.colors.border),")"),t.style.borderRadius="10px")}else if(t.style.border="none",t.style.borderRadius="0",L.element){var i=L.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.maxWidth="none",e.style.maxHeight="none",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0"}function G(e){var t=1e3*e;L.eventsNextPollAt=new Date(Date.now()+t),L.eventsPollerTimerId=setTimeout(z,t)}function z(){return n(this,void 0,void 0,(function(){var e,n,r,a,s,c,d,u;return o(this,(function(o){switch(o.label){case 0:if(ie(),!L.token||!L.domain||!L.deviceId)return G(60),[2];e=L.notificationsPaused||L.sdkIsOpen?"true":"false",n="https://".concat(L.domain,"/api/sdk/events"),r=new URLSearchParams(t(t({token:L.token,language:null!==(d=L.language)&&void 0!==d?d:"en",deviceId:L.deviceId,notificationsPaused:e,mode:L.mode},(null===(u=L.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:L.player.id}:{}),L.signedMetadataToken?{signedMetadataToken:L.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(n,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=o.sent()).ok?[3,4]:[4,ee(a)];case 3:throw o.sent();case 4:return[4,a.json()];case 5:return s=o.sent(),L.notifications=i(i([],L.notifications,!0),s.notifications,!0),s.notifications.length>0&&Y(),s.unansweredMessageCount!==L.unansweredMessageCount&&(L.unansweredMessageCount=s.unansweredMessageCount,l("unansweredMessageCountUpdate",[s.unansweredMessageCount])),s.unreadMessageCount!==L.unreadMessageCount&&(L.unreadMessageCount=s.unreadMessageCount,l("unreadMessageCountUpdate",[s.unreadMessageCount]),se({action:"unreadMessageCountUpdate",count:s.unreadMessageCount})),G(s.nextPollSeconds),[3,7];case 6:return c=o.sent(),console.error("Error initializing SDK:",c),G(60),[3,7];case 7:return[2]}}))}))}function Y(){var e,t,n=L.notifications[0];if(n&&!L.visibleNotification){L.visibleNotification=n;var o=null!==(e=document.querySelector(w.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=w.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(t=o.querySelector(w.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=w.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(O,"s ease-in-out, margin-top ").concat(O,"s ease-in-out"),o.appendChild(r),H({iframe:r,content:(i={text:n.text},B({template:u}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),J(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),n.closeAfterSeconds>0&&setTimeout((function(){K({notification:n})}),1e3*n.closeAfterSeconds)}}function J(){var e,t,n,o=document.querySelector(w.notificationDialog),i=document.querySelector(w.notificationIframe);if(o&&i){var r=(null===(n=null===(t=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===n?void 0:n.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===L.mode){var a=Z({type:"widget"}),s=Q(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.maxWidth=s.maxWidth,o.style.maxHeight=s.maxHeight,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(L.element){var c=L.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.maxWidth="none",o.style.maxHeight="none",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function K(e){if(e.notification&&L.visibleNotification===e.notification){var t=document.querySelector(w.notificationIframe),n=document.querySelector(w.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),L.notifications=L.notifications.slice(1),L.visibleNotification=null,Y()}),1e3*O))}}function X(){var e,t=null!==(e=document.querySelector(w.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=Z({type:"button"});t.id=w.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(S,"px"),t.style.height="".concat(x,"px"),t.style.maxWidth="95%",t.style.maxHeight="95%",t.style.bottom=o.bottom,t.style.right=o.right,t.style.left=o.left,t.style.top=o.top,t.style.margin="0",t.style.padding="0",t.style.zIndex="9997",t.style.backgroundColor="transparent",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transition="opacity ".concat(_,"s ease-in-out, transform ").concat(_,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),H({iframe:t,content:(n={unreadMessageCount:L.unreadMessageCount},B({template:p}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",M(L.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",M(L.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",M(L.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",le()))})}}function V(){return!!function(e){e||(e={});var t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;var n=f.test(t)&&!m.test(t)||!!e.tablet&&h.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}({tablet:!0})&&(window.innerWidth<E||window.innerHeight<E)}function Z(e){var t=e.type,n=L.position,o=L.x,i=L.y;return V()&&"widget"===t?{top:"0",left:"0",right:"0",bottom:"0"}:"top-left"===n?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===n?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===n?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}}function Q(){return V()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(k,"px"),height:"".concat(T,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*L.y,"px)")}}function $(e){return"start"===e.animation?"game"===L.mode?"translateY(20%)":"scale(0.8)":"game"===L.mode?"translateY(0)":"scale(1)"}function ee(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function te(){return n(this,void 0,void 0,(function(){var e,t,n,i,r,a;return o(this,(function(o){switch(o.label){case 0:if(re(),L.retryRecordRetentionTimerId&&(clearTimeout(L.retryRecordRetentionTimerId),L.retryRecordRetentionTimerId=null),L.retentionRemainingSeconds=null,L.isRetentionRecordedForSession=!0,!(e=N()))return[2];t="https://".concat(L.domain,"/api/sdk/retention"),n=j({supportViewConfig:e}),i={token:L.token,deviceId:L.deviceId,language:L.language,metadata:n},o.label=1;case 1:return o.trys.push([1,5,,6]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=o.sent()).ok?[3,4]:[4,ee(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),L.retryRecordRetentionTimerId=setTimeout(te,6e4),[3,6];case 6:return[2]}}))}))}function ne(){var e=new Date;if(L.sessionStatus="active",L.sessionResumeOrStartTime=e,L.sessionStartTime){var t=L.sessionStartTime.valueOf()/1e3+L.resetSessionAfterSecs;Date.now()/1e3>t&&oe()}else oe();if(null!==L.retentionRemainingSeconds&&(L.recordRetentionTimerId=setTimeout(te,1e3*L.retentionRemainingSeconds)),!L.eventsPollerTimerId)if(L.eventsNextPollAt){var n=Math.floor((L.eventsNextPollAt.valueOf()-Date.now())/1e3);n>0?G(n):z()}else z()}function oe(){L.sessionStartTime=new Date,L.retentionRemainingSeconds=L.recordRetentionAfterSecs,L.isRetentionRecordedForSession=!1,re()}function ie(){L.eventsPollerTimerId&&(clearTimeout(L.eventsPollerTimerId),L.eventsPollerTimerId=null)}function re(){L.recordRetentionTimerId&&(clearTimeout(L.recordRetentionTimerId),L.recordRetentionTimerId=null)}function ae(){z(),L.isRetentionRecordedForSession&&te()}function se(e){var t=document.querySelector(w.sdkButtonIframe);if(t)var n=setInterval((function(){var o,i;"complete"===(null===(o=t.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(n),null===(i=null==t?void 0:t.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function le(){var e,t,n;return null!==(n=null===(e=L.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=L.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function ce(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===L.sessionStatus?ne():e||"active"!==L.sessionStatus||function(){if(L.sessionResumeOrStartTime&&L.retentionRemainingSeconds){var e=Math.floor((Date.now()-L.sessionResumeOrStartTime.valueOf())/1e3);L.retentionRemainingSeconds-=e}L.sessionStatus="paused",ie(),re()}()}document.addEventListener("visibilitychange",ce),window.addEventListener("focus",ce),window.addEventListener("blur",ce),window.addEventListener("resize",q),window.addEventListener("resize",J),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(w.sdkLoaderIframe),n=document.querySelector(w.sdkIframe);L.networkErrorTimerId&&(clearTimeout(L.networkErrorTimerId),L.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)P();else if("theymes.closeNotification"===e.data.action)K({notification:L.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:L.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(F({path:a.action.path}),K({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(w.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*_)),"support"===L.widgetButtonAction?I():"assistant"===L.widgetButtonAction&&R();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var t=e.key,n=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:n,expiry:Date.now()+o};r.setItem(t,JSON.stringify(a))}({key:A,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),D("open",(function(){L.sdkIsOpen=!0})),D("close",(function(){L.sdkIsOpen=!1})),e.addEventListener=D,e.addField=function(e,t){L.fields[e]=t,W()},e.addFields=function(e){L.fields=t(t({},L.fields),e),W()},e.addTag=function(e){L.tags.add(e),W()},e.addTags=function(e){e.forEach((function(e){return L.tags.add(e)})),W()},e.close=P,e.disableLogging=function(){L.loggingEnabled=!1},e.disableNotifications=function(){L.notificationsPaused=!0},e.enableLogging=function(){L.loggingEnabled=!0},e.enableNotifications=function(){L.notificationsPaused=!1,z()},e.getFields=function(){return L.fields},e.getLanguage=function(){return L.language},e.getPlayer=function(){return L.player},e.getSdkVersion=function(){return v},e.getSignedMetadataToken=function(){return L.signedMetadataToken},e.getTags=function(){return Array.from(L.tags)},e.getUnansweredMessageCount=function(){return L.unansweredMessageCount},e.getUnreadMessageCount=function(){return L.unreadMessageCount},e.initialize=function(e,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,p,g,f,m,h,v,w;return o(this,(function(o){switch(o.label){case 0:if(!e||!i||!r.mode)throw new Error("Token, domain, and mode are required");L.token=e,L.domain=i,L.mode=r.mode,L.element="element"in r&&void 0!==r.element?r.element:L.element,L.language=null!==(u=r.language)&&void 0!==u?u:L.language,L.nonce=null!==(p=r.nonce)&&void 0!==p?p:L.nonce,L.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),L.widgetButton="button"in r&&void 0!==r.button&&null!==(g=r.button)&&void 0!==g?g:L.widgetButton,L.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(f=r.buttonAction)&&void 0!==f?f:L.widgetButtonAction,L.position="position"in r&&void 0!==r.position&&null!==(m=r.position)&&void 0!==m?m:L.position,L.x="x"in r&&void 0!==r.x?r.x:L.x,L.y="y"in r&&void 0!==r.y?r.y:L.y,z(),n="https://".concat(i,"/api/sdk/initialize"),a={token:e,deviceId:L.deviceId,platform:b,mode:L.mode},o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=o.sent()).ok?[3,4]:[4,ee(s)];case 3:throw o.sent();case 4:return[4,s.json()];case 5:return l=o.sent(),(null===(h=null==l?void 0:l.branding)||void 0===h?void 0:h.colors)&&(k=l.branding.colors,L.colors=t(t({},L.colors),k),localStorage.setItem(y,JSON.stringify(L.colors))),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.locs)&&(L.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(L.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(L.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(L.resetSessionAfterSecs=l.resetSessionAfterSecs),ne(),W(),c=function(e){var t=e.key,n=e.storage,o=void 0===n?sessionStorage:n,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(t);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(t),null):(r&&o.removeItem(t),s.value)}({key:A,removeItem:!0}),c?F({path:c}):L.widgetButton&&X(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var k}))}))},e.isPrivacyMode=function(){return L.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return L.youngPlayer},e.openAssistant=R,e.openResource=function(e,t){var n="/resources/".concat(e);U({path:n,config:t}),F({path:n,config:t})},e.openSupport=I,e.recordRetention=function(){L.isRetentionRecordedForSession||te()},e.removeAllFields=function(){L.fields={},W()},e.removeAllTags=function(){L.tags.clear(),W()},e.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.apply(void 0,e)},e.removeField=function(e){delete L.fields[e],W()},e.removeFields=function(e){e.forEach((function(e){return delete L.fields[e]})),W()},e.removeTag=function(e){L.tags.delete(e),W()},e.removeTags=function(e){e.forEach((function(e){return L.tags.delete(e)})),W()},e.requestNotificationPermission=function(){},e.reset=function(){L.language=null,L.tags=new Set,L.fields={},L.signedMetadataToken=null,L.player=null,W(),se({action:"widgetButtonTextUpdate",text:le()})},e.setFields=function(e){L.fields=e,W()},e.setLanguage=function(e){var t=L.language!==e;L.language=e,t&&(W(),se({action:"widgetButtonTextUpdate",text:le()}))},e.setPlayer=function(e){var t,n=(null===(t=L.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);L.player=e,n&&(W(),ae())},e.setPrivacyMode=function(e){L.privacyMode=e,W()},e.setSignedMetadataToken=function(e){var t=L.signedMetadataToken!==e;L.signedMetadataToken=e,t&&(W(),ae())},e.setTags=function(e){L.tags=new Set(e),W()},e.setYoungPlayer=function(e){L.youngPlayer=e,W()}}(this.theymes=this.theymes||{});
|