1"use strict";(self.webpackChunkpixfort_core=self.webpackChunkpixfort_core||[]).push([[3283,6450],{5175(e,t,n){n.d(t,{default:()=>r});var o=n(9244),s=n(5886);function r(e){e.addClass("ajax-loaded");let t=e.closest(".pix-ajax-search-container"),n=e.closest(".pix-search-form"),r="",a=!0,i=-1,c=[];const d={name:"customPosition",enabled:!0,phase:"write",fn({state:e}){Object.assign(e.elements.popper.style,{transform:"none"})}},l=(0,o.Ay)(e[0],{content:"",allowHTML:!0,interactive:!0,trigger:"manual",placement:"bottom",maxWidth:"none",appendTo:t[0],popperOptions:{modifiers:[d,{name:"flip",options:{enabled:!1}},{name:"preventOverflow",options:{padding:{top:0,bottom:0,left:0,right:0}}},{name:"offset",options:{offset:[0,0]}}]}});function h(e){c=e,i=-1;const t=e.map((e,t)=>{const n=e.icon?`<img src="${e.icon}" alt=""> `:"";return`<div class="dropdown-item" data-id="${e.value}" data-index="${t}">${n}${e.text}</div>`}).join("");l.setContent(t),l.show()}function u(){$(".dropdown-item").removeClass("active"),i>=0&&i<c.length&&$(`.dropdown-item[data-index=${i}]`).addClass("active")}e.on("input",function(){const t=e.val();r!==t&&(r=t,t.length>1?s.default.makeRequest({action:"pix_ajax_search",nonceKey:"search_nonce",data:{term:t},method:"GET",success:function(e){if(e&&e.success&&e.data)h(e.data);else if(Array.isArray(e))h(e);else if("string"==typeof e)try{h(JSON.parse(e))}catch(e){console.error("Failed to parse search response:",e),l.hide()}else console.warn("Unexpected search response format:",e),l.hide()},error:function(e){console.error("Search suggestions error:",e),e&&e.responseJSON&&e.responseJSON.data&&e.responseJSON.data.message&&console.error("Server error:",e.responseJSON.data.message),l.hide()}}).catch(e=>{console.error("Search request failed:",e),l.hide()}):l.hide())}),t.on("click",".dropdown-item",function(e){e.preventDefault(),a=!1;const t=$(this).data("id");t&&(window.location.href=t)}),t.on("submit",function(e){a||e.preventDefault()}),n.on("submit",function(e){a||e.preventDefault()}),e.on("blur",function(){setTimeout(()=>{l.hide()},200)}),e.on("keydown",function(e){if("Enter"===e.key){if(i>=0&&i<c.length){e.preventDefault(),a=!1;const t=c[i].value;t&&(window.location.href=t)}}else"ArrowDown"===e.key?(e.preventDefault(),i=(i+1)%c.length,u()):"ArrowUp"===e.key&&(e.preventDefault(),i=(i-1+c.length)%c.length,u())})}},5886(e,t,n){n.d(t,{default:()=>s});const o=new class{constructor(){this.nonces={},this.isLoading=!1,this.loadingPromise=null,this.requestQueue=[],this.ajaxUrl=PIX_JS_OPTIONS.dataAjaxBase}async makeRequest(e){const{action:t,nonceKey:n,data:o={},url:s=this.ajaxUrl,method:r="GET",success:a,error:i,complete:c}=e;try{await this.ensureNoncesLoaded();const e=this.getNonce(n);if(!e)throw new Error(`Nonce not found for key: ${n}`);const i={action:t,nonce:e,...o},d=await this.performAjaxRequest({url:s,method:r,data:i});return a&&"function"==typeof a&&a(d),c&&"function"==typeof c&&c(d),d}catch(e){throw console.error("AJAX request failed:",e),i&&"function"==typeof i&&i(e),c&&"function"==typeof c&&c(null,e),e}}async ensureNoncesLoaded(){if(Object.keys(this.nonces).length>0)return Promise.resolve(this.nonces);if(this.isLoading&&this.loadingPromise)return this.loadingPromise;this.isLoading=!0,this.loadingPromise=this.fetchNonces();try{return await this.loadingPromise,this.nonces}finally{this.isLoading=!1,this.loadingPromise=null}}async fetchNonces(){try{const e=await this.performAjaxRequest({url:this.ajaxUrl,method:"GET",data:{action:"pix_get_nonces"}});if(e&&e.success&&e.data)return this.nonces=e.data,this.cacheNonces(e.data),this.nonces;throw new Error("Invalid nonces response format")}catch(e){throw console.error("Failed to fetch nonces:",e),e}}getNonce(e){return this.nonces[e]||null}cacheNonces(e){try{const t={nonces:e,timestamp:Date.now(),expiry:Date.now()+36e5};sessionStorage.setItem("pixfort_nonces",JSON.stringify(t))}catch(e){console.warn("Failed to cache nonces:",e)}}loadCachedNonces(){try{const e=sessionStorage.getItem("pixfort_nonces");if(!e)return!1;const t=JSON.parse(e);return Date.now()>t.expiry?(sessionStorage.removeItem("pixfort_nonces"),!1):(this.nonces=t.nonces,!0)}catch(e){return console.warn("Failed to load cached nonces:",e),sessionStorage.removeItem("pixfort_nonces"),!1}}performAjaxRequest(e){return new Promise((t,n)=>{if("undefined"!=typeof $&&$.ajax)$.ajax({url:e.url,type:e.method,data:e.data,dataType:"json",success:t,error:(e,t,o)=>{n(new Error(`AJAX Error: ${t} - ${o}`))}});else{const o=new FormData;
1Object.keys(e.data).forEach(t=>{o.append(t,e.data[t])}),fetch(e.url,{method:e.method,body:o,credentials:"same-origin"}).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);return e.json()}).then(t).catch(n)}})}clearCache(){this.nonces={};try{sessionStorage.removeItem("pixfort_nonces")}catch(e){console.warn("Failed to clear nonce cache:",e)}}async refreshNonces(){return this.clearCache(),this.ensureNoncesLoaded()}};o.loadCachedNonces(),window.pixAjaxRequest=function(e){return o.makeRequest(e)},window.pixRefreshNonces=function(){return o.refreshNonces()};const s=o}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.