"use strict";define(["handlebars","View","text!/v2/components/SessionTimeout/Templates/SessionTimeoutTemplate.html","text!/v2/components/SessionTimeout/Templates/SessionTimeoutTemplate2.html","utils"],function(e,d,f,c,b){var a=d.extend({id:"sessionTimeout",overlay:null,callback:null,timeLeft:0,intervalId:null,sessionTimeoutTemplate:null,events:{"click #yes,#no":"yesNo"},yesNo:function(h){this.trigger("view:close");this.overlay.close();if(this.callback){var g=$(h.target).data("value");this.callback.apply(this,[g===1]);}},initialize:function(g){d.prototype.initialize.apply(this,arguments);this.options=g||{};this.overlay=this.options.parent;window.clearInterval(this.intervalId);this.intervalId=window.setInterval(_.bind(this.increment,this),1000);},increment:function(){var g=this.$el.find("#timeLeft");if(g.length){g.html(b.localize(this,["sessionTimeout.sessionClosing",this.timeLeft]));this.timeLeft-=1;if(this.timeLeft<0){this.timeLeft=0;}}},render:function(g,h){d.prototype.render.apply(this,arguments);this.setParent(g.parent);this.callback=h;this.timeLeft=g.timeLeft;this.sessionTimeoutTemplate=(g.framework==="semantic")?e.compile(c):e.compile(f);this.$el.html(this.sessionTimeoutTemplate({timeLeft:g.timeLeft}));this.overlay.render().$el.find("#overlay").html(this.$el);g.parent.$el.append(this.overlay.$el);return this;}});return a;});