/*! ATOOnline 2023-10-31, Copyright (c) 2023 Australian Taxation Office */ !function(e,n){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e.Bloodhound=n(t)}):"object"==typeof exports?module.exports=n(require("jquery")):e.Bloodhound=n(e.jQuery)}(this,function(c){var h=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(t){return!t||/^\s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:c.isArray,isFunction:c.isFunction,isObject:c.isPlainObject,isUndefined:function(t){return void 0===t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(t){return t instanceof c},toStr:function(t){return h.isUndefined(t)||null===t?"":t+""},bind:c.proxy,each:function(t,n){c.each(t,function(t,e){return n(e,t)})},map:c.map,filter:c.grep,every:function(n,i){var s=!0;return n?(c.each(n,function(t,e){if(!(s=i.call(null,e,t,n)))return!1}),!!s):s},some:function(n,i){var s=!1;return n?(c.each(n,function(t,e){if(s=i.call(null,e,t,n))return!1}),!!s):s},mixin:c.extend,identity:function(t){return t},clone:function(t){return c.extend(!0,{},t)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(t){return c.isFunction(t)?t:function(){return String(t)}},defer:function(t){setTimeout(t,0)},debounce:function(s,r,o){var a,u;return function(){var t,e,n=this,i=arguments;return t=function(){a=null,o||(u=s.apply(n,i))},e=o&&!a,clearTimeout(a),a=setTimeout(t,r),e&&(u=s.apply(n,i)),u}},throttle:function(n,i){var s,r,o,a,u,c;return u=0,c=function(){u=new Date,o=null,a=n.apply(s,r)},function(){var t=new Date,e=i-(t-u);return s=this,r=arguments,e<=0?(clearTimeout(o),o=null,u=t,a=n.apply(s,r)):o=o||setTimeout(c,e),a}},stringify:function(t){return h.isString(t)?t:JSON.stringify(t)},guid:function(){function t(t){var e=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+e.substr(0,4)+"-"+e.substr(4,4):e}return"tt-"+t()+t(!0)+t(!0)+t()},noop:function(){}}}(),n=function(){"use strict";return{nonword:e,whitespace:t,ngram:n,obj:{nonword:i(e),whitespace:i(t),ngram:i(n)}};function t(t){return(t=h.toStr(t))?t.split(/\s+/):[]}function e(t){return(t=h.toStr(t))?t.split(/\W+/):[]}function n(t){t=h.toStr(t);var e=[],n="";return h.each(t.split(""),function(t){t.match(/\s+/)?n="":(e.push(n+t),n+=t)}),e}function i(i){return function(t){return t=h.isArray(t)?t:[].slice.call(arguments,0),function(e){var n=[];return h.each(t,function(t){n=n.concat(i(h.toStr(e[t])))}),n}}}}(),i=function(){"use strict";function t(t){this.maxSize=h.isNumber(t)?t:100,this.reset(),this.maxSize<=0&&(this.set=this.get=c.noop)}function e(){this.head=this.tail=null}function s(t,e){this.key=t,this.val=e,this.prev=this.next=null}return h.mixin(t.prototype,{set:function(t,e){var n,i=this.list.tail;this.size>=this.maxSize&&(this.list.remove(i),delete this.hash[i.key],this.size--),(n=this.hash[t])?(n.val=e,this.list.moveToFront(n)):(n=new s(t,e),this.list.add(n),this.hash[t]=n,this.size++)},get:function(t){var e=this.hash[t];if(e)return this.list.moveToFront(e),e.val},reset:function(){this.size=0,this.hash={},this.list=new e}}),h.mixin(e.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),t}(),e=function(){"use strict";var r;try{(r=window.localStorage).setItem("~~~","!"),r.removeItem("~~~")}catch(t){r=null}function t(t,e){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+h.escapeRegExChars(this.prefix)),this.ls=e||r,this.ls||this._noop()}return h.mixin(t.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=h.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(t){"QuotaExceededError"===t.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),n(this.ls.getItem(this._prefix(t)))},set:function(t,e,n){return h.isNumber(n)?this._safeSet(this._ttlKey(t),s(i()+n)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),s(e))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){var t,e=function(t){var e,n,i=[],s=r.length;for(e=0;ee)}}),t;function i(){return(new Date).getTime()}function s(t){return JSON.stringify(h.isUndefined(t)?null:t)}function n(t){return c.parseJSON(t)}}(),s=function(){"use strict";var a=0,u={},e=new i(10);function t(t){t=t||{},this.maxPendingRequests=t.maxPendingRequests||6,this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=!1===t.cache?new i(0):e}return t.setMaxPendingRequests=function(t){this.maxPendingRequests=t},t.resetCache=function(){e.reset()},h.mixin(t.prototype,{_fingerprint:function(t){return(t=t||{}).url+t.type+c.param(t.data||{})},_get:function(t,e){var n,i,s=this;function r(t){e(null,t),s._cache.set(n,t)}function o(){e(!0)}n=this._fingerprint(t),this.cancelled||n!==this.lastReq||((i=u[n])?i.done(r).fail(o):ae[i]||(s.push(t[n]),n++),i++);return s}(r,s):s;else if(!o.matchAnyQueryToken)return!(r=[])}),r?h.map(function(t){for(var e={},n=[],i=0,s=t.length;i',menu:'
'}}(n),selectors:function(t){var n={};return y.each(t,function(t,e){n[e]="."+t}),n}(n)}).css,html:e.html,classes:e.classes,selectors:e.selectors,mixin:function(t){y.mixin(t,e)}}}}(),v=function(){"use strict";var n;function t(t){t&&t.el||m.error("EventBus initialized without el"),this.$el=m(t.el)}return"typeahead:",n={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},y.mixin(t.prototype,{_trigger:function(t,e){var n=m.Event("typeahead:"+t);return this.$el.trigger.call(this.$el,n,e||[]),n},before:function(t){var e;return e=[].slice.call(arguments,1),this._trigger("before"+t,e).isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=n[t])&&this._trigger(e,[].slice.call(arguments,1))}}),t}(),e=function(){"use strict";var o=/\s+/,a=function(){var t;t=window.setImmediate?function(t){setImmediate(function(){t()})}:function(t){setTimeout(function(){t()},0)};return t}();return{onSync:function(t,e,n){return i.call(this,"sync",t,e,n)},onAsync:function(t,e,n){return i.call(this,"async",t,e,n)},off:function(t){var e;if(!this._callbacks)return this;t=t.split(o);for(;e=t.shift();)delete this._callbacks[e];return this},trigger:function(t){var e,n,i,s,r;if(!this._callbacks)return this;t=t.split(o),i=[].slice.call(arguments,1);for(;(e=t.shift())&&(n=this._callbacks[e]);)s=u(n.sync,this,[e].concat(i)),r=u(n.async,this,[e].concat(i)),s()&&a(r);return this}};function i(t,e,n,i){var s;if(!n)return this;for(e=e.split(o),n=i?function(t,e){return t.bind?t.bind(e):function(){t.apply(e,[].slice.call(arguments,0))}}(n,i):n,this._callbacks=this._callbacks||{};s=e.shift();)this._callbacks[s]=this._callbacks[s]||{sync:[],async:[]},this._callbacks[s][t].push(n);return this}function u(i,s,r){return function(){for(var t,e=0,n=i.length;!t&&e