(function( blueConic, undefined ) {var p='http://plugins.blueconic.net/';var ps='https://plugins.blueconic.net/';(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.BCClass=function(){};BCClass.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]=="function"&&typeof f[d]=="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}})();var InteractionType=BCClass.extend({init:function(a){},getPreloadProperties:function(){return[]},getContent:function(){},onEvent:function(){},importLibraries:function(c){var e=[];var a=[];if(!c||c.length===0){return}for(var b=0;b<c.length;b++){var d=c[b];if(d&&d.sharing==="none"){e.push(d.url)}else{a.push(d.url)}}blueConic.fn.importLibraries.call(this,e);blueConic.fn.importAndCacheLibraries.call(this,a)}});(function(){ var InteractionTypeImpl = InteractionType.extend({
  // any interactiontype has an init function which receives the blueConicClient and the context
  // see https://support.blueconic.com/hc/en-us/articles/202605221-JavaScript-Front-end-API#interactiontype 
  init: function(blueConicClient, interactionContext) {
    this.blueConicClient = blueConicClient;
    this.context = interactionContext;
  },

  onLoad: function() {
    this.callProfileLoad();
    this.handleConsent();
  },

  callProfileLoad: function() {
    // the context also contains a reference to the profile
    var profile = this.context.getProfile();
    var propNames = this.getPreloadProperties();
    var props = {};
    for (var i = 0; i < propNames.length; i++) {
      props[propNames[i]] = profile.getValues(propNames[i]);
    }
    
    if (window.onBlueConicProfileLoad) {
      window.onBlueConicProfileLoad(props);
    }
  },

  handleConsent: function() {
    // the context also contains a reference to the profile
    var profile = this.context.getProfile();    
    var blueConicClient = this.blueConicClient;
    var existing_consents = profile.getValues('consented_objectives') || [];
    
    // update consent props if we need to
    if(window.__cmp) {
      __cmp('getVendorConsents', null, function(vendors) {
        __cmp('getPublisherConsents', null, function(publishers) {
          var objs = [];

          // first vendors
          if(vendors.purposeConsents['1'])
            objs.push('vendor_information_storage');
          if(vendors.purposeConsents['2'])
            objs.push('vendor_personalisation');
          if(vendors.purposeConsents['3'])
            objs.push('vendor_ads');
          if(vendors.purposeConsents['4'])
            objs.push('vendor_content');
          if(vendors.purposeConsents['5'])
            objs.push('vendor_measurement');

          // now publisher consents
          if(publishers.standardPurposeConsents['1'])
            objs.push('publisher_information_storage');
          if(publishers.standardPurposeConsents['2'])
            objs.push('publisher_personalisation');
          if(publishers.standardPurposeConsents['3'])
            objs.push('publisher_ads');
          if(publishers.standardPurposeConsents['4'])
            objs.push('publisher_content');
          if(publishers.standardPurposeConsents['5'])
            objs.push('publisher_measurement');

          objs.sort();
          existing_consents.sort();
          if(objs.join() !== existing_consents.join()) {
            profile.setConsentedObjectives(objs);
            blueConicClient.profile.updateProfile();
          }
        });
      });
    }
  },

  getPreloadProperties: function() {
    return ['email', 'consented_objectives'];
  }
});
var a = [];var i='atlantic';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : 'https://theatlantic.blueconic.net/plugins/atlantic/ts_64b6a0db7e3f1b78b15535eca9a6f7a4/'}]);})();(function(){ var ARTICLE="article",PRODUCT="product",EVENT_SHOPPING_CART="shoppingcart",EVENT_ORDER="order",InteractionTypeImpl=InteractionType.extend({init:function(t,e){this.blueConicClient=t,this.context=e,this.profile=this.context.getProfile();var i=this.context.getParameters();this.storeId=i.storeId&&i.storeId[0]||null,this.metadata=i.metadata&&i.metadata[0]||null,this.requiredOptionSet=i.requiredOptionSet&&"true"===i.requiredOptionSet[0],this.type="connection_content_collector"===this.context.getInteractionTypeId()?ARTICLE:PRODUCT,this._initProductProperties(i)},_initProductProperties:function(t){this.type===PRODUCT&&(t.lastCartUpdateProperty&&t.lastCartUpdateProperty[0]&&(this.lastCartUpdateProperty=t.lastCartUpdateProperty[0]),t.nrProductsInCartProperty&&t.nrProductsInCartProperty[0]&&(this.nrProductsInCartProperty=t.nrProductsInCartProperty[0]),this._subscribeToShoppingEvents())},_subscribeToShoppingEvents:function(){this.blueConicClient.event.subscribe(EVENT_SHOPPING_CART,this,this._handleShoppingEvent),this.blueConicClient.event.subscribe(EVENT_ORDER,this,this._handleShoppingEvent)},_updateShoppingcartItems:function(t){this.blueConicClient.recommendation.createEvent({storeId:this.storeId,action:EVENT_SHOPPING_CART,itemId:t,profileId:this.profile.getId()}),this.nrProductsInCartProperty&&this._storeItemsInShoppingCart(t),this.lastCartUpdateProperty&&this._storeCurrentDateAsLastCartUpdate(),(this.nrProductsInCartProperty||this.lastCartUpdateProperty)&&this.blueConicClient.profile.updateProfile()},_storeItemsInShoppingCart:function(t){this.profile.setValue(this.nrProductsInCartProperty,t.length)},_storeCurrentDateAsLastCartUpdate:function(){this.profile.setValue(this.lastCartUpdateProperty,this.blueConicClient.getCurrentDate().getTime())},_updateBoughtItems:function(t){this.blueConicClient.recommendation.createEvent({storeId:this.storeId,action:EVENT_ORDER,itemId:t,profileId:this.profile.getId()})},_handleShoppingEvent:function(t,e){if(e&&e.productIds&&(!e.storeId||e.storeId===this.storeId)){var i=this.blueConicClient.util.array.ensureArray(e.productIds);t===EVENT_SHOPPING_CART?this._updateShoppingcartItems(i):t===EVENT_ORDER&&(this._updateBoughtItems(i),this._updateShoppingcartItems([]))}},_isValidItem:function(t,e,i){if(!t.itemId)return this.blueConicClient.util.log("Item will not be scraped due to missing item ID"),!1;if(!t.name)return this.blueConicClient.util.log("Item will not be scraped due to missing name"),!1;if(!t.url)return this.blueConicClient.util.log("Item will not be scraped due to missing URL"),!1;if(!/^https?:\/\//.test(t.url))return this.blueConicClient.util.log("Item will not be scraped due to invalid URL: "+t.url),!1;if(t.pageType!==this.type)return this.blueConicClient.util.log("Item will not be scraped due to incorrect type: "+t.pageType+" !== "+this.type),!1;if(this.type===ARTICLE&&!t.publicationDate)return this.blueConicClient.util.log("Item will not be scraped due to missing publication date"),!1;if(this.requiredOptionSet)for(var r=["id","url","name","type","publicationDate"],n=0;n<i.length;n++)if(i[n].required&&-1===r.indexOf(i[n].fieldId)){var o=e.getFieldValue(i[n]);if(null==o||0===o.length)return this.blueConicClient.util.log("Item will not be scraped due to missing value for required field: "+i[n].fieldId),!1}return!0},onLoad:function(){if(this.storeId){var t=this.metadata?this.blueConicClient.json.parse(this.metadata):null,e=new window.BlueConicMetaDataService(this.jQuery,t,this.type,document.location.href);e.blueConicClient=this.blueConicClient;var i=e.getItemData(t);if(this._isValidItem(i,e,t)){var r=this._makeMetaDataHash(e,t);this._handleView(i.itemId,i.url,r,e)}this._check404Page(i.itemId,window.location.toString())}},_handleView:function(t,e,i,r){this.referrer=document.referrer;var n=this.referrer.replace(/http[s]?:\/\/(.*?)(:|\?|\/|$).*/,"$1"),o=window.location.hostname,s={storeId:this.storeId,action:"view",itemId:t,url:e,profileId:this.profile.getId(),isEntrypage:n!==o,hash:i},a=r.getLastModifiedInMs();a&&(s.lastmodified=a),this.blueConicClient.recommendation.createEvent(s)},_makeMetaDataHash:function(t,e){var i=t.getMetaDataValues(e);return this.md5(this.blueConicClient.json.stringify(i))},_check404Page:function(t,e){if(t){for(var i=[this.jQuery("title").text(),this.jQuery('meta[property="description"]').attr("content"),this.jQuery('meta[property="og:title"]').attr("content"),this.jQuery("h1").text()],r=["not found","404","niet gevonden","sorry","probleem"],n=!1,o=this.storeId,s=0;s<i.length;s++){var a=i[s];if(a)for(var l=0;l<r.length;l++){var u=r[l]||"";if(-1!==a.toLowerCase().indexOf(u)){n=!0;break}}}n&&t&&this.jQuery.ajax({url:e,type:"HEAD",statusCode:{404:this.jQuery.proxy(function(){this.blueConicClient.recommendation.createEvent({itemId:t,url:t,storeId:o,lastmodified:(new Date).getTime()})},this)}})}}});var a = [];var i='connection_content_collector';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/3.2.4/frontend/src/lib/md5.min.js', sharing: 'local'});a.push({url: p + i + '/3.2.4/frontend/src/node_modules/@blueconic/frontend-metadataservice/metaDataService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/3.2.4/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({PF_PROPERTY_PREFIX:"tlpf",STANDARD_EVENTS:["ViewContent","Search","AddToCart","AddToWishlist","InitiateCheckout","AddPaymentInfo","Purchase","Lead","CompleteRegistration"],MIGRATED_SEGMENT_ID:"migrated-segment",SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection",init:function(e,t){this.blueConicClient=e,this.context=t,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this._migrate(),this.pixelId=this.parameters.pixelId[0],this.goals=this._parseGoals(),this.segments=this.blueConicClient.getSegments()},getPreloadProperties:function(){var e=this._getFrontendGoals(this.parameters).reduce(function(e,t){var n=JSON.parse(t.parameters.exportMapping[0]).filter(function(e){return"property"===e.from.type&&e.from.property}).map(function(e){return e.from.property});return e.concat(n)},[]).concat(this.goals.reduce(function(e,t){return e.push(t.context.LAST_PUSH_PROPERTY),e.push(t.context.VARIABLE_STATE_PUSH_PROPERTY),e},[]));return e.push(this.SENT_TO_CONNECTION_PROPERTY),e.push(this.SENT_TO_SYSTEM_PROPERTY),e},onLoad:function(){if(0!==this.goals.length&&this.pixelId){this._createFacebookScript(),window.fbq("init",this.pixelId);for(var e=0;e<this.goals.length;e++)this._handleGoal(this.goals[e].goal,this.goals[e].context)}},_parseGoals:function(){var e=this._getFrontendGoals(this.parameters);if(0===e.length||!this.pixelId)return[];for(var t=[],n=0;n<e.length;n++){var r=this._parseGoal(e[n]);t.push({goal:r,context:this._createGoalContext(r)})}return t},_getFrontendGoals:function(e){return e.frontendGoals.map(JSON.parse)},_createFacebookScript:function(){var e,t,n,r,i,s;e=window,t=document,n="script",e.fbq||(r=e.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},e._fbq||(e._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],(i=t.createElement(n)).async=!0,i.src="https://connect.facebook.net/en_US/fbevents.js",(s=t.getElementsByTagName(n)[0]).parentNode.insertBefore(i,s))},_parseGoal:function(e){var t=e.parameters;return t.exportMapping=JSON.parse(this._getValue("exportMapping",t)),t.pushFrequency=this._getValue("pushFrequency",t),t.exportSegment=this._getValue("exportSegment",t),t.eventName=this._getValue("eventName",t),t.events=[],t.triggerEvent&&t.events.push(t.triggerEvent),"plc"===t.pushFrequency&&t.events.push(this.blueConicClient.event.onProfilePermissionChange),t},_getValue:function(e,t){return t[e]&&t[e][0]||null},_getValues:function(e,t){return t[e]?t[e]:[]},_handleGoal:function(e,t){if(!1!==this._validSegment(e.exportSegment)){var n=this;e.events.forEach(function(r){n.blueConicClient.event.subscribe(r,n,function(){setTimeout(function(){n.profile.loadValues(n.preloadProperties,n,function(){n._pushGoalData(e,t)})},200)})}),this.bcConnectionUtil.doPush(t)&&this._pushGoalData(e,t)}},_pushGoalData:function(e,t){for(var n={},r=!1,i=0;i<e.exportMapping.length;i++){var s=e.exportMapping[i];if(s.from){var o=this.bcConnectionUtil.getVariableValue(s.from,t,!0).filter(function(e){return null!=e});o&&o.length>0&&(n[s.to.fieldId]=1===o.length?o[0]:o,r=!0)}}if(r){var a=e.eventName||"BlueConic";this._isStandardEvent(a)?window.fbq("track",a,n):window.fbq("trackCustom",a,n),this.bcConnectionUtil.setSyncProperties(this.context,this.profile,[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY])}},_validSegment:function(e){if(e===this.MIGRATED_SEGMENT_ID)return!0;for(var t=0;t<this.segments.length;t++)if(this.segments[t].id===e)return!0;return!1},_createGoalContext:function(e){return{LAST_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),VARIABLE_STATE_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId(),push_frequency:e.pushFrequency||null,profile:this.profile,variables:[]}},_isStandardEvent:function(e){for(var t=0;t<this.STANDARD_EVENTS.length;t++)if(e===this.STANDARD_EVENTS[t])return!0;return!1},_migrate:function(){(this.parameters.version&&this.parameters.version[0]?parseInt(this.parameters.version[0]):1)<3&&this._migrateToV3()},_migrateToV3:function(){var e=this.parameters.eventName,t=this.parameters.push_frequency,n=JSON.parse(this.parameters.variables).map(function(e){var t={from:{type:e.type},to:{type:"text",fieldLabel:e.key,fieldId:e.key}};return Object.keys(e).forEach(function(n){"key"!==n&&"id"!==n&&(t.from[n]=e[n])}),"pm"===e.type?t.from.type="permission":"text"===e.type&&(t.from.fieldLabel=e.text,t.from.fieldId=e.text),t});this.parameters.frontendGoals=[],this.parameters.frontendGoals.push(JSON.stringify({id:"migrated-goal-"+Math.round(1e3*Math.random()),active:!0,type:"export-pixel",parameters:{exportMapping:[JSON.stringify(n)],eventName:e,triggerEvent:null,pushFrequency:t,exportSegment:[this.MIGRATED_SEGMENT_ID]}}))}});var a = [];var i='connection_facebook_ads';a.push({url: p + i + '/4.2.2/frontend/src/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/4.2.2/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({LP_PREFIX:"_lp_silverpop_",init:function(t,e){this.blueConicClient=t,this.context=e,this.profile=this.blueConicClient.profile.getProfile(),this.parameters=this.context.getParameters(),this.interactionTypeId=this.context.getInteractionTypeId(),this.interactionId=this.context.getInteractionId(),this.preloadProperties=[],this.properties=[],this.matchingProperties=[],this.LAST_PUSHED_PROPERTY=this.LP_PREFIX+this.interactionId,this.SENT_TO_SYSTEM_PROPERTY="sent_to_system",this.SENT_TO_CONNECTION_PROPERTY="sent_to_connection",this._getPropertiesFromParameters()},getPreloadProperties:function(){return this.preloadProperties},onLoad:function(){if(this.parameters&&this.parameters.goals&&-1!==this.parameters.goals.indexOf("export")){var t=this._getValuesFromProfile(this.properties);this._hasMatchingValue(t)&&this._isValuesChanged(t)&&this._updateUser()}},_updateUser:function(){var t=this;this.jQuery.getJSON(this._getRestEndpoint("updateUser")+"&callback=?",function(e){e&&e.SUCCESS&&"TRUE"===e.SUCCESS[0]&&t._updateLastPushProperty()})},_isValuesChanged:function(t){return this.profile.getValue(this.LAST_PUSHED_PROPERTY)!==this.blueConicClient.json.stringify(t)},_hasMatchingValue:function(t){if(0===this.matchingProperties.length)return!1;for(var e=!1,r=0;r<this.matchingProperties.length;r++)if(t[this.matchingProperties[r]]&&t[this.matchingProperties[r]].length>0){e=!0;break}return e},_updateLastPushProperty:function(){this.profile.setValue(this.LAST_PUSHED_PROPERTY,this.blueConicClient.json.stringify(this._getValuesFromProfile(this.properties))),this.bcConnectionUtil.setSyncProperties(this.context,this.profile,[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY]),this.blueConicClient.profile.updateProfile()},_getValuesFromProfile:function(t){var e={};if(!t||0===!t.length||!this.profile)return e;for(var r=0;r<t.length;r++)e[t[r]]=this.profile.getValues(t[r]);return e},_getPropertiesFromParameters:function(){if(this.preloadProperties.push(this.LAST_PUSHED_PROPERTY),this.preloadProperties.push(this.SENT_TO_SYSTEM_PROPERTY),this.preloadProperties.push(this.SENT_TO_CONNECTION_PROPERTY),this.parameters){if(this.parameters&&!this.parameters.goalParameters){var t=this.parameters.exportMatching&&this.parameters.exportMatching[0]?this.blueConicClient.json.parse(this.parameters.exportMatching[0]):null,e=this.parameters.exportMapping&&this.parameters.exportMapping[0]?this.blueConicClient.json.parse(this.parameters.exportMapping[0]):null;return this._getPropertiesFromList(t),void this._getPropertiesFromList(e)}for(var r=0;r<this.parameters.goalParameters.length;r++)try{var i=this.blueConicClient.json.parse(this.parameters.goalParameters[r]),s=i.parameters.exportMatching&&i.parameters.exportMatching[0]?this.blueConicClient.json.parse(i.parameters.exportMatching[0]):null,o=i.parameters.exportMapping&&i.parameters.exportMapping[0]?this.blueConicClient.json.parse(i.parameters.exportMapping[0]):null;this._getPropertiesFromList(s),this._getPropertiesFromList(o)}catch(t){console.error("Cannot parse the goals")}}},_getPropertiesFromList:function(t){if(t&&t&&t.length>0)for(var e=0;e<t.length;e++){var r=t[e];(r.from.fieldId||r.from.property)&&-1===this.properties.indexOf(r.from.fieldId||r.from.property)&&(this.properties.push(r.from.fieldId||r.from.property),this.preloadProperties.push(r.from.fieldId||r.from.property))}},_getRestEndpoint:function(t){return this.blueConicClient.getRestEndpoint(this.interactionTypeId+"/"+t)+"?profileId="+this.profile.getId()+"&itemId="+this.context.getInteractionId()}});var a = [];var i='connection_silverpop';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/1.7.1/frontend/src/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.7.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t||null,this.parameters=this.context.getParameters(),this.profile=e.profile.getProfile(),this.isInEditMode=e.isInEditMode(),this._createdElements=[],this.parameters&&this.parameters.content&&(this._fragment=this._createFragment(this.parameters.content))},_createFragment:function(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.getElementsByTagName("div"),i=0;i<n.length;i++)n[i].getAttribute("data-bc-external")&&(n[i].innerHTML="");return t},onLoad:function(){if(this.element=this.context.getDOMElement(),this.element){window.bc=window.bc||{},window.bc.jQuery=this.jQuery,window.bc.$=this.jQuery;var e=this.element.cloneNode(!0),t=this;this.loadInteraction(function(n,i){if(n)return console.error("[BC] Content interaction couldn't be loaded because of the following error(s)",n),void(t.isInEditMode||(console.error("[BC] The element will be restored to it's previous content"),t._createdElements.forEach(function(e){e.remove()}),t.element.replaceWith?t.element.replaceWith(e):t.element.innerHTML=e.innerHTML));t._createdElements=i.createdElements,t.isInEditMode?t.blueConicClient.event.publish("contentinteractiontype.interactionLoaded",{interaction:t}):t.blueConicClient.createEvent("VIEW",t.context.getInteractionId())})}},loadInteraction:function(e,t){var n="boolean"!=typeof(t=t||{}).loadContent||t.loadContent,i=window._bcp.interactionUtil,r=this.getValue("content");r||(r=this.element.innerHTML);var l=[];n&&l.push(i.createContentHandler({content:r,interactionId:this.context.getInteractionId(),bcEvent:this.blueConicClient.event,isInEditMode:this.isInEditMode,jQuery:this.jQuery})),l.push(i.createCssHandler({cssUrl:this.getValue("styling_css")}),i.createAdvancedHandler({blueConicClient:this.blueConicClient,interactionId:this.context.getInteractionId(),clickEventSelector:this.getValue("click_event_selector"),jQuery:this.jQuery}),i.createJavaScriptHandler({interactionId:this.context.getInteractionId(),javaScriptUrls:this.getValues("javascript_urls"),inlineJavaScript:this.getValue("javascript"),isInEditMode:this.isInEditMode})),i.runHandlers(this.element,l,e)},getPreloadProperties:function(){for(var e,t=this.context.getParameters().content+"",n=/data-bc-preload="([^"]*)"/g,i=[];null!==(e=n.exec(t));)for(var r=e[1].split(","),l=0;l<r.length;l++)i.push(r[l]);return i||[]},getContent:function(){return this.loadInlineStyling(),this._fragment?this._fragment.innerHTML:null},loadInlineStyling:function(){var e=this.getValue("styling_css_inline");e?(this._inlineStylingElement||(this._inlineStylingElement=document.createElement("style"),document.head.appendChild(this._inlineStylingElement),this._createdElements.push(this._inlineStylingElement)),this._inlineStylingElement.innerHTML=e):this._inlineStylingElement&&(this._inlineStylingElement.remove(),this._inlineStylingElement=null)},onMessageReceived:function(e){this.blueConicClient.event.publish("contentinteractiontype.messageReceived",e)},getValue:function(e){return this.parameters[e]&&this.parameters[e][0]?this.parameters[e][0]:null},getValues:function(e){return this.parameters[e]||[]}});var a = [];var i='contentinteractiontype';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/1.1.24/frontend/src/scripts/handlerUtil.js', sharing: 'none'});a.push({url: p + i + '/1.1.24/frontend/src/scripts/handleCss.js', sharing: 'none'});a.push({url: p + i + '/1.1.24/frontend/src/scripts/handleContent.js', sharing: 'none'});a.push({url: p + i + '/1.1.24/frontend/src/scripts/handleJavaScript.js', sharing: 'none'});a.push({url: p + i + '/1.1.24/frontend/src/scripts/handleAdvanced.js', sharing: 'none'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.24/'},{ id : 'html', baseUrl : ps + 'html/1.0.10/'},{ id : 'string', baseUrl : ps + 'string/1.0.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(e,t){this.blueConicClient=e,this.context=t},onLoad:function(){var e=this.blueConicClient,t=this.context.getParameters(),n=this.jQuery;if(t){var r=(t.clickcandidates||[]).map(JSON.parse).map(v),i=(t.contentcandidates||[]).map(JSON.parse).map(v),a={},c={},o={};r.forEach(function(e){u(e,l)}),i.forEach(function(e){u(e,s)})}function u(t,n){var r=function(){n(t);var i=c[t.interactionId],a=o[t.selecterarea];i||a||e.position.subscribe(t.selecterarea,null,r)};e.position.subscribe(t.selecterarea,null,r),n(t)}function l(e){for(var t=d(e),r=n(e.selecterarea),i=0,a=r.length;i<a;i++)r[i].addEventListener("click",t,{once:!0})}function s(e){f(e)&&d(e)()}function f(e){if(c[e.interactionId])return!1;for(var t=n(e.selecterarea),r=0,i=t.length;r<i;r++)if(h(t[r].textContent,e.words))return!0;return!1}function d(t){return a[t.interactionId]||(a[t.interactionId]=function(n,a){var u=c[n],l=o[t.selecterarea];if(!u&&!l){var s=[];s=(s=a instanceof MouseEvent?r.filter(function(e){var t=!c[e.interactionId],n=$(e.selecterarea).is(event.target),r=$(e.selecterarea).find(event.target).length>0;return t&&(n||r)}):i.filter(function(e){return f(e)})).filter(function(e){return e.interactionId!==t.interactionId}),o[t.selecterarea]=!0,o[t.interactionId]=!0,s.forEach(function(e){o[e.selecterarea]=!0,c[e.interactionId]=!0});var d=s.map(function(e){return e.interactionId});e.createEvent("CONVERSION",n,null,function(){e.util.log("CONVERSION event registred. Interaction: ["+n+"]")},{losingInteractions:d})}}.bind(null,t.interactionId)),a[t.interactionId]}function h(e,t){if(!e||!Array.isArray(t))return!1;var n=t.filter(function(e){return Boolean(e)&&"pre_any"!==e}).map(function(e){return e.trim().toLowerCase()});if(0===n.length)return!0;for(var r=e.toLowerCase(),i=0,a=n.length;i<a;i++)if(r.indexOf(n[i])>=0)return!0;return!1}function v(e){var t=e.selecterarea;return/^pre_any/.test(t)?t="html":/^pre_header/.test(t)?t="h1, h2, h3, h4, h5, h6":/^pre_/.test(t)&&(t=t.replace(/^pre_/,"")),e.selecterarea=t,e}}});var a = [];var i='conversionlistenerinteractiontype';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.8/'}]);})();(function(){ 
var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a;this.context=b?b:null;this.profile=this.context.getProfile();this.targetingParameters=[]},getPreloadProperties:function(){return this._getProfilePropertiesFromParameters()},onLoad:function(){if(this.targetingParameters&&0<this.targetingParameters.length){for(var a=[],b=0;b<this.targetingParameters.length;b++){var c=this.targetingParameters[b],e=c.key,c=this._getParamValue(c);e&&c&&a.push({key:e,value:c})}if("undefined"!==
typeof window.Storage)try{window.localStorage.setItem("bcDFPTargetingParams",this.blueConicClient.json.stringify(a))}catch(g){}var f=0,d=function(){window.bcDFPCallback?window.bcDFPCallback(a):40<f||(f++,window.setTimeout(d,250))};d.call(this)}},_getParamValue:function(a){if((!a.type||"text"===a.type)&&a.text)return a.text;if("property"===a.type&&a.property)return this.profile.getValues(a.property);if("segments"===a.type&&0<this.blueConicClient.getSegments().length){var b=[],c=this.blueConicClient.getSegments();
if(a.segments&&0<a.segments.length)for(var e=0;e<c.length;e++)for(var g=c[e],f=0;f<a.segments.length;f++){var d=a.segments[f];(g.id&&g.id===d.segmentId||g.name===d.segmentName)&&b.push(d.aamCode||d.dcmCode||d.smCode||g.name)}else for(a=0;a<c.length;a++)b.push(c[a].name);return b}},_getProfilePropertiesFromParameters:function(){var a=[],b=this.context.getParameters(),b=b.targeting_parameters?b.targeting_parameters[0]:b.targeting_parameters;if(!b)return a;this.targetingParameters=this.blueConicClient.json.parse(b);
for(b=0;b<this.targetingParameters.length;b++){var c=this.targetingParameters[b];"property"===c.type&&c.property&&a.push(c.property)}return a}});
var a = [];var i='dfpconnection_to';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : 'https://theatlantic.blueconic.net/plugins/dfpconnection_to/ts_e19317762cea0b7a3658deb94c42c3ed/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this.parameters=this.context.getParameters();var c=new Date(2017,8,1,0,0,0,0),d=this.blueConicClient.getCurrentDate().getTime(),e=d-c.getTime();this.days=Math.floor(e/86400000);var f=this.parameters.propertyRules&&this.parameters.propertyRules[0]?this.parameters.propertyRules[0]:null;if(f){f=a.json.parse(f),this.preLoadProperties=[];for(var g,h=0,i=0;i<f.length;i++)g=f[i],g.profileproperty&&g.decay&&g.nr&&(this.preLoadProperties.push(g.profileproperty+"_index"),g.decay>h&&(h=g.decay,this.property=g.profileproperty))}else{var j=this.parameters.property?this.parameters.property[0]:this.parameters.property;j&&(this.property=this.blueConicClient.json.parse(j)[0].profileproperty,this.preLoadProperties=[this.property+"_index"])}},getPreloadProperties:function(){return this.preLoadProperties},onLoad:function(){if(0<this.preLoadProperties.length){var a=this.context.getProfile(),b=this.parameters.engagement_rules?this.parameters.engagement_rules[0]:this.parameters.engagement_rules;if(!b)return;if(b=this.blueConicClient.json.parse(b),0===b.length)return;var c=this.parameters.interests?this.parameters.interests[0]:this.parameters.interests;c=c?this.blueConicClient.json.parse(c).values:[];var d=new this.BlueConicEngagement(this.blueConicClient,a,this.context.getInteractionId(),!0,c,this.jQuery,this.days,!0);if(d.applyEngagementRules(b),d.isChanged())d.save();else{for(var e,f=!1,g=0;g<this.preLoadProperties.length;g++)e=this.preLoadProperties[g],a.getValue(e)||(a.setValue(e,"0"),f=!0);f&&this.blueConicClient.profile.updateProfile()}}}});var a = [];var i='engagement_interest_ranking';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/6.3.1/js/engagement_service/engagementService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/6.3.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.interaction=b,this.parameters=this.interaction.getParameters();var c=this.parameters.propertyRules&&this.parameters.propertyRules[0]?this.parameters.propertyRules[0]:null;if(c){c=a.json.parse(c),this.preLoadProperties=[];for(var d,e=0,f=0;f<c.length;f++)d=c[f],d.profileproperty&&d.decay&&(this.preLoadProperties.push(d.profileproperty),d.decay>e&&(e=d.decay,this.property=d.profileproperty))}else{var g=this.parameters.property?this.parameters.property[0]:this.parameters.property;g&&(this.property=this.blueConicClient.json.parse(g)[0].profileproperty,this.preLoadProperties=[this.property])}},getPreloadProperties:function(){return this.preLoadProperties},onLoad:function(){if(0<this.preLoadProperties.length){var a=this.interaction.getProfile(),b=this.parameters.engagement_rules?this.parameters.engagement_rules[0]:this.parameters.engagement_rules;if(!b)return;if(b=this.blueConicClient.json.parse(b),0===b.length)return;var c=new this.BlueConicEngagement(this.blueConicClient,a,this.property,!1,"",this.jQuery);if(c.applyEngagementRules(b),c.isChanged())c.save();else{for(var d,e=!1,f=0;f<this.preLoadProperties.length;f++)d=this.preLoadProperties[f],a.getValue(d)||(a.setValue(d,"0"),e=!0);e&&this.blueConicClient.profile.updateProfile()}}}});var a = [];var i='engagement_score';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/6.3.1/js/engagement_service/engagementService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/6.3.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b},getPreloadProperties:function(){return this.preloadProperties=[],this.context&&(this.preloadProperties=this.getProfilePropertiesFromParameters(this.context.getParameters())),this.preloadProperties},onLoad:function(){var a=this.context.getProfile(),b=this.context.getParameters(),c=b.listener_rules?b.listener_rules[0]:b.listener_rules;if(c){c=this.blueConicClient.json.parse(c);var d=new this.RuleService(this.blueConicClient,a,this.jQuery);d.applyRules(c),d.save()}},getProfilePropertiesFromParameters:function(a){var b=[],c=a.listener_rules?a.listener_rules[0]:a.listener_rules;if(!c)return b;c=this.blueConicClient.json.parse(c);for(var d,e=0;e<c.rules.length;e++)d=c.rules[e],d.profileproperty&&("set_if_empty"===d.addset||"merge"===d.addset)&&b.push(d.profileproperty[0].profileproperty);return b}});var a = [];var i='enrichprofilebyvisitorbehavior';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + 'enrichProfileByVisitorBehavior/5.3.1/js/ruleService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + 'enrichProfileByVisitorBehavior/5.3.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this.parameters=this.context.getParameters(),this.rules=this._migrate(this.parameters.version||1)},getPreloadProperties:function(){return this.preloadProperties=[],this.context&&(this.preloadProperties=this.getProfilePropertiesFromParameters()),this.preloadProperties},onLoad:function(){if(this.rules){var a=this.context.getProfile(),b=new window.FormRuleService(this.blueConicClient,a,this.jQuery);b.applyRules(this.rules)}},getProfilePropertiesFromParameters:function(){if(this.rules){for(var a,b=[],c=0;c<this.rules.length;c++)a=this.rules[c],a.profileProperty&&"set_if_empty"===a.addset&&b.push(a.profileProperty);return b}},_migrate:function(a){var b=this.parameters.form_listener_rules?this.parameters.form_listener_rules[0]:this.parameters.form_listener_rules;return b=this.blueConicClient.json.parse(b),1===a&&(a=2,b=this._migrateToVersion2(b)),b},_migrateToVersion2:function(a){if(!a)return a;a=a.rules||a;for(var b=0;b<a.length;b++){a[b].id=a[b].id||a[b].identifier,delete a[b].identifier,a[b].profileproperty&&!a[b].profileProperty&&(a[b].profileProperty=a[b].profileproperty[0]?a[b].profileproperty[0].profileproperty||"":"",delete a[b].profileproperty);var c=this._migrateConverterMappingsToVersion2(a[b]);c&&(a[b].converter.mappings=c)}return a},_migrateConverterMappingsToVersion2:function(a){if(a&&a.converter&&a.converter.mappings){for(var b,c=[],d=0;d<a.converter.mappings.length;d++){if(b=a.converter.mappings[d],b&&b.original&&b.converted){c.push(b);continue}c.push({id:b.identifier||b.id,original:b.o,converted:b.c})}return c}}});var a = [];var i='enrichprofilewithvisitorinput';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + 'enrichProfileWithVisitorInput/4.3.20/js/form_rule_service/formRuleService.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + 'enrichProfileWithVisitorInput/4.3.20/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this.parameters=this.context.getParameters()},_ouibounce:function(){var a=this,b="sensitivity",c="delay";this.ouibounce({aggressive:!0,timer:0,sensitivity:this.parameters[b]?parseInt(this.parameters[b][0]):20,delay:this.parameters[c]?parseInt(this.parameters[c][0]):0,callback:function(){window.blueConicClient&&window.blueConicClient.exitIntentThrown||a.blueConicClient.createEvent("exitintent"),window.blueConicClient&&(window.blueConicClient.exitIntentThrown=!0)}})},onLoad:function(){this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){window.blueConicClient&&window.blueConicClient.exitIntentThrown&&(window.blueConicClient.exitIntentThrown=!1,this._ouibounce())}),this._ouibounce()}});var a = [];var i='exitintent';a.push({url: p + i + '/2.0.5/js/ouibounce.js', sharing: 'none'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/2.0.5/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({languageLabels:{nl:{defaultValidation:"Vul een valide waarde in"},default:{defaultValidation:"Please enter a valid value"}},_editorOpen:!1,init:function(e,t){this.blueConicClient=e,this.baseURL=this.blueConicClient.getBaseURL("forms");var i=this;this.blueConicClient.event.subscribe("bcComplexObject",this,function(e,s){s&&"forms"===s.plugin&&s.config&&(s.config.attributionId=s.interactionId,s.config=this._migrateConfig(s.config),this._loadLibraries(s.config).done(function(){i._loadData(s,t)}))}),this.blueConicClient.isInEditMode()&&(this._sendMessage("forms.formLoaded"),this.blueConicClient.event.subscribe("forms.updateName",this,function(e,t){var s=t.message.field;i.jQuery(".bcForm[data-bc-id='"+t.message.form+"']").find(".fieldHolder[data-bc-id='"+s.id+"'] .bcLabel").text(s.settings.label),i.jQuery(".bcForm[data-bc-id='"+t.message.form+"']").find(".fieldHolder[data-bc-id='"+s.id+"'] .buttonInput").attr("value",s.settings.label)}),this.blueConicClient.event.subscribe("forms.updateField",this,function(e,s){i._updateField(s.message.form,s.message.field,t)}),this.blueConicClient.event.subscribe("forms.updateLabelLocation",this,function(e,t){i._updateLabelLocation(t.message.form,t.message.show_labels_inline)}),this.blueConicClient.event.subscribe("forms.updateStyling",this,function(e,t){i._updateStyling(t.message.styling)}),this.blueConicClient.event.subscribe("forms.addField",this,function(e,t){i._addField(t.message.form,t.message.field,!0)}),this.blueConicClient.event.subscribe("forms.deleteField",this,function(e,t){i.jQuery(".bcForm[data-bc-id='"+t.message.form+"']").find(".fieldHolder[data-bc-id='"+t.message.fieldId+"']").remove(),i._removeSelectedState()}),this.blueConicClient.event.subscribe("forms.updateConfig",this,function(e,t){var s=i.jQuery(".bcForm[data-bc-id='"+t.message.id+"']").closest(".bccomplexobject");s.attr("data-bc-config",JSON.stringify(t.message));var n=t.message.actions.filter(function(e){return"setaddvalue"===e.type&&"set_if_empty"===e.operation&&e.property}).map(function(e){return e.property});s.attr("data-bc-preload",n.join(","))}),this.blueConicClient.event.subscribe("forms.updateOrdering",this,function(e,t){i._updateOrdering(t.message.form,t.message.ordering)}),this.blueConicClient.event.subscribe("editorOpened",this,function(){this._editorOpen=!0;var e=this;this._loadLibraries().done(function(){e._addBindings(t)})}),this.blueConicClient.event.subscribe("editorClosed",this,function(){this._editorOpen=!1,i._removeSelectedState(),i._sendMessage("forms.closeConfigurator")}))},getPreloadProperties:function(){return[]},_migrateConfig:function(e){if((e=JSON.parse(JSON.stringify(e))).actions||!e.routing)return e;var t,i=e.routing;return"form_routing_inline"===i.type?t={type:"text",text:i.inline_message}:"form_routing_url"===i.type?t={type:"url",url:i.go_to_url}:"form_routing_close_lightbox"===i.type&&(t={type:"close"}),e.actions=t?[t]:[],e},_loadLibraries:function(e){var t,i,s=this.jQuery;if(window.BlueConicJQuery=s,this.blueConicClient.isInEditMode())t=this._getLoadScriptDeferred(this.baseURL+"frontend/src/lib/datepicker.min.js"),i=this._getLoadScriptDeferred(this.baseURL+"frontend/src/lib/jquery-ui.min.js");else for(var n=0;n<e.fields.length;n++)"DatePicker"===e.fields[n].fieldType&&(t=this._getLoadScriptDeferred(this.baseURL+"frontend/src/lib/datepicker.min.js"));return s.when(t,i)},_getLoadScriptDeferred:function(e){var t=this.jQuery.Deferred();return this.blueConicClient.util.loadScript(e,this,function(){t.resolve()}),t},_updateOrdering:function(e,t){var i=(0,this.jQuery)(".bcForm[data-bc-id='"+e+"']"),s=null;t.forEach(function(e){var t=i.find(".fieldHolder[data-bc-id='"+e+"']");s?t.insertAfter(s):t.prependTo(i.find("fieldset")),s=t})},_removeSelectedState:function(){(0,this.jQuery)(".fieldHolder").removeClass("bcSelected")},_updateStyling:function(e){var t=this.jQuery;this._stylingUrl&&t("link[href='"+this._stylingUrl+"']").remove(),this._inlineCss&&this._inlineCss.remove(),this._handleStyling(e)},_handleStyling:function(e){var t=this.jQuery;e&&e.css&&(this._stylingUrl=e.css,this.blueConicClient.util.loadCSS(this._stylingUrl)),e&&e.css_inline&&(this._inlineCss=t("<style>"+e.css_inline+"</style>"),this._inlineCss.appendTo(t("body")))},_selectField:function(e,t){if(this._removeSelectedState(),e.addClass("bcSelected"),!t){var i=e.closest(".bccomplexobject").attr("data-bc-config"),s=this._jsonEscape(i);this._sendMessage("forms.fieldSelected",{form:JSON.parse(s),field:e.attr("data-bc-id")})}},_jsonEscape:function(e){return e.replace(/\n/g,"\\\\n").replace(/\r/g,"\\\\r").replace(/\t/g,"\\\\t")},_addBindings:function(e){var t=window.CKEDITOR;if(t){this.baseURL=this.blueConicClient.getBaseURL(e.getInteractionTypeId()),this.blueConicClient.util.loadCSS(this.baseURL+"frontend/src/css/formsinline.css");var i,s=this.jQuery,n=this;if(s(document).on("click",".bcForm .fieldHolder",function(){n._editorOpen&&n._selectField(s(this))}),t.currentInstance)for(i in t.currentInstance.widgets.instances)if("bccomplexobject"===t.currentInstance.widgets.instances[i].name){var a=t.currentInstance.widgets.instances[i];"forms"===s(a.wrapper.$).find(".bccomplexobject").attr("data-bc-pluginid")&&(a.on("select",function(e){s(e.sender.wrapper.$).removeClass("cke_widget_selected")}),a.on("deselect",function(){n._removeSelectedState(),n._sendMessage("forms.closeConfigurator")}))}s(".bcForm fieldset").sortable({handle:".bcDragHandle",stop:function(e){var t=[];s(".fieldHolder",s(this)).each(function(){s(this).attr("data-bc-id")&&t.push(s(this).attr("data-bc-id"))}),n._sendMessage("forms.updateOrdering",{form:JSON.parse(s(this).closest(".bccomplexobject").attr("data-bc-config")),order:t});var i=s(e.toElement);i.attr("data-bc-config")||(i=i.closest(".fieldHolder")),n._selectField(i,!0)}})}},_sendMessage:function(e,t){this.blueConicClient.fn.postMessage&&this.blueConicClient.fn.postMessage(e,t)},_addField:function(e,t,i){var s=this.jQuery,n=this,a=s(this._getFieldsHTML(t));a.appendTo(s(".bcForm[data-bc-id='"+e+"'] fieldset")),this._selectField(a,!0),i&&setTimeout(function(){n._isElementInViewport(a.get(0))||a.get(0).scrollIntoView()},100)},_isElementInViewport:function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},_updateField:function(e,t,i){var s=this.jQuery,n=this._getFieldsHTML(t,!0);s(".bcForm[data-bc-id='"+e+"']").find(".fieldHolder[data-bc-id='"+t.id+"']").html(n),this._addDatePickerHandleForField(t,i)},_updateLabelLocation:function(e,t){var i=this.jQuery;t?i(".bcForm[data-bc-id='"+e+"']").find("fieldset").addClass("inlineLabels"):i(".bcForm[data-bc-id='"+e+"']").find("fieldset").removeClass("inlineLabels")},_loadData:function(e,t){var i=this,s=this.jQuery,n=e.node;n.innerHTML="",this.baseURL=this.blueConicClient.getBaseURL(t.getInteractionTypeId());var a=s('<link type="text/css" href="'+this.baseURL+'frontend/src/css/default.uni-form.css" rel="stylesheet" />');a.on("load",function(){i._handleStyling(e.config.styling),i._loadForm(n,e.config,t),i._editorOpen&&i._addBindings(t)}),s("head").append(a)},_loadForm:function(e,t,i){var s=this.jQuery;this._node=e;var n=s('<div class="bcForm" data-bc-external="true" data-bc-id="'+t.id+'"></div>');n.appendTo(s(e)),this._getForm(t).appendTo(n),this.blueConicClient.isInEditMode()?this._addDatePickerHandler(n,t,i):this._prefillForm(n,t,i)},_getForm:function(e){var t=this.jQuery;e.styling||(e.styling={});var i=t('<div id="'+e.id+'" class="uniForm" action="#"></div>'),s=t('<div class="formHolder"></div>');s.appendTo(i);var n=t("<fieldset />");e.styling.show_labels_inline&&n.addClass("inlineLabels"),n.appendTo(s);for(var a=e.fields,l=0;l<a.length;l++){var r=a[l];t(this._getFieldsHTML(r)).appendTo(n)}return i},_getFieldsHTML:function(e,t){var i='<% if(settings.description) { %><span class="formHint"><%= settings.description %></span><% } %>',s="<% if(settings.required) { %><em>*</em><% } %>",n="";switch(e.fieldType){case"PlainText":n='<div class="plaintext"><%= settings.text %></div>';break;case"SingleLineText":"small"===e.settings.fieldSize||e.settings.fieldSize;n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><input type="text" class="'+("small"===e.settings.fieldSize?"bcSmall":"large"===e.settings.fieldSize?"bcLarge":"bcMedium")+' textInput" placeholder="<%= settings.value %>" />'+i+"</div>";break;case"TextArea":n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><textarea rows="'+("small"===e.settings.fieldSize?3:"large"===e.settings.fieldSize?10:5)+'" placeholder="<%= settings.value %>"></textarea>'+i+"</div>";break;case"Select":n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><select class="selectInput"><% if (settings.values) for(var i=0; i < settings.values.length; i++) { %><option<% if(settings.values[i].defaultOn) { %> selected="selected"<% } %> value="<%= escape(settings.values[i].identifier || "") %>"><%= settings.values[i].name %></option><% } %></select>'+i+"</div>";break;case"CheckboxList":n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><ul <% if(settings.repeatdirection === "horizontal") { %>class="horizontal"<% } %>><%  if (settings.values) for(var i=0; i < settings.values.length; i++) { %><li><input<% if(settings.values[i].defaultOn) { %> checked="checked"<% } %> type="checkbox" name="bcCList_<%= id %>" id="bcCList_<%= id %>_<%= i %>" value="<%= escape(settings.values[i].identifier || "") %>"/><label for="bcCList_<%= id %>_<%= i %>"><%= settings.values[i].name %></label></li><% } %></ul>'+i+"</div>";break;case"RadioButtonList":n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><ul <% if(settings.repeatdirection === "horizontal") { %>class="horizontal"<% } %>><%  if (settings.values) for(var i=0; i < settings.values.length; i++) { %><li><input<% if(settings.values[i].defaultOn) { %> checked="checked"<% } %> type="radio" name="bcRadioList_<%= id %>" id="bcRadioList_<%= id %>_<%= i %>" value="<%= escape(settings.values[i].identifier || "") %>"/><label for="bcRadioList_<%= id %>_<%= i %>"><%= settings.values[i].name %></label></li><% } %></ul>'+i+"</div>";break;case"DatePicker":n='<div<% if (settings.className) {%> class="<%= settings.className %>"<% } %>><label>'+s+'<span class="bcLabel"><%= settings.label %></span></label><% if(settings.flat) { %><div class="datepicker"/><input type="hidden" class="hiddenInput"/><% } else { %><input type="text" class="textInput" placeholder="<%= settings.value %>" /><input type="hidden" class="hiddenInput"/><% } %>'+i+"</div>";break;case"Button":n='<div class="buttonHolder<% if (settings.className) {%> <%= settings.className %><% } %>"><input type="<% if (settings.submitForm === false) {%>button<% } else { %>submit<% } %>" class="buttonInput primaryAction" value="<%= settings.label %>"/></div>'}return this.blueConicClient.isInEditMode()&&(n+='<div class="bcDragHandle"><div class="bcInnerDragHandle"></div></div>'),t||(n='<div class="fieldHolder blueConic<%= fieldType %>" data-bc-id="<%= id %>">'+n+"</div>"),this._tmpl(n,e)},_prefillForm:function(e,t,i){for(var s=i.getProfile(),n=e.find(".fieldHolder"),a=[],l=0;l<t.fields.length;l++){var r=t.fields[l];r.settings.prefillproperty&&a.push(r.settings.prefillproperty)}0!==a.length?s.loadValues(a,this,function(){this._addFormListeners(e,t,i);for(var a=0;a<t.fields.length;a++){var l=t.fields[a],r=this.jQuery(n[a]).find("input, textarea, select");if(l.settings.prefillproperty){var o=s.getValues(l.settings.prefillproperty);if(o.length>0)switch(l.fieldType){case"DatePicker":break;case"CheckboxList":case"Checkbox":case"RadioButtonList":case"RadioButton":for(var d=0;d<o.length;d++)r.filter('[value="'+o[d]+'"]').attr("checked","checked");break;default:r.val(o[0])}}}}):this._addFormListeners(e,t,i)},_formatDate:function(e){var t=e.getMonth()+1,i=e.getDate();return e.getYear()+1900+"-"+(t<10?"0":"")+t+"-"+(i<10?"0":"")+i},_addDatePickerHandler:function(e,t,i){for(var s=0;s<t.fields.length;s++){var n=t.fields[s];this._addDatePickerHandleForField(n,i)}},_getDateForTimestamp:function(e){if(!e)return null;var t=new Date(parseInt(e));return t&&t instanceof Date&&!isNaN(t)?t:null},_addDatePickerHandleForField:function(e,t){var i=this.jQuery;if("DatePicker"===e.fieldType){var s,n=i("div[data-bc-id='"+e.id+"']"),a=this.blueConicClient.profile.getProfile(),l="nl"===t.getLocale()?"NL":"EN",r=this._getDateForTimestamp(a.getValue(e.settings.prefillproperty));r?(s=r,i(".textInput",n).val(this._formatDate(s))):s=e.settings.pickerOffset?new Date(e.settings.pickerOffset):new Date,i("input.textInput, div.datepicker",n).DatePicker({flat:e.settings.flat,lang:l,calendars:e.settings.calendars,date:s,current:this._formatDate(s),onChange:i.proxy(function(e,t){var s=i("div[data-bc-id='"+this.id+"']");i("input.hiddenInput",s).val(t.getTime()),i("input.textInput",s).length>0&&(i("input.textInput",s).val(e),i("input.textInput",s).DatePickerHide())},e)}),e.settings.flat||n.on("focus","input.textInput",function(){i("input.textInput, div.datepicker",n).DatePickerShow()})}},_submit:function(e,t,i){this._validateForm(e,t,i)&&(!1!==t.logConversion&&this.blueConicClient.createEvent("CONVERSION",t.attributionId),this._storeFormValues(e,t,i),this.blueConicClient.profile.updateProfile(this.jQuery.proxy(function(){this._handleActions(t.actions,t.attributionId,e,i)},this)))},_handleActions:function(e,t,i,s){if(e){var n=new window._bcp.utils.AfterSubmitActionHandler(this.blueConicClient,s,this.jQuery,t);e.forEach(function(e){n.executeAction(e,i)},this)}},_getField:function(e,t){var i=e.closest(".fieldHolder").attr("data-bc-id");if(i&&void 0!==i){for(var s,n=0;n<t.fields.length;n++){var a=t.fields[n];if(a&&a.id&&void 0!==a.id&&a.id===i){s=a;break}}return s}},_addFormListeners:function(e,t,i){var s=this.jQuery,n=this;this._addDatePickerHandler(e,t,i),s('input[type="submit"]',e).click(function(a){a.preventDefault();var l=n._getField(s(this),t);l&&l.settings&&!1===l.settings.logClick||n.blueConicClient.createEvent("CLICK",t.attributionId),n._submit(e,t,i)}),s('input[type="button"]',e).click(function(){var a=n._getField(s(this),t);a&&(a.settings&&!1!==a.settings.logClick&&n.blueConicClient.createEvent("CLICK",t.attributionId),n._handleActions(a.settings.actions,t.attributionId,e,i))}),1===t.fields.length&&"RadioButtonList"===t.fields[0].fieldType&&s('input[type="radio"]',e).click(s.proxy(function(s){s.preventDefault(),this.blueConicClient.createEvent("CLICK",t.attributionId),this._submit(e,t,i)},this))},_validateForm:function(e,t,i){var s=e.find(".fieldHolder");e.find("span.errormsg").remove(),s.removeClass("error");for(var n=!0,a=0;a<t.fields.length;a++){var l=t.fields[a],r=this.jQuery(s[a]),o=r.find("input, textarea, select"),d=!1;if(l.settings.required)switch(l.fieldType){case"CheckboxList":case"Checkbox":case"RadioButtonList":case"RadioButton":0===o.filter(":checked").length&&(d=!0);break;case"DatePicker":o.filter(".hiddenInput").val()||(d=!0);break;default:o.val()||(d=!0)}var c=!1;if(!d&&l.settings.validation){var u=this.jQuery.trim(o.val());if(u)switch(l.settings.validation){case"email":u.match(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/)||(c=!0);break;case"number":u.match(/^\d+$/)||(c=!0);break;case"regexp":try{l.settings.validation_regexp&&!u.match(l.settings.validation_regexp)&&(c=!0)}catch(e){console.error(e)}}}if((d||c)&&(n=!1,r.addClass("error"),c||l.settings.validation_failed_msg)){var f="nl"===i.getLocale()?"nl":"default";r.before('<span class="errormsg">'+(l.settings.validation_failed_msg?l.settings.validation_failed_msg:this.languageLabels[f].defaultValidation)+"</span")}}return n},_storeFormValues:function(e,t,i){for(var s=i.getProfile(),n=0;n<t.fields.length;n++){var a,l=t.fields[n],r=this.jQuery(e).find("div[data-bc-id = '"+l.id+"']").find("input, textarea, select");if(l.settings.storeproperty)switch(l.fieldType){case"CheckboxList":case"Checkbox":case"RadioButtonList":case"RadioButton":for(var o=[],d=r.filter(":checked"),c=0;c<d.length;c++){var u=this.jQuery(d[c]).val();u=unescape(u),o.push(u)}if("set"===l.settings.overwriteValue)s.setValues(l.settings.storeproperty,o);else for(var f=0;f<o.length;f++)s.addValue(l.settings.storeproperty,o[f]);break;case"DatePicker":(a=r.filter(".hiddenInput").val())&&("set"===l.settings.overwriteValue?s.setValue(l.settings.storeproperty,a):s.addValue(l.settings.storeproperty,a));break;default:a=unescape(r.val()),"set"===l.settings.overwriteValue?s.setValue(l.settings.storeproperty,a):s.addValue(l.settings.storeproperty,a)}}},_tmpl:function(e,t){var i=/\W/.test(e)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):this.cache[e]=this.cache[e]||tmpl(document.getElementById(e).innerHTML);return t?i(t):i}});var a = [];var i='forms';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});a.push({url: p + i + '/1.1.22/frontend/src/node_modules/@blueconic/actionhandlers-frontend/AfterSubmitActionHandler.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.22/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({PF_PROPERTY_PREFIX:"gtmpf",BLUECONIC_EVENT_PREFIX:"GTM:",init:function(e,t){this.blueConicClient=e,this.context=t||null,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.parameters=this.migrate(this.parameters),this.objectName=this.parameters.objectname&&this.parameters.objectname.length>0&&this.parameters.objectname[0]?this.parameters.objectname[0]:"dataLayer",this._goals=[];var i=t.getGoals().reduce(function(e,t){return e[t.getId()]=!0,e},{});if(this.parameters.goalParameters)for(var n=0;n<this.parameters.goalParameters.length;n++){var a=e.json.parse(this.parameters.goalParameters[n]);a.active&&i[a.id]&&this._goals.push(a)}this.connectionContext={LAST_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),VARIABLE_STATE_PUSH_PROPERTY:this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId(),profile:this.profile,variables:[],SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection",RECEIVED_FROM_SYSTEM_PROPERTY:"received_from_system",RECEIVED_FROM_CONNECTION_PROPERTY:"received_from_connection"}},initDataLayerUtil:function(){this.bcConnectionUtil.md5Lib=this.md5,this._bcDatalayerUtil=new this.BlueConicDataLayerUtil(this.objectName,this.blueConicClient,this.bcConnectionUtil,this.context,this.connectionContext,this.profile),this._bcDatalayerUtil.LAST_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),this._bcDatalayerUtil.VARIABLE_STATE_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId()},onLoad:function(){this.initDataLayerUtil();var e=this,t=0;(function i(){if(e._bcDatalayerUtil.getDataLayer())e._handleGoals();else{if(t>20)return;t++,window.setTimeout(i,250)}}).call(this)},_handleGoals:function(){for(var e=0;e<this._goals.length;e++){var t=this._goals[e],i=t.parameters.segment?t.parameters.segment[0]:null;this._bcDatalayerUtil.visitorInSegment(i)&&("export"===t.type&&this._handleExportGoal(t.parameters,t.id),"import"===t.type&&this._handleImportGoal(t.parameters))}},_handleImportGoal:function(e){var t=this._bcDatalayerUtil.getDataLayer();if(t){this._bcDatalayerUtil.doImport(e),this._publishEvents();var i=this,n=t.length;window.setInterval(function(){t=i._bcDatalayerUtil.getDataLayer(),n!==t.length&&(i._publishEvents(n),n=t.length)},1e3)}},_publishEvents:function(e){for(var t=this._bcDatalayerUtil.getDataLayer(),i=e=e||0;i<t.length;i++){var n=t[i].event;n&&this.blueConicClient.event.publish(this.BLUECONIC_EVENT_PREFIX+n,[t[i]])}},_handleExportGoal:function(e,t){this._bcDatalayerUtil.doExport(e,t);var i=Array.isArray(e.push_interactions)&&"true"===e.push_interactions[0],n=Array.isArray(e.passOnEvents)&&"true"===e.passOnEvents[0];!window[this.objectName]||window[this.objectName].push?(i&&this.blueConicClient.event.subscribe("VIEW",this,this._pushInteractionView),n&&this._subscribeToPassOnEvents()):console.warn("window."+this.objectName+" does not have a push function: is the correct Object Name entered?")},getPreloadProperties:function(){for(var e=[this.connectionContext.SENT_TO_SYSTEM_PROPERTY,this.connectionContext.SENT_TO_CONNECTION_PROPERTY,this.connectionContext.RECEIVED_FROM_SYSTEM_PROPERTY,this.connectionContext.RECEIVED_FROM_CONNECTION_PROPERTY],t=0;t<this._goals.length;t++){var i=this._goals[t];if("export"===i.type){e.push(this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId()+"_"+i.id),e.push(this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId()+"_"+i.id);for(var n=this.blueConicClient.json.parse(i.parameters.exportMapping),a=0;a<n.length;a++)"property"===n[a].from.dataType&&n[a].from.values.length>0&&e.push(n[a].from.values[0].id)}else for(var r=this.blueConicClient.json.parse(i.parameters.importMapping),s=0;s<r.length;s++)r[s].to.values.length>0&&e.push(r[s].to.values[0].id)}return e},_pushInteractionView:function(e,t){var i=this.blueConicClient.getInteractionNamesById(t);if(null!==i){var n=i.variantName?i.name+" / "+i.variantName:i.name;window[this.objectName].push({event:"bcInteractionView",name:n})}},_subscribeToPassOnEvents:function(){var e,t=[["inactivity","Inactivity"],["exitintent","Exit Intent"],["cm_firstview","Content Meter View 1"],["cm_exceeded","Content Meter Exceeded"],["cm_lastview","Content Meter Last View"],["cm_excluded","Content Meter Excluded View"],["cm_bottom","Content Meter Bottom Range"],["cm_middle","Content Meter Middle Range"],["cm_top","Content Meter Top Range"],["cm_already_viewed","Content Meter Already Viewed"],["cm_free_view","Content Meter Free View"],["cm_last_free_view","Content Meter Last Free View"]];for(e=2;e<10;e++)t.push(["cm_view_"+e,"Content Meter View "+e]);for(e=1;e<10;e++)t.push(["cm_free_view_"+e,"Content Meter Free View "+e]);var i=this;t.forEach(function(e){i.blueConicClient.event.subscribe(e[0],i,function(){window[this.objectName].push({event:"bcEvent",bcEventName:e[1]})})})},migrate:function(e){var t=parseInt(e.version||"2");return!e.usecases&&!e.variables||e.goalParameters||(t=1),t<2&&(e=this._migrateToV2(e),t=2),t<3&&(e=this._migrateToV3(e)),e},_migrateToV2:function(e){var t={objectname:e.objectname},i=[];if(-1!==e.usecases.indexOf("uc2")){var n={id:1,name:"Import",active:!0,type:"import"},a=[];if(e.importVariables&&e.importVariables.length>0)for(var r=this.blueConicClient.json.parse(e.importVariables[0]),s=0;s<r.length;s++)a.push({from:{fieldId:r[s].fieldLabel},to:{type:"property",property:r[s].property},restriction:r[s].restriction,mergeRule:r[s].mergeRule});n.parameters={importMapping:[this.blueConicClient.json.stringify(a)]},i.push(this.blueConicClient.json.stringify(n))}if(-1!==e.usecases.indexOf("uc1")){var o={id:2,name:"Export",active:!0,type:"export"},l=[];if(e.variables&&e.variables.length>0)for(var c=this.blueConicClient.json.parse(e.variables[0]),h=0;h<c.length;h++)l.push({to:{fieldId:c[h].key},from:{type:"pm"===c[h].type?"permission":c[h].type,property:c[h].property,segments:c[h].segments,fieldId:c[h].text}});o.parameters={exportMapping:[this.blueConicClient.json.stringify(l)],eventname:e.eventname,push_frequency:e.push_frequency,push_interactions:e.push_interactions,passOnEvents:e.passOnEvents,triggerEvent:e.triggerEvent},i.push(this.blueConicClient.json.stringify(o))}return t.goalParameters=i,t},_migrateToV3:function(e){return e.goalParameters=(e.goalParameters||[]).map(JSON.parse).map(function(e){if("export"===e.type){var t=e.parameters.eventname?e.parameters.eventname[0]:null;e.parameters.eventname=[t||"BlueConic"]}return JSON.stringify(e)}),e}});var a = [];var i='gtmconnection';a.push({url: p + i + '/3.0.2/frontend/src/node_modules/@blueconic/connection_lib/connection_lib.js', sharing: 'local'});a.push({url: p + i + '/3.0.2/frontend/src/node_modules/@blueconic/datalayer_lib/datalayer_lib.js', sharing: 'local'});a.push({url: p + i + '/3.0.2/frontend/src/lib/jsonpath.min.js', sharing: 'local'});a.push({url: p + i + '/3.0.2/frontend/src/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/3.0.2/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({_timeout:null,_timestamp:null,_interval:200,init:function(a,b){this.blueConicClient=a,this.context=b||null},onLoad:function(){var a=this.jQuery,b=this;this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){this._setTimestamp(),clearTimeout(b._timeoutID),b._timeoutID=setTimeout(function(){b._checkTimeout()},b._interval)}),this._setTimestamp();var c,d=this.context.getParameters(),e="true"===d.clicks[0],f="true"===d.inputs[0],g=d.scrolling;c=!g||"true"===d.scrolling[0],this._timeout=d.timeout[0],this._timeout?!isNaN(parseInt(this._timeout))&&(this._timeout=1e3*parseInt(this._timeout)):this._timeout=60000;(e||f||c)&&(e&&a(document).on("click","*",function(){b._setTimestamp()}),f&&(a("input").on("keyup",function(){b._setTimestamp()}),a("textarea").on("keyup",function(){b._setTimestamp()}),a("select").on("change",function(){b._setTimestamp()}),a("input").on("change",function(){b._setTimestamp()})),c&&a(window).scroll(function(){b._setTimestamp()}),this._timeoutID=setTimeout(function(){b._checkTimeout()},b._interval))},_handleInactivity:function(){this.blueConicClient.createEvent("inactivity")},_checkTimeout:function(){var a=new Date().getTime(),b=this;a-this._timestamp>this._timeout?this._handleInactivity():b._timeoutID=setTimeout(function(){b._checkTimeout()},b._interval)},_setTimestamp:function(){this._timestamp=new Date().getTime()}});var a = [];var i='inactivitylistener';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.11/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.interaction=b},onLoad:function(){var a=this.interaction.getProfile(),b=this.interaction.getParameters(),c=b.ip_range_rules?b.ip_range_rules[0]:b.ip_range_rules,d=b.property?b.property[0]:b.property,e=this.blueConicClient.getIPAddress();if(c&&d&&e&&(c=this.blueConicClient.json.parse(c),0!==c.length)){for(var f=!1,g=0;g<c.rules.length;g++){var h=c.rules[g],i=h.lowest,k=h.highest,l=h.addset,m=h.values;if(i&&k&&m&&0<m.length){var n,o,p;if(1<i.split(":").length&&1<k.split(":").length&&1<e.split(":").length?(n=this.ip2num(this.ip6hexToNumber(e)),o=this.ip2num(this.ip6hexToNumber(i)),p=this.ip2num(this.ip6hexToNumber(k))):(n=this.ip2num(e),o=this.ip2num(i),p=this.ip2num(k)),n<=p&&n>=o)if(f=!0,"add"===l)for(var q=0;q<m.length;q++)a.addValue(d,m[q]);else a.setValues(d,m)}}f&&this.blueConicClient.profile.updateProfile()}},ip2num:function(b){var c=b.split(".");0===c.length&&(c=b.split(":")),4===c.length&&c.unshift(0,0,0,0);var d=256*(256*(256*(256*(256*(256*(256*+c[0]+ +c[1])+ +c[2])+ +c[3])+ +c[4])+ +c[5])+ +c[6])+1*+c[7];return d},ip6hexToNumber:function(a){for(var b=a.split(":"),c=[],d=0;d<b.length;d++)if(""===b[d])for(var e=0;e<=8-b.length;e++)c.push(0);else c.push(parseInt(b[d],16));return c.join(".")}});var a = [];var i='iplistenerinteractiontype';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/2.0.8/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(t,e){this.blueConicClient=t,this.context=e,this.parameters=this.context.getParameters(),this.isInEditMode=this.blueConicClient.isInEditMode(),this.fancyBoxLib="frontend/src/lib/fancybox/jquery.fancybox.pack.js";var i=this.context.getInteractionTypeId();this.baseURL=this.blueConicClient.getBaseURL(i);var n=this.parameters.content+"";this.htmlFragment=this.createElement(n),this.profile=t.profile.getProfile(),this.inlineCss=null,this._timestamp=null,this._observer=null,this._eventListenerFunction=null,this._lightboxTriggered=!1,this.blueConicClient._renderedInteractions=this.blueConicClient._renderedInteractions||[],this.blueConicClient.event.subscribe(this.blueConicClient.event.onUrlChange,this,function(){var t=this.blueConicClient.util.array.indexOfArray(this.blueConicClient._renderedInteractions,this.context.getInteractionId());this.blueConicClient._renderedInteractions.splice(t,1)})},getPreloadProperties:function(){for(var t,e=this.context.getParameters().content+"",i=/data-bc-preload="([^"]*)"/g,n=[];null!==(t=i.exec(e));)for(var o=t[1].split(","),r=0;r<o.length;r++)n.push(o[r]);for(var s=this.htmlFragment?this._getPropertiesFromPlaceholders(this.htmlFragment.innerHTML):[],a=0;a<n.length;a++)s.push(n[a]);return s},onMessageReceived:function(t){this.blueConicClient.event.publish("lightbox.messageReceived",t)},onLoad:function(){window.bc=window.bc||{},window.bc.jQuery=this.jQuery,window.bc.$=this.jQuery,window.bcFancyboxLoading?this.blueConicClient.event.subscribe("bcFancyboxLoaded",this,function(){this.onLoad()}):this.blueConicClient._lightboxinteractiontypeFancybox?(this.jQuery.fancybox=this.blueConicClient._lightboxinteractiontypeFancybox,this._onLoadWithLibrary()):(window.bcFancyboxLoading=!0,this.blueConicClient.util.loadScript(this.baseURL+this.fancyBoxLib,this,function(){this.blueConicClient._loadLightboxInteractionTypeFancyBox(window,document,this.jQuery),this.blueConicClient._lightboxinteractiontypeFancybox=this.jQuery.fancybox,delete this.blueConicClient._loadLightboxInteractionTypeFancyBox,this._onLoadWithLibrary(),window.bcFancyboxLoading=!1,this.blueConicClient.event.publish("bcFancyboxLoaded")}))},_onLoadWithLibrary:function(){if(this.isInEditMode)this.showLightbox();else{var t=this.parameters.selected_when||[],e=this.getParameter("click_selector");e&&-1!==this.blueConicClient.util.array.indexOfArray(t,"click_selector")&&this._addClickTriggerBindings(e);var i=this.getParameter("content_condition");i&&-1!==this.blueConicClient.util.array.indexOfArray(t,"content_condition")&&this._addContentPolling(i);var n=this.parameters.scroll_depth&&this.parameters.scroll_depth[0]&&!isNaN(this.parameters.scroll_depth[0])?parseInt(this.parameters.scroll_depth[0]):0;n&&-1!==this.blueConicClient.util.array.indexOfArray(t,"scroll_depth")&&this._addScrollBinding(n),0===t.length&&this.showLightbox(),this._addCloseEventHandler()}},_checkScrollCondition:function(t){this.jQuery(window).scrollTop()/(this.jQuery(document).height()-window.innerHeight)*100>=t&&this.showLightbox()},_addScrollBinding:function(t){this._checkScrollCondition(t),this.jQuery(window).scroll(this.jQuery.proxy(function(){this._checkScrollCondition(t)},this))},_addClickTriggerBindings:function(t){try{var e=this.jQuery(t);e.length>0?e.off("click.lightboxinteractiontype").on("click.lightboxinteractiontype",this.jQuery.proxy(function(){this.showLightbox(!0)},this)):this.blueConicClient.position.subscribe(t,this,this.jQuery.proxy(this._addClickTriggerBindings,this,t))}catch(t){}},_addContentPolling:function(t){this._checkContentCondition(t);var e=this,i=document.getElementsByTagName("body")[0];if(window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)this._observer=new MutationObserver(function(){e._observeContentChanges(t)}),this._observer.observe(i,{childList:!0,subtree:!0});else if(window.addEventListener)this._eventListenerFunction=function(){e._observeContentChanges(t)},i.addEventListener("DOMNodeInserted",this._eventListenerFunction,!1);else var n=setInterval(function(){e._lightboxTriggered?clearInterval(n):e._checkContentCondition(t)},500)},_observeContentChanges:function(t){if(this._lightboxTriggered){this._observer?this._observer.disconnect():document.getElementsByTagName("body")[0].removeEventListener("DOMNodeInserted",this._eventListenerFunction,!1)}else{var e=this,i=(new Date).getTime();this._timestamp=i,setTimeout(function(){e._timestamp!==i||e._lightboxTriggered||e._checkContentCondition(t)},250)}},_checkContentCondition:function(t){this.jQuery(t).length>0&&this.jQuery(t).html()&&this.jQuery(t).html().length>0&&this.showLightbox()},closeLightbox:function(){this.isInEditMode||this.jQuery.fancybox.close()},_addCloseEventHandler:function(){this.blueConicClient.event.subscribe("closeoverlay",this,function(t,e){e instanceof Array&&e[0]===this.context.getInteractionId()&&this.closeLightbox()})},showLightbox:function(t){if(-1===this.blueConicClient.util.array.indexOfArray(this.blueConicClient._renderedInteractions,this.context.getInteractionId())){this.blueConicClient._renderedInteractions.push(this.context.getInteractionId());this.parameters.selected_when;if(!this._lightboxTriggered||this.isInEditMode||t){var e=this.parameters.delay&&this.parameters.delay[0]&&!isNaN(this.parameters.delay[0])?1e3*parseInt(this.parameters.delay[0]):0;!this.isInEditMode&&e>0?window.setTimeout(this.jQuery.proxy(function(){this._showLightbox()},this),e):this._showLightbox()}}},getSettings:function(){var t=null,e=this.getParameter("width")||null,i=this.getParameter("height")||null,n="true"===this.getParameter("hide_after_close");this.htmlFragment&&(t=this.htmlFragment.innerHTML);var o=!(e||i),r=this.getParameter("show_close"),s=this.getParameter("alternative_close"),a={parent:"body",autoSize:o,autoCenter:!1,autoWidth:!e,autoHeight:!i,closeBtn:"false"!==r,width:e||"auto",height:i||"auto",keys:{close:"false"===s||this.isInEditMode?null:[27]},helpers:{overlay:{locked:!0,closeClick:"false"!==s&&!this.isInEditMode}}};this.getParameter("template")&&(a.padding=0),(t||this.isInEditMode)&&(a.content=" ",a.type="inline");var c=this,l=this.jQuery,h=this.getParameter("effect"),d=this.getParameter("effect_slide_direction")||"left";if(this.isInEditMode&&(h="noEffect"),h&&"noEffect"!==h&&("fadeIn"===h?l.fancybox.transitions.openEffect=function(){var t=l.fancybox._getPosition(!0);t.opacity=0,l.fancybox.wrap.css(t).show().animate({opacity:1},{duration:l.fancybox.current.openSpeed,complete:l.fancybox._afterZoomIn})}:"slideIn"===h&&(l.fancybox.transitions.openEffect=function(){var t,e=l.fancybox._getPosition(!0),i=l(window).height(),n=l(window).width(),o=l(".fancybox-wrap").get(0).getBoundingClientRect(),r="top"===d||"bottom"===d?"top":"left";"top"===d||"bottom"===d?t=i-(i-o.height)/2:"left"!==d&&"right"!==d||(t=n-(n-o.width)/2),e[r]="top"===d||"left"===d?parseInt(e[r])-t+"px":parseInt(e[r])+t+"px";var s={},a="top"===d||"left"===d?"+":"-";s[r]=a+"="+t+"px",l.fancybox.wrap.css(e).show().animate(s,{duration:l.fancybox.current.openSpeed,complete:l.fancybox._afterZoomIn})}),l.fancybox.transitions.openEffect&&(a.openMethod="openEffect",a.openSpeed=1e3)),t)a.afterLoad=function(){c.emptyElementsWithAttribute(c.htmlFragment,"div","data-bc-external");try{l(".fancybox-inner").html(c.htmlFragment.innerHTML)}catch(t){console.error("[BC] Error occured when injecting the HTML in the DOM",t)}c.isInEditMode&&c.blueConicClient.event.publish("lightbox.interactionLoaded",{interaction:c}),c.handleComplexElements(l(".fancybox-inner").get(0));var t=c.getParameter("javascript");if(t&&!c.blueConicClient.isInEditMode()){t=t.replace(/(^|\W)blueConicVariantId(\W|$)/g,'$1"'+c.context.getInteractionId()+'"$2'),c._inlineJs=c.jQuery("<script>"+t+"<\/script>");try{c._inlineJs.appendTo(c.jQuery("body"))}catch(t){console.error(t)}}};else if(c.isInEditMode){a.afterLoad=function(){c.blueConicClient.event.publish("lightbox.interactionLoaded",{interaction:c})}}return this.isInEditMode?a.afterShow=function(){l(".fancybox-close").off("click.fb")}:n&&(a.afterShow=function(){l(".fancybox-close").on("click",l.proxy(function(){this.blueConicClient.doNotShowAgain(this.context.getInteractionId())},this))}.bind(this)),a.afterClose=function(){var t=c.blueConicClient.util.array.indexOfArray(c.blueConicClient._renderedInteractions,c.context.getInteractionId());c.blueConicClient._renderedInteractions.splice(t,1)},a},updateLightbox:function(){this.jQuery.fancybox.update()},getCurrentFancyBox:function(){return this.jQuery.fancybox.current},_showLightbox:function(){this._lightboxTriggered=!0;var t=this.jQuery,e=this.getParameter("close_icon"),i=this.getParameter("close_icon_hover"),n=this;function o(){if(!this.isInEditMode){this.blueConicClient.createEvent("VIEW",this.context.getInteractionId()),!!this.parameters.forceclick&&("true"===this.parameters.forceclick[0]||!0===this.parameters.forceclick[0])&&this.blueConicClient.createEvent("CLICK",this.context.getInteractionId());var e=this.getParameter("click_event_selector");if(e){this.jQuery("body").one("click",e,this.jQuery.proxy(function(t){this.lastClickEvent&&this.lastClickEvent.originalEvent===t.originalEvent||this._logClickEvent(t)},this));try{this.jQuery(e).one("click",this.jQuery.proxy(function(t){this.lastClickEvent=t,this._logClickEvent(t)},this))}catch(t){}}}t(".fancybox-wrap").remove(),t(".fancybox-overlay").remove(),this.highZindex=function(t){var e,i=document.getElementsByTagName(t),n=0,o=0;for(o=0;o<i.length;o++)"auto"!==(e=document.defaultView.getComputedStyle(i[o],null).getPropertyValue("z-index"))&&parseInt(e)>n&&(n=parseInt(e));return n}("*"),this.htmlFragment&&(this.emptyElementsWithAttribute(this.htmlFragment,"div","data-bc-external"),this.isInEditMode||this.handlePlaceholders(this.htmlFragment)),t.fancybox(this.getSettings()),this.highZindex>8e3&&this.highZindex+1030<2147483647&&(t(".fancybox-opened").css("z-index",this.highZindex+1030),t(".fancybox-wrap").css("z-index",this.highZindex+920),t(".fancybox-overlay").css("z-index",this.highZindex+910)),this.highZindex+1030>=2147483647&&(t(".fancybox-opened").css("z-index",2147483647),t(".fancybox-wrap").css("z-index",2147483646),t(".fancybox-overlay").css("z-index",2147483645)),this.isInEditMode||this._setupFrontEndBindings()}this.handleStyling(e,i,function(e){if(!e||(console.error(e),n.isInEditMode))n.handleJavascript().then(function(){o.call(n,t)},function(e){if(console.error("[BC] Loading Javascript urls for the lightbox failed:",e),n.isInEditMode)o.call(n,t);else{var i=n.blueConicClient.util.array.indexOfArray(n.blueConicClient._renderedInteractions,n.context.getInteractionId());n.blueConicClient._renderedInteractions.splice(i,1)}});else{var i=n.blueConicClient.util.array.indexOfArray(n.blueConicClient._renderedInteractions,n.context.getInteractionId());n.blueConicClient._renderedInteractions.splice(i,1)}})},_logClickEvent:function(t){t&&t.originalEvent&&t.originalEvent._blueConicLoggedClickEvent===this.context.getInteractionId()||(t&&t.target&&t.target.pathname&&t.target.hostname&&0===t.target.pathname.indexOf("/s/")&&-1!==t.target.hostname.indexOf("blueconic")||(t.originalEvent&&(t.originalEvent._blueConicLoggedClickEvent=this.context.getInteractionId()),this.blueConicClient.createEvent("CLICK",this.context.getInteractionId())))},_setupFrontEndBindings:function(){var t=this.jQuery(".bcLightboxDontShowAgainLink"),e=this.jQuery(".bcLightboxCloseButton");t.length>0&&t.off("click.dontShowAgainLinks").on("click.dontShowAgainLinks",this.jQuery.proxy(function(t){t.preventDefault(),this.blueConicClient.doNotShowAgain(this.context.getInteractionId()),this.closeLightbox()},this)),e.length>0&&e.off("click.closeButtons").on("click.closeButtons",this.jQuery.proxy(function(){this.closeLightbox()},this))},handleComplexElements:function(t){for(var e=this.getElementsWithAttribute(t,"div","data-bc-pluginid"),i=0;i<e.length;i++){var n=e[i],o=n.getAttribute("data-bc-pluginid"),r=n.getAttribute("data-bc-config");if(r)try{var s=r.replace(/\n/g,"\\\\n").replace(/\r/g,"\\\\r").replace(/\t/g,"\\\\t");r=this.blueConicClient.json.parse(s)}catch(t){r=null}this.blueConicClient.event.publish("bcComplexObject",{plugin:o,config:r,node:n,interactionId:this.context.getInteractionId()}),this.isInEditMode||(n.removeAttribute("data-bc-pluginid"),n.removeAttribute("data-bc-config"))}},emptyElementsWithAttribute:function(t,e,i){for(var n=this.getElementsWithAttribute(t,e,i),o=0,r=n.length;o<r;o++){n[o].innerHTML=""}},getElementsWithAttribute:function(t,e,i){for(var n=[],o=t.getElementsByTagName(e),r=0,s=o.length;r<s;r++){var a=o[r];a.getAttribute(i)&&n.push(a)}return n},createElement:function(t){var e;if(!t)return null;try{(e=document.createElement("div")).innerHTML=t}catch(t){return null}return e},handlePlaceholders:function(t){for(var e=this._getPropertiesFromPlaceholders(t.innerHTML),i=0;i<e.length;i++){var n=e[i],o=this.profile.getValue(n)||"",r=new RegExp("\\$\\{"+n+"\\}","g");t.innerHTML=t.innerHTML.replace(r,encodeURI(o))}},_getPropertiesFromPlaceholders:function(t){for(var e,i=/\$\{([a-zA-Z\-_0-9]+)\}/g,n=[];e=i.exec(t);)n.push(e[1]);return n},getParameter:function(t){return this.parameters[t]&&this.parameters[t][0]?this.parameters[t][0]:null},getParameters:function(t){return this.parameters[t]||null},handleJavascript:function(){var t=this.jQuery,e=this.getParameters("javascript_urls"),i=[];if(e){this.javascriptUrls=e;for(var n=0;n<e.length;n++)i.push(this._getLoadScriptDeferred(e[n]))}return t.when.apply(t,i)},_getLoadScriptDeferred:function(t){var e=this.jQuery.Deferred(),i=document.createElement("script");return i.setAttribute("src",t),i.onload=function(){e.resolve()},i.onerror=function(){e.reject('Url "'+t+"\" couldn't be loaded")},document.head.appendChild(i),e},handleStyling:function(t,e,i){var n=this.getParameter("content"),o=[this.baseURL+"frontend/src/lib/fancybox/jquery.fancybox.css"];n&&-1!==n.indexOf("bcLightboxTemplate")||o.push(this.baseURL+"frontend/src/css/lightbox.css");var r=this.getParameter("styling_css");r&&(this.stylingUrl=r,o.push(r));var s="";"true"===this.getParameter("custom_close")&&t&&(s+=".fancybox-close {background-image: url('"+t+"');background-repeat: no-repeat;background-position: center center;background-size: contain;}",e&&(s+=".fancybox-close:hover {background-image: url('"+e+"');background-repeat: no-repeat;background-position: center center;background-size: contain;}"));var a=this.getParameter("close_position"),c=this.getParameter("close_padding");s+=this._getClosePositionStyling(a,c);var l=this.getParameter("styling_css_inline");return l&&(s+=l.replace(/&#xd;/gi,"")),s&&(this.inlineCss=this.jQuery("<style>"+s+"</style>"),this.inlineCss.appendTo(this.jQuery("body"))),this._loadCssUrls(o,i)},_loadCssUrls:function(t,e){var i=(t=t||[]).length,n=0,o=[];if(0===i)return e();function r(){if(++n>=i)return o.length>0?e(o):e()}t.forEach(function(t){if(document.querySelector('link[href="'+t+'"]'))r();else{var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href",t),e.onload=r,e.onerror=function(t){o.push(t),r()},document.head.appendChild(e)}})},_getClosePositionStyling:function(t,e){if(!t)return"";null!==e&&"NaN"!==e||(e="-18");var i=".fancybox-close {";switch(t){case"TOP_LEFT":i+="top:"+e+"px; right: unset; bottom: unset; left:"+e+"px;";break;case"BOTTOM_RIGHT":i+="top: unset; right: "+e+"px; bottom: "+e+"px; left: unset;";break;default:i+="top: "+e+"px; right: "+e+"px; bottom: unset; left: unset;"}return i+"}"}});var a = [];var i='lightboxinteractiontype';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/2.2.20/'},{ id : 'html', baseUrl : ps + 'html/1.0.10/'},{ id : 'image', baseUrl : ps + 'image/1.0.2/'},{ id : 'number', baseUrl : ps + 'number/1.0.2/'},{ id : 'string', baseUrl : ps + 'string/1.0.1/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({EVENT_NAME:"adblock_detected",init:function(a,b){this.blueConicClient=a,this.context=b},getPreloadProperties:function(){var a=this.context.getParameters(),b=a.property?a.property[0]:a.property;return b?[b]:[]},onLoad:function(){var a=this,b=this.context.getProfile(),c=this.context.getParameters(),d=c.property?c.property[0]:c.property;d||(d=this.EVENT_NAME);var e=function(){"no"!==b.getValue(d)&&(b.setValue(d,"no"),a.blueConicClient.profile.updateProfile())},f=function(){"yes"!==b.getValue(d)&&(b.setValue(d,"yes"),a.blueConicClient.profile.updateProfile()),a.blueConicClient.createEvent(a.EVENT_NAME)};window.blockAdBlock?(window.blockAdBlock.on(!1,e),window.blockAdBlock.on(!0,f),window.blockAdBlock.check()):e()}});var a = [];var i='listener_adblock';a.push({url: p + i + '/1.0.16/lib/blockadblock.min.js', sharing: 'none'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.0.16/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b},getPreloadProperties:function(){var a=this.context.getParameters(),b=a.responseProperty?a.responseProperty[0]:a.responseProperty;return b?(this.campaignIdentifierProperty=b,[b]):(this.campaignIdentifierProperty="responded_to_campaigns",["responded_to_campaigns"])},onLoad:function(){var a=this.context.getProfile(),b=this.context.getParameters(),c=this.blueConicClient,d=!1,e=!1,f=b.config?b.config[0]:b.config;if(f){for(var g=this.blueConicClient.json.parse(f),h=0;h<g.length;h++){var i=g[h],j=this.getParameterByName(i.parameter);j&&i.profileProperty&&(a.addValue(i.profileProperty,j),d=!0,i.isCampaignIdentifier&&!e&&(this._bindHandlers(j),e=!0))}d&&c.profile.updateProfile()}},_bindHandlers:function(a){var b=this,c=this.context.getProfile(),d=this.blueConicClient,e=this.jQuery;e("a").click(function(){c.addValue(b.campaignIdentifierProperty,a),d.profile.updateProfile()}),e("form").submit(function(){c.addValue(b.campaignIdentifierProperty,a),d.profile.updateProfile()})},getParameterByName:function(a){if(!a)return"";a=a.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&#]"+a+"=([^&#]*)"),c=b.exec(location.href);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}});var a = [];var i='listener_campaign_tracker';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.0.17/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({PARAMETERS:{ENGAGEMENT_PROPERTY:"engagementProperty",ENGAGEMENT_SCORE_PROPERTY:"engagementScoreProperty",DECAY:"decay",ENGAGEMENT_ON_CHANNEL:"engagementOnChannel"},DEFAULTS:{ENGAGEMENT:"engagement",ENGAGEMENT_SCORE:"engagement_score",VISITS:"visits",CLICKCOUNT:"clickcount"},SCORES:{LOW:"low",MEDIUM:"medium",HIGH:"high"},DEFAULT_DECAY:50,init:function(e,t){this.blueConicClient=e,this.context=t,this.parameters=t.getParameters(),this._channelId=e.getChannelId();var i="true"===this.getParameterValue(this.PARAMETERS.ENGAGEMENT_ON_CHANNEL)&&this._channelId;this.properties={engagement:this.getParameterValue(this.PARAMETERS.ENGAGEMENT_PROPERTY,this.DEFAULTS.ENGAGEMENT),engagementScore:this.getParameterValue(this.PARAMETERS.ENGAGEMENT_SCORE_PROPERTY,this.DEFAULTS.ENGAGEMENT_SCORE),engagementObject:"_"+this.getParameterValue(this.PARAMETERS.ENGAGEMENT_PROPERTY,this.DEFAULTS.ENGAGEMENT),visits:this.DEFAULTS.VISITS+(i?"_"+this._channelId:""),clickcount:this.DEFAULTS.CLICKCOUNT+(i?"_"+this._channelId:"")};var r=new Date(2015,0,1,0,0,0,0),n=(new Date).getTime()-r.getTime();this.days=Math.floor(n/864e5),this.weekNr=Math.floor(this.days/7),this.decay=parseInt(this.getParameterValue(this.PARAMETERS.DECAY))||this.DEFAULT_DECAY},getPreloadProperties:function(){return[this.properties.engagementObject,this.properties.visits,this.properties.clickcount]},onLoad:function(){var e=this.context.getProfile(),t=e.getValue(this.properties.clickcount)?parseInt(e.getValue(this.properties.clickcount)):0,i=e.getValue(this.properties.visits)?parseInt(e.getValue(this.properties.visits)):0,r=e.getValues(this.properties.engagementObject).map(function(e){return this.blueConicClient.json.parse(e)||{}}.bind(this)),n=this._clearInvalidValues(r,i),s=n.cleanedValues,a=this._sumInternalValues(s),h=this._addCurrentWeek(a,t,i),o=this._getCalculated(a,i,t),c=this._calculateScore(o);isNaN(c)||((h||s.length>1||n.removedValues)&&e.setValue(this.properties.engagementObject,JSON.stringify(a)),this._setEngagement(e,c))},getParameterValue:function(e,t){return this.parameters&&this.parameters[e]&&this.parameters[e][0]?this.parameters[e][0]:t},_clearInvalidValues:function(e,t){var i=!1;return e.forEach(function(e){var r=Object.keys(e).filter(function(e){return-1!==e.indexOf("v")}).map(function(e){return parseInt(e.substring(1))});r.sort(function(e,t){return t-e}),r.forEach(function(r){(i||e["v"+r]>t||e["v"+r]<0)&&(delete e["v"+r],delete e["c"+r],i=!0)})},this),{removedValues:i,cleanedValues:e}},_sumInternalValues:function(e){var t={};return e.forEach(function(e){Object.keys(e).forEach(function(i){t[i]=(t[i]||0)+e[i]})}),t},_setEngagement:function(e,t){var i=this.context.getParameters(),r=parseInt(i.lowTreshold?i.lowTreshold[0]:i.lowTreshold),n=parseInt(i.highTreshold?i.highTreshold[0]:i.highTreshold),s=this.SCORES.MEDIUM;t<r?s=this.SCORES.LOW:t>n&&(s=this.SCORES.HIGH),e.setValue(this.properties.engagementScore,t),e.setValue(this.properties.engagement,s),this.blueConicClient.profile.updateProfile()},_addCurrentWeek:function(e,t,i){var r=!1;return e["v"+this.weekNr]||(e["v"+this.weekNr]=i,r=!0),e["c"+this.weekNr]||(e["c"+this.weekNr]=t,r=!0),r},_calculateScore:function(e){for(var t=0,i=0;i<e.length;i++){var r=this._getWeight(i+1,this.decay),n=e[i];t+=(n.clickCount+5*n.visits)*r}return t=Math.floor(t)},_getWeight:function(e,t){return e<=.1*t?1:e<=.2*t?.8:e<=.4*t?.5:e<=t?.3:.1},_getCalculated:function(e,t,i){for(var r=[],n=this.weekNr;n>0;n--){var s=0;e["v"+n]&&(t-=s=Math.max(t-e["v"+n],0));var a=0;e["c"+n]&&(i-=a=Math.max(i-e["c"+n],0)),r.push({week:n,visits:s,clickCount:a})}return r}});var a = [];var i='listener_engagement';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.0/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b},getPreloadProperties:function(){return[]},onLoad:function(){}});var a = [];var i='listener_geolocation';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.0.12/'}]);})();(function(){ var InteractionTypeImpl = InteractionType.extend({
  init: function(blueConicClient, interactionContext) {
    this.blueConicClient = blueConicClient;
    this.context = interactionContext;
  },

  onLoad: function() {
    this.sendQueue();
    this.blueConicClient.event.subscribe(
      'VIEW',
      this,
      function(event, interactionId) {this.eventReact(interactionId, "VIEW");}
    );

    this.blueConicClient.event.subscribe(
      'CLICK',
      this,
      function(event, interactionId) {this.eventReact(interactionId, "CLICK");}
    );

    this.blueConicClient.event.subscribe(
      'CONVERSION',
      this,
      function(event, interactionId) {this.eventReact(interactionId, "CONVERSION");}
    );
  },

  getInteraction: function(interactionId) {
    var interaction = this.blueConicClient.getInteractionNamesById(interactionId);
    if (!interaction) {
      this.blueConicClient.util.log("No interaction could be loaded");
      return {variantId: interactionId};
    }
    var obj = {};
    if (interaction.name) {
      obj.dialogue = interaction.name;
    }
    if (interaction.dialogueId) {
      obj.dialogueId = interaction.dialogueId;
    }
    if (interaction.variantName) {
      obj.variant = interaction.variantName;
    }
    if (interaction.id) {
      obj.variantId = interaction.id;
    }
    return obj;
  },

  hasLoaded: function() {
    return window.dataLayer;
  },

  sendQueue: function() {
    if (!this.hasLoaded()) {
      var counter = 0;
      var me = this;
      var intervalId = setInterval(function() {
        if (me.hasLoaded()) {
          me.blueConicClient.util.log("DataLayer available");
          if (me.eventQueue.length > 0) {
            me.blueConicClient.util.log("Flushing Queue");
          }
          for (var i = 0; i < me.eventQueue.length; i++) {
            me.eventSend(me.eventQueue[i]);
          }
          me.eventQueue = [];
          clearInterval(intervalId);
        } else if (counter++ > 20) {
          me.blueConicClient.util.log("Stop checking dataLayer");
          clearInterval(intervalId);
        }
      }, 300);
    } else {
      this.blueConicClient.util.log("DataLayer available");
    }
  },

  eventQueue: [],

  eventSend: function(eventObject) {
    this.blueConicClient.util.log("Pushing event: " + eventObject.event);
    window.dataLayer.push(eventObject);
  },

  eventReact: function(interactionId, eventType) {
    var gtmObject = {
      event: "BlueConic." + eventType,
      dialogue: this.getInteraction(interactionId)
    };
    if (this.hasLoaded()) {
      this.eventSend(gtmObject);
    } else {
      this.eventQueue.push(gtmObject);
    }
  }
});
var a = [];var i='listener_gtm_actions';a.push({url: '/plugins/listener_gtm_actions/js/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : 'https://theatlantic.blueconic.net/plugins/listener_gtm_actions/ts_015c80329fad3812639394a904eeb8a5/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b;var c=new Date(2017,8,1,0,0,0,0),d=this.blueConicClient.getCurrentDate().getTime(),e=d-c.getTime();this.days=Math.floor(e/86400000)},getPreloadProperties:function(){return[]},onLoad:function(){var a=this.context.getProfile(),b=this.context.getParameters(),c=b.property?b.property[0]:b.property;if(c){var d=this.blueConicClient.util.array.ensureArray(b.excludedKeywords),e=this.blueConicClient.json.parse(c)[0].profileproperty,f=[],g=document.getElementsByTagName("meta");if(g)for(var h=!1,j=0,k=g.length;j<k;j++)if("news_keywords"===g[j].name.toLowerCase()){var l=g[j].content.split(",");0===l.length||1===l.length&&""===l[0]||(f=l,h=!0)}else h||0!==f.length||"keywords"!==g[j].name.toLowerCase()||(f=g[j].content.split(","));if(0<f.length){for(var m,n={TIME:new Date().getTime(),days:this.days,points:1,keywords:[]},o=0;o<f.length;o++)m=this._trim(f[o]),""!==m&&-1===this.blueConicClient.util.array.indexOfArray(d,m)&&n.keywords.push(m);0<n.keywords.length&&(a.addValue("_hl_"+e,this.blueConicClient.json.stringify(n)),this.blueConicClient.profile.updateProfile())}}},_trim:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}});var a = [];var i='listener_meta_keywords_ranker';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.2.6/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b;var c=new Date(2017,8,1,0,0,0,0),d=this.blueConicClient.getCurrentDate().getTime(),e=d-c.getTime();this.days=Math.floor(e/86400000)},getPreloadProperties:function(){return[]},onLoad:function(){var a=this.context.getProfile(),b=this.context.getParameters(),c=b.property?b.property[0]:b.property;if(c){var d=this.blueConicClient.json.parse(c)[0].profileproperty,e=this.blueConicClient.getCurrentDate(),f=this._getTimeFrame(e.getHours(),b.locale[0]),g={TIME:new Date().getTime(),data:[]};g.data.push({n:f,p:1,d:this.days}),a.addValue("_hl_"+d,this.blueConicClient.json.stringify(g)),this.blueConicClient.profile.updateProfile()}},_getTimeFrame:function(a,b){return this._getHour(a,b)+" - "+this._getHour(a+1,b)},_getHour:function(a,b){if("en-us"===b){var c=12<=a?"PM":"AM";return a%=12,a=0===a?12:a,a+" "+c}return a=10>a?"0"+a:a,a+":00"}});var a = [];var i='listener_preferred_hour';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.2.4/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this._maxScrollPercent=0,this._minScrollPercent=100},_fireScrollDownEvent:function(a){a>this._maxScrollPercent&&(this._maxScrollPercent=a,this._minScrollPercent=a,this.blueConicClient.createEvent("scroll_"+a.toString()+"_percent"))},_fireScrollUpEvent:function(a){a<this._minScrollPercent&&this._maxScrollPercent>a&&(this._minScrollPercent=a,this.blueConicClient.createEvent("scroll_up_"+a.toString()+"_percent"))},_checkScrollCondition:function(){var a=this.jQuery(window).scrollTop(),b=this.jQuery(document).height(),c=100*(a/(b-window.innerHeight));80<=c?this._fireScrollDownEvent(80):50<=c?this._fireScrollDownEvent(50):20<=c&&this._fireScrollDownEvent(20),5>c?this._fireScrollUpEvent(0):20>=c?this._fireScrollUpEvent(20):50>=c?this._fireScrollUpEvent(50):80>=c&&this._fireScrollUpEvent(80)},onLoad:function(){this._checkScrollCondition(),this.jQuery(window).scroll(this.jQuery.proxy(this._checkScrollCondition,this))}});var a = [];var i='listener_scroll';a.push({url: 'http://code.jquery.com/jquery-1.11.2.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : 'https://theatlantic.blueconic.net/plugins/listener_scroll/ts_4afa5d6c8aaf98f7b6ec4bfbcd18fd12/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b;var c=new Date(2012,0,1,0,0,0,0),d=new Date,e=d.getTime()-c.getTime();this.days=Math.floor(e/86400000)},getPreloadProperties:function(){return[]},onLoad:function(){var a=this.context.getParameters(),b=a.config?a.config[0]:a.config;if(b){var c=this.blueConicClient.json.parse(b),d=document.location.href;(0<=d.indexOf("#")||0<=d.indexOf("?"))&&(d=d.substring(0,d.indexOf("#"))||d.substring(0,d.indexOf("?")));var e,f=d.split("/"),g=!1;for(e=0;e<c.length;e++){var h=c[e],i=f[e+3];h.checked&&h.profileProperty&&!g&&(this._storeEngagement(h.profileProperty,this._getValue(i)),i&&30<i.length&&h.checked&&(g=!0))}this.blueConicClient.profile.updateProfile()}},_getValue:function(a){return a?30<a.length?null:(0<=a.indexOf(".")&&(a=a.substring(0,a.indexOf("."))),isNaN(a)&&"index"!==a&&0!==a.indexOf("index.")?a:null):null},_storeEngagement:function(a,b){if(b){var c=this.context.getProfile(),d={TIME:new Date().getTime()};d[b]={},d[b]["p"+this.days]=1,c.addValue("_"+a,this.blueConicClient.json.stringify(d))}}});var a = [];var i='listener_url_structure';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.0.18/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({blueConicClient:null,context:null,_profile:null,_userLanguage:null,_systemLanguage:null,_language:null,_referrer:null,_hostName:null,_currentUrl:null,_domain:null,ORIGIN_TYPES:{WEB:"web",MOBILE_WEB:"mobile_web",CONNECTION:"connection",MOBILE:"mobile_app"},CONSTANTS:{THIRTY_MINUTES_IN_MS:18e5,UNKNOWN:""},PROFILE_PROPERTIES:{CLICKCOUNT:"clickcount",VISITS:"visits",VISITCLICKS:"visitclicks",LASTVISITDATE:"lastvisitdate",VISITEDSITES:"visitedsites",VISITEDDOMAIN:"visiteddomain",ENTRYPAGE:"entrypage",REFERRERHOST:"referrerhost",REFERRERHOSTS:"referrerhosts",HOSTENTRYPAGE:"hostentrypage",HOSTAVERAGETIME:"hostaveragetime",LASTREFERRERAVERAGE:"lastreferreraverage",AVERAGETIME:"averagetime",TOTALVISITTIME:"totalvisittime",RESOLUTION:"resolution",CURRENTRESOLUTION:"currentresolution",CURRENTSCREENWIDTH:"currentscreenwidth",CURRENTSCREENHEIGHT:"currentscreenheight",ORIGIN_TYPE:"origin_type",ORIGIN_SOURCE:"origin_source",ORIGIN_DETAIL:"origin_detail",DEVICETYPE:"devicetype",RECEIVED_FROM_SYSTEM:"received_from_system",RECEIVED_FROM_CONNECTION:"received_from_connection",MOBILE_APP_ID:"mobile_app_id",MOBILE_APP_NAMEVERSION:"mobile_app_nameversion",LANGUAGE:"language",KEYWORDS:"keywords",CURRENTKEYWORDS:"currentkeywords",CURRENT_UTM_SOURCE:"current_utm_source",CURRENT_UTM_MEDIUM:"current_utm_medium",CURRENT_UTM_TERM:"current_utm_term",CURRENT_UTM_CONTENT:"current_utm_content",CURRENT_UTM_CAMPAIGN:"current_utm_campaign",UTM_SOURCE:"utm_source",UTM_MEDIUM:"utm_medium",UTM_TERM:"utm_term",UTM_CONTENT:"utm_content",UTM_CAMPAIGN:"utm_campaign"},PROFILE_PROPERTIES_FOR_CHANNEL:{},init:function(e,t){this.blueConicClient=e,this.context=t,this._profile=e.profile.getProfile(),this._channelId=e.getChannelId(),this._referrer=document.referrer,this._hostName=window.location.hostname,this._currentUrl=window.location.href,this._domain=document.domain,this._userLanguage=window.navigator.userLanguage,this._systemLanguage=navigator.systemLanguage,this._language=window.navigator.language,this.PROFILE_PROPERTIES_FOR_CHANNEL={CLICKCOUNT:this.PROFILE_PROPERTIES.CLICKCOUNT+"_"+this._channelId,VISITS:this.PROFILE_PROPERTIES.VISITS+"_"+this._channelId,VISITCLICKS:this.PROFILE_PROPERTIES.VISITCLICKS+"_"+this._channelId,LASTVISITDATE:this.PROFILE_PROPERTIES.LASTVISITDATE+"_"+this._channelId}},onPrepare:function(){this._profile&&(this._setLanguageProperties(),this._setResolutionProperties(),this._setReferrerProperties(),this._setCampaignProperties())},onLoad:function(){this._profile&&(this._setReferrerHostOnLoad(),this._setVisitProperties(),this._setOriginProperties(),this.blueConicClient.profile.updateProfile())},getPreloadProperties:function(){return[this.PROFILE_PROPERTIES.CLICKCOUNT,this.PROFILE_PROPERTIES.VISITS,this.PROFILE_PROPERTIES.VISITCLICKS,this.PROFILE_PROPERTIES.LASTVISITDATE,this.PROFILE_PROPERTIES.VISITEDSITES,this.PROFILE_PROPERTIES.ENTRYPAGE,this.PROFILE_PROPERTIES.HOSTENTRYPAGE,this.PROFILE_PROPERTIES.HOSTAVERAGETIME,this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE,this.PROFILE_PROPERTIES.AVERAGETIME,this.PROFILE_PROPERTIES.TOTALVISITTIME,this.PROFILE_PROPERTIES.RESOLUTION,this.PROFILE_PROPERTIES.DEVICETYPE,this.PROFILE_PROPERTIES.ORIGIN_TYPE,this.PROFILE_PROPERTIES.ORIGIN_SOURCE,this.PROFILE_PROPERTIES.ORIGIN_DETAIL,this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM,this.PROFILE_PROPERTIES.RECEIVED_FROM_CONNECTION,this.PROFILE_PROPERTIES.VISITEDDOMAIN,this.PROFILE_PROPERTIES.MOBILE_APP_ID,this.PROFILE_PROPERTIES.MOBILE_APP_NAMEVERSION,this.PROFILE_PROPERTIES_FOR_CHANNEL.CLICKCOUNT,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITS,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITCLICKS,this.PROFILE_PROPERTIES_FOR_CHANNEL.LASTVISITDATE]},_setLanguageProperties:function(){var e=this._userLanguage||this._systemLanguage||this._language,t=this._normalizeLocale(e).split("-")[0];t&&this._profile.setValue(this.PROFILE_PROPERTIES.LANGUAGE,t)},_normalizeLocale:function(e){return e&&e.replace("_","-").toLowerCase()},_setResolutionProperties:function(){var e=screen.width,t=screen.height;this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTSCREENWIDTH,e),this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTSCREENHEIGHT,t);var i=e+"x"+t;this._profile.setValue(this.PROFILE_PROPERTIES.CURRENTRESOLUTION,i),this._profile.addValue(this.PROFILE_PROPERTIES.RESOLUTION,i)},_setReferrerProperties:function(){this._setReferrerKeywords(),this._setReferrerHost()},_setReferrerKeywords:function(){var e=this.HELPER.decodeReferrer(this._referrer)||[];e.length>0&&(this._addProfileValues(this.PROFILE_PROPERTIES.KEYWORDS,e),this._profile.setValues(this.PROFILE_PROPERTIES.CURRENTKEYWORDS,e))},_addProfileValues:function(e,t){(Array.isArray(t)?t:[t]).forEach(function(t){this._profile.addValue(e,t)},this)},_setReferrerHost:function(){var e=this._getReferrerHost();e!==this._hostName&&(this._profile.setValue(this.PROFILE_PROPERTIES.ENTRYPAGE,this._currentUrl),e&&(this._profile.setValue(this.PROFILE_PROPERTIES.REFERRERHOST,e),this._profile.addValue(this.PROFILE_PROPERTIES.REFERRERHOSTS,e)))},_setReferrerHostOnLoad:function(){var e=this._getReferrerHost();e!==this._hostName&&this._setHostEntryPageProperty(),this._setHostTotalAndAverageTimeProperty(this._hostName,e)},_getReferrerHost:function(){return this._referrer.replace(/http[s]?:\/\/(.*?)(:|\?|\/|$).*/,"$1")},_setCampaignProperties:function(){[this.PROFILE_PROPERTIES.UTM_SOURCE,this.PROFILE_PROPERTIES.UTM_MEDIUM,this.PROFILE_PROPERTIES.UTM_TERM,this.PROFILE_PROPERTIES.UTM_CONTENT,this.PROFILE_PROPERTIES.UTM_CAMPAIGN].forEach(function(e){var t=this._removeHashPart(this.HELPER._getParameterByName(this._currentUrl,e));t&&(this._profile.setValue("current_"+e,t),this._profile.addValue(e,t))},this)},_setHostEntryPageProperty:function(){this._profile.setValue(this.PROFILE_PROPERTIES.ENTRYPAGE,this._currentUrl);var e=this._getHostEntryPageMapping();e[this._hostName]={entrypage:this._currentUrl},this._profile.setValue(this.PROFILE_PROPERTIES.HOSTENTRYPAGE,JSON.stringify(e))},_getHostEntryPageMapping:function(){return this._safeJSONParse(this._profile.getValue(this.PROFILE_PROPERTIES.HOSTENTRYPAGE))},_safeJSONParse:function(e){try{var t=e.replace(/'/g,'"');return JSON.parse(t)||{}}catch(e){return{}}},_setHostTotalAndAverageTimeProperty:function(e,t){var i=this._safeJSONParse(this._profile.getValue(this.PROFILE_PROPERTIES.HOSTAVERAGETIME));i[e]||(i[e]=this._createNewVisitData());var s=this.blueConicClient.getCurrentDate().getTime(),E=this._profile.getValue(this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE),r=0,R=0,I=0;Object.keys(i).map(function(e){return e.toString()}).forEach(function(_){var n=i[_];this._isSessionExpired(n.enddate)?this._addVisit(n,n.enddate-n.startdate):_===e?n.enddate=s:_===t&&E!==t&&(n.enddate=s,this._profile.setValue(this.PROFILE_PROPERTIES.LASTREFERRERAVERAGE,t)),0!==n.averageTime&&(R++,r+=n.averageTime,I+=n.averageTime*n.visits)},this),this._profile.setValue(this.PROFILE_PROPERTIES.HOSTAVERAGETIME,JSON.stringify(i)),this._profile.setValue(this.PROFILE_PROPERTIES.TOTALVISITTIME,I);var _=R>0?Math.round(r/R):0;this._profile.setValue(this.PROFILE_PROPERTIES.AVERAGETIME,_)},_addVisit:function(e,t){if(t>0){var i=e.averageTime*e.visits+t/1e3;e.visits++,e.averageTime=Math.round(i/e.visits)}var s=this.blueConicClient.getCurrentDate().getTime();e.startdate=s,e.enddate=s},_createNewVisitData:function(){var e=this.blueConicClient.getCurrentDate().getTime();return{startdate:e,enddate:e,averageTime:0,visits:0}},_setPropertyIfEmpty:function(e,t,i){void 0===e[t]&&(e[t]=i)},_setVisitProperties:function(){this._addVisitedDomain(this._domain),this._increaseClickCount(),this._increaseVisits(this.PROFILE_PROPERTIES.VISITS,this.PROFILE_PROPERTIES.VISITCLICKS,this.PROFILE_PROPERTIES.LASTVISITDATE),this._channelId&&this._increaseVisits(this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITS,this.PROFILE_PROPERTIES_FOR_CHANNEL.VISITCLICKS,this.PROFILE_PROPERTIES_FOR_CHANNEL.LASTVISITDATE)},_increaseVisits:function(e,t,i){e=e||this.PROFILE_PROPERTIES.VISITS,t=t||this.PROFILE_PROPERTIES.VISITCLICKS,i=i||this.PROFILE_PROPERTIES.LASTVISITDATE,this._isNewSession(e,i)?(this._resetPageViewsCurrentSession(t),this._increaseSessionCount(e)):this._increasePageViewsCurrentSession(t),this._setLastVisitDate(i,this.blueConicClient.getCurrentDate().getTime())},_setLastVisitDate:function(e,t){e=e||this.PROFILE_PROPERTIES.LASTVISITDATE,this._profile.setValue(e,t)},_addVisitedDomain:function(e){this._hasVisitedDomain(e)||this._profile.addValue(this.PROFILE_PROPERTIES.VISITEDSITES,e)},_hasVisitedDomain:function(e){var t=this._profile.getValues(this.PROFILE_PROPERTIES.VISITEDSITES)||[];return t.length>0&&-1!==t.indexOf(e)},_increaseClickCount:function(){var e=this._getNumberProperty(this.PROFILE_PROPERTIES.CLICKCOUNT);if(this._profile.setValue(this.PROFILE_PROPERTIES.CLICKCOUNT,e+1),this._channelId){var t=this._getNumberProperty(this.PROFILE_PROPERTIES_FOR_CHANNEL.CLICKCOUNT);this._profile.setValue(this.PROFILE_PROPERTIES_FOR_CHANNEL.CLICKCOUNT,t+1)}},_isNewSession:function(e,t){e=e||this.PROFILE_PROPERTIES.VISITS,t=t||this.PROFILE_PROPERTIES.LASTVISITDATE;var i=this._getNumberProperty(e),s=this._getNumberProperty(t)||0;return 0===i||this._isSessionExpired(s)},_isSessionExpired:function(e){return this.blueConicClient.getCurrentDate().getTime()>e+this.CONSTANTS.THIRTY_MINUTES_IN_MS},_resetPageViewsCurrentSession:function(e){e=e||this.PROFILE_PROPERTIES.VISITCLICKS,this._profile.setValue(e,1)},_increasePageViewsCurrentSession:function(e){e=e||this.PROFILE_PROPERTIES.VISITCLICKS;var t=this._getNumberProperty(e);this._profile.setValue(e,t+1)},_increaseSessionCount:function(e){e=e||this.PROFILE_PROPERTIES.VISITS;var t=this._getNumberProperty(e);this._profile.setValue(e,t+1)},_setOriginProperties:function(){var e=this._getOriginCount();e>1?this._mergeOriginProperties():0===e&&this._resolveOriginProperties()},_getOriginCount:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_TYPE)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_SOURCE)||[],i=this._profile.getValues(this.PROFILE_PROPERTIES.ORIGIN_DETAIL)||[];return Math.max(e.length,t.length,i.length)},_mergeOriginProperties:function(){this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_TYPE),this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_SOURCE),this._mergePropertyToUnknown(this.PROFILE_PROPERTIES.ORIGIN_DETAIL)},_mergePropertyToUnknown:function(e){var t=this._profile.getValues(e)||[];this._profile.setValue(e,1===t.length?t[0]:this.CONSTANTS.UNKNOWN)},_resolveOriginProperties:function(){this._isVisitorOriginFromWeb()?this._resolveOriginForWebVisitor():this._isVisitorOriginFromConnection()?this._resolveOriginForProfileComingFromConnection():this._isVisitorOriginFromMobileApp()&&this._resolveOriginForMobileAppVisitor()},_isVisitorOriginFromWeb:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[];return 0===e.length&&0===t.length},_isVisitorOriginFromMobileApp:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[],i=this._getNumberProperty(this.PROFILE_PROPERTIES.VISITS);return t.length>0&&0===e.length&&0===i},_isVisitorOriginFromConnection:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM),t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID),i=this._getNumberProperty(this.PROFILE_PROPERTIES.VISITS);return e&&e.length>0&&t&&0===t.length&&i<=0},_resolveOriginForWebVisitor:function(){var e="",t=this._profile.getValues(this.PROFILE_PROPERTIES.VISITEDSITES)||[],i=this._profile.getValue(this.PROFILE_PROPERTIES.DEVICETYPE)||"",s=this._profile.getValues(this.PROFILE_PROPERTIES.ENTRYPAGE)||[];i&&(e="PC"===i?this.ORIGIN_TYPES.WEB:this.ORIGIN_TYPES.MOBILE_WEB);var E=1===t.length?t[0]:this.CONSTANTS.UNKNOWN,r=1===s.length?s[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(e,E,r)},_resolveOriginForProfileComingFromConnection:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_SYSTEM)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.RECEIVED_FROM_CONNECTION)||[],i=1===e.length?e[0]:this.CONSTANTS.UNKNOWN,s=1===t.length?t[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(this.ORIGIN_TYPES.CONNECTION,i,s)},_resolveOriginForMobileAppVisitor:function(){var e=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_ID)||[],t=this._profile.getValues(this.PROFILE_PROPERTIES.MOBILE_APP_NAMEVERSION)||[],i=1===e.length?e[0]:this.CONSTANTS.UNKNOWN,s=1===t.length?t[0]:this.CONSTANTS.UNKNOWN;this._setOriginProfileProperties(this.ORIGIN_TYPES.MOBILE,i,s)},_setOriginProfileProperties:function(e,t,i){this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_TYPE,e),this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_SOURCE,t),this._profile.setValue(this.PROFILE_PROPERTIES.ORIGIN_DETAIL,i)},_removeHashPart:function(e){if(e){var t=e.indexOf("#");if(-1!==t)return e.substring(0,t)}return e},HELPER:{search_engines:[["google\\.","q"],["bing\\.","q"],["search\\.yahoo\\.","p"],["search\\.aol\\.","q"],["duckduckgo\\.","q"],["baidu\\.","wd"],["ask\\.com","q"],["search\\.lycos\\.","q"],["dogpile\\.com","q"]],substringToHash:function(e){if(e){var t=e.indexOf("#");if(-1!==t)return e.substring(0,t)}return e},decodeReferrer:function(e){for(var t=new RegExp(""),i=0;i<this.search_engines.length;i++){var s=this.search_engines[i];t.compile("^http(s?)://(www\\.)?"+s[0],"i");var E=e.match(t);if(E){var r;if(r=isNaN(s[1])?this._getParameterByName(e,s[1]):E[s[1]+1])return r=decodeURIComponent(r),s.length>2&&s[2]&&(r=decodeURIComponent(r)),r=(r=(r=r.replace(/'|"/g,"")).split(/[\s,+.]+/)).filter(function(e){return e});break}}return null},_getParameterByName:function(e,t){if(!t)return"";t=t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&#]"+t+"=([^&#]*)").exec(e);return null===i?"":decodeURIComponent(i[1].replace(/\+/g," "))}},_getNumberProperty:function(e){var t=this._profile.getValue(e);if(!t)return 0;try{t=parseInt(t),isNaN(t)&&(t=0)}catch(e){t=0}return t}});var a = [];var i='listenerinteractiontype';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.1.13/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({blueConicClient:null,context:null,profile:null,parameters:null,objectName:null,DEFAULT_TRACKER_NAME:"ga",DEFAULT_EVENT_NAME:"BlueConic",SENT_TO_SYSTEM_PROPERTY:"sent_to_system",SENT_TO_CONNECTION_PROPERTY:"sent_to_connection",PF_PROPERTY_PREFIX:"uapf",_LAST_PUSH_PROPERTY:null,_VARIABLE_STATE_PUSH_PROPERTY:null,_goalParams:null,_preloadProperties:null,_hasSynchronized:!1,_visitorSegmentIds:[],init:function(a,b){this.blueConicClient=a,this.context=b,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this._LAST_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"lt"+this.context.getInteractionId(),this._VARIABLE_STATE_PUSH_PROPERTY=this.PF_PROPERTY_PREFIX+"st"+this.context.getInteractionId(),this.parameters=this._migrateParameters(this.parameters),this.objectName=this.parameters.trackerName&&this.parameters.trackerName[0]||this.DEFAULT_TRACKER_NAME,this._visitorSegmentIds=this._getVisitorSegmentIds(),this._goalParams=this._parseGoalParams(this.parameters.goalParameters),this._fillPreloadProperties()},_getVisitorSegmentIds:function(){return this.blueConicClient.getSegments().map(function(a){return a.id})||[]},_parseGoalParams:function(a){return a.map(function(a){return a&&this.blueConicClient.json.parse(a)},this).filter(function(a){return a&&a.active&&a.parameters}).map(function(a){return a.parameters.id=a.id,a.parameters.exportMapping=this._parseExportMapping(a.parameters.exportMapping),a.parameters},this)},_parseExportMapping:function(a){var b=a&&this.blueConicClient.json.parse(a[0])||[];return b.filter(function(a){return this._isValidExportMapping(a)},this)},_isValidExportMapping:function(a){var b=a&&a.from&&a.to&&a.to.fieldId,c=b&&("property"!==a.from.type||a.from.property);return!!c},_fillPreloadProperties:function(){this._preloadProperties=[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY],this._goalParams.forEach(function(a){this._preloadProperties.push(this._LAST_PUSH_PROPERTY+"_"+a.id),this._preloadProperties.push(this._VARIABLE_STATE_PUSH_PROPERTY+"_"+a.id),a.exportMapping.forEach(function(a){var b=a.from&&"property"===a.from.type&&a.from.property;b&&-1===this._preloadProperties.indexOf(b)&&this._preloadProperties.push(a.from.property)},this)},this)},getPreloadProperties:function(){return this._preloadProperties},onLoad:function(){function a(){if(window[b.objectName])b._handleGoals();else{if(20<c)return;c++,window.setTimeout(a,250)}}this.bcConnectionUtil.md5Lib=this.md5;var b=this,c=0;a.call(this)},_handleGoals:function(){this._goalParams.forEach(function(a){this._isSegmentValid(a.exportSegment)&&this._applyGoal(a)},this)},_isSegmentValid:function(a){var b=!a||0===a.length,c=a&&a[0]&&-1!==this._visitorSegmentIds.indexOf(a[0]);return b||c},_applyGoal:function(a){var b=this._createConnectionContext(a);this._pushProfileValues(a,b),a.triggerEvent&&a.triggerEvent[0]&&this.blueConicClient.event.subscribe(a.triggerEvent[0],this,function(){this._doPush(a,b)});var c=this._getEventNameForGoal(a);a.push_interactions&&"true"===a.push_interactions[0]&&this._subscribeToInteractionViews(c),a.passOnEvents&&"true"===a.passOnEvents[0]&&this._subscribeToPassOnEvents(c)},_pushProfileValues:function(a,b){this.bcConnectionUtil.doPush(b)?this._doPush(a,b):"plc"===b.push_frequency&&this.blueConicClient.event.subscribe(this.blueConicClient.event.onProfilePermissionChange,this,function(){this._doPush(a,b)})},_doPush:function(a,b){var c=a.exportMapping,d=a.eventname&&a.eventname[0]||this.DEFAULT_EVENT_NAME;if(0===c.length)return!1;var e={nonInteraction:1,userId:this.profile.getId()},f=!1;return c.map(function(a){return this._transformMappingTypes(a)},this).forEach(function(a){var c=this.bcConnectionUtil.getVariableValue(a.from,b,!0);c&&(e[a.to.fieldId]=c.join(","),f=!0)},this),f&&this._pushUA(d,"Profile",e),f},_createConnectionContext:function(a){var b={LAST_PUSH_PROPERTY:this._LAST_PUSH_PROPERTY+"_"+a.id,VARIABLE_STATE_PUSH_PROPERTY:this._VARIABLE_STATE_PUSH_PROPERTY+"_"+a.id,profile:this.profile,push_frequency:a.push_frequency&&a.push_frequency[0]?a.push_frequency[0]:null,variables:c,SENT_TO_SYSTEM_PROPERTY:this.SENT_TO_SYSTEM_PROPERTY,SENT_TO_CONNECTION_PROPERTY:this.SENT_TO_CONNECTION_PROPERTY},c=[];return a.exportMapping.forEach(function(a){var d=a.from,e=this.bcConnectionUtil.getVariableValue(d,b);e&&(d.key=a.to.fieldId,c.push(d))}),b.variables=c,b},_transformMappingTypes:function(a){return"permission"===a.from.type&&(a.from.type="pm"),"text"===a.from.type&&(a.from.text=a.from.fieldId),a},_getEventNameForGoal:function(a){return a.eventname&&a.eventname[0]||this.DEFAULT_EVENT_NAME},_subscribeToInteractionViews:function(a){this.blueConicClient.event.subscribe("VIEW",this,this._pushInteractionViews.bind(this,a))},_pushUA:function(a,b,c,d){window[this.objectName]("send","event",a,b,c,d),this._syncProperties()},_pushInteractionViews:function(a){this.blueConicClient.getInteractions().map(function(a){return a.variantName?a.name+" / "+a.variantName:a.name}).forEach(function(b){this._pushUA(a,"Interaction View",b,{nonInteraction:1,userId:this.profile.getId()})},this)},_subscribeToPassOnEvents:function(a){this.blueConicClient.event.subscribe("inactivity",this,this.onEventPublished.bind(this,a,"Inactivity")),this.blueConicClient.event.subscribe("exitintent",this,this.onEventPublished.bind(this,a,"Exit Intent")),this.blueConicClient.event.subscribe("cm_firstview",this,this.onEventPublished.bind(this,a,"Content Meter View 1")),this.blueConicClient.event.subscribe("cm_exceeded",this,this.onEventPublished.bind(this,a,"Content Meter View Content Meter Exceeded"));for(var b=2;10>b;b++)this.blueConicClient.event.subscribe("cm_view_"+b,this,function(b){var c=b.split("_")[2];this.onEventPublished(a,"Content Meter View "+c)})},onEventPublished:function(a,b){var c={nonInteraction:1,userId:this.profile.getId()};this._pushUA(a,b,c)},_syncProperties:function(){this._hasSynchronized||(this.bcConnectionUtil.setSyncProperties(this.context,this.profile,[this.SENT_TO_SYSTEM_PROPERTY,this.SENT_TO_CONNECTION_PROPERTY]),this._hasSynchronized=!0)},_migrateParameters:function(a){return a.goalParameters?a:this._migrateToV2(a)},_migrateToV2:function(a){var b=function(b,c){return a[b]||c},c=[],d=b("dimensions"),e=d&&d[0]?JSON.parse(d[0]):[];e.forEach(function(a){var b={id:a.id,from:{type:"pm"===a.type?"permission":a.type,property:a.property,segments:a.segments,fieldLabel:"text"===a.type?a.text:void 0,fieldId:a.text},to:{type:"text",fieldLabel:"Dimension "+a.index,fieldId:"dimension"+a.index},mergeRule:"set"};c.push(b)});var f=b("profileproperties"),g={exportSegment:[""],exportMapping:[this.blueConicClient.json.stringify(c)],properties_out:Array.isArray(f)?f:[f],segments:[],push_frequency:b("push_frequency")||[""],triggerEvent:b("triggerEvent")||[""],eventname:[this.DEFAULT_EVENT_NAME],push_interactions:["true"],passOnEvents:["false"],saved:["true"]};return{trackerName:[b("custom_tracker")||this.DEFAULT_TRACKER_NAME],goalParameters:[JSON.stringify({id:"1",type:"export",name:"Export data into Universal Analytics",active:!0,parameters:g})]}}});var a = [];var i='uaconnection';a.push({url: p + i + '/1.2.2/js/connection_lib/connection_lib.js', sharing: 'local'});a.push({url: p + i + '/1.2.2/lib/md5.min.js', sharing: 'local'});blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : ps + i + '/1.2.2/'}]);})();(function(){ var InteractionTypeImpl=InteractionType.extend({init:function(a,b){this.blueConicClient=a,this.context=b,this.profile=this.context.getProfile(),this.parameters=this.context.getParameters(),this.visitHistoryProperty="_vl_"+this.context.getInteractionId(),this.visitsProperty=this.parameters.visits_property?this.parameters.visits_property[0]:null,this.nrVisits=this.parameters.nr_visits&&!isNaN(this.parameters.nr_visits)?parseInt(this.parameters.nr_visits):100,this.nrVisitsProperty=this.parameters.nr_visits_property?this.parameters.nr_visits_property[0]:null,this.nrDays=this.parameters.nr_days&&!isNaN(this.parameters.nr_days)?parseInt(this.parameters.nr_days):30,this.totalVisitsProperty=this.parameters.total_visits_property?this.parameters.total_visits_property[0]:null,this.startSessionProperty=this.parameters.start_session_property?this.parameters.start_session_property[0]:null,this.nrPageViewsProperty=this.parameters.nr_page_views_property?this.parameters.nr_page_views_property[0]:null,this.sessionPageViewsProperty=this.parameters.session_page_views_property?this.parameters.session_page_views_property[0]:null,this.firstVisitDateProperty=this.parameters.first_visit_date_property?this.parameters.first_visit_date_property[0]:null,this.lastVisitDateProperty=this.parameters.last_visit_date_property?this.parameters.last_visit_date_property[0]:null,this.averageVisitTimeProperty=this.parameters.average_visit_time_property?this.parameters.average_visit_time_property[0]:null,this.totalVisitTimeProperty=this.parameters.total_visit_time_property?this.parameters.total_visit_time_property[0]:null,this.directVisitsOnly=!!this.parameters.directVisitsOnly&&"true"===this.parameters.directVisitsOnly[0]},getPreloadProperties:function(){var a=[this.visitHistoryProperty];return this.visitsProperty&&a.push(this.visitsProperty),a},onLoad:function(){var a=this.blueConicClient.getCurrentDate(),b=this._getVisitsHistory(a),c=!0;if(b.lastVisit){var d=new Date(b.lastVisit);d.setMinutes(d.getMinutes()+30),c=a>d}this.directVisitsOnly&&c&&0<document.referrer.length||(c?this._handleNewVisit(b,a):this._handleExistingVisit(b,a),++b.pageViews,this.nrPageViewsProperty&&this.profile.setValue(this.nrPageViewsProperty,b.pageViews),!b.firstVisit&&(b.firstVisit=a.getTime(),this.firstVisitDateProperty&&this.profile.setValue(this.firstVisitDateProperty,b.firstVisit)),b.lastVisit=a.getTime(),this.lastVisitDateProperty&&this.profile.setValue(this.lastVisitDateProperty,b.lastVisit),this.profile.setValue(this.visitHistoryProperty,JSON.stringify(b)),this.blueConicClient.profile.updateProfile())},_handleNewVisit:function(a,b){if(++a.visits,a.sessionStart=b.getTime(),a.sessionPageViews=1,this.startSessionProperty&&this.profile.setValue(this.startSessionProperty,a.sessionStart),this.sessionPageViewsProperty&&this.profile.setValue(this.sessionPageViewsProperty,a.sessionPageViews),this.totalVisitsProperty&&this.profile.setValue(this.totalVisitsProperty,a.visits),this.visitsProperty){var c=this.profile.getValues(this.visitsProperty);if(c.push(b.getTime()),c.length<=this.nrVisits?this.profile.addValue(this.visitsProperty,b.getTime()+""):(c.sort(function(c,a){return a-c}),c=c.slice(0,this.nrVisits),this.profile.setValues(this.visitsProperty,c)),this.nrVisitsProperty){var d=new Date().setDate(b.getDate()-this.nrDays),e=b.getTime()-d,f=c.filter(function(a){return b.getTime()-new Date(parseInt(a)).getTime()<e}).length;this.profile.setValue(this.nrVisitsProperty,f)}}},_handleExistingVisit:function(a,b){var c=Math.round;++a.sessionPageViews,this.sessionPageViewsProperty&&this.profile.setValue(this.sessionPageViewsProperty,a.sessionPageViews);var d=(b.getTime()-a.lastVisit)/1e3/60;a.totalVisitTime+=d,this.totalVisitTimeProperty&&this.profile.setValue(this.totalVisitTimeProperty,c(a.totalVisitTime)),this.averageVisitTimeProperty&&this.profile.setValue(this.averageVisitTimeProperty,c(a.totalVisitTime/a.visits))},_getVisitsHistory:function(){var a=this.profile.getValue(this.visitHistoryProperty);if(a)try{a=JSON.parse(a)}catch(a){}return a||{visits:0,sessionStart:0,firstVisit:0,lastVisit:0,totalVisitTime:0,pageViews:0,sessionPageViews:0}},_getNumberProperty:function(a){var b=this.profile.getValue(a);try{b=parseInt(b)}catch(a){b=0}return isNaN(b)&&(b=0),b}});var a = [];var i='visitlistener';blueConic.fn.registerInteractionType(i, InteractionTypeImpl, a, [{ id : i, baseUrl : 'https://theatlantic.blueconic.net/plugins/visitlistener/ts_89c5ed8c3c73a2230c62884a6a796401/'}]);})();})(blueConicClient);