PageSourceSearch

https://markformelle.ru/_nuxt/z92UsTIY.js

js markformelle.ru collected 2026-09-28 12:12:40 UTC 11,840 bytes, 1 lines download raw bytes

1import{a as ke,_ as ee}from"./McOJ_zaG.js";import{o,c as a,b as t,d as ae,g as we,H as xe,h as ce,e as y,i as s,q as J,t as R,k as _,l as w,_ as be,ao as j,I as Ce,v as k,J as Se,M as Ee,a3 as $e,ad as Ie,y as te,w as G,a1 as Me,n as Be,p as z,m as P,S as Te,j as Le,R as se,F as E,r as L,P as oe,U as Re,x as He}from"./CBOi-qbM.js";import{_ as ze}from"./TBnvm7ao.js";import{b as ne,c as Pe}from"./DuiVvJta.js";import{j as Ve}from"./Dh3s8uo3.js";import"./DRsRgxdN.js";const Ae={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"};function De(u,e){return o(),a("svg",Ae,[...e[0]||(e[0]=[t("path",{fill:"currentColor",d:"M3 18H2V2h1zm4 0H5V2h2zm3 0H9V2h1zm2 0h-1V2h1zm3 0h-1V2h1zm3 0h-2V2h2z"},null,-1)])])}const le={render:De},Oe={class:"search-scanner"},qe={class:"search-scanner__viewport"},Fe={key:0,class:"search-scanner__error text-base"},Ne=ae({__name:"Scanner",emits:["decoded","close"],setup(u,{emit:e}){const x=e,l=w(null),i=w("");let h=null;function S(){h?.stop(),h=null}return we(async()=>{if(l.value)try{const{BrowserMultiFormatReader:m}=await xe(async()=>{const{BrowserMultiFormatReader:g}=await import("./C6AHlKYc.js");return{BrowserMultiFormatReader:g}},[],import.meta.url);h=await new m().decodeFromConstraints({video:{facingMode:"environment"}},l.value,g=>{g&&(S(),x("decoded",g.getText()))})}catch(m){i.value=m instanceof DOMException&&m.name==="NotAllowedError"?"Доступ к камере запрещён":"Камера недоступна"}}),ce(S),(m,f)=>(o(),a("div",Oe,[t("button",{type:"button",class:"search-scanner__toggle text-base",onClick:f[0]||(f[0]=g=>x("close"))},[y(s(le),{class:"search-scanner__toggle-icon"}),f[1]||(f[1]=J(" Скрыть сканер ",-1))]),t("div",qe,[t("video",{ref_key:"videoEl",ref:l,class:"search-scanner__video",muted:"",playsinline:"",autoplay:""},null,512),s(i)?(o(),a("p",Fe,R(s(i)),1)):_("",!0)])]))}}),Ue=be(Ne,[["__scopeId","data-v-d47d4bfc"]]),je={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32"};function Ge(u,e){return o(),a("svg",je,[...e[0]||(e[0]=[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",d:"M25.333 16H6.667M14.667 24l-8-8 8-8"},null,-1)])])}const Qe={render:Ge},Ke={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"};function Je(u,e){return o(),a("svg",Ke,[...e[0]||(e[0]=[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.333 14.167a5.833 5.833 0 1 0 0-11.667 5.833 5.833 0 0 0 0 11.667M12.5 12.5l5 5"},null,-1)])])}const Ye={render:Je},We={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"};function Xe(u,e){return o(),a("svg",We,[...e[0]||(e[0]=[t("path",{fill:"currentColor",d:"M10 1.667A8.333 8.333 0 0 1 18.333 10a8.333 8.333 0 1 1-16.666 0h1.666a6.667 6.667 0 1 0 1.154-3.75h2.18v1.667h-5v-5h1.666V5A8.32 8.32 0 0 1 10 1.667m.833 4.166v3.821l2.703 2.703-1.18 1.179-3.19-3.192v-4.51z"},null,-1)])])}const Ze={render:Xe},et={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"};function tt(u,e){return o(),a("svg",et,[...e[0]||(e[0]=[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11.667 12.5a.833.833 0 1 1 1.666 0 .833.833 0 0 1-1.666 0M6.667 12.5a.833.833 0 1 1 1.666 0 .833.833 0 0 1-1.666 0M11.667 7.5a.833.833 0 1 1 1.666 0 .833.833 0 0 1-1.666 0M6.667 7.5a.833.833 0 1 1 1.666 0 .833.833 0 0 1-1.666 0"},null,-1)])])}const st={render:tt},ot={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"};function nt(u,e){return o(),a("svg",ot,[...e[0]||(e[0]=[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",d:"M10 17.5s5.833-4.039 5.833-9.23c0-1.53-.614-2.998-1.708-4.08A5.87 5.87 0 0 0 10 2.5c-1.547 0-3.031.608-4.125 1.69a5.74 5.74 0 0 0-1.708 4.08C4.167 13.461 10 17.5 10 17.5"},null,-1),t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",d:"M10 9.167a1.667 1.667 0 1 0 0-3.334 1.667 1.667 0 0 0 0 3.334"},null,-1)])])}const rt={render:nt},Q={autocompleteV2:async u=>{const e=await j("/search/autocomplete/v2/",{query:{q:u}});return{...e,products:(e.products??[]).map(Ve)}},deleteHistoryItem:u=>j(`/search/history/${u}/`,{method:"DELETE"}),clearHistory:()=>j("/search/history/",{method:"DELETE"})},D={phrases:[],taps:[],categories:[],products:[],history:[],correction:"",mobileButtons:[]},at=250,ct=Ce("search",()=>{const u=w(""),e=w(D),x=w(!1),l=w(null);let i=null,h=0;const S=k(()=>e.value.products),m=k(()=>e.value.history),f=k(()=>e.value.mobileButtons??[]);async function g(d){const p=++h;x.value=!0;try{const v=await Q.autocompleteV2(d.trim());if(p!==h)return;e.value=v??D,l.value=null,v?.products?.length&&(Se().seedFromProducts(v.products),Ee().seedFromProducts(v.products),$e().searchProducts(v.products.map(H=>({id:H.id,price:H.price.current/100}))))}catch(v){if(p!==h)return;l.value=v instanceof Error?v.message:String(v),e.value=D}finally{p===h&&(x.value=!1)}}function O(d){u.value=d,i&&clearTimeout(i),i=setTimeout(()=>g(d),at)}function V(){u.value="",e.value=D,l.value=null,i&&(clearTimeout(i),i=null)}async function $(d){try{const p=await Q.deleteHistoryItem(d);e.value={...e.value,history:p.history}}catch(p){l.value=p instanceof Error?p.message:String(p)}}async function I(){try{const d=await Q.clearHistory();e.value={...e.value,history:d.history}}catch(d){l.value=d instanceof Error?d.message:String(d)}}return{query:u,result:e,loading:x,error:l,products:S,history:m,mobileButtons:f,load:g,setQuery:O,reset:V,deleteHistoryItem:$,clearHistory:I}}),lt={class:"search__panel"},it={class:"search__bar"},ut={class:"search__field"},dt=["value"],_t={key:1,class:"search__tags"},ht=["onClick"],vt={key:2,class:"search__body"},pt={class:"search__sidebar"},mt={key:0,class:"search__group"},ft={class:"search__group-head"},gt={class:"search__suggest-list"},yt=["onClick"],kt={class:"search__suggest-text"},wt=["onClick"],xt={key:1,class:"search__group"},bt={class:"search__suggest-list"},Ct=["onClick"],St={class:"search__suggest-text"},Et={key:2,class:"search__group search__group--categories"},$t={class:"search__suggest-list"},It={class:"search__suggest-text"},Mt={class:"search__content"},Bt={class:"search__products"},Tt={class:"search__more"},Lt={key:3,class:"search__actions"},Rt={class:"search__action-text"}
1,Ht=4,re="Результаты поиска",K=3,qt=ae({__name:"Search",setup(u){const e=Ie(),{current:x}=te(e),l=ct(),{query:i,result:h,products:S,history:m,mobileButtons:f}=te(l),g=ee,O={barcode:le,geo:rt};function V(c){return O[c]??null}function $(c){return!!c.url&&c.url!=="#"}const I=k(()=>x.value==="search"),d=k(()=>h.value.taps),p=k(()=>m.value.slice(0,K)),v=k(()=>h.value.phrases.slice(0,K)),H=k(()=>h.value.categories.slice(0,K)),q=k(()=>S.value.slice(0,Ht)),ie=He();let Y=null;G([I,q],([c,r])=>{!c||!r.length||Y===r||(Y=r,ie.viewItemList(r,re))});const{lock:ue,unlock:W}=Pe(),X=w(null),F=w(null),b=w(!1);let M=null;function N(){X.value?.focus()}function de(c){l.setQuery(c.target.value)}function _e(c){const r=`${i.value} ${c}`.trim().replace(/\s+/g," ");l.query=r,l.load(r),N()}function he(){l.reset(),l.load(""),N()}function U(c){const r=c.trim();r&&(window.location.href=`/search/?q=${encodeURIComponent(r)}`)}function A(){U(i.value)}function ve(c){if(c.svg==="barcode"){b.value=!0;return}$(c)&&B()}function pe(c){b.value=!1,l.query=c,A()}function B(){e.close()}const me=Me();G(()=>me.fullPath,()=>{I.value&&B()});function C(){if(typeof document>"u")return;const c=document.querySelector(".header")?.getBoundingClientRect();F.value=c&&Math.round(c.top)<0?0:null}return G(I,async c=>{if(c?ue():W(),c){C(),window.addEventListener("scroll",C,{passive:!0}),window.addEventListener("resize",C);const r=document.querySelector(".layout");r&&typeof ResizeObserver<"u"&&(M=new ResizeObserver(()=>C()),M.observe(r)),!S.value.length&&!i.value&&l.load(""),await Be(),N()}else window.removeEventListener("scroll",C),window.removeEventListener("resize",C),M?.disconnect(),M=null,l.reset(),b.value=!1},{immediate:!0}),ce(()=>{window.removeEventListener("scroll",C),window.removeEventListener("resize",C),M?.disconnect(),M=null,W()}),(c,r)=>{const Z=ke,fe=Ue,ge=ee,ye=ze;return o(),z(Re,{name:"search-fade",appear:""},{default:P(()=>[s(I)?(o(),a("div",{key:0,class:"search",style:Le(s(F)!==null?{top:`${s(F)}px`}:void 0),onClick:Te(B,["self"])},[t("div",lt,[t("div",it,[t("button",{type:"button",class:"search__back","aria-label":"Закрыть поиск",onClick:B},[y(s(Qe))]),t("div",ut,[t("input",{ref_key:"inputRef",ref:X,value:s(i),type:"text",class:"search__input text-large",placeholder:"Введите название, цвет или артикул","aria-label":"Поиск по сайту",autocomplete:"off",onInput:de,onKeydown:[se(A,["enter"]),se(B,["esc"])]},null,40,dt),s(i).length?(o(),a("button",{key:0,type:"button",class:"search__clear","aria-label":"Очистить",onClick:he},[y(s(ne))])):_("",!0),s(i).length?(o(),z(Z,{key:1,size:"xs",class:"search__submit",onClick:A},{default:P(()=>[...r[2]||(r[2]=[J(" Найти ",-1)])]),_:1})):_("",!0)]),t("button",{type:"button",class:"search__close link-base",onClick:B}," Закрыть ")]),s(b)?(o(),z(fe,{key:0,onDecoded:pe,onClose:r[0]||(r[0]=n=>b.value=!1)})):_("",!0),s(d).length&&!s(b)?(o(),a("div",_t,[(o(!0),a(E,null,L(s(d),n=>(o(),a("button",{key:n,type:"button",class:"search__tag text-base",onClick:T=>_e(n)},R(n),9,ht))),128))])):_("",!0),s(b)?_("",!0):(o(),a("div",vt,[t("aside",pt,[s(m).length?(o(),a("section",mt,[t("div",ft,[r[3]||(r[3]=t("h3",{class:"search__group-title text-base"},"История",-1)),t("button",{type:"button",class:"search__group-clear text-base",onClick:r[1]||(r[1]=n=>s(l).clearHistory())}," Очистить ")]),t("ul",gt,[(o(!0),a(E,null,L(s(p),n=>(o(),a("li",{key:n.id,class:"search__suggest-row"},[t("button",{type:"button",class:"search__suggest text-base",onClick:T=>U(n.phrase)},[y(s(Ze),{class:"search__suggest-icon"}),t("span",kt,R(n.phrase),1)],8,yt),t("button",{type:"button",class:"search__suggest-remove","aria-label":"Удалить из истории",onClick:T=>s(l).deleteHistoryItem(n.id)},[y(s(ne))],8,wt)]))),128))])])):_("",!0),s(v).length?(o(),a("section",xt,[r[4]||(r[4]=t("h3",{class:"search__group-title text-base"},"Часто ищут",-1)),t("ul",bt,[(o(!0),a(E,null,L(s(v),n=>(o(),a("li",{key:n},[t("button",{type:"button",class:"search__suggest text-base",onClick:T=>U(n)},[y(s(Ye),{class:"search__suggest-icon"}),t("span",St,R(n),1)],8,Ct)]))),128))])])):_("",!0),s(H).length?(o(),a("section",Et,[r[5]||(r[5]=t("h3",{class:"search__group-title text-base"},"Найти в категориях",-1)),t("ul",$t,[(o(!0),a(E,null,L(s(H),n=>(o(),a("li",{key:n.url},[y(ge,{to:n.url,class:"search__suggest text-base"},{default:P(()=>[y(s(st),{class:"search__suggest-icon"}),t("span",It,R(n.name),1)]),_:2},1032,["to"])]))),128))])])):_("",!0)]),t("div",Mt,[s(q).length?(o(),a(E,{key:0},[r[7]||(r[7]=t("h2",{class:"search__content-title title-2"},"Популярные товары",-1)),t("ul",Bt,[(o(!0),a(E,null,L(s(q),(n,T)=>(o(),a("li",{key:n.link,class:"search__product"},[y(ye,{product:n,"list-name":re,"list-index":T+1},null,8,["product","list-index"])]))),128))]),t("div",Tt,[y(Z,{variant:"border-light",size:"m",onClick:A},{default:P(()=>[...r[6]||(r[6]=[J(" Смотреть все результаты ",-1)])]),_:1})])],64)):_("",!0)])])),s(f).length&&!s(b)?(o(),a("div",Lt,[(o(!0),a(E,null,L(s(f),n=>(o(),z(oe($(n)?s(g):"button"),{key:n.name,to:$(n)?n.url:void 0,type:$(n)?void 0:"button",class:"search__action",onClick:T=>ve(n)},{default:P(()=>[V(n.svg)?(o(),z(oe(V(n.svg)),{key:0,class:"search__action-icon"})):_("",!0),t("span",Rt,R(n.name),1)]),_:2},1032,["to","type","onClick"]))),128))])):_("",!0)])],4)):_("",!0)]),_:1})}}});
1export{qt 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.