/* * # Fomantic UI - 2.9.2 * https://github.com/fomantic/Fomantic-UI * https://fomantic-ui.com/ * * Copyright 2023 Contributors * Released under the MIT license * https://opensource.org/licenses/MIT * */ !function(F,k,D){"use strict";function E(e){return"function"==typeof e&&"number"!=typeof e.nodeType}k=void 0!==k&&k.Math===Math?k:globalThis,F.fn.search=function(R){var S,x=F(this),C=x.selector||"",w=Date.now(),T=[],A=R,j="string"==typeof A,q=[].slice.call(arguments,1);return x.each(function(){var d=F.isPlainObject(R)?F.extend(!0,{},F.fn.search.settings,R):F.extend({},F.fn.search.settings),f=d.className,c=d.metadata,r=d.regExp,i=d.fields,g=d.selector,h=d.error,e=d.namespace,n="."+e,t=e+"-module",v=F(this),p=v.find(g.prompt),s=v.find(g.searchButton),a=v.find(g.results),o=v.find(g.result),u=(v.find(g.category),this),l=v.data(t),m=!1,y=!1,b={initialize:function(){b.verbose("Initializing module"),b.get.settings(),b.determine.searchFields(),b.bind.events(),b.set.type(),b.create.results(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),l=b,v.data(t,b)},destroy:function(){b.verbose("Destroying instance"),v.off(n).removeData(t)},refresh:function(){b.debug("Refreshing selector cache"),p=v.find(g.prompt),s=v.find(g.searchButton),v.find(g.category),a=v.find(g.results),o=v.find(g.result)},refreshResults:function(){a=v.find(g.results),o=v.find(g.result)},bind:{events:function(){b.verbose("Binding events to search"),d.automatic&&(v.on(b.get.inputEvent()+n,g.prompt,b.event.input),p.attr("autocomplete",b.is.chrome()?"fomantic-search":"off")),v.on("focus"+n,g.prompt,b.event.focus).on("blur"+n,g.prompt,b.event.blur).on("keydown"+n,g.prompt,b.handleKeyboard).on("click"+n,g.searchButton,b.query).on("mousedown"+n,g.results,b.event.result.mousedown).on("mouseup"+n,g.results,b.event.result.mouseup).on("click"+n,g.result,b.event.result.click)}},determine:{searchFields:function(){R&&void 0!==R.searchFields&&(d.searchFields=R.searchFields)}},event:{input:function(){d.searchDelay?(clearTimeout(b.timer),b.timer=setTimeout(function(){b.is.focused()&&b.query()},d.searchDelay)):b.query()},focus:function(){b.set.focus(),d.searchOnFocus&&b.has.minimumCharacters()&&b.query(function(){b.can.show()&&b.showResults()})},blur:function(e){function t(){b.cancel.query(),b.remove.focus(),b.timer=setTimeout(b.hideResults,d.hideDelay)}var s=D.activeElement===this;s||(y=!1,b.resultsClicked?(b.debug("Determining if user action caused search to close"),v.one("click.close"+n,g.results,function(e){b.is.inMessage(e)||m?p.trigger("focus"):(m=!1,b.is.animating()||b.is.hidden()||t())})):(b.debug("Input blurred without user action, closing results"),t()))},result:{mousedown:function(){b.resultsClicked=!0},mouseup:function(){b.resultsClicked=!1},click:function(e){b.debug("Search result selected");var t=F(this),s=t.find(g.title).eq(0),r=t.is("a[href]")?t:t.find("a[href]").eq(0),n=r.attr("href")||!1,i=r.attr("target")||!1,s=0=d.minCharacters},results:function(){return 0!==a.length&&""!==a.html()}},clear:{cache:function(e){var t=v.data(c.cache);e?t&&t[e]&&(b.debug("Removing value from cache",e),delete t[e],v.data(c.cache,t)):(b.debug("Clearing cache",e),v.removeData(c.cache))}},read:{cache:function(e){var t=v.data(c.cache);return!!d.cache&&(b.verbose("Checking cache for generated html for query",e),"object"==typeof t&&void 0!==t[e]&&t[e])}},create:{categoryResults:function(e){var s={};return F.each(e,function(e,t){t.category&&(void 0===s[t.category]?(b.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){var s,e=e+1;return void 0!==t?(t=String.fromCharCode(97+t),b.verbose("Creating category result id",s=t+e)):b.verbose("Creating result id",s=e),s},results:function(){0===a.length&&(a=F("
").addClass(f.results).appendTo(v))}},inject:{result:function(e,t,s){b.verbose("Injecting result into results");s=(void 0!==s?a.children().eq(s).children(g.results).first():a).children(g.result).eq(t);b.verbose("Injecting results metadata",s),s.data(c.result,e)},id:function(e){b.debug("Injecting unique ids into results");var s=0,r=0;return"category"===d.type?F.each(e,function(e,t){0 as a polyfill.'},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[$()*+./?[\\\]^{|}-]/g,beginsWith:"(?:\\s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(t)return e;var s={"<":"<",">":">",'"':""","'":"'","`":"`"};return/["&'<>`]/.test(e)?(e=e.replace(/&(?![\d#a-z]{1,12};)/gi,"&")).replace(/["'<>`]/g,function(e){return s[e]}):e},message:function(e,t,s){var r="";return void 0!==e&&void 0!==t&&(r+='
',s&&(r+='
'+s+"
"),r=r+'
'+e+"
"),r},category:function(e,s,r){var n="",i=F.fn.search.settings.templates.escape;return void 0!==e[s.categoryResults]&&(F.each(e[s.categoryResults],function(e,t){void 0!==t[s.results]&&0',void 0!==t[s.categoryName]&&(n+='
'+i(t[s.categoryName],r)+"
"),n+='
")}),e[s.action]&&(n+=!1===s.actionURL?'
'+i(e[s.action][s.actionText],r)+"
":''+i(e[s.action][s.actionText],r)+""),n)},standard:function(e,s,r){var n="",i=F.fn.search.settings.templates.escape;return void 0!==e[s.results]&&(F.each(e[s.results],function(e,t){n+=t[s.url]?'':'',void 0!==t[s.image]&&(n+='
'),n+='
',void 0!==t[s.price]&&(n+='
'+i(t[s.price],r)+"
"),void 0!==t[s.title]&&(n+='
'+i(t[s.title],r)+"
"),void 0!==t[s.description]&&(n+='
'+i(t[s.description],r)+"
"),n+="
"}),e[s.action]&&(n+=!1===s.actionURL?'
'+i(e[s.action][s.actionText],r)+"
":''+i(e[s.action][s.actionText],r)+""),n)}}},F.extend(F.easing,{easeOutExpo:function(e){return 1===e?1:1-Math.pow(2,-10*e)}})}(jQuery,window,document);