1(()=>{window.addEventListener("DOMContentLoaded",()=>{let u=(e,o=document)=>o.querySelector(e),_=(e,o,n)=>e.addEventListener(o,n),k=u("#wc-shipping-sim");if(!k)return;let f=u("#wc-shipping-sim-form"),d=JSON.parse(f.dataset.params),s=u(".input-postcode",f),m=u(".button.submit",f),v=u("#wc-shipping-sim-results"),p=e=>e,t={...d,requesting:!1,hooks:{filterFormData:p,filterXHR:p,filterResults:p,filterProduct:p,filterQuantity:p,filterPostcodeMaxLength:()=>t.postcode_mask?t.postcode_mask.length:15,beforeSubmit:e=>{t.hooks.resultsHandler(""),s.disabled=!0,m.classList.add("loading")},afterSubmit:e=>{s.disabled=!1,m.classList.remove("loading")},resultsHandler:e=>{v.ariaBusy=e?"false":"true",v.innerHTML=e},errorHandler:(e,o)=>{alert(e||t.errors.unexpected),console.error("wc-shipping-simulator request error:",o)},submitHandler:e=>{if(e.preventDefault(),t.requesting)return;let o=g();if(o.id===0)return;t.requesting=!0;let n=o.variation_id?"&variation_id="+o.variation_id:"",a=b(),h=t.hooks.filterFormData(`action=${d.ajax_action}&postcode=${s.value}&product_id=${o.id}&quantity=${a>=1?a:1}${n}`),r=new XMLHttpRequest;r.open("POST",d.ajax_url,!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.timeout=+t.timeout||0,r.onload=()=>{t.requesting=!1,t.hooks.afterSubmit(r);try{let i=JSON.parse(r.responseText);if(i.success){let l=t.hooks.filterResults(i.results_html?i.results_html:"");t.hooks.resultsHandler(l)}else t.hooks.errorHandler(i.error,i)}catch(i){t.hooks.errorHandler(null,i)}},r.ontimeout=()=>{t.requesting=!1,t.hooks.afterSubmit(r),t.hooks.errorHandler(t.errors.timeout,"timeout")},r=t.hooks.filterXHR(r),t.hooks.beforeSubmit(r),r.send(h)},inputMaskHandler:()=>{if(s.maxLength=t.hooks.filterPostcodeMaxLength(),t.postcode_mask){let o=function(n,a,h="X"){if(!a)return n;let r="",i=(n+"").replace(/[^0-9]/g,"");for(let l=0,c=0,w=a.length;l<w&&i[c];l++)h===a[l]?(r+=i[c],c++):(r+=a[l]||"",c=c>0?c--:0);return r};var e=o;_(s,"input",n=>{let a=t.postcode_mask;s.value=o(s.value||"",a),s.maxLength=t.postcode_mask.length}),s.dispatchEvent(new Event("input"))}}}};window.wc_shipping_simulator=t,document.dispatchEvent(new Event("wc_shipping_simulator:init")),k.style.display=t.root_display,t.hooks.inputMaskHandler&&t.hooks.inputMaskHandler(),_(f,"submit",t.hooks.submitHandler),t.auto_submit&&t.postcode_mask&&_(s,"input",e=>{let o=t.hooks.filterPostcodeMaxLength();o>0&&s.value.length===o&&(s.blur(),m.click())});function g(){let e={type:d.product_type,id:d.product_id};if(e.type==="variable"){let o=u(".variations_form .variation_id");if(e.variation_id=o?o.value:0,t.requires_variation&&!e.variation_id){let n=wc_add_to_cart_variation_params?wc_add_to_cart_variation_params.i18n_make_a_selection_text:"";t.hooks.errorHandler(n,"no_variation_selected"),e.id=0}}return t.hooks.filterProduct(e)}function b(){let e=1,o=u('.cart [name="quantity"]');return o&&(e=o.value),t.hooks.filterQuantity(+e||1)}});})();
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.