/*! [BUILD VERSION] - 20.5.0 - Wed Oct 20 2021 17:38:59 GMT+1100 (Australian Eastern Daylight Time) */
!function(){"use strict";var t={HIDDEN:"is-hidden",ACTIVE:"is-active",CURRENT:"is-current",FOCUSED:"is-focused",ERROR:"is-error",OPEN:"is-open",DISABLED:"is-disabled",HAS_ERROR:"has-error"},a={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,FORWARD_SLASH:191};var e=a.TAB,n=a.ENTER,r=a.ESCAPE,o=a.UP,s=a.DOWN,i=".js-search-form-input-wrap",c=".js-search-form-input",u=".search-typeahead",l=$(".wrapper-body").hasClass("has-search-results"),d="is-open",f="no-scroll",g="cta-search-form-open",h="search-overlay",p=$("body"),v=[];function m(t){return t.siblings(u).addClass("is-hidden").attr("aria-expanded",!1).find("ul").empty(),!0}function y(t,a){for(var e=a.attr("data-max-suggestions"),n=parseInt(a.attr("data-instance-id"),10),r=(v[n-1]||{}).autoSuggestData||[],o=[],s=0;s<r.length;s++){var i=r[s];if(0===i.toLowerCase().indexOf(t.trim().toLowerCase())&&(o.push(i),o.length>=e))break}return o}function C(t,a){!function(t,a){if(t&&t.results&&t.results.length){for(var e=t.results,n=a.siblings(u),r=a.parents("form").attr("action"),o="",s=0;s<e.length;s++){var i=e[s],c=encodeURI(i),l="".concat(r,"?q=").concat(c,"&ref=auto");o+='<li role="option" aria-selected="false"><a href="'.concat(l,'" data-query="').concat(i,'" title="Search for ').concat(i,'">').concat(i,"</a></li>\n")}n.removeClass("is-hidden").attr("aria-expanded",!0).find("ul").html(o)}else m(a)}({results:y(t,a)},a)}function S(t,a,i){var c=t.is(":focus"),u=a.find("a"),d=u.length;if(c&&$.inArray(i.keyCode,[o,s])>-1)return E(u,i.keyCode===s?0:d-1),!1;if(i.keyCode===n&&!l&&!c)return window.location=i.currentTarget.href,!1;if($.inArray(i.keyCode,[e,o,s])>-1){var f=u.index(i.currentTarget)+(i.keyCode===o||i.shiftKey&&i.keyCode===e?-1:1);return-1===f||f===d?(t.focus(),E(u)):E(u,f),!1}return c||i.keyCode!==r?void 0:(t.focus(),m(t))}function E(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t.each((function(t,e){var n=$(e),r=n.parent("li");t===a?(n.focus(),r.attr("aria-selected","true")):r.attr("aria-selected","false")}))}function w(t){var a=$(t.currentTarget),r=t.currentTarget.value.trim();if(!($.inArray(t.keyCode,[n,e,o,s])>-1))return r.length>=3?void C(r,a):m(a)}function b(t){var a=$(t.currentTarget),e=a.siblings(u);if($.inArray(t.keyCode,[r,n,o,s])>-1){if(!e.is(":visible"))return;return S(a,e,t)}}function D(t){var a=$(t.currentTarget).closest(u);return S(a.siblings(c),a,t)}function T(t){var a=$(t.target),e=a.find(c).val().trim();return window.location="".concat(a.attr("action"),"?q=").concat(encodeURIComponent(e)),!1}function k(a){var e=$(a.target).closest(i);"focus"===a.type?e.addClass(t.FOCUSED):"blur"===a.type&&e.removeClass(t.FOCUSED)}function A(t){return!$(t.target).closest(i).length&&$("".concat(c,"[data-typeahead=true]")).each((function(t){m($(t))})),!0}function P(){var t,a,e,n,r,o;$(document).on("input","".concat(c,"[data-typeahead=true]"),(t=w,a=200,function(){var s,i;r=this,n=[].slice.call(arguments,0),o=new Date,s=function(){(i=new Date-o)<a?e=setTimeout(s,a-i):(e=null,t.apply(r,n))},e||(e=setTimeout(s,a))})).on("keydown","".concat(c,"[data-typeahead=true]"),b).on("internal-search","".concat(c,"[data-typeahead=true]"),(function(t){m($(t.target))})).on("keydown","".concat(u," a"),D).on("click",A)}function R(t){var a,e,n=$(t.target).closest(".header-wrap").find(".".concat(h)),r=n.siblings(".search-form-container"),o=r.find(c);r.addClass(d),o.focus(),n.addClass(d),p.addClass(f),$(".".concat(g)).attr("aria-expanded",!0),e="focusin."+"searchbar",(a=r).attr("tabindex","0"),$(document).on(e,(function(t){a[0].contains(t.target)||(t.stopPropagation(),a.focus())}))}function O(t){var a,e=$(t.target).closest(".header-wrap"),n=e.find(".".concat(h)),r=n.siblings(".search-form-container"),o=e.find(".cta-search-form-open");return r.removeClass(d),o.focus(),n.removeClass(d),p.removeClass(f),$(".".concat(g)).attr("aria-expanded",!1),a="focusin."+"searchbar",r.attr("tabindex","-1"),$(document).off(a),!1}function I(){var t;$(c).on("blur focus",k),l||$(document).on("submit",".search-form",T),$(".".concat(g)).on("click",(function(t){return R(t)})),$(".".concat("cta-search-form-close")).on("click",(function(t){return O(t)})),$(".".concat(h)).on("click",(function(t){return O(t)})),$(c).each((function(t,a){var e=$(a),n=t+1,r=e.attr("data-api-base")||"",o={id:n,autoSuggestEndpoint:r,autoSuggestPromise:null,autoSuggestData:null};v.push(o);var s="search-form-auto-suggestions-".concat(n),c=e.closest(i).find("".concat(u," > ul"));if(e.attr({"data-instance-id":n,"aria-owns":s}),c.attr("id",s),r.length){for(var l=t;l>0;l--){var d=v[t-1]||{},f=d.autoSuggestEndpoint;r.length&&r===f&&(o.autoSuggestPromise=d.autoSuggestPromise)}null===o.autoSuggestPromise&&(o.autoSuggestPromise=$.get(r)),o.autoSuggestPromise.done((function(t){if("string"==typeof t){var a=t.trim().slice(1,-1);try{o.autoSuggestData=JSON.parse(a.trim())}catch(t){o.autoSuggestData=null,console.warn("[SF]","Invalid auto suggest JSON string:",n,a,t)}}else console.warn("[SF]","Invalid auto suggest data string:",n,t)})).fail((function(){console.warn("[SF]","Error getting auto suggest results pool data",n)}))}else console.warn("[SF]","Invalid auto suggest data endpoint for instance:",n,r)}));var a=[];v.forEach((function(t){null!==t.autoSuggestPromise&&a.push(t.autoSuggestPromise)})),(t=$).when.apply(t,a).then((function(){P()}))}$(document).ready((function(){I()}))}();