1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgeBasePage-DJT9Fkps.js","assets/index-L9AYrVUw.js","assets/index-DnDj_hub.css","assets/FloatingTopMenu-CIhwk2RR.js","assets/PlanAccessModal-P_W2GThH.js","assets/productFunnel-DiJFcMU2.js","assets/locale-Cctu0V3Y.js","assets/SnewLogo-Cg53XTnQ.js","assets/ArrowsClockwise.es-CX8V1pij.js","assets/ChatCircle.es-ys8V5LKI.js","assets/FloppyDisk.es-DCGe340Q.js","assets/Globe.es-5iBT42E4.js","assets/Image.es-BLTC_PgL.js","assets/MagicWand.es-CAihBnXI.js","assets/Package.es-CyLjTX4J.js","assets/Palette.es-Dd5ZEM4v.js","assets/Target.es-Ds7XP-fd.js","assets/WarningCircle.es-CHfqKWRY.js","assets/hydrateStoreContext-CnRDd9GD.js"])))=>i.map(i=>d[i]); 2import{r,u as N,j as e,N as ee,a as ne,_ as vt,aV as jt,c as St}from"./index-L9AYrVUw.js";import{useSearchParams as ue}from"./index-p7aFGi8o.js";import{s as xe,H as Ct,W as wt,X as $t,Y as Re,o as Ce,Z as ze,_ as kt,$ as Ne,a0 as It,G as Tt,a1 as Rt}from"./FloatingTopMenu-CIhwk2RR.js";import{u as Oe,O as ve,s as Fe,P as Et,a as At,b as zt}from"./PlansModal-arzAnfLd.js";import{p as _e,b0 as F,R as E,aC as Pt,C as o,m as u,aW as L,b2 as te,d as je,aF as Mt,az as Dt,u as He,aQ as Ot,s as Ue,aE as Le,a as et,fb as tt,n as ot,fc as Ft,fd as _t,fe as Ut,h as Ie,dO as Lt,T as Wt,ff as qt,fg as Bt,fh as Ee,fi as Nt,fj as Ht,fk as Zt}from"./PlanAccessModal-P_W2GThH.js";import{B as Se}from"./button-Bt8F5TkE.js";import{s as Vt}from"./ArrowUp.es-sg_sCqx1.js";import{a as Gt}from"./PencilSimple.es-DDA0fpvv.js";import{H as Yt,J as Kt,K as Xt,L as Jt,N as Qt,z as eo,O as Ze,M as at,Q as rt,U as Ve,V as to,W as oo,X as ao}from"./App-DyVHSnY3.js";import{s as ro,a as We}from"./productFunnel-DiJFcMU2.js";import{s as Te}from"./CheckCircle.es-PkF6a2W-.js";import{m as nt}from"./MagicWand.es-CAihBnXI.js";import{n as no}from"./Palette.es-Dd5ZEM4v.js";import{n as so}from"./SquaresFour.es-BpA8mwXA.js";import{s as io}from"./TShirt.es-Mn3oLi8V.js";import{a as lo}from"./connectedStoreCompiler-B6HBdZ2d.js";import{p as co}from"./LinkSimple.es-DyfkgQYM.js";import{l as qe}from"./UploadSimple.es-BDJIa312.js";import{b as fe,W as X,a as K}from"./WfOnboardingLayout-DjuiAQmZ.js";import{W as f}from"./wfTheme-DA7tTXEm.js";import{s as ke,p as Be,r as st}from"./firstAsset-DWUwvZpm.js";import{u as uo,a as mo}from"./useConnectedStoreReadiness-DF-_Nxmd.js";import{persistConnectedStoreContext as po,buildConnectedStoreContext as go}from"./connectedStoreContext-CJsQZQXn.js";import{c as it,i as Pe}from"./productImageClassifier-CtjXT6b0.js";import{c as ho}from"./loadRecommendationContext-eK4jCmh4.js";import{o as fo,b as yo,s as xo}from"./boardBatch-BeNr49rO.js";import{c as bo,d as vo}from"./durableRepository-CrJ1KOcD.js";import{s as jo}from"./canvasDocument-BD3jeUPg.js";import{c as So,a as Co}from"./admitCommercialProductReference-C8SXMXFm.js";import{W as we}from"./welcomeBoard-4xJYHWeA.js";import{s as wo}from"./VideoCamera.es-CCLoNiT_.js";import{n as $o}from"./Camera.es-8HNgckmU.js";import{c as ko}from"./Megaphone.es-CpcQHM6H.js";import{s as Io}from"./CaretLeft.es-CVEVfjVi.js";import"./locale-Cctu0V3Y.js";import"./SnewLogo-Cg53XTnQ.js";import"./BillingCycleToggle-CYks6Uh5.js";import"./segmented-tabs--x9EQobi.js";import"./modal-close-button-BhLoO4jQ.js";import"./Trash.es-D2Zs5Rpt.js";import"./dissolve-CQo8GAUH.js";import"./sanitized-commercial-metrics-Ctrrpq63.js";import"./OnboardingPrimaryButton-DXhfBHeb.js";import"./snewDefault-bcI9V4vY.js";import"./privateMedia-B7Po080i.js";import"./quickActions-Bt6kGa-B.js";import"./christmasCreativeDirections-Ceo-u5n5.js";import"./recipes-CtHnj9D9.js";import"./antiStock-CfefI4TX.js";import"./eligibility-B5UjMwH6.js";import"./overrides-DxGb-X-q.js";import"./types-YVLQw7aQ.js";import"./scoring-Oj4SgCwH.js";import"./generationHistory-D4RTxXIf.js";import"./historyKey-GcKgTVWl.js";import"./KnowledgeBasePage-DJT9Fkps.js";import"./ArrowsClockwise.es-CX8V1pij.js";import"./ChatCircle.es-ys8V5LKI.js";import"./FloppyDisk.es-DCGe340Q.js";import"./Globe.es-5iBT42E4.js";import"./Image.es-BLTC_PgL.js";import"./Package.es-CyLjTX4J.js";import"./Target.es-Ds7XP-fd.js";import"./WarningCircle.es-CHfqKWRY.js";import"./hydrateStoreContext-CnRDd9GD.js";import"./sceneCovers-B-dE7_Ce.js";import"./directions-DxJo97Ho.js";import"./jobRuntime-D9imWnJq.js";import"./durableDocument-CwDQPJIK.js";import"./boardSaveRetry-DOnjTgch.js";const To=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212ZM163.27,77l-56,24a12,12,0,0,0-6.3,6.3l-24,56A12,12,0,0,0,92.73,179l56-24a12,12,0,0,0,6.3-6.3l24-56A12,12,0,0,0,163.27,77Zm-28.41,57.89-24,10.29,10.29-24,24-10.29Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,32a96,96,0,1,0,96,96A96,96,0,0,0,128,32Zm16,112L80,176l32-64,64-32Z",opacity:"0.2"}),r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm51.58,57.79-32,64a4.08,4.08,0,0,1-1.79,1.79l-64,32a4,4,0,0,1-5.37-5.37l32-64a4.08,4.08,0,0,1,1.79-1.79l64-32A4,4,0,0,1,179.58,81.79Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218ZM173.32,74.63l-64,32a6,6,0,0,0-2.69,2.69l-32,64A6,6,0,0,0,80,182a6.06,6.06,0,0,0,2.68-.63l64-32a6,6,0,0,0,2.69-2.69l32-64a6,6,0,0,0-8.05-8.05Zm-33.79,64.9L93.42,162.58l23-46.11,46.11-23Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216ZM172.42,72.84l-64,32a8.05,8.05,0,0,0-3.58,3.58l-32,64A8,8,0,0,0,80,184a8.1,8.1,0,0,0,3.58-.84l64-32a8.05,8.05,0,0,0,3.58-3.58l32-64a8,8,0,0,0-10.74-10.74ZM138,138,97.89,158.11,118,118l40.15-20.07Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220ZM174.21,76.42l-64,32a4.08,4.08,0,0,0-1.79,1.79l-32,64A4,4,0,0,0,80,180a4.05,4.05,0,0,0,1.79-.42l64-32a4.08,4.08,0,0,0,1.79-1.79l32-64a4,4,0,0,0-5.37-5.37ZM141,141l-52.08,26L115,115l52.08-26Z"}))]]),Ro=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M114.32,49.8A19.79,19.79,0,0,0,81.72,57L29.22,201.41A19.82,19.82,0,0,0,47.75,228a20,20,0,0,0,6.84-1.22L199,174.28a19.79,19.79,0,0,0,7.24-32.6ZM104.19,183.21l-31.4-31.4L82.94,123.9l49.16,49.16Zm-52.42,26.4Zm12-32.91L79.3,192.26l-24.45,8.89ZM157,164,92,99l10-27.58L184.57,154ZM128,40V16a12,12,0,0,1,24,0V40a12,12,0,0,1-24,0Zm116.48,83.51a12,12,0,0,1-17,17l-16-16a12,12,0,0,1,17-17Zm-.69-40.13
2-24,8a12,12,0,0,1-7.59-22.77l24-8a12,12,0,1,1,7.59,22.77ZM156.6,65.93C159.83,47.47,173.39,36,192,36c6.45,0,8.69-2.49,10-4.92a18,18,0,0,0,2-7.22V24a12,12,0,0,1,24,0c0,14.47-9.59,36-36,36-4.94,0-10.21,1.19-11.76,10.06A12,12,0,0,1,168.43,80a12.35,12.35,0,0,1-2.08-.18A12,12,0,0,1,156.6,65.93Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M58.89,154.89l42.22,42.22-50.63,18.4a7.79,7.79,0,0,1-10-10Zm138.82-4.72L105.83,58.29A7.79,7.79,0,0,0,93,61.14l-14.9,41,75.82,75.82,41-14.9A7.79,7.79,0,0,0,197.71,150.17Z",opacity:"0.2"}),r.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26ZM65.14,161.13l19.2-52.79,63.32,63.32-52.8,19.2ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M110.08,54a13.8,13.8,0,0,0-22.73,5.05L34.85,203.47A13.82,13.82,0,0,0,47.76,222a14,14,0,0,0,4.77-.85l144.38-52.5a13.8,13.8,0,0,0,5-22.73ZM48.43,209.87a1.79,1.79,0,0,1-2.3-2.3L61.31,165.8,90.2,194.68Zm54.21-19.71-36.8-36.81L80.51,113,143,175.49ZM194,156.07a1.74,1.74,0,0,1-1.14,1.3L155.44,171,85,100.55,98.63,63.19a1.72,1.72,0,0,1,1.3-1.14,1.58,1.58,0,0,1,.41,0,1.72,1.72,0,0,1,1.25.53l91.88,91.88A1.73,1.73,0,0,1,194,156.07ZM162,72a35.52,35.52,0,0,1,3.63-14.68C170.57,47.44,179.93,42,192,42c7.47,0,12.53-2.74,15.48-8.38A24.18,24.18,0,0,0,210,24,6,6,0,0,1,216,18h0a6,6,0,0,1,6,6c0,10.38-6.27,30-30,30-7.47,0-12.53,2.74-15.48,8.38A24,24,0,0,0,174,72a6,6,0,0,1-6,6h0A6,6,0,0,1,162,72ZM138,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm98.24,83.76a6,6,0,1,1-8.48,8.48l-16-16a6,6,0,0,1,8.48-8.48Zm5.66-46.07-24,8a6,6,0,1,1-3.8-11.38l24-8a6,6,0,0,1,3.8,11.38Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M111.49,52.63a15.8,15.8,0,0,0-26,5.77L33,202.78A15.83,15.83,0,0,0,47.76,224a16,16,0,0,0,5.46-1l144.37-52.5a15.8,15.8,0,0,0,5.78-26Zm-8.33,135.21-35-35,13.16-36.21,58.05,58.05Zm-55,20,14-38.41,24.45,24.45ZM156,168.64,87.36,100l13-35.87,91.43,91.43ZM160,72a37.8,37.8,0,0,1,3.84-15.58C169.14,45.83,179.14,40,192,40c6.7,0,11-2.29,13.65-7.21A22,22,0,0,0,208,23.94,8,8,0,0,1,224,24c0,12.86-8.52,32-32,32-6.7,0-11,2.29-13.65,7.21A22,22,0,0,0,176,72.06,8,8,0,0,1,160,72ZM136,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm101.66,82.34a8,8,0,1,1-11.32,11.31l-16-16a8,8,0,0,1,11.32-11.32Zm4.87-42.75-24,8a8,8,0,0,1-5.06-15.18l24-8a8,8,0,0,1,5.06,15.18Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M108.66,55.46a11.79,11.79,0,0,0-19.43,4.31L36.73,204.15a11.81,11.81,0,0,0,11,15.85,11.88,11.88,0,0,0,4.08-.73l144.38-52.5a11.79,11.79,0,0,0,4.31-19.43Zm-6.53,137L63.52,153.87l16.19-44.51,66.92,66.93Zm-53,19.28a3.81,3.81,0,0,1-4.87-4.87l16.27-44.72,33.32,33.32Zm146.8-55.25a3.77,3.77,0,0,1-2.42,2.74l-38.56,14L82.72,101.07l14-38.56a3.77,3.77,0,0,1,2.74-2.42,4.32,4.32,0,0,1,.85-.09A3.65,3.65,0,0,1,103,61.12L194.88,153A3.78,3.78,0,0,1,195.91,156.51ZM220,24c0,9.68-5.85,28-28,28-8.31,0-14.18,3.29-17.42,9.79A26.12,26.12,0,0,0,172,72a4,4,0,0,1-8,0,34.06,34.06,0,0,1,3.42-13.79C170.66,51.73,177.56,44,192,44c19.29,0,20-18,20-20a4,4,0,0,1,4-4h0A4,4,0,0,1,220,24ZM140,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm94.83,85.17a4,4,0,0,1-5.66,5.66l-16-16a4,4,0,0,1,5.66-5.66Zm6.43-49.37-24,8A4,4,0,0,1,216,84a4,4,0,0,1-1.27-7.79l24-8a4,4,0,0,1,2.53,7.59Z"}))]]),Eo=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M225.15,197.71,164,95.81V44h4a12,12,0,0,0,0-24H88a12,12,0,0,0,0,24h4V95.81L30.85,197.71A20,20,0,0,0,48,228H208a20,20,0,0,0,17.15-30.29ZM140,44V99.14a12,12,0,0,0,1.71,6.17l35.13,58.54c-10.79.86-25.15-1.31-43.42-10.56-14-7.08-27.46-11.33-40.27-12.76l21.14-35.22A12,12,0,0,0,116,99.14V44ZM55.06,204,79,164.19c13-1.11,27.62,2.42,43.62,10.52,19.61,9.92,36.25,13.31,49.85,13.31A75.44,75.44,0,0,0,190.11,186l10.83,18Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,216H48a8,8,0,0,1-6.86-12.12l30.48-50.8h0c13.23-2.48,32-1.41,56.37,10.92,32.25,16.33,54.75,12.91,67.5,7.65h0l19.34,32.23A8,8,0,0,1,208,216Z",opacity:"0.2"}),r.createElement("path",{d:"M221.69,199.77,160,96.92V40h8a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16h8V96.92L34.31,199.77A16,16,0,0,0,48,224H208a16,16,0,0,0,13.72-24.23ZM110.86,103.25A7.93,7.93,0,0,0,112,99.14V40h32V99.14a7.93,7.93,0,0,0,1.14,4.11L183.36,167c-12,2.37-29.07,1.37-51.75-10.11-15.91-8.05-31.05-12.32-45.22-12.81ZM48,208l28.54-47.58c14.25-1.73,30.31,1.85,47.82,10.72,19,9.61,35,12.88,48,12.88a69.89,69.89,0,0,0,19.55-2.7L208,208Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M221.69,199.77,160,96.92V40h8a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16h8V96.92L34.31,199.77A16,16,0,0,0,48,224H208a16,16,0,0,0,13.72-24.23Zm-90.08-42.91c-15.91-8.05-31.05-12.32-45.22-12.81l24.47-40.8A7.93,7.93,0,0,0,112,99.14V40h32V99.14a7.93,7.93,0,0,0,1.14,4.11L183.36,167C171.4,169.34,154.29,168.34,131.61,156.86Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M220,200.8,158,97.48V38h10a6,6,0,0,0,0-12H88a6,6,0,0,0,0,12H98
2V97.48L36,200.8A14,14,0,0,0,48,222H208a14,14,0,0,0,12-21.2ZM109.15,102.23a6,6,0,0,0,.85-3.09V38h36V99.14a6,6,0,0,0,.85,3.09l39.65,66.08c-12.41,3.16-30.86,3-55.79-9.66-16.94-8.58-33-12.8-47.83-12.64ZM209.72,209a2,2,0,0,1-1.74,1H48a2,2,0,0,1-1.71-3l29-48.41c14.89-2.08,31.68,1.55,49.94,10.79C144,178.8,159.67,182,172.42,182A67.89,67.89,0,0,0,192.89,179l16.8,28A2,2,0,0,1,209.72,209Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M221.69,199.77,160,96.92V40h8a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16h8V96.92L34.31,199.77A16,16,0,0,0,48,224H208a16,16,0,0,0,13.72-24.23ZM110.86,103.25A7.93,7.93,0,0,0,112,99.14V40h32V99.14a7.93,7.93,0,0,0,1.14,4.11L183.36,167c-12,2.37-29.07,1.37-51.75-10.11-15.91-8.05-31.05-12.32-45.22-12.81ZM48,208l28.54-47.58c14.25-1.74,30.31,1.85,47.82,10.72,19,9.61,35,12.88,48,12.88a69.89,69.89,0,0,0,19.55-2.7L208,208Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M218.27,201.83,156,98V36h12a4,4,0,0,0,0-8H88a4,4,0,0,0,0,8h12V98L37.73,201.83A12,12,0,0,0,48,220H208a12,12,0,0,0,10.29-18.17ZM107.43,101.2a4.07,4.07,0,0,0,.57-2.06V36h40V99.14a4.07,4.07,0,0,0,.57,2.06l41,68.33c-12.76,3.94-32.54,4.68-59.75-9.1-18-9.14-35-13.24-50.54-12.29ZM211.46,210a3.94,3.94,0,0,1-3.48,2H48a4,4,0,0,1-3.43-6.06l29.53-49.21c15.54-2.43,33.05,1.21,52.07,10.84C144.54,176.86,160,180,172.42,180a65,65,0,0,0,21.36-3.46l17.63,29.38A3.92,3.92,0,0,1,211.46,210Z"}))]]),lt=r.forwardRef((a,n)=>r.createElement(_e,{ref:n,...a,weights:To}));lt.displayName="CompassIcon";const Ao=lt,ct=r.forwardRef((a,n)=>r.createElement(_e,{ref:n,...a,weights:Ro}));ct.displayName="ConfettiIcon";const zo=ct,dt=r.forwardRef((a,n)=>r.createElement(_e,{ref:n,...a,weights:Eo}));dt.displayName="FlaskIcon";const Po=dt,Ge=a=>/^(https?:\/\/)?([\w-]+\.)+[\w-]{2,}(\/.*)?$/i.test(a.trim());function Mo(){const a=N(),{markStepCompleted:n,setPlatform:t}=Oe(),[d,l]=r.useState(""),i=()=>{if(!Ge(d))return;const c=d.trim();try{Fe({platform:null,status:"connected",shopUrl:c})}catch(m){console.warn(m)}try{t("url-import")}catch(m){console.warn(m)}try{n("store")}catch(m){console.warn(m)}try{L.saveOnboardingProfile({storePlatform:null,storeUrl:c,catalogSource:"url"})}catch(m){console.warn(m)}try{L.updateOnboardingProgress(3,!1)}catch(m){console.warn(m)}a(`/onboarding/import?source=url&url=${encodeURIComponent(c)}`)},s=Ge(d);return e.jsx(ve,{currentStep:"store",completedSteps:["goals","source","priority"],heading:"Importe sua loja via URL",subheading:"Cole o link do seu site. Vamos puxar produtos e informações a partir dele.",cta:e.jsxs("button",{type:"button",onClick:i,disabled:!s,style:{height:44,minWidth:180,padding:"0 24px",background:"hsl(0 0% 9%)",color:"hsl(0 0% 100%)",border:"none",borderRadius:9999,fontSize:13,fontWeight:500,fontFamily:"inherit",cursor:s?"pointer":"not-allowed",opacity:s?1:.4,transition:"opacity 150ms",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8},children:["Continuar",e.jsx(xe,{size:10,weight:"bold"})]}),children:e.jsx("div",{style:{display:"flex",alignItems:"center",padding:`0 ${u[4]}`,background:`hsl(${o.bg.primary})`,border:Pt.default,borderRadius:E.lg,height:48,transition:`border-color ${F.fast}`},children:e.jsx("input",{type:"url",autoFocus:!0,value:d,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&s&&i()},placeholder:"https://minhaloja.com.br",style:{flex:1,height:"100%",border:"none",outline:"none",background:"transparent",fontSize:14,fontFamily:"inherit",color:`hsl(${o.text.primary})`}})})})}const Do=[{id:"loja",label:"Tenho uma loja",description:"Quero o agente cuidando do marketing da minha marca."},{id:"agencia",label:"Sou agência",description:"Cuido do marketing de várias marcas de clientes."}],Oo="snew_onboarding_user_type";function Fo(){const a=N(),{markStepCompleted:n}=Oe(),[t,d]=r.useState(null),l=s=>{d(s);try{localStorage.setItem(Oo,s)}catch{}},i=()=>{t&&(n("goals"),L.updateOnboardingProgress(2,!1),a("/onboarding/source"))};return e.jsx(ve,{currentStep:"goals",completedSteps:[],heading:"Bem-vindo ao Snew",subheading:"O marketing do seu e-commerce na era da IA. Me diz quem você é pra personalizar sua experiência.",cta:e.jsxs(Se,{type:"button",onClick:i,disabled:!t,className:"h-11 min-w-[160px] rounded-full gap-2 [&_svg]:!size-2.5",children:["Continuar",e.jsx(xe,{size:10,weight:"bold"})]}),children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:u[3]},children:Do.map(s=>{const c=t===s.id;return e.jsx("button",{type:"button",onClick:()=>l(s.id),style:{position:"relative",background:`hsl(${o.bg.primary}
2)`,border:c?`2px solid hsl(${o.text.primary})`:`2px solid hsl(${o.border.tertiary})`,borderRadius:E.xl,padding:28,textAlign:"left",display:"flex",flexDirection:"column",gap:16,minHeight:160,cursor:"pointer",fontFamily:"inherit",boxShadow:"none",transition:`border-color ${F.fast}, transform ${F.fast}, box-shadow ${F.fast}`},onMouseEnter:m=>{c||(m.currentTarget.style.borderColor=`hsl(${o.border.secondary})`,m.currentTarget.style.transform="translateY(-2px)",m.currentTarget.style.boxShadow=te.floatSoft)},onMouseLeave:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="none",!c&&(m.currentTarget.style.borderColor=`hsl(${o.border.tertiary})`)},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:`hsl(${o.text.primary})`,lineHeight:1.2,letterSpacing:"-0.01em"},children:s.label}),e.jsx("div",{style:{fontSize:13,color:`hsl(${o.text.tertiary})`,lineHeight:1.4},children:s.description})]})},s.id)})})})}const _o=[{id:"instagram",label:"Instagram"},{id:"tiktok",label:"TikTok"},{id:"linkedin",label:"LinkedIn"},{id:"youtube",label:"YouTube"},{id:"friend",label:"Indicação de um amigo"},{id:"press",label:"Imprensa / blog"},{id:"search",label:"Busca no Google"},{id:"other",label:"Outro"}],Uo="snew_onboarding_source";function Lo(){const a=N(),[n,t]=r.useState(null),d=i=>{t(i);try{localStorage.setItem(Uo,i)}catch{}},l=()=>{n&&a("/onboarding/priority")};return e.jsx(ve,{currentStep:"source",heading:"Como você conheceu a Snew?",subheading:"Ajuda a gente a saber por onde a nossa mensagem está chegando.",cta:e.jsxs(Se,{type:"button",onClick:l,disabled:!n,className:"h-11 min-w-[160px] rounded-full gap-2 [&_svg]:!size-2.5",children:["Continuar",e.jsx(xe,{size:10,weight:"bold"})]}),children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:u[3]},children:_o.map(i=>{const s=n===i.id;return e.jsx("button",{type:"button",onClick:()=>d(i.id),style:{position:"relative",background:`hsl(${o.bg.primary})`,border:s?`2px solid hsl(${o.text.primary})`:`2px solid hsl(${o.border.tertiary})`,borderRadius:E.xl,padding:20,textAlign:"left",display:"flex",alignItems:"center",gap:14,minHeight:64,cursor:"pointer",fontFamily:"inherit",boxShadow:"none",transition:`border-color ${F.fast}, transform ${F.fast}, box-shadow ${F.fast}`},onMouseEnter:c=>{s||(c.currentTarget.style.borderColor=`hsl(${o.border.secondary})`,c.currentTarget.style.transform="translateY(-2px)",c.currentTarget.style.boxShadow=te.floatSoft)},onMouseLeave:c=>{c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow="none",!s&&(c.currentTarget.style.borderColor=`hsl(${o.border.tertiary})`)},children:e.jsx("div",{style:{fontSize:14,fontWeight:500,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em"},children:i.label})},i.id)})})})}const Wo=[{id:"ads",label:"Criar anúncios que vendem",description:"Gerar criativos para Meta, TikTok e Google."},{id:"content",label:"Produzir conteúdo em escala",description:"Fotos de produto, posts e stories no meu estilo."},{id:"calendar",label:"Organizar meu calendário",description:"Planejar campanhas e datas sazonais."},{id:"performance",label:"Melhorar performance",description:"Entender o que funciona e iterar mais rápido."},{id:"brand",label:"Fortalecer minha marca",description:"Consistência visual em todos os canais."},{id:"sales",label:"Vender mais na loja",description:"Aumentar conversão do meu e-commerce."}],qo="snew_onboarding_priority";function Bo(){const a=N(),[n,t]=r.useState([]),d=i=>{t(s=>{const c=s.includes(i)?s.filter(m=>m!==i):[...s,i];try{localStorage.setItem(qo,JSON.stringify(c))}catch{}return c})},l=()=>{n.length!==0&&a("/onboarding/store")};return e.jsx(ve,{currentStep:"priority",heading:"O que é mais importante pra você agora?",subheading:"Escolha uma ou mais prioridades. O Snew vai começar por aÃ, dá pra ajustar depois.",cta:e.jsxs(Se,{type:"button",onClick:l,disabled:n.length===0,className:"h-11 min-w-[160px] rounded-full gap-2 [&_svg]:!size-2.5",children:["Continuar",e.jsx(xe,{size:10,weight:"bold"})]}),children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:u[3]},children:Wo.map(i=>{const s=n.includes(i.id);return e.jsx("button",{type:"button",onClick:()=>d(i.id),"aria-pressed":s,style:{position:"relative",background:`hsl(${o.bg.primary}
2)`,border:s?`2px solid hsl(${o.text.primary})`:`2px solid hsl(${o.border.tertiary})`,borderRadius:E.xl,padding:24,textAlign:"left",display:"flex",flexDirection:"column",gap:14,minHeight:150,cursor:"pointer",fontFamily:"inherit",boxShadow:"none",transition:`border-color ${F.fast}, transform ${F.fast}, box-shadow ${F.fast}`},onMouseEnter:c=>{s||(c.currentTarget.style.borderColor=`hsl(${o.border.secondary})`,c.currentTarget.style.transform="translateY(-2px)",c.currentTarget.style.boxShadow=te.floatSoft)},onMouseLeave:c=>{c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow="none",!s&&(c.currentTarget.style.borderColor=`hsl(${o.border.tertiary})`)},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:`hsl(${o.text.primary})`,lineHeight:1.2,letterSpacing:"-0.01em"},children:i.label}),e.jsx("div",{style:{fontSize:13,color:`hsl(${o.text.tertiary})`,lineHeight:1.4},children:i.description})]})},i.id)})})})}function No(){const[a]=ue(),n=a.get("url")??"";return e.jsx(ee,{to:`/onboarding/import?source=url&url=${encodeURIComponent(n)}`,replace:!0})}const Ho=700,Zo=400;function ut(){return e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:4,alignSelf:"flex-start",animation:"bubbleIn 200ms cubic-bezier(0.16, 1, 0.3, 1) both"},children:[0,1,2].map(a=>e.jsx("span",{style:{width:5,height:5,borderRadius:E.pill,background:`hsl(${o.text.tertiary})`,animation:`typingDot 1.2s ease-in-out ${a*.15}s infinite`}},a))})}function mt({children:a}){return e.jsx("div",{style:{alignSelf:"flex-start",maxWidth:"100%",animation:"bubbleIn 280ms cubic-bezier(0.16, 1, 0.3, 1) both"},children:e.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em",fontWeight:400},children:a})})}function Vo({messages:a,onComplete:n}){const[t,d]=r.useState(0),[l,i]=r.useState(!0),[s,c]=r.useState(!1);r.useEffect(()=>{if(s)return;if(t>=a.length){i(!1),n==null||n();return}i(!0);const g=setTimeout(()=>{i(!1),d(x=>x+1)},Ho);return()=>clearTimeout(g)},[t,a.length,s,n]),r.useEffect(()=>{s&&(n==null||n())},[s,n]),r.useEffect(()=>{if(s||t===0||t>=a.length)return;const g=setTimeout(()=>i(!0),Zo);return()=>clearTimeout(g)},[t,a.length,s]);const m=s||t>=a.length,h=m?a:a.slice(0,t);return e.jsxs("div",{onClick:()=>!m&&c(!0),style:{display:"flex",flexDirection:"column",gap:u[2],cursor:m?"default":"pointer"},children:[h.map((g,x)=>e.jsx(mt,{children:g},x)),!m&&l&&e.jsx(ut,{})]})}function Go(){return e.jsxs("div",{style:{marginTop:u[3],display:"inline-flex",alignItems:"center",gap:u[2],alignSelf:"flex-start",padding:`${u[2]} ${u[3]}`,background:`hsl(${o.bg.success})`,border:"1px solid rgba(34, 197, 94, 0.25)",borderRadius:E.pill,fontSize:12,fontWeight:500,color:`hsl(${o.text.success})`,animation:"bubbleIn 320ms cubic-bezier(0.16, 1, 0.3, 1) both"},children:["Escolha um produto",e.jsx(Ue,{size:14,weight:"bold"})]})}function Yo({onUpgrade:a}){return e.jsx("div",{style:{marginTop:u[3],display:"flex",animation:"bubbleIn 320ms cubic-bezier(0.16, 1, 0.3, 1) both"},children:e.jsxs("button",{type:"button",onClick:a,style:{display:"inline-flex",alignItems:"center",gap:u[2],padding:`${u[2]} ${u[3]}`,background:`hsl(${o.bg.primary})`,color:`hsl(${o.text.primary})`,border:`1px solid hsl(${o.border.tertiary})`,borderRadius:E.pill,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"inherit",letterSpacing:"-0.01em",transition:`background ${F.fast}`,boxShadow:te.chip},onMouseEnter:n=>{n.currentTarget.style.background=`hsl(${o.bg.secondary})`},onMouseLeave:n=>{n.currentTarget.style.background=`hsl(${o.bg.primary})`},children:["Fazer upgrade",e.jsx(Ue,{size:12,weight:"bold"})]})})}function Ko({children:a}){return e.jsx("div",{style:{background:`hsl(${o.bg.secondary})`,color:`hsl(${o.text.primary})`,borderRadius:`${E.xl} ${E.xl} 4px ${E.xl}`,padding:`${u[3]} ${u[4]}`,alignSelf:"flex-end",maxWidth:"85%",fontSize:14,lineHeight:1.5,animation:"bubbleIn 280ms cubic-bezier(0.16, 1, 0.3, 1) both"},children:a})}function Xo({onSubmit:a,disabled:n,suggestions:t}){const[d,l]=r.useState(""),i=r.useRef(null),s=()=>{const c=d.trim();!c||n||(a(c),l(""),requestAnimationFrame(()=>{var m;return(m=i.current)==null?void 0:m.focus()}))};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[2]}
2,children:[t&&t.length>0&&e.jsx("div",{style:{display:"flex",gap:u[2],overflowX:"auto",paddingBottom:2,scrollbarWidth:"none",WebkitMaskImage:"linear-gradient(to right, black 0, black calc(100% - 32px), transparent 100%)",maskImage:"linear-gradient(to right, black 0, black calc(100% - 32px), transparent 100%)"},children:t.map(c=>e.jsx("button",{type:"button",onClick:()=>!n&&a(c),disabled:n,style:{flexShrink:0,background:`hsl(${o.bg.primary})`,border:`1px solid hsl(${o.border.tertiary})`,borderRadius:E.pill,padding:"6px 12px",fontSize:12,lineHeight:1.3,color:`hsl(${o.text.secondary})`,cursor:n?"not-allowed":"pointer",opacity:n?.5:1,fontFamily:"inherit",letterSpacing:"-0.01em",whiteSpace:"nowrap",transition:`background ${F.fast}, color ${F.fast}`},onMouseEnter:m=>{n||(m.currentTarget.style.background=`hsl(${o.bg.secondary})`,m.currentTarget.style.color=`hsl(${o.text.primary})`)},onMouseLeave:m=>{m.currentTarget.style.background=`hsl(${o.bg.primary})`,m.currentTarget.style.color=`hsl(${o.text.secondary})`},children:c},c))}),e.jsxs("div",{style:{background:`hsl(${o.bg.primary})`,border:`1.5px solid hsl(${o.border.tertiary})`,borderRadius:E.xl,padding:`${u[3]} ${u[3]}`,display:"flex",flexDirection:"column",gap:u[2],boxShadow:te.chip},children:[e.jsx("textarea",{ref:i,value:d,onChange:c=>l(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),s())},placeholder:"Pergunte algo ao agente...",rows:1,style:{width:"100%",minHeight:36,maxHeight:100,padding:0,border:"none",outline:"none",resize:"none",lineHeight:1.5,background:"transparent",fontFamily:"inherit",fontSize:14,color:`hsl(${o.text.primary})`}}),e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:u[2]},children:e.jsx("button",{className:"snew-main-action",type:"button",onClick:s,disabled:n||!d.trim(),"aria-label":"Enviar",style:{width:30,height:30,borderRadius:E.pill,border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:n||!d.trim()?"not-allowed":"pointer",opacity:n||!d.trim()?.4:1,transition:`opacity ${F.fast}`},children:e.jsx(Vt,{size:14,weight:"bold"})})})]})]})}const Ye=[{id:"p1",name:"Camiseta Oversize Off-white",price:"R$ 189",image:"https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?w=600&q=80"},{id:"p2",name:"Moletom Cropped Grafite",price:"R$ 249",image:"https://images.unsplash.com/photo-1556905055-8f358a7a47b2?w=600&q=80"},{id:"p3",name:"Calça Cargo Verde Militar",price:"R$ 329",image:"https://images.unsplash.com/photo-1624378439575-d8705ad7ae80?w=600&q=80"},{id:"p4",name:"Jaqueta Corta-vento Preta",price:"R$ 459",image:"https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=600&q=80"},{id:"p5",name:"Boné Trucker Bege",price:"R$ 129",image:"https://images.unsplash.com/photo-1588850561407-ed78c282e89b?w=600&q=80"},{id:"p6",name:"Tênis Runner Branco",price:"R$ 599",image:"https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=600&q=80"},{id:"p7",name:"Camisa Social Linho",price:"R$ 279",image:"https://images.unsplash.com/photo-1602810318383-e386cc2a3ccf?w=600&q=80"},{id:"p8",name:"Shorts Tactel Preto",price:"R$ 149",image:"https://images.unsplash.com/photo-1591195853828-11db59a44f6b?w=600&q=80"},{id:"p9",name:"Vestido Midi Estampado",price:"R$ 389",image:"https://images.unsplash.com/photo-1585487000160-6ebcfceb0d03?w=600&q=80"},{id:"p10",name:"Blazer Alfaiataria Bege",price:"R$ 549",image:"https://images.unsplash.com/photo-1594938298603-c8148c4dae35?w=600&q=80"},{id:"p11",name:"Saia Plissada Preta",price:"R$ 219",image:"https://images.unsplash.com/photo-1583496661160-fb5886a13d44?w=600&q=80"},{id:"p12",name:"Bolsa Tote Couro Caramelo",price:"R$ 699",image:"https://images.unsplash.com/photo-1584917865442-de89df76afd3?w=600&q=80"},{id:"p13",name:"Ãculos Redondo Metal",price:"R$ 249",image:"https://images.unsplash.com/photo-1511499767150-a48a237f0083?w=600&q=80"},{id:"p14",name:"Relógio Minimalista Prata",price:"R$ 899",image:"https://images.unsplash.com/photo-1524592094714-0f0654e20314?w=600&q=80"},{id:"p15",name:"Cinto Fivela Dourada",price:"R$ 159",image:"https://images.unsplash.com/photo-1624222247344-550fb60583dc?w=600&q=80"},{id:"p16",name:"Cachecol Lã Xadrez",price:"R$ 189",image:"https://images.unsplash.com/photo-1520903920243-00d872a2d1c9?w=600&q=80"},{id:"p17",name:"Suéter Gola Alta Creme",price:"R$ 359",image:"https://images.unsplash.com/photo-1620799140408-edc6dcb6d633?w=600&q=80"},{id:"p18",name:"Coturno Cano Curto Preto",price:"R$ 649",image:"https://images.unsplash.com/photo-1520639888713-7851133b1ed0?w=600&q=80"},{id:"p19",name:"Regata Básica Branca",price:"R$ 79",image:"https://images.unsplash.com/photo-1503342217505-b0a15ec3261c?w=600&q=80"},{id:"p20",name:"Mochila Nylon Preta",price:"R$ 429",image:"https://images.unsplash.com/photo-1553062407-98eeb64c6a62?w=600&q=80"}];function Jo(){const{user:a}=je(),n=N(),[t]=ue(),d=t.get("url")??"";d.replace(/^https?:\/\//,"").replace(/\/.*$/,"");const l=t.get("source"),i=t.get("platform"),s=i==="shopify"?"Shopify":i==="nuvemshop"?"Nuvemshop":null,c=l==="connect",[m,h]=r.useState(null),[g,x]=r.useState({}),[v,P]=r.useState(""),w=Mt(),S=Dt(w),[$,A]=r.useState(!1),[R,T]=r.useState(!1),[z,C]=r.useState(!1),[k,q]=r.useState(!0),[D,_]=r.useState(!1),oe=5*3,[J,le]=r.useState([]),[ce,V]=r.useState(!1),me=r.useRef(null),pe=async(p,b)=>{if(p==="enterprise"){window.location.assign("mailto:[email protected]?subject=Snew%20Enterprise");return}if(!(a!=null&&a.teamId)||R){He.error("Não foi possÃvel abrir o checkout. Tente novamente.");return}T(!0);try{const I=await Ot(a.teamId,p,b);window.location.assign(I)}catch{He.error("Não foi possÃvel abrir o checkout. Tente novamente.")}finally{T(!1)}};r.useEffect(()=>{const p=me.current;p&&(p.scrollTop=p.scrollHeight)},[J,ce,z]);const ye=async p=>{const b=[...J,{role:"user",content:p}];le(b),V(!0);try{const{data:I,error:O}=await ro.functions.invoke("onboarding-chat",{body:{messages:b}});if(O)throw O;
2const Y=(I==null?void 0:I.reply)??"Não consegui responder agora, tenta de novo?";le(ae=>[...ae,{role:"assistant",content:Y}])}catch{le(I=>[...I,{role:"assistant",content:"Deu um problema pra responder agora. Tenta de novo em alguns segundos."}])}finally{V(!1)}};(()=>{var b,I;const p=((I=(b=[...J].reverse().find(O=>O.role==="assistant"))==null?void 0:b.content)==null?void 0:I.toLowerCase())??"";return p.includes("crédito")||p.includes("plano")||p.includes("upgrade")?["Ver planos","Como funcionam os créditos?","Quanto gasto por imagem?"]:p.includes("produto")||p.includes("imagem")||p.includes("foto")?["Gerar imagem de um produto","Trocar o fundo","Criar variações"]:p.includes("campanha")||p.includes("anúncio")||p.includes("ad")?["Criar campanha","Copy pra Instagram","Ideias de anúncio"]:["O que o agente faz?","Como funcionam os créditos?","Gerar minha primeira imagem","Como conectar mais produtos?"]})();const ge="onboarding:recents:images",j=p=>typeof p=="string"&&!!p&&p.length<4096&&!p.startsWith("blob:")&&!p.startsWith("data:")&&!p.startsWith("mock://"),M=p=>p.sort((b,I)=>I.updatedAt-b.updatedAt).slice(0,4),U=p=>{if(!Array.isArray(p))return[];if(typeof p[0]=="string"){const b=p.filter(j),I=[];for(let O=0;O<b.length&&I.length<4;O+=4)I.push({key:`__legacy__-${O}`,thumbs:b.slice(O,O+4),updatedAt:0});return I}return p.map((b,I)=>{const O=Array.isArray(b==null?void 0:b.thumbs)?Array.from(new Set(b.thumbs.filter(j))).slice(0,4):[];return{key:String((b==null?void 0:b.key)??`recent-${I}`),thumbs:O,updatedAt:Number((b==null?void 0:b.updatedAt)??0)}}).filter(b=>b.thumbs.length>0)},Z=()=>{try{const p=localStorage.getItem(ge);return p?M(U(JSON.parse(p))):[]}catch{return[]}},[se,H]=r.useState(()=>Z()),G=se.flatMap(p=>p.thumbs);r.useEffect(()=>{const p=()=>{H(Z())};return p(),window.addEventListener("storage",p),window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),()=>{window.removeEventListener("storage",p),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}},[]),r.useEffect(()=>{const p=setTimeout(()=>q(!1),1600);return()=>clearTimeout(p)},[]),r.useEffect(()=>{if(z)try{const p=window.AudioContext||window.webkitAudioContext;if(!p)return;const b=new p,I=b.currentTime;[880,1320].forEach((Y,ae)=>{const re=b.createOscillator(),B=b.createGain();re.type="sine",re.frequency.value=Y;const Q=I+ae*.08;B.gain.setValueAtTime(0,Q),B.gain.linearRampToValueAtTime(.12,Q+.02),B.gain.exponentialRampToValueAtTime(1e-4,Q+.35),re.connect(B).connect(b.destination),re.start(Q),re.stop(Q+.4)}),setTimeout(()=>b.close().catch(()=>{}),700)}catch{}},[z]);const de=Ye.filter(p=>p.name.toLowerCase().includes(v.trim().toLowerCase())),ie=p=>{const b=new URLSearchParams({mode:"url-import",url:d});if(p){b.set("productId",p);const I=Ye.find(O=>O.id===p);I&&(b.set("id",I.id),b.set("name",I.name),b.set("image",I.image))}n(`/studio-ai-modal?${b.toString()}`)};return e.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:"hsl(var(--background))",position:"relative"},children:[e.jsx("div",{style:{position:"fixed",top:0,left:0,zIndex:40},children:e.jsx(Ct,{})}),e.jsx("div",{style:{position:"fixed",top:12,right:40,zIndex:40},children:e.jsx(Yt,{credits:w,user:{name:"John O'Connor",email:"[email protected]"},onUpgradeClick:()=>A(!0),onTriggerClick:()=>A(!0),onTriggerMouseEnter:()=>{},onTriggerMouseLeave:()=>{}})}),e.jsxs("main",{style:{flex:1,display:"grid",gridTemplateColumns:"360px 1fr",gap:u[8],padding:`80px ${u[8]} ${u[8]}`},children:[e.jsxs("aside",{style:{display:"flex",flexDirection:"column",gap:u[3],position:"sticky",top:80,alignSelf:"stretch",height:"calc(100vh - 80px - "+u[8]+")",background:`hsl(${o.bg.primary})`,border:"1px solid hsl(var(--border))",boxShadow:te.sm,borderRadius:E.xl,padding:u[5],overflow:"hidden"},children:[e.jsxs("div",{ref:me,style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:u[5],paddingRight:u[1],marginRight:`-${u[1]}`},children:[(()=>{const p=new Date().getHours(),b=p<5?"Boa madrugada":p<12?"Bom dia":p<18?"Boa tarde":"Boa noite",I=(a==null?void 0:a.firstName)??"",O=G.length>0?"Que bom te ver de volta â dei uma olhada no que você já criou.":c?"Estou ansioso pra começar a trabalhar na sua loja.":"Estou ansioso pra começar a transformar a cara da sua loja.";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,marginBottom:u[2]},children:[e.jsxs("span",{style:{fontSize:16,color:`hsl(${o.text.tertiary})`,letterSpacing:"-0.014em",lineHeight:1.25},children:[b,I?`, ${I}`:""]}),e.jsx("span",{style:{fontSize:16,fontWeight:500,color:`hsl(${o.text.primary})`,letterSpacing:"-0.014em",lineHeight:1.25},children:O})]})})(),e.jsxs("div",{style:{alignSelf:"center",fontSize:11,color:`hsl(${o.text.tertiary})`,fontWeight:500,letterSpacing:"-0.005em",margin:`${u[1]} 0 ${u[2]}`},children:["Hoje à s ",new Date().toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})]}),e.jsx(Vo,{onComplete:()=>C(!0),messages:G.length>0?[e.jsxs(e.Fragment,{children:["Boa, vi que você já testou algumas imagens ali em ",e.jsx("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:"Recents"}),". Curti o que saiu."]}),e.jsxs(e.Fragment,{children:["Você já usou parte dos seus ",e.jsxs("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:[S," créditos"]})," grátis. Dá pra continuar, mas o teto chega rápido."]}),e.jsxs(e.Fragment,{children:["Com o ",e.jsx("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:"plano Pro"})," você libera créditos pra rodar campanhas inteiras, exportar em alta e destravar os agentes premium."]}),e.jsx(e.Fragment,{children:"Bora subir de plano agora enquanto tá quente? V
2ocê continua exatamente de onde parou."})]:[c?e.jsxs(e.Fragment,{children:["Conexão feita. Já puxei sua loja",s?e.jsxs(e.Fragment,{children:[" do ",e.jsx("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:s})]}):null," e a partir de agora vou te ajudar a transformar a cara dela."]}):e.jsx(e.Fragment,{children:"Bem-vindo. Peguei sua loja inteira e a partir de agora vou te ajudar a transformar a cara dela."}),e.jsxs(e.Fragment,{children:["Pra isso, já te dei ",e.jsxs("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:[S," créditos"]})," pra usar à vontade. à seu ponto de partida, sem compromisso."]}),e.jsx(e.Fragment,{children:"E relaxa, aqui você não precisa saber escrever prompt. Eu cuido disso por você."}),e.jsxs(e.Fragment,{children:["Se quiser ir com tudo desde o começo, dá pra subir pro ",e.jsx("strong",{style:{fontWeight:600,color:`hsl(${o.text.primary})`},children:"Pro"})," e liberar créditos e recursos avançados."]}),e.jsx(e.Fragment,{children:"Ou escolhe uma imagem de produto ali do lado e eu te mostro o próximo passo."})]}),z&&e.jsxs(e.Fragment,{children:[e.jsx(Yo,{onUpgrade:()=>A(!0)}),G.length===0&&e.jsx(Go,{})]}),J.map((p,b)=>p.role==="user"?e.jsx(Ko,{children:p.content},`m-${b}`):e.jsx(mt,{children:p.content},`m-${b}`)),ce&&e.jsx(ut,{})]}),e.jsx(Xo,{onSubmit:ye,disabled:ce||!z})]}),e.jsxs("section",{style:{display:"flex",flexDirection:"column",gap:u[6],minHeight:"100%",alignSelf:"stretch"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[4]},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[4]},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:500,color:"hsl(var(--foreground))",margin:0,letterSpacing:"-0.014em"},children:"Modelos"}),e.jsx("button",{type:"button",onClick:()=>ie(),style:{background:"transparent",border:"none",padding:0,fontSize:13,fontFamily:"inherit",color:`hsl(${o.text.tertiary})`,cursor:"pointer",letterSpacing:"-0.01em"},children:"Ver todos"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",columnGap:u[4],rowGap:u[4]},children:[{key:"grid",title:"Grid de fotos do produto",desc:"Transforme uma foto em 9 cenas estilizadas.",image:"https://images.unsplash.com/photo-1556228720-195a672e8a03?w=800&q=80"},{key:"model",title:"Modelo vestindo",desc:"Coloque seu produto em um modelo real.",image:"https://images.unsplash.com/photo-1520975916090-3105956dac38?w=800&q=80"},{key:"bold-bg",title:"Fundo colorido de estúdio",desc:"Solte o produto em um fundo bold, cinematográfico.",image:"https://images.unsplash.com/photo-1608571423902-eed4a5ad8108?w=800&q=80"},{key:"video",title:"VÃdeo de produto",desc:"Transforme uma imagem em um vÃdeo curto animado.",image:"https://images.unsplash.com/photo-1516575334481-f85287c2c82d?w=800&q=80"}].map(({key:p,title:b,desc:I,image:O})=>{const Y=`template-${p}`,ae=m===Y;return e.jsxs("button",{type:"button",onMouseEnter:()=>h(Y),onMouseLeave:()=>h(re=>re===Y?null:re),onClick:()=>ie(),style:{display:"flex",flexDirection:"column",gap:u[2],padding:0,background:"transparent",border:"none",textAlign:"left",cursor:"pointer",fontFamily:"inherit",opacity:ae?.94:1,transition:"opacity 200ms ease"},children:[e.jsx("div",{style:{position:"relative",width:"100%",aspectRatio:"4 / 3",background:`hsl(${o.bg.secondary})`,overflow:"hidden",borderRadius:E.lg,border:`1px solid hsl(${o.border.tertiary})`,boxShadow:ae?te.floatSoft:"none",transition:"box-shadow 200ms ease"},children:e.jsx("img",{src:O,alt:b,loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),e.jsx("div",{style:{fontSize:13,fontWeight:500,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em",lineHeight:1.3},children:b}),e.jsx("div",{style:{fontSize:12,color:`hsl(${o.text.tertiary})`,lineHeight:1.4,letterSpacing:"-0.005em",marginTop:-6},children:I})]},p)})})]}),e.jsx("div",{style:{height:1,width:"100%",background:`hsl(${o.border.tertiary})`}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[4]},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[4]},children:e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:u[3]},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:500,color:"hsl(var(--foreground))",margin:0,letterSpacing:"-0.014em"},children:"Recents"}),e.jsxs("span",{style:{fontSize:12,color:`hsl(${o.text.tertiary})`,fontWeight:400},children:[S," ",S===1?"crédito":"créditos"," restantes"]})]})}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",columnGap:u[4],rowGap:u[4]},children:(se.length>0?se.slice(0,4):Array.from({length:4},(p,b)=>({key:`placeholder-${b}`,thumbs:[],updatedAt:0}))).map((p,b)=>{const I={width:32,height:32,borderRadius:E.pill,background:`hsl(${o.bg.primary})`,border:"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:`hsl(${o.text.primary})`,boxShadow:te.floatSoft},O=`recent-${b}`,Y=m===O,ae=p.thumbs.slice(0,4),re=(B,Q=E.md)=>e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",borderRadius:Q,overflow:"hidden",background:`hsl(${o.bg.secondary})`},children:[e.jsx("img",{src:B,alt:"",loading:"lazy",onLoad:()=>x(he=>he[B]?he:{...he,[B]:!0}),onError:()=>x(he=>he[B]?he:{...he,[B]:!0}),style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}),!g[B]&&e.jsx("div",{style:{position:"absolute",inset:0,background:`linear-gradient(90deg, hsl(${o.bg.secondary}) 0%, hsl(${o.bg.tertiary}) 50%, hsl(${o.bg.secondary}) 100%) 0 0 / 200% 100%`,animation:"shimmer 1.4s linear infinite"}})]});return e.jsxs("div",{onMouseEnter:()=>h(O),onMouseLeave:()=>h(B=>
2B===O?null:B),onClick:()=>ie(),style:{position:"relative",cursor:"pointer",width:"100%",aspectRatio:"1 / 1",borderRadius:E.lg,overflow:"hidden",background:`hsl(${o.bg.secondary})`,padding:u[3],opacity:Y?.96:1,transition:"opacity 200ms ease"},children:[e.jsx("div",{style:{width:"100%",height:"100%",display:"grid",gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr 1fr",gap:u[2]},children:[0,1,2,3].map(B=>{const Q=ae[B];return e.jsx("div",{style:{minWidth:0,minHeight:0},children:Q?re(Q):e.jsx("div",{style:{width:"100%",height:"100%",borderRadius:E.md,background:`hsl(${o.border.secondary})`}})},Q??`empty-${B}`)})}),e.jsx("div",{style:{position:"absolute",inset:0,background:`hsl(${o.border.secondary})`,display:"flex",alignItems:"center",justifyContent:"center",opacity:Y?1:0,transition:"opacity 200ms ease",pointerEvents:Y?"auto":"none"},children:e.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),ie()},"aria-label":"Editar",style:I,children:e.jsx(Gt,{size:14,weight:"bold"})})})]},p.key||`group-${b}`)})})]}),e.jsx("div",{style:{height:1,width:"100%",background:"hsl(var(--border))"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[4]},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:500,color:"hsl(var(--foreground))",margin:0,letterSpacing:"-0.014em"},children:"Meus produtos"}),e.jsx("input",{type:"text",value:v,onChange:p=>P(p.target.value),placeholder:"Buscar produto",style:{background:`hsl(${o.bg.secondary})`,border:"none",outline:"none",boxShadow:"none",borderRadius:E.pill,padding:"8px 16px",fontSize:13,fontFamily:"inherit",color:"hsl(var(--foreground))",width:220}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",columnGap:u[4],rowGap:u[4]},children:k?Array.from({length:15}).map((p,b)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[2]},children:[e.jsx("div",{style:{width:"100%",aspectRatio:"1 / 1",borderRadius:E.lg,background:`linear-gradient(90deg, hsl(${o.bg.secondary}) 0%, hsl(${o.bg.tertiary}) 50%, hsl(${o.bg.secondary}) 100%)`,backgroundSize:"200% 100%",animation:"bubbleShimmer 1.4s linear infinite"}}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:u[2],paddingTop:2},children:[e.jsx("div",{style:{height:10,flex:1,maxWidth:"70%",borderRadius:E.sm,background:`linear-gradient(90deg, hsl(${o.bg.secondary}) 0%, hsl(${o.bg.tertiary}) 50%, hsl(${o.bg.secondary}) 100%)`,backgroundSize:"200% 100%",animation:"bubbleShimmer 1.4s linear infinite"}}),e.jsx("div",{style:{height:10,width:32,borderRadius:E.sm,background:`linear-gradient(90deg, hsl(${o.bg.secondary}) 0%, hsl(${o.bg.tertiary}) 50%, hsl(${o.bg.secondary}) 100%)`,backgroundSize:"200% 100%",animation:"bubbleShimmer 1.4s linear infinite"}})]})]},`sk-${b}`)):(D?de:de.slice(0,oe)).map(p=>{const b=m===p.id;return e.jsxs("div",{onMouseEnter:()=>h(p.id),onMouseLeave:()=>h(I=>I===p.id?null:I),style:{position:"relative",display:"flex",flexDirection:"column",gap:u[2],background:"transparent",opacity:b?.94:1,transition:"opacity 200ms ease"},children:[e.jsxs("div",{style:{position:"relative",width:"100%",aspectRatio:"1 / 1",background:`hsl(${o.bg.secondary})`,overflow:"hidden",borderRadius:E.lg,border:`1px solid hsl(${o.border.tertiary})`,boxShadow:b?te.floatSoft:"none",transition:"box-shadow 200ms ease"},children:[e.jsx("img",{src:p.image,alt:p.name,loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}),e.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:`hsl(${o.border.secondary})`,opacity:b?1:0,pointerEvents:b?"auto":"none",transition:"opacity 200ms ease"},children:e.jsx("button",{type:"button",onClick:()=>ie(p.id),style:{background:"white",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",borderRadius:E.pill,padding:"8px 14px",fontSize:13,fontWeight:500,fontFamily:"inherit",cursor:"pointer",boxShadow:te.sm},children:"Selecionar produto"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[2],minWidth:0},children:[e.jsx("div",{style:{flex:1,minWidth:0,fontSize:13,fontWeight:500,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.name}),e.jsx("div",{style:{flexShrink:0,fontSize:12,color:`hsl(${o.text.tertiary})`},children:p.price})]})]}
2,p.id)})}),!k&&!D&&de.length>oe&&e.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:u[4]},children:e.jsxs("button",{type:"button",onClick:()=>_(!0),style:{display:"inline-flex",alignItems:"center",gap:u[2],padding:`${u[2]} ${u[4]}`,background:`hsl(${o.bg.primary})`,border:`1px solid hsl(${o.border.tertiary})`,borderRadius:E.pill,fontSize:13,fontWeight:500,color:`hsl(${o.text.primary})`,fontFamily:"inherit",cursor:"pointer",transition:`background ${F.fast}`},onMouseEnter:p=>{p.currentTarget.style.background=`hsl(${o.bg.secondary})`},onMouseLeave:p=>{p.currentTarget.style.background=`hsl(${o.bg.primary})`},children:["Carregar mais",e.jsxs("span",{style:{color:`hsl(${o.text.tertiary})`,fontWeight:400},children:["(",de.length-oe,")"]})]})})]})]}),e.jsx(Et,{open:$,onClose:()=>A(!1),currentPlan:"free",onCheckout:pe})]})}const Qo={estilo_fotos:{context:"Plano · Estilo visual",intro:"Bora aplicar um estilo único nas suas fotos de produto. Escolhe um produto pra eu começar (ou eu pego o mais visitado)."},campanha:{context:"Plano · Campanha",intro:"Vamos tirar suas fotos do modo catálogo e transformar em peça de campanha. Me diz o produto e eu monto a cena."},carrossel:{context:"Plano · Carrossel",intro:"Posso montar uma sequência de imagens prontas pra um carrossel. Escolhe uma coleção ou um tema pra eu partir daÃ."},produto_cena:{context:"Plano · Produto em cena",intro:"Vou colocar seu produto em uso, em cena real ou em modelo. Me indica o produto pra começar."}},Ke=["Lendo sua loja","Lendo catálogo e preços","Analisando fotos e descrições","Montando seu Brand DNA"],pt={estilo_fotos:{icon:nt,skill:"Studio",texto:"Aplicar um estilo visual único nas suas fotos de produto",objetivos:["marca","tempo"]},campanha:{icon:no,skill:"Studio",texto:"Transformar seus produtos em peças de campanha, não só foto de catálogo",objetivos:["converter","tempo"]},carrossel:{icon:so,skill:"Studio",texto:"Criar uma sequência de imagens pronta pra um carrossel",objetivos:["converter","tempo"]},produto_cena:{icon:io,skill:"Studio",texto:"Colocar seus produtos em uso, em cena real ou em modelo",objetivos:["marca","converter","tempo"]}},Xe={shopify:{storeName:"Milkes",essencia:"Milkes é o calçado que acompanha a infância sem entregar o conforto pelo estilo.",fatos:{categoria:"Calçados e moda infantil de 0 a 12 anos",faixaPreco:"R$ 89 a R$ 259, ticket médio em torno de R$ 160",tamanhoCatalogo:"47 produtos ativos em 6 coleções",publico:"Mães urbanas de 28 a 42 que valorizam conforto, design e durabilidade"},comunicacaoAtual:"Suas fotos oscilam entre packshot de catálogo e cliques soltos de lifestyle, sem uma paleta que amarre tudo. As descrições resolvem tamanho e material, mas ainda não carregam a voz afetiva que aparece na sua bio.",objetivosSugeridos:[{id:"marca",motivo:"porque suas fotos ainda não seguem um sistema visual único"},{id:"converter",motivo:"porque as descrições estão curtas e técnicas nos 47 produtos"},{id:"tempo",motivo:"porque você produz cada foto manualmente pra 47 produtos"}],acoesDetectadas:[{id:"estilo_fotos",evidencia:"47 produtos com fotos sem um padrão visual comum"},{id:"produto_cena",evidencia:"42 dos 47 produtos aparecem só em packshot, sem contexto de uso"},{id:"campanha",evidencia:"imagens apenas de catálogo, nenhuma peça com clima de campanha"},{id:"carrossel",evidencia:"6 coleções que rendem carrossel por tema"}],veredito:"Já li a Milkes inteira e sei por onde começar. Suas imagens são o que segura sua conversão hoje, então é por elas que a gente começa.",mensagens:["Oi, eu sou o agente da Snew. Acabei de ler a Milkes inteira, do catálogo à s suas fotos.","Sua base é afetiva e forte: 47 produtos com uma história de infância bem contada. Mas suas imagens ainda não vendem o quanto poderiam, e é aà que dá pra ganhar mais rápido.","Me diz por onde você quer que eu comece:"]},nuvemshop:{storeName:"Minha Loja",essencia:"Uma curadoria de moda com alma editorial, feita pra quem se veste com intenção.",fatos:{categoria:"Vestuário sazonal com curadoria autoral",faixaPreco:"R$ 129 a R$ 480, ticket médio próximo de R$ 220",tamanhoCatalogo:"63 produtos ativos entre básicos e drops",publico:"Jovem adulto de 22 a 35 conectado com tendências e consumo consciente"},comunicacaoAtual:"A curadoria tem tom editorial, mas as fotos vêm de fontes diferentes e a paleta muda de produto pra produto. Ainda não vi criativos de ads que c
2arreguem a mesma identidade da home.",objetivosSugeridos:[{id:"marca",motivo:"porque as fotos misturam still de fornecedor e cliques próprios sem paleta comum"},{id:"converter",motivo:"porque as páginas de produto usam still de fornecedor sem cena de uso"},{id:"tempo",motivo:"porque cada drop exige refazer criativos do zero"}],acoesDetectadas:[{id:"estilo_fotos",evidencia:"fotos vindas de 3 fornecedores diferentes sem paleta comum"},{id:"campanha",evidencia:"63 produtos com foto de fornecedor, nenhuma peça de campanha"},{id:"produto_cena",evidencia:"48 dos 63 produtos só em still, sem foto em modelo ou cena"},{id:"carrossel",evidencia:"drops sazonais que rendem carrossel por tema"}],veredito:"Li sua curadoria inteira e sei por onde começar. O que puxa sua marca pra cima agora são imagens com identidade única, então é daà que eu parto.",mensagens:["Oi, eu sou o agente da Snew. Acabei de ler a sua loja inteira, do catálogo à s fotos.","Sua curadoria tem alma editorial, mas as fotos vêm de 3 fornecedores diferentes e a paleta muda a cada produto. à aà que dá pra ganhar mais rápido.","Me diz por onde você quer que eu comece:"]},default:{storeName:"sua marca",essencia:"Uma marca em construção, com curadoria própria e espaço pra ganhar uma identidade reconhecÃvel.",fatos:{categoria:"Produtos com posicionamento próprio",faixaPreco:"Faixa média coerente com o segmento",tamanhoCatalogo:"Catálogo enxuto em construção",publico:"Público que valoriza autenticidade e curadoria"},comunicacaoAtual:"A loja tem base sólida, mas a identidade visual ainda não está sistematizada e as descrições variam de tom entre produtos.",objetivosSugeridos:[{id:"marca",motivo:"porque a identidade visual ainda não está sistematizada"},{id:"converter",motivo:"porque as fotos de produto não têm contexto de uso"}],acoesDetectadas:[{id:"estilo_fotos",evidencia:"fotos de produto sem padrão visual consistente"},{id:"produto_cena",evidencia:"produto aparece só em packshot, sem cena de uso"},{id:"campanha",evidencia:"imagens apenas de catálogo, sem clima de campanha"},{id:"carrossel",evidencia:"coleções que rendem carrossel por tema"}],veredito:"Já li sua loja inteira e sei por onde começar. Suas imagens são o que segura sua conversão hoje, então é por elas que a gente começa.",mensagens:["Oi, eu sou o agente da Snew. Acabei de ler a sua loja inteira, do catálogo à s fotos.","Sua base tem posicionamento próprio, mas suas imagens ainda não carregam essa identidade. à por aà que a gente ganha mais rápido.","Me diz por onde você quer que eu comece:"]}};function ea(){N();const{markStepCompleted:a}=Oe(),[n,t]=r.useState("extracting"),[d,l]=r.useState(0),i=r.useRef(!1),s=r.useMemo(()=>lo(),[]),c=r.useMemo(()=>{if(s)return s.summary;const h=At(),g=(h==null?void 0:h.platform)??"default";return Xe[g]??Xe.default},[s]);r.useEffect(()=>{if(n!=="extracting")return;if(d>=Ke.length){if(i.current)return;i.current=!0;const g=setTimeout(()=>t("ready"),500);return()=>clearTimeout(g)}const h=setTimeout(()=>l(g=>g+1),900);return()=>clearTimeout(h)},[n,d]);const m=h=>{try{localStorage.setItem("snew_brand_dna_simple",JSON.stringify({...c,objetivosSelecionados:h}))}catch{}a("store"),L.updateOnboardingProgress(3,!1)};return n==="extracting"?e.jsxs(ve,{currentStep:"store",completedSteps:["goals"],heading:"Lendo a alma da sua marcaâ¦",subheading:`Analisando ${c.storeName}. Isso leva só alguns segundos.`,children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:u[3]},children:Ke.map((h,g)=>{const x=g<d,v=g===d,P=g>d;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[3],opacity:P?.4:1,transition:`opacity ${F.base}`},children:[e.jsx("div",{style:{width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center"},children:x?e.jsx(Te,{size:20,weight:"fill",color:"#5BA940"}):v?e.jsx(Le,{size:18,weight:"bold",color:`hsl(${o.text.primary})`,style:{animation:"spin 1s linear infinite"}}):e.jsx("div",{style:{width:16,height:16,borderRadius:"50%",border:`1.5px solid hsl(${o.border.tertiary})`}})}),e.jsx("div",{style:{fontSize:14,fontWeight:v?500:400,color:P?`hsl(${o.text.tertiary})`:`hsl(${o.text.primary})`},children:h})]},h)})}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}):e.jsx(ta,{info:c,onPersist:m})}function ta({info:a,onPersist:n}){const[d]=r.useState(()=>new Set(a.objetivosSugeridos.map(s=>s.id))),l=r.useMemo(()=>{const s=new Set(a.acoesDetectadas.map(m=>m.id));new Map(a.acoesDetectadas.map(m=>[m.id,m.evidencia]));const c=[];return a.acoesDetectadas.forEach(m=>{!s.has(m.id)||!pt[m.id].objetivos.some(x=>d.has(x))||c.push({id:m.id,evidencia:m.evidencia})}
2),c.length===0&&a.acoesDetectadas.slice(0,5).forEach(m=>c.push({id:m.id,evidencia:m.evidencia})),c.slice(0,6)},[d,a]),i=()=>{n(Array.from(d))};return e.jsxs("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:`hsl(${o.bg.secondary})`},children:[e.jsx("header",{style:{display:"flex",flexDirection:"column",gap:u[4],padding:`${u[6]} ${u[6]} ${u[3]}`,maxWidth:640,width:"100%",margin:"0 auto"},children:e.jsx("div",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.02em",color:`hsl(${o.text.primary})`,lineHeight:1},children:"snew"})}),e.jsx("main",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:`${u[4]} ${u[6]}`},children:e.jsx("div",{style:{width:"100%",maxWidth:580,animation:`fadeUp ${F.base} ease-out`},children:e.jsx(oa,{acoes:l,storeName:a.storeName,veredito:a.veredito,mensagens:a.mensagens,onBeforeNavigate:i})},2)}),e.jsx("style",{children:` 3 @keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } } 4 @keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } } 5 @keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } } 6 `})]})}function oa({acoes:a,storeName:n,veredito:t,mensagens:d,onBeforeNavigate:l}){var C;const i=N(),[s,c]=r.useState(null),m=d??[`Oi, eu sou o agente da Snew. Acabei de ler a ${n} inteira, do catálogo às fotos.`,t??"Sua base é forte, mas suas imagens ainda não vendem o quanto poderiam. à aà que dá pra ganhar mais rápido.","Me diz por onde você quer que eu comece:"],h=r.useMemo(()=>[{at:400,stage:"typing1"},{at:1400,stage:"msg1"},{at:2e3,stage:"typing2"},{at:3200,stage:"msg2"},{at:3800,stage:"typing3"},{at:4700,stage:"msg3"},{at:5100,stage:"actions"}],[]),[g,x]=r.useState(0),[v,P]=r.useState(!1);r.useEffect(()=>{if(v||g>=h.length)return;const k=g===0?0:h[g-1].at,q=h[g].at-k,D=setTimeout(()=>x(_=>_+1),q);return()=>clearTimeout(D)},[g,v,h]);const w=v?"actions":((C=h[Math.max(0,g-1)])==null?void 0:C.stage)??"typing1",S=["typing1","msg1","typing2","msg2","typing3","msg3","actions"],$=v?S.length-1:S.indexOf(w),A=k=>$>=S.indexOf(`msg${k}`),R=k=>!v&&$>=S.indexOf(`typing${k}`)&&$<S.indexOf(`msg${k}`),T=$>=S.indexOf("actions"),z=()=>{v||P(!0)};return e.jsxs("div",{onClick:z,style:{display:"flex",flexDirection:"column",gap:u[5],cursor:v?"default":"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[3],paddingBottom:u[4],borderBottom:`1px solid hsl(${o.border.tertiary})`},children:[e.jsxs("div",{style:{position:"relative",width:40,height:40,flexShrink:0},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:999,background:`hsl(${o.text.primary})`,color:`hsl(${o.bg.primary})`,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(et,{size:20,weight:"fill"})}),e.jsx("div",{style:{position:"absolute",right:-1,bottom:-1,width:12,height:12,borderRadius:999,background:"#3AA85E",border:`2px solid hsl(${o.bg.secondary})`}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontSize:14,fontWeight:600,letterSpacing:"-0.01em",color:`hsl(${o.text.primary})`},children:"Agente Snew"}),e.jsxs("span",{style:{fontSize:12,color:"#3A7A1F",letterSpacing:"-0.01em"},children:[n," conectada"]})]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:u[3],minHeight:220},children:[1,2,3].map(k=>A(k)?e.jsx(aa,{children:m[k-1]},k):R(k)?e.jsx(ra,{},k):null)}),T&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:u[2],marginTop:u[2]},onClick:k=>k.stopPropagation(),children:a.map((k,q)=>{const D=pt[k.id],_=D.icon,W=Qo[k.id],y=s===k.id,oe=()=>{l==null||l();const J=new URLSearchParams({brief:"home3-product",name:D.texto,intro:W.intro,context:W.context});i(`/studio-ai-modal?${J.toString()}`)};return e.jsxs("button",{type:"button",onClick:oe,onMouseEnter:()=>c(k.id),onMouseLeave:()=>c(null),onFocus:()=>c(k.id),onBlur:()=>c(null),style:{display:"flex",alignItems:"center",gap:u[3],padding:u[3],background:y?`hsl(${o.bg.primary})`:`hsl(${o.bg.primary})`,border:y?`1px solid hsl(${o.text.primary})`:`1px solid hsl(${o.border.tertiary})`,borderRadius:E.md,textAlign:"left",cursor:"pointer",fontFamily:"inherit",transition:`background ${F.fast}, border-color ${F.fast}`,animation:v?void 0:"slideIn 320ms ease-out both",animationDelay:v?void 0:`${q*110}ms`},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:E.md,background:`hsl(${o.text.primary})`,color:`hsl(${o.bg.primary})`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(_,{size:18,weight:"fill"})}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:3},children:[e.jsx("p",{style:{margin:0,fontSize:15,lineHeight:1.4,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em"},children:D.texto}),e.jsx("span",{style:{fontSize:12,lineHeight:1.4,color:"#3A7A1F"},children:k.evidencia})]}),e.jsx(xe,{size:14,weight:"bold",color:`hsl(${o.text.tertiary})`,style:{flexShrink:0,transform:y?"translateX(3px)":"translateX(0)",transition:`transform ${F.fast}`}})]},k.id)})})]})}function aa({children:a}){return e.jsxs("div",{style:{alignSelf:"flex-start",maxWidth:"88%",padding:`${u[3]} ${u[4]}`,background:`hsl(${o.bg.primary})`,border:`1px solid hsl(${o.border.tertiary})`,borderRadius:16,borderTopLeftRadius:6,fontSize:14.5,lineHeight:1.5,letterSpacing:"-0.01em",color:`hsl(${o.text.primary})`,animation:"bubbleIn 260ms ease-out both"},children:[a,e.jsx("style",{children:"@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }"})]})}function ra(){return e.jsxs("div",{style:{alignSelf:"flex-start",padding:`${u[3]} ${u[4]}`,background:`hsl(${o.bg.primary})`,border:`1px solid hsl(${o.border.tertiary})`,borderRadius:16,borderTopLeftRadius:6,display:"inline-flex",alignItems:"center",gap:4},children:[[0,150,300].map(a=>e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:`hsl(${o.text.tertiary})`,display:"inline-block",animation:"typingDot 1s infinite ease-in-out",animationDelay:`${a}ms`}},a)),e.jsx("style",{children:"@keyframes typingDot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }"})]})}function na(){const a=N(),{lang:n}=ne(),t=n==="pt-BR",[d,l]=r.useState(null),i=d==="upload",s=d==="url";return e.jsxs(fe,{step:"create",children:[e.jsxs("h1",{style:{margin:"0 0 58px",fontSize:31,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.2,color:f.text,textAlign:"center"},children:[t?"Boas-vindas à Snew.":"Welcome to Snew.",e.jsx("br",{}),t?"Vamos criar sua primeira imagem":"Let's create your first image"]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:25},children:[e.jsxs("button",{type:"button",onClick:()=>a("/onboarding/import?source=upload"),onMouseEnter:()=>l("upload"),onMouseLeave:()=>l(null),onFocus:()=>l("upload"),onBlur:()=>l(null),style:{...Je,flexDirection:"column",gap:4,border:`2px solid ${i?f.accent:"transparent"}`,background:i?f.accentSurface:f.surface},children:[e.jsx(qe,{size:22,color:f.text,style:{marginBottom:6}}),t?"Enviar uma imagem":"Upload an image",e.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textMuted}
6,children:t?"Escolha no seu computador":"Choose from your computer"})]}),e.jsxs("button",{type:"button",onClick:()=>a("/onboarding/import?source=url"),onMouseEnter:()=>l("url"),onMouseLeave:()=>l(null),onFocus:()=>l("url"),onBlur:()=>l(null),style:{...Je,flexDirection:"column",gap:4,border:`2px solid ${s?f.accent:"transparent"}`,background:s?f.accentSurface:f.surface},children:[e.jsx(co,{size:22,color:f.text,style:{marginBottom:6}}),t?"Link da loja ou da imagem":"Store or image link",e.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textMuted},children:t?"Importe até 10 produtos":"Import up to 10 products"})]})]})]})}const Je={width:277,height:277,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:24,color:f.text,fontFamily:"inherit",fontSize:18,fontWeight:500,letterSpacing:"-0.02em",cursor:"pointer",textAlign:"center",transition:"background 120ms ease, border-color 120ms ease"},sa="/onboarding/intent",gt="/onboarding/products",ia="/onboarding/analyze?source=upload",ht=["Identifying store information","Syncing products","Analyzing visual identity","Finishing connection"],la=["Identificando informações da loja","Sincronizando produtos","Analisando a identidade visual","Finalizando a conexão"],Me=a=>/^(https?:\/\/)?([\w-]+\.)+[\w-]{2,}(\/.*)?$/i.test(a.trim()),ca=a=>a.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/.*$/,"");function da(){const[a]=ue(),n=a.get("source"),t=n==="store"||n==="url"?n:"upload";return e.jsx(fe,{step:"import",children:t==="store"?e.jsx(ma,{}):t==="url"?e.jsx(pa,{initialUrl:a.get("url")??""}):e.jsx(ua,{})})}const be={margin:"0 0 40px",fontSize:31,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.2,color:f.text,textAlign:"center"};function ua(){const a=N(),{lang:n}=ne(),t=n==="pt-BR",d=r.useRef(null),[l,i]=r.useState(!1),[s,c]=r.useState(!1),[m,h]=r.useState(()=>{const S=Be();return S?{name:S.label,url:S.dataUrl}:null}),[g,x]=r.useState(null),v=l||s,P=async S=>{if(!(!S||!S.type.startsWith("image/"))){x(null);try{const $=await st(S);if(!$)throw new Error("empty image");const A={name:S.name.replace(/\.[^.]+$/,""),url:$};if(!ke({label:A.name,dataUrl:A.url}))throw new Error("image persistence failed");h(A)}catch{h(null),x(t?"Não foi possÃvel preparar esta imagem. Tente outro arquivo.":"We couldn't prepare this image. Try another file.")}}},w=()=>{if(!m)return;if(!ke({label:m.name,dataUrl:m.url})){x(t?"Não foi possÃvel salvar a imagem neste navegador. Libere espaço ou tente outro arquivo.":"We couldn't save the image in this browser. Free up space or try another file.");return}L.saveOnboardingProfile({storePlatform:null,storeUrl:"",catalogSource:"upload",starterProductId:null,starterStyleId:null,starterStyleIds:[],starterCampaign:null,uploadProductClassification:null,starterProductSnapshot:null,recommendationTrace:null}),a(ia)};return e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:be,children:t?"Envie uma foto do produto":"Upload a product photo"}),m?e.jsx("div",{style:{width:"min(472px, 100%)",height:360,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:24,background:f.surface,marginBottom:48},children:e.jsxs("div",{style:{position:"relative",width:178,height:178},children:[e.jsx("img",{src:m.url,alt:m.name,style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:16,display:"block"}}),e.jsx("button",{type:"button",onClick:()=>{h(null),ke(null)},"aria-label":t?"Remover imagem":"Remove image",title:t?"Remover imagem":"Remove image",className:"wf-hover-dim",style:{position:"absolute",top:10,right:10,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:4,background:"#d9d9d9",color:"#333333",cursor:"pointer"},children:e.jsx(ot,{size:14,weight:"bold"})})]})}):e.jsxs("label",{htmlFor:"onboarding-product-upload","aria-label":t?"Escolher uma foto do produto":"Choose a product photo",onDragOver:S=>{S.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:S=>{var $;S.preventDefault(),i(!1),P(($=S.dataTransfer.files)==null?void 0:$[0])},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{position:"relative",width:"min(480px, 100%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,padding:"56px 24px",borderRadius:24,border:`2px dashed ${v?f.accent:"#3a3a3a"}`,background:v?f.accentSurface:f.surface,cursor:"pointer",textAlign:"center",marginBottom:48,overflow:"hidden",transition:"background 120ms ease, border-color 120ms ease"},children:[e.jsx(qe,{size:24,color:f.text,style:{marginBottom:6}}),e.jsx("div",{style:{fontSize:16,fontWeight:500,color:f.text},children:t?"Arraste a imagem para cá":"Drag the image here"}),e.jsx("div",{style:{fontSize:14,fontWeight:500,color:f.textMuted},children:t?"Ou clique para escolher":"Or click to choose"})]}),e.jsx("input",{ref:d,id:"onboarding-product-upload",type:"file",accept:"image/*","aria-label":t?"Escolher uma foto do produto":"Cho
6ose a product photo",tabIndex:-1,style:{position:"fixed",width:1,height:1,opacity:0,pointerEvents:"none",clipPath:"inset(50%)"},onChange:S=>{var R;const $=S.currentTarget,A=(R=$.files)==null?void 0:R[0];P(A).finally(()=>{$.value=""})}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:20},children:[g?e.jsx("p",{role:"alert",style:{margin:0,maxWidth:480,color:"#ff7b7b",fontSize:13,textAlign:"center"},children:g}):null,e.jsx(X,{label:t?"Continuar":"Continue",onClick:w,disabled:!m}),e.jsx(K,{label:t?"Pular por agora":"Skip for now",onClick:()=>a(sa)})]})]})}function ft({stepIndex:a}){const{lang:n}=ne(),t=n==="pt-BR"?la:ht;return e.jsxs("div",{style:{width:"min(480px, 100%)",display:"flex",flexDirection:"column",gap:18,padding:28,borderRadius:24,background:f.surface},children:[t.map((d,l)=>{const i=l<a,s=l===a;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[i?e.jsx(Te,{size:18,weight:"fill",color:f.accent}):s?e.jsx(Le,{size:18,weight:"bold",color:f.text,style:{animation:"wf-spin 900ms linear infinite"}}):e.jsx("div",{style:{width:18,height:18,borderRadius:999,border:`1.5px solid ${f.textMuted}`}}),e.jsx("span",{style:{fontSize:15,color:i||s?f.text:f.textMuted},children:d})]},d)}),e.jsx("style",{children:"@keyframes wf-spin { to { transform: rotate(360deg); } }"})]})}function ma(){var ge;const a=N(),{lang:n}=ne(),t=n==="pt-BR",[d]=ue(),[l,i]=r.useState(wt),[s,c]=r.useState(!1),m=d.get("shopify")==="connected"?"shopify":d.get("nuvemshop")==="connected"?"nuvemshop":null,h=$t(d,n),[g,x]=r.useState((l==null?void 0:l.sourceUrl)??""),[v,P]=r.useState((l==null?void 0:l.sourceUrl)??""),[w,S]=r.useState(m??(l==null?void 0:l.platform)??null),[$,A]=r.useState(""),[R,T]=r.useState(!1),[z,C]=r.useState(null),k=r.useRef(!1),q=Kt(),D=Xt(),_=uo(w),W=mo(),y=_.data,oe=q.isPending||D.isPending,J=!!(m||h||l||oe||!s&&(y!=null&&y.store)),le=y!=null&&y.store?y.productsSynced?y.contextReady?3:2:1:0;r.useEffect(()=>{var Z,se;if(!(y!=null&&y.ready)||k.current||h||s)return;const j=(Z=y.store)==null?void 0:Z.platform;if(!j)return;k.current=!0;const M=((se=y.store)==null?void 0:se.platform_url)||(l==null?void 0:l.sourceUrl)||v;tt(),Re(),Fe({platform:j,status:"connected",shopUrl:M}),L.saveOnboardingProfile({storePlatform:j,storeUrl:M,catalogSource:"connected-store",starterProductId:null,starterStyleId:null,starterStyleIds:[],starterCampaign:null,starterProductSnapshot:null,recommendationTrace:null}),(y.brandDna?Promise.resolve().then(()=>{var H;return po(go({storeName:(H=y.store)==null?void 0:H.name,storeUrl:M,brandDna:y.brandDna}))}):vt(async()=>{const{hydrateStoreContextFromSupabase:H}=await import("./KnowledgeBasePage-DJT9Fkps.js");return{hydrateStoreContextFromSupabase:H}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])).then(({hydrateStoreContextFromSupabase:H})=>H())).catch(()=>null).finally(()=>a(gt,{replace:!0}))},[h,l==null?void 0:l.sourceUrl,a,v,s,y]);const ce=async()=>{if(!(!Me(g)||R)){T(!0),C(null);try{const j=kt(g);let M=Ne(j);if(!M)try{const U=await Ft(j);M=Ne(j,U.products.map(Z=>({sourceUrl:U.sourceUrl,imageUrl:Z.image_url,galleryUrls:Z.gallery_urls,productUrl:Z.product_url})))}catch{}P(j),S(M),M==="shopify"&&A(Ce(j)??""),M||C(t?"Não foi possÃvel detectar a plataforma automaticamente. Escolha uma abaixo.":"We couldn't detect the platform automatically. Choose one below.")}catch{C(t?"Digite uma URL válida para sua loja.":"Enter a valid URL for your store.")}finally{T(!1)}}},V=async()=>{if(!w||!v||oe)return;C(null);const j=w==="shopify"?Ce($||v):null;if(w==="shopify"&&!j){C(t?"Digite o domÃnio administrativo no formato sua-loja.myshopify.com.":"Enter the admin domain in the format your-store.myshopify.com.");return}It(w,v),i({platform:w,sourceUrl:v,startedAt:new Date().toISOString()}),c(!1);try{w==="shopify"?await q.mutateAsync({shop_domain:j,redirect_uri:ze}):await D.mutateAsync({redirect_uri:ze})}catch(M){Re(),i(null),C(M instanceof Error&&M.message==="authenticated_session_required"?t?"Sua sessão expirou. Entre novamente antes de conectar sua loja.":"Your session expired. Sign in again before connecting your store.":t?"Não foi possÃvel abrir a autenticação da loja. Tente novamente.":"We couldn't open store authentication. Try again.")}},me=async()=>
6{if(!(!(y!=null&&y.store)||W.isPending)){C(null);try{await W.mutateAsync({store:y.store,sourceUrl:(l==null?void 0:l.sourceUrl)||v}),await _.refetch()}catch{C(t?"Não foi possÃvel retomar a sincronização agora. Tente novamente em instantes.":"We couldn't resume sync right now. Try again in a moment.")}}};if(J){const j=(y==null?void 0:y.store)&&!y.platformMatches,M=!!(y!=null&&y.store&&y.platformMatches&&!h),U=h||z||(_.isError?t?"Não foi possÃvel verificar a sincronização da loja.":"We couldn't check the store sync.":j?t?"A loja conectada não corresponde à plataforma selecionada.":"The connected store doesn't match the selected platform.":null);return e.jsxs(e.Fragment,{children:[e.jsxs("h1",{style:be,children:[t?"Conectando":"Connecting"," ",(((ge=y==null?void 0:y.store)==null?void 0:ge.platform)??w)==="shopify"?"Shopify":"Nuvemshop"]}),e.jsx(ft,{stepIndex:le}),e.jsx("p",{role:U?"alert":"status",style:{margin:"18px 0 0",maxWidth:480,minHeight:20,color:U?"#ef8b8b":f.textMuted,fontSize:13,lineHeight:1.5,textAlign:"center"},children:U||(y!=null&&y.productsSynced&&!y.contextReady?t?"Os produtos chegaram. Estamos finalizando a análise da identidade da loja.":"Products have arrived. We're finishing the store identity analysis.":t?"Aguardando sua loja confirmar a sincronização.":"Waiting for your store to confirm the sync.")}),U?e.jsxs("div",{style:{marginTop:24,display:"flex",flexDirection:"column",alignItems:"center",gap:16},children:[e.jsx(X,{label:M?t?"Retomar sincronização":"Resume sync":t?"Verificar novamente":"Check again",onClick:()=>M?void me():void _.refetch(),disabled:W.isPending}),e.jsx(K,{label:t?"Reiniciar conexão":"Restart connection",onClick:()=>{Re(),i(null),c(!0),S(null),C(null),a("/onboarding/import?source=store",{replace:!0})}})]}):y!=null&&y.store&&!y.ready?e.jsx("div",{style:{marginTop:22},children:e.jsx(K,{label:W.isPending?t?"Retomando sincronização...":"Resuming sync...":t?"Está demorando? Retome a sincronização":"Taking too long? Resume sync",onClick:()=>void me()})}):null]})}const pe=Me(g),ye=w==="shopify"&&!Ce(v);return e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:be,children:t?"Conecte sua loja":"Connect your store"}),e.jsxs("div",{style:{width:"min(580px, 100%)",marginBottom:24},children:[e.jsx("input",{type:"url",autoFocus:!0,value:g,onChange:j=>{x(j.target.value),P(""),S(null),C(null)},onKeyDown:j=>{j.key==="Enter"&&pe&&ce()},placeholder:t?"https://sua-loja.com.br":"https://your-store.com","aria-invalid":!!z,style:{width:"100%",height:64,padding:"0 24px",background:f.surface,border:`2px solid ${z?"#e36c6c":"transparent"}`,borderRadius:999,outline:"none",fontSize:16,fontWeight:500,fontFamily:"inherit",color:f.text}}),e.jsx("p",{style:{margin:"10px 12px 0",minHeight:20,color:z?"#ef8b8b":f.textMuted,fontSize:13},children:z||(w?`${w==="shopify"?"Shopify":"Nuvemshop"} ${t?"detectada":"detected"}.`:t?"Vamos detectar a plataforma antes de abrir a autenticação segura.":"We'll detect the platform before opening secure authentication.")})]}),v?e.jsx("div",{style:{width:"min(580px, 100%)",display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:24},children:[{id:"shopify",label:"Shopify",logo:e.jsx(Jt,{})},{id:"nuvemshop",label:"Nuvemshop",logo:e.jsx(Qt,{})}].map(j=>{const M=w===j.id;return e.jsxs("button",{type:"button",onClick:()=>{S(j.id),C(null),j.id==="shopify"&&A(Ce(v)??"")},style:{height:170,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14,border:`2px solid ${M?f.accent:"transparent"}`,borderRadius:24,background:M?f.accentSurface:f.surface,color:f.text,fontFamily:"inherit",fontSize:16,fontWeight:500,cursor:"pointer"},children:[e.jsx("span",{style:{width:44,height:44},children:j.logo}),j.label]},j.id)})}):null,ye?e.jsxs("div",{style:{width:"min(580px, 100%)",marginBottom:24},children:[e.jsx("input",{type:"text",value:$,onChange:j=>A(j.target.value),placeholder:t?"sua-loja.myshopify.com":"your-store.myshopify.com","aria-label":t?"DomÃnio administrativo da Shopify":"Shopify admin domain",style:{width:"100%",height:56,padding:"0 22px",background:f.surface,border:"2px s
6olid transparent",borderRadius:999,outline:"none",fontSize:15,fontFamily:"inherit",color:f.text}}),e.jsx("p",{style:{margin:"10px 12px 0",color:f.textMuted,fontSize:13},children:t?"A Shopify exige o domÃnio administrativo, mesmo quando a loja usa um domÃnio personalizado.":"Shopify requires the admin domain, even when the storefront uses a custom domain."})]}):null,e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:20},children:[v?e.jsx(X,{label:w?`${t?"Conectar":"Connect"} ${w==="shopify"?"Shopify":"Nuvemshop"}`:t?"Escolha uma plataforma":"Choose a platform",onClick:()=>void V(),disabled:!w||oe}):e.jsx(X,{label:R?t?"Detectando...":"Detecting...":t?"Detectar plataforma":"Detect platform",onClick:()=>void ce(),disabled:!pe||R}),e.jsx(K,{label:t?"Usar uma URL":"Use a URL",onClick:()=>a("/onboarding/import?source=url")})]})]})}function pa({initialUrl:a=""}){const n=N(),{lang:t}=ne(),d=t==="pt-BR",[l,i]=r.useState(a),[s,c]=r.useState(!1),[m,h]=r.useState(!1),[g,x]=r.useState(0),[v,P]=r.useState(null),[w,S]=r.useState(!1),$=Me(l);r.useEffect(()=>{if(!m)return;const T=setInterval(()=>{x(z=>Math.min(z+1,ht.length-1))},900);return()=>clearInterval(T)},[m]);const A=async()=>{if(!(!$||m)){h(!0),x(0),P(null),S(!1);try{const T=await _t(l);Fe({platform:null,status:"connected",shopUrl:T.sourceUrl}),L.saveOnboardingProfile({storePlatform:null,storeUrl:T.sourceUrl,catalogSource:"url",starterProductId:null,starterStyleId:null,starterStyleIds:[],starterCampaign:null,starterProductSnapshot:null,recommendationTrace:null}),n(gt)}catch(T){h(!1),x(0),P(d?"Não foi possÃvel importar esta loja.":T instanceof Error?T.message:"We couldn't import this store."),S(Ut(T))}}},R=()=>{tt(),L.saveOnboardingProfile({storePlatform:null,storeUrl:l.trim(),catalogSource:"demo",starterProductId:null,starterStyleId:null,starterStyleIds:[],starterCampaign:null,starterProductSnapshot:null,recommendationTrace:null}),n("/onboarding/products?source=demo")};return m?e.jsxs(e.Fragment,{children:[e.jsxs("h1",{style:be,children:[d?"Importando":"Importing"," ",ca(l)]}),e.jsx(ft,{stepIndex:g})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:be,children:d?"Use um link de loja ou imagem":"Use a store or image link"}),e.jsxs("div",{style:{width:"min(520px, 100%)",marginBottom:48},children:[e.jsx("input",{type:"url",autoFocus:!0,value:l,onChange:T=>{i(T.target.value),P(null),S(!1)},onKeyDown:T=>{T.key==="Enter"&&$&&A()},placeholder:d?"https://sua-loja.com.br":"https://your-store.com","aria-invalid":!!v,style:{width:"100%",height:64,padding:"0 24px",background:f.surface,border:`2px solid ${v?"#e36c6c":"transparent"}`,borderRadius:999,outline:"none",fontSize:16,fontWeight:500,fontFamily:"inherit",color:f.text},onFocus:T=>{v||(T.currentTarget.style.borderColor=f.accent)},onBlur:T=>{v||(T.currentTarget.style.borderColor="transparent")}}),e.jsx("p",{style:{margin:"12px 12px 0",minHeight:20,fontSize:13,lineHeight:1.45,color:v?"#ef8b8b":f.textMuted},children:v||(d?"Vamos ler apenas informações públicas e importar até 10 produtos.":"We'll only read public information and import up to 10 products.")})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:20},children:[e.jsx(X,{label:d?"Importar produtos":"Import products",onClick:()=>void A(),disabled:!$}),w&&e.jsx(K,{label:d?"Testar produtos de exemplo":"Try sample products",onClick:R}),e.jsx(K,{label:d?"Conectar uma plataforma":"Connect a platform",onClick:()=>c(!0)})]}),e.jsx(eo,{open:s,onOpenChange:c,redirectUri:ze})]})}const ga=5,ha=10;function fa(){var $,A;const a=N(),{lang:n}=ne(),t=n==="pt-BR",[d]=ue(),{products:l,loading:i,origin:s,connectedStoreState:c,refetch:m}=Ie(),h=($=L.getCurrentUser())==null?void 0:$.profile,g=((A=h==null?void 0:h.storeUrl)==null?void 0:A.trim())||"",x=d.get("source")==="demo"&&(h==null?void 0:h.catalogSource)==="demo",v=x||s==="url"?ha:ga,w=r.useMemo(()=>(x?Ze:l).filter(R=>R.image_url).slice(0,v),[l,!1,v,x]),S=R=>{if(x){const z=Ze.find(C=>C.product_id===R);if(!z)return;L.saveOnboardingProfile({catalogSource:"demo",starterProductId:void 0,starterStyleId:void 0,starterStyleIds:[],starterCampaign:null,starterCastIds:[],starterNote:"",recommendationTrace:void 0,starterProductSnapshot:{id:z.product_id,name:z.name,imageUrl:z.image_url,origin:"demo",category:null,selectedAt:new Date().toISOString()}})}const T=new URLSearchParams({product:R});x&&T.set("source","demo"),a(`/onboarding/analyze?${T.toString()}`)};return e.jsxs(fe,{step:"products",children:[e.jsx("h1",{style:{margin:"0 0 40px",fontSize:31,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.2,color:f.text,textAlign:"center"},children:x?t?"Escolha um produto de demonstração":"Choose a demo product":t?"Escolha um produto para começar":"Choose a product to get started"}),x?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{...$e,marginTop:-24},children:t?"Não encontramos um catálogo nesta URL. Estes itens servem apenas para você testar uma geração. Eles não pertencem à sua loja e não serão importados.":"We couldn't find a catalog at this URL. These items are only here so you can test a generation. They don't belong to your store and won't be imported."}),e.jsx("div",{style:Ae,children:w.map(R=>e.jsx(Qe,{product:R,onClick:()=>S(R.product_id)},R.product_id))}),e.jsx(K,{label:t?"Enviar meu próprio produto":"Upload my own product",onClick:()=>a("/onboarding/import?source=upload")})]}):i?e.jsx("div",{style:Ae,children:Array.from({length:v}).map((R,T)=>e.jsx("div",{style:{aspectRatio:"3 / 4",borderRadius:24,background:f.surface}},T))}):s==="connected-store"&&c==="syncing"?e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status",style:$e,children:t?"Sua loja está conectada. A sincronização dos produtos ainda está em andamento.":"Your store is connected. Product sync is still in progress."}),e.jsx(K,{label:t?"Verificar agora":"Check now",onClick:()=>void m()})]}):s==="connected-store"&&(c==="error"||c==="disconnected")?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:$e,children:c==="disconnected"?t?"
6Não encontramos uma loja autenticada nesta sessão.":"We couldn't find an authenticated store in this session.":t?"Não foi possÃvel carregar os produtos sincronizados da sua loja.":"We couldn't load the products synced from your store."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18},children:[e.jsx(X,{label:t?"Verificar conexão":"Check connection",onClick:()=>void m()}),e.jsx(K,{label:t?"Conectar novamente":"Connect again",onClick:()=>a("/onboarding/import?source=store")})]})]}):w.length===0&&s==="url"?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{margin:"0 0 32px",maxWidth:460,fontSize:16,fontWeight:500,lineHeight:1.5,letterSpacing:"-0.01em",color:f.textMuted,textAlign:"center"},children:t?"O catálogo desta URL não está mais disponÃvel neste navegador. Importe o link novamente para manter os produtos desta loja separados dos catálogos de demonstração ou conectados.":"This URL catalog is no longer available in this browser. Import the link again to keep this store's products separate from demo or connected catalogs."}),e.jsx(X,{label:t?"Importar novamente":"Import again",onClick:()=>a("/onboarding/import?source=url")})]}):w.length===0&&s==="connected-store"&&c==="empty"?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:$e,children:t?`A sincronização de ${g||"sua loja"} terminou, mas nenhum produto publicado com imagem foi encontrado.`:`The sync for ${g||"your store"} finished, but no published products with images were found.`}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18},children:[e.jsx(X,{label:t?"Verificar produtos":"Check products",onClick:()=>void m()}),e.jsx(K,{label:t?"Enviar uma imagem":"Upload an image",onClick:()=>a("/onboarding/import?source=upload")})]})]}):w.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{margin:"0 0 40px",maxWidth:460,fontSize:16,fontWeight:500,lineHeight:1.5,letterSpacing:"-0.01em",color:f.textMuted,textAlign:"center"},children:t?"Não há um catálogo real disponÃvel para esta origem. Importe o link novamente ou envie uma foto do seu próprio produto.":"There is no real catalog available for this source. Import the link again or upload a photo of your own product."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18},children:[e.jsx(X,{label:t?"Importar novamente":"Import again",onClick:()=>a("/onboarding/import?source=url")}),e.jsx(K,{label:t?"Enviar uma imagem":"Upload an image",onClick:()=>a("/onboarding/import?source=upload")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:Ae,children:w.map(R=>e.jsx(Qe,{product:R,onClick:()=>S(R.product_id)},R.product_id))}),e.jsx(K,{label:t?"Escolher depois":"Choose later",onClick:()=>a("/onboarding/intent")})]})]})}function Qe({product:a,onClick:n}){return e.jsx("button",{type:"button",onClick:n,title:a.name,"aria-label":a.name,style:{position:"relative",padding:0,display:"flex",flexDirection:"column",borderRadius:24,overflow:"hidden",border:"none",outline:"2px solid transparent",outlineOffset:-2,background:f.surface,cursor:"pointer",fontFamily:"inherit",textAlign:"left",transition:"background 120ms ease, outline-color 120ms ease"},onMouseEnter:t=>{t.currentTarget.style.outlineColor=f.accent,t.currentTarget.style.background=f.accentSurface},onMouseLeave:t=>{t.currentTarget.style.outlineColor="transparent",t.currentTarget.style.background=f.surface},children:e.jsx("div",{style:{aspectRatio:"1 / 1",width:"100%",background:f.surface},children:e.jsx("img",{src:a.image_url,alt:a.name,loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})})})}const Ae={display:"grid",gridTemplateColumns:"repeat(5, minmax(130px, 160px))",gap:16,justifyContent:"center",width:"min(920px, 100%)",marginBottom:40},$e={margin:"0 0 32px",maxWidth:480,fontSize:16,fontWeight:500,lineHeight:1.5,letterSpacing:"-0.01em",color:f.textMuted,textAlign:"center"};function yt(a){let n=2166136261,t=2654435769;for(let d=0;d<a.length;d++){const l=a.charCodeAt(d);n=Math.imul(n^l,16777619),t=Math.imul(t^l,2246822507)}return`uploaded-product-${a.length}-${(n>>>0).toString(16)}-${(t>>>0).toString(16)}`}const ya=["Reading the product photo","Understanding shape, color, and material","Matching it with your store identity","Finding campaign ideas for this product"],xa=["Validating file quality","Identifying the category and product type","Understanding shape, material, and audience","Preparing creative suggestions"],ba=["Loading the demo product","Preparing the visual reference","Preparing creative suggestions","Getting your first campaign ready"],va=["Lendo a foto do produto","Entendendo forma, cor e material","Combinando com a identidade da sua loja","Buscando ideias de campanha para este produto"],ja=["Validando a qualidade do arquivo","Identificando a categoria e o tipo de produto","Entendendo forma, material e público","Preparando sugestões criativas"],Sa=["Carregando o produto de demonstração","Preparando a referência visual","Preparando sugestões criativas","Deixando sua primeira campanha pronta"],Ca=850;function wa(){const a=N(),{lang:n}=ne(),t=n==="pt-BR",[d]=ue(),l=d.get("product")??"",i=d.get("source")==="upload",s=d.get("source")==="demo",{products:c,loading:m}=Ie(),h=i?null:s?at(l):c.find(z=>z.product_id===l)??null,g=i?Be():null,x=g?yt(g.dataUrl):"",v=i?!!g:!!h,P=t?i?ja:s?Sa:va:i?xa:s?ba:ya,[w,S]=r.useState(0),[$,A]=r.useState(s),[R,T]=r.useState(!1);return r.useEffect(()=>{const z=i?g==null?void 0:g.dataUrl:h==null?void 0:h.image_url,C=i?g==null?void 0:g.label:h==null?void 0:h.name;if(!z||s)return;let k=!0;return A(!1),T(!1),it(z,C,i?void 0:l).then(q=>{if(!k)return;const D=i?Pe(C):null,_=q!=null&&q.category&&q.category!=="other"?q:D;if(!_){if(!i&&(h!=null&&h.category)){A(!0);return}L.saveOnboardingProfile(i?{uploadProductClassification:null}:{starterProductClassification:null}),T(!0),A(!0);return}L.saveOnboardingProfile(i?{uploadProductClassification:{imageId:x,category:_.category,subcategory:_.subcategory,productForm:_.productForm,audie
6nce:_.audience,traits:_.traits}}:{starterProductClassification:{productId:l,category:_.category,subcategory:_.subcategory,productForm:_.productForm,traits:_.traits}}),A(!0)}),()=>{k=!1}},[i,g==null?void 0:g.dataUrl,g==null?void 0:g.label,x,h==null?void 0:h.image_url,h==null?void 0:h.name,h==null?void 0:h.category,l,s]),r.useEffect(()=>{if(!v||!$)return;if(w>=P.length){const C=new URLSearchParams(i?{source:"upload"}:s?{source:"demo",product:l}:{product:l});R&&C.set("fallback","generic"),a(`/onboarding/style?${C.toString()}`,{replace:!0});return}const z=setTimeout(()=>S(C=>C+1),Ca);return()=>clearTimeout(z)},[v,$,w,i,s,l,a,P.length,R]),i&&!g?e.jsx(ee,{to:"/onboarding/create",replace:!0}):!i&&!m&&!h?e.jsx(ee,{to:s?"/onboarding/products?source=demo":"/onboarding/products",replace:!0}):e.jsxs(fe,{step:"analyze",children:[e.jsx("h1",{className:"wf-title wf-title-shimmer",style:{margin:"0 0 40px",fontSize:31,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.2,textAlign:"center"},children:i?t?"Preparando sua imagem...":"Preparing your image...":s?t?"Preparando sua demonstração...":"Preparing your demo...":t?"Analisando seu produto...":"Checking your product..."}),e.jsx("div",{style:{width:"min(480px, 100%)",display:"flex",flexDirection:"column",gap:18,padding:28,borderRadius:24,background:f.surface},children:P.map((z,C)=>{const k=C<w,q=C===w;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[k?e.jsx(Te,{size:18,weight:"fill",color:f.accent}):q?e.jsx(Le,{size:18,weight:"bold",color:f.text,style:{animation:"wf-spin 900ms linear infinite"}}):e.jsx("div",{style:{width:18,height:18,borderRadius:999,border:`1.5px solid ${f.textMuted}`}}),e.jsx("span",{style:{fontSize:15,fontWeight:500,color:k||q?f.text:f.textMuted},children:z})]},z)})}),e.jsx("style",{children:"@keyframes wf-spin { to { transform: rotate(360deg); } }"})]})}async function $a(a){if(!a)return null;if(/^https?:\/\//i.test(a)&&Lt(a))return a;try{const n=new Image;a.startsWith("data:")||(n.crossOrigin="anonymous"),await new Promise((i,s)=>{const c=setTimeout(()=>s(new Error("Image load timed out")),15e3);n.onload=()=>{clearTimeout(c),i()},n.onerror=()=>{clearTimeout(c),s(new Error("Image load failed"))},n.src=a});const t=Math.min(1,2048/Math.max(n.naturalWidth,n.naturalHeight)),d=document.createElement("canvas");d.width=Math.max(1,Math.round(n.naturalWidth*t)),d.height=Math.max(1,Math.round(n.naturalHeight*t));const l=d.getContext("2d");return l?(l.fillStyle="#ffffff",l.fillRect(0,0,d.width,d.height),l.drawImage(n,0,0,d.width,d.height),d.toDataURL("image/jpeg",.86)):null}catch{return null}}function ka(){var pe,ye,ge;const a=N(),{lang:n}=ne(),t=n==="pt-BR",{user:d}=je(),[l,i]=r.useState(!1),[s,c]=r.useState(null),[m]=ue(),h=m.get("product")??"",g=m.get("source")==="upload",x=m.get("source")==="demo",{products:v,loading:P,origin:w,recommendationStore:S}=Ie(),$=g?null:x?at(h):v.find(j=>j.product_id===h)??null,A=g?Be():null,R=A==null?void 0:A.dataUrl,T=A==null?void 0:A.label,z=R?yt(R):"",C=(pe=L.getCurrentUser())==null?void 0:pe.profile,k=g&&((ye=C==null?void 0:C.uploadProductClassification)==null?void 0:ye.imageId)===z&&C.uploadProductClassification.category!=="other"?C.uploadProductClassification:null,q=!!k,[D,_]=r.useState(k?{category:k.category,subcategory:k.subcategory,productForm:k.productForm,audience:k.audience,traits:k.traits}:null);r.useEffect(()=>{if(!g||!R||q)return;let j=!0;return it(R,T,void 0,{bypassCache:!0}).then(M=>{if(!j)return;const U=M&&M.category!=="other"?M:Pe(T);U&&(_(U),L.saveOnboardingProfile({uploadProductClassification:{imageId:z,category:U.category,subcategory:U.subcategory,productForm:U.productForm,audience:U.audience,traits:U.traits}}))}).catch(()=>{j&&_(Pe(T))}),()=>{j=!1}},[g,R,T,z,q]);const W=((ge=C==null?void 0:C.starterProductClassification)==null?void 0:ge.productId)===h?C.starterProductClassification:null,y=r.useMemo(()=>{if(g&&R)return{id:z,source:"board",name:T??(t?"Produto enviado":"Uploaded product"),image:R,weeklySales:0,addedAt:"",category:D==null?void 0:D.category,subcategory:D==null?void 0:D.subcategory,productForm:D==null?void 0:D.productForm,traits:(D==null?void 0:D.traits)??[],catalogImageCount:1};if(!$)return null;const j=ho($);return{...j,category:(W==null?void 0:W.category)??j.category,subcategory:(W==null?void 0:W.subcategory)??j.subcategory,productForm:(W==null?void 0:W.productForm)??j.productForm,traits:(W==null?void 0:W.traits)??j.traits}},[g,R,T,z,D,$,W,t]),J=r.useMemo(()=>y?fo(y,x||g?null:S):[],[y,x,g,S]).filter(j=>j.source==="agent"),[le,ce]=r.useState(()=>{var U,Z;const j=C==null?void 0:C.starterCampaign;return(g?((U=C==null?void 0:C.starterProductSnapshot)==null?void 0:U.id)===z:((Z=C==null?void 0:C.starterProductSnapshot)==null?void 0:Z.id)===h)&&(j==null?void 0:j.source)==="agent"?`${j.source}:${j.actionId}`:""}),V=J.find(j=>`${j.source}:${j.action.id}`===le);if(g&&!A)return e.jsx(ee,{to:"/onboarding/import?source=upload",replace:!0});if(!g&&!P&&!$)return e.jsx(ee,{to:x?"/onboarding/products?source=demo":"/onboarding/products",replace:!0});const me=async()=>{var U,Z,se;if(!y||!V||l)return;if(!(d!=null&&d.teamId)){c(t?"Não foi possÃvel carregar sua conta. Atualize a página e tente novamente.":"We couldn't load your account. Refresh and try again.");return}i(!0),c(null);const j={source:V.source,actionId:V.action.id},M=((U=V.gisePlan)==null?void 0:U.directions.map(H=>H.styleId))??[];await L.saveOnboardingProfile({...!x&&$?{starterProductId:$.product_id}:{},starterCampaign:j,starterStyleId:M[0]??null,starterStyleIds:M,starterCastIds:[],starterNote:"",starterProductSnapshot:{id:y.id,name:y.name,imageUrl:y.image,origin:g?"upload":x?"demo":w==="url"?"url":"connected-store",category:y.category,selectedAt:new Date().toISOString()},recommendationTrace:{computedAt:new Date().toISOString(),productId:y.id,storeName:S==null?void 0:S.name,evidence:((Z=V.action.recommendation)==null?void 0:Z.evidence)??[],styleIds:M}});try{const H=await $a(y.image);if(!H)throw new Error(t?"Não foi possÃvel ler a foto do produto. Tente novamente.":"We couldn't read the product photo. Try again.");const G=crypto.randomUUID(),{batch:de,assets:ie}=yo({boardId:G,teamId:d.teamId,productId:y.id,productName:y.name,productImageUrl:y.image,referenceImage:H,option:V,language:n,storeId:x||g?null:(se=d.activeStore)==null?void 0:se.id,sourceKind:g?"upload":x?"demo":w==="url"?"url":"connected-store"});let p=!1;try{const b=await bo(G,we),I=[...ie];if(g){const Y=await(await fetch(H)).blob(),ae=await So(G,Y,"onboarding-product");I[0]={...I[0],imageUrl:"",mediaLocator:ae}}else if(!x&&Tt){const O=await Co(G,y.id,y.image);I[0]={...I[0],imageUrl:"",mediaLocator:O}}await vo.save({boardId:G,userId:d.id},{id:crypto.randomUUID(),expectedRevision:b.updated_at,snapshot:jo(b.snapshot,I,{x:0,y:0,zoom:1},we)}),p=!0}catch(b){console.warn("[onboarding] Board durável indisponÃvel; abrindo canvas local",b)}xo(de),await L.saveOnboardingProfile({onboardingStep:"result",onboardingBoardId:p?G:null}),We("welcome_campaign_requested",{language:n,generation_count:de.requests.length,welcome_credit_budget:jt,credit_source:"free_welcome_grant",source_kind:g?"upload":x?"demo":w==="url"?"url":"connected_store"},{dedupeKey:G}),a(p?`/board?boardId=${G}&boardTitle=${encodeURIComponent(we)}`:"/board",{replace:!0,state:{_ts:Date.now(),boardId:p?G:void 0,boardTitle:we,blankBoard:!p,allowTransientBoardFallback:!p,fromOnboarding:!0,onboardingBatch:de,initialBoardAssets:p?[]:ie,initialSelectedAssetIds:[ie[0].id],initialBoardScale:1,suppressPendingComposer:!0}})}catch(H){c(H instanceof Error?H.message:t?"Não foi possÃvel abrir o Board. Tente novamente.":"We couldn't open the Board. Try again."),i(!1)}};return e.jsxs(fe,{step:"style",children:[e.jsxs("div",{className:"wf-campaign-layout",style:{width:"min(1280px, 100%)",display:"grid",gridTemplateColumns:"minmax(300px, 0.92fr) minmax(0, 1.08fr)",gap:48,alignItems:"center"},children:[e.jsx("div",{style:{width:"100%",aspectRatio:"1 / 1",maxHeight:650,borderRadius:24,overflow:"hidden",background:f.surface},children:(y==null?void 0:y.image)&&e.jsx("img",{src:y.image,alt:y.name,style:{display:"block",width:"100%",height:"100%",objectFit:"contain"}})}),e.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:28},children:[e.jsx(Ia,{title:t?"Recomendações do diretor criativo":"Creative director recommendations",options:J,selectedKey:le,onSelect:ce,pt:t}),e.jsx("div",{style:{alignSelf:"flex-start",marginTop:4},children:e.jsx(X,{label:l?t?"Abrindo o Board...":"Opening Board...":t?"Gerar minha campanha":"Generate my campaign",onClick:()=>void me(),disabled:!V||l,style:{color:V?void 0:f.ctaDisabledText}})}),s&&e.jsx("p",{role:"alert",style:{margin:0,color:f.textMuted,fontSize:13},children:s})]})]}),e.jsx("style",{children:` 7 @media (max-width: 900px) { 8 .wf-campaign-layout { grid-template-columns: 1fr !important; gap: 28px !important; max-width: 680px; } 9 .wf-campaign-layout > div:first-child { max-height: 320px !important; } 10 } 11 @media (max-width: 560px) { 12 .wf-campaign-cards { grid-template-columns: 1fr !important; } 13 } 14 `})]})}function Ia({title:a,options:n,selectedKey:t,onSelect:d,pt:l}){return e.jsxs("section",{style:{minWidth:0},children:[e.jsx("h2",{style:{margin:"0 0 14px",color:f.textMuted,fontSize:16,fontWeight:500},children:a}),e.jsx("div",{className:"wf-campaign-cards",style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:12},children:n.map(i=>{var x,v,P,w;const s=`${i.source}:${i.action.id}`,c=s===t,m=((x=i.action.recommendation)==null?void 0:x.displayLabel)??i.action.label,h=l?Ta(i.action.id,m):m.replace(/material e acabamento/gi,"material and finish"),g=Ea(l?Ra(i.action.id):((v=i.action.recommendation)==null?void 0:v.reason)??((w=(P=i.action.recommendation)==null?void 0:P.scene)==null?void 0:w.description)??i.action.description);return e.jsxs("button",{type:"button",onClick:()=>d(s),"aria-pressed":c,title:`${h} â ${g}`,className:"wf-hover-lift",style:{aspectRatio:"3 / 4",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-end",gap:0,padding:18,border:"none",borderRadius:20,outline:`2px solid ${c?f.accent:"transparent"}`,outlineOffset:-2,background:c?f.accentSurface:f.surface,color:f.text,textAlign:"left",fontFamily:"inherit",curs
14or:"pointer"},children:[e.jsx("span",{style:{fontSize:12,lineHeight:1.35,fontWeight:400,marginBottom:8},children:h}),e.jsx("span",{style:{fontSize:12,lineHeight:1.4,color:f.textMuted,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden"},children:g})]},s)})})]})}const xt={"renovar-mais-vendido":{label:"Transforme o produto em protagonista",description:"Destaque a principal promessa do produto com uma campanha visual marcante."},"detalhe-produto":{label:"Transforme o detalhe em prova",description:"Use detalhes visÃveis para demonstrar o valor e o acabamento do produto."},"adicionar-modelo":{label:"Conecte o produto à vida real",description:"Mostre como o produto faz parte da rotina real do seu público."},"produto-em-uso":{label:"Mostre o produto em uso",description:"Crie cenas reais que deixem claro o papel do produto na rotina."},"produto-em-ambiente":{label:"Crie desejo com contexto",description:"Coloque o produto em um universo relevante e desejável para o público."},"carrossel-instagram":{label:"Leve da atenção à escolha",description:"Crie uma sequência que chame atenção, prove valor e desperte desejo."},"story-instagram":{label:"Ganhe o momento mobile",description:"Traduza a promessa do produto em uma mensagem rápida e pensada para celular."},"aplicar-estilo":{label:"Construa um universo de marca",description:"Crie um código visual consistente e reconhecÃvel antes mesmo do logo."},"peca-de-marca":{label:"Deixe a marca inconfundÃvel",description:"Conecte produto e marca para que cada imagem pareça realmente sua."},"criativo-oferta":{label:"Transforme valor em ação",description:"Deixe claro o motivo para escolher sem inventar preço, urgência ou prova."},"variacao-angulos":{label:"Facilite a escolha",description:"Use ângulos complementares para reduzir dúvidas e aumentar a confiança."},lancamento:{label:"Apresente uma história clara",description:"Mostre para quem é o produto, por que ele importa e por que agora."},"campanha-sazonal":{label:"Aproveite o momento sazonal",description:"Conecte o produto à ocasião com uma mensagem relevante para o público."}};function Ta(a,n){var t;return((t=xt[a])==null?void 0:t.label)??n}function Ra(a){var n;return((n=xt[a])==null?void 0:n.description)??"Crie uma campanha clara e relevante para este produto."}function Ea(a,n=88){var s,c;const t=((c=(s=a.match(/^.*?[.!?](?:\s|$)/))==null?void 0:s[0])==null?void 0:c.trim())??a.trim();if(t.length<=n)return t;const d=t.slice(0,n-1),l=d.lastIndexOf(" ");return`${d.slice(0,l>n/2?l:void 0).replace(/[,:;.!?\s]+$/,"")}â¦`}const Aa=[{id:"explore",label:"Explore the app",labelPt:"Explorar o app",Icon:Ao},{id:"try-features",label:"Try the features",labelPt:"Testar os recursos",Icon:Po},{id:"edit-product-photos",label:"Edit product photos",labelPt:"Editar fotos de produtos",Icon:nt},{id:"create-videos",label:"Create videos",labelPt:"Criar vÃdeos",Icon:wo}];function za(){var c;const a=N(),{lang:n}=ne(),t=n==="pt-BR",d=((c=L.getCurrentUser())==null?void 0:c.profile)??{},[l,i]=r.useState(d.focus??null),s=()=>{l&&(We("onboarding_completed",{language:n,completion_path:"intent",intent:l},{dedupeKey:`intent:${l}`}),L.saveOnboardingProfile({focus:l}),L.updateOnboardingProgress(4,!0),a("/",{replace:!0}))};return e.jsxs(fe,{step:"intent",children:[e.jsx("h1",{style:{margin:"0 0 58px",fontSize:31,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.2,color:f.text,textAlign:"center"},children:t?"Por onde você quer começar?":"Where would you like to start?"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(220px, 277px))",gap:25,justifyContent:"center",marginBottom:58},children:Aa.map(({id:m,label:h,labelPt:g,Icon:x})=>{const v=l===m;return e.jsxs("button",{type:"button",onClick:()=>i(m),"aria-pressed":v,style:{height:130,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,borderRadius:24,border:`2px solid ${v?f.accent:"transparent"}`,background:v?f.accentSurface:f.surface,color:f.text,fontFamily:"inherit",fontSize:14,fontWeight:500,letterSpacing:"-0.02em",cursor:"pointer",transition:"background 120ms ease, border-color 120ms ease"},children:[e.jsx(x,{size:22,weight:"regular",color:v?f.accent:f.text}),t?g:h]},m)})}),e.jsx(X,{label:t?"Continuar":"Continue",onClick:s,disabled:!l})]})}function Pa(){const a=N(),{user:n}=je(),{lang:t}=ne(),d=t==="pt-BR",l=n==null?void 0:n.firstName,i=(s,c)=>{We("onboarding_completed",{language:t,completion_path:c},{dedupeKey:c}),L.updateOnboardingProgress(4,!0),a(s,{replace:!0,state:{firstRunProduct:!0}})};return e.jsxs(fe,{step:"ready",children:[e.jsx("h1",{style:{margin:"0 0 64px",fontSize:42,fontWeight:500,letterSpacing:"-0.02em",lineHeight:1.15,color:f.text,textAlign:"center"},children:d?l?`Tudo pronto, ${l}`:"Tudo pronto":l?`You're all set, ${l}`:"You're all set"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:20},children:[e.jsx(X,{label:d?"Gerar minha primeira imagem":"Generate my first image",onClick:()=>i(`/board?${rt}=1`,"generate_first_image")}),e.jsx(K,{label:d?"Explorar o app primeiro":"Explore the app first",onClick:()=>i("/","explore_first")})]})]})}const bt=({step:a,heading:n,subheading:t,children:d,cta:l,secondary:i,maxWidth:s=680})=>{const c=N(),m=oo(a),h=m>1?Ve[m-2]:null;return e.jsxs("div",{"data-no-translate":!0,style:{minHeight:"100vh",display:"flex",flexDirection:"column",background:`hsl(${o.bg.primary})`},children:[e.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[4],padding:`${u[5]} ${u[7]}`},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.02em",color:`hsl(${o.text.primary})`,lineHeight:1},children:"snew"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[Ve.map((g,x)=>
14e.jsx("div",{"aria-hidden":!0,style:{width:34,height:3,borderRadius:E.pill,background:x<m?`hsl(${o.text.primary})`:`hsl(${o.border.tertiary})`,transition:`background ${F.base}`}},g)),e.jsxs("span",{style:{marginLeft:u[2],fontSize:12,fontWeight:500,color:`hsl(${o.text.tertiary})`},children:[String(m).padStart(2,"0")," / ",String(to).padStart(2,"0")]})]})]}),e.jsxs("main",{style:{flex:1,width:"100%",maxWidth:s,margin:"0 auto",padding:`${u[7]} ${u[7]} ${u[8]}`,display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[2],marginBottom:u[7]},children:[e.jsx("h1",{style:{...Wt.pageTitle,margin:0,letterSpacing:"-0.02em"},children:n}),t&&e.jsx("p",{style:{margin:0,fontSize:15,lineHeight:1.5,color:`hsl(${o.text.tertiary})`,maxWidth:560},children:t})]}),e.jsx("div",{children:d}),e.jsxs("div",{style:{marginTop:u[7],display:"flex",alignItems:"center",justifyContent:"space-between",gap:u[3]},children:[h?e.jsxs("button",{type:"button",onClick:()=>c(`/onboarding/${h}`),style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"none",padding:0,fontFamily:"inherit",fontSize:13,color:`hsl(${o.text.tertiary})`,cursor:"pointer"},children:[e.jsx(Io,{size:12,weight:"bold"}),"Voltar"]}):e.jsx("span",{}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[4]},children:[i,l]})]})]})]})},Ma=[{id:"product-photos",label:"Fotos de produto",description:"Trocar o packshot pela cena â o produto em um lugar de verdade.",Icon:$o},{id:"social",label:"Conteúdo social",description:"Feed e stories com a mesma identidade toda semana.",Icon:Rt},{id:"ads",label:"Anúncios",description:"Criativos de performance em vários formatos de uma vez.",Icon:ko},{id:"campaign",label:"Campanha sazonal",description:"Uma data, um conceito, o pacote inteiro de peças.",Icon:zo}];function Da(){var i;const a=N(),n=((i=L.getCurrentUser())==null?void 0:i.profile)??{},[t,d]=r.useState(n.focus??null),l=()=>{t&&(L.saveOnboardingProfile({focus:t}),L.updateOnboardingProgress(4,!1),a("/onboarding/first-image"))};return e.jsx(bt,{step:"focus",heading:"O que você quer criar primeiro?",subheading:"Isso define o que o agente sugere na sua primeira sessão. Dá para mudar quando quiser.",cta:e.jsxs(Se,{type:"button",onClick:l,disabled:!t,className:"h-11 min-w-[150px] rounded-full gap-2 [&_svg]:!size-2.5",children:["Continuar",e.jsx(xe,{size:10,weight:"bold"})]}),children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:u[3]},children:Ma.map(({id:s,label:c,description:m,Icon:h})=>{const g=t===s;return e.jsxs("button",{type:"button",onClick:()=>d(s),"aria-pressed":g,style:{background:`hsl(${o.bg.primary})`,border:g?`2px solid hsl(${o.text.primary})`:`2px solid hsl(${o.border.tertiary})`,borderRadius:E.xl,padding:22,textAlign:"left",display:"flex",flexDirection:"column",gap:12,minHeight:140,cursor:"pointer",fontFamily:"inherit",transition:`border-color ${F.fast}, box-shadow ${F.fast}`},onMouseEnter:x=>{g||(x.currentTarget.style.borderColor=`hsl(${o.border.secondary})`,x.currentTarget.style.boxShadow=te.floatSoft)},onMouseLeave:x=>{x.currentTarget.style.boxShadow="none",!g&&(x.currentTarget.style.borderColor=`hsl(${o.border.tertiary})`)},children:[e.jsx(h,{size:20,weight:"regular",color:`hsl(${o.text.primary})`}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:`hsl(${o.text.primary})`,letterSpacing:"-0.01em"},children:c}),e.jsx("div",{style:{fontSize:13,lineHeight:1.4,color:`hsl(${o.text.tertiary})`},children:m})]})]},s)})})})}const Oa={"product-photos":{headline:"Vamos tirar seu produto do fundo branco",hint:"Escolha por onde começar e deixa o resto comigo."},social:{headline:"Vamos montar seu primeiro post",hint:"Escolha por onde começar e você já vê a identidade em pé."},ads:{headline:"Vamos criar seu primeiro criativo",hint:"Começamos por um produto e depois adaptamos para os outros formatos."},campaign:{headline:"Vamos abrir sua primeira campanha",hint:"Uma imagem de cabeça primeiro; o pacote vem em cima dela."}},Fa={headline:"Vamos gerar sua primeira imagem",hint:"Escolha por onde começar e deixa o resto comigo."},De=5;function _a(){const a=N(),{user:n}=je(),t=n==null?void 0:n.profile,d=n==null?void 0:n.firstName,l=Oa[(t==null?void 0:t.focus)??""]??Fa,i=qt(t),{products:s,loading:c}=Ie(),m=r.useMemo(()=>s.filter($=>$.image_url).slice(0,De),[s]),[h,g]=r.useState(null),[x,v]=r.useState(null);r.useEffect(()=>{i&&!h&&m.length&&g(m[0].product_id)},[i,h,m]);const P=m.find($=>$.product_id===h)??null,w=($,A)=>{L.updateOnboardingProgress(4,!0),a($,{replace:!0,state:A})},S=()=>{const $=(P==null?void 0:P.name)??(x==null?void 0:x.name)??"";ke(!P&&x?{label:$,dataUrl:x.url}:null),w(`/board?${rt}=1`,{firstRunProduct:!0,productLabel:$,productImageUrl:(P==null?void 0:P.image_url)??""})};return e.jsx(bt,{step:"first-image",heading:d?`Tudo pronto, ${d}`:"Tudo pronto",subheading:i?"Sua loja está conectada e o agente já leu o catálogo. Falta a parte boa.":"Sua conta está criada e o agente já tem contexto. Falta a parte boa.",maxWidth:760,secondary:e.jsx("button",{type:"button",onClick:()=>w("/"),style:{background:"transparent",border:"none",padding:0,fontFamily:"inherit",fontSize:13,color:`hsl(${o.text.tertiary}
14)`,textDecoration:"underline",textUnderlineOffset:3,cursor:"pointer"},children:"Explorar o app primeiro"}),cta:e.jsxs(Se,{type:"button",onClick:S,className:"h-11 min-w-[220px] rounded-full gap-2 [&_svg]:!size-3",children:["Gerar minha primeira imagem",e.jsx(Ue,{size:12,weight:"bold"})]}),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[5]},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[2]},children:[e.jsxs("div",{style:{display:"inline-flex",alignSelf:"flex-start",alignItems:"center",gap:6,padding:"4px 12px",borderRadius:E.pill,background:`hsl(${o.bg.secondary})`,fontSize:12,fontWeight:500,color:`hsl(${o.text.secondary})`},children:[e.jsx(et,{size:13,weight:"fill"}),"Primeira sessão"]}),e.jsx("div",{style:{fontSize:22,fontWeight:600,letterSpacing:"-0.02em",color:`hsl(${o.text.primary})`,lineHeight:1.25},children:l.headline}),e.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.55,color:`hsl(${o.text.tertiary})`,maxWidth:520},children:l.hint})]}),i?e.jsx(Ua,{products:m,loading:c,selectedId:h,onSelect:g,storeUrl:t==null?void 0:t.storeUrl}):e.jsx(La,{upload:x,onChange:v}),e.jsxs("div",{style:{paddingTop:u[4],borderTop:`1px solid hsl(${o.border.tertiary})`,fontSize:12.5,lineHeight:1.5,color:`hsl(${o.text.tertiary})`},children:["Você entra no plano"," ",e.jsx("strong",{style:{color:`hsl(${o.text.primary})`,fontWeight:600},children:"Free"}),": o app inteiro liberado â catálogo, board, estilos e o agente. A geração de imagem abre quando você escolher um plano."]})]})})}function Ua({products:a,loading:n,selectedId:t,onSelect:d,storeUrl:l}){return n?e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:u[3]},children:Array.from({length:De}).map((i,s)=>e.jsx("div",{style:{aspectRatio:"1 / 1",borderRadius:E.lg,background:`hsl(${o.bg.secondary})`}},s))}):a.length?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:u[3]},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:500,color:`hsl(${o.text.secondary})`},children:["Escolha um produto",l?` de ${l}`:""]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${De}, 1fr)`,gap:u[3]},children:a.map(i=>{const s=i.product_id===t;return e.jsxs("button",{type:"button",onClick:()=>d(i.product_id),"aria-pressed":s,title:i.name,style:{position:"relative",padding:0,border:s?`2px solid hsl(${o.text.primary})`:`2px solid hsl(${o.border.tertiary})`,borderRadius:E.lg,background:`hsl(${o.bg.primary})`,overflow:"hidden",cursor:"pointer",fontFamily:"inherit",transition:`border-color ${F.fast}`},children:[e.jsx("div",{style:{aspectRatio:"1 / 1",background:`hsl(${o.bg.secondary})`},children:e.jsx("img",{src:i.image_url,alt:i.name,loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),e.jsx("div",{style:{padding:"8px 10px",fontSize:11.5,lineHeight:1.3,textAlign:"left",color:`hsl(${o.text.secondary})`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.name}),s&&e.jsx("div",{style:{position:"absolute",top:6,right:6},children:e.jsx(Te,{size:18,weight:"fill",color:`hsl(${o.text.primary})`})})]},i.product_id)})})]}):e.jsx("div",{style:{padding:u[5],borderRadius:E.lg,background:`hsl(${o.bg.secondary})`,fontSize:13,color:`hsl(${o.text.tertiary})`},children:"Ainda estamos sincronizando os produtos. Você pode seguir e escolher no board."})}function La({upload:a,onChange:n}){const t=r.useRef(null),[d,l]=r.useState(!1),i=async s=>{if(!s||!s.type.startsWith("image/"))return;const c=await st(s);c&&n({name:s.name.replace(/\.[^.]+$/,""),url:c})};return a?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[4],padding:u[4],border:`1px solid hsl(${o.border.tertiary})`,borderRadius:E.xl},children:[e.jsx("img",{src:a.url,alt:a.name,style:{width:72,height:72,objectFit:"cover",borderRadius:E.lg,background:`hsl(${o.bg.secondary})`}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:`hsl(${o.text.primary})`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.name}),e.jsx("div",{style:{fontSize:12.5,color:`hsl(${o.text.tertiary})`},children:"Pronto â esse é o produto da primeira cena."})]}),e.jsx("button",{type:"button",onClick:()=>n(null),"aria-label":"Remover imagem",style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:E.pill,color:`hsl(${o.text.tertiary}
14)`,cursor:"pointer"},children:e.jsx(ot,{size:15,weight:"bold"})})]}):e.jsxs("div",{onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},onDragOver:s=>{s.preventDefault(),l(!0)},onDragLeave:()=>l(!1),onDrop:s=>{var c;s.preventDefault(),l(!1),i((c=s.dataTransfer.files)==null?void 0:c[0])},role:"button",tabIndex:0,onKeyDown:s=>{var c;(s.key==="Enter"||s.key===" ")&&((c=t.current)==null||c.click())},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:u[2],padding:`${u[8]} ${u[5]}`,border:`2px dashed hsl(${d?o.text.primary:o.border.tertiary})`,borderRadius:E.xl,background:d?`hsl(${o.bg.secondary})`:"transparent",cursor:"pointer",textAlign:"center",transition:`border-color ${F.fast}, background ${F.fast}`},children:[e.jsx(qe,{size:22,weight:"regular",color:`hsl(${o.text.secondary})`}),e.jsx("div",{style:{fontSize:14,fontWeight:500,color:`hsl(${o.text.primary})`},children:"Arraste a foto de um produto"}),e.jsx("div",{style:{fontSize:12.5,color:`hsl(${o.text.tertiary})`,maxWidth:360,lineHeight:1.5},children:"Ou clique para escolher. Sem loja conectada, é daqui que sai o produto da primeira cena â pode ser um packshot mesmo."}),e.jsx("input",{ref:t,type:"file",accept:"image/*",hidden:!0,onChange:s=>{var c;return i((c=s.target.files)==null?void 0:c[0])}})]})}function Wa(){const{user:a,loading:n}=je(),[t,d]=r.useState(null);return r.useEffect(()=>{if(n||!a)return;if(a.onboardingCompleted){d("/");return}let l=!0;return Bt().then(i=>{var s;l&&(i?Nt(i)?d(i.destinationBoardId?`/board?id=${encodeURIComponent(i.destinationBoardId)}`:"/"):d(Ht((s=a.profile)==null?void 0:s.onboardingStep)?Ee(a):Zt(i.currentStep,i.sourcePath)):d(Ee(a)))}).catch(()=>{l&&d(Ee(a))}),()=>{l=!1}},[n,a]),n||!a||!t?null:e.jsx(ee,{to:t,replace:!0})}function rn(){const[a]=ue(),n=St(),t=n.pathname.split("/")[2],d=a.get("step");if(!t||t==="profile")return e.jsx(Wa,{});switch(t){case"create":return e.jsx(na,{});case"import":return e.jsx(da,{});case"products":return e.jsx(fa,{});case"analyze":return e.jsx(wa,{});case"style":return e.jsx(ka,{});case"result":return e.jsx(ee,{to:`/onboarding/style${n.search}`,replace:!0});case"intent":return e.jsx(za,{});case"ready":return e.jsx(Pa,{});case"connect":return e.jsx(ee,{to:"/onboarding/import?source=store",replace:!0});case"focus":return e.jsx(Da,{});case"first-image":return e.jsx(_a,{});case"store":{if(a.has("shopify")||a.has("nuvemshop")){const l=new URLSearchParams(a);return l.set("source","store"),e.jsx(ee,{to:`/onboarding/import?${l.toString()}`,replace:!0})}return e.jsx(ee,{to:"/onboarding/import?source=store",replace:!0})}case"url":return e.jsx(Mo,{});case"branddna":return e.jsx(ea,{});case"goals":return e.jsx(Fo,{});case"source":return e.jsx(Lo,{});case"priority":return e.jsx(Bo,{});case"pricing":return e.jsx(zt,{});case"url-import":return e.jsx(No,{});case"sync-confirm":return e.jsx(Jo,{})}return e.jsx(ee,{to:d?ao(Number(d)||1):"/onboarding/create",replace:!0})}export{rn as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.