1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2d555079-9e35-5b1e-9946-80ba3ad881ba")}catch(e){}}(); 3import{j as e,r as _,a as J}from"./constants-psci6gc1.js";import{R as Ae,l as Y,u as ee,i as ae,D as re,T as te}from"./useResponsiveClientValue-82rXJak1.js";import{e as w,F as X,T as K,g as Ie,G as oe,n as Pe,o as B,q as Te,r as we,s as Me,R as Oe,v as Ge,w as ze,M as De,x as Ue}from"./Header-BCtZByOG.js";import{h as ke,q as Ve,S as ne}from"./variants-BpGuSOo8.js";import{F as Be,a as M,A as U,B as W,u as $e,b as le,h as ie,c as He,d as qe,e as Qe,G as Ye,f as Xe,L as Z,U as Ke,g as k,i as We}from"./useHandleRegionSelection-DdVd9ket.js";import{p as Ze,V as h,T as L,D as Je,u as se,l as ea}from"./Link-BOm1qwNN.js";import{g as aa,u as O}from"./useLocale-BvOEoNgk.js";import{B as E,u as ra}from"./services-VIymWOJT.js";import{g as T}from"./FleamarketArticleStatusV2-jOKjdzCz.js";import{u as ta}from"./CurrentLocationButton-BS2xBd3x.js";import{C as oa}from"./Checkbox-Cu67QP-A.js";const na={jp:["0.0","500","1000","2000"],kr:["0.0","5000","10000","20000"],ca:["0.0","5","10","20"],us:["0.0","5","10","20"],uk:["0.0","5","10","20"]};function V(a,t){return{label:T(a,t),value:{from:"0",to:"0"},urlFriendlyValue:Be}}function la(a){const t=na[a];switch(a){case"jp":return t.map(r=>r==="0.0"?V(a,r):{label:`${T(a,r)} 以ä¸`,value:{from:"0",to:r},urlFriendlyValue:`0__${r}`});case"kr":return t.map(r=>r==="0.0"?V(a,r):{label:`${T(a,r)} ì´í`,value:{from:"0",to:r},urlFriendlyValue:`0__${r}`});case"ca":case"uk":default:return t.map(r=>r==="0.0"?V(a,r):{label:`Under ${T(a,r)}`,value:{from:"0",to:r},urlFriendlyValue:`0__${r}`})}}function ce({karrotLocalCountryCode:a}){const{t}=aa(Ze(a));return{sortOptions:[{label:t("AsideFilter.sort_filter_most_recent"),urlFriendlyValue:"recent"},{label:t("AsideFilter.sort_filter_hottest"),urlFriendlyValue:"hottest"}],priceOptions:la(a)}}function de({label:a,name:t,categoryFilterOptions:r,categoryId:u,onChange:i}){return e.jsx(M,{label:a,group:!0,children:e.jsx(Ae,{name:t,value:u||U,onChange:n=>i(n.value===U?"":n.value),children:e.jsxs(h,{gap:3,direction:"column",children:[e.jsx(Y,{value:U,"data-gtm":w.AllPageSearchFilter,children:e.jsx(L,{weight:"medium",children:"All Categories"})}),e.jsx(Je,{}),e.jsx(h,{gap:4,direction:"row",children:r.categories.map(n=>e.jsx(Y,{value:n.id.toString(),"data-gtm":w.AllPageSearchFilter,children:n.name},n.id))})]})})})}var ue="leynzi0",he="leynzi1",me="leynzi2",ge="leynzi3",pe="leynzi4",ia="i9lf1g0",sa="i9lf1g1",ca="i9lf1g2",da=ke({defaultClassName:"i9lf1g3",variantClassNames:{isValid:{true:"i9lf1g4",false:"i9lf1g5"}},defaultVariants:{},compoundVariants:[]});function fe({label:a,priceOptions:t,priceValue:r,onChange:u,onValidityChange:i}){var R,s;const{t:n}=O(),[m,S]=_.useState(!0),v=({priceValue:o})=>{const p=W.parse(o??""),f=p.from,x=p.to;return!(f!==void 0&&x!==void 0&&f>x)},y=o=>{const p=$e({prevPrice:r??"",target:o.name==="price-from"?"from":"to",value:o.value})??"";u(p);const f=v({priceValue:p});S(f),i==null||i(f)};_.useEffect(()=>{const o=v({priceValue:r});S(o),i==null||i(o)},[r,i]);const j=W.parse(r??"");return e.jsxs(M,{label:a,group:!0,className:ia,children:[e.jsx(h,{as:"ul",gap:2,direction:"row",children:t.map(o=>{const p=r===o.urlFriendlyValue;return e.jsx("li",{children:e.jsx(E,{color:"neutral",variant:"solid",size:"medium",rounded:!0,className:sa,attributes:{"data-gtm":w.AllPageSearchFilter,"data-selected":p},onClick:()=>u(o.urlFriendlyValue),children:o.label})},o.label)})}),e.jsxs(h,{"data-gtm":w.AllPageSearchFilter,paddingTop:3,gap:2,direction:"row",wrap:!1,align:"center",children:[e.jsxs(h,{gap:1,shrink:!0,grow:!0,children:[e.jsx(L,{variant:"caption-1",weight:"medium",color:"neutral-faded",children:"Minimum"}),e.jsx(X,{hasError:!m,children:e.jsx(K,{name:"price-from",placeholder:n("SearchFilterModal.price_filter_min_input_placeholder"),value:((R=j.from)==null?void 0:R.toString())??"",prefix:"$",variant:"outline",size:"medium",rounded:!0,onChange:y,inputAttributes:{inputMode:"numeric",pattern:"[0-9]*"}})})]}),e.jsx("div",{className:ca}),e.jsxs(h,{gap:1,shrink:!0,grow:!0,children:[e.jsx(L,{variant:"caption-1",weight:"medium",color:"neutral-faded",children:"Maximum"}),e.jsx(X,{hasError:!m,children:e.jsx(K,{name:"price-to",placeholder:n("SearchFilterModal.price_filter_max_input_placeholder"),value:((s=j.to)==null?void 0:s.toString())??"",prefix:"$",variant:"outline",size:"medium",rounded:!0,onChange:y,inputAttributes:{inputMode:"numeric",pattern:"[0-9]*"}})})]})]}),e.jsx(h,{direction:"row",justify:"space-between",align:"center",children:e.jsx(L,{className:da({isValid:m}),variant:"caption-1",weight:"medium",color:"critical",children:"Invalid price range"})})]})}const ua=/\/buy-sell\/all\/[^/]/;function ha(a){return ua.test(a)}function Se({pathname:a,karrotLocalCountryCode:t,hasSearchQuery:r}){const u=`/${t}${Ie.BUY_SELL}`;return r||ha(a)?u:a}function xe({label:a,name:t,value:r,onChange:u}){const{t:i}=O();return e.jsx(M,{label:a,group:!0,children:e.jsx(oa,{checked:r??!1,onChange:n=>u(n.checked),size:"medium",name:t,children:i("SearchFilterModal.only_on_sale")})})}const ma=5,ga=65;function Ea(a){if(!a.selectedFilterValues.h3Index)throw new Error("AuthModalSearchFilter: h3Index is required");return e.jsx(oe,{children:e.jsx(pa,{...a})})}function pa({selectedFilterValues:a,selectedLocation:t,categoryFilterOptions:r,open:u,onClose:i}){const{t:n}=O(),m=se(),{navigateToNormalizedUrl:S}=ee(),v=J(),[y,j]=_.useState(!0),R=ce({karrotLocalCountryCode:m.karrotLocalCountryCode}),{filterState:s,onChangeFilterState:o,onClearAll:p}=le({selectedFilterValues:a}),f=Number(s.h3RangeLevel??ma),x=Pe(a.h3Index),b=B(f,t.countryCode),F=Te(t.countryCode),G=c=>{var I;c.preventDefault(),a.h3RangeLevel!==s.h3RangeLevel&&te({distance:Number(s.h3RangeLevel),countryCode:m.karrotLocalCountryCode,serviceName:ne.BUY_SELL});const N=new URLSearchParams(He.fromFilterValuesToQueryString({filterValues:s}));N.sort();const A=!!((I=s.search)!=null&&I.trim()),z=Se({pathname:v.pathname,karrotLocalCountryCode:m.karrotLocalCountryCode,hasSearchQuery:A});S({pathname:z,queryString:`?${N.toString()}`}),i()};return e.jsx(ae,{size:"large",position:{s:"bottom",m:"center"},active:u,onClose:i,className:ue,children:e.jsxs("form",{onSubmit:G,className:me,role:"form","aria-label":n("SearchFilterModal.title"),children:[e.jsx(re,{onClose:i,closeAriaLabel:"Close modal",className:he,children:e.jsx(L,{variant:"featured-3",weight:"bold",color:"neutral",children:n("SearchFilterModal.title")})}),e.jsxs(h,{className:ge,children:[e.jsx(M,{group:!0,label:"Location",description:`Showing listing within ${F(f)} of ${t.name}`,children:e.jsxs(h,{paddingTop:3,gap:3,children:[e.jsx(h,{width:"100%",height:ga,borderRadius:"small",backgroundColor:"neutral-faded",overflow:"hidden",className:Ve,attributes:{onTouchMove:c=>c.stopPropagation(),onTouchEnd:c=>c.stopPropagation()},children:e.jsx(we,{reuseMaps:!0,center:x,zoom:b.zoom,gestureHandling:"none",clickableIcons:!1,zoomControl:!1,children:e.jsx(Me,{center:x,radius:b.radius,strokeColor:"#E14D00",strokeWeight:1,clickable:!1})})}),e.jsx(Oe,{name:"h3RangeLevel",value:f,onChange:c=>o({h3RangeLevel:c.toString()}),displayRangeLevel:F})]})}),e.jsx(xe,{label:"Status",name:"onlyOnSale",value:s.onlyOnSale,onChange:c=>o({onlyOnSale:c})}),e.jsx(de,{label:n("SearchFilterModal.category_filter_header"),name:"category",categoryFilterOptions:r,categoryId:s.categoryId,onChange:c=>o({categoryId:c})}),e.jsx(fe,{label:n("SearchFilterModal.price_filter_header"),priceOptions:R.priceOptions,priceValue:s.price,onChange:c=>o({price:c}),onValidityChange:j})]}),e.jsxs(h,{className:pe,paddingTop:4,direction:"row",justify:"space-between",width:"100%",children:[e.jsx(E,{color:ie(s)?"primary":"neutral",variant:"ghost",size:"large",onClick:p,children:"Clear all"}),e.jsx(E,{type:"submit",color:"primary",variant:"solid",size:"large",disabled:!y,children:"Show items"})]})]})})}function Na(a){return e.jsx(oe,{children:e.jsx(fa,{...a})})}function fa({selectedLocation:a,selectedFilterValues:t,categoryFilterOptions:r,lockSearchLocation:u,open:i,onClose:n}){const{t:m}=O(),S=se(),{navigateToNormalizedUrl:v}=ee(),y=J(),[j,R]=_.useState(!0),s=qe(),{value:o,cameraProps:p,circleCenter:f,hideCircleDuringDrag:x,error:b,isSyncing:F,onCameraChange:G,onDragEnd:c,changeZoom:N,reset:A,setByRegionSelection:z}=Ge({locationName:a.name,countryCode:a.countryCode,h3Index:t.h3Index,zoom:B(Number(t.h3RangeLevel),a.countryCode).zoom,formattedAddress:a.formattedAddress,locality:a.locality},{reverseGeocode:s,lockSearchLocation:u}),I=ce({karrotLocalCountryCode:S.karrotLocalCountryCode}),{filterState:g,onChangeFilterState:C,onClearAll:ve}=le({selectedFilterValues:t}),$=Qe({fallbackCountryCode:a.countryCode,rangeLevel:Number(g.h3RangeLevel),onChangeFilterState:C,setByRegionSelection:z}),D=ra(),[ye,H]=_.useState(!1),{geolocation:je,isLoading:Re,getGeolocation:Ce,unsetGeolocation:_e}=ta({onSuccess:async l=>{H(!0);try{const d=await s(l),P=d?ze({formatted_address:d.formattedAddress,address_components:d.addressComponents},l):null;if(!P){D.error({text:Z});return}$(P)}catch(d){console.error("[UnauthModalSearchFilter] reverseGeocode failed",d),D.error({text:Z})}finally{H(!1)}},onError:l=>{const d=l.code===GeolocationPositionError.PERMISSION_DENIED?Ye:Xe;D.error({text:d})}}),Le=Re||ye;_.useEffect(()=>{if(!i){const l=setTimeout(()=>{A(),_e()},De);return()=>clearTimeout(l)}},[i]);const be=l=>{u||C({h3Index:Ue(l.detail.center)}),G(l)},Fe=l=>{C({h3RangeLevel:l.toString()}),N(B(l,a.countryCode).zoom)},q=g.h3Index!==o.h3Index||F,Ee=l=>{var Q;if(l.preventDefault(),q)return;t.h3RangeLevel!==g.h3RangeLevel&&te({distance:Number(g.h3RangeLevel),countryCode:S.karrotLocalCountryCode,serviceName:ne.BUY_SELL});const d=new URLSearchParams(k.fromFilterValuesToQueryString({filterValues:{...g,h3Index:o.h3Index}}));o.formattedAddress?d.set("search_address",o.formattedAddress):d.delete("search_address"),We(o.locality)?d.set("locality",o.locality):d.delete("locality"),d.sort();const P=!!((Q=g.search)!=null&&Q.trim()),Ne=Se({pathname:y.pathname,karrotLocalCountryCode:S.karrotLocalCountryCode,hasSearchQuery:P});v({pathname:Ne,queryString:`?${d.toString()}`}),n()};return e.jsx(ae,{position:{s:"bottom",m:"center"},active:i,onClose:n,size:"large",className:ue,children:e.jsxs("form",{onSubmit:Ee,className:me,role:"form","aria-label":m("SearchFilterModal.title"),children:[e.jsx(re,{onClose:n,closeAriaLabel:"Close modal",className:he,children:e.jsx(L,{variant:"featured-3",weight:"bold",color:"neutral",children:m("SearchFilterModal.title")})}),e.jsxs(h,{className:ge,children:[e.jsx(Ke,{label:"Location",value:{...o,h3RangeLevel:Number(g.h3RangeLevel)},cameraProps:p,circleCenter:f,hideCircleDuringDrag:x,error:b,isSyncing:F,onChangeRangeLevel:Fe,onCameraChange:be,onDragEnd:c,onSelectRegion:$,onRequestCurrentLocation:Ce,geolocation:je,isGeolocationLoading:Le,reset:A}),e.jsx(xe,{label:"Status",name:"onlyOnSale",value:g.onlyOnSale,onChange:l=>C({onlyOnSale:l})}),e.jsx(de,{label:m("SearchFilterModal.category_filter_header"),name:"category",categoryFilterOptions:r,categoryId:g.categoryId,onChange:l=>C({categoryId:l})}),e.jsx(fe,{label:m("SearchFilterModal.price_filter_header"),priceOptions:I.priceOptions,priceValue:g.price,onChange:l=>C({price:l}),onValidityChange:R})]}),e.jsxs(h,{className:pe,paddingTop:4,direction:"row",justify:"space-between",width:"100%",children:[e.jsx(E,{color:ie(g)?"primary":"neutral",variant:"ghost",size:"large",onClick:ve,children:"Clear all"}),e.jsx(E,{type:"submit",color:"primary",variant:"solid",size:"large",disabled:!j||k.fromFilterValuesToQueryString({filterValues:{...g,h3Index:o.h3Index}})===k.fromFilterValuesToQueryString({filterValues:t})||!ea.isNil(b)||q,children:"Show items"})]})]})})}export{Ea as A,xe as S,Na as U,ca as a,ce as g,sa as p}; 4//# sourceMappingURL=UnauthModalSearchFilter-CAt_G5fu.js.map 5
6//# debugId=2d555079-9e35-5b1e-9946-80ba3ad881ba
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.