!function(n){"use strict";function i(n){for(var t=window,i=n.split("."),u=i.pop(),r=0,f=i.length;f>r;r++)t=t[i[r]];return function(){t[u].call(this)}}var t,r;if(!n.fn.popover)throw new Error("Confirmation requires popover.js");t=function(t,i){this.init("confirmation",t,i);var r=this;this.options.selector||(this.$element.attr("href")&&(this.options.href=this.$element.attr("href"),this.$element.removeAttr("href"),this.$element.attr("target")&&(this.options.target=this.$element.attr("target"))),this.$element.on(r.options.trigger,function(n,t){t||(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation())}),this.$element.on("confirmed.bs.confirmation",function(){n(this).trigger(r.options.trigger,[!0])}),this.$element.on("show.bs.confirmation",function(){r.options.singleton&&n(r.options._selector).not(n(this)).filter(function(){return void 0!==n(this).data("bs.confirmation")}).confirmation("hide")}));this.options._isDelegate||(this.eventBody=!1,this.uid=this.$element[0].id||this.getUID("group_"),this.$element.on("shown.bs.confirmation",function(){r.options.popout&&!r.eventBody&&(n(this),r.eventBody=n("body").on("click.bs.confirmation."+r.uid,function(t){n(r.options._selector).is(t.target)||(n(r.options._selector).filter(function(){return void 0!==n(this).data("bs.confirmation")}).confirmation("hide"),n("body").off("click.bs."+r.uid),r.eventBody=!1)}))}))};t.DEFAULTS=n.extend({},n.fn.popover.Constructor.DEFAULTS,{placement:"top",title:"Are you sure?",html:!0,href:!1,popout:!1,singleton:!1,target:"_self",onConfirm:n.noop,onCancel:n.noop,btnOkClass:"btn-xs btn-primary",btnOkIcon:"glyphicon glyphicon-ok",btnOkLabel:"Yes",btnCancelClass:"btn-xs btn-default",btnCancelIcon:"glyphicon glyphicon-remove",btnCancelLabel:"No",template:'<div class="popover confirmation"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content text-center"><div class="btn-group"><a class="btn" data-apply="confirmation"><\/a><a class="btn" data-dismiss="confirmation"><\/a><\/div><\/div><\/div>'});t.prototype=n.extend({},n.fn.popover.Constructor.prototype);t.prototype.constructor=t;t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.init=function(t,i,r){n.fn.popover.Constructor.prototype.init.call(this,t,i,r);this.options._isDelegate=!1;r.selector?this.options._selector=this._options._selector=r._root_selector+" "+r.selector:r._selector?(this.options._selector=r._selector,this.options._isDelegate=!0):this.options._selector=r._root_selector};t.prototype.setContent=function(){var t=this,r=this.tip(),i=this.options;r.find(".popover-title")[i.html?"html":"text"](this.getTitle());r.find('[data-apply="confirmation"]').addClass(i.btnOkClass).html(i.btnOkLabel).prepend(n("<i><\/i>").addClass(i.btnOkIcon)," ").off("click").one("click",function(){t.getOnConfirm.call(t).call(t.$element);t.$element.trigger("confirmed.bs.confirmation");t.leave(t)});i.href&&r.find('[data-apply="confirmation"]').attr({href:i.href,target:i.target});r.find('[data-dismiss="confirmation"]').addClass(i.btnCancelClass).html(i.btnCancelLabel).prepend(n("<i><\/i>").addClass(i.btnCancelIcon)," ").off("click").one("click",function(){t.getOnCancel.call(t).call(t.$element);t.$element.trigger("canceled.bs.confirmation");t.leave(t)});r.removeClass("fade top bottom left right in");r.find(".popover-title").html()||r.find(".popover-title").hide()};t.prototype.getOnConfirm=function(){return this.$element.attr("data-on-confirm")?i(this.$element.attr("data-on-confirm")):this.options.onConfirm};t.prototype.getOnCancel=function(){return this.$element.attr("data-on-cancel")?i(this.$element.attr("data-on-cancel")):this.options.onCancel};r=n.fn.confirmation;n.fn.confirmation=function(i){var r="object"==typeof i&&i||{};return r._root_selector=this.selector,this.each(function(){var f=n(this),u=f.data("bs.confirmation");(u||"destroy"!=i)&&(u||f.data("bs.confirmation",u=new t(this,r)),"string"==typeof i&&u[i]())})};n.fn.confirmation.Constructor=t;n.fn.confirmation.noConflict=function(){return n.fn.confirmation=r,this}}(jQuery)