PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | dist/js/comments-script.js +1 -1 4.5.05.3.5 View file →
@@ -1 +1 @@
1 -!function(){"use strict";window.wp.hooks;const e=(e,t)=>{for(;(e=e.parentElement)&&!e.classList.contains(t););return e},t=document.querySelectorAll(".ep-widget-search-comments");let n;t.forEach((e=>{const{id:t}=e,n=document.createElement("input");n.setAttribute("autocomplete","off"),n.setAttribute("type","search"),n.setAttribute("class","ep-widget-search-comments-input"),n.setAttribute("id",`${t}-s`);const s=document.createElement("ul");s.setAttribute("class","ep-widget-search-comments-results"),e.appendChild(n),e.appendChild(s)}));const s=[38,40,13];function i(t){n=void 0;const s=e(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");for(;s.firstChild;)s.removeChild(s.firstChild)}function o(e){const t=window.epc.minimumLengthToSearch||2;return e?.value?.trim().length>=t}function c(t,n){const s=e(n,"ep-widget-search-comments");t?s.classList.add("ep-widget-search-comments-is-loading"):s.classList.remove("ep-widget-search-comments-is-loading")}const r=((e,t)=>{let n=null;return function(...s){const i=this;window.clearTimeout(n),n=window.setTimeout((()=>{e.apply(i,s)}),t)}})((function(t){if(o(t)){const n=e(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-post-type"),s=n?.value?`&post_type=${n.value.trim()}`:"";return c(!0,t),fetch(`${window.epc.restApiEndpoint}?s=${t.value.trim()}${s}`).then((e=>{if(!e.ok)throw e;return e.json()})).then((n=>{0===Object.keys(n).length?t.value.trim()?(t=>{const n=e(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");let s=`<li class="ep-widget-search-comments-result-item-not-found">${window.epc.noResultsFoundText}</li>`;"undefined"!==typeof window.epCommentWidgetItemNotFoundHTMLFilter&&(s=window.epCommentWidgetItemNotFoundHTMLFilter(s,window.epc.noResultsFoundText,t.value)),n.innerHTML=s})(t):i(t):((t,n)=>{let s="",i="";Object.keys(t).forEach(((e,o)=>{t[e]?.content&&t[e]?.link&&(i=`\n\t\t\t\t<li class="ep-widget-search-comments-result-item">\n\t\t\t\t\t<a href="${t[e].link}">\n\t\t\t\t\t\t${t[e].content}\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t\t`,"undefined"!==typeof window.epCommentWidgetItemHTMLFilter&&(i=window.epCommentWidgetItemHTMLFilter(i,t[e],o,n.value)),s+=i)}));const o=e(n,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");"undefined"!==typeof window.epCommentWidgetItemsHTMLFilter&&(s=window.epCommentWidgetItemsHTMLFilter(s,n.value)),o.innerHTML=s})(n,t)})).catch((()=>{i(t)})).finally((()=>{c(!1,t)}))}return!1}),500),d=t=>{t.preventDefault();const{target:c,key:d,keyCode:l}=t;if("Escape"===d||"Esc"===d||27===l)return i(c),void c.setAttribute("aria-expanded",!1);s.includes(l)&&""!==c.value?(t=>{if(!s.includes(t.keyCode))return;const i=e(t.target,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results"),o=i.querySelectorAll(".ep-widget-search-comments-result-item").length,c=i.children,r=n;switch(t.keyCode){case 38:n=n-1<0||"undefined"===typeof n?o-1:n-1;break;case 40:"undefined"===typeof n||n+1>o-1?n=0:n+=1;break;case 13:if(c[n]?.classList.contains("selected")||1===o){const e=n||0;if(c[e]){const t=c[e].querySelector("a")?.getAttribute("href");window.location.href=t}}}"number"===typeof r&&(c[r].classList.remove("selected"),c[r].setAttribute("aria-selected","false")),c[n]?.classList.add("selected"),c[n]?.setAttribute("aria-selected","true")})(t):o(c)?r(c):i(c)};t.forEach((e=>{const t=e.querySelector(".ep-widget-search-comments-input");t.addEventListener("keyup",d),t.addEventListener("keydown",(e=>{38===e.keyCode&&e.preventDefault()})),t.addEventListener("blur",(function(){setTimeout((()=>i(t)),200)}))}))}();
1 +!function(){"use strict";var t={9306:function(t,e,n){var r=n(4901),o=n(6823),i=TypeError;t.exports=function(t){if(r(t))return t;throw new i(o(t)+" is not a function")}},6469:function(t,e,n){var r=n(8227),o=n(2360),i=n(4913).f,c=r("unscopables"),u=Array.prototype;void 0===u[c]&&i(u,c,{configurable:!0,value:o(null)}),t.exports=function(t){u[c][t]=!0}},8551:function(t,e,n){var r=n(34),o=String,i=TypeError;t.exports=function(t){if(r(t))return t;throw new i(o(t)+" is not an object")}},9617:function(t,e,n){var r=n(5397),o=n(5610),i=n(6198),c=function(t){return function(e,n,c){var u=r(e),a=i(u);if(0===a)return!t&&-1;var s,f=o(c,a);if(t&&n!==n){for(;a>f;)if((s=u[f++])!==s)return!0}else for(;a>f;f++)if((t||f in u)&&u[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:c(!0),indexOf:c(!1)}},2195:function(t,e,n){var r=n(9504),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},7740:function(t,e,n){var r=n(9297),o=n(5031),i=n(7347),c=n(4913);t.exports=function(t,e,n){for(var u=o(e),a=c.f,s=i.f,f=0;f<u.length;f++){var p=u[f];r(t,p)||n&&r(n,p)||a(t,p,s(e,p))}}},6699:function(t,e,n){var r=n(3724),o=n(4913),i=n(6980);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},6980:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},6840:function(t,e,n){var r=n(4901),o=n(4913),i=n(283),c=n(9433);t.exports=function(t,e,n,u){u||(u={});var a=u.enumerable,s=void 0!==u.name?u.name:e;if(r(n)&&i(n,s,u),u.global)a?t[e]=n:c(e,n);else{try{u.unsafe?t[e]&&(a=!0):delete t[e]}catch(t){}a?t[e]=n:o.f(t,e,{value:n,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return t}},9433:function(t,e,n){var r=n(4576),o=Object.defineProperty;t.exports=function(t,e){try{o(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},3724:function(t,e,n){var r=n(9039);t.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:function(t,e,n){var r=n(4576),o=n(34),i=r.document,c=o(i)&&o(i.createElement);t.exports=function(t){return c?i.createElement(t):{}}},8727:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2839:function(t,e,n){var r=n(4576).navigator,o=r&&r.userAgent;t.exports=o?String(o):""},9519:function(t,e,n){var r,o,i=n(4576),c=n(2839),u=i.process,a=i.Deno,s=u&&u.versions||a&&a.version,f=s&&s.v8;f&&(o=(r=f.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&c&&(!(r=c.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=c.match(/Chrome\/(\d+)/))&&(o=+r[1]),t.exports=o},6518:function(t,e,n){var r=n(4576),o=n(7347).f,i=n(6699),c=n(6840),u=n(9433),a=n(7740),s=n(2796);t.exports=function(t,e){var n,f,p,l,d,v=t.target,m=t.global,y=t.stat;if(n=m?r:y?r[v]||u(v,{}):r[v]&&r[v].prototype)for(f in e){if(l=e[f],p=t.dontCallGetSet?(d=o(n,f))&&d.value:n[f],!s(m?f:v+(y?".":"#")+f,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;a(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),c(n,f,l,t)}}},9039:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},616:function(t,e,n){var r=n(9039);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},9565:function(t,e,n){var r=n(616),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},350:function(t,e,n){var r=n(3724),o=n(9297),i=Function.prototype,c=r&&Object.getOwnPropertyDescriptor,u=o(i,"name"),a=u&&"something"===function(){}.name,s=u&&(!r||r&&c(i,"name").configurable);t.exports={EXISTS:u,PROPER:a,CONFIGURABLE:s}},9504:function(t,e,n){var r=n(616),o=Function.prototype,i=o.call,c=r&&o.bind.bind(i,i);t.exports=r?c:function(t){return function(){return i.apply(t,arguments)}}},7751:function(t,e,n){var r=n(4576),o=n(4901);t.exports=function(t,e){return arguments.length<2?(n=r[t],o(n)?n:void 0):r[t]&&r[t][e];var n}},5966:function(t,e,n){var r=n(9306),o=n(4117);t.exports=function(t,e){var n=t[e];return o(n)?void 0:r(n)}},4576:function(t,e,n){var r=function(t){return t&&t.Math===Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:function(t,e,n){var r=n(9504),o=n(8981),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},421:function(t){t.exports={}},397:function(t,e,n){var r=n(7751);t.exports=r("document","documentElement")},5917:function(t,e,n){var r=n(3724),o=n(9039),i=n(4055);t.exports=!r&&!o((function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7055:function(t,e,n){var r=n(9504),o=n(9039),i=n(2195),c=Object,u=r("".split);t.exports=o((function(){return!c("z").propertyIsEnumerable(0)}))?function(t){return"String"===i(t)?u(t,""):c(t)}:c},3706:function(t,e,n){var r=n(9504),o=n(4901),i=n(7629),c=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return c(t)}),t.exports=i.inspectSource},1181:function(t,e,n){var r,o,i,c=n(8622),u=n(4576),a=n(34),s=n(6699),f=n(9297),p=n(7629),l=n(6119),d=n(421),v="Object already initialized",m=u.TypeError,y=u.WeakMap;if(c||p.state){var h=p.state||(p.state=new y);h.get=h.get,h.has=h.has,h.set=h.set,r=function(t,e){if(h.has(t))throw new m(v);return e.facade=t,h.set(t,e),e},o=function(t){return h.get(t)||{}},i=function(t){return h.has(t)}}else{var g=l("state");d[g]=!0,r=function(t,e){if(f(t,g))throw new m(v);return e.facade=t,s(t,g,e),e},o=function(t){return f(t,g)?t[g]:{}},i=function(t){return f(t,g)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!a(e)||(n=o(e)).type!==t)throw new m("Incompatible receiver, "+t+" required");return n}}}},4901:function(t){var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},2796:function(t,e,n){var r=n(9039),o=n(4901),i=/#|\.prototype\./,c=function(t,e){var n=a[u(t)];return n===f||n!==s&&(o(e)?r(e):!!e)},u=c.normalize=function(t){return String(t).replace(i,".").toLowerCase()},a=c.data={},s=c.NATIVE="N",f=c.POLYFILL="P";t.exports=c},4117:function(t){t.exports=function(t){return null===t||void 0===t}},34:function(t,e,n){var r=n(4901);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},6395:function(t){t.exports=!1},757:function(t,e,n){var r=n(7751),o=n(4901),i=n(1625),c=n(7040),u=Object;t.exports=c?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,u(t))}},6198:function(t,e,n){var r=n(8014);t.exports=function(t){return r(t.length)}},283:function(t,e,n){var r=n(9504),o=n(9039),i=n(4901),c=n(9297),u=n(3724),a=n(350).CONFIGURABLE,s=n(3706),f=n(1181),p=f.enforce,l=f.get,d=String,v=Object.defineProperty,m=r("".slice),y=r("".replace),h=r([].join),g=u&&!o((function(){return 8!==v((function(){}),"length",{value:8}).length})),b=String(String).split("String"),w=t.exports=function(t,e,n){"Symbol("===m(d(e),0,7)&&(e="["+y(d(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!c(t,"name")||a&&t.name!==e)&&(u?v(t,"name",{value:e,configurable:!0}):t.name=e),g&&n&&c(n,"arity")&&t.length!==n.arity&&v(t,"length",{value:n.arity});try{n&&c(n,"constructor")&&n.constructor?u&&v(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=p(t);return c(r,"source")||(r.source=h(b,"string"==typeof e?e:"")),t};Function.prototype.toString=w((function(){return i(this)&&l(this).source||s(this)}),"toString")},741:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},2360:function(t,e,n){var r,o=n(8551),i=n(6801),c=n(8727),u=n(421),a=n(397),s=n(4055),f=n(6119),p="prototype",l="script",d=f("IE_PROTO"),v=function(){},m=function(t){return"<"+l+">"+t+"</"+l+">"},y=function(t){t.write(m("")),t.close();var e=t.parentWindow.Object;return t=null,e},h=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}h="undefined"!=typeof document?document.domain&&r?y(r):function(){var t,e=s("iframe"),n="java"+l+":";return e.style.display="none",a.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(m("document.F=Object")),t.close(),t.F}():y(r);for(var t=c.length;t--;)delete h[p][c[t]];return h()};u[d]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(v[p]=o(t),n=new v,v[p]=null,n[d]=t):n=h(),void 0===e?n:i.f(n,e)}},6801:function(t,e,n){var r=n(3724),o=n(8686),i=n(4913),c=n(8551),u=n(5397),a=n(1072);e.f=r&&!o?Object.defineProperties:function(t,e){c(t);for(var n,r=u(e),o=a(e),s=o.length,f=0;s>f;)i.f(t,n=o[f++],r[n]);return t}},4913:function(t,e,n){var r=n(3724),o=n(5917),i=n(8686),c=n(8551),u=n(6969),a=TypeError,s=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",d="writable";e.f=r?i?function(t,e,n){if(c(t),e=u(e),c(n),"function"===typeof t&&"prototype"===e&&"value"in n&&d in n&&!n[d]){var r=f(t,e);r&&r[d]&&(t[e]=n.value,n={configurable:l in n?n[l]:r[l],enumerable:p in n?n[p]:r[p],writable:!1})}return s(t,e,n)}:s:function(t,e,n){if(c(t),e=u(e),c(n),o)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new a("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},7347:function(t,e,n){var r=n(3724),o=n(9565),i=n(8773),c=n(6980),u=n(5397),a=n(6969),s=n(9297),f=n(5917),p=Object.getOwnPropertyDescriptor;e.f=r?p:function(t,e){if(t=u(t),e=a(e),f)try{return p(t,e)}catch(t){}if(s(t,e))return c(!o(i.f,t,e),t[e])}},8480:function(t,e,n){var r=n(1828),o=n(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},3717:function(t,e){e.f=Object.getOwnPropertySymbols},1625:function(t,e,n){var r=n(9504);t.exports=r({}.isPrototypeOf)},1828:function(t,e,n){var r=n(9504),o=n(9297),i=n(5397),c=n(9617).indexOf,u=n(421),a=r([].push);t.exports=function(t,e){var n,r=i(t),s=0,f=[];for(n in r)!o(u,n)&&o(r,n)&&a(f,n);for(;e.length>s;)o(r,n=e[s++])&&(~c(f,n)||a(f,n));return f}},1072:function(t,e,n){var r=n(1828),o=n(8727);t.exports=Object.keys||function(t){return r(t,o)}},8773:function(t,e){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);e.f=o?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},4270:function(t,e,n){var r=n(9565),o=n(4901),i=n(34),c=TypeError;t.exports=function(t,e){var n,u;if("string"===e&&o(n=t.toString)&&!i(u=r(n,t)))return u;if(o(n=t.valueOf)&&!i(u=r(n,t)))return u;if("string"!==e&&o(n=t.toString)&&!i(u=r(n,t)))return u;throw new c("Can't convert object to primitive value")}},5031:function(t,e,n){var r=n(7751),o=n(9504),i=n(8480),c=n(3717),u=n(8551),a=o([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=i.f(u(t)),n=c.f;return n?a(e,n(t)):e}},7750:function(t,e,n){var r=n(4117),o=TypeError;t.exports=function(t){if(r(t))throw new o("Can't call method on "+t);return t}},6119:function(t,e,n){var r=n(5745),o=n(3392),i=r("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},7629:function(t,e,n){var r=n(6395),o=n(4576),i=n(9433),c="__core-js_shared__",u=t.exports=o[c]||i(c,{});(u.versions||(u.versions=[])).push({version:"3.39.0",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(t,e,n){var r=n(7629);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},4495:function(t,e,n){var r=n(9519),o=n(9039),i=n(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol("symbol detection");return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},5610:function(t,e,n){var r=n(1291),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},5397:function(t,e,n){var r=n(7055),o=n(7750);t.exports=function(t){return r(o(t))}},1291:function(t,e,n){var r=n(741);t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},8014:function(t,e,n){var r=n(1291),o=Math.min;t.exports=function(t){var e=r(t);return e>0?o(e,9007199254740991):0}},8981:function(t,e,n){var r=n(7750),o=Object;t.exports=function(t){return o(r(t))}},2777:function(t,e,n){var r=n(9565),o=n(34),i=n(757),c=n(5966),u=n(4270),a=n(8227),s=TypeError,f=a("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,a=c(t,f);if(a){if(void 0===e&&(e="default"),n=r(a,t,e),!o(n)||i(n))return n;throw new s("Can't convert object to primitive value")}return void 0===e&&(e="number"),u(t,e)}},6969:function(t,e,n){var r=n(2777),o=n(757);t.exports=function(t){var e=r(t,"string");return o(e)?e:e+""}},6823:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},3392:function(t,e,n){var r=n(9504),o=0,i=Math.random(),c=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+c(++o+i,36)}},7040:function(t,e,n){var r=n(4495);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:function(t,e,n){var r=n(3724),o=n(9039);t.exports=r&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8622:function(t,e,n){var r=n(4576),o=n(4901),i=r.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},8227:function(t,e,n){var r=n(4576),o=n(5745),i=n(9297),c=n(3392),u=n(4495),a=n(7040),s=r.Symbol,f=o("wks"),p=a?s.for||s:s&&s.withoutSetter||c;t.exports=function(t){return i(f,t)||(f[t]=u&&i(s,t)?s[t]:p("Symbol."+t)),f[t]}},4423:function(t,e,n){var r=n(6518),o=n(9617).includes,i=n(9039),c=n(6469);r({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),c("includes")}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}();n(4423),window.wp.hooks;const r=(t,e)=>{for(;(t=t.parentElement)&&!t.classList.contains(e););return t},o=document.querySelectorAll(".ep-widget-search-comments");let i;o.forEach((t=>{const{id:e}=t,n=document.createElement("input");n.setAttribute("autocomplete","off"),n.setAttribute("type","search"),n.setAttribute("class","ep-widget-search-comments-input"),n.setAttribute("id",`${e}-s`);const r=document.createElement("ul");r.setAttribute("class","ep-widget-search-comments-results"),t.appendChild(n),t.appendChild(r)}));const c=[38,40,13];function u(t){i=void 0;const e=r(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");for(;e.firstChild;)e.removeChild(e.firstChild)}function a(t){const e=window.epc.minimumLengthToSearch||2;return t?.value?.trim().length>=e}function s(t,e){const n=r(e,"ep-widget-search-comments");t?n.classList.add("ep-widget-search-comments-is-loading"):n.classList.remove("ep-widget-search-comments-is-loading")}const f=((t,e)=>{let n=null;return function(...r){const o=this;window.clearTimeout(n),n=window.setTimeout((()=>{t.apply(o,r)}),e)}})((function(t){if(a(t)){const e=r(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-post-type"),n=e?.value?`&post_type=${e.value.trim()}`:"";return s(!0,t),fetch(`${window.epc.restApiEndpoint}?s=${t.value.trim()}${n}`).then((t=>{if(!t.ok)throw t;return t.json()})).then((e=>{0===Object.keys(e).length?t.value.trim()?(t=>{const e=r(t,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");let n=`<li class="ep-widget-search-comments-result-item-not-found">${window.epc.noResultsFoundText}</li>`;"undefined"!==typeof window.epCommentWidgetItemNotFoundHTMLFilter&&(n=window.epCommentWidgetItemNotFoundHTMLFilter(n,window.epc.noResultsFoundText,t.value)),e.innerHTML=n})(t):u(t):((t,e)=>{let n="",o="";Object.keys(t).forEach(((r,i)=>{t[r]?.content&&t[r]?.link&&(o=`\n\t\t\t\t<li class="ep-widget-search-comments-result-item">\n\t\t\t\t\t<a href="${t[r].link}">\n\t\t\t\t\t\t${t[r].content}\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t\t`,"undefined"!==typeof window.epCommentWidgetItemHTMLFilter&&(o=window.epCommentWidgetItemHTMLFilter(o,t[r],i,e.value)),n+=o)}));const i=r(e,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results");"undefined"!==typeof window.epCommentWidgetItemsHTMLFilter&&(n=window.epCommentWidgetItemsHTMLFilter(n,e.value)),i.innerHTML=n})(e,t)})).catch((()=>{u(t)})).finally((()=>{s(!1,t)}))}return!1}),500),p=t=>{t.preventDefault();const{target:e,key:n,keyCode:o}=t;if("Escape"===n||"Esc"===n||27===o)return u(e),void e.setAttribute("aria-expanded",!1);c.includes(o)&&""!==e.value?(t=>{if(!c.includes(t.keyCode))return;const e=r(t.target,"ep-widget-search-comments").querySelector(".ep-widget-search-comments-results"),n=e.querySelectorAll(".ep-widget-search-comments-result-item").length,o=e.children,u=i;switch(t.keyCode){case 38:i=i-1<0||"undefined"===typeof i?n-1:i-1;break;case 40:"undefined"===typeof i||i+1>n-1?i=0:i+=1;break;case 13:if(o[i]?.classList.contains("selected")||1===n){const t=i||0;if(o[t]){const e=o[t].querySelector("a")?.getAttribute("href");window.location.href=e}}}"number"===typeof u&&(o[u].classList.remove("selected"),o[u].setAttribute("aria-selected","false")),o[i]?.classList.add("selected"),o[i]?.setAttribute("aria-selected","true")})(t):a(e)?f(e):u(e)};o.forEach((t=>{const e=t.querySelector(".ep-widget-search-comments-input");e.addEventListener("keyup",p),e.addEventListener("keydown",(t=>{38===t.keyCode&&t.preventDefault()})),e.addEventListener("blur",(function(){setTimeout((()=>u(e)),200)}))}))}();