text: "use strict";(function($){$.fn.flowchat=function(options){var settings=$.extend({delay:1500,startButtonId:'#startButton',autoStart:!0,startMessageId:1,dataJSON:null},options);var container=$(this);$(function(){if(settings.autoStart)
  startChat(container,settings.dataJSON,settings.startMessageId,settings.delay)});$(document).on('click',settings.startButtonId,function(){startChat(container,settings.dataJSON,settings.startMessageId,settings.delay)})}
  function selectOption($this,container,data,delay){console.log("here");$this.parent().hide();var $userReply=$('<li class="user"><div class="text">'+$this.html()+'</div></li>');container.children('.chat-window').append($userReply);var nextMessageId=$this.attr('data-nextId');var nextMessage=findMessageInJsonById(data,nextMessageId);generateMessageHTML(container,data,nextMessage,delay)}
  function startChat(container,data,startId,delay){container.html("");container.append("<ul class='chat-window'></ul>");var message=findMessageInJsonById(data,startId);generateMessageHTML(container,data,message,delay)}
  function findMessageInJsonById(data,id){var messages=data;for(var i=0;messages.length>i;i ++)
  if(messages[i].id==id)
  return messages[i]}
  function addOptions(container,data,delay,m){var $optionsContainer=$('<li class="options"></li>');var $optionsList=$('<ul></ul>');var optionText=null;var optionMessageId=null;for(var i=1;i<6;i++){optionText=m["option"+i]
  optionMessageId=m["option"+i+"_nextMessageId"]
  if(optionText!=""&&optionText!=undefined&&optionText!=null){var $optionElem=$("<li data-nextId="+optionMessageId+">"+optionText+"</li>");$optionElem.click(function(){selectOption($(this),container,data,delay)});$optionsList.append($optionElem)}}
  $optionsContainer.append($optionsList);return $optionsContainer}
  function toggleLoader(status,container){if(status=="show")
  container.children('.chat-window').append("<li class='typing-indicator'><span></span><span></span><span></span></li>");else container.find('.typing-indicator').remove()}
  function generateMessageHTML(container,messages,m,delay){var $template=$('<li class="bot"><div class="text">'+m.text+'</div></li>');toggleLoader("show",container);container.children(".chat-window").scrollTop($(".chat-window").prop('scrollHeight'));setTimeout(function(){toggleLoader("hide",container);container.children('.chat-window').append($template);if(m.messageType=="Question")
  container.children('.chat-window').append(addOptions(container,messages,delay,m));container.children(".chat-window").scrollTop($(".chat-window").prop('scrollHeight'));if(m.nextMessageId!=""){var nextMessage=findMessageInJsonById(messages,m.nextMessageId)
  generateMessageHTML(container,messages,nextMessage,delay)}},delay)}}(jQuery))