/*! For license information please see 897.93ac9b2b3ff8d5b338a4.js.LICENSE.txt */ (globalThis.blocksyJsonP=globalThis.blocksyJsonP||[]).push([[897],{123:function(e){"use strict";function t(e,r){for(var n,i=0,o=e.length;i1&&void 0!==arguments[1]?arguments[1]:{};const r=function(r){"modal"!==c({mode:"inline"},t).mode&&(e.contains(r.target)||m(e.querySelector(".ct-search-results")))},i=e.querySelector('input[type="search"]'),o=c({postType:"ct_forced_any",mode:"inline",perPage:5},t);if(!i)return;if(o.postType=e.querySelector('[name="post_type"]')?`ct_forced_${e.querySelector('[name="post_type"]').value}`:e.querySelector('[name="ct_post_type"]')?`ct_forced_${e.querySelector('[name="ct_post_type"]').value}`:"ct_forced_any",o.productPrice=!!e.querySelector('[name="ct_product_price"]')&&!!e.querySelector('[name="ct_product_price"]').value,!window.fetch)return;let s=v((function(t){if(document.removeEventListener("click",r),document.addEventListener("click",r),0!==t.target.value.trim().length)e.classList.add("ct-searching"),d(`${ct_localizations.rest_url}wp/v2/posts${ct_localizations.rest_url.indexOf("?")>-1?"&":"?"}_embed=1&post_type=${o.postType}&per_page=${o.perPage}&${"true"===o.productPrice||!0===o.productPrice?`product_price=${o.productPrice}&`:""}search=${t.target.value}`).then((function(r){let i=parseInt(r.headers.get("X-WP-Total"),10);(0,a.Xr)(ct_localizations.dynamic_styles.search_lazy).then((function(){r.json().then((function(r){if(u)return;e.classList.remove("ct-searching");let a=!!e.querySelector(".ct-search-results");u=!0;let s=e.querySelector(".ct-search-results"),{height:c}=s?s.getBoundingClientRect():0;s&&0!==t.target.value.trim().length&&0!==r.length?s&&e.removeChild(s):0!==t.target.value.trim().length&&0!==r.length||m(s);let l=ct_localizations.search_live_no_result;r.length>0&&t.target.value.trim().length>0&&(l=(r.length>1?ct_localizations.search_live_many_results:ct_localizations.search_live_one_result).replace("%s",r.length));let f=e.querySelector("[aria-live]");if(f&&(f.innerHTML=l),r.length>0&&t.target.value.trim().length>0){let s=(0,n.h)("div",{class:"ct-search-results",role:"listbox","aria-label":ct_localizations.search_live_results},r.map((function(t){return p({post:t,hasThumbs:(e.dataset.liveResults||"").indexOf("thumbs")>-1})})),i>o.perPage?(0,n.h)("a",{className:"ct-search-more",href:ct_localizations.search_url.replace(/QUERY_STRING/,t.target.value)},ct_localizations.show_more_text):[]);if(e.appendChild(s),a){let t=e.querySelector(".ct-search-results"),{height:r}=t.getBoundingClientRect();c!==r&&(t.style.height=`${c}px`,t.classList.add("ct-slide"),requestAnimationFrame((function(){t.style.height=`${r}px`,g(t,(function(){t.removeAttribute("style"),t.classList.remove("ct-slide")}))})))}else y(e.querySelector(".ct-search-results"));e.querySelector(".ct-search-more")&&e.querySelector(".ct-search-more").addEventListener("click",(function(t){t.preventDefault(),e.submit()})),window.scrollTo(0,0)}u=!1}))}))}));else{m(e.querySelector(".ct-search-results"));let t=e.querySelector("[aria-live]");t&&(t.innerHTML=ct_localizations.search_live_no_result)}}),200);i.addEventListener("input",s),"modal"===c({mode:"inline"},t).mode&&i.addEventListener("blur",(function(e){return setTimeout((function(){return s(e)}))})),i.addEventListener("focus",(function(e){s(e)})),i.value.length>0&&s({target:i})};function m(e){if(!e)return;let{height:t}=e.getBoundingClientRect();e.classList.add("ct-fade-leave"),e.style.height=`${t}px`,e.closest("form").classList.remove("ct-has-dropdown"),requestAnimationFrame((function(){e.classList.remove("ct-fade-leave"),e.classList.add("ct-fade-leave-active"),e.style.height=0,g(e,(function(){return e.parentNode&&e.parentNode.removeChild(e)}))}))}function g(e,t){const r=function(n){n.target===e&&(e.removeEventListener("transitionend",r),t())};e.addEventListener("transitionend",r)}function y(e){e.classList.add("ct-fade-enter");let{height:t}=e.getBoundingClientRect();e.classList.add("ct-fade-leave"),e.style.height=0,e.closest("form").classList.add("ct-has-dropdown"),requestAnimationFrame((function(){e.style.height=`${t}px`,e.classList.remove("ct-fade-enter"),e.classList.add("ct-fade-enter-active"),g(e,(function(){return e.removeAttribute("style")}))}))}function v(e,t){var r;return function(){if(!t)return e.apply(this,arguments);var n=this,i=arguments;clearTimeout(r),r=setTimeout((function(){return r=null,e.apply(n,i)}),t)}}function _(e){var t=[];if("object"==typeof e||"function"==typeof e){for(var r=Object.keys(e),n=r.length,i=0;i!a.includes(e))),c=(e,t,r)=>{null!=r&&(/^xlink[AHRST]/.test(t)?e.setAttributeNS("http://www.w3.org/1999/xlink",t.replace("xlink","xlink:").toLowerCase(),r):e.setAttribute(t,r))},l=(e,t,r)=>{const n=(e=>(e=>s.includes(e))(e)?document.createElementNS("http://www.w3.org/2000/svg",e):e===DocumentFragment?document.createDocumentFragment():document.createElement(e))(e);return Object.keys(t).forEach((e=>{const r=t[e];if("class"===e||"className"===e)c(n,"class",r);else if("style"===e)((e,t)=>{Object.keys(t).forEach((r=>{let n=t[r];"number"!=typeof n||o.test(r)||(n+="px"),e.style[r]=n}))})(n,r);else if(0===e.indexOf("on")){const t=e.slice(2).toLowerCase();n.addEventListener(t,r)}else"dangerouslySetInnerHTML"===e?n.innerHTML=r.__html:"key"!==e&&!1!==r&&c(n,e,!0===r?"":r)})),t.dangerouslySetInnerHTML||n.appendChild(r),n};function u(e,t){const r=[].slice.apply(arguments,[2]),n=document.createDocumentFragment();return i(r).forEach((e=>{e instanceof Node?n.appendChild(e):"boolean"!=typeof e&&null!=e&&n.appendChild(document.createTextNode(e))})),l(e,t||{},n)}const f={createElement:u,Fragment:"function"==typeof DocumentFragment?DocumentFragment:()=>{}};e.exports=f,e.exports.h=u,e.exports.default=f},979:function(e){"use strict";e.exports=JSON.parse('["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","animation","audio","canvas","circle","clipPath","color-profile","cursor","defs","desc","discard","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","handler","hatch","hatchpath","hkern","iframe","image","line","linearGradient","listener","marker","mask","mesh","meshgradient","meshpatch","meshrow","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","prefetch","radialGradient","rect","script","set","solidColor","solidcolor","stop","style","svg","switch","symbol","tbreak","text","textArea","textPath","title","tref","tspan","unknown","use","video","view","vkern"]')}}]); //# sourceMappingURL=897.93ac9b2b3ff8d5b338a4.js.map