var Drupal=Drupal||{};(function($,Drupal,Bootstrap){"use strict";var $document=$(document);Bootstrap.extendPlugin('popover',function(settings){return{DEFAULTS:{animation:!!settings.popover_animation,autoClose:!!settings.popover_auto_close,enabled:settings.popover_enabled,html:!!settings.popover_html,placement:settings.popover_placement,selector:settings.popover_selector,trigger:settings.popover_trigger,title:settings.popover_title,content:settings.popover_content,delay:parseInt(settings.popover_delay,10),container:settings.popover_container}};});Drupal.behaviors.bootstrapPopovers={$activePopover:null,attach:function(context){if(!$.fn.popover||!$.fn.popover.Constructor.DEFAULTS.enabled){return;} var _this=this;$document.on('show.bs.popover','[data-toggle=popover]',function(){var $trigger=$(this);var popover=$trigger.data('bs.popover');if(popover.options.originalTrigger==='click'){if(_this.$activePopover&&_this.getOption('autoClose')&&!_this.$activePopover.is($trigger)){_this.$activePopover.popover('hide');} _this.$activePopover=$trigger;}}).on('focus.bs.popover',':visible',function(e){var $target=$(e.target);if(_this.$activePopover&&_this.getOption('autoClose')&&!_this.$activePopover.is($target)&&!$target.closest('.popover.in')[0]){_this.$activePopover.popover('hide');_this.$activePopover=null;}}).on('click.bs.popover',function(e){var $target=$(e.target);if(_this.$activePopover&&_this.getOption('autoClose')&&!$target.is('[data-toggle=popover]')&&!$target.closest('.popover.in')[0]){_this.$activePopover.popover('hide');_this.$activePopover=null;}}).on('keyup.bs.popover',function(e){if(_this.$activePopover&&_this.getOption('autoClose')&&e.which===27){_this.$activePopover.popover('hide');_this.$activePopover=null;}});var elements=$(context).find('[data-toggle=popover]').toArray();for(var i=0;i').parent()[options.html?'html':'text']()||'';} $element.popover(options);if(options.originalTrigger==='click'){$element.off('click.drupal.bootstrap.popover').on('click.drupal.bootstrap.popover',function(e){$(this).popover('toggle');e.preventDefault();e.stopPropagation();});}}},detach:function(context){if(!$.fn.popover||!$.fn.popover.Constructor.DEFAULTS.enabled){return;} $(context).find('[data-toggle="popover"]').off('click.drupal.bootstrap.popover').popover('destroy');},getOption:function(name,defaultValue,element){var $element=element?$(element):this.$activePopover;var options=$.extend(true,{},$.fn.popover.Constructor.DEFAULTS,($element&&$element.data('bs.popover')||{}).options);if(options[name]!==void 0){return options[name];} return defaultValue!==void 0?defaultValue:void 0;}};})(window.jQuery,window.Drupal,window.Drupal.bootstrap);