import{a as xe,c as ve,b as we,d as be,r as L,f as Z,j as e,L as H}from"./jsx-runtime-CgWCn3gT.js";import{l as f}from"./styled-components.browser.esm-CQ4IZagM.js";import{B as ye,g as Pe,S as I,K as U,M as je,N as G,P as Ce,af as Le,ag as Se,ah as Be,ai as re,v as Te,aj as se,ak as J,al as _e,W as ke,X as Re}from"./legacy-shell-D4JdMu14.js";import{c as Ie}from"./index-ao6ir_VS.js";import{u as Ee,a as $e,b as Ne}from"./blogColumn-BobpY0f9.js";import{u as Oe,R as Ge}from"./useTranslation-CksCcIr-.js";import{R as qe,E as ie}from"./SearchOutlined-4CAPyJbl.js";import{R as ze}from"./ArrowLeftOutlined-PEnSNofW.js";const q={exports:{}};{let o=function(t){return String(t??"").toLowerCase()},v=function(t){return o(t).slice(0,B).split(/\s+/).filter(Boolean)},y=function(t){return String(t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},i=function(t){const l=y(t);return!S||d.test(t)?l:`(?<!(?:(?![${h}])[\\p{L}\\p{N}]))${l}`},m=function(t,l){return new RegExp(i(l),"iu").test(t)},T=function(t){return o(t&&t.title)},p=function(t){return o((t&&t.tags||[]).map(l=>l&&l.name).join(" "))},E=function(t){return o(t&&t.excerpt)},s=function(t,l){const b=T(t),r=p(t),u=E(t);return l.every(x=>m(b,x)||m(r,x)||m(u,x))},w=function(t,l,b){const r=o(t&&t.slug),u=l.every(A=>m(r,A)),z=(u?r:b).split(u?"-vs-":j)[0];return l.every(A=>m(z,A))},O=function(t,l){const b=T(t),r=p(t),u=l.filter(x=>m(b,x)).length;return u===l.length?w(t,l,b)?4:3:u>0||l.every(x=>m(r,x))?2:1},$=function(t){const l=Date.parse(t&&t.published_at||"");return Number.isFinite(l)?l:0},_=function(t,l){const b=Array.isArray(t)?t:[],r=v(l);return r.length?b.map((u,x)=>({post:u,index:x})).filter(({post:u})=>s(u,r)).map(({post:u,index:x})=>({post:u,index:x,tier:O(u,r)})).sort((u,x)=>x.tier-u.tier||$(x.post)-$(u.post)||u.index-x.index).map(({post:u})=>u):b},g=function(t){const l=[...new Set(v(t))].sort((b,r)=>r.length-b.length);return l.length?new RegExp(`(${l.map(i).join("|")})`,"giu"):null},c=function(t,l){const b=String(t??""),r=g(l);return r?b.split(r).map((u,x)=>({text:u,hit:x%2===1})).filter(u=>u.text!==""):b?[{text:b,hit:!1}]:[]};const n=q,h="\\u3040-\\u30ff\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\uac00-\\ud7af",d=new RegExp(`[${h}]`),S=(()=>{try{return new RegExp(`(?<!(?:(?![${h}])[\\p{L}\\p{N}]))x`,"u"),!0}catch{return!1}})(),B=100,j=/\s+(?:vs\.?|versus|против|проти|срещу|kontra|сравнени\S*|karşılaştırma\S*)\s+|\s*(?:对比|對比|比较|比較|비교)\s*/i;n.exports={MAX_BLOG_QUERY_LENGTH:B,searchBlogPosts:_,buildBlogSearchRegex:g,splitBlogSearchText:c}}const Ae=q.exports.MAX_BLOG_QUERY_LENGTH,He=q.exports.searchBlogPosts;q.exports.buildBlogSearchRegex;const Me=q.exports.splitBlogSearchText,Qe=q.exports,k={exports:{}};{let o=function(g){const c=g||[];return c.find(n=>n.featured)||c[0]||null},v=function(g){const c=new URLSearchParams(g||"").get("page");return!c||!/^\d+$/.test(c)?1:Math.max(1,Number(c))},y=function(g){return(new URLSearchParams(g||"").get("q")||"").trim().slice(0,$)},i=function(g,{page:c=1,withPin:n=!1}={}){const h=g||[],d=n?o(h):null,S=d?h.filter(t=>t.slug!==d.slug):h,B=Math.max(1,Math.ceil(S.length/_)),j=Math.min(Math.max(1,c),B);return{pinned:j===1?d:null,items:S.slice((j-1)*_,j*_),page:j,totalPages:B}},m=function(g,c){const n=g||[];return c?n.filter(h=>(h.tags||[]).some(d=>d.slug===c)):n},T=function(g,{tag:c,search:n}={}){return i(m(g,c),{page:v(n),withPin:!c}).page},p=function(g,c){if(g.pathname!==c.pathname)return!1;const n=h=>{const d=new URLSearchParams(h.search);return d.delete("page"),d.delete("q"),d.toString()};return n(g)===n(c)},E=function(g,c){return c>1?`${g}?page=${c}`:g},s=function(g,{page:c=1,q:n=""}={}){const h=String(g),d=h.indexOf("?"),S=d===-1?h:h.slice(0,d),B=d===-1?"":h.slice(d+1),j=new URLSearchParams(B);n?j.set("q",n):j.delete("q"),c>1?j.set("page",String(c)):j.delete("page");const t=j.toString();return t?`${S}?${t}`:S},w=function(g,c){if(c<=7)return Array.from({length:c},(d,S)=>S+1);const n=new Set([1,c,g-1,g,g+1]),h=[];for(let d=1;d<=c;d+=1)n.has(d)||n.has(d-1)&&n.has(d+1)?h.push(d):h[h.length-1]!=="gap"&&h.push("gap");return h};const O=k,{MAX_BLOG_QUERY_LENGTH:$}=Qe,_=10;O.exports={BLOG_PAGE_SIZE:_,pickPinnedPost:o,parseBlogPage:v,parseBlogQuery:y,paginateBlogPosts:i,postsForTag:m,blogListPage:T,isBlogListQueryOnlyChange:p,blogPageHref:E,blogListHref:s,blogPagerItems:w}}k.exports.BLOG_PAGE_SIZE;k.exports.pickPinnedPost;const Fe=k.exports.parseBlogPage,Ue=k.exports.parseBlogQuery,De=k.exports.paginateBlogPosts,Ke=k.exports.postsForTag,jt=k.exports.blogListPage,Ct=k.exports.isBlogListQueryOnlyChange,Lt=k.exports.blogPageHref,W=k.exports.blogListHref,Xe=k.exports.blogPagerItems,Ye=f.div.withConfig({componentId:"sc-ew3c3o-0"})([""," padding-block:16px 80px;&&{background:transparent;}"],Ne),Ve=f.h1.withConfig({componentId:"sc-ew3c3o-1"})(["font-family:var(--ah-font-title);font-size:var(--ah-text-section-marketing);line-height:1.35;font-weight:600;color:var(--ah-foreground);margin:0 0 var(--ah-space-2);@media (max-width:639px){font-size:var(--ah-text-display);}"]),Je=f.p.withConfig({componentId:"sc-ew3c3o-2"})(["color:var(--ah-muted-foreground);font-size:var(--ah-text-prose);line-height:var(--ah-leading-prose);margin:0 0 var(--ah-space-6);"]),We=f.div.withConfig({componentId:"sc-ew3c3o-3"})(["display:flex;flex-wrap:wrap;align-items:center;gap:var(--ah-space-3);margin-bottom:var(--ah-space-4);"]),Ze=f.div.withConfig({componentId:"sc-ew3c3o-4"})(["flex:none;margin-inline-start:auto;@media (max-width:639px){flex:1 1 100%;}"]),et=f.div.withConfig({componentId:"sc-ew3c3o-5"})(["position:relative;display:flex;align-items:center;gap:var(--ah-space-2);width:280px;min-height:var(--ah-control-height);padding-inline:var(--ah-space-3);.anticon{flex:none;color:var(--ah-muted-foreground);font-size:var(--ah-text-body);}input{flex:1;min-width:0;padding:0;border:0;background:transparent;color:var(--ah-foreground);font-family:inherit;font-size:var(--ah-text-body);line-height:1.5;}input::placeholder{color:var(--ah-muted-foreground);}input::-webkit-search-cancel-button{display:none;}&&:focus-within{border-color:var(--ah-focus-border);box-shadow:var(--ah-focus-shadow);}@media (max-width:639px){width:100%;}"]),tt=f.button.withConfig({componentId:"sc-ew3c3o-6"})(["display:inline-flex;flex:none;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--ah-radius-full);background:none;color:var(--ah-muted-foreground);cursor:pointer;&:hover{color:var(--ah-foreground);}&:focus-visible{outline:2px solid var(--ah-focus-border);outline-offset:2px;}"]),at=f.p.withConfig({componentId:"sc-ew3c3o-7"})(["margin:0 0 var(--ah-space-4);color:var(--ah-muted-foreground);font-size:var(--ah-text-body);overflow-wrap:anywhere;"]),nt=f.span.withConfig({componentId:"sc-ew3c3o-8"})(["position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;"]),ot=f.mark.withConfig({componentId:"sc-ew3c3o-9"})(["padding:0 1px;border-radius:var(--ah-radius-sm);background:var(--ah-accent);color:inherit;"]),rt=f.div.withConfig({componentId:"sc-ew3c3o-10"})(["display:flex;flex:1 1 auto;flex-wrap:wrap;gap:var(--ah-space-2);min-width:0;"]),de=f.div.withConfig({componentId:"sc-ew3c3o-11"})([""]),he=f.article.withConfig({componentId:"sc-ew3c3o-12"})(["position:relative;display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;overflow:hidden;background:var(--ah-card);border:1px solid var(--ah-border);border-radius:var(--ah-radius-lg);transition:border-color var(--ah-duration-fast) var(--ah-ease-standard),box-shadow var(--ah-duration-base) var(--ah-ease-out),transform var(--ah-duration-base) var(--ah-ease-out);li:hover > &,",":hover > &{border-color:var(--ah-border-strong);@media (hover:hover){box-shadow:0 10px 24px rgb(3 8 10 / 10%);}@media (hover:hover) and (prefers-reduced-motion:no-preference){transform:translateY(calc(-1 * var(--ah-motion-distance-sm)));}}&:has(a:focus-visible){outline:2px solid var(--ah-focus-border);outline-offset:2px;}"],de),st=f(H).withConfig({componentId:"sc-ew3c3o-13"})(["color:inherit;text-decoration:none;&::after{content:'';position:absolute;inset:0;}@supports selector(:has(a)){&&:focus-visible{outline:none;box-shadow:none;}}"]),ue=f.div.withConfig({componentId:"sc-ew3c3o-14"})(["aspect-ratio:1600 / 840;background:var(--ah-surface-inset);border-bottom:1px solid var(--ah-border);img{display:block;width:100%;height:100%;object-fit:cover;}"]),D=f.div.withConfig({componentId:"sc-ew3c3o-15"})(["display:flex;flex-direction:column;gap:var(--ah-space-2);min-width:0;min-height:0;padding:var(--ah-space-5) var(--ah-space-6);@media (max-width:639px){padding:var(--ah-space-4);}"]),M=o=>`
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: ${o};
  line-clamp: ${o};
  overflow: hidden;
`,K=f.h2.withConfig({componentId:"sc-ew3c3o-16"})(["margin:0;font-family:var(--ah-font-title);font-size:var(--ah-text-heading);line-height:var(--ah-leading-heading);font-weight:600;color:var(--ah-foreground);overflow-wrap:anywhere;",""],M(2)),ee=f.p.withConfig({componentId:"sc-ew3c3o-17"})(["margin:0;font-size:var(--ah-text-body);line-height:1.625;color:var(--ah-muted-foreground);overflow-wrap:anywhere;",""],M(2)),pe=f.div.withConfig({componentId:"sc-ew3c3o-18"})(["margin-top:auto;font-size:var(--ah-text-caption);line-height:20px;color:var(--ah-muted-foreground);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;& > * + *::before{content:'·';margin:0 6px;}"]),it=f(he).withConfig({componentId:"sc-ew3c3o-19"})(["margin-bottom:var(--ah-space-6);","{justify-content:center;gap:var(--ah-space-3);padding:var(--ah-space-6);}","{font-size:var(--ah-text-title);line-height:var(--ah-leading-title);","}","{","}","{margin-top:0;}@media (min-width:1024px){grid-template-columns:11fr 9fr;grid-template-rows:none;","{align-self:stretch;border-bottom:0;border-inline-end:1px solid var(--ah-border);}","{padding:var(--ah-space-8);}","{font-size:var(--ah-text-display);}","{font-size:var(--ah-text-prose);line-height:var(--ah-leading-prose);","}}@media (max-width:639px){margin-bottom:var(--ah-space-4);","{padding:var(--ah-space-4);}}"],D,K,M(3),ee,M(3),pe,ue,D,K,ee,M(2),D),ct=f.ul.withConfig({componentId:"sc-ew3c3o-20"})(["list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ah-space-6);& > li{display:grid;min-width:0;min-height:0;}@media (min-width:1024px){","{font-size:var(--ah-text-title);line-height:var(--ah-leading-title);}}@media (max-width:639px){grid-template-columns:minmax(0,1fr);gap:var(--ah-space-4);}"],K),lt=f.nav.withConfig({componentId:"sc-ew3c3o-21"})(["display:flex;flex-wrap:wrap;justify-content:center;gap:var(--ah-space-2);margin-top:var(--ah-space-12);.ds-button{min-width:var(--ah-control-height);font-variant-numeric:tabular-nums;}@media (max-width:639px){justify-content:space-between;align-items:center;}"]),gt=f.span.withConfig({componentId:"sc-ew3c3o-22"})(["display:contents;@media (max-width:639px){display:none;}"]),dt=f.span.withConfig({componentId:"sc-ew3c3o-23"})(["display:none;@media (max-width:639px){display:inline-flex;align-items:center;color:var(--ah-muted-foreground);font-size:var(--ah-text-body);font-variant-numeric:tabular-nums;white-space:nowrap;}"]),ht=f.span.withConfig({componentId:"sc-ew3c3o-24"})(["display:inline-flex;align-items:center;min-width:var(--ah-space-6);justify-content:center;color:var(--ah-muted-foreground);"]),ce=({text:o,query:v})=>Me(o,v).map((y,i)=>y.hit?e.jsx(ot,{children:y.text},i):e.jsx(Z.Fragment,{children:y.text},i)),ut=(o,v)=>e.jsxs(pe,{children:[o.published_at&&e.jsx("time",{dateTime:o.published_at,children:ke(o.published_at,v)}),o.reading_time>0&&e.jsx("span",{children:Re(v,o.reading_time)}),(o.tags||[]).length>0&&e.jsx("span",{children:o.tags.map(y=>y.name).join(", ")})]}),le=({post:o,locale:v,pinned:y=!1,eager:i=!1,query:m="",onPostClick:T})=>{const p=y?it:he,E=y?{fetchPriority:"high"}:i?{}:{loading:"lazy"};return e.jsxs(p,{children:[e.jsx(ue,{children:o.feature_image&&e.jsx("img",{src:o.feature_image,alt:o.title,decoding:"async",...E})}),e.jsxs(D,{children:[e.jsx(K,{children:e.jsx(st,{to:G(v,`/${o.slug}`),onClick:T,children:m?e.jsx(ce,{text:o.title,query:m}):o.title})}),o.excerpt&&e.jsx(ee,{children:m?e.jsx(ce,{text:o.excerpt,query:m}):o.excerpt}),ut(o,v)]})]})},ge=({to:o,children:v,...y})=>o?e.jsx(H,{className:"ds-button ds-button-secondary",to:o,...y,children:v}):e.jsx("span",{className:"ds-button ds-button-secondary",role:"link","aria-disabled":"true",children:v}),pt=({initialData:o,tag:v}={})=>{const{tag:y}=xe(),i=v??y,{i18n:m}=Oe(),T=ve(),p=we(),E=be(),s=ye(p.pathname),w=Pe(s),[O,$]=L.useState(o??null),[_,g]=L.useState(!o),c=Z.useRef(!!o),n=Ue(p.search),[h,d]=L.useState(n),S=L.useRef(null),B=L.useRef(null),j=L.useRef(""),t=L.useRef(""),l=Ee(),b=$e();L.useEffect(()=>{if(n===B.current){B.current=null;return}B.current=null,d(n)},[n]);const r=h.trim(),u=r!==n?1:Fe(p.search),x=Z.useCallback(a=>{const C=a.trim();C!==n&&(B.current=C,T(`${W(`${p.pathname}${p.search}`,{q:C})}${p.hash}`,{replace:!0,preventScrollReset:!0}))},[p.hash,p.pathname,p.search,T,n]);L.useEffect(()=>{if(r===n)return;const a=setTimeout(()=>x(r),300);return()=>clearTimeout(a)},[r,n,x]);const z=()=>{d(""),B.current="",n&&T(`${W(`${p.pathname}${p.search}`,{q:""})}${p.hash}`,{replace:!0,preventScrollReset:!0}),S.current&&S.current.focus()};L.useEffect(()=>{s!==I.defaultLanguage&&U(m.language)!==s&&Ie(s)},[s]),L.useEffect(()=>{const a=U(m.language);if(s===I.defaultLanguage&&a!==I.defaultLanguage){const C=p.pathname.slice(5);T(...je(G(a,C),p,{replace:!0}))}},[s,m.language,p.pathname,p.search,p.hash,T]),L.useEffect(()=>{if(s===I.defaultLanguage&&U(m.language)!==I.defaultLanguage)return;if(c.current){c.current=!1;return}let a=!1;const C=s===I.defaultLanguage?"/blog-data/index.json":`/blog-data/${s}/index.json`;return Ce(C).then(V=>!a&&$(V)).catch(()=>!a&&$({posts:[],tags:[]})).finally(()=>!a&&g(!1)),()=>{a=!0}},[s]);const A=E!=="POP"&&!!p.state?.blogLocaleSwitch;L.useEffect(()=>{A||window.scrollTo(0,0)},[i,s]),L.useEffect(()=>{E!=="POP"&&window.scrollTo(0,0)},[u]);const fe=O?.posts||[],X=O?.tags||[],Q=i?X.find(a=>a.slug===i):null,te=Ke(fe,i),R=r?He(te,r):te,{pinned:F,items:ae,page:P,totalPages:N}=De(R,{page:u,withPin:!i&&!r}),me=i?G(s,`/tag/${i}`):G(s),Y=a=>W(me,{page:a,q:r}),ne=r?w.searchResults.replace("{n}",String(R.length)).replace("{q}",()=>r):"",oe=r?w.searchEmpty.replace("{q}",()=>r):w.emptyPosts;return L.useEffect(()=>{if(!b&&s===I.defaultLanguage||_||r!==n||s===I.defaultLanguage&&U(m.language)!==I.defaultLanguage)return;const a=[s,i||"",n,P,R.length].join("|");if(j.current!==a&&Le({locale:s,tag:i,q:n,resultCount:R.length,page:P})&&(j.current=a),!n)return;const C=[s,i||"",n,R.length].join("|");t.current!==C&&Se({query:n,resultCount:R.length,locale:s,tag:i})&&(t.current=C)},[b,_,r,n,s,i,P,R.length,m.language,l]),e.jsxs(Ye,{className:"ah-ds",lang:s,children:[e.jsx(Ve,{children:Q?Q.name:w.blogTitle}),e.jsx(Je,{children:Q?Be(s,Q.name):w.blogSubtitle}),e.jsxs(We,{children:[X.length>0&&e.jsxs(rt,{children:[e.jsx(H,{className:`ds-button ds-button-choice${i?"":" ds-button--selected"}`,to:G(s),"aria-current":i?void 0:"page",onClick:()=>re({tag:"all",fromTag:i,q:n,locale:s}),children:w.tagAll}),X.map(a=>e.jsx(H,{className:`ds-button ds-button-choice${a.slug===i?" ds-button--selected":""}`,to:G(s,`/tag/${a.slug}`),"aria-current":a.slug===i?"page":void 0,onClick:()=>re({tag:a.slug,fromTag:i,q:n,locale:s}),children:a.name},a.slug))]}),e.jsx(Ze,{children:e.jsxs(et,{className:"ds-search",children:[e.jsx(qe,{"aria-hidden":"true"}),e.jsx("input",{ref:S,type:"search",value:h,maxLength:Ae,placeholder:w.searchPlaceholder,"aria-label":w.searchPlaceholder,"aria-controls":"blog-results",autoComplete:"off",spellCheck:"false",onChange:a=>d(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||(a.key==="Escape"?(a.preventDefault(),z()):a.key==="Enter"&&(a.preventDefault(),x(h)))}}),h&&e.jsx(tt,{type:"button",onClick:z,"aria-label":w.searchClear,children:e.jsx(Ge,{"aria-hidden":"true"})})]})})]}),r&&!_&&R.length>0&&e.jsx(at,{children:ne}),e.jsx(nt,{role:"status","aria-live":"polite",children:r&&!_?R.length>0?ne:oe:""}),e.jsx("div",{id:"blog-results",children:_?e.jsx("div",{style:{textAlign:"center",padding:80},children:e.jsx(Te,{size:"large"})}):R.length===0?r?e.jsx(ie,{description:oe,style:{padding:60},children:e.jsx("button",{type:"button",className:"ds-button ds-button-secondary",onClick:z,children:w.searchClear})}):e.jsx(ie,{description:w.emptyPosts,style:{padding:60}}):e.jsxs(e.Fragment,{children:[F&&e.jsx(de,{children:e.jsx(le,{post:F,locale:s,pinned:!0,onPostClick:()=>se({slug:F.slug,placement:"pinned",position:1,q:r,tag:i,page:P,locale:s})})}),ae.length>0&&e.jsx(ct,{children:ae.map((a,C)=>e.jsx("li",{children:e.jsx(le,{post:a,locale:s,eager:!F&&C<2,query:r,onPostClick:()=>se({slug:a.slug,placement:"grid",position:C+1,q:r,tag:i,page:P,locale:s})})},a.slug))}),N>1&&e.jsxs(lt,{"aria-label":w.paginationLabel,children:[e.jsxs(ge,{to:P>1?Y(P-1):null,rel:"prev",onClick:()=>J({page:P-1,direction:"prev",totalPages:N,tag:i,q:r,locale:s}),children:[e.jsx(ze,{"aria-hidden":"true"}),w.pagePrevious]}),e.jsx(gt,{children:Xe(P,N).map((a,C)=>a==="gap"?e.jsx(ht,{"aria-hidden":"true",children:"…"},`gap-${C}`):e.jsx(H,{className:`ds-button ${a===P?"ds-button-choice ds-button--selected":"ds-button-secondary"}`,to:Y(a),"aria-current":a===P?"page":void 0,onClick:()=>{a!==P&&J({page:a,direction:"page",totalPages:N,tag:i,q:r,locale:s})},children:a},a))}),e.jsxs(dt,{children:[P," / ",N]}),e.jsxs(ge,{to:P<N?Y(P+1):null,rel:"next",onClick:()=>J({page:P+1,direction:"next",totalPages:N,tag:i,q:r,locale:s}),children:[w.pageNext,e.jsx(_e,{"aria-hidden":"true"})]})]})]})})]})},St=Object.freeze(Object.defineProperty({__proto__:null,default:pt},Symbol.toStringTag,{value:"Module"}));export{pt as B,jt as a,Lt as b,St as c,Ct as i,Ue as p};
