PageSourceSearch

https://www.nathab.com/_astro/index.astro_astro_type_script_index_0_lang.L_2Gzd4_.js

js nathab.com collected 2026-10-02 02:33:07 UTC 6,397 bytes, 1 lines download raw bytes

1import{a as e,i as t,l as n,o as r,u as i}from"./gear-cart.MhPa_a-6.js";var a=null,o=null;function s(){let e=document.querySelector(`[data-gear-minicart]`),n=document.querySelector(`[data-gear-minicart-close]`),i=document.querySelector(`[data-gear-minicart-backdrop]`);if(!e)return;window.location.pathname.startsWith(`/gear-store/checkout`)&&e.querySelector(`[data-gear-cart-checkout]`)?.setAttribute(`hidden`,``),document.addEventListener(`gear-minicart:open`,()=>c(e));let a=document.querySelector(`[data-gear-nav-cart]`);a&&a.addEventListener(`click`,()=>{e.hidden?c(e):l(e)}),n?.addEventListener(`click`,()=>l(e)),i?.addEventListener(`click`,()=>l(e)),document.addEventListener(`keydown`,t=>{t.key===`Escape`&&!e.hidden&&l(e)}),e.addEventListener(`keydown`,u),document.addEventListener(`gear-cart:updated`,t=>{t.detail!==o&&g(t.detail,e)});let s=r();s&&d(s.total_quantity??0),t().then(e=>{e&&d(e.total_quantity??0)}).catch(()=>{})}function c(e){a=document.activeElement,e.hidden=!1,document.body.style.overflow=`hidden`,e.querySelector(`[data-gear-minicart-close]`)?.focus(),t().then(t=>{t?g(t,e):h(e)}).catch(()=>{h(e)})}function l(e){e.hidden=!0,document.body.style.overflow=``,a instanceof HTMLElement&&a.focus()}function u(e){if(e.key!==`Tab`)return;let t=document.querySelector(`[data-gear-minicart]`);if(!t||t.hidden)return;let n=Array.from(t.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.closest(`[hidden]`));if(!n.length)return;let r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus())}function d(e){let t=document.querySelector(`[data-gear-cart-badge]`);if(!t)return;t.textContent=String(e),t.hidden=e===0;let n=document.querySelector(`[data-gear-nav-cart]`);n&&n.setAttribute(`aria-label`,`Cart, ${e} item${e===1?``:`s`}`)}function f(e,t){let n=e.querySelector(`[data-gear-cart-count]`);n&&(n.textContent=`(${t})`);let r=e.querySelector(`[data-gear-cart-count-sr]`);r&&(r.textContent=`, ${t} item${t===1?``:`s`}`)}function p(){let e=document.getElementById(`gear-cart-subtotal-value`)?.textContent.trim();return e?` Subtotal ${e}.`:``}function m(e){let t=document.getElementById(`gear-cart-announce`);t&&(t.textContent=``,requestAnimationFrame(()=>{t.textContent=e}))}function h(e){e.dataset.empty=`true`,d(0),f(e,0);let t=document.getElementById(`gear-cart-subtotal-value`);t&&(t.textContent=``)}function g(t,n){o=t;let r=t.items??[],i=t.total_quantity??0;n.dataset.empty=r.length===0?`true`:`false`,d(i),f(n,i);let a=r.reduce((e,t)=>e+(t.prices?.row_total?.value??0),0),s=t.prices?.grand_total?.currency??`USD`,c=document.getElementById(`gear-cart-subtotal-value`);c&&(c.textContent=e(a,s));let l=document.getElementById(`gear-cart-items`);l&&(l.innerHTML=``,r.forEach(t=>{let r=t.product?.small_image,i=t.configurable_options??[],a=t.prices?.row_total,o=a?e(a.value,a.currency):``,s=i.map(e=>`${e.option_label}: ${e.value_label}`).join(`, `),c=t.product?.name??`Product`,u=document.createElement(`li`);if(u.classList.add(`gear-cart-item`),u.setAttribute(`data-gear-cart-item`,``),u.dataset.uid=t.uid,r?.url){let e=document.createElement(`img`);e.classList.add(`gear-item-image`),e.src=r.url,e.alt=``,e.loading=`lazy`,e.width=72,e.height=72,u.appendChild(e)}else{let e=document.createElement(`div`);e.classList.add(`gear-item-image-placeholder`),e.setAttribute(`aria-hidden`,`true`),e.textContent=c.charAt(0),u.appendChild(e)}let d=document.createElement(`div`);d.classList.add(`gear-item-info`);let f=document.createElement(`p`);if(f.classList.add(`gear-item-name`),f.textContent=c,d.appendChild(f),s){let e=document.createElement(`p`);e.classList.add(`gear-item-options`),e.textContent=s,d.appendChild(e)}u.appendChild(d);let p=document.createElement(`div`);p.classList.add(`gear-item-controls`);let m=document.createElement(`div`);m.classList.add(`gear-item-qty`);let h=document.createElement(`button`);h.type=`button`,h.dataset.qtyAction=`minus`,h.setAttribute(`aria-label`,t.quantity<=1?`Remove ${c} from cart`:`Decrease quantity of ${c}`),h.innerHTML=`<span aria-hidden="true">−</span>`,h.addEventListener(`click`,()=>v(t,t.quantity-1,n));let g=document.createElement(`span`),_=document.createElement(`span`);_.className=`sr-only`,_.textContent=`Quantity `,g.appendChild(_),g.appendChild(document.createTextNode(String(t.quantity)));let b=document.createElement(`button`);b.type=`button`,b.dataset.qtyAction=`plus`,b.setAttribute(`aria-label`,`Increase quantity of ${c}`),b.innerHTML=`<span aria-hidden="true">+</span>`,b.addEventListener(`click`,()=>v(t,t.quantity+1,n)),m.appendChild(h),m.appendChild(g),m.appendChild(b);let x=document.createElement(`span`);x.classList.add(`gear-item-price`),x.textContent=o;let S=document.createElement(`button`);S.type=`button`,S.classList.add(`gear-item-remove`),S.setAttribute(`data-gear-item-remove`,``),S.setAttribute(`aria-label`,`Remove ${c} from cart`),S.innerHTML=`<svg aria-hidden="true" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5 1h4M1 4h12M2.5 4l1 10h7l1-10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>`,S.addEventListener(`click`,()=>y(t,n)),p.appendChild(m),p.appendChild(x),u.appendChild(p),u.appendChild(S),l.appendChild(u)}))}function _(e,t,n){let r=e.querySelector(`[data-gear-cart-item][data-uid="${CSS.escape(t)}"]`),i=r?.querySelector(`[data-qty-action="${n}"]`);
1((i&&!i.disabled?i:r?.querySelector(`[data-qty-action]:not([disabled])`)??r?.querySelector(`[data-gear-item-remove]`))??e.querySelector(`[data-gear-minicart-close]`))?.focus()}async function v(e,t,n){if(t<1)return y(e,n);let r=t>e.quantity?`plus`:`minus`;try{let a=await i(e.uid,t);a&&(g(a,n),_(n,e.uid,r),m(`${e.product?.name??`Item`} quantity updated to ${t}.${p()}`),document.dispatchEvent(new CustomEvent(`gear-cart:updated`,{detail:a})))}catch{}}async function y(e,t){try{let r=await n(e.uid),i=e.product?.name??`Item`;r?(g(r,t),(t.querySelector(`[data-gear-item-remove]`)??t.querySelector(`[data-gear-minicart-close]`))?.focus(),m(`${i} removed from cart.${p()}`),document.dispatchEvent(new CustomEvent(`gear-cart:updated`,{detail:r}))):(h(t),t.querySelector(`[data-gear-minicart-close]`)?.focus(),m(`${i} removed. Your cart is empty.`))}catch{}}typeof window<`u`&&s();

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.