var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,t){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:t})}else{e.raw=t}return e};var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};import{r as registerInstance,h as h$1}from"./index-38ad4957.js";import{n as h}from"./dom-context-hooks.module-50442785.js";import{d as dist,J,w as wn,s as setUserIdentity,i as isDemo}from"./index.module-b23fdad8.js";import{c as cjs}from"./cjs-bdfb4486.js";import{g as getProps}from"./utils-334c1e34.js";import"./JSS-67b5cff8.js";import{L as LogoutCurrentUserView}from"./sqm-logout-current-user-view-376c1bf6.js";var GET_USER_DETAILS=dist.gql(templateObject_1||(templateObject_1=__makeTemplateObject(["\n  query getUserDetails {\n    viewer {\n      ... on User {\n        id\n        accountId\n        email\n      }\n    }\n  }\n"],["\n  query getUserDetails {\n    viewer {\n      ... on User {\n        id\n        accountId\n        email\n      }\n    }\n  }\n"])));function useLogoutCurrentUser(e){var t,r;var n=J();var i=wn(GET_USER_DETAILS,{},!n),s=i.loading,o=i.data;var a=function(){setUserIdentity(undefined)};var u=(t=e.userIdentificationText)===null||t===void 0?void 0:t.replace("{email}",(r=o===null||o===void 0?void 0:o.viewer)===null||r===void 0?void 0:r.email);return __assign({loading:s,onSwitchClick:a,filledInEmailText:u},e)}var LogoutCurrentUser=function(){function e(e){registerInstance(this,e);this.userIdentificationText="{email}";this.switchUserText="not you?";this.emailErrorText="Error fetching email";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?useDemoLogoutCurrentUser(this):useLogoutCurrentUser(getProps(this));var t={userIdentificationText:this.userIdentificationText,switchUserText:this.switchUserText,emailErrorText:this.emailErrorText};return h$1(LogoutCurrentUserView,Object.assign({},e,t))};return e}();function useDemoLogoutCurrentUser(e){return cjs({onSwitchClick:function(){return setUserIdentity(undefined)},filledInEmailText:"john@example.com",switchUserText:e.switchUserText,emailErrorText:e.emailErrorText,loading:false},e.demoData||{},{arrayMerge:function(e,t){return t}})}export{LogoutCurrentUser as sqm_logout_current_user};var templateObject_1;