PageSourceSearch

https://thekrazycouponlady.com/_astro/index.DX67s13n.js

js thekrazycouponlady.com collected 2026-10-01 10:18:02 UTC 10,941 bytes, 1 lines download raw bytes

1import{j as l}from"./jsx-runtime.D_zvdyIk.js";import{c as q}from"./index.FLHzWaeL.js";import{r}from"./index.DBbMZl2G.js";import{u as X,F as Z}from"./useScrollLock.BhcTGkzx.js";import{u as V}from"./index.B557SFQm.js";import{S as Q}from"./CloseX.CzLDPrlx.js";import{a as J,r as ee,t as te,g as re,f as N,S as se,V as oe,b as ne,u as ae,c as H,d as ce,s as w,e as ie,h as ue,i as le,j as de}from"./MagnifyingGlass.EPajfuaS.js";import{s as g}from"./index.1e6d4bcc.CW2leDJl.js";import{S as pe}from"./Spinner.araYerp0.js";import{u as fe}from"./useHasMounted.BIOoKhBm.js";import{m as U}from"./pageRegionModuleHelpers.HSKw6600.js";import{M as K}from"./PageRegionModuleTaxonomy.CqpbxftK.js";import{a as me,n as he,t as ye,T as Se,b as ge}from"./typewriterConfig.C9e9Sx01.js";import{t as B}from"./safe.DWHhN48L.js";import{Z as j,S as F}from"./zones.BemwU2uA.js";import{s as Ee}from"./index.CbUm5JID.js";import{u as ve}from"./scrollLock.JNeR8LWR.js";import{u as be}from"./useOnClickOutside.Chbu_W1T.js";import{S as k}from"./sanitizeSearchTerm.Bv-P2ojH.js";import{u as Re}from"./userStore.fsk2SzIk.js";import{g as xe}from"./_commonjsHelpers.D6-XlEtG.js";import{v as we}from"./v4.BKrj-4V8.js";import"./index.DdhaQPQ0.js";import"./index.Bfoz6rCN.js";import"./splide.esm.B7IEmT1H.js";import"./splide-extension-grid.esm.BDPLTlrJ.js";import"./ArrowLeft.DLZluvTH.js";import"./ArrowRight.BSwE5eXz.js";/* empty css                       */import"./index.49c3845b.CBmMJc1L.js";import"./Image.C4nCYzEY.js";import"./resolve.B3WuOKFk.js";import"./useScreenSize.BJle2WJo.js";import"./getScreenSize.CnXIUdNe.js";import"./customMedia.TddthWa7.js";import"./impressions.model.D7dMMwUg.js";import"./index.e46269b7.mdzBFhTy.js";import"./Link.D0-cxjzP.js";import"./filters.B3NckLWN.js";import"./isExternal.pyCLhaOv.js";import"./index.DVwZf235.js";import"./preload-helper.BlTxHScW.js";import"./constants.Cv_77uZs.js";/* empty css                       */import"./SquircleClip.DwIllFWs.js";import"./resolveStoreTiles.Cnd4UG6S.js";import"./DrinkerClient.D43oG_2z.js";import"./index.BBhcORMm.js";import"./UserCacheManager.DGF2RrpP.js";import"./dayjs.gtnaJZnM.js";import"./utc.D8ANpP3u.js";import"./relativeTime.D_y5ur43.js";import"./expiry.Dnak9uun.js";import"./IndexedDBManager.aNAd28ay.js";import"./index.D1sA79gK.js";import"./index.CDAgpjSw.js";import"./subidTransformer.D67TlOXC.js";import"./getFeatureFlagClient.CFsM0M_T.js";import"./impressionsStore.C0MRAWlD.js";const P="search-typeahead-listbox",Ce=({searchResults:c,trimmedValue:t,loading:o,onSelect:n,onSubmitQuery:p,inputRef:u})=>{const d=fe(),i=V(J),f=r.useMemo(()=>ee(c,t).filter(s=>te(re(s)??"",t)),[c,t]),y=r.useMemo(()=>N(f,t),[f,t]),E=s=>{if(s.key!=="ArrowDown"&&s.key!=="ArrowUp")return;const m=Array.from(s.currentTarget.querySelectorAll('[role="option"]')),v=m.indexOf(document.activeElement);v!==-1&&(s.preventDefault(),s.key==="ArrowDown"?m[v+1]?.focus():v===0?u.current?.focus():m[v-1]?.focus())},S=f.length+1,a=!d||o?"":f.length===0?`No matching suggestions. Press return to search for ${t}.`:`${S} result${S===1?"":"s"} available.`;return l.jsx("div",{className:g.searchPrimaryRow,...U(K.SEARCH_SUGGESTIONS),children:l.jsxs("div",{className:q(g.searchSuggestions,g.searchSuggestionsTypeahead),children:[l.jsx("div",{className:g.srOnly,role:"status","aria-live":"polite","aria-atomic":"true",children:a}),o?l.jsx(pe,{}):d&&l.jsxs("ul",{id:P,role:"listbox","aria-label":"Search suggestions",className:g.searchCardList,"data-testid":"search-suggestions-list",onKeyDown:E,children:[f.map((s,m)=>l.jsx(se,{result:s,contentType:i,onSelect:n,showReturnHint:s===y,isListboxOption:!0,onShiftTabBack:m===0?()=>u.current?.focus():void 0},typeof s=="string"?`term-${s}`:`result-${s.url||s.title}`)),l.jsx(oe,{query:t,contentType:i,onSubmit:p,showReturnHint:!y,isListboxOption:!0,onShiftTabBack:f.length===0?()=>u.current?.focus():void 0})]})]})})};function Te(c,t,o=!0){const[n,p]=r.useState(me),u=t.join("|");return r.useEffect(()=>{if(!o||t.length===0)return;const{state:d,delay:i}=he(n,t),f=setTimeout(()=>p(d),i);return()=>clearTimeout(f)},[n,u,o]),ye(n,c,t)}const ke="_row_shuhi_1",Ae="_icon_shuhi_6",_e="_input_shuhi_15",je="_inputError_shuhi_44",C={row:ke,icon:Ae,input:_e,inputError:je},Ne=r.forwardRef(function({hasError:t=!1,placeholder:o,animatePlaceholder:n=!0,...p},u){const d=Te(ge,Se,n);return l.jsxs("div",{className:C.row,children:[l.jsx(ne,{className:C.icon,width:21,height:21,"aria-hidden":"true"}),l.jsx("input",{ref:u,className:`${C.input} ${t?C.inputError:""}`,placeholder:o??d,autoComplete:"off",...p})]})});var T={exports:{}},$;function Pe(){if($)return T.exports;$=1;function c(t,o=100,n={}){if(typeof t!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);if(o<0)throw new RangeError("`wait` must not be negative.");const{immediate:p}=typeof n=="boolean"?{immediate:n}:n;let u,d,i,f,y;function E(){const s=u,m=d;return u=void 0,d=void 0,y=t.apply(s,m),y}function S(){const s=Date.now()-f;s<o&&s>=0?i=setTimeout(S,o-s):(i=void 0,p||(y=E()))}const a=function(...s){if(u&&this!==u&&Object.getPrototypeOf(this)===Object.getPrototypeOf(u))throw new Error("Debounced method called with different c
1ontexts of the same prototype.");u=this,d=s,f=Date.now();const m=p&&!i;return i||(i=setTimeout(S,o)),m&&(y=E()),y};return Object.defineProperty(a,"isPending",{get(){return i!==void 0}}),a.clear=()=>{i&&(clearTimeout(i),i=void 0)},a.flush=()=>{i&&a.trigger()},a.trigger=()=>{y=E(),a.clear()},a}return T.exports.debounce=c,T.exports=c,T.exports}var Ie=Pe();const Le=xe(Ie),Oe=["diaper","laundry","Tide","shampoo","coffee","Dove","CoverGirl"],I=3,De=50,Me=(c,t)=>{switch(t.type){case"loading":return{...c,loading:!0};case"success":return{...c,loading:!1,error:null,searchResults:t.results,resolvedValue:t.value};case"error":return{...c,loading:!1,error:t.error};case"updateSearchValue":return{...c,searchValue:t.searchValue};case"idle":return{...c,loading:!1}}},L=c=>{const t=c.trim().length;return t>=I&&t<=De},He=(c,t="")=>{const[o,n]=r.useReducer(Me,{loading:!1,error:null,searchValue:t.slice(0,k),searchResults:Oe,resolvedValue:null}),p=r.useRef(0),u=r.useCallback(async S=>{const a=++p.current;n({type:"loading"});try{const s=await c.searchLandingPages(S);if(a!==p.current)return;n({type:"success",results:s,value:S})}catch(s){if(a!==p.current)return;n({type:"error",error:s})}},[c]),d=r.useCallback(Le(u,600),[u]);r.useEffect(()=>()=>{d.clear?.()},[d]);const i=r.useRef(!1);r.useEffect(()=>{i.current||L(t)&&(i.current=!0,u(t.trim()))},[t,u]);const f=r.useCallback(S=>{let a=S.target.value;a.length>k&&(a=a.slice(0,k)),a.endsWith(".")&&(a=a.replace(/\.{2,}/g," ")),n({type:"updateSearchValue",searchValue:a}),L(a)?(n({type:"loading"}),d(a.trim())):(p.current++,d.clear?.(),n({type:"idle"}))},[d]),y=r.useCallback(()=>{p.current++,d.clear?.(),n({type:"updateSearchValue",searchValue:""}),n({type:"idle"})},[d]),E=o.searchValue.trim();return{...o,trimmedValue:E,clearSearchValue:y,inputProps:{value:o.searchValue,onChange:f}}},Ut=({initialValue:c="",startCollapsed:t=!1}={})=>{const[o,n]=r.useState(!t),p=r.useRef(null),u=r.useRef(null);X(o,{pinHeader:!0}),r.useLayoutEffect(()=>{if(!o)return;const e=()=>{const h=p.current,b=u.current;if(!h||!b)return;const W=Math.max(0,Math.round(h.getBoundingClientRect().bottom));b.style.setProperty("--search-bar-offset",`${W}px`)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[o]);const d=V(Re),i=r.useRef(null),f=r.useRef(!1),y=r.useRef(!1);r.useEffect(()=>{if(t)return;const e=i.current;if(!e)return;e.focus({preventScroll:!0});const h=e.value.length;e.setSelectionRange(h,h)},[t]);const{addSearchTerm:E}=ae(d.user),{searchResults:S,inputProps:a,loading:s,trimmedValue:m,clearSearchValue:v,resolvedValue:O}=He(w,c);r.useEffect(()=>{m!==c.trim()&&(y.current=!0)},[m,c]);const D=m.length>=I,A=o&&D,_=r.useCallback(async(e,h)=>{f.current=!0;const b=we();Ee({searchTerm:e,searchText:e}),await B(ce,H({zone:j.FREEFORM,subZone:F.FREEFORM_INPUT,surface:"empty_state",search:e,type:h?"store":"keyword",queryId:b}),void 0,300),h?await w.navigateToSearchResult(h,E):await w.navigateToSearchResult(e,E,ie(),"freeform",b)},[E]),Y=r.useCallback(async e=>{let h=N(S,e);if(!h&&O!==e&&L(e))try{h=N(await w.searchLandingPages(e),e)}catch{}await _(e,h)},[S,O,_]),M=ue(E,{zone:j.SUGGESTED,subZone:F.AUTOCOMPLETE,surface:"empty_state"}),z=r.useCallback(async e=>{f.current=!0,await M(e)},[M]),x=r.useCallback(()=>{!f.current&&y.current&&m.length>=I&&B(le,H({zone:j.FREEFORM,search:m}),void 0,300)},[m]),R=r.useCallback(()=>{x(),n(!1),v();const e=document.getElementById("search-bar");e&&(e.dataset.open==="true"&&ve(),delete e.dataset.open,e.style.display="none",document.querySelector(".navigation-header")?.classList.remove("nav-search-open"))},[x,v]);r.useEffect(()=>{document.getElementById("search-bar")?.dataset.open==="true"&&(n(!0),i.current?.focus({preventScroll:!0}))},[]),r.useEffect(()=>{const e=()=>{n(!0)},h=()=>{x(),n(!1),v()};return document.addEventListener("kcl:search-bar-opened",e),document.addEventListener("kcl:search-bar-closed",h),()=>{document.removeEventListener("kcl:search-bar-opened",e),document.removeEventListener("kcl:search-bar-closed",h)}},[x,v]);const G=r.useCallback(()=>{o&&R()},[o,R]);return be(p,G),l.jsx("div",{ref:p,id:"searchBar",className:q(g.searchMain,{[g.collapsed]:!o}),"data-testid":"search-main",children:l.jsxs(Z,{disabled:!o,returnFocus:{preventScroll:!0},className:g.searchFocusLock,children:[l.jsx("div",{className:g.searchBarContainer,children:l.jsxs("div",{className:g.searchBar,"data-testid":"search-placeholder",...
1U(K.SEARCH),children:[l.jsx(Ne,{ref:i,type:"text","data-testid":"search-input",animatePlaceholder:o,"aria-label":"Search",role:"combobox","aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":A,"aria-controls":A?P:void 0,maxLength:k,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",...a,onFocus:()=>n(!0),onKeyDown:e=>{if(e.nativeEvent.isComposing||e.key==="Process")return;if(e.key==="Escape"){R();return}if(e.key==="ArrowDown"&&A){e.preventDefault(),document.getElementById(P)?.querySelector('[role="option"]')?.focus();return}if(e.key===" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){e.stopPropagation();return}if(e.repeat||e.key!=="Enter")return;e.preventDefault();const b=e.currentTarget.value.trim();b&&Y(b)}}),l.jsx("div",{"data-testid":"search-close",onClick:()=>R(),className:g.searchClose,tabIndex:0,role:"button","aria-label":"Close search",onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&R()},children:l.jsx(Q,{width:22,height:22})})]})}),o&&l.jsx("div",{className:g.searchContent,ref:u,children:l.jsx("div",{className:g.searchContainer,children:D?l.jsx(Ce,{searchResults:S,trimmedValue:m,loading:s,onSelect:z,onSubmitQuery:_,inputRef:i}):l.jsx(de,{})})})]})})};export{Ut as default};

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.