@theymes/sdk 1.2.7 → 1.2.8

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.
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "1.2.7";
1
+ export declare const SDK_VERSION = "1.2.8";
2
2
  export declare const LOCAL_STORAGE_KEYS: {
3
3
  colors: string;
4
4
  };
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 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 n(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 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 a(e,t){i[e].delete(t)}function s(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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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>",u="1.2.7",p="colors",f="web",g={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"},m=340,h=680,y=500,v=120,b=48,w=.2,x=.2,E=.2,T="theymes_path_on_init",k="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",S={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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var C=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 C(o,t[n])})))};function O(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 L(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function I(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",f).replace("INSET_TOP_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace("INSET_BOTTOM_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace("INSET_LEFT_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace("INSET_RIGHT_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replaceAll("CSS_TEXT_PLACEHOLDER",L(S.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",L(S.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",L(S.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",L(S.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",L(S.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",L(S.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",L(S.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===S.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=S.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:k).replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=S.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",S.nonce?'nonce="'.concat(S.nonce,'"'):"")}var _='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',R=/(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,A=/CrOS/,P=/android|ipad|playbook|silk/i;function N(){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=R.test(t)&&!A.test(t)||!!e.tablet&&P.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<y||window.innerHeight<y)}function D(e){var t=e.type,n=S.position,o=S.x,i=S.y;return N()&&"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 B(){return N()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(m,"px"),height:"".concat(h,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*S.y,"px)")}}function M(e){var t=document.querySelector(g.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 H(){var e,t,n=S.notifications[0];if(n&&!S.visibleNotification){S.visibleNotification=n;var o=null!==(e=document.querySelector(g.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=g.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(g.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=g.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),O({iframe:r,content:(i={text:n.text},I({template:_}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",F()}),500),n.closeAfterSeconds>0&&setTimeout((function(){j({notification:n})}),1e3*n.closeAfterSeconds)}}function F(){var e,t,n,o=document.querySelector(g.notificationDialog),i=document.querySelector(g.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"===S.mode){var a=D({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(S.element){var c=S.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=S.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=S.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=S.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function j(e){if(e.notification&&S.visibleNotification===e.notification){var t=document.querySelector(g.notificationIframe),n=document.querySelector(g.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),S.notifications=S.notifications.slice(1),S.visibleNotification=null,H()}),1e3*E))}}var U=function(){function i(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(i.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){S.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(i.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var t=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(t.getTime()+1e3)),t>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-t.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(i.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(i.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return S.isLoggedIn&&S.isInForeground&&S.hasNetworkConnectivity&&!S.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(i.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(i.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(i.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){t.timer=null,t.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(i.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var t,i,r,a,l,c,d,u,p;return n(this,(function(n){switch(n.label){case 0:if(!S.token||!S.domain||!S.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(t=new Date(this.lastPollDate.getTime()+6e4),(i=(t.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(i),[2];this.lastPollDate=new Date,r=S.notificationsPaused||S.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:S.token,language:null!==(u=S.language)&&void 0!==u?u:"en",deviceId:S.deviceId,notificationsPaused:r,mode:S.mode},(null===(p=S.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:S.player.id}:{}),S.signedMetadataToken?{signedMetadataToken:S.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,fetch("https://".concat(S.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(l=n.sent()).ok)throw new Error("HTTP error! status: ".concat(l.status));return[4,l.json()];case 3:return c=n.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),S.notifications=o(o([],S.notifications,!0),c.notifications,!0),S.notifications.length>0&&H(),c.unansweredMessageCount!==S.unansweredMessageCount&&(S.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==S.unreadMessageCount&&(S.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),M({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=n.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(S.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),i}(),q={eventPoller:null},W=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogout()},Y=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onOpen()},z=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onClose()},J=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onEnableNotifications()},K=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onIsInForegroundChanged()},X=function(e){var t="/help-center";te({path:t,config:e}),ee({path:t,config:e})},V=function(e){var t="/assistant";te({path:t,config:e}),ee({path:t,config:e})},Z=function(){!function(){var e=document.querySelector(g.sdkDialog),t=document.querySelector(g.sdkIframeWrapper);if(e){var n=function(){"widget"!==S.mode||S.forceUpdateSdkDialog?e.remove():e.style.display="none",S.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=ae({animation:"start"}),setTimeout((function(){n()}),1e3*w)):n()}S.widgetButton&&re();s("close",[])}()},Q=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function $(t){var n,i,r,a,s,l,c=(null!=t?t:{}).config;if(!S.token||!S.domain||!S.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],p=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},g=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:S.language)&&void 0!==a?a:null,m=null!==(s=S.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=S.player)&&void 0!==l?l:null,y={_platform:f,_sdkVersion:u};S.youngPlayer&&(y._youngPlayer=!0),(S.privacyMode||S.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(S.tags),!0),d,!0),b=e(e(e({},S.fields),p),y);return{token:S.token,domain:S.domain,deviceId:S.deviceId,tags:v,fields:b,language:g,signedMetadataToken:m,player:h}}function ee(e){var t,n,o,i=$({config:e.config});if(i){var r=null!==(t=document.querySelector(g.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=g.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(g.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");a.id=g.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(L(S.colors.background),")"),a.style.transform=ae({animation:"start"}),a.style.transition=(S.mode,"opacity ".concat(w,"s ease-in-out, transform ").concat(w,"s ease-in-out")),"widget"===S.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(g.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=g.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(g.sdkIframe),p=null!=u?u:document.createElement("iframe"),m=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(m),y())}),500);p.id=g.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&&!S.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(S.domain,"/sdk"),i=new URLSearchParams;i.set("platform",f),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",S.mode),i.set("origin",window.location.origin),i.set("userLanguage",S.userLanguage),S.disableInsets&&i.set("disableInsets","true");n.language&&i.set("language",n.language);var r=oe({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(d),a.appendChild(p),document.body.appendChild(r)),O({iframe:d,content:I({template:l})});var h=!1,y=function(){h||(h=!0,S.networkErrorTimerId=setTimeout((function(){O({iframe:d,content:I({template:c})})}),1e4))};p.onload=y,p.onerror=function(){O({iframe:d,content:I({template:c})})},ie(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=ae({animation:"end"})}),100)}}function te(e){var t=e.path,n=e.config,o=null!=n?n:null;S.previousPath===t&&C(S.previousConfig,o)||(S.previousPath=t,S.previousConfig=o,ne())}function ne(){var e=document.querySelector(g.sdkDialog);S.sdkIsOpen?S.forceUpdateSdkDialog=!0:null==e||e.remove()}function oe(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 ie(){var e=document.querySelector(g.sdkDialog),t=document.querySelector(g.sdkIframeWrapper);if(e&&t)if("widget"===S.mode){var n=D({type:"widget"}),o=B();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,N()?(t.style.border="none",t.style.borderRadius="0"):(t.style.border="1px solid rgb(".concat(L(S.colors.border),")"),t.style.borderRadius="10px")}else if(t.style.border="none",t.style.borderRadius="0",S.element){var i=S.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{a=S.keyboardHeight>0?"calc(100% - ".concat(S.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 re(){var e,t=null!==(e=document.querySelector(g.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=D({type:"button"});t.id=g.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(v,"px"),t.style.height="".concat(b,"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(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),O({iframe:t,content:(n={unreadMessageCount:S.unreadMessageCount},I({template:d}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",L(S.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",L(S.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",L(S.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",fe()))})}}function ae(e){return"start"===e.animation?"game"===S.mode?"translateY(20%)":"scale(0.8)":"game"===S.mode?"translateY(0)":"scale(1)"}function se(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 le(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,a;return n(this,(function(n){switch(n.label){case 0:if(ue(),S.retryRecordRetentionTimerId&&(clearTimeout(S.retryRecordRetentionTimerId),S.retryRecordRetentionTimerId=null),S.retentionRemainingSeconds=null,S.isRetentionRecordedForSession=!0,!(e=$()))return[2];t="https://".concat(S.domain,"/api/sdk/retention"),o=oe({supportViewConfig:e}),i={token:S.token,deviceId:S.deviceId,language:S.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,se(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return a=n.sent(),console.error("Error tracking retention:",a),S.retryRecordRetentionTimerId=setTimeout(le,6e4),[3,6];case 6:return[2]}}))}))}function ce(){var e=new Date;if(S.sessionStatus="active",S.sessionResumeOrStartTime=e,S.sessionStartTime){var t=S.sessionStartTime.valueOf()/1e3+S.resetSessionAfterSecs;Date.now()/1e3>t&&de()}else de();null!==S.retentionRemainingSeconds&&(S.recordRetentionTimerId=setTimeout(le,1e3*S.retentionRemainingSeconds))}function de(){S.sessionStartTime=new Date,S.retentionRemainingSeconds=S.recordRetentionAfterSecs,S.isRetentionRecordedForSession=!1,ue()}function ue(){S.recordRetentionTimerId&&(clearTimeout(S.recordRetentionTimerId),S.recordRetentionTimerId=null)}function pe(){S.isRetentionRecordedForSession&&le()}function fe(){var e,t,n;return null!==(n=null===(e=S.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=S.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function ge(){var e=S.isInForeground,t="visible"===document.visibilityState&&document.hasFocus();S.isInForeground=t,e!==t&&K(),t&&"paused"===S.sessionStatus?ce():t||"active"!==S.sessionStatus||function(){if(S.sessionResumeOrStartTime&&S.retentionRemainingSeconds){var e=Math.floor((Date.now()-S.sessionResumeOrStartTime.valueOf())/1e3);S.retentionRemainingSeconds-=e}S.sessionStatus="paused",ue()}()}function me(){var e,t=S.isLoggedIn,n=Boolean(S.signedMetadataToken||(null===(e=S.player)||void 0===e?void 0:e.id));S.isLoggedIn=n,n&&!t?W():!n&&t&&G()}document.addEventListener("visibilitychange",ge),window.addEventListener("focus",ge),window.addEventListener("blur",ge),window.addEventListener("resize",ie),window.addEventListener("resize",F),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(g.sdkLoaderIframe),n=document.querySelector(g.sdkIframe);S.networkErrorTimerId&&(clearTimeout(S.networkErrorTimerId),S.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)Z();else if("theymes.closeNotification"===e.data.action)j({notification:S.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:S.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ee({path:a.action.path}),j({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(g.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),"support"===S.widgetButtonAction?X():"assistant"===S.widgetButtonAction&&V();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:T,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),Q("open",(function(){S.sdkIsOpen=!0,Y()})),Q("close",(function(){S.sdkIsOpen=!1,z()})),exports.addEventListener=Q,exports.addField=function(e,t){S.fields[e]=t,ne()},exports.addFields=function(t){S.fields=e(e({},S.fields),t),ne()},exports.addTag=function(e){S.tags.add(e),ne()},exports.addTags=function(e){e.forEach((function(e){return S.tags.add(e)})),ne()},exports.close=Z,exports.disableLogging=function(){S.loggingEnabled=!1},exports.disableNotifications=function(){S.notificationsPaused=!0},exports.enableLogging=function(){S.loggingEnabled=!0},exports.enableNotifications=function(){S.notificationsPaused=!1,J()},exports.getFields=function(){return S.fields},exports.getLanguage=function(){return S.language},exports.getPlayer=function(){return S.player},exports.getSdkVersion=function(){return u},exports.getSignedMetadataToken=function(){return S.signedMetadataToken},exports.getTags=function(){return Array.from(S.tags)},exports.getUnansweredMessageCount=function(){return S.unansweredMessageCount},exports.getUnreadMessageCount=function(){return S.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,g,m,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");S.token=o,S.domain=i,S.mode=r.mode,S.element="element"in r&&void 0!==r.element?r.element:S.element,S.language=null!==(u=r.language)&&void 0!==u?u:S.language,S.nonce=null!==(g=r.nonce)&&void 0!==g?g:S.nonce,S.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),S.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m:S.widgetButton,S.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:S.widgetButtonAction,S.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:S.position,S.x="x"in r&&void 0!==r.x?r.x:S.x,S.y="y"in r&&void 0!==r.y?r.y:S.y,S.disableInsets="game"===S.mode&&null!==S.element,q.eventPoller||(q.eventPoller=new U),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:S.token,platform:f,mode:S.mode}).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=n.sent()).ok?[3,4]:[4,se(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(x=l.branding.colors,S.colors=e(e({},S.colors),x),localStorage.setItem(p,JSON.stringify(S.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(S.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(S.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(S.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(S.resetSessionAfterSecs=l.resetSessionAfterSecs),ce(),ne(),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:T,removeItem:!0}),c?ee({path:c}):S.widgetButton&&re(),[3,7];case 6:return d=n.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var x}))}))},exports.iosSetKeyboardHeight=function(e){S.keyboardHeight=e,ie()},exports.isPrivacyMode=function(){return S.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return S.youngPlayer},exports.openAssistant=V,exports.openResource=function(e,t){var n="/resources/".concat(e);te({path:n,config:t}),ee({path:n,config:t})},exports.openSupport=X,exports.recordRetention=function(){S.isRetentionRecordedForSession||le()},exports.removeAllFields=function(){S.fields={},ne()},exports.removeAllTags=function(){S.tags.clear(),ne()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a.apply(void 0,e)},exports.removeField=function(e){delete S.fields[e],ne()},exports.removeFields=function(e){e.forEach((function(e){return delete S.fields[e]})),ne()},exports.removeTag=function(e){S.tags.delete(e),ne()},exports.removeTags=function(e){e.forEach((function(e){return S.tags.delete(e)})),ne()},exports.requestNotificationPermission=function(){},exports.reset=function(){S.language=null,S.tags=new Set,S.fields={},S.signedMetadataToken=null,S.player=null,me(),ne(),M({action:"widgetButtonTextUpdate",text:fe()})},exports.setFields=function(e){S.fields=e,ne()},exports.setLanguage=function(e){var t=S.language!==e;S.language=e,t&&(ne(),M({action:"widgetButtonTextUpdate",text:fe()}))},exports.setPlayer=function(e){var t,n=(null===(t=S.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);S.player=e,me(),n&&(ne(),pe())},exports.setPrivacyMode=function(e){S.privacyMode=e,ne()},exports.setSignedMetadataToken=function(e){var t=S.signedMetadataToken!==e;S.signedMetadataToken=e,me(),t&&(ne(),pe())},exports.setTags=function(e){S.tags=new Set(e),ne()},exports.setYoungPlayer=function(e){S.youngPlayer=e,ne()};
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 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 n(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 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 a(e,t){i[e].delete(t)}function s(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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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>",u="1.2.8",p="colors",g="web",f={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"},m=340,h=680,y=500,v=120,b=48,w=.2,x=.2,E=.2,T="theymes_path_on_init",k="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",S={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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var C=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 C(o,t[n])})))};function O(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 L(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function I(e){var t,n,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,g).replace(/INSET_TOP_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,L(S.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,L(S.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,L(S.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,L(S.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,L(S.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,L(S.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,L(S.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===S.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(n=null===(t=S.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:k).replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=S.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,S.nonce?'nonce="'.concat(S.nonce,'"'):"")}var _='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',R=/(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,P=/CrOS/,A=/android|ipad|playbook|silk/i;function N(){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=R.test(t)&&!P.test(t)||!!e.tablet&&A.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<y||window.innerHeight<y)}function D(e){var t=e.type,n=S.position,o=S.x,i=S.y;return N()&&"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 M(){return N()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(m,"px"),height:"".concat(h,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*S.y,"px)")}}function B(e){var t=document.querySelector(f.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 H(){var e,t,n=S.notifications[0];if(n&&!S.visibleNotification){S.visibleNotification=n;var o=null!==(e=document.querySelector(f.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=f.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(f.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=f.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),O({iframe:r,content:(i={text:n.text},I({template:_}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",F()}),500),n.closeAfterSeconds>0&&setTimeout((function(){j({notification:n})}),1e3*n.closeAfterSeconds)}}function F(){var e,t,n,o=document.querySelector(f.notificationDialog),i=document.querySelector(f.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"===S.mode){var a=D({type:"widget"}),s=M(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(S.element){var c=S.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=S.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=S.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=S.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function j(e){if(e.notification&&S.visibleNotification===e.notification){var t=document.querySelector(f.notificationIframe),n=document.querySelector(f.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),S.notifications=S.notifications.slice(1),S.visibleNotification=null,H()}),1e3*E))}}var U=function(){function i(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(i.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){S.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(i.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var t=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(t.getTime()+1e3)),t>=this.nextPollDate)this.pollEventsRequest();else{var n=(this.nextPollDate.getTime()-t.getTime())/1e3;this.scheduleNextPollEventsRequest(n)}}}),Object.defineProperty(i.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(i.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return S.isLoggedIn&&S.isInForeground&&S.hasNetworkConnectivity&&!S.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(i.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(i.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(i.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){t.timer=null,t.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(i.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var t,i,r,a,l,c,d,u,p;return n(this,(function(n){switch(n.label){case 0:if(!S.token||!S.domain||!S.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(t=new Date(this.lastPollDate.getTime()+6e4),(i=(t.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(i),[2];this.lastPollDate=new Date,r=S.notificationsPaused||S.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:S.token,language:null!==(u=S.language)&&void 0!==u?u:"en",deviceId:S.deviceId,notificationsPaused:r,mode:S.mode},(null===(p=S.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:S.player.id}:{}),S.signedMetadataToken?{signedMetadataToken:S.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,fetch("https://".concat(S.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(l=n.sent()).ok)throw new Error("HTTP error! status: ".concat(l.status));return[4,l.json()];case 3:return c=n.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),S.notifications=o(o([],S.notifications,!0),c.notifications,!0),S.notifications.length>0&&H(),c.unansweredMessageCount!==S.unansweredMessageCount&&(S.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==S.unreadMessageCount&&(S.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),B({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=n.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(S.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),i}(),q={eventPoller:null},W=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogout()},Y=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onOpen()},z=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onClose()},J=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onEnableNotifications()},K=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onIsInForegroundChanged()},X=function(e){var t="/help-center";te({path:t,config:e}),ee({path:t,config:e})},V=function(e){var t="/assistant";te({path:t,config:e}),ee({path:t,config:e})},Z=function(){!function(){var e=document.querySelector(f.sdkDialog),t=document.querySelector(f.sdkIframeWrapper);if(e){var n=function(){"widget"!==S.mode||S.forceUpdateSdkDialog?e.remove():e.style.display="none",S.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=ae({animation:"start"}),setTimeout((function(){n()}),1e3*w)):n()}S.widgetButton&&re();s("close",[])}()},Q=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function $(t){var n,i,r,a,s,l,c=(null!=t?t:{}).config;if(!S.token||!S.domain||!S.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],p=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:S.language)&&void 0!==a?a:null,m=null!==(s=S.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=S.player)&&void 0!==l?l:null,y={_platform:g,_sdkVersion:u};S.youngPlayer&&(y._youngPlayer=!0),(S.privacyMode||S.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(S.tags),!0),d,!0),b=e(e(e({},S.fields),p),y);return{token:S.token,domain:S.domain,deviceId:S.deviceId,tags:v,fields:b,language:f,signedMetadataToken:m,player:h}}function ee(e){var t,n,o,i=$({config:e.config});if(i){var r=null!==(t=document.querySelector(f.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=f.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(f.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");a.id=f.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(L(S.colors.background),")"),a.style.transform=ae({animation:"start"}),a.style.transition=(S.mode,"opacity ".concat(w,"s ease-in-out, transform ").concat(w,"s ease-in-out")),"widget"===S.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(f.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=f.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(f.sdkIframe),p=null!=u?u:document.createElement("iframe"),m=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(m),y())}),500);p.id=f.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&&!S.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(S.domain,"/sdk"),i=new URLSearchParams;i.set("platform",g),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",S.mode),i.set("origin",window.location.origin),i.set("userLanguage",S.userLanguage),S.disableInsets&&i.set("disableInsets","true");n.language&&i.set("language",n.language);var r=oe({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(d),a.appendChild(p),document.body.appendChild(r)),O({iframe:d,content:I({template:l})});var h=!1,y=function(){h||(h=!0,S.networkErrorTimerId=setTimeout((function(){O({iframe:d,content:I({template:c})})}),1e4))};p.onload=y,p.onerror=function(){O({iframe:d,content:I({template:c})})},ie(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=ae({animation:"end"})}),100)}}function te(e){var t=e.path,n=e.config,o=null!=n?n:null;S.previousPath===t&&C(S.previousConfig,o)||(S.previousPath=t,S.previousConfig=o,ne())}function ne(){var e=document.querySelector(f.sdkDialog);S.sdkIsOpen?S.forceUpdateSdkDialog=!0:null==e||e.remove()}function oe(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 ie(){var e=document.querySelector(f.sdkDialog),t=document.querySelector(f.sdkIframeWrapper);if(e&&t)if("widget"===S.mode){var n=D({type:"widget"}),o=M();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,N()?(t.style.border="none",t.style.borderRadius="0"):(t.style.border="1px solid rgb(".concat(L(S.colors.border),")"),t.style.borderRadius="10px")}else if(t.style.border="none",t.style.borderRadius="0",S.element){var i=S.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{a=S.keyboardHeight>0?"calc(100% - ".concat(S.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 re(){var e,t=null!==(e=document.querySelector(f.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=D({type:"button"});t.id=f.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(v,"px"),t.style.height="".concat(b,"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(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),O({iframe:t,content:(n={unreadMessageCount:S.unreadMessageCount},I({template:d}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(n.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,L(S.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,L(S.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,L(S.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,ge()))})}}function ae(e){return"start"===e.animation?"game"===S.mode?"translateY(20%)":"scale(0.8)":"game"===S.mode?"translateY(0)":"scale(1)"}function se(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 le(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,a;return n(this,(function(n){switch(n.label){case 0:if(ue(),S.retryRecordRetentionTimerId&&(clearTimeout(S.retryRecordRetentionTimerId),S.retryRecordRetentionTimerId=null),S.retentionRemainingSeconds=null,S.isRetentionRecordedForSession=!0,!(e=$()))return[2];t="https://".concat(S.domain,"/api/sdk/retention"),o=oe({supportViewConfig:e}),i={token:S.token,deviceId:S.deviceId,language:S.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,se(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return a=n.sent(),console.error("Error tracking retention:",a),S.retryRecordRetentionTimerId=setTimeout(le,6e4),[3,6];case 6:return[2]}}))}))}function ce(){var e=new Date;if(S.sessionStatus="active",S.sessionResumeOrStartTime=e,S.sessionStartTime){var t=S.sessionStartTime.valueOf()/1e3+S.resetSessionAfterSecs;Date.now()/1e3>t&&de()}else de();null!==S.retentionRemainingSeconds&&(S.recordRetentionTimerId=setTimeout(le,1e3*S.retentionRemainingSeconds))}function de(){S.sessionStartTime=new Date,S.retentionRemainingSeconds=S.recordRetentionAfterSecs,S.isRetentionRecordedForSession=!1,ue()}function ue(){S.recordRetentionTimerId&&(clearTimeout(S.recordRetentionTimerId),S.recordRetentionTimerId=null)}function pe(){S.isRetentionRecordedForSession&&le()}function ge(){var e,t,n;return null!==(n=null===(e=S.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=S.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function fe(){var e=S.isInForeground,t="visible"===document.visibilityState&&document.hasFocus();S.isInForeground=t,e!==t&&K(),t&&"paused"===S.sessionStatus?ce():t||"active"!==S.sessionStatus||function(){if(S.sessionResumeOrStartTime&&S.retentionRemainingSeconds){var e=Math.floor((Date.now()-S.sessionResumeOrStartTime.valueOf())/1e3);S.retentionRemainingSeconds-=e}S.sessionStatus="paused",ue()}()}function me(){var e,t=S.isLoggedIn,n=Boolean(S.signedMetadataToken||(null===(e=S.player)||void 0===e?void 0:e.id));S.isLoggedIn=n,n&&!t?W():!n&&t&&G()}document.addEventListener("visibilitychange",fe),window.addEventListener("focus",fe),window.addEventListener("blur",fe),window.addEventListener("resize",ie),window.addEventListener("resize",F),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(f.sdkLoaderIframe),n=document.querySelector(f.sdkIframe);S.networkErrorTimerId&&(clearTimeout(S.networkErrorTimerId),S.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)Z();else if("theymes.closeNotification"===e.data.action)j({notification:S.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:S.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ee({path:a.action.path}),j({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(f.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),"support"===S.widgetButtonAction?X():"assistant"===S.widgetButtonAction&&V();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:T,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),Q("open",(function(){S.sdkIsOpen=!0,Y()})),Q("close",(function(){S.sdkIsOpen=!1,z()})),exports.addEventListener=Q,exports.addField=function(e,t){S.fields[e]=t,ne()},exports.addFields=function(t){S.fields=e(e({},S.fields),t),ne()},exports.addTag=function(e){S.tags.add(e),ne()},exports.addTags=function(e){e.forEach((function(e){return S.tags.add(e)})),ne()},exports.close=Z,exports.disableLogging=function(){S.loggingEnabled=!1},exports.disableNotifications=function(){S.notificationsPaused=!0},exports.enableLogging=function(){S.loggingEnabled=!0},exports.enableNotifications=function(){S.notificationsPaused=!1,J()},exports.getFields=function(){return S.fields},exports.getLanguage=function(){return S.language},exports.getPlayer=function(){return S.player},exports.getSdkVersion=function(){return u},exports.getSignedMetadataToken=function(){return S.signedMetadataToken},exports.getTags=function(){return Array.from(S.tags)},exports.getUnansweredMessageCount=function(){return S.unansweredMessageCount},exports.getUnreadMessageCount=function(){return S.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,f,m,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");S.token=o,S.domain=i,S.mode=r.mode,S.element="element"in r&&void 0!==r.element?r.element:S.element,S.language=null!==(u=r.language)&&void 0!==u?u:S.language,S.nonce=null!==(f=r.nonce)&&void 0!==f?f:S.nonce,S.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=(n=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(n+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})));return localStorage.setItem("deviceId",t),t;var n}(),S.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m:S.widgetButton,S.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:S.widgetButtonAction,S.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:S.position,S.x="x"in r&&void 0!==r.x?r.x:S.x,S.y="y"in r&&void 0!==r.y?r.y:S.y,S.disableInsets="game"===S.mode&&null!==S.element,q.eventPoller||(q.eventPoller=new U),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:S.token,platform:g,mode:S.mode}).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=n.sent()).ok?[3,4]:[4,se(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.colors)&&(x=l.branding.colors,S.colors=e(e({},S.colors),x),localStorage.setItem(p,JSON.stringify(S.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(S.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(S.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(S.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(S.resetSessionAfterSecs=l.resetSessionAfterSecs),ce(),ne(),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:T,removeItem:!0}),c?ee({path:c}):S.widgetButton&&re(),[3,7];case 6:return d=n.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var x}))}))},exports.iosSetKeyboardHeight=function(e){S.keyboardHeight=e,ie()},exports.isPrivacyMode=function(){return S.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return S.youngPlayer},exports.openAssistant=V,exports.openResource=function(e,t){var n="/resources/".concat(e);te({path:n,config:t}),ee({path:n,config:t})},exports.openSupport=X,exports.recordRetention=function(){S.isRetentionRecordedForSession||le()},exports.removeAllFields=function(){S.fields={},ne()},exports.removeAllTags=function(){S.tags.clear(),ne()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a.apply(void 0,e)},exports.removeField=function(e){delete S.fields[e],ne()},exports.removeFields=function(e){e.forEach((function(e){return delete S.fields[e]})),ne()},exports.removeTag=function(e){S.tags.delete(e),ne()},exports.removeTags=function(e){e.forEach((function(e){return S.tags.delete(e)})),ne()},exports.requestNotificationPermission=function(){},exports.reset=function(){S.language=null,S.tags=new Set,S.fields={},S.signedMetadataToken=null,S.player=null,me(),ne(),B({action:"widgetButtonTextUpdate",text:ge()})},exports.setFields=function(e){S.fields=e,ne()},exports.setLanguage=function(e){var t=S.language!==e;S.language=e,t&&(ne(),B({action:"widgetButtonTextUpdate",text:ge()}))},exports.setPlayer=function(e){var t,n=(null===(t=S.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);S.player=e,me(),n&&(ne(),pe())},exports.setPrivacyMode=function(e){S.privacyMode=e,ne()},exports.setSignedMetadataToken=function(e){var t=S.signedMetadataToken!==e;S.signedMetadataToken=e,me(),t&&(ne(),pe())},exports.setTags=function(e){S.tags=new Set(e),ne()},exports.setYoungPlayer=function(e){S.youngPlayer=e,ne()};
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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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>",u="1.2.7",p="colors",f="web",g={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"},m=340,h=680,y=500,v=120,b=48,w=.2,E=.2,k=.2,T="theymes_path_on_init",C="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",S={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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var x=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 x(o,n[t])})))};function O(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",f).replace("INSET_TOP_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace("INSET_BOTTOM_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace("INSET_LEFT_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace("INSET_RIGHT_PLACEHOLDER",S.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replaceAll("CSS_TEXT_PLACEHOLDER",I(S.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",I(S.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",I(S.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",I(S.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",I(S.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",I(S.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",I(S.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===S.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=S.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:C).replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=S.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replaceAll("NONCE_ATTR_PLACEHOLDER",S.nonce?'nonce="'.concat(S.nonce,'"'):"")}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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',R=/(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,A=/CrOS/,P=/android|ipad|playbook|silk/i;function D(){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=R.test(n)&&!A.test(n)||!!e.tablet&&P.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<y||window.innerHeight<y)}function N(e){var n=e.type,t=S.position,o=S.x,i=S.y;return D()&&"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 B(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(m,"px"),height:"".concat(h,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*S.y,"px)")}}function H(e){var n=document.querySelector(g.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 M(){var e,n,t=S.notifications[0];if(t&&!S.visibleNotification){S.visibleNotification=t;var o=null!==(e=document.querySelector(g.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=g.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(g.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=g.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(k,"s ease-in-out, margin-top ").concat(k,"s ease-in-out"),o.appendChild(r),O({iframe:r,content:(i={text:t.text},_({template:L}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",F()}),500),t.closeAfterSeconds>0&&setTimeout((function(){j({notification:t})}),1e3*t.closeAfterSeconds)}}function F(){var e,n,t,o=document.querySelector(g.notificationDialog),i=document.querySelector(g.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"===S.mode){var a=N({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(S.element){var c=S.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=S.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=S.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=S.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function j(e){if(e.notification&&S.visibleNotification===e.notification){var n=document.querySelector(g.notificationIframe),t=document.querySelector(g.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),S.notifications=S.notifications.slice(1),S.visibleNotification=null,M()}),1e3*k))}}var U=function(){function i(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(i.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){S.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(i.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(i.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(i.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return S.isLoggedIn&&S.isInForeground&&S.hasNetworkConnectivity&&!S.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(i.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(i.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(i.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(i.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u,p;return t(this,(function(t){switch(t.label){case 0:if(!S.token||!S.domain||!S.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(n=new Date(this.lastPollDate.getTime()+6e4),(i=(n.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(i),[2];this.lastPollDate=new Date,r=S.notificationsPaused||S.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:S.token,language:null!==(u=S.language)&&void 0!==u?u:"en",deviceId:S.deviceId,notificationsPaused:r,mode:S.mode},(null===(p=S.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:S.player.id}:{}),S.signedMetadataToken?{signedMetadataToken:S.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(S.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(l=t.sent()).ok)throw new Error("HTTP error! status: ".concat(l.status));return[4,l.json()];case 3:return c=t.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),S.notifications=o(o([],S.notifications,!0),c.notifications,!0),S.notifications.length>0&&M(),c.unansweredMessageCount!==S.unansweredMessageCount&&(S.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==S.unreadMessageCount&&(S.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=t.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(S.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),i}(),q={eventPoller:null},W=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onOpen()},Y=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onClose()},J=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onEnableNotifications()},K=function(){var e;null===(e=q.eventPoller)||void 0===e||e.onIsInForegroundChanged()},X=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,g,m,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");S.token=o,S.domain=i,S.mode=r.mode,S.element="element"in r&&void 0!==r.element?r.element:S.element,S.language=null!==(u=r.language)&&void 0!==u?u:S.language,S.nonce=null!==(g=r.nonce)&&void 0!==g?g:S.nonce,S.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),S.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m:S.widgetButton,S.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:S.widgetButtonAction,S.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:S.position,S.x="x"in r&&void 0!==r.x?r.x:S.x,S.y="y"in r&&void 0!==r.y?r.y:S.y,S.disableInsets="game"===S.mode&&null!==S.element,q.eventPoller||(q.eventPoller=new U),n="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:S.token,platform:f,mode:S.mode}).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(n,"?").concat(a),{method:"GET"})];case 2:return(s=t.sent()).ok?[3,4]:[4,Ye(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)&&(E=l.branding.colors,S.colors=e(e({},S.colors),E),localStorage.setItem(p,JSON.stringify(S.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(S.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(S.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(S.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(S.resetSessionAfterSecs=l.resetSessionAfterSecs),Ke(),Ue(),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?Fe({path:c}):S.widgetButton&&Ge(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},V=function(e){var n="/help-center";je({path:n,config:e}),Fe({path:n,config:e})},Z=function(e){var n="/assistant";je({path:n,config:e}),Fe({path:n,config:e})},Q=function(e,n){var t="/resources/".concat(e);je({path:t,config:n}),Fe({path:t,config:n})},$=function(){!function(){var e=document.querySelector(g.sdkDialog),n=document.querySelector(g.sdkIframeWrapper);if(e){var t=function(){"widget"!==S.mode||S.forceUpdateSdkDialog?e.remove():e.style.display="none",S.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=ze({animation:"start"}),setTimeout((function(){t()}),1e3*w)):t()}S.widgetButton&&Ge();s("close",[])}()},ee=function(){return S.language},ne=function(e){var n=S.language!==e;S.language=e,n&&(Ue(),H({action:"widgetButtonTextUpdate",text:Qe()}))},te=function(){return S.signedMetadataToken},oe=function(e){var n=S.signedMetadataToken!==e;S.signedMetadataToken=e,en(),n&&(Ue(),Ze())},ie=function(){return S.player},re=function(e){var n,t=(null===(n=S.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);S.player=e,en(),t&&(Ue(),Ze())},ae=function(){return Array.from(S.tags)},se=function(e){S.tags=new Set(e),Ue()},le=function(e){S.tags.add(e),Ue()},ce=function(e){e.forEach((function(e){return S.tags.add(e)})),Ue()},de=function(e){S.tags.delete(e),Ue()},ue=function(e){e.forEach((function(e){return S.tags.delete(e)})),Ue()},pe=function(){S.tags.clear(),Ue()},fe=function(){return S.fields},ge=function(e){S.fields=e,Ue()},me=function(e,n){S.fields[e]=n,Ue()},he=function(n){S.fields=e(e({},S.fields),n),Ue()},ye=function(e){delete S.fields[e],Ue()},ve=function(e){e.forEach((function(e){return delete S.fields[e]})),Ue()},be=function(){S.fields={},Ue()},we=function(){S.loggingEnabled=!0},Ee=function(){S.loggingEnabled=!1},ke=function(){return S.youngPlayer},Te=function(e){S.youngPlayer=e,Ue()},Ce=function(){return S.privacyMode},Se=function(e){S.privacyMode=e,Ue()},xe=function(){return!0},Oe=function(){},Ie=function(){S.notificationsPaused=!1,J()},_e=function(){S.notificationsPaused=!0},Le=function(){return S.unreadMessageCount},Re=function(){return S.unansweredMessageCount},Ae=function(){return u},Pe=function(){S.language=null,S.tags=new Set,S.fields={},S.signedMetadataToken=null,S.player=null,en(),Ue(),H({action:"widgetButtonTextUpdate",text:Qe()})},De=function(){S.isRetentionRecordedForSession||Je()},Ne=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},Be=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)},He=function(e){S.keyboardHeight=e,We()};function Me(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!S.token||!S.domain||!S.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],p=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},g=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:S.language)&&void 0!==a?a:null,m=null!==(s=S.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=S.player)&&void 0!==l?l:null,y={_platform:f,_sdkVersion:u};S.youngPlayer&&(y._youngPlayer=!0),(S.privacyMode||S.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(S.tags),!0),d,!0),b=e(e(e({},S.fields),p),y);return{token:S.token,domain:S.domain,deviceId:S.deviceId,tags:v,fields:b,language:g,signedMetadataToken:m,player:h}}function Fe(e){var n,t,o,i=Me({config:e.config});if(i){var r=null!==(n=document.querySelector(g.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=g.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(g.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=g.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(I(S.colors.background),")"),a.style.transform=ze({animation:"start"}),a.style.transition=(S.mode,"opacity ".concat(w,"s ease-in-out, transform ").concat(w,"s ease-in-out")),"widget"===S.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(g.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=g.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(g.sdkIframe),p=null!=u?u:document.createElement("iframe"),m=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(m),y())}),500);p.id=g.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&&!S.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(S.domain,"/sdk"),i=new URLSearchParams;i.set("platform",f),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",S.mode),i.set("origin",window.location.origin),i.set("userLanguage",S.userLanguage),S.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=qe({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)),O({iframe:d,content:_({template:l})});var h=!1,y=function(){h||(h=!0,S.networkErrorTimerId=setTimeout((function(){O({iframe:d,content:_({template:c})})}),1e4))};p.onload=y,p.onerror=function(){O({iframe:d,content:_({template:c})})},We(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=ze({animation:"end"})}),100)}}function je(e){var n=e.path,t=e.config,o=null!=t?t:null;S.previousPath===n&&x(S.previousConfig,o)||(S.previousPath=n,S.previousConfig=o,Ue())}function Ue(){var e=document.querySelector(g.sdkDialog);S.sdkIsOpen?S.forceUpdateSdkDialog=!0:null==e||e.remove()}function qe(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 We(){var e=document.querySelector(g.sdkDialog),n=document.querySelector(g.sdkIframeWrapper);if(e&&n)if("widget"===S.mode){var t=N({type:"widget"}),o=B();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(S.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",S.element){var i=S.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{a=S.keyboardHeight>0?"calc(100% - ".concat(S.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 Ge(){var e,n=null!==(e=document.querySelector(g.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=N({type:"button"});n.id=g.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(v,"px"),n.style.height="".concat(b,"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),O({iframe:n,content:(t={unreadMessageCount:S.unreadMessageCount},_({template:d}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",I(S.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",I(S.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",I(S.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",Qe()))})}}function ze(e){return"start"===e.animation?"game"===S.mode?"translateY(20%)":"scale(0.8)":"game"===S.mode?"translateY(0)":"scale(1)"}function Ye(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 Je(){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(Ve(),S.retryRecordRetentionTimerId&&(clearTimeout(S.retryRecordRetentionTimerId),S.retryRecordRetentionTimerId=null),S.retentionRemainingSeconds=null,S.isRetentionRecordedForSession=!0,!(e=Me()))return[2];n="https://".concat(S.domain,"/api/sdk/retention"),o=qe({supportViewConfig:e}),i={token:S.token,deviceId:S.deviceId,language:S.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,Ye(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),S.retryRecordRetentionTimerId=setTimeout(Je,6e4),[3,6];case 6:return[2]}}))}))}function Ke(){var e=new Date;if(S.sessionStatus="active",S.sessionResumeOrStartTime=e,S.sessionStartTime){var n=S.sessionStartTime.valueOf()/1e3+S.resetSessionAfterSecs;Date.now()/1e3>n&&Xe()}else Xe();null!==S.retentionRemainingSeconds&&(S.recordRetentionTimerId=setTimeout(Je,1e3*S.retentionRemainingSeconds))}function Xe(){S.sessionStartTime=new Date,S.retentionRemainingSeconds=S.recordRetentionAfterSecs,S.isRetentionRecordedForSession=!1,Ve()}function Ve(){S.recordRetentionTimerId&&(clearTimeout(S.recordRetentionTimerId),S.recordRetentionTimerId=null)}function Ze(){S.isRetentionRecordedForSession&&Je()}function Qe(){var e,n,t;return null!==(t=null===(e=S.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=S.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function $e(){var e=S.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();S.isInForeground=n,e!==n&&K(),n&&"paused"===S.sessionStatus?Ke():n||"active"!==S.sessionStatus||function(){if(S.sessionResumeOrStartTime&&S.retentionRemainingSeconds){var e=Math.floor((Date.now()-S.sessionResumeOrStartTime.valueOf())/1e3);S.retentionRemainingSeconds-=e}S.sessionStatus="paused",Ve()}()}function en(){var e,n=S.isLoggedIn,t=Boolean(S.signedMetadataToken||(null===(e=S.player)||void 0===e?void 0:e.id));S.isLoggedIn=t,t&&!n?W():!t&&n&&G()}document.addEventListener("visibilitychange",$e),window.addEventListener("focus",$e),window.addEventListener("blur",$e),window.addEventListener("resize",We),window.addEventListener("resize",F),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(g.sdkLoaderIframe),t=document.querySelector(g.sdkIframe);S.networkErrorTimerId&&(clearTimeout(S.networkErrorTimerId),S.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)$();else if("theymes.closeNotification"===e.data.action)j({notification:S.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:S.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(Fe({path:a.action.path}),j({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(g.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*E)),"support"===S.widgetButtonAction?V():"assistant"===S.widgetButtonAction&&Z();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),Ne("open",(function(){S.sdkIsOpen=!0,z()})),Ne("close",(function(){S.sdkIsOpen=!1,Y()}));export{Ne as addEventListener,me as addField,he as addFields,le as addTag,ce as addTags,$ as close,Ee as disableLogging,_e as disableNotifications,we as enableLogging,Ie as enableNotifications,fe as getFields,ee as getLanguage,ie as getPlayer,Ae as getSdkVersion,te as getSignedMetadataToken,ae as getTags,Re as getUnansweredMessageCount,Le as getUnreadMessageCount,X as initialize,He as iosSetKeyboardHeight,Ce as isPrivacyMode,xe as isSupported,ke as isYoungPlayer,Z as openAssistant,Q as openResource,V as openSupport,De as recordRetention,be as removeAllFields,pe as removeAllTags,Be as removeEventListener,ye as removeField,ve as removeFields,de as removeTag,ue as removeTags,Oe as requestNotificationPermission,Pe as reset,ge as setFields,ne as setLanguage,re as setPlayer,Se as setPrivacyMode,oe as setSignedMetadataToken,se as setTags,Te 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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>",u="1.2.8",p="colors",f="web",g={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"},m=340,h=680,y=500,v=120,b=48,w=.2,E=.2,x=.2,k="theymes_path_on_init",T="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",S={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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var C=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 C(o,n[t])})))};function O(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,f).replace(/INSET_TOP_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,S.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,I(S.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,I(S.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,I(S.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,I(S.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,I(S.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,I(S.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,I(S.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===S.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=S.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:T).replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,null!==(i=null===(o=S.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif").replace(/NONCE_ATTR_PLACEHOLDER/g,S.nonce?'nonce="'.concat(S.nonce,'"'):"")}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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',R=/(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,P=/CrOS/,A=/android|ipad|playbook|silk/i;function D(){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=R.test(n)&&!P.test(n)||!!e.tablet&&A.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<y||window.innerHeight<y)}function N(e){var n=e.type,t=S.position,o=S.x,i=S.y;return D()&&"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 B(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(m,"px"),height:"".concat(h,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*S.y,"px)")}}function M(e){var n=document.querySelector(g.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 H(){var e,n,t=S.notifications[0];if(t&&!S.visibleNotification){S.visibleNotification=t;var o=null!==(e=document.querySelector(g.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=g.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(g.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=g.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(x,"s ease-in-out, margin-top ").concat(x,"s ease-in-out"),o.appendChild(r),O({iframe:r,content:(i={text:t.text},_({template:L}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",F()}),500),t.closeAfterSeconds>0&&setTimeout((function(){j({notification:t})}),1e3*t.closeAfterSeconds)}}function F(){var e,n,t,o=document.querySelector(g.notificationDialog),i=document.querySelector(g.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"===S.mode){var a=N({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(S.element){var c=S.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=S.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=S.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=S.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=S.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function j(e){if(e.notification&&S.visibleNotification===e.notification){var n=document.querySelector(g.notificationIframe),t=document.querySelector(g.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),S.notifications=S.notifications.slice(1),S.visibleNotification=null,H()}),1e3*x))}}var q=function(){function i(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(i.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){S.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(i.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(i.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(i.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return S.isLoggedIn&&S.isInForeground&&S.hasNetworkConnectivity&&!S.sdkIsOpen}}),Object.defineProperty(i.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(i.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(i.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(i.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(i.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(i.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(i.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u,p;return t(this,(function(t){switch(t.label){case 0:if(!S.token||!S.domain||!S.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(n=new Date(this.lastPollDate.getTime()+6e4),(i=(n.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(i),[2];this.lastPollDate=new Date,r=S.notificationsPaused||S.sdkIsOpen?"true":"false",a=new URLSearchParams(e(e({token:S.token,language:null!==(u=S.language)&&void 0!==u?u:"en",deviceId:S.deviceId,notificationsPaused:r,mode:S.mode},(null===(p=S.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:S.player.id}:{}),S.signedMetadataToken?{signedMetadataToken:S.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch("https://".concat(S.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(l=t.sent()).ok)throw new Error("HTTP error! status: ".concat(l.status));return[4,l.json()];case 3:return c=t.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),S.notifications=o(o([],S.notifications,!0),c.notifications,!0),S.notifications.length>0&&H(),c.unansweredMessageCount!==S.unansweredMessageCount&&(S.unansweredMessageCount=c.unansweredMessageCount,s("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==S.unreadMessageCount&&(S.unreadMessageCount=c.unreadMessageCount,s("unreadMessageCountUpdate",[c.unreadMessageCount]),M({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=t.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(S.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),i}(),U={eventPoller:null},W=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onLogin()},G=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onOpen()},Y=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onClose()},J=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onEnableNotifications()},K=function(){var e;null===(e=U.eventPoller)||void 0===e||e.onIsInForegroundChanged()},X=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,g,m,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");S.token=o,S.domain=i,S.mode=r.mode,S.element="element"in r&&void 0!==r.element?r.element:S.element,S.language=null!==(u=r.language)&&void 0!==u?u:S.language,S.nonce=null!==(g=r.nonce)&&void 0!==g?g:S.nonce,S.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=(t=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})));return localStorage.setItem("deviceId",n),n;var t}(),S.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m:S.widgetButton,S.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h:S.widgetButtonAction,S.position="position"in r&&void 0!==r.position&&null!==(y=r.position)&&void 0!==y?y:S.position,S.x="x"in r&&void 0!==r.x?r.x:S.x,S.y="y"in r&&void 0!==r.y?r.y:S.y,S.disableInsets="game"===S.mode&&null!==S.element,U.eventPoller||(U.eventPoller=new q),n="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:S.token,platform:f,mode:S.mode}).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(n,"?").concat(a),{method:"GET"})];case 2:return(s=t.sent()).ok?[3,4]:[4,Ye(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)&&(E=l.branding.colors,S.colors=e(e({},S.colors),E),localStorage.setItem(p,JSON.stringify(S.colors))),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.locs)&&(S.locs=l.branding.locs),(null===(w=null==l?void 0:l.branding)||void 0===w?void 0:w.fonts)&&(S.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(S.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(S.resetSessionAfterSecs=l.resetSessionAfterSecs),Ke(),qe(),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:k,removeItem:!0}),c?Fe({path:c}):S.widgetButton&&Ge(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},V=function(e){var n="/help-center";je({path:n,config:e}),Fe({path:n,config:e})},Z=function(e){var n="/assistant";je({path:n,config:e}),Fe({path:n,config:e})},Q=function(e,n){var t="/resources/".concat(e);je({path:t,config:n}),Fe({path:t,config:n})},$=function(){!function(){var e=document.querySelector(g.sdkDialog),n=document.querySelector(g.sdkIframeWrapper);if(e){var t=function(){"widget"!==S.mode||S.forceUpdateSdkDialog?e.remove():e.style.display="none",S.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=ze({animation:"start"}),setTimeout((function(){t()}),1e3*w)):t()}S.widgetButton&&Ge();s("close",[])}()},ee=function(){return S.language},ne=function(e){var n=S.language!==e;S.language=e,n&&(qe(),M({action:"widgetButtonTextUpdate",text:Qe()}))},te=function(){return S.signedMetadataToken},oe=function(e){var n=S.signedMetadataToken!==e;S.signedMetadataToken=e,en(),n&&(qe(),Ze())},ie=function(){return S.player},re=function(e){var n,t=(null===(n=S.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);S.player=e,en(),t&&(qe(),Ze())},ae=function(){return Array.from(S.tags)},se=function(e){S.tags=new Set(e),qe()},le=function(e){S.tags.add(e),qe()},ce=function(e){e.forEach((function(e){return S.tags.add(e)})),qe()},de=function(e){S.tags.delete(e),qe()},ue=function(e){e.forEach((function(e){return S.tags.delete(e)})),qe()},pe=function(){S.tags.clear(),qe()},fe=function(){return S.fields},ge=function(e){S.fields=e,qe()},me=function(e,n){S.fields[e]=n,qe()},he=function(n){S.fields=e(e({},S.fields),n),qe()},ye=function(e){delete S.fields[e],qe()},ve=function(e){e.forEach((function(e){return delete S.fields[e]})),qe()},be=function(){S.fields={},qe()},we=function(){S.loggingEnabled=!0},Ee=function(){S.loggingEnabled=!1},xe=function(){return S.youngPlayer},ke=function(e){S.youngPlayer=e,qe()},Te=function(){return S.privacyMode},Se=function(e){S.privacyMode=e,qe()},Ce=function(){return!0},Oe=function(){},Ie=function(){S.notificationsPaused=!1,J()},_e=function(){S.notificationsPaused=!0},Le=function(){return S.unreadMessageCount},Re=function(){return S.unansweredMessageCount},Pe=function(){return u},Ae=function(){S.language=null,S.tags=new Set,S.fields={},S.signedMetadataToken=null,S.player=null,en(),qe(),M({action:"widgetButtonTextUpdate",text:Qe()})},De=function(){S.isRetentionRecordedForSession||Je()},Ne=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},Be=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)},Me=function(e){S.keyboardHeight=e,We()};function He(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!S.token||!S.domain||!S.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],p=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},g=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:S.language)&&void 0!==a?a:null,m=null!==(s=S.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=S.player)&&void 0!==l?l:null,y={_platform:f,_sdkVersion:u};S.youngPlayer&&(y._youngPlayer=!0),(S.privacyMode||S.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(S.tags),!0),d,!0),b=e(e(e({},S.fields),p),y);return{token:S.token,domain:S.domain,deviceId:S.deviceId,tags:v,fields:b,language:g,signedMetadataToken:m,player:h}}function Fe(e){var n,t,o,i=He({config:e.config});if(i){var r=null!==(n=document.querySelector(g.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=g.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(g.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=g.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(I(S.colors.background),")"),a.style.transform=ze({animation:"start"}),a.style.transition=(S.mode,"opacity ".concat(w,"s ease-in-out, transform ").concat(w,"s ease-in-out")),"widget"===S.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(g.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=g.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(g.sdkIframe),p=null!=u?u:document.createElement("iframe"),m=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(m),y())}),500);p.id=g.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&&!S.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(S.domain,"/sdk"),i=new URLSearchParams;i.set("platform",f),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",S.mode),i.set("origin",window.location.origin),i.set("userLanguage",S.userLanguage),S.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=Ue({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)),O({iframe:d,content:_({template:l})});var h=!1,y=function(){h||(h=!0,S.networkErrorTimerId=setTimeout((function(){O({iframe:d,content:_({template:c})})}),1e4))};p.onload=y,p.onerror=function(){O({iframe:d,content:_({template:c})})},We(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=ze({animation:"end"})}),100)}}function je(e){var n=e.path,t=e.config,o=null!=t?t:null;S.previousPath===n&&C(S.previousConfig,o)||(S.previousPath=n,S.previousConfig=o,qe())}function qe(){var e=document.querySelector(g.sdkDialog);S.sdkIsOpen?S.forceUpdateSdkDialog=!0:null==e||e.remove()}function Ue(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 We(){var e=document.querySelector(g.sdkDialog),n=document.querySelector(g.sdkIframeWrapper);if(e&&n)if("widget"===S.mode){var t=N({type:"widget"}),o=B();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(S.colors.border),")"),n.style.borderRadius="10px")}else if(n.style.border="none",n.style.borderRadius="0",S.element){var i=S.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{a=S.keyboardHeight>0?"calc(100% - ".concat(S.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 Ge(){var e,n=null!==(e=document.querySelector(g.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=N({type:"button"});n.id=g.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(v,"px"),n.style.height="".concat(b,"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),O({iframe:n,content:(t={unreadMessageCount:S.unreadMessageCount},_({template:d}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,I(S.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,I(S.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,I(S.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,Qe()))})}}function ze(e){return"start"===e.animation?"game"===S.mode?"translateY(20%)":"scale(0.8)":"game"===S.mode?"translateY(0)":"scale(1)"}function Ye(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 Je(){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(Ve(),S.retryRecordRetentionTimerId&&(clearTimeout(S.retryRecordRetentionTimerId),S.retryRecordRetentionTimerId=null),S.retentionRemainingSeconds=null,S.isRetentionRecordedForSession=!0,!(e=He()))return[2];n="https://".concat(S.domain,"/api/sdk/retention"),o=Ue({supportViewConfig:e}),i={token:S.token,deviceId:S.deviceId,language:S.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,Ye(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),S.retryRecordRetentionTimerId=setTimeout(Je,6e4),[3,6];case 6:return[2]}}))}))}function Ke(){var e=new Date;if(S.sessionStatus="active",S.sessionResumeOrStartTime=e,S.sessionStartTime){var n=S.sessionStartTime.valueOf()/1e3+S.resetSessionAfterSecs;Date.now()/1e3>n&&Xe()}else Xe();null!==S.retentionRemainingSeconds&&(S.recordRetentionTimerId=setTimeout(Je,1e3*S.retentionRemainingSeconds))}function Xe(){S.sessionStartTime=new Date,S.retentionRemainingSeconds=S.recordRetentionAfterSecs,S.isRetentionRecordedForSession=!1,Ve()}function Ve(){S.recordRetentionTimerId&&(clearTimeout(S.recordRetentionTimerId),S.recordRetentionTimerId=null)}function Ze(){S.isRetentionRecordedForSession&&Je()}function Qe(){var e,n,t;return null!==(t=null===(e=S.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=S.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function $e(){var e=S.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();S.isInForeground=n,e!==n&&K(),n&&"paused"===S.sessionStatus?Ke():n||"active"!==S.sessionStatus||function(){if(S.sessionResumeOrStartTime&&S.retentionRemainingSeconds){var e=Math.floor((Date.now()-S.sessionResumeOrStartTime.valueOf())/1e3);S.retentionRemainingSeconds-=e}S.sessionStatus="paused",Ve()}()}function en(){var e,n=S.isLoggedIn,t=Boolean(S.signedMetadataToken||(null===(e=S.player)||void 0===e?void 0:e.id));S.isLoggedIn=t,t&&!n?W():!t&&n&&G()}document.addEventListener("visibilitychange",$e),window.addEventListener("focus",$e),window.addEventListener("blur",$e),window.addEventListener("resize",We),window.addEventListener("resize",F),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(g.sdkLoaderIframe),t=document.querySelector(g.sdkIframe);S.networkErrorTimerId&&(clearTimeout(S.networkErrorTimerId),S.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)$();else if("theymes.closeNotification"===e.data.action)j({notification:S.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:S.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(Fe({path:a.action.path}),j({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(g.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*E)),"support"===S.widgetButtonAction?V():"assistant"===S.widgetButtonAction&&Z();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:k,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),Ne("open",(function(){S.sdkIsOpen=!0,z()})),Ne("close",(function(){S.sdkIsOpen=!1,Y()}));export{Ne as addEventListener,me as addField,he as addFields,le as addTag,ce as addTags,$ as close,Ee as disableLogging,_e as disableNotifications,we as enableLogging,Ie as enableNotifications,fe as getFields,ee as getLanguage,ie as getPlayer,Pe as getSdkVersion,te as getSignedMetadataToken,ae as getTags,Re as getUnansweredMessageCount,Le as getUnreadMessageCount,X as initialize,Me as iosSetKeyboardHeight,Te as isPrivacyMode,Ce as isSupported,xe as isYoungPlayer,Z as openAssistant,Q as openResource,V as openSupport,De as recordRetention,be as removeAllFields,pe as removeAllTags,Be as removeEventListener,ye as removeField,ve as removeFields,de as removeTag,ue as removeTags,Oe as requestNotificationPermission,Ae as reset,ge as setFields,ne as setLanguage,re as setPlayer,Se as setPrivacyMode,oe as setSignedMetadataToken,se as setTags,ke 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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="1.2.7",f="colors",g="web",m={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"},h=340,y=680,v=500,b=120,w=48,E=.2,T=.2,k=.2,S="theymes_path_on_init",C="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var O=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 O(o,n[t])})))};function L(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",g).replace("INSET_TOP_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace("INSET_BOTTOM_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace("INSET_LEFT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace("INSET_RIGHT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replaceAll("CSS_TEXT_PLACEHOLDER",I(x.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",I(x.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",I(x.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",I(x.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",I(x.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",I(x.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",I(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:C).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,'"'):"")}var R='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',A=/(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,P=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){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=A.test(n)&&!P.test(n)||!!e.tablet&&N.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<v||window.innerHeight<v)}function B(e){var n=e.type,t=x.position,o=x.x,i=x.y;return D()&&"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 M(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(h,"px"),height:"".concat(y,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*x.y,"px)")}}function H(e){var n=document.querySelector(m.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 F(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(m.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=m.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(m.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=m.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(k,"s ease-in-out, margin-top ").concat(k,"s ease-in-out"),o.appendChild(r),L({iframe:r,content:(i={text:t.text},_({template:R}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",j()}),500),t.closeAfterSeconds>0&&setTimeout((function(){U({notification:t})}),1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(m.notificationDialog),i=document.querySelector(m.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=B({type:"widget"}),s=M(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=x.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=x.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=x.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(m.notificationIframe),t=document.querySelector(m.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,F()}),1e3*k))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){x.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return x.isLoggedIn&&x.isInForeground&&x.hasNetworkConnectivity&&!x.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u,p;return o(this,(function(o){switch(o.label){case 0:if(!x.token||!x.domain||!x.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=x.notificationsPaused||x.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:x.token,language:null!==(u=x.language)&&void 0!==u?u:"en",deviceId:x.deviceId,notificationsPaused:r,mode:x.mode},(null===(p=x.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(x.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),x.notifications=i(i([],x.notifications,!0),c.notifications,!0),x.notifications.length>0&&F(),c.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(x.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),W={eventPoller:null},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},Z=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.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=se({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}x.widgetButton&&ae();l("close",[])}()},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ee(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:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,m=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=x.player)&&void 0!==l?l:null,y={_platform:g,_sdkVersion:p};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:f,signedMetadataToken:m,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(m.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=m.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(m.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=m.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(I(x.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(m.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=m.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(m.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=m.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",g),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),i.set("userLanguage",x.userLanguage),x.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=ie({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)),L({iframe:s,content:_({template:c})});var h=!1,y=function(){h||(h=!0,x.networkErrorTimerId=setTimeout((function(){L({iframe:s,content:_({template:d})})}),1e4))};p.onload=y,p.onerror=function(){L({iframe:s,content:_({template:d})})},re(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=se({animation:"end"})}),100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&O(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,oe())}function oe(){var e=document.querySelector(m.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(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 re(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e&&n)if("widget"===x.mode){var t=B({type:"widget"}),o=M();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(x.colors.border),")"),n.style.borderRadius="10px")}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.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{a=x.keyboardHeight>0?"calc(100% - ".concat(x.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 ae(){var e,n=null!==(e=document.querySelector(m.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=B({type:"button"});n.id=m.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(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),L({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},_({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",I(x.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",I(x.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",I(x.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ge()))})}}function se(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function le(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 ce(){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(pe(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),t=ie({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,le(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(ce,6e4),[3,6];case 6:return[2]}}))}))}function de(){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&&ue()}else ue();null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(ce,1e3*x.retentionRemainingSeconds))}function ue(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,pe()}function pe(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function fe(){x.isRetentionRecordedForSession&&ce()}function ge(){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 me(){var e=x.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();x.isInForeground=n,e!==n&&X(),n&&"paused"===x.sessionStatus?de():n||"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",pe()}()}function he(){var e,n=x.isLoggedIn,t=Boolean(x.signedMetadataToken||(null===(e=x.player)||void 0===e?void 0:e.id));x.isLoggedIn=t,t&&!n?G():!t&&n&&Y()}return document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",j),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(m.sdkLoaderIframe),t=document.querySelector(m.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)Q();else if("theymes.closeNotification"===e.data.action)U({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&&(ne({path:a.action.path}),U({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(m.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*T)),"support"===x.widgetButtonAction?V():"assistant"===x.widgetButtonAction&&Z();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:S,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),$("open",(function(){x.sdkIsOpen=!0,z()})),$("close",(function(){x.sdkIsOpen=!1,J()})),e.addEventListener=$,e.addField=function(e,n){x.fields[e]=n,oe()},e.addFields=function(e){x.fields=n(n({},x.fields),e),oe()},e.addTag=function(e){x.tags.add(e),oe()},e.addTags=function(e){e.forEach((function(e){return x.tags.add(e)})),oe()},e.close=Q,e.disableLogging=function(){x.loggingEnabled=!1},e.disableNotifications=function(){x.notificationsPaused=!0},e.enableLogging=function(){x.loggingEnabled=!0},e.enableNotifications=function(){x.notificationsPaused=!1,K()},e.getFields=function(){return x.fields},e.getLanguage=function(){return x.language},e.getPlayer=function(){return x.player},e.getSdkVersion=function(){return p},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,m,h,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!==(m=r.button)&&void 0!==m?m:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h: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,x.disableInsets="game"===x.mode&&null!==x.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:x.token,platform:g,mode:x.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,le(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)&&(E=l.branding.colors,x.colors=n(n({},x.colors),E),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),de(),oe(),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:S,removeItem:!0}),c?ne({path:c}):x.widgetButton&&ae(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},e.iosSetKeyboardHeight=function(e){x.keyboardHeight=e,re()},e.isPrivacyMode=function(){return x.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return x.youngPlayer},e.openAssistant=Z,e.openResource=function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},e.openSupport=V,e.recordRetention=function(){x.isRetentionRecordedForSession||ce()},e.removeAllFields=function(){x.fields={},oe()},e.removeAllTags=function(){x.tags.clear(),oe()},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],oe()},e.removeFields=function(e){e.forEach((function(e){return delete x.fields[e]})),oe()},e.removeTag=function(e){x.tags.delete(e),oe()},e.removeTags=function(e){e.forEach((function(e){return x.tags.delete(e)})),oe()},e.requestNotificationPermission=function(){},e.reset=function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,he(),oe(),H({action:"widgetButtonTextUpdate",text:ge()})},e.setFields=function(e){x.fields=e,oe()},e.setLanguage=function(e){var n=x.language!==e;x.language=e,n&&(oe(),H({action:"widgetButtonTextUpdate",text:ge()}))},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,he(),t&&(oe(),fe())},e.setPrivacyMode=function(e){x.privacyMode=e,oe()},e.setSignedMetadataToken=function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,he(),n&&(oe(),fe())},e.setTags=function(e){x.tags=new Set(e),oe()},e.setYoungPlayer=function(e){x.youngPlayer=e,oe()},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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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="1.2.8",p="colors",f="web",m={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"},h=340,y=680,v=500,b=120,w=48,E=.2,x=.2,T=.2,k="theymes_path_on_init",S="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var O=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 O(o,n[t])})))};function L(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,f).replace(/INSET_TOP_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,I(C.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,I(C.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,I(C.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,I(C.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,I(C.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,I(C.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,I(C.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===C.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=C.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:S).replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,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").replace(/NONCE_ATTR_PLACEHOLDER/g,C.nonce?'nonce="'.concat(C.nonce,'"'):"")}var R='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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=/(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,A=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){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=P.test(n)&&!A.test(n)||!!e.tablet&&N.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<v||window.innerHeight<v)}function M(e){var n=e.type,t=C.position,o=C.x,i=C.y;return D()&&"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 B(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(h,"px"),height:"".concat(y,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*C.y,"px)")}}function H(e){var n=document.querySelector(m.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 F(){var e,n,t=C.notifications[0];if(t&&!C.visibleNotification){C.visibleNotification=t;var o=null!==(e=document.querySelector(m.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=m.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(m.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=m.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),L({iframe:r,content:(i={text:t.text},_({template:R}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",j()}),500),t.closeAfterSeconds>0&&setTimeout((function(){U({notification:t})}),1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(m.notificationDialog),i=document.querySelector(m.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=M({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(C.element){var c=C.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=C.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=C.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=C.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=C.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&C.visibleNotification===e.notification){var n=document.querySelector(m.notificationIframe),t=document.querySelector(m.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,F()}),1e3*T))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){C.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C.isLoggedIn&&C.isInForeground&&C.hasNetworkConnectivity&&!C.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u,g;return o(this,(function(o){switch(o.label){case 0:if(!C.token||!C.domain||!C.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=C.notificationsPaused||C.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:C.token,language:null!==(u=C.language)&&void 0!==u?u:"en",deviceId:C.deviceId,notificationsPaused:r,mode:C.mode},(null===(g=C.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:C.player.id}:{}),C.signedMetadataToken?{signedMetadataToken:C.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(C.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),C.notifications=i(i([],C.notifications,!0),c.notifications,!0),C.notifications.length>0&&F(),c.unansweredMessageCount!==C.unansweredMessageCount&&(C.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==C.unreadMessageCount&&(C.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(C.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),W={eventPoller:null},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},Z=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.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=se({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}C.widgetButton&&ae();l("close",[])}()},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ee(e){var t,o,r,a,s,l,c=(null!=e?e:{}).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!==(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:C.language)&&void 0!==a?a:null,m=null!==(s=C.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=C.player)&&void 0!==l?l:null,y={_platform:f,_sdkVersion:g};C.youngPlayer&&(y._youngPlayer=!0),(C.privacyMode||C.youngPlayer)&&(y._privacyMode=!0);var v=i(i([],Array.from(C.tags),!0),d,!0),b=n(n(n({},C.fields),u),y);return{token:C.token,domain:C.domain,deviceId:C.deviceId,tags:v,fields:b,language:p,signedMetadataToken:m,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(m.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=m.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(m.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=m.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(I(C.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(C.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===C.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(m.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=m.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(m.sdkIframe),g=null!=u?u:document.createElement("iframe"),p=setInterval((function(){var e;"complete"===(null===(e=g.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(p),y())}),500);g.id=m.sdkIframe.replace("#",""),g.style.position="absolute",g.style.border="none",g.style.top="0",g.style.right="0",g.style.bottom="0",g.style.left="0",g.style.colorScheme="auto",u&&!C.networkErrorTimerId||(g.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(C.domain,"/sdk"),i=new URLSearchParams;i.set("platform",f),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",C.mode),i.set("origin",window.location.origin),i.set("userLanguage",C.userLanguage),C.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=ie({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),g.style.width="0",g.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(g),document.body.appendChild(r)),L({iframe:s,content:_({template:c})});var h=!1,y=function(){h||(h=!0,C.networkErrorTimerId=setTimeout((function(){L({iframe:s,content:_({template:d})})}),1e4))};g.onload=y,g.onerror=function(){L({iframe:s,content:_({template:d})})},re(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=se({animation:"end"})}),100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;C.previousPath===n&&O(C.previousConfig,o)||(C.previousPath=n,C.previousConfig=o,oe())}function oe(){var e=document.querySelector(m.sdkDialog);C.sdkIsOpen?C.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(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 re(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e&&n)if("widget"===C.mode){var t=M({type:"widget"}),o=B();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(C.colors.border),")"),n.style.borderRadius="10px")}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.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{a=C.keyboardHeight>0?"calc(100% - ".concat(C.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 ae(){var e,n=null!==(e=document.querySelector(m.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=M({type:"button"});n.id=m.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(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),L({iframe:n,content:(t={unreadMessageCount:C.unreadMessageCount},_({template:u}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,I(C.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,I(C.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,I(C.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,fe()))})}}function se(e){return"start"===e.animation?"game"===C.mode?"translateY(20%)":"scale(0.8)":"game"===C.mode?"translateY(0)":"scale(1)"}function le(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 ce(){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(ge(),C.retryRecordRetentionTimerId&&(clearTimeout(C.retryRecordRetentionTimerId),C.retryRecordRetentionTimerId=null),C.retentionRemainingSeconds=null,C.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(C.domain,"/api/sdk/retention"),t=ie({supportViewConfig:e}),i={token:C.token,deviceId:C.deviceId,language:C.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,le(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),C.retryRecordRetentionTimerId=setTimeout(ce,6e4),[3,6];case 6:return[2]}}))}))}function de(){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&&ue()}else ue();null!==C.retentionRemainingSeconds&&(C.recordRetentionTimerId=setTimeout(ce,1e3*C.retentionRemainingSeconds))}function ue(){C.sessionStartTime=new Date,C.retentionRemainingSeconds=C.recordRetentionAfterSecs,C.isRetentionRecordedForSession=!1,ge()}function ge(){C.recordRetentionTimerId&&(clearTimeout(C.recordRetentionTimerId),C.recordRetentionTimerId=null)}function pe(){C.isRetentionRecordedForSession&&ce()}function fe(){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 me(){var e=C.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();C.isInForeground=n,e!==n&&X(),n&&"paused"===C.sessionStatus?de():n||"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",ge()}()}function he(){var e,n=C.isLoggedIn,t=Boolean(C.signedMetadataToken||(null===(e=C.player)||void 0===e?void 0:e.id));C.isLoggedIn=t,t&&!n?G():!t&&n&&Y()}return document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",j),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(m.sdkLoaderIframe),t=document.querySelector(m.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)Q();else if("theymes.closeNotification"===e.data.action)U({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&&(ne({path:a.action.path}),U({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(m.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),"support"===C.widgetButtonAction?V():"assistant"===C.widgetButtonAction&&Z();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:k,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),$("open",(function(){C.sdkIsOpen=!0,z()})),$("close",(function(){C.sdkIsOpen=!1,J()})),e.addEventListener=$,e.addField=function(e,n){C.fields[e]=n,oe()},e.addFields=function(e){C.fields=n(n({},C.fields),e),oe()},e.addTag=function(e){C.tags.add(e),oe()},e.addTags=function(e){e.forEach((function(e){return C.tags.add(e)})),oe()},e.close=Q,e.disableLogging=function(){C.loggingEnabled=!1},e.disableNotifications=function(){C.notificationsPaused=!0},e.enableLogging=function(){C.loggingEnabled=!0},e.enableNotifications=function(){C.notificationsPaused=!1,K()},e.getFields=function(){return C.fields},e.getLanguage=function(){return C.language},e.getPlayer=function(){return C.player},e.getSdkVersion=function(){return g},e.getSignedMetadataToken=function(){return C.signedMetadataToken},e.getTags=function(){return Array.from(C.tags)},e.getUnansweredMessageCount=function(){return C.unansweredMessageCount},e.getUnreadMessageCount=function(){return C.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,g,m,h,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");C.token=e,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!==(g=r.nonce)&&void 0!==g?g:C.nonce,C.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=(t=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})));return localStorage.setItem("deviceId",n),n;var t}(),C.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m: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,C.disableInsets="game"===C.mode&&null!==C.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:C.token,platform:f,mode:C.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,le(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)&&(E=l.branding.colors,C.colors=n(n({},C.colors),E),localStorage.setItem(p,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),de(),oe(),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:k,removeItem:!0}),c?ne({path:c}):C.widgetButton&&ae(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},e.iosSetKeyboardHeight=function(e){C.keyboardHeight=e,re()},e.isPrivacyMode=function(){return C.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return C.youngPlayer},e.openAssistant=Z,e.openResource=function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},e.openSupport=V,e.recordRetention=function(){C.isRetentionRecordedForSession||ce()},e.removeAllFields=function(){C.fields={},oe()},e.removeAllTags=function(){C.tags.clear(),oe()},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 C.fields[e],oe()},e.removeFields=function(e){e.forEach((function(e){return delete C.fields[e]})),oe()},e.removeTag=function(e){C.tags.delete(e),oe()},e.removeTags=function(e){e.forEach((function(e){return C.tags.delete(e)})),oe()},e.requestNotificationPermission=function(){},e.reset=function(){C.language=null,C.tags=new Set,C.fields={},C.signedMetadataToken=null,C.player=null,he(),oe(),H({action:"widgetButtonTextUpdate",text:fe()})},e.setFields=function(e){C.fields=e,oe()},e.setLanguage=function(e){var n=C.language!==e;C.language=e,n&&(oe(),H({action:"widgetButtonTextUpdate",text:fe()}))},e.setPlayer=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,he(),t&&(oe(),pe())},e.setPrivacyMode=function(e){C.privacyMode=e,oe()},e.setSignedMetadataToken=function(e){var n=C.signedMetadataToken!==e;C.signedMetadataToken=e,he(),n&&(oe(),pe())},e.setTags=function(e){C.tags=new Set(e),oe()},e.setYoungPlayer=function(e){C.youngPlayer=e,oe()},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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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="1.2.7",f="colors",g="web",m={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"},h=340,y=680,v=500,b=120,w=48,E=.2,T=.2,k=.2,S="theymes_path_on_init",C="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var O=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 O(o,n[t])})))};function L(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",g).replace("INSET_TOP_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace("INSET_BOTTOM_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace("INSET_LEFT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace("INSET_RIGHT_PLACEHOLDER",x.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replaceAll("CSS_TEXT_PLACEHOLDER",I(x.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",I(x.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",I(x.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",I(x.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",I(x.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",I(x.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",I(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:C).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,'"'):"")}var R='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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>',A=/(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,P=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){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=A.test(n)&&!P.test(n)||!!e.tablet&&N.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<v||window.innerHeight<v)}function B(e){var n=e.type,t=x.position,o=x.x,i=x.y;return D()&&"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 M(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(h,"px"),height:"".concat(y,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*x.y,"px)")}}function H(e){var n=document.querySelector(m.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 F(){var e,n,t=x.notifications[0];if(t&&!x.visibleNotification){x.visibleNotification=t;var o=null!==(e=document.querySelector(m.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=m.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(m.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=m.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(k,"s ease-in-out, margin-top ").concat(k,"s ease-in-out"),o.appendChild(r),L({iframe:r,content:(i={text:t.text},_({template:R}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",j()}),500),t.closeAfterSeconds>0&&setTimeout((function(){U({notification:t})}),1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(m.notificationDialog),i=document.querySelector(m.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=B({type:"widget"}),s=M(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(x.element){var c=x.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=x.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=x.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=x.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=x.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&x.visibleNotification===e.notification){var n=document.querySelector(m.notificationIframe),t=document.querySelector(m.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,F()}),1e3*k))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){x.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return x.isLoggedIn&&x.isInForeground&&x.hasNetworkConnectivity&&!x.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u,p;return o(this,(function(o){switch(o.label){case 0:if(!x.token||!x.domain||!x.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=x.notificationsPaused||x.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:x.token,language:null!==(u=x.language)&&void 0!==u?u:"en",deviceId:x.deviceId,notificationsPaused:r,mode:x.mode},(null===(p=x.player)||void 0===p?void 0:p.id)?{unsignedPlayerId:x.player.id}:{}),x.signedMetadataToken?{signedMetadataToken:x.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(x.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),x.notifications=i(i([],x.notifications,!0),c.notifications,!0),x.notifications.length>0&&F(),c.unansweredMessageCount!==x.unansweredMessageCount&&(x.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==x.unreadMessageCount&&(x.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(x.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),W={eventPoller:null},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},Z=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.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=se({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}x.widgetButton&&ae();l("close",[])}()},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ee(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:{},f=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:x.language)&&void 0!==a?a:null,m=null!==(s=x.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=x.player)&&void 0!==l?l:null,y={_platform:g,_sdkVersion:p};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:f,signedMetadataToken:m,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(m.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=m.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(m.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=m.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(I(x.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(x.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===x.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(m.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=m.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(m.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=m.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",g),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",x.mode),i.set("origin",window.location.origin),i.set("userLanguage",x.userLanguage),x.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=ie({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)),L({iframe:s,content:_({template:c})});var h=!1,y=function(){h||(h=!0,x.networkErrorTimerId=setTimeout((function(){L({iframe:s,content:_({template:d})})}),1e4))};p.onload=y,p.onerror=function(){L({iframe:s,content:_({template:d})})},re(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=se({animation:"end"})}),100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;x.previousPath===n&&O(x.previousConfig,o)||(x.previousPath=n,x.previousConfig=o,oe())}function oe(){var e=document.querySelector(m.sdkDialog);x.sdkIsOpen?x.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(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 re(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e&&n)if("widget"===x.mode){var t=B({type:"widget"}),o=M();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(x.colors.border),")"),n.style.borderRadius="10px")}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.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{a=x.keyboardHeight>0?"calc(100% - ".concat(x.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 ae(){var e,n=null!==(e=document.querySelector(m.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=B({type:"button"});n.id=m.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(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),L({iframe:n,content:(t={unreadMessageCount:x.unreadMessageCount},_({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",I(x.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",I(x.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",I(x.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",ge()))})}}function se(e){return"start"===e.animation?"game"===x.mode?"translateY(20%)":"scale(0.8)":"game"===x.mode?"translateY(0)":"scale(1)"}function le(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 ce(){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(pe(),x.retryRecordRetentionTimerId&&(clearTimeout(x.retryRecordRetentionTimerId),x.retryRecordRetentionTimerId=null),x.retentionRemainingSeconds=null,x.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(x.domain,"/api/sdk/retention"),t=ie({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,le(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(ce,6e4),[3,6];case 6:return[2]}}))}))}function de(){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&&ue()}else ue();null!==x.retentionRemainingSeconds&&(x.recordRetentionTimerId=setTimeout(ce,1e3*x.retentionRemainingSeconds))}function ue(){x.sessionStartTime=new Date,x.retentionRemainingSeconds=x.recordRetentionAfterSecs,x.isRetentionRecordedForSession=!1,pe()}function pe(){x.recordRetentionTimerId&&(clearTimeout(x.recordRetentionTimerId),x.recordRetentionTimerId=null)}function fe(){x.isRetentionRecordedForSession&&ce()}function ge(){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 me(){var e=x.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();x.isInForeground=n,e!==n&&X(),n&&"paused"===x.sessionStatus?de():n||"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",pe()}()}function he(){var e,n=x.isLoggedIn,t=Boolean(x.signedMetadataToken||(null===(e=x.player)||void 0===e?void 0:e.id));x.isLoggedIn=t,t&&!n?G():!t&&n&&Y()}document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",j),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(m.sdkLoaderIframe),t=document.querySelector(m.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)Q();else if("theymes.closeNotification"===e.data.action)U({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&&(ne({path:a.action.path}),U({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(m.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*T)),"support"===x.widgetButtonAction?V():"assistant"===x.widgetButtonAction&&Z();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:S,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),$("open",(function(){x.sdkIsOpen=!0,z()})),$("close",(function(){x.sdkIsOpen=!1,J()})),e.addEventListener=$,e.addField=function(e,n){x.fields[e]=n,oe()},e.addFields=function(e){x.fields=n(n({},x.fields),e),oe()},e.addTag=function(e){x.tags.add(e),oe()},e.addTags=function(e){e.forEach((function(e){return x.tags.add(e)})),oe()},e.close=Q,e.disableLogging=function(){x.loggingEnabled=!1},e.disableNotifications=function(){x.notificationsPaused=!0},e.enableLogging=function(){x.loggingEnabled=!0},e.enableNotifications=function(){x.notificationsPaused=!1,K()},e.getFields=function(){return x.fields},e.getLanguage=function(){return x.language},e.getPlayer=function(){return x.player},e.getSdkVersion=function(){return p},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,m,h,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!==(m=r.button)&&void 0!==m?m:x.widgetButton,x.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(h=r.buttonAction)&&void 0!==h?h: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,x.disableInsets="game"===x.mode&&null!==x.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:x.token,platform:g,mode:x.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,le(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)&&(E=l.branding.colors,x.colors=n(n({},x.colors),E),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),de(),oe(),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:S,removeItem:!0}),c?ne({path:c}):x.widgetButton&&ae(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},e.iosSetKeyboardHeight=function(e){x.keyboardHeight=e,re()},e.isPrivacyMode=function(){return x.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return x.youngPlayer},e.openAssistant=Z,e.openResource=function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},e.openSupport=V,e.recordRetention=function(){x.isRetentionRecordedForSession||ce()},e.removeAllFields=function(){x.fields={},oe()},e.removeAllTags=function(){x.tags.clear(),oe()},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],oe()},e.removeFields=function(e){e.forEach((function(e){return delete x.fields[e]})),oe()},e.removeTag=function(e){x.tags.delete(e),oe()},e.removeTags=function(e){e.forEach((function(e){return x.tags.delete(e)})),oe()},e.requestNotificationPermission=function(){},e.reset=function(){x.language=null,x.tags=new Set,x.fields={},x.signedMetadataToken=null,x.player=null,he(),oe(),H({action:"widgetButtonTextUpdate",text:ge()})},e.setFields=function(e){x.fields=e,oe()},e.setLanguage=function(e){var n=x.language!==e;x.language=e,n&&(oe(),H({action:"widgetButtonTextUpdate",text:ge()}))},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,he(),t&&(oe(),fe())},e.setPrivacyMode=function(e){x.privacyMode=e,oe()},e.setSignedMetadataToken=function(e){var n=x.signedMetadataToken!==e;x.signedMetadataToken=e,he(),n&&(oe(),fe())},e.setTags=function(e){x.tags=new Set(e),oe()},e.setYoungPlayer=function(e){x.youngPlayer=e,oe()}}(this.theymes=this.theymes||{});
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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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"\n 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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: 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-bottom: INSET_BOTTOM_PLACEHOLDER;\n padding-left: INSET_LEFT_PLACEHOLDER;\n padding-right: INSET_RIGHT_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"\n stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"\n class="lucide lucide-x-icon lucide-x">\n <path d="M18 6 6 18" />\n <path d="m6 6 12 12" />\n </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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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="1.2.8",p="colors",f="web",m={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"},h=340,y=680,v=500,b=120,w=48,E=.2,x=.2,T=.2,k="theymes_path_on_init",S="url('https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2') format('woff2')",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,userLanguage:navigator.language,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,isLoggedIn:!1,isInForeground:!0,hasNetworkConnectivity:!0,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,retryIntervalSecs:300,networkErrorTimerId:null,colors:function(){var e=localStorage.getItem(p);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},notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,previousPath:null,previousConfig:null,nonce:null,keyboardHeight:0,disableInsets:!1};var O=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 O(o,n[t])})))};function L(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 I(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function _(e){var n,t,o,i;return e.template.replace(/PLATFORM_PLACEHOLDER/g,f).replace(/INSET_TOP_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-top, 0px)").replace(/INSET_BOTTOM_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)").replace(/INSET_LEFT_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-left, 0px)").replace(/INSET_RIGHT_PLACEHOLDER/g,C.disableInsets?"0px":"env(safe-area-inset-right, 0px)").replace(/CSS_TEXT_PLACEHOLDER/g,I(C.colors.text)).replace(/CSS_BORDER_PLACEHOLDER/g,I(C.colors.border)).replace(/CSS_BACKGROUND_PLACEHOLDER/g,I(C.colors.background)).replace(/CSS_TILE_PLACEHOLDER/g,I(C.colors.tile)).replace(/CSS_ACCENT_PLACEHOLDER/g,I(C.colors.accent)).replace(/CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER/g,I(C.colors.notificationBackground)).replace(/CSS_NOTIFICATION_TEXT_PLACEHOLDER/g,I(C.colors.notificationText)).replace(/CSS_FONT_SIZE_PLACEHOLDER/g,"game"===C.mode?"16px":"14px").replace(/CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER/g,null!==(t=null===(n=C.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:S).replace(/CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER/g,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").replace(/NONCE_ATTR_PLACEHOLDER/g,C.nonce?'nonce="'.concat(C.nonce,'"'):"")}var R='<!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 <title>Theymes</title>\n <style NONCE_ATTR_PLACEHOLDER>\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 font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\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=/(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,A=/CrOS/,N=/android|ipad|playbook|silk/i;function D(){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=P.test(n)&&!A.test(n)||!!e.tablet&&N.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<v||window.innerHeight<v)}function M(e){var n=e.type,t=C.position,o=C.x,i=C.y;return D()&&"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 B(){return D()?{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none"}:{width:"".concat(h,"px"),height:"".concat(y,"px"),maxWidth:"none",maxHeight:"calc(100vh - ".concat(2*C.y,"px)")}}function H(e){var n=document.querySelector(m.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 F(){var e,n,t=C.notifications[0];if(t&&!C.visibleNotification){C.visibleNotification=t;var o=null!==(e=document.querySelector(m.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=m.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",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(m.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=m.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),L({iframe:r,content:(i={text:t.text},_({template:R}).replace(/NOTIFICATION_TEXT_PLACEHOLDER/g,i.text))}),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px",j()}),500),t.closeAfterSeconds>0&&setTimeout((function(){U({notification:t})}),1e3*t.closeAfterSeconds)}}function j(){var e,n,t,o=document.querySelector(m.notificationDialog),i=document.querySelector(m.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=M({type:"widget"}),s=B(),l="calc(".concat(s.width," - 20px)");o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,o.style.overflow="hidden",i.style.width=l}else if(C.element){var c=C.element.getBoundingClientRect();l="".concat(c.width-20,"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"),o.style.overflow="hidden",i.style.width=l}else{l="calc(100% - 20px)";o.style.top=C.disableInsets?"0px":"env(safe-area-inset-top, 0px)",o.style.left=C.disableInsets?"0px":"env(safe-area-inset-left, 0px)",o.style.right=C.disableInsets?"0px":"env(safe-area-inset-right, 0px)",o.style.bottom=C.disableInsets?"0px":"env(safe-area-inset-bottom, 0px)",o.style.overflow="visible",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px"}}function U(e){if(e.notification&&C.visibleNotification===e.notification){var n=document.querySelector(m.notificationIframe),t=document.querySelector(m.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,F()}),1e3*T))}}var q=function(){function e(){Object.defineProperty(this,"isRunning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pollWhenNotificationsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lastPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextPollDate",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.resumeIfNeeded(!1)}return Object.defineProperty(e.prototype,"onIsInForegroundChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){C.isInForeground?this.resumeIfNeeded(!1):this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onHasNetworkConnectivityChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!1)}}),Object.defineProperty(e.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isRunning=!0;var n=new Date;if(this.nextPollDate&&!e||(this.nextPollDate=new Date(n.getTime()+1e3)),n>=this.nextPollDate)this.pollEventsRequest();else{var t=(this.nextPollDate.getTime()-n.getTime())/1e3;this.scheduleNextPollEventsRequest(t)}}}),Object.defineProperty(e.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)}}),Object.defineProperty(e.prototype,"shouldBeRunning",{enumerable:!1,configurable:!0,writable:!0,value:function(){return C.isLoggedIn&&C.isInForeground&&C.hasNetworkConnectivity&&!C.sdkIsOpen}}),Object.defineProperty(e.prototype,"resumeIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){!this.shouldBeRunning()||this.isRunning&&!e||this.resume(e)}}),Object.defineProperty(e.prototype,"pauseIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&!this.shouldBeRunning()&&this.pause()}}),Object.defineProperty(e.prototype,"onEnableNotifications",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isRunning&&this.pollWhenNotificationsEnabled&&this.scheduleNextPollEventsRequest(0)}}),Object.defineProperty(e.prototype,"onOpen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"onClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogin",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.resumeIfNeeded(!0)}}),Object.defineProperty(e.prototype,"onLogout",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.pauseIfNeeded()}}),Object.defineProperty(e.prototype,"scheduleNextPollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;this.nextPollDate=new Date(Date.now()+1e3*e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){n.timer=null,n.pollEventsRequest()}),1e3*e)}}),Object.defineProperty(e.prototype,"pollEventsRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){return t(this,void 0,void 0,(function(){var e,t,r,a,s,c,d,u,g;return o(this,(function(o){switch(o.label){case 0:if(!C.token||!C.domain||!C.deviceId)return[2];if(!this.isRunning)return[2];if(this.lastPollDate&&(e=new Date(this.lastPollDate.getTime()+6e4),(t=(e.getTime()-Date.now())/1e3)>0))return this.scheduleNextPollEventsRequest(t),[2];this.lastPollDate=new Date,r=C.notificationsPaused||C.sdkIsOpen?"true":"false",a=new URLSearchParams(n(n({token:C.token,language:null!==(u=C.language)&&void 0!==u?u:"en",deviceId:C.deviceId,notificationsPaused:r,mode:C.mode},(null===(g=C.player)||void 0===g?void 0:g.id)?{unsignedPlayerId:C.player.id}:{}),C.signedMetadataToken?{signedMetadataToken:C.signedMetadataToken}:{})).toString(),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch("https://".concat(C.domain,"/api/sdk/events?").concat(a),{method:"GET"})];case 2:if(!(s=o.sent()).ok)throw new Error("HTTP error! status: ".concat(s.status));return[4,s.json()];case 3:return c=o.sent(),this.scheduleNextPollEventsRequest(c.nextPollSeconds),void 0!==c.pollWhenNotificationsEnabled&&(this.pollWhenNotificationsEnabled=c.pollWhenNotificationsEnabled),C.notifications=i(i([],C.notifications,!0),c.notifications,!0),C.notifications.length>0&&F(),c.unansweredMessageCount!==C.unansweredMessageCount&&(C.unansweredMessageCount=c.unansweredMessageCount,l("unansweredMessageCountUpdate",[c.unansweredMessageCount])),c.unreadMessageCount!==C.unreadMessageCount&&(C.unreadMessageCount=c.unreadMessageCount,l("unreadMessageCountUpdate",[c.unreadMessageCount]),H({action:"unreadMessageCountUpdate",count:c.unreadMessageCount})),[3,5];case 4:return d=o.sent(),console.error("Error fetching events:",d),this.scheduleNextPollEventsRequest(C.retryIntervalSecs),[3,5];case 5:return[2]}}))}))}}),e}(),W={eventPoller:null},G=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogin()},Y=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onLogout()},z=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onOpen()},J=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onClose()},K=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onEnableNotifications()},X=function(){var e;null===(e=W.eventPoller)||void 0===e||e.onIsInForegroundChanged()},V=function(e){var n="/help-center";te({path:n,config:e}),ne({path:n,config:e})},Z=function(e){var n="/assistant";te({path:n,config:e}),ne({path:n,config:e})},Q=function(){!function(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.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=se({animation:"start"}),setTimeout((function(){t()}),1e3*E)):t()}C.widgetButton&&ae();l("close",[])}()},$=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ee(e){var t,o,r,a,s,l,c=(null!=e?e:{}).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!==(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:C.language)&&void 0!==a?a:null,m=null!==(s=C.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=C.player)&&void 0!==l?l:null,y={_platform:f,_sdkVersion:g};C.youngPlayer&&(y._youngPlayer=!0),(C.privacyMode||C.youngPlayer)&&(y._privacyMode=!0);var v=i(i([],Array.from(C.tags),!0),d,!0),b=n(n(n({},C.fields),u),y);return{token:C.token,domain:C.domain,deviceId:C.deviceId,tags:v,fields:b,language:p,signedMetadataToken:m,player:h}}function ne(e){var n,t,o,i=ee({config:e.config});if(i){var r=null!==(n=document.querySelector(m.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=m.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(m.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=m.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(I(C.colors.background),")"),a.style.transform=se({animation:"start"}),a.style.transition=(C.mode,"opacity ".concat(E,"s ease-in-out, transform ").concat(E,"s ease-in-out")),"widget"===C.mode&&(a.style.overflow="hidden");var s=null!==(o=a.querySelector(m.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");s.id=m.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(m.sdkIframe),g=null!=u?u:document.createElement("iframe"),p=setInterval((function(){var e;"complete"===(null===(e=g.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(p),y())}),500);g.id=m.sdkIframe.replace("#",""),g.style.position="absolute",g.style.border="none",g.style.top="0",g.style.right="0",g.style.bottom="0",g.style.left="0",g.style.colorScheme="auto",u&&!C.networkErrorTimerId||(g.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(C.domain,"/sdk"),i=new URLSearchParams;i.set("platform",f),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",C.mode),i.set("origin",window.location.origin),i.set("userLanguage",C.userLanguage),C.disableInsets&&i.set("disableInsets","true");t.language&&i.set("language",t.language);var r=ie({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),g.style.width="0",g.style.height="0",r.appendChild(a),a.appendChild(s),a.appendChild(g),document.body.appendChild(r)),L({iframe:s,content:_({template:c})});var h=!1,y=function(){h||(h=!0,C.networkErrorTimerId=setTimeout((function(){L({iframe:s,content:_({template:d})})}),1e4))};g.onload=y,g.onerror=function(){L({iframe:s,content:_({template:d})})},re(),l("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=se({animation:"end"})}),100)}}function te(e){var n=e.path,t=e.config,o=null!=t?t:null;C.previousPath===n&&O(C.previousConfig,o)||(C.previousPath=n,C.previousConfig=o,oe())}function oe(){var e=document.querySelector(m.sdkDialog);C.sdkIsOpen?C.forceUpdateSdkDialog=!0:null==e||e.remove()}function ie(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 re(){var e=document.querySelector(m.sdkDialog),n=document.querySelector(m.sdkIframeWrapper);if(e&&n)if("widget"===C.mode){var t=M({type:"widget"}),o=B();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,D()?(n.style.border="none",n.style.borderRadius="0"):(n.style.border="1px solid rgb(".concat(I(C.colors.border),")"),n.style.borderRadius="10px")}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.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{a=C.keyboardHeight>0?"calc(100% - ".concat(C.keyboardHeight,"px + env(safe-area-inset-bottom) - 10px)"):"100%";e.style.width="100%",e.style.height=a,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 ae(){var e,n=null!==(e=document.querySelector(m.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=M({type:"button"});n.id=m.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(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),L({iframe:n,content:(t={unreadMessageCount:C.unreadMessageCount},_({template:u}).replace(/UNREAD_MESSAGE_COUNT_PLACEHOLDER/g,"".concat(t.unreadMessageCount)).replace(/CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER/g,I(C.colors.widgetButtonBackground)).replace(/CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER/g,I(C.colors.widgetButtonText)).replace(/CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER/g,I(C.colors.widgetButtonActionPending)).replace(/WIDGET_BUTTON_TEXT_PLACEHOLDER/g,fe()))})}}function se(e){return"start"===e.animation?"game"===C.mode?"translateY(20%)":"scale(0.8)":"game"===C.mode?"translateY(0)":"scale(1)"}function le(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 ce(){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(ge(),C.retryRecordRetentionTimerId&&(clearTimeout(C.retryRecordRetentionTimerId),C.retryRecordRetentionTimerId=null),C.retentionRemainingSeconds=null,C.isRetentionRecordedForSession=!0,!(e=ee()))return[2];n="https://".concat(C.domain,"/api/sdk/retention"),t=ie({supportViewConfig:e}),i={token:C.token,deviceId:C.deviceId,language:C.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,le(r)];case 3:throw o.sent();case 4:return[3,6];case 5:return a=o.sent(),console.error("Error tracking retention:",a),C.retryRecordRetentionTimerId=setTimeout(ce,6e4),[3,6];case 6:return[2]}}))}))}function de(){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&&ue()}else ue();null!==C.retentionRemainingSeconds&&(C.recordRetentionTimerId=setTimeout(ce,1e3*C.retentionRemainingSeconds))}function ue(){C.sessionStartTime=new Date,C.retentionRemainingSeconds=C.recordRetentionAfterSecs,C.isRetentionRecordedForSession=!1,ge()}function ge(){C.recordRetentionTimerId&&(clearTimeout(C.recordRetentionTimerId),C.recordRetentionTimerId=null)}function pe(){C.isRetentionRecordedForSession&&ce()}function fe(){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 me(){var e=C.isInForeground,n="visible"===document.visibilityState&&document.hasFocus();C.isInForeground=n,e!==n&&X(),n&&"paused"===C.sessionStatus?de():n||"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",ge()}()}function he(){var e,n=C.isLoggedIn,t=Boolean(C.signedMetadataToken||(null===(e=C.player)||void 0===e?void 0:e.id));C.isLoggedIn=t,t&&!n?G():!t&&n&&Y()}document.addEventListener("visibilitychange",me),window.addEventListener("focus",me),window.addEventListener("blur",me),window.addEventListener("resize",re),window.addEventListener("resize",j),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(m.sdkLoaderIframe),t=document.querySelector(m.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)Q();else if("theymes.closeNotification"===e.data.action)U({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&&(ne({path:a.action.path}),U({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(m.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),"support"===C.widgetButtonAction?V():"assistant"===C.widgetButtonAction&&Z();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:k,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),$("open",(function(){C.sdkIsOpen=!0,z()})),$("close",(function(){C.sdkIsOpen=!1,J()})),e.addEventListener=$,e.addField=function(e,n){C.fields[e]=n,oe()},e.addFields=function(e){C.fields=n(n({},C.fields),e),oe()},e.addTag=function(e){C.tags.add(e),oe()},e.addTags=function(e){e.forEach((function(e){return C.tags.add(e)})),oe()},e.close=Q,e.disableLogging=function(){C.loggingEnabled=!1},e.disableNotifications=function(){C.notificationsPaused=!0},e.enableLogging=function(){C.loggingEnabled=!0},e.enableNotifications=function(){C.notificationsPaused=!1,K()},e.getFields=function(){return C.fields},e.getLanguage=function(){return C.language},e.getPlayer=function(){return C.player},e.getSdkVersion=function(){return g},e.getSignedMetadataToken=function(){return C.signedMetadataToken},e.getTags=function(){return Array.from(C.tags)},e.getUnansweredMessageCount=function(){return C.unansweredMessageCount},e.getUnreadMessageCount=function(){return C.unreadMessageCount},e.initialize=function(e,i,r){return t(void 0,void 0,void 0,(function(){var t,a,s,l,c,d,u,g,m,h,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");C.token=e,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!==(g=r.nonce)&&void 0!==g?g:C.nonce,C.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=(t=Date.now(),"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})));return localStorage.setItem("deviceId",n),n;var t}(),C.widgetButton="button"in r&&void 0!==r.button&&null!==(m=r.button)&&void 0!==m?m: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,C.disableInsets="game"===C.mode&&null!==C.element,W.eventPoller||(W.eventPoller=new q),t="https://".concat(i,"/api/sdk/settings"),a=new URLSearchParams({token:C.token,platform:f,mode:C.mode}).toString(),o.label=1;case 1:return o.trys.push([1,6,,7]),[4,fetch("".concat(t,"?").concat(a),{method:"GET"})];case 2:return(s=o.sent()).ok?[3,4]:[4,le(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)&&(E=l.branding.colors,C.colors=n(n({},C.colors),E),localStorage.setItem(p,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),de(),oe(),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:k,removeItem:!0}),c?ne({path:c}):C.widgetButton&&ae(),[3,7];case 6:return d=o.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var E}))}))},e.iosSetKeyboardHeight=function(e){C.keyboardHeight=e,re()},e.isPrivacyMode=function(){return C.privacyMode},e.isSupported=function(){return!0},e.isYoungPlayer=function(){return C.youngPlayer},e.openAssistant=Z,e.openResource=function(e,n){var t="/resources/".concat(e);te({path:t,config:n}),ne({path:t,config:n})},e.openSupport=V,e.recordRetention=function(){C.isRetentionRecordedForSession||ce()},e.removeAllFields=function(){C.fields={},oe()},e.removeAllTags=function(){C.tags.clear(),oe()},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 C.fields[e],oe()},e.removeFields=function(e){e.forEach((function(e){return delete C.fields[e]})),oe()},e.removeTag=function(e){C.tags.delete(e),oe()},e.removeTags=function(e){e.forEach((function(e){return C.tags.delete(e)})),oe()},e.requestNotificationPermission=function(){},e.reset=function(){C.language=null,C.tags=new Set,C.fields={},C.signedMetadataToken=null,C.player=null,he(),oe(),H({action:"widgetButtonTextUpdate",text:fe()})},e.setFields=function(e){C.fields=e,oe()},e.setLanguage=function(e){var n=C.language!==e;C.language=e,n&&(oe(),H({action:"widgetButtonTextUpdate",text:fe()}))},e.setPlayer=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,he(),t&&(oe(),pe())},e.setPrivacyMode=function(e){C.privacyMode=e,oe()},e.setSignedMetadataToken=function(e){var n=C.signedMetadataToken!==e;C.signedMetadataToken=e,he(),n&&(oe(),pe())},e.setTags=function(e){C.tags=new Set(e),oe()},e.setYoungPlayer=function(e){C.youngPlayer=e,oe()}}(this.theymes=this.theymes||{});
package/dist/utils.d.ts CHANGED
@@ -19,3 +19,4 @@ export declare function renderColor(color: ThemeColor): string;
19
19
  export declare function renderTemplate(args: {
20
20
  template: string;
21
21
  }): string;
22
+ export declare function uuidv4(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theymes/sdk",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "type": "module",
5
5
  "main": "dist/sdk.cjs.js",
6
6
  "module": "dist/sdk.esm.js",