/opt/canhelp/apps/web/.next/server/chunks
Edit: /opt/canhelp/apps/web/.next/server/chunks/22.js (12331B)
"use strict";exports.id=22,exports.ids=[22],exports.modules={53863:(a,b,c)=>{c.d(b,{V:()=>g});var d=c(78157),e=c(31768),f=c(96484);function g({locations:a,value:b,onChange:c,anyLabel:g,allLabel:h}){let[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(""),o=(0,e.useRef)(null),{locale:p}=(0,f.Y)(),q=g;a:for(let c of a){if(c.slug===b){q=c.names[p]??c.names.el;break}for(let a of c.children??[])if(a.slug===b){q=a.names[p]??a.names.el;break a}}function r(){j(!1),l(null),n("")}let s=m.toLowerCase(),t=s?a.filter(a=>(a.names[p]??a.names.el).toLowerCase().includes(s)||(a.children??[]).some(a=>(a.names[p]??a.names.el).toLowerCase().includes(s))):a;return(0,d.jsxs)("div",{className:"relative",ref:o,children:[(0,d.jsx)("input",{type:"hidden",name:"location",value:b}),(0,d.jsxs)("button",{type:"button",onClick:()=>j(!i),className:`w-full flex items-center gap-1.5 px-3 py-2 text-sm transition-colors ${i?"rounded-t-lg border border-green-400 bg-white text-gray-900":"rounded-lg border border-gray-200 bg-gray-50 hover:bg-gray-100 text-gray-600 hover:text-gray-900"}`,children:[(0,d.jsxs)("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),(0,d.jsx)("span",{className:"flex-1 text-left truncate font-medium",children:q}),(0,d.jsx)("svg",{className:`w-3.5 h-3.5 text-gray-400 shrink-0 transition-transform ${i?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),i&&(0,d.jsxs)("div",{className:"absolute left-0 top-full w-full min-w-[220px] bg-white border border-t-0 border-green-400 rounded-b-xl shadow-lg z-50 max-h-96 overflow-y-auto",children:[(0,d.jsx)("div",{className:"sticky top-0 bg-white border-b border-gray-100 px-3 py-2",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,d.jsx)("input",{type:"text",value:m,onChange:a=>n(a.target.value),className:"w-full pl-8 pr-7 py-1.5 text-sm border border-gray-200 rounded-md focus:outline-none focus:border-green-400",placeholder:"Поиск...",onClick:a=>a.stopPropagation()}),m&&(0,d.jsx)("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>n(""),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),(0,d.jsxs)("button",{className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-sm hover:bg-gray-50 text-left border-b border-gray-100 ${!b?"text-green-600 font-medium":"text-gray-700"}`,onClick:()=>{c(""),r()},children:[(0,d.jsx)("span",{className:"flex-1",children:g}),!b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),t.map(a=>{let e=a.names[p]??a.names.el,f=a.children??[],g=s?f.filter(a=>(a.names[p]??a.names.el).toLowerCase().includes(s)):f,i=f.length>0,j=b===a.slug,m=k===a.slug||!!s&&g.length>0&&!e.toLowerCase().includes(s);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2 px-4 py-2.5 text-sm text-left transition-colors ${j?"text-green-600 font-medium hover:bg-green-50":"text-gray-800 hover:bg-gray-50"}`,onClick:()=>{i?l(m?null:a.slug):(c(a.slug),r())},children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5 text-gray-300 shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"})}),(0,d.jsx)("span",{className:"flex-1 font-medium",children:e}),i?(0,d.jsx)("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${m?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):j?(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):null]}),i&&m&&(0,d.jsxs)("div",{className:"bg-gray-50 border-t border-b border-gray-100",children:[(!s||e.toLowerCase().includes(s))&&(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2 pl-8 pr-4 py-2 text-sm text-left transition-colors ${j?"text-green-600 font-medium bg-green-50":"text-gray-600 hover:bg-gray-100"}`,onClick:()=>{c(a.slug),r()},children:[(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 shrink-0"}),(0,d.jsxs)("span",{className:"flex-1",children:[e," — ",h]}),j&&(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),g.map(a=>{let e=a.names[p]??a.names.el,f=b===a.slug;return(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2 pl-8 pr-4 py-2 text-sm text-left transition-colors ${f?"text-green-600 font-medium bg-green-50":"text-gray-600 hover:bg-gray-100"}`,onClick:()=>{c(a.slug),r()},children:[(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:e}),f&&(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},a.id)})]})]},a.id)})]})]})}},88142:(a,b,c)=>{c.d(b,{W:()=>h});var d=c(78157),e=c(31768),f=c(44972);function g(a,b){var c;let d="string"==typeof a?a.trim():"";return!d||(c=d).startsWith("/api/")||c.startsWith("/uploads/")||c.startsWith("http://")||c.startsWith("https://")?b.split("-").filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "):d}function h({categories:a,locale:b,value:c,onChange:h,placeholder:i}){let[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(""),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r="",s="";a:for(let d of a){if(d.slug===c){r=g(d.names[b]??d.names.el,d.slug),s=d.icon??"";break}for(let a of d.children??[])if(a.slug===c){r=g(a.names[b]??a.names.el,a.slug),s=d.icon??"";break a}}function t(){k(!1),m(null),o("")}let u=n.toLowerCase(),v=u?a.filter(a=>(a.names[b]??a.names.el).toLowerCase().includes(u)||(a.children??[]).some(a=>(a.names[b]??a.names.el).toLowerCase().includes(u))):a;return(0,d.jsxs)("div",{className:"relative",ref:p,children:[(0,d.jsx)("input",{type:"hidden",name:"category",value:c}),(0,d.jsxs)("button",{type:"button",onClick:()=>k(!j),className:`w-full flex items-center gap-1.5 px-3 py-2 text-sm transition-colors ${j?"rounded-t-lg border border-green-400 bg-white text-gray-900":"rounded-lg border border-gray-200 bg-gray-50 hover:bg-gray-100 text-gray-600 hover:text-gray-900"}`,children:[s?(0,d.jsx)(f.Ez,{icon:s,alt:r||i,className:"h-4 w-4 object-contain text-base leading-none shrink-0",fallback:"\uD83D\uDCE6"}):(0,d.jsx)("svg",{className:"w-4 h-4 text-gray-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 10h16M4 14h16M4 18h16"})}),(0,d.jsx)("span",{className:"flex-1 text-left truncate font-medium",children:r||i}),(0,d.jsx)("svg",{className:`w-3.5 h-3.5 text-gray-400 shrink-0 transition-transform ${j?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),j&&(0,d.jsxs)("div",{className:"absolute left-0 top-full w-full min-w-[240px] bg-white border border-t-0 border-green-400 rounded-b-xl shadow-lg z-50 max-h-96 overflow-y-auto",children:[(0,d.jsx)("div",{className:"sticky top-0 bg-white border-b border-gray-100 px-3 py-2",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,d.jsx)("input",{ref:q,type:"text",value:n,onChange:a=>o(a.target.value),className:"w-full pl-8 pr-7 py-1.5 text-sm border border-gray-200 rounded-md focus:outline-none focus:border-green-400",placeholder:"Поиск...",onClick:a=>a.stopPropagation()}),n&&(0,d.jsx)("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>o(""),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),(0,d.jsxs)("button",{className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-sm hover:bg-gray-50 text-left border-b border-gray-100 ${!c?"text-green-600 font-medium":"text-gray-700"}`,onClick:()=>{h(""),t()},children:[(0,d.jsx)("span",{className:"flex-1",children:i}),!c&&(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),v.map(a=>{let e=g(a.names[b]??a.names.el,a.slug),i=a.icon??"",j=a.children??[],k=u?j.filter(a=>(a.names[b]??a.names.el).toLowerCase().includes(u)||e.toLowerCase().includes(u)):j,n=l===a.slug||!!u&&k.length>0&&!e.toLowerCase().includes(u),o=j.length>0;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2 px-4 py-2.5 text-sm text-left transition-colors ${o?"hover:bg-gray-50 text-gray-800":c===a.slug?"text-green-600 font-medium hover:bg-green-50":"hover:bg-gray-50 text-gray-700"}`,onClick:()=>{o?m(n?null:a.slug):(h(a.slug),t())},children:[i?(0,d.jsx)(f.Ez,{icon:i,alt:e,className:"h-4 w-4 object-contain text-base leading-none shrink-0",fallback:"\uD83D\uDCE6"}):null,(0,d.jsx)("span",{className:"flex-1 font-medium",children:e}),o?(0,d.jsx)("svg",{className:`w-4 h-4 text-gray-400 shrink-0 transition-transform ${n?"rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):c===a.slug?(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):null]}),o&&n&&(0,d.jsx)("div",{className:"bg-gray-50 border-t border-b border-gray-100",children:k.map(a=>{let e=g(a.names[b]??a.names.el,a.slug),f=c===a.slug;return(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2 pl-10 pr-4 py-2 text-sm text-left transition-colors ${f?"text-green-600 font-medium bg-green-50":"text-gray-600 hover:bg-gray-100"}`,onClick:()=>{h(a.slug),t()},children:[(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-300 shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:e}),f&&(0,d.jsx)("svg",{className:"w-4 h-4 text-green-600 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},a.id)})})]},a.id)})]})]})}}};