1import{u as M,r as m,j as e}from"./vendor-react-ff_kKGjF.js";import{f as y,B as p}from"./app-BW3wlK8f.js";import{useAdEntry as B}from"./AdEntryContext-DSpTP2oP.js";import{A as L,a as K,b as O}from"./AnimationPreview-C6Amqfhv.js";/* empty css */import"./stepFlow-DEePQidx.js";import"./tracking-C5rvY3AT.js";import"./imageCompression-CXcOpvF7.js";import"./ListingCard-CY8IhGb5.js";import"./useFavorite-CARFJVks.js";import"./AnimationOverlay-BNAQzFhf.js";import"./shield-check-CrbEVR09.js";import"./badge-check-DdYMgZ_4.js";import"./map-pin-BXUuHzuZ.js";import"./heart-DWvoMaXr.js";import"./star-BMnwQRYM.js";import"./crown-D4ZvZG2C.js";import"./loader-circle-Dndhg7R5.js";import"./calendar-MdDTE8m5.js";import"./chevron-right-n_jdUfIF.js";function re(){const{translations:s}=M().props,{draft:t,selectedRegion:u,packageContext:f,selectedPackages:x,togglePackage:N,updatePackageContext:b,goToNextStep:S,goToPreviousStep:E}=B(),g=t?.animation_styles??[],l=t?.animation_package?.price??0,h=t?.animation_package?.duration??"",[o,w]=m.useState(f?.animation_style??g[0]??null),[T,j]=m.useState(0),[_,k]=m.useState(!1),A=n=>{w(i=>i===n?i:n),j(i=>i+1)},r=t?.animation_package?{id:t.animation_package.id,code:t.animation_package.code,name:t.animation_package.name??s.AD_ENTRY_STEP_ANIMATIONS,price:l,price_formatted:y(l),duration_days:28,duration:h,is_featured:!1,is_bundle:!1,badge:null,description:"",features:[],color:"",buttonColor:"",badgeColor:""}:null,v=async n=>{if(!t?.id)return;const i=x.some(a=>a.code==="animation-listing"),c=x.filter(a=>a.code!=="animation-listing"),d=n&&r?[...c,r]:c,D={...f,animation_style:n??void 0},R=d.find(a=>a.package_type!=="token"&&a.code!=="animation-listing")??null;try{k(!0),await window.axios.post("/api/ad-entry/step3",{draft_id:t.id,network_package_id:R?.id??null,package_context:{...D,selected_package_ids:d.map(a=>a.id)}})}catch(a){console.error("Failed to save animation selection",a)}finally{k(!1)}if(n&&r&&!i&&N(r),!n&&i){const a=x.find(Y=>Y.code==="animation-listing");a&&N(a)}b({animation_style:n??void 0}),S()},C=()=>v(o),I=()=>v(null),P=m.useMemo(()=>{const n=t?.title_en||t?.title_es||t?.title||"Your Listing",i=t?.pending_images?.[0],c=i?i.startsWith("/api/pending-media/")||i.startsWith("http")?i:`/api/pending-media/${i}`:"/images/placeholder.svg",d=u?.display||(t?.region?[t.region.name,t.region.state].filter(Boolean).join(", "):"");return{id:t?.id??0,title:n,price:null,location:d,image:c,href:"#",description:t?.description_en||t?.description_es||t?.description||"",is_verified:!1,ad_type:"standard",parent_category_id:t?.category_id??null,meta_tags:[]}},[t,u]);return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"mb-6 flex items-center lg:items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-primary",children:s.AD_ENTRY_STEP_ANIMATIONS}),e.jsx("p",{className:"hidden lg:block text-sm text-gray-500 mt-1",children:s.AD_ENTRY_ANIMATE_SUBHEADING})]}),l>0&&e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("span",{className:"text-xl font-extrabold text-primary",children:y(l)}),h&&e.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["/ ",h]})]})]}),e.jsx("div",{className:"lg:hidden mb-5",children:e.jsx(L,{styles:g,selected:o,onSelect:A})}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(K,{previewListing:P,style:o,playKey:T}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsx("p",{className:"lg:hidden flex-1 text-sm text-gray-500",children:s.AD_ENTRY_ANIMATE_SUBHEADING}),o&&e.jsxs(p,{variant:"outline",size:"sm",className:"shrink-0 min-h-11",onClick:()=>j(n=>n+1),children:[e.jsx("span",{className:"text-lg sm:text-base leading-none",children:"â»"}),s.AD_ENTRY_ANIMATE_REPLAY]})]})]}),e.jsxs("div",{className:"w-full lg:w-80 shrink-0",children:[e.jsx("div",{className:"hidden lg:block",children:e.jsx(O,{styles:g,selected:o,onSelect:A})}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx(p,{onClick:C,disabled:_||!o,className:"w-full rounded-xl h-11 font-semibold shadow-lg hover:shadow-xl transition-all",children:s.AD_ENTRY_ANIMATE_CONTINUE}),e.jsx(p,{variant:"outline",onClick:I,disabled:_,className:"w-full rounded-xl h-11 bg-transparent",children:s.AD_ENTRY_SKIP})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(p,{variant:"outline",onClick:E,disabled:_,className:"rounded-xl px-5 h-11 bg-transparent text-sm",children:[e.jsx(U,{className:"hidden sm:inline-block h-4 w-4 mr-1"}),s.BACK]})})]})]})]})}function U({className:s}){return e.jsx("svg",{className:s,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}
1export{re as AnimationsStep};
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.