function imageurlfromsku(n){return"/globalassets/product-images/"+n.toString().substring(0,n.toString().length-3)+"000/"+n+".jpg?width=40"}!function(n,t){"function"==typeof define&&define.amd?define(["jquery"],function(i){return n.Bloodhound=t(i)}):"object"==typeof exports?module.exports=t(require("jquery")):n.Bloodhound=t(n.jQuery)}(this,function(n){var t=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(n){return!n||/^\s*$/.test(n)},escapeRegExChars:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(n){return"string"==typeof n},isNumber:function(n){return"number"==typeof n},isArray:n.isArray,isFunction:n.isFunction,isObject:n.isPlainObject,isUndefined:function(n){return void 0===n},isElement:function(n){return!(!n||1!==n.nodeType)},isJQuery:function(t){return t instanceof n},toStr:function(n){return t.isUndefined(n)||null===n?"":n+""},bind:n.proxy,each:function(t,i){n.each(t,function(n,t){return i(t,n)})},map:n.map,filter:n.grep,every:function(t,i){var r=!0;return t?(n.each(t,function(n,u){if(!(r=i.call(null,u,n,t)))return!1}),!!r):r},some:function(t,i){var r=!1;return t?(n.each(t,function(n,u){if(r=i.call(null,u,n,t))return!1}),!!r):r},mixin:n.extend,identity:function(n){return n},clone:function(t){return n.extend(!0,{},t)},getIdGenerator:function(){var n=0;return function(){return n++}},templatify:function(t){return n.isFunction(t)?t:function(){return String(t)}},defer:function(n){setTimeout(n,0)},debounce:function(n,t,i){var r,u;return function(){var f,e,o=this,s=arguments;return f=function(){r=null;i||(u=n.apply(o,s))},e=i&&!r,clearTimeout(r),r=setTimeout(f,t),e&&(u=n.apply(o,s)),u}},throttle:function(n,t){var u,f,i,e,r,o;return r=0,o=function(){r=new Date;i=null;e=n.apply(u,f)},function(){var s=new Date,h=t-(s-r);return u=this,f=arguments,h<=0?(clearTimeout(i),i=null,r=s,e=n.apply(u,f)):i||(i=setTimeout(o,h)),e}},stringify:function(n){return t.isString(n)?n:JSON.stringify(n)},guid:function(){function n(n){var t=(Math.random().toString(16)+"000000000").substr(2,8);return n?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return"tt-"+n()+n(!0)+n(!0)+n()},noop:function(){}}}(),u="1.2.0",f=function(){"use strict";function i(n){return(n=t.toStr(n))?n.split(/\s+/):[]}function r(n){return(n=t.toStr(n))?n.split(/\W+/):[]}function u(n){n=t.toStr(n);var r=[],i="";return t.each(n.split(""),function(n){n.match(/\s+/)?i="":(r.push(i+n),i+=n)}),r}function n(n){return function(i){return i=t.isArray(i)?i:[].slice.call(arguments,0),function(r){var u=[];return t.each(i,function(i){u=u.concat(n(t.toStr(r[i])))}),u}}}return{nonword:r,whitespace:i,ngram:u,obj:{nonword:n(r),whitespace:n(i),ngram:n(u)}}}(),i=function(){"use strict";function i(i){this.maxSize=t.isNumber(i)?i:100;this.reset();this.maxSize<=0&&(this.set=this.get=n.noop)}function r(){this.head=this.tail=null}return t.mixin(i.prototype,{set:function(n,t){var i,r=this.list.tail;this.size>=this.maxSize&&(this.list.remove(r),delete this.hash[r.key],this.size--);(i=this.hash[n])?(i.val=t,this.list.moveToFront(i)):(i=new function(n,t){this.key=n;this.val=t;this.prev=this.next=null}(n,t),this.list.add(i),this.hash[n]=i,this.size++)},get:function(n){var t=this.hash[n];if(t)return this.list.moveToFront(t),t.val},reset:function(){this.size=0;this.hash={};this.list=new r}}),t.mixin(r.prototype,{add:function(n){this.head&&(n.next=this.head,this.head.prev=n);this.head=n;this.tail=this.tail||n},remove:function(n){n.prev?n.prev.next=n.next:this.head=n.next;n.next?n.next.prev=n.prev:this.tail=n.prev},moveToFront:function(n){this.remove(n);this.add(n)}}),i}(),e=function(){"use strict";function r(n,r){this.prefix=["__",n,"__"].join("");this.ttlKey="__ttl__";this.keyMatcher=new RegExp("^"+t.escapeRegExChars(this.prefix));this.ls=r||i;this.ls||this._noop()}function u(){return(new Date).getTime()}function f(n){return JSON.stringify(t.isUndefined(n)?null:n)}function e(t){return n.parseJSON(t)}var i;try{(i=window.localStorage).setItem("~~~","!");i.removeItem("~~~")}catch(n){i=null}return t.mixin(r.prototype,{_prefix:function(n){return this.prefix+n},_ttlKey:function(n){return this._prefix(n)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=t.noop},_safeSet:function(n,t){try{this.ls.setItem(n,t)}catch(n){"QuotaExceededError"===n.name&&(this.clear(),this._noop())}},get:function(n){return this.isExpired(n)&&this.remove(n),e(this.ls.getItem(this._prefix(n)))},set:function(n,i,r){return t.isNumber(r)?this._safeSet(this._ttlKey(n),f(u()+r)):this.ls.removeItem(this._ttlKey(n)),this._safeSet(this._prefix(n),f(i))},remove:function(n){return this.ls.removeItem(this._ttlKey(n)),this.ls.removeItem(this._prefix(n)),this},clear:function(){for(var n=function(n){for(var r,u=[],f=i.length,t=0;t<f;t++)(r=i.key(t)).match(n)&&u.push(r.replace(n,""));return u}(this.keyMatcher),t=n.length;t--;)this.remove(n[t]);return this},isExpired:function(n){var i=e(this.ls.getItem(this._ttlKey(n)));return!!(t.isNumber(i)&&u()>i)}}),r}(),r=function(){"use strict";function r(n){n=n||{};this.maxPendingRequests=n.maxPendingRequests||6;this.cancelled=!1;this.lastReq=null;this._send=n.transport;this._get=n.limiter?n.limiter(this._get):this._get;this._cache=!1===n.cache?new i(0):e}var u=0,f={},e=new i(10);return r.setMaxPendingRequests=function(n){this.maxPendingRequests=n},r.resetCache=function(){e.reset()},t.mixin(r.prototype,{_fingerprint:function(t){return(t=t||{}).url+t.type+n.param(t.data||{})},_get:function(n,t){function e(n){t(null,n);r._cache.set(i,n)}function o(){t(!0)}var i,s,r=this;i=this._fingerprint(n);this.cancelled||i!==this.lastReq||((s=f[i])?s.done(e).fail(o):u<this.maxPendingRequests?(u++,f[i]=this._send(n).done(e).fail(o).always(function(){u--;delete f[i];r.onDeckRequestArgs&&(r._get.apply(r,r.onDeckRequestArgs),r.onDeckRequestArgs=null)})):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(i,r){var f,u;r=r||n.noop;i=t.isString(i)?{url:i}:i||{};u=this._fingerprint(i);this.cancelled=!1;this.lastReq=u;(f=this._cache.get(u))?r(null,f):this._get(i,r)},cancel:function(){this.cancelled=!0}}),r}(),o=window.SearchIndex=function(){"use strict";function u(i){(i=i||{}).datumTokenizer&&i.queryTokenizer||n.error("datumTokenizer and queryTokenizer are both required");this.identify=i.identify||t.stringify;this.datumTokenizer=i.datumTokenizer;this.queryTokenizer=i.queryTokenizer;this.matchAnyQueryToken=i.matchAnyQueryToken;this.reset()}function f(n){return n=t.filter(n,function(n){return!!n}),n=t.map(n,function(n){return n.toLowerCase()})}function e(){var n={};return n[r]=[],n[i]={},n}var i="c",r="i";return t.mixin(u.prototype,{bootstrap:function(n){this.datums=n.datums;this.trie=n.trie},add:function(n){var u=this;n=t.isArray(n)?n:[n];t.each(n,function(n){var o,s;u.datums[o=u.identify(n)]=n;s=f(u.datumTokenizer(n));t.each(s,function(n){for(var t,f=u.trie,s=n.split("");t=s.shift();)(f=f[i][t]||(f[i][t]=e()))[r].push(o)})})},get:function(n){var i=this;return t.map(n,function(n){return i.datums[n]})},search:function(n){var o,u,e=this;return o=f(this.queryTokenizer(n)),t.each(o,function(n){var t,f,s,o;if(u&&0===u.length&&!e.matchAnyQueryToken)return!1;for(t=e.trie,f=n.split("");t&&(s=f.shift());)t=t[i][s];if(t&&0===f.length)o=t[r].slice(0),u=u?function(n,t){var i=0,r=0,u=[],f,e;for(n=n.sort(),t=t.sort(),f=n.length,e=t.length;i<f&&r<e;)n[i]<t[r]?i++:n[i]>t[r]?r++:(u.push(n[i]),i++,r++);return u}(u,o):o;else if(!e.matchAnyQueryToken)return u=[],!1}),u?t.map(function(n){for(var i={},r=[],t=0,u=n.length;t<u;t++)i[n[t]]||(i[n[t]]=!0,r.push(n[t]));return r}(u),function(n){return e.datums[n]}):[]},all:function(){var n=[];for(var t in this.datums)n.push(this.datums[t]);return n},reset:function(){this.datums={};this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),u}(),s=function(){"use strict";function i(n){this.url=n.url;this.ttl=n.ttl;this.cache=n.cache;this.prepare=n.prepare;this.transform=n.transform;this.transport=n.transport;this.thumbprint=n.thumbprint;this.storage=new e(n.cacheKey)}var n;return n={data:"data",protocol:"protocol",thumbprint:"thumbprint"},t.mixin(i.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(t){this.cache&&(this.storage.set(n.data,t,this.ttl),this.storage.set(n.protocol,location.protocol,this.ttl),this.storage.set(n.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var i,t={};return this.cache?(t.data=this.storage.get(n.data),t.protocol=this.storage.get(n.protocol),t.thumbprint=this.storage.get(n.thumbprint),i=t.thumbprint!==this.thumbprint||t.protocol!==location.protocol,t.data&&!i?t.data:null):null},fromNetwork:function(n){var t,i=this;n&&(t=this.prepare(this._settings()),this.transport(t).fail(function(){n(!0)}).done(function(t){n(null,i.transform(t))}))},clear:function(){return this.storage.clear(),this}}),i}(),h=function(){"use strict";function n(n){this.url=n.url;this.prepare=n.prepare;this.transform=n.transform;this.indexResponse=n.indexResponse;this.transport=new r({cache:n.cache,limiter:n.limiter,transport:n.transport,maxPendingRequests:n.maxPendingRequests})}return t.mixin(n.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(n,t){var i,r=this;if(t)return n=n||"",i=this.prepare(n,this._settings()),this.transport.get(i,function(n,i){t(n?[]:r.transform(i))})},cancelLastRequest:function(){this.transport.cancel()}}),n}(),c=function(){"use strict";function i(i){return function(r){var u=n.Deferred();return i(r,function(n){t.defer(function(){u.resolve(n)})},function(n){t.defer(function(){u.reject(n)})}),u}}return function(r){var e,f;return e={initialize:!0,identify:t.stringify,datumTokenizer:null,queryTokenizer:null,matchAnyQueryToken:!1,sufficient:5,indexRemote:!1,sorter:null,local:[],prefetch:null,remote:null},!(r=t.mixin(e,r||{})).datumTokenizer&&n.error("datumTokenizer is required"),!r.queryTokenizer&&n.error("queryTokenizer is required"),f=r.sorter,r.sorter=f?function(n){return n.sort(f)}:t.identity,r.local=t.isFunction(r.local)?r.local():r.local,r.prefetch=function(r){var f;return r?(f={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:t.identity,transform:t.identity,transport:null},r=t.isString(r)?{url:r}:r,!(r=t.mixin(f,r)).url&&n.error("prefetch requires url to be set"),r.transform=r.filter||r.transform,r.cacheKey=r.cacheKey||r.url,r.thumbprint=u+r.thumbprint,r.transport=r.transport?i(r.transport):n.ajax,r):null}(r.prefetch),r.remote=function(r){var c,f,e,l,o,a,v,u,s,h,y;if(r)return c={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:t.identity,transport:null},r=t.isString(r)?{url:r}:r,!(r=t.mixin(c,r)).url&&n.error("remote requires url to be set"),r.transform=r.filter||r.transform,r.prepare=(u=r,s=u.prepare,h=u.replace,y=u.wildcard,s||(s=h?function(n,t){return t.url=h(t.url,n),t}:u.wildcard?function(n,t){return t.url=t.url.replace(y,encodeURIComponent(n)),t}:function(n,t){return t})),r.limiter=(f=r,e=f.limiter,l=f.rateLimitBy,o=f.rateLimitWait,e||(e=/^throttle$/i.test(l)?(v=o,function(n){return t.throttle(n,v)}):(a=o,function(n){return t.debounce(n,a)})),e),r.transport=r.transport?i(r.transport):n.ajax,delete r.replace,delete r.wildcard,delete r.rateLimitBy,delete r.rateLimitWait,r}(r.remote),r}}();return function(){"use strict";function i(n){n=c(n);this.sorter=n.sorter;this.identify=n.identify;this.sufficient=n.sufficient;this.indexRemote=n.indexRemote;this.local=n.local;this.remote=n.remote?new h(n.remote):null;this.prefetch=n.prefetch?new s(n.prefetch):null;this.index=new o({identify:this.identify,datumTokenizer:n.datumTokenizer,queryTokenizer:n.queryTokenizer});!1!==n.initialize&&this.initialize()}var u;return u=window&&window.Bloodhound,i.noConflict=function(){return window&&(window.Bloodhound=u),i},i.tokenizers=f,t.mixin(i.prototype,{__ttAdapter:function(){var n=this;return this.remote?function(t,i,r){return n.search(t,i,r)}:function(t,i){return n.search(t,i)}},_loadPrefetch:function(){var t,r,i=this;return t=n.Deferred(),this.prefetch?(r=this.prefetch.fromCache())?(this.index.bootstrap(r),t.resolve()):this.prefetch.fromNetwork(function(n,r){if(n)return t.reject();i.add(r);i.prefetch.store(i.index.serialize());t.resolve()}):t.resolve(),t.promise()},_initialize:function(){var n=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(function(){n.add(n.local)}),this.initPromise},initialize:function(n){return!this.initPromise||n?this._initialize():this.initPromise},add:function(n){return this.index.add(n),this},get:function(n){return n=t.isArray(n)?n:[].slice.call(arguments),this.index.get(n)},search:function(n,i,r){var u,f=this;return i=i||t.noop,r=r||t.noop,u=this.sorter(this.index.search(n)),i(this.remote?u.slice():u),this.remote&&u.length<this.sufficient?this.remote.get(n,function(n){var i=[];t.each(n,function(n){t.some(u,function(t){return f.identify(n)===f.identify(t)})||i.push(n)});f.indexRemote&&f.add(i);r(i)}):this.remote&&this.remote.cancelLastRequest(),this},all:function(){return this.index.all()},clear:function(){return this.index.reset(),this},clearPrefetchCache:function(){return this.prefetch&&this.prefetch.clear(),this},clearRemoteCache:function(){return r.resetCache(),this},ttAdapter:function(){return this.__ttAdapter()}}),i}()}),function(n,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(n)}):"object"==typeof exports?module.exports=t(require("jquery")):t(n.jQuery)}(this,function(n){var t=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(n){return!n||/^\s*$/.test(n)},escapeRegExChars:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(n){return"string"==typeof n},isNumber:function(n){return"number"==typeof n},isArray:n.isArray,isFunction:n.isFunction,isObject:n.isPlainObject,isUndefined:function(n){return void 0===n},isElement:function(n){return!(!n||1!==n.nodeType)},isJQuery:function(t){return t instanceof n},toStr:function(n){return t.isUndefined(n)||null===n?"":n+""},bind:n.proxy,each:function(t,i){n.each(t,function(n,t){return i(t,n)})},map:n.map,filter:n.grep,every:function(t,i){var r=!0;return t?(n.each(t,function(n,u){if(!(r=i.call(null,u,n,t)))return!1}),!!r):r},some:function(t,i){var r=!1;return t?(n.each(t,function(n,u){if(r=i.call(null,u,n,t))return!1}),!!r):r},mixin:n.extend,identity:function(n){return n},clone:function(t){return n.extend(!0,{},t)},getIdGenerator:function(){var n=0;return function(){return n++}},templatify:function(t){return n.isFunction(t)?t:function(){return String(t)}},defer:function(n){setTimeout(n,0)},debounce:function(n,t,i){var r,u;return function(){var f,e,o=this,s=arguments;return f=function(){r=null;i||(u=n.apply(o,s))},e=i&&!r,clearTimeout(r),r=setTimeout(f,t),e&&(u=n.apply(o,s)),u}},throttle:function(n,t){var u,f,i,e,r,o;return r=0,o=function(){r=new Date;i=null;e=n.apply(u,f)},function(){var s=new Date,h=t-(s-r);return u=this,f=arguments,h<=0?(clearTimeout(i),i=null,r=s,e=n.apply(u,f)):i||(i=setTimeout(o,h)),e}},stringify:function(n){return t.isString(n)?n:JSON.stringify(n)},guid:function(){function n(n){var t=(Math.random().toString(16)+"000000000").substr(2,8);return n?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return"tt-"+n()+n(!0)+n(!0)+n()},noop:function(){}}}(),e=function(){"use strict";var n={wrapper:"wex-typeahead",input:"w-input",hint:"w-hint",menu:"w-menu",dataset:"w-dataset",suggestion:"w-suggestion",selectable:"w-selectable",empty:"w-empty",open:"w-open",cursor:"w-cursor",highlight:"w-highlight"};return function(i){var r,u,s,f,e,o;return u=t.mixin({},n,i),{css:(r={css:(o={wrapper:{position:"relative"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none",width:"100%"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}},t.isMsie()&&t.mixin(o.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),o),classes:u,html:(e=u,{wrapper:'<span class="'+e.wrapper+'"><\/span>',menu:'<div role="listbox" class="'+e.menu+'"><\/div>'}),selectors:(s=u,f={},t.each(s,function(n,t){f[t]="."+n}),f)}).css,html:r.html,classes:r.classes,selectors:r.selectors,mixin:function(n){t.mixin(n,r)}}}}(),o=function(){"use strict";function i(t){t&&t.el||n.error("EventBus initialized without el");this.$el=n(t.el)}var r,u;return r="typeahead:",u={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},t.mixin(i.prototype,{_trigger:function(t,i){var u=n.Event(r+t);return this.$el.trigger.call(this.$el,u,i||[]),u},before:function(n){var t;return t=[].slice.call(arguments,1),this._trigger("before"+n,t).isDefaultPrevented()},trigger:function(n){var t;this._trigger(n,[].slice.call(arguments,1));(t=u[n])&&this._trigger(t,[].slice.call(arguments,1))}}),i}(),r=function(){"use strict";function t(t,i,r,u){var f,e,o;if(!r)return this;for(i=i.split(n),r=u?(o=u,(e=r).bind?e.bind(o):function(){e.apply(o,[].slice.call(arguments,0))}):r,this._callbacks=this._callbacks||{};f=i.shift();)this._callbacks[f]=this._callbacks[f]||{sync:[],async:[]},this._callbacks[f][t].push(r);return this}function i(n,t,i){return function(){for(var r,u=0,f=n.length;!r&&u<f;u+=1)r=!1===n[u].apply(t,i);return!r}}var n=/\s+/,r=function(){return window.setImmediate?function(n){setImmediate(function(){n()})}:function(n){setTimeout(function(){n()},0)}}();return{onSync:function(n,i,r){return t.call(this,"sync",n,i,r)},onAsync:function(n,i,r){return t.call(this,"async",n,i,r)},off:function(t){var i;if(!this._callbacks)return this;for(t=t.split(n);i=t.shift();)delete this._callbacks[i];return this},trigger:function(t){var u,f,e,o,s;if(!this._callbacks)return this;for(t=t.split(n),e=[].slice.call(arguments,1);(u=t.shift())&&(f=this._callbacks[u]);)o=i(f.sync,this,[u].concat(e)),s=i(f.async,this,[u].concat(e)),o()&&r(s);return this}}}(),s=function(n){"use strict";function i(n){return u[n.toUpperCase()]||n}var r={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1,diacriticInsensitive:!1},u={A:"[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Ａａ]",B:"[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Ｂｂ]",C:"[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Ｃｃ]",D:"[DdĎďǄ-ǆǱ-ǳᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Ｄｄ]",E:"[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ｅｅ]",F:"[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ﬀ-ﬄＦｆ]",G:"[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Ｇｇ]",H:"[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Ｈｈ]",I:"[IiÌ-Ïì-ïĨ-İĲĳǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕ﬁﬃＩｉ]",J:"[JjĲ-ĵǇ-ǌǰʲᴶⅉ⒥ⒿⓙⱼＪｊ]",K:"[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Ｋｋ]",L:"[LlĹ-ŀǇ-ǉˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿ﬂﬄＬｌ]",M:"[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Ｍｍ]",N:"[NnÑñŃ-ŉǊ-ǌǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Ｎｎ]",O:"[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Ｏｏ]",P:"[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Ｐｐ]",Q:"[Qqℚ⒬Ⓠⓠ㏃Ｑｑ]",R:"[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Ｒｒ]",S:"[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜ﬆＳｓ]",T:"[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ﬅﬆＴｔ]",U:"[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Ｕｕ]",V:"[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Ｖｖ]",W:"[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ｗｗ]",X:"[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Ｘｘ]",Y:"[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Ｙｙ]",Z:"[ZzŹ-žǱ-ǳᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Ｚｚ]"};return function(u){var f;(u=t.mixin({},r,u)).node&&u.pattern&&(u.pattern=t.isArray(u.pattern)?u.pattern:[u.pattern],f=function(n,r,u,f){for(var e,o,s=[],h=0,c=n.length;h<c;h++)e=t.escapeRegExChars(n[h]),f&&(e=e.replace(/\S/g,i)),s.push(e);return o=u?"\\b("+s.join("|")+")\\b":"("+s.join("|")+")",r?new RegExp(o):new RegExp(o,"i")}(u.pattern,u.caseSensitive,u.wordsOnly,u.diacriticInsensitive),function n(t,i){for(var u,r=0;r<t.childNodes.length;r++)3===(u=t.childNodes[r]).nodeType?r+=i(u)?1:0:n(u,i)}(u.node,function(t){var i,e,r;return(i=f.exec(t.data))&&(r=n.createElement(u.tagName),u.className&&(r.className=u.className),(e=t.splitText(i.index)).splitText(i[0].length),r.appendChild(e.cloneNode(!0)),t.parentNode.replaceChild(r,e)),!!i}))}}(window.document),u=function(){"use strict";function i(i,r){var u;(i=i||{}).input||n.error("input is missing");r.mixin(this);this.$hint=n(i.hint);this.$input=n(i.input);this.$input.attr({"aria-activedescendant":"","aria-owns":this.$input.attr("id")+"_listbox",role:"combobox","aria-readonly":"true","aria-autocomplete":"list"});n(r.menu).attr("id",this.$input.attr("id")+"_listbox");this.query=this.$input.val();this.queryWhenFocused=this.hasFocus()?this.query:null;this.$overflowHelper=(u=this.$input,n('<pre aria-hidden="true"><\/pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:u.css("font-family"),fontSize:u.css("font-size"),fontStyle:u.css("font-style"),fontVariant:u.css("font-variant"),fontWeight:u.css("font-weight"),wordSpacing:u.css("word-spacing"),letterSpacing:u.css("letter-spacing"),textIndent:u.css("text-indent"),textRendering:u.css("text-rendering"),textTransform:u.css("text-transform")}).insertAfter(u));this._checkLanguageDirection();0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=t.noop);this.onSync("cursorchange",this._updateDescendent)}function f(n){return n.altKey||n.ctrlKey||n.metaKey||n.shiftKey}var u;return u={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},i.normalizeQuery=function(n){return t.toStr(n).replace(/^\s*/g,"").replace(/\s{2,}/g," ")},t.mixin(i.prototype,r,{_onBlur:function(){this.resetInputValue();this.trigger("blurred")},_onFocus:function(){this.queryWhenFocused=this.query;this.trigger("focused")},_onKeydown:function(n){var t=u[n.which||n.keyCode];this._managePreventDefault(t,n);t&&this._shouldTrigger(t,n)&&this.trigger(t+"Keyed",n)},_onInput:function(){this._setQuery(this.getInputValue());this.clearHintIfInvalid();this._checkLanguageDirection()},_managePreventDefault:function(n,t){var i;switch(n){case"up":case"down":i=!f(t);break;default:i=!1}i&&t.preventDefault()},_shouldTrigger:function(n,t){var i;switch(n){case"tab":i=!f(t);break;default:i=!0}return i},_checkLanguageDirection:function(){var n=(this.$input.css("direction")||"ltr").toLowerCase();this.dir!==n&&(this.dir=n,this.$hint.attr("dir",n),this.trigger("langDirChanged",n))},_setQuery:function(n,t){var r,u,f,e;f=n;e=this.query;u=!!(r=i.normalizeQuery(f)===i.normalizeQuery(e))&&this.query.length!==n.length;this.query=n;t||r?!t&&u&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},_updateDescendent:function(n,t){this.$input.attr("aria-activedescendant",t)},bind:function(){var n,i,r,f,e=this;return n=t.bind(this._onBlur,this),i=t.bind(this._onFocus,this),r=t.bind(this._onKeydown,this),f=t.bind(this._onInput,this),this.$input.on("blur.tt",n).on("focus.tt",i).on("keydown.tt",r),!t.isMsie()||t.isMsie()>9?this.$input.on("input.tt",f):this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(n){u[n.which||n.keyCode]||t.defer(t.bind(e._onInput,e,n))}),this},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getLangDir:function(){return this.dir},getQuery:function(){return this.query||""},setQuery:function(n,t){this.setInputValue(n);this._setQuery(n,t)},hasQueryChangedSinceLastFocus:function(){return this.query!==this.queryWhenFocused},getInputValue:function(){return this.$input.val()},setInputValue:function(n){this.$input.val(n);this.clearHintIfInvalid();this._checkLanguageDirection()},resetInputValue:function(){this.setInputValue(this.query)},getHint:function(){return this.$hint.val()},setHint:function(n){this.$hint.val(n)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var n,t,i;i=(n=this.getInputValue())!==(t=this.getHint())&&0===t.indexOf(n);""!==n&&i&&!this.hasOverflow()||this.clearHint()},hasFocus:function(){return this.$input.is(":focus")},hasOverflow:function(){var n=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=n},isCursorAtEnd:function(){var n,i,r;return n=this.$input.val().length,i=this.$input[0].selectionStart,t.isNumber(i)?i===n:!document.selection||((r=document.selection.createRange()).moveStart("character",-n),n===r.text.length)},destroy:function(){this.$hint.off(".tt");this.$input.off(".tt");this.$overflowHelper.remove();this.$hint=this.$input=this.$overflowHelper=n("<div>")}}),i}(),f=function(){"use strict";function u(i,r){var u;(i=i||{}).templates=i.templates||{};i.templates.notFound=i.templates.notFound||i.templates.empty;i.source||n.error("missing source");i.node||n.error("missing node");i.name&&(u=i.name,!/^[_a-zA-Z0-9-]+$/.test(u))&&n.error("invalid dataset name: "+i.name);r.mixin(this);this.highlight=!!i.highlight;this.name=t.toStr(i.name||f());this.limit=i.limit||5;this.displayFn=function(n){return n=n||t.stringify,t.isFunction(n)?n:function(t){return t[n]}}(i.display||i.displayKey);this.templates=function(i,r){return{notFound:i.notFound&&t.templatify(i.notFound),pending:i.pending&&t.templatify(i.pending),header:i.header&&t.templatify(i.header),footer:i.footer&&t.templatify(i.footer),suggestion:i.suggestion||function(i){return n('<div role="option">').attr("id",t.guid()).text(r(i))}}}(i.templates,this.displayFn);this.source=i.source.__ttAdapter?i.source.__ttAdapter():i.source;this.async=t.isUndefined(i.async)?this.source.length>2:!!i.async;this._resetLastSuggestion();this.$el=n(i.node).attr("role","presentation").addClass(this.classes.dataset).addClass(this.classes.dataset+"-"+this.name)}var i,f;return i={dataset:"tt-selectable-dataset",val:"tt-selectable-display",obj:"tt-selectable-object"},f=t.getIdGenerator(),u.extractData=function(t){var r=n(t);return r.data(i.obj)?{dataset:r.data(i.dataset)||"",val:r.data(i.val)||"",obj:r.data(i.obj)||null}:null},t.mixin(u.prototype,r,{_overwrite:function(n,t){(t=t||[]).length?this._renderSuggestions(n,t):this.async&&this.templates.pending?this._renderPending(n):!this.async&&this.templates.notFound?this._renderNotFound(n):this._empty();this.trigger("rendered",t,!1,this.name)},_append:function(n,t){(t=t||[]).length&&this.$lastSuggestion.length?this._appendSuggestions(n,t):t.length?this._renderSuggestions(n,t):!this.$lastSuggestion.length&&this.templates.notFound&&this._renderNotFound(n);this.trigger("rendered",t,!0,this.name)},_renderSuggestions:function(n,t){var i;i=this._getSuggestionsFragment(n,t);this.$lastSuggestion=i.children().last();this.$el.html(i).prepend(this._getHeader(n,t)).append(this._getFooter(n,t))},_appendSuggestions:function(n,t){var i,r;r=(i=this._getSuggestionsFragment(n,t)).children().last();this.$lastSuggestion.after(i);this.$lastSuggestion=r},_renderPending:function(n){var t=this.templates.pending;this._resetLastSuggestion();t&&this.$el.html(t({query:n,dataset:this.name}))},_renderNotFound:function(n){var t=this.templates.notFound;this._resetLastSuggestion();t&&this.$el.html(t({query:n,dataset:this.name}))},_empty:function(){this.$el.empty();this._resetLastSuggestion()},_getSuggestionsFragment:function(r,u){var e,f=this;return e=document.createDocumentFragment(),t.each(u,function(t){var u,o;o=f._injectQuery(r,t);u=n(f.templates.suggestion(o)).data(i.dataset,f.name).data(i.obj,t).data(i.val,f.displayFn(t)).addClass(f.classes.suggestion+" "+f.classes.selectable);e.appendChild(u[0])}),this.highlight&&s({className:this.classes.highlight,node:e,pattern:r}),n(e)},_getFooter:function(n,t){return this.templates.footer?this.templates.footer({query:n,suggestions:t,dataset:this.name}):null},_getHeader:function(n,t){return this.templates.header?this.templates.header({query:n,suggestions:t,dataset:this.name}):null},_resetLastSuggestion:function(){this.$lastSuggestion=n()},_injectQuery:function(n,i){return t.isObject(i)?t.mixin({_query:n},i):i},update:function(t){function f(n){u||(u=!0,n=(n||[]).slice(0,i.limit),r=n.length,i._overwrite(t,n),r<i.limit&&i.async&&i.trigger("asyncRequested",t,i.name))}var i=this,e=!1,u=!1,r=0;this.cancel();this.cancel=function(){e=!0;i.cancel=n.noop;i.async&&i.trigger("asyncCanceled",t,i.name)};this.source(t,f,function(u){if(u=u||[],!e&&r<i.limit){i.cancel=n.noop;var f=Math.abs(r-i.limit);r+=f;i._append(t,u.slice(0,f));i.async&&i.trigger("asyncReceived",t,i.name)}});u||f([])},cancel:n.noop,clear:function(){this._empty();this.cancel();this.trigger("cleared")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=n("<div>")}}),u}(),i=function(){"use strict";function i(i,r){var u=this;(i=i||{}).node||n.error("node is required");r.mixin(this);this.$node=n(i.node);this.query=null;this.datasets=t.map(i.datasets,function(t){var i=u.$node.find(t.node).first();return t.node=i.length?i:n("<div>").appendTo(u.$node),new f(t,r)})}return t.mixin(i.prototype,r,{_onSelectableClick:function(t){this.trigger("selectableClicked",n(t.currentTarget))},_onRendered:function(n,t,i,r){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetRendered",t,i,r)},_onCleared:function(){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty());this.trigger("datasetCleared")},_propagate:function(){this.trigger.apply(this,arguments)},_allDatasetsEmpty:function(){return t.every(this.datasets,t.bind(function(n){var t=n.isEmpty();return this.$node.attr("aria-expanded",!t),t},this))},_getSelectables:function(){return this.$node.find(this.selectors.selectable)},_removeCursor:function(){var n=this.getActiveSelectable();n&&n.removeClass(this.classes.cursor)},_ensureVisible:function(n){var t,i,r,u;i=(t=n.position().top)+n.outerHeight(!0);r=this.$node.scrollTop();u=this.$node.height()+parseInt(this.$node.css("paddingTop"),10)+parseInt(this.$node.css("paddingBottom"),10);t<0?this.$node.scrollTop(r+t):u<i&&this.$node.scrollTop(r+(i-u))},bind:function(){var r,i=this;return r=t.bind(this._onSelectableClick,this),this.$node.on("click.tt",this.selectors.selectable,r),this.$node.on("mouseover",this.selectors.selectable,function(){i.setCursor(n(this))}),this.$node.on("mouseleave",function(){i._removeCursor()}),t.each(this.datasets,function(n){n.onSync("asyncRequested",i._propagate,i).onSync("asyncCanceled",i._propagate,i).onSync("asyncReceived",i._propagate,i).onSync("rendered",i._onRendered,i).onSync("cleared",i._onCleared,i)}),this},isOpen:function(){return this.$node.hasClass(this.classes.open)},open:function(){this.$node.scrollTop(0);this.$node.addClass(this.classes.open)},close:function(){this.$node.attr("aria-expanded",!1);this.$node.removeClass(this.classes.open);this._removeCursor()},setLanguageDirection:function(n){this.$node.attr("dir",n)},selectableRelativeToCursor:function(n){var t,r,i;return r=this.getActiveSelectable(),t=this._getSelectables(),-1===(i=(i=((i=(r?t.index(r):-1)+n)+1)%(t.length+1)-1)<-1?t.length-1:i)?null:t.eq(i)},setCursor:function(n){this._removeCursor();(n=n&&n.first())&&(n.addClass(this.classes.cursor),this._ensureVisible(n))},getSelectableData:function(n){return n&&n.length?f.extractData(n):null},getActiveSelectable:function(){var n=this._getSelectables().filter(this.selectors.cursor).first();return n.length?n:null},getTopSelectable:function(){var n=this._getSelectables().first();return n.length?n:null},update:function(n){var i=n!==this.query;return i&&(this.query=n,t.each(this.datasets,function(t){t.update(n)})),i},empty:function(){t.each(this.datasets,function(n){n.clear()});this.query=null;this.$node.addClass(this.classes.empty)},destroy:function(){this.$node.off(".tt");this.$node=n("<div>");t.each(this.datasets,function(n){n.destroy()})}}),i}(),h=function(){"use strict";function i(i){this.$el=n("<span><\/span>",{role:"status","aria-live":"polite"}).css({position:"absolute",padding:"0",border:"0",height:"1px",width:"1px","margin-bottom":"-1px","margin-right":"-1px",overflow:"hidden",clip:"rect(0 0 0 0)","white-space":"nowrap"});i.$input.after(this.$el);t.each(i.menu.datasets,t.bind(function(n){n.onSync&&(n.onSync("rendered",t.bind(this.update,this)),n.onSync("cleared",t.bind(this.cleared,this)))},this))}return t.mixin(i.prototype,{update:function(n,t){var i,r=t.length;i=1===r?{result:"result",is:"is"}:{result:"results",is:"are"};this.$el.text(r+" "+i.result+" "+i.is+" available, use up and down arrow keys to navigate.")},cleared:function(){this.$el.text("")}}),i}(),c=function(){"use strict";function r(){i.apply(this,[].slice.call(arguments,0))}var n=i.prototype;return t.mixin(r.prototype,i.prototype,{open:function(){return!this._allDatasetsEmpty()&&this._show(),n.open.apply(this,[].slice.call(arguments,0))},close:function(){return this._hide(),n.close.apply(this,[].slice.call(arguments,0))},_onRendered:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),n._onRendered.apply(this,[].slice.call(arguments,0))},_onCleared:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),n._onCleared.apply(this,[].slice.call(arguments,0))},setLanguageDirection:function(t){return this.$node.css("ltr"===t?this.css.ltr:this.css.rtl),n.setLanguageDirection.apply(this,[].slice.call(arguments,0))},_hide:function(){this.$node.hide()},_show:function(){this.$node.css("display","block")}}),r}(),l=function(){"use strict";function r(r,u){var f,e,o,s,h,c,l,a,v,y,p;(r=r||{}).input||n.error("missing input");r.menu||n.error("missing menu");r.eventBus||n.error("missing event bus");u.mixin(this);this.eventBus=r.eventBus;this.minLength=t.isNumber(r.minLength)?r.minLength:1;this.input=r.input;this.menu=r.menu;this.enabled=!0;this.autoselect=!!r.autoselect;this.active=!1;this.input.hasFocus()&&this.activate();this.dir=this.input.getLangDir();this._hacks();this.menu.bind().onSync("selectableClicked",this._onSelectableClicked,this).onSync("asyncRequested",this._onAsyncRequested,this).onSync("asyncCanceled",this._onAsyncCanceled,this).onSync("asyncReceived",this._onAsyncReceived,this).onSync("datasetRendered",this._onDatasetRendered,this).onSync("datasetCleared",this._onDatasetCleared,this);f=i(this,"activate","open","_onFocused");e=i(this,"deactivate","_onBlurred");o=i(this,"isActive","isOpen","_onEnterKeyed");s=i(this,"isActive","isOpen","_onTabKeyed");h=i(this,"isActive","_onEscKeyed");c=i(this,"isActive","open","_onUpKeyed");l=i(this,"isActive","open","_onDownKeyed");a=i(this,"isActive","isOpen","_onLeftKeyed");v=i(this,"isActive","isOpen","_onRightKeyed");y=i(this,"_openIfActive","_onQueryChanged");p=i(this,"_openIfActive","_onWhitespaceChanged");this.input.bind().onSync("focused",f,this).onSync("blurred",e,this).onSync("enterKeyed",o,this).onSync("tabKeyed",s,this).onSync("escKeyed",h,this).onSync("upKeyed",c,this).onSync("downKeyed",l,this).onSync("leftKeyed",a,this).onSync("rightKeyed",v,this).onSync("queryChanged",y,this).onSync("whitespaceChanged",p,this).onSync("langDirChanged",this._onLangDirChanged,this)}function i(n){var i=[].slice.call(arguments,1);return function(){var r=[].slice.call(arguments);t.each(i,function(t){return n[t].apply(n,r)})}}return t.mixin(r.prototype,{_hacks:function(){var r,i;r=this.input.$input||n("<div>");i=this.menu.$node||n("<div>");r.on("blur.tt",function(n){var u,f,e;u=document.activeElement;f=i.is(u);e=i.has(u).length>0;t.isMsie()&&(f||e)&&(n.preventDefault(),n.stopImmediatePropagation(),t.defer(function(){r.focus()}))});i.on("mousedown.tt",function(n){n.preventDefault()})},_onSelectableClicked:function(n,t){this.select(t)},_onDatasetCleared:function(){this._updateHint()},_onDatasetRendered:function(n,t,i,r){if(this._updateHint(),this.autoselect){var u=this.selectors.cursor.substr(1);this.menu.$node.find(this.selectors.suggestion).first().addClass(u)}this.eventBus.trigger("render",t,i,r)},_onAsyncRequested:function(n,t,i){this.eventBus.trigger("asyncrequest",i,t)},_onAsyncCanceled:function(n,t,i){this.eventBus.trigger("asynccancel",i,t)},_onAsyncReceived:function(n,t,i){this.eventBus.trigger("asyncreceive",i,t)},_onFocused:function(){this._minLengthMet()&&this.menu.update(this.input.getQuery())},_onBlurred:function(){this.input.hasQueryChangedSinceLastFocus()&&this.eventBus.trigger("change",this.input.getQuery())},_onEnterKeyed:function(n,t){var i;(i=this.menu.getActiveSelectable())?this.select(i)&&(t.preventDefault(),t.stopPropagation()):this.autoselect&&this.select(this.menu.getTopSelectable())&&(t.preventDefault(),t.stopPropagation())},_onTabKeyed:function(n,t){var i;(i=this.menu.getActiveSelectable())?this.select(i)&&t.preventDefault():(i=this.menu.getTopSelectable())&&this.autocomplete(i)&&t.preventDefault()},_onEscKeyed:function(){this.close()},_onUpKeyed:function(){this.moveCursor(-1)},_onDownKeyed:function(){this.moveCursor(1)},_onLeftKeyed:function(){"rtl"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getActiveSelectable()||this.menu.getTopSelectable())},_onRightKeyed:function(){"ltr"===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getActiveSelectable()||this.menu.getTopSelectable())},_onQueryChanged:function(n,t){this._minLengthMet(t)?this.menu.update(t):this.menu.empty()},_onWhitespaceChanged:function(){this._updateHint()},_onLangDirChanged:function(n,t){this.dir!==t&&(this.dir=t,this.menu.setLanguageDirection(t))},_openIfActive:function(){this.isActive()&&this.open()},_minLengthMet:function(n){return(n=t.isString(n)?n:this.input.getQuery()||"").length>=this.minLength},_updateHint:function(){var r,i,n,f,e,o;r=this.menu.getTopSelectable();i=this.menu.getSelectableData(r);n=this.input.getInputValue();!i||t.isBlankString(n)||this.input.hasOverflow()?this.input.clearHint():(f=u.normalizeQuery(n),e=t.escapeRegExChars(f),(o=new RegExp("^(?:"+e+")(.+$)","i").exec(i.val))&&this.input.setHint(n+o[1]))},isEnabled:function(){return this.enabled},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},isActive:function(){return this.active},activate:function(){return!!this.isActive()||!(!this.isEnabled()||this.eventBus.before("active"))&&(this.active=!0,this.eventBus.trigger("active"),!0)},deactivate:function(){return!this.isActive()||!this.eventBus.before("idle")&&(this.active=!1,this.close(),this.eventBus.trigger("idle"),!0)},isOpen:function(){return this.menu.isOpen()},open:function(){return this.isOpen()||this.eventBus.before("open")||(this.menu.open(),this._updateHint(),this.eventBus.trigger("open")),this.isOpen()},close:function(){return this.isOpen()&&!this.eventBus.before("close")&&(this.menu.close(),this.input.clearHint(),this.input.resetInputValue(),this.eventBus.trigger("close")),!this.isOpen()},setVal:function(n){this.input.setQuery(t.toStr(n))},getVal:function(){return this.input.getQuery()},select:function(n){var t=this.menu.getSelectableData(n);return!(!t||this.eventBus.before("select",t.obj,t.dataset))&&(this.input.setQuery(t.val,!0),this.eventBus.trigger("select",t.obj,t.dataset),this.close(),!0)},autocomplete:function(n){var i,t;return i=this.input.getQuery(),!(!((t=this.menu.getSelectableData(n))&&i!==t.val)||this.eventBus.before("autocomplete",t.obj,t.dataset))&&(this.input.setQuery(t.val),this.eventBus.trigger("autocomplete",t.obj,t.dataset),!0)},moveCursor:function(n){var f,i,t,r,u,e;return f=this.input.getQuery(),i=this.menu.selectableRelativeToCursor(n),r=(t=this.menu.getSelectableData(i))?t.obj:null,u=t?t.dataset:null,e=i?i.attr("id"):null,this.input.trigger("cursorchange",e),!(this._minLengthMet()&&this.menu.update(f))&&!this.eventBus.before("cursorchange",r,u)&&(this.menu.setCursor(i),t?this.input.setInputValue(t.val):(this.input.resetInputValue(),this._updateHint()),this.eventBus.trigger("cursorchange",r,u),!0)},destroy:function(){this.input.destroy();this.menu.destroy()}}),r}();!function(){"use strict";function r(t,i){t.each(function(){var t,r=n(this);(t=r.data(f.typeahead))&&i(t,r)})}function a(i){var r;return(r=t.isJQuery(i)||t.isElement(i)?n(i).first():[]).length?r:null}var v,f,s;v=n.fn.typeahead;f={www:"tt-www",attrs:"tt-attrs",typeahead:"tt-typeahead"};s={initialize:function(r,s){var v;return s=t.isArray(s)?s:[].slice.call(arguments,1),v=e((r=r||{}).classNames),this.each(function(){var e,d,p,w,b,k,it,rt,g,ut,ft,nt,tt,y;t.each(s,function(n){n.highlight=!!r.highlight});e=n(this);d=n(v.html.wrapper);p=a(r.hint);w=a(r.menu);b=!1!==r.hint&&!p;k=!1!==r.menu&&!w;b&&(nt=e,tt=v,p=nt.clone().addClass(tt.classes.hint).removeData().css(tt.css.hint).css((y=nt,{backgroundAttachment:y.css("background-attachment"),backgroundClip:y.css("background-clip"),backgroundColor:y.css("background-color"),backgroundImage:y.css("background-image"),backgroundOrigin:y.css("background-origin"),backgroundPosition:y.css("background-position"),backgroundRepeat:y.css("background-repeat"),backgroundSize:y.css("background-size")})).prop({readonly:!0,required:!1}).removeAttr("id name placeholder").removeClass("required").attr({spellcheck:"false",tabindex:-1}));k&&(w=n(v.html.menu).css(v.css.menu));p&&p.val("");e=function(n,t){n.data(f.attrs,{dir:n.attr("dir"),autocomplete:n.attr("autocomplete"),spellcheck:n.attr("spellcheck"),style:n.attr("style")});n.addClass(t.classes.input).attr({spellcheck:!1});try{n.attr("dir")||n.attr("dir","auto")}catch(n){}return n}(e,v);(b||k)&&(d.css(v.css.wrapper),e.css(b?v.css.input:v.css.inputWithNoHint),e.wrap(d).parent().prepend(b?p:null).append(k?w:null));ft=k?c:i;it=new o({el:e});rt=new u({hint:p,input:e},v);g=new ft({node:w,datasets:s},v);new h({$input:e,menu:g});ut=new l({input:rt,menu:g,eventBus:it,minLength:r.minLength,autoselect:r.autoselect},v);e.data(f.www,v);e.data(f.typeahead,ut)})},isEnabled:function(){var n;return r(this.first(),function(t){n=t.isEnabled()}),n},enable:function(){return r(this,function(n){n.enable()}),this},disable:function(){return r(this,function(n){n.disable()}),this},isActive:function(){var n;return r(this.first(),function(t){n=t.isActive()}),n},activate:function(){return r(this,function(n){n.activate()}),this},deactivate:function(){return r(this,function(n){n.deactivate()}),this},isOpen:function(){var n;return r(this.first(),function(t){n=t.isOpen()}),n},open:function(){return r(this,function(n){n.open()}),this},close:function(){return r(this,function(n){n.close()}),this},select:function(t){var i=!1,u=n(t);return r(this.first(),function(n){i=n.select(u)}),i},autocomplete:function(t){var i=!1,u=n(t);return r(this.first(),function(n){i=n.autocomplete(u)}),i},moveCursor:function(n){var t=!1;return r(this.first(),function(i){t=i.moveCursor(n)}),t},val:function(n){var i;return arguments.length?(r(this,function(i){i.setVal(t.toStr(n))}),this):(r(this.first(),function(n){i=n.getVal()}),i)},destroy:function(){return r(this,function(n,i){var r,e,u;e=(r=i).data(f.www);u=r.parent().filter(e.selectors.wrapper);t.each(r.data(f.attrs),function(n,i){t.isUndefined(n)?r.removeAttr(i):r.attr(i,n)});r.removeData(f.typeahead).removeData(f.www).removeData(f.attr).removeClass(e.classes.input);u.length&&(r.detach().insertAfter(u),u.remove());n.destroy()}),this}};n.fn.typeahead=function(n){return s[n]?s[n].apply(this,[].slice.call(arguments,1)):s.initialize.apply(this,arguments)};n.fn.typeahead.noConflict=function(){return n.fn.typeahead=v,this}}()});var autocompleteterms=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.nonword("t","i","m","n"),queryTokenizer:Bloodhound.tokenizers.nonword,prefetch:"/webcontent/typeahead.json",sorter:function(n,t){return n.r-t.r}});$(".typeahead-search").typeahead({highlight:!0,minLength:2,hint:!1,limit:5,fitToElement:!0},{name:"autocompleteterms",source:autocompleteterms,limit:5,displayKey:function(n){return n.n},templates:{suggestion:function(n){return'<div data-result-s="'+n.r+'" class="clearfix"><div class="col-sm-2 hidden-xs"><img src="'+imageurlfromsku(n.i)+'" style="margin: 2px 5px;"/><\/div> <div class="col-xs-12 col-sm-10"> '+n.n+"<\/div><\/div>"},header:'<h4 style="padding:0 5px">Top product results:<\/h4> <hr style="margin:3px;">',footer:function(n){return'<hr style="margin:3px;"><a class="h4 no-style w-selectable" href="/search/?q='+n.query+'" style="padding:0 5px">View all results for <b>"'+n.query+'" &raquo;<\/b><\/a>'}},updater:function(n){return this.$element[0].value=n,this.$element[0].form.submit(),n}});$(".typeahead-search").bind("typeahead:select",function(n,t){dataLayer.push({event:"GAEvent",eventCategory:"Search AutoComplete",eventAction:"suggested",eventLabel:JSON.stringify(t),eventValue:undefined});$("form[name='search']").submit()}),function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(require("jquery")):typeof define=="function"&&define.amd?define(["jquery"],t):t(n.$)}(this,function(n){"use strict";function w(n,t){return t={exports:{}},n(t,t.exports),t.exports}function ay(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function vy(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function yy(n,i){return i&&(s(i)==="object"||typeof i=="function")?i:t(n)}function py(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}});t&&eg(n,t)}function wy(n,t,i){return t in n?Object.defineProperty(n,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[t]=i,n}function by(n){if(Array.isArray(n))return n}function ky(n,t){var r=[],u=!0,f=!1,e=undefined,i,o;try{for(i=n[Symbol.iterator]();!(u=(o=i.next()).done);u=!0)if(r.push(o.value),t&&r.length===t)break}catch(s){f=!0;e=s}finally{try{u||i["return"]==null||i["return"]()}finally{if(f)throw e;}}return r}function dy(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function gy(n,t){return lo(n)||ao(n,t)||vo()}function np(n,t){return n!=null&&hg.call(n,t)}function tp(n){var i=wg.call(n,vi),r=n[vi],t;try{n[vi]=undefined}catch(u){}return t=bg.call(n),i?n[vi]=r:delete n[vi],t}function ip(n){return gg.call(n)}function rp(n){return n==null?n===undefined?rn:tn:el&&el in Object(n)?kg(n):nn(n)}function up(n){return n!=null&&typeof n=="object"}function fp(n){return typeof n=="symbol"||ht(n)&&st(n)==yo}function ep(n,t){if(d(n))return!1;var i=typeof n;return i=="number"||i=="symbol"||i=="boolean"||n==null||vf(n)?!0:fn.test(n)||!un.test(n)||t!=null&&n in Object(t)}function op(n){var t=typeof n;return n!=null&&(t=="object"||t=="function")}function sp(n){if(!yf(n))return!1;var t=st(n);return t==on||t==sn||t==en||t==hn}function hp(n){return!!sl&&sl in n}function cp(n){if(n!=null){try{return vn.call(n)}catch(t){}try{return n+""}catch(t){}}return""}function lp(n){if(!yf(n)||ln(n))return!1;var t=ol(n)?dn:yn;return t.test(yt(n))}function ap(n,t){return n==null?undefined:n[t]}function vp(n,t){var i=wo(n,t);return po(i)?i:undefined}function yp(){this.__data__=yi?yi(null):{};this.size=0}function pp(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function wp(n){var t=this.__data__,i;return yi?(i=t[n],i===ttt?undefined:i):rtt.call(t,n)?t[n]:undefined}function bp(n){var t=this.__data__;return yi?t[n]!==undefined:ett.call(t,n)}function kp(n,t){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=yi&&t===undefined?go:t,this}function bt(n){var i=-1,r=n==null?0:n.length,t;for(this.clear();++i<r;)t=n[i],this.set(t[0],t[1])}function dp(){this.__data__=[];this.size=0}function gp(n,t){return n===t||n!==n&&t!==t}function nw(n,t){for(var i=n.length;i--;)if(ou(n[i][0],t))return i;return-1}function tw(n){var t=this.__data__,i=vr(t,n),r;return i<0?!1:(r=t.length-1,i==r?t.pop():stt.call(t,i,1),--this.size,!0)}function iw(n){var t=this.__data__,i=vr(t,n);return i<0?undefined:t[i][1]}function rw(n){return vr(this.__data__,n)>-1}function uw(n,t){var i=this.__data__,r=vr(i,n);return r<0?(++this.size,i.push([n,t])):i[r][1]=t,this}function kt(n){var i=-1,r=n==null?0:n.length,t;for(this.clear();++i<r;)t=n[i],this.set(t[0],t[1])}function fw(){this.size=0;this.__data__={hash:new eu,map:new(pi||yr),string:new eu}}function ew(n){var t=typeof n;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?n!=="__proto__":n===null}function ow(n,t){var i=n.__data__;return os(t)?i[typeof t=="string"?"string":"hash"]:i.map}function sw(n){var t=ei(this,n)["delete"](n);return this.size-=t?1:0,t}function hw(n){return ei(this,n).get(n)}function cw(n){return ei(this,n).has(n)}function lw(n,t){var i=ei(this,n),r=i.size;return i.set(n,t),this.size+=i.size==r?0:1,this}function dt(n){var i=-1,r=n==null?0:n.length,t;for(this.clear();++i<r;)t=n[i],this.set(t[0],t[1])}function uu(n,t){if(typeof n!="function"||t!=null&&typeof t!="function")throw new TypeError(as);var i=function(){var u=arguments,f=t?t.apply(this,u):u[0],r=i.cache,e;return r.has(f)?r.get(f):(e=n.apply(this,u),i.cache=r.set(f,e)||r,e)};return i.cache=new(uu.Cache||oi),i}function aw(n){var t=vs(n,function(n){return i.size===ys&&i.clear(),n}),i=t.cache;return t}function vw(n,t){for(var i=-1,r=n==null?0:n.length,u=Array(r);++i<r;)u[i]=t(n[i],i,n);return u}function fo(n){if(typeof n=="string")return n;if(d(n))return ptt(n,fo)+"";if(vf(n))return cl?cl.call(n):"";var t=n+"";return t=="0"&&1/n==-wtt?"-0":t}function yw(n){return n==null?"":ps(n)}function pw(n,t){return d(n)?n:er(n,t)?[n]:ytt(ws(n))}function ww(n){return ht(n)&&st(n)==bs}function bw(n,t){var i=typeof n;return t=t==null?gtt:t,!!t&&(i=="number"||i!="symbol"&&nit.test(n))&&n>-1&&n%1==0&&n<t}function kw(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=ks}function dw(n){if(typeof n=="string"||vf(n))return n;var t=n+"";return t=="0"&&1/n==-ds?"-0":t}function gw(n,t,i){var u;t=su(t,n);for(var f=-1,r=t.length,e=!1;++f<r;){if(u=si(t[f]),!(e=n!=null&&i(n,u)))break;n=n[u]}return e||++f!=r?e:(r=n==null?0:n.length,!!r&&or(r)&&hu(u,r)&&(d(n)||vl(n)))}function nb(n,t){return n!=null&&cu(n,t,cg)}function tb(n,t){t=su(t,n);for(var i=0,r=t.length;n!=null&&i<r;)n=n[si(t[i++])];return i&&i==r?n:undefined}function ib(n,t,i){var r=n==null?undefined:lu(n,t);return r===undefined?i:r}function eo(){var n=jQuery,r=n.extend(!0,{},fu,afdOptions),t=n(this),u=r.typeahead.containers.length===0?n(document):t.closest(afdOptions.typeahead.containers.toString()),i;if(u.find('[data-afd-control="typeahead"]').length>1&&console.warn("More than one instance of `typeahead` detected.  If these are in separate containers please define the containers in `afdOptions.typeahead.containers`"),!t.is("input"))throw"<"+t.prop("tagName").toLowerCase()+'> is not a valid tag for `[data-afd-control="typeahead"]`, use <input>';i=new th(t,r);n(document).off("afd:init.afd").on("afd:init.afd",function(){i.init()});i.init()}function rb(n){var t,i;this.promise=new n(function(n,r){if(t!==undefined||i!==undefined)throw TypeError("Bad Promise constructor");t=n;i=r});this.resolve=ni(t);this.reject=ni(i)}function oo(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}function ub(n,t,i){return t&&oo(n.prototype,t),i&&oo(n,i),n}function fb(n,t){for(var i=-1,f=n==null?0:n.length,e=0,u=[],r;++i<f;)r=n[i],t(r,i,n)&&(u[e++]=r);return u}function eb(n){return function(t,i,r){for(var s=-1,f=Object(t),e=r(t),o=e.length,u;o--;)if(u=e[n?o:++s],i(f[u],u,f)===!1)break;return t}}function ob(n,t){for(var i=-1,r=Array(n);++i<n;)r[i]=t(i);return r}function sb(){return!1}function hb(n){return ht(n)&&or(n.length)&&!!e[st(n)]}function cb(n){return function(t){return n(t)}}function lb(n,t){var r=d(n),u=!r&&vl(n),f=!r&&!u&&ge(n),o=!r&&!u&&!f&&bv(n),s=r||u||f||o,e=s?uh(n.length,String):[],h=e.length;for(var i in n)(t||nft.call(n,i))&&(!s||!(i=="length"||f&&(i=="offset"||i=="parent")||o&&(i=="buffer"||i=="byteLength"||i=="byteOffset")||hu(i,h)))&&e.push(i);return e}function ab(n){var t=n&&n.constructor,i=typeof t=="function"&&t.prototype||oh;return n===i}function vb(n,t){return function(i){return n(t(i))}}function yb(n){var i,t;if(!sh(n))return rft(n);i=[];for(t in Object(n))fft.call(n,t)&&t!="constructor"&&i.push(t);return i}function pb(n){return n!=null&&or(n.length)&&!ol(n)}function wb(n){return wu(n)?eh(n):hh(n)}function bb(n,t){return n&&wut(n,t,hr)}function kb(n,t){return function(i,r){if(i==null)return i;if(!wu(i))return n(i,r);for(var f=i.length,u=t?f:-1,e=Object(i);t?u--:++u<f;)if(r(e[u],u,e)===!1)break;return i}}function db(n,t){var i=[];return sft(n,function(n,r,u){t(n,r,u)&&i.push(n)}),i}function gb(){this.__data__=new yr;this.size=0}function nk(n){var t=this.__data__,i=t["delete"](n);return this.size=t.size,i}function tk(n){return this.__data__.get(n)}function ik(n){return this.__data__.has(n)}function rk(n,t){var i=this.__data__,r;if(i instanceof yr){if(r=i.__data__,!pi||r.length<wh-1)return r.push([n,t]),this.size=++i.size,this;i=this.__data__=new oi(r)}return i.set(n,t),this.size=i.size,this}function gt(n){var t=this.__data__=new yr(n);this.size=t.size}function uk(n){return this.__data__.set(n,kh),this}function fk(n){return this.__data__.has(n)}function rr(n){var t=-1,i=n==null?0:n.length;for(this.__data__=new oi;++t<i;)this.add(n[t])}function ek(n,t){for(var i=-1,r=n==null?0:n.length;++i<r;)if(t(n[i],i,n))return!0;return!1}function ok(n,t){return n.has(t)}function sk(n,t,i,r,u,f){var y=i&cft,c=n.length,p=t.length,l,e,o,a;if(c!=p&&!(y&&p>c))return!1;if(l=f.get(n),l&&f.get(t))return l==t;var s=-1,h=!0,v=i&lft?new nc:undefined;for(f.set(n,t),f.set(t,n);++s<c;){if(e=n[s],o=t[s],r&&(a=y?r(o,e,s,t,n,f):r(e,o,s,n,t,f)),a!==undefined){if(a)continue;h=!1;break}if(v){if(!tc(t,function(n,t){if(!hft(v,t)&&(e===n||u(e,n,i,r,f)))return v.push(t)})){h=!1;break}}else if(!(e===o||u(e,o,i,r,f))){h=!1;break}}return f["delete"](n),f["delete"](t),h}function hk(n){var i=-1,t=Array(n.size);return n.forEach(function(n,r){t[++i]=[r,n]}),t}function ck(n){var i=-1,t=Array(n.size);return n.forEach(function(n){t[++i]=n}),t}function lk(n,t,i,r,u,f,e){var o,h,s,c;switch(i){case fet:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer;t=t.buffer;case uet:return n.byteLength!=t.byteLength||!f(new dv(n),new dv(t))?!1:!0;case wft:case bft:case gft:return ou(+n,+t);case kft:return n.name==t.name&&n.message==t.message;case net:case iet:return n==t+"";case dft:o=ic;case tet:return(h=r&yft,o||(o=vft),n.size!=t.size&&!h)?!1:(s=e.get(n),s)?s==t:(r|=pft,e.set(n,t),c=kv(o(n),o(t),r,u,f,e),e["delete"](n),c);case ret:if(no)return no.call(n)==no.call(t)}return!1}function ak(n,t){for(var i=-1,r=t.length,u=n.length;++i<r;)n[u+i]=t[i];return n}function vk(n,t,i){var r=t(n);return d(n)?r:uc(r,i(n))}function yk(){return[]}function pk(n){return fc(n,hr,cet)}function wk(n,t,i,r,u,f){var v=i&aet,p=ty(n),w=p.length,d=ty(t),g=d.length,o,e,b,s,y,h,c,k,l,a;if(w!=g&&!v)return!1;for(o=w;o--;)if(e=p[o],!(v?e in t:yet.call(t,e)))return!1;if(b=f.get(n),b&&f.get(t))return b==t;for(s=!0,f.set(n,t),f.set(t,n),y=v;++o<w;){if(e=p[o],h=n[e],c=t[e],r&&(k=v?r(c,h,e,t,n,f):r(h,c,e,n,t,f)),!(k===undefined?h===c||u(h,c,i,r,f):k)){s=!1;break}y||(y=e=="constructor")}return s&&!y&&(l=n.constructor,a=t.constructor,l!=a&&"constructor"in n&&"constructor"in t&&!(typeof l=="function"&&l instanceof l&&typeof a=="function"&&a instanceof a)&&(s=!1)),f["delete"](n),f["delete"](t),s}function bk(n,t,i,r,u,f){var s=d(n),p=d(t),e=s?hy:oy(n),o=p?hy:oy(t),h,c,v,y;e=e==sy?ru:e;o=o==sy?ru:o;var l=e==ru,w=o==ru,a=e==o;if(a&&ge(n)){if(!ge(t))return!1;s=!0;l=!1}return a&&!l?(f||(f=new ci),s||bv(n)?kv(n,t,i,r,u,f):rc(n,t,e,i,r,u,f)):!(i&fot)&&(h=l&&cy.call(n,"__wrapped__"),c=w&&cy.call(t,"__wrapped__"),h||c)?(v=h?n.value():n,y=c?t.value():t,f||(f=new ci),u(v,y,i,r,f)):a?(f||(f=new ci),pet(n,t,i,r,u,f)):!1}function so(n,t,i,r,u){return n===t?!0:n==null||t==null||!ht(n)&&!ht(t)?n!==n&&t!==t:ec(n,t,i,r,so,u)}function kk(n,t,i,r){var f=i.length,c=f,l=!r,u,e,o;if(n==null)return!c;for(n=Object(n);f--;)if(u=i[f],l&&u[2]?u[1]!==n[u[0]]:!(u[0]in n))return!1;while(++f<c){u=i[f];var s=u[0],h=n[s],a=u[1];if(l&&u[2]){if(h===undefined&&!(s in n))return!1}else if(e=new ci,r&&(o=r(h,a,s,n,t,e)),!(o===undefined?ly(a,h,oot|sot,r,e):o))return!1}return!0}function dk(n){return n===n&&!yf(n)}function gk(n){for(var t=hr(n),i=t.length,r,u;i--;)r=t[i],u=n[r],t[i]=[r,u,bu(u)];return t}function nd(n,t){return function(i){return i==null?!1:i[n]===t&&(t!==undefined||n in Object(i))}}function td(n){var t=sc(n);return t.length==1&&t[0][2]?ku(t[0][0],t[0][1]):function(i){return i===n||oc(i,n,t)}}function id(n,t){return n!=null&&t in Object(n)}function rd(n,t){return n!=null&&cu(n,t,cc)}function ud(n,t){return er(n)&&bu(t)?ku(si(n),t):function(i){var r=hi(i,n);return r===undefined&&r===t?hot(i,n):ly(t,r,cot|lot)}}function fd(n){return n}function ed(n){return function(t){return t==null?undefined:t[n]}}function od(n){return function(t){return lu(t,n)}}function sd(n){return er(n)?vc(si(n)):yc(n)}function hd(n){return typeof n=="function"?n:n==null?ac:typeof n=="object"?d(n)?lc(n[0],n[1]):hc(n):pc(n)}function cd(n,t){var i=d(n)?pu:lh;return i(n,wc(t,3))}function ho(n,t){var i=jQuery,u=i(this),f=i.extend(!0,{},fu,afdOptions),r;try{r=new vot(u,f);r.init().then(function(){t()})}catch(e){console.error("Error initialising country control");console.error(e)}}function ld(){typeof afdDataInit=="undefined"&&(window.afdDataInit=!1);$(document).ready(function(){window.afdDataInit||(window.afdDataInit=!0,$(document).trigger("afd::page_ready"))});$(document).off("afd::page_ready").on("afd::page_ready",function(){var n=["country"],t=[];$("[data-afd-control]").each(function(){var i=$(this),r=i.data("afd-control");n.indexOf(r)>-1&&t.push(new Promise(function(n){co(i,r,n)}))});Promise.all(t).then(function(){$("[data-afd-control]").each(function(){var t=$(this),i=t.data("afd-control");n.indexOf(i)===-1&&co(t,i,null)})})})}function co(n,t,i){try{n.afd(t,i)}catch(r){console.error(r)}}var rt,ur,fu,fi,s,t,fr,lo,ao,vo,st,ht,yo,er,po,wo,bo,ko,go,ns,eu,ts,ou,is,rs,us,fs,es,os,ei,ss,hs,cs,ls,oi,as,vs,ys,ps,ws,su,bs,hu,ks,or,ds,si,cu,ct,lu,hi,gs,au,vu,yu,sr,nh,a,th,ih,rh,pu,uh,fh,eh,oh,sh,hh,wu,hr,ch,lh,ah,vh,yh,ph,wh,bh,ci,kh,dh,gh,nc,tc,ic,rc,uc,fc,ec,oc,bu,sc,ku,hc,cc,lc,ac,vc,yc,pc,wc;n=n&&n.hasOwnProperty("default")?n["default"]:n;rt=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};var r=w(function(n){var t=n.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=t)}),b=w(function(n){var t=n.exports={version:"2.5.7"};typeof __e=="number"&&(__e=t)}),yot=b.version,v=function(n){return typeof n=="object"?n!==null:typeof n=="function"},y=function(n){if(!v(n))throw TypeError(n+" is not an object!");return n},tt=function(n){try{return!!n()}catch(t){return!0}},k=!tt(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),du=r.document,ad=v(du)&&v(du.createElement),cr=function(n){return ad?du.createElement(n):{}},bc=!k&&!tt(function(){return Object.defineProperty(cr("div"),"a",{get:function(){return 7}}).a!=7}),kc=function(n,t){if(!v(n))return n;var i,r;if(t&&typeof(i=n.toString)=="function"&&!v(r=i.call(n))||typeof(i=n.valueOf)=="function"&&!v(r=i.call(n))||!t&&typeof(i=n.toString)=="function"&&!v(r=i.call(n)))return r;throw TypeError("Can't convert object to primitive value");},vd=Object.defineProperty,yd=k?Object.defineProperty:function(n,t,i){if(y(n),t=kc(t,!0),y(i),bc)try{return vd(n,t,i)}catch(r){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(n[t]=i.value),n},lt={f:yd},gu=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}},p=k?function(n,t,i){return lt.f(n,t,gu(1,i))}:function(n,t,i){return n[t]=i,n},pd={}.hasOwnProperty,at=function(n,t){return pd.call(n,t)},wd=0,bd=Math.random(),nf=function(n){return"Symbol(".concat(n===undefined?"":n,")_",(++wd+bd).toString(36))},vt=w(function(n){var t=nf("src"),i="toString",u=Function[i],f=(""+u).split(i);b.inspectSource=function(n){return u.call(n)};(n.exports=function(n,i,u,e){var o=typeof u=="function";(o&&(at(u,"name")||p(u,"name",i)),n[i]!==u)&&(o&&(at(u,t)||p(u,t,n[i]?""+n[i]:f.join(String(i)))),n===r?n[i]=u:e?n[i]?n[i]=u:p(n,i,u):(delete n[i],p(n,i,u)))})(Function.prototype,i,function(){return typeof this=="function"&&this[t]||u.call(this)})}),ni=function(n){if(typeof n!="function")throw TypeError(n+" is not a function!");return n},c=function(n,t,i){if(ni(n),t===undefined)return n;switch(i){case 1:return function(i){return n.call(t,i)};case 2:return function(i,r){return n.call(t,i,r)};case 3:return function(i,r,u){return n.call(t,i,r,u)}}return function(){return n.apply(t,arguments)}},tf="prototype",l=function(n,t,i){var w=n&l.F,s=n&l.G,k=n&l.S,a=n&l.P,d=n&l.B,e=s?r:k?r[t]||(r[t]={}):(r[t]||{})[tf],o=s?b:b[t]||(b[t]={}),v=o[tf]||(o[tf]={}),f,h,u,y;s&&(i=t);for(f in i)h=!w&&e&&e[f]!==undefined,u=(h?e:i)[f],y=d&&h?c(u,r):a&&typeof u=="function"?c(Function.call,u):u,e&&vt(e,f,u,n&l.U),o[f]!=u&&p(o,f,y),a&&v[f]!=u&&(v[f]=u)};r.core=b;l.F=1;l.G=2;l.S=4;l.P=8;l.B=16;l.W=32;l.U=64;l.R=128;var f=l,kd={}.toString,ut=function(n){return kd.call(n).slice(8,-1)},dc=Object("z").propertyIsEnumerable(0)?Object:function(n){return ut(n)=="String"?n.split(""):Object(n)},rf=function(n){if(n==undefined)throw TypeError("Can't call method on  "+n);return n},li=function(n){return Object(rf(n))},dd=Math.ceil,gd=Math.floor,gc=function(n){return isNaN(n=+n)?0:(n>0?gd:dd)(n)},ng=Math.min,uf=function(n){return n>0?ng(gc(n),9007199254740991):0},nl=Array.isArray||function(n){return ut(n)=="Array"},lr=!1,tl=w(function(n){var t="__core-js_shared__",i=r[t]||(r[t]={});(n.exports=function(n,t){return i[n]||(i[n]=t!==undefined?t:{})})("versions",[]).push({version:b.version,mode:"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),o=w(function(n){var t=tl("wks"),i=r.Symbol,u=typeof i=="function",f=n.exports=function(n){return t[n]||(t[n]=u&&i[n]||(u?i:nf)("Symbol."+n))};f.store=t}),tg=o("species"),ig=function(n){var t;return nl(n)&&(t=n.constructor,typeof t=="function"&&(t===Array||nl(t.prototype))&&(t=undefined),v(t)&&(t=t[tg],t===null&&(t=undefined))),t===undefined?Array:t},rg=function(n,t){return new(ig(n))(t)},ug=function(n,t){var r=n==1,e=n==2,o=n==3,i=n==4,u=n==6,s=n==5||u,f=t||rg;return function(t,h,l){for(var b=li(t),y=dc(b),d=c(h,l,3),k=uf(y.length),a=0,p=r?f(t,k):e?f(t,0):undefined,v,w;k>a;a++)if((s||a in y)&&(v=y[a],w=d(v,a,b),n))if(r)p[a]=w;else if(w)switch(n){case 3:return!0;case 5:return v;case 6:return a;case 2:p.push(v)}else if(i)return!1;return u?-1:o||i?i:p}},ff=o("unscopables"),ef=Array.prototype;ef[ff]==undefined&&p(ef,ff,{});var ar=function(n){ef[ff][n]=!0},fg=ug(5),of="find",il=!0;of in[]&&Array(1)[of](function(){il=!1});f(f.P+f.F*il,"Array",{find:function(n){return fg(this,n,arguments.length>1?arguments[1]:undefined)}});ar(of);ur=function(){var t=y(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n};k&&/./g.flags!="g"&&lt.f(RegExp.prototype,"flags",{configurable:!0,get:ur});var sf="toString",hf=/./[sf],rl=function(n){vt(RegExp.prototype,sf,n,!0)};tt(function(){return hf.call({source:"a",flags:"b"})!="/a/b"})?rl(function(){var n=y(this);return"/".concat(n.source,"/","flags"in n?n.flags:!k&&n instanceof RegExp?ur.call(n):undefined)}):hf.name!=sf&&rl(function(){return hf.call(this)});fu={pceUrl:"//pce.afd.co.uk/afddata.pce",nativeValidationMessages:!1,defaultCountry:null,afdc:0,phone:{defaultDialingCode:"+44",invalidPhoneNumberMessage:"Please input a valid phone number",loadingSpinner:null,countryControl:null,countryControlConverter:null},email:{invalidEmailMessage:"Please input a valid email address",loadingSpinner:null},card:{invalidCardNumberMessage:"Please input a valid card number",invalidCardOrExpiryMessage:"Either the card number or expiry date are not valid",invalidExpiryMonthMessage:"Please input a valid month",invalidExpiryDateMessage:"Please input a valid expiry date",loadingSpinner:null,logoHeight:16,logoWidth:24},account:{invalidAccountNumberMessage:"Please input a valid account number",invalidSortCodeMessage:"Please input a valid Sort Code",loadingSpinner:null},typeahead:{maxItems:5,pushUp:!1,afterHideTypeahead:!1,searchAgain:!0,afterClearTypeahead:!0,beforeHideResults:!1,parentClass:null,fieldSets:[],manualInputButton:!1,fewResultsManualInput:!0,fewResultsManualInputText:"Can't see your address? Enter it manually",notEmptyShowResults:!1,hideEmpties:!1,containers:[],retrieveFields:"standard",availableCountries:[],minLength:2,matchPositions:!1,postcodeFirst:!0,hideForCountries:[],showForCountries:[],containerOnlyContainsControl:!1,regionMap:null,regionAttribute:"value"},lookup:{prefetch:!0,pushUp:!1,beforeHideResults:!1,parentClass:null,fieldSets:[],manualInputButton:!1,hideEmpties:!1,afterRetrieveHideResultsList:!0,postcodeIsLookup:!1,resultsContainer:"",containers:[],retrieveFields:"standard",availableCountries:[],postcodeFirst:!0,hideForCountries:[],showForCountries:[],regionMap:null,regionAttribute:"value",selectAddressText:"Please select an address"},country:{defaultCountry:null,availableCountries:[],preferredCountries:["GBR","USA","CAN"],customCountryControl:null,customCountryConverter:null},reverseGeocode:{maxItems:100,pushUp:!1,fieldSets:[],hideEmpties:!1,afterRetrieveHideResultsList:!0,containers:[],retrieveFields:"standard",postcodeFirst:!0,hideForCountries:[],showForCountries:["GBR"],linkedControl:"typeahead",hideOnDesktop:!1,buttonContainer:null}};fi=ay;s=w(function(n){function t(n){return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)}function i(r){return n.exports=i=typeof Symbol=="function"&&t(Symbol.iterator)==="symbol"?function(n){return t(n)}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":t(n)},i(r)}n.exports=i});t=vy;var cf=yy,lf=w(function(n){function t(i){return n.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},t(i)}n.exports=t}),eg=w(function(n){function t(i,r){return n.exports=t=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},t(i,r)}n.exports=t});fr=py;var i=wy,ai=jQuery,af=function af(n,t){var r=this,u;fi(this,af);i(this,"setupParams",function(n){var t={format:"json"},i,u;if(r.options.serial&&r.options.password)t.serial=r.options.serial,t.password=r.options.password;else if(r.options.token&&r.options.id)t.token=r.options.token,t.id=r.options.id;else throw"You must either supply password and serial, or token and id";if(r.controlType!=="reverseGeocode"&&(r.options.defaultCountry&&(t.countryiso=r.options.defaultCountry),r.options.country.defaultCountry&&(t.countryiso=r.options.country.defaultCountry),i=ai('[data-afd-control="country"]'),i.length>0&&(t.countryiso=i.val()),r.options.country.customCountryControl))if(u=r.options.typeahead.containers.length===0?ai(r.options.country.customCountryControl):r.$element.closest(r.options.typeahead.containers.toString).find(r.options.country.customCountryControl),r.options.country.customCountryConverter){if(typeof r.options.country.customCountryConverter!="function")throw"customCountryConverter Must be a function";t.countryiso=r.options.country.customCountryConverter(u.val())}else t.countryiso=u.val();try{return{method:"GET",url:r.options.pceUrl,error:function(n,t,i){console.log(n);console.log(t);console.log(i);ai(document).trigger("afd:pceError",n)},data:ai.extend(!0,{},t,n),callback:typeof r.requestCallback!="undefined"?{done:r.requestCallback}:null,beforeSend:typeof r.beforeSend!="undefined"?r.beforeSend:null}}catch(f){console.error("Error setting up request");console.error(f)}});i(this,"eventHandler",function(n,t,i){n.off(t+".afd").on(t+".afd",i)});this.$element=n;this.element=n.get()[0];typeof n.data("afd-additional-options")!="undefined"?(u=window[n.data("afd-additional-options")],this.options=ai.extend(!0,{},t,u)):this.options=t};lo=by;ao=ky;vo=dy;var og=gy,sg=Object.prototype,hg=sg.hasOwnProperty,cg=np,lg=Array.isArray,d=lg,ag=typeof rt=="object"&&rt&&rt.Object===Object&&rt,ul=ag,vg=typeof self=="object"&&self&&self.Object===Object&&self,yg=ul||vg||Function("return this")(),it=yg,pg=it.Symbol,ft=pg,fl=Object.prototype,wg=fl.hasOwnProperty,bg=fl.toString,vi=ft?ft.toStringTag:undefined,kg=tp,dg=Object.prototype,gg=dg.toString,nn=ip,tn="[object Null]",rn="[object Undefined]",el=ft?ft.toStringTag:undefined;st=rp;ht=up;yo="[object Symbol]";var vf=fp,un=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fn=/^\w*$/;er=ep;var yf=op,en="[object AsyncFunction]",on="[object Function]",sn="[object GeneratorFunction]",hn="[object Proxy]",ol=sp,cn=it["__core-js_shared__"],pf=cn,sl=function(){var n=/[^.]+$/.exec(pf&&pf.keys&&pf.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ln=hp,an=Function.prototype,vn=an.toString,yt=cp,yn=/^\[object .+?Constructor\]$/,pn=Function.prototype,wn=Object.prototype,bn=pn.toString,kn=wn.hasOwnProperty,dn=RegExp("^"+bn.call(kn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");po=lp;wo=ap;var ti=vp,gn=ti(Object,"create"),yi=gn;bo=yp;var ntt=pp,ttt="__lodash_hash_undefined__",itt=Object.prototype,rtt=itt.hasOwnProperty,utt=wp,ftt=Object.prototype,ett=ftt.hasOwnProperty;ko=bp;go="__lodash_hash_undefined__";ns=kp;bt.prototype.clear=bo;bt.prototype["delete"]=ntt;bt.prototype.get=utt;bt.prototype.has=ko;bt.prototype.set=ns;eu=bt;ts=dp;ou=gp;var vr=nw,ott=Array.prototype,stt=ott.splice;is=tw;rs=iw;us=rw;fs=uw;kt.prototype.clear=ts;kt.prototype["delete"]=is;kt.prototype.get=rs;kt.prototype.has=us;kt.prototype.set=fs;var yr=kt,htt=ti(it,"Map"),pi=htt;es=fw;os=ew;ei=ow;ss=sw;hs=hw;cs=cw;ls=lw;dt.prototype.clear=es;dt.prototype["delete"]=ss;dt.prototype.get=hs;dt.prototype.has=cs;dt.prototype.set=ls;oi=dt;as="Expected a function";uu.Cache=oi;vs=uu;ys=500;var ctt=aw,ltt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,att=/\\(\\)?/g,vtt=ctt(function(n){var t=[];return n.charCodeAt(0)===46&&t.push(""),n.replace(ltt,function(n,i,r,u){t.push(r?u.replace(att,"$1"):i||n)}),t}),ytt=vtt,ptt=vw,wtt=1/0,hl=ft?ft.prototype:undefined,cl=hl?hl.toString:undefined;ps=fo;ws=yw;su=pw;bs="[object Arguments]";var ll=ww,al=Object.prototype,btt=al.hasOwnProperty,ktt=al.propertyIsEnumerable,dtt=ll(function(){return arguments}())?ll:function(n){return ht(n)&&btt.call(n,"callee")&&!ktt.call(n,"callee")},vl=dtt,gtt=9007199254740991,nit=/^(?:0|[1-9]\d*)$/;hu=bw;ks=9007199254740991;or=kw;ds=1/0;si=dw;cu=gw;ct=nb;lu=tb;hi=ib,function(n){function e(n){n=n||"";(n instanceof URLSearchParams||n instanceof e)&&(n=n.toString());this[r]=h(n)}function c(n){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\x00"};return encodeURIComponent(n).replace(/[!'\(\)~]|%20|%00/g,function(n){return t[n]})}function o(n){return n.replace(/[ +]/g,"%20").replace(/(%[a-f0-9]{2})+/ig,function(n){return decodeURIComponent(n)})}function s(t){var i={next:function(){var n=t.shift();return{done:n===undefined,value:n}}};return y&&(i[n.Symbol.iterator]=function(){return i}),i}function h(n){var i={},u,r,e,c,s,t,h;if(typeof n=="object")if(l(n))for(u=0;u<n.length;u++)if(r=n[u],l(r)&&r.length===2)f(i,r[0],r[1]);else throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");else for(e in n)n.hasOwnProperty(e)&&f(i,e,n[e]);else for(n.indexOf("?")===0&&(n=n.slice(1)),c=n.split("&"),s=0;s<c.length;s++)t=c[s],h=t.indexOf("="),-1<h?f(i,o(t.slice(0,h)),o(t.slice(h+1))):t&&f(i,o(t),"");return i}function f(n,t,i){var r=typeof i=="string"?i:i!==null&&i!==undefined&&typeof i.toString=="function"?i.toString():JSON.stringify(i);t in n?n[t].push(r):n[t]=[r]}function l(n){return!!n&&"[object Array]"===Object.prototype.toString.call(n)}var i=n.URLSearchParams&&n.URLSearchParams.prototype.get?n.URLSearchParams:null,a=i&&new i({a:1}).toString()==="a=1",v=i&&new i("s=%2B").get("s")==="+",r="__URLSearchParams__",b=i?function(){var n=new i;return n.append("s"," &"),n.toString()==="s=+%26"}():!0,u=e.prototype,y=!!(n.Symbol&&n.Symbol.iterator),p,w,t;i&&a&&v&&b||(u.append=function(n,t){f(this[r],n,t)},u["delete"]=function(n){delete this[r][n]},u.get=function(n){var t=this[r];return n in t?t[n][0]:null},u.getAll=function(n){var t=this[r];return n in t?t[n].slice(0):[]},u.has=function(n){return n in this[r]},u.set=function(n,t){this[r][n]=[""+t]},u.toString=function(){var u=this[r],f=[],n,t,e,i;for(t in u)for(e=c(t),n=0,i=u[t];n<i.length;n++)f.push(e+"="+c(i[n]));return f.join("&")},p=!v,w=!p&&i&&!a&&n.Proxy,Object.defineProperty(n,"URLSearchParams",{value:w?new Proxy(i,{construct:function(n,t){return new n(new e(t[0]).toString())}}):e}),t=n.URLSearchParams.prototype,t.polyfill=!0,t.forEach=t.forEach||function(n,t){var i=h(this.toString());Object.getOwnPropertyNames(i).forEach(function(r){i[r].forEach(function(i){n.call(t,i,r,this)},this)},this)},t.sort=t.sort||function(){var f=h(this.toString()),t=[],e,n,i,r,u;for(e in f)t.push(e);for(t.sort(),n=0;n<t.length;n++)this["delete"](t[n]);for(n=0;n<t.length;n++)for(r=t[n],u=f[r],i=0;i<u.length;i++)this.append(r,u[i])},t.keys=t.keys||function(){var n=[];return this.forEach(function(t,i){n.push(i)}),s(n)},t.values=t.values||function(){var n=[];return this.forEach(function(t){n.push(t)}),s(n)},t.entries=t.entries||function(){var n=[];return this.forEach(function(t,i){n.push([i,t])}),s(n)},y&&(t[n.Symbol.iterator]=t[n.Symbol.iterator]||t.entries))}(typeof rt!="undefined"?rt:typeof window!="undefined"?window:rt);var u=jQuery,tit=function(n){var r;return r=function(n){function r(n,f){var e;return fi(this,r),e=cf(this,lf(r).call(this,n,f)),i(t(t(e)),"initRequestSequence",function(){e.seq=0;e.lastSeq=0}),i(t(t(e)),"beforeSend",function(n,t){var i=new URLSearchParams(t.url);n.lookup=i.get("lookup");n.seq=e.seq;e.seq++;u(document).trigger("afd:pceLookupStarted",[n,i.get("lookup")])}),i(t(t(e)),"requestCallback",function(n,t,i){u(document).trigger("afd:pceLookupComplete",[n,i,i.lookup])}),i(t(t(e)),"refreshUniqeID",function(){e.uniqueID=e.getUniqueID()}),i(t(t(e)),"getUniqueID",function(){return Math.floor(Math.random()*9e4)+1e4}),i(t(t(e)),"setFields",function(){var n=e.options[e.controlType].linkedControl?e.options[e.controlType].linkedControl:e.controlType;if(e.$typeaheadFieldandLabel=e.$typeaheadFieldandLabel=hi(e.options,n+".containerOnlyContainsControl",!1)?u(".afd-typeahead-container"):u(".afd-typeahead-container label, .afd-typeahead-field"),e.$typeAheadInput=u(".afd-typeahead-container input"),e.$resultFields=u("[data-afd-result]"),e.$typeaheadContainer=u(".afd-typeahead-container"),e.$errorField=u(".afd-"+n+"-error"),e.$manualInputButton=ct(e.options,n+".manualInputButtonIdentifier")?u(e.options[n].manualInputButtonIdentifier):u(".afd-manual-input-button"),e.$manualInputSearchButton=ct(e.options,n+".manualInputSearchButtonIdentifier")?u(e.options[n].manualInputSearchButtonIdentifier):u(".afd-manual-input-search-button"),e.$searchAgainButton=ct(e.options,n+".searchAgainButtonIdentifier")?u(e.options[n].searchAgainButtonIdentifier):u(".afd-search-again"),e.$fieldSets=u(e.options[n].fieldSets.toString()),e.$afdCountryField=u('[data-afd-control="country"]'),e.$customCountryField=e.options.country.customCountryControl?u(e.options.country.customCountryControl):null,e.containers=e.options[n].containers.toString(),e.multiForms=u(e.containers).length>0,e.$customCountryField){if(e.$customCountryField.length===0)throw"Custom country field selector `"+e.options.country.customCountryControl+"` supplied, but no matching control found.";e.$customCountryField.off("change.afd",e.onCustomCountryChange).on("change.afd",e.onCustomCountryChange)}if(e.$afdCountryField.length>0)e.$afdCountryField.off("change.afd",e.onCustomCountryChange).on("change.afd",e.onCustomCountryChange)}),i(t(t(e)),"initFields",function(){var r=e.controlType,n,f,t,i,o,s;if(e.handleMultiForms(),e.$typeaheadFieldandLabel.show(),n=e.options[r].fieldSets,f=e.getInitialCountry(),e.options[r].beforeHideResults){if(e.$manualInputSearchButton.hide(),e.hideResultFields(f),n.length>0)for(t=0;t<n.length;t++)u(n[t]).hide()}else if(e.showResultFields(),n.length>0)for(i=0;i<n.length;i++)u(n[i]).show();e.options[r].notEmptyShowResults&&(o=e.$element.closest(e.containers),s=e.multiForms?o.find("[data-afd-result]:empty").filter(function(){return u.trim(u(this).val()).length!==0}).length===0:u("[data-afd-result]:empty").filter(function(){return u.trim(u(this).val()).length!==0}).length===0,s||(e.showResultFields(),e.$fieldSets.show(),e.$manualInputButton.hide()))}),i(t(t(e)),"handleMultiForms",function(){var t=e.controlType,n=e.$element.closest(e.containers);if(e.multiForms){if(e.$manualInputButton=ct(e.options,t+".manualInputButtonIdentifier")?n.find(e.options[t].manualInputButtonIdentifier):n.find(".afd-manual-input-button"),e.$manualInputSearchButton=ct(e.options,t+".manualInputSearchButtonIdentifier")?n.find(e.options[t].manualInputSearchButtonIdentifier):n.find(".afd-manual-input-search-button"),e.$searchAgainButton=ct(e.options,t+".searchAgainButtonIdentifier")?n.find(e.options[t].searchAgainButtonIdentifier):n.find(".afd-search-again"),e.$resultFields=n.find("[data-afd-result]"),e.$typeaheadFieldandLabel=hi(e.options,t+".containerOnlyContainsControl",!1)?n.find(".afd-typeahead-container"):n.find(".afd-typeahead-container > label, .afd-typeahead-field"),e.$typeaheadContainer=n.find(".afd-typeahead-container"),e.$errorField=n.find(".afd-"+t+"-error"),e.$afdCountryField=n.find('[data-afd-control="country"]'),e.$customCountryField=e.options.country.customCountryControl?n.find(e.options.country.customCountryControl):null,e.$fieldSets=n.find(e.options[t].fieldSets.toString()),e.$customCountryField){if(e.$customCountryField.length===0)throw"Custom country field selector `"+e.options.country.customCountryControl+"` supplied, but no matching control found within container.";e.$customCountryField.on("change.afd",e.onCustomCountryChange)}if(e.$afdCountryField.length>0)e.$afdCountryField.off("change.afd",e.onCustomCountryChange).on("change.afd",e.onCustomCountryChange)}}),i(t(t(e)),"addressLookup",function(n){var i=e.controlType,t=e.setupParams({data:"address",task:"fastfindv4",fields:e.options[i].postcodeFirst?"list":"fflist",uniqueid:e.uniqueID,lookup:n,allpc:"1"});return e.options.afdc===1&&(t.data.afdc=1),u.ajax(t)}),i(t(t(e)),"addressRetrieve",function(n){var t=e.setupParams({key:n,data:"address",task:"retrieve",fields:e.options[e.controlType].retrieveFields});return e.options.afdc===1&&(t.data.afdc=1),u.ajax(t)}),i(t(t(e)),"reverseGeocodeLookup",function(n){var i=e.controlType,t=e.setupParams({data:"address",task:"nearest",fields:e.options[i].postcodeFirst?"list":"fflist",uniqueid:e.uniqueID,longitude:n.longitude,latitude:n.latitude,allpc:"1"});return e.options.afdc===1&&(t.data.afdc=1),u.ajax(t)}),i(t(t(e)),"handleAddressRetrieve",function(n){var t=e.controlType,i;typeof n.Item!="undefined"&&((i=og(n.Item,1),e.result=i[0],u(document).trigger("afd:pceRetrieveComplete",[e.result]),e.$manualInputButton.hide(),typeof e.$button!="undefined"&&e.$button.hide(),e.options[t].afterClearTypeahead&&e.$typeAheadInput.val(""),e.options[t].afterHideTypeahead&&(e.$typeaheadFieldandLabel.hide(),e.options[t].searchAgain&&e.$searchAgainButton.show()),e.options[t].afterHideLookupButton&&(e.$lookupButton.hide(),e.options[t].searchAgain&&e.$searchAgainButton.show()),e.$fieldSets.show(),e.$resultFields.length<1)||(e.$resultFields.each(e.populateResult),e.$typeAheadInput.blur()))}),i(t(t(e)),"populateResult",function(n){var t=u(e.$resultFields[n]),r=t.data("afd-result"),i=e.options[e.controlType].linkedControl?e.options[e.controlType].linkedControl:e.controlType;if(["Region","State","AbbreviatedOptionalCounty","AbbreviatedPostalCounty","AdministrativeCounty","PostalCounty","TraditionalCounty"].indexOf(r)>-1&&e.options[i].regionMap){if(!t.is("select"))throw"<"+t.prop("tagName").toLowerCase()+'> is not a valid tag for `[data-afd-result="'+r+'"]`, when regionMap is set.  This should be <select>';var f=e.options[i].regionAttribute,h=e.result[r],o=e.options[i].regionMap(e.result),s=t.find("["+f+'="'+o+'"]').val();t.val(s);return}e.options[i].pushUp?Array.isArray(e.options[i].pushUp)?e.handlePushUp(e.options[i].pushUp,r,t):e.handlePushUp(["Property","Street","Locality"],r,t):t.val(e.result[r]);!e.options[i].hideEmpties||t.val()&&t.val().length>0?e.options[i].parentClass?t.closest("."+e.options[i].parentClass).show():t.show():e.options[i].parentClass?t.closest("."+e.options[i].parentClass).hide():t.hide();e.$fieldSets.show();t.keyup();u(document).trigger("afd:populateResultsComplete")}),i(t(t(e)),"populateResultsList",function(){var n=e.$resultList.prop("tagName")==="SELECT"?"option":"li",t,i;for(e.$resultList.empty(),n==="option"&&typeof e.$resultList.attr("multiple")=="undefined"&&e.$resultList.append('<option value="null">'+e.options.lookup.selectAddressText+"<\/option>"),e.results.length===0&&e.$resultList.append("<"+n+' value="null">'+e.options.lookup.noResultsText+"<\/"+n+">"),t=0;t<e.results.length;t++)i=e.results[t],e.$resultList.append("<"+n+' value="'+i.Key+'">'+i.List+"<\/"+n+">");n==="li"&&(e.$resultListResults=e.$resultList.children("li"),e.eventHandler(e.$resultListResults,"click",e.onResultListItemClick));e.$resultList.show().closest(".afd-form-control").show();e.$resultList.focus()}),i(t(t(e)),"onResultListItemClick",function(n){e.selectResult(n)}),i(t(t(e)),"onKeyDownResult",function(n){var t=n.keyCode?n.keyCode:n.which;t===13&&n.preventDefault();[38,40].indexOf(t)>-1&&(e.blockChange=!0)}),i(t(t(e)),"onKeyUpResult",function(n){var t=n.keyCode?n.keyCode:n.which;t===13&&e.selectResult(n)}),i(t(t(e)),"onChangeResult",function(n){e.blockChange||e.selectResult(n);e.blockChange=!1}),i(t(t(e)),"selectResult",function(n){(e.options[e.controlType].afterRetrieveHideResultsList||e.isReverseGeocode)&&e.hideResultsElement();e.addressRetrieve(n.target.value).then(function(n){e.handleAddressRetrieve(n)}).fail(function(n){throw n;})}),i(t(t(e)),"hideResultsElement",function(){e.$resultList.closest(".afd-form-control").hide()}),i(t(t(e)),"hideResultFields",function(n){var t=e.controlType,r=e.options[t].showForCountries.length>0||e.options[t].hideForCountries.length>0,f=!r||e.options[t].showForCountries.length>0&&e.options[t].showForCountries.indexOf(n)>-1||e.options[t].hideForCountries.length>0&&e.options[t].hideForCountries.indexOf(n)===-1,i;f&&(e.options[t].parentClass?e.$resultFields.closest("."+e.options[t].parentClass).hide():e.$resultFields.hide(),e.$fieldSets.hide(),i=hi(e.options,t+".postcodeIsLookup",!1),i&&(e.options[t].parentClass?u('[data-afd-result="Postcode"]').closest("."+e.options[t].parentClass).show():u('[data-afd-result="Postcode"]').show()))}),i(t(t(e)),"showResultFields",function(){var n=e.controlType;e.options[n].parentClass?e.$resultFields.closest("."+e.options[n].parentClass).show():e.$resultFields.show();e.$fieldSets.show()}),i(t(t(e)),"fieldEmpty",function(n){return typeof e.result[n]!="undefined"&&e.result[n].length===0}),i(t(t(e)),"onAfdSearchAgainButtonClick",function(){var n=e.controlType;e.$resultFields.val("");e.$searchAgainButton.hide();n==="typeahead"?e.$typeaheadFieldandLabel.show():n==="lookup"&&(e.$lookupButton.show(),e.$lookupField.focus());e.options[n].beforeHideResults?(e.$manualInputButton.show(),e.hideResultFields(e.country),e.$fieldSets.hide()):(e.$manualInputButton.hide(),e.showResultFields(),e.$fieldSets.show())}),i(t(t(e)),"onAfdManualInputButtonClick",function(){var n=e.controlType,t,i;if(e.$manualInputButton.hide(),e.$manualInputSearchButton.show(),n==="typeahead"?e.$typeaheadFieldandLabel.hide():(e.$lookupButton.hide(),e.hideResultsElement()),e.showResultFields(),e.options[n].fieldSets.length>0)for(t=0;t<e.options[n].fieldSets.length;t++)i=u(e.options[n].fieldSets[t]).show()}),i(t(t(e)),"onAfdManualInputSearchButtonClick",function(){var n=e.controlType;n==="typeahead"?e.$typeaheadFieldandLabel.show():n==="lookup"&&e.$lookupButton.show();e.$manualInputButton.show();e.$manualInputSearchButton.hide();e.hideResultFields(e.country);e.$fieldSets.hide()}),i(t(t(e)),"onCustomCountryChange",function(n){var t=n.target.value;if(e.options.country.customCountryConverter){if(typeof e.options.country.customCountryConverter!="function")throw"customCountryConverter Must be a function";t=e.options.country.customCountryConverter(t)}e.$element.trigger("afd:customCountryChanged",[t]);e.onCountryChanged(t)}),i(t(t(e)),"onCountryChanged",function(n){if(e.$resultFields.val(""),e.country=n,e.handleHideShowControls(n),e.$element.trigger("afd:countryChanged",[n]),typeof e.onCountryChangedLocal!="undefined")e.onCountryChangedLocal(n)}),i(t(t(e)),"handleHideShowControls",function(n){var t=e.controlType;e.$searchAgainButton.hide();e.options[t].hideForCountries.length>0&&(e.options[t].hideForCountries.indexOf(n)>-1?e.hideControls(t):e.showControls(t));e.options[t].showForCountries.length>0&&(e.options[t].showForCountries.indexOf(n)>-1?(e.showControls(t),e.options[t].beforeHideResults?(e.$manualInputButton.show(),e.hideResultFields(n),e.$fieldSets.hide()):(e.$manualInputButton.hide(),e.showResultFields(),e.$fieldSets.show())):(e.hideControls(t),e.showResultFields()));e.options[t].hideForCountries.length===0&&e.options[t].showForCountries.length===0&&e.showControls(t);e.isReverseGeocode&&e.checkVisibilityByCountry(n)}),i(t(t(e)),"showControls",function(n){n==="lookup"?(e.$lookupButton.closest(".afd-form-control").show(),e.$lookupField.closest(".afd-form-control").show()):e.$typeaheadFieldandLabel.show();e.options[n].manualInputButton&&e.$manualInputButton.show()}),i(t(t(e)),"hideControls",function(n){n==="lookup"?(e.$lookupButton.closest(".afd-form-control").hide(),e.$lookupField.closest(".afd-form-control").hide(),e.$resultList.closest(".afd-form-control").hide()):e.$typeaheadFieldandLabel.hide();e.$manualInputButton.hide()}),i(t(t(e)),"getInitialCountry",function(){var n=null;if(e.$customCountryField){if(n=e.$customCountryField.val(),e.options.country.customCountryConverter){if(typeof e.options.country.customCountryConverter!="function")throw"customCountryConverter Must be a function";n=e.options.country.customCountryConverter(n)}e.handleHideShowControls(n)}else e.options.country.defaultCountry?(n=e.options.country.defaultCountry,e.handleHideShowControls(e.options.country.defaultCountry)):e.options.defaultCountry&&(n=e.options.defaultCountry,e.handleHideShowControls(e.options.defaultCountry));return n}),i(t(t(e)),"handlePushUp",function(n,t,i){var f=n.indexOf(t),u,r;if(f===-1){i.val(e.result[t]);return}for(u=[],r=0;r<n.length;r++)e.result[n[r]].length>0&&u.push(e.result[n[r]]);i.val(u[f])}),e.isReverseGeocode=!1,e}return fr(r,n),r}(n),r},wf=function(n,t,i){var r=o(n),u=i(rf,r,""[n]),e=u[0],f=u[1];tt(function(){var t={};return t[r]=function(){return 7},""[n](t)!=7})&&(vt(String.prototype,n,e),p(RegExp.prototype,r,t==2?function(n,t){return f.call(n,this,t)}:function(n){return f.call(n,this)}))};wf("match",1,function(n,t,i){return[function(i){var r=n(this),u=i==undefined?undefined:i[t];return u!==undefined?u.call(i,r):new RegExp(i)[t](String(r))},i]});var iit={}.propertyIsEnumerable,rit={f:iit},pr=function(n){return dc(rf(n))},yl=Object.getOwnPropertyDescriptor,uit=k?yl:function(n,t){if(n=pr(n),t=kc(t,!0),bc)try{return yl(n,t)}catch(i){}if(at(n,t))return gu(!rit.f.call(n,t),n[t])},fit={f:uit},pl=function(n,t){if(y(n),!v(t)&&t!==null)throw TypeError(t+": can't set as prototype!");},eit={set:Object.setPrototypeOf||("__proto__"in{}?function(n,t,i){try{i=c(Function.call,fit.f(Object.prototype,"__proto__").set,2);i(n,[]);t=!(n instanceof Array)}catch(r){t=!0}return function(n,r){return pl(n,r),t?n.__proto__=r:i(n,r),n}}({},!1):undefined),check:pl},wl=eit.set,oit=function(n,t,i){var r=t.constructor,u;return r!==i&&typeof r=="function"&&(u=r.prototype)!==i.prototype&&v(u)&&wl&&wl(n,u),n},sit=Math.max,hit=Math.min,cit=function(n,t){return n=gc(n),n<0?sit(n+t,0):hit(n,t)},lit=function(n){return function(t,i,r){var f=pr(t),e=uf(f.length),u=cit(r,e),o;if(n&&i!=i){while(e>u)if(o=f[u++],o!=o)return!0}else for(;e>u;u++)if((n||u in f)&&f[u]===i)return n||u||0;return!n&&-1}},bl=tl("keys"),bf=function(n){return bl[n]||(bl[n]=nf(n))},ait=lit(!1),vit=bf("IE_PROTO"),kl=function(n,t){var u=pr(n),f=0,r=[];for(var i in u)i!=vit&&at(u,i)&&r.push(i);while(t.length>f)at(u,i=t[f++])&&(~ait(r,i)||r.push(i));return r},wr="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),yit=wr.concat("length","prototype"),pit=Object.getOwnPropertyNames||function(n){return kl(n,yit)},wit={f:pit},bit=o("match"),dl=function(n){var t;return v(n)&&((t=n[bit])!==undefined?!!t:ut(n)=="RegExp")},gl=o("species"),na=function(n){var t=r[n];k&&t&&!t[gl]&&lt.f(t,gl,{configurable:!0,get:function(){return this}})},kit=lt.f,dit=wit.f,h=r.RegExp,wi=h,kf=h.prototype,bi=/a/g,df=/a/g,ta=new h(bi)!==bi;if(k&&(!ta||tt(function(){return df[o("match")]=!1,h(bi)!=bi||h(df)==df||h(bi,"i")!="/a/i"}))){for(h=function(n,t){var u=this instanceof h,i=dl(n),r=t===undefined;return!u&&i&&n.constructor===h&&r?n:oit(ta?new wi(i&&!r?n.source:n,t):wi((i=n instanceof h)?n.source:n,i&&r?ur.call(n):t),u?this:kf,h)},gs=function(n){n in h||kit(h,n,{configurable:!0,get:function(){return wi[n]},set:function(t){wi[n]=t}})},au=dit(wi),vu=0;au.length>vu;)gs(au[vu++]);kf.constructor=h;h.prototype=kf;vt(r,"RegExp",h)}na("RegExp");var git=function(n,t){return!!n&&tt(function(){t?n.call(null,function(){},1):n.call(null)})},gf=[].sort,ia=[1,2,3];f(f.P+f.F*(tt(function(){ia.sort(undefined)})||!tt(function(){ia.sort(null)})||!git(gf)),"Array",{sort:function(n){return n===undefined?gf.call(li(this)):gf.call(li(this),ni(n))}});wf("split",2,function(n,t,i){var s=dl,e=i,h=[].push,u="split",r="length",o="lastIndex",f;return"abbc"[u](/(b)*/)[1]=="c"||"test"[u](/(?:)/,-1)[r]!=4||"ab"[u](/(?:ab)*/)[r]!=2||"."[u](/(.?)(.?)/)[r]!=4||"."[u](/()()/)[r]>1||""[u](/.?/)[r]?(f=/()??/.exec("")[1]===undefined,i=function(n,t){var c=String(this);if(n===undefined&&t===0)return[];if(!s(n))return e.call(c,n,t);var u=[],w=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(n.sticky?"y":""),l=0,y=t===undefined?4294967295:t>>>0,a=new RegExp(n.source,w+"g"),b,i,p,k,v;for(f||(b=new RegExp("^"+a.source+"$(?!\\s)",w));i=a.exec(c);){if(p=i.index+i[0][r],p>l&&(u.push(c.slice(l,i.index)),!f&&i[r]>1&&i[0].replace(b,function(){for(v=1;v<arguments[r]-2;v++)arguments[v]===undefined&&(i[v]=undefined)}),i[r]>1&&i.index<c[r]&&h.apply(u,i.slice(1)),k=i[0][r],l=p,u[r]>=y))break;a[o]===i.index&&a[o]++}return l===c[r]?(k||!a.test(""))&&u.push(""):u.push(c.slice(l)),u[r]>y?u.slice(0,y):u}):"0"[u](undefined,0)[r]&&(i=function(n,t){return n===undefined&&t===0?[]:e.call(this,n,t)}),[function(r,u){var f=n(this),e=r==undefined?undefined:r[t];return e!==undefined?e.call(r,f,u):i.call(String(f),r,u)},i]});wf("replace",2,function(n,t,i){return[function(r,u){var f=n(this),e=r==undefined?undefined:r[t];return e!==undefined?e.call(r,f,u):i.call(String(f),r,u)},i]});var br=function(n,t){return{value:t,done:!!n}},et={},ne=Object.keys||function(n){return kl(n,wr)},nrt=k?Object.defineProperties:function(n,t){y(n);for(var i=ne(t),f=i.length,r=0,u;f>r;)lt.f(n,u=i[r++],t[u]);return n},ra=r.document,te=ra&&ra.documentElement,trt=bf("IE_PROTO"),ie=function(){},re="prototype",kr=function(){var t=cr("iframe"),i=wr.length,r="<",u=">",n;for(t.style.display="none",te.appendChild(t),t.src="javascript:",n=t.contentWindow.document,n.open(),n.write(r+"script"+u+"document.F=Object"+r+"/script"+u),n.close(),kr=n.F;i--;)delete kr[re][wr[i]];return kr()},irt=Object.create||function(n,t){var i;return n!==null?(ie[re]=y(n),i=new ie,ie[re]=null,i[trt]=n):i=kr(),t===undefined?i:nrt(i,t)},rrt=lt.f,ua=o("toStringTag"),ue=function(n,t,i){n&&!at(n=i?n:n.prototype,ua)&&rrt(n,ua,{configurable:!0,value:t})},fa={};p(fa,o("iterator"),function(){return this});var urt=function(n,t,i){n.prototype=irt(fa,{next:gu(1,i)});ue(n,t+" Iterator")},ea=bf("IE_PROTO"),frt=Object.prototype,ert=Object.getPrototypeOf||function(n){return(n=li(n),at(n,ea))?n[ea]:typeof n.constructor=="function"&&n instanceof n.constructor?n.constructor.prototype:n instanceof Object?frt:null},ki=o("iterator"),fe=!([].keys&&"next"in[].keys()),ort="@@iterator",oa="keys",dr="values",sa=function(){return this},srt=function(n,t,i,r,u,e,o){urt(i,t,r);var v=function(n){if(!fe&&n in s)return s[n];switch(n){case oa:return function(){return new i(this,n)};case dr:return function(){return new i(this,n)}}return function(){return new i(this,n)}},k=t+" Iterator",w=u==dr,b=!1,s=n.prototype,h=s[ki]||s[ort]||u&&s[u],c=h||v(u),g=u?w?v("entries"):c:undefined,d=t=="Array"?s.entries||h:h,a,y,l;if(d&&(l=ert(d.call(new n)),l!==Object.prototype&&l.next&&(ue(l,k,!0),lr||typeof l[ki]=="function"||p(l,ki,sa))),w&&h&&h.name!==dr&&(b=!0,c=function(){return h.call(this)}),(!lr||o)&&(fe||b||!s[ki])&&p(s,ki,c),et[t]=c,et[k]=sa,u)if(a={values:w?c:v(dr),keys:e?c:v(oa),entries:g},o)for(y in a)y in s||vt(s,y,a[y]);else f(f.P+f.F*(fe||b),t,a);return a},ha=srt(Array,"Array",function(n,t){this._t=pr(n);this._i=0;this._k=t},function(){var t=this._t,i=this._k,n=this._i++;return!t||n>=t.length?(this._t=undefined,br(1)):i=="keys"?br(0,n):i=="values"?br(0,t[n]):br(0,[n,t[n]])},"values");et.Arguments=et.Array;ar("keys");ar("values");ar("entries");var ca=o("iterator"),la=o("toStringTag"),aa=et.Array,va={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1};for(yu=ne(va),sr=0;sr<yu.length;sr++){var gr=yu[sr],hrt=va[gr],ya=r[gr],pt=ya&&ya.prototype,nu;if(pt&&(pt[ca]||p(pt,ca,aa),pt[la]||p(pt,la,gr),et[gr]=aa,hrt))for(nu in ha)pt[nu]||vt(pt,nu,ha[nu],!0)}nh=function(n,t){var i=(b.Object||{})[n]||Object[n],r={};r[n]=t(i);f(f.S+f.F*tt(function(){i(1)}),"Object",r)};nh("keys",function(){return function(n){return ne(li(n))}}),function(n){var r,t;window.Typeahead={version:"2.10.6"};var e={input:null,minLength:2,maxLength:!1,maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,multiselect:null,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,filter:!0,matcher:null,source:null,abortAjax:!0,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onEnter:null,onLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",labelContainer:"typeahead__label-container",label:"typeahead__label",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},o=".typeahead",u={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},h=~window.navigator.appVersion.indexOf("MSIE 9."),c=~window.navigator.appVersion.indexOf("MSIE 10"),l=~window.navigator.userAgent.indexOf("Trident")?~window.navigator.userAgent.indexOf("rv:11"):!1,f=0,i=function(n,t){this.rawQuery=n.val()||"";this.query=n.val()||"";this.selector=n[0].selector;this.deferred=null;this.tmpSource={};this.source={};this.dynamicGroups=[];this.hasDynamicGroups=!1;this.generatedGroupCount=0;this.groupBy="group";this.groups=[];this.searchGroups=[];this.generateGroups=[];this.requestGroups=[];this.result=[];this.tmpResult={};this.groupTemplate="";this.resultHtml=null;this.resultCount=0;this.resultCountPerGroup={};this.options=t;this.node=n;this.namespace="."+this.helper.slugify.call(this,this.selector)+o;this.isContentEditable=typeof this.node.attr("contenteditable")!="undefined"&&this.node.attr("contenteditable")!=="false";this.container=null;this.resultContainer=null;this.item=null;this.items=null;this.comparedItems=null;this.xhr={};this.hintIndex=null;this.filters={dropdown:{},dynamic:{}};this.dropdownFilter={"static":[],dynamic:[]};this.dropdownFilterAll=null;this.isDropdownEvent=!1;this.requests={};this.backdrop={};this.hint={};this.label={};this.hasDragged=!1;this.focusOnly=!1;this.displayEmptyTemplate;this._lastSeq=0;this.__construct()};return i.prototype={_validateCacheMethod:function(n){var i;if(n===!0)n="localStorage";else if(typeof n=="string"&&!~["localStorage","sessionStorage"].indexOf(n))return this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid options.cache, possible options are "localStorage" or "sessionStorage"'}),t.print()),!1;i=typeof window[n]!="undefined";try{window[n].setItem("typeahead","typeahead");window[n].removeItem("typeahead")}catch(r){i=!1}return i&&n||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&((typeof LZString=="undefined"?"undefined":s(LZString))==="object"&&this.options.cache||(this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:"Missing LZString Library or options.cache, no compression will occur."}),t.print()),this.options.compression=!1)),(!this.options.maxLength||isNaN(this.options.maxLength))&&(this.options.maxLength=Infinity),typeof this.options.maxItem!="undefined"&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=Infinity),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.multiselect&&(this.items=[],this.comparedItems=[],typeof this.options.multiselect.matchOn=="string"&&(this.options.multiselect.matchOn=[this.options.multiselect.matchOn])),this.options.group&&(Array.isArray(this.options.group)?this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:"options.group must be a boolean|string|object as of 2.5.0"}),t.print()):(typeof this.options.group=="string"?this.options.group={key:this.options.group}:typeof this.options.group=="boolean"&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var i=0,r=this.options.dropdownFilter.length;i<r;++i)this.dropdownFilter[this.options.dropdownFilter[i].value?"static":"dynamic"].push(this.options.dropdownFilter[i])}this.options.dynamicFilter&&!Array.isArray(this.options.dynamicFilter)&&(this.options.dynamicFilter=[this.options.dynamicFilter]);this.options.accent&&(s(this.options.accent)==="object"?this.options.accent.from&&this.options.accent.to&&this.options.accent.from.length!==this.options.accent.to.length&&this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid "options.accent", from and to must be defined and same length.'}),t.print()):this.options.accent=u);this.options.groupTemplate&&(this.groupTemplate=this.options.groupTemplate);this.options.resultContainer&&(typeof this.options.resultContainer=="string"&&(this.options.resultContainer=n(this.options.resultContainer)),this.options.resultContainer instanceof n&&this.options.resultContainer[0]?this.resultContainer=this.options.resultContainer:this.options.debug&&(t.log({node:this.selector,"function":"extendOptions()",message:'Invalid jQuery selector or jQuery Object for "options.resultContainer".'}),t.print()));this.options.group&&this.options.group.key&&(this.groupBy=this.options.group.key);this.options.callback&&this.options.callback.onClick&&(this.options.callback.onClickBefore=this.options.callback.onClick,delete this.options.callback.onClick);this.options.callback&&this.options.callback.onNavigate&&(this.options.callback.onNavigateBefore=this.options.callback.onNavigate,delete this.options.callback.onNavigate);this.options=n.extend(!0,{},e,this.options)},unifySourceFormat:function(){this.dynamicGroups=[];Array.isArray(this.options.source)&&(this.options.source={group:{data:this.options.source}});typeof this.options.source=="string"&&(this.options.source={group:{ajax:{url:this.options.source}}});this.options.source.ajax&&(this.options.source={group:{ajax:this.options.source.ajax}});(this.options.source.url||this.options.source.data)&&(this.options.source={group:this.options.source});var i,n,r;for(i in this.options.source)if(this.options.source.hasOwnProperty(i)){if(n=this.options.source[i],typeof n=="string"&&(n={ajax:{url:n}}),r=n.url||n.ajax,Array.isArray(r)?(n.ajax=typeof r[0]=="string"?{url:r[0]}:r[0],n.ajax.path=n.ajax.path||r[1]||null,delete n.url):(s(n.url)==="object"?n.ajax=n.url:typeof n.url=="string"&&(n.ajax={url:n.url}),delete n.url),!n.data&&!n.ajax)return this.options.debug&&(t.log({node:this.selector,"function":"unifySourceFormat()",arguments:JSON.stringify(this.options.source),message:'Undefined "options.source.'+i+'.[data|ajax]" is Missing - Typeahead dropped'}),t.print()),!1;n.display&&!Array.isArray(n.display)&&(n.display=[n.display]);n.minLength=typeof n.minLength=="number"?n.minLength:this.options.minLength;n.maxLength=typeof n.maxLength=="number"?n.maxLength:this.options.maxLength;n.dynamic=typeof n.dynamic=="boolean"||this.options.dynamic;n.minLength>n.maxLength&&(n.minLength=n.maxLength);this.options.source[i]=n;this.options.source[i].dynamic&&this.dynamicGroups.push(i);n.cache=typeof n.cache!="undefined"?this._validateCacheMethod(n.cache):this.options.cache;n.compression&&((typeof LZString=="undefined"?"undefined":s(LZString))==="object"&&n.cache||(this.options.debug&&(t.log({node:this.selector,"function":"unifySourceFormat()",message:"Missing LZString Library or group.cache, no compression will occur on group: "+i}),t.print()),n.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this._lastSeq=0;this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]);this.container=this.node.closest("."+this.options.selector.container);this.options.debug&&(t.log({node:this.selector,"function":"init()",message:"OK - Typeahead activated on "+this.selector}),t.print())},delegateEvents:function(){var t=this,u=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace],i,r;n("html").on("touchmove",function(){t.hasDragged=!0}).on("touchstart",function(){t.hasDragged=!1});this.node.closest("form").on("submit",function(n){if(t.options.mustSelectItem&&t.helper.isEmpty(t.item)){n.preventDefault();return}return t.options.backdropOnFocus||t.hideLayout(),t.options.callback.onSubmit?t.helper.executeCallback.call(t,t.options.callback.onSubmit,[t.node,this,t.item||t.items,n]):void 0}).on("reset",function(){setTimeout(function(){t.node.trigger("input"+t.namespace);t.hideLayout()})});if(i=!1,this.node.attr("placeholder")&&(c||l)){r=!0;this.node.on("focusin focusout",function(){r=!!(!this.value&&this.placeholder)});this.node.on("input",function(n){r&&(n.stopImmediatePropagation(),r=!1)})}this.node.off(this.namespace).on(u.join(" "),function(r,u){switch(r.type){case"generate":t.generateSource(Object.keys(t.options.source));break;case"focus":if(t.focusOnly){t.focusOnly=!1;break}t.options.backdropOnFocus&&(t.buildBackdropLayout(),t.showLayout());t.options.searchOnFocus&&!t.item&&(t.deferred=n.Deferred(),t.assignQuery(),t.generateSource());break;case"keydown":r.keyCode===8&&t.options.multiselect&&t.options.multiselect.cancelOnBackspace&&t.query===""&&t.items.length?t.cancelMultiselectItem(t.items.length-1,null,r):r.keyCode&&~[9,13,27,38,39,40].indexOf(r.keyCode)&&(i=!0,t.navigate(r));break;case"keyup":h&&t.node[0].value.replace(/^\s+/,"").toString().length<t.query.length&&t.node.trigger("input"+t.namespace);break;case"propertychange":if(i){i=!1;break}case"input":t.deferred=n.Deferred();t.assignQuery();t.rawQuery===""&&t.query===""&&(r.originalEvent=u||{},t.helper.executeCallback.call(t,t.options.callback.onCancel,[t.node,t.item,r]),t.item=null);t.options.cancelButton&&t.toggleCancelButtonVisibility();t.options.hint&&t.hint.container&&t.hint.container.val()!==""&&t.hint.container.val().indexOf(t.rawQuery)!==0&&(t.hint.container.val(""),t.isContentEditable&&t.hint.container.text(""));t.hasDynamicGroups?t.helper.typeWatch(function(){t.generateSource()},t.options.delay):t.generateSource();break;case"search":t.searchResult();t.buildLayout();t.result.length||t.searchGroups.length&&t.displayEmptyTemplate?t.showLayout():t.hideLayout();t.deferred&&t.deferred.resolve()}return t.deferred&&t.deferred.promise()});this.options.generateOnLoad&&this.node.trigger("generate"+this.namespace)},assignQuery:function(){this.rawQuery=this.isContentEditable?this.node.text():this.node.val().toString();this.rawQuery=this.rawQuery.replace(/^\s+/,"");this.rawQuery!==this.query&&(this.query=this.rawQuery)},filterGenerateSource:function(){if(this.searchGroups=[],this.generateGroups=[],!this.focusOnly||this.options.multiselect)for(var n in this.options.source)if(this.options.source.hasOwnProperty(n)&&this.query.length>=this.options.source[n].minLength&&this.query.length<=this.options.source[n].maxLength){if(this.filters.dropdown&&this.filters.dropdown.key==="group"&&this.filters.dropdown.value!==n)continue;if(this.searchGroups.push(n),!this.options.source[n].dynamic&&this.source[n])continue;this.generateGroups.push(n)}},generateSource:function(i){var h,r,o,u,s,l,f,c,e,a;if(this.filterGenerateSource(),Array.isArray(i)&&i.length)this.generateGroups=i;else if(!this.generateGroups.length){this.node.trigger("search"+this.namespace);return}if(this.requestGroups=[],this.generatedGroupCount=0,this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(e in this.xhr)this.xhr.hasOwnProperty(e)&&this.options.abortAjax&&this.xhr[e].abort();this.xhr={}}for(h=this,e=0,a=this.generateGroups.length;e<a;++e){if(r=this.generateGroups[e],u=this.options.source[r],s=u.cache,l=u.compression,s&&(f=window[s].getItem("TYPEAHEAD_"+this.selector+":"+r),f)){l&&(f=LZString.decompressFromUTF16(f));c=!1;try{f=JSON.parse(f+"");f.data&&f.ttl>(new Date).getTime()?(this.populateSource(f.data,r),c=!0,this.options.debug&&(t.log({node:this.selector,"function":"generateSource()",message:'Source for group "'+r+'" found in '+s}),t.print())):window[s].removeItem("TYPEAHEAD_"+this.selector+":"+r)}catch(v){}if(c)continue}if(u.data&&!u.ajax){typeof u.data=="function"?(o=u.data.call(this),Array.isArray(o)?h.populateSource(o,r):typeof o.promise=="function"&&function(t){n.when(o).then(function(n){n&&Array.isArray(n)&&h.populateSource(n,t)})}(r)):this.populateSource(n.extend(!0,[],u.data),r);continue}u.ajax&&(this.requests[r]||(this.requests[r]=this.generateRequestObject(r)),this.requestGroups.push(r))}return this.requestGroups.length&&this.handleRequests(),!!this.generateGroups.length},generateRequestObject:function(n){var u=this,i=this.options.source[n],t={request:{url:i.ajax.url||null,dataType:"json",beforeSend:function(t){u.xhr[n]=t;u.options.abortAjax||(t.seq=f,f++);var r=u.requests[n].callback.beforeSend||i.ajax.beforeSend;typeof r=="function"&&r.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:i.ajax.path||null,group:n},validForGroup:[n]},r;if(typeof i.ajax!="function"&&(i.ajax instanceof Object&&(t=this.extendXhrObject(t,i.ajax)),Object.keys(this.options.source).length>1))for(r in this.requests)this.requests.hasOwnProperty(r)&&(this.requests[r].isDuplicated||t.request.url&&t.request.url===this.requests[r].request.url&&(this.requests[r].validForGroup.push(n),t.isDuplicated=!0,delete t.validForGroup));return t},extendXhrObject:function(t,i){return s(i.callback)==="object"&&(t.callback=i.callback,delete i.callback),typeof i.beforeSend=="function"&&(t.callback.beforeSend=i.beforeSend,delete i.beforeSend),t.request=n.extend(!0,t.request,i),t.request.dataType.toLowerCase()!=="jsonp"||t.request.jsonpCallback||(t.request.jsonpCallback="callback_"+t.extra.group),t},handleRequests:function(){var i=this,r,f=this.requestGroups.length,u,e;if(this.helper.executeCallback.call(this,this.options.callback.onSendRequest,[this.node,this.query])!==!1)for(u=0,e=this.requestGroups.length;u<e;++u)(r=this.requestGroups[u],this.requests[r].isDuplicated)||function(r,u){var l,e,o,h,c;if(typeof i.options.source[r].ajax=="function"){if(l=i.options.source[r].ajax.call(i,i.query),u=i.extendXhrObject(i.generateRequestObject(r),s(l)==="object"?l:{}),s(u.request)!=="object"||!u.request.url){i.options.debug&&(t.log({node:i.selector,"function":"handleRequests",message:'Source function must return an object containing ".url" key for group "'+r+'"'}),t.print());i.populateSource([],r);return}i.requests[r]=u}if(o=!1,h={},~u.request.url.indexOf("{{query}}")&&(o||(u=n.extend(!0,{},u),o=!0),u.request.url=u.request.url.replace("{{query}}",encodeURIComponent(i.query))),u.request.data)for(c in u.request.data)if(u.request.data.hasOwnProperty(c)&&~String(u.request.data[c]).indexOf("{{query}}")){o||(u=n.extend(!0,{},u),o=!0);u.request.data[c]=u.request.data[c].replace("{{query}}",i.query);break}n.ajax(u.request).done(function(n,r,f){for(var o,c=0,l=u.validForGroup.length;c<l;c++)o=u.validForGroup[c],e=i.requests[o],typeof e.callback.done=="function"&&(h[o]=e.callback.done.call(i,n,r,f),Array.isArray(h[o])&&s(h[o])==="object"||i.options.debug&&(t.log({node:i.selector,"function":"Ajax.callback.done()",message:"Invalid returned data has to be an Array"}),t.print()))}).fail(function(n,r,f){for(var o=0,s=u.validForGroup.length;o<s;o++)e=i.requests[u.validForGroup[o]],e.callback.fail instanceof Function&&e.callback.fail.call(i,n,r,f);i.options.debug&&(t.log({node:i.selector,"function":"Ajax.callback.fail()",arguments:JSON.stringify(u.request),message:r}),console.log(f),t.print())}).always(function(n,t,r){for(var o,s=0,c=u.validForGroup.length;s<c;s++){if(o=u.validForGroup[s],e=i.requests[o],e.callback.always instanceof Function&&e.callback.always.call(i,n,t,r),t==="abort")return;if(!i.options.abortAjax){if(r.seq<i._lastSeq)return;i._lastSeq=r.seq}i.populateSource(n!==null&&typeof n.promise=="function"&&[]||h[o]||n,e.extra.group,e.extra.path||e.request.path);f-=1;f===0&&i.helper.executeCallback.call(i,i.options.callback.onReceiveRequest,[i.node,i.query])}}).then(function(n,t){for(var r=0,f=u.validForGroup.length;r<f;r++)e=i.requests[u.validForGroup[r]],e.callback.then instanceof Function&&e.callback.then.call(i,n,t)})}(r,this.requests[r])},populateSource:function(i,r,u){var k=this,e=this.options.source[r],s=e.ajax&&e.data,w,d,c,a,v,h,g,l,y,f,o,p;for(u&&typeof u=="string"&&(i=this.helper.namespace.call(this,u,i)),typeof i=="undefined"&&this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:u,message:"Invalid data path."}),t.print()),Array.isArray(i)||(this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:JSON.stringify({group:r}),message:"Invalid data type, must be Array type."}),t.print()),i=[]),s&&(typeof s=="function"&&(s=s()),Array.isArray(s)?i=i.concat(s):this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:JSON.stringify(s),message:"WARNING - this.options.source."+r+".data Must be an Array or a function that returns an Array."}),t.print())),d=e.display?e.display[0]==="compiled"?e.display[1]:e.display[0]:this.options.display[0]==="compiled"?this.options.display[1]:this.options.display[0],f=0,o=i.length;f<o;f++){if(i[f]===null||typeof i[f]=="boolean"){this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",message:"WARNING - NULL/BOOLEAN value inside "+r+"! The data was skipped."}),t.print());continue}typeof i[f]=="string"&&(w={},w[d]=i[f],i[f]=w);i[f].group=r}if(!this.hasDynamicGroups&&this.dropdownFilter.dynamic.length)for(v={},f=0,o=i.length;f<o;f++)for(h=0,g=this.dropdownFilter.dynamic.length;h<g;h++)(c=this.dropdownFilter.dynamic[h].key,a=i[f][c],a)&&(this.dropdownFilter.dynamic[h].value||(this.dropdownFilter.dynamic[h].value=[]),v[c]||(v[c]=[]),~v[c].indexOf(a.toLowerCase())||(v[c].push(a.toLowerCase()),this.dropdownFilter.dynamic[h].value.push(a)));if(this.options.correlativeTemplate)if(l=e.template||this.options.template,y="",typeof l=="function"&&(l=l.call(this,"",{})),l){if(Array.isArray(this.options.correlativeTemplate))for(f=0,o=this.options.correlativeTemplate.length;f<o;f++)y+="{{"+this.options.correlativeTemplate[f]+"}} ";else y=l.replace(/<.+?>/g," ").replace(/\s{2,}/," ").trim();for(f=0,o=i.length;f<o;f++)i[f].compiled=n("<textarea />").html(y.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(n,t){return k.helper.namespace.call(k,t,i[f],"get","")}).trim()).text();e.display?~e.display.indexOf("compiled")||e.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else this.options.debug&&(t.log({node:this.selector,"function":"populateSource()",arguments:String(r),message:"WARNING - this.options.correlativeTemplate is enabled but no template was found."}),t.print());this.options.callback.onPopulateSource&&(i=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,i,r,u]),this.options.debug&&(i&&Array.isArray(i)||(t.log({node:this.selector,"function":"callback.populateSource()",message:'callback.onPopulateSource must return the "data" parameter'}),t.print())));this.tmpSource[r]=Array.isArray(i)&&i||[];var b=this.options.source[r].cache,nt=this.options.source[r].compression,tt=this.options.source[r].ttl||this.options.ttl;b&&!window[b].getItem("TYPEAHEAD_"+this.selector+":"+r)&&(this.options.callback.onCacheSave&&(i=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,i,r,u]),this.options.debug&&(i&&Array.isArray(i)||(t.log({node:this.selector,"function":"callback.populateSource()",message:'callback.onCacheSave must return the "data" parameter'}),t.print()))),p=JSON.stringify({data:i,ttl:(new Date).getTime()+tt}),nt&&(p=LZString.compressToUTF16(p)),window[b].setItem("TYPEAHEAD_"+this.selector+":"+r,p));this.incrementGeneratedGroup()},incrementGeneratedGroup:function(){this.generatedGroupCount++;this.options.abortAjax||this.generatedGroupCount!==this.generateGroups.length;this.xhr={};for(var n=0,t=this.generateGroups.length;n<t;n++)this.source[this.generateGroups[n]]=this.tmpSource[this.generateGroups[n]];this.hasDynamicGroups||this.buildDropdownItemLayout("dynamic");this.options.loadingAnimation&&this.container.removeClass("loading");this.node.trigger("search"+this.namespace)},navigate:function(n){var e;if(this.helper.executeCallback.call(this,this.options.callback.onNavigateBefore,[this.node,this.query,n]),n.keyCode===27){n.preventDefault();this.query.length?(this.resetInput(),this.node.trigger("input"+this.namespace,[n])):(this.node.blur(),this.hideLayout());return}if(this.result.length){var t=this.resultContainer.find("."+this.options.selector.item).not("[disabled]"),r=t.filter(".active"),f=r[0]?t.index(r):null,o=r[0]?r.attr("data-index"):null,i=null,u=null;if(this.clearActiveItem(),this.helper.executeCallback.call(this,this.options.callback.onLeave,[this.node,f!==null&&t.eq(f)||undefined,o!==null&&this.result[o]||undefined,n]),n.keyCode===13){n.preventDefault();t.length===1&&t.click();r.length>0?r.find("a:first")[0].href==="javascript:;"?r.find("a:first").trigger("click",n):r.find("a:first")[0].click():this.node.closest("form").trigger("submit");return}if(n.keyCode===15802020){f!==null?t.eq(f).find("a:first")[0].click():this.options.hint&&this.hint.container.val()!==""&&this.helper.getCaret(this.node[0])>=this.query.length&&t.filter('[data-index="'+this.hintIndex+'"]').find("a:first")[0].click();return}n.keyCode===9?this.options.blurOnTab?this.hideLayout():r.length>0?f+1<t.length?(n.preventDefault(),i=f+1,this.addActiveItem(t.eq(i))):this.hideLayout():t.length?(n.preventDefault(),i=0,this.addActiveItem(t.first())):this.hideLayout():n.keyCode===38?(n.preventDefault(),r.length>0?f-1>=0&&(i=f-1,this.addActiveItem(t.eq(i))):t.length&&(i=t.length-1,this.addActiveItem(t.last()))):n.keyCode===40&&(n.preventDefault(),r.length>0?f+1<t.length&&(i=f+1,this.addActiveItem(t.eq(i))):t.length&&(i=0,this.addActiveItem(t.first())));u=i!==null?t.eq(i).attr("data-index"):null;this.helper.executeCallback.call(this,this.options.callback.onEnter,[this.node,i!==null&&t.eq(i)||undefined,u!==null&&this.result[u]||undefined,n]);n.preventInputChange&&~[38,40].indexOf(n.keyCode)&&this.buildHintLayout(u!==null&&u<this.result.length?[this.result[u]]:null);this.options.hint&&this.hint.container&&this.hint.container.css("color",n.preventInputChange?this.hint.css.color:u===null&&this.hint.css.color||this.hint.container.css("background-color")||"fff");e=u===null||n.preventInputChange?this.rawQuery:this.getTemplateValue.call(this,this.result[u]);this.node.val(e);this.isContentEditable&&this.node.text(e);this.helper.executeCallback.call(this,this.options.callback.onNavigateAfter,[this.node,t,i!==null&&t.eq(i).find("a:first")||undefined,u!==null&&this.result[u]||undefined,this.query,n])}},getTemplateValue:function(n){var t,i;if(n)return(t=n.group&&this.options.source[n.group].templateValue||this.options.templateValue,typeof t=="function"&&(t=t.call(this)),!t)?this.helper.namespace.call(this,n.matchedKey,n).toString():(i=this,t.replace(/\{\{([\w\-.]+)}}/gi,function(t,r){return i.helper.namespace.call(i,r,n,"get","")}))},clearActiveItem:function(){this.resultContainer.find("."+this.options.selector.item).removeClass("active")},addActiveItem:function(n){n.addClass("active")},searchResult:function(){(this.resetLayout(),this.helper.executeCallback.call(this,this.options.callback.onSearch,[this.node,this.query])!==!1)&&(!this.searchGroups.length||this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit||this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var tt=this,y=this.groupBy,e=null,i,it,c,p=this.query.toLowerCase(),ft=this.options.maxItem,l=this.options.maxItemPerGroup,vt=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),h,et={},w,b,ot,k,yt=typeof this.options.matcher=="function"&&this.options.matcher,st,d,rt,g,ct,o,lt,a,at,u,ht,r,ut,nt,f,v;for(this.options.accent&&(p=this.helper.removeAccent.call(this,p)),f=0,v=this.searchGroups.length;f<v;++f)if(r=this.searchGroups[f],!this.filters.dropdown||this.filters.dropdown.key!=="group"||this.filters.dropdown.value===r)for(w=typeof this.options.source[r].filter!="undefined"?this.options.source[r].filter:this.options.filter,ot=typeof this.options.source[r].matcher=="function"&&this.options.source[r].matcher||yt,g=0,ct=this.source[r].length;g<ct;g++){if(this.resultItemCount>=ft&&!this.options.callback.onResult)break;if((!vt||this.dynamicFilter.validate.apply(this,[this.source[r][g]]))&&(i=this.source[r][g],i!==null&&typeof i!="boolean")&&(!this.options.multiselect||this.isMultiselectUniqueData(i))&&(!this.filters.dropdown||(i[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if(e=y==="group"?r:i[y]?i[y]:i.group,e&&!this.tmpResult[e]&&(this.tmpResult[e]=[],this.resultCountPerGroup[e]=0),l&&y==="group"&&this.tmpResult[e].length>=l&&!this.options.callback.onResult)break;for(u=this.options.source[r].display||this.options.display,o=0,lt=u.length;o<lt;++o){if(w!==!1){if(h=/\./.test(u[o])?this.helper.namespace.call(this,u[o],i):i[u[o]],typeof h=="undefined"||h===""){this.options.debug&&(et[o]={display:u[o],data:i});continue}h=this.helper.cleanStringFromScript(h)}if(typeof w=="function"){if(b=w.call(this,i,h),b===undefined)break;if(!b)continue;s(b)==="object"&&(i=b)}if(~[undefined,!0].indexOf(w)){if(h===null)continue;if(c=h,c=c.toString().toLowerCase(),this.options.accent&&(c=this.helper.removeAccent.call(this,c)),it=c.indexOf(p),this.options.correlativeTemplate&&u[o]==="compiled"&&it<0&&/\s/.test(p))for(st=!0,d=p.split(" "),rt=c,a=0,at=d.length;a<at;a++)if(d[a]!==""){if(!~rt.indexOf(d[a])){st=!1;break}rt=rt.replace(d[a],"")}if(it<0&&!st)continue;if(this.options.offset&&it!==0)continue;if(ot){if(k=ot.call(this,i,h),k===undefined)break;if(!k)continue;s(k)==="object"&&(i=k)}}if(this.resultCount++,this.resultCountPerGroup[e]++,this.resultItemCount<ft){if(l&&this.tmpResult[e].length>=l)break;this.tmpResult[e].push(n.extend(!0,{matchedKey:u[o]},i));this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=ft)break;if(l&&this.tmpResult[e].length>=l&&y==="group")break}}}if(this.options.debug&&(this.helper.isEmpty(et)||(t.log({node:this.selector,"function":"searchResult()",arguments:JSON.stringify(et),message:"Missing keys for display, make sure options.display is set properly."}),t.print())),this.options.order){u=[];for(r in this.tmpResult)if(this.tmpResult.hasOwnProperty(r)){for(f=0,v=this.tmpResult[r].length;f<v;f++)ht=this.options.source[this.tmpResult[r][f].group].display||this.options.display,~u.indexOf(ht[0])||u.push(ht[0]);this.tmpResult[r].sort(tt.helper.sort(u,tt.options.order==="asc",function(n){return n.toString().toUpperCase()}))}}for(ut=[],nt=[],nt=typeof this.options.groupOrder=="function"?this.options.groupOrder.apply(this,[this.node,this.query,this.tmpResult,this.resultCount,this.resultCountPerGroup]):Array.isArray(this.options.groupOrder)?this.options.groupOrder:typeof this.options.groupOrder=="string"&&~["asc","desc"].indexOf(this.options.groupOrder)?Object.keys(this.tmpResult).sort(tt.helper.sort([],tt.options.groupOrder==="asc",function(n){return n.toString().toUpperCase()})):Object.keys(this.tmpResult),f=0,v=nt.length;f<v;f++)ut=ut.concat(this.tmpResult[nt[f]]||[]);this.groups=JSON.parse(JSON.stringify(nt));this.result=ut},buildLayout:function(){this.buildHtmlLayout();this.buildBackdropLayout();this.buildHintLayout();this.options.callback.onLayoutBuiltBefore&&(this.tmpResultHtml=this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltBefore,[this.node,this.query,this.result,this.resultHtml]));this.tmpResultHtml instanceof n?this.resultContainer.html(this.tmpResultHtml):this.resultHtml instanceof n&&this.resultContainer.html(this.resultHtml);this.options.callback.onLayoutBuiltAfter&&this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltAfter,[this.node,this.query,this.result])},buildHtmlLayout:function(){var e,o,u,p,i,w,b,h,a,k,l,v,c,d,f,y;if(this.options.resultContainer!==!1){if(this.resultContainer||(this.resultContainer=n("<div/>",{"class":this.options.selector.result}),this.container.append(this.resultContainer)),!this.result.length)if(this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit)e=this.options.multiselect.limitTemplate?typeof this.options.multiselect.limitTemplate=="function"?this.options.multiselect.limitTemplate.call(this,this.query):this.options.multiselect.limitTemplate.replace(/\{\{query}}/gi,n("<div>").text(this.helper.cleanStringFromScript(this.query)).html()):"Can't select more than "+this.items.length+" items.";else if(this.options.emptyTemplate&&this.query!=="")e=typeof this.options.emptyTemplate=="function"?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,n("<div>").text(this.helper.cleanStringFromScript(this.query)).html());else return;this.displayEmptyTemplate=!!e;o=this.query.toLowerCase();this.options.accent&&(o=this.helper.removeAccent.call(this,o));var t=this,r=this.groupTemplate||"<ul><\/ul>",g=!1;for(this.groupTemplate?r=n(r.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(n,i,r){var f="",o=r==="group"?t.groups:[r],u,s;if(!t.result.length)return g===!0?"":(g=!0,"<"+i+' class="'+t.options.selector.empty+'">'+e+"<\/"+i+">");for(u=0,s=o.length;u<s;++u)f+="<"+i+' data-group-template="'+o[u]+'"><ul><\/ul><\/'+i+">";return f})):(r=n(r),this.result.length||r.append(e instanceof n?e:'<li class="'+t.options.selector.empty+'">'+e+"<\/li>")),r.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":"")),c=this.groupTemplate&&this.result.length&&t.groups||[],f=0,y=this.result.length;f<y;++f)i=this.result[f],u=i.group,w=!this.options.multiselect&&this.options.source[i.group].href||this.options.href,k=[],l=this.options.source[i.group].display||this.options.display,this.options.group&&(u=i[this.options.group.key],this.options.group.template&&(typeof this.options.group.template=="function"?p=this.options.group.template.call(this,i):typeof this.options.group.template=="string"&&(p=this.options.group.template.replace(/\{\{([\w\-\.]+)}}/gi,function(n,r){return t.helper.namespace.call(t,r,i,"get","")}))),r.find('[data-search-group="'+u+'"]')[0]||(this.groupTemplate?r.find('[data-group-template="'+u+'"] ul'):r).append(n("<li/>",{"class":t.options.selector.group,html:n("<a/>",{href:"javascript:;",html:p||u,tabindex:-1}),"data-search-group":u}))),this.groupTemplate&&c.length&&(d=c.indexOf(u||i.group),~d&&c.splice(d,1)),b=n("<li/>",{"class":t.options.selector.item+" "+t.options.selector.group+"-"+this.helper.slugify.call(this,u),disabled:i.disabled?!0:!1,"data-group":u,"data-index":f,html:n("<a/>",{href:w&&!i.disabled?function(n,i){return i.href=t.generateHref.call(t,n,i)}(w,i):"javascript:;",html:function(){if(h=i.group&&t.options.source[i.group].template||t.options.template,h)typeof h=="function"&&(h=h.call(t,t.query,i)),a=h.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(n,r,u){var f=t.helper.cleanStringFromScript(String(t.helper.namespace.call(t,r,i,"get","")));return u=u&&u.split("|")||[],~u.indexOf("slugify")&&(f=t.helper.slugify.call(t,f)),~u.indexOf("raw")||t.options.highlight===!0&&o&&~l.indexOf(r)&&(f=t.helper.highlight.call(t,f,o.split(" "),t.options.accent)),f});else{for(var r=0,u=l.length;r<u;r++)(v=/\./.test(l[r])?t.helper.namespace.call(t,l[r],i,"get",""):i[l[r]],typeof v!="undefined"&&v!=="")&&k.push(v);a='<span class="'+t.options.selector.display+'">'+t.helper.cleanStringFromScript(String(k.join(" ")))+"<\/span>"}(t.options.highlight===!0&&o&&!h||t.options.highlight==="any")&&(a=t.helper.highlight.call(t,a,o.split(" "),t.options.accent));n(this).append(a)}})}),function(i,r,u){u.on("click",function(i,u){if(r.disabled){i.preventDefault();return}if(u&&s(u)==="object"&&(i.originalEvent=u),t.options.mustSelectItem&&t.helper.isEmpty(r)){i.preventDefault();return}(t.options.multiselect||(t.item=r),t.helper.executeCallback.call(t,t.options.callback.onClickBefore,[t.node,n(this),r,i])!==!1)&&(i.originalEvent&&i.originalEvent.defaultPrevented||i.isDefaultPrevented()||(t.options.multiselect?(t.query=t.rawQuery="",t.addMultiselectItemLayout(r)):(t.focusOnly=!0,t.query=t.rawQuery=t.getTemplateValue.call(t,r),t.isContentEditable&&(t.node.text(t.query),t.helper.setCaretAtEnd(t.node[0]))),t.hideLayout(),t.node.val(t.query),t.options.cancelButton&&t.toggleCancelButtonVisibility(),t.helper.executeCallback.call(t,t.options.callback.onClickAfter,[t.node,n(this),r,i])))});u.on("mouseenter",function(i){r.disabled||(t.clearActiveItem(),t.addActiveItem(n(this)));t.helper.executeCallback.call(t,t.options.callback.onEnter,[t.node,n(this),r,i])});u.on("mouseleave",function(i){r.disabled||t.clearActiveItem();t.helper.executeCallback.call(t,t.options.callback.onLeave,[t.node,n(this),r,i])})}(f,i,b),(this.groupTemplate?r.find('[data-group-template="'+u+'"] ul'):r).append(b);if(this.result.length&&c.length)for(f=0,y=c.length;f<y;++f)r.find('[data-group-template="'+c[f]+'"]').remove();this.resultHtml=r}},generateHref:function(n,t){var i=this;return typeof n=="string"?n=n.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(n,r,u){var f=i.helper.namespace.call(i,r,t,"get","");return u=u&&u.split("|")||[],~u.indexOf("slugify")&&(f=i.helper.slugify.call(i,f)),f}):typeof n=="function"&&(n=n.call(this,t)),n},getMultiselectComparedData:function(n){var r="",u,f,t,i;if(Array.isArray(this.options.multiselect.matchOn))for(t=0,i=this.options.multiselect.matchOn.length;t<i;++t)r+=typeof n[this.options.multiselect.matchOn[t]]!="undefined"?n[this.options.multiselect.matchOn[t]]:"";else{for(u=JSON.parse(JSON.stringify(n)),f=["group","matchedKey","compiled","href"],t=0,i=f.length;t<i;++t)delete u[f[t]];r=JSON.stringify(u)}return r},buildBackdropLayout:function(){this.options.backdrop&&(this.backdrop.container||(this.backdrop.css=n.extend({opacity:.6,filter:"alpha(opacity=60)",position:"fixed",top:0,right:0,bottom:0,left:0,"z-index":1040,"background-color":"#000"},this.options.backdrop),this.backdrop.container=n("<div/>",{"class":this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(t){var u,h,f,i,c,r,l,o;if(this.options.hint){if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth())){this.hint.container&&this.hint.container.val("");return}var a=this,s="",t=t||this.result,e=this.query.toLowerCase();if(this.options.accent&&(e=this.helper.removeAccent.call(this,e)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=n.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=n("<"+this.node[0].nodeName+"/>",{type:this.node.attr("type"),"class":this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){a.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),e)for(i=0,c=t.length;i<c;i++)if(!t[i].disabled){for(h=t[i].group,u=this.options.source[h].display||this.options.display,r=0,l=u.length;r<l;r++)if(f=String(t[i][u[r]]).toLowerCase(),this.options.accent&&(f=this.helper.removeAccent.call(this,f)),f.indexOf(e)===0){s=String(t[i][u[r]]);this.hintIndex=i;break}if(this.hintIndex!==null)break}o=s.length>0&&this.rawQuery+s.substring(this.query.length)||"";this.hint.container.val(o);this.isContentEditable&&this.hint.container.text(o)}}},buildDropdownLayout:function(){if(this.options.dropdownFilter){var t=this;n("<span/>",{"class":this.options.selector.filter,html:function(){n(this).append(n("<button/>",{type:"button","class":t.options.selector.filterButton,style:"display: none;",click:function(){t.container.toggleClass("filter");var i=t.namespace+"-dropdown-filter";if(n("html").off(i),t.container.hasClass("filter"))n("html").on("click"+i+" touchend"+i,function(r){n(r.target).closest("."+t.options.selector.filter)[0]&&n(r.target).closest(t.container)[0]||t.hasDragged||(t.container.removeClass("filter"),n("html").off(i))})}}));n(this).append(n("<ul/>",{"class":t.options.selector.dropdown}))}}).insertAfter(t.container.find("."+t.options.selector.query))}},buildDropdownItemLayout:function(t){function c(n){n.value==="*"?delete this.filters.dropdown:this.filters.dropdown=n;this.container.removeClass("filter").find("."+this.options.selector.filterButton).html(n.template);this.isDropdownEvent=!0;this.node.trigger("input"+this.namespace);this.options.multiselect&&this.adjustInputSize();this.node.focus()}var u,e,r,o;if(this.options.dropdownFilter){var f=this,s,h=typeof this.options.dropdownFilter=="string"&&this.options.dropdownFilter||"All",l=this.container.find("."+this.options.selector.dropdown),i;for(t==="static"&&(this.options.dropdownFilter===!0||typeof this.options.dropdownFilter=="string")&&this.dropdownFilter.static.push({key:"group",template:"{{group}}",all:h,value:Object.keys(this.options.source)}),u=0,e=this.dropdownFilter[t].length;u<e;u++)for(i=this.dropdownFilter[t][u],Array.isArray(i.value)||(i.value=[i.value]),i.all&&(this.dropdownFilterAll=i.all),r=0,o=i.value.length;r<=o;r++){if(r===o&&u!==e-1)continue;else if(r===o&&u===e-1&&t==="static"&&this.dropdownFilter.dynamic.length)continue;s=this.dropdownFilterAll||h;i.value[r]?s=i.template?i.template.replace(new RegExp("{{"+i.key+"}}","gi"),i.value[r]):i.value[r]:this.container.find("."+f.options.selector.filterButton).html(s),function(t,i,r){l.append(n("<li/>",{"class":f.options.selector.dropdownItem+" "+f.helper.slugify.call(f,i.key+"-"+(i.value[t]||h)),html:n("<a/>",{href:"javascript:;",html:r,click:function(n){n.preventDefault();c.call(f,{key:i.key,value:i.value[t]||"*",template:r})}})}))}(r,i,s)}this.dropdownFilter[t].length&&this.container.find("."+f.options.selector.filterButton).removeAttr("style")}},dynamicFilter:{isEnabled:!1,init:function(){this.options.dynamicFilter&&(this.dynamicFilter.bind.call(this),this.dynamicFilter.isEnabled=!0)},validate:function(n){var u,i=null,r=null,f;for(var t in this.filters.dynamic)if(this.filters.dynamic.hasOwnProperty(t)&&(f=~t.indexOf(".")?this.helper.namespace.call(this,t,n,"get"):n[t],this.filters.dynamic[t].modifier!=="|"||i||(i=f==this.filters.dynamic[t].value||!1),this.filters.dynamic[t].modifier==="&"))if(f==this.filters.dynamic[t].value)r=!0;else{r=!1;break}return u=i,r!==null&&(u=r,r===!0&&i!==null&&(u=i)),!!u},set:function(n,t){var i=n.match(/^([|&])?(.+)/);t?this.filters.dynamic[i[2]]={modifier:i[1]||"|",value:t}:delete this.filters.dynamic[i[2]];this.dynamicFilter.isEnabled&&this.generateSource()},bind:function(){for(var r=this,i,u=0,f=this.options.dynamicFilter.length;u<f;u++){if(i=this.options.dynamicFilter[u],typeof i.selector=="string"&&(i.selector=n(i.selector)),!(i.selector instanceof n)||!i.selector[0]||!i.key){this.options.debug&&(t.log({node:this.selector,"function":"buildDynamicLayout()",message:'Invalid jQuery selector or jQuery Object for "filter.selector" or missing filter.key'}),t.print());continue}(function(n){n.selector.off(r.namespace).on("change"+r.namespace,function(){r.dynamicFilter.set.apply(r,[n.key,r.dynamicFilter.getValue(this)])}).trigger("change"+r.namespace)})(i)}},getValue:function(n){var t;return n.tagName==="SELECT"?t=n.value:n.tagName==="INPUT"&&(n.type==="checkbox"?t=n.checked&&n.getAttribute("value")||n.checked||null:n.type==="radio"&&n.checked&&(t=n.value)),t}},buildMultiselectLayout:function(){if(this.options.multiselect){var i=this,t;(this.label.container=n("<span/>",{"class":this.options.selector.labelContainer,"data-padding-left":parseFloat(this.node.css("padding-left"))||0,"data-padding-right":parseFloat(this.node.css("padding-right"))||0,"data-padding-top":parseFloat(this.node.css("padding-top"))||0,click:function(t){n(t.target).hasClass(i.options.selector.labelContainer)&&i.node.focus()}}),this.node.closest("."+this.options.selector.query).prepend(this.label.container),this.options.multiselect.data)&&(Array.isArray(this.options.multiselect.data)?this.populateMultiselectData(this.options.multiselect.data):typeof this.options.multiselect.data=="function"&&(t=this.options.multiselect.data.call(this),Array.isArray(t)?this.populateMultiselectData(t):typeof t.promise=="function"&&n.when(t).then(function(n){n&&Array.isArray(n)&&i.populateMultiselectData(n)})))}},isMultiselectUniqueData:function(n){for(var i=!0,t=0,r=this.comparedItems.length;t<r;++t)if(this.comparedItems[t]===this.getMultiselectComparedData(n)){i=!1;break}return i},populateMultiselectData:function(n){for(var t=0,i=n.length;t<i;++t)this.addMultiselectItemLayout(n[t]);this.node.trigger("search"+this.namespace,{origin:"populateMultiselectData"})},addMultiselectItemLayout:function(t){if(this.isMultiselectUniqueData(t)){this.items.push(t);this.comparedItems.push(this.getMultiselectComparedData(t));var u=this.getTemplateValue(t),i=this,f=this.options.multiselect.href?"a":"span",r=n("<span/>",{"class":this.options.selector.label,html:n("<"+f+"/>",{text:u,click:function(t){var r=n(this).closest("."+i.options.selector.label),u=i.label.container.find("."+i.options.selector.label).index(r);i.options.multiselect.callback&&i.helper.executeCallback.call(i,i.options.multiselect.callback.onClick,[i.node,i.items[u],t])},href:this.options.multiselect.href?function(n){return i.generateHref.call(i,i.options.multiselect.href,n)}(i.items[i.items.length-1]):null})});return r.append(n("<span/>",{"class":this.options.selector.cancelButton,html:"×",click:function(t){var r=n(this).closest("."+i.options.selector.label),u=i.label.container.find("."+i.options.selector.label).index(r);i.cancelMultiselectItem(u,r,t)}})),this.label.container.append(r),this.adjustInputSize(),!0}},cancelMultiselectItem:function(n,t,i){var r=this.items[n];t=t||this.label.container.find("."+this.options.selector.label).eq(n);t.remove();this.items.splice(n,1);this.comparedItems.splice(n,1);this.options.multiselect.callback&&this.helper.executeCallback.call(this,this.options.multiselect.callback.onCancel,[this.node,r,i]);this.adjustInputSize();this.focusOnly=!0;this.node.focus().trigger("input"+this.namespace,{origin:"cancelMultiselectItem"})},adjustInputSize:function(){var u=this.node[0].getBoundingClientRect().width-(parseFloat(this.label.container.data("padding-right"))||0)-(parseFloat(this.label.container.css("padding-left"))||0),t=0,f=0,i=0,r=!1,e=0,o,s;this.label.container.find("."+this.options.selector.label).filter(function(o,s){o===0&&(e=n(s)[0].getBoundingClientRect().height+parseFloat(n(s).css("margin-bottom")||0));t=n(s)[0].getBoundingClientRect().width+parseFloat(n(s).css("margin-right")||0);i+t>u*.7&&!r&&(f++,r=!0);i+t<u?i+=t:(r=!1,i=t)});o=parseFloat(this.label.container.data("padding-left")||0)+(r?0:i);s=f*e+parseFloat(this.label.container.data("padding-top")||0);this.container.find("."+this.options.selector.query).find("input, textarea, [contenteditable], .typeahead__hint").css({paddingLeft:o,paddingTop:s})},showLayout:function(){function t(){var t=this;n("html").off("keydown"+this.namespace).on("keydown"+this.namespace,function(i){i.keyCode&&i.keyCode===9&&setTimeout(function(){n(":focus").closest(t.container).find(t.node)[0]||t.hideLayout()},0)});n("html").off("click"+this.namespace+" touchend"+this.namespace).on("click"+this.namespace+" touchend"+this.namespace,function(i){n(i.target).closest(t.container)[0]||n(i.target).closest("."+t.options.selector.item)[0]||i.target.className===t.options.selector.cancelButton||t.hasDragged||t.hideLayout()})}!this.container.hasClass("result")&&(this.result.length||this.displayEmptyTemplate||this.options.backdropOnFocus)&&(t.call(this),this.container.addClass([this.result.length||this.searchGroups.length&&this.displayEmptyTemplate?"result ":"",this.options.hint&&this.searchGroups.length?"hint":"",this.options.backdrop||this.options.backdropOnFocus?"backdrop":""].join(" ")),this.helper.executeCallback.call(this,this.options.callback.onShowLayout,[this.node,this.query]))},hideLayout:function(){(this.container.hasClass("result")||this.container.hasClass("backdrop"))&&((this.container.removeClass("result hint filter"+(this.options.backdropOnFocus&&n(this.node).is(":focus")?"":" backdrop")),this.options.backdropOnFocus&&this.container.hasClass("backdrop"))||(n("html").off(this.namespace),this.helper.executeCallback.call(this,this.options.callback.onHideLayout,[this.node,this.query])))},resetLayout:function(){this.result=[];this.tmpResult={};this.groups=[];this.resultCount=0;this.resultCountPerGroup={};this.resultItemCount=0;this.resultHtml=null;this.options.hint&&this.hint.container&&(this.hint.container.val(""),this.isContentEditable&&this.hint.container.text(""))},resetInput:function(){this.node.val("");this.isContentEditable&&this.node.text("");this.query="";this.rawQuery=""},buildCancelButtonLayout:function(){if(this.options.cancelButton){var t=this;n("<span/>",{"class":this.options.selector.cancelButton,html:"×",mousedown:function(n){n.stopImmediatePropagation();n.preventDefault();t.resetInput();t.node.trigger("input"+t.namespace,[n])}}).insertBefore(this.node)}},toggleCancelButtonVisibility:function(){this.container.toggleClass("cancel",!!this.query.length)},__construct:function(){(this.extendOptions(),this.unifySourceFormat())&&(this.dynamicFilter.init.apply(this),this.init(),this.buildDropdownLayout(),this.buildDropdownItemLayout("static"),this.buildMultiselectLayout(),this.delegateEvents(),this.buildCancelButtonLayout(),this.helper.executeCallback.call(this,this.options.callback.onReady,[this.node]))},helper:{isEmpty:function(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0},removeAccent:function(n){if(typeof n=="string"){var t=u;return s(this.options.accent)==="object"&&(t=this.options.accent),n.toLowerCase().replace(new RegExp("["+t.from+"]","g"),function(n){return t.to[t.from.indexOf(n)]})}},slugify:function(n){return n=String(n),n!==""&&(n=this.helper.removeAccent.call(this,n),n=n.replace(/[^-a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")),n},sort:function(n,t,i){var r=function(t){for(var r=0,u=n.length;r<u;r++)if(typeof t[n[r]]!="undefined")return i(t[n[r]]);return t};return t=[-1,1][+!!t],function(n,i){return n=r(n),i=r(i),t*((n>i)-(i>n))}},replaceAt:function(n,t,i,r){return n.substring(0,t)+r+n.substring(t+i)},highlight:function(n,t,i){var f,u,r;for(n=String(n),f=i&&this.helper.removeAccent.call(this,n)||n,u=[],Array.isArray(t)||(t=[t]),t.sort(function(n,t){return t.length-n.length}),r=t.length-1;r>=0;r--){if(t[r].trim()===""){t.splice(r,1);continue}t[r]=t[r].replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}for(f.replace(new RegExp("(?:"+t.join("|")+")(?!([^<]+)?>)","gi"),function(n,t,i){u.push({offset:i,length:n.length})}),r=u.length-1;r>=0;r--)n=this.helper.replaceAt(n,u[r].offset,u[r].length,"<strong>"+n.substr(u[r].offset,u[r].length)+"<\/strong>");return n},getCaret:function(n){var t=0,r,i,u,f,e;if(n.selectionStart)return n.selectionStart;if(document.selection){if(r=document.selection.createRange(),r===null)return t;i=n.createTextRange();u=i.duplicate();i.moveToBookmark(r.getBookmark());u.setEndPoint("EndToStart",i);t=u.text.length}else window.getSelection&&(f=window.getSelection(),f.rangeCount&&(e=f.getRangeAt(0),e.commonAncestorContainer.parentNode==n&&(t=e.endOffset)));return t},setCaretAtEnd:function(n){var t,r,i;typeof getSelection!="undefined"&&typeof document.createRange!="undefined"?(t=document.createRange(),t.selectNodeContents(n),t.collapse(!1),r=window.getSelection(),r.removeAllRanges(),r.addRange(t)):typeof document.body.createTextRange!="undefined"&&(i=document.body.createTextRange(),i.moveToElementText(n),i.collapse(!1),i.select())},cleanStringFromScript:function(n){return typeof n=="string"&&n.replace(/<\/?(?:script|iframe)\b[^>]*>/gm,"")||n},executeCallback:function(n,i){if(n){var r;if(typeof n=="function")r=n;else if((typeof n=="string"||Array.isArray(n))&&(typeof n=="string"&&(n=[n,[]]),r=this.helper.namespace.call(this,n[0],window),typeof r!="function")){this.options.debug&&(t.log({node:this.selector,"function":"executeCallback()",arguments:JSON.stringify(n),message:'WARNING - Invalid callback function"'}),t.print());return}return r.apply(this,(n[1]||[]).concat(i?i:[]))}},namespace:function(n,i,r,u){var s,o,h;if(typeof n!="string"||n==="")return this.options.debug&&(t.log({node:this.options.input||this.selector,"function":"helper.namespace()",arguments:n,message:'ERROR - Missing string"'}),t.print()),!1;if(s=typeof u!="undefined"?u:undefined,!~n.indexOf("."))return i[n]||s;var c=n.split("."),f=i||window,r=r||"get",e="";for(o=0,h=c.length;o<h;o++){if(e=c[o],typeof f[e]=="undefined"){if(~["get","delete"].indexOf(r))return typeof u!="undefined"?u:undefined;f[e]={}}if(~["set","create","delete"].indexOf(r)&&o===h-1)if(r==="set"||r==="create")f[e]=s;else return delete f[e],!0;f=f[e]}return f},typeWatch:function(){var n=0;return function(t,i){clearTimeout(n);n=setTimeout(t,i)}}()}},n=jQuery,n.fn.typeahead=n.typeahead=function(n){return r.typeahead(this,n)},r={typeahead:function(r,u){var o,e,f,h;if(!u||!u.source||s(u.source)!=="object"){t.log({node:r.selector||u&&u.input,"function":"$.typeahead()",arguments:JSON.stringify(u&&u.source||""),message:'Undefined "options" or "options.source" or invalid source type - Typeahead dropped'});t.print();return}if(typeof r=="function"){if(!u.input){t.log({node:r.selector,"function":"$.typeahead()",message:'Undefined "options.input" - Typeahead dropped'});t.print();return}r=n(u.input)}if(typeof r[0].value=="undefined"&&(r[0].value=r.text()),!r.length){t.log({node:r.selector,"function":"$.typeahead()",arguments:JSON.stringify(u.input),message:"Unable to find jQuery input element - Typeahead dropped"});t.print();return}if(r.length===1)return r[0].selector=r.selector||u.input||r[0].nodeName.toLowerCase(),window.Typeahead[r[0].selector]=new i(r,u);for(o={},f=0,h=r.length;f<h;++f)e=r[f].nodeName.toLowerCase(),typeof o[e]!="undefined"&&(e+=f),r[f].selector=e,window.Typeahead[e]=o[e]=new i(r.eq(f),u);return o}},t={table:{},log:function(t){t.message&&typeof t.message=="string"&&(this.table[t.message]=n.extend({node:"","function":"",arguments:""},t))},print:function(){!i.prototype.helper.isEmpty(this.table)&&console&&console.table&&(console.group!==undefined||console.table!==undefined,this.table={})}},t.log({message:"WARNING - You are using the DEBUG version. Use /dist/jquery.typeahead.min.js in production."}),t.print(),window.console=window.console||{log:function(){}},Array.isArray||(Array.isArray=function(n){return Object.prototype.toString.call(n)==="[object Array]"}),"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),"indexOf"in Array.prototype||(Array.prototype.indexOf=function(n,t){t===undefined&&(t=0);t<0&&(t+=this.length);t<0&&(t=0);for(var i=this.length;t<i;t++)if(t in this&&this[t]===n)return t;return-1}),Object.keys||(Object.keys=function(n){var t=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.push(i);return t}),i}($);a=jQuery;th=function(n){function r(n,u){var f;return fi(this,r),f=cf(this,lf(r).call(this,n,u)),i(t(t(f)),"init",function(){try{f.initFields();f.$element.typeahead(f.typeaheadOptions)}catch(t){console.error("Error initisalising typeahead control");console.error(t)}var n=f.eventHandler;n(f.$element,"input",f.onInput);n(f.$element,"afd:initFields",f.onAfdInitFields);n(f.$searchAgainButton,"click",f.onAfdSearchAgainButtonClick);f.options.typeahead.manualInputButton&&n(f.$manualInputButton,"click",f.onAfdManualInputButtonClick);f.options.typeahead.manualInputButton&&n(f.$manualInputSearchButton,"click",f.onAfdManualInputSearchButtonClick);f.getInitialCountry()}),i(t(t(f)),"setupTypeaheadRequestOptions",function(){f.initRequestSequence();f.requestOptions=f.setupParams({data:"address",fields:f.options.typeahead.postcodeFirst?"list":"fflist",task:"fastfindv4",lookup:"{{query}}",allpc:"1",matchPositions:f.options.typeahead.matchPositions?1:0,maxquantity:f.options.typeahead.maxItems,uniqueid:f.uniqueID});f.requestOptions.path="Item"}),i(t(t(f)),"prepareTypeaheadOptions",function(){return{dynamic:!0,source:{lookup:{ajax:f.requestOptions}},template:"<span>{{List}}<\/span>",templateValue:"{{List}}",cancelButton:!1,emptyTemplate:"No results found for {{query}}",filter:!1,maxItem:0,minLength:f.options.typeahead.minLength,delay:20,abortAjax:!1,selector:f.getTypeaheadSelectors(),callback:{onResult:f.onResult,onShowLayout:f.onShowLayout,onHideLayout:f.onHideLayout,onLayoutBuiltBefore:f.onLayoutBuiltBefore,onSearch:f.onSearch,onNavigateBefore:f.onNavigateBefore,onNavigateAfter:f.onNavigateAfter,onClickAfter:f.onClickAfter}}}),i(t(t(f)),"onInput",function(n){var t=f.containers.length>0?a(f.containers):a(document);t.find(".afd-typeahead-status").html("&nbsp;");a(document).trigger("afd:typeaheadInput",[n.target.value])}),i(t(t(f)),"onCountryChangedLocal",function(n){f.typeaheadOptions.source.lookup.ajax.data.countryiso=n;f.$element.typeahead(f.typeaheadOptions)}),i(t(t(f)),"onAfdInitFields",function(){f.$element.typeahead(f.typeaheadOptions);f.setFields();f.initFields()}),i(t(t(f)),"onResult",function(n,t,i){var r=f.containers.length>0?a(f.containers):a(document);r.find(".afd-typeahead-status").html(i.length+" results found");f.options.typeahead.beforeHideResults&&f.options.typeahead.fewResultsManualInput&&i.length<f.options.typeahead.maxItems&&t.length>3&&window.Typeahead.input.result.push({List:f.options.typeahead.fewResultsManualInputText,Key:null,group:"lookup",matchedKey:"display"})}),i(t(t(f)),"onShowLayout",function(){f.$manualInputButton.hide()}),i(t(t(f)),"onHideLayout",function(n){var t=n.closest(f.containers),i=f.multiForms?t.find("[data-afd-result]:hidden").length===0:a("[data-afd-result]:hidden").length===0;!i&&f.options.typeahead.manualInputButton&&f.$manualInputButton.show()}),i(t(t(f)),"onLayoutBuiltBefore",function(n,t,i,r){var y,u,o,c;if(i.length===0)return r;if(y=f.containers.length>0?"-"+f.$element.closest(f.containers.toString()).attr("id"):"",r.attr("id","afd-results"+y).attr("role","listbox"),f.options.typeahead.matchPositions&&typeof i[0].matchPositions!="undefined"){var p='<span class="afd-matched-highlight">',w="<\/span>",b=p.length+w.length;for(u=0;u<i.length;u++){var l=i[u],k=a(r.children().eq(u)),s=k.text();if(typeof l.matchPositions!="undefined")for(o=0;o<l.matchPositions.length;o++){var h=l.matchPositions[o],v=o*b,e="";e+=s.substr(0,h[0]+v);e+=p;e+=s.substr(h[0]+v,h[1]-h[0]);e+=w;e+=s.substr(h[1]+v);s=e}c='<a href="javascript:;">';c+=s;c+="<\/a>";r.children().eq(u).html(c)}}return i.length===1&&r.children().addClass("active"),r.children().attr("role","option"),r.children().each(function(n){r.children().eq(n).attr("id","afd-result-"+n)}),r.attr("aria-label","Results"),r}),i(t(t(f)),"onSearch",function(){a("."+f.typeaheadOptions.selector.result).empty()}),i(t(t(f)),"onNavigateBefore",function(n,t,i){~[38,40].indexOf(event.keyCode)&&(i.preventInputChange=!0)}),i(t(t(f)),"onNavigateAfter",function(n,t,i,r,u,e){var o=t.filter("li.active"),c=f.containers.length>0?a(f.containers):a(document),s,h;~[38,40].indexOf(e.keyCode)&&(s=c.find(".afd-typeahead-list"),h=o[0]&&o[0].offsetTop-s.height()/2||0,s.scrollTop(h));t.removeAttr("aria-selected");o.attr("aria-selected","true");f.$element.attr("aria-activedescendant",o.attr("id"))}),i(t(t(f)),"onClickAfter",function(n,t,i){var r=f.containers.length>0?a(f.containers):a(document);if(r.find(".afd-typeahead-status").html("&nbsp;"),f.handleMultiForms(),a(".afd-typeahead-field input").val(""),!i.Key){f.showResultFields();f.$fieldSets.show();f.$manualInputButton.hide();f.$manualInputSearchButton.show();f.$typeaheadFieldandLabel.hide();return}f.addressRetrieve(i.Key).then(f.handleAddressRetrieve).fail(function(n){return console.error(n)})}),i(t(t(f)),"getTypeaheadSelectors",function(){return{container:"afd-typeahead-container",result:"afd-typeahead-result",list:"afd-typeahead-list",group:"afd-typeahead-group",item:"afd-typeahead-item",empty:"afd-typeahead-empty",display:"afd-typeahead-display",query:"afd-typeahead-query",filter:"afd-typeahead-filter",filterButton:"afd-typeahead-filterButton",dropdown:"afd-typeahead-dropdown",dropdownItem:"afd-typeahead-dropdownItem",button:"afd-typeahead-button",backdrop:"afd-typeahead-backdrop",hint:"afd-typeahead-hint",cancelButton:"afd-typeahead-cancelButton"}}),f.controlType="typeahead",f.timer=null,f.$reverseGeocodeButton=n.siblings(".afd-typeahead-reverse-geocode-button"),f.setFields(),f.refreshUniqeID(),f.setupTypeaheadRequestOptions(),f.typeaheadOptions=f.prepareTypeaheadOptions(),f}return fr(r,n),r}(tit(af));var crt=lt.f,pa=Function.prototype,lrt=/^\s*function ([^ (]*)/,wa="name";wa in pa||k&&crt(pa,wa,{configurable:!0,get:function(){try{return(""+this).match(lrt)[1]}catch(n){return""}}});var art=o("toStringTag"),vrt=ut(function(){return arguments}())=="Arguments",yrt=function(n,t){try{return n[t]}catch(i){}},ba=function(n){var t,i,r;return n===undefined?"Undefined":n===null?"Null":typeof(i=yrt(t=Object(n),art))=="string"?i:vrt?ut(t):(r=ut(t))=="Object"&&typeof t.callee=="function"?"Arguments":r},prt=function(n,t,i,r){if(!(n instanceof t)||r!==undefined&&r in n)throw TypeError(i+": incorrect invocation!");return n},wrt=function(n,t,i,r){try{return r?t(y(i)[0],i[1]):t(i)}catch(f){var u=n["return"];u!==undefined&&y(u.call(n));throw f;}},brt=o("iterator"),krt=Array.prototype,drt=function(n){return n!==undefined&&(et.Array===n||krt[brt]===n)},grt=o("iterator"),nut=b.getIteratorMethod=function(n){if(n!=undefined)return n[grt]||n["@@iterator"]||et[ba(n)]},ka=w(function(n){var t={},i={},r=n.exports=function(n,r,u,f,e){var l=e?function(){return n}:nut(n),a=c(u,f,r?2:1),s=0,p,h,v,o;if(typeof l!="function")throw TypeError(n+" is not iterable!");if(drt(l)){for(p=uf(n.length);p>s;s++)if(o=r?a(y(h=n[s])[0],h[1]):a(n[s]),o===t||o===i)return o}else for(v=l.call(n);!(h=v.next()).done;)if(o=wrt(v,a,h.value,r),o===t||o===i)return o};r.BREAK=t;r.RETURN=i}),tut=o("species"),iut=function(n,t){var i=y(n).constructor,r;return i===undefined||(r=y(i)[tut])==undefined?t:ni(r)},rut=function(n,t,i){var r=i===undefined;switch(t.length){case 0:return r?n():n.call(i);case 1:return r?n(t[0]):n.call(i,t[0]);case 2:return r?n(t[0],t[1]):n.call(i,t[0],t[1]);case 3:return r?n(t[0],t[1],t[2]):n.call(i,t[0],t[1],t[2]);case 4:return r?n(t[0],t[1],t[2],t[3]):n.call(i,t[0],t[1],t[2],t[3])}return n.apply(i,t)},da=r.process,ee=r.setImmediate,oe=r.clearImmediate,ga=r.MessageChannel,se=r.Dispatch,he=0,di={},nv="onreadystatechange",ii,ce,le,gi=function(){var n=+this,t;di.hasOwnProperty(n)&&(t=di[n],delete di[n],t())},tv=function(n){gi.call(n.data)};ee&&oe||(ee=function(n){for(var t=[],i=1;arguments.length>i;)t.push(arguments[i++]);return di[++he]=function(){rut(typeof n=="function"?n:Function(n),t)},ii(he),he},oe=function(n){delete di[n]},ut(da)=="process"?ii=function(n){da.nextTick(c(gi,n,1))}:se&&se.now?ii=function(n){se.now(c(gi,n,1))}:ga?(ce=new ga,le=ce.port2,ce.port1.onmessage=tv,ii=c(le.postMessage,le,1)):r.addEventListener&&typeof postMessage=="function"&&!r.importScripts?(ii=function(n){r.postMessage(n+"","*")},r.addEventListener("message",tv,!1)):ii=nv in cr("script")?function(n){te.appendChild(cr("script"))[nv]=function(){te.removeChild(this);gi.call(n)}}:function(n){setTimeout(c(gi,n,1),0)});var iv={set:ee,clear:oe},uut=iv.set,rv=r.MutationObserver||r.WebKitMutationObserver,ae=r.process,ve=r.Promise,uv=ut(ae)=="process",fut=function(){var n,i,t,u=function(){var r,u;for(uv&&(r=ae.domain)&&r.exit();n;){u=n.fn;n=n.next;try{u()}catch(f){n?t():i=undefined;throw f;}}i=undefined;r&&r.enter()},f,e,o;return uv?t=function(){ae.nextTick(u)}:!rv||r.navigator&&r.navigator.standalone?ve&&ve.resolve?(o=ve.resolve(undefined),t=function(){o.then(u)}):t=function(){uut.call(r,u)}:(f=!0,e=document.createTextNode(""),new rv(u).observe(e,{characterData:!0}),t=function(){e.data=f=!f}),function(r){var u={fn:r,next:undefined};i&&(i.next=u);n||(n=u,t());i=u}},eut=function(n){return new rb(n)},ye={f:eut},pe=function(n){try{return{e:!1,v:n()}}catch(t){return{e:!0,v:t}}},fv=r.navigator,out=fv&&fv.userAgent||"",sut=function(n,t){if(y(n),v(t)&&t.constructor===n)return t;var i=ye.f(n),r=i.resolve;return r(t),i.promise},hut=function(n,t,i){for(var r in t)vt(n,r,t[r],i);return n},we=o("iterator"),ev=!1;try{ih=[7][we]();ih["return"]=function(){ev=!0}}catch(pot){}var cut=function(n,t){var r,i,u;if(!t&&!ev)return!1;r=!1;try{i=[7];u=i[we]();u.next=function(){return{done:r=!0}};i[we]=function(){return u};n(i)}catch(f){}return r},ov=iv.set,sv=fut(),ot="Promise",hv=r.TypeError,ri=r.process,cv=ri&&ri.versions,lut=cv&&cv.v8||"",g=r[ot],nr=ba(ri)=="process",tu=function(){},iu,lv,av,be,tr=lv=ye.f,ir=!!function(){try{var n=g.resolve(1),t=(n.constructor={})[o("species")]=function(n){n(tu,tu)};return(nr||typeof PromiseRejectionEvent=="function")&&n.then(tu)instanceof t&&lut.indexOf("6.6")!==0&&out.indexOf("Chrome/66")===-1}catch(i){}}(),vv=function(n){var t;return v(n)&&typeof(t=n.then)=="function"?t:!1},ke=function(n,t){if(!n._n){n._n=!0;var i=n._c;sv(function(){for(var r=n._v,u=n._s==1,f=0,e=function(t){var o=u?t.ok:t.fail,s=t.resolve,e=t.reject,i=t.domain,f,h,c;try{o?(u||(n._h==2&&vut(n),n._h=1),o===!0?f=r:(i&&i.enter(),f=o(r),i&&(i.exit(),c=!0)),f===t.promise?e(hv("Promise-chain cycle")):(h=vv(f))?h.call(f,s,e):s(f)):e(r)}catch(l){i&&!c&&i.exit();e(l)}};i.length>f;)e(i[f++]);n._c=[];n._n=!1;t&&!n._h&&aut(n)})}},aut=function(n){ov.call(r,function(){var t=n._v,f=yv(n),i,e,u;if(f&&(i=pe(function(){nr?ri.emit("unhandledRejection",t,n):(e=r.onunhandledrejection)?e({promise:n,reason:t}):(u=r.console)&&u.error&&u.error("Unhandled promise rejection",t)}),n._h=nr||yv(n)?2:1),n._a=undefined,f&&i.e)throw i.v;})},yv=function(n){return n._h!==1&&(n._a||n._c).length===0},vut=function(n){ov.call(r,function(){var t;nr?ri.emit("rejectionHandled",n):(t=r.onrejectionhandled)&&t({promise:n,reason:n._v})})},ui=function(n){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=n,t._s=2,t._a||(t._a=t._c.slice()),ke(t,!0))},de=function(n){var t=this,i;if(!t._d){t._d=!0;t=t._w||t;try{if(t===n)throw hv("Promise can't be resolved itself");(i=vv(n))?sv(function(){var r={_w:t,_d:!1};try{i.call(n,c(de,r,1),c(ui,r,1))}catch(u){ui.call(r,u)}}):(t._v=n,t._s=1,ke(t,!1))}catch(r){ui.call({_w:t,_d:!1},r)}}};ir||(g=function(n){prt(this,g,ot,"_h");ni(n);iu.call(this);try{n(c(de,this,1),c(ui,this,1))}catch(t){ui.call(this,t)}},iu=function(){this._c=[];this._a=undefined;this._s=0;this._d=!1;this._v=undefined;this._h=0;this._n=!1},iu.prototype=hut(g.prototype,{then:function(n,t){var i=tr(iut(this,g));return i.ok=typeof n=="function"?n:!0,i.fail=typeof t=="function"&&t,i.domain=nr?ri.domain:undefined,this._c.push(i),this._a&&this._a.push(i),this._s&&ke(this,!1),i.promise},"catch":function(n){return this.then(undefined,n)}}),av=function(){var n=new iu;this.promise=n;this.resolve=c(de,n,1);this.reject=c(ui,n,1)},ye.f=tr=function(n){return n===g||n===be?new av(n):lv(n)});f(f.G+f.W+f.F*!ir,{Promise:g});ue(g,ot);na(ot);be=b[ot];f(f.S+f.F*!ir,ot,{reject:function(n){var t=tr(this),i=t.reject;return i(n),t.promise}});f(f.S+f.F*(lr||!ir),ot,{resolve:function(n){return sut(lr&&this===be?g:this,n)}});f(f.S+f.F*!(ir&&cut(function(n){g.all(n)["catch"](tu)})),ot,{all:function(n){var i=this,t=tr(i),r=t.resolve,u=t.reject,f=pe(function(){var t=[],e=0,f=1;ka(n,!1,function(n){var s=e++,o=!1;t.push(undefined);f++;i.resolve(n).then(function(n){o||(o=!0,t[s]=n,--f||r(t))},u)});--f||r(t)});return f.e&&u(f.v),t.promise},race:function(n){var i=this,t=tr(i),r=t.reject,u=pe(function(){ka(n,!1,function(n){i.resolve(n).then(t.resolve,r)})});return u.e&&r(u.v),t.promise}});rh=ub;pu=fb;var yut=eb,put=yut(),wut=put;uh=ob;var but=sb,ge=w(function(n,t){var i=t&&!t.nodeType&&t,r=i&&!0&&n&&!n.nodeType&&n,f=r&&r.exports===i,u=f?it.Buffer:undefined,e=u?u.isBuffer:undefined,o=e||but;n.exports=o}),e={};e["[object Float32Array]"]=e["[object Float64Array]"]=e["[object Int8Array]"]=e["[object Int16Array]"]=e["[object Int32Array]"]=e["[object Uint8Array]"]=e["[object Uint8ClampedArray]"]=e["[object Uint16Array]"]=e["[object Uint32Array]"]=!0;e["[object Arguments]"]=e["[object Array]"]=e["[object ArrayBuffer]"]=e["[object Boolean]"]=e["[object DataView]"]=e["[object Date]"]=e["[object Error]"]=e["[object Function]"]=e["[object Map]"]=e["[object Number]"]=e["[object Object]"]=e["[object RegExp]"]=e["[object Set]"]=e["[object String]"]=e["[object WeakMap]"]=!1;fh=hb;var kut=cb,pv=w(function(n,t){var u=t&&!t.nodeType&&t,i=u&&!0&&n&&!n.nodeType&&n,f=i&&i.exports===u,r=f&&ul.process,e=function(){try{var n=i&&i.require&&i.require("util").types;return n?n:r&&r.binding&&r.binding("util")}catch(t){}}();n.exports=e}),wv=pv&&pv.isTypedArray,dut=wv?kut(wv):fh,bv=dut,gut=Object.prototype,nft=gut.hasOwnProperty;eh=lb;oh=Object.prototype;sh=ab;var tft=vb,ift=tft(Object.keys,Object),rft=ift,uft=Object.prototype,fft=uft.hasOwnProperty;hh=yb;wu=pb;hr=wb;ch=bb;var eft=kb,oft=eft(ch),sft=oft;lh=db;ah=gb;vh=nk;yh=tk;ph=ik;wh=200;bh=rk;gt.prototype.clear=ah;gt.prototype["delete"]=vh;gt.prototype.get=yh;gt.prototype.has=ph;gt.prototype.set=bh;ci=gt;kh="__lodash_hash_undefined__";dh=uk;gh=fk;rr.prototype.add=rr.prototype.push=dh;rr.prototype.has=gh;nc=rr;tc=ek;var hft=ok,cft=1,lft=2,kv=sk,aft=it.Uint8Array,dv=aft;ic=hk;var vft=ck,yft=1,pft=2,wft="[object Boolean]",bft="[object Date]",kft="[object Error]",dft="[object Map]",gft="[object Number]",net="[object RegExp]",tet="[object Set]",iet="[object String]",ret="[object Symbol]",uet="[object ArrayBuffer]",fet="[object DataView]",gv=ft?ft.prototype:undefined,no=gv?gv.valueOf:undefined;rc=lk;uc=ak;fc=vk;var eet=yk,oet=Object.prototype,set=oet.propertyIsEnumerable,ny=Object.getOwnPropertySymbols,het=ny?function(n){return n==null?[]:(n=Object(n),pu(ny(n),function(t){return set.call(n,t)}))}:eet,cet=het,ty=pk,aet=1,vet=Object.prototype,yet=vet.hasOwnProperty,pet=wk,wet=ti(it,"DataView"),to=wet,bet=ti(it,"Promise"),io=bet,ket=ti(it,"Set"),ro=ket,det=ti(it,"WeakMap"),uo=det,iy="[object Map]",get="[object Object]",ry="[object Promise]",uy="[object Set]",fy="[object WeakMap]",ey="[object DataView]",not=yt(to),tot=yt(pi),iot=yt(io),rot=yt(ro),uot=yt(uo),wt=st;(to&&wt(new to(new ArrayBuffer(1)))!=ey||pi&&wt(new pi)!=iy||io&&wt(io.resolve())!=ry||ro&&wt(new ro)!=uy||uo&&wt(new uo)!=fy)&&(wt=function(n){var t=st(n),i=t==get?n.constructor:undefined,r=i?yt(i):"";if(r)switch(r){case not:return ey;case tot:return iy;case iot:return ry;case rot:return uy;case uot:return fy}return t});var oy=wt,fot=1,sy="[object Arguments]",hy="[object Array]",ru="[object Object]",eot=Object.prototype,cy=eot.hasOwnProperty;ec=bk;var ly=so,oot=1,sot=2;oc=kk;bu=dk;sc=gk;ku=nd;hc=td;cc=id;var hot=rd,cot=1,lot=2;lc=ud;ac=fd;vc=ed;yc=od;pc=sd;wc=hd;var aot=cd,nt=jQuery,vot=function(n){function r(n,u){var f;return fi(this,r),f=cf(this,lf(r).call(this,n,u)),i(t(t(f)),"onChange",function(n){nt(document).trigger("afd:countryChanged",[n.target.value])}),i(t(t(f)),"getCountries",function(){nt(document).trigger("afd:getCountriesStart");var n,t=new Promise(function(t){n=t}),i=f.setupParams({data:"list",task:"listcountries",fields:"standard",countryISO:"FRA"});return nt.ajax(i).done(f.handleGetCountries.bind(null,n)),t}),i(t(t(f)),"handleGetCountries",function(n,t){var u,i,r;if(t.status===-2){u=(typeof t.reason!="undefined"?t.reason:"")+(typeof t.other!="undefined"?" - "+t.other:"");throw u;}i=t.Item;r=f.options.country.preferredCountries;nt.each(r,function(n,t){var u=aot(i,{iso:t}),r;if(u.length===0){console.warn(t+" was supplied as a preferredCountry but is not a valid option.  Please use a valid country ISO3");return}r=u[0];f.$element.append(nt("<option />").val(r.iso).text(r.name))});nt.each(i,function(n,t){if(!(r.indexOf(t.iso)>-1)){var i=f.options.typeahead.availableCountries.length>0&&f.options.typeahead.availableCountries.indexOf(t.iso)>-1||f.options.country.availableCountries.length>0&&f.options.country.availableCountries.indexOf(t.iso)>-1||f.options.typeahead.availableCountries.length<1&&f.options.country.availableCountries.length<1;i&&f.$element.append(nt("<option />").val(t.iso).text(t.name))}});f.options.defaultCountry&&(f.$element.val(f.options.defaultCountry),nt(document).trigger("afd:countryChanged",[f.$element.val()]));f.options.country.defaultCountry&&(f.$element.val(f.options.country.defaultCountry),nt(document).trigger("afd:countryChanged",[f.$element.val()]));nt(document).trigger("afd:getCountriesComplete",i);n()}),f}return fr(r,n),rh(r,[{key:"init",value:function(){return this.eventHandler(this.$element,"change",this.onChange),this.getCountries()}}]),r}(af);window.afdInitScripts=typeof afdInitScripts=="undefined"?{lookupButton:null,typeahead:null,reverseGeocodeButton:null,account:null,card:null,email:null,phone:null,country:null}:window.afdInitScripts;window.afdInitScripts.lookupButton=typeof initLookup!="undefined"?initLookup:window.afdInitScripts.lookupButton?window.afdInitScripts.lookupButton:null;window.afdInitScripts.typeahead=typeof eo!="undefined"?eo:window.afdInitScripts.typeahead?window.afdInitScripts.typeahead:null;window.afdInitScripts.reverseGeocodeButton=typeof initReverseGeocode!="undefined"?initReverseGeocode:window.afdInitScripts.reverseGeocodeButton?window.afdInitScripts.reverseGeocodeButton:null;window.afdInitScripts.account=typeof initAccount!="undefined"?initAccount:window.afdInitScripts.account?window.afdInitScripts.account:null;window.afdInitScripts.card=typeof initCard!="undefined"?initCard:window.afdInitScripts.card?s(window.afdInitScripts.card):null;window.afdInitScripts.email=typeof initEmail!="undefined"?initEmail:window.afdInitScripts.email?window.afdInitScripts.email:null;window.afdInitScripts.phone=typeof initPhone!="undefined"?initPhone:window.afdInitScripts.phone?window.afdInitScripts.phone:null;window.afdInitScripts.country=typeof ho!="undefined"?ho:window.afdInitScripts.country?window.afdInitScripts.country:null,function(n){if(n.fn.afd=function(n,t){return this.each(function(){var r=["lookupField","lookupResultsList","reverseGeocodeResultsList","sort","expiry"],i;if(!(r.indexOf(n)>-1)){if(i=["typeahead","lookupButton","country","reverseGeocodeButton","phone","email","account","card"],i.indexOf(n)===-1)throw"`"+n+"` is not a valid AFD jQuery control.  Please use one of "+i+","+r;if(!window.afdInitScripts[n])throw"You are trying to intitialise the control `"+n+"` but it seems that you have not loaded this module";try{window.afdInitScripts[n].call(this,n,t,constructor)}catch(u){console.error("Problem initialising AFD Control");console.error(u)}}})},ld(),typeof postRender!="undefined"){n(document).ready(function(){n(document).trigger("afd::initPostRender")});n(document).on("afd::initPostRender",function(){try{if(typeof afdOptions.postRender=="undefined")throw"Post Render version of plugin used bit no post render options supplied";postRender(afdOptions.postRender);n(document).trigger("afd:postRenderInitComplete")}catch(t){console.error(t)}n(document).trigger("afd::page_ready")})}}(n)})