MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/FoneFinal/examp/img/
File Upload :
Current < : /hermes/bosweb/b1705/trinix19.ipage.com/Backup/FoneFinal/examp/img/SharedApp.js

var FO;!function(e){var t;!function(e){var t;!function(e){function t(e){var t,r,n,o=0;if(0==e.length)return o;for(t=0,n=e.length;n>t;t++)r=e.charCodeAt(t),o=(o<<5)-o+r,o|=0;return o}function r(e){for(var t="",r=0;e>r;r++){var n=Math.floor(65536*(1+Math.random())).toString(16).substring(1);t+=n}return t.substr(0,e)}function n(){for(var e=[],t="0123456789ABCDEF",r=0;36>r;r++)e[r]=Math.floor(16*Math.random());e[14]=4,e[19]=3&e[19]|8;for(var r=0;36>r;r++)e[r]=t[e[r]];return e[8]=e[13]=e[18]=e[23]="-",e.join("")}function o(e,t){if(e==t)return!0;if("object"!=typeof e&&"object"!=typeof t)return e==t;var r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(r.length!=n.length)return!1;for(var i=0;i<r.length;i++){var a=r[i];if(!o(e[a],t[a]))return!1}return!0}function i(e,t){return 0===e.length?t.length:0===t.length?e.length:Math.min(i(e.substr(1),t)+1,i(t.substr(1),e)+1,i(e.substr(1),t.substr(1))+(e[0]!==t[0]?1:0))}function a(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;var r,n=[];for(r=0;r<=t.length;r++)n[r]=[r];var o;for(o=0;o<=e.length;o++)n[0][o]=o;for(r=1;r<=t.length;r++)for(o=1;o<=e.length;o++)t.charAt(r-1)==e.charAt(o-1)?n[r][o]=n[r-1][o-1]:n[r][o]=Math.min(n[r-1][o-1]+1,Math.min(n[r][o-1]+1,n[r-1][o]+1));return n[t.length][e.length]}function s(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=arguments;return e.replace(/{(\d+)}/g,function(e,t){var r=parseInt(t)+1;if("undefined"==typeof n[r])throw Error("Failed matching format group "+e);return n[r].toString()})}function u(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return e.replace(/{(\w+)}/g,function(e,r){for(var n=0;n<t.length;n++){var o=t[n];if(r in o)return o[r]}throw Error("Failed matching format group "+e)})}function c(e,t){e.addEventListener?e.addEventListener("message",t,!1):e.attachEvent&&e.attachEvent("onmessage",t)}e.stringHash=t,e.generateGuid=r,e.generateUUID=n,e.isEquivalent=o,e.levenshteinDistance=i,e.getEditDistance=a,e.stringFormat=s,e.namedStringFormat=u,e.attachPostMessageHandler=c,e.HOUR_SECONDS=3600,e.DAY_SECONDS=24*e.HOUR_SECONDS,e.WEEK_SECONDS=7*e.DAY_SECONDS,e.MONTH_SECONDS=30*e.DAY_SECONDS}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var __extends=this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},FO;!function(e){var t;!function(t){var r=function(){function e(){}return e.from=function(t,r){var n=new e;return n.first=t,n.second=r,n},e}();t.Pair=r,function(e){e[e.CONTINUE=0]="CONTINUE",e[e.BREAK_NODE=1]="BREAK_NODE",e[e.BREAK_ALL=2]="BREAK_ALL"}(t.RecursionFlow||(t.RecursionFlow={}));var n=(t.RecursionFlow,function(){function t(e){this.source=null,this.source=e}return t.of=function(e){return new t(e)},t.fromSelector=function(r){return t.ofJQueryElements(e.$(r))},t.ofJQueryElements=function(e){for(var r=[],n=0;n<e.length;n++)r.push(e.get(n));return new t(r)},t.ofElements=function(e){for(var r=[],n=0;n<e.length;n++)r.push(e.item(n));return new t(r)},t.empty=function(){return new t([])},t.ofInts=function(e,r){for(var n=[],o=0;r>o;o++)n.push(e+o);return new t(n)},t.prototype.unique=function(){var e={};return new t(this.source.filter(function(t){var r=""+t;return e.hasOwnProperty(r)?!1:e[r]=!0}))},t.prototype.length=function(){return this.source.length},t.prototype.getItem=function(e){return this.source[e]},t.prototype.each=function(e){o.each(this.source,e)},t.prototype.select=function(e){return t.of(o.select(this.source,e))},t.prototype.slice=function(e,r){for(var n=[],o=e;r>o;o++)n.push(this.source[o]);return new t(n)},t.prototype.stableSort=function(e){function r(e,t){if(null==e)return[];if(e.length<2)return e;null==t&&(t=n);var i,a,s;return i=~~(e.length/2),a=r(e.slice(0,i),t),s=r(e.slice(i,e.length),t),o(a,s,t)}function n(e,t){return t>e?-1:e>t?1:0}function o(e,t,r){for(var n=[];e.length&&t.length;)r(e[0],t[0])<=0?n.push(e.shift()):n.push(t.shift());return e.length&&n.push.apply(n,e),t.length&&n.push.apply(n,t),n}var i=r(this.source,e);return t.of(i)},t.prototype.sort=function(e){var r=this.source.slice(0);return r.sort(e),t.of(r)},t.prototype.orderBy=function(e){return this.sort(function(t,r){return e(t)-e(r)})},t.prototype.orderByDesc=function(e){return this.sort(function(t,r){return e(r)-e(t)})},t.prototype.where=function(e){return t.of(o.where(this.source,e))},t.prototype.skip=function(e){if(e>=this.source.length)return new t([]);var r=this.source.slice(e);return t.of(r)},t.prototype.take=function(e){var r=this.source.slice(0,e);return t.of(r)},t.prototype.firstOrValue=function(e){return this.source.length?this.source[0]:e},t.prototype.first=function(e,t){void 0===t&&(t=null);for(var r=0;r<this.source.length;r++)if(e(this.source[r]))return this.source[r];return t},t.prototype.count=function(e){return o.count(this.source,e)},t.prototype.any=function(e){return o.any(this.source,e)},t.prototype.mergeCol=function(e){var r=this.source.concat(e.source);return t.of(r)},t.prototype.merge=function(e){var r=this.source.concat(e);return t.of(r)},t.prototype.normalize=function(e,t,r,n){if(void 0===r&&(r=0),void 0===n&&(n=1),0!=this.length()){var o=e(this.minBy(e)),i=e(this.maxBy(e));this.each(function(a){var s=e(a),u=i>o?(s-o)/(i-o):n-r/2;t(a,u)})}},t.prototype.distinct=function(e){return t.of(o.distinct(this.source,e))},t.prototype.sum=function(e){return o.aggregate(this.source,0,function(t,r){return r+e(t)})},t.prototype.avg=function(e){return this.sum(e)/this.source.length},t.prototype.maxBy=function(e){return o.maxBy(this.source,e)},t.prototype.minBy=function(e){return this.maxBy(function(t){return-e(t)})},t.prototype.stringJoin=function(e){return this.source.join(e)},t.prototype.groupBy=function(e){var t=o.orderedGroupByString(this.source,e);return t},t.prototype.selectTopAndCloseEnough=function(e,t){void 0===t&&(t=.8);var r=e(this.maxBy(e));return this.where(function(n){return e(n)/r>t})},t.prototype.multiOrderBy=function(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];for(var i=[this.source],a=0;a<n.length;a++){for(var s=n[a],u=[],c=0;c<i.length;c++){var l=i[c],f=t.of(l).select(function(e){return r.from(e,s(e))}).orderBy(function(e){return e.second}),d=[],p=null;f.each(function(t){null!=p&&p/t.second>=e?d.push(t.first):(d.length&&u.push(d),d=[t.first],p=t.second)}),d.length&&u.push(d)}i=u}return t.of(i).selectMany(function(e){return e})},t.prototype.selectMany=function(e){var r=[];return this.each(function(t){return r=r.concat(e(t))}),t.of(r)},t.prototype.selectFirst=function(e,t){void 0===t&&(t=function(e){return!!e});for(var r=0;r<this.source.length;r++){var n=e(this.source[r]);if(t(n))return n}return null},t.prototype.toMap=function(e,t){var r=this.select(function(r){return{key:e(r),value:t(r)}});return new i(r.toArray())},t.prototype.toHashmap=function(e){return o.toHashmap(this.source,e)},t.prototype.toHashmap2=function(e,t){return o.toHashmap2(this.source,e,t)},t.prototype.toArray=function(){return this.source},t}());t.Col=n;var o=function(){function e(){}return e.count=function(e,t){for(var r=0,n=0;n<e.length;n++)t(e[n])&&r++;return r},e.any=function(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return!0;return!1},e.each=function(e,t){for(var r=0;r<e.length;r++)t(e[r],r)},e.hashEach=function(e,t){for(var r in e)e.hasOwnProperty(r)&&t(r,e[r])},e.rand=function(e,t){function r(e){for(var t,r,n=e.length;n;)r=Math.floor(Math.random()*n--),t=e[n],e[n]=e[r],e[r]=t;return e}for(var n=[],o=0;o<e.length;o++){var i=t(e[o],o);n.push(i)}return r(n)},e.select=function(e,t){for(var r=[],n=0;n<e.length;n++){var o=t(e[n],n);r.push(o)}return r},e.where=function(e,t){for(var r=[],n=0;n<e.length;n++){var o=t(e[n]);o&&r.push(e[n])}return r},e.filterSelect=function(e,t){for(var r=[],n=0;n<e.length;n++){var o=t(e[n]);null!=o&&r.push(o)}return r},e.flatMap=function(e){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);return t},e.distinct=function(e,t){for(var r={},n=[],o=0;o<e.length;o++){var i=e[o],a=t(i);a in r||(r[t(i)]=!0,n.push(i))}return n},e.exclude=function(e,t){for(var r=[],n=0;n<e.length;n++){for(var o=!1,i=0;i<t.length;n++)if(e[n].toLowerCase()==t[i].toLowerCase()){o=!0;break}o||r.push(e[n])}return r},e.contains=function(e,t){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()==t.toLowerCase())return!0;return!1},e.groupByString=function(e,t){for(var r={},n=0;n<e.length;n++){var o=e[n],i=t(o);i in r||(r[i]=[]),r[i].push(o)}return r},e.orderedGroupByString=function(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],s=t(a);s in r||(n.push({key:s,value:[]}),r[s]=n.length-1);var u=r[s];n[u].value.push(a)}return new i(n)},e.hashSelect=function(e,t){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=t(e[n]));return r},e.aggregate=function(e,t,r){for(var n=t,o=0;o<e.length;o++)n=r(e[o],n);return n},e.hashAggregate=function(e,t,r){var n=t;for(var o in e){var i=e[o];n=r(o,i,n)}return n},e.sum=function(t,r){return e.aggregate(t,0,function(e,t){return t+r(e)})},e.hashSum=function(t,r){return e.hashAggregate(t,0,function(e,t,n){return n+r(e,t)})},e.values=function(e){var t=[];for(var r in e)t.push(e[r]);return t},e.numValues=function(e){var t=[];for(var r in e)t.push(e[r]);return t},e.maxBy=function(e,t){for(var r=null,n=null,o=0;o<e.length;o++){var i=t(e[o]);(null==r||i>r)&&(r=i,n=e[o])}return n},e.intersect=function(e,t){for(var r=[],n=0;n<e.length;n++)for(var o=0;o<t.length;o++)if(e[n]==t[o]){r.push(e[n]);break}return r},e.getKeys=function(e){var t=[];for(var r in e)t.push(r);return t},e.toArray=function(e,t){var r=[];for(var n in e){var o=e[n],i=t(n,o);r.push(i)}return r},e.valuesCol=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return n.of(t)},e.toHashmap=function(t,r){return e.toHashmap2(t,r,function(e){return e})},e.toHashmap2=function(e,t,r){for(var n={},o=0;o<e.length;o++){var i=e[o],a=r(i),s=t(i);n[s]=a}return n},e.join=function(e,t,r){for(var n=[],o=0;o<e.length;o++)for(var i=e[o],a=0;a<t.length;a++){var s=t[a],u=r(i,s);null!=u&&n.push(u)}return n},e.joinByString=function(e,t,r,o){for(var i={},a=[],s=0;s<e.length;s++){var u=r(e[s]);i[u]=e[s]}for(var s=0;s<t.length;s++){var u=o(t[s]);u in i&&a.push({first:i[u],second:t[s]})}return n.of(a)},e.hashMerge=function(t,r,n){void 0===n&&(n=e.hashMergeDefaultConflictFn);var o={};return e.hashEach(t,function(e,t){return o[e]=t}),e.hashEach(r,function(e,t){e in o?o[e]=n(e,o[e],t):o[e]=t}),o},e.hashMergeDefaultConflictFn=function(e,t,r){throw new Error("Conflict on hash merge. Key: "+e+". First: "+t+". Second: "+r)},e.recurseElements=function(t,r,n){void 0===n&&(n=null);var o=r(t,n);if(1==o||2==o)return o;for(var i=0;i<t.children.length;i++){var a=t.children.item(i),s=e.recurseElements(a,r);if(2==s)return 2}return o},e.recurseNodes=function(t,r,n){void 0===n&&(n=null);var o=r(t,n);if(1==o||2==o)return o;for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes.item(i),s=e.recurseNodes(a,r);if(2==s)return 2}return o},e.repeatString=function(e,t){for(var r=[],n=0;t>n;n++)r.push(e);return r},e.recurseSelectElements=function(t,r,n){var o=r(t),i=o[0],a=o[1];if(0==i)for(var s=0;s<t.children.length;s++){var u=t.children.item(s),c=e.recurseSelectElements(u,r,n),l=c[0],f=c[1];if(a=n(t,a,f),2==l){i=2;break}}return[i,a]},e.recurseSelectElements2=function(t,r,n){var o=r(t),i=o[0],a=o[1],s=[];if(0==i)for(var u=0;u<t.children.length;u++){var c=t.children.item(u),l=e.recurseSelectElements2(c,r,n),f=l[0];if(s.push(l[1]),2==f){i=2;break}}var d=n(a,s);return[i,d]},e}();t.StaticCol=o;var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.ofHash=function(e){var r=[];for(var n in e)e.hasOwnProperty(n)&&r.push({key:n,value:e[n]});return new t(r)},t.ofUrlString=function(e){return t.ofHashString(e,"&","=",function(e){return decodeURIComponent(e)})},t.ofHashString=function(e,r,o,i){var a=n.of(e.split(r)),s=a.select(function(e){var t=e.split(o),r=t[0],n=t[1],a=i(n);return{key:r,value:a}}).toArray();return new t(s)},t.emptyMap=function(){return t.ofHash({})},t.prototype.get=function(e){var t=this.first(function(t){return t.key==e});return t?t.value:null},t.prototype.containsKey=function(e){var t=this.first(function(t){return t.key==e});return!!t},t.prototype.keys=function(){return this.select(function(e){return e.key})},t.prototype.values=function(){return this.select(function(e){return e.value})},t.prototype.selectValues=function(e){var r=this.select(function(t){return{key:t.key,value:e(t)}});return new t(r.toArray())},t}(n);t.Map=i}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(e){this.userSettings=e}return t.prototype.isSuspended=function(r){var n=this.userSettings.retrive(t.SUSPENDED_KEY),o=(new Date).getTime();if(n&&r in n&&"timestamp"in n[r]){var i=n[r].timestamp;return-1==i||i>o}if(n)if(r in n&&"timestamp"in n[r]){var i=n[r].timestamp;e.Logger.log("Suspension found, but expired on "+new Date(i).toUTCString())}else e.Logger.log("Suspension id "+r+" not in suspension map");else e.Logger.log("No suspension map found");return!1},t.prototype.shouldAutoAppear=function(e){var r=this.userSettings.retrive(t.SUSPENDED_KEY);return r&&e in r&&"autoAppear"in r[e]&&0==r[e].autoAppear?!1:!0},t.prototype.suspend=function(r,n){var o=this.userSettings.retrive(t.SUSPENDED_KEY);null==o&&(o={});var i=(new Date).getTime(),a=i+n;o[r]||(o[r]={}),o[r].timestamp=a,e.Logger.log("Suspended "+r+" until "+new Date(a).toUTCString()),this.userSettings.store(t.SUSPENDED_KEY,o)},t.SUSPENDED_KEY="suspend",t}();t.DefaultSuspender=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e){this.resolvedOverrides={},e.params()&&e.params().flags&&(e.params().flags.base.value&&this.resolveAndApplyOverrides(e,e.params().flags.base.value,"base"),e.params().flags.specific.value&&this.resolveAndApplyOverrides(e,e.params().flags.specific.value,"specific"))}return e.prototype.resolveAndApplyOverrides=function(e,t,r){for(var n=0;n<t.length;n++)for(var o=t[n],i=r+"."+o.name,a=Math.random(),s=0,u=0;u<o.variants.length;u++){var c=o.variants[u],l=i+"."+c.name;if(s+=c.odds,s>a){for(var f=0;f<c.values.length;f++)this.resolvedOverrides[c.values[f].name]={value:c.values[f].val,origin:l},o.flag&&c.flagValue&&e.pushNotificationParam(o.flag,c.flagValue);break}}},e.prototype.contains=function(e){return e in this.resolvedOverrides},e.prototype.value=function(e,t){return void 0===t&&(t=null),e in this.resolvedOverrides?this.resolvedOverrides[e].value:t},e.prototype.switchByRate=function(e,t){void 0===t&&(t=0);var r=this.floatValue(e,t);return Math.random()<r},e.prototype.floatValue=function(e,t){return void 0===t&&(t=null),e in this.resolvedOverrides?parseFloat(this.resolvedOverrides[e].value):t},e.prototype.intValue=function(e,t){return void 0===t&&(t=null),e in this.resolvedOverrides?parseInt(this.resolvedOverrides[e].value):t},e.prototype.boolValue=function(e,t){return void 0===t&&(t=null),!!this.intValue(e,t?1:0)},e.prototype.describe=function(){var e=[];for(var t in this.resolvedOverrides){var r=this.resolvedOverrides[t];e.push(t+": "+r.value+" ("+r.origin+")")}return e.join("\n")},e}();e.Overrides=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.resolveReportingProduct=function(e,t){return"gpp"==e&&"rsy"==t?"rs":"pp"==e&&"rs-dual"==t?"rs":"pp"==e&&"rsif"==t?"rs":"pp"==e&&"rsinc"==t?"rs":"pp"==e&&"rsinc2"==t?"rs":"pp"==e&&"rsinc3"==t?"rs":"pp"==e&&"rsinc4"==t?"rs":"pp"==e&&"rsalt"==t?"rs":"pp"==e&&"rsx"==t?"rs":"pp"==e&&"rsy"==t?"rs":"pp"==e&&"bs-dual"==t?"bs":"pp"==e&&"bsif"==t?"rs":"pp"==e&&"bsx"==t?"bs":"pp"==e&&"bsy"==t?"bs":"pp"==e&&"tsx"==t?"ts":"pp"==e&&"tsy"==t?"ts":"pp"==e&&"tb-dual"==t?"tb":"pp"==e&&"tbx"==t?"tb":"pp"==e&&"tby"==t?"tb":"sk"==e&&"sbx"==t?"sb":"sk"==e&&"sby"==t?"sb":"imgdeals"==e&&"gbx"==t?"gb":"imgdeals"==e&&"gby"==t?"gb":"universal-banner"==e?"ub":"rb"==e?"rb":"gb"==e?"gb":"cpn"==e?"cpn":"ppm"==e?"rs":e+"_"+t},e}();e.Reporting=t}(t=e.Logger||(e.Logger={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.notify=function(e,t,n,o,i){void 0===n&&(n={}),void 0===o&&(o=1),void 0===i&&(i=!0);var a=t.key;return r.notifyX(e,a,n,o,i)},r.notifyX=function(e,t,n,o,i){void 0===n&&(n={}),void 0===o&&(o=1),void 0===i&&(i=!0);try{var a=r.determineShouldNotify(e,t,n,o);if(!a)return!1;var s=r.resolveUrl(e,t,n,i),u=document.body.appendChild(document.createElement("img"));return u.style.zIndex="-100",u.style.position="absolute",u.style.left="0",u.style.top="0",u.src=s,!0}catch(c){return!1}},r.determineShouldNotify=function(t,r,n,o){var i=[];"subtype"in n&&(i.push("notifyrate."+r+"."+n.subtype+"_"+document.location.hostname),i.push("notifyrate."+r+"."+n.subtype)),i.push("notifyrate."+r+"_"+document.location.hostname),i.push("notifyrate."+r);var a=e.Col.of(i).first(function(e){return t.overrides().contains(e)}),s=a?t.overrides().floatValue(a,o):o,u=Math.random()<s;return u},r.resolveUrl=function(e,t,n,o){void 0===n&&(n={}),void 0===o&&(o=!0);var i=r.resolveParamaters(e,n,o),a="";for(var s in i)a.length>0&&(a+="&"),a+=s+"="+encodeURIComponent(i[s]);var u=e.paths().notifyRoot()+"/a/"+t+"/logo.png?"+a;return u},r.resolveParamaters=function(e,r,n){void 0===r&&(r={}),void 0===n&&(n=!0);var o=e.notificationParams(),i={};if(n)for(var a in o)i[a]=o[a];for(var a in r)i[a]=r[a];if("t"in i||(i.t=(new Date).getTime()+""),i.pr&&i.w){var s=t.Reporting.resolveReportingProduct(i.pr,i.w);s&&(i.rp=s)}return i},r.notifyGenericUrl=function(e,t,n,o){void 0===t&&(t={}),void 0===n&&(n=null),void 0===o&&(o=!1);try{if(t){-1==e.indexOf("?")&&(e+="?");for(var i in t){var a=t[i]+"";e=e+"&"+i+"="+encodeURIComponent(a)}}var s=document.body.appendChild(document.createElement("img")),u="rid"+Math.floor(9999999999*Math.random());return s.id=u,s.style.zIndex="-100",s.style.position="absolute",s.style.left="0",s.style.top="0",s.src=e,o&&n&&setTimeout(function(){var t=!!document.getElementById(u);t||r.notify(n,r.GENERIC,{subtype:"notifyfailue",originalurl:e})},500),u}catch(c){return null}},r.GENERIC={key:"generic"},r.INJECTION={key:"inj"},r.INIT={key:"init"},r.USER={key:"usr"},r.NO_SHOW={key:"noshow"},r.IMPRESSION={key:"wo"},r.HOVER={key:"ho"},r.CLICK={key:"c"},r.EXCEPTION={key:"exception"},r}();t.Analytics=r}(t=e.Logger||(e.Logger={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function t(t,r,n,o){void 0===o&&(o=null),this._isDebugMode=!1,this.extraParams={},this.extraParams={},this._paths=t,this._params=r,this._host=window.location.host,this._isDebugMode=this.determineIsDebugMode(),this._overrides=o?o:new e.Overrides(this);for(var i in n)this.extraParams[i]=n[i]}return t.prototype.paths=function(){return this._paths},t.prototype.params=function(){return this._params},t.prototype.host=function(){return this._host},t.prototype.isDebugMode=function(){return this._isDebugMode},t.prototype.overrides=function(){return this._overrides},t.prototype.determineIsDebugMode=function(){return!!window.FO_DEBUG},t.prototype.pushNotificationParam=function(e,t){this.extraParams[e]=t},t.prototype.notificationParams=function(){var e={hn:this.host(),partid:this.params()?this.params().partnerCode:"",subid:this.params()?this.params().subId:"",v:"0_0_603",fam:"nwp",dmn:this.paths().domain(),safepassage:"1"};for(var t in this.extraParams)e[t]=this.extraParams[t];return e},t}();e.BootstrapContext=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e){this._domain=null,this._domain=e}return e.prototype.domain=function(){return this._domain},e.prototype.innerResourcesRoot=function(){return this.rootUrl()+"/Extras"},e.prototype.outerResourcesRoot=function(){return"//pstatic"+this.domain()+"/nwp/External"},e.prototype.iframeStoreSrc=function(){return this.rootUrl()+"/Store.html"},e.prototype.notifyRoot=function(){return this.apiRoot()},e.prototype.rootUrl=function(){return"//pstatic"+this.domain()+"/nwp/v0_0_603/release"},e.prototype.apiRoot=function(){return"//app"+this.domain()},e.prototype.dynamicContentRoot=function(){return"//jsgnr"+this.domain()},e.prototype.cachedApiRoot=function(){return"//capp"+this.domain()},e.prototype.blackWhiteListRoot=function(){return"//cwbl"+this.domain()},e.prototype.shortCacheRoot=function(){return"//istatic"+this.domain()},e.prototype.longCacheRoot=function(){return"//pstatic"+this.domain()},e}();e.Paths=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){function t(e){e=e||{guess:!0};var t=e.e||null,n=!!e.guess,o=e.mode||null,i=new r,a=i.run(t,o);return n?i.guessAnonymousFunctions(a):a}e.printStackTrace=t;var r=function(){function e(){this.sourceCache={}}return e.prototype.run=function(e,t){return e=e||this.createException(),t=t||this.mode(e),"other"===t?this.other(arguments.callee):this[t](e)},e.prototype.createException=function(){try{this.undef()}catch(e){return e}},e.prototype.mode=function(e){return e.arguments&&e.stack?"chrome":e.stack&&e.sourceURL?"safari":e.stack&&e.number?"ie":e.stack&&e.fileName?"firefox":e.message&&e["opera#sourceloc"]?e.stacktrace?e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?"opera9":"opera10a":"opera9":e.message&&e.stack&&e.stacktrace?e.stacktrace.indexOf("called from line")<0?"opera10b":"opera11":e.stack&&!e.fileName?"chrome":"other"},e.prototype.instrumentFunction=function(e,r,n){e=e||window;var o=e[r];e[r]=function(){return n.call(this,t().slice(4)),e[r]._instrumented.apply(this,arguments)},e[r]._instrumented=o},e.prototype.deinstrumentFunction=function(e,t){e[t].constructor===Function&&e[t]._instrumented&&e[t]._instrumented.constructor===Function&&(e[t]=e[t]._instrumented)},e.prototype.chrome=function(e){return(e.stack+"\n").replace(/^[\s\S]+?\s+at\s+/," at ").replace(/^\s+(at eval )?at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}() ($1)$2").replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm,"{anonymous}() ($1)").replace(/^(.+) \((.+)\)$/gm,"$1@$2").split("\n").slice(0,-1)},e.prototype.safari=function(e){return e.stack.replace(/\[native code\]\n/m,"").replace(/^(?=\w+Error\:).*$\n/m,"").replace(/^@/gm,"{anonymous}()@").split("\n")},e.prototype.ie=function(e){return e.stack.replace(/^\s*at\s+(.*)$/gm,"$1").replace(/^Anonymous function\s+/gm,"{anonymous}() ").replace(/^(.+)\s+\((.+)\)$/gm,"$1@$2").split("\n").slice(1)},e.prototype.firefox=function(e){return e.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^(?:\((\S*)\))?@/gm,"{anonymous}($1)@").split("\n")},e.prototype.opera11=function(e){for(var t="{anonymous}",r=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/,n=e.stacktrace.split("\n"),o=[],i=0,a=n.length;a>i;i+=2){var s=r.exec(n[i]);if(s){var u=s[4]+":"+s[1]+":"+s[2],c=s[3]||"global code";c=c.replace(/<anonymous function: (\S+)>/,"$1").replace(/<anonymous function>/,t),o.push(c+"@"+u+" -- "+n[i+1].replace(/^\s+/,""))}}return o},e.prototype.opera10b=function(e){for(var t=/^(.*)@(.+):(\d+)$/,r=e.stacktrace.split("\n"),n=[],o=0,i=r.length;i>o;o++){var a=t.exec(r[o]);if(a){var s=a[1]?a[1]+"()":"global code";n.push(s+"@"+a[2]+":"+a[3])}}return n},e.prototype.opera10a=function(e){for(var t="{anonymous}",r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),o=[],i=0,a=n.length;a>i;i+=2){var s=r.exec(n[i]);if(s){var u=s[3]||t;o.push(u+"()@"+s[2]+":"+s[1]+" -- "+n[i+1].replace(/^\s+/,""))}}return o},e.prototype.opera9=function(e){for(var t="{anonymous}",r=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),o=[],i=2,a=n.length;a>i;i+=2){var s=r.exec(n[i]);s&&o.push(t+"()@"+s[2]+":"+s[1]+" -- "+n[i+1].replace(/^\s+/,""))}return o},e.prototype.other=function(e){for(var t,r,n="{anonymous}",o=/function(?:\s+([\w$]+))?\s*\(/,i=[],a=10,s=Array.prototype.slice;e&&i.length<a;){t=o.test(e.toString())?RegExp.$1||n:n;try{r=s.call(e.arguments||[])}catch(u){r=["Cannot access arguments: "+u]}i[i.length]=t+"("+this.stringifyArguments(r)+")";try{e=e.caller}catch(u){i[i.length]="Cannot access caller: "+u;break}}return i},e.prototype.stringifyArguments=function(e){for(var t=[],r=Array.prototype.slice,n=0;n<e.length;++n){var o=e[n];void 0===o?t[n]="undefined":null===o?t[n]="null":o.constructor&&(o.constructor===Array?o.length<3?t[n]="["+this.stringifyArguments(o)+"]":t[n]="["+this.stringifyArguments(r.call(o,0,1))+"..."+this.stringifyArguments(r.call(o,-1))+"]":o.constructor===Object?t[n]="#object":o.constructor===Function?t[n]="#function":o.constructor===String?t[n]='"'+o+'"':o.constructor===Number?t[n]=o:t[n]="?")}return t.join(",")},e.prototype.ajax=function(e){var t=this.createXMLHTTPObject();if(t)try{return t.open("GET",e,!1),t.send(null),t.responseText}catch(r){}return""},e.prototype.createXMLHTTPObject=function(){for(var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],r=0;r<t.length;r++)try{return e=t[r](),this.createXMLHTTPObject=t[r],e}catch(n){}},e.prototype.isSameDomain=function(e){return"undefined"!=typeof location&&-1!==e.indexOf(location.hostname)},e.prototype.getSource=function(e){return e in this.sourceCache||(this.sourceCache[e]=this.ajax(e).split("\n")),this.sourceCache[e]},e.prototype.guessAnonymousFunctions=function(e){for(var t=0;t<e.length;++t){var r=/\{anonymous\}\(.*\)@(.*)/,n=/^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/,o=e[t],i=r.exec(o);if(i){var a=n.exec(i[1]);if(a){var s=a[1],u=a[2],c=a[3]||0;if(s&&this.isSameDomain(s)&&u){var l=this.guessAnonymousFunction(s,u,c);e[t]=o.replace("{anonymous}",l)}}}}return e},e.prototype.guessAnonymousFunction=function(e,t,r){var n;try{n=this.findFunctionName(this.getSource(e),t)}catch(o){n="getSource failed with url: "+e+", exception: "+o.toString()}return n},e.prototype.findFunctionName=function(e,t){for(var r,n,o,i=/function\s+([^(]*?)\s*\(([^)]*)\)/,a=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,s=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/,u="",c=Math.min(t,20),l=0;c>l;++l)if(r=e[t-l-1],o=r.indexOf("//"),o>=0&&(r=r.substr(0,o)),r){if(u=r+u,n=a.exec(u),n&&n[1])return n[1];if(n=i.exec(u),n&&n[1])return n[1];if(n=s.exec(u),n&&n[1])return n[1]}return"(?)"},e}()}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){function r(e){void 0===e&&(e=!1),t.logToConsole=e,console.log&&(t.log=console.log.bind(console),t.info=console.info?console.info.bind(console):console.log.bind(console),t.warn=console.warn?console.warn.bind(console):console.log.bind(console),t.error=console.error?console.error.bind(console):console.log.bind(console),t.time=console.time?console.time.bind(console):console.log.bind(console),t.timeEnd=console.timeEnd?console.timeEnd.bind(console):console.log.bind(console))}function n(e){t.logContext=e,r(e.isDebugMode()),window.FO_NATIVE_DEBUG||(t.log=o,t.info=i,t.warn=a,t.error=s,t.time=u,t.timeEnd=c)}function o(e){l(15e3,e)}function i(e){l(2e4,e)}function a(e){l(3e4,e)}function s(e,r){void 0===r&&(r=t.logContext),l(4e4,e,r)}function u(e){t.logToConsole&&console.time&&console.time(e),t.log("TIMER_START: "+e)}function c(e){if(t.logToConsole&&console.timeEnd&&console.timeEnd(e),t.logstack)for(var r=0;r<t.logstack.length;r++){var n=t.logstack[r];if(n.msg=="TIMER_START: "+e){var o=Date.now()-n.time;return t.log("TIMER END: "+e+"("+o+"ms elapsed)"),o}}}function l(e,r,n){void 0===n&&(n=t.logContext);try{var o=f();if(t.logToConsole){var i=v[e];i||(i=function(e){return console.log(e)});var a="FO - "+(o?r+" @ "+o:r);i(a)}t.logstack||(t.logstack=[]);var s={time:Date.now(),level:e,msg:r,source:o};t.logstack.push(s),s.level>=t.callHomeLevel&&d(t.logstack,r,n)}catch(u){}}function f(){try{var t=e.Common.printStackTrace(),r=t[6],n=r.match(/^[^@]*/)[0];return"{anonymous}()"==n?null:n}catch(o){return null}}function d(e,r,n){try{for(var o="",i=0;i<e.length;i++){var a=e[i];a.level>=3e4&&"string"==typeof a.msg&&(o.length>0&&(o+=" --- "),o+=g[a.level]+" "+a.msg)}o.length>1024&&(o=o.substr(o.length-1024)),o||(o=r);var s={ex:o};t.Analytics.notify(n,t.Analytics.EXCEPTION,s,0)}catch(u){}}function p(){h(t.logstack)}function h(e){if(e)for(var t=0;t<e.length;t++){var r=e[t];1e4==r.level&&console.debug(r.msg),15e3==r.level&&console.log(r.msg),2e4==r.level&&console.info(r.msg),3e4==r.level&&console.warn(r.msg),4e4==r.level&&console.error(r.msg)}}function m(e,r,n){window.setTimeout(function(){for(var n=0;n<t.logstack.length;n++){var o=t.logstack[n],i=r(o,t.logstack);if(i)return}t.error("Failure on EXPECT "+e)},n)}!function(e){e[e.FATAL=5e4]="FATAL",e[e.ERROR=4e4]="ERROR",e[e.WARN=3e4]="WARN",e[e.INFO=2e4]="INFO",e[e.LOG=15e3]="LOG",e[e.DEBUG=1e4]="DEBUG",e[e.TRACE=5e3]="TRACE"}(t.LogLevel||(t.LogLevel={}));var g=t.LogLevel,v={1e4:function(e){return console.debug(e)},15e3:function(e){return console.log(e)},2e4:function(e){return console.info(e)},3e4:function(e){return console.warn(e)},4e4:function(e){return console.error(e)}};t.logToConsole,t.logstack,t.callHomeLevel=4e4,t.logContext,t.initializeWithoutContext=r,t.initialize=n,t.log,t.info,t.warn,t.error,t.time,t.timeEnd,r(!!window.FO_NATIVE_DEBUG),t.flushToConsole=p,t.expect=m}(t=e.Logger||(e.Logger={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){function r(e,t){return{name:e,value:t}}function n(e,t){return t.then(function(t){return r(e,t)})}function o(e,t){void 0===t&&(t=!1);var r=[];for(var n in e){var o=s(n,e[n]);r.push(o)}return a(r,t)}function i(e,t){void 0===t&&(t=!1);var r=[];for(var n in e){var o=s(n,e[n]);r.push(o)}return a(r,t)}function a(e,r){void 0===r&&(r=!1);var n=t.defer(),o=e.length,i={};if(0==o)return n.resolve({}),n.promise();for(var a=0;a<e.length;a++){var s=e[a];s.done(function(e){i[e.name]=e.value,t.StaticCol.getKeys(i).length==o&&n.resolve(i)}).fail(function(e){if(r){t.Logger.warn("Continuing ofter inner error: "+e.message);var o=""+Math.random();i[o]=null}else 1!==n.getStatus()&&n.reject(e)})}return n.promise()}function s(e,t){return t.then(function(t){return{name:e,value:t}})}function u(r){var n=t.defer();return e.$.ajax(r,{dataType:"text"}).done(function(e){n.resolve(e)}).fail(function(e,o,i){var a=i&&i.message||"error"!=o&&o||e.status||e.responseText||"generic error";t.Logger.warn("First level error on jqGet '"+r+"': "+a),n.reject({message:a})}),n.promise()}t.toNamed=r,t.toNamedPromise=n,t.namedWhen3=o,t.namedWhen2=i,t.namedWhen=a,t.namePromise=s,t.jqGetPromise=u}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){function t(){return new k}function r(e){return t().resolve(e).promise()}function n(e){return t().reject(e).promise()}function o(e,r){var n=t(),o=new Array;return i(o,n,e,r),n.promise()}function i(e,t,r,n){var o=r(n);if(!o)return void t.resolve(e);for(;o.next&&2==o.promise.getStatus();)if(e.push(o.promise.getResult()),o=r(o.next),!o)return void t.resolve(e);o.promise.done(function(n){e.push(n),o.next?i(e,t,r,o.next):t.resolve(e)}).fail(function(e){t.reject(e)})}function a(e){return u(function(){return!0},Number.MAX_VALUE,e,!1)}function s(e,r){void 0===r&&(r=Number.MAX_VALUE);var n=t(),o=!1;return window.setTimeout(function(){o||(o=!0,n.reject({message:"Timed out after "+r}))}),e(function(e){o||(o=!0,n.resolve(e))}),n.promise()}function u(e,r,n,o){void 0===r&&(r=0),void 0===n&&(n=500),void 0===o&&(o=!0);var i=t(),a=Date.now(),s=function(){
var t=Date.now()-a;if(t>=r)clearInterval(u),i.reject(Error("Timed out after "+t));else{var n=e();"undefined"!=typeof n&&null!=n&&(clearInterval(u),i.resolve(n))}},u=setInterval(s,n);return o&&s(),i.promise()}function c(){for(var e=[],r=0;r<arguments.length;r++)e[r-0]=arguments[r];var n=t();if(!e.length)return n.resolve([]),n.promise();for(var o=0,i=[],a=0;a<e.length;a++){var s=e[a];s.done(function(t){i.push(t),++o,o===e.length&&1!==n.getStatus()&&n.resolve(i)}).fail(function(e){1!==n.getStatus()&&n.reject(e)})}return n.promise()}function l(r,n){void 0===n&&(n=!1);var o=t();if(!r.length)return o.resolve([]),o.promise();for(var i=0,a=[],s=0;s<r.length;s++){var u=r[s];u.done(function(e){a.push(e),++i,i===r.length&&1!==o.getStatus()&&o.resolve(a)}).fail(function(t){n?(e.Logger.warn("Continuing after inner error: "+t.message),++i):1!==o.getStatus()&&o.reject(t)})}return o.promise()}function f(e,r,n,o,i,a){void 0===a&&(a=6e4);var s=t(),u=(new Date).getTime(),c=null,l=0,f=setInterval(function(){var t=(new Date).getTime();if(t-u>=a)clearInterval(f),s.reject({message:"Timed out after "+(t-u)});else try{var o=e();o==c?t-u>=i&&(clearInterval(f),s.resolve(o)):r(o)&&(n(o),c=o,l=t)}catch(d){s.reject(d)}},o);return s.promise()}function d(e,r){void 0===r&&(r=0);var n=t(),o=null,i=!1;r>0&&(o=setTimeout(function(){i||(i=!0,n.reject({message:"Timedout after "+r}))}));var a=function(e){i||(i=!0,clearTimeout(o),n.resolve(e))};try{e(a)}catch(s){i||(i=!0,clearTimeout(o),n.reject(s))}return n.promise()}function p(e,t){void 0===t&&(t=function(e){return!0});for(var n=r(null),o=0;o<e.length;o++){var i=h(e[o],t,o+1);n=n.alwaysThen(i)}return n}function h(e,t,n){var o=function(n,o,i){return!i&&null!=o&&t(o.value)?r(o):e.value(n).then(function(t){return{name:e.name,value:t}})};return v(o,n)}function m(e,t){return function(){return e(t)}}function g(e,t){return function(r){return e(t,r)}}function v(e,t){return function(r,n){return e(t,r,n)}}function y(e,t){return function(r,n,o){return e(t,r,n,o)}}function b(e,t){void 0===t&&(t=1);for(var r=n({message:"initial state"}),o=0;t>o;o++)r=r.alwaysThen(C(e,o));return r}function C(e,t){return void 0===t&&(t=1),function(n,o){return o?e(t):r(n)}}function w(e){return function(){return S(e())}}function S(e){return new x(e)}function _(e,r){var n=t();return E(n,e(),r),n.promise()}function E(e,t,r){t.advance().done(function(n){return n?(r(t.current),void E(e,t,r)):void e.resolve({})}).fail(function(t){return e.reject(t)})}function O(e){return"undefined"==typeof e}e.defer=t,e.resolve=r,e.reject=n,e.unfold=o,function(e){e[e.Unfulfilled=0]="Unfulfilled",e[e.Rejected=1]="Rejected",e[e.Resolved=2]="Resolved"}(e.Status||(e.Status={}));e.Status;e.wait=a,e.waitForEvent=s,e.waitFor=u,e.when=c,e.typedWhen=l,e.waitForStable=f,e.promiseFromCallback=d,e.namedWaterfall=p,e.lambda1=m,e.lambda2=g,e.lambda3=v,e.lambda4=y,e.retryPromise=b;var F=function(){function t(e){this.deferred=e}return t.prototype.getStatus=function(){return this.deferred.getStatus()},t.prototype.getResult=function(){return this.deferred.getResult()},t.prototype.getError=function(){return this.deferred.getError()},t.prototype.done=function(e){return this.deferred.done(e),this},t.prototype.fail=function(e){return this.deferred.fail(e),this},t.prototype.always=function(e){return this.deferred.always(e),this},t.prototype.alwaysThen=function(e){return this.deferred.alwaysThen(e)},t.prototype.then=function(e){return this.deferred.then(e)},t.prototype.logPassthrough=function(t){return this.then(function(r){return"string"==typeof r||r instanceof String?e.Logger.log(t+": "+r):e.Logger.log(t+": "+JSON3.stringify(r)),r})},t}(),k=function(){function r(){this._resolved=function(e){},this._rejected=function(e){},this._status=0,this._error={message:""},this._promise=new F(this)}return r.prototype.promise=function(){return this._promise},r.prototype.getStatus=function(){return this._status},r.prototype.getResult=function(){if(2!=this._status)throw new Error("Promise: result not available");return this._result},r.prototype.getError=function(){if(1!=this._status)throw new Error("Promise: rejection reason not available");return this._error},r.prototype.thenOld=function(e){var r=t();return this.done(function(t){var n=e(t);if(n&&"function"==typeof n.done&&n.deferred){var o=n;return o.done(function(e){return r.resolve(e)}).fail(function(e){return r.reject(e)}),o}r.resolve(n)}).fail(function(e){return r.reject(e)}),r.promise()},r.prototype.then=function(r){var n=t();return this.done(function(t){var o=null;try{o=r(t)}catch(i){return e.Logger.warn("First level error: "+i.message+" @ "+r),void n.reject(i)}if(o&&"function"==typeof o.done&&o.deferred){var a=o;return a.done(function(e){return n.resolve(e)}).fail(function(e){return n.reject(e)}),a}n.resolve(o)}).fail(function(e){return n.reject(e)}),n.promise()},r.prototype.alwaysThen=function(r){var n=t(),o=function(t,o){var i=null;try{i=r(t,o)}catch(a){return e.Logger.warn("First level error: "+a.message+" @ "+r),void n.reject(a)}if(i&&"function"==typeof i.done&&i.deferred){var s=i;return s.done(function(e){return n.resolve(e)}).fail(function(e){return n.reject(e)}),s}n.resolve(i)};return this.done(function(e){return o(e,null)}).fail(function(e){return o(null,e)}),n.promise()},r.prototype.done=function(e){if(2===this.getStatus())return e(this._result),this;if(0!==this.getStatus())return this;var t=this._resolved;return this._resolved=function(r){t(r),e(r)},this},r.prototype.fail=function(e){if(1===this.getStatus())return e(this._error),this;if(0!==this.getStatus())return this;var t=this._rejected;return this._rejected=function(r){t(r),e(r)},this},r.prototype.always=function(e){return this.done(function(t){return e(t)}).fail(function(t){return e(null,t)}),this},r.prototype.resolve=function(e){if(0!==this._status)throw new Error("tried to resolve a fulfilled promise");return this._result=e,this._status=2,this._resolved(e),this.detach(),this},r.prototype.reject=function(e){if(0!==this._status)throw new Error("tried to reject a fulfilled promise");return this._error=e,this._status=1,this._rejected(e),this.detach(),this},r.prototype.detach=function(){this._resolved=function(e){},this._rejected=function(e){}},r}();e.generator=w,e.iterator=S;var x=function(){function e(e){this.f=e,this.current=void 0}return e.prototype.advance=function(){var e=this,t=this.f();return t.then(function(t){return O(t)?!1:(e.current=t,!0)})},e}();e.each=_,e.isUndefined=O}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.getCountryPromise=function(t){var r=window.FO_COUNTRY;if(r)return e.Logger.log("Impersonaating country "+r),e.resolve(r);var n=t.paths().apiRoot()+"/fo/country.js";return e.jqGetPromise(n).then(function(e){var t=JSON3.parse(e);return t.country}).alwaysThen(function(t,r){return r&&!t?(e.Logger.warn("Failed getting Country.js for context.Defaulting to 'US': "+r.message),t="US"):e.Logger.log("Country resolved as "+t),t})},t}();t.CountryHelper=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.encode=function(t){var r,n,o,i,a,s,u,c="",l=0;for(t=e._utf8_encode(t);l<t.length;)r=t.charCodeAt(l++),n=t.charCodeAt(l++),o=t.charCodeAt(l++),i=r>>2,a=(3&r)<<4|n>>4,s=(15&n)<<2|o>>6,u=63&o,isNaN(n)?s=u=64:isNaN(o)&&(u=64),c=c+e._keyStr.charAt(i)+e._keyStr.charAt(a)+e._keyStr.charAt(s)+e._keyStr.charAt(u);return c},e.decode=function(t){var r,n,o,i,a,s,u,c="",l=0;for(t=t.replace(/[^A-Za-z0-9\-\_\=]/g,"");l<t.length;)i=e._keyStr.indexOf(t.charAt(l++)),a=e._keyStr.indexOf(t.charAt(l++)),s=e._keyStr.indexOf(t.charAt(l++)),u=e._keyStr.indexOf(t.charAt(l++)),r=i<<2|a>>4,n=(15&a)<<4|s>>2,o=(3&s)<<6|u,c+=String.fromCharCode(r),64!=s&&(c+=String.fromCharCode(n)),64!=u&&(c+=String.fromCharCode(o));return c=e._utf8_decode(c)},e._utf8_encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);128>n?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},e._utf8_decode=function(e){for(var t="",r=0,n=0,o=0,i=0;r<e.length;)n=e.charCodeAt(r),128>n?(t+=String.fromCharCode(n),r++):n>191&&224>n?(o=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&o),r+=2):(o=e.charCodeAt(r+1),i=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&o)<<6|63&i),r+=3);return t},e._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",e}();e.Base64=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.countWords=function(t){var r=e.Col.of(t).groupBy(function(e){return e}),n=r.selectValues(function(e){return e.value.length});return n},r.countWords_old=function(t){var r=e.StaticCol.groupByString(t,function(e){return e}),n=e.StaticCol.hashSelect(r,function(e){return e.length});return n},r.getNonTrivialWords=function(e){var t=new RegExp("^"+window.location.hostname.replace(/\./g,"|")+"$","i"),n=new RegExp(r.trivialWordPattern,"i"),o=[];return e&&(e=r.cleanString(e).toLowerCase(),o=r.splitToDistinctWords(e,function(e){return!n.test(e)&&!t.test(e)&&"|"!=e})),o},r.splitToDistinctWords=function(t,r){var n=t.match(/\S+/g);return n?e.Col.of(n).distinct(function(e){return e}).where(r).toArray():[]},r.cleanString=function(e){return e=e.replace(/(<([^>]+)>)/gi,""),e=e.replace(/\$\d(?:\d|,|&|\.)*/g," "),e=e.replace(/\(.*\)/g," "),e=e.replace(/[\|,\-\/#!$%\^&\*;:{}=\-_`~()@\+\?><\[\]\+]/g," "),e=e.replace(/\./g,function(e,t,r){var n=0!=t&&r[t-1].match(/\d/),o=t!=r.length-1&&r[t+1].match(/\d/);return n&&o?".":" "}),e=e.replace(/\s{2,}/g," "),e=e.replace(/('|\s$)/g,""),/[\u00C0-\u017F]/.test(e)&&(e=r.removeDiacritics(e)),e},r.removeDiacritics=function(e){for(var t=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}],r=0;r<t.length;r++)e=e.replace(t[r].letters,t[r].base);return e},r.encodedTrivialWordPattern="XihzZWFyY2h8cmVzdWx0fHJlc3VsdHN8Y29tfGluZm98bmV0fGl0ZW18a2V5d29yZHxrZXl3b3Jkc3xjYXJ0fGZvcnxhY2NvdW50c3xhY2NvdW50fGN1c3RvbWVyfHNlcnZpY2V8c3VwcG9ydHxjb250YWN0fHdlfGRlc2NyaXB0aW9ufHhtbHxwcm94eXxzdHlsZXNoZWV0fHNob3BzfHNob3B8c2hvcHBpbmd8cHJpY2V8bWlufG1heHxvbmxpbmV8aWR8ZW1haWx8c2hpcHxzaGlwcGluZ3x0b3xwZXJzb25hbGl6ZWR8c3VjaGVufGxpZWJsaW5nc3Byb2R1a3R8cHJvZHVrdHxkZXxzdWNoZXxlcmdlYm5pc3xlcmdlYm5pc3NlfGFydGlrZWx8c3RpY2h3b3J0fGpvYnRpdGVsfHdhcmVua29yYnxrdW5kZW5kaWVuc3R8a3VuZGVuc3VwcG9ydHxrb250YWt0aWVyZW58dW50ZXJzdMO8dHp1bmd8d2lyfGJlc2NocmVpYnVuZ3xlaW5rYXVmZW58Z2VzY2jDpGZ0ZXxwcmVpc3xzY2hpZmZzfHZlcnNhbmR8dW50ZXJzdMO8dHp1bmd8c2NodWhlfHphbGFuZG98YWNjb3VudHxwcm9kdWt0ZXxvbmxpbmVzaG9wfHN1Y2hlcmdlYm5pc3NlfHF1ZXJ5fGxhbmdpZHxtYXJrdHxtZWRpYXxtdWx0aWNoYW5uZWxzZWFyY2h8YWNoYXRzfGFjaGF0c3xjb21tZXJjZXxkaXNjb3VudHxyZWNoZXJjaMOpfHJlY2hlcmNoZXxyZWNoZXJjaGVyfHJlY2hlcmNoZXN8Y2hlcmNoZXJ8cHJvZHVpdHxwcm9kdWl0c3xhcnRpY2xlfHLDqXN1bHRhdHxyw6lzdWx0YXRzfHN1aXRlfGNvbnNlcXVlbmNlfHJhaXNvbnxwcml4fHBhZ2V8YXNwfGFzcHh8cGhwfGNob2l4fHByaXh8w6lsZWN0cm9tw6luYWdlcnxhY2N1ZWlsfGhvbWVwYWdlfG1hcmNoYW5kfG1lcmNoYW50fGjDpG5kbGVyfHVybHxodG1sfHByb2RvdHRpfHByb2dyYW1taXxndWFyZGFyZXxwcmV6eml8dHJvdmF8YWNxdWlzdGl8cmljZXJjYXxjb25mcm9udGF8b2ZmZXJ0ZXxjZXJjYXxJc2NyaXZpdGl8QWNjZWRpfGxvZ2lufGVtYWlsfGUtbWFpbHxzY29udGl8bGF2b3JldHRpfG1lbnV8Y29yc298YmVuZXNzZXJlfHBhcmNoZWdnaXxyaWNhcmljYWJpbGV8Y29tcGFyYXxsaXN0c2FsZXN8cmV0dXJudXJsfHNhbGVzfHRhZ3x0YWduYW1lfG9mZmVydGEpJA==",r.trivialWordPattern=t.Base64.decode(r.encodedTrivialWordPattern),r}();t.WordUtils=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){t.emptyDedicatedResult={hasDedicated:!1,wordCounts:e.Map.emptyMap(),clientPrice:-1,isHomepage:!1};var r=function(){function r(){}return r.tryScrpaePageByDedicated=function(n,o){var i=o.paths().dynamicContentRoot()+"/site-classification/site/"+n;return e.jqGetPromise(i).then(function(n){if("{}"==n.trim())return e.Logger.log("Empty dedicated definition"),t.emptyDedicatedResult;try{var i=JSON3.parse(n),a=r.parsePageSchema(o,i,o.scraper());return a}catch(s){throw e.Logger.error("Dedicated failed: "+(s&&s.message)),s}})},r.parsePageSchema=function(n,o,i){var a=o.jqxgridHomepage&&o.jqxgridHomepage.some(function(e){return e.text==window.location.href}),s=t.WordUtils.getNonTrivialWords(document.title);a&&(s=[]);var u=i.queryParams(),c=[];if(o.jqxgridUrlParams)for(var l=0;l<o.jqxgridUrlParams.length;l++){var f=o.jqxgridUrlParams[l];if(f.text in u){var d=t.WordUtils.getNonTrivialWords(u[f.text]);c=c.concat(d)}}var p=i.getElementTextByReference(o.jqxgridDescription,!0),h=t.WordUtils.getNonTrivialWords(p),m=i.getElementTextByReference(o.jqxgridPrice,!1),g=m?Number(m.replace(/[^0-9\.]+/g,"")):r.MAX_PRICE,v=Math.min(g,r.MAX_PRICE),y=r.getMetaTags(),b=o.chkMetaKeywords?t.WordUtils.getNonTrivialWords(y.keywords):[],C=o.chkMetaDescription?t.WordUtils.getNonTrivialWords(y.description):[],w=h.concat(s).concat(C).concat(b).concat(c),S=e.StaticCol.where(w,function(e){return!e.match(/^[\W_]*$/)}),_=t.WordUtils.countWords(S),E={hasDedicated:!0,wordCounts:_,clientPrice:v,isHomepage:a};return E},r.getMetaTags=function(){for(var e=[],t=document.getElementsByTagName("meta"),r=0;r<t.length;r++)"keywords"==t[r].name.toLowerCase()?e.keywords=t[r].content:"description"==t[r].name.toLowerCase()&&(e.description=t[r].content);return e},r.MAX_PRICE=4294967295,r}();t.DedicatedHelper=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t){this.virgin=!0,this.keyFunc=e,this.valueFunc=t}return e.prototype.value=function(){var e=this.keyFunc();return(this.virgin||e!=this.key)&&(this._value=this.valueFunc(),this.key=e,this.virgin=!1),this._value},e}();e.DependentSingletone=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e}();e.ModelBase=t}(t=e.Model||(e.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(t,r,n,o,i){this.context=null,this.suspendIdentifier=null,this.legacySuspendIdentifier=null,this.suspendPeriods=null,this.suspendPeriods=o,this.selectedPeriodMS=e.ko.observable(this.suspendPeriods[0].ms),this.context=t,this.suspendIdentifier=r,this.legacySuspendIdentifier=n,this.closeFn=i}return r.prototype.shouldAutoAppear=function(){return this.context.suspender().shouldAutoAppear(this.suspendIdentifier)},r.prototype.applySelectedSuspension=function(){this.suspend(this.selectedPeriodMS())},r.prototype.suspend=function(e){this.context.suspender().suspend(this.suspendIdentifier,e),this.closeFn()},r.prototype.openSuspendWindow=function(){var e=t.Common.stringFormat("http://removemyapp.info/suspend.html?hid={0}_{1}&contact={2}",this.context.userSettings().uuid(),this.legacySuspendIdentifier,encodeURIComponent(this.context.params().providerLink)),n="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=730, height=400",o=window.open(e,"",n),i=this,a=window.setInterval(function(){var e=r.checkSuspendWindowClosed(i,o,i.closeFn);e&&window.clearInterval(a)},500)},r.checkSuspendWindowClosed=function(e,r,n){return r&&r.closed?(e.context.userSettings().reload().then(function(){var r=e.context.suspender().isSuspended(e.suspendIdentifier),o=e.context.suspender().shouldAutoAppear(e.suspendIdentifier);t.Logger.log("Suspend advanced window closed. Suspended: "+r+". AutoAppear: "+o),r&&n()}),!0):!1},r.prototype.openSuspendWindow_new=function(){var e=this,r=t.Common.stringFormat("http://removemyapp.info/suspend.html?hid={0}_{1}&contact={2}",this.context.userSettings().uuid(),this.legacySuspendIdentifier,encodeURIComponent(this.context.params().providerLink)),n="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=730, height=400",o=window.open(r,"",n),i=window.setInterval(function(){o&&o.closed&&(e.context.userSettings().reload().then(function(){var r=e.context.suspender().isSuspended(e.suspendIdentifier),n=e.context.suspender().shouldAutoAppear(e.suspendIdentifier);t.Logger.log("Suspend advanced window closed. Suspended: "+r+". AutoAppear: "+n),r&&e.closeFn()}),window.clearInterval(i))},500)},r.defaultSuspendPeriods=[{text:"1 Hour",ms:36e5},{text:"1 Day",ms:864e5},{text:"1 Week",ms:6048e5}],r.strictSuspendPeriods=[{text:"1 Day",ms:864e5},{text:"1 Week",ms:6048e6},{text:"Forever",ms:3155692597470}],r.allSuspendPeriods=[{text:"1 Hour",ms:36e5},{text:"1 Day",ms:864e5},{text:"1 Week",ms:6048e5},{text:"Forever",ms:3155692597470}],r}();r.SuspendTarget=n}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e){this.datastore=null,window.FO.GlobalStore||(window.FO.GlobalStore={}),this.datastore=window.FO.GlobalStore,e&&(e in this.datastore||(this.datastore[e]={}),this.datastore=this.datastore[e])}return e.prototype.retrive=function(e){return this.datastore[e]},e.prototype.store=function(e,t){this.datastore[e]=t},e.prototype.remove=function(e){delete this.datastore[e]},e.prototype.retriveAndRemove=function(e){var t=this.retrive(e);return this.remove(e),t},e}();e.GlobalSpace=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.resolveProductsByRealEstate=function(n,o){var i=[],a=e.StaticCol.groupByString(o,function(t){return e.Products.VisualRealEstate[t.product.visual.realEstate()]});for(var s in a){var u=a[s],c=e.StaticCol.maxBy(u,function(e){return e.score});i.push(c.product)}for(var l=new t.GlobalSpace("RealEstate"),f=[],d=0;d<i.length;d++){var p=i[d],h=e.Products.VisualRealEstate[p.visual.realEstate()],m=r.isTaken(l,h);m?(e.Logger.info("Product "+p.name+" skipped. Its realestate "+h+" is occupied"),e.Logger.Analytics.notify(n,e.Logger.Analytics.NO_SHOW,{reason:"realestate_taken",w:p.visual.flag()},0)):(r.claimRealestate(l,h,p.name),l.store(h,p.name),f.push(p))}return f},r.isTaken=function(e,t){var n=!!e.retrive(t);if(n)return!0;var o=r.realEstateToOldMarker(t);if(o){var i=!!window[o];if(i)return!0}return!1},r.claimRealestate=function(e,t,n){e.store(t,n);var o=r.realEstateToOldMarker(t);o&&(window[o]=!0)},r.releaseRealestate=function(n){var o=new t.GlobalSpace("RealEstate");o.remove(n);var i=r.realEstateToOldMarker(n);i&&(window[i]=!1),e.Logger.log("Released realestate "+n)},r.realEstateToOldMarker=function(e){var t={RIGHT_PANEL:"__rsor",BOTTOM_PANEL:"__bsor"};return t[e]},r}();t.RealEstateHelper=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(n){function o(o,i,a,s){var u=this;void 0===s&&(s=function(){}),n.call(this),this.collapsed=e.ko.observable(!1),this.hidden=e.ko.observable(!1),this.suspendTarget=null,this.winSize=e.ko.observable({x:0,y:0}),this.docSize=e.ko.observable({x:0,y:0}),this.postRenderHandler=function(){};var c=this;this.context=o,this.suspendIdentifier=i,this.providerLink=o.params().providerLink,this.providerName=o.params().providerName,this.providerFooter=o.params().providerFooter,this.extraAttribution=window.__rvzfrrstfr&&window.__rvzfrrstfr.product_name;var l=this.extraAttribution?r.SuspendTarget.strictSuspendPeriods:r.SuspendTarget.defaultSuspendPeriods;this.suspendTarget=new r.SuspendTarget(o,i,a,l,function(){return u.destroy()}),this.collapsed(!this.suspendTarget.shouldAutoAppear()),this.onClose=s,this.afterRender=function(r,n){if(0==r.length)t.Logger.warn("No nodes sent to after render. wtf?");else{var o=r[0].parentNode,i=e.$(o);u.postRenderHandler(i,o)}};var f=function(){c.winSize({x:e.$(window).width(),y:e.$(window).height()}),c.docSize({x:e.$(document).width(),y:e.$(document).height()})};f(),e.$(window).resize(f)}return __extends(o,n),o.prototype.hide=function(){this.destroy()},o.prototype.destroy=function(){this.hidden(!0),t.Common.RealEstateHelper.releaseRealestate(this.suspendIdentifier),this.onClose()},o.prototype.toggleCollapsed=function(){this.collapsed(!this.collapsed())},o.prototype.blockPropagation=function(e,t){return t&&(t.stopPropagation(),t.cancelBubble=!0),!0},o}(r.ModelBase);r.ProductModelBase=n}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.treatForCollisions=function(t){t.addClass(e.antiCollisionClass),t.find("*").addClass(e.antiCollisionClass)},e.antiCollisionClass="fo-close-xyz sgsefvhuedc",e}();e.CollisionHelper=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n;!function(e){e[e.HORIZONTAL=0]="HORIZONTAL",e[e.VERTICAL=1]="VERTICAL",e[e.BOTH=2]="BOTH"}(n||(n={}));var o=function(){function n(){}return n.createAndBindDisplay=function(o,i,a,s,u){if(null==u)throw new Error("Parent elmenet missing");var c=e.$(o).addClass(i);r.CollisionHelper.treatForCollisions(c),n.safeAppend(u,c,!0);var l=c[0];a.postRenderHandler=function(){t.Col.of(s).each(function(e){return e.afterRender(c,l)})};try{e.ko.applyBindings(a,l)}catch(f){throw t.Col.of(s).each(function(e){return e.remove&&e.remove()}),c.remove(),f}return l},n.appendHtmlWithRootClass=function(t,r,o){void 0===o&&(o=document);var i=e.$(t).addClass(r);return n.appendToBody(i,o),i},n.parseAndAppendHtmlToElement=function(t,r){var n=e.$.parseHTML(t);return e.$(r).append(n)},n.appendToDivById=function(e,t,r){void 0===r&&(r=document);var o=r.getElementById(e);n.safeAppend(o,t,!1)},n.appendToBody=function(e,t){void 0===t&&(t=document);var r=t.documentElement.getElementsByTagName("body")[0];n.safeAppend(r,e,!1)},n.appendToHead=function(e,t){void 0===t&&(t=document);var r=t.documentElement.getElementsByTagName("head")[0];n.safeAppend(r,e,!1)},n.safeAppend=function(t,r,n){var o="ver"+(1e7*Math.random()).toFixed();if(r.addClass(o),n?e.$(t).prepend(r):e.$(t).append(r),0==e.$("."+o).length){var i=r[0],a=t.childElementCount>0?t.children.item(0):null;if(t.insertBefore(i,a),0==e.$("."+o).length)throw new Error("Root element cannot be found after supposadly appended")}},n.elementBelowTheFold=function(t,r){var n=e.$(window).height()+e.$(window).scrollTop();return n<=e.$(t).offset().top+e.$(t).height()*r},n.elementAboveTheTop=function(t,r){var n=e.$(window).scrollTop(),o=e.$(t).height();return n>=e.$(t).offset().top+o-o*r},n.elementRightOfScreen=function(t,r){var n=e.$(window).width()+e.$(window).scrollLeft();return n<=e.$(t).offset().left-e.$(t).width()*r},n.positionNextTo=function(t,r,o,i){void 0===o&&(o=0),void 0===i&&(i=window);var a,s=n.getElementPosWithOffsets(t[0]),u=t.width(),c=r.width(),l=s.left+u+o+c<i.innerWidth,f=s.left-o>c;a=l?s.left+u+o:f?s.left-o-c:(i.innerWidth-c)/2;var d=Math.min(s.top,e.$(i).scrollTop()+e.$(i).height()-r.height());return{x:a,y:d}},n.getElementPosWithOffsets=function(e){if(e&&e.getBoundingClientRect){var t={top:0,left:0,width:0,height:0,bottom:0,right:0},r=e&&e.ownerDocument;if(t=e.getBoundingClientRect(),!r)return t;var n=r.defaultView||r.parentWindow,o=r.documentElement,i=t.top+(n.pageYOffset||o.scrollTop||0)-(o.clientTop||0),a=t.left+(n.pageXOffset||o.scrollLeft||0)-(o.clientLeft||0),s=e.offsetWidth||0,u=e.offsetHeight||0,c=i+u,l=a+s;return{top:i,left:a,width:s,height:u,bottom:c,right:l}}},n.isContained=function(e,t,r){return e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom},n.elementLeftOfScreen=function(t,r){var n=e.$(window).scrollLeft(),o=e.$(t).width();return n>=e.$(t).offset().left+o-o*r},n.isElementInViewport=function(e,t){return t=t||0,!(n.elementRightOfScreen(e,t)||n.elementLeftOfScreen(e,t)||n.elementBelowTheFold(e,t)||n.elementAboveTheTop(e,t))},n}();r.VisualHelper=o}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(){var t=this;this._queryParams=new r.DependentSingletone(function(){return window.location.href},function(){return t.parseQueryString(window.location)}),this._documentHTML=new r.DependentSingletone(function(){return window.location.href},function(){return e.$(document.documentElement).html();
})}return n.prototype.documentHTML=function(){return this._documentHTML.value()},n.prototype.queryParams=function(){return this._queryParams.value()},n.prototype.parseQueryString=function(e){for(var t=e.search.substring(1).split("&"),r=e.hash.substring(1).split("&"),o=r.concat(t),i={},a=0;a<o.length;a++){var s;try{s=decodeURIComponent(o[a])}catch(u){s=o[a]}if(-1==s.indexOf("="))i[s]=n.VALUELESS_PARAM;else{var c=s.split("=");i[c[0]]=c[1]}}return i},n.prototype.testPatternsAgainstHTML=function(e){for(var r=0;r<e.length;r++){var n=new RegExp("(^|[^a-z|A-Z])("+e[r]+")($|[^a-z|A-Z])","ig"),o=this.documentHTML().match(n),i=o?o.length:0;if(i)return t.Logger.info("Matched pattern ["+r+"]. ["+i+"] matches found"),1}return 0},n.prototype.getElementTextByReference=function(e,r){var o=[function(e){return e.xpath&&n.getElementByXpath(e.xpath.trim())},function(e){return e.id&&document.querySelector("#"+e.id.trim())},function(e){return e.name&&document.getElementsByName(e.name.trim())[0]},function(e){return e["class"]&&document.querySelector("."+e["class"].trim())}],i="";try{for(var a=0;a<e.length;a++)for(var s=e[a],u=0;u<o.length;u++){var c=o[u],l=c(s);if(l){if(!r)return n.getInnerText(l);i=i+n.getInnerText(l)+" "}}}catch(a){t.Logger.warn("Failure in dedicated field parsing. Skipping field")}return i},n.getInnerText=function(e){return e.innerText||e.textContent},n.getElementByXpath=function(e){var t=document.evaluate&&document.evaluate(e,document,null,9,null).singleNodeValue;return t},n.prototype.getFirstMatchText=function(e,t){void 0===t&&(t="");for(var r=0;r<e.length;r++){var o=e[r],i=document.querySelector(o);if(i){var a=n.getInnerText(i);if(a)return a}}return t},n.prototype.getElementPosWithOffsets=function(e){return r.VisualHelper.getElementPosWithOffsets(e)},n.VALUELESS_PARAM="",n}();r.DefaultPageScraper=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(t){function r(r,n,o,i,a,s){t.call(this,r.paths(),r.params(),r.extraParams,r.overrides()),this._countryCode=n,this._userSettings=o,this._suspender=i,this._iframe=a,this._scraper=new e.Common.DefaultPageScraper,this._fnWindow=window}return __extends(r,t),r.prototype.countryCode=function(){return this._countryCode},r.prototype.userSettings=function(){return this._userSettings},r.prototype.suspender=function(){return this._suspender},r.prototype.scraper=function(){return this._scraper},r.prototype.iframe=function(){return this._iframe},r.prototype.fnWindow=function(){return this._fnWindow},r.prototype.notificationParams=function(){var e=t.prototype.notificationParams.call(this);return e.hid=this.userSettings().uuid(),e},r.fromPromise=function(t,n,o,i,a){var s=e.Common.CountryHelper.getCountryPromise(t);return e.namedWhen2({CC:s,US:n,SU:o}).then(function(e){var n=e.CC,o=e.US,s=e.SU;return new r(t,n,o,s,i,a)})},r}(t.BootstrapContext);t.ApplicationContext=r}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(e){function t(t,r,n){e.call(this,t,t.countryCode(),t.userSettings(),t.suspender(),t.iframe(),t.fnWindow()),this.productName=r,this.visual=n}return __extends(t,e),t.prototype.notificationParams=function(){var t=e.prototype.notificationParams.call(this);return t.pname=this.productName,t.w=this.visual.flag(),t},t}(e.ApplicationContext);e.VisualContext=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(e){function t(t,r,n,o){e.call(this,t,r,o),this._logic=n}return __extends(t,e),t.prototype.logic=function(){return this._logic},t.prototype.notificationParams=function(){var t=e.prototype.notificationParams.call(this);return t.pr=this.logic().flag(),t},t}(e.VisualContext);e.LVContext=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t){this.primaryCount=e,this.secondaryCount=t}return e.prototype.totalCount=function(){return this.primaryCount+this.secondaryCount},e}();e.ItemCounts=t}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t,r,n){void 0===n&&(n={}),this.source=e,this.context=t,this.data=r,this.extras=n}return e.prototype.hasData=function(){return this.data&&this.data.length>0},e}();e.PlainDataResult=t;var r=function(){function e(e,t){this.source=e,this.context=t}return e.prototype.hasData=function(){return!0},e}();e.StubDataResult=r;var n=function(e){function t(t,r,n){e.call(this,t,r),this.generator=n}return __extends(t,e),t.prototype.generateData=function(e,t,r){return this.generator(e,t,r)},t}(r);e.DataGeneratorResult=n}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){!function(e){e[e.LEFT_PANEL=0]="LEFT_PANEL",e[e.RIGHT_PANEL=1]="RIGHT_PANEL",e[e.TOP_PANEL=2]="TOP_PANEL",e[e.BOTTOM_PANEL=3]="BOTTOM_PANEL",e[e.MAIN_TABLE=4]="MAIN_TABLE",e[e.MAIN_IMAGE=5]="MAIN_IMAGE",e[e.IMAGE_RIGHT=6]="IMAGE_RIGHT",e[e.IMAGE_INNER=7]="IMAGE_INNER",e[e.APPNEXUS_SPECIAL=8]="APPNEXUS_SPECIAL",e[e.BANNER_SQUERE=9]="BANNER_SQUERE",e[e.SEARCH_BAR=10]="SEARCH_BAR"}(e.VisualRealEstate||(e.VisualRealEstate={}));e.VisualRealEstate}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){this.dataSyncStore=new t.GlobalSpace("DataSync")}return r.prototype.getAll=function(){var e=this.dataSyncStore.retrive("DataItems");return e||(e={}),e},r.prototype.setAll=function(e){this.dataSyncStore.store("DataItems",e)},r.prototype.claim=function(e,t,r){void 0===r&&(r=!1);var n=this.getAll(),o=e in n;return(!o||r)&&(n[e]=t),this.setAll(n),o},r.prototype.cliamWithoutMarking=function(t,r,n,o){void 0===o&&(o=[]);for(var i=[],a=e.StaticCol.select(o,r),s=0;s<t.length&&!(i.length>=n);s++){var u=t[s],c=r(u),l=e.StaticCol.contains(a,c);l||i.push(u)}return i},r.prototype.claimUniques=function(t,r,n,o,i,a){void 0===i&&(i=!0),void 0===a&&(a=[]);for(var s=[],u=[],c=[],l=this.getAll(),f=e.StaticCol.select(a,r),d=0;d<t.length;d++){var p=t[d],h=r(p),m=e.StaticCol.contains(f,h);if(!m)if(h in l)u.push(p);else if(s.push(p),l[h]=n,s.length>=o)break}if(this.setAll(l),i){var g=this.cliamWithoutMarking(u,r,o-s.length,s);c=s.concat(g)}else c=s;return c},r}();t.DataSynchronizer=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t,r){this.logic=null,this.name=e,this.logics=t,this.visual=r}return e.prototype.classify=function(e){return this.logic.classify(e)},e}();e.Product=t}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.disable=function(){return window.FO_FORGET},e.getHistoricalClassification=function(t){if(e.disable())return 0;var r="FO.Classification."+t.flag(),n=localStorage.getItem(r),o=(new Date).getTime();return n&&parseInt(n)>o?1:0},e.setHistoricalClassification=function(t,r){if(void 0===r&&(r=3600),!e.disable()){var n="FO.Classification."+t.flag(),o=(new Date).getTime(),i=o+1e3*r;localStorage.setItem(n,i+"")}},e}();e.ElephantClassifier=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(e,t){this.paths=null,this.paths=e;var n=r.generateGuid(16);this.iframePromise=this.createIFrame(n,e.iframeStoreSrc(),t)}return n.prototype.createIFrame=function(n,o,i){var a=this,s=t.defer(),u=document.createElement("iframe");return u.id=n,u.src=i?o+"#debug":o,u.style.position="absolute",u.style.width="1px",u.style.height="1px",u.style.left="-100px",u.style.top="-100px",u.style.visibility="hidden",r.VisualHelper.appendToBody(e.$(u)),r.attachPostMessageHandler(window,this.createHandleCallback(this.paths.rootUrl())),t.Logger.log("IFrameStore setup"),u.onload=function(){t.Logger.info("IFrame trying echo on onload"),a.verifyIFramePromise(u).fail(function(e){t.Logger.warn("IFrame echo failed");var r=e.message?e.message:e+"";s.reject({message:"Store IFrame echo after load failure: "+r})}).done(function(){t.Logger.info("Store IFrame alive and well.Loaded and echoes"),s.resolve(u)})},u.onerror=function(e){t.Logger.info("IFrame trying echo on onerror"),a.verifyIFramePromise(u).fail(function(r){t.Logger.warn("IFrame echo failed");var n=r.message?e.message:r+"";s.reject({message:"Store IFrame echo after error failure: "+n})}).done(function(){t.Logger.warn("Store IFrame alive and well even though error reported. WTF."),s.resolve(u)})},s.promise()},n.prototype.verifyIFramePromise=function(e){return this.postRequestPromise(e,"retrieveOrSet",!0,"echo","echo")},n.prototype.postRequest=function(e,t,r,n){var o=this;return this.iframePromise.then(function(i){return o.postRequestPromise(i,e,t,r,n)})},n.prototype.postRequestPromise=function(e,o,i,a,s){var u=t.defer(),c=!1,l=r.generateGuid(9);window.setTimeout(function(){if(!c){c=!0;var e={message:"IFrameStore request of type: "+o+". key: "+a+". Has timed out after "+n.REQUEST_TIMEOUT_MS};u.reject(e)}},n.REQUEST_TIMEOUT_MS),i&&n.getGlobalCallMap().store(l,function(e){c||(c=!0,u.resolve(e))});var f={id:l,type:o,key:a,value:s},d=JSON3.stringify(f);return e.contentWindow.postMessage(d,e.src),u.promise()},n.getGlobalCallMap=function(){return new r.GlobalSpace("postMessageCallbacks")},n.prototype.createHandleCallback=function(e){return function(t){var r=!1,o=n.getMainDomain(e),i=n.getMainDomain(t.origin);if(r||i==o)try{var a=JSON3.parse(t.data),s=n.getGlobalCallMap().retriveAndRemove(a.id);s&&s(a.value)}catch(u){}}},n.getMainDomain=function(e){if(-1!=e.indexOf("//localhost"))return"localhost";var t=/\/\/[^\.]+\.((?:[^\.\/]*\.+)?[^\.\/]*)/gi,r=t.exec(e)[1];return r},n.prototype.retrieveAll=function(){return this.postRequest("retrieveAll",!0)},n.prototype.retrieveOrSet=function(e,t){return this.postRequest("retrieveOrSet",!0,e,t)},n.prototype.retrieve=function(e){return this.postRequest("retrieve",!0,e)},n.prototype.store=function(e,t){this.postRequest("store",!1,e,t)},n.prototype.storeAll=function(e){this.postRequest("storeAll",!1,null,e)},n.REQUEST_TIMEOUT_MS=300,n}();r.IFrameStore=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(e,t){this.asyncStore=e,this.data=t}return t.prototype.uuid=function(){return this.data.uuid},t.prototype.retrive=function(e){return this.data[e]},t.prototype.store=function(e,t){this.data[e]=t,this.commitChanges()},t.prototype.remove=function(e){delete this.data[e],this.commitChanges()},t.prototype.retriveAndRemove=function(e){var t=this.data[e];return delete this.data[e],this.commitChanges(),t},t.prototype.reload=function(){var r=this;return this.asyncStore.retrieve(t.USER_SETTINGS_KEY).alwaysThen(function(t,n){n?n&&e.Logger.warn("Failed reloading userSetting."):r.data=t})},t.prototype.commitChanges=function(){this.asyncStore.store(t.USER_SETTINGS_KEY,this.data),localStorage.setItem(t.USER_SETTINGS_KEY,JSON3.stringify(this.data))},t.fromAsyncStorePromise=function(r,n){var o={uuid:n,suspend:{}};return r.retrieveOrSet(t.USER_SETTINGS_KEY,o).alwaysThen(function(n,i){var a=null;if(i){e.Logger.warn("Failed getting real userSetting using default: "+(i&&i.message));var s=localStorage.getItem(t.USER_SETTINGS_KEY),u=null;try{u=JSON3.parse(s)}catch(c){}u&&u.uuid?(e.Logger.warn("Using localStorage info in place of iframe settings:"),e.Logger.info(s),a=u):(e.Logger.info("localStorage info missing or misshaped will use default values for user settings"),a=o)}else e.Logger.info("Using true iframe data for user settings"),a=n,localStorage.setItem(t.USER_SETTINGS_KEY,JSON3.stringify(n));return new t(r,a)}).fail(function(t){e.Logger.error("Failed loading async store for userSettings: "+t.message)})},t.USER_SETTINGS_KEY="userSettings",t}();t.LooseUserSettings=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function t(){}return t.perform=function(e,r){var n=t.singletoneStore.retrive(e);if(n)return n.promise;var o=r();return n={initTime:(new Date).getTime(),promise:o},t.singletoneStore.store(e,n),o},t.singletoneStore=new e.GlobalSpace("Singletones"),t}();e.GlobalSingletone=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var Injector=function(){function e(){}return e.getAltDocument=function(){if(null==e.altDocument){var t=document.createElement("iframe");t.height=t.width="0",document.body.appendChild(t),e.altDocument=t.contentWindow.document}return e.altDocument},e.retryOnFailure=function(t,r,n){try{t(function(o){0==r?n(o):e.retryOnFailure(t,r-1,n)},r)}catch(o){0==r?n(o):e.retryOnFailure(t,r-1,n)}},e.injectScriptWithRetries=function(t,r,n,o){void 0===o&&(o=!1),e.retryOnFailure(function(n,i){return e.injectScript(t+"?retries="+i,r,n,o)},3,n)},e.injectScript=function(t,r,n,o){void 0===o&&(o=!1);var i=null,a=!0,s=!1,u=document.createElement;u.toString().indexOf("[native code]")>0?i=document.createElement("script"):(i=e.getAltDocument().createElement.call(document,"script"),a=!1),i.onload=i.onreadystatechange=function(e){s||i.readyState&&"loaded"!==i.readyState&&"complete"!==i.readyState||(s=!0,o&&console.log("Injected script loaded"),r&&window.setTimeout(function(){r()},1))},i.onerror=function(e){s||(s=!0,o&&console.warn("Injected script failed",e),n&&window.setTimeout(function(){n(e)},1))};var c=document.getElementsByTagName("head")[0],l=c.appendChild;return l.toString().indexOf("[native code]")>0?c.appendChild(i):(e.getAltDocument().appendChild.call(c,i),a=!1),i.src=t,o&&console.log("Injected script "+t+". Using native functions: "+a),a},e.altDocument=null,e}(),FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.injectScriptRetryPromise=function(r,n){void 0===n&&(n=0);var o=function(e){return t.injectScriptPromise(r+"?try="+e)};return e.retryPromise(o,n+1)},t.injectScriptPromise=function(t){var r=e.defer();return Injector.injectScript(t,function(){return r.resolve(null)},function(e){return r.reject({message:"Failed script load "+t+": "+(e&&e.message)})}),r.promise()},t.promiseFromLoader=function(t,r){var n=e.defer(),o=!1;return t.onload=t.onreadystatechange=function(e){o||t.readyState&&4!=t.readyState&&"loaded"!==t.readyState&&"complete"!==t.readyState||(o=!0,n.resolve(t))},t.onerror=function(e){o||(o=!0,n.reject({message:"unknown load error"}))},t.ontimeout=function(e){o||(o=!0,n.reject({message:"timeout error"}))},n.promise()},t.nativeAjax=function(e){var r=null;if("XDomainRequest"in window){var n=new window.XDomainRequest;n.open("get",e),r=t.promiseFromLoader(n,e),n.send()}else{var o=new XMLHttpRequest;o.open("get",e,!0),r=t.promiseFromLoader(o,e),o.send()}return r.then(function(e){if(200==e.status)return e.responseText;throw new Error(e.statusText)})},t}();t.NativeJSHelper=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(){}return n.bring=function(e){return t.jqGetPromise(e)},n.injectCss2=function(n,o){if(void 0===o&&(o=document),o.createStyleSheet)o.createStyleSheet(n);else{var i=e.$('<link rel="stylesheet" type="text/css" href="'+n+'" />');r.VisualHelper.appendToHead(i,o)}return t.resolve(null)},n.injectScript=function(e){return r.NativeJSHelper.injectScriptRetryPromise(e,2)},n.loadProduct=function(e,r,o,i){var a=n.instantiateVisual(i),s=t.StaticCol.select(o,function(e){return n.instantiateLogic(e)}),u=new t.Products.Product(r,s,a);return t.resolve(u)},n.instantiateLogic=function(e){var r=["FO.Shared_0_0_603.Products.Logic."+e,"FO.Shared_0_0_603.ExternalProducts."+e],o=t.Col.of(r).selectFirst(function(e){return n.instantiateFromQualifiedName(e,!1)});if(!o)throw new Error("Failed to instantiate logic "+e);return o},n.instantiateVisual=function(e){var r=["FO.Shared_0_0_603.Products.Visual."+e,"FO.Shared_0_0_603.ExternalProducts."+e],o=t.Col.of(r).selectFirst(function(e){return n.instantiateFromQualifiedName(e,!1)});if(!o)throw new Error("Failed to instantiate visual "+e);return o},n.instantiateFromQualifiedName=function(e,t){void 0===t&&(t=!0);for(var r=e.split("."),n=window,o=0;o<r.length;o++){if(!(r[o]in n)){if(t)throw Error("Cannot instantiate from qualified name. "+r[o]+" not found for path "+e);return null}n=n[r[o]]}return new n},n}();r.Res=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(FO){var Shared;!function(Shared){var Common;!function(Common){var ExternalResources=function(){function ExternalResources(){}return ExternalResources.getJQuery=function(e){return ExternalResources.patchExternalOrFallback("//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js",-2041667497,ExternalResources.patchJQuery,e+"jquery-1.11.1.js",ExternalResources.verifyJQuery).then(function(){return window.FO.$=window.$.noConflict(!0)})},ExternalResources.patchJQuery=function(e){var t=',"function"==typeof define&&define.amd&&define("jquery",[],function(){return m})',r=e.replace(t,"");if(r.length!=e.length-t.length)throw new Error("Replace didnt take effect");return r},ExternalResources.verifyJQuery=function(){return"1.11.1"===window.$.fn.jquery},ExternalResources.getKnockout=function(e){return ExternalResources.patchExternalOrFallback("//cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js",-1013341204,ExternalResources.patchKnockout,e+"knockout-3.3.0.js",ExternalResources.verifyKnockout)},ExternalResources.patchKnockout=function(e){var t='"function"===typeof define&&define.amd?define(["exports","require"],p):"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?p(module.exports||exports):p(y',r='p(window["FO"]',n=e.replace(t,r);if(n.length!=e.length-t.length+r.length)throw new Error("Replace didnt take effect");return n},ExternalResources.verifyKnockout=function(){return"3.3.0"==FO.ko.version},ExternalResources.patchExternalOrFallback=function(e,t,r,n,o){return void 0===o&&(o=function(){return!0}),ExternalResources.loadAndPatchExternal(e,t,r).then(function(){if(!o())throw new Error("External patch failed verification on "+e)}).alwaysThen(function(t,r){return r?(Shared.Logger.warn("Failed external patching on "+e+": "+r.message),ExternalResources.loadFallback(n).then(function(){if(!o())throw new Error("External fallback failed on "+n)})):Shared.resolve(null)})},ExternalResources.loadAndPatchExternal=function(externalUrl,verificationHash,patch){return Common.NativeJSHelper.nativeAjax(externalUrl).then(function(original){var originalHash=Common.stringHash(original);if(originalHash!=verificationHash)throw new Error("Original didnt match verification hash");var patched=patch(original);eval(patched)})},ExternalResources.loadFallback=function(e){return Common.NativeJSHelper.injectScriptRetryPromise(e,3)},ExternalResources}();Common.ExternalResources=ExternalResources}(Common=Shared.Common||(Shared.Common={}))}(Shared=FO.Shared_0_0_603||(FO.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.xhr=function(e,t,r){var n=new XMLHttpRequest;if(n.open("get",e),t)for(var o in t)n.setRequestHeader(o,t[o]);n.onreadystatechange=function(){4==n.readyState&&200==n.status&&r&&r(n.responseText)},n.send(null)},t.xhrPromise=function(r,n){return void 0===n&&(n=null),e.promiseFromCallback(function(e){return t.xhr(r,n,e)})},t.imgGetPromise=function(t){var r=document.body.appendChild(document.createElement("img"));return r.style.zIndex="-100",r.style.position="absolute",r.style.left="0",r.style.top="0",r.src=t,e.resolve("")},t.getBrowser=function(){var e,t=navigator.userAgent,r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(r[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],"MSIE "+(e[1]||"")):"Chrome"===r[1]&&(e=t.match(/\bOPR\/(\d+)/),null!=e)?"Opera "+e[1]:(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&r.splice(1,1,e[1]),r.join(" "))},t}();t.AjaxHelper=r;var n=function(){function e(e){this.name="MagicStore",this.endpoint=e}return e.prototype.store=function(e,t){var n=this.endpoint+"?key="+encodeURIComponent(e),o={"X-Data":t,"Cache-control":"no-cache"};return r.xhrPromise(n,o)},e.prototype.retrieve=function(e){var t=this.endpoint+"?key="+encodeURIComponent(e);return r.xhrPromise(t)},e.prototype.isStoreAvailable=function(){return 0==r.getBrowser().indexOf("Chrome")},e.prototype.isRetrieveAvailable=function(){return 0==r.getBrowser().indexOf("Chrome")},e}();t.MagicStore=n;var o=function(){function t(e,t){this.name="ServerCookieStore",this.endpoint=e,this.domain=t}return t.prototype.store=function(e,t){var n=this.endpoint+"/set/logo.png?key="+encodeURIComponent(e)+"&value="+encodeURIComponent(t)+"&t="+(new Date).getTime();return r.imgGetPromise(n)},t.prototype.retrieve=function(t){for(var r=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(r)){var a=i.substring(r.length,i.length);return e.resolve(decodeURIComponent(a))}}return e.resolve("")},t.prototype.isStoreAvailable=function(){return!0},t.prototype.isRetrieveAvailable=function(){return document.location.host.indexOf(this.domain)>=0},t}();t.ServerCookieStore=o;var i=function(){function t(e){void 0===e&&(e=".fastimagecdn.com"),this.testKey="testKey",this.testValue="TestValueForSomething",this.naValue="NA";var t=new n("//app"+e+"/distore/store"),r=new o("//app"+e+"/distore/cookie",e);this.stores=[t,r]}return t.prototype.setValue=function(t,r){var n=[];return this.stores.forEach(function(e){e.isStoreAvailable()&&n.push(e.store(t,r))}),e.typedWhen(n)},t.prototype.getMultiValue=function(t){var r=this,n={};return this.stores.forEach(function(o){n[o.name]=o.isRetrieveAvailable()?o.retrieve(t):e.resolve(r.naValue)}),e.namedWhen2(n,!0).then(function(e){return e})},t.prototype.testSet=function(e){var t=this;this.setValue(this.testKey,this.testValue).then(function(){e&&t.testGetInner("psset")})},t.prototype.testGet=function(){this.testGetInner("psget")},t.prototype.clkGet=function(){var r={},n="",o=this.getMultiValue(this.testKey).then(function(e){for(var t in e)r["test_"+t]=e[t]}),i=this.getMultiValue("psclk").then(function(e){for(var t in e)r["clk_"+t]=e[t],e[t]&&"NA"!=e[t]&&(n=e[t])});return e.when(o,i).done(function(){t.notifyGeneric("psget",r)}).fail(function(e){t.notifyGeneric("psgeterror",{error:e.message})}),i.then(function(){return n})},t.prototype.testGetInner=function(e){this.getMultiValue(this.testKey).then(function(r){t.notifyGeneric(e,r)})},t.notifyGeneric=function(t,r){void 0===r&&(r={});var n={t:(new Date).getTime().toString(),hn:document.location.host,subtype:t};for(var o in r)n[o]=r[o];e.Logger.Analytics.notifyGenericUrl("//app.fastimagecdn.com/a/generic/logo.png",n)},t}();t.Persistance=i}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(e){function t(t,r,n,o){e.call(this,t,t.countryCode(),t.userSettings(),t.suspender(),t.iframe(),t.fnWindow()),this.productName=r,this.logic=n,this.visual=o}return __extends(t,e),t.prototype.notificationParams=function(){var t=e.prototype.notificationParams.call(this);return t.pname=this.productName,t.pr=this.logic.flag(),t.w=this.visual.flag(),t},t}(e.ApplicationContext);e.ProductContext=t}(t=e.Context||(e.Context={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){!function(e){e[e.Small=0]="Small",e[e.Medium=1]="Medium",e[e.Large=2]="Large"}(r.RibbonSize||(r.RibbonSize={}));r.RibbonSize;!function(e){e[e.Large=300]="Large",e[e.Medium=189]="Medium",e[e.Small=99]="Small"}(r.ImageMinHeight||(r.ImageMinHeight={}));var n=(r.ImageMinHeight,function(){function n(){}return n.getProductImage=function(){var t=new e.NWPLegacy;return t.ImageUtils.getLargestImage()},n.getFirstEcommerceImage=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);var r=n.getAllEcommerceImages(e,t,!1);return r.length>0?r[0]:null},n.distanceFromViewPortCenter=function(t){var r=e.$(t),n={X:e.$(window).width()/2,Y:e.$(window).height()/2},o=r.offset();o.left+=r.width()/2,o.top+=r.height()/2;var i=n.X-o.left;i*=i;var a=n.Y-o.top;return a*=a,Math.sqrt(i+a)},n.getAllEcommerceImages=function(n,o,i){var a=t.Col.ofElements(document.images).where(function(t){var i=e.$(t);return n&&!i.is(":visible")?!1:o&&!r.VisualHelper.isElementInViewport(i,.9)?!1:i.hasClass("fo-offer-img")||!r.ImageUtils.isImageValid(i[0])?!1:!0});return i&&(a=a.stableSort(function(e,t){return t.height-e.height})),a.toArray()},n.findValidImagesBySize=function(n,o,i){var a=t.Col.ofElements(document.images).where(function(t){var n=e.$(t);return n.is(":visible")&&!n.hasClass("fo-offer-img")&&r.ImageUtils.isImageValid(n[0])?i?r.VisualHelper.isElementInViewport(n,.9):!0:!1});return a=a.stableSort(function(e,t){return t.height-e.height}),a.length()>0?(2==this.imageSizeToRibbonSize(a.getItem(0).height)&&(n=0),a.skip(n).take(o).toArray()):[]},n.imageSizeToRibbonSize=function(e){return e>=300?2:e>=189?1:0},n.getLargestImageText=function(){var t=new e.NWPLegacy,r=t.ImageUtils.getLargestImage(),o=r?t.utils.getImgText(r,5):null;return o&&(o=n.removeStopWords(o)),o},n.getImageText=function(r){var o=new e.NWPLegacy;try{var i=r?o.utils.getImgText(r,5):null;return i&&(i=n.removeStopWords(i)),i}catch(a){return t.Logger.error("Failure in getImageText: "+a.message),""}},n.isImageValid=function(e){return n.imageHasStandardEcommerceDimensions(e)&&n.isImageExtensionValid(e)&&!n.imageHasClickableAreas(e)},n.imageHasStandardEcommerceDimensions=function(e){var t=4200,r=.45,n=2.1,o=e.width,i=e.height;if(t>o*i)return!1;var a=o/i;return r>a||a>n?!1:!0},n.isImageExtensionValid=function(e){var t="";try{t=e.src.toLowerCase()}catch(r){return!1}var n=t.indexOf("?");if(-1!=n&&(t=t.substring(0,n)),t.length<4)return!1;var o=t.substring(t.length-4,t.length);return"."!=t.charAt(t.length-4)||".gif"!=o&&".png"!=o?!0:!1},n.imageHasClickableAreas=function(e){return e.getAttribute("usemap")?!0:!1},n.removeStopWords=function(e){for(var t=["by","-","of","for","in","a","the","at","is","with","to","this","and","usd","eur","br","product","details"],r=0;r<t.length;r++){var n="\\s+("+t[r]+")\\s+",o=new RegExp(n,"g");e=(" "+e+" ").replace(o," ")}return e=e.trim()},n}());r.ImageUtils=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.imageScrapeLogic=function(e,n){var o=t.ImageUtils.findValidImagesBySize(0,4,!1);return r.imageScrapeLogicWithSupporting(e,n,o)},r.imageScrapeLogicWithSupporting=function(r,n,o){var i=r.scraper(),a=["search","here","keyword","keywords","product","products","username","email","password","enter"],s=["q","Search","search","searchterm","searchTerm","search_query","query","Keywords","keywords","field-keywords","w","kw","origkw","SearchString","searchString","keys","text","Ntt","qu","Keyword","keyword","SearchTerms","searchTerms"],u=10,c=r.overrides().intValue("deal-scrape-weights.search",8),l=r.overrides().intValue("deal-scrape-weights.text",1),f=r.overrides().intValue("deal-scrape-weights.title",6),d=r.overrides().intValue("deal-scrape-weights.importantqs",20),p=r.overrides().intValue("deal-scrape-weights.otherqs",1),h=new t.WordCounter,m=t.ImageUtils.getImageText(n);if(m){var g=t.WordUtils.getNonTrivialWords(m);h.push(g,"Product Image",u);var v=t.WordUtils.getNonTrivialWords(document.title),y=e.StaticCol.intersect(g,v);if(h.push(y,"Product Image And Title Intersect",f),o){for(var b=0;b<o.length;b++)if(n!=o[b]){var C=t.ImageUtils.getImageText(o[b]);if(C){var w=t.WordUtils.getNonTrivialWords(C),S=e.StaticCol.intersect(g,w);h.push(S,"Extra image word intersection",u)}}var _=document.querySelectorAll("input[type='search']"),E=e.StaticCol.select(e.StaticCol.numValues(_),function(e){return e.value}).join(" "),O=t.WordUtils.getNonTrivialWords(E);if(0==e.StaticCol.intersect(O,a).length){var F=e.StaticCol.intersect(g,O);h.push(F,"Search inputs",c)}var k=document.querySelectorAll("input[type='text']"),x=e.StaticCol.select(e.StaticCol.numValues(k),function(e){return e.value}).join(" "),R=t.WordUtils.getNonTrivialWords(x);if(0==e.StaticCol.intersect(R,a).length){var A=e.StaticCol.intersect(g,R);h.push(A,"Text inputs",l)}var T=[],P=[];for(var D in i.queryParams())if(e.StaticCol.contains(s,D)){var I=i.queryParams()[D];T=T.concat(I.replace(/\+/g," ").trim().split(" "))}else{var I=i.queryParams()[D];P=P.concat(I.replace(/\+/g," ").trim().split(" "))}var B=e.StaticCol.intersect(g,T);h.push(B,"Recognized query string",d);var M=e.StaticCol.intersect(g,P);h.push(M,"Unknown query string",p)}var L=r.overrides().boolValue("deals-logic.filter-empty-words",!0),N=e.StaticCol.where(h.getWords(),function(e){return L?!e.match(/^[\s]*$/):!e.match(/^[\W_]*$/)}),H=t.WordUtils.countWords(N);return H}return e.Map.emptyMap()},r.entirePageScrape=function(r,n,o){var i=["search","here","keyword","keywords","product","products","username","email","password","enter"],a=["q","Search","search","searchterm","searchTerm","search_query","query","Keywords","keywords","field-keywords","w","kw","origkw","SearchString","searchString","keys","text","Ntt","qu","Keyword","keyword","SearchTerms","searchTerms","_nkw"],s=r.overrides().intValue("deal-scrape-weights-amplify.ribbon",10),u=r.overrides().intValue("deal-scrape-weights-amplify.search",8),c=r.overrides().intValue("deal-scrape-weights-amplify.importantqs",20),l=r.overrides().intValue("deal-scrape-weights-amplify.text",1),f=r.overrides().intValue("deal-scrape-weights-amplify.h1",6),d=r.overrides().intValue("deal-scrape-weights-amplify.title",6),p=r.overrides().intValue("deal-scrape-weights-amplify.otherqs",1),h=r.overrides().intValue("deal-scrape-weights-amplify.dedicated",6),m=r.scraper(),g=new t.WordCounter,v=[],y=t.ImageUtils.getImageText(n);y&&(v=t.WordUtils.getNonTrivialWords(y));var b=document.querySelectorAll("input[type='search']"),C=e.StaticCol.select(e.StaticCol.numValues(b),function(e){return e.value}).join(" "),w=t.WordUtils.getNonTrivialWords(C),S=e.StaticCol.intersect(w,i).length?[]:w,_=[],E=[];for(var O in m.queryParams()){var F=m.queryParams()[O].split(/[+| ]/);if(e.StaticCol.contains(a,O))for(var k=0;k<F.length;k++)_.push(F[k]);else for(var k=0;k<F.length;k++)E.push(F[k])}var x=[];o&&(x=o.wordCounts.selectMany(function(t){return e.StaticCol.repeatString(t.key,t.value)}).toArray());var R=m.getFirstMatchText(["h1"]),A=t.WordUtils.getNonTrivialWords(R),T=t.WordUtils.getNonTrivialWords(document.title),P=document.querySelectorAll("input[type='text']"),D=e.StaticCol.select(e.StaticCol.numValues(P),function(e){return e.value}).join(" "),I=t.WordUtils.getNonTrivialWords(D),B=e.StaticCol.intersect(I,i).length?[]:I,M=[];M.push({keywords:v,weight:s,source:"Product Image"}),M.push({keywords:T,weight:d,source:"Title"}),M.push({keywords:A,weight:f,source:"H1"}),M.push({keywords:E,weight:p,source:"unknown query string"}),M.push({keywords:x,weight:h,source:"Dedicated keywords"}),M.push({keywords:_,weight:c,source:"Recognized query string"}),M.push({keywords:B,weight:l,source:"Text inputs"}),M.push({keywords:S,weight:u,source:"Search inputs"});var L=new e.Col(M),N=L.orderByDesc(function(e){
return e.weight}).toArray();e.StaticCol.each(N,function(e){g.pushAndAmplify(e.keywords,e.source,e.weight)}),e.Logger.log(g.describe());var H=e.StaticCol.where(g.getWords(),function(e){return!e.match(/^[\s]*$/)}),W=t.WordUtils.countWords(H);return W},r}();t.ScrapingLogics=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){this.words=[]}return r.prototype.push=function(e,t,r){void 0===r&&(r=1);for(var n=0;n<e.length;n++)this.words.push({word:e[n],origin:t,count:r})},r.prototype.contains=function(e){for(var t=0;t<this.words.length;t++)if(this.words[t].word==e)return!0;return!1},r.prototype.pushAndAmplify=function(t,r,n){var o=this;void 0===n&&(n=1),e.Col.of(t).each(function(e){var t=n>0||o.contains(e);t&&o.words.push({word:e,origin:r,count:Math.abs(n)})})},r.prototype.getWords=function(){e.Logger.log(this.describe());for(var t=[],r=0;r<this.words.length;r++)for(var n=this.words[r],o=0;o<n.count;o++)t.push(n.word);return t},r.prototype.getWordMap=function(){return e.Col.of(this.words).groupBy(function(e){return e.word}).toMap(function(e){return e.key},function(t){return e.Col.of(t.value).sum(function(e){return e.count})})},r.prototype.describe=function(){var r="Words: ";return e.Col.of(this.words).groupBy(function(e){return e.word+"|"+e.origin}).select(function(t){return[t.value[0].word,t.value[0].origin,e.Col.of(t.value).sum(function(e){return e.count})]}).orderByDesc(function(e){return Number(e[2])}).each(function(e){return r+=t.stringFormat("\n{0} ({1} x {2})",e[0],e[1],e[2])}),r},r}();t.WordCounter=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(){}return r.breakdownHost=function(){for(var e=document.location.host,t="weird_get_top_level_domain=cookie",r=e.split("."),n=r.length-1;n>=0;n--){var o=r.slice(n).join(".");if(document.cookie=t+";domain=."+o+";",document.cookie.indexOf(t)>-1){document.cookie=t.split("=")[0]+"=;domain=."+o+";expires=Thu, 01 Jan 1970 00:00:01 GMT;";var i=r.slice(0,n).join("."),a=r[n],s=r.slice(n+1).join(".");document.location.protocol+"//";return[i+"."+a+"."+s,a+"."+s,a]}}return[e]},r.blackWhiteMatch=function(e,n,o,i){var a={};return null!=n&&(a.white=t.jqGetPromise(n)),null!=o&&(a.black=t.jqGetPromise(o)),t.namedWhen2(a).then(function(n){for(var o=("white"in n?r.parseBloomFromResponse(n.white):null),a=("black"in n?r.parseBloomFromResponse(n.black):null),s=t.resolve({match:null,score:0}),u=0;u<e.length;u++){var c=e[u].toLowerCase(),l=r.createTestMatchClosure(o,a,i,c);s=s.then(l)}return s.logPassthrough("bw result")})},r.blackWhiteWeakMatch=function(e,n){return t.jqGetPromise(n).then(function(n){for(var o=0,i=[],a=r.parseBloomFromResponse(n),s=0;s<e.length;s++){var u=e[s].toLowerCase(),c=a&&a.test(u);c&&(i.push(u),o++)}return t.resolve({match:i,score:o})})},r.parseBloomFromResponse=function(t){var r=t.match(/\[.*\]/)[0],n=JSON3.parse(r);return new e.BloomFilter(n,10)},r.createTestMatchClosure=function(e,n,o,i){return function(a){return 0==a.score?r.testMatch(e,n,o,i):t.resolve(a)}},r.testMatch=function(e,r,n,o){var i=e&&e.test(o),a=r&&r.test(o);if(n&&(i||a)){var s=n+encodeURIComponent(o);return t.jqGetPromise(s).then(function(e){var r=JSON3.parse(e),n="found"in r?r.found?2:-1:0;return n&&t.Logger.log("WBL for "+o+": "+n),{match:o,score:n}})}return i?t.resolve({match:o,score:1}):a?t.resolve({match:o,score:-1}):t.resolve({match:o,score:0})},r}();r.BlackWhiteListHelper=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.getLanguagesForCountry=function(r,n){void 0===n&&(n="en");var o=t.countryLanguages[r];return e.StaticCol.contains(o,n)||o.push(n),o},t.getStringMapForCountry=function(r,n,o){void 0===o&&(o="en");var i=t.getLanguagesForCountry(r,o),a=e.StaticCol.toHashmap(n,function(e){return e.key});return e.StaticCol.hashSelect(a,function(t){return e.Col.of(i).selectFirst(function(e){return t[e]},function(e){return e&&e.length>0})})},t.countryLanguages={AF:["ps","uz","tk"],AX:["sv"],AL:["sq"],DZ:["ar"],AS:["en","sm"],AD:["ca"],AO:["pt"],AI:["en"],AQ:[],AG:["en"],AR:["es","gn"],AM:["hy","ru"],AW:["nl","pa"],AU:["en"],AT:["de"],AZ:["az","hy"],BS:["en"],BH:["ar"],BD:["bn"],BB:["en"],BY:["be","ru"],BE:["nl","fr","de"],BZ:["en","es"],BJ:["fr"],BM:["en"],BT:["dz"],BO:["es","ay","qu"],BQ:["nl"],BA:["bs","hr","sr"],BW:["en","tn"],BV:[],BR:["pt"],IO:["en"],VG:["en"],BN:["ms"],BG:["bg"],BF:["fr","ff"],BI:["fr","rn"],KH:["km"],CM:["en","fr"],CA:["en","fr"],CV:["pt"],KY:["en"],CF:["fr","sg"],TD:["fr","ar"],CL:["es"],CN:["zh"],CX:["en"],CC:["en"],CO:["es"],KM:["ar","fr"],CG:["fr","ln"],CD:["fr","ln","kg","sw","lu"],CK:["en"],CR:["es"],HR:["hr"],CU:["es"],CW:["nl","pa","en"],CY:["el","tr","hy"],CZ:["cs","sk"],DK:["da"],DJ:["fr","ar"],DM:["en"],DO:["es"],EC:["es"],EG:["ar"],SV:["es"],GQ:["es","fr"],ER:["ti","ar","en"],EE:["et"],ET:["am"],FK:["en"],FO:["fo"],FJ:["en","fj","hi","ur"],FI:["fi","sv"],FR:["fr"],GF:["fr"],PF:["fr"],TF:["fr"],GA:["fr"],GM:["en"],GE:["ka"],DE:["de"],GH:["en"],GI:["en"],GR:["el"],GL:["kl"],GD:["en"],GP:["fr"],GU:["en","ch","es"],GT:["es"],GG:["en","fr"],GN:["fr","ff"],GW:["pt"],GY:["en"],HT:["fr","ht"],HM:["en"],VA:["it","la"],HN:["es"],HK:["zh","en"],HU:["hu"],IS:["is"],IN:["hi","en"],ID:["id"],CI:["fr"],IR:["fa"],IQ:["ar","ku"],IE:["ga","en"],IM:["en","gv"],IL:["en","he","ar"],IT:["it"],JM:["en"],JP:["ja"],JE:["en","fr"],JO:["ar"],KZ:["kk","ru"],KE:["en","sw"],KI:["en"],KW:["ar"],KG:["ky","ru"],LA:["lo"],LV:["lv"],LB:["ar","fr"],LS:["en","st"],LR:["en"],LY:["ar"],LI:["de"],LT:["lt"],LU:["fr","de","lb"],MO:["zh","pt"],MK:["mk"],MG:["fr","mg"],MW:["en","ny"],MY:[],MV:["dv"],ML:["fr"],MT:["mt","en"],MH:["en","mh"],MQ:["fr"],MR:["ar"],MU:["en"],YT:["fr"],MX:["es"],FM:["en"],MD:["ro"],MC:["fr"],MN:["mn"],ME:["sr","bs","sq","hr"],MS:["en"],MA:["ar"],MZ:["pt"],MM:["my"],NA:["en","af"],NR:["en","na"],NP:["ne"],NL:["nl"],NC:["fr"],NZ:["en","mi"],NI:["es"],NE:["fr"],NG:["en"],NU:["en"],NF:["en"],KP:["ko"],MP:["en","ch"],NO:["no","nb","nn"],OM:["ar"],PK:["en","ur"],PW:["en"],PS:["ar"],PA:["es"],PG:["en"],PY:["es","gn"],PE:["es"],PH:["en"],PN:["en"],PL:["pl"],PT:["pt"],PR:["es","en"],QA:["ar"],XK:["sq","sr"],RE:["fr"],RO:["ro"],RU:["ru"],RW:["rw","en","fr"],BL:["fr"],SH:["en"],KN:["en"],LC:["en"],MF:["fr"],PM:["fr"],VC:["en"],WS:["sm","en"],SM:["it"],ST:["pt"],SA:["ar"],SN:["fr"],RS:["sr"],SC:["fr","en"],SL:["en"],SG:["en","ms","ta","zh"],SX:["nl","en","fr"],SK:["sk"],SI:["sl"],SB:["en"],SO:["so","ar"],ZA:["af","en","nr","st","ss","tn","ts","ve","xh","zu"],GS:["en"],KR:["ko"],SS:["en"],ES:["es","eu","ca","gl","oc"],LK:["si","ta"],SD:["ar","en"],SR:["nl"],SJ:["no"],SZ:["en","ss"],SE:["sv"],CH:["de","fr","it"],SY:["ar"],TW:["zh"],TJ:["tg","ru"],TZ:["sw","en"],TH:["th"],TL:["pt"],TG:["fr"],TK:["en"],TO:["en","to"],TT:["en"],TN:["ar"],TR:["tr"],TM:["tk","ru"],TC:["en"],TV:["en"],UG:["en","sw"],UA:["uk"],AE:["ar"],GB:["en"],US:["en"],UM:["en"],VI:["en"],UY:["es"],UZ:["uz","ru"],VU:["bi","en","fr"],VE:["es"],VN:["vi"],WF:["fr"],EH:["es"],YE:["ar"],ZM:["en"],ZW:["en","sn","nd"]},t}();t.LocaleHelper=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){!function(e){e[e.None=0]="None",e[e.Commerce=1]="Commerce",e[e.Travel=2]="Travel"}(e.VerticalType||(e.VerticalType={}));e.VerticalType}(t=e.Vertical||(e.Vertical={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.LanguageCommercePhrases={da:["kurven|returnering|kategorier|butik|mine produkter|bedste pris|køb|kurv|tilbud|indkøbskurv|købsguide til"],de:["alle marken|stöbern in kategorien|wunschliste|heißesten angebote|deinwarenkorb|geschenkefinder|beliebte produkte|kaufberatung|preisvergleich|einkaufswagen|warenkorb|auf lager|versandkosten|wunsch zettel|gratisversand|gratis rücksendung|sofort(-s)kaufen","einkauf(en|sliste|s-wagen|s-tasche)|express-(zustellung|lieferung)|(meine|kostenfreie|standard) lieferung|24-stunden-lieferung|speditionslieferung|lieferstatus|lieferzeit|versand|mwst|bestellen|bestellung|wunschzettel|merkzettel|gutschein|geschenkkarte|widerruf|zur kasse gehen","warenkorb|einkaufswagen|einkaufstasche|meine einkaufstasche|kostenlosem versand|gratis versand|bestseller|bestsellers|bestellung|in den einkaufswagen|in den warenkorb|in die einkaufstasche|zur einkaufstasche|eröffnen|kaufen|ankauf|angebote|gutscheine|verkaufen|einkaufswagen|einkaufstasche gelegt|wunschzettel|merkzettel|wunschliste|lieferung|lieferung verfolgen|bestellung anzeigen|geschenkverpackung|zur kasse gehen|zur kasse|rückversand|versandkosten|rücksendung|online kaufen|geschenk-gutscheine|geschenk|gutscheine|artikel merken|auf die wunschliste|weitershoppen|weiter einkaufen|rabatte|produktinformationen|versandkosten|sichere zahlung"],en:["(add\\s?(item)?\\s?to\\s?(my)?\\s?(shopping|digital)?\\s?(cart\b|bag\b|basket|order))","(my|your|view|show) (\bcart\b|shopping) (\bcart\b|\btrolley\b|\bbag\b|\bbasket\b|categories)","view all brands|shop by (brand|department(s)?|categor(y|ies))","(shop|buy) now|in stock","shipping (time|info|cost(s)?|charges|policy|options)","(free|no anxiety) shipping|(refund|return) policy","(my|your) order(s)?","order(s)? status|(shopping|buying) guide|(fast|ontime) delivery","store locat(ion(s)?|or)","(continue|start|safe|secure|no minimum) shopping","gift voucher|bulk orders|cash purchase|cash on delivery|replacement (guarantee|options)|money back guaranty|my shopping alert","wish list"],es:["mis pedidos|compra online|cesta de la compra|lista dedeseos|tarifas y políticas de envoi|envío libre|mi compra(s)?|iniciar compra(s)?|cambio gratis|gastos de envio|gastos de envoi|ideas para regalar|ofertas destacadas|panier|envío gratis|tu bolsa|bolsa de compras|plazos de entrega|a carrito|(mi|al) carrito|listas de regalos|comprar ya en 1-clic|(tu|mi|ir|la|a) cesta|ver carrito|lista de (favoritos|deseos|productos)|mi boisa|cheques regalo|seguir mi pedido|entrega gratuita|entrega y devoluciones"],fr:["panier|(mon|votre) sac|liste d'envies|livraison (gratuite|offerte)|livraison à domicile sur rendez-vous|je retourne par la poste|disponible sous|(retours ou é|reprise ou a)change gratuit|expédition (gratuite|libre)|la livraison gratuite|les délais de livraison|carte cadeau|bons de reduction|commandez maintenant|acheter moins cher|en soldes|joutez au comparateur","(continue|continuerz) (vos|mes) (achats|continuer) le shopping","livraison gratuits|meilleures ventes|ordres|ordre|acheter maintenant|ajouter au panier|boutique|acheter|achat|bons de réduction|vendez|liste d'enies|livraison|la livraison de la piste|emballage cadeau|passer la commande|expédition de retour|acheter en ligne|chèques-cadeaux|cadeau|ajoutez à votre liste d'envies|continuer mes achats|réductions|détails sur le produit|frais de livraison|paiement sécurisé|guide des tailles|le produit|en stock|top marques"],it:["idee regalo|lista (desideri|dei desideri)|consegna gratuita|spedizione e reso gratuity|offerte del giorno|vai al negozio|prenota ora|spedizioni|spese di (consegna|spedizione|trasporto)|spedizione gratuita|servizio  di spedizione|modalità di spedizione|pagamento per contrassegno|\bacquista\b|articoli selezionati|\bordina\b|continua shopping|stato ordini|storico ordini|buono acquisto|diritto di recesso|carrello|pagamenti rateali|buoni (sconto|regalo)"],jp:["お気に入り|カート|買い物かご|送料無料|カート|ほしい物リスト|配送料|ショッピングを|ショッピング|お買い物"],no:["mine lister|sammenlign (priser|produkter)|nettbutik(ker|ke)?|til(bud| kassen)|handle(lister|vognen|kurven|vogn)|kjøp|på lager|ønskeliste(r)?|priskrigen|salg|gavekort|butikk(er)?"],pl:["koszyk|upominki|do koszyka|złóż zamówienie|listy zakupowe|okazje|lista życzeń|karty podarunkowe|darmowa dostawa","oferty|marka|wysyłka gratis|dodaj do koszyka|kup teraz|koszty dostawy|twój koszyk jest pusty|kategorie|sklepy|bezpieczne zakupy|informacje o produkcie|mój koszyk|płatności|delivery method|delivery"],pt:["minha cesta|como comprar|frete grátis|ofertas exclusivas para você|entrega a domicilio gratis|para cambio gratis|formas de pago|carrinho|bolsa|nossas lojas|meu caminhãovazio|caixa expressotodo shopping|Lista de Desejos|Ofertas e Descontos|Ver todos os Departamentos|Política de compra|Lista de Casamento|[ms]eus pedidos|comprar (este|produto|agora|com garantia)|Quem viu este produto acabou comprandosua entrega|acompanhe seus pedidos|trocas|lista de presentes|super descontos|envio imediato|em estoque|meu caminho|minha sacola|seu cadastro|meu cadastro"],ru:["(моя )?(моя )?(моя )?корзина|новинка, подробнее|(добавить )?в корзину|быстрая доставка|правила возврата|гарантия возврата|купить сейчас|возврат товара|доставка и оплата|в корзину|возврат и обмен|стоимость доставки|доставка товара|срок поставки|бесплатной доставкой|где мой заказ?|(способы|условия) доставки|доставке и оплате|информация о доставке|доставка (в любой регион бесплатно|и возврат)|add to the bag|возврат в течение 14 дней|обмен и возврат|ваша покупка|\nлучшие цены|все товары|скидки дня|акции и скидки|скидки и акции|распродажа|доставка и оплата|подарочные сертификаты|как сделать заказ|интернет-магазин|подарочные карты|онлайн торговый|онлайн торговый|\nдоставка и оплата товаров|бесплатная доставка|как купить|как заказать|как оплатить"],sv:["erbjudanden|dagens deal|varukorg|fraktfria|frakt|orderstatus|så här handlar du|presentkort|skickar vanligtvis beställda varor inom 24 timmar|butiker|kundvagnen|returinformation|leveransinformation|fraktinformation|shop by brand|köp|i lager|jämför priser|direkt från lagerhyllan|kundvagn|varukorgen|kassan|prissänkta produkter"],tr:["mağazaya|mağaza|sepetim|kargo bedava ürünler|cok satanlar|sipariş takibi|sipariş|güvenli alışveriş|hemen al|sepete ekle|günün fırsatı ürünleri|popüler ürünler|kargo süresi|hemen al|mağazalar|alışveriş|ürün|markalar|kampanyalar|yeni ürünler|ödeme seçenekleri|güvenli alışveriş|ücretsiz kargo|beden tablosu|değişim bilgileri|iade bilgileri"]},e.LanguageDisqualifyingPhrases={de:["(lesbisch|oralsex|blowjob|sex|pornstars|porno)","(online-banking|banking)","(hotelname|hotel|flüge|flügen)","(casino|video slots)"],en:["(anal|blowjob|lesbian|sex|porn)","(bank|banks|banking)","(hotel|hotels|accommodation|flights)","(casino|horse racing|slot machine|roulette)"],es:["(lésbianas|sex|porno)","(banco|banking|banca)","(hoteles|hotel|vuelos)","(casino|las tragamonedas|video tragamonedas)"],fr:["(lesbienne|ménage à trois|sex|porno)","(banque|banking|bank|compte bancaire)","(hôtels|hôtel|hotel|un vol)","(casino|machines à sous|video slots)"],it:["(lesbiche|sex|porno)","(bancario|banca|banche|bancari)","(hotel|alberghi|alberghiere|voli|volo)","(casinò|casino|video slots)"],pl:["(lesbijki|sex|porno)","(bank|bankowość|banku|bancari)","(hotel|hotele|loty)","(casino|roulette|video slots)"],pt:["(lésbicas|sex|porno)","(crédito e financiamentos|banco|créditos e financiamentos|conta corrente)","(hotel|hotéis|pousadas|voos)","(cassino|casino|roleta|caça níqueis|video slots)"],ru:["(Лесбиянки|Порно)","(Банк|Банковское дело|банке|bank)","(hotel|alberghiere|voli|volo)","(casino|КАЗИНО|Казино|рулетку|casino|video slots)"]},e}();e.CommerceDictionary=t}(t=e.Vertical||(e.Vertical={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(){}return n.classifyBySpecialCasesAndJunk=function(e){return 0==document.location.pathname.indexOf("/shop")?t.resolve(1):e.host().toLowerCase().match(this.blackRegex)?(t.Logger.log("Host matched black REGEX - Classifying as non-commerce"),t.resolve(-1)):t.resolve(0)},n.classifyBySchemaOrg=function(r){var n=e.$("[itemtype='http://schema.org/Offer']").length>0||e.$("[itemtype='http://schema.org/Offer/']").length>0,o=e.$("[itemtype='http://schema.org/Product']").length>0||e.$("[itemtype='http://schema.org/Product/']").length>0;return n||o?t.resolve(1):t.resolve(0)},n.classifyByBlackWhiteList=function(e){var r=e.paths().blackWhiteListRoot()+"/search/",n=t.Common.BlackWhiteListHelper.breakdownHost();return t.Common.BlackWhiteListHelper.blackWhiteMatch(n,e.paths().dynamicContentRoot()+"/bwl/wl",e.paths().dynamicContentRoot()+"/bwl/bl",r).then(function(e){return e.score})},n.classifyByDictionaries=function(e){for(var n=t.Common.LocaleHelper.getLanguagesForCountry(e.countryCode()),o=0,i=0;i<n.length;i++){var a=n[i],s=e.overrides().boolValue("use.disqualifying.phrases",!1);if(s&&a in r.CommerceDictionary.LanguageDisqualifyingPhrases){var u=r.CommerceDictionary.LanguageDisqualifyingPhrases[a];if(u&&u.length>0){var c=e.scraper().testPatternsAgainstHTML(u);if(c)return t.Logger.log("Page contains disqualifying phrases for language ["+a+"]. Failing classification by dictionaries"),t.resolve(-1)}}if(a in r.CommerceDictionary.LanguageCommercePhrases){var u=r.CommerceDictionary.LanguageCommercePhrases[a];if(u&&u.length>0){var c=e.scraper().testPatternsAgainstHTML(u);t.Logger.log("Language score for "+a+": "+c),c>o&&(o=c)}}}return t.Logger.log("Commerce vertical lang result: "+o),t.resolve(o)},n.classifyByProductImage=function(e){var r,n=0,o=e.overrides().boolValue("classify-use-new-get-img-algo",!1);if(o){r=t.Common.ImageUtils.getFirstEcommerceImage(!0,!1);var i=new t.ProductBoxes.ScraperBase,a=i.findPriceElements(document.body),s=a&&a.length>0;n=r&&s?1:0,t.Logger.log("Product image (ribbon logic): "+n+". Image found: "+!!r+" Price found: "+s)}else r=t.Common.ImageUtils.getProductImage(),n=r?1:0,t.Logger.log("Product image (ribbon logic): "+n);return t.resolve(n)},n.blackRegex=/tube|lazada|shopzilla.|beso.|kelkoo.|orange.|gameforge|infojobs|(allmyvideos|laposte|megafilmeshd|vidspot).net|gov.br|wikipedia.org|(pricegrabber|stackoverflow|hulu|bloomberg|blogger|dartybox|alexa|baidu|cj|cnn|facebook|flickr|history|hotmail|imdb|imvu|linkedin|microsoft|msn|myspace|netflix|nytimes|politico|picasa|pinterest|delta-search|sfgate|shutterfly|techcrunch|verizon|venturebeat|wired|yankodesign|youtube|bing|vk|live|tumblr|roblox|411answers|tagged|nickjr|opposingviews|truste|adobe|breakfastdailynews|.avg|espn.go|.aol|pogo|pornhub|youporn|pron|youjizz|xnxx|marca|elpais|juegos|surveysresearchgroup|dofus|adopteunmec|unique|nationzoom|sncf|privee|awesomehp|updateflashplayer|stocktradingcenters|empowernetwork|regionalhealthreview|websurveycentral|\.att|news788|411source|hsselite|verizonwireless|internetautoguide|symantec|\.pch|nortonpro|pchealthboost|voipo|contenko|seaworldparks|ratezip|game321|boostmobile|globo|yepi|jogatina|4shared|ojogos|tudogostoso|netcartas|voeazul|cartoonnetwork|\.tam|viajanet|vagalume|jogosdemeninas|^as|\.as|atrapalo|elconfidencial|lavanguardia|forocoches|peliculasyonkis|logitravel|freakshare|elperiodico|iberia|filmaffinity|chaturbate|expansion|todotest|antena3|cincodias).com|(elmundo|rtve|lavozdegalicia|publico|eldiariomontanes|elcomercio|\.hoy|\.abc|telepizza|europapress).es|paypal|filmesonlinegratis|google|.gov|.edu|qvo6|cam4|surveyservers|games.la|jeu.info/i,n}();r.CommerceHelper=n}(r=t.Vertical||(t.Vertical={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(t){var r=function(){function t(e,t,r){this.minHoverMS=e,this.maxHoverMS=t,this.onHoverDone=r}return t.prototype.hoverStart=function(e,t,r){null==e.hoverStartTime&&(e.hoverStartTime=(new Date).getTime())},t.prototype.hoverEnd=function(t,r,n){if(!(e.$(n.toElement).closest(n.currentTarget).length>0)){if(null!=t.hoverStartTime){var o=(new Date).getTime()-t.hoverStartTime;o>t.minHoverMS&&o<t.maxHoverMS&&t.onHoverDone(o)}t.hoverStartTime=null}},t}();t.HoverTarget=r}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(e){function r(r,n){e.call(this),this.offers=[];var i=t.StaticCol.select(n,function(e){return new o(r,e)});this.offers=i,this.context=r}return __extends(r,e),r}(r.ModelBase);r.GenericOffersModel=n;var o=function(n){function o(e,o){var i=this;n.call(this),this.offer=null,this.url=null,this.clickNotified=!1,this.hoverTarget=new r.HoverTarget(4e3,6e4,function(e){return t.Logger.Analytics.notify(i.context,t.Logger.Analytics.HOVER,{time:e+""})}),this.context=e,this.offer=o,this.url=o.url}return __extends(o,n),o.prototype.windowOpen=function(t,r){var n=e.$('<iframe width="0" height="0" style="display: none"></iframe>')[0];document.body.appendChild(n);var o=n.contentWindow.open.apply(window,[t,r]);return document.body.removeChild(n),o},o.prototype.hoverStart=function(e,t){this.hoverTarget.hoverStart(this.hoverTarget,e,t)},o.prototype.hoverEnd=function(e,t){this.hoverTarget.hoverEnd(this.hoverTarget,e,t)},o}(r.ModelBase);r.GenericOfferModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(t){function r(r,o){t.call(this),this.offers=[];var i=e.StaticCol.select(o,function(e){return new n(r,e)});this.offers=i,this.context=r}return __extends(r,t),r}(t.ModelBase);t.DealsModel=r;var n=function(t){function r(e,r){t.call(this,e,r),this.offer=r}return __extends(r,t),r.prototype.onClick=function(t,r){r&&r.preventDefault();var n;if(n=window.FO_OPENONCURRENTPAGE&&this.context.overrides().boolValue("open-on-current-window",!1)?t.windowOpen(t.offer.url,"_top"):t.windowOpen(t.offer.url,"_blank"),!t.clickNotified){t.clickNotified=!0;var o={};if(o.p=t.offer.part,o.kwds=t.offer.keywords,t.offer.url.indexOf("af_placement_id=")>-1)try{var i=t.offer.url;o.plid=i.match(/af_placement_id=([^&]+)/)[1]}catch(a){e.Logger.info("Bad parse of placmentID"),o.plid="0"}t.offer.title&&(o.title=t.offer.title.substring(0,40)),t.offer.price&&(o.prc=t.offer.price),t.offer.begrp&&(o.begrp=t.offer.begrp),e.Logger.Analytics.notify(t.context,e.Logger.Analytics.CLICK,o),t.offer.onClick&&t.offer.onClick()}},r}(t.GenericOfferModel);t.DealModel=n}(t=e.Model||(e.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(e){function r(r,n,i){e.call(this,r,n),this.displayWindowOffers=[],this.offers=t.StaticCol.select(n,function(e){return new o(r,e)}),this.displayWindowOffers=t.StaticCol.select(i,function(e){return new o(r,e)}),this.context=r}return __extends(r,e),r}(r.GenericOffersModel);r.RibbonOffersModel=n;var o=function(t){function r(r,n){t.call(this,r,n),this.zoomVisible=e.ko.observable(!1)}return __extends(r,t),r.prototype.hideZoom=function(e,t){t.stopPropagation(),e.zoomVisible(!1)},r.prototype.zoomIntoOffer=function(e,r){r.stopPropagation(),t.prototype.hoverStart.call(this,e,r),e.zoomVisible(!0)},r.prototype.zoomOutOfOffer=function(e,r){r.stopPropagation(),t.prototype.hoverEnd.call(this,e,r),e.zoomVisible(!1)},r}(r.DealModel);r.RibbonOfferModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){e.sliderStrings=[{key:"deals_header",en:"Related Products",tr:"Diğer Fırsatlara",fr:"Super offres",de:"Top-Schnäppchen",it:"Offerte speciali",es:"Grandes ofertas",ru:"супер предложения",pt:"Ofertas Incríveis",pl:"Gorące oferty",ja:"お買い得",nl:"Populaire deals",sv:"Heta erbjudanden",da:"Fantastiske tilbud",he:"דילים חמים",ar:"عروض رائعة"},{key:"coupons_header",en:"Best Coupons",tr:"En İyi Kuponlar",fr:"Meilleurs coupons",de:"Beste Gutscheine",it:"Coupon migliori",es:"Mejores cupones",ru:"Лучшие купоны",pt:"Melhores Cupons",pl:"Najlepsze kupony",ja:"最得クーポン",nl:"Beste coupons",sv:"Bästa kuponger",da:"Bedste kuponer",he:"קופונים",ar:"أفضل الكوبونات"},{key:"campaigns_header",en:"Special Offers",tr:"Special Offers",fr:"Special Offers",de:"Special Offers",it:"Special Offers",es:"Special Offers",ru:"Special Offers",pt:"Special Offers",pl:"Special Offers",ja:"Special Offers",nl:"Special Offers",sv:"Special Offers",da:"Special Offers",he:"Special Offers",ar:"Special Offers"},{key:"coupons_tab",en:"Coupons",tr:"Kuponlar",fr:"Coupons",de:"Gutscheine",it:"Coupon",es:"Cupones",ru:"купоны",pt:"Cupons",pl:"Kupony",ja:"クーポン",nl:"Coupons",sv:"Kuponger",da:"Kuponer",he:"קופונים",ar:"الكوبونات"},{key:"campaigns_tab",en:"Offers",tr:"Teklifler",fr:"Offers",de:"Offers",it:"Offers",es:"Offers",ru:"Offers",pt:"Offers",pl:"Offers",ja:"Offers",nl:"Offers",sv:"Offers",da:"Offers",he:"Offers",ar:"Offers"},{key:"deals_tab",en:"Deals",tr:"Fırsatlar",fr:"Offres",de:"Angebote",it:"Offerte",es:"Ofertas",ru:"сделка",pt:"Ofertas",pl:"Oferty",ja:"割引",nl:"Deals",sv:"erbjudanden",da:"Tilbud",he:"דילים",ar:"العروض"},{key:"deals_header2",en:"Best Value",tr:"En İyi Fırsatlar",fr:"Meilleur offre",de:"Beste",it:"Offerta migliore",es:"Mejor oferta",ru:"лучший",pt:"Melhor oferta",pl:"Najlepsze oferty",ja:"最大割引",nl:"Beste deal",sv:"Bästa erbjudanden",da:"Bedste tilbud",he:"דיל טוב",ar:"أفضل صفقة"},{key:"free_shipping",en:"Free Shipping",tr:"Ücretsiz Kargo",fr:"Port gratuit",de:"Gratisversand",it:"Spedizione gratuita",es:"Envío gratis",ru:"Бесплатная доставка",pt:"Frete grátis",pl:"Darmowa dostawa",ja:"送料無料",nl:"Gratis verzending",sv:"Gratis frakt",da:"Gratis forsendelse",he:"משלוח חינם",ar:"شحن مجاني"},{key:"click_here",en:"Click Here",tr:"Buraya Tıklayın",fr:"Cliquez ici",de:"Hier klicken",it:"Clicca qui",es:"Haz clic aquí",ru:"Нажать сюда",pt:"Clique aqui",pl:"Kliknij tutaj",ja:"ここをクリック",nl:"Klik hier",sv:"Klicka här",da:"Klike her",he:"לחץ כאן",ar:"انقر هنا"},{key:"get_code",en:"Get Code",tr:"Kodu Al",fr:"Recevoir le code",de:"Code erhalten",it:"Ricevi codice",es:"Obtener código",ru:"Получить код",pt:"Obter código",pl:"Otrzymaj kod",ja:"コードを入手",nl:"Krijg code",sv:"Hämta kod",da:"Hent kode",he:"חשוף קוד",ar:"احصل على كود"},{key:"see_more",en:"See more",tr:"Daha fazla",fr:"Voir plus",de:"Mehr erfahren",it:"Vedi altro",es:"Ver más",ru:"См. подробнее",pt:"Ver mais",pl:"Zobacz więcej",ja:"もっと見る",nl:"Meer info",sv:"Visa mer",da:"Se mere",he:"ראה עוד",ar:"رؤية المزيد"},{key:"more_deals",en:"Compare Prices",tr:"Diğer Fırsatlara Git",fr:"Recevoir plus d'offres",de:"Mehr Schnäppchen erhalten",it:"Ricevi altre offerte",es:"Obtener más ofertas",ru:"Получить больше акций",pt:"Receba mais ofertas",pl:"Otrzymaj więcej ofert",ja:"他の割引を利用",nl:"Krijg meer deals",sv:"Hämta fler erbjudanden",da:"Få flere tilbud",he:"ראה עוד",ar:"احصل على مزيد من الصفقات"},{key:"more_deals2",en:"Compare Prices",tr:"Diğer Fırsatları Gör",fr:"Recevoir plus d'offres",de:"Mehr Schnäppchen erhalten",it:"Ricevi altre offerte",es:"Obtener más ofertas",ru:"Получить больше акций",pt:"Receba mais ofertas",pl:"Otrzymaj więcej ofert",ja:"他の割引を利用",nl:"Krijg meer deals",sv:"Hämta fler erbjudanden",da:"Få flere tilbud",he:"ראה עוד",ar:"احصل على مزيد من الصفقات"},{key:"buy",en:"Read More",tr:"Satın Al",fr:"Acheter maintenant",de:"Jetzt kaufen",it:"Compra ora",es:"Comprar ahora",ru:"Купить сейчас",pt:"Compre já",pl:"Kup teraz",ja:"今すぐ購入",nl:"Koop nu",sv:"Köp nu",da:"Køb nu",he:"קנה עכשיו",ar:"الشراء الآن"},{key:"attribution1",en:"Ads by",tr:"desteğiyle",fr:"Optimisé par",de:"Unterstützt von",it:"Powered by",es:"Tecnología de",ru:"На платформе от",pt:"Desenvolvido por",pl:"Wspierane przez",ja:"協力:",nl:"Geleverd door",sv:"Drivs av",da:"Drevet af",he:"powered by",ar:"بدعم من"},{key:"attribution2",en:"Brought by",tr:"güvencesiyle",fr:"Fourni par",de:"Präsentiert von",it:"Offerto da",es:"Ofrecido por",ru:"Представлено",pt:"Trazido por",pl:"Przedstawia",ja:"提供:",nl:"Gebracht door",sv:"Levererat av",da:"Udviklet af",he:"Brought by",ar:"جلبت من قبل"},{key:"click_to_use",en:"Get Coupon",tr:"Kupon Al",fr:"Recevoir le coupon",de:"Gutschein erhalten",it:"Ottieni coupon",es:"Obtener cupón",ru:"Получить купон",pt:"Obter cupom",pl:"Otrzymaj kupon",ja:"クーポンを入手",nl:"Krijg coupon",sv:"Hämta kupong",da:"Hent kupon",he:"קח קופון",ar:"احصل على كوبون"},{key:"black_friday_deals",en:"Black friday <b>deals</b>",tr:"Black friday <b>deals</b>",fr:"Spécial",de:"Heiße Angebote",it:"Speciale",es:"Ofertas calientes",ru:"супер предложения",pt:"Ofertas quentes",pl:"Gorące oferty",ja:"特価セール",nl:"",sv:"",da:"",he:"",ar:""},{key:"copy_paste",en:"Copy/Paste code to use at Checkout",tr:"Kopyala / Yapıştır kodu kullanmak için",fr:"Copier/Coller le code à utiliser lors du paiement",de:"Code kopieren und bei Abschluss der Bestellung einfügen",it:"Copia/incolla codice da usare alla cassa",es:"Copiar/pegar código y usar al pagar",ru:"Купить/вставить код для использования при расчете",pt:"Copie/Cole código e use no Checkout",pl:"Kopiuj/Wklej kod do wykorzystania przy kasie",ja:"コードをコピー・ペーストして精算時にご利用ください",nl:"Kopieer/plak code bij het afrekenen",sv:"Kopiera/klistra in kod att använda i kassan",da:"Kopier/sæt ind koden, der skal bruges ved betaling",he:"העתק והדבק קופון על מנת להשתמש",ar:"نسخ / لصق الكود للسداد"},{key:"click_coupon",en:"Click to get the Coupon",tr:"Kupon almak için tıklayın",fr:"Cliquer pour recevoir le coupon",de:"Klicken, um Gutschein zu erhalten",it:"Clicca per ricevere il coupon",es:"Haz clic para obtener cupón",ru:"Нажмите для получения купона",pt:"Clique para obter o cupom",pl:"Kliknij, by otrzymać kupon",ja:"クーポンはここをクリック",nl:"Klik om de coupon te krijgen",sv:"Klicka för att hämta kupong",da:"Klik for at hente kuponen",he:"לחץ לקבלת קופון",ar:"انقر للحصول على الكوبون"},{key:"more_deals_short",en:"Compare Prices",tr:"Diğer Fırsatlara Git",fr:"Voir plus d'offres",de:"Mehr Angebote",it:"Trova offerte",es:"Ver más",ru:"См. подробнее",pt:"Veja mais ofertas",pl:"Zobacz więcej",ja:"もっと見る",nl:"Krijg meer deals",sv:"Hämta fler erbjudanden",da:"",he:"",ar:""},{key:"cyber_monday_deals",en:"Cyber Monday <b>deals</b>",tr:"Cyber Monday <b>deals</b>",fr:"Spécial",de:"Heiße Angebote",it:"Speciale",es:"Ofertas calientes",ru:"супер предложения",pt:"Ofertas quentes",pl:"Gorące oferty",ja:"特価セール",nl:"",sv:"",da:"",he:"",ar:""},{key:"mature_deals_header",en:"Sexy Deals",tr:"Sexy Deals",fr:"",de:"",it:"",es:"",ru:"",pt:"",pl:"",ja:"",nl:"",sv:"",da:"",he:"",ar:""},{key:"visit_store",en:"Visit Store",tr:"Ziyaret mağazası",fr:"Acheter maintenant",de:"Jetzt kaufen",it:"Compra ora",es:"Comprar ahora",ru:"Купить сейчас",pt:"Compre já",pl:"Kup teraz",ja:"今すぐ購入",nl:"Koop nu",sv:"Köp nu",da:"Køb nu",he:"קנה עכשיו",ar:"الشراء الآن"},{key:"more",en:"More",tr:"More",fr:"More",de:"More",it:"More",es:"More",ru:"More",pt:"More",pl:"More",ja:"More",nl:"More",sv:"More",da:"More",he:"עוד",ar:"More"}]}(t=e.Locale||(e.Locale={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=(t.Common.RibbonSize,function(){function e(){}return e.getDimensions=function(e){switch(e){case 0:return{width:61,height:71};case 1:return{width:71,height:81};case 2:return{width:104,height:114}}},e.ribbonSizeToString=function(e){switch(e){case 0:return"Small";case 1:return"Medium";case 2:return"Large"}},e}()),o=function(){function o(o,i,a,s){var u=this;this.context=o,this.imageToDrawOn=a,this.ribbonVisible=e.ko.observable(!1),this.ribbonValid=e.ko.observable(!0),this.imageRect=e.ko.observable(o.scraper().getElementPosWithOffsets(a));var c=n.getDimensions(s);this.numOfPresentedOffers=this.calculateNumOfPresentedDeals(c,this.imageRect,i),t.Logger.info("Displaying:  "+this.numOfPresentedOffers+" offers in ribbon out of available: "+i.length),this.offers=e.ko.computed(function(){return i.slice(0,this.numOfPresentedOffers)},this),this.displayWindowOffers=e.ko.observableArray(i),this.offersModel=this.offers()?new r.RibbonOffersModel(o,this.offers(),this.displayWindowOffers()):new r.RibbonOffersModel(null,[],[]),this.ribbonDimensions=this.calculateRibbonDimensions(this.numOfPresentedOffers,c),this.strings=t.Common.LocaleHelper.getStringMapForCountry(o.countryCode(),t.Locale.sliderStrings),this.ribbonSize=n.ribbonSizeToString(s),this.displayWindowVisible=e.ko.observable(!1),
this.ribbonPosition=e.ko.computed(function(){return u.calculatePositionsByImage()}),this.displayWindowPosition=e.ko.computed(function(){return u.chooseBestPosition()}),t.Logger.info("Ribbon Position: "+JSON3.stringify(this.ribbonPosition())),t.Logger.info("Ribbon Dimensions: "+JSON3.stringify(this.ribbonDimensions))}return o.prototype.updateImageRect=function(){this.imageRect(this.context.scraper().getElementPosWithOffsets(this.imageToDrawOn))},o.prototype.calculatePositionsByImage=function(){return this.imageRect()&&this.imageRect().top&&this.imageRect().right||this.ribbonValid(!1),{top:this.imageRect().top,left:this.imageRect().right}},o.prototype.hideDisplayWindow=function(){this.displayWindowVisible(!1)},o.prototype.showDisplayWindow=function(){this.displayWindowVisible(!0)},o.prototype.calculateNumOfPresentedDeals=function(e,t,r){var n=Math.max(1,Math.floor(t().height/e.height)),o=3,i=Math.max(n,o),a=Math.min(i,r.length);return a},o.prototype.calculateRibbonDimensions=function(e,t){return{width:t.width,height:e*t.height}},o.prototype.chooseBestPosition=function(){var e=80,r=515,n=205,o=2,i={left:this.ribbonPosition().left+this.ribbonDimensions.width+10,top:this.imageRect().top,width:r,height:e+n*o};return t.Logger.info("Image rect:"+this.imageRect()),t.Logger.info("Display Window rect:"+i),i.left+i.width>window.innerWidth?this.imageRect().top+this.imageRect().height+i.height+10>window.innerHeight+window.pageYOffset&&this.imageRect().top-i.height-10-window.pageYOffset<0?this.imageRect().left-i.width-10<0?i.left>window.innerWidth-r-10&&(i.left=window.innerWidth-r-10):i.left=this.imageRect().left-i.width-10:(this.imageRect().left+this.imageRect().width/2-i.width/2+i.width<window.innerWidth?i.left=this.imageRect().left+this.imageRect().width/2-i.width/2:i.left=window.innerWidth-(10+i.width),this.imageRect().top+this.imageRect().height+i.height+10>window.innerHeight+window.pageYOffset?i.top=this.imageRect().top-i.height-10:i.top=this.imageRect().top+this.imageRect().height+10):this.imageRect().top+i.height+10>window.innerHeight+window.pageYOffset&&(i.top=window.pageYOffset+window.innerHeight-(10+i.height)),i},o}();r.RibbonCommerceOffersModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(){this.ribbonImageElement=null,this.imagesForWordIntersection=null}return r.prototype.flag=function(){return"rb"},r.prototype.dataKey=function(){return"CommerceRibbon"},r.prototype.supportsStickyClassification=function(){return!0},r.prototype.classify=function(e){return t.namedWaterfall([{name:"specialcase",value:function(){return t.Vertical.CommerceHelper.classifyBySpecialCasesAndJunk(e)}},{name:"bwl",value:function(){return t.Vertical.CommerceHelper.classifyByBlackWhiteList(e)}},{name:"dict",value:function(){return t.Vertical.CommerceHelper.classifyByDictionaries(e)}},{name:"ribbon",value:function(){return t.Vertical.CommerceHelper.classifyByProductImage(e)}}],function(e){return 0!=e}).alwaysThen(function(e,t){return t?{name:t.message,value:0}:e})},r.prototype.scrapeAndObtainData=function(e,r,n){var o=this;return this.imagesForWordIntersection=t.Common.ImageUtils.findValidImagesBySize(0,4,!1),window.setInterval(function(){return o.scrapeAndSetDataIfNeeded(e,r.totalCount())},1e3),this.scrapeAndSetDataIfNeeded(e,r.totalCount()).then(function(){var r=new t.Data.StubDataResult("rb",e);return r})},r.prototype.scrapeAndSetDataIfNeeded=function(e,t){var r=this.findCandidateImages();return this.searchByImagesText(e,r,t)},r.prototype.findCandidateImages=function(){var e=r.DEFAULT_IMG_INDEX_TO_SHOW_ON;"undefined"!=typeof window.FO_RB_IMG&&(e=window.FO_RB_IMG);var n=2,o=t.Common.ImageUtils.findValidImagesBySize(e,n,!0),i=this.createImagesAndSize(o);return i},r.prototype.createImagesAndSize=function(r){var n=[];if(r)for(var o=0;o<r.length;o++){var i={image:e.$(r[o]),size:t.Common.ImageUtils.imageSizeToRibbonSize(r[o].height)};n.push(i)}return n},r.prototype.searchByImagesText=function(e,r,n,o){var i=this;if(r&&r.length>0&&(o=o||0,o<r.length)){var a=r[o].image,s=a.data("fo-ribbon-state");if(s){var u=(new Date).getTime();return a.data("fo-ribbon-primary",u),void(this.ribbonImageElement=a)}a.data("fo-ribbon-state","loading");var c=this.requestDataFromImage(e,a[0]),l=t.Data.OffersApi.queryFromData(e,c);return t.Data.OffersApi.queryApi(e,n,null,l).then(function(s){if(a.data("fo-ribbon-state","loaded"),s&&s.offers.length>0){var u=(new Date).getTime();a.data("fo-ribbon-primary",u),i.ribbonImageElement=a,a.data("fo-ribbon-data",t.Data.OffersApi.dealsFromOffers(e,s.offers)),a.data("fo-ribbon-size",r[o].size),i.storeRetargetingData(s.offers,e);var c=t.Data.OffersApi.dealsFromOffers(e,s.offers),l=new t.Data.PlainDataResult("rb",e,c);return l}return o++,i.searchByImagesText(e,r,n,o),null})}return t.resolve(null)},r.prototype.storeRetargetingData=function(e,r){var n=e[0].keywords;t.Common.Retargeting.storeImpressionKeywords(r,n),t.Common.Retargeting.storeImpressionKeywordsToCookie(r,n,r.paths().domain()),t.StaticCol.each(e,function(e){e.onClick=function(){t.Common.Retargeting.storeClickKeywords(r,e.keywords),t.Common.Retargeting.storeClickKeywordsToCookie(r,e.keywords,r.paths().domain())}})},r.prototype.requestDataFromImage=function(t,r){var n=new e.NWPLegacy,o={wordCounts:this.imageScrape(t,r),price:n.PriceUtils.getPrice(r),source:"rb"};return o},r.prototype.imageScrape=function(e,r){return t.Common.ScrapingLogics.imageScrapeLogicWithSupporting(e,r,this.imagesForWordIntersection)},r.DEFAULT_IMG_INDEX_TO_SHOW_ON=0,r}();r.CommerceRibbonLogic=n}(r=t.ExternalProducts||(t.ExternalProducts={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){function n(e,r){r.subscribe(function(r){return t.Logger.log("Observable "+e+": "+r)})}r.watchObservable=n,r.defaultAdjustScaleOptions={active:!1,top:0,bottom:0,pos:.5,minScale:.65},r.defaultHorizontalPos={active:!1,right:0,left:0,minScale:1};var o=function(){function n(){}return n.setAlternativeTemplateEngine=function(){var t=new e.ko.nativeTemplateEngine;t.renderTemplate=function(r,n,o,i){var a=e.ko.templateEngine.prototype.makeTemplateSource(r,null);return t.renderTemplateSource(a,n,o)},e.ko.setTemplateEngine(t)},n.registerCustomBindings=function(t){e.ko.bindingHandlers.containedTemplate2=n.containedTemplate2(),e.ko.bindingHandlers.slideVisible=n.slideVisible(),e.ko.bindingHandlers.fadeVisible=n.fadeVisible(),e.ko.bindingHandlers.fadeVisibleInvisibleRemove=n.fadeVisibleInvisibleRemove(),e.ko.bindingHandlers.hoverToggle=n.hoverToggle(),e.ko.bindingHandlers.className=n.className(),e.ko.bindingHandlers.stopBubble=n.stopBubble(),e.ko.bindingHandlers.positionNextTo=n.positionNextTo(),n.setAlternativeTemplateEngine()},n.stopBubble=function(){return{init:function(t,r,n,o,i){for(var a=e.ko.utils.unwrapObservable(r()),s=a.split(","),u=0;u<s.length;u++)e.ko.utils.registerEventHandler(t,s[u].trim(),function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()})}}},n.className=function(){return{update:function(t,r,n,o,i){var a=r();a&&e.$(t).toggleClass(a,!0)}}},n.positionNextTo=function(){return{update:function(t,n,o,i,a){var s=e.$(t),u=e.ko.utils.unwrapObservable(n()),c=r.VisualHelper.positionNextTo(u,s);s.css({top:c.y,left:c.x,position:"absolute"})}}},n.getBrowser=function(){var e,t=navigator.userAgent,r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(r[1])?(e=/\brv[ :]+(\d+)/g.exec(t)||[],"MSIE "+(e[1]||"")):"Chrome"===r[1]&&(e=t.match(/\bOPR\/(\d+)/),null!=e)?"Opera "+e[1]:(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&r.splice(1,1,e[1]),r.join(" "))},n.hoverToggle=function(){return{init:function(t,r,n,o,i){var a=r();e.ko.utils.registerEventHandler(t,"mouseenter",function(){return a(!0)}),e.ko.utils.registerEventHandler(t,"mouseout",function(){return a(!1)})}}},n.containedTemplate2=function(){return{update:function(o,i,a,s,u){var c=e.$("<div></div>");e.ko.bindingHandlers.template.update(c[0],i,a,s,u);var l=e.ko.utils.unwrapObservable(i()),f=n.getBrowser(),d=!0,p="object"==typeof l&&l.squereResizeWithOffsets?l.squereResizeWithOffsets:0,h="object"==typeof l&&l.adjustHeightInterval?l.adjustHeightInterval:0,m="object"==typeof l&&l.adjustScale&&"MSIE 9"!=f?l.adjustScale:{},g=e.$.extend({},r.defaultAdjustScaleOptions,m),v="object"==typeof l&&l.css?l.css:null,y="object"==typeof l&&l.adjustHorizontal?l.adjustHorizontal:{},b=e.$.extend({},r.defaultHorizontalPos,y);d&&n.ctTreatForCollisions(o,c),g&&g.active&&n.ctAdjustScale(o,c,g),b&&b.active&&n.ctAdjustHorizontalPosition(o,c,b),p&&n.squereResizeWithOffsets(o,c,h);var C=function(){v&&e.$(o.contentDocument.head).append(e.$("<link rel='stylesheet' href='"+v+"'></link>")),e.$(o.contentDocument.body).append(c)};f.indexOf("Firefox")>=0?setInterval(function(){o.contentDocument&&o.contentDocument.body&&!o.contentDocument.body.hasChildNodes()&&C()},100):t.wait(100).then(C)}}},n.squereResizeWithOffsets=function(e,t,r){n.ctAdjustHeight(e,t,r,20),n.ctAdjustWidth(e,t,r,25)},n.ctTreatForCollisions=function(e,t){r.CollisionHelper.treatForCollisions(t)},n.ctAdjustHeight=function(t,r,n,o){void 0===o&&(o=0),setInterval(function(){try{var n=r&&r.children().length&&r.children()[0];if(n){var i=e.$(n).height();e.$(t).height(i+o)}}catch(a){}},n)},n.ctAdjustWidth=function(t,r,n,o){void 0===o&&(o=0),setInterval(function(){try{var n=r&&r.children().length&&r.children()[0];if(n){var i=e.$(n).width();e.$(t).width(i+o)}}catch(a){}},n)},n.ctAdjustScale=function(r,o,i){t.waitFor(function(){return"true"===e.$(r.contentDocument.body).css("ready")},1e4,50).then(function(){return setInterval(function(){return n.scaleOnResize(r,i,n.getFirstHeight(o))},100)}),window.addEventListener("resize",function(){var e=n.getFirstHeight(o);n.scaleOnResize(r,i,e)})},n.ctAdjustHorizontalPosition=function(r,o,i){t.waitFor(function(){return"true"===e.$(r.contentDocument.body).css("ready")},1e4,50).then(function(){return t.waitForStable(function(){return n.getFirstWidth(o)},function(e){return e>0},function(e){return n.adjustHorizontalPosition(r,i,e)},100,500)}),window.addEventListener("resize",function(){var e=n.getFirstWidth(o);n.adjustHorizontalPosition(r,i,e)})},n.getFirstHeight=function(e){var t=e[0].getElementsByClassName("fo-container");return t.length?t.item(0).offsetHeight:0},n.getFirstWidth=function(t){for(;;){var r=t.width();if(r)return r;var n=t.children();if(!(n&&n.length>0))return 0;t=e.$(n[0])}},n.scaleOnResize=function(t,r,o){var i=e.$(t).data("scaleData");if(!i||window.innerHeight!=i.windowHeight||o!=i.innerHeight){i={windowHeight:window.innerHeight,innerHeight:o},e.$(t).data("scaleData",i),console.log("adjusting scale");var a=r.width?r.width:310,s=window.innerHeight-r.top-r.bottom,u=s/o;u>1&&(u=1),u<r.minScale&&(u=r.minScale);var c=o*u,l=(s-c)*r.pos+r.top,f=window.innerHeight-r.bottom-c;l=Math.min(f,l),e.$(t).css("top",l+"px"),n.getBrowser().indexOf("Chrome")>=0?(e.$(t).height(c),e.$(t).width(a*u),e.$(t.contentDocument.body).css("zoom",u)):(e.$(t).height(o),e.$(t).css("transform","scale("+u+")"),e.$(t).css("right",(u-1)*e.$(t).width()+"px"))}},n.adjustHorizontalPosition=function(t,r,n){var o=window.innerWidth-r.left-r.right,i=o/n;i>1&&(i=1),i<r.minScale&&(i=r.minScale);var a=e.$(t).height()*(i-1);e.$(t).css("transform","scale("+i+")"),e.$(t).css("right",r.right+"px"),e.$(t).css("bottom",a+"px")},n.slideVisible=function(){return{init:function(t,r){var n=e.ko.unwrap(r());e.$(t).toggle(n)},update:function(t,r,n){var o=r(),i=e.ko.unwrap(o),a=n.get("slideInDuration")||300,s=n.get("slideOutDuration")||300;1==i?e.$(t).slideDown(a):e.$(t).slideUp(s)}}},n.fadeVisible=function(){return{update:function(t,r){var n=r();e.ko.unwrap(n)?e.$(t).fadeIn(600):e.$(t).fadeOut(600)}}},n.fadeVisibleInvisibleRemove=function(){return{update:function(t,r){var n=r();e.ko.unwrap(n)?e.$(t).fadeIn():e.$(t).fadeOut(600,function(){e.$(t).remove()})}}},n.isPropertySupported=function(e){return e in document.body.style},n}();r.KoBindings=o}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(r){function n(t,n,o){r.call(this,t,n,o),this.currentBodyRect=null,this.context=t,this.ribbonModels=e.ko.observableArray(),this.ribbonsVisible=e.ko.observable(!0)}return __extends(n,r),n.prototype.addRibbon=function(e){this.ribbonModels.push(e)},n.prototype.updatePrimaryRibbon=function(e){var r=this;t.Col.of(this.ribbonModels()).each(function(t){t.ribbonVisible(t.imageToDrawOn==e),t.imageToDrawOn==e&&(r.primaryRibbon=t)})},n.prototype.updateRibbonPositionIfNeeded=function(){if(this.primaryRibbon){var r=this.context.scraper().getElementPosWithOffsets(e.$("body")[0]);this.currentBodyRect?t.Common.isEquivalent(r,this.currentBodyRect)||(this.primaryRibbon.updateImageRect(),this.currentBodyRect=r):(this.currentBodyRect=r,this.primaryRibbon.updateImageRect())}},n}(r.ProductModelBase);r.MultiRibbonModel=n}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=t.Common.RibbonSize,o=function(){function r(){this.multiRibbonModel=null,this.lastViewportPosition=-999999,this.currentPrimaryImage=null}return r.prototype.realEstate=function(){return 6},r.prototype.flag=function(){return"rrb"},r.prototype.determineNeededItemCount=function(e){return new t.Products.ItemCounts(4,8)},r.prototype.declareResourcesPromise=function(e){return{reset2_css:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Visual/reset.css"),icons_css:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Visual/foicons.css"),ribbon_css:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Visual/dealsRightRibbon.css"),displayWindowcss:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Visual/displayWindow.css"),displayWindowBgcss:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Visual/cssImages.css"),fa_css:t.Common.Res.injectCss2("//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"),ribbonHtml:t.Common.Res.bring(e.paths().innerResourcesRoot()+"/Visual/dealsRightRibbon.html"),displayWindowHtml:t.Common.Res.bring(e.paths().innerResourcesRoot()+"/Visual/displayWindow.html")}},r.prototype.draw=function(e,r,n){var o=this,i=r.CommerceRibbon.context;return this.prepareMultiRibbonBinding(i,n),window.setInterval(function(){return o.drawRibbonsWhereNeeded(e,i,n)},1e3),this.drawRibbonsWhereNeeded(e,i,n),window.setInterval(function(){return o.updateRibbonPositionIfNeeded()},1e3),t.resolve(null)},r.prototype.drawRibbonsWhereNeeded=function(e,r,n){var o=this.findImagesWithRibbonData();if(0==o.length)return void t.Logger.info("No images found with ribbon data. Doing nothing");var i=t.Col.of(o).orderByDesc(function(e){return e.data("fo-ribbon-primary")?e.data("fo-ribbon-primary"):-1}),a=i.getItem(0);if(null==this.currentPrimaryImage||this.currentPrimaryImage!==a[0])if(this.currentPrimaryImage=a[0],this.imageHasRibbonVisual(a)){t.Logger.info("Primary Image has a ribbon visual, updating primary ribbon");var s=this.currentPrimaryImage;this.multiRibbonModel.updatePrimaryRibbon(s)}else{t.Logger.info("Primary Image DOESN'T have ribbon visual, drawing new one");var u=a.data("fo-ribbon-data"),c=a.data("fo-ribbon-size");this.drawNewRibbon(e,r,u,c,a,n)}},r.prototype.updateRibbonPositionIfNeeded=function(){this.multiRibbonModel.updateRibbonPositionIfNeeded()},r.prototype.findImagesWithRibbonData=function(){for(var r=[],n=0;n<document.images.length;n++){var o=e.$(document.images[n]);o.data("fo-ribbon-data")&&(o.is(":visible")?r.push(o):t.Logger.info("Image has data but is not visible, filtering it out"))}return r},r.prototype.imageHasRibbonVisual=function(e){return!!e.data("fo-ribbon-visual-state")},r.prototype.calculateRelativeOpacity=function(e){var t,r,n=e.find("#fo-right-ribbon"),o=n[0].getBoundingClientRect();return t=o.top<0?Math.max(0,o.top+o.height):o.bottom>(window.innerHeight||document.documentElement.clientHeight)?Math.max(0,(window.innerHeight||document.documentElement.clientHeight)-o.top):o.height,r=t/o.height},r.prototype.prepareMultiRibbonBinding=function(r,n){var o=n.ribbonHtml,i="fo-right-ribbon fo-deal-offers",a=t.Common.VisualHelper.appendHtmlWithRootClass(o,i)[0],s=n.displayWindowHtml,u=e.$.parseHTML(s)[0];e.$(a).find("#fo-ribbon-container").append(u);try{var c=t.Products.VisualRealEstate[this.realEstate()],l="forb";this.multiRibbonModel=new t.Model.MultiRibbonModel(r,c,l),e.ko.applyBindings(this.multiRibbonModel,a)}catch(f){throw e.$(a).remove(),f}},r.prototype.drawNewRibbon=function(e,r,o,i,a,s){var u=a.data("fo-ribbon-visual-state");if(!u){a.data("fo-ribbon-visual-state","drawing");var c=a[0],l=new t.Model.RibbonCommerceOffersModel(r,o,c,i);this.multiRibbonModel.addRibbon(l),this.currentPrimaryImage=c,this.multiRibbonModel.updatePrimaryRibbon(this.currentPrimaryImage),a.data("fo-ribbon-visual-state","drawn"),r.pushNotificationParam("size",n[i]),t.Logger.Analytics.notify(r,t.Logger.Analytics.IMPRESSION)}},r.prototype.remove=function(e){this.multiRibbonModel.hide()},r}();r.CommerceRightRibbonVisual=o}(r=t.ExternalProducts||(t.ExternalProducts={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.splitPrice=function(t){"string"!=typeof t&&(t=""+t),t=t.replace(/[\n\t ]/gi,""),t=t.replace(/(<([^>]+)>)/gi,""),t=t.replace(/<.+/g,"");var r,n,o,i,a=/([\$£\u00A3\u20AC\u0440\u0192\u00A5\u20B1]|usd|eur|ils|r|rs|rp|руб){1,2}\.?/gi;t||(r=0,n=0,l="");var s,u,c=t.match(a),l=c?c[0]:"",f=t.replace(a,""),d=f.indexOf("."),p=f.indexOf(",");return-1==d&&-1==p?(r=e.strToNumber(f),n=0):(s=Math.max(d,p),u=f[s]||(d>p?".":","),f=f.replace(/ /g,""),f.length-s<=3?(o=f.split(u),r=e.strToNumber(o[0]),n=e.strToNumber(o[1])):(r=e.strToNumber(f),n=0)),i=parseFloat(r+"."+n),0==r&&0==n?null:{round:r,cents:n,sign:l,fullPrice:i}},e.strToNumber=function(e){if(!e)return 0;var t=/[0-9]/gi,r=e.match(t),n=r?r.join(""):"",o=n.length?parseInt(n):0;return o},e}();e.PriceUtils=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.getCookie=function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "==o.charAt(0);)o=o.substring(1);if(-1!=o.indexOf(t))return o.substring(t.length,o.length)}return""},t.setCookie=function(e,t,r,n){var o="";r&&(new Date((new Date).getTime()+24*r*60*60*1e3).toUTCString(),o="; expires="+new Date((new Date).getTime()+24*r*60*60*1e3).toUTCString());var i="";n&&(i="; domain="+n),document.cookie=e+"="+t+o+"; path=/"+i},t.setBackendClickCookie=function(t,r){void 0===r&&(r={});try{var n=t.paths().notifyRoot()+"/c/clk/logo.png",o=t.paths().domain();if(n+="?",n=n+"&domain="+encodeURIComponent(o),r)for(var i in r){var a=r[i]+"";n=n+"&"+i+"="+encodeURIComponent(a)}e.Logger.Analytics.notifyGenericUrl(n)}catch(s){}},t.serverSetCookie=function(t,r,n){var o="//"+n+"/cookie/set?type=json&action=appand&key="+t+"&value="+r;e.Logger.Analytics.notifyGenericUrl(o,{key:t,value:r,t:(new Date).getTime().toString()})},t}();t.CookieUtils=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(){}return n.storeImpressionKeywords=function(e,t){n.storeKeywords(e,t,n.RT_IMPRESSIONS_KEY)},n.storeClickKeywords=function(e,t){var o=n.storeKeywords(e,t,n.RT_CLICKS_KEY);r.CookieUtils.setBackendClickCookie(e,{clk:o})},n.storeKeywords=function(e,n,o){var i=localStorage.getItem(o),a=i?JSON3.parse(i):[],s={keywords:n.split(" "),when:(new Date).getTime()};return a.push(s),a=t.Col.of(a).orderBy(function(e){return e.when}).take(10).toArray(),i=JSON3.stringify(a),localStorage.setItem(o,i),r.CookieUtils.serverSetCookie(o,JSON3.stringify(s),"app.fastimagecdn.com"),i},n.storeClickKeywordsToCookie=function(e,t,r){n.storeKeywordsToCookie(e,t,n.RT_CLICKS_KEY,r)},n.storeImpressionKeywordsToCookie=function(e,t,r){n.storeKeywordsToCookie(e,t,n.RT_IMPRESSIONS_KEY,r)},n.storeKeywordsToCookie=function(e,n,o,i){var a,s=r.CookieUtils.getCookie(o);try{s=s?decodeURIComponent(s):"",a=s?JSON3.parse(s):[]}catch(u){t.Logger.warn("error in Json.Parse on "+s),a=[]}a.push({keywords:n.split(" "),when:(new Date).getTime()}),a=t.Col.of(a).orderBy(function(e){return e.when}).take(10).toArray(),s=JSON3.stringify(a),r.CookieUtils.setCookie(o,s,365,i)},n.getRetargetingKeywordsFromLocalStorage=function(e){var t=n.readRecentKewwordsFromSource(n.RT_IMPRESSIONS_KEY),r=n.readRecentKewwordsFromSource(n.RT_CLICKS_KEY);return n.getRetargetingKeywords(e,t,r)},n.getRetargetingKeywordsFromCookie=function(e){var t=n.readRecentKewwordsFromCookieSource(n.RT_IMPRESSIONS_KEY),r=n.readRecentKewwordsFromCookieSource(n.RT_CLICKS_KEY);return n.getRetargetingKeywords(e,t,r)},n.readRecentKewwordsFromSource=function(e){var r=((new Date).getTime(),localStorage.getItem(e)),n=r?JSON3.parse(r):[];return t.Col.of(n).orderByDesc(function(e){return e.when})},n.readRecentKewwordsFromCookieSource=function(e){var n=((new Date).getTime(),r.CookieUtils.getCookie(e)),o=n?JSON3.parse(n):[];return t.Col.of(o).orderByDesc(function(e){return e.when})},n.getRetargetingKeywords=function(e,t,r){var o=e.overrides().boolValue("retarget.oldalgo",!0);return o?n.getRetargetingKeywords_OldAlgo(e,t,r):n.getRetargetingKeywords_new(e,t,r)},n.getRetargetingKeywords_new=function(n,o,i){var a=n.overrides().floatValue("retarget-weights.type",2),s=n.overrides().floatValue("retarget-weights.age",2),u=n.overrides().floatValue("retarget-weights.page-match",2),c=n.overrides().floatValue("retarget-weights.word-repeat",2),l=o.select(function(e){return{keywords:e.keywords,when:e.when,typeScore:0,ageScore:null,repeatScore:null,matchScore:null,normTypeScore:null,normAgeScore:null,normRepeatScore:null,normMatchScore:null,totalScore:null}}),f=i.select(function(e){return{keywords:e.keywords,when:e.when,typeScore:1,ageScore:null,repeatScore:null,matchScore:null,normTypeScore:null,normAgeScore:null,normRepeatScore:null,normMatchScore:null,totalScore:null}}),d=l.mergeCol(f);if(0==d.length())return[];var p=d.minBy(function(e){return e.when}).when,h=d.selectMany(function(e){return e.keywords}).groupBy(function(e){return e}).toHashmap2(function(e){return e.key},function(e){return e.value.length}),m=e.$("body").text(),g=t.StaticCol.aggregate(m.split(/\W+/gi),{},function(e,t){return e.length>0&&(t[e]=e in t?t[e]+1:1),t});d.each(function(e){e.ageScore=(e.when-p)/(1e3*r.DAY_SECONDS),e.repeatScore=t.StaticCol.sum(e.keywords,function(e){return h[e]}),e.matchScore=t.StaticCol.sum(e.keywords,function(e){return e in g?g[e]:0})}),d.normalize(function(e){return e.ageScore},function(e,t){return e.normAgeScore=t}),d.normalize(function(e){return e.typeScore},function(e,t){return e.normTypeScore=t}),d.normalize(function(e){return e.repeatScore},function(e,t){return e.normRepeatScore=t}),d.normalize(function(e){return e.matchScore},function(e,t){return e.normMatchScore=t}),d.each(function(e){e.totalScore=e.normTypeScore*a+e.normAgeScore*s+e.normRepeatScore*c+e.normMatchScore*u});var v=d.orderByDesc(function(e){return e.totalScore}).firstOrValue(null);return v.keywords},n.getRetargetingKeywords_OldAlgo=function(e,r,o){var i={};r.each(function(e){t.Col.of(e.keywords).each(function(e){i[e]=i[e]?i[e]+=1:1})}),o.each(function(e){t.Col.of(e.keywords).each(function(e){i[e]=i[e]?i[e]+=2:2})});var a=r.select(function(e,r){var o=t.StaticCol.sum(e.keywords,function(e){return i[e]}),a=o*(n.POSITION_WEIGHT+r);return{keywords:e.keywords,score:a}}),s=o.select(function(e,r){var o=t.StaticCol.sum(e.keywords,function(e){return i[e]}),a=o*(n.POSITION_WEIGHT+r);return{keywords:e.keywords,score:a}}),u={keywords:[],score:0},c=a.orderByDesc(function(e){return e.score}).firstOrValue(u),l=s.orderByDesc(function(e){return e.score}).firstOrValue(u);return c.score>l.score?c.keywords:l.keywords},n.RT_CLICKS_KEY="fo-rt-clk",n.RT_IMPRESSIONS_KEY="fo-rt-imp",n.POSITION_WEIGHT=8,n}();r.Retargeting=n}(r=t.Common||(t.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.pruneQueryData=function(t,r){var n=e.Col.of(t.kwc).where(function(t){return!e.StaticCol.contains(r,t.w)}),o=t.t;e.Col.of(r).each(function(e){return o=o.replace(e,"")});var i=n.orderBy(function(e){return o.indexOf(e.w)});return{kwc:i.toArray(),t:o,clientPrice:t.clientPrice,source:t.source}},t.pruneTooManyKeywords=function(r,n){void 0===n&&(n=20);var o=e.Col.of(r.kwc).orderByDesc(function(e){return e.c}),i=o.skip(n).select(function(e){return e.w}).toArray();return t.pruneQueryData(r,i)},t.pruneKeywordsToTopHalf=function(r){var n=e.Col.of(r.kwc).orderByDesc(function(e){return e.c}),o=n.length()>0?n.getItem(0).c:0,i=o/2,a=n.where(function(e){return e.c>=i}),s=Math.max(t.MIN_WORDS,a.length()),u=n.skip(s).select(function(e){return e.w}).toArray();return t.pruneQueryData(r,u)},t.pruneKeywordsToOverMedian=function(r){var n=e.Col.of(r.kwc).orderByDesc(function(e){return e.c}),o=Math.max(t.MIN_WORDS,Math.ceil(n.length()/2));if(o<n.length()){var i=n.getItem(o).c,a=n.where(function(e){return e.c<i}).select(function(e){return e.w}).toArray();return t.pruneQueryData(r,a)}return r},t.logQueryData=function(t){var r=e.Col.of(t.kwc).select(function(e){return e.w+" ("+e.c+")"}).stringJoin(" ");e.Logger.info("Requesting offers with\nSource:	"+t.source+"\nPrice:	"+t.clientPrice+"\nKwds:	"+r+"\n")},t.queryApi=function(r,n,o,i){if(t.logQueryData(i),i=t.pruneTooManyKeywords(i,20),this.queryContainsOnlyNumbers(i))return e.Logger.warn("Query contains only numbers: "+i),e.resolve({offers:[],source:i.source});if(this.queryContainsLessThanTwoKeywords(i))return e.Logger.warn("Query contains less than 2 words: "+i),e.resolve({offers:[],source:i.source});var a=e.Logger.Reporting.resolveReportingProduct(r.logic().flag(),r.visual.flag()),s={rootUrl:r.paths().apiRoot(),base64Data:encodeURIComponent(e.Common.Base64.encode(JSON3.stringify(i))),partnerId:r.params().partnerCode,countryCode:r.countryCode().toLowerCase(),hostName:r.host(),offers:n,apiContext:o,rp:a},u=e.Common.namedStringFormat("{rootUrl}/o/1234/{base64Data}?partid={partnerId}&hn={hostName}&offers={offers}&c={countryCode}&rp={rp}",s);return null!=r.params().subId&&(u=u+"&subid="+r.params().subId),null!=o&&(u=u+"&context="+o),e.jqGetPromise(u).then(function(e){var t=JSON3.parse(e),r={offers:t,source:i.source};return r})},t.queryContainsOnlyNumbers=function(e){return 0==e.t.replace(/[0-9]/g,"").trim().length},t.queryContainsLessThanTwoKeywords=function(e){return e.kwc.length<2},t.queryFromData=function(t,r){var n=r.wordCounts.select(function(e){return{w:e.key,c:e.value}}).toArray(),o=e.StaticCol.select(n,function(e){return e.w}).join(" ");return{kwc:n,t:o,clientPrice:r.price,source:"api-"+r.source}},t.queryFromRetargeting=function(t){var r=e.Common.Retargeting.getRetargetingKeywordsFromLocalStorage(t);if(0==r.length)return null;var n=e.StaticCol.select(r,function(e){return{w:e,c:1}}),o={kwc:n,t:r.join(" "),clientPrice:-1,source:"rt"};return o},t.queryFromGenericKeywords=function(t){var r=e.StaticCol.select(t,function(e){return{w:e,c:1}}),n={kwc:r,t:t.join(" "),clientPrice:-1,source:"generic-keywords"};return n},t.dealsFromOffers=function(r,n){var o=r.paths().outerResourcesRoot()+"/empty_merchant.jpg",i=r.overrides().boolValue("deals.default-merchant-image",!1),a=e.Col.of(n).orderByDesc(function(e){return e.rank}).select(function(e,r){var n=t.generateFakeData(e),a={title:e.title,price:e.price,thumb:e.largeImage?e.largeImage:e.images,url:-1==e.url.indexOf("?")?e.url+"?safepassage=1":e.url+"&safepassage=1",merchantThumb:e.merchantImage||!i?e.merchantImage:o,merchantText:e.merchant,ribbon:0==r?"Best Deal":"",part:e.part,keywords:e.keywords,freeShipping:e.freeShipping,attribution:e.attribution,onClick:e.onClick,originalPrice:n.originalPrice,discount:n.discount,rating:n.rating};return a});return a.toArray()},t.generateFakeData=function(r){var n=Math.abs(e.Common.stringHash(r.price)),o=Math.abs(e.Common.stringHash(r.title)),i=(1+n%1e3)/1e3,a=(1+o%1e3)/1e3,s=.6+.4*a,u=t.extractPriceValueAndPattern(r.price);if(u&&u.value==parseFloat(r.priceNum)){var c=.6>i?.333*i:0,l=Math.round(100*c),f=Math.floor(u.value*(1+c))+.99,d=e.Common.stringFormat(u.pattern,f);return{originalPrice:d,discount:l,rating:s}}return e.Logger.info("Failed parsing for discount: "+r.price),{originalPrice:r.price,discount:0,rating:s}},t.extractPriceValueAndPattern=function(e){var t=e.split(/&[#\d]+;/).join(""),r=t.match(/\d+(?:[ ,\.]\d+)*/);if(!r||0==r.length)return null;var n=r[0],o=n.match(/^(.*?)(?:[ ,\.](\d{1,2}))?$/),i=o[1].split(/[ ,\.]/).join(""),a=o[2],s=i+"."+a,u=parseFloat(s),c=e.replace(n,"{0}");return{pattern:c,value:u}},t.MIN_WORDS=4,t}();t.OffersApi=r}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){!function(e){e[e.INVALID=0]="INVALID",e[e.SMALL=1]="SMALL",e[e.LARGE=2]="LARGE"}(e.ProductImageSize||(e.ProductImageSize={}));e.ProductImageSize;e.defaultPBSettings={useGeneric:!0,generic:{productImageAreas:[{size:0,maxArea:5e3},{size:1,maxArea:4e4},{size:2,maxArea:1e6}],productImageMaxRatio:2.8,productBoxToImageMaxRatio:9,productBoxToImageSingleDimensionMaxRatio:2},useCustom:!1},e.laxGenericSettings={productImageAreas:[{size:0,maxArea:5e3},{size:1,maxArea:4e4},{size:2,maxArea:1e6}],productImageMaxRatio:6,productBoxToImageMaxRatio:18,productBoxToImageSingleDimensionMaxRatio:4}}(t=e.ProductBoxes||(e.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.retrieveSettings=function(r){for(var n in t.manualCustomSettings)if(r.match(n))return e.resolve(t.manualCustomSettings[n]);return e.resolve(null)},r}();t.CustomHelper=r,t.manualCustomSettings={"xx_ebay\\.co[\\.\\w]{1,3}/itm/":{useGeneric:!0,useCustom:!0,custom:{boxSelectors:[{name:"ebay product page",boxSelector:"#CenterPanelInternal",titleSelector:"#itemTitle",priceSelector:"#prcIsum",isVerifier:!1,minCount:1}]}},"xx_amazon\\.co[\\.\\w]{1,3}":{useGeneric:!0,useCustom:!0,custom:{boxSelectors:[{name:"amazon product page",boxSelector:"#centerCol",titleSelector:"#productTitle",priceSelector:"#priceblock_ourprice",isVerifier:!1,minCount:0}]}},"xx_homedepot\\.com/p/":{useGeneric:!0,useCustom:!0,custom:{boxSelectors:[{name:"homedepot product page",boxSelector:"#productinfo_ctn",titleSelector:".product_title",priceSelector:"#ajaxPrice",isVerifier:!1,minCount:1}]}}}}(t=e.ProductBoxes||(e.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(){}return r.calculateBoxElement=function(r){var n=e.$(r),o=n.outerWidth(),i=n.outerHeight(),a=Math.max(i/o,o/i),s=o*i,u=n.is(":visible"),c=t.Common.VisualHelper.getElementPosWithOffsets(r),l={element:r,jqElement:n,width:o,height:i,ratio:a,area:s,isVisible:u,rect:c};return l},r}();r.DomHelper=n}(r=t.ProductBoxes||(t.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){t.knownCurrencies=e.Col.of([{iso:"USD",patterns:["\\$","USD","US\\s+\\$","DOLLAR","DOLLARS"],meaninglessSeparators:",",decimalSeparators:"."},{iso:"GBP",patterns:["£","\\u00A3","POUND","GBP"],meaninglessSeparators:",",decimalSeparators:"."},{iso:"EUR",patterns:["€","\\u20AC","EURO","EUR"],meaninglessSeparators:",",decimalSeparators:"."},{iso:"JPY",patterns:["¥","\\u00A5","YEN"],meaninglessSeparators:",",decimalSeparators:"."},{iso:"ILS",patterns:["\\u20aa","ILS","NIS","ILS ₪","₪"],
meaninglessSeparators:",",decimalSeparators:"."},{iso:"PLN",patterns:["zł"],meaninglessSeparators:".",decimalSeparators:","},{iso:"INR",patterns:["Rs\\."],meaninglessSeparators:",",decimalSeparators:"."},{iso:"TR",patterns:["TL"],meaninglessSeparators:".",decimalSeparators:","},{iso:"BRL",patterns:["R\\$","BRL"],meaninglessSeparators:".",decimalSeparators:","},{iso:"RUB",patterns:["руб","р"],meaninglessSeparators:" ",decimalSeparators:","}])}(t=e.ProductBoxes||(e.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){!function(e){e[e.Irrelevant=0]="Irrelevant",e[e.ProductPage=1]="ProductPage",e[e.ListPage=2]="ListPage",e[e.SearchPage=3]="SearchPage",e[e.BrowsePage=4]="BrowsePage",e[e.CartPage=5]="CartPage",e[e.BelowFoldListPage=6]="BelowFoldListPage",e[e.Weird=7]="Weird"}(r.PageType||(r.PageType={}));var n=r.PageType,o=function(){function o(){this.priceSuffixes=["(per|/)?\\s*\\w+"],this.priceSuffixesPattern="\\s*("+this.priceSuffixes.join("|")+")?\\s*",this.pricePatternSymbols="("+r.knownCurrencies.selectMany(function(e){return e.patterns}).stringJoin("|")+")",this.singlePricePattern="([\\s\\d\\.,\\-]*)"+this.pricePatternSymbols,this.pricePattern="([\\s\\d\\.,\\-]*)"+this.pricePatternSymbols+"([\\s\\d\\.,\\-]*)",this.strictPriceRx=new RegExp("^"+this.pricePattern+"(?:\\s+\\-\\s+"+this.pricePattern+")?"+this.priceSuffixesPattern+"$","gi")}return o.prototype.customScrape=function(o,i,a,s){var u=this,c=t.Col.of(i.boxSelectors).selectMany(function(n){var o=t.Col.fromSelector(n.boxSelector).select(function(t){var o=r.DomHelper.calculateBoxElement(t),i=e.$(t),a=i.find(n.titleSelector);if(0==a.length)return null;o.mainText=a[0].textContent;var s=i.find(n.priceSelector);return 0==s.length?null:(o.price=u.priceFromElement(s[0]),o)});return n.minCount>o.length()&&a&&a.reportUnfulfilledCustom(n,o.length()),o.toArray()}),l=null;if(i.searchBoxSelector){var f=e.$(i.searchBoxSelector);f.length>0&&f[0].textContent&&(l={element:f[0],text:f[0].textContent})}var d=i.explicitPageType?n[i.explicitPageType]:null;return{boxes:c,searchBox:l,explicitPageType:d}},o.prototype.debugNaiveScrape=function(e){var t=r.defaultPBSettings,n=this.scrapeByImageNaive(e,t.generic,!0);console.log(n)},o.prototype.debugScrape=function(e){void 0===e&&(e=document.documentElement);var t=r.defaultPBSettings;this.genericScrape(e,t.generic,!0)},o.prototype.genericScrape=function(e,r,n){var o=this,i=function(e){return o.collectMeaningfullBoxes(e,r,n)},a=function(e,t,i){return o.mergeMeaningfullBoxes(e,t,i,r,n)},s=t.StaticCol.recurseSelectElements(e,i,a),u=t.Col.of(s[1].productBoxes).orderByDesc(function(e){return e.area});return u=u.where(function(e){var t=u.first(function(t){return e.element!=t.element&&e.element.contains(t.element)});return t&&n&&console.log(e.element," eliminated. contains ",t.element),!t})},o.prototype.collectMeaningfullBoxes=function(e,t,r){if("img"==e.tagName.toLowerCase()){var n=this.productImageFromIMG(e,t,r);if(0!=n.size)return[1,{validImage:n,validPrices:[],productBoxes:[]}]}else if(e.textContent.trim().match(this.strictPriceRx)){var o=this.priceFromElement(e);if(o)return[1,{validImage:null,validPrices:[o],productBoxes:[]}]}return[0,{validImage:null,validPrices:[],productBoxes:[]}]},o.prototype.mergeMeaningfullBoxes=function(e,t,r,n,o){var i={validImage:t.validImage||r.validImage,validPrices:t.validPrices.concat(r.validPrices),productBoxes:t.productBoxes.concat(r.productBoxes)},a=this.tryCombineToProductBox(e,i.validImage,i.validPrices,n,o);return a&&(i.validImage=null,i.validPrices=[],i.productBoxes.push(a)),i},o.prototype.attemptAltMainProductBox=function(e,n){var o=this,i=r.laxGenericSettings,a=document.title,s=a.split(/\W+/).join(" "),u=t.Col.ofElements(document.images).select(function(e){var r=e.alt.split(/[\W_]+/).join(" "),n=t.Common.getEditDistance(r,s),o=1-n/a.length;return{image:e,closeness:o}}),c=u.where(function(e){return e.closeness>.6}),l=c.select(function(e){return o.productImageFromIMG(e.image,i,n)}),f=l.where(function(e){return e.rect.top<=window.innerHeight}),d=e.maxBy(function(e){return e.image.area}),p=d?d.image.area:4e4,h=f.where(function(e){return e.area>p}),m=1==h.length()?this.findContainingProductBox(h.getItem(0),i,n):null;return m?(n&&console.log("alt product box",m),m):(n&&(console.log("AltProductBox failed!"),console.log("SimilarAlt",c.toArray()),console.log("aboveTheFold",f.toArray()),console.log("largerThanOthers",h.toArray())),null)},o.prototype.productImageFromIMG=function(e,n,o){var i=r.DomHelper.calculateBoxElement(e),a=i.ratio<=n.productImageMaxRatio&&i.isVisible;if(o&&!a&&console.log("Ignoring image due to bad ration / invisible",i),a){var s=t.Col.of(n.productImageAreas).first(function(e){return e.maxArea>i.area});i.size=s?s.size:2}else i.size=0;return i.alt=e.alt,i},o.prototype.priceFromElement=function(e){var n=e.textContent.trim(),o=r.knownCurrencies.first(function(e){return t.Col.of(e.patterns).any(function(e){return new RegExp(e,"gi").test(n)})}),i="([\\d"+this.escapeRegExp(o.decimalSeparators)+this.escapeRegExp(o.meaninglessSeparators)+"]+)",a=i+"\\s*\\-?\\s*"+i+"?",s=n.match(a);if(s&&s.length){var u=t.Col.of(s).skip(1).where(function(e){return!!e}).select(function(e){return e=e.replace(/[,\.]\d\d$/,""),e=e.split(/[,\.]/).join(""),parseFloat(e)}),c=u.minBy(function(e){return e});return{element:e,value:c,currency:o}}return null},o.prototype.isProductBoxValid=function(e,t,r){var n=e.height?e.height/e.image.height:0,o=e.width?e.width/e.image.width:0;return.7>o?(r&&console.log("Box invalid. Image width too large compared to box width"),!1):.7>n?(r&&console.log("Box invalid. Image Height too large compared to box height"),!1):e.productToImageRatio>t.productBoxToImageMaxRatio&&o>t.productBoxToImageSingleDimensionMaxRatio&&n>t.productBoxToImageSingleDimensionMaxRatio&&o>t.productImageMaxRatio?(r&&console.log("Box invalid. Both 2D and 1D image to box ratios are bad"),!1):!0},o.prototype.tryCombineToProductBox=function(e,n,o,i,a){if(null==n||null==o||0==o.length)return null;var s=r.DomHelper.calculateBoxElement(e);return s.image=n,s.prices=t.Col.of(o),s.productToImageRatio=s.area/s.image.area,this.isProductBoxValid(s,i,a)?(s.mainText=this.resolveProductBoxText(s),s.price=this.resolvePrice(s,i,a),s.mainText?s.price?s:(a&&console.log("Box invalid. No price",s),null):(a&&console.log("Box invalid. No text",s),null)):void 0},o.prototype.resolveProductBoxText=function(e){if(e.texts=this.collectProductBoxTexts(e),0==e.texts.length())return null;var t=e.image.alt&&this.resolveMainTextByAlt(e);if(t)return t;var r=this.resolveTextByStyle(e);return r?r:void 0},o.prototype.collectProductBoxTexts=function(e){var r=[];return t.StaticCol.recurseNodes(e.element,function(t,n){if(e.prices.any(function(e){return e.element==t}))return 1;if(3==t.nodeType){var o=t.nodeValue.trim();if(o&&o.length>5&&o.length<150){var i=o.split(" ");i.length>=1&&i.length<30&&r.push({text:o,element:t.parentNode})}}return 0}),t.Col.of(r)},o.prototype.resolveTextByStyle=function(t){var r=t.texts.orderByDesc(function(t){return parseFloat(e.$(t.element).css("font-size"))}).firstOrValue(null);return r.text},o.prototype.resolveMainTextByAlt=function(e){var r=e.image.alt.replace("...",""),n=e.texts.select(function(e){var n=e.text.replace("...",""),o=Math.min(r.length,n.length);if(4>o)return{text:e.text,match:0};var i=t.Common.getEditDistance(r.substr(0,o),n.substr(0,o)),a=1-i/o;return{text:e.text,match:a}}),o=n.orderByDesc(function(e){return e.match}).firstOrValue(null);if(o&&o.match>.9){var i=e.image.alt.length>o.text.length?e.image.alt:o.text;return i}return null},o.prototype.resolvePrice=function(r,n,o){var i=r.prices.where(function(r){var n=r.element,i=t.Col.ofInts(0,3).any(function(t){return"line-through"==e.$(n).css("text-decoration")?!0:void(n=n.parentElement)});return i?(o&&console.log("Price disregarded. Has line through",r),!1):!0});if(0==i.length())return null;var a=i.select(function(r){return t.Pair.from(r,parseFloat(e.$(r.element).css("font-size")))}).orderByDesc(function(e){return e.second}),s=a.getItem(0).second,u=a.where(function(e){return e.second/s>.9}),c=u.orderByDesc(function(e){return e.first.value}).firstOrValue(null);return c.first},o.prototype.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},o.prototype.scrapeByImageNaive=function(e,r,n){var o=this,i=t.Col.of(this.findElements(e,"img")).select(function(e){return o.productImageFromIMG(e,r,n)}),a=i.where(function(e){return 0!=e.size}),s=a.select(function(e){return o.findContainingProductBox(e,r,n)}).where(function(e){return!!e});return s},o.prototype.findContainingProductBox=function(e,t,r){for(var n=e.element;n.parentElement;){n=n.parentElement;var o=this.findPriceElements(n);if(o.length>0){var i=this.tryCombineToProductBox(n,e,o,t,r);return i}}return r&&console.log("Ignoring image, no containing div also contains price(s)",e),null},o.prototype.findPriceElements=function(e){var r=this,n=this,o=[];return t.StaticCol.recurseElements(e,function(e){if(e.textContent.trim().match(r.strictPriceRx)){var t=n.priceFromElement(e);return t&&t.value&&o.push(t),1}return 0}),o},o.prototype.findElements=function(e,r){var n=[];return t.StaticCol.recurseElements(e,function(e){return e.tagName.toLowerCase()==r&&n.push(e),0}),n},o.isVisible=function(e){function t(e,o,i,a,s,u,c){var l=e.parentNode,f=2;return n(e)?9===l.nodeType?!0:"0"===r(e,"opacity")||"none"===r(e,"display")||"hidden"===r(e,"visibility")?!1:(("undefined"==typeof o||"undefined"==typeof i||"undefined"==typeof a||"undefined"==typeof s||"undefined"==typeof u||"undefined"==typeof c)&&(o=e.offsetTop,s=e.offsetLeft,a=o+e.offsetHeight,i=s+e.offsetWidth,u=e.offsetWidth,c=e.offsetHeight),l?"hidden"!==r(l,"overflow")&&"scroll"!==r(l,"overflow")||!(s+f>l.offsetWidth+l.scrollLeft||s+u-f<l.scrollLeft||o+f>l.offsetHeight+l.scrollTop||o+c-f<l.scrollTop)?(e.offsetParent===l&&(s+=l.offsetLeft,o+=l.offsetTop),t(l,o,i,a,s,u,c)):!1:!0):!1}function r(e,t){return window.getComputedStyle?document.defaultView.getComputedStyle(e,null)[t]:e.currentStyle?e.currentStyle[t]:void 0}function n(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}return t(e,void 0,void 0,void 0,void 0,void 0,void 0)},o}();r.ScraperBase=o}(r=t.ProductBoxes||(t.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function n(){}return n.simpleAnalyze=function(e,t){return void 0===t&&(t=!1),n.analyze(e,null,t)},n.analyze=function(t,o,i){void 0===o&&(o=null),void 0===i&&(i=!1);var a=r.CustomHelper.retrieveSettings(document.location.href);return a.then(function(a){var s=e.$.extend({},r.defaultPBSettings,a,o);return n.analyzeInner(s,t,i)})},n.analyzeInner=function(e,o,i){var a=new r.ScraperBase,s=e.useCustom?a.customScrape(document.documentElement,e.custom,o,i):null,u=e.useGeneric?a.genericScrape(document.documentElement,e.generic,!1):t.Col.empty(),c=u,l=s?c.mergeCol(s.boxes):u,f=n.classify(l);if(1!=f.pageType){var d=a.attemptAltMainProductBox(u,i);if(d){var p=l.merge([d]);i&&console.log("Found alt main product box. reclassifying",d),f=n.classify(p)}}return i&&console.log("Classification "+r.PageType[f.pageType]+": "+f.typeReason),f},n.classify=function(e){var r,o=null,i=null,a=window.innerWidth*window.innerHeight,s=e.orderByDesc(function(e){return e.area}),u=s.getItem(0),c=u?u.area:0;if(0==s.length())r={type:0,reason:"No boxes found"};else if(1==e.length())r=c/a>.3?{type:1,reason:"Single box, large relative to window"}:{type:7,reason:"Single box, small relative to window"};else{var l=s.getItem(1),f=l.area;if(c/a>.3&&.8>f/c)r={type:1,reason:"First box larger than second AND is large relative to window"};else if(.6>f/c)r={type:1,reason:"Second largest box is relatively smaller than first"};else{var d=s.where(function(e){return e.area/c>=.8});r=d.length()>=Math.min(4,s.length())?{type:2,reason:"Four biggest boxes roughly same size"}:{type:7,reason:"Four biggest boxes differ in size"}}}if(1==r.type&&(o=s.getItem(0)),2==r.type&&(i=n.resolveSearchBox(s),i&&(r={type:3,reason:"List page + found search box"})),s.length()>0){var p=s.select(function(e){return t.Common.VisualHelper.getElementPosWithOffsets(e.element)}).orderBy(function(e){return e.top}).getItem(0);p&&p.top>window.innerHeight&&(r={type:6,reason:"List page + top boxes bellow the fold"})}return{boxes:s,mainBox:o,searchBox:i,pageType:r.type,typeReason:r.reason}},n.resolveSearchBox=function(r){var n=t.Col.ofJQueryElements(e.$('input[type="search"], input[type="text"]')),o=n.where(function(e){return e.offsetTop<200}).orderByDesc(function(t){return e.$(t).width()}),i=o.firstOrValue(null);return i&&i.value?{element:i,text:i.value}:null},n}();r.ProductBoxesAnalyzer=n}(r=t.ProductBoxes||(t.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(e,t,r){this.context=e,this.oldKeywords=t,this.oldPrice=r}return r.prototype.reportUnfulfilledCustom=function(t){e.Logger.Analytics.notify(this.context,e.Logger.Analytics.GENERIC,{subtype:"pb_missedcustom",selector_name:t.name},.01)},r.prototype.reportResult=function(r,n,o,i){var a=this.keywordsMapToString(r),s=this.keywordsMapToString(this.oldKeywords);e.Logger.log("Product boxes keywords: "+a),e.Logger.Analytics.notify(this.context,e.Logger.Analytics.GENERIC,{subtype:"pb_result",oldkeywords:s,oldprice:this.oldPrice.toString(),pbkeywords:a,pbprice:n.toString(),pagetype:t.PageType[o],pbreason:i,winsize:window.innerWidth+"x"+window.innerHeight},.01)},r.prototype.keywordsMapToString=function(e){var t=e.orderByDesc(function(e){return e.value}).take(r.MAX_WORDS).toMap(function(e){return e.key},function(e){return e.value}),n=e.where(function(e){return t.containsKey(e.key)}).select(function(e){return e.key}).stringJoin(".");return n},r.MAX_WORDS=10,r}();t.NotifyReporter=r}(t=e.ProductBoxes||(e.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function r(){}return r.Scrape=function(n,o){var i=new t.NotifyReporter(n,o.wordCounts,o.price),a=t.ProductBoxesAnalyzer.simpleAnalyze(i).then(function(t){var o=n.overrides().boolValue("productbox.newscrape",!1),a=o?r.scrapePBKeywords_new(t,i):r.scrapePBKeywords(t,i),s=a[0],u=a[1],c=e.StaticCol.where(s.getWords(),function(e){return!e.match(/^[\s]*$/)}),l=e.Common.WordUtils.countWords(c);return{wordCounts:l,price:u,source:"product-boxes"}});return a},r.scrapePBKeywords_new=function(t,r){var n=new e.Common.WordCounter,o=-1;if(0!=t.pageType){var i=t.boxes.multiOrderBy(.8,function(e){return-e.area},function(e){return e.rect.top},function(e){return e.rect.left}),a=i.getItem(0);n.pushAndAmplify(e.Common.WordUtils.getNonTrivialWords(a.mainText),"MainBox",1),o=a.price.value,i.skip(1).each(function(t){return n.pushAndAmplify(e.Common.WordUtils.getNonTrivialWords(t.mainText),"SupportBoxes",-1)}),t.searchBox&&t.searchBox.text&&n.pushAndAmplify(e.Common.WordUtils.getNonTrivialWords(t.searchBox.text),"SearhBox",-2)}return r&&r.reportResult(n.getWordMap(),o,t.pageType,t.typeReason),[n,o]},r.scrapePBKeywords=function(r,n){var o=new e.Common.WordCounter,i=-1;switch(r.pageType){case 1:var a=e.Common.WordUtils.getNonTrivialWords(r.mainBox.mainText);o.push(a,t.PageType[r.pageType]),i=r.mainBox.price.value;break;case 3:case 2:var s=r.boxes.groupBy(function(e){return(800*Math.round(e.area/800)).toString()}).orderByDesc(function(e){return e.value.length}).select(function(e){return e.value}).getItem(0),u=e.Col.of(s).take(7),c=u.selectMany(function(t){return e.Common.WordUtils.getNonTrivialWords(t.mainText)}).toArray();o.push(c,t.PageType[r.pageType]),3==r.pageType&&o.push(r.searchBox.text.split(" "),"Search Text",4),i=u.avg(function(e){return e.price.value});break;case 6:var l=r.boxes.orderBy(function(t){return e.Common.ImageUtils.distanceFromViewPortCenter(t.element)}).getItem(0);o.push(e.Common.WordUtils.getNonTrivialWords(l.mainText),t.PageType[r.pageType]),i=l.price.value;break;case 7:var l=r.boxes.orderBy(function(e){return Math.sqrt(e.rect.top*e.rect.top+e.rect.left*e.rect.left)}).getItem(0);o.push(e.Common.WordUtils.getNonTrivialWords(l.mainText),t.PageType[r.pageType]),i=l.price.value}return n&&n.reportResult(o.getWordMap(),i,r.pageType,r.typeReason),[o,i]},r}();t.ProductBoxesDataGenerator=r}(t=e.ProductBoxes||(e.ProductBoxes={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(){}return r.prototype.flag=function(){return"pp"},r.prototype.dataKey=function(){return"CommerceDeals"},r.prototype.supportsStickyClassification=function(){return!0},r.prototype.classify=function(e){return t.namedWaterfall([{name:"specialcase",value:function(){return t.Vertical.CommerceHelper.classifyBySpecialCasesAndJunk(e)}},{name:"bwl",value:function(){return t.Vertical.CommerceHelper.classifyByBlackWhiteList(e)}},{name:"dict",value:function(){return t.Vertical.CommerceHelper.classifyByDictionaries(e)}},{name:"schemaorg",value:function(){return t.Vertical.CommerceHelper.classifyBySchemaOrg(e)}},{name:"ribbon",value:function(){return t.Vertical.CommerceHelper.classifyByProductImage(e)}}],function(e){return 0!=e}).alwaysThen(function(e,t){return t?{name:t.message,value:0}:e})},r.prototype.scrapeAndObtainData=function(e,r,n){var o=2*r.primaryCount+r.secondaryCount,i=null,a=this.dataFromPageOrDedicated(e),s=a.then(function(r){return t.Data.OffersApi.queryFromData(e,r)}),u=e.overrides().switchByRate("productbox.userate",0);if(u){var c=a.then(function(r){return t.ProductBoxes.ProductBoxesDataGenerator.Scrape(e,r)}),l=c.then(function(r){return t.Data.OffersApi.queryFromData(e,r)});i=l.then(function(r){return t.Data.OffersApi.queryApi(e,o,null,r)})}else i=t.resolve({offers:[],source:""});var f=i.then(function(r){return r.offers.length?t.resolve(r):s.then(function(r){return t.Data.OffersApi.queryApi(e,o,null,r)})}),d=this.retargetIfEmptyPageResult(e,f,o),p=d.then(function(o){var i=e.logic().flag()+"_"+e.visual.flag(),a=n.claimUniques(o.results,function(e){return e.url},i,r.primaryCount),s=n.cliamWithoutMarking(o.results,function(e){return e.url},r.secondaryCount,a),u=a.concat(s),c=t.Data.OffersApi.dealsFromOffers(e,u);return new t.Data.PlainDataResult(o.source,e,c)});return this.postProcessResults(e,p),p},r.prototype.dataFromPageOrDedicated=function(r){var n=this,o=window.location.host,i=t.Common.DedicatedHelper.tryScrpaePageByDedicated(o,r);return i.alwaysThen(function(o,i){var a=new e.NWPLegacy,s=null,u=r.overrides().boolValue("ribbon-find-image-big-or-second",!1);if(u){var c=t.Common.ImageUtils.findValidImagesBySize(0,4,!1);c.length>0&&(s=c[0])}else s=n.getFirstImgElement();var l=n.generateOfferesApiRequestDateFromScrapingOrDedicated(r,a,s,o);return l})},r.prototype.generateOfferesApiRequestDateFromScrapingOrDedicated=function(e,r,n,o){var i=e.overrides().boolValue("dedicated-part-of-scrape",!1),a=o&&this.dedicatedLooksValid(o),s={wordCounts:t.Map.emptyMap(),price:0,source:null};if(a&&!i){e.pushNotificationParam("hasDedicated","1"),t.Logger.info("Using dedicated"),s.wordCounts=o.wordCounts,s.source="dedicated";var u=this.dedicatedHasPrice(o)?o.clientPrice:r.PriceUtils.getPrice(n);s.price=u}else o?t.Logger.info("Using Dedicated as amlifier"):t.Logger.info("Using generic scrape"),s.wordCounts=t.Common.ScrapingLogics.entirePageScrape(e,n,o),s.price=r.PriceUtils.getPrice(n),s.source="generic-scrape";return s},r.prototype.getFirstImgElement=function(){var e=t.Common.ImageUtils.getFirstEcommerceImage(!0,!0);return e||(e=t.Common.ImageUtils.getFirstEcommerceImage(!0,!1)),e},r.prototype.retargetIfEmptyPageResult=function(e,r,n){var o=r.then(function(r){var o=null;if(r&&r.offers.length)o=t.resolve({source:r.source,results:r.offers});else{var i=t.Data.OffersApi.queryFromRetargeting(e);if(null==i)return t.resolve({source:null,results:[]});o=t.Data.OffersApi.queryApi(e,n,null,i).then(function(e){return{source:e.source,results:e.offers}})}return o});return o},r.prototype.postProcessResults=function(e,r){r.then(function(r){if(r.data.length){var n=r.data[0].keywords;t.Common.Retargeting.storeImpressionKeywords(e,n),t.StaticCol.each(r.data,function(r){r.onClick=function(){t.Common.Retargeting.storeClickKeywords(e,r.keywords);var n=new t.Common.Persistance;n.setValue("psclk",r.keywords).then(function(){var e=document.createElement("IMG");e.width=1,e.height=1,e.src="//secure.adnxs.com/seg?add=2785798&t=2",document.body.appendChild(e),n.testSet(!1)})}})}})},r.prototype.dedicatedLooksValid=function(e){var r=e.wordCounts.length()>1;return r||t.Logger.warn("Dedicated result too small. Will ignore: "+JSON3.stringify(e)),r},r.prototype.dedicatedHasPrice=function(e){var r=e.clientPrice&&e.clientPrice!=t.Common.DedicatedHelper.MAX_PRICE;return r||t.Logger.info("Dedicated didn't find a price"),r},r}();r.CommerceDealsLogic=n}(r=t.ExternalProducts||(t.ExternalProducts={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(t){function r(){t.apply(this,arguments)}return __extends(r,t),r.prototype.flag=function(){return"gpp"},r.prototype.classify=function(t){var r=e.Vertical.CommerceHelper.classifyByBlackWhiteList(t).then(function(e){return e}).alwaysThen(function(e,t){return t?-1:e});return e.toNamedPromise("bwl",r)},r}(t.CommerceDealsLogic);t.StrictCommerceDealsLogic=r}(t=e.ExternalProducts||(e.ExternalProducts={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.setCouponRevealed=function(t){var r=e.getCouponMarker(t);null==r&&(r={code:t,revealTimestamp:null,freshlyRevealed:null}),r.revealTimestamp=(new Date).getTime(),r.freshlyRevealed=!0,e.setCouponMarker(r)},e.setRevealedCouponSeen=function(t){var r=e.getCouponMarker(t);null==r&&(r={code:t,revealTimestamp:(new Date).getTime(),freshlyRevealed:null}),r.freshlyRevealed=!1,e.setCouponMarker(r)},e.createCouponMarker=function(e){var t=(new Date).getTime();return{code:e,revealTimestamp:t,freshlyRevealed:!0}},e.getCouponMarker=function(e){var t=null;try{var r=localStorage.getItem("cpn_rvl_"+e);return t=JSON3.parse(r),t.code?t:null}catch(n){}},e.setCouponMarker=function(e){var t=JSON3.stringify(e);localStorage.setItem("cpn_rvl_"+e.code,t)},e.setCouponRevealedMessage=function(t,r){e.setCouponsMessage("Coupon for "+r+" revealed. Copy / Paste '"+t+"' at checkout")},e.setCouponAppliedMessage=function(t,r){e.setCouponsMessage("Coupon for "+r+" has been applied. Enjoy!")},e.setCouponsMessage=function(e){localStorage.setItem("anounceCoupons",e)},e.pollCouponsMessage=function(){var e=localStorage.getItem("anounceCoupons");return e&&localStorage.removeItem("anounceCoupons"),e},e}();e.CouponsHelper=t}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.queryApi=function(r,n,o){var i=e.Logger.Reporting.resolveReportingProduct(r.logic().flag(),r.visual.flag()),a={rootUrl:r.paths().cachedApiRoot(),url:encodeURIComponent(o.join("|")),partnerId:r.params().partnerCode,countryCode:r.countryCode().toLowerCase(),hostName:encodeURIComponent(r.host()),limit:n,rp:i},s=e.Common.namedStringFormat("{rootUrl}/coupons/search?url={url}&hn={hostName}&partid={partnerId}&limit={limit}&c={countryCode}&rp={rp}",a);return e.jqGetPromise(s).then(function(e){var r=JSON3.parse(e);return window.FO_COUPON_TEST?t.testData.coupon:r.coupon})},t.couponsFromCouponOffers=function(t){var r=e.StaticCol.select(t,function(t){var r=t.couponCode?e.Common.CouponsHelper.getCouponMarker(t.couponCode):null,n=(new Date).getTime(),o=r&&n-r.revealTimestamp<2*e.Common.HOUR_SECONDS*1e3,i={url:t.url,title:t.title,description:t.description,merchant:t.merchant,merchantImage:t.merchantImage,code:t.couponCode,revealed:o,isDirect:!t.couponCode,part:t.part?t.part:"na",partialCode:t.couponCode?t.couponCode.replace(/^../,"XX"):null};return i});return r},t.testData={coupon:[{title:"Extra 15% off Sitewide",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Save additional 15% on your order when you apply the code at checkout, save up to 74%. Orders over $99 ship free. Excludes Sephora, Gift Cards, Services, Service Plans and other restrictions; see website for details.",score:15294,altTitle:"15% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"AFFSHOP1",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7126168/c?afsrc=1&up=2014-11-10-02-40"},{title:"Extra 20% off All Orders Using Store Credit Card",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Enter this code at checkout and get additional 20% discount on all orders using store credit card, get up to 40% total savings. Shipping is free on orders $99 or more. Restrictions may apply.",score:14842,altTitle:"20% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"VAULT",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7733390/c?afsrc=1&up=2014-11-10-02-40"},{title:"Free Shipping on All Orders $99 or More",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Get free shipping anywhere on orders of $99 or more. See website for details.",score:11663,fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/6848063/c?afsrc=1&up=2014-11-10-02-40"},{title:"10-15% off Apparel, Shoes, Accessories, Jewelry & Home",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Save 15% off apparel, shoes, accessories,fine jewelry & home and 10% off watches, furniture, mattresses, custom blinds and shades. Restrictions apply. Orders over $99 ship free. Limited time offer.",score:2476,altTitle:"15% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"FUNDEAL",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7121523/c?afsrc=1&up=2014-11-10-02-40"},{title:"Extra 15% off Sitewide",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Save additional 15% on your order when you apply the code at checkout, save up to 74%. Orders over $99 ship free. Excludes Sephora, Gift Cards, Services, Service Plans and other restrictions; see website for details.",score:15294,altTitle:"15% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"AFFSHOP1",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7126168/c?afsrc=1&up=2014-11-10-02-40"},{title:"Extra 20% off All Orders Using Store Credit Card",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Enter this code at checkout and get additional 20% discount on all orders using store credit card, get up to 40% total savings. Shipping is free on orders $99 or more. Restrictions may apply.",score:14842,altTitle:"20% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"VAULT",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7733390/c?afsrc=1&up=2014-11-10-02-40"},{title:"Free Shipping on All Orders $99 or More",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Get free shipping anywhere on orders of $99 or more. See website for details.",score:11663,fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/6848063/c?afsrc=1&up=2014-11-10-02-40"},{title:"10-15% off Apparel, Shoes, Accessories, Jewelry & Home",merchantDisplayUrl:"http://www.jcpenney.com",merchant:"jcpenney",description:"Save 15% off apparel, shoes, accessories,fine jewelry & home and 10% off watches, furniture, mattresses, custom blinds and shades. Restrictions apply. Orders over $99 ship free. Limited time offer.",score:2476,altTitle:"15% Off",fileName:"FirstOffer_US_Coupons_11102014.xml.gz",image:"http://cdn.savings.com/logo/4215555.png",couponCode:"FUNDEAL",merchantImage:"http://cdn.savings.com/logo/4215555.png",url:"http://www.savings.com/m/p/22441821/7121523/c?afsrc=1&up=2014-11-10-02-40"}]},t}();t.CouponsApi=r}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.classifyByWhiteList=function(r){var n=r.paths().dynamicContentRoot()+"/cu/cu",o=e.Common.BlackWhiteListHelper.breakdownHost(),i=t.breakUrlIntoComponents(document.location.protocol+"//"+document.location.host,document.location.pathname),a=t.breakUrlIntoComponents(document.location.host,document.location.pathname),s=t.breakUrlIntoComponents(document.location.host.replace("www.",""),document.location.pathname),u=o.concat(i).concat(a).concat(s);return e.Common.BlackWhiteListHelper.blackWhiteWeakMatch(e.Col.of(u).unique().toArray(),n)},t.breakUrlIntoComponents=function(e,t){for(var r=[e],n=t.split("/"),o=n.length;o>0;o--){var i=e+n.slice(0,o).join("/");r.push(i,i+"/")}return r},t}();t.CouponsHelper=r}(t=e.Vertical||(e.Vertical={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){this.couponUrlMatch=null}return t.prototype.supportsStickyClassification=function(){return!1},t.prototype.dataKey=function(){return"Coupons"},t.prototype.flag=function(){return"cpn"},t.prototype.classify=function(t){var r=this;if(0==document.location.host.indexOf("localhost")||window.FO_COUPON_TEST)return r.couponUrlMatch=["fo.dev"],e.toNamedPromise("test",e.resolve(1));var n=e.Vertical.CouponsHelper.classifyByWhiteList(t).then(function(e){return e.score>0&&(r.couponUrlMatch=e.match),e.score}).alwaysThen(function(e,t){return t?-1:e});return e.toNamedPromise("bwl",n)},t.prototype.scrapeAndObtainData=function(t,r,n){var o=this,i=2*r.primaryCount,a=e.Data.CouponsApi.queryApi(t,i,o.couponUrlMatch),s=a.then(function(i){var a=n.claimUniques(i,function(e){return e.url},o.flag(),r.totalCount()),s=e.Data.CouponsApi.couponsFromCouponOffers(a),u={rootCouponsUrl:o.couponUrlMatch};return new e.Data.PlainDataResult("api",t,s,u)});return s},t}();t.CouponsLogic=r}(t=e.ExternalProducts||(e.ExternalProducts={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.queryApi=function(r,n,o){var i=o.substr(-1);("/"==i||"#"==i)&&(o=o.substring(0,o.length-1));var a=r.countryCode().toLowerCase(),s=r.paths().cachedApiRoot()+"/cmpn/"+e.Common.Base64.encode(o)+"?c="+a;return e.jqGetPromise(s).then(function(e){var r="{}"!=e?JSON3.parse(e):{offers:[]};return window.FO_CAMPAIGN_TEST?t.testData.offers:r.offers})},t.campaignsFromCampaignOffers=function(t){var r=e.StaticCol.rand(t,function(e){var t={accountTitle:e.accountTitle,campaignTitle:e.campaignTitle,url:e.linkUrl,title:e.title,description:e.description,imageUrl:e.imageUrl,actionBtnTitle:e.actionBtnTitle,htmlTemplate:e.htmlTemplate,htmlScript:e.htmlScript,part:"na"};return t});return r},t.testData={offers:[{_id:"4k7jNAURSm6DCMy7h2QWcg",accountTitle:"Webfore Japan ",campaignTitle:"Hay Fever",title:"?????????????? ????????????! ??????1000???!! ??????  ",description:" offer1",linkUrl:"http://www.kafunsho.sg/kafunsho/?aff_id=fstofz&chan=kfs1",
imageUrl:"http://www.imageurlhost.com/images/celapw466g5za1pjls4.jpg",htmlTemplate:"",htmlScript:null},{_id:"AFlXkGD6QACfwxDvQLc9CA",accountTitle:"Webfore Japan ",campaignTitle:"Hay Fever",title:"?????????????? ????????????! ??????1000???!! ??????  ",description:"offer2",linkUrl:"http://www.kafunsho.sg/kafunsho/?aff_id=fstofz&chan=kfs3",imageUrl:"http://www.imageurlhost.com/images/gmcrq0qr9le3x0vi653f.jpg",htmlTemplate:"",htmlScript:null}]},t}();t.CampaignsApi=r}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(){function t(){}return t.prototype.supportsStickyClassification=function(){return!1},t.prototype.dataKey=function(){return"Campaigns"},t.prototype.flag=function(){return"cmp"},t.prototype.classify=function(r){var n=this;if(window.FO_CAMPAIGN_TEST)return this.forUrl="localhost",e.toNamedPromise("test",e.resolve(1));var o=r.paths().dynamicContentRoot()+"/cmpn/wl",i=t.breakUrlIntoComponents(document.location.protocol+"//"+document.location.host,document.location.pathname),a=e.Common.BlackWhiteListHelper.blackWhiteMatch(i,o,null,null).then(function(e){return n.forUrl=i[0],e.score}).alwaysThen(function(e,t){return t?-1:e});return e.toNamedPromise("Campaign bwl",a)},t.prototype.scrapeAndObtainData=function(t,r,n){var o=this,i=e.Data.CampaignsApi.queryApi(t,4,this.forUrl),a=i.then(function(r){o.apiResult=r;var n=e.Data.CampaignsApi.campaignsFromCampaignOffers(o.apiResult);return new e.Data.PlainDataResult("api",t,n)});return a},t.breakUrlIntoComponents=function(e,t){var r=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);null!=r&&r.length>2&&"string"==typeof r[2]&&r[2].length>0&&(e=r[2]);var n=[e];return n},t}();t.CampaignsLogic=r}(r=t.Logic||(t.Logic={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.matchToLocation=function(r){var n=t.searchEngineConfigs.first(function(e){return e.validateLocation(r)});return null==n&&e.Logger.log("Didnt match any search engine!"),n},t.googleConfig={name:"Google",validateLocation:function(e){var t=0==e.host.indexOf("www.google."),r=""==e.pathname||"/"==e.pathname||"/search"==e.pathname||"/webhp"==e.pathname;return t&&r},queryKey:"q",getParentElement:function(){return document.getElementById("rcnt")||document.getElementById("appbar")},cssName:"googleSearchBar"},t.bingConfig={name:"Bing",validateLocation:function(e){var t=0==e.host.indexOf("www.bing."),r=e.pathname.indexOf("/search")==e.pathname.length-6-1;return t&&r},queryKey:"q",getParentElement:function(){return document.getElementById("vm_res")||document.getElementById("b_content")||document.getElementsByClassName("Content").length&&document.getElementsByClassName("Content")[0]},cssName:"bingSearchBar"},t.yahooConfig={name:"Yahoo",validateLocation:function(e){var t=e.host.indexOf("search.yahoo.")>=0,r=0==e.pathname.indexOf("/search");return t&&r},queryKey:"p",getParentElement:function(){var e=document.getElementById("results"),t=document.getElementById("bd");return e&&"section"==e.tagName.toLowerCase()?e:t&&"document"==t.getAttribute("role")?t:null},cssName:"yahooSearchBar"},t.askConfig={name:"Ask",validateLocation:function(t){var r="www.ask.com"==t.hostname,n=e.StaticCol.contains(["/web","/pictures","/news","/youtube","/shopping"],t.pathname);return r&&n},queryKey:"q",getParentElement:function(){return document.getElementById("mrRSM")||document.getElementById("csaTop")},cssName:"askSearchBar"},t.aolConfig={name:"AOL",validateLocation:function(e){return 0==e.hostname.indexOf("search.aol.")},queryKey:"q",getParentElement:function(){return document.getElementById("c")},cssName:"aolSearchBar"},t.searchEngineConfigs=e.Col.of([t.askConfig]),t}();t.SearchEngines=r}(t=e.Common||(e.Common={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(){function t(){}return t.prototype.flag=function(){return"sk"},t.prototype.dataKey=function(){return"CommerceDeals"},t.prototype.supportsStickyClassification=function(){return!1},t.extractQuery=function(t){var r=document.location.hash.length>0?document.location.hash.substr(1):"",n=document.location.search.length>0?document.location.search.substr(1):"",o=e.Map.ofUrlString(r),i=e.Map.ofUrlString(n),a=o.get(t),s=i.get(t),u=a||s;return u?u.split(/[ +]/):[]},t.prototype.classify=function(t){var r=e.Common.SearchEngines.matchToLocation(document.location),n=null;return n=r?r.getParentElement()?e.toNamed("wl",2):e.toNamed("missing_element",-1):e.toNamed("no_sec",-1),e.resolve(n)},t.prototype.scrapeAndObtainData=function(r,n,o){var i=e.Common.SearchEngines.matchToLocation(document.location),a=i?t.extractQuery(i.queryKey):[];if(a&&a.length){var s=e.Data.OffersApi.queryFromGenericKeywords(a),u=e.Data.OffersApi.queryApi(r,n.totalCount(),t.SEARCH_CONTEXT_ADDITION,s),c=u.then(function(t){var n=e.Data.OffersApi.dealsFromOffers(r,t.offers);return new e.Data.PlainDataResult(t.source,r,n)});return c}var l=new e.Data.PlainDataResult("noquery",r,[]);return e.resolve(l)},t.SEARCH_CONTEXT_ADDITION="search",t}();t.SearchKeywordsLogic=r}(r=t.Logic||(t.Logic={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(){function t(){}return t.prototype.supportsStickyClassification=function(){return!0},t.prototype.dataKey=function(){return"Deals"},t.prototype.flag=function(){return"imgdeals"},t.prototype.classify=function(t){return e.namedWaterfall([{name:"specialcase",value:function(){return e.Vertical.CommerceHelper.classifyBySpecialCasesAndJunk(t)}},{name:"bwl",value:function(){return e.Vertical.CommerceHelper.classifyByBlackWhiteList(t)}},{name:"dict",value:function(){return e.Vertical.CommerceHelper.classifyByDictionaries(t)}},{name:"schemaorg",value:function(){return e.Vertical.CommerceHelper.classifyBySchemaOrg(t)}},{name:"ribbon",value:function(){return e.Vertical.CommerceHelper.classifyByProductImage(t)}}],function(e){return 0!=e}).alwaysThen(function(e,t){return t?{name:t.message,value:0}:e})},t.prototype.scrapeAndObtainData=function(t,r,n){var o=new e.Data.ImageDealGenerator("api",t);return e.resolve(o)},t}();t.ImageDealsLogic=r}(r=t.Logic||(t.Logic={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(t){function r(){t.apply(this,arguments)}return __extends(r,t),r.prototype.flag=function(){return"rb"},r.prototype.scrapeAndObtainData=function(t,r,n){var o=0,i=999,a=new e.Data.RibbonImageDealGenerator("api",t,o,i);return e.resolve(a)},r.prototype.selectPrimaryImage=function(){},r}(t.ImageDealsLogic);t.RibbonImageDealsLogic=r}(r=t.Logic||(t.Logic={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){}return t.prototype.setItem=function(r,n,o){if("userSettings"==n){var i=JSON.parse(o),a=r.getItem("fouhid");if("uuid"in i){var s=i.uuid;if(a&&s!=a)throw Error("UUID and legacy UUID mismatch");r.setItem("fouhid",s)}if("suspend"in i)for(var u=0;u<t.suspendIds.length;u++){var c=t.suspendIds[u].nwp,l=t.suspendIds[u].old;if(c in i.suspend){var f=i.suspend[c],d=r.getItem(a+"_"+l)?JSON.parse(r.getItem(a+"_"+l)):null;d||(d={}),"autoAppear"in f&&(d.autoAppear=f.autoAppear),"timestamp"in f&&(d.timestamp=f.timestamp),e.Logger.log("Replacing legacy "+JSON.stringify(d)+" with "+JSON.stringify(f)),r.setItem(a+"_"+l,JSON.stringify(d))}}}},t.prototype.getItem=function(r,n){if("userSettings"==n){var o=r.getItem("userSettings")?JSON.parse(r.getItem("userSettings")):{},i=r.getItem("fouhid");i&&(o.uuid=i);for(var a=0;a<t.suspendIds.length;a++){var s=t.suspendIds[a].nwp,u=t.suspendIds[a].old,c=r.getItem(i+"_"+u)?JSON.parse(r.getItem(i+"_"+u)):null,l=c&&"timestamp"in c?c.timestamp:null;l&&(o.suspend||(o.suspend={}),o.suspend[s]||(o.suspend[s]={}),o.suspend[s].timestamp=l);var f=c&&"autoAppear"in c?0==c.autoAppear:null;f&&(o.suspend||(o.suspend={}),o.suspend[s]||(o.suspend[s]={}),o.suspend[s].autoAppear=!f)}var d=!0;for(var p in o){d=!1;break}return d?null:(e.Logger.log("Returning "+JSON.stringify(o)+" for legacy considerations"),o)}return null},t.suspendIds=[{nwp:"RIGHT_PANEL",old:"foss"},{nwp:"BOTTOM_PANEL",old:"fobs"},{nwp:"MAIN_TABLE",old:"fomt"},{nwp:"IMAGE_RIGHT",old:"forb"},{nwp:"IMAGE_INNER",old:"fogb"}],t}();t.LegacyTranslationTable=r}(t=e.Extras||(e.Extras={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(e){function r(r,n){e.call(this),this.offers=[];var i=t.StaticCol.select(n,function(e){return new o(r,e)});this.offers=i,this.context=r}return __extends(r,e),r}(r.ModelBase);r.CouponsModel=n;var o=function(r){function n(t,n){r.call(this,t,n),this.isRevealed=e.ko.observable(!1),this.isRevealed(n.revealed)}return __extends(n,r),n.prototype.onClick=function(r,n){if(n&&n.preventDefault(),!r.clickNotified){r.clickNotified=!0;var o={};o.title=r.offer.title.substring(0,40),o.p=r.offer.part,o.cpntype=r.offer.code?"code":"coupon",t.Logger.Analytics.notify(r.context,t.Logger.Analytics.CLICK,o),r.offer.onClick&&r.offer.onClick()}if(r.offer.isDirect)r.windowOpen(r.url,"_blank"),t.Common.CouponsHelper.setCouponRevealed(""),t.Common.CouponsHelper.setCouponAppliedMessage(r.offer.code,r.offer.title);else if(!r.offer.revealed){var i=e.$('<iframe width="0" height="0"></iframe>');i.attr("src",r.url),t.Common.VisualHelper.appendToBody(i),t.Common.CouponsHelper.setCouponRevealed(r.offer.code),t.Common.CouponsHelper.setCouponRevealedMessage(r.offer.code,r.offer.title),r.isRevealed(!0)}},n}(r.GenericOfferModel);r.CouponModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(e){function r(r,n){e.call(this),this.offers=[];var i=t.StaticCol.select(n,function(e){return new o(r,e)});this.offers=i,this.context=r}return __extends(r,e),r}(r.ModelBase);r.CampaignsModel=n;var o=function(r){function n(t,n){r.call(this,t,n),this.isRevealed=e.ko.observable(!1),n.actionBtnTitle||(n.actionBtnTitle="Read More")}return __extends(n,r),n.prototype.getOpenTarget=function(){return"_self"},n.prototype.onClick=function(e,r){if(r&&r.preventDefault(),!e.clickNotified){e.clickNotified=!0;var n={};e.offer.accountTitle&&(n.acttl=e.offer.accountTitle),e.offer.campaignTitle&&(n.cmpnttl=e.offer.campaignTitle),e.offer.title&&(n.ofrttl=e.offer.title),e.offer.price&&(n.prc=e.offer.price),e.offer.begrp&&(n.begrp=e.offer.begrp),t.Logger.Analytics.notify(e.context,t.Logger.Analytics.CLICK,n),e.offer.onClick&&e.offer.onClick()}var o=window.open(e.url);o.focus()},n}(r.GenericOfferModel);r.CampaignModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(n){function o(o,i,a,s,u,c,l,f,d,p,h){var m=this;n.call(this,o,c,l),this.deals=e.ko.observable(),this.coupons=e.ko.observable(),this.campaigns=e.ko.observable(),this.hasDeals=e.ko.computed(function(){return m.deals()&&m.deals().offers.length>0}),this.hasCoupons=e.ko.computed(function(){return m.coupons()&&m.coupons().offers.length>0}),this.hasCampaigns=e.ko.computed(function(){return m.campaigns()&&m.campaigns().offers.length>0}),this.selectedTab=e.ko.observable(0),this.dealsDisplayed=!1,this.couponsDisplayed=!1,this.campaignsDisplayed=!1,this.revealedCoupons=e.ko.observable(0),this.moreDealsUrl=e.ko.observable(),this.couponsMessage=e.ko.observable(),this.visibleItems=e.ko.observable(0),this.dealScroll=e.ko.computed(function(){return m.deals()&&m.deals().offers.length>m.visibleItems()}),this.couponScroll=e.ko.computed(function(){return m.coupons()&&m.coupons().offers.length>m.visibleItems()}),i=this.pushTenticaJumper(o,i);var g=i?new r.DealsModel(a,i):new r.DealsModel(null,[]),v=s?new r.CouponsModel(u,s):new r.CouponsModel(null,[]),y=d?new r.CampaignsModel(p,d):new r.CampaignsModel(null,[]);this.deals(g),this.coupons(v),this.campaigns(y),this.setPanelMaxHeight(o,h),this.setPanelVisibilityAndBadges(g,v,y,f,o),this.setMoreDealsTarget(g),this.setRevealedCoupons(v),this.setBadgePlacements(this.deals(),this.coupons(),this.campaigns()),this.strings=t.Common.LocaleHelper.getStringMapForCountry(o.countryCode(),t.Locale.sliderStrings)}return __extends(o,n),o.prototype.setPanelMaxHeight=function(t,r){this.visibleItems(t.overrides().intValue("panel.visible.items",r));var n=8*(this.visibleItems()-1),o=this.visibleItems()*this.itemHeight();this.maxHeight=e.ko.computed(function(){return o+n})},o.prototype.pushTenticaJumper=function(e,r){var n=e.overrides().floatValue("deals.tenticajumper",0),o=Math.random()<n;if(o){var i={thumb:"",ribbon:"",title:"Get the total shopper app for your android smartphone",price:"FREE",merchantThumb:"",merchantText:"*With this invitation only",part:"tentica",keywords:"",attribution:"",url:"//play.google.com/store/apps/details?id=com.mobile.coupons&rdid=com.mobile.coupons&referrer=utm_campaign%3Dfoffer",className:"tenticaOffer",onClick:function(){return t.Logger.Analytics.notify(e,t.Logger.Analytics.GENERIC,{subtype:"tnt_click"})},originalPrice:"",discount:0,rating:0};t.Logger.Analytics.notify(e,t.Logger.Analytics.GENERIC,{subtype:"tnt_impression"}),r?r.unshift(i):r=[i]}return r},o.prototype.setBadgePlacements=function(e,t,r){var n=93,o=95;t&&t.offers.length&&(t.cssBadgeTop=n+"px",n+=o),r&&r.offers.length&&(r.cssBadgeTop=n+"px",n+=o),e&&e.offers.length&&(e.cssBadgeTop=n+"px")},o.prototype.setPanelVisibilityAndBadges=function(e,r,n,o,i){var a=-1,s=i.overrides().boolValue("useCampaigns1st",!1);if(s){if(r&&r.offers.length){var u=t.Common.CouponsHelper.pollCouponsMessage();u&&(a=1,this.couponsMessage(u))}if(e&&e.offers.length&&-1==a)a=0;else if(n&&n.offers.length&&-1==a)a=2;else if(r&&r.offers.length&&-1==a)a=1;else if(-1==a)throw new Error("Neither Deals, Coupons or Campaigns provided")}else{if(r&&r.offers.length){var u=t.Common.CouponsHelper.pollCouponsMessage();(u||o)&&(a=1,this.couponsMessage(u))}if(e&&e.offers.length&&-1==a)a=0;else if(r&&r.offers.length&&-1==a)a=1;else if(n&&n.offers.length&&-1==a)a=2;else if(-1==a)throw new Error("Neither Deals, Coupons or Campaigns provided")}this.selectTab(a,!1)},o.prototype.setMoreDealsTarget=function(e){e.offers.length?this.moreDealsUrl("http://bestdealwiz.com/productlist.html?q="+e.offers[0].offer.keywords.split(" ").join("+")):this.moreDealsUrl("http://bestdealwiz.com/index.html")},o.prototype.setRevealedCoupons=function(e){this.revealedCoupons(t.StaticCol.count(e.offers,function(e){return e.offer.revealed}))},o.prototype.selectTab=function(e,r){if(void 0===r&&(r=!0),this.selectedTab(e),r&&this.collapsed(!1),0!=e||this.dealsDisplayed||(this.dealsDisplayed=!0,t.Logger.Analytics.notify(this.deals().context,t.Logger.Analytics.IMPRESSION,{kwds:this.deals().offers[0].offer.keywords})),1!=e||this.couponsDisplayed||(this.couponsDisplayed=!0,t.Logger.Analytics.notify(this.coupons().context,t.Logger.Analytics.IMPRESSION)),2==e&&!this.campaignsDisplayed){this.campaignsDisplayed=!0;for(var n=[],o=0;o<this.campaigns().offers.length;o++)n.indexOf(this.campaigns().offers[o].offer.campaignTitle)<0&&n.push(this.campaigns().offers[o].offer.campaignTitle);t.Logger.Analytics.notify(this.campaigns().context,t.Logger.Analytics.IMPRESSION,{cmpnimpr:n.join("|")})}},o.prototype.itemHeight=function(){return 125},o}(r.ProductModelBase);r.PanelModel=n}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.prototype.afterRender=function(t){var r=t.find(".fo-code-slide-text");r.click(function(t){e.selectText(t.target)})},e.selectText=function(e){var t=document.body;if(window.getSelection){var r=window.getSelection(),n=document.createRange();n.selectNodeContents(e),r.removeAllRanges(),r.addRange(n)}else if(t.createTextRange){var o=t.createTextRange();o.moveToElementText(e),o.select()}},e}();e.CouponTextSelectHandler=t}(t=e.DisplayHandlers||(e.DisplayHandlers={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(t){var r=function(){function t(){}return t.prototype.afterRender=function(r){e.$("body").click(function(e){return t.checkCloseSuspendBox(e,r)}),r.click(function(e){return t.checkCloseSuspendBox(e,r)}),r.find(".fo-suspend.fo-tools-btn").click(function(e){return t.openSuspendBox(e,r)}),r.find(".fo-suspend-close-button.fo-tooltip-btn").click(function(e){return t.closeSuspendBox(e,r)})},t.openSuspendBox=function(t,r){var n=e.$(t.target).closest(".fo-suspend-close-button.fo-tooltip-btn").length>0;n||r.find(".fo-suspend-tooltip").addClass("shown"),t.stopPropagation()},t.checkCloseSuspendBox=function(r,n){var o=e.$(r.target).closest(".fo-suspend-tooltip").length>0;o||t.closeSuspendBox(r,n)},t.closeSuspendBox=function(e,t){t.find(".fo-suspend-tooltip").removeClass("shown"),e.stopPropagation()},t}();t.SuspendBoxHandler=r}(r=t.DisplayHandlers||(t.DisplayHandlers={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.prototype.afterRender=function(e){try{e.find(".elps").dotdotdot()}catch(t){}},e}();e.EllipsisHandler=t}(t=e.DisplayHandlers||(e.DisplayHandlers={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n;!function(n){var o=function(){function n(){this.element=null,this.model=null}return n.prototype.config=function(){throw new Error("Config Not implemented")},n.prototype.realEstate=function(){return this.config().realEstate},n.prototype.flag=function(){return this.config().flag},n.prototype.determineNeededItemCount=function(e){var t=this.config().primaryItemCount,n=this.config().secondaryItemCount;if(t||n)return new r.ItemCounts(t||0,n||0);throw new Error("Item counts not implemented")},n.prototype.getParentElement=function(){return document.documentElement.getElementsByTagName("body")[0]},n.prototype.declareResourcesPromise=function(e){return{templates:t.Common.Res.bring(e.paths().innerResourcesRoot()+"/Resources/templates.html"),css:t.Common.Res.injectCss2(this.cssUrl(e))}},n.prototype.declareDisplayHandlers=function(e){return[new t.DisplayHandlers.EllipsisHandler,new t.DisplayHandlers.SuspendBoxHandler,new t.DisplayHandlers.CouponTextSelectHandler]},n.prototype.cssUrl=function(e){return e.paths().innerResourcesRoot()+"/Resources/"+this.config().rootCssFile},n.prototype.getLegacySuspension=function(e){var r=t.Col.of(t.Extras.LegacyTranslationTable.suspendIds).first(function(t){return t.nwp==e}),n=r?r.old:"suspend_"+e;return n},n.prototype.draw=function(n,o,i){var a=this,s=o.CommerceDeals,u=s?s.data:null,c=s?s.context:null,l=o.Coupons,f=l?l.data:null,d=l?l.context:null,p=l?this.isOnCouponsWhitelist(l):!1,h=o.Campaigns,m=h?h.data:null,g=h?h.context:null,v=c||d||g,y=i.templates,b=e.$(y);t.Common.VisualHelper.appendToBody(b);var C=this.declareDisplayHandlers(v),w=r.VisualRealEstate[this.realEstate()],S=this.getLegacySuspension(w),_=new t.Model.PanelModel(c||d||g,u,c,f,d,w,S,p,m,g,this.visibleItems());_.cssUrl=this.cssUrl(v),_.cssName=this.config().rootCssClass;var E=e.$("<div data-bind=\"template: '"+this.config().rootTemplate+"'\"></div>"),O=E[0],F=this.getParentElement();t.Common.VisualHelper.safeAppend(F,E,this.config().appendFirst),_.postRenderHandler=function(e,r){t.Col.of(C).each(function(t){return t.afterRender(e,r)})},_.onClose=function(){t.Col.of(C).each(function(e){return e.remove&&e.remove()}),e.$(a.element).remove()};try{e.ko.applyBindings(_,O),t.Logger.Analytics.notify(v,t.Logger.Analytics.GENERIC,{subtype:"postwo"},.01)}catch(k){throw t.Col.of(C).each(function(e){return e.remove&&e.remove()}),E.remove(),k}return this.element=O,this.model=_,t.resolve(O)},n.prototype.isOnCouponsWhitelist=function(e){var t=document.location.host+document.location.pathname;t=t.replace(/www\.|\/$/g,"");var r=e.extras.rootCouponsUrl;return-1!=r.indexOf(t)},n.prototype.remove=function(e){this.model.onClose()},n.prototype.visibleItems=function(){return 9999},n}();n.GenericPanelVisual=o}(n=r.Visual||(r.Visual={}))}(r=t.Products||(t.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(e){this.mouseOverElement=!1,this.cleanup=[];var t=e.overrides().boolValue("rightslider.scroll-sync",!0),r=e.overrides().boolValue("rightslider.scroll-arrows",!0),n=e.overrides().intValue("rightslider.scroll-auto",6e3),o=e.overrides().boolValue("rightslider.scroll-independent",!0),i=e.overrides().boolValue("rightslider.scroll-peekaboo",!1),a=["fo-deals-tab","fo-coupons-tab"];this.tabClasses=a,this.syncToPage=t,this.autoScroll=n,this.scrollIndepandent=o,this.peekaboo=i,this.scrollArrows=r,this.directionalHelper={lengthFn:function(e){return e.height()},positionProperty:"margin-top"}}return r.prototype.afterRender=function(e){var n=this,o=!!window.FO_NOSCROLL;o||(t.Col.of(n.tabClasses).each(function(t){var o=e.find("."+t);r.scrollTabToIndex(n,o,0)}),e.hover(function(){return n.mouseOverElement=!0},function(){return n.mouseOverElement=!1}),this.syncToPage&&this.setupSyncToPage(e),this.scrollArrows&&this.setupScrollArrows(e),this.autoScroll&&this.setupAutoScroll(e),this.scrollIndepandent&&this.setupIndependentScroll(e),this.peekaboo&&this.setupPeekaboo(e))},r.prototype.remove=function(){t.StaticCol.each(this.cleanup,function(e){return e()})},r.prototype.setupSyncToPage=function(t){var n=this;r.syncScrollToPage(n,t);var o=function(){return r.syncScrollToPage(n,t)};e.$(window).scroll(o),n.cleanup.push(function(){return e.$(window).off("scroll",o)})},r.prototype.setupScrollArrows=function(t){var n=this;t.find(".fo-scroll-btn").each(function(t,o){e.$(o).click(function(t){var o=e.$(t.target),i=o.closest(".fo-tab"),a=parseInt(o.attr("data-scroll-step"));r.scrollTabByStep(n,i,a)})})},r.prototype.setupAutoScroll=function(e){var n=this,o=window.setInterval(function(){n.mouseOverElement||t.Col.of(n.tabClasses).each(function(t){var o=e.find("."+t),i=o.data("fo-current-scroll-index"),a=r.scrollTabToIndex(n,o,i+1,"slow");a||r.scrollTabToIndex(n,o,0,"slow")})},this.autoScroll);n.cleanup.push(function(){return clearInterval(o)})},r.prototype.setupIndependentScroll=function(n){var o=this,i=function(e){if(o.mouseOverElement){e.preventDefault(),e.cancelBubble=!0,e.stopPropagation();var i=e.originalEvent.wheelDeltaY<0?1:-1;t.Col.of(o.tabClasses).each(function(e){var t=n.find("."+e),a=t.data("fo-current-scroll-index");r.scrollTabToIndex(o,t,a+i,"fast")})}};e.$(window).on("mousewheel",i),o.cleanup.push(function(){return e.$(window).off("mousewheel",i)})},r.prototype.setupPeekaboo=function(e){var n=this;t.Col.of(n.tabClasses).each(function(t){var o=e.find("."+t);r.scrollTabToIndex(n,o,1,"slow"),window.setTimeout(function(){return r.scrollTabToIndex(n,o,0,"slow")},1500)})},r.syncScrollToPage=function(e,n){t.Col.of(e.tabClasses).each(function(t){var o=n.find("."+t);r.syncTabScrollToPage(e,o)})},r.syncTabScrollToPage=function(t,n){var o=e.$(document).height(),i=e.$(window).scrollTop(),a=i/o,s=n.find(".fo-list li"),u=Math.round(s.length*a);r.scrollTabToIndex(t,n,u)},r.scrollTabToIndex=function(e,t,r,n){void 0===n&&(n="fast");var o=t.find(".fo-list"),i=o.find("li"),a=e.directionalHelper.lengthFn(o),s=(a+8)/i.length,u=e.directionalHelper.lengthFn(t.find(".fo-list-wrapper")),c=Math.round(u/s);if(r>=0&&r<=i.length-c){var l=t.data("fo-current-scroll-index");if(r!=l){var f=r*s,d={};return d[e.directionalHelper.positionProperty]="-"+f+"px",o.stop(),o.animate(d,n),t.data("fo-current-scroll-index",r),t.find(".fo-scroll-up").toggleClass("fo-active",r>0),t.find(".fo-scroll-down").toggleClass("fo-active",r<i.length-c),!0}}return!1},r.scrollTabByStep=function(e,t,n){var o=t.data("fo-current-scroll-index");r.scrollTabToIndex(e,t,o+n)},r}();r.ScrollHandler=n}(r=t.DisplayHandlers||(t.DisplayHandlers={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(t){function r(){t.apply(this,arguments)}return __extends(r,t),r.prototype.declareDisplayHandlers=function(r){var n=t.prototype.declareDisplayHandlers.call(this,r),o=new e.DisplayHandlers.ScrollHandler(r);return n.push(o),n},r.prototype.config=function(){var e=!!window.FO_MOREOFFERS;return{realEstate:1,flag:"rsy",rootTemplate:"right-slider-template2",rootCssFile:e?"altRightSlider.css":"rightSlider.css",rootCssClass:"fo-right-sliderx",appendFirst:!1,primaryItemCount:4,secondaryItemCount:8}},r.prototype.visibleItems=function(){var e=!!window.FO_MOREOFFERS;return e?5:4},r}(t.GenericPanelVisual);t.RightSliderY=r}(r=t.Visual||(t.Visual={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(){function r(e){this.cssUrl=e}return r.prototype.afterRender=function(e){t.Common.Res.injectCss2(this.cssUrl)},r.prototype.remove=function(){e.$("link[rel='stylesheet'][href='"+this.cssUrl+"']").prop("disabled",!0)},r}();r.TransiantCSSHandler=n}(r=t.DisplayHandlers||(t.DisplayHandlers={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(t){function r(){t.apply(this,arguments)}return __extends(r,t),r.prototype.config=function(){return{realEstate:2,flag:"tby",rootTemplate:"generic-horizontal-template2",rootCssFile:"topBar.css",rootCssClass:"fo-top-barx",appendFirst:!1,primaryItemCount:4,secondaryItemCount:4}},r.prototype.declareDisplayHandlers=function(r){var n=r.paths().innerResourcesRoot()+"/Resources/topBarPushBody.css",o=new e.DisplayHandlers.TransiantCSSHandler(n),i=t.prototype.declareDisplayHandlers.call(this,r);return i.push(o),i},r}(t.GenericPanelVisual);t.TopBarY=r}(r=t.Visual||(t.Visual={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r;!function(t){var r=function(t){function r(){t.apply(this,arguments)}return __extends(r,t),r.prototype.config=function(){var t=e.Common.SearchEngines.matchToLocation(document.location);return{realEstate:10,flag:"sby",rootTemplate:"generic-horizontal-template2",rootCssFile:t&&t.cssName+".css",rootCssClass:"fo-search-barx",appendFirst:!0,primaryItemCount:3,secondaryItemCount:0}},r.prototype.getParentElement=function(){var t=e.Common.SearchEngines.matchToLocation(document.location);return t&&t.getParentElement()},r}(t.GenericPanelVisual);t.SearchBarY=r}(r=t.Visual||(t.Visual={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.config=function(){return{realEstate:2,flag:"tsy",rootTemplate:"generic-horizontal-template2",rootCssFile:"topSlider.css",rootCssClass:"fo-top-sliderx",appendFirst:!1,primaryItemCount:4,secondaryItemCount:0}},t}(e.GenericPanelVisual);e.TopSliderY=t}(t=e.Visual||(e.Visual={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.config=function(){return{realEstate:3,flag:"bsy",rootTemplate:"bottom-slider-template",rootCssFile:"bottomSlider.css",rootCssClass:"fo-bottom-sliderx",appendFirst:!1,primaryItemCount:4,secondaryItemCount:0}},t}(e.GenericPanelVisual);e.BottomSliderY=t}(t=e.Visual||(e.Visual={}))}(t=e.Products||(e.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(r){function n(t,n,o,i){void 0===o&&(o=0),void 0===i&&(i=999),r.call(this,t,n),this.validImages=e.Common.ImageUtils.findValidImagesBySize(o,i,!1)||[]}return __extends(n,r),n.prototype.generateData=function(r,n,o){var i=e.Common.ScrapingLogics.imageScrapeLogicWithSupporting(this.context,r,this.validImages),a={wordCounts:i,price:-1,source:"api"},s=t.OffersApi.queryFromData(n,a);return t.OffersApi.queryApi(n,o.totalCount(),null,s).then(function(e){return t.OffersApi.dealsFromOffers(n,e.offers)})},n.prototype.hasData=function(){return this.validImages.length>0},n}(t.StubDataResult);t.ImageDealGenerator=r}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=function(n){function i(i,a,s,u,c){var l=this;void 0===c&&(c=function(){}),n.call(this,i.context,a,s,c),this.buttons=e.ko.observableArray(),this.deals=e.ko.observable(),this.selectedTab=e.ko.observable(0),this.hasDeals=e.ko.computed(function(){return l.deals()&&l.deals().offers.length>0}),this.dealScroll=e.ko.observable(!1),this.hasCoupons=e.ko.observable(!1),this.hasCampaigns=e.ko.observable(!1),this.couponsMessage=e.ko.observable(""),this.moreDealsUrl=e.ko.observable(""),this.modalTarget=e.ko.observable(),this.isWindowOpen=e.ko.computed(function(){return null!=l.deals()}),this.visibleRows=e.ko.observable(0);var f=this;this.strings=t.Common.LocaleHelper.getStringMapForCountry(i.context.countryCode(),t.Locale.sliderStrings),this.bodyRect=e.ko.observable(null);var d=function(){var r=l.context.scraper().getElementPosWithOffsets(e.$("body")[0]);f.bodyRect()&&t.Common.isEquivalent(r,f.bodyRect())||f.bodyRect(r)};window.setInterval(d,1e3),d();var p=t.Col.of(i.validImages),h=p.select(function(e){var n=l,a=function(){return i.generateData(e,i.context,new t.Products.ItemCounts(0,10))},s=function(e){var t=new r.DealsModel(n.context,e.data());n.modalTarget(e.target()),n.deals(t)};return new o(e,a,s,n.bodyRect)});this.buttons(h.toArray()),this.suspendTarget.closeFn=this.onClose,this.isWindowOpen.subscribe(function(e){return e&&t.Logger.Analytics.notify(f.context,t.Logger.Analytics.IMPRESSION)}),this.setModalMaxHeight(i.context,u)}return __extends(i,n),i.prototype.setModalMaxHeight=function(t,r){this.visibleRows(t.overrides().intValue("modal.visible.rows",r));var n=8*(this.visibleRows()-1),o=this.visibleRows()*this.rowHeight();this.maxHeight=e.ko.computed(function(){return o+n})},i.prototype.onWindowOpenChange=function(e){e&&t.Logger.Analytics.notify(this.context,t.Logger.Analytics.IMPRESSION)},i.prototype.hide=function(){this.dismissWindow()},i.prototype.dismissWindow=function(){this.deals(null)},i.prototype.rowHeight=function(){return 125},i}(r.ProductModelBase);r.GenericButtonModel=n;var o=function(){function r(n,o,i,a){var s=this;this.displayDelay=e.ko.observable(1e3),this.selfHoverStart=0,this.target=e.ko.observable(),this.isLoading=e.ko.observable(!1),this.data=e.ko.observable(null),this.hasNoResults=e.ko.computed(function(){return s.data()&&0==s.data().length}),this.buttonText=e.ko.computed(function(){return s.hasNoResults()?"No deals":s.data()||!s.isLoading()?"Compare":"Loading..."}),this.isTargetHovered=e.ko.observable(!1),this.isSelfHovered=e.ko.observable(!1),this.isVisible=e.ko.computed(function(){return window.FO_ALWAYSON||s.isTargetHovered()||s.isSelfHovered()}),this.generator=null;var u=this;this.target(e.$(n)),this.generator=o,this.bodyRect=a,this.displayWidnowFn=function(e){u.isTargetHovered(!1),u.isSelfHovered(!1),i(e)},this.attachHandlers(n),this.buttonPosition=e.ko.computed(function(){return u.isTargetHovered(),u.bodyRect(),r.calcButtonPosition(u.target()[0])}),
this.targetRect=e.ko.computed(function(){return u.isTargetHovered(),u.bodyRect(),t.Common.VisualHelper.getElementPosWithOffsets(u.target()[0])}),this.isSelfHovered.subscribe(function(e){if(e)u.selfHoverStart=(new Date).getTime();else{var t=(new Date).getTime()-u.selfHoverStart;t<u.displayDelay()&&u.delayedHoverTimeoutId&&clearTimeout(u.delayedHoverTimeoutId)}})}return r.prototype.attachHandlers=function(r){var n=this;e.$(r).mouseenter(function(e){n.isTargetHovered(!0)}),e.$(document.body).mouseover(function(e){n.isTargetHovered()&&(t.Common.VisualHelper.isContained(e.pageX,e.pageY,n.targetRect())||n.isTargetHovered(!1))})},r.prototype.displayAfterDelay=function(){var e=this;this.hasNoResults()||window.FO_DONT_OPEN||(this.data()||this.isLoading()||(this.isLoading(!0),this.loadData()),this.delayedHoverTimeoutId=setTimeout(function(){e.display()},this.displayDelay()))},r.prototype.display=function(){var e=this;this.hasNoResults()||window.FO_DONT_OPEN||(this.data()?this.displayWidnowFn(this):this.isLoading()||(this.isLoading(!0),this.loadData().then(function(){return e.displayWidnowFn(e)})))},r.prototype.loadData=function(){var e=this;return this.generator().then(function(r){t.Logger.log("Generator returned "+r.length),e.isLoading(!1),e.data(r)})},r.calcButtonPosition=function(e){var r=t.Common.VisualHelper.getElementPosWithOffsets(e);if(r){var n=r.left+r.width/2,o=r.top+40;return{x:n,y:o}}return{x:0,y:0}},r}();r.CompareButtonModel=o}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n;!function(n){var o=function(){function n(){this.element=null}return n.prototype.realEstate=function(){return 7},n.prototype.flag=function(){return"gby"},n.prototype.determineNeededItemCount=function(e){return new r.ItemCounts(0,10)},n.prototype.declareResourcesPromise=function(e){return{panel_css:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Resources/multiButton.css"),templates:t.Common.Res.bring(e.paths().innerResourcesRoot()+"/Resources/templates.html")}},n.prototype.getOldSuspensionIdentifer=function(){return"forb"},n.prototype.getMainCssClass=function(){return"fo-iframe-right-slider"},n.prototype.getParentElement=function(){return document.documentElement.getElementsByTagName("body")[0]},n.prototype.draw=function(n,o,i){var a=this,s=o.Deals,u=t.Col.of([new t.DisplayHandlers.EllipsisHandler,new t.DisplayHandlers.SuspendBoxHandler]),c=i.templates,l=e.$(c);t.Common.VisualHelper.appendToBody(l);var f=e.$("<div data-bind='template: \"multibutton-template\"'></div>"),d=f[0];this.element=d,t.Common.VisualHelper.appendToBody(f);var p=function(){u.each(function(e){return e.remove&&e.remove()}),e.$(a.element).remove()},h=r.VisualRealEstate[this.realEstate()],m=this.getOldSuspensionIdentifer(),g=new t.Model.GenericButtonModel(s,h,m,this.visibleRows(),p);return g.cssUrl=s.context.paths().innerResourcesRoot()+"/Resources/multiButton.css",g.cssName="fo-modal-panel",g.postRenderHandler=function(e,t){u.each(function(r){return r.afterRender(e,t)})},e.ko.applyBindings(g,d),t.resolve(null)},n.prototype.remove=function(t){e.$(this.element).remove()},n.prototype.visibleRows=function(){return 3},n}();n.GenericButtonY=o}(n=r.Visual||(r.Visual={}))}(r=t.Products||(t.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(r){function n(e,t,n,o){void 0===n&&(n=0),void 0===o&&(o=999),r.call(this,e,t),this.validImages=[],this.imageHowMany=o,this.imageStartFrom=n}return __extends(n,r),n.prototype.generateData=function(r,n,o){this.genValidImages();var i=e.Common.ScrapingLogics.imageScrapeLogic(n,r),a={wordCounts:i,price:-1,source:"api"},s=t.OffersApi.queryFromData(n,a);return t.OffersApi.queryApi(n,o.totalCount(),null,s).then(function(e){return t.OffersApi.dealsFromOffers(n,e.offers)})},n.prototype.hasData=function(){return!0},n.prototype.genValidImages=function(){return this.validImages=e.Common.ImageUtils.findValidImagesBySize(this.imageStartFrom,this.imageHowMany,!1)||[],this.validImages},n}(t.StubDataResult);t.RibbonImageDealGenerator=r}(t=e.Data||(e.Data={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n=(t.Common.RibbonSize,function(){function e(){}return e.getDimensions=function(e){switch(e){case 0:return{width:61,height:71};case 1:return{width:71,height:81};case 2:return{width:104,height:114}}},e.ribbonSizeToString=function(e){switch(e){case 0:return"Small";case 1:return"Medium";case 2:return"Large"}},e}()),o=function(n){function o(r,o,i,a,s){void 0===s&&(s=function(){}),n.call(this,r.context,o,i,s),this.ribbons=e.ko.observableArray(),this.imageToRibbonDic=[],this.primaryRibbon=e.ko.observable(null),this.modalTarget=e.ko.observable(),this.selectedTab=e.ko.observable(0),this.dealScroll=e.ko.observable(!1),this.hasCoupons=e.ko.observable(!1),this.hasCampaigns=e.ko.observable(!1),this.couponsMessage=e.ko.observable(""),this.moreDealsUrl=e.ko.observable(""),this.visibleRows=e.ko.observable(0),this.deals=e.ko.observable(null),this.atLeastOneRibbonShown=!1,this.waitingForResult=!1;var u=this;this.context=r.context,this.strings=t.Common.LocaleHelper.getStringMapForCountry(r.context.countryCode(),t.Locale.sliderStrings),this.hasDeals=e.ko.computed(function(){return u.deals()&&u.deals().offers.length>0}),this.isWindowOpen=e.ko.computed(function(){return null!=u.deals()}),this.intervalToken=window.setInterval(function(){u.waitingForResult||(!u.atLeastOneRibbonShown||u.primaryRibbon()&&!t.Common.VisualHelper.isElementInViewport(e.$(u.primaryRibbon().targetImage),.5)||!u.primaryRibbon())&&(u.isWindowOpen()||u.selectAndDrawRibbon(r))},1e3),this.selectAndDrawRibbon(r),this.setModalMaxHeight(this.context,a)}return __extends(o,n),o.prototype.selectAndDrawRibbon=function(n,o,a){var s=this;void 0===o&&(o=0),void 0===a&&(a=2);var u=this;n.genValidImages(),t.Logger.log("try select image: "+o);var c=this.findCandidateImages(n);if(c.length()<=o||o==a)return void t.Logger.log("no more images to try "+o);var l=c.getItem(o),f=l.image,d=t.Col.of(this.imageToRibbonDic).first(function(e){return e.image==f});if(null==d){var p={image:f,ribbon:null};this.imageToRibbonDic.push(p),u.waitingForResult=!0,n.generateData(f,n.context,new t.Products.ItemCounts(0,8)).then(function(a){if(u.waitingForResult=!1,a.length>0){var c=new r.DealsModel(n.context,a),f=function(t){u.modalTarget(e.$(t.targetImage)),u.deals(c)},d=new i(n.context,c,l,f);u.atLeastOneRibbonShown=!0,s.primaryRibbon(d),s.ribbons.push(d),p.ribbon=d}else t.Logger.log("try next image"),u.selectAndDrawRibbon(n,o+1)})}else t.Logger.log("image "+o+" already scraped"),this.primaryRibbon(d.ribbon)},o.prototype.setModalMaxHeight=function(t,r){var n=8*(r-1),o=r*this.rowHeight();this.maxHeight=e.ko.computed(function(){return o+n})},o.prototype.findCandidateImages=function(r,n,o){void 0===n&&(n=0),void 0===o&&(o=2);var i=t.Col.of(r.validImages).select(function(e){return{image:e,size:t.Common.ImageUtils.imageSizeToRibbonSize(e.height)}}).where(function(r){return t.Common.VisualHelper.isElementInViewport(e.$(r.image),.9)});return i.skip(n).take(o)},o.prototype.rowHeight=function(){return 125},o.prototype.hide=function(){this.dismissWindow()},o.prototype.hideRibbons=function(e,r){t.Common.RealEstateHelper.releaseRealestate(this.suspendIdentifier),this.onClose(),window.clearInterval(this.intervalToken)},o.prototype.dismissWindow=function(){this.deals(null)},o}(r.ProductModelBase);r.MultiRibbonModelY=o;var i=function(){function r(o,i,a,s){var u=this;void 0===s&&(s=function(){}),this.deals=e.ko.observable(),this.bodyRect=e.ko.observable(null),this.isValid=e.ko.observable(!0);var c=this;this.displayWindowFn=function(){s(c)},this.deals=e.ko.observable(i),this.targetImage=a.image,this.context=o,this.ribbonSizeEnum=e.ko.observable(a.size),this.ribbonSize=e.ko.computed(function(){return n.ribbonSizeToString(c.ribbonSizeEnum())}),this.presentedDeals=e.ko.computed(function(){var e=n.getDimensions(u.ribbonSizeEnum()),t=o.scraper().getElementPosWithOffsets(u.targetImage),r=u.calculateNumOfPresentedDeals(e,t,u.deals().offers);return u.deals().offers.slice(0,r)},this);var l=function(){var r=u.context.scraper().getElementPosWithOffsets(e.$("body")[0]);c.bodyRect()&&t.Common.isEquivalent(r,c.bodyRect())||c.bodyRect(r)};window.setInterval(l,1e3),l(),this.ribbonPosition=e.ko.computed(function(){c.bodyRect();var e=r.calculatePositionsByImage(u.context,u.targetImage);return e.left-=n.getDimensions(u.ribbonSizeEnum()).width/4,e.top-=n.getDimensions(u.ribbonSizeEnum()).height/4,e}),this.targetRect=e.ko.computed(function(){return c.bodyRect(),t.Common.VisualHelper.getElementPosWithOffsets(c.targetImage)}),this.context.pushNotificationParam("size",this.ribbonSize()),t.Logger.Analytics.notify(this.context,t.Logger.Analytics.IMPRESSION)}return r.calculatePositionsByImage=function(e,t){var r=e.scraper().getElementPosWithOffsets(t);return{top:r.top,left:r.right}},r.prototype.calculateNumOfPresentedDeals=function(e,t,r){var n=3,o=Math.max(1,Math.floor(t.height/e.height)),i=Math.max(o,n),a=Math.min(i,r.length);return a},r}();r.SingleRibbonModelY=i}(r=t.Model||(t.Model={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(t){var r;!function(r){var n;!function(n){var o=function(){function n(){this.element=null}return n.prototype.realEstate=function(){return 6},n.prototype.flag=function(){return"rby"},n.prototype.determineNeededItemCount=function(e){return new r.ItemCounts(5,10)},n.prototype.declareResourcesPromise=function(e){return{panel_css:t.Common.Res.injectCss2(e.paths().innerResourcesRoot()+"/Resources/multiRibbon.css"),templates:t.Common.Res.bring(e.paths().innerResourcesRoot()+"/Resources/templates.html")}},n.prototype.getOldSuspensionIdentifer=function(){return"forb"},n.prototype.getMainCssClass=function(){return"fo-iframe-right-slider"},n.prototype.getParentElement=function(){return document.documentElement.getElementsByTagName("body")[0]},n.prototype.draw=function(n,o,i){var a=this,s=o.Deals,u=t.Col.of([new t.DisplayHandlers.EllipsisHandler,new t.DisplayHandlers.SuspendBoxHandler]),c=i.templates,l=e.$(c);t.Common.VisualHelper.appendToBody(l);var f=e.$("<div data-bind='template: \"multiribbony-template\"'></div>"),d=f[0];this.element=d,t.Common.VisualHelper.appendToBody(f);var p=function(){u.each(function(e){return e.remove&&e.remove()}),e.$(a.element).remove()},h=r.VisualRealEstate[this.realEstate()],m=this.getOldSuspensionIdentifer(),g=new t.Model.MultiRibbonModelY(s,h,m,this.visibleRows(),p);return g.ribbonCssUrl=s.context.paths().innerResourcesRoot()+"/Resources/ribbon.css",g.displayWindowCssUrl=s.context.paths().innerResourcesRoot()+"/Resources/multiRibbon.css",g.postRenderHandler=function(e,t){u.each(function(r){return r.afterRender(e,t)})},g.cssName="fo-modal-panel",e.ko.applyBindings(g,d),t.resolve(null)},n.prototype.remove=function(t){e.$(this.element).remove()},n.prototype.visibleRows=function(){return 3},n}();n.RibbonY=o}(n=r.Visual||(r.Visual={}))}(r=t.Products||(t.Products={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));var FO;!function(e){var t;!function(e){var t;!function(t){var r=function(){function t(){this.selectedProducts=[]}return t.prototype.init=function(t,r){var n=this;window.FO_ADJUSTSCALE||(window.FO_ADJUSTSCALE={active:!0,top:0,bottom:0,pos:.13,minScale:.9}),t.products.CommerceRightRibbon&&Math.random()<.1&&(delete t.products.CommerceRightRibbon,t.products.RibbonY=[{logic:["RibbonImageDealsLogic"],visual:"RibbonY"}]);var o=new e.Context.Paths(r),i=new e.Context.BootstrapContext(o,t,{});e.Logger.initialize(i),e.Logger.Analytics.notify(i,e.Logger.Analytics.INIT,{},0),e.Logger.log("Started app init. Version: 0_0_603. PartId: "+t.partnerCode+". SubId: "+t.subId+". Domain: "+r),e.Logger.time("FO end to end"),e.Logger.log("Overrides:\n"+i.overrides().describe()),e.Logger.time("FO LoadTime");var a=i.paths().outerResourcesRoot()+"/",s=e.Common.Res.injectScript(a+"json3.js").then(function(){return window.JSON3=JSON3.noConflict()}),u=e.Common.Res.injectScript(a+"NWPLegacy_v2.js"),c=e.Common.Res.injectScript(a+"bloomfilter.js"),l=e.Common.ExternalResources.getKnockout(a).then(function(){e.Common.KoBindings.registerCustomBindings(i)}),f=e.Common.ExternalResources.getJQuery(a).then(function(){return e.when(e.Common.Res.injectScript(a+"jquery.xdr.js"),e.Common.Res.injectScript(a+"jquery.dotdotdot.js"))}),d=[s,u,c,l,f];e.typedWhen(d).done(function(){return n.continueWithLibraries(i)}).fail(function(t){return e.Logger.error("Shared: Library load failed: "+t.message,i)})},t.prototype.continueWithLibraries=function(t){var r=this;e.Logger.log("Libraries loaded. Loading application context");var n=e.Common.generateUUID(),o=new e.Common.IFrameStore(t.paths(),t.isDebugMode()),i=e.Common.LooseUserSettings.fromAsyncStorePromise(o,n),a=i.then(function(t){return new e.Common.DefaultSuspender(t)}),s=e.Context.ApplicationContext.fromPromise(t,i,a,o,null),u={};u.CTX=s;for(var c in t.params().products){var l=t.params().products[c],f=l[0],d=e.Common.Res.loadProduct(t.paths(),c,f.logic,f.visual);u["PRODUCT_"+c]=d}e.namedWhen2(u).done(function(e){r.continueWithContextAndProducts(e,n)}).fail(function(t){e.Logger.error("Shared: preload failed: "+t.message)})},t.prototype.continueWithContextAndProducts=function(t,r){e.Logger.log("Continuing with Context and Products");var n=t.CTX,o=new Date,i=o.getFullYear()+""+o.getMonth()+o.getDate(),a=n.userSettings().uuid()==r?"generated":"active";e.Logger.Analytics.notify(n,e.Logger.Analytics.USER,{t:i,usertype:a,hid:n.userSettings().uuid(),partid:n.params().partnerCode,subid:n.params().subId},1,!1);var s=[];for(var u in t)0==u.indexOf("PRODUCT")&&s.push(t[u]);this.selectProductsAndAddReloadChecks(n,s)},t.prototype.selectProductsAndAddReloadChecks=function(t,r){var n=this;this.selectProducts(t,r);var o=window.location.href,i=null;window.setInterval(function(){window.location.href!=o&&(o=window.location.href,i&&window.clearTimeout(i),e.Logger.info("Reloading products - URL has changed"),n.removeProducts(t,n.selectedProducts,!0),n.selectedProducts=[],i=window.setTimeout(function(){n.selectProducts(t,r)},1500))},1e3)},t.prototype.selectProducts=function(t,r){var n=this,o=e.StaticCol.select(r,function(e){return e.name}).join(",");e.Logger.log("loaded product code for "+o);for(var i={},a=0;a<r.length;a++){var s=r[a],u=new e.Context.VisualContext(t,s.name,s.visual),c=e.Products.VisualRealEstate[s.visual.realEstate()],l=t.suspender().isSuspended(c);if(l)e.Logger.info("Realestate "+c+" Is suspended. Product "+s.name+" will not be displayed"),e.Logger.Analytics.notify(u,e.Logger.Analytics.NO_SHOW,{reason:"suspended"},0);else for(var f=0;f<s.logics.length;f++){var d=s.logics[f],p=d.supportsStickyClassification()&&e.Common.ElephantClassifier.getHistoricalClassification(d);if(p){e.Logger.log("Approving for historical classification for logic "+d.flag());var h={name:"historical",value:p};i[d.flag()]=e.resolve(h)}else{var m=new e.Context.LVContext(t,s.name,d,s.visual);i[d.flag()]=d.classify(m).logPassthrough("Logic classification score for "+d.flag())}}}var g=e.namedWhen2(i).fail(function(t){e.Logger.error("Failed classification: "+t.message)}),v=g.then(function(n){for(var o=[],i=0;i<r.length;i++){var a=r[i],s=new e.Context.VisualContext(t,a.name,a.visual),u=e.Products.VisualRealEstate[a.visual.realEstate()],c=t.suspender().isSuspended(u);if(!c){for(var l=null,f=0,d=null,p=[],h=0;h<a.logics.length;h++){var m=a.logics[h],g=n[m.flag()];if(g){var v=g.value,y=g.name;v>0&&(p.push(m),m.supportsStickyClassification()&&e.Common.ElephantClassifier.setHistoricalClassification(m)),(null==d||v>f)&&(f=v,l=m,d=y)}else e.Logger.log("Skipping logic "+m.flag()+". Did not reach classification")}if(0>=f){e.Logger.log("Skipping product "+a.name+". Top logic classification returned "+f+" with reason "+d);var b=0==f?"Classification zero":"Negative classification: "+d;e.Logger.Analytics.notify(s,e.Logger.Analytics.NO_SHOW,{reason:b},0)}else a.logics=p,o.push({product:a,score:f})}}return o}),y=v.then(function(r){return e.Common.RealEstateHelper.resolveProductsByRealEstate(t,r)}).fail(function(t){e.Logger.error("Failed realestate resolution: "+t.message)});y.then(function(r){n.selectedProducts=r,0==r.length?e.Logger.info("FO complete: no products selected."):n.loadProducts(t,r)}).fail(function(t){e.Logger.error("Failed selected product initialization: "+t.message)})},t.prototype.loadProducts=function(t,r){var n=this,o=e.StaticCol.select(r,function(e){return e.name}).join();e.Logger.info("initializing products "+o);var i=new e.Common.DataSynchronizer,a=e.StaticCol.select(r,function(r){var o=new e.Context.VisualContext(t,r.name,r.visual),a=n.obtainProductData(t,r,i).fail(function(t){e.Logger.error("Failed retrieving data for product "+r.name+": "+t.message)}),s=e.namedWhen2(r.visual.declareResourcesPromise(o)).fail(function(t){e.Logger.error("Failed retrieving visual resources for product "+r.name+": "+t.message)});return e.namedWhen2({data:a,visres:s}).then(function(e){return n.displayProduct(o,r,e.data,e.visres)}).done(function(){e.Logger.log("Product "+r.name+" displayed")})});e.typedWhen(a).always(function(){e.Logger.info("FO complete: "+o),e.Logger.timeEnd("FO end to end")})},t.prototype.obtainProductData=function(t,r,n){for(var o={},i=0;i<r.logics.length;i++){var a=r.logics[i],s=new e.Context.LVContext(t,r.name,a,r.visual),u=r.visual.determineNeededItemCount(s),c=a.scrapeAndObtainData(s,u,n).then(function(e){return e.context.pushNotificationParam("datasrc",e.source),e});o[a.dataKey()]=c}return e.namedWhen3(o)},t.prototype.displayProduct=function(t,r,n,o){var i=e.StaticCol.hashSum(n,function(e,t){return t.hasData()?1:0})>0,a=null;if(i){e.Logger.log("Initializing visual for product "+r.name);try{a=r.visual.draw(r,n,o)}catch(s){e.Logger.error("Failed drawing "+r.name+": "+s.message),a=e.reject(new Error("Draw Failure: "+(s&&s.message)))}}else{e.Logger.log(r.name+" will halt. no results returned"),e.Logger.Analytics.notify(t,e.Logger.Analytics.NO_SHOW,{reason:"zero_results"},0);var u=e.Products.VisualRealEstate[r.visual.realEstate()];e.Common.RealEstateHelper.releaseRealestate(u),a=e.resolve(null)}return a.fail(function(n){e.Logger.error("Failed drawing "+t.productName+": "+n.message),e.Logger.Analytics.notify(t,e.Logger.Analytics.NO_SHOW,{reason:"Failed drawing: "+n.message},0);var o=e.Products.VisualRealEstate[r.visual.realEstate()];e.Common.RealEstateHelper.releaseRealestate(o)}),a},t.prototype.removeProducts=function(t,r,n){var o=e.StaticCol.select(r,function(e){return e.name}).join(",");e.Logger.info("Removing products "+o);for(var i=0;i<r.length;i++)this.removeProduct(t,r[i],n)},t.prototype.removeProduct=function(t,r,n){try{if(r.visual.remove(t),n){var o=e.Products.VisualRealEstate[r.visual.realEstate()];e.Common.RealEstateHelper.releaseRealestate(o)}}catch(i){e.Logger.warn("Error while removing product "+r.name+": "+i)}},t}();t.SharedApp=r}(t=e.App||(e.App={}))}(t=e.Shared_0_0_603||(e.Shared_0_0_603={}))}(FO||(FO={}));