vendor: 4,815 bytes, lines 1-26
1import{r as qe,s as Es,a0 as ts,A as Ps,G as o,v as ss,u as as,y as we,$ as bt,x as be,K as Ds,I as Rs,_ as te,z as e,X as ee,d as Ts,M as St,T as at,L as rs,p as nt,O as ns,g as Kt,i as Ce,m as Se,C as ft,j as Is,f as Be,k as ke,e as rt,c as Nt,l as Os,Y as Ls,V as $s,U as Ms,S as Qt}from"./index-D1INOIXK.js";import{u as Fs}from"./useAdsActions-C21MtAmn.js";import{u as zs}from"./useAds-3MFBGco5.js";import{P as Bs,u as qs}from"./PriceSuggestion-CMDNNeeZ.js";import{u as At}from"./useCredits-DxBZbZTX.js";import{M as Hs,f as Fe,u as Us,b as Vs}from"./useRepostNotifications-Be_33QV1.js";import{C as Ws}from"./chevron-left-BfTQRo-R.js";import{u as Ks}from"./useWettbewerbSearches-DzpWynga.js";import{H as Qs,u as is,M as Ys,C as Gs}from"./ContactEmailForm-DD9yxkAx.js";import{T as Xs}from"./Toast-DMt9XDQw.js";import{S as Js}from"./star-C4joQGd2.js";import{d as Zs}from"./useAnalytics-DbIRAGOj.js";import{T as ea}from"./trending-up-w8qlYji-.js";import"./notification-preferences-7THn4fsu.js";import"./useMutation-D-13h-zM.js";/** 2 * @license lucide-react v0.383.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ta=qe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 7 * @license lucide-react v0.383.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const sa=qe("BarChart2",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** 12 * @license lucide-react v0.383.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const aa=qe("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** 17 * @license lucide-react v0.383.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const ra=qe("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 22 * @license lucide-react v0.383.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const na=qe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var ia={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const oa=Es(ia);var la=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Yt(t){var a={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(a.name=r[1],(oa[r[1]]||t.charAt(t.length-2)==="/")&&(a.voidElement=!0),a.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(la),l=null;(l=i.exec(t))!==null;)if(l[0].trim())if(l[1]){var c=l[1].trim(),m=[c,""];c.indexOf("=")>-1&&(m=c.split("=")),a.attrs[m[0]]=m[1],i.lastIndex--}else l[2]&&(a.attrs[l[2]]=l[3].trim().substring(1,l[3].length-1));return a}var da=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ca=/^\s*$/,ua=Object.create(null);function os(t,a){switch(a.type){case"text":return t+a.content;case"tag":return t+="<"+a.name+(a.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(a.attrs):"")+(a.voidElement?"/>":">"),a.voidElement?t:t+a.children.reduce(os,"")+"</"+a.name+">";case"comment":return t+"<!--"+a.comment+"-->"}}var xa={parse:function(t,a){a||(a={}),a.components||(a.components=ua);var r,n=[],i=[],l=-1,c=!1;if(t.indexOf("<")!==0){var m=t.indexOf("<");n.push({type:"text",content:m===-1?t:t.substring(0,m)})}return t.replace(da,function(g,f){if(c){if(g!=="</"+r.name+">")return;c=!1}var j,N=g.charAt(1)!=="/",k=g.startsWith("<!--"),h=f+g.length,p=t.charAt(h);if(k){var w=Yt(g);return l<0?(n.push(w),n):((j=i[l]).children.push(w),n)}if(N&&(l++,(r=Yt(g)).type==="tag"&&a.components[r.name]&&(r.type="component",c=!0),r.voidElement||c||!p||p==="<"||r.children.push({type:"text",content:t.slice(h,t.indexOf("<",h))}),l===0&&n.push(r),(j=i[l-1])&&j.children.push(r),i[l]=r),(!N||r.voidElement)&&(l>-1&&(r.voidElement||r.name===g.slice(2,-1))&&(l--,r=l===-1?n:i[l]),!c&&p!=="<"&&p)){j=l===-1?n:i[l].children;var v=t.indexOf("<",h),P=t.slice(h,v===-1?void 0:v);ca.test(P)&&(P=" "),(v>-1&&l+j.length>=0||P!==" ")&&j.push({type:"text",content:P})}}),n}
26,stringify:function(t){return t.reduce(function(a,r){return a+os("",r)},"")}};const st=(t,a)=>{var n;if(!t)return!1;const r=((n=t.props)==null?void 0:n.children)??t.children;return a?r.length>0:!!r},ze=t=>{var r,n;if(!t)return[];const a=((r=t.props)==null?void 0:r.children)??t.children;return(n=t.props)!=null&&n.i18nIsDynamicList?he(a):a},ma=t=>Array.isArray(t)&&t.every(o.isValidElement),he=t=>Array.isArray(t)?t:[t],pa=(t,a)=>{const r={...a};return r.props={...a.props,...t.props},r},ga=t=>{const a={};if(!t)return a;const r=n=>{he(n).forEach(l=>{we(l)||(st(l)?r(ze(l)):be(l)&&!o.isValidElement(l)&&Object.assign(a,l))})};return r(t),a},vt=(t,a,r,n)=>{if(!t)return"";let i="";const l=he(t),c=a!=null&&a.transSupportBasicHtmlNodes?a.transKeepBasicHtmlNodesFor??[]:[];return l.forEach((m,g)=>{if(we(m)){i+=`${m}`;return}if(o.isValidElement(m)){const{props:f,type:j}=m,N=Object.keys(f).length,k=c.indexOf(j)>-1,h=f.children;if(!h&&k&&!N){i+=`<${j}/>`;return}if(!h&&(!k||N)||f.i18nIsDynamicList){i+=`<${g}></${g}>`;return}if(k&&N<=1){const w=we(h)?h:vt(h,a,r,n);i+=`<${j}>${w}</${j}>`;return}const p=vt(h,a,r,n);i+=`<${g}>${p}</${g}>`;return}if(m===null){bt(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(be(m)){const{format:f,...j}=m,N=Object.keys(j);if(N.length===1){const k=f?`${N[0]}, ${f}`:N[0];i+=`{{${k}}}`;return}bt(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:m});return}bt(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:m})}),i},ha=(t,a=[],r={})=>{if(!t)return t;const n=Object.keys(r),i=[...a,...n];let l="",c=0;for(;c<t.length;)if(t[c]==="<"){let m=!1;const g=t.slice(c).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(g){const f=g[1];(/^\d+$/.test(f)||i.includes(f))&&(m=!0,l+=g[0],c+=g[0].length)}if(!m){const f=t.slice(c).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(f){const j=f[1];(/^\d+$/.test(j)||i.includes(j))&&(m=!0,l+=f[0],c+=f[0].length)}}m||(l+="<",c+=1)}else l+=t[c],c+=1;return l},ba=(t,a,r,n,i,l,c)=>{if(r==="")return[];const m=i.transKeepBasicHtmlNodesFor||[],g=r&&new RegExp(m.map(s=>`<${s}`).join("|")).test(r);if(!t&&!a&&!g&&!c)return[r];const f=a??{},j=s=>{he(s).forEach(x=>{we(x)||(st(x)?j(ze(x)):be(x)&&!o.isValidElement(x)&&Object.assign(f,x))})};j(t);const N=ha(r,m,f),k=xa.parse(`<0>${N}</0>`),h={...f,...l},p=(s,A,x)=>{var R;const T=ze(s),G=v(T,A.children,x);return ma(T)&&G.length===0||(R=s.props)!=null&&R.i18nIsDynamicList?T:G},w=(s,A,x,T,G)=>{s.dummy?(s.children=A,x.push(o.cloneElement(s,{key:T},G?void 0:A))):x.push(...o.Children.map([s],R=>{var b;if(R.type===o.Fragment||((b=R.props)==null?void 0:b.i18nIsDynamicList)!==void 0){const y={key:T};return R&&R.props&&Object.keys(R.props).forEach(H=>{H==="children"||H==="i18nIsDynamicList"||(y[H]=R.props[H])}),o.createElement(R.type,y,G?null:A)}const E={key:T};return R&&R.props&&Object.keys(R.props).forEach(y=>{y==="ref"||y==="children"||(E[y]=R.props[y])}),o.cloneElement(R,E,G?null:A)}))},v=(s,A,x)=>{const T=he(s),G=he(A),R={};return G.reduce((E,b,y)=>{var U,ae;const H=((ae=(U=b.children)==null?void 0:U[0])==null?void 0:ae.content)&&n.services.interpolator.interpolate(b.children[0].content,h,n.language);if(b.type==="tag"){let O=T[parseInt(b.name,10)];!O&&a&&(O=a[b.name]),x.length===1&&!O&&(O=x[0][b.name]),O||(O={});const X={...b.attrs};c&&Object.keys(X).forEach(D=>{const W=X[D];we(W)&&(X[D]=Ds(W))});const I=Object.keys(X).length!==0?pa({props:X},O):O,Q=o.isValidElement(I),V=Q&&st(b,!0)&&!b.voidElement,ne=g&&be(I)&&I.dummy&&!Q,ie=be(a)&&Object.hasOwnProperty.call(a,b.name);if(we(I)){const D=n.services.interpolator.interpolate(I,h,n.language);E.push(D)}else if(st(I)||V){const D=p(I,b,x);w(I,D,E,y)}else if(ne){const D=v(T,b.children,x);w(I,D,E,y)}else if(Number.isNaN(parseFloat(b.name)))if(ie){const D=p(I,b,x);w(I,D,E,y,b.voidElement)}else if(i.transSupportBasicHtmlNodes&&m.indexOf(b.name)>
26-1)if(b.voidElement)E.push(o.createElement(b.name,{key:`${b.name}-${y}`}));else{const D=R[b.name]||0;R[b.name]=D+1;let W,Y=0;for(let F=0;F<T.length;F+=1){const me=T[F];if(o.isValidElement(me)&&me.type===b.name){if(Y===D){W=me;break}Y+=1}}const $=W?he(ze(W)):T,M=v($,b.children,x);E.push(o.createElement(b.name,{key:`${b.name}-${y}`},M))}else if(b.voidElement)E.push(`<${b.name} />`);else{const D=v(T,b.children,x);E.push(`<${b.name}>${D}</${b.name}>`)}else if(be(I)&&!Q){const D=b.children[0]?H:null;D&&E.push(D)}else w(I,H,E,y,b.children.length!==1||!H)}else if(b.type==="text"){const O=i.transWrapTextNodes,X=typeof i.unescape=="function"?i.unescape:as().unescape,I=c?X(n.services.interpolator.interpolate(b.content,h,n.language)):n.services.interpolator.interpolate(b.content,h,n.language);O?E.push(o.createElement(O,{key:`${b.name}-${y}`},I)):E.push(I)}return E},[])},P=v([{dummy:!0,children:t||[]}],k,he(t||[]));return ze(P[0])},ls=(t,a,r)=>{const n=t.key||a,i=o.cloneElement(t,{key:n});if(!i.props||!i.props.children||r.indexOf(`${a}/>`)<0&&r.indexOf(`${a} />`)<0)return i;function l(){return o.createElement(o.Fragment,null,i)}return o.createElement(l,{key:n})},fa=(t,a)=>t.map((r,n)=>ls(r,n,a)),ya=(t,a)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:ls(t[n],n,a)})}),r},ja=(t,a,r,n)=>t?Array.isArray(t)?fa(t,a):be(t)?ya(t,a):(ts(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,Na=t=>!be(t)||Array.isArray(t)?!1:Object.keys(t).reduce((a,r)=>a&&Number.isNaN(Number.parseFloat(r)),!0);function va({children:t,count:a,parent:r,i18nKey:n,context:i,tOptions:l={},values:c,defaults:m,components:g,ns:f,i18n:j,t:N,shouldUnescape:k,...h}){var ie,D,W,Y,$,M;const p=j||ss();if(!p)return ts(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const w=N||p.t.bind(p)||(F=>F),v={...as(),...(ie=p.options)==null?void 0:ie.react};let P=f||w.ns||((D=p.options)==null?void 0:D.defaultNS);P=we(P)?[P]:P||["translation"];const{transDefaultProps:s}=v,A=s!=null&&s.tOptions?{...s.tOptions,...l}:l,x=k??(s==null?void 0:s.shouldUnescape),T=s!=null&&s.values?{...s.values,...c}:c,G=s!=null&&s.components?{...s.components,...g}:g,R=vt(t,v,p,n),E=m||(A==null?void 0:A.defaultValue)||R||v.transEmptyNodeValue||(typeof n=="function"?Ps(n):n),{hashTransKey:b}=v,y=n||(b?b(R||E):R||E);(Y=(W=p.options)==null?void 0:W.interpolation)!=null&&Y.defaultVariables?c=T&&Object.keys(T).length>0?{...T,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:c=T;const H=ga(t);H&&typeof H.count=="number"&&a===void 0&&(a=H.count);const U=c||a!==void 0&&!((M=($=p.options)==null?void 0:$.interpolation)!=null&&M.alwaysFormat)||!t?A.interpolation:{interpolation:{...A.interpolation,prefix:"#$?",suffix:"?$#"}},ae={...A,context:i||A.context,count:a,...c,...U,defaultValue:E,ns:P};let O=y?w(y,ae):E;O===y&&E&&(O=E);const X=ja(G,O,p,n);let I=X||t,Q=null;Na(X)&&(Q=X,I=t);const V=ba(I,Q,O,p,v,ae,x),ne=r??v.defaultTransParent;return ne?o.createElement(ne,h,V):V}function wt({children:t,count:a,parent:r,i18nKey:n,context:i,tOptions:l={},values:c,defaults:m,components:g,ns:f,i18n:j,t:N,shouldUnescape:k,...h}){var s;const{i18n:p,defaultNS:w}=o.useContext(Rs)||{},v=j||p||ss(),P=N||(v==null?void 0:v.t.bind(v));return va({children:t,count:a,parent:r,i18nKey:n,context:i,tOptions:l,values:c,defaults:m,components:g,ns:f||(P==null?void 0:P.ns)||w||((s=v==null?void 0:v.options)==null?void 0:s.defaultNS),i18n:v,t:N,shouldUnescape:k,...h})}function wa(t,a,r,n,i,l){const[c,m]=o.useState(null),[g,f]=o.useState(null),[j,N]=o.useState(!1),[k,h]=o.useState(null),[p,w]=o.useState(null),[v,P]=o.useState({}),[s,A]=o.useState(!1),[x,T]=o.useState("unknown"),G=o.useRef(null),[R,E]=o.useState(!1),[b,y]=o.useState(!1),[H,U]=o.useState(!1),[ae,O]=o.useState(!1),[X,I]=o.useState(!1),Q=o.useRef(!1);o.useEffect(()=>{if(!c){T("unknown");return}const Y="https://api.anzeigenboost.de/api",$=()=>{fetch(`${Y}/ai/health`,{signal:AbortSignal.timeout(5e3)}).then(M=>M.json()).then(M=>T(M.ok&&M.latencyMs<2e3?"ok":"error")).catch(()=>T("error"))};return $(),G.current=setInterval($,15e3),()=>{G.current&&clearInterval(G.current)}},[c]);const V=async Y=>{try{return await navigator.clipboard.writeText(Y),!0}catch{const $=document.createElement("textarea");$.value=Y,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();const M=document.execCommand("copy");return document.body.removeChild($),M}};return{optimizePanelAdId:c,panelAd:g,isPanelLoading:j,panelData:k,panelError:p,loadedFromCac
26he:s,appliedTitle:R,appliedDescription:b,isApplyingTitle:H,isApplyingDescription:ae,isApplyingAll:X,geminiHealth:x,handleStartOptimization:async(Y,$=!1)=>{if(Q.current)return;const M=t.find(F=>String(F.id)===String(Y.id))||Y;if(f(M),m(M.id),E(!1),y(!1),!$&&v[M.id]){h(v[M.id]),w(null),A(!0),N(!1);return}if(n){w({status:429,message:`Monatslimit erreicht (${i}/${l}). Nächsten Monat wieder verfügbar.`}),N(!1);return}Q.current=!0,N(!0),h(null),w(null),A(!1);try{const F=await a(M.title,M.description||"",M.category||"",M.price||"");F!=null&&F.__error?w({status:F.status,message:F.message}):F?(h(F),P(me=>({...me,[M.id]:F})),r()):m(null)}finally{Q.current=!1,N(!1)}},handleApplyTitle:async()=>{k&&(U(!0),await V(k.improvedTitle),E(!0),U(!1))},handleApplyDescription:async()=>{k&&(O(!0),await V(k.improvedDescription),y(!0),O(!1))},handleApplyAll:async()=>{if(!k)return;I(!0);const Y=`${k.improvedTitle} 27 28${k.improvedDescription}`;await V(Y),E(!0),y(!0),I(!1)},copyToClipboard:V,setOptimizePanelAdId:m}}function Ca(t,a){const r=`${t||""} ${a||""}`.toLowerCase();return r.includes("category_")||r.includes("category_mismatch")||r.includes("category_rejected")?"failureCause.categoryChanged":r.includes("no_category_data")?"failureCause.categoryUnreadable":r.includes("no_price_data")?"failureCause.priceUnreadable":r.includes("session_expired")||r.includes("login_required")?"failureCause.sessionExpired":r.includes("404_not_found")||r.includes("ad_unavailable")||r.includes("ad_deleted")?"failureCause.adGone":r.includes("captcha")?"failureCause.securityCheck":r.includes("ip_blocked")||r.includes("rate_limit")?"failureCause.tooManyRequests":r.includes("worker_unreachable")||r.includes("econnrefused")?"failureCause.serviceDown":r.includes("dom_changed")||r.includes("preflight_form")||r.includes("form_not_found")?"failureCause.pageChanged":r.includes("submit_validation")?"failureCause.formRejected":r.includes("submit_outcome_uncertain")?"failureCause.outcomeUnclear":r.includes("timeout")?"failureCause.timeout":"failureCause.unknown"}function ka(t,a,r){if(r==="failureCause.sessionExpired")return"failureConsequence.reconnect";switch(t){case"OUR_FAULT":return a?r==="failureCause.categoryChanged"||r==="failureCause.pageChanged"?"failureConsequence.freeRetryAdjusting":"failureConsequence.freeRetry":"failureConsequence.noChargeOurFault";case"PLATFORM_FAULT":return"failureConsequence.noChargePlatform";case"UNCERTAIN":return"failureConsequence.noChargeUncertain";case"THEIR_FAULT":return"failureConsequence.actionNeeded";default:return null}}function Sa({isOpen:t,onClose:a,feedback:r,photos:n,isLoading:i,error:l,onRetry:c}){const{t:m}=te(),[g,f]=o.useState(0),j=(n||[]).filter(p=>p&&typeof p=="string"),N={lighting:m("photoFeedback.dimensions.lighting"),clarity:m("photoFeedback.dimensions.clarity"),background:m("photoFeedback.dimensions.background"),composition:m("photoFeedback.dimensions.composition"),coverage:m("photoFeedback.dimensions.coverage")};if(!t)return null;const h=(p=>p>=80?"text-green-600":p>=60?"text-orange-600":"text-red-600")((r==null?void 0:r.overall)||0);return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded w-full max-w-md max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[e.jsx("h2",{className:"text-base font-bold text-gray-900",children:m("photoFeedback.title")}),e.jsx("button",{onClick:a,className:"text-gray-400 hover:text-gray-600",children:e.jsx(ee,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-4",children:i?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-300 border-t-gray-600 mb-3"}),e.jsx("p",{className:"text-xs text-gray-600",children:m("photoFeedback.analyzing")})]}):l?e.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded p-2 mb-4",children:e.jsx("p",{className:"text-gray-700 text-xs leading-relaxed",children:l})}):r?e.jsxs(e.Fragment,{children:[j.length>0?e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"relative bg-gray-100 rounded overflow-hidden",style:{paddingBottom:"100%"},children:e.jsx("img",{src:j[g],alt:m("photoFeedback.photoAlt",{number:g+1}),className:"absolute inset-0 w-full h-full object-cover",onError:p=>{p.target.style.display="none"}},`photo-${g}`)}),j.length>1&&e.jsxs("div",{className:"flex items-center justify-between mt-2 px-2",children:[e.jsx("button",{onClick:()=>f(p=>p>0?p-1:j.length-1),className:"p-1 hover:bg-gray-100 rounded",title:m("photoFeedback.previousPhoto"),children:e.jsx(Ws,{className:"w-4 h-4 text-gray-600"})}),e.jsx("span",{className:"text-xs text-gray-600",children:m("photoFeedback.photoOf",{current:g+1,total:j.length})}),e.jsx("button",{onClick:()=>f(p=>p<j.length-1?p+1:0),className:"p-1 hover:bg-gray-100 rounded",title:m("photoFeedback.nextPhoto"),children:e.jsx(Ts,{className:"w-4 h-4 text-gray-600"})})]})]}):e.jsx("div",{className:"mb-4 p-3 bg-gray-50 rounded text-xs text-gray-600 text-center",children:m("photoFeedback.noPhotos")}),e.jsx("div",{className:"mb-4 p-3 bg-gray-50 rounded",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-gray-600",children:m("photoFeedback.overall")}),e.jsx("span",{className:`text-2xl font-bold ${h}`,children:r.overall})]})}),e.jsx("div",{className:"mb-4 space-y-2",children:Object.entries(r.scores||{}).map(([p,w])=>e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-800 font-medium w-24",children:N[p]||p}),e.jsx("div",{className:"flex-1 mx-2 bg-gray-200 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"h-full bg-gray-600 rounded-full",style:{width:`${Math.min(w,100)}%`}})}),e.jsx("span",{className:"text-gray-700 font-medium w-6 text-right",children:w})]},p))}),r.strengths&&r.strengths.length>0&&e.jsxs("div",{className:"mb-3 text-xs",children:[e.jsx("p",{className:"font-medium text-gray-800 mb
28-1",children:m("photoFeedback.strengths")}),e.jsx("ul",{className:"space-y-0.5",children:r.strengths.map((p,w)=>e.jsxs("li",{className:"text-gray-700",children:["⢠",p]},w))})]}),r.suggestions&&r.suggestions.length>0&&e.jsxs("div",{className:"text-xs",children:[e.jsx("p",{className:"font-medium text-gray-800 mb-1",children:m("photoFeedback.improvements")}),e.jsx("ul",{className:"space-y-0.5",children:r.suggestions.slice(0,2).map((p,w)=>e.jsxs("li",{className:"text-gray-700",children:["⢠",p.split(":")[0]]},w))})]}),c&&e.jsx("button",{onClick:c,className:"w-full mt-4 py-1.5 border border-gray-300 text-gray-700 text-xs font-medium rounded hover:bg-gray-50 transition-colors",children:m("photoFeedback.reanalyze")})]}):null})]})})}function Gt({ad:t,size:a="sm"}){const{t:r,i18n:n}=te(),i=At(),l=St(),[c,m]=o.useState("idle"),[g,f]=o.useState(null),[j,N]=o.useState(!1),k=o.useRef(null);async function h(){if(c==="done"){N(!j);return}m("loading"),N(!1);try{const v=localStorage.getItem("kb_session")||localStorage.getItem("token"),s=await fetch("https://api.anzeigenboost.de/api/ai/suggest-price",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({adId:String(t.id),language:n.language})});if(!s.ok)throw new Error("Request failed");const A=await s.json();f(A),m("done"),N(!0)}catch(v){console.error("[SuggestPrice] Error:",v),m("error")}}const p={low:r("suggestPriceButton.confidence.low"),medium:r("suggestPriceButton.confidence.medium"),high:r("suggestPriceButton.confidence.high")},w={low:"text-gray-500",medium:"text-orange-600",high:"text-green-600"};return e.jsxs("div",{className:"w-full relative",children:[e.jsxs("div",{className:a==="sm"?"relative group":void 0,children:[e.jsxs("button",{ref:k,onClick:h,disabled:c==="loading",className:a==="lg"?"w-full border rounded-lg py-3 px-4 font-semibold text-sm flex items-center justify-center gap-2.5 transition-colors border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50 disabled:opacity-50":"w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50 disabled:opacity-50",children:[e.jsx(at,{className:`shrink-0 ${a==="lg"?"w-4 h-4":"w-3.5 h-3.5"}`}),e.jsx("span",{children:r(c==="loading"?"suggestPriceButton.buttonLoading":c==="error"?"suggestPriceButton.buttonRetry":"suggestPriceButton.button")})]}),a==="sm"&&e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-48",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:r("adCard.infoDialog.price.title")}),e.jsx("p",{className:"text-white/75",children:r("adCard.infoDialog.price.body")}),i.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:r("adCard.infoDialog.creditCost",{count:l.price_suggestion})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),c==="done"&&g&&j&&e.jsxs("div",{className:"absolute left-0 right-0 top-full mt-2 min-w-72 bg-white border border-gray-200 shadow-lg rounded-sm p-3 z-40 animate-in fade-in slide-in-from-top-2 duration-150",children:[e.jsx("button",{onClick:()=>N(!1),className:"absolute top-2 right-2 text-gray-400 hover:text-gray-600 transition-colors",title:r("suggestPriceButton.close"),children:e.jsx(ee,{className:"w-4 h-4"})}),e.jsxs("div",{className:"pr-6",children:[e.jsx("div",{className:"mb-2",children:e.jsxs("div",{className:"text-sm font-semibold text-gray-900",children:[g.suggestedLow," â ",g.suggestedHigh," â¬"]})}),e.jsxs("div",{className:"mb-2.5 text-xs",children:[e.jsx("span",{className:"font-medium text-gray-700",children:r("suggestPriceButton.confidenceLabel")})," ",e.jsx("span",{className:`font-medium ${w[g.confidence]}`,children:p[g.confidence]})," ",e.jsx("span",{className:"text-gray-500",children:r("suggestPriceButton.comparablesUsed",{count:g.comparablesUsed})})]}),e.jsx("p",{className:"text-xs text-gray-700 mb-3 leading-relaxed italic",children:g.reasoning}),e.jsx("a",{href:`https://www.kleinanzeigen.de/s-suchanfrage.html?keywords=${encodeURIComponent(t.title)}`,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline text-xs font-medium",children:r("suggestPriceButton.compareListings")})]})]}),c==="done"&&j&&e.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>N(!1),"aria-hidden":"true"})]})}function Ct(t){return String((t==null?void 0:t.price)??"").replace(/<[^>]*>/g,"").toLowerCase().includes("verschenken")}function ds(t){const r=String(t??"").replace(/<[^>]*>/g,"").match(/[\d.,]+/);return r?r[0].replace(/\.(?=\d{3}(\D|$))/g,"").replace(",","."):""}function Aa({adId:t,price:a,enabled:r}){const{t:n}=te(),{searches:i}=Ks(r);if(!r)return null;const l=i.find(h=>h.adId===t)??i.find(h=>{var p;return((p=h.latestSnapshot)==null?void 0:p.userAdId)===t}),c=l==null?void 0:l.latestSnapshot,m=Number(ds(a).replace(/\./g,"").replace(",","."));if(!c||c.suggestedPriceLow==null||c.suggestedPriceHigh==null||!m)return null;const g=c.suggestedPriceLow,f=c.suggestedPriceHigh,j=`${g}â${f} â¬`;let N,k;return m>f+5?(N=n("adCard.market.above",{diff:Math.round(m-f)}),k="bg-orange-50 text-orange-700 border-orange-200"):m<g-5?(N=n("adCard.market.below",{diff:Math.round(g-m)}),k="bg-blue-50 text-blue-700 border-blue-200"):(N=n("adCard.market.fair"),k="bg-green-50 text-green-700 border-green-200"),e.jsx(rs,{to:"/wettbewerb",title:n("adCard.market.tooltip",{range:j,keyword:l.keyword}),className:`inline-flex items-center gap-1 text-[11px] font-medium px-2 py-0.5 rounded-full border hover:underline ${k}`,children:N})}const _a=[{days:[0],startHour:19,label:"So-Abend"},{days:[1,2,3,4,5],startHour:12,label:"Mittag"},{days:[1,2,3,4,5],startHour:18,label:"Abend"}],Ea=7*24*60*60*1e3,Pa=45;function Xt(t,a=Date.now()){const r=Pa*6e4,n=Math.max(a,(t??0)+Ea);for(let i=0;i<21;i++){const l=new Date(n);l.setDate(l.getDate()+i);const c=l.getDay(),m=_a.filter(g=>g.days.includes(c)).map(g=>{const f=new Date(l);return f.setHours(g.startHour,0,0,0),f.getTime()}).sort((g,f)=>g-f);for(const g of m){const f=g-r;if(f>=n)return new Date(f).toISOString()}}return new Date(n).toISOString()}const Jt={fresh:3,stale:7};function Da(t){if(!t)return"never";const a=(Date.now()-new Date(t).getTime())/(24*60*60*1e3);return a<=Jt.fresh?"fresh":a<=Jt.stale?"stale":"overdue"}const Ra=new Set(["195","198","196","197","199","200","206","272"]),Zt={195:"Wohnungen mieten",198:"Häuser mieten",196:"Wohnungen kaufen",197:"Häuser kaufen",199:"Garagen & Stellplätze",200:"Gewerbliche Immobilien",206:"Ferienwohnungen & -häuser",272:"Container / Land & Gärten"};function Ta(t){return t?Ra.has(String(t)):!1}const cs=()=>e.jsx("svg",{viewBox:"0 0 42 16",className:"h-3.5 shrink-0 flex items-center",xmlns:"http://www.w3.org/2000/svg",children:e.jsxs("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fontWeight:"bold",fontSize:"14",fontFamily:"Arial, Helvetica, sans-serif",letterSpacing:"-0.5",children:[e.jsx("tspan",{fill:"#e53238",children:"e"}),e.jsx("tspan",{fill:"#0064d2",children:"b"}),e.jsx("tspan",{fill:"#f5af02",children:"a"}),e.jsx("tspan",{fill:"#86b817",children:"y"})]})});function Ia({adTitle:t,onCancel:a,onConfirm:r}){const{t:n}=te();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xxs",children:e.jsxs("div",{className:"bg-white rounded-sm border border-gray-200 shadow-2xl p-5 w-full max-w-sm overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("h4",{className:"text-[15px] font-bold text-gray-800 flex items-center gap-1.5 mb-2",children:[e.jsx(cs,{})," ",n("adCard.confirmEbayListing")]}),e.jsxs("p",{className:"text-[13px] text-gray-600 mb-3 leading-normal",children:[n("adCard.confirmEbayListingBefore")," ",e.jsx("strong",{className:"text-gray-800",children:t})," ",n("adCard.confirmEbayListingAfter")]}),e.jsx("div",{className:"bg-blue-50 border border-blue-100 rounded-sm p-2.5 text-[11px] text-blue-800 font-semibold mb-4 leading-relaxed",children:n("adCard.ebayFixedPriceHint")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:a,className:"px-3 py-1.5 text-[12px] font-semibold bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-sm transition-colors",children:n("adCard.cancel")}),e.jsx("button",{onClick:r,className:"px-3 py-1.5 text-[12px] font-bold bg-[#A8C300] hover:bg-[#96ae00] text-white rounded-sm transition-colors",children:n("adCard.confirm")})]})]})})}function Oa({categoryName:t,onClose:a}){const{t:r}=te();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xxs",children:e.jsxs("div",{className:"bg-white rounded-sm border border-gray-200 shadow-2xl p-5 w-full max-w-sm overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("h4",{className:"text-[15px] font-bold text-gray-800 flex items-center gap-1.5 mb-2",children:[e.jsx(nt,{className:"w-4 h-4 text-red-500"})," ",r("adCard.paidCategoryWarningTitle")]}),e.jsx("p",{className:"text-[13px] text-gray-600 mb-3 leading-normal",dangerouslySetInnerHTML:{__html:r("adCard.paidCategoryWarningText",{categoryName:t})}}),e.jsx("div",{className:"bg-red-50 border border-red-100 rounded-sm p-2.5 text-[12px] text-gray-700 mb-4 leading-relaxed",children:r("adCard.paidCategoryWarningHint")}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{autoFocus:!0,onClick:a,className:"px-3 py-1.5 text-[12px] font-bold bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-sm transition-colors",children:r("carAdWarning.ok")})})]})})}function La({onClose:t}){const{t:a}=te();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xxs",children:e.jsxs("div",{className:"bg-white rounded-sm border border-gray-200 shadow-2xl p-5 w-full max-w-sm overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("h4",{className:"text-[15px] font-bold text-gray-800 flex items-center gap-1.5 mb-2",children:[e.jsx(nt,{className:"w-4 h-4 text-orange-500"})," ",a("carAdWarning.title")]}),e.jsx("p",{className:"text-[13px] text-gray-600 mb-3 leading-normal",dangerouslySetInnerHTML:{__html:a("carAdWarning.body")}}),e.jsx("div",{className:"bg-orange-50 border border-orange-100 rounded-sm p-2.5 text-[12px] text-gray-700 mb-4 leading-relaxed",children:a("carAdWarning.hint")}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{autoFocus:!0,onClick:t,className:"px-3 py-1.5 text-[12px] font-bold bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-sm transition-colors",children:a("carAdWarning.ok")})})]})})}function $a({views:t,favorites:a,messages:r,onCancel:n,onConfirm:i}){const{t:l}=te();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xxs",children:e.jsxs("div",{className:"bg-white rounded-sm border border-gray-200 shadow-2xl p-5 w-full max-w-sm overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("h4",{className:"text-[15px] font-bold text-gray-800 flex items-center gap-1.5 mb-2",children:[e.jsx(nt,{className:"w-4 h-4 text-orange-500"})," ",l("adCard.confirmRepostTitle")]}),e.jsx("p",{className:"text-[13px] text-gray-600 mb-3 leading-normal",children:l("adCard.confirmRepostText")}),e.jsxs("div",{className:"bg-orange-50 border border-orange-100 rounded-sm p-2.5 text-[12px] text-gray-700 mb-4 leading-relaxed",children:[e.jsx("div",{className:"font-semibold text-gray-800 mb
28-1",children:l("adCard.currentStats")}),e.jsxs("ul",{className:"space-y-0.5",children:[e.jsxs("li",{children:["- ",t," ",l("adCard.statViews")]}),e.jsxs("li",{children:["- ",a," ",l("adCard.statFavorites")]}),e.jsxs("li",{children:["- ",r," ",l("adCard.statMessages")]})]})]}),e.jsx("p",{className:"text-[13px] text-gray-700 font-medium mb-4",children:l("adCard.confirmRepostQuestion")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{autoFocus:!0,onClick:n,className:"px-3 py-1.5 text-[12px] font-semibold bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-sm transition-colors",children:l("adCard.cancel")}),e.jsx("button",{onClick:i,className:"px-3 py-1.5 text-[12px] font-bold bg-[#A8C300] hover:bg-[#96ae00] text-white rounded-sm transition-colors",children:l("adCard.confirmRepostYes")})]})]})})}const Ma=[{labelKey:"interval24h",value:1440},{labelKey:"interval3d",value:4320},{labelKey:"interval7d",value:10080}],Fa=new Set(["SESSION_EXPIRED","CAPTCHA_DETECTED","403_FORBIDDEN"]);function za(t){return t?["SESSION_EXPIRED","CAPTCHA_DETECTED","403_FORBIDDEN","IP_BLOCKED","IP_RATE_LIMITED","TIMEOUT","VERIFICATION_FAILED","404_NOT_FOUND","CATEGORY_MISMATCH","AD_UNAVAILABLE","KA_QUOTA_EXCEEDED","PAID_CATEGORY"].includes(t)?`adCard.repostDisabled.${t}`:"adCard.repostDisabled.UNKNOWN":null}function yt(t,a,r,n){if(!t)return r("adCard.noSchedule");const i=new Date(t),l=new Date;if(i.getTime()<=l.getTime())return r("adCard.duePending");const c=n==="en"?"en-US":"de-DE",m=i.toLocaleTimeString(c,{hour:"2-digit",minute:"2-digit"});if(i.toDateString()===l.toDateString())return r("adCard.todayAt",{time:m});const g=new Date(l);return g.setDate(l.getDate()+1),i.toDateString()===g.toDateString()?r("adCard.tomorrowAt",{time:m}):i.toLocaleDateString(c,{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const Ba=1e5;async function jt(t,a){if(!t||typeof t!="string")throw new Error(a("adCard.invalidAdId",{adId:t,type:typeof t}));const r=localStorage.getItem("kb_session")||localStorage.getItem("token"),n="https://api.anzeigenboost.de/api",i=new AbortController,l=setTimeout(()=>i.abort(),Ba);try{const c={adId:t},m=await fetch(`${n}/ai/photo-feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify(c),signal:i.signal}),g=await m.json().catch(()=>({}));if(!m.ok)throw new Error((g==null?void 0:g.message)||a("adCard.photoFeedbackFetchError"));return g}catch(c){throw(c==null?void 0:c.name)==="AbortError"?new Error(a("adCard.photoFeedbackTimeout")):new Error(c.message||a("adCard.photoFeedbackFetchError"))}finally{clearTimeout(l)}}function qa({ad:t,onAction:a,onAIOptimize:r,onCheckCategory:n,onPriceCheck:i,onSchedule:l,onEbayCrossPost:c,onConnectEbay:m,isEbayConnected:g,onUpdateFields:f,onCancelScheduledRepost:j,aiBlocked:N=!1,aiWarning:k=!1,creditsBalance:h,repostState:p="idle",repostBusy:w=!1,repostQueuePosition:v=0,onCancelRepost:P}){var Ft,zt,Bt,qt,Ht,Ut;const{t:s,i18n:A}=te(),x=ns(),G=(t.repostMode==="smart"?"smart":"manual")==="smart"?x.repost_schedule_smart_enabled:x.repost_schedule_manual_enabled,R=x.repost_schedule_smart_enabled||x.repost_schedule_manual_enabled,E=!!t.autoRepost&&!G||t.repostDisabledErrorCode==="FEATURE_PAUSED",b=At(),y=St(),[H,U]=o.useState(!1),[ae,O]=o.useState(!1),[X,I]=o.useState(!1),[Q,V]=o.useState(null),[ne,ie]=o.useState(!1),[D,W]=o.useState(!1),[Y,$]=o.useState(null),[M,F]=o.useState(null),[me,Ie]=o.useState(!1),[Oe,Le]=o.useState(!1),[Ae,He]=o.useState(""),[Ue,Ve]=o.useState(""),[fe,_e]=o.useState(!1),[ue,pe]=o.useState(null),[it,Ee]=o.useState(!1),[_,We]=o.useState(t.lastPositionResult??null),[se,Ke]=o.useState(!1),[oe,$e]=o.useState(null),Pe=y.position_check??3,ye=50,z=!b.enabled||b.balance>=Pe;t.lastPositionCheckedAt;const ot=!1,Qe=t.listingState==="deleted"||t.listingState==="reserved"||!t.title,De="https://api.anzeigenboost.de/api";o.useEffect(()=>{t.lastPositionResult&&We(t.lastPositionResult)},[t.lastPositionResult]);const lt=async(d=!1)=>{if(!(!d&&(!z||Qe))){Ke(!0),d||$e(null);try{const S=localStorage.getItem("kb_session")||localStorage.getItem("token"),L=`${De}/ads/${t.id}/check-position${d?"?auto=true":""}`,K=await fetch(L,{method:"POST",headers:{Authorization:`Bearer ${S}`}}),q=await K.json();K.ok?(We(q),d||b.refetchBalance()):d||(q==null?void 0:q.code)!=="POSITION_CHECK_COOLDOWN"&&$e((q==null?void 0:q.message)||s("adCard.positionCheckError"))}catch{d||$e(s("adCard.positionCheckError"))}finally{Ke(!1)}}},_t=()=>{He(ds(t.price)),Ve(t.description||""),pe(null),Ee(!1),Le(!0)},dt=async()=>{const d=Ae.trim()===""?void 0:Number(Ae.replace(",",".")),S=Ue.trim();if(d===void 0&&!S){pe(s("adCard.quickEditNothingToSave"));return}if(d!==void 0&&(Number.isNaN(d)||d<0)){pe(s("adCard.quickEditInvalidPrice"));return}_e(!0),pe(null),Ee(!1);try{const L=await new Promise((K,q)=>{const re=setTimeout(()=>{window.removeEventListener("message",tt),q(new Error(s("ads.toast.extensionNotResponding")))},3e4),tt=ht=>{var Vt,Wt;((Vt=ht.data)==null?void 0:Vt.type)==="AB_QUICK_EDIT_RESPONSE"?(clearTimeout(re),window.removeEventListener("message",tt),K(ht.data)):((Wt=ht.data)==null?void 0:Wt.type)==="EXTENSION_CONTEXT_INVALIDATED"&&(clearTimeout(re),window.removeEventListener("message",tt),q(new Error(s("ads.toast.extensionNotResponding"))))};window.addEventListener("message",tt),window.postMessage({type:"AB_QUICK_EDIT",adId:t.
28id,...d!==void 0?{priceAmount:d}:{},...S?{description:S}:{}},"*")});if(L!=null&&L.ok){if(Ee(!0),d!==void 0){const K=Number.isInteger(d)?String(d):d.toFixed(2).replace(".",",");bs(`${K} â¬`)}b.refetchBalance(),setTimeout(()=>{Le(!1),Ee(!1)},1800)}else pe((L==null?void 0:L.error)||s("adCard.quickEditError"))}catch(L){pe((L==null?void 0:L.message)||s("adCard.quickEditError"))}finally{_e(!1)}},J=t.listingState==="reserved"||t.listingState==="paused"||t.listingState==="under_review"||t.listingState==="deleted",ct=t.listingState==="reserved"?s("adCard.repostLockedReserved"):t.listingState==="paused"?s("adCard.repostLockedPaused"):t.listingState==="under_review"?s("adCard.repostLockedUnderReview"):s("adCard.repostLockedDeleted");t.ebayListingId||t.ebayUrl;const Ye=async()=>{O(!1),I(!0),V(null);try{const d=await c(t.id);d.success||(V(d.error||s("adCard.ebayPostError")),setTimeout(()=>V(null),6e3))}catch{V(s("adCard.ebayNetworkError")),setTimeout(()=>V(null),6e3)}finally{I(!1)}},[Re,je]=o.useState(!1),[Z,le]=o.useState(t.repostMode||"smart"),[de,ce]=o.useState([1440,4320,10080].includes(t.repostIntervalMinutes)?t.repostIntervalMinutes:1440),[xe,ut]=o.useState(((zt=(Ft=t.smartVariation)==null?void 0:Ft.titleVariants)==null?void 0:zt[0])??(t.title||"")),[u,C]=o.useState(((qt=(Bt=t.smartVariation)==null?void 0:Bt.titleVariants)==null?void 0:qt[1])??""),[B,Ne]=o.useState(!!((Ht=t.smartVariation)!=null&&Ht.rotatePhotos)),[ge,Te]=o.useState(((Ut=t.smartVariation)==null?void 0:Ut.priceStepPercent)??0),[xt,Ge]=o.useState(!1),[ve,Xe]=o.useState(!!t.autoRepost),[hs,bs]=o.useState(null),[mt,Je]=o.useState(t.nextRepostAt||null),Ze=t.status==="pending_repost",[Et,Pt]=o.useState(!1),[fs,ys]=o.useState(()=>localStorage.getItem("ab_smart_repost_seen")!=="1"),js=[xe,u].filter(d=>d.trim()).length>=2||B||ge>0,Dt=Number(t.views)||0,Rt=Number(t.favorites)||0,Tt=Number(t.messages)||0,It=Dt>0||Rt>0||Tt>0,[Ot,et]=o.useState(null),[Ns,pt]=o.useState(null),Me=Ta(t.l1Category)||!t.l1Category&&!!t.category&&Object.values(Zt).some(d=>t.category.toLowerCase().includes(d.toLowerCase())),vs=t.l1Category?Zt[String(t.l1Category)]??t.category??"":t.category??"",Lt=String(t.l2Category??"")==="216",[ws,gt]=o.useState(!1),[br,$t]=o.useState("schedule"),Mt=async()=>{if(f){Ge(!0);try{let d,S;if(Z==="smart"){const K=[xe,u].map(re=>re.trim()).filter(Boolean),q=t.lastPostedAt?new Date(t.lastPostedAt).getTime():Date.now();S=Xt(q),d={status:"active",autoRepost:!0,repostMode:"smart",nextRepostAt:S,smartVariation:{...K.length>=2?{titleVariants:K}:{},rotatePhotos:B,priceStepPercent:ge||0}}}else S=new Date(Math.ceil((Date.now()+de*6e4)/6e4)*6e4).toISOString(),d={status:"active",autoRepost:!0,repostMode:"manual",repostIntervalMinutes:de,nextRepostAt:S};await f(t.id,d)&&(Xe(!0),Je(S),je(!1))}finally{Ge(!1)}}},Cs=()=>{if(!(Z==="smart"?x.repost_schedule_smart_enabled:x.repost_schedule_manual_enabled)){je(!1);return}if(Me){pt("schedule");return}if(!ve&&Lt){$t("schedule"),gt(!0);return}if(!ve&&It){et("schedule");return}Mt()},ks=()=>{const d=Ot;et(null),d==="instant"?a("repost",t.id,s("adCard.repostRunningAction")):d==="schedule"&&Mt()};o.useEffect(()=>{Me&&ve&&f&&(f(t.id,{autoRepost:!1,nextRepostAt:null}).catch(()=>{}),Xe(!1),Je(null))},[]),o.useEffect(()=>{Z==="smart"&&!x.repost_schedule_smart_enabled&&x.repost_schedule_manual_enabled?le("manual"):Z==="manual"&&!x.repost_schedule_manual_enabled&&x.repost_schedule_smart_enabled&&le("smart")},[Z,x.repost_schedule_smart_enabled,x.repost_schedule_manual_enabled]);const Ss=()=>{localStorage.setItem("ab_smart_repost_seen","1"),ys(!1)},As=async()=>{if(f){Ge(!0);try{await f(t.id,{autoRepost:!1,nextRepostAt:null})&&(Xe(!1),Je(null),je(!1))}finally{Ge(!1)}}},_s=async()=>{if(!(!j||Ze)){Pt(!0);try{(await j(t.id)).success&&(Xe(!1),Je(null))}finally{Pt(!1)}}};return e.jsxs("div",{className:"border border-[#e5e5e5] flex flex-col md:flex-row hover:shadow-[0_1px_3px_rgba(0,0,0,0.1)] transition-shadow",children:[e.jsxs("div",{className:"bg-white flex flex-col sm:flex-row flex-1 p-2 gap-3 border-b md:border-b-0 border-[#e5e5e5]",children:[e.jsxs("div",{className:"relative shrink-0 w-full sm:w-[160px] h-[140px] bg-[#f5f5f5] flex items-center justify-center overflow-hidden rounded-sm",children:[t.image||t.thumbnailUrl||t.pictureUrl?e.jsx("img",{src:t.image||t.thumbnailUrl||t.pictureUrl,alt:t.title,className:`w-full h-full object-cover mix-blend-multiply transition-all ${J?"grayscale opacity-50":""}`,onError:d=>{d.target.style.display="none"}}):e.jsx("span",{className:"text-[#bbb] text-[11px]",children:s("adCard.noImage")}),t.listingState==="reserved"&&e.jsx("span",{className:"absolute bottom-1 left-1 text-[9px] font-bold uppercase tracking-wide text-white bg-orange-500/90 px-1.5 py-0.5 rounded-sm",children:s("adCard.reserved")}),t.listingState==="deleted"&&e.jsx("span",{className:"absolute bottom-1 left-1 text-[9px] font-bold uppercase tracking-wide text-white bg-red-500/90 px-1.5 py-0.5 rounded-sm",children:s("adCard.deleted")})]}),e.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[e.jsx("a",{href:`https://www.kleinanzeigen.de/s-anzeige/${t.id}`,target:"_blank",rel:"noopener noreferrer",className:"text-[15px] font-semibold text-[#333] hover:underline leading-snug mb-1 block line-clamp-2",children:t.title}),e.jsx("div",{className:"text-[12px] text-[#888] mb-0.5",children:t.category}),e.jsx("div",{className:"text-[12px] text-[#888] mb-2",children:t.date}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 text-[12px] font-medium text-[#666]",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(ra,{className:"w-3 h-3"})," ",t.views??"â"]}
28),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Qs,{className:"w-3 h-3"})," ",t.favorites??"â"]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Hs,{className:"w-3 h-3"})," ",t.messages??"â"]})]}),(()=>{const d=Da(t.lastPostedAt),S={fresh:"bg-green-50 text-green-700 border-green-200",stale:"bg-amber-50 text-amber-700 border-amber-200",overdue:"bg-red-50 text-red-700 border-red-200",never:"bg-gray-50 text-gray-500 border-gray-200"},L=d==="never"?s("adCard.neverReposted"):s("adCard.lastRepostedLabel",{time:Fe(t.lastPostedAt,s)});return e.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full border w-fit mt-1.5 ${S[d]}`,children:[e.jsx(Kt,{className:"w-2.5 h-2.5"}),L]})})(),_&&(()=>{const d=_.isAutoCheck,S=_.positionBefore;let L;if(d&&S!=null){const K=s("adCard.positionResultBefore",{position:S}),q=_.found&&_.position!=null?s("adCard.positionResultAfterRepost",{position:_.position}):s("adCard.positionResultAfterRepostNotRanked",{total:_.totalOnPage||ye});L=`${K} â ${q}`}else d?L=_.found&&_.position!=null?s("adCard.positionResultAfterRepost",{position:_.position}):s("adCard.positionResultAfterRepostNotRanked",{total:_.totalOnPage||ye}):_.found&&_.position!=null?L=s("adCard.positionResultRank",{position:_.position,total:_.totalOnPage}):L=s("adCard.positionResultNotRanked",{total:_.totalOnPage||ye});return e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full border w-fit mt-1 bg-blue-50 text-blue-700 border-blue-200",title:s("adCard.positionCheckedAgo",{time:Fe(_.checkedAt,s)}),children:[L," · ",Fe(_.checkedAt,s)]})})()]})]}),e.jsxs("div",{className:"w-full md:w-[260px] bg-[#fdfdfd] md:border-l border-[#e5e5e5] p-2.5 flex flex-col gap-2 shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[11px] font-semibold text-[#999] uppercase tracking-wide",children:s("adCard.options")}),e.jsx("span",{className:"text-[14px] font-bold text-[#333]",children:hs??t.price})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx(Aa,{adId:String(t.id),price:t.price,enabled:x.wettbewerb_enabled!==!1}),t.status==="Aktiv"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-green-50 text-green-700 px-2 py-0.5 rounded-full border border-green-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"})," ",s("adCard.active")]}),t.status==="Pausiert"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-gray-50 text-gray-600 px-2 py-0.5 rounded-full border border-gray-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"})," ",s("adCard.paused")]}),t.status==="Reserviert"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-orange-50 text-orange-600 px-2 py-0.5 rounded-full border border-orange-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-500"})," ",s("adCard.reserved")]}),t.status==="pending"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-yellow-50 text-yellow-700 px-2 py-0.5 rounded-full border border-yellow-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500"})," ",s("adCard.draft")]}),t.listingState==="reserved"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-orange-50 text-orange-600 px-2 py-0.5 rounded-full border border-orange-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-orange-500"})," ",s("adCard.reserved")]}),t.listingState==="paused"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-gray-50 text-gray-600 px-2 py-0.5 rounded-full border border-gray-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"})," ",s("adCard.paused")]}),t.listingState==="under_review"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-blue-50 text-blue-600 px-2 py-0.5 rounded-full border border-blue-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-500"})," ",s("adCard.underReview")]}),t.listingState==="deleted"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium bg-red-50 text-red-600 px-2 py-0.5 rounded-full border border-red-200",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"})," ",s("adCard.deleted")]}),p==="running"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold bg-[#A8C300]/10 text-[#6f8f00] px-2 py-0.5 rounded-full border border-[#A8C300]/40",children:[e.jsx(Ce,{className:"w-3 h-3 animate-spin"})," ",s("adCard.running")]}),p==="queued"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold bg-blue-50 text-blue-700 px-2 py-0.5 rounded-full border border-blue-200",children:["â³ ",v>0?s("adCard.queuedPosition",{position:v}):s("adCard.queuedNoPosition")]}),(p==="running"||p==="queued")&&P&&e.jsxs("button",{type:"button",onClick:()=>P(t.id),className:"inline-flex items-center gap-0.5 text-[11px] font-semibold text-red-600 hover:text-red-700 hover:underline px-0.5",children:[e.jsx(ee,{className:"w-3 h-3"})," ",s("adCard.cancelRepost")]}),Ze&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold bg-[#A8C300]/10 text-[#6f8f00] px-2 py-0.5 rounded-full border border-[#A8C300]/40",children:[e.jsx(Ce,{className:"w-3 h-3 animate-spin"})," ",s("adCard.executingBadge")]})]})]}),x.repost_now_enabled&&e.jsxs("div",{className:"relative group/repost hidden md:block",children:[e.jsxs("div",{className:"absolute bottom-full left-0 mb-2 hidden group-hover/repost:block z-50 pointer-events-none w-56",children:[e.jsxs("div",{className:"bg-gray-900 text-white rounded-md px-3 py-2 shadow-lg text-left",children:[e.jsx("p",{className:"font-semibold text-[11px] mb-0.5",children:s("adCard.repostNow")}),e.jsx("p",{className:"text-[10px] text-gray-300 leading-snug",children:s("adCard.tooltip.repostBody")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[10px] text-yellow-300 font-medium",children:s("adCard.creditCostHint",{count:t.repostMode==="smart"?y.manual_smart_repost:y.manual_repost})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]}),e.jsxs("label",{className:`flex items-start gap-1.5 group ${J||p!=="idle"?"cursor-default":"cursor-pointer"}`,children:[e.jsx("input",{type:"checkbox",className:`mt-0.5 h-3.5 w-3.5 text-ka-green border-[#ccc] rounded-sm focus:ring-ka-green ${J||p!=="idle"?"cursor-not-allowed opacity-70":"cursor-pointer"}`,checked:p==="running"||p==="queued",disabled:J||p==="running"||p==="queued",onChange:()=>{if(!(p!=="idle"||J)&&x.repost_now_enabled){if(Me){pt("instant");return}if(Lt){$t("instant"),gt(!0);return}It?et("instant"):a("repost",t.id,s("adCard.repostRunningAction"))}}}),e.jsxs("div",{className:"text-[12px]",children:[e.jsxs("span",{className:`block font-semibold transition-colors ${J?"text-gray-400":"text-[#333] group-hover:text-ka-green-text"}`,children:[s("adCard.repostNow"),b.enabled&&e.jsx("span",{className:"ml-1 font-normal text-[11px] text-gray-400",children:s("adCard.creditCostHint",{count:t.repostMode==="smart"?y.manual_smart_repost:y.manual_repost})})]}),J?e.jsx("span",{className:"text-[12px] block text-orange-600 font-medium",children:s("adCard.pausedListing",{state:ct})}):t.lastFailureFault&&t.lastFailureCharged===!1&&!Fa.has(t.repostDisabledErrorCode)?e.jsxs("span",{className:"text-[12px] block text-orange-600 font-medium",children:[(()=>{const d=Ca(t.repostDisabledErrorCode,t.lastFailureDetail),S=ka(t.lastFailureFault,!!t.autoRetryPending,d);return e.jsxs(e.Fragment,{children:["â¹ï¸ ",s(d)," ",S?s(S):""]})})(),e.jsx("span",{className:"ml-1 inline-flex items-center text-[10px] font-semibold bg-green-50 text-green-700 border border-green-200 px-1.5 py-0.5 rounded-full align-middle",children:s("repostFault.noChargeBadge")})]}):t.repostDisabledReason?e.jsx("span",{className:"text-[12px] block text-red-600 font-medium",children:e.jsx("span",{title:t.repostDisabledReason,
28children:(()=>{const d=za(t.repostDisabledErrorCode);return d?s(d):t.repostDisabledReason})()})}):e.jsx("span",{className:"text-[12px] block text-[#888]",children:p==="running"?s("adCard.repostRunning"):p==="queued"?v>0?s("adCard.queuedPosition",{position:v}):s("adCard.queuedNoPosition"):s("adCard.repostOnce")}),e.jsx("div",{className:"mt-1 space-y-0.5 text-[11px] text-gray-550",children:(()=>{const d=t.trackedRepostsCount||0,S=s("adCard.days",{returnObjects:!0});if(d===0)return e.jsx("div",{className:"text-gray-400 italic",children:s("adCard.firstRepost")});if(d<3)return null;if(d<5){const L=t.bestDayBisher||S[4],K=t.bestHourBisher??19;return e.jsx("div",{className:"font-medium text-gray-700",children:s("adCard.bestTimeTip",{day:L,hour:`${String(K).padStart(2,"0")}:00`,count:d})})}else{const L=t.aiSuggestedRepostDay??4,K=t.aiSuggestedRepostHour??19,q=t.aiSuggestedImprovementPercent||47;return e.jsx("div",{className:"font-semibold text-green-700",children:s("adCard.aiTip",{day:S[L]||S[4],hour:`${String(K).padStart(2,"0")}:00`,improvement:q})})}})()})]})]})]}),!J&&(R||ve||E)&&e.jsxs("div",{className:"relative border-t border-gray-100 pt-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>{R&&je(d=>!d)},className:"w-full flex items-center justify-between gap-1 text-[12px] text-gray-600 hover:text-[#A8C300] transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[e.jsx(Kt,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:s("adCard.autoRepeat")})]}),E?e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 bg-amber-50 border border-amber-200 rounded-full px-2 py-0.5 shrink-0",children:s("adCard.schedulePaused")}):Me?e.jsx("span",{className:"text-[10px] font-semibold text-red-600 bg-red-50 border border-red-200 rounded-full px-2 py-0.5 shrink-0",children:s("adCard.paidCategoryScheduleBadge")}):ve?(()=>{const d=!!mt&&new Date(mt).getTime()<=Date.now(),S=yt(mt,!0,s,A.language);return e.jsx("span",{className:`text-[11px] font-medium shrink-0 ${d?"text-[#c2620a]":"text-[#6f8f00]"}`,title:s("adCard.browserDependencyTooltip"),children:d?S:s("adCard.nextRepost",{time:S})})})():e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 bg-gray-100 border border-gray-200 rounded-full px-2 py-0.5 shrink-0",children:s("adCard.off")})]}),(ve||Ze)&&j&&e.jsx("div",{className:"mt-1 text-[11px]",children:Ze?e.jsx("span",{className:"text-orange-600 font-medium",children:s("adCard.executingCannotCancel")}):e.jsx("button",{type:"button",onClick:_s,disabled:Et,className:"text-red-600 hover:text-red-700 font-semibold underline underline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",children:s(Et?"adCard.cancellingScheduled":"adCard.cancelScheduled")})}),Re&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-[19rem] bg-white border border-[#d4d4d4] shadow-lg rounded-sm p-3 z-40 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-gray-700 uppercase tracking-wide",children:s("adCard.repostMode")}),e.jsx("button",{type:"button",onClick:()=>je(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(ee,{className:"w-4 h-4"})})]}),Me?e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-sm px-2.5 py-2.5 text-[11px] text-red-700 leading-snug",children:[e.jsx("p",{className:"font-semibold mb-1",children:s("adCard.paidCategoryWarningTitle")}),e.jsx("p",{children:s("adCard.paidCategoryBlockSave")})]}):e.jsxs(e.Fragment,{children:[fs&&e.jsxs("div",{className:"relative bg-[#f2f7e6] border border-[#d4e39a] rounded-sm px-2.5 py-2 mb-3 text-[11px] text-[#5a6e00] leading-snug",children:[e.jsx("button",{type:"button",onClick:Ss,"aria-label":s("adCard.close"),className:"absolute top-1 right-1 text-[#7a9000] hover:text-[#5a6e00]",children:e.jsx(ee,{className:"w-3 h-3"})}),e.jsx("span",{className:"font-semibold",children:s("adCard.smartCalloutTitle")})," ",s("adCard.smartCalloutText")]}),(()=>{const d=[["smart",s("adCard.smartRecommended"),y.smart_repost,x.repost_schedule_smart_enabled],["manual",s("adCard.manual"),y.repost,x.repost_schedule_manual_enabled]].filter(([,,,S])=>S);return e.jsxs(e.Fragment,{children:[d.length>1&&e.jsx("div",{className:"grid grid-cols-2 gap-1 mb-2",children:d.map(([S,L,K])=>e.jsxs("button",{type:"button",onClick:()=>le(S),className:`py-1.5 text-[11px] font-semibold rounded-sm border transition-colors ${Z===S?"bg-[#A8C300] text-white border-[#A8C300]":"bg-white text-gray-600 border-gray-200 hover:border-[#A8C300]"}`,children:[L,b.enabled&&e.jsx("span",{className:`ml-1 font-normal ${Z===S?"text-white/80":"text-gray-400"}`,children:s("adCard.creditCostHint",{count:K})})]},S))}),d.length===1&&e.jsx("p",{className:"text-[10px] text-gray-500 bg-gray-50 border border-gray-200 rounded-sm px-2 py-1 mb-2 leading-snug",children:s("adCard.modeUnavailable",{mode:x.repost_schedule_smart_enabled?s("adCard.manual"):s("adCard.smartRecommended")})})]})})(),Z==="smart"?e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:s("adCard.smartHint")}),e.jsxs("div",{className:"text-[11px] text-gray-500 bg-gray-50 border border-gray-200 rounded-sm px-2.5 py-1.5",children:[s("adCard.nextRepostLabel")," ",e.jsx("span",{className:"font-semibold text-gray-700",children:yt(Xt(t.lastPostedAt?new Date(t.lastPostedAt).getTime():Date.now()),!0,s,A.language)}),e.jsxs("span",{className:"text-gray-400",children:[" (",s("adCard.smartWeeklyNote"),")"]})]}),x.repost_smart_variations_enabled&&e.jsxs("div",{className:"space-y-1.5 border border-gray-100 rounded-sm p-2",children:[e.jsx("span",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-wide",children:s("adCard.variationsOptional")}),e.jsx("input",{value:xe,onChange:d=>ut(d.target.value),placeholder:s("adCard.titleVariantA"),className:"w-full border border-gray-200 rounded-sm px-2 py-1 text-[11px] focus:outline-none focus:border-[#A8C300]"}),e.jsx("input",{value:u,onChange:d=>C(d.target.value),placeholder:s("adCard.titleVariantB"),className:"w-full border border-gray-200 rounded-sm px-2 py-1 text-[11px] focus:outline-none focus:border-[#A8C300]"}),e.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-gray-600",children:[e.jsx("input",{type:"checkbox",checked:B,onChange:d=>Ne(d.target.checked),className:"h-3.5 w-3.5"}),s("adCard.rotatePhotos")]}),e.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-gray-600",children:[s("adCard.lowerPriceBy"),e.jsx("input",{type:"number",min:0,max:90,value:ge,onChange:d=>Te(Math.max(0,Math.min(90,Number(d.target.value)||0))),className:"w-14 border border-gray-200 rounded-sm px-1.5 py-0.5 text-[11px] focus:outline-none focus:border-[#A8C300]"}),s("adCard.perRepost")]})]}),x.repost_smart_variations_enabled&&!js&&e.jsx("p",{className:"text-[10px] text-amber-700 bg-amber-50 border border-amber-200 rounded-sm px-2 py-1 leading-snug",children:s("adCard.noVariationTip")})]}):e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"grid grid-cols-3 gap-1 mb-2",children:Ma.map(d=>e.jsx("button",{type:"button",onClick:()=>
28ce(d.value),className:`py-1 text-[11px] font-semibold rounded-sm border transition-colors ${de===d.value?"bg-[#A8C300] text-white border-[#A8C300]":"bg-white text-gray-600 border-gray-200 hover:border-[#A8C300]"}`,children:s(`adCard.${d.labelKey}`)},d.value))}),e.jsxs("div",{className:"text-[11px] text-gray-500 bg-gray-50 border border-gray-200 rounded-sm px-2.5 py-1.5",children:[s("adCard.nextRepostLabel")," ",e.jsx("span",{className:"font-semibold text-gray-700",children:yt(new Date(Date.now()+de*6e4).toISOString(),!0,s,A.language)}),e.jsxs("span",{className:"text-gray-400",children:[" (",s("adCard.browserDependencyNote"),")"]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[ve&&e.jsx("button",{type:"button",onClick:As,disabled:xt,className:"px-3 py-1.5 text-[11px] font-semibold text-red-600 hover:bg-red-50 rounded-sm transition-colors",children:s("adCard.removeSchedule")}),e.jsx("button",{type:"button",onClick:Cs,disabled:xt,className:"ml-auto px-3 py-1.5 bg-[#A8C300] hover:bg-[#96ae00] disabled:bg-gray-300 text-white font-bold rounded-sm text-[11px] transition-colors",children:s(xt?"adCard.saving":"adCard.save")})]})]})]})]}),e.jsxs("div",{className:"hidden md:grid grid-cols-2 gap-1.5 w-full",children:[x.ai_optimize_enabled&&e.jsxs("div",{className:"relative w-full group",children:[e.jsxs("button",{onClick:()=>r(t.id),title:b.enabled&&h!==void 0&&h<y.ai_optimization?s("adCard.notEnoughCredits",{cost:y.ai_optimization,balance:h}):b.enabled?`${s("adCard.aiOpt")} ${s("adCard.creditCostHint",{count:y.ai_optimization})}`:s("adCard.aiOpt"),disabled:b.enabled&&h!==void 0&&h<y.ai_optimization,className:`w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap ${b.enabled&&h!==void 0&&h<y.ai_optimization?"border-gray-200 text-gray-300 cursor-not-allowed bg-gray-50":"border-green-600 text-green-700 hover:bg-green-50"}`,children:[e.jsx(Se,{className:`w-3.5 h-3.5 shrink-0 ${b.enabled&&h!==void 0&&h<y.ai_optimization?"text-gray-300":"text-green-600"}`}),e.jsx("span",{children:s("adCard.aiOptShort")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-48",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.ai.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.ai.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.creditCost",{count:y.ai_optimization})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),x.ai_photo_check_enabled&&e.jsxs("div",{className:"relative w-full group",children:[e.jsxs("button",{onClick:async()=>{Ie(!0),W(!0),F(null),$(null);try{const d=await jt(String(t.id),s);$(d)}catch(d){F(d.message)}W(!1)},disabled:D,title:s("adCard.photoCheckTitle"),className:"w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50 disabled:opacity-50",children:[e.jsx(ft,{className:"w-3.5 h-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{children:s(D?"adCard.photoCheckAnalyzing":"adCard.photoCheck")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-48",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.photo.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.photo.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.creditCost",{count:y.photo_check})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),e.jsxs("div",{className:"relative w-full group",children:[e.jsxs("button",{onClick:_t,title:b.enabled&&h!==void 0&&h<y.quick_edit?s("adCard.notEnoughCredits",{cost:y.quick_edit,balance:h}):s("adCard.quickEditTooltip"),disabled:b.enabled&&h!==void 0&&h<y.quick_edit,className:`w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap ${b.enabled&&h!==void 0&&h<y.quick_edit?"border-gray-200 text-gray-300 cursor-not-allowed bg-gray-50":"border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50"}`,children:[e.jsx(Is,{className:"w-3.5 h-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{children:s("adCard.quickEditShort")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-56",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.quickEdit.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.quickEdit.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.credit
28Cost",{count:y.quick_edit})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),Oe&&e.jsxs("div",{className:"col-span-2 border border-gray-200 rounded-sm p-2.5 mt-1 bg-gray-50 space-y-2",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:s("adCard.quickEditHint")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{type:"text",inputMode:"decimal",value:Ae,onChange:d=>He(d.target.value),disabled:fe,placeholder:s("adCard.quickEditPricePlaceholder"),className:"w-full border border-gray-200 rounded-sm px-2 py-1 text-[11px] focus:outline-none focus:border-[#A8C300] disabled:bg-gray-100 disabled:text-gray-400"}),e.jsx("span",{className:"text-[11px] text-gray-400 self-center",children:"â¬"})]}),e.jsx("textarea",{value:Ue,onChange:d=>Ve(d.target.value),disabled:fe,rows:4,placeholder:s("adCard.quickEditDescriptionPlaceholder"),className:"w-full border border-gray-200 rounded-sm px-2 py-1.5 text-[11px] focus:outline-none focus:border-[#A8C300] resize-none disabled:bg-gray-100 disabled:text-gray-400"}),it&&e.jsxs("div",{className:"p-2 bg-green-50 border border-green-200 rounded-sm text-[11px] text-green-700 font-medium flex items-center gap-1.5",children:[e.jsx(Be,{className:"w-3.5 h-3.5 text-green-600 shrink-0"}),e.jsx("span",{children:s("adCard.quickEditSuccess")})]}),ue&&e.jsx("p",{className:"text-[10px] text-red-500 leading-snug",children:ue}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>Le(!1),disabled:fe,className:"px-3 py-1.5 text-[11px] font-semibold text-gray-500 hover:bg-gray-100 rounded-sm transition-colors disabled:opacity-50",children:s("adCard.cancel")}),e.jsx("button",{type:"button",onClick:dt,disabled:fe,className:"px-3 py-1.5 bg-[#A8C300] hover:bg-[#96ae00] disabled:bg-gray-300 text-white font-bold rounded-sm text-[11px] transition-colors flex items-center gap-1.5",children:fe?e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:s("adCard.saving")})]}):s("adCard.save")})]})]}),n&&x.enableCategoryCheck&&e.jsxs("div",{className:"relative w-full group",children:[e.jsxs("button",{onClick:()=>n(t.id),title:b.enabled&&h!==void 0&&h<(y.category_check??2)?s("adCard.notEnoughCredits",{cost:y.category_check??2,balance:h}):b.enabled?`${s("adCard.checkCategory")} ${s("adCard.creditCostHint",{count:y.category_check??2})}`:s("adCard.checkCategory"),disabled:b.enabled&&h!==void 0&&h<(y.category_check??2),className:`w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap ${b.enabled&&h!==void 0&&h<(y.category_check??2)?"border-gray-200 text-gray-300 cursor-not-allowed bg-gray-50":"border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50"}`,children:[e.jsx(at,{className:`w-3.5 h-3.5 shrink-0 ${b.enabled&&h!==void 0&&h<(y.category_check??2)?"text-gray-300":"text-gray-500"}`}),e.jsx("span",{children:s("adCard.checkCategoryShort")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-48",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.category.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.category.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.creditCost",{count:y.category_check??2})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),e.jsxs("div",{className:"relative w-full group",children:[e.jsxs("button",{onClick:async()=>{Ie(!0),W(!0),F(null),$(null);try{const d=await jt(String(t.id),s);$(d)}catch(d){F(d.message)}W(!1)},disabled:D,title:s("adCard.photoCheckTitle"),className:"w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50 disabled:opacity-50",children:[e.jsx(ft,{className:"w-3.5 h-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{children:s(D?"adCard.photoCheckAnalyzing":"adCard.photoCheck")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-48",children:[e.jsxs("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg",children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.photo.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.photo.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.credit
28Cost",{count:y.photo_check})})]}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),x.position_check_enabled&&(()=>{const d=Qe,S=!z,K=se||d||S||ot;let q=null;d?q=t.listingState==="deleted"?s("adCard.positionAdDeleted"):s("adCard.positionAdReserved"):S&&(q=s("adCard.positionNeedCredits"));const re=!!_&&!se;return e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{onClick:()=>void lt(!1),disabled:K,className:`w-full border rounded-sm py-1.5 px-1 font-medium text-[11px] flex items-center justify-center gap-1 transition-colors whitespace-nowrap ${K&&!re?"border-gray-200 text-gray-300 cursor-not-allowed bg-gray-50":re?"border-blue-300 text-blue-700 bg-blue-50 hover:bg-blue-100":"border-gray-300 text-gray-700 hover:border-blue-500 hover:text-blue-600 hover:bg-blue-50"}`,children:[e.jsx(sa,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{children:se?s("adCard.positionChecking"):re&&_.found&&_.position!=null?`#${_.position} / ${_.totalOnPage}`:re?s("adCard.positionResultNotRanked",{total:_.totalOnPage||ye}):s("adCard.positionCheckShort")})]}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none w-56",children:[e.jsx("div",{className:"bg-gray-900 text-white text-[11px] rounded px-2.5 py-2 leading-snug shadow-lg space-y-1",children:re?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-semibold text-white",children:_.found&&_.position!=null?`Rank #${_.position} of ${_.totalOnPage} results`:`Not found in top ${_.totalOnPage||ye} results`}),e.jsx("p",{className:"text-white/60 break-all",children:_.searchUrl||_.searchQuery}),e.jsx("p",{className:"text-white/50",children:s("adCard.positionCheckedAgo",{time:Fe(_.checkedAt,s)})}),e.jsxs("p",{className:"text-[#c8e000] font-medium pt-0.5",children:[s("adCard.positionCheckShort")," again",b.enabled?` (â${Pe} credits)`:""]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-semibold mb-0.5",children:s("adCard.infoDialog.rank.title")}),e.jsx("p",{className:"text-white/75",children:s("adCard.infoDialog.rank.body")}),b.enabled&&e.jsx("p",{className:"mt-1 text-[#c8e000] font-medium",children:s("adCard.infoDialog.rank.creditCost",{count:Pe})})]})}),e.jsx("div",{className:"w-2 h-2 bg-gray-900 rotate-45 mx-auto -mt-1"})]})]}),q&&e.jsx("span",{className:"text-[10px] text-center text-gray-400 leading-tight px-0.5",children:q}),oe&&!q&&e.jsx("span",{className:"text-[10px] text-center text-red-500 leading-tight px-0.5",children:oe}),re&&!q&&!oe&&e.jsx("span",{className:"text-[10px] text-center text-gray-400 leading-tight px-0.5",children:s("adCard.positionCheckedAgo",{time:Fe(_.checkedAt,s)})})]})})(),x.ai_price_suggestion_enabled&&!Ct(t)&&e.jsx(Gt,{ad:t})]}),e.jsx("div",{className:"flex md:hidden mt-auto w-full",children:e.jsx("button",{onClick:()=>U(!0),className:"w-full min-h-[44px] flex justify-center items-center gap-1.5 text-[13px] font-semibold text-[#333] bg-[#f2f2f2] border border-[#ccc] hover:bg-[#e6e6e6] rounded-sm py-2 transition-colors",children:s("adCard.actions")})})]}),ne&&x.analytics_enabled&&e.jsxs("div",{className:"border-t border-ka-green/20 bg-green-50/40 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-[12px] font-semibold text-ka-green-text uppercase tracking-wider",children:s("adCard.repostPerformance")}),e.jsx("button",{onClick:()=>ie(!1),"aria-label":s("adCard.close"),className:"text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx(ee,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto",children:[{date:s("adCard.today"),views:12,messages:2,time:"14:30"},{date:s("adCard.yesterday"),views:8,messages:1,time:"10:15"},{date:s("adCard.daysAgo",{count:2}),views:15,messages:3,time:"09:00"}].map((d,S)=>e.jsxs("div",{className:"bg-white rounded border border-ka-green/20 p-2 text-[11px]",children:[e.jsxs("div",{className:"flex justify-between items-start mb-1",children:[e.jsx("span",{className:"font-semibold text-gray-800",children:d.date}),e.jsx("span",{className:"text-gray-500 text-[10px]",children:d.time})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:s("adCard.views")}),e.jsx("span",{className:"font-bold text-ka-green-text ml-1",children:d.views})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:s("adCard.messages")}),e.jsx("span",{className:"font-bold text-ka-green-text ml-1",children:d.messages})]})]})]},S))})]}),ne&&!x.analytics_enabled&&e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-3 text-center",children:e.jsx("p",{className:"text-[12px] text-gray-500",children:s("adCard.analyticsDisabled")})}),e.jsx(Sa,{isOpen:me,onClose:()=>Ie(!1),feedback:Y,photos:(()=>{const d=(t.pictures||t.images||t.pictureUrls||[]).filter(S=>S);return d.length===0&&(t.image||t.adImage)?[t.image||t.adImage]:d})(),isLoading:D,error:M,onRetry:void 0}),H&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-end justify-center",children:[e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-xs transition-opacity animate-in fade-in duration-200",onClick:()=>U(!1)}),e.jsxs("div",{className:"relative w-full max-w-[500px] bg-white rounded-t-2xl p-5 shadow-2xl z-10 flex flex-col gap-3 animate-in slide-in-from-bottom duration-200 max-h-[85vh] overflow-y-auto",children:[e.jsx("div",{className:"w-12 h-1 bg-gray-300 rounded-full mx-auto mb-2"}),e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("h3",{className:"font-bold text-gray-800 text-[16px]",children:s("adCard.adOptions")}),e.jsx("button",{onClick:()=>U(!1),className:"p-3 -m-1.5 rounded-full hover:bg-gray-100 text-gray-500 hover:text-gray-700 transition-colors",children:e.jsx(ee,{className:"w-5 h-5"})})]}),e.jsx("p",{className:"text-[12px] text-gray-500 mb-2 border-b border-gray-100 pb-2 truncate",children:t.title}),x.ai_optimize_enabled&&e.jsxs("button",{onClick:()=>
28{U(!1),r(t.id)},className:"flex items-center justify-center gap-2.5 w-full py-3 px-4 border border-green-600 text-green-700 rounded-lg hover:bg-green-50 font-semibold text-sm transition-colors",children:[e.jsx(Se,{className:"w-4 h-4 text-green-600"}),e.jsx("span",{children:s("adCard.startAiOpt")}),b.enabled&&e.jsx("span",{className:"text-xs font-normal text-green-600/70",children:s("adCard.creditCostHint",{count:y.ai_optimization})})]}),n&&x.enableCategoryCheck&&e.jsxs("button",{onClick:()=>{U(!1),n(t.id)},className:"flex items-center justify-center gap-2.5 w-full py-3 px-4 border border-gray-300 text-gray-700 rounded-lg hover:bg-blue-50 hover:border-blue-500 hover:text-blue-600 font-semibold text-sm transition-colors",children:[e.jsx(at,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{children:s("adCard.checkCategory")}),b.enabled&&e.jsx("span",{className:"text-xs font-normal text-gray-500",children:s("adCard.creditCostHint",{count:y.category_check??2})})]}),x.ai_photo_check_enabled&&e.jsxs("button",{onClick:async()=>{U(!1),Ie(!0),W(!0),F(null),$(null);try{const d=await jt(String(t.id),s);$(d)}catch(d){F(d.message)}W(!1)},disabled:D,className:"flex items-center justify-center gap-2.5 w-full py-3 px-4 border border-gray-300 text-gray-700 rounded-lg hover:bg-blue-50 hover:border-blue-500 hover:text-blue-600 font-semibold text-sm transition-colors disabled:opacity-50",children:[e.jsx(ft,{className:"w-4 h-4","aria-hidden":!0}),e.jsx("span",{children:s(D?"adCard.photoCheckAnalyzing":"adCard.photoCheck")})]}),x.ai_price_suggestion_enabled&&!Ct(t)&&e.jsx(Gt,{ad:t,size:"lg"}),e.jsxs("button",{disabled:!0,className:"w-full py-3 px-4 rounded-lg font-semibold text-sm flex items-center justify-center gap-2 border border-gray-200 text-gray-400 bg-gray-50/50 cursor-not-allowed",title:s("adCard.comingSoon"),children:[e.jsx("span",{children:"Vinted (Beta)"}),e.jsx("span",{className:"text-xs font-normal",children:s("adCard.comingSoonShort")})]}),e.jsxs("button",{disabled:!0,title:s("adCard.ebayComingSoon"),className:"flex items-center justify-center gap-2.5 w-full py-3 px-4 border border-gray-200 text-gray-300 bg-gray-50/50 rounded-lg font-semibold text-sm cursor-not-allowed",children:[e.jsx(cs,{}),e.jsxs("span",{children:["eBay ",e.jsx("span",{className:"text-xs font-normal",children:s("adCard.comingSoonShort")})]})]}),e.jsx("button",{onClick:()=>U(!1),className:"w-full py-3 px-4 mt-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 font-semibold text-sm transition-colors",children:s("adCard.cancel")})]})]}),ae&&e.jsx(Ia,{adTitle:t.title,onCancel:()=>O(!1),onConfirm:Ye}),Ns&&e.jsx(Oa,{categoryName:vs,onClose:()=>pt(null)}),ws&&e.jsx(La,{onClose:()=>gt(!1)}),Ot&&e.jsx($a,{views:Dt,favorites:Rt,messages:Tt,onCancel:()=>et(null),onConfirm:ks})]})}function Ha({ads:t,onAction:a,onAIOptimize:r,onCheckCategory:n,onPriceCheck:i,onSchedule:l,onEbayCrossPost:c,onConnectEbay:m,isEbayConnected:g,onUpdateFields:f,onCancelScheduledRepost:j,aiBlocked:N=!1,aiWarning:k=!1,creditsBalance:h,repostRunningId:p=null,repostQueuedIds:w=[],onCancelRepost:v}){const P=p!==null||w.length>0;return e.jsx("div",{className:"space-y-3",children:t.map(s=>{const A=p===s.id?"running":w.includes(s.id)?"queued":"idle",x=w.indexOf(s.id);return e.jsx(qa,{ad:s,onAction:a,onAIOptimize:r,onCheckCategory:n,onPriceCheck:i,onSchedule:l,onEbayCrossPost:c,onConnectEbay:m,isEbayConnected:g,onUpdateFields:f,onCancelScheduledRepost:j,aiBlocked:N,aiWarning:k,creditsBalance:h,repostState:A,repostBusy:P,repostQueuePosition:x>=0?x+1:0,onCancelRepost:v},s.id)})})}function Ua({optimizePanelAdId:t,panelAd:a,isPanelLoading:r,panelData:n,panelError:i,loadedFromCache:l,appliedTitle:c,appliedDescription:m,isApplyingTitle:g,isApplyingDescription:f,isApplyingAll:j,geminiHealth:N,creditsEnabled:k,creditsBalance:h,onClose:p,onStartOptimization:w,onApplyTitle:v,onApplyDescription:P,onApplyAll:s,onPriceCheck:A}){const{t:x}=te();return e.jsxs("div",{className:`fixed top-0 right-0 h-full bg-white shadow-2xl z-[60] transition-transform duration-300 ease-in-out border-l border-[#e5e5e5] flex flex-col ${t?"translate-x-0":"translate-x-full"} w-full md:w-[380px]`,children:[e.jsxs("div",{className:"px-5 py-4 border-b border-[#e5e5e5] flex justify-between items-center bg-[#F9FAFB]",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-700 font-bold text-[16px]",children:[e.jsx(Se,{className:"w-5 h-5 text-green-600 animate-pulse"}),e.jsx("span",{children:x("kiPanel.title")}),e.jsx("span",{title:x(N==="ok"?"kiPanel.geminiConnected":N==="error"?"kiPanel.geminiError":"kiPanel.geminiChecking"),className:`w-2.5 h-2.5 rounded-full ml-1 transition-colors ${N==="ok"?"bg-green-400":N==="error"?"bg-red-400 animate-pulse":"bg-gray-300"}`})]}),e.jsx("button",{onClick:p,className:"text-gray-500 hover:text-red-600 hover:bg-red-50 p-1.5 rounded-full transition-all duration-200 cursor-pointer flex items-center justify-center border border-transparent hover:border-red-200","aria-label":x("kiPanel.close"),title:x("kiPanel.close"),children:e.jsx(ee,{className:"w-[20px] h-[20px]"})})]}),k&&e.jsxs("div",{className:`px-5 py-2 border-b text-[12px] flex items-center justify-between gap-3 ${h<2?"bg-red-50 border-red-200":"bg-gray-50 border-[#e5e5e5]"}`,children:[e.jsx("span",{className:`font-medium ${h<2?"text-red-600":"text-gray-500"}
28`,children:h<2?x("kiPanel.notEnoughCredits"):x("kiPanel.creditCost",{cost:2})}),e.jsx("span",{className:"text-gray-400 font-mono whitespace-nowrap",children:x("kiPanel.creditsBalance",{balance:h})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-6",children:[l&&n&&!r&&e.jsxs("div",{className:"bg-blue-50 border border-blue-200 text-blue-850 text-[12px] p-2.5 rounded-sm flex items-center justify-between gap-2 shadow-xxs",children:[e.jsx("span",{children:x("kiPanel.loadedFromCache")}),e.jsxs("button",{onClick:()=>a&&w(a,!0),disabled:r,className:"text-blue-700 hover:text-blue-900 font-bold hover:underline shrink-0 flex items-center gap-1 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:no-underline",children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:x("kiPanel.regenerate")})]})]}),a&&e.jsxs("div",{className:"flex gap-3 p-3 bg-gray-50 border border-gray-200 rounded-sm",children:[e.jsx("div",{className:"shrink-0 w-[60px] h-[50px] bg-white border border-gray-100 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:a.image,alt:a.title,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-semibold text-gray-700 truncate",children:a.title}),e.jsx("div",{className:"text-[11px] text-gray-500 font-medium",children:a.category})]})]}),r?e.jsxs("div",{className:"space-y-6 animate-pulse",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-1/3"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-1/2"}),e.jsx("div",{className:"h-8 bg-gray-100 rounded-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-1/2"}),e.jsx("div",{className:"h-8 bg-gray-200 rounded-sm"})]})]}),e.jsx("div",{className:"h-8 bg-gray-200 rounded-sm w-full mt-2"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded-sm w-1/3"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-1/2"}),e.jsx("div",{className:"h-20 bg-gray-100 rounded-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 bg-gray-200 rounded-sm w-1/2"}),e.jsx("div",{className:"h-20 bg-gray-200 rounded-sm"})]})]}),e.jsx("div",{className:"h-8 bg-gray-200 rounded-sm w-full mt-2"})]}),e.jsx("div",{className:"h-10 bg-gray-100 rounded-sm w-full"})]}):i?e.jsxs("div",{className:"flex flex-col items-center text-center py-6 gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-red-50 flex items-center justify-center",children:e.jsx(rt,{className:"w-6 h-6 text-red-500"})}),e.jsxs("div",{className:"px-4",children:[e.jsx("p",{className:"text-[14px] font-semibold text-gray-800 mb-1",children:x("kiPanel.optimizationFailed")}),e.jsx("p",{className:"text-[12px] text-gray-500 leading-relaxed",children:x("kiPanel.serverBusy")})]}),e.jsxs("button",{onClick:()=>a&&w(a),className:"flex items-center gap-1.5 px-4 py-2 bg-[#A8C300] hover:bg-[#96ae00] text-white font-semibold text-[13px] rounded-sm transition-colors",children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),x("kiPanel.retry")]})]}):n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-[13px] font-bold text-gray-800 uppercase tracking-wider border-b border-gray-100 pb-1",children:x("kiPanel.adTitle")}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded-sm uppercase",children:x("kiPanel.current")}),e.jsx("p",{className:"text-[12px] text-gray-500 break-words leading-snug line-clamp-4",children:a==null?void 0:a.title})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-green-50 text-green-700 border border-green-200 px-1.5 py-0.5 rounded-sm uppercase",children:x("kiPanel.aiSuggestion")}),e.jsx("p",{className:"text-[12px] font-semibold text-gray-800 break-words leading-snug",children:n.improvedTitle})]})]}),c?e.jsxs("div",{className:"w-full flex items-center justify-center gap-1.5 bg-green-50 border border-green-200 text-green-700 py-1.5 rounded-sm text-[13px] font-medium",children:[e.jsx(Nt,{className:"w-4 h-4"}),e.jsx("span",{children:x("kiPanel.copied")})]}):e.jsxs("button",{onClick:v,disabled:g,className:"w-full bg-[#f2f2f2] hover:bg-[#e6e6e6] border border-[#ccc] text-[#333] font-semibold py-1.5 rounded-sm text-[13px] transition-colors flex items-center justify-center gap-1",children:[g&&e.jsx(Ce,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:x("kiPanel.copy")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-[13px] font-bold text-gray-800 uppercase tracking-wider border-b border-gray-100 pb-1",children:x("kiPanel.description")}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded-sm uppercase",children:x("kiPanel.current")}),e.jsx("div",{className:"text-[11px] text-gray-500 leading-relaxed overflow-y-auto max-h-[140px] break-words pr-1",children:(a==null?void 0:a.description)||x("kiPanel.noDescription")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-green-50 text-green-700 border border-green-200 px-1.5 py-0.5 rounded-sm uppercase",children:x("kiPanel.aiSuggestion")}),e.jsx("div",{className:"text-[11px] font-medium text-gray-800 leading-relaxed overflow-y-auto max-h-[140px] break-words pr-1",children:n.improvedDescription})]})]}),m?e.jsxs("div",{className:"w-full flex items-center justify-center gap-1.5 bg-green-50 border border-green-200 text-green-700 py-1.5 rounded-sm text-[13px] font-medium",children:[e.jsx(Nt,{className:"w-4 h-4"}),e.jsx("span",{children:x("kiPanel.copied")})]}):e.jsxs("button",{onClick:P,disabled:f,className:"w-full bg-[#f2f2f2] hover:bg-[#e6e6e6] border border-[#ccc] text-[#333] font-semibold py-1.5 rounded-sm text-[13px] transition-colors flex items-center justify-center gap-1",children:[f&&e.jsx(Ce,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:x("kiPanel.copy")})]})]}),e.jsxs("div",{className:"p-3 bg-green-50/50 border border-green-100 rounded-sm flex items-start gap-2",children:[e.jsx(Se,{className:"w-4 h-4 text-green-600 shrink-0 mt-0.5 animate-pulse"}),e.jsx("p",{className:"text-[12px] text-green-800 font-medium leading-normal",children:n.improvementSummary})]}),a&&!Ct(a)&&e.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[e.jsx("p",{className:"text-[12px] font-bold text-gray-600 uppercase tracking-wider mb-2",children:x("kiPanel.priceSuggestion")}),e.jsx(Bs,{adId:a.id,adTitle:a.title,currentPrice:a.price,onCheck:A,aiBlocked:k&&h<2})]})]})]}),n&&!r&&e.jsxs("div",{className:"p-4 border-t border-[#e5e5e5] bg-gray-50 flex flex-col gap-2",children:[e.jsxs("button",{onClick:s,disabled:j,className:"w-full bg-[#A8C300] hover:bg-[#96ae00] text-white font-bold py-2 rounded-sm text-[13px] transition-colors flex items-center justify-center gap-1.5 shadow-sm cursor-pointer",children:[j&&e.jsx(Ce,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:x("kiPanel.copyAll")})]}),e.jsxs("button",{onClick:()=>a&&w(a,!0),disabled:r,className:"w-full bg-white hover:bg-gray-50 text-gray-700 border border-gray-300 font-semibold py-2 rounded-sm text-[13px] transition-colors flex items-center justify-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(ke,{className:"w-3.5 h-3.5 text-gray-500"}),e.jsx("span",{children:x("kiPanel.regenerate")})]})]})]})}const Va="https://api.anzeigenboost.de/api";function Wa(){return localStorage.getItem("kb_session")||localStorage.getItem("token")}
28function Ka({ad:t,onClose:a,creditsEnabled:r,creditCost:n}){const{t:i}=te(),[l,c]=o.useState("confirm"),[m,g]=o.useState(null),[f,j]=o.useState(null),N=t.category||t.l1Category||"",k=n??2,h=async()=>{c("loading"),g(null),j(null);const w=Wa();if(!w){g(i("checkCategory.noSession")),c("error");return}try{const v=await fetch(`${Va}/ai/check-category`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${w}`},body:JSON.stringify({title:t.title||"",description:t.description||"",category:N})}),P=await v.json();if(!v.ok){g((P==null?void 0:P.message)||i("checkCategory.error")),c("error");return}j(P),c("done")}catch(v){g((v==null?void 0:v.message)||i("checkCategory.error")),c("error")}},p=!!(f!=null&&f.suggestedCategory)&&f.suggestedCategory!==N&&!f.currentCategoryOk;return e.jsxs("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/40",onClick:a}),e.jsxs("div",{className:"relative w-full max-w-[440px] bg-white rounded-xl shadow-2xl z-10 p-5 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-gray-800 text-[15px]",children:[e.jsx(at,{className:"w-4 h-4 text-green-600"}),e.jsx("span",{children:i("checkCategory.title")})]}),e.jsx("button",{onClick:a,className:"p-1.5 rounded-full hover:bg-gray-100 text-gray-500","aria-label":i("checkCategory.close"),children:e.jsx(ee,{className:"w-5 h-5"})})]}),l==="confirm"&&e.jsxs("div",{className:"py-3",children:[e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mb-1",children:i("checkCategory.introBody")}),e.jsx("p",{className:"text-[12px] text-gray-400 leading-relaxed mb-4",children:i("checkCategory.introAdvisoryNote")}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{onClick:h,className:"w-full bg-[#A8C300] hover:bg-[#96ae00] text-white font-bold py-2 rounded-sm text-[13px]",children:r?i("checkCategory.runWithCost",{count:k}):i("checkCategory.run")}),e.jsx("button",{onClick:a,className:"w-full bg-white hover:bg-gray-50 text-gray-700 border border-gray-300 font-semibold py-2 rounded-sm text-[13px]",children:i("checkCategory.cancel")})]})]}),l==="loading"&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-gray-500 text-[13px]",children:[e.jsx(Ce,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:i("checkCategory.checking")})]}),l==="error"&&e.jsxs("div",{className:"flex flex-col items-center text-center py-6 gap-2",children:[e.jsx(rt,{className:"w-6 h-6 text-red-500"}),e.jsx("p",{className:"text-[13px] text-gray-600",children:m}),e.jsx("button",{onClick:a,className:"mt-2 px-4 py-1.5 bg-gray-100 hover:bg-gray-200 rounded-sm text-[12px]",children:i("checkCategory.close")})]}),l==="done"&&f&&!p&&e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-green-50 flex items-center justify-center mx-auto mb-3",children:e.jsx(Nt,{className:"w-6 h-6 text-green-600"})}),e.jsx("p",{className:"text-[14px] font-semibold text-gray-800 mb-1",children:i("checkCategory.goodFitTitle")}),e.jsx("p",{className:"text-[12px] text-gray-500",children:i("checkCategory.goodFitBody",{category:N||"â"})}),f.reason&&e.jsxs("p",{className:"text-[12px] text-gray-400 mt-2 italic",children:["â",f.reason,"â"]}),e.jsx("button",{onClick:a,className:"mt-4 px-5 py-2 bg-[#A8C300] hover:bg-[#96ae00] text-white rounded-sm text-[13px] font-semibold",children:i("checkCategory.gotIt")})]}),l==="done"&&f&&p&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded-sm uppercase mb-1",children:i("checkCategory.current")}),e.jsx("p",{className:"text-[13px] text-gray-500 break-words leading-snug",children:N||"â"})]}),e.jsx(ta,{className:"w-4 h-4 text-gray-300 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"inline-block text-[10px] font-bold bg-green-50 text-green-700 border border-green-200 px-1.5 py-0.5 rounded-sm uppercase mb-1",children:i("checkCategory.suggested")}),e.jsx("p",{className:"text-[13px] font-semibold text-green-700 break-words leading-snug",children:f.suggestedCategory})]})]}),e.jsxs("div",{className:"p-3 bg-green-50/50 border border-green-100 rounded-sm text-[12px] text-gray-700 leading-relaxed mb-3",children:[e.jsx("span",{className:"font-semibold text-green-700",children:i("checkCategory.reasonLabel")})," ",f.reason||"â"]}
28),e.jsx("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-sm text-[12px] text-amber-800 leading-relaxed mb-4",children:i("checkCategory.howToApply")}),e.jsx("button",{onClick:a,className:"w-full bg-[#A8C300] hover:bg-[#96ae00] text-white font-bold py-2 rounded-sm text-[13px]",children:i("checkCategory.gotIt")})]})]})]})}function Qa({adId:t,onClose:a}){const{t:r}=te();if(t===null)return null;const n=i=>{i.preventDefault(),a()};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-[#333] bg-opacity-50",children:e.jsxs("div",{className:"bg-white rounded-sm shadow-xl w-full max-w-sm overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"px-5 py-3 border-b border-[#e5e5e5] flex justify-between items-center",children:[e.jsxs("h3",{className:"text-[16px] font-semibold text-[#333] flex items-center gap-2",children:[e.jsx(aa,{className:"w-4 h-4 text-[#7C3AED]"})," ",r("scheduleModal.title")]}),e.jsx("button",{onClick:a,className:"text-[#666] hover:text-[#333]",children:e.jsx(ee,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:n,className:"p-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-semibold text-[#333] mb-1",children:r("scheduleModal.interval")}),e.jsxs("select",{className:"w-full border border-[#ccc] rounded-sm px-3 py-2 text-[13px] focus:outline-none focus:border-[#7C3AED]",children:[e.jsx("option",{children:r("scheduleModal.daily")}),e.jsx("option",{children:r("scheduleModal.every3days")}),e.jsx("option",{children:r("scheduleModal.weekly")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-semibold text-[#333] mb-1",children:r("scheduleModal.when")}),e.jsx("input",{type:"time",defaultValue:"18:00",className:"w-full border border-[#ccc] rounded-sm px-3 py-2 text-[13px] focus:outline-none focus:border-[#7C3AED]"})]}),e.jsxs("div",{className:"pt-2 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-[13px] font-medium text-[#333] bg-[#f2f2f2] border border-[#ccc] hover:bg-[#e6e6e6] rounded-sm transition-colors",children:r("scheduleModal.cancel")}),e.jsx("button",{type:"submit",className:"px-3 py-1.5 text-[13px] font-medium text-white bg-[#7C3AED] hover:bg-purple-700 rounded-sm transition-colors",children:r("scheduleModal.save")})]})]})]})})}function Ya(t,a){if(!t)return"";const r=Math.max(0,Math.round((Date.now()-new Date(t).getTime())/6e4));if(r<60)return a("wettbewerb.card.minutesAgo",{count:r});const n=Math.round(r/60);if(n<24)return a("wettbewerb.card.hoursAgo",{count:n});const i=Math.round(n/24);return i===1?a("wettbewerb.card.dayAgo",{count:i}):a("wettbewerb.card.daysAgo",{count:i})}function es({open:t,variant:a,onClose:r,retryAt:n,limitPerDay:i=5,lastPostedAt:l}){const{t:c,i18n:m}=te();if(!t)return null;const g=n?new Date(n).toLocaleTimeString(m.language==="en"?"en-US":"de-DE",{hour:"2-digit",minute:"2-digit"}):"",f=c(a==="same_ad_cooldown"?"repostLimits.cooldownTitle":a==="daily_budget_exhausted"?"repostLimits.dailyTitle":"repostLimits.eduTitle");return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-lg w-full p-6 relative",children:[e.jsx("button",{onClick:r,"aria-label":c("repostLimits.eduButton"),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600",children:e.jsx(ee,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx(Os,{className:"w-6 h-6 text-[#A8C300] shrink-0 mt-0.5"}),e.jsx("h2",{className:"text-lg font-bold text-[#333] pr-6",children:f})]}),a==="same_ad_cooldown"&&e.jsx("p",{className:"text-[14px] text-gray-700 leading-relaxed mb-4",children:e.jsx(wt,{i18nKey:"repostLimits.cooldownBody",values:{ago:Ya(l,c),time:g},components:[e.jsx("strong",{},"0"),e.jsx("strong",{},"1")]})}),a==="daily_budget_exhausted"&&e.jsx("p",{className:"text-[14px] text-gray-700 leading-relaxed mb-4",children:c("repostLimits.dailyBody",{limit:i})}),e.jsx("p",{className:"text-[14px] text-gray-700 mb-2",children:c("repostLimits.eduIntro")}),e.jsxs("ul",{className:"text-[14px] text-gray-700 list-disc pl-5 mb-3 space-y-1",children:[e.jsx("li",{children:c("repostLimits.eduRule1")}),e.jsx("li",{children:c("repostLimits.eduRule2",{limit:i})})]}),e.jsx("p",{className:"text-[13px] text-gray-600 leading-relaxed mb-3",children:c("repostLimits.eduWhy")}),e.jsx("p",{className:"text-[13px] text-gray-700 leading-relaxed mb-5",children:e.jsx(wt,{i18nKey:"repostLimits.eduProtect",components:[e.jsx("strong",{},"0")]})}),e.jsx("button",{onClick:r,className:"w-full px-4 py-2.5 bg-[#A8C300] hover:bg-[#96ae00] text-white font-semibold text-[14px] rounded-sm transition-colors",children:c(a==="education"?"repostLimits.eduButton":"repostLimits.c
28ooldownButton")})]})})}const Ga="https://api.anzeigenboost.de/api";function Xa(){return localStorage.getItem("kb_session")||localStorage.getItem("token")}const kt={allowed:!0,usedToday:0,limitPerDay:5,exempt:!1};async function Ja(){const t=await fetch(`${Ga}/ads/repost-limits`,{headers:{Authorization:`Bearer ${Xa()}`}});return t.ok?t.json():kt}function Za(t=!0){const a=Ls(),{data:r,isLoading:n}=$s({queryKey:["repost-limits"],queryFn:Ja,placeholderData:c=>c??kt,staleTime:3e4,refetchOnWindowFocus:!0,refetchOnReconnect:!0,enabled:t}),i=o.useCallback(()=>{a.invalidateQueries({queryKey:["repost-limits"]})},[a]),l=r??kt;return{...l,remaining:Math.max(0,l.limitPerDay-l.usedToday),isLoading:n,invalidate:i}}const us="onboarding_checklist_dismissed";function er(){try{return localStorage.getItem(us)==="true"}catch{return!1}}function tr(t){const a=t.isConnected,r=t.hasAds,n=t.hasRepostProof,[i,l]=o.useState(er),c=o.useCallback(()=>{try{localStorage.setItem(us,"true")}catch{}l(!0)},[]);return o.useMemo(()=>{const m=[a,r,n].filter(Boolean).length,g=m===3;return{connected:a,synced:r,reposted:n,allDone:g,doneCount:m,dismissed:i,show:!g&&!i,dismiss:c}},[a,r,n,i,c])}function sr({onboarding:t,onSync:a,onCreateWithAi:r}){const{t:n}=te();if(!t.show)return null;const i=l=>`flex items-center gap-2 px-3 py-2 rounded-sm text-[13px] ${l?"text-[#5a6e00]":"text-[#333]"}`;return e.jsxs("div",{className:"relative bg-white border border-[#e5e5e5] rounded-sm shadow-sm mb-5 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-[#eef0f2] pl-4 pr-9 py-2.5",children:[e.jsx("p",{className:"text-[13px] font-semibold text-[#333]",children:n("onboarding.title")}),e.jsx("span",{className:"text-[11px] font-medium text-[#888]",children:n("onboarding.progress",{done:t.doneCount,total:3})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row divide-y sm:divide-y-0 sm:divide-x divide-[#eef0f2]",children:[e.jsxs("div",{className:`${i(t.connected)} sm:flex-1 sm:justify-center`,children:[t.connected?e.jsx(Be,{className:"w-4 h-4 shrink-0 text-[#7a9000]"}):e.jsx(na,{className:"w-4 h-4 shrink-0 text-[#bbb]"}),e.jsx("span",{children:n("onboarding.stepConnect")})]}),e.jsxs("div",{className:`${i(t.synced)} sm:flex-1 sm:justify-center`,children:[t.synced?e.jsx(Be,{className:"w-4 h-4 shrink-0 text-[#7a9000]"}):e.jsx(ke,{className:"w-4 h-4 shrink-0 text-[#bbb]"}),e.jsx("span",{children:n("onboarding.stepSync")}),!t.synced&&e.jsx("button",{onClick:a,className:"ml-1 text-[12px] font-semibold text-[#A8C300] hover:text-[#96ae00] underline underline-offset-2",children:n("onboarding.syncNow")})]}),e.jsxs("div",{className:`${i(t.reposted)} sm:flex-1 sm:justify-center`,children:[t.reposted?e.jsx(Be,{className:"w-4 h-4 shrink-0 text-[#7a9000]"}):e.jsx(Se,{className:"w-4 h-4 shrink-0 text-[#bbb]"}),e.jsx("span",{children:n("onboarding.stepRepost")}),!t.reposted&&t.synced&&e.jsx("button",{onClick:r,className:"ml-1 text-[12px] font-semibold text-[#A8C300] hover:text-[#96ae00] underline underline-offset-2",children:n("onboarding.boostAd")})]})]}),e.jsx("button",{onClick:t.dismiss,className:"absolute top-2 right-2 text-[#999] hover:text-[#333] p-0.5","aria-label":n("onboarding.dismiss"),title:n("onboarding.dismiss"),children:e.jsx(ee,{className:"w-4 h-4"})})]})}const ar="https://chromewebstore.google.com/detail/noagiapohlenpolcbeghlmngalapbobe/reviews",xs="review_request_state",rr=3,nr=14*24*60*60*1e3;function ir(){try{const t=localStorage.getItem(xs);return t?t==="done"?!0:Date.now()-Number(t)<nr:!1}catch{return!1}}function or({successfulReposts:t}){const{t:a}=te(),[r,n]=o.useState(ir);if(r||t<rr)return null;const i=l=>{try{localStorage.setItem(xs,l)}catch{}n(!0)};return e.jsxs("div",{className:"relative bg-white dark:bg-[#2b2e32] border border-[#d8e59a] rounded-sm mb-5 px-4 py-3 pr-9 flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[e.jsx(Js,{className:"w-4 h-4 mt-0.5 shrink-0 text-[#f5b301] fill-[#f5b301]","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-semibold text-[#333] dark:text-[#f5f5f5]",children:a("reviewRequest.title",{count:t})}),e.jsx("p",{className:"text-[12px] text-[#666] dark:text-[#aaa]",children:a("reviewRequest.body")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("a",{href:ar,target:"_blank",rel:"noopener noreferrer",onClick:()=>i("done"),className:"bg-[#A8C300] hover:bg-[#96ad00] text-white text-[13px] font-semibold px-3 py-1.5 rounded-sm",children:a("reviewRequest.cta")}),e.jsx("button",{onClick:()=>i(String(Date.now())),className:"text-[12px] text-[#666] dark:text-[#aaa] hover:underline px-2 py-1.5",children:a("reviewRequest.later")})]}),e.jsx("button",{onClick:()=>i(String(Date.now())),className:"absolute top-2 right-2 text-[#999] hover:text-[#333] p-0.5","aria-label":a("reviewRequest.later"),children:e.jsx(ee,{className:"w-4 h-4"})})]})}const ms="import_result_dismissed_at",lr=3*24*60*60*1e3;function dr(){try{return localStorage.getItem(ms)}catch{return null}}function cr(){const{t}=te(),{lastImport:a}=is(),[r,n]=o.useState(dr);if(!a||!a.failed&&a.skipped===0||Date.now()-Date.parse(a.at)>lr||r===a.at)return null;const i=()=>{try{localStorage.setItem(ms,a.at)}catch{}n(a.at)};return e.jsxs("div",{className:"relative bg-orange-50 border border-orange-200 rounded-sm mb-5 px-4 py-3 pr-9 flex items-start gap-2",children:[e.jsx(nt,{className:"w-4 h-4 mt-0.5 shrink-0 text-orange-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-semibold text-[#333]",children:a.failed?t("importResult.failedTitle",{total:a.total}):t("importResult.partialTitle",{imported:a.imported,total:a.total})}),e.jsx("p",{className:"text-[12px] text-[#666]",children:a.failed?t("importResult.failedBody"):t("importResult.partialBody",{skipped:a.skipped})})]}),e.jsx("button",{onClick:i,className:"absolute top-2 right-2 text-[#999] hover:text-[#333] p-0.5","aria-label":t("onboarding.dismiss"),title:t("onboarding.dismiss"),children:e.jsx(ee,{className:"w-4 h-4"})})]})}
28const ps="contact_email_prompt_dismissed",ur=7*24*60*60*1e3;function xr(){try{const t=Number(localStorage.getItem(ps));return t>0&&Date.now()-t<ur}catch{return!1}}function mr(){const{t}=te(),{contactEmail:a,isLoaded:r}=is(),[n,i]=o.useState(xr),[l,c]=o.useState(!1),m=()=>{try{localStorage.setItem(ps,String(Date.now()))}catch{}i(!0)};return!r||n||a&&!l?null:e.jsxs("div",{className:"relative bg-white border border-[#e5e5e5] rounded-sm shadow-sm mb-5 px-4 py-3 pr-9",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[e.jsx(Ys,{className:"w-4 h-4 mt-0.5 shrink-0 text-[#A8C300]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-semibold text-[#333]",children:t("contactEmail.promptTitle")}),e.jsx("p",{className:"text-[12px] text-[#666]",children:t("contactEmail.promptBody")})]})]}),l?e.jsx("p",{className:"text-[12px] text-[#5a6e00]",children:t("contactEmail.saved")}):e.jsx(Gs,{compact:!0,onSaved:()=>c(!0)}),e.jsx("button",{onClick:m,className:"absolute top-2 right-2 text-[#999] hover:text-[#333] p-0.5","aria-label":t("onboarding.dismiss"),title:t("onboarding.dismiss"),children:e.jsx(ee,{className:"w-4 h-4"})})]})}const pr="extension-1.0.19",gs=`whats_new_dismissed_${pr}`;function gr(){try{return localStorage.getItem(gs)==="true"}catch{return!1}}function hr(){const[t,a]=o.useState(gr);if(t)return null;const r=()=>{try{localStorage.setItem(gs,"true")}catch{}a(!0)};return e.jsxs("div",{className:"relative bg-[#f7fae6] dark:bg-[#2f3320] border border-[#d8e59a] dark:border-[#4a5220] rounded-sm mb-5 px-4 py-3 pr-10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(Se,{className:"w-4 h-4 text-[#7a9000]"}),e.jsx("p",{className:"text-[13px] font-semibold text-[#333] dark:text-[#f5f5f5]",children:"Neu in Version 1.0.19"})]}),e.jsxs("ul",{className:"text-[13px] text-[#444] dark:text-[#ddd] space-y-1 list-none",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Kategorien behoben:"})," Reifen & Felgen und 60 weitere Unterkategorien (z. B. Autos nach Mar
28ke, Möbel, Kinderkleidung, Hunde) werden jetzt zuverlässig richtig ausgewählt."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Credits im Blick:"}),' Dein Guthaben steht jetzt direkt oben im Erweiterungs-Menü â mit âAufladen", wenn es knapp wird.']}),e.jsxs("li",{children:[e.jsx("strong",{children:"Benachrichtigungen:"})," Neue Glocke oben rechts mit allen Hinweisen zu deinen Reposts."]})]}),e.jsx("p",{className:"mt-2 text-[12px] text-[#666] dark:text-[#aaa]",children:"Die Erweiterung aktualisiert sich automatisch. Falls ein Repost vorher fehlgeschlagen ist: einfach erneut starten â fehlgeschlagene Versuche wurden erstattet."}),e.jsx(rs,{to:"/neuigkeiten",className:"mt-1 inline-block text-[12px] font-medium text-[#5a6e00] hover:underline",children:"Alle Neuigkeiten ansehen â"}),e.jsx("button",{onClick:r,className:"absolute top-2 right-2 text-[#999] hover:text-[#333] dark:hover:text-white p-0.5","aria-label":"SchlieÃen",title:"SchlieÃen",children:e.jsx(ee,{className:"w-4 h-4"})})]})}function Tr(){const{t}=te(),{isConnected:a,contextInvalidated:r}=Us(),{callsCount:n,limit:i,isWarning:l,isBlocked:c,incrementUsage:m}=qs(),{enabled:g,balance:f}=At(),j=St(),N=Ms(),{create_with_ai_enabled:k}=ns(),{ads:h,invalidateAds:p,isLoading:w,isFetching:v,isError:P,error:s}=zs(),A=Zs(),[x,T]=o.useState(null),[G,R]=o.useState(!1),[E,b]=o.useState("newest"),[y,H]=o.useState(1),[U,ae]=o.useState(""),[O,X]=o.useState(!1),I=12,[Q,V]=o.useState(!1),[ne,ie]=o.useState(null),[D,W]=o.useState(null),[Y,$]=o.useState(!1),[M,F]=o.useState(null),[me,Ie]=o.useState(localStorage.getItem("platform_banner_dismissed")==="true"),{syncAds:Oe,handleAction:Le,handlePriceCheck:Ae,handleEbayCrossPost:He,optimizeExistingAd:Ue,updateAdFields:Ve,cancelScheduledRepost:fe,fetchSchedulerStatus:_e,isSyncing:ue,toastMessage:pe,toastType:it,repostRunningId:Ee,repostQueuedIds:_,cancelRepost:We,limitBlock:se,clearLimitBlock:Ke}=Fs(),oe=Za(),[$e,Pe]=o.useState(localStorage.getItem("repost_limits_explained")!=="true"),ye=()=>{localStorage.setItem("repost_limits_explained","true"),Pe(!1)},z=wa(h,Ue,m,c,n,i),ot=o.useCallback(async()=>{T(null),V(!0);try{await Oe(()=>{}),p()}catch(u){T(u.message||t("ads.syncFailed"))}finally{V(!1)}},[Oe,p,t]);Vs(ot),o.useEffect(()=>{const u=localStorage.getItem("kb_session")||localStorage.getItem("token");if(!u)return;fetch("https://api.anzeigenboost.de/api/ebay/status",{headers:{Authorization:`Bearer ${u}`}}).then(B=>B.json()).then(B=>$(!!B.connected)).catch(()=>{})},[]),o.useEffect(()=>{_e().then(C=>{C&&F(C)});const u=setInterval(()=>{_e().then(C=>{C&&F(C)})},3e4);return()=>clearInterval(u)},[_e]),o.useEffect(()=>{const u=C=>{var B;((B=C.data)==null?void 0:B.type)==="EBAY_CONNECTED"&&$(!0)};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[]);const Qe=async()=>(p(),h),De=async()=>{if(r){window.location.reload();return}T(null),R(!1),V(!0);try{await Oe(()=>{}),p(),R(!0),setTimeout(()=>R(!1),3500)}catch(u){T(u.message||t("ads.syncFailed"))}finally{V(!1)}},lt=()=>{const u="https://api.anzeigenboost.de/api",C=localStorage.getItem("kb_session")||localStorage.getItem("token"),B=600,Ne=700,ge=window.screen.width/2-B/2,Te=window.screen.height/2-Ne/2;window.open(`${u}/ebay/connect?token=${C}`,"eBay Login",`width=${B},height=${Ne},left=${ge},top=${Te}`)},dt=!1,J=h.filter(u=>u.listingState!=="deleted"&&u.status!=="pending"),ct=tr({isConnected:a,hasAds:J.length>0,hasRepostProof:!!(A.data&&A.data.viewsAfter!=null)}),Ye=O?J.filter(u=>u.listingState==="active"):J,Re=U.trim().toLowerCase(),je=Re?Ye.filter(u=>(u.title||"").toLowerCase().includes(Re)):Ye,Z=u=>typeof u=="number"?u:parseInt(u)||0,le=(u,C)=>{const B=typeof u.kaListOrder=="number",Ne=typeof C.kaListOrder=="number";if(B&&Ne){if(u.kaListOrder!==C.kaListOrder)return u.kaListOrder-C.kaListOrder}else if(B!==Ne)return B?-1:1;const ge=Date.parse(u.firstSyncedAt||"")||0,Te=Date.parse(C.firstSyncedAt||"")||0;return Te!==ge?Te-ge:String(C.id).localeCompare(String(u.id))},de=[...je].sort((u,C)=>{switch(E){case"oldest":return-le(u,C);case"views-desc":return Z(C.views)-Z(u.views)||le(u,C);case"views-asc":return Z(u.views)-Z(C.views)||le(u,C);case"messages-desc":return Z(C.messages)-Z(u.messages)||le(u,C);case"favorites-desc":return Z(C.favorites)-Z(u.favorites)||le(u,C);case"newest":default:return le(u,C)}}),ce=Math.max(1,Math.ceil(de.length/I)),xe=Math.min(y,ce),ut=de.slice((xe-1)*I,xe*I);return o.useEffect(()=>{H(1)},[E,Re,O]),o.useEffect(()=>{y>ce&&H(ce)},[ce,y]),e.jsxs("div",{className:"w-full relative",children:[e.jsx(hr,{}),e.jsx(sr,{onboarding:ct,onSync:De,onCreateWithAi:()=>N("/neue-anzeige-mit-ki-erstellen")}),e.jsx(cr,{}),e.jsx(mr,{}),e.jsx(or,{successfulReposts:h.reduce((u,C)=>u+(Number(C.trackedRepostsCount)||0),0)}),!oe.exempt&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[12px] text-[#666]",children:[e.jsx("span",{children:oe.remaining>0?e.jsx(wt,{i18nKey:"repostLimits.inline",values:{remaining:oe.remaining,limit:oe.limitPerDay},components:[e.jsx("strong",{},"0")]}):t("repostLimits.inlineExhausted")}),e.jsx("button",{onClick:()=>Pe(!0),className:"underline text-[#A8C300] hover:text-[#96ae00]",children:t("repostLimits.whyLink")})]}),e.jsx(es,{open:!!se,variant:(se==null?void 0:se.variant)||"education",retryAt:se==null?void 0:se.retryAt,limitPerDay:(se==null?void 0:se.limitPerDay)??oe.limitPerDay,onClose:Ke}),e.jsx(es,{open:$e&&!se,variant:"education",limitPerDay:oe.limitPerDay,onClose:ye}),dt,e.jsxs("div",{className:"flex flex-col gap-3 mb-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold text-[#333] shrink-0 whitespace-nowrap",children:t("ads.title")}),k&&e.jsxs("button",{onClick:()=>N("/neue-anzeige-mit-ki-erstellen"),className:"bg-[#A8C300] hover:bg-[#96ae00] text-white font-medium py-1.5 px-3 rounded-sm transition-colors text-[13px] flex items-center gap-1 shrink-0",children:[e.jsx(Se,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:t("ads.createWithAi")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qt,{className:"w-3.5 h-3.5 text-[#999] absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none"}),e.jsx("input",{type:"text",value:U,onChange:u=>ae(u.target.value),placeholder:t("ads.searchPlaceholder"),className:"border border-[#ccc] bg-white rounded-sm pl-8 pr-7 py-1.5 text-[13px] text-[#333] shadow-sm focus:outline-none focus:border-[#A8C300] focus:ring-1 focus:ring-[#A8C300] w-44 sm:w-56"}),U&&e.jsx("button",{onClick:()=>ae(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-[#999] hover:text-[#333]","aria-label":t("ads.resetSearch"),children:e.jsx(ee,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 border border-[#ccc] bg-white rounded-sm px-2.5 py-1.5 text-[13px] text-[#333] shadow-sm",children:[e.jsx("span",{className:"text-[#666] font-medium hidden sm:inline",children:t("ads.sortBy")}),e.jsxs("select",{value:E,onChange:u=>b(u.target.value),className:"bg-transparent focus:outline-none font-semibold text-[#333] cursor-pointer",children:[e.jsx("option",{value:"newest",children:t("ads.sortNewest")}
28),e.jsx("option",{value:"oldest",children:t("ads.sortOldest")}),e.jsx("option",{value:"views-desc",children:t("ads.sortMostViews")}),e.jsx("option",{value:"views-asc",children:t("ads.sortLeastViews")}),e.jsx("option",{value:"messages-desc",children:t("ads.sortMostMessages")}),e.jsx("option",{value:"favorites-desc",children:t("ads.sortMostFavorites")})]})]}),e.jsxs("button",{type:"button",onClick:()=>X(u=>!u),"aria-pressed":O,className:`flex items-center gap-1.5 border rounded-full px-3 py-1.5 text-[13px] font-medium transition-colors ${O?"bg-[#f2f7e6] border-[#A8C300] text-[#5a6e00]":"bg-gray-100 border-gray-200 text-gray-500 hover:bg-gray-200"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${O?"bg-[#A8C300]":"bg-gray-400"}`}),t("ads.onlyActive")]}),(v||Q)&&h.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 py-1.5 px-1 shrink-0",children:[e.jsx(ke,{className:"w-3 h-3 animate-spin text-gray-400"}),e.jsx("span",{className:"hidden md:inline text-[11px]",children:Q?t("ads.syncingCount",{count:J.length}):t("ads.updating")})]}),r&&e.jsx("span",{className:"text-[12px] text-orange-600 bg-orange-50 border border-orange-200 px-2 py-1 rounded-sm",children:t("ads.extensionReloaded")}),e.jsxs("button",{onClick:De,disabled:ue||Q,className:"flex items-center gap-1.5 bg-[#f2f2f2] hover:bg-[#e6e6e6] border border-[#ccc] text-[#333] font-medium py-1.5 px-3 rounded-sm transition-colors text-[13px] disabled:opacity-50",children:[e.jsx(ke,{className:`w-3.5 h-3.5 ${ue||Q?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:t(r?"ads.reloadPage":"ads.sync")})]})]})]}),G&&!x&&e.jsxs("div",{className:"flex items-center gap-2 bg-[#f2f7e6] border border-[#d4e39a] rounded-sm px-4 py-2.5 mb-4 text-[13px] text-[#5a6e00]",children:[e.jsx(Be,{className:"w-4 h-4 shrink-0 text-[#7a9000]"}),e.jsxs("span",{children:[J.length," ",J.length===1?t("ads.syncedCountSingular"):t("ads.syncedCountPlural")]})]}),x&&e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-orange-50 border border-orange-200 rounded-sm px-4 py-2.5 mb-4 text-[13px] text-orange-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:x})]}),e.jsx("button",{onClick:De,className:"font-semibold underline hover:no-underline shrink-0",children:t("ads.retry")})]}),A.data&&A.data.viewsAfter!=null&&(()=>{const u=A.data,C=u.viewsBefore&&u.viewsBefore>0&&u.viewsAfter!=null?Math.round((u.viewsAfter-u.viewsBefore)/u.viewsBefore*100):null,B=u.positionBefore!=null&&u.positionAfter!=null;return e.jsxs("div",{className:"flex items-center gap-3 bg-[#f0f7ff] border border-[#cde3ff] rounded-sm px-4 py-3 mb-4 text-[13px] text-[#1a4d8f]",children:[e.jsx(ea,{className:"w-5 h-5 shrink-0 text-[#2b6cb0]"}),e.jsxs("div",{className:"leading-tight",children:[e.jsx("span",{className:"font-semibold",children:t("repostProof.title")}),e.jsxs("span",{className:"text-[#2b6cb0]",children:[" · ",u.title]}),e.jsxs("span",{className:"block mt-0.5",children:[C!=null?t("repostProof.views",{before:u.viewsBefore,after:u.viewsAfter,pct:C}):t("repostProof.viewsSimple",{before:u.viewsBefore,after:u.viewsAfter}),B&&e.jsxs(e.Fragment,{children:[" · ",t("repostProof.rank",{before:u.positionBefore,after:u.positionAfter})]})]})]})]})})(),P&&!w&&e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-red-50 border border-red-200 rounded-sm px-4 py-2.5 mb-4 text-[13px] text-red-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:(s==null?void 0:s.message)||t("ads.loadError")})]}),e.jsx("button",{onClick:()=>p(),className:"font-semibold underline hover:no-underline shrink-0",children:t("ads.retry")})]}),(ue||Q)&&e.jsxs("div",{className:"mb-4",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-gray-100",children:e.jsx("div",{className:"ab-indeterminate-bar"})}),e.jsx("p",{className:"mt-1.5 text-[12px] text-gray-500",children:J.length>0?t("ads.syncingWithKleinanzeigenCount",{count:J.length}):t("ads.syncingWithKleinanzeigen")})]}),w||(ue||Q)&&h.length===0?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(u=>e.jsx("div",{className:"bg-white border border-[#e5e5e5] h-[120px] rounded-sm animate-pulse",children:e.jsxs("div",{className:"flex gap-3 p-3 h-full",children:[e.jsx("div",{className:"w-[130px] bg-gray-200 rounded-sm shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-2 py-1",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-1/2"}),e.jsx("div",{className:"h-3 bg-gray-100 rounded w-1/3"})]})]})},u))}):h.length===0?e.jsxs("div",{className:"text-center py-12 text-[#666]",children:[e.jsx("p",{className:"mb-3",children:t("ads.noAdsFound")}),e.jsxs("button",{onClick:De,disabled:ue||Q,className:"inline-flex items-center gap-1.5 bg-[#A8C300] hover:bg-[#96ae00] text-white font-medium py-2 px-4 roun
28ded-sm transition-colors text-[13px] disabled:opacity-50",children:[e.jsx(ke,{className:`w-3.5 h-3.5 ${ue?"animate-spin":""}`}),t("ads.syncNow")]})]}):de.length===0&&Re?e.jsxs("div",{className:"text-center py-12 text-[#666]",children:[e.jsx(Qt,{className:"w-6 h-6 mx-auto mb-3 text-[#bbb]"}),e.jsx("p",{className:"mb-1",children:t("ads.noAdsForSearch",{query:U})}),e.jsx("button",{onClick:()=>ae(""),className:"text-[#A8C300] font-semibold hover:underline text-[13px]",children:t("ads.resetSearch")})]}):de.length===0?e.jsxs("div",{className:"text-center py-12 text-[#666]",children:[e.jsx("p",{className:"mb-3",children:t("ads.noActiveAds")}),e.jsx("button",{onClick:()=>X(!1),className:"text-[#A8C300] font-semibold hover:underline text-[13px]",children:t("ads.showAllAds")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ha,{ads:ut,onAction:(u,C,B)=>Le(u,C,B,Qe),onAIOptimize:u=>{const C=h.find(B=>B.id===u);C&&z.handleStartOptimization(C)},onCheckCategory:u=>W(u),onPriceCheck:(u,C)=>Ae(u,C),onSchedule:u=>ie(u),onEbayCrossPost:He,onConnectEbay:lt,isEbayConnected:Y,onUpdateFields:Ve,onCancelScheduledRepost:fe,aiBlocked:c,aiWarning:l,creditsBalance:f,repostRunningId:Ee,repostQueuedIds:_,onCancelRepost:We}),ce>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6",children:[e.jsx("button",{onClick:()=>H(u=>Math.max(1,u-1)),disabled:xe===1,className:"px-3 py-1.5 text-[13px] font-medium rounded border border-gray-200 text-gray-600 hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:t("ads.back")}),e.jsxs("span",{className:"text-[13px] text-gray-500 px-2",children:[t("ads.pageOf",{current:xe,total:ce}),e.jsxs("span",{className:"text-gray-400",children:[" · ",t("ads.adsCount",{count:de.length})]})]}),e.jsx("button",{onClick:()=>H(u=>Math.min(ce,u+1)),disabled:xe===ce,className:"px-3 py-1.5 text-[13px] font-medium rounded border border-gray-200 text-gray-600 hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:t("ads.next")})]})]}),M&&e.jsxs("div",{className:"mt-8 text-center text-[12px] text-gray-500",children:[t("ads.schedulerActive")," ",(()=>{const u=Math.floor((Date.now()-new Date(M).getTime())/6e4);return u<=0?t("ads.lessThanMinuteAgo"):u===1?t("ads.oneMinuteAgo"):t("ads.minutesAgo",{count:u})})()]}),e.jsx(Qa,{adId:ne,onClose:()=>ie(null)}),e.jsx(Ua,{optimizePanelAdId:z.optimizePanelAdId,panelAd:z.panelAd,isPanelLoading:z.isPanelLoading,panelData:z.panelData,panelError:z.panelError,loadedFromCache:z.loadedFromCache,appliedTitle:z.appliedTitle,appliedDescription:z.appliedDescription,isApplyingTitle:z.isApplyingTitle,isApplyingDescription:z.isApplyingDescription,isApplyingAll:z.isApplyingAll,geminiHealth:z.geminiHealth,creditsEnabled:g,creditsBalance:f,onClose:()=>z.setOptimizePanelAdId(null),onStartOptimization:z.handleStartOptimization,onApplyTitle:z.handleApplyTitle,onApplyDescription:z.handleApplyDescription,onApplyAll:z.handleApplyAll,onPriceCheck:Ae}),D&&(()=>{const u=h.find(C=>C.id===D);return u?e.jsx(Ka,{ad:u,creditsEnabled:g,creditCost:j.category_check,onClose:()=>W(null)}):null})(),z.optimizePanelAdId&&e.jsx("div",{className:"fixed inset-0 z-30 bg-black/10 backdrop-blur-xxs transition-opacity cursor-pointer md:bg-transparent md:pointer-events-none",onClick:()=>z.setOptimizePanelAdId(null)}),e.jsx(Xs,{message:pe,type:it})]})}export{Tr as Ads};
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.