1import{j as e,w as s,u as a,x as t,A as l,y as n,r as i,N as r,t as c,z as o,n as m}from"./bootstrap-YcGq5d07.js";import{r as d,u}from"./i18n-CBvvWIm0.js";import{u as h}from"./state-DCJ-GHTM.js";import{j as p,e as f}from"./index-BPdJYlZx.js";import"./phone-input-DMd9JE98.js";const v=({className:a="",options:t=[],selectedValues:l=[],name:n,onChange:i,required:r=!1})=>e.jsx("ul",{className:`${a}`,children:t?.map((t,c)=>{const{label:o,value:m}=t;return e.jsx("li",{className:`${a}-item`,children:e.jsx(s,{id:`${n}_${m}`,label:o,name:n,onChange:()=>(e=>{const s=l.includes(e.value.toString())?l.filter(s=>s!==e.value.toString()):[...l,e.value.toString()];i(s)})(t),checked:l.includes(m.toString()),required:r&&!l.length})},`${m}_${c}`)})}),x=({options:s,value:a,prevText:t,inline:l,onChange:n,className:i=""})=>{const[r,c]=d.useState(a||s[0].value);return d.useEffect(()=>{c(a||"")},[a]),e.jsxs("div",{className:`${l?"ms-sf-sortBy-select":"ms-sf-wrapper-select"} ${i}`,children:[l&&t&&e.jsxs("label",{className:"ms-sf-label",children:[t," ",e.jsx("strong",{children:s?.find(e=>e.value===r)?.label})]}),e.jsx("select",{className:"ms-sf-select",value:r,onChange:function(e){const s=e.target.value;c(s),n&&n(s)},children:s?.map(({value:s,label:a},t)=>e.jsx("option",{value:s,children:a},`${s}_${t}`))})]})},j=()=>{const{t:s}
1=u(),j=window.paramsMapSearch?.params?.name,b=h(),[N,g]=d.useState(!1),[w,S]=d.useState(null);a(N),d.useEffect(()=>{const e=e=>{const s=e.detail;s&&c()&&(S(s),g(!0))},s=()=>{g(!1),S(null)};return window.addEventListener(p,e),window.addEventListener(f,s),()=>{window.removeEventListener(p,e),window.removeEventListener(f,s)}},[b]);const y=document.getElementById("wpadminbar"),$=y?.offsetHeight,[C,E]=d.useState(!1),[k]=t(),[_,q]=d.useState(j||""),[B,L]=d.useState("1"),[I,T]=d.useState(l.map(({value:e})=>`${e}`)),D=d.useCallback(()=>{E(!1),setTimeout(()=>{n()},300)},[b]);if(d.useEffect(()=>{N&&setTimeout(()=>E(!0),100)},[N]),!N)return null;const F=document.getElementById("save-modal")||document.createElement("div");return F.id||(F.id="save-modal",document.body.appendChild(F)),i.createPortal(e.jsx("div",{className:"ms-sf-modal active "+(C?"in":""),tabIndex:-1,role:"dialog",id:"saveSearch",children:e.jsx("div",{className:"ms-sf-modal-dialog -sm",role:"document",children:e.jsxs("div",{className:"ms-sf-modal-content "+(C?"active":""),style:{top:$},children:[e.jsx("div",{className:"ms-sf-modal-header ms-sf-ct",children:e.jsx("div",{className:"ms-sf-flex",children:e.jsx("h5",{className:"ms-sf-title",children:s("Save Search")})})}),e.jsxs("div",{className:"ms-sf-modal-body ms-sf-ct",children:[e.jsx("div",{className:"ms-sf-paragraph",children:e.jsx("p",{children:s("You will receive automatic updates every time there are new listings and price reductions.")})}),e.jsx("div",{className:"ms-sf-form",children:e.jsxs("form",{className:"ms-sf-contact-form",onSubmit:async function(e){if(w)try{e.preventDefault();const s={searchName:_.trim(),notificationDay:B,alertOptions:I,...w},a=await k(s).unwrap();o("saved_searches"),D(),function(){q(j||""),L("1");const e=l.map(({value:e})=>`${e}`);T(e)}(),m({title:"Search Saved!",text:a.message,type:"success",timer:2e3})}catch(s){m({title:"Oops...",text:s.message,type:"error",showConfirmButton:!0})}},children:[e.jsxs("div",{className:"ms-sf-wrapper-input -full",children:[e.jsxs("label",{htmlFor:"ib-name-search",children:[s("Name Your Search"),"*"]}),e.jsx("input",{id:"ib-name-search",name:"search_name",type:"text",placeholder:s("Enter a search name"),value:_,required:!0,onChange:({target:e})=>q(e.value||"")})]}),e.jsxs("div",{className:"ms-sf-wrapper-input -full",children:[e.jsx("label",{htmlFor:"ib-notification-day",children:s("Email Updates")}),e.jsx(x,{options:r.map(({label:e,value:a})=>({label:s(e),value:a})),value:B,onChange:e=>L(`${e}`)})]}),e.jsx(v,{name:"alert-options",className:"ms-sf-chk-inner-list",options:l.map(({label:e,value:a})=>({label:s(e),value:a})),selectedValues:I,onChange:e=>T(e),required:!0}),e.jsx("div",{className:"ms-sf-wrapper-btn",children:e.jsx("button",{className:"ms-sf-btn -black -xl -full",type:"submit",children:s("Continue")})})]})})]}),e.jsx("button",{className:"ms-sf-btn -close-modal -circle -standard -sm js-close-st-modal","data-id":"#saveSearch",onClick:D,children:e.jsx("i",{className:"sf-icon-close"})})]})})}),F)};export{j 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.