{"version":3,"sources":["webpack:///./node_modules/@chatwoot/utils/dist/utils.esm.js","webpack:///./app/javascript/widget/components/TeamAvailability.vue?876b","webpack:///./app/javascript/widget/components/TeamAvailability.vue?3c25","webpack:///app/javascript/widget/components/TeamAvailability.vue","webpack:///./app/javascript/widget/components/TeamAvailability.vue?eb3d","webpack:///./app/javascript/widget/components/TeamAvailability.vue","webpack:///./app/javascript/widget/views/Home.vue?345f","webpack:///./app/javascript/widget/views/Home.vue?a7be","webpack:///app/javascript/widget/views/Home.vue","webpack:///./app/javascript/widget/views/Home.vue?c87c","webpack:///./app/javascript/widget/views/Home.vue"],"names":["debounce","func","wait","immediate","timeout","context","args","arguments","later","apply","callNow","clearTimeout","window","setTimeout","getContrastingTextColor","bgColor","color","replace","parseInt","slice","formatTime","timeInSeconds","formattedTime","minutes","Math","floor","seconds","hours","_minutes","days","_hours","trimContent","content","maxLength","ellipsis","trimmedContent","length","substring","parseBoolean","candidate","candidateString","String","toLowerCase","Boolean","JSON","parse","error","sortAsc","arr","sort","a","b","_quantileForSorted","sorted","q","min","max","value","clamped","pos","base","rest","undefined","getQuantileIntervals","data","intervals","map","interval","component","_vm","this","_h","$createElement","_c","_self","staticClass","_v","_s","replyWaitMessage","routePage","getIsChatOnLine","_e","attrs","GetAvailableAgents","conversationSize"],"mappings":"uSAaA,IAAIA,EAAW,SAAkBC,EAAMC,EAAMC,GAC3C,IAAIC,EACJ,OAAO,WACL,IAAIC,EAAU,KACVC,EAAOC,UAEPC,EAAQ,WACVJ,EAAU,KACLD,GAAWF,EAAKQ,MAAMJ,EAASC,IAGlCI,EAAUP,IAAcC,EAC5BO,aAAaP,GACbA,EAAUQ,OAAOC,WAAWL,EAAON,GAC/BQ,GAAST,EAAKQ,MAAMJ,EAASC,KAWjCQ,EAA0B,SAAiCC,GAC7D,IAAIC,EAAQD,EAAQE,QAAQ,IAAK,IAKjC,MAAW,KAJHC,SAASF,EAAMG,MAAM,EAAG,GAAI,IAIb,KAHfD,SAASF,EA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EAEA,sBACA,4CACA,oDACA,sDACA,sEAEA,2CACA,0DAZA,IAcA,mBAdA,WAgBA,UAEA,mBAlBA,WAmBA,2CAEA,gBArBA,WAsBA,kDAEA,UAxBA,WAyBA,iCAEA,gBA3BA,WA6BA,OADA,6DACA,sBAEA,mBA/BA,WAqCA,MALA,CACA,SACA,YACA,aACA,qCAIA,OACA,iBADA,SACA,KACA,yBAEA,QACA,yBACA,sBACA,2BAEA,6CACA,gDAGA,OAbA,SAaA,KAOA,OANA,YACA,6BACA,EACA,EACA,aAEA,cAGA,QA/EA,WAgFA,sDAEA,SACA,UADA,WAEA,oBAEA,kBAJA,WAIA,I,EAAA,OACA,mBACA,8D,EACA,mIACA,iEADA,SAEC,OAAD,IAAC,GAFD,UAEA,EAFA,OAGA,+DACA,YACA,EACA,mDACA,OACA,sBAGA,+BACA,uBAZA,wBAcA,iDACA,0CAfA,kBAgBA,4BAhBA,eAkBA,iDACA,0CAnBA,kBAoBA,gCApBA,2C,oLCpHyM,I,iBCQrMA,EAAY,YACd,GHTW,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAQF,EAAmB,gBAAEI,EAAG,MAAM,CAACA,EAAG,MAAM,CAACE,YAAY,oCAAoC,CAACN,EAAIO,GAAG,SAASP,EAAIQ,GAAGR,EAAIU,WAAW,YAAcV,EAAIW,gBAAgNX,EAAIY,KAAnMR,EAAG,MAAM,CAACE,YAAY,4BAA4B,CAACF,EAAG,oBAAoB,CAACE,YAAY,MAAMO,MAAM,CAAC,mBAAmBb,EAAIc,mBAAmB,qBAAqBd,EAAIe,qBAAqB,KAC1a,IGWpB,EACA,KACA,WACA,MAIa,UAAAhB,E","file":"js/29-716e9f44e215f5cb9df1.chunk.js","sourcesContent":["import isToday from 'date-fns/isToday';\nimport isYesterday from 'date-fns/isYesterday'; // Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\n\n/**\r\n * @func Callback function to be called after delay\r\n * @delay Delay for debounce in ms\r\n * @immediate should execute immediately\r\n * @returns debounced callback function\r\n */\n\nvar debounce = function debounce(func, wait, immediate) {\n  var timeout;\n  return function () {\n    var context = null;\n    var args = arguments;\n\n    var later = function later() {\n      timeout = null;\n      if (!immediate) func.apply(context, args);\n    };\n\n    var callNow = immediate && !timeout;\n    clearTimeout(timeout);\n    timeout = window.setTimeout(later, wait);\n    if (callNow) func.apply(context, args);\n  };\n};\n/**\r\n * @name Get contrasting text color\r\n * @description Get contrasting text color from a text color\r\n * @param bgColor  Background color of text.\r\n * @returns contrasting text color\r\n */\n\n\nvar getContrastingTextColor = function getContrastingTextColor(bgColor) {\n  var color = bgColor.replace('#', '');\n  var r = parseInt(color.slice(0, 2), 16);\n  var g = parseInt(color.slice(2, 4), 16);\n  var b = parseInt(color.slice(4, 6), 16); // http://stackoverflow.com/a/3943023/112731\n\n  return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF';\n};\n/**\r\n * @name Get formatted date\r\n * @description Get date in today, yesterday or any other date format\r\n * @param date  date\r\n * @param todayText  Today text\r\n * @param yesterdayText  Yesterday text\r\n * @returns formatted date\r\n */\n\n\nvar formatDate = function formatDate(_ref) {\n  var date = _ref.date,\n      todayText = _ref.todayText,\n      yesterdayText = _ref.yesterdayText;\n  var dateValue = new Date(date);\n  if (isToday(dateValue)) return todayText;\n  if (isYesterday(dateValue)) return yesterdayText;\n  return date;\n};\n/**\r\n * @name formatTime\r\n * @description Format time to Hour, Minute and Second\r\n * @param timeInSeconds  number\r\n * @returns formatted time\r\n */\n\n\nvar formatTime = function formatTime(timeInSeconds) {\n  var formattedTime = '';\n\n  if (timeInSeconds >= 60 && timeInSeconds < 3600) {\n    var minutes = Math.floor(timeInSeconds / 60);\n    formattedTime = minutes + \" Min\";\n    var seconds = minutes === 60 ? 0 : Math.floor(timeInSeconds % 60);\n    return formattedTime + (\"\" + (seconds > 0 ? ' ' + seconds + ' Sec' : ''));\n  }\n\n  if (timeInSeconds >= 3600 && timeInSeconds < 86400) {\n    var hours = Math.floor(timeInSeconds / 3600);\n    formattedTime = hours + \" Hr\";\n\n    var _minutes = timeInSeconds % 3600 < 60 || hours === 24 ? 0 : Math.floor(timeInSeconds % 3600 / 60);\n\n    return formattedTime + (\"\" + (_minutes > 0 ? ' ' + _minutes + ' Min' : ''));\n  }\n\n  if (timeInSeconds >= 86400) {\n    var days = Math.floor(timeInSeconds / 86400);\n    formattedTime = days + \" Day\";\n\n    var _hours = timeInSeconds % 86400 < 3600 || days >= 364 ? 0 : Math.floor(timeInSeconds % 86400 / 3600);\n\n    return formattedTime + (\"\" + (_hours > 0 ? ' ' + _hours + ' Hr' : ''));\n  }\n\n  return Math.floor(timeInSeconds) + \" Sec\";\n};\n/**\r\n * @name trimContent\r\n * @description Trim a string to max length\r\n * @param content String to trim\r\n * @param maxLength Length of the string to trim, default 1024\r\n * @param ellipsis Boolean to add dots at the end of the string, default false\r\n * @returns trimmed string\r\n */\n\n\nvar trimContent = function trimContent(content, maxLength, ellipsis) {\n  if (content === void 0) {\n    content = '';\n  }\n\n  if (maxLength === void 0) {\n    maxLength = 1024;\n  }\n\n  if (ellipsis === void 0) {\n    ellipsis = false;\n  }\n\n  var trimmedContent = content;\n\n  if (content.length > maxLength) {\n    trimmedContent = content.substring(0, maxLength);\n  }\n\n  if (ellipsis) {\n    trimmedContent = trimmedContent + '...';\n  }\n\n  return trimmedContent;\n};\n/**\r\n * Function that parses a string boolean value and returns the corresponding boolean value\r\n * @param {string | number} candidate - The string boolean value to be parsed\r\n * @return {boolean} - The parsed boolean value\r\n */\n\n\nfunction parseBoolean(candidate) {\n  try {\n    // lowercase the string, so TRUE becomes true\n    var candidateString = String(candidate).toLowerCase(); // wrap in boolean to ensure that the return value\n    // is a boolean even if values like 0 or 1 are passed\n\n    return Boolean(JSON.parse(candidateString));\n  } catch (error) {\n    return false;\n  }\n}\n/**\r\n * Sorts an array of numbers in ascending order.\r\n * @param {number[]} arr - The array of numbers to be sorted.\r\n * @returns {number[]} - The sorted array.\r\n */\n\n\nfunction sortAsc(arr) {\n  // .slice() is used to create a copy of the array so that the original array is not mutated\n  return arr.slice().sort(function (a, b) {\n    return a - b;\n  });\n}\n/**\r\n * Calculates the quantile value of an array at a specified percentile.\r\n * @param {number[]} arr - The array of numbers to calculate the quantile value from.\r\n * @param {number} q - The percentile to calculate the quantile value for.\r\n * @returns {number} - The quantile value.\r\n */\n\n\nfunction quantile(arr, q) {\n  var sorted = sortAsc(arr); // Sort the array in ascending order\n\n  return _quantileForSorted(sorted, q); // Calculate the quantile value\n}\n/**\r\n * Clamps a value between a minimum and maximum range.\r\n * @param {number} min - The minimum range.\r\n * @param {number} max - The maximum range.\r\n * @param {number} value - The value to be clamped.\r\n * @returns {number} - The clamped value.\r\n */\n\n\nfunction clamp(min, max, value) {\n  if (value < min) {\n    return min;\n  }\n\n  if (value > max) {\n    return max;\n  }\n\n  return value;\n}\n/**\r\n * This method assumes the the array provided is already sorted in ascending order.\r\n * It's a helper method for the quantile method and should not be exported as is.\r\n *\r\n * @param {number[]} arr - The array of numbers to calculate the quantile value from.\r\n * @param {number} q - The percentile to calculate the quantile value for.\r\n * @returns {number} - The quantile value.\r\n */\n\n\nfunction _quantileForSorted(sorted, q) {\n  var clamped = clamp(0, 1, q); // Clamp the percentile between 0 and 1\n\n  var pos = (sorted.length - 1) * clamped; // Calculate the index of the element at the specified percentile\n\n  var base = Math.floor(pos); // Find the index of the closest element to the specified percentile\n\n  var rest = pos - base; // Calculate the decimal value between the closest elements\n  // Interpolate the quantile value between the closest elements\n  // Most libraries don't to the interpolation, but I'm just having fun here\n  // also see https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample\n\n  if (sorted[base + 1] !== undefined) {\n    // in case the position was a integer, the rest will be 0 and the interpolation will be skipped\n    return sorted[base] + rest * (sorted[base + 1] - sorted[base]);\n  } // Return the closest element if there is no interpolation possible\n\n\n  return sorted[base];\n}\n/**\r\n * Calculates the quantile values for an array of intervals.\r\n * @param {number[]} data - The array of numbers to calculate the quantile values from.\r\n * @param {number[]} intervals - The array of intervals to calculate the quantile values for.\r\n * @returns {number[]} - The array of quantile values for the intervals.\r\n */\n\n\nvar getQuantileIntervals = function getQuantileIntervals(data, intervals) {\n  // Sort the array in ascending order before looping through the intervals.\n  // depending on the size of the array and the number of intervals, this can speed up the process by at least twice\n  // for a random array of 100 numbers and 5 intervals, the speedup is 3x\n  var sorted = sortAsc(data);\n  return intervals.map(function (interval) {\n    return _quantileForSorted(sorted, interval);\n  });\n};\n\nexport { clamp, debounce, formatDate, formatTime, getContrastingTextColor, getQuantileIntervals, parseBoolean, quantile, sortAsc, trimContent };","export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js!../../../../node_modules/css-loader/dist/cjs.js??ref--3-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--3-2!../../../../node_modules/sass-loader/dist/cjs.js??ref--3-3!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./TeamAvailability.vue?vue&type=style&index=0&id=371dd6f7&prod&scoped=true&lang=scss\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"space\"},[_c('div',{staticClass:\"messageText  mb-4\"},[_c('div',[_vm._v(\"\\n      \"+_vm._s(_vm.replyWaitMessage)+\"\\n    \")])])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n  <div class=\"space\">\r\n    <div class=\"messageText  mb-4\">\r\n      <!-- <div\r\n         <div class=\"flex items-center justify-between   mb-4\">\r\n        class=\"max-w-xs\"\r\n        :class=\"$dm('text-black-700', 'dark:text-slate-50')\"\r\n      > -->\r\n      <div>\r\n        {{ replyWaitMessage }}\r\n      </div>\r\n      <!-- <div class=\"text-xs leading-4 mt-1\" /> -->\r\n      <!-- </div> -->\r\n      <!-- <available-agents v-if=\"isOnline\" :agents=\"availableAgents\" /> -->\r\n    </div>\r\n  </div>\r\n</template>\r\n\r\n<script>\r\nimport { mapGetters } from 'vuex';\r\nimport { getContrastingTextColor } from '@chatwoot/utils';\r\n// import AvailableAgents from 'widget/components/AvailableAgents.vue';\r\n// import CustomButton from 'shared/components/Button';\r\nimport configMixin from 'widget/mixins/configMixin';\r\nimport availabilityMixin from 'widget/mixins/availability';\r\nimport darkMixin from 'widget/mixins/darkModeMixin.js';\r\n\r\nexport default {\r\n  name: 'TeamAvailability',\r\n  // components: {\r\n  //   // AvailableAgents,\r\n  //   // CustomButton,\r\n  // },\r\n  mixins: [configMixin, availabilityMixin, darkMixin],\r\n  props: {\r\n    availableAgents: {\r\n      type: Array,\r\n      default: () => [],\r\n    },\r\n    hasConversation: {\r\n      type: Boolean,\r\n      default: false,\r\n    },\r\n  },\r\n\r\n  computed: {\r\n    ...mapGetters({\r\n      widgetColor: 'appConfig/getWidgetColor',\r\n      getDataIsChatOnLine: 'conversation/getDataIsChatOnLine',\r\n    }),\r\n    textColor() {\r\n      return getContrastingTextColor(this.widgetColor);\r\n    },\r\n    getIsChatOnLine() {\r\n      return this.getDataIsChatOnLine.isChatOnline === true;\r\n    },\r\n    isOnline() {\r\n      // WH added new state of aviability in store\r\n      return this.getIsChatOnLine;\r\n    },\r\n    replyWaitMessage() {\r\n      //   return this.getDataIsChatOnLine.onLineMassage;\r\n      if (this.isOnline) {\r\n        return ' ';\r\n      }\r\n      const { onLineMassage } = this.getDataIsChatOnLine;\r\n      const message = onLineMassage || 'We are unavailable at the moment.';\r\n      return message;\r\n    },\r\n  },\r\n};\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.space {\r\n  display: flex;\r\n  align-items: center !important;\r\n  justify-content: center !important;\r\n  margin: 1px;\r\n  padding: 3px;\r\n  line-height: 1.5rem !important;\r\n  font-size: 1.2rem !important;\r\n  font-weight: 500 !important;\r\n}\r\n.messageText {\r\n  display: flex;\r\n  align-items: center !important;\r\n  justify-content: center !important;\r\n  margin: 1px;\r\n  padding: 3px;\r\n}\r\n</style>\r\n","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js??ref--7-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./TeamAvailability.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js??ref--7-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./TeamAvailability.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./TeamAvailability.vue?vue&type=template&id=371dd6f7&scoped=true\"\nimport script from \"./TeamAvailability.vue?vue&type=script&lang=js\"\nexport * from \"./TeamAvailability.vue?vue&type=script&lang=js\"\nimport style0 from \"./TeamAvailability.vue?vue&type=style&index=0&id=371dd6f7&prod&scoped=true&lang=scss\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"371dd6f7\",\n  null\n  \n)\n\nexport default component.exports","export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js!../../../../node_modules/css-loader/dist/cjs.js??ref--3-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--3-2!../../../../node_modules/sass-loader/dist/cjs.js??ref--3-3!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=style&index=0&id=b0c58a06&prod&scoped=true&lang=scss\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.getIsChatOnLine)?_c('div',[_c('div',{staticClass:\"flex flex-1 flex-col justify-end\"},[_vm._v(\"\\n    \"+_vm._s(_vm.routePage)+\"\\n  \")])]):(!_vm.getIsChatOnLine)?_c('div',{staticClass:\"flex flex-1 flex-col box\"},[_c('team-availability',{staticClass:\"box\",attrs:{\"available-agents\":_vm.GetAvailableAgents,\"has-conversation\":!!_vm.conversationSize}})],1):_vm._e()}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<!-- eslint-disable no-console -->\r\n<template>\r\n  <div v-if=\"getIsChatOnLine\">\r\n    <div class=\"flex flex-1 flex-col justify-end\">\r\n      {{ routePage }}\r\n    </div>\r\n    <!--   <div class=\"flex flex-1 overflow-auto\"> -->\r\n  </div>\r\n  <div v-else-if=\"!getIsChatOnLine\" class=\"flex flex-1 flex-col box\">\r\n    <!-- Load Conversation List Components Here -->\r\n    <team-availability\r\n      class=\"box\"\r\n      :available-agents=\"GetAvailableAgents\"\r\n      :has-conversation=\"!!conversationSize\"\r\n    />\r\n  </div>\r\n</template>\r\n\r\n<script>\r\nimport configMixin from '../mixins/configMixin';\r\nimport TeamAvailability from 'widget/components/TeamAvailability';\r\nimport { mapState, mapGetters } from 'vuex';\r\nimport routerMixin from 'widget/mixins/routerMixin';\r\nimport { CONVERSATION_STATUS } from 'shared/constants/messages';\r\nimport { getConversationAPI } from 'widget/api/conversation';\r\n// import { isEmptyObject } from 'widget/helpers/utils';\r\n\r\nexport default {\r\n  name: 'Home',\r\n  components: {\r\n    TeamAvailability,\r\n  },\r\n  mixins: [configMixin, routerMixin],\r\n  props: {\r\n    hasFetched: {\r\n      type: Boolean,\r\n      default: false,\r\n    },\r\n    isCampaignViewClicked: {\r\n      type: Boolean,\r\n      default: false,\r\n    },\r\n  },\r\n  computed: {\r\n    ...mapState({\r\n      status: state => state.conversationAttributes.status, // uiFlags.isCreating\r\n      isCreating: state => state.conversation.uiFlags.isCreating,\r\n    }),\r\n    ...mapGetters({\r\n      activeCampaign: 'campaign/getActiveCampaign',\r\n      conversationSize: 'conversation/getConversationSize',\r\n      groupedMessages: 'conversation/getGroupedConversation',\r\n      conversationAttributes: 'conversationAttributes/getConversationParams',\r\n      // availableAgents: 'agent/availableAgents',\r\n      getIsCreating: 'conversation/getIsCreating',\r\n      getDataIsChatOnLine: 'conversation/getDataIsChatOnLine',\r\n    }),\r\n    GetAvailableAgents() {\r\n      //  return this.availableAgents;\r\n      return [];\r\n    },\r\n    conversationStatus() {\r\n      return this.conversationAttributes.status;\r\n    },\r\n    getIsChatOnLine() {\r\n      return this.getDataIsChatOnLine.isChatOnline === true;\r\n    },\r\n    routePage() {\r\n      return this.routeRelevantPage();\r\n    },\r\n    groupedMessages() {\r\n      console.log('GGGGGGGGGGGGGGGGGGGGGGGG', this.groupedMessages);\r\n      return this.groupedMessages;\r\n    },\r\n    ifOpenConversation() {\r\n      let currentstatus = [\r\n        CONVERSATION_STATUS.OPEN,\r\n        CONVERSATION_STATUS.SNOOZED,\r\n        CONVERSATION_STATUS.PENDING,\r\n      ].includes(this.conversationStatus);\r\n      return currentstatus;\r\n    },\r\n  },\r\n  watch: {\r\n    conversationSize(newSize, oldSize) {\r\n      const { name: routeName } = this.$route;\r\n      if (\r\n        (!oldSize && newSize > oldSize) ||\r\n        this.conversationStatus ||\r\n        this.status === 'open' ||\r\n        this.getStatus === 'open'\r\n      ) {\r\n        console.log('replaceRoute', this.$route.name);\r\n        if (routeName !== 'messages') this.replaceRoute('messages');\r\n      }\r\n    },\r\n    status(newStatus, oldStatus) {\r\n      console.log(\r\n        'watch newStatus, oldStatus',\r\n        newStatus,\r\n        oldStatus,\r\n        this.status\r\n      );\r\n      return this.status;\r\n    },\r\n  },\r\n  mounted() {\r\n    this.$store.dispatch('conversation/setUserLastSeen');\r\n  },\r\n  methods: {\r\n    getStatus() {\r\n      return this.status;\r\n    },\r\n    routeRelevantPage() {\r\n      let num = Math.random() * 10;\r\n      this.$store.dispatch('conversationAttributes/getAttributes');\r\n      (async () => {\r\n        console.log(num, 'before getConversationAPI ', this.conversationStatus);\r\n        let result = await getConversationAPI();\r\n        console.log(num, 'after getConversationAPI', this.conversationStatus);\r\n        console.log(\r\n          num,\r\n          '############### before check conversationStatus ',\r\n          result.data,\r\n          this.conversationStatus\r\n        );\r\n        if (\r\n          this.conversationStatus === 'open' ||\r\n          result.data.status === 'open'\r\n        ) {\r\n          console.log(num, '############### messages Route ');\r\n          console.log('replaceRoute', this.$route.name);\r\n          return this.replaceRoute('messages');\r\n        }\r\n        console.log(num, '###############Pre Chat Route 1');\r\n        console.log('replaceRoute', this.$route.name);\r\n        return this.replaceRoute('prechat-form');\r\n      })();\r\n    },\r\n  },\r\n};\r\n</script>\r\n\r\n<style scoped lang=\"scss\">\r\n.justify-end-wh {\r\n  justify-content: center !important;\r\n}\r\n.box {\r\n  display: flex;\r\n  align-items: center !important;\r\n  justify-content: center !important;\r\n}\r\n</style>\r\n","import mod from \"-!../../../../node_modules/babel-loader/lib/index.js??ref--7-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../node_modules/babel-loader/lib/index.js??ref--7-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Home.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./Home.vue?vue&type=template&id=b0c58a06&scoped=true\"\nimport script from \"./Home.vue?vue&type=script&lang=js\"\nexport * from \"./Home.vue?vue&type=script&lang=js\"\nimport style0 from \"./Home.vue?vue&type=style&index=0&id=b0c58a06&prod&scoped=true&lang=scss\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"b0c58a06\",\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}