1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D_T1XJ3U.js","assets/vendor-react-Bxgxa9T6.js","assets/index-CzLeof4w.css"])))=>i.map(i=>d[i]); 2var oj=Object.defineProperty;var rj=(t,a,n)=>a in t?oj(t,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[a]=n;var ra=(t,a,n)=>rj(t,typeof a!="symbol"?a+"":a,n);import{j as e,aI as ad,aJ as ij,aK as sj,aL as Lg,aM as lj,t as dj,aN as ov,u as $a,h as ni,a3 as Pg,aO as rv,aD as br,J as rn,D as iv,g as cj,E as uj,n as pj,m as sv,aP as lv,P as Kp,aQ as Gl,o as dv,aR as au,aS as x1,aT as b1,a2 as Rr,ay as Dg,a5 as gj,_ as Yp,q as y1,aU as mj,aC as v1,aV as Bg,aW as cv,aX as Bu,aY as uv,a1 as hj,aZ as fj,M as Jp,T as Zp,a_ as xj,a$ as bj,b0 as j1,b1 as yj,b2 as pv,W as vj}from"./index-D_T1XJ3U.js";import{e as gv,u as Wg,a as qg,I as Wu,p as jj,b as Aj,c as Sj,d as ts,l as Kd,H as wj,C as kj,S as Cj,F as _j,f as $j,A as Ij,g as cp,h as Tj,s as Ej,i as zj,j as Rj,k as Nj,m as Lj,n as Pj,o as up,q as Dj,r as Bj}from"./WhatsAppInboxTab-D4YoHJGX.js";import{r as h,b as Wo}from"./vendor-react-Bxgxa9T6.js";import{f as Sn}from"./formato-moneda-B-myNs4h.js";import{t as ei,p as Xp,c as Wj,a as qj}from"./tasa-de-entrega-Ddtfuka5.js";import{f as Mj}from"./TemplatesPanel-Sec3ZcMK.js";import{C as Fj}from"./CieloLumy-Br0FDAhQ.js";import{B as Oj}from"./Banderas-D2N83YVf.js";import{u as Hj,C as Gj}from"./useCollapsible-CQvzgLKu.js";import{d as mv}from"./semaforo-1n3dRRyu.js";import{j as hv}from"./pedidos-por-pauta-BwD_YLFQ.js";import{c as On,a as Yo,b as A1}from"./coDates-BxYjNlB-.js";import{u as fv}from"./pais-ventas-YDkuBTEL.js";import{R as S1,k as w1,C as k1,X as C1,Y as _1,T as $1,c as Vj,h as I1,b as T1}from"./vendor-recharts-BYQpxUtL.js";import{l as Uj,s as Qj,a as E1,r as Kj,c as z1,b as pp,i as R1,w as Yj,d as gp,e as Jj,g as Zj,h as Xj}from"./serialized-save-DxU5JriH.js";const eg={CO:{l1:"Departamento",l2:"Ciudad / Municipio",l1ph:"Ej: Antioquia",l2ph:"Ej: MedellÃn"},MX:{l1:"Estado",l2:"Ciudad / Municipio",l1ph:"Ej: Jalisco",l2ph:"Ej: Guadalajara",l3:"Colonia",l3Key:"colonia",l3Req:!0,l3Ph:"Ej: Roma Norte",zipLabel:"Código Postal",zipPh:"Ej: 06700",zipMin:5,phPh:"Ej: 55 1234 5678",addrPh:"Ej: Av. Insurgentes Sur 1234, Int 5B",refPh:"Entre qué calles está y referencia (Ej: entre Juárez y 5 de Mayo)"},EC:{l1:"Provincia",l2:"Ciudad / Cantón",l1ph:"Ej: Pichincha",l2ph:"Ej: Quito",phPh:"Ej: 0961234567",addrPh:"Ej: Av. Amazonas N34-45 y República",refPh:"Ej: Barrio Centenario, frente a la farmacia"},PE:{l1:"Departamento",l2:"Provincia",l1ph:"Ej: Lima",l2ph:"Ej: Lima",l3:"Distrito",l3Key:"distrito",l3Req:!0,l3Ph:"Ej: Miraflores",phPh:"Ej: 912 345 678",addrPh:"Ej: Av. Arequipa 1234, Dpto 501",refPh:"Ej: Mz B Lt 5, cerca al parque",docLabel:"DNI o CE (opcional, para tu boleta)",docPh:"Ej: 45678912"},CL:{l1:"Región",l2:"Comuna",l1ph:"Ej: Región Metropolitana",l2ph:"Ej: Providencia",phPh:"Ej: 9 1234 5678",addrPh:"Ej: Av. Providencia 1234",refPh:"Ej: depto 52, block B, casa 2"},AR:{l1:"Provincia",l2:"Localidad o Partido",l1ph:"Ej: Buenos Aires",l2ph:"Ej: Quilmes",zipLabel:"Código postal",zipPh:"Ej: 1704",zipMin:4,phPh:"Sin 0 ni 15. Ej: 1125637886",addrPh:"Ej: Av. Corrientes 3456, 4° B",refPh:"Ej: frente a la escuela, tocar timbre B"},PA:{l1:"Provincia",l2:"Distrito",l1ph:"Ej: Panamá",l2ph:"Ej: Ciudad de Panamá",l3:"Corregimiento",l3Key:"corregimiento",l3Req:!0,l3Ph:"Ej: Bella Vista",phPh:"Ej: 6123 4567",addrPh:"Ej: Calle 50, Edificio X, Piso 12",refPh:"Ej: Barriada, edificio, PH, casa, piso"},PY:{l1:"Departamento",l2:"Distrito / Ciudad",l1ph:"Ej: Central",l2ph:"Ej: Asunción",l3:"Barrio",l3Key:"barrio",l3Req:!1,l3Ph:"Ej: Villa Morra",phPh:"Ej: 0974 501 715",addrPh:"Ej: Av. Mcal. López 1234 c/ Rca. Argentina",refPh:"Ej: Barrio, entre calles, casa, piso"},VE:{l1:"Estado",l2:"Municipio",l1ph:"Ej: Miranda",l2ph:"Ej: Chacao",l3:"Parroquia",l3Key:"parroquia",l3Req:!1,l3Ph:"Ej: Chacao",phPh:"Ej: 414 123 4567",addrPh:"Ej: Av. Francisco de Miranda, Edif. X, Piso 3, Urb. Los Palos Grandes",refPh:"Ej: Urbanización, edificio, apto, casa, piso"},GT:{l1:"Departamento",l2:"Municipio",l1ph:"Ej: Guatemala",l2ph:"Ej: Ciudad de Guatemala",l3:"Zona",l3Key:"zona",l3Req:!1,l3Ph:"Ej: Zona 10",phPh:"Ej: 5123 4567",addrPh:"Ej: 12 Avenida 5-43, Zona 10",refPh:"Ej: Zona, colonia, condominio, casa, nivel"},CR:{l1:"Provincia",l2:"Cantón",l1ph:"Ej: San José",l2ph:"Ej: San José",l3:"Distrito",l3Key:"distrito",l3Req:!0,l3Ph:"Ej: Carmen",phPh:"Ej: 6123 4567",addrPh:"Ej: 200m sur de la iglesia, casa verde",refPh:"Ej: 200 metros al sur de la iglesia, casa, apto"}};function wc(t){const a=String(t||"").toUpperCase();return eg[a]||eg.CO}const N1="<script>(function(){document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a||e.defaultPrevented)return;var h=a.getAttribute('href')||'';if(/^javascript:/i.test(h))return;e.preventDefault();if(h.charAt(0)==='#'){var id=decodeURIComponent(h.slice(1));var el=id?(document.getElementById(id)||document.getElementsByName(id)[0]):null;if(el&&el.classList&&el.classList.contains('lz-suelto')){el=el.querySelector('input:not(.hp):not
2([type=hidden]), select, textarea, button[type=submit]')||el}if(el&&el.scrollIntoView)el.scrollIntoView({behavior:'smooth',block:'center'});else if(!id)window.scrollTo({top:0,behavior:'smooth'});return}try{window.open(a.href,'_blank','noopener')}catch(_){}},true)})();<\/script>";function eA(t){const a=String(t||"");return a&&(/<head[^>]*>/i.test(a)?a.replace(/<head[^>]*>/i,n=>n+N1):N1+a)}const tA=4,aA=40,nA=6;function tg(t){if(t==null)return;const a=[];for(const n of String(t).split(/[|;]/)){const o=n.indexOf(":");if(o<1)continue;const i=n.slice(0,o).trim().replace(/\s+/g," ").slice(0,40),s=[...new Set(n.slice(o+1).split(",").map(u=>u.trim().replace(/\s+/g," ").slice(0,60)).filter(Boolean))].slice(0,aA);if(!(!i||!s.length)&&!a.some(u=>u.nombre.toLowerCase()===i.toLowerCase())&&(a.push({nombre:i,opciones:s}),a.length>=tA))break}return a.length?a:void 0}function xv(t){if(t==null)return;const a=[],n=/(\d{1,2})\s*:\s*([^:]*?)(?=(?:[,;|\s]\s*\d{1,2}\s*:)|$)/g;let o;for(;o=n.exec(String(t));){const i=Number(o[1]),s=nd(o[2].replace(/[,;|\s]+$/,""));if(!(!(i>=2&&i<=20)||s===void 0)&&!a.some(u=>u.cantidad===i)&&(a.push({cantidad:i,precio:s}),a.length>=nA))break}return a.length?a.sort((i,s)=>i.cantidad-s.cantidad):void 0}const oA=4e3,Cl=t=>t===" "||t===` 3`||t===" "||t==="\r"||t==="\f";function Mi(t){const a=String(t||""),n=a.length,o=[];let i=1;for(;i<n&&!Cl(a[i])&&a[i]!==">"&&a[i]!=="/";)i++;for(;i<n;){const s=i;for(;i<n&&Cl(a[i]);)i++;if(i>=n||a[i]===">")break;if(a[i]==="/"){i++;continue}const u=i;for(;i<n&&!Cl(a[i])&&a[i]!=="="&&a[i]!==">"&&a[i]!=="/";)i++;const m=a.slice(u,i).toLowerCase();if(!m){i++;continue}let c=i;for(;c<n&&Cl(a[c]);)c++;let g=null;if(a[c]==="="){for(c++;c<n&&Cl(a[c]);)c++;if(a[c]==='"'||a[c]==="'"){const f=a.indexOf(a[c],c+1);f<0?(g=a.slice(c+1),i=n):(g=a.slice(c+1,f),i=f+1)}else{const f=c;for(;c<n&&!Cl(a[c])&&a[c]!==">";)c++;g=a.slice(f,c),i=c}}o.push({nombre:m,valor:g,desde:s,hasta:i})}return o}function ko(t,a,n=!1,o=1/0){const i=String(t||""),s=[],u=a.toLowerCase(),m=new RegExp(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");let c,g=0,f=-1,b=-2,v=-1;for(;s.length<o&&(c=m.exec(i));){const j=c.index;for(;g<j;g++)i.charCodeAt(g)===60&&(f=g);const S=f;if(S<0)continue;if(S!==b){b=S,v=-1;const C=i.charCodeAt(S+1)|32;if(C>=97&&C<=122){const _=Math.min(i.length,S+oA);let N=S+1,w="";for(;N<_;N++){const M=i[N];if(w)M===w&&(w="");else if(M==='"'||M==="'")w=M;else if(M===">")break}N<_&&i[N]===">"&&(v=N)}}if(v<j)continue;const $=i.slice(S,v+1);if(n&&!/^<div[\s>\/]/i.test($)){m.lastIndex=v+1;continue}Mi($).some(C=>C.nombre===u)&&s.push({etiqueta:$,indice:S}),m.lastIndex=v+1}return s}const Do=(t,a)=>{const n=Mi(t).find(o=>o.nombre===`data-${a}`||o.nombre===a);return!n||n.valor===null?null:n.valor.replace(/"/gi,'"').replace(/'|'/gi,"'").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&")},bv=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,"");function nd(t){if(t==null)return;const n=String(t).trim().replace(/^\s*(COP|USD|MXN|PEN|CLP|ARS|GTQ|EUR)\s*/i,"").replace(/\s*(COP|USD|MXN|PEN|CLP|ARS|GTQ|EUR)\s*$/i,"").replace(/[$\s]/g,"");if(!/^\d[\d.,]*$/.test(n))return;const o=Math.max(n.lastIndexOf("."),n.lastIndexOf(","));let i;if(o>=0){const s=n.length-o-1,u=n.slice(0,o).replace(/[^\d]/g,""),m=n.slice(o+1).replace(/[^\d]/g,"");i=s===1||s===2?+`${u}.${m}`:Number(u+m)}else i=Number(n.replace(/[^\d]/g,""));if(!(!Number.isFinite(i)||i<=0||i>=1e9))return Math.round(i*100)/100}function Mg(t){return nd(String(t||"").replace(/^[^\d]+/,"").replace(/[^\d.,]+$/,""))}const Vl=t=>t!=null&&/^(ninguna|ninguno)$/i.test(t.trim()),ss=t=>t!=null&&/[<>\n\r]/.test(t);function rA(t){if(t==null)return;if(/^(gratis|gratuito|0)$/i.test(t.trim()))return{gratis:!0};const a=nd(t);return a===void 0?void 0:{gratis:!1,valor:a}}function iA(t){if(t==null)return;const a=t.lastIndexOf(":");if(a<1)return;const n=t.slice(0,a).trim().replace(/\s+/g," ").slice(0,60),o=nd(t.slice(a+1));if(!(!n||o===void 0))return{nombre:n,precio:o}}const sA=t=>t!=null&&/^(si|sÃ|true|1|marcado)$/i.test(t.trim()),lA=t=>/^(https?:\/\/[^\s"'<>]{3,}|\/[^\s"'<>]*|#[\w-]*)$/i.test(t)&&t.length<=500;function yv(t){const a=ko(bv(t),"data-lumy-gracias",!1,1)[0];if(!a)return null;const n=a.etiqueta,o={},i=(f,b)=>{const v=Do(n,f);
3if(v==null||ss(v))return;if(Vl(v))return null;const j=v.trim().replace(/\s+/g," ").slice(0,b);return j||void 0},s=i("titulo",120);s!==void 0&&(o.titulo=s);const u=i("texto",400);u!==void 0&&(o.texto=u);const m=i("boton",60);m!==void 0&&(o.boton=m);const c=Do(n,"ir-a");c!=null&&!ss(c)&&(Vl(c)?o.irA=null:lA(c.trim())&&(o.irA=c.trim()));const g=Do(n,"ir-en");if(g!=null&&/^\d{1,3}$/.test(g.trim())){const f=Number(g.trim());o.irEn=f===0?0:Math.min(60,Math.max(3,f))}return Object.keys(o).length?o:null}function qu(t){const a=ko(bv(t),"data-lumy-producto",!0,1)[0];if(!a)return null;const n=a.etiqueta,o={},i=Do(n,"nombre");i!=null&&i.trim()&&(o.nombre=i.trim().slice(0,200));const s=nd(Do(n,"precio"));s!==void 0&&(o.precio=s);const u=nd(Do(n,"tachado")??Do(n,"precio_antes")??Do(n,"precio-antes"));u!==void 0&&(o.precio===void 0||u>o.precio)&&(o.tachado=u);const m=Do(n,"variantes"),c=ss(m)?null:m,g=tg(c);g?o.variantes=g:Vl(c)&&(o.sinVariantes=!0);const f=Do(n,"ofertas"),b=ss(f)?null:f,v=xv(b);v?o.ofertas=v:Vl(b)&&(o.sinOfertas=!0);const j=Do(n,"envio"),S=rA(ss(j)?null:j);S&&(o.envio=S);const $=Do(n,"adicional"),C=ss($)?null:$,_=iA(C);_?o.adicional=_:Vl(C)&&(o.sinAdicional=!0);const N=Do(n,"adicional-texto");N!=null&&!ss(N)&&(Vl(N)?o.adicionalTexto=null:N.trim()&&(o.adicionalTexto=N.trim().replace(/\s+/g," ").slice(0,140)));const w=Do(n,"adicional-marcado");return w!=null&&!ss(w)&&w.trim()&&(o.adicionalMarcado=sA(w)),Object.keys(o).length?o:null}function dA(t,a){for(const n of Array.isArray(a==null?void 0:a.variants)?a.variants:[]){const o=String((n==null?void 0:n.name)||"").trim();if(!o)continue;let i=t.variants.find(s=>String((s==null?void 0:s.name)||"").trim().toLowerCase()===o.toLowerCase());i||(i={name:o,options:[]},t.variants.push(i));for(const[s,u]of Object.entries(n||{}))s!=="name"&&s!=="options"&&i[s]===void 0&&(i[s]=u);for(const s of Array.isArray(n==null?void 0:n.options)?n.options:[]){const u=String((s==null?void 0:s.value)||"").trim();if(!u||Object.keys(s||{}).length<=1)continue;const m=i.options.find(c=>String((c==null?void 0:c.value)||"").trim()===u);m?Object.assign(m,{...s,...m,value:u}):i.options.push({...s,value:u})}}for(const n of Array.isArray(a==null?void 0:a.bundles)?a.bundles:[]){const o=Number(n==null?void 0:n.qty)||0,i=Object.keys(n||{}).filter(u=>u!=="qty"&&u!=="price");if(!o||!i.length)continue;const s=t.bundles.find(u=>Number(u==null?void 0:u.qty)===o);s?Object.assign(s,{...n,...s,qty:o}):t.bundles.push({...n})}}function cA(t){const a=yv(String((t==null?void 0:t.lienzo_html)||""));if(!a)return t;const n={...t.thankyou||{}},o=(i,s)=>{s!==void 0&&(s===null?delete n[i]:n[i]=s)};return o("headline",a.titulo),o("text",a.texto),o("cta_text",a.boton),o("redirect_url",a.irA),a.irEn!==void 0&&(a.irEn>0?n.redirect_in=a.irEn:delete n.redirect_in),{...t,thankyou:n}}function uA(t,a,n){const o=cA(t),i=qu(String((o==null?void 0:o.lienzo_html)||""));if(!i)return o;const s={...o.product||{}},u=a?a(String((o==null?void 0:o.country)||"")):!1;i.nombre!==void 0&&(s.name=i.nombre),i.precio!==void 0&&(s.price=u?Math.round(i.precio):i.precio),i.tachado!==void 0&&(s.compare_at_price=u?Math.round(i.tachado):i.tachado);const m={...o,product:s};if(i.variantes){const c=Array.isArray(o.variants)?o.variants:[],g=(b,v)=>b.find(j=>String((j==null?void 0:j.name)||"").trim().toLowerCase()===v.toLowerCase()),f=(b,v)=>(Array.isArray(b==null?void 0:b.options)?b.options:[]).find(j=>String((j==null?void 0:j.value)||"").trim()===v);m.variants=i.variantes.map(b=>{const v=g(c,b.nombre),j=g((n==null?void 0:n.variants)||[],b.nombre);return{...j||{},...v||{},name:b.nombre,options:b.opciones.map(S=>({...f(j,S)||{},...f(v,S)||{},value:S}))}})}if(i.sinVariantes&&(m.variants=[]),i.sinOfertas&&(m.bundles=[]),i.precio!==void 0&&!i.ofertas&&!i.sinOfertas&&Array.isArray(o.bundles)&&o.bundles.some(c=>Number(c==null?void 0:c.qty)===1&&Number(c==null?void 0:c.price)!==Number(s.price))&&(m.bundles=o.bundles.map(c=>Number(c==null?void 0:c.qty)===1?{...c,price:s.price}:c)),i.ofertas){const c=Number(s.price)||0;if(c>0){const g=Array.isArray(o.bundles)?o.bundles:[],f=b=>({...((n==null?void 0:n.bundles)||[]).find(v=>Number(v==null?void 0:v.qty)===b)||{},...g.find(v=>Number(v==null?void 0:v.qty)===b)||{}});m.bundles=[{...f(1),qty:1,price:c},...i.ofertas.filter(b=>b.precio>=c).map(b=>({...f(b.cantidad),qty:b.cantidad,price:u?Math.round(b.precio):b.precio}))]}}if(i.envio){const c=o.shipping&&typeof o.shipping=="object"?o.shipping:{};m.shipping=i.envio.gratis?{...c,mode:"free"}:{...c,mode:"general",general_cop:u?Math.round(i.envio.valor):i.envio.valor}}if(i.sinAdicional)m.order_bump=null;else if(i.adicional||i.adicionalTexto!==void 0||i.adicionalMarcado!==void 0){const c=o.order_bump&&typeof o.order_bump=="object"?o.order_bump:null;if(i.adicional||c){const g={...c||{}};i.adicional&&(g.label=i.adicional.nombre,g.price=u?Math.round(i.adicional.precio):i.adicional.precio),i.adicionalTexto===null?delete g.text:i.adicionalTexto!==void 0&&(g.text=i.adicionalTexto),i.adicionalMarcado!==void 0&&(g.preselected=i.adicionalMarcado),m.order_bump=g}}return m}const Mu=(t,a)=>String(t??"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"").trim().slice(0,a);function L1(t){if(typeof t=="number")return Number.isFinite(t)&&t>0&&t<1e9?t:void 0;if(!(t==null||t===""))return Mg(String(t))}function pA(t){if(t==null||t==="")return[];if(typeof t=="string")return tg(t)||[];if(!Array.isArray(t))return[];const a=t.map(n=>{const o=Mu((n==null?void 0:n.nombre)??(n==null?void 0:n.name),40).replace(/[:|;]/g," "),s=(Array.isArray((n==null?void 0:n.opciones)??(n==null?void 0:n.options))?n.opciones??n.options:String((n==null?void 0:n.opciones)??(n==null?void 0:n.options)??"").split(",")).map(u=>Mu(typeof u=="object"&&u?u.value??u.nombre??"":u,60).replace(/[,|;
3]/g," ")).filter(Boolean);return o&&s.length?`${o}: ${s.join(", ")}`:""}).filter(Boolean).join(" | ");return a?tg(a)||[]:[]}function gA(t){const a=t&&typeof t=="object"?t:{},n=a.product&&typeof a.product=="object"?a.product:{},o=Array.isArray(a.variants)&&a.variants.length?a.variants:Array.isArray(n.variants)?n.variants:[];return{nombre:String(n.name||a.name||""),precio:Number(n.price)||0,precioAntes:Number(n.compare_at_price)||0,descripcion:String(n.description||""),fotos:Array.isArray(n.images)?n.images.filter(i=>typeof i=="string"):[],variantes:o.filter(i=>i&&i.name&&Array.isArray(i.options)).map(i=>({nombre:String(i.name),opciones:i.options.map(s=>String(s&&typeof s=="object"?s.value??"":s)).filter(Boolean)})),atadoADropi:Array.isArray(n.dropi_variations)&&n.dropi_variations.length>0}}const vv=420,mA=30,Zl=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{};function hA(t){const a=Zl(t),n=Zl(a.product),o=gA(a),i=a.page_type==="catalogo"?"tienda":"landing",s=i==="landing"&&!!a.modo_codigo,u=i==="landing"&&String(n.dropi_product_id??"").trim()!=="",m=String(n.mastershop_product_id??"").trim()!=="",c=s?"codigo":o.atadoADropi||u?"dropi":m?"mastershop":"",g=s&&(!!a.modo_codigo_borrador&&typeof a.modo_codigo_borrador=="object"||typeof a.lienzo_borrador=="string"),f=(Array.isArray(a.bundles)?a.bundles:[]).map(b=>({cantidad:Number(b==null?void 0:b.qty)||0,precio:Number(b==null?void 0:b.price)||0})).filter(b=>b.cantidad>=2&&b.precio>0);return{...o,tipo:i,enCodigo:s,borradorPendiente:g,tallasBloqueadas:c,textoDeTienda:i==="landing"?String(n.store_desc||"").slice(0,vv):"",ofertas:f}}function fA(t){const n=(Array.isArray(t)?t:[]).map(o=>String(o??"").trim()).filter(o=>/^https?:\/\/[^\s"'<>()\\]+$/i.test(o)&&o.length<=2048);return[...new Set(n)].slice(0,mA)}function xA(t,a){const n=Array.isArray(t)?t:[],o=i=>String(i&&typeof i=="object"?i.value??"":i??"").trim();return a.map(i=>{const s=n.find(m=>String((m==null?void 0:m.name)||"").trim().toLowerCase()===i.nombre.toLowerCase()),u=Array.isArray(s==null?void 0:s.options)?s.options:[];return{...Zl(s),name:i.nombre,options:i.opciones.map(m=>u.find(c=>o(c)===m)??{value:m})}})}function bA(t,a,n){const o={...Zl(t)},i={...Zl(o.product)},s=hA(o),u=Zl(a),m=g=>Object.prototype.hasOwnProperty.call(u,g);if(s.borradorPendiente)return{ok:!1,error:"La landing de este producto tiene cambios sin publicar en su código. PublÃcalos o descártalos en su editor y vuelve a intentarlo."};if(s.enCodigo&&(m("nombre")||m("precio")||m("precio_antes")))return{ok:!1,error:"El nombre y el precio de este producto están en el código de su landing: cámbialos allá."};if(s.tallasBloqueadas&&m("variantes"))return{ok:!1,error:s.tallasBloqueadas==="codigo"?"Las tallas y colores de este producto están en el código de su landing: cámbialos allá.":`Las tallas y colores de este producto vienen de ${s.tallasBloqueadas==="mastershop"?"Mastershop":"Dropi"}: cambiarlos aquà harÃa que el pedido suba con otra, o que no suba.`};const c=g=>n.sinCentavos?Math.round(g):Math.round(g*100)/100;if(m("nombre")){const g=Mu(u.nombre,200);if(!g)return{ok:!1,error:"Ponle un nombre al producto."};i.name=g}if(m("precio")){const g=L1(u.precio);if(!g||!(c(g)>0))return{ok:!1,error:"Ponle un precio mayor que cero. Un producto en $0 llegarÃa a la guÃa sin nada que cobrar."};i.price=c(g),Array.isArray(o.bundles)&&(o.bundles=o.bundles.map(f=>Number(f==null?void 0:f.qty)===1?{...f,price:i.price}:f))}if(m("precio_antes")||m("precio")){const g=m("precio_antes")?L1(u.precio_antes):Number(i.compare_at_price)>0?Number(i.compare_at_price):void 0;g&&c(g)>Number(i.price)?i.compare_at_price=c(g):delete i.compare_at_price}if(m("fotos")&&(i.images=fA(u.fotos)),m("texto_de_tienda")){const g=Mu(u.texto_de_tienda,vv);g?i.store_desc=g:delete i.store_desc}return m("variantes")&&(o.variants=xA(o.variants,pA(u.variantes))),o.product=i,{ok:!0,config:o}}const Ul={name:80,text:2e3,date:40,source:60,image:2048};function yA(t){const a={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"',aacute:"á",eacute:"é",iacute:"Ã",oacute:"ó",uacute:"ú",ntilde:"ñ",Aacute:"Ã",Eacute:"Ã",Iacute:"Ã",Oacute:"Ã",Uacute:"Ã",
3Ntilde:"Ã"};return String(t||"").replace(/&#x([0-9a-f]+);?/gi,(n,o)=>{const i=Number.parseInt(o,16);try{return i>0&&i<=1114111?String.fromCodePoint(i):""}catch{return""}}).replace(/&#(\d+);?/g,(n,o)=>{const i=Number.parseInt(o,10);try{return i>0&&i<=1114111?String.fromCodePoint(i):""}catch{return""}}).replace(/&([a-z]+);/gi,(n,o)=>a[o]??a[o.toLowerCase()]??n)}function Yd(t,a=Ul.text){let n=String(t??"");for(let i=0;i<2;i++){const s=yA(n);if(s===n)break;n=s}return n.replace(/<script\b[\s\S]*?<\/script\s*>/gi," ").replace(/<style\b[\s\S]*?<\/style\s*>/gi," ").replace(/<svg\b[\s\S]*?<\/svg\s*>/gi," ").replace(/<!--[\s\S]*?-->/g," ").replace(/<br\s*\/?>/gi,` 4`).replace(/<\/(?:p|div|li|blockquote|h[1-6])\s*>/gi,` 5`).replace(/<[^>]+>/g," ").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"").replace(/[ \t\f\v]+/g," ").replace(/ *\n+ */g," ").trim().slice(0,Math.max(0,a)).trim()}const P1=100,vA=(t,a)=>String(t??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim().slice(0,a),jA=t=>{const a=Math.round(Number(t));return a>=1&&a<=5?a:void 0},D1=t=>{const a=String(t??"").trim();return/^https:\/\/[^\s"'<>()\\]+$/i.test(a)&&a.length<=Ul.image?a:void 0};function AA(t){const a=t&&typeof t=="object"&&!Array.isArray(t)?t:null;if(!a)return{ok:!1,error:"Las reseñas no llegaron bien. Vuelve a intentarlo."};const n=Array.isArray(a.items)?a.items:[];if(n.filter(f=>f&&(String(f.texto??f.text??"").trim()||D1(f.foto??f.image))).length>P1)return{ok:!1,error:`Puedes poner hasta ${P1} reseñas por producto.`};const o=n.map(f=>{const b=Yd((f==null?void 0:f.texto)??(f==null?void 0:f.text),Ul.text),v=D1((f==null?void 0:f.foto)??(f==null?void 0:f.image)),j=Yd((f==null?void 0:f.nombre)??(f==null?void 0:f.name),Ul.name);if(!b&&!v&&!j)return null;const S=jA((f==null?void 0:f.estrellas)??(f==null?void 0:f.stars)),$=vA((f==null?void 0:f.fecha)??(f==null?void 0:f.date),Ul.date);return{name:j,city:Yd((f==null?void 0:f.ciudad)??(f==null?void 0:f.city),60),text:b,...S?{stars:S}:{},verified:((f==null?void 0:f.verificada)??(f==null?void 0:f.verified))===!0,...v?{image:v}:{},...$?{date:$}:{}}}).filter(Boolean),i=Number(String(a.calificacion??"").replace(",",".")),s=a.calificacion!==void 0&&a.calificacion!==null&&String(a.calificacion).trim()!==""?i>=1&&i<=5?Math.round(i*10)/10:NaN:void 0;if(Number.isNaN(s))return{ok:!1,error:"La calificación va de 1 a 5 (por ejemplo 4,8)."};const u=Number(String(a.cantidad??"").replace(/[.\s]/g,"")),m=a.cantidad!==void 0&&a.cantidad!==null&&String(a.cantidad).trim()!==""?Number.isSafeInteger(u)&&u>=0&&u<=1e7?u:NaN:void 0;if(Number.isNaN(m))return{ok:!1,error:"El número de reseñas va en números enteros (por ejemplo 35)."};const c={...s!==void 0?{rating:s}:{},...m?{count:m}:{},title:Yd(a.titulo??a.title,60),source:Yd(a.fuente??a.source,Ul.source),items:o},g=a.mostrar===!0;return g&&!o.length&&s===void 0?{ok:!0,reviews_off:!0,reviews:c,aviso:"No habÃa reseñas que mostrar: quedaron apagadas. Escribe al menos una para que salgan."}:{ok:!0,reviews_off:!g,reviews:c}}function SA(t,a){const n=t!=null&&t.reviews&&typeof t.reviews=="object"&&!Array.isArray(t.reviews)?t.reviews:{},{rating:o,count:i,title:s,source:u,items:m,de_ejemplo:c,...g}=n;return{...t,reviews_off:a.reviews_off,reviews:{...g,...a.reviews||{}}}}function wA({size:t=15}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 40 40",fill:"none",style:{flex:"none"},"aria-hidden":!0,children:[e.jsx("path",{d:"M30 10c-.2 0-3.8-.3-3.8-.3l-2.9-2.8c-.2-.2-.6-.1-.8 0l-1.4.4c-.4-1-1-1.6-1.7-1.6h-.1c-.2-.3-.5-.4-.7-.4-2 0-3 2.5-3.3 3.7l-2.1.7c-.6.2-.6.2-.7.8L11 28l11 2.1 5.4-1.2L30.5 10.5c0-.3-.3-.5-.5-.5z",fill:"#95BF47"}),e.jsx("path",{d:"M30 10c-.2 0-3.8-.3-3.8-.3l-2.9-2.8L22 30.1l5.4-1.2L30.5 10.5c0-.3-.3-.5-.5-.5z",fill:"#5E8E3E"})]})}function kA(){const[t,a]=h.useState([]),[n,o]=h.useState([]),[i,s]=h.useState(""),[u,m]=h.useState(""),[c,g]=h.useState(null),[f,b]=h.useState({}),[v,j]=h.useState([]),[S,$]=h.useState({}),[C,_]=h.useState({}),[N,w]=h.useState(!0),[M,p]=h.useState(""),V=h.useRef(new Set),L=ce=>ce.shopify_product_id+"|"+ce.shopify_variant_id,x=h.useCallback(async()=>{w(!0),V.current.clear();try{const ce=await fetch("/api/shopify/equivalencias-dropi").then(ve=>ve.json()).catch(()=>null);ce!=null&&ce.ok&&(a(ce.items||[]),g(Number(ce.tiendas_conectadas)||0),j(Array.isArray(ce.lectura_por_tienda)?ce.lectura_por_tienda:[]),m(ce.catalogo_shopify&&!ce.catalogo_shopify.ok?"No pudimos leer tu catálogo de Shopify: "+String(ce.catalogo_shopify.message||"").replace(/[.\s]+$/,"")+". Abajo solo salen los productos que ya te han llegado en pedidos.":""))}catch{}finally{w(!1)}},[]);h.useEffect(()=>{x(),(async()=>{const ce=await fetch("/api/dropi-v2/catalogo").then(ve=>ve.json()).catch(()=>null);ce!=null&&ce.ok?o(ce.items||[]):ce!=null&&ce.message&&s(ce.message)})()},[x]);const z=h.useCallback(async ce=>{if(!(!(ce>0)||V.current.has(ce))){V.current.add(ce),_(ve=>({...ve,[ce]:""}));try{const ve=await fetch(`/api/dropi-v2/producto/${ce}/variaciones`).then(ge=>ge.json()).catch(()=>null);ve!=null&&ve.ok?($(ge=>({...ge,[ce]:ve.items||[]})),_(ge=>({...ge,[ce]:ve.nombre||null}))):_(ge=>({...ge,[ce]:null}))}catch{_(ve=>({...ve,[ce]:null}))}}},[]);h.useEffect(()=>{for(const ce of t)ce.dropi_product_id&&z(ce.dropi_product_id)},[t,z]);const G=h.useCallback(async(ce,ve,ge,Te)=>{var ie;try{const fe=await fetch("/api/shopify/equivalencias-dropi",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopify_product_id:ce.shopify_product_id,shopify_variant_id:ce.shopify_variant_id,dropi_product_id:ve,dropi_variation_id:ge,auto_push:Te===void 0?ce.auto_push:Te,nombre_shopify:ce.variante?`${ce.nombre} · ${ce.variante}`:ce.nombre,nombre_dropi:((ie=n.find(Be=>Be.id===ve))==null?void 0:ie.nombre)||null})}).then(Be=>Be.json()).catch(()=>null);p(fe!=null&&fe.ok?"":(fe==null?void 0:fe.message)||"No se pudo guardar.")}catch{p("Error de conexión.")}},[n]),B=async(ce,ve)=>{const ge=new Set(ce.map(L));a(Te=>Te.map(ie=>ge.has(L(ie))?{...ie,es_extra:ve,dropi_product_id:null,dropi_variation_id:null}:ie));for(const Te of ce)try{await fetch("/api/shopify/equivalencias-dropi",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopify_product_id:Te.shopify_product_id,shopify_variant_id:Te.shopify_variant_id,es_extra:ve,nombre_shopify:Te.nombre})})}catch{}},U=(ce,ve)=>{const ge=new Set(ce.map(L));a(Te=>Te.map(ie=>ge.has(L(ie))?{...ie,auto_push:ve}:ie));for(const Te of ce)G(Te,Number(Te.dropi_product_id)||0,Number(Te.dropi_variation_id)||0,ve)},ne=(ce,ve)=>{const ge=Number(ve)||0;a(Te=>Te.map(ie=>L(ie)===L(ce)?{...ie,dropi_variation_id:ge||null}:ie)),G(ce,Number(ce.dropi_product_id)||0,ge)},Q=(ce,ve)=>{const ge=Number(ve)||0,Te=new Set(ce.map(L));a(ie=>ie.map(fe=>Te.has(L(fe))?{...fe,dropi_product_id:ge||null,dropi_variation_id:null}:fe)),ge&&z(ge);for(const ie of ce)G(ie,ge,0)};if(N)return e.jsx("div",{style:{padding:"18px 2px",color:"var(--text-muted)",fontSize:12.5},children:"Cargandoâ¦"});if(!t.length)return e.jsx("div",{style:{padding:"18px 2px",color:"var(--text-muted)",fontSize:12.5,lineHeight:1.55}
5,children:u||(c===0?"No tienes ninguna tienda de Shopify conectada. Conéctala en Conexiones y aquà saldrán tus productos.":"No encontramos productos en tu tienda de Shopify. Si acabas de conectarla, dale un momento y recarga.")});const de=new Map;for(const ce of t){const ve=de.get(ce.shopify_product_id)||[];ve.push(ce),de.set(ce.shopify_product_id,ve)}const pe={padding:"6px 9px",borderRadius:8,border:"1px solid var(--border)",fontFamily:"inherit",fontSize:12.5,background:"var(--bg-card)",color:"var(--text-primary)"};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[e.jsxs("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:[t.length," ",t.length===1?"producto":"productos"," de tu tienda"]}),e.jsxs("button",{onClick:()=>void x(),disabled:N,title:"Volver a leer tus productos de Shopify",style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:6,border:"1px solid var(--border)",background:"transparent",color:"var(--text-primary)",borderRadius:8,padding:"5px 11px",fontSize:12,fontWeight:700,fontFamily:"inherit",cursor:N?"default":"pointer"},children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}),e.jsx("path",{d:"M21 3v6h-6"})]}),N?"Buscandoâ¦":"Traer de Shopify"]})]}),M&&e.jsx("div",{style:{fontSize:12,color:"var(--danger)",marginBottom:6},children:M}),i&&e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:6},children:i}),u&&e.jsx("div",{style:{fontSize:12,color:"var(--warning)",marginBottom:6},children:u}),!u&&v.map(ce=>ce.error?e.jsxs("div",{style:{fontSize:12,color:"var(--warning)",marginBottom:6,lineHeight:1.5},children:[e.jsx("b",{children:ce.dominio}),": ",ce.error.includes("reconnect")?"hay que volver a conectarla en Conexiones â sus productos no salen aquà hasta entonces.":ce.error]},ce.dominio):null),[...de.values()].map((ce,ve)=>{var tt;const ge=ce[0],Te=((tt=ce.find(Fe=>Fe.dropi_product_id))==null?void 0:tt.dropi_product_id)??null,ie=Te?S[Te]:void 0,fe=ce.filter(Fe=>Fe.variante),Be=ce.reduce((Fe,F)=>Fe+F.pedidos,0),We=ce.reduce((Fe,F)=>Fe+F.pedidos_sin_guia,0),ze=!!Te&&(!fe.length||fe.every(Fe=>Fe.dropi_variation_id));return e.jsxs("div",{style:{padding:"14px 0",borderTop:ve?"1px solid var(--border)":0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginBottom:fe.length?12:0},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",flex:"none",background:ze||ge.es_extra||ge.no_se_envia?"#16a34a":"var(--border)"}}),e.jsx("span",{style:{fontSize:13.5,fontWeight:700},children:ge.nombre}),e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums"},children:[Be," ",Be===1?"pedido":"pedidos",We>0&&e.jsxs(e.Fragment,{children:[" · ",We," sin guÃa"]})]}),ge.no_se_envia?e.jsx("span",{style:{marginLeft:"auto",fontSize:11.5,fontWeight:700,color:"var(--text-secondary, #8a90a2)"},children:"1-Tick Upsell · no se despacha"}):ge.es_extra?e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-secondary, #8a90a2)"},children:"1-Tick Upsell · no se despacha"}),e.jsx("button",{onClick:()=>B(ce,!1),style:{border:0,background:"transparent",color:"var(--text-muted)",textDecoration:"underline",cursor:"pointer",fontFamily:"inherit",fontSize:11.5},children:"Es un producto"})]}):e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,marginLeft:"auto",flex:"0 0 auto"},children:[e.jsxs("label",{title:"Apágalo si prefieres subir este producto a la logÃstica a mano. Encendido hace lo mismo que un pedido de tus landings: manda tu interruptor del flujo.",style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:ge.auto_push!==!1,onChange:Fe=>U(ce,Fe.target.checked),style:{width:15,height:15,accentColor:"#16a34a",cursor:"pointer"}}),e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:ge.auto_push!==!1?"#15803d":"var(--text-secondary, #8a90a2)"},children:"Subir automático"})]}),e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-secondary, #8a90a2)"},children:"Producto en Dropi"}),e.jsx("input",{value:Te??"",inputMode:"numeric",placeholder:"Id",onChange:Fe=>{const F=Fe.target.value.replace(/\D/g,""),Re=new Set(ce.map(L));a(K=>K.map(I=>Re.has(L(I))?{...I,dropi_product_id:F?Number(F):null}:I))},onBlur:Fe=>Q(ce,Fe.target.value),onKeyDown:Fe=>{Fe.key==="Enter"&&Fe.target.blur()},style:{...pe,width:96,fontVariantNumeric:"tabular-nums"}}),!Te&&e.jsx("button",{onClick:()=>B(ce,!0),title:"Márcalo si esta lÃnea no es un producto que se empaca, sino un 1-Tick Upsell: un extra que le cobras al comprador (el envÃo, una garantÃa, la envoltura de regalo). Deja de pedirse para siempre.",style:{border:0,background:"transparent",color:ge.sugerencia_extra?"#b45309":"var(--text-muted)",textDecoration:"underline",cursor:"pointer",fontFamily:"inherit",fontSize:11.5,fontWeight:ge.sugerencia_extra?800:600},children:"Es un 1-Tick Upsell"}),Te!=null&&(()=>{const Fe=C[Te];return Fe===void 0||Fe===""?e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"comprobandoâ¦"}):Fe===null?e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--danger)"},children:"ese id no está en tu Dropi"}):e.jsx("span",{title:Fe,style:{fontSize:11.5,color:"var(--success)",fontWeight:700,flex:"none"},children:"â Sincronizado"})})()]})]}),fe.length>3&&!f[ge.shopify_product_id]&&fe.every(Fe=>Fe.dropi_variation_id)&&e.jsxs("button",{onClick:()=>b(Fe=>({...Fe,[ge.shopify_product_id]:!0})),style:{marginLeft:15,border:"1px solid var(--border)",background:"transparent",color:"var(--text-primary)",borderRadius:8,padding:"5px 11px",fontSize:12,fontWeight:700,fontFamily:"inherit",curs
5or:"pointer"},children:[fe.length," variantes, todas asociadas · ver"]}),fe.length>0&&(fe.length<=3||f[ge.shopify_product_id]||fe.some(Fe=>!Fe.dropi_variation_id))&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"8px 20px",paddingLeft:15},children:fe.map(Fe=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("span",{style:{fontSize:12.5,color:"var(--text-primary)",minWidth:78,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Fe.variante}),Te?ie?ie.length?e.jsxs("select",{value:Fe.dropi_variation_id??"",onChange:F=>ne(Fe,F.target.value),style:{...pe,flex:1,minWidth:0},children:[e.jsx("option",{value:"",children:"â elegir â"}),ie.map(F=>e.jsxs("option",{value:F.id,children:[F.nombre,F.stock!==null?` (${F.stock})`:""]},F.id))]}):e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Sin variantes en Dropi"}):e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Cargandoâ¦"}):e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"pon el id primero"})]},L(Fe)))})]},ge.shopify_product_id)})]})}const nu=t=>String(t??"").toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,"").replace(/\s+/g," ").trim(),B1=t=>(typeof t=="string"?t:t==null?void 0:t.value)??"";function CA(t,a){const n=Array.isArray(t)?t:[],o=new Set,i=n.map(s=>{var g;const u=a.findIndex((f,b)=>!o.has(b)&&nu(f==null?void 0:f.name)===nu(s==null?void 0:s.name));if(u<0)return s;o.add(u);const m=Array.isArray(s==null?void 0:s.options)?s.options:[],c=(Array.isArray((g=a[u])==null?void 0:g.options)?a[u].options:[]).map(f=>m.find(b=>nu(B1(b))===nu(B1(f)))??f);return{...a[u],options:c}});return a.forEach((s,u)=>{o.has(u)||i.push(s)}),i}const W1={background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:14,padding:14},ou={width:"100%",padding:"9px 11px",borderRadius:10,border:"1.5px solid var(--border, #dde)",fontSize:13.5,background:"var(--card-bg, #fff)",color:"inherit"},Ps={padding:"8px 13px",borderRadius:10,border:"1.5px solid var(--border, #dde)",background:"var(--card-bg, #fff)",fontSize:12.5,fontWeight:700,cursor:"pointer",color:"inherit"},mp={...Ps,background:"var(--accent, #0866FF)",borderColor:"var(--accent, #0866FF)",color:"#fff"},q1=t=>(Number(t)||0).toLocaleString("es-CO");function _A(){const[t,a]=h.useState([]),[n,o]=h.useState([]),[i,s]=h.useState(!1),[u,m]=h.useState(""),[c,g]=h.useState(""),[f,b]=h.useState(""),[v,j]=h.useState(null),[S,$]=h.useState({}),C=()=>{fetch("/api/inventory").then(L=>L.json()).then(L=>{L!=null&&L.ok&&(a(L.items||[]),o(L.candidates||[])),s(!0)}).catch(()=>s(!0))};h.useEffect(C,[]);const _=L=>{m(L),setTimeout(()=>m(""),2500)},N=async()=>{const L=Number(c);if(!L)return;const x=await fetch("/api/inventory/items",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({landing_id:L,initial:Number(f)||0})}).then(z=>z.json()).catch(()=>null);x!=null&&x.ok?(g(""),b(""),C(),_("Producto agregado al control de stock â")):_((x==null?void 0:x.message)||"No se pudo agregar.")},w=async(L,x)=>{const z=x==="conteo"?window.prompt(`Conteo fÃsico de "${L.name}": ¿cuántas unidades HAY en tu bodega ahora mismo?`):window.prompt(x==="entrada"?`¿Cuántas unidades ENTRAN de "${L.name}"? (llegó mercancÃa)`:`Ajuste de "${L.name}": positivo suma, negativo resta (ej. -2 por daño)`);if(z===null||z.trim()==="")return;const G=Number(z.replace(/\./g,"").replace(",",".").replace(/[^0-9.-]/g,""));if(!Number.isFinite(G)){_("Escribe solo el número de unidades.");return}const B={item_id:L.id,reason:x};x==="conteo"?B.fisico=Math.max(0,Math.floor(G)):B.delta=Math.trunc(G);const U=await fetch("/api/inventory/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)}).then(ne=>ne.json()).catch(()=>null);U!=null&&U.ok?(C(),v===L.id?fetch(`/api/inventory/items/${L.id}/moves`).then(ne=>ne.json()).then(ne=>{ne!=null&&ne.ok&&$(Q=>({...Q,[L.id]:ne.moves}))}).catch(()=>{}):$(ne=>{const Q={...ne};return delete Q[L.id],Q}),_("Stock actualizado â")):_((U==null?void 0:U.message)||"No se pudo registrar.")},M=async(L,x)=>{const z=window.prompt(x==="min_alert"?`Avisarte cuando queden ¿cuántas unidades de "${L.name}"? (0 = sin aviso)`:`Costo por unidad de "${L.name}" en pesos (para tu margen):`,String(L[x]||""));if(z===null)return;const G=z.replace(/[^0-9]/g,"");if(z.trim()!==""&&G===""){_("Escribe solo números.");return}const B=await fetch(`/api/inventory/items/${L.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[x]:Number(G)||0})}).then(U=>U.json()).catch(()=>null);B!=null&&B.ok&&(C(),_("Guardado â"))},p=async L=>{window.confirm(`¿Quitar "${L.name}" del control de stock? Sus movimientos se borran (los pedidos no se tocan).`)&&(await fetch(`/api/inventory/items/${L.id}`,{method:"DELETE"}).catch(()=>null),C())},V=L=>{if(v===L){j(null);return}j(L),S[L]||fetch(`/api/inventory/items/${L}/moves`).then(x=>x.json()).then(x=>{x!=null&&x.ok&&$(z=>({...z,[L]:x.moves}))}).catch(()=>{})};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,marginBottom:18},children:[e.jsxs("div",{style:{margin:"0 2px"},children:[e.jsx("h2",{style:{fontSize:19,fontWeight:800,margin:0,color:"var(--text, #111)"},children:"Stock propio"}),e.jsxs("p",{style:{fontSize:13,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5},children:["Para mercancÃa que despachas tú (no Dropi). El disponible se calcula solo con tus pedidos del CRM: los activos quedan ",e.jsx("b",{children:"comprometidos"}),", los entregados descuentan y las cancelaciones o devoluciones reponen."]})]}),u&&e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:"var(--accent, #0866FF)"},children:u}
5),i&&t.length===0&&e.jsxs("div",{style:W1,children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:700,marginBottom:8},children:"Empieza a controlar un producto"}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("select",{style:{...ou,flex:"1 1 200px"},value:c,onChange:L=>g(L.target.value),children:[e.jsx("option",{value:"",children:"Elige la landing del productoâ¦"}),n.map(L=>e.jsx("option",{value:L.id,children:L.name},L.id))]}),e.jsx("input",{style:{...ou,flex:"0 1 140px"},type:"number",min:0,placeholder:"Unidades que tienes",value:f,onChange:L=>b(L.target.value)}),e.jsx("button",{style:mp,onClick:N,disabled:!c,children:"Agregar"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"8px 0 0"},children:"Solo aplica a productos que despachas con tu propio stock. Los de Dropi ya se controlan abajo con el stock del proveedor."})]}),t.map(L=>{const x=L.min_alert>0&&L.disponible<=L.min_alert;return e.jsxs("div",{style:{...W1,borderColor:L.disponible<=0?"#fca5a5":x?"#fcd34d":"var(--border, #e5e7eb)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:"1 1 180px",minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.name}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)"},children:[L.comprometido," comprometidas · ",L.entregado," entregadas",L.cost_cop>0?` · costo $${q1(L.cost_cop)}`:"",L.min_alert>0?` · aviso en ${L.min_alert}`:""]})]}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsx("div",{style:{fontSize:22,fontWeight:900,color:L.disponible<=0?"var(--danger)":x?"var(--warning)":"var(--text, #111)"},children:q1(L.disponible)}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)"},children:"disponibles"})]})]}),L.disponible<=0&&e.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--danger)",marginTop:6},children:"Agotado: los pedidos nuevos no tendrÃan unidades para despachar."}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginTop:10},children:[e.jsx("button",{style:mp,onClick:()=>w(L,"entrada"),children:"+ Entrada"}),e.jsx("button",{style:Ps,onClick:()=>w(L,"conteo"),children:"Conteo fÃsico"}),e.jsx("button",{style:Ps,onClick:()=>w(L,"ajuste"),children:"Ajuste"}),e.jsx("button",{style:Ps,onClick:()=>M(L,"min_alert"),children:"Aviso"}),e.jsx("button",{style:Ps,onClick:()=>M(L,"cost_cop"),children:"Costo"}),e.jsx("button",{style:Ps,onClick:()=>V(L.id),children:v===L.id?"Ocultar historial":"Historial"}),e.jsx("button",{style:{...Ps,color:"var(--danger)"},onClick:()=>p(L),children:"Quitar"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:12,cursor:"pointer",marginTop:9,color:"var(--text-muted)"},children:[e.jsx("input",{type:"checkbox",checked:!!L.sold_out_auto,onChange:async z=>{const G=await fetch(`/api/inventory/items/${L.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({sold_out_auto:z.target.checked})}).then(B=>B.json()).catch(()=>null);G!=null&&G.ok?(C(),_(z.target.checked?"Al llegar a 0, la landing se marcará agotada â":"Marc
5ado automático apagado â")):(C(),_("No se pudo guardar, intenta de nuevo."))}}),"Marcar la landing como agotada cuando el disponible llegue a 0"]}),v===L.id&&e.jsxs("div",{style:{marginTop:10,borderTop:"1px solid var(--border, #eee)",paddingTop:8},children:[(S[L.id]||[]).length===0&&e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)"},children:"Sin movimientos manuales todavÃa."}),(S[L.id]||[]).map(z=>e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12,padding:"3px 0",color:"var(--text-muted)"},children:[e.jsxs("span",{style:{fontWeight:800,color:z.delta>=0?"var(--success)":"var(--danger)",minWidth:40},children:[z.delta>=0?"+":"",z.delta]}),e.jsx("span",{style:{minWidth:60},children:z.reason}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:z.note}),e.jsx("span",{children:String(z.created_at).slice(0,16).replace("T"," ")})]},z.id))]})]},L.id)}),i&&t.length>0&&n.length>0&&e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("select",{style:{...ou,flex:"1 1 200px"},value:c,onChange:L=>g(L.target.value),children:[e.jsx("option",{value:"",children:"Agregar otro productoâ¦"}),n.map(L=>e.jsx("option",{value:L.id,children:L.name},L.id))]}),e.jsx("input",{style:{...ou,flex:"0 1 140px"},type:"number",min:0,placeholder:"Unidades",value:f,onChange:L=>b(L.target.value)}),e.jsx("button",{style:mp,onClick:N,disabled:!c,children:"Agregar"})]})]})}const $A=String.raw` 6function lumyChatDeWhatsApp(h) { 7 h = String(h || '').trim(); 8 var m = /^https?:\/\/(?:www\.)?wa\.me\/([^?#]*)/i.exec(h); 9 if (m) { 10 var camino = m[1], fin = camino.length; 11 while (fin > 0 && camino.charCodeAt(fin - 1) === 47) fin--; 12 camino = camino.slice(0, fin); 13 if (!camino) return null; 14 var crudo = camino; try { crudo = decodeURIComponent(camino); } catch (e) {} 15 return { numero: /^\+?[\d\s().-]+$/.test(crudo) ? crudo.replace(/\D/g, '') : '', conRef: true }; 16 } 17 if (/^https?:\/\/(?:www\.)?wa\.link\/[\w-]+/i.test(h)) return { numero: '', conRef: false }; 18 if (/^https?:\/\/(?:api|web)\.whatsapp\.com\/message\//i.test(h)) return { numero: '', conRef: true }; 19 if (/^(?:https?:\/\/(?:api|web)\.whatsapp\.com\/|whatsapp:)/i.test(h)) { 20 var tel = ''; 21 try { tel = new URL(h).searchParams.get('phone') || ''; } catch (e) { 22 var q = /[?&]phone=([^&#]*)/i.exec(h); 23 if (q) { try { tel = decodeURIComponent(q[1].replace(/\+/g, ' ')); } catch (e2) { tel = q[1]; } } 24 } 25 var d = String(tel).replace(/\D/g, ''); 26 return d.length >= 7 ? { numero: d, conRef: true } : null; 27 } 28 return null; 29} 30function lumyConReferencia(h, ref) { 31 try { 32 if (!ref) return ''; 33 var u = new URL(String(h || '').trim()); 34 var t = u.searchParams.get('text') || ''; 35 if (/\(ref:\s*L[0-9a-z]{1,8}-/i.test(t)) return ''; 36 var nuevo = (t ? t + String.fromCharCode(10) + String.fromCharCode(10) : '') + '(ref: ' + ref + ')'; 37 var partes = [], puesto = false; 38 u.search.replace(/^\?/, '').split('&').forEach(function (p) { 39 if (!p) return; 40 var k = p.split('=')[0]; 41 try { k = decodeURIComponent(k.replace(/\+/g, ' ')); } catch (e) {} 42 if (k === 'text') { if (!puesto) { partes.push('text=' + encodeURIComponent(nuevo)); puesto = true; } return; } 43 partes.push(p); 44 }); 45 if (!puesto) partes.push('text=' + encodeURIComponent(nuevo)); 46 u.search = '?' + partes.join('&'); 47 return u.toString(); 48 } catch (e) { return ''; } 49} 50`;let hp=null;function IA(){return hp||(hp=new Function(`${$A}; return { lumyChatDeWhatsApp: lumyChatDeWhatsApp, lumyConReferencia: lumyConReferencia }`)()),hp}const TA=["conectado","otro_numero","sin_referencia","no_abre","sin_numero"];function EA(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const a=t,n=Object.keys(a);if(a.lumyPreview==="wa"){const o=n.length===3&&typeof a.huella=="string"&&/^[0-9a-f]{64}$/.test(a.huella);return!(n.length===2||o)||typeof a.estado!="string"||!TA.includes(a.estado)?null:{tipo:"wa",estado:a.estado,huella:o?String(a.huella):""}}if(a.lumyPreview==="contenido"){const o=n.length===6&&typeof a.datos=="string"&&/^(?:[0-9a-f]{64})?$/.test(a.datos);if(!(n.length===5||o)||typeof a.huella!="string"||!/^[0-9a-f]{64}$/.test(a.huella)||typeof a.texto!="string"||a.texto.length>2e4||typeof a.parcial!="boolean"||!Array.isArray(a.imagenes)||a.imagenes.length>50)return null;const i=[];for(const s of a.imagenes){const u=s;if(!u||typeof u!="object"||typeof u.src!="string"||typeof u.alt!="string"||u.src.length>500||u.alt.length>200||!/^https?:/i.test(u.src))return null;i.push({src:u.src,alt:u.alt})}return{tipo:"contenido",huella:a.huella,texto:a.texto,imagenes:i,parcial:a.parcial,datos:o?String(a.datos):""}}return null}const jv={conectado:"Este botón llega al agente con los datos de esta página.",agente_apagado:"Este botón llega a tu WhatsApp conectado a Lumy, pero tu agente está apagado: enciéndelo para que conteste solo.",otro_numero:"Este enlace va a un número que no está conectado a Lumy. El agente no recibe ese chat.",sin_referencia:"Los enlaces wa.link llegan sin saber de qué página vienen. Usa wa.me con tu número o ponle data-lumy-whatsapp al bot
50ón.",no_abre:"Este botón abre WhatsApp cambiando la dirección de la página y asà no funciona aquÃ. Cambia esa lÃnea por lumyWhatsApp('tu mensaje').",sin_js:"En lumycol.com este botón no hace nada porque usa tu programa. Ponle data-lumy-whatsapp.",sin_numero:"Tu botón de WhatsApp no tiene a qué número ir. Escribe un enlace wa.me con tu número o pon tu número en el botón de WhatsApp de la página.",ref_escrita:"Tu enlace ya trae (ref: â¦) escrito. Bórralo: Lumy pone el suyo."},Av="Este botón abre WhatsApp cambiando la dirección de la página: asà el chat no llega con los datos de esta página ni cuenta como contacto. Cambia esa lÃnea por lumyWhatsApp('tu mensaje').",ag="Este enlace no dice a qué número va y el chat llega sin saber de qué página viene. Usa wa.me con tu número o ponle data-lumy-whatsapp al botón.",Jd=t=>String(t??"").replace(/\D/g,""),zA=(t,a)=>t.length>=8&&a.length>=8&&t.slice(-10)===a.slice(-10),RA=8e3;function NA(t){const a=[];let n=1;for(;n<t.length&&/[A-Za-z0-9-]/.test(t[n]);)n++;const o=t.length;for(;n<o;){for(;n<o&&/[\s/]/.test(t[n]);)n++;if(n>=o||t[n]===">")break;const i=n;for(;n<o&&!/[\s=>/]/.test(t[n]);)n++;const s=t.slice(i,n).toLowerCase();for(;n<o&&/\s/.test(t[n]);)n++;let u="";if(t[n]==="="){for(n++;n<o&&/\s/.test(t[n]);)n++;const m=t[n];if(m==='"'||m==="'"){const c=t.indexOf(m,n+1);u=t.slice(n+1,c<0?o:c),n=c<0?o:c+1}else{const c=n;for(;n<o&&!/[\s>]/.test(t[n]);)n++;u=t.slice(c,n)}}s&&a.push({nombre:s,valor:u,desde:i}),s||n++}return a}function Yu(t,a){const n=String(t||""),o={avisos:[],resumen:{total:0,llegan:0,noLlegan:0,conocido:Array.isArray(a.conectados)}};if(!n.trim())return o;const i=n.toLowerCase();if(!i.includes("wa.me")&&!i.includes("wa.link")&&!i.includes("whatsapp"))return o;let s;try{s=IA().lumyChatDeWhatsApp}catch{return o}const u=Array.isArray(a.conectados),m=(a.conectados||[]).map(Jd).filter(z=>z.length>=8),c=z=>z.length>=8&&m.some(G=>zA(z,G)||G.endsWith(z)),g=Jd(a.numeroDelBoton),f=a.agenteEncendido===!1,b=a.tipo==="pagina"&&!a.dominioPropio,v=[0];for(let z=0;z<n.length;z++)n.charCodeAt(z)===10&&v.push(z+1);const j=z=>{let G=0,B=v.length-1;for(;G<B;){const U=G+B+1>>1;v[U]<=z?G=U:B=U-1}return G+1},S=[],$=new Set;let C=0,_=0;const N=(z,G,B=jv[G])=>{const U=j(z),ne=`${U}|${G}|${B}`;$.has(ne)||($.add(ne),S.push({linea:U,estado:G,texto:B}))},w=(z,G,B)=>{C++,G==="conectado"&&_++,G&&N(z,G,B)},M=z=>u?c(z)?f?"agente_apagado":"conectado":"otro_numero":null,p=[],V=[];{const z=new Int32Array(n.length+1);z[n.length]=-1;for(let B=n.length-1;B>=0;B--)z[B]=n.charCodeAt(B)===62?B:z[B+1];let G=0;for(;G<n.length;){const B=n.indexOf("<",G);if(B<0)break;if(n.startsWith("<!--",B)){const ce=n.indexOf("-->",B+4);G=ce<0?n.length:ce+3;continue}const U=n.charAt(B+1);if(!/[A-Za-z]/.test(U)){G=B+1;continue}const ne=z[B+1];if(ne<0)break;if(ne-B>RA){G=B+1;continue}const Q=n.slice(B,ne+1),de=(/^<([A-Za-z][A-Za-z0-9-]*)/.exec(Q)||["",""])[1].toLowerCase(),pe=NA(Q);p.push({pos:B,nombre:de,attrs:pe});for(const ce of pe)/^on[a-z]{3,}$/.test(ce.nombre)&&ce.valor&&V.push({pos:B+ce.desde,texto:ce.valor});if(de==="script"||de==="style"){const ce=i.indexOf(`</${de}`,ne+1),ve=ce<0?n.length:ce;de==="script"&&V.push({pos:ne+1,texto:n.slice(ne+1,ve)}),G=ve+1;continue}G=ne+1}}const L=[];for(const z of p){if(z.nombre!=="a")continue;const G=z.attrs.find(U=>U.nombre==="href"),B=G?s(G.valor.replace(/&/gi,"&")):null;B&&B.numero&&L.push(Jd(B.numero))}const x=()=>g.length>=8?g:L.find(c)||"";for(const z of p){const G=z.nombre==="a"?z.attrs.find(de=>de.nombre==="href"):void 0,B=G?G.valor.replace(/&/gi,"&"):"",U=G?s(B):null;if(z.attrs.some(de=>de.nombre==="data-lumy-whatsapp")&&!U){const de=x();w(z.pos,de?M(de):u?"sin_numero":null);continue}if(!U)continue;let Q="";try{Q=new URL(B).searchParams.get("text")||""}catch{Q=""}if(/\(ref:/i.test(Q)&&N(z.pos,"ref_escrita"),!U.numero){w(z.pos,"sin_referencia",U.conRef?ag:void 0);continue}w(z.pos,M(Jd(U.numero)))}for(const z of V){const G=z.texto,B=G.toLowerCase();if(B.includes("wa.me")||B.includes("wa.link")||B.includes("whatsapp")){const de=/\blocation(?:\.href)?\s*=(?!=)|\blocation\.(?:assign|replace)\s*\(/g;let pe;const ce=new Set;for(;pe=de.exec(G);){const ge=B.slice(pe.index,pe.index+240),Te=ge.search(/[;\n]/),ie=Te<0?ge:ge.slice(0,Te);
50if(/wa\.me|wa\.link|whatsapp/.test(ie)){if(ce.add(pe.index),b){w(z.pos+pe.index,"sin_js");continue}w(z.pos+pe.index,"no_abre",a.tipo==="pagina"?Av:void 0)}}let ve=0;for(;ve<G.length;){let ge=ve;for(;ge<G.length&&G[ge]!=='"'&&G[ge]!=="'"&&G[ge]!=="`";)ge++;if(ge>=G.length)break;const Te=G[ge],ie=G.indexOf(Te,ge+1);if(ie<0)break;const fe=G.slice(ge+1,Math.min(ie,ge+1+500));if(ve=ie+1,!/^(?:https?:\/\/(?:www\.)?wa\.(?:me|link)\/|https?:\/\/(?:api|web)\.whatsapp\.com\/|whatsapp:\/\/)/i.test(fe))continue;const Be=B.slice(Math.max(0,ge-60),ge);if(/location(?:\.href)?\s*=\s*$|location\.(?:assign|replace)\s*\(\s*$/.test(Be))continue;const We=s(fe);if(We){if(b){w(z.pos+ge,"sin_js");continue}if(!We.numero){w(z.pos+ge,"sin_referencia",We.conRef?ag:void 0);continue}w(z.pos+ge,M(Jd(We.numero)))}}}const ne=/\blumyWhatsApp\s*\(/g;let Q;for(;Q=ne.exec(G);){if(b){w(z.pos+Q.index,"sin_js");continue}const de=x();w(z.pos+Q.index,de?M(de):u?"sin_numero":null)}}return S.sort((z,G)=>z.linea-G.linea),{avisos:S,resumen:{total:C,llegan:_,noLlegan:C-_,conocido:u}}}function sc(t){if(!t.total||t.conocido===!1)return"";const a=t.total===1?"1 botón de WhatsApp":`${t.total} botones de WhatsApp`;return t.llegan===t.total?t.total===1?`En tu diseño hay ${a} y llega al agente.`:`En tu diseño hay ${a} y todos llegan al agente.`:t.llegan?`En tu diseño hay ${a}: ${t.llegan} ${t.llegan===1?"llega":"llegan"} al agente, ${t.noLlegan} no.`:t.total===1?`En tu diseño hay ${a} y no llega al agente.`:`En tu diseño hay ${a} y ninguno llega al agente.`}const Ql=t=>String(t??"").replace(/\D/g,"");function LA(t,a){const n=Ql(t),o=Ql(a);return n.length<8||o.length<8?!1:n.endsWith(o)||o.endsWith(n)}function PA({activo:t,numero:a,onActivo:n,onNumero:o,disenos:i}){const[s,u]=h.useState(null),[m,c]=h.useState(!1);h.useEffect(()=>{let S=!0;return fetch("/api/whatsapp/seller/status").then($=>$.json()).then($=>{var _;if(!S)return;c(($==null?void 0:$.ok)===!0);const C=(Array.isArray($==null?void 0:$.numeros)?$.numeros:[]).filter(N=>(N==null?void 0:N.status)==="connected"&&Ql(N==null?void 0:N.display).length>=8);u({numeros:C,agente:!!((_=$==null?void 0:$.capabilities)!=null&&_.agent_enabled)})}).catch(()=>{S&&u({numeros:[],agente:!1})}),()=>{S=!1}},[]);const g=(s==null?void 0:s.numeros)||[],f=g.find(S=>LA(S.display,a))||null,b=h.useMemo(()=>{const S=(i||[]).filter(C=>String(C||"").trim());if(!S.length)return"";const $={total:0,llegan:0,noLlegan:0};for(const C of S){const _=Yu(C,{tipo:"bloque",numeroDelBoton:a,conectados:g.map(N=>Ql(N.display)),agenteEncendido:s?s.agente:void 0});$.total+=_.resumen.total,$.llegan+=_.resumen.llegan,$.noLlegan+=_.resumen.noLlegan}return sc($)},[JSON.stringify(i||[]),a,JSON.stringify(g.map(S=>S.display)),s==null?void 0:s.agente]),v={display:"flex",alignItems:"flex-start",gap:9,cursor:"pointer",padding:"10px 12px",border:"1px solid var(--border, #e6e8ee)",borderRadius:12,background:t?"rgba(124,58,237,.05)":"transparent",marginTop:12},j={fontSize:12,lineHeight:1.45,borderRadius:10,padding:"8px 11px",marginTop:8,background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",color:"var(--notice-warning-text)"};return e.jsxs("div",{children:[!!b&&s&&m&&e.jsx("div",{role:"status",style:{fontSize:12,lineHeight:1.45,marginTop:10,color:"var(--text-secondary, #64748b)"},children:b}),e.jsxs("label",{style:v,children:[e.jsx("input",{type:"checkbox",style:{marginTop:2},checked:t,onChange:S=>n(S.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:700,display:"block"},children:"Que responda el agente de IA"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"El chat llega al agente sabiendo que viene de esta página y de qué producto."})]})]}),t&&s&&(g.length===0?e.jsxs("div",{role:"status",style:j,children:["Conecta tu WhatsApp en ",e.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new Event("ecomdrop:open-connections")),style:{border:0,background:"none",padding:0,color:"inherit",fontWeight:700,textDecoration:"underline",cursor:"pointer",font:"inherit"},children:"Conexiones"})," para que el agente reciba estos chats."]}):e.jsxs("div",{style:{marginTop:10},children:[e.jsx("label",{style:{fontSize:12.5,fontWeight:700,display:"block",marginBottom:5},children:"Número que atiende el agente"}),e.jsxs("select",{value:(f==null?void 0:f.phone_number_id)||"",onChange:S=>{const $=g.find(C=>C.phone_number_id===S.target.value);$&&o(Ql($.display))},style:{width:"100%",fontSize:16,padding:"9px 10px",borderRadius:10,border:"1px solid var(--border)",background:"var(--input-bg, #fff)",color:"var(--text)"},children:[!f&&e.jsx("option",{value:"",children:"Elige uno de tus números conectados"}),g.map(S=>e.jsxs("option",{value:S.phone_number_id,children:[S.display,S.label&&S.label!=="Principal"?` · ${S.label}`:""]},S.phone_number_id))]}),!f&&Ql(a).length>=8&&e.jsx("div",{role:"status",style:j,children:"El número de arriba no está conectado a Lumy: el agente no recibe esos chats. Elige uno de tus números conectados."}),!s.agente&&e.jsxs("div",{role:"status",style:j,children:["Tu agente está apagado. Enciéndelo en ",e.jsx("a",{href:"/whatsapp/agente",target:"_blank",rel:"noopener",style:{color:"inherit",fontWeight:700},children:"WhatsApp · Agente IA"})," para que conteste."]})]}))]})}function DA(){return fetch("/api/whatsapp/seller/status").then(async t=>{var n;const a=await t.json().catch(()=>null);return!t.ok||!a||a.ok!==!0?null:{conectados:(Array.isArray(a.numeros)?a.numeros:[]).filter(o=>(o==null?void 0:o.status)==="connected").map(o=>String((o==null?void 0:o.display)||"").replace(/\D/g,"")).filter(o=>o.length>=8),agente:!!((n=a==null?void 0:a.capabilities)!=null&&n.agent_enabled)}}).catch(()=>null)}function Fg(){const[t,a]=h.useState(null);return h.useEffect(()=>{let n=!0;return DA().then(o=>{n&&a(o)}),()=>{n=!1}},[]),t}async function BA(t){const a=new TextEncoder().encode(String(t??"")),n=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}function Sv(t){const[a,n]=h.useState("");return h.useEffect(()=>{let o=!0;try{BA(t).then(i=>{o&&n(i)}).catch(()=>{o&&n("")})}catch{n("")}return()=>{o=!1}},[t]),a}function wv(t){const[a,n]=h.useState({}),[o,i]=h.useState({}),s=h.useRef(t);return s.current=t,h.useEffect(()=>{const u=m=>{const c=s.current();if(!c||!c.contentWindow||m.source!==c.contentWindow)return;const g=EA(m.data);g&&(g.tipo==="wa"?n(f=>({...f,[g.huella||"pagina"]:{estado:g.estado,at:Date.now()}})):i(f=>{const b={...f,[g.huella]:{texto:g.texto,imagenes:g.imagenes,parcial:g.parcial,at:Date.now(),datos:g.datos}},v=Object.keys(b);if(v.length>12)for(const j of v.slice(0,v.length-12))delete b[j];return b}))};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[]),{pruebas:a,capturas:o}}const Og={marginTop:8,border:"1px solid var(--border, #e8eaf0)",borderRadius:11,background:"var(--card-bg, #fff)",padding:"9px 11px",fontSize:12,lineHeight:1.45},Hg={fontSize:11,fontWeight:800,letterSpacing:".04em",textTransform:"uppercase",color:"var(--text-muted)",marginBottom:5},kv=t=>t==="conectado"?"var(--notice-success-text, #047857)":"var(--notice-warning-text, #92400E)";function M1({html:t,tipo:a,numeroDelBoton:n,dominioPropio:o}){const i=Fg(),s=h.useMemo(()=>Yu(t,{tipo:a,numeroDelBoton:n,conectados:i?i.conectados:null,dominioPropio:o,agenteEncen
50dido:i?i.agente:void 0}),[t,a,n,o,i]);return!s.avisos.length&&!sc(s.resumen)?null:e.jsxs("div",{style:Og,"data-lumy-diagnostico":"whatsapp",children:[e.jsx("div",{style:Hg,children:"WhatsApp en tu diseño"}),!!sc(s.resumen)&&e.jsx("div",{style:{fontWeight:700,color:"var(--text, #111)",marginBottom:s.avisos.length?5:0},children:sc(s.resumen)}),s.avisos.map((u,m)=>e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",padding:"3px 0"},children:[e.jsx("span",{style:{flex:"none",fontFamily:"ui-monospace, Menlo, monospace",fontSize:11,fontWeight:800,color:kv(u.estado)},children:u.linea}),e.jsx("span",{style:{color:u.estado==="conectado"?"var(--text-secondary, #64748b)":"var(--text, #111)"},children:u.texto})]},m))]})}function ng({pruebas:t,tipo:a,html:n,agenteEncendido:o}){const i=Sv(n??""),s=n===void 0?"pagina":i,u=s&&t[s]||null,m=u?u.estado==="conectado"&&o===!1?"agente_apagado":u.estado:null,c=m?m==="no_abre"&&a==="pagina"?Av:m==="sin_referencia"?ag:jv[m]:"Toca un botón de WhatsApp en la vista previa y aquà te digo si le llega al agente.";return e.jsxs("div",{style:Og,"data-lumy-prueba-en-vivo":m||"",children:[e.jsx("div",{style:Hg,children:"Prueba en la vista previa"}),e.jsx("div",{style:{color:m?kv(m):"var(--text-secondary, #64748b)",fontWeight:m?700:500},children:c})]})}function og({landingId:t,parte:a,html:n,capturas:o}){const i=Sv(n),s=i?o[i]:void 0,[u,m]=h.useState(null),[c,g]=h.useState(!1),[f,b]=h.useState(null),[v,j]=h.useState(!1);if(h.useEffect(()=>{if(!(t>0))return;let C=!0;return fetch(`/api/landing/${t}/contenido-renderizado`).then(_=>_.json()).then(_=>{if(!C)return;const N=(Array.isArray(_==null?void 0:_.partes)?_.partes:[]).find(w=>(w==null?void 0:w.bloque)===a);m(N?{estado:String(N.estado||""),capturadoAt:String(N.capturadoAt||"")}:null)}).catch(()=>{}),()=>{C=!1}},[t,a]),h.useEffect(()=>{b(null),j(!1)},[i]),!(t>0)||!String(n||"").trim())return null;const S=async()=>{if(!(!s||!i||c)){g(!0),b(null);try{const C=await fetch(`/api/landing/${t}/contenido-renderizado`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({parte:a,huella:i,texto:s.texto,imagenes:s.imagenes,parcial:s.parcial,...s.datos?{datos:s.datos}:{}})}),_=await C.json().catch(()=>({}));C.ok&&(_!=null&&_.ok)?(b({ok:!0,texto:"Listo: el agente ya lee este texto de tu diseño."}),m({estado:String(_.estado||"vigente"),capturadoAt:new Date().toISOString()})):b({ok:!1,texto:String((_==null?void 0:_.message)||"No pude guardarlo. Vuelve a intentarlo.")})}catch{b({ok:!1,texto:"Sin conexión: no pude guardarlo. Vuelve a intentarlo."})}finally{g(!1)}}},$=s?v?s.texto:s.texto.slice(0,600):"";return e.jsxs("div",{style:Og,"data-lumy-lo-que-lee":a,children:[e.jsx("div",{style:Hg,children:"Esto es lo que el agente va a leer de tu diseño"}),(u==null?void 0:u.estado)==="desactualizado"&&!f&&e.jsx("div",{style:{color:"var(--notice-warning-text, #92400E)",marginBottom:5},children:"Cambiaste tu diseño después de guardar lo que lee el agente. RevÃsalo aquà y vuelve a guardarlo."}),s?e.jsxs(e.Fragment,{children:[s.texto?e.jsxs("div",{style:{whiteSpace:"pre-wrap",maxHeight:v?260:120,overflowY:"auto",background:"var(--bg-tertiary, #f6f8fc)",borderRadius:8,padding:"7px 9px",color:"var(--text, #111)"},children:[$,!v&&s.texto.length>600?"â¦":""]}):e.jsx("div",{style:{color:"var(--text-secondary, #64748b)"},children:"Tu diseño no muestra texto que el agente pueda leer."}),s.texto.length>600&&e.jsx("button",{type:"button",onClick:()=>j(!v),style:{border:0,background:"none",padding:"4px 0 0",color:"#0866ff",fontWeight:700,fontSize:12,cursor:"pointer",fontFamily:"inherit"},children:v?"Ver menos":"Ver todo"}),!!s.imagenes.length&&e.jsxs("div",{style:{color:"var(--text-secondary, #64748b)",marginTop:5},children:[s.imagenes.length===1?"Y 1 foto":`Y ${s.imagenes.length} fotos`,s.imagenes.some(C=>C.alt)?", con su descripción.":"."]}),s.parcial&&e.jsx("div",{style:{color:"var(--notice-warning-text, #92400E)",marginTop:5},children:"Algo de tu diseño no cargó en la vista previa, asà que puede faltar texto."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",marginTop:8},children:[e.jsx("button",{type:"button",onClick:()=>{S()},disabled:c||!s.texto,style:{border:0,background:"#0866ff",color:"#fff",borderRadius:9,padding:"7px 12px",fontSize:12,fontWeight:800,cursor:c?"wait":"pointer",opacity:c||!s.texto?.6:1,fontFamily:"inherit"},children:c?"Guardandoâ¦":"Guardar para el agente"}),e.jsx("span",{style:{color:"var(--text-muted)",fontSize:11.5},children:"El agente lo usa como información de tu página."})]})]}):e.jsx("div",{style:{color:"var(--text-secondary, #64748b)"},children:"Cuando la vista previa termine de mostrar tu diseño, aquà verás su texto. Si no aparece, baja en la vista previa hasta tu diseño."}),f&&e.jsx("div",{role:"status",style:{marginTop:6,fontWeight:700,color:f.ok?"var(--notice-success-text, #047857)":"var(--notice-warning-text, #92400E)"},children:f.texto}),!f&&u&&u.estado!=="desactualizado"&&e.jsx("div",{style:{color:"var(--text-muted)",marginTop:6,fontSize:11.5},children:"Ya guardaste lo que lee el agente de esta parte."})]})}const WA=[{re:/\b(gana|ganar[áa]s?|genera|factura)\s+(hasta\s+)?\$?\s?\d/gi,motivo:"Prometer una cifra de ganancia es de lo que más rechazos genera.",sugerencia:"Di qué hace el producto, no cuánto va a ganar quien lo compre.",grave:!0},{re:/\b(resultados?|ingresos?|ganancias?)\s+(garantizad[oa]s?|asegurad[oa]s?|100\s?%)/gi,motivo:"Garantizar resultados está prohibido de forma explÃcita.",sugerencia:"Cambia la garantÃa de resultado por la garantÃa de devolución, si la ofreces.",grave:!0},{re:/(?:^|[\s.,;¡!¿?])(h[áa]zte\s+ric[oa]|dinero\s+f[áa]cil|libertad\s+financiera|sin\s+esfuerzo)/gi,motivo:'Entra en "oportunidades engañosas", que es el motivo por el que ya nos rechazaron.',sugerencia:"Explica cómo funciona en vez de prometer el resultado.",grave:!0},{re:/\b(baja|pierde|elimina|quema)\s+(hasta\s+)?\d+\s*(kilos?|kg|libras?|tallas?|cent[Ãi]metros?|cm)\b/gi,motivo:"Prometer una cantidad concreta de pérdida de peso o tallas está prohibido.",sugerencia:"Describe la prenda y su compresión, sin prometer cuánto baja.",grave:!0},{re:/(?:^|[\s.,;¡!¿?])(cura|curar|sana|sanar|elimina|eliminar)\s+(la|el|las|los)\s+(celulitis|acn[ée]|arrugas?|grasa|dolor
50(es)?|hongos?|v[áa]rices|estr[Ãi]as|manchas|caspa|ansiedad|insomnio|diabetes|c[áa]ncer|artritis|migra[ñn]as?|gastritis|colesterol)/gi,motivo:"Atribuirle a un producto que cura algo es una promesa médica prohibida.",sugerencia:"Di para qué sirve, sin decir que cura.",grave:!0},{re:/\b(antes\s*y\s*despu[ée]s|antes\/despu[ée]s)\b/gi,motivo:"Las comparaciones antes y después están restringidas en productos de cuerpo y salud.",sugerencia:"Muestra el producto puesto, sin comparar cuerpos.",grave:!0},{re:/(?:^|[\s.,;¡!¿?])(el|la)\s+(mejor|[úu]nic[oa])\s+(\w+\s+)?(del\s+mundo|del\s+mercado|de\s+colombia|que\s+existe)/gi,motivo:"Los superlativos absolutos exigen prueba; sin ella, se rechaza.",sugerencia:'Cambia "el mejor del mercado" por lo que de verdad lo distingue.',grave:!1},{re:/\bn[úu]mero\s*1\b|\b#\s?1\b/gi,motivo:"Decirse número 1 sin una fuente verificable se considera engañoso.",sugerencia:"Si tienes el dato, cita la fuente; si no, quÃtalo.",grave:!1},{re:/(?:^|[\s.,;¡!¿?])[úu]ltim[ao]s?\s+\d+\s+(unidades?|cupos?)/gi,motivo:"La escasez sà se permite, pero solo si es REAL y comprobable.",sugerencia:"Si el número es real, déjalo. Si es adorno, quÃtalo: es de lo que más se revisa.",grave:!1}];function qA(t){const a=String(t||"");if(a.length<12)return[];const n=[],o=new Set;for(const i of WA){i.re.lastIndex=0;let s;for(;(s=i.re.exec(a))!==null;){const u=s[0].trim().slice(0,70),m=u.toLowerCase();if(!o.has(m)&&(o.add(m),n.push({frase:u,motivo:i.motivo,sugerencia:i.sugerencia,grave:i.grave}),n.length>=6))return n.sort((c,g)=>Number(g.grave)-Number(c.grave))}}return n.sort((i,s)=>Number(s.grave)-Number(i.grave))}function MA(t){var i,s,u;const a=[],n=m=>{typeof m=="string"&&m.trim()&&a.push(m)},o=(t==null?void 0:t.product)||{};n(o.name),n(o.description),n(t==null?void 0:t.headline),n(t==null?void 0:t.subheadline),n((i=t==null?void 0:t.form)==null?void 0:i.cta_text),n((s=t==null?void 0:t.offer_box)==null?void 0:s.text),n((u=t==null?void 0:t.scarcity)==null?void 0:u.text);for(const m of Array.isArray(t==null?void 0:t.content_blocks)?t.content_blocks:[])n(m==null?void 0:m.text),n(m==null?void 0:m.title),n(m==null?void 0:m.caption);for(const m of Array.isArray(t==null?void 0:t.reviews)?t.reviews:[])n(m==null?void 0:m.text);for(const m of Array.isArray(t==null?void 0:t.faq)?t.faq:[])n(m==null?void 0:m.q),n(m==null?void 0:m.a);for(const m of Array.isArray(t==null?void 0:t.bullets)?t.bullets:[])n(typeof m=="string"?m:m==null?void 0:m.text);return a.join(` 51`)}function FA(t){const a=Math.max(0,Number(t.total)||0),n=Math.max(0,Number(t.cargados)||0),o=Math.max(0,Number(t.visibles)||0),i=t.filtrando?o:Math.max(a,n),s=a>n,u=c=>c.toLocaleString("es-CO"),m=s?t.filtrando?`Buscando entre los ${u(n)} más recientes de ${u(a)}.`:`Mostrando ${u(n)} de ${u(a)}, los más recientes.`:null;return{numero:i,nota:m}}const F1=6,OA=3.1,HA=new Set(["name","lastname","phone","department","city","address"]),GA={email:"En contraentrega no lo necesitas para nada: ni para cobrar ni para despachar.",phone2:"Es opcional y aun asà frena. Si el primero no contesta, el agente lo persigue por WhatsApp.",referencia:"Va después de la dirección, cuando ya vienen cansados. Déjalo claramente opcional o quÃtalo.",documento:"Pedir la cédula antes de comprar asusta. Si la necesitas, pÃdela después por WhatsApp.",cedula:"Pedir la cédula antes de comprar asusta. Si la necesitas, pÃdela después por WhatsApp.",codigo_postal:"En Colombia casi nadie se lo sabe, y la transportadora no lo usa.",empresa:"Salvo que vendas al por mayor, no lo vas a usar."},VA=new Set(["note","nota","divider","separator","heading","title"]);function UA(t){const a=(Array.isArray(t)?t:[]).filter(m=>{const c=String((m==null?void 0:m.type)||"").toLowerCase();return m&&String(m.key||"").trim()&&!VA.has(c)}),n=a.length,o=Math.max(0,n-F1),i=Math.round(o*OA*10)/10,s=[];for(const m of a){const c=String(m.key).trim().toLowerCase();if(HA.has(c))continue;const g=GA[c];g&&s.push({key:c,nombre:String(m.label||c),porque:g})}let u="";if(!n)u="";else if(!o)u=`Tu formulario tiene ${n} ${n===1?"campo":"campos"}. Está en el rango bueno: por debajo de ${F1} casi nadie se cae por el formulario.`;else{const m=`Los ${o} de más te cuestan alrededor del ${i}% de los pedidos`;u=s.length?`Tu formulario tiene ${n} campos. ${m}. ${s.length===1?"Este es prescindible":`Estos ${s.length} son prescindibles`} en contraentrega.`:`Tu formulario tiene ${n} campos. ${m}, pero todos parecen necesarios para despachar.`}return{cuantos:n,deMas:o,caidaPct:i,sugerencias:s,resumen:u}}const O1=["name","product","total","address","city","carrier","guide","novelty"],QA=[[/gu[iÃ]a|tracking|rastreo/i,"guide"],[/transportadora|mensajer|con\s*$|env[iÃ]a por/i,"carrier"],[/novedad|inconvenient/i,"novelty"],[/direcci[oó]n|entregar en/i,"address"],[/ciudad|municipio/i,"city"],[/total|valor|precio|pagar|\$\s*$/i,"total"],[/pedido de|producto|compra de/i,"product"],[/hola|estimad|se[ñn]or|buenas/i,"name"]];function KA(t){const a=[...String(t||"").matchAll(/\{\{\s*(\d+)\s*\}\}/g)].map(n=>Number(n[1])).filter(n=>Number.isFinite(n));return a.length?Math.max(...a):0}function YA(t,a,n,o){var c;if(n<=0)return[];const i=o==null?void 0:o[t];if(Array.isArray(i)&&i.length===n)return i.slice(0,n);const s=String(a||""),u=new Set,m=[];for(let g=1;g<=n;g++){const f=s.search(new RegExp(`\\{\\{\\s*${g}\\s*\\}\\}`)),b=f>0?s.slice(Math.max(0,f-40),f):"",v=((c=QA.find(([j])=>j.test(b)))==null?void 0:c[1])||"";v&&!u.has(v)?(u.add(v),m.push(v)):m.push("")}return m.map((g,f)=>{if(g)return g;const b=O1.find(v=>!u.has(v))||O1[f]||"name";return u.add(b),b})}const rg=[{k:"no_contesta",l:"No contesta",c:"#b45309"},{k:"numero_errado",l:"Número errado",c:"#dc2626"},{k:"confirma",l:"Confirma",c:"#16a34a"},{k:"aplaza",l:"Aplaza",c:"#6366f1"},{k:"cancela",l:"Quiere cancelar",c:"#dc2626"}],JA=Object.fromEntries(rg.map(t=>[t.k,t.l])),H1={background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:14,padding:"12px 13px"},G1={fontSize:11,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em",marginBottom:8},V1=t=>
51"$"+(Number(t)||0).toLocaleString("es-CO"),ZA=t=>{try{return new Date(String(t).replace(" ","T")+"Z").toLocaleString("es-CO",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}catch{return String(t).slice(0,16)}},XA=t=>{try{return new Date(String(t).replace(" ","T")+"Z").toLocaleDateString("es-CO",{year:"2-digit",month:"2-digit",day:"2-digit"})}catch{return String(t).slice(0,10)}},eS={nuevo:"Nuevo",contactado:"Contactado",confirmado:"Confirmado",despachado:"Despachado",en_camino:"En camino",en_transito:"En tránsito",entregado:"Entregado",novedad:"Novedad",cancelado:"Cancelado",abandonado:"Abandonado",lead_wa:"Lead WA",pago_pendiente:"Pago pendiente",devuelto:"Devuelto",rechazado:"Rechazado",pendiente_confirmar:"Pendiente confirmar",reclamar_oficina:"Reclamar en oficina"},U1=new Map,Q1=new Map,Cv=3e4;function tS(t){const a=U1.get(t);if(a&&Date.now()-a.t<Cv)return a.p;const n=fetch(`/api/crm/notes?submission_id=${t}`).then(o=>o.json()).then(o=>o!=null&&o.ok?o.notes||[]:[]);return U1.set(t,{t:Date.now(),p:n}),n}function aS(t){const a=Q1.get(t);if(a&&Date.now()-a.t<Cv)return a.p;const n=fetch(`/api/crm/customer?phone=${encodeURIComponent(t)}`).then(o=>o.json()).then(o=>o!=null&&o.ok?{orders:o.orders||[],resumen:o.resumen||null}:{orders:[],resumen:null});return Q1.set(t,{t:Date.now(),p:n}),n}function K1({submissionId:t,phone:a,parte:n}){const[o,i]=h.useState([]),[s,u]=h.useState(!1),[m,c]=h.useState(""),[g,f]=h.useState(null),[b,v]=h.useState(!1);h.useEffect(()=>{i([]),f(null),v(!1),t&&(tS(t).then(C=>i(C)).catch(()=>{}),a&&aS(a).then(C=>f(C)).catch(()=>{}))},[t,a]);const j=async(C,_="")=>{if(s)return;u(!0);const N=await fetch("/api/crm/notes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({submission_id:t,kind:C,note:_})}).then(w=>w.json()).catch(()=>null);u(!1),N!=null&&N.ok&&(i(N.notes||[]),c(""))},S=g==null?void 0:g.resumen,$=!!S&&S.total>1;return e.jsxs(e.Fragment,{children:[n!=="historial"&&e.jsxs("div",{style:H1,children:[e.jsx("div",{style:G1,children:"Registrar llamada"}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:rg.map(C=>e.jsx("button",{disabled:s,onClick:()=>j(C.k),style:{padding:"6px 11px",borderRadius:999,border:`1.5px solid ${C.c}44`,background:`${C.c}12`,color:C.c,fontSize:12,fontWeight:800,cursor:"pointer"},children:C.l},C.k))}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("input",{value:m,onChange:C=>c(C.target.value),placeholder:"Nota libre (opcional)",maxLength:300,onKeyDown:C=>{C.key==="Enter"&&m.trim()&&j("nota",m.trim())},style:{flex:1,padding:"8px 10px",borderRadius:10,border:"1.5px solid var(--border, #dde)",fontSize:12.5,background:"var(--card-bg, #fff)",color:"inherit"}}),e.jsx("button",{disabled:s||!m.trim(),onClick:()=>j("nota",m.trim()),style:{padding:"8px 12px",borderRadius:10,border:0,background:"var(--accent, #0866FF)",color:"#fff",fontSize:12,fontWeight:800,cursor:"pointer",opacity:m.trim()?1:.5},children:"Guardar"})]}),o.length>0&&e.jsx("div",{style:{marginTop:9,borderTop:"1px solid var(--border, #eee)",paddingTop:7,display:"flex",flexDirection:"column",gap:4},children:o.slice(0,6).map(C=>{var _;return e.jsxs("div",{style:{display:"flex",gap:7,fontSize:12,color:"var(--text-muted)",alignItems:"baseline"},children:[e.jsx("span",{style:{fontWeight:800,color:((_=rg.find(N=>N.k===C.kind))==null?void 0:_.c)||"var(--text, #333)",whiteSpace:"nowrap"},children:JA[C.kind]||"Nota"}),C.note&&e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.note}),e.jsx("span",{style:{marginLeft:"auto",whiteSpace:"nowrap"},children:ZA(C.created_at)})]},C.id)})})]}),n!=="llamada"&&S&&S.total>0&&e.jsxs("div",{style:H1,children:[e.jsxs("div",{style:{...G1,marginBottom:6,display:"flex",alignItems:"center",gap:8},children:["Historial de este cliente",$&&S.entregados>0&&e.jsx("span",{style:{background:"rgba(22,163,74,.14)",color:"#16a34a",borderRadius:999,padding:"2px 9px",fontSize:10.5,fontWeight:800,textTransform:"none",letterSpacing:0},children:"Cliente recurrente"})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:12.5,flexWrap:"wrap"},children:[e.jsxs("span",{children:[e.jsx("b",{children:S.total})," pedido",S.total!==1?"s":""]}),e.jsxs("span",{style:{color:"#16a34a"},children:[e.jsx("b",{children:S.entregados})," entregado",S.entregados!==1?"s":""]}),S.cancelados>0&&e.jsxs("span",{style:{color:"#dc2626"},children:[e.jsx("b",{children:S.cancelados})," sin cerrar"]}),S.ltv_cop>0&&e.jsxs("span",{children:[e.jsx("b",{children:V1(S.ltv_cop)})," comprado"]})]}),g&&g.orders.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(C=>!C),style:{marginTop:7,padding:0,border:0,background:"none",color:"var(--accent, #0866FF)",fontSize:12,fontWeight:700,cursor:"pointer"},children:b?"Ocultar pedidos":`Ver los ${g.orders.length} pedidos`}),b&&e.jsx("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:4},children:g.orders.map(C=>e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12,color:"var(--text-muted)",alignItems:"baseline"},children:[e.jsx("span",{style:{whiteSpace:"nowrap"},children:XA(C.created_at)}),e.jsxs("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[C.landing_name||"Pedido",C.id===t?" (este)":""]}),e.jsx("span",{style:{fontWeight:700,color:C.crm_status==="entregado"?"#16a34a":["cancelado","abandonado"].includes(C.crm_status)?"#dc2626":"inherit",whiteSpace:"nowrap"},children:eS[C.crm_status]||C.crm_status}),e.jsx("span",{style:{whiteSpace:"nowrap"},children:V1(C.total_cop)})]},C.id))})]})]})]})}const ig={nombre:"name",apellido:"lastname",telefono:"phone",celular:"phone",correo:"email",email:"email",departamento:"department",estado:"department",provincia:"department",ciudad:"city",municipio:"city",direccion:"address",referencia:"referencia",barrio:"referencia",telefono2:"phone2",otro_telefono:"phone2",notas:"mensaje",mensaje:"mensaje",colonia:"colonia",distrito:"distrito",corregimiento:"corregimiento",parroquia:"parroquia",zona:"zona",codigo_postal:"codigo_postal",cp:"codigo_postal"},nS=t=>String(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),lc=t=>nS(t).split(/\s*\/\s*|\s+o\s+/).map(a=>
51a.trim().replace(/[^a-z_0-9]/g,"")).filter(Boolean),Y1=new Map;function ri(t){const a=String(t||"").toUpperCase(),n=Y1.get(a);if(n)return n;const o=wc(a),i={...ig};for(const s of lc((o==null?void 0:o.l1)||""))i[s]="department";for(const s of lc((o==null?void 0:o.l2)||""))i[s]="city";if(o!=null&&o.l3Key&&(o!=null&&o.l3))for(const s of lc(String(o.l3)))i[s]=String(o.l3Key);return o!=null&&o.docLabel&&(i.documento="documento"),Y1.set(a,i),i}function oS(t){const a=wc(String(t||"").toUpperCase());return a!=null&&a.docLabel?String(a.docLabel).replace(/\s*\(.*\)\s*$/,"").trim():""}const J1=[["name","nombre"],["lastname","apellido"],["phone","telefono"],["email","correo"],["documento","documento"],["department","departamento"],["city","ciudad"],["address","direccion"],["referencia","referencia"],["phone2","telefono2"],["mensaje","notas"]];function mc(t){const a=new Map;for(const[s,u]of Object.entries(ri(t)))a.has(u)||a.set(u,[]),a.get(u).push(s);const n=(s,u)=>{const m=a.get(s)||[],c=m.includes(u)?u:m[0]||u,g=m.filter(f=>f!==c);return g.length?`${c} (o ${g.join(", ")})`:c},o=new Set(J1.map(([s])=>s)),i=[...a.keys()].filter(s=>!o.has(s)).map(s=>n(s,s));return J1.filter(([s])=>a.has(s)).map(([s,u])=>n(s,u)).join(" · ")+(i.length?` · y de dirección, según el paÃs (van pegados a la dirección): ${i.join(", ")}`:"")}function _v(t,a){return Object.values(ri(a)).includes(t)}const rS=["region","comuna","canton","localidad","partido"];function iS(t,a,n=[]){const o=wc(a||""),i=new Set([...t].map(s=>String(s||"").toLowerCase()));return sS(a,n).filter(s=>!i.has(s.toLowerCase())).map(s=>s==="codigo_postal"?`${o.zipLabel} (<input data-lumy-dato="codigo_postal" required>)`:`${o.l3} (<input data-lumy-dato="${o.l3Key}" required>)`)}function sS(t,a=[]){const n=wc(t||""),o=new Set([...a].map(s=>String(s||"").toLowerCase())),i=[];return n!=null&&n.l3Req&&(n!=null&&n.l3Key)&&!o.has(String(n.l3Key).toLowerCase())&&i.push(String(n.l3Key)),n!=null&&n.zipLabel&&!o.has("codigo_postal")&&i.push("codigo_postal"),i}function lS(t,a){return`Esta página es de ${String(a||"").toUpperCase()} y no pide ${t.join(" ni ")}. Sin ese dato Lumy RECHAZA todos los pedidos con «Falta: ese campo»: nadie podrÃa comprar. Agrégalo, o pon la pieza <div data-lumy-campo="datos"></div> y Lumy pone los del paÃs solo. Asà no te deja publicar.`}function $v(){return Object.keys(eg).filter(t=>t!=="CO").map(t=>{const a=wc(t),n=[],o=[];return a!=null&&a.l3Key&&(a.l3Req?n:o).push(String(a.l3Key)),a!=null&&a.zipLabel&&n.push("codigo_postal"),{codigo:t,pais:ad(t).name,obligatorios:n,opcionales:o,nivel1:lc((a==null?void 0:a.l1)||""),nivel2:lc((a==null?void 0:a.l2)||""),documento:oS(t)}})}const Xr=t=>t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} y ${t[t.length-1]}`;function dS(t){const a=String(t||"CO").toUpperCase(),n=ad(a).name,o=$v().find(s=>s.codigo===a);if(!o)return`Esta página es de ${n}: no pide ningún dato de dirección más.`;const i=[`Esta página es de ${n}.`];return o.obligatorios.length&&i.push(`Además de los de siempre, ${n} pide OBLIGATORIO: ${Xr(o.obligatorios)} â sin eso, Lumy RECHAZA todos los pedidos y nadie puede comprar.`),o.opcionales.length&&i.push(`Opcional: ${Xr(o.opcionales)}.`),!o.obligatorios.length&&!o.opcionales.length&&i.push("No pide ningún dato de dirección más."),i.push(`Allá el departamento se escribe ${Xr(o.nivel1)} y la ciudad ${Xr(o.nivel2)}; Lumy entiende las dos formas.`),o.documento&&i.push(`Y si quieres pedir el documento del comprador (${o.documento}), como lo pide el formulario de Lumy, es opcional: <input data-lumy-dato="documento">.`),i.join(" ")}function cS(){const t=$v(),a=t.filter(u=>u.obligatorios.length).map(u=>`${u.pais} â ${Xr(u.obligatorios)}`),n=t.filter(u=>u.opcionales.length).map(u=>`${u.pais} â ${Xr(u.opcionales)}`),o=t.filter(u=>!u.obligatorios.length&&!u.opcionales.length).map(u=>u.pais),i=t.map(u=>`${u.pais}: ${Xr(u.nivel1)} / ${Xr(u.nivel2)}`),s=t.filter(u=>u.documento).map(u=>`${u.pais} (${u.documento})`);return`FUERA DE COLOMBIA cada paÃs pide sus propios datos de dirección. OBLIGATORIOS, y si falta uno Lumy RECHAZA todos los pedidos y nadie puede comprar: ${a.join(" · ")}. `+(n.length?`OPCIONALES: ${n.join(" · ")}. `:"")+(o.length?`${Xr(o)} no ${o.length>1?"piden":"pide"} ninguno más. `:"")+`Se escriben igual que los demás: <input data-lumy-dato="colonia" required>. El departamento y la ciudad se pueden escribir con la palabra de cada paÃs (departamento / ciudad): ${i.join(" · ")}. `+(s.length?`El documento del comprador, opcional, solo donde el formulario de Lumy lo pide: ${Xr(s)} â <input data-lumy-dato="documento">. `:"")+'Si prefieres no pensarlo, usa la pieza <div data-lumy-campo="datos"></div> y Lumy pone los del paÃs sola.'}const uS=["phone","address"],Pi=8;function pS(t,a){return`Tienes ${t} preguntas propias y Lumy guarda hasta ${Pi}: desde «${a}» no llegarÃan al pedido. Quita las que no necesites o junta dos en una. Asà no te deja publicar.`}function gS(t){const a=[];for(const n of t)n&&!a.some(o=>o.toLowerCase()===n.toLowerCase())&&a.push(n);return a}const Z1=200,Iv=40,mS=new Set([...Object.keys(ig),...Object.values(ig),"lk_hp","vivienda","recibe_en","codigo postal","codigo_postal","nota_wa","nota_cobertura","servicio","colonia","distrito","corregimiento","parroquia","zona","barrio",...rS]),Fu=t=>String(t||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim(),Ws=t=>String(t??"").replace(/"/gi,'"').replace(/'|'/gi,"'").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&").replace(/\s+/g," ").trim();function Gg(t,a=[]){const n=Ws(t),o=Fu(n);return o?/[\p{L}\p{N}]/u.test(n)?n.length>Iv?"larga":/[\u0000-\u001f<>{}]/.test(n)?"signos":o.startsWith("_")?"interna":mS.has(o)?"de_lumy":a.some(i=>Fu(i)===o)?"variante":"":"sin_letras":"vacia"}function hS(t,a,n=Iv){const o=a?`«${a.slice(0,60)}»`:"Una de tus preguntas";return t==="vacia"?'Una de tus preguntas (data-lumy-pregunta) no tiene nombre: escribe qué le estás preguntando al comprador, por ejemplo data-lumy-pregunta="Cédula".':t==="sin_letras"?`${o} no sirve como nombre de un dato: escrÃbelo con letras, por ejemplo data-lumy-pregunta="Cédula".`:t==="larga"?`${o} es muy larga para guardarla con el pedido: déjala en ${n} letras o menos, por ejemplo «Documento de identidad».`:t==="signos"?`${o} lleva signos que no se pueden guardar (< > { }): quÃtaselos.`:t==="variante"?`${o} es una de tus variantes: el comprador la llenarÃa y el pedido guardarÃa la otra. Ponle otro nombre.`:`${o} ya es un dato que Lumy pide por su cuenta: el comprador lo llenarÃa y el pedido guardarÃa el otro. Ponle otro nombre.`}function fS(t,a){if(a==="select")return"select";if(a==="textarea")return"textarea";const n=String((Mi(t).find(o=>o.nombre==="type")||{}).valor||"").toLowerCase();return n==="tel"?"tel":n==="number"?"number":n==="email"?"email":"text"}const xS=["hidden","file","password","submit","image","reset","button"];function Tv(t,a=[]){const n=Vg(t).replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,""),o=[];for(const i of ko(n,"data-lumy-pregunta")){const s=(i.etiqueta.match(/^<([a-z]+)/i)||["",""])[1].toLowerCase();if(!["input","select","textarea"].includes(s))continue;const u=Mi(i.etiqueta);if(s==="input"){const f=String((u.find(b=>b.nombre==="type")||{}).valor||"").trim().toLowerCase();if(xS.includes(f))continue}const m=Ws((u.find(f=>f.nombre==="data-lumy-pregunta")||{}).valor);if(Gg(m,a)||o.some(f=>Fu(f.clave)===Fu(m)))continue;const c=Number(String((u.find(f=>f.nombre==="maxlength")||{}).valor||"").trim()),g={clave:m,obligatorio:u.some(f=>f.nombre==="required"),tipo:fS(i.etiqueta,s),max:Number.isFinite(c)&&c>0?Math.min(Z1,Math.round(c)):Z1};if(g.tipo==="select"){const f=n.slice(i.indice+i.etiqueta.length),b=f.search(/<\/select>/i),v=[];for(const j of(b<0?f:f.slice(0,b)).matchAll(/<option\b([^>]*)>([\s\S]*?)(?:<\/option>|(?=<option\b)|$)/gi)){const S=Mi("<option"+j[1]+">").find(C=>C.nombre==="value"),$=String(S?S.valor??"":j[2].replace(/<[^>]*>/g,"")).replace(/\s+/g," ").trim().slice(0,60);$&&!v.includes($)&&v.push($)}v.length&&(g.opciones=v.slice(0,40))}if(o.push(g),o.length>=Pi)break}return o}const Vg=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,"");function bS(t){const a=ko(Vg(t),"data-lumy-campos",!0,1)[0];return a?String((Mi(a.etiqueta).find(n=>n.nombre==="data-lumy-campos")||{}).valor??""):null}function Ug(t,a){const n=Vg(t).replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,""),o=ri(a),i=[];for(const{etiqueta:s}of ko(n,"data-lumy-dato")){if(!/^<(?:input|select|textarea)[\s/>]/i.test(s))continue;const u=Mi(s),m=(u.find(g=>g.nombre==="data-lumy-dato")||{}).valor;if(typeof m!="string"||!/^[a-z0-9_]+$/i.test(m))continue;const c=o[m.toLowerCase()];!c||i.some(g=>g.clave===c)||i.push({clave:c,obligatorio:u.some(g=>g.nombre==="required")})}return i}function Qg(t,a=!1,n=[],o){const i=bS(t),s=ri(o),u=Tv(t,n).map(j=>({clave:j.clave,obligatorio:j.obligatorio}));if(i===null){const j=Ug(t,o);return!j.length&&!u.length?null:X1([...j.map(S=>({...S}
51)),...u],a,u.map(S=>S.clave))}const m=i,c=[];for(const j of m.split(",")){const S=j.trim();if(S){if(S.startsWith("+")){const $=S.endsWith("?"),C=Ws($?S.slice(1,-1):S.slice(1));if(Gg(C,n)||c.some(_=>_.clave.toLowerCase()===C.toLowerCase())||c.filter(_=>!_v(_.clave,o)).length>=Pi)continue;c.push({clave:C,obligatorio:!$});continue}for(const $ of S.split(/\s+/)){const C=$.trim().toLowerCase();if(!C)continue;const _=C.endsWith("?"),N=(_?C.slice(0,-1):C).replace(/[^a-z_0-9]/g,""),w=s[N];!w||c.some(M=>M.clave===w)||c.push({clave:w,obligatorio:!_})}}}for(const j of u)c.some(S=>S.clave.toLowerCase()===j.clave.toLowerCase())||c.push(j);if(!c.length)return null;const g=new Set(Object.values(ri(o)));let f=0;const b=c.filter(j=>g.has(j.clave)||++f<=Pi);c.length=0,c.push(...b);const v=c.filter(j=>!g.has(j.clave)).map(j=>j.clave);return X1(c,a,v)}function X1(t,a,n=[]){const o=m=>n.some(c=>c.toLowerCase()===m.toLowerCase()),i=t.filter(m=>o(m.clave)),s=t.filter(m=>!o(m.clave));if(s.some(m=>m.clave==="name")||s.unshift({clave:"name",obligatorio:!0}),!a){for(const m of uS)s.some(c=>c.clave===m)||s.push({clave:m,obligatorio:!0});s.some(m=>m.clave==="city")||s.push({clave:"city",obligatorio:!0}),s.some(m=>m.clave==="department")||s.splice(-1,0,{clave:"department",obligatorio:!0})}const u=a?["name","phone"]:["name","phone","address","city","department"];return[...s,...i].map(m=>u.includes(m.clave)?{...m,obligatorio:!0}:m)}const fp={GT:"(?<![A-Za-z])Q",PE:"(?<![A-Za-z])S\\/\\.?",PY:"â²|(?<![A-Za-z])Gs\\.?",CR:"â¡"},yS=String.raw`\s?(?:\d{1,3}(?:[.,\s]\d{3})+|\d+)(?:[.,]\d{1,2})?(?!\d)`,vS=String.raw`\b\d{1,3}(?:[.,]\d{3})+(?:[.,]\d{1,2})?\s?(?:COP|MXN|USD|PEN|CLP|ARS|PYG|GTQ|CRC)\b`,eb=new Map;function jS(t){const a=String(t||"").toUpperCase().trim(),n=eb.get(a);if(n)return n;const o=a?fp[a]?[fp[a]]:[]:Object.values(fp),i=new RegExp(`(?:\\$|${o.join("|")||"(?!)"})${yS}|${vS}`,"g");return eb.set(a,i),i}const Ev=t=>t.replace(/\D/g,"");function hc(t,a){const n=new Map;for(const o of String(t||"").matchAll(jS(a))){const i=Ev(o[0]);i&&!n.has(i)&&n.set(i,o[0].trim())}return[...n.values()]}const tb=t=>t.replace(/[^\n]/g," "),AS=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,tb).replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,tb);function SS(t,a,n=[]){const o=[],i=AS(t),s=new Set(n.map(M=>String(M||"").trim().toLowerCase()).filter(Boolean)),u=M=>{const p=(M.match(/\bdata-lumy-variante\s*=\s*["']([^"']*)["']/i)||[])[1];return p!==void 0&&s.has(p.trim().toLowerCase())},m=M=>M.replace(/<[^<>]*>/g," ").replace(/ /gi," ").replace(/&/gi,"&"),c=(M,p)=>{if(new Set(p.map(x=>hc(x,a).map(Ev).sort().join("|")).filter(Boolean)).size<2)return;const L=hc(p.join(" | "),a);L.length>=2&&o.push({indice:M,montos:L})};let g=null;const f=M=>{g&&g.opcionDesde>=0&&(g.textos.push(m(i.slice(g.opcionDesde,M))),g.opcionDesde=-1)},b=M=>{g&&(f(M),g.cuenta&&c(g.indice,g.textos),g=null)},v=new Map,j=[],S=[];let $=null;const C=M=>{if(!$)return;const p=m(i.slice($.desde,M));S[$.n]=p,$.para&&v.set($.para,p),$=null},_=/<(\/?)(select|option|label|input)\b([^<>]*)>/gi;let N;for(;N=_.exec(i);){const M=N[1]==="/",p=N[2].toLowerCase(),V=N.index+N[0].length;if(p==="select")b(N.index),M||(g={indice:N.index,cuenta:!/\bdata-lumy-cantidad\b/i.test(N[3])&&!u(N[3]),textos:[],opcionDesde:-1});else if(p==="option"){if(!g)continue;f(N.index),M||(g.opcionDesde=V)}else p==="label"?(C(N.index),M||($={desde:V,para:(N[3].match(/\bfor\s*=\s*["']([^"']+)["']/i)||[])[1]||"",n:S.length},S.push(""))):M||j.push({atributos:N[3],indice:N.index,label:$?$.n:-1})}b(i.length),C(i.length);const w=new Map;for(const M of j){if(!/\btype\s*=\s*["']?radio\b/i.test(M.atributos)||/\bdata-lumy-cantidad\b/i.test(M.atributos))continue;const p=(M.atributos.match(/\bname\s*=\s*["']([^"']*)["']/i)||[])[1]||(M.atributos.match(/\bdata-lumy-variante\s*=\s*["']([^"']*)["']/i)||[])[1]||"(sin grupo)",V=(M.atributos.match(/\bid\s*=\s*["']([^"']+)["']/i)||[])[1],L=M.label>=0?`l${M.label}`:V?`f${V}`:"",x=w.get(p)||{indice:M.indice,textos:[],vistos:new Set};w.set(p,x),!(!L||x.vistos.has(L))&&(x.vistos.add(L),x.textos.push(M.label>=0?S[M.label]:v.get(V)||""))}for(const M of w.values())c(M.indice,M.textos);return o.sort((M,p)=>M.indice-p.indice)}const zv='<div data-lumy-producto data-nombre="Tu producto" data-precio="99000"></div>';function wS(t){return`Esta lista ofrece productos con precios distintos (${t.slice(0,4).join(", ")}${t.length>4?"â¦":""}), y una landing cobra UN solo precio: el comprador escogerÃa uno y el pedido saldrÃa con otro precio y otro producto. Para vender una colección usa la tienda (menú: Activar tienda), donde cada producto tiene su precio, o haz una landing por producto. Asà no te deja publicar.`}function ab(t){return`${t.length?`Tu página muestra precios (${t.slice(0,3).join(", ")}
51), pero ese texto Lumy no lo cobra. `:""}Falta el precio: en modo código se pone con esta lÃnea, en cualquier parte de tu código: ${zv}. Pon tu precio en data-precio, solo el número.`}const Rv=["producto.nombre","producto.precio","producto.precio_antes","producto.descripcion","producto.imagen","producto.imagenes[0]","envio.texto","tienda.nombre","landing.nombre"],kS=["name","phone","address","city","department"],CS=["name","phone"],Fs=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,""),_S=t=>/^<(?:input|select|textarea)[\s/>]/i.test(t),$S=t=>ko(t,"data-lumy-dato").some(a=>{if(!_S(a.etiqueta))return!1;const n=(Mi(a.etiqueta).find(o=>o.nombre==="data-lumy-dato")||{}).valor;return typeof n=="string"&&/^[a-z0-9_]+$/i.test(n)}),Nv=t=>ko(t,"data-lumy-pedir").some(a=>/^<button[\s/>]/i.test(a.etiqueta));function Ju(t){const a=Fs(t);return $S(a)||Nv(a)}function IS(t,a=!1,n){if(!Ju(t))return[];const o=new Set(Ug(t,n).map(c=>c.clave)),i={name:"nombre",phone:"telefono",address:"direccion",city:"ciudad",department:"departamento"},s=(a?CS:kS).filter(c=>!o.has(c)).map(c=>i[c]),u=Fs(t);return Nv(u)||/<div[^>]*\bdata-lumy-campo\s*=\s*["']boton["']/i.test(u)||s.push("pedir"),s}function Kg(t){const a=[],n=/([^\s=/>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+)))?/g;let o;for(;o=n.exec(t);)a.push([o[1].toLowerCase(),o[2]??o[3]??o[4]??null]);return a}const Xl=/<select\b([^>]*?\bdata-lumy-cantidad\b[^>]*)>([\s\S]*?)<\/select>/gi,xp=/<input\b([^>]*?\bdata-lumy-cantidad\b[^>]*?)\s*\/?>/gi;function nb(t){return/<(?:select|input)\b[^>]*\bdata-lumy-cantidad\b/i.test(Fs(t))}const sg=t=>{const a=String(t??"").trim();return/^\d{1,2}$/.test(a)?Number(a):NaN};function Lv(t){return[...String(t||"").matchAll(/<option\b([^>]*)>([\s\S]*?)(?:<\/option>|(?=<option\b)|$)/gi)].map(a=>{const n=Kg(a[1]),o=n.find(([s])=>s==="value");return{escrito:o?String(o[1]??""):a[2].replace(/<[^>]*>/g,"").trim(),texto:a[2],marcada:n.some(([s])=>s==="selected"),esRotulo:!!o&&!String(o[1]??"").trim()}})}function TS(t){const a=Fs(t);return(a.match(/<select\b[^>]*\bdata-lumy-cantidad\b/gi)||[]).length+(/<input\b[^>]*\bdata-lumy-cantidad\b/i.test(a)?1:0)}function ES(t,a){const n=Fs(t),o=[],i=u=>{const m=sg(u);if(Number.isNaN(m)||!a.includes(m)){const c=u.trim()||"(sin valor)";o.includes(c)||o.push(c)}};xp.lastIndex=0;let s;for(;s=xp.exec(n);)i(String((Kg(s[1]).find(([u])=>u==="value")||[])[1]??""));for(Xl.lastIndex=0;s=Xl.exec(n);)for(const u of Lv(s[2]))u.esRotulo||i(u.escrito);return xp.lastIndex=0,Xl.lastIndex=0,o}function zS(t,a,n){if(!a.length)return[];const o=Fs(t),i=new Map(a.filter(c=>Number(c.precio)>0).map(c=>[Number(c.cantidad),Number(c.precio)])),s=[],u=(c,g)=>{const f=i.get(c);if(!f||s.some(_=>_.cantidad===c))return;const b=[],j=String(g||"").replace(/<([a-z0-9]+)([^>]*\bdata-lumy-text\s*=\s*"([^"]+)"[^>]*)>([\s\S]*?)<\/\1>/gi,(_,N,w,M)=>{const p=String(M).trim().toLowerCase();if(p==="producto.precio"){const V=i.get(1);return V&&b.push(V)," "}return Rv.includes(p)||/^producto\.imagenes\[\d+\]$/.test(p)?" ":_}).replace(/<[^>]*>/g," ").replace(/ /gi," ").replace(/\s+/g," ").trim(),S=j.replace(/(ahorr\w*|descuento|dcto\.?|antes|te regalamos|de regalo|en vez de|valor real|normal)\s*(de|:|-)?\s*[^\d\s]{0,3}\s?\d[\d.,\s]*/gi," "),$=[...b,...hc(S,n).map(Mg).filter(_=>typeof _=="number"&&_>0)];if(!$.length)return;const C=(_,N)=>Math.abs(_-N)<.01||Math.abs(Math.round(_)-Math.round(N))<1;$.some(_=>C(_,f)||C(_,f/Math.max(1,c)))||s.push({cantidad:c,dice:j.slice(0,80),cuesta:f})};Xl.lastIndex=0;let m;for(;m=Xl.exec(o);)for(const c of Lv(m[2]))c.esRotulo||u(sg(c.escrito),c.texto);Xl.lastIndex=0;for(const c of o.matchAll(/<label\b[^>]*>([\s\S]*?)<\/label>/gi)){const g=c[1].match(/<input\b([^>]*?\bdata-lumy-cantidad\b[^>]*?)\s*\/?>/i);g&&u(sg((Kg(g[1]).find(([f])=>f==="value")||[])[1]),c[1])}return s}function RS(t){return/<input\b[^>]*\bdata-lumy-adicional\b/i.test(Fs(t))}const NS=["bold","mercadopago","paypal"],Yg={bold:"Bold",mercadopago:"Mercado Pago",paypal:"PayPal"},LS=new Set(["MXN","USD"]);function Pv(t,a){const n=String(a||"").toUpperCase();return t==="bold"?n==="COP":t==="paypal"?LS.has(n):!0}function $u(t,a,n){const o=t&&typeof t=="object"?t:{},i=new Set(Array.from(a||[],s=>String(s)));return NS.filter(s=>!!o[s]&&i.has(s)&&Pv(s,n))}function ob(t){return!!(t&&typeof t=="object"&&t.contraentrega===!1)}function PS(t,a,n){return new Set(Array.from(a||[],i=>String(i))).has(t)?Pv(t,n)?null:t==="bold"?"Bold solo cobra en pesos colombianos":t==="paypal"?"PayPal solo cobra en pesos mexicanos o dólares":"no cobra en la moneda de esta landing":"conéctala en la pestaña Pagos"}function Dv(t){if(!t||typeof t!="object")return!1;const a=String(t.mode||"free");return a==="general"?(Number(t.general_cop)||0)>0:a==="zones"?(Array.isArray(t.zones)?t.zones:[]).some(o=>(Number(o==null?void 0:o.price_cop)||0)>0)||(Number(t.zones_default_cop)||0)>0:!1}function DS(t,a,n,o){const i={medios:[],soloEnLinea:!1,prepagoPorZonas:!1,envioAnticipado:!1};if(!t||t.page_type==="servicio")return i;const s=$u(t.payment_methods,a,o);if(!s.length)return i;const u=t.shipping&&typeof t.shipping=="object"?t.shipping:{},c=String(n||"").toUpperCase()==="CO"&&!!u.prepay_shipping;return{medios:s,soloEnLinea:ob(t.payment_methods),prepagoPorZonas:c&&String(u.mode||"free")==="zones"&&Array.isArray(u.zones)&&u.zones.some(g=>(g==null?void 0:g.prepay_required)===!0),envioAnticipado:c&&Dv(u)&&!ob(t.payment_methods)}}function Bv(t){const a=t.map(n=>Yg[n]);return a.length>1?`${a.slice(0,-1).join(", ")} y ${a[a.length-1]}`:a[0]||""}function BS(t){const a='<div data-lumy-campo="pago"></div>';if(!t||!t.medios.length)return"Solo contraentrega: el comprador paga al recibir. Para cobrar también en lÃnea, el vendedor activa Bold o Mercado Pago en su editor (pestaña «El pedido», Botones de pago) y la página los muestra donde pongas "+a+".";const n=Bv(t.medios),o=t.soloEnLinea?[`SOLO en lÃnea, con ${n}: la contraentrega está apagada. Los botones de pago salen dentro del formulario entero de Lumy (data-lumy-form) o donde pongas ${a}. Con las piezas de Lumy esa pieza es OBLIGATORIA: en este modo el botón "boton" se esconde y el pedido se paga con los botones de pago. Tu propio <button data-lumy-pedir> sà sirve: manda a pagar con ${Yg[t.medios[0]]}.`]:[`Contraentrega o en lÃnea con ${n}. Los botones de pago salen dentro del formulario entero de Lumy (data-lumy-form) o donde pongas ${a}; sin eso, en la página el comprador solo ve la contraentrega.`];return t.prepagoPorZonas&&o.push("En las ciudades con envÃo «Antici
51pado» el pedido solo se puede pagar en lÃnea: ahà los botones de pago son obligatorios, también con tu propio botón."),t.envioAnticipado&&!t.soloEnLinea&&o.push("Con esos botones el comprador también puede pagar solo el envÃo y el resto al recibir."),t.soloEnLinea||o.push(`Además, después de un pedido contraentrega la pantalla de gracias le ofrece pagarlo en lÃnea con ${n} (con el descuento por pagar en lÃnea, si el vendedor lo puso), mientras el pedido no se haya subido a la transportadora; esa pantalla la pone Lumy, también en modo código.`),o.join(" ")}const kc=/<div\b[^>]*\bdata-lumy-form\b[^>]*?(?:\/>|>(?:(?!<\/?div\b)[\s\S])*?<\/div>)/i,Cc=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,"").replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,""),Wi=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,a=>a.replace(/[^\n]/g," ")).replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,a=>a.replace(/[^\n]/g," ")),Ms=t=>new RegExp(`<div\\b[^>]*\\bdata-lumy-campo\\s*=\\s*["']${t}["'][^>]*>\\s*</div>`,"i"),ru=4e3,qs=6e5;function Wv(t){const a=String(t||""),n=a.toLowerCase(),o=g=>g===32||g===62||g===47||g===9||g===10||g===13||g===12||Number.isNaN(g),i="Tu código tiene etiquetas sin cerrar (les falta el «>») a lo largo de miles de caracteres, y asà no se puede leer. Ciérralas y vuelve a mandarlo.",s="Tu código termina con una etiqueta sin cerrar (le falta el «>») de miles de caracteres, y asà no se puede leer. Ciérrala y vuelve a mandarlo.";let u=0,m=-1;const c=new Set;for(let g=0;g<a.length;g++){const f=a.charCodeAt(g);if(f===62){if(u>=2&&g-m>ru)return i;u=0,m=-1;continue}if(f!==60)continue;if(n.startsWith("<!--",g)&&!c.has("-->")){const j=n.indexOf("-->",g+4);if(j>=0){g=j+2,u=0,m=-1;continue}c.add("-->")}const b=n.startsWith("<script",g)&&o(n.charCodeAt(g+7))?"script":n.startsWith("<style",g)&&o(n.charCodeAt(g+6))?"style":"";if(b&&!c.has(b)){const j=n.indexOf("</"+b,g+b.length+1);if(j>=0){g=j-1,u=0,m=-1;continue}c.add(b)}const v=a.charCodeAt(g+1);if(v>=65&&v<=90||v>=97&&v<=122||v===33||v===47){if(u===0&&(m=g),++u>200)return"Tu código tiene cientos de etiquetas seguidas sin cerrar (les falta el «>»), y asà no se puede leer. Ciérralas y vuelve a mandarlo.";if(u>=2&&g-m>ru)return i}}if(u>=2&&a.length-m>ru)return i;if(u>=1&&a.length-m>ru)return s;{const g=n.lastIndexOf("-->");let f=0,b=g<0?0:g+3;for(;(b=n.indexOf("<!--",b))>=0;)if(b+=4,++f>50)return"Tu código abre decenas de comentarios <!-- que nunca se cierran (falta -->), y asà no se puede leer. Ciérralos y vuelve a mandarlo."}for(const g of["script","style","select","textarea","button","label"]){const f=n.lastIndexOf("</"+g);let b=0,v=f<0?0:f+g.length+2;for(;(v=n.indexOf("<"+g,v))>=0;)if(v+=g.length+1,!!o(n.charCodeAt(v))&&++b>50)return`Tu código abre decenas de <${g}> que nunca se cierran (falta </${g}>), y asà no se puede leer. Ciérralos y vuelve a mandarlo.`}return a.length>qs?`Tu código pesa ${Math.round(a.length/1e3)} KB y Lumy publica hasta ${qs/1e3} KB: lo que pase de ahà no saldrÃa en la página. Casi siempre es una imagen pegada dentro del código (base64): súbela aparte y usa su enlace.`:""}function lg(t,a=!1,n,o){const i=Cc(t);if(kc.test(i))return[];const s=!!(o!=null&&o.soloEnLinea)&&o.medios.length>0&&Ms("pago").test(i);if(Ju(i)){const u=IS(i,a,n);return s?u.filter(m=>m!=="pedir"):u}return["datos","boton"].filter(u=>!Ms(u).test(i)&&!(u==="boton"&&s))}function WS(t,a){if(!a.pais||a.esServicio)return[];const n=Cc(t);if(a.esWhatsapp&&!fc(n))return[];if(kc.test(n)||Ms("datos").test(n))return[];if(!Ju(n))return[];const o=new Set(Ug(t,a.pais).map(i=>i.clave));for(const i of Qg(t,!1,a.variantes||[],a.pais)||[])i.obligatorio||o.add(i.clave);return iS(o,a.pais,Array.isArray(a.quitados)?a.quitados:[])}function fc(t){const a=Cc(t);return kc.test(a)||Ms("datos").test(a)||Ms("boton").test(a)||Ju(a)}function qS(t,a){const n={frena:"",ojo:"",indice:0};if(!a||!a.medios.length)return n;const o=Cc(t);if(kc.test(o)||Ms("pago").test(o))return n;const i=a.medios.map(f=>Yg[f]),s=Bv(a.medios),u=/<button\b[^>]*\bdata-lumy-pedir\b/i,m=Wi(t).search(/<button\b[^>]*\bdata-lumy-pedir\b|<div\b[^>]*\bdata-lumy-campo\s*=\s*["']boton["']/i),c=m>=0?m:0,g='<div data-lumy-campo="pago"></div>';return a.soloEnLinea&&!u.test(o)?{...n,indice:c,frena:`Tu página solo cobra en lÃnea (la contraentrega está apagada) y no tiene los botones de pago: el comprador no tendrÃa con qué pagar. Pon ${g} donde quieras los botones de ${s}, o enciende la contraentrega. Asà no te deja publicar.`}:a.prepagoPorZonas?{...n,indice:c,frena:`En las ciudades donde el envÃo es «Antici
51pado» el comprador solo puede pagar en lÃnea, y tu página no tiene los botones de pago: ahà no podrÃa comprar. Pon ${g} donde quieras los botones de ${s}. Asà no te deja publicar.`}:a.soloEnLinea?i.length>1?{...n,indice:c,ojo:`Tu botón de pedir lleva a pagar con ${i[0]}: el comprador no puede elegir ${i.slice(1).join(" ni ")}. Si quieres que elija, pon ${g} donde quieras los botones.`}:n:{...n,indice:c,ojo:`Activaste el pago en lÃnea con ${s}, pero tu página no muestra sus botones: el comprador solo puede pedir contraentrega${a.envioAnticipado?" y no ve la opción de pagar solo el envÃo":""}. Pon ${g} donde quieras los botones.`}}function MS(t,a){const n=Wi(t),o=ri(a),i=[],s=/<(?:input|select|textarea)\b[^<>]*>/gi;let u;for(;u=s.exec(n);){const m=Mi(u[0]),c=m.find(v=>v.nombre==="data-lumy-dato");if(!c)continue;const g=String((m.find(v=>v.nombre==="type")||{}).valor??"").trim().toLowerCase();if(/^<input/i.test(u[0])&&["hidden","file","password","submit","image","reset","button"].includes(g))continue;const f=String(c.valor??""),b=f.toLowerCase();/^[a-z0-9_]+$/i.test(f)&&(b==="recibe_en"||Object.prototype.hasOwnProperty.call(o,b))||i.push({dato:f,indice:u.index})}return i}function FS(t,a){const n=String(t||"").trim().toLowerCase();if(n.length<4)return"";for(const o of Object.keys(ri(a)))if(!(Math.abs(o.length-n.length)>1)&&OS(n,o))return o;return""}function OS(t,a){if(t===a)return!1;if(t.length===a.length){const s=[];for(let u=0;u<t.length;u++)t[u]!==a[u]&&s.push(u);return s.length===1?!0:s.length===2&&s[1]===s[0]+1&&t[s[0]]===a[s[1]]&&t[s[1]]===a[s[0]]}const[n,o]=t.length<a.length?[t,a]:[a,t];let i=0;for(;i<n.length&&n[i]===o[i];)i++;return n.slice(i)===o.slice(i+1)}function HS(t,a,n={}){const i=n.conLista!==!1?`: ${mc(a)}`:" (la lista está en el primer aviso de este tipo)";if(!t.trim())return`Esta casilla tiene data-lumy-dato vacÃo: lo que el comprador escriba ahà no llega al pedido. Ponle el nombre del dato${i} o, para preguntar otra cosa, data-lumy-pregunta="Tu pregunta". Asà no te deja publicar.`;const s=t.trim().toLowerCase();if(s!==t.toLowerCase()&&/^[a-z0-9_]+$/.test(s)&&(s==="recibe_en"||Object.prototype.hasOwnProperty.call(ri(a),s)))return`«${t}» lleva espacios: escrÃbelo pegado a las comillas, data-lumy-dato="${s}". Asà como está, lo que el comprador escriba ahà no llega al pedido. Asà no te deja publicar.`;const u=s.normalize("NFD").replace(/[\u0300-\u036f]/g,""),m=(n.variantes||[]).find(f=>String(f||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")===u);if(m||["talla","color","tamano","sabor","modelo","medida","estilo"].includes(u)){const f=m||s.charAt(0).toUpperCase()+s.slice(1);return`«${t}» no es un dato de Lumy: ${m?"es una de las variantes de tu producto":"si es una variante de tu producto"} y va con su propia marca, <select data-lumy-variante="${f}"></select> (Lumy pone las opciones) o la pieza <div data-lumy-campo="variantes"></div>. Asà llega al pedido como variante y la logÃstica la entiende; como pregunta llegarÃa suelta. Asà no te deja publicar.`}if(["cantidad","cantidades","unidades","qty"].includes(u))return`«${t}» no es un dato de Lumy: la cantidad se elige con data-lumy-cantidad, en una lista (<select data-lumy-cantidad></select>) o en botones de opción, y cada cantidad cobra su oferta de data-ofertas="2: 159.900, 3: 219.900". Como pregunta, el comprador escogerÃa 2 y el pedido saldrÃa por 1. Asà no te deja publicar.`;if(["adicional","extra","bump","order_bump"].includes(u))return`«${t}» no es un dato de Lumy: el producto adicional se marca con <input type="checkbox" data-lumy-adicional> y se declara en tu producto, data-adicional="EnvÃo express: 9.900". Asà no te deja publicar.`;const c=FS(t,a);if(c)return`«${t}» no es un dato de Lumy: ¿quisiste decir «${c}»? Lo que el comprador escriba ahà no llega al pedido. Asà no te deja publicar.`;const g=(t.charAt(0).toUpperCase()+t.slice(1)).replace(/_/g," ");return`«${t}» no es un dato de Lumy: lo que el comprador escriba ahà no llega al pedido. Si es una pregunta tuya, cámbialo a data-lumy-pregunta="${g}" y llega al CRM como «${g}: â¦Â». Si es uno de los datos de Lumy, usa su nombre${i}. Asà no te deja publicar.`}function qv(t){return t.length?t.length===2&&t.includes("datos")&&t.includes("boton")?'Tu página todavÃa no tiene dónde pedir. Pon <div data-lumy-form></div>, o tus propios campos con data-lumy-dato="telefono"⦠y un <button data-lumy-pedir>.':`A tu página le falta ${t.map(n=>n==="pedir"?"<button data-lumy-pedir>":n==="datos"||n==="boton"?`<div data-lumy-campo="${n}"></div>`:`data-lumy-dato="${n}"`).join(", ")}: sin eso no se puede pedir.`:""}function GS(t){const a=String(t||""),n=[];for(const i of a.matchAll(/<!--[\s\S]*?-->
51/g))/data-lumy-form|data-lumy-campo\s*=|data-lumy-dato\s*=|data-lumy-pedir/.test(i[0])&&n.push({indice:i.index||0,texto:"Esta marca está dentro de un comentario (<!-- -->): Lumy no la toma."});const o=Wi(a);for(const i of o.matchAll(/<([a-z][a-z0-9]*)\b[^>]*\bdata-lumy-(form|campo)\b[^>]*>/gi))i[1].toLowerCase()!=="div"&&n.push({indice:i.index||0,texto:`data-lumy-${i[2].toLowerCase()} va en un <div>, no en <${i[1].toLowerCase()}>.`});for(const i of o.matchAll(/<div\b[^>]*\bdata-lumy-form\b[^>]*>/gi)){const s=o.slice((i.index||0)+i[0].length),u=s.search(/<\/div>/i),m=s.search(/<div\b/i);!/\/>$/.test(i[0])&&m>=0&&(u<0||m<u)&&n.push({indice:i.index||0,texto:"Deja <div data-lumy-form></div> vacÃo: con otro <div> dentro, Lumy no sabe dónde poner el formulario."})}return n}function VS(t,a,n){if(!a.length)return[];const o=Cc(t);if(kc.test(o))return[];if(Ms(n?"oferta":"variantes").test(o))return[];const i=s=>new RegExp(`data-lumy-variante\\s*=\\s*["']${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}["']`,"i").test(o);return n&&!/<(?:select|input)\b[^>]*\bdata-lumy-cantidad\b/i.test(o)?a:a.filter(s=>!i(s))}function US(t,a){const n=Wi(t),o=new Map(a.map(c=>[String(c.nombre||"").trim().toLowerCase(),c])),i=c=>String(c||"").replace(/"/gi,'"').replace(/'|'/gi,"'").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&"),s=[],u=/<input\b[^>]*\bdata-lumy-variante\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>/gi;let m;for(;m=u.exec(n);){const c=m[0],g=i(m[1]??m[2]??"").trim(),f=o.get(g.toLowerCase()),b=c.match(/\bvalue\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i),v=i(b?b[1]??b[2]??b[3]??"":"").trim();f?(!v||!f.opciones.some(j=>String(j).trim()===v))&&s.push({grupo:f.nombre,valor:v,indice:m.index,motivo:"valor"}):s.push({grupo:g,valor:v,indice:m.index,motivo:"grupo"})}return s}const Mv=["addrHint","addrPhotoBtn","addrPhotoHint","addrPhotoInp","addrPhotoTx","addrSug","app","discToast","dnAccept","dnDecline","dnHead","dnImg","dnPrice","dnText","downsellModal","dtText","exitAccept","exitDecline","exitModal","extraCta","formClose","formModal","fviv","fvivMsg","gbFill","gbText","giftBar","heroVidCta","oafDone","oafInp","oafPhotoBtn","oafPhotoHint","oafPhotoInp","oafPhotoTx","oafSave","oafSug","offer","okAddrFix","okChk","okDone","okHead","okMkt","okpBtns","okpP","okPrepay","okpSkip","okRef","okScreen","okShare","okShareBig","okSteps","okSummary","oktCopy","oktInp","oktOpen","okTrack","okVoz","okWa","orderBump","orderForm","payNowHead","payState","pcbCta","pcbPrice","pcbWas","priceVal","priceWas","psCod","psCod2","psFailed","psPending","psRecheck","psRetry","psVerifying","quizDecline","quizModal","refAccept","refDecline","refHint","refModal","saveAmt","saveBadge","saveLine","scPrice","scrollBtn","scWas","shCart","shDrawer","shDrawerBd","shDrawerX","shipPrepayBox","shipPrepayHead","shMenu","stickyBtn","stickyCta","subErr","submitBtn","submitLbl","submitPr","submitSub","sumBump","sumBumpLbl","sumBumpRow","sumDisc","sumDisc2","sumDiscLbl","sumDiscLbl2","sumDiscRow","sumDiscRow2","sumQty","sumShip","sumSub","sumTot","upAccept","upDecline","upHead","upImg","upPrice","upsellModal","upText","waBump","waFab","waFormBtn","waInvite","waPriceNow","waPriceOff","waPriceSave","waPriceWas","waQtyMinus","waQtyPlus","waQtyVal","waSheet","waSheetGo","policyModal","polTitle","polBody","polClose","heroVidWa","waPairBtn","waInviteX","cdown","cdRing"],dc="mi-",Fv=`Lumy usa sus propios id dentro de la página (orderForm, submitBtn, okScreen, offer, app y ${Mv.length-5} más). Si le pones a algo tuyo el mismo id, el pedido puede salir mal, asà que la página NO se deja publicar hasta cambiarlo (el editor dice en qué lÃnea). Para no chocar NUNCA, ponle a todos tus id el prefijo ${dc}: id="${dc}oferta", id="${dc}hero". Tampoco uses clases que empiecen por lzr-.`,QS=new Set(Mv);function KS(t){const a=String(t||"");let n="",o=0;for(;o<a.length;){const j=a.indexOf("<!--",o);if(j<0){n+=a.slice(o);break}const S=a.indexOf("-->",j+4),$=S<0?a.length:S+3;n+=a.slice(o,j)+a.slice(j,$).replace(/[^\n]/g," "),o=$}const i=Wi(n),s=[],u=/\sid\s*=\s*["']([^"']+)["']/gi;let m;
51for(;m=u.exec(n);)s.push({id:m[1].trim(),indice:m.index});const c=/\sid\s*=\s*([^\s"'<>=`]+)/gi;for(;m=c.exec(i);)s.push({id:m[1].trim(),indice:m.index});const g=YS(i),f=[];let b=0,v=-1;for(const j of s.sort((S,$)=>S.indice-$.indice))if(QS.has(j.id)){for(;b<j.indice;b++)n.charCodeAt(b)===60&&(v=b);g.get(v)!==j.id&&f.push(j)}return f}function YS(t){const a=new Map,n=/<div\b[^>]*\bdata-lumy-form\b/i.test(t),o=s=>new RegExp(`<div\\b[^>]*\\bdata-lumy-campo\\s*=\\s*["']?${s}\\b`,"i").test(t);if(!n&&!o("boton")){const s=ko(t,"data-lumy-pedir").find(u=>/^<button[\s/>]/i.test(u.etiqueta));s&&a.set(s.indice,"submitBtn")}if(!n&&!o("bump")){const s=ko(t,"data-lumy-adicional").find(u=>/^<input[\s/>]/i.test(u.etiqueta));s&&a.set(s.indice,"orderBump")}const i=ko(t,"data-lumy-form",!0,1)[0];return i&&a.set(i.indice,"orderForm"),a}function JS(t){return`«${t}» es un id de Lumy (un nombre que Lumy usa por dentro): cámbialo, por ejemplo a «mi-${t}», o el pedido puede salir mal. Asà no te deja publicar.`}const ZS=["aparecer","aparecer-hijos","contador","escribir","cuenta-regresiva","parallax","zoom-scroll","revelar-imagen","particulas","marquesina","flotar","brillar","pulso","sacudir","tilt","gradiente-vivo","pestanas","acordeon","carrusel","comparador","ampliar","video-al-verse","rotar-palabras","resaltar","progreso-scroll","pegajoso","parallax-raton","confeti","copiar","ver-mas","zoom-hover"],XS=["form","link","template","noscript","object","embed"],e5=t=>Object.keys(ri(t)),t5=/no te deja publicar|no se deja publicar|no te dejará publicar|RECHAZA todos los pedidos/i,rb=["variantes","datos","resumen","oferta","bump","boton","pago","politicas"],iu=Rv.filter(t=>!t.startsWith("producto.imagenes")),a5=["nombre","apellido","telefono","celular","correo","email","departamento","estado","provincia","ciudad","municipio","direccion","referencia","barrio","telefono2","otro_telefono","notas","mensaje"],n5=(t,a)=>t.slice(0,a).split(` 52`).length;function Ov(t,a={}){var M,p,V,L;const n=String(t||"");if(!n.trim())return[];const o=Wv(n);if(o)return n.length>qs&&/Lumy publica hasta/.test(o)?[{linea:n5(n,qs),tipo:"ojo",texto:`${o} Desde esta lÃnea sobran ${n.length-qs} caracteres. Asà no te deja publicar.`}]:[{linea:1,tipo:"ojo",texto:o+" Asà no te deja publicar."}];const i=ri(a.pais),s=e5(a.pais),u=[],m=[0];for(let x=0;x<n.length;x++)n.charCodeAt(x)===10&&m.push(x+1);const c=x=>{let z=0,G=m.length-1;for(;z<G;){const B=z+G+1>>1;m[B]<=x?z=B:G=B-1}return z+1},g=new Set,f=(x,z,G)=>{const B=c(x),U=`${B}\0${G}`;g.has(U)||(g.add(U),u.push({linea:B,tipo:z,texto:G}))};for(const x of XS){const z=new RegExp(`<${x}(?=[\\s>/])`,"gi");let G;for(;G=z.exec(n);){if(x==="link"){const B=n.slice(G.index,n.indexOf(">",G.index)+1),U=ce=>(B.match(new RegExp(`\\b${ce}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"))||[]).slice(1).find(ve=>ve!==void 0)||"",ne=U("rel"),Q=U("href"),de=/^stylesheet$/i.test(ne)&&/^https:\/\/fonts\.googleapis\.com\//i.test(Q),pe=/\bicon\b/i.test(ne)&&(/^https:\/\//i.test(Q)||/^data:image\/(?:png|x-icon|vnd\.microsoft\.icon|svg\+xml|webp|gif|jpe?g);base64,/i.test(Q));if(de||pe)continue}f(G.index,"quita",x==="form"?'Lumy quita el <form>: el formulario lo pone él alrededor de tu página. Escribe tus campos sueltos, con data-lumy-dato="telefono" y demás.':`Lumy borra <${x}> al publicar.`)}}if(!a.dominioPropio){const x=/\son[a-z]+\s*=\s*["']/gi;let z;for(;z=x.exec(n);)f(z.index,"quita","Los eventos escritos en la etiqueta (onclick y demás) necesitan tu dominio propio. Conéctalo o usa CSS y las recetas data-lumy.")}{const x=/<style\b[^>]*>([\s\S]*?)<\/style>/gi;let z;for(;z=x.exec(n);){const B=z[1].match(/@import[^;]*/gi)||[];for(const U of B)/fonts\.googleapis\.com/i.test(U)?/family=[^&"')]*\s/i.test(U)&&f(z.index+z[0].indexOf(U),"quita","En la fuente de Google, los espacios del nombre van como +: Playfair+Display, no «Playfair Display»."):f(z.index+z[0].indexOf(U),"quita","Solo se admite @import de Google Fonts. Para una fuente tuya usa @font-face con la fuente embebida (data:font/woff2;base64,â¦).")}}{const x=/<iframe\b[^>]*>/gi;let z;for(;z=x.exec(n);){const G=(z[0].match(/\bsrc\s*=\s*["']([^"']*)["']/i)||[])[1]||"";/^https:\/\/(?:(?:www\.)?youtube\.com\/embed\/|(?:www\.)?youtube-nocookie\.com\/embed\/|player\.vimeo\.com\/video\/|(?:www\.)?tiktok\.com\/embed\/|(?:iframe|player)\.mediadelivery\.net\/embed\/|www\.google\.com\/maps\/embed\?|maps\.google\.com\/maps\?)/i.test(G)||f(z.index,"quita","Este iframe se quita. Solo se admiten YouTube, Vimeo, TikTok, Bunny/MediaDelivery y Google Maps.")}}if(a.dominioPropio){const x=/<script\b[^>]*\bsrc\s*=\s*(?:["']([^"']*)["']|([^\s>]+))[^>]*>/gi;let z;for(;z=x.exec(n);){const de=z[1]||z[2]||"";
52/^https:\/\//i.test(de)||f(z.index,"quita","Las librerÃas JavaScript externas tienen que usar una dirección https://. Este src se elimina.")}const G=/<script\b[^>]*>([\s\S]*?)<\/script>|<script\b[^>]*\bsrc\s*=\s*["']([^"']+)["'][^>]*>/gi;let B;for(;B=G.exec(n);){const de=`${B[1]||""} ${B[2]||""}`,pe=/\bfbq\s*\(\s*['"]init['"]|connect\.facebook\.net\/[^"'\s]*fbevents\.js/i.test(de),ce=/\bttq\.load\s*\(|analytics\.tiktok\.com\/i18n\/pixel/i.test(de);if(!pe&&!ce)continue;const ve=[pe&&"Meta",ce&&"TikTok"].filter(Boolean).join(" y ");f(B.index,"ojo",`Tu código trae el pÃxel de ${ve}. Lumy ya lo pone por ti (menú: PÃxeles y dominios) y manda la visita, el producto visto, el inicio del pedido y la compra, sin duplicar. Con el tuyo encima, cada visita y cada venta se cuentan dos veces. QuÃtalo de tu código y deja solo el de Lumy.`)}const U=a.esServicio?{meta:["PageView","ViewContent","Lead","Contact"],tiktok:["ViewContent","SubmitForm","Contact"]}:a.esWhatsapp?{meta:["PageView","ViewContent","Contact"],tiktok:["ViewContent","Contact"]}:{meta:["PageView","ViewContent","InitiateCheckout","Purchase","Contact"],tiktok:["ViewContent","InitiateCheckout","PlaceAnOrder","CompletePayment","Contact"]},ne=/<script\b[^>]*>([\s\S]*?)<\/script>|\son[a-z]+\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;let Q;for(;Q=ne.exec(n);){const de=Q[1]??Q[2]??Q[3]??"";if(/\bfbq\s*\(\s*['"]init['"]|\bttq\.load\s*\(/.test(de))continue;const pe=[];for(const ve of de.matchAll(/\bfbq\s*\(\s*['"]track['"]\s*,\s*['"]([A-Za-z]+)['"]/g))U.meta.includes(ve[1])&&!pe.includes(`${ve[1]} a Meta`)&&pe.push(`${ve[1]} a Meta`);for(const ve of de.matchAll(/\bttq\.track\s*\(\s*['"]([A-Za-z]+)['"]/g))U.tiktok.includes(ve[1])&&!pe.includes(`${ve[1]} a TikTok`)&&pe.push(`${ve[1]} a TikTok`);if(/\bttq\.page\s*\(/.test(de)&&pe.push("la visita a TikTok (ttq.page)"),!pe.length)continue;const ce=pe.length>1?`${pe.slice(0,-1).join(", ")} y ${pe[pe.length-1]}`:pe[0];f(Q.index,"ojo",pe.length>1?`Tu código manda ${ce}. Lumy ya los manda por ti, sin duplicar: con los tuyos encima se cuentan dos veces. Quita esas lÃneas de tu código.`:`Tu código manda ${ce}. Lumy ya lo manda por ti, sin duplicar: con el tuyo encima se cuenta dos veces. Quita esa lÃnea de tu código.`)}}else{const x=/<script\b/gi;let z;for(;z=x.exec(n);)f(z.index,"quita","Tu JavaScript necesita TU dominio conectado a Lumy. Puedes seguir escribiendo y guardando, pero para publicar hay que conectarlo primero (menú: PÃxeles y dominios).")}for(const x of KS(n))f(x.indice,"ojo",JS(x.id));{const x=/data-lumy-campo\s*=\s*["']([^"']*)["']/gi;let z;for(;z=x.exec(n);)rb.includes(z[1].toLowerCase())||f(z.index,"ojo",`«${z[1]}» no es una ranura de Lumy. Las que hay: ${rb.join(", ")}.`)}{const x=/data-lumy-(?:text|src)\s*=\s*["']([^"']*)["']/gi;let z;for(;z=x.exec(n);){const G=z[1].toLowerCase().replace(/\[\d+\]$/,"");!iu.includes(G)&&G!=="producto.imagenes"&&f(z.index,"ojo",`«${z[1]}» no es una variable de Lumy: se queda vacÃo. Las que hay: ${iu.join(", ")}.`)}}{const x=Wi(n),z=/\{\{\s*([a-z_]+\.[a-z_]+)(?:\[\d+\])?\s*\}\}/gi;let G;for(;G=z.exec(x);){const Q=G[1].toLowerCase();!iu.includes(Q)&&Q!=="producto.imagenes"&&f(G.index,"ojo",`«${G[0]}» no es una variable de Lumy: se queda escrita tal cual en tu página. Las que hay: ${iu.join(", ")}.`)}const B=/\bdata-lumy\s*=\s*["']([^"']*)["']/gi;for(;G=B.exec(x);)for(const Q of G[1].trim().toLowerCase().split(/\s+/).filter(Boolean))ZS.includes(Q)||f(G.index,"ojo",`«${Q}» no es una receta de Lumy: no hace nada. Las que hay están en «Lo que Lumy entiende» (aparecer, contador, carruselâ¦).`);const U=/<(?:img|video|source|audio)\b[^>]*\bsrc\s*=\s*["']http:\/\/[^"']*["'][^>]*>/gi;for(;G=U.exec(x);)f(G.index,"ojo","Esta dirección va por http:// y tu página se sirve por https: el navegador la bloquea. Usa https://.");const ne=/\bclass\s*=\s*["'][^"']*\blzr-[^"']*["']/gi;for(;G=ne.exec(x);)f(G.index,"ojo","Las clases que empiezan por «lzr-» son de Lumy: con ese nombre tus estilos chocan con los de las recetas. Ponle otro.")}{const x=/data-lumy-campos\s*=\s*["']([^"']*)["']/gi;let z;for(;z=x.exec(n);)for(const G of z[1].split(/[,\s]+/)){if(G.trim().startsWith("+"))continue;const B=G.trim().toLowerCase().replace(/\?$/,"");B&&!a5.includes(B)&&!s.includes(B)&&f(z.index,"ojo",`«${B}
52» no es un campo de Lumy y se ignora. Los que hay: ${mc(a.pais)}.`)}}{const x=new Set,z=/<(input|select|textarea)\b[^>]*>/gi;let G;for(;G=z.exec(n);){const Q=G[0],de=(Q.match(/\bdata-lumy-dato\s*=\s*["']([^"']*)["']/i)||[])[1];if(de===void 0&&/\bdata-lumy-(?:variante|pregunta|cantidad|adicional)\s*=?/i.test(Q)||de===void 0&&/\btype\s*=\s*["']?(radio|checkbox|range|color)\b/i.test(Q)||de&&de.toLowerCase()==="recibe_en")continue;const pe=(Q.match(/\btype\s*=\s*["']?([a-z]+)/i)||[])[1];if(G[1].toLowerCase()==="input"&&pe&&["file","hidden","password","submit","image","reset","button"].includes(pe.toLowerCase())){f(G.index,"quita",`type="${pe}" no se admite en un campo: Lumy elimina este input al publicar.`);continue}if(de===void 0){f(G.index,"ojo",`Este <${G[1].toLowerCase()}> no tiene data-lumy-dato: Lumy no sabe qué dato es y no viaja en el pedido. Ponle data-lumy-dato="telefono" (o nombre, direccion, ciudadâ¦).`);continue}const ce=i[de.toLowerCase()];if(ce){if((ce==="department"||ce==="city")&&G[1].toLowerCase()!=="select"&&f(G.index,"ojo",`Tu «${de}» es una casilla de texto: Lumy la vuelve lista desplegable, con los nombres que acepta la transportadora, y le deja tu diseño. Si quieres verla asà en tu código, usa <select data-lumy-dato="${de}"></select>.`),x.has(ce)&&f(G.index,"ojo",`Ya hay otro campo para «${de}»: este segundo no viaja en el pedido.`),x.add(ce),G[1].toLowerCase()==="select"&&ce!=="department"&&ce!=="city"){const ve=n.slice(G.index+Q.length),ge=ve.search(/<\/select>/i);[...(ge>=0?ve.slice(0,ge):"").matchAll(/<option\b([^>]*)>([\s\S]*?)<\/option>/gi)].some(fe=>{const Be=(fe[1].match(/\bvalue\s*=\s*["']([^"']*)["']/i)||[])[1];return String(Be!==void 0?Be:fe[2].replace(/<[^>]*>/g,"")).trim()!==""})||f(G.index,"ojo",`«${de}» no tiene lista en Lumy (solo el departamento y la ciudad la tienen): tu <select> vacÃo se vuelve una casilla de texto para que el comprador pueda escribirlo. Si quieres una lista, escribe tú sus opciones.`)}/\sname\s*=/i.test(Q)&&f(G.index,"ojo","Lumy quita el name: lo pone él según data-lumy-dato, que es lo que leen el CRM y la logÃstica."),/\sdisabled(?:\s|=|\/?>)/i.test(Q)&&f(G.index,"ojo","Lumy quita disabled de los campos conectados: un campo deshabilitado no viaja en un formulario. Si no quieres pedirlo, quita data-lumy-dato; si solo quieres bloquearlo visualmente, usa readonly cuando aplique.")}}let B=!1;const U=mc(a.pais);for(const Q of MS(n,a.pais)){const de=HS(Q.dato,a.pais,{conLista:!B,variantes:a.variantes});de.includes(U)&&(B=!0),f(Q.indice,"ojo",de)}const ne=/<div[^>]*\bdata-lumy-(?:campo\s*=\s*["']datos["']|form\b)/i.test(n);x.size&&ne&&f(n.search(/data-lumy-(campo|form)/i),"ojo","Tienes tus propios campos Y el formulario de Lumy: se piden los datos dos veces. Usa uno de los dos.");for(const Q of ko(n,"data-lumy-pedir")){const de={0:Q.etiqueta,1:(Q.etiqueta.match(/^<([a-z][a-z0-9]*)/i)||["",""])[1],index:Q.indice};de[1].toLowerCase()!=="button"&&f(de.index,"ojo","data-lumy-pedir va en un <button>: en otra etiqueta no envÃa el pedido."),/\sdisabled(?:\s|=|\/?>)/i.test(de[0])&&f(de.index,"ojo","Lumy quita disabled del botón data-lumy-pedir para que el pedido no quede imposible de enviar. Controla su apariencia con CSS, no bloquees permanentemente el botón.")}}for(const x of ko(n,"data-lumy-variante")){if(!/^<(?:input|select)[\s>\/]/i.test(x.etiqueta))continue;const z={0:x.etiqueta,index:x.indice};/\sdisabled(?:\s|=|\/?>)/i.test(z[0])&&f(z.index,"ojo","Lumy quita disabled de las variantes conectadas: talla y color deben poder viajar con el pedido.")}for(const x of ko(n,"data-lumy-producto",!0)){const z={0:x.etiqueta,index:x.indice},G=z[0].match(new RegExp(`(?<![\\w-])(?:data-)?precio\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i")),B=G?G[1]??G[2]??G[3]??"":null;if(B!==null){const Q=String(B).replace(/^\s*(COP|USD|MXN|PEN|CLP|ARS|GTQ|EUR)\s*/i,"").replace(/\s*(COP|USD|MXN|PEN|CLP|ARS|GTQ|EUR)\s*$/i,"").replace(/[$\s]/g,"");(!/^\d[\d.,]*$/.test(Q)||Number(Q.replace(/[^\d]/g,""))<=0)&&f(z.index,"ojo",`El precio «${B}» no se entiende y se ignora: tiene que ser un número. Tu página seguirÃa cobrando el precio anterior.`)}const U=z[0].match(new RegExp(`(?<![\\w-])(?:data-)?ofertas\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i")),ne=U?U[1]??U[2]??"":null;if(ne&&ne.trim()&&!/^(ninguna|ninguno)$/i.test(ne.trim())&&!/[<>\n\r]/.test(ne)){const Q=(ne.match(/:/g)||[]).length,de=xv(ne)||[];de.length<Q&&f(z.index,"ojo",`De tus ofertas solo se entiende${de.length===1?"":"n"} ${de.length}: cada una va como «cantidad: precio total», separadas por coma, por ejemplo data-ofertas="2: 219.900, 3: 299.900". La cantidad va de 2 en adelante y el precio es solo el número.`);const pe=Number((M=qu(z[0]))==null?void 0:M.precio)||0;for(const ce of de)pe>0&&ce.precio<pe&&f(z.index,"ojo",`La oferta de ${ce.cantidad} unidades cuesta menos que una sola y se ignora: revisa si le falta un cero al precio.`)}}{const x=Wi(n),z=qu(n),G=Math.max(0,x.search(/<div\b[^>]*\bdata-lumy-producto\b/i)),B=/<div[^>]*\bdata-lumy-form\b/i.test(x),U=ge=>new RegExp(`data-lumy-campo\\s*=\\s*["']${ge}["']`,"i").test(x),ne=(ko(x,"data-lumy-producto",!0)[0]||{etiqueta:""}).etiqueta,Q=ge=>{const ie=ne.match(new RegExp(`(?<![\\w-])(?:data-)?${ge}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i"));return ie?ie[1]??ie[2]??"":null},de=Q("envio");de!==null&&de.trim()&&!/[<>\n\r]/.test(de)&&!(z!=null&&z.envio)&&f(G,"ojo",`El envÃo «${de}» no se entiende y se ignora: escribe el valor (data-envio="12.000") o la palabra gratis.`),z!=null&&z.envio&&!z.envio.gratis&&!B&&!U("resumen")&&!/data-lumy-pedido\s*=\s*["'](?:envio|total)["']/i.test(x)&&f(G,"ojo",'Cobras envÃo y tu página no se lo muestra al comprador antes de pedir: pon <span data-lumy-pedido="envio"></span> y <span data-lumy-pedido="total"></span>, o la pieza <div data-lumy-campo="resumen"></div>. Si no, le llega un cobro mayor al que vio.');const pe=Q("adicional");pe!==null&&pe.trim()&&!/[<>\n\r]/.test(pe)&&!(z!=null&&z.adicional)&&!(z!=null&&z.sinAdicional)&&f(G,"ojo",`El adicional «${pe}» no se entiende y se ignora: va como «nombre: precio», por ejemplo data-adicional="EnvÃo express: 9.900".`);const ce=RS(n);if(z!=null&&z.adicional&&!B&&!U("bump")&&!ce&&f(G,"ojo",'Declaraste un producto adicional y tu página no tiene dónde marcarlo: pon <div data-lumy-campo="bump"></div> o tu propia casilla <input type="checkbox" data-lumy-adicional>. Sin eso nadie lo puede agregar.'),ce){const ge=Math.max(0,x.search(/<input\b[^>]*\bdata-lumy-adicional\b/i));!(z!=null&&z.adicional)&&!a.conAdicional?f(ge,"ojo",'Tu casilla data-lumy-adicional no tiene nada que sumar: declara el adicional en la marca de tu producto, por ejemplo data-adicional="EnvÃo express: 9.900".'):(B||U("bump"))&&f(ge,"ojo","Tienes la pieza de Lumy y tu propia casilla para el adicional: se usa la pieza y la tuya queda sin conectar. Deja solo una.")}if(nb(n)){const ge=Math.max(0,x.search(/<(?:select|input)\b[^>]*\bdata-lumy-cantidad\b/i)),Te=z!=null&&z.ofertas?[1,...z.ofertas.map(ie=>ie.cantidad)]:a.cantidades||[];if(TS(n)>1&&f(ge,"ojo","Tienes más de un control de cantidad. Deja uno solo, una lista o un grupo de botones: con dos, cada uno puede quedar en una cantidad distinta y asà no te deja publicar."),!Te.length&&!a.conOfertas)f(ge,"ojo",'Tu página deja elegir la cantidad, pero no has dicho cuánto vale llevar 2 o 3: decláralo en la marca de tu producto, data-ofertas="2: 219.900, 3: 299.900". Hasta entonces no te deja publicar.');else if(Te.length)for(const ie of ES(n,Te))f(ge,"ojo",`Dejas elegir la cantidad «${ie}», pero no tienes oferta para esa cantidad (tienes: ${Te.join(", ")}). Agrégala en data-ofertas o quita esa opción: asà no te deja publicar.`);if((p=z==null?void 0:z.ofertas)!=null&&p.length){const ie=[...Number(z.precio)>0?[{cantidad:1,precio:Number(z.precio)}]:[],...z.ofertas.map(fe=>({cantidad:fe.cantidad,precio:fe.precio}))];for(const fe of zS(n,ie,a.pais))f(ge,"ojo",`Tu opción «${fe.dice}» dice otro precio: llevar ${fe.cantidad} cuesta ${ij(fe.cuesta,a.pais)} y eso es lo que se cobra. Cambia el texto de esa opción, o el precio de la oferta en data-ofertas, para que el comprador pague lo que ve.`)}/<input\b(?=[^>]*\bdata-lumy-cantidad\b)(?=[^>]*\btype\s*=\s*["']?(?:number|text|range)\b)[^>]*>/i.test(x)&&f(ge,"ojo",'La cantidad se elige en una lista (<select>) o en botones de opción (type="radio"), no se teclea: el precio de cada cantidad es el de tus ofertas.')}{const ge=[...x.matchAll(/<(?:input|select|textarea)\b[^>
52]*\bdata-lumy-pregunta\s*=\s*"([^"]*)"/gi)],Te=new Set;for(const We of ge){const ze=Ws(We[1]),tt=We.index||0;if(B){f(tt,"ojo",`«${ze||"Tu pregunta"}» queda FUERA del formulario de Lumy y el dato no llegarÃa. Con el formulario entero, pÃdela dentro: <div data-lumy-campos="nombre, telefono, direccion, ciudad, +${ze||"Cédula"}"></div>. Asà no te deja publicar.`);break}const Fe=Gg(ze,a.variantes||[]);Fe?f(tt,"ojo",hS(Fe,ze)+" Asà no te deja publicar."):Te.has(ze.toLowerCase())&&f(tt,"ojo",`Ya tienes una pregunta llamada «${ze}»: solo llegarÃa una. Ponles nombres distintos. Asà no te deja publicar.`),Te.add(ze.toLowerCase())}const ie=(Qg(n,!!a.esServicio,a.variantes||[],a.pais)||[]).map(We=>We.clave).filter(We=>!_v(We,a.pais));if(!(B||U("datos"))){for(const We of ie)if(!ge.some(ze=>Ws(ze[1]).toLowerCase()===We.toLowerCase())){f(Math.max(0,x.search(/<div\b[^>]*\bdata-lumy-campos\b/i)),"ojo",`Pediste «${We}» en data-lumy-campos y tu página no tiene dónde llenarla: el pedido llegarÃa sin ese dato. Dibújala con <input data-lumy-pregunta="${We}">. Asà no te deja publicar.`);break}}ie.length>Pi&&f(((V=ge[Pi])==null?void 0:V.index)||0,"ojo",`Tienes ${ie.length} preguntas propias y el máximo es ${Pi}.`);const Be=gS(ge.map(We=>Ws(We[1])));if(Be.length>Pi){const We=Be[Pi],ze=((L=ge.find(tt=>Ws(tt[1]).toLowerCase()===We.toLowerCase()))==null?void 0:L.index)||0;f(ze,"ojo",pS(Be.length,We))}}const ve=ko(x,"data-lumy-gracias");if(ve.length){const ge=ve[0].etiqueta,Te=ve[0].indice,ie=yv(n),fe=ge.match(new RegExp(`(?<![\\w-])(?:data-)?ir-a\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i")),Be=fe?(fe[1]??fe[2]??"").trim():"";Be&&!/[<>\n\r]/.test(Be)&&(ie==null?void 0:ie.irA)===void 0&&f(Te,"ojo",`La dirección «${Be.slice(0,60)}» no se va a usar: tiene que empezar por https:// (o por / si es una página de tu mismo sitio).`),new RegExp("(?<![\\w-])(?:data-)?ir-en\\s*=","i").test(ge)&&!Be&&f(Te,"ojo",'Dijiste en cuántos segundos irse (data-ir-en) pero no a dónde: agrega data-ir-a="https://â¦".'),ve.length>1&&f(ve[1].indice,"ojo","Solo se usa la primera marca data-lumy-gracias: deja una sola.")}}for(const x of GS(n))f(x.indice,"ojo",x.texto);if(!/data-lumy-abrir/i.test(n)){const x=n.search(/<[a-z][^>]*\bpopovertarget\b/i);/\bpopover\b|<dialog\b/i.test(n)&&x>=0&&f(x,"ojo","Tu botón abre una ventana con el formulario dentro, pero Lumy no se entera de que alguien quiso comprar: ese clic no cuenta en tus métricas ni en Meta. Ponle data-lumy-abrir al botón.")}const b=!!a.esWhatsapp&&!fc(n),v=b?[]:VS(n,a.variantes||[],!!a.conOfertas),j=/<div[^>]*\bdata-lumy-form\b/i.test(n),S=x=>new RegExp(`data-lumy-campo\\s*=\\s*["']${x}["']`,"i").test(n),$=!!a.conOfertas&&!/\bdata-ofertas\s*=/i.test(Wi(n)),C=(a.cantidades||[]).filter(x=>x>1).map(x=>`lleva ${x}`).join(", "),_=$?` Esas ofertas${C?` (${C})`:""} son las que ya tenÃa guardada la landing, aunque tu código no las nombra: si no las quieres, escribe data-ofertas="ninguna" en tu <div data-lumy-producto>.`:"";v.length?u.push({linea:n.split(` 53`).length,tipo:"ojo",texto:a.conOfertas?`Tu producto tiene ${v.join(" y ")} y ofertas por cantidad: pon <div data-lumy-campo="oferta"></div> (ahà se elige la talla de cada unidad).${_} Sin eso el pedido llega sin talla y no te deja publicar.`:`Tu producto tiene ${v.join(" y ")}: pon <div data-lumy-campo="variantes"></div> o tu propia lista con data-lumy-variante="${v[0]}". Sin eso el pedido llega sin talla y no te deja publicar.`}):!b&&!j&&a.conOfertas&&!S("oferta")&&!nb(n)&&/data-lumy(-campo)?\s*=/i.test(n)&&u.push({linea:n.split(` 54`).length,tipo:"ojo",texto:`Tienes ofertas por cantidad (${C||"lleva 2, lleva 3â¦"}): pon <div data-lumy-campo="oferta"></div> para que el comprador las vea, o deja que elija la cantidad con data-lumy-cantidad.${_}`});for(const x of US(n,a.variantesConOpciones||[]))f(x.indice,"ojo",x.motivo==="grupo"?`«${x.grupo||"(vacÃo)"}» no está declarada en tu producto. Decláralas en tu código: <div data-lumy-producto data-variantes="${x.grupo||"Color"}: opción 1, opción 2">. Asà no te deja publicar.`:`«${x.valor||"(sin valor)"}» no existe en ${x.grupo}. Usa exactamente una de las opciones configuradas; si no, la logÃstica puede rechazar el pedido. Asà no te deja publicar.`);const N=b?[]:lg(n,!!a.esServicio,a.pais,a.pago);if(N.length&&u.push({linea:n.split(` 55`).length,tipo:"ojo",texto:qv(N)+" Hasta entonces no te deja publicar."}),!N.length&&!a.esServicio&&!b&&fc(n)){const x=qS(n,a.pago);(x.frena||x.ojo)&&f(x.indice,"ojo",x.frena||x.ojo)}{const x=Wi(n),z=/<div\b[^>]*\bdata-lumy-campo\s*=\s*["']?politicas\b/i.test(x),G=/<a\b[^>]*\bhref\s*=\s*["']https?:\/\/[^"']+["'][^>]*>[^<]*(?:privacidad|privacy|pol[iÃ]tica)/i.test(x)||/<a\b[^>]*\bhref\s*=\s*["']https?:\/\/[^"']*(?:privacidad|privacy|politica)[^"']*["']/i.test(x);!z&&!G&&u.push({linea:1,tipo:"ojo",texto:'Tu página no enlaza la polÃtica de privacidad ni la de envÃos y devoluciones, y Meta y TikTok las exigen para aprobar los anuncios. Pon <div data-lumy-campo="politicas"></div> en tu pie y Lumy pone ahà esos enlaces, con los textos de tu paÃs.'})}if(!a.esServicio&&!b)for(const x of SS(n,a.pais,a.variantes||[]))f(x.indice,"ojo",wS(x.montos));
55{const x=WS(n,{pais:a.pais,esServicio:a.esServicio,esWhatsapp:a.esWhatsapp,variantes:a.variantes,quitados:a.quitados});x.length&&u.push({linea:1,tipo:"ojo",texto:lS(x,a.pais)})}if(a.whatsapp)for(const x of Yu(n,{tipo:"pagina",dominioPropio:a.dominioPropio,...a.whatsapp}).avisos)x.estado!=="conectado"&&u.push({linea:x.linea,tipo:"ojo",texto:x.texto});const w=u.sort((x,z)=>x.linea-z.linea);return b?w.filter(x=>!t5.test(x.texto)):w}const su={fontFamily:"ui-monospace, Menlo, Consolas, monospace",fontSize:12.5,lineHeight:"19px"},ib=19,Zr=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function o5(t){const a=t.match(/^(<\/?)([a-zA-Z][\w-]*)/);if(!a)return Zr(t);let n=Zr(a[1])+`<span class="c-tag">${Zr(a[2])}</span>`;const o=/(\s+)|([^\s=\/>"']+)(?:(\s*=\s*)("[^"]*"|'[^']*'|[^\s>"']*))?|([\s\S])/g,i=t.slice(a[0].length);let s;for(;s=o.exec(i);)s[1]?n+=s[1]:s[2]?(n+=`<span class="${/^data-lumy/i.test(s[2])?"c-lumy":"c-att"}">${Zr(s[2])}</span>`,s[3]!==void 0&&(n+=Zr(s[3])+(s[4]?`<span class="c-val">${Zr(s[4])}</span>`:""))):n+=Zr(s[5]||"");return n}function r5(t){const a=[],n=/(<!--[\s\S]*?-->)|(<\/?[a-zA-Z][^>]*>)/g;let o=0,i;for(;i=n.exec(t);)i.index>o&&a.push(`<span class="c-txt">${Zr(t.slice(o,i.index))}</span>`),a.push(i[1]?`<span class="c-com">${Zr(i[1])}</span>`:o5(i[2])),o=i.index+i[0].length;return o<t.length&&a.push(`<span class="c-txt">${Zr(t.slice(o))}</span>`),a.join("")+` 56`}const Hv=h.forwardRef(function({valor:a,onCambio:n,dominioPropio:o,esServicio:i,variantes:s,variantesConOpciones:u,conOfertas:m,cantidades:c,conAdicional:g,pais:f,esWhatsapp:b,quitados:v,pago:j,whatsapp:S,alto:$,revisar:C,placeholder:_},N){const w=h.useRef(null),M=h.useRef(null),p=h.useRef(null),[V,L]=h.useState([]);h.useImperativeHandle(N,()=>w.current);const x=h.useMemo(()=>Math.max(1,a.split(` 57`).length),[a]),z=h.useMemo(()=>r5(a),[a]);h.useEffect(()=>{const Q=setTimeout(()=>L(C?C(a):Ov(a,{dominioPropio:o,esServicio:i,variantes:s,variantesConOpciones:u,conOfertas:m,cantidades:c,conAdicional:g,pais:f,esWhatsapp:b,quitados:v,pago:j,whatsapp:S})),400);return()=>clearTimeout(Q)},[a,C,o,i,(s||[]).join("|"),JSON.stringify(u||[]),m,(c||[]).join("|"),g,f,b,(v||[]).join("|"),JSON.stringify(j||null),JSON.stringify(S||null)]);const G=()=>{const Q=w.current;Q&&(M.current&&(M.current.scrollTop=Q.scrollTop,M.current.scrollLeft=Q.scrollLeft),p.current&&(p.current.scrollTop=Q.scrollTop))},B=h.useRef(null);h.useLayoutEffect(()=>{const Q=B.current;if(Q==null)return;B.current=null;const de=w.current;if(de&&de.value===a)try{de.selectionStart=de.selectionEnd=Math.min(Q,de.value.length)}catch{}},[a]);const U=Q=>{const de=Q.currentTarget,pe=de.selectionStart,ce=de.selectionEnd,ve=(ge,Te)=>{Q.preventDefault();const ie=a.slice(0,pe)+ge+a.slice(ce);B.current=Te,n(ie)};if(Q.key==="Tab")return ve(" ",pe+2);if(Q.key==="Enter"){const ge=a.lastIndexOf(` 58`,pe-1)+1,Te=(a.slice(ge,pe).match(/^[ \t]*/)||[""])[0],fe=/<([a-zA-Z][\w-]*)[^>]*>$/.test(a.slice(ge,pe))&&!/\/>$/.test(a.slice(ge,pe))?" ":"";return ve(` 59`+Te+fe,pe+1+Te.length+fe.length)}},ne=V.filter(Q=>Q.tipo==="quita");return e.jsxs("div",{children:[e.jsx("div",{className:"lk-aurora",children:e.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",height:$,minHeight:320,background:"#0b1020",borderRadius:12,overflow:"hidden"},children:[e.jsx("div",{ref:p,"aria-hidden":"true",style:{...su,flex:"none",width:46,padding:"12px 8px 12px 0",textAlign:"right",color:"#43536f",background:"#080d1a",overflow:"hidden",userSelect:"none"},children:Array.from({length:x},(Q,de)=>e.jsx("div",{style:{height:ib,color:V.some(pe=>pe.linea===de+1)?ne.some(pe=>pe.linea===de+1)?"#f87171":"#fbbf24":void 0},children:de+1},de))}),e.jsxs("div",{style:{position:"relative",flex:1,minWidth:0},children:[e.jsxs("div",{className:"lk-fondo-codigo","aria-hidden":"true",children:[e.jsx("i",{}),e.jsx("i",{}),e.jsx("i",{})]}),e.jsx("pre",{ref:M,"aria-hidden":"true",style:{...su,position:"absolute",inset:0,margin:0,padding:"12px 14px",overflow:"auto",whiteSpace:"pre",color:"#e6edf7",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:z}}),e.jsx("textarea",{ref:w,value:a,onChange:Q=>n(Q.target.value),onScroll:G,onKeyDown:U,spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",placeholder:_||"Escribe o pega aquà el HTML de tu página.",style:{...su,position:"absolute",inset:0,width:"100%",height:"100%",margin:0,padding:"12px 14px",border:0,outline:"none",resize:"none",background:"transparent",color:"transparent",caretColor:"#7fd1ff",whiteSpace:"pre",overflow:"auto",tabSize:2}})]})]})}),V.length>0&&e.jsxs("div",{style:{marginTop:8,border:"1px solid var(--border, #e8eaf0)",borderRadius:11,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"7px 12px",fontSize:11,fontWeight:900,letterSpacing:".05em",textTransform:"uppercase",color:"var(--text-muted)",background:"var(--bg-tertiary, #f6f8fc)",borderBottom:"1px solid var(--border, #eef1f6)"},children:ne.length?`${ne.length} ${ne.length===1?"cosa que Lumy va a borrar":"cosas que Lumy va a borrar"}`:"Para tener en cuenta"}),e.jsx("div",{style:{maxHeight:132,overflowY:"auto"},children:V.map((Q,de)=>e.jsxs("button",{type:"button",onClick:()=>{const pe=w.current;
59if(!pe)return;const ce=a.split(` 60`).slice(0,Q.linea-1).join(` 61`).length+(Q.linea>1?1:0);pe.focus(),pe.selectionStart=pe.selectionEnd=ce,pe.scrollTop=Math.max(0,(Q.linea-3)*ib)},style:{display:"flex",gap:9,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"8px 12px",border:0,borderBottom:"1px solid var(--border, #f3f5f9)",background:"var(--card-bg, #fff)",cursor:"pointer",fontFamily:"inherit"},children:[e.jsxs("span",{style:{flex:"none",fontFamily:su.fontFamily,fontSize:11,fontWeight:800,color:Q.tipo==="quita"?"var(--danger, #dc2626)":"var(--warning, #b45309)"},children:[Q.tipo==="quita"?"â":"â¢"," ",Q.linea]}),e.jsx("span",{style:{fontSize:12,color:"var(--text-secondary, #64748b)",lineHeight:1.45},children:Q.texto})]},de))})]}),e.jsx("style",{children:` 62 .c-tag{color:#7fd1ff} 63 .c-att{color:#c3a6ff} 64 .c-val{color:#9be3a2} 65 .c-com{color:#5b6b88;font-style:italic} 66 .c-lumy{color:#ffc46b;font-weight:700} 67 .c-txt{color:#e6edf7} 68 /* OJO: esto vive DENTRO de un template literal. Nada de acentos graves en estos comentarios: 69 cierran la cadena y rompen el archivo entero (pasó el 21-sep-2026). */ 70 /* El marco: 1 px de aire alrededor del cuadro, fondo oscuro para que el oro se lea como luz, 71 y el halo por fuera (la sombra propia no la recorta el overflow). */ 72 .lk-aurora{position:relative;isolation:isolate;overflow:hidden;padding:1px;border-radius:13px;background:#0b1020; 73 box-shadow:0 0 0 1px rgba(212,175,55,.10),0 0 16px -5px rgba(232,196,95,.50),0 16px 38px -24px rgba(212,175,55,.70)} 74 /* La luz que gira: un cuadrado centrado que cubre el marco en cualquier ángulo (su lado es 75 mayor que la diagonal del marco). Hilo tenue siempre, una luz viva y un reflejo más suave. */ 76 .lk-aurora::before{content:'';position:absolute;left:50%;top:50%;width:max(145%,145vh);aspect-ratio:1/1;z-index:0;pointer-events:none; 77 transform:translate(-50%,-50%); 78 background:conic-gradient(from 0deg,rgba(201,162,39,.38) 0deg,rgba(232,196,95,.62) 32deg,rgba(201,162,39,.38) 72deg,rgba(201,162,39,.38) 160deg, 79 rgba(232,196,95,.85) 200deg,#f5d77f 218deg,#fff3cf 228deg,#f5d77f 238deg,rgba(232,196,95,.85) 256deg,rgba(201,162,39,.38) 300deg,rgba(201,162,39,.38) 360deg); 80 animation:lk-aurora-gira 9s linear infinite} 81 @keyframes lk-aurora-gira{from{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(360deg)}} 82 /* El fondo vivo del editor: luces grandes, tenues, que se cruzan muy despacio. Sin filtros 83 de desenfoque: el borde suave lo da el propio degradado, y moverlas no repinta nada. */ 84 .lk-fondo-codigo{position:absolute;inset:0;overflow:hidden;pointer-events:none} 85 .lk-fondo-codigo i{position:absolute;border-radius:50%;will-change:transform} 86 .lk-fondo-codigo i:nth-child(1){width:620px;height:360px;top:-150px;right:-140px; 87 background:radial-gradient(closest-side,rgba(232,196,95,.13),rgba(232,196,95,0));animation:lk-fondo-a 26s ease-in-out infinite alternate} 88 .lk-fondo-codigo i:nth-child(2){width:680px;height:440px;bottom:-210px;left:-170px; 89 background:radial-gradient(closest-side,rgba(124,92,246,.15),rgba(124,92,246,0));animation:lk-fondo-b 32s ease-in-out infinite alternate} 90 .lk-fondo-codigo i:nth-child(3){width:460px;height:320px;top:34%;left:40%; 91 background:radial-gradient(closest-side,rgba(26,115,255,.10),rgba(26,115,255,0));animation:lk-fondo-c 38s ease-in-out infinite alternate} 92 @keyframes lk-fondo-a{to{transform:translate(-260px,170px) scale(1.15)}} 93 @keyframes lk-fondo-b{to{transform:translate(280px,-160px) scale(1.2)}} 94 @keyframes lk-fondo-c{to{transform:translate(-220px,-100px) scale(.85)}} 95 /* Quien pidió menos movimiento en su sistema: el oro y las luces se quedan quietos. */ 96 @media (prefers-reduced-motion: reduce){ 97 .lk-aurora::before{animation:none} 98 .lk-fondo-codigo i{animation:none} 99 } 100 `})]})}),i5=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function s5(t){return t>=55296&&t<=57343||t>1114111?65533:i5.get(t)??t}function Gv(t){const a=atob(t),n=a.length&-2,o=new Uint16Array(n/2);for(let i=0,s=0;i<n;
100i+=2){const u=a.charCodeAt(i),m=a.charCodeAt(i+1);o[s++]=u|m<<8}return o}const l5=Gv
vendor: 32,204 bytes, line 100
100("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg")
100,d5=Gv("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");var jo;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.FLAG13=8192]="FLAG13",t[t.BRANCH_LENGTH=8064]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(jo||(jo={}));var gn;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(gn||(gn={}));const sb=32;function dg(t){return t>=gn.ZERO&&t<=gn.NINE}function c5(t){return t>=gn.UPPER_A&&t<=gn.UPPER_F||t>=gn.LOWER_A&&t<=gn.LOWER_F}function u5(t){return t>=gn.UPPER_A&&t<=gn.UPPER_Z||t>=gn.LOWER_A&&t<=gn.LOWER_Z||dg(t)}function p5(t){return t===gn.EQUALS||u5(t)}var Qn;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Qn||(Qn={}));var ti;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(ti||(ti={}));class g5{constructor(a,n,o){ra(this,"decodeTree");ra(this,"emitCodePoint");ra(this,"errors");ra(this,"state",Qn.EntityStart);ra(this,"consumed",1);ra(this,"result",0);ra(this,"treeIndex",0);ra(this,"excess",1);ra(this,"decodeMode",ti.Strict);ra(this,"runConsumed",0);this.decodeTree=a,this.emitCodePoint=n,this.errors=o}startEntity(a){this.decodeMode=a,this.state=Qn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(a,n){switch(this.state){case Qn.EntityStart:return a.charCodeAt(n)===gn.NUM?(this.state=Qn.NumericStart,this.consumed+=1,this.stateNumericStart(a,n+1)):(this.state=Qn.NamedEntity,this.stateNamedEntity(a,n));case Qn.NumericStart:return this.stateNumericStart(a,n);case Qn.NumericDecimal:return this.stateNumericDecimal(a,n);case Qn.NumericHex:return this.stateNumericHex(a,n);case Qn.NamedEntity:return this.stateNamedEntity(a,n)}}stateNumericStart(a,n){return n>
100=a.length?-1:(a.charCodeAt(n)|sb)===gn.LOWER_X?(this.state=Qn.NumericHex,this.consumed+=1,this.stateNumericHex(a,n+1)):(this.state=Qn.NumericDecimal,this.stateNumericDecimal(a,n))}stateNumericHex(a,n){for(;n<a.length;){const o=a.charCodeAt(n);if(dg(o)||c5(o)){const i=o<=gn.NINE?o-gn.ZERO:(o|sb)-gn.LOWER_A+10;this.result=this.result*16+i,this.consumed++,n++}else return this.emitNumericEntity(o,3)}return-1}stateNumericDecimal(a,n){for(;n<a.length;){const o=a.charCodeAt(n);if(dg(o))this.result=this.result*10+(o-gn.ZERO),this.consumed++,n++;else return this.emitNumericEntity(o,2)}return-1}emitNumericEntity(a,n){var o;if(this.consumed<=n)return(o=this.errors)==null||o.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(a===gn.SEMI)this.consumed+=1;else if(this.decodeMode===ti.Strict)return 0;return this.emitCodePoint(s5(this.result),this.consumed),this.errors&&(a!==gn.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(a,n){const{decodeTree:o}=this;let i=o[this.treeIndex],s=(i&jo.VALUE_LENGTH)>>14;for(;n<a.length;){if(s===0&&(i&jo.FLAG13)!==0){const m=(i&jo.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const c=i&jo.JUMP_TABLE;if(a.charCodeAt(n)!==c)return this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}for(;this.runConsumed<m;){if(n>=a.length)return-1;const c=this.runConsumed-1,g=o[this.treeIndex+1+(c>>1)],f=c%2===0?g&255:g>>8&255;if(a.charCodeAt(n)!==f)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();n++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(m>>1),i=o[this.treeIndex],s=(i&jo.VALUE_LENGTH)>>14}if(n>=a.length)break;const u=a.charCodeAt(n);if(u===gn.SEMI&&s!==0&&(i&jo.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=m5(o,i,this.treeIndex+Math.max(1,s),u),this.treeIndex<0)return this.result===0||this.decodeMode===ti.Attribute&&(s===0||p5(u))?0:this.emitNotTerminatedNamedEntity();if(i=o[this.treeIndex],s=(i&jo.VALUE_LENGTH)>>14,s!==0){if(u===gn.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==ti.Strict&&(i&jo.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}n++,this.excess++}return-1}emitNotTerminatedNamedEntity(){var i;const{result:a,decodeTree:n}=this,o=(n[a]&jo.VALUE_LENGTH)>>14;return this.emitNamedEntityData(a,o,this.consumed),(i=this.errors)==null||i.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(a,n,o){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[a]&~(jo.VALUE_LENGTH|jo.FLAG13):i[a+1],o),n===3&&this.emitCodePoint(i[a+2],o),o}end(){var a;switch(this.state){case Qn.NamedEntity:return this.result!==0&&(this.decodeMode!==ti.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Qn.NumericDecimal:return this.emitNumericEntity(0,2);case Qn.NumericHex:return this.emitNumericEntity(0,3);case Qn.NumericStart:return(a=this.errors)==null||a.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Qn.EntityStart:return 0}}}function m5(t,a,n,o){const i=(a&jo.BRANCH_LENGTH)>>7,s=a&jo.JUMP_TABLE;if(i===0)return s!==0&&o===s?n:-1;if(s){const g=o-s;return g<0||g>=i?-1:t[n+g]-1}const u=i+1>>1;let m=0,c=i-1;for(;m<=c;){const g=m+c>>>1,f=g>>1,v=t[n+f]>>(g&1)*8&255;if(v<o)m=g+1;else if(v>o)c=g-1;else return t[n+u+g]}return-1}var Wt;(function(t){t[t.Tab=9]="Tab",t[t.NewLine=10]="NewLine",t[t.FormFeed=12]="FormFeed",t[t.CarriageReturn=13]="CarriageReturn",t[t.Space=32]="Space",t[t.ExclamationMark=33]="ExclamationMark",t[t.Number=35]="Number",t[t.Amp=38]="Amp",t[t.SingleQuote=39]="SingleQuote",t[t.DoubleQuote=34]="DoubleQuote",t[t.Dash=45]="Dash",t[t.Slash=47]="Slash",t[t.Zero=48]="Zero",t[t.Nine=57]="Nine",t[t.Semi=59]="Semi",t[t.Lt=60]="Lt",t[t.Eq=61]="Eq",t[t.Gt=62]="Gt",t[t.Questionmark=63]="Questionmark",t[t.UpperA=65]="UpperA",t[t.LowerA=97]="LowerA",t[t.UpperF=70]="UpperF",t[t.LowerF=102]="LowerF",t[t.UpperZ=90]="UpperZ",t[t.LowerZ=122]="LowerZ",t[t.LowerX=120]="LowerX",t[t.OpeningSquareBracket=91]="OpeningSquareBracket"})(Wt||(Wt={}));var qe;(function(t){t[t.Text=1]="Text",t[t.BeforeTagName=2]="BeforeTagName",t[t.InTagName=3]="InTagName",t[t.InSelfClosingTag=4]="InSelfClosingTag",t[t.BeforeClosingTagName=5]="BeforeClosingTagName",t[t.InClosingTagName=6]="InClosingTagName",t[t.AfterClosingTagName=7]="AfterClosingTagName",t[t.BeforeAttributeName=8]="BeforeAttributeName",t[t.InAttributeName=9]="InAttributeName",t[t.AfterAttributeName=10]="AfterAttributeName",t[t.BeforeAttributeValue=11]="BeforeAttributeValue",t[t.InAttributeValueDq=12]="InAttributeValueDq",t[t.InAttributeValueSq=13]="InAttributeValueSq",t[t.InAttributeValueNq=14]="InAttributeValueNq",t[t.BeforeDeclaration=15]="BeforeDeclaration",t[t.InDeclaration=16]="InDeclaration",t[t.InProcessingInstruction=17]="InProcessingInstruction",t[t.BeforeComment=18]="BeforeComment",t[t.CDATASequence=19]="CDATASequence",t[t.DeclarationSequence=20]="DeclarationSequence",t[t.InSpecialComment=21]="InSpecialComment",t[t.InCommentLike=22]="InCommentLike",t[t.SpecialStartSequence=23]="SpecialStartSequence",t[t.InSpecialTag=24]="InSpecialTag",t[t.InPlainText=25]="InPlainText",t[t.InEntity=26]="InEntity"})(qe||(qe={}));function Ds(t){return t===Wt.Space||t===Wt.NewLine||t===Wt.Tab||t===Wt.FormFeed||t===Wt.CarriageReturn}function _l(t){return t===Wt.Slash||t===Wt.Gt||Ds(t)}function h5(t){return t>=Wt.LowerA&&t<=Wt.LowerZ||t>=Wt.UpperA&&t<=Wt.UpperZ}var ai;(function(t){t[t.NoValue=0]="NoValue",t[t.Unquoted=1]="Unquoted",t[t.Single=2]="Single",t[t.Double=3]="Double"})(ai||(ai={}));const ga={Empty:new Uint8Array(0),Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,33,62]),Doctype:new Uint8Array([100,
100111,99,116,121,112,101]),IframeEnd:new Uint8Array([60,47,105,102,114,97,109,101]),NoembedEnd:new Uint8Array([60,47,110,111,101,109,98,101,100]),NoframesEnd:new Uint8Array([60,47,110,111,102,114,97,109,101,115]),Plaintext:new Uint8Array([60,47,112,108,97,105,110,116,101,120,116]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])},f5=new Map([[ga.IframeEnd[2],ga.IframeEnd],[ga.NoembedEnd[2],ga.NoembedEnd],[ga.Plaintext[2],ga.Plaintext],[ga.ScriptEnd[2],ga.ScriptEnd],[ga.TitleEnd[2],ga.TitleEnd],[ga.XmpEnd[2],ga.XmpEnd]]);class x5{constructor({xmlMode:a=!1,decodeEntities:n=!0,recognizeSelfClosing:o=a},i){ra(this,"cbs");ra(this,"state",qe.Text);ra(this,"buffer","");ra(this,"sectionStart",0);ra(this,"index",0);ra(this,"entityStart",0);ra(this,"baseState",qe.Text);ra(this,"isSpecial",!1);ra(this,"running",!0);ra(this,"offset",0);ra(this,"xmlMode");ra(this,"decodeEntities");ra(this,"recognizeSelfClosing");ra(this,"entityDecoder");ra(this,"currentSequence",ga.Empty);ra(this,"sequenceIndex",0);this.cbs=i,this.xmlMode=a,this.decodeEntities=n,this.recognizeSelfClosing=o,this.entityDecoder=new g5(a?d5:l5,(s,u)=>this.emitCodePoint(s,u))}reset(){this.state=qe.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=qe.Text,this.isSpecial=!1,this.currentSequence=ga.Empty,this.sequenceIndex=0,this.running=!0,this.offset=0}write(a){this.offset+=this.buffer.length,this.buffer=a,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(a){a===Wt.Lt||!this.decodeEntities&&this.fastForwardTo(Wt.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=qe.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&a===Wt.Amp&&this.startEntity()}enterTagBody(){this.currentSequence===ga.Plaintext?(this.currentSequence=ga.Empty,this.state=qe.InPlainText):this.isSpecial?(this.state=qe.InSpecialTag,this.sequenceIndex=0):this.state=qe.Text}
100stateSpecialStartSequence(a){const n=a|32;if(this.sequenceIndex<this.currentSequence.length){if(n===this.currentSequence[this.sequenceIndex]){this.sequenceIndex++;return}if(this.sequenceIndex===3){if(this.currentSequence===ga.ScriptEnd&&n===ga.StyleEnd[3]){this.currentSequence=ga.StyleEnd,this.sequenceIndex=4;return}if(this.currentSequence===ga.TitleEnd&&n===ga.TextareaEnd[3]){this.currentSequence=ga.TextareaEnd,this.sequenceIndex=4;return}}else if(this.sequenceIndex===4&&this.currentSequence===ga.NoembedEnd&&n===ga.NoframesEnd[4]){this.currentSequence=ga.NoframesEnd,this.sequenceIndex=5;return}}else if(_l(a)){this.sequenceIndex=0,this.state=qe.InTagName,this.stateInTagName(a);return}this.isSpecial=!1,this.currentSequence=ga.Empty,this.sequenceIndex=0,this.state=qe.InTagName,this.stateInTagName(a)}stateCDATASequence(a){a===ga.Cdata[this.sequenceIndex]?++this.sequenceIndex===ga.Cdata.length&&(this.state=qe.InCommentLike,this.currentSequence=ga.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.xmlMode?(this.state=qe.InDeclaration,this.stateInDeclaration(a)):(this.state=qe.InSpecialComment,this.stateInSpecialComment(a)))}fastForwardTo(a){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===a)return!0;return this.index=this.buffer.length+this.offset-1,!1}emitComment(a){this.cbs.oncomment(this.sectionStart,this.index,a),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=qe.Text}stateInCommentLike(a){!this.xmlMode&&this.currentSequence===ga.CommentEnd&&this.sequenceIndex<=1&&this.index===this.sectionStart+this.sequenceIndex&&a===Wt.Gt?this.emitComment(this.sequenceIndex):this.currentSequence===ga.CommentEnd&&this.sequenceIndex===2&&a===Wt.Gt?this.emitComment(2):this.currentSequence===ga.CommentEnd&&this.sequenceIndex===this.currentSequence.length-1&&a!==Wt.Gt?this.sequenceIndex=+(a===Wt.Dash):a===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===ga.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,3),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=qe.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):a!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(a){return this.xmlMode?!_l(a):h5(a)}stateInSpecialTag(a){if(this.sequenceIndex===this.currentSequence.length){if(_l(a)){const n=this.index-this.currentSequence.length;if(this.sectionStart<n){const o=this.index;this.index=n,this.cbs.ontext(this.sectionStart,n),this.index=o}this.isSpecial=!1,this.sectionStart=n+2,this.stateInClosingTagName(a);return}this.sequenceIndex=0}(a|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===ga.TitleEnd||this.currentSequence===ga.TextareaEnd?this.decodeEntities&&a===Wt.Amp&&this.startEntity():this.fastForwardTo(Wt.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(a===Wt.Lt)}stateBeforeTagName(a){var n,o;if(a===Wt.ExclamationMark)this.state=qe.BeforeDeclaration,this.sectionStart=this.index+1;else if(a===Wt.Questionmark)this.xmlMode?(this.state=qe.InProcessingInstruction,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.state=qe.InSpecialComment,this.sectionStart=this.index);else if(this.isTagStartChar(a)){this.sectionStart=this.index;const i=this.xmlMode||(o=(n=this.cbs).isInForeignContext)!=null&&o.call(n)?void 0:f5.get(a|32);i===void 0?this.state=qe.InTagName:(this.isSpecial=!0,this.currentSequence=i,this.sequenceIndex=3,this.state=qe.SpecialStartSequence)}else a===Wt.Slash?this.state=qe.BeforeClosingTagName:(this.state=qe.Text,this.stateText(a))}stateInTagName(a){_l(a)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=qe.BeforeAttributeName,this.stateBeforeAttributeName(a))}stateBeforeClosingTagName(a){Ds(a)?this.xmlMode||(this.state=qe.InSpecialComment,this.sectionStart=this.index):a===Wt.Gt?(this.state=qe.Text,this.xmlMode||(this.sectionStart=this.index+1)):(this.state=this.isTagStartChar(a)?qe.InClosingTagName:qe.InSpecialComment,this.sectionStart=this.index)}
vendor: 2,166 bytes, line 100
100stateInClosingTagName(a){_l(a)&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=qe.AfterClosingTagName,this.stateAfterClosingTagName(a))}stateAfterClosingTagName(a){(a===Wt.Gt||this.fastForwardTo(Wt.Gt))&&(this.state=qe.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(a){a===Wt.Gt?(this.cbs.onopentagend(this.index),this.enterTagBody(),this.sectionStart=this.index+1):a===Wt.Slash?this.state=qe.InSelfClosingTag:Ds(a)||(this.state=qe.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(a){if(a===Wt.Gt){if(this.cbs.onselfclosingtag(this.index),this.sectionStart=this.index+1,!this.recognizeSelfClosing){this.enterTagBody();return}this.state=qe.Text,this.isSpecial=!1,this.currentSequence=ga.Empty}else Ds(a)||(this.state=qe.BeforeAttributeName,this.stateBeforeAttributeName(a))}stateInAttributeName(a){(a===Wt.Eq||_l(a))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=qe.AfterAttributeName,this.stateAfterAttributeName(a))}stateAfterAttributeName(a){a===Wt.Eq?this.state=qe.BeforeAttributeValue:a===Wt.Slash||a===Wt.Gt?(this.cbs.onattribend(ai.NoValue,this.sectionStart),this.sectionStart=-1,this.state=qe.BeforeAttributeName,this.stateBeforeAttributeName(a)):Ds(a)||(this.cbs.onattribend(ai.NoValue,this.sectionStart),this.state=qe.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(a){a===Wt.DoubleQuote?(this.state=qe.InAttributeValueDq,this.sectionStart=this.index+1):a===Wt.SingleQuote?(this.state=qe.InAttributeValueSq,this.sectionStart=this.index+1):Ds(a)||(this.sectionStart=this.index,this.state=qe.InAttributeValueNq,this.stateInAttributeValueNoQuotes(a))}handleInAttributeValue(a,n){a===n||!this.decodeEntities&&this.fastForwardTo(n)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(n===Wt.DoubleQuote?ai.Double:ai.Single,this.index+1),this.state=qe.BeforeAttributeName):this.decodeEntities&&a===Wt.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(a){this.handleInAttributeValue(a,Wt.DoubleQuote)}stateInAttributeValueSingleQuotes(a){this.handleInAttributeValue(a,Wt.
100SingleQuote)}stateInAttributeValueNoQuotes(a){Ds(a)||a===Wt.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(ai.Unquoted,this.index),this.state=qe.BeforeAttributeName,this.stateBeforeAttributeName(a)):this.decodeEntities&&a===Wt.Amp&&this.startEntity()}stateBeforeDeclaration(a){a===Wt.OpeningSquareBracket?(this.state=qe.CDATASequence,this.sequenceIndex=0):this.xmlMode?this.state=a===Wt.Dash?qe.BeforeComment:qe.InDeclaration:(a|32)===ga.Doctype[0]?(this.state=qe.DeclarationSequence,this.currentSequence=ga.Doctype,this.sequenceIndex=1):a===Wt.Gt?(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=qe.Text,this.sectionStart=this.index+1):a===Wt.Dash?this.state=qe.BeforeComment:this.state=qe.InSpecialComment}stateDeclarationSequence(a){this.sequenceIndex===this.currentSequence.length?(this.state=qe.InDeclaration,this.stateInDeclaration(a)):(a|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:a===Wt.Gt?(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=qe.Text,this.sectionStart=this.index+1):this.state=qe.InSpecialComment}stateInDeclaration(a){(a===Wt.Gt||this.fastForwardTo(Wt.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=qe.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(a){a===Wt.Questionmark?this.sequenceIndex=1:a===Wt.Gt&&this.sequenceIndex===1?(this.cbs.onprocessinginstruction(this.sectionStart,this.index-1),this.sequenceIndex=0,this.state=qe.Text,this.sectionStart=this.index+1):this.sequenceIndex=Number(this.fastForwardTo(Wt.Questionmark))}stateBeforeComment(a){a===Wt.Dash?(this.state=qe.InCommentLike,this.currentSequence=ga.CommentEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):this.xmlMode?this.state=qe.InDeclaration:a===Wt.Gt?(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=qe.Text,this.sectionStart=this.index+1):this.state=qe.InSpecialComment}stateInSpecialComment(a){(a===Wt.Gt||this.fastForwardTo(Wt.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=qe.Text,this.sectionStart=this.index+1)}startEntity(){this.baseState=this.state,this.state=qe.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?ti.Strict:this.baseState===qe.Text||this.baseState===qe.InSpecialTag?ti.Legacy:ti.Attribute)}stateInEntity(){const a=this.index-this.offset,n=this.entityDecoder.write(this.buffer,a);if(n>=0)this.state=this.baseState,n===0&&(this.index-=1);else{if(a<this.buffer.length&&this.buffer.charCodeAt(a)===Wt.Amp){this.state=this.baseState,this.index-=1;return}this.index=this.offset+this.buffer.length-1}}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===qe.Text||this.state===qe.InPlainText||this.state===qe.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===qe.InAttributeValueDq||this.state===qe.InAttributeValueSq||this.state===qe.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const a=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case qe.Text:{this.stateText(a);break}case qe.InPlainText:{this.index=this.buffer.length+this.offset-1;break}
100case qe.SpecialStartSequence:{this.stateSpecialStartSequence(a);break}case qe.InSpecialTag:{this.stateInSpecialTag(a);break}case qe.CDATASequence:{this.stateCDATASequence(a);break}case qe.DeclarationSequence:{this.stateDeclarationSequence(a);break}case qe.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(a);break}case qe.InAttributeName:{this.stateInAttributeName(a);break}case qe.InCommentLike:{this.stateInCommentLike(a);break}case qe.InSpecialComment:{this.stateInSpecialComment(a);break}case qe.BeforeAttributeName:{this.stateBeforeAttributeName(a);break}case qe.InTagName:{this.stateInTagName(a);break}case qe.InClosingTagName:{this.stateInClosingTagName(a);break}case qe.BeforeTagName:{this.stateBeforeTagName(a);break}case qe.AfterAttributeName:{this.stateAfterAttributeName(a);break}case qe.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(a);break}case qe.BeforeAttributeValue:{this.stateBeforeAttributeValue(a);break}case qe.BeforeClosingTagName:{this.stateBeforeClosingTagName(a);break}case qe.AfterClosingTagName:{this.stateAfterClosingTagName(a);break}case qe.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(a);break}case qe.InSelfClosingTag:{this.stateInSelfClosingTag(a);break}case qe.InDeclaration:{this.stateInDeclaration(a);break}case qe.BeforeDeclaration:{this.stateBeforeDeclaration(a);break}case qe.BeforeComment:{this.stateBeforeComment(a);break}case qe.InProcessingInstruction:{this.stateInProcessingInstruction(a);break}case qe.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===qe.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingCommentLikeData(a){if(this.state!==qe.InCommentLike)return!1;if(this.currentSequence===ga.CdataEnd)if(this.xmlMode)this.sectionStart<a&&this.cbs.oncdata(this.sectionStart,a,0);else{const n=this.sectionStart-ga.Cdata.length-1;this.cbs.oncomment(n,a,0)}else{const n=this.xmlMode?0:Math.min(this.sequenceIndex,ga.CommentEnd.length-1);this.cbs.oncomment(this.sectionStart,a,n)}return!0}
100handleTrailingMarkupDeclaration(a){if(this.xmlMode)switch(this.state){case qe.InSpecialComment:case qe.BeforeComment:case qe.CDATASequence:case qe.DeclarationSequence:case qe.InDeclaration:return this.cbs.ontext(this.sectionStart,a),!0;default:return!1}switch(this.state){case qe.BeforeDeclaration:case qe.InSpecialComment:case qe.BeforeComment:case qe.CDATASequence:return this.cbs.oncomment(this.sectionStart,a,0),!0;case qe.DeclarationSequence:return this.sequenceIndex!==ga.Doctype.length&&this.cbs.oncomment(this.sectionStart,a,0),!0;case qe.InDeclaration:return!0;default:return!1}}handleTrailingData(){const a=this.buffer.length+this.offset;if(!(this.handleTrailingCommentLikeData(a)||this.handleTrailingMarkupDeclaration(a))&&!(this.sectionStart>=a))switch(this.state){case qe.InTagName:case qe.BeforeAttributeName:case qe.BeforeAttributeValue:case qe.AfterAttributeName:case qe.InAttributeName:case qe.InAttributeValueSq:case qe.InAttributeValueDq:case qe.InAttributeValueNq:case qe.InClosingTagName:break;default:this.cbs.ontext(this.sectionStart,a)}}emitCodePoint(a,n){this.baseState!==qe.Text&&this.baseState!==qe.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+n,this.index=this.sectionStart-1,this.cbs.onattribentity(a)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+n,this.index=this.sectionStart-1,this.cbs.ontextentity(a,this.sectionStart))}}const{fromCodePoint:lb}=String,$l=new Set(["input","option","optgroup","select","button","datalist","textarea"]),vn=new Set(["p"]),Il=new Set(["h1","h2","h3","h4","h5","h6","p"]),db=new Set(["thead","tbody"]),cb=new Set(["dd","dt"]),ub=new Set(["rt","rp"]),b5=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["a",new Set(["a"])],["li",new Set(["li"])],["p",vn],["h1",Il],["h2",Il],["h3",Il],["h4",Il],["h5",Il],["h6",Il],["select",$l],["input",$l],["output",$l],["button",$l],["datalist",$l],["textarea",$l],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",cb],["dt",cb],["address",vn],["article",vn],["aside",vn],["blockquote",vn],["details",vn],["div",vn],["dl",vn],["fieldset",vn],["figcaption",vn],["figure",vn],["footer",vn],["form",vn],["header",vn],["hr",vn],["main",vn],["nav",vn],["ol",vn],["pre",vn],["section",vn],["table",vn],["ul",vn],["rt",ub],["rp",ub],["tbody",db],["tfoot",db]]),pb="doctype",y5=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),v5=new Set(["math","svg"]),gb=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),mb=new Map([["altglyph","altGlyph"],["altglyphdef","altGlyphDef"],["altglyphitem","altGlyphItem"],["animatecolor","animateColor"],["animatemotion","animateMotion"],["animatetransform","animateTransform"],["clippath","clipPath"],["feblend","feBlend"],["fecolormatrix","feColorMatrix"],["fecomponenttransfer","feComponentTransfer"],["fecomposite","feComposite"],["feconvolvematrix","feConvolveMatrix"],["fediffuselighting","feDiffuseLighting"],["fedisplacementmap","feDisplacementMap"],["fedistantlight","feDistantLight"],["fedropshadow","feDropShadow"],["feflood","feFlood"],["fefunca","feFuncA"],["fefuncb","feFuncB"],["fefuncg","feFuncG"],["fefuncr","feFuncR"],["fegaussianblur","feGaussianBlur"],["feimage","feImage"],["femerge","feMerge"],["femergenode","feMergeNode"],["femorphology","feMorphology"],["feoffset","feOffset"],["fepointlight","fePointLight"],["fespecularlighting","feSpecularLighting"],["fespotlight","feSpotLight"],["fetile","feTile"],["feturbulence","feTurbulence"],["foreignobject","foreignObject"],["glyphref","glyphRef"],["lineargradient","linearGradient"],["radialgradient","radialGradient"],["textpath","textPath"]]);var zi;(function(t){t[t.None=0]="None",t[t.Svg=1]="Svg",t[t.MathML=2]="MathML"})(zi||(zi={}));const j5=/\s|\//;class A5{constructor(a,n={}){ra(this,"options");ra(this,"startIndex",0);ra(this,"endIndex",0);ra(this,"openTagStart",0);ra(this,"tagname","");ra(this,"attribname","");ra(this,"attribvalue","");ra(this,"attribs",null);ra(this,"stack",[]);ra(this,"foreignContext");ra(this,"cbs");ra(this,"lowerCaseTagNames");ra(this,"lowerCaseAttributeNames");ra(this,"recognizeSelfClosing");ra(this,"htmlMode");ra(this,"tokenizer");ra(this,"buffers",[]);ra(this,"bufferOffset",0);ra(this,"writeIndex",0);ra(this,"ended",!1);var o,i;this.options=n,this.cbs=a??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=n.lowerCaseTags??this.htmlMode,this.lowerCaseAttributeNames=n.lowerCaseAttributeNames??this.htmlMode,this.recognizeSelfClosing=n.recognizeSelfClosing??!this.htmlMode,this.tokenizer=new(n.Tokenizer??x5)(this.options,this),this.foreignContext=[zi.None],(i=(o=this.cbs).onparserinit)==null||i.call(o,this)}ontext(a,n){var i,s;const o=this.getSlice(a,n);this.endIndex=n-1,(s=(i=this.cbs).ontext)==null||s.call(i,o),this.startIndex=n}
100ontextentity(a,n){var o,i;this.endIndex=n-1,(i=(o=this.cbs).ontext)==null||i.call(o,lb(a)),this.startIndex=n}isInForeignContext(){return this.foreignContext[0]!==zi.None}isVoidElement(a){return this.htmlMode&&y5.has(a)}readTagName(a,n){const o=this.lowerCaseTagNames?this.getSlice(a,n).toLowerCase():this.getSlice(a,n);if(!(this.lowerCaseTagNames&&this.htmlMode))return o;if(this.foreignContext[0]===zi.Svg)return mb.get(o)??o;if(this.foreignContext.length>1){const i=mb.get(o);if(i!==void 0&&this.stack.includes(i))return i}return this.isInForeignContext()?o:o==="image"?"img":o}onopentagname(a,n){this.endIndex=n,this.emitOpenTag(this.readTagName(a,n))}emitOpenTag(a){var o,i;if(this.openTagStart=this.startIndex,this.tagname=a,this.htmlMode&&a==="form"&&this.stack.includes("form")){this.tagname="";return}const n=this.htmlMode&&b5.get(a);if(n)for(;this.stack.length>0&&n.has(this.stack[0]);)this.popElement(!0);this.isVoidElement(a)||(this.stack.unshift(a),this.htmlMode&&(a==="svg"?this.foreignContext.unshift(zi.Svg):a==="math"?this.foreignContext.unshift(zi.MathML):gb.has(a)&&this.foreignContext.unshift(zi.None))),(i=(o=this.cbs).onopentagname)==null||i.call(o,a),this.cbs.onopentag&&(this.attribs={})}endOpenTag(a){var n,o;this.startIndex=this.openTagStart,this.attribs&&((o=(n=this.cbs).onopentag)==null||o.call(n,this.tagname,this.attribs,a),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(a){this.endIndex=a,this.endOpenTag(!1),this.startIndex=a+1}onclosetag(a,n){var i,s,u,m,c,g;this.endIndex=n;const o=this.readTagName(a,n);if(this.isVoidElement(o))this.htmlMode&&o==="br"&&((s=(i=this.cbs).onopentagname)==null||s.call(i,"br"),(m=(u=this.cbs).onopentag)==null||m.call(u,"br",{},!0),(g=(c=this.cbs).onclosetag)==null||g.call(c,"br",!1));else{const f=this.stack.indexOf(o);if(f!==-1){for(let b=0;b<f;b++)this.popElement(!0);this.popElement(!1)}else this.htmlMode&&o==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=n+1}onselfclosingtag(a){this.endIndex=a,this.recognizeSelfClosing||this.isInForeignContext()?(this.closeCurrentTag(!1),this.startIndex=a+1):this.onopentagend(a)}popElement(a){var o,i;const n=this.stack.shift();this.htmlMode&&(v5.has(n)||gb.has(n))&&this.foreignContext.shift(),(i=(o=this.cbs).onclosetag)==null||i.call(o,n,a)}closeCurrentTag(a){const n=this.tagname;this.endOpenTag(a),this.stack[0]===n&&this.popElement(!a)}onattribname(a,n){this.startIndex=a;const o=this.getSlice(a,n);this.attribname=this.lowerCaseAttributeNames?o.toLowerCase():o}onattribdata(a,n){this.attribvalue+=this.getSlice(a,n)}onattribentity(a){this.attribvalue+=lb(a)}onattribend(a,n){var o,i;this.endIndex=n,(i=(o=this.cbs).onattribute)==null||i.call(o,this.attribname,this.attribvalue,a===ai.Double?'"':a===ai.Single?"'":a===ai.NoValue?void 0:null),this.attribs&&!Object.hasOwn(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(a){const n=a.search(j5);let o=n<0?a:a.substr(0,n);return this.lowerCaseTagNames&&(o=o.toLowerCase()),o}ondeclaration(a,n){this.endIndex=n;const o=this.getSlice(a,n);if(this.cbs.onprocessinginstruction){const i=this.htmlMode?this.lowerCaseTagNames?pb:o.slice(0,pb.length):this.getInstructionName(o);this.cbs.onprocessinginstruction(`!${i}`,`!${o}`)}this.startIndex=n+1}onprocessinginstruction(a,n){this.endIndex=n;const o=this.getSlice(a,n);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(o);this.cbs.onprocessinginstruction(`?${i}`,`?${o}`)}this.startIndex=n+1}oncomment(a,n,o){var i,s,u,m;this.endIndex=n,(s=(i=this.cbs).oncomment)==null||s.call(i,this.getSlice(a,n-o)),(m=(u=this.cbs).oncommentend)==null||m.call(u),this.startIndex=n+1}oncdata(a,n,o){var s,u,m,c,g,f,b,v,j,S,$,C;this.endIndex=n;const i=this.getSlice(a,n-o);!this.htmlMode||this.options.recognizeCDATA?((u=(s=this.cbs).oncdatastart)==null||u.call(s),(c=(m=this.cbs).ontext)==null||c.call(m,i),(f=(g=this.cbs).oncdataend)==null||f.call(g)):this.isInForeignContext()?(v=(b=this.cbs).ontext)==null||v.call(b,i):((S=(j=this.cbs).oncomment)==null||S.call(j,`[CDATA[${i}]]`),(C=($=this.cbs).oncommentend)==null||C.call($)),this.startIndex=n+1}onend(){var a,n;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let o=0;o<this.stack.length;o++)this.cbs.onclosetag(this.stack[o],!0)}(n=(a=this.cbs).onend)==null||n.call(a)}reset(){var a,n,o,i;(n=(a=this.cbs).onreset)==null||n.call(a),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(i=(o=this.cbs).onparserinit)==null||i.call(o,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(zi.None),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(a){this.reset(),this.end(a)}getSlice(a,n){if(a===n)return"";for(;a-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let o=this.buffers[0].slice(a-this.bufferOffset,n-this.bufferOffset);for(;n-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),o+=this.buffers[0].slice(0,n-this.bufferOffset);return o}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(a){var n,o;if(this.ended){(o=(n=this.cbs).onerror)==null||o.call(n,new Error(".write() after done!"));return}this.buffers.push(a),this.tokenizer.running&&(this.tokenizer.write(a),this.writeIndex++)}end(a){var n,o;if(this.ended){(o=(n=this.cbs).onerror)==null||o.call(n,new Error(".end() after done!"));return}a&&this.write(a),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}}const S5=`<style> 101 @import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,[email protected],500;9..144,700&family=Manrope:wght@400;600;800&display=swap"); 102 :root{--fondo:#faf8f5;--tinta:#1d1b19;--suave:#6f6a64;--linea:#e8e2da;--acento:#1d1b19;--tarjeta:#ffffff} 103 *{box-sizing:border-box} 104 body{margin:0;background:var(--fondo);color:var(--tinta);font-family:Manrope,system-ui,sans-serif} 105 .tope{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:14px;padding:14px clamp(16px,4vw,48px);background:var(--fondo);border-bottom:1px solid var(--linea)}
106 .marca{font-family:Fraunces,Georgia,serif;font-size:22px;font-weight:700;letter-spacing:-.01em;margin-right:auto} 107 .bolsa{position:relative;border:1px solid var(--linea);background:var(--tarjeta);border-radius:999px;padding:9px 16px;font:inherit;font-weight:800;cursor:pointer} 108 .bolsa b{display:inline-grid;place-items:center;min-width:20px;height:20px;margin-left:6px;border-radius:999px;background:var(--acento);color:#fff;font-size:11px} 109 .portada{padding:clamp(40px,8vw,96px) clamp(16px,4vw,48px) 28px;max-width:1180px;margin:0 auto} 110 .portada h1{font-family:Fraunces,Georgia,serif;font-size:clamp(38px,7vw,76px);line-height:1;letter-spacing:-.02em;margin:0 0 14px;font-weight:500} 111 .portada p{color:var(--suave);font-size:17px;max-width:520px;margin:0} 112 .filtros{display:flex;gap:8px;flex-wrap:wrap;max-width:1180px;margin:0 auto;padding:0 clamp(16px,4vw,48px) 18px} 113 .filtros button{border:1px solid var(--linea);background:transparent;border-radius:999px;padding:8px 15px;font:inherit;font-size:14px;cursor:pointer;color:var(--tinta)} 114 .filtros button.lumy-activo{background:var(--tinta);color:#fff;border-color:var(--tinta)} 115 .buscar{margin-left:auto;border:1px solid var(--linea);background:var(--tarjeta);border-radius:999px;padding:8px 15px;font:inherit;font-size:14px;
115min-width:200px} 116 .rejilla{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:22px;max-width:1180px;margin:0 auto;padding:0 clamp(16px,4vw,48px) 60px} 117 .producto{display:flex;flex-direction:column;gap:10px} 118 .foto{position:relative;aspect-ratio:4/5;border-radius:18px;overflow:hidden;background:#efe9e1} 119 .foto img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .45s ease,transform .8s cubic-bezier(.2,.7,.2,1)} 120 .foto img+img{opacity:0} 121 .producto:hover .foto img:first-child{transform:scale(1.04)} 122 .producto:hover .foto img+img{opacity:1} 123 .sello{position:absolute;top:12px;left:12px;background:#fff;color:var(--tinta);font-size:12px;font-weight:800;padding:5px 10px;border-radius:999px} 124 .nombre{font-weight:600;font-size:15px;margin:2px 0 0} 125 .precios{display:flex;gap:8px;align-items:baseline} 126 .precios b{font-size:16px}.precios s{color:var(--suave);font-size:13px} 127 .acciones{display:flex;gap:8px} 128 .acciones button{flex:1;border-radius:12px;padding:11px;font:inherit;font-weight:800;cursor:pointer;transition:transform .15s ease} 129 .agregar{background:var(--acento);color:#fff;border:0} 130 .ver{background:transparent;border:1px solid var(--linea);color:var(--tinta)} 131 .acciones button:active{transform:scale(.97)} 132 .lumy-agregado{outline:2px solid var(--acento);outline-offset:2px} 133 .vacio{max-width:1180px;margin:0 auto;padding:40px clamp(16px,4vw,48px);color:var(--suave)} 134 .pie{border-top:1px solid var(--linea);padding:34px clamp(16px,4vw,48px);display:flex;flex-wrap:wrap;gap:18px;align-items:center;color:var(--suave);font-size:14px} 135 .pie [data-lumy-politicas]{display:flex;flex-wrap:wrap;gap:12px} 136 .pie [data-lumy-politicas] button{background:none;border:0;padding:0;font:inherit;color:var(--suave);text-decoration:underline;cursor:pointer} 137 @media (max-width:560px){.rejilla{grid-template-columns:1fr 1fr;gap:12px}.acciones{flex-direction:column}.buscar{min-width:0;width:100%;margin-left:0}} 138</style> 139 140<header class="tope"> 141 <span class="marca">{{tienda.nombre}}</span> 142 <button class="bolsa" data-lumy-carrito>Bolsa <b data-lumy-carrito-cantidad>0</b></button> 143</header> 144 145<section class="portada" data-lumy="aparecer"> 146 <h1>{{tienda.nombre}}</h1> 147 <p>{{tienda.frase}}</p> 148</section> 149 150<nav class="filtros" data-lumy-categorias> 151 <button data-lumy-filtro="">Todo</button> 152 <button data-lumy-molde>{{categoria.nombre}}</button> 153 <input class="buscar" type="search" placeholder="Buscar" data-lumy-buscar> 154</nav> 155 156<main class="rejilla" data-lumy-productos="todos" data-lumy="aparecer-hijos"> 157 <article class="producto" data-lumy-molde> 158 <a class="foto" data-lumy-ver> 159 <img data-lumy-si="foto" data-lumy-src="producto.imagen" alt="{{producto.nombre}}" loading="lazy"> 160 <img data-lumy-si="foto2" data-lumy-src="producto.imagen2" alt="" loading="lazy"> 161 <span class="sello" data-lumy-si="oferta">-{{producto.descuento}}</span> 162 </a> 163 <p class="nombre">{{producto.nombre}}</p> 164 <div class="precios"><b>{{producto.precio}}</b><s data-lumy-si="oferta">{{producto.precio_antes}}</s></div> 165 <div class="acciones"> 166 <button class="agregar" data-lumy-agregar>Agregar</button> 167 <button class="ver" data-lumy-ver>Ver</button> 168 </div> 169 </article> 170 <p class="vacio" data-lumy-vacio>Muy pronto verás los productos aquÃ.</p> 171</main> 172<p class="vacio" data-lumy-sin-resultados>No encontramos productos con esa búsqueda.</p> 173 174<footer class="pie"> 175 <span>© {{tienda.nombre}}</span> 176 <nav data-lumy-politicas></nav> 177</footer> 178`,cg=[{grupo:"Listas de productos",marcas:[{codigo:'<div data-lumy-productos="todos">â¦moldeâ¦</div>',que:"Repite el molde (el primer elemento de adentro, o el que tenga data-lumy-molde) por cada producto de tu tienda."},{codigo:'data-lumy-productos="categoria:Vestidos"',que:"Solo los de esa categorÃa (por nombre)."},{codigo:'data-lumy-productos="oferta" · "mas-vendidos" · "nuevos"',que:"Los que tienen precio de antes, los más pedidos o los más recientes."},{codigo:'data-lumy-productos="ids:12,15,9"',que:"Estos productos, en este orden (los ids salen en la pestaña Productos)."},{codigo:'data-limite="8"',que:"Cuántos como máximo."},{codigo:"data-lumy-molde",que:"Marca cuál elemento se repite (si no, se repite el primero)."},{codigo:"data-lumy-vacio",que:"Se muestra solo si la lista queda sin productos."}]},{grupo:"Datos del producto (dentro del molde)",marcas:[{codigo:"{{producto.nombre}}",que:"El nombre."},{codigo:"{{producto.precio}} · {{producto.precio_antes}}",que:"El precio con la moneda de tu paÃs, y el de antes (vacÃo
178si no tiene)."},{codigo:"{{producto.descuento}} · {{producto.ahorro}}",que:"El % de descuento y cuánto se ahorra."},{codigo:'<img data-lumy-src="producto.imagen">',que:"La foto principal. producto.imagen2 = la segunda (para el efecto al pasar el mouse)."},{codigo:"{{producto.descripcion}} · {{producto.categoria}}",que:"El texto del producto y el nombre de su categorÃa."},{codigo:"{{producto.url}} · {{producto.id}}",que:"La dirección de su ficha y su id."},{codigo:'data-lumy-si="oferta" · "foto" · "foto2" · "variantes" · "nuevo" · "mas-vendido" · "descripcion"',que:"El elemento sale solo si se cumple (data-lumy-si-no = al revés)."}]},{grupo:"Botones (dentro del molde)",marcas:[{codigo:"<button data-lumy-agregar>Agregar</button>",que:"Agrega al carrito. Si tiene tallas o colores, primero pregunta cuál."},{codigo:"<button data-lumy-ver>Ver</button>",que:"Abre la vista rápida: fotos, variantes, descripción y compra."},{codigo:"<a data-lumy-enlace>",que:"Un enlace a la ficha del producto."},{codigo:".lumy-agregado",que:"Clase que el botón recibe 1 segundo al agregar (para tu animación)."}]},{grupo:"CategorÃas, filtros y buscador",marcas:[{codigo:"<nav data-lumy-categorias><button data-lumy-molde>{{categoria.nombre}}</button></nav>",que:"Un botón por categorÃa con productos; al tocarlo filtra."},{codigo:"{{categoria.imagen}} · {{categoria.cantidad}}",que:"Foto y cuántos productos tiene."},{codigo:'<button data-lumy-filtro="">Todo</button>',que:"Quita el filtro. El botón activo lleva la clase lumy-activo."},{codigo:"<input data-lumy-buscar>",que:"Buscador por nombre, en vivo."},{codigo:"data-lumy-sin-resultados",que:"Se muestra cuando el filtro o la búsqueda no encuentran nada."}]},{grupo:"Carrito y tienda",marcas:[{codigo:"<button data-lumy-carrito>Bolsa <b data-lumy-carrito-cantidad>0</b></button>",que:"Abre el carrito y muestra cuántos productos lleva. Si no lo pones, queda el botón flotante de siempre."},{codigo:"{{tienda.nombre}} · {{tienda.frase}} · {{tienda.anuncio}}",que:"Los datos de tu tienda."},{codigo:'<img data-lumy-src="tienda.logo"> · <a data-lumy-whatsapp>',que:"Tu logo y un enlace a tu WhatsApp."},{codigo:"<nav data-lumy-politicas></nav>",que:"Los enlaces a tus polÃticas, que abren en ventana."}]},{grupo:"Lo que pone Lumy (tú le das estilo)",marcas:[{codigo:".cart-sheet · .cart-panel · .cart-fab",que:"El carrito: cantidades, envÃo, descuentos, cupones, regalo, pago en lÃnea y el formulario de envÃo de tu paÃs. Se configura en Tu tienda â Carrito y ofertas; con tu CSS cambias cómo se ve.",soloParaLeer:!0},{codigo:"#pvSheet · .pv-gal · .pv-â¦",que:"La vista rápida de cada producto (la abre data-lumy-ver): fotos, tallas y colores, precio, descripción y comprar. Sus datos salen del producto (Productos â Editar).",soloParaLeer:!0},{codigo:".cart-win · .cw-card",que:"Los avisos por tiempo y la plaquita al llegar al envÃo gratis (Tu tienda â Avisos por tiempo).",soloParaLeer:!0},{codigo:"{{producto.precio}} y los demás datos",que:"Nunca a mano: si cambias un precio en Lumy, tu tienda cambia sola y el carrito cobra esa misma cifra, c
178on la moneda de tu paÃs.",soloParaLeer:!0}]},{grupo:"Movimiento",marcas:[{codigo:'data-lumy="aparecer" · "aparecer-hijos" · "marquesina" · "carrusel"â¦',que:"Las mismas recetas de movimiento de las landings en código. Y todo el CSS que quieras: @keyframes, transiciones, hover."},{codigo:"<script>",que:"Tu JavaScript corre en tu dominio propio. En lumycol.com se quita (lo comparten todas las tiendas)."}]}],w5=["data-lumy-productos","data-lumy-categorias","data-lumy-molde","data-lumy-vacio","data-limite","data-lumy-agregar","data-lumy-ver","data-lumy-enlace","data-lumy-carrito","data-lumy-carrito-cantidad","data-lumy-filtro","data-lumy-buscar","data-lumy-sin-resultados","data-lumy-politicas","data-lumy-whatsapp","data-lumy-si","data-lumy-si-no","data-lumy-text","data-lumy-src","data-lumy"],k5=/no te deja publicar/i,C5=["form","template","noscript","object","embed"],Vv=["cartFab","cartBadge","cartSheet","cartItems","cartTotal","cartView","cartCheckout","cartDone","cartWin","cartGo","cartSubmit","cartClose","cartTitle","qbSheet","pvSheet","pvGal","pvName","pvPrice","stfModal","stfClose","lzProxies","addToast","addrHint","addrPhotoBtn","addrPhotoHint","addrPhotoInp","addrPhotoTx","addrSug","awB","awIco","awM","awX","cartBack","cartDiscL","cartDiscRow","cartDiscV","cartGiftRow","cartGiftV","cartPayGo","cartPayLbl","cartShip","cartShipFill","cartShipMandNote","cartShipRow","cartShipV","cartSubRow","cartSubV","cartTotal2","cartWa","cf_err","cpnGo","cpnIn","cpnMsg","cpsBtns","cpsShipBtns","cwBtn","cwMsg","cwTitle","cwX","fviv","fvivMsg","pvAdd","pvComp","pvCount","pvDesc","pvFoot","pvFootAlt","pvFootWrap","pvMinus","pvNext","pvPay","pvPlus","pvPrev","pvQty","pvRate","pvRelated","pvRevs","pvSave","pvShare","pvThumbs","pvVars","pvWa","pvX2","qbAdd","qbClose","qbImg","qbMinus","qbName","qbPlus","qbPrice","qbQty","qbVars","refHint","stfp0","stfp1","stfp2","stfp3","stfp4","stfp5","stfp6","stfp7","stfp8","stfp9","stfp10","stfp11"],_5=["catalogo"],hb=["nombre","precio","precio_antes","descuento","ahorro","descripcion","imagen","imagen2","url","id","categoria"],fb=["nombre","frase","logo","anuncio","whatsapp","productos"],xb=["nombre","imagen","cantidad","id"],$5=/^(?:|todos|oferta|mas-vendidos|nuevos|categoria:.+|ids:[\d,\s]+)$/i,I5=25e5;function bb(t,a={}){const n=String(t||"");if(!n.trim())return[];const o=Wv(n),i=[0];for(let w=0;w<n.length;w++)n.charCodeAt(w)===10&&i.push(w+1);const s=w=>{let M=0,p=i.length-1;for(;M<p;){const V=M+p+1>>1;i[V]<=w?M=V:p=V-1}return M+1};if(o)return[{linea:n.length>qs&&/Lumy publica hasta/.test(o)?s(qs):1,tipo:"ojo",texto:o+" Asà no te deja publicar."}];const u=[],m=new Set,c=(w,M,p)=>{const V=s(w),L=`${V}\0${p}`;m.has(L)||(m.add(L),u.push({linea:V,tipo:M,texto:p}))},g=[],f=[],b=[];let v=!1,j=!1;const S=new A5({onopentag(w,M){const p=f.length?f[f.length-1]:-1,V=p>=0?g[p]:null,L=String(w).toLowerCase(),x=!!V&&(V.enLista||Object.prototype.hasOwnProperty.call(V.attrs,"data-lumy-productos")),z=!!V&&(V.enCategorias||Object.prototype.hasOwnProperty.call(V.attrs,"data-lumy-categorias"));g.push({tag:L,attrs:{...M},inicio:S.startIndex,padre:p,enLista:x,enCategorias:z}),f.push(g.length-1),L==="style"&&(v=!0),L==="script"&&(j=!0)},onclosetag(w){const M=String(w).toLowerCase();for(let p=f.length-1;p>=0;p--)if(g[f[p]].tag===M){f.length=p;break}M==="style"&&(v=!1),M==="script"&&(j=!1)},ontext(w){if(v||j)return;const M=f.length?f[f.length-1]:-1,p=M>=0?g[M]:null;b.push({texto:w,inicio:S.startIndex,enLista:!!p&&(p.enLista||Object.prototype.hasOwnProperty.call(p.attrs,"data-lumy-productos")),enCategorias:!!p&&(p.enCategorias||Object.prototype.hasOwnProperty.call(p.attrs,"data-lumy-categorias"))})}},{lowerCaseTags:!0,lowerCaseAttributeNames:!0,recognizeSelfClosing:!0,decodeEntities:!0});S.write(n),S.end();for(const w of g){if(C5.includes(w.tag)&&c(w.inicio,"quita",w.tag==="form"?"Lumy quita el <form>: el pedido lo toma el carrito de la tienda. Usa botones con data-lumy-agregar.":`Lumy borra <${w.tag}> al publicar.`),w.tag==="link"){const M=String(w.attrs.rel||""),p=String(w.attrs.href||"");/stylesheet/i.test(M)&&/^https:\/\/fonts\.googleapis\.com\//i.test(p)||c(w.inicio,"quita","
178Lumy quita este <link>. Las fuentes de Google sà se admiten (se convierten en @import).")}w.tag==="iframe"&&!/^https:\/\/(?:(?:www\.)?youtube\.com\/embed\/|(?:www\.)?youtube-nocookie\.com\/embed\/|player\.vimeo\.com\/video\/|(?:www\.)?tiktok\.com\/embed\/|(?:iframe|player)\.mediadelivery\.net\/embed\/|www\.google\.com\/maps\/embed\?|maps\.google\.com\/maps\?)/i.test(String(w.attrs.src||""))&&c(w.inicio,"quita","Este iframe se quita. Solo se admiten YouTube, Vimeo, TikTok, Bunny/MediaDelivery y Google Maps."),!a.dominioPropio&&Object.keys(w.attrs).some(M=>/^on[a-z]+$/.test(M))&&c(w.inicio,"quita","Los eventos escritos en la etiqueta (onclick y demás) solo corren en tu dominio propio. En lumycol.com se quitan: usa CSS y las recetas data-lumy."),w.tag==="script"&&(a.dominioPropio?w.attrs.src&&!/^https:\/\//i.test(String(w.attrs.src))&&c(w.inicio,"quita","Las librerÃas externas tienen que usar https://. Este src se elimina."):c(w.inicio,"quita","Tu JavaScript solo corre en TU dominio conectado a la tienda (Publicar y dirección). En lumycol.com se quita, y tu tienda quedarÃa a medias: asà no te deja publicar. Conéctalo o quita el <script>.")),w.attrs.id&&Vv.includes(String(w.attrs.id))?c(w.inicio,"ojo",`El id «${w.attrs.id}» lo usa el carrito de Lumy: con el tuyo se pisan y el botón de confirmar puede quedar muerto. Cámbiale el nombre: asà no te deja publicar.`):w.attrs.id&&_5.includes(String(w.attrs.id))&&c(w.inicio,"ojo",`El id «${w.attrs.id}» también lo usa la tienda de Lumy. Mejor cámbiale el nombre.`),a.carritoApagado&&Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-carrito")&&c(w.inicio,"ojo","Tu carrito está apagado: este botón no abre nada. ActÃvalo en Tu tienda â Carrito y ofertas, o quÃtalo.");for(const M of Object.keys(w.attrs))!M.startsWith("data-lumy")||M==="data-lumy"||M==="data-limite"||!w5.includes(M)&&!/^data-lumy-ln$/.test(M)&&c(w.inicio,"ojo",`Lumy no conoce «${M}» en la tienda. Revisa la guÃa (pestaña GuÃa).`);Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-productos")&&!$5.test(String(w.attrs["data-lumy-productos"]).trim())&&c(w.inicio,"ojo",`data-lumy-productos="${w.attrs["data-lumy-productos"]}" no es una lista que Lumy entienda: usa todos, categoria:Nombre, oferta, mas-vendidos, nuevos o ids:12,15.`),(Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-agregar")||Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-ver")||Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-enlace"))&&!w.enLista&&c(w.inicio,"ojo","Este botón no está dentro de una lista de productos (data-lumy-productos): no sabe qué producto agregar ni cuál abrir."),(w.attrs["data-lumy-src"]||"").startsWith("producto.")&&!w.enLista&&c(w.inicio,"ojo","Esta foto de producto está fuera de una lista de productos: queda vacÃa.")}const $=w=>{const M=g.findIndex((p,V)=>V>w&&!C(V,w));return M<0?n.length:g[M].inicio},C=(w,M)=>{let p=g[w].padre;for(;p>=0;){if(p===M)return!0;p=g[p].padre}return!1};let _=0;for(const[w,M]of g.entries()){if(!(Object.prototype.hasOwnProperty.call(M.attrs,"data-lumy-productos")||Object.prototype.hasOwnProperty.call(M.attrs,"data-lumy-categorias")))continue;_++;const V=g.map((G,B)=>({h:G,k:B})).filter(({h:G})=>G.padre===w&&!["style","script"].includes(G.tag));if(!V.length){c(M.inicio,"ojo","Esta lista está vacÃa: pon adentro el molde que se repite (una tarjeta de producto o un botón de categorÃa).");continue}if(!Object.prototype.hasOwnProperty.call(M.attrs,"data-lumy-productos"))continue;const L=V.find(({h:G})=>Object.prototype.hasOwnProperty.call(G.attrs,"data-lumy-molde"))||V[0],x=$(L.k)-L.h.inicio,z=Math.max(1,a.productos??50);x>8e3&&x*z>I5/2&&c(L.h.inicio,"ojo",`Esta tarjeta pesa ${Math.round(x/1e3)} KB y sale una vez por producto (${z} â ${(x*z/1e6).toFixed(1)} MB). Lumy repite hasta 2,5 MB en toda la tienda: lo que pase no sale. Aligérala: los Ãconos, una sola vez con <svg><symbol id> y <use href="#id">.`)}_>30&&c(0,"ojo",`Tu tienda tiene ${_} listas de productos y Lumy arma hasta 30: las de más salen vacÃas.`),g.some(w=>Object.prototype.hasOwnProperty.call(w.attrs,"data-lumy-productos"))||c(0,"ojo","Tu tienda todavÃa no muestra productos: agrega un contenedor con data-lumy-productos y una tarjeta adentro (mira la plantilla).");const N=(w,M,p,V)=>{for(const L of w.matchAll(/\{\{\s*([a-z_]+)\.([a-z0-9_]+)(?:\[\d+\])?\s*\}\}/gi)){const[x,z,G]=L,B=z.toLowerCase(),U=G.toLowerCase(),ne=M+(L.index||0);B==="producto"?!hb.includes(U)&&U!=="imagenes"?c(ne,"ojo",`${x} no existe. Las del producto son: ${hb.map(Q=>`producto.${Q}`).join(", ")}.`):p||c(ne,"ojo",`${x} va dentro de una lista de productos (data-lumy-productos); aquà queda tal cual.`):B==="categoria"?xb.includes(U)?V||c(ne,"ojo",`${x} va dentro de data-lumy-categorias; aquà queda tal cual.`):c(ne,"ojo",`${x} no existe. Las de la categorÃa son: ${xb.map(Q=>`categoria.${Q}`).join(", ")}.`):B==="tienda"&&(fb.includes(U)||c(ne,"ojo",`${x} no existe. Las de la tienda son: ${fb.map(Q=>`tienda.${Q}`).join(", ")}.`))}};for(const w of b)N(w.texto,w.inicio,w.enLista,w.enCategorias);for(const w of g)for(const M of Object.values(w.attrs))M.includes("{{")&&N(M,w.inicio,w.enLista,w.enCategorias);for(const w of n.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))for(const M of w[1].match(/@import[^;]*/gi)||[])/fonts\.googleapis\.com/i.test(M)||c((w.index||0)+w[0].indexOf(M),"quita","Solo se admite @import de Google Fonts. Para una fuente tuya usa @font-face.");return u.sort((w,M)=>w.linea-M.linea)}const T5={bold:"Bold",mercadopago:"Mercado Pago",paypal:"PayPal"},Po=t=>{const a=Number(t);return Number.isFinite(a)&&a>0?a:0},Ti=(t,a=200)=>String(t??"").replace(/\s+/g," ").trim().slice(0,a);function Zu(t){const a=ad(t),n=sj(a);return n||(o=>
178"$"+Number(o||0).toLocaleString(a.noDecimals?"es-CO":a.locale,a.noDecimals?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}))}function E5(t,a){const n=t&&typeof t=="object"?t:{},o=ad(a.pais).code,i=ad(o).currency,s=new Set(a.pagosConectados||[]),u=n.payment_methods&&typeof n.payment_methods=="object"?n.payment_methods:{},m=["bold","mercadopago","paypal"].filter(C=>u[C]&&s.has(C)).map(C=>T5[C]),c=Dv(n.shipping),g=(()=>{const C=n.shipping&&typeof n.shipping=="object"?n.shipping:{},_=Zu(o);return c?C.mode==="general"?`se cobra ${_(Po(C.general_cop))} de envÃo`:"se cobra por zonas (cada ciudad o departamento con su valor)":"gratis siempre (no se cobra flete)"})(),f=n.cart_value_discount&&typeof n.cart_value_discount=="object"?n.cart_value_discount:{},b=n.cart_qty_discount&&typeof n.cart_qty_discount=="object"?n.cart_qty_discount:{},v=new Set,j=(Array.isArray(b.tiers)&&b.tiers.length?b.tiers:[b]).map(C=>({desde:Math.floor(Po(C==null?void 0:C.min)),porcentaje:Math.min(90,Math.round(Po(C==null?void 0:C.percent)))})).filter(C=>C.desde>=2&&C.porcentaje>0).filter(C=>v.has(C.desde)?!1:(v.add(C.desde),!0)).sort((C,_)=>_.desde-C.desde).slice(0,5).reverse(),S=n.cart_gift&&typeof n.cart_gift=="object"?n.cart_gift:{},$=String(a.whatsapp||"").replace(/\D/g,"");return{nombre:Ti(n.name,80),frase:Ti(n.tagline,140),anuncio:Ti(n.announcement,140),conLogo:/^https?:\/\//i.test(String(n.logo||"")),pais:o,moneda:i,whatsapp:$,agente:$?a.agenteConectado?"conectado":"sin-conectar":"sin-numero",carrito:{activo:!!n.cart_enabled,flujo:String(n.cart_flow||"form")==="directo"&&m.length?"directo":"form",pedidoMinimo:Po(n.cart_min_total),envioGratisDesde:Po(n.free_shipping_min),cobraEnvio:c,envio:g,cupones:(Array.isArray(n.cart_coupons)?n.cart_coupons:[]).map(C=>({codigo:Ti(C==null?void 0:C.code,20).toUpperCase(),porcentaje:Math.min(90,Math.round(Po(C==null?void 0:C.percent))),minimo:Po(C==null?void 0:C.min)})).filter(C=>C.codigo&&C.porcentaje>0).slice(0,10),descuentoPorValor:Po(f.min)&&Po(f.percent)?{desde:Po(f.min),porcentaje:Math.min(90,Math.round(Po(f.percent)))}:null,descuentoPorCantidad:j,regalo:Po(S.min)&&Ti(S.text)?{desde:Po(S.min),texto:Ti(S.text,80)}:null,pagosEnLinea:m},avisos:(Array.isArray(n.time_alerts)?n.time_alerts:[]).filter(C=>C&&Ti(C.text)).slice(0,3).map(C=>({segundos:Math.max(3,Math.min(600,Math.round(Po(C.seconds)||15))),texto:Ti(C.text,120)})),politicas:(Array.isArray(n.policies)?n.policies:[]).map(C=>Ti(C==null?void 0:C.title,60)).filter(Boolean).slice(0,8),direccion:String(a.direccion||""),dominioPropio:String(a.dominioPropio||""),tiendaPrendida:!!a.tiendaPrendida}}function Uv(t){const a=Zu(t.pais),n=t.carrito,o=[];if(!n.activo)return["El carrito está APAGADO: «Agregar» abre la vista rápida del producto y ahà se pide ese solo producto."];const i=!!t.whatsapp;o.push(n.flujo==="directo"?`Al terminar, el carrito ofrece pagar en lÃnea (${n.pagosEnLinea.join(", ")})${i?" o pedir por WhatsApp":""}; no pide dirección para contraentrega.`:`Al terminar, el carrito pide los datos del envÃo y el pedido es contraentrega${n.pagosEnLinea.length?`, o se paga en lÃnea con ${n.pagosEnLinea.join(", ")}`:""}.${i?" También ofrece «Pedir por WhatsApp».":""}`),o.push(`EnvÃo: ${n.envio}.`),n.envioGratisDesde&&n.cobraEnvio&&o.push(`EnvÃo gratis desde ${a(n.envioGratisDesde)}, contado sobre el total ya con el descuento (el carrito muestra la barra de cuánto falta).`),n.pedidoMinimo&&o.push(`Pedido mÃnimo: ${a(n.pedidoMinimo)}.`),n.descuentoPorValor&&o.push(`Descuento por valor: comprando desde ${a(n.descuentoPorValor.desde)}, ${n.descuentoPorValor.porcentaje}% menos.`);for(const u of n.descuentoPorCantidad)o.push(`Descuento por cantidad: llevando ${u.desde} o más productos, ${u.porcentaje}% menos.`);n.regalo&&o.push(`Regalo: comprando desde ${a(n.regalo.desde)}, se lleva «${n.regalo.texto}».`);for(const u of n.cupones)o.push(`Cupón ${u.codigo}: ${u.porcentaje}% menos${u.minimo?` desde ${a(u.minimo)}`:""}.`);return(n.descuentoPorValor?1:0)+(n.descuentoPorCantidad.length?1:0)+(n.cupones.length?1:0)>1&&o.push("Los descuentos no se suman: el carrito aplica el mayor (por valor, por cantidad o el cupón)."),o}function z5(t){var b;const a=t.resumen,n=Zu(a.pais),o=((b=Lg[a.pais])==null?void 0:b.name)||a.pais,i=t.productos.slice(0,80).map(v=>{var S,$;
178const j=[`${v.id} · ${v.nombre} · ${v.precio>0?n(v.precio):"sin precio"}`];return v.precioAntes&&v.precioAntes>v.precio&&j.push(`antes ${n(v.precioAntes)}`),(S=v.variantes)!=null&&S.length&&j.push(v.variantes.map(C=>`${C.nombre}: ${C.opciones.slice(0,12).join("/")}`).join("; ")),($=v.categorias)!=null&&$.length&&j.push(`en ${v.categorias.join(", ")}`),v.imagen||j.push("SIN FOTO"),` · ${j.join(" · ")}`}),s=t.productos.length-i.length,u=t.dominioPropio?`Esta tienda Sà tiene dominio propio (${a.dominioPropio}). Puedes usar <script>, eventos como onclick 179y librerÃas por <script src="https://â¦">; corren solo en ese dominio.`:`Esta tienda NO tiene dominio propio conectado. Nada de <script> ni onclick: en lumycol.com se quitan 180y la tienda no se deja publicar con ellos. Haz las interacciones con CSS (:hover, :has, @keyframes, 181transiciones, popover, <details>) y las recetas data-lumy de abajo.`,m=a.whatsapp?`Mi WhatsApp es +${a.whatsapp}${a.agente==="conectado"?" y está conectado a Lumy: el agente de ventas por WhatsApp atiende a quien escriba":""}. Para un botón de WhatsApp usa 182<a data-lumy-whatsapp>EscrÃbenos</a> (Lumy le pone mi número). Dentro de la tarjeta de un producto, ese 183mismo botón abre el chat hablando de ESE producto («Hola, me interesaâ¦Â»${a.agente==="conectado"?" y el agente sabe cuál miraba":""}); fuera de las 184tarjetas (encabezado, pie) abre un chat general. Cada toque cuenta: deja el contacto en mi CRM con el 185rastro del anuncio y manda Contact a Meta y a TikTok. Un enlace normal a https://wa.me/${a.whatsapp} 186también cuenta.`:"Mi tienda todavÃa no tiene WhatsApp (se pone en «Tu tienda â Marca»): no pongas botones de WhatsApp.",c=cg.flatMap(v=>[` ${v.grupo}:`,...v.marcas.map(j=>` ${j.codigo} â ${j.que}`)]).join(` 187`),g=String(t.codigo||"").trim(),f=g?g.length>12e4?`Mi código actual es largo (${Math.round(g.length/1e3)} mil caracteres) y no cabe aquÃ: si tienes el conector de Lumy, léelo con ver_codigo_tienda; si no, te lo pego aparte.`:`Este es mi código actual. Parte de él y devuélvemelo entero, con los cambios que te pida: 188 189${g}`:"TodavÃa no tengo código: créala desde cero.";return`Vas a escribir mi TIENDA ONLINE completa, en un solo archivo, para el modo código de Lumy. Devuélveme 190solo el código, sin Markdown ni explicaciones: HTML y <style>${t.dominioPropio?" (y <script>, porque tengo dominio propio)":""}, sin <html>, <head> ni <body>. 191Es un catálogo entero, no una página de un producto: que se vea espectacular, que se entienda en el 192celular y que invite a llevar más de uno. Los productos, el carrito, el cobro y los pedidos los pone 193Lumy: tú diseñas la vitrina. 194 195MI TIENDA 196 · Nombre: ${a.nombre||"(todavÃa sin nombre: usa {{tienda.nombre}})"} 197 · Frase: ${a.frase||"(sin frase)"} 198 · Anuncio de arriba: ${a.anuncio||"(ninguno)"} 199 · PaÃs: ${o}. Moneda: ${a.moneda}. Los precios los escribe Lumy con esa moneda (no escribas «$» a mano). 200 · Dirección: ${a.direccion||"(sin publicar todavÃa)"} 201 202MIS PRODUCTOS (id · nombre · precio · antes · tallas y colores · categorÃa) 203${i.length?i.join(` 204`):" · (todavÃa no hay productos en la tienda)"}${s>0?` 205 · â¦y ${s} más.`:""} 206NO los escribas a mano: se repiten solos con el molde (abajo). Si cambio un precio en Lumy, la tienda 207cambia sola; si lo escribes tú, se queda viejo y dice una cifra distinta a la que cobra el carrito. 208 209MIS CATEGORÃAS: ${t.categorias.length?t.categorias.join(", "):"(ninguna todavÃa)"} 210 211CÃMO SE ARMA (las marcas que Lumy entiende, y ninguna más) 212${c} 213 214EL MOLDE, EN CORTO 215 <main data-lumy-productos="todos"> 216 <article data-lumy-molde> 217 <img data-lumy-src="producto.imagen" alt="{{producto.nombre}}"> 218 <h3>{{producto.nombre}}</h3> 219 <b>{{producto.precio}}</b> <s data-lumy-si="oferta">{{producto.precio_antes}}</s> 220 <button data-lumy-agregar>Agregar</button> <button data-lumy-ver>Ver</button> 221 </article> 222 <p data-lumy-vacio>Pronto verás productos aquÃ.</p> 223 </main> 224Puedes poner varias listas (una por categorÃa con data-lumy-productos="categoria:Nombre", una de 225ofertas, una de los más vendidos) y armar el catálogo por categorÃas, por estilos o por tallas. 226 227LO QUE PONE LUMY (no lo escribas, pero sà puedes darle estilo con tu CSS: tus reglas le ganan) 228${a.carrito.activo?` · El carrito: se abre con <button data-lumy-carrito> (o el botón flotante si no pones uno). Adentro
229 van las cantidades, el envÃo, los descuentos, los cupones, el regalo, el pago y el formulario con 230 los datos de envÃo de mi paÃs. Clases: .cart-sheet, .cart-panel, .cart-fab.`:` · El carrito está APAGADO en mi tienda: no pongas botón de carrito (no abrirÃa nada). «Agregar» 231 abre la vista rápida y ahà se pide ese producto.`} 232 · La vista rápida del producto (data-lumy-ver): fotos, tallas y colores, precio, descripción y 233 comprar. Sus datos salen del producto; su diseño se ajusta con las clases .pv-⦠(p. ej. .pv-gal). 234 · La ventana de las polÃticas (<nav data-lumy-politicas>), los avisos por tiempo, el cobro, el 235 pedido en mi CRM, la subida a la logÃstica y los eventos de Meta y TikTok. 236 · Estos id son de Lumy; no los uses: ${Vv.join(", ")}. 237 238MI CARRITO Y MIS OFERTAS (ya están configurados en Lumy y se cobran solos; si los anuncias en el diseño, 239usa estas cifras exactas y no inventes otras) 240${Uv(a).map(v=>` · ${v}`).join(` 241`)}${a.avisos.length?` 242 · Avisos que salen solos: ${a.avisos.map(v=>`a los ${v.segundos} s «${v.texto}»`).join("; ")}.`:""}${a.politicas.length?` 243 · Mis polÃticas: ${a.politicas.join(", ")} (salen en <nav data-lumy-politicas>).`:""} 244 245WHATSAPP 246${m} 247 248JAVASCRIPT Y DOMINIO 249${u} 250 251MOVIMIENTO SIN JAVASCRIPT 252Marca cualquier elemento con data-lumy="â¦": aparecer (data-desde="abajo|izquierda|derecha|zoom"), 253aparecer-hijos (data-paso), contador, escribir, cuenta-regresiva (data-hasta="2026-12-24T20:00"), 254parallax, zoom-scroll, revelar-imagen, particulas, marquesina (data-velocidad, data-direccion), flotar, 255brillar, pulso, sacudir, tilt, gradiente-vivo (data-colores="#1e2a5a,#4f7cff"), pestanas, acordeon, 256carrusel (data-intervalo), comparador, ampliar, video-al-verse, rotar-palabras (data-palabras="uno,dos"), 257resaltar, progreso-scroll, pegajoso, parallax-raton, confeti, copiar, ver-mas, zoom-hover. 258El CSS es libre: cualquier selector, @media, @keyframes, @property, @font-face, @container, filtros, 259máscaras, degradados y sombras. 260 261LÃMITES (el editor los avisa antes de publicar) 262 · Sin <form>: el pedido lo toma el carrito de Lumy. Sin <template>, <object>, <embed> ni <noscript>. 263 · Solo iframes de YouTube, Vimeo, TikTok, Bunny/MediaDelivery y Google Maps. 264 · En el CSS, solo @import de Google Fonts (@import url(https://fonts.googleapis.com/css2?family=â¦)). 265 · Imágenes y videos por https. Las mÃas las subo en Lumy («Subir foto o video» / «Mis fotos») y te 266 paso su dirección. 267 · La tarjeta del molde sale una vez por producto: que no pese más de unos pocos KB (los Ãconos, una 268 sola vez con <svg><symbol id> y <use href="#id">). 269 270ENTREGA 271Un solo documento, responsive desde 320 px (la mayorÃa compra desde el celular), accesible con 272teclado, sin precios ni productos inventados, con todas las marcas de Lumy necesarias y de menos de 273600.000 caracteres. 274 275${f}${R5(t.avisos)} 276 277Si tienes el conector de Lumy (MCP), lee la tienda con ver_codigo_tienda y guárdala en mi borrador con 278poner_tienda_en_codigo: no cambia lo que ven mis compradores hasta que yo la publique.`}function R5(t){const a=(t||[]).filter(s=>s&&s.texto);if(!a.length)return"";const n=a.filter(s=>s.tipo==="quita"),o=a.filter(s=>s.tipo!=="quita"),i=s=>` · lÃnea ${s.linea}: ${s.texto}`;return` 279 280LO QUE HAY QUE ARREGLAR DEL CÃDIGO QUE YA TENGO${n.length?` 281Lumy BORRA esto al publicar, asà que hay que arreglarlo sà o sÃ: 282${n.slice(0,25).map(i).join(` 283`)}`:""}${o.length?` 284Esto conviene revisarlo: 285${o.slice(0,25).map(i).join(` 286`)}`:""}`}const N5={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46
vendor: 10,172 bytes, line 286
286])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:241|349)0\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|[34]\\d\\d)|91(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79]))))\\d{3}|(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8])|8(?:55|6[0-8]|[78]\\d|9[02-9]))\\d{6}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[024-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[024-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|8)\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:2[7-9]|3[3-7]|5[12]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","(?:[2-7]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]|50"]],["(\\d{8})","$1",["[5-7]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}
vendor: 15,256 bytes, line 286
286|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[178]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-6]|7[246]|8[2-4]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|[78]"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|3[23]|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","8776\\d{4}|(?:[27]\\d|61)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-8]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["60|809"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9(?:10|[2-9])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-8]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|9[14]"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-36-9]|95[0-3])\\d{5}|4(?:[0-36]\\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|3[13])"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,0,[["528[89]\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[016-8]\\d|2[0-8]|5[0-5]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-57
286-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-57-9]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,"0|180020",0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-5])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|5[01]))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])
286))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:694\\d|7093)\\d{5}|(?:59|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|80[6-9]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0|180020","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","[235]\\d{8}|800\\d{5,6}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2358]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|80[6-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["(?:59(?:0(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","[2-589]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0|180020","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6
vendor: 17,388 bytes, line 286
286]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31)|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:3171|5[15][2-6]|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|8(?:16|2[014]|3[126]|6[136]|7[78]|83)(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|3[129]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7(?:[23569]|8[0-57-9])|8[1-6])|7(?:1(?:[013-8]|9[6-9])|3(?:17|2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|8(?:28[235-7]|3))|73179|807(?:1|9[1-3])|(?:1552|6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578])\\d|7(?:[23569]\\d|8[0-57-9])|8(?:[14-6]\\d|2[0-79]))|7(?:1(?:[013-8]\\d|9[6-9])|3(?:2[0-49]|9[2-57])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["16|[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["18[06]","18[06]0"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[03]"]]],0,0,0,0,0,0,[["0(?:669[0-79]\\d{1,6}|831\\d{2,8})|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[2356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0|180020","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|427|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[47]"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[25-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["3|4(?:2[09]|7[01])|6[1-9]","3|4(?:2(?:0|9[02-69])|7(?:0[019]|1))|6[1-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[25-9]"],"0$1"]],"0",0,"(000[2569]\\d{4,6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","8\\d{13}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-6]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[2457]\\d|33|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["20"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["20"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|78|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2679]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{4})(\\d{5})","$1-$2",["892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8(?:0[0-7]|9)"],"0$1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[5-8]"],"0$1"]],"0",0,0,0,0,"[5-8]"],MC:["377","00","(?:[3489]|[67]\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[67]"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","7090\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["(?:59(?:0(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)|87\\d)|80[6-9]\\d\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],["8[129]\\d{7}"],0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["11|2[16]"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","7091\\d{5}|(?:[56]9|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{
2863})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}
286(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","30|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[78]\\d{8}|[2-9]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","[36-8]\\d{5,8}|4\\d{6,8}|59\\d{6}|9\\d{5,10}|(?:2\\d|5[0-8])\\d{6,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["3[289]|4[246-8]|61|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["2631[0-6]\\d{4}|26(?:2\\d|30|88)\\d{5}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"[3489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","(?:[15]\\d|800|92)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|[6-9]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[25-7]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[25-7]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-359]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-4]|5[1-3]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[59]"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[3689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[236-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","(?:[0-57-9]\\d|66)\\d{7}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4}
286)","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["\\d"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[0-79]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["826"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["83"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["82"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[25]0|37|49|8[09]"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-478])|7[1-9]","[23568]|4(?:0[2-48]|[1-478])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:274[27]|(?:472|983)[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013-79]|3[0-24679]|4[167]|5[0-3]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-2478]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|3[23]|44|66|77|88)[2-9]\\d{6}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|2\\d{3,4}|(?:[49]\\d|80)\\d{5}",[4,5,6,7,8,9,10,11,12,13],[["(\\d{4,5})","$1",["21"]],["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1(?:2[02]|[89])"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[26]|6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","(?:639\\d|7093)\\d{5}|(?:26|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["26(?:89\\d|9(?:0[0-467]|15|5[0-4]|6\\d|[78]0))\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4}
286)","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|5[12]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|5(?:0\\d{3}|2[0-2]))\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function L5(t,a){var n=Array.prototype.slice.call(a);return n.push(N5),t.apply(this,n)}function yb(t,a){t=t.split("-"),a=a.split("-");for(var n=t[0].split("."),o=a[0].split("."),i=0;i<3;i++){var s=Number(n[i]),u=Number(o[i]);if(s>u)return 1;if(u>s)return-1;if(!isNaN(s)&&isNaN(u))return 1;if(isNaN(s)&&!isNaN(u))return-1}return t[1]&&a[1]?t[1]>a[1]?1:t[1]<a[1]?-1:0:!t[1]&&a[1]?1:t[1]&&!a[1]?-1:0}var P5={}.constructor;function ed(t){return t!=null&&t.constructor===P5}var D5=/^\d+$/;function B5(t){return D5.test(t)}function od(t){"@babel/helpers - typeof";return od=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},od(t)}function Xu(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function W5(t,a){for(var n=0;n<a.length;n++){var o=a[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,q5(o.key),o)}}function ep(t,a,n){return a&&W5(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function q5(t){var a=M5(t,"string");return od(a)=="symbol"?a:a+""}function M5(t,a){if(od(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,a);if(od(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var F5="1.2.0",O5="1.7.35",vb=" ext. ",uo=(function(){function t(a){Xu(this,t),Qv(a),this.metadata=a,Yv.call(this,a)}return ep(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(n){return n!=="001"})}},{key:"getCountryMetadata",value:function(n){return this.metadata.countries[n]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(n){return this.getCountryMetadata(n)!==void 0}},{key:"hasCallingCode",value:function(n){if(this.getCountryCodesForCallingCode(n))return!0;if(this.nonGeographic()){if(this.nonGeographic()[n])return!0}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(n){return this.nonGeographic()?!!this.nonGeographic()[n]:!this.getCountryCodesForCallingCode(n)}},{key:"country",value:function(n){return this.selectNumberingPlan(n)}},{key:"selectNumberingPlan",value:function(n,o){var i,s;if(n&&(B5(n)?s=n:i=n),o&&(s=o),i&&i!=="001"){var u=this.getCountryMetadata(i);if(!u)throw new Error("Unknown country: ".concat(i));this.numberingPlan=new jb(u,this)}else if(s){if(!this.hasCallingCode(s))throw new Error("Unknown calling code: ".concat(s));this.numberingPlan=new jb(this.getNumberingPlanMetadata(s),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var o=this.countryCallingCodes()[n];if(o)return o.length===1&&o[0].length===3?void 0:o}},{key:"getCountryCodeForCallingCode",value:function(n){var o=this.getCountryCodesForCallingCode(n);if(o)return o[0]}},{key:"getNumberingPlanMetadata",value:function(n){var o=this.getCountryCodeForCallingCode(n);if(o)return this.getCountryMetadata(o);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var s=this.countryCallingCodes()[n];if(s&&s.length===1&&s[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(n){return this.numberingPlan.type(n)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}])})(),jb=(function(){function t(a,n){Xu(this,t),this.globalMetadataObject=n,this.metadata=a,Yv.call(this,n.metadata)}return ep(t,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"_getDefaultCountryMetadataForThisCallingCode",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this._getDefaultCountryMetadataForThisCallingCode()}},{key:"IDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(n){return n[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var n=this,o=this._getFormats(this.metadata)||this._getFormats(this._getDefaultCountryMetadataForThisCallingCode())||[];return o.map(function(i){return new H5(i,n)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(n){return n[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this._getDefaultCountryMetadataForThisCallingCode())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return this.types()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(n){if(this.hasTypes()&&Ab(this.types(),n))return new V5(Ab(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?vb:this.metadata[13]||vb}}])})(),H5=(function(){function t(a,n){Xu(this,t),this._format=a,this.metadata=n}return ep(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!!(this.nationalPrefixFormattingRule()&&!G5.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}])})(),G5=/^\(?\$1\)?$/,V5=(function(){function t(a,n){Xu(this,t),this.type=a,this.metadata=n}return ep(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.t
vendor: 4,716 bytes, lines 286-287
286ype[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}])})();function Ab(t,a){switch(a){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function Qv(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!ed(t)||!ed(t.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(ed(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+U5(t)+": "+t,"."))}var U5=function(a){return od(a)};function Kv(t,a){var n=new uo(a);if(n.hasCountry(t))return n.selectNumberingPlan(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function Q5(t,a){return a.countries.hasOwnProperty(t)}function Yv(t){var a=t.version;typeof a=="number"?(this.v1=a===1,this.v2=a===2,this.v3=a===3,this.v4=a===4):a?yb(a,F5)===-1?this.v2=!0:yb(a,O5)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function Jg(t,a,n){return K5(t,void 0,a,n)}function K5(t,a,n,o){n&&(o=new uo(o.metadata),o.selectNumberingPlan(n));var i=o.type(a),s=i&&i.possibleLengths()||o.possibleLengths();if(!s)return"IS_POSSIBLE";var u=t.length,m=s[0];return m===u?"IS_POSSIBLE":m>u?"TOO_SHORT":s[s.length-1]<u?"TOO_LONG":s.indexOf(u,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function Y5(t,a,n){a===void 0&&(a={});var o=new uo(n);if(a.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");o.selectNumberingPlan(t.country||t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!o.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));o.selectNumberingPlan(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");o.selectNumberingPlan(t.countryCallingCode)}}if(o.possibleLengths())return Jv(t.phone||t.nationalNumber,o);if(t.countryCallingCode&&o.isNonGeographicCallingCode(t.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function Jv(t,a){switch(Jg(t,void 0,a)){case"IS_POSSIBLE":return!0;default:return!1}}function Fi(t,a){return t=t||"",new RegExp("^(?:"+a+")$").test(t)}function J5(t,a){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=Z5(t))||a){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 287In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z5(t,a){if(t){if(typeof t=="string")return Sb(t,a);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sb(t,a):void 0}}function Sb(t,a){(a==null||a>t.length)&&(a=t.length);for(var n=0,o=Array(a);n<a;n++)o[n]=t[n];return o}var X5=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function Zg(t,a,n){if(a=a||{},!(!t.country&&!t.countryCallingCode)){var o=new uo(n);o.selectNumberingPlan(t.country||t.countryCallingCode);var i=a.v2?t.nationalNumber:t.phone;if(Fi(i,o.nationalNumberPattern())){if(bp(i,"FIXED_LINE",o))return o.type("MOBILE")&&o.type("MOBILE").pattern()===""||!o.type("MOBILE")||bp(i,"MOBILE",o)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var s=J5(X5),u;!(u=s()).done;){var m=u.value;if(bp(i,m,o))return m}}}}function bp(t,a,n){var o=n.type(a);return!o||!o.pattern()||o.possibleLengths()&&o.possibleLengths().indexOf(t.length)<0?!1:Fi(t,o.pattern())}function e3(t,a,n){a=a||{};var o=new uo(n);if(o.selectNumberingPlan(t.country||t.countryCallingCode),o.hasTypes())return Zg(t,a,o.metadata)!==void 0;var i=a.v2?t.nationalNumber:t.phone;return Fi(i,o.nationalNumberPattern())}var t3=/^[A-Z]{2}$/;function a3(t){return t3.test(t)}function n3(t,a){var n,o,i=new uo(a);return a3(t)?(n=t,i.selectNumberingPlan(n),o=i.countryCallingCode()):o=t,{country:n,callingCode:o}}function o3(t,a,n){var o=new uo(n),i=o.getCountryCodesForCallingCode(t);return i?i.filter(function(s){return r3(a,s,n)}):[]}function r3(t,a,n){var o=new uo(n);return o.selectNumberingPlan(a),o.numberingPlan.possibleLengths().indexOf(t.length)>=0}var Xg=2,i3=17,s3=3,Pr="0-9ï¼-ï¼Ù -Ù©Û°-Û¹",l3="-â-ââã¼ï¼",d3="ï¼/",c3="ï¼.",u3="  Ââ
287â ã",p3="()ï¼ï¼ï¼»ï¼½\\[\\]",g3="~ââ¼ï½",Ou="".concat(l3).concat(d3).concat(c3).concat(u3).concat(p3).concat(g3),em="+ï¼",m3=new RegExp("(["+Pr+"])");function h3(t,a,n,o){if(a){var i=new uo(o);i.selectNumberingPlan(a||n);var s=new RegExp(i.IDDPrefix());if(t.search(s)===0){t=t.slice(t.match(s)[0].length);var u=t.match(m3);if(!(u&&u[1]!=null&&u[1].length>0&&u[1]==="0"))return t}}}function f3(t,a){if(t&&a.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+a.numberingPlan.nationalPrefixForParsing()+")"),o=n.exec(t);if(o){var i,s,u=o.length-1,m=u>0&&o[u];if(a.nationalPrefixTransformRule()&&m)i=t.replace(n,a.nationalPrefixTransformRule()),u>1&&(s=o[1]);else{var c=o[0];i=t.slice(c.length),m&&(s=o[1])}var g;if(m){var f=t.indexOf(o[1]),b=t.slice(0,f);b===a.numberingPlan.nationalPrefix()&&(g=a.numberingPlan.nationalPrefix())}else g=o[0];return{nationalNumber:i,nationalPrefix:g,carrierCode:s}}}return{nationalNumber:t}}function x3(t,a){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=b3(t))||a){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 288In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b3(t,a){if(t){if(typeof t=="string")return wb(t,a);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wb(t,a):void 0}}function wb(t,a){(a==null||a>t.length)&&(a=t.length);for(var n=0,o=Array(a);n<a;n++)o[n]=t[n];return o}function y3(t,a,n){for(var o=new uo(n),i=x3(a),s;!(s=i()).done;){var u=s.value;if(o.selectNumberingPlan(u),o.leadingDigits()){if(t&&t.search(o.leadingDigits())===0)return u}else if(Zg({phone:t,country:u},void 0,o.metadata))return u}}function Zv(t,a){var n=a.nationalNumber,o=a.metadata,i=o.getCountryCodesForCallingCode(t);if(i)return i.length===1?i[0]:y3(n,i,o.metadata)}function ug(t,a,n){var o=f3(t,n),i=o.carrierCode,s=o.nationalNumber;if(s!==t){if(!v3(t,s,n))return{nationalNumber:t};if(n.numberingPlan.possibleLengths()&&(a||(a=Zv(n.numberingPlan.callingCode(),{nationalNumber:s,metadata:n})),!j3(s,a,n)))return{nationalNumber:t}}return{nationalNumber:s,carrierCode:i}}function v3(t,a,n){return!(Fi(t,n.nationalNumberPattern())&&!Fi(a,n.nationalNumberPattern()))}function j3(t,a,n){switch(Jg(t,a,n)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function A3(t,a,n,o,i){if(!(n||o))return{number:t};var s=n?Kv(n,i):o;if(t.indexOf(s)===0){var u=new uo(i);u.selectNumberingPlan(n||o);var m=t.slice(s.length),c=ug(m,void 0,u),g=c.nationalNumber,f=ug(t,void 0,u),b=f.nationalNumber;if(!Fi(b,u.nationalNumberPattern())&&Fi(g,u.nationalNumberPattern())||Jg(b,void 0,u)==="TOO_LONG")return{countryCallingCode:s,number:m}}return{number:t}}function Xv(t,a,n,o,i){if(!t)return{};var s;if(t[0]!=="+"){var u=h3(t,n,o,i);if(u&&u!==t)s=!0,t="+"+u;else{if(n||o){var m=A3(t,a,n,o,i),c=m.countryCallingCode,g=m.number;if(c)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:c,number:g}}return{number:t}}}if(t[1]==="0")return{};for(var f=new uo(i),b=2;b-1<=s3&&b<=t.length;){var v=t.slice(1,b);if(f.hasCallingCode(v))return f.selectNumberingPlan(v),{countryCallingCodeSource:s?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:v,number:t.slice(b)};b++}return{}}function S3(t){return t.replace(new RegExp("[".concat(Ou,"]+"),"g")," ").trim()}var w3=/(\$\d)/;function k3(t,a,n){var o=n.useInternationalFormat,i=n.withNationalPrefix,s=t.replace(new RegExp(a.pattern()),o?a.internationalFormat():i&&a.nationalPrefixFormattingRule()?a.format().replace(w3,a.nationalPrefixFormattingRule()):a.format());return o?S3(s):s}var C3=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function _3(t,a,n){var o=new uo(n);if(o.selectNumberingPlan(t||a),o.defaultIDDPrefix())return o.defaultIDDPrefix();if(C3.test(o.IDDPrefix()))return o.IDDPrefix()}var $3=";ext=",Tl=function(a){return"([".concat(Pr,"]{1,").concat(a,"})")};function e2(t){var a="20",n="15",o="9",i="6",s="[  \\t,]*",u="[:\\.ï¼]?[  \\t,-]*",m="#?",c="(?:e?xt(?:ensi(?:oÌ?|ó))?n?|ï½ ?ï½ï½ï½?|доб|anexo)",g="(?:[xï½#ï¼~ï½]|int|ï½ï½ï½)",f="[- ]+",b="[  \\t]*",v="(?:,{2}|;)",j=$3+Tl(a),S=s+c+u+Tl(a)+m,$=s+g+u+Tl(o)+m,C=f+Tl(i)+"#",_=b+v+u+Tl(n)+m,N=b+"(?:,)+"+u+Tl(o)+m;return j+"|"+S+"|"+$+"|"+C+"|"+_+"|"+N}var I3="["+Pr+"]{"+Xg+"}",T3="["+em+"]{0,1}(?:["+Ou+"]*["+Pr+"]){3,}["+Ou+Pr+"]*",E3=new RegExp("^["+em+"]{0,1}(?:["+Ou+"]*["+Pr+"]){1,2}$","i"),z3=T3+"(?:"+e2()+")?",R3=new RegExp("^"+I3+"$|^"+z3+"$","i");function N3(t){return t.length>=Xg&&R3.test(t)}function L3(t){return E3.test(t)}function P3(t){var a=t.number,n=t.ext;if(!a)return"";if(a[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(a).concat(n?";ext="+n:"")}var kb={formatExtension:function(a,n,o){return"".concat(a).concat(o.ext()).concat(n)}};function D3(t,a,n,o){n?n=q3({},kb,n):n=kb;var i=new uo(o);if(t.country&&t.country!=="001"){if(!i.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));i.selectNumberingPlan(t.country)}else if(t.countryCallingCode)i.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var s=i.countryCallingCode(),u=n.v2?t.nationalNumber:t.phone,m;switch(a){case"NATIONAL":return u?(m=Hu(u,t.carrierCode,"NATIONAL",i,n),yp(m,t.ext,i,n.formatExtension)):"";case"INTERNATIONAL":return u?(m=Hu(u,null,"INTERNATIONAL",i,n),m="+".concat(s," ").concat(m),yp(m,t.ext,i,n.formatExtension)):"+".concat(s);case"E.164":return"+".concat(s).concat(u);case"RFC3966":return P3({number:"+".concat(s).concat(u),ext:t.ext});case"IDD":if(!n.fromCountry)return;var c=W3(u,t.carrierCode,s,n.fromCountry,i);return c?yp(c,t.ext,i,n.formatExtension):void 0;default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(a,'"'))}}function Hu(t,a,n,o,i){var s=B3(o.formats(),t);return s?k3(t,s,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(s.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1)}):t}function B3(t,a){return M3(t,function(n){if(n.leadingDigitsPatterns().length>0){var o=n.leadingDigitsPatterns()[n.leadingDigitsPatterns().length-1];if(a.search(o)!==0)return!1}return Fi(a,n.pattern())})}function yp(t,a,n,o){return a?o(t,a,n):t}function W3(t,a,n,o,i){var s=Kv(o,i.metadata);if(s===n){var u=Hu(t,a,"NATIONAL",i);return n==="1"?n+" "+u:u}var m=_3(o,void 0,i.metadata);if(m)return"".concat(m," ").concat(n," ").concat(Hu(t,null,"INTERNATIONAL",i))}function q3(){for(var t=1,a=arguments.length,n=new Array(a),o=0;o<a;o++)n[o]=arguments[o];for(;t<n.length;){if(n[t])for(var i in n[t])n[0][i]=n[t][i];t++}return n[0]}function M3(t,a){for(var n=0;n<t.length;){if(a(t[n]))return t[n];n++}}function xc(t){"@babel/helpers - typeof";return xc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},xc(t)}function Cb(t,a){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function _b(t){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};
vendor: 4,145 bytes, line 288
288a%2?Cb(Object(n),!0).forEach(function(o){F3(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Cb(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function F3(t,a,n){return(a=t2(a))in t?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,t}function O3(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function H3(t,a){for(var n=0;n<a.length;n++){var o=a[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,t2(o.key),o)}}function G3(t,a,n){return a&&H3(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),t}function t2(t){var a=V3(t,"string");return xc(a)=="symbol"?a:a+""}function V3(t,a){if(xc(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,a);if(xc(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var U3=(function(){function t(a,n,o){if(O3(this,t),!a)throw new TypeError("First argument is required");if(typeof a!="string")throw new TypeError("First argument must be a string");if(a[0]==="+"&&!n)throw new TypeError("`metadata` argument not passed");if(ed(n)&&ed(n.countries)){o=n;var i=a;if(!Q3.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var s=Xv(i,void 0,void 0,void 0,o),u=s.countryCallingCode,m=s.number;if(n=m,a=u,!n)throw new Error("Invalid `number` argument passed: too short")}if(!n)throw new TypeError("`nationalNumber` argument is required");if(typeof n!="string")throw new TypeError("`nationalNumber` argument must be a string");Qv(o);var c=n3(a,o),g=c.country,f=c.callingCode;this.country=g,this.countryCallingCode=f,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}return G3(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:o3(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return Y5(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return e3(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new uo(this.getMetadata());return n.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(n){return this.number===n.number&&this.ext===n.ext}},{key:"getType",value:function(){return Zg(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,o){return D3(this,n,o?_b(_b({},o),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(n){return this.format("NATIONAL",n)}},{key:"formatInternational",value:function(n){return this.format("INTERNATIONAL",n)}},{key:"getURI",value:function(n){return this.format("RFC3966",n)}}])})(),Q3=/^\+\d+$/;function pg(t){"@babel/helpers - typeof";return pg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},pg(t)}function K3(t,a,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function Y3(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function J3(t,a,n){return a=yc(a),Z3(t,tm()?Reflect.construct(a,n||[],yc(t).constructor):a.apply(t,n))}function Z3(t,a){if(a&&(pg(a)=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X3(t)}function X3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ew(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),a&&bc(t,a)}function gg(t){var a=typeof Map=="function"?new Map:void 0;
vendor: 5,569 bytes, lines 288-289
288return gg=function(o){if(o===null||!aw(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(a!==void 0){if(a.has(o))return a.get(o);a.set(o,i)}function i(){return tw(o,arguments,yc(this).constructor)}return i.prototype=Object.create(o.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),bc(i,o)},gg(t)}function tw(t,a,n){if(tm())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,a);var i=new(t.bind.apply(t,o));return n&&bc(i,n.prototype),i}function tm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tm=function(){return!!t})()}function aw(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function bc(t,a){return bc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},bc(t,a)}function yc(t){return yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},yc(t)}var Li=(function(t){function a(n){var o;return Y3(this,a),o=J3(this,a,[n]),Object.setPrototypeOf(o,a.prototype),o.name=o.constructor.name,o}return ew(a,t),K3(a)})(gg(Error)),$b=new RegExp("(?:"+e2()+")$","i");function nw(t){var a=t.search($b);if(a<0)return{};for(var n=t.slice(0,a),o=t.match($b),i=1;i<o.length;){if(o[i])return{number:n,ext:o[i]};i++}}var ow={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","ï¼":"0","ï¼":"1","ï¼":"2","ï¼":"3","ï¼":"4","ï¼":"5","ï¼":"6","ï¼":"7","ï¼":"8","ï¼":"9","Ù ":"0","Ù¡":"1","Ù¢":"2","Ù£":"3","Ù¤":"4","Ù¥":"5","Ù¦":"6","Ù§":"7","Ù¨":"8","Ù©":"9","Û°":"0","Û±":"1","Û²":"2","Û³":"3","Û´":"4","Ûµ":"5","Û¶":"6","Û·":"7","Û¸":"8","Û¹":"9"};function rw(t){return ow[t]}function iw(t,a){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=sw(t))||a){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 289In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sw(t,a){if(t){if(typeof t=="string")return Ib(t,a);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ib(t,a):void 0}}function Ib(t,a){(a==null||a>t.length)&&(a=t.length);for(var n=0,o=Array(a);n<a;n++)o[n]=t[n];return o}function Tb(t){for(var a="",n=iw(t.split("")),o;!(o=n()).done;){var i=o.value;a+=lw(i,a)||""}return a}function lw(t,a,n){return t==="+"?a?void 0:"+":rw(t)}var a2="+",dw="[\\-\\.\\(\\)]?",Eb="(["+Pr+"]|"+dw+")",cw="^\\"+a2+Eb+"*["+Pr+"]"+Eb+"*$",uw=new RegExp(cw,"g"),mg=Pr,pw="["+mg+"]+((\\-)*["+mg+"])*",gw="a-zA-Z",mw="["+gw+"]+((\\-)*["+mg+"])*",hw="^("+pw+"\\.)*"+mw+"\\.?$",fw=new RegExp(hw,"g"),zb="tel:",hg=";phone-context=",xw=";isub=";function bw(t){var a=t.indexOf(hg);if(a<0)return null;var n=a+hg.length;if(n>=t.length)return"";var o=t.indexOf(";",n);return o>=0?t.substring(n,o):t.substring(n)}function yw(t){return t===null?!0:t.length===0?!1:uw.test(t)||fw.test(t)}function vw(t,a){var n=a.extractFormattedPhoneNumber,o=bw(t);if(!yw(o))throw new Li("NOT_A_NUMBER");var i;if(o===null)i=n(t)||"";else{i="",o.charAt(0)===a2&&(i+=o);var s=t.indexOf(zb),u;s>=0?u=s+zb.length:u=0;var m=t.indexOf(hg);i+=t.substring(u,m)}var c=i.indexOf(xw);if(c>0&&(i=i.substring(0,c)),i!=="")return i}var jw=250,Aw=new RegExp("["+em+Pr+"]"),Sw=new RegExp("[^"+Pr+"#]+$");function ww(t,a,n){a=a||{};var o=new uo(n);if(a.defaultCountry&&!o.hasCountry(a.defaultCountry))throw a.v2?new Li("INVALID_COUNTRY"):new Error("Unknown country: ".concat(a.defaultCountry));var i=Cw(t,a.v2,a.extract),s=i.number,u=i.ext,m=i.error;if(!s){if(a.v2)throw m==="TOO_SHORT"?new Li("TOO_SHORT"):new Li("NOT_A_NUMBER");return{}}var c=$w(s,a.defaultCountry,a.defaultCallingCode,o),g=c.country,f=c.nationalNumber,b=c.countryCallingCode,v=c.countryCallingCodeSource,j=c.carrierCode;if(!o.hasSelectedNumberingPlan()){if(a.v2)throw new Li("INVALID_COUNTRY");return{}}if(!f||f.length<Xg){if(a.v2)throw new Li("TOO_SHORT");return{}}if(f.length>i3){if(a.v2)throw new Li("TOO_LONG");return{}}if(a.v2){var S=new U3(b,f,o.metadata);return g&&(S.country=g),j&&(S.carrierCode=j),u&&(S.ext=u),S.__countryCallingCodeSource=v,S}var $=(a.extended?o.hasSelectedNumberingPlan():g)?Fi(f,o.nationalNumberPattern()):!1;return a.extended?{country:g,countryCallingCode:b,carrierCode:j,valid:$,possible:$?!0:!!(a.extended===!0&&o.possibleLengths()&&Jv(f,o)),phone:f,ext:u}:$?_w(g,f,u):{}}function kw(t,a,n){if(t){if(t.length>jw){if(n)throw new Li("TOO_LONG");return}if(a===!1)return t;var o=t.search(Aw);if(!(o<0))return t.slice(o).replace(Sw,"")}}function Cw(t,a,n){var o=vw(t,{extractFormattedPhoneNumber:function(u){return kw(u,n,a)}});if(!o)return{};if(!N3(o))return L3(o)?{error:"TOO_SHORT"}:{};var i=nw(o);return i.ext?i:{number:o}}function _w(t,a,n){var o={country:t,phone:a};return n&&(o.ext=n),o}function $w(t,a,n,o){var i=Xv(Tb(t),void 0,a,n,o.metadata),s=i.countryCallingCodeSource,u=i.countryCallingCode,m=i.number,c;if(u)o.selectNumberingPlan(u);else if(m&&(a||n))a?(c=a,o.selectNumberingPlan(a),u=o.numberingPlan.callingCode()):(o.selectNumberingPlan(n),u=n);else return{};if(!m)return{countryCallingCodeSource:s,countryCallingCode:u};var g=ug(Tb(m),void 0,o),f=g.nationalNumber,b=g.carrierCode,v=Zv(u,{nationalNumber:f,metadata:o});
vendor: 4,714 bytes, lines 289-290
289return v&&(c=v,v==="001"||o.selectNumberingPlan(c)),{country:c,countryCallingCode:u,countryCallingCodeSource:s,nationalNumber:f,carrierCode:b}}function vc(t){"@babel/helpers - typeof";return vc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},vc(t)}function Rb(t,a){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function Nb(t){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?Rb(Object(n),!0).forEach(function(o){Iw(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rb(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Iw(t,a,n){return(a=Tw(a))in t?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,t}function Tw(t){var a=Ew(t,"string");return vc(a)=="symbol"?a:a+""}function Ew(t,a){if(vc(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,a);if(vc(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}function zw(t,a,n){return ww(t,Nb(Nb({},a),{},{v2:!0}),n)}function jc(t){"@babel/helpers - typeof";return jc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},jc(t)}function Lb(t,a){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function Rw(t){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?Lb(Object(n),!0).forEach(function(o){Nw(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lb(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Nw(t,a,n){return(a=Lw(a))in t?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,t}function Lw(t){var a=Pw(t,"string");return jc(a)=="symbol"?a:a+""}function Pw(t,a){if(jc(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,a);if(jc(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}function Dw(t,a){return Mw(t)||qw(t,a)||Ww(t,a)||Bw()}function Bw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 290In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ww(t,a){if(t){if(typeof t=="string")return Pb(t,a);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pb(t,a):void 0}}function Pb(t,a){(a==null||a>t.length)&&(a=t.length);for(var n=0,o=Array(a);n<a;n++)o[n]=t[n];return o}function qw(t,a){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,i,s,u,m=[],c=!0,g=!1;try{if(s=(n=n.call(t)).next,a!==0)for(;!(c=(o=s.call(n)).done)&&(m.push(o.value),m.length!==a);c=!0);}catch(f){g=!0,i=f}finally{try{if(!c&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(g)throw i}}return m}}function Mw(t){if(Array.isArray(t))return t}function Fw(t){var a=Array.prototype.slice.call(t),n=Dw(a,4),o=n[0],i=n[1],s=n[2],u=n[3],m,c,g;if(typeof o=="string")m=o;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")u?(c=s,g=u):(c=void 0,g=s),i&&(c=Rw({defaultCountry:i},c));else if(ed(i))s?(c=i,g=s):g=i;else throw new Error("Invalid second argument: ".concat(i));return{text:m,options:c,metadata:g}}function Ac(t){"@babel/helpers - typeof";return Ac=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Ac(t)}function Db(t,a){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function Bb(t){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};
290a%2?Db(Object(n),!0).forEach(function(o){Ow(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Db(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Ow(t,a,n){return(a=Hw(a))in t?Object.defineProperty(t,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[a]=n,t}function Hw(t){var a=Gw(t,"string");return Ac(a)=="symbol"?a:a+""}function Gw(t,a){if(Ac(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,a);if(Ac(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(t)}function Vw(t,a,n){a&&a.defaultCountry&&!Q5(a.defaultCountry,n)&&(a=Bb(Bb({},a),{},{defaultCountry:void 0}));try{return zw(t,a,n)}catch(o){if(!(o instanceof Li))throw o}}function Uw(){var t=Fw(arguments),a=t.text,n=t.options,o=t.metadata;return Vw(a,n,o)}function fg(){return L5(Uw,arguments)}const Qw=[...new Set([...Object.values(Lg).map(t=>String(t.phoneCc)),"1","34"])].sort((t,a)=>a.length-t.length);function n2(t,a){const n=String(t||"").trim();if(/^\+?\d+(?:[.,]\d+)?e\+?\d+$/i.test(n.replace(/\s/g,"")))return null;const o=n.replace(/^(\+?\d+)[.,]0+$/,"$1"),i=o.replace(/\D/g,"");return!i||/^0+$/.test(i)?null:!o.startsWith("+")&&i.startsWith("00")&&Qw.find(u=>i.startsWith("00"+u))?"+"+i.slice(2):String(a||"").toUpperCase()==="MX"&&/^04[45]\d{10}$/.test(i)?i.slice(3):o}function Kw(t,a="CO"){if(!t)return;const n=String(t).trim();if(!n)return;const o=n2(n,a);if(o!==null)try{const i=fg(o,a);if(!i||!i.isValid()){const s=o.replace(/\D/g,"");if(/^521\d{10}$/.test(s)){const u=fg("+52"+s.slice(3),"MX");if(u&&u.isValid())return u.format("E.164").replace(/^\+/,"")}return Wb(o,a==="CO"?"57":"")}return i.format("E.164").replace(/^\+/,"")}catch{return Wb(o,a==="CO"?"57":"")}}function Wb(t,a){let n=t.replace(/\D/g,"");if(n)return n.startsWith("0")&&(n=n.slice(1)),n.length===10&&a&&!n.startsWith(a)&&(n=a+n),n.length>=7?n:void 0}function Yw(t,a="CO"){if(t&&n2(String(t),a)===null)return"";let n=Kw(t,a)||String(t||"").replace(/\D/g,"");return String(a||"").toUpperCase()==="MX"&&/^521\d{10}$/.test(n)&&(n=`52${n.slice(3)}`),n}const Jw=/^54(?!9)(\d{10})$/;function Zw(t){const a=Jw.exec(t);return a?`549${a[1]}`:t}function Xw(t,a="CO"){return Zw(Yw(t,a))}function ek(t,a="CO",n=!1){const o=String(t||"").replace(/\D/g,"");if(!o)return null;const i=Xw(n?"+"+o:String(t),a);try{const s=i?fg("+"+i):void 0;return s&&s.isValid()?i:null}catch{return null}}function tk(t,a){const n=String(t??""),o=/wa\.me\/\+?(\d[\d\s().-]{6,})/i.exec(n)||/[?&]phone=\+?(\d[\d\s().-]{6,})/i.exec(n),i=String(o?o[1]:n).replace(/\D/g,"");if(i.length<7)return"";const s=!!o||/^\s*\+/.test(n);try{const u=String(a||"CO");return ek(i,u,s)||lj(i,ad(u))}catch{return i}}function o2(t){let a=String(t||"").trim();const n=a.match(/```+[a-z]*\s*\n([\s\S]*?)\n?```+/i);return n?a=n[1]:a=a.replace(/^```+[a-z]*\s*\n?/i,"").replace(/\n?```+\s*$/i,""),a.trim()}function r2(t){return/<\s*(!doctype|html|head|body|div|section|main|header|style|h1|img|form|article)\b/i.test(t)}const Gu="#0866ff",i2=` 291/* La hoja en blanco: fondo vivo + halo que late detrás del logo + luz que cruza la frase. */ 292/* Tres luces grandes y muy difusas que se cruzan despacio. Van por DEBAJO (z-index 0) y 293 el contenido va encima (z-index 1). El desenfoque las vuelve color, no formas: asà no 294 parece un adorno pegado, sino que la hoja está viva. */ 295/* Las luces recorren MÃS camino y se encienden y apagan mientras lo hacen: antes solo 296 se movÃan un poco y quedaban como manchas quietas (Andrés, 21-sep-2026: «esos efectos 297 de las esquinas creo que pueden mejorar en efecto movimiento»). */ 298.lk-hoja > .lk-luz{position:absolute;border-radius:50%;filter:blur(32px);pointer-events:none;z-index:0} 299.lk-luz.a{width:230px;height:230px;top:-70px;left:-64px;background:rgba(8,102,255,.34);animation:lk-vaga-a 13s ease-in-out infinite} 300.lk-luz.b{width:200px;height:200px;bottom:-56px;right:-52px;background:rgba(139,92,246,.32);animation:lk-vaga-b 16s ease-in-out infinite} 301.lk-luz.c{width:170px;height:170px;top:42%;left:50%;background:rgba(56,189,248,.24);
301animation:lk-vaga-c 19s ease-in-out infinite} 302@keyframes lk-vaga-a{0%,100%{transform:translate(0,0) scale(1);opacity:.75} 303 30%{transform:translate(96px,74px) scale(1.2);opacity:1} 304 62%{transform:translate(28px,168px) scale(.86);opacity:.6}} 305@keyframes lk-vaga-b{0%,100%{transform:translate(0,0) scale(1);opacity:.8} 306 34%{transform:translate(-88px,-96px) scale(.88);opacity:.55} 307 68%{transform:translate(-132px,32px) scale(1.24);opacity:1}} 308@keyframes lk-vaga-c{0%,100%{transform:translate(-50%,-50%) scale(1);opacity:.5} 309 50%{transform:translate(-128%,-14%) scale(1.3);opacity:.95}} 310.lk-hoja > *:not(.lk-luz){position:relative;z-index:1} 311/* Entrada escalonada: primero el logo, después la frase. La hoja en blanco se arma 312 sola al abrirla, en vez de aparecer ya puesta (Andrés, 21-sep-2026: «me gustó lo de 313 crea algo increÃble, si se puede mejorar serÃa perfecto»). */ 314.lk-halo{position:relative;display:grid;place-items:center;width:58px;height:58px;margin-bottom:16px; 315 animation:lk-entra .7s cubic-bezier(.2,.8,.25,1) both} 316.lk-halo::before{content:'';position:absolute;width:112px;height:112px;border-radius:50%; 317 background:radial-gradient(circle,rgba(8,102,255,.26),rgba(139,92,246,.16) 45%,transparent 70%); 318 animation:lk-latido 3.6s ease-in-out .7s infinite} 319@keyframes lk-latido{0%,100%{transform:scale(.82);opacity:.55}50%{transform:scale(1.12);opacity:1}} 320@keyframes lk-entra{from{opacity:0;transform:translateY(9px) scale(.9)}to{opacity:1;transform:none}} 321.lk-frase{font-size:24px;font-weight:900;line-height:1.18;letter-spacing:-.018em; 322 background:linear-gradient(100deg,#0b1020 0%,#0b1020 38%,#0866ff 50%,#8b5cf6 58%,#0b1020 70%,#0b1020 100%); 323 background-size:280% 100%;-webkit-background-clip:text;background-clip:text; 324 -webkit-text-fill-color:transparent;color:transparent; 325 /* La entrada corre una vez; el brillo empieza después y ya no para. */ 326 animation:lk-entra .7s cubic-bezier(.2,.8,.25,1) .12s both, lk-brillo 7s ease-in-out 1.1s infinite} 327@keyframes lk-brillo{0%,22%{background-position:150% 0}72%,100%{background-position:-50% 0}} 328/* Sin variante oscura A PROPÃSITO: esto vive DENTRO del teléfono simulado, que siempre 329 es blanco (asà ve el comprador la página). Con texto claro se volverÃa invisible. */ 330@media (prefers-reduced-motion: reduce){ 331 .lk-halo{animation:none} 332 .lk-halo::before{animation:none;transform:scale(1);opacity:.7} 333 .lk-frase{animation:none;background-position:50% 0} 334 /* Las luces se quedan donde nacen: el color sigue, el movimiento no. */ 335 .lk-hoja > .lk-luz{animation:none} 336 .lk-luz.c{transform:translate(-50%,-50%)} 337} 338/* El fondo de la pantalla: la aurora del inicio de ecomdroptv.com, en suave. Luces grandes 339 y tenues que derivan (sin filtro de desenfoque: el borde suave lo da el degradado), en 340 azul, lila y celeste, sin verde. Se anima moviendo capas, sin repintar. Los puntos y el 341 mouse los pone CieloLumy. */ 342.lk-fondo-pantalla{position:absolute;inset:0;z-index:-1;pointer-events:none;overflow:hidden} 343.lk-fondo-pantalla b{position:absolute;border-radius:50%;will-change:transform} 344.lk-fondo-pantalla b:nth-child(1){width:min(56vw,760px);height:min(56vw,760px);top:-260px;left:-200px; 345 background:radial-gradient(circle,rgba(8,102,255,.075),rgba(8,102,255,0) 66%);animation:lk-pant-a 30s ease-in-out infinite} 346.lk-fondo-pantalla b:nth-child(2){width:min(52vw,720px);height:min(52vw,720px);top:-180px;right:-240px; 347 background:radial-gradient(circle,rgba(124,92,246,.055),rgba(124,92,246,0) 66%);animation:lk-pant-b 38s ease-in-out infinite} 348.lk-fondo-pantalla b:nth-child(3){width:min(48vw,660px);height:min(48vw,660px);bottom:-280px;left:30%; 349 background:radial-gradient(circle,rgba(34,211,238,.06),rgba(34,211,238,0) 68%);animation:lk-pant-c 44s ease-in-out infinite} 350@keyframes lk-pant-a{0%,100%{transform:translate3d(0,0,0) scale(1)}50%{transform:translate3d(8vw,6vh,0) scale(1.15)}} 351@keyframes lk-pant-b{0%,100%{transform:translate3d(0,0,0) scale(1)}50%{transform:translate3d(-7vw,5vh,0) scale(1.2)}} 352@keyframes lk-pant-c{0%,100%{transform:translate3d(0,0,0) scale(1.05)}50%{transform:translate3d(5vw,-6vh,0) scale(.9)}} 353@media (prefers-reduced-motion: reduce){.lk-fondo-pantalla b{animation:none}} 354.lk-cabecera-codigo{padding-right:190px} 355@media (max-width: 768px){.lk-cabecera-codigo{padding-right:64px}} 356.lk-barra-codigo{display:flex;align-items:center;gap:10px 8px;flex-wrap:wrap;margin-bottom:10px} 357.lk-vistas{display:inline-flex;gap:2px;padding:4px;border-radius:13px;background:var(--bg-tertiary,#eef1f7);box-shadow:inset 0 0 0 1px var(--border,#e3e7ef)} 358.lk-vista{border:0;background:transparent;color:var(--text-secondary,#64748b);font:inherit;font-size:12.5px;font-weight:700;padding:6px 12px;border-radius:9px;
358cursor:pointer;transition:background .15s,color .15s,box-shadow .15s;white-space:nowrap} 359.lk-vista:hover{color:var(--text,#0f172a)} 360.lk-vista.on{background:var(--card-bg,#fff);color:var(--text,#0f172a);box-shadow:0 1px 2px rgba(15,23,42,.08),0 2px 8px -2px rgba(15,23,42,.12)} 361/* La segunda fila: ocupa el ancho entero, asà siempre baja debajo de las vistas. */ 362.lk-acciones{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:1 1 100%} 363/* Ver y Publicar: justo al lado de «El pedido» (Andrés, 23-sep-2026). Si la fila no 364 cabe, bajan juntos. */ 365.lk-separa{display:inline-flex;gap:7px;align-items:center;flex-wrap:wrap} 366.lk-accion{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--border,#e3e7ef);background:var(--card-bg,#fff);color:var(--text,#0f172a);font:inherit;font-size:12.5px;font-weight:700;padding:8px 12px;border-radius:11px;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.05);transition:border-color .15s,box-shadow .15s,transform .15s} 367.lk-accion svg{color:var(--text-secondary,#64748b);transition:color .15s} 368.lk-accion:hover{border-color:rgba(8,102,255,.45);box-shadow:0 4px 14px -6px rgba(8,102,255,.35)} 369.lk-accion:hover svg{color:#0866ff} 370.lk-accion:disabled{cursor:wait;opacity:.7} 371.lk-ia{display:inline-flex;align-items:center;gap:8px;border:0;color:#fff;font:inherit;font-size:12.5px;font-weight:800;padding:9px 14px;border-radius:11px;cursor:pointer;background:linear-gradient(135deg,#1a73ff 0%,#5b5bf7 55%,#8b5cf6 100%);box-shadow:0 1px 0 rgba(255,255,255,.25) inset,0 6px 18px -6px rgba(91,91,247,.65);transition:transform .15s,box-shadow .15s,filter .15s} 372.lk-ia:hover{transform:translateY(-1px);box-shadow:0 1px 0 rgba(255,255,255,.25) inset,0 10px 24px -8px rgba(91,91,247,.75)} 373.lk-ia:active{transform:none} 374.lk-ia.ok{background:linear-gradient(135deg,#0e9f6e,#0b7a4b);box-shadow:0 6px 18px -6px rgba(11,122,75,.6)} 375.lk-vista:focus-visible,.lk-accion:focus-visible,.lk-ia:focus-visible{outline:2px solid #0866ff;outline-offset:2px} 376@media (prefers-reduced-motion: reduce){.lk-ia,.lk-accion,.lk-vista{transition:none}.lk-ia:hover{transform:none}} 377`;function s2(){return e.jsxs("div",{className:"lk-fondo-pantalla","aria-hidden":"true",children:[e.jsx("b",{}),e.jsx("b",{}),e.jsx("b",{}),e.jsx(Fj,{enCaja:!0,suave:!0})]})}function l2(){return e.jsxs("div",{className:"lk-hoja",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:3,padding:22,textAlign:"center",background:"#fff",overflow:"hidden"},children:[e.jsx("span",{className:"lk-luz a","aria-hidden":"true"}),e.jsx("span",{className:"lk-luz b","aria-hidden":"true"}),e.jsx("span",{className:"lk-luz c","aria-hidden":"true"}),e.jsx("div",{className:"lk-halo",children:e.jsx("img",{src:"/logos/iconoF.png",alt:"Lumy",width:"58",height:"58",style:{objectFit:"contain",display:"block",position:"relative",zIndex:1}})}),e.jsx("div",{className:"lk-frase",children:"Crea algo increÃble"}),e.jsx("button",{onClick:()=>dj(),style:{position:"relative",zIndex:1,marginTop:16,background:"none",border:0,color:"var(--text-secondary, #64748b)",fontSize:12,fontWeight:700,cursor:"pointer",fontFamily:"inherit",textDecoration:"underline"},children:"Conectar mi Claude o mi ChatGPT con Lumy"})]})}const El={width:15,height:15,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},wo={subir:()=>e.jsxs("svg",{...El,children:[e.jsx("path",{d:"M12 16V4"}),e.jsx("path",{d:"m6 10 6-6 6 6"}),e.jsx("path",{d:"M4 20h16"})]}),fotos:()=>e.jsxs("svg",{...El,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("circle",{cx:"9",cy:"9",r:"1.8"}),e.jsx("path",{d:"m21 15-4.5-4.5L6 21"})]}),importar:()=>e.jsxs("svg",{...El,children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 2v6h6M12 18v-6m-3 3 3-3 3 3"})]}),descargar:()=>e.jsxs("svg",{...El,children:[e.jsx("path",{d:"M12 3v12m-4-4 4 4 4-4"}),e.jsx("path",{d:"M5 21h14"})]}),traer:()=>e.jsxs("svg",{...El,children:[e.jsx("path",{d:"M12 21V9"}),e.jsx("path",{d:"m6 15 6 6 6-6"}),e.jsx("path",{d:"M4 3h16"})]}),plantilla:()=>e.jsxs("svg",{...El,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),e.jsx("path",{d:"M3 9h18M9 21V9"})]}),listo:()=>e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),chispa:()=>
377e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("path",{d:"M12 2.5c.5 3.9 2.6 6 6.5 6.5-3.9.5-6 2.6-6.5 6.5-.5-3.9-2.6-6-6.5-6.5 3.9-.5 6-2.6 6.5-6.5Z"}),e.jsx("path",{d:"M19 14.5c.25 1.9 1.1 2.75 3 3-1.9.25-2.75 1.1-3 3-.25-1.9-1.1-2.75-3-3 1.9-.25 2.75-1.1 3-3Z",opacity:".75"})]})};function d2({señalando:t,onClick:a}){return e.jsxs("button",{type:"button",onClick:a,title:t?"Toca una parte de la página: te lleva a su lÃnea y se apaga solo. Escape para salir.":"Enciéndelo y toca cualquier parte de la página para saltar a su lÃnea de código",style:{display:"inline-flex",alignItems:"center",gap:5,border:`1px solid ${t?Gu:"var(--border, #e5e7eb)"}`,background:t?"rgba(8,102,255,.1)":"var(--card-bg, #fff)",color:t?Gu:"var(--text-secondary, #64748b)",borderRadius:8,padding:"4px 9px",fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap"},children:[e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m3 3 7.5 18 2.5-7.5L20.5 11z"})}),t?"Señalando":"Señalar y ver su código"]})}function c2(){return e.jsx("span",{style:{fontFamily:"ui-monospace, Menlo, monospace",fontWeight:800,fontSize:11,color:Gu,background:"rgba(8,102,255,.1)",border:"1px solid rgba(8,102,255,.28)",borderRadius:7,padding:"3px 8px",whiteSpace:"nowrap"},children:"Modo código"})}const am=t=>typeof document>"u"?t:Wo.createPortal(t,document.body),nm={position:"fixed",inset:0,background:"rgba(10,15,32,.55)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100100,padding:16},om={background:"var(--card-bg, #fff)",borderRadius:16,padding:18,width:"100%",boxShadow:"0 30px 70px -30px rgba(6,12,34,.6)"},rm={border:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",color:"var(--text, #111)",borderRadius:10,padding:"8px 15px",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"inherit"};function u2({items:t,copiado:a,onCopiar:n,onMeter:o,onCerrar:i}){return am(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Mis fotos y videos",onClick:i,style:nm,children:e.jsxs("div",{onClick:s=>s.stopPropagation(),style:{...om,maxWidth:760,maxHeight:"86vh",overflowY:"auto"},children:[e.jsx("h3",{style:{margin:"0 0 4px",fontSize:16.5,color:"var(--text, #111)"},children:"Mis fotos y videos"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 14px"},children:t.length?"Toca una para meterla en tu código donde tengas el cursor, o copia su dirección.":"TodavÃa no has subido nada. Usa «Subir foto o video»."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(118px, 1fr))",gap:10},children:t.map(s=>{const u=/\.(mp4|webm|mov)$/i.test(s.url);return e.jsxs("div",{style:{border:"1px solid var(--border, #e8eaf0)",borderRadius:11,overflow:"hidden",background:"var(--bg-tertiary, #f8f9fc)"},children:[e.jsx("button",{onClick:()=>o(ov({url:s.url,tipo:u?"video":"imagen"})),title:"Meter en el código",style:{display:"block",width:"100%",aspectRatio:"1 / 1",border:0,padding:0,background:"#0b1020",cursor:"pointer"},children:u?e.jsx("span",{style:{color:"#9fb4d8",fontSize:22},children:"â¶"}):e.jsx("img",{src:s.url,alt:"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),e.jsx("button",{onClick:()=>n(s.url),style:{width:"100%",border:0,borderTop:"1px solid var(--border, #eef1f6)",background:"var(--card-bg, #fff)",color:a===s.url?"var(--success, #0b7a4b)":"var(--text-secondary, #64748b)",fontSize:11,fontWeight:800,padding:"6px 4px",cursor:"pointer",fontFamily:"inherit"},children:a===s.url?"¡copiada!":"Copiar dirección"})]},s.key)})}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:e.jsx("button",{onClick:i,style:rm,children:"Cerrar"})})]})}))}function p2({medios:t,copiado:a,onCopiar:n,onMeter:o,onCerrar:i}){return am(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Lo que acabas de subir",onClick:i,style:nm,children:e.jsxs("div",{onClick:s=>s.stopPropagation(),style:{...om,maxWidth:620,maxHeight:"86vh",overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:4},children:[e.jsx("span",{style:{fontSize:18},children:"â"}),e.jsx("h3",{style:{margin:0,fontSize:16.5,color:"var(--text, #111)"},children:t.length===1?"Listo, ya está en Lumy":`Listos: ${t.length} archivos en Lumy`})]}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 14px"},children:"Copia la dirección y úsala en tu código, o mete la etiqueta ya armada de un toque."}),t.map(s=>e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:10,marginBottom:9,flexWrap:"wrap"},children:[s.tipo==="imagen"?e.jsx("img",{src:s.url,alt:"",style:{width:64,height:64,objectFit:"cover",borderRadius:9,flex:"none",background:"var(--bg-tertiary, #f6f8fc)"}}
377):e.jsx("video",{src:s.url,muted:!0,playsInline:!0,style:{width:64,height:64,objectFit:"cover",borderRadius:9,flex:"none",background:"#0b1020"}}),e.jsxs("div",{style:{flex:"1 1 220px",minWidth:0},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:800,color:"var(--text, #111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.nombre}),e.jsx("code",{style:{display:"block",fontSize:11,color:"var(--text-secondary, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.url})]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>n(s.url),style:{border:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",color:a===s.url?"var(--success, #0b7a4b)":"var(--text, #111)",borderRadius:9,padding:"7px 12px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:a===s.url?"¡copiada!":"Copiar dirección"}),e.jsx("button",{onClick:()=>o(ov(s)),style:{border:0,background:Gu,color:"#fff",borderRadius:9,padding:"7px 12px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Meter en el código"})]})]},s.url)),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:e.jsx("button",{onClick:i,style:rm,children:"Cerrar"})})]})}))}function g2({valor:t,onCambio:a,onMeter:n,onCerrar:o}){const i=!!String(t||"").trim();return am(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Pegar el código de la IA",onMouseDown:s=>{s.target===s.currentTarget&&o()},style:nm,children:e.jsxs("div",{style:{...om,maxWidth:620},children:[e.jsx("h3",{style:{margin:"0 0 4px",fontSize:16.5,color:"var(--text, #111)"},children:"Pega aquà lo que te dio la IA"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 12px"},children:"Tu navegador no me deja leer lo que copiaste. Pégalo aquà y yo lo meto en el editor. Si viene envuelto en acentos graves, se los quito."}),e.jsx("textarea",{autoFocus:!0,value:t,onChange:s=>a(s.target.value),rows:9,spellCheck:!1,placeholder:"Pega aquà el código (Cmd+V)",style:{width:"100%",boxSizing:"border-box",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"10px 12px",fontSize:12.5,fontFamily:"ui-monospace, Menlo, monospace",background:"var(--input-bg, #fff)",color:"var(--text, #111)",resize:"vertical"}}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{onClick:o,style:{...rm,padding:"8px 14px"},children:"Cancelar"}),e.jsx("button",{onClick:()=>{n(t||"")&&o()},disabled:!i,style:{background:"linear-gradient(100deg, #0866ff, #8b5cf6)",color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:13,fontWeight:800,cursor:i?"pointer":"default",opacity:i?1:.5,fontFamily:"inherit"},children:"Meter en el editor"})]})]})}))}function m2({srcDoc:t,onCerrar:a}){const n=h.useRef(a);return n.current=a,h.useEffect(()=>{const o=document.body.style.overflow,i=s=>{s.key==="Escape"&&n.current()};return document.body.style.overflow="hidden",window.addEventListener("keydown",i),()=>{document.body.style.overflow=o,window.removeEventListener("keydown",i)}},[]),typeof document>"u"?null:Wo.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Vista previa completa",onMouseDown:o=>{o.target===o.currentTarget&&a()},style:{position:"fixed",inset:0,zIndex:100050,background:"rgba(3,7,18,.78)",padding:"clamp(10px,2vw,24px)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,background:"#0b1020",color:"#fff",padding:"9px 12px",borderRadius:"14px 14px 0 0"},children:[e.jsx("strong",{style:{fontSize:13.5},children:"Vista responsive completa"}),e.jsx("span",{style:{fontSize:11.5,opacity:.7},children:"Cambia el ancho de la ventana para revisar móvil y escritorio."}),e.jsx("button",{type:"button",onClick:a,"aria-label":"Cerrar vista completa",style:{marginLeft:"auto",border:"1px solid rgba(255,255,255,.2)",background:"rgba(255,255,255,.08)",color:"#fff",borderRadius:9,padding:"6px 10px",cursor:"pointer",font:"inherit",fontWeight:800},children:"Cerrar"})]}),e.jsx("iframe",{title:"Vista previa completa",srcDoc:t,sandbox:"allow-scripts allow-modals allow-popups",style:{flex:1,width:"100%",minHeight:0,border:0,background:"#fff",borderRadius:"0 0 14px 14px"}})]}),document.body)}const Iu="#0866ff",zl={border:"1px solid var(--border, #e8eaf0)",borderRadius:14,background:"var(--card-bg, #fff)",overflow:"hidden"},lu={fontSize:11.5,fontWeight:800,color:"var(--warning, #b45309)",background:"rgba(245,158,11,.10)",border:"1px solid rgba(180,83,9,.25)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap",cursor:"pointer",fontFamily:"inherit"},vp={border:0,background:"none",color:Iu,padding:0,fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap"};function ak({onVolver:t,onPublicado:a,ajustes:n,versionDeLaTienda:o,onEditarProducto:i,onCrearProducto:s,configEnVivo:u,tiendaEnVivo:m,guardarAjustes:c,avisosDeLaTienda:g}){const f=$a(),[b,v]=h.useState(!0),[j,S]=h.useState(null),[$,C]=h.useState(""),[_,N]=h.useState([]),[w,M]=h.useState([]),[p,V]=h.useState(null),[L,x]=h.useState([]),[z,G]=h.useState(null),[B,U]=h.useState("codigo"),[ne,Q]=h.useState(""),[de,pe]=h.useState(""),[ce,ve]=h.useState(!1),[ge,Te]=h.useState(""),[ie,fe]=h.useState(!1),[Be,We]=h.useState(!1),[ze,tt]=h.useState(null),[Fe,F]=h.useState(""),[Re,K]=h.useState(""),[I,H]=h.useState(null),[ye,De]=h.useState(null),[Ue,se]=h.useState(!1),[we,Ye]=h.useState(null),[lt,jt]=h.useState(!1),[Je,Ct]=h.useState(""),[st,la]=h.useState(""),[ia,ha]=h.useState(new Set),da=h.useRef(null),Na=h.useRef(null),wa=h.useRef(null),La=h.useRef(null),Gt=h.useRef(0),he=h.useRef(""),Me=h.useRef(!1),[yt,kt]=h.useState(!1),ct=h.useRef("");ct.current=$;const xt=h.useRef(!1),Ut=X=>{N(Array.isArray(X==null?void 0:X.productos)?X.productos:[]),M(Array.isArray(X==null?void 0:X.categorias)?X.categorias:[]),X!=null&&X.resumen&&V(X.resumen),X!=null&&X.tienda&&G(X.tienda),Array.isArray(X==null?void 0:X.pagos_conectados)&&x(X.pagos_conectados.map(ae=>String(ae))),X!=null&&X.codigo&&"dominio_propio"in X.codigo&&S(ae=>ae&&{...ae,dominio_propio:String(X.codigo.dominio_propio||"")})},Qt=h.useCallback(async()=>{v(!0),Q("");try{await gv("tienda-codigo");const ae=await(await f("/api/landing/store-codigo")).json();if(!(ae!=null&&ae.ok)){Q((ae==null?void 0:ae.message)||"No se pudo abrir el código de la tienda.");return}const ot=ae.codigo;S(ot),Gt.current=Number(ot.revision)||0,he.current=String(ot.borrador||""),Me.current=!1,kt(!1),xt.current=!0,C(String(ot.borrador||"")),Ut(ae)}catch{Q("Error de conexión. Recarga la página.")}finally{v(!1)}},[f]);h.useEffect(()=>{Qt()},[Qt]);const $e=h.useRef(!0);h.useEffect(()=>{if($e.current){$e.current=!1;return}let X=!0;const ae=setTimeout(()=>{f("/api/landing/store-codigo?solo=catalogo").then(ot=>ot.json()).then(ot=>{X&&(ot!=null&&ot.ok)&&Ut(ot)}).catch(()=>{})},400);return()=>{X=!1,clearTimeout(ae)}},[o,f]);const{token:Pe}=ni(),ue=Wg({esperaMs:1200,clave:"tienda-codigo",sesion:()=>Pg()?null:Pe,preparar:()=>xt.current?Me.current?{falta:"El código cambió en otra pestaña o desde el asistente. Recárgalo para seguir guardando."}:{cuerpo:{html:ct.current}}:{falta:"Cargando el códigoâ¦"},enviar:async(X,ae)=>{if(X.html===he.current)return{ok:!0,datos:null};const ot=await qg(f,"/api/landing/store-codigo","PUT",{html:X.html,expected_revision:Gt.current},ae);return!ot.ok&&ot.status===409&&(Me.current=!0,kt(!0)),ot},alGuardar:(X,{cuerpo:ae})=>{var ot;X&&(he.current=ae.html,Gt.current=Number((ot=X.codigo)==null?void 0:ot.revision)||Gt.current,S(X.codigo))}}),oe=X=>{C(X),ue.marcarEdicion()};h.useEffect(()=>{if(b)return;if(!$.trim()){Te("");return}let X=!0;const ae=setTimeout(async()=>{try{const it=await(await f("/api/landing/store-codigo-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$})})).json().catch(()=>({}));X&&(it!=null&&it.ok)&&Te(String(it.html||""))}catch{}},700);return()=>{X=!1,clearTimeout(ae)}},[$,b,f,o]);const Ae=h.useRef(0);h.useEffect(()=>{const X=ae=>{var ma;const ot=ae==null?void 0:ae.data;if(!ot||typeof ot!="object"||!("lumyCodigoScroll"in ot))return;const it=(ma=La.current)==null?void 0:ma.querySelector("iframe");it&&ae.source&&ae.source!==it.contentWindow||(Ae.current=Math.max(0,Number(ot.lumyCodigoScroll)||0))};return window.addEventListener("message",X),()=>window.removeEventListener("message",X)},[]);const He=h.useRef(null),ut=X=>
377{B==="codigo"&&da.current&&(He.current=da.current.selectionStart??null),U(X)},at=X=>{const ot=ct.current.split(` 378`);if(X<1||X>ot.length)return;let it=0;for(let ta=0;ta<X-1;ta++)it+=ot[ta].length+1;const ma=it+ot[X-1].length;U("codigo"),setTimeout(()=>{const ta=da.current;if(ta)try{ta.focus(),ta.setSelectionRange(it,ma);const pn=ta.scrollHeight/Math.max(1,ot.length);ta.scrollTop=Math.max(0,pn*(X-1)-ta.clientHeight/2)}catch{}},60)},dt=X=>{const ae=da.current,ot=ct.current,it=ae?ae.selectionStart??ot.length:Math.min(He.current??ot.length,ot.length),ma=ae?ae.selectionEnd??it:it;C(ta=>ta.slice(0,Math.min(it,ta.length))+X+ta.slice(Math.min(ma,ta.length))),ue.marcarEdicion(),He.current=it+X.length,U("codigo"),setTimeout(()=>{const ta=da.current;if(ta)try{ta.focus(),ta.selectionStart=ta.selectionEnd=it+X.length}catch{}},60)};h.useEffect(()=>{if(!Be)return;const X=ma=>{var ta,pn,Gn;try{(Gn=(pn=(ta=La.current)==null?void 0:ta.querySelector("iframe"))==null?void 0:pn.contentWindow)==null||Gn.postMessage({lumyCodigoInspect:ma},"*")}catch{}},ae=ma=>{var Ln;const ta=ma==null?void 0:ma.data;if(!ta||typeof ta!="object"||!("lumyCodigoLinea"in ta))return;const pn=(Ln=La.current)==null?void 0:Ln.querySelector("iframe");if(!pn||ma.source!==pn.contentWindow)return;const Gn=Number(ta.lumyCodigoLinea)||0;tt({linea:Gn,etiqueta:String(ta.etiqueta||""),deLumy:!!ta.deLumy,producto:Number(ta.producto)||0,zona:String(ta.zona||"")}),Gn>0&&at(Gn),We(!1)},ot=ma=>{ma.key==="Escape"&&We(!1)};window.addEventListener("message",ae),window.addEventListener("keydown",ot),X(!0);const it=setInterval(()=>X(!0),1200);return()=>{window.removeEventListener("message",ae),window.removeEventListener("keydown",ot),clearInterval(it),X(!1)}},[Be,ge]);const Ge=h.useMemo(()=>{var ae;if(!p)return null;if(!u)return p;let X=p.whatsapp;try{X=tk((ae=u==null?void 0:u.social)==null?void 0:ae.wa,p.pais)}catch{}return E5(u,{pais:p.pais,pagosConectados:L,whatsapp:X,agenteConectado:p.agente==="conectado"&&X===p.whatsapp,direccion:m?m.direccion:p.direccion,dominioPropio:m?m.dominioPropio:p.dominioPropio,tiendaPrendida:m?m.prendida:p.tiendaPrendida})},[p,u,m,L]),vt=m?m.prendida:!!(z!=null&&z.activa),Nt=m?m.dominioPropio:String((j==null?void 0:j.dominio_propio)||""),sa=!!Nt,Pa=!!Ge&&!Ge.carrito.activo,Ot=_.length,Ia=h.useCallback(X=>bb(X,{dominioPropio:sa,productos:Ot,carritoApagado:Pa}),[sa,Ot,Pa]),za=h.useMemo(()=>bb($,{dominioPropio:sa,productos:Ot,carritoApagado:Pa}),[$,sa,Ot,Pa]),sn=h.useMemo(()=>za.filter(X=>k5.test(X.texto)),[za]),ba=!!j&&($!==j.publicado||!j.activo),Ga=h.useMemo(()=>Zu((Ge==null?void 0:Ge.pais)||"CO"),[Ge==null?void 0:Ge.pais]),Ie=X=>_.find(ae=>ae.id===X)||null,ka=X=>{ut("tienda");try{window.dispatchEvent(new CustomEvent("lumy:guia-ir",{detail:{tipo:"seccion-tienda",seccion:X}}))}catch{}setTimeout(()=>{var ae;try{(ae=document.getElementById("st-sec-"+X))==null||ae.scrollIntoView({behavior:"smooth",block:"start"})}catch{}},120)},Zo=(X,ae="precio")=>{!X||!i||i({id:X.id,tipo:X.tipo,nombre:X.nombre,que:ae})},Cn=async()=>{if(!$.trim()){Q("Escribe tu tienda o usa la plantilla antes de publicar.");return}ve(!0),Q(""),pe("");try{if(c&&!await c()){Q("No se pudieron guardar los ajustes de tu tienda antes de publicar. Revisa «Tu tienda».");return}if(!(ue.hayPendiente()?await ue.guardarYa():(await ue.esperar(),!0))||ct.current!==he.current){Q("No se pudo guardar lo último antes de publicar. Revisa el aviso de arriba.");return}const ae=await ue.enCola(async()=>{var ma;const ot=await f("/api/landing/store-codigo-publicar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected_revision:Gt.current})}),it=await ot.json().catch(()=>({}));return ot.ok&&(it!=null&&it.ok)&&(Gt.current=Number((ma=it.codigo)==null?void 0:ma.revision)||Gt.current),ot.ok?it:{...it,ok:!1}});if(!(ae!=null&&ae.ok)){Q((ae==null?void 0:ae.message)||"No se pudo publicar."),ae!=null&&ae.linea&&at(Number(ae.linea));return}S(ae.codigo),pe(vt?"Publicado: tu tienda ya se ve con tu código â":"Tu código quedó publicado, pero tu tienda está apagada: nadie la ve todavÃa. Préndela en Tu tienda â Publicar y dirección."),setTimeout(()=>pe(""),vt?5e3:12e3),a==null||a(!0)}catch{Q("Error de conexión. Intenta de nuevo.")}finally{ve(!1)}},Xo=async()=>
378{if(window.confirm("¿Despublicar tu código? Tu tienda pública vuelve al diseño visual ahora mismo. Tu código queda guardado aquà para cuando quieras.")){Q("");try{const X=await ue.enCola(async()=>{var ma;const ae=Gt.current,it=await(await f("/api/landing/store-codigo-desactivar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected_revision:ae})})).json().catch(()=>({}));return it!=null&&it.ok&&(Number((ma=it.codigo)==null?void 0:ma.revision)===ae+1?Gt.current=Number(it.codigo.revision):(Me.current=!0,kt(!0))),it});if(!(X!=null&&X.ok)){Q((X==null?void 0:X.message)||"No se pudo cambiar.");return}S(X.codigo),pe("Tu tienda volvió al diseño visual. Tu código queda guardado aquÃ."),setTimeout(()=>pe(""),6e3),a==null||a(!1)}catch{Q("Error de conexión. Intenta de nuevo.")}}},Nn=async()=>{if(lt)return;const X=window.open("","_blank");jt(!0);try{if(c&&!await c()){X==null||X.close(),Q("No se pudieron guardar los ajustes de tu tienda. Revisa «Tu tienda» y vuelve a probar.");return}if(!(ue.hayPendiente()?await ue.guardarYa():(await ue.esperar(),!0))||ct.current!==he.current){X==null||X.close(),Q("No se pudo guardar lo último: la prueba mostrarÃa una versión vieja. Revisa el aviso de arriba y vuelve a probar.");return}const it=await(await f("/api/landing/store-codigo-prueba")).json();it!=null&&it.ok&&it.url?X?X.location.href=it.url:window.location.href=it.url:(X==null||X.close(),Q("No se pudo abrir la prueba."))}catch{X==null||X.close(),Q("Error de conexión.")}finally{jt(!1)}},er=async(X,ae)=>{try{await navigator.clipboard.writeText(X),K(ae),setTimeout(()=>K(""),1800)}catch{K("")}},Oa=async X=>{if(!X.length)return;F(`Subiendo ${X.length===1?"tu archivo":`${X.length} archivos`}â¦`);const{medios:ae,fallaron:ot}=await rv(f,X,it=>F(`Subiendo⦠${it} de ${X.length}`));F(ot.length?ot.map(it=>`${it.nombre}: ${it.motivo}`).join(" · "):""),ot.length&&setTimeout(()=>F(""),9e3),ae.length&&H(ae)},Xa=async()=>{se(!0);try{const ae=await(await f("/api/landing/media")).json();De(Array.isArray(ae==null?void 0:ae.items)?ae.items:[])}catch{De([])}finally{se(!1)}},Kn=async X=>{const ae=X==null?void 0:X[0];if(ae&&!($.trim()&&!window.confirm("Esto reemplazará el código que está en el editor. ¿Continuar?")))try{oe(await ae.text()),U("codigo")}catch{F("No pude leer ese archivo.")}},qa=()=>{const X=new Blob([$||""],{type:"text/html;charset=utf-8"}),ae=URL.createObjectURL(X),ot=document.createElement("a");ot.href=ae,ot.download=`${((Ge==null?void 0:Ge.nombre)||"tienda").toLowerCase().replace(/[^a-z0-9áéÃóúñ_-]+/gi,"-").replace(/^-|-$/g,"")||"tienda"}.html`,ot.click(),setTimeout(()=>URL.revokeObjectURL(ae),0)},_n=()=>{$.trim()&&!window.confirm("¿Reemplazar tu código por la plantilla? Tu borrador actual se pierde.")||(oe(S5),U("codigo"))},Va=X=>{const ae=o2(X);return ae?r2(ae)?$.trim()&&!window.confirm("Esto reemplazará el código que está en el editor. ¿Continuar?")?!1:(oe(ae),U("codigo"),F(""),setTimeout(()=>{var ot;return(ot=da.current)==null?void 0:ot.focus()},40),!0):(F("Eso no parece el código de la tienda: no trae etiquetas HTML. Copia solo el código que te dio la IA."),!1):(F("No habÃa nada que traer."),!1)},mn=async()=>{try{const X=await navigator.clipboard.readText();if(!String(X||"").trim()){Ye("");return}Va(X)}catch{Ye("")}},po=()=>{if(!Ge)return;const X=z5({codigo:$,dominioPropio:sa,resumen:Ge,productos:_.map(ae=>({id:ae.id,nombre:ae.nombre,precio:ae.precio,precioAntes:ae.precioAntes,categorias:ae.categorias,variantes:ae.variantes,imagen:ae.imagen,tipo:ae.tipo})),categorias:w.map(ae=>ae.nombre),avisos:za});er(X,"ia")},hn=h.useMemo(()=>{const X=String($||""),ae=[],ot=[...X.matchAll(/data-lumy-productos\s*=\s*"([^"]*)"/gi)].map(ta=>ta[1]||"todos"),it=(X.match(/data-lumy-productos(?!\s*=)/gi)||[]).length,ma=[...ot,...Array(it).fill("todos")];return ma.length&&ae.push({que:"Listas de productos",vale:ma.map(ta=>ta.replace(/^categoria:/i,"categorÃa ")).join(" · ")}),/data-lumy-categorias/i.test(X)&&ae.push({que:"CategorÃas",vale:w.length?`un botón por categorÃa con productos (${w.length})`:"todavÃa no tienes categorÃas"}),ae.push({que:"Carrito",vale:Pa?`apagado: actÃvalo en Tu tienda â Carrito y ofertas${/data-lumy-carrito(?![\w-])
378/i.test(X)?" (tu botón de carrito no abre nada mientras tanto)":""}`:/data-lumy-carrito(?![\w-])/i.test(X)?"tu propio botón":"el botón flotante de Lumy"}),/data-lumy-buscar/i.test(X)&&ae.push({que:"Buscador",vale:"por nombre, en vivo"}),/data-lumy-whatsapp/i.test(X)&&ae.push({que:"WhatsApp",vale:Ge!=null&&Ge.whatsapp?`+${Ge.whatsapp}`:"sin número: ponlo en Tu tienda â Marca y WhatsApp"}),ae.push({que:"PolÃticas",vale:/data-lumy-politicas/i.test(X)?"en tu pie de página":"no las pusiste (Meta y TikTok las piden)"}),/<script\b/i.test(X)&&ae.push({que:"JavaScript",vale:sa?`corre en ${Nt}`:"necesita tu dominio propio para publicarse"}),ae},[$,w.length,Ge==null?void 0:Ge.whatsapp,sa,Nt,Pa]),Co=h.useMemo(()=>{const X=Je.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");if(!X)return cg;const ae=ot=>ot.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").includes(X);return cg.map(ot=>({...ot,marcas:ae(ot.grupo)?ot.marcas:ot.marcas.filter(it=>ae(it.codigo)||ae(it.que))})).filter(ot=>ot.marcas.length>0)},[Je]),go=h.useMemo(()=>{const X=[];for(const ot of w){const it=_.filter(ma=>ma.categorias.includes(ot.nombre));it.length&&X.push({nombre:ot.nombre,productos:it})}const ae=_.filter(ot=>!ot.categorias.length);return ae.length&&X.push({nombre:X.length?"Sin categorÃa":"Todos tus productos",productos:ae}),X},[_,w]),fn=h.useMemo(()=>{const X=st.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");return X?_.filter(ae=>`${ae.nombre} ${ae.id} ${ae.categorias.join(" ")}`.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").includes(X)):null},[_,st]);if(b)return e.jsx("div",{style:{padding:24,fontSize:13,color:"var(--text-muted)"},children:"Abriendo el código de tu tiendaâ¦"});const Da=yt?{tipo:"error",mensaje:"cambió en otra pestaña o desde el asistente"}:ue.estado,Hn=ze&&ze.linea>0&&$.split(` 379`)[ze.linea-1]||"",Ra=ze!=null&&ze.producto?Ie(ze.producto):null,ln=Hn?["img","picture","source","video"].includes(String((ze==null?void 0:ze.etiqueta)||""))?"foto":/\{\{\s*producto\.(precio|precio_antes|descuento|ahorro)\s*\}\}/.test(Hn)?"precio":/producto\.imagen/.test(Hn)?"foto":/\{\{\s*producto\.nombre\s*\}\}/.test(Hn)?"nombre":/\{\{\s*producto\.descripcion\s*\}\}/.test(Hn)?"descripción":"":"",mo=X=>e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",padding:"8px 12px",borderTop:"1px solid var(--border, #f0f2f6)"},children:[e.jsx("span",{style:{width:40,height:40,borderRadius:9,flex:"none",background:X.imagen?`#f1f2f5 center/cover url('${X.imagen.replace(/'/g,"%27")}')`:"var(--bg-tertiary, #f1f2f5)"},"aria-hidden":"true"}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--text, #111827)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:X.nombre}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",gap:6,flexWrap:"wrap",alignItems:"baseline"},children:[e.jsx("span",{style:{fontWeight:700,color:"var(--text-secondary, #475569)",fontVariantNumeric:"tabular-nums"},children:X.precio>0?Ga(X.precio):"sin precio"}),X.precioAntes>X.precio&&e.jsx("s",{style:{opacity:.7},children:Ga(X.precioAntes)}),!!X.variantes.length&&e.jsxs("span",{children:["· ",X.variantes.map(ae=>`${ae.nombre}: ${ae.opciones.slice(0,5).join("/")}${ae.opciones.length>5?"â¦":""}`).join(" · ")]}),!X.imagen&&e.jsx("span",{style:{color:"var(--warning, #b45309)",fontWeight:700},children:"· sin foto"})]})]}),e.jsx("button",{type:"button",onClick:()=>void er(String(X.id),"id"+X.id),title:'Copiar el id (para data-lumy-productos="ids:â¦")',style:{flex:"none",border:"1px solid var(--border, #e3e7ef)",background:Re==="id"+X.id?"rgba(11,122,75,.08)":"var(--input-bg, #f6f8fb)",color:Re==="id"+X.id?"var(--success, #0b7a4b)":"var(--text-secondary, #475569)",borderRadius:7,padding:"3px 7px",fontFamily:"ui-monospace, Menlo, monospace",fontSize:11.5,fontWeight:800,cursor:"pointer"},children:Re==="id"+X.id?"copiado":`id ${X.id}`}),i&&e.jsx("button",{type:"button",onClick:()=>Zo(X),className:"lk-accion",style:{flex:"none",padding:"6px 10px",fontSize:12},children:"Editar"})]},X.id);return e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(10px, 1.6vw, 18px)",position:"relative",isolation:"isolate"},children:[e.jsx(s2,{}),e.jsx("style",{children:i2}),e.jsxs("div",{className:"lk-cabecera-codigo",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:10},children:[e.jsx("button",{type:"button",onClick:t,style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 13px",fontSize:13.5,fontWeight:700,cursor:"pointer",color:"var(--text, #111)",fontFamily:"inherit"},children:"â Editor visual"}),e.jsx("span",{style:{fontSize:14.5,fontWeight:800,color:"var(--text, #111)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ge!=null&&Ge.nombre?`${Ge.nombre} · tienda en código`:"Tienda en modo código"}),e.jsx(Wu,{estado:Da,enReposo:"Borrador guardado",style:{fontSize:12}}),e.jsx("span",{style:{fontSize:11.5,fontWeight:800,borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap",...j!=null&&j.activo?ba?{color:"var(--warning, #b45309)",background:"rgba(245,158,11,.10)",border:"1px solid rgba(180,83,9,.25)"}:{color:"var(--success, #0b7a4b)",background:"rgba(11,122,75,.08)",border:"1px solid rgba(11,122,75,.25)"}:{color:"var(--text-muted)",background:"var(--input-bg, #f4f6fa)",border:"1px solid var(--border, #e3e7ef)"}},children:j!=null&&j.activo?ba?"Publicada · con cambios sin publicar":"Publicada":"Sin publicar: tu tienda muestra el diseño visual"}),(m||z)&&!vt&&e.jsx("button",{type:"button",onClick:()=>ka("publicar"),style:lu,title:"Aunque publiques tu código, nadie ve la tienda mientras esté apagada",children:"Tu tienda está apagada · prenderla"}),Pa&&!!$.trim()&&e.jsx("button",{type:"button",onClick:()=>ka("carrito"),style:lu,title:"Sin carrito, «Agregar» abre la vista rápida y se pide un producto a la vez",children:"El carrito está apagado · activarlo"}),!_.length&&e.jsx("button",{type:"button",onClick:()=>ka("productos"),style:lu,children:"Tu tienda no tiene productos · elegirlos"}),!sa&&/<script\b/i.test($)&&e.jsx("button",{type:"button",style:lu,onClick:()=>window.alert("Tu JavaScript solo corre en TU dominio conectado a la tienda. En lumycol.com se quita, y tu tienda quedarÃa a medias: asà no te deja publicar. Conéctalo en «PÃxeles â Dominio propio» y elÃgelo en Tu tienda â Publicar y dirección, o quita el <script>."),children:"Tu JavaScript necesita tu dominio · ¿cómo?"})]}),yt&&e.jsxs("div",{role:"alert",style:{...zl,padding:"9px 12px",marginBottom:10,fontSize:12.5,fontWeight:600,color:"var(--danger, #dc2626)",display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{flex:1,minWidth:200},children:"El código cambió en otra pestaña o desde el asistente. Recárgalo para seguir: lo que escribiste aquà después de eso no se guardó."}),e.jsx("button",{type:"button",onClick:()=>void Qt(),className:"lk-accion",children:"Recargar el código"})]}),(ne||de||sn.length>0)&&e.jsxs("div",{role:ne?"alert":"status",style:{...zl,padding:"9px 12px",marginBottom:10,fontSize:12.5,fontWeight:600,color:ne||sn.length?"var(--danger, #dc2626)":/apagada/.test(de)?"var(--warning, #b45309)":"var(--success, #0b7a4b)",display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{flex:1,minWidth:200},children:ne||de||`LÃnea ${sn[0].linea}: ${sn[0].texto}`}),!ne&&!de&&sn.length>0&&e.jsx("button",{type:"button",onClick:()=>at(sn[0].linea),className:"lk-accion",children:"Ir a la lÃnea"}),/apagada/.test(de)&&e.jsx("button",{type:"button",onClick:()=>ka("publicar"),className:"lk-accion",children:"Prender mi tienda"})]}),g,e.jsxs("div",{className:"lk-codigo-2col",style:{display:"flex",gap:14,alignItems:"flex-start"},children:[e.jsxs("div",{ref:La,style:{flex:"0 0 328px",minWidth:0,maxWidth:"100%",position:"sticky",top:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:7,minHeight:28},children:[e.jsx(c2,{}),e.jsx(d2,{señalando:Be,onClick:()=>{Be||tt(null),We(!Be)}})]}),(Be||ze)&&e.jsx("div",{role:"status",style:{fontSize:11.5,fontWeight:600,lineHeight:1.45,marginBottom:7,padding:ze&&(ze.deLumy||ln)?"8px 10px":0,borderRadius:10,...ze&&(ze.deLumy||ln)?{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e3e7ef)",color:"var(--text-secondary, #475569)"}:{color:"var(--text-muted, #64748b)"}},children:ze?ze.deLumy?ze.zona==="vista-rapida"?e.jsxs(e.Fragment,{children:[e.jsxs("b",{style:{color:"var(--text, #111)"},children:["La vista rápida",Ra?` de «${Ra.nombre}»`:""]})," la pone Lumy con los datos del producto: fotos, precio, tallas, descripción y reseñas. ",Ra?"Para cambiarlos, edita el producto.":""," Su diseño lo ajustas con tu CSS (clases .pv-â¦).",Ra&&i&&e.jsx("div",{style:{marginTop:6},children:e.jsx("button",{type:"button",onClick:()=>Zo(Ra),className:"lk-accion",style:{padding:"6px 10px"},children:"Editar el producto"})})]}):ze.zona==="carrito"?e.jsxs(e.Fragment,{children:[e.jsx("b",{style:{color:"var(--text, #111)"},children:"Es el carrito de Lumy."}
379)," El envÃo, los descuentos, los cupones, el regalo y los datos del pedido se configuran en Tu tienda.",e.jsx("div",{style:{marginTop:6},children:e.jsx("button",{type:"button",onClick:()=>ka("carrito"),className:"lk-accion",style:{padding:"6px 10px"},children:"Abrir Carrito y ofertas"})})]}):ze.zona==="politicas"?e.jsxs(e.Fragment,{children:[e.jsx("b",{style:{color:"var(--text, #111)"},children:"Tus polÃticas"})," se escriben en Tu tienda; aquà Lumy pone sus enlaces.",e.jsx("div",{style:{marginTop:6},children:e.jsx("button",{type:"button",onClick:()=>ka("politicas"),className:"lk-accion",style:{padding:"6px 10px"},children:"Abrir Páginas y polÃticas"})})]}):ze.zona==="aviso"?e.jsxs(e.Fragment,{children:[e.jsx("b",{style:{color:"var(--text, #111)"},children:"Es un aviso por tiempo."})," Sus textos y cuándo sale están en Tu tienda.",e.jsx("div",{style:{marginTop:6},children:e.jsx("button",{type:"button",onClick:()=>ka("avisos"),className:"lk-accion",style:{padding:"6px 10px"},children:"Abrir Avisos por tiempo"})})]}):"Eso lo pone Lumy, no está en tu código.":ln&&Ra?e.jsxs(e.Fragment,{children:["LÃnea ",ze.linea,". ",e.jsx("b",{style:{color:"var(--text, #111)"},children:ln==="precio"?`Ese precio es el de «${Ra.nombre}» (${Ga(Ra.precio)})`:`${ln==="foto"?"Esa foto es la":ln==="descripción"?"Esa descripción es la":"Ese nombre es el"} de «${Ra.nombre}»`})," y sale de tu producto: en el código está el molde que se repite para todos.",i&&e.jsx("div",{style:{marginTop:6},children:e.jsxs("button",{type:"button",onClick:()=>Zo(Ra,ln==="foto"?"foto":"precio"),className:"lk-accion",style:{padding:"6px 10px"},children:[ln==="precio"?"Cambiar el precio":ln==="foto"?"Cambiar las fotos":"Editar el producto",Ra.tipo==="landing"?" (en su landing)":""]})})]}):`LÃnea ${ze.linea}${ze.etiqueta?` · <${ze.etiqueta}>`:""}${Ra?` · en la tarjeta de «${Ra.nombre}»`:""}`:"Toca cualquier parte de tu tienda: un producto, un botón, un texto."}),e.jsx("div",{style:{width:328,maxWidth:"100%",boxSizing:"border-box",background:"#0b1020",borderRadius:26,padding:9,boxShadow:"0 18px 40px -22px rgba(6,12,34,.7)"},children:e.jsx("div",{style:{position:"relative",width:310,maxWidth:"100%",height:"calc(100vh - 210px)",minHeight:430,overflow:"hidden",borderRadius:18,background:"#fff"},children:$.trim()?ge?e.jsx("iframe",{title:"Asà ve tu tienda el comprador",srcDoc:ge,sandbox:"allow-scripts allow-modals allow-popups",onLoad:X=>{var ae;try{(ae=X.currentTarget.contentWindow)==null||ae.postMessage({lumyCodigoScrollA:Ae.current},"*")}catch{}},style:{width:430,height:`${100/.72}%`,border:0,background:"#fff",display:"block",transform:"scale(0.72)",transformOrigin:"top left"}}):e.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#9aa0aa",fontSize:13},children:"Cargando vista previaâ¦"}):e.jsx(l2,{})})}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:12,marginTop:8,flexWrap:"wrap"},children:[!!ge&&!!$.trim()&&e.jsx("button",{type:"button",onClick:()=>fe(!0),style:vp,children:"Vista completa â"}),e.jsx("button",{type:"button",onClick:()=>{Nn()},disabled:lt,style:{...vp,opacity:lt?.5:1},title:"Abre tu tienda como la verá el comprador, sin publicarla. No cuenta visitas, no avisa a Meta ni a TikTok y el carrito no crea pedidos.",children:lt?"Abriendoâ¦":"Probar de verdad â"})]}),e.jsxs("p",{style:{fontSize:10.5,color:"var(--text-muted)",margin:"5px 4px 0",textAlign:"center",lineHeight:1.4},children:["«Probar de verdad» abre tu tienda sin publicarla: los productos, la vista rápida y el carrito funcionan como para el comprador, pero no cuenta visitas ni crea pedidos. Dura una hora.",/<script\b/i.test($)?" Tu JavaScript no corre ahÃ: solo en tu dominio.":""]})]}),e.jsxs("div",{style:{flex:"1 1 0",minWidth:0},children:[e.jsxs("div",{className:"lk-barra-codigo",children:[e.jsx("div",{className:"lk-vistas lk-tc-vistas",role:"tablist",children:[["codigo","Tu código",""],["guia","Lo que Lumy entiende","GuÃa"],["productos",`Productos (${_.length})`,""],["tienda","Tu tienda",""]].map(([X,ae,ot])=>e.jsx("button",{type:"button",role:"tab","aria-selected":B===X,"aria-label":ae,onClick:()=>ut(X),className:B===X?"lk-vista on":"lk-vista",children:ot?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"lk-tc-largo",children:ae}),e.jsx("span",{className:"lk-tc-corto",children:ot})]}):ae},X))}),e.jsxs("span",{className:"lk-separa",children:[(j==null?void 0:j.activo)&&e.jsx("button",{type:"button",onClick:()=>void Xo(),className:"lk-accion",title:"Tu tienda pública vuelve al diseño visual; tu código queda guardado",children:"Despublicar"}),e.jsx("button",{type:"button",onClick:()=>void Cn(),disabled:ce||!ba||sn.length>0,title:sn.length?sn[0].texto:ba?vt?"Tu tienda pública pasa a ser este código":"Tu tienda está apagada: después de publicar, préndela en Tu tienda â Publicar y dirección":"No hay cambios por publicar",style:{display:"inline-flex",alignItems:"center",gap:7,border:0,background:Iu,color:"#fff",font:"inherit",fontSize:12.5,fontWeight:800,padding:"9px 15px",borderRadius:11,cursor:ce||!ba||sn.length>0?"default":"pointer",opacity:ce||!ba||sn.length>0?.5:1,boxShadow:"0 6px 16px -8px rgba(8,102,255,.7)"},children:ce?"Publicandoâ¦":j!=null&&j.activo?"Publicar cambios":"Publicar mi tienda en código"})]}),e.jsxs("div",{className:"lk-acciones",children:[e.jsxs("button",{type:"button",onClick:()=>{var X;return(X=Na.current)==null?void 0:X.click()},className:"lk-accion",children:[e.jsx(wo.subir,{}),"Subir foto o video"]}),e.jsxs("button",{type:"button",onClick:()=>void Xa(),disabled:Ue,className:"lk-accion",children:[e.jsx(wo.fotos,{}),Ue?"Abriendoâ¦":"Mis fotos"]}),e.jsx("input",{ref:Na,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:X=>{const ae=Array.from(X.target.files||[]);X.currentTarget.value="",Oa(ae)}}),e.jsxs("button",{type:"button",onClick:_n,className:"lk-accion",title:"Una tienda completa que ya funciona con tus productos, para cambiarla a tu gusto",children:[e.jsx(wo.plantilla,{}
379),$.trim()?"Usar la plantilla":"Empezar con la plantilla"]}),e.jsxs("button",{type:"button",onClick:()=>{var X;return(X=wa.current)==null?void 0:X.click()},className:"lk-accion",title:"Reemplazar el editor con un archivo .html o .txt",children:[e.jsx(wo.importar,{}),"Importar HTML"]}),e.jsx("input",{ref:wa,type:"file",accept:".html,.htm,.txt,text/html,text/plain",hidden:!0,onChange:X=>{Kn(X.target.files),X.currentTarget.value=""}}),e.jsxs("button",{type:"button",onClick:qa,className:"lk-accion",title:"Guardar una copia del código en tu equipo",children:[e.jsx(wo.descargar,{}),"Descargar"]}),e.jsxs("button",{type:"button",onClick:()=>{mn()},className:"lk-accion",title:"Pega aquà el código que te devolvió tu IA",children:[e.jsx(wo.traer,{}),"Traer de IA"]}),e.jsxs("button",{type:"button",onClick:po,disabled:!Ge,className:Re==="ia"?"lk-ia ok":"lk-ia",title:"Copia el encargo con tus productos, tu carrito, tus ofertas y tu código, para pegarlo en Claude o ChatGPT",children:[Re==="ia"?e.jsx(wo.listo,{}):e.jsx(wo.chispa,{}),Re==="ia"?"¡Copiado! Pégalo en tu IA":"Copiar para la IA"]})]})]}),!!Fe&&e.jsx("div",{role:"status",style:{fontSize:12.5,fontWeight:700,color:/Subiendo/.test(Fe)?"var(--text-secondary, #64748b)":"var(--danger)",marginBottom:8},children:Fe}),B==="codigo"&&e.jsx(Hv,{ref:da,valor:$,onCambio:oe,dominioPropio:sa,revisar:Ia,alto:"calc(100vh - 320px)",placeholder:`Escribe o pega aquà el HTML de tu tienda. 380O toca «Empezar con la plantilla», o «Copiar para la IA» y pÃde
380sela a Claude o ChatGPT.`}),B==="guia"&&e.jsxs("div",{style:{...zl,maxHeight:"calc(100vh - 230px)",overflowY:"auto"},children:[e.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--border, #eef1f6)",background:"linear-gradient(120deg, rgba(8,102,255,.05), rgba(139,92,246,.05))"},children:[e.jsx("div",{style:{fontSize:14.5,fontWeight:900,color:"var(--text, #111)",marginBottom:3},children:"Lo que Lumy entiende de tu tienda"}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",lineHeight:1.5,marginBottom:10},children:"La vitrina la escribes tú; los productos, el carrito, el cobro y los pedidos los pone Lumy. Abajo, lo que Lumy leyó de tu código ahora mismo, lo que ya está configurado y todas las marcas que sabe leer."}),e.jsxs("div",{style:{border:"1px solid var(--border, #e3e7ef)",borderRadius:11,background:"var(--card-bg, #fff)",padding:"11px 13px",marginBottom:10},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,letterSpacing:".07em",textTransform:"uppercase",color:Iu,marginBottom:8},children:"De tu código, ahora mismo"}),$.trim()?e.jsx("div",{style:{display:"grid",gap:6},children:hn.map(X=>e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"baseline",fontSize:12.5,lineHeight:1.45},children:[e.jsx("span",{style:{minWidth:118,flex:"0 0 auto",color:"var(--text-muted)",fontWeight:700},children:X.que}),e.jsx("span",{style:{color:"var(--text, #111)",fontWeight:600,wordBreak:"break-word"},children:X.vale})]},X.que))}):e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"TodavÃa no hay código."})]}),Ge&&e.jsxs("div",{style:{border:"1px solid var(--border, #e3e7ef)",borderRadius:11,background:"var(--card-bg, #fff)",padding:"11px 13px",marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:11,fontWeight:800,letterSpacing:".07em",textTransform:"uppercase",color:Iu,flex:1},children:"Lo que ya pone Lumy, con tus ajustes"}),e.jsx("button",{type:"button",onClick:()=>ka("carrito"),style:vp,children:"Cambiar en Tu tienda"})]}),e.jsxs("ul",{style:{margin:0,paddingLeft:18,display:"grid",gap:4,fontSize:12.5,color:"var(--text-secondary, #475569)",lineHeight:1.45},children:[Uv(Ge).map(X=>e.jsx("li",{children:X},X)),e.jsx("li",{children:Ge.whatsapp?`WhatsApp +${Ge.whatsapp}${Ge.agente==="conectado"?", atendido por tu agente de ventas":""}: cada toque deja el contacto en tu CRM.`:"Sin WhatsApp: ponlo en Tu tienda â Marca para tener botón de WhatsApp."}),e.jsxs("li",{children:["Precios en ",Ge.moneda,", con el formato de tu paÃs: Lumy los escribe solos."]})]})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{value:Je,onChange:X=>Ct(X.target.value),placeholder:"Busca: carrito, precio, categorÃa, WhatsApp, fotoâ¦","aria-label":"Buscar en las marcas",style:{width:"100%",boxSizing:"border-box",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 30px 8px 11px",fontSize:13,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"}}),!!Je&&e.jsx("button",{type:"button",onClick:()=>Ct(""),"aria-label":"Limpiar",style:{position:"absolute",right:6,top:"50%",transform:"translateY(-50%)",background:"none",border:0,color:"var(--text-muted)",fontSize:15,cursor:"pointer",padding:"0 5px",fontFamily:"inherit"},children:"Ã"})]})]}),Co.length===0&&e.jsxs("div",{style:{padding:"18px 16px",fontSize:12.5,color:"var(--text-muted)"},children:["No hay ninguna marca con «",Je,"». Prueba con: productos, carrito, categorÃa, precio, foto, WhatsApp."]}),Co.map(X=>e.jsxs("div",{children:[e.jsx("div",{style:{position:"sticky",top:0,zIndex:1,background:"var(--card-bg, #fff)",borderBottom:"1px solid var(--border, #eef1f6)",padding:"9px 16px",fontSize:11,fontWeight:900,letterSpacing:".06em",color:"var(--text-muted)",textTransform:"uppercase"},children:X.grupo}),X.marcas.map(ae=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 280px) minmax(0, 1fr)",gap:14,alignItems:"start",padding:"10px 16px",borderBottom:"1px solid var(--border, #f3f5f9)"},children:[ae.soloParaLeer?e.jsx("code",{style:{display:"block",minWidth:0,fontFamily:"ui-monospace, Menlo, monospace",fontSize:11.5,lineHeight:1.45,background:"var(--input-bg, #f4f6fa)",border:"1px solid var(--border, #e3e7ef)",color:"var(--text-secondary, #475569)",borderRadius:9,padding:"7px 9px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:ae.codigo}):e.jsx("button",{type:"button",onClick:()=>dt(ae.codigo),title:"Meter en el código, donde está el cursor",style:{textAlign:"left",width:"100%",minWidth:0,fontFamily:"ui-monospace, Menlo, monospace",fontSize:11.5,lineHeight:1.45,background:"#0b1020",border:"1px solid rgba(8,102,255,.18)",color:"#cfe0ff",borderRadius:9,padding:"7px 9px",cursor:"pointer",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:ae.codigo}),e.jsx("span",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",lineHeight:1.55,minWidth:0,paddingTop:2},children:ae.que})]},ae.codigo))]},X.grupo)),e.jsx("div",{style:{padding:"12px 16px",fontSize:11.5,color:"var(--text-muted)",lineHeight:1.55},children:"Toca una marca para meterla donde tienes el cursor. ¿Prefieres que lo escriba una IA? «Copiar para la IA» se lleva todo esto con tus productos y tus ajustes."})]}),B==="productos"&&e.jsxs("div",{style:{...zl,maxHeight:"calc(100vh - 230px)",overflowY:"auto"},children:[e.jsxs("div",{style:{padding:"12px 14px",borderBottom:"1px solid var(--border, #eef1f6)",display:"grid",gap:9},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:900,color:"var(--text, #111)",flex:"1 1 200px"},children:"Tus productos en la tienda"}),e.jsx("button",{type:"button",onClick:()=>ka("productos"),className:"lk-accion",style:{padding:"6px 11px"},children:"Elegir cuáles salen"}),s&&e.jsx("button",{type:"button",onClick:s,className:"lk-accion",style:{padding:"6px 11px"},children:"+ Crear producto"})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.45},children:[_.length," en tu tienda",w.length?` · ${w.length} categorÃas`:"",". Tu código los repite con el molde: para unos en especial usa ",e.jsxs("code",{children:['data-lumy-productos="ids:',_.slice(0,3).map(X=>X.id).join(",")||"12,15",'"']})," (toca un id para copiarlo) o ",e.jsx("code",{children:'"categoria:Nombre"'}),"."]}),e.jsx("input",{type:"search",value:st,onChange:X=>la(X.target.value),placeholder:"Buscar por nombre, id o categorÃaâ¦","aria-label":"Buscar producto",style:{width:"100%",boxSizing:"border-box",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 11px",fontSize:13,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"}})]}),!_.length&&e.jsx("div",{style:{padding:"16px 14px",fontSize:12.5,color:"var(--text-muted)"},children:"TodavÃa no hay productos en tu tienda. Tócale «Elegir cuáles salen» o crea uno."}),fn?fn.length?fn.map(mo):e.jsxs("div",{style:{padding:"16px 14px",fontSize:12.5,color:"var(--text-muted)"},children:["Ningún producto coincide con «",st,"»."]}):go.map(X=>{const ae=ia.has(X.nombre)||go.length===1;return e.jsxs("div",{style:{borderTop:"1px solid var(--border, #eef1f6)"},children:[e.jsxs("button",{type:"button","aria-expanded":ae,onClick:()=>ha(ot=>{const it=new Set(ot);return it.has(X.nombre)?it.delete(X.nombre):it.add(X.nombre),it}),style:{display:"flex",alignItems:"center",gap:9,width:"100%",border:0,background:"var(--card-bg, #fff)",padding:"11px 14px",cursor:"pointer",font:"inherit",color:"var(--text, #111)",textAlign:"left"},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:ae?"rotate(90deg)":"none",transition:"transform .15s ease",color:"var(--text-muted)",flex:"none"},children:e.jsx("path",{d:"m9 6 6 6-6 6"})}),e.jsx("span",{style:{fontSize:13.5,fontWeight:800,flex:1,minWidth:0},children:X.nombre}),e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums"},children:X.productos.length})]}),ae&&X.productos.map(mo)]},X.nombre)})]}),B==="tienda"&&e.jsxs("div",{style:{maxHeight:"calc(100vh - 230px)",overflowY:"auto",paddingRight:4},children:[e.jsxs("div",{style:{...zl,padding:"11px 14px",marginBottom:10,fontSize:12.5,color:"var(--text-secondary, #475569)",lineHeight:1.5,overflow:"visible"},children:[e.jsx("b",{style:{color:"var(--text, #111)"},children:"Lo que sigue valiendo con tu código."})," Tus productos, el carrito y sus ofertas, tu WhatsApp, los avisos, las polÃticas y la dirección de tu tienda. Se guarda solo y tu vista previa lo muestra en segundos. La IA también lo sabe: va en «Copiar para la IA»."]}),n||e.jsx("div",{style:{...zl,padding:14,fontSize:12.5,color:"var(--text-muted)"},children:"Los ajustes de tu tienda están en el editor visual."})]})]})]}),ie&&e.jsx(m2,{srcDoc:ge,onCerrar:()=>fe(!1)}),we!==null&&e.jsx(g2,{valor:we,onCambio:Ye,onMeter:Va,onCerrar:()=>Ye(null)}),ye!==null&&e.jsx(u2,{items:ye,copiado:Re,onCopiar:X=>{er(X,X)},onMeter:X=>{dt(X),De(null)},onCerrar:()=>De(null)}),!!(I!=null&&I.length)&&e.jsx(p2,{medios:I,copiado:Re,onCopiar:X=>{er(X,X)},onMeter:X=>{dt(X),H(null)},onCerrar:()=>H(null)}),e.jsx("style",{children:`@media (max-width: 1080px){ .lk-codigo-2col{ flex-wrap: wrap } .lk-codigo-2col > div:first-child{ flex: 1 1 100% !important; position: static !important } } 381 .lk-tc-vistas{max-width:100%;overflow-x:auto;scrollbar-width:none} 382 .lk-tc-vistas::-webkit-scrollbar{display:none} 383 .lk-tc-corto{display:none} 384 @media (max-width: 560px){ .lk-tc-largo{display:none} .lk-tc-corto{display:inline} .lk-tc-vistas .lk-vista{padding:6px 9px} }`})]})}const nk={product:"Producto",whatsapp:"WhatsApp",advertorial:"Advertorial",service:"Servicio",catalog:"Catálogo"},ok=Object.values(rn),Vu=430,im=932,rk=54,h2=164,ik=` 385.gp-fondo{position:fixed;inset:0;z-index:10000;background:rgba(10,14,25,.62);display:flex;align-items:center;justify-content:center;padding:16px} 386.gp-panel{width:min(1120px,100%);height:min(90vh,940px);
386display:flex;flex-direction:column;background:var(--bg-card,#fff);border:1px solid var(--border);border-radius:22px;box-shadow:0 30px 80px -24px rgba(10,14,25,.45);overflow:hidden} 387.gp-cabeza{position:relative;display:flex;align-items:flex-start;gap:16px;padding:26px 28px 22px;border-bottom:1px solid var(--border);background:radial-gradient(120% 140% at 0% 0%,rgba(8,102,255,.07),transparent 55%),var(--bg-card,#fff)} 388.gp-ceja{display:inline-flex;align-items:center;gap:8px;font-size:11.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-blue)} 389.gp-ceja b{font-weight:800;color:var(--text-secondary);letter-spacing:.04em;text-transform:none;font-size:12px;padding:2px 9px;border-radius:999px;background:var(--bg-tertiary);font-variant-numeric:tabular-nums} 390.gp-titulo{margin:8px 0 0;font-size:clamp(22px,2.6vw,28px);line-height:1.15;font-weight:800;letter-spacing:-.02em;color:var(--text-primary);text-wrap:balance} 391.gp-pasos{display:flex;flex-wrap:wrap;gap:8px 18px;margin:14px 0 0;padding:0;list-style:none;counter-reset:paso} 392.gp-pasos li{counter-increment:paso;display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--text-secondary)} 393.gp-pasos li::before{content:counter(paso);width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:11.5px;font-weight:800;color:var(--accent-blue);background:rgba(8,102,255,.1)} 394.gp-cerrar{flex:none;margin-left:auto;width:38px;height:38px;border-radius:12px;border:1px solid var(--border);background:var(--bg-card,#fff);color:var(--text-secondary);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s ease,color .15s ease} 395.gp-cerrar:hover{background:var(--bg-tertiary);color:var(--text-primary)} 396.gp-cuerpo{flex:1;overflow-y:auto;padding:24px 28px 30px;background:var(--bg-tertiary)} 397.gp-rejilla{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(290px,100%),1fr));gap:22px} 398.gp-tarjeta{display:flex;flex-direction:column;background:var(--bg-card,#fff);border:1px solid var(--border);border-radius:18px;overflow:hidden;transition:box-shadow .2s ease} 399.gp-tarjeta:hover{box-shadow:0 22px 40px -26px rgba(10,14,25,.45)} 400.gp-escena{position:relative;display:flex;justify-content:center;padding:30px 16px 26px;background:radial-gradient(58% 52% at 50% 46%,rgba(8,102,255,.11),transparent 72%),linear-gradient(180deg,var(--bg-tertiary),var(--bg-card,#fff))} 401.gp-escena[data-ver]{cursor:pointer} 402.gp-escena .gp-telefono{transition:transform .35s cubic-bezier(.22,1,.36,1),box-shadow .35s ease} 403.gp-escena:hover .gp-telefono{transform:translateY(-5px);box-shadow:inset 0 0 0 1.5px #30343c,0 0 0 1px rgba(10,14,25,.06),0 34px 44px -22px rgba(10,14,25,.6)} 404.gp-telefono{position:relative;flex:none;background:#0d0f13;box-shadow:inset 0 0 0 1.5px #30343c,0 0 0 1px rgba(10,14,25,.06),0 24px 36px -20px rgba(10,14,25,.55)} 405.gp-telefono-grande{box-shadow:inset 0 0 0 2px #30343c,0 0 0 1px rgba(255,255,255,.08),0 44px 90px -30px rgba(0,0,0,.75)} 406.gp-pantalla{position:relative;overflow:hidden;background:#fff;-webkit-mask-image:-webkit-radial-gradient(white,black);transform:translateZ(0)} 407.gp-lienzo{position:absolute;top:0;left:0;width:${Vu}px;height:${im}px;display:flex;flex-direction:column;transform-origin:0 0} 408.gp-estado{position:relative;flex:none;height:${rk}px;display:flex;align-items:center;justify-content:space-between;padding:6px 30px 0 46px;background:#fff;color:#0d0f13;font:600 17px/1 -apple-system,BlinkMacSystemFont,"SF Pro Text",Inter,system-ui,sans-serif;letter-spacing:-.01em;font-variant-numeric:tabular-nums} 409.gp-isla{position:absolute;top:11px;left:50%;transform:translateX(-50%);width:124px;height:36px;border-radius:20px;background:#0d0f13} 410.gp-iconos{display:inline-flex;align-items:center;gap:6px} 411.gp-contenido{position:relative;flex:1;min-height:0;overflow:hidden;background:#eef0f4} 412.gp-contenido>img,.gp-contenido>video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center top} 413.gp-contenido iframe{position:absolute;inset:0;display:block;width:100%;height:100%;border:0;background:#fff} 414.gp-viva{opacity:0;pointer-events:none;transition:opacity .45s ease} 415.gp-viva.gp-lista{opacity:1} 416.gp-sin-foto{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;color:#9aa3b2;font-size:30px;font-weight:700;background:#f5f6f8} 417.gp-tipo{position:absolute;top:12px;left:12px;z-index:3;padding:4px 10px;border-radius:999px;background:var(--bg-card,#fff);border:1px solid var(--border);color:var(--text-primary);font-size:11px;font-weight:800;letter-spacing:.02em} 418.gp-info{display:flex;flex-direction:column;gap:14px;padding:16px 16px 16px;flex:1;border-top:1px solid var(--border)} 419.gp-nombre{margin:0;font-size:15px;line-height:1.3;font-weight:800;color:var(--text-primary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.6em} 420.gp-acciones{display:flex;gap:8px;margin-top:auto} 421.gp-importar{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border:0;border-radius:12px;padding:11px 12px;background:var(--accent-blue);color:#fff;font-size:13px;font-weight:800;cursor:pointer;transition:filter .15s ease,opacity .15s ease} 422.gp-importar:hover:not(:disabled){filter:brightness(1.08)} 423.gp-importar:disabled{cursor:wait} 424.gp-ver{flex:none;display:inline-flex;align-items:center;gap:6px;padding:0 14px;border-radius:12px;border:1px solid var(--border);color:var(--text-primary);font-size:13px;font-weight:700;background:var(--bg-card,#fff);cursor:pointer;transition:background .15s ease} 425.gp-ver:hover{background:var(--bg-tertiary)} 426.gp-vacio{max-width:420px;margin:48px auto;text-align:center;color:var(--text-secondary);font-size:14px;line-height:1.55} 427.gp-vacio b{display:block;margin:0 0 4px;color:var(--text-primary);font-size:15px} 428.gp-aviso{margin-bottom:16px;padding:11px 14px;border-radius:12px;font-size:13px;background:var(--notice-danger-bg);border:1px solid var(--notice-danger-border,var(--border));color:var(--notice-danger-text,var(--text-primary))} 429.gp-gris{background:linear-gradient(90deg,var(--bg-tertiary) 25%,var(--border) 50%,var(--bg-tertiary) 75%);background-size:200% 100%;animation:gp-brillo 1.3s ease-in-out infinite;border-radius:8px} 430@keyframes gp-brillo{0%{background-position:100% 0}100%{background-position:-100% 0}} 431.gp-capa{position:fixed;inset:0;z-index:10001;background:rgba(10,14,25,.78);display:flex;align-items:center;justify-content:center;padding:16px} 432.gp-vista{display:flex;align-items:center;gap:36px;max-width:100%} 433.gp-lado{width:280px;max-width:100%;color:#fff;display:flex;flex-direction:column;gap:14px} 434.gp-lado h3{margin:0;font-size:22px;line-height:1.2;font-weight:800;letter-spacing:-.01em;text-wrap:balance} 435.gp-lado p{margin:0;font-size:13.5px;line-height:1.55;color:rgba(255,255,255,.75)} 436.gp-lado a{color:rgba(255,255,255,.85);font-size:13px;font-weight:700} 437.gp-cerrar-vista{position:fixed;top:18px;right:18px;width:42px;height:42px;border-radius:14px;border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.1);color:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer} 438.gp-moneda{width:min(580px,100%);background:var(--bg-card,#fff);border:1px solid var(--border);border-radius:20px;box-shadow:0 30px 80px -24px rgba(10,14,25,.5);padding:24px} 439.gp-moneda h3{margin:0;font-size:20px;font-weight:800;letter-spacing:-.01em;color:var(--text-primary)} 440.gp-moneda p{margin:6px 0 16px;font-size:13.5px;line-height:1.5;color:var(--text-secondary)} 441.gp-opciones{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px;max-height:50vh;overflow-y:auto} 442.gp-opcion{display:flex;align-items:center;gap:9px;white-space:nowrap;padding:10px 11px;border-radius:12px;border:1.5px solid var(--border);background:var(--bg-card,#fff);cursor:pointer;text-align:left;font-size:13px;font-weight:700;color:var(--text-primary)} 443.gp-opcion small{margin-left:auto;font-size:11.5px;font-weight:800;color:var(--text-muted);font-variant-numeric:tabular-nums} 444.gp-opcion[aria-checked="true"]{border-color:var(--accent-blue);background:rgba(8,102,255,.06);color:var(--accent-blue)} 445.gp-opcion[aria-checked="true"] small{color:var(--accent-blue)} 446.gp-pie{display:flex;justify-content:flex-end;
446gap:10px;margin-top:18px} 447.gp-cancelar{border:1px solid var(--border);background:var(--bg-card,#fff);color:var(--text-primary);border-radius:12px;padding:11px 16px;font-size:13px;font-weight:700;cursor:pointer} 448.gp-importar:focus-visible,.gp-ver:focus-visible,.gp-cerrar:focus-visible,.gp-opcion:focus-visible,.gp-cancelar:focus-visible,.gp-cerrar-vista:focus-visible{outline:2px solid var(--accent-blue);outline-offset:2px} 449@media(max-width:760px){.gp-vista{flex-direction:column;gap:16px}.gp-lado{width:100%;align-items:stretch;text-align:center}} 450@media(max-width:560px){.gp-cabeza{padding:20px 16px 18px}.gp-cuerpo{padding:16px}.gp-pasos{gap:6px 14px}} 451@media(prefers-reduced-motion:reduce){.gp-tarjeta,.gp-escena .gp-telefono,.gp-viva{transition:none}.gp-escena:hover .gp-telefono{transform:none}.gp-gris{animation:none}} 452`,f2=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round","aria-hidden":"true",children:e.jsx("path",{d:"M6 6l12 12M18 6L6 18"})}),sk=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),lk=()=>e.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),e.jsx("circle",{cx:"9",cy:"10",r:"1.8"}),e.jsx("path",{d:"M21 16l-5-5-8 9"})]}),x2=()=>{var t;try{return!!((t=window.matchMedia)!=null&&t.call(window,"(prefers-reduced-motion: reduce)").matches)}catch{return!1}};function dk(){return e.jsxs("div",{className:"gp-estado","aria-hidden":"true",children:[e.jsx("span",{children:"9:41"}),e.jsx("span",{className:"gp-isla"}),e.jsxs("span",{className:"gp-iconos",children:[e.jsxs("svg",{width:"19",height:"12",viewBox:"0 0 19 12",fill:"currentColor",children:[e.jsx("rect",{y:"8",width:"3.2",height:"4",rx:"1"}),e.jsx("rect",{x:"5",y:"5.5",width:"3.2",height:"6.5",rx:"1"}),e.jsx("rect",{x:"10",y:"3",width:"3.2",height:"9",rx:"1"}),e.jsx("rect",{x:"15",width:"3.2",height:"12",rx:"1"})]}),e.jsx("svg",{width:"17",height:"12",viewBox:"0 0 17 12",fill:"currentColor",children:e.jsx("path",{d:"M8.5 2.4c2.4 0 4.6.9 6.2 2.5l1.3-1.3A10.4 10.4 0 0 0 8.5.6 10.4 10.4 0 0 0 1 3.6l1.3 1.3a8.6 8.6 0 0 1 6.2-2.5zm0 3.5c1.4 0 2.7.5 3.7 1.4l1.3-1.3a7.2 7.2 0 0 0-10 0l1.3 1.3c1-.9 2.3-1.4 3.7-1.4zm0 3.5c.6 0 1.1.2 1.4.6L8.5 11.4 7.1 10c.3-.4.8-.6 1.4-.6z"})}),e.jsxs("svg",{width:"27",height:"13",viewBox:"0 0 27 13",fill:"currentColor",children:[e.jsx("rect",{x:".5",y:".5",width:"22.5",height:"12",rx:"3.6",fill:"none",stroke:"currentColor",opacity:".4"}),e.jsx("rect",{x:"2",y:"2",width:"19.5",height:"9",rx:"2.2"}),e.jsx("path",{d:"M24.5 4.4v4.2c.9-.3 1.5-1.2 1.5-2.1s-.6-1.8-1.5-2.1z",opacity:".45"})]})]})]})}function sm({ancho:t,grande:a,children:n}){const o=t/Vu,i=Math.max(5,Math.round(t*.034)),s=Math.round(58*o);return e.jsx("div",{className:a?"gp-telefono gp-telefono-grande":"gp-telefono",style:{padding:i,borderRadius:s+i},children:e.jsx("div",{className:"gp-pantalla",style:{width:t,height:im*o,borderRadius:s},children:e.jsxs("div",{className:"gp-lienzo",style:{transform:`scale(${o})`},children:[e.jsx(dk,{}),e.jsx("div",{className:"gp-contenido",children:n})]})})})}function b2(t){try{const a=t.contentDocument;if(!a||a.getElementById("gp-sin-barras"))return;const n=a.createElement("style");n.id="gp-sin-barras",n.textContent="html{scrollbar-width:none}html::-webkit-scrollbar,body::-webkit-scrollbar{width:0;height:0;display:none}",(a.head||a.documentElement).appendChild(n)}catch{}}const ck=t=>{var a;try{return((a=t.contentWindow)==null?void 0:a.__lumyDemo)===1}catch{return!1}};function uk({p:t,conVideo:a=!0}){return a&&t.video&&!x2()?e.jsx("video",{src:t.video,poster:t.imagen||void 0,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):t.imagen?e.jsx("img",{src:t.imagen,alt:"",loading:"lazy",decoding:"async"}):e.jsxs("div",{className:"gp-sin-foto",children:[e.jsx(lk,{}),"Sin foto"]})}function pk(t,a){const[n,o]=h.useState(!1);return h.useEffect(()=>{const i=t.current;if(!i||typeof IntersectionObserver>"u")return;const s=new IntersectionObserver(([u])=>o(u.isIntersecting),{root:a.current,rootMargin:"160px 0px"});return s.observe(i),()=>s.disconnect()},[t,a]),n}function gk({p:t,raiz:a,importando:n,onVer:o,onImportar:i}){const s=h.useRef(null),u=h.useRef(null),m=pk(s,a),[c,g]=h.useState(!1),[f,b]=h.useState(!1);h.useEffect(()=>{m||g(!1)},[m]),h.useEffect(()=>{var _;let j=null;try{j=((_=u.current)==null?void 0:_.contentWindow)||null}catch{j=null}if(!j||!c||x2())return;const S=j;if(!f){try{S.scrollTo({top:0,behavior:"smooth"})}catch{}return}let $=0;const C=()=>{try{if(S.scrollY+S.innerHeight>=S.document.documentElement.scrollHeight-1)return;S.scrollBy(0,4),$=requestAnimationFrame(C)}catch{}};return $=requestAnimationFrame(C),()=>cancelAnimationFrame($)},[f,c]);const v=!!t.vista&&m;return e.jsxs("article",{className:"gp-tarjeta",children:[e.jsxs("div",{ref:s,className:"gp-escena","data-ver":t.vista?"":void 0,onClick:t.vista?o:void 0,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),children:[e.jsx("span",{className:"gp-tipo",children:nk[t.tipo]||"Landing"}),e.jsxs(sm,{ancho:h2,children:[e.jsx(uk,{p:t,conVideo:!t.vista}),v&&e.jsx("iframe",{ref:u,src:t.vista||"",title:`Landing de ${t.nombre}`,tabIndex:-1,"aria-hidden":"true",loading:"lazy",inert:"",className:c?"gp-viva gp-lista":"gp-viva",onLoad:j=>{const S=j.currentTarget;ck(S)&&(b2(S),g(!0))}})]})]}),e.jsxs("div",{className:"gp-info",children:[e.jsx("h3",{className:"gp-nombre",title:t.nombre,children:t.nombre}),e.jsxs("div",{className:"gp-acciones",children:[e.jsx("button",{type:"button",onClick:i,disabled:n!==null,className:"gp-importar",style:{opacity:n!==null&&n!==t.id?.55:1},children:n===t.id?"Importandoâ¦":"Importar a mis landings"}),t.vista&&e.jsxs("button",{type:"button",className:"gp-ver",onClick:o,children:[e.jsx(sk,{}),"Ver"]})]})]})]})}function mk(){return e.jsx("div",{className:"gp-rejilla",role:"status","aria-label":"Cargando plantillas",children:[0,1,2,3,4,5].map(t=>e.jsxs("div",{className:"gp-tarjeta","aria-hidden":"true",children:[e.jsx("div",{className:"gp-escena",children:e.jsx(sm,{ancho:h2,children:e.jsx("div",{className:"gp-gris",style:{position:"absolute",inset:0,borderRadius:0}})})}),e.jsxs("div",{className:"gp-info",children:[e.jsx("div",{className:"gp-gris",style:{height:14,width:"85%"}}),e.jsx("div",{className:"gp-gris",style:{height:40,width:"100%",borderRadius:12,marginTop:"auto"}})]})]},t))})}function hk(){const[t,a]=h.useState(()=>({ancho:window.innerWidth,alto:window.innerHeight}));return h.useEffect(()=>{const n=()=>a({ancho:window.innerWidth,alto:window.innerHeight});
452return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t}function fk({p:t,onCerrar:a,onImportar:n}){const o=hk(),i=o.ancho<760,s=Math.min(o.alto*.92,1e3)-(i?190:0)-32,u=i?o.ancho-32-32:1/0,m=Math.max(.3,Math.min(1,s/im,u/Vu));return e.jsxs("div",{className:"gp-capa",role:"dialog","aria-modal":"true","aria-label":`Vista previa: ${t.nombre}`,onClick:c=>{c.stopPropagation(),a()},children:[e.jsx("button",{type:"button",className:"gp-cerrar-vista","aria-label":"Cerrar vista previa",onClick:c=>{c.stopPropagation(),a()},children:e.jsx(f2,{})}),e.jsxs("div",{className:"gp-vista",onClick:c=>c.stopPropagation(),children:[e.jsx(sm,{ancho:Vu*m,grande:!0,children:e.jsx("iframe",{src:t.vista||"",title:`Vista previa de ${t.nombre}`,onLoad:c=>b2(c.currentTarget)})}),e.jsxs("div",{className:"gp-lado",children:[e.jsx("h3",{children:t.nombre}),e.jsx("p",{children:"Asà la ven tus clientes en el celular. Desliza dentro del teléfono para recorrerla."}),e.jsx("button",{type:"button",className:"gp-importar",onClick:n,children:"Importar a mis landings"}),t.enlace&&e.jsx("a",{href:t.enlace,target:"_blank",rel:"noopener noreferrer",children:"Abrir en otra pestaña"})]})]})]})}function xk({p:t,paisInicial:a,importando:n,onCancelar:o,onImportar:i}){const[s,u]=h.useState(a),m=h.useRef(null);return h.useEffect(()=>{var c;(c=m.current)==null||c.focus()},[]),e.jsx("div",{className:"gp-capa",onClick:c=>{c.stopPropagation(),n||o()},children:e.jsxs("div",{className:"gp-moneda",role:"dialog","aria-modal":"true","aria-labelledby":"gp-moneda-titulo",onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{id:"gp-moneda-titulo",children:"¿En qué moneda la quieres?"}),e.jsxs("p",{children:["«",t.nombre,"» te llega como borrador con los precios en esa moneda. Después pones tu producto y tu precio."]}),e.jsx("div",{className:"gp-opciones",role:"radiogroup","aria-label":"Moneda",children:ok.map(c=>e.jsxs("button",{ref:c.code===s?m:void 0,type:"button",role:"radio","aria-checked":c.code===s,className:"gp-opcion",onClick:()=>u(c.code),children:[e.jsx(Oj,{pais:c.code,alto:14}),c.name,e.jsx("small",{children:c.currency})]},c.code))}),e.jsxs("div",{className:"gp-pie",children:[e.jsx("button",{type:"button",className:"gp-cancelar",onClick:o,disabled:n,children:"Cancelar"}),e.jsx("button",{type:"button",className:"gp-importar",style:{flex:"none",padding:"11px 18px"},onClick:()=>i(s),disabled:n,children:n?"Importandoâ¦":`Importar en ${br(s).currency}`})]})]})})}function bk({onImportada:t,onCerrar:a}){const n=$a(),o=h.useRef(null),[i,s]=h.useState(null),[u,m]=h.useState("CO"),[c,g]=h.useState(""),[f,b]=h.useState(null),[v,j]=h.useState(null),[S,$]=h.useState(null);h.useEffect(()=>{let N=!0;return n("/api/landing/plantillas").then(w=>w.json()).then(w=>{if(N){if(!(w!=null&&w.ok)){g("No pudimos cargar las plantillas. Intenta de nuevo."),s([]);return}s(Array.isArray(w.plantillas)?w.plantillas:[]),w.mi_pais&&br(String(w.mi_pais)).code===String(w.mi_pais)&&m(String(w.mi_pais))}}).catch(()=>{N&&(g("No pudimos cargar las plantillas. Revisa tu conexión."),s([]))}),()=>{N=!1}},[n]),h.useEffect(()=>{const N=w=>{if(w.key==="Escape"){if(S){f===null&&$(null);return}if(v){j(null);return}a()}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[a,S,v,f]);const C=i||[],_=async(N,w)=>{b(N.id),g("");try{const M=await n(`/api/landing/plantillas/${N.id}/importar`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pais:w})}),p=await M.json().catch(()=>({}));if(!M.ok||!(p!=null&&p.ok)||!p.page){g((p==null?void 0:p.message)||"No se pudo importar. Intenta de nuevo."),$(null);return}t(p.page)}catch{g("No se pudo importar. Revisa tu conexión."),$(null)}finally{b(null)}};return Wo.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"plantillas-titulo",onClick:a,className:"gp-fondo",children:[e.jsx("style",{children:ik}),e.jsxs("div",{onClick:N=>N.stopPropagation(),className:"gp-panel",children:[e.jsxs("div",{className:"gp-cabeza",children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{className:"gp-ceja",children:["Plantillas",i&&i.length>0&&e.jsxs("b",{children:[i.length," listas"]})]}),e.jsx("h2",{id:"plantillas-titulo",className:"gp-titulo",children:"Elige una landing y hazla tuya"}),e.jsxs("ol",{className:"gp-pasos",children:[e.jsx("li",{children:"La importas en tu moneda"}),e.jsx("li",{children:"Pones tu producto, tu pÃxel y tu WhatsApp"}),e.jsx("li",{children:"La publicas"})]})]}),e.jsx("button",{type:"button",onClick:a,"aria-label":"Cerrar",className:"gp-cerrar",children:e.jsx(f2,{})})]}),e.jsxs("div",{ref:o,className:"gp-cuerpo",children:[c&&e.jsx("div",{role:"alert",className:"gp-aviso",children:c}),i===null?e.jsx(mk,{}):C.length===0?e.jsxs("div",{className:"gp-vacio",children:[e.jsx("b",{children:"TodavÃa no hay plantillas."}),"Pronto habrá más."]}):e.jsx("div",{className:"gp-rejilla",children:C.map(N=>e.jsx(gk,{p:N,raiz:o,importando:f,onVer:()=>j(N),onImportar:()=>$(N)},N.id))})]})]}),v&&!S&&e.jsx(fk,{p:v,onCerrar:()=>j(null),onImportar:()=>$(v)}),S&&e.jsx(xk,{p:S,paisInicial:u,importando:f===S.id,onCancelar:()=>$(null),onImportar:N=>_(S,N)})]}),document.body)}const yk={border:0,background:"#fff",color:"#0B7A5B",cursor:"pointer",borderRadius:10,padding:"8px 15px",fontSize:13,fontWeight:800,boxShadow:"0 2px 8px -2px rgba(0,0,0,.25)",whiteSpace:"nowrap"},qb={border:"1px solid rgba(255,255,255,.55)",background:"transparent",color:"#fff",cursor:"pointer",borderRadius:10,padding:"8px 15px",fontSize:13,fontWeight:700,whiteSpace:"nowrap"};function xg({clave:t,titulo:a,resumen:n,children:o}){const{open:i,toggle:s}=Hj(t,!1);return e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:s,"aria-expanded":i,style:{display:"flex",alignItems:"center",gap:7,width:"100%",minWidth:0,padding:"5px 0",background:"none",border:0,cursor:"pointer",fontFamily:"inherit",color:"var(--text-muted)",textAlign:"left"},children:[e.jsx(Gj,{open:i}),e.jsx("span",{style:{flex:"none",fontSize:10.5,fontWeight:800,textTransform:"uppercase",letterSpacing:".4px"},children:a}),n&&e.jsx("span",{style:{minWidth:0,fontSize:11.5,fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]}),i&&e.jsx("div",{style:{marginTop:8},children:o})]})}const vk=["tiktok_pixel_id","meta_pixel_id","meta_capi_token","tiktok_events_token","tiktok_pixels_extra","meta_pixels_extra","web_analytics"],y2=["tiktok_pixel_id","meta_pixel_id","meta_capi_token","tiktok_events_token"],v2=["ga4","ads","ads_label","gtm","clarity","hotjar"],Mb={tiktok_pixel_id:"el pixel de TikTok",meta_pixel_id:"el pixel de Meta",meta_capi_token:"el token de CAPI",tiktok_events_token:"el token de eventos de TikTok",ga4:"Google Analytics",ads:"Google Ads",ads_label:"la etiqueta de conversión",gtm:"Tag Manager",clarity:"Clarity",hotjar:"Hotjar"};function jk(t,a){const n={},o=new Set(vk);for(const i of a)o.has(i)&&t[i]!==void 0&&(n[i]=t[i]);return n}const Di=t=>String(t??"").trim();function Ak(t,a){const n=new Set,o=[];let i=!1;for(const u of y2)t[u]!==void 0&&Di(t[u])&&!Di(a[u])&&(n.add(u),o.push(Mb[u]));if(t.web_analytics!==void 0){const u=t.web_analytics||{},m=a.web_analytics||{};for(const c of v2)!Di(u[c])||Di(m[c])||(n.add("web_analytics"),c==="ads_label"&&!Di(m.ads)?i=!0:o.push(Mb[c]))}const s=[];return o.length&&s.push(`no reconocà ${o.join(" ni ")}. Revisa que sea solo el identificador, sin nada más pegado.`),i&&s.push("la etiqueta de conversión se guarda cuando pongas también el ID de Google Ads (AW-â¦)."),{claves:[...n],mensaje:s.join(" ")}}function Sk(t,a,n){const o={...t};for(const i of y2)a[i]!==void 0&&(Di(a[i])&&!Di(n[i])||(o[i]=String(n[i]??"")));if(a.web_analytics!==void 0){const i=a.web_analytics||{},s=n.web_analytics||{},u={...t.web_analytics||{}};for(const m of v2)Di(i[m])&&!Di(s[m])||(u[m]=String(s[m]??""));o.web_analytics=u}return o}const cc=t=>(Array.isArray(t)?t:[]).map(a=>Number(a)).filter(a=>Number.isInteger(a)&&a>0),j2=t=>(t==null?void 0:t.productos_modo)==="elegidos";function wk(t){if(j2(t)){const n=new Set(cc(t==null?void 0:t.elegidos));return o=>n.has(Number(o))}const a=new Set(cc(t==null?void 0:t.hidden));return n=>!a.has(Number(n))}function bg(t,a,n){const o=cc(a);if(j2(t)){const s=new Set(cc(t==null?void 0:t.elegidos));for(const u of o)n?s.add(u):s.delete(u);return{elegidos:[...s]}}const i=new Set(cc(t==null?void 0:t.hidden));for(const s of o)n?i.delete(s):i.add(s);return{hidden:[...i]}}function kk(t,a,n){const o=bg(t,a,n),i=t==null?void 0:t.codigo_productos;return!i||typeof i!="object"||Array.isArray(i)?o:{...o,codigo_productos:{...i,...bg(i,a,n)}}}const Uu="lumy_landing_home",yg="lumy:landing-home",lm=t=>{const a=Number(t);return Number.isInteger(a)&&a>0?a:0};function Fb(){try{return lm(localStorage.getItem(Uu))}catch{return 0}}function Ck(t){const a=lm(t);try{a?localStorage.setItem(Uu,String(a)):localStorage.removeItem(Uu)}catch{}try{window.dispatchEvent(new CustomEvent(yg,{detail:a}))}catch{}}function _k(){const[t,a]=h.useState(Fb);return h.useEffect(()=>{const n=i=>a(lm(i.detail)),o=i=>{(i.key===Uu||i.key===null)&&a(Fb())};return window.addEventListener(yg,n),window.addEventListener("storage",o),()=>{window.removeEventListener(yg,n),window.removeEventListener("storage",o)}},[]),[t,Ck]}const Ob=[{grupo:"El pedido: el diseño es tuyo, los datos van al CRM",marcas:[{codigo:'<input data-lumy-dato="telefono" class="tu-clase" placeholder="Tu celular">',que:`TUS CAMPOS, CON TU DISEÃO. Escribe tus <input>, <select> y <textarea> como quieras (clases, estilos, etiquetas, orden). Con data-lumy-dato Lumy sabe qué dato es y lo lleva al CRM y a la logÃstica, con su validación. Los datos: ${mc()}. Otro nombre no llega al pedido y no te deja publicar: para preguntar otra cosa, data-lumy-pregunta. En ventas son obligatorios nombre, telefono, direccion, departamento y ciudad; en servicios, nombre y telefono.`},{codigo:'<input data-lumy-dato="colonia" required> · "distrito" · "corregimiento" · "codigo_postal" · "parroquia" · "zona" · "barrio"',que:cS()},{codigo:'<select data-lumy-dato="departamento"><option value="">Elige tu departamento</option></select>',que:'Lumy llena los departamentos y, al elegir uno, sus ciudades (la misma lista que usa la transportadora). Tu primera opción vacÃa se respeta. Para la ciudad: <select data-lumy-dato="ciudad"></select>.'},{codigo:"<button data-lumy-pedir>Lo quiero</button>",que:'Tu botón envÃa el pedido. Puedes sumarle una animación: data-lumy="pulso". Si falta un dato, aparece un aviso debajo: dale tu estilo con #subErr { ⦠}.'},{codigo:'<select data-lumy-variante="Talla"><option value="">Elige tu talla</option></select>',que:'Tus tallas y colores: Lumy pone las opciones que tienes configuradas. O dibuja tus botones: <input type="radio" data-lumy-variante="Color" value="Rojo"> con su <label>.'},{codigo:'<input data-lumy-pregunta="Cédula" required>',que:"PREGÃNTALE LO QUE QUIERAS, ADEMÃS DE LOS DATOS DE ARRIBA: la cédula, el texto que va grabado, la talla del anillo. Lo que escribes es la pregunta Y el nombre del dato: en el CRM el pedido dice «Cédula: 1020304050». Sirve en <input>, <select> (con tus propias opciones) y <textarea>, y lleva required si es obligatoria. Hasta ocho. No le pongas el nombre de un dato que Lumy
452ya pide ni el de una de tus variantes."},{codigo:'<div data-lumy-campos="nombre, telefono, direccion, ciudad, +Cédula"></div>',que:"Con las piezas de Lumy, tus preguntas van en esa misma lista con un + delante. Es la forma de pedirlas cuando usas <div data-lumy-form></div>: ahà tu propio campo quedarÃa fuera del formulario y el dato no llegarÃa."},{codigo:"<select data-lumy-cantidad></select>",que:'TU PROPIA CANTIDAD: Lumy pone tus ofertas («2 unidades · $329.900») y deja elegida la de siempre. O dibuja tus botones: <input type="radio" data-lumy-cantidad value="2"> con su <label>. La cantidad se elige entre tus ofertas declaradas (data-ofertas), no se teclea; la talla o el color que elija vale para todas las unidades.'},{codigo:'<label><input type="checkbox" data-lumy-adicional> EnvÃo express <span data-lumy-pedido="adicional"></span></label>',que:"TU PROPIA CASILLA DEL PRODUCTO ADICIONAL: al marcarla, su valor se suma al total y al cobro de la misma guÃa. El adicional se declara en la marca del producto (data-adicional). No le pongas id: Lumy le pone el suyo."},{codigo:'<span data-lumy-pedido="total"></span>',que:'El total, vivo: cambia con las ofertas, el adicional y el envÃo. También "subtotal", "cantidad", "adicional" (su valor) y "envio" (si es gratis pone tu texto: data-gratis="EnvÃo gratis"). Si cobras envÃo, muéstralo: el comprador tiene que ver el total antes de pedir.'},{codigo:'<a href="#orderForm">Pedir ahora</a>',que:"Cualquier enlace tuyo que lleve a los campos del pedido."},{codigo:"<button data-lumy-abrir>Pedir ahora</button>",que:"SI TU BOTÃN ABRE TU PROPIA VENTANA con el formulario dentro: ponle esta marca. Sin ella, Lumy no se entera de que alguien quiso comprar, y ese clic no cuenta ni en tus métricas ni en Meta. Con ella sÃ. Solo cuenta la primera vez."},{codigo:"<div data-lumy-form></div>",que:"O EL FORMULARIO DE LUMY ENTERO, con su diseño, donde pongas esto (vacÃo). Si no pones ni esto ni tus campos, la página no tiene dónde pedir y no te deja publicar."},{codigo:'<div data-lumy-campo="datos"></div> · "variantes" · "resumen" · "boton" · "oferta" · "bump" · "pago"',que:'O las piezas de Lumy por separado, donde quieras cada una. Para pedir hacen falta "datos" y "boton".'},{codigo:'<div data-lumy-campo="pago"></div>',que:"LOS BOTONES DE PAGO EN LÃNEA (Bold, Mercado Pago, PayPal), donde pongas esto. Se activan en la pestaña «El pedido» â Botones de pago; en el formulario de Lumy entero ya vienen. Si apagas la contraentrega, o tienes ciudades con envÃo «Anticipado», esta pieza es obligatoria: sin ella el comprador no tendrÃa con qué pagar y no te deja publicar. Tu propio botón de pedir (data-lumy-pedir) también sirve: manda a pagar con la primera pasarela."},{codigo:'<div data-lumy-campos="nombre, telefono, direccion, departamento, ciudad, correo?"></div>',que:"Con las piezas de Lumy, qué datos se piden. El que lleve ? es opcional. En ventas, nombre, teléfono, dirección, departamento y ciudad van siempre; en servicios, nombre y teléfono."},{codigo:"https://wa.me/57300â¦",que:"Un enlace normal a WhatsApp funciona y cuenta: al tocarlo, Lumy manda Contact a Meta y a TikTok y deja el lead en tu CRM con el rastro del anuncio, igual que el botón de WhatsApp de una landing de siempre. Si ese número está conectado a Lumy, el chat le llega al agente sabiendo de qué página viene. Es un chat, no un pedido: los pedidos entran por tus campos."},{codigo:'<button data-lumy-whatsapp data-texto="Quiero la talla M">Pedir por WhatsApp</button>',que:"TU BOTÃN DE WHATSAPP SIN PROGRAMAR: Lumy lo abre con el número de tu página y su mensaje, más tu data-texto en otra lÃnea, y lo cuenta como contacto con el rastro del anuncio. Funciona también en la dirección de Lumy, sin tu dominio. Si ese número está conectado a Lumy, el chat le llega al agente sabiendo de qué página viene."}
452,{codigo:"lumyWhatsApp('Quiero la talla M')",que:'Lo mismo desde tu JavaScript (con tu dominio propio): llámala dentro del clic del comprador. No abras WhatsApp cambiando la dirección de la página (location.href = "https://wa.me/â¦"): asà el chat no llega con los datos de tu página ni cuenta como contacto.'}]},{grupo:"Los datos de tu producto, sin escribirlos a mano",marcas:[{codigo:'<h1 data-lumy-text="producto.nombre"></h1>',que:"Lumy pone ahà el nombre del producto. Si lo cambias en Lumy, tu página se actualiza sola."},{codigo:'<b data-lumy-text="producto.precio"></b>',que:"El precio, ya con su formato. Escribirlo a mano es lo que hace que tu página diga una cifra y el formulario cobre otra."},{codigo:'<s data-lumy-text="producto.precio_antes"></s>',que:"El precio tachado (solo si tienes uno más alto puesto)."},{codigo:'<p data-lumy-text="producto.descripcion"></p>',que:"La descripción del producto."},{codigo:'<img data-lumy-src="producto.imagen" alt="">',que:"La foto principal. Para las demás: producto.imagenes[1], producto.imagenes[2]â¦"},{codigo:"{{ producto.nombre }}",que:"También funcionan las llaves dobles dentro de un texto, por si tu IA las escribe asÃ."},{codigo:'<div data-lumy-producto data-nombre="Reloj Curren" data-precio="129900" data-tachado="189900"></div>',que:"O DECLARA EL PRODUCTO EN TU CÃDIGO: al guardar, Lumy toma ese nombre y ese precio como los de la página. El precio puede ir como 129900, 129.900 o $129,900; en dólares, 29.90 son 29 con 90."},{codigo:'<div data-lumy-producto data-precio="129900" data-variantes="Color: Negro, Azul | Talla: S, M, L" data-ofertas="2: 219.900, 3: 299.900"></div>',que:'TUS TALLAS, COLORES Y OFERTAS POR CANTIDAD se declaran en la misma marca. Variantes: cada grupo con sus opciones, separados por | . Ofertas: «cantidad: precio total» (la de 1 unidad es tu precio). Sin declararlas, una página que usa data-lumy-variante no se deja publicar. Para quitarlas escribe la palabra: data-ofertas="ninguna".'},{codigo:'<div data-lumy-producto data-precio="129900" data-envio="12.000" data-adicional="EnvÃo express: 9.900"></div>',que:'EL ENVÃO Y EL PRODUCTO ADICIONAL, también en esa marca. data-envio="12.000" cobra ese valor fijo y data-envio="gratis" no cobra. data-adicional="nombre: precio" crea el adicional; le puedes sumar data-adicional-texto="Te llega primero" y data-adicional-marcado="si". Para quitarlo: data-adicional="ninguno".'},{codigo:"envio.texto · tienda.nombre · landing.nombre",que:"Las otras tres que puedes usar igual."}]},{grupo:"Después de la compra: la pantalla de gracias y a dónde va el comprador",marcas:[{codigo:'<section data-lumy-gracias data-titulo="¡Listo, {nombre}!" data-texto="Te escribimos hoy por WhatsApp." data-boton="Seguir viendo"></section>',que:'Los textos de la pantalla que sale al confirmar el pedido: el tÃtulo ({nombre}
452 se cambia por el nombre del comprador), el texto y el botón. Para volver al de Lumy escribe la palabra: data-titulo="ninguno".'},{codigo:'data-ir-a="https://mitienda.com/gracias" data-ir-en="8"',que:"A DÃNDE VA DESPUÃS. data-ir-a es a dónde lleva el botón de esa pantalla: tu sitio, tu catálogo, o tu WhatsApp (https://wa.me/57300â¦?text=Hola). Con data-ir-en se va solo a los segundos que digas (de 3 a 60); sin eso, solo al tocar el botón."},{codigo:'<section data-lumy-gracias> <h2>Gracias, <span data-lumy-pedido="nombre"></span></h2> <p>Tu pedido <span data-lumy-pedido="numero"></span> va por <span data-lumy-pedido="total"></span>.</p> </section>',que:'O TU PROPIA PANTALLA: lo que escribas dentro no se ve en la página; al confirmar el pedido pasa a la pantalla de gracias en lugar del tÃtulo y el texto de Lumy, con tu diseño. Adentro sirven "nombre", "numero", "total", "cantidad" y "envio".'},{codigo:"#okSummary · #okRef · #okSteps · #okTrack · .ok-actions · #okDone",que:"Lo demás de esa pantalla (el resumen, el número de pedido, los pasos, el enlace de rastreo, WhatsApp y compartir, el botón) se queda. Lo que no quieras, ocúltalo desde tu CSS: #okSteps { display: none; }."}]},{grupo:"Aparecer al bajar y movimiento (31 recetas, sin escribir JavaScript)",marcas:[{codigo:'data-lumy="aparecer" data-desde="abajo" data-retraso="0"',que:"Aparece al entrar en pantalla. `data-desde`: abajo, izquierda, derecha o zoom."},{codigo:'data-lumy="aparecer-hijos" data-paso="120"',que:"Los hijos directos van apareciendo uno tras otro."},{codigo:'data-lumy="contador" data-hasta="12500" data-duracion="1800" data-prefijo="$" data-sufijo=""',que:"El número sube solo hasta la cifra."},{codigo:'data-lumy="escribir" data-velocidad="45"',que:"El texto se escribe letra por letra."},{codigo:'data-lumy="cuenta-regresiva" data-hasta="2026-12-24T20:00" data-fin="¡Se acabó!"',que:"Cuenta atrás hasta esa fecha."},{codigo:'data-lumy="parallax" data-fuerza="0.15"',que:"Se mueve más lento que el resto al bajar."},{codigo:'data-lumy="zoom-scroll" data-fuerza="0.08"',que:"Se acerca despacio mientras bajas."},{codigo:'data-lumy="revelar-imagen"',que:"La foto se descubre al verse."},{codigo:'data-lumy="particulas" data-cantidad="35" data-color="#8fa8ff" data-velocidad="0.8"',que:"PartÃculas de fondo. En un <div> vacÃo con altura propia."},{codigo:'data-lumy="marquesina" data-velocidad="18" data-direccion="izquierda"',que:"Cinta que corre sin parar."},{codigo:'data-lumy="flotar" data-fuerza="8" data-duracion="3"',que:"Flota suavemente."},{codigo:'data-lumy="brillar"',que:"Un brillo que recorre el elemento."},{codigo:'data-lumy="pulso"',que:"Late despacio, para llamar la atención."},{codigo:'data-lumy="sacudir" data-cada="6"',que:"Se sacude cada tantos segundos."},{codigo:'data-lumy="tilt"',que:"Se inclina siguiendo el mouse (solo en computador)."},{codigo:'data-lumy="gradiente-vivo" data-colores="#1e2a5a,#4f7cff" data-duracion="9"',que:"Fondo degradado en movimiento. De 2 a 5 colores."},{codigo:'data-lumy="pestanas"',que:'Pestañas. Cada hijo directo lleva data-titulo="â¦". MÃnimo dos.'},{codigo:'data-lumy="acordeon"',que:"Preguntas que se abren. Adentro, mÃnimo dos <details>."},{codigo:'data-lumy="carrusel" data-intervalo="0"',que:"Carrusel con puntos. MÃnimo dos hijos; el intervalo en milisegundos (0 = manual)."},{codigo:'data-lumy="comparador"',que:"Antes y después. Adentro, exactamente dos <img>."},{codigo:'data-lumy="ampliar"',que:"La foto se abre grande al tocarla."},{codigo:'data-lumy="video-al-verse"',que:"El video arranca solo, sin sonido, al verse."},{codigo:'data-lumy="rotar-palabras" data-palabras="rápido,fácil,seguro" data-espera="1600"',que:"Va cambiando la palabra. De 2 a 8."},{codigo:'data-lumy="resaltar" data-color="#ffd166"',que:"Se subraya como con marcador."},{codigo:'data-lumy="progreso-scroll" data-color="#4f7cff"',que:"Barra de avance arriba de la página."},{codigo:'data-lumy="pegajoso" data-arriba="0"',que:"Se queda fijo al bajar."},{codigo:'data-lumy="parallax-raton"',que:'Los hijos se mueven con el mouse. Cada uno con data-profundidad="3".'},{codigo:'data-lumy="confeti"',que:"Confeti, una sola vez, al verse."},{codigo:'data-lumy="copiar" data-texto="CUPON10"',que:"Al tocarlo copia ese texto."},{codigo:'data-lumy="ver-mas" data-alto="140"',que:"Recorta el texto largo y pone «ver más»."},{codigo:'data-lumy="zoom-hover"',que:"La foto de adentro se acerca al pasar el mouse."}]},{grupo:"Diseño sin lÃmites: todo esto funciona",marcas:[{codigo:'@property --giro { syntax: "<angle>"; inherits: false; initial-value: 0deg; }',que:"Bordes aurora que giran, degradados animados: conic-gradient(from var(--giro), â¦) con @keyframes."},{codigo:"background: linear-gradient(90deg, #111 50%, #22c55e 50%);",que:"Bloques mitad y mitad, una parte de un color y otra de otro, degradados, transparencias: todo el CSS."},{codigo:".lista > li + li · @media (width > 600px) and (hover: hover)",que:"Cualquier selector y cualquier @media. También @container, @layer, @starting-style y @supports."},{codigo:'@font-face { font-family: "Mia"; src: url(data:font/woff2;base64,â¦); }',que:"Tu propia fuente, embebida. O hasta 10 de Google Fonts con @import."},{codigo:'<button popovertarget="info">Ver</button> <div popover id="info">â¦</div>',que:"Ventanas emergentes sin JavaScript. También <dialog> y <details open>."},{codigo:'<svg><filter id="brillo"><feGaussianBlur stdDeviation="6"/></filter></svg>',que:"Filtros SVG (brillos, desenfoques, «gooey»), máscaras y texto SVG; en el CSS: filter: url(#brillo)."},{codigo:'<iframe src="https://www.youtube.com/embed/ID" allowfullscreen></iframe>',que:"Videos de YouTube, Vimeo y TikTok, del tamaño y con el marco que quieras."}]},{grupo:"LÃmites técnicos que el editor te avisa antes de publicar",marcas:[{codigo:"<form>",que:"El <form> lo pone Lumy alrededor de tu página: tus campos van sueltos, c
452on data-lumy-dato."},{codigo:'name="â¦" type="hidden" · "file" · "password"',que:"En tus campos, el name lo pone Lumy (es lo que lee el CRM) y esos tipos se eliminan. Para archivos usa el módulo de medios de Lumy."},{codigo:'<iframe src="https://otro-sitioâ¦"> <object> <embed>',que:"Se admiten YouTube, Vimeo, TikTok, Bunny/MediaDelivery y Google Maps. Los demás iframes y los objetos se quitan."},{codigo:"@import url(https://otro-sitio.com/estilos.css)",que:"Solo @import de Google Fonts: traer archivos de cualquier sitio no se permite."},{codigo:'<script>â¦<\/script> · onclick="â¦"',que:"Funcionan únicamente al publicar en tu dominio propio. En la dirección compartida de Lumy se quitan por seguridad."},{codigo:"disabled en un campo, variante o botón conectado",que:"Lumy lo quita para que el pedido no quede imposible de enviar. Para un dato fijo usa readonly; si no quieres pedir el dato, quita su marca data-lumy."}]},{grupo:"Tu página va sola: Lumy no le agrega nada por debajo",marcas:[{codigo:"Ni pie de página, ni barra de abajo, ni botón de WhatsApp, ni formulario visible",que:"En modo código Lumy no agrega bloques visuales que no hayas pedido. Solo conecta por dentro tus campos y crea la pantalla de confirmación cuando incluyes un pedido."},{codigo:'<div data-lumy-campo="politicas"></div>',que:"Meta y TikTok piden a la vista la polÃtica de privacidad y la de envÃos y devoluciones, o te rechazan los anuncios. Pon esto donde quieras (normalmente en tu pie) y Lumy pone ahà esos enlaces, con los textos de tu paÃs, en una ventanita. Si tienes tus propias páginas de polÃticas, enlázalas tú."},{codigo:'<a href="https://wa.me/57300â¦">EscrÃbenos</a>',que:"Si quieres el botón de WhatsApp, ponlo tú donde quieras: un enlace a tu número o <button data-lumy-whatsapp>."}]},{grupo:"Detalles que cuestan una tarde si no los sabes",marcas:[{codigo:"@import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;800&display=swap);",que:'Asà se traen las fuentes de Google (hasta 10). Los espacios del nombre van como +, por ejemplo Playfair+Display. También sirve <link rel="stylesheet"> de Google Fonts.'},{codigo:`id="${dc}oferta" · id="${dc}hero"`,que:Fv+" Tu botón data-lumy-pedir recibe «submitBtn» solo: no se lo pongas tú. Si usas uno de Lumy, el revisor te lo marca."},{codigo:"<script>",que:"Tu JavaScript corre con TU dominio conectado. Puedes escribirlo y guardarlo antes; para publicar, conecta el dominio (menú: PÃxeles y dominios)."},{codigo:'<title>Mi producto</title> · <meta name="description" content="â¦"> · <link rel="icon" href="https://â¦">',que:"También controlas el tÃtulo, la descripción, el Ãcono y la imagen social (og:image). Lumy los pasa al <head> real de la página publicada."},{codigo:'<img src="https://â¦">',que:"Las imágenes van por https. Las que subas a Lumy se sirven solas en el tamaño que toca."},{codigo:"input, select, textarea, button { font: inherit; }",que:"Los estilos de Lumy no tocan tu página: tus campos y botones salen como los deja el navegador. Con esta lÃnea usan tu letra."},{codigo:".lumy-pieza input { ⦠} · #okScreen { ⦠} · #subErr { ⦠}",que:"Si usas piezas de Lumy, también las puedes estilizar desde tu CSS: tus reglas les ganan a las de Lumy."}]}];function $k(t,a){var b,v,j;const n=String(t.moneda||"COP").toUpperCase(),o=!Object.values(Lg).some(S=>S.currency===n&&S.noDecimals),i=S=>S>0?`${S.toLocaleString(o?"es-EC":"es-CO",o?{minimumFractionDigits:2,maximumFractionDigits:2}:{})} ${t.moneda||"COP"}`:"sin precio puesto todavÃa",s=t.variantes.length?t.variantes.map(S=>` · ${S.nombre}: ${S.opciones.join(", ")}`).join(` 453`):" · (esta página no tiene variantes configuradas)",u=t.campos.length?t.campos.map(S=>` · ${S.etiqueta||S.clave}${S.obligatorio?" (obligatorio)":""}`).join(` 454`):t.esServicio?" · nombre y teléfono":" · nombre, teléfono, dirección, departamento y ciudad",m=t.esServicio?"nombre y telefono":"nombre, telefono, direccion, departamento y ciudad",c=t.esServicio?` <input class="campo" data-lumy-dato="nombre" placeholder="Tu nombre"> 455 <input id="cel" class="campo" data-lumy-dato="telefono" placeholder="300 123 4567">`:` <input class="campo" data-lumy-dato="nombre" placeholder="Tu nombre"> 456 <input id="cel" class="campo" data-lumy-dato="telefono" placeholder="300 123 4567"> 457 <select class="campo" data-lumy-dato="departamento"><option value="">Elige tu departamento</option></select> 458 <select class="campo" data-lumy-dato="ciudad"><option value="">Elige tu ciudad</option></select> 459 <textarea class="campo" data-lumy-dato="direccion" placeholder="Calle, número, barrio"></textarea>`,g=t.dominioPropio?`Esta landing Sà tiene dominio propio conectado. Puedes usar JavaScript dentro de <script>, 460eventos inline como onclick y librerÃas por <script src="https://â¦">. Usa solo HTTPS. El navegador 461puede exigir CORS a las API externas, como en cualquier web.`:`Esta landing NO tiene dominio propio conectado. No uses <script>, onclick ni otros eventos 462inline: Lumy los quitará y bloqueará la publicación si encuentra <script>. Haz las interacciones con
463CSS, popover/details o las recetas data-lumy que aparecen abajo.`,f=(b=t.automatizacion)!=null&&b.activa?`ACTIVA: al confirmar, Lumy sube el pedido a ${t.automatizacion.logistica||"la logÃstica configurada"}${t.automatizacion.productoId?` con el producto ${t.automatizacion.productoId}`:""}. El HTML no debe llamar esa API: Lumy lo hace después de guardar el pedido.`:"INACTIVA: el pedido entra al CRM de Lumy, pero no se sube automáticamente a una logÃstica.";return`Vas a escribir una página COMPLETA en un solo archivo para el modo código de Lumy. Devuélveme solo el código, sin Markdown ni explicaciones. Puedes incluir HTML, <style> y, únicamente si abajo dice que hay dominio propio, <script>. No uses una plantilla de Lumy: todo lo visual debe estar escrito en este archivo. 464 465MI PRODUCTO 466 · Nombre: ${t.producto||"(escrÃbelo tú, aún no lo puse)"} 467 · Precio: ${i(t.precio)} 468 · PaÃs del pedido: ${t.pais||"(heredado de la cuenta)"} 469 · Moneda sellada por Lumy: ${t.moneda||"COP"} 470 · Variantes que ofrezco: 471${s} 472 · Datos que le pido al comprador: 473${u} 474 · Automatización logÃstica: ${f} 475 · EnvÃo: ${t.envio&&!t.envio.gratis?t.envio.valor>0?`cobro ${i(t.envio.valor)} fijo`:"se cobra por zonas (configurado fuera del código)":"gratis"} 476 · Producto adicional: ${t.adicional?`${t.adicional.nombre} (${i(t.adicional.precio)})`:"ninguno"} 477 · Pago: ${t.esServicio?"no se cobra en la página (se cotiza o se agenda)":(v=t.pago)!=null&&v.medios.length?t.pago.soloEnLinea?"SOLO en lÃnea (la contraentrega está apagada)":"contraentrega o en lÃnea":"contraentrega (el comprador paga al recibir)"} 478 · Después de la compra: ${(j=t.gracias)!=null&&j.irA?`el botón de la pantalla de gracias lleva a ${t.gracias.irA}${t.gracias.irEn?` y se va solo a los ${t.gracias.irEn} segundos`:""}`:"se queda en la pantalla de gracias de Lumy"} 479 480${t.esWhatsapp?`ESTA PÃGINA ES DE WHATSAPP 481El pedido se cierra en el chat: la página NO necesita formulario. El botón principal es un enlace a 482mi WhatsApp: <a href="https://wa.me/${String(t.whatsappNumero||"").replace(/\D/g,"")||"57XXXXXXXXXX"}?text=Hola">Pedir por WhatsApp</a>. Lumy cuenta 483cada toque como Contact en Meta y TikTok y deja el contacto en mi CRM con el rastro del anuncio. 484Si además pongo dónde pedir (mis campos con data-lumy-pedir, las piezas o <div data-lumy-form></div>), 485la página cobra como cualquier otra: entonces el precio, las tallas y los datos de mi paÃs son 486obligatorios. Sin formulario, nada de eso hace falta. 487 488`:""}JAVASCRIPT Y DOMINIO 489${g} 490 491EL FORMULARIO: EL DISEÃO ES TUYO, LOS DATOS VAN A MI CRM 492Diseña tú el formulario entero, como quieras: tus <input>, <select>, <textarea>, <label> y tu 493<button>, con tus clases y tu CSS. Lo único que Lumy necesita es saber qué dato es cada campo: 494 <label for="cel">Tu celular</label> 495${c} 496 <button class="boton" data-lumy-pedir>Lo quiero</button> 497Los datos que Lumy entiende y NINGÃN otro (con otro nombre lo que escriba el comprador no llega al 498pedido y la página no se deja publicar): ${mc(t.pais)}. 499Lo de mi paÃs: 500${dS(t.pais)} 501Si necesito preguntar algo MÃS (la cédula, un texto para grabar, la talla del anillo), va con su 502propia marca y el nombre lo pongo yo: 503 <input class="campo" data-lumy-pregunta="Cédula" required> 504 <select class="campo" data-lumy-pregunta="Color del lazo"><option>Rojo</option><option>Azul</option></select> 505 <textarea class="campo" data-lumy-pregunta="Texto a grabar" maxlength="30"></textarea> 506Lo que escribo ahà es la pregunta Y el nombre del dato: el CRM mostrará «Cédula: 1020304050». Máximo 507ocho, y el nombre no puede ser uno de los datos de arriba ni el de una de mis variantes (se pisarÃan). En esta página tienen que estar: ${m}, y un 508<button data-lumy-pedir>. Lumy les pone el name, la validación y la lista de departamentos y 509ciudades (no escribas name ni las opciones de esas dos listas). Si falta el dato, debajo del botón 510aparece un aviso con id="subErr": dale estilo en tu CSS. 511Tallas y colores, si los tengo: <select data-lumy-variante="Talla"><option value="">Elige tu talla</option></select> 512(Lumy pone las opciones) o botones propios <input type="radio" data-lumy-variante="Color" value="Rojo">. 513El nombre del grupo y cada valor tienen que ser EXACTAMENTE los declarados en data-variantes (abajo). 514El total vivo (cambia con ofertas, adicional y envÃo): <span data-lumy-pedido="total"></span>; también 515"subtotal", "cantidad", "adicional" y "envio" (con data-gratis="EnvÃo gratis" para el texto cuando no 516cobra). Si la página cobra envÃo, el comprador tiene que ver el total antes de pedir. 517La cantidad, con mi diseño: <select data-lumy-cantidad></select> (Lumy pone mis ofertas) o botones 518<input type="radio" data-lumy-cantidad value="2">. Solo valen las cantidades que tengan oferta declarada 519en data-ofertas; no uses una casilla de número. Con este control, la talla o el color elegidos valen 520para todas las unidades y la pieza "oferta" deja de ser obligatoria. 521El producto adicional, con mi diseño: <label><input type="checkbox" data-lumy-adicional> EnvÃo express 522<span data-lumy-pedido="adicional"></span></label> (sin id: se lo pone Lumy). 523Un enlace que lleve a los campos: <a href="#orderForm">Pedir ahora</a>. 524Puedes animar tu botón como cualquier otro elemento: <button data-lumy-pedir data-lumy="pulso">. 525 526Si prefieres no diseñar el formulario, dos alternativas: 527 · el de Lumy entero, con su diseño: <div data-lumy-form></div> (vacÃo); 528 · sus piezas por separado: <div data-lumy-campo="datos"></div>, "variantes", "resumen", "oferta", 529 "bump", "pago" y "boton" â hacen falta "datos" y "boton" â, y qué datos se piden con 530 <div data-lumy-campos="${t.esServicio?"nombre, telefono, correo?":"nombre, telefono, direccion, departamento, ciudad, correo?"}"></div>. 531Con las piezas de Lumy, mis preguntas propias van en la misma lista con un + delante: 532<div data-lumy-campos="${t.esServicio?"nombre, telefono, +Cédula":"nombre, telefono, direccion, departamento, ciudad, +Cédula"}"></div>. 533Con el formulario ENTERO de Lumy (data-lumy-form) hay que pedirlas asÃ: un <input data-lumy-pregunta> 534suelto quedarÃa fuera del formulario y ese dato no llegarÃa nunca. 535No mezcles tus campos con las piezas de Lumy: se pedirÃan los datos dos veces. 536${t.esServicio?"":` 537EL PAGO: ${BS(t.pago)} 538`}Lumy no agrega bloques visuales por su cuenta: si la página no tiene dónde pedir, no se deja publicar. 539Por dentro sà envuelve tus campos en el formulario seguro, conecta variantes/totales, registra el 540pedido en el CRM y muestra la confirmación después de enviarlo. Eso no camb
540ia tu diseño. 541 542LÃMITES TÃCNICOS (el editor los avisa antes de publicar) 543 · <form>: el formulario lo pone Lumy alrededor de la página; tus campos van sueltos. 544 · name="â¦" en tus campos (lo pone Lumy) y los tipos hidden, file, password, submit, image o reset 545 se eliminan. Para archivos usa el módulo de medios y pega la URL HTTPS resultante. 546 · disabled se elimina de campos, variantes y botones conectados al pedido: si no quieres pedir un 547 campo, quita su data-lumy; si solo quieres impedir cambios, usa readonly cuando aplique. 548 · <iframe> que no sea YouTube, Vimeo, TikTok, Bunny/MediaDelivery o Google Maps; también se quitan 549 <template>, <object>, <embed> y <noscript>. 550 · ${t.dominioPropio?"JavaScript permitido porque esta landing tiene dominio propio.":"<script>, onclick y demás eventos: necesitan dominio propio."} 551 · En el CSS, solo @import de Google Fonts (hasta 10). Todo lo demás del CSS Sà se puede. 552 553EL DISEÃO NO TIENE LÃMITES 554El CSS es libre: cualquier selector (también >, +, ~, :has), cualquier @media (rangos, hover, 555pointer), @property (bordes aurora que giran con conic-gradient), @font-face (fuente embebida en 556data:font/woff2;base64), @layer, @container, @starting-style, filtros SVG con filter: url(#id), 557máscaras, degradados, mitad y mitad, sombras, blur, animaciones. Ventanas sin JavaScript con 558popover/popovertarget, <dialog> y <details>. SVG con <filter>, <mask>, <pattern> y <text>. Videos 559de YouTube (youtube.com/embed/ID), Vimeo (player.vimeo.com/video/ID) y TikTok (tiktok.com/embed/ID). 560 561PUEDES DECLARAR EL PRODUCTO EN TU PROPIO CÃDIGO 562 <div data-lumy-producto data-nombre="Reloj Curren 8462" data-precio="129900" data-tachado="189900"></div> 563Al guardar, Lumy toma ese nombre y ese precio como los de la página: de ahà salen el total del 564formulario, lo que la transportadora recauda y lo que llega al CRM. 565En esa MISMA marca se declaran las tallas y colores y las ofertas por cantidad, que en modo código no 566tienen otra pantalla: 567 data-variantes="Color: Negro, Azul | Talla: S, M, L" (grupos separados por | ; opciones por coma) 568 data-ofertas="2: 219.900, 3: 299.900" (cantidad: precio TOTAL; la de 1 es el precio) 569Si uso data-lumy-variante sin declarar ese grupo aquÃ, la página no se deja publicar. Para que el 570comprador elija una oferta, pon la pieza <div data-lumy-campo="oferta"></div> donde quieras: con 571ofertas, la talla o el color de CADA unidad se elige dentro de esa pieza, asà que es obligatoria. 572En esa MISMA marca van también el envÃo y el producto adicional: 573 data-envio="12.000" (valor fijo; data-envio="gratis" no cobra) 574 data-adicional="EnvÃo express: 9.900" (nombre: precio; se suma al cobro de la misma guÃa) 575 data-adicional-texto="Te llega primero" data-adicional-marcado="si" (opcionales) 576El adicional necesita dónde marcarse: la pieza <div data-lumy-campo="bump"></div> o mi propia casilla 577data-lumy-adicional. Para quitarlo: data-adicional="ninguno". 578Para quitar las ofertas o las variantes se escribe la palabra: data-ofertas="ninguna". El precio se puede escribir 579129900, 129.900 o $129,900; en dólares, 29.90 son 29 con 90 centavos. No pongas ahà letras ni un 580cero: Lumy ignora lo que no entiende y conserva el precio anterior, para no dejar la página 581vendiendo en cero. 582 583DESPUÃS DE LA COMPRA: LA PANTALLA DE GRACIAS Y A DÃNDE VA EL COMPRADOR 584Al confirmar el pedido Lumy muestra su pantalla de gracias. Se decide desde el código con UNA marca: 585 <section data-lumy-gracias data-titulo="¡Listo, {nombre}!" data-texto="Te escribimos hoy por WhatsApp." 586 data-boton="Seguir viendo" data-ir-a="https://mitienda.com/gracias" data-ir-en="8"></section> 587data-ir-a es a dónde lleva el botón (una dirección https, por ejemplo mi sitio o https://wa.me/57300â¦); 588con data-ir-en se va solo a los segundos indicados (de 3 a 60). Si escribo contenido DENTRO de esa 589etiqueta, no se ve en la página y pasa a ser la pantalla de gracias con mi diseño; adentro sirven 590<span data-lumy-pedido="nombre">, "numero", "total", "cantidad" y "envio". Lo demás de esa pantalla 591(#okSummary, #okRef, #okSteps, #okTrack, .ok-actions, #okDone) se oculta desde mi CSS si no lo quiero. 592 593LOS DATOS DEL PRODUCTO, SIN ESCRIBIRLOS A MANO 594No escribas el nombre ni el precio a pelo: si después los cambio en Lumy, tu página se queda vieja y 595termina diciendo una cifra distinta a la que cobra el formulario. Usa estas marcas y Lumy las 596rellena sola al publicar: 597 <h1 data-lumy-text="producto.nombre"></h1> 598 <b data-lumy-text="producto.precio"></b> 599 <s data-lumy-text="producto.precio_antes"></s> 600 <p data-lumy-text="producto.descripcion"></p> 601 <img data-lumy-src="producto.imagen" alt=""> 602 <img data-lumy-src="producto.imagenes[1]" alt=""> 603También sirven dentro de un texto como {{ producto.nombre }}. 604Las que existen y NINGUNA más: producto.nombre, producto.precio, producto.precio_antes, 605producto.descripcion, producto.imagen, producto.imagenes[n], envio.texto, tienda.nombre, 606landing.nombre. Si inventas otra, Lumy la deja tal cual y queda a la vista en la página. 607 608LO QUE Sà PUEDES USAR SIN ESCRIBIR JAVASCRIPT 609Marca cualquier elemento con data-lumy="â¦" y Lumy le pone movimiento:
610 aparecer (data-desde="abajo|izquierda|derecha|zoom", data-retraso), aparecer-hijos (data-paso), 611 contador (data-hasta, data-duracion, data-prefijo, data-sufijo), escribir (data-velocidad), 612 cuenta-regresiva (data-hasta="2026-12-24T20:00", data-fin), parallax (data-fuerza), 613 zoom-scroll (data-fuerza), revelar-imagen, particulas (data-cantidad, data-color, data-velocidad), 614 marquesina (data-velocidad, data-direccion), flotar (data-fuerza, data-duracion), brillar, pulso, 615 sacudir (data-cada), tilt, gradiente-vivo (data-colores="#1e2a5a,#4f7cff", data-duracion), 616 pestanas (cada hijo con data-titulo), acordeon (con <details> adentro), 617 carrusel (data-intervalo), comparador (dos <img> adentro), ampliar, video-al-verse, 618 rotar-palabras (data-palabras="uno,dos", data-velocidad, data-espera), resaltar (data-color), 619 progreso-scroll (data-color), pegajoso (data-arriba), parallax-raton (hijos con data-profundidad), 620 confeti, copiar (data-texto), ver-mas (data-alto), zoom-hover. 621 622LOS ESTILOS DE LUMY NO TOCAN MI PÃGINA
623Mi página arranca como la deja el navegador: pon tú la letra, los márgenes y los colores de todo. 624Los campos y botones no heredan la letra por defecto: input, select, textarea, button { font: inherit; }. 625Las piezas de Lumy (si las uso) y su pantalla de gracias (#okScreen) también se pueden estilizar: 626mis reglas les ganan. 627 628OTROS DETALLES 629 · Fuentes: @import url(https://fonts.googleapis.com/css2?family=Poppins:wght@400;800&display=swap); 630 Los espacios del nombre van como + (Playfair+Display). Máximo 10. También funciona el <link 631 rel="stylesheet"> de Google Fonts. 632 · Imágenes: por https. Etiquetas permitidas: las normales de texto, listas, tablas, img, video, 633 audio, a, button, details, summary, picture, source y SVG. 634 · ${Fv} 635 · Hazla para celular primero: la mayorÃa de mis compradores entra desde el teléfono. 636 · Puedes definir <title>, <meta name="description">, <link rel="icon"> y <meta property="og:image">; 637 Lumy los lleva al <head> real de la página publicada. 638 · Lumy NO agrega a mi diseño pie, barra inferior ni botón de WhatsApp. En tu pie pon 639 <div data-lumy-campo="politicas"></div>: ahà Lumy pinta los enlaces a la polÃtica de privacidad 640 y a la de envÃos y devoluciones, con los textos de mi paÃs. Meta y TikTok los exigen para aprobar 641 los anuncios.${t.conWhatsapp?` 642 · La configuración antigua indica WhatsApp, pero en modo código el botón solo aparece si lo escribes tú.`:""} 643 · Un botón de WhatsApp: un enlace a mi número (https://wa.me/57300â¦) o, mejor, 644 <button data-lumy-whatsapp data-texto="Quiero la talla M">Pedir por WhatsApp</button>: Lumy lo 645 abre con el número y el mensaje de la página y lo cuenta como contacto. Con JavaScript, llama 646 lumyWhatsApp('mi mensaje') dentro del clic. Nunca abras WhatsApp con location.href. 647 648ENTREGA 649Devuelve un solo documento. Debe ser responsive desde 320 px, accesible con teclado, sin texto ni 650precio inventados, sin llamadas directas a Dropi/Mastershop/99envÃos y con todas las marcas Lumy 651necesarias. No omitas el formulario ni las variantes indicadas arriba. El archivo completo debe 652pesar menos de 600.000 caracteres; enlaza imágenes, videos y librerÃas por HTTPS en vez de incrustar 653archivos grandes en base64.${Ik(a)}`}function Ik(t){const a=(t||[]).filter(s=>s&&s.texto);if(!a.length)return"";const n=a.filter(s=>s.tipo==="quita"),o=a.filter(s=>s.tipo!=="quita"),i=s=>` · lÃnea ${s.linea}: ${s.texto}`;return` 654 655LO QUE HAY QUE ARREGLAR DEL CÃDIGO QUE YA TENGO 656Esto es lo que Lumy encontró revisando mi página ahora mismo. CorrÃgelo en lo que me devuelvas.${n.length?` 657 658Lumy BORRA esto al publicar, asà que hay que arreglarlo sà o sÃ: 659${n.slice(0,25).map(i).join(` 660`)}`:""}${o.length?` 661 662Esto funciona, pero conviene tenerlo en cuenta: 663${o.slice(0,25).map(i).join(` 664`)}`:""}`}const Tk=new Set(["producto.precio","producto.precio_antes"]),A2={"producto.nombre":"el nombre del producto","producto.descripcion":"la descripción del producto","tienda.nombre":"el nombre de tu tienda","landing.nombre":"el nombre de la página","envio.texto":"el texto del envÃo","producto.precio":"el precio","producto.precio_antes":"el precio de antes"},Hb=(t,a)=>t.slice(0,Math.max(0,a)).split(` 665`).length;function Ek(t,a){var N;const n=String(t??""),o=String(a??"");if(n===o)return{tipo:"ninguno"};let i=0;const s=Math.min(n.length,o.length);for(;i<s&&n.charCodeAt(i)===o.charCodeAt(i);)i++;let u=0;for(;u<n.length-i&&u<o.length-i&&n.charCodeAt(n.length-1-u)===o.charCodeAt(o.length-1-u);)u++;const m=o.slice(i,o.length-u),c=n.slice(i,n.length-u);if(/[<>]/.test(m)||/[<>]/.test(c))return{tipo:"ninguno"};if(!/\S/.test(m)&&!/\S/.test(c))return{tipo:"ninguno"};const g=o.lastIndexOf(">",i-1);if(g<0||o.lastIndexOf("<",i-1)>g)return{tipo:"ninguno"};const f=o.lastIndexOf("<",g);if(f<0)return{tipo:"ninguno"};const b=o.slice(f,g+1),v=(N=/^<([a-zA-Z][a-zA-Z0-9-]*)\b/.exec(b))==null?void 0:N[1];if(!v||/\/\s*>$/.test(b))return{tipo:"ninguno"};const j=/\sdata-lumy-text\s*=\s*"([^"]+)"/i.exec(b);if(!j)return{tipo:"ninguno"};const S=o.indexOf("<",g+1);if(S<0||!new RegExp(`^</${v}\\s*>`,"i").test(o.slice(S,S+v.length+8)))return{tipo:"ninguno"};const $=j[1].trim().toLowerCase();if(!A2[$])return{tipo:"ninguno"};const C=Hb(o,f);if(Tk.has($)){const w=o.search(/data-lumy-producto\b/i);
665return{tipo:"precio",variable:$,linea:C,lineaDeLaMarca:w>=0?Hb(o,w):null}}const _=b.slice(0,j.index)+b.slice(j.index+j[0].length);return{tipo:"suelto",html:o.slice(0,f)+_+o.slice(g+1),corrimiento:_.length-b.length,variable:$,linea:C}}const Rs="#0866ff";function zk({html:t,onHtml:a,previewHtml:n,landingId:o,nombre:i,savedMsg:s,onVolver:u,acciones:m,datos:c,dominioPropio:g,pedido:f,onPedido:b,porQueSinDominio:v,seccionDePagos:j,seccionDePixeles:S,onVerPixeles:$}){const[C,_]=h.useState("codigo"),[N,w]=h.useState(""),M=h.useRef(null),p=$a(),V=h.useRef(null),L=h.useRef(null),[x,z]=h.useState([]),[G,B]=h.useState(""),[U,ne]=h.useState(null),[Q,de]=h.useState(""),[pe,ce]=h.useState(null),[ve,ge]=h.useState(!1),[Te,ie]=h.useState(!1),fe=async()=>{ge(!0);try{const Ae=await(await p("/api/landing/media")).json();ce(Array.isArray(Ae==null?void 0:Ae.items)?Ae.items:[])}catch{ce([])}finally{ge(!1)}},Be=h.useMemo(()=>{const oe=Q.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"");if(!oe)return Ob;const Ae=He=>He.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").includes(oe);return Ob.map(He=>({...He,marcas:Ae(He.grupo)?He.marcas:He.marcas.filter(ut=>Ae(ut.codigo)||Ae(ut.que))})).filter(He=>He.marcas.length>0)},[Q]),We=Fg(),ze=h.useMemo(()=>We?{numeroDelBoton:c.whatsappNumero||"",conectados:We.conectados,agenteEncendido:We.agente}:void 0,[We,c.whatsappNumero]),tt=h.useMemo(()=>ze?sc(Yu(t||"",{tipo:"pagina",dominioPropio:!!c.dominioPropio,...ze}).resumen):"",[t,ze,c.dominioPropio]),Fe=h.useMemo(()=>Ov(t||"",{dominioPropio:!!c.dominioPropio,esServicio:!!c.esServicio,variantes:(c.variantes||[]).map(oe=>oe.nombre),variantesConOpciones:c.variantes||[],conOfertas:!!c.conOfertas,cantidades:c.cantidades||[],conAdicional:!!c.adicional,pais:c.pais,esWhatsapp:!!c.esWhatsapp,quitados:c.quitados||[],pago:c.pago,whatsapp:ze}),[t,c.dominioPropio,c.esServicio,JSON.stringify(c.variantes||[]),c.conOfertas,(c.cantidades||[]).join("|"),!!c.adicional,c.pais,!!c.esWhatsapp,(c.quitados||[]).join("|"),JSON.stringify(c.pago||null),JSON.stringify(ze||null)]),F=h.useMemo(()=>{var Ae,He,ut;const oe=[];try{const at=qu(t||"");at!=null&&at.nombre&&oe.push({que:"Producto",vale:at.nombre}),at!=null&&at.precio&&oe.push({que:"Precio",vale:String(at.precio)}),(Ae=at==null?void 0:at.variantes)!=null&&Ae.length&&oe.push({que:"Variantes",vale:at.variantes.map(Nt=>`${Nt.nombre}: ${Nt.opciones.join(", ")}`).join(" · ")}),(He=at==null?void 0:at.ofertas)!=null&&He.length&&oe.push({que:"Ofertas",vale:at.ofertas.map(Nt=>`${Nt.cantidad} u. ${Nt.precio}`).join(" · ")}),(ut=at==null?void 0:at.adicional)!=null&&ut.nombre&&oe.push({que:"Adicional",vale:`${at.adicional.nombre} (${at.adicional.precio})`});const dt=((at==null?void 0:at.variantes)||[]).map(Nt=>Nt.nombre),Ge=Qg(t||"",!!c.esServicio,dt,c.pais);Ge!=null&&Ge.length&&oe.push({que:"Datos del pedido",vale:Ge.map(Nt=>`${Nt.clave}${Nt.obligatorio?"*":""}`).join(", ")});const vt=Tv(t||"",dt);vt.length&&oe.push({que:"Tus preguntas",vale:vt.map(Nt=>`${Nt.clave}${Nt.obligatorio?"*":""}`).join(", ")})}catch{}return oe},[t,c.esServicio,c.pais]),[Re,K]=h.useState(!1),[I,H]=h.useState(null),ye=h.useRef(null),De=wv(()=>{var oe;return(oe=ye.current)==null?void 0:oe.querySelector("iframe")}),Ue=oe=>{const Ae=M.current;if(!Ae||oe<1)return;const ut=String(t||"").split(` 666`);if(oe>ut.length)return;let at=0;for(let Ge=0;Ge<oe-1;Ge++)at+=ut[Ge].length+1;const dt=at+ut[oe-1].length;_("codigo"),setTimeout(()=>{try{Ae.focus(),Ae.setSelectionRange(at,dt);const Ge=Ae.scrollHeight/Math.max(1,ut.length);Ae.scrollTop=Math.max(0,Ge*(oe-1)-Ae.clientHeight/2)}catch{}},60)};h.useEffect(()=>{if(!Re)return;const oe=at=>{var dt,Ge,vt;try{(vt=(Ge=(dt=ye.current)==null?void 0:dt.querySelector("iframe"))==null?void 0:Ge.contentWindow)==null||vt.postMessage({lumyCodigoInspect:at},"*")}catch{}},Ae=at=>{var Nt;const dt=at==null?void 0:at.data;if(!dt||typeof dt!="object"||!("lumyCodigoLinea"in dt))return;const Ge=(Nt=ye.current)==null?void 0:Nt.querySelector("iframe");if(!Ge||at.source!==Ge.contentWindow)return;const vt=Number(dt.lumyCodigoLinea)||0;H({linea:vt,etiqueta:String(dt.etiqueta||""),deLumy:!!dt.deLumy}),vt>0&&Ue(vt),K(!1)};window.addEventListener("message",Ae),oe(!0);const He=setInterval(()=>
666oe(!0),1200),ut=at=>{at.key==="Escape"&&K(!1)};return window.addEventListener("keydown",ut),()=>{window.removeEventListener("message",Ae),window.removeEventListener("keydown",ut),clearInterval(He),oe(!1)}},[Re,t]);const[se,we]=h.useState(null);h.useEffect(()=>{if(!se)return;const oe=setTimeout(()=>we(null),2e4);return()=>clearTimeout(oe)},[se]);const Ye=h.useRef(null);h.useLayoutEffect(()=>{const oe=Ye.current;if(oe==null)return;Ye.current=null;const Ae=M.current;if(Ae&&Ae.value===t)try{Ae.selectionStart=Ae.selectionEnd=Math.min(oe,Ae.value.length)}catch{}},[t]);const lt=oe=>{const Ae=Ek(t||"",oe);if(Ae.tipo==="suelto"){const He=M.current,ut=He?He.selectionStart:null;ut!=null&&(Ye.current=Math.max(0,ut+Ae.corrimiento)),a(Ae.html),we({tipo:"suelto",variable:Ae.variable,linea:Ae.linea});return}Ae.tipo==="precio"&&we({tipo:"precio",variable:Ae.variable,linea:Ae.linea,lineaDeLaMarca:Ae.lineaDeLaMarca}),a(oe)},jt=h.useRef(0);h.useEffect(()=>{const oe=Ae=>{var at;const He=Ae==null?void 0:Ae.data;if(!He||typeof He!="object"||!("lumyCodigoScroll"in He))return;const ut=(at=ye.current)==null?void 0:at.querySelector("iframe");ut&&Ae.source&&Ae.source!==ut.contentWindow||(jt.current=Math.max(0,Number(He.lumyCodigoScroll)||0))};return window.addEventListener("message",oe),()=>window.removeEventListener("message",oe)},[]);const[Je,Ct]=h.useState(!1),[st,la]=h.useState(null);h.useEffect(()=>{la(null)},[f.idLogistica,f.logistica,f.cuentaDropiId,f.paisEfectivo]);const ia=async()=>{var He;const oe=String(f.idLogistica||"").trim(),Ae=((He=f.logisticas.find(ut=>ut.nombre===f.logistica))==null?void 0:He.clave)||"";if(oe){Ct(!0),la(null);try{const ut=new URLSearchParams({logistica:Ae,id:oe});Ae==="dropi"&&(f.cuentaDropiId&&ut.set("account_id",f.cuentaDropiId),ut.set("country",f.paisEfectivo));const dt=await(await p(`/api/landing/comprobar-producto?${ut.toString()}`)).json();la({ok:(dt==null?void 0:dt.ok)??null,message:String((dt==null?void 0:dt.message)||"")})}catch{la({ok:null,message:"Sin conexión: no pude comprobarlo ahora."})}finally{Ct(!1)}}},ha=h.useRef(null),da=oe=>{C==="codigo"&&M.current&&(ha.current=M.current.selectionStart??null),oe==="pixeles"&&($==null||$()),_(oe)},Na=oe=>{const Ae=M.current;if(!Ae){const dt=t||"",Ge=Math.min(ha.current??dt.length,dt.length);a(dt.slice(0,Ge)+oe+dt.slice(Ge)),ha.current=Ge+oe.length,_("codigo"),setTimeout(()=>{const vt=M.current;if(vt)try{vt.focus(),vt.selectionStart=vt.selectionEnd=Ge+oe.length}catch{}},60);return}const He=Ae.selectionStart??t.length,ut=Ae.selectionEnd??He,at=t.slice(0,He)+oe+t.slice(ut);a(at),requestAnimationFrame(()=>{try{Ae.focus(),Ae.selectionStart=Ae.selectionEnd=He+oe.length}catch{}})},wa=async oe=>{if(!oe.length)return;B(`Subiendo ${oe.length===1?"tu archivo":`${oe.length} archivos`}â¦`);const{medios:Ae,fallaron:He}=await rv(p,oe,ut=>B(`Subiendo⦠${ut} de ${oe.length}`));z(ut=>[...Ae,...ut]),_("codigo"),B(He.length?`${He.map(ut=>`${ut.nombre}: ${ut.motivo}`).join(" · ")}`:""),He.length&&setTimeout(()=>B(""),9e3),Ae.length&&ne(Ae)},La=async(oe,Ae)=>{try{await navigator.clipboard.writeText(oe),w(Ae),setTimeout(()=>w(""),1800)}catch{w("")}},Gt=async oe=>{const Ae=oe==null?void 0:oe[0];if(Ae&&!(String(t||"").trim()&&!window.confirm("Esto reemplazará el código que está en el editor. ¿Continuar?")))try{a(await Ae.text()),_("codigo"),setTimeout(()=>{var He;return(He=M.current)==null?void 0:He.focus()},40)}catch{B("No pude leer ese archivo.")}},[he,Me]=h.useState(null),yt=oe=>{const Ae=o2(oe);return Ae?r2(Ae)?String(t||"").trim()&&!window.confirm("Esto reemplazará el código que está en el editor. ¿Continuar?")?!1:(a(Ae),_("codigo"),B(""),setTimeout(()=>{var He;return(He=M.current)==null?void 0:He.focus()},40),!0):(B("Eso no parece el código de la página: no trae etiquetas HTML. Copia solo el código que te dio la IA."),!1):(B("No habÃa nada que traer."),!1)},kt=async()=>{try{const oe=await navigator.clipboard.readText();if(!String(oe||"").trim()){Me("");return}yt(oe)}catch{Me("")}},[ct,xt]=h.useState(!1),Ut=async()=>{if(!o||ct)return;const oe=window.open("","_blank");xt(!0);try{const He=await(await fetch(`/api/landing/${o}/url-de-prueba`)).json();if(He!=null&&He.ok&&He.url)oe?oe.location.href=He.url:window.location.href=He.url;else{try{oe==null||oe.close()}catch{}B("No pude abrir la prueba. Guarda la página y vuelve a intentarlo.")}}catch{try{oe==null||oe.close()}catch{}B("No pude abrir la prueba. Revisa tu conexión.")}finally{xt(!1)}},Qt=()=>{const oe=new Blob([t||""],{type:"text/html;charset=utf-8"}),Ae=URL.createObjectURL(oe),He=document.createElement("a");He.href=Ae,He.download=`${(i||"landing").toLowerCase().replace(/[^a-z0-9áéÃóúñ_-]+/gi,"-").replace(/^-|-$/g,"")||"landing"}.html`,He.click(),setTimeout(()=>URL.revokeObjectURL(Ae),0)},$e={display:"block",fontSize:12,fontWeight:800,color:"var(--text, #111)",marginBottom:5},Pe={width:"100%",boxSizing:"border-box",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"9px 11px",fontSize:13.5,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"},ue={border:"1px solid var(--border, #e8eaf0)",borderRadius:14,background:"var(--card-bg, #fff)",overflow:"hidden"};return e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(10px, 1.6vw, 18px)",position:"relative",isolation:"isolate"},children:[e.jsx(s2,{}),e.jsxs("div",{className:"lk-cabecera-codigo",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:10},children:[e.jsx("button",{onClick:u,style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 13px",fontSize:13.5,fontWeight:700,cursor:"pointer",color:"var(--text, #111)",fontFamily:"inherit"},children:"â Volver"}),e.jsx("span",{style:{fontSize:14.5,fontWeight:800,color:"var(--text, #111)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i||"Página en código"}),!c.esServicio&&!(c.esWhatsapp&&!fc(t||""))&&!!String(t||"").trim()&&!(Number(c.precio)>0)&&e.jsx("button",{type:"button",title:ab(hc(t||"",c.pais)),onClick:()=>{var oe;try{(oe=navigator.clipboard)==null||oe.writeText(zv)}catch{}window.alert(ab(hc(t||"",c.pais))+` 667
668Ya te copié la lÃnea: pégala en tu código y cambia el nombre y el precio.`)},style:{fontSize:11.5,fontWeight:800,color:"var(--warning, #b45309)",background:"rgba(245,158,11,.10)",border:"1px solid rgba(180,83,9,.25)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap",cursor:"pointer"},children:"Falta el precio para poder publicar · ¿cómo?"}),!g&&/<script\b/i.test(t||"")&&e.jsx("button",{type:"button",title:v||"Tu JavaScript solo corre en tu propio dominio.",onClick:()=>window.alert(v||"Tu JavaScript solo corre en tu propio dominio. Conéctalo en «PÃxeles y dominios» y asÃgnaselo a esta página."),style:{fontSize:11.5,fontWeight:800,color:"var(--warning, #b45309)",background:"rgba(245,158,11,.10)",border:"1px solid rgba(180,83,9,.25)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap",cursor:"pointer"},children:/tienda está apagada/.test(v||"")?"Tu tienda está apagada: tu JavaScript no corre · ¿qué hago?":"Para publicar con tu JavaScript, conecta tu dominio · ¿cómo?"}),!!String(t||"").trim()&&!(c.esWhatsapp&&!fc(t||""))&&lg(t,!!c.esServicio,c.pais,c.pago).length>0&&e.jsx("span",{title:qv(lg(t,!!c.esServicio,c.pais,c.pago)),style:{fontSize:11.5,fontWeight:800,color:"var(--warning, #b45309)",background:"rgba(245,158,11,.10)",border:"1px solid rgba(180,83,9,.25)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:"Tu página aún no tiene dónde pedir"}),!!s&&e.jsx("span",{role:"status",style:{fontSize:12.5,fontWeight:700,color:/^(sin guardar|no se pudo|error)/i.test(s)?"var(--danger)":/borrador/i.test(s)?"var(--warning, #b45309)":"var(--success)"},children:s}),e.jsx("button",{onClick:()=>da("pedido"),title:"A dónde van los pedidos de esta página",style:{display:"flex",alignItems:"center",gap:6,border:`1px solid ${f.subeSolo?"rgba(11,122,75,.3)":"var(--warning-border, rgba(180,83,9,.3))"}`,background:f.subeSolo?"rgba(11,122,75,.08)":"rgba(245,158,11,.10)",color:f.subeSolo?"var(--success, #0b7a4b)":"var(--warning, #b45309)",borderRadius:999,padding:"5px 12px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:f.subeSolo?`Los pedidos suben solos${f.logistica?" a "+f.logistica:""}`:"Los pedidos NO suben solos · activar"})]}),e.jsxs("div",{className:"lk-codigo-2col",style:{display:"flex",gap:14,alignItems:"flex-start"},children:[e.jsxs("div",{ref:ye,style:{flex:"0 0 328px",minWidth:0,maxWidth:"100%",position:"sticky",top:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:7,minHeight:28},children:[e.jsx(c2,{}),e.jsx(d2,{señalando:Re,onClick:()=>{Re||H(null),K(!Re)}})]}),(Re||I)&&e.jsx("div",{style:{fontSize:11,fontWeight:700,color:I!=null&&I.deLumy?"var(--warning, #b45309)":"var(--text-muted, #64748b)",marginBottom:6,lineHeight:1.35},children:I?I.deLumy?"Eso lo pone Lumy, no está en tu código: el formulario y sus piezas.":`LÃnea ${I.linea}${I.etiqueta?` · <${I.etiqueta}>`:""}`:"Toca cualquier parte de la página."}),e.jsx("div",{style:{width:328,maxWidth:"100%",boxSizing:"border-box",background:"#0b1020",borderRadius:26,padding:9,boxShadow:"0 18px 40px -22px rgba(6,12,34,.7)"},children:e.jsx("div",{style:{position:"relative",width:310,maxWidth:"100%",height:"calc(100vh - 190px)",minHeight:430,overflow:"hidden",borderRadius:18,background:"#fff"},children:String(t||"").trim()?e.jsx("iframe",{title:"Asà la ve tu cliente",srcDoc:n,sandbox:"allow-scripts allow-modals allow-popups",onLoad:oe=>{var Ae;try{(Ae=oe.currentTarget.contentWindow)==null||Ae.postMessage({lumyCodigoScrollA:jt.current},"*")}catch{}},style:{width:430,height:`${100/.72}%`,border:0,background:"#fff",display:"block",transform:"scale(0.72)",transformOrigin:"top left"}}):e.jsx(l2,{})})}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:8,marginTop:7,textAlign:"center"},children:[!!n&&e.jsx("button",{type:"button",onClick:()=>ie(!0),style:{border:0,background:"none",color:Rs,padding:0,fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap"},children:"Vista completa â"}),!!o&&e.jsx("button",{type:"button",onClick:()=>{Ut()},disabled:ct,title:"Abre tu página como la verá el comprador, sin publicarla. No cuenta visitas ni avisa a Meta.",style:{border:0,background:"none",color:Rs,padding:0,fontSize:11.5,fontWeight:800,cursor:ct?"default":"pointer",opacity:ct?.5:1,fontFamily:"inherit",whiteSpace:"nowrap"},children:ct?"Abriendoâ¦":"Probar de verdad â"})]}),!!tt&&e.jsx("div",{role:"status",style:{fontSize:12,lineHeight:1.45,marginTop:8,color:"var(--text-secondary, #64748b)",textAlign:"center"},children:tt}
668),e.jsx(ng,{pruebas:De.pruebas,tipo:"pagina",agenteEncendido:We?We.agente:void 0}),e.jsx(og,{landingId:o||0,parte:"pagina",html:t||"",capturas:De.capturas}),/<script\b|\son[a-z]+\s*=/i.test(t||"")&&e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)",marginTop:4,textAlign:"center",lineHeight:1.35},children:g?"Tu JavaScript corre aquà dentro de un espacio aislado y, al publicar, en tu dominio propio.":"Aquà puedes probar tu JavaScript de forma aislada; para publicarlo necesitas conectar tu dominio propio."})]}),e.jsxs("div",{style:{flex:"1 1 0",minWidth:0},children:[e.jsxs("div",{className:"lk-barra-codigo",children:[e.jsx("div",{className:"lk-vistas",role:"tablist",children:[["codigo","Tu código"],["guia","Lo que Lumy entiende"],["pedido","El pedido"],...S?[["pixeles","PÃxeles"]]:[]].map(([oe,Ae])=>e.jsx("button",{role:"tab","aria-selected":C===oe,onClick:()=>da(oe),className:C===oe?"lk-vista on":"lk-vista",children:Ae},oe))}),m&&e.jsx("span",{className:"lk-separa",children:m}),e.jsxs("div",{className:"lk-acciones",children:[e.jsxs("button",{onClick:()=>{var oe;return(oe=V.current)==null?void 0:oe.click()},className:"lk-accion",children:[e.jsx(wo.subir,{}),"Subir foto o video"]}),e.jsxs("button",{onClick:fe,disabled:ve,className:"lk-accion",children:[e.jsx(wo.fotos,{}),ve?"Abriendoâ¦":"Mis fotos"]}),e.jsx("input",{ref:V,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:oe=>{const Ae=Array.from(oe.target.files||[]);oe.currentTarget.value="",wa(Ae)}}),e.jsxs("button",{onClick:()=>{var oe;return(oe=L.current)==null?void 0:oe.click()},className:"lk-accion",title:"Reemplazar el editor con un archivo .html o .txt",children:[e.jsx(wo.importar,{}),"Importar HTML"]}),e.jsx("input",{ref:L,type:"file",accept:".html,.htm,.txt,text/html,text/plain",hidden:!0,onChange:oe=>{Gt(oe.target.files),oe.currentTarget.value=""}}),e.jsxs("button",{onClick:Qt,className:"lk-accion",title:"Guardar una copia del código en tu equipo",children:[e.jsx(wo.descargar,{}),"Descargar"]}),e.jsxs("button",{onClick:()=>{kt()},className:"lk-accion",title:"Pega aquà el código que te devolvió tu IA",children:[e.jsx(wo.traer,{}),"Traer de IA"]}),e.jsxs("button",{onClick:()=>La($k(c,Fe),"prompt"),className:N==="prompt"?"lk-ia ok":"lk-ia",children:[N==="prompt"?e.jsx(wo.listo,{}):e.jsx(wo.chispa,{}),N==="prompt"?"¡Copiado!":"Copiar para la IA"]})]})]}),e.jsx("style",{children:i2}),!!G&&e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:/Subiendo/.test(G)?"var(--text-secondary, #64748b)":"var(--danger)",marginBottom:8},children:G}),C==="codigo"&&se&&e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"flex-start",gap:8,marginBottom:8,padding:"8px 11px",borderRadius:10,fontSize:12.5,lineHeight:1.45,fontWeight:600,background:se.tipo==="precio"?"var(--notice-warning-bg, #fff7e6)":"var(--notice-success-bg, #ecfdf3)",border:`1px solid ${se.tipo==="precio"?"var(--notice-warning-border, #f5c46b)":"var(--notice-success-border, #a7e3c1)"}`,color:se.tipo==="precio"?"var(--notice-warning-text, #8a5300)":"var(--success, #047857)"},children:[e.jsx("span",{style:{flex:1},children:se.tipo==="suelto"?e.jsxs(e.Fragment,{children:["Listo: la lÃnea ",se.linea," ahora muestra lo que escribes. Ya no copia ",A2[se.variable],"."]}):e.jsxs(e.Fragment,{children:["Ese precio lo pone Lumy y es el que se cobra: aunque lo cambies aquÃ, la página sigue mostrando el de tu producto. ",se.lineaDeLaMarca?e.jsxs(e.Fragment,{children:["Cámbialo en la marca del producto, lÃnea ",se.lineaDeLaMarca,". ",e.jsxs("button",{type:"button",onClick:()=>{const oe=se.lineaDeLaMarca;we(null),Ue(oe)},style:{border:0,background:"none",padding:0,color:"inherit",fontWeight:800,textDecoration:"underline",cursor:"pointer",fontFamily:"inherit",fontSize:"inherit"},children:["Ir a la lÃnea ",se.lineaDeLaMarca]})]}):e.jsxs(e.Fragment,{children:["Para cambiarlo, ponle el precio a la marca del producto en tu código (",e.jsx("code",{children:"data-lumy-producto"}),")."]})]})}),e.jsx("button",{type:"button","aria-label":"Cerrar aviso",onClick:()=>we(null),style:{border:0,background:"none",padding:"0 2px",color:"inherit",fontSize:15,lineHeight:1,cursor:"pointer",fontFamily:"inherit"},children:"Ã"})]}),C==="codigo"?e.jsx("div",{children:e.jsx(Hv,{ref:M,valor:t,onCambio:lt,dominioPropio:g,esServicio:!!c.esServicio,variantes:c.variantes.map(oe=>oe.nombre),variantesConOpciones:c.variantes,conOfertas:!!c.conOfertas,cantidades:c.cantidades,conAdicional:!!c.adicional,pais:c.pais,esWhatsapp:!!c.esWhatsapp,quitados:c.quitados||[],pago:c.pago,whatsapp:ze,alto:"calc(100vh - 320px)"})}):C==="pixeles"&&S?e.jsxs("div",{style:{...ue,padding:"14px 16px",maxHeight:"calc(100vh - 210px)",overflowY:"auto"},children:[e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",lineHeight:1.5,marginBottom:6},children:"A qué pÃxeles le reporta sus ventas esta página. Lumy los pone solo: no los escribas en tu código."}),S]}):C==="pedido"?e.jsxs("div",{style:{...ue,padding:"14px 16px",maxHeight:"calc(100vh - 210px)",overflowY:"auto"},children:[e.jsxs("div",{style:{paddingBottom:14,marginBottom:14,borderBottom:"1px solid var(--border, #eef1f6)"},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,color:"var(--text, #111)",marginBottom:3},children:"PaÃs y moneda del pedido"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:9,lineHeight:1.5},children:"La moneda no se escribe a mano: Lumy la toma del paÃs y la sella en el pedido, el CRM, el recaudo y las automatizaciones."}),e.jsxs("select",{value:f.paisDeclarado,onChange:oe=>b({pais:oe.target.value}),style:Pe,"aria-label":"PaÃs de la landing",children:[e.jsxs("option",{value:"",children:["Usar paÃs de mi cuenta (",f.paisCuenta,")"]}),f.paises.map(oe=>e.jsxs("option",{value:oe.codigo,children:[oe.nombre," · ",oe.moneda]},oe.codigo))]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:6},children:["Esta landing publicará pedidos de ",e.jsx("b",{children:f.paisEfectivo})," en ",e.jsx("b",{children:f.moneda}),f.paisDeclarado?"":" (heredado de tu cuenta)","."]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,color:"var(--text, #111)",marginBottom:3},children:"A dónde van tus pedidos"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:10,lineHeight:1.5},children:"Elige una y el pedido sube solo apenas se confirma. Sin esto entra a tu CRM y la guÃa la pides tú, uno por uno."}),e.jsxs("div",{style:{display:"flex",gap:9,flexWrap:"wrap",marginBottom:12},children:[f.logisticas.map(oe=>{const Ae=f.subeSolo&&f.logistica===oe.nombre,He=oe.disponible&&oe.compatible;return e.jsxs("button",{disabled:!He,onClick:()=>b({subeSolo:!0,logistica:oe.clave}
668),title:oe.disponible?oe.compatible?`Subir los pedidos a ${oe.nombre}`:oe.motivo:oe.motivo||`${oe.nombre} no está disponible`,style:{flex:"1 1 130px",minWidth:120,textAlign:"left",cursor:He?"pointer":"not-allowed",border:Ae?`2px solid ${Rs}`:"1.5px solid var(--border, #e5e7eb)",background:Ae?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",opacity:He?1:.45,borderRadius:12,padding:"11px 12px",fontFamily:"inherit"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{display:"flex",flex:"none",filter:He?void 0:"grayscale(1)"},children:oe.clave==="dropi"?e.jsx(iv,{size:18}):oe.clave==="mastershop"?e.jsx(cj,{size:18}):e.jsx(uj,{size:18})}),e.jsx("span",{style:{fontSize:13.5,fontWeight:800,color:"var(--text, #111)"},children:oe.nombre}),Ae&&e.jsx("span",{style:{marginLeft:"auto",width:9,height:9,borderRadius:999,background:Rs,flex:"none"}})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:3},children:oe.disponible?oe.compatible?Ae?"Suben solos aquÃ":"Conectada":`No disponible en ${f.paisEfectivo}`:oe.motivo||"No disponible"})]},oe.clave)}),e.jsxs("button",{onClick:()=>b({subeSolo:!1}),title:"Los pedidos entran a tu CRM y tú decides cuándo subirlos",style:{flex:"1 1 130px",minWidth:120,textAlign:"left",cursor:"pointer",border:f.subeSolo?"1.5px solid var(--border, #e5e7eb)":`2px solid ${Rs}`,background:f.subeSolo?"var(--card-bg, #fff)":"rgba(8,102,255,.05)",borderRadius:12,padding:"11px 12px",fontFamily:"inherit"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{display:"flex",flex:"none",width:18,height:18,alignItems:"center",justifyContent:"center",color:"var(--text-muted)"},children:e.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}
668),e.jsx("path",{d:"M6 18 18 6"})]})}),e.jsx("span",{style:{fontSize:13.5,fontWeight:800,color:"var(--text, #111)"},children:"Ninguna"}),!f.subeSolo&&e.jsx("span",{style:{marginLeft:"auto",width:9,height:9,borderRadius:999,background:Rs,flex:"none"}})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:3},children:"Los subo yo"})]})]}),f.subeSolo&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:$e,children:["Id del producto en ",f.logistica||"tu logÃstica"]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{value:f.idLogistica,onChange:oe=>{b({idLogistica:oe.target.value}),la(null)},placeholder:"Ej: 184922",style:{...Pe,flex:"1 1 160px",width:"auto"}}),e.jsx("button",{onClick:ia,disabled:Je||!String(f.idLogistica||"").trim(),style:{border:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",color:"var(--text, #111)",borderRadius:10,padding:"9px 14px",fontSize:12.5,fontWeight:800,cursor:Je?"wait":"pointer",fontFamily:"inherit",opacity:String(f.idLogistica||"").trim()?1:.5},children:Je?"Comprobandoâ¦":"Comprobar"})]}),st?e.jsxs("div",{style:{fontSize:12,marginTop:7,lineHeight:1.5,fontWeight:700,color:st.ok===!0?"var(--success, #0b7a4b)":st.ok===!1?"var(--danger, #dc2626)":"var(--warning, #b45309)"},children:[st.ok===!0?"â ":st.ok===!1?"â ":"⢠",st.message]}):e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:6},children:["Es el número que ese producto tiene en ",f.logistica||"tu logÃstica",". Tócale «Comprobar» y te digo si es el tuyo, antes de que llegue el primer pedido."]}),f.logistica==="Dropi"&&f.cuentasDropi.length>1&&e.jsxs("div",{style:{marginTop:11},children:[e.jsx("label",{style:$e,children:"Cuenta de Dropi"}),e.jsxs("select",{value:f.cuentaDropiId,onChange:oe=>b({dropiAccountId:oe.target.value}),style:Pe,children:[e.jsx("option",{value:"",children:"Elegir automáticamente por paÃs"}),f.cuentasDropi.map(oe=>e.jsxs("option",{value:oe.id,disabled:!!oe.country&&oe.country!==f.paisEfectivo,children:[oe.label||`Cuenta ${oe.id}`,oe.country?` · ${oe.country}`:"",oe.is_default?" · principal":"",oe.country&&oe.country!==f.paisEfectivo?" · otro paÃs":""]},oe.id))]})]})]})]}),j&&e.jsxs("div",{style:{paddingTop:14,marginTop:14,borderTop:"1px solid var(--border, #eef1f6)"},children:[e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:9,lineHeight:1.5},children:["Activa aquà el pago en lÃnea. Los botones salen en tu página donde pongas ",e.jsx("code",{children:'<div data-lumy-campo="pago"></div>'})," (o dentro del formulario de Lumy entero)."]}),j]})]}):e.jsxs("div",{style:{...ue,padding:0,maxHeight:"calc(100vh - 210px)",overflowY:"auto"},children:[e.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--border, #eef1f6)",background:"linear-gradient(120deg, rgba(8,102,255,.05), rgba(139,92,246,.05))"},children:[e.jsx("div",{style:{fontSize:14.5,fontWeight:900,color:"var(--text, #111)",marginBottom:3},children:"Lo que Lumy entiende de tu código"}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",lineHeight:1.5,marginBottom:10},children:"Tu página la escribes tú; el pedido lo recoge Lumy. Abajo, lo que Lumy leyó de TU código ahora mismo, y después todas las marcas que sabe leer."}),e.jsxs("div",{style:{border:"1px solid var(--border, #e3e7ef)",borderRadius:11,background:"var(--card-bg, #fff)",padding:"11px 13px",marginBottom:12},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,letterSpacing:".07em",textTransform:"uppercase",color:Rs,marginBottom:8},children:"De tu código, ahora mismo"}),F.length===0?e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"TodavÃa no hay nada marcado en tu código."}):e.jsx("div",{style:{display:"grid",gap:7},children:F.map(oe=>e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"baseline",fontSize:12.5,lineHeight:1.45},children:[e.jsx("span",{style:{minWidth:92,flex:"0 0 auto",color:"var(--text-muted)",fontWeight:700},children:oe.que}),e.jsx("span",{style:{color:"var(--text, #111)",fontWeight:600,wordBreak:"break-word"},children:oe.vale})]},oe.que))}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:9,lineHeight:1.45},children:"El nombre de cada dato es con el que llega a tu CRM. No se dibuja en la página: lo que ahà lee el comprador es tu propio texto."})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{value:Q,onChange:oe=>de(oe.target.value),placeholder:"Busca: precio, contador, formulario, carruselâ¦",style:{width:"100%",boxSizing:"border-box",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 30px 8px 11px",fontSize:13,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"}}),!!Q&&e.jsx("button",{onClick:()=>de(""),"aria-label":"Limpiar",style:{position:"absolute",right:6,top:"50%",transform:"translateY(-50%)",background:"none",border:0,color:"var(--text-muted)",fontSize:15,cursor:"pointer",padding:"0 5px",fontFamily:"inherit"},children:"Ã"})]})]}),Be.length===0&&e.jsxs("div",{style:{padding:"18px 16px",fontSize:12.5,color:"var(--text-muted)",lineHeight:1.5},children:["No hay ninguna marca con «",Q,"». Prueba con: formulario, precio, variantes, foto, aparecer, contador, carrusel, fuente."]}),Be.map(oe=>e.jsxs("div",{children:[e.jsx("div",{style:{position:"sticky",top:0,zIndex:1,background:"var(--card-bg, #fff)",borderBottom:"1px solid var(--border, #eef1f6)",padding:"9px 16px",fontSize:11,fontWeight:900,letterSpacing:".06em",color:"var(--text-muted)",textTransform:"uppercase"},children:oe.grupo}),oe.marcas.map(Ae=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 260px) minmax(0, 1fr)",gap:14,alignItems:"start",padding:"11px 16px",borderBottom:"1px solid var(--border, #f3f5f9)"},children:[e.jsx("button",{onClick:()=>La(Ae.codigo,Ae.codigo),title:`Copiar: ${Ae.codigo}`,style:{textAlign:"left",width:"100%",minWidth:0,overflow:"hidden",fontFamily:"ui-monospace, Menlo, monospace",fontSize:11.5,lineHeight:1.45,background:N===Ae.codigo?"rgba(11,122,75,.08)":"#0b1020",border:N===Ae.codigo?"1px solid rgba(11,122,75,.35)":"1px solid rgba(8,102,255,.18)",color:N===Ae.codigo?"var(--success, #0b7a4b)":"#cfe0ff",borderRadius:9,padding:"7px 9px",cursor:"pointer",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:N===Ae.codigo?"¡copiado!":Ae.codigo}),e.jsx("span",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",lineHeight:1.55,minWidth:0,paddingTop:2},children:Ae.que})]},Ae.codigo))]},oe.grupo)),e.jsx("div",{style:{padding:"12px 16px",fontSize:11.5,color:"var(--text-muted)",lineHeight:1.55},children:"¿Prefieres que lo escriba una IA? Toca «Copiar instrucciones para la IA»: se lleva todo esto más los datos de esta página."})]})]})]}),Te&&e.jsx(m2,{srcDoc:n,onCerrar:()=>ie(!1)}),he!==null&&e.jsx(g2,{valor:he,onCambio:Me,onMeter:yt,onCerrar:()=>Me(null)}),pe!==null&&e.jsx(u2,{items:pe,copiado:N,onCopiar:oe=>{La(oe,oe)},onMeter:oe=>{Na(oe),ce(null)},onCerrar:()=>ce(null)}),!!(U!=null&&U.length)&&e.jsx(p2,{medios:U,copiado:N,onCopiar:oe=>{La(oe,oe)},onMeter:oe=>{Na(oe),ne(null)},onCerrar:()=>ne(null)}),e.jsx("style",{children:"@media (max-width: 1080px){ .lk-codigo-2col{ flex-wrap: wrap } .lk-codigo-2col > div:first-child{ flex: 1 1 100% !important; position: static !important } }"})]})}const oc={dropi:"dropi_product_id",mastershop:"mastershop_product_id",envios99:"envios99_product_id"},vg={dropi:"Dropi",mastershop:"Mastershop",envios99:"99envÃos"};function Rk(t){const a=String((t==null?void 0:t.fulfillment_provider)||"").toLowerCase().trim();return a==="dropi"||a==="mastershop"||a==="envios99"?a:null}function Kl(t){const a=Rk(t);if(a)return a;const n=(t==null?void 0:t.product)||{};return String(n.dropi_product_id??"").trim()?"dropi":String(n.mastershop_product_id??"").trim()?"mastershop":String(n.envios99_product_id??"").trim()?"envios99":null}function Nk(t,a=Kl(t)){var n;return a?String(((n=t==null?void 0:t.product)==null?void 0:n[oc[a]])??"").trim():""}function jg(t,a){return t==="dropi"||String(a||"").toUpperCase()==="CO"}function Lk(t,a){if(!(t!=null&&t.push_to_dropi)||t!=null&&t.send_to_lucidbot)return null;const n=Kl(t);if(!n)return"Elige a qué logÃstica deben subir los pedidos.";if(!jg(n,a))return`${vg[n]} solo está habilitada para pedidos de Colombia. Cambia el paÃs o elige Dropi.`;const o=Nk(t,n);return!/^\d+$/.test(o)||Number(o)<=0?`Falta el ID del producto en ${vg[n]}; sin él los pedidos no pueden subir automáticamente.`:null}const co=t=>String(t??"").trim(),Pk=/cobro en l[iÃ]nea|pago en l[iÃ]nea|monto es muy bajo|createcharge|pasarela/i,Dk=/intento de pago|cobro incierto|cobro en l[iÃ]nea|pago en l[iÃ]nea|monto es muy bajo|createcharge|pasarela/i;function Bk(t){return co(t.paid_at)?!1:!!t.payment_attempt_failed||t.crm_status==="pago_fallido"||t.status==="failed"&&Pk.test(co(t.error))}
668function jp(t){if(!t||!co(t.error)||co(t.dropi_order_id)||co(t.mastershop_order_id)||co(t.envios99_order_id)||t.status==="pushing"||co(t.paid_at)&&(t.status!=="paid_only"&&t.status!=="failed"||co(t.payment_failed_at)&&Dk.test(co(t.error))))return null;if(t.collection_state==="manual_review")return{tipo:"pago",titulo:"Pago por conciliar"};if(!co(t.paid_at)&&/cobro incierto/i.test(co(t.error)))return{tipo:"pago",titulo:"No se pudo cobrar en lÃnea"};const a=t.fields&&typeof t.fields=="object"?t.fields:null;return a&&Number(a._dropi_dudoso)===1?{tipo:"despacho",titulo:"Puede que ya esté en Dropi"}:Bk(t)?{tipo:"pago",titulo:"No se pudo cobrar en lÃnea"}:{tipo:"despacho",titulo:"No se subió a la logÃstica"}}function Wk(t){return/escribi[oó] la suya a mano|ciudad ya qued[oó] corregida/i.test(String(t??""))}function qk(t){return/falta el nombre de quien recibe|nombre de quien recibe ya qued[oó] escrito/i.test(String(t??""))}function Ap(t){return Wk(t)||qk(t)}const Mk=["cancelado","rechazado","devuelto","entregado"];function Fk(t){return!t||co(t.dropi_order_id)||co(t.mastershop_order_id)||co(t.envios99_order_id)||t.collection_state==="manual_review"||Mk.includes(co(t.crm_status))||Number(t.en_logistica_propia)===1||t.en_logistica_propia===!0?!1:t.status==="failed"?!0:t.status==="paid_only"&&!!co(t.error)}const S2="Autorizo que me contacten por llamada telefónica, incluida una llamada automatizada y grabada, para confirmar y gestionar este pedido.",w2="Autorizo que esta tienda me envÃe novedades y promociones por WhatsApp. Puedo pedir que dejen de escribirme en cualquier momento respondiendo al mensaje.",Ok="Autorizo que este negocio me envÃe novedades y promociones por WhatsApp. Puedo pedir que dejen de escribirme en cualquier momento respondiendo al mensaje.",Gb=["datos","voz","mkt"],Hk={datos:"Mis datos son correctos",voz:"Autorizo la llamada",mkt:"Autorizo promociones por WhatsApp"},Gk={datos:160,voz:300,mkt:300};function k2(t,a=!1){return`Acepto que mis datos son correctos${t||a?".":" y pagaré al recibir mi pedido."}`}const Vk="Autorizo que me contacten por llamada telefónica, incluida una llamada automatizada y grabada, para confirmar y gestionar mi solicitud o mi cita.";function C2(t){const a=String(t||"").toLowerCase(),n=[];return/llam/.test(a)||n.push("que es por llamada"),/automatizad/.test(a)||n.push("que puede ser automatizada"),/grabad/.test(a)||n.push("que puede ser grabada"),n}function _2(t){const a=String(t||"").toLowerCase(),n=[];return/tienda|marca|nosotros|nuestr|negocio|cl[iÃ]nica|consultorio|empresa|equipo/.test(a)||n.push("quién te va a escribir"),/whatsapp/.test(a)||n.push("que es por WhatsApp"),/novedad|promoci|oferta/.test(a)||n.push("para qué (novedades o promociones)"),/dej(en|ar) de|cualquier momento|darme de baja|cancelar/.test(a)||n.push("cómo dejar de recibirlos"),n}const Uk=(t,a)=>String(t??"").replace(/[\u0000-\u001f\u007f]+/g," ").replace(/\s+/g," ").trim().slice(0,a);function Vb(t,a){const n=t&&typeof t=="object"?t:{},o=n.confirm_check===!0,i=Array.isArray(n.consents)?n.consents:[],s=[];for(const u of i)u&&Gb.includes(u.key)&&!s.some(m=>m.key===u.key)&&s.push(u);for(const u of Gb)s.some(m=>m.key===u)||s.push(u==="datos"?{key:u,text:n.confirm_text}:{key:u});return s.map(u=>{const m=u.key,c=n.confirm_check===!1?!1:Array.isArray(n.consents)&&i.some(j=>j&&j.key===m)?u.on!==!1:o,g=Uk(u.text,Gk[m]);if(m==="datos")return{key:m,on:c,texto:g||k2(a.pagoEnLinea,!!a.servicio),obligatoria:!0,propio:!!g};const f=m==="voz"?a.servicio?Vk:S2:a.servicio?Ok:w2,b=m==="voz"?C2(g):_2(g),v=!!g&&b.length===0;return{key:m,on:c,texto:v?g:f,obligatoria:!1,propio:v}})}const Tu=t=>String(t||"").trim().toLowerCase().replace(/\s+/g," "),Ub=t=>/^\d{5,}$/.test(String(t||"").trim()),Qk=t=>{const a=Tu(t);return/tiktok|^tt$/.test(a)?"tiktok":!a||/facebook|instagram|meta|^fb$|^ig$|paid/.test(a)?"meta":"otro"},Zd=()=>({orders:0,revenue:0,delivered:0}),Xd=(t,a)=>{t.orders+=a.orders,t.revenue+=a.revenue,t.delivered+=a.delivered;const n=hv(t.moneda,a.moneda);n!==void 0&&(t.moneda=n)},Ag=(t,a)=>`${t} â¦${a.slice(-6)}`;function $2(t,a){const n=new Map,o=s=>(s==="tiktok"?a==null?void 0:a.tiktok:a==null?void 0:a.meta)||null,i=(s,u)=>{if(!s||!u)return"";const m=Tu(u);for(const[c,g]of Object.entries(s.campaigns))if(Tu(g.name)===m)return c;return""};for(const s of Array.isArray(t)?t:[]){if(!s)continue;const u=Qk(s.source),m=o(u),c=String(s.campaign||"").trim(),g=String(s.ad_id||"").trim(),f=String(s.adset_id||"").trim(),b=g&&m?m.ads[g]:void 0,v=f&&m?m.adsets[f]:void 0,j=String(s.campaign_id||"").trim()||(Ub(c)?c:"")||(b==null?void 0:b.campaign_id)||(v==null?void 0:v.campaign_id)||i(m,c),S=`${u}|${j||Tu(c)||"sin"}`;let $=n.get(S);$||($={key:S,plataforma:u,id:j,nombre:"",nombreReal:!1,gasto:null,compras:null,conjuntos:[],sueltos:[],sinConjunto:null,...Zd()},n.set(S,$)),!$.id&&j&&($.id=j),!$.nombre&&c&&!Ub(c)&&($.nombre=c);const C={orders:Number(s.orders)||0,revenue:Number(s.revenue)||0,delivered:Number(s.delivered)||0,...s.currency!==void 0?{moneda:s.currency}:{}};Xd($,C);const _=f||(b==null?void 0:b.adset_id)||"";let N=null;if(_&&(N=$.conjuntos.find(w=>
668w.id===_)||null,N||(N={id:_,nombre:"",nombreReal:!1,gasto:null,compras:null,anuncios:[],sinAnuncio:null,...Zd()},$.conjuntos.push(N)),Xd(N,C)),g){const w=N?N.anuncios:$.sueltos;let M=w.find(p=>p.id===g);M||(M={id:g,nombre:"",nombreReal:!1,gasto:null,compras:null,...Zd()},w.push(M)),Xd(M,C)}}for(const s of n.values()){const u=o(s.plataforma),m=s.id&&u?u.campaigns[s.id]:void 0;m!=null&&m.name&&(s.nombre=m.name,s.nombreReal=!0),m&&(s.gasto=m.spend,s.compras=m.purchases,s.estado=m.status),s.nombre||(s.nombre=s.id?Ag("Campaña",s.id):"Sin nombre de campaña");for(const g of s.conjuntos){const f=u?u.adsets[g.id]:void 0;f!=null&&f.name&&(g.nombre=f.name,g.nombreReal=!0),f&&(g.gasto=f.spend,g.compras=f.purchases,g.estado=f.status),g.nombre||(g.nombre=Ag("Conjunto",g.id));for(const v of g.anuncios)Qb(v,u);const b=g.anuncios.reduce((v,j)=>(Xd(v,j),v),Zd());g.anuncios.length&&g.orders>b.orders&&(g.sinAnuncio={orders:g.orders-b.orders,revenue:g.revenue-b.revenue,delivered:Math.max(0,g.delivered-b.delivered),...g.moneda!==void 0?{moneda:g.moneda}:{}}),g.anuncios.sort(du)}for(const g of s.sueltos)Qb(g,u);const c=[...s.conjuntos,...s.sueltos].reduce((g,f)=>(Xd(g,f),g),Zd());(s.conjuntos.length||s.sueltos.length)&&s.orders>c.orders&&(s.sinConjunto={orders:s.orders-c.orders,revenue:s.revenue-c.revenue,delivered:Math.max(0,s.delivered-c.delivered),...s.moneda!==void 0?{moneda:s.moneda}:{}}),s.conjuntos.sort(du),s.sueltos.sort(du)}return[...n.values()].sort(du)}function Qb(t,a){const n=a?a.ads[t.id]:void 0;n!=null&&n.name&&(t.nombre=n.name,t.nombreReal=!0),n&&(t.gasto=n.spend,t.compras=n.purchases,t.estado=n.status),t.nombre||(t.nombre=Ag("Anuncio",t.id))}const du=(t,a)=>a.orders-t.orders||a.revenue-t.revenue;function I2(t){const a={orders:0,revenue:0,moneda:void 0,gasto:null,compras:null,cruzadas:0};for(const n of t)a.orders+=n.orders,a.revenue+=n.revenue,a.moneda=hv(a.moneda,n.moneda),n.gasto!=null&&(a.gasto=(a.gasto||0)+n.gasto,a.cruzadas++),n.compras!=null&&(a.compras=(a.compras||0)+n.compras);return a}function Kb(t,a){return t.reduce((n,o)=>o.plataforma!==a?n:{hay:!0,gasto:o.gasto!=null?(n.gasto||0)+o.gasto:n.gasto,orders:n.orders+o.orders},{hay:!1,gasto:null,orders:0})}function Yb(t,a,n){const o=t.filter(s=>s.plataforma===n);if(!o.length)return!1;const i=n==="meta"?a==null?void 0:a.meta:a==null?void 0:a.tiktok;return!i||!i.conectado?!0:o.some(s=>!s.id||s.gasto==null||s.conjuntos.length===0&&s.sueltos.length===0)}const Ao="#2563EB",Jb=["#0866FF","#16a34a","#f59e0b","#7c3aed","#dc2626","#0ea5e9","#db2777","#65a30d","#ea580c","#0d9488","#4f46e5","#ca8a04"],Kk=t=>{const{cx:a,cy:n,index:o}=t;return a==null||n==null?e.jsx("g",{}):e.jsx("circle",{cx:a,cy:n,r:3.6,fill:Jb[o%Jb.length],stroke:"var(--card-bg, #fff)",strokeWidth:1.5})},rc=[{k:"visits",label:"Sesiones",fmt:t=>Number(t||0).toLocaleString("es-CO")},{k:"orders",label:"Pedidos",fmt:t=>Number(t||0).toLocaleString("es-CO")},{k:"revenue",label:"Ventas",fmt:t=>"$"+Math.round(Number(t||0)).toLocaleString("es-CO")}],Zb=(t,a,n)=>t.k==="revenue"&&a?{...t,fmt:o=>Sn(o,a,!!n)}:t,Sg={background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"16px 18px 14px",marginBottom:16,boxShadow:"0 1px 2px rgba(15,23,42,.04), 0 10px 24px -16px rgba(15,23,42,.10)"},wg={fontSize:10.5,fontWeight:700,letterSpacing:".08em",textTransform:"uppercase",color:"var(--text-muted, #8a90a2)"},Xb={fontSize:26,fontWeight:800,color:"var(--text, #171717)",fontVariantNumeric:"tabular-nums",letterSpacing:"-.02em",lineHeight:1.1},ey=(t,a=!1)=>{const n=Number(t)||0,o=n>=1e6?Math.round(n/1e5)/10+"M":n>=1e3?Math.round(n/1e3)+"k":String(Math.round(n));return a?"$"+o:o},ty=t=>{const a=String(t).split("-");if(a.length!==3)return t;const n=new Date(Number(a[0]),Number(a[1])-1,Number(a[2]));return isNaN(+n)?t:n.toLocaleDateString("es-CO",{weekday:"short",day:"numeric",month:"short"}).replace(/\./g,"")},ay=t=>{const a=String(t).split("-");return a.length===3?a[2]+"/"+a[1]:t};function Yk(t,a){if(!t||!a||!/^\d{4}-\d{2}-\d{2}$/.test(t)||!/^\d{4}-\d{2}-\d{2}$/.test(a))return null;const n=new Date(t+"T00:00:00Z"),o=new Date(a+"T00:00:00Z");if(isNaN(+n)||isNaN(+o)||+o<+n)return null;const i=Math.round((+o-+n)/864e5)+1;if(i<2||i>62)return null;const s=u=>new Date(u).toISOString().slice(0,10);return{from:s(+n-i*864e5),to:s(+n-864e5)}}function Eu({pct:t}){const a=t>0,n=t<0,o=a?"var(--success)":n?"var(--danger)":"var(--text-muted)",i=a?"var(--notice-success-bg)":n?"var(--notice-danger-bg)":"var(--bg-secondary)";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:11,fontWeight:800,color:o,background:i,borderRadius:999,padding:"2.5px 8px",fontVariantNumeric:"tabular-nums",flex:"none"},children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"9",height:"9",fill:"
668currentColor","aria-hidden":"true",children:e.jsx("path",{d:a?"M12 5l8 11H4z":n?"M12 19l-8-11h16z":"M5 11h14v2H5z"})}),Math.abs(t),"%"]})}function ny({metric:t,setMetric:a}){return e.jsx("div",{className:"lk-scroll-x",style:{display:"flex",gap:3,marginLeft:"auto",background:"var(--bg-soft, #f1f4f9)",borderRadius:9,padding:3,flex:"none"},children:rc.map(n=>e.jsx("button",{onClick:()=>a(n.k),style:{border:0,borderRadius:7,padding:"5px 11px",fontSize:12,fontWeight:700,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap",background:t===n.k?"var(--card-bg, #fff)":"transparent",color:t===n.k?Ao:"var(--text-muted, #8a90a2)",boxShadow:t===n.k?"0 1px 3px rgba(15,23,42,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:n.label},n.k))})}function oy({monedas:t,moneda:a,setMoneda:n}){return e.jsx("div",{role:"group","aria-label":"Moneda de la gráfica",style:{display:"flex",gap:3,background:"var(--bg-soft, #f1f4f9)",borderRadius:9,padding:3,flex:"none"},children:t.map(o=>e.jsx("button",{type:"button",onClick:()=>n(o),"aria-pressed":a===o,style:{border:0,borderRadius:7,padding:"5px 10px",fontSize:12,fontWeight:700,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap",background:a===o?"var(--card-bg, #fff)":"transparent",color:a===o?Ao:"var(--text-muted, #8a90a2)",boxShadow:a===o?"0 1px 3px rgba(15,23,42,.10)":"none"},children:o},o))})}function T2({title:t,children:a}){return e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"9px 12px",boxShadow:"0 6px 20px -6px rgba(15,23,42,.22)",fontSize:12,fontVariantNumeric:"tabular-nums",minWidth:128},children:[e.jsx("div",{style:{...wg,fontSize:10,marginBottom:6},children:t}),a]})}function Jk({active:t,payload:a,label:n,fmt:o}){var m,c;if(!t||!a||!a.length)return null;const i=(m=a.find(g=>g.dataKey==="hoy"))==null?void 0:m.value,s=(c=a.find(g=>g.dataKey==="ayer"))==null?void 0:c.value,u=Number(s)>0&&i!=null?Math.round((Number(i)-Number(s))/Number(s)*100):null;return e.jsxs(T2,{title:String(n).padStart(2,"0")+":00",children:[i!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Ao,flex:"none"}}),e.jsxs("span",{style:{color:"var(--text, #171717)"},children:["Hoy: ",e.jsx("b",{style:{fontWeight:800},children:o(i)})]}),u!=null&&e.jsx(Eu,{pct:u})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text-muted, #9ca3af)",marginTop:4},children:[e.jsx("span",{style:{width:9,height:0,borderTop:"2px dashed rgba(37,99,235,.45)",flex:"none"}}),e.jsxs("span",{children:["Ayer: ",o(s)]})]})]})}function Rl({label:t,value:a,accent:n}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"baseline",gap:7,background:n?"rgba(37,99,235,.07)":"var(--bg-soft, #f4f6fa)",border:"1px solid "+(n?"rgba(37,99,235,.20)":"var(--border, #e8eaf0)"),borderRadius:9,padding:"6px 11px",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text-muted, #8a90a2)"},children:t}),e.jsx("b",{style:{fontSize:12.5,fontWeight:800,color:n?Ao:"var(--text, #171717)",fontVariantNumeric:"tabular-nums"},children:a})]})}function ry({solid:t,dashed:a}){return e.jsxs("div",{style:{display:"flex",gap:16,justifyContent:"center",marginTop:10},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11.5,fontWeight:600,color:"var(--text-muted, #8a90a2)"},children:[e.jsx("span",{style:{width:14,height:2.5,background:Ao,borderRadius:2}})," ",t]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11.5,fontWeight:600,color:"var(--text-muted, #8a90a2)"},children:[e.jsx("span",{style:{width:14,height:0,borderTop:"2.5px dashed rgba(37,99,235,.45)"}})," ",a]})]})}function iy(){return e.jsxs("div",{style:Sg,"aria-hidden":"true",children:[e.jsx("style",{children:"@keyframes lhSkel { 0%,100% { opacity: .45 } 50% { opacity: .95 } } .lh-skel { background: var(--input-bg, #eef1f6); animation: lhSkel 1.5s ease-in-out infinite; } @media (prefers-reduced-motion: reduce) { .lh-skel { animation: none !important } }"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10},children:[e.jsx("span",{className:"lh-skel",style:{width:148,height:10,borderRadius:5}}),e.jsx("span",{className:"lh-skel",style:{width:186,height:28,borderRadius:9}})]}),e.jsx("span",{className:"lh-skel",style:{display:"block",width:128,height:24,borderRadius:7,marginTop:12}}),e.jsx("div",{className:"lh-skel",style:{height:224,borderRadius:10,marginTop:14,o
668pacity:.55}})]})}const sy={stroke:"var(--border, #eef0f4)",strokeDasharray:"3 3",vertical:!1},cu={fontSize:10.5,fill:"var(--text-muted, #a6adbb)"},Zk={r:5,strokeWidth:2,stroke:"var(--card-bg, #fff)"};function Xk({range:t,from:a,to:n,pais:o,landing:i,conCodigo:s}={}){var ve,ge,Te;const u=$a(),[m,c]=h.useState(null),[g,f]=h.useState(null),[b,v]=h.useState(null),[j,S]=h.useState("visits"),[$,C]=h.useState(null),_=!!t&&t!=="today";if(h.useEffect(()=>{let ie=!0;if(_){f(null),v(null);const fe=[o?`pais=${encodeURIComponent(o)}`:"",i?`landing=${i}`:""].filter(Boolean).join("&"),Be=a&&n?`?from=${a}&to=${n}${fe?"&"+fe:""}`:fe?`?${fe}`:"";u("/api/landing/daily-traffic"+Be).then(ze=>ze.json()).then(ze=>{ie&&(ze!=null&&ze.ok)&&f(ze)}).catch(()=>{});const We=Yk(a,n);We&&u(`/api/landing/daily-traffic?from=${We.from}&to=${We.to}${fe?"&"+fe:""}`).then(ze=>ze.json()).then(ze=>{ie&&(ze!=null&&ze.ok)&&v(ze)}).catch(()=>{})}else{const fe=[o?`pais=${encodeURIComponent(o)}`:"",i?`landing=${i}`:""].filter(Boolean).join("&");u("/api/landing/hourly-traffic"+(fe?`?${fe}`:"")).then(Be=>Be.json()).then(Be=>{ie&&(Be!=null&&Be.ok)&&c(Be)}).catch(()=>{})}return()=>{ie=!1}},[u,_,a,n,o,i]),_){if(!g)return e.jsx(iy,{});const ie=s&&j==="revenue"&&g.currency?[...new Set([String(g.currency),...Object.keys(g.revenue_por_moneda||{})])]:[],fe=ie.length>1&&ie.includes(String($))?String($):g.currency,Be=Zb(rc.find(we=>we.k===j)||rc[0],fe,s),We=we=>{var Ye,lt;return we?j==="revenue"&&fe!==we.currency?((Ye=we.revenue_por_moneda)==null?void 0:Ye[fe])||(Array.isArray(we.days)?we.days.map(()=>0):null):Array.isArray((lt=we.metrics)==null?void 0:lt[j])?we.metrics[j]:null:null},ze=We(g)||[],tt=We(b),Fe=(b==null?void 0:b.days)||[],F=(g.days||[]).map((we,Ye)=>({day:we,val:Number(ze[Ye])||0,prev:tt?Number(tt[Ye])||0:void 0,prevDay:Fe[Ye]})),Re=F.length,K=!!tt&&Re>=2,I=F.reduce((we,Ye)=>we+Ye.val,0),H=K?tt.reduce((we,Ye)=>we+(Number(Ye)||0),0):0,ye=K&&H>0?Math.round((I-H)/H*100):null,De=F.reduce((we,Ye)=>Ye.val>((we==null?void 0:we.val)??-1)?Ye:we,null),Ue=Math.max(1,Math.ceil(Re/8)),se=we=>{var jt,Je;if(!we.active||!((jt=we.payload)!=null&&jt.length))return null;const Ye=(Je=we.payload[0])==null?void 0:Je.payload;if(!Ye)return null;const lt=Ye.prev!=null&&Number(Ye.prev)>0?Math.round((Ye.val-Ye.prev)/Ye.prev*100):null;return e.jsxs(T2,{title:ty(Ye.day),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Ao,flex:"none"}}),e.jsxs("span",{style:{color:"var(--text, #171717)"},children:[Be.label,": ",e.jsx("b",{style:{fontWeight:800},children:Be.fmt(Ye.val)})]}),lt!=null&&e.jsx(Eu,{pct:lt})]}),Ye.prev!=null&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text-muted, #9ca3af)",marginTop:4},children:[e.jsx("span",{style:{width:9,height:0,borderTop:"2px dashed rgba(37,99,235,.45)",flex:"none"}}),e.jsxs("span",{children:[Ye.prevDay?ty(Ye.prevDay):"Periodo anterior",": ",Be.fmt(Ye.prev)]})]})]})};return e.jsxs("div",{style:Sg,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:8},children:[e.jsxs("span",{style:wg,children:[Be.label," por dÃa · ",Re," ",Re===1?"dÃa":"dÃas"]}),e.jsx(ny,{metric:j,setMetric:S}),ie.length>1&&e.jsx(oy,{monedas:ie,moneda:fe,setMoneda:C})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:Xb,children:Be.fmt(I)}),ye!=null&&e.jsx(Eu,{pct:ye}),e.jsx("span",{style:{fontSize:11.5,fontWeight:600,color:"var(--text-muted, #9ca3af)"},children:K?`vs los ${Re} dÃas anteriores`:"en el rango"})]}),e.jsx("div",{style:{width:"100%",height:240},children:e.jsx(S1,{width:"100%",height:"100%",children:e.jsxs(w1,{data:F,margin:{top:6,right:8,left:-16,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"lhGradDaily",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Ao,stopOpacity:.18}),e.jsx("stop",{offset:"100%",stopColor:Ao,stopOpacity:0})]})}),e.jsx(k1,{...sy}
668),e.jsx(C1,{dataKey:"day",tickFormatter:ay,tick:cu,axisLine:!1,tickLine:!1,interval:Math.max(0,Ue-1)}),e.jsx(_1,{tick:cu,axisLine:!1,tickLine:!1,width:j==="revenue"?56:42,tickFormatter:we=>ey(we,j==="revenue")}),e.jsx($1,{content:se,cursor:{stroke:"var(--border, #dbe0e8)",strokeDasharray:"3 3"}}),Re<=1?e.jsx(Vj,{dataKey:"val",fill:Ao,radius:[6,6,0,0],maxBarSize:72,isAnimationActive:!1}):e.jsxs(e.Fragment,{children:[K&&e.jsx(I1,{type:"monotone",dataKey:"prev",stroke:Ao,strokeOpacity:.4,strokeWidth:1.6,strokeDasharray:"4 4",dot:!1,isAnimationActive:!1}),e.jsx(T1,{type:"monotone",dataKey:"val",stroke:Ao,strokeWidth:2.2,fill:"url(#lhGradDaily)",isAnimationActive:!1,activeDot:Zk,dot:Re<=45?Kk:!1})]})]})})}),De&&De.val>0||K?e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:12},children:[De&&De.val>0&&e.jsx(Rl,{label:"DÃa pico",value:ay(De.day)+" · "+Be.fmt(De.val),accent:!0}),De&&De.val>0&&e.jsx(Rl,{label:"Promedio/dÃa",value:Be.fmt(Math.round(I/Math.max(1,Re)))}),K&&e.jsx(Rl,{label:"Periodo anterior",value:Be.fmt(H)})]}):null,K&&e.jsx(ry,{solid:"Este periodo",dashed:"Periodo anterior"})]})}if(!m)return e.jsx(iy,{});const N=s&&j==="revenue"&&m.currency?[...new Set([String(m.currency),...Object.keys(m.revenue_por_moneda||{})])]:[],w=N.length>1&&N.includes(String($))?String($):m.currency,M=Zb(rc.find(ie=>ie.k===j)||rc[0],w,s),p=j==="revenue"&&w!==m.currency?((ve=m.revenue_por_moneda)==null?void 0:ve[w])||{today:[],yesterday:[]}:((ge=m.metrics)==null?void 0:ge[j])||{today:[],yesterday:[]},V=Number.isFinite(Number(m.nowHour))?Number(m.nowHour):23,L=Array.from({length:24},(ie,fe)=>{var Be,We;return{hour:fe,hoy:fe<=V?Number((Be=p.today)==null?void 0:Be[fe])||0:null,ayer:Number((We=p.yesterday)==null?void 0:We[fe])||0}}),x=ie=>(ie||[]).reduce((fe,Be)=>fe+(Number(Be)||0),0),z=x(p.today),G=x(p.yesterday),U=((ie,fe)=>(ie||[]).slice(0,fe+1).reduce((Be,We)=>Be+(Number(We)||0),0))(p.yesterday,V),ne=U>0?Math.round((z-U)/U*100):null,Q=U>0&&V<23?Math.round(z*(G/U)):null;let de=-1,pe=-1;for(let ie=0;ie<=V;ie++){const fe=Number((Te=p.today)==null?void 0:Te[ie])||0;fe>pe&&(pe=fe,de=ie)}const ce=z>0||G>0;return e.jsxs("div",{style:Sg,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:8},children:[e.jsxs("span",{style:wg,children:[M.label," · hoy vs ayer"]}),e.jsx(ny,{metric:j,setMetric:S}),N.length>1&&e.jsx(oy,{monedas:N,moneda:w,setMoneda:C})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:Xb,children:M.fmt(z)}),ne!=null&&e.jsx(Eu,{pct:ne}),e.jsx("span",{style:{fontSize:11.5,fontWeight:600,color:"var(--text-muted, #9ca3af)"},children:"vs ayer a esta hora"})]}),e.jsx("div",{style:{width:"100%",height:240},children:e.jsx(S1,{width:"100%",height:"100%",children:e.jsxs(w1,{data:L,margin:{top:6,right:8,left:-16,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"lhGradHoy",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Ao,stopOpacity:.18}),e.jsx("stop",{offset:"100%",stopColor:Ao,stopOpacity:0})]})}),e.jsx(k1,{...sy}),e.jsx(C1,{dataKey:"hour",ticks:[0,3,6,9,12,15,18,21],tickFormatter:ie=>String(ie).padStart(2,"0"),tick:cu,axisLine:!1,tickLine:!1}),e.jsx(_1,{tick:cu,axisLine:!1,tickLine:!1,width:j==="revenue"?56:42,tickFormatter:ie=>ey(ie,j==="revenue")}),e.jsx($1,{content:ie=>e.jsx(Jk,{...ie,fmt:M.fmt}),cursor:{stroke:"var(--border, #dbe0e8)",strokeDasharray:"3 3"}}),e.jsx(I1,{type:"monotone",dataKey:"ayer",stroke:Ao,strokeOpacity:.4,strokeWidth:1.6,strokeDasharray:"4 4",dot:!1,isAnimationActive:!1,connectNulls:!0}),e.jsx(T1,{type:"monotone",dataKey:"hoy",stroke:Ao,strokeWidth:2.2,fill:"url(#lhGradHoy)",dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4.5,strokeWidth:2,stroke:"var(--card-bg, #fff)"}})]})})}),ce&&e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:12},children:[U>0&&e.jsx(Rl,{label:"A esta hora ayer",value:M.fmt(U)}),Q!=null&&e.jsx(Rl,{label:"Proyección de hoy",value:"~"+M.fmt(Q),accent:!0}),de>=0&&pe>0&&e.jsx(Rl,{label:"Hora pico hoy",value:String(de).padStart(2,"0")+":00"})]}),e.jsx(ry,{solid:"Hoy",dashed:"Ayer"})]})}/** 669 * table-core 670 * 671 * Copyright (c) TanStack 672 * 673 * This source code is licensed under the MIT license found in the 674 * LICENSE.md file in the root directory of this source tree. 675 * 676 * @license MIT 677 */function ds(t,a){return typeof t=="function"?t(a):t}function Jo(t,a){return n=>{a.setState(o=>({...o,[t]:ds(n,o[t])}))}}function tp(t){return t instanceof Function}function e4(t){return Array.isArray(t)&&t.every(a=>typeof a=="number")}function t4(t,a){const n=[],o=i=>
vendor: 45,832 bytes, lines 677-680
677{i.forEach(s=>{n.push(s);const u=a(s);u!=null&&u.length&&o(u)})};return o(t),n}function aa(t,a,n){let o=[],i;return s=>{let u;n.key&&n.debug&&(u=Date.now());const m=t(s);if(!(m.length!==o.length||m.some((f,b)=>o[b]!==f)))return i;o=m;let g;if(n.key&&n.debug&&(g=Date.now()),i=a(...m),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const f=Math.round((Date.now()-u)*100)/100,b=Math.round((Date.now()-g)*100)/100,v=b/16,j=(S,$)=>{for(S=String(S);S.length<$;)S=" "+S;return S};console.info(`%câ± ${j(b,5)} /${j(f,5)} ms`,` 678 font-size: .6rem; 679 font-weight: bold; 680 color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n==null?void 0:n.key)}return i}}function na(t,a,n,o){return{debug:()=>{var i;return(i=t==null?void 0:t.debugAll)!=null?i:t[a]},key:!1,onChange:o}}function a4(t,a,n,o){const i=()=>{var u;return(u=s.getValue())!=null?u:t.options.renderFallbackValue},s={id:`${a.id}_${n.id}`,row:a,column:n,getValue:()=>a.getValue(o),renderValue:i,getContext:aa(()=>[t,n,a,s],(u,m,c,g)=>({table:u,column:m,row:c,cell:g,getValue:g.getValue,renderValue:g.renderValue}),na(t.options,"debugCells"))};return t._features.forEach(u=>{u.createCell==null||u.createCell(s,n,a,t)},{}),s}function n4(t,a,n,o){var i,s;const m={...t._getDefaultColumnDef(),...a},c=m.accessorKey;let g=(i=(s=m.id)!=null?s:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?i:typeof m.header=="string"?m.header:void 0,f;if(m.accessorFn?f=m.accessorFn:c&&(c.includes(".")?f=v=>{let j=v;for(const $ of c.split(".")){var S;j=(S=j)==null?void 0:S[$]}return j}:f=v=>v[m.accessorKey]),!g)throw new Error;let b={id:`${String(g)}`,accessorFn:f,parent:o,depth:n,columnDef:m,columns:[],getFlatColumns:aa(()=>[!0],()=>{var v;return[b,...(v=b.columns)==null?void 0:v.flatMap(j=>j.getFlatColumns())]},na(t.options,"debugColumns")),getLeafColumns:aa(()=>[t._getOrderColumnsFn()],v=>{var j;if((j=b.columns)!=null&&j.length){let S=b.columns.flatMap($=>$.getLeafColumns());return v(S)}return[b]},na(t.options,"debugColumns"))};for(const v of t._features)v.createColumn==null||v.createColumn(b,t);return b}const lo="debugHeaders";function ly(t,a,n){var o;let s={id:(o=n.id)!=null?o:a.id,column:a,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],m=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(m),u.push(c)};return m(s),u},getContext:()=>({table:t,header:s,column:a})};return t._features.forEach(u=>{u.createHeader==null||u.createHeader(s,t)}),s}const o4={createTable:t=>{t.getHeaderGroups=aa(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,n,o,i)=>{var s,u;const m=(s=o==null?void 0:o.map(b=>n.find(v=>v.id===b)).filter(Boolean))!=null?s:[],c=(u=i==null?void 0:i.map(b=>n.find(v=>v.id===b)).filter(Boolean))!=null?u:[],g=n.filter(b=>!(o!=null&&o.includes(b.id))&&!(i!=null&&i.includes(b.id)));return uu(a,[...m,...g,...c],t)},na(t.options,lo)),t.getCenterHeaderGroups=aa(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,n,o,i)=>(n=n.filter(s=>!(o!=null&&o.includes(s.id))&&!(i!=null&&i.includes(s.id))),uu(a,n,t,"center")),na(t.options,lo)),t.getLeftHeaderGroups=aa(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(a,n,o)=>{var i;const s=(i=o==null?void 0:o.map(u=>n.find(m=>m.id===u)).filter(Boolean))!=null?i:[];return uu(a,s,t,"left")},na(t.options,lo)),t.getRightHeaderGroups=aa(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(a,n,o)=>{var i;const s=(i=o==null?void 0:o.map(u=>n.find(m=>m.id===u)).filter(Boolean))!=null?i:[];return uu(a,s,t,"right")},na(t.options,lo)),t.getFooterGroups=aa(()=>[t.getHeaderGroups()],a=>[...a].reverse(),na(t.options,lo)),t.getLeftFooterGroups=aa(()=>[t.getLeftHeaderGroups()],a=>[...a].reverse(),na(t.options,lo)),t.getCenterFooterGroups=aa(()=>[t.getCenterHeaderGroups()],a=>[...a].reverse(),na(t.options,lo)),t.getRightFooterGroups=aa(()=>[t.getRightHeaderGroups()],a=>[...a].reverse(),na(t.options,lo)),t.getFlatHeaders=aa(()=>[t.getHeaderGroups()],a=>a.map(n=>n.headers).flat(),na(t.options,lo)),t.getLeftFlatHeaders=aa(()=>[t.getLeftHeaderGroups()],a=>a.map(n=>n.headers).flat(),na(t.options,lo)),t.getCenterFlatHeaders=aa(()=>[t.getCenterHeaderGroups()],a=>a.map(n=>n.headers).flat(),na(t.options,lo)),t.getRightFlatHeaders=aa(()=>[t.getRightHeaderGroups()],a=>a.map(n=>n.headers).flat(),na(t.options,lo)),t.getCenterLeafHeaders=aa(()=>[t.getCenterFlatHeaders()],a=>a.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),na(t.options,lo)),t.getLeftLeafHeaders=aa(()=>[t.getLeftFlatHeaders()],a=>a.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),na(t.options,lo)),t.getRightLeafHeaders=aa(()=>[t.getRightFlatHeaders()],a=>a.filter(n=>{var o;return!((o=n.subHeaders)!=null&&o.length)}),na(t.options,lo)),t.getLeafHeaders=aa(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(a,n,o)=>{var i,s,u,m,c,g;return[...(i=(s=a[0])==null?void 0:s.headers)!=null?i:[],...(u=(m=n[0])==null?void 0:m.headers)!=null?u:[],...(c=(g=o[0])==null?void 0:g.headers)!=null?c:[]].map(f=>f.getLeafHeaders()).flat()},na(t.options,lo))}};function uu(t,a,n,o){var i,s;let u=0;const m=function(v,j){j===void 0&&(j=1),u=Math.max(u,j),v.filter(S=>S.getIsVisible()).forEach(S=>{var $;($=S.columns)!=null&&$.length&&m(S.columns,j+1)},0)};m(t);let c=[];const g=(v,j)=>{const S={depth:j,id:[o,`${j}`].filter(Boolean).join("_"),headers:[]},$=[];v.forEach(C=>{const _=[...$].reverse()[0],N=C.column.depth===S.depth;let w,M=!1;if(N&&C.column.parent?w=C.column.parent:(w=C.column,M=!0),_&&(_==null?void 0:_.column)===w)_.subHeaders.push(C);else{const p=ly(n,w,{id:[o,j,w.id,C==null?void 0:C.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${$.filter(V=>V.column===w).length}`:void 0,depth:j,index:$.length});p.subHeaders.push(C),$.push(p)}S.headers.push(C),C.headerGroup=S}),c.push(S),j>0&&g($,j-1)},f=a.map((v,j)=>ly(n,v,{depth:u,index:j}));g(f,u-1),c.reverse();const b=v=>v.filter(S=>S.column.getIsVisible()).map(S=>{let $=0,C=0,_=[0];S.subHeaders&&S.subHeaders.length?(_=[],b(S.subHeaders).forEach(w=>{let{colSpan:M,rowSpan:p}=w;$+=M,_.push(p)})):$=1;const N=Math.min(..._);return C=C+N,S.colSpan=$,S.rowSpan=C,{colSpan:$,rowSpan:C}});return b((i=(s=c[0])==null?void 0:s.headers)!=null?i:[]),c}const dm=(t,a,n,o,i,s,u)=>{let m={id:a,index:o,original:n,depth:i,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(m._valuesCache.hasOwnProperty(c))return m._valuesCache[c];const g=t.getColumn(c);if(g!=null&&g.accessorFn)return m._valuesCache[c]=g.accessorFn(m.original,o),m._valuesCache[c]},getUniqueValues:c=>{if(m._uniqueValuesCache.hasOwnProperty(c))return m._uniqueValuesCache[c];const g=t.getColumn(c);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(m._uniqueValuesCache[c]=g.columnDef.getUniqueValues(m.original,o),m._uniqueValuesCache[c]):(m._uniqueValuesCache[c]=[m.getValue(c)],m._uniqueValuesCache[c])},renderValue:c=>{var g;return(g=m.getValue(c))!=null?g:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>t4(m.subRows,c=>c.subRows),getParentRow:()=>m.parentId?t.getRow(m.parentId,!0):void 0,getParentRows:()=>{let c=[],g=m;for(;;){const f=g.getParentRow();if(!f)break;c.push(f),g=f}return c.reverse()},getAllCells:aa(()=>[t.getAllLeafColumns()],c=>c.map(g=>a4(t,m,g,g.id)),na(t.options,"debugRows")),_getAllCellsByColumnId:aa(()=>[m.getAllCells()],c=>c.reduce((g,f)=>(g[f.column.id]=f,g),{}),na(t.options,"debugRows"))};for(let c=0;c<t._features.length;c++){const g=t._features[c];g==null||g.createRow==null||g.createRow(m,t)}return m},r4={createColumn:(t,a)=>{t._getFacetedRowModel=a.options.getFacetedRowModel&&a.options.getFacetedRowModel(a,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():a.getPreFilteredRowModel(),t._getFacetedUniqueValues=a.options.getFacetedUniqueValues&&a.options.getFacetedUniqueValues(a,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=a.options.getFacetedMinMaxValues&&a.options.getFacetedMinMaxValues(a,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}}},E2=(t,a,n)=>{var o,i;const s=n==null||(o=n.toString())==null?void 0:o.toLowerCase();return!!(!((i=t.getValue(a))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(s))};E2.autoRemove=t=>Lr(t);const z2=(t,a,n)=>{var o;return!!(!((o=t.getValue(a))==null||(o=o.toString())==null)&&o.includes(n))};z2.autoRemove=t=>Lr(t);const R2=(t,a,n)=>{var o;return((o=t.getValue(a))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(n==null?void 0:n.toLowerCase())};R2.autoRemove=t=>Lr(t);const N2=(t,a,n)=>{var o;return(o=t.getValue(a))==null?void 0:o.includes(n)};N2.autoRemove=t=>Lr(t);const L2=(t,a,n)=>!n.some(o=>{var i;return!((i=t.getValue(a))!=null&&i.includes(o))});L2.autoRemove=t=>Lr(t)||!(t!=null&&t.length);const P2=(t,a,n)=>n.some(o=>{var i;return(i=t.getValue(a))==null?void 0:i.includes(o)});P2.autoRemove=t=>Lr(t)||!(t!=null&&t.length);const D2=(t,a,n)=>t.getValue(a)===n;D2.autoRemove=t=>Lr(t);const B2=(t,a,n)=>t.getValue(a)==n;B2.autoRemove=t=>Lr(t);const cm=(t,a,n)=>{let[o,i]=n;const s=t.getValue(a);return s>=o&&s<=i};cm.resolveFilterValue=t=>{let[a,n]=t,o=typeof a!="number"?parseFloat(a):a,i=typeof n!="number"?parseFloat(n):n,s=a===null||Number.isNaN(o)?-1/0:o,u=n===null||Number.isNaN(i)?1/0:i;if(s>u){const m=s;s=u,u=m}return[s,u]};cm.autoRemove=t=>Lr(t)||Lr(t[0])&&Lr(t[1]);const Ri={includesString:E2,includesStringSensitive:z2,equalsString:R2,arrIncludes:N2,arrIncludesAll:L2,arrIncludesSome:P2,equals:D2,weakEquals:B2,inNumberRange:cm};function Lr(t){return t==null||t===""}const i4={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:Jo("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(t,a)=>{t.getAutoFilterFn=()=>{const n=a.getCoreRowModel().flatRows[0],o=n==null?void 0:n.getValue(t.id);return typeof o=="string"?Ri.includesString:typeof o=="number"?Ri.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Ri.equals:Array.isArray(o)?Ri.arrIncludes:Ri.weakEquals},t.getFilterFn=()=>{var n,o;return tp(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(o=a.options.filterFns)==null?void 0:o[t.columnDef.filterFn])!=null?n:Ri[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,o,i;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((o=a.options.enableColumnFilters)!=null?o:!0)&&((i=a.options.enableFilters)!=null?i:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=a.getState().columnFilters)==null||(n=n.find(o=>o.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,o;return(n=(o=a.getState().columnFilters)==null?void 0:o.findIndex(i=>i.id===t.id))!=null?n:-1},t.setFilterValue=n=>{a.setColumnFilters(o=>{const i=t.getFilterFn(),s=o==null?void 0:o.find(f=>f.id===t.id),u=ds(n,s?s.value:void 0);if(dy(i,u,t)){var m;return(m=o==null?void 0:o.filter(f=>f.id!==t.id))!=null?m:[]}const c={id:t.id,value:u};if(s){var g;return(g=o==null?void 0:o.map(f=>f.id===t.id?c:f))!=null?g:[]}return o!=null&&o.length?[...o,c]:[c]})}},createRow:(t,a)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=a=>{const n=t.getAllLeafColumns(),o=i=>{var s;return(s=ds(a,i))==null?void 0:s.filter(u=>{const m=n.find(c=>c.id===u.id);if(m){const c=m.getFilterFn();if(dy(c,u.value,m))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(o)},t.resetColumnFilters=a=>{var n,o;t.setColumnFilters(a?[]:(n=(o=t.initialState)==null?void 0:o.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())}};function dy(t,a,n){return(t&&t.autoRemove?t.autoRemove(a,n):!1)||typeof a>"u"||typeof a=="string"&&!a}const s4=(t,a,n)=>n.reduce((o,i)=>{const s=i.getValue(t);return o+(typeof s=="number"?s:0)},0),l4=(t,a,n)=>{let o;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(o>s||o===void 0&&s>=s)&&(o=s)}),o},d4=(t,a,n)=>{let o;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(o<s||o===void 0&&s>=s)&&(o=s)}),o},c4=(t,a,n)=>{let o,i;return n.forEach(s=>{const u=s.getValue(t);u!=null&&(o===void 0?u>=u&&(o=i=u):(o>u&&(o=u),i<u&&(i=u)))}),[o,i]},u4=(t,a)=>{let n=0,o=0;if(a.forEach(i=>{let s=i.getValue(t);s!=null&&(s=+s)>=s&&(++n,o+=s)}),n)return o/n},p4=(t,a)=>{if(!a.length)return;const n=a.map(s=>s.getValue(t));if(!e4(n))return;if(n.length===1)return n[0];const o=Math.floor(n.length/2),i=n.sort((s,u)=>s-u);return n.length%2!==0?i[o]:(i[o-1]+i[o])/2},g4=(t,a)=>Array.from(new Set(a.map(n=>n.getValue(t))).values()),m4=(t,a)=>new Set(a.map(n=>n.getValue(t))).size,h4=(t,a)=>a.length,Sp={sum:s4,min:l4,max:d4,extent:c4,mean:u4,median:p4,unique:g4,uniqueCount:m4,count:h4},f4={getDefaultColumnDef:()=>({aggregatedCell:t=>{var a,n;return(a=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?a:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:Jo("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,a)=>{t.toggleGrouping=()=>{a.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(o=>o!==t.id):[...n??[],t.id])},t.getCanGroup=()=>{var n,o;return((n=t.columnDef.enableGrouping)!=null?n:!0)&&((o=a.options.enableGrouping)!=null?o:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var n;return(n=a.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=a.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const n=a.getCoreRowModel().flatRows[0],o=n==null?void 0:n.getValue(t.id);if(typeof o=="number")return Sp.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Sp.extent},t.getAggregationFn=()=>{var n,o;if(!t)throw new Error;return tp(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(o=a.options.aggregationFns)==null?void 0:o[t.columnDef.aggregationFn])!=null?n:Sp[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=a=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(a),t.resetGrouping=a=>{var n,o;t.setGrouping(a?[]:(n=(o=t.initialState)==null?void 0:o.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,a)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const o=a.getColumn(n);return o!=null&&o.columnDef.getGroupingValue?(t._groupingValuesCache[n]=o.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,a,n,o)=>{t.getIsGrouped=()=>a.getIsGrouped()&&a.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&a.getIsGrouped(),t.getIsAggregated=()=>{var i;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function x4(t,a,n){if(!(a!=null&&a.length)||!n)return t;const o=t.filter(s=>!a.includes(s.id));return n==="remove"?o:[...a.map(s=>t.find(u=>u.id===s)).filter(Boolean),...o]}const b4={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Jo("columnOrder",t)}),createColumn:(t,a)=>{t.getIndex=aa(n=>[uc(a,n)],n=>n.findIndex(o=>o.id===t.id),na(a.options,"debugColumns")),t.getIsFirstColumn=n=>{var o;return((o=uc(a,n)[0])==null?void 0:o.id)===t.id},t.getIsLastColumn=n=>{var o;const i=uc(a,n);return((o=i[i.length-1])==null?void 0:o.id)===t.id}},createTable:t=>{t.setColumnOrder=a=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(a),t.resetColumnOrder=a=>{var n;t.setColumnOrder(a?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=aa(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(a,n,o)=>i=>{let s=[];if(!(a!=null&&a.length))s=i;else{const u=[...a],m=[...i];for(;m.length&&u.length;){const c=u.shift(),g=m.findIndex(f=>f.id===c);g>-1&&s.push(m.splice(g,1)[0])}s=[...s,...m]}return x4(s,n,o)},na(t.options,"debugTable"))}},wp=()=>({left:[],right:[]}),y4={getInitialState:t=>({columnPinning:wp(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Jo("columnPinning",t)}),createColumn:(t,a)=>{t.pin=n=>{const o=t.getLeafColumns().map(i=>i.id).filter(Boolean);a.setColumnPinning(i=>{var s,u;if(n==="right"){var m,c;return{left:((m=i==null?void 0:i.left)!=null?m:[]).filter(b=>!(o!=null&&o.includes(b))),right:[...((c=i==null?void 0:i.right)!=null?c:[]).filter(b=>!(o!=null&&o.includes(b))),...o]}}if(n==="left"){var g,f;return{left:[...((g=i==null?void 0:i.left)!=null?g:[]).filter(b=>!(o!=null&&o.includes(b))),...o],right:((f=i==null?void 0:i.right)!=null?f:[]).filter(b=>!(o!=null&&o.includes(b)))}}return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(b=>!(o!=null&&o.includes(b))),right:((u=i==null?void 0:i.right)!=null?u:[]).filter(b=>!(o!=null&&o.includes(b)))}})},t.getCanPin=()=>t.getLeafColumns().some(o=>{var i,s,u;return((i=o.columnDef.enablePinning)!=null?i:!0)&&((s=(u=a.options.enableColumnPinning)!=null?u:a.options.enablePinning)!=null?s:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(m=>m.id),{left:o,right:i}=a.getState().columnPinning,s=n.some(m=>o==null?void 0:o.includes(m)),u=n.some(m=>i==null?void 0:i.includes(m));return s?"left":u?"right":!1},t.getPinnedIndex=()=>{var n,o;const i=t.getIsPinned();return i?(n=(o=a.getState().columnPinning)==null||(o=o[i])==null?void 0:o.indexOf(t.id))!=null?n:-1:0}},createRow:(t,a)=>{t.getCenterVisibleCells=aa(()=>[t._getAllVisibleCells(),a.getState().columnPinning.left,a.getState().columnPinning.right],(n,o,i)=>{const s=[...o??[],...i??[]];return n.filter(u=>!s.includes(u.column.id))},na(a.options,"debugRows")),t.getLeftVisibleCells=aa(()=>[t._getAllVisibleCells(),a.getState().columnPinning.left],(n,o)=>(o??[]).map(s=>n.find(u=>u.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),na(a.options,"debugRows")),t.getRightVisibleCells=aa(()=>[t._getAllVisibleCells(),a.getState().columnPinning.right],(n,o)=>(o??[]).map(s=>n.find(u=>u.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),na(a.options,"debugRows"))},createTable:t=>{t.setColumnPinning=a=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(a),t.resetColumnPinning=a=>{var n,o;return t.setColumnPinning(a?wp():(n=(o=t.initialState)==null?void 0:o.columnPinning)!=null?n:wp())},t.getIsSomeColumnsPinned=a=>{var n;const o=t.getState().columnPinning;if(!a){var i,s;return!!((i=o.left)!=null&&i.length||(s=o.right)!=null&&s.length)}return!!((n=o[a])!=null&&n.length)},t.getLeftLeafColumns=aa(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(a,n)=>(n??[]).map(o=>a.find(i=>i.id===o)).filter(Boolean),na(t.options,"debugColumns")),t.getRightLeafColumns=aa(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(a,n)=>(n??[]).map(o=>a.find(i=>i.id===o)).filter(Boolean),na(t.options,"debugColumns")),t.getCenterLeafColumns=aa(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,n,o)=>{const i=[...n??[],...o??[]];return a.filter(s=>!i.includes(s.id))},na(t.options,"debugColumns"))}};function v4(t){return t||(typeof document<"u"?document:null)}const pu={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},kp=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),j4={getDefaultColumnDef:()=>pu,getInitialState:t=>({columnSizing:{},columnSizingInfo:kp(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Jo("columnSizing",t),onColumnSizingInfoChange:Jo("columnSizingInfo",t)}),createColumn:(t,a)=>{t.getSize=()=>{var n,o,i;const s=a.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:pu.minSize,(o=s??t.columnDef.size)!=null?o:pu.size),(i=t.columnDef.maxSize)!=null?i:pu.maxSize)},t.getStart=aa(n=>[n,uc(a,n),a.getState().columnSizing],(n,o)=>o.slice(0,t.getIndex(n)).reduce((i,s)=>i+s.getSize(),0),na(a.options,"debugColumns")),t.getAfter=aa(n=>[n,uc(a,n),a.getState().columnSizing],(n,o)=>o.slice(t.getIndex(n)+1).reduce((i,s)=>i+s.getSize(),0),na(a.options,"debugColumns")),t.resetSize=()=>{a.setColumnSizing(n=>{let{[t.id]:o,...i}=n;return i})},t.getCanResize=()=>{var n,o;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((o=a.options.enableColumnResizing)!=null?o:!0)},t.getIsResizing=()=>a.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,a)=>{t.getSize=()=>{let n=0;const o=i=>{if(i.subHeaders.length)i.subHeaders.forEach(o);else{var s;n+=(s=i.column.getSize())!=null?s:0}};return o(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const o=a.getColumn(t.column.id),i=o==null?void 0:o.getCanResize();return s=>{if(!o||!i||(s.persist==null||s.persist(),Cp(s)&&s.touches&&s.touches.length>1))return;const u=t.getSize(),m=t?t.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[o.id,o.getSize()]],c=Cp(s)?Math.round(s.touches[0].clientX):s.clientX,g={},f=(_,N)=>{typeof N=="number"&&(a.setColumnSizingInfo(w=>{var M,p;const V=a.options.columnResizeDirection==="rtl"?-1:1,L=(N-((M=w==null?void 0:w.startOffset)!=null?M:0))*V,x=Math.max(L/((p=w==null?void 0:w.startSize)!=null?p:0),-.999999);return w.columnSizingStart.forEach(z=>{let[G,B]=z;g[G]=Math.round(Math.max(B+B*x,0)*100)/100}),{...w,deltaOffset:L,deltaPercentage:x}}),(a.options.columnResizeMode==="onChange"||_==="end")&&a.setColumnSizing(w=>({...w,...g})))},b=_=>f("move",_),v=_=>{f("end",_),a.setColumnSizingInfo(N=>({...N,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},j=v4(n),S={moveHandler:_=>b(_.clientX),upHandler:_=>{j==null||j.removeEventListener("mousemove",S.moveHandler),j==null||j.removeEventListener("mouseup",S.upHandler),v(_.clientX)}},$={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),b(_.touches[0].clientX),!1),upHandler:_=>{var N;j==null||j.removeEventListener("touchmove",$.moveHandler),j==null||j.removeEventListener("touchend",$.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),v((N=_.touches[0])==null?void 0:N.clientX)}},C=A4()?{passive:!1}:!1;Cp(s)?(j==null||j.addEventListener("touchmove",$.moveHandler,C),j==null||j.addEventListener("touchend",$.upHandler,C)):(j==null||j.addEventListener("mousemove",S.moveHandler,C),j==null||j.addEventListener("mouseup",S.upHandler,C)),a.setColumnSizingInfo(_=>({..._,startOffset:c,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:m,isResizingColumn:o.id}))}}},createTable:t=>{t.setColumnSizing=a=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(a),t.setColumnSizingInfo=a=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(a),t.resetColumnSizing=a=>{var n;t.setColumnSizing(a?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=a=>{var n;t.setColumnSizingInfo(a?kp():(n=t.initialState.columnSizingInfo)!=null?n:kp())},t.getTotalSize=()=>{var a,n;return(a=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((o,i)=>o+i.getSize(),0))!=null?a:0},t.getLeftTotalSize=()=>{var a,n;return(a=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((o,i)=>o+i.getSize(),0))!=null?a:0},t.getCenterTotalSize=()=>{var a,n;return(a=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((o,i)=>o+i.getSize(),0))!=null?a:0},t.getRightTotalSize=()=>{var a,n;return(a=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((o,i)=>o+i.getSize(),0))!=null?a:0}}};let gu=null;function A4(){if(typeof gu=="boolean")return gu;let t=!1;try{const a={get passive(){return t=!0,!1}},n=()=>{};window.addEventListener("test",n,a),window.removeEventListener("test",n)}catch{t=!1}return gu=t,gu}function Cp(t){return t.type==="touchstart"}const S4={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Jo("columnVisibility",t)}),createColumn:(t,a)=>{t.toggleVisibility=n=>{t.getCanHide()&&a.setColumnVisibility(o=>({...o,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,o;const i=t.columns;return(n=i.length?i.some(s=>s.getIsVisible()):(o=a.getState().columnVisibility)==null?void 0:o[t.id])!=null?n:!0},t.getCanHide=()=>{var n,o;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((o=a.options.enableHiding)!=null?o:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,a)=>{t._getAllVisibleCells=aa(()=>[t.getAllCells(),a.getState().columnVisibility],n=>n.filter(o=>o.column.getIsVisible()),na(a.options,"debugRows")),t.getVisibleCells=aa(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,o,i)=>[...n,...o,...i],na(a.options,"debugRows"))},createTable:t=>{const a=(n,o)=>aa(()=>[o(),o().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),na(t.options,"debugColumns"));t.getVisibleFlatColumns=a("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=a("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=a("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=a("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=a("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var o;t.setColumnVisibility(n?{}:(o=t.initialState.columnVisibility)!=null?o:{})},t.toggleAllColumnsVisible=n=>{var o;n=(o=n)!=null?o:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((i,s)=>({...i,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var o;t.toggleAllColumnsVisible((o=n.target)==null?void 0:o.checked)}}};function uc(t,a){return a?a==="center"?t.getCenterVisibleLeafColumns():a==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const w4={createTable:t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}},k4={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:Jo("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:a=>{var n;const o=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[a.id])==null?void 0:n.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(t,a)=>{t.getCanGlobalFilter=()=>{var n,o,i,s;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((o=a.options.enableGlobalFilter)!=null?o:!0)&&((i=a.options.enableFilters)!=null?i:!0)&&((s=a.options.getColumnCanGlobalFilter==null?void 0:a.options.getColumnCanGlobalFilter(t))!=null?s:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>Ri.includesString,t.getGlobalFilterFn=()=>{var a,n;const{globalFilterFn:o}=t.options;return tp(o)?o:o==="auto"?t.getGlobalAutoFilterFn():(a=(n=t.options.filterFns)==null?void 0:n[o])!=null?a:Ri[o]},t.setGlobalFilter=a=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(a)},t.resetGlobalFilter=a=>{t.setGlobalFilter(a?void 0:t.initialState.globalFilter)}}},C4={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Jo("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let a=!1,n=!1;t._autoResetExpanded=()=>{var o,i;if(!a){t._queue(()=>{a=!0});return}if((o=(i=t.options.autoResetAll)!=null?i:t.options.autoResetExpanded)!=null?o:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=o=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(o),t.toggleAllRowsExpanded=o=>{o??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=o=>{var i,s;t.setExpanded(o?{}:(i=(s=t.initialState)==null?void 0:s.expanded)!=null?i:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const o=t.getState().expanded;return o===!0||Object.values(o).some(Boolean)},t.getIsAllRowsExpanded=()=>{const o=t.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||t.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},t.getExpandedDepth=()=>{let o=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(s=>{const u=s.split(".");o=Math.max(o,u.length)}),o},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,a)=>{t.toggleExpanded=n=>{a.setExpanded(o=>{var i;const s=o===!0?!0:!!(o!=null&&o[t.id]);let u={};if(o===!0?Object.keys(a.getRowModel().rowsById).forEach(m=>{u[m]=!0}):u=o,n=(i=n)!=null?i:!s,!s&&n)return{...u,[t.id]:!0};if(s&&!n){const{[t.id]:m,...c}=u;return c}return o})},t.getIsExpanded=()=>{var n;const o=a.getState().expanded;return!!((n=a.options.getIsRowExpanded==null?void 0:a.options.getIsRowExpanded(t))!=null?n:o===!0||o!=null&&o[t.id])},t.getCanExpand=()=>{var n,o,i;return(n=a.options.getRowCanExpand==null?void 0:a.options.getRowCanExpand(t))!=null?n:((o=a.options.enableExpanding)!=null?o:!0)&&!!((i=t.subRows)!=null&&i.length)},t.getIsAllParentsExpanded=()=>{let n=!0,o=t;for(;n&&o.parentId;)o=a.getRow(o.parentId,!0),n=o.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},kg=0,Cg=10,_p=()=>({pageIndex:kg,pageSize:Cg}),_4={getInitialState:t=>({...t,pagination:{..._p(),...t==null?void 0:t.pagination}}),getDefaultOptions:t=>({onPaginationChange:Jo("pagination",t)}),createTable:t=>{let a=!1,n=!1;t._autoResetPageIndex=()=>{var o,i;if(!a){t._queue(()=>{a=!0});return}if((o=(i=t.options.autoResetAll)!=null?i:t.options.autoResetPageIndex)!=null?o:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=o=>{const i=s=>ds(o,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=o=>{var i;t.setPagination(o?_p():(i=t.initialState.pagination)!=null?i:_p())},t.setPageIndex=o=>{t.setPagination(i=>{let s=ds(o,i.pageIndex);const u=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return s=Math.max(0,Math.min(s,u)),{...i,pageIndex:s}})},t.resetPageIndex=o=>{var i,s;t.setPageIndex(o?kg:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:kg)},t.resetPageSize=o=>{var i,s;t.setPageSize(o?Cg:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:Cg)},t.setPageSize=o=>{t.setPagination(i=>{const s=Math.max(1,ds(o,i.pageSize)),u=i.pageSize*i.pageIndex,m=Math.floor(u/s);return{...i,pageIndex:m,pageSize:s}})},t.setPageCount=o=>t.setPagination(i=>{var s;let u=ds(o,(s=t.options.pageCount)!=null?s:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...i,pageCount:u}}),t.getPageOptions=aa(()=>[t.getPageCount()],o=>{let i=[];return o&&o>0&&(i=[...new Array(o)].fill(null).map((s,u)=>u)),i},na(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:o}=t.getState().pagination,i=t.getPageCount();return i===-1?!0:i===0?!1:o<i-1},t.previousPage=()=>t.setPageIndex(o=>o-1),t.nextPage=()=>t.setPageIndex(o=>o+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var o;return(o=t.options.pageCount)!=null?o:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var o;return(o=t.options.rowCount)!=null?o:t.getPrePaginationRowModel().rows.length}}},$p=()=>({top:[],bottom:[]}),$4={getInitialState:t=>({rowPinning:$p(),...t}),getDefaultOptions:t=>({onRowPinningChange:Jo("rowPinning",t)}),createRow:(t,a)=>{t.pin=(n,o,i)=>{const s=o?t.getLeafRows().map(c=>{let{id:g}=c;return g}):[],u=i?t.getParentRows().map(c=>{let{id:g}=c;return g}):[],m=new Set([...u,t.id,...s]);a.setRowPinning(c=>{var g,f;if(n==="bottom"){var b,v;return{top:((b=c==null?void 0:c.top)!=null?b:[]).filter($=>!(m!=null&&m.has($))),bottom:[...((v=c==null?void 0:c.bottom)!=null?v:[]).filter($=>!(m!=null&&m.has($))),...Array.from(m)]}}if(n==="top"){var j,S;return{top:[...((j=c==null?void 0:c.top)!=null?j:[]).filter($=>!(m!=null&&m.has($))),...Array.from(m)],bottom:((S=c==null?void 0:c.bottom)!=null?S:[]).filter($=>!(m!=null&&m.has($)))}}return{top:((g=c==null?void 0:c.top)!=null?g:[]).filter($=>!(m!=null&&m.has($))),bottom:((f=c==null?void 0:c.bottom)!=null?f:[]).filter($=>!(m!=null&&m.has($)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:o,enablePinning:i}=a.options;return typeof o=="function"?o(t):(n=o??i)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:o,bottom:i}=a.getState().rowPinning,s=n.some(m=>o==null?void 0:o.includes(m)),u=n.some(m=>i==null?void 0:i.includes(m));return s?"top":u?"bottom":!1},t.getPinnedIndex=()=>{var n,o;const i=t.getIsPinned();if(!i)return-1;const s=(n=i==="top"?a.getTopRows():a.getBottomRows())==null?void 0:n.map(u=>{let{id:m}=u;return m});return(o=s==null?void 0:s.indexOf(t.id))!=null?o:-1}},createTable:t=>{t.setRowPinning=a=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(a),t.resetRowPinning=a=>{var n,o;return t.setRowPinning(a?$p():(n=(o=t.initialState)==null?void 0:o.rowPinning)!=null?n:$p())},t.getIsSomeRowsPinned=a=>{var n;const o=t.getState().rowPinning;if(!a){var i,s;return!!((i=o.top)!=null&&i.length||(s=o.bottom)!=null&&s.length)}return!!((n=o[a])!=null&&n.length)},t._getPinnedRows=(a,n,o)=>{var i;return((i=t.options.keepPinnedRows)==null||i?(n??[]).map(u=>{const m=t.getRow(u,!0);return m.getIsAllParentsExpanded()?m:null}):(n??[]).map(u=>a.find(m=>m.id===u))).filter(Boolean).map(u=>({...u,position:o}))},t.getTopRows=aa(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(a,n)=>t._getPinnedRows(a,n,"top"),na(t.options,"debugRows")),t.getBottomRows=aa(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(a,n)=>t._getPinnedRows(a,n,"bottom"),na(t.options,"debugRows")),t.getCenterRows=aa(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(a,n,o)=>{const i=new Set([...n??[],...o??[]]);return a.filter(s=>!i.has(s.id))},na(t.options,"debugRows"))}},I4={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Jo("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=a=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(a),t.resetRowSelection=a=>{var n;return t.setRowSelection(a?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=a=>{t.setRowSelection(n=>{a=typeof a<"u"?a:!t.getIsAllRowsSelected();const o={...n},i=t.getPreGroupedRowModel().flatRows;return a?i.forEach(s=>{s.getCanSelect()&&(o[s.id]=!0)}):i.forEach(s=>{delete o[s.id]}),o})},t.toggleAllPageRowsSelected=a=>t.setRowSelection(n=>{const o=typeof a<"u"?a:!t.getIsAllPageRowsSelected(),i={...n};return t.getRowModel().rows.forEach(s=>{_g(i,s.id,o,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=aa(()=>[t.getState().rowSelection,t.getCoreRowModel()],(a,n)=>Object.keys(a).length?Ip(t,n):{rows:[],flatRows:[],rowsById:{}},na(t.options,"debugTable")),t.getFilteredSelectedRowModel=aa(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(a,n)=>Object.keys(a).length?Ip(t,n):{rows:[],flatRows:[],rowsById:{}},na(t.options,"debugTable")),t.getGroupedSelectedRowModel=aa(()=>[t.getState().rowSelection,t.getSortedRowModel()],(a,n)=>Object.keys(a).length?Ip(t,n):{rows:[],flatRows:[],rowsById:{}},na(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const a=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let o=!!(a.length&&Object.keys(n).length);return o&&a.some(i=>i.getCanSelect()&&!n[i.id])&&(o=!1),o},t.getIsAllPageRowsSelected=()=>{const a=t.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=t.getState();let o=!!a.length;return o&&a.some(i=>!n[i.id])&&(o=!1),o},t.getIsSomeRowsSelected=()=>{var a;const n=Object.keys((a=t.getState().rowSelection)!=null?a:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const a=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:a.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>a=>{t.toggleAllRowsSelected(a.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>a=>{t.toggleAllPageRowsSelected(a.target.checked)}},createRow:(t,a)=>{t.toggleSelected=(n,o)=>{const i=t.getIsSelected();a.setRowSelection(s=>{var u;if(n=typeof n<"u"?n:!i,t.getCanSelect()&&i===n)return s;const m={...s};return _g(m,t.id,n,(u=o==null?void 0:o.selectChildren)!=null?u:!0,a),m})},t.getIsSelected=()=>{const{rowSelection:n}=a.getState();return um(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=a.getState();return $g(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=a.getState();return $g(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof a.options.enableRowSelection=="function"?a.options.enableRowSelection(t):(n=a.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof a.options.enableSubRowSelection=="function"?a.options.enableSubRowSelection(t):(n=a.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof a.options.enableMultiRowSelection=="function"?a.options.enableMultiRowSelection(t):(n=a.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return o=>{var i;n&&t.toggleSelected((i=o.target)==null?void 0:i.checked)}}}},_g=(t,a,n,o,i)=>{var s;const u=i.getRow(a,!0);n?(u.getCanMultiSelect()||Object.keys(t).forEach(m=>delete t[m]),u.getCanSelect()&&(t[a]=!0)):delete t[a],o&&(s=u.subRows)!=null&&s.length&&u.getCanSelectSubRows()&&u.subRows.forEach(m=>_g(t,m.id,n,o,i))};function Ip(t,a){const n=t.getState().rowSelection,o=[],i={},s=function(u,m){return u.map(c=>{var g;const f=um(c,n);if(f&&(o.push(c),i[c.id]=c),(g=c.subRows)!=null&&g.length&&(c={...c,subRows:s(c.subRows)}),f)return c}).filter(Boolean)};return{rows:s(a.rows),flatRows:o,rowsById:i}}function um(t,a){var n;return(n=a[t.id])!=null?n:!1}function $g(t,a,n){var o;if(!((o=t.subRows)!=null&&o.length))return!1;let i=!0,s=!1;return t.subRows.forEach(u=>{if(!(s&&!i)&&(u.getCanSelect()&&(um(u,a)?s=!0:i=!1),u.subRows&&u.subRows.length)){const m=$g(u,a);m==="all"?s=!0:(m==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const Ig=/([0-9]+)/gm,T4=(t,a,n)=>W2(cs(t.getValue(n)).toLowerCase(),cs(a.getValue(n)).toLowerCase()),E4=(t,a,n)=>W2(cs(t.getValue(n)),cs(a.getValue(n))),z4=(t,a,n)=>pm(cs(t.getValue(n)).toLowerCase(),cs(a.getValue(n)).toLowerCase()),R4=(t,a,n)=>pm(cs(t.getValue(n)),cs(a.getValue(n))),N4=(t,a,n)=>{const o=t.getValue(n),i=a.getValue(n);return o>i?1:o<i?-1:0},L4=(t,a,n)=>pm(t.getValue(n),a.getValue(n));function pm(t,a){return t===a?0:t>a?1:-1}function cs(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function W2(t,a){const n=t.split(Ig).filter(Boolean),o=a.split(Ig).filter(Boolean);for(;n.length&&o.length;){const i=n.shift(),s=o.shift(),u=parseInt(i,10),m=parseInt(s,10),c=[u,m].sort();if(isNaN(c[0])){if(i>s)return 1;if(s>i)return-1;continue}if(isNaN(c[1]))return isNaN(u)?-1:1;if(u>m)return 1;if(m>u)return-1}return n.length-o.length}const ec={alphanumeric:T4,alphanumericCaseSensitive:E4,text:z4,textCaseSensitive:R4,datetime:N4,basic:L4},P4={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Jo("sorting",t),isMultiSortEvent:a=>a.shiftKey}),createColumn:(t,a)=>{t.getAutoSortingFn=()=>{const n=a.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const i of n){const s=i==null?void 0:i.getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]")return ec.datetime;if(typeof s=="string"&&(o=!0,s.split(Ig).length>1))return ec.alphanumeric}return o?ec.text:ec.basic},t.getAutoSortDir=()=>{const n=a.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(t.id))=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,o;if(!t)throw new Error;return tp(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(o=a.options.sortingFns)==null?void 0:o[t.columnDef.sortingFn])!=null?n:ec[t.columnDef.sortingFn]},t.toggleSorting=(n,o)=>{const i=t.getNextSortingOrder(),s=typeof n<"u"&&n!==null;a.setSorting(u=>{const m=u==null?void 0:u.find(j=>j.id===t.id),c=u==null?void 0:u.findIndex(j=>j.id===t.id);let g=[],f,b=s?n:i==="desc";if(u!=null&&u.length&&t.getCanMultiSort()&&o?m?f="toggle":f="add":u!=null&&u.length&&c!==u.length-1?f="replace":m?f="toggle":f="replace",f==="toggle"&&(s||i||(f="remove")),f==="add"){var v;g=[...u,{id:t.id,desc:b}],g.splice(0,g.length-((v=a.options.maxMultiSortColCount)!=null?v:Number.MAX_SAFE_INTEGER))}else f==="toggle"?g=u.map(j=>j.id===t.id?{...j,desc:b}:j):f==="remove"?g=u.filter(j=>j.id!==t.id):g=[{id:t.id,desc:b}];return g})},t.getFirstSortDir=()=>{var n,o;return((n=(o=t.columnDef.sortDescFirst)!=null?o:a.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var o,i;const s=t.getFirstSortDir(),u=t.getIsSorted();return u?u!==s&&((o=a.options.enableSortingRemoval)==null||o)&&(!(n&&(i=a.options.enableMultiRemove)!=null)||i)?!1:u==="desc"?"asc":"desc":s},t.getCanSort=()=>{var n,o;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((o=a.options.enableSorting)!=null?o:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,o;return(n=(o=t.columnDef.enableMultiSort)!=null?o:a.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const o=(n=a.getState().sorting)==null?void 0:n.find(i=>i.id===t.id);return o?o.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,o;return(n=(o=a.getState().sorting)==null?void 0:o.findIndex(i=>i.id===t.id))!=null?n:-1},t.clearSorting=()=>{a.setSorting(n=>n!=null&&n.length?n.filter(o=>o.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return o=>{n&&(o.persist==null||o.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?a.options.isMultiSortEvent==null?void 0:a.options.isMultiSortEvent(o):!1))}}},createTable:t=>{t.setSorting=a=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(a),t.resetSorting=a=>{var n,o;t.setSorting(a?[]:(n=(o=t.initialState)==null?void 0:o.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},D4=[o4,S4,b4,y4,r4,i4,w4,k4,P4,f4,C4,_4,$4,I4,j4];function B4(t){var a,n;const o=[...D4,...(a=t._features)!=null?a:[]];let i={_features:o};const s=i._features.reduce((v,j)=>Object.assign(v,j.getDefaultOptions==null?void 0:j.getDefaultOptions(i)),{}),u=v=>i.options.mergeOptions?i.options.mergeOptions(s,v):{...s,...v};let c={...{},...(n=t.initialState)!=null?n:{}};
vendor: 4,413 bytes, line 680
680i._features.forEach(v=>{var j;c=(j=v.getInitialState==null?void 0:v.getInitialState(c))!=null?j:c});const g=[];let f=!1;const b={_features:o,options:{...s,...t},initialState:c,_queue:v=>{g.push(v),f||(f=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();f=!1}).catch(j=>setTimeout(()=>{throw j})))},reset:()=>{i.setState(i.initialState)},setOptions:v=>{const j=ds(v,i.options);i.options=u(j)},getState:()=>i.options.state,setState:v=>{i.options.onStateChange==null||i.options.onStateChange(v)},_getRowId:(v,j,S)=>{var $;return($=i.options.getRowId==null?void 0:i.options.getRowId(v,j,S))!=null?$:`${S?[S.id,j].join("."):j}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(v,j)=>{let S=(j?i.getPrePaginationRowModel():i.getRowModel()).rowsById[v];if(!S&&(S=i.getCoreRowModel().rowsById[v],!S))throw new Error;return S},_getDefaultColumnDef:aa(()=>[i.options.defaultColumn],v=>{var j;return v=(j=v)!=null?j:{},{header:S=>{const $=S.header.column.columnDef;return $.accessorKey?$.accessorKey:$.accessorFn?$.id:null},cell:S=>{var $,C;return($=(C=S.renderValue())==null||C.toString==null?void 0:C.toString())!=null?$:null},...i._features.reduce((S,$)=>Object.assign(S,$.getDefaultColumnDef==null?void 0:$.getDefaultColumnDef()),{}),...v}},na(t,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:aa(()=>[i._getColumnDefs()],v=>{const j=function(S,$,C){return C===void 0&&(C=0),S.map(_=>{const N=n4(i,_,C,$),w=_;return N.columns=w.columns?j(w.columns,N,C+1):[],N})};return j(v)},na(t,"debugColumns")),getAllFlatColumns:aa(()=>[i.getAllColumns()],v=>v.flatMap(j=>j.getFlatColumns()),na(t,"debugColumns")),_getAllFlatColumnsById:aa(()=>[i.getAllFlatColumns()],v=>v.reduce((j,S)=>(j[S.id]=S,j),{}),na(t,"debugColumns")),getAllLeafColumns:aa(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(v,j)=>{let S=v.flatMap($=>$.getLeafColumns());return j(S)},na(t,"debugColumns")),getColumn:v=>i._getAllFlatColumnsById()[v]};Object.assign(i,b);for(let v=0;v<i._features.length;v++){const j=i._features[v];j==null||j.createTable==null||j.createTable(i)}return i}function W4(){return t=>aa(()=>[t.options.data],a=>{const n={rows:[],flatRows:[],rowsById:{}},o=function(i,s,u){s===void 0&&(s=0);const m=[];for(let g=0;g<i.length;g++){const f=dm(t,t._getRowId(i[g],g,u),i[g],g,s,void 0,u==null?void 0:u.id);if(n.flatRows.push(f),n.rowsById[f.id]=f,m.push(f),t.options.getSubRows){var c;f.originalSubRows=t.options.getSubRows(i[g],g),(c=f.originalSubRows)!=null&&c.length&&(f.subRows=o(f.originalSubRows,s+1,f))}}return m};return n.rows=o(a),n},na(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function q4(t,a,n){return n.options.filterFromLeafRows?M4(t,a,n):F4(t,a,n)}function M4(t,a,n){var o;const i=[],s={},u=(o=n.options.maxLeafRowFilterDepth)!=null?o:100,m=function(c,g){g===void 0&&(g=0);const f=[];for(let v=0;v<c.length;v++){var b;let j=c[v];const S=dm(n,j.id,j.original,j.index,j.depth,void 0,j.parentId);if(S.columnFilters=j.columnFilters,(b=j.subRows)!=null&&b.length&&g<u){if(S.subRows=m(j.subRows,g+1),j=S,a(j)&&!S.subRows.length){f.push(j),s[j.id]=j,i.push(j);continue}if(a(j)||S.subRows.length){f.push(j),s[j.id]=j,i.push(j);continue}}else j=S,a(j)&&(f.push(j),s[j.id]=j,i.push(j))}return f};return{rows:m(t),flatRows:i,rowsById:s}}function F4(t,a,n){var o;const i=[],s={},u=(o=n.options.maxLeafRowFilterDepth)!=null?o:100,m=function(c,g){g===void 0&&(g=0);const f=[];for(let v=0;v<c.length;v++){let j=c[v];if(a(j)){var b;if((b=j.subRows)!=null&&b.length&&g<u){const $=dm(n,j.id,j.original,j.index,j.depth,void 0,j.parentId);$.subRows=m(j.subRows,g+1),j=$}f.push(j),i.push(j),s[j.id]=j}}return f};return{rows:m(t),flatRows:i,rowsById:s}}function O4(){return t=>aa(()=>[t.getPreFilteredRowModel(),t.getState().columnFilters,t.getState().globalFilter],(a,n,o)=>{if(!a.rows.length||!(n!=null&&n.length)&&!o){for(let v=0;v<a.flatRows.length;v++)a.flatRows[v].columnFilters={},a.flatRows[v].columnFiltersMeta={};return a}const i=[],s=[];(n??[]).forEach(v=>{var j;const S=t.getColumn(v.id);if(!S)return;const $=S.getFilterFn();$&&i.push({id:v.id,filterFn:$,resolvedValue:(j=$.resolveFilterValue==null?void 0:$.resolveFilterValue(v.value))!=null?j:v.value})});const u=(n??[]).map(v=>v.id),m=t.getGlobalFilterFn(),c=t.getAllLeafColumns().filter(v=>v.getCanGlobalFilter());
680o&&m&&c.length&&(u.push("__global__"),c.forEach(v=>{var j;s.push({id:v.id,filterFn:m,resolvedValue:(j=m.resolveFilterValue==null?void 0:m.resolveFilterValue(o))!=null?j:o})}));let g,f;for(let v=0;v<a.flatRows.length;v++){const j=a.flatRows[v];if(j.columnFilters={},i.length)for(let S=0;S<i.length;S++){g=i[S];const $=g.id;j.columnFilters[$]=g.filterFn(j,$,g.resolvedValue,C=>{j.columnFiltersMeta[$]=C})}if(s.length){for(let S=0;S<s.length;S++){f=s[S];const $=f.id;if(f.filterFn(j,$,f.resolvedValue,C=>{j.columnFiltersMeta[$]=C})){j.columnFilters.__global__=!0;break}}j.columnFilters.__global__!==!0&&(j.columnFilters.__global__=!1)}}const b=v=>{for(let j=0;j<u.length;j++)if(v.columnFilters[u[j]]===!1)return!1;return!0};return q4(a.rows,b,t)},na(t.options,"debugTable","getFilteredRowModel",()=>t._autoResetPageIndex()))}function H4(){return t=>aa(()=>[t.getState().sorting,t.getPreSortedRowModel()],(a,n)=>{if(!n.rows.length||!(a!=null&&a.length))return n;const o=t.getState().sorting,i=[],s=o.filter(c=>{var g;return(g=t.getColumn(c.id))==null?void 0:g.getCanSort()}),u={};s.forEach(c=>{const g=t.getColumn(c.id);g&&(u[c.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const m=c=>{const g=c.map(f=>({...f}));return g.sort((f,b)=>{for(let j=0;j<s.length;j+=1){var v;const S=s[j],$=u[S.id],C=$.sortUndefined,_=(v=S==null?void 0:S.desc)!=null?v:!1;let N=0;if(C){const w=f.getValue(S.id),M=b.getValue(S.id),p=w===void 0,V=M===void 0;if(p||V){if(C==="first")return p?-1:1;if(C==="last")return p?1:-1;N=p&&V?0:p?C:-C}}if(N===0&&(N=$.sortingFn(f,b,S.id)),N!==0)return _&&(N*=-1),$.invertSorting&&(N*=-1),N}return f.index-b.index}),g.forEach(f=>{var b;i.push(f),(b=f.subRows)!=null&&b.length&&(f.subRows=m(f.subRows))}),g};return{rows:m(n.rows),flatRows:i,rowsById:n.rowsById}},na(t.options,"debugTable","getSortedRowModel",()=>t._autoResetPageIndex()))}/** 681 * react-table 682 * 683 * Copyright (c) TanStack 684 * 685 * This source code is licensed under the MIT license found in the 686 * LICENSE.md file in the root directory of this source tree. 687 * 688 * @license MIT 689 */function cy(t,a){return t?G4(t)?h.createElement(t,a):t:null}function G4(t){return V4(t)||typeof t=="function"||U4(t)}function V4(t){return typeof t=="function"&&(()=>{const a=Object.getPrototypeOf(t);return a.prototype&&a.prototype.isReactComponent})()}function U4(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function Q4(t){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=h.useState(()=>({current:B4(a)})),[o,i]=h.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...t,state:{...o,...t.state},onStateChange:u=>{i(u),t.onStateChange==null||t.onStateChange(u)}})),n.current}const ls="#2563EB",as=t=>String(t||"").toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,"").trim(),Nl=t=>{const a=t.stockOwn!=null?t.stockOwn:t.dropiStock;return a==null?"none":a===0?"out":a<=(t.stockMin||5)?"low":"ok"},uy={out:0,low:1,ok:2,none:3},K4={out:{label:"Agotado",color:"var(--danger)",bg:"var(--notice-danger-bg)",border:"var(--notice-danger-border)"},low:{label:"Bajo",color:"var(--notice-warning-text)",bg:"var(--notice-warning-bg)",border:"var(--notice-warning-border)"},ok:{label:"En stock",color:"var(--notice-success-text)",bg:"var(--notice-success-bg)",border:"var(--notice-success-border)"},none:{label:"Sin control",color:"var(--text-secondary)",bg:"var(--bg-hover)",border:"var(--border)"}},zu=t=>"$"+Number(t||0).toLocaleString("es-CO"),Ll={background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,boxShadow:"0 1px 2px rgba(16,24,40,0.04), 0 10px 28px -10px rgba(16,24,40,0.08)"},Bs={fontSize:9.5,fontWeight:600,letterSpacing:".08em",textTransform:"uppercase",color:"var(--text-muted, #8a90a0)"},Y4={...Bs,fontSize:10.5,textAlign:"left",padding:"11px 12px",borderBottom:"1px solid var(--border, #e8eaf0)",whiteSpace:"nowrap",userSelect:"none",background:"var(--card-bg, #fff)",position:"sticky",top:0,zIndex:1},J4={padding:"13px 12px",borderBottom:"1px solid var(--border, #eef0f5)",fontSize:13,color:"var(--text, #16181d)",verticalAlign:"middle"},Tp={background:"transparent",color:"var(--text, #333)",border:"1px solid var(--border, #dde)",borderRadius:9,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",transition:"all .15s ease",whiteSpace:"nowrap"};function py({st:t}){const a=K4[t];return e.jsx("span",{style:{display:"inline-block",fontSize:10.5,fontWeight:700,letterSpacing:".04em",textTransform:"uppercase",color:a.color,background:a.bg,border:`1px solid ${a.border}`,borderRadius:999,padding:"3px 10px",whiteSpace:"nowrap"},children:a.label})}function Pl({text:t,tone:a}){const n=a==="red"?["var(--danger)","var(--notice-danger-bg)","var(--notice-danger-border)"]:a==="amber"?["var(--notice-warning-text)","var(--notice-warning-bg)","var(--notice-warning-border)"]:["var(--text-secondary)","var(--bg-hover)","var(--border)"];return e.jsx("span",{style:{flex:"none",fontSize:9.5,fontWeight:700,letterSpacing:".05em",color:n[0],background:n[1],border:`1px solid ${n[2]}`,borderRadius:999,padding:"1px 7px",whiteSpace:"nowrap"},children:t})}function Z4({dir:t}){return e.jsx("svg",{viewBox:"0 0 24 24",width:"9",height:"9",style:{marginLeft:4,opacity:t?.9:0,transform:t==="desc"?"rotate(180deg)":"none",transition:"opacity .15s ease, transform .15s ease",verticalAlign:"middle"},fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function mu({checked:t,indeterminate:a,onChange:n,ariaLabel:o}){const i=h.useRef(null);return h.useEffect(()=>{i.current&&(i.current.indeterminate=!!a&&!t)},[a,t]),e.jsx("input",{ref:i,type:"checkbox","aria-label":o,checked:t,onChange:n,onClick:s=>s.stopPropagation(),style:{width:15,height:15,accentColor:ls,cursor:"pointer",display:"block"}})}function Yl({value:t,display:a,sub:n,disabled:o,disabledHint:i,placeholder:s,min:u,onSave:m,width:c=74}){const[g,f]=h.useState(!1),[b,v]=h.useState(""),[j,S]=h.useState(!1),[$,C]=h.useState(null),_=h.useRef(null);h.useEffect(()=>()=>clearTimeout(_.current),[]);const N=async()=>{const w=b.trim(),M=w===""?null:Math.max(u??0,Math.round(Number(w.replace(/[^0-9]/g,""))||0));if(f(!1),M!==t){S(!0);try{await m(M),C("ok")}catch{C("err")}finally{S(!1),clearTimeout(_.current),_.current=setTimeout(()=>C(null),1600)}}};return o?e.jsxs("span",{title:i,style:{fontSize:13,color:"var(--text-muted, #99a)",cursor:"help"},children:[a,n&&e.jsx("span",{style:{display:"block",fontSize:9.5,color:"var(--text-muted, #99a)",marginTop:2},children:n})]}):g?e.jsx("input",{autoFocus:!0,inputMode:"numeric",value:b,placeholder:s,onChange:w=>v(w.target.value.replace(/[^0-9]/g,"")),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),N()),w.key==="Escape"&&(w.preventDefault(),f(!1))},onBlur:N,style:{width:c,padding:"6px 8px",borderRadius:8,border:`1.5px solid ${ls}`,boxShadow:"0 0 0 3px rgba(37,99,235,.14)",fontSize:13,fontWeight:700,textAlign:"right",background:"var(--card-bg, #fff)",color:"var(--text, #111)",outline:"none"}}):e.jsxs("button",{type:"button",onClick:()=>{v(t==null?"":String(t)),f(!0)},title:"Clic para editar. Enter guarda, Esc cancela.",style:{background:"transparent",border:"1px dashed transparent",borderRadius:8,padding:"5px 8px",margin:"-5px -8px",font:"inherit",fontSize:13,fontWeight:700,color:"var(--text, #16181d)",cursor:"pointer",textAlign:"right",transition:"border-color .15s ease, background .15s ease",display:"inline-block"},onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--border, #cdd3e0)",w.currentTarget.style.background="var(--input-bg, #f6f8fb)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="transparent",w.currentTarget.style.background="transparent"},children:[j?e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Guardandoâ¦"}):a,$==="ok"&&!j&&e.jsx("span",{style:{display:"block",fontSize:9.5,fontWeight:700,color:"var(--success)",marginTop:2},children:"Guardado"}),$==="err"&&!j&&e.jsx("span",{style:{display:"block",fontSize:9.5,fontWeight:700,color:"var(--danger)",marginTop:2},children:"No se guardó"}),$===null&&!j&&n&&e.jsx("span",{style:{display:"block",fontSize:9.5,color:"var(--text-muted, #99a)",marginTop:2},children:n})]})}function X4({items:t,alerts:a,currency:n,storeOn:o,onSaveStock:i,onSetStoreHidden:s,onEdit:u}){const m=$a(),c=pj(720),[g,f]=h.useState(null),b=h.useMemo(()=>{const I=new Map;if(g)for(const H of g.keys())I.set(as(H),H);return I},[g]);h.useEffect(()=>{let I=!0;return Promise.allSettled([m("/api/product-costs?platform=dropi").then(H=>H.json()),m("/api/product-costs?platform=dropi-v2").then(H=>H.json())]).then(([H,ye])=>
689{if(!I)return;const De=new Map,Ue=(se,we)=>{for(const Ye of(se==null?void 0:se.items)||[]){const lt=String(Ye.product_name||"").trim();if(!lt)continue;const jt=De.get(lt),Je={cost:Number(Ye.unit_cost)||0,dataCost:Number(Ye.data_unit_cost)||0,source:Ye.is_user_override?"override":(Number(Ye.data_unit_cost)||0)>0?"data":"none"};if(!jt){De.set(lt,Je);continue}we&&Je.source==="override"||jt.source!=="override"&&Je.source!=="none"?De.set(lt,Je):jt.dataCost===0&&Je.dataCost>0&&De.set(lt,{...jt,dataCost:Je.dataCost})}};Ue(ye.status==="fulfilled"?ye.value:null,!1),Ue(H.status==="fulfilled"?H.value:null,!0),f(De)}),()=>{I=!1}},[m]);const v=I=>{if(I.dropiName&&I.dropiName.trim())return I.dropiName.trim();const H=b.get(as(I.name));return H||null},j=I=>{const H=v(I);return!H||!g?null:g.get(H)||{cost:0,dataCost:0,source:"none"}},S=async(I,H)=>{const ye=Ue=>m("/api/product-costs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:Ue,costs:I.map(se=>{var we;return{product_name:se,unit_cost:H,data_original_cost:((we=g==null?void 0:g.get(se))==null?void 0:we.dataCost)||0}})})});if(!(await ye("dropi")).ok)throw new Error("save_failed");ye("dropi-v2").catch(()=>{}),f(Ue=>{var we;const se=new Map(Ue||[]);for(const Ye of I){const lt=((we=se.get(Ye))==null?void 0:we.dataCost)||0;H>0?se.set(Ye,{cost:H,dataCost:lt,source:"override"}):se.set(Ye,{cost:lt,dataCost:lt,source:lt>0?"data":"none"})}return se})},$=t||[],[C,_]=h.useState([{id:"estado",desc:!1}]),[N,w]=h.useState(""),[M,p]=h.useState("all");h.useEffect(()=>{const I=H=>{const ye=H.detail;(ye==null?void 0:ye.tipo)==="inventario-filtro"&&(w(""),p(ye.filtro),ye.consumido=!0)};return window.addEventListener("lumy:guia-ir",I),()=>window.removeEventListener("lumy:guia-ir",I)},[]);const[V,L]=h.useState({}),x=h.useMemo(()=>{const I=new Map;return $.forEach(H=>{H.dropiPid&&I.set(H.dropiPid,(I.get(H.dropiPid)||0)+1)}),I},[$]),z=h.useMemo(()=>[{id:"select",size:34,enableSorting:!1,header:({table:I})=>{const H=I.getFilteredRowModel().rows,ye=H.length>0&&H.every(Ue=>Ue.getIsSelected()),De=H.some(Ue=>Ue.getIsSelected());return e.jsx(mu,{ariaLabel:"Seleccionar lo visible",checked:ye,indeterminate:De&&!ye,onChange:()=>{const Ue={};ye||H.forEach(se=>{Ue[se.id]=!0}),L(Ue)}})},cell:({row:I})=>e.jsx(mu,{ariaLabel:`Seleccionar ${I.original.name}`,checked:I.getIsSelected(),onChange:I.getToggleSelectedHandler()})},{id:"producto",accessorKey:"name",header:"Producto",sortingFn:(I,H)=>as(I.original.name).localeCompare(as(H.original.name),"es"),cell:({row:I})=>{const H=I.original,ye=H.dropiPid&&x.get(H.dropiPid)||0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:210},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:9,overflow:"hidden",flex:"none",background:"var(--input-bg, #f1f5f9)",border:"1px solid var(--border, #e8eaf0)",display:"flex",alignItems:"center",justifyContent:"center"},children:H.image?e.jsx("img",{src:H.image,alt:"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsxs("svg",{viewBox:"0 0 24 24",width:"17",height:"17",fill:"none",stroke:"var(--text-muted, #99a)",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("circle",{cx:"9",cy:"9",r:"2"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[e.jsx("span",{style:{fontWeight:700,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:260},children:H.name}),H.status!=="published"&&e.jsx(Pl,{text:"BORRADOR",tone:"amber"}),!(H.price>0)&&e.jsx(Pl,{text:"SIN PRECIO",tone:"red"}),o&&H.storeHidden&&e.jsx(Pl,{text:"OCULTO EN TIENDA",tone:"gray"})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2,display:"flex",alignItems:"center",gap:4,minWidth:0},children:H.dropiPid?e.jsxs(e.Fragment,{children:[e.jsx(iv,{size:11}),e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:240},children:[H.dropiName||`Dropi ${H.dropiPid}`,ye>1?` · en ${ye} landings`:""]})]}):e.jsx("span",{children:"Producto propio (sin Dropi)"})})]})]})}},{id:"estado",accessorFn:I=>Nl(I),header:"Estado",filterFn:"equals",sortingFn:(I,H)=>uy[Nl(I.original)]-uy[Nl(H.original)]||(H.original.sold30||0)-(I.original.sold30||0),cell:({row:I})=>e.jsx(py,{st:Nl(I.original)})},{id:"precio",accessorKey:"price",header:"Precio",cell:({row:I})=>I.original.price>0?e.jsxs("span",{style:{fontWeight:700,fontSize:13},children:[zu(I.original.price)," ",e.jsx("span",{style:{fontSize:9.5,color:"var(--text-muted)",fontWeight:600},children:n})]}):e.jsx("span",{style:{color:"var(--text-muted)"},children:"â"})},{id:"costo",accessorFn:I=>{var H;return((H=j(I))==null?void 0:H.cost)??-1},header:"Costo",cell:({row:I})=>e.jsx(gy,{it:I.original,costKey:v(I.original),entry:j(I.original),onSave:S})},{id:"stockOwn",accessorFn:I=>I.stockOwn==null?-1:I.stockOwn,header:()=>e.jsx("span",{"data-guia":"inventario.entradas",children:"Tu stock"}),cell:({row:I})=>{const H=I.original;return e.jsx(Yl,{value:H.stockOwn,display:H.stockOwn!=null?H.stockOwn.toLocaleStr
689ing("es-CO"):e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:"Llevar control"}),placeholder:"0",onSave:ye=>i(H.landingId,{stock_own:ye})})}},{id:"dropiStock",accessorFn:I=>I.dropiStock==null?-1:I.dropiStock,header:"Bodega Dropi",cell:({row:I})=>{const H=I.original;return H.dropiPid?e.jsxs("span",{title:"Este stock lo manda Dropi. Es solo lectura.",children:[e.jsx("span",{style:{fontWeight:700,fontSize:13},children:typeof H.dropiStock=="number"?H.dropiStock.toLocaleString("es-CO"):"â"}),e.jsx("span",{style:{display:"block",fontSize:9.5,color:H.dropiActive===!1?"var(--danger)":"var(--text-muted)",marginTop:2,fontWeight:H.dropiActive===!1?700:400},children:H.dropiActive===!1?"pausado en Dropi":"de Dropi"})]}):e.jsx("span",{style:{color:"var(--text-muted)"},children:"â"})}},{id:"stockMin",accessorKey:"stockMin",header:()=>e.jsx("span",{"data-guia":"inventario.alertas",children:"Avisar si queda"}),cell:({row:I})=>{const H=I.original;return e.jsx(Yl,{value:H.stockMin??5,min:1,display:e.jsxs("span",{style:{fontWeight:600,fontSize:12.5,color:"var(--text-muted)"},children:["â¤"," ",H.stockMin??5]}),onSave:ye=>i(H.landingId,{stock_min:Math.max(1,ye??5)}),width:56})}},{id:"sold30",accessorKey:"sold30",header:"30 dÃas",cell:({row:I})=>e.jsx("span",{style:{fontWeight:600,fontSize:12.5,color:(I.original.sold30||0)>0?"var(--text, #16181d)":"var(--text-muted)"},children:I.original.sold30||0})},{id:"acciones",enableSorting:!1,header:"",cell:({row:I})=>e.jsx(my,{it:I.original,storeOn:o,onEdit:u,onSetStoreHidden:s})}],[g,b,n,o,x,i,s,u]),G=h.useMemo(()=>M==="all"?[]:[{id:"estado",value:M}],[M]),B=Q4({data:$,columns:z,state:{sorting:C,globalFilter:N,rowSelection:V,columnFilters:G},onSortingChange:_,onGlobalFilterChange:w,onRowSelectionChange:L,getRowId:I=>String(I.landingId),enableRowSelection:!0,globalFilterFn:(I,H,ye)=>{const De=as(String(ye||""));if(!De)return!0;const Ue=I.original;return as(Ue.name).includes(De)||as(Ue.slug||"").includes(De)||as(Ue.dropiName||"").includes(De)||String(Ue.dropiPid||"").includes(De)},getCoreRowModel:W4(),getSortedRowModel:H4(),getFilteredRowModel:O4()}),U=B.getRowModel().rows,ne=B.getSelectedRowModel().rows,Q=h.useMemo(()=>{const I={all:$.length,out:0,low:0,ok:0,none:0};return $.forEach(H=>{I[Nl(H)]++}),I},[$]),[de,pe]=h.useState(!1),[ce,ve]=h.useState(""),[ge,Te]=h.useState(!1),[ie,fe]=h.useState(""),Be=h.useRef(null);h.useEffect(()=>()=>clearTimeout(Be.current),[]);const We=I=>{fe(I),clearTimeout(Be.current),Be.current=setTimeout(()=>fe(""),3e3)},ze=async()=>{const I=Math.max(0,Math.round(Number(ce.replace(/[^0-9]/g,""))||0));if(!I){We("Escribe un costo mayor a 0.");return}const H=[...new Set(ne.map(De=>v(De.original)).filter(De=>!!De))],ye=ne.length-ne.filter(De=>v(De.original)).length;if(!H.length){We("Ninguno de los seleccionados tiene producto de Dropi.");return}Te(!0);try{await S(H,I),We(`Costo ${zu(I)} asignado a ${H.length} producto${H.length===1?"":"s"}${ye?` (${ye} sin Dropi, omitido${ye===1?"":"s"})`:""}.`),pe(!1),ve("")}catch{We("No se pudo guardar el costo. Intenta de nuevo.")}finally{Te(!1)}},tt=async()=>{const I=ne.map(H=>H.original.name).join(` 690`);try{await navigator.clipboard.writeText(I),We("Nombres copiados.")}catch{We("No se pudo copiar en este navegador.")}},Fe=async I=>{try{await s(ne.map(H=>H.original.landingId),I),We(I?"Ocultados en la tienda.":"Visibles en la tienda.")}catch{We("No se pudo actualizar la tienda. Intenta de nuevo.")}},F={background:"rgba(255,255,255,.08)",color:"#fff",border:"1px solid rgba(255,255,255,.18)",borderRadius:9,padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",transition:"background .15s ease",whiteSpace:"nowrap"},Re=[["all","Todos"],["out","Agotado"],["low","Stock bajo"],["ok","Con stock"],["none","Sin control"]],K=(I,H)=>({padding:"5px 11px",borderRadius:999,fontSize:12,fontWeight:700,cursor:"pointer",userSelect:"none",border:`1.5px solid ${I?H||ls:"var(--border, #e8eaf0)"}`,background:I?H?H+"14":"rgba(37,99,235,.08)":"var(--card-bg, #fff)",color:I?H||ls:"var(--text-muted)",transition:"all .15s ease"});return e.jsxs("div",{"data-guia-inventario-filtro":M,style:{marginTop:8},children:[e.jsx("style",{children:` 691 .invt-row { transition: background .15s ease; } 692 .invt-row:hover { background: var(--input-bg, #f6f8fb); } 693 .invt-th { cursor: pointer; transition: color .15s ease; } 694 .invt-th:hover { color: var(--text, #16181d); } 695 `}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap",margin:"0 2px 4px"},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:800,margin:0},children:"Inventario"}),t!==null&&e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:[Q.all," producto",Q.all===1?"":"s",Q.out>0&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{style:{color:"var(--danger)"},children:[Q.out," agotado",Q.out===1?"":"s"]})]}),Q.low>0&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{style:{color:"var(--warning)"}
695,children:[Q.low," con stock bajo"]})]})]})]}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 2px 12px",lineHeight:1.45},children:"Toca el costo, tu stock o el aviso para editarlos en la fila (Enter guarda). La Bodega Dropi es solo lectura."}),a.length>0&&e.jsxs("div",{style:{...Ll,borderLeft:`4px solid ${a.some(I=>I.level==="critical")?"var(--danger)":"var(--warning)"}`,marginBottom:12,padding:"12px 14px"},children:[e.jsxs("div",{style:{fontSize:13.5,fontWeight:800,marginBottom:6},children:["Alertas de stock (",a.length,")"]}),a.slice(0,8).map((I,H)=>e.jsxs("div",{style:{fontSize:12.5,color:I.level==="critical"?"var(--danger)":"var(--warning)",fontWeight:600,marginBottom:3},children:["⢠",I.title]},H))]}),$.length>0&&e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",marginBottom:10},children:[e.jsx("input",{style:{flex:"1 1 190px",minWidth:150,padding:"8px 12px",fontSize:13,border:"1.5px solid var(--border, #dde)",borderRadius:10,background:"var(--input-bg, #fff)",color:"var(--text, #111)",outline:"none",transition:"border-color .15s ease, box-shadow .15s ease"},value:N,onChange:I=>w(I.target.value),onFocus:I=>{I.currentTarget.style.borderColor=ls,I.currentTarget.style.boxShadow="0 0 0 3px rgba(37,99,235,.12)"},onBlur:I=>{I.currentTarget.style.borderColor="var(--border, #dde)",I.currentTarget.style.boxShadow="none"},placeholder:"Buscar por nombre, slug o producto Dropiâ¦"}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Re.map(([I,H])=>e.jsxs("span",{"data-guia":`inventario.${I}`,style:K(M===I,I==="out"?"#dc2626":I==="low"?"#d97706":I==="ok"?"#16a34a":void 0),onClick:()=>p(I),children:[H,I==="all"?` (${Q.all})`:Q[I]>0?` (${Q[I]})`:""]},I))})]}),t===null?e.jsx("div",{style:{...Ll,textAlign:"center",color:"var(--text-muted)",padding:30},children:"Cargando inventarioâ¦"}):$.length===0?e.jsx("div",{style:{...Ll,textAlign:"center",color:"var(--text-muted)",padding:30},children:"Publica productos para llevar su inventario aquÃ."}):U.length===0?e.jsx("div",{style:{...Ll,textAlign:"center",color:"var(--text-muted)",padding:24},children:"Ningún producto coincide con la búsqueda o el filtro."}):c?e.jsxs("div",{style:{display:"grid",gap:8},children:[(()=>{const I=B.getFilteredRowModel().rows,H=I.length>0&&I.every(De=>De.getIsSelected()),ye=I.some(De=>De.getIsSelected());return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,fontWeight:700,color:"var(--text-secondary)",padding:"2px 4px"},children:[e.jsx(mu,{ariaLabel:"Seleccionar lo visible",checked:H,indeterminate:ye&&!H,onChange:()=>{const De={};H||I.forEach(Ue=>{De[Ue.id]=!0}),L(De)}}),"Seleccionar lo visible",I.length?` (${I.length})`:""]})})(),U.map(I=>{const H=I.original,ye=Nl(H);return e.jsxs("div",{style:{...Ll,minWidth:0,overflow:"hidden",padding:"12px 14px",borderLeft:`4px solid ${ye==="out"?"#dc2626":ye==="low"?"#f59e0b":ye==="none"?"#cbd5e1":"#16a34a"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(mu,{ariaLabel:`Seleccionar ${H.name}`,checked:I.getIsSelected(),onChange:I.getToggleSelectedHandler()}
695),e.jsx("div",{style:{width:42,height:42,borderRadius:9,overflow:"hidden",flex:"none",background:"var(--input-bg, #f1f5f9)",border:"1px solid var(--border, #e8eaf0)"},children:H.image&&e.jsx("img",{src:H.image,alt:"",loading:"lazy",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:700,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:H.name}),H.status!=="published"&&e.jsx(Pl,{text:"BORRADOR",tone:"amber"}),!(H.price>0)&&e.jsx(Pl,{text:"SIN PRECIO",tone:"red"}),o&&H.storeHidden&&e.jsx(Pl,{text:"OCULTO",tone:"gray"})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)",marginTop:2},children:H.dropiPid?H.dropiName||`Dropi ${H.dropiPid}`:"Producto propio (sin Dropi)"})]}),e.jsx(py,{st:ye})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"10px 8px",marginTop:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:Bs,children:"Precio"}),e.jsx("div",{style:{fontSize:13,fontWeight:700,marginTop:3},children:H.price>0?zu(H.price):"â"})]}),e.jsxs("div",{children:[e.jsx("div",{style:Bs,children:"Costo"}),e.jsx("div",{style:{marginTop:3},children:e.jsx(gy,{it:H,costKey:v(H),entry:j(H),onSave:S})})]}),e.jsxs("div",{children:[e.jsx("div",{"data-guia":"inventario.entradas",style:Bs,children:"Tu stock"}),e.jsx("div",{style:{marginTop:3},children:e.jsx(Yl,{value:H.stockOwn,display:H.stockOwn!=null?H.stockOwn.toLocaleString("es-CO"):e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:"Llevar control"}),placeholder:"0",onSave:De=>i(H.landingId,{stock_own:De})})})]}),e.jsxs("div",{children:[e.jsx("div",{style:Bs,children:"Bodega Dropi"}),e.jsxs("div",{style:{fontSize:13,fontWeight:700,marginTop:3},children:[H.dropiPid&&typeof H.dropiStock=="number"?H.dropiStock.toLocaleString("es-CO"):"â",e.jsx("span",{style:{display:"block",fontSize:9,color:H.dropiActive===!1?"var(--danger)":"var(--text-muted)",fontWeight:H.dropiActive===!1?700:400},children:H.dropiPid?H.dropiActive===!1?"pausado en Dropi":"de Dropi · solo lectura":""})]})]}),e.jsxs("div",{children:[e.jsx("div",{"data-guia":"inventario.alertas",style:Bs,children:"Avisar si queda"}),e.jsx("div",{style:{marginTop:3},children:e.jsx(Yl,{value:H.stockMin??5,min:1,display:e.jsxs("span",{style:{fontWeight:600,fontSize:12.5},children:["â¤"," ",H.stockMin??5]}),onSave:De=>i(H.landingId,{stock_min:Math.max(1,De??5)}),width:56})})]}),e.jsxs("div",{children:[e.jsx("div",{style:Bs,children:"30 dÃas"}),e.jsx("div",{style:{fontSize:13,fontWeight:700,marginTop:3},children:H.sold30||0})]})]}),e.jsx("div",{style:{display:"flex",gap:6,marginTop:12,flexWrap:"wrap"},children:e.jsx(my,{it:H,storeOn:o,onEdit:u,onSetStoreHidden:s})})]},I.id)})]}):e.jsx("div",{style:{...Ll,overflow:"hidden"},children:e.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,minWidth:960},children:[e.jsx("thead",{children:B.getHeaderGroups().map(I=>e.jsx("tr",{children:I.headers.map(H=>{const ye=H.column.getCanSort(),De=H.column.getIsSorted();return e.jsxs("th",{className:ye?"invt-th":void 0,style:{...Y4,width:H.column.id==="select"?34:void 0,cursor:ye?"pointer":"default"},onClick:ye?H.column.getToggleSortingHandler():void 0,title:ye?"Ordenar":void 0,children:[H.isPlaceholder?null:cy(H.column.columnDef.header,H.getContext()),ye&&e.jsx(Z4,{dir:De})]},H.id)})},I.id))}),e.jsx("tbody",{children:U.map(I=>e.jsx("tr",{className:"invt-row",style:{background:I.getIsSelected()?"rgba(37,99,235,.045)":void 0},children:I.getVisibleCells().map(H=>e.jsx("td",{style:J4,children:cy(H.column.columnDef.cell,H.getContext())},H.id))},I.id))})]})})}),ne.length>0&&Wo.createPortal(e.jsxs("div",{style:{position:"fixed",left:"50%",transform:"translateX(-50%)",bottom:"calc(14px + env(safe-area-inset-bottom, 0px))",zIndex:1200,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",background:"#0f172a",color:"#fff",borderRadius:14,padding:"10px 14px",boxShadow:"0 14px 36px -10px rgba(15,23,42,.5)",maxWidth:"calc(100vw - 24px)"},children:[e.jsxs("span",{style:{fontSize:12.5,fontWeight:700,whiteSpace:"nowrap"},children:[ne.length," seleccionado",ne.length===1?"":"s"]}),ie?e.jsx("span",{style:{fontSize:12,color:"#a5f3c9",fontWeight:600,maxWidth:380},children:ie}):de?e.jsxs(e.Fragment,{children:[e.jsx("input",{autoFocus:!0,inputMode:"numeric",value:ce,onChange:I=>ve(I.target.value.replace(/[^0-9]/g,"")),onKeyDown:I=>{I.key==="Enter"&&ze(),I.key==="Escape"&&(pe(!1),ve(""))},placeholder:"Costo por unidad",style:{width:130,padding:"7px 10px",borderRadius:9,border:`1.5px solid ${ls}`,boxShadow:"0 0 0 3px rgba(37,99,235,.25)",fontSize:13,fontWeight:700,background:"#1e293b",color:"#fff",outline:"none"}}),e.jsx("button",{style:{...F,background:ls,borderColor:ls,opacity:ge?.6:1},disabled:ge,onClick:ze,children:ge?"Guardandoâ¦":"Aplicar"}),e.jsx("button",{style:F,onClick:()=>{pe(!1),ve("")},children:"Cancelar"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{style:F,onClick:()=>pe(!0),children:"Asignar costo"}),o&&e.jsx("button",{style:F,onClick:()=>Fe(!0),children:"Ocultar en tienda"}),o&&e.jsx("button",{style:F,onClick:()=>Fe(!1),children:"Mostrar en tienda"}),e.jsx("button",{style:F,onClick:tt,children:"Copiar nombres"})]}),e.jsx("button",{"aria-label":"Quitar selección",style:{...F,padding:"7px 9px",lineHeight:0},onClick:()=>B.resetRowSelection(),children:e.jsx("svg",{viewBox:"0 0 24 24",width:"11",height:"11",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),document.body)]})}function gy({it:t,costKey:a,entry:n,onSave:o}){return a?e.jsx(Yl,{value:n&&n.source==="override"?n.cost:null,display:n&&n.cost>0?zu(n.cost):e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:"Asignar"}),sub:n?n.source==="override"?"manual":n.source==="data"?"de la data":void 0:void 0,placeholder:n&&n.dataCost>0?String(n.dataCost):"0",onSave:i=>o([a],i??0)}):e.jsx(Yl,{value:null,display:"â",disabled:!0,disabledHint:t.dropiPid?"Dropi no reportó el nombre del producto; recarga para reintentar.":"Producto propio: el costo se asigna a productos de Dropi (es el nombre que cruza con tus pedidos).",sub:"sin Dropi",onSave:async()=>{}})}function my({it:t,storeOn:a,onEdit:n,onSetStoreHidden:o}){const[i,s]=h.useState(!1),[u,m]=h.useState(!1),c=async()=>{s(!0),m(!1);try{await o([t.landingId],!t.storeHidden)}catch{m(!0)}finally{s(!1)}};return e.jsxs("div",{style:{display:"flex",gap:6,whiteSpace:"nowrap"},children:[t.status==="published"&&e.jsx("a",{href:`/l/${t.slug}`,target:"_blank",rel:"noreferrer",style:{...Tp,textDecoration:"none",display:"inline-flex",alignItems:"center"},children:"Ver"}),e.jsx("button",{style:Tp,onClick:()=>n(t.landingId),children:"Editar"}),a&&t.status==="published"&&e.jsx("button",{disabled:i,title:u?"
695No se pudo guardar. Intenta de nuevo.":void 0,style:{...Tp,color:u?"var(--danger)":t.storeHidden?"var(--success)":"var(--text-muted)",opacity:i?.65:1},onClick:c,children:i?"Guardandoâ¦":u?"Reintentar":t.storeHidden?"Mostrar en tienda":"Ocultar en tienda"})]})}function eC(t){const a=(t==null?void 0:t.product)||{},n=(t==null?void 0:t.prelanding)||{},o=(t==null?void 0:t.page_type)==="advertorial",i=(Array.isArray(t==null?void 0:t.content_blocks)?t.content_blocks:[]).filter(b=>(b==null?void 0:b.type)==="image"&&typeof b.url=="string").map(b=>b.url),s=[...Array.isArray(a.images)?a.images:[],...i,n.image].filter(b=>typeof b=="string"&&/^https:\/\//i.test(b)).filter((b,v,j)=>j.indexOf(b)===v),u=[a.description,...a.bullets||[],...(t==null?void 0:t.bullets)||[]].filter(Boolean).map(String),m=o?[n.kicker,n.headline,n.subheadline,n.content].filter(Boolean).map(String):[],c=[...u,...m].join(" · ").slice(0,800),g=(o?[a.description,...m]:[a.description]).filter(Boolean).map(String).join(` 696`).slice(0,800),f=String(a.name||"").trim();return{productName:f,brief:g,context:c,images:s,hasInput:!!(f||c||s.length)}}function tC(t,a,n){const o={...t||{}};a!=null&&a.kicker&&n&&(o.kicker=String(a.kicker).slice(0,60)),a!=null&&a.headline&&n&&(o.headline=String(a.headline).slice(0,120)),a!=null&&a.subheadline&&n&&(o.subheadline=String(a.subheadline).slice(0,140));const i=Array.isArray(a==null?void 0:a.scenes)?a.scenes.slice(0,4):[];return i.length&&n&&(o.content=i.filter(s=>s&&String(s.heading||"").trim()&&String(s.body||"").trim()).map(s=>`## ${String(s.heading).trim()} 697${String(s.body).trim()}`).join(` 698`)),a!=null&&a.cta&&n&&(o.cta_text=String(a.cta).slice(0,40)),o}function hy(t,a){var n;return{...t,copy_length:a,product:a==="explicativa"?t.product:{...t.product,bullets:(((n=t.product)==null?void 0:n.bullets)||[]).slice(0,2)}}}const aC=390;function q2({html:t,title:a,anchoLogico:n=aC,alturaLogica:o=740,escalaMax:i=1,escalaMin:s=0,marco:u=!1,conScripts:m=!1,style:c}){const g=h.useRef(null),[f,b]=h.useState(0);h.useEffect(()=>{const C=g.current;if(!C)return;const _=()=>b(C.getBoundingClientRect().width);if(_(),typeof ResizeObserver>"u")return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_);const N=new ResizeObserver(_);return N.observe(C),()=>N.disconnect()},[]);const v=Math.max(0,f-(u?12:0)),j=v>0?Math.max(s,Math.min(i,v/n)):0,S=Math.round(n*j),$=Math.round(o*j)+(u?12:0);return e.jsx("div",{ref:g,style:{width:"100%",...c},children:e.jsx("div",{style:{position:"relative",width:S?S+(u?12:0):"100%",maxWidth:"100%",margin:"0 auto",height:$||1,overflowX:s&&j<=s?"auto":"hidden",overflowY:"hidden",background:"#fff",...u?{border:"6px solid #202331",borderRadius:24}:{}},children:j>0&&t&&e.jsx("iframe",{title:a,sandbox:m?"allow-scripts":"",srcDoc:t,style:{width:n,height:o,border:0,background:"#fff",transform:`scale(${j})`,transformOrigin:"top left",position:"absolute",top:0,left:0}})})})}const Qu=[{id:"directa",name:"Directa",description:"Va al beneficio y resuelve la objeción principal con rapidez."},{id:"demostrativa",name:"Demostrativa",description:"Explica el uso con escenas concretas y evidencia visual."},{id:"premium",name:"Premium",description:"Eleva el valor percibido con una presentación sobria y cuidada."}],nC=[{id:"editorial",name:"Revista",description:"Bloques sobre página blanca, titular con serifas y reseñas como notas a mano."},{id:"impulso",name:"Oferta",description:"El precio es el protagonista, con la comparativa que lo sostiene."},{id:"cercana",name:"Cercana",description:"Los testimonios arriba y el tono de quien ya lo compró."}],hu=[...Qu,...nC],oC={price:!0,offer:!0,photos:!0,reviews:!0,colors:!1};class M2 extends Error{constructor(){super("landing_studio_timeout"),this.name="LandingStudioTimeoutError"}}class Sc extends Error{constructor(){super("landing_studio_cancelled"),this.name="LandingStudioCancelledError"}}async function fy(t,a,n){if(n!=null&&n.aborted)throw new Sc;const o=new AbortController;let i=!1;const s=()=>o.abort();n==null||n.addEventListener("abort",s,{once:!0});const u=setTimeout(()=>{i=!0,o.abort()},Math.max(1,a));try{return await t(o.signal)}catch(m){throw i?new M2:n!=null&&n.aborted?new Sc:m}finally{clearTimeout(u),n==null||n.removeEventListener("abort",s)}}const rC=(t,a)=>!!t&&Object.prototype.hasOwnProperty.call(t,a);function Qo(t,a,n){rC(a,n)?t[n]=a[n]:delete t[n]}function iC(t,a,n){var s,u,m;const o={...t,product:{...(t==null?void 0:t.product)||{}}},i=(a==null?void 0:a.copy_length)==="explicativa"?6:2;if(["rapida","equilibrada","explicativa"].includes(String((a==null?void 0:a.copy_length)||""))&&(o.copy_length=a.copy_length),(t==null?void 0:t.page_type)==="advertorial")return o.prelanding=tC(t.prelanding,a,!0),Array.isArray(t.content_blocks)&&(o.content_blocks=t.content_blocks.filter(c=>(c==null?void 0:c.type)!=="h"&&(c==null?void 0:c.type)!=="p"),delete o.content_layout_v2),o;if((a!=null&&a.tagline||a!=null&&a.kicker)&&(o.product.tagline=a.tagline||a.kicker),a!=null&&a.hook&&(o.product.kicker=a.hook),a!=null&&a.headline&&(o.product.name=a.headline),a!=null&&a.subheadline&&(o.product.description=String(a.subheadline).slice(0,140)),Array.isArray(a==null?void 0:a.bullets)&&a.bullets.length&&(o.product.bullets=a.bullets.slice(0,i),((s=t.product)==null?void 0:s.bullets_center)===void 0&&(o.product.bullets_center=!0)),a!=null&&a.cta&&(o.form={...t.form||{},cta_text:String(a.cta).slice(0,40)}),(a!=null&&a.offer_box||a!=null&&a.offer_text)&&t.offer_text!==""&&(o.offer_text=a.offer_box||a.offer_text),a!=null&&a.delivery&&t.shipping_info!==""&&(o.shipping_info=a.delivery),a!=null&&a.form_title&&((u=t.form)==null?void 0:u.section_title)!==""&&(o.form={...o.form||t.form||{},section_title:String(a.form_title).slice(0,60)}),a!=null&&a.form_button_sub&&((m=t.form)==null?void 0:m.button_sub)!==""&&(o.form={...o.form||t.form||{},button_sub:String(a.form_button_sub).slice(0,60)}),a!=null&&a.guarantee&&(a.guarantee.title||a.guarantee.text)&&t.guarantee!==null&&(o.guarantee={...t.guarantee||{},...a.guarantee.title?{title:String(a.guarantee.title).slice(0,40)}:{},...a.guarantee.text?{text:String(a.guarantee.text).slice(0,220)}:{}}),a!=null&&a.announcement&&t.announcement!==null&&(o.announcement={...t.announcement||{},text:String(a.announcement).slice(0,80)}),Array.isArray(a==null?void 0:a.blocks)&&a.blocks.length){const c=[...a.blocks];Array.isArray(t.content_blocks)&&t.content_blocks.forEach((g,f)=>{var v,j;if(!g||g.type==="h"||g.type==="p")return;let b=Math.min(f,c.length);for(;b>0&&b<c.length&&((v=c[b-1])==null?void 0:v.type)==="h"&&((j=c[b])==null?void 0:j.type)==="p";)b++;c.splice(b,0,g)}),o.content_blocks=c.map(g=>g!=null&&g._k?g:{...g,_k:n()}),delete o.content_layout_v2}if(Array.isArray(a==null?void 0:a.bundles)&&a.bundles.length&&Array.isArray(t.bundles)){const c=new Map(a.bundles.map(g=>[Number(g.qty),g]));o.bundles=t.bundles.map(g=>{const f=c.get(Number(g.qty));return f?{...g,label:f.label||g.label,badge:f.badge||g.badge}:g})}return o}function sC(t,a){if(!a||typeof a!="object")return t;const n=!!a.style,o={...(t==null?void 0:t.theme)||{},...a.theme||{}};a.theme&&(a.theme.bg_anim?o.bg_anim_by="ai":o.bg_anim&&o.bg_anim_by==="ai"&&(delete o.bg_anim,delete o.bg_anim_by,delete o.bg_anim_intensity,delete o.bg_anim_color));const i={...t,theme:o};if(a.style&&(i.style=a.style),a.hero_style&&(i.hero_style=a.hero_style),a.form_style&&(i.form_style=a.form_style),a.reviews_style&&(i.reviews_style=a.reviews_style),a.hero_align?i.hero_align=a.hero_align:n&&delete i.hero_align,a.hero_title_size?i.hero_title_size=a.hero_title_size:n&&delete i.hero_title_size,a.hero_cut?i.hero_cut=a.hero_cut:n&&delete i.hero_cut,a.price_size?i.price_size=a.price_size:n&&delete i.price_size,a.headline_fx?i.headline_fx=a.headline_fx:n&&delete i.headline_fx,Array.isArray(a.section_blocks)){const s=(Array.isArray(t==null?void 0:t.section_blocks)?t.section_blocks:[]).map(String),u=new Set(s),m=new Set(["garantia","ficha"]),c=a.section_blocks.map(String).filter(g=>u.has(g)||m.has(g));i.section_blocks=[...new Set([...c,...s])]}return i}const lC=["accent","page_bg","button_color","button_text_color","price_color","compare_color","offers_color","form_bg","form_input_bg","form_input_border","form_input_icon_bg","form_focus_border","bg_anim","bg_anim_intensity","bg_anim_color","bg_anim_by"];function dC(t,a,n){const o={...a,product:{...(a==null?void 0:a.product)||{}},theme:{...(a==null?void 0:a.theme)||{}}};if(n.offer&&(Qo(o,t,"offer_text"),Qo(o,t,"bundles"),Qo(o,t,"bundles_preselect")),n.price&&(Qo(o.product,(t==null?void 0:t.product)||{},"price"),Qo(o.product,(t==null?void 0:t.product)||{},"compare_at_price"),!n.offer&&Array.isArray(o.bundles)&&Array.isArray(t==null?void 0:t.bundles)&&(o.bundles=o.bundles.map((i,s)=>{const u=t.bundles[s];if(!u)return i;const m={...i};return Qo(m,u,"price"),m}))),n.photos&&(Qo(o.product,(t==null?void 0:t.product)||{},"images"),Qo(o,t,"extra_images"),(o.prelanding||t!=null&&t.prelanding)&&(o.prelanding={...o.prelanding||{}},Qo(o.prelanding,(t==null?void 0:t.prelanding)||{},"image"))),n.reviews)for(const i of["reviews","reviews_off","reviews_max"])Qo(o,t,i);if(n.colors){for(const i of lC)Qo(o.theme,(t==null?void 0:t.theme)||{},i);for(const i of["hero_style","form_style","reviews_style"])Qo(o,t,i);Qo(o,t,"style")}return o}function cC(t,a,n,o){let i=0;const s=new Set((Array.isArray(t==null?void 0:t.content_blocks)?t.content_blocks:[]).map(c=>
698String((c==null?void 0:c._k)||"").trim()).filter(Boolean)),u=()=>{let c=`studio_${++i}`;for(;!c||s.has(c);)c=`studio_${++i}`;return s.add(c),c};let m=t;return(a.mode||"build")==="build"&&a.copy&&(m=iC(m,a.copy,u)),a.design&&(m=sC(m,a.design)),dC(t,m,n)}function uC(t,a,n){var o;return((o=a.find(i=>i.id===n))==null?void 0:o.config)??t}const xy=t=>Array.isArray(t)?t.map(a=>typeof a=="string"?a:(a==null?void 0:a.text)||"").filter(Boolean).join(", ").slice(0,90):t==null||t===""?"Sin definir":String(t).slice(0,90);function pC(t,a){return[{key:"tagline",label:"Etiqueta",get:o=>{var i,s;return(o==null?void 0:o.page_type)==="advertorial"?(i=o==null?void 0:o.prelanding)==null?void 0:i.kicker:(s=o==null?void 0:o.product)==null?void 0:s.tagline}},{key:"kicker",label:"Gancho",get:o=>{var i;return(o==null?void 0:o.page_type)==="advertorial"||(i=o==null?void 0:o.product)==null?void 0:i.kicker}},{key:"headline",label:"Titular",get:o=>{var i,s;return(o==null?void 0:o.page_type)==="advertorial"?(i=o==null?void 0:o.prelanding)==null?void 0:i.headline:(s=o==null?void 0:o.product)==null?void 0:s.name}},{key:"subheadline",label:"Bajada",get:o=>{var i,s;return(o==null?void 0:o.page_type)==="advertorial"?(i=o==null?void 0:o.prelanding)==null?void 0:i.subheadline:(s=o==null?void 0:o.product)==null?void 0:s.description}},{key:"benefits",label:"Beneficios",get:o=>{var i;return(i=o==null?void 0:o.product)==null?void 0:i.bullets}},{key:"copy_length",label:"Longitud",get:o=>o==null?void 0:o.copy_length},{key:"body",label:"Escenas de contenido",get:o=>{var i;return(o==null?void 0:o.page_type)==="advertorial"?(i=o==null?void 0:o.prelanding)==null?void 0:i.content:((o==null?void 0:o.content_blocks)||[]).filter(s=>(s==null?void 0:s.type)==="h"||(s==null?void 0:s.type)==="p").map(s=>s.text)}},{key:"layout",label:"Guion visual",get:o=>{var i;return((i=o==null?void 0:o.content_layout_v2)==null?void 0:i.mode)||"Clásico sin guion"}},{key:"cta",label:"Botón de compra",get:o=>{var i,s;return(o==null?void 0:o.page_type)==="advertorial"?(i=o==null?void 0:o.prelanding)==null?void 0:i.cta_text:(s=o==null?void 0:o.form)==null?void 0:s.cta_text}},{key:"offer",label:"Oferta",get:o=>o==null?void 0:o.offer_text},{key:"delivery",label:"Entrega",get:o=>o==null?void 0:o.shipping_info},{key:"form_title",label:"TÃtulo del formulario",get:o=>{var i;return(i=o==null?void 0:o.form)==null?void 0:i.section_title}},{key:"form_subtitle",label:"Ayuda del formulario",get:o=>{var i;return(i=o==null?void 0:o.form)==null?void 0:i.button_sub}},{key:"guarantee",label:"GarantÃa",get:o=>{var i,s;return[(i=o==null?void 0:o.guarantee)==null?void 0:i.title,(s=o==null?void 0:o.guarantee)==null?void 0:s.text].filter(Boolean).join(" / ")}},{key:"announcement",label:"Cintillo",get:o=>{var i;return(i=o==null?void 0:o.announcement)==null?void 0:i.text}},{key:"bundles",label:"Etiquetas de ofertas",get:o=>((o==null?void 0:o.bundles)||[]).map(i=>[i==null?void 0:i.label,i==null?void 0:i.badge].filter(Boolean).join(" / "))},{key:"style",label:"Estilo",get:o=>o==null?void 0:o.style},{key:"hero",label:"Portada",get:o=>o==null?void 0:o.hero_style},{key:"hero_align",label:"Alineación de portada",get:o=>o==null?void 0:o.hero_align},{key:"hero_title_size",label:"Tamaño del titular",get:o=>o==null?void 0:o.hero_title_size},{key:"hero_cut",label:"Cómo termina la foto",get:o=>(o==null?void 0:o.hero_cut)||"Corte recto"},{key:"price_size",label:"Tamaño del precio",get:o=>(o==null?void 0:o.price_size)||"Normal"},{key:"headline_fx",label:"Efecto del titular",get:o=>o==null?void 0:o.headline_fx},{key:"font",label:"TipografÃa",get:o=>{var i;return(i=o==null?void 0:o.theme)==null?void 0:i.font}},{key:"accent",label:"Color de marca",get:o=>{var i;return(i=o==null?void 0:o.theme)==null?void 0:i.accent}},{key:"background",label:"Fondo",get:o=>{var i;return(i=o==null?void 0:o.theme)==null?void 0:i.page_bg}},{key:"button",label:"Botón visual",get:o=>{var i,s,u;return[(i=o==null?void 0:o.theme)==null?void 0:i.button_color,(s=o==null?void 0:o.theme)==null?void 0:s.button_text_color,(u=o==null?void 0:o.theme)==null?void 0:u.button_style].filter(
698Boolean).join(" / ")}},{key:"button_shape",label:"Forma del botón",get:o=>{var i;return(i=o==null?void 0:o.theme)==null?void 0:i.button_radius}},{key:"animations",label:"Animaciones",get:o=>{var i,s,u,m,c;return[(i=o==null?void 0:o.theme)==null?void 0:i.button_animation,(s=o==null?void 0:o.theme)==null?void 0:s.sticky_anim,(u=o==null?void 0:o.theme)==null?void 0:u.bg_anim,(m=o==null?void 0:o.theme)==null?void 0:m.bg_anim_intensity,(c=o==null?void 0:o.theme)==null?void 0:c.bg_anim_color].filter(g=>g!==void 0&&g!=="").join(" / ")}},{key:"visual_axes",label:"Densidad y textura",get:o=>{var i,s,u,m,c;return[(i=o==null?void 0:o.theme)==null?void 0:i.radius_level,(s=o==null?void 0:o.theme)==null?void 0:s.density,(u=o==null?void 0:o.theme)==null?void 0:u.texture,(m=o==null?void 0:o.theme)==null?void 0:m.divider,(c=o==null?void 0:o.theme)==null?void 0:c.img_mask].filter(g=>g!==void 0&&g!=="").join(" / ")}},{key:"form",label:"Formulario",get:o=>o==null?void 0:o.form_style},{key:"reviews_style",label:"Presentación de reseñas",get:o=>o==null?void 0:o.reviews_style},{key:"section_blocks",label:"Bloques comerciales",get:o=>o==null?void 0:o.section_blocks}].flatMap(o=>{const i=xy(o.get(t)),s=xy(o.get(a));return i===s?[]:[{key:o.key,label:o.label,before:i,after:s}]})}const gC=9e4,mC=25e3,fu=()=>Qu.map(t=>({...t,status:"idle",diff:[]})),Dl={width:"100%",border:"1px solid var(--border, #dfe3ea)",borderRadius:10,background:"var(--card-bg, #fff)",color:"var(--text, #111827)",padding:"10px 11px",font:"inherit",fontSize:13};function Ep(t){return t instanceof M2?"La solicitud superó el tiempo de espera.":t instanceof Sc?"Generación cancelada.":t instanceof Error&&t.message&&!/^HTTP_/.test(t.message)?t.message:"La IA no respondió para esta variante."}function by({config:t,mode:a,compact:n,onApply:o,onApplied:i,renderPreview:s}){const u=$a(),[m,c]=h.useState(!1),[g,f]=h.useState(!1),[b,v]=h.useState(""),[j,S]=h.useState("Conseguir más pedidos calificados"),[$,C]=h.useState(String((t==null?void 0:t.audience)||"")),[_,N]=h.useState("frio"),[w,M]=h.useState("clara"),[p,V]=h.useState((t==null?void 0:t.page_type)==="advertorial"?"explicativa":(t==null?void 0:t.copy_length)||"equilibrada"),[L,x]=h.useState(""),[z,G]=h.useState({...oC}),[B,U]=h.useState(fu),[ne,Q]=h.useState(""),[de,pe]=h.useState([]),[ce,ve]=h.useState([]),[ge,Te]=h.useState(null),ie=h.useRef(null);h.useEffect(()=>()=>{var se;return(se=ie.current)==null?void 0:se.abort()},[]),h.useEffect(()=>{g||U(fu())},[j,$,_,w,p,L,z]),h.useEffect(()=>{if(!m||typeof document>"u")return;const se=document.body.style.overflow,we=Ye=>{var lt;if(Ye.key==="Escape"){if(ge){Te(null);return}(lt=ie.current)==null||lt.abort(),f(!1),c(!1)}};return document.body.style.overflow="hidden",window.addEventListener("keydown",we),()=>{document.body.style.overflow=se,window.removeEventListener("keydown",we)}},[m,ge]);const fe=a==="build"?"Armar con IA":"Rediseñar con IA",Be=B.filter(se=>se.status==="ready").length,We=h.useMemo(()=>eC(t),[t]),ze=(se,we)=>{U(Ye=>Ye.map(lt=>lt.id===se?{...lt,...we}:lt))},tt=()=>{var se;(se=ie.current)==null||se.abort(),ie.current=null,f(!1),v(""),c(!1)},Fe=()=>{var se;(se=ie.current)==null||se.abort(),ie.current=null,f(!1),U(we=>we.map(Ye=>Ye.status==="generating"?{...Ye,status:"failed",error:"Generación cancelada. Puedes reintentar esta variante."}:Ye))},F=async(se,we,Ye)=>fy(async lt=>{const jt=await u(se,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(we),signal:lt}),Je=await jt.json().catch(()=>({}));if(!jt.ok||(Je==null?void 0:Je.ok)===!1)throw new Error(String((Je==null?void 0:Je.message)||`HTTP_${jt.status}`));return Je},gC,Ye),Re=async(se,we,Ye)=>{var ct;ze(se.id,{status:"generating",error:"",warning:"",previewHtml:"",diff:[]});const lt=(t==null?void 0:t.product)||{},jt=We.images.slice(0,6),Je=(t==null?void 0:t.page_type)||"product",Ct=["rapida","equilibrada","explicativa"].includes(String(Ye==null?void 0:Ye.copy_length))?String(Ye.copy_length):"",st=Je==="advertorial"?"explicativa":Ct||p,la={country:(t==null?void 0:t.country)||void 0,page_type:Je,copy_length:st,content_text_align:t==null?void 0:t.content_text_align,product_name:We.productName,audience:$.trim(),objective:j.trim(),traffic_temperature:_,voice:w,studio_angle:se.id,direction:L.trim(),locked_fields:Object.entries(z).filter(([,xt])=>xt).map(([xt])=>xt),provider:"openai"},ia=a==="build"?F("/api/landing/generate-copy",{...la,brief:We.brief,images:jt,bundles:(Array.isArray(t==null?void 0:t.bundles)?t.bundles:[]).map(xt=>({qty:xt.qty,price:xt.price}))},we):null,ha=Ye?Promise.resolve(Ye):F("/api/landing/suggest-design",{...la,context:We.context.slice(0,800),price:Number(lt.price)||0,images:jt.slice(0,3),current_design:{style:t==null?void 0:t.style,hero_style:t==null?void 0:t.hero_style,form_style:t==null?void 0:t.form_style,reviews_style:t==null?void 0:t.reviews_style,theme:(t==null?void 0:t.theme)||{}},design_attempt:Qu.findIndex(xt=>xt.id===se.id)},we),da=await Promise.allSettled(ia?[ia,ha]:[ha]);if(we.aborted)throw new Sc;const Na=a==="build"?da[0]:null,wa=a==="build"?da[1]:da[0],La=(Na==null?void 0:Na.status)==="fulfilled"?Na.value.copy:void 0,Gt=(wa==null?void 0:wa.status)==="fulfilled"?wa.value:void 0,he=[(Na==null?void 0:Na.status)==="rejected"?`Textos: ${Ep(Na.reason)}`:"",(wa==null?void 0:wa.status)==="rejected"?`Diseño: ${Ep(wa.reason)}
698`:""].filter(Boolean);if(!La&&!Gt){ze(se.id,{status:"failed",error:he.join(" ")||"No se pudo generar esta variante."});return}const Me=cC(t,{copy:La,design:Gt,mode:a},z);let yt="",kt="";try{yt=await fy(xt=>s(Me,xt),mC,we)}catch(xt){if(xt instanceof Sc)throw xt;kt=Ep(xt)}ze(se.id,{status:yt?"ready":"failed",config:Me,previewHtml:yt,diff:pC(t,Me),explanation:String(((ct=Gt==null?void 0:Gt.rationale)==null?void 0:ct.why)||se.description).slice(0,500),nick:String((Gt==null?void 0:Gt._nick)||"").slice(0,40),nota:String((Gt==null?void 0:Gt._nota)||"").slice(0,400),warning:he.length?he.join(" "):"",error:kt?`No pudimos preparar la vista previa. ${kt}`:""})},K=async(se,we)=>{const Ye=(t==null?void 0:t.product)||{},lt=(t==null?void 0:t.page_type)||"product",jt=await F("/api/landing/suggest-design",{country:(t==null?void 0:t.country)||void 0,page_type:lt,copy_length:lt==="advertorial"?"explicativa":p,content_text_align:t==null?void 0:t.content_text_align,product_name:We.productName,audience:$.trim(),objective:j.trim(),traffic_temperature:_,voice:w,direction:L.trim(),locked_fields:Object.entries(z).filter(([,Ct])=>Ct).map(([Ct])=>Ct),provider:"openai",context:We.context.slice(0,800),price:Number(Ye.price)||0,compare_at_price:Number(Ye.compare_at_price)||0,images:We.images.slice(0,3),mode:a,studio_batch:!0,studio_angles:se},we),Je=new Map;for(const Ct of Array.isArray(jt==null?void 0:jt.variants)?jt.variants:[])Je.set(String(Ct.angle),{...Ct.design,rationale:jt.rationale,dynamics:jt.dynamics,_nota:Ct.nota,_nick:Ct.nick,_name:Ct.name});return{porAngulo:Je,disponibles:Array.isArray(jt==null?void 0:jt.disponibles)?jt.disponibles:[],aviso:String((jt==null?void 0:jt.aviso)||"")}},I=async()=>{var lt;if(!We.hasInput){Q("Escribe contenido o sube una foto primero.");return}(lt=ie.current)==null||lt.abort();const se=new AbortController;ie.current=se,Q("");const we=B.length?B.map(jt=>jt.id):Qu.map(jt=>jt.id);U(jt=>(jt.length?jt:fu()).map(Je=>({...Je,status:"generating",error:"",warning:""}))),f(!0);let Ye=null;try{Ye=await K(we,se.signal)}catch{}if(Ye&&(pe(Ye.disponibles),Ye.aviso&&Q(Ye.aviso)),await Promise.allSettled(we.map(jt=>{const Je=hu.find(Ct=>Ct.id===jt);return Re(Je,se.signal,Ye==null?void 0:Ye.porAngulo.get(jt))})),se.signal.aborted){U(jt=>jt.map(Je=>Je.status==="generating"?{...Je,status:"failed",error:"Generación cancelada. Puedes volver a intentarlo."}:Je)),f(!1);return}f(!1)},H=async se=>{const we=B.map(Ct=>Ct.id),Ye=new Set([...we,...ce]),lt=(de.length?de.map(Ct=>Ct.angle):hu.map(Ct=>Ct.id)).find(Ct=>!Ye.has(Ct));if(!lt){Q("Ya viste todas las direcciones que le quedan bien a este producto.");return}Q("");const jt=hu.find(Ct=>Ct.id===lt);U(Ct=>Ct.map(st=>st.id===se?{...jt,status:"generating",diff:[]}:st));const Je=ie.current&&!ie.current.signal.aborted?ie.current:new AbortController;ie.current=Je,f(!0);try{const Ct=await K([...we.filter(st=>st!==se),lt],Je.signal).catch(()=>null);await Re(jt,Je.signal,Ct==null?void 0:Ct.porAngulo.get(lt)),ve(st=>st.includes(se)?st:[...st,se])}finally{Je.signal.aborted||f(!1)}},ye=async se=>{const we=hu.find(lt=>lt.id===se);if(!we)return;const Ye=ie.current&&!ie.current.signal.aborted?ie.current:new AbortController;ie.current=Ye,f(!0);try{const lt=await K(B.map(jt=>jt.id),Ye.signal).catch(()=>null);await Re(we,Ye.signal,lt==null?void 0:lt.porAngulo.get(se))}finally{Ye.signal.aborted||f(!1)}},De=async se=>{const we=B.filter(lt=>!!lt.config).map(lt=>({id:lt.id,config:lt.config})),Ye=uC(t,we,se);if(Ye!==t){v(se),Q("");try{if(!await o(Ye,se)){Q("No se pudo guardar la versión anterior. No se aplicó ningún cambio.");return}i==null||i(),tt()}catch{Q("No se pudo aplicar la variante. La página sigue como estaba.")}finally{v("")}}},Ue=se=>G(we=>({...we,[se]:!we[se]}));return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>{c(!0),C(String((t==null?void 0:t.audience)||"")),V((t==null?void 0:t.page_type)==="advertorial"?"explicativa":(t==null?void 0:t.copy_length)||"equilibrada"),Q(""),U(fu())},className:n?"lk-ia-btn lk-ia-main":void 0,style:{padding:"8px 14px",borderRadius:10,border:n?void 0:0,background:n?void 0:"linear-gradient(96deg, #7c3aed, #0866FF)",color:n?void 0:"#fff",fontSize:13,fontWeight:800,cursor:"pointer"},children:fe}),m&&typeof document<"u"&&Wo.createPortal(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`${fe}, estudio de variantes`,onMouseDown:se=>{se.target===se.currentTarget&&tt()},style:{position:"fixed",inset:0,zIndex:10050,background:"rgba(8,12,24,.72)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:12},children:e.jsxs("div",{onMouseDown:se=>se.stopPropagation(),style:{width:"min(1480px, 100%)",height:"100%",overflow:"auto",borderRadius:18,background:"var(--bg, #f7f8fb)",color:"var(--text, #111827)",boxShadow:"0 30px 90px rgba(0,0,0,.35)"},children:[e.jsxs("div",{style:{position:"sticky",top:0,zIndex:3,display:"flex",alignItems:"center",flexWrap:"wrap",gap:12,padding:"14px 18px",borderBottom:"1px solid var(--border, #e5e7eb)",background:"var(--bg, #f7f8fb)"},children:[e.jsxs("div",{style:{flex:"1 1 220px",minWidth:0},children:[e.jsxs("div",{style:{fontSize:17,fontWeight:850},children:[fe," como estudio"]}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted, #64748b)",marginTop:2}
698,children:"Genera tres propuestas. Tu página no cambia hasta que elijas una."})]}),g&&e.jsx("button",{type:"button",onClick:Fe,style:{border:"1px solid var(--warning)",color:"var(--warning)",background:"transparent",borderRadius:9,padding:"8px 11px",fontWeight:750,cursor:"pointer"},children:"Cancelar generación"}),e.jsx("button",{type:"button",onClick:tt,"aria-label":"Cerrar",style:{border:"1px solid var(--border, #dfe3ea)",background:"var(--card-bg, #fff)",color:"inherit",borderRadius:9,padding:"8px 11px",fontWeight:750,cursor:"pointer"},children:"Cerrar"})]}),e.jsxs("div",{style:{padding:"16px 18px 24px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:10,padding:14,border:"1px solid var(--border, #e5e7eb)",borderRadius:14,background:"var(--card-bg, #fff)"},children:[e.jsxs("label",{style:{fontSize:12.5,fontWeight:750},children:["Objetivo",e.jsx("input",{disabled:g,value:j,onChange:se=>S(se.target.value.slice(0,180)),placeholder:"Conseguir más pedidos",style:{...Dl,marginTop:6}})]}),e.jsxs("label",{style:{fontSize:12.5,fontWeight:750},children:["Audiencia",e.jsx("input",{disabled:g,value:$,onChange:se=>C(se.target.value.slice(0,200)),placeholder:"Ej. mujeres de 25 a 45 años",style:{...Dl,marginTop:6}})]}),e.jsxs("label",{style:{fontSize:12.5,fontWeight:750},children:["Temperatura del tráfico",e.jsxs("select",{disabled:g,value:_,onChange:se=>N(se.target.value),style:{...Dl,marginTop:6},children:[e.jsx("option",{value:"frio",children:"FrÃo, aún no conoce la oferta"}),e.jsx("option",{value:"tibio",children:"Tibio, ya conoce el problema"}),e.jsx("option",{value:"caliente",children:"Caliente, ya está comparando"})]})]}),e.jsxs("label",{style:{fontSize:12.5,fontWeight:750},children:["Voz",e.jsxs("select",{disabled:g,value:w,onChange:se=>M(se.target.value),style:{...Dl,marginTop:6},children:[e.jsx("option",{value:"clara",children:"Clara y confiable"}),e.jsx("option",{value:"cercana",children:"Cercana"}),e.jsx("option",{value:"energica",children:"Enérgica"}),e.jsx("option",{value:"sobria",children:"Sobria"})]})]}),a==="build"&&e.jsxs("label",{style:{fontSize:12.5,fontWeight:750},children:["Longitud",e.jsxs("select",{value:p,onChange:se=>V(se.target.value),style:{...Dl,marginTop:6},disabled:g||(t==null?void 0:t.page_type)==="advertorial",children:[e.jsx("option",{value:"rapida",children:"Rápida, 2 escenas"}),e.jsx("option",{value:"equilibrada",children:"Equilibrada, 3 escenas"}),e.jsx("option",{value:"explicativa",children:"Explicativa, 4 escenas"})]})]}),e.jsxs("label",{style:{fontSize:12.5,fontWeight:750,gridColumn:"1 / -1"},children:["Dirección opcional",e.jsx("input",{disabled:g,value:L,onChange:se=>x(se.target.value.slice(0,180)),placeholder:a==="design"?"Ej. más premium, más directo, menos oscuro":"Ej. destacar facilidad de uso",style:{...Dl,marginTop:6}})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:800,marginBottom:7},children:"Bloquear para que la IA no lo cambie"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[["price","Precio"],["offer","Oferta"],["photos","Fotos"],["reviews","Reseñas"],["colors","Colores"]].map(([se,we])=>e.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:7,border:z[se]?"1px solid #7c3aed66":"1px solid var(--border, #dfe3ea)",background:z[se]?"#7c3aed10":"transparent",borderRadius:999,padding:"7px 10px",fontSize:12.5,fontWeight:700,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",disabled:g,checked:z[se],onChange:()=>Ue(se)})," ",we]},se))})]}),e.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:I,disabled:g||!!b,style:{border:0,borderRadius:10,background:"linear-gradient(96deg, #7c3aed, #0866FF)",color:"#fff",padding:"10px 15px",fontWeight:800,cursor:g?"default":"pointer",opacity:g?.65:1},children:g?"Generando variantesâ¦":Be?"Generar tres nuevas":"Generar tres variantes"}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted, #64748b)"},children:"Cada llamada tiene timeout y se puede cancelar. Si una falla, las otras siguen."})]})]}),ne&&e.jsx("div",{style:{marginTop:12,color:"var(--notice-danger-text)",border:"1px solid var(--notice-danger-border)",background:"var(--notice-danger-bg)",borderRadius:10,padding:"9px 11px",fontSize:12.5},children:ne}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 340px), 1fr))",gap:14,marginTop:16},children:B.map(se=>e.jsxs("article",{style:{minWidth:0,border:"1px solid var(--border, #dfe3ea)",borderRadius:15,background:"var(--card-bg, #fff)",overflow:"hidden",boxShadow:se.status==="ready"?"0 10px 30px rgba(35,45,80,.08)":"none"},children:[e.jsxs("div",{style:{padding:"12px 13px",borderBottom:"1px solid var(--border, #e5e7eb)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("strong",{style:{fontSize:15},children:se.name}),se.nick&&e.jsxs("span",{style:{fontSize:11.5,color:"var(--text-muted, #64748b)"},children:["· ",se.nick]}),e.jsx("span",{style:{marginLeft:"auto",fontSize:11.5,color:se.status==="failed"?"var(--danger)":"var(--text-muted, #64748b)"},children:se.status==="generating"?"Generando":se.status==="ready"?"Lista para comparar":se.status==="failed"?"No dis
698ponible":"Sin generar"})]}),e.jsx("p",{style:{margin:"5px 0 0",color:"var(--text-muted, #64748b)",fontSize:12,lineHeight:1.45},children:se.explanation||se.description}),se.nota&&e.jsx("p",{style:{margin:"6px 0 0",fontSize:11.5,lineHeight:1.45,color:"var(--text, #111827)",background:"var(--input-bg, #f6f7fb)",border:"1px solid var(--border, #e5e7eb)",borderRadius:8,padding:"7px 9px"},children:se.nota}),se.warning&&e.jsx("p",{style:{margin:"6px 0 0",color:"var(--warning)",fontSize:11.5,lineHeight:1.4},children:se.warning})]}),se.previewHtml?e.jsx(q2,{html:se.previewHtml,title:`Vista previa ${se.name}`,alturaLogica:620,conScripts:!0}):e.jsx("div",{style:{height:430,background:"#eef1f6",position:"relative"},children:e.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",padding:24,textAlign:"center",color:se.status==="failed"?"var(--danger)":"var(--text-muted, #64748b)",fontSize:12.5},children:se.status==="generating"?"Preparando la propuesta y su vista previaâ¦":se.error||"Genera las variantes para compararlas aquÃ."})}),e.jsxs("div",{style:{padding:12},children:[se.diff.length>0&&e.jsxs("details",{open:!0,children:[e.jsxs("summary",{style:{cursor:"pointer",fontSize:12.5,fontWeight:800},children:["Qué cambia (",se.diff.length,")"]}),e.jsx("div",{style:{display:"grid",gap:6,marginTop:8},children:se.diff.map(we=>e.jsxs("div",{style:{borderLeft:"3px solid #8b5cf6",paddingLeft:8,minWidth:0},children:[e.jsx("div",{style:{fontSize:11.5,fontWeight:800},children:we.label}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #64748b)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[we.before," â ",we.after]})]},we.key))})]}),se.status==="ready"&&e.jsxs("div",{style:{display:"flex",gap:8,marginTop:9},children:[e.jsx("button",{type:"button",onClick:()=>Te(se.id),style:{flex:1,border:"1px solid var(--border, #dfe3ea)",background:"transparent",color:"inherit",borderRadius:9,padding:"9px 10px",fontWeight:700,fontSize:12.5,cursor:"pointer",fontFamily:"inherit"},children:"Ver la página completa"}),e.jsx("button",{type:"button",onClick:()=>H(se.id),disabled:g,title:"Cambia solo esta, deja las otras como están",style:{flex:1,border:"1px solid var(--border, #dfe3ea)",background:"transparent",color:"inherit",borderRadius:9,padding:"9px 10px",fontWeight:700,fontSize:12.5,cursor:g?"default":"pointer",fontFamily:"inherit",opacity:g?.6:1},children:"Dame otra"})]}),se.status==="failed"&&e.jsx("button",{type:"button",onClick:()=>ye(se.id),disabled:g,style:{width:"100%",marginTop:9,border:"1px solid var(--border, #dfe3ea)",background:"transparent",color:"inherit",borderRadius:9,padding:"9px 10px",fontWeight:750,cursor:g?"default":"pointer"},children:"Reintentar esta variante"}),se.status==="ready"&&e.jsx("button",{type:"button",onClick:()=>De(se.id),disabled:!!b||g,style:{width:"100%",marginTop:10,border:0,background:"#111827",color:"#fff",borderRadius:9,padding:"10px 11px",fontWeight:800,cursor:b||g?"default":"pointer",opacity:b||g?.65:1},children:b===se.id?"Guardando versión y aplicandoâ¦":`Aplicar ${se.name}`})]})]},se.id))}),ge&&(()=>{const se=B.find(we=>we.id===ge);return se!=null&&se.previewHtml?Wo.createPortal(e.jsx("div",{onClick:()=>Te(null),style:{position:"fixed",inset:0,zIndex:2147483e3,background:"rgba(12,14,22,.72)",display:"flex",flexDirection:"column",alignItems:"center",padding:"18px 12px",overflow:"auto"},children:e.jsxs("div",{onClick:we=>we.stopPropagation(),style:{width:"100%",maxWidth:430,display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"#fff"},children:[e.jsx("strong",{style:{fontSize:15},children:se.name}),se.nick&&e.jsxs("span",{style:{fontSize:12,opacity:.75},children:["· ",se.nick]}),e.jsx("button",{type:"button",onClick:()=>Te(null),"aria-label":"Cerrar",style:{marginLeft:"auto",border:0,background:"rgba(255,255,255,.16)",color:"#fff",borderRadius:9,width:34,height:34,fontSize:19,lineHeight:1,cursor:"pointer",fontFamily:"inherit"},children:"Ã"})]}),e.jsx("iframe",{title:`Página completa ${se.name}
698`,sandbox:"allow-scripts",srcDoc:se.previewHtml,style:{width:"100%",height:"82vh",border:0,borderRadius:14,background:"#fff"}}),e.jsx("button",{type:"button",onClick:()=>{Te(null),De(se.id)},disabled:!!b||g,style:{border:0,background:"#111827",color:"#fff",borderRadius:11,padding:"12px 14px",fontWeight:800,fontSize:14,cursor:"pointer",fontFamily:"inherit"},children:"Usar esta"})]})}),document.body):null})()]})]})}),document.body)]})}const ap=[{id:"modern",label:"Moderna clara",description:"Space Grotesk + Inter",heading:"space",body:"inter"},{id:"editorial",label:"Editorial serena",description:"Fraunces + Lora",heading:"fraunces",body:"lora"},{id:"impact",label:"Impacto directo",description:"Archivo + Work Sans",heading:"archivo",body:"worksans"},{id:"warm",label:"Premium cálida",description:"Playfair + Nunito",heading:"playfair",body:"nunito"}];new Map(ap.map(t=>[t.id,t]));const hC={classic:"modern",boutique:"warm",brutal:"impact",bento:"modern",aurora:"editorial",cinema:"impact",advertorial:"editorial",tienda:"modern",express:"impact"};function fC(t){return hC[String(t||"classic")]||"modern"}function xC(t){var s,u,m,c,g;const a=t&&typeof t=="object"?t:{},n=a.theme&&typeof a.theme=="object"?a.theme:{},o=(Array.isArray((s=a.reviews)==null?void 0:s.items)?a.reviews.items:[]).filter(f=>f&&(String(f.text||"").trim()||String(f.name||"").trim())),i=Number((u=a.product)==null?void 0:u.price);return{style:String(a.style||"classic"),heroStyle:String(a.page_type==="simple"?"clasico":a.hero_style||"clasico"),formStyle:String(a.form_style||"clasico"),reviewsStyle:String(a.reviews_style||"lista"),buttonStyle:String(n.button_style||"plano"),buttonAnimation:n.button_animation===void 0?"shine":["shine","pulse"].includes(String(n.button_animation))?String(n.button_animation):"none",backgroundAnimation:String(n.bg_anim||""),backgroundIntensity:String(n.bg_anim_intensity||"sutil"),backgroundColor:String(n.bg_anim_color||""),productName:String(((m=a.product)==null?void 0:m.name)||"Tu producto"),image:String(((g=(c=a.product)==null?void 0:c.images)==null?void 0:g[0])||""),priceLabel:i>0?"$"+Math.round(i).toLocaleString("es-CO"):"Precio configurado",reviewLabel:a.reviews_off?"Reseñas ocultas":o.length?"Reseña real":"Sin reseñas cargadas",reviewCount:a.reviews_off?0:o.length}}function zp(t,a){const n={...t};a.theme&&(n.theme={...t.theme||{},...a.theme});for(const o of["style","hero_style","reviews_style","form_style","animations"])a[o]!==void 0&&(n[o]=a[o]);return n}const bC=[{path:"style",label:"Estilo general"},{path:"hero_style",label:"Hero"},{path:"form_style",label:"Formulario"},{path:"reviews_style",label:"Reseñas"},{path:"animations",label:"Animaciones de entrada"},{path:"theme.accent",label:"Color principal"},{path:"theme.page_bg",label:"Fondo de página"},{path:"theme.button_color",label:"Color del botón"},{path:"theme.button_text_color",label:"Texto del botón"},{path:"theme.button_radius",label:"Redondez del botón"},{path:"theme.button_size",label:"Tamaño del botón"},{path:"theme.button_shadow",label:"Sombra del botón"},{path:"theme.button_full_width",label:"Ancho del botón"},{path:"theme.button_style",label:"Estilo del botón"},{path:"theme.button_animation",label:"Movimiento del botón"},{path:"theme.font",label:"TipografÃa simple"},{path:"theme.font_pair",label:"Pareja tipográfica"},{path:"theme.bg_anim",label:"Fondo animado"},{path:"theme.radius_level",label:"Esquinas"},{path:"theme.density",label:"Densidad"},{path:"theme.texture",label:"Textura"},{path:"theme.divider",label:"Divisor"},{path:"theme.img_mask",label:"Marco de imágenes"}],yy=(t,a)=>a.split(".").reduce((n,o)=>n==null?void 0:n[o],t);function yC(t,a){return bC.flatMap(n=>{const o=yy(t,n.path),i=yy(a,n.path);return JSON.stringify(o)===JSON.stringify(i)?[]:[{...n,before:o,after:i}]})}const vC=[{id:"",nombre:"Ninguno",cuando:"Sin fondo animado."},{id:"aurora-azul",nombre:"Aurora azul",cuando:"Aurora en azules. Va con armazón oscuro."},{id:"aurora-violeta",nombre:"Aurora violeta",cuando:"Aurora en violetas. Va con armazón oscuro."},{id:"aurora-dorado",nombre:"Aurora dorada",cuando:"JoyerÃa, regalo y productos de estatus."},{id:"aurora-verde",nombre:"Aurora verde",cuando:"Natural, hogar y bienestar no sensible."},{id:"malla",nombre:"Malla",cuando:"TecnologÃa y productos modernos. No la combines con textura mesh."},{id:"puntos",nombre:"Puntos",cuando:"Minimal y limpio, cuando el producto debe mandar."},{id:"ondas",nombre:"Ondas",cuando:"Deporte, productos virales y páginas con energÃa."},{id:"blobs",nombre:"Manchas flotantes",cuando:"Belleza, moda y estilo de vida con fotos aspiracionales."},{id:"gradiente-vivo",nombre:"Gradiente vivo",cuando:"TecnologÃa y moda joven. Ãsalo con intensidad sutil o media."},{id:"destellos",nombre:"Destellos",cuando:"JoyerÃa, regalo, fiesta y productos nocturnos."},{id:"rejilla-3d",nombre:"Rejilla 3D",cuando:"Gadgets y gaming sobrio, con paleta oscura."},{id:"halo",nombre:"Halo",cuando:"Un producto protagonista de ticket alto, sobre todo joyerÃa y tecnologÃa."},{id:"grano",nombre:"Grano de pelÃcula",cuando:"Editorial, moda y marcas con carácter."},{id:"burbujas",nombre:"Burbujas",cuando:"Infantil, mascotas, bebidas y limpieza con tono alegre."},{id:"cometas",nombre:"Cometas",cuando:"Deporte y gaming con sensación de velocidad."},{id:"pulso",nombre:"Pulso",cuando:"Lanzamientos y páginas de una sola oferta."}];ap.map(t=>({id:t.id,nombre:t.label,cuando:t.description}));function Rp({s:t=9.5,general:a=!1,style:n}){const o=Math.round(t*1.1);return e.jsxs("span",{"data-origen":"tienda",title:a?"Escribió por WhatsApp desde tu tienda, sin elegir un producto.":"Nació en tu tienda (el carrito, su WhatsApp o la ficha de un producto), no en una landing.",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:t,fontWeight:800,color:"#4f46e5",background:"rgba(79,70,229,.12)",borderRadius:999,padding:"2px 8px",whiteSpace:"nowrap",...n},children:[e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flex:"none"},children:[e.jsx("path",{d:"M3 9l1.6-5h14.8L21 9"}),e.jsx("path",{d:"M4.5 9.5V20h15V9.5"}),e.jsx("path",{d:"M3 9a3 3 0 0 0 6 0a3 3 0 0 0 6 0a3 3 0 0 0 6 0"})]}),"Tienda"]})}const jC=t=>{if(!t||typeof t!="object")return t;if(t.modo_codigo_borrador&&typeof t.modo_codigo_borrador=="object"&&!Array.isArray(t.modo_codigo_borrador)){const{modo_codigo_borrador:o,lienzo_borrador:i,...s}=t;return{...s,...o}}if(typeof t.lienzo_borrador!="string")return t;const{lienzo_borrador:a,...n}=t;return{...n,lienzo_html:a}},F2=h.createContext("openai"),np=()=>h.useContext(F2);function AC({code:t,onClose:a}){const[n,o]=h.useState("idle");h.useEffect(()=>{const s=u=>{u.key==="Escape"&&a()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[a]);const i=async()=>{var s;try{if((s=navigator.clipboard)!=null&&s.writeText)await navigator.clipboard.writeText(t);else{const u=document.createElement("textarea");u.value=t,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.focus(),u.select();
698const m=document.execCommand("copy");if(u.remove(),!m)throw new Error("copy_failed")}o("copied")}catch{o("error")}};return Wo.createPortal(e.jsx("div",{role:"presentation",onMouseDown:s=>{s.currentTarget===s.target&&a()},style:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(15, 23, 42, .58)",display:"grid",placeItems:"center",padding:20},children:e.jsxs("section",{role:"dialog","aria-modal":"true","aria-labelledby":"share-landing-title",style:{width:"min(520px, 100%)",background:"var(--bg-card, #fff)",borderRadius:22,boxShadow:"0 28px 70px rgba(15, 23, 42, .28)",overflow:"hidden",border:"1px solid var(--border, #dbe4ee)"},children:[e.jsxs("div",{style:{padding:"24px 24px 18px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 6px",color:"var(--success)",fontSize:12,fontWeight:800,letterSpacing:".08em",textTransform:"uppercase"},children:"Compartir landing"}),e.jsx("h2",{id:"share-landing-title",style:{margin:0,color:"var(--text-primary, #172033)",fontSize:24,lineHeight:1.2},children:"Copia el código"}),e.jsx("p",{style:{margin:"8px 0 0",color:"var(--text-secondary, #64748b)",fontSize:14,lineHeight:1.5},children:"EnvÃalo al vendedor que recibirá esta landing en su cuenta de Lumy."})]}),e.jsx("button",{type:"button",onClick:a,"aria-label":"Cerrar",style:{width:38,height:38,borderRadius:12,border:"1px solid var(--border, #dbe4ee)",background:"var(--bg-card, #fff)",color:"var(--text-secondary, #475569)",fontSize:22,cursor:"pointer"},children:"Ã"})]}),e.jsxs("div",{style:{marginTop:20,padding:16,borderRadius:16,background:"var(--bg-tertiary, #f0fdfa)",border:"1px solid var(--border, #99f6e4)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:14},children:[e.jsx("code",{style:{color:"var(--success)",fontSize:24,fontWeight:800,letterSpacing:".08em",overflowWrap:"anywhere",userSelect:"all"},children:t}),e.jsx("button",{type:"button",onClick:i,style:{flex:"none",border:0,borderRadius:12,background:n==="copied"?"#047857":"#0f766e",color:"#fff",padding:"11px 16px",fontSize:14,fontWeight:800,cursor:"pointer"},children:n==="copied"?"Código copiado":"Copiar código"})]}),n==="error"?e.jsx("p",{role:"alert",style:{margin:"8px 2px 0",color:"var(--danger)",fontSize:13},children:"No se pudo copiar automáticamente. Selecciona el código y cópialo manualmente."}):null,e.jsxs("div",{style:{marginTop:16,padding:"14px 16px",borderRadius:14,background:"var(--bg-tertiary, #f8fafc)",color:"var(--text-secondary, #475569)",fontSize:13,lineHeight:1.55},children:[e.jsx("strong",{style:{color:"var(--text-primary, #1e293b)"},children:"Tu información sigue protegida."})," ","La landing se recibe como borrador. Tu pÃxel, ID de Dropi y dominio no se comparten. El código caduca en 90 dÃas."]})]}),e.jsx("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--border, #e2e8f0)",display:"flex",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:a,style:{border:"1px solid var(--border, #cbd5e1)",borderRadius:12,background:"var(--bg-card, #fff)",color:"var(--text-primary, #334155)",padding:"10px 18px",fontSize:14,fontWeight:800,cursor:"pointer"},children:"Cerrar"})})]})}),document.body)}function xu(t){if(!t)return"";const a=rn[String(t.pais||"").toUpperCase()],n=(a==null?void 0:a.name)||t.pais||"";if(t.fallo)return`no pudimos pasar sus pedidos a ${n}: siguen como estaban`;const o=Number(t.movidos)||0,i=Number(t.respetados)||0;if(t.sinLogisticaEnElPais)return i?`${i===1?"su pedido sigue":`sus ${i} pedidos siguen`} como ${i===1?"estaba":"estaban"}: tu logÃstica no tiene cuenta de ${n}`:"";if(!o&&!i)return"";const s=o?`${o} ${o===1?"pedido pasó":"pedidos pasaron"} a ${n}${a!=null&&a.currency?` y su valor pasa a contarse en ${a.currency}`:""}`:"",u=i?`${i} ${i===1?"se quedó":"se quedaron"} como ${i===1?"estaba":"estaban"} (pagados, de tu tienda, a medio despachar o de una bodega de otro paÃs)`:"";return[s,u].filter(Boolean).join(" · ")}const bu=6,me="#0866FF",vy=18e4,SC="https://chatgpt.com/g/g-6a06abeaa0c88191a3be639daec355e5-easy-creator-image",wC="https://chatgpt.com/g/g-6a06c9798f3481919a12a90c4bcdfa52-easy-creator-landing-page",jy=(t,a="57",n=10)=>{const o=String(t||"").replace(/\D/g,"");return o?o.length>n?o:a+o:""},ic=(t,a,n)=>{const o=String((t==null?void 0:t.country)||"").trim().toUpperCase(),i=o?rn[o]:null;return i?jy(t==null?void 0:t.phone,i.phoneCc,i.natLen):jy(t==null?void 0:t.phone,a,n)},kC=(t,a="57",n=10)=>{const o=String(t||"").replace(/\D/g,"");return o.length>n&&o.startsWith(a)?o.slice(a.length):o};function Np({phone:t,cc:a,natLen:n,children:o,style:i}){const[s,u]=h.useState(!1),m=async c=>{c.preventDefault(),c.stopPropagation();const g=kC(t,a,n);if(!g)return;let f=!1;try{await navigator.clipboard.writeText(g),f=!0}catch{}if(!f)try{const b=document.createElement("textarea");b.value=g,b.setAttribute("readonly",""),b.style.position="fixed",b.style.top="-1000px",b.style.opacity="0",document.body.appendChild(b),b.select(),f=document.execCommand("copy"),b.remove()}catch{f=!1}f&&(u(!0),setTimeout(()=>u(!1),1300))};return e.jsx("span",{onClick:m,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),m(c))},title:s?"Copiado":"Tócalo para copiarlo sin indicativo",style:{cursor:"pointer",borderRadius:5,transition:"background .15s ease, color .15s ease",...s?{background:"rgba(37,211,102,.16)",color:"#128C4A"}:null,...i},children:s?"Copiado":o})}const tc=t=>String(t||"").replace(/\D/g,"").length>=7;function yu({sub:t,href:a,style:n,title:o,children:i}){const s=$a(),[u,m]=h.useState(!1),[c,g]=h.useState("pick"),[f,b]=h.useState(!1),[v,j]=h.useState(null),S=String(t.country||"").trim().toUpperCase(),$=S?"?pais="+encodeURIComponent(S):"",[C,_]=h.useState(null),[N,w]=h.useState([]),[M,p]=h.useState({}),[V,L]=h.useState(""),[x,z]=h.useState(!1),[G,B]=h.useState(null),U=async()=>{var pe,ce,ve,ge,Te;if(g("tpl"),B(null),v===null){b(!0);try{const[ie,fe,Be]=await Promise.all([s("/api/whatsapp/seller/status").then(K=>K.json()).catch(()=>null),s("/api/whatsapp/seller/templates"+$).then(K=>K.json()).catch(()=>null),s("/api/whatsapp/seller/flow"+$).then(K=>K.json()).catch(()=>null)]);j(!!(ie!=null&&ie.connected)),_(fe!=null&&fe.sinNumeroPais?{pais:String(fe.pais||S),nombre:String(fe.paisNombre||"")}:null);const We=((fe==null?void 0:fe.templates)||[]).filter(K=>String(K.status).toUpperCase()==="APPROVED").map(K=>{var H;const I=String(((H=(K.components||[]).find(ye=>String(ye.type).toUpperCase()==="BODY"))==null?void 0:H.text)||"");return{name:String(K.name),language:String(K.language||"es"),body:I,vars:KA(I)}});w(We);const ze=(Be==null?void 0:Be.config)||{},tt={},Fe=K=>{K!=null&&K.name&&Array.isArray(K==null?void 0:K.vars)&&(tt[String(K.name)]=K.vars.map(I=>String(I)))};Fe(ze.initial),Object.values(ze.stages||{}
698).forEach(Fe),(ze.reminders||[]).forEach(K=>Fe(K==null?void 0:K.template)),(ze.carts||[]).forEach(K=>Fe(K==null?void 0:K.template)),(ze.payPending||[]).forEach(K=>Fe(K==null?void 0:K.template)),p(tt);const F=(Be==null?void 0:Be.config)||{},Re=((ce=(pe=F==null?void 0:F.stages)==null?void 0:pe[String(t.stage||"")])==null?void 0:ce.name)||(["nuevo","contactado","lead_wa","confirmado"].includes(String(t.stage||""))?(ve=F==null?void 0:F.initial)==null?void 0:ve.name:"")||((ge=We[0])==null?void 0:ge.name)||"";L(We.some(K=>K.name===Re)?Re:((Te=We[0])==null?void 0:Te.name)||"")}finally{b(!1)}}},ne=()=>{t!=null&&t.id&&s("/api/landing/submissions/"+t.id+"/gestion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intento:!0})}).catch(()=>{})},Q=async()=>{const pe=N.find(ce=>ce.name===V);if(!(!pe||x)){z(!0),B(null);try{const ce=YA(pe.name,pe.body,pe.vars,M),ge=await(await s("/api/whatsapp/seller/flow/send-manual",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({submission_id:t.id,name:pe.name,language:pe.language,vars:ce,bodyText:pe.body})})).json().catch(()=>({}));ge.ok?(B({ok:!0,text:"Enviado. Lo verás en la Bandeja de tu módulo de WhatsApp."}),ne()):B({ok:!1,text:ge.message||"No se pudo enviar."})}catch{B({ok:!1,text:"Error de conexión."})}finally{z(!1)}}},de=(t.name||"").split(" ")[0]||"el cliente";return e.jsxs(e.Fragment,{children:[e.jsx("a",{href:a,title:o,onClick:pe=>{pe.preventDefault(),g("pick"),B(null),m(!0)},style:{cursor:"pointer",...n},children:i}),u&&Wo.createPortal(e.jsx("div",{onClick:()=>m(!1),style:{position:"fixed",inset:0,zIndex:100002,background:"rgba(10,14,20,.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:pe=>pe.stopPropagation(),style:{width:400,maxWidth:"94vw",background:"var(--card-bg, #fff)",borderRadius:16,padding:18,boxShadow:"0 24px 70px rgba(0,0,0,.35)",animation:"waSmartIn .18s cubic-bezier(.22,.61,.36,1) both"},children:[e.jsx("style",{children:"@keyframes waSmartIn{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("span",{style:{width:34,height:34,borderRadius:10,background:"#25D366",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Bo,{s:17})}),e.jsxs("b",{style:{fontSize:14.5,color:"var(--text, #111)"},children:["Escribirle a ",de]}),e.jsx("button",{onClick:()=>m(!1),style:{marginLeft:"auto",border:0,background:"transparent",fontSize:18,cursor:"pointer",color:"var(--text-muted, #8a90a2)",fontFamily:"inherit"},children:"Ã"})]}),c==="pick"?e.jsxs("div",{style:{display:"grid",gap:9},children:[e.jsxs("button",{onClick:U,style:{textAlign:"left",border:"1.5px solid #25D36655",background:"rgba(37,211,102,.07)",borderRadius:12,padding:"12px 14px",cursor:"pointer",fontFamily:"inherit"},children:[e.jsx("b",{style:{fontSize:13.5,display:"block",color:"var(--text, #111)"},children:"Automatizado (recomendado)"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted, #667085)",lineHeight:1.5},children:"EnvÃa una plantilla aprobada desde tu número conectado. Queda en tu Bandeja y abre la ventana de 24h."})]}),e.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",onClick:()=>{ne(),m(!1)},style:{display:"block",textAlign:"left",border:"1px solid var(--border, #e3e6ee)",background:"var(--card-bg, #fff)",borderRadius:12,padding:"12px 14px",textDecoration:"none",fontFamily:"inherit"},children:[e.jsx("b",{style:{fontSize:13.5,display:"block",color:"var(--text, #111)"},children:"Chat normal"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted, #667085)",lineHeight:1.5},children:"Abre WhatsApp con tu número de siempre y escribes tú a mano."})]})]}):e.jsxs("div",{children:[f?e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted, #667085)",padding:"12px 0"},children:"Cargando tus plantillasâ¦"}):v===!1?e.jsxs("div",{style:{fontSize:12.5,color:"var(--text, #333)",lineHeight:1.55},children:["Aún no tienes tu WhatsApp conectado. ",e.jsx("a",{href:"/whatsapp",style:{color:"#16a34a",fontWeight:800},children:"Conéctalo aquÃ"})," y vuelve."]}):C?e.jsxs("div",{style:{fontSize:12.5,color:"var(--text, #333)",lineHeight:1.55},children:["Este pedido es de ",C.nombre||"otro paÃs"," y no tienes un WhatsApp de ",C.nombre||"ese paÃs"," conectado. No se manda desde otro número. ",e.jsx("a",{href:"/whatsapp",style:{color:"#16a34a",fontWeight:800},children:"Conéctalo aquÃ"})," y vuelve."]}):N.length===0?e.jsxs("div",{style:{fontSize:12.5,color:"var(--text, #333)",lineHeight:1.55},children:["No tienes plantillas APROBADAS todavÃa. ",e.jsx("a",{href:"/whatsapp",style:{color:"#16a34a",fontWeight:800},children:"Créalas en el módulo de WhatsApp"})," (Meta las aprueba en minutos u horas)."]}):e.jsxs(e.Fragment,{children:[e.jsx("label",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted, #667085)",display:"block",marginBottom:5},children:"Plantilla (sugerida según la etapa del pedido)"}),e.jsx("select",{value:V,onChange:pe=>L(pe.target.value),style:{width:"100%",padding:"9px 10px",borderRadius:9,border:"1px solid var(--border, #e3e6ee)",fontFamily:"inherit",fontSize:13,background:"var(--card-bg, #fff)",color:"var(--text, #111)"},children:N.map(pe=>e.jsx("option",{value:pe.name,children:pe.name},pe.name))}),(()=>{const pe=N.find(ce=>ce.name===V);return pe!=null&&pe.body?e.jsx("div",{style:{marginTop:8,fontSize:11.5,color:"var(--text-muted, #667085)",background:"var(--input-bg, #f4f6fa)",borderRadius:9,padding:"8px 10px",maxHeight:96,overflowY:"auto",whiteSpace:"pre-wrap"},children:pe.body.slice(0,280)}):null})(),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted, #98a2b3)",marginTop:6},children:"Las variables se llenan solas con los datos de este pedido (nombre, producto, valorâ¦)."}),e.jsx("button",{onClick:Q,disabled:x||!V,style:{width:"100%",marginTop:12,padding:11,border:0,borderRadius:10,background:"#25D366",color:"#fff",fontWeight:800,fontSize:13.5,cursor:x?"default":"pointer",fontFamily:"inherit",opacity:x?.6:1},children:x?"Enviandoâ¦":"Enviar plantilla"})]}),G&&e.jsx("div",{role:"status",style:{marginTop:10,fontSize:12,fontWeight:700,color:G.ok?"var(--success)":"var(--danger)"},children:G.text}),e.jsx("button",{onClick:()=>g("pick"),style:{marginTop:10,border:0,background:"transparent",color:"var(--text-muted, #8a90a2)",fontSize:11.5,cursor:"pointer",fontFamily:"inherit",fontWeight:700},children:"â¹ Volver"})]})]})}),document.body)]})}const td=[{key:"name",label:"Nombre",type:"text",required:!0,placeholder:"Escribe tu nombre"},{key:"lastname",label:"Apellido",type:"text",required:!0,placeholder:"Escribe tu apellido"},{key:"phone",label:"Número de celular",type:"tel",required:!0,min:10,placeholder:"Ej: 300 123 4567"},{key:"email",label:"Correo electrónico (opcional)",type:"email",required:!1,placeholder:"Ej: [email protected]"},{key:"nota_wa",label:"ð Te enviaremos un mensaje por WhatsApp para confirmar tus datos. â Responde por favor para gestionar el despacho cuanto antes.",type:"note",color:"#0f766e"},{key:"department",label:"Departamento",type:"text",required:!0},{key:"nota_cobertura",label:"â Si tu ciudad o municipio no aparece en la lista, no tenemos cobertura en tu zona",type:"note",color:"#dc2626"},{key:"city",label:"Ciudad / Municipio",type:"text",required:!0,placeholder:"Ej: MedellÃn"},{key:"address",label:"Dirección completa",type:"text",required:!0,placeholder:"Ej: Calle 10 # 5-23, apto 201"},{key:"referencia",label:"Datos adicionales y punto de referencia",type:"text",placeholder:"Conjunto, torre, apto, casa, piso, barr
698io"},{key:"phone2",label:"Teléfono (opcional)",type:"tel",placeholder:"Otro número de contacto",min:7}];function O2(t,a,n){const o=Bg(a).filter(u=>!t.some(m=>m.key===u.key)&&!n.includes(u.key)).map(u=>({key:u.key,label:u.label,type:"text",required:u.required,placeholder:u.placeholder,...u.min?{min:u.min}:{}}));if(!o.length)return t;const i=t.slice();let s=i.findIndex(u=>u.key==="city"||/ciudad|municipio/i.test(u.label));return s=s>=0?s+1:i.length,i.splice(s,0,...o),i}const Ay=[{v:"text",l:"Texto"},{v:"tel",l:"Teléfono"},{v:"number",l:"Número"},{v:"email",l:"Email"},{v:"select",l:"Lista"},{v:"textarea",l:"Párrafo"},{v:"image",l:"Imagen / GIF"},{v:"note",l:"Texto / aviso"},{v:"banner",l:"Banner de sección"}],H2=[{v:"system",l:"Sistema (más rápida)"},{v:"inter",l:"Inter"},{v:"poppins",l:"Poppins"},{v:"montserrat",l:"Montserrat"},{v:"nunito",l:"Nunito"},{v:"roboto",l:"Roboto"},{v:"lato",l:"Lato"},{v:"playfair",l:"Playfair (elegante)"},{v:"fraunces",l:"Fraunces (editorial con carácter)"},{v:"lora",l:"Lora (serif suave)"},{v:"bitter",l:"Bitter (sólida, robusta)"},{v:"space",l:"Space Grotesk (tech)"},{v:"archivo",l:"Archivo (impacto)"},{v:"worksans",l:"Work Sans (limpia)"},{v:"karla",l:"Karla (minimal cálida)"},{v:"baloo",l:"Baloo (redondeada alegre)"}],CC=[{v:"s",l:"Pequeño"},{v:"m",l:"Mediano"},{v:"l",l:"Grande"}];function Sy(t){var a;return(((a=H2.find(n=>n.v===(t||"system")))==null?void 0:a.l)||"Sistema").replace(/ \(.*\)/,"")}const _C=[{id:"lumy",name:"Lumy",style:"classic",theme:{accent:"#0866FF",button_text_color:"#ffffff",page_bg:"#f7f8fc",button_radius:13,font:"inter",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"esmeralda",name:"Esmeralda",style:"classic",theme:{accent:"#059669",button_text_color:"#ffffff",page_bg:"#f0fdf4",button_radius:16,font:"poppins",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"coral",name:"Coral",style:"classic",theme:{accent:"#e11d48",button_text_color:"#ffffff",page_bg:"#fff5f5",button_radius:24,font:"nunito",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"naranja",name:"EnergÃa",style:"classic",theme:{accent:"#ea580c",button_text_color:"#ffffff",page_bg:"#fff7ed",button_radius:10,font:"montserrat",button_size:"l",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"elegante",name:"Elegante",style:"classic",theme:{accent:"#1e293b",button_text_color:"#ffffff",page_bg:"#f8fafc",button_radius:4,font:"playfair",button_size:"m",button_shadow:!1,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"morado",name:"Moderno",style:"classic",theme:{accent:"#7c3aed",button_text_color:"#ffffff",page_bg:"#faf5ff",button_radius:14,font:"inter",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none"}},{id:"clinica",name:"ClÃnica",style:"classic",hero_style:"clasico",reviews_style:"lista",form_style:"clasico",theme:{accent:"#0e7490",button_text_color:"#ffffff",page_bg:"#f8fafc",button_radius:10,font:"lato",button_size:"m",button_shadow:!1,button_full_width:!0,button_style:"plano",button_animation:"none",bg_anim:"",radius_level:2,density:"",texture:"",divider:"",img_mask:""}},{id:"boutique",name:"Boutique",style:"boutique",hero_style:"editorial",reviews_style:"destacada",form_style:"tarjetas",theme:{accent:"#9d174d",button_text_color:"#ffffff",page_bg:"#fdf8f6",button_radius:12,font:"playfair",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"shine",bg_anim:"",radius_level:2,density:"airy",texture:"paper",divider:"",img_mask:"arch"}},{id:"urbano",name:"Urbano",style:"brutal",hero_style:"tipografico",reviews_style:"tarjetas",form_style:"clasico",theme:{accent:"#111111",button_text_color:"#ffffff",page_bg:"#fffbeb",button_radius:6,font:"archivo",button_size:"l",button_shadow:!0,button_full_width:!0,button_style:"neobrutal",button_animation:"none",bg_anim:"",radius_level:0,density:"",texture:"lines",divider:"",img_mask:""}},{id:"noche",name:"Noche premium",style:"aurora",hero_style:"tarjeta",reviews_style:"destacada",form_style:"tarjetas",theme:{accent:"#8b5cf6",button_text_color:"#ffffff",page_bg:"#0e0e12",button_radius:14,font:"space",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"glow",button_animation:"shine",bg_anim:"",radius_level:2,density:"airy",texture:"",divi
698der:"",img_mask:""}},{id:"sneaker",name:"Sneaker premium",style:"cinema",hero_style:"inmersivo",reviews_style:"destacada",form_style:"panel",theme:{accent:"#2563eb",button_text_color:"#ffffff",page_bg:"#08080c",button_radius:14,font:"oswald",button_size:"l",button_shadow:!0,button_full_width:!0,button_style:"glow",button_animation:"shine",bg_anim:"halo",bg_anim_intensity:"sutil",radius_level:2,density:"airy",texture:"grain",divider:"",img_mask:""}},{id:"hogar",name:"Hogar cálido",style:"classic",hero_style:"clasico",reviews_style:"tarjetas",form_style:"tarjetas",theme:{accent:"#b45309",button_text_color:"#ffffff",page_bg:"#fbf7f0",button_radius:14,font:"nunito",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none",bg_anim:"",radius_level:3,density:"",texture:"paper",divider:"curva",img_mask:"blob"}},{id:"fitness",name:"EnergÃa fitness",style:"classic",hero_style:"split",reviews_style:"tarjetas",form_style:"clasico",theme:{accent:"#dc2626",button_text_color:"#ffffff",page_bg:"#ffffff",button_radius:10,font:"archivo",button_size:"l",button_shadow:!0,button_full_width:!0,button_style:"gradiente",button_animation:"pulse",bg_anim:"",radius_level:1,density:"compact",texture:"",divider:"diagonal",img_mask:""}},{id:"ternura",name:"Bebés y ternura",style:"classic",hero_style:"clasico",reviews_style:"whatsapp",form_style:"tarjetas",theme:{accent:"#db2777",button_text_color:"#ffffff",page_bg:"#fdf2f8",button_radius:22,font:"baloo",button_size:"m",button_shadow:!0,button_full_width:!0,button_style:"plano",button_animation:"none",bg_anim:"",radius_level:4,density:"",texture:"",divider:"zigzag",img_mask:"capsule"}},{id:"tech",name:"Tech minimal",style:"bento",hero_style:"tipografico",reviews_style:"lista",form_style:"minimal",theme:{accent:"#2563eb",button_text_color:"#ffffff",page_bg:"#f6f8fb",button_radius:8,font:"space",button_size:"m",button_shadow:!1,button_full_width:!0,button_style:"borde",button_animation:"none",bg_anim:"",radius_level:1,density:"",texture:"dots",divider:"",img_mask:""}},{id:"natural",name:"Natural eco",style:"classic",hero_style:"clasico",reviews_style:"lista",form_style:"clasico",theme:{accent:"#3f6212",button_text_color:"#ffffff",page_bg:"#f7f8f3",button_radius:14,font:"lora",button_size:"m",button_shadow:!1,button_full_width:!0,button_style:"plano",button_animation:"none",bg_anim:"",radius_level:3,density:"airy",texture:"paper",divider:"curva",img_mask:"blob"}},{id:"remate",name:"Remate impulso",style:"express",hero_style:"ticket",reviews_style:"whatsapp",form_style:"clasico",theme:{accent:"#ea580c",button_text_color:"#ffffff",page_bg:"#fffdf7",button_radius:12,font:"poppins",button_size:"l",button_shadow:!0,button_full_width:!0,button_style:"gradiente",button_animation:"pulse",bg_anim:"",radius_level:2,density:"compact",texture:"",divider:"",img_mask:""}}],wy=[{v:"classic",name:"Sin estilo (base)",desc:"El look limpio de siempre. Es el punto de partida: elÃgelo para quitar cualquier estilo que hayas probado.",chip:"#0866FF"},{v:"boutique",name:"Boutique",desc:"Serio y confiable pero cálido. Marca premium, cero look de producto barato.",chip:"#8A6D3B"},{v:"brutal",name:"Mercado Brutal",desc:"Bordes negros y sombras duras. Se siente creador independiente, ideal para TikTok/Meta.",chip:"#111111"},{v:"bento",name:"Bento Editorial",desc:"Celdas modulares y tipografÃa gigante. Cada sección es un argumento de compra.",chip:"#FF6B35"},{v:"aurora",name:"Aurora Premium",desc:"Fondo oscuro con gradientes y vidrio. Para productos de ticket alto.",chip:"#0E0E12"},{v:"cinema",name:"Cinemático",desc:"Oscuro e inmersivo, foto a todo lo alto, tÃtulos en mayúscula. Mucho impacto de marca.",chip:"#08080c"},{v:"advertorial",name:"Advertorial",desc:"Formato artÃculo que vende: lectura cómoda, tÃtulos serif. Ideal para tráfico frÃo de TikTok/Meta.",chip:"#8a6d3b"},{v:"tienda",name:"Tienda / Catálogo",desc:"GalerÃa en cuadrÃcula y tarjetas tipo producto. Se siente como una tienda seria.",chip:"#1f2430"},{v:"express",name:"Express",desc:"Fondo gris claro, titular grueso y fotos cuadradas. Todo apretado para comprar rápido desde el celular.",chip:"#0866FF"}],$C=[{v:"clasico",name:"Clásico"},{v:"tipografico",name:"Tipográfico"},{v:"split",name:"Dividido"},{v:"inmersivo",name:"Inmersivo"},{v:"tarjeta",name:"Tarjeta"},{v:"diagonal",name:"Diagonal"},{v:"editorial",name:"Editorial"},{v:"collage",name:"Collage"},{v:"ticket",name:"GuÃa de envÃo"}
698,{v:"vitrina",name:"Vitrina"},{v:"panorama",name:"Panorama"},{v:"video",name:"Video"},{v:"espejo",name:"Espejo"},{v:"cinta",name:"Cinta"},{v:"portada",name:"Portada"},{v:"mosaico",name:"Mosaico"},{v:"polaroid",name:"Polaroid"},{v:"orbita",name:"Ãrbita"},{v:"pista",name:"Pista 3D"},{v:"rasgado",name:"Rasgado"},{v:"periodico",name:"Periódico"},{v:"sello",name:"Sello postal"},{v:"cristal",name:"Cristal"},{v:"libre",name:"Libre (tu HTML)"}],IC=[{v:"izquierda",name:"Izquierda"},{v:"centro",name:"Centro"}],TC=[{v:"normal",name:"Normal"},{v:"grande",name:"Grande"},{v:"gigante",name:"Gigante"}],ky=[{v:"clasico",name:"Clásico"},{v:"tarjetas",name:"Tarjetas"},{v:"minimal",name:"Minimal"},{v:"recibo",name:"Recibo"},{v:"panel",name:"Panel"}],Cy=[{v:"lista",name:"Lista"},{v:"tarjetas",name:"Tarjetas"},{v:"destacada",name:"Destacada"},{v:"whatsapp",name:"Chat WhatsApp"},{v:"citas",name:"Citas"},{v:"notas",name:"Notas de papel"}];async function Lp(t,a,n=40){try{const i=await(await fetch(t,{...a,signal:AbortSignal.timeout(n*1e3)})).json().catch(()=>null);return i?{ok:!0,j:i}:{ok:!1,motivo:"Dropi respondió algo que no entendimos. Intenta de nuevo en un momento."}}catch(o){return(o==null?void 0:o.name)==="TimeoutError"||(o==null?void 0:o.name)==="AbortError"?{ok:!1,motivo:`Dropi no respondió en ${n} segundos. Suele ser que está lento, no que tu producto esté mal. Espera un minuto y vuelve a intentar.`}:{ok:!1,motivo:"No hay conexión con el servidor. Revisa tu internet y vuelve a intentar."}}}const EC=[{v:"",name:"Sin animación",desc:"Todo aparece de una, como hasta hoy."},{v:"suave",name:"Suave",desc:"Los bloques entran con un desvanecido corto. El más discreto."},{v:"subir",name:"Suben",desc:"Entran desde abajo. Se nota más y da sensación de página cuidada."},{v:"escala",name:"Acercan",desc:"Crecen un poco al entrar. Va bien con fotos grandes."}],_y=[{v:"",name:"Normal"},{v:"degradado",name:"Degradado"},{v:"marcador",name:"Marcador"},{v:"subrayado",name:"Subrayado"},{v:"sombra",name:"Sombra"},{v:"trazo",name:"Trazo"},{v:"brillo",name:"Brillo"},{v:"relieve",name:"Relieve"},{v:"neon",name:"Neón"},{v:"contorno",name:"Contorno"},{v:"cartel",name:"Cartel"},{v:"foto",name:"Foto en el texto"},{v:"recorte",name:"Recorte"},{v:"glitch",name:"Glitch"},{v:"cromado",name:"Cromado"},{v:"bloque",name:"Bloque"}];function $y({value:t,color:a,text:n="TÃtulo"}){return e.jsx("span",{style:{fontWeight:900,fontSize:15,lineHeight:1.1,...t==="degradado"?{backgroundImage:`linear-gradient(100deg,${a},#7c3aed)`,WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",color:"transparent"}:{},...t==="marcador"?{backgroundImage:`linear-gradient(transparent 55%, ${a}47 55%)`,padding:"0 3px"}:{},...t==="subrayado"?{textDecoration:"underline",textDecorationColor:a,textDecorationThickness:3,textUnderlineOffset:3}:{},...t==="sombra"?{textShadow:`2.5px 2.5px 0 ${a}59`}:{},...t==="trazo"?{backgroundImage:`linear-gradient(175deg, transparent 68%, ${a} 69% 82%, transparent 83%)`,backgroundRepeat:"no-repeat",paddingBottom:4}:{},...t==="brillo"?{backgroundImage:`linear-gradient(100deg,currentColor 0%,currentColor 42%,${a} 50%,currentColor 58%,currentColor 100%)`,backgroundSize:"280% 100%",backgroundPosition:"50% 0",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",color:"transparent"}:{},...t==="relieve"?{textShadow:"0 1px 0 rgba(255,255,255,.75), 0 -1px 0 rgba(10,15,32,.22)"}:{},...t==="neon"?{textShadow:`0 0 1px ${a}59, 0 0 4px ${a}59`}:{},...t==="contorno"?{WebkitTextStroke:`.7px ${a}`,paintOrder:"stroke fill"}:{},...t==="cartel"?{textShadow:`1.5px 1.5px 0 ${a}b8, 3px 3px 0 ${a}80, 4.5px 4.5px 0 ${a}52`}:{},...t==="recorte"?{WebkitTextStroke:"2.5px #fff",paintOrder:"stroke fill",filter:"drop-shadow(0 1.5px 3px rgba(10,15,32,.4))"}:{},...t==="glitch"?{textShadow:`2px 0 0 ${a}59, -2px 0 0 rgba(34,211,238,.5)`}:{},...t==="cromado"?{backgroundImage:"linear-gradient(180deg,#f8fafc 0%,#e2e8f0 36%,#94a3b8 50%,#cbd5e1 62%,#f1f5f9 100%)",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",color:"transparent"}:{},...t==="bloque"?{background:a,color:"#fff",padding:"1px 5px",boxShadow:"2px 2px 0 rgba(10,15,32,.2)"}:{}},children:n})}const zC=[{v:"plano",name:"Plano"},{v:"shine",name:"Destello"},{v:"glow",name:"Halo"},{v:"gradiente",name:"Gradiente"},{v:"press3d",name:"Botón 3D"},{v:"borde",name:"Borde"},{v:"neobrutal",name:"Brutal"},{v:"neon",name:"Neón"},{v:"liquido",name:"LÃquido"},{v:"relleno",name:"Relleno"},{v:"aura",name:"Aura"},{v:"saten",name:"Satén metálico"},{v:"orbe",name:"Orbe"},{v:"foco",name:"Foco"},{v:"burbuja",name:"Burbujas"}],RC=` 699.lbsd { display: inline-block; font-weight: 800; font-size: 11.5px; line-height: 1; padding: 9px 12px; border-radius: 9px; background: var(--db); color: var(--dt); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; } 700/* Andrés 2026-07-27: las miniaturas de los CUATRO nuevos. Sin esto la rejilla del editor los pinta 701 como una pÃldora lisa y el vendedor no ve qué está eligiendo, que es exactamente lo que pasaba con 702 "Destello" y por lo que parecÃa que no hacÃa nada. Espejan el efecto del servidor, en chiquito. */ 703.lbsd-saten { position: relative; overflow: hidden; isolation: isolate; 704 background: linear-gradient(100deg, var(--db), color-mix(in srgb, var(--db) 18%, transparent) 62%, #fff 100%); 705 border: 1px solid color-mix(in srgb, var(--db) 60%, transparent); } 706.lbsd-saten::before { content: ''; position: absolute; inset: -60%; z-index: -1; 707 background: conic-gradient(from 0deg, transparent 0deg, rgba(255,255,255,.55) 34deg, transparent 76deg, transparent 180deg, rgba(255,255,255,.4) 214deg, transparent 256deg, transparent 360deg); 708 animation: lbsdSaten 5.2s linear infinite; } 709@keyframes lbsdSaten { to { transform: rotate(360deg); } } 710.lbsd-orbe { position: relative; overflow: hidden; } 711.lbsd-orbe::before { content: ''; position: absolute; top: 50%; left: 0; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; 712 background: radial-gradient(circle, rgba(255,255,255,.5) 0%, rgba(255,255,255,.17) 42%, transparent 68%); 713 animation: lbsdOrbe 3.4s ease-in-out infinite; } 714@keyframes lbsdOrbe { 0% { transform: translateX(-110%); } 50% { transform: translateX(calc(100% + 110%)); } 100% { transform: translateX(calc(100% + 110%)); } } 715.lbsd-foco { position: relative; overflow: hidden; } 716.lbsd-foco::before { content: ''; position: absolute; top: 50%; left: 50%; width: 150%; aspect-ratio: 1; border-radius: 50%; 717 transform: translate(-50%, -50%) scale(.55); 718 background: radial-gradient(circle, rgba(255,255,255,.42) 0%, transparent 62%); 719 animation: lbsdFoco 2.8s ease-in-out infinite; } 720@keyframes lbsdFoco { 0%, 100% { transform: translate(-50%, -50%) scale(.5); opacity: .55; } 50% { transform: translate(-50%, -50%) scale(1); opacity: 1; } } 721.lbsd-burbuja { position: relative; overflow: hidden; } 722.lbsd-burbuja::before, .lbsd-burbuja::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.3); } 723.lbsd-burbuja::before { width: 15px; height: 15px; left: 16%; bottom: -15px; animation: lbsdBurb 4.6s ease-in-out infinite; } 724.lbsd-burbuja::after { width: 9px; height: 9px; left: 68%; bottom: -9px; animation: lbsdBurb 4.6s ease-in-out infinite 1.9s; } 725@keyframes lbsdBurb { 0% { transform: translateY(0) scale(.7); opacity: 0; } 18% { opacity: 1; } 78% { opacity: .55; } 100% { transform: translateY(-190%) scale(1.05); opacity: 0; } } 726.lbsd-glow { animation: lbsdGlow 2.6s ease-in-out infinite; } 727@keyframes lbsdGlow { 0%, 100% { box-shadow: 0 0 9px color-mix(in srgb, var(--db) 40%, transparent); } 50% { box-shadow: 0 0 18px color-mix(in srgb, var(--db) 80%, transparent); } } 728.lbsd-gradiente { background: linear-gradient(115deg, var(--db) 8%, color-mix(in srgb, var(--db) 72%, #fff) 50%, var(--db) 92%); background-size: 220% 100%; animation: lbsdGrad 5.5s ease-in-out infinite; } 729@keyframes lbsdGrad { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } } 730.lbsd-press3d { box-shadow: 0 3px 0 color-mix(in srgb, var(--db) 55%, #000), 0 6px 10px rgba(10,15,32,.2); } 731.lbsd-shine { position: relative; overflow: hidden; } 732.lbsd-shine::after { content: ''; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.6), rgba(255,255,255,0)); transform: skewX(-18deg); animation: lbsdShine 2.4s ease-in-out infinite; } 733@keyframes lbsdShine { 0% { left: -70%; } 55%, 100% { left: 130%; } } 734.lbsd-borde { background: transparent; color: var(--db); box-shadow: inset 0 0 0 2px var(--db); } 735.lbsd-neobrutal { border: 2px solid #111; box-shadow: 3px 3px 0 #111; border-radius: 7px; } 736.lbsd-neon { border: 1.5px solid color-mix(in srgb, var(--db) 55%, #fff); animation: lbsdNeon 2.2s ease-in-out infinite; } 737@keyframes lbsdNeon { 0%, 100% { box-shadow: 0 0 6px color-mix(in srgb, var(--db) 45%, transparent), inset 0 0 5px color-mix(in srgb, var(--db) 40%, transparent); } 50% { box-shadow: 0 0 13px color-mix(in srgb, var(--db) 80%, transparent), inset 0 0 8px color-mix(in srgb, var(--db) 65%, transparent); } } 738.lbsd-liquido { background: linear-gradient(130deg, var(--db), color-mix(in srgb, var(--db) 68%, #fff) 28%, color-mix(in srgb, var(--db) 78%, #000) 52%, color-mix(in srgb, var(--db) 58%, #fff) 74%, var(--db)); background-size: 320% 320%; animation: lbsdLiquid 4.2s ease-in-out infinite; } 739@keyframes lbsdLiquid { 0%, 100% { background-position: 0% 30%; } 50% { background-position: 100% 70%; } } 740.lbsd-relleno { box-shadow: inset 0 0 0 1.5px var(--db); animation: lbsdFill 4.6s ease-in-out infinite; } 741@keyframes lbsdFill { 0%, 12% { background: transparent; color: var(--db); } 34%, 74% { background: var(--db); color: var(--dt); } 94%, 100% { background: transparent; color: var(--db); } } 742.lbsd-aura { animation: lbsdAura 3.4s ease-in-out infinite; } 743@keyframes lbsdAura { 0%, 100% { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--db) 30%, transparent); } 50% { box-shadow: 0 0 7px 2.5px color-mix(in srgb, var(--db) 75%, #fff); } } 744@media (prefers-reduced-motion: reduce) { .lbsd-glow, .lbsd-gradiente, .lbsd-shine::after, .lbsd-neon, .lbsd-liquido, .lbsd-relleno, .lbsd-aura, .lbsd-saten::before, .lbsd-orbe::before, .lbsd-foco::before, .lbsd-burbuja::before, .lbsd-burbuja::after { animation: none; } } 745`;function G2({v:t,accent:a="#0866ff"}){const n=/^#[0-9a-f]{6}$/i.test(a)?a:"#0866ff",o={width:"100%",height:62,borderRadius:7,background:"#f3f5fa",border:"1px solid #e4e7f0",padding:6,display:"flex",flexDirection:"column",gap:4,overflow:"hidden",boxSizing:"border-box",position:"relative"},i={background:"linear-gradient(135deg, #c9d3e6, #a2b2cf)",borderRadius:3},s=(u,m,c)=>({width:u,height:m,borderRadius:2,background:c,flex:"none"});return t==="tipografico"?e.jsxs("div",{style:o,children:[e.jsx("div",{style:s("88%",8,"#28304a")}),e.jsx("div",{style:s("60%",8,"#28304a")}),e.jsx("div",{style:{...i,flex:1,marginTop:2}})]}):t==="split"?e.jsxs("div",{style:{...o,flexDirection:"row",gap:5},children:[e.jsx("div",{style:{...i,width:"46%"}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4,justifyContent:"center"},children:[e.jsx("div",{style:s("92%",6,"#28304a")}),e.jsx("div",{style:s("70%",4,"#28304a")}),e.jsx("div",{style:s("52%",4,"#b7bfd2")})]})]}):t==="inmersivo"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",inset:0,borderRadius:6}}),e.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,padding:6,background:"linear-gradient(180deg, rgba(10,12,22,0), rgba(10,12,22,.8))",display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:s("76%",6,"#fff")}),e.jsx("div",{style:s("46%",4,"rgba(255,255,255,.75)")})]})]}):t==="tarjeta"?e.jsx("div",{style:{...o,background:n+"1f",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{width:"72%",height:"80%",background:"#fff",borderRadius:5,boxSh
745adow:"0 4px 10px rgba(20,30,60,.3)",padding:5,display:"flex",flexDirection:"column",gap:3,boxSizing:"border-box"},children:[e.jsx("div",{style:{...i,flex:1}}),e.jsx("div",{style:s("68%",5,"#28304a")})]})}):t==="diagonal"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",inset:0,borderRadius:6,clipPath:"polygon(0 0,100% 0,100% 78%,0 100%)"}}),e.jsx("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:"42%",background:`linear-gradient(105deg, ${n}, ${n}8c)`,clipPath:"polygon(0 44%,100% 0,100% 100%,0 100%)"}}),e.jsxs("div",{style:{position:"absolute",left:6,right:6,bottom:6,display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:s("70%",6,"#fff")}),e.jsx("div",{style:s("44%",4,"rgba(255,255,255,.8)")})]})]}):t==="vitrina"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"flex-start",paddingTop:5},children:[e.jsx("div",{style:{position:"absolute",inset:"4px 8px 15px",borderRadius:6,border:`1px solid ${n}47`,background:`radial-gradient(120% 90% at 50% 30%, ${n}38, ${n}0d 58%, transparent)`}}),e.jsx("div",{style:{...i,position:"relative",width:"44%",height:30,borderRadius:4,boxShadow:`0 7px 10px -5px ${n}8c`}}),e.jsx("div",{style:{position:"relative",display:"flex",gap:4,justifyContent:"center"},children:[0,1,2].map(u=>e.jsx("div",{style:{width:8,height:8,borderRadius:99,background:u===0?n+"80":"#dfe4f0",border:"1px solid #c6cfe2"}},u))})]}):t==="panorama"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",left:0,right:0,top:0,height:"58%",borderRadius:"6px 6px 0 0"}}),e.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:"46%",background:`linear-gradient(100deg, ${n}, ${n}d1)`,borderRadius:"5px 5px 6px 6px",display:"flex",flexDirection:"column",justifyContent:"center",gap:3,padding:6,boxSizing:"border-box"},children:[e.jsx("div",{style:s("72%",6,"#fff")}),e.jsx("div",{style:s("44%",4,"rgba(255,255,255,.8)")})]})]}):t==="editorial"?e.jsxs("div",{style:o,children:[e.jsx("div",{style:s("30%",3,"#9aa3b8")}),e.jsx("div",{style:{...s("82%",8,"#28304a"),fontFamily:"Georgia, serif"}}),e.jsx("div",{style:s("58%",8,"#28304a")}),e.jsx("div",{style:{...i,flex:1,marginTop:2,border:"1.5px solid #cbb68a",borderRadius:2}})]}):t==="collage"?e.jsx("div",{style:{...o,alignItems:"center",justifyContent:"center",overflow:"visible"},children:e.jsxs("div",{style:{position:"relative",width:"78%",height:"78%"},children:[e.jsx("div",{style:{...i,position:"absolute",inset:"8% 20% 8% 0",borderRadius:4,transform:"rotate(-6deg)",boxShadow:"0 3px 8px rgba(20,30,60,.3)"}}),e.jsx("div",{style:{...i,position:"absolute",inset:"10% 0 6% 24%",borderRadius:4,transform:"rotate(5deg)",background:"linear-gradient(135deg, #b9c6de, #8fa2c4)",boxShadow:"0 3px 8px rgba(20,30,60,.3)"}})]})}):t==="ticket"?e.jsx("div",{style:{...o,background:"#fffdf7",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{width:"84%",height:"88%",background:"#fff",border:"1px dashed #9aa3b8",borderRadius:3,padding:5,boxSizing:"border-box",display:"grid",gridTemplateColumns:"1fr 30%",gap:5},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:s("86%",6,"#28304a")}),e.jsx("div",{style:s("62%",4,"#aab2c3")}),e.jsx("div",{style:{...s("100%",3,"#d1d6e1"),marginTop:"auto"}})]}),e.jsx("div",{style:{background:"repeating-linear-gradient(90deg,#28304a 0 2px,transparent 2px 4px)",opacity:.7}})]})}):t==="video"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",inset:0,borderRadius:6,background:"linear-gradient(120deg, #4c3aa8, #7a4fd0 55%, #2a2350)"}}),e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:6,background:"linear-gradient(90deg, rgba(8,10,20,.82) 0 46%, rgba(8,10,20,.15) 100%)"}}),e.jsx("span",{style:{position:"absolute",top:6,right:6,width:13,height:13,borderRadius:99,background:"rgba(255,255,255,.85)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:0,height:0,borderLeft:"4px solid #2a2350",borderTop:"3px solid transparent",borderBottom:"3px solid transparent",marginLeft:1}})}),e.jsxs("div",{style:{position:"absolute",left:6,right:6,bottom:6,display:"flex",flexDirection:"column",gap:3,alignItems:"flex-start"},children:[e.jsx("div",{style:{...s("34%",4,"rgba(255,255,255,.5)"),borderRadius:99}}),e.jsx("div",{style:s("74%",7,"#fff")}),e.jsx("div",{style:s("40%",3,"rgba(255,255,255,.7)")}),e.jsxs("div",{style:{display:"flex",gap:3,marginTop:1},children:[e.jsx("div",{style:{...s("26px",7,n),borderRadius:3}}),e.jsx("div",{style:{...s("22px",7,"#25D366"),borderRadius:3}})]})]})]}):t==="precio"?e.jsxs("div",{style:{...o,background:"#fff"},children:[e.jsx("div",{style:{...i,height:22}}),e.jsx("div",{style:s("58%",4,"#aab2c3")}),e.jsx("div",{style:{fontSize:19,lineHeight:.9,fontWeight:950,color:n,letterSpacing:"-1px"},children:"$ PRECIO"})]}):t==="espejo"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"flex-start",paddingTop:5,background:`linear-gradient(180deg, ${n}1c, #eef1f8 46%, #d8dce8 78%, #c3c9da)`},children:[e.jsx("div",{style:{...i,position:"relative",width:"42%",height:26,borderRadius:4,zIndex:1}}),e.jsx("div",{style:{position:"relative",width:"42%",height:12,borderRadius:4,background:"linear-gradient(135deg, #c9d3e6, #a2b2cf)",opacity:.35,transform:"scaleY(-1)",marginTop:1,WebkitMaskImage:"linear-gradient(180deg, transparent 20%, #000)",maskImage:"linear-gradient(180deg, transparent 20%, #000)"}}),e.jsx("div",{style:{position:"absolute",left:"12%",right:"12%",top:37,height:1.5,background:`linear-gradient(90deg, transparent, ${n}, transparent)`}})]}):t==="cinta"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"center",background:`linear-gradient(135deg, ${n}24, #f3f5fa 55%, ${n}1f)`},children:[e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",left:"-8%",top:4,fontSize:21,fontWeight:900,whiteSpace:"nowrap",letterSpacing:"-.5px",color:"transparent",WebkitTextStroke:`1px ${n}59`,transform:"rotate(-6deg)"},children:"HYPE HYPE HYPE"}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",left:"-16%",bottom:2,fontSize:14,fontWeight:900,whiteSpace:"nowrap",color:n+"21",transform:"rotate(-6deg)"},children:"HYPE HYPE HYPE HYPE"}),e.jsx("div",{style:{...i,position:"relative",width:"40%",height:34,borderRadius:5,boxSh
745adow:"0 8px 10px -5px rgba(10,15,32,.4)"}})]}):t==="portada"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",left:0,right:0,top:0,height:"62%",borderRadius:"6px 6px 0 0"}}),e.jsxs("div",{style:{position:"absolute",left:5,right:5,bottom:0,height:"52%",background:"#fff",borderRadius:"8px 8px 5px 5px",boxShadow:"0 -5px 12px -6px rgba(10,15,32,.45)",padding:"6px 7px",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:s("34%",2.5,"#9aa3b8")}),e.jsx("div",{style:{...s("84%",8,"#28304a"),fontFamily:"Georgia, serif"}}),e.jsx("div",{style:{...s("26%",2,n),marginTop:1}})]})]}):t==="mosaico"?e.jsxs("div",{style:{...o,padding:5,display:"grid",gridTemplateColumns:"1.7fr 1fr 1fr",gridTemplateRows:"1fr 1fr",gap:4},children:[e.jsx("div",{style:{...i,gridRow:"1 / span 2",borderRadius:6}}),e.jsx("div",{style:{...i,borderRadius:5,background:"linear-gradient(135deg, #b9c6de, #8fa2c4)"}}),e.jsx("div",{style:{...i,borderRadius:5}}),e.jsx("div",{style:{...i,borderRadius:5,background:"linear-gradient(135deg, #cdd6e8, #aab9d4)"}}),e.jsx("div",{style:{borderRadius:5,background:`linear-gradient(135deg, ${n}, ${n}b8)`,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:11},children:"â¦"})]}):t==="polaroid"?e.jsx("div",{style:{...o,alignItems:"center",justifyContent:"center",overflow:"visible"},children:e.jsxs("div",{style:{position:"relative",width:"58%",background:"#fff",padding:"4px 4px 12px",borderRadius:2,boxShadow:"0 6px 14px rgba(20,30,60,.35)",transform:"rotate(-2.5deg)"},children:[e.jsx("div",{style:{position:"absolute",top:-5,left:"50%",width:26,height:8,marginLeft:-13,background:n+"52",border:`1px solid ${n}33`,transform:"rotate(-4deg)",borderRadius:1}}),e.jsx("div",{style:{...i,height:30,borderRadius:1}})]})}):t==="orbita"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"center",background:`repeating-radial-gradient(circle at 50% 46%, transparent 0 9px, ${n}2e 9px 10px), #f3f5fa`},children:[e.jsx("span",{style:{position:"absolute",top:9,right:14,width:5,height:5,borderRadius:99,background:n,boxShadow:`0 0 7px ${n}`}}),e.jsx("div",{style:{...i,position:"relative",width:"38%",height:30,borderRadius:4}})]}):t==="pista"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"center",overflow:"hidden",background:`linear-gradient(180deg, #f3f5fa 30%, ${n}24)`},children:[e.jsx("div",{style:{position:"absolute",left:"-25%",right:"-25%",bottom:"-8%",height:"52%",background:`repeating-linear-gradient(90deg, ${n}59 0 1px, transparent 1px 12px), repeating-linear-gradient(0deg, ${n}47 0 1px, transparent 1px 9px)`,transform:"perspective(70px) rotateX(55deg)",transformOrigin:"50% 100%"}}),e.jsx("div",{style:{...i,position:"relative",width:"36%",height:28,borderRadius:4,boxShadow:`0 8px 9px -4px ${n}66`}})]}):t==="rasgado"?e.jsxs("div",{style:{...o,padding:0},children:[e.jsx("div",{style:{...i,position:"absolute",left:0,right:0,top:0,height:"58%",borderRadius:"6px 6px 0 0",clipPath:"polygon(0 0, 100% 0, 100% 78%, 94% 96%, 88% 74%, 81% 99%, 74% 78%, 67% 95%, 60% 72%, 53% 98%, 46% 76%, 39% 94%, 32% 70%, 25% 97%, 18% 76%, 11% 93%, 5% 72%, 0 92%)"}}),e.jsxs("div",{style:{position:"absolute",left:6,right:6,bottom:6,display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:s("26%",3,"#9aa3b8")}),e.jsx("div",{style:s("72%",7,"#28304a")}),e.jsx("div",{style:s("44%",4,"#b7bfd2")})]})]}):t==="periodico"?e.jsxs("div",{style:{...o,background:"#faf8f3"},children:[e.jsx("div",{style:{borderTop:"3px double #3a4054",paddingTop:3},children:e.jsx("div",{style:s("30%",2.5,"#9aa3b8")})}),e.jsx("div",{style:{...s("88%",9,"#20263a"),fontFamily:"Georgia, serif"}}),e.jsx("div",{style:{...i,flex:1,border:"1px solid #3a405480",borderRadius:1}})]}):t==="sello"?e.jsx("div",{style:{...o,alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{position:"relative",width:"64%",height:"82%",background:"#fff",padding:4,boxSizing:"border-box",boxShadow:"0 4px 12px rgba(20,30,60,.3)",backgroundImage:"radial-gradient(circle 2px at 4px 4px, #f3f5fa 2px, transparent 2.4px)",backgroundSize:"8px 8px"},children:[e.jsx("div",{style:{...i,width:"100%",height:"100%"}}),e.jsx("span",{style:{position:"absolute",top:-7,right:-9,width:24,height:24,border:`1.5px solid ${n}99`,borderRadius:99,transform:"rotate(12deg)",boxShadow:`inset 0 0 0 2.5px transparent, inset 0 0 0 3.5px ${n}55`}})]})}):t==="cristal"?e.jsx("div",{style:{...o,alignItems:"center",justifyContent:"center",background:`linear-gradient(135deg, ${n}59, ${n}1f 45%, ${n}4d)`},children:e.jsx("div",{style:{position:"relative",width:"74%",height:"74%",borderRadius:8,border:"1px solid rgba(255,255,255,.75)",background:"rgba(255,255,255,.38)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("div",{style:{...i,width:"52%",height:"62%",borderRadius:4}})})}):t==="libre"?e.jsxs("div",{style:{...o,alignItems:"center",justifyContent:"center",background:"#101423",border:"1px dashed #4a5578"},children:[e.jsx("div",{style:{fontFamily:"ui-monospace, monospace",fontSize:12,color:"#9fb3ff",fontWeight:700},children:"</>"}),e.jsx("div",{style:{...s("56%",4,"#3d4666"),borderRadius:2}}),e.jsx("div",{style:{...s("38%",4,"#3d4666"),borderRadius:2}})]}):e.jsxs("div",{style:o,children:[e.jsx("div",{style:{...i,flex:1}}),e.jsx("div",{style:s("70%",6,"#28304a")}),e.jsx("div",{style:s("44%",4,"#b7bfd2")})]})}function Iy({config:t}){const a=t.theme||{},n=String(t.style||"classic"),o=/^#[0-9a-f]{6}$/i.test(a.accent||"")?a.accent:"#0866ff",i=a.page_bg||"#f7f8fc",u=["aurora","cinema"].includes(n)||NC(i)<.45?"#ffffff"
745:"#0f1222",m=n==="brutal",c=m?2:Math.max(4,Math.min(14,(Number(a.radius_level)||3)*3+4)),g=(f,b=6,v=.22)=>({width:f,height:b,borderRadius:3,background:u,opacity:v});return e.jsxs("div",{"aria-hidden":!0,style:{background:i,borderRadius:9,padding:9,minHeight:108,display:"flex",flexDirection:"column",gap:6,border:m?`2px solid ${u}`:"1px solid rgba(120,130,160,.18)"},children:[e.jsx("div",{style:{height:34,borderRadius:Math.min(c,8),background:u,opacity:.14}}),e.jsx("div",{style:g("70%")}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("div",{style:{...g("100%"),flex:1}}),e.jsx("div",{style:{...g("34%"),maxWidth:"34%"}})]}),e.jsx("div",{style:{marginTop:"auto",height:15,borderRadius:Math.min(c,10),background:a.button_color||o}})]})}function NC(t){const a=/^#?([0-9a-f]{6})$/i.exec(String(t));if(!a)return 1;const n=parseInt(a[1],16);return(.2126*(n>>16&255)+.7152*(n>>8&255)+.0722*(n&255))/255}function c_({config:t}){var Re,K,I;const a=t.theme||{},n=xC(t),o=/^#[0-9a-f]{6}$/i.test(a.accent||"")?a.accent:"#0866ff",i=a.page_bg||"#f7f8fc",{image:s,style:u,formStyle:m,reviewsStyle:c,buttonStyle:g,buttonAnimation:f,backgroundAnimation:b,backgroundIntensity:v,backgroundColor:j,productName:S,priceLabel:$,reviewLabel:C,reviewCount:_}=n,N=["aurora","cinema"].includes(u),w=N?"#f8fafc":"#172033",M=N?"rgba(248,250,252,.62)":"#718096",p=ap.find(H=>H.id===a.font_pair),L=["playfair","fraunces","lora"].includes((p==null?void 0:p.heading)||a.font||"")||["boutique","advertorial"].includes(u)?"Georgia, serif":n.heroStyle==="ticket"?"monospace":"Arial, sans-serif",x=u==="brutal",z=a.density==="compact"||u==="express",G=x?2:u==="tienda"?5:Math.max(5,Math.min(15,Number(a.radius_level)*3+6||9)),B=(H,ye=M,De=3)=>({width:H,height:De,borderRadius:3,background:ye,opacity:.72}),U=a.texture==="dots"?`radial-gradient(${o}2b 1px,transparent 1.3px)`:a.texture==="lines"?`repeating-linear-gradient(0deg,transparent 0 13px,${o}1c 13px 14px)`:a.texture==="mesh"?`radial-gradient(70% 55% at 15% 8%,${o}2e,transparent 72%),radial-gradient(65% 55% at 88% 85%,#ec48992b,transparent 72%)`:a.texture==="paper"||u==="advertorial"?"repeating-linear-gradient(0deg,rgba(120,110,90,.035) 0 1px,transparent 1px 5px)":void 0,ne=/^#[0-9a-f]{6}$/i.test(j)?j:o,Q=v==="notoria"?"52":v==="media"?"38":"24",de=!b||b==="none"?void 0:b.startsWith("aurora")?`radial-gradient(70% 56% at 12% 8%,${ne}${Q},transparent 72%),radial-gradient(68% 58% at 88% 88%,#7c3aed${Q},transparent 74%)`:b==="malla"||b==="rejilla-3d"?`linear-gradient(${ne}24 1px,transparent 1px),linear-gradient(90deg,${ne}24 1px,transparent 1px)`:b==="puntos"||b==="destellos"?`radial-gradient(${ne}${Q} 1.2px,transparent 1.7px)`:b==="ondas"||b==="pulso"?`repeating-radial-gradient(circle at 50% 42%,${ne}${Q} 0 2px,transparent 3px 18px)`:b==="blobs"||b==="burbujas"?`radial-gradient(circle at 18% 22%,${ne}${Q} 0 12%,transparent 13%),radial-gradient(circle at 82% 76%,#ec4899${Q} 0 16%,transparent 17%)`:b==="halo"?`radial-gradient(circle at 50% 45%,transparent 20%,${ne}${Q} 22%,transparent 58%)`:b==="grano"?`repeating-linear-gradient(117deg,transparent 0 3px,${ne}16 3px 4px)`:b==="cometas"?`linear-gradient(128deg,transparent 18%,${ne}${Q} 20%,transparent 23%,transparent 66%,#ffffff38 68%,transparent 71%)`:`linear-gradient(135deg,${ne}${Q},transparent 52%,#7c3aed${Q})`,pe=[U,de].filter(Boolean),ce=[...U?[a.texture==="dots"?"13px 13px":"auto"]:[],...de?[["puntos","destellos"].includes(b)?"13px 13px":b==="malla"||b==="rejilla-3d"?"16px 16px":"100% 100%"]:[]],ve=a.button_color||o,ge=g==="gradiente"?`linear-gradient(120deg,${ve},${ve}99,#ffffffaa)`:g==="liquido"?`linear-gradient(135deg,${ve},#ffffff88 28%,${ve} 52%,#11111155 78%,${ve})`:g==="saten"?`linear-gradient(105deg,${ve},#ffffff99 48%,${ve} 72%)`:g==="orbe"?"radial-gradient(circle at 18% 50%,#ffffff88,transparent 34%)":g==="foco"?"radial-gradient(circle at 50% 50%,#ffffff80,transparent 62%)":g==="burbuja"?"radial-gradient(circle at 22% 70%,#ffffff70 0 7%,transparent 8%),radial-gradient(circle at 72% 28%,#ffffff65 0 5%,transparent 6%)":g==="shine"?"linear-gradient(110deg,transparent 22%,rgba(255,255,255,.72) 48%,transparent 70%)":void 0,ie={backgroundColor:g==="borde"||g==="relleno"?"transparent":ve,backgroundImage:[f==="shine"?"linear-gradient(110deg,transparent 25%,rgba(255,255,255,.52) 49%,transparent 72%)":void 0,ge].filter(
745Boolean).join(",")||void 0,color:a.button_text_color||"#fff",borderRadius:g==="neobrutal"?3:Math.min(10,Number(a.button_radius)||9),padding:a.button_size==="l"?"6px 8px":"5px 7px",fontSize:6.5,fontWeight:900,...g==="borde"?{background:"transparent",color:o,border:`1.5px solid ${o}`}:{},...g==="neobrutal"?{border:"1.5px solid #111",boxShadow:"2px 2px 0 #111"}:{},...g==="glow"?{boxShadow:`0 0 9px ${ve}88`}:{},...g==="aura"?{boxShadow:`0 0 0 2px ${ve}55, 0 0 8px ${ve}66`}:{},...g==="neon"?{border:`1px solid ${ve}`,boxShadow:`0 0 7px ${ve}, inset 0 0 5px ${ve}77`}:{},...g==="relleno"?{color:ve,boxShadow:`inset 0 0 0 1.5px ${ve}`}:{},...g==="press3d"?{boxShadow:`0 3px 0 ${ve}88`}:{},...f==="pulse"?{outline:`2px solid ${ve}55`,outlineOffset:1}:{}},fe={display:"flex",flexDirection:"column",gap:3,minHeight:31,borderRadius:m==="minimal"?0:G,padding:4,background:m==="panel"?o+"18":N?"rgba(255,255,255,.05)":"rgba(255,255,255,.76)",border:m==="recibo"?"1px dashed #98a2b3":m==="tarjetas"?"1px solid rgba(120,132,160,.22)":"none",fontFamily:m==="recibo"?"monospace":"inherit"},Be=m==="minimal"?{height:6,borderBottom:"1px solid rgba(120,132,160,.55)"}:{height:7,border:"1px solid rgba(120,132,160,.3)",borderRadius:m==="tarjetas"?5:3,background:m==="tarjetas"?"#fff":"transparent"},We={display:"flex",flexDirection:"column",justifyContent:"center",gap:3,minHeight:31,padding:4,borderRadius:c==="notas"?2:c==="whatsapp"?"8px 8px 2px 8px":G,background:c==="whatsapp"?"#dcfce7":c==="notas"?"#fff7c2":N?"rgba(255,255,255,.05)":"rgba(255,255,255,.76)",border:c==="citas"?`1px solid ${o}55`:"none",transform:c==="notas"?"rotate(-1deg)":void 0,color:c==="whatsapp"||c==="notas"?"#172033":w},ze=(I=(K=(Re=t.content_layout_v2)==null?void 0:Re.scenes)==null?void 0:K[0])==null?void 0:I.background,tt=(ze==null?void 0:ze.color)||o,Fe=n.heroStyle,F=a.img_mask==="arch"?"999px 999px 4px 4px":a.img_mask==="blob"?"42% 58% 60% 40% / 45% 40% 55% 60%":a.img_mask==="capsule"?20:G;return e.jsxs("div",{"data-testid":"recipe-mini-landing","data-style":u,"data-hero-style":Fe,"data-form-style":m,"data-reviews-style":c,"data-button-style":g,"data-button-animation":f,"data-bg-animation":b||"none",style:{height:a.density==="airy"?226:z?204:214,overflow:"hidden",borderRadius:9,backgroundColor:N&&i==="#f7f8fc"?"#0e0e12":i,backgroundImage:pe.join(",")||void 0,backgroundSize:ce.join(",")||void 0,color:w,padding:z?5:7,display:"flex",flexDirection:"column",gap:z?3:5,boxSizing:"border-box",border:x?"2px solid #111":u==="boutique"?"1px solid #cbbd9d":"1px solid rgba(120,132,160,.2)",boxShadow:x?"3px 3px 0 #111":u==="aurora"?`inset 0 0 24px ${o}2e`:"none",fontFamily:u==="advertorial"?"Georgia, serif":"Arial, sans-serif"},children:[e.jsx("div",{"aria-label":"Parte superior",style:{clipPath:a.divider==="diagonal"?"polygon(0 0,100% 0,100% 88%,0 100%)":void 0,borderRadius:G,overflow:"hidden"},children:e.jsx(G2,{v:Fe,accent:o})}),e.jsxs("div",{"aria-label":"Escena",style:{display:"grid",gridTemplateColumns:u==="advertorial"?"1fr":"1fr 31%",gap:5,alignItems:"center",padding:"3px 4px",borderRadius:ze?G:u==="bento"?6:0,background:ze?`${tt}${Math.round((ze.opacity??.32)*255).toString(16).padStart(2,"0")}`:u==="bento"?"rgba(255,255,255,.72)":"transparent",border:u==="bento"?`1px solid ${o}35`:"none"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[e.jsx("div",{style:{...B("88%",w,4),fontFamily:L}}),e.jsx("div",{style:B("100%")}),e.jsx("div",{style:B("72%")})]}),u!=="advertorial"&&(s?e.jsx("img",{src:s,alt:"",loading:"lazy",style:{width:"100%",height:29,objectFit:"cover",borderRadius:F}}):e.jsx("div",{style:{height:29,borderRadius:F,background:`linear-gradient(145deg,${o}3d,${o}14)`}}))]}),e.jsxs("div",{"aria-label":"Oferta",style:{display:"grid",gridTemplateColumns:"1fr auto",gap:5,alignItems:"center",background:N?"rgba(255,255,255,.07)":"#fff",borderRadius:G,padding:"5px 6px",border:x?"1.5px solid #111":u==="tienda"?"1px solid #cfd5df":"1px solid rgba(120,132,160,.16)"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:8,fontWeight:900,fontFamily:L,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:94},children:S}),e.jsx("div",{style:{fontSize:9.5,fontWeight:950,color:/^#[0-9a-f]{6}$/i.test(a.price_color||"")?a.price_color:N?"#22c55e":"#16a34a"},children:$})]}
745),e.jsx("div",{style:ie,children:"Pedir ahora"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:5,minHeight:29},children:[e.jsxs("div",{"aria-label":"Formulario",style:fe,children:[e.jsx("div",{style:{fontSize:6.5,fontWeight:850},children:m==="recibo"?"Datos del pedido":"Formulario"}),e.jsx("div",{style:Be}),e.jsx("div",{style:{height:6,borderRadius:3,background:o,opacity:.85}})]}),e.jsxs("div",{"aria-label":"Reseña",style:We,children:[e.jsxs("div",{style:{fontSize:6.4,fontWeight:850},children:[c==="citas"?"â ":"",C]}),_>0?e.jsx("div",{style:{...B("82%",c==="whatsapp"||c==="notas"?"#365048":w,3),alignSelf:c==="destacada"?"center":void 0}}):e.jsx("div",{style:B("58%",M,2)})]})]})]})}function LC({name:t,candidate:a,original:n,renderPreview:o,onApply:i,onClose:s}){const[u,m]=h.useState(""),[c,g]=h.useState(""),[f,b]=h.useState(!1),v=yC(n,a);h.useEffect(()=>{const $=new AbortController;return m(""),g(""),o(a,$.signal).then(m).catch(C=>{$.signal.aborted||g(C instanceof Error?C.message:"No se pudo cargar la vista previa.")}),()=>$.abort()},[a,o]),h.useEffect(()=>{const $=C=>{C.key==="Escape"&&s()};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[s]);const j=$=>$===void 0||$===""?"Automático":typeof $=="boolean"?$?"SÃ":"No":String($),S=async()=>{b(!0);const $=await i(a);b(!1),$&&s()};return Wo.createPortal(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Vista previa de ${t}`,onMouseDown:$=>{$.target===$.currentTarget&&s()},style:{position:"fixed",inset:0,zIndex:1000002,background:"rgba(10,15,32,.62)",padding:16,overflowY:"auto"},children:e.jsxs("div",{style:{width:"min(1180px, 100%)",margin:"0 auto",background:"var(--card-bg,#fff)",borderRadius:18,boxShadow:"0 28px 90px rgba(10,15,32,.38)",overflow:"hidden"},children:[e.jsx("style",{children:"@media(max-width:780px){.lk-recipe-preview-grid{grid-template-columns:1fr!important}}"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 16px",borderBottom:"1px solid var(--border,#e5e7eb)",position:"sticky",top:0,zIndex:2,background:"var(--card-bg,#fff)"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:me,textTransform:"uppercase",letterSpacing:".06em"},children:"Ver sin aplicar"}),e.jsx("div",{style:{fontSize:16,fontWeight:900,color:"var(--text,#111)"},children:t})]}),e.jsx("button",{type:"button",onClick:s,style:{...ee,padding:"7px 11px"},children:"Cerrar"}),e.jsx("button",{type:"button",onClick:S,disabled:f||!!c||!u,style:{...xa,padding:"8px 14px",opacity:f||c||!u?.55:1},children:f?"Aplicandoâ¦":"Aplicar"})]}),e.jsxs("div",{style:{padding:16},children:[c?e.jsx("div",{style:{padding:18,borderRadius:12,background:"rgba(220,38,38,.08)",color:"#b91c1c",fontSize:13},children:c}
745):u?e.jsxs("div",{className:"lk-recipe-preview-grid",style:{display:"grid",gridTemplateColumns:"minmax(310px, 390px) minmax(0, 1fr)",gap:16,alignItems:"start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:850,marginBottom:7},children:"Móvil, 390 px"}),e.jsx("div",{style:{width:"100%",overflowX:"auto",border:"1px solid var(--border,#dfe3eb)",borderRadius:14,background:"#eef1f6"},children:e.jsx("iframe",{title:`${t} móvil`,srcDoc:u,sandbox:"",style:{display:"block",width:390,height:700,border:0,background:"#fff"}})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:850,marginBottom:7},children:"Escritorio, 1280 px"}),e.jsx("div",{style:{border:"1px solid var(--border,#dfe3eb)",borderRadius:14,overflow:"hidden",background:"#eef1f6"},children:e.jsx(q2,{html:u,title:`${t} escritorio`,anchoLogico:1280,alturaLogica:940,escalaMin:.42,conScripts:!0})})]})]}):e.jsx("div",{style:{padding:26,textAlign:"center",color:"var(--text-muted)",fontSize:13},children:"Preparando la landing realâ¦"}),e.jsxs("div",{style:{marginTop:14,borderTop:"1px solid var(--border,#e5e7eb)",paddingTop:12},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:850,marginBottom:7},children:"Tokens que cambiarán"}),v.length?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:v.map($=>e.jsxs("span",{title:`${j($.before)} â ${j($.after)}`,style:{border:"1px solid var(--border,#dfe3eb)",borderRadius:999,padding:"5px 9px",fontSize:11.5,color:"var(--text-secondary,#475569)"},children:[e.jsxs("b",{children:[$.label,":"]})," ",j($.after)]},$.path))}):e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)"},children:"Esta opción ya coincide con tu configuración."}),e.jsx("div",{style:{marginTop:8,fontSize:11.5,color:"var(--text-muted)",lineHeight:1.45},children:"El contenido, las fotos, el precio, las reseñas y los campos no se cambian."})]})]})]})}),document.body)}const V2=[{v:"sutil",name:"Sutil"},{v:"media",name:"Media"},{v:"notoria",name:"Notoria"}];function U2({kind:t,overlay:a,intensity:n,color:o,label:i}){const s=/^#[0-9a-fA-F]{6}$/.test(o)?o:"#0866ff",u=n!=="sutil",m=n==="notoria"?1.9:n==="media"?1.45:1,c=n==="notoria"?.62:n==="media"?.78:1,g=(C,_)=>{const N=/^#?([0-9a-f]{6})$/i.exec(C);if(!N)return`rgba(8,102,255,${_})`;const w=parseInt(N[1],16);return`rgba(${w>>16&255},${w>>8&255},${w&255},${Math.min(.6,_*m).toFixed(3)})`},f="#ec4899",b=C=>(C*c).toFixed(1)+"s",v=C=>{let _="",N="",w="";if(C.startsWith("aurora")||C==="blobs")_=`radial-gradient(46% 46% at 16% 12%,${g(s,u?.36:.3)},transparent 70%),radial-gradient(44% 44% at 84% 84%,${g(f,u?.3:.24)},transparent 70%)`,N=`bgpAura ${b(6)} ease-in-out infinite`,C==="blobs"&&(w="filter:blur(8px);");else if(C==="malla")_=`linear-gradient(45deg,transparent 47%,${g(s,.14)} 48.5%,${g(s,.14)} 51.5%,transparent 53%),linear-gradient(-45deg,transparent 47%,${g(f,.1)} 48.5%,${g(f,.1)} 51.5%,transparent 53%)`,w="background-size:22px 22px;",N=`bgpMesh ${b(6)} linear infinite`;else if(C==="puntos"||C==="destellos")_=`radial-gradient(circle at 20% 30%,${g(s,u?.55:.4)} 0,transparent 2px),radial-gradient(circle at 66% 20%,${g(C==="destellos"?"#ffffff":s,.45)} 0,transparent 2px),radial-gradient(circle at 80% 66%,${g(s,.4)} 0,transparent 2px)`,w="background-size:34px 34px,40px 40px,48px 48px;",N=`bgpSpark ${b(C==="destellos"?2.2:3)} ease-in-out infinite`;else if(C==="ondas")_=`repeating-linear-gradient(115deg,${g(s,u?.18:.13)} 0,${g(s,u?.18:.13)} 2px,transparent 2px,transparent 9px),radial-gradient(70% 60% at 20% 0%,${g(f,u?.2:.14)},transparent 72%)`,N=`bgpOndas ${b(5.5)} ease-in-out infinite`;else if(C==="gradiente-vivo")_=`linear-gradient(120deg,${g(s,u?.32:.22)},${g("#8b5cf6",u?.3:.2)},${g(f,u?.28:.19)},${g("#06b6d4",u?.3:.2)})`,w="background-size:300% 300%;",N=`bgpGrad ${b(6)} ease-in-out infinite`;else if(C==="rejilla-3d")_=`linear-gradient(${g(s,u?.5:.36)} 1.5px,transparent 1.5px),linear-gradient(90deg,${g(s,u?.5:.36)} 1.5px,transparent 1.5px)`,w="background-size:16px 16px;transform:perspective(120px) rotateX(58deg);transform-origin:bottom;-webkit-mask:linear-gradient(#0000,#000);mask:linear-gradient(#0000,#000);",N=`bgpGrid ${b(3)} linear infinite`;else if(C==="halo")_=`conic-gradient(from 0deg at 50% 50%,${g("#8b5cf6",u?.4:.28)},transparent 25%,${g(s,u?.36:.26)} 50%,transparent 75%,${g("#8b5cf6",u?.4:.28)})`,w="-webkit-mask:radial-gradient(50% 50% at 50% 50%,transparent 26%,#000 44%,transparent 74%);mask:radial-gradient(50% 50% at 50% 50%,transparent 26%,#000 44%,transparent 74%);",N=`bgpHalo ${b(7)} linear infinite`;else if(C==="grano")_=`radial-gradient(circle at 21% 33%,rgba(255,255,255,${u?.5:.34}) 0,transparent 1px),radial-gradient(circle at 64% 18%,rgba(255,255,255,${u?.42:.28}) 0,transparent 1px),radial-gradient(circle at 83% 61%,rgba(255,255,255,${u?.46:.3}) 0,transparent 1px),radial-gradient(circle at 42% 79%,rgba(255,255,255,${u?.4:.26}) 0,transparent 1px),radial-gradient(90% 70% at 50% 12%,${g(s,u?.16:.1)}
745,transparent 70%)`,w="background-size:7px 9px,11px 8px,9px 11px,8px 7px,100% 100%;",N=`bgpGrano ${b(.7)} steps(1) infinite`;else if(C==="burbujas")_=`radial-gradient(circle at 24% 86%,transparent 4px,${g(s,u?.4:.3)} 5px 6.5px,transparent 7.5px),radial-gradient(circle at 72% 92%,transparent 2.5px,${g(f,u?.36:.26)} 3.5px 4.5px,transparent 5.5px)`,w="background-size:70px 80px,55px 95px;",N=`bgpBurb ${b(6)} linear infinite`;else if(C==="cometas")_=`linear-gradient(105deg,transparent 46%,rgba(255,255,255,${u?.5:.36}) 50%,transparent 54%),linear-gradient(105deg,transparent 47%,${g(s,u?.44:.32)} 50%,transparent 53%)`,w="background-size:280% 280%,340% 340%;background-repeat:no-repeat;",N=`bgpComet ${b(3.2)} ease-in-out infinite`;else if(C==="pulso")_=`radial-gradient(circle at 50% 50%,transparent 26%,${g(s,u?.5:.36)} 28% 31%,transparent 33%),radial-gradient(40% 40% at 50% 50%,${g(s,u?.22:.14)},transparent 70%)`,N=`bgpPulso ${b(2.4)} cubic-bezier(.2,.6,.4,1) infinite`;else return null;return{bg:_,extra:w,anim:N}},j=v(t),S=a?v(a):null;if(!j&&!S)return null;const $=` 746 .bgp-box{position:relative;height:74px;border-radius:11px;overflow:hidden;background:#0d1017;border:1px solid var(--border,#e5e7eb)} 747 .bgp-fx{position:absolute;inset:-20%;pointer-events:none} 748 ${j?`.bgp-fx-a{background:${j.bg};${j.extra}animation:${j.anim}}`:""} 749 ${S?`.bgp-fx-b{background:${S.bg};${S.extra}animation:${S.anim}}`:""} 750 .bgp-lbl{position:absolute;left:10px;bottom:8px;z-index:1;font-size:11px;font-weight:800;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.6)} 751 @keyframes bgpAura{0%,100%{transform:translate(0,0) scale(1)}50%{transform:translate(3%,-3%) scale(1.08)}} 752 @keyframes bgpMesh{0%{background-position:0 0,0 0}100%{background-position:22px 22px,-22px -22px}} 753 @keyframes bgpSpark{0%,100%{opacity:.4}50%{opacity:1}} 754 @keyframes bgpOndas{0%,100%{transform:translate(0,0)}50%{transform:translate(-4%,3%)}} 755 @keyframes bgpGrad{0%,100%{background-position:0% 50%}50%{background-position:100% 50%}} 756 @keyframes bgpGrid{0%{background-position:0 0}100%{background-position:0 16px}} 757 @keyframes bgpHalo{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} 758 @keyframes bgpGrano{0%,100%{transform:translate(0,0)}25%{transform:translate(-4px,3px)}50%{transform:translate(3px,-4px)}75%{transform:translate(-2px,-2px)}} 759 @keyframes bgpBurb{0%{background-position:0 0,20px 0}100%{background-position:0 -160px,20px -190px}} 760 @keyframes bgpComet{0%{background-position:-120% -120%,220% 220%}50%,100%{background-position:220% 220%,-120% -120%}} 761 @keyframes bgpPulso{0%{transform:scale(.5);opacity:0}18%{opacity:1}100%{transform:scale(1.7);opacity:0}} 762 @media(prefers-reduced-motion:reduce){.bgp-fx{animation:none}}`;return e.jsxs("div",{children:[e.jsx("style",{children:$}),e.jsxs("div",{className:"bgp-box",children:[j?e.jsx("div",{className:"bgp-fx bgp-fx-a"}):null,S?e.jsx("div",{className:"bgp-fx bgp-fx-b"}):null,e.jsx("span",{className:"bgp-lbl",children:i||"Asà se ve el movimiento"})]})]})}function jn({options:t,value:a,onPick:n,small:o}){const i=h.useRef(null),s=h.useRef({}),[u,m]=h.useState(null),c=t.map(g=>String(g.v)).join("|");return h.useLayoutEffect(()=>{const g=()=>{const v=s.current[String(a)];if(!v){m(null);return}m({x:v.offsetLeft,y:v.offsetTop,w:v.offsetWidth,h:v.offsetHeight})};g();const f=i.current;if(!f||typeof ResizeObserver>"u")return;const b=new ResizeObserver(g);return b.observe(f),()=>b.disconnect()},[a,c]),e.jsxs("div",{ref:i,className:"lk-pills",style:{position:"relative",display:"flex",flexWrap:"wrap",gap:5,padding:4,borderRadius:12,background:"var(--bg-soft, #f1f3f9)"},children:[u&&e.jsx("span",{"aria-hidden":!0,className:"lk-pill-ind",style:{position:"absolute",left:0,top:0,zIndex:0,transform:`translate(${u.x}px, ${u.y}px)`,width:u.w,height:u.h,borderRadius:9}}),t.map(g=>{const f=String(a)===String(g.v);return e.jsx("button",{type:"button",ref:b=>{s.current[String(g.v)]=b},"data-on":f?"1":"0",onClick:()=>n(String(g.v)),style:{position:"relative",zIndex:1,border:"none",background:"transparent",borderRadius:9,padding:o?"6px 11px":"7px 13px",fontSize:o?12:12.5,fontFamily:"inherit",fontWeight:f?800:700,letterSpacing:"-.005em",curs
762or:"pointer",color:f?"#fff":"var(--text-secondary, #475569)"},children:g.l},String(g.v))})]})}function Ko({options:t,value:a,onPick:n,allowClear:o}){return e.jsx("div",{style:{display:"inline-flex",border:"1.5px solid var(--border, #e5e7eb)",borderRadius:9,overflow:"hidden",background:"var(--card-bg, #fff)"},children:t.map((i,s)=>{const u=a===i.v;return e.jsx("button",{type:"button",onClick:()=>n(o&&u?"":i.v),className:u?"lk-sel-aurora":void 0,style:{border:"none",borderLeft:s?"1px solid var(--border, #e5e7eb)":"none",background:u?me:"transparent",color:u?"#fff":"var(--text, #374151)",fontSize:12,fontWeight:700,padding:"7px 13px",cursor:"pointer"},children:i.name},i.v)})})}function Ty({v:t}){const a={width:"100%",height:62,borderRadius:7,background:"#f3f5fa",border:"1px solid #e4e7f0",padding:7,display:"flex",flexDirection:"column",gap:5,justifyContent:"center",boxSizing:"border-box",overflow:"hidden"};return t==="tarjetas"?e.jsx("div",{style:a,children:[0,1,2].map(n=>e.jsxs("div",{style:{height:15,background:"#fff",border:"1px solid #d9deea",borderRadius:5,padding:"2px 4px",display:"flex",flexDirection:"column",gap:2,boxSizing:"border-box"},children:[e.jsx("div",{style:{width:"34%",height:3,borderRadius:2,background:"#b7bfd2"}}),e.jsx("div",{style:{width:"62%",height:4,borderRadius:2,background:"#e6eaf3"}})]},n))}):t==="minimal"?e.jsx("div",{style:a,children:[0,1,2].map(n=>e.jsxs("div",{style:{height:13,display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:3},children:[e.jsx("div",{style:{width:"38%",height:3,borderRadius:2,background:"#b7bfd2"}}),e.jsx("div",{style:{width:"100%",height:2,borderRadius:1,background:"#8a94a8"}})]},n))}):t==="recibo"?e.jsx("div",{style:{...a,background:"#faf5e8",borderColor:"#e6dcc0"},children:[0,1,2].map(n=>e.jsxs("div",{style:{height:13,display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:3},children:[e.jsx("div",{style:{width:"36%",height:3,borderRadius:2,background:"#b3a37c"}}),e.jsx("div",{style:{width:"100%",height:0,borderTop:"2px dashed #cfc09a"}})]},n))}):t==="panel"?e.jsx("div",{style:a,children:e.jsx("div",{style:{background:"#fff",border:"1px solid #cdd4e4",borderRadius:6,overflow:"hidden",display:"flex",flexDirection:"column"},children:[0,1,2].map(n=>e.jsxs("div",{style:{height:15,borderTop:n?"1px solid #e4e8f1":"none",display:"flex",alignItems:"center",gap:4,padding:"0 5px",boxSizing:"border-box"},children:[e.jsx("div",{style:{width:"28%",height:3,borderRadius:2,background:"#b7bfd2"}}),e.jsx("div",{style:{flex:1,height:4,borderRadius:2,background:"#eef1f7"}})]},n))})}):e.jsx("div",{style:a,children:[0,1,2].map(n=>e.jsxs("div",{style:{height:13,display:"flex",gap:3},children:[e.jsx("div",{style:{width:13,height:"100%",background:"#dde3ef",border:"1px solid #cdd4e4",borderRadius:3,boxSizing:"border-box",flex:"none"}}),e.jsx("div",{style:{flex:1,background:"#fff",border:"1px solid #cdd4e4",borderRadius:3,boxSizing:"border-box"}})]},n))})}function Ey({v:t}){const a={width:"100%",height:62,borderRadius:7,background:"#f3f5fa",border:"1px solid #e4e7f0",padding:6,display:"flex",flexDirection:"column",gap:4,boxSizing:"border-box",overflow:"hidden"},n={width:20,height:3,borderRadius:2,background:"#f0b429",flex:"none"},o={background:"#fff",border:"1px solid #dde2ee",borderRadius:4,padding:4,display:"flex",flexDirection:"column",gap:3,boxSizing:"border-box"},i=s=>({width:s,height:3,borderRadius:2,background:"#c3cadb"});return t==="tarjetas"?e.jsx("div",{style:{...a,flexDirection:"row"},children:[0,1].map(s=>e.jsxs("div",{style:{...o,flex:1},children:[e.jsx("div",{style:{height:16,borderRadius:3,background:"linear-gradient(135deg, #c9d3e6, #a2b2cf)"}}),e.jsx("div",{style:n}),e.jsx("div",{style:i("86%")}),e.jsx("div",{style:i("60%")})]},s))}):t==="destacada"?e.jsxs("div",{style:a,children:[e.jsxs("div",{style:{...o,flex:1},children:[e.jsx("div",{style:n}),e.jsx("div",{style:i("90%")}),e.jsx("div",{style:i("72%")})]}),e.jsx("div",{style:{display:"flex",gap:3,flex:"none"},children:[0,1,2].map(s=>e.jsx("div",{style:{flex:1,height:8,borderRadius:99,background:s===0?"rgba(8,102,255,.25)":"#e1e6f0"}},s))})]}):t==="whatsapp"?e.jsxs("div",{style:{...a,background:"#e5ddd5"},children:[e.jsxs("div",{style:{...o,width:"74%",borderRadius:6,borderTopLeftRadius:0},children:[e.jsx("div",{style:i("84%")}),e.jsx("div",{style:i("52%")})]}),e.jsxs("div",{style:{...o,width:"74%",alignSelf:"flex-end",background:"#dcf8c6",borderColor:"#c8ecb0",borderRadius:6,borderTopRightRadius:0},children:[e.jsx("div",{style:i("78%")}),e.jsx("div",{style:i("46%")})]})]}):t==="citas"?e.jsx("div",{style:a,children:[0,1].map(s=>e.jsxs("div",{style:{flex:1,display:"flex",gap:5},children:[e.jsx("div",{style:{width:2,borderRadius:1,background:"rgba(8,102,255,.4)",flex:"none"}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:3,justifyContent:"center"},children:[e.jsxs("div",{style:{display:"flex",gap:3,alignItems:"center"},children:[e.jsx("span",{style:{fontFamily:"Georgia, serif",fontSize:13,lineHeight:"6px",fontWeight:700,color:"rgba(8,102,255,.55)"},children:"â"}),e.jsx("div",{style:n})]}),e.jsx("div",{style:i("84%")}),e.jsx("div",{style:i("58%")})]})]},s))}):t==="notas"?e.jsx("div",{style:{...a,flexDirection:"row",alignItems:"center",gap:6},children:[0,1].map(s=>e.jsxs("div",{style:{...o,flex:1,background:"#fdf8e2",borderColor:"#e9e2c4",borderRadius:3,transform:`rotate(${s===0?-2.5:2.5}deg)`,position:"relative",paddingTop:8},children:[e.jsx("div",{style:{position:"absolute",top:-3,left:"50%",marginLeft:-9,width:18,height:6,background:"rgba(255,255,255,.9)",border:"1px solid #ddd6b8",borderRadius:2,transform:"rotate(-3deg)"}}),e.jsx("div",{style:n}),e.jsx("div",{style:i("82%")}),e.jsx("div",{style:i("55%")})]},s))}):e.jsx("div",{style:a,children:[0,1].map(s=>e.jsxs("div",{style:{...o,flex:1,justifyContent:"center"},children:[e.jsxs("div",{style:{display:"flex",gap:3,alignItems:"center"},children:[e.jsx("div",{style:n}),e.jsx("div",{style:{...i("40%"),background:"#9aa3b8"}})]}),e.jsx("div",{style:i("82%")})]},s))})}function ns({options:t,value:a,onPick:n,render:o}){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(92px, 1fr))",gap:8},children:t.map(i=>{const s=a===i.v;return e.jsxs("button",{type:"button",onClick:()=>
762n(i.v),className:s?"lk-ring-aurora":void 0,style:{border:s?"2px solid transparent":"1.5px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",borderRadius:10,padding:7,cursor:"pointer"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:34},children:o(i.v)}),e.jsx("div",{style:{fontSize:11.5,fontWeight:700,color:"var(--text, #111)",marginTop:5,textAlign:"center"},children:i.name})]},i.v)})})}const PC={name:"Nombre",first_name:"Nombre",firstname:"Nombre",nombre:"Nombre",lastname:"Apellido",last_name:"Apellido",surname:"Apellido",apellido:"Apellido",apellidos:"Apellidos",phone:"Teléfono",telefono:"Teléfono",celular:"Celular",mobile:"Celular",phone2:"Teléfono 2",telefono2:"Teléfono 2",phone_2:"Teléfono 2",email:"Correo",correo:"Correo","e-mail":"Correo",department:"Departamento",departamento:"Departamento",state:"Departamento",provincia:"Provincia",city:"Ciudad",ciudad:"Ciudad",municipio:"Municipio",address:"Dirección",direccion:"Dirección",address2:"Dirección 2",address_2:"Dirección 2",reference:"Referencia",referencia:"Referencia",website:"Sitio web",web:"Sitio web",url:"Sitio web",zip:"Código postal",postal_code:"Código postal",codigo_postal:"Código postal",notes:"Notas",note:"Nota",observaciones:"Observaciones",mensaje:"Notas",notas:"Notas",colonia:"Colonia",distrito:"Distrito",corregimiento:"Corregimiento",parroquia:"Parroquia",zona:"Zona",barrio:"Barrio",quantity:"Cantidad",cantidad:"Cantidad",qty:"Cantidad",size:"Talla",talla:"Talla",color:"Color",variant:"Variante",variante:"Variante"},zy=t=>!t||typeof t!="object"?[]:Object.entries(t).filter(([a,n])=>!String(a).startsWith("_")&&n!=null&&String(n).trim()!==""),DC=t=>PC[String(t).trim().toLowerCase()]||String(t).replace(/_/g," ");function Ns({children:t}){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flex:"none"},children:t})}const BC=[{v:"producto",l:"Producto",ic:e.jsxs(Ns,{children:[e.jsx("path",{d:"M21 8l-9-5-9 5v8l9 5 9-5z"}),e.jsx("path",{d:"M3 8l9 5 9-5M12 13v8"})]})},{v:"landing",l:"Página",ic:e.jsxs(Ns,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2.5"}),e.jsx("path",{d:"M3 9h18"})]})},{v:"formulario",l:"Formulario",ic:e.jsxs(Ns,{children:[e.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),e.jsx("path",{d:"M8 8h8M8 12h8M8 16h5"})]})},{v:"upsell",l:"Impulso",ic:e.jsxs(Ns,{children:[e.jsx("path",{d:"M3 17l6-6 4 4 7-7"}),e.jsx("path",{d:"M17 8h4v4"})]})},{v:"diseno",l:"Diseño",ic:e.jsxs(Ns,{children:[e.jsx("path",{d:"M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.6 0-1 .7-1.6 1.6-1.6h2A4 4 0 0 0 21 14a9 9 0 0 0-9-11z"}),e.jsx("circle",{cx:"7.5",cy:"11",r:"1"}),e.jsx("circle",{cx:"12",cy:"8",r:"1"}),e.jsx("circle",{cx:"16",cy:"11",r:"1"})]})},{v:"pixeles",l:"Dominio",ic:e.jsxs(Ns,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3 12h18"}),e.jsx("path",{d:"M12 3c2.5 2.6 2.5 15 0 18M12 3c-2.5 2.6-2.5 15 0 18"})]})},{v:"ajustes",l:"Ajustes",ic:e.jsxs(Ns,{children:[e.jsx("path",{d:"M4 7h9M19 7h1M4 17h1M11 17h9"}),e.jsx("circle",{cx:"16",cy:"7",r:"2.4"}),e.jsx("circle",{cx:"8",cy:"17",r:"2.4"})]})}],WC="Pagas al recibir · EnvÃo gratis · GarantÃa de devolución",qC="Pagas solo cuando lo tienes en tus manos",Ry={title:"Compra 100% segura",text:"Pagas al recibir en la puerta de tu casa, sin transferencias ni adelantos. Producto sellado y en perfecto estado."},vu=[{label:"Pedido",sub:"Mismo dÃa"},{label:"En camino",sub:"24 a 48 h"},{label:"Entrega",sub:"3 a 7 dÃas"}],Bi=[{key:"cod",label:"Pago contraentrega",text:"Pagas al recibir"},{key:"whatsapp",label:"Confirmación por WhatsApp",text:"Confirmamos tu pedido por WhatsApp"},{key:"door_reject",label:"Decisión en la puerta",text:"Puedes rechazarlo en la puerta si no te convence"},{key:"cutoff",label:"Hora de corte real",text:"Pide antes de las {hora} y se despacha hoy"}],Ny=t=>t==="servicio"?Bi.filter(a=>a.key==="whatsapp"):t==="advertorial"?Bi.filter(a=>a.key==="whatsapp"||a.key==="door_reject"):t==="whatsapp"?Bi.filter(a=>a.key!=="cutoff"):Bi,MC=t=>
762({enabled:!0,items:!t||t==="product"||t==="simple"?[{key:"cod",text:"Pagas al recibir"}]:[]});function mt({children:t}){const[a,n]=h.useState(!1);return e.jsxs("div",{style:{margin:"2px 0 8px"},children:[e.jsxs("button",{type:"button",onClick:()=>n(o=>!o),style:{background:"none",border:"none",padding:0,fontSize:11.5,fontWeight:700,color:a?me:"var(--text-muted)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:14,height:14,borderRadius:999,border:"1.3px solid currentColor",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9.5,fontWeight:800,flex:"none"},children:"?"}),a?"Ocultar ayuda":"Cómo funciona"]}),a&&e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.55,marginTop:5},children:t})]})}const os=t=>{const a=t==null?void 0:t.content_blocks;if(!Array.isArray(a)||a.length<2)return t;const n=["inicio","price","offers","cta","form","faq","end"],o=s=>{const u=n.includes(s==null?void 0:s.pos)?s.pos:"end";return n.indexOf(u)},i=a.map((s,u)=>({b:s,idx:u})).sort((s,u)=>o(s.b)-o(u.b)||s.idx-u.idx).map(s=>s.b);return i.some((s,u)=>s!==a[u])?{...t,content_blocks:i}:t},FC=[{icon:"â",text:"Pago contraentrega"},{icon:"â",text:"EnvÃo gratis"}],ac=["lead_wa","pago_pendiente","nuevo","pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado","cancelado","abandonado"],Bl={lead_wa:"#22c55e",pago_pendiente:"#d97706",nuevo:"#3b82f6",contactado:"#a855f7",pendiente_confirmar:"#38bdf8",confirmado:"#0284c7",despachado:"#f59e0b",en_transito:"#0891b2",entregado:"#16a34a",novedad:"#f97316",reclamar_oficina:"#c2410c",devuelto:"#7c3aed",rechazado:"#9f1239",pago_fallido:"#e11d48",cancelado:"#dc2626",abandonado:"#94a3b8",otro:"#64748b"},OC={lead_wa:"Lead WhatsApp",pago_pendiente:"Esperando pago",nuevo:"Nuevo Pedido",contactado:"Contactado",pendiente_confirmar:"Pendiente confirmación",confirmado:"Confirmado",despachado:"GuÃa generada",en_transito:"En tránsito",entregado:"Entregado",novedad:"Novedad",reclamar_oficina:"Reclamar en oficina",devuelto:"Devuelto",rechazado:"Rechazado",repetido:"Repetidos",pago_fallido:"Pago falló",cancelado:"Cancelado",abandonado:"Abandonado",otro:"Estado por revisar"},Ni={lead_wa:"Te escribió por WhatsApp, sin pedido aún",pago_pendiente:"Fue a pagar en lÃnea y no completó",nuevo:"Pedido recién llegado del formulario",contactado:"Ya le escribiste para confirmar el pedido",pendiente_confirmar:"En Dropi, esperando confirmación",confirmado:"Confirmado, listo para despachar",despachado:"Dropi ya generó la guÃa de envÃo",en_transito:"Va en camino al cliente",entregado:"Entregado y pagado",novedad:"Hubo una novedad en la entrega",reclamar_oficina:"El cliente debe recogerlo en la oficina o se devuelve",devuelto:"El pedido se devolvió",rechazado:"El cliente lo rechazó al recibir",cancelado:"Pedido cancelado",abandonado:"Empezó el formulario y no terminó",repetido:"El mismo comprador, que ya te hizo un pedido en esta página",otro:"Dropi envió un estado que Lumy todavÃa no pudo clasificar"},to=t=>OC[t]||t,Jr={lead_wa:"Aquà caen los chats de WhatsApp que aún no son pedido.",abandonado:"Sin formularios a medio llenar en este rango.",pago_pendiente:"Nadie está pagando en lÃnea en este momento.",nuevo:"Los pedidos nuevos del formulario aparecen aquÃ.",contactado:"Arrastra aquà los pedidos que ya contactaste.",confirmado:"Arrastra aquà los confirmados, listos para Dropi.",pendiente_confirmar:"Nada esperando confirmación en Dropi.",despachado:"Sin guÃas generadas en este rango.",en_transito:"Nada viajando al cliente en este rango.",entregado:"Las entregas confirmadas aparecen aquÃ.",novedad:"Sin novedades de entrega en este rango.",reclamar_oficina:"Nada retenido en oficina de la transportadora.",devuelto:"Sin devoluciones en este rango.",rechazado:"Sin rechazos al recibir en este rango.",cancelado:"Sin pedidos cancelados en este rango.",otro:"Sin pedidos con estado pendiente de clasificar."},Ly={nuevo:"Pedido importado automáticamente desde Shopify",contactado:"Ya contactaste al cliente para confirmar el pedido",pendiente_confirmar:"Esperando confirmación del cliente",confirmado:"Confirmado y listo para gestionar el envÃo",de
762spachado:"La guÃa de envÃo ya fue generada",en_transito:Ni.en_transito,entregado:Ni.entregado,novedad:Ni.novedad,reclamar_oficina:Ni.reclamar_oficina,devuelto:Ni.devuelto,rechazado:Ni.rechazado,cancelado:Ni.cancelado},HC={nuevo:"Los pedidos nuevos de Shopify aparecen aquà automáticamente.",contactado:Jr.contactado,pendiente_confirmar:"No hay pedidos esperando confirmación en este rango.",confirmado:"Arrastra aquà los pedidos confirmados y listos para gestionar.",despachado:Jr.despachado,en_transito:Jr.en_transito,entregado:Jr.entregado,novedad:Jr.novedad,reclamar_oficina:Jr.reclamar_oficina,devuelto:Jr.devuelto,rechazado:Jr.rechazado,cancelado:Jr.cancelado},GC={confianza:"Tira de confianza",como_funciona:"Cómo funciona (3 pasos)",ficha:"Ficha técnica",comparativa:"Comparativa (vs otros)",garantia:"Sello de garantÃa"},Pp=["lead_wa","abandonado","repetido","pago_pendiente","nuevo","contactado","pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","cancelado","otro"],ju=["#0ea5e9","#8b5cf6","#f59e0b","#10b981","#ef4444","#ec4899","#14b8a6","#6366f1"],Py=["lead_wa","abandonado","repetido","pago_pendiente","nuevo","contactado","pendiente_confirmar","confirmado","local_exportado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado","cancelado","otro"],VC={reclamar_oficina:{boton:"Avisarles que recojan",quienes:"los pedidos retenidos en oficina",borrador:"Hola {nombre} ð Tu {producto} ya está en la oficina de {transportadora} esperándote (guÃa {guia}). Pásate a recogerlo pronto con tu cédula, porque si pasan varios dÃas lo devuelven. Si necesitas la dirección de la oficina, escrÃbeme y te la paso."},novedad:{boton:"Pedir ayuda con la entrega",quienes:"los pedidos con novedad",borrador:"Hola {nombre} ð {transportadora} intentó entregarte tu {producto} y no pudo: «{novedad}». Ayúdame confirmando tu dirección exacta (calle, número, barrio) y un teléfono donde te encuentren, y lo reprogramamos de una."},wa_error:{boton:"Reintentar el mensaje",quienes:"los que no recibieron tu mensaje",borrador:"¡Hola! ð Te escribo por tu pedido ð ¿Me confirmas si me lees por aquÃ?"},por_confirmar:{boton:"Confirmarlos ya",quienes:"los pedidos por confirmar",borrador:"Hola {nombre} ð ¡Recibimos tu pedido de {producto} por {total}! ð ¿Me confirmas que tus datos están bien para despacharlo hoy mismo? Recuerda que pagas al recibirlo en tu casa."},sin_cobertura:{boton:"Acordar la entrega",quienes:"los pedidos sin cobertura",borrador:"Hola ð Estamos alistando tu pedido. Para hacértelo llegar hasta tu zona necesito confirmar contigo el punto de entrega: ¿me regalas una dirección o un punto de referencia conocido?"},flete_caro:{boton:"Coordinar el envÃo",quienes:"los pedidos de flete alto",borrador:"Hola ð Tu pedido está listo para salir. Te escribo para coordinar la entrega hasta tu zona y confirmarte el valor del envÃo. ¿Hablamos?"},estancados:{boton:"Reactivarlos",quienes:"los pedidos quietos hace dÃas",borrador:"Hola ð ¿Sigues interesado en tu pedido? Lo tenemos apartado para ti: confÃrmame y te lo despacho de una. Pagas al recibir ð"},direccion:{boton:"Pedir la dirección buena",quienes:"los pedidos con dirección a revisar",borrador:"Hola {nombre} ð Estoy alistando el envÃo de tu {producto} y quiero que llegue sin enredos: ¿me confirmas tu dirección completa (calle, número, barrio) y un punto de referencia?"},pago_fallido:{boton:"Tranquilizarlos",quienes:"los que intentaron pagar en lÃnea",borrador:"Hola {nombre} ð Vi que intentaste pagar en lÃnea y no se completó. Tranquilo: tu {producto} sigue en pie y pagas los {total} al recibirlo en tu casa. ¿Te lo confirmo y lo despacho?"},guia_estancada:{boton:"Avisar del retraso",quienes:"las guÃas estancadas",borrador:"Hola {nombre} ð Tu {producto} va en camino con {transportadora} (guÃa {guia}), pero se han demorado más de lo normal. Ya estamos encima del envÃo y cualquier avance te lo cuento por aquÃ. ¡Gracias por la paciencia! ð"}},UC=["despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado"],Dp=(t,a,n)=>
762t===a||!["lead_wa","pago_pendiente","abandonado"].includes(t)&&(n?!["novedad","reclamar_oficina","devuelto","rechazado"].includes(t):t!=="rechazado"),Bp=["nuevo","contactado","pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado","cancelado","otro"],Wp=["pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado","cancelado","otro"],Dy=new Set(["nuevo","contactado","pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto","rechazado","cancelado"]),QC=t=>({border:`1.5px solid ${t}`,boxShadow:`0 0 0 3px ${t}1c, 0 10px 24px -12px ${t}59, inset 0 1px 0 rgba(255,255,255,.5)`}),KC=t=>({border:`1.5px solid ${t}`,boxShadow:`0 0 0 3px ${t}12, 0 1px 2px rgba(16,24,40,.05), 0 8px 18px -10px ${t}4d`}),YC=t=>`0 0 0 3px ${t}26, 0 18px 38px -10px ${t}66, 0 8px 18px rgba(16,24,40,.18)`,qp={display:"inline-flex",alignItems:"center",gap:3,minWidth:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},zn={display:"inline-flex",alignItems:"center",gap:4,fontSize:9.5,fontWeight:800,borderRadius:999,padding:"2px 8px",whiteSpace:"nowrap"},Jt={background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:18,padding:18,boxShadow:"0 1px 2px rgba(16,24,40,0.04), 0 10px 28px -10px rgba(16,24,40,0.10), inset 0 1px 0 rgba(255,255,255,0.5)"},E={width:"100%",minWidth:0,padding:"11px 13px",border:"1.5px solid var(--border, #dde)",borderRadius:12,fontSize:16,background:"var(--input-bg, #fff)",color:"var(--text, #111)"},D={fontSize:"clamp(11.5px, 2.8vw, 12.5px)",fontWeight:800,color:"var(--text, #111827)",letterSpacing:"-.01em",display:"block",marginBottom:5,marginTop:12},Jl="Contenido patrocinado · Publicidad",Q2={nota:{template:"nota",niche:"general",ad_label:Jl,kicker:"BIENESTAR Y CUIDADO",headline:"Qué debes saber sobre [Producto] antes de elegirlo para [necesidad]",subheadline:"Revisamos qué es, cómo se usa y qué información conviene comprobar antes de pedirlo.",byline:{author:"Equipo Editorial",source:"Sección Bienestar",date_relative:""},image_caption:"[Producto] en uso cotidiano. Imagen del fabricante.",content:`Si buscas una opción para [necesidad], conviene revisar con claridad qué hace el producto y qué incluye. 763## Qué es [Producto] 764[Producto] es [categorÃa honesta] pensado para [función concreta]. Describe aquà únicamente beneficios y lÃmites que puedas comprobar. 765[CTA: Ver disponibilidad y precio] 766## Cómo se usa 767Explica los pasos reales de uso y los cuidados necesarios. 768## Qué revisar antes de pedir 769Indica materiales, medidas, contenido del paquete y condiciones de entrega verificables.`,cta_text:"Conocer la oferta y pedir con pago contraentrega",disclaimer:"Contenido publicitario. [Producto] no reemplaza el consejo de un profesional. Los resultados pueden variar de una persona a otra."},transformacion:{template:"transformacion",niche:"general",ad_label:Jl,kicker:"GUÃA DE USO",headline:"Cómo integrar [Producto] en una rutina para [necesidad cotidiana]",subheadline:"Una guÃa práctica con usos, lÃmites y datos que debes verificar antes de elegir.",byline:{author:"Equipo Editorial",source:"",date_relative:""},image_caption:"[Producto] en una situación de uso. Imagen del fabricante.",content:`Antes de elegir [Producto], define qué necesidad concreta quieres resolver y revisa si sus caracterÃsticas corresponden a ese uso. 770## Antes de usarlo 771[Describe preparación, compatibilidad o requisitos reales, sin diagnóstico médico.] 772## Cómo incorporarlo a la rutina 773Explica la frecuencia y los pasos indicados por el fabricante. 774[CTA: Ver detalles del producto] 775## LÃmites y cuidados 776Aclara qué no hace el producto y qué precauciones debe conocer la persona.`,cta_text:"Ver la oferta y pedir con pago contraentrega",disclaimer:"Contenido publicitario. Verifica las caracterÃsticas y condiciones del producto antes de pedir."},listicle:{template:"listicle",niche:"general",ad_label:Jl,kicker:"GUÃA DE COMPRA",headline:"5 aspectos que conviene revisar antes de elegir [Producto]",subheadline:"Lo que debes saber antes de comprarlo, con pago contraentrega.",byline:{author:"Equipo Editorial",source:"GuÃa de compra",date_relative:""},image_caption:"[Producto]. Imagen del fabricante.",content:`## 1. Función principal 777[Explica el beneficio principal de forma realista.] 778## 2. Contenido del paquete 779[Enumera únicamente lo que realmente se entrega.] 780[CTA: Ver disponibilidad] 781## 3. Material y calidad 782[Detalla materiales y garantÃa verificables.] 783## 4. Forma de uso
784[Explica cómo se usa en pocos pasos.] 785## 5. Condiciones de entrega 786[Escribe cobertura y tiempos reales, sin inventar disponibilidad.]`,cta_text:"Ver la oferta completa",disclaimer:"Contenido publicitario. Los resultados pueden variar de una persona a otra."},resena:{template:"resena",niche:"general",ad_label:Jl,kicker:"GUÃA DE EVALUACIÃN",headline:"Cómo evaluar si [Producto] corresponde a lo que necesitas",subheadline:"Un repaso de caracterÃsticas, lÃmites y preguntas útiles antes de elegir.",byline:{author:"Equipo Editorial",source:"GuÃas de producto",date_relative:""},image_caption:"[Producto]. Imagen del fabricante.",content:`Esta guÃa organiza la información que debes comprobar para decidir si [Producto] corresponde a tu necesidad. 787## CaracterÃsticas principales 788[Incluye 2 o 3 puntos concretos y verificables.] 789## Lo que debes tener en cuenta 790[Explica un lÃmite real, compatibilidad o cuidado importante.] 791[CTA: Ver precio y disponibilidad] 792## ¿Para quién puede servir? 793[Describe el uso previsto por el fabricante sin prometer resultados.]`,cta_text:"Ver la oferta",disclaimer:"Contenido publicitario. Verifica las caracterÃsticas y condiciones del producto antes de pedir."}},xa={background:me,color:"#fff",border:0,borderRadius:10,padding:"11px 18px",fontSize:14,fontWeight:700,cursor:"pointer"},ee={background:"transparent",color:"var(--text, #333)",border:"1.5px solid var(--border, #ddd)",borderRadius:10,padding:"9px 14px",fontSize:13.5,fontWeight:600,cursor:"pointer"},Au={background:"rgba(255,255,255,.08)",color:"#fff",border:"1px solid rgba(255,255,255,.18)",borderRadius:9,padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",transition:"background .15s ease",whiteSpace:"nowrap",fontFamily:"inherit"},Mp={flex:"none",width:24,height:24,borderRadius:"50%",background:me,color:"#fff",fontWeight:800,fontSize:12.5,display:"inline-flex",alignItems:"center",justifyContent:"center"};function K2(t){const a=String(t||"").trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/\.+$/,"").replace(/\s+/g,"");if(!a||!a.includes("."))return{ok:!1,isApex:!1,host:"",root:a};const n=["com.co","net.co","org.co","com.mx","com.ar","com.br","co.uk","com.pe","com.ve","com.ec","com.bo","com.uy","com.py","com.gt","com.do","com.pa","com.sv","com.hn","com.ni","com.cr"],o=a.split("."),i=n.includes(o.slice(-2).join("."))?3:2,s=o.slice(-i).join("."),u=o.slice(0,Math.max(0,o.length-i)).join(".");return{ok:o.length>=i,isApex:u==="",host:u,root:s}}const qi=t=>/\.(l\.ecomdroptv|lumycol)\.com$/i.test(String(t||"").trim()),JC={display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:8,marginTop:12,marginBottom:5},Y2={display:"inline-flex",alignItems:"center",gap:4,padding:"3px 9px",fontSize:11,fontWeight:800,lineHeight:1,color:me,background:"rgba(8,102,255,.10)",border:"1px solid rgba(8,102,255,.28)",borderRadius:999,cursor:"pointer",flex:"none",whiteSpace:"nowrap"},J2={position:"fixed",inset:0,background:"rgba(10,15,32,.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:12,zIndex:240},Z2={background:"var(--card-bg, #fff)",borderRadius:14,padding:16,width:"100%",maxWidth:440,maxHeight:"82vh",overflowY:"auto",boxShadow:"0 20px 60px rgba(10,15,32,.32)"},Tg={display:"block",width:"100%",textAlign:"left",background:"var(--bg-soft, #f6f8fc)",border:"1px solid var(--border, #e6e9f0)",borderRadius:10,padding:"10px 12px",marginBottom:8,fontSize:13.5,lineHeight:1.45,cursor:"pointer",color:"var(--text, #111)",whiteSpace:"pre-wrap"},ZC={display:"inline-flex",alignItems:"center",gap:7,padding:"9px 16px",fontSize:13,fontWeight:800,color:"#fff",background:me,border:0,borderRadius:10,cursor:"pointer"},XC={marginTop:10,padding:"11px 13px",background:"rgba(8,102,255,.06)",border:"1px solid rgba(8,102,255,.20)",borderRadius:12};function e8({onSelect:t,onClose:a,usedUrls:n,ownUrls:o}){const i=$a(),[s,u]=h.useState(null),m=new Set(n||[]),c=new Set(o||[]);h.useEffect(()=>{i("/api/landing/media").then(f=>f.json()).then(f=>u(f.ok?f.items:[])).catch(()=>u([]))},[i]);const g=async f=>{if(!confirm("¿Eliminar esta imagen de tu biblioteca? Las landings que la usen dejarán de mostrarla."))return;const b=await i(`/api/landing/media?key=${encodeURIComponent(f)}`,{method:"DELETE"}).catch(()=>null),v=b?await b.json().catch(()=>({})):{};if(!b||!b.ok||!v.ok){alert(v.message||"No se pudo eliminar la imagen. Intenta de nuevo.");return}u(j=>(j||[]).filter(S=>S.key!==f))};return e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(10,15,32,.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:80,padding:16},onClick:a,children:e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:14,maxWidth:640,width:"100%",maxHeight:"80vh",display:"flex",flexDirection:"column"},onClick:f=>f.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--border, #eee)"},children:[e.jsx("h3",{style:{margin:0,fontSize:16},children:"Mis imágenes"}),e.jsx("button",{onClick:a,style:{...ee,padding:"4px 10px"},children:"â"})]}),e.jsx("div",{style:{overflowY:"auto",padding:14},children:s===null?e.jsx("p",{style:{color:"var(--text-muted)",fontSize:13,textAlign:"center",padding:20},children:"Cargandoâ¦"}):s.length===0?e.jsx("p",{style:{color:"var(--text-muted)",fontSize:13,textAlign:"center",padding:20},children:'Aún no has subido imágenes. Sube la primera con el botón "Subir imagen".'}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(110px, 1fr))",gap:8},children:s.map(f=>e.jsxs("div",{style:{position:"relative"},children:[e.jsx("img",{src:f.url,alt:"",loading:"lazy",onClick:()=>
793{if(c.has(f.url)){alert("Esta foto ya está en esta galerÃa. Aquà la misma foto solo se muestra una vez.");return}m.has(f.url)&&!confirm("Esta foto ya se muestra en otra parte de esta página. ¿Usarla otra vez?")||t(f.url)},style:{width:"100%",aspectRatio:"1 / 1",objectFit:"cover",borderRadius:10,border:m.has(f.url)?`1.5px solid ${me}`:"1.5px solid var(--border, #e5e7eb)",cursor:"pointer",display:"block",background:"var(--input-bg, #f7f8fc)"}}),m.has(f.url)&&e.jsx("span",{style:{position:"absolute",left:4,bottom:4,background:"rgba(10,15,32,.72)",color:"#fff",fontSize:9.5,fontWeight:800,borderRadius:6,padding:"2px 6px",pointerEvents:"none"},children:"En esta página"}),e.jsx("button",{onClick:()=>g(f.key),title:"Eliminar",style:{position:"absolute",top:4,right:4,width:22,height:22,borderRadius:"50%",border:0,background:"rgba(10,15,32,.55)",color:"#fff",fontSize:12,cursor:"pointer",lineHeight:1},children:"â"})]},f.key))})}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:0,padding:"10px 16px",borderTop:"1px solid var(--border, #eee)"},children:"Toca una imagen para usarla en esta casilla."})]})})}async function t8(t,a,n){const o=[],i=[];let s=0;for(const u of a){try{const m=u.type==="image/gif";if(m&&u.size>7*1024*1024){i.push(u.name);continue}const c=m?u:await pv(u),f=await(await t("/api/landing/upload",{method:"POST",headers:{"Content-Type":m?"image/gif":"image/jpeg"},body:c})).json().catch(()=>({}));f.ok&&f.url?o.push(f.url):i.push(u.name)}catch{i.push(u.name)}n==null||n(++s)}return{urls:o,fallaron:i}}function Rn({label:t,value:a,onChange:n,uploadsEnabled:o,compact:i,usedUrls:s,ownUrls:u,onAddMany:m}){const c=$a(),g=h.useRef(null),[f,b]=h.useState(!1),[v,j]=h.useState(""),[S,$]=h.useState(!1),[C,_]=h.useState(!1),N=S||!o,[w,M]=h.useState(null),p=()=>{var Te;return(Te=g.current)==null?void 0:Te.click()},V=async Te=>{const ie=Array.from(Te.target.files||[]);Te.target.value="",ie.length&&(m&&ie.length>1?U(ie):ne(ie[0]))},[L,x]=h.useState(!1),[z,G]=h.useState(!1),B=Te=>{var fe;Te.preventDefault(),x(!1);const ie=Array.from(((fe=Te.dataTransfer)==null?void 0:fe.files)||[]);!ie.length||!o||f||(m&&ie.length>1?U(ie):ne(ie[0]))},U=async Te=>{j(""),b(!0),M({hecho:0,total:Te.length});const{urls:ie,fallaron:fe}=await t8(c,Te,Be=>M(We=>We&&{...We,hecho:Be}));ie.length&&(m==null||m(ie)),fe.length&&j(`No se pudieron subir ${fe.length} de ${Te.length}: ${fe.slice(0,3).join(", ")}${fe.length>3?"â¦":""}`),M(null),b(!1)},ne=async Te=>{j(""),b(!0);try{const ie=Te.type==="image/gif";if(ie&&Te.size>7*1024*1024){j("El GIF pesa demasiado (máx 7 MB). Usa uno más corto o liviano para que tu página cargue rápido."),b(!1);return}const fe=ie?Te:await pv(Te),We=await(await c("/api/landing/upload",{method:"POST",headers:{"Content-Type":ie?"image/gif":"image/jpeg"},body:fe})).json().catch(()=>({}));We.ok&&We.url?n(We.url):j(We.message||"No se pudo subir la imagen")}catch{j("No se pudo procesar la imagen")}finally{b(!1)}},Q=e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("path",{d:"M17 8l-5-5-5 5"}),e.jsx("path",{d:"M12 3v12"})]}),de=e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),pe=e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),ce=e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})]}),ve=w?`Subiendo ${w.hecho+1} de ${w.total}â¦`:"Subiendoâ¦",ge={...ee,padding:"6px 11px",fontSize:12,display:"inline-flex",alignItems:"center",gap:5,transition:"all .15s ease"};return e.jsxs("div",{style:{marginBottom:8},onDragOver:Te=>{Te.preventDefault(),o&&x(!0)},onDragLeave:()=>x(!1),onDrop:B,children:[e.jsx("input",{ref:g,type:"file",accept:"image/*",multiple:!!m,style:{display:"none"},onChange:V}),a?e.jsxs("div",{style:{borderRadius:12,overflow:"hidden",border:L?"2px dashed "+me:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",transition:"border-color .15s ease, box-shadow .15s ease",boxShadow:z?"0 6px 18px -10px rgba(10,15,32,.25)":"none"},onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px 6px"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:800,color:"var(--text, #16181d)",letterSpacing:"-.01em",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),e.jsxs("button",{title:"Quitar imagen",style:{...ee,padding:"5px 8px",fontSize:12,color:"var(--danger)",display:"inline-flex",alignItems:"center",gap:4,flex:"none"},onClick:()=>
793n(""),children:[ce,e.jsx("span",{children:"Quitar"})]})]}),e.jsx("img",{src:a,alt:t,style:{display:"block",width:"100%",maxHeight:i?150:240,objectFit:"contain",background:"var(--input-bg, #f2f4fa)",transition:"transform .2s ease",transform:z?"scale(1.01)":"none"}}),e.jsxs("div",{style:{display:"flex",gap:6,padding:8,alignItems:"center",flexWrap:"wrap"},children:[o&&e.jsxs("button",{style:ge,onClick:p,disabled:f,children:[Q,e.jsx("span",{children:f?ve:"Subir nueva"})]}),o&&e.jsxs("button",{style:ge,onClick:()=>_(!0),children:[de,e.jsx("span",{children:"Mis imágenes"})]}),o&&e.jsxs("button",{style:{...ge,...S?{borderColor:me,color:me}:{}},onClick:()=>$(Te=>!Te),children:[pe,e.jsx("span",{children:"Pegar enlace"})]})]})]}):e.jsxs("div",{onClick:o&&!f?p:void 0,onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),style:{border:`2px dashed ${L||z?me:"var(--border, #cdd6e0)"}`,borderRadius:12,padding:i?"14px 12px":"22px 14px",textAlign:"center",cursor:o&&!f?"pointer":"default",background:L?"rgba(8,102,255,.06)":"var(--input-bg, #fafbff)",transition:"all .18s ease",transform:L?"scale(1.005)":"none"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:6,color:L||z?me:"var(--text-muted, #9aa3b5)",transition:"color .15s ease"},children:e.jsxs("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]})}),e.jsx("div",{style:{fontSize:13,fontWeight:800,letterSpacing:"-.01em"},children:t}),o?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted, #888)",marginTop:3},children:m?"Arrastra una o varias imágenes aquÃ, o:":"Arrastra una imagen aquÃ, o:"}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center",marginTop:9,flexWrap:"wrap"},children:[e.jsxs("button",{style:{...xa,padding:"8px 16px",fontSize:13,display:"inline-flex",alignItems:"center",gap:6},onClick:Te=>{Te.stopPropagation(),p()},disabled:f,children:[Q,e.jsx("span",{children:f?ve:m?"Subir fotos":"Subir imagen"})]}),e.jsxs("button",{style:{...ee,padding:"8px 14px",fontSize:13,display:"inline-flex",alignItems:"center",gap:6},onClick:Te=>{Te.stopPropagation(),_(!0)},children:[de,e.jsx("span",{children:"Mis imágenes"})]}),e.jsxs("button",{style:{...ee,padding:"8px 14px",fontSize:13,display:"inline-flex",alignItems:"center",gap:6,...S?{borderColor:me,color:me}:{}},onClick:Te=>{Te.stopPropagation(),$(ie=>!ie)},children:[pe,e.jsx("span",{children:"Pegar enlace"})]})]})]}):e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted, #888)",marginTop:6},children:"Pega el enlace abajo (la subida directa se activará pronto)"})]}),v&&e.jsx("div",{role:"alert",style:{fontSize:12,color:"var(--danger)",marginTop:5},children:v}),N&&e.jsx("input",{autoFocus:S,style:{...E,fontFamily:"monospace",fontSize:12,marginTop:6},value:a||"",onChange:Te=>n(Te.target.value),placeholder:"Pega aquà el enlace de la imagen (https://â¦)"}),C&&e.jsx(e8,{usedUrls:s,ownUrls:u,onSelect:Te=>{n(Te),_(!1)},onClose:()=>_(!1)})]})}const a8=t=>/\.(mp4|webm|m4v)(\?|$)/i.test(String(t||""));function Ru({values:t,onChange:a,uploadsEnabled:n,usedUrls:o,uniqueInList:i}){const s=t||[],u=(g,f)=>{if(!f){a(s.filter((b,v)=>v!==g));return}a(s.map((b,v)=>v===g?f:b))},m=g=>{g&&a([...s,g])},c=(g,f)=>{const b=g+f;if(b<0||b>=s.length)return;const v=[...s],j=v[g];v[g]=v[b],v[b]=j,a(v)};return e.jsxs("div",{children:[s.map((g,f)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:a8(g)?e.jsxs("div",{style:{border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:8,background:"var(--card-bg, #fff)",display:"flex",gap:10,alignItems:"center"},children:[e.jsx("video",{src:g,muted:!0,playsInline:!0,preload:"metadata",style:{width:74,height:54,objectFit:"cover",borderRadius:6,background:"#000",flexShrink:0}}),e.jsxs("span",{style:{fontSize:12,color:"var(--text-secondary)",flex:1},children:["Video ",f+1]}),e.jsx("button",{style:{...ee,padding:"4px 9px",fontSize:11.5,color:"var(--danger)"},onClick:()=>
793u(f,""),children:"Quitar"})]}):e.jsx(Rn,{label:`Imagen ${f+1}`,value:g,onChange:b=>u(f,b),uploadsEnabled:n,compact:!0,usedUrls:o,ownUrls:i?s.filter((b,v)=>v!==f):void 0})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,paddingTop:2},children:[e.jsx("button",{style:{...ee,padding:"3px 8px",fontSize:11},onClick:()=>c(f,-1),disabled:f===0,title:"Subir orden",children:"â"}),e.jsx("button",{style:{...ee,padding:"3px 8px",fontSize:11},onClick:()=>c(f,1),disabled:f===s.length-1,title:"Bajar orden",children:"â"})]})]},f)),e.jsx(Rn,{label:s.length?`Agregar imagen ${s.length+1}`:"Imagen principal del producto",value:"",onChange:m,onAddMany:g=>a([...s,...g]),uploadsEnabled:n,compact:!0,usedUrls:o,ownUrls:i?s:void 0})]})}function Su(t){var a;return[...((a=t==null?void 0:t.product)==null?void 0:a.images)||[],...((t==null?void 0:t.content_blocks)||[]).flatMap(n=>(n==null?void 0:n.type)==="image"?[n.url]:(n==null?void 0:n.type)==="carousel"?n.images||[]:[]),...(t==null?void 0:t.extra_images)||[]].filter(Boolean)}let Fp=null,Ku=Promise.resolve(),pc=0;const n8=["-pix_fmt","yuv420p","-colorspace","bt709","-color_primaries","bt709","-color_trc","bt709","-color_range","tv"];async function X2(){const{FFmpeg:t}=await Yp(async()=>{const{FFmpeg:n}=await import("./index-BWXEABTF.js");return{FFmpeg:n}},[]),{fetchFile:a}=await Yp(async()=>{const{fetchFile:n}=await import("./index-DRPQNq22.js");return{fetchFile:n}},[]);if(!Fp){const n=new t;await n.load({coreURL:location.origin+"/ffmpeg-core/ffmpeg-core.js?v=esm1",wasmURL:location.origin+"/ffmpeg-core/ffmpeg-core.wasm?v=esm1"}),Fp=n}return{ff:Fp,fetchFile:a}}async function o8(t,a){const n=Ku.then(async()=>{const{ff:o,fetchFile:i}=await X2(),s=`rin_${++pc}`,u=`rout_${pc}.mp4`;try{await o.writeFile(s,await i(t));const m=await o.exec(["-i",s,"-t",String(a),"-map","0:v:0","-map","0:a:0?","-c","copy","-movflags","+faststart","-y",u]);if(typeof m=="number"&&m!==0)throw new Error("recorte: ffmpeg terminó con "+m);const c=(await o.readFile(u)).slice();if(!c.byteLength)throw new Error("recorte vacÃo");return new File([c],(t.name.replace(/\.[\w]+$/,"")||"video")+".mp4",{type:"video/mp4"})}finally{try{await o.deleteFile(s)}catch{}try{await o.deleteFile(u)}catch{}}});return Ku=n.catch(()=>{}),n}async function r8(t,a,n=40*1024*1024){const o=Ku.then(async()=>{const{ff:i,fetchFile:s}=await X2(),u=`in_${++pc}`,m=`out_${pc}.mp4`,c=({progress:g})=>a(Math.max(1,Math.min(99,Math.round((g||0)*100))));i.on("progress",c);try{await i.writeFile(u,await s(t));const g=async(b,v,j,S)=>(await i.exec(["-i",u,"-vf",`scale=w=${b}:h=${b}:force_original_aspect_ratio=decrease:force_divisible_by=2`,"-c:v","libx264","-crf",v,"-preset",j,...n8,"-movflags","+faststart","-c:a","aac","-b:a","128k","-y",S]),(await i.readFile(S)).slice());let f=await g(1440,"25","veryfast",m);if(f.byteLength>n){const b=`out2_${pc}.mp4`;try{f=await g(960,"28","veryfast",b);try{await i.deleteFile(b)}catch{}}catch{}}try{await i.deleteFile(u),await i.deleteFile(m)}catch{}return new File([f],(t.name.replace(/\.[\w]+$/,"")||"video")+".mp4",{type:"video/mp4"})}finally{i.off("progress",c)}});return Ku=o.catch(()=>{}),o}function i8(t,a){const n=String((t==null?void 0:t.message)||t||"").toLowerCase();return/failed to import/.test(n)?"El conversor de video no arrancó bien. No es culpa de tu ar
793chivo ni de tu conexión: ya quedó reportado y lo revisamos. Mientras tanto, sube el video en menor resolución para que no necesite conversión.":/failed to fetch|networkerror|load failed|importscripts|ffmpeg-core|dynamically imported/.test(n)?"No se pudo cargar el conversor de video (son unos 30 MB). Revisa tu conexión y vuelve a intentarlo; si estás en datos móviles, intenta con wifi.":/out of memory|memory access out of bounds|allocation|maximum call stack|aborted|rangeerror/.test(n)?"A tu navegador se le acabó la memoria convirtiendo el video. Cierra otras pestañas y vuelve a intentarlo, o exporta el video en menor resolución (1080p o menos).":/invalid data|moov atom|does not contain|no such file|unsupported|decoder|codec/.test(n)?"El archivo no se pudo leer como video: puede estar dañado, incompleto o no ser un video. Vuelve a exportarlo y súbelo de nuevo.":a?"Este video viene en formato QuickTime y no se pudo convertir en tu navegador. Expórtalo como MP4 con códec H.264 y súbelo de nuevo.":"No se pudo convertir el video en tu navegador. Vuelve a intentarlo; si sigue fallando, expórtalo como MP4 (H.264) en 1080p o menos."}function s8({url:t}){const[a,n]=h.useState(0);return h.useEffect(()=>{let o=!0;const i=document.createElement("video");return i.preload="metadata",i.muted=!0,i.onloadedmetadata=()=>{o&&n(Number.isFinite(i.duration)?i.duration:0)},i.src=t,()=>{o=!1,i.removeAttribute("src");try{i.load()}catch{}}},[t]),Math.round(a)<=15?null:e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"6px 2px 0",lineHeight:1.45},children:["Dura ",Math.round(a)," s y cada visitante lo descarga completo. Para acortarlo, quÃtalo y vuelve a subirlo: te ofrecemos recortarlo a 12 s."]})}function Nu({value:t,onChange:a,uploadsEnabled:n,soloArchivo:o,onAddMany:i,etiqueta:s,recorteSugerido:u}){const m=$a(),c=h.useRef(null),[g,f]=h.useState(null),[b,v]=h.useState(!1),[j,S]=h.useState(null),$=h.useRef(a);$.current=a;const[C,_]=h.useState(0),[N,w]=h.useState(""),[M,p]=h.useState(!1),[V,L]=h.useState(""),x=!!t&&/youtube|youtu\.be|tiktok\.com|vimeo\.com/i.test(t),z=async(U,ne)=>{w(""),f(null);const Q=150*1024*1024,de=40*1024*1024;if(U.size>Q){w("El video pesa "+(U.size/1048576).toFixed(0)+" MB y el máximo para subir es 150 MB. Expórtalo en menor resolución (1080p basta) o recórtalo.");return}let pe=0;try{if(pe=await new Promise(Be=>{const We=document.createElement("video");We.preload="metadata",We.onloadedmetadata=()=>{Be(We.duration||0),URL.revokeObjectURL(We.src)},We.onerror=()=>Be(0),We.src=URL.createObjectURL(U)}),u&&!ne&&pe>u.siPasa){f({file:U,dur:pe});return}if(u&&ne==="recortar"&&pe>u.a){v(!0);try{U=await o8(U,u.a),pe=u.a}catch(Be){try{j1(Be,{donde:"recorte-video-portada",pesoMB:+(U.size/1048576).toFixed(2),duracionSeg:Math.round(pe)})}catch{}w("No se pudo recortar este video en tu navegador. Súbelo completo o recórtalo antes en tu celular."),v(!1);return}v(!1)}if(Math.round(pe)>90){w("El video dura "+Math.round(pe)+" segundos y el máximo son 90. Recórtalo y vuelve a subirlo.");return}}catch{}const ce=await(async()=>{try{const Be=new Uint8Array(await U.slice(0,12).arrayBuffer());return String.fromCharCode(Be[8],Be[9],Be[10],Be[11]).trim().toLowerCase()==="qt"}catch{return!1}})(),ve=/quicktime|\.mov$/i.test(U.type+" "+U.name)||ce,ge=await(async()=>{try{const Be=[U.slice(0,1048576)];U.size>2*1024*1024&&Be.push(U.slice(U.size-1024*1024));for(const We of Be){const ze=new Uint8Array(await We.arrayBuffer());for(let tt=0;tt+4<=ze.length;tt++)if(ze[tt]===104&&ze[tt+3]===49&&(ze[tt+1]===118&&ze[tt+2]===99||ze[tt+1]===101&&ze[tt+2]===118))return!0}}catch{}return!1})(),Te=4*1024*1024,ie=U.size>8*1024*1024||U.size>Te&&pe>0&&U.size/pe>900*1024,fe=U.size>de;if(ve||ge||ie||fe){v(!0);try{w("");const Be=U.size;_(1),U=await r8(U,_,de),_(0),Be>0&&U.size>0&&w("")}catch(Be){_(0);try{j1(Be,{donde:"compresion-video-editor",pesoMB:+(U.size/1048576).toFixed(2),duracionSeg:Math.round(pe),tipo:U.type||"(sin tipo)",marcaQuickTime:ce,entroPorMov:ve,entroPorHevc:ge,entroPorPeso:ie,entroPorObligatorio:fe})}catch{}if(!ie&&!ge&&U.size<=de)w("");else{const ze=(U.size/1048576).toFixed(1);w(i8(Be,ce)+` Y este archivo pesa ${ze} MB: a ese peso carga lento en celulares y el comprador se va.`),v(!1);return}}}v(!0);try{const We=await(await m("/api/landing/upload-video",{method:"POST",headers:{"Content-Type":U.type||"video/mp4"},body:U})).json().catch(()=>({}));if(We.ok&&We.url){let ze;try{const tt=await new Promise(Fe=>{const F=document.createElement("video");
793F.muted=!0,F.playsInline=!0,F.preload="auto";const Re=I=>{try{URL.revokeObjectURL(F.src)}catch{}Fe(I)},K=()=>{try{const I=F.videoWidth,H=F.videoHeight;if(!I||!H)return Re(null);const ye=document.createElement("canvas");ye.width=I,ye.height=H;const De=ye.getContext("2d");if(!De)return Re(null);De.drawImage(F,0,0,I,H),ye.toBlob(Ue=>Re(Ue?{blob:Ue,w:I,h:H}:null),"image/webp",.82)}catch{Re(null)}};F.onloadeddata=()=>{try{F.currentTime=Math.min(.1,(F.duration||1)/10)}catch{K()}},F.onseeked=K,F.onerror=()=>Re(null),setTimeout(()=>Re(null),9e3),F.src=URL.createObjectURL(U)});if(tt){const F=await(await m("/api/landing/upload",{method:"POST",headers:{"Content-Type":"image/webp"},body:tt.blob})).json().catch(()=>({}));F.ok&&F.url&&(ze={poster:F.url,vw:tt.w,vh:tt.h})}}catch{}$.current(We.url,ze)}else w(We.message||"No se pudo subir el video")}catch{w("No se pudo subir el video")}finally{v(!1)}},G=async U=>{const ne=[];S({hecho:0,total:U.length}),$.current=(Q,de)=>{ne.push({url:Q,extra:de})};try{for(const Q of U)await z(Q),S(de=>de&&{...de,hecho:de.hecho+1})}finally{$.current=a,S(null)}ne.length&&(i==null||i(ne))},B=()=>{const U=V.trim();U&&(a(U),L(""),p(!1))};return t?e.jsxs("div",{style:{border:"1px solid var(--border, #e5e7eb)",borderRadius:12,padding:10,background:"var(--card-bg, #fff)"},children:[x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",wordBreak:"break-all"},children:["Enlace de video: ",t]}),/tiktok\.com|instagram\.com/i.test(String(t))&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:7,lineHeight:1.5,background:"var(--bg-hover, #f8fafc)",border:"1px solid var(--border, #e5e7eb)",borderRadius:8,padding:"7px 9px"},children:["Asà se ve con el marco de TikTok: sale el perfil, el texto, la música y sus videos relacionados, y un botón que se lleva a tu comprador a TikTok. Eso no se puede quitar.",e.jsx("b",{children:" Si quieres solo el video, a lo ancho completo:"}),' guárdalo desde TikTok (los tuyos se pueden descargar) y súbelo aquà con "Subir video".']})]}):e.jsx("video",{src:t,muted:!0,playsInline:!0,controls:!0,style:{width:"100%",maxHeight:200,borderRadius:8,background:"#000",display:"block"}}),e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12,color:"#dc2626",marginTop:8},onClick:()=>a(""),children:"Quitar video"})]}):e.jsxs("div",{style:{border:"2px dashed var(--border, #cdd6e0)",borderRadius:12,padding:"14px 12px",background:"var(--input-bg, #fafbff)"},children:[e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center",justifyContent:"center"},children:[n&&e.jsx("button",{style:{...ee,padding:"8px 12px",fontSize:12.5},onClick:()=>{var U;return(U=c.current)==null?void 0:U.click()},disabled:b,children:b?C>0?`Comprimiendo${j?` ${j.hecho+1} de ${j.total}`:""}⦠${C}%`:j?`Subiendo ${j.hecho+1} de ${j.total}â¦`:"Subiendoâ¦":s||"Subir video (mp4)"}),!o&&e.jsx("button",{style:{...ee,padding:"8px 12px",fontSize:12.5},onClick:()=>p(U=>!U),children:"Pegar enlace (YouTube/TikTok)"})]}),!o&&(M||!n)&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("input",{style:{...E,flex:1,marginTop:0},value:V,onChange:U=>L(U.target.value),onKeyDown:U=>{U.key==="Enter"&&B()},placeholder:"https://youtube.com/... o tiktok.com/..."}),e.jsx("button",{style:{...xa,padding:"8px 12px"},onClick:B,children:"Usar"})]}),e.jsx("input",{ref:c,type:"file",accept:"video/*",multiple:!!i,style:{display:"none"},onChange:U=>{const ne=Array.from(U.target.files||[]);U.currentTarget.value="",ne.length&&(i&&ne.length>1?G(ne):z(ne[0]))}}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"8px 0 0",textAlign:"center"},children:"Video de máximo 90 segundos. Súbelo hasta 150 MB: lo optimizamos aquà mismo. Se reproduce silenciado y en bucle."}),g&&u&&e.jsxs("div",{role:"status",style:{marginTop:8,fontSize:12,lineHeight:1.45,textAlign:"center"},children:["Dura ",Math.round(g.dur)," s y en la portada cada visitante lo descarga completo.",e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap",marginTop:7},children:[e.jsxs("button",{type:"button",style:{...xa,padding:"7px 12px",fontSize:12.5},onClick:()=>z(g.file,"recortar"),children:["Recortar a los primeros ",u.a," s"]}),e.jsx("button",{type:"button",style:{...ee,padding:"7px 12px",fontSize:12.5},onClick:()=>z(g.file,"completo"),children:"Subirlo completo"})]})]}),N&&e.jsx("div",{style:{fontSize:11.5,color:"#dc2626",marginTop:6,textAlign:"center"},children:N})]})}const l8=` 794/* Rejilla del módulo de analÃtica (Andrés 2026-07-27). Seis columnas para poder dar proporciones 795 distintas por fila, como en el boceto aprobado: 796 fila 1 titular de conversión (2) + embudo (4) <- asimétrica a propósito
797 fila 2 de dónde llega (3) + puntos débiles (3) 798 fila 3 de qué ciudades (3) + cuándo compran (3) 799 El orden lo fija CSS 'order' y el ancho 'grid-column', sin mover nada del DOM. 800 Por debajo de 900px se apila todo en una sola columna. */ 801.lk-agrid{display:grid;gap:14px;grid-template-columns:repeat(6,minmax(0,1fr));align-items:stretch} 802@media (max-width:900px){ 803 .lk-agrid{grid-template-columns:minmax(0,1fr)} 804 .lk-agrid > *{grid-column:1 / -1 !important;min-width:0} 805} 806/* Ninguna tarjeta de la rejilla puede medir más que su columna (Andrés 2026-09-06, celular). */ 807.lk-agrid .lk-kpi{min-width:0;max-width:100%} 808.lk-agrid > *{min-width:0} 809 810/* Tarjeta de landing en CUADRICULA (Andrés 2026-07-26: "que no parezca genérica"). Tres detalles, 811 todos sobrios: un matiz de color muy tenue en la esquina, un contorno que se enciende al pasar y 812 una elevación corta. Nada de sombras duras ni degradados chillones. */ 813/* SIN overflow:hidden: recortaba el menú de tres puntos (Andrés lo vio cortado). El matiz se queda 814 dentro del borde solo, con inset 0 y el mismo redondeo de la tarjeta. */ 815.lk-gcard{position:relative;isolation:isolate; 816 transition:transform .2s cubic-bezier(.22,1,.28,1),box-shadow .2s ease,border-color .2s ease} 817.lk-gcard::before{content:'';position:absolute;z-index:-1;inset:0;border-radius:inherit;pointer-events:none; 818 background:radial-gradient(170px 170px at 100% 0%,var(--lk-accent,#0866FF) 0%,transparent 68%);opacity:.06;transition:opacity .25s ease} 819.lk-gcard:hover{transform:translateY(-2px);border-color:var(--lk-accent,#0866FF)!important; 820 box-shadow:0 1px 2px rgba(11,16,32,.05),0 16px 34px -22px rgba(11,16,32,.6)} 821.lk-gcard:hover::before{opacity:.12} 822/* El enlace se subraya solo al pasar, con el subrayado creciendo desde la izquierda. */ 823.lk-glink{position:relative;text-decoration:none} 824.lk-glink::after{content:'';position:absolute;left:0;right:100%;bottom:-2px;height:1.5px;border-radius:2px; 825 background:currentColor;opacity:.5;transition:right .28s cubic-bezier(.22,1,.28,1)} 826.lk-glink:hover::after{right:0} 827/* Punto de estado: un latido lento SOLO en las publicadas, para distinguirlas de un vistazo. */ 828.lk-dot{width:5px;height:5px;border-radius:50%;background:currentColor;flex:none;box-shadow:0 0 0 0 currentColor;animation:lkDot 2.8s ease-out infinite} 829@keyframes lkDot{0%{box-shadow:0 0 0 0 currentColor;opacity:.9}70%{box-shadow:0 0 0 5px transparent;opacity:.55}100%{box-shadow:0 0 0 0 transparent;opacity:.9}} 830@media (prefers-reduced-motion: reduce){.lk-gcard,.lk-glink::after{transition:none}.lk-dot{animation:none}} 831 832/* Acabado AURORA para lo seleccionado, en todo el constructor (Andrés 2026-07-26: "ese cambio de los 833 botones debe aplicarse a todo el constructor, no quiero botones con fondos azules"). 834 .lk-sel-aurora = relleno, para lo que antes era azul plano. 835 .lk-ring-aurora = solo el contorno, para las tarjetas de variante: marca la elegida sin taparla. */ 836.lk-sel-aurora{color:#fff!important;border-color:transparent!important; 837 background:linear-gradient(115deg,#0866FF,#5B8DEF 22%,#7C3AED 48%,#2563EB 74%,#0866FF)!important; 838 background-size:260% 100%!important; 839 box-shadow:0 1px 0 rgba(255,255,255,.22) inset,0 6px 16px -9px rgba(8,102,255,.8); 840 animation:lkAurora 11s ease-in-out infinite} 841.lk-ring-aurora{position:relative;border-color:transparent!important;background:var(--card-bg,#fff)!important} 842.lk-ring-aurora::before{content:'';position:absolute;inset:0;border-radius:inherit;padding:1.8px;pointer-events:none; 843 background:linear-gradient(115deg,#0866FF,#5B8DEF 22%,#7C3AED 48%,#2563EB 74%,#0866FF);background-size:260% 100%; 844 animation:lkAurora 11s ease-in-out infinite; 845 -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor; 846 mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask-composite:exclude} 847@media (prefers-reduced-motion: reduce){.lk-sel-aurora,.lk-ring-aurora::before{animation:none}} 848 849/* Grupos de opciones (Andrés 2026-07-26): "pon la animación que pusiste arriba cuando uno pasa de 850 Producto a Página" y "aún siguen con esos fondos azules, quiero el otro más premium con efecto 851 aurora". La pastilla se DESLIZA hasta la opción elegida, igual que en las pestañas, y en vez del 852 azul plano lleva un degradado que se mueve muy lento. Sobrio: el movimiento dura 11s, no parpadea. */ 853.lk-pill-ind{ 854 background:linear-gradient(115deg,#0866FF,#5B8DEF 22%,#7C3AED 48%,#2563EB 74%,#0866FF);
855 background-size:260% 100%; 856 box-shadow:0 1px 0 rgba(255,255,255,.22) inset,0 6px 16px -9px rgba(8,102,255,.8); 857 animation:lkAurora 11s ease-in-out infinite; 858 transition:transform .42s cubic-bezier(.22,1,.28,1),width .42s cubic-bezier(.22,1,.28,1),height .42s cubic-bezier(.22,1,.28,1)} 859@keyframes lkAurora{0%,100%{background-position:0 0}50%{background-position:100% 0}} 860.lk-pills button{transition:color .22s ease} 861.lk-pills button:not([data-on="1"]):hover{color:var(--text,#111)} 862@media (prefers-reduced-motion: reduce){.lk-pill-ind{animation:none;transition:none}} 863 864/* Buscador con contorno DORADO (Andrés 2026-07-26). Un hilo de luz recorre el borde muy lento: llama 865 la atención sobre "busca por nombre o enlace" sin parpadear. El dorado es el único color cálido del 866 módulo, asà que no compite con el azul de la marca. */ 867.lk-search{padding:1.5px;border-radius:13.5px; 868 background:linear-gradient(115deg,#C9963A,#F3D68A 20%,rgba(201,150,58,.16) 47%,#F3D68A 74%,#C9963A); 869 background-size:280% 100%;animation:lkGold 9s ease-in-out infinite} 870@keyframes lkGold{0%,100%{background-position:0 0}50%{background-position:100% 0}} 871.lk-search input{border-color:transparent!important;border-radius:12px!important} 872.lk-search:focus-within{animation-duration:4.5s} 873 874/* Botón "Editar": un brillo suave y lento que lo cruza cada varios segundos, para que sea obvio cuál 875 es la acción principal de cada landing. El barrido dura ~1.3s dentro de un ciclo de 7s. */ 876.lk-edit{position:relative;overflow:hidden} 877.lk-edit::after{content:'';position:absolute;top:0;bottom:0;width:34%;left:-55%;pointer-events:none; 878 background:linear-gradient(100deg,transparent,rgba(255,255,255,.40),transparent); 879 transform:skewX(-18deg);animation:lkShine 7s ease-in-out infinite} 880@keyframes lkShine{0%{left:-55%}19%{left:125%}100%{left:125%}} 881@media (prefers-reduced-motion: reduce){.lk-search{animation:none}.lk-edit::after{animation:none;opacity:0}} 882 883/* Botones de IA (Andrés 2026-07-26): un destello que cruza LENTO, cada varios segundos. Marca que 884 ahà hay inteligencia artificial sin parpadear todo el tiempo ni usar emojis. El principal lleva 885 además un borde con el azul de la marca. Se apaga con reduced-motion. */ 886.lk-ia-row{display:flex;gap:7px;flex-wrap:wrap;align-items:center} 887.lk-ia-btn{position:relative;overflow:hidden;border-color:rgba(8,102,255,.28)!important} 888.lk-ia-btn::after{content:'';position:absolute;top:0;left:-150%;width:42%;height:100%;pointer-events:none; 889 background:linear-gradient(100deg,transparent,rgba(8,102,255,.20),transparent);transform:skewX(-14deg); 890 animation:lkIaSheen 6s cubic-bezier(.4,0,.2,1) infinite} 891/* "Armar con IA" recupera el HOLOGRAMA interno que tenÃa antes: un velo violeta-azul-cian que se 892 desplaza despacio por dentro del botón. Es el que hace el trabajo pesado, asà que se distingue de 893 los dos creadores. El velo es muy transparente: el texto se sigue leyendo perfecto. */ 894.lk-ia-btn.lk-ia-main{border-color:rgba(124,58,237,.45)!important;box-shadow:0 0 0 1px rgba(124,58,237,.10),0 6px 18px -12px rgba(124,58,237,.85)} 895.lk-ia-btn.lk-ia-main::before{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none; 896 background:linear-gradient(115deg,rgba(124,58,237,.17),rgba(37,99,235,.17) 34%,rgba(6,182,212,.15) 56%,rgba(124,58,237,.17)); 897 background-size:280% 100%;animation:lkAiHolo 7s ease-in-out infinite} 898.lk-ia-btn.lk-ia-main::after{background:linear-gradient(100deg,transparent,rgba(167,139,250,.38),transparent)} 899@keyframes lkAiHolo{0%,100%{background-position:0% 0}50%{background-position:100% 0}} 900.lk-ia-btn:hover{border-color:rgba(8,102,255,.6)!important;transform:translateY(-1px)} 901@keyframes lkIaSheen{0%,62%{left:-150%}100%{left:180%}} 902@media (prefers-reduced-motion: reduce){.lk-ia-btn::after{display:none}.lk-ia-btn.lk-ia-main::before{animation:none}} 903 904@keyframes lkRise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } } 905@keyframes lkPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.45) } 50% { box-shadow: 0 0 0 5px rgba(22,163,74,0) } } 906@keyframes lkSpin { to { transform: rotate(360deg) } } 907.lk-kpi { animation: lkRise .34s cubic-bezier(0,.4,0,1) both; transition: transform .16s cubic-bezier(.4,0,.2,1), box-shadow .16s cubic-bezier(.4,0,.2,1); will-change: transform; } 908.lk-kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,30,60,.05), 0 12px 28px -8px rgba(20,30,60,.12); } 909.lk-dot { animation: lkPulse 1.7s ease-in-out 3; } 910.lk-row { animation: lkRise .34s cubic-bezier(0,.4,0,1) both; transition: transform .16s cubic-bezier(.4,0,.2,1), box-shadow .16s cubic-bezier(.4,0,.2,1), border-color .16s ease; } 911.lk-row:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,30,60,.04), 0 10px 24px -8px rgba(20,30,60,.10); border-color: rgba(8,102,255,.28); } 912/* Modo selección de «Mis landings» (25-sep-2026): la tarjeta entera es la casilla. Lo de adentro no 913 recibe el puntero (ni el hover ni el clic), asà nada parece tocable salvo la tarjeta misma. */ 914.lk-marcable { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; } 915.lk-marcable * { pointer-events: none !important; } 916.lk-marcable:focus-visible { outline: 2px solid #0866FF; outline-offset: 2px; } 917/* Su barra flotante: centrada en PC; en celular se corre a la izquierda para no quedar debajo de los 918 globos de ayuda y de chat de la esquina (el mismo hueco de 80px que deja la barra de PÃxeles). */ 919.lk-barra-sel { position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: max-content; max-width: calc(100vw - 24px); box-sizing: border-box; } 920.lk-barra-sel-aire { height: 96px; } 921@media (max-width: 640px) {
922 .lk-barra-sel { left: 12px; right: 84px; transform: none; width: auto; max-width: none; padding: 9px 10px !important; gap: 6px !important; } 923 .lk-barra-sel button { padding: 7px 9px !important; font-size: 11.5px !important; } 924 .lk-barra-sel-aire { height: 130px; } 925} 926@keyframes lkDraw { from { stroke-dashoffset: 1 } to { stroke-dashoffset: 0 } } 927.lk-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: lkDraw .9s cubic-bezier(.22,1,.36,1) forwards; } 928@keyframes lkMiss { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.38); border-color: rgba(220,38,38,.45) } 50% { box-shadow: 0 0 0 4px rgba(220,38,38,0); border-color: rgba(220,38,38,.95) } } 929.lk-miss { animation: lkMiss 1.7s ease-in-out infinite; } 930/* Skeleton sobrio del resumen (rediseño 2026-07-10): bloques que respiran, sin spinners. */ 931@keyframes lkSkel { 0%,100% { opacity: .45 } 50% { opacity: .95 } } 932.lk-skel { display: block; background: var(--input-bg, #eef1f6); animation: lkSkel 1.5s ease-in-out infinite; } 933@media (prefers-reduced-motion: reduce) { .lk-kpi, .lk-row, .lk-dot, .lk-miss, .lk-skel { animation: none !important; } .lk-draw { animation: none !important; stroke-dashoffset: 0 !important; } } 934.lk-grip { cursor: grab; touch-action: none; opacity: .55; transition: opacity .15s; 935 /* Andrés 2026-08-03: en iOS una pulsación un pelo larga sacaba la lupa y CANCELABA el arrastre 936 a medio camino. Y el área tocable era de 17x20px, muy por debajo de los 44 recomendados. */ 937 user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } 938.lk-grip:hover { opacity: 1; } 939.lk-dragging { opacity: .4; } 940.lk-dropline { box-shadow: 0 -2px 0 0 var(--accent, #0866ff); } 941.lk-act { transition: background .14s ease, border-color .14s ease, transform .14s ease; } 942.lk-act:hover { border-color: rgba(8,102,255,.45); background: rgba(8,102,255,.05); transform: translateY(-1px); } 943.lk-mi { transition: background .12s ease; } 944.lk-mi:hover { background: var(--input-bg, #f1f3f8); } 945.lk-kebab { transition: background .14s ease, border-color .14s ease; } 946.lk-kebab:hover { background: var(--input-bg, #f1f3f8); border-color: rgba(8,102,255,.35); } 947/* Tira de pestañas/chips que se desliza en móvil en vez de desbordar la pantalla. */ 948.lk-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100%; } 949.lk-scroll-x::-webkit-scrollbar { display: none; } 950/* ââ TABLERO Kanban (rediseño 2026-07-10): columnas limpias, tarjetas con jerarquÃa ââ */ 951/* Pista horizontal del tablero: scrollbar FINA visible en escritorio (con 10 columnas hay 952 que saber que se puede desplazar), snap por columna en móvil. */ 953.lk-board { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; scrollbar-width: thin; scrollbar-color: var(--border, #d7dbe4) transparent; } 954.lk-board::-webkit-scrollbar { height: 8px; } 955.lk-board::-webkit-scrollbar-track { background: transparent; } 956.lk-board::-webkit-scrollbar-thumb { background: var(--border, #d7dbe4); border-radius: 99px; } 957.lk-bcol-body { scrollbar-width: thin; scrollbar-color: var(--border, #dde2ea) transparent; } 958.lk-bcol-body::-webkit-scrollbar { width: 5px; } 959.lk-bcol-body::-webkit-scrollbar-thumb { background: var(--border, #dde2ea); border-radius: 99px; } 960/* Tarjeta del tablero: entra con lkRise y se eleva 2px al pasar el mouse (sin tocar su 961 sombra inline de estado). Mientras se arrastra, el transform inline manda. */ 962.lk-bcard { animation: lkRise .3s cubic-bezier(0,.4,0,1) both; transition: transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s cubic-bezier(.4,0,.2,1), opacity .15s ease; will-change: transform; } 963.lk-bcard:hover { transform: translateY(-2px); } 964/* Hueco punteado que "respira" en la columna destino durante el arrastre. */ 965@keyframes lkDropPulse { 0%,100% { opacity: .55 } 50% { opacity: 1 } } 966.lk-bdrop { animation: lkDropPulse 1.1s ease-in-out infinite; } 967@media (prefers-reduced-motion: reduce) { .lk-bcard, .lk-bdrop { animation: none !important; } .lk-bcard:hover { transform: none; } } 968/* Andrés 2026-06-17 (auditorÃa móvil): checkboxes del editor un poco más 969 grandes = más fáciles de tocar en celular. */ 970.lk-editor input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; flex: none; } 971/* MÃVIL (<980px): el editor SIEMPRE en una columna y sin desbordar a los lados, 972 sin importar la bandera JS 'wide' (que en DevTools/rotación se queda pegada en 973 modo escritorio). Esto neutraliza el "corrido para un lado". */ 974@media (max-width: 979px) { 975 /* CLAVE: el editor es un flex-item en columna con min-width:auto, asà que su 976 contenido (la barra de pestañas) lo inflaba a ~573px en un viewport de 430. 977 width:100% le da un ancho DEFINIDO (= el del contenedor) y deja de crecer. */ 978 .lk-editor { width: 100% !important; min-width: 0 !important; overflow-x: hidden; } 979 /* Andrés 2026-08-03: en el celular esta fila NO envolvÃa. La columna izquierda es flex:none y se 980 inflaba a 413px (el ancho de los tres botones de IA), empujando la derecha fuera de pantalla: 981 Deshacer, Compartir, Duplicar y PUBLICAR quedaban en x=449..543 sobre una pantalla de 360, y 982 como .lk-editor recorta sin dejar deslizar, eran INALCANZABLES. Un vendedor podÃa armar toda su 983 landing desde el teléfono y no tenÃa cómo publicarla. Medido en Chromium a 360, 375 y 390. */ 984 .lk-actions { flex-wrap: wrap !important; } 985 .lk-actions > div { flex: 1 1 100% !important; min-width: 0 !important; } 986 .lk-actions > div:last-child { justify-content: flex-start !important; } 987 .lk-2col { flex-direction: column !important; } 988 .lk-col { flex: 1 1 auto !important; width: 100% !important; max-width: 100% !important; min-width: 0 !important; position: static !important; max-height: none !important; overflow-y: visible !important; padding-right: 0 !important; } 989} 990@media (max-width: 600px) { 991 /* En celular, las grillas de 2 y 3 columnas del editor se apilan a 1 (inputs
992 anchos y legibles, sin que el ancho dependa del contenido). */ 993 .lk-editor div[style*="minmax(0, 1fr) minmax(0, 1fr)"], 994 .lk-editor div[style*="1fr 1fr 1fr"], 995 .lk-editor div[style*="repeat(3, 1fr)"], 996 .lk-editor div[style*="repeat(3, minmax(0, 1fr))"] { grid-template-columns: 1fr !important; } 997 /* Pestañas del editor más compactas para que quepan mejor en celular. */ 998 .lk-scroll-x button { padding: 6px 9px !important; font-size: 11.5px !important; } 999 /* iOS hace zoom automático al enfocar inputs con font-size < 16px (molesto). En 1000 celular forzamos 16px en los campos del editor (escritorio queda igual). */ 1001 .lk-editor input, .lk-editor select, .lk-editor textarea { font-size: 16px !important; } 1002} 1003/* ââ PAGO ANTICIPADO (sin recaudo): look PREMIUM dorado ââ */ 1004@keyframes lkGoldFlow { 0% { background-position: 0% 50% } 100% { background-position: 200% 50% } } 1005@keyframes lkGoldGlow { 0%,100% { box-shadow: 0 0 0 1px rgba(212,160,23,.22), 0 6px 20px -10px rgba(212,160,23,.5) } 50% { box-shadow: 0 0 0 1px rgba(212,160,23,.45), 0 12px 30px -8px rgba(212,160,23,.8) } } 1006@keyframes lkSparkle { 0%,100% { opacity: 0; transform: scale(.3) rotate(0deg) } 45%,60% { opacity: 1; transform: scale(1) rotate(90deg) } } 1007@keyframes lkShimmer { 0% { transform: translateX(-130%) } 55%,100% { transform: translateX(360%) } } 1008.lk-paid { position: relative; border-color: transparent !important; animation: lkRise .34s cubic-bezier(0,.4,0,1) both, lkGoldGlow 3s ease-in-out infinite; } 1009.lk-paid::before { content:''; position:absolute; inset:0; border-radius:18px; padding:1.7px; background: linear-gradient(110deg,#f7d774,#b8860b,#fff6c9,#d4a017,#f7d774); background-size:220% 100%; animation: lkGoldFlow 4.2s linear infinite; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events:none; z-index:0; } 1010.lk-spk { position:absolute; width:8px; height:8px; pointer-events:none; z-index:2; background: radial-gradient(circle at center, #fff7d6 0%, #f3c95b 55%, rgba(243,201,91,0) 72%); } 1011.lk-spk1 { top:9px; right:16%; animation: lkSparkle 2.6s ease-in-out .2s infinite; } 1012.lk-spk2 { bottom:13px; left:8%; animation: lkSparkle 3.2s ease-in-out 1.2s infinite; } 1013.lk-spk3 { top:48%; right:7px; animation: lkSparkle 2.9s ease-in-out 2s infinite; } 1014.lk-gold-badge { position:relative; overflow:hidden; color:#6e4a00; background: linear-gradient(135deg,#fde9a8,#f3c95b 52%,#dca42b); border:1px solid rgba(184,134,11,.5); box-shadow: 0 1px 3px rgba(184,134,11,.32); } 1015.lk-gold-badge::after { content:''; position:absolute; top:0; left:0; width:38%; height:100%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.9), transparent); transform: translateX(-130%); animation: lkShimmer 3.4s ease-in-out infinite; } 1016/* COMPLETADO (verde) y PAGO FALLIDO (rojo): mismo borde animado que el dorado, otro color. */ 1017@keyframes lkGreenGlow { 0%,100% { box-shadow: 0 0 0 1px rgba(22,163,74,.2), 0 6px 20px -10px rgba(22,163,74,.45) } 50% { box-shadow: 0 0 0 1px rgba(22,163,74,.42), 0 12px 30px -8px rgba(22,163,74,.72) } } 1018@keyframes lkRedGlow { 0%,100% { box-shadow: 0 0 0 1px rgba(220,38,38,.2), 0 6px 20px -10px rgba(220,38,38,.42) } 50% { box-shadow: 0 0 0 1px rgba(220,38,38,.46), 0 12px 30px -8px rgba(220,38,38,.72) } } 1019.lk-done { position: relative; border-color: transparent !important; animation: lkRise .34s cubic-bezier(0,.4,0,1) both, lkGreenGlow 3s ease-in-out infinite; } 1020.lk-done::before { content:''; position:absolute; inset:0; border-radius:18px; padding:1.7px; background: linear-gradient(110deg,#86efac,#16a34a,#dcfce7,#22c55e,#86efac); background-size:220% 100%; animation: lkGoldFlow 4.2s linear infinite; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events:none; z-index:0; } 1021.lk-done .lk-spk { background: radial-gradient(circle at center, #eafff1 0%, #4ade80 55%, rgba(74,222,128,0) 72%); } 1022.lk-fail { position: relative; border-color: transparent !important; animation: lkRise .34s cubic-bezier(0,.4,0,1) both, lkRedGlow 2.4s ease-in-out infinite; } 1023.lk-fail::before { content:''; position:absolute; inset:0; border-radius:18px; padding:1.7px; background: linear-gradient(110deg,#fca5a5,#dc2626,#fee2e2,#ef4444,#fca5a5); background-size:220% 100%; animation: lkGoldFlow 3.4s linear infinite; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events:none; z-index:0; } 1024@media (prefers-reduced-motion: reduce) { .lk-paid, .lk-paid::before, .lk-done, .lk-done::before, .lk-fail, .lk-fail::before, .lk-spk, .lk-gold-badge::after { animation: none !important; } } 1025`;function gm(){return e.jsx("style",{children:l8})}function By(t){const a=String(t||"");return/lower than the min|min(?:imum)? amount|monto (?:muy bajo|es muy bajo)|too low/i.test(a)?"El monto es muy bajo para pagar en lÃnea. Usa un valor más alto.":/no est[áa] conectad|conecta tu cuenta|credencial|unauthorized|invali
1025d.*key/i.test(a)?"Revisa la conexión de tu pasarela de pago.":a.split("[")[0].replace(/cobro en l[iÃ]nea fall[óo]:?/i,"").trim()||"No se pudo procesar el pago en lÃnea. Intenta de nuevo."}function mm(t){const[a,n]=h.useState(null),o=h.useRef(null),i=h.useRef(0),s=h.useCallback(()=>{i.current&&(cancelAnimationFrame(i.current),i.current=0),o.current=null,n(g=>g===null?g:null)},[]);return h.useEffect(()=>{if(a===null)return;const g=()=>s();return window.addEventListener("pointerup",g,!0),window.addEventListener("pointercancel",g,!0),window.addEventListener("blur",g),()=>{window.removeEventListener("pointerup",g,!0),window.removeEventListener("pointercancel",g,!0),window.removeEventListener("blur",g)}},[a,s]),{dragIdx:a,start:(g,f)=>{f.stopPropagation(),f.preventDefault();try{f.currentTarget.setPointerCapture(f.pointerId)}catch{}o.current=g,n(g)},over:g=>{if(o.current===null)return;if(g.pointerType==="mouse"&&g.buttons===0){s();return}const f=g.clientX,b=g.clientY;i.current||(i.current=requestAnimationFrame(()=>{if(i.current=0,o.current===null)return;const v=95,j=(()=>{let w=document.elementFromPoint(f,b);for(;w&&w!==document.body;){const M=getComputedStyle(w).overflowY;if((M==="auto"||M==="scroll")&&w.scrollHeight>w.clientHeight+4)return w;w=w.parentElement}return null})();if(j){const w=j.getBoundingClientRect();b<w.top+v?j.scrollTop-=Math.ceil((w.top+v-b)/2.5):b>w.bottom-v&&(j.scrollTop+=Math.ceil((b-(w.bottom-v))/2.5))}else{const w=window.innerHeight;b<v?window.scrollBy(0,-Math.ceil((v-b)/2.5)):b>w-v&&window.scrollBy(0,Math.ceil((b-(w-v))/2.5))}const S=document.elementFromPoint(f,b),$=S?S.closest("[data-dragidx]"):null;if(!$)return;const C=Number($.getAttribute("data-dragidx"));if(Number.isNaN(C)||C===o.current)return;const _=$.getBoundingClientRect(),N=C>o.current;N&&b<_.top+_.height/2||!N&&b>_.top+_.height/2||(t(o.current,C),o.current=C,n(C))}))},end:g=>{try{g.currentTarget.releasePointerCapture(g.pointerId)}catch{}s()}}}const wu=({s:t=13})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:e.jsx("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"})}),Hl=({s:t=13})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0Z"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),Ls=({s:t=13})=>e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 2"})]}),Bo=({s:t=15})=>e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",style:{flex:"none"},children:e.jsx("path",{d:"M.057 24l1.687-6.163a11.867 11.867 0 0 1-1.587-5.946C.16 5.335 5.495 0 12.05 0a11.82 11.82 0 0 1 8.413 3.488 11.82 11.82 0 0 1 3.48 8.414c-.003 6.557-5.338 11.892-11.893 11.892a11.9 11.9 0 0 1-5.688-1.448L.057 24zm6.597-3.807c1.676.995 3.276 1.591 5.392 1.592 5.448 0 9.886-4.434 9.889-9.885.002-5.462-4.415-9.89-9.881-9.892-5.452 0-9.887 4.434-9.889 9.884a9.86 9.86 0 0 0 1.51 5.26l-.999 3.648 3.978-1.027zm11.387-5.464c-.074-.124-.272-.198-.57-.347-.297-.149-1.758-.868-2.031-.967-.272-.099-.47-.149-.669.149-.198.297-.768.967-.941 1.165-.173.198-.347.223-.644.074-.297-.149-1.255-.462-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.297-.347.446-.521.151-.172.2-.296.3-.495.099-.198.05-.372-.025-.521-.075-.148-.669-1.612-.916-2.206-.242-.579-.487-.501-.669-.51l-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.758-.719 2.006-1.413.248-.695.248-1.29.173-1.414z"})}),Wy={tiktok:{label:"TikTok",logo:"/logos/tiktok.svg",logoBg:"#000",color:"var(--text, #111)",bg:"rgba(120,120,120,.12)"},meta:{label:"Meta",logo:"/logos/meta.svg",logoBg:"#EEF3FF",color:"#1877F2",bg:"rgba(24,119,242,.12)"},whatsapp:{label:"WhatsApp",logoBg:"#25D366",color:"#128C42",bg:"rgba(37,211,102,.14)"},organico:{label:"Orgánico",logoBg:"#94a3b8",color:"#64748b",bg:"rgba(100,116,139,.12)"}},Lu=({source:t,s:a=9.5})=>{const n=Wy[t||"organico"]||Wy.organico,o=Math.round(a*1.5);return e.jsxs("span",{title:`Vino de: ${n.label}`,style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:a,fontWeight:800,color:n.color,background:n.bg,borderRadius:999,padding:"2px 8px 2px 3px"},children:[e.jsx("span",{style:{width:o,height:o,borderRadius:4,background:n.logoBg,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"none"},children:n.logo?e.jsx("img",{src:n.logo,alt:"",width:Math.round(o*.7),height:Math.round(o*.7),style:{objectFit:"contain",display:"block"}}):t==="whatsapp"?e.jsx("span",{style:{color:"#fff",display:"inline-flex"},children:e.jsx(Bo,{s:Math.round(o*.66)})}):e.jsx("span",{style:{width:Math.round(o*.36),height:Math.round(o*.36),borderRadius:999,background:"#fff",display:"inline-block"}})}),n.label]})},Op=12,qy=28;function hm({onStart:t,onOver:a,onEnd:n}){return e.jsx("span",{className:"lk-grip",title:"Arrastra para reordenar",onClick:o=>o.stopPropagation(),onPointerDown:t,onPointerMove:a,onPointerUp:n,onPointerCancel:n,style:{flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 3px",minWidth:34,minHeight:34,color:"var(--text-muted, #9aa0b0)"},children:e.jsxs("svg",{width:"11",height:"16",viewBox:"0 0 10 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2.5",cy:"3",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"3",r:"1.4"}),e.jsx("circle",{cx:"2.5",cy:"8",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"8",r:"1.4"}),e.jsx("circle",{cx:"2.5",cy:"13",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"13",r:"1.4"})]})})}function d8(t,a=850){const[n,o]=h.useState(0),i=h.useRef(0);return h.useEffect(()=>
1025{const s=i.current;let u=0,m=0;const c=g=>{m||(m=g);const f=Math.min(1,(g-m)/a),b=1-Math.pow(1-f,3),v=s+(t-s)*b;i.current=v,o(v),f<1?u=requestAnimationFrame(c):(i.current=t,o(t))};return u=requestAnimationFrame(c),()=>cancelAnimationFrame(u)},[t,a]),n}const c8=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>")`;function My(t,a){return{appearance:"none",WebkitAppearance:"none",MozAppearance:"none",cursor:"pointer",fontFamily:"inherit",fontSize:12.5,fontWeight:700,padding:a?"6px 30px 6px 30px":"6px 30px 6px 14px",borderRadius:999,flex:"none",lineHeight:1.25,maxWidth:240,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",border:`1px solid ${t?"#2563EB":"var(--border)"}`,background:t?"rgba(37,99,235,.08)":"var(--bg-card)",color:t?"#1d4ed8":"var(--text-muted)",backgroundImage:c8,backgroundRepeat:"no-repeat",backgroundPosition:"right 11px center",boxShadow:t?"0 2px 8px -3px rgba(37,99,235,.45)":"0 1px 2px rgba(20,30,60,.04)",transition:"border-color .15s, background .15s, color .15s"}}function Fy({icono:t,children:a}){return e.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",flex:"none"},children:[e.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:11,display:"inline-flex",pointerEvents:"none",color:"inherit",opacity:.75},children:t}),a]})}function Eg(t){const a=Number(t)||0;if(!(a<=0))return a===1?"1 eliminado por ti no cuenta":`${a.toLocaleString("es-CO")} eliminados por ti no cuentan`}function xr({label:t,value:a,num:n,fmt:o,sub:i,notas:s,accent:u,idx:m=0,hero:c,dot:g,trend:f,trendDenom:b,extra:v,columnas:j}){const S=typeof n=="number"&&isFinite(n),$=d8(S?n:0),C=S?o?o($):Math.round($).toLocaleString("es-CO"):a;let _=null,N="",w=!1;if(f&&f.length>=4){const z=Math.floor(f.length/2),G=(Q,de,pe)=>Q.slice(de,pe).reduce((ce,ve)=>ce+ve,0),B=o||(Q=>Math.round(Q).toLocaleString("es-CO"));let U,ne;if(b&&b.length===f.length){const Q=G(b,0,z),de=G(b,z,b.length);U=Q>0?G(f,0,z)/Q:0,ne=de>0?G(f,z,f.length)/de:0}else U=G(f,0,z),ne=G(f,z,f.length);if(!(U===0&&ne===0)){const Q=p8(U,ne);Math.abs(Q)>=1&&(_=Q,N=`Ãltimos ${f.length-z} dÃas: ${B(ne)} · ${z} anteriores: ${B(U)}`),w=U===0&&ne>0}}const M=_==null?null:_>=5?"up":_<=-5?"down":null,p=M==="up"?"rgba(22,163,74,.42)":M==="down"?"rgba(220,38,38,.42)":null,V=M==="up"?"0 1px 2px rgba(22,163,74,.06), 0 10px 24px -12px rgba(22,163,74,.30)":M==="down"?"0 1px 2px rgba(220,38,38,.06), 0 10px 24px -12px rgba(220,38,38,.28)":null,L=(z,G,B,U=138)=>`clamp(${G}px, ${(U/Math.max(1,String(z).length)).toFixed(1)}cqi, ${B}px)`,x=L(a,13,26);return e.jsxs("div",{className:"lk-kpi",style:{animationDelay:`${m*55}ms`,background:c?"linear-gradient(135deg, rgba(22,163,74,.10), rgba(22,163,74,.02))":"var(--card-bg, #fff)",border:`1px solid ${p||(c?"rgba(22,163,74,.30)":"var(--border, #e8eaf0)")}`,boxShadow:V||(c?"0 1px 2px rgba(22,163,74,.05), 0 4px 10px -2px rgba(22,163,74,.08), 0 14px 28px -12px rgba(22,163,74,.20)":"0 1px 2px rgba(20,30,60,.04), 0 4px 10px -2px rgba(20,30,60,.06), 0 12px 26px -14px rgba(20,30,60,.12)"),borderRadius:12,padding:"15px 16px 14px",minWidth:0,position:"relative",overflow:"hidden",containerType:"inline-size"},children:[e.jsxs("div",{style:{fontSize:"clamp(8.8px, 2.1vw, 10.5px)",fontWeight:700,letterSpacing:".055em",color:"var(--text-muted, #6b7280)",textTransform:"uppercase",lineHeight:1.25,minWidth:0},children:[_!=null?e.jsx("span",{style:{float:"right",marginLeft:6},children:e.jsx(g8,{pct:_,hint:N,nueva:w})}):null,g&&e.jsx("span",{className:"lk-dot",style:{width:8,height:8,borderRadius:"50%",background:u||"#16a34a",display:"inline-block",flex:"none",marginRight:6,verticalAlign:"middle"}}),e.jsx("span",{style:{overflowWrap:"break-word"},children:t})]}),j&&j.length?e.jsx("div",{style:{display:"flex",gap:10,alignItems:"flex-start",marginTop:6,clear:"both"},children:j.map((z,G)=>e.jsxs("div",{style:{flex:1,minWidth:0,borderRight:G<j.length-1?"1px solid var(--border, #e8eaf0)":void 0,paddingRight:G<j.length-1?9:0},children:[e.jsx("div",{style:{fontSize:9.5,fontWeight:800,color:z.color,textTransform:"uppercase",letterSpacing:".06em",marginBottom:2},children:z.etiqueta}),e.jsx("div",{style:{fontSize:L(z.valor,11,22,j.length>1?66:150),fontWeight:800,color:"var(--text, #171717)",lineHeight:1.15,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums",overflowWrap:"anywhere"},children:z.valor}),z.pie&&e.jsx("div",{style:{fontSize:L(z.pie,8.2,13,j.length>1?66:170),fontWeight:700,color:z.colorPie||"var(--text-muted, #6b7280)",marginTop:3,lineHeight:1.25,overflowWrap:"anywhere"},children:z.pie})]},z.etiqueta))}):e.jsx("div",{style:{fontSize:x,fontWeight:800,marginTop:6,color:u||"var(--text, #171717)",overflowWrap:"anywhere",lineHeight:1.1,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums"},children:C}),(v||[]).map((z,G)=>e.jsx("div",{style:{fontSize:L(z,11,17),fontWeight:800,marginTop:4,color:u||"var(--text, #171717)",overflowWrap:"anywhere",lineHeight:1.15,letterSpacing:"-.01em",fontVariantNumeric:"tabular-nums"},children:z},G)),i&&e.jsx("div",{style:{fontSize:11.5,fontWeight:500,color:"var(--text-muted, #9ca3af)",marginTop:6,lineHeight:1.35,overflowWrap:"anywhere"},children:i}),(s||[]).map((z,G)=>e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginTop:G===0?6:3,fontSize:L(z.texto,8.8,13,155),fontWeight:700,lineHeight:1.3,color:z.color||(z.tono==="bien"?"#059669":"#DC2626"),minWidth:0,overflowWrap:"anywhere"},children:[e.jsx("span",{"aria-hidden":!0,style:{flex:"none",width:5,height:5,borderRadius:999,background:"currentColor",opacity:.75,transform:"translateY(-1px)"}}),e.jsx("span",{style:{minWidth:0},children:z.texto})]},G))]})}const Nr=t=>
1025"$"+Math.round(Number(t)||0).toLocaleString("es-CO");function Pu(t){return{texto:Pj(t)}}function Oy({s:t,fetch:a,onSaved:n,compacta:o}){const[i,s]=h.useState(!1),[u,m]=h.useState(""),[c,g]=h.useState(!1),[f,b]=h.useState(""),v=Pu(t),j=(()=>{try{const w=typeof(t==null?void 0:t.fields)=="string"?JSON.parse(t.fields):t==null?void 0:t.fields;return w&&typeof w=="object"&&!Array.isArray(w)?w:{}}catch{return{}}})(),S=String(j._vivienda||"").trim().toLowerCase(),$=S==="casa"?"Recibe en casa":S==="apto"?"Recibe en apartamento":S==="oficina"?"Recibe en oficina":"",C=!!(t!=null&&t.dropi_order_id)||["dropi","envios99","mastershop"].includes(String((t==null?void 0:t.origin)||"")),_=async()=>{const w=u.trim().slice(0,200);if(!(!w||c)){g(!0),b("");try{const M=await a(`/api/landing/submissions/${t.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({address:w,campos:{barrio:"",referencia:""}})}),p=await M.json().catch(()=>({}));if(!M.ok||(p==null?void 0:p.ok)===!1){b(String((p==null?void 0:p.message)||(p==null?void 0:p.error)||"No se pudo guardar"));return}const V={...j};"barrio"in V&&(V.barrio=""),"referencia"in V&&(V.referencia=""),n(t.id,{address:w,fields:V,...Number.isInteger(Number(p==null?void 0:p.revision))?{crm_revision:Number(p.revision)}:{}}),s(!1)}catch{b("Sin conexión")}finally{g(!1)}}};if(i)return e.jsxs("div",{onClick:w=>w.stopPropagation(),style:{marginTop:6},children:[e.jsx("textarea",{autoFocus:!0,value:u,onChange:w=>m(w.target.value.slice(0,200)),rows:2,placeholder:"Calle y número, barrio, referencia",onKeyDown:w=>{w.key==="Escape"&&s(!1),w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),_())},style:{width:"100%",boxSizing:"border-box",fontSize:12,lineHeight:1.35,fontFamily:"inherit",border:`1.5px solid ${me}`,borderRadius:8,padding:"6px 8px",resize:"none",background:"var(--card-bg, #fff)",color:"var(--text, #111)"}}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:4,alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:_,disabled:c||!u.trim(),style:{background:me,color:"#fff",border:0,borderRadius:7,padding:"4px 10px",fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:c?"Guardandoâ¦":"Guardar"}),e.jsx("button",{type:"button",onClick:()=>s(!1),style:{background:"transparent",border:"1px solid var(--border, #e8eaf0)",borderRadius:7,padding:"4px 10px",fontSize:11.5,fontWeight:700,cursor:"pointer",fontFamily:"inherit",color:"var(--text-secondary, #64748b)"},children:"Cancelar"}),f&&e.jsx("span",{role:"alert",style:{fontSize:11,color:"var(--danger)",fontWeight:600},children:f})]})]});const N=[v.texto,$].filter(Boolean).join(" · ");return N?e.jsxs("div",{onClick:w=>{w.stopPropagation(),C||(m(v.texto),s(!0))},title:C?`${N} (ya está en la logÃstica: se cambia allá)`:`${N}. Toca para corregir`,style:{marginTop:o?4:6,fontSize:o?11:11.5,lineHeight:1.35,color:"var(--text-secondary, #475569)",fontWeight:600,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",cursor:C?"default":"text"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,verticalAlign:"middle"},children:e.jsx(Hl,{s:10})})," ",N,!C&&e.jsx("span",{"aria-hidden":!0,style:{marginLeft:5,opacity:.55},children:"â"})]}):null}const is=t=>{const a=String(t||""),n=Date.parse(a.includes("T")?a:a.replace(" ","T")+"Z");if(!n||isNaN(n))return{txt:"",hours:0};const o=Math.max(0,(Date.now()-n)/6e4),i=o/60;return{txt:o<60?`hace ${Math.round(o)} min`:i<24?`hace ${Math.round(i)} h`:`hace ${Math.round(i/24)} d`,hours:i}},Hy=t=>{var a;return Array.isArray(t)&&t.length?{qty:Number((a=t[0])==null?void 0:a.quantity)||1,extra:t.length-1}:{qty:0,extra:0}},u8=new Set(["lead_wa","abandonado","repetido","pago_pendiente","entregado","devuelto","rechazado","cancelado"]),Yr=t=>!["cancelado","entregado"].includes(String((t==null?void 0:t.crm_status)||"")),Du=t=>!!(t.dropi_order_id||t.mastershop_order_id||t.envios99_order_id)&&t.dropi_last_movement_at||t.crm_status_changed_at||t.created_at,Gy=t=>u8.has(String(t.crm_status||""))?!1:is(String(Du(t)||"")).hours>168,Wl=t=>{if((t==null?void 0:t.origin)==="dropi"||(t==null?void 0:t.origin)==="envios99"||(t==null?void 0:t.origin)==="mastershop"||["lead_wa","abandonado"].includes(String(t==null?void 0:t.crm_status)))return"";const a=String((t==null?void 0:t.address)||"").trim();return a?a.replace(/\s/g,"").length<8?"Dirección incompleta":/\d/.test(a)?String((t==null?void 0:t.city)||(t==null?void 0:t.department)||"").trim()?"":"Sin ciudad":"Dirección sin número":"Sin dirección"},ql=t=>{const a=String(t||"").toUpperCase();return/ENTREG/.test(a)?"#16a34a":/DEVOL|RECHAZ|NO ENTREG|CANCEL/.test(a)?"#dc2626":/NOVEDAD|PEND|ESPERA/.test(a)?"#b45309":/TRANSPORT|REPARTO|CAMINO|RUTA|DESPACH|GUIA|GUÃA|PREPARA/.test(a)?"#0866FF":"#64748b"},Hp=t=>{const a=String(t||"").trim().toLowerCase();return a?a.charAt(0).toUpperCase()+a.slice(1):""},An=t=>t===""?void 0:Number(t);
1025function ej({fields:t,onChange:a,uploadsEnabled:n,productName:o,onRestore:i,natLen:s=0}){const[u,m]=h.useState(null),[c,g]=h.useState(null),f=[["name",/^\s*nombres?\b/i,/apellido|tienda|usuario|producto|empresa/i],["lastname",/^\s*apellidos?\b/i],["address",/^\s*direcci[oó]n/i,/correo|email/i],["city",/^\s*ciudad|^\s*municipio/i],["department",/^\s*departamento|^\s*provincia/i],["barrio",/^\s*barrio/i]],b=(_,N)=>{var M;let w=N;if(typeof N.label=="string"){const p=String(((M=t[_])==null?void 0:M.key)||"");if(/^campo_\d+_\d+$/.test(p)){const V=N.label.trim();for(const[L,x,z]of f)if(!(!x.test(V)||z&&z.test(V))){if(t.some((G,B)=>B!==_&&String(G.key||"")===L))break;w={...N,key:L};break}}}a(t.map((p,V)=>V===_?{...p,...w}:p))},v=_=>a(t.filter((N,w)=>w!==_)),j=_=>{if(_==="barrio"){if(t.some(L=>L.key==="barrio"))return;const M={key:"barrio",label:"Barrio",type:"text",required:!1,placeholder:"Ej: El Prado"},p=t.findIndex(L=>["address","direccion","dirección"].includes(String(L.key||"").toLowerCase())),V=[...t];V.splice(p>=0?p+1:V.length,0,M),a(V),m("barrio");return}const N="campo_"+(t.length+1)+"_"+Math.floor(performance.now()%1e3),w={text:{key:N,label:"Nuevo campo",type:"text"},tel:{key:N,label:"Teléfono",type:"tel",required:!0,min:10,placeholder:"Ej: 300 123 4567"},number:{key:N,label:"Número",type:"number"},email:{key:N,label:"Correo",type:"email",placeholder:"Ej: [email protected]"},select:{key:N,label:"Talla",type:"select",required:!0,options:["S","M","L"]},textarea:{key:N,label:"Comentarios",type:"textarea"},image:{key:N,label:"",type:"image"},note:{key:N,label:"",type:"note",color:"#0f766e"},banner:{key:N,label:"Completa la dirección para tu entrega",type:"banner"}};a([...t,w[_]||w.text]),m((w[_]||w.text).key)},S=mm((_,N)=>{const w=t.slice(),[M]=w.splice(_,1);w.splice(N,0,M),a(w)}),$=UA(t),C=(()=>{const _=new Set(t.map(w=>String(w.key||""))),N={name:"Nombre",phone:"Celular",address:"Dirección",city:"Ciudad",department:"Departamento"};return Object.keys(N).filter(w=>!_.has(w)).map(w=>N[w])})();return e.jsxs(e.Fragment,{children:[C.length>0&&e.jsxs("div",{style:{background:"#FFFAEB",color:"#B45309",border:"1px solid #B4530944",borderRadius:11,padding:"11px 14px",marginBottom:12,fontSize:12.5,lineHeight:1.55},children:[e.jsxs("b",{children:["Revisa ",C.length===1?"este campo":"estos campos",": ",C.join(" · ")]}),e.jsxs("div",{style:{marginTop:5},children:[C.length===1?"Ese dato no le está llegando":"Esos datos no le están llegando"," completo",C.length===1?"":"s"," a la transportadora, aunque el comprador ",C.length===1?"lo escriba":"los escriba",". Pasa cuando se borra un campo que venÃa de fábrica y se vuelve a crear a mano. Para arreglarlo: bórralo y usa el botón de agregar el campo de fábrica, o escrÃbele exactamente el mismo nombre (",C.join(", "),") y se corrige solo."]})]}),$.resumen&&e.jsxs("div",{style:{...$.deMas?{background:"#FFFAEB",color:"#B45309",border:"1px solid #B4530922"}:{background:"#ECFDF5",color:"#0F766E",border:"1px solid #0F766E22"},borderRadius:11,padding:"11px 14px",marginBottom:12,fontSize:12.5,lineHeight:1.55},children:[e.jsx("div",{children:$.resumen}),$.sugerencias.length>0&&e.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18},children:$.sugerencias.map(_=>e.jsxs("li",{style:{marginBottom:3},children:[e.jsxs("b",{children:[_.nombre,":"]})," ",_.porque]},_.key))})]}),t.map((_,N)=>{var V;const w=u===_.key,M=((V=Ay.find(L=>L.v===_.type))==null?void 0:V.l)||"Texto",p=_.type==="image"?_.image?"Imagen cargada":"Sin imagen aún. Tócalo y súbela":_.type==="note"?_.label||"Sin texto aún. Tócalo y escrÃbelo":_.type==="banner"?_.label||"Banner sin texto. Tócalo y escrÃbelo":_.label||"Campo sin nombre";return e.jsxs("div",{"data-dragidx":N,className:S.dragIdx===N?"lk-dragging":"",style:{border:w?`1.5px solid ${me}`:"1px solid var(--border, #e5e7eb)",borderRadius:10,marginBottom:6,background:"var(--card-bg, #fff)",overflow:"hidden"},children:[e.jsxs("div",{onClick:()=>m(w?null:_.key),style:{display:"flex",alignItems:"center",gap:8,padding:"9px 10px",cursor:"pointer"},children:[e.jsx(hm,{onStart:L=>S.start(N,L),onOver:S.over,onEnd:S.end}),e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",background:"var(--input-bg, #f2f4f9)",borderRadius:6,padding:"3px 7px",whiteSpace:"nowrap",flex:"none"},children:M}),e.jsxs("span",{style:{flex:1,minWidth:0,fontSize:13.5,fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text, #222)"},children:[_.icon?_.icon+" ":"",p,_.required&&e.jsx("span",{style:{color:"var(--danger)"},children:" *"})]}),e.jsx("button",{onClick:L=>{L.stopPropagation(),v(N),m(null)},title:"Quitar",style:{...ee,padding:"3px 8px",fontSize:12,color:"var(--danger)"},children:"â"}
1025),e.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",flex:"none"},children:w?"â²":"â¼"})]}),w&&e.jsx("div",{style:{padding:"6px 10px 12px",borderTop:"1px solid var(--border, #f0f0f4)"},children:_.type==="image"?e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"¿Dónde se muestra?"}),e.jsxs("select",{style:E,value:_.pos||"inline",onChange:L=>b(N,{pos:L.target.value==="inline"?void 0:L.target.value}),children:[e.jsx("option",{value:"top",children:"Arriba de todo el formulario"}),e.jsx("option",{value:"inline",children:"Entre los campos (según este orden)"}),e.jsx("option",{value:"bottom",children:"Al final, después del botón"})]}),e.jsx("div",{style:{marginTop:8},children:e.jsx(Rn,{label:"Imagen o GIF",value:_.image,onChange:L=>b(N,{image:L||void 0}),uploadsEnabled:n,compact:!0})})]}):_.type==="banner"?e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Texto del banner"}),e.jsx("input",{style:E,value:_.label,onChange:L=>b(N,{label:L.target.value}),placeholder:"Ej: Completa la dirección para tu entrega"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fondo"}),e.jsx("input",{type:"color",value:_.bg||me,onChange:L=>b(N,{bg:L.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto"}),e.jsx("input",{type:"color",value:_.color||"#ffffff",onChange:L=>b(N,{color:L.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Posición"}),e.jsxs("select",{style:E,value:_.pos||"inline",onChange:L=>b(N,{pos:L.target.value==="inline"?void 0:L.target.value}),children:[e.jsx("option",{value:"top",children:"Arriba de todo"}),e.jsx("option",{value:"inline",children:"Según este orden"}),e.jsx("option",{value:"bottom",children:"Al final"})]})]})]})]}):_.type==="note"?e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Texto del aviso (admite emojis)"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[e.jsx("textarea",{style:{...E,flex:1,minWidth:0,minHeight:52,resize:"vertical"},value:_.label,onChange:L=>b(N,{label:L.target.value}),placeholder:"Ej: Te confirmamos tu pedido por WhatsApp â"}),e.jsx(So,{field:"Aviso del formulario",instruction:"Aviso corto dentro del formulario que da tranquilidad al pedir contraentrega (confirmación por WhatsApp, sin pagos por adelantado), máximo 90 caracteres",current:_.label||"",productName:o,onPick:L=>b(N,{label:L})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"90px minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color"}),e.jsx("input",{type:"color",value:_.color||"#0f766e",onChange:L=>b(N,{color:L.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"¿Dónde se muestra?"}),e.jsxs("select",{style:E,value:_.pos||"inline",onChange:L=>b(N,{pos:L.target.value==="inline"?void 0:L.target.value}),children:[e.jsx("option",{value:"top",children:"Arriba de todo el formulario"}),e.jsx("option",{value:"inline",children:"Entre los campos (según este orden)"}),e.jsx("option",{value:"bottom",children:"Al final, después del botón"})]})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Nombre del campo (lo ve el cliente)"}),e.jsx("input",{style:E,value:_.label,onChange:L=>b(N,{label:L.target.value}),placeholder:"Ej: Nombre completo"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tipo de dato"}),e.jsx("select",{style:E,value:_.type,onChange:L=>{const x=L.target.value;b(N,x==="select"&&!(_.options&&_.options.length)?{type:x,options:["S","M","L"]}:{type:x})},children:Ay.map(L=>e.jsx("option",{value:L.v,children:L.l},L.v))})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 110px",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto de ejemplo (se borra cuando el cliente escribe)"}),e.jsx("input",{style:E,value:_.placeholder||"",onChange:L=>b(N,{placeholder:L.target.value}),placeholder:"Ej: Juan Camilo Pérez"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Ãcono / emoji"}),e.jsx("button",{style:{...E,textAlign:"center",cursor:"pointer",fontSize:_.icon?17:13},onClick:()=>
1025g(c===_.key?null:_.key),children:_.icon||"Auto"})]})]}),c===_.key&&e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:8,padding:8,border:"1px solid var(--border, #e5e7eb)",borderRadius:10,background:"var(--input-bg, #fafbff)"},children:[e.jsx("button",{onClick:()=>{b(N,{icon:void 0}),g(null)},style:{...ee,padding:"4px 10px",fontSize:12},children:"Auto"}),["ð¤","ðââï¸","ð§","ð±","ð","ð¬","ð¢","ð","ð ","ðï¸","ðºï¸","ðª","âï¸","ð¢","ð","ð§¾","ðµ","ð","ð¦","ð","â","âï¸","ð","ð³"].map(L=>e.jsx("button",{onClick:()=>{b(N,{icon:L}),g(null)},style:{border:"1px solid var(--border, #eee)",background:"var(--card-bg, #fff)",borderRadius:8,fontSize:18,padding:"3px 7px",cursor:"pointer",lineHeight:1.2},children:L},L))]}),_.type==="select"&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Opciones (separadas por coma)"}),e.jsx("input",{style:E,value:(_.options||[]).join(", "),onChange:L=>b(N,{options:L.target.value.split(",").map(x=>x.trim()).filter(Boolean)}),placeholder:"S, M, L, XL"})]}),e.jsxs("div",{style:{display:"flex",gap:18,marginTop:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("label",{style:{fontSize:13,display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!_.required,onChange:L=>b(N,{required:L.target.checked})}),"Obligatorio ",e.jsx("span",{style:{color:"var(--danger)",fontWeight:800},children:"*"})]}),(_.type==="tel"||_.type==="number")&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{fontSize:13,display:"flex",alignItems:"center",gap:6},children:["MÃnimo de dÃgitos",e.jsx("input",{style:{...E,padding:"5px 8px",width:64},type:"number",min:0,value:_.min??"",onChange:L=>b(N,{min:An(L.target.value)}),placeholder:"10"})]}),e.jsxs("label",{style:{fontSize:13,display:"flex",alignItems:"center",gap:6},children:["Máximo ",e.jsx("span",{style:{color:"var(--text-muted)",fontSize:11.5},children:"(opcional)"}),e.jsx("input",{style:{...E,padding:"5px 8px",width:64},type:"number",min:1,max:30,step:1,value:_.max??"",onChange:L=>b(N,{max:An(L.target.value)}),placeholder:"sin tope",title:"Déjalo vacÃo si no quieres tope. Entre 1 y 30."})]}),(()=>{if(_.max===void 0||_.max===null)return null;const L=Number(_.max),x=Number(_.min||0),z=_.type==="tel"&&x>0&&s>0?Math.min(x,s):x,G=!Number.isFinite(L)||L<1?"tiene que estar entre 1 y 30":Number.isInteger(L)?L>30?"no puede pasar de 30":L<z?"no puede ser menor que el mÃnimo":"":"tiene que ser un número entero";return G?e.jsxs("span",{role:"alert",style:{fontSize:12,color:"var(--danger, #dc2626)",flexBasis:"100%"},children:["El máximo ",G,". Asà queda sin tope."]}):null})()]})]})]})})]},N)}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:10,flexWrap:"wrap"},children:[e.jsx("button",{style:{...ee,padding:"7px 13px",fontSize:12.5,borderColor:me,color:me},onClick:()=>{confirm("Esto reemplaza los campos actuales por el set recomendado completo (Nombre, Apellido, WhatsApp, notas, Departamento, Ciudad, Dirección, Datos adicionales y Teléfono opcional). ¿Continuar?")&&(i?i():a(td.map(_=>({..._}))),m(null))},children:"Restaurar campos recomendados"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"El set completo de la referencia, en orden, de un clic."})]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",alignItems:"center",marginTop:10},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-muted)"},children:"Agregar:"}),[["barrio","Barrio"],["text","Campo de texto"],["tel","Teléfono"],["select","Lista de opciones"],["image","Imagen / GIF"],["note","Aviso de texto"],["banner","Banner de sección"]].map(([_,N])=>e.jsxs("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},onClick:()=>j(_),children:["+ ",N]},_))]})]})}function p8(t,a){return t>0?Math.round((a/t-1)*100):a>0?100:0}function g8({pct:t,hint:a,nueva:n}){const o=Math.abs(t)<5,i=t>0&&!o,s=t<0&&!o,u=i?"var(--success)":s?"var(--danger)":"var(--text-muted)",m=i?"var(--notice-success-bg)":s?"var(--notice-danger-bg)":"var(--bg-tertiary)";return e.jsxs("span",{title:a||void 0,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:11,fontWeight:800,color:u,background:m,borderRadius:999,padding:"2px 7px",fontVariantNumeric:"tabular-nums"},children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"9",height:"9",fill:"
1025currentColor","aria-hidden":"true",children:e.jsx("path",{d:t>0?"M12 5l8 11H4z":t<0?"M12 19l-8-11h16z":"M5 11h14v2H5z"})}),n?"nuevo":Math.abs(t)+"%"]})}const Ml={display:"block",width:"100%",textAlign:"left",border:0,background:"transparent",padding:"10px 12px",borderRadius:9,fontSize:13.5,fontWeight:600,color:"var(--text, #111)",cursor:"pointer",textDecoration:"none",boxSizing:"border-box"};function m8({from:t,to:a,pais:n,onEditLandings:o,onCrm:i}){const s=$a(),[u,m]=h.useState(!1),[c,g]=h.useState(""),[f,b]=h.useState(null),v=async()=>{m(!0),g("");try{const C=await(await s("/api/landing/analytics/insights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:t||"",to:a||"",pais:n||""})})).json();if(!C.ok){g(C.message||"No se pudo generar.");return}b(C.insights||[])}catch{g("Error de conexión. Intenta de nuevo.")}finally{m(!1)}},j=$=>($==="landing"||$==="oferta")&&o?{label:"Editar mis landings",go:o}:$==="pedidos"&&i?{label:"Ir a pedidos",go:i}:null,S={display:"block",fontSize:10,fontWeight:800,textTransform:"uppercase",letterSpacing:".05em",color:"var(--text-muted, #9ca3af)",marginBottom:2};return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,background:"linear-gradient(135deg, rgba(8,102,255,.05), rgba(8,102,255,.01))",border:"1px solid rgba(8,102,255,.18)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,flexWrap:"wrap"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"¿Qué hago ahora?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #6b7280)",margin:"2px 0 0"},children:"La IA lee los números de arriba y te da pasos concretos, del más importante al menos."})]}),e.jsx("button",{type:"button",onClick:v,disabled:u,style:{...xa,padding:"9px 16px",opacity:u?.7:1,flex:"none"},children:u?"Analizandoâ¦":f?"Volver a generar":"Generar consejos"})]}),c&&e.jsx("div",{role:"alert",style:{color:"var(--danger)",fontSize:12.5,marginTop:8},children:c}),f&&f.length>0&&e.jsx("div",{style:{display:"grid",gap:10,marginTop:12},children:f.map(($,C)=>{const _=j(String($.area||""));return e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"flex-start",background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"12px 14px",boxShadow:"0 1px 2px rgba(16,24,40,0.04)"},children:[e.jsx("span",{style:{width:22,height:22,borderRadius:"50%",background:"rgba(8,102,255,.1)",color:me,fontSize:11.5,fontWeight:800,display:"flex",alignItems:"center",justifyContent:"center",flex:"none",marginTop:1,fontVariantNumeric:"tabular-nums"},children:C+1}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:6},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:800,color:"var(--text, #171717)"},children:$.titulo}),e.jsx("span",{style:{fontSize:10,fontWeight:800,textTransform:"uppercase",letterSpacing:".04em",color:$.impacto==="alto"?"var(--success)":"var(--notice-warning-text)",background:$.impacto==="alto"?"var(--notice-success-bg)":"var(--notice-warning-bg)",borderRadius:999,padding:"2px 8px",flex:"none"},children:$.impacto==="alto"?"Impacto alto":"Impacto medio"})]}),$.porque&&e.jsxs("div",{style:{marginBottom:7},children:[e.jsx("span",{style:S,children:"Qué está pasando"}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text, #374151)",lineHeight:1.5},children:$.porque})]}),e.jsxs("div",{children:[e.jsx("span",{style:S,children:"Haz esto"}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text, #171717)",lineHeight:1.5},children:$.accion})]}),_&&e.jsx("button",{type:"button",onClick:_.go,style:{...ee,padding:"6px 12px",fontSize:12,marginTop:9},children:_.label})]})]},C)})})]})}function Vy({stats:t,analytics:a,onCrm:n,enRejilla:o}){const i=Number(t==null?void 0:t.orders)||0,s=Number(t==null?void 0:t.delivered)||0,u=Number(t==null?void 0:t.returned)||0,m=s+u,c=ei(s,u),g=Array.isArray(a==null?void 0:a.cities)?a.cities:[],f=N=>String(N||"").toLowerCase().replace(/(^|\s)\S/g,w=>w.toUpperCase()),b=[];m>=8&&c!==null&&c<.5&&b.push({tone:"bad",title:`Tasa de entrega baja: ${Math.round(c*100)}%`,sub:"De tus pedidos ya resueltos (entregados o devueltos), muchos se devuelven. Confirma por WhatsApp antes de despachar y depura las direcciones dudosas."});const v=Xp(g,3);v&&v.tasa<.45&&b.push({tone:"bad",title:`${f(v.fila.city)} se te devuelve mucho`,sub:`Solo ${Math.round(v.tasa*100)}% de entrega en sus ${v.resueltos} pedidos ya resueltos (entregados o devueltos). Considera confirmación extra o ajustar tu pauta en esa zona.`});const j=Number(t==null?void 0:t.prepay_attempts)||0,S=Number(t==null?void 0:t.prepay_failed)||0;j>=3&&S/j>.4&&b.push({tone:"warn",title:`${Math.round(S/j*100)}% de los pagos en lÃnea fallan`,sub:`${S} de ${j} intentos. Quedan contraentrega, pero revisa que tu pasarela esté bien conectada en Pagos.`});const $=Number(t==null?void 0:t.pending)||0;$>0&&b.push({tone:"warn",title:`${$} ${$===1?"pedido":"pedidos"} por confirmar`,sub:"Tócalos antes que se enfrÃen: entre más rápido confirmas, más entregas.",action:n,actionLabel:"Ir al CRM"});const C=Number(t==null?void 0:t.abandoned)||0;if(C>0&&b.push({tone:"warn",title:`${C} ${C===1?"pedido abandonado":"pedidos abandonados"}`,sub:"Llenaron datos y no terminaron. Recupéralos por WhatsApp.",action:n,actionLabel:"Ver en CRM"}),i===0&&g.length===0)return null;const _=N=>N==="bad"?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.3 3.8 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.8a2 2 0 0 0-3.4 0Z"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("path",{d:"M12 17h.01"})]}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 8v4"}),e.jsx("path",{d:"M12 16h.01"})]});return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,marginBottom:16,...o?{margin:0,order:1,gridColumn:"span 2",display:"flex",flexDirection:"column"}:{}},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:b.length?12:0},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:8,background:b.length?"var(--notice-warning-bg)":"var(--notice-success-bg)",color:b.length?"var(--notice-warning-text)":"var(--success)",display:"flex",alignItems:"center",justifyContent:"center",flex:"none"},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),e.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]})}),e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"Alertas"}),!!b.length&&e.jsx("span",{style:{marginLeft:"auto",fontSize:11.5,fontWeight:800,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",borderRadius:999,padding:"2px 9px"},children:b.length})]}),b.length===0?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,color:"var(--success)",fontWeight:600},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--success)"}}),"Todo en orden. No hay nada urgente por ahora."]}):e.jsx("div",{style:{display:"grid",gap:10},children:b.map((N,w)=>e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"flex-start",padding:"11px 12px",borderRadius:12,background:N.tone==="bad"?"var(--notice-danger-bg)":"var(--notice-warning-bg)",border:"1px solid "+(N.tone==="bad"?"var(--notice-danger-border)":"var(--notice-warning-border)")},children:[e.jsx("span",{style:{color:N.tone==="bad"?"var(--danger)":"var(--notice-warning-text)",flex:"none",marginTop:1},children:_(N.tone)}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:N.tone==="bad"?"var(--danger)":"var(--notice-warning-text)"},children:N.title}),N.sub&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:2,lineHeight:1.45},children:N.sub})]}),N.action&&e.jsx("button",{onClick:N.action,style:{...ee,flex:"none",padding:"6px 11px",fontSize:12,alignSelf:"center"},children:N.actionLabel})]},w))})]})}function zg(t){const a=String(t||"").toLowerCase().trim();return!a||a==="directo"||a==="direct"||a==="(direct)"?{key:"directo",name:"Directo"}:/facebook|instagram|meta|^fb$|^ig$/.test(a)?{key:"meta",name:"Meta"}
1025:/tiktok|^tt$/.test(a)?{key:"tiktok",name:"TikTok"}:/whatsapp|^wa$/.test(a)?{key:"whatsapp",name:"WhatsApp"}:{key:"otro",name:t.charAt(0).toUpperCase()+t.slice(1)}}const h8={meta:"#0866FF",tiktok:"#171717",whatsapp:"#25D366"};function f8({kind:t}){const a=e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"#64748b",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3.5 12h17"}),e.jsx("path",{d:"M12 3a14.5 14.5 0 0 1 0 18 14.5 14.5 0 0 1 0-18Z"})]});return e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"var(--input-bg, #f4f6fa)",border:"1px solid var(--border, #e8eaf0)",display:"flex",alignItems:"center",justifyContent:"center",flex:"none"},children:t==="meta"?e.jsx(Jp,{size:20}):t==="tiktok"?e.jsx(Zp,{size:17}):t==="whatsapp"?e.jsx(vj,{size:18}):a})}function x8(t){const a=new Map;for(const n of Array.isArray(t)?t:[]){const o=zg(n.source),i=o.key==="otro"?"otro:"+o.name.toLowerCase():o.key;a.has(i)||a.set(i,{key:i,name:o.name,kind:o.key,opens:0,orders:0,revenue:0,ventas:{},mezcla:!1});const s=a.get(i);if(s.opens+=Number(n.opens)||0,s.orders+=Number(n.orders)||0,s.revenue+=Number(n.revenue)||0,n.ventas&&typeof n.ventas=="object")for(const[u,m]of Object.entries(n.ventas))s.ventas[u]=(s.ventas[u]||0)+(Number(m)||0);else n.currency===null?s.mezcla=!0:n.currency&&(s.ventas[n.currency]=(s.ventas[n.currency]||0)+(Number(n.revenue)||0))}return[...a.values()].sort((n,o)=>o.orders-n.orders||o.opens-n.opens).slice(0,8)}function b8({rows:t,conCodigo:a}){const n=u=>a?u.mezcla?"Varias monedas":Object.entries(u.ventas).filter(([,m])=>m>0).map(([m,c])=>Sn(c,m,!0)).join(" · ")||Nr(0):Nr(u.revenue);if(!t.length)return null;const o=Math.max(1,...t.map(u=>u.orders)),i=t.reduce((u,m)=>u+m.orders,0),s=t.some(u=>u.opens>0&&u.orders>u.opens);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"lk-fuentes",children:t.map(u=>{const m=u.opens>0?Math.round(u.orders/u.opens*100):null,c=m!=null&&u.orders>u.opens,g=m!=null?Math.min(m,100):null,f=i>0?Math.round(u.orders/i*100):0;return e.jsxs("div",{className:"lk-fuente",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx(f8,{kind:u.kind}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,minWidth:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,color:"var(--text, #171717)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),g!=null&&u.orders>0&&e.jsxs("span",{title:c?"Incluye pedidos del carrito de la tienda, que no abren el formulario de la landing":`${u.orders} pedidos de ${u.opens} que abrieron el formulario`,style:{fontSize:10.5,fontWeight:800,color:me,background:"rgba(8,102,255,.1)",borderRadius:999,padding:"1px 7px",flex:"none"},children:[g,"%",c?"*":""," compra"]})]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",marginTop:1,fontVariantNumeric:"tabular-nums"},children:[e.jsx("b",{style:{color:"var(--text, #374151)"},children:u.orders.toLocaleString("es-CO")})," ",u.orders===1?"pedido":"pedidos"," · ",u.opens.toLocaleString("es-CO")," ",u.opens===1?"abrió":"abrieron"," el formulario"]})]}),e.jsx("b",{style:{fontSize:14,color:"var(--success)",fontVariantNumeric:"tabular-nums",flex:"none"},children:n(u)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[e.jsx("div",{style:{flex:1,height:6,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(3,u.orders/o*100)}%`,background:h8[u.kind]||"#94a3b8",borderRadius:999,transition:"width .4s ease"}})}),e.jsxs("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted, #8a90a2)",flex:"none",fontVariantNumeric:"tabular-nums"},children:[f,"% de tus pedidos"]})]})]},u.key)})}),e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted, #b6bdca)",margin:"10px 0 0",lineHeight:1.45},children:["El «% compra» es sobre los que abrieron el formulario en ese canal. Sale de los UTM de tus anuncios; el tráfico sin UTM aparece como Directo.",s?" Un * significa que el canal incluye pedidos del carrito de la tienda, que no pasan por el formulario.":""]})]})}const Uy="utm_source=facebook&utm_medium=paid&utm_campaign={{campaign.name}}&utm_id={{campaign.id}}&utm_term={{adset.id}}&utm_content={{ad.id}}",Qy="utm_source=tiktok&utm_medium=paid&utm_campaign=__CAMPAIGN_NAME__&utm_id=__CAMPAIGN_ID__&utm_term=__AID__&utm_c
1025ontent=__CID__",ku={fontSize:11.5,fontWeight:700,padding:"5px 11px",borderRadius:8,border:"1px solid var(--border, #cbd2e0)",background:"var(--bg-card, #fff)",color:"var(--text-primary, #111)",cursor:"pointer"};function y8(t,a,n,o){const i=$a(),s=t,[u,m]=h.useState(null),[c,g]=h.useState(!1),[f,b]=h.useState(null);return h.useEffect(()=>{if(!s){m(null);return}let v=!0;g(!0);const j=a&&n?`since=${a}&until=${n}`:"todo=1";return i(`/api/landing/pauta-cruce?${j}${o?`&pais=${encodeURIComponent(o)}`:""}`).then(S=>S.json()).then(S=>{v&&(m(S!=null&&S.ok?{meta:S.meta,tiktok:S.tiktok}:null),b(S!=null&&S.ok&&/^[A-Z]{3}$/.test(String(S.moneda_gasto||""))?String(S.moneda_gasto):null))}).catch(()=>{v&&m(null)}).finally(()=>{v&&g(!1)}),()=>{v=!1}},[i,t,s,a,n,o]),{cruce:u,cruzando:c,monedaGasto:f,puedeCruzar:s}}function v8({utm:t,pauta:a,conCodigo:n,moneda:o,cruceDePauta:i}){const s=Array.isArray(a)?a:[],u=s.length>0,m=x8(t),{cruce:c,cruzando:g,monedaGasto:f,puedeCruzar:b}=i,[v,j]=h.useState(null),[S,$]=h.useState(!1),[C,_]=h.useState(""),N=h.useMemo(()=>$2(s,c),[a,c]);if(!u&&!m.length)return null;const w=10,M=S?N:N.slice(0,w),p=N.length<=3,V=F=>v?v.has(F):p,L=F=>j(Re=>{const K=new Set(Re??(p?N.map(I=>I.key):[]));return K.has(F)?K.delete(F):K.add(F),K}),x=F=>j(F?new Set(N.map(Re=>Re.key)):new Set),z=I2(N),G=N.filter(F=>F.plataforma==="meta").length,B=N.filter(F=>F.plataforma==="tiktok").length,U=!!f&&(!!n||!!o&&f!==o),ne=F=>Sn(F,f||void 0,U),Q=F=>F!=null?ne(F):e.jsx("span",{style:{color:"var(--text-muted)"},children:"â"}),de=(F,Re)=>F==null?e.jsx("span",{style:{color:"var(--text-muted)"},children:"â"}):Re>0?e.jsx("b",{style:{color:mv(F/Re)},children:ne(F/Re)}):e.jsx("span",{style:{color:"var(--danger)",fontWeight:800},children:"sin pedidos"}),pe=(F,Re)=>{if(F==null)return e.jsx("span",{style:{color:"var(--text-muted)"},children:"â"});const K=F>Re?"var(--warning)":F<Re?"var(--accent-blue)":"var(--success)";return e.jsx("span",{style:{fontWeight:700,color:K},title:F>Re?`La plataforma reporta ${F-Re} más de las que entraron a Lumy`:F<Re?`Entraron a Lumy ${Re-F} más de las que reporta la plataforma`:"Cuadra con lo que entró a Lumy",children:F.toLocaleString("es-CO")})},ce=(F,Re,K)=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"lk-pauta-num",style:{color:"var(--success)",fontWeight:700},children:Sn(F.revenue,F.moneda,!!n)}),e.jsx("td",{className:"lk-pauta-num",children:Q(Re)}),e.jsx("td",{className:"lk-pauta-num",children:de(Re,F.orders)}),e.jsx("td",{className:"lk-pauta-num",children:pe(K,F.orders)}),e.jsx("td",{className:"lk-pauta-num",children:e.jsx("b",{children:F.orders.toLocaleString("es-CO")})})]}),ve=F=>!!F&&/PAUSED|inactive|DISABLE|ARCHIVED|DELETED/i.test(F),ge=F=>ve(F)?e.jsx("span",{className:"lk-pauta-estado",children:/ARCHIVED|DELETED/i.test(F||"")?"Archivada":"Pausada"}):null,Te=F=>{const Re=F==="meta"?Uy:Qy,K=()=>{_(F),setTimeout(()=>_(""),1800)};try{navigator.clipboard.writeText(Re).then(K,K)}catch{K()}},ie=G>0&&b&&!g&&!!c&&!c.meta.conectado,fe=B>0&&b&&!g&&!!c&&!c.tiktok.conectado,Be=b&&!g&&!!c&&c.meta.conectado&&Yb(N,c,"meta"),We=b&&!g&&!!c&&c.tiktok.conectado&&Yb(N,c,"tiktok"),ze=F=>e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:500},children:F}),tt=(F,Re,K)=>e.jsxs("span",{style:{color:"var(--text-muted)",fontWeight:500},children:[F," ",F===1?Re:K]}),Fe=(F,Re,K,I,H,ye=[])=>e.jsxs("tr",{className:"lk-pauta-hijo",children:[Re.map((De,Ue)=>e.jsx("td",{className:`lk-pauta-nombre lk-pauta-c${Ue+1}`,children:De!=null&&De!==""?e.jsxs("span",{className:"lk-pauta-fila",children:[Ue>0?e.jsx("span",{className:"lk-pauta-guia"}):null,e.jsx("span",{className:"txt",title:ye[Ue],children:De})]}):null},Ue)),ce(K,I,H)]},F);return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"¿De dónde llega tu gente?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 14px"},children:"Qué plataforma te trae compradores de verdad: quiénes abrieron el formulario, pidieron y cuánta plata dejaron. Y abajo, campaña por campaña, qué te está funcionando."}),e.jsx(b8,{rows:m,conCodigo:n}),!u&&m.length>0&&e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",margin:"14px 0 0",lineHeight:1.45},children:"Cuando tus anuncios traigan pedidos con UTM, aquà vas a ver cada campaña, conjunto y anuncio con sus pedidos, gasto y CPA."}),u&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"lk-pauta-cab",style:{marginTop:m.length?18:0,paddingTop:m.length?16:0,borderTop:m.length?"1px solid var(--border, #eef0f5)":"none"},children:[e.jsxs("div",{style:{minWidth:0,flex:"1 1 320px"},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"Tu pauta, campaña por campaña"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 0"},children:"Qué campaña, qué conjunto y qué anuncio te traen pedidos, a cuánto te sale cada pedido (CPA) y cuántas compras dice la plataforma, con la plata de tus tablas de Meta y TikTok en este mismo rango."})]}),e.jsxs("div",{className:"lk-pauta-chips",children:[G>0&&e.jsxs("span",{className:"lk-pauta-chip",children:[e.jsx(Jp,{size:12}
1025)," ",G," ",G===1?"campaña":"campañas"]}),B>0&&e.jsxs("span",{className:"lk-pauta-chip",children:[e.jsx(Zp,{size:12})," ",B," ",B===1?"campaña":"campañas"]}),g&&e.jsx("span",{className:"lk-pauta-chip",style:{color:"var(--text-muted)"},children:"Cruzando con la pautaâ¦"}),N.length>1&&e.jsxs("span",{className:"lk-pauta-chip",style:{padding:0,background:"transparent"},children:[e.jsx("button",{type:"button",onClick:()=>x(!0),style:ku,children:"Abrir todo"}),e.jsx("button",{type:"button",onClick:()=>x(!1),style:ku,children:"Cerrar todo"})]})]})]}),e.jsx("div",{className:"lk-tabla-premium",children:e.jsxs("table",{className:"lk-pauta lk-pauta-arbol",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Campaña"}),e.jsx("th",{children:"Conjunto"}),e.jsx("th",{children:"Anuncio"}),e.jsx("th",{className:"lk-pauta-num",children:"Ventas"}),e.jsx("th",{className:"lk-pauta-num",children:"Gasto"}),e.jsx("th",{className:"lk-pauta-num",children:"CPA"}),e.jsx("th",{className:"lk-pauta-num lk-pauta-th2",title:"Compras según la plataforma: lo que Meta o TikTok dicen que vendió esa fila en este mismo rango, con su propia atribución. Compáralo con los pedidos que de verdad entraron a Lumy.",children:G>0&&B>0?"Meta o TikTok":B>0?"TikTok":"Meta"}),e.jsx("th",{className:"lk-pauta-num",title:"Pedidos que de verdad entraron a Lumy por esa campaña, conjunto o anuncio",children:"Pedidos Lumy"})]})}),e.jsxs("tbody",{children:[M.map(F=>{const Re=F.conjuntos.length+F.sueltos.length>0||!!F.sinConjunto,K=Re&&V(F.key);return e.jsxs(h.Fragment,{children:[e.jsxs("tr",{className:"lk-pauta-camp",children:[e.jsx("td",{className:"lk-pauta-nombre lk-pauta-c1",children:e.jsxs("span",{className:"lk-pauta-fila",children:[e.jsx("button",{type:"button",className:`lk-pauta-chev${K?" on":""}${Re?"":" vacio"}`,onClick:()=>L(F.key),"aria-label":K?"Cerrar campaña":"Abrir campaña","aria-expanded":K,children:"â¶"}),F.plataforma==="tiktok"?e.jsx(Zp,{size:14}):F.plataforma==="meta"?e.jsx(Jp,{size:14}):e.jsx("span",{style:{width:8,height:8,borderRadius:99,background:"#94a3b8",flex:"none"}}),e.jsx("span",{className:"txt",title:F.id?`Campaña ${F.id}`:F.nombre,children:F.nombre}),ge(F.estado)]})}),e.jsx("td",{className:"lk-pauta-nombre lk-pauta-c2",children:F.conjuntos.length?tt(F.conjuntos.length,"conjunto","conjuntos"):ze("â")}),e.jsx("td",{className:"lk-pauta-nombre lk-pauta-c3",children:(()=>{const I=F.conjuntos.reduce((H,ye)=>H+ye.anuncios.length,0)+F.sueltos.length;return I?tt(I,"anuncio","anuncios"):ze("â")})()}),ce(F,F.gasto,F.compras)]}),K&&F.conjuntos.map(I=>e.jsxs(h.Fragment,{children:[Fe(`s-${I.id}`,[null,e.jsxs(e.Fragment,{children:[I.nombre,ge(I.estado)]}),I.anuncios.length?e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:500,fontStyle:"italic"},children:"Todo el conjunto"}):ze("â")],I,I.gasto,I.compras,[void 0,`Conjunto ${I.id}`,"El conjunto completo, con el gasto de todos sus anuncios"]),I.anuncios.map(H=>Fe(`a-${H.id}`,[null,null,e.jsxs(e.Fragment,{children:[H.nombre,ge(H.estado)]})],H,H.gasto,H.compras,[void 0,void 0,`Anuncio ${H.id}`])),I.sinAnuncio&&Fe(`sa-${I.id}`,[null,null,ze("Pedidos sin dato de anuncio")],I.sinAnuncio,null,null)]},I.id)),K&&F.sueltos.map(I=>Fe(`a-${I.id}`,[null,ze("Sin dato de conjunto"),e.jsxs(e.Fragment,{children:[I.nombre,ge(I.estado)]})],I,I.gasto,I.compras,[void 0,void 0,`Anuncio ${I.id}`])),K&&F.sinConjunto&&Fe(`sc-${F.key}`,[null,ze("Pedidos sin dato de conjunto ni anuncio"),null],F.sinConjunto,null,null)]},F.key)}),N.length>1&&e.jsxs("tr",{className:"lk-pauta-total",children:[e.jsxs("td",{className:"lk-pauta-nombre",colSpan:3,children:["Total · ",N.length," campañas",z.gasto!=null&&z.cruzadas<N.length?e.jsxs("span",{style:{fontWeight:500,color:"var(--text-muted)"},children:[" · gasto de ",z.cruzadas," de ",N.length]}):null]}),ce(z,z.gasto,z.compras)]})]})]})}),N.length>w&&e.jsx("button",{type:"button",className:"lk-pauta-mas",onClick:()=>$(F=>!F),children:S?`Ver solo las ${w} primeras`:`Ver las ${N.length} campañas`}),ie?e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",margin:"10px 0 0",lineHeight:1.45},children:"Conecta tu cuenta publicitaria de Meta en Conexiones para ver el gasto, el CPA y las compras reportadas de cada campaña, conjunto y anuncio."}):null,fe&&e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",margin:"10px 0 0",lineHeight:1.45},children:"Conecta tu cuenta de TikTok Ads en Conexiones para ver el gasto y el CPA de tus campañas de TikTok."}),(c==null?void 0:c.meta.error)&&e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--warning)",margin:"10px 0 0"},children:"Meta no respondió en este momento: el gasto y las compras reportadas se mostrarán cuando vuelva."}),(c==null?void 0:c.tiktok.error)&&e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--warning)",margin:"10px 0 0"},children:"TikTok no respondió en este momento: el gasto y las compras reportadas se mostrarán cuando vuelva."}),Be&&e.jsxs("div",{className:"lk-pauta-url",children:[e.jsx("span",{style:{flex:"1 1 260px",color:"var(--text-secondary, #475569)"},children:"Alguna campaña de Meta llegó sin su id o no se pudo leer. Para que Lumy ponga el nombre y el gasto de cada campaña, conjunto y anuncio, pega esto en
1025«Parámetros de URL» de tus anuncios:"}),e.jsx("code",{style:{flex:"1 1 100%"},children:Uy}),e.jsx("button",{type:"button",onClick:()=>Te("meta"),style:ku,children:C==="meta"?"¡Copiado!":"Copiar"})]}),We&&e.jsxs("div",{className:"lk-pauta-url",children:[e.jsx("span",{style:{flex:"1 1 260px",color:"var(--text-secondary, #475569)"},children:"Alguna campaña de TikTok llegó sin su id o no se pudo leer. Para que Lumy ponga el nombre y el gasto de cada campaña, grupo y anuncio, pega esto en la URL de tus anuncios:"}),e.jsx("code",{style:{flex:"1 1 100%"},children:Qy}),e.jsx("button",{type:"button",onClick:()=>Te("tiktok"),style:ku,children:C==="tiktok"?"¡Copiado!":"Copiar"})]}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted, #b6bdca)",margin:"10px 0 0",lineHeight:1.45},children:"Los pedidos y las ventas salen de los UTM de tus anuncios. El gasto y las compras reportadas se le piden a Meta y a TikTok por el id de cada campaña, conjunto y anuncio, en este mismo rango de fechas. Un «â» es una fila que la plataforma no devolvió."})]})]})}function j8(t,a){var M,p,V,L;const n=(t==null?void 0:t.funnel)||{},o=Number(n.visits)||0,i=Number(n.opens)||0,s=Number(n.orders)||0,u=Number(n.confirmed)||0,m=Number(n.delivered)||0,c=Number(n.returned)||0,g=m+c,f=Array.isArray(t==null?void 0:t.utm)?t.utm:[],b=Array.isArray(t==null?void 0:t.cities)?t.cities:[],v=(t==null?void 0:t.offers)||{},j=a||{},S=Number(j.pending)||0,$=Number(j.prepay_attempts)||0,C=Number(j.prepay_failed)||0,_=x=>String(x||"").toLowerCase().replace(/(^|\s)\S/g,z=>z.toUpperCase()),N=[];o>=50&&i>0&&i/o<.35&&N.push({sev:6,area:"landing",title:"Pocos abren el formulario",sub:`Solo ${Math.round(i/o*100)}% de quienes ven tu página abren el formulario (lo sano es 40 a 60%). Sube la oferta y el precio a la primera pantalla, con un botón de compra bien visible.`}),i>=20&&s/i<.25&&N.push({sev:7,area:"landing",title:"Abren el formulario pero no piden",sub:`De ${i} que abrieron, solo ${Math.round(s/i*100)}% dejó pedido (lo normal es 25 a 45%; en checkouts se abandona hasta el 70%). Pide solo lo necesario y muestra el costo de envÃo desde el inicio.`}),o>=200&&s/o<.01&&N.push({sev:9,area:"pauta",title:"Conversión muy baja de visita a pedido",sub:`Solo ${(s/o*100).toFixed(1)}% de las visitas deja pedido (lo normal es 1 a 3%). Revisa que la pauta traiga público correcto y que el producto y la oferta enganchen.`});{const x=f.filter(U=>(Number(U.opens)||0)>=30).map(U=>({name:zg(U.source).name,opens:Number(U.opens)||0,orders:Number(U.orders)||0,delivered:Number(U.delivered)||0,conv:(Number(U.opens)||0)>0?(Number(U.orders)||0)/(Number(U.opens)||1):0})),z=Math.max(0,...x.map(U=>U.conv)),G=x.filter(U=>U.conv<.15&&z>=.3).sort((U,ne)=>U.conv-ne.conv)[0];G&&N.push({sev:6,area:"pauta",title:`${G.name} convierte poco`,sub:`En ${G.name}, de ${G.opens} aperturas solo ${Math.round(G.conv*100)}% deja pedido, muy por debajo de tu mejor canal (${Math.round(z*100)}%). Baja el presupuesto ahà y muévelo a lo que sà convierte.`});const B=Xp(f,8);if(B&&B.tasa<.5){const U=zg(B.fila.source).name;N.push({sev:7,area:"pauta",title:`${U} trae pedidos que no se entregan`,sub:`De ${B.resueltos} pedidos de ${U} ya resueltos (entregados o devueltos), solo ${Math.round(B.tasa*100)}% se entregó. Confirma esos pedidos por WhatsApp antes de despachar y afina el público de esa pauta.`})}}s>=10&&u/s<.6&&N.push({sev:8,area:"pedidos",title:"Pocos pedidos confirmados",sub:`Solo ${Math.round(u/s*100)}% de tus pedidos está confirmado. ConfÃrmalos por WhatsApp rápido: entre más pronto, más entregas.`}),S>=5&&N.push({sev:7,area:"pedidos",title:`${S} pedidos por confirmar`,sub:"Tócalos hoy antes de que se enfrÃen. Cada hora que pasa, baja la probabilidad de que reciban."});const w=ei(m,c);g>=8&&w!=null&&w<.5&&N.push({sev:9,area:"pedidos",title:`Tasa de entrega baja: ${Math.round(w*100)}%`,sub:"De tus pedidos ya resueltos, muchos se devuelven. Confirma por WhatsApp antes de despachar y depura las direcciones dudosas."});{const x=Xp(b,3);x&&x.tasa<.45&&N.push({sev:7,area:"pedidos",title:`${_(x.fila.city)} se te devuelve mucho`,sub:`Solo ${Math.round(x.tasa*100)}% de entrega en sus ${x.resueltos} pedidos ya resueltos (entregados o devueltos). Confirma dos veces la dirección o excluye esa zona de tu pauta.`})}$>=3&&C/$>.4&&N.push({sev:5,area:"pagos",title:`${Math.round(C/$*100)}% de los pagos en lÃnea fallan`,sub:`${C} de ${$} intentos. Quedan contraentrega, pero revisa que tu pasarela esté bien conectada en Pagos.`});{const x=Number((M=v.bump)==null?void 0:M.pct)||0,z=Number((p=v.upsell)==null?void 0:p.pct)||0,G=Number((V=v.upsell)==null?void 0:V.count)||0,B=Number(v.orders)||0,U=(Number((L=v.bump)==null?void 0:L.count)||0)>0;B>=15&&(U&&x<10||G>0&&z<8)&&N.push({sev:3,area:"oferta",title:"Pocos toman el extra",sub:`Tu order bump lo toma ${x}% y tu upsell ${z}% de las compras. Mejora el texto del extra, ajusta su precio o el momento en que aparece.`}),G===0&&B>=15&&N.push({sev:3,area:"oferta",title:"No estás ofreciendo un upsell",sub:`Tienes ${B} compras y ningún upsell activo. Activa un upsell o un pack por cantidad para subir el ticket promedio sin gastar más en pauta.`})}return N.sort((x,z)=>z.sev-x.sev),N}
1025function A8({cooling:t,onCrm:a,conCodigo:n}){const o=$a(),[i,s]=h.useState({cc:"57",nat:10});h.useEffect(()=>{o("/api/me/country").then(c=>c.json()).then(c=>{const g=rn[c==null?void 0:c.country];g&&s({cc:g.phoneCc,nat:g.natLen})}).catch(()=>{})},[o]);const u=Array.isArray(t==null?void 0:t.items)?t.items:[];if(!u.length)return null;const m=Number(t==null?void 0:t.umbral)||48;return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em",margin:"2px 2px 4px"},children:"Llama a estos primero"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:"Pedidos sin confirmar, del más viejo al más reciente. Entre más se enfrÃan, menos entregan."}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsx("div",{children:u.map((c,g)=>{const f=Number(c.hours)||0,b=f>=m?"bad":f>=m*.6?"warn":"n",v=b==="bad"?"var(--danger)":b==="warn"?"var(--warning)":"var(--text-muted, #9ca3af)",j=b==="bad"?"var(--notice-danger-bg)":b==="warn"?"var(--notice-warning-bg)":"var(--input-bg, #f1f3f8)",S=ic(c,i.cc,i.nat);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,padding:g===0?"0 0 11px":"11px 0",borderTop:g===0?"none":"1px solid var(--border, #eef0f5)"},children:[e.jsx("span",{style:{flex:"none",width:30,height:30,borderRadius:9,display:"grid",placeItems:"center",background:j,color:v},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 2"})]})}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:700,letterSpacing:"-.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[c.name||"Sin nombre",c.city?e.jsxs("span",{style:{fontWeight:500,color:"var(--text-muted)"},children:[" · ",c.city]}):null]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:2},children:[to(c.status)," · ",Sn(Number(c.total)||0,c.currency,!!n)]})]}),e.jsxs("div",{style:{flex:"none",textAlign:"right"},children:[e.jsxs("div",{style:{fontSize:14,fontWeight:800,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums",color:v},children:[f," h"]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)"},children:"sin confirmar"})]}),!!S&&e.jsx("a",{href:`https://wa.me/${S}?text=${encodeURIComponent("Hola "+String(c.name||"").split(" ")[0]+", te escribo por tu pedido.")}`,target:"_blank",rel:"noopener noreferrer",title:"Escribir por WhatsApp",style:{flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:9,background:"#25D366",color:"#fff",textDecoration:"none"},children:e.jsx(Bo,{s:15})})]},g)})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",marginTop:13,paddingTop:12,borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsxs("p",{style:{margin:0,flex:1,minWidth:200,fontSize:11.5,color:"var(--text-muted, #9ca3af)",lineHeight:1.5},children:["Los que pasan de ",e.jsxs("b",{style:{color:"var(--text, #171717)"},children:[m," horas"]})," entregan bastante menos. Confirmar rápido es la palanca más barata que tienes."]}),a&&e.jsx("button",{type:"button",onClick:a,style:{...ee,padding:"7px 13px",fontSize:12},children:"Ver todos en el CRM"})]})]})]})}function S8({data:t,stats:a,from:n,to:o,pais:i,moneda:s,landings:u,onEditLandings:m,onCrm:c,onPagos:g,alertas:f,cruceDePauta:b}){var Ye,lt,jt,Je,Ct,st,la,ia,ha,da,Na,wa,La,Gt;const v=!!s,j=he=>Sn(he,t!=null&&t.currency?String(t.currency):s,v),[S,$]=h.useState("table"),[C,_]=h.useState(!0),N=Array.isArray(t==null?void 0:t.cities)?t.cities:[],w=(t==null?void 0:t.funnel)||{},M=Array.isArray(t==null?void 0:t.utm)?t.utm:[],p=Math.max(1,...N.map(he=>Number(he.orders)||0)),V=he=>he>=.7?"var(--success)":he>=.45?"var(--warning)":"var(--danger)",L=he=>he>=.7?"var(--notice-success-bg)":he>=.45?"var(--notice-warning-bg)":"var(--notice-danger-bg)",x=Number(w.visits)||0,z=Number(w.opens)||0,G=Number(w.orders)||0,B=Number(w.confirmed)||0,U=Number(w.delivered)||0,ne=Number(w.returned)||0,Q=U+ne,de=[{label:"Vieron tu página",phrase:"vieron tu página",v:x,phase:"adq"},...z>0?[{label:"Abrieron el formulario",phrase:"abrieron el formulario",v:z,phase:"adq",band:[40,60]}]:[],{label:"Dejaron su pedido",phrase:"dejaron su pedido",v:G,phase:"adq",band:[25,45],nota:Eg(w.eliminados)},{label:"Confirmaste el pedido",phrase:"confirmaron el pedido",v:B,phase:"op",band:[60,100],pending:G>0&&B===0&&Q===0},{label:"Llegó y te pagaron",phrase:"recibieron y te pagaron",v:U,phase:"op",band:[55,70],denom:Q,pending:G>0&&Q<4}],pe=Math.max(1,...de.map(he=>he.v)),ce=he=>{if(he===0)return null;const Me=de[he].denom!=null?de[he].denom:de[he-1].v;return!Me||Me<=0?null:Math.round(de[he].v/Me*100)},ve=he=>{const Me=de[he];if(Me.pending)return"muted";const yt=ce(he);return yt==null||!Me.band?"muted":yt>=Me.band[0]?"ok":yt>=Me.band[0]*.7?"warn":"bad"},ge={ok:"var(--success)",warn:"var(--warning)",bad:"var(--danger)",muted:"var(--text-muted, #9ca3af)"},Te={ok:"var(--notice-success-bg)",warn:"var(--notice-warning-bg)",bad:"var(--notice-danger-bg)",muted:"var(--input-bg, #f1f3f8)"},ie={ok:"#16a34a",warn:"#f59e0b",bad:"#ef4444",muted:"#cbd5e1"};let fe=-1,Be=0;for(let he=1;he<de.length;he++){if(de[he].phase!=="adq")continue;const Me=de[he-1].v,yt=Me>0?1-de[he].v/Me:0;yt>Be&&(Be=yt,fe=he)}const We=fe>0&&de[fe-1].v>=10,ze=fe>0?de[fe].label==="Abrieron el formulario"?"Sube el botón de compra para que se vea sin hacer scroll y deja el precio y la oferta claros en la primera pantalla.":de[fe-1].label==="Abrieron el formulario"?"Pide solo los datos necesarios en el formulario y muestra el costo de envÃo desde el principio, para que nadie se lleve sorpresas al final.":"Deja la oferta, el precio y el botón de compra a la vista de una, y revisa que el formulario sea corto y fácil de llenar.":"",tt=j8(t,a),Fe=tt.slice(0,4),F=tt.length===0&&G>=10,Re=he=>(he==="landing"||he==="oferta")&&m?{label:"Editar mis landings",go:m}:he==="pedidos"&&c?{label:"Ir a pedidos",go:c}:he==="pagos"&&g?{label:"Ir a Pagos",go:g}:null,K=["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],I=["Madrugada","Mañana","Tarde","Noche"],H=["12amâ6am","6amâ12m","12mâ6pm","6pmâ
102512am"],ye=K.map(()=>[0,0,0,0]);for(const he of Array.isArray(t==null?void 0:t.hourly)?t.hourly:[]){const Me=he.hour<6?0:he.hour<12?1:he.hour<18?2:3;he.dow>=0&&he.dow<7&&(ye[he.dow][Me]+=Number(he.orders)||0)}const De=Math.max(1,...ye.flat()),Ue=ye.flat().reduce((he,Me)=>he+Me,0);if(!(w.visits||w.orders||N.length))return null;const se={fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},we=x>0?(()=>{const he=G/x*100,Me=(Math.round(he*10)/10).toLocaleString("es-CO"),yt=200,kt=x>=yt,ct=kt?he>=1?"ok":he>=.5?"warn":"bad":"muted",xt=Math.max(0,Math.min(100,he/4*100)),Ut=Math.max(0,Math.ceil(x/100)-G),Qt=($e,Pe)=>e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,padding:"7px 0",borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)"},children:$e}),e.jsx("b",{style:{fontSize:12.5,fontVariantNumeric:"tabular-nums"},children:Pe})]});return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:1,gridColumn:"span 2",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,textTransform:"uppercase",letterSpacing:".05em",color:"var(--text-muted, #9ca3af)"},children:"Pedidos por cada 100 visitas"}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:7,margin:"7px 0 2px"},children:[e.jsx("b",{style:{fontSize:40,fontWeight:800,letterSpacing:"-.035em",fontVariantNumeric:"tabular-nums",color:ge[ct],lineHeight:1},children:Me}),e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-muted, #9ca3af)"},children:"de 100"})]}),e.jsxs("div",{style:{marginTop:14,position:"relative",height:9,borderRadius:5,background:"var(--input-bg, #f1f3f8)"},children:[e.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:"25%",right:"25%",background:"rgba(22,163,74,.14)",borderLeft:"1px solid rgba(22,163,74,.35)",borderRight:"1px solid rgba(22,163,74,.35)"}}),kt&&e.jsx("div",{style:{position:"absolute",top:-4,left:`calc(${xt}% - 1.5px)`,width:3,height:17,borderRadius:2,background:ie[ct],transition:"left .4s ease"}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:10,color:"var(--text-muted, #9ca3af)",fontVariantNumeric:"tabular-nums"},children:[e.jsx("span",{children:"0"}),e.jsx("span",{children:"normal 1 a 3"}),e.jsx("span",{children:"4"})]}),e.jsxs("div",{style:{marginTop:16},children:[Qt("Visitas en el periodo",x.toLocaleString("es-CO")),Qt("Dejaron su pedido",G.toLocaleString("es-CO")),z>0&&Qt("Abrieron el formulario",z.toLocaleString("es-CO")),kt&&Ut>0&&Qt("Para entrar en lo normal",`+${Ut.toLocaleString("es-CO")} pedidos`)]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"auto 0 0",paddingTop:14,lineHeight:1.5},children:kt?ct==="ok"?"Estás dentro de lo normal en pago contraentrega.":`Estás por debajo de lo normal en pago contraentrega. De cada 100 personas que ven tu página, ${Me} dejan un pedido.`:`Con ${x.toLocaleString("es-CO")} visitas todavÃa es muy pronto para sacar conclusiones: un pedido más o menos mueve mucho este número. Desde unas ${yt} visitas empieza a ser confiable.`})]})})():null;return e.jsxs("div",{style:{marginTop:18,display:"grid",gap:14,gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},children:[e.jsxs("div",{children:[e.jsx(Ei,{children:"Entiende tu tráfico"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 4px",lineHeight:1.45},children:"De arriba a abajo: de dónde llega tu gente, de qué ciudades te compran, dónde se te caen y qué hacer."})]}),e.jsxs("div",{className:"lk-agrid",children:[we||f,e.jsx("div",{style:{order:3,gridColumn:"span 6",minWidth:0,display:"grid",gridTemplateColumns:"minmax(0, 1fr)"},children:e.jsx(v8,{utm:M,pauta:Array.isArray(t==null?void 0:t.pauta)?t.pauta:[],conCodigo:v,moneda:t!=null&&t.currency?String(t.currency):s,cruceDePauta:b})}),(Fe.length>0||F)&&e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:4,gridColumn:"span 6"},children:[e.jsxs("button",{type:"button",onClick:()=>_(he=>!he),style:{display:"flex",alignItems:"center",gap:10,width:"100%",background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:"inherit",textAlign:"left"},children:[e.jsx("span",{style:{flex:"none",color:Fe.length>0?"var(--danger)":"var(--success)",display:"inline-flex"},children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.3 3.8 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.8a2 2 0 0 0-3.4 0Z"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("path",{d:"M12 17h.01"})]})}),e.jsxs("span",{style:{minWidth:0,flex:1},children:[e.jsx("span",{style:{display:"block",fontSize:13.5,fontWeight:800,letterSpacing:"-.01em",color:"var(--text, #171717)"},children:"Puntos débiles"}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted, #9ca3af)",marginTop:1},children:"Lo que más te está costando ahora, de mayor a menor"})]}),Fe.length>0&&e.jsx("span",{style:{flex:"none",fontSize:11,fontWeight:800,color:"var(--danger)",background:"var(--notice-danger-bg)",borderRadius:999,padding:"2px 9px",fontVariantNumeric:"tabular-nums"},children:Fe.length}),e.jsx("span",{style:{flex:"none",color:"var(--text-muted, #9ca3af)",display:"inline-flex",transform:C?"rotate(180deg)":"none",transition:"transform .2s"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),C&&(Fe.length>0?e.jsx("div",{style:{marginTop:12},children:Fe.map((he,Me)=>{const yt=Re(he.area),kt=he.sev>=7;return e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"flex-start",padding:Me===0?"0 0 12px":"12px 0",borderTop:Me===0?"none":"1px solid var(--border, #eef0f5)"},children:[e.jsx("span",{style:{flex:"none",width:21,height:21,borderRadius:7,display:"grid",placeItems:"center",fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",marginTop:1,color:kt?"var(--danger)":"var(--warning)",background:kt?"var(--notice-danger-bg)":"var(--notice-warning-bg)"},children:Me+1}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,letterSpacing:"-.01em",color:"var(--text, #171717)"},children:he.title}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:2,lineHeight:1.5},children:he.sub}),yt&&e.jsx("button",{type:"button",onClick:yt.go,style:{background:"transparent",border:"none",padding:0,marginTop:6,color:me,fontSize:11.5,fontWeight:700,fontFamily:"inherit",curs
1025or:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:yt.label})]})]},Me)})}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,color:"var(--success)",fontWeight:600,marginTop:12,padding:"11px 12px",borderRadius:12,background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--success)",flex:"none"}}),"Tu embudo está sano. No hay fugas grandes por ahora."]}))]}),N.length>0&&e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:5,gridColumn:Array.isArray(t==null?void 0:t.perLanding)&&t.perLanding.length>0?"span 3":"span 6"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsx("div",{style:se,children:"¿De qué ciudades te compran?"}),e.jsx("div",{style:{display:"flex",gap:3,background:"var(--input-bg, #f1f3f8)",borderRadius:8,padding:3,flex:"none"},children:[["bars","Barras"],["table","Tabla"]].map(([he,Me])=>e.jsx("button",{type:"button",onClick:()=>$(he),style:{padding:"4px 11px",fontSize:11.5,fontWeight:700,border:"none",borderRadius:6,cursor:"pointer",fontFamily:"inherit",background:S===he?"var(--card-bg, #fff)":"transparent",color:S===he?"var(--text, #111)":"var(--text-muted, #9ca3af)",boxShadow:S===he?"0 1px 2px rgba(0,0,0,.08)":"none"},children:Me},he))})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 12px"},children:"Pedidos y plata por ciudad. El porcentaje es la tasa de entrega (entregados sobre entregados y devueltos; lo que sigue en camino no cuenta): si sale rojo, ahà se te devuelve más."}),S==="bars"?e.jsx("div",{style:{display:"grid",gap:11},children:N.map((he,Me)=>{const yt=ei(he.delivered,he.returned);return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"var(--text, #171717)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textTransform:"capitalize"},children:String(he.city).toLowerCase()}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.jsx("b",{style:{fontSize:12.5,fontVariantNumeric:"tabular-nums"},children:he.orders}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted, #9ca3af)",fontVariantNumeric:"tabular-nums"},children:Sn(he.revenue,he.currency,v)}),yt!=null&&e.jsxs("span",{style:{fontSize:10.5,fontWeight:800,color:V(yt),background:L(yt),borderRadius:999,padding:"1px 7px"},children:[Math.round(yt*100),"%"]})]})]}),e.jsx("div",{style:{height:7,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(4,he.orders/p*100)}%`,background:me,borderRadius:999,transition:"width .4s ease"}})})]},Me)})}):e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{color:"var(--text-muted, #8a90a2)",fontSize:10.5,textTransform:"uppercase",letterSpacing:".05em"},children:[e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"left"},children:"Ciudad"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},children:"Pedidos"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Qué parte de todos tus pedidos vino de esta ciudad",children:"% del total"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},children:"Ventas"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Plata promedio por pedido",children:"Ticket"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Tasa de entrega: entregados sobre entregados y devueltos. Lo que sigue en camino no cuenta.",children:"Entrega"})]})}),e.jsx("tbody",{children:(()=>{const he=Math.max(1,N.reduce((Me,yt)=>Me+(Number(yt.orders)||0),0));return N.map((Me,yt)=>{const kt=ei(Me.delivered,Me.returned);return e.jsxs("tr",{style:{borderTop:"1px solid var(--border, #eef0f5)",background:yt%2?"var(--bg-soft, #f8f9fc)":"transparent"},children:[e.jsx("td",{style:{padding:"8px 10px",fontWeight:800,color:"var(--text, #171717)",textTransform:"capitalize",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(Me.city).toLowerCase()}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",fontWeight:800},children:Me.orders}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:44,height:5,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden",display:"inline-block"},children:e.jsx("span",{style:{display:"block",height:"100%",width:`${Math.max(4,Math.round(Me.orders/he*100))}%`,background:me,borderRadius:999}})}),e.jsxs("span",{style:{fontSize:11.5,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)",fontWeight:700,minWidth:30,textAlign:"right"},children:[Math.round(Me.orders/he*100),"%"]})]})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--success)",fontWeight:800},children:Sn(Me.revenue,Me.currency,v)}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #475569)",fontWeight:700},children:Me.orders>0?Sn(Me.revenue/Me.orders,Me.currency,v):"â"}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:kt!=null?e.jsxs("span",{style:{fontSize:11,fontWeight:800,color:V(kt),background:L(kt),borderRadius:999,padding:"2px 9px"},children:[Math.round(kt*100),"%"]}):e.jsx("span",{style:{color:"var(--text-muted, #9ca3af)"},children:"â"})})]},yt)})})()})]})})]}),Array.isArray(t==null?void 0:t.perLanding)&&t.perLanding.length>0&&e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:5,gridColumn:N.length>0?"span 3":"span 6"},children:[e.jsx("div",{style:se,children:"¿Qué producto te da la plata?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 12px"},children:"Cada página con sus visitas, pedidos y ventas en este rango. El % compra es pedidos sobre visitas; la entrega en rojo avisa devoluciones."}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5,minWidth:560},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{color:"var(--text-muted, #8a90a2)",fontSize:10.5,textTransform:"uppercase",letterSpacing:".05em"},children:[e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"left"},children:"Producto"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},children:"Visitas"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},children:"Pedidos"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Pedidos sobre visitas",children:"% compra"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},children:"Ventas"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Plata promedio por pedido",children:"Ticket"}),e.jsx("th",{style:{padding:"6px 10px",fontWeight:800,textAlign:"right"},title:"Tasa de entrega: entregados sobre entregados y devueltos. Lo que sigue en camino no cuenta.",children:"Entrega"})]})}),e.jsx("tbody",{children:[...t.perLanding].sort((he,Me)=>Me.submissions-he.submissions||Me.views-he.views).slice(0,10).map((he,Me)=>{var xt;const yt=((xt=(u||[]).find(Ut=>Ut.id===he.id))==null?void 0:xt.name)||`Página ${he.id}`,kt=he.views>0?he.submissions/he.views*100:null,ct=ei(he.delivered,he.returned);return e.jsxs("tr",{style:{borderTop:"1px solid var(--border, #eef0f5)",background:Me%2?"var(--bg-soft, #f8f9fc)":"transparent"},children:[e.jsx("td",{style:{padding:"8px 10px",fontWeight:800,color:"var(--text, #171717)",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:yt}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #475569)",fontWeight:700}
1025,children:Number(he.views||0).toLocaleString("es-CO")}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",fontWeight:800},children:Number(he.submissions||0).toLocaleString("es-CO")}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:kt!=null?e.jsxs("span",{style:{fontSize:11,fontWeight:800,color:me,background:"rgba(8,102,255,.1)",borderRadius:999,padding:"2px 9px",fontVariantNumeric:"tabular-nums"},children:[kt>=10?Math.round(kt):kt.toFixed(1),"%"]}):e.jsx("span",{style:{color:"var(--text-muted, #9ca3af)"},children:"â"})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--success)",fontWeight:800},children:Sn(Number(he.revenue)||0,he.currency,v)}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #475569)",fontWeight:700},children:he.submissions>0?Sn(Math.round((Number(he.revenue)||0)/he.submissions),he.currency,v):"â"}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:ct!=null?e.jsxs("span",{style:{fontSize:11,fontWeight:800,color:V(ct),background:L(ct),borderRadius:999,padding:"2px 9px"},children:[Math.round(ct*100),"%"]}):e.jsx("span",{style:{color:"var(--text-muted, #9ca3af)"},children:"â"})})]},he.id)})})]})})]}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:2,gridColumn:"span 4"},children:[e.jsx("div",{style:se,children:"¿Dónde pierdes gente?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 12px"},children:"El camino completo: de visita a pedido (azul) y luego a que te paguen (verde). El color del paso dice si va bien, regular o mal frente a lo normal."}),e.jsx("div",{style:{display:"grid",gap:11},children:de.map((he,Me)=>{const yt=ce(Me),kt=ve(Me),ct=Me===fe&&We,xt=he.pending?"#cbd5e1":he.phase==="op"?"#16a34a":me;return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:ct?"var(--warning)":"var(--text, #171717)"},children:he.label}),e.jsxs("span",{style:{display:"inline-flex",gap:8,alignItems:"baseline",flex:"none"},children:[e.jsx("b",{style:{fontSize:17,fontWeight:800,fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em",color:he.pending?"var(--text-muted, #9ca3af)":"var(--text, #171717)"},children:he.v.toLocaleString("es-CO")}),he.pending?e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted, #9ca3af)",background:"var(--input-bg, #f1f3f8)",borderRadius:999,padding:"1px 8px"},children:"en progreso"}):Me>0&&yt!=null&&e.jsxs("span",{style:{fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",color:ge[kt],background:Te[kt],borderRadius:999,padding:"1px 8px"},children:[yt,"% sigue"]})]})]}),e.jsx("div",{style:{height:12,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(3,he.v/pe*100)}%`,background:ct?"#f59e0b":xt,borderRadius:999,transition:"width .4s ease"}})}),he.nota&&e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted, #9ca3af)",marginTop:3},children:he.nota})]},Me)})}),We&&e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"flex-start",marginTop:13,padding:"11px 12px",borderRadius:12,background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)"},children:[e.jsx("span",{style:{color:"var(--notice-warning-text)",flex:"none",marginTop:1},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.3 3.8 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.8a2 2 0 0 0-3.4 0Z"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("path",{d:"M12 17h.01"})]})}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:"var(--notice-warning-text)"},children:"Aquà pierdes más gente"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, #6b7280)",lineHeight:1.5,marginTop:2}
1025,children:["De ",de[fe-1].v.toLocaleString("es-CO")," personas que ",de[fe-1].phrase,", solo ",de[fe].v.toLocaleString("es-CO")," ",de[fe].phrase,". ",ze]}),m&&e.jsx("button",{type:"button",onClick:m,style:{...ee,padding:"6px 12px",fontSize:12,marginTop:8},children:"Editar mis landings"})]})]})]}),Ue>0&&(()=>{const he=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],Me=K.map((xt,Ut)=>ye[Ut].reduce((Qt,$e)=>Qt+$e,0)),yt=[0,1,2,3].map(xt=>K.reduce((Ut,Qt,$e)=>Ut+ye[$e][xt],0)),kt=Me.indexOf(Math.max(...Me)),ct=yt.indexOf(Math.max(...yt));return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,margin:0,order:6,gridColumn:"span 6"},children:[e.jsx("div",{style:se,children:"¿Cuándo te compran?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"3px 0 12px"},children:"Pedidos por dÃa y franja (hora Colombia). Programa tu pauta cuando más te compran."}),e.jsxs("div",{style:{background:"linear-gradient(135deg, rgba(8,102,255,.09), rgba(8,102,255,.02))",border:"1px solid rgba(8,102,255,.2)",borderRadius:12,padding:"11px 13px",marginBottom:14,display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{color:me,flex:"none"},children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 2"})]})}),e.jsxs("div",{style:{fontSize:12.5,color:"var(--text, #171717)",lineHeight:1.45},children:["Tu mejor momento es ",e.jsx("b",{children:he[kt]})," en la ",e.jsx("b",{children:I[ct].toLowerCase()})," (",H[ct],"). Sube y refuerza tu pauta ahÃ."]})]}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"38px repeat(4, 1fr)",gap:5,minWidth:280},children:[e.jsx("div",{}),I.map((xt,Ut)=>e.jsxs("div",{style:{fontSize:10,fontWeight:700,color:"var(--text-muted, #9ca3af)",textAlign:"center",paddingBottom:3,lineHeight:1.25,textTransform:"uppercase",letterSpacing:".03em"},children:[xt,e.jsx("div",{style:{fontSize:8.5,fontWeight:600,opacity:.75,textTransform:"none",letterSpacing:0},children:H[Ut]})]},Ut)),K.map((xt,Ut)=>e.jsxs("div",{style:{display:"contents"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"var(--text-muted, #6b7280)",display:"flex",alignItems:"center",justifyContent:"flex-end",paddingRight:6},children:xt}),ye[Ut].map((Qt,$e)=>{const Pe=Qt>0?.12+.88*(Qt/De):0;return e.jsx("div",{title:`${xt} ${I[$e]}: ${Qt}`,style:{height:30,borderRadius:8,background:Qt>0?`rgba(8,102,255,${Pe.toFixed(2)})`:"var(--input-bg, #f1f3f8)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:800,fontVariantNumeric:"tabular-nums",color:Pe>.55?"#fff":"var(--text-muted, #9ca3af)"},children:Qt>0?Qt:""},$e)})]},Ut))]})}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"13px 0 0",paddingTop:12,borderTop:"1px solid var(--border, #eef0f5)",lineHeight:1.5},children:[yt[ct]," de tus ",Ue," pedidos entraron en la ",I[ct].toLowerCase(),".",Ue<10?" Con tan pocos datos todavÃa, tómalo como pista y no como regla.":""]})]})})()]}),(t==null?void 0:t.offers)&&Number((Ye=t.offers.bump)==null?void 0:Ye.count)+Number((lt=t.offers.upsell)==null?void 0:lt.count)+Number((jt=t.offers.downsell)==null?void 0:jt.count)+Number((Je=t.offers.quiz)==null?void 0:Je.total)>0&&e.jsxs("div",{children:[e.jsx("div",{style:{...se,margin:"2px 2px 4px"},children:"Ofertas y dinámicas"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:["Cuántos ",e.jsx("b",{children:"toman"})," cada oferta frente al total y su porcentaje (las ofertas, sobre las ",e.jsx("b",{children:"compras"}),"; el quiz, sobre las ",e.jsx("b",{children:"visitas"}),"). El bump es la casilla extra del formulario, como envÃo express."]}),e.jsx("div",{className:"lk-kpi",style:{...Jt,padding:16,marginBottom:(Ct=t.offers.quiz)!=null&&Ct.options&&t.offers.quiz.options.length?12:0},children:e.jsx("div",{style:{display:"grid",gap:11,gridTemplateColumns:"repeat(auto-fit, minmax(min(200px, 100%), 1fr))"},children:[{label:"EnvÃo express / bump",took:Number(((st=t.offers.bump)==null?void 0:st.count)||0),base:Number(t.offers.orders||0),baseLabel:"compras",pct:Number(((la=t.offers.bump)==null?void 0:la.pct)||0),color:me},{label:"Upsell",took:Number(((ia=t.offers.upsell)==null?void 0:ia.count)||0),base:Number(t.offers.orders||0),baseLabel:"compras",pct:Number(((ha=t.offers.upsell)==null?void 0:ha.pct)||0),color:"#16a34a"},{label:"Downsell",took:Number(((da=t.offers.downsell)==null?void 0:da.count)||0),base:Number(t.offers.orders||0),baseLabel:"compras",pct:Number(((Na=t.offers.downsell)==null?void 0:Na.pct)||0),color:me},{label:"Quiz (respondieron)",took:Number(((wa=t.offers.quiz)==null?void 0:wa.total)||0),base:Number(t.offers.visits||0),baseLabel:"visitas",pct:Number(((La=t.offers.quiz)==null?void 0:La.pct)||0),color:"#8b5cf6"}].map((he,Me)=>e.jsxs("div",{style:{background:"var(--input-bg, #fafbff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"13px 14px"},children:[e.jsx("div",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted, #9ca3af)",letterSpacing:"-.005em"},children:he.label}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:7,margin:"7px 0 2px"},children:[e.jsx("b",{style:{fontSize:24,fontWeight:800,letterSpacing:"-.03em",fontVariantNumeric:"tabular-nums",color:he.took>0?"var(--text, #171717)":"var(--text-muted, #9ca3af)"}
1025,children:he.took.toLocaleString("es-CO")}),e.jsxs("span",{style:{fontSize:11.5,fontWeight:800,fontVariantNumeric:"tabular-nums",color:he.took>0?he.color:"var(--text-muted, #9ca3af)"},children:[he.pct,"%"]})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #9ca3af)",marginBottom:9,fontVariantNumeric:"tabular-nums"},children:["de ",he.base.toLocaleString("es-CO")," ",he.baseLabel]}),e.jsx("div",{style:{height:6,borderRadius:999,background:"var(--card-bg, #fff)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(2,Math.min(100,he.pct))}%`,background:he.color,borderRadius:999,transition:"width .4s ease"}})})]},Me))})}),((Gt=t.offers.quiz)==null?void 0:Gt.options)&&t.offers.quiz.options.length>0&&e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:14},children:[e.jsx("div",{style:{fontSize:12,fontWeight:800,textTransform:"uppercase",letterSpacing:".04em",color:"var(--text-muted, #6b7280)",marginBottom:8},children:"Respuestas del quiz"}),e.jsx("div",{style:{display:"grid",gap:9},children:(()=>{const he=Math.max(1,...t.offers.quiz.options.map(Me=>Number(Me.n)||0));return t.offers.quiz.options.map((Me,yt)=>e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text, #171717)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textTransform:"capitalize"},children:String(Me.tag).toLowerCase()}),e.jsx("b",{style:{fontSize:12.5,fontVariantNumeric:"tabular-nums"},children:Me.n})]}),e.jsx("div",{style:{height:7,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(4,Number(Me.n)/he*100)}%`,background:me,borderRadius:999,transition:"width .4s ease"}})})]},yt))})()}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"10px 0 0",lineHeight:1.45},children:["Toca ",e.jsx("b",{children:'"Generar consejos"'})," abajo para que la IA te diga qué hacer con estas respuestas: a qué público enfocar la pauta y la oferta."]})]})]}),(()=>{var He,ut,at;const he=t==null?void 0:t.money;if(!he)return null;const Me=Number((He=he.cobrada)==null?void 0:He.total)||0,yt=Number((ut=he.camino)==null?void 0:ut.total)||0,kt=Number((at=he.perdida)==null?void 0:at.total)||0,ct=Me+yt+kt,xt=v?Object.entries(he.por_moneda||{}).filter(([dt])=>dt!==he.currency):[],Ut=dt=>xt.filter(([,Ge])=>{var vt;return Number((vt=Ge==null?void 0:Ge[dt])==null?void 0:vt.total)>0}).map(([Ge,vt])=>`${Sn(Number(vt[dt].total),Ge,!0)} (${Number(vt[dt].orders)||0})`),Qt=dt=>{var Ge;return Number((Ge=he[dt])==null?void 0:Ge.orders)||0},$e=xt.some(([,dt])=>["cobrada","camino","perdida"].some(Ge=>{var vt;return Number((vt=dt==null?void 0:dt[Ge])==null?void 0:vt.total)>0}));if(ct<=0&&!$e)return null;const Pe=dt=>Math.round(dt/ct*100),ue=ei(Qt("cobrada"),Qt("perdida")),oe=ue==null?null:Math.round(ue*100),Ae=(dt,Ge,vt,Nt,sa,Pa=[])=>e.jsxs("div",{style:{borderRadius:14,padding:"13px 14px",border:"1px solid "+(sa==="ok"?"rgba(22,163,74,.26)":sa==="bad"?"rgba(220,38,38,.22)":"var(--border, #e8eaf0)"),background:sa==="ok"?"rgba(22,163,74,.07)":sa==="bad"?"rgba(220,38,38,.05)":"var(--input-bg, #fafbff)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:".04em",color:"var(--text-muted, #9ca3af)"},children:dt}),e.jsx("div",{style:{fontSize:21,fontWeight:800,letterSpacing:"-.03em",fontVariantNumeric:"tabular-nums",margin:"8px 0 3px",color:sa==="ok"?"var(--success)":sa==="bad"?"var(--danger)":"var(--text, #171717)"},children:j(Ge)}),Pa.map((Ot,Ia)=>e.jsx("div",{style:{fontSize:15,fontWeight:800,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums",margin:"-1px 0 4px",color:sa==="ok"?"var(--success)":sa==="bad"?"var(--danger)":"var(--text, #171717)"},children:Ot},Ia)),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #9ca3af)",fontVariantNumeric:"tabular-nums"},children:[vt.toLocaleString("es-CO")," ",Nt]})]});return e.jsxs("div",{children:[e.jsx("div",{style:{...se,margin:"2px 2px 4px"},children:"Tu plata ahora mismo"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:"De todo lo vendido en el periodo, dónde está parada tu plata. En contraentrega la venta solo se vuelve tuya cuando entregan."}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsxs("div",{style:{display:"grid",gap:11,gridTemplateColumns:"repeat(auto-fit, minmax(min(210px, 100%), 1fr))"},children:[Ae("Ya cobrada",Me,Qt("cobrada"),"entregados","ok",Ut("cobrada")),Ae("En camino",yt,Qt("camino"),"aún pueden entregar","n",Ut("camino")),Ae("Se devolvió",kt,Qt("perdida"),"devueltos o rechazados al recibir","bad",Ut("perdida"))]}),ct>0&&e.jsxs("div",{style:{display:"flex",height:8,borderRadius:5,overflow:"hidden",marginTop:14,background:"var(--input-bg, #f1f3f8)"},children:[Me>0&&e.jsx("span",{style:{width:`${Pe(Me)}%`,background:"#16a34a"}}
1025),yt>0&&e.jsx("span",{style:{width:`${Pe(yt)}%`,background:me}}),kt>0&&e.jsx("span",{style:{width:`${Pe(kt)}%`,background:"#ef4444"}})]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"12px 0 0",paddingTop:11,borderTop:"1px solid var(--border, #eef0f5)",lineHeight:1.55},children:[ct>0&&e.jsxs(e.Fragment,{children:[$e?`En ${he.currency}, de`:"De"," cada $100 que ves como venta, ",e.jsxs("b",{style:{color:"var(--text, #171717)"},children:[Pe(Me)," ya están en tu bolsillo"]}),", ",Pe(yt)," dependen de que entreguen y ",Pe(kt)," se perdieron."]}),oe!=null&&e.jsxs(e.Fragment,{children:[" Sobre lo ya resuelto, tu tasa de entrega es del ",e.jsxs("b",{style:{color:"var(--text, #171717)"},children:[oe,"%"]}),"."]})]})]})]})})(),(()=>{const he=t==null?void 0:t.pace;if(!he||!Array.isArray(he.today)||!Array.isArray(he.yest))return null;const Me=Math.max(0,Math.min(23,Number(he.hour)||0)),yt=$e=>$e.slice(0,Me+1).reduce((Pe,ue)=>Pe+(Number(ue)||0),0),kt=yt(he.today),ct=yt(he.yest);if(kt===0&&ct===0)return null;const xt=ct>0?Math.round((kt-ct)/ct*100):null,Ut=xt==null?"n":xt>=0?"ok":"bad",Qt=Math.max(1,...he.today.map($e=>Number($e)||0),...he.yest.map($e=>Number($e)||0));return e.jsxs("div",{children:[e.jsx("div",{style:{...se,margin:"2px 2px 4px"},children:"Cómo va el dÃa"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:["Pedidos de hoy contra los de ayer ",e.jsx("b",{children:"a esta misma hora"}),". No depende del rango de fechas de arriba."]}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[e.jsx("b",{style:{fontSize:30,fontWeight:800,letterSpacing:"-.03em",fontVariantNumeric:"tabular-nums"},children:kt.toLocaleString("es-CO")}),xt!=null&&e.jsxs("span",{style:{fontSize:11,fontWeight:800,fontVariantNumeric:"tabular-nums",borderRadius:999,padding:"2px 8px",color:ge[Ut==="ok"?"ok":"bad"],background:Te[Ut==="ok"?"ok":"bad"]},children:[xt>=0?"+":"",xt,"% vs ayer"]}),e.jsxs("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:["ayer a esta hora: ",ct.toLocaleString("es-CO")]})]}),e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:58,marginTop:14},children:he.today.map(($e,Pe)=>{const ue=Number($e)||0,oe=Pe<=Me;return e.jsx("div",{title:`${Pe}:00 · hoy ${ue} · ayer ${Number(he.yest[Pe])||0}`,style:{flex:1,height:`${Math.max(3,ue/Qt*100)}%`,borderRadius:"3px 3px 0 0",background:Pe===Me?"#16a34a":oe?me:"var(--input-bg, #f1f3f8)",opacity:oe?1:.55,transition:"height .4s ease"}},Pe)})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:5,fontSize:10,color:"var(--text-muted, #9ca3af)"},children:[e.jsx("span",{children:"12am"}),e.jsxs("span",{children:["ahora ",Me,":00"]}),e.jsx("span",{children:"11pm"})]})]})]})})(),(()=>{const he=Array.isArray(t==null?void 0:t.margins)?t.margins:[];return he.length?e.jsxs("div",{children:[e.jsx("div",{style:{...se,margin:"2px 2px 4px"},children:"Cuánto deja cada producto"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:"Después de restar el costo del proveedor y los fletes, incluidos los de las devoluciones. Solo pedidos ya resueltos."}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5,minWidth:380},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{color:"var(--text-muted, #9ca3af)",fontSize:10.5,fontWeight:700,textAlign:"left"},children:[e.jsx("th",{style:{padding:"0 8px 8px",fontWeight:700,textTransform:"uppercase",letterSpacing:".04em"},children:"Producto"}),e.jsx("th",{style:{padding:"0 8px 8px",fontWeight:700,textAlign:"right",textTransform:"uppercase",letterSpacing:".04em"},children:"Entrega"}),e.jsx("th",{style:{padding:"0 8px 8px",fontWeight:700,textAlign:"right",textTransform:"uppercase",letterSpacing:".04em"},children:"Ingresó"}),e.jsx("th",{style:{padding:"0 8px 8px",fontWeight:700,textAlign:"right",textTransform:"uppercase",letterSpacing:".04em"},children:"Te quedó"})]})}),e.jsx("tbody",{children:he.map((Me,yt)=>{const kt=ei(Me.delivered,Me.returned??(Number(Me.resolved)||0)-(Number(Me.delivered)||0)),ct=kt==null?0:Math.round(kt*100),xt=ct>=70?"var(--success)":ct>=45?"var(--warning)":"var(--danger)",Ut=ct>=70?"rgba(22,163,74,.1)":ct>=45?"rgba(245,158,11,.12)":"rgba(220,38,38,.1)";return e.jsxs("tr",{style:{borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("td",{style:{padding:"9px 8px",fontWeight:700,letterSpacing:"-.01em",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Me.product}),e.jsx("td",{style:{padding:"9px 8px",textAlign:"right"},children:e.jsxs("span",{style:{fontSize:10.5,fontWeight:800,color:xt,background:Ut,borderRadius:999,padding:"2px 8px",fontVariantNumeric:"tabular-nums"},children:[ct,"%"]})}),e.jsx("td",{style:{padding:"9px 8px",textAlign:"right",fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #475569)"},children:Sn(Me.income,Me.currency,v)}),e.jsx("td",{style:{padding:"9px 8px",textAlign:"right",fontVariantNumeric:"tabular-nums"},children:e.jsx("b",{style:{color:Me.net>=0?"var(--success)":"var(--danger)"},children:Sn(Me.net,Me.currency,v)})})]},yt)})})]})}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"12px 0 0",paddingTop:11,borderTop:"1px solid var(--border, #eef0f5)",lineHeight:1.55},children:"Si un producto sale en rojo, no es que venda poco: es que lo que se devuelve se come la ganancia de lo que sà llega."})]})]}):null})(),e.jsx(A8,{cooling:t==null?void 0:t.cooling,onCrm:c,conCodigo:v}),(()=>{const he=Array.isArray(t==null?void 0:t.rto)?t.rto:[];return he.length?e.jsxs("div",{children:[e.jsx("div",{style:{...se,margin:"2px 2px 4px"},children:"Dónde se te devuelve la plata"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"0 2px 10px",lineHeight:1.45},children:"Ciudad y transportadora, solo sobre pedidos ya resueltos. La devolución no se reparte pareja: se concentra."}),e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16},children:[e.jsx("div",{children:he.map((Me,yt)=>{const kt=Me.resolved>0?Math.round(Me.returned/Me.resolved*100):0,ct=kt>=50?"var(--danger)":kt>=30?"var(--warning)":"var(--success)";return e.jsxs("div",{style:{padding:yt===0?"0 0 11px":"11px 0",borderTop:yt===0?"none":"1px solid var(--border, #eef0f5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,marginBottom:5},children:[e.jsxs("span",{style:{minWidth:0,fontSize:13,fontWeight:700,letterSpacing:"-.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textTransform:"capitalize"},children:[String(Me.city).toLowerCase(),Me.carrier?e.jsxs("span",{style:{fontWeight:500,color:"var(--text-muted)",textTransform:"none"},children:[" · ",Me.carrier]}):null]}),e.jsxs("span",{style:{flex:"none",display:"inline-flex",alignItems:"baseline",gap:8,fontVariantNumeric:"tabular-nums"},children:[e.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)"},children:[Me.resolved," resueltos"]}),e.jsxs("b",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.02em",color:ct},children:[kt,"%"]})]})]}),e.jsx("div",{style:{height:7,borderRadius:999,background:"var(--input-bg, #f1f3f8)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.max(3,kt)}%`,background:ct,borderRadius:999,transition:"width .4s ease"}})})]},yt)})}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"12px 0 0",paddingTop:11,borderTop:"1px solid var(--border, #eef0f5)",lineHeight:1.55},children:["Donde la devolución pasa del ",e.jsx("b",{style:{color:"var(--text, #171717)"},children:"50%"})," conviene cobrar el envÃo por adelantado, o probar otra transportadora antes de seguir pautando a esa ciudad."]})]})]}):null})(),e.jsx(m8,{from:n,to:o,pais:i,onEditLandings:m,onCrm:c})]})}function u_({initialView:t,initialPanel:a,shopifyEmbedded:n=!1}
1025={}){var ao,Vn,ar;const o=$a(),i=((ao=ni().user)==null?void 0:ao.role)==="admin",s=sv(i).rutaApagada("/paginas"),[u,m]=h.useState([]),[c,g]=h.useState(()=>{try{return localStorage.getItem("lumy_landings_view")==="lista"?"lista":"grid"}catch{return"grid"}}),f=q=>{g(q);try{localStorage.setItem("lumy_landings_view",q)}catch{}},[b,v]=h.useState(null),[j,S]=h.useState(""),[$,C]=h.useState("all"),[_,N]=h.useState(""),[w,M]=h.useState(!0),[p,V]=h.useState(null),[L,x]=h.useState(t||"list"),[z,G]=h.useState(a||"resumen"),[B,U]=h.useState(!1),[ne,Q]=fv(),[de,pe]=_k(),[ce,ve]=h.useState([]),ge=de&&ce.some(q=>Number(q.id)===de)?de:0,Te=h.useMemo(()=>lv(ce),[ce]);h.useEffect(()=>{t?x(t):(x("list"),G(a||"resumen"))},[t,a]);const[ie,fe]=h.useState(null),Be=q=>{fe(null),x("crm")},[We,ze]=h.useState(null),[tt,Fe]=h.useState(null),[F,Re]=h.useState(null);h.useEffect(()=>{let q=!0;const te=()=>o("/api/landing/live"+(()=>{const bt=[ne?`pais=${encodeURIComponent(ne)}`:"",ge?`landing=${ge}`:""].filter(Boolean).join("&");return bt?`?${bt}`:""})()).then(bt=>bt.json()).then(bt=>{q&&bt.ok&&Re({total:bt.total,byLanding:bt.byLanding||{}})}).catch(()=>{});te();const ke=setInterval(te,15e3);return()=>{q=!1,clearInterval(ke)}},[o,ne,ge]);const[K,I]=h.useState(null),[H,ye]=h.useState(null),[De,Ue]=h.useState([]),[se,we]=h.useState("COP"),[Ye,lt]=h.useState(!1),jt=async(q,te)=>{var oa;const ke=new Set(q.map(Number)),bt=new Map;ye(wt=>(wt||[]).map(pt=>ke.has(Number(pt.landingId))?(bt.set(Number(pt.landingId),!!pt.storeHidden),{...pt,storeHidden:te}):pt));try{const wt=await o("/api/landing/store"),pt=await wt.json();if(!wt.ok||!pt||!pt.ok)throw new Error((pt==null?void 0:pt.message)||"store_load_failed");const Zt=kk(pt.store,[...ke],!te),At=await o("/api/landing/store",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...Zt,expected_revision:Number((oa=pt.store)==null?void 0:oa.revision)||0})}),Et=await At.json().catch(()=>null);if(!At.ok||!(Et!=null&&Et.ok))throw new Error((Et==null?void 0:Et.message)||"store_save_failed")}catch(wt){throw ye(pt=>(pt||[]).map(Zt=>{const At=Number(Zt.landingId);return ke.has(At)&&!!Zt.storeHidden===te&&bt.has(At)?{...Zt,storeHidden:bt.get(At)}:Zt})),wt}},Je=h.useRef({}),Ct=h.useRef({}),st=h.useRef({}),la=(q,te)=>(ye(ke=>(ke||[]).map(bt=>bt.landingId===q?{...bt,...te.stock_own!==void 0?{stockOwn:te.stock_own}:{},...te.stock_min!==void 0?{stockMin:te.stock_min}:{}}:bt)),Je.current[q]={...Je.current[q]||{},...te},clearTimeout(Ct.current[q]),new Promise((ke,bt)=>{(st.current[q]=st.current[q]||[]).push({ok:ke,fail:bt}),Ct.current[q]=setTimeout(()=>{const oa={landingId:q,...Je.current[q]};delete Je.current[q];const wt=st.current[q]||[];delete st.current[q],o("/api/landing/product-stock",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oa)}).then(pt=>{if(!pt.ok)throw new Error("save_failed");wt.forEach(Zt=>Zt.ok())}).catch(pt=>wt.forEach(Zt=>Zt.fail(pt)))},700)})),[ia,ha]=h.useState("today"),[da,Na]=h.useState(""),[wa,La]=h.useState(""),Gt=()=>{if(ia==="today"){const q=On();return{from:q,to:q}}if(ia==="yesterday"){const q=Yo(On(),1);return{from:q,to:q}}return ia==="7d"?{from:Yo(On(),6),to:On()}:ia==="custom"&&da&&wa?{from:da,to:wa}:{}},[he,Me]=h.useState([]),yt=he.length>1&&he.includes(ne)?ne:"",kt=Object.entries((K==null?void 0:K.revenue_by_currency)||{}).filter(([q,te])=>q!==(K==null?void 0:K.primary_currency)&&Number(te)>0),ct=new Set(he.map(q=>{var te;return(te=rn[q])==null?void 0:te.currency}).filter(Boolean)).size>1||kt.length>0,xt=ct?String((K==null?void 0:K.primary_currency)||"COP"):void 0,Ut=q=>Sn(q,K!=null&&K.primary_currency?String(K.primary_currency):void 0,ct),Qt=Number((K==null?void 0:K.orders_moneda)??(K==null?void 0:K.orders))||0,$e=q=>ct?Object.entries(q||{}).filter(([te,ke])=>te!==(K==null?void 0:K.primary_currency)&&Number(ke)>0):[],Pe=(q,te)=>{const ke=$e(q).map(([bt,oa])=>Sn(Number(oa),bt,!0));return[...Number(te)>0||!ke.length?[Ut(te)]:[],...ke].join(" · ")},ue=$e(K==null?void 0:K.revenue_by_currency).map(([q,te])=>Sn(Number(te),q,!0)),oe=[...Qt>0?[Ut(Number(K==null?void 0:K.revenue)/Qt)]:[],...$e(K==null?void 0:K.revenue_by_currency).filter(([q])=>{var te;return Number((te=K==null?void 0:K.orders_by_currency)==null?void 0:te[q])>0}).map(([q,te])=>Sn(Number(te)/Number(K.orders_by_currency[q]),q,!0))],Ae=Number(K==null?void 0:K.delivered_revenue)>0||$e(K==null?void 0:K.delivered_by_currency).length>0,He=Number(K==null?void 0:K.revenue)||0,ut=Number(K==null?void 0:K.delivered_revenue)||0,at=Math.max(0,He-ut),dt=Number((K==null?void 0:K.delivered)||0)+Number((K==null?void 0:K.returned)||0),Ge=ei(K==null?void 0:K.delivered,K==null?void 0:K.returned),vt=dt>0?Number((K==null?void 0:K.returned)||0)/dt*100:null,Nt=Number(K==null?void 0:K.returned_revenue)||0,sa=Number((K==null?void 0:K.returned)||0),Pa=dt===0?[]:sa===0?[{texto:"Nada se te ha devuelto",tono:"bien"}
1025]:[{texto:Math.round(vt||0)+"% se devolvió · "+sa.toLocaleString("es-CO")+(sa===1?" pedido":" pedidos"),tono:"falta"},{texto:(Nt>0?Pe(K==null?void 0:K.returned_by_currency,Nt):Ut(0))+" perdidos",tono:"falta"}],Ot=Ae?[{texto:Pe(K==null?void 0:K.delivered_by_currency,ut)+" recaudado",tono:"bien"},...at>0?[{texto:Ut(at)+" por cobrar",tono:"falta"}]:[]]:[],Ia=()=>{const{from:q,to:te}=Gt(),ke=new URLSearchParams;q&&te&&(ke.set("from",q),ke.set("to",te)),ne&&ke.set("pais",ne),ge&&ke.set("landing",String(ge));const bt=ke.toString();return bt?`?${bt}`:""};h.useEffect(()=>{if(L!=="list")return;let q=!0;return o("/api/landing/stats"+Ia()).then(te=>te.json()).then(te=>{!q||!te.ok||(I(te),Array.isArray(te.paises)&&Me(te.paises.filter(ke=>typeof ke=="string")))}).catch(()=>{}),()=>{q=!1}},[o,L,ia,da,wa,ne,ge]);const[za,sn]=h.useState(null);h.useEffect(()=>{if(L!=="list"||z!=="resumen")return;let q=!0;return o("/api/landing/analytics"+Ia()).then(te=>te.json()).then(te=>{q&&te.ok&&sn(te)}).catch(()=>{}),()=>{q=!1}},[o,L,z,ia,da,wa,ne,ge]);const ba=Gt(),Ga=Array.isArray(za==null?void 0:za.pauta)?za.pauta:[],Ie=y8(Ga.length>0,ba.from,ba.to,ne),ka=h.useMemo(()=>$2(Ga,Ie.cruce),[za,Ie.cruce]),Zo=h.useMemo(()=>I2(ka),[ka]),Cn=Kb(ka,"meta"),Xo=Kb(ka,"tiktok"),Nn=Ie.monedaGasto,er=!!Nn&&(ct||Nn!==String((K==null?void 0:K.primary_currency)||"COP")),Oa=q=>Sn(q,Nn||void 0,er),Xa=q=>(Nn||"COP")==="COP"?mv(q):"var(--text-muted, #6b7280)",Kn=(q,te,ke)=>{if(!ke.hay)return null;const bt=ke.gasto!=null&&ke.orders>0?ke.gasto/ke.orders:null;return{etiqueta:q,color:te,valor:ke.gasto!=null?Oa(ke.gasto):"â",pie:bt!=null?"CPA "+Oa(bt):ke.gasto!=null?"sin pedidos":"sin dato",colorPie:bt!=null?Xa(bt):void 0}},qa=[Kn("Meta","#0866FF",Cn),Kn("TikTok","#FE2C55",Xo)].filter(Boolean);h.useEffect(()=>{L==="list"&&o("/api/landing/stock-alerts").then(q=>q.json()).then(q=>{q.ok&&Ue(q.alerts||[])}).catch(()=>{})},[o,L]),h.useEffect(()=>{if(L!=="list"||z!=="inventario")return;let q=!0;return o("/api/landing/inventory").then(te=>te.json()).then(te=>{!q||!te.ok||(ye(te.items),te.currency&&we(te.currency),lt(!!te.storeEnabled),!(!te.dropiConnected||!Number(te.dropiPending))&&o("/api/landing/inventory/dropi").then(ke=>ke.json()).then(ke=>{!q||!ke.ok||!ke.stock||ye(bt=>(bt||[]).map(oa=>{const wt=ke.porLanding?ke.porLanding[String(oa.landingId)]:oa.dropiPid?ke.stock[String(oa.dropiPid)]:null;return wt?{...oa,dropiStock:typeof wt.stock=="number"?wt.stock:oa.dropiStock,dropiActive:typeof wt.active=="boolean"?wt.active:oa.dropiActive,dropiName:wt.name||oa.dropiName}:oa}))}).catch(()=>{}))}).catch(()=>{}),()=>{q=!1}},[o,L,z]);const _n=h.useCallback(()=>{M(!0),o("/api/landing/pages").then(q=>q.json()).then(q=>{q.ok&&(m((q.pages||[]).filter(te=>(te==null?void 0:te.page_type)!=="catalogo")),N(String(q.brand_domain||"")))}).finally(()=>M(!1))},[o]);h.useEffect(()=>{const q=te=>{const ke=te==null?void 0:te.detail;if((ke==null?void 0:ke.tipo)==="crm-alerta"&&ke.alerta){!ke.consumido&&L!=="crm"&&Be(String(ke.alerta));return}if((ke==null?void 0:ke.tipo)==="crm-vista"){L!=="crm"&&Be();return}if((ke==null?void 0:ke.tipo)!=="editor-landing")return;const bt=Number(ke.landingId)||(L==="edit"&&p?p:0)||(u.length===1?Number(u[0].id):0);bt&&(p!==bt||L!=="edit")&&(V(bt),x("edit"))};return window.addEventListener("lumy:guia-ir",q),()=>window.removeEventListener("lumy:guia-ir",q)},[u,p,L]),h.useEffect(()=>{_n()},[_n]),h.useEffect(()=>{if(L!=="list"||z!=="resumen")return;let q=!0;return o("/api/landing/pages?con_archivadas=1").then(te=>te.json()).then(te=>{q&&te.ok&&ve((te.pages||[]).filter(ke=>(ke==null?void 0:ke.page_type)!=="catalogo"))}).catch(()=>{}),()=>{q=!1}},[o,L,z]);const Va=async q=>{const te=Number(q.submissions)||0,ke=`¿Eliminar "${q.name}"? 1026 1027La página sale de tu lista y deja de mostrarse.${te>0?` 1028 1029Tus ${te} pedido(s) se CONSERVAN en el CRM.`:""}`;if(confirm(ke))try{(await(await o(`/api/landing/pages/${q.id}`,{method:"DELETE"})).json().catch(()=>({}))).ok?(m(wt=>wt.filter(pt=>pt.id!==q.id)),_n()):alert("No se pudo eliminar. Intenta de nuevo.")}catch{alert("Error de conexión al eliminar.")}},mn=async q=>{try{const ke=await(await o(`/api/landing/pages/${q.id}/duplicate`,{method:"POST"})).json().catch(()=>({}));ke.ok&&ke.page?(_n(),V(ke.page.id),x("edit")):alert("No se pudo duplicar. Intenta de nuevo.")}catch{alert("Error de conexión al duplicar.")}},[po,hn]=h.useState(!1),Co=h.useCallback(()=>hn(!1),[]),go=async q=>{const te=!q.plantilla_at,ke=te?`¿Compartir "${Gl(q)}" como plantilla? 1030 1031Todos los vendedores de Lumy la verán en «Plantillas», en el paÃs de esta landing, y podrán importarla a sus landings. Lo que cambies después aquà es lo que importarán los siguientes. 1032 1033No viajan tus pÃxeles, tu WhatsApp, tus productos de Dropi, 99envÃos o Mastershop, tus pagos ni el nombre de tu tienda. Revisa que los textos no lleven tus datos personales.`:`¿Dejar de compartir "${Gl(q)}"? 1034 1035Sale de «Plantillas». Las copias que otros ya importaron siguen siendo de ellos.`;if(confirm(ke))try{const bt=await o(`/api/landing/pages/${q.id}/plantilla`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({compartir:te})}),oa=await bt.json().catch(()=>({}));if(!bt.ok||!oa.ok){alert(oa.message||"No se pudo. Intenta de nuevo.");return}m(wt=>wt.map(pt=>
1035pt.id===q.id?{...pt,plantilla_at:te?new Date().toISOString():null}:pt)),alert(te?`Listo: ya está en Plantillas, en ${br(oa.pais).name}.`:"Listo: ya no está en Plantillas.")}catch{alert("Error de conexión. Intenta de nuevo.")}},fn=h.useMemo(()=>{const q=j.trim().toLowerCase();return u.filter(te=>$==="published"&&te.status!=="published"||$==="draft"&&te.status==="published"?!1:q?[te.product_name||"",te.name||"",te.slug||"",te.custom_domain||""].join(" ").toLowerCase().includes(q):!0)},[u,j,$]),[Da,Hn]=h.useState(!1),[Ra,ln]=h.useState(()=>new Set),[mo,X]=h.useState(!1),[ae,ot]=h.useState(""),it=h.useMemo(()=>fn.filter(q=>Ra.has(Number(q.id))),[fn,Ra]),ma=h.useCallback(()=>{Hn(!1),ln(new Set),ot("")},[]),ta=q=>ln(te=>{const ke=new Set(te);return ke.has(q)?ke.delete(q):ke.add(q),ke});h.useEffect(()=>{if(!Da)return;const q=te=>{te.key==="Escape"&&ma()};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[Da,ma]),h.useEffect(()=>{ma()},[z,L,ma]),h.useEffect(()=>{!w&&u.length===0&&!ae&&ma()},[w,u.length,ae,ma]),h.useEffect(()=>{if(!ae)return;const q=setTimeout(()=>ot(""),3500);return()=>clearTimeout(q)},[ae]);const pn=async()=>{const q=it;if(!q.length||mo)return;const te=q.length,ke=q.reduce((Zt,At)=>Zt+(Number(At.submissions)||0),0),bt=`¿Eliminar ${te===1?"1 landing":`${te} landings`}? 1036 1037`+(te===1?`"${Gl(q[0])}" sale de tu lista y deja de mostrarse.`:"Salen de tu lista y dejan de mostrarse.")+` 1038 1039Tus pedidos se CONSERVAN en el CRM${ke>0?` (${ke} ${ke===1?"entró":"entraron"} por ${te===1?"ella":"ellas"})`:""}.`;if(!confirm(bt))return;X(!0);const oa=q.map(Zt=>Number(Zt.id));let wt=0,pt="";try{for(let Zt=0;Zt<oa.length&&!pt;Zt+=500){const At=await o("/api/landing/pages/archivar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:oa.slice(Zt,Zt+500)})}),Et=await At.json().catch(()=>({}));At.ok&&Et.ok?wt+=Number(Et.archivadas)||0:pt=String(Et.message||"No se pudieron eliminar. Intenta de nuevo.")}}catch{pt="Error de conexión al eliminar."}try{if(pt){alert(pt);return}const Zt=new Set(oa);m(At=>At.filter(Et=>!Zt.has(Number(Et.id)))),ln(new Set),ot(wt===1?"Se eliminó 1 landing.":`Se eliminaron ${wt} landings.`)}finally{X(!1),_n()}},[Gn,Ln]=h.useState(!1),[ho,tr]=h.useState(""),[fo,Dr]=h.useState(""),[Ba,_o]=h.useState("product"),[Yn,yr]=h.useState(!1),[$o,ja]=h.useState(!1),dn=async()=>{const q=ho.trim();if(!q){yr(!0);return}if($o)return;ja(!0);const te=Ba==="codigo",ke={...te?{modo_codigo:!0}:{},page_type:te?"simple":Ba,sticky_smart:!0,theme:{font:"poppins"},trust_mode:"real_only",reviews_off:!0,copy_length:Ba==="advertorial"?"explicativa":"equilibrada",...Ba==="product"?{content_text_align:"center"}:{}};(Ba==="product"||Ba==="simple")&&(ke.order_bump={label:"EnvÃo Express",text:"Tu pedido será despachado primero que los demás",price:4e3,preselected:!1,animated:!0}),Ba==="whatsapp"&&(ke.whatsapp={enabled:!0}),Ba==="advertorial"&&(ke.prelanding=Q2.nota);try{const oa=await(await o("/api/landing/pages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:q,config:ke})})).json();if(oa.ok){const wt=fo.trim();if(wt&&/^https?:\/\//i.test(wt)&&(Ba==="product"||Ba==="simple"))try{sessionStorage.setItem("lumy_pending_import_"+oa.page.id,wt)}catch{}if(te)try{sessionStorage.setItem("lumy_abrir_lienzo_"+oa.page.id,"1")}catch{}Ln(!1),tr(""),Dr(""),yr(!1),V(oa.page.id),x("edit")}}finally{ja(!1)}};return L==="edit"&&p!=null?e.jsx(R8,{id:p,onBack:()=>{x("list"),_n()}}):L==="crm"?e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)"},children:[e.jsx(Kp,{platform:n?"shopify":"landing",title:n?"Pedidos de Shopify":"CRM Pedidos",subtitle:n?"Tus pedidos entran automáticamente y puedes gestionarlos desde este CRM.":"Gestiona, confirma y haz seguimiento a los pedidos de tus landings."}),e.jsx(V8,{landingId:ie,shopifyOnly:n,onBack:()=>{fe(null),x("list")},onNavLandings:()=>{fe(null),x("list"),G("landings")},onNavPagos:()=>{fe(null),x("list"),G("pagos")}})]}):L==="stats"&&We?e.jsx(H8,{landing:We,onBack:()=>{ze(null),x("list")}}):L==="pixels"?e.jsx(O8,{onBack:()=>x("list")}):e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)"},children:[e.jsx(gm,{}),po&&e.jsx(bk,{onCerrar:Co,onImportada:q=>{hn(!1),_n(),V(q.id),x("edit")}}),!(z==="tienda"&&B)&&e.jsx(Kp,{platform:"landing",title:z==="pagos"?"Integraciones":void 0,subtitle:z==="pagos"?"Cobra con Bold, Mercado Pago o PayPal, y saca tus pedidos":void 0,rightSlot:e.jsxs(e.Fragment,{children:[e.jsx("button",{style:yk,onClick:()=>Ln(!0),children:"+ Nueva landing"}),e.jsx("button",{style:qb,title:"Landings listas para importar a las tuyas",onClick:()=>hn(!0),children:"Plantillas"}),e.jsx("button",{style:qb,title:"Pegar un código que te compartieron para recibir esa landing",onClick:async()=>{var te;const q=window.prompt("Pega el código que te compartieron (por ejemplo 8FEDS-3ERM2):");if(!(!q||!q.trim()))try{const bt=await(await o(`/api/landing/compartida/${encodeURIComponent(q.trim())}`)).json();if(!bt.ok){alert(bt.message||"Ese código no sirve o ya caducó.");return}if(!window.confirm(`Vas a recibir "${bt.nombre}". 1040 1041Llega como borrador tuyo, con su propia dirección. Tendrás que ponerle TU pÃxel y TU producto de Dropi: eso no viaja con el código. 1042 1043¿La recibo?`))return;const wt=await(await o("/api/landing/importar-compartida",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codigo:q.trim()})})).json();if(!wt.ok){alert(wt.message||"No se pudo recibir la landing.");return}alert(wt.message||"Listo, ya la tienes en borradores."),_n(),(te=wt.page)!=null&&te.id&&(V(wt.page.id),x("edit"))}catch{alert("No se pudo conectar. Intenta de nuevo.")}},children:"Importar código"})]})}),z==="resumen"&&!K&&e.jsxs("div",{style:{marginBottom:16},"aria-hidden":"true",children:[e.jsx("div",{style:{display:"flex",gap:7,marginBottom:12},children:[64,64,76,118].map((q,te)=>e.jsx("span",{className:"lk-skel",style:{width:q,height:30,borderRadius:999}},te))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(180px, 100%), 1fr))",gap:12,marginBottom:16},children:Array.from({length:7},(q,te)=>e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"15px 16px",minWidth:0},children:[e.jsx("span",{className:"lk-skel",style:{width:"55%",height:9,borderRadius:5}}),e.jsx("span",{className:"lk-skel",style:{width:"70%",height:22,borderRadius:7,marginTop:12}}),e.jsx("span",{className:"lk-skel",style:{width:"45%",height:9,borderRadius:5,marginTop:10}})]},te))}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"16px 18px 14px"},children:[e.jsx("span",{className:"lk-skel",style:{width:148,height:10,borderRadius:5}}),e.jsx("span",{className:"lk-skel",style:{width:128,height:24,borderRadius:7,marginTop:12}}),e.jsx("span",{className:"lk-skel",style:{width:"100%",height:200,borderRadius:10,marginTop:14,o
1043pacity:.55}})]})]}),z==="resumen"&&K&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("div",{className:"lk-scroll-x",style:{display:"inline-flex",gap:7,flexWrap:"wrap"},children:[["today","Hoy"],["yesterday","Ayer"],["7d","7 dÃas"],["custom","Personalizado"]].map(([q,te])=>e.jsx("button",{onClick:()=>ha(q),style:{cursor:"pointer",borderRadius:999,padding:"6px 14px",fontSize:12.5,fontWeight:700,flex:"none",whiteSpace:"nowrap",fontFamily:"inherit",border:`1px solid ${ia===q?"#2563EB":"var(--border)"}`,background:ia===q?"#2563EB":"transparent",color:ia===q?"#fff":"var(--text-muted)",boxShadow:ia===q?"0 2px 8px -2px rgba(37,99,235,.5)":"none",transition:"all .15s"},children:te},q))}),he.length>1&&e.jsx(Fy,{icono:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3 12h18M12 3a15 15 0 0 1 0 18a15 15 0 0 1 0-18z"})]}),children:e.jsxs("select",{"aria-label":"Filtrar el Home por paÃs",value:yt,onChange:q=>Q(q.target.value),style:My(!!yt,!0),children:[e.jsx("option",{value:"",children:"Todos los paÃses"}),he.map(q=>{var te,ke;return e.jsxs("option",{value:q,children:[((te=rn[q])==null?void 0:te.name)||q," · ",((ke=rn[q])==null?void 0:ke.currency)||""]},q)})]})}),ce.length>1&&e.jsx(Fy,{icono:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),e.jsx("path",{d:"M3 9h18M9 21V9"})]}),children:e.jsxs("select",{"aria-label":"Filtrar el Home por landing",value:ge||"",onChange:q=>pe(q.target.value),style:My(!!ge,!0),children:[e.jsx("option",{value:"",children:"Todas las landings"}),ce.filter(q=>!q.archivada).map(q=>e.jsx("option",{value:q.id,children:Te.get(q.id)},q.id)),ce.some(q=>q.archivada)&&e.jsx("optgroup",{label:"Archivadas",children:ce.filter(q=>q.archivada).map(q=>e.jsx("option",{value:q.id,children:Te.get(q.id)},q.id))})]})}),!!(F&&F.total>0)&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:999,padding:"6px 12px",whiteSpace:"nowrap",flex:"none"},children:[e.jsx("span",{className:"lk-dot",style:{width:7,height:7,borderRadius:"50%",background:"var(--success)",display:"inline-block",flex:"none",boxShadow:"0 0 0 3px var(--notice-success-bg)"}}),F.total," en vivo"]}),ia==="custom"&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"6px 12px",boxShadow:"0 1px 2px rgba(16,24,40,0.04)"},children:[e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted, #6b7280)"},children:"Desde"}),e.jsx("input",{type:"date",value:da,onChange:q=>Na(q.target.value),style:{border:0,background:"transparent",fontSize:12.5,fontWeight:600,color:"var(--text, #171717)",padding:"3px 2px",outline:"none",colorScheme:"light",fontFamily:"inherit"}}),e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted, #6b7280)"},children:"hasta"}),e.jsx("input",{type:"date",value:wa,onChange:q=>La(q.target.value),style:{border:0,background:"transparent",fontSize:12.5,fontWeight:600,color:"var(--text, #171717)",padding:"3px 2px",outline:"none",colorScheme:"light",fontFamily:"inherit"}})]}),e.jsx("span",{style:{flex:1,minWidth:8}}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"baseline",gap:7,fontSize:12.5,color:"var(--text-muted, #9ca3af)",fontWeight:600,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontSize:10,fontWeight:800,textTransform:"uppercase",letterSpacing:".05em",color:"var(--text-muted, #b6bdca)"},children:"Hoy"}),e.jsxs("b",{style:{color:"var(--text, #171717)",fontWeight:800},children:[K.today_orders," ",K.today_orders===1?"pedido":"pedidos"]}),e.jsx("span",{style:{opacity:.55},children:"·"}),e.jsx("b",{style:{color:"var(--success)",fontWeight:800},children:Pe(K.today_by_currency,K.today_revenue)})]})]}),ge>0&&Number(K.fuera_de_la_landing)>0&&e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, #6b7280)",fontWeight:600,marginBottom:10,marginTop:-4},children:["Solo esta landing. Quedan fuera ",Number(K.fuera_de_la_landing).toLocaleStr
1043ing("es-CO")," ",Number(K.fuera_de_la_landing)===1?"pedido":"pedidos"," de otras landings o de tu logÃstica."]}),e.jsxs("div",{className:"lk-kpis",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(180px, 100%), 1fr))",gap:12,marginBottom:16},children:[e.jsx(xr,{idx:0,label:"Visitas",value:Number(K.views).toLocaleString("es-CO"),num:Number(K.views)||0,fmt:q=>Math.round(q).toLocaleString("es-CO"),sub:K.ranged?"en el periodo":"todas tus landings",trend:(K.seriesRange||K.series||[]).map(q=>Number(q.visits)||0)}),e.jsx(xr,{idx:1,label:"Pedidos",value:Number(K.orders).toLocaleString("es-CO"),num:Number(K.orders)||0,fmt:q=>Math.round(q).toLocaleString("es-CO"),sub:K.ranged?"en el periodo":`hoy: ${K.today_orders}`,trend:(K.seriesRange||K.series||[]).map(q=>Number(q.orders)||0)}),e.jsx(xr,{idx:2,label:"Conversión",value:K.views>0?(K.orders/K.views*100).toFixed(1)+"%":"â",num:K.views>0?K.orders/K.views*100:void 0,fmt:q=>q.toFixed(1)+"%",sub:"pedidos ÷ visitas",trend:(K.seriesRange||K.series||[]).map(q=>(Number(q.orders)||0)*100),trendDenom:(K.seriesRange||K.series||[]).map(q=>Number(q.visits)||0)}),e.jsx(xr,{idx:3,hero:!0,label:"Ventas",value:Ut(K.revenue),num:Number(K.revenue)||0,fmt:Ut,extra:ue,sub:K.ranged?"en el periodo":`hoy: ${Pe(K.today_by_currency,K.today_revenue)}`,accent:"#16a34a"}),e.jsx(xr,{idx:4,label:"Ticket promedio",value:oe[0]||"â",num:Qt>0?Number(K.revenue)/Qt:void 0,fmt:Ut,extra:oe.slice(1),sub:"venta ÷ pedidos"}),e.jsx(xr,{idx:5,label:"Entregados",value:Number(K.delivered||0).toLocaleString("es-CO"),num:Number(K.delivered)||0,fmt:q=>Math.round(q).toLocaleString("es-CO"),sub:Ae?void 0:"pedidos ya entregados",notas:Ot,accent:"#0ea5e9"}),e.jsx(xr,{idx:6,label:"Tasa de entrega",value:Ge!=null?Math.round(Ge*100)+"%":"â",num:Ge!=null?Ge*100:void 0,fmt:q=>Math.round(q)+"%",sub:dt===0?"aún no hay pedidos resueltos":"entregados ÷ resueltos",notas:Pa,accent:"#0ea5e9"}),qa.length>0&&e.jsx(xr,{idx:7,label:"Gasto en pauta",value:"",columnas:qa,sub:Zo.gasto==null&&Ie.cruzando?"consultando Meta y TikTokâ¦":void 0})]},`kpi-${ia}-${da}-${wa}`),e.jsx(Xk,{range:ia,from:Gt().from,to:Gt().to,pais:ne,landing:ge,conCodigo:ct}),!(za&&!(Number((Vn=za==null?void 0:za.funnel)==null?void 0:Vn.visits)>0))&&e.jsx(Vy,{stats:K,analytics:za,onCrm:()=>{fe(null),x("crm")}}),Number(K.prepay_attempts)>0&&(()=>{const q=Number(K.prepay_attempts)||0,te=Number(K.prepay_failed)||0,ke=Number(K.prepay_paid)||0,bt=q>0?Math.round(te/q*100):0,oa=q>0?Math.round(ke/q*100):0;return e.jsxs("div",{className:"lk-kpi",style:{...Jt,padding:16,marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:30,height:30,borderRadius:9,background:"rgba(8,102,255,.1)",color:me,display:"flex",alignItems:"center",justifyContent:"center",flex:"none"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M2 10h20"})]})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"Pago anticipado (en lÃnea)"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted, #9ca3af)",margin:"2px 0 0"},children:["De ",q," ",q===1?"persona que intentó":"personas que intentaron"," pagar en lÃnea: cuántas lograron pagar y cuántas fallaron (quedan contraentrega)."]})]})]}),e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",alignItems:"flex-end",margin:"14px 0 10px"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:26,fontWeight:800,color:"var(--success)",fontVariantNumeric:"tabular-nums",letterSpacing:"-.02em"},children:[oa,"%"]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted, #6b7280)",marginTop:2},children:[ke," ",ke===1?"pagó":"pagaron"]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:26,fontWeight:800,color:"#be123c",fontVariantNumeric:"tabular-nums",letterSpacing:"-.02em"},children:[bt,"%"]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted, #6b7280)",marginTop:2},children:[te," ",te===1?"falló":"fallaron"]})]}),e.jsxs("div",{style:{marginLeft:"auto",textAlign:"right"},children:[e.jsx("div",{style:{fontSize:17,fontWeight:800,color:"var(--text, #171717)",fontVariantNumeric:"tabular-nums"},children:q}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted, #6b7280)"},children:"intentos"})]})]}),e.jsxs("div",{style:{display:"flex",height:9,borderRadius:999,overflow:"hidden",background:"var(--input-bg, #f1f3f8)"},children:[e.jsx("div",{style:{width:oa+"%",background:"#16a34a",transition:"width .7s cubic-bezier(.22,.61,.36,1)"}}),e.jsx("div",{style:{width:bt+"%",background:"#e11d48",transition:"width .7s cubic-bezier(.22,.61,.36,1)"}})]})]})})(),za&&e.jsx(S8,{data:za,stats:K,from:ba.from,to:ba.to,pais:ne,moneda:xt,cruceDePauta:Ie,landings:u,onEditLandings:()=>G("landings"),onCrm:()=>{fe(null),x("crm")},onPagos:()=>G("pagos"),alertas:Number((ar=za==null?void 0:za.funnel)==null?void 0:ar.visits)>0?null:e.jsx(Vy,{stats:K,analytics:za,onCrm:()=>{fe(null),x("crm")},enRejilla:!0})})]}),z==="landings"&&(w?e.jsx("div",{style:{...Jt,textAlign:"center",color:"var(--text-muted)"},children:"Cargandoâ¦"}):u.length===0?e.jsxs("div",{style:{...Jt,textAlign:"center",padding:40},children:[e.jsx("h3",{style:{margin:"0 0 6px"},children:"Aún no tienes landings"}),e.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginBottom:16},children:"Crea tu primer túnel de venta. Pones texto + subes tus imágenes desde el PC y al publicar queda con su propio enlace."}),e.jsx("button",{style:xa,onClick:()=>Ln(!0),children:"+ Crear mi primera landing"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginBottom:12},children:[e.jsxs("div",{className:"lk-search",style:{position:"relative",flex:"1 1 200px",minWidth:0},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.3,style:{position:"absolute",left:11,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",zIndex:1},children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"M20 20l-3.5-3.5"})]}),e.jsx("input",{value:j,onChange:q=>S(q.target.value),placeholder:"Buscar por nombre o enlaceâ¦",style:{...E,padding:"8px 11px 8px 32px",fontSize:13,margin:0}})]}),[["all","Todas"],["published","Publicadas"],["draft","Borradores"]].map(([q,te])=>{const ke=q==="all"?u.length:u.filter(oa=>q==="published"?oa.status==="published":oa.status!=="published").length,bt=$===q;return e.jsxs("button",{type:"button",onClick:()=>C(q),style:{...bt?{...ee,background:me+"14",borderColor:"transparent",color:me}:ee,padding:"6px 12px",fontSize:12.5,borderRadius:999,flex:"none"},children:[te," ",e.jsx("span",{style:{opacity:.6,fontVariantNumeric:"tabular-nums"},children:ke})]},q)}),e.jsx("div",{style:{display:"flex",gap:2,padding:3,borderRadius:11,background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",flex:"none"},children:[["grid","CuadrÃcula"],["lista","Lista"]].map(([q,te])=>e.jsx("button",{type:"button",onClick:()=>f(q),style:{border:0,background:c===q?"var(--bg-card, #fff)":"transparent",color:c===q?me:"var(--text-muted, #64748b)",borderRadius:8,padding:"6px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",boxShadow:c===q?"0 1px 1px rgba(11,16,32,.05), 0 6px 14px -8px rgba(11,16,32,.4)":"none",transition:"background .2s, color .2s"},children:te},q))}),e.jsxs("button",{type:"button","aria-pressed":Da,onClick:()=>{Da?ma():(Fe(null),Hn(!0))},style:{...Da?{...ee,background:me+"14",border:"1.5px solid transparent",color:me}:ee,padding:"6px 12px",fontSize:12.5,borderRadius:999,flex:"none",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"4"}),e.jsx("path",{d:"M8 12.2l2.8 2.8L16.5 9.3"})]}),"Seleccionar"]})]}),(()=>{const q=fn;return q.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gap:12,gridTemplateColumns:c==="grid"?"repeat(auto-fill, minmax(min(100%, 290px), 1fr))":"1fr",alignItems:"start"},children:q.map((te,ke)=>{const bt=Gl(te),oa=Da&&Ra.has(Number(te.id)),wt=Da?{role:"checkbox","aria-checked":oa,"aria-label":bt,tabIndex:0,onClickCapture:en=>{en.preventDefault(),en.stopPropagation(),ta(Number(te.id))},onKeyDown:en=>{(en.key===" "||en.key==="Enter")&&(en.preventDefault(),ta(Number(te.id)))}}:{},pt=oa?{border:`1px solid ${me}`,boxShadow:`0 0 0 1px ${me}`,background:"linear-gradient(rgba(8,102,255,.05), rgba(8,102,255,.05)), var(--card-bg, #fff)"}:{},Zt=Da?e.jsx("input",{type:"checkbox",checked:oa,readOnly:!0,tabIndex:-1,"aria-hidden":"true",style:{width:18,height:18,margin:0,flex:"none",accentColor:me}}):null,At=te.views>0?(te.submissions/te.views*100).toFixed(1)+"%":"â",Et=te.status==="published"?te.custom_domain?`${te.custom_domain}`:te.use_lumy_domain?_?`${_}/${te.slug}`:`lumycol.com/l/${te.slug}`:`/l/${te.slug}`:"",xo=te.status==="published"?te.custom_domain?`https://${te.custom_domain}/`:te.use_lumy_domain?_?`https://${_}/${te.slug}`:`https://lumycol.com/l/${te.slug}`:`/l/${te.slug}`:"",Ma=en=>e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none",opacity:.85},children:e.jsx("path",{d:en})});return c==="grid"?e.jsxs("div",{className:"lk-row lk-gcard"+(Da?" lk-marcable":""),...wt,style:{...Jt,"--lk-accent":me,display:"flex",flexDirection:"column",gap:0,padding:13,height:"100%",animationDelay:`${Math.min(ke,12)*45}ms`,position:"relative",zIndex:tt===te.id?70:1,...pt},children:[e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start",minWidth:0},children:[te.product_image?e.jsx("img",{src:te.product_image,alt:"",loading:"lazy",style:{width:44,height:44,borderRadius:10,objectFit:"cover",flex:"none"}}):e.jsx("div",{style:{width:44,height:44,borderRadius:10,flex:"none",display:"flex",alignItems:"center",justifyContent:"center",background:me+"14",color:me,fontWeight:800,fontSize:15},children:bt.trim().charAt(0).toUpperCase()}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("strong",{title:bt,style:{display:"block",fontSize:14,letterSpacing:"-.012em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:bt}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,marginTop:4,fontSize:10.5,fontWeight:800,letterSpacing:".03em",padding:"3px 9px",borderRadius:999,background:te.status==="published"?"var(--notice-success-bg)":"var(--bg-tertiary)",color:te.status==="published"?"var(--success)":"var(--text-muted, #64748b)"},children:[te.status==="published"&&e.jsx("i",{className:"lk-dot"}),te.status==="published"?"PUBLICADA":"BORRADOR"]}),!!te.plantilla_at&&e.jsx("span",{title:"Compartida como plantilla: todos los vendedores la ven en Plantillas",style:{display:"inline-flex",alignItems:"center",marginTop:4,marginLeft:6,fontSize:10.5,fontWeight:800,letterSpacing:".03em",padding:"3px 9px",borderRadius:999,background:"var(--notice-info-bg)",color:"var(--accent-blue)"},children:"PLANTILLA"})]}),Zt]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:11,minWidth:0,height:28},children:Et?e.jsxs(e.Fragment,{children:[e.jsx("a",{className:"lk-glink",href:x
1043o,target:"_blank",rel:"noreferrer",title:Et,style:{flex:1,minWidth:0,fontSize:11.5,color:me,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Et}),e.jsx("button",{type:"button",title:"Copiar enlace",onClick:()=>{try{navigator.clipboard.writeText(xo.startsWith("http")?xo:location.origin+xo),v(te.id),setTimeout(()=>v(null),1400)}catch{}},style:{...ee,flex:"none",padding:"4px 8px",fontSize:11,fontWeight:700,lineHeight:1.4},children:b===te.id?"Copiado":"Copiar"})]}):e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Sin publicar"})}),e.jsxs("div",{style:{display:"flex",gap:13,marginTop:10,fontSize:12,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums",flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[Ma("M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z"),e.jsx("b",{style:{color:"var(--text, #111)",fontWeight:750},children:te.views})]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[Ma("M6 6h15l-1.5 9h-12zM6 6L5 3H2M9 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM18 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"),e.jsx("b",{style:{color:"var(--text, #111)",fontWeight:750},children:te.submissions})]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontWeight:800,color:te.views>0?te.submissions/te.views>=.01?"var(--success)":te.submissions>0?"var(--warning)":"var(--text-muted)":"var(--text-muted)"},children:[Ma("M3 17l6-6 4 4 8-8M21 7h-5"),At]}),e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:4},children:[e.jsx("button",{type:"button",title:"AnalÃticas de esta landing","aria-label":"AnalÃticas",onClick:()=>{ze(te),x("stats")},style:{...ee,padding:"4px 7px",lineHeight:0,flex:"none",color:"var(--text-muted, #777)"},children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",children:e.jsx("path",{d:"M4 19V11M10 19V5M16 19v-6M21 19H3"})})}),e.jsx("button",{type:"button",title:"Pedidos de esta landing","aria-label":"Pedidos",onClick:()=>{fe(te.id),x("crm")},style:{...ee,padding:"4px 7px",lineHeight:0,flex:"none",color:"var(--text-muted, #777)"},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M6 6h15l-1.6 9H7.5zM6 6L5 3H2"}),e.jsx("circle",{cx:"9.5",cy:"19",r:"1.4"}),e.jsx("circle",{cx:"17.5",cy:"19",r:"1.4"})]})})]})]}),e.jsxs("div",{style:{marginTop:"auto",paddingTop:12,display:"flex",gap:8,alignItems:"center",position:"relative"},children:[e.jsx("button",{className:"lk-edit",style:{...xa,flex:1,padding:"8px 12px"},onClick:()=>{V(te.id),x("edit")},children:"Editar"}),e.jsx("button",{className:"lk-kebab","aria-label":"Más acciones",title:"Más acciones",style:{...ee,padding:"8px 10px",lineHeight:0,color:"var(--text-muted, #777)",flex:"none"},onClick:()=>Fe(tt===te.id?null:te.id),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.9"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.9"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.9"})]})}),tt===te.id&&e.jsxs("div",{"data-menu-flotante":"",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,minWidth:188,background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:12,boxShadow:"0 14px 36px rgba(20,30,60,.18)",padding:6,zIndex:81},children:[e.jsx("button",{className:"lk-mi",style:Ml,onClick:()=>{Fe(null),mn(te)},children:"Duplicar"}),i&&e.jsx("button",{className:"lk-mi",style:Ml,onClick:()=>{Fe(null),go(te)},children:te.plantilla_at?"Dejar de compartir":"Compartir como plantilla"}),e.jsx("div",{style:{height:1,background:"var(--border, #eee)",margin:"5px 6px"}}),e.jsx("button",{className:"lk-mi",style:{...Ml,color:"var(--danger)"},onClick:()=>{Fe(null),Va(te)},children:"Borrar"})]})]})]},te.id):e.jsxs("div",{className:"lk-row"+(Da?" lk-marcable":""),...wt,style:{...Jt,display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap",animationDelay:`${Math.min(ke,12)*45}ms`,position:"relative",zIndex:tt===te.id?70:1,...pt},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:200,flex:"1 1 auto"},children:[Zt,te.product_image?e.jsx("img",{src:te.product_image,alt:"",loading:"lazy",style:{width:56,height:56,borderRadius:12,objectFit:"cover",flex:"none",border:"1px solid var(--border, #e8eaf0)"}}):e.jsx("div",{style:{width:56,height:56,borderRadius:12,flex:"none",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,fontSize:21,color:"#64748b",background:"linear-gradient(135deg, #eef2ff, #f6f8fc)",border:"1px solid var(--border, #e8eaf0)"},children:bt.slice(0,1).toUpperCase()}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("strong",{style:{fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:260},children:bt}),e.jsx("span",{style:{fontSize:11,fontWeight:800,padding:"2px 8px",borderRadius:7,background:te.status==="published"?"var(--notice-success-bg)":"var(--bg-tertiary)",color:te.status==="published"?"var(--success)":"var(--text-muted)"},children:te.status==="published"?"Publicada":"Borrador"}),!!te.plantilla_at&&e.jsx("span",{title:"Compartida como plantilla: todos los vendedores la ven en Plantillas",style:{fontSize:11,fontWeight:800,padding:"2px 8px",borderRadius:7,background:"var(--notice-info-bg)",color:"var(--accent-blue)"},children:"Plantilla"}),!!(F&&F.byLanding[te.id])&&e.jsxs("span",{style:{fontSize:11,fontWeight:800,padding:"2px 8px",borderRadius:7,background:"var(--notice-success-bg)",color:"var(--success)",display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--success)",display:"inline-block"}}),F.byLanding[te.id]," en vivo"]})]}),e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginTop:4,minWidth:0,overflowWrap:"anywhere"},children:[e.jsxs("span",{title:"Estos tres son acumulados desde que se creó la página, no del periodo que tengas elegido. Para verlos por fechas entra a AnalÃticas.",children:[te.views," visitas · ",te.submissions," pedidos · conv. ",At," ",e.jsx("span",{style:{opacity:.7},children:"(desde que se creó)"})]}),te.status==="published"&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("a",{href:te.use_lumy_domain?_?`https://${_}/${te.slug}`:`https://lumycol.com/l/${te.slug}`:`/l/${te.slug}`,target:"_blank",rel:"noreferrer",title:"La dirección de Lumy. Siempre funciona, aunque no tengas dominio propio.",style:{color:me},children:[te.use_lumy_domain?_?`${_}/${te.slug}`:`lumycol.com/l/${te.slug}`:`/l/${te.slug}`," â"]})]}),te.status==="published"&&te.custom_domain&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("a",{href:`https://${te.custom_domain}/`,target:"_blank",rel:"noreferrer",title:"Tu dominio propio. Abre la misma landing que el enlace azul.",style:{color:"#16a34a"},children:[te.custom_domain," â"]})]})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",position:"relative"},children:[e.jsx("button",{type:"button",title:"AnalÃticas de esta landing","aria-label":"AnalÃticas",onClick:()=>{ze(te),x("stats")},style:{...ee,padding:"6px 8px",lineHeight:0,flex:"none",color:"var(--text-muted, #777)"},children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",children:e.jsx("path",{d:"M4 19V11M10 19V5M16 19v-6M21 19H3"})})}),e.jsx("button",{type:"button",title:"Pedidos de esta landing","aria-label":"Pedidos",onClick:()=>{fe(te.id),x("crm")},style:{...ee,padding:"6px 8px",lineHeight:0,flex:"none",color:"var(--text-muted, #777)"},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M6 6h15l-1.6 9H7.5zM6 6L5 3H2"}),e.jsx("circle",{cx:"9.5",cy:"19",r:"1.4"}),e.jsx("circle",{cx:"17.5",cy:"19",r:"1.4"})]})}),e.jsx("button",{className:"lk-edit",style:xa,onClick:()=>{V(te.id),x("edit")},children:"Editar"}),e.jsx("button",{className:"lk-kebab","aria-label":"Más acciones",title:"Más acciones",style:{...ee,padding:"9px 11px",lineHeight:0,color:"var(--text-muted, #777)"},onClick:()=>Fe(tt===te.id?null:te.id),children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"
1043currentColor",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.9"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.9"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.9"})]})}),tt===te.id&&e.jsxs("div",{"data-menu-flotante":"",style:{position:"absolute",top:"calc(100% + 6px)",right:0,minWidth:188,background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:12,boxShadow:"0 14px 36px rgba(20,30,60,.18)",padding:6,zIndex:81},children:[e.jsx("button",{className:"lk-mi",style:Ml,onClick:()=>{Fe(null),mn(te)},children:"Duplicar"}),i&&e.jsx("button",{className:"lk-mi",style:Ml,onClick:()=>{Fe(null),go(te)},children:te.plantilla_at?"Dejar de compartir":"Compartir como plantilla"}),e.jsx("div",{style:{height:1,background:"var(--border, #eee)",margin:"5px 6px"}}),e.jsx("button",{className:"lk-mi",style:{...Ml,color:"var(--danger)"},onClick:()=>{Fe(null),Va(te)},children:"Eliminar"})]})]})]},te.id)})}),Da&&e.jsx("div",{"aria-hidden":"true",className:"lk-barra-sel-aire"})]}):e.jsx("div",{style:{...Jt,textAlign:"center",color:"var(--text-muted)",fontSize:13.5,padding:26},children:"Ninguna landing coincide con lo que buscas."})})()]})),z==="landings"&&Da&&(u.length>0||!!ae)&&typeof document<"u"&&Wo.createPortal(e.jsxs("div",{role:"toolbar","aria-label":"Acciones con las landings seleccionadas",className:"lk-barra-sel",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",background:"#0f172a",color:"#fff",borderRadius:14,padding:"10px 14px",boxShadow:"0 14px 36px -10px rgba(15,23,42,.5)"},children:[e.jsx("span",{role:"status",style:{fontSize:12.5,fontWeight:700,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:ae||`${it.length} ${it.length===1?"seleccionada":"seleccionadas"}`}),u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",style:Au,onClick:()=>ln(q=>{const te=new Set(q);return fn.forEach(ke=>te.add(Number(ke.id))),te}),children:"Seleccionar todas"}),e.jsx("button",{type:"button",style:{...Au,opacity:Ra.size?1:.5,cursor:Ra.size?"pointer":"default"},disabled:!Ra.size,onClick:()=>ln(new Set),children:"Quitar selección"}),e.jsx("button",{type:"button",style:{...Au,background:"#dc2626",borderColor:"#dc2626",fontWeight:700,opacity:it.length&&!mo?1:.5,cursor:it.length&&!mo?"pointer":"default"},disabled:!it.length||mo,onClick:pn,children:mo?"Eliminandoâ¦":`Eliminar (${it.length})`})]}),e.jsx("button",{type:"button",style:Au,onClick:ma,children:"Salir"})]}),document.body),tt!=null&&e.jsx("div",{onClick:()=>Fe(null),style:{position:"fixed",inset:0,zIndex:60}}),Gn&&typeof document<"u"&&Wo.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(10,15,32,.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:16},onClick:()=>Ln(!1),children:e.jsxs("div",{style:{...Jt,maxWidth:520,width:"100%",padding:20},onClick:q=>q.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 4px",fontSize:17},children:"Nueva página"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 12px"},children:"¿Qué quieres crear?"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:10,marginBottom:14},children:[e.jsxs("button",{onClick:()=>_o("product"),style:{textAlign:"left",border:Ba==="product"?`2px solid ${me}`:"1.5px solid var(--border, #e5e7eb)",background:Ba==="product"?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Página de producto"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:"Completa: tÃtulo, precio, variantes, ofertas, reseñas, garantÃa, entrega y formulario."})]}),e.jsxs("button",{onClick:()=>_o("simple"),style:{textAlign:"left",border:Ba==="simple"?`2px solid ${me}`:"1.5px solid var(--border, #e5e7eb)",background:Ba==="simple"?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Landing simple"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:"Tus imágenes una debajo de otra + botón de pedir + formulario. Directo al grano."})]}),e.jsxs("button",{onClick:()=>_o("whatsapp"),style:{textAlign:"left",border:Ba==="whatsapp"?"2px solid #16a34a":"1.5px solid var(--border, #e5e7eb)",background:Ba==="whatsapp"?"rgba(22,163,74,.06)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Landing de WhatsApp"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:"Página de venta + botón grande que abre WhatsApp. Sin formulario. Ideal para asesorÃas y agendas por chat. Mide la venta real con el código del clic."})]}),!s&&e.jsxs("button",{onClick:()=>_o("servicio"),style:{textAlign:"left",border:Ba==="servicio"?"2px solid #0d9488":"1.5px solid var(--border, #e5e7eb)",background:Ba==="servicio"?"rgba(13,148,136,.06)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Página de servicios"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:"Para negocios de servicio (odontologÃa, estética, asesorÃas, lavado, reparacionesâ¦). Agenda de citas, planes y precios, equipo, horario y formulario de cotización. Sin dirección ni envÃo. Optimiza LEADS en tu pixel, no compras."})]}),e.jsxs("button",{onClick:()=>_o("codigo"),style:{textAlign:"left",border:Ba==="codigo"?"2px solid #8b5cf6":"1.5px solid var(--border, #e5e7eb)",background:Ba==="codigo"?"rgba(139,92,246,.06)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontFamily:"ui-monospace, Menlo, monospace",fontWeight:800,fontSize:12,color:"#0866ff",background:"rgba(8,102,255,.1)",border:"1px solid rgba(8,102,255,.28)",borderRadius:7,padding:"2px 6px"},children:"</>"}),e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Página en código"}),e.jsx("span",{style:{fontSize:9.5,fontWeight:900,letterSpacing:".07em",color:"#fff",background:"linear-gradient(100deg, #0866ff, #8b5cf6)",borderRadius:999,padding:"3px 8px",whiteSpace:"nowrap"},children:"100% LIBRE"})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:"Tu HTML+CSS es la página entera, a tu gusto. Puedes pedÃrselo a Claude o a ChatGPT y pegarlo aquÃ. El formulario de pedido y el CRM funcionan igual."})]}),i&&e.jsxs("button",{onClick:()=>_o("advertorial"),style:{textAlign:"left",border:Ba==="advertorial"?`2px solid ${me}`:"1.5px solid var(--border, #e5e7eb)",background:Ba==="advertorial"?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",borderRadius:12,padding:14,cursor:"pointer"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:14.5,color:"var(--text, #111)"},children:"Advertorial (página aparte)"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5}
1043,children:"Una nota estilo artÃculo que calienta el tráfico frÃo y, con un botón, lleva a tu landing de venta (otra URL). El anuncio apunta aquÃ. Contenido publicitario honesto, sin engañar al revisor."})]})]}),e.jsx("style",{children:"@keyframes lp-shake{10%,90%{transform:translateX(-1px)}20%,80%{transform:translateX(2px)}30%,50%,70%{transform:translateX(-4px)}40%,60%{transform:translateX(4px)}}.lp-shake{animation:lp-shake .4s cubic-bezier(.36,.07,.19,.97)}"}),e.jsxs("label",{style:D,children:["Nombre interno ",e.jsx("span",{style:{color:"var(--danger)"},children:"*"})]}),e.jsx("input",{style:{...E,...Yn?{borderColor:"var(--danger)",boxShadow:"0 0 0 3px var(--notice-danger-bg)"}:{}},className:Yn?"lp-shake":"",value:ho,onChange:q=>{tr(q.target.value),Yn&&yr(!1)},placeholder:"Ej: Compresor de aire",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"&&dn()}}),e.jsx("p",{role:Yn?"alert":void 0,style:{margin:"6px 2px 0",fontSize:12,color:Yn?"var(--danger)":"var(--text-muted)",fontWeight:Yn?600:400},children:Yn?"Ponle un nombre para encontrarla después en tu lista.":"Solo tú lo ves. Te sirve para identificarla en tu lista de landings."}),!1,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},children:[e.jsx("button",{style:ee,onClick:()=>Ln(!1),children:"Cancelar"}),e.jsx("button",{style:{...xa,opacity:$o?.6:1,cursor:$o?"default":"pointer"},onClick:dn,children:$o?"Creandoâ¦":"Crear"})]})]})}),document.body),z==="inventario"&&e.jsx(_A,{}),z==="inventario"&&e.jsx(X4,{items:H,alerts:De,currency:se,storeOn:Ye,onSaveStock:la,onSetStoreHidden:jt,onEdit:q=>{V(q),x("edit")}}),z==="tienda"&&e.jsx(_8,{onModoCodigo:U}),z==="pagos"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(Cu,{title:"Cobrar antes de entregar",desc:"Conectas TU cuenta una sola vez y la plata te cae directo: Lumy nunca la toca. Después eliges en qué landings mostrar el botón.",children:e.jsx(z8,{})}),e.jsx(Cu,{title:"Tus datos y clientes bloqueados",desc:"Tus pedidos en vivo en una hoja de cálculo, y los teléfonos a los que no quieres despachar.",children:e.jsx(T8,{})}),e.jsx(Cu,{title:"Conecta tu propio bot o CRM",desc:"Si ya tienes tu sistema, Lumy le avisa cada vez que entra un pedido o cambia de estado. Funciona con cualquier plataforma que reciba un webhook.",children:e.jsx(I8,{})}),e.jsx(Cu,{title:"Bot externo (LucidBot)",desc:"Que confirme y despache por WhatsApp. Ojo: los pedidos de esa landing van al bot y NO a Dropi â igual quedan en tu CRM y reportan a tus pÃxeles.",children:e.jsx(E8,{})})]})]})}function ht({title:t,right:a,defaultOpen:n,children:o}){const[i,s]=h.useState(!!n),u=h.useRef(null);return h.useEffect(()=>{const m=c=>{if(!c||!c.detail)return;const g=Array.isArray(c.detail.titles)?c.detail.titles:[c.detail.title],f=S=>String(S||"").replace(/\s+/g," ").trim().toLowerCase(),b=f(t),v=g.findIndex(S=>f(S)===b);if(v<0)return;c.detail.consumed=!0,(typeof c.detail.best!="number"||v<c.detail.best)&&(c.detail.best=v);const j=String(c.detail.field||"");setTimeout(()=>{if(c.detail.best!==v)return;s(!0);let S=0;const $=()=>{var C,_,N;try{const w=u.current;if(!w)return;let M=null;if(j){const p=Array.from(w.querySelectorAll("label")),V=x=>String(x||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),L=V(j);if(M=p.find(x=>{const z=V(x.textContent||"");return z.startsWith(L)||z.length>=6&&L.startsWith(z)})||null,!M&&S++<14){setTimeout($,120);return}try{window.dispatchEvent(new CustomEvent("lumy:guia-campo",{detail:{ok:!!M,campo:j}}))}catch{}}if(M){const p=M.closest("div"),V=p&&p.getBoundingClientRect().height<420?p:M;V.scrollIntoView({behavior:"smooth",block:"center"});const L=V===M?[M,M.nextElementSibling,(C=M.nextElementSibling)==null?void 0:C.nextElementSibling].filter(x=>x instanceof HTMLElement):[V];for(const x of L)(_=x.animate)==null||_.call(x,[{boxShadow:"0 0 0 5px rgba(8,102,255,.65)",backgroundColor:"rgba(8,102,255,.12)"},{boxShadow:"0 0 0 5px rgba(8,102,255,.65)",backgroundColor:"rgba(8,102,255,.12)",offset:.7},{boxShadow:"0 0 0 0 rgba(8,102,255,0)",backgroundColor:"rgba(8,102,255,0)"}],{duration:3200});yj(M)}else w.scrollIntoView({behavior:"smooth",block:"center"}
1043),(N=w.animate)==null||N.call(w,[{boxShadow:"0 0 0 5px rgba(8,102,255,.65)"},{boxShadow:"0 0 0 5px rgba(8,102,255,.65)",offset:.7},{boxShadow:"0 0 0 0 rgba(8,102,255,0)"}],{duration:3200})}catch{}};setTimeout($,140)},160)};return window.addEventListener("lumy:open-section",m),()=>window.removeEventListener("lumy:open-section",m)},[t]),e.jsxs("div",{ref:u,style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,marginBottom:10,overflow:"hidden",width:"100%",maxWidth:"100%",boxSizing:"border-box"},children:[e.jsxs("div",{onClick:()=>s(m=>!m),style:{display:"flex",alignItems:"center",gap:10,padding:"13px 16px",cursor:"pointer",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,minWidth:0,fontSize:14.5,fontWeight:700,color:"var(--text, #16181d)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),a&&e.jsx("span",{onClick:m=>m.stopPropagation(),style:{flex:"none",display:"inline-flex",alignItems:"center"},children:a}),e.jsx("svg",{viewBox:"0 0 24 24",width:"15",height:"15",style:{flex:"none",transform:i?"rotate(180deg)":"none",transition:"transform .15s ease",color:"var(--text-muted, #99a)"},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),i&&e.jsx("div",{style:{padding:"0 16px 16px"},children:o})]})}const tj=["Amazonas","Antioquia","Arauca","Atlántico","Bogotá D.C.","BolÃvar","Boyacá","Caldas","Caquetá","Casanare","Cauca","Cesar","Chocó","Córdoba","Cundinamarca","GuainÃa","Guaviare","Huila","La Guajira","Magdalena","Meta","Nariño","Norte de Santander","Putumayo","QuindÃo","Risaralda","San Andrés y Providencia","Santander","Sucre","Tolima","Valle del Cauca","Vaupés","Vichada"];function w8({excluded:t,excludedL2:a,onChange:n,onChangeL2:o,country:i}){const s=$a(),u=i&&rn[String(i).toUpperCase()]?String(i).toUpperCase():Rr().code,[m,c]=h.useState(null),[g,f]=h.useState(null);h.useEffect(()=>{const p=()=>c(u==="CO"?Object.fromEntries(tj.map(V=>[V,[]])):{});s(`/api/landing/my-geo?c=${encodeURIComponent(u)}`).then(V=>V.json()).then(V=>{V&&typeof V=="object"&&Object.keys(V).length?c(V):p()}).catch(p)},[s,u]);const b=m?Object.keys(m).sort((p,V)=>p.localeCompare(V,"es")):null,v=new Set(t.map(p=>p.toLowerCase())),j=new Set(a.map(p=>p.toLowerCase())),S=p=>{const V=v.has(p.toLowerCase());n(V?t.filter(L=>L.toLowerCase()!==p.toLowerCase()):[...t,p])},$=(p,V)=>{const L=`${p}|${V}`,x=j.has(L.toLowerCase());o(x?a.filter(z=>z.toLowerCase()!==L.toLowerCase()):[...a,L])},C=p=>a.filter(V=>V.toLowerCase().startsWith(p.toLowerCase()+"|")).length,_=Dg(u),N=_.l1.toLowerCase(),w=_.l2.toLowerCase(),M=t.length+a.length;return e.jsxs(ht,{title:"Cobertura de envÃo (zonas)",right:M?e.jsxs("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--warning)"},children:[M," sin cobertura"]}):void 0,children:[e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"2px 0 10px",lineHeight:1.5},children:["Desmarca cada ",N," donde NO despachas (desaparece del formulario con todas sus ciudades). Con la flecha abres la zona y puedes quitar también ",w,"s puntuales. Aplica a esta landing."]}),b===null?e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"Cargando zonasâ¦"}):b.length?e.jsx("div",{style:{display:"grid",gridTemplateColumns:g?"1fr":"repeat(auto-fill, minmax(min(190px, 100%), 1fr))",gap:6},children:b.map(p=>{const V=v.has(p.toLowerCase()),L=m&&m[p]||[],x=C(p),z=g===p;return g&&!z?null:e.jsxs("div",{style:{borderRadius:8,background:V?"var(--notice-danger-bg)":z?"var(--surface-2, rgba(0,0,0,.03))":"transparent"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,padding:"5px 8px"},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:12.5,cursor:"pointer",flex:1,minWidth:0,color:V?"var(--danger)":"inherit"},children:[e.jsx("input",{type:"checkbox",checked:!V,onChange:()=>S(p)}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p})]}),x>0&&!V&&e.jsxs("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--warning)",flex:"none"},children:["-",x]}),L.length>0&&!V&&e.jsx("button",{type:"button",onClick:()=>f(z?null:p),"aria-label":z?"Cerrar":"Ver ciudades",style:{border:0,background:"transparent",curs
1043or:"pointer",padding:2,color:"var(--text-muted)",flex:"none",display:"inline-flex"},children:e.jsx("svg",{viewBox:"0 0 24 24",width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:z?"rotate(180deg)":"none"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),z&&e.jsx("div",{style:{maxHeight:260,overflowY:"auto",padding:"2px 8px 8px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(160px, 100%), 1fr))",gap:3},children:L.map(G=>{const B=j.has(`${p}|${G}`.toLowerCase());return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,cursor:"pointer",padding:"2px 4px",borderRadius:6,color:B?"var(--danger)":"inherit",background:B?"var(--notice-danger-bg)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:!B,onChange:()=>$(p,G)}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:G})]},G)})})]},p)})}):e.jsx("p",{role:"status",style:{fontSize:12.5,color:"var(--warning)"},children:"Conecta tu cuenta de Dropi de tu paÃs para cargar las zonas."})]})}function aj({value:t,onChange:a,country:n}){const o=$a(),[i,s]=h.useState(null),u=String(n||Rr().code).toUpperCase();h.useEffect(()=>{const w=u==="CO",M=()=>s(w?Object.fromEntries(tj.map(V=>[V,[]])):{});(w?window.fetch("/l-assets/co-geo.json").then(V=>V.json()):o("/api/landing/my-geo?c="+encodeURIComponent(u)).then(V=>V.json())).then(V=>{V&&typeof V=="object"&&Object.keys(V).length?s(V):M()}).catch(M)},[o,u]);const[m,c]=h.useState(null);h.useEffect(()=>{o("/api/landing/payments/status").then(w=>w.json()).then(w=>{w&&w.ok&&c((w.providers||[]).some(M=>M.connected))}).catch(()=>{})},[o]);const g=t&&typeof t=="object"?t:{},f=String(g.mode||"free"),b=Array.isArray(g.zones)?g.zones:[],v=w=>a({...g,...w}),j=i?Object.keys(i).sort((w,M)=>w.localeCompare(M,"es")):[],S=w=>Math.max(0,Math.min(1e8,Math.round(Number(String(w).replace(/[^\d]/g,""))||0))),$=(w,M)=>{const p=b.map((V,L)=>L===w?{...V,...M}:V);v({zones:p})},C={width:"100%",boxSizing:"border-box",padding:"8px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--input-bg, #fff)",color:"inherit",fontSize:13},_=w=>({fontSize:12.5,fontWeight:700,padding:"7px 13px",borderRadius:9,cursor:"pointer",border:w?"1.5px solid var(--accent, #0866ff)":"1px solid var(--border)",background:w?"rgba(8,102,255,.08)":"var(--card-bg, #fff)",color:w?"var(--accent, #0866ff)":"inherit"}),N={fontSize:12,fontWeight:700,padding:"6px 11px",borderRadius:8,cursor:"pointer",border:"1px solid var(--border)",background:"var(--card-bg, #fff)",color:"inherit"};return e.jsxs(ht,{title:"Costo de envÃo",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"2px 0 10px",lineHeight:1.5},children:"Por defecto el envÃo es gratis. Si cobras el flete, se SUMA al total que paga el cliente al recibir (recaudo). El cliente lo ve en el resumen del pedido."}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:[["free","Gratis"],["general","Costo fijo"],["zones","Por zonas"]].map(([w,M])=>e.jsx("button",{type:"button",onClick:()=>v({mode:w}),style:_(f===w),children:M},w))}),f==="general"&&e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12.5,fontWeight:600,marginBottom:5},children:"Costo del envÃo (para todos los pedidos)"}),e.jsx("input",{style:{...C,maxWidth:220},value:g.general_cop?String(g.general_cop):"",onChange:w=>v({general_cop:S(w.target.value)}),placeholder:"Ej: 8000",inputMode:"numeric"})]}),f==="zones"&&e.jsxs("div",{style:{display:"grid",gap:8},children:[b.map((w,M)=>{const p=i&&i[w.dept]||[];return e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("select",{style:{...C,flex:"1 1 130px",cursor:"pointer"},value:w.dept||"",onChange:V=>$(M,{dept:V.target.value,city:""}),children:[e.jsx("option",{value:"",children:"Departamentoâ¦"}),j.map(V=>e.jsx("option",{value:V,children:V},V))]}),e.jsxs("select",{style:{...C,flex:"1 1 130px",cursor:"pointer"},value:w.city||"",onChange:V=>$(M,{city:V.target.value}),children:[e.jsx("option",{value:"",children:"Todo el departamento"}),p.map(V=>e.jsx("option",{value:V,children:V},V))]}),e.jsx("input",{style:{...C,flex:"0 1 110px"}
1043,value:w.price_cop?String(w.price_cop):"",onChange:V=>$(M,{price_cop:S(V.target.value)}),placeholder:"Precio",inputMode:"numeric"}),e.jsxs("label",{title:"En esta ciudad el cliente paga el pedido COMPLETO por adelantado en lÃnea (producto más envÃo). No se le ofrece contraentrega.",style:{display:"flex",alignItems:"center",gap:4,fontSize:11.5,cursor:"pointer",flex:"0 0 auto",color:"var(--text-muted)",whiteSpace:"nowrap"},children:[e.jsx("input",{type:"checkbox",checked:!!w.prepay_required,onChange:V=>$(M,{prepay_required:V.target.checked})})," Paga todo"]}),e.jsx("button",{type:"button",onClick:()=>v({zones:b.filter((V,L)=>L!==M)}),style:{...N,color:"var(--danger)",padding:"6px 10px"},children:"Quitar"})]},M)}),e.jsx("div",{children:e.jsx("button",{type:"button",onClick:()=>v({zones:[...b,{dept:"",city:"",price_cop:0}]}),style:N,children:"+ Agregar zona"})}),b.some(w=>w.prepay_required)&&!g.prepay_shipping&&e.jsxs("div",{style:{marginTop:8,padding:"9px 12px",border:"1px solid rgba(245,158,11,.45)",background:"rgba(245,158,11,.1)",borderRadius:10,fontSize:12,color:"var(--text)",lineHeight:1.45},children:["Marcaste ciudades con ",e.jsx("b",{children:"Paga todo"}),", pero abajo está apagado el cobro por adelantado, asà que por ahora no se aplica. Enciéndelo para que esas ciudades paguen el pedido completo en lÃnea."]}),e.jsxs("div",{style:{marginTop:6,paddingTop:10,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:{display:"block",fontSize:12.5,fontWeight:600,marginBottom:5},children:"Precio para las demás zonas (las que no listaste)"}),e.jsx("input",{style:{...C,maxWidth:220},value:g.zones_default_cop?String(g.zones_default_cop):"",onChange:w=>v({zones_default_cop:S(w.target.value)}),placeholder:"Ej: 15000",inputMode:"numeric"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 2px 0",lineHeight:1.45},children:"Si un cliente elige una zona que no está en la lista, se le cobra este valor. Déjalo en blanco para no cobrar envÃo en esas zonas."})]})]}),f!=="free"&&u==="CO"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",style:{marginTop:3,width:16,height:16,flexShrink:0},checked:!!g.prepay_shipping,onChange:w=>v({prepay_shipping:w.target.checked})}),e.jsxs("span",{children:[e.jsx("b",{style:{fontSize:13},children:"Cobrar por adelantado (Colombia)"}),e.jsxs("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)",marginTop:3,lineHeight:1.45},children:["Enciende dos cosas: en las ciudades marcadas con ",e.jsx("b",{children:"Paga todo"}),", el cliente paga el pedido completo en lÃnea y no ve contraentrega; y en el resto, le aparece la opción de pagar solo el envÃo por adelantado y el producto al recibir. Necesita una pasarela conectada (Bold, Mercado Pago o PayPal)."]})]})]}),g.prepay_shipping&&m===!1&&e.jsxs("div",{role:"status",style:{marginTop:8,padding:"9px 12px",border:"1px solid var(--notice-warning-border)",background:"var(--notice-warning-bg)",borderRadius:10,fontSize:12,color:"var(--notice-warning-text)",lineHeight:1.45},children:["Para cobrar el envÃo por adelantado necesitas una ",e.jsx("b",{children:"pasarela de pago conectada"}),'. Agrégala en "Botones de pago" (Bold, Mercado Pago o PayPal). Mientras no haya, la opción no le aparece al cliente.']})]})]})}const Gp=[{id:"lumy",name:"Lumy Base",accent:"#111827",theme:{page_bg:"#f6f7f9",card_bg:"#ffffff",price_color:"#16a34a",text_color:"#14161d",card_radius:15,cta_radius:10,font:""}},{id:"joyas",name:"JoyerÃa Oro",accent:"#1a1714",theme:{page_bg:"#faf8f4",card_bg:"#ffffff",price_color:"#b08628",text_color:"#1a1714",card_radius:18,cta_radius:26,font:"serif"}},{id:"moda",name:"Moda Minimal",accent:"#000000",theme:{page_bg:"#ffffff",card_bg:"#fafafa",price_color:"#111111",text_color:"#111111",card_radius:8,cta_radius:6,font:"modern"}},{id:"mascotas",name:"Mascotas",accent:"#16a34a",theme:{page_bg:"#f3f9f4",card_bg:"#ffffff",price_color:"#15803d",text_color:"#14241a",card_radius:20,cta_radius:14,font:"rounded"}},{id:"belleza",name:"Belleza Glow",accent:"#be185d",theme:{page_bg:"#fdf6f8",card_bg:"#ffffff",price_color:"#be185d",text_color:"#3b0a23",card_radius:16,cta_radius:12,font:"poppins"}},{id:"hogar",name:"Hogar Cálido",accent:"#c2410c",theme:{page_bg:"#f7f5f1",card_bg:"#ffffff",price_color:"#c2410c",text_color:"#27211c",card_radius:14,cta_radius:10,font:"dmsans"}}
1043,{id:"tech",name:"TecnologÃa",accent:"#2563eb",theme:{page_bg:"#0f1115",card_bg:"#1a1d24",price_color:"#22d3ee",text_color:"#e5e7eb",card_radius:12,cta_radius:8,font:"space"}},{id:"ninos",name:"Niños Festivo",accent:"#2563eb",theme:{page_bg:"#fffaf0",card_bg:"#ffffff",price_color:"#2563eb",text_color:"#1e293b",card_radius:22,cta_radius:16,font:"baloo"}},{id:"salud",name:"Salud",accent:"#0d9488",theme:{page_bg:"#f4faf9",card_bg:"#ffffff",price_color:"#0d9488",text_color:"#134e4a",card_radius:14,cta_radius:10,font:"mulish"}}];function zr({open:t,onToggle:a,title:n,desc:o,children:i,id:s,guia:u}){return e.jsxs("div",{style:Jt,id:s,"data-guia":u,children:[e.jsxs("button",{type:"button","aria-expanded":t,onClick:a,style:{display:"flex",alignItems:"center",gap:10,width:"100%",background:"none",border:"none",padding:0,cursor:"pointer",textAlign:"left",font:"inherit",color:"inherit"},children:[e.jsx("span",{style:{fontSize:14.5,fontWeight:800,flex:1,letterSpacing:"-.01em"},children:n}),e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-muted)",transform:t?"rotate(180deg)":"none",transition:"transform .2s",flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),o&&e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"5px 0 0",lineHeight:1.45},children:o}),t&&e.jsx("div",{style:{marginTop:13},children:i})]})}function rs({children:t}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,margin:"8px 2px 0"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:800,letterSpacing:".05em",textTransform:"uppercase",color:"var(--text-muted)",flexShrink:0},children:t}),e.jsx("span",{style:{flex:1,height:1,background:"var(--border, #e8eaf0)"}})]})}const Ky={mostrar:!1,calificacion:"",cantidad:"",titulo:"",fuente:"",items:[]},k8=t=>({mostrar:!!(t!=null&&t.mostrar),calificacion:t!=null&&t.calificacion?String(t.calificacion).replace(".",","):"",cantidad:t!=null&&t.cantidad?String(t.cantidad):"",titulo:String((t==null?void 0:t.titulo)||""),fuente:String((t==null?void 0:t.fuente)||""),items:(Array.isArray(t==null?void 0:t.items)?t.items:[]).map(a=>({nombre:String((a==null?void 0:a.nombre)||""),ciudad:String((a==null?void 0:a.ciudad)||""),texto:String((a==null?void 0:a.texto)||""),estrellas:Number(a==null?void 0:a.estrellas)>=1&&Number(a==null?void 0:a.estrellas)<=5?Number(a.estrellas):"",verificada:(a==null?void 0:a.verificada)===!0,...a!=null&&a.foto?{foto:String(a.foto)}:{},...a!=null&&a.fecha?{fecha:String(a.fecha)}:{}}))}),nc=t=>({mostrar:t.mostrar,calificacion:t.calificacion.trim(),cantidad:t.cantidad.trim(),titulo:t.titulo.trim(),fuente:t.fuente.trim(),items:t.items.filter(a=>a.texto.trim()||a.foto||a.nombre.trim()).map(a=>({nombre:a.nombre.trim(),ciudad:a.ciudad.trim(),texto:a.texto.trim(),...a.estrellas?{estrellas:a.estrellas}:{},verificada:a.verificada,...a.foto?{foto:a.foto}:{},...a.fecha?{fecha:a.fecha}:{}}))});function Yy({id:t,colecciones:a,enColecciones:n,uploadsEnabled:o,onCerrar:i,onGuardado:s,onEliminado:u,ejecutar:m,onAbrirLanding:c}){var Qt;const g=$a(),[f,b]=h.useState(!!t),[v,j]=h.useState("tienda"),[S,$]=h.useState(""),[C,_]=h.useState(""),[N,w]=h.useState(""),[M,p]=h.useState(""),[V,L]=h.useState(""),[x,z]=h.useState([]),[G,B]=h.useState([]),[U,ne]=h.useState(""),[Q,de]=h.useState(!1),[pe,ce]=h.useState(!1),[ve,ge]=h.useState([]),[Te,ie]=h.useState(!0),[fe,Be]=h.useState(Ky),[We,ze]=h.useState("ninguna"),[tt,Fe]=h.useState(!1),[F,Re]=h.useState(n),[K,I]=h.useState(""),[H,ye]=h.useState(""),[De,Ue]=h.useState(!1),[se,we]=h.useState(""),[Ye,lt]=h.useState(!1),jt=h.useRef(null),[Je,Ct]=h.useState(!1),st=()=>{De||(!Je||window.confirm("¿Cerrar sin guardar? Lo que escribiste en este producto se pierde."))&&i()},la=()=>G.filter($e=>$e.nombre.trim()&&$e.opciones.trim()).map($e=>({nombre:$e.nombre.trim(),opciones:$e.opciones.split(",").map(Pe=>Pe.trim()).filter(Boolean)})),ia=()=>[...F.map($e=>{var Pe;return((Pe=a.find(ue=>ue.id===$e))==null?void 0:Pe.name)||""}
1043),K.trim()].filter(Boolean);h.useEffect(()=>{if(!t){jt.current=null;return}let $e=!0;return g(`/api/landing/store-products/${t}`).then(Pe=>Pe.json()).then(Pe=>{var He;if(!$e)return;if(!(Pe!=null&&Pe.ok)){we((Pe==null?void 0:Pe.message)||"No se pudo abrir el producto."),b(!1);return}const ue=Pe.producto.datos,oe=(ue.variantes||[]).map(ut=>({nombre:ut.nombre,opciones:(ut.opciones||[]).join(", ")})),Ae=k8(Pe.producto.resenas);j(Pe.producto.tipo==="landing"?"landing":"tienda"),$(ue.nombre||""),_(ue.precio?String(ue.precio):""),w(ue.precioAntes?String(ue.precioAntes):""),p(ue.descripcion||""),L(ue.textoDeTienda||""),z(Array.isArray(ue.fotos)?ue.fotos:[]),B(oe),ne(["dropi","mastershop","codigo"].includes(ue.tallasBloqueadas)?ue.tallasBloqueadas:ue.atadoADropi?"dropi":""),de(!!ue.enCodigo),ce(!!ue.borradorPendiente),ie(Pe.producto.sin_centavos!==!1),ge(Array.isArray(ue.ofertas)?ue.ofertas:[]),La(Array.isArray(Pe.producto.ofertas_texto)?Pe.producto.ofertas_texto:[]),Be(Ae),ze(((He=Pe.producto.resenas)==null?void 0:He.estado)||"ninguna"),ye(String(Pe.producto.updated_at||"")),b(!1),jt.current={nombre:String(ue.nombre||"").trim(),precio:ue.precio?String(ue.precio):"",precioAntes:ue.precioAntes?String(ue.precioAntes):"",textoDeTienda:String(ue.textoDeTienda||""),fotos:JSON.stringify(Array.isArray(ue.fotos)?ue.fotos:[]),variantes:JSON.stringify(oe.filter(ut=>ut.nombre.trim()&&ut.opciones.trim()).map(ut=>({nombre:ut.nombre.trim(),opciones:ut.opciones.split(",").map(at=>at.trim()).filter(Boolean)}))),resenas:JSON.stringify(nc(Ae)),categorias:JSON.stringify([...n.map(ut=>{var at;return((at=a.find(dt=>dt.id===ut))==null?void 0:at.name)||""})].filter(Boolean))}}).catch(()=>{$e&&(we("Error de conexión. Intenta de nuevo."),b(!1))}),()=>{$e=!1}},[t,g]),h.useEffect(()=>{const $e=Pe=>{Pe.key==="Escape"&&st()};return window.addEventListener("keydown",$e),()=>window.removeEventListener("keydown",$e)});const ha=!!t&&v==="landing",da=ni().user,Na=ha&&!!(da!=null&&da.es_miembro)&&((Qt=da==null?void 0:da.equipo_modulos)==null?void 0:Qt.landing)!=="editar",[wa,La]=h.useState([]),Gt=()=>{var $e;return JSON.stringify(nc(fe))!==((($e=jt.current)==null?void 0:$e.resenas)??JSON.stringify(nc(Ky)))},he=async()=>{const $e=jt.current;if(!t||!$e)return{ok:!1,message:"No se pudo abrir el producto. Ciérralo y ábrelo de nuevo."};const Pe={};Q||(S.trim()!==$e.nombre&&(Pe.nombre=S.trim()),C.trim()!==$e.precio&&(Pe.precio=C),N.trim()!==$e.precioAntes&&(Pe.precio_antes=N)),JSON.stringify(x)!==$e.fotos&&(Pe.fotos=x),!U&&JSON.stringify(la())!==$e.variantes&&(Pe.variantes=la()),V!==$e.textoDeTienda&&(Pe.texto_de_tienda=V);const ue=Gt(),oe=JSON.stringify(ia())!==$e.categorias;let Ae="",He={},ut=null;if(Object.keys(Pe).length||ue){const dt=await g(`/api/landing/pages/${t}`),Ge=await dt.json().catch(()=>({}));if(!dt.ok||!(Ge!=null&&Ge.ok)||!Ge.page)return{ok:!1,message:"No se pudo abrir la landing de este producto. Intenta de nuevo."};const vt=bA(Ge.page.config||{},Pe,{sinCentavos:Te});if(!vt.ok)return{ok:!1,message:vt.error};if(ut=vt.config,ue){const Pa=AA(nc(fe));if(!Pa.ok)return{ok:!1,message:Pa.error};ut=SA(ut,Pa),Pa.aviso&&(Ae=Pa.aviso)}const Nt=await g(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:ut,expected_updated_at:Ge.page.updated_at})}),sa=await Nt.json().catch(()=>({}));if(!Nt.ok||(sa==null?void 0:sa.ok)===!1)return{ok:!1,message:Nt.status===409?"La landing de este producto cambió en otra pestaña. Cierra y vuelve a abrir el producto.":(sa==null?void 0:sa.message)||"No se pudo guardar. Intenta de nuevo."};if(sa!=null&&sa.borrador)return{ok:!1,message:`Quedó guardado como borrador de su landing, sin publicar: ${String(sa.borrador).replace(/\.?$/,".")} Ãbrela para publicarlo.`}}if(oe){const dt=await g(`/api/landing/store-products/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({categorias:ia()})}),Ge=await dt.json().catch(()=>({}));if(!dt.ok||!(Ge!=null&&Ge.ok))return{ok:!1,message:(Ge==null?void 0:Ge.message)||"El producto se guardó, pero no sus categorÃas. Intenta de nuevo."};He=Ge}const at={id:t,catalogo:!1};if(ut){const dt=ut.product||{};at.name=String(dt.name||"").trim()||S.trim(),at.image=(Array.isArray(dt.images)?dt.images:[]).find(Ge=>typeof Ge=="string"&&/^https?:\/\//i.test(Ge))||"",at.price=Number(dt.price)||0,at.compare=Number(dt.compare_at_price)||0}return{ok:!0,...He,...Ae?{aviso:Ae}:{},producto:at}},Me=async()=>{var Pe;if(we(""),!Q){if(!S.trim()){we("Ponle un nombre al producto.");return}if((!ha||C.trim()!==(((Pe=jt.current)==null?void 0:Pe.precio)??""))&&!(Number(String(C).replace(/[^\d.,]/g,"").replace(/\./g,"").replace(",","."))>0)){we("Ponle un precio mayor que cero.");return}}if(fe.items.find(ue=>ue.nueva&&!ue.texto.trim()&&!ue.foto&&(ue.nombre.trim()||ue.ciudad.trim()))){Fe(!0),we("Cada reseña necesita su texto. EscrÃbelo o quita esa reseña.");return}Ue(!0);try{if(ha){const Ae=await m(he);if(!(Ae!=null&&Ae.ok)){we((Ae==null?void 0:Ae.message)||"No se pudo guardar. Intenta de nuevo.");return}s(Ae.producto,Ae,!1);return}const ue={nombre:S.trim(),precio:C,precio_antes:N,descripcion:M,fotos:x,categorias:ia(),...U?{}:{variantes:la()},...Gt()?{resenas:nc(fe)}:{},...t?{expected_updated_at:H}:{}},oe=await m(async()=>{const Ae=await g(t?`/api/landing/store-products/${t}`:"/api/landing/store-products",{method:t?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)}),He=await Ae.json().catch(()=>({}));return Ae.ok?He:{...He,ok:!1}});if(!(oe!=null&&oe.ok)){we((oe==null?void 0:oe.message)||"No se pudo guardar. Intenta de nuevo.");return}s(oe.producto,oe,!t)}catch{we("Error de conexión. Intenta de nuevo.")}finally{Ue(!1)}},yt=async()=>
1043{if(t){Ue(!0),we("");try{const $e=await m(async()=>{const Pe=await g(`/api/landing/store-products/${t}`,{method:"DELETE"}),ue=await Pe.json().catch(()=>({}));return Pe.ok?ue:{...ue,ok:!1}});if(!($e!=null&&$e.ok)){we(($e==null?void 0:$e.message)||"No se pudo eliminar.");return}u(t,$e)}catch{we("Error de conexión. Intenta de nuevo.")}finally{Ue(!1)}}},kt=($e,Pe)=>Be(ue=>({...ue,items:ue.items.map((oe,Ae)=>Ae===$e?{...oe,...Pe}:oe)})),ct={fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 0",lineHeight:1.45},xt=fe.items.filter($e=>$e.texto.trim()||$e.foto).length,Ut=fe.mostrar?[fe.calificacion?`${fe.calificacion.replace(".",",")} â
`:"",fe.cantidad?`${fe.cantidad} reseñas`:"",`${xt} escrita${xt===1?"":"s"}`].filter(Boolean).join(" · "):"Apagadas: no salen en la tienda.";return Wo.createPortal(e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":t?"Editar producto":"Nuevo producto",onMouseDown:$e=>{$e.target===$e.currentTarget&&st()},onInput:()=>{Je||Ct(!0)},onClickCapture:$e=>{var Pe,ue,oe,Ae;!Je&&((ue=(Pe=$e.target)==null?void 0:Pe.closest)!=null&&ue.call(Pe,'button[aria-pressed], button[type="button"]'))&&!((Ae=(oe=$e.target)==null?void 0:oe.closest)!=null&&Ae.call(oe,"[data-cerrar], [data-sin-cambios]"))&&Ct(!0)},style:{position:"fixed",inset:0,zIndex:1300,background:"rgba(12,16,28,.42)",display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"4vh 12px",overflowY:"auto"},children:e.jsxs("div",{style:{...Jt,width:"100%",maxWidth:580,padding:0,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"15px 18px",borderBottom:"1px solid var(--border, #eef0f4)"},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em"},children:t?"Editar producto":"Nuevo producto de tienda"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)"},children:ha?e.jsxs(e.Fragment,{children:["Tiene su propia landing: lo que cambies aquà también cambia allá.",c&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button","data-cerrar":!0,onClick:()=>{(!Je||window.confirm("¿Ir a su landing sin guardar lo de aquÃ?"))&&c(t)},style:{border:0,background:"none",padding:0,color:me,fontWeight:700,cursor:"pointer",font:"inherit",textDecoration:"underline"},children:"Abrir su landing"})]})]}):"Sale en tu tienda con su vista rápida y se compra en el carrito. No crea una landing."})]}),e.jsx("button",{type:"button","data-cerrar":!0,onClick:st,disabled:De,"aria-label":"Cerrar",style:{...ee,padding:"6px 11px",fontSize:13},children:"Cerrar"})]}),f?e.jsx("div",{style:{padding:28,fontSize:13,color:"var(--text-muted)"},children:"Cargandoâ¦"}):e.jsxs("div",{style:{padding:"6px 18px 18px"},children:[Na&&e.jsx("p",{role:"status",style:{...ct,margin:"10px 0 0",padding:"8px 10px",borderRadius:10,background:"rgba(234,179,8,.12)",color:"var(--text, #1f2937)"},children:"Este producto tiene landing y tu usuario no puede editar landings: aquà solo puedes cambiar sus categorÃas. PÃdele al dueño de la cuenta el permiso de Landing."}),e.jsxs("fieldset",{disabled:Na,style:{border:0,padding:0,margin:0,minWidth:0},children:[pe&&e.jsx("p",{role:"status",style:{...ct,margin:"10px 0 0",padding:"8px 10px",borderRadius:10,background:"rgba(234,179,8,.12)",color:"var(--text, #1f2937)"},children:"Su landing tiene cambios sin publicar en el código. PublÃcalos o descártalos en su editor antes de cambiarla desde aquÃ. Las categorÃas sà se pueden cambiar."}),e.jsx("label",{style:D,children:"Fotos"}),e.jsx(Ru,{values:x,onChange:z,uploadsEnabled:o,uniqueInList:!0}),e.jsxs("p",{style:ct,children:["La primera es la portada de la tarjeta.",ha?"":" Hasta 8."]}),e.jsx("label",{style:D,htmlFor:"pr-nombre",children:"Nombre"}),e.jsx("input",{id:"pr-nombre",style:E,value:S,maxLength:ha?200:80,disabled:Q,onChange:$e=>$($e.target.value),placeholder:"Ej: Blusa de lino manga larga"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(160px, 1fr))",gap:10},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,htmlFor:"pr-precio",children:"Precio"}),e.jsx("input",{id:"pr-precio",style:E,inputMode:"decimal",value:C,disabled:Q,onChange:$e=>_($e.target.value),placeholder:"Ej: 89900"})]}),e.jsxs("div",{children:[e.jsxs("label",{style:D,htmlFor:"pr-antes",children:["Pre
1043cio antes ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(opcional)"})]}),e.jsx("input",{id:"pr-antes",style:E,inputMode:"decimal",value:N,disabled:Q,onChange:$e=>w($e.target.value),placeholder:"Ej: 119900"})]})]}),Q&&e.jsx("p",{style:ct,children:"El nombre y el precio están en el código de su landing: se cambian allá."}),ha&&ve.length>0&&(()=>{const $e=Mg(String(C||""))||0,Pe=$e>0?ve.filter(ue=>ue.precio>$e*ue.cantidad):[];return e.jsxs("p",{style:ct,children:["Ofertas de su landing: ",(wa.length?wa:ve.map(ue=>`${ue.cantidad} por ${ue.precio}`)).join(" · "),". Se cambian en su landing.",Pe.length>0&&e.jsxs("b",{style:{color:"var(--warning, #b45309)"},children:[" Con este precio, la oferta de ",Pe.map(ue=>ue.cantidad).join(" y la de ")," sale más cara que comprarlos sueltos."]})]})})(),ha?e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:D,htmlFor:"pr-texto-tienda",children:["Texto en la tienda ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(opcional)"})]}),e.jsx("textarea",{id:"pr-texto-tienda",style:{...E,minHeight:72,resize:"vertical",fontFamily:"inherit",lineHeight:1.5},maxLength:420,value:V,onChange:$e=>L($e.target.value),placeholder:"Lo que se lee en la vista rápida. VacÃo = la descripción de su landing."})]}):e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,htmlFor:"pr-desc",children:"Descripción"}),e.jsx("textarea",{id:"pr-desc",style:{...E,minHeight:92,resize:"vertical",fontFamily:"inherit",lineHeight:1.5},maxLength:2e3,value:M,onChange:$e=>p($e.target.value),placeholder:"Qué es, de qué está hecho, medidas, cuidadosâ¦"})]}),e.jsxs("label",{style:D,children:["Variantes ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(tallas, coloresâ¦)"})]}),U?e.jsxs("p",{style:ct,children:[U==="codigo"?"Las tallas y colores de este producto están en el código de su landing: se cambian allá.":`Las variantes de este producto están conectadas con ${U==="mastershop"?"Mastershop":"Dropi"} y no se cambian aquÃ.`,G.length>0&&e.jsxs(e.Fragment,{children:[" Hoy: ",G.map($e=>`${$e.nombre}: ${$e.opciones}`).join(" · "),"."]})]}):e.jsxs(e.Fragment,{children:[G.map(($e,Pe)=>e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:8,flexWrap:"wrap"},children:[e.jsx("input",{"aria-label":"Nombre del grupo",style:{...E,flex:"0 1 130px",marginBottom:0},value:$e.nombre,maxLength:40,onChange:ue=>B(oe=>oe.map((Ae,He)=>He===Pe?{...Ae,nombre:ue.target.value}:Ae)),placeholder:"Talla"}),e.jsx("input",{"aria-label":"Opciones separadas por coma",style:{...E,flex:"1 1 200px",marginBottom:0},value:$e.opciones,onChange:ue=>B(oe=>oe.map((Ae,He)=>He===Pe?{...Ae,opciones:ue.target.value}:Ae)),placeholder:"S, M, L, XL"}),e.jsx("button",{type:"button",onClick:()=>B(ue=>ue.filter((oe,Ae)=>Ae!==Pe)),style:{...ee,padding:"7px 11px",fontSize:12},children:"Quitar"})]},Pe)),G.length<4&&e.jsxs("button",{type:"button",onClick:()=>B($e=>[...$e,{nombre:$e.length?"":"Talla",opciones:""}]),style:{...ee,padding:"7px 12px",fontSize:12.5},children:["+ Agregar ",G.length?"otro grupo":"variantes"]}),e.jsx("p",{style:ct,children:"El comprador elige una opción de cada grupo antes de agregar al carrito."})]})]}),e.jsx("label",{style:D,children:"CategorÃas"}),a.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:a.map($e=>{const Pe=F.includes($e.id);return e.jsx("button",{type:"button","aria-pressed":Pe,onClick:()=>Re(ue=>Pe?ue.filter(oe=>oe!==$e.id):[...ue,$e.id]),style:{border:"1.5px solid "+(Pe?me:"var(--border, #dfe3ea)"),background:Pe?"rgba(8,102,255,.08)":"var(--card-bg, #fff)",color:Pe?me:"var(--text, #1f2937)",borderRadius:999,padding:"6px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",font:"inherit"},children:$e.name},$e.id)})}),e.jsx("input",{"aria-label":"Nueva categorÃa",style:E,value:K,maxLength:60,onChange:$e=>I($e.target.value),placeholder:a.length?"O crea una nueva: Ej. Vestidos":"Ej: Vestidos (opcional)"}),e.jsx("fieldset",{disabled:Na,style:{border:0,padding:0,margin:0,minWidth:0},children:e.jsxs("div",{style:{marginTop:16,border:"1px solid var(--border, #e6e9ef)",borderRadius:12,overflow:"hidden"},children:[e.jsxs("button",{type:"button","data-sin-cambios":!0,"aria-expanded":tt,onClick:()=>Fe($e=>!$e),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"11px 12px",background:"var(--input-bg, #f7f8fb)",border:0,cursor:"pointer",font:"inherit",color:"inherit",textAlign:"left"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:800},children:"Reseñas"}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ut}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--text-muted)",transform:tt?"rotate(180deg)":"none",flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),tt&&e.jsxs("div",{style:{padding:"10px 12px 12px"},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,fontWeight:700,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:fe.mostrar,onChange:$e=>Be(Pe=>({...Pe,mostrar:$e.target.checked}))})," Mostrar reseñas en la tienda"]}),We==="ejemplo"&&e.jsx("p",{style:ct,children:"Son las de ejemplo que Lumy pone por defecto. Cámbialas a tu gusto."}),ha&&e.jsx("p",{style:ct,children:"Son las mismas de su landing."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:10,opacity:fe.mostrar?1:.5},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,htmlFor:"pr-calificacion",children:"Calificación (1 a 5)"}),e.jsx("input",{id:"pr-calificacion",style:E,inputMode:"decimal",value:fe.calificacion,onChange:$e=>Be(Pe=>({...Pe,calificacion:$e.target.value})),placeholder:"Ej: 4,8"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,htmlFor:"pr-cantidad",children:"Número de reseñas"}),e.jsx("input",{id:"pr-cantidad",style:E,inputMode:"numeric",value:fe.cantidad,onChange:$e=>Be(Pe=>({...Pe,cantidad:$e.target.value})),placeholder:"Ej: 35"})]})]}),fe.items.map(($e,Pe)=>e.jsxs("div",{style:{border:"1px solid var(--border, #eceff4)",borderRadius:10,padding:8,marginTop:8,background:"var(--card-bg, #fff)",opacity:fe.mostrar?1:.5},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{"aria-label":`Nombre de la reseña ${Pe+1}`,style:{...E,padding:"8px 10px",flex:"1 1 120px",minWidth:0,marginBottom:0},value:$e.nombre,maxLength:80,onChange:ue=>kt(Pe,{nombre:ue.target.value}),placeholder:"Nombre"}),e.jsx("input",{"aria-label":`Ciudad de la reseña ${Pe+1}`,style:{...E,padding:"8px 10px",flex:"1 1 110px",minWidth:0,marginBottom:0},value:$e.ciudad,maxLength:60,onChange:ue=>kt(Pe,{ciudad:ue.target.value}),placeholder:"Ciudad"}),e.jsxs("select",{"aria-label":`Estrellas de la reseña ${Pe+1}`,style:{...E,padding:"7px 6px",width:"auto",marginBottom:0},value:$e.estrellas,onChange:ue=>kt(Pe,{estrellas:ue.target.value?Number(ue.target.value):""}),children:[e.jsx("option",{value:"",children:"Sin estrellas"}),[5,4,3,2,1].map(ue=>e.jsx("option",{value:ue,children:"â
".repeat(ue)},ue))]}),e.jsx("button",{type:"button",onClick:()=>Be(ue=>({...ue,items:ue.items.filter((oe,Ae)=>Ae!==Pe)})),"aria-label":`Quitar la reseña ${Pe+1}`,style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]}),$e.foto&&e.jsx("img",{src:$e.foto,alt:"",style:{display:"block",width:56,height:56,objectFit:"cover",borderRadius:8,marginTop:6}}),e.jsx("textarea",{"aria-label":`Texto de la reseña ${Pe+1}`,style:{...E,minHeight:52,resize:"vertical",marginTop:6,marginBottom:0,fontFamily:"inherit"},maxLength:2e3,value:$e.texto,onChange:ue=>kt(Pe,{texto:ue.target.value}),placeholder:$e.foto?"Lo que dijo el cliente (opcional: tiene foto)":"Lo que dijo el cliente"}),e.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-muted)",marginTop:6,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:$e.verificada,onChange:ue=>kt(Pe,{verificada:ue.target.checked})})," Compra verificada"]})]},Pe)),fe.items.length<100?e.jsx("button",{type:"button",onClick:()=>Be($e=>({...$e,mostrar:!0,items:[...$e.items,{nombre:"",ciudad:"",texto:"",estrellas:5,verificada:!1,nueva:!0}]})),style:{...ee,marginTop:8,padding:"7px 12px",fontSize:12.5},children:"+ Agregar reseña"}):e.jsx("p",{style:ct,children:"Hasta 100 reseñas por producto."})]})]})}),se&&e.jsx("p",{role:"alert",style:{color:"var(--danger)",fontSize:12.5,fontWeight:700,margin:"10px 0 0"},children:se}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:16,flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:Me,disabled:De,style:{...xa,opacity:De?.7:1},children:De?"Guardandoâ¦":t?"Guardar cambios":"Crear producto"}),e.jsx("button",{type:"button","data-cerrar":!0,onClick:st,disabled:De,style:ee,children:"Cancelar"}),t&&!ha&&(Ye?e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8,alignItems:"center",fontSize:12.5},children:["¿Eliminarlo de la tienda?",e.jsx("button",{type:"button",onClick:yt,disabled:De,style:{...ee,padding:"6px 11px",fontSize:12.5,color:"var(--danger)",borderColor:"var(--danger)"},children:"SÃ, eliminar"}),e.jsx("button",{type:"button",onClick:()=>lt(!1),style:{...ee,padding:"6px 11px",fontSize:12.5},children:"No"})]}):e.jsx("button",{type:"button",onClick:()=>lt(!0),disabled:De,style:{...ee,marginLeft:"auto",padding:"8px 12px",fontSize:12.5,color:"var(--danger)"},children:"Eliminar"}))]})]})]})}),document.body)}function Jy({on:t,onToggle:a,compacto:n=!1}){return e.jsxs("button",{type:"button",onClick:a,"aria-pressed":t,title:t?"Salir del inspector (Esc)":"Toca una parte de la vista previa para ir a su ajuste",style:{display:"inline-flex",alignItems:"center",gap:6,padding:n?"5px 11px":"6px 13px",borderRadius:999,cursor:"pointer",font:"inherit",fontSize:12,fontWeight:700,border:"1px solid "+(t?me:"var(--border, #dfe3ea)"),background:t?me:"var(--card-bg, #fff)",color:t?"#fff":"var(--text, #1f2937)",transition:"background .15s ease, color .15s ease"},children:[e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M4 4l7.07 17 2.51-
10437.39L21 11.07z"})}),t?"Inspeccionandoâ¦":"Inspeccionar"]})}const C8=!1;function _8({onModoCodigo:t}={}){var Os,Jn,ii,nr,or,si,Zn,rr,vr,li,Br,qo,di,Mo,Oi,Hs,Wa,Pn,Wr,ir,ci,qr,Dn,us,Bn,$n,sr,no,Hi,Gi,Wn,Un,Pt,yo,lr,Qa,ps,Mr,jr,Ar,gs,ms,Sr,hs,Gs,wn,Io,qn,Fo,Vi,Vs,Oo,cn,To,wr,Ho;const a=$a(),[n,o]=h.useState(""),[i,s]=h.useState(!1),[u,m]=h.useState(""),[c,g]=h.useState(null),[f,b]=h.useState([]),[v,j]=h.useState({cantidad:0,paises:[]}),[S,$]=h.useState(new Set),[C,_]=h.useState(new Set),[N,w]=h.useState(""),[M,p]=h.useState("todos"),[V,L]=h.useState(0),[x,z]=h.useState(null),[G,B]=h.useState(0),[U,ne]=h.useState(!1),[Q,de]=h.useState(()=>{try{return sessionStorage.getItem("lumy_tienda_modo")==="codigo"?"codigo":"visual"}catch{return"visual"}});h.useEffect(()=>{try{sessionStorage.setItem("lumy_tienda_modo",Q)}catch{}},[Q]),h.useEffect(()=>{t==null||t(Q==="codigo")},[Q,t]),h.useEffect(()=>()=>t==null?void 0:t(!1),[t]);const[pe,ce]=h.useState(null),[ve,ge]=h.useState(null),[Te,ie]=h.useState(!1),[fe,Be]=h.useState(!1),[We,ze]=h.useState({cname_target:"",cf:!1}),[tt,Fe]=h.useState([]);h.useEffect(()=>{a("/api/landing/domains").then(k=>k.json()).then(k=>{k!=null&&k.ok&&Fe((k.dominios||[]).filter(Y=>(Y==null?void 0:Y.estado)==="listo").map(Y=>String(Y.dominio)))}).catch(()=>{})},[]);const[F,Re]=h.useState(null),[K,I]=h.useState(""),[H,ye]=h.useState(""),[De,Ue]=h.useState(!1),[se,we]=h.useState(!1),[Ye,lt]=h.useState(null),[jt,Je]=h.useState(""),[Ct,st]=h.useState(new Set(["productos"])),la=k=>st(Y=>{const be=new Set(Y);return be.has(k)?be.delete(k):be.add(k),be});h.useEffect(()=>{const k=Y=>{const be=Y.detail;(be==null?void 0:be.tipo)==="seccion-tienda"&&(st(je=>new Set(je).add(be.seccion)),be.consumido=!0)};return window.addEventListener("lumy:guia-ir",k),()=>window.removeEventListener("lumy:guia-ir",k)},[]);const[ia,ha]=h.useState(!1),da=h.useRef(!1),Na=h.useRef(null),wa=h.useRef(null),La=h.useCallback(k=>{var Y;for(const be of[Na.current,wa.current])try{(Y=be==null?void 0:be.contentWindow)==null||Y.postMessage({lumyInspector:k},"*")}catch{}},[]);h.useEffect(()=>{da.current=ia,La(ia)},[ia,La]),h.useEffect(()=>{if(!ia)return;const k=Y=>{Y.key==="Escape"&&ha(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[ia]);const Gt=h.useRef(Ct);h.useEffect(()=>{Gt.current=Ct},[Ct]);const he=h.useRef(!1);h.useEffect(()=>{const k=["banner","marca","confianza","categorias","productos","carrito","avisos","politicas","diseno","colores","publicar"],Y=je=>{try{je.scrollIntoView({behavior:"smooth",block:"center"}),je.animate([{boxShadow:"0 0 0 0 rgba(8,102,255,0)",outline:"2px solid rgba(8,102,255,0)"},{boxShadow:"0 0 0 4px rgba(8,102,255,.28)",outline:"2px solid rgba(8,102,255,.9)",offset:.25},{boxShadow:"0 0 0 4px rgba(8,102,255,.28)",outline:"2px solid rgba(8,102,255,.9)",offset:.7},{boxShadow:"0 0 0 0 rgba(8,102,255,0)",outline:"2px solid rgba(8,102,255,0)"}],{duration:1700,easing:"ease-in-out"})}catch{}},be=je=>{if(je.origin!==window.location.origin)return;const Ne=je&&je.data&&typeof je.data=="object"?je.data:{},Lt=String(Ne.lumyStoreZone||""),Ke=String(Ne.lumyEditTarget||"");k.includes(Lt)&&da.current&&(ha(!1),he.current&&Pe(!1),st(ft=>ft.has(Lt)?ft:new Set(ft).add(Lt)),/^productos:(search|sort|best_row_off|ship_text|pv_full_link)$/.test(Ke)&&ne(!0),setTimeout(()=>{try{const ft=document.getElementById("st-sec-"+Lt),Xt=Ke?document.querySelector('[data-ins="'+Ke.replace(/"/g,"")+'"]'):null;Xt?Y(Xt):ft&&ft.scrollIntoView({behavior:"smooth",block:"start"})}catch{}},220))};return window.addEventListener("message",be),()=>window.removeEventListener("message",be)},[]);const[Me,yt]=h.useState(!1),[kt,ct]=h.useState(null),xt=h.useRef(void 0);h.useEffect(()=>()=>clearTimeout(xt.current),[]);const[Ut,Qt]=h.useState(()=>typeof window<"u"&&window.matchMedia("(min-width: 1200px)").matches);h.useEffect(()=>{const k=window.matchMedia("(min-width: 1200px)"),Y=()=>Qt(k.matches);return Y(),k.addEventListener("change",Y),()=>k.removeEventListener("change",Y)},[]);const[$e,Pe]=h.useState(!1);h.useEffect(()=>{he.current=$e},[$e]);const[ue,oe]=h.useState(""),[Ae,He]=h.useState(""),ut=Ut||$e,at=h.useMemo(()=>JSON.stringify({...c||{},revision:0}),[c]);h.useEffect(()=>{if(!c||!ut||Q==="codigo")return;let k=!0;const Y=setTimeout(()=>{a("/api/landing/store-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:{...c,order:f.map(be=>be.id),hidden:[...S],elegidos:[...C]}})}).then(be=>be.text()).then(be=>{k&&oe(be)}
1043).catch(()=>{})},800);return()=>{k=!1,clearTimeout(Y)}},[at,f,S,C,ut,a,Q]);const dt=h.useCallback(()=>{gv("tienda").then(()=>a("/api/landing/store")).then(k=>k.json()).then(k=>{var Ne,Lt;if(!k.ok){g({});return}const Y=k.store||{};vt.current=Number(Y.revision)||0,g(k.nueva===!0&&!Y.productos_modo?{...Y,productos_modo:"elegidos"}:Y),sa(!1),_(new Set((Array.isArray(Y.elegidos)?Y.elegidos:[]).map(Ke=>Number(Ke))));const be=Array.isArray(k.products)?k.products.slice():[],je=(Array.isArray((Ne=k.store)==null?void 0:Ne.order)?k.store.order:[]).map(Ke=>Number(Ke));if(je.length){const Ke=new Map(je.map((ft,Xt)=>[Number(ft),Xt]));be.sort((ft,Xt)=>(Ke.has(ft.id)?Ke.get(ft.id):9999)-(Ke.has(Xt.id)?Ke.get(Xt.id):9999))}b(be),j(k.de_otro_pais&&Number(k.de_otro_pais.cantidad)>0?{cantidad:Number(k.de_otro_pais.cantidad),paises:Array.isArray(k.de_otro_pais.paises)?k.de_otro_pais.paises:[]}:{cantidad:0,paises:[]}),$(new Set((Array.isArray((Lt=k.store)==null?void 0:Lt.hidden)?k.store.hidden:[]).map(Ke=>Number(Ke)))),ze(k.domain||{cname_target:"",cf:!1}),k.codigo&&ce(k.codigo)}).catch(()=>g({}))},[a]);h.useEffect(()=>{dt(),a("/api/landing/config").then(k=>k.json()).then(k=>{k&&k.ok&&Be(!!k.uploads)}).catch(()=>{})},[dt,a]);const{token:Ge}=ni(),vt=h.useRef(0),[Nt,sa]=h.useState(!1),Pa=h.useRef(!1);h.useEffect(()=>{Pa.current=Nt},[Nt]);const Ot=h.useRef(null),Ia=h.useRef({store:null,products:[],hidden:new Set,elegidos:new Set});Ia.current={store:c,products:f,hidden:S,elegidos:C};const za="Se guarda al salir del campo.",sn=()=>{if(typeof document>"u"||document.visibilityState==="hidden")return!1;const k=document.activeElement;return!!(k&&Ot.current&&Ot.current.contains(k)&&k.matches("input[type=number], input[inputmode=numeric], input[inputmode=decimal]"))},ba=Wg({esperaMs:1500,clave:"tienda",sesion:()=>Pg()?null:Ge,preparar:()=>{const k=Ia.current;return k.store?Pa.current?{falta:"La tienda cambió en otra pestaña o desde el asistente. Recárgala para seguir guardando."}:sn()?{falta:za}:{cuerpo:{...k.store,order:k.products.map(Y=>Y.id),hidden:[...k.hidden],elegidos:[...k.elegidos]}}:{falta:"Cargando la tiendaâ¦"}},enviar:async(k,Y)=>{const be=await qg(a,"/api/landing/store","PUT",{...k,expected_revision:vt.current},Y);return!be.ok&&be.status===409&&/revision/.test(String(be.codigo||""))&&(Pa.current=!0,sa(!0)),be},alGuardar:(k,{cuerpo:Y,ultima:be})=>{var je,Ne;if(vt.current=Number((je=k==null?void 0:k.store)==null?void 0:je.revision)||vt.current,k!=null&&k.cf&&Re(k.cf),be&&(k!=null&&k.store)?g(k.store):g(Lt=>({...Lt||{},revision:vt.current})),String((Y==null?void 0:Y.custom_css)||"").trim()&&!String(((Ne=k==null?void 0:k.store)==null?void 0:Ne.custom_css)||"").trim())return"Lumy quitó tu CSS (tenÃa algo que no se admite, como red o un cierre de <style>)."}});h.useEffect(()=>{const k=Y=>{var Ne;const be=Y.target,je=Ot.current;!be||!je||!je.contains(be)||(Ne=be.matches)!=null&&Ne.call(be,"input[type=number], input[inputmode=numeric], input[inputmode=decimal]")&&setTimeout(()=>ba.programar(),0)};return document.addEventListener("focusout",k),()=>document.removeEventListener("focusout",k)});const Ga=()=>{ba.marcarEdicion()},Ie=k=>{g(Y=>({...Y||{},...k})),Ga()},ka=Dg(Rr().code),Zo=k=>k.key==="department"&&cv.has(k.label)?{...k,label:ka.l1,placeholder:!k.placeholder||Bu.has(k.placeholder)?ka.l1ph:k.placeholder}:k.key==="city"&&uv.has(k.label)?{...k,label:ka.l2,placeholder:!k.placeholder||Bu.has(k.placeholder)?ka.l2ph:k.placeholder}:k,Cn=Rr().code,Xo=Array.isArray(c==null?void 0:c.addr_removed)?c.addr_removed:[],Nn=O2((c!=null&&c.form_fields&&c.form_fields.length?c.form_fields:td).map(Zo),Cn,Xo),er=k=>{const be=Bg(Cn).map(je=>je.key).filter(je=>Nn.some(Ne=>Ne.key===je)&&!k.some(Ne=>Ne.key===je));Ie({form_fields:k,addr_removed:be.length?Array.from(new Set([...Xo,...be])):Xo})},Oa=()=>Ie({form_fields:td.map(k=>({...k})),addr_removed:[]}),Xa=c&&c.social||{},Kn=k=>Ie({social:{...Xa,...k}}),qa=h.useRef([]),_n=mm((k,Y)=>{const be=qa.current[k],je=qa.current[Y];if(!(be==null||je==null)){if(Va){const Ne=Da.map(Xt=>Number(Xt.id)),Lt=Ne.indexOf(Number(be)),Ke=Ne.indexOf(Number(je));if(Lt<0||Ke<0)return;const[ft]=Ne.splice(Lt,1);Ne.splice(Ke,0,ft),qa.current=qa.current.map(Xt=>Xt===be?je:Xt===je?be:Xt),Hn({order:Ne});return}Ga(),b(Ne=>{const Lt=Ne.findIndex(ea=>ea.id===be),Ke=Ne.findIndex(ea=>ea.id===je);if(Lt<0||Ke<0)return Ne;
1043const ft=Ne.slice(),[Xt]=ft.splice(Lt,1);return ft.splice(Ke,0,Xt),qa.current=qa.current.map(ea=>ea===be?je:ea===je?be:ea),ft})}}),Va=Q==="codigo",mn=c!=null&&c.codigo_productos&&typeof c.codigo_productos=="object"&&!Array.isArray(c.codigo_productos)?c.codigo_productos:null,po=k=>(Array.isArray(k)?k:[]).map(Y=>Number(Y)).filter(Y=>Number.isInteger(Y)&&Y>0),hn={productos_modo:(mn?mn.productos_modo:c==null?void 0:c.productos_modo)==="elegidos"?"elegidos":"todos",hidden:mn?new Set(po(mn.hidden)):S,elegidos:mn?new Set(po(mn.elegidos)):C,order:mn&&po(mn.order).length?po(mn.order):f.map(k=>Number(k.id))},Co=(Va?hn.productos_modo:c==null?void 0:c.productos_modo)==="elegidos",go=Va?{productos_modo:hn.productos_modo,hidden:[...hn.hidden],elegidos:[...hn.elegidos]}:{productos_modo:c==null?void 0:c.productos_modo,hidden:[...S],elegidos:[...C]},fn=wk(go),Da=(()=>{if(!Va)return f;const k=new Map(hn.order.map((Y,be)=>[Y,be]));return f.map((Y,be)=>({p:Y,i:be})).sort((Y,be)=>(k.has(Number(Y.p.id))?k.get(Number(Y.p.id)):1e6+Y.i)-(k.has(Number(be.p.id))?k.get(Number(be.p.id)):1e6+be.i)).map(Y=>Y.p)})(),Hn=k=>Ie({codigo_productos:{productos_modo:hn.productos_modo,hidden:[...hn.hidden],elegidos:[...hn.elegidos],order:hn.order,...k}}),Ra=(k,Y)=>{if(!k.length)return;const be=bg(go,k,Y);if(Va){Hn(be);return}be.elegidos&&_(new Set(be.elegidos)),be.hidden&&$(new Set(be.hidden)),Ga()},ln=k=>Ra([k],!fn(k)),mo=k=>{if(k!==(Co?"elegidos":"todos")){if(Va){Hn(k==="elegidos"?{productos_modo:"elegidos",elegidos:f.filter(Y=>!hn.hidden.has(Y.id)).map(Y=>Y.id)}:{productos_modo:"todos",hidden:f.filter(Y=>!hn.elegidos.has(Y.id)).map(Y=>Y.id)});return}k==="elegidos"?_(new Set(f.filter(Y=>!S.has(Y.id)).map(Y=>Y.id))):$(new Set(f.filter(Y=>!C.has(Y.id)).map(Y=>Y.id))),Ie({productos_modo:k})}},X=async()=>{const k=String((c==null?void 0:c.slug)||""),Y=k?window.open("","_blank"):null;(ba.hayPendiente()?await ba.guardarYa():(await ba.esperar(),!0))&&k&&Y?Y.location.href="/t/"+k:Y&&Y.close()},ae=k=>ba.enCola(async()=>{var je;const Y=vt.current,be=await k();return(je=be==null?void 0:be.tienda)!=null&&je.revision&&(Number(be.tienda.revision)===Y+1?vt.current=Number(be.tienda.revision):(Pa.current=!0,sa(!0))),be}),ot=k=>{!k||Pa.current||(g(Y=>({...Y||{},revision:Number(k.revision)||(Y==null?void 0:Y.revision),collections:Array.isArray(k.collections)?k.collections:Y==null?void 0:Y.collections,...Object.prototype.hasOwnProperty.call(k,"codigo_productos")?{codigo_productos:k.codigo_productos||void 0}:{}})),Array.isArray(k.elegidos)&&_(new Set(k.elegidos.map(Y=>Number(Y)))),Array.isArray(k.hidden)&&$(new Set(k.hidden.map(Y=>Number(Y)))))},it=(k,Y,be)=>{const je={id:k.id};for(const Lt of["slug","name","image","price","compare","catalogo"])Object.prototype.hasOwnProperty.call(k,Lt)&&k[Lt]!==void 0&&(je[Lt]=k[Lt]);be&&(je.catalogo=!0),b(Lt=>be?[je,...Lt.filter(Ke=>Ke.id!==k.id)]:Lt.map(Ke=>Ke.id===k.id?{...Ke,...je}:Ke)),ot(Y==null?void 0:Y.tienda),z(null),B(Lt=>Lt+1);const Ne=Y!=null&&Y.aviso?String(Y.aviso):"";Ne?ye(Ne):(I(be?(Y==null?void 0:Y.en_la_tienda)===!1?"Producto creado â":"Producto creado y agregado a tu tienda â":"Producto guardado â"),setTimeout(()=>I(""),3500))},ma=k=>{z(null);const Y=xj("landing.producto");bj({...(Y==null?void 0:Y.accion)||{tipo:"editor-landing"},landingId:k})},ta=(k,Y)=>{b(be=>be.filter(je=>je.id!==k)),ot(Y==null?void 0:Y.tienda),z(null),B(be=>be+1),I("Producto eliminado de tu tienda â"),setTimeout(()=>I(""),3500)},[pn,Gn]=h.useState(""),[Ln,ho]=h.useState(!1),[tr,fo]=h.useState(""),[Dr,Ba]=h.useState("dropshipper"),[_o,Yn]=h.useState(!1);h.useEffect(()=>{a("/api/landing/dropi-provider-token").then(k=>k.json()).then(k=>{k!=null&&k.ok&&Yn(!!k.connected)}).catch(()=>{})},[]);const yr=async()=>{we(!0),ye(""),I("");try{const Y=await(await a("/api/landing/store-design",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({store_name:(c==null?void 0:c.name)||"",products:f.map(ea=>ea.name).filter(Boolean),items:f.map(ea=>({name:ea.name,price:Number(ea.price)||0})).filter(ea=>ea.name),provider:"openai"})})).json();if(!Y.ok){ye(Y.message||"La IA no pudo diseñar. Intenta de nuevo.");return}const be=Gp.find(ea=>ea.id===Y.template)||Gp[0],je=Y.dynamics,Ne={};if(je){const ea=c||{};!(Number(ea.free_shipping_min)>0)&&Number(je.free_shipping_min)>0&&(Ne.free_shipping_min=Number(je.free_shipping_min)),!(ea.cart_value_discount&&Number(ea.cart_value_discount.min)>0)&&je.value_discount&&Number(je.value_discount.min)>0&&Number(je.value_discount.percent)>0&&(Ne.cart_value_discount={min:Number(je.value_discount.min),percent:Number(je.value_discount.percent)}
1043),!(ea.cart_qty_discount&&Number(ea.cart_qty_discount.min)>0)&&je.qty_discount&&Number(je.qty_discount.min)>1&&Number(je.qty_discount.percent)>0&&(Ne.cart_qty_discount={min:Number(je.qty_discount.min),percent:Number(je.qty_discount.percent)}),!(ea.cart_gift&&Number(ea.cart_gift.min)>0)&&je.gift&&Number(je.gift.min)>0&&String(je.gift.text||"").trim()&&(Ne.cart_gift={min:Number(je.gift.min),text:String(je.gift.text).trim()})}const Lt=c||{},Ke={};if(Y.banner&&(Y.banner.title||Y.banner.subtitle)){const ea=Lt.banner||{};Ke.banner={...ea,title:String(ea.title||"").trim()||Y.banner.title||"",subtitle:String(ea.subtitle||"").trim()||Y.banner.subtitle||"",cta_text:String(ea.cta_text||"").trim()||Y.banner.cta_text||"Ver productos",cta_url:String(ea.cta_url||"").trim()||"#catalogo"}}Y.announcement&&!String(Lt.announcement||"").trim()&&(Ke.announcement=Y.announcement),Y.tagline&&!String(Lt.tagline||"").trim()&&(Ke.tagline=Y.tagline),typeof Y.collection_rows=="boolean"&&Lt.collection_rows===void 0&&(Ke.collection_rows=Y.collection_rows),Ie({accent:Y.accent||be.accent,theme:{...(c==null?void 0:c.theme)||{},...be.theme,...Y.caps?{caps:!0}:{},...Y.font?{font:Y.font==="system"?void 0:Y.font}:{},...Y.card_skin!==void 0?{card_skin:Y.card_skin||void 0}:{},...Y.btn_style?{btn_style:Y.btn_style}:{},...Y.button_color?{button_color:Y.button_color}:{}},...Y.bg_style?{bg_style:Y.bg_style}:{},...Y.bg_fx!==void 0?{bg_fx:Y.bg_fx}:{},...Ke,...Ne});const ft=Object.keys(Ne).length,Xt=Object.keys(Ke).length;I(`Diseño aplicado: ${be.name}${Xt?" + portada armada (banner, cintillo y secciones: edÃtalos abajo)":""}${ft?` + ${ft} oferta${ft>1?"s":""} del carrito (revÃsalas en Carrito y ofertas)`:""} â`),setTimeout(()=>I(""),7e3)}catch{ye("Error de conexión. Intenta de nuevo.")}finally{we(!1)}};if(!c)return e.jsx("div",{style:{padding:22,color:"var(--text-muted)",fontSize:13},children:"Cargandoâ¦"});const $o=String(c.slug||""),ja=$o?`${$o}.lumycol.com`:"",dn=String(c.store_domain||""),ao=dn&&!qi(dn)?dn:ja,Vn=f.filter(k=>fn(k.id)).length,ar=!!(c.accent||c.theme&&typeof c.theme=="object"&&Object.keys(c.theme).length||c.bg_style),q=Number(c.free_shipping_min)>0||Number((Os=c.cart_value_discount)==null?void 0:Os.min)>0&&Number((Jn=c.cart_value_discount)==null?void 0:Jn.percent)>0||Number((ii=c.cart_qty_discount)==null?void 0:ii.min)>0&&Number((nr=c.cart_qty_discount)==null?void 0:nr.percent)>0||Number((or=c.cart_gift)==null?void 0:or.min)>0&&!!String(((si=c.cart_gift)==null?void 0:si.text)||"").trim()||(c.cart_coupons||[]).some(k=>String((k==null?void 0:k.code)||"").trim()&&Number(k==null?void 0:k.percent)>0),te=[{id:"productos",n:"Elige tus productos",done:Vn>0},{id:"marca",n:"Nombre y logo",done:!!(String(c.name||"").trim()&&String(c.logo||"").trim())},{id:"diseno",n:"Diseño",done:ar},{id:"carrito",n:"Ofertas del carrito",done:q},{id:"publicar",n:"Publica",done:!!c.enabled}],ke=te.filter(k=>k.done).length,bt=ke===te.length&&!!c.enabled,oa=k=>{st(Y=>{const be=new Set(Y);return be.add(k),be}),setTimeout(()=>{var Y;try{(Y=document.getElementById("st-sec-"+k))==null||Y.scrollIntoView({behavior:"smooth",block:"start"})}catch{}},60)},wt=Q==="codigo",pt=e.jsx(zr,{id:"st-sec-productos",guia:"tienda.productos",open:Ct.has("productos"),onToggle:()=>la("productos"),title:"Productos en la tienda",desc:f.length?`${Vn} de ${f.length} en tu tienda.`:"Crea un producto o publica una landing para empezar.",children:(()=>{const Y=N.trim().toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,""),be={todos:f.length,visibles:Vn,ocultos:f.length-Vn},je=Da.filter(et=>M==="visibles"&&!fn(et.id)||M==="ocultos"&&fn(et.id)?!1:!Y||String(et.name||"").toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,"").includes(Y)),Ne=Math.max(1,Math.ceil(je.length/12)),Lt=Math.min(V,Ne-1),Ke=je.slice(Lt*12,(Lt+1)*12);qa.current=Ke.map(et=>et.id);const ft=(c.sort||"manual")==="manual"&&!Y,Xt=je.map(et=>et.id),ea=je.filter(et=>!fn(et.id)).length,Ta=je.some(et=>fn(et.id)),Eo=(et,Aa)=>e.jsxs("button",{type:"button","aria-pressed":M===et,onClick:()=>{p(et),L(0)},style:{border:"1px solid "+(M===et?"var(--text, #111827)":"var(--border, #e3e6ec)"),background:M===et?"var(--text, #111827)":"var(--card-bg, #fff)",color:M===et?"var(--card-bg, #fff)":"var(--text, #1f2937)",borderRadius:999,padding:"5px 11px",fontSize:12,fontWeight:700,cursor:"pointer",font:"inherit",whiteSpace:"nowrap"},children:[Aa," ",e.jsx("span",{style:{opacity:.6,fontWeight:600},children:be[et]})]},et);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("div",{role:"radiogroup","aria-label":"Qué productos entran a la tienda",style:{display:"inline-flex",padding:3,borderRadius:11,background:"var(--input-bg, #f1f3f7)",border:"1px solid var(--border, #e6e9ef)"},children:[["elegidos","Solo los que yo elija"],["todos","Todos mis productos"]].map(([et,Aa])=>{const ya=(Co?"elegidos":"todos")===et;return e.jsx("button",{type:"button",role:"radio","aria-checked":ya,onClick:()=>mo(et),style:{border:0,borderRadius:8,padding:"7px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",font:"inherit",background:ya?"var(--card-bg, #fff)":"transparent",color:ya?"var(--text, #111827)":"var(--text-muted)",boxShadow:ya?"0 1px 3px rgba(16,24,40,.14)":"none"},children:Aa},et)})}),e.jsx("button",{type:"button",onClick:()=>z({}),style:{...xa,marginLeft:"auto",padding:"8px 14px",fontSize:13},children:"+ Crear producto"})]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"-4px 0 12px",lineHeight:1.45},children:[Co?"Solo salen los que marques. Lo que publiques después no entra solo.":"Sale todo lo que publiques, menos lo que desmarques. Lo nuevo entra solo.",Va&&e.jsxs(e.Fragment,{children:[" ",e.jsx("b",{style:{color:"var(--text-secondary, #475569)"},children:"Esta lista es solo de tu tienda en código:"}
1043)," el editor visual tiene la suya y cambiar una no toca la otra.",mn&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",onClick:()=>{window.confirm("Tu tienda en código volverá a mostrar los mismos productos que el editor visual. ¿Seguir?")&&Ie({codigo_productos:null})},style:{border:0,background:"none",padding:0,color:me,fontWeight:700,cursor:"pointer",font:"inherit",textDecoration:"underline"},children:"Usar la misma del editor visual"})]})]}),v.cantidad>0&&e.jsxs(e.Fragment,{children:[" ",v.cantidad===1?"Una landing tuya es":`${v.cantidad} landings tuyas son`," de otro paÃs (",v.paises.join(", "),") y no sale",v.cantidad===1?"":"n"," aquÃ: tu tienda vende en una sola moneda, la de tu cuenta."]})]}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"search","aria-label":"Buscar producto",style:{...E,marginBottom:10},value:N,onChange:et=>{w(et.target.value),L(0)},placeholder:"Buscar producto por nombreâ¦"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginBottom:10},children:[Eo("todos","Todos"),Eo("visibles","En la tienda"),Eo("ocultos","Fuera"),e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:6,flexWrap:"wrap"},children:[ea>0&&e.jsx("button",{type:"button",onClick:()=>Ra(Xt,!0),style:{...ee,padding:"5px 10px",fontSize:12},children:Y||M!=="todos"?`Marcar estos ${je.length}`:`Marcar los ${je.length}`}),Ta&&e.jsx("button",{type:"button",onClick:()=>Ra(Xt,!1),style:{...ee,padding:"5px 10px",fontSize:12},children:Y||M!=="todos"?"Quitar estos":"Quitar todos"})]})]}),e.jsx("style",{children:` 1044 .lk-prow{display:flex;align-items:center;gap:10px;padding:8px 10px;background:var(--card-bg,#fff)} 1045 .lk-pthumb{width:44px;height:44px;border-radius:9px;flex-shrink:0;background-color:#f1f2f5;background-size:cover;background-position:center} 1046 .lk-pinfo{flex:1;min-width:0} 1047 .lk-pname{font-size:13px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} 1048 .lk-pmeta{font-size:11.5px;color:var(--text-muted);display:flex;gap:6px;align-items:baseline;flex-wrap:wrap;margin-top:1px} 1049 .lk-pact-s{display:none} 1050 @media (max-width:560px){ 1051 .lk-prow{gap:8px;padding:8px 6px} 1052 .lk-pthumb{width:40px;height:40px} 1053 .lk-pact-l{display:none}.lk-pact-s{display:inline} 1054 } 1055 `}),e.jsxs("div",{style:{border:"1px solid var(--border, #e8eaf0)",borderRadius:12,overflow:"hidden"},children:[Ke.length===0&&e.jsx("div",{style:{padding:"18px 14px",fontSize:12.5,color:"var(--text-muted)",textAlign:"center"},children:Y?"Ningún producto se llama asÃ.":M==="visibles"?"TodavÃa no hay productos en tu tienda. Márcalos en «Todos».":"No hay productos fuera de la tienda."}),Ke.map((et,Aa)=>{const ya=fn(et.id);return e.jsx(h.Fragment,{children:e.jsxs("div",{"data-dragidx":Aa,className:"lk-prow"+(_n.dragIdx===Aa?" lk-dragging":""),style:{borderTop:Aa?"1px solid var(--border, #f0f2f6)":"none"},children:[ft&&e.jsx(hm,{onStart:kr=>_n.start(Aa,kr),onOver:_n.over,onEnd:_n.end}),e.jsx("input",{type:"checkbox",checked:ya,onChange:()=>ln(et.id),"aria-label":`${et.name}: ${ya?"en la tienda":"fuera de la tienda"}`,style:{width:17,height:17,flexShrink:0,accentColor:me,cursor:"pointer"}}),e.jsx("div",{className:"lk-pthumb",style:{backgroundImage:et.image?`url('${et.image}')`:"none",opacity:ya?1:.55}}),e.jsxs("div",{className:"lk-pinfo",children:[e.jsx("div",{className:"lk-pname",style:{color:ya?"var(--text, #111827)":"var(--text-muted)"},children:et.name}),e.jsxs("div",{className:"lk-pmeta",children:[et.price>0&&e.jsx("span",{children:"$"+Number(et.price).toLocaleString("es-CO")}),et.compare>et.price&&e.jsx("s",{style:{opacity:.7},children:"$"+Number(et.compare).toLocaleString("es-CO")}),e.jsx("span",{style:{fontWeight:700,color:ya?me:"var(--text-muted)"},children:ya?"En la tienda":"Fuera"}),e.jsxs("span",{children:["· ",et.catalogo?"Solo tienda":"Con landing"]})]})]}),e.jsx("button",{type:"button",style:{...ee,padding:"5px 10px",fontSize:11.5,flex:"none"},onClick:()=>z({id:et.id}),children:"Editar"})]})},et.id)})]}),Ne>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:10,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)"},children:[Lt*12+1,"â",Math.min(je.length,(Lt+1)*12)," de ",je.length]}),e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("button",{type:"button",disabled:Lt===0,onClick:()=>L(Lt-1),style:{...ee,padding:"5px 11px",fontSize:12,opacity:Lt===0?.45:1},children:"â¹ Anterior"}),e.jsxs("span",{style:{fontSize:12,fontWeight:700,minWidth:70,textAlign:"center"},children:["Página ",Lt+1," de ",Ne]}),e.jsx("button",{type:"button",disabled:Lt>=Ne-1,onClick:()=>L(Lt+1),style:{...ee,padding:"5px 11px",fontSize:12,opacity:Lt>=Ne-1?.45:1},children:"Siguiente âº"})]})]}),!ft&&(c.sort||"manual")==="manual"&&e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"8px 2px 0"},children:"Para ordenar arrastrando, borra la búsqueda."})]}),!f.length&&e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",padding:"6px 2px 2px"},children:"TodavÃa no tienes productos. Crea uno aquà mismo, sin landing, o publica una landing."}),e.jsxs("div",{style:{marginTop:14,borderTop:"1px solid var(--border, #eef0f4)"},children:[e.jsxs("button",{type:"button","aria-expanded":U,onClick:()=>ne(et=>!et),style:{display:"flex",alignItems:"center",gap:8,width:"100%",border:0,background:"none",padding:"11px 2px",cursor:"pointer",font:"inherit",color:"inherit",textAlign:"left"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,flex:1},children:"Cómo se ve el catálogo"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:wt?"Orden y vista rápida":"Orden, buscador, vista rápida"}),e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:U?"rotate(180deg)":"none",transition:"transform .15s ease",color:"var(--text-muted)"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),U&&e.jsxs("div",{style:{paddingBottom:6},children:[!wt&&e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",ga
1055p:8,cursor:"pointer",marginBottom:12},children:[e.jsx("input",{type:"checkbox",style:{marginTop:3},checked:c.product_preview!==!1,onChange:et=>Ie({product_preview:et.target.checked})}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,display:"block"},children:'Vista rápida al tocar "Ver oferta" (recomendado)'}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",lineHeight:1.45},children:"Abre una hoja con fotos, variantes y botones de compra sin salir del catálogo."})]})]}),(wt||c.product_preview!==!1)&&e.jsxs("label",{"data-ins":"productos:pv_full_link",style:{display:"flex",alignItems:"flex-start",gap:8,cursor:"pointer",marginBottom:12,marginLeft:wt?0:22},children:[e.jsx("input",{type:"checkbox",style:{marginTop:3},checked:c.pv_full_link===!0,onChange:et=>Ie({pv_full_link:et.target.checked})}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,display:"block"},children:"Mostrar «Ver página completa» en la vista rápida"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",lineHeight:1.45},children:"Lleva a la landing del producto. Apagado por defecto; los productos de tienda nunca lo muestran."})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-muted)"},children:"Orden del catálogo"}),e.jsxs("select",{"data-ins":"productos:sort",style:{...E,width:"auto",marginBottom:0,padding:"7px 10px",fontSize:13},value:c.sort||"manual",onChange:et=>Ie({sort:et.target.value}),children:[e.jsx("option",{value:"manual",children:"Manual (arrastras en la lista)"}),e.jsx("option",{value:"ventas",children:"Más vendidos primero"}),e.jsx("option",{value:"nuevos",children:"Más nuevos primero"})]})]}),!wt&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-ins":"productos:search",style:{display:"grid",gap:6,marginBottom:10,padding:"10px 12px",border:"1px solid var(--border)",borderRadius:10},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!c.search_off,onChange:et=>Ie({search_off:!et.target.checked})}),e.jsx("span",{style:{fontSize:12.5,fontWeight:700},children:"Mostrar el buscador (con más de 2 productos)"})]}),!c.search_off&&e.jsx("input",{style:{...E,marginBottom:0},value:c.search_placeholder||"",onChange:et=>Ie({search_placeholder:et.target.value.slice(0,60)}),placeholder:"Texto del buscador. Ej: Buscar productoâ¦"})]}),e.jsxs("label",{"data-ins":"productos:best_row_off",style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",marginBottom:10},children:[e.jsx("input",{type:"checkbox",checked:!c.best_row_off,onChange:et=>Ie({best_row_off:!et.target.checked})}),e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:'Mostrar la fila "Los más vendidos" arriba del catálogo'})]}),e.jsxs("div",{"data-ins":"productos:ship_text",style:{display:"grid",gap:4,marginBottom:4},children:[e.jsx("label",{style:D,children:"Pastilla de envÃo en cada producto (vacÃo = ocultarla)"}),e.jsx("input",{style:{...E,marginBottom:0},value:c.ship_text!==void 0?c.ship_text:"EnvÃo a todo el paÃs",onChange:et=>Ie({ship_text:et.target.value.slice(0,40)}),placeholder:"Ej: EnvÃo a todo el paÃs"})]})]})]})]}),C8,e.jsxs("div",{style:{borderTop:"1px solid var(--border, #eef0f4)"},children:[e.jsxs("button",{type:"button","aria-expanded":Te,onClick:()=>ie(et=>!et),style:{display:"flex",alignItems:"center",gap:8,width:"100%",border:0,background:"none",padding:"11px 2px 4px",cursor:"pointer",font:"inherit",color:"inherit",textAlign:"left"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,flex:1},children:"Traer mi tienda de Shopify"}),e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:Te?"rotate(180deg)":"none",transition:"transform .15s ease",color:"var(--text-muted)"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),Te&&e.jsxs("div",{style:{paddingTop:6},children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Pega el link de tu tienda Shopify y dejamos tu tienda lista: traemos hasta 60 productos (precio, tachado, fotos, variantes y descripción), las categorÃas de tu menú, las fotos de portada, tus redes, tus polÃticas y páginas como Sobre nosotros. Publicamos lo completo; lo que quede sin precio o sin fotos entra como borrador."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("input",{style:{...E,flex:"1 1 220px",marginBottom:0},value:n,onChange:et=>o(et.target.value),placeholder:"mitienda.myshopify.com o tudominio.com"}),e.jsx("button",{style:{...xa,whiteSpace:"nowrap"},disabled:i||!n.trim(),onClick:async()=>{s(!0),m("");try{const Aa=await(await a("/api/landing/import-shopify-store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:n.trim()})})).json();if(Aa!=null&&Aa.ok){const ya=Aa.store||{},kr=[ya.categorias?`${ya.categorias} categorÃa${ya.categorias!==1?"s":""}`:"",ya.fotos_portada>1?`${ya.fotos_portada} fotos de portada`:ya.fotos_portada?"foto de portada":"",ya.redes?`${ya.redes} red${ya.redes!==1?"es":""}
1055`:"",ya.politicas?"tus polÃticas y páginas":""].filter(Boolean).join(", ").replace(/, ([^,]*)$/," y $1");m(`Listo: ${Aa.count} producto${Aa.count!==1?"s":""} importado${Aa.count!==1?"s":""}: ${Aa.published||0} publicado${Aa.published!==1?"s":""} en tu tienda${Aa.drafts?` y ${Aa.drafts} en borrador (les falta precio o foto)`:""}${kr?`, con ${kr}`:""}. Mira tu tienda en la pestaña Tienda.`),dt()}else m((Aa==null?void 0:Aa.message)||"No se pudo importar.")}catch{m("Error de conexión. Intenta de nuevo.")}finally{s(!1)}},children:i?"Importandoâ¦":"Importar"})]}),u&&e.jsx("p",{role:"status",style:{fontSize:12,fontWeight:700,margin:"8px 0 0",color:u.startsWith("Listo")?"var(--success)":"var(--danger)"},children:u})]})]})]})})()}),Zt=e.jsxs(zr,{id:"st-sec-categorias",guia:"tienda.categorias",open:Ct.has("categorias"),onToggle:()=>la("categorias"),title:"CategorÃas",desc:"Agrupa productos (Anillos, Cadenasâ¦) como filtros arriba del catálogo. Opcional.",children:[(c.collections||[]).map((k,Y)=>{var Ke;const be=Array.isArray(k.product_ids)?k.product_ids:[],je=Ye===k.id,Ne=jt.trim().toLowerCase(),Lt=je?f.filter(ft=>!Ne||String(ft.name||"").toLowerCase().includes(Ne)):[];return e.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",padding:10},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:k.name||"",placeholder:"Ej: Anillos",onChange:ft=>{const Xt=[...c.collections||[]];Xt[Y]={...Xt[Y],name:ft.target.value},Ie({collections:Xt})}}),e.jsx(So,{field:"Nombre de categorÃa de la tienda",instruction:"Nombre de categorÃa corto, 1 a 2 palabras, claro para el comprador. Sin emojis",current:k.name||"",productName:((Ke=f[0])==null?void 0:Ke.name)||"",onPick:ft=>{const Xt=[...c.collections||[]];Xt[Y]={...Xt[Y],name:ft},Ie({collections:Xt})}}),e.jsxs("button",{type:"button",onClick:()=>{lt(je?null:k.id),Je("")},style:{...ee,padding:"6px 11px",flexShrink:0,fontWeight:700,whiteSpace:"nowrap"},title:"Asignar productos",children:[be.length," ",be.length===1?"producto":"productos"," ",je?"â²":"â¼"]}),e.jsx("button",{onClick:()=>{je&<(null),Ie({collections:(c.collections||[]).filter((ft,Xt)=>Xt!==Y)})},style:{...ee,padding:"6px 11px",color:"var(--danger)",flexShrink:0},children:"Quitar"})]}),je&&e.jsxs("div",{style:{borderTop:"1px solid var(--border)",padding:10},children:[e.jsxs("div",{style:{marginBottom:10},children:[e.jsx(Rn,{label:"Foto de la categorÃa (opcional)",value:k.image||"",uploadsEnabled:fe,compact:!0,onChange:ft=>{const Xt=[...c.collections||[]];Xt[Y]={...Xt[Y],image:ft},Ie({collections:Xt})}}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 0 0",lineHeight:1.45},children:"Si la dejas vacÃa, tu tienda usa la foto del producto más vendido de esta categorÃa. Se ve mejor una foto donde se use el producto que el producto solo."})]}),f.length>6&&e.jsx("input",{style:{...E,marginBottom:8},value:jt,placeholder:"Buscar productoâ¦",onChange:ft=>Je(ft.target.value)}),f.length>0&&e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:8},children:[e.jsx("button",{type:"button",onClick:()=>{const ft=[...c.collections||[]];ft[Y]={...ft[Y],product_ids:f.map(Xt=>Xt.id)},Ie({collections:ft})},style:{...ee,fontSize:11.5,padding:"4px 10px"},children:"Seleccionar todos"}),e.jsx("button",{type:"button",onClick:()=>{const ft=[...c.collections||[]];ft[Y]={...ft[Y],product_ids:[]},Ie({collections:ft})},style:{...ee,fontSize:11.5,padding:"4px 10px"},children:"Ninguno"})]}),e.jsxs("div",{style:{display:"grid",gap:3,maxHeight:320,overflowY:"auto"},children:[Lt.map(ft=>{const Xt=be.includes(ft.id);return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"5px 4px",borderRadius:8,cursor:"pointer",background:Xt?"rgba(8,102,255,.06)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:Xt,onChange:()=>{const ea=[...c.collections||[]],Ta=new Set(ea[Y].product_ids||[]);Xt?Ta.delete(ft.id):Ta.add(ft.id),ea[Y]={...ea[Y],product_ids:[...Ta]},Ie({collections:ea})},style:{width:16,height:16,flexShrink:0}}),e.jsx("div",{style:{width:32,height:32,borderRadius:6,flexShrink:0,background:"#f1f2f5",backgroundImage:ft.image?`url('${ft.image}')`:"none",backgroundSize:"cover",backgroundPosition:"center"}}),e.jsx("div",{style:{fontSize:12.5,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:ft.name})]},ft.id)}),!f.length&&e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Publica productos para asignarlos."}),f.length>0&&!Lt.length&&e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Sin resultados."})]})]})]},k.id)}),e.jsx("button",{onClick:()=>Ie({collections:[...c.collections||[],{id:"c"+Date.now().toString(36),name:"",product_ids:[]}]}),style:{...ee,fontSize:13},children:"+ Agregar categorÃa"}),!wt&&(c.collections||[]).length>0&&e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",ga
1055p:10,marginTop:14,padding:12,border:"1px solid var(--border)",borderRadius:10,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",style:{marginTop:3,width:16,height:16,flexShrink:0},checked:c.collection_rows===!0,onChange:k=>Ie({collection_rows:k.target.checked})}),e.jsxs("span",{children:[e.jsx("b",{style:{fontSize:13.5},"data-ins":"categorias:collection_rows",children:"Mostrar como filas deslizables (estilo Shopify)"}),e.jsx("span",{style:{display:"block",fontSize:12,color:"var(--text-muted)",marginTop:3,lineHeight:1.45},children:"Cada categorÃa se ve como una fila que se desliza, con su tÃtulo. Apagado: grilla con filtros arriba."})]})]})]}),At=e.jsxs(zr,{id:"st-sec-marca",guia:"tienda.marca",open:Ct.has("marca"),onToggle:()=>la("marca"),title:wt?"Marca y WhatsApp":"Marca",desc:wt?"Nombre, frase, anuncio, logo y tu WhatsApp. Tu código los usa con {{tienda.nombre}}, {{tienda.frase}}, {{tienda.anuncio}}, la foto tienda.logo y data-lumy-whatsapp.":"Nombre, logo, frase, cintillo y redes. Es lo que ve el cliente arriba.",children:[!wt&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,"data-ins":"marca:header_style",children:"Estilo de encabezado"}),e.jsx("div",{style:{marginBottom:6},children:e.jsx(jn,{small:!0,options:[{v:"clasico",l:"Clásico"},{v:"membrete",l:"Membrete"},{v:"sangre",l:"Portada"},{v:"perfil",l:"Perfil"},{v:"tarjeta",l:"Tarjeta"},{v:"cuenta",l:"Cuenta atrás"},{v:"remate",l:"Remate"}],value:c.header_style||"clasico",onPick:k=>Ie({header_style:k})})}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 14px",lineHeight:1.45},children:'Cambia la forma del bloque de arriba de tu tienda. "Clásico" es el de siempre; los demás dan otra cara para tu nicho (mira la vista previa).'}),e.jsxs("div",{style:{borderRadius:12,overflow:"hidden",border:"1px solid var(--border,#e8eaf0)",marginBottom:14},children:[!!String(c.announcement||"").trim()&&e.jsx("div",{style:{background:c.accent||"#111827",color:"#fff",fontSize:10.5,fontWeight:700,textAlign:"center",padding:"5px 8px",letterSpacing:".02em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.announcement}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"11px 13px",background:"var(--card-bg,#fff)"},children:[c.logo?e.jsx("img",{src:c.logo,alt:"",style:{width:34,height:34,borderRadius:8,objectFit:"cover",flexShrink:0}}):e.jsx("span",{style:{width:34,height:34,borderRadius:8,flexShrink:0,background:"var(--input-bg,#eef1f6)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:14,fontWeight:800},children:String(c.name||"T").slice(0,1).toUpperCase()}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:14.5,fontWeight:800,letterSpacing:"-.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name||"Tu marca"}),!!String(c.tagline||"").trim()&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.tagline})]})]})]})]}),e.jsxs("div",{"data-ins":"marca:name",children:[e.jsx(Ea,{ai:{field:"Nombre de la tienda",instruction:'Marca corta y memorable, 1 a 3 palabras, sin la palabra "tienda" ni nada generico',current:c.name||"",productName:((Zn=f[0])==null?void 0:Zn.name)||"",onPick:k=>Ie({name:k})},children:"Nombre de tu tienda"}),e.jsx("input",{style:E,value:c.name||"",onChange:k=>Ie({name:k.target.value}),placeholder:"Ej: Bella Importados"}),!wt&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",margin:"2px 0 6px"},children:[e.jsx("input",{type:"checkbox",checked:!!((rr=c.theme)!=null&&rr.caps),onChange:k=>Ie({theme:{...c.theme||{},caps:k.target.checked}})}),e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:"Nombre y productos en MAYÃSCULAS"})]})]}),e.jsxs("div",{"data-ins":"marca:tagline",children:[e.jsx(Ea,{ai:{field:"Frase corta de la tienda (debajo del nombre)",instruction:"Una frase de 4 a 7 palabras que da confianza y vende: beneficio + pago contraentrega. Sin emojis",current:c.tagline||"",productName:((vr=f[0])==null?void 0:vr.name)||"",onPick:k=>Ie({tagline:k})},children:"Frase corta (debajo del nombre)"}),e.jsx("input",{style:E,value:c.tagline||"",onChange:k=>Ie({tagline:k.target.value}),placeholder:"Ej: Detalles que enamoran, pago al recibir"})]}),e.jsxs("div",{"data-ins":"marca:announcement",children:[e.jsx(Ea,{ai:{field:"Cintillo de beneficios (banner superior)",instruction:'Tres beneficios cortos separados por punto medio, ej "Pago contraentrega · Envio gratis · Garantia". Sin emojis',current:c.announcement||"",productName:((li=f[0])==null?void 0:li.name)||"",onPick:k=>Ie({announcement:k})},children:"Cintillo superior (la barra de arriba)"}),e.jsx("input",{style:E,value:c.announcement||"",onChange:k=>Ie({announcement:k.target.value}),placeholder:"Pago contraentrega · EnvÃo gratis · GarantÃa"}),!wt&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"2px 0 8px"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Color del cintillo"}),e.jsx("input",{type:"color",value:((Br=c.theme)==null?void 0:Br.ann_color)||"#14161d",onChange:k=>Ie({theme:{...c.theme||{},ann_color:k.target.value}}),style:{width:46,height:30,border:"1px solid var(--border)",borderRadius:7,background:"none",cursor:"pointer"}})]})]}),!wt&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Botón de link en el encabezado (opcional, sale junto a tus redes)"}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},"data-ins":"marca:header_link",children:[e.jsx("input",{style:{...E,flex:"1 1 140px",minWidth:120},value:((qo=c.header_link)==null?void 0:qo.text)||"",onChange:k=>Ie({header_link:{...c.header_link||{},text:k.target.value.slice(0,30)}}),placeholder:"Texto. Ej: Catálogo 2026"}
1055),e.jsx("input",{style:{...E,flex:"2 1 200px",minWidth:160},value:((di=c.header_link)==null?void 0:di.url)||"",onChange:k=>Ie({header_link:{...c.header_link||{},url:k.target.value}}),placeholder:"https://..."})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 8px"},children:"Se ve solo si tu tienda tiene banner y logo (encabezado de perfil). VacÃo = no aparece."})]}),e.jsx("div",{style:{marginTop:10},"data-ins":"marca:logo",children:e.jsx(Rn,{label:"Logo de la tienda",value:c.logo||"",onChange:k=>Ie({logo:k}),uploadsEnabled:fe,compact:!0})}),e.jsxs("div",{style:{marginTop:14,paddingTop:13,borderTop:"1px solid var(--border)"},"data-ins":"marca:social",children:[e.jsx("label",{style:D,children:wt?"Tu WhatsApp (el de data-lumy-whatsapp y «Pedir por WhatsApp» del carrito)":"Redes (opcional)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:9},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"#25D366",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2a10 10 0 00-8.6 15l-1.3 4.9 5-1.3A10 10 0 1012 2zm0 2a8 8 0 11-4.1 14.9l-.3-.2-2.6.7.7-2.6-.2-.3A8 8 0 0112 4zm-3 3.4c-.2 0-.5.1-.7.4-.3.3-.9.9-.9 2.1s.9 2.4 1 2.6c.1.2 1.7 2.8 4.3 3.8 2.1.8 2.6.7 3 .6.5 0 1.4-.6 1.6-1.1.2-.6.2-1 .1-1.1l-.7-.3s-1.5-.7-1.7-.8c-.2-.1-.4-.1-.6.1l-.8 1c-.1.2-.3.2-.5.1-.3-.1-1.1-.4-2-1.2-.8-.7-1.3-1.5-1.4-1.8-.2-.3 0-.4.1-.5l.4-.5.2-.4v-.4l-.8-1.9c-.2-.4-.3-.4-.5-.4h-.4z"})})}),e.jsx("input",{style:{...E,marginBottom:0},value:Xa.wa||"",onChange:k=>Kn({wa:k.target.value}),placeholder:"WhatsApp (https://wa.me/57...)"})]}),!wt&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:9},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"5"}),e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("circle",{cx:"17.5",cy:"6.5",r:"1.2",fill:"currentColor",stroke:"none"})]})}),e.jsx("input",{style:{...E,marginBottom:0},value:Xa.ig||"",onChange:k=>Kn({ig:k.target.value}),placeholder:"Instagram (https://instagram.com/...)"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:9},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"#010101",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M16 3v3.2a5 5 0 003 1v3a8 8 0 01-3-.9V16a5.5 5.5 0 11-5.5-5.5l.5.03v3.1a2.5 2.5 0 102 2.45V3z"})})}),e.jsx("input",{style:{...E,marginBottom:0},value:Xa.tk||"",onChange:k=>Kn({tk:k.target.value}),placeholder:"TikTok (https://tiktok.com/@...)"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:9},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"#1877F2",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M13.5 21v-7h2.4l.4-3h-2.8V9.1c0-.9.3-1.5 1.6-1.5h1.4V4.9c-.3 0-1.2-.1-2.2-.1-2.2 0-3.8 1.4-3.8 3.9V11H8v3h2.5v7z"})})}),e.jsx("input",{style:{...E,marginBottom:0},value:Xa.fb||"",onChange:k=>Kn({fb:k.target.value}),placeholder:"Facebook (https://facebook.com/...)"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"#E60023",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"
1055currentColor",children:e.jsx("path",{d:"M12 2a10 10 0 00-3.8 19.3c-.1-.8-.2-2.1 0-3l1.2-5.1s-.3-.6-.3-1.5c0-1.4.8-2.5 1.9-2.5.9 0 1.3.7 1.3 1.5 0 .9-.6 2.2-.9 3.4-.2 1 .5 1.9 1.6 1.9 1.9 0 3.3-2 3.3-4.8 0-2.5-1.8-4.3-4.4-4.3-3 0-4.8 2.3-4.8 4.6 0 .9.4 1.9.8 2.4a.3.3 0 01.1.3l-.3 1.2c0 .2-.2.3-.4.2-1.2-.6-2-2.4-2-3.8 0-3.1 2.3-6 6.5-6 3.4 0 6.1 2.4 6.1 5.7 0 3.4-2.2 6.2-5.2 6.2-1 0-2-.5-2.3-1.1l-.6 2.4c-.2.9-.8 1.9-1.2 2.6A10 10 0 1012 2z"})})}),e.jsx("input",{style:{...E,marginBottom:0},value:Xa.pin||"",onChange:k=>Kn({pin:k.target.value}),placeholder:"Pinterest (https://pinterest.com/...)"})]})]})]})]}),Et=e.jsxs(zr,{id:"st-sec-colores",guia:"tienda.colores",open:Ct.has("colores"),onToggle:()=>la("colores"),title:wt?"Colores del carrito":"Colores y botón",desc:wt?"Aplican a lo que pone Lumy: el carrito, la vista rápida y los avisos. Tu vitrina la pintas con tu CSS.":"Afina colores, forma y los textos de los botones.",children:[e.jsx("label",{style:D,children:"Colores"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(110px, 100%), 1fr))",gap:10},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"General (marca)"}),e.jsx("input",{type:"color",value:c.accent||"#111827",onChange:k=>Ie({accent:k.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{"data-ins":"colores:button_color",children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Botón"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Mo=c.theme)==null?void 0:Mo.button_color)||c.accent||"#111827",onChange:k=>Ie({theme:{...c.theme||{},button_color:k.target.value}}),style:{width:44,height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(Oi=c.theme)!=null&&Oi.button_color?e.jsx("button",{type:"button",onClick:()=>Ie({theme:{...c.theme||{},button_color:""}}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):null]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Texto del botón"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Hs=c.theme)==null?void 0:Hs.cta_text_color)||"#ffffff",onChange:k=>Ie({theme:{...c.theme||{},cta_text_color:k.target.value}}),style:{width:44,height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(Wa=c.theme)!=null&&Wa.cta_text_color?e.jsx("button",{type:"button",onClick:()=>Ie({theme:{...c.theme||{},cta_text_color:""}}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):null]})]}),!wt&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Fondo página"}),e.jsx("input",{type:"color",value:((Pn=c.theme)==null?void 0:Pn.page_bg)||"#f6f7f9",onChange:k=>Ie({theme:{...c.theme||{},page_bg:k.target.value}}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),!wt&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Fondo tarjetas"}),e.jsx("input",{type:"color",value:((Wr=c.theme)==null?void 0:Wr.card_bg)||"#ffffff",onChange:k=>Ie({theme:{...c.theme||{},card_bg:k.target.value}}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{"data-ins":"colores:price_color",children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Precio"}),e.jsx("input",{type:"color",value:((ir=c.theme)==null?void 0:ir.price_color)||"#16a34a",onChange:k=>Ie({theme:{...c.theme||{},price_color:k.target.value}}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginTop:12},children:[!wt&&e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Redondez de tarjetas"}),e.jsx("input",{type:"range",min:0,max:40,value:((ci=c.theme)==null?void 0:ci.card_radius)??
105515,onChange:k=>Ie({theme:{...c.theme||{},card_radius:Number(k.target.value)}}),style:{width:"100%",accentColor:me}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Redondez del botón"}),e.jsx("input",{type:"range",min:0,max:40,value:((qr=c.theme)==null?void 0:qr.cta_radius)??10,onChange:k=>Ie({theme:{...c.theme||{},cta_radius:Number(k.target.value)}}),style:{width:"100%",accentColor:me}})]})]}),e.jsx("label",{style:{...D,marginTop:12},children:"Estilo del botón"}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[{k:"solid",n:"Relleno"},{k:"gradient",n:"Gradiente"},{k:"outline",n:"Contorno"},{k:"soft",n:"Con sombra"}].map(k=>{var be;const Y=(((be=c.theme)==null?void 0:be.btn_style)||"solid")===k.k;return e.jsx("button",{type:"button",onClick:()=>Ie({theme:{...c.theme||{},btn_style:k.k}}),style:{fontSize:12,fontWeight:700,padding:"7px 13px",borderRadius:9,border:Y?`1.5px solid ${me}`:"1px solid var(--border)",background:Y?"rgba(8,102,255,.08)":"var(--card-bg, #fff)",color:Y?me:"var(--text, #111)",cursor:"pointer"},children:k.n},k.k)})}),e.jsxs("div",{style:{marginTop:14,paddingTop:13,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Textos de los botones"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:12},children:[!wt&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:5},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flex:1},"data-ins":"colores:cta_text",children:"Botón de producto"}),e.jsx(So,{field:"Texto del botón de producto",instruction:"Llamado a la acción corto, 1 a 3 palabras: Ver oferta, Lo quiero, Comprar ya. Sin emojis",current:c.cta_text||"",productName:((Dn=f[0])==null?void 0:Dn.name)||"",onPick:k=>Ie({cta_text:k})})]}),e.jsx("input",{style:{...E,marginBottom:0},value:c.cta_text||"",onChange:k=>Ie({cta_text:k.target.value}),placeholder:"Ver oferta",maxLength:28})]}),!wt&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:5},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flex:1},"data-ins":"colores:add_text",children:"Agregar al carrito"}),e.jsx(So,{field:"Texto del botón de agregar al carrito",instruction:"Acción corta para sumar al carrito, 1 a 3 palabras: Agregar, Lo quiero, Al carrito. Sin emojis",current:c.add_text||"",productName:((us=f[0])==null?void 0:us.name)||"",onPick:k=>Ie({add_text:k})})]}),e.jsx("input",{style:{...E,marginBottom:0},value:c.add_text||"",onChange:k=>Ie({add_text:k.target.value}),placeholder:"Agregar al carrito",maxLength:28})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:5},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flex:1},children:"Botón de la plaquita"}),e.jsx(So,{field:"Texto del botón de la plaquita de felicitación y avisos",instruction:"Acción corta y positiva para cerrar la plaquita, 2 a 3 palabras: ¡Seguir comprando!, Ver más, ¡Sigamos!. Sin emojis",current:c.win_btn||"",productName:((Bn=f[0])==null?void 0:Bn.name)||"",onPick:k=>Ie({win_btn:k})})]}),e.jsx("input",{style:{...E,marginBottom:0},value:c.win_btn||"",onChange:k=>Ie({win_btn:k.target.value}),placeholder:"¡Seguir comprando!",maxLength:28})]})]})]}),!wt&&e.jsxs("div",{style:{marginTop:14,paddingTop:13,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,"data-ins":"colores:custom_css",children:"CSS personalizado (avanzado, opcional)"}),e.jsx("textarea",{style:{...E,minHeight:64,resize:"vertical",fontFamily:"monospace",fontSize:12},value:c.custom_css||"",onChange:k=>Ie({custom_css:k.target.value}),placeholder:".pc-n{ text-transform: uppercase }"})]})]}),xo=e.jsxs(zr,{id:"st-sec-carrito",guia:"tienda.carrito",open:Ct.has("carrito"),onToggle:()=>la("carrito"),title:"Carrito y ofertas",desc:"Carrito multi-producto, envÃo gratis, descuentos, regalo y pago en lÃnea.",children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:10,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",style:{marginTop:3},checked:!!c.cart_enabled,onChange:k=>Ie({cart_enabled:k.target.checked})}),e.jsxs("span",{"data-ins":"carrito:cart_enabled",children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:800,display:"block"},children:"Activar carrito"}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.45},children:"Tus clientes juntan varios productos y los piden juntos. El checkout crea el pedido en Dropi automático."})]})]}),c.cart_enabled&&e.jsxs("div",{style:{marginTop:12},children:[e.jsx("label",{style:D,children:"EnvÃo gratis desde (opcional)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:14,color:"var(--text-muted)",fontWeight:700},children:"$"}),e.jsx("input",{style:E,type:"number",min:0,value:c.free_shipping_min||"",onChange:k=>Ie({free_shipping_min:Math.max(0,Math.round(Number(k.target.value)||0))}),placeholder:"Ej: 60000"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0",lineHeight:1.45},children:'Muestra la barra "te faltan $X para envÃo gratis". VacÃo o 0 = no aparece.'}),e.jsx("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},"data-ins":"carrito:shipping",children:e.jsx(aj,{value:c.shipping,onChange:k=>Ie({shipping:k})})}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Botones del carrito"}
1055),e.jsxs("select",{style:E,value:c.cart_flow||"form",onChange:k=>Ie({cart_flow:k.target.value}),children:[e.jsx("option",{value:"form",children:"Completo: Continuar pedido (contraentrega) + Pedir por WhatsApp"}),e.jsx("option",{value:"directo",children:"Directo: solo Pagar en lÃnea + Pedir por WhatsApp (sin formulario contraentrega)"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0",lineHeight:1.45},children:"Directo cierra el pedido por WhatsApp o pago en lÃnea (sin formulario). Requiere tu WhatsApp y, para pagar, una pasarela conectada."})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Campos del formulario del pedido"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 10px",lineHeight:1.45},children:["Quita, reordena o edita cada campo del checkout. ",e.jsx("b",{children:"Nombre, teléfono, dirección, departamento y ciudad"})," los necesita Dropi para el envÃo."]}),e.jsx(ej,{natLen:br(Cn).natLen,fields:Nn,onChange:er,onRestore:Oa,uploadsEnabled:fe,productName:(($n=f[0])==null?void 0:$n.name)||""})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Pedido mÃnimo (opcional)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontSize:14,color:"var(--text-muted)",fontWeight:700},children:"$"}),e.jsx("input",{style:E,type:"number",min:0,value:c.cart_min_total||"",onChange:k=>Ie({cart_min_total:Math.max(0,Math.round(Number(k.target.value)||0))}),placeholder:"Ej: 40000"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0",lineHeight:1.45},children:"Por debajo de este monto no se puede confirmar el pedido (protege tu flete). VacÃo o 0 = sin mÃnimo."})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Cupones de descuento (opcional, máximo 10)"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:"El cliente escribe el código en el carrito. Ãtil para pauta y recuperar carritos. Se aplica el mayor, no se acumulan."}),(c.cart_coupons||[]).map((k,Y)=>e.jsxs(h.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:6},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1,minWidth:0,textTransform:"uppercase"},value:k.code||"",onChange:be=>Ie({cart_coupons:(c.cart_coupons||[]).map((je,Ne)=>Ne===Y?{...je,code:be.target.value.toUpperCase().replace(/[^A-Z0-9-]/g,"").slice(0,20)}:je)}),placeholder:"Ej: BIENVENIDO10"}),e.jsx("input",{style:{...E,marginBottom:0,width:64,textAlign:"center"},type:"number",min:1,max:90,value:k.percent||"",onChange:be=>Ie({cart_coupons:(c.cart_coupons||[]).map((je,Ne)=>Ne===Y?{...je,percent:Math.max(0,Math.min(90,Math.round(Number(be.target.value)||0)))}:je)}),placeholder:"%",title:"Porcentaje de descuento"}),e.jsx("input",{style:{...E,marginBottom:0,width:96},type:"number",min:0,value:k.min||"",onChange:be=>Ie({cart_coupons:(c.cart_coupons||[]).map((je,Ne)=>Ne===Y?{...je,min:Math.max(0,Math.round(Number(be.target.value)||0))}:je)}),placeholder:"MÃn $",title:"Compra mÃnima para usarlo (opcional)"}),e.jsx("button",{onClick:()=>Ie({cart_coupons:(c.cart_coupons||[]).filter((be,je)=>je!==Y)}),title:"Quitar",style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]}),!!String(k.code||"").trim()&&Number(k.percent)>0&&!!ao&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"-2px 0 10px",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",style:{...ee,fontSize:11.5,padding:"4px 10px"},onClick:()=>{var be;try{(be=navigator.clipboard)==null||be.writeText(`https://${ao}/?cupon=${k.code}`)}catch{}ct(Y),clearTimeout(xt.current),xt.current=setTimeout(()=>ct(je=>je===Y?null:je),1600)},children:kt===Y?"Link copiado â":"Copiar link con cupón"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Quien abra el link llega a tu tienda con el cupón ya aplicad
1055o."})]})]},Y)),(c.cart_coupons||[]).length<10&&e.jsx("button",{style:{...ee,fontSize:12.5},onClick:()=>Ie({cart_coupons:[...c.cart_coupons||[],{code:"",percent:10,min:0}]}),children:"+ Agregar cupón"})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Plaquita de felicitación (al alcanzar una meta)"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:"Plaquita con confeti al llegar al envÃo gratis. VacÃo = el texto de siempre."}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:6},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:c.cart_win_title||"",onChange:k=>Ie({cart_win_title:k.target.value}),placeholder:"TÃtulo â Ej: ¡Genial!",maxLength:60}),e.jsx(So,{field:"TÃtulo de la plaquita de felicitación",instruction:"Exclamación corta y alegre de 1 a 2 palabras, ej ¡Genial!, ¡Listo!, ¡Vas bien!. Sin emojis",current:c.cart_win_title||"",productName:((sr=f[0])==null?void 0:sr.name)||"",onPick:k=>Ie({cart_win_title:k})})]}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:c.cart_win_msg||"",onChange:k=>Ie({cart_win_msg:k.target.value}),placeholder:"Mensaje â Ej: Ya tienes envÃo GRATIS en tu pedido.",maxLength:140}),e.jsx(So,{field:"Mensaje de la plaquita de felicitación",instruction:"Frase corta que celebra el beneficio logrado (envÃo gratis, descuento, regalo), 5 a 9 palabras, sin emojis",current:c.cart_win_msg||"",productName:((no=f[0])==null?void 0:no.name)||"",onPick:k=>Ie({cart_win_msg:k})})]})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},"data-ins":"carrito:cart_done_msg",children:[e.jsx("label",{style:D,children:'Mensaje al terminar el pedido ("¡Pedido recibido!")'}),e.jsx("input",{style:{...E,marginBottom:0},value:c.cart_done_msg||"",onChange:k=>Ie({cart_done_msg:k.target.value.slice(0,200)}),placeholder:"Te contactaremos para confirmar la entrega. Pagas cuando lo recibas.",maxLength:200}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 2px 0",lineHeight:1.45},children:"Lo que ve el cliente al confirmar su compra. VacÃo = el mensaje de siempre."})]}),!wt&&e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},"data-ins":"carrito:pay_badge_text",children:[e.jsx("label",{style:D,children:"Texto de la pastilla de pago (junto al nombre, arriba)"}),e.jsx("input",{style:{...E,marginBottom:0},value:c.pay_badge_text||"",onChange:k=>Ie({pay_badge_text:k.target.value.slice(0,40)}),placeholder:"VacÃo = automático (Pago contraentrega / Paga en casa o en lÃnea)",maxLength:40})]}),e.jsxs("label",{"data-ins":"carrito:cart_fx_off",style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("input",{type:"checkbox",checked:!c.cart_fx_off,onChange:k=>Ie({cart_fx_off:!k.target.checked})}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,display:"block"},children:"Efectos del carrito"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",lineHeight:1.45},children:"Confeti al comprar, la foto que vuela al carrito y los avisos que llaman la atención. Apágalos para una tienda más sobria."})]})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Descuento por valor de compra (opcional)"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:"Gasta el monto, se baja ese % del total. Real: también baja el cobro contraentrega."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"Gasta desde $"}),e.jsx("input",{style:{...E,marginBottom:0},type:"number",min:0,value:((Hi=c.cart_value_discount)==null?void 0:Hi.min)||"",onChange:k=>Ie({cart_value_discount:{...c.cart_value_discount||{},min:Math.max(0,Math.round(Number(k.target.value)||0))}}),placeholder:"120000"})]}),e.jsxs("div",{style:{width:86},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"% off"}),e.jsx("input",{style:{...E,marginBottom:0},type:"number",min:0,max:90,value:((Gi=c.cart_value_discount)==null?void 0:Gi.percent)||"",onChange:k=>Ie({cart_value_discount:{...c.cart_value_discount||{},percent:Math.max(0,Math.min(90,Math.round(Number(k.target.value)||0)))}}),placeholder:"10"})]})]})]}),e.jsxs("div",{style:{marginTop:12},children:[e.jsx("label",{style:D,children:"Descuento por cantidad de productos (opcional)"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:"Lleva esa cantidad o más, se baja ese %. Si aplican los dos, se usa el mayor (no se suman)."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"Lleva desde (productos)"}),e.jsx("input",{style:{...E,marginBottom:0},type:"number",min:0,value:((Wn=c.cart_qty_discount)==null?void 0:Wn.min)||"",onChange:k=>Ie({cart_qty_discount:{...c.cart_qty_discount||{},min:Math.max(0,Math.floor(Number(k.target.value)||0))}}),placeholder:"3"})]}),e.jsxs("div",{style:{width:86},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"% off"}),e.jsx("input",{style:{...E,marginBottom:0},type:"number",min:0,max:90,value:((Un=c.cart_qty_discount)==null?void 0:Un.percent)||"",onChange:k=>Ie({cart_qty_discount:{...c.cart_qty_discount||{},percent:Math.max(0,Math.min(90,Math.round(Number(k.target.value)||0)))}}),placeholder:"15"})]})]})]}),e.jsxs("div",{style:{marginTop:12},children:[e.jsx("label",{style:D,children:"Regalo por monto (opcional)"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:"Gasta el monto, le prometes un regalo. Aparece en la barra del carrito y en las notas."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-end"},children:[e.jsxs("div",{style:{width:130},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"Gasta desde $"}),e.jsx("input",{style:{...E,marginBottom:0},type:"number",min:0,value:((Pt=c.cart_gift)==null?void 0:Pt.min)||"",onChange:k=>Ie({cart_gift:{...c.cart_gift||{},min:Math.max(0,Math.round(Number(k.target.value)||0))}}),placeholder:"150000"})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:2},children:"Regalo"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:((yo=c.cart_gift)==null?void 0:yo.text)||"",onChange:k=>Ie({cart_gift:{...c.cart_gift||{},text:k.target.value}}),placeholder:"Ej: Un anillo de regalo",maxLength:80}),e.jsx(So,{field:"Regalo por compra",instruction:"Nombre corto y atractivo de un regalo u obsequio, 2 a 4 palabras, sin emojis",current:((lr=c.cart_gift)==null?void 0:lr.text)||"",productName:((Qa=f[0])==null?void 0:Qa.name)||"",onPick:k=>Ie({cart_gift:{...c.cart_gift||{},text:k}})})]})]})]})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Pago en lÃnea (pago anticipado)"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.45},children:["Botones de Bold / Mercado Pago en el carrito. Primero conecta tu cuenta en ",e.jsx("b",{children:"Landing â Pagos"})," (la plata cae directo a ti)."]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:6},children:[e.jsx("input",{type:"checkbox",checked:!!((ps=c.payment_methods)!=null&&ps.bold),onChange:k=>Ie({payment_methods:{...c.payment_methods||{},bold:k.target.checked}})})," Mostrar Bold"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:6},children:[e.jsx("input",{type:"checkbox",checked:!!((Mr=c.payment_methods)!=null&&Mr.mercadopago),onChange:k=>Ie({payment_methods:{...c.payment_methods||{},mercadopago:k.target.checked}})})," Mostrar Mercado Pago"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((jr=c.payment_methods)!=null&&jr.paypal),onChange:k=>Ie({payment_methods:{...c.payment_methods||{},paypal:k.target.checked}})})," Mostrar PayPal (México y cuentas en dólares)"]})]})]})]}),Ma=e.jsxs(zr,{id:"st-sec-avisos",guia:"tienda.avisos",open:Ct.has("avisos"),onToggle:()=>la("avisos"),title:"Avisos por tiempo",desc:"Hasta 3 plaquitas que salen tras X segundos. Cada una con su color, botón y link.",children:[(c.time_alerts||[]).map((k,Y)=>{var be;return e.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,padding:10,marginBottom:8,display:"grid",gap:7},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flexShrink:0},children:"A los"}),e.jsx("input",{type:"number",min:3,max:600,value:k.seconds??"",onChange:je=>{const Ne=[...c.time_alerts||[]],Lt=je.target.value;Ne[Y]={...Ne[Y],seconds:Lt===""?void 0:Math.round(Number(Lt)||0)},Ie({time_alerts:Ne})},onBlur:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],seconds:Math.max(3,Math.min(600,Math.round(Number(je.target.value)||15)))},Ie({time_alerts:Ne})},placeholder:"15",className:"lk-secs",style:{...E,width:72,marginBottom:0,flexShrink:0,textAlign:"center",paddingLeft:6,paddingRight:6}}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flexShrink:0},children:"seg"}),e.jsx("span",{style:{flex:1}}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flexShrink:0},children:"Color"}),e.jsx("input",{type:"color",value:k.color||"#111827",onChange:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],color:je.target.value},Ie({time_alerts:Ne})},title:"Color del aviso (icono y botón)",style:{width:36,height:34,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),e.jsx("button",{type:"button",onClick:()=>Ie({time_alerts:(c.time_alerts||[]).filter((je,Ne)=>Ne!==Y)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flexShrink:0}
1055,children:"Quitar"})]}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:k.text||"",onChange:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],text:je.target.value},Ie({time_alerts:Ne})},placeholder:"Mensaje â Ej: ¡EnvÃo gratis hoy! Aprovecha",maxLength:120}),e.jsx(So,{field:"Aviso por tiempo de la tienda",instruction:"Mensaje corto y persuasivo que empuja la compra (envÃo gratis, oferta, urgencia suave), 4 a 8 palabras, sin emojis",current:k.text||"",productName:((be=f[0])==null?void 0:be.name)||"",onPick:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],text:je},Ie({time_alerts:Ne})}})]}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1,minWidth:110},value:k.btn||"",onChange:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],btn:je.target.value},Ie({time_alerts:Ne})},placeholder:"Texto del botón â Ej: Ver oferta",maxLength:28}),e.jsx("input",{style:{...E,marginBottom:0,flex:2,minWidth:150},value:k.link||"",onChange:je=>{const Ne=[...c.time_alerts||[]];Ne[Y]={...Ne[Y],link:je.target.value},Ie({time_alerts:Ne})},placeholder:"Link al tocar el botón (opcional) â https://...",maxLength:400})]})]},Y)}),(c.time_alerts||[]).length<3&&e.jsx("button",{type:"button",onClick:()=>Ie({time_alerts:[...c.time_alerts||[],{seconds:15,text:""}]}),style:{...ee,fontSize:12.5},children:"+ Agregar aviso"})]}),en=e.jsxs(zr,{id:"st-sec-politicas",guia:"tienda.politicas",open:Ct.has("politicas"),onToggle:()=>la("politicas"),title:"Páginas y polÃticas",desc:"Las secciones del pie de página (envÃos, cambios, sobre nosotrosâ¦). VacÃo = las polÃticas estándar de tu paÃs.",children:[!wt&&e.jsxs("div",{"data-ins":"politicas:footer_reassure",style:{display:"grid",gap:4,marginBottom:12},children:[e.jsx("label",{style:D,children:"Franja de reaseguro del pie (vacÃo = ocultarla)"}),e.jsx("input",{style:{...E,marginBottom:0},value:c.footer_reassure!==void 0?c.footer_reassure:"Pago 100% contraentrega: pagas cuando recibes tu pedido en la puerta de tu casa.",onChange:k=>Ie({footer_reassure:k.target.value.slice(0,160)}),placeholder:"Pago 100% contraentrega: pagas cuando recibes tu pedidoâ¦",maxLength:160})]}),e.jsxs("div",{"data-ins":"politicas:track_pay_note",style:{marginBottom:12},children:[e.jsx("label",{style:D,children:"Mensaje del rastreo (página de seguimiento del pedido)"}),e.jsx("input",{style:E,value:c.track_pay_note||"",onChange:k=>Ie({track_pay_note:k.target.value}),placeholder:"Guarda este link y vuelve para seguir tu pedido y saber cuándo llega.",maxLength:160}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 2px 0",lineHeight:1.45},children:"Lo que ve el cliente abajo cuando rastrea su pedido. Déjalo vacÃo para usar el de siempre."})]}),(c.policies||[]).map((k,Y)=>e.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:12,padding:12,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:8},children:[e.jsx("input",{style:{...E,marginBottom:0,flex:1,fontWeight:700},value:k.title||"",onChange:be=>{const je=[...c.policies||[]];je[Y]={...je[Y],title:be.target.value.slice(0,60)},Ie({policies:je})},placeholder:"TÃtulo (ej: PolÃtica de envÃos)"}),e.jsx("button",{type:"button",onClick:()=>Ie({policies:(c.policies||[]).filter((be,je)=>je!==Y)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flexShrink:0},children:"Quitar"})]}),e.jsx("textarea",{style:{...E,minHeight:92,resize:"vertical",marginBottom:0},value:k.content||"",onChange:be=>{const je=[...c.policies||[]];je[Y]={...je[Y],content:be.target.value.slice(0,6e3)},Ie({policies:je})},placeholder:"El texto que ve el cliente al abrirla desde el pie de página"})]},Y)),(c.policies||[]).length<8&&e.jsx("button",{type:"button",onClick:()=>Ie({policies:[...c.policies||[],{title:"",content:""}]}),style:{...ee,fontSize:12.5},children:"+ Agregar página"}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"8px 2px 0",lineHeight:1.45},children:"Aquà van tus polÃticas y páginas (Sobre nosotros, Preguntas frecuentesâ¦). Una página sin tÃtulo o sin texto no se guarda."})]}),bo=e.jsxs(zr,{id:"st-sec-publicar",guia:"tienda.publicar",open:Ct.has("publicar"),onToggle:()=>la("publicar"),title:"Publicar y dirección",desc:"Prende tu tienda y elige su link (gratis o tu propio dominio).",children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:11,cursor:"pointer",marginBottom:14,background:c.enabled?"rgba(22,163,74,.07)":"var(--input-bg,#f4f6fa)",border:"1px solid "+(c.enabled?"rgba(22,163,74,.28)":"var(--border,#e8eaf0)"),borderRadius:12,padding:"11px 13px",transition:"background .2s"},children:[e.jsxs("span",{style:{position:"relative",width:42,he
1055ight:24,borderRadius:999,background:c.enabled?"#16a34a":"var(--border,#cdd2dd)",transition:"background .2s",flexShrink:0},children:[e.jsx("input",{type:"checkbox",checked:!!c.enabled,onChange:k=>Ie({enabled:k.target.checked}),style:{position:"absolute",inset:0,opacity:0,width:"100%",height:"100%",margin:0,cursor:"pointer"}}),e.jsx("span",{style:{position:"absolute",top:3,left:c.enabled?21:3,width:18,height:18,borderRadius:"50%",background:"#fff",transition:"left .2s cubic-bezier(.22,.61,.36,1)",boxShadow:"0 1px 3px rgba(0,0,0,.28)"}})]}),e.jsx("span",{style:{fontWeight:800,fontSize:13.5},children:c.enabled?"Tienda publicada":"Publicar mi tienda"})]}),!!c.enabled&&f.length===0&&e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"flex-start",gap:8,background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:10,padding:"9px 12px",margin:"-4px 0 14px",fontSize:12,color:"var(--notice-warning-text)",lineHeight:1.45},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,marginTop:1},children:[e.jsx("path",{d:"M10.3 3.9L1.8 18a2 2 0 001.7 3h17a2 2 0 001.7-3L13.7 3.9a2 2 0 00-3.4 0z"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("path",{d:"M12 17h.01"})]}),e.jsxs("span",{children:["Tu tienda quedará publicada sin productos. ",e.jsx("button",{type:"button",onClick:()=>oa("productos"),style:{border:"none",background:"none",padding:0,cursor:"pointer",font:"inherit",fontWeight:800,color:"var(--notice-warning-text)",textDecoration:"underline"},children:"Trae tus productos"})," primero para no quemar visitas."]})]}),!(dn&&!qi(dn))&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Dirección gratis de tu tienda"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5},children:[e.jsx("input",{style:{...E,flex:1},value:ve??$o,onChange:k=>ge(k.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),onBlur:()=>{ve!==null&&ve!==$o&&Ie({slug:ve}),ge(null)},onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur()},placeholder:"tumarca"}),e.jsx("span",{style:{fontSize:13,color:"var(--text-muted)",whiteSpace:"nowrap"},children:".lumycol.com"})]}),ja&&e.jsxs("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:[e.jsx("button",{type:"button",style:{...ee,fontSize:12.5},onClick:()=>{var k;try{(k=navigator.clipboard)==null||k.writeText("https://"+ja)}catch{}Ue(!0),setTimeout(()=>Ue(!1),1500)},children:De?"Copiado â":"Copiar link"}),e.jsxs("span",{style:{fontSize:11.5,color:"var(--text-muted)",alignSelf:"center"},children:["También en lumycol.com/t/",$o]})]})]}),e.jsxs("div",{style:{marginTop:14,paddingTop:13,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Tu propio dominio (opcional)"}),e.jsxs("select",{style:{...E,cursor:"pointer"},value:dn||"",onChange:k=>Ie({store_domain:k.target.value}),children:[e.jsx("option",{value:"",children:"La dirección gratis de Lumy"}),dn&&!tt.includes(dn)&&e.jsx("option",{value:dn,children:dn}),tt.map(k=>e.jsx("option",{value:k,children:k},k))]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:8,lineHeight:1.5},children:tt.length===0?e.jsxs(e.Fragment,{children:["TodavÃa no tienes ningún dominio listo. Conéctalo en ",e.jsx("b",{children:"PÃxeles â Dominio propio"})," y cuando diga ",e.jsx("b",{children:"Listo"})," aparecerá aquÃ."]}):e.jsxs(e.Fragment,{children:["Aquà solo salen los dominios que ya están listos. Para conectar uno nuevo, ve a ",e.jsx("b",{children:"PÃxeles â Dominio propio"}),"."]})}),F&&e.jsx("div",{role:"status",style:{fontSize:12,marginTop:8,fontWeight:600,color:F.registered?"var(--warning)":"var(--danger)"},children:F.registered?`Dominio registrado. Candado: ${F.ssl_status||F.status||"pendiente"} (automático).`:`No se pudo registrar: ${F.error||"intenta de nuevo"}.`})]})]});return wt?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{maxWidth:1400,margin:"0 auto"},children:e.jsx(ak,{onVolver:()=>de("visual"),onPublicado:k=>ce(Y=>({hay_borrador:!0,sin_publicar:!1,...Y||{},activo:k})),versionDeLaTienda:`${Number(c.revision)||0}·${G}`,configEnVivo:c,tiendaEnVivo:{dominioPropio:dn&&!qi(dn)?dn:"",direccion:ao?"https://"+ao:"",prendida:!!c.enabled},guardarAjustes:async()=>Pa.current?!1:ba.hayPendiente()?await ba.guardarYa():(await ba.esperar(),!0),avisosDeLaTienda:K||H||Nt?e.jsxs("div",{role:H||Nt?"alert":"status",style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",padding:"9px 12px",marginBottom:10,borderRadius:14,border:`1px solid ${H||Nt?"var(--danger, #dc2626)":"var(--border, #e8eaf0)"}`,background:"var(--card-bg, #fff)",fontSize:12.5,fontWeight:600,color:H||Nt?"var(--danger, #dc2626)":"var(--success, #0b7a4b)"},children:[e.jsx("span",{style:{flex:"1 1 240px"}
1055,children:Nt?"La tienda cambió en otra pestaña o desde el asistente. Recárgala para seguir: lo que cambiaste en «Tu tienda» después de eso no se guardó.":H||K}),Nt?e.jsx("button",{type:"button",onClick:()=>dt(),style:{...ee,fontSize:12.5,padding:"6px 12px"},children:"Recargar la tienda"}):H?e.jsx("button",{type:"button",onClick:()=>ye(""),"aria-label":"Cerrar aviso",style:{border:0,background:"none",color:"inherit",cursor:"pointer",fontWeight:800},children:"Ã"}):null]}):null,onCrearProducto:()=>z({}),onEditarProducto:k=>z({id:k.id}),ajustes:e.jsxs("div",{ref:Ot,className:"lk-store-secs",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",minHeight:22},children:[ba.estado.tipo==="bloqueado"&&ba.estado.mensaje===za?e.jsx("span",{role:"status",style:{fontSize:12.5,fontWeight:600,color:"var(--text-muted)"},children:za}):e.jsx(Wu,{estado:ba.estado.tipo==="bloqueado"&&Nt?{tipo:"error",mensaje:"la tienda cambió en otra pestaña"}:ba.estado,enReposo:"Tus ajustes se guardan solos"}),ba.estado.tipo==="error"&&e.jsx("button",{type:"button",onClick:()=>{ba.guardarYa()},style:{...ee,fontSize:12.5,padding:"6px 12px"},children:"Reintentar"})]}),e.jsx(rs,{children:"Tus productos"}),pt,Zt,e.jsx(rs,{children:"Tu marca, el carrito y los avisos"}),At,xo,Et,Ma,e.jsx(rs,{children:"Publicar y dirección"}),en,bo]})})}),x&&e.jsx(Yy,{id:x.id,colecciones:(c.collections||[]).filter(k=>k&&k.id&&k.name).map(k=>({id:String(k.id),name:String(k.name)})),enColecciones:x.id?(c.collections||[]).filter(k=>(k.product_ids||[]).map(Y=>Number(Y)).includes(x.id)).map(k=>String(k.id)):[],uploadsEnabled:fe,onCerrar:()=>z(null),onGuardado:it,onEliminado:ta,ejecutar:ae,onAbrirLanding:ma},x.id||"nuevo")]}):e.jsxs("div",{ref:Ot,style:{display:"flex",gap:40,alignItems:"flex-start",justifyContent:"center",maxWidth:Ut?1350:900,margin:"0 auto"},children:[e.jsxs("div",{style:{flex:"1 1 0",minWidth:0,maxWidth:900,paddingBottom:4,...Ut?{maxHeight:"calc(100vh - 120px)",overflowY:"auto",overflowX:"hidden",scrollbarGutter:"stable",paddingRight:6}:{}},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:14},children:[e.jsx("span",{style:{width:32,height:32,borderRadius:9,background:"rgba(8,102,255,.1)",color:me,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 9l1.2-5h15.6L21 9"}),e.jsx("path",{d:"M4.5 9v11h15V9"}),e.jsx("path",{d:"M9.5 20v-6h5v6"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("h2",{style:{fontSize:18,margin:0,fontWeight:800,letterSpacing:"-.01em"},children:"Tienda online"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)"},children:["Tu vitrina de marca con todos tus productos. ",c.enabled?e.jsx("b",{style:{color:"#16a34a"},children:"Publicada"}):e.jsx("span",{children:"Sin publicar"})]})]}),!Ut&&e.jsx("button",{type:"button",onClick:()=>Pe(!0),style:{...ee,fontSize:12.5,flexShrink:0},children:"Vista previa"}),ao&&e.jsx("a",{href:"https://"+ao,target:"_blank",rel:"noreferrer",style:{...ee,fontSize:12.5,textDecoration:"none",flexShrink:0},children:"Ver tienda"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12,flexWrap:"wrap"},children:[e.jsx("div",{role:"radiogroup","aria-label":"Cómo diseñas tu tienda",style:{display:"inline-flex",padding:3,borderRadius:11,background:"var(--input-bg, #f1f3f7)",border:"1px solid var(--border, #e6e9ef)"},children:[["visual","Editor visual"],["codigo","Modo código"]].map(([k,Y])=>e.jsx("button",{type:"button",role:"radio","aria-checked":Q===k,onClick:()=>de(k),style:{border:0,borderRadius:8,padding:"7px 13px",fontSize:12.5,fontWeight:700,cursor:"pointer",font:"inherit",background:Q===k?"var(--card-bg, #fff)":"transparent",color:Q===k?"var(--text, #111827)":"var(--text-muted)",boxShadow:Q===k?"0 1px 3px rgba(16,24,40,.14)":"none"},children:Y},k))}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flex:"1 1 220px"},children:"Con el modo código escribes tu tienda en HTML y CSS (o te la arma tu IA) y sigue usando tus productos, el carrito y los pagos de aquÃ."})]}),(pe==null?void 0:pe.activo)&&e.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",padding:"10px 13px",marginBottom:12,borderRadius:12,border:"1px solid rgba(8,102,255,.25)",background:"rgba(8,102,255,.05)"},children:[e.jsxs("span",{style:{fontSize:12.5,lineHeight:1.45,flex:"1 1 260px"},children:[e.jsx("b",{children:"Tu tienda pública se ve con tu código."})," El diseño de aquà no se ve; los productos, el carrito, el envÃo, los pagos y la dirección sà aplican."]}),e.jsx("button",{type:"button",onClick:()=>de("codigo"),style:{...ee,padding:"6px 12px",fontSize:12.5},children:"Abrir el modo código"})]}),bt&&!Me?e.jsxs("button",{type:"button",onClick:()=>yt(!0),style:{display:"flex",alignItems:"center",gap:9,width:"100%",border:"1px solid rgba(22,163,74,.25)",background:"rgba(22,163,74,.06)",borderRadius:12,padding:"9px 13px",marginBottom:10,cursor:"pointer",font:"inherit",color:"inherit",textAlign:"left",transition:"background .15s ease"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#16a34a",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:800,color:"#15803d"},children:"Tienda activa"}),e.jsxs("span",{style:{marginLeft:"auto",fontSize:11.5,color:"var(--text-muted)"},children:[ke," de ",te.length," listos"]})]}):e.jsxs("div",{style:{...Jt,padding:"15px 16px",marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[e.jsx("div",{style:{fontSize:14,fontWeight:800,letterSpacing:"-.01em",flex:1},children:"Activa tu tienda"}),e.jsxs("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted)",flexShrink:0},children:[ke," de ",te.length," listos"]}),bt&&e.jsx("button",{type:"button",onClick:()=>yt(!1),style:{border:"none",background:"none",cursor:"pointer",fontSize:11.5,fontWeight:700,color:"var(--text-muted)",padding:0},children:"Ocultar"})]}),e.jsx("div",{style:{height:5,borderRadius:999,background:"var(--input-bg, #eef1f6)",margin:"9px 0 11px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.round(ke/te.length*100)}%`,background:ke===te.length?"#16a34a":me,borderRadius:999,transition:"width .2s ease"}})}),e.jsx("div",{style:{display:"grid",gap:2},children:te.map((k,Y)=>e.jsxs("button",{type:"button",onClick:()=>oa(k.id),style:{display:"flex",alignItems:"center",gap:10,width:"100%",border:"none",background:"none",cursor:"pointer",textAlign:"left",font:"inherit",color:"inherit",padding:"6px 4px",borderRadius:9,transition:"background .15s ease"},children:[k.done?e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"#16a34a",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",border:"1.5px dashed var(--border, #cdd2dd)",color:"var(--text-muted)",fontSize:10.5,fontWeight:800,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:Y+1}),e.jsx("span",{style:{fontSize:13,fontWeight:k.done?600:700,color:k.done?"var(--text-muted)":"var(--text, #111)",textDecoration:k.done?"line-through":"none",flex:1,minWidth:0},children:k.n}),e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-muted)",flexShrink:0},children:e.jsx("path",{d:"M9 6l6 6-6 6"})})]},k.id))})]}),e.jsxs("div",{className:"lk-store-secs",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",padding:"12px 14px",marginBottom:12,borderRadius:12,border:"1px solid var(--border)",background:"var(--accent-soft, rgba(8,102,255,.06))"},children:[e.jsxs("button",{onClick:yr,disabled:se,style:{...xa,fontSize:13,fontWeight:800,display:"inline-flex",alignItems:"center",gap:7,padding:"10px 16px",opacity:se?.6:1},children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3l1.8 5.4
1055L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.6z"}),e.jsx("path",{d:"M19 15l.6 1.8L21 17l-1.4.5L19 19l-.6-1.5L17 17l1.4-.2z"})]}),se?"Diseñando tu tiendaâ¦":"Diseñar mi tienda con IA"]}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.45,flex:1,minWidth:200},children:"Lee tus productos, precios y categorÃas y arma el diseño completo: colores, tipografÃa, fondo, portada con banner y secciones. Después ajustas lo que quieras en cada sección."})]}),e.jsx(rs,{children:"Tus productos"}),pt,Zt,e.jsx(rs,{children:"Encabezado de tu tienda"}),At,e.jsxs(zr,{id:"st-sec-confianza",guia:"tienda.confianza",open:Ct.has("confianza"),onToggle:()=>la("confianza"),title:"Sellos de confianza",desc:"Las pastillas bajo el nombre (Pagas al recibir, etc.). VacÃo = las 4 por defecto.",children:[(c.trust_badges||[]).map((k,Y)=>{var be;return e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6,alignItems:"center"},children:[e.jsx("select",{value:k.icon||"check",onChange:je=>{const Ne=[...c.trust_badges||[]];Ne[Y]={...Ne[Y],icon:je.target.value},Ie({trust_badges:Ne})},style:{...E,width:104,marginBottom:0,flexShrink:0},children:[["wallet","Billetera"],["eye","Ojo"],["truck","Camión"],["shield","Escudo"],["check","Check"],["lock","Candado"],["star","Estrella"],["gift","Regalo"]].map(([je,Ne])=>e.jsx("option",{value:je,children:Ne},je))}),e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:k.text||"",onChange:je=>{const Ne=[...c.trust_badges||[]];Ne[Y]={...Ne[Y],text:je.target.value},Ie({trust_badges:Ne})},placeholder:"Ej: Pagas al recibir",maxLength:40}),e.jsx(So,{field:"Sello de confianza",instruction:"Beneficio corto que da confianza para comprar contraentrega, 2 a 4 palabras, sin emojis",current:k.text||"",productName:((be=f[0])==null?void 0:be.name)||"",onPick:je=>{const Ne=[...c.trust_badges||[]];Ne[Y]={...Ne[Y],text:je},Ie({trust_badges:Ne})}}),e.jsx("button",{type:"button",onClick:()=>Ie({trust_badges:(c.trust_badges||[]).filter((je,Ne)=>Ne!==Y)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flexShrink:0},children:"Quitar"})]},Y)}),(c.trust_badges||[]).length<6&&e.jsx("button",{type:"button",onClick:()=>Ie({trust_badges:[...c.trust_badges||[],{icon:"check",text:""}]}),style:{...ee,fontSize:12.5},children:"+ Agregar sello"})]}),e.jsxs(zr,{id:"st-sec-banner",guia:"tienda.banner",open:Ct.has("banner"),onToggle:()=>la("banner"),title:"Banner principal",desc:"Imagen grande con tÃtulo y botón arriba del catálogo. Con varias fotos, rotan solas.",children:[e.jsx("div",{"data-ins":"banner:image",children:e.jsx(Rn,{label:"Imagen del banner",value:((Ar=c.banner)==null?void 0:Ar.image)||"",onChange:k=>Ie({banner:{...c.banner||{},image:k}}),uploadsEnabled:fe,compact:!0})}),e.jsxs("div",{style:{marginTop:10},"data-ins":"banner:images",children:[e.jsx("label",{style:D,children:"Más fotos de portada (rotan con la principal)"}),(((gs=c.banner)==null?void 0:gs.images)||[]).map((k,Y)=>e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:7},children:[/^https?:\/\//i.test(k)?e.jsx("img",{src:k,alt:"",style:{width:52,height:34,objectFit:"cover",borderRadius:8,border:"1px solid var(--border)",flexShrink:0}}):e.jsx("span",{style:{width:52,height:34,borderRadius:8,border:"1px dashed var(--border)",flexShrink:0}}),e.jsx("input",{style:{...E,marginBottom:0,flex:1},value:k,onChange:be=>{var Ne;const je=[...((Ne=c.banner)==null?void 0:Ne.images)||[]];je[Y]=be.target.value,Ie({banner:{...c.banner||{},images:je}})},placeholder:"https://..."}),e.jsx("button",{type:"button",onClick:()=>{var be;return Ie({banner:{...c.banner||{},images:(((be=c.banner)==null?void 0:be.images)||[]).filter((je,Ne)=>Ne!==Y)}})},style:{...ee,padding:"6px 10px",color:"var(--danger)",flexShrink:0},children:"Quitar"})]},Y)),(((ms=c.banner)==null?void 0:ms.images)||[]).length<4&&e.jsxs(e.Fragment,{children:[e.jsx(Rn,{label:"Agregar otra foto de portada",value:Ae,onChange:He,uploadsEnabled:fe,compact:!0}),Ae.trim()&&e.jsx("button",{type:"button",onClick:()=>{var k;Ie({banner:{...c.banner||{},images:[...((k=c.banner)==null?void 0:k.images)||[],Ae.trim()]}}),He("")},style:{...xa,fontSize:12.5,marginTop:6},children:"Agregar esta foto"})]}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 2px 8px",lineHeight:1.45},children:"Con 2 o más fotos la portada las rota sola con un cambio suave (la principal siempre va primero). El import de Shopify trae aquà las fotos del home."})]}),e.jsxs("div",{style:{marginTop:12},"data-ins":"banner:video",children:[e.jsx("label",{style:D,children:"Video de fondo de la portada (opcional)"}),e.jsx(Nu,{value:((Sr=c.banner)==null?void 0:Sr.video)||"",onChange:(k,Y)=>{var be;return Ie({banner:{...c.banner||{},video:k||void 0,...Y!=null&&Y.poster&&!((be=c.banner)!=null&&be.poster)?{poster:Y.poster}:{}}})},uploadsEnabled:fe}),(()=>{var je,Ne,Lt;
1055const k=String(((je=c.banner)==null?void 0:je.video)||"").trim(),Y=!!((Ne=c.banner)!=null&&Ne.image||(((Lt=c.banner)==null?void 0:Lt.images)||[]).length),be=!k||/^\//.test(k)||/^https:\/\/[^/]*\.b-cdn\.net\//i.test(k)||/^https:\/\/[^/]*\.r2\.dev\//i.test(k);return k&&!be?e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"0 2px 8px",lineHeight:1.45},children:[e.jsx("b",{children:"Ese video no se va a ver."})," Solo funcionan los que subas a Lumy. Un enlace de YouTube, Drive u otra página lo bloquea el navegador por seguridad."]}):k&&!Y?e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"0 2px 8px",lineHeight:1.45},children:[e.jsx("b",{children:"Falta la foto de arriba."})," Sin ella el video no se pinta: es lo que se ve mientras carga, y si el video falla es lo único que queda. Una portada en negro cuando llega alguien de un anuncio es lo más caro que hay."]}):e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"0 2px 8px",lineHeight:1.45},children:"Un mp4 corto en bucle, sin sonido, detrás del tÃtulo. La foto de arriba queda de respaldo mientras carga. Déjalo vacÃo para la portada normal. Ojo con el peso: un video pesado te tumba la velocidad de la página."})})()]}),e.jsxs("div",{style:{marginTop:10},"data-ins":"banner:title",children:[e.jsx(Ea,{ai:{field:"Titulo del banner principal de la tienda",instruction:"Titulo gancho de 3 a 6 palabras, vendedor y claro para el nicho. Sin emojis",current:((hs=c.banner)==null?void 0:hs.title)||"",productName:((Gs=f[0])==null?void 0:Gs.name)||"",onPick:k=>Ie({banner:{...c.banner||{},title:k}})},children:"TÃtulo"}),e.jsx("input",{style:E,value:((wn=c.banner)==null?void 0:wn.title)||"",onChange:k=>Ie({banner:{...c.banner||{},title:k.target.value}}),placeholder:"Ej: Joyas que enamoran"})]}),e.jsxs("div",{"data-ins":"banner:subtitle",children:[e.jsx(Ea,{ai:{field:"Subtitulo del banner de la tienda",instruction:"Una frase de apoyo con beneficio + confianza (envio, pago contraentrega). 5 a 9 palabras, sin emojis",current:((Io=c.banner)==null?void 0:Io.subtitle)||"",productName:((qn=f[0])==null?void 0:qn.name)||"",onPick:k=>Ie({banner:{...c.banner||{},subtitle:k}})},children:"SubtÃtulo"}),e.jsx("input",{style:E,value:((Fo=c.banner)==null?void 0:Fo.subtitle)||"",onChange:k=>Ie({banner:{...c.banner||{},subtitle:k.target.value}}),placeholder:"Ej: EnvÃo gratis a todo el paÃs, pago al recibir"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{"data-ins":"banner:cta_text",children:[e.jsx(Ea,{ai:{field:"Texto del boton del banner",instruction:'Llamado a la accion corto, 2 a 3 palabras, baja friccion: "Ver productos", "Quiero ver", "Comprar ahora". Sin emojis',current:((Vi=c.banner)==null?void 0:Vi.cta_text)||"",productName:((Vs=f[0])==null?void 0:Vs.name)||"",onPick:k=>Ie({banner:{...c.banner||{},cta_text:k}})},children:"Texto del botón"}),e.jsx("input",{style:E,value:((Oo=c.banner)==null?void 0:Oo.cta_text)||"",onChange:k=>Ie({banner:{...c.banner||{},cta_text:k.target.value}}),placeholder:"Ver productos"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Link del botón"}),e.jsx("input",{style:E,value:((cn=c.banner)==null?void 0:cn.cta_url)||"",onChange:k=>Ie({banner:{...c.banner||{},cta_url:k.target.value}}),placeholder:"Pega un link"})]})]}),e.jsxs("div",{style:{display:"flex",gap:16,flexWrap:"wrap",alignItems:"center",marginTop:12},children:[e.jsxs("div",{"data-ins":"banner:align",children:[e.jsx("label",{style:D,children:"Alineación del texto"}),e.jsx("div",{style:{display:"flex",gap:6},children:[{k:"center",n:"Centrado"},{k:"left",n:"Izquierda"}].map(k=>{var be;const Y=(((be=c.banner)==null?void 0:be.align)||"center")===k.k;return e.jsx("button",{type:"button",onClick:()=>Ie({banner:{...c.banner||{},align:k.k}}),style:{fontSize:12,fontWeight:700,padding:"7px 13px",borderRadius:9,border:Y?`1.5px solid ${me}`:"1px solid var(--border)",background:Y?"rgba(8,102,255,.08)":"var(--card-bg, #fff)",color:Y?me:"var(--text, #111)",cursor:"pointer"},children:k.n},k.k)})})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",marginTop:18},"data-ins":"banner:verified",children:[e.jsx("input",{type:"checkbox",checked:!((To=c.banner)!=null&&To.verified_off),onChange:k=>Ie({banner:{...c.banner||{},verified_off:!k.target.checked}})}),e.jsx("span",{style:{fontSize:12.5,fontWeight:600},children:'Mostrar sello "Tienda verificada"'})]})]})]}),e.jsx(rs,{children:"Estilo"}),e.jsxs(zr,{id:"st-sec-diseno",guia:"tienda.diseno",open:Ct.has("diseno"),onToggle:()=>la("diseno"),title:"Diseño",desc:"Plantilla, fondo y tipografÃa. O deja que la IA lo elija por tu nicho.",children:[e.jsxs("button",{onClick:yr,disabled:se,style:{...xa,fontSize:12.5,fontWeight:700,display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",opacity:se?.6:1,marginBottom:12},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3l1.8 5.4
1055L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.6z"}),e.jsx("path",{d:"M19 15l.6 1.8L21 17l-1.4.5L19 19l-.6-1.5L17 17l1.4-.2z"})]}),se?"Diseñandoâ¦":"Diseñar con IA"]}),e.jsx("label",{style:D,children:"Plantilla por tipo de negocio"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(88px, 1fr))",gap:9,marginBottom:14},children:Gp.map(k=>{var be;const Y=(((be=c.theme)==null?void 0:be.page_bg)||"#f6f7f9")===k.theme.page_bg&&(c.accent||"#111827")===k.accent;return e.jsxs("button",{type:"button",onClick:()=>Ie({accent:k.accent,theme:{...c.theme||{},...k.theme}}),style:{border:Y?`2px solid ${me}`:"1px solid var(--border)",borderRadius:12,padding:0,overflow:"hidden",cursor:"pointer",background:"var(--card-bg, #fff)",textAlign:"left"},children:[e.jsx("div",{style:{height:44,background:k.theme.page_bg,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:24,height:32,borderRadius:Math.min(9,k.theme.card_radius/2),background:k.theme.card_bg,boxShadow:"0 1px 4px rgba(0,0,0,.22)",display:"flex",alignItems:"flex-end",justifyContent:"center",paddingBottom:4},children:e.jsx("span",{style:{width:16,height:6,borderRadius:k.theme.cta_radius>18?999:2,background:k.accent}})})}),e.jsx("div",{style:{padding:"5px 6px",fontSize:10.5,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:k.name})]},k.id)})}),(()=>{const k=["puntos","destellos","ondas","burbujas","cometas","pulso"],Y=String(c.bg_style||"aurora-azul"),be=String(c.bg_fx||""),je=k.includes(Y)?"plano":Y,Ne=be||(k.includes(Y)?Y:""),Lt=[["plano","Sin fondo"],["aurora-azul","Aurora azul"],["aurora-violeta","Aurora violeta"],["aurora-dorado","Aurora dorado"],["aurora-verde","Aurora verde"],["malla","Malla"],["gradiente-vivo","Gradiente"],["blobs","Manchas"]],Ke=[["","Ninguna"],["puntos","Puntos"],["destellos","Destellos"],["ondas","Ondas"],["burbujas","Burbujas"],["cometas","Cometas"],["pulso","Pulso"]],ft={"aurora-azul":"#0866ff","aurora-violeta":"#8b5cf6","aurora-dorado":"#f59e0b","aurora-verde":"#10b981",malla:"#6366f1","gradiente-vivo":"#0866ff",blobs:"#8b5cf6"},Xt=["media","notoria"].includes(String(c.bg_intensity||""))?String(c.bg_intensity):"sutil",ea=/^#[0-9a-fA-F]{6}$/.test(String(c.bg_color||""))?String(c.bg_color):"",Ta=je!=="plano"||!!Ne,Eo=ea||ft[je]||(Ne?"#6366f1":"#0866ff");return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,"data-ins":"diseno:bg_style",children:"Fondo"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:Lt.map(([et,Aa])=>e.jsx("button",{type:"button",className:je===et?"lk-sel-aurora":void 0,onClick:()=>Ie({bg_style:et,bg_fx:Ne}),style:{...je===et?{...xa,background:"transparent"}:ee,padding:"6px 11px",fontSize:12},children:Aa},et))}),e.jsxs("label",{style:D,"data-ins":"diseno:bg_fx",children:["Animación ",e.jsx("span",{style:{fontWeight:400,color:"var(--text-muted)"},children:"· se combina con el fondo"})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:Ke.map(([et,Aa])=>e.jsx("button",{type:"button",className:Ne===et?"lk-sel-aurora":void 0,onClick:()=>Ie({bg_fx:et,bg_style:je}),style:{...Ne===et?{...xa,background:"transparent"}:ee,padding:"6px 11px",fontSize:12},children:Aa},et||"none"))}),Ta&&e.jsx("div",{style:{marginBottom:12},children:e.jsx(U2,{kind:je==="plano"?"":je,overlay:Ne,intensity:Xt,color:Eo,label:"Vista del fondo"})}),Ta&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Qué tanto se nota"}),e.jsx("div",{style:{marginBottom:12},children:e.jsx(Ko,{options:V2,value:Xt,onPick:et=>Ie({bg_intensity:et||"sutil"})})}),e.jsx("label",{style:D,children:"Color del efecto (opcional)"}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:14},children:[e.jsx("input",{type:"color",value:ea||c.accent||"#0866ff",onChange:et=>Ie({bg_color:et.target.value}),style:{width:44,height:34,padding:0,border:"1.5px solid var(--border, #e5e7eb)",borderRadius:8,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:ea?"Color propio":"Tono propio de cada fondo"}),ea&&e.jsx("button",{type:"button",onClick:()=>Ie({bg_color:""}),style:{border:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",borderRadius:8,fontSize:12,padding:"5px 10px",cursor:"pointer",color:"var(--text-muted)"}
1055,children:"Quitar"})]})]})]})})(),e.jsx("label",{style:D,children:"TipografÃa"}),e.jsxs("select",{style:{...E,cursor:"pointer"},value:((wr=c.theme)==null?void 0:wr.font)||"",onChange:k=>Ie({theme:{...c.theme||{},font:k.target.value}}),children:[e.jsx("option",{value:"",children:"Sistema (la más rápida)"}),e.jsx("option",{value:"serif",children:"Elegante (Playfair, joyas y moda premium)"}),e.jsx("option",{value:"lora",children:"Serif cálida (Lora, hogar y artesanal)"}),e.jsx("option",{value:"modern",children:"Moderna (Inter)"}),e.jsx("option",{value:"montserrat",children:"Comercial (Montserrat, va con todo)"}),e.jsx("option",{value:"outfit",children:"Marca joven (Outfit)"}),e.jsx("option",{value:"rounded",children:"Redondeada (Nunito, mascotas)"}),e.jsx("option",{value:"poppins",children:"Poppins (belleza)"}),e.jsx("option",{value:"dmsans",children:"DM Sans (hogar)"}),e.jsx("option",{value:"space",children:"Tech (Space Grotesk)"}),e.jsx("option",{value:"baloo",children:"Divertida (Baloo, niños)"}),e.jsx("option",{value:"mulish",children:"Limpia (Mulish, salud)"})]}),e.jsx("label",{style:D,"data-ins":"diseno:card_skin",children:"Piel de las tarjetas de producto"}),e.jsxs("select",{style:{...E,cursor:"pointer"},value:((Ho=c.theme)==null?void 0:Ho.card_skin)||"",onChange:k=>Ie({theme:{...c.theme||{},card_skin:k.target.value||void 0}}),children:[e.jsx("option",{value:"",children:"Clásica"}),e.jsx("option",{value:"polaroid",children:"Polaroid (marco blanco, giro sutil)"}),e.jsx("option",{value:"editorial",children:"Editorial (foto 4:5, tipografÃa serif)"}),e.jsx("option",{value:"marcado",children:"Borde marcado (sombra dura)"})]})]}),Et,e.jsx(rs,{children:"Carrito y avisos"}),xo,Ma,e.jsx(rs,{children:"Publicar y dirección"}),en,bo]}),Nt&&e.jsxs("div",{role:"alert",style:{position:"sticky",bottom:64,marginTop:14,display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",padding:"10px 13px",borderRadius:12,border:"1px solid var(--danger, #dc2626)",background:"var(--card-bg, #fff)",zIndex:6},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--danger, #dc2626)",flex:"1 1 240px"},children:"La tienda cambió en otra pestaña o desde el asistente. Recárgala para seguir: lo que cambiaste aquà después de eso no se guardó."}),e.jsx("button",{type:"button",onClick:()=>dt(),style:{...ee,fontSize:12.5,padding:"7px 13px"},children:"Recargar la tienda"})]}),e.jsxs("div",{style:{position:"sticky",bottom:0,marginTop:14,padding:"10px 14px",background:"var(--card-bg, #fff)",border:"1px solid var(--border)",borderRadius:12,boxShadow:"0 -3px 16px -6px rgba(10,15,32,.18)",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",zIndex:5},children:[ba.estado.tipo==="bloqueado"&&ba.estado.mensaje===za?e.jsx("span",{role:"status",style:{fontSize:12.5,fontWeight:600,color:"var(--text-muted)"},children:za}):e.jsx(Wu,{estado:ba.estado.tipo==="bloqueado"&&Nt?{tipo:"error",mensaje:"la tienda cambió en otra pestaña"}:ba.estado,enReposo:"Se guarda solo"}),ba.estado.tipo==="error"&&e.jsx("button",{type:"button",onClick:()=>{ba.guardarYa()},style:{...ee,fontSize:12.5,padding:"6px 12px"},children:"Reintentar"}),K&&e.jsx("span",{role:"status",style:{color:"var(--success)",fontSize:12.5,fontWeight:700},children:K}),H&&e.jsxs("span",{role:"alert",style:{color:"var(--danger)",fontSize:12.5,flex:"1 1 220px"},children:[H," ",e.jsx("button",{type:"button",onClick:()=>ye(""),"aria-label":"Cerrar aviso",style:{border:0,background:"none",color:"inherit",cursor:"pointer",fontWeight:800},children:"Ã"})]}),!!String(c.slug||"")&&e.jsx("button",{type:"button",onClick:X,style:{...ee,marginLeft:"auto",fontSize:12.5,fontWeight:700,padding:"7px 14px"},children:"Ver mi tienda"})]})]}),Ut&&e.jsxs("div",{style:{flex:"0 0 410px",alignSelf:"flex-start",position:"sticky",top:8,maxHeight:"calc(100vh - 16px)"},children:[e.jsx("div",{style:{background:"#0b0b0f",borderRadius:38,padding:10,boxShadow:"0 14px 40px rgba(0,0,0,.25)"},children:e.jsx("div",{style:{position:"relative",height:"72vh",minHeight:430,overflow:"hidden",borderRadius:30,background:"#fff"},children:ue?e.jsx("iframe",{ref:Na,onLoad:()=>La(da.current),title:"preview-tienda",srcDoc:ue,style:{width:390,height:"100%",border:0,background:"#fff",display:"block"}}):e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9aa0aa",fontSize:13},children:"Cargando vista previaâ¦"})})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:10,marginTop:9,flexWrap:"wrap"},children:[e.jsx(Jy,{on:ia,onToggle:()=>ha(k=>!k)}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:ia?"Toca lo que quieres editar · Esc para salir":pe!=null&&pe.activo?"Diseño visual (tu tienda pública usa tu código)":"Asà ve tu tienda el cliente"})]})]}),x&&e.jsx(Yy,{id:x.id,colecciones:(c.collections||[]).filter(k=>k&&k.id&&k.name).map(k=>({id:String(k.id),name:String(k.name)})),enColecciones:x.id?(c.collections||[]).filter(k=>(k.product_ids||[]).map(Y=>Number(Y)).includes(x.id)).map(k=>String(k.id)):[],uploadsEnabled:fe,onCerrar:()=>z(null),onGuardado:it,onEliminado:ta,ejecutar:ae,onAbrirLanding:ma},x.id||"nuevo"),!Ut&&$e&&Wo.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:10050,display:"flex",flexDirection:"column",background:"var(--card-bg, #fff)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",paddingTop:"calc(10px + env(safe-area-inset-top, 0px))",borderBottom:"1px solid var(--border, #e8eaf0)",flexShrink:0},children:[e.jsx("b",{style:{fontSize:14},children:"Vista previa"}),e.jsx(Jy,{on:ia,onToggle:()=>ha(k=>!k),compacto:!0}),e.jsx("button",{type:"button",onClick:()=>{ha(!1),Pe(!1)},style:{...ee,marginLeft:"auto",padding:"6px 14px",fontSize:12.5,flexShrink:0},children:"Cerrar"})]}),ue?e.jsx("iframe",{ref:wa,onLoad:()=>La(da.current),title:"preview-tienda",srcDoc:ue,style:{flex:1,width:"100%",border:0,background:"#fff"}}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#9aa0aa",fontSize:13},children:"Cargando vista previaâ¦"})]}),document.body)]})}
1055function gc({src:t,bg:a,fit:n="cover",size:o=48,pad:i=0}){return e.jsx("span",{style:{width:o,height:o,borderRadius:o>=46?13:11,background:a,flex:"none",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",padding:i,boxShadow:"0 2px 10px -3px rgba(16,24,40,.3), inset 0 0 0 1px rgba(255,255,255,.14)"},children:e.jsx("img",{src:t,alt:"",style:{width:"100%",height:"100%",objectFit:n,display:"block"}})})}function oi({on:t,error:a,onLabel:n="Conectado",offLabel:o="Sin conectar"}){return a?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:800,color:"var(--warning)",background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--warning)"}}),"Necesita revisión"]}):t?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--success)"}}),n]}):e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:700,color:"var(--text-muted, #8a90a2)",background:"var(--input-bg, #f1f3f8)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:o})}function $8(t,a){const n=String(a||"");return/createCharge (401|403)\b/i.test(n)||/unauthor|forbidden|api[ _-]?key|no autorizad/i.test(n)?t==="Bold"?"Bold no aceptó tu llave. Cópiala de nuevo desde Bold â Integraciones â Llaves de API: va la «Llave de identidad», no la secreta.":`${t} no aceptó tus credenciales. Vuelve a copiarlas desde tu panel de ${t} y pégalas otra vez aquÃ.`:/createCharge (400|422)\b/i.test(n)?`${t} no aceptó el último cobro (normalmente por el monto o porque la cuenta todavÃa no puede cobrar en lÃnea). RevÃsalo en tu panel de ${t}.`:/createCharge 404\b/i.test(n)?`${t} no encontró la cuenta de ese cobro. Vuelve a conectarla aquÃ.`:`${t} rechazó el último cobro. Vuelve a conectar la cuenta; si sigue igual, escrÃbenos.`}function Vp({marca:t,p:a}){return!a||a.status!=="error"&&!a.last_error?null:e.jsxs("div",{style:{marginTop:12,display:"flex",gap:9,alignItems:"flex-start",background:"rgba(245,158,11,.10)",border:"1px solid rgba(245,158,11,.32)",borderRadius:11,padding:"10px 12px"},children:[e.jsx("span",{style:{fontSize:14,lineHeight:1.2},children:"â ï¸"}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:12.5,fontWeight:800,color:"var(--notice-warning-text)"},children:["Tus cobros con ",t," no están abriendo"]}),e.jsx("div",{style:{fontSize:12,color:"var(--notice-warning-text)",lineHeight:1.5,marginTop:2},title:String(a.last_error||""),children:$8(t,String(a.last_error||""))})]})]})}const Zy=`function doPost(e){ 1056 var sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); 1057 var d = JSON.parse(e.postData.contents); 1058 if (sh.getLastRow() === 0) { 1059 sh.appendRow(["Evento","Fecha","Pedido","Nombre","Telefono","Direccion","Ciudad","Departamento","Producto","Total","Estado","Dropi ID"]); 1060 } 1061 sh.appendRow([d.evento,d.fecha,d.pedido_id,d.nombre,d.telefono,d.direccion,d.ciudad,d.departamento,d.producto,d.total,d.estado,d.dropi_id]); 1062 return ContentService.createTextOutput(JSON.stringify({ok:true})); 1063}`;function Cu({title:t,desc:a,children:n}){return e.jsxs("div",{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:15,fontWeight:800,color:"var(--text, #111)",letterSpacing:"-.01em"},children:t}),a&&e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginTop:4,lineHeight:1.5,maxWidth:760},children:a})]}),n]})}const Xy=`{ 1064 "evento": "pedido_nuevo", 1065 "fecha": "2026-08-30T15:04:05.000Z", 1066 "pedido_id": 8421, 1067 "nombre": "Yorgelis DÃaz", 1068 "telefono": "3105554433", 1069 "email": "[email protected]", 1070 "direccion": "Calle 45 # 12-34, Apto 502", 1071 "ciudad": "Barranquilla", 1072 "departamento": "Atlántico", 1073 "producto": "2 x Set de Ollas Premium", 1074 "total": 189000, 1075 "estado": "nuevo", 1076 "dropi_id": "", 1077 "landing_id": 1740, 1078 "origen": "landing", 1079 "rastreo": "https://lumycol.com/rastreo/8f3k2?k=...", 1080 "pago": "contraentrega", 1081 "recaudo": 189000 1082}`,_u={pedido_nuevo:"Pedido nuevo",cambio_estado:"Cambio de estado",carrito_abandonado:"Carrito abandonado",pedido_lista_negra:"Pedido de un teléfono bloqueado"};function I8(){const t=$a(),[a,n]=h.useState([]),[o,i]=h.useState([]),[s,u]=h.useState(!1),[m,c]=h.useState(null),[g,f]=h.useState(""),[b,v]=h.useState(""),[j,S]=h.useState(!1),[$,C]=h.useState(0),_=h.useCallback(()=>{t("/api/webhooks").then(B=>B.json()).then(B=>{B.ok&&n(B.destinos||[])}).catch(()=>{})},[t]);h.useEffect(()=>{_()},[_]);const N=async()=>{u(!0);try{const B=await(await t("/api/webhooks/envios")).json();B.ok&&i(B.envios||[])}catch{}},w=async()=>{var B;if(m){S(!0),v("");try{const ne=await(await t("/api/webhooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nombre:m.nombre,url:m.url,eventos:m.eventos,su_bot_despacha:m.despacha})})).json();if(!ne.ok){v(ne.message||"No se pudo guardar.");return}f(((B=ne.destino)==null?void 0:B.secreto)||""),c(null),_()}catch{v("No se pudo conectar.")}finally{S(!1)}}},M=async B=>{C(B),v("");try{const U=await(await t(`/api/webhooks/${B}/probar`,{method:"POST"})).json();v(U.ok?"â Tu sistema recibió la prueba.":`No llegó: ${U.message||"sin detalle"}`),_()}catch{v("No se pudo conectar.")}finally{C(0)}},p=async B=>{await t(`/api/webhooks/${B.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({activo:!B.activo})}).catch(()=>{}),_()},V=async B=>{window.confirm("¿Quitar este destino? Dejará de recibir avisos.")&&(await t(`/api/webhooks/${B}`,{method:"DELETE"}).catch(()=>{}),_())},L="linear-gradient(90deg, #0866FF 0%, #3AA8FF 100%)",x=B=>B.activo?B.ultimo_error?{txt:"Falló",barra:"#dc2626",on:!1}:B.ultimo_ok_at?{txt:"Recibiendo",barra:"#16a34a",on:!0}:{txt:"Sin estrenar",barra:"#f59e0b",on:!1}:{txt:"Pausado",barra:"#94a3b8",on:!1}
1082,z=a.filter(B=>B.activo).length,G=e.jsx("span",{style:{width:48,height:48,borderRadius:13,background:me,flex:"none",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 10px -3px rgba(16,24,40,.3), inset 0 0 0 1px rgba(255,255,255,.14)"},children:e.jsxs("svg",{width:"23",height:"23",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 3v5M15 3v5"}),e.jsx("rect",{x:"6",y:"8",width:"12",height:"6",rx:"2"}),e.jsx("path",{d:"M12 14v3a4 4 0 0 0 4 4h2"})]})});return e.jsx("div",{children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(340px, 100%), 1fr))",gap:14,alignItems:"start"},children:[a.map(B=>{const U=x(B);return e.jsxs("div",{style:{...Jt,padding:0,overflow:"hidden",opacity:B.activo?1:.8},children:[e.jsx("div",{style:{height:4,background:U.barra}}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[G,e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em"},children:B.nombre||"Sin nombre"}),e.jsx("div",{title:B.url,style:{fontSize:12,color:"var(--text-muted)",marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:String(B.url).replace(/^https?:\/\//,"")})]}),e.jsx(oi,{on:U.on,onLabel:U.txt,offLabel:U.txt})]}),B.ultimo_error&&e.jsxs("div",{role:"alert",style:{background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:10,padding:"9px 11px",fontSize:12.5,color:"var(--danger)",marginTop:12,lineHeight:1.45},children:[e.jsx("b",{children:"Ãltimo fallo:"})," ",B.ultimo_error]}),e.jsxs("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"12px 0 0",lineHeight:1.5},children:["Le avisamos de: ",e.jsx("b",{children:(B.eventos.length?B.eventos:Object.keys(_u)).map(ne=>_u[ne]||ne).join(", ").toLowerCase()}),".",!!B.su_bot_despacha&&e.jsxs(e.Fragment,{children:[" Este sistema ",e.jsx("b",{children:"despacha los pedidos"}),", asà que Lumy no los sube a la logÃstica."]})]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"6px 0 0"},children:["Secreto ",e.jsx("b",{children:B.secreto})," â solo se ve entero al crearlo."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginTop:14},children:[e.jsx("button",{type:"button",onClick:()=>M(B.id),disabled:$===B.id,style:{...ee,padding:"8px 14px",fontSize:12.5},children:$===B.id?"Probandoâ¦":"Probar ahora"}),e.jsx("button",{type:"button",onClick:()=>p(B),style:{...ee,padding:"8px 14px",fontSize:12.5},children:B.activo?"Pausar":"Reanudar"}),e.jsx("button",{type:"button",onClick:()=>V(B.id),style:{...ee,padding:"8px 14px",fontSize:12.5,color:"var(--danger)",borderColor:"var(--notice-danger-border)"},children:"Quitar"})]})]})]},B.id)}),e.jsxs("div",{style:{...Jt,padding:0,overflow:"hidden"},children:[e.jsx("div",{style:{height:4,background:L}}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[G,e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em"},children:"Tu propio bot o CRM"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Lumy le avisa en el momento en que pasa algo con un pedido"})]}),a.length>0&&e.jsx(oi,{on:z>0,onLabel:z===1?"1 conectado":z+" conectados",offLabel:"Todos pausados"})]}),m?e.jsxs("div",{style:{marginTop:6},children:[e.jsx("label",{style:D,children:"Nombre"}),e.jsx("input",{style:E,placeholder:"Mi bot de WhatsApp",value:m.nombre,onChange:B=>c({...m,nombre:B.target.value})}),e.jsx("label",{style:D,children:"Dirección de tu sistema"}),e.jsx("input",{style:{...E,fontFamily:"monospace",fontSize:13},placeholder:"https://tu-sistema.com/lumy",value:m.url,onChange:B=>c({...m,url:B.target.value})}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 2px 0",lineHeight:1.45},children:["Tiene que ser ",e.jsx("b",{children:"https"})," y estar publicada en internet."]}),e.jsx("label",{style:D,children:"¿De qué le avisamos?"}),e.jsx("div",{style:{display:"grid",gap:6},children:Object.entries(_u).map(([B,U])=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:m.eventos.includes(B),onChange:ne=>c({...m,eventos:ne.target.checked?[...m.eventos,B]:m.eventos.filter(Q=>Q!==B)})}),e.jsx("span",{children:U})]},B))}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"6px 2px 0",lineHeight:1.45},children:"Si no marcas ninguno, le llegan todos."}),e.jsx("div",{role:"status",style:{background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:10,padding:"11px 12px",margin:"14px 0 0",fontSize:12,color:"var(--notice-warning-text)",lineHeight:1.5},children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",ga
1082p:9,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:m.despacha,onChange:B=>c({...m,despacha:B.target.checked}),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("b",{children:"Mi bot despacha los pedidos."})," Márcalo ",e.jsx("b",{children:"solo"})," si tu sistema sube el pedido a la transportadora. Lumy dejará de subirlo para que no salga dos veces â el pedido igual queda en tu CRM y reporta a tus pÃxeles."]})]})}),e.jsxs("div",{style:{display:"flex",gap:9,flexWrap:"wrap",marginTop:14},children:[e.jsx("button",{type:"button",onClick:w,disabled:j||!m.url.trim(),style:{background:L,color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",opacity:j||!m.url.trim()?.7:1,boxShadow:"0 6px 18px -8px rgba(8,102,255,.7)"},children:j?"Guardandoâ¦":"Conectar"}),e.jsx("button",{type:"button",onClick:()=>{c(null),v("")},style:ee,children:"Cancelar"})]})]}):e.jsxs("div",{style:{marginTop:14},children:[e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 12px",lineHeight:1.5},children:"Cada vez que entra un pedido, se abandona un carrito o cambia el estado de una entrega, Lumy le manda el aviso a tu sistema, firmado para que pueda comprobar que viene de Lumy. Funciona con cualquier plataforma que reciba un webhook."}),e.jsxs("details",{style:{marginBottom:12},children:[e.jsx("summary",{style:{fontSize:12.5,fontWeight:700,color:me,cursor:"pointer"},children:"Ver qué le mandamos a tu sistema"}),e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 7px",lineHeight:1.5},children:["Un ",e.jsx("b",{children:"POST"})," con este JSON y estas cabeceras: ",e.jsx("code",{children:"X-Lumy-Evento"}),", ",e.jsx("code",{children:"X-Lumy-Fecha"}),", ",e.jsx("code",{children:"X-Lumy-Entrega"})," y ",e.jsx("code",{children:"X-Lumy-Firma"}),"."]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 7px",lineHeight:1.5}
1082,children:[e.jsxs("b",{children:["Ojo con ",e.jsx("code",{children:"recaudo"}),":"]})," es lo que el repartidor debe cobrar en la puerta, y NO siempre es igual a ",e.jsx("code",{children:"total"}),". Si el comprador ya pagó en lÃnea llega ",e.jsx("code",{children:'pago: "pagado"'})," y",e.jsx("code",{children:"recaudo: 0"})," â si tu sistema crea la guÃa cobrando ",e.jsx("code",{children:"total"}),", le cobrarÃas dos veces."]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 7px",lineHeight:1.5},children:["Para comprobar que viene de Lumy: ",e.jsx("code",{children:"X-Lumy-Firma"})," es ",e.jsx("code",{children:'sha256=HMACâSHA256(tu secreto, XâLumyâFecha + "." + cuerpo)'}),". Va la fecha dentro a propósito, para que un aviso viejo capturado no se pueda reenviar."]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("pre",{style:{background:"#0f172a",color:"#e2e8f0",borderRadius:10,padding:"11px 12px",fontSize:11,overflowX:"auto",margin:0,lineHeight:1.6},children:Xy}),e.jsx("button",{type:"button",onClick:()=>{try{navigator.clipboard.writeText(Xy),v("â Ejemplo copiado.")}catch{}},style:{...ee,position:"absolute",top:8,right:8,padding:"4px 10px",fontSize:11},children:"Copiar"})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:9,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{type:"button",onClick:()=>{c({nombre:"",url:"",eventos:[],despacha:!1}),v("")},style:{background:L,color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",boxShadow:"0 6px 18px -8px rgba(8,102,255,.7)"},children:a.length?"Conectar otro sistema":"Conectar un sistema"}),e.jsx("button",{type:"button",onClick:N,style:{...ee,padding:"9px 14px",fontSize:13},children:"Ver los últimos envÃos"})]})]}),g&&e.jsxs("div",{style:{background:"rgba(22,163,74,.07)",border:"1px solid rgba(22,163,74,.3)",borderRadius:10,padding:"11px 12px",marginTop:12},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800},children:"Guarda este secreto ahora"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"3px 0 9px",lineHeight:1.45},children:"Con él tu sistema comprueba que el aviso viene de Lumy y no de otra persona. No se vuelve a mostrar."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("code",{style:{flex:1,minWidth:190,wordBreak:"break-all",fontSize:12.5,background:"var(--input-bg, #f4f6fa)",borderRadius:8,padding:"7px 10px"},children:g}),e.jsx("button",{type:"button",style:{...ee,padding:"7px 13px",fontSize:12.5},onClick:()=>{try{navigator.clipboard.writeText(g),v("â Secreto copiado.")}catch{}},children:"Copiar"})]}),e.jsx("div",{style:{marginTop:10},children:e.jsx("button",{type:"button",style:{...ee,padding:"7px 13px",fontSize:12.5},onClick:()=>f(""),children:"Ya lo guardé"})})]}),b&&e.jsx("div",{role:"status",style:{fontSize:12.5,fontWeight:700,marginTop:10,color:b.startsWith("â")?"var(--success)":"var(--danger)"},children:b}),s&&e.jsxs("div",{style:{background:"var(--input-bg, #f4f6fa)",borderRadius:12,padding:"12px 14px",marginTop:12,maxHeight:260,overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800},children:"Ãltimos envÃos"}),e.jsx("button",{type:"button",style:{...ee,padding:"4px 11px",fontSize:11.5},onClick:()=>u(!1),children:"Cerrar"})]}),o.length===0&&e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"TodavÃa no se ha mandado ningún aviso."}),o.map(B=>e.jsxs("div",{style:{fontSize:12,padding:"7px 0",borderTop:"1px solid var(--border, #e8eaf0)",display:"flex",gap:10,justifyContent:"space-between",alignItems:"baseline"},children:[e.jsxs("span",{style:{color:"var(--text-muted)"},children:[e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:String(B.creado_at||"").slice(5,16)})," · ",_u[B.evento]||B.evento," â ",B.nombre||B.url]}),e.jsx("span",{style:{fontWeight:700,flex:"none",color:B.estado==="ok"?"var(--success)":B.estado==="fallido"?"var(--danger)":"var(--warning)"},children:B.resumen})]},B.id))]})]})]})]})})}function T8(){const t=$a(),[a,n]=h.useState(""),[o,i]=h.useState(""),[s,u]=h.useState(""),[m,c]=h.useState(!1),[g,f]=h.useState(!1),[b,v]=h.useState(!1);h.useEffect(()=>{t("/api/landing/integrations").then(C=>C.json()).then(C=>
1082{C.ok&&(n(C.sheets_url||""),i(C.blacklist||""))}).catch(()=>{})},[t]);const j=async()=>{c(!0),u("");try{const _=await(await t("/api/landing/integrations",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({sheets_url:a.trim(),blacklist:o})})).json();u(_.ok?"Guardado â":_.message||"No se pudo guardar.")}catch{u("Error de conexión.")}finally{c(!1),setTimeout(()=>u(""),4e3)}},S=async()=>{c(!0),u("Enviando fila de pruebaâ¦");try{await t("/api/landing/integrations",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({sheets_url:a.trim()})});const _=await(await t("/api/landing/integrations/sheets-test",{method:"POST"})).json();u(_.ok?'Listo: revisa tu hoja, debe aparecer una fila "prueba" â':_.message||"No se pudo enviar.")}catch{u("Error de conexión.")}finally{c(!1),setTimeout(()=>u(""),6e3)}},$=o.split(/[\n,;]+/).map(C=>C.replace(/\D/g,"")).filter(C=>C.length>=7).length;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{...Jt,marginBottom:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,marginBottom:9},children:[e.jsx("span",{style:{width:40,height:40,borderRadius:11,background:"#0F9D58",flex:"none",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 10px -3px rgba(15,157,88,.55), inset 0 0 0 1px rgba(255,255,255,.14)"},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),e.jsx("path",{d:"M4 9h16M4 15h16M10 3v18"})]})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em"},children:"Google Sheets en vivo"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Cada pedido y cambio de estado cae solo en tu hoja"})]})]}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 12px",lineHeight:1.5},children:"En tiempo real, sin entrar a Lumy. Ideal si le manejas la tienda a un cliente: le compartes la hoja y ve todo (pedidos y carritos abandonados incluidos)."}),e.jsx("button",{onClick:()=>v(C=>!C),style:{...ee,marginBottom:10},children:b?"Ocultar instrucciones":"Cómo conectar mi hoja (3 pasos)"}),b&&e.jsxs("div",{style:{background:"var(--input-bg, #f4f6fa)",borderRadius:12,padding:14,fontSize:12.5,lineHeight:1.6,marginBottom:12},children:[e.jsx("b",{children:"1."})," Abre una hoja nueva en Google Sheets â menú ",e.jsx("b",{children:"Extensiones â Apps Script"}),".",e.jsx("br",{}),e.jsx("b",{children:"2."})," Borra lo que haya, pega este código y guarda:",e.jsxs("div",{style:{position:"relative",margin:"8px 0"},children:[e.jsx("pre",{style:{background:"#0f172a",color:"#e2e8f0",borderRadius:10,padding:"10px 12px",fontSize:11,overflowX:"auto",margin:0},children:Zy}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(Zy).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}).catch(()=>{})},style:{...ee,position:"absolute",top:8,right:8,padding:"4px 10px",fontSize:11},children:g?"Copiado â":"Copiar"})]}),e.jsx("b",{children:"3."})," Arriba a la derecha: ",e.jsx("b",{children:"Implementar â Nueva implementación â Aplicación web"}),'. En "Quién tiene acceso" elige ',e.jsx("b",{children:"Cualquier persona"}),". Copia la ",e.jsx("b",{children:"URL del Web App"})," y pégala aquà abajo."]}),e.jsx("label",{style:D,children:"URL del Web App de tu hoja"}),e.jsx("input",{style:{...E,fontFamily:"monospace",fontSize:13},value:a,onChange:C=>n(C.target.value),placeholder:"https://script.google.com/macros/s/â¦/exec"}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{onClick:j,disabled:m,style:{...xa,opacity:m?.6:1},children:"Guardar"}),e.jsx("button",{onClick:S,disabled:m||!a.trim(),style:{...ee,opacity:m||!a.trim()?.6:1},children:"Probar (envÃa 1 fila)"}),s&&e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:/â|Listo/.test(s)?"#16a34a":"var(--text-muted)"},children:s})]})]}),e.jsxs("div",{style:{...Jt,marginBottom:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,marginBottom:9},children:[e.jsx("span",{style:{width:40,height:40,borderRadius:11,background:"#334155",flex:"none",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 10px -3px rgba(51,65,85,.5), inset 0 0 0 1px rgba(255,255,255,.12)"},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3l7 3v5c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z"}),e.jsx("path",{d:"M9.5 9.5l5 5M14.5 9.5l-5 5"})]})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em",display:"flex",alignItems:"center",gap:7},children:["Lista negra de clientes",$>0&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",fontWeight:800,background:"var(--input-bg,#f1f3f8)",borderRadius:999,padding:"2px 8px"},children:$})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Los que no pagan o rechazan entregas"})]})]}),e.jsxs("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"0 0 10px",lineHeight:1.5},children:["Teléfonos (uno por lÃnea). Cuando pidan, el pedido queda registrado pero ",e.jsx("b",{children:"no se les manda confirmación automática"})," y se marca en ",e.jsx("b",{children:"Novedad"})," para que lo revises antes de despachar."]}),e.jsx("textarea",{style:{...E,minHeight:90,fontFamily:"monospace",fontSize:13},value:o,onChange:C=>i(C.target.value),placeholder:`3001234567 10833009876543`}),e.jsx("div",{style:{marginTop:10},children:e.jsx("button",{onClick:j,disabled:m,style:{...xa,opacity:m?.6:1},children:"Guardar lista"})})]})]})}function E8(){const t=$a(),[a,n]=h.useState(null),[o,i]=h.useState(""),[s,u]=h.useState(""),[m,c]=h.useState(""),[g,f]=h.useState({}),[b,v]=h.useState(!1),[j,S]=h.useState(""),$=h.useCallback(()=>{t("/api/landing/integrations/lucidbot").then(z=>z.json()).then(z=>{z.ok&&(n(z),u(z.flow_id||""),c(z.recovery_flow_id||""),f(z.mapping||{}))}).catch(()=>{})},[t]);h.useEffect(()=>{$()},[$]);const C=!!(a!=null&&a.connected),_=(a==null?void 0:a.flows)||[],N=(a==null?void 0:a.fields)||[],w=async(z,G)=>{v(!0),S("");try{const U=await(await t("/api/landing/integrations/lucidbot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)})).json();return U.ok?(S(G),setTimeout(()=>S(""),2500),$(),!0):(S(U.message||"No se pudo guardar."),!1)}catch{return S("Sin conexión"),!1}finally{v(!1)}},M=async()=>{o.trim()&&await w({token:o.trim(),flow_id:s,recovery_flow_id:m,mapping:g},"Conectado â")&&i("")},p=()=>w({flow_id:s,recovery_flow_id:m,mapping:g},"Guardado â"),V=async()=>
1083{if(confirm('¿Desconectar LucidBot? Las landings con "Enviar a LucidBot" dejarán de mandar pedidos hasta reconectar.')){v(!0);try{await t("/api/landing/integrations/lucidbot/disconnect",{method:"POST"}),n({connected:!1,flows:[],fields:[]}),i(""),S("")}finally{v(!1)}}},L=(z,G)=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,marginTop:6},children:[e.jsx("span",{style:{width:82,color:"var(--text-muted)"},children:G}),e.jsxs("select",{style:{...E,flex:1,marginTop:0},value:g[z]||"",onChange:B=>f(U=>({...U,[z]:B.target.value})),children:[e.jsx("option",{value:"",children:"(no enviar)"}),N.map(B=>e.jsx("option",{value:B.id,children:B.name},B.id))]})]}),x="linear-gradient(90deg, #6366F1 0%, #A855F7 100%)";return e.jsx("div",{children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(340px, 100%), 1fr))",gap:14,alignItems:"start"},children:e.jsxs("div",{style:{...Jt,padding:0,overflow:"hidden"},children:[e.jsx("div",{style:{height:4,background:x}}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(gc,{src:"/logos/lucidbot.png",bg:"#6366F1",fit:"cover"}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.01em"},children:"LucidBot"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Confirma pedidos contraentrega por WhatsApp"})]}),e.jsx(oi,{on:C})]}),C?e.jsxs("div",{style:{marginTop:14},children:[(a==null?void 0:a.valid)===!1&&e.jsx("div",{role:"alert",style:{background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:10,padding:"9px 11px",fontSize:12.5,color:"var(--danger)",marginBottom:10},children:"El token dejó de ser válido en LucidBot. Vuelve a conectarlo."}),e.jsx("label",{style:D,children:"¿Qué hace tu bot cuando entra el pedido?"}),e.jsxs("select",{style:E,value:s,onChange:z=>u(z.target.value),children:[e.jsx("option",{value:"",children:"Solo guardar el contacto (no le escribe)"}),_.map(z=>e.jsxs("option",{value:z.id,children:["Iniciar: ",z.name]},z.id))]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 2px 0",lineHeight:1.45},children:["Elige la ",e.jsx("b",{children:"automatización de tu LucidBot que confirma el pedido"})," (la que le escribe al cliente por WhatsApp)."]}),_.length>0&&!_.some(z=>!/^\s*system/i.test(z.name))&&e.jsxs("div",{role:"status",style:{background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:10,padding:"9px 11px",margin:"8px 0 0",fontSize:12,color:"var(--notice-warning-text)",lineHeight:1.45},children:["Aún no tienes un ",e.jsx("b",{children:"flujo de confirmación propio"})," en LucidBot (solo aparece el de ejemplo del sistema). Créalo en LucidBot y vuelve a esta pantalla para elegirlo aquÃ."]}),e.jsx("label",{style:{...D,marginTop:12},children:"Carrito abandonado (opcional)"}),e.jsxs("select",{style:E,value:m,onChange:z=>c(z.target.value),children:[e.jsx("option",{value:"",children:"No recuperar carritos abandonados"}),_.map(z=>e.jsxs("option",{value:z.id,children:["Iniciar: ",z.name]},z.id))]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 2px 0",lineHeight:1.45},children:'Si un cliente empieza a pedir y no termina, a los ~20 minutos LucidBot le escribe con este flujo para recuperarlo. Déjalo en "No recuperar" si no lo quieres.'}),e.jsxs("details",{style:{marginTop:12},children:[e.jsx("summary",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-muted)",cursor:"pointer"},children:"Avanzado: pasar los datos del pedido a campos de tu bot (opcional)"}),e.jsxs("div",{style:{marginTop:8},children:[e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 4px",lineHeight:1.45},children:"Solo si tu bot usa campos para leer el pedido. Si no sabes qué es, déjalo asÃ: igual le llega el nombre y el teléfono."}),L("producto","Producto"),L("valor","Valor"),L("direccion","Dirección"),L("ciudad","Ciudad")]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:14},children:[e.jsx("button",{type:"button",onClick:p,disabled:b,style:{background:x,color:"#fff",border:0,borderRadius:11,padding:"10px 18px",fontSize:13.5,fontWeight:800,cursor:"pointer",opacity:b?.7:1},children:b?"Guardandoâ¦":"Guardar"}),e.jsx("button",{type:"button",onClick:V,style:{...ee,padding:"8px 14px",fontSize:12.5,color:"var(--danger)",borderColor:"var(--notice-danger-border)"},children:"Desconectar"}),j&&e.jsx("span",{role:"status",style:{fontSize:12.5,color:j.includes("â")?"var(--success)":"var(--danger)"},children:j})]})]}):e.jsxs("div",{style:{display:"grid",gap:9,marginTop:14},children:[e.jsx("input",{style:{...E,fontFamily:"monospace"},value:o,onChange:z=>i(z.target.value),placeholder:"Pega tu token de LucidBot"}),e.jsx("button",{type:"button",onClick:M,disabled:b||!o.trim(),style:{background:x,color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",opacity:b||!o.trim()?.7:1,boxShadow:"0 6px 18px -8px rgba(124,58,237,.7)"},children:b?"Conectandoâ¦":"Conectar LucidBot"}),e.jsxs("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:["Tu token está en LucidBot: ",e.jsx("b",{children:"Ajustes â Integraciones â API"}),". Se guarda cifrado."]}),j&&e.jsx("span",{role:"status",style:{fontSize:12.5,color:j.includes("â")?"var(--success)":"var(--danger)"},children:j})]})]})]})})})}
1083function Up({src:t,bg:a,fit:n,pad:o,nombre:i,detalle:s,estado:u}){return e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:14},children:[e.jsx(gc,{src:t,bg:a,fit:n,pad:o,size:56}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:16.5,fontWeight:800,letterSpacing:"-.01em",color:"var(--text, #111)"},children:i}),u]}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginTop:4,lineHeight:1.45},children:s})]})]})}function Fl({etiqueta:t,...a}){return e.jsxs("label",{style:{display:"grid",gap:5},children:[e.jsx("span",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-secondary)"},children:t}),e.jsx("input",{style:E,...a})]})}function Qp({children:t}){const[a,n]=h.useState(!1);return e.jsxs("div",{style:{marginTop:2},children:[e.jsxs("button",{type:"button",onClick:()=>n(o=>!o),style:{background:"transparent",border:0,padding:0,cursor:"pointer",fontFamily:"inherit",fontSize:12,fontWeight:700,color:"var(--accent-blue, #2563EB)",display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{fontSize:10,transform:a?"rotate(90deg)":"none",transition:"transform .15s"},children:"â¶"}),"¿Dónde saco estas llaves?"]}),a&&e.jsx("div",{style:{marginTop:8,padding:"10px 12px",background:"var(--bg-tertiary)",border:"1px solid var(--border)",borderRadius:10,fontSize:12,color:"var(--text-secondary)",lineHeight:1.55},children:t})]})}function z8(){const t=$a(),[a,n]=h.useState(null),[o,i]=h.useState({public_key:"",secret_key:""}),[s,u]=h.useState(""),[m,c]=h.useState(""),[g,f]=h.useState(""),[b,v]=h.useState(""),[j,S]=h.useState(""),[$,C]=h.useState(""),_=h.useCallback(()=>{t("/api/landing/payments/status").then(U=>U.json()).then(U=>{U.ok&&n(U)}).catch(()=>{})},[t]);h.useEffect(()=>{_()},[_]);const N=U=>((a==null?void 0:a.providers)||[]).find(ne=>ne.id===U)||{},w=async()=>{if(!o.public_key.trim()||!o.secret_key.trim()){C("Pega las dos llaves de Bold.");return}S("bold"),C("");try{const ne=await(await t("/api/landing/payments/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"bold",public_key:o.public_key.trim(),secret_key:o.secret_key.trim()})})).json();if(!ne.ok){C(ne.error||"No se pudo conectar.");return}i({public_key:"",secret_key:""}),_()}catch{C("Error de conexión.")}finally{S("")}},M=async()=>{S("mp"),C("");try{const ne=await(await t("/api/landing/payments/oauth/mercadopago/start")).json();if(!ne.ok||!ne.url){C(ne.error||"Mercado Pago no está disponible todavÃa.");return}window.open(ne.url,"_blank","width=520,height=720"),setTimeout(_,4e3)}catch{C("Error de conexión.")}finally{S("")}},p=async()=>{if(!s.trim()||!m.trim()){C("Pega tu Access Token y tu Clave secreta del webhook de Mercado Pago.");return}S("mp"),C("");try{const ne=await(await t("/api/landing/payments/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"mercadopago",access_token:s.trim(),webhook_secret:m.trim()})})).json();if(!ne.ok){C(ne.error||"No se pudo conectar.");return}u(""),c(""),_()}catch{C("Error de conexión.")}finally{S("")}},V=async U=>{confirm("¿Desconectar esta pasarela? Los botones de pago dejarán de aparecer en tus landings.")&&(await t("/api/landing/payments/disconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:U})}).catch(()=>{}),_())},L=N("bold"),x=N("mercadopago"),z=N("paypal"),G="linear-gradient(90deg, #F5394E 0%, #7A2B8E 55%, #2A1A6C 100%)",B="#00A9E0";return e.jsxs("div",{children:[$&&e.jsx("div",{role:"alert",style:{color:"var(--danger)",fontSize:12.5,marginBottom:10,fontWeight:600},children:$}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(340px, 100%), 1fr))",gap:14,alignItems:"start"},children:[e.jsx("div",{style:{...Jt,padding:18},children:e.jsxs("div",{children:[e.jsx(Up,{src:"/pay/bold.png",bg:"#2A1A6C",nombre:"Bold",detalle:"Tarjetas, PSE, Nequi y más",estado:e.jsx(oi,{on:!!L.connected,error:!!L.last_error||L.status==="error"})}),e.jsx(Vp,{marca:"Bold",p:L}),L.connected&&!L.last_error?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{type:"button",onClick:()=>V("bold"),style:{...ee,padding:"6px 12px",fontSize:12},children:"Desconectar"})}):e.jsxs("div",{style:{display:"grid",gap:11,marginTop:16},children:[e.jsx(Fl,{etiqueta:"Llave de identidad (API key)",value:o.public_key,onChange:U=>i(ne=>({...ne,public_key:U.target.value}))}),e.jsx(Fl,{etiqueta:"Llave secreta",type:"password",autoComplete:"off",value:o.secret_key,onChange:U=>i(ne=>({...ne,secret_key:U.target.value}))}),e.jsx("button",{type:"button",onClick:w,disabled:j==="bold",style:{background:G,color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",opacity:j==="bold"?.7:1},children:j==="bold"?"Conectandoâ¦":L.last_error||L.status==="error"?"Volver a conectar Bold":"Conectar Bold"}),e.jsxs(Qp,{children:["Las sacas de tu panel de Bold: ",e.jsx("b",{children:"Integraciones â Llaves de API"}),". Arriba va la ",e.jsx("b",{children:"Llave de identidad"})," y abajo la ",e.jsx("b",{children:"secreta"}),". Se guardan cifradas."]})]})]})}),e.jsx("div",{style:{...Jt,padding:18},children:e.jsxs("div",{children:[e.jsx(Up,{src:"/pay/mercadopago.webp",bg:"#00A9E0",nombre:"Mercado Pago",detalle:"Tarjetas, PSE y saldo de Mercado Pago",estado:e.jsx(oi,{on:!!x.connected,error:!!x.last_error||x.status==="error"})}),e.jsx(Vp,{marca:"Mercado Pago",p:x}),x.connected&&!x.last_error?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{type:"button",onClick:()=>V("mercadopago"),style:{...ee,padding:"6px 12px",fontSize:12},children:"Desconectar"})}):a&&a.mp_token_ready?e.jsxs("div",{style:{display:"grid",gap:11,marginTop:16},children:[e.jsx(Fl,{etiqueta:"Access Token de producción",value:s,onChange:U=>u(U.target.value)}),e.jsx(Fl,{etiqueta:"Clave secreta del webhook",type:"password",autoComplete:"off",value:m,onChange:U=>c(U.target.value)}),e.jsx("button",{type:"button",onClick:p,disabled:j==="mp",style:{background:B,color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",opacity:j==="mp"?.7:1},children:j==="mp"?"Conectandoâ¦":"Conectar Mercado Pago"}),e.jsxs(Qp,{children:["En Mercado Pago, entra a ",e.jsx("b",{children:"Tus integraciones"}),": copia el ",e.jsx("b",{children:"Access Token"})," (Credenciales de producción) y la ",e.jsx("b",{children:"Clave secreta"})," (Webhooks). Es de tu cuenta de tu paÃs. Se guardan cifrados."]})]}):a&&a.mp_oauth_ready?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{type:"button",onClick:M,disabled:j==="mp",style:{background:B,color:"#fff",border:0,borderRadius:10,padding:"9px 16px",fontSize:13,fontWeight:800,cursor:"pointer",opacity:j==="mp"?.5:1,boxShadow:"0 6px 18px -8px rgba(0,169,224,.7)"},children:j==="mp"?"Abriendoâ¦":"Conectar"})}):e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",display:"block",marginTop:10},children:"Se habilita pronto (falta terminar de configurar Mercado Pago en Lumy)."})]})}),e.jsx("div",{style:{...Jt,padding:18},children:e.jsxs("div",{children:[e.jsx(Up,{src:"/pay/paypal.png",bg:"#ffffff",fit:"contain",pad:10,nombre:"PayPal",detalle:"México (MXN) y cuentas en dólares (USD)",estado:e.jsx(oi,{on:!!z.connected,error:!!z.last_error||z.status==="error"})}),e.jsx(Vp,{marca:"PayPal",p:z}),z.connected&&!z.last_error?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{type:"button",onClick:()=>V("paypal"),style:{...ee,padding:"6px 12px",fontSize:12},children:"Desconectar"})}):e.jsxs("div",{style:{display:"grid",gap:9,marginTop:14},children:[e.jsx(Fl,{etiqueta:"Client ID (app Live)",value:g,onChange:U=>f(U.target.value)}),e.jsx(Fl,{etiqueta:"Secret",type:"password",autoComplete:"off",value:b,onChange:U=>v(U.target.value)}),e.jsx("button",{type:"button",onClick:async()=>
1083{if(!j){S("pp"),C("");try{const U=await t("/api/landing/payments/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"paypal",public_key:g.trim(),secret_key:b.trim()})}),ne=await U.json().catch(()=>({}));U.ok&&ne.ok?(f(""),v(""),_()):C(ne.error||"No se pudo conectar PayPal.")}catch{C("Error de conexión.")}S("")}},disabled:j==="pp",style:{background:"#003087",color:"#fff",border:0,borderRadius:11,padding:"11px 18px",fontSize:14,fontWeight:800,cursor:"pointer",opacity:j==="pp"?.7:1},children:j==="pp"?"Conectandoâ¦":"Conectar PayPal"}),e.jsxs(Qp,{children:["Crea una app en ",e.jsx("b",{children:"developer.paypal.com"})," (My Apps & Credentials, modo Live, cuenta Business) y pega el Client ID y el Secret. PayPal cobra su comisión por venta (revisa las tarifas de tu paÃs en su página oficial). No recibe pesos colombianos, chilenos ni soles."]})]})]})})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",textAlign:"center",marginTop:14},children:"Addi y Sistecrédito (crédito a cuotas) llegan después."})]})}function ev({cfg:t,setCfg:a,moneda:n,abierta:o,conectadas:i}){const s=t.payment_methods||{contraentrega:!0},u=v=>PS(v,i,n),m=v=>v==="contraentrega"?s.contraentrega!==!1:$u(s,i,n).includes(v),c=(v,j)=>["contraentrega","bold","mercadopago","paypal"].filter(S=>S===v?j:m(S)).length,g=(v,j)=>{!j&&c(v,j)<1||a(S=>({...S,payment_methods:{...S.payment_methods||{contraentrega:!0},[v]:j}}))},f=s.contraentrega===!1,b=v=>m(v)&&c(v,!1)<1;return e.jsxs(ht,{title:"Botones de pago",defaultOpen:o,children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 12px",lineHeight:1.55},children:"Elige qué botones mostrar en este formulario. Las pasarelas se conectan una sola vez en la pestaña Pagos. Sin conectar, solo aparece el pago contraentrega."}),e.jsx("div",{style:{display:"grid",gap:9},children:[["contraentrega","Pago contraentrega",!0],["bold","Pagar con Bold",!u("bold")],["mercadopago","Pagar con Mercado Pago",!u("mercadopago")],["paypal","Pagar con PayPal",!u("paypal")]].map(([v,j,S])=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,fontSize:13.5,opacity:S?1:.45,cursor:S&&!b(v)?"pointer":"not-allowed"},children:[e.jsx("input",{type:"checkbox",disabled:!S||b(v),checked:v==="contraentrega"?s.contraentrega!==!1:!!s[v],onChange:$=>g(v,$.target.checked)}),e.jsxs("span",{children:[j,!S&&v!=="contraentrega"&&e.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)",marginLeft:6},children:["(",u(v)||"conéctala en Pagos",")"]})]})]},v))}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"9px 0 0",lineHeight:1.5},children:"Si quitas contraentrega, la landing pedirá pago en lÃnea únicamente."}),f&&$u(s,i,n).length===0&&e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--warning)",margin:"6px 0 0",lineHeight:1.5},children:"Marca y conecta una pasarela (Bold o Mercado Pago) para poder cobrar; si no, la landing seguirá aceptando contraentrega."}),$u(s,i,n).length>0&&e.jsxs("div",{style:{marginTop:14,paddingTop:14,borderTop:"1px solid var(--border, #eef1f6)"},children:[e.jsx("label",{style:D,children:"Descuento por pagar en lÃnea (opcional)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:50,value:t.online_discount||"",placeholder:"0",onChange:v=>{const j=Math.max(0,Math.min(50,Math.round(Number(v.target.value)||0)));a(S=>({...S,online_discount:j}))},style:{...E,width:84,textAlign:"center",marginBottom:0}}),e.jsx("span",{style:{fontSize:15,fontWeight:800,color:"var(--text)"},children:"%"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"7px 0 0",lineHeight:1.5},children:'Premia a quien paga por adelantado: aparece en el botón ("X% de descuento") y se descuenta del cobro en lÃnea. La contraentrega paga el precio completo. Pagar online reduce devoluciones.'})]})]})}function Ei({children:t}){return e.jsx("div",{style:{fontSize:11,fontWeight:800,letterSpacing:".07em",textTransform:"uppercase",color:"var(--text-muted, #94a3b8)",margin:"20px 4px 8px"},children:t})}function tv({value:t,onChange:a,brand:n,hint:o}){const i=!!n&&t.trim()===n.trim();return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Nombre de tu tienda (aparece arriba como tu marca)"}),e.jsx("input",{style:E,value:t,onChange:s=>a(s.target.value),placeholder:n||"Ej: Bella Importados"}),n&&!i&&e.jsxs("button",{type:"button",onClick:()=>a(n),style:{marginTop:6,background:"rgba(8,102,255,.07)",border:"1px dashed rgba(8,102,255,.4)",color:me,fontSize:11.5,fontWeight:700,cursor:"pointer",padding:"6px 10px",borderRadius:9},children:["Usar el de mi Tienda: «",n,"»"]}),e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"6px 2px 0",lineHeight:1.45},children:[n?e.jsxs(e.Fragment,{children:["Tu Tienda se llama ",e.jsx("b",{children:n}
1083),". Déjalo igual para que tu marca sea consistente. "]}):null,o]})]})}function R8({id:t,onBack:a}){var Oc,ul,bd,Hc,Gc,yd,Si,pl,$r,Vc,wi,ki,No,gl,vd,Uc,ml,_s,jd,Kr,Ad,Qc,hl,fl,Ci,xl,Sd,Kc,$s,Is,wd,Yc,kd,bl,yl,Cd,Jc,_d,Zc,Xc,eu,$d,Id,vl,tu,Ts,jl,Al,Td,dp,_i,Sl,Ed,zd,Rd,Nd,Ld,Pd,Dd,Bd,Wd,qd,Md,Fd,Od,Hd,Gd,Vd,Ud,d,A,T,O,W,J,le,Ve,gt,Qe,Z,Rt,Yt,Ht,nt,Bt,ca,Vt,va,qt,io,Uo,Se,It,_t,Dt,Ce,Kt,pa,_a,tn,an,vo,so,$i,wl,_e,ua,Mt,Tn,es,ym,vm,jm,Am,Sm,wm,km,Cm,_m,$m,Im,Tm,Em,zm,Rm,Nm,Lm,Pm,Dm,Bm,Wm,qm,Mm,Fm,Om,Hm,Gm,Vm,Um,Qm,Km,Ym,Jm,Zm,Xm,eh,th,ah,nh,oh,rh,ih,sh,lh,dh,ch,uh,ph,gh,mh,hh,fh,xh,bh,yh,vh,jh,Ah,Sh,wh,kh,Ch,_h,$h,Ih,Th,Eh,zh,Rh,Nh,Lh,Ph,Dh,Bh,Wh,qh,Mh,Fh,Oh,Hh,Gh,Vh,Uh,Qh,Kh,Yh,Jh,Zh,Xh,ef,tf,af,nf,of,rf,sf,lf,df,cf,uf,pf,gf,mf,hf,ff,xf,bf,yf,vf,jf,Af,Sf,wf,kf,Cf,_f,$f,If,Tf,Ef,zf,Rf,Nf,Lf,Pf,Df,Bf,Wf,qf,Mf,Ff,Of,Hf,Gf,Vf,Uf,Qf,Kf,Yf,Jf,Zf,Xf,ex,tx,ax,nx,ox,rx,ix,sx,lx,dx,cx,ux,px,gx,mx,hx,fx,xx,bx,yx,vx,jx,Ax,Sx,wx,kx,Cx,_x,$x,Ix,Tx,Ex,zx,Rx,Nx,Lx,Px,Dx,Bx,Wx,qx,Mx,Fx,Ox,Hx,Gx,Vx,Ux,Qx,Kx,Yx,Jx,Zx,Xx,e0,t0,a0,n0,o0,r0,i0,s0,l0,d0,c0,u0,p0,g0,m0,h0,f0,x0,b0,y0,v0,j0,A0,S0,w0,k0,C0,_0,$0,I0,T0,E0,z0,R0,N0,L0,P0,D0,B0,W0,q0,M0,F0,O0,H0,G0,V0,U0,Q0,K0,Y0,J0,Z0,X0,e1,t1,a1,n1,o1,r1,i1,s1,l1,d1,c1,u1,p1,g1,m1,h1,f1;const n=$a(),[o,i]=h.useState([]);h.useEffect(()=>{n("/api/landing/payments/status").then(r=>r.json()).then(r=>{r!=null&&r.ok&&i((r.providers||[]).filter(l=>l.connected).map(l=>String(l.id)))}).catch(()=>{})},[n]);const s=ni(),u=((Oc=s.user)==null?void 0:Oc.role)==="admin",m=sv(u).rutaApagada("/paginas"),c=Uj(Number(((ul=s.user)==null?void 0:ul.id)||0),t),[g,f]=h.useState(null),[b,v]=h.useState([]),j=b[0]||null,[S,$]=h.useState(!1),C=h.useRef(!1),_=h.useRef(new Set),[N,w]=h.useState(!1),M=h.useRef(null);h.useEffect(()=>{const r=M.current;if(r)return N?r.setAttribute("inert",""):r.removeAttribute("inert"),()=>r.removeAttribute("inert")},[N]);const[p,V]=h.useState({}),L=h.useRef({variants:[],bundles:[]}),x=h.useCallback(r=>{C.current||V(r)},[]),[z,G]=h.useState(null),[B,U]=h.useState(null),ne=dv().limits,[Q,de]=h.useState(""),[pe,ce]=h.useState([]),[ve,ge]=h.useState(""),[Te,ie]=h.useState(!1),[fe,Be]=h.useState([]),[We,ze]=h.useState(null),[tt,Fe]=h.useState(""),[F,Re]=h.useState(null),K=!!tt.trim()&&!/\.(l\.ecomdroptv|lumycol)\.com$/i.test(tt.trim()),[I,H]=h.useState(""),[ye,De]=h.useState(""),[Ue,se]=h.useState(""),[we,Ye]=h.useState(""),[lt,jt]=h.useState(!1);h.useEffect(()=>{n("/api/landing/store").then(r=>r.json()).then(r=>{if(r&&r.ok&&r.store){r.store.name&&se(String(r.store.name));const l=String(r.store.store_domain||"");l&&!qi(l)&&Ye(l),jt(!!r.store.enabled)}}).catch(()=>{})},[n]);const Je=!!tt.trim()&&K&&au(tt.trim())||!!(g!=null&&g.use_lumy_domain)&<&&!!we&&au(we),Ct=Je?"":we&&au(we)&&(g!=null&&g.use_lumy_domain)&&!lt?`Tu dominio ${we} ya está conectado, pero a tu tienda, y la tienda está apagada: asà ese dominio no muestra tus páginas. Enciéndela en el menú «Activar tienda» y tu JavaScript correrá en ${we}.`:we&&au(we)&&!(g!=null&&g.use_lumy_domain)?`Tu dominio ${we} está conectado, pero esta página no está publicada en él. EscrÃbenos por el chat de soporte y la pasamos a tu dominio.`:"Tu JavaScript solo corre en tu propio dominio. Conéctalo en «PÃxeles y dominios» y asÃgnaselo a esta página.",[st,la]=h.useState("");h.useEffect(()=>{la(String((g==null?void 0:g.slug)||""))},[g==null?void 0:g.slug]);const ia=async()=>{if(!(st.length<3||st===g.slug)&&!(xt==="published"&&!confirm(`¿Cambiar la dirección a "${st}"? 1084 1085La dirección vieja deja de funcionar de una vez. Si tienes anuncios apuntando ahÃ, cámbiales el enlace.`))&&await Ai(!0))try{const r=await n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:st,expected_updated_at:un.current||void 0})}),l=await r.json();l.ok&&l.page?(un.current=String(l.page.updated_at||un.current),f(l.page),V(os(l.page.config||{})),ue(xt==="published"?"Dirección cambiada â · la vieja dejó de funcionar":"Dirección cambiada â"),setTimeout(()=>ue(""),9e3)):r.status===401?ue("Sin guardar: tu sesión se venció. Vuelve a entrar"):ue(l.message||"No se pudo cambiar la dirección")}catch{ue("No se pudo cambiar la dirección. Revisa tu conexión")}finally{zt()}},ha=st.length>=3&&st!==(g==null?void 0:g.slug),da=we&&(g!=null&&g.use_lumy_domain)?`${we}/`:g!=null&&g.custom_domain?`${g.custom_domain}/ (tu dominio abre en la raÃz) · lumycol.com/l/`:g!=null&&g.use_lumy_domain?"lumycol.com/l/":"/l/",[Na,wa]=h.useState({ready:!1,cname_target:"landings.lumycol.com"}),[La,Gt]=h.useState(!1);K2(tt);const he=/\.(l\.ecomdroptv|lumycol)\.com$/i.test(tt.trim())?tt.trim().replace(/\.(l\.ecomdroptv|lumycol)\.com$/i,""):"",Me=r=>{const l=r.toLowerCase().replace(/[^a-z0-9-]/g,"");Fe(l?l+".lumycol.com":"")},[yt,kt]=h.useState(null);h.useEffect(()=>{n("/api/landing/domains").then(r=>r.json()).then(r=>{r!=null&&r.ok&&kt(new Set((r.dominios||[]).filter(l=>(l==null?void 0:l.estado)==="listo").map(l=>String(l.dominio))))}).catch(()=>{})},[n]);const ct=h.useCallback(()=>{n(`/api/landing/pages/${t}/domain-status`).then(r=>r.json()).then(r=>{r.ok&&Re(r)}).catch(()=>{})},[n,t]),[xt,Ut]=h.useState("draft"),[Qt,$e]=h.useState(!1),[Pe,ue]=h.useState(""),[oe,Ae]=h.useState(!1),[He,ut]=h.useState(!1),[at,dt]=h.useState(!1),[Ge,vt]=h.useState(!1),[Nt,sa]=h.useState(!1),[Pa,Ot]=h.useState(""),[Ia,za]=h.useState(!1),[sn,ba]=h.useState(null);h.useEffect(()=>{n("/api/dropi-v2/status").then(r=>r.json()).then(r=>ba(!!(r!=null&&r.connected))).catch(()=>ba(null))},[n]);const[Ga,Ie]=h.useState(null);h.useEffect(()=>{n("/api/landing/integrations/lucidbot?solo_estado=1").then(r=>r.json()).then(r=>Ie(!!(r!=null&&r.connected&&(r!=null&&r.flow_id)))).catch(()=>Ie(!1))},[n]);const[ka,Zo]=h.useState([]);h.useEffect(()=>{n("/api/landing/dropi-accounts").then(r=>r.json()).then(r=>Zo(Array.isArray(r==null?void 0:r.accounts)?r.accounts:[])).catch(()=>Zo([]))},[n]);const[Cn,Xo]=h.useState(!1);h.useEffect(()=>{Promise.all([n("/api/mastershop/connection").then(r=>r.json()).catch(()=>({})),n("/api/plan/limits").then(r=>r.json()).catch(()=>({}))]).then(([r,l])=>{var R;const y=(l==null?void 0:l.limits)||{};Xo(!!(r!=null&&r.connected)&&(!!((R=y==null?void 0:y.mastershop)!=null&&R.enabled)||(y==null?void 0:y.source)==="legacy"||(y==null?void 0:y.source)==="courtesy"))}).catch(()=>Xo(!1))},[n]);const[Nn,er]=h.useState(!1);h.useEffect(()=>{Promise.all([n("/api/envios99/connection").then(r=>r.json()).catch(()=>({})),n("/api/plan/limits").then(r=>r.json()).catch(()=>({}))]).then(([r,l])=>{var R;const y=(l==null?void 0:l.limits)||{};er(!!(r!=null&&r.connected)&&(!!((R=y==null?void 0:y.envios99)!=null&&R.enabled)||(y==null?void 0:y.source)==="legacy"||(y==null?void 0:y.source)==="courtesy"))}).catch(()=>er(!1))},[n]),h.useEffect(()=>{n("/api/landing/saas-status").then(r=>r.json()).then(r=>{r!=null&&r.ok&&wa({ready:!!r.ready,cname_target:r.cname_target||"landings.lumycol.com"})}).catch(()=>{})},[n]);const[Oa,Xa]=h.useState("landing");h.useEffect(()=>{Oa!=="pixeles"||We!==null||n("/api/meta/pixels").then(r=>r.json()).then(r=>ze(Array.isArray(r==null?void 0:r.pixels)?r.pixels:[])).catch(()=>ze([]))},[Oa,We,n]),h.useEffect(()=>{const r=()=>window.dispatchEvent(new CustomEvent(b1,{detail:{landingId:t,landingNombre:String((g==null?void 0:g.name)||"").slice(0,120),pestana:Oa}}));return r(),window.addEventListener(x1,r),()=>{window.removeEventListener(x1,r),window.dispatchEvent(new CustomEvent(b1,{detail:null}))}},[t,g==null?void 0:g.name,Oa]),h.useEffect(()=>{const r=l=>{const y=l==null?void 0:l.detail;if((y==null?void 0:y.tipo)!=="editor-landing"||y.landingId&&Number(y.landingId)!==Number(t))return;y.consumido=!0;const R=[{tab:y.tab,secciones:y.secciones,campo:y.campo},...Array.isArray(y.alternativas)?y.alternativas:[]],P=xe=>{try{window.dispatchEvent(new CustomEvent("lumy:guia-seccion",{detail:{ok:xe,secciones:y.secciones}}))}catch{}},re=xe=>{const Le=R[xe];if(!Le){P(!1);return}Xa(Le.tab);const Ee=()=>{const Oe={titles:Le.secciones,field:Le.campo||""};try{window.dispatchEvent(new CustomEvent("lumy:open-section",{detail:Oe}))}catch{}return!!Oe.consumed};setTimeout(()=>{if(Ee())return P(!0);setTimeout(()=>{Ee()?P(!0):re(xe+1)},600)},160)};re(0)};return window.addEventListener("lumy:guia-ir",r),()=>window.removeEventListener("lumy:guia-ir",r)},[t]);const Kn=()=>{Xa("diseno"),setTimeout(()=>{const r=document.getElementById("seccion-codigo-libre");
1085if(r){r.scrollIntoView({behavior:"smooth",block:"start"});try{r.animate([{boxShadow:"0 0 0 3px rgba(8,102,255,.4)",borderRadius:"14px"},{boxShadow:"0 0 0 14px rgba(8,102,255,0)",borderRadius:"14px"}],{duration:850,iterations:2})}catch{}}},180)},qa=()=>{Xa("pixeles"),setTimeout(()=>{const r=document.getElementById("seccion-dominio");if(r){r.scrollIntoView({behavior:"smooth",block:"start"});try{r.animate([{boxShadow:"0 0 0 3px rgba(245,158,11,.5)",borderRadius:"14px"},{boxShadow:"0 0 0 14px rgba(245,158,11,0)",borderRadius:"14px"}],{duration:850,iterations:2})}catch{}}},180)},_n=()=>e.jsx("button",{type:"button",onClick:qa,style:{display:"block",marginTop:8,background:"#b45309",color:"#fff",border:"none",borderRadius:9,padding:"7px 13px",fontSize:12.5,fontWeight:800,cursor:"pointer"},children:"Conectar mi dominio â"}),Va=({que:r})=>e.jsxs("button",{type:"button",onClick:Kn,style:{display:"inline-flex",alignItems:"center",gap:5,background:"transparent",border:"none",padding:"0 2px 8px",fontSize:12,fontWeight:700,color:"#0866ff",cursor:"pointer"},children:["⨠¿Quieres ",r," 100% a tu manera? Usa tu CSS o JavaScript â"]}),[mn,po]=h.useState(null),hn=h.useRef(null),Co=h.useRef({}),[go,fn]=h.useState(null),Da=h.useRef([]),Hn=h.useRef(!1),[Ra,ln]=h.useState(!1);h.useEffect(()=>{if(Hn.current){Hn.current=!1;return}const r=setTimeout(()=>{try{const l=JSON.stringify(p),y=Da.current;if(y[y.length-1]===l)return;y.push(l),y.length>30&&y.shift(),ln(y.length>1)}catch{}},700);return()=>clearTimeout(r)},[p]);const mo=(r,l)=>{Xa(r),Ln(null);const y={titles:l,title:l[0]};let R=0;const P=()=>{window.dispatchEvent(new CustomEvent("lumy:open-section",{detail:y})),R++,!y.consumed&&R<4&&setTimeout(P,300)};setTimeout(P,150)},X=()=>{const r=Da.current;if(r.length<2)return;r.pop();const l=r[r.length-1];try{Hn.current=!0,x(JSON.parse(l))}catch{}ln(r.length>1)};h.useLayoutEffect(()=>{const r=Co.current[Oa];if(!r){fn(null);return}const l={x:r.offsetLeft,w:r.offsetWidth};fn(y=>y&&y.x===l.x&&y.w===l.w?y:l)});const[ae,ot]=h.useState(()=>typeof window<"u"&&window.matchMedia("(min-width: 1120px)").matches),[it,ma]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-height: 800px)").matches);h.useEffect(()=>{const r=window.matchMedia("(max-height: 800px)"),l=()=>ma(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[]);const[ta,pn]=h.useState(!1),[Gn,Ln]=h.useState(null);h.useEffect(()=>{const r=window.matchMedia("(min-width: 1120px)"),l=()=>ot(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[]),h.useEffect(()=>{n("/api/landing/config").then(r=>r.json()).then(r=>{r.ok&&za(!!r.uploads)}).catch(()=>{}),n("/api/landing/settings").then(r=>r.json()).then(r=>{var xe;if(!r.ok)return;H(((xe=r.settings)==null?void 0:xe.default_subdomain)||"");const l=r.settings||{},y=[],R=(Le,Ee)=>{const Oe=String(Le||"").trim();Oe&&!y.some(St=>St.id===Oe)&&y.push({id:Oe,hasToken:!!String(Ee||"").trim()})};R(l.tiktok_pixel_id,l.tiktok_events_token);for(const Le of l.tiktok_pixels_extra||[])R(Le.id,Le.token);ce(y);const P=[],re=(Le,Ee)=>{const Oe=String(Le||"").replace(/[^0-9]/g,"").slice(0,20);Oe&&!P.some(St=>St.id===Oe)&&P.push({id:Oe,hasToken:!!String(Ee||"").trim()})};re(l.meta_pixel_id,l.meta_capi_token);for(const Le of l.meta_pixels_extra||[])re(Le.id,Le.token);Be(P)}).catch(()=>{})},[n]);const ho=h.useCallback(()=>Qj(()=>window.localStorage),[]),tr=h.useCallback(async r=>{let l=!1;if((r==null?void 0:r.snapshot_before)===!0&&r.snapshot_before_config&&typeof r.snapshot_before_config=="object"&&!Array.isArray(r.snapshot_before_config)){const y=`${String(r.editor_session_id||"")}:${Number(r.snapshot_before_generation||0)}`;if(l=_.current.has(y),!l)try{const R=await n(`/api/landing/pages/${t}/versions/snapshot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:r.snapshot_before_config})}),P=await R.json().catch(()=>({}));if(!R.ok||P.ok===!1)return null;_.current.add(y),l=!0}catch{return null}}return E1(r,l)},[n,t]);h.useEffect(()=>{let r=!1;return(async()=>{var xe,Le,Ee,Oe,St,rt,Ft;let l=!1;const y=ho(),R=y?Kj(y,c):[],P=R[0]||null;if(R.length>1&&(l=!0,v(R)),P&&R.length===1)try{const Tt=await tr(P);if(!Tt)throw new Error("snapshot_failed");const fa=await n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Tt)}),Ha=await fa.json().catch(()=>({}));fa.ok&&Ha.ok!==!1?y&&z1(y,c,P):(l=!0,v([P]))}catch{l=!0,v([P])}const re=await n(`/api/landing/pages/${t}`).then(Tt=>Tt.json());if(!r&&re.ok){f(re.page),x(os(jC(re.page.config||{}))),de(re.page.pixel_id||""),ge(re.page.meta_pixel_id||""),ie(Number(re.page.meta_pixel_exclusivo)===1),Ut(re.page.status),Fe(re.page.custom_domain||""),Ae(re.page.status==="published"&&!!(re.page.config&&typeof re.page.config=="object"&&re.page.config.modo_codigo_borrador)),l&&ue("Hay cambios locales sin recuperar porque esta landing cambió en otro lugar. No se borraron; resuélvelos en el aviso antes de cerrar esta pestaña."),re.page.custom_domain&&setTimeout(()=>ct(),50),ut(!!((xe=re.page.config)!=null&&xe.upsell)),dt(!!((Le=re.page.config)!=null&&Le.order_bump)),vt(!!((Ee=re.page.config)!=null&&Ee.downsell)),sa(!!((Oe=re.page.config)!=null&&Oe.prelanding));const Tt=String(((St=re.page.config)==null?void 0:St.page_type)||"");!String(((Ft=(rt=re.page.config)==null?void 0:rt.product)==null?void 0:Ft.name)||"").trim()&&Tt!=="advertorial"&&Xa("producto");try{const fa="lumy_abrir_lienzo_"+t;sessionStorage.getItem(fa)&&(sessionStorage.removeItem(fa),Xa("producto"),po(!0),setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("lumy:open-section",{detail:{title:"Contenido de la página (fotos, videos, gifs, textos)"}}))}catch{}},500));const Ha="lumy_pending_import_"+t,Fn=sessionStorage.getItem(Ha);Fn&&(sessionStorage.removeItem(Ha),Xa("producto"),Zi(Fn),ro(os(re.page.config||{})),setTimeout(()=>fi(Fn),400))}catch{}}})().catch(()=>{r||ue("No se pudo cargar la landing. Revisa tu conexión.")}),()=>{r=!0}},[n,ho,t,tr,c]);const fo=h.useRef(null),Dr=wv(()=>fo.current),Ba=Fg(),_o=h.useRef(0),Yn=h.useRef(null),[yr,$o]=h.useState(.74),[ja,dn]=h.useState(!1),[ao,Vn]=h.useState(!1),ar=()=>{Vn(!1),Xa("diseno"),setTimeout(()=>{const r=document.getElementById("lk-imgmask");if(r){try{r.scrollIntoView({behavior:"smooth",block:"center"})}catch{}try{r.animate([{boxShadow:"0 0 0 3px #8b5cf6"},{boxShadow:"0 0 0 10px rgba(139,92,246,0)"}],{duration:1600})}catch{}}},140)};h.useEffect(()=>{var re,xe;if(!ja)return;const r={camara:{tab:"formulario",sections:["Cámara del recibo, sellos y nota de pago"]},intercta:{tab:"formulario",sections:["Botón entre imágenes"]},botoncompra:{tab:"formulario",sections:["Botón de compra"]},formulario:{tab:"formulario",sections:["Formulario"]},ofertas:{tab:"producto",sections:["Ofertas por cantidad"]},variantes:{tab:"producto",sections:["Variantes (tallas, colores)"]},contenido:{tab:"producto",sections:["Contenido de la página (fotos, videos, gifs, textos)"]}
1085,barratotal:{tab:"diseno",sections:["Barra del total (abajo de la página)"]},bump:{tab:"formulario",sections:["Order bump (envÃo express)"]},resenas:{tab:"landing",sections:["Reseñas y testimonios"]},faq:{tab:"landing",sections:["Preguntas frecuentes (FAQ)"]},garantia:{tab:"landing",sections:["GarantÃa","GarantÃa y entrega","GarantÃa de satisfacción"]},entrega:{tab:"landing",sections:["Asà llega tu pedido","GarantÃa y entrega"]},cintillo:{tab:"landing",sections:["Cintillo de beneficios","Parte superior"]},etiqueta:{tab:"landing",sections:["Etiqueta y frase gancho","Parte superior"]},marca:{tab:"landing",sections:["Encabezado de tu tienda","Parte superior"]},textosprod:{tab:"landing",sections:["Textos del producto","Caja de oferta","Parte superior"]},formtextos:{tab:"formulario",sections:["Textos y botones del formulario","Formulario"]},ofertasdonde:{tab:"producto",sections:["¿Dónde mostrar las ofertas?","Ofertas por cantidad"]},sellos:{tab:"landing",sections:["Sellos encima del precio","Sellos de confianza"]},producto:{tab:"producto",sections:["Producto","Tu servicio o infoproducto"]},galeria:{tab:"producto",sections:["GalerÃa principal (fotos principales)","Imágenes / portada"]},regalo:{tab:"upsell",sections:["Regalo por monto"]},promobanner:{tab:"diseno",sections:["Franja animada"]},bloques:{tab:"diseno",sections:["Bloques extra","Forma de la página"]},advertorial:{tab:"landing",sections:["Tu página advertorial"]},cierreoscuro:{tab:"upsell",sections:["Cierre oscuro (remate final)"]},svccred:{tab:"producto",sections:["Credenciales y confianza"]},svcpasos:{tab:"producto",sections:["Cómo trabajamos (pasos)"]},svclista:{tab:"producto",sections:["Servicios que ofreces"]},svczonas:{tab:"producto",sections:["Zonas de cobertura"]},pie:{tab:"landing",sections:["Pie de página"]},whatsapp:{tab:"formulario",sections:["Botón de WhatsApp"]},confianzareal:{tab:"landing",sections:["Compra con información clara"]},urgencia:{tab:"upsell",sections:["Hora de corte de despacho"]},antesdespues:{tab:"landing",sections:["Antes / Después"]},quiz:{tab:"upsell",sections:["Quiz de bienvenida (desbloquea descuento)"]},ruleta:{tab:"upsell",sections:["Ruleta de descuento (gira y gana)"]},salida:{tab:"upsell",sections:["Oferta de salida (descuento si intenta cerrar)"]}},l={".tag-pill":"Etiqueta (pill",".kicker":"Frase gancho",".offer-box":"Caja de oferta",".ship-info":"Tiempo de entrega",h1:"Nombre del",".desc":"Descripción",".bullets":"Beneficios (uno",".price-was":"Precio normal",".price":"Precio (",".save-line":"Precio (",".cta":"Texto del botón","#waFab":"Texto del botón flotante","#waFormBtn":"Texto del botón en el formulario",".wa-alt-sub":"Texto debajo del botón",".annbar":"Cintillo",".gal-thumbs":"Ajuste"},y=Le=>{const Ee=Le&&Le.data&&Le.data.lumyEdit;if(!Ee||!fo.current||Le.source!==fo.current.contentWindow)return;let Oe=r[Ee];if(!Oe)return;Vn(Ee==="contenido"||Ee==="galeria");const St=String(p.page_type||"");Ee==="camara"&&St==="servicio"&&(Oe={tab:"producto",sections:["Credenciales y confianza"]}),Ee==="intercta"&&St==="whatsapp"&&(Oe={tab:"producto",sections:["Contenido de la página (fotos, videos, gifs, textos)"]}),Xa(Oe.tab),Ln(null);const rt=String(Le.data.sel||""),Ft={titles:Oe.sections,title:Oe.sections[0],field:l[rt]||""};let Tt=0;const fa=()=>{window.dispatchEvent(new CustomEvent("lumy:open-section",{detail:Ft})),Tt++,!Ft.consumed&&Tt<4&&setTimeout(fa,300)};setTimeout(fa,150)};window.addEventListener("message",y);try{(xe=(re=fo.current)==null?void 0:re.contentWindow)==null||xe.postMessage({lumyInspect:!0},"*")}catch{}const R=Le=>{Le.key==="Escape"&&dn(!1)},P=Le=>{var Oe;const Ee=Le.target;Ee&&((Oe=Ee.closest)!=null&&Oe.call(Ee,"[data-inspect-toggle]")||Yn.current&&!Yn.current.contains(Ee)&&dn(!1))};return window.addEventListener("keydown",R),document.addEventListener("pointerdown",P,!0),()=>{var Le,Ee;window.removeEventListener("message",y),window.removeEventListener("keydown",R),document.removeEventListener("pointerdown",P,!0),Vn(!1);try{(Ee=(Le=fo.current)==null?void 0:Le.contentWindow)==null||Ee.postMessage({lumyInspect:!1},"*")}catch{}}},[ja,p.page_type]),h.useEffect(()=>{const r=()=>{var Le;const xe=((Le=Yn.current)==null?void 0:Le.clientWidth)||0;xe>0&&$o(Math.min(1,xe/430))};r();const l=requestAnimationFrame(r);let y=null,R=null;const P=()=>{const xe=Yn.current;typeof ResizeObserver>"u"||!xe||xe===R||(y&&y.disconnect(),y=new ResizeObserver(r),y.observe(xe),R=xe)};P();const re=setInterval(()=>{P(),r()},1200);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(l),y&&y.disconnect(),clearInterval(re),window.removeEventListener("resize",r)}},[ta,ae,it]),h.useEffect(()=>{if(!g)return;const r=setTimeout(()=>{const l=Gn==="gracias"?"gracias":Oa==="upsell"?Gn:null,y=l||(Oa==="formulario"?"form":void 0),R=!!p.modo_codigo;n(R?"/api/landing/preview-codigo":"/api/landing/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:g==null?void 0:g.name,slug:g==null?void 0:g.slug,open:y,config:{...p,upsell:He||l==="upsell"?p.upsell||{}:null,order_bump:at?p.order_bump:null,downsell:Ge||l==="downsell"?p.downsell||{}:null,exit_offer:l==="exit"?{...p.exit_offer||{},enabled:!0}:p.exit_offer,entry_quiz:l==="quiz"?{...p.entry_quiz||{},enabled:!0}:p.entry_quiz,wheel:l==="ruleta"?{...p.wheel||{},enabled:!0}:p.wheel,referral:l==="gracias"?{...p.referral||{},enabled:!0}:p.referral,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null}})}).then(async P=>{if(!R)return P.text();const re=await P.json().catch(()=>({}));if(!P.ok||!(re!=null&&re.ok))throw new Error(String((re==null?void 0:re.error)||"preview_failed"));return String(re.html||"")}).then(P=>{var re,xe;try{_o.current=((xe=(re=fo.current)==null?void 0:re.contentWindow)==null?void 0:xe.scrollY)||0}catch{}Ot(eA(P))}).catch(()=>{})},500);return()=>clearTimeout(r)},[p,He,at,Ge,Nt,n,g,Oa,Gn]);const q=p.product||{},te=p.page_type==="simple",ke=p.page_type==="whatsapp",bt=p.page_type==="advertorial",oa=bt?"explicativa":p.copy_length||"equilibrada",wt=oa==="explicativa"?6:2,pt=p.page_type==="servicio",Zt=r=>x(l=>{const y={...l,product:{...l.product,...r}};return Object.prototype.hasOwnProperty.call(r,"images")&&l.content_layout_v2&&(delete y.content_layout_v2,gr(l)),y}),At=p.service||{},Et=r=>x(l=>({...l,service:{...l.service||{},...r}})),xo=Array.isArray(At.trust)&&At.trust.length?At.trust:["Atención personalizada","Agenda flexible","Profesionales con experiencia","GarantÃa de satisfacción"],Ma=Array.isArray(At.steps)&&At.steps.length?At.steps:[{t:"EscrÃbenos o agenda",d:"Cuéntanos qué necesitas; si quieres, envÃa una foto."},{t:"Te cotizamos y agendamos",d:"Te damos el precio y elegimos juntos el dÃa y la hora."},{t:"Te atendemos",d:"Hacemos el trabajo en la fecha acordada, con garantÃa de satisfacción."}],en=Array.isArray(At.services)&&At.services.length?At.services:[{name:"Salas y sofás"},{name:"Colchones"},{name:"Sillas de comedor"},{name:"Tapetes y alfombras"},{name:"Vestiduras de carro"},{name:"Muebles de tela"}],bo=r=>x(l=>({...l,upsell:{...l.upsell,...r}})),Os=r=>{const l=Gn===r?null:r;Ln(l),l&&!ae&&(pn(!0),setTimeout(()=>{var y;try{(y=fo.current)==null||y.scrollIntoView({behavior:"smooth",block:"center"})}catch{}},80))},Jn=r=>{const l=Gn===r;return e.jsxs("button",{type:"button",className:l?"lk-sel-aurora":void 0,onClick:()=>Os(r),style:{...l?{...xa,background:"transparent"}:ee,width:"100%",padding:"9px 13px",fontSize:12.5,marginTop:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),l?"Ocultar de la vista previa":"Ver en la vista previa"]})},ii=String(((bd=p.theme)==null?void 0:bd.headline_fx_color)||((Hc=p.theme)==null?void 0:Hc.accent)||me),nr=p.promo_banner||{},or=nr.on===void 0?!!(nr.image||nr.title):nr.on===!0,si=["shine","pulso","aurora","float","slide"].includes(String(nr.anim))?String(nr.anim):"shine",Zn=r=>x(l=>({...l,promo_banner:{...l.promo_banner||{},...r}}
1085)),rr=p.country&&rn[String(p.country).toUpperCase()]?String(p.country).toUpperCase():Rr().code,vr=((Gc=rn[rr])==null?void 0:Gc.currency)||"COP",li=Dg(rr),Br=r=>r.key==="department"&&cv.has(r.label)?{...r,label:li.l1,placeholder:!r.placeholder||Bu.has(r.placeholder)?li.l1ph:r.placeholder}:r.key==="city"&&uv.has(r.label)?{...r,label:li.l2,placeholder:!r.placeholder||Bu.has(r.placeholder)?li.l2ph:r.placeholder}:r,qo=rr,di=Array.isArray((yd=p.form)==null?void 0:yd.addr_removed)?p.form.addr_removed:[],Mo=()=>{const r=p.service||{},l=[...new Set([...Array.isArray(r.services)?r.services:[],...Array.isArray(r.plans)?r.plans:[]].map(R=>String((R==null?void 0:R.name)||"").replace(/\s+/g," ").trim().slice(0,60)).filter(Boolean))].slice(0,20);return[...td.filter(R=>["name","lastname","phone","email"].includes(R.key)).map(R=>R.key==="lastname"?{...R,required:!1}:{...R}),...l.length?[{key:"servicio",label:"¿Qué servicio necesitas?",type:"select",required:!1,options:l}]:[],{key:"mensaje",label:"Cuéntanos qué necesitas (opcional)",type:"textarea",required:!1,placeholder:"En pocas palabras"}]},Oi=pt?((Si=p.form)!=null&&Si.fields&&p.form.fields.length?p.form.fields:Mo()).filter(r=>!["department","city","address","referencia","phone2","codigo_postal","nota_wa","nota_cobertura"].includes(r.key)):O2(((pl=p.form)!=null&&pl.fields&&p.form.fields.length?p.form.fields:td).map(Br),qo,di),Hs=r=>{const y=Bg(qo).map(P=>P.key).filter(P=>Oi.some(re=>re.key===P)&&!r.some(re=>re.key===P)),R=y.length?Array.from(new Set([...di,...y])):di;x(P=>({...P,form:{...P.form,fields:r,addr_removed:R}}))},Wa=()=>x(r=>({...r,form:{...r.form,fields:pt?Mo():td.map(l=>({...l})),addr_removed:[]}})),Pn=(r,l)=>{const y={...r,content_blocks:l};return r.content_layout_v2&&(delete y.content_layout_v2,gr(r)),y},ir=mm((r,l)=>x(y=>{const R=[...y.content_blocks||[]];if(r<0||r>=R.length||l<0||l>=R.length)return y;const[P]=R.splice(r,1),re=Ee=>["inicio","price","offers","cta","form","faq"].includes(Ee==null?void 0:Ee.pos)?Ee.pos:"end",xe=l>r?R[l-1]??R[l]:R[l]??R[l-1],Le=xe&&re(xe)!==re(P)?{...P,pos:re(xe)==="end"?void 0:re(xe)}:P;return R.splice(l,0,Le),Pn(y,R)})),[ci,qr]=h.useState(null),Dn=r=>{const l=Yi();x(y=>Pn(y,[...y.content_blocks||[],{...r,_k:l}])),qr(l)},us=()=>{const r="scene_"+Math.random().toString(36).slice(2,10),l=Yi(),y=Yi();x(R=>Pn(R,[...R.content_blocks||[],{type:"h",text:"",scene_id:r,_k:l},{type:"p",text:"",scene_id:r,_k:y}])),qr(l)};h.useEffect(()=>{if(ir.dragIdx!=null)return;const r=os(p);r!==p&&x(l=>({...l,content_blocks:r.content_blocks}
1085))},[p.content_blocks,ir.dragIdx]);const Bn=p.bundles||[],$n=r=>x(l=>({...l,bundles:r})),sr=(r,l)=>x(y=>{const R=(y.bundles||[]).map((xe,Le)=>Le===r?{...xe,...l}:xe),P=R[r],re=Number(P==null?void 0:P.qty)===1&&(l.price!==void 0||l.qty!==void 0);return{...y,bundles:R,product:re?{...y.product,price:P.price}:y.product}});h.useEffect(()=>{g&&x(r=>{var y;const l=(r.bundles||[]).find(R=>Number(R.qty)===1);return!l||!(Number(l.price)>0)||Number((y=r.product)==null?void 0:y.price)===Number(l.price)?r:{...r,product:{...r.product,price:Number(l.price)}}})},[g==null?void 0:g.id]);const no=r=>x(l=>{const y=l.bundles||[],R=y.findIndex(P=>Number(P.qty)===1);return{...l,product:{...l.product,price:r},bundles:R>=0?y.map((P,re)=>re===R?{...P,price:r}:P):y}}),Hi=()=>{Bn.length>=bu||$n([...Bn,{qty:(Bn.length||0)+1,price:0,label:"",badge:""}])},Gi=r=>x(l=>{const y=(l.bundles||[]).filter((P,re)=>re!==r);let R=Number(l.bundles_preselect)||0;return r<R&&(R-=1),R>=y.length&&(R=Math.max(0,y.length-1)),{...l,bundles:y,bundles_preselect:R}}),Wn=r=>x(l=>({...l,order_bump:{...l.order_bump,...r}})),Un=r=>x(l=>({...l,downsell:{...l.downsell,...r}})),Pt=r=>x(l=>({...l,theme:{...l.theme,...r}})),yo=(r,l,y)=>x(R=>{const P={...R.inter_cta_spaces||{}},re={...P[r]||{}};return y===void 0?delete re[l]:re[l]=y,re.mt===void 0&&re.mb===void 0?delete P[r]:P[r]=re,{...R,inter_cta_spaces:P}}),lr=(r,l)=>y=>yo(r,l,y.target.value===""?void 0:Math.max(0,Math.min(120,Math.round(Number(y.target.value)||0)))),Qa=r=>x(l=>({...l,prelanding:{...l.prelanding,...r}})),ps=r=>{gr(),x(l=>zp(l,{theme:r.theme,style:r.style,hero_style:r.hero_style,reviews_style:r.reviews_style,form_style:r.form_style,animations:r.animations!==!1})),ue("Plantilla aplicada â"),setTimeout(()=>ue(""),2e3)},Mr=p.trust_badges??FC,jr=r=>x(l=>({...l,trust_badges:r})),Ar=(r,l)=>jr(Mr.map((y,R)=>R===r?{...y,...l}:y)),gs=()=>jr([...Mr,{icon:"â",text:""}]),ms=r=>jr(Mr.filter((l,y)=>y!==r)),Sr=!!p.trust_facts&&p.trust_facts.enabled!==!1,[hs,Gs]=h.useState(!1);h.useEffect(()=>{Sr&&Gs(!0)},[Sr]);const wn=Array.isArray(($r=p.trust_facts)==null?void 0:$r.items)?p.trust_facts.items.slice(0,2):[],Io=Ny(p.page_type),qn=r=>x(l=>({...l,trust_facts:{...l.trust_facts||{},...r}})),Fo=(r,l)=>qn({items:wn.map((y,R)=>R===r?{...y,...l}:y).slice(0,2)}),Vi=r=>qn({items:wn.filter((l,y)=>y!==r)}),Vs=()=>{const r=new Set(wn.map(y=>y==null?void 0:y.key)),l=Io.find(y=>!r.has(y.key));l&&wn.length<2&&qn({items:[...wn,{key:l.key,text:l.text}]})},Oo=p.reviews||{},cn=r=>x(l=>({...l,reviews:{...l.reviews||{},...r}})),To=Oo.items||[],wr=r=>cn({items:r}),Ho=(r,l)=>wr(To.map((y,R)=>R===r?{...y,...l}:y)),k=()=>wr([...To,{name:"",city:"",stars:5,text:"",verified:!1}]),Y=r=>wr(To.filter((l,y)=>y!==r)),be=r=>x(l=>({...l,urgency:{...l.urgency,...r}})),je=p.announcement===void 0?WC:((Vc=p.announcement)==null?void 0:Vc.text)||"",Ne=r=>x(l=>({...l,announcement:{...l.announcement||{},...r}})),Lt=p.offer_text===void 0?qC:p.offer_text||"",Ke=p.guarantee===void 0?Ry:p.guarantee||{title:"",text:""},ft=p.delivery_steps===void 0?vu:p.delivery_steps||[],Xt=p.delivery_off===void 0?p.guarantee_off!==!0:p.delivery_off!==!0,ea=r=>x(l=>({...l,guarantee:{...l.guarantee===void 0?Ry:l.guarantee,...r}})),Ta=["Pago contraentrega","Producto sellado"],Eo=["Pago contraentrega","Producto sellado","EnvÃo gratis"],et=Array.isArray(Ke.seals)?Ke.seals:Ta,Aa=(r,l)=>{const y=[...et];y[r]=l,ea({seals:y})},ya=[{title:"PolÃtica de privacidad",content:"En [Razón social] tratamos tus datos personales conforme a la Ley 1581 de 2012 (Habeas Data). Los datos que nos entregas (nombre, teléfono y dirección) se usan para procesar, coordinar y entregar tu pedido y para contactarte sobre el mismo. No los vendemos ni los compartimos con terceros ajenos a la entrega. Como titular puedes conocer, actualizar, rectificar y suprimir tus datos o revocar la autorización escribiéndonos a [correo]; también puedes acudir a la Superintendencia de Industria y Comercio (SIC)."},{title:"PolÃtica de envÃos",content:"Realizamos envÃos a todo el paÃs. El tiempo estimado de entrega es de 3 a 7 dÃas hábiles según tu ciudad. El pago es contraentrega: pagas al recibir tu pedido en la puerta de tu casa. No necesitas pagar nada por adelantado."},{title:"Cambios y devoluciones",content:"Si tu producto llega con algún defecto o equivocado, contáctanos dentro de las 48 horas siguientes a la entrega para coordinar el cambio o la solución. El producto debe estar sin uso y en su empaque original."},{title:"Derecho de retracto",content:"Conforme a la Ley 1480 de 2011 (Estatuto del Consumidor) t
1085ienes derecho de retracto: puedes retractarte dentro de los 5 dÃas hábiles siguientes a la entrega, devolviendo el producto sin uso y en su empaque original. Para ejercerlo escrÃbenos a [correo] indicando tu número de pedido; te devolvemos el 100% del dinero en un plazo máximo de 30 dÃas calendario. No aplica para productos perecederos, de uso personal e higiene o hechos a tu medida."},{title:"Términos y condiciones",content:"Al realizar un pedido aceptas estos términos. Los precios y promociones pueden cambiar sin previo aviso. Confirmamos tu pedido por teléfono o WhatsApp antes del despacho y podemos cancelar pedidos con datos incompletos o incorrectos."}],kr=[],kn=p.footer||{},Cr=kn.enabled===void 0?!0:!!kn.enabled,xn=r=>x(l=>({...l,footer:{...l.footer||{},...r}})),fs=Array.isArray(kn.policies)?kn.policies:ya,ui=Array.isArray(kn.authority)?kn.authority:kr,pi=Array.isArray(kn.links)?kn.links:[],_c=(r,l)=>xn({policies:fs.map((y,R)=>R===r?{...y,...l}:y)}),Ze=()=>xn({policies:[...fs,{title:"",content:""}]}),$c=r=>xn({policies:fs.filter((l,y)=>y!==r)}),Us=(r,l)=>{const y=[...ui];y[r]=l,xn({authority:y})},Qs=()=>xn({authority:[...ui,""]}),Ui=r=>xn({authority:ui.filter((l,y)=>y!==r)}),dr=(r,l)=>xn({links:pi.map((y,R)=>R===r?{...y,...l}:y)}),Ks=()=>xn({links:[...pi,{label:"",url:""}]}),Ic=r=>xn({links:pi.filter((l,y)=>y!==r)}),Ys=(r,l)=>{const y=p.delivery_steps===void 0?vu:p.delivery_steps||[];x(R=>({...R,delivery_steps:y.map((P,re)=>re===r?{...P,...l}:P)}))},cr=p.variants||[],Js=r=>x(l=>({...l,variants:r})),ur=(r,l)=>Js(cr.map((y,R)=>R===r?{...y,...l}:y)),Tc=r=>Js(cr.filter((l,y)=>y!==r)),fm=()=>Js([...cr,{name:cr.length===0?"Color":"Talla",options:[{value:""}]}]),op=(r,l,y)=>{var R;return ur(r,{options:(((R=cr[r])==null?void 0:R.options)||[]).map((P,re)=>re===l?{...P,...y}:P)})},rp=r=>{var l;return ur(r,{options:[...((l=cr[r])==null?void 0:l.options)||[],{value:""}]})},xs=(r,l)=>{var y;return ur(r,{options:(((y=cr[r])==null?void 0:y.options)||[]).filter((R,P)=>P!==l)})},[Qi,bs]=h.useState(!1),[ys,Ki]=h.useState(null),rd=async r=>{var R,P;const l=p[r]||{},y=String(l.dropi_product_id??"").trim();if(!y){alert("Primero escribe el ID del producto en Dropi.");return}Ki(r);try{const re=new URLSearchParams;String(p.country||"")&&re.set("country",String(p.country)),Number(p.dropi_account_id)>0&&re.set("account_id",String(Number(p.dropi_account_id)));const xe=await Lp(`/api/landing/dropi-product/${encodeURIComponent(y)}${re.toString()?"?"+re.toString():""}`);if(!xe.ok){alert(xe.motivo);return}if(!((R=xe.j)!=null&&R.ok)){alert(((P=xe.j)==null?void 0:P.message)||"No se pudo traer ese producto de Dropi. Revisa el ID.");return}const Le={variants:Array.isArray(xe.j.variants)?xe.j.variants:[],dropi_variations:Array.isArray(xe.j.dropi_variations)?xe.j.dropi_variations:[],dropi_nombre:String(xe.j.name||"").slice(0,120)};r==="upsell"?bo(Le):r==="downsell"?Un(Le):x(Ee=>({...Ee,gift_reward:{...Ee.gift_reward,...Le}}))}finally{Ki(null)}},id={variants:void 0,dropi_variations:void 0,dropi_nombre:void 0},Zs=(r,l)=>{const y=String((l==null?void 0:l.dropi_product_id)??"").trim(),R=Array.isArray(l==null?void 0:l.dropi_variations),P=(Array.isArray(l==null?void 0:l.variants)?l.variants:[]).filter(re=>(re==null?void 0:re.name)&&Array.isArray(re==null?void 0:re.options)&&re.options.length>1);return e.jsxs("div",{"data-tallas-extra":r,style:{marginTop:6},children:[e.jsx("button",{type:"button",style:{...ee,padding:"6px 12px",fontSize:12.5},disabled:!y||ys===r,onClick:()=>rd(r),children:ys===r?"Trayendoâ¦":R?"Volver a traer de Dropi":"Traer tallas de Dropi"}),R&&P.length>0&&e.jsxs("div",{style:{marginTop:6,fontSize:12.5,lineHeight:1.5,color:"var(--text-secondary)"},children:[l.dropi_nombre?e.jsx("b",{children:l.dropi_nombre}):null,l.dropi_nombre?" · ":"",P.map(re=>`${re.name}: ${re.options.map(xe=>xe&&typeof xe=="object"?xe.value:xe).join(", ")}`).join(" · "),e.jsx("div",{style:{color:"var(--text-muted)"},children:"El cliente elige al pedir y el pedido llega a Dropi con esa talla."})]}),R&&P.length===0&&e.jsxs("div",{style:{marginTop:6,fontSize:12.5,color:"var(--text-muted)"},children:[l.dropi_nombre?`${l.dropi_nombre}: `:"","no tiene tallas en Dropi, va tal cual."]}),!R&&y&&e.jsx("div",{style:{marginTop:6,fontSize:12.5,color:"var(--text-muted)"},children:"Toca «Traer tallas de Dropi»: si este producto tiene tallas o colores, el cliente la elige al pedir. Si no, Dropi puede rechazar el pedido."})]})},[vs,gi]=h.useState(null),[mi,ip]=h.useState(""),[Xs,oo]=h.useState({loading:!1,result:null}),Ec=async()=>{var l;const r=String(((l=p.product)==null?void 0:l.dropi_product_id)??"").trim();if(!r){oo({loading:!1,result:{ok:!1,message:'Primero pon el ID del producto en Dropi (arriba, en "Producto en Dropi").'}});return}oo({loading:!0,result:null});try{const y=await Lp("/api/landing/dropi-variant-check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product_id:r,variants:p.variants||[],country:String(p.country||""),account_id:Number(p.dropi_account_id)||0})});oo({loading:!1,result:y.ok?y.j:{ok:!1,message:y.motivo}})}catch{oo({loading:!1,result:{ok:!1,message:"No se pudo verificar. Intenta de nuevo."}})}},[xm,bm]=h.useState(!1),Yi=()=>"cb_"+Math.random().toString(36).slice(2,10),sp=async()=>{const r=String(q.dropi_product_id??"").trim();if(!r){alert("Primero escribe el ID del producto en Dropi.");return}const l=[];confirm(`¿Traer las VARIANTES (tallas/colores) de este producto de Dropi? 1086 1087(No toca tus fotos ni tu descripción.)`)&&l.push("variants");const y=!(q.name||"").trim()&&confirm("Tu producto no tiene nombre. ¿Traer el NOMBRE de Dropi?"),R=!(Number(q.price)>0||p.bundles&&p.bundles.length)&&confirm("Tu producto no tiene precio. ¿Traer el PRECIO de Dropi?");if(y&&l.push("name"),R&&l.push("price"),!l.length){alert(`No elegiste nada para traer, asà que no se cambió nada. 1088 1089Ojo: para enlazarlo con Dropi NO hace falta este botón. Con el ID escrito, dale a Guardar y los pedidos ya se crean en ese producto de Dropi. Importar solo sirve para traerte las variantes, el nombre o el precio.`);return}bs(!0);try{const P=new URLSearchParams;String(p.country||"")&&P.set("country",String(p.country)),Number(p.dropi_account_id)>0&&P.set("account_id",String(Number(p.dropi_account_id)));const re=await Lp(`/api/landing/dropi-product/${encodeURIComponent(r)}${P.toString()?"?"+P.toString():""}`);if(!re.ok){alert(re.motivo+` 1090 1091Tu ID no se pierde: dale a Guardar y la landing queda enlazada igual.`);return}const xe=re.j;if(!xe.ok){alert(xe.message||"No se pudo importar. El ID que escribiste no se pierde: dale a Guardar y la landing queda enlazada igual.");return}const Le=xe.product;x(Oe=>{var St,rt,Ft,Tt,fa;return{...Oe,product:{...Oe.product,dropi_product_id:r,name:l.includes("name")?Le.name||((St=Oe.product)==null?void 0:St.name)||"":(rt=Oe.product)==null?void 0:rt.name,price:l.includes("price")?Le.price:(Ft=Oe.product)==null?void 0:Ft.price,dropi_variations:l.includes("variants")?Le.dropi_variations||((Tt=Oe.product)==null?void 0:Tt.dropi_variations):(fa=Oe.product)==null?void 0:fa.dropi_variations},variants:l.includes("variants")&&Le.variants&&Le.variants.length?Le.variants:Oe.variants}});const Ee=l.map(Oe=>Oe==="variants"?"variantes":Oe==="name"?"nombre":"precio").join(", ");ue(`Importado de Dropi: ${Ee} â`),setTimeout(()=>ue(""),3500)}catch{alert("Error de conexión al importar. Intenta de nuevo.")}finally{bs(!1)}},el=async r=>{const l=r==="mastershop"?"mastershop_product_id":"envios99_product_id",y=r==="mastershop"?"Mastershop":"99envÃos",R=String(q[l]??"").trim();if(!R){alert(`Primero escribe el ID del producto en ${y}.`);return}const P=[];confirm(`¿Traer las VARIANTES (tallas/colores) de este producto de ${y}? 1092
1093(No toca tus fotos ni tu descripción.)`)&&P.push("variants");const re=!(q.name||"").trim()&&confirm(`Tu producto no tiene nombre. ¿Traer el NOMBRE de ${y}?`),xe=!(Number(q.price)>0||p.bundles&&p.bundles.length)&&confirm(`Tu producto no tiene precio. ¿Traer el PRECIO de ${y}?`);if(re&&P.push("name"),xe&&P.push("price"),!P.length){alert(`No elegiste nada para traer, asà que no se cambió nada. 1094 1095Ojo: para enlazarlo con ${y} NO hace falta este botón. Con el ID escrito, dale a Guardar y los pedidos ya salen por ${y}.`);return}bs(!0);try{const Ee=await(await n(`/api/landing/${r==="mastershop"?"mastershop":"envios99"}-product/${encodeURIComponent(R)}`)).json();if(!Ee.ok){alert((Ee.message||"No se pudo importar.")+` 1096 1097Tu ID no se pierde: dale a Guardar y la landing queda enlazada igual.`);return}const Oe=Ee.product;x(rt=>{var Ft,Tt,fa,Ha,Fn,Ya,Xn;return{...rt,product:{...rt.product,[l]:R,name:P.includes("name")?Oe.name||((Ft=rt.product)==null?void 0:Ft.name)||"":(Tt=rt.product)==null?void 0:Tt.name,price:P.includes("price")?Oe.price:(fa=rt.product)==null?void 0:fa.price,...r==="mastershop"?{ms_variations:P.includes("variants")?Oe.ms_variations||((Ha=rt.product)==null?void 0:Ha.ms_variations):(Fn=rt.product)==null?void 0:Fn.ms_variations}:{},...r==="envios99"?{e99_variations:P.includes("variants")?Oe.e99_variations||((Ya=rt.product)==null?void 0:Ya.e99_variations):(Xn=rt.product)==null?void 0:Xn.e99_variations}:{}},variants:P.includes("variants")&&Oe.variants&&Oe.variants.length?r==="envios99"?CA(rt.variants,Oe.variants):Oe.variants:rt.variants}});const St=P.map(rt=>rt==="variants"?"variantes":rt==="name"?"nombre":"precio").join(", ");ue(`Importado de ${y}: ${St} â`),setTimeout(()=>ue(""),3500)}catch{alert("Error de conexión al importar. Intenta de nuevo.")}finally{bs(!1)}},[Ji,hi]=h.useState(!1),[js,Zi]=h.useState(""),[sd,ro]=h.useState(null),fi=async r=>{var xe;const l=(typeof r=="string"?r:js).trim();if(!l){alert("Pega el link de la página del producto.");return}const y=!!((((xe=p.product)==null?void 0:xe.images)||[]).length||(p.content_blocks||[]).length||(p.extra_images||[]).length),R=!!(p.reviews&&p.reviews.items||[]).length,re=p.reviews_off!==!0?"Esto reemplaza las imágenes y el contenido. Las reseñas del producto anterior se retirarán; luego puedes agregar o importar reseñas reales del producto nuevo. ¿Continuar?":"Esto reemplaza las imágenes de la galerÃa, el contenido y la galerÃa de cierre. ¿Continuar?";if(!((y||R)&&!confirm(re))){hi(!0);try{const Le=await n("/api/landing/import-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:l}
1097),signal:AbortSignal.timeout(vy)}),Ee=await Le.json().catch(()=>null);if(!Le.ok||!(Ee!=null&&Ee.ok)){const $t=Ee&&Ee.ok===!1&&typeof Ee.message=="string"?Ee.message:"";alert($t||(!Le.ok&&Le.status>=500?"El servidor no respondió. Suele pasar unos segundos después de una actualización: espera un momento y vuelve a intentar.":"No se pudo leer esa página."));return}try{const $t=JSON.parse(JSON.stringify(bn.current));ro(Fa=>Fa??$t)}catch{}const Oe=Ee.images||[],St=(Ee.content_blocks||[]).map($t=>$t&&$t._k?$t:{...$t,_k:Yi()}),rt=Ee.variants||[],Ft=Ee.bundles||[],Tt=Ee.reviews&&typeof Ee.reviews=="object"&&!Array.isArray(Ee.reviews)?Ee.reviews:null,fa=Array.isArray(Tt==null?void 0:Tt.items)?Tt.items.length:0,Ha=!!(Tt&&(fa||Tt.rating!==void 0||Tt.count!==void 0));gr(),x($t=>{var nn,Ja,on,Ua,En;const Fa={...$t,product:{...$t.product,name:Ee.product.name||((nn=$t.product)==null?void 0:nn.name)||"",price:Ee.product.price||(Number((Ja=$t.product)==null?void 0:Ja.price)>0?(on=$t.product)==null?void 0:on.price:void 0),compare_at_price:Ee.product.compare_at_price||(Number((Ua=$t.product)==null?void 0:Ua.compare_at_price)>0?(En=$t.product)==null?void 0:En.compare_at_price:void 0),images:Oe,description:""},variants:$t.variants&&$t.variants.length?$t.variants:rt.length?rt:$t.variants,bundles:$t.bundles&&$t.bundles.length?$t.bundles:Ft.length?Ft:$t.bundles,content_blocks:St,extra_images:[],reviews:Ha?Tt:null,reviews_off:!Ha,_img_dims:{...$t._img_dims||{},...Ee.image_dims||{}}};return delete Fa.content_layout_v2,Fa});const Fn=rt.length?`, ${rt.length} variantes`:"",Ya=Ft.length?`, ${Ft.length} ofertas`:"",Xn=Ee.mirrored?`, ${Ee.mirrored} imágenes optimizadas y guardadas en Lumy`:"",Es=Ee.video_mirrored?`, ${Ee.video_mirrored} videos guardados en Lumy`:"",Xe=`, ${fa} ${fa===1?"reseña real":"reseñas reales"}`;ue(`Link importado${Ee.ai?" (IA)":""}: ${Oe.length} en galerÃa, ${St.length} bloques${Fn}${Ya}${Xe}${Xn}${Es}`),setTimeout(()=>ue(""),6e3),Zi("")}catch(Le){alert((Le==null?void 0:Le.name)==="TimeoutError"||(Le==null?void 0:Le.name)==="AbortError"?"La importación tardó demasiado. Intenta de nuevo, o con un link más liviano.":"Error de conexión al importar. Intenta de nuevo.")}finally{hi(!1)}}},zc=async()=>{var l;const r=js.trim();if(!r){alert("Pega el link de la página del producto (con sus reseñas visibles).");return}{const y=p.reviews&&Array.isArray(p.reviews.items)?p.reviews.items:[],R=re=>!!(re&&re.text&&String(re.text).trim()),P=y.filter(re=>!(re&&re.image&&!R(re)));if(!y.some(R)){ue("Primero agrega tus reseñas con texto; después trae las fotos y se combinan solas."),setTimeout(()=>ue(""),7e3);return}if(!P.some(re=>!re.image)){ue("Todas tus reseñas con texto ya tienen foto. Agrega más reseñas para combinar fotos nuevas."),setTimeout(()=>ue(""),6500);return}}hi(!0);try{const y=[...((l=p.product)==null?void 0:l.images)||[],...(p.content_blocks||[]).flatMap(rt=>(rt==null?void 0:rt.type)==="image"?[rt.url]:(rt==null?void 0:rt.type)==="carousel"?rt.images||[]:[]),...p.extra_images||[]].filter(Boolean).slice(0,80),R=await n("/api/landing/import-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:r,reviewsOnly:!0,current_images:y}
1097),signal:AbortSignal.timeout(vy)}),P=await R.json().catch(()=>null);if(!R.ok||!(P!=null&&P.ok)){const rt=P&&P.ok===!1&&typeof P.message=="string"?P.message:"";alert(rt||(!R.ok&&R.status>=500?"El servidor no respondió. Suele pasar unos segundos después de una actualización: espera un momento y vuelve a intentar.":"No encontramos fotos de reseñas en esa página."));return}const re=P.review_images||[];if(!re.length){alert("No encontramos fotos de reseñas en esa página.");return}const xe=p.reviews_off===!0,Le=P.image_dims||{},Ee=p.reviews&&Array.isArray(p.reviews.items)?p.reviews.items:[],Oe=rt=>!!(rt&&rt.text&&String(rt.text).trim()),St=rt=>!!(rt&&rt.image&&!Oe(rt));if(Ee.some(Oe)){const rt=Ee.filter(Tt=>!St(Tt));if(rt.filter(Tt=>!Tt.image).length===0)ue("Todas tus reseñas con texto ya tienen foto. Agrega más reseñas para combinar fotos nuevas."),setTimeout(()=>ue(""),6500);else{let Tt=0;const fa=rt.map(Ya=>!Ya.image&&Tt<re.length?{...Ya,image:re[Tt++]}:{...Ya});x(Ya=>({...Ya,reviews:{...Ya.reviews||{},items:fa},_img_dims:{...Ya._img_dims||{},...Le}}));const Ha=re.length-Tt;let Fn=`${Tt} ${Tt===1?"foto combinada":"fotos combinadas"} con tus reseñas â`;Ha>0&&(Fn+=` (sobraron ${Ha}; agrega más reseñas con texto para usarlas)`),xe&&(Fn+=" · activa la sección de reseñas para que se vean"),ue(Fn),setTimeout(()=>ue(""),7500)}}else ue("Encontramos fotos, pero necesitas agregar primero las reseñas reales con las que quieres combinarlas."),setTimeout(()=>ue(""),7e3);Zi("")}catch{alert("Error de conexión al traer las fotos de reseñas. Intenta de nuevo.")}finally{hi(!1)}},Fr=r=>x(l=>({...l,before_after:{...l.before_after,...r}})),Xi=[{q:"¿Cuándo llega mi pedido?",a:"Llega en 2 a 5 dÃas hábiles según tu ciudad. Te confirmamos por WhatsApp en cada etapa."},{q:"¿Pago cuando lo recibo?",a:"SÃ. Es pago contraentrega: pagas en efectivo al recibir tu pedido en la puerta de tu casa. No pagas nada por adelantado."},{q:"¿El envÃo tiene costo?",a:"El envÃo es gratis a todo el paÃs. Lo coordinamos contigo al confirmar tu pedido."},{q:"¿Cómo sé qué talla u opción elegir?",a:"GuÃate por la información del producto. Si tienes dudas, escrÃbenos y te ayudamos a elegir la correcta."},{q:"¿Es seguro comprar aquÃ?",a:"Totalmente. No pagas nada por adelantado: solo pagas cuando el producto llega a tus manos."},{q:"¿Qué pasa si llega con algún problema?",a:"Contáctanos dentro de las 48 horas siguientes a la entrega y coordinamos el cambio o la solución."},{q:"¿Puedo hacer seguimiento de mi pedido?",a:"Claro. Te mantenemos informado por WhatsApp o llamada desde que confirmas hasta que recibes."}],Or=((wi=p.faq)==null?void 0:wi.enabled)===void 0?!0:!!p.faq.enabled,Go=Array.isArray((ki=p.faq)==null?void 0:ki.items)?p.faq.items:Xi,tl=r=>x(l=>({...l,faq:{...l.faq,...r}})),Hr=(r,l)=>x(y=>{var P;const R=Array.isArray((P=y.faq)==null?void 0:P.items)?y.faq.items:Xi;return{...y,faq:{...y.faq,items:R.map((re,xe)=>xe===r?{...re,...l}:re)}}}),ld=()=>x(r=>{var y;const l=Array.isArray((y=r.faq)==null?void 0:y.items)?r.faq.items:Xi;return{...r,faq:{...r.faq,items:[...l,{q:"",a:""}]}}}),Rc=r=>x(l=>{var R;const y=Array.isArray((R=l.faq)==null?void 0:R.items)?l.faq.items:Xi;return{...l,faq:{...l.faq,items:y.filter((P,re)=>re!==r)}}}),Nc=r=>x(l=>({...l,faq:{...l.faq,enabled:r}})),al=h.useRef(!0),Mn=h.useRef(null),As=h.useRef(Promise.resolve()),xi=h.useRef(!1),Ca=h.useRef(null),zo=h.useRef(0),nl=h.useRef("");nl.current||(nl.current=typeof((No=globalThis.crypto)==null?void 0:No.randomUUID)=="function"?globalThis.crypto.randomUUID():`landing_${Date.now()}_${Math.random().toString(36).slice(2)}_${Math.random().toString(36).slice(2)}`);const Lc=h.useRef(0),ol=h.useRef({sequence:0,updatedAt:""}),dd=()=>({editor_session_id:nl.current,editor_sequence:++Lc.current}),un=h.useRef("");h.useEffect(()=>{un.current=String((g==null?void 0:g.updated_at)||"")},[g]);const[cd,Vo]=h.useState(""),[Gr,bi]=h.useState(null),[rl,il]=h.useState(!1),Ss=h.useRef(0),pr=h.useRef(0),_r=h.useRef(null),bn=h.useRef({}),Vr=h.useRef({upsellOn:He,bumpOn:at,downsellOn:Ge,preOn:Nt});h.useLayoutEffect(()=>{Vr.current={upsellOn:He,bumpOn:at,downsellOn:Ge,preOn:Nt},bn.current={...p,upsell:He?p.upsell:null,order_bump:at?p.order_bump:null,downsell:Ge?p.downsell:null,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null}},[p,He,at,Ge,Nt]);const gr=r=>{Ss.current+=1,pr.current=Ss.current;const l=Vr.current,y=r||bn.current||{},R=r?{...y,upsell:l.upsellOn?y.upsell:null,order_bump:l.bumpOn?y.order_bump:null,downsell:l.downsellOn?y.downsell:null,prelanding:l.preOn||y.page_type==="advertorial"?y.prelanding:null}:y;try{_r.current=JSON.parse(JSON.stringify(R))}catch{_r.current=R}},yi=r=>{pr.current=Jj(pr.current,r),pr.current===0&&(_r.current=null)},vi=(r,l)=>{var R;if(!Zj(ol.current,r,l))return!1;const y=String(((R=l==null?void 0:l.page)==null?void 0:R.updated_at)||un.current);return ol.current={sequence:Number(r.editor_sequence),updatedAt:y},un.current=y,!0},Ur=r=>{const l=ho(),y=!!l&&Yj(l,c,r);return!y&&!gp(r)&&ue("No cierres esta pestaña todavÃa: el cambio es grande y el navegador no permitió guardar su copia local."),y},ji=r=>{const l=ho();return!!l&&z1(l,c,r)},mr=h.useRef(null),zt=()=>{C.current=!1,w(!1)},hr=r=>{var l,y;r!=null&&r.meta_pixel_rechazado&&(ge(String(((l=r.page)==null?void 0:l.meta_pixel_id)??(g==null?void 0:g.meta_pixel_id)??"")),ie(Number(((y=r.page)==null?void 0:y.meta_pixel_exclusivo)??(g==null?void 0:g.meta_pixel_exclusivo))===1),ue(String(r.meta_pixel_rechazado)),setTimeout(()=>ue(""),9e3))},ud=async(r,l=!1)=>{un.current&&(r.expected_updated_at=un.current),Ur(r);const y=await tr(r);if(!y)return ue("Sin guardar: no se pudo crear la versión anterior. Intenta de nuevo."),!1;if(l&&!gp(y))return!1;
1097xi.current=!0,Ca.current=r;try{const R=await n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y),keepalive:l}),P=await R.json().catch(()=>({}));if(!R.ok||P.ok===!1)return ue(R.status===409&&P.error==="stale"?"Sin guardar: se editó en otra pestaña. Recarga la página":"Sin guardar. Revisa los datos"),!1;yi(r),ji(r),P.borrador&&ue("Guardado como borrador: "+String(P.borrador).replace(/\.+$/,"")+". Tu página publicada sigue como estaba."),Ae(!!P.borrador),Mn.current===r&&(Mn.current=null),vi(r,P)&&(P.page&&f(P.page),r.custom_domain!==void 0&&P.page&&Fe(P.page.custom_domain||""));const re=xu(P.pedidos_reencuadrados);return re&&(ue("Guardado â · "+re),setTimeout(()=>ue(""),9e3)),hr(P),!0}catch{return ue("Sin guardar. Sin conexión"),!1}finally{Ca.current===r&&(Ca.current=null),xi.current=!1}},Ai=async(r=!1)=>{if(C.current)return!1;if(C.current=!0,w(!0),typeof document<"u"&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),zo.current+=1,mr.current&&clearTimeout(mr.current),mr.current=null,await As.current.catch(()=>{}),mr.current&&clearTimeout(mr.current),mr.current=null,r){if(!await Xj(()=>Promise.resolve(),()=>Mn.current,y=>ud(y)))return zt(),!1}else Mn.current=null;return!0},Pc=async()=>{try{const r=p.theme||{},l={theme:{}};for(const P of["accent","page_bg","button_color","button_text_color","button_radius","font","font_pair","button_style","button_animation","bg_anim","bg_anim_intensity","bg_anim_color","radius_level","density","texture","divider"])r[P]!==void 0&&(l.theme[P]=r[P]);for(const P of["style","form_style","reviews_style"])p[P]!==void 0&&(l[P]=p[P]);const y=await n("/api/user-prefs/brand_kit",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:l})}),R=await y.json().catch(()=>({}));Vo(y.ok&&R.ok!==!1?"Kit guardado. Tus landings nuevas nacen con esta marca.":"No se pudo guardar el kit. Intenta de nuevo.")}catch{Vo("No se pudo guardar el kit. Intenta de nuevo.")}setTimeout(()=>Vo(""),4e3)},pd=async()=>{try{const l=await(await n(`/api/landing/pages/${t}/versions`)).json();bi(l.ok?l.versions||[]:[])}catch{bi([])}},Dc=async r=>{if(!rl&&window.confirm("¿Volver la página a esta versión? Lo actual se guarda como una versión más, asà que puedes deshacerlo.")){il(!0);try{if(!await Ai(!0)){il(!1);return}const l=await n(`/api/landing/pages/${t}/versions/${r}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected_updated_at:un.current||void 0})}),y=await l.json();if(y.ok&&y.page){const R=y.page.config||{};un.current=String(y.page.updated_at||un.current),f(y.page),V(os(R)),ut(!!R.upsell),dt(!!R.order_bump),vt(!!R.downsell),sa(!!R.prelanding),bi(null);const P=xu(y.pedidos_reencuadrados);ue("Versión restaurada â"+(P?" · "+P:"")),setTimeout(()=>ue(""),P?9e3:2500)}else ue(y.message||"No se pudo restaurar. Intenta de nuevo"),setTimeout(()=>ue(""),3500),l.status===404&&pd()}catch{ue("No se pudo restaurar. Intenta de nuevo"),setTimeout(()=>ue(""),3500)}zt(),il(!1)}},Bc=async()=>{const r={...p,upsell:He?p.upsell:null,order_bump:at?p.order_bump:null,downsell:Ge?p.downsell:null,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null};try{const l=await n(`/api/landing/pages/${t}/versions/snapshot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:r})}),y=await l.json().catch(()=>({}));return l.ok&&y.ok!==!1}catch{return!1}},Wc=async()=>Ai(!1),sl=async r=>{if(!await Wc())return!1;try{return await Bc()?(V(r),bi(null),ue("Variante aplicada. La versión anterior quedó guardada."),setTimeout(()=>ue(""),3500),!0):!1}finally{zt()}},ll=h.useCallback(async(r,l)=>{const y=await n("/api/landing/preview",{method:"POST",headers:{"Content-Type":"application/json"},signal:l,body:JSON.stringify({name:g==null?void 0:g.name,slug:g==null?void 0:g.slug,config:{...r,upsell:He?r.upsell:null,order_bump:at?r.order_bump:null,downsell:Ge?r.downsell:null,prelanding:Nt||r.page_type==="advertorial"?r.prelanding:null}})});if(!y.ok)throw new Error("No se pudo renderizar la propuesta.");return y.text()},[n,g==null?void 0:g.name,g==null?void 0:g.slug,He,at,Ge,Nt]);h.useCallback(async(r,l)=>{const y=await n("/api/landing/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:g==null?void 0:g.name,slug:g==null?void 0:g.slug,config:{...p,content_blocks:l,content_layout_v2:r,upsell:He?p.upsell:null,order_bump:at?p.order_bump:null,downsell:Ge?p.downsell:null,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null}})});if(!y.ok)throw new Error("preview_failed");return y.text()},[n,g==null?void 0:g.name,g==null?void 0:g.slug,p,He,at,Ge,Nt]),h.useEffect(()=>{if(!g)return;if(al.current){al.current=!1;return}if(C.current)return;const r={...dd(),...pp(pr.current,_r.current),config:{...p,upsell:He?p.upsell:null,order_bump:at?p.order_bump:null,downsell:Ge?p.downsell:null,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null},pixel_id:Q||null,meta_pixel_id:ve||null,meta_pixel_exclusivo:!!ve&&Te},l=tt.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,""),y=l===""||/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/.test(l),R=l===""&&!!String(g.custom_domain||"");y&&!R&&l!==String(g.custom_domain||"")&&(r.custom_domain=l),g.updated_at&&(r.expected_updated_at=g.updated_at),Ur(r),Mn.current=r;const P=zo.current,re=setTimeout(async()=>{ue("Guardandoâ¦");const xe=As.current.catch(()=>{}).then(async()=>
1097{if(R1(P,zo.current)){xi.current=!0,Ca.current=r;try{un.current&&(r.expected_updated_at=un.current),Ur(r);const Le=await tr(r);if(!Le){ue("Sin guardar: no se pudo crear la versión anterior. Intenta de nuevo.");return}const Ee=await n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le)}),Oe=await Ee.json();if(Oe.ok){yi(r),ji(r),Mn.current===r&&(Mn.current=null);const St=xu(Oe.pedidos_reencuadrados);if(!R1(P,zo.current)){St&&(ue("Guardado â · "+St),setTimeout(()=>ue(""),9e3));return}vi(r,Oe)?(f(Oe.page),r.custom_domain!==void 0&&Fe(Oe.page.custom_domain||""),Ae(!!Oe.borrador),Oe.borrador?ue("Guardado como borrador: "+String(Oe.borrador).replace(/\.+$/,"")+". Tu página publicada sigue como estaba."):St?(ue("Guardado â · "+St),setTimeout(()=>ue(""),9e3)):(ue("Guardado â"),setTimeout(()=>ue(""),1800))):St&&(ue("Guardado â · "+St),setTimeout(()=>ue(""),9e3)),hr(Oe)}else Ee.status===409&&Oe.error==="stale"?ue("Sin guardar: se editó en otra pestaña. Recarga la página"):(Oe==null?void 0:Oe.error)==="domain_not_ready"?(Fe((g==null?void 0:g.custom_domain)||""),ue(String(Oe.message||"Ese dominio todavÃa se está activando.")),setTimeout(()=>ue(""),9e3)):ue("Sin guardar. Revisa los datos")}catch{ue("Sin guardar. Sin conexión")}finally{Ca.current===r&&(Ca.current=null),xi.current=!1}}});As.current=xe,await xe},1600);return mr.current=re,()=>clearTimeout(re)},[p,Q,ve,Te,tt,He,at,Ge,Nt,N]);const qc=r=>{const l=Mn.current||Ca.current;if(!l||(un.current&&(l.expected_updated_at=un.current),Ur(l),l.snapshot_before===!0))return null;const y=E1(l,!1);if(r&&!gp(y))return null;try{const R=n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y),keepalive:r});return R.then(async P=>{const re=await P.json().catch(()=>({}));P.ok&&re.ok!==!1&&(yi(l),ji(l),Mn.current===l&&(Mn.current=null),vi(l,re))}).catch(()=>{}),R}catch{return null}},gd=h.useRef(qc);gd.current=qc,h.useEffect(()=>{const r=y=>{!Mn.current&&!xi.current||(y.preventDefault(),y.returnValue="")},l=()=>{gd.current(!0)};return window.addEventListener("beforeunload",r),window.addEventListener("pagehide",l),()=>{window.removeEventListener("beforeunload",r),window.removeEventListener("pagehide",l),gd.current(!0)}},[t]);const md=async()=>{await Ai(!0)&&a()},fr=async r=>{var R,P,re,xe;if(r===!0){const Le=[];!!String(Q||"").trim()||pe.length>0||Le.push("Esta landing no tiene pixel de TikTok. Si pautas solo en Meta con tu pixel global, ignora este punto."),ve&&fe.length>0&&!fe.some(Ft=>Ft.id===ve)&&Le.push("El pÃxel de Meta que elegiste para esta landing ya no está en tus pÃxeles: por ahora reporta a todos tus pÃxeles de Meta. Elige otro en la pestaña Dominio.");const Oe=String(p.country||Rr().code).toUpperCase(),St=Lk(p,Oe);if(St&&Le.push(St),p.push_to_dropi&&Kl(p)==="dropi"&&!p.send_to_lucidbot&&!p.dropi_account_id&&!p.country&&new Set(ka.map(Ft=>Ft.country).filter(Boolean)).size>1&&Le.push("Tienes cuentas de Dropi de varios paÃses y esta landing no dice de cuál es: sus pedidos saldrÃan por la bodega del paÃs de tu perfil. Elige el paÃs de la landing, o su cuenta de Dropi."),p.push_to_dropi&&Kl(p)==="dropi"&&!p.send_to_lucidbot&&!p.dropi_account_id){const Ft=ka.filter(Tt=>Tt.country&&Tt.country===String(p.country||"").toUpperCase());Ft.length>1&&Le.push(`Tienes ${Ft.length} cuentas de Dropi de ${p.country} y esta landing no dice a cuál sube: sus pedidos NO se van a subir hasta que elijas la cuenta.`)}const rt=Array.isArray(p.bundles)&&p.bundles.some(Ft=>Number(Ft.qty)===1&&Number(Ft.price)>0);if(!ke&&!pt&&!(Number((R=p.product)==null?void 0:R.price)>0)&&!rt&&Le.push("El producto no tiene precio."),!ke&&!pt&&!p.modo_codigo&&!(Number((P=p.product)==null?void 0:P.compare_at_price)>0)&&!rt&&Le.push("Sin precio tachado: la oferta pierde fuerza (opcional pero recomendado)."),!(((re=p.product)==null?void 0:re.images)||[]).length&&!ke&&!p.modo_codigo&&Le.push("La galerÃa no tiene fotos."),Le.length&&!confirm(`Antes de publicar, revisa esto: 1098 1099`+Le.map(Ft=>"- "+Ft).join(` 1100`)+` 1101 1102¿Publicar de todas formas?`))return}if(r===!0&&ke&&String(((xe=p.whatsapp)==null?void 0:xe.number)||"").replace(/\D/g,"").length<8){alert("Agrega tu número de WhatsApp antes de publicar (es el único botón de esta página).");return}if($e(!0),ue(""),!await Ai(!1)){$e(!1);return}mr.current&&clearTimeout(mr.current),Mn.current=null,await As.current.catch(()=>{});const l=r===!0?"published":r===!1?"draft":xt,y={...dd(),...pp(pr.current,_r.current),config:{...p,upsell:He?p.upsell:null,order_bump:at?p.order_bump:null,downsell:Ge?p.downsell:null,prelanding:Nt||p.page_type==="advertorial"?p.prelanding:null},pixel_id:Q||null,meta_pixel_id:ve||null,meta_pixel_exclusivo:!!ve&&Te,custom_domain:tt.trim(),status:l};(un.current||g!=null&&g.updated_at)&&(y.expected_updated_at=un.current||g.updated_at),Ur(y),xi.current=!0,C
1102a.current=y;try{const Le=await tr(y);if(!Le){alert("No se pudo guardar la versión anterior. Intenta de nuevo; tus cambios siguen en este navegador.");return}const Oe=await(await n(`/api/landing/pages/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le)})).json();if(Oe.ok){if(yi(y),ji(y),vi(y,Oe)){Ut(l),f(Oe.page),Fe(Oe.page.custom_domain||""),Ae(!1);const St=xu(Oe.pedidos_reencuadrados);ue((r===!0?"¡Publicada!":"Guardado â")+(St?" · "+St:"")),setTimeout(()=>ue(""),St?9e3:2500)}hr(Oe)}else alert(Oe.message||"No se pudo guardar. Revisa los datos e intenta de nuevo.")}catch{alert("No se pudo guardar. Revisa tu conexión e intenta de nuevo.")}finally{Ca.current===y&&(Ca.current=null),xi.current=!1,zt(),$e(!1)}},ws=async()=>{if(confirm("¿Borrar esta landing? No se puede deshacer.")){try{const r=await n(`/api/landing/pages/${t}`,{method:"DELETE"}),l=await r.json().catch(()=>({}));if(!r.ok||l.ok===!1){alert(l.message||"No se pudo borrar la landing. Intenta de nuevo.");return}}catch{alert("No se pudo borrar la landing. Revisa tu conexión.");return}Mn.current=null,a()}},hd=()=>{const r=j,l=r==null?void 0:r.config;if(!l||typeof l!="object"||Array.isArray(l)){ue("La copia local no tiene un formato recuperable. Contacta soporte antes de descartarla.");return}gr();const y={...dd(),...pp(pr.current,_r.current),config:l,pixel_id:r.pixel_id??null,...r.meta_pixel_id!==void 0?{meta_pixel_id:r.meta_pixel_id}:{},...r.meta_pixel_exclusivo!==void 0?{meta_pixel_exclusivo:r.meta_pixel_exclusivo}:{},...r.custom_domain!==void 0?{custom_domain:r.custom_domain}:{},expected_updated_at:un.current||String((g==null?void 0:g.updated_at)||"")};if(!Ur(y)){ue("No se pudo preparar la recuperación local. No cierres esta pestaña y contacta soporte.");return}ji(r),Mn.current=y;const R=b.slice(1);v(R),V(os(l)),ut(!!l.upsell),dt(!!l.order_bump),vt(!!l.downsell),sa(!!l.prelanding),r.pixel_id!==void 0&&de(String(r.pixel_id||"")),r.meta_pixel_id!==void 0&&ge(String(r.meta_pixel_id||"")),r.meta_pixel_exclusivo!==void 0&&ie(r.meta_pixel_exclusivo===!0||Number(r.meta_pixel_exclusivo)===1),r.custom_domain!==void 0&&Fe(String(r.custom_domain||"")),ue("Cambios locales cargados. Espera a que aparezca Guardado antes de cerrar.")},fd=()=>{if(!j||!window.confirm("¿Conservar la versión actual y descartar los cambios locales sin recuperar?"))return;if(!ji(j)){ue("No se pudo retirar la copia local. No cierres esta pestaña y contacta soporte.");return}const r=b.slice(1);v(r),ue("Se conservó la versión actual.")};if(!g)return e.jsx("div",{style:{...Jt,maxWidth:720,margin:"0 auto"},children:"Cargandoâ¦"});const dl=Kl(p)||((gl=ne==null?void 0:ne.dropi)!=null&&gl.enabled?"dropi":(vd=ne==null?void 0:ne.mastershop)!=null&&vd.enabled?"mastershop":(Uc=ne==null?void 0:ne.envios99)!=null&&Uc.enabled?"envios99":"dropi"),Qr={clave:dl,nombre:vg[dl],campo:oc[dl]},xd=Rr().code,Ro=String(p.country||xd).toUpperCase(),Fc=DS(p,o,Ro,br(Ro).currency),ks=Number(p.dropi_account_id)||0,In=ks?ka.find(r=>Number(r.id)===ks):null,Ka=!ka.length||(In?!String(In.country||"").trim()||String(In.country).toUpperCase()===Ro:ka.some(r=>String(r.country||"").toUpperCase()===Ro)),Cs=e.jsxs(e.Fragment,{children:[e.jsxs(ht,{title:"Pixel de TikTok de esta página",children:[e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:["Por defecto, cada pedido se reporta a ",e.jsx("b",{children:"todos"})," tus pixeles de TikTok. Si vendes productos distintos en ",e.jsx("b",{children:"cuentas distintas"})," (ej: el collar en una cuenta y el frasco en otra), pon aquà el ID del pixel de ESTA página para que sus ventas no se mezclen con las de las otras."]}),e.jsx("label",{style:D,children:"Pixel de esta página"}),pe.length===0?e.jsx("p",{role:"status",style:{fontSize:12.5,color:"var(--warning)",margin:"4px 0 0"},children:"No tienes pixeles de TikTok conectados. Agrégalos en Ajustes (con su token) para que las ventas se reporten."}):(()=>{const r=[{id:"",label:"Todos mis pixeles",sub:"Lo normal: cada venta se reporta a todos. Recomendado.",token:null},...pe.map((l,y)=>({id:l.id,label:y===0?"Pixel principal":`Pixel ${y+1}`,sub:"ID: "+l.id,token:l.hasToken})),...Q&&!pe.some(l=>l.id===Q)?[{id:Q,label:"Pixel de esta página",sub:"ID: "+Q,token:null}]:[]];return e.jsx("div",{style:{display:"grid",gap:8},children:r.map(l=>{const y=Q===l.id;return e.jsxs("button",{type:"button",onClick:()=>de(l.id),className:`lk-act ${y?"lk-ring-aurora":""}`,style:{textAlign:"left",display:"flex",alignItems:"center",gap:11,padding:"12px 13px",borderRadius:12,cursor:"pointer",border:`1.6px solid ${y?"transparent":"var(--border, #e3e6ee)"}`,background:y?"transparent":"var(--card-bg, #fff)",boxShadow:y?`0 8px 22px -14px ${me}`:"none"},children:[e.jsx("span",{style:{flex:"none",width:18,height:18,borderRadius:"50%",border:`2px solid ${y?me:"var(--border, #cbd5e1)"}`,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"border-color .15s"},children:y&&e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:me}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:800,fontSize:13.5,color:y?me:"var(--text, #111)"},children:l.label}),l.token!==null&&e.jsx("span",{style:{fontSize:10.5,fontWeight:800,padding:"2px 7px",borderRadius:999,background:l.token?"var(--notice-success-bg)":"var(--notice-warning-bg)",color:l.token?"var(--success)":"var(--warning)"},children:l.token?"Con token":"Sin token"})]}),e.jsx("span",{style:{display:"block",fontFamily:l.id?"monospace":"inherit",fontSize:l.id?12:11.5,color:"var(--text-muted)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.sub})]})]},l.id||"__all")})})})(),Q&&(()=>{const r=pe.find(l=>l.id===Q);return r?r.hasToken?e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--success)",margin:"6px 0 0"},children:"Conectado con token. Las ventas de esta página se reportarán a este pixel."}):e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--warning)",margin:"6px 0 0"},children:"Este pixel no tiene token (Events API) en Ajustes: solo reportará desde el navegador, menos confiable. Agrega su token."}):e.jsx("p",{role:"alert",style:{fontSize:11.5,color:"var(--danger)",margin:"6px 0 0",fontWeight:700},children:"Este pixel NO está en tus Ajustes. Las ventas no se reportarán por el servidor a TikTok. Agrégalo en Ajustes con su token."})})()]}),e.jsxs(ht,{title:"PÃxel de Meta de esta página",children:[e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:["Por defecto, cada pedido se reporta a ",e.jsx("b",{children:"todos"})," tus pÃxeles de Meta. Si vendes productos distintos en ",e.jsx("b",{children:"cuentas distintas"}),", elige aquà el pÃxel de ESTA página para que sus ventas no se mezclen con las de las otras."]}),e.jsx("label",{style:D,children:"A qué pÃxel de Meta reporta"}),e.jsx(F8,{elegido:ve,onElegir:r=>{ge(r),r||ie(!1)},mios:fe,deLaCuenta:We}),ve&&e.jsxs("label",{style:{fontSize:13,display:"flex",alignItems:"flex-start",ga
1102p:8,cursor:"pointer",marginTop:12},children:[e.jsx("input",{type:"checkbox",checked:Te,onChange:r=>ie(r.target.checked),style:{marginTop:2}}),e.jsxs("span",{children:[e.jsx("b",{children:"Solo esta página le manda ventas a este pÃxel"}),e.jsx("span",{style:{display:"block",fontSize:12,color:"var(--text-muted)",marginTop:2},children:"Tus otras landings y tu tienda dejan de reportarle. Márcalo si la cuenta de este pÃxel anuncia solo esta página: asà Meta no le suma ventas de las otras."})]})]})]})]});if(p.modo_codigo)return e.jsx(zk,{html:p.lienzo_html||"",onHtml:r=>x(l=>(dA(L.current,l),uA({...l,lienzo_html:r},y=>br(y||Rr().code).noDecimals,L.current))),previewHtml:Pa,landingId:Number(g.id)||0,nombre:g.name||"",savedMsg:Pe,onVolver:md,dominioPropio:Je,porQueSinDominio:Ct,seccionDePagos:ke?null:e.jsx(ev,{cfg:p,setCfg:x,moneda:br(Ro).currency,conectadas:o,abierta:!0}),seccionDePixeles:Cs,onVerPixeles:()=>Xa("pixeles"),pedido:{producto:String(((ml=p==null?void 0:p.product)==null?void 0:ml.name)||""),precio:Number(((_s=p==null?void 0:p.product)==null?void 0:_s.price)||0),precioAntes:Number(((jd=p==null?void 0:p.product)==null?void 0:jd.compare_at_price)||0),paisDeclarado:String(p.country||""),paisCuenta:xd,paisEfectivo:Ro,moneda:br(Ro).currency,paises:Object.values(rn).map(r=>({codigo:r.code,nombre:r.name,moneda:r.currency})),subeSolo:!!p.push_to_dropi&&!p.send_to_lucidbot,logistica:Qr.nombre,logisticas:[{clave:"dropi",nombre:"Dropi",disponible:!!((Kr=ne==null?void 0:ne.dropi)!=null&&Kr.enabled)&&sn===!0,compatible:Ka,motivo:(Ad=ne==null?void 0:ne.dropi)!=null&&Ad.enabled?sn!==!0?"Conecta Dropi antes de elegirla.":`Conecta o elige una cuenta de Dropi de ${Ro}.`:"Dropi no está en tu plan."},{clave:"mastershop",nombre:"Mastershop",disponible:!!((Qc=ne==null?void 0:ne.mastershop)!=null&&Qc.enabled)&&Cn,compatible:jg("mastershop",Ro),motivo:(hl=ne==null?void 0:ne.mastershop)!=null&&hl.enabled?Cn?"Mastershop solo admite pedidos de Colombia.":"Conecta Mastershop antes de elegirla.":"Mastershop no está en tu plan."},{clave:"envios99",nombre:"99envÃos",disponible:!!((fl=ne==null?void 0:ne.envios99)!=null&&fl.enabled)&&Nn,compatible:jg("envios99",Ro),motivo:(Ci=ne==null?void 0:ne.envios99)!=null&&Ci.enabled?Nn?"99envÃos solo admite pedidos de Colombia.":"Conecta 99envÃos antes de elegirla.":"99envÃos no está en tu plan."}],idLogistica:String(((xl=p==null?void 0:p.product)==null?void 0:xl[Qr.campo])||""),cuentasDropi:ka,cuentaDropiId:String(p.dropi_account_id||""),campos:(((Sd=p==null?void 0:p.form)==null?void 0:Sd.fields)||[]).map(r=>String((r==null?void 0:r.label)||(r==null?void 0:r.key)||"")).filter(Boolean)},onPedido:r=>x(l=>{const y={...l.product||{}};if(r.producto!==void 0&&(y.name=r.producto),r.precio!==void 0&&(y.price=r.precio),r.precioAntes!==void 0&&(y.compare_at_price=r.precioAntes),r.logistica&&oc[r.logistica]&&Kl(l)!==r.logistica)for(const re of Object.values(oc))delete y[re];r.idLogistica!==void 0&&(y[oc[r.logistica||Qr.clave]]=r.idLogistica);const R={...l,product:y,...r.subeSolo!==void 0?{push_to_dropi:r.subeSolo}:{}};return r.logistica&&(R.fulfillment_provider=r.logistica),r.pais!==void 0&&(r.pais?R.country=r.pais:delete R.country),r.dropiAccountId!==void 0&&(r.dropiAccountId?R.dropi_account_id=Number(r.dropiAccountId):delete R.dropi_account_id),R}),datos:{producto:String(((Kc=p==null?void 0:p.product)==null?void 0:Kc.name)||""),precio:Number((($s=p==null?void 0:p.product)==null?void 0:$s.price)||0),moneda:br(String((p==null?void 0:p.country)||Rr().code)).currency,pais:Ro,variantes:(Array.isArray(p.variants)?p.variants:[]).map(r=>({nombre:String((r==null?void 0:r.name)||""),opciones:((r==null?void 0:r.options)||[]).map(l=>String((l==null?void 0:l.value)??(l==null?void 0:l.label)??l??"")).filter(Boolean)})).filter(r=>r.nombre&&r.opciones.length),campos:(((Is=p==null?void 0:p.form)==null?void 0:Is.fields)||[]).map(r=>({clave:String((r==null?void 0:r.key)||""),etiqueta:String((r==null?void 0:r.label)||""),obligatorio:!!(r!=null&&r.required)})).filter(r=>r.clave),conWhatsapp:!!((wd=p==null?void 0:p.whatsapp)!=null&&wd.enabled),dominioPropio:Je,automatizacion:{activa:!!p.push_to_dropi&&!p.send_to_lucidbot,logistica:Qr.nombre,productoId:String(((Yc=p==null?void 0:p.product)==null?void 0:Yc[Qr.campo])||"")},esServicio:p.page_type==="servicio",esWhatsapp:p.page_type==="whatsapp",whatsappNumero:String(((kd=p==null?void 0:p.whatsapp)==null?void 0:kd.number)||"").replace(/\D/g,""),pago:Fc,quitados:Array.isArray((bl=p==null?void 0:p.form)==null?void 0:bl.addr_removed)?p.form.addr_removed.map(r=>String(r)):[],conOfertas:Array.isArray(p==null?void 0:p.bundles)&&p.bundles.length>0,cantidades:(Array.isArray(p==null?void 0:p.bundles)?p.bundles:[]).map(r=>Number(r==null?void 0:r.qty)||0).filter(r=>r>0),envio:{gratis:!(((yl=p==null?void 0:p.shipping)==null?void 0:yl.mode)==="general"&&Number((Cd=p==null?void 0:p.shipping)==null?void 0:Cd.general_cop)>0)&&((Jc=p==null?void 0:p.shipping)==null?void 0:Jc.mode)!=="zones",valor:Number((_d=p==null?void 0:p.shipping)==null?void 0:_d.general_cop)||0},adicional:p!=null&&p.order_bump&&(p.order_bump.label||p.order_bump.price)?{nombre:String(p.order_bump.label||""),precio:Number(p.order_bump.price)||0}:null,gracias:{titulo:(Zc=p==null?void 0:p.thankyou)==null?void 0:Zc.headline,texto:(Xc=p==null?void 0:p.thankyou)==null?void 0:Xc.text,boton:(eu=p==null?void 0:p.thankyou)==null?void 0:eu.cta_text,irA:($d=p==null?void 0:p.thankyou)==null?void 0:$d.redirect_url,irEn:Number((Id=p==null?void 0:p.thankyou)==null?void 0:Id.redirect_in)||0}},acciones:e.jsxs(e.Fragment,{children:[g.status==="published"&&e.jsx("a",{href:we&&g.use_lumy_domain?`https://${we}/${g.slug}`:g.custom_domain?`https://${g.custom_domain}/`:g.use_lumy_domain?`https://lumycol.com/l/${g.slug}`:`/l/${g.slug}`,target:"_blank",rel:"noreferrer",style:{...ee,padding:"8px 13px",textDecoration:"none",display:"inline-block"},children:"Ver â"}),xt==="published"&&oe&&e.jsx("button",{style:{...xa,padding:"8px 16px"},onClick:()=>fr(!0),disabled:Qt,title:"Tu página publicada sigue como estaba. Esto saca al aire lo que tienes guardado como borrador.",children:"Publicar cambios"}),xt==="published"?e.jsx("button",{style:{...ee,padding:"8px 14px",color:"var(--warning)"},onClick:()=>fr(!1),disabled:Qt,children:"Despublicar"}):e.jsx("button",{style:{...xa,padding:"8px 16px"},onClick:()=>fr(!0),disabled:Qt,children:"Publicar"})]})});const cl=r=>(r||[]).join(` 1103`),lp=r=>r.split(` 1104`).map(l=>
1104l.trim()).filter(Boolean);return e.jsxs(F2.Provider,{value:"openai",children:[B&&typeof document<"u"?e.jsx(AC,{code:B,onClose:()=>U(null)}):null,z&&typeof document<"u"?e.jsx(LC,{name:z.name,candidate:z.candidate,original:p,renderPreview:ll,onApply:sl,onClose:()=>G(null)}):null,e.jsxs("div",{ref:M,className:"lk-editor","aria-busy":N,style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)",pointerEvents:N?"none":void 0,opacity:N?.72:1},children:[e.jsx(gm,{}),j&&e.jsxs("div",{role:"alert",style:{marginBottom:12,padding:"12px 14px",borderRadius:12,border:"1px solid var(--notice-warning-border)",background:"var(--notice-warning-bg)",color:"var(--notice-warning-text)"},children:[e.jsxs("strong",{style:{display:"block",fontSize:13.5},children:["Encontramos ",b.length===1?"una copia local":`${b.length} copias locales`," que chocan con una edición más reciente."]}),e.jsx("span",{style:{display:"block",marginTop:3,fontSize:12.5,lineHeight:1.45},children:"No se borraron. Se muestra primero la más reciente; decide qué hacer con cada una antes de seguir."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:[e.jsx("button",{type:"button",onClick:hd,style:{...xa,padding:"8px 12px"},children:"Recuperar mis cambios locales"}),e.jsx("button",{type:"button",onClick:fd,style:{...ee,padding:"8px 12px"},children:"Conservar la versión actual"})]})]}),e.jsxs("div",{className:"lk-actions",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:12,gap:8},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start",flex:"none"},children:[e.jsx("button",{style:{...ee,padding:"8px 13px",flex:"none"},onClick:md,children:"â Volver"}),e.jsxs("div",{className:"lk-ia-row",children:[e.jsx(by,{config:p,mode:"build",compact:!0,renderPreview:ll,onApply:async r=>sl(r),onApplied:()=>mo("producto",["Contenido de la página (fotos, videos, gifs, textos)"])}),e.jsx("a",{className:"lk-ia-btn",href:SC,target:"_blank",rel:"noreferrer",style:{...ee,padding:"8px 14px",textDecoration:"none"},title:"Genera las imágenes en el creador y súbelas en la pestaña Página",children:"Imágenes con IA â"}),e.jsx("a",{className:"lk-ia-btn",href:wC,target:"_blank",rel:"noreferrer",style:{...ee,padding:"8px 14px",textDecoration:"none"},title:"Crea la página con IA",children:"Página con IA â"})]})]}),e.jsxs("div",{className:"lk-editor-acts",style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[Pe&&e.jsx("span",{role:"status",style:{fontSize:12.5,color:/^(sin guardar|no se pudo|error)/i.test(Pe)?"var(--danger)":"var(--success)",fontWeight:700},children:Pe}),g.status==="published"&&e.jsx("a",{href:we&&g.use_lumy_domain?`https://${we}/${g.slug}`:g.custom_domain?`https://${g.custom_domain}/`:g.use_lumy_domain?`https://lumycol.com/l/${g.slug}`:`/l/${g.slug}`,target:"_blank",rel:"noreferrer",style:{...ee,padding:"8px 13px",textDecoration:"none",display:"inline-block"},children:"Ver â"}),e.jsx("button",{style:{...ee,padding:"8px 14px",opacity:Ra?1:.45,cursor:Ra?"pointer":"default"},onClick:X,disabled:!Ra,title:Ra?"Deshacer el último cambio":"No hay cambios que deshacer",children:"⺠Deshacer"}),e.jsx("button",{style:{...ee,padding:"8px 14px",opacity:S?.55:1,cursor:S?"default":"pointer"},disabled:S,title:"Traer los cambios que hizo tu Claude o tu ChatGPT, sin recargar la página",onClick:async()=>{if($(!0),!await Ai(!0)){$(!1);return}try{try{await As.current}catch{}const l=await(await n(`/api/landing/pages/${t}`)).json();if(l!=null&&l.ok&&l.page){const y=JSON.stringify(p);f(l.page),V(os(l.page.config||{})),de(l.page.pixel_id||""),ge(l.page.meta_pixel_id||""),ie(Number(l.page.meta_pixel_exclusivo)===1),Ut(l.page.status),Fe(l.page.custom_domain||""),un.current=String(l.page.updated_at||"");const R=JSON.stringify(l.page.config||{})!==y;ue(R?"Cambios del chat traÃdos â":"No hay cambios nuevos"),setTimeout(()=>ue(""),2500)}else ue("No se pudo traer"),setTimeout(()=>ue(""),2500)}catch{ue("Sin conexión"),setTimeout(()=>ue(""),2500)}zt(),$(!1)},children:S?"Trayendoâ¦":"â³ Traer del chat"}),e.jsx("button",{style:{...ee,padding:"8px 14px"},title:"Sacar un código para que otro vendedor de Lumy copie esta landing",onClick:async()=>{try{const l=await(await n(`/api/landing/pages/${t}/compartir`,{method:"POST"})).json();if(!l.ok){alert(l.message||"No se pudo crear el código.");return}const y=String(l.codigo||"").trim();if(!y){alert("No se pudo crear el código.");return}U(y)}catch{alert("No se pudo conectar. Intenta de nuevo.")}},children:"Compartir"}),e.jsx("button",{style:{...ee,padding:"8px 14px"},title:"Crear una copia de esta landing (borrador, con su propia dirección)",onClick:async()=>{try{(await(await n(`/api/landing/pages/${t}/duplicate`,{method:"POST"})).json().catch(()=>({}))).ok?a():alert("No se pudo duplicar. Intenta de nuevo.")}catch{alert("Error de conexión al duplicar.")}},children:"Duplicar"}),xt==="published"?e.jsx("button",{style:{...ee,padding:"8px 14px",color:"var(--warning)"},onClick:()=>fr(!1),disabled:Qt,children:"Despublicar"}):e.jsx("button",{style:{...xa,padding:"8px 16px"},onClick:()=>fr(!0),disabled:Qt,children:"Publicar"})]})]}),(()=>{const r=qA(MA(p));if(!r.length)return null;const l=r.filter(y=>y.grave).length;return e.jsxs("div",{role:"status",style:{border:"1px solid var(--notice-warning-border)",background:"var(--notice-warning-bg)",borderRadius:10,padding:"10px 12px",margin:"0 0 12px",fontSize:12.5,lineHeight:1.55},children:[e.jsx("div",{style:{fontWeight:700,color:"var(--notice-warning-text)"},children:l>0?"Hay texto que TikTok suele rechazar":"Un par de frases que conviene revisar"}),e.jsx("ul",{style:{margin:"6px 0 0",paddingLeft:17,color:"var(--text-muted)"},children:r.map((y,R)=>e.jsxs("li",{style:{marginTop:R?4:0},children:[e.jsxs("b",{style:{color:"var(--text)"},children:["â",y.frase,"â"]})," â ",y.motivo," ",y.sugerencia]},R))}),e.jsx("div",{style:{marginTop:6,fontSize:11.5,color:"var(--text-muted)"},children:"Puedes publicar igual: esto es solo un aviso, no un bloqueo."})]})})(),e.jsxs("div",{ref:hn,className:"lk-scroll-x",style:{position:"relative",display:"flex",gap:2,marginBottom:14,padding:4,background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,width:"fit-content",maxWidth:"100%"},children:[go&&e.jsx("span",{"aria-hidden":!0,style:{position:"absolute",top:4,bottom:4,left:0,zIndex:0,transform:`translateX(${go.x-4}px)`,width:go.w,borderRadius:10,background:"var(--bg-card, #fff)",boxShadow:"0 1px 1px rgba(11,16,32,.05), 0 6px 16px -8px rgba(11,16,32,.35)",transition:"transform .42s cubic-bezier(.22,1,.28,1), width .42s cubic-bezier(.22,1,.28,1)"}}),BC.filter(r=>!(ke&&r.v==="upsell")).filter(r=>!(p.modo_codigo&&(r.v==="landing"||r.v==="diseno"))).map(r=>{const l=Oa===r.v;return e.jsxs("button",{ref:y=>{Co.current[r.v]=y},onClick:()=>{Xa(r.v),Ln(null)},style:{position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",gap:7,padding:"9px 14px",fontSize:13,fontWeight:700,flex:"none",whiteSpace:"nowrap",cursor:"pointer",border:"none",borderRadius:10,background:"transparent",transition:"color .22s ease",color:l?me:"var(--text-muted, #64748b)"},children:[r.ic,ke&&r.v==="formulario"?"WhatsApp":r.l]},r.v)})]}
1104),!ae&&e.jsx("button",{onClick:()=>pn(r=>!r),style:{...ee,width:"100%",marginBottom:12,fontWeight:700,transition:"all .18s ease"},children:ta?"Ocultar vista previa â´":"Ver cómo lo ve tu cliente â¾"}),e.jsxs("div",{className:"lk-2col",style:{display:"flex",gap:22,alignItems:"flex-start",flexWrap:ae?"nowrap":"wrap",justifyContent:"center",width:"100%",maxWidth:1320,margin:"0 auto"},children:[(ae||ta)&&e.jsxs("div",{className:"lk-col",style:{alignSelf:"flex-start",maxWidth:"100%",...ae?{flex:it?"0 0 280px":"0 0 340px",position:"sticky",top:8,minWidth:it?240:280}:{flex:"1 1 100%",minWidth:0,marginBottom:14}},children:[e.jsx("style",{children:"@keyframes lkAurora{to{background-position:300% 0}}"}),e.jsxs("button",{type:"button","data-inspect-toggle":!0,onClick:()=>dn(r=>!r),style:{display:"flex",alignItems:"center",gap:7,margin:"0 auto 8px",padding:"7px 15px",borderRadius:999,border:ja?"1.5px solid transparent":"1.5px solid var(--border, #e5e7eb)",background:ja?"linear-gradient(90deg, #0866ff, #8b5cf6, #ec4899, #f59e0b, #0866ff)":"var(--card-bg, #fff)",backgroundSize:ja?"300% 100%":void 0,animation:ja?"lkAurora 4s linear infinite":void 0,color:ja?"#fff":"var(--text-muted)",fontSize:12,fontWeight:800,cursor:"pointer",boxShadow:ja?"0 6px 18px -6px rgba(139,92,246,.55)":"none",transition:"box-shadow .2s ease"},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"8"}),e.jsx("circle",{cx:"12",cy:"12",r:"2.5"}),e.jsx("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3"})]}),ja?"Inspector activo: toca algo en el teléfono":"Modo inspector"]}),ja&&ao&&e.jsxs("button",{type:"button",onClick:ar,style:{display:"flex",alignItems:"center",gap:8,margin:"0 auto 8px",padding:"8px 14px",borderRadius:12,border:"1.5px solid var(--ai-note-border)",background:"var(--ai-note-bg)",color:"var(--ai-note-muted)",fontSize:12,fontWeight:800,cursor:"pointer",width:"fit-content",maxWidth:"100%"},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"6"}),e.jsx("circle",{cx:"9",cy:"9",r:"1.6"}),e.jsx("path",{d:"M21 15l-5-4-8 7"})]}),e.jsx("span",{style:{textAlign:"left",lineHeight:1.25},children:"Cambiar la forma de TODAS las fotos (cada una se ajusta en su bloque)"}),e.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:e.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})})]}),e.jsx("div",{style:{...ae?{}:{width:"min(452px, calc((100vh - 210px) / 2.06))",minWidth:262,margin:"0 auto"},background:"#0b0b0f",borderRadius:42,padding:11,boxShadow:"0 14px 40px rgba(0,0,0,.28)"},children:e.jsx("div",{ref:Yn,style:{position:"relative",height:ae?"70vh":"62vh",minHeight:420,overflow:"hidden",borderRadius:32,background:"#fff"},children:e.jsx("iframe",{ref:fo,title:"preview",srcDoc:Pa,onLoad:()=>{var r,l,y,R;try{(l=(r=fo.current)==null?void 0:r.contentWindow)==null||l.scrollTo(0,_o.current)}catch{}try{ja&&((R=(y=fo.current)==null?void 0:y.contentWindow)==null||R.postMessage({lumyInspect:!0},"*"))}catch{}},style:{width:430,height:`${100/yr}%`,border:0,background:"#fff",display:"block",transform:`scale(${yr})`,transformOrigin:"top left"}})})}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:7,textAlign:"center"},children:"Asà la ve tu cliente. Se actualiza mientras editas"})]}),e.jsxs("div",{className:"lk-col",style:{...ae?{flex:"1 1 380px",minWidth:0,maxWidth:860,maxHeight:"calc(100vh - 170px)",overflowY:"auto",overflowX:"hidden",scrollbarGutter:"stable",paddingRight:6}:{flex:"1 1 100%",minWidth:0,maxWidth:"100%"}},children:[Oa==="producto"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Producto"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"Lo que vendes: nombre, precio, fotos, variantes y su enlace con tu logÃstica."})]}),!pt&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{title:ke?"Producto en Dropi (para los pedidos que cierre tu agente de WhatsApp)":sn!==!1||!Cn&&!Nn?"Producto en Dropi (subida automática)":Cn&&!Nn?"Producto en Mastershop (subi
1104da automática)":Nn&&!Cn?"Producto en 99envÃos (subida automática)":"Producto y subida automática",children:[e.jsxs(mt,{children:["El ",e.jsx("b",{children:"ID que pongas aquà decide a dónde van los pedidos de esta landing"}),": con ID de Dropi suben a Dropi, con ID de Mastershop a Mastershop, con ID de 99envÃos quedan como solicitud allá. Puedes tener una landing por logÃstica."]}),(sn!==!1||!Cn&&!Nn)&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"ID de producto en Dropi"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0},value:q.dropi_product_id??"",onChange:r=>Zt({dropi_product_id:r.target.value}),placeholder:"Ej: 12345"}),e.jsx("button",{style:{...xa,whiteSpace:"nowrap",padding:"10px 14px"},onClick:sp,disabled:Qi,children:Qi?"Importandoâ¦":"Importar de Dropi"})]}),e.jsxs(mt,{children:["Con solo escribir el ID y ",e.jsx("b",{children:"guardar"}),", la landing queda ",e.jsx("b",{children:"enlazada"})," (los pedidos se crean en ese producto de Dropi). El botón ",e.jsx("b",{children:"Importar"})," es opcional: te ",e.jsx("b",{children:"pregunta qué traer"})," (variantes, nombre o precio). Nunca toca tus fotos ni tu descripción."]})]}),Cn&&e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("label",{style:D,children:"ID de producto en Mastershop"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0},value:q.mastershop_product_id??"",onChange:r=>Zt({mastershop_product_id:r.target.value}),placeholder:"Ej: 21823"}),e.jsx("button",{style:{...xa,whiteSpace:"nowrap",padding:"10px 14px",background:"#0d9488"},onClick:()=>el("mastershop"),disabled:Qi,children:Qi?"Importandoâ¦":"Importar de Mastershop"})]}),e.jsxs(mt,{children:["Opcional. Pon el ID del producto en Mastershop y ",e.jsx("b",{children:"guarda"})," para poder enviar los pedidos allá con el botón ",e.jsx("b",{children:"âEnviar a Mastershopâ"})," del CRM."]})]}),Nn&&e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("label",{style:D,children:"ID de producto en 99envÃos (solicitud automática)"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0},value:q.envios99_product_id??"",onChange:r=>Zt({envios99_product_id:r.target.value}),placeholder:"Ej: 270 (el ID de tu inventario en 99envÃos)"}),e.jsx("button",{style:{...xa,whiteSpace:"nowrap",padding:"10px 14px",background:"#ea580c"},onClick:()=>el("envios99"),disabled:Qi,children:Qi?"Importandoâ¦":"Importar de 99envÃos"})]}),e.jsxs(mt,{children:["Con este ID y ",e.jsx("b",{children:"guardar"}),", cada pedido nuevo se sube ",e.jsx("b",{children:"al instante"})," a 99envÃos como ",e.jsx("b",{children:"solicitud editable"})," (sin guÃa todavÃa). Cuando el cliente ",e.jsx("b",{children:"confirma por WhatsApp"}),", la solicitud se confirma sola y nace la guÃa; si ",e.jsx("b",{children:"cancela"}),", se rechaza sola. Sin este ID, sigue el botón clásico de guÃa directa."]})]})]}),e.jsxs(ht,{title:"Importar desde un link",children:[e.jsx("label",{style:D,children:"Pega el link del producto"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0},value:js,onChange:r=>Zi(r.target.value),placeholder:"https://la-pagina-del-producto.com/...",onKeyDown:r=>{r.key==="Enter"&&fi()}}),sd&&e.jsx("button",{disabled:Ji,style:{...ee,padding:"7px 12px",fontSize:12,whiteSpace:"nowrap",opacity:Ji?.5:1},onClick:()=>{x(sd),ro(null),ue("Volvió a como estaba antes del import â"),setTimeout(()=>ue(""),2500)},children:"Volver a como estaba"}),e.jsx("button",{style:{...xa,whiteSpace:"nowrap",padding:"10px 14px"},onClick:()=>fi(),disabled:Ji,children:Ji?"Importandoâ¦":"Importar del link"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8,flexWrap:"wrap"},children:[e.jsx("button",{style:{...ee,whiteSpace:"nowrap",padding:"8px 12px",fontSize:12.5},onClick:zc,disabled:Ji,children:Ji?"Trayendoâ¦":"Solo fotos de reseñas"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",lineHeight:1.45},children:"Trae únicamente las fotos de clientes y las combina con tus reseñas actuales, una foto por reseña sin foto (no crea tarjetas nuevas ni toca el nombre, el precio o el contenido)."})]}),e.jsxs(mt,{children:["Pega el link de cualquier página de producto y traemos nombre, precio, fotos, textos ",e.jsx("b",{children:"en su orden original"})," y las reseñas reales que la página publique. Las imágenes se guardan en Lumy. Reemplaza la galerÃa, el contenido y las reseñas del producto anterior."]})]}),!ke&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Subida automática de pedidos",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:p.send_to_lucidbot?"not-allowed":"pointer",opacity:p.send_to_lucidbot?.5:1},children:[e.jsx("input",{type:"checkbox",disabled:!!p.send_to_lucidbot,checked:!!p.push_to_dropi&&!p.send_to_lucidbot,onChange:r=>x(l=>({...l,push_to_dropi:r.target.checked}))})," Activar"]})}),children:[p.send_to_lucidbot&&e.jsxs("div",{role:"status",style:{background:"var(--ai-note-bg)",border:"1px solid var(--ai-note-border)",borderRadius:10,padding:"10px 12px",margin:"6px 0 0",fontSize:12.5,color:"var(--ai-note-text)",lineHeight:1.45},children:["Desactivado: esta landing ",e.jsx("b",{children:"envÃa los pedidos a LucidBot"})," (abajo), no a Dropi."]}),p.push_to_dropi&&!p.send_to_lucidbot&&sn===!1&&e.jsxs("div",{role:"status",style:{background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:10,padding:"10px 12px",margin:"6px 0 0",fontSize:12.5,color:"var(--notice-warning-text)",lineHeight:1.45},children:["No tienes Dropi conectado. Conéctalo en la pestaña ",e.jsx("b",{children:"Dropi"}),' para que los pedidos suban solos. Mientras tanto se guardan en tu CRM marcados como "Dropi falló".']}
1104),p.push_to_dropi&&!String(q.dropi_product_id??"").trim()&&e.jsxs("div",{role:"alert",style:{background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:10,padding:"10px 12px",margin:"6px 0 0",fontSize:12.5,color:"var(--danger)",lineHeight:1.45},children:["Falta el ",e.jsx("b",{children:"ID del producto en Dropi"}),' (arriba, en "Producto en Dropi"). Sin él, el pedido no puede subir a Dropi.']}),p.push_to_dropi&&!p.send_to_lucidbot&&ka.length>1&&e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("label",{style:D,children:"¿A cuál de tus cuentas de Dropi suben los pedidos de esta landing?"}),e.jsxs("select",{style:E,value:String(p.dropi_account_id||""),onChange:r=>x(l=>({...l,dropi_account_id:r.target.value?Number(r.target.value):void 0})),children:[e.jsx("option",{value:"",children:"Automático, según el paÃs del pedido"}),ka.map(r=>e.jsxs("option",{value:r.id,children:[r.label||`Cuenta ${r.id}`,r.country?` · ${r.country}`:""]},r.id))]}),e.jsx(mt,{children:"Sin elegir, cada pedido sube a tu cuenta del paÃs que trae: los de Colombia a la de Colombia, los de Ecuador a la de Ecuador. Elige una cuenta concreta si tienes DOS del mismo paÃs â ahà el paÃs no alcanza para saber cuál, y el pedido no sube hasta que lo digas."})]}),e.jsx(mt,{children:"Si lo activas, cada pedido se crea automático en Dropi (requiere ID de producto Dropi). Mientras tanto, todos quedan en tu CRM."})]})}),!ke&&e.jsx(e.Fragment,{children:(Ga===!0||!!p.send_to_lucidbot)&&e.jsxs(ht,{title:"Enviar pedidos a LucidBot",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!p.send_to_lucidbot,onChange:r=>x(l=>({...l,send_to_lucidbot:r.target.checked,push_to_dropi:r.target.checked?!1:l.push_to_dropi}))})," Activar"]})}),children:[e.jsxs(mt,{children:["Si lo activas, los pedidos de esta landing se envÃan a ",e.jsx("b",{children:"LucidBot"})," para que su bot los confirme por WhatsApp y despache, y ",e.jsx("b",{children:"NO se suben a Dropi"}),". El pedido queda igual en tu CRM y las ventas se reportan a tus pixeles."]}),p.send_to_lucidbot&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid var(--border)",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,.02))"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:600},children:"Recuperar carritos abandonados"}),e.jsxs(mt,{children:["Si un cliente empieza el pedido y no lo termina, a los ~20 min LucidBot le escribe para recuperarlo. Usa el flujo de recuperación que elegiste en ",e.jsx("b",{children:"Integraciones"}),"."]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",whiteSpace:"nowrap",flexShrink:0},children:[e.jsx("input",{type:"checkbox",checked:!!p.lucidbot_recover_abandoned,onChange:r=>x(l=>({...l,lucidbot_recover_abandoned:r.target.checked}))})," Activar"]})]}),Ga===!1&&e.jsxs("div",{role:"status",style:{background:"var(--ai-note-bg)",border:"1px solid var(--ai-note-border)",borderRadius:10,padding:"10px 12px",margin:"8px 0 0",fontSize:12.5,color:"var(--ai-note-text)",lineHeight:1.45},children:["Conecta tu cuenta de LucidBot una sola vez en ",e.jsx("b",{children:"Landing â Pagos â Integraciones"})," (pega tu token y elige tu flujo de confirmación). Si no la conectas, el pedido queda pendiente."]})]})]})})]}),e.jsx(Ei,{children:pt?"Contenido del servicio":"Contenido del producto"}),e.jsxs(ht,{title:pt?"Tu servicio o infoproducto":"Producto",children:[e.jsx(Ea,{ai:{field:"Nombre / titular del producto",instruction:"Titular atractivo y claro, máximo 70 caracteres",current:q.name||"",productName:q.name||"",context:q.description||"",onPick:r=>Zt({name:r})},children:pt?"Nombre del servicio":"Nombre del producto"}),e.jsx("input",{style:E,value:q.name||"",onChange:r=>Zt({name:r.target.value}),placeholder:pt?"Ej: Lavado y desinfección de tapizados":"Ej: Reloj inteligente X9"}),!te&&!bt&&!pt&&e.jsx("button",{type:"button",onClick:()=>mo("diseno",["Forma de la página"]),style:{...ee,padding:"5px 10px",fontSize:11.5,fontWeight:700,marginTop:6},title:"Ir a los efectos del titular (degradado, marcador, brillo, neónâ¦)",children:"Efectos del tÃtulo â"}),e.jsx("label",{style:D,children:"Extensión del copy con IA"}),e.jsxs("select",{style:E,value:oa,disabled:bt,onChange:r=>{const l=r.target.value;x(y=>hy(y,l))},children:[e.jsx("option",{value:"rapida",children:"Rápida: 2 escenas, máximo 2 beneficios"}),e.jsx("option",{value:"equilibrada",children:"Equilibrada: 3 escenas, máximo 2 beneficios"}),e.jsx("option",{value:"explicativa",children:"Explicativa: 4 escenas, hasta 6 beneficios"})]}),e.jsx(mt,{children:"La IA crea cada escena como un tÃtulo y un párrafo de máximo dos frases. Los advertoriales usan siempre el modo Explicativa."}),e.jsx(Ea,{ai:{field:"Descripción del producto",instruction:"Una lÃnea de apoyo para el hero, máximo 2 frases y 130 caracteres, con un beneficio concreto",current:q.description||"",productName:q.name||"",onPick:r=>Zt({description:r})},children:"Descripción"}),e.jsx("textarea",{style:{...E,minHeight:80,resize:"vertical"},value:q.description||"",onChange:r=>Zt({description:r.target.value}),placeholder:"Texto persuasivo del productoâ¦"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",margin:"6px 2px 2px"},children:[e.jsx("input",{type:"checkbox",checked:q.desc_align==="center",onChange:r=>Zt({desc_align:r.target.checked?"center":void 0})})," Centrar la descripción"]}),e.jsx(Ea,{ai:{field:"Beneficios",instruction:`Devuelve ${wt===2?"máximo 2":"entre 2 y 6"} beneficios concretos, uno por lÃnea con saltos de lÃnea reales, cada uno una frase corta`,current:cl(q.bullets),productName:q.name||"",images:q.images,multiline:!0,listMax:wt,onPick:r=>Zt({bullets:lp(r).slice(0,wt)})},children:"Beneficios (uno por lÃnea)"}),e.jsx(L8,{value:q.bullets,onChange:r=>Zt({bullets:p.copy_length?r.slice(0,wt):r}),style:{...E,minHeight:80,resize:"vertical"},placeholder:`Resistente al agua 1105BaterÃa para todo el dÃa`}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,margin:"8px 0 2px",fontSize:13,cursor:"pointer",color:"var(--text-muted)"},children:[e.jsx("input",{type:"checkbox",checked:!!q.bullets_center,onChange:r=>Zt({bullets_center:r.target.checked})})," Centrar los beneficios en la página"]}),e.jsx("label",{style:D,children:"¿A quién le vendes? (opcional)"}),e.jsx("input",{style:E,maxLength:140,value:p.audience||"",onChange:r=>x(l=>({...l,audience:r.target.value||void 0})),placeholder:"Ej: mamás de niños pequeños en Colombia"}),e.jsx(mt,{children:"La IA usa esto para escribir textos, reseñas y diseño pensados en ESA persona. Una frase basta."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:pt?`Precio desde (${vr}, opcional)`:`Precio (${vr})`}),e.jsx("input",{style:E,type:"number",value:q.price??"",onChange:r=>no(An(r.target.value)),placeholder:pt?"VacÃo si cotizas":"89000"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Precio normal (tachado)"}),e.jsx("input",{style:E,type:"number",value:q.compare_at_price??"",onChange:r=>Zt({compare_at_price:An(r.target.value)}),placeholder:"129900"})]})]})]}),e.jsxs(ht,{title:pt?"Imágenes / portada":"GalerÃa principal (fotos principales)",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"La primera es la principal."}),e.jsx(Ru,{values:q.images||[],onChange:r=>Zt({images:r}),uploadsEnabled:Ia,usedUrls:Su(p),uniqueInList:!0}),e.jsx("label",{style:D,children:"Ajuste"}
1105),e.jsxs("select",{style:E,value:q.image_fit||"full",onChange:r=>Zt({image_fit:r.target.value}),children:[e.jsx("option",{value:"full",children:"Completas, sin recorte (recomendado)"}),e.jsx("option",{value:"square",children:"Cuadradas, recorte 1:1 (estilo catálogo)"})]}),e.jsxs("div",{style:{marginTop:14},"data-ins":"galeria:hero_video",children:[e.jsx("label",{style:D,children:"Video en la portada (opcional)"}),e.jsx(Nu,{value:q.hero_video||"",onChange:r=>Zt({hero_video:r||void 0}),uploadsEnabled:Ia,recorteSugerido:{siPasa:15,a:12}}),!!String(q.hero_video||"").trim()&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",margin:"8px 2px 0"},children:[e.jsx("input",{type:"checkbox",checked:q.hero_video_sound===!0,onChange:r=>Zt({hero_video_sound:r.target.checked||void 0})})," Permitir sonido"]}),(()=>{const r=String(q.hero_video||"").trim(),l=["inmersivo","diagonal","panorama"].includes(String(p.hero_style||""));return r&&!l?e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"6px 2px 0",lineHeight:1.45},children:[e.jsx("b",{children:"Con esta portada el video no se va a ver."})," Solo funciona con las portadas donde el tÃtulo va ENCIMA de la foto: Inmersivo, Diagonal o Panorama. Cámbiala en Diseño."]}):r&&!(q.images||[]).length?e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"6px 2px 0",lineHeight:1.45},children:[e.jsx("b",{children:"Falta la primera foto."})," Es lo que se ve mientras el video carga, y lo único que queda si falla."]}):e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"6px 2px 0",lineHeight:1.45},children:"Se reproduce solo, sin sonido y en bucle detrás del tÃtulo. Con «Permitir sonido», el comprador lo activa con el botón del parlante. La primera foto queda de respaldo. Solo aplica a las portadas con el tÃtulo encima de la foto (Inmersivo, Diagonal, Panorama)."})})(),!!String(q.hero_video||"").trim()&&!/youtube|youtu\.be|tiktok\.com|vimeo\.com/i.test(String(q.hero_video))&&e.jsxs(e.Fragment,{children:[e.jsx(s8,{url:String(q.hero_video)}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:7,fontSize:12,marginTop:8,cursor:"pointer",lineHeight:1.45},children:[e.jsx("input",{type:"checkbox",style:{marginTop:2},checked:q.hero_video_ahorro===!0,onChange:r=>Zt({hero_video_ahorro:r.target.checked||void 0})}),e.jsxs("span",{children:[e.jsx("b",{children:"Ahorrar datos del comprador:"})," con ahorro de datos o conexión lenta, se muestra solo la foto."]})]})]})]})]}),e.jsxs(ht,{title:"Contenido de la página (fotos, videos, gifs, textos)",right:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",justifyContent:"flex-end"},children:[(p.page_type||"product")==="product"&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:p.content_text_align==="center",onChange:r=>x(l=>({...l,content_text_align:r.target.checked?"center":void 0}))})," Centrar tÃtulos y párrafos"]}),!!(p.content_blocks&&p.content_blocks.length)&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Espacio entre bloques:"}),e.jsxs("select",{style:{...E,width:"auto",padding:"4px 8px",fontSize:12},value:(()=>{const l=(p.content_blocks||[]).map(y=>typeof y.mt=="number"?y.mt:null);return!l.length||l.some(y=>y===null)||new Set(l).size>1?"mixto":l[0]===0?"pegado":l[0]===Op?"normal":l[0]===qy?"amplio":"mixto"})(),onChange:r=>{const l=r.target.value;if(l==="mixto")return;const y=l==="pegado"?0:l==="amplio"?qy:Op;x(R=>Pn(R,(R.content_blocks||[]).map(P=>({...P,mt:y,mb:y}))))},children:[e.jsx("option",{value:"pegado",children:"Pegado (sin espacio)"}),e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"amplio",children:"Amplio"}),e.jsx("option",{value:"mixto",disabled:!0,children:"Mezclado"})]})]}),!!(p.content_blocks&&p.content_blocks.length)&&e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12,color:"var(--danger)"},onClick:()=>{confirm("¿Borrar todos los bloques de contenido?")&&x(r=>Pn(r,[]))},children:"Borrar todo"})]}),children:[!1,e.jsxs(mt,{children:["La unidad recomendada es una ",e.jsx("b",{children:"escena"}),": un tÃtulo y un párrafo de máximo dos frases. Puedes sumar medios y elegir dónde va cada bloque sin cambiar el orden de las landings existentes."]}
1105),(p.content_blocks||[]).map((r,l)=>{var Es;const y=p.content_blocks||[],R=Xe=>x($t=>{const Fa=$t.content_blocks||[],nn=r._k,Ja=nn?Fa.findIndex(Ua=>Ua&&Ua._k===nn):-1;if(nn&&Ja<0)return $t;const on=Ja>=0?Ja:l;return on<0||on>=Fa.length?$t:Pn($t,Fa.map((Ua,En)=>En===on?{...Ua,...Xe}:Ua))}),P=Xe=>{const $t=l+Xe;$t<0||$t>=y.length||x(Fa=>{const nn=[...Fa.content_blocks||[]],Ja=En=>["inicio","price","offers","cta","form","faq"].includes(En==null?void 0:En.pos)?En.pos:"end",on=nn[l],Ua=nn[$t];return nn[l]=Ua,nn[$t]=Ja(Ua)!==Ja(on)?{...on,pos:Ja(Ua)==="end"?void 0:Ja(Ua)}:on,Pn(Fa,nn)})},re=Xe=>x($t=>{const Fa=$t.content_blocks||[],nn=r._k,Ja=nn?Fa.findIndex(yn=>yn&&yn._k===nn):-1;if(nn&&Ja<0)return $t;const on=Ja>=0?Ja:l;if(on<0||on>=Fa.length||!Xe.length)return $t;const Ua=Fa[on],En=!Ua.url,Ii=yn=>({type:"image",url:yn,_k:Yi(),...Ua.pos?{pos:Ua.pos}:{},...Ua.mask?{mask:Ua.mask}:{},...typeof Ua.mt=="number"?{mt:Ua.mt}:{},...typeof Ua.mb=="number"?{mb:Ua.mb}:{}}),Sa=En?{...Ua,url:Xe[0]}:Ua,Za=(En?Xe.slice(1):Xe).map(Ii);return Pn($t,[...Fa.slice(0,on),Sa,...Za,...Fa.slice(on+1)])}),xe=r.align||(p.content_text_align==="center"&&(p.page_type||"product")==="product"?"center":""),Le=()=>x(Xe=>Pn(Xe,(Xe.content_blocks||[]).filter(($t,Fa)=>Fa!==l))),Ee=r.type==="image"?"Imagen":r.type==="carousel"?"Carrusel":r.type==="video"?"Video":r.type==="cta"?"Botón":r.type==="h"?"TÃtulo":r.type==="space"?"Espacio":r.type==="codigo"?"Código":r.type==="entrega"?"Entrega":"Texto",Oe=["inicio","price","offers","cta","form","faq","end"],St=Xe=>Oe.includes(Xe==null?void 0:Xe.pos)?Xe.pos:"end",rt={inicio:"Arriba, tras la portada",price:"Contenido principal (debajo del precio)",offers:"Después de las ofertas",cta:"Después del botón de compra",form:"Antes del formulario",faq:"Al final, antes del cierre",end:"Contenido de la página (abajo)"}
1105,Ft=St(r),Tt=l===0||St(y[l-1])!==Ft,fa=String(r._k||`ix_${l}`),Ha=ci===fa,Fn=()=>{if(Ha){qr(null);return}let Xe=r._k;Xe||(Xe=Yi(),R({_k:Xe})),qr(String(Xe))},Ya=r.type==="image"?r.url:r.type==="carousel"?(r.images||[])[0]:"",Xn=r.type==="h"||r.type==="p"||r.type==="cta"?String(r.text||"").replace(/\*\*|__|\[color=#[0-9a-fA-F]{6}\]|\[\/color\]/g,"").trim().slice(0,54)||"(vacÃo)":r.type==="image"?r.url?"":"(sin imagen)":r.type==="carousel"?`${(r.images||[]).filter(Boolean).length} fotos/videos`:r.type==="video"?r.url?"Video listo":"(sin video)":r.type==="space"?{sm:"Pequeño",md:"Mediano",lg:"Grande"}[r.size||"md"]:r.type==="codigo"?(r.html||"").trim()?"Diseño propio (HTML)":"(sin código)":r.type==="entrega"?`Fecha estimada · ${r.dias_rapido||2}-${r.dias_resto||7} dÃas hábiles`:"";return e.jsxs(h.Fragment,{children:[Tt&&e.jsxs("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.5,margin:(l===0?2:14)+"px 2px 6px",display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:me,flex:"none"}}),rt[Ft]]}),e.jsxs("div",{"data-dragidx":l,className:ir.dragIdx===l?"lk-dragging":"",style:{border:`1px solid ${Ha?me+"66":"var(--border, #e5e7eb)"}`,borderRadius:10,marginBottom:6,background:"var(--card-bg, #fff)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,padding:"6px 8px",cursor:"pointer"},onClick:Fn,children:[e.jsxs("span",{onClick:Xe=>Xe.stopPropagation(),style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(hm,{onStart:Xe=>ir.start(l,Xe),onOver:ir.over,onEnd:ir.end}),e.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("button",{type:"button",onClick:()=>P(-1),disabled:l===0,title:"Subir",style:{width:22,height:17,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border, #e5e7eb)",borderRadius:6,background:"var(--card-bg, #fff)",color:l===0?"var(--text-muted, #cbd2dd)":"var(--text-secondary, #64748b)",cursor:l===0?"default":"pointer",padding:0},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 15l-6-6-6 6"})})}),e.jsx("button",{type:"button",onClick:()=>P(1),disabled:l===y.length-1,title:"Bajar",style:{width:22,height:17,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border, #e5e7eb)",borderRadius:6,background:"var(--card-bg, #fff)",color:l===y.length-1?"var(--text-muted, #cbd2dd)":"var(--text-secondary, #64748b)",cursor:l===y.length-1?"default":"pointer",padding:0},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]})]}),e.jsx("span",{style:{flex:"none",fontSize:10,fontWeight:800,color:me,textTransform:"uppercase",letterSpacing:.4,background:me+"14",borderRadius:6,padding:"3px 7px"},children:Ee}),Ya?e.jsx("img",{src:Ya,alt:"",style:{width:30,height:30,borderRadius:6,objectFit:"cover",flex:"none",background:"#f1f2f5"}}):null,e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,color:/^\(/.test(Xn)?"var(--danger)":"var(--text-secondary, #556)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:r.type==="h"?700:400},children:Xn}),e.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",style:{flex:"none",transform:Ha?"rotate(180deg)":"none",transition:"transform .15s",color:"var(--text-muted)"},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})}),e.jsx("button",{onClick:Xe=>{Xe.stopPropagation(),Le()},style:{...ee,flex:"none",padding:"2px 7px",fontSize:12,color:"var(--danger)"},children:"â"})]}),Ha&&e.jsxs("div",{style:{padding:"2px 10px 10px"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:(r.type==="h"||r.type==="p")&&e.jsx(So,{field:r.type==="h"?"TÃtulo de sección":"Párrafo de descripción",instruction:r.type==="h"?"TÃtulo de sección corto y atractivo, máximo 50 caracteres":"Párrafo persuasivo de máximo 2 frases con beneficios concretos, sin escasez ni presión inventada",current:r.text||"",productName:q.name||"",context:q.description||"",images:q.images,onPick:Xe=>R({text:Xe})})}),r.type==="image"?e.jsx("div",{style:{marginTop:4},children:e.jsx(Rn,{label:"Imagen o GIF",value:r.url,onChange:Xe=>R({url:Xe||""}),onAddMany:re,uploadsEnabled:Ia,compact:!0,usedUrls:Su(p)})}):r.type==="carousel"?e.jsxs("div",{style:{marginTop:4},children:[e.jsx(Ru,{values:r.images||[],onChange:Xe=>R({images:Xe}),uploadsEnabled:Ia,usedUrls:Su(p)}),e.jsxs("div",{style:{marginTop:6},children:[e.jsx(Nu,{value:"",onChange:Xe=>{Xe&&R({images:[...r.images||[],Xe]})},onAddMany:Xe=>R({images:[...r.images||[],...Xe.map($t=>$t.url)]}),etiqueta:"Subir videos (mp4)",uploadsEnabled:Ia,soloArchivo:!0}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Los videos entran como una lámina más: se reproducen solos (sin sonido) cuando les toca el turno."})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Formato:"}),e.jsxs("select",{style:{...E,marginTop:0,width:"auto",padding:"5px 8px",fontSize:12},value:r.formato==="reels"?"reels":"normal",onChange:Xe=>R({formato:Xe.target.value==="reels"?"reels":void 0}),children:[e.jsx("option",{value:"normal",children:"Ancho completo"}),e.jsx("option",{value:"reels",children:"Vertical tipo Reels (vecinas asomadas)"})]})]}),e.jsxs("div",{style:{display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",marginTop:8},children:[e.jsxs("label",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:6},children:["Cambia cada",e.jsx("input",{type:"number",min:1,max:15,step:.5,value:typeof r.interval=="number"?+(r.interval/1e3).toFixed(1):3,onChange:Xe=>R({interval:Math.round(Math.max(1,Math.min(15,Number(Xe.target.value)||3))*1e3)}),style:{...E,width:62,padding:"4px 6px",fontSize:12,marginTop:0}}),"seg"]}),e.jsxs("label",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:r.autoplay!==!1,onChange:Xe=>R({autoplay:Xe.target.checked})}),"Cambiar solas"]}),e.jsxs("label",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5,cursor:"pointer"},title:"Muestra una manito animada de 'desliza' sobre el carrusel (desaparece al deslizar).",children:[e.jsx("input",{type:"checkbox",checked:r.hint!==!1,onChange:Xe=>R({hint:Xe.target.checked})}),"Seña de deslizar"]})]})]}):r.type==="video"?e.jsxs("div",{style:{marginTop:4},children:[e.jsx(Nu,{value:r.url,onChange:(Xe,$t)=>R({url:Xe||"",poster:($t==null?void 0:$t.poster)||void 0,vw:$t==null?void 0:$t.vw,vh:$t==null?void 0:$t.vh}),uploadsEnabled:Ia}),e.jsxs("div",{style:{display:"flex",gap:14,flexWrap:"wrap",alignItems:"center",marginTop:8},children:[e.jsxs("label",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:r.autoplay!==!1,onChange:Xe=>R({autoplay:Xe.target.checked})}),"Reproducir solo (silenciado)"]}),e.jsxs("label",{style:{fontSize:11.5,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:r.loop!==!1,onChange:Xe=>R({loop:Xe.target.checked})}),"En bucle"]})]})]}):r.type==="cta"?e.jsx("input",{style:{...E,marginTop:4},value:r.text||"",onChange:Xe=>R({text:Xe.target.value}
1105),placeholder:"Texto del botón. Ej: Pedir ahora",maxLength:40}):r.type==="space"?e.jsxs("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Tamaño:"}),e.jsxs("select",{style:{...E,padding:"6px 8px",fontSize:12.5,marginTop:0,width:"auto"},value:r.size||"md",onChange:Xe=>R({size:Xe.target.value}),children:[e.jsx("option",{value:"sm",children:"Pequeño"}),e.jsx("option",{value:"md",children:"Mediano"}),e.jsx("option",{value:"lg",children:"Grande"})]})]}):r.type==="codigo"?e.jsxs("div",{style:{marginTop:4},children:[e.jsx("textarea",{style:{...E,minHeight:180,fontFamily:"ui-monospace, Menlo, monospace",fontSize:12,resize:"vertical"},value:r.html||"",onChange:Xe=>R({html:Xe.target.value}),placeholder:"Pega aquà tu HTML, CSS y JavaScript (puedes pedÃrselo a una IA)."}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Alto del recuadro (px):"}),e.jsx("input",{type:"number",min:240,max:1600,style:{...E,marginTop:0,width:90,padding:"6px 8px",fontSize:12.5},value:r.alto||720,onChange:Xe=>R({alto:Math.max(240,Math.min(1600,Number(Xe.target.value)||720))})}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"El alto se ajusta solo a tu contenido."})]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:6,lineHeight:1.5},children:["Tu diseño, en un recuadro que pones donde quieras. ¿Prefieres diseñar la página completa? Crea una ",e.jsx("b",{children:"Página en código"})," (Nueva landing â Página en código)."]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:["¿Un botón de WhatsApp? Ponle ",e.jsx("code",{children:"data-lumy-whatsapp"})," (y si quieres ",e.jsx("code",{children:'data-texto="Quiero la talla M"'}),"), o en tu JavaScript usa ",e.jsx("code",{children:"lumyWhatsApp('tu mensaje')"}),". Se abre con el número de esta página y, si ese número está conectado a Lumy, llega al agente sabiendo de qué página viene."]}),e.jsx(M1,{html:r.html||"",tipo:"bloque",numeroDelBoton:String(((Es=p.whatsapp)==null?void 0:Es.number)||"")}),e.jsx(ng,{pruebas:Dr.pruebas,tipo:"bloque",html:r.html||"",agenteEncendido:Ba?Ba.agente:void 0}),e.jsx(og,{landingId:Number(g==null?void 0:g.id)||0,parte:`bloque:${l}`,html:r.html||"",capturas:Dr.capturas})]}):r.type==="entrega"?e.jsxs("div",{style:{marginTop:4,display:"grid",gap:6},children:[e.jsx("input",{style:{...E,marginTop:0},value:r.titulo||"",onChange:Xe=>R({titulo:Xe.target.value}),placeholder:"TÃtulo. Ej: ¿Cuándo llega a tu casa?",maxLength:100}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Ciudades principales:"}),e.jsx("input",{type:"number",min:1,max:30,style:{...E,marginTop:0,width:70,padding:"6px 8px",fontSize:12.5},value:r.dias_rapido||2,onChange:Xe=>R({dias_rapido:Math.max(1,Math.min(30,Number(Xe.target.value)||2))})}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"dÃas · Resto del paÃs:"}),e.jsx("input",{type:"number",min:1,max:45,style:{...E,marginTop:0,width:70,padding:"6px 8px",fontSize:12.5},value:r.dias_resto||7,onChange:Xe=>R({dias_resto:Math.max(1,Math.min(45,Number(Xe.target.value)||7))})}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"dÃas hábiles"})]}),e.jsx("textarea",{style:{...E,marginTop:0,minHeight:54,fontSize:12.5,resize:"vertical"},value:(r.ciudades_rapidas||[]).join(` 1106`),onChange:Xe=>R({ciudades_rapidas:Xe.target.value.split(` 1107`).map($t=>$t.trim()).filter(Boolean).slice(0,60)}),placeholder:"Ciudades con entrega rápida, una por lÃnea. VacÃo = Bogotá, MedellÃn, Cali, Barranquilla, Cartagena y Bucaramanga."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"La fecha se calcula con:"}),e.jsxs("select",{style:{...E,marginTop:0,width:"auto",padding:"6px 8px",fontSize:12.5},value:r.modo||"formulario",onChange:Xe=>R({modo:Xe.target.value}),children:[e.jsx("option",{value:"formulario",children:"La ciudad que escriba el comprador (recomendado)"}),e.jsx("option",{value:"ambos",children:"Estimado por ubicación + se corrige con el formulario"}),e.jsx("option",{value:"ip",children:"Solo ubicación estimada"})]})]}),e.jsx("input",{style:{...E,marginTop:0,fontSize:12.5},value:r.fallback||"",onChange:Xe=>R({fallback:Xe.target.value}),placeholder:"Texto mientras no hay ciudad. Ej: Escribe tu ciudad en el formulario y te decimos la fecha exacta.",maxLength:200}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Ojo: los dÃas son una promesa. Ponlos según lo que tu logÃstica cumple de verdad; un dÃa de menos aquà son devoluciones allá."})]}):e.jsxs(e.Fragment,{children:[(()=>{const Xe="cbtx-"+fa,$t=()=>{const Sa=document.getElementById(Xe),Za=String(r.text||"");return{t:Za,s0:Sa?Sa.selectionStart:Za.length,s1:Sa?Sa.selectionEnd:Za.length}},Fa=(Sa,Za)=>requestAnimationFrame(()=>{const yn=document.getElementById(Xe);yn&&(yn.focus(),yn.setSelectionRange(Sa,Za))}),nn=(Sa,Za)=>{const{t:yn,s0:Lo,s1:Ir}=$t(),eo=yn.slice(Lo,Ir),Tr=yn.slice(0,Lo),zs=yn.slice(Ir),kl=(Qd,nj)=>nj!=="*"||!Qd.endsWith("**")||Qd.endsWith("***");if(eo&&Tr.endsWith(Sa)&&zs.startsWith(Za)&&kl(Tr,Sa)){R({text:Tr.slice(0,-Sa.length)+eo+zs.slice(Za.length),rich:!0}),Fa(Lo-Sa.length,Ir-Sa.length);return}if(eo.length>Sa.length+Za.length&&eo.startsWith(Sa)&&eo.endsWith(Za)){const Qd=eo.slice(Sa.length,eo.length-Za.length);R({text:Tr+Qd+zs,rich:!0}),Fa(Lo,Lo+Qd.length);return}const Er=eo||"texto";R({text:Tr+Sa+Er+Za+zs,rich:!0}),Fa(Lo+Sa.length,Lo+Sa.length+Er.length)},Ja=Sa=>{const{t:Za,s0:yn,s1:Lo}=$t(),Ir=Za.slice(0,yn),eo=Za.slice(Lo),Tr=Ir.match(/\[color=#[0-9a-fA-F]{6}\]$/);if(Tr&&eo.startsWith("[/color]")){const Er=Ir.slice(0,-Tr[0].length)+`[color=${Sa}]`;R({text:Er+Za.slice(yn,Lo)+eo,rich:!0}),Fa(Er.length,Er.length+(Lo-yn));return}const kl=Za.slice(yn,Lo).replace(/^\[color=#[0-9a-fA-F]{6}\]([\s\S]*)\[\/color\]$/,"$1")||"texto";R({text:Ir+`[color=${Sa}]`+kl+"[/color]"+eo,rich:!0}),Fa(yn+15,yn+15+kl.length)},on=Sa=>{const{t:Za,s0:yn,s1:Lo}=$t(),Ir=yn>0?Za.lastIndexOf(` 1108`,yn-1)+1:0;let eo=Za.indexOf(` 1109`,Math.max(Lo,Ir));eo<0&&(eo=Za.length);let Tr=0;const zs=(Za.slice(Ir,eo)||"texto").split(` 1110`).map(kl=>{const Er=kl.replace(/^[ \t]*(?:[-â¢]|\d{1,3}[.)])[ \t]+/,"");return Er.trim()?(Tr++,Sa==="ul"?"- "+Er:Tr+". "+Er):Er}).join(` 1111`);R({text:Za.slice(0,Ir)+zs+Za.slice(eo),rich:!0})},Ua=()=>R({text:String(r.text||"").replace(/\*\*\*|\*\*|__|\[color=#[0-9a-fA-F]{6}\]|\[\/color\]/g,"").replace(/(^|[^*\w])\*([^*\n]+)\*(?![*\w])/g,"$1$2").replace(/^[ \t]*(?:[-â¢]|\d{1,3}[.)])[ \t]+/gm,"")}),En={minWidth:30,height:28,padding:"0 7px",border:"1px solid var(--border, #e5e7eb)",borderRadius:7,background:"var(--card-bg, #fff)",color:"var(--text-secondary, #475569)",cursor:"pointer",fontSize:13,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4},Ii=Sa=>Sa.preventDefault();return e.jsxs("div",{role:"toolbar","aria-label":"Formato del texto",style:{display:"flex",alignItems:"center",gap:4,flexWrap:"wrap",marginTop:4},children:[e.jsxs("select",{"aria-label":"Formato",value:r.type,onCh
1111ange:Sa=>R({type:Sa.target.value}),style:{...E,marginTop:0,width:"auto",padding:"4px 8px",fontSize:12.5,height:28},children:[e.jsx("option",{value:"p",children:"Párrafo"}),e.jsx("option",{value:"h",children:"TÃtulo"})]}),e.jsx("button",{type:"button",title:"Negrita","aria-label":"Negrita",onMouseDown:Ii,onClick:()=>nn("**","**"),style:En,children:e.jsx("b",{children:"B"})}),e.jsx("button",{type:"button",title:"Cursiva","aria-label":"Cursiva",onMouseDown:Ii,onClick:()=>nn("*","*"),style:En,children:e.jsx("i",{children:"I"})}),e.jsx("button",{type:"button",title:"Subrayado","aria-label":"Subrayado",onMouseDown:Ii,onClick:()=>nn("__","__"),style:En,children:e.jsx("u",{children:"U"})}),["#dc2626","#ea580c","#16a34a","#2563eb","#7c3aed","#111827"].map(Sa=>e.jsx("button",{type:"button",title:"Color "+Sa,"aria-label":"Color "+Sa,onMouseDown:Ii,onClick:()=>Ja(Sa),style:{...En,minWidth:22,width:22,padding:0},children:e.jsx("span",{style:{width:12,height:12,borderRadius:999,background:Sa}})},Sa)),r.type==="p"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",title:"Lista con viñetas","aria-label":"Lista con viñetas",onMouseDown:Ii,onClick:()=>on("ul"),style:En,children:"⢠Lista"}),e.jsx("button",{type:"button",title:"Lista numerada","aria-label":"Lista numerada",onMouseDown:Ii,onClick:()=>on("ol"),style:En,children:"1. Lista"})]}),e.jsx("button",{type:"button",title:"Quitar el formato","aria-label":"Quitar el formato",onMouseDown:Ii,onClick:Ua,style:{...En,color:"var(--text-muted)"},children:"Quitar formato"})]})})(),e.jsx("textarea",{id:"cbtx-"+fa,style:{...E,marginTop:4,minHeight:r.type==="h"?38:60,fontWeight:r.type==="h"?700:400,resize:"vertical",fontFamily:"inherit",textAlign:xe||void 0},value:r.text||"",onChange:Xe=>R({text:Xe.target.value}),placeholder:r.type==="h"?"TÃtulo de la sección":"Texto del párrafo"}),e.jsxs("div",{role:"group","aria-label":"Alineado",style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",whiteSpace:"nowrap"},children:"Alineado:"}),e.jsx("span",{style:{display:"inline-flex",border:"1px solid var(--border, #e5e7eb)",borderRadius:8,overflow:"hidden"},children:[["left","Izquierda","M4 6h16M4 10h10M4 14h16M4 18h10"],["center","Centro","M4 6h16M7 10h10M4 14h16M7 18h10"],["right","Derecha","M4 6h16M10 10h10M4 14h16M10 18h10"],["justify","Justificado","M4 6h16M4 10h16M4 14h16M4 18h16"]].map(([Xe,$t,Fa],nn)=>{const Ja=xe===Xe;return e.jsx("button",{type:"button",title:Ja&&r.align?$t+" (tócalo otra vez para volver a automático)":$t,"aria-label":$t,"aria-pressed":Ja,onClick:()=>R({align:Ja&&r.align?void 0:Xe}),style:{width:34,height:30,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:0,borderLeft:nn?"1px solid var(--border, #e5e7eb)":0,background:Ja?me+"1a":"var(--card-bg, #fff)",color:Ja?me:"var(--text-secondary, #64748b)",cursor:"pointer"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:Fa})})},Xe)})})]})]}),(r.type==="image"||r.type==="carousel"||r.type==="video")&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",whiteSpace:"nowrap"},children:"Forma:"}),e.jsxs("select",{style:{...E,padding:"6px 8px",fontSize:12.5,marginTop:0,width:"auto"},value:r.mask||"",onChange:Xe=>R({mask:Xe.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Como el diseño"}),e.jsx("option",{value:"ninguno",children:"Normal (rectangular)"}),e.jsx("option",{value:"circulo",children:"CÃrculo"}),e.jsx("option",{value:"capsule",children:"Cápsula"}),e.jsx("option",{value:"arch",children:"Arco"}),e.jsx("option",{value:"blob",children:"Orgánico"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)",whiteSpace:"nowrap"},children:"Dónde va:"}),e.jsxs("select",{style:{...E,padding:"6px 8px",fontSize:12.5,marginTop:0,flex:1,minWidth:150},value:r.pos||"end",onChange:Xe=>R({pos:Xe.target.value}),children:[e.jsx("option",{value:"inicio",children:"Arriba, tras la portada"}),e.jsx("option",{value:"price",children:"Debajo del precio"}),e.jsx("option",{value:"offers",children:"Después de las ofertas"}),e.jsx("option",{value:"cta",children:"Después del botón de compra"}),e.jsx("option",{value:"form",children:"Antes del formulario"}),e.jsx("option",{value:"faq",children:"Al final, antes del cierre"}),e.jsx("option",{value:"end",children:"Al final de la página"})]})]}),r.type!=="space"&&e.jsxs("details",{style:{marginTop:8},children:[e.jsx("summary",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted)",cursor:"pointer",userSelect:"none"},children:"Espaciado (avanzado)"}),e.jsx("div",{style:{display:"flex",gap:14,flexWrap:"wrap",marginTop:6},children:[["mt","Arriba"],["mb","Abajo"]].map(([Xe,$t])=>{const Fa=r.type==="image"||r.type==="carousel"||r.type==="video"?Op:0,nn=typeof r[Xe]=="number"?r[Xe]:Fa,Ja=on=>R({[Xe]:Math.max(0,Math.min(160,Math.round(on||0)))});return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-muted)"},children:[e.jsx("span",{style:{minWidth:38},children:$t}),e.jsx("input",{type:"range",min:0,max:80,step:2,value:nn,onChange:on=>Ja(Number(on.target.value)),style:{width:96}}),e.jsx("input",{type:"number",min:0,max:160,value:nn,onChange:on=>Ja(Number(on.target.value)),style:{...E,width:58,padding:"4px 6px",fontSize:12,marginTop:0}}),e.jsx("span",{children:"px"})]},Xe)})})]})]})]})]},fa)}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginTop:8},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-muted)",alignSelf:"center"},children:"Agregar:"}),e.jsx("button",{style:{...xa,padding:"6px 11px",fontSize:12.5},title:"TÃtulo + texto juntos, como un capÃtulo de tu página.",onClick:us,children:"+ Escena"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},title:"Una o varias fotos: si eliges varias, cada una queda en su propio bloque, en el orden en que las elegiste.",onClick:()=>Dn({type:"image",url:""}),children:"+ Imagen"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},onClick:()=>Dn({type:"carousel",images:[],interval:3e3,autoplay:!0}),title:"Imágenes y videos cortos que rotan solos (slider) con tiempo configurable.",children:"+ Carrusel"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},onClick:()=>Dn({type:"video",url:"",autoplay:!0,loop:!0}),title:"Sube un video corto (mp4) o pega un enlace de YouTube/TikTok/Vimeo.",children:"+ Video"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5}
1111,title:"Solo el renglón grande, suelto, sin texto debajo.",onClick:()=>Dn({type:"h",text:""}),children:"+ TÃtulo"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},title:"Un párrafo suelto, sin tÃtulo.",onClick:()=>Dn({type:"p",text:""}),children:"+ Texto"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},title:"Lleva al formulario o al WhatsApp.",onClick:()=>Dn({type:"cta",text:""}),children:"+ Botón"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},onClick:()=>Dn({type:"space",size:"md"}),children:"+ Espacio"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},title:"Fecha estimada que se ajusta con la ciudad del comprador.",onClick:()=>Dn({type:"entrega",modo:"formulario",dias_rapido:2,dias_resto:7}),children:"+ Entrega"}),e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5},title:"HTML, CSS y JavaScript a tu gusto.",onClick:()=>Dn({type:"codigo",html:"",alto:720}),children:"+ Código HTML"})]}),!!(p.lienzo_html||"").trim()&&(()=>{const r=mn??!!(p.lienzo_html||"").trim();return e.jsxs("div",{style:{marginTop:10,borderRadius:13,overflow:"hidden",border:"1.5px solid rgba(8,102,255,.25)",background:"var(--card-bg, #fff)",boxShadow:"0 4px 16px -10px rgba(8,102,255,.25)"},children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>po(!r),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),po(!r))},style:{display:"flex",alignItems:"center",gap:10,background:"linear-gradient(120deg, rgba(8,102,255,.07), rgba(139,92,246,.07))",padding:"12px 14px",cursor:"pointer",userSelect:"none"},children:[e.jsx("span",{style:{fontFamily:"ui-monospace, Menlo, monospace",fontWeight:800,fontSize:13,color:"#0866ff",background:"rgba(8,102,255,.1)",border:"1px solid rgba(8,102,255,.28)",borderRadius:8,padding:"4px 8px"},children:"</>"}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",fontSize:13.5,fontWeight:800,color:"var(--text, #1a2233)"},children:"Página en código â modo lienzo"}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:"Tu HTML+CSS es la página entera. Puedes pedÃrselo a Claude o a ChatGPT."})]}),e.jsx("span",{style:{fontSize:10,fontWeight:900,letterSpacing:".07em",color:"#fff",background:"linear-gradient(100deg, #0866ff, #8b5cf6)",borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},children:"100% LIBRE"}),e.jsx("span",{style:{color:"var(--text-muted)",fontSize:12,transform:r?"rotate(180deg)":"none",transition:"transform .18s ease"},children:"â¼"})]}),r&&e.jsxs("div",{style:{padding:"12px 14px 12px"},children:[e.jsx("div",{style:{fontSize:12,lineHeight:1.5,marginBottom:8,fontWeight:600,color:Je?"var(--success)":"var(--warning)"},children:Je?e.jsx(e.Fragment,{children:"â¡ Tu propio JavaScript también corre aquà (GSAP, jQueryâ¦): pega tu HTML y enciende el interruptor de abajo."}):e.jsxs(e.Fragment,{children:["⡠¿Quieres tu propio JavaScript (GSAP, jQueryâ¦)? Conecta ",e.jsx("b",{children:"tu dominio"})," a esta landing (pestaña Dominio) y aquà aparece el interruptor."]})}),e.jsx("textarea",{style:{...E,minHeight:200,fontFamily:"ui-monospace, Menlo, monospace",fontSize:12,resize:"vertical"},value:p.lienzo_html||"",onChange:l=>x(y=>({...y,lienzo_html:l.target.value})),placeholder:"<!-- Pega aquà el HTML completo de tu página -->",spellCheck:!1}),e.jsxs("details",{style:{marginTop:8},children:[e.jsx("summary",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted)",cursor:"pointer",userSelect:"none"},children:"GuÃa rápida: el formulario, las fuentes y las 31 recetas de movimiento"}),e.jsxs("ul",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.6,margin:"8px 0 0",paddingLeft:18},children:[e.jsxs("li",{children:[e.jsx("b",{children:"El formulario de pedido"})," aparece donde dejes ",e.jsx("code",{style:{background:"var(--bg-hover, #f1f5f9)",padding:"1px 5px",borderRadius:5},children:"<div data-lumy-form></div>"}),"; sin la marca, va al final."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Fuentes de Google"})," permitidas con ",e.jsx("code",{children:"@import"}),". Con el lienzo lleno, los bloques de arriba no se muestran."]}),e.jsxs("li",{children:[e.jsx("b",{children:"31 recetas de movimiento"})," sin escribir código: marca cualquier elemento con ",e.jsx("code",{children:'data-lumy="aparecer"'}),", ",e.jsx("code",{children:'data-lumy="contador" data-hasta="12500"'}),", ",e.jsx("code",{children:'data-lumy="particulas"'}
1111),"⦠(contadores, parallax, pestañas, carrusel, antes/después, confeti y más)."]}),e.jsxs("li",{children:[e.jsx("b",{children:"¿Tu propio JavaScript?"})," (librerÃas tipo GSAP): pega tu HTML y abajo aparece el interruptor para permitirlo."]})]})]}),!!(p.lienzo_html||"").trim()&&!/data-lumy-form/i.test(p.lienzo_html||"")&&e.jsxs("div",{role:"status",style:{fontSize:11.5,color:"var(--warning)",marginTop:6},children:["Sin la marca ","<div data-lumy-form></div>",", el formulario de pedido se agrega al final de tu página."]}),/<script/i.test(p.lienzo_html||"")&&!Je&&e.jsxs("div",{role:"alert",style:{fontSize:12.5,fontWeight:600,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1.5px solid var(--notice-warning-border)",borderRadius:10,padding:"10px 12px",marginTop:8,lineHeight:1.55},children:["â Tu código trae JavaScript. Para usarlo es necesario que ",e.jsx("b",{children:"conectes tu dominio a Lumy"}),". Cuando lo hagas, todo funcionará como quieres.",e.jsx(_n,{})]}),/<script/i.test(p.lienzo_html||"")&&Je&&!p.js_libre&&e.jsx("div",{role:"status",style:{fontSize:12.5,fontWeight:600,color:"var(--notice-info-text)",background:"var(--notice-info-bg)",border:"1.5px solid var(--notice-info-border)",borderRadius:10,padding:"10px 12px",marginTop:8,lineHeight:1.55},children:"ð¡ Tu código trae JavaScript. Enciende el interruptor de abajo para que funcione."}),!!(p.lienzo_html||"").trim()&&e.jsxs("div",{style:{background:Je?"rgba(8,102,255,.06)":"var(--input-bg, #f4f6fa)",border:"1px solid "+(Je?"rgba(8,102,255,.22)":"var(--border, #e8eaf0)"),borderRadius:10,padding:"11px 12px",marginTop:8},children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,fontSize:12.5,lineHeight:1.5,cursor:Je?"pointer":"not-allowed",opacity:Je?1:.65},children:[e.jsx("input",{type:"checkbox",disabled:!Je,checked:!!p.js_libre&&Je,onChange:l=>x(y=>({...y,js_libre:l.target.checked})),style:{marginTop:3}}),e.jsxs("span",{children:[e.jsx("b",{children:"Permitir mi propio JavaScript en toda la página."}),e.jsx("br",{}),Je?e.jsxs(e.Fragment,{children:["Tu página queda tan libre como un tema de Shopify: tus ",e.jsx("code",{children:"<script>"})," corren y puedes cargar librerÃas (GSAP, jQuery, lo que uses). Aplica cuando la abren por ",e.jsx("b",{children:"tu dominio"}),"."]}):e.jsxs(e.Fragment,{children:["Para activarlo, ",e.jsx("b",{children:"conecta tu propio dominio"})," a esta landing."]})]})]}),!!p.js_libre&&Je&&e.jsx("div",{role:"status",style:{fontSize:11.5,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:8,padding:"8px 10px",marginTop:9,lineHeight:1.5},children:"Con esto encendido, el código que pegues manda en tu página â incluido el formulario del pedido. Pega solo código que entiendas o que venga de una fuente en la que confÃes."})]}),!!(p.lienzo_html||"").trim()&&e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12,color:"var(--danger)",marginTop:8},onClick:()=>x(l=>({...l,lienzo_html:""})),children:"Apagar modo lienzo (volver a los bloques)"})]})]})})()]}),!ke&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Botón entre imágenes",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!p.inter_cta_tight,onChange:r=>x(l=>({...l,inter_cta_tight:r.target.checked}))})," Pegado a las imágenes"]})}),children:[e.jsx(mt,{children:"Deja el botón borde con borde con las imágenes (sin banda de espacio) y a todo el ancho."}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:[e.jsx("b",{children:"Ajuste fino por botón"})," en pÃxeles. VacÃo = automático, ",e.jsx("b",{children:"0"})," = pegado a las imágenes."]}),[1,2,3,4].map(r=>{const l=(p.inter_cta_spaces||{})[String(r)]||{};return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:12.5,fontWeight:700,width:62,flex:"none"},children:["Botón ",r]}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Arriba"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:l.mt??"",onChange:lr(String(r),"mt"),placeholder:"auto"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Abajo"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:l.mb??"",onChange:lr(String(r),"mb"),placeholder:"auto"}),(l.mt!==void 0||l.mb!==void 0)&&e.jsx("button",{type:"button",style:{...ee,padding:"5px 9px",fontSize:11.5},onClick:()=>{yo(String(r),"mt",void 0),yo(String(r),"mb",void 0)},children:"Auto"})]},r)}),p.page_type==="simple"&&(()=>
1111{const r=(p.inter_cta_spaces||{}).p||{};return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:2,paddingTop:8,borderTop:"1px dashed var(--border)",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,flex:"none"},children:"Botón principal"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Arriba"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:r.mt??"",onChange:lr("p","mt"),placeholder:"auto"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Abajo"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:r.mb??"",onChange:lr("p","mb"),placeholder:"auto"}),(r.mt!==void 0||r.mb!==void 0)&&e.jsx("button",{type:"button",style:{...ee,padding:"5px 9px",fontSize:11.5},onClick:()=>{yo("p","mt",void 0),yo("p","mb",void 0)},children:"Auto"})]})})(),p.page_type==="simple"&&(()=>{const r=(p.inter_cta_spaces||{}).g||{};return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:2,paddingTop:8,borderTop:"1px dashed var(--border)",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12.5,fontWeight:700,flex:"none"},children:"Botón bajo la galerÃa"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Arriba"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:r.mt??"",onChange:lr("g","mt"),placeholder:"auto"}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Abajo"}),e.jsx("input",{style:{...E,marginBottom:0,width:74,textAlign:"center"},type:"number",min:0,max:120,value:r.mb??"",onChange:lr("g","mb"),placeholder:"auto"}),(r.mt!==void 0||r.mb!==void 0)&&e.jsx("button",{type:"button",style:{...ee,padding:"5px 9px",fontSize:11.5},onClick:()=>{yo("g","mt",void 0),yo("g","mb",void 0)},children:"Auto"})]})})()]})}),!ke&&e.jsxs(ht,{title:pt?"Página de confirmación":"Página de gracias",children:[e.jsx(Ea,{ai:{field:"TÃtulo de la página de gracias",instruction:"Titular de confirmación post-compra, emotivo y claro, máx 50 caracteres. Ej: ¡Pedido confirmado!",current:((vl=p.thankyou)==null?void 0:vl.headline)||"",productName:q.name||"",onPick:r=>x(l=>({...l,thankyou:{...l.thankyou,headline:r}}))},children:"TÃtulo"}),e.jsx("input",{style:E,value:((tu=p.thankyou)==null?void 0:tu.headline)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,headline:r.target.value}})),placeholder:"¡Pedido confirmado!"}),e.jsx(Ea,{ai:{field:"Mensaje de la página de gracias",instruction:"Máximo 2 frases: próximos pasos más la tranquilidad de que paga al recibir. Máx 150 caracteres.",current:((Ts=p.thankyou)==null?void 0:Ts.text)||"",productName:q.name||"",onPick:r=>x(l=>({...l,thankyou:{...l.thankyou,text:r}}))},children:"Mensaje"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:((jl=p.thankyou)==null?void 0:jl.text)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,text:r.target.value}})),placeholder:"Te contactaremos para coordinar la entrega. Pagas al recibir."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12,marginTop:2},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color de fondo"}),e.jsx("input",{type:"color",value:((Al=p.thankyou)==null?void 0:Al.bg)||"#ffffff",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,bg:r.target.value}})),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color de los textos"}
1111),e.jsx("input",{type:"color",value:((Td=p.thankyou)==null?void 0:Td.text_color)||"#1a1a2e",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,text_color:r.target.value}})),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto del botón final"}),e.jsx("input",{style:E,value:((dp=p.thankyou)==null?void 0:dp.cta_text)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,cta_text:r.target.value}})),placeholder:"Listo, entendido"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Costo de envÃo (en el recibo)"}),e.jsx("input",{style:E,value:((_i=p.thankyou)==null?void 0:_i.shipping_label)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,shipping_label:r.target.value}})),placeholder:"Gratis"})]})]}),e.jsx("label",{style:D,children:"Al tocar el botón, ir a (opcional)"}),e.jsx("input",{style:E,value:((Sl=p.thankyou)==null?void 0:Sl.redirect_url)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,redirect_url:r.target.value}})),placeholder:"https://www.tiktok.com/@tu_cuenta"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"5px 0 0"},children:"Si lo dejas vacÃo, el botón intenta cerrar la pestaña o volver atrás. Pega tu perfil de TikTok para devolver ahà al cliente."}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginTop:12},children:[e.jsx("input",{type:"checkbox",checked:((Ed=p.thankyou)==null?void 0:Ed.confetti)!==!1,onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,confetti:r.target.checked}}))})," Confeti al confirmar"]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"3px 0 0 26px"},children:"Una lluvia corta con los colores de tu landing cuando el pedido queda confirmado."}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Botón de WhatsApp"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:"Aparece si tienes tu número de WhatsApp en el pie de la landing. Déjalo vacÃo y usa el texto de siempre."}),e.jsx("input",{style:E,value:((zd=p.thankyou)==null?void 0:zd.wa_label)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,wa_label:r.target.value.slice(0,60)}})),placeholder:pt?"Agendar mi servicio por WhatsApp":"Confirmar mi pedido por WhatsApp",maxLength:60}),e.jsx("label",{style:D,children:"Mensaje que le queda escrito al cliente"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:((Rd=p.thankyou)==null?void 0:Rd.wa_msg)||"",onChange:r=>x(l=>({...l,thankyou:{...l.thankyou,wa_msg:r.target.value.slice(0,400)}})),placeholder:"Hola, soy {nombre}. Quiero confirmar mi pedido {pedido} de {producto}.",maxLength:400}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"3px 0 0"},children:["Puedes usar ",e.jsx("b",{children:"{nombre}"}),", ",e.jsx("b",{children:"{producto}"})," y ",e.jsx("b",{children:"{pedido}"}),": se reemplazan solos con los datos reales de ese cliente."]})]}),Jn("gracias")]}),pt&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{title:"Credenciales y confianza",children:[e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:"Deja vacÃo para no mostrarlas."}),xo.map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r,onChange:y=>{const R=[...xo];R[l]=y.target.value,Et({trust:R})},placeholder:"Ej: +2.000 muebles lavados"}),e.jsx("button",{onClick:()=>Et({trust:xo.filter((y,R)=>R!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]},l)),e.jsx("button",{style:ee,onClick:()=>Et({trust:[...xo,""]}),children:"+ Agregar credencial"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12,marginTop:10},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Respondemos en menos de (minutos)"}),e.jsx("input",{style:E,type:"number",min:0,max:720,value:At.response_min??"",onChange:r=>Et({response_min:r.target.value===""?void 0:Number(r.target.value)}),placeholder:"VacÃo = no mostrar"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Cupos de agenda (honesto)"}),e.jsx("input",{style:E,value:At.slots_note||"",onChange:r=>Et({slots_note:r.target.value||void 0}),placeholder:"Quedan 3 cupos esta semana",maxLength:70})]})]}),e.jsx("label",{style:D,children:'Teléfono para "Llámanos ahora" (opcional)'}),e.jsx("input",{style:E,value:At.call_phone||"",onChange:r=>Et({call_phone:r.target.value||void 0}),placeholder:"+573001234567 (vacÃo = sin botón de llamada)"})]}),e.jsxs(ht,{title:"Cómo trabajamos (pasos)",children:[e.jsx("label",{style:D,children:"TÃtulo de la sección"}),e.jsx("input",{style:E,value:At.steps_title??"Asà de fácil es",onChange:r=>Et({steps_title:r.target.value}),placeholder:"Asà de fácil es"}),Ma.map((r,l)=>e.jsxs("div",{style:{border:"1px solid var(--border, #e6e9f0)",borderRadius:10,padding:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:6},children:[e.jsxs("span",{style:{fontSize:12,fontWeight:800,color:"var(--text-muted)",flex:"none"},children:["Paso ",l+1]}),e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r.t||"",onChange:y=>Et({steps:Ma.map((R,P)=>P===l?{...R,t:y.target.value}:R)}),placeholder:"TÃtulo (Ej: EscrÃbenos por WhatsApp)"}),e.jsx("button",{onClick:()=>Et({steps:Ma.filter((y,R)=>R!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]}),e.jsx("textarea",{style:{...E,minHeight:46,resize:"vertical"},value:r.d||"",onChange:y=>Et({steps:Ma.map((R,P)=>P===l?{...R,d:y.target.value}:R)}),placeholder:"Detalle corto del paso"})]},l)),Ma.length<4&&e.jsx("button",{style:ee,onClick:()=>Et({steps:[...Ma,{t:"",d:""}]}),children:"+ Agregar paso"})]}),e.jsxs(ht,{title:"Servicios que ofreces",children:[e.jsx("label",{style:D,children:"TÃtulo de la sección"}),e.jsx("input",{style:E,value:At.services_title??"Servicios que ofrecemos",onChange:r=>Et({services_title:r.target.value}),placeholder:"Lo que hacemos"}),en.map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r.name||"",onChange:y=>Et({services:en.map((R,P)=>P===l?{...R,name:y.target.value}:R)}),placeholder:"Ej: Colchones"}),e.jsx("input",{style:{...E,width:120,flex:"none",marginBottom:0},value:r.from||"",onChange:y=>Et({services:en.map((R,P)=>P===l?{...R,from:y.target.value}:R)}),placeholder:"Desde $ (opcional)"}),e.jsx("button",{onClick:()=>Et({services:en.filter((y,R)=>R!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]},l)),en.length<12&&e.jsx("button",{style:ee,onClick:()=>Et({services:[...en,{name:""}]}),children:"+ Agregar servicio"})]}),e.jsxs(ht,{title:"Zonas de cobertura",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Genera confianza local. Deja el texto vacÃo para ocultar la sección."}),e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:At.zones_title??"Dónde te atendemos",onChange:r=>Et({zones_title:r.target.value}),placeholder:"Dónde te atendemos"}),e.jsx("label",{style:D,children:"Texto"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:At.zones_text??"Cubrimos toda la ciudad y municipios cercanos. ¿No sabes si llegamos a tu barrio? EscrÃbenos y te confirmamos al instante.",onChange:r=>Et({zones_text:r.target.value}),placeholder:"Zonas o barrios que cubres"})]}),e.jsxs(ht,{title:"Agenda de citas",right:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:((Nd=At.agenda)==null?void 0:Nd.on)===!0,onChange:r=>Et({agenda:{...At.agenda||{},on:r.target.checked}})})," Activar"]}),children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"El cliente elige dÃa y hora en el formulario. Un horario reservado ya no se le ofrece a na
1111die más."}),((Ld=At.agenda)==null?void 0:Ld.on)===!0&&(()=>{const r=At.agenda||{},l=xe=>Et({agenda:{...At.agenda||{},...xe}}),y=["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],R=Array.isArray(r.disponibilidad)&&r.disponibilidad.length?r.disponibilidad:[...[1,2,3,4,5].flatMap(xe=>[{dia:xe,inicio:"08:00",fin:"12:00"},{dia:xe,inicio:"14:00",fin:"18:00"}]),{dia:6,inicio:"08:00",fin:"12:00"}],P=xe=>l({disponibilidad:xe}),re=xe=>xe===0?"Sin descanso":xe<60?xe+" minutos":xe===60?"1 hora":xe%60===0?xe/60+" horas":xe+" minutos";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Duración de cada cita"}),e.jsx("select",{style:E,value:r.duracion_min??30,onChange:xe=>l({duracion_min:Number(xe.target.value)}),children:[15,20,30,45,60,90,120].map(xe=>e.jsx("option",{value:xe,children:re(xe)},xe))})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Descanso entre citas"}),e.jsx("select",{style:E,value:r.buffer_min??0,onChange:xe=>l({buffer_min:Number(xe.target.value)}),children:[0,5,10,15,30].map(xe=>e.jsx("option",{value:xe,children:re(xe)},xe))})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Aviso mÃnimo para reservar"}),e.jsx("select",{style:E,value:r.anticipacion_min??60,onChange:xe=>l({anticipacion_min:Number(xe.target.value)}),children:[[0,"Sin mÃnimo"],[60,"1 hora antes"],[120,"2 horas antes"],[240,"4 horas antes"],[1440,"1 dÃa antes"]].map(([xe,Le])=>e.jsx("option",{value:xe,children:Le},xe))})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"DÃas hacia adelante"}),e.jsx("input",{style:E,type:"number",min:1,max:120,value:r.dias_max??30,onChange:xe=>l({dias_max:Math.max(1,Math.min(120,Number(xe.target.value)||30))})})]})]}),e.jsx("label",{style:D,children:"Horarios para citas"}),R.map((xe,Le)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:6,flexWrap:"wrap"},children:[e.jsx("select",{style:{...E,width:"auto",marginTop:0},value:xe.dia,onChange:Ee=>P(R.map((Oe,St)=>St===Le?{...Oe,dia:Number(Ee.target.value)}:Oe)),children:y.map((Ee,Oe)=>e.jsx("option",{value:Oe,children:Ee},Oe))}),e.jsx("input",{type:"time",style:{...E,width:"auto",marginTop:0},value:xe.inicio,onChange:Ee=>P(R.map((Oe,St)=>St===Le?{...Oe,inicio:Ee.target.value}:Oe))}),e.jsx("span",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"a"}),e.jsx("input",{type:"time",style:{...E,width:"auto",marginTop:0},value:xe.fin,onChange:Ee=>P(R.map((Oe,St)=>St===Le?{...Oe,fin:Ee.target.value}:Oe))}),e.jsx("button",{onClick:()=>P(R.filter((Ee,Oe)=>Oe!==Le)),style:{...ee,padding:"6px 10px",color:"var(--danger)"},title:"Quitar",children:"â"})]},Le)),R.length<21&&e.jsx("button",{style:ee,onClick:()=>P([...R,{dia:1,inicio:"08:00",fin:"12:00"}]),children:"+ Agregar horario"}),e.jsx(mt,{children:"La cita llega a tus pedidos con el dÃa y la hora que eligió el cliente. Si alguien reserva un horario, desaparece para los demás."})]})})()]}),e.jsxs(ht,{title:"Planes y precios",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"El botón de cada plan abre el formulario con ese plan elegido. Sin planes, la sección no se muestra."}),e.jsx("label",{style:D,children:"TÃtulo de la sección"}),e.jsx("input",{style:E,value:At.plans_title??"Planes y precios",onChange:r=>Et({plans_title:r.target.value}),placeholder:"Planes y precios"}),(At.plans||[]).map((r,l)=>{const y=R=>Et({plans:(At.plans||[]).map((P,re)=>re===l?{...P,...R}:P)});return e.jsxs("div",{style:{border:"1px solid var(--border, #e6e9f0)",borderRadius:10,padding:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("input",{style:{...E,flex:1,minWidth:140,marginBottom:0},value:r.name||"",onChange:R=>y({name:R.target.value}),placeholder:"Ej: Limpieza dental",maxLength:60}),e.jsx("input",{style:{...E,width:170,flex:"none",marginBottom:0},value:r.price||"",onChange:R=>y({price:R.target.value}),placeholder:"Ej: Desde $80.000",maxLength:30}),e.jsx("button",{onClick:()=>Et({plans:(At.plans||[]).filter((R,P)=>P!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]}),e.jsx("input",{style:E,value:r.note||"",onChange:R=>y({note:R.target.value}),placeholder:"Nota corta (opcional). Ej: Incluye valoración",maxLength:90}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:(r.features||[]).join(` 1112`),onChange:R=>y({features:R.target.value.split(` 1113`).slice(0,8)}
1113),placeholder:"Lo que incluye, uno por renglón"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!r.featured,onChange:R=>y({featured:R.target.checked||void 0})})," Destacar como «Más elegido»"]})]},l)}),(At.plans||[]).length<4&&e.jsx("button",{style:ee,onClick:()=>Et({plans:[...At.plans||[],{name:"",price:"",features:[]}]}),children:"+ Agregar plan"})]}),e.jsxs(ht,{title:"Trabajos realizados",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Fotos de resultados reales: antes y después, casos terminados."}),e.jsx("label",{style:D,children:"TÃtulo de la sección"}),e.jsx("input",{style:E,value:At.works_title??"Trabajos realizados",onChange:r=>Et({works_title:r.target.value}),placeholder:"Trabajos realizados"}),e.jsx(Ru,{values:At.works||[],onChange:r=>Et({works:r.slice(0,12)}),uploadsEnabled:Ia,usedUrls:Su(p)})]}),e.jsxs(ht,{title:"Experiencia y equipo",children:[e.jsx("label",{style:D,children:"Cifras de experiencia (máximo 4)"}),(At.stats||[]).map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6},children:[e.jsx("input",{style:{...E,width:120,flex:"none",marginBottom:0},value:r.value||"",onChange:y=>Et({stats:(At.stats||[]).map((R,P)=>P===l?{...R,value:y.target.value}:R)}),placeholder:"Ej: 12 años",maxLength:16}),e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r.label||"",onChange:y=>Et({stats:(At.stats||[]).map((R,P)=>P===l?{...R,label:y.target.value}:R)}),placeholder:"Ej: de experiencia",maxLength:40}),e.jsx("button",{onClick:()=>Et({stats:(At.stats||[]).filter((y,R)=>R!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]},l)),(At.stats||[]).length<4&&e.jsx("button",{style:ee,onClick:()=>Et({stats:[...At.stats||[],{value:"",label:""}]}),children:"+ Agregar cifra"}),e.jsx("label",{style:D,children:"TÃtulo del equipo"}),e.jsx("input",{style:E,value:At.team_title??"Quiénes te atienden",onChange:r=>Et({team_title:r.target.value}),placeholder:"Quiénes te atienden"}),(At.team||[]).map((r,l)=>{const y=R=>Et({team:(At.team||[]).map((P,re)=>re===l?{...P,...R}:P)});return e.jsxs("div",{style:{border:"1px solid var(--border, #e6e9f0)",borderRadius:10,padding:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("input",{style:{...E,flex:1,minWidth:140,marginBottom:0},value:r.name||"",onChange:R=>y({name:R.target.value}),placeholder:"Ej: Dra. Laura Gómez",maxLength:60}),e.jsx("input",{style:{...E,flex:1,minWidth:140,marginBottom:0},value:r.role||"",onChange:R=>y({role:R.target.value}),placeholder:"Ej: Ortodoncista",maxLength:80}),e.jsx("button",{onClick:()=>Et({team:(At.team||[]).filter((R,P)=>P!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]}),e.jsx(Rn,{compact:!0,label:`Foto de ${r.name||"esta persona"} (opcional)`,value:r.photo,onChange:R=>y({photo:R||void 0}),uploadsEnabled:Ia})]},l)}),(At.team||[]).length<6&&e.jsx("button",{style:ee,onClick:()=>Et({team:[...At.team||[],{name:"",role:""}]}),children:"+ Agregar persona"})]}),e.jsxs(ht,{title:"Horario de atención",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Sale con un botón para escribirte por WhatsApp. Sin renglones, no se muestra."}),e.jsx("label",{style:D,children:"TÃtulo de la sección"}),e.jsx("input",{style:E,value:At.hours_title??"Horario de atención",onChange:r=>Et({hours_title:r.target.value}),placeholder:"Horario de atención"}),(At.hours||[]).map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r.days||"",onChange:y=>Et({hours:(At.hours||[]).map((R,P)=>P===l?{...R,days:y.target.value}:R)}),placeholder:"Ej: Lunes a viernes",maxLength:40}),e.jsx("input",{style:{...E,flex:1,minWidth:0,marginBottom:0},value:r.time||"",onChange:y=>Et({hours:(At.hours||[]).map((R,P)=>P===l?{...R,time:y.target.value}:R)}),placeholder:"Ej: 8:00 a. m. a 6:00 p. m.",maxLength:40}),e.jsx("button",{onClick:()=>Et({hours:(At.hours||[]).filter((y,R)=>R!==l)}),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar",children:"â"})]},l)),(At.hours||[]).length<7&&e.jsx("button",{style:ee,onClick:()=>Et({hours:[...At.hours||[],{days:"",time:""}]}),children:"+ Agregar renglón"}),e.jsx("label",{style:D,children:"WhatsApp del botón (opcional)"}),e.jsx("input",{style:E,value:At.wa_number||"",onChange:r=>Et({wa_number:r.target.value||void 0}),placeholder:(Pd=p.whatsapp)!=null&&Pd.number?`VacÃo = ${p.whatsapp.number}`:"Ej: +57 300 123 4567"})]})]}),!pt&&e.jsx(Ei,{children:"Oferta y persuasión"}),!pt&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Variantes (tallas, colores)",children:[e.jsxs(mt,{children:['El cliente las escoge antes de pedir. Se llenan solas al importar. Si la variante se llama "Color", sube una foto por color y al elegirlo la foto de arriba cambia sola.',ke?" En la landing de WhatsApp, la talla y el color que elija se meten solos en el mensaje del chat.":""]}),!ke&&cr.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"¿Dónde las ve el cliente?"}),e.jsx(jn,{small:!0,options:[{v:"",l:"En la página y en el formulario"},{v:"1",l:"Solo en el formulario"}],value:p.variants_form_only?"1":"",onPick:r=>x(l=>({...l,variants_form_only:r?!0:void 0}))}),e.jsx(mt,{children:'"Solo en el formulario" deja la página más limpia: el cliente escoge talla y color justo antes de dejar sus datos, sin verlas dos veces. Con ofertas por cantidad la talla y el color van dentro de cada oferta: esto también las quita de la copia de la página. Si pusiste las ofertas en "Solo en la página", se dejan visibles igual, porque si no el cliente no tendrÃa dónde escogerlas.'})]}),cr.map((r,l)=>{const y=/color/i.test(r.name||"");return e.jsxs("div",{style:{border:"1px solid var(--border, #eee)",borderRadius:10,padding:10,marginBottom:8,background:"var(--input-bg, #fafbff)"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,fontWeight:700},value:r.name,onChange:R=>ur(l,{name:R.target.value}),placeholder:"Color"}),e.jsx("button",{onClick:()=>Tc(l),style:{...ee,padding:"6px 10px",color:"var(--danger)"}
1113,children:"Quitar"})]}),(r.options||[]).map((R,P)=>e.jsxs("div",{style:{marginBottom:y?10:6},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,padding:"8px 10px"},value:R.value,onChange:re=>op(l,P,{value:re.target.value}),placeholder:r.name==="Talla"?"M":"Verde"}),e.jsx("button",{onClick:()=>xs(l,P),style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]}),y&&e.jsx("div",{style:{marginTop:6,paddingLeft:2},children:e.jsx(Rn,{compact:!0,label:`Foto de ${R.value||"este color"} (opcional)`,value:R.image,onChange:re=>op(l,P,{image:re||void 0}),uploadsEnabled:Ia})})]},P)),e.jsx("button",{style:{...ee,padding:"6px 12px",fontSize:12.5},onClick:()=>rp(l),children:"+ Agregar opción"})]},l)}),e.jsx("button",{style:ee,onClick:fm,children:"+ Agregar variante"}),!!String(((Dd=p.product)==null?void 0:Dd.dropi_product_id)??"").trim()&&e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px solid var(--border, #eef1f6)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsx("button",{style:{...ee,padding:"8px 13px",fontSize:12.5},onClick:Ec,disabled:Xs.loading,children:Xs.loading?"Verificandoâ¦":"Verificar con Dropi"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",flex:"1 1 200px",minWidth:160},children:"Tus variantes deben coincidir con las de Dropi (ni más ni menos). Si una opción no existe en Dropi, ese pedido no se puede surtir."})]}),Xs.result&&(()=>{const r=Xs.result;return r.ok?r.matches?e.jsxs("div",{role:"status",style:{marginTop:10,display:"flex",alignItems:"center",gap:8,fontSize:12.5,fontWeight:700,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:10,padding:"9px 12px"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--success)"}}),"Coinciden con Dropi · ",r.lumyOptionCount," ",r.lumyOptionCount===1?"opción":"opciones"," en ",r.lumyVariantCount," ",r.lumyVariantCount===1?"variante":"variantes","."]}):e.jsxs("div",{style:{marginTop:10,background:r.hasErrors?"var(--notice-danger-bg)":"var(--notice-warning-bg)",border:"1px solid "+(r.hasErrors?"var(--notice-danger-border)":"var(--notice-warning-border)"),borderRadius:10,padding:"11px 12px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:r.hasErrors?"var(--danger)":"var(--notice-warning-text)",marginBottom:7},children:r.hasErrors?"No coinciden con Dropi â corrige antes de vender":"Diferencias con Dropi"}),e.jsx("div",{style:{display:"grid",gap:6},children:(r.issues||[]).map((l,y)=>e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:12,lineHeight:1.45,color:"var(--text, #374151)"},children:[e.jsx("span",{style:{flex:"none",marginTop:1,color:l.level==="error"?"var(--danger)":"var(--warning)",fontWeight:900},children:l.level==="error"?"â":"!"}),e.jsx("span",{children:l.message})]},y))}),Array.isArray(r.dropi)&&r.dropi.length>0&&e.jsxs("div",{style:{marginTop:9,paddingTop:9,borderTop:"1px dashed var(--border, #e3e6ee)",fontSize:11.5,color:"var(--text-muted)"},children:["En Dropi: ",r.dropi.map(l=>`${l.name} (${(l.values||[]).join(", ")})`).join(" · ")]})]}):e.jsx("div",{role:"status",style:{marginTop:10,fontSize:12.5,color:"var(--warning)"},children:r.message||"No se pudo verificar."})})()]})]})}),!pt&&e.jsxs(ht,{title:"Ofertas por cantidad",right:e.jsx(e.Fragment,{children:e.jsxs("select",{value:p.bundles_style||"",onChange:r=>x(l=>({...l,bundles_style:r.target.value||void 0})),style:{fontSize:12,padding:"5px 8px",borderRadius:8,border:"1px solid var(--border)",background:"var(--card-bg, #fff)",color:"var(--text, #222)"},children:[e.jsx("option",{value:"",children:"Estilo clásico"}),e.jsx("option",{value:"destacada",children:"Tarjetas destacadas"}),e.jsx("option",{value:"precios",children:"Tarjetas con precio"}),e.jsx("option",{value:"escalera",children:"Escalera de descuento"}),e.jsx("option",{value:"boletos",children:"Cupones"}),e.jsx("option",{value:"foco",children:"La elegida en grande"})]})}),children:[e.jsx(mt,{children:"Puedes crear hasta 6 ofertas. Ej: 1 unidad, 2 con descuento, 3 con más descuento. El cliente elige y el precio cambia solo. (VacÃo = precio único.)"}),e.jsx(Va,{que:"tus ofertas"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",marginBottom:12,padding:"9px 12px",border:"1px solid var(--border)",borderRadius:10},children:[e.jsx("input",{type:"checkbox",style:{width:16,height:16,flexShrink:0},checked:!p.hide_unit_price,onChange:r=>x(l=>({...l,hide_unit_price:r.target.checked?void 0:!0}))}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13,fontWeight:700}
1113,children:'Mostrar precio por unidad ("c/u $X")'}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:'El "c/u" que sale bajo cada oferta. Desmárcalo para ocultarlo (útil en productos de precio alto).'})]})]}),Bn.map((r,l)=>e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center",marginBottom:8},children:[e.jsx("input",{style:{...E,padding:"8px 6px",textAlign:"center",width:56,flex:"none"},type:"number",value:r.qty??"",onChange:y=>sr(l,{qty:An(y.target.value)}),title:"Cantidad",placeholder:"Cant."}),e.jsx("input",{style:{...E,padding:"8px 10px",flex:"1 1 110px",minWidth:100},type:"number",value:r.price??"",onChange:y=>sr(l,{price:An(y.target.value)}),placeholder:"Precio total"}),e.jsx("input",{style:{...E,padding:"8px 10px",flex:"1 1 110px",minWidth:100},value:r.label||"",onChange:y=>sr(l,{label:y.target.value}),placeholder:"Etiqueta"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flex:"1 1 130px",minWidth:110},children:[e.jsx("input",{style:{...E,padding:"8px 10px",flex:1,minWidth:0},value:r.badge||"",onChange:y=>sr(l,{badge:y.target.value}),placeholder:"Insignia (nombre)"}),e.jsx(D8,{qty:r.qty||1,price:Number(r.price)||0,productName:q.name||"",context:[q.description,...q.bullets||[]].filter(Boolean).join(" · ").slice(0,600),onPick:y=>sr(l,{label:y.label,badge:y.badge})})]}),e.jsx("button",{onClick:()=>Gi(l),style:{...ee,padding:"6px 10px",color:"var(--danger)",flex:"none"},title:"Quitar oferta",children:"â"}),e.jsx("div",{style:{flexBasis:"100%"},children:e.jsx(Rn,{compact:!0,label:"Foto de esta oferta (opcional, si no usa la primera de la galerÃa)",value:r.image,onChange:y=>sr(l,{image:y}),uploadsEnabled:Ia})})]},l)),Bn.length>=2&&e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid var(--border, #e6e9f0)"},children:[e.jsx("label",{style:D,children:"¿Cuál viene marcada por defecto?"}),e.jsx(mt,{children:"Recomendado: marca la de 2 o 3 unidades. La mayorÃa se queda con la opción marcada, asà sube tu ticket promedio sin tocar el envÃo. Si marcas una de 2+ unidades sin insignia propia, lleva la cinta MÃS VENDIDO automáticamente."}),e.jsx(jn,{small:!0,options:Bn.map((r,l)=>({v:String(l),l:`${r.qty} ${Number(r.qty)===1?"unidad":"unidades"}`})),value:String(Number(p.bundles_preselect)||0),onPick:r=>x(l=>({...l,bundles_preselect:Number(r)}))})]}),Bn.length<bu?e.jsxs("button",{style:{...ee,marginTop:10},onClick:Hi,children:["+ Agregar oferta de cantidad (",Bn.length,"/",bu,")"]}):e.jsxs("div",{style:{marginTop:10,fontSize:12,color:"var(--text-muted)",fontWeight:700},children:["Máximo ",bu," ofertas de cantidad."]})]}),!pt&&!ke&&Bn.length>0&&e.jsx(ht,{title:"¿Dónde mostrar las ofertas?",children:e.jsxs("div",{children:[e.jsx("label",{style:D,children:"¿Dónde mostrar las ofertas?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 7px"},children:"En la página (donde el cliente baja), dentro del formulario al pedir, o en ambas."}),e.jsx(jn,{options:[{v:"both",l:"En la página y en el formulario"},{v:"outside",l:"Solo en la página"},{v:"inside",l:"Solo dentro del formulario"}],value:p.bundles_placement||(te?"inside":"both"),onPick:r=>x(l=>({...l,bundles_placement:r}))}),e.jsxs("div",{style:{marginTop:12},children:[e.jsx("label",{style:D,children:"Alineación de las insignias (MEJOR COMBO, AHORRO MAXâ¦)"}),e.jsx(jn,{options:[{v:"left",l:"Izquierda"},{v:"center",l:"Centro"},{v:"right",l:"Derecha"}],value:p.bundles_badge_align||"left",onPick:r=>x(l=>({...l,bundles_badge_align:r}))})]}),!ke&&(cr||[]).length>0&&e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px dashed var(--border, #e8eaf0)"},children:[e.jsx("label",{style:D,children:"¿Dónde mostrar las tallas y colores?"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 7px"},children:'Es el mismo ajuste que está en "Variantes (tallas, colores)".'}),e.jsx(jn,{options:[{v:"",l:"En la página y en el formulario"},{v:"1",l:"Solo dentro del formulario"}],value:p.variants_form_only?"1":"",onPick:r=>x(l=>({...l,variants_form_only:r?!0:void 0}))})]})]})})]}),Oa==="landing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Página"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"El cuerpo de tu landing: la parte superior, las fotos, el contenido y las secciones que ve el cliente al bajar."})]}),te&&e.jsx("div",{style:{...Jt,marginBottom:12,background:"rgba(8,102,255,.04)"},children:e.jsxs(mt,{children:[e.jsx("b",{children:"Landing simple:"})," tus imágenes una debajo de otra con botones de compra repartidos, ofertas por cantidad y reseñas reales, más el formulario popup. También puedes agregar variantes, hora de corte de despacho, regalo por monto y preguntas frecuentes."]})}),te&&e.jsxs(ht,{title:"Parte superior",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:"El cintillo y el nombre de tu tienda salen arriba de la página. Deja vacÃo lo que quieras ocultar."}),e.jsx(tv,{value:p.store_name||"",onChange:r=>x(l=>({...l,store_name:r}
1113)),brand:Ue,hint:"Si lo dejas vacÃo, el encabezado no se muestra."}),e.jsx(Ea,{ai:{field:"Cintillo de beneficios",instruction:"Tres beneficios cortos separados por punto medio (·), ej Pagas al recibir · EnvÃo gratis · GarantÃa. Sin emojis",current:je,productName:q.name||"",onPick:r=>Ne({text:r})},children:"Cintillo de beneficios (sepáralos con · , máximo 3)"}),e.jsx("input",{style:E,value:je,onChange:r=>Ne({text:r.target.value}),placeholder:"Pagas al recibir · EnvÃo gratis · GarantÃa de devolución"}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 2px 0"},children:"Para quitarlo, borra todo el texto del cintillo (déjalo vacÃo)."}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,margin:"9px 2px 0",cursor:"pointer",color:"var(--text-secondary,#475569)"},children:[e.jsx("input",{type:"checkbox",checked:!!((Bd=p.announcement)!=null&&Bd.animate),onChange:r=>Ne({animate:r.target.checked})})," Animar el cintillo"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,margin:"7px 2px 0",cursor:"pointer",color:"var(--text-secondary,#475569)"},children:[e.jsx("input",{type:"checkbox",checked:!!((Wd=p.announcement)!=null&&Wd.marquee),onChange:r=>Ne({marquee:r.target.checked})})," Cinta continua (el texto se desplaza)"]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:10,margin:"11px 0 2px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Fondo del cintillo"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((qd=p.theme)==null?void 0:qd.ann_bg)||"#eef4ff",onChange:r=>Pt({ann_bg:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(Md=p.theme)!=null&&Md.ann_bg?e.jsx("button",{type:"button",onClick:()=>Pt({ann_bg:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Texto del cintillo"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Fd=p.theme)==null?void 0:Fd.ann_text)||"#0866FF",onChange:r=>Pt({ann_text:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(Od=p.theme)!=null&&Od.ann_text?e.jsx("button",{type:"button",onClick:()=>Pt({ann_text:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:10,margin:"10px 0 2px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Fondo del encabezado"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Hd=p.theme)==null?void 0:Hd.shead_bg)||"#ffffff",onChange:r=>Pt({shead_bg:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(Gd=p.theme)!=null&&Gd.shead_bg?e.jsx("button",{type:"button",onClick:()=>Pt({shead_bg:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Texto del encabezado"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Vd=p.theme)==null?void 0:Vd.shead_text)||"#111827",onChange:r=>Pt({shead_text:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(Ud=p.theme)!=null&&Ud.shead_text?e.jsx("button",{type:"button",onClick:()=>Pt({shead_text:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]})]})]}),te&&e.jsxs(ht,{title:"Caja de oferta",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"El recuadro que va encima del precio. Escribe la frase y aparece; déjalo vacÃo y no sale."}),e.jsx(Ea,{ai:{field:"Caja de oferta",instruction:"Frase basada en una razón real de la oferta o en tranquilidad de compra, máximo 60 caracteres. Sin escasez, últimas unidades ni presión inventada",current:String(p.offer_text||""),productName:q.name||"",onPick:r=>x(l=>({...l,offer_text:r}))},children:"Frase de la caja"}),e.jsx("input",{style:E,value:String(p.offer_text||""),onChange:r=>x(l=>({...l,offer_text:r.target.value})),placeholder:"Pagas solo cuando lo tienes en tus manos"}),!!String(p.offer_text||"").trim()&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Forma del recuadro"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Normal"},{v:"etiqueta",l:"Etiqueta"},{v:"cinta",l:"Cinta"},{v:"sello",l:"Sello"},{v:"nota",l:"Nota"},{v:"luz",l:"Borde de luz"},{v:"saten",l:"Satén"},{v:"orbe",l:"Orbe"},{v:"foco",l:"Foco"},{v:"burbuja",l:"Burbujas"},{v:"amano",l:"A mano"}],value:((d=p.offer_box)==null?void 0:d.style)||"",onPick:r=>x(l=>({...l,offer_box:{...l.offer_box||{},style:r||void 0}}))}),e.jsx("label",{style:D,children:"Latido"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Siempre"},{v:"dos",l:"Dos veces"},{v:"quieto",l:"Quieto"}
1113],value:((A=p.offer_box)==null?void 0:A.pulse)==="siempre"?"":((T=p.offer_box)==null?void 0:T.pulse)||"",onPick:r=>x(l=>({...l,offer_box:{...l.offer_box||{},pulse:r||void 0}}))}),e.jsx(mt,{children:'El latido es el resplandor que la hace notar. "A mano" quita el recuadro y deja la frase con un trazo debajo.'})]})]}),e.jsxs(ht,{title:"Cómo aparecen los bloques al bajar",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px",lineHeight:1.5},children:"Los bloques se animan al entrar en pantalla. No pesa nada â lo hace el navegador solo â y donde no se soporte, tu página se ve igual que hoy."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))",gap:8},children:EC.map(r=>{const l=String(p.reveal||"")===r.v;return e.jsxs("button",{type:"button",onClick:()=>x(y=>({...y,reveal:r.v||void 0})),style:{textAlign:"left",cursor:"pointer",fontFamily:"inherit",padding:"10px 12px",borderRadius:10,background:"var(--card-bg,#fff)",border:l?"2px solid var(--primary,#0866ff)":"1px solid var(--border)"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700},children:r.name}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:2,lineHeight:1.4},children:r.desc})]},r.v||"none")})})]}),te&&e.jsxs(ht,{title:"Efecto del titular",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"El resaltado, subrayado o degradado que va sobre el nombre del producto."}
1113),e.jsx(Va,{que:"un efecto de titular único"}),e.jsx(ns,{options:_y,value:p.headline_fx||"",onPick:r=>x(l=>({...l,headline_fx:r||void 0})),render:r=>e.jsx($y,{value:r,color:ii,text:"Aa"})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,margin:"10px 2px 0"},children:[e.jsx("span",{style:{fontSize:12.5,color:"var(--text-secondary,#475569)",fontWeight:600},children:"Color del efecto"}),e.jsx("input",{type:"color",value:ii,onChange:r=>Pt({headline_fx_color:r.target.value}),style:{width:40,height:30,border:"none",background:"none",cursor:"pointer"}}),!!((O=p.theme)!=null&&O.headline_fx_color)&&e.jsx("button",{type:"button",onClick:()=>Pt({headline_fx_color:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"})]}),e.jsx(mt,{children:"Sin elegir ninguno, el titular queda como siempre."})]}),ke&&e.jsx("div",{style:{...Jt,marginBottom:12,background:"rgba(22,163,74,.05)",borderColor:"rgba(22,163,74,.25)"},children:e.jsxs(mt,{children:[e.jsx("b",{children:"Landing de WhatsApp:"})," página puente. Gancho + imágenes + beneficios y un botón que abre el chat. Sin formulario ni extras de pedido. La venta la marcas en Pedidos cuando cierres por chat."]})}),!te&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{title:pt?"Encabezado de tu página":"Encabezado de tu tienda",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Tu marca arriba de la página. Si lo dejas vacÃo, el encabezado no se muestra."}),e.jsx(tv,{value:p.store_name||"",onChange:r=>x(l=>({...l,store_name:r})),brand:Ue,hint:"Si lo dejas vacÃo, el encabezado no se muestra."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:10,margin:"8px 0 2px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Fondo del encabezado"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((W=p.theme)==null?void 0:W.shead_bg)||"#ffffff",onChange:r=>Pt({shead_bg:r.target.value}),style:{width:44,height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(J=p.theme)!=null&&J.shead_bg?e.jsx("button",{type:"button",onClick:()=>Pt({shead_bg:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Blanco"})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Texto del encabezado"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((le=p.theme)==null?void 0:le.shead_text)||"#111827",onChange:r=>Pt({shead_text:r.target.value}),style:{width:44,height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(Ve=p.theme)!=null&&Ve.shead_text?e.jsx("button",{type:"button",onClick:()=>Pt({shead_text:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Auto"})]})]})]})]}),e.jsxs(ht,{title:"Cintillo de beneficios",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"La cinta de arriba con tus beneficios cortos."}),e.jsx(Ea,{ai:{field:"Cintillo de beneficios",instruction:"Tres beneficios cortos separados por punto medio (·), ej Pagas al recibir · EnvÃo gratis · GarantÃa. Sin emojis",current:je,productName:q.name||"",onPick:r=>Ne({text:r})},children:"Cintillo de beneficios (sepáralos con · , máximo 3)"}),e.jsx("input",{style:E,value:je,onChange:r=>Ne({text:r.target.value}),placeholder:"Pagas al recibir · EnvÃo gratis · GarantÃa de devolución"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,margin:"7px 2px 0",cursor:"pointer",color:"var(--text-secondary)"},children:[e.jsx("input",{type:"checkbox",checked:!!((gt=p.announcement)!=null&>.animate),onChange:r=>Ne({animate:r.target.checked})})," Animar el cintillo (rota entre los beneficios, uno por uno)"]}
1113),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,margin:"7px 2px 0",cursor:"pointer",color:"var(--text-secondary)"},children:[e.jsx("input",{type:"checkbox",checked:!!((Qe=p.announcement)!=null&&Qe.marquee),onChange:r=>Ne({marquee:r.target.checked})})," Cinta continua (los beneficios corren en bucle, estilo marquee)"]}),(!!((Z=p.announcement)!=null&&Z.animate)||!!((Rt=p.announcement)!=null&&Rt.marquee))&&((Yt=p.announcement)==null?void 0:Yt.text)!==void 0&&je.trim()!==""&&je.split("·").map(r=>r.trim()).filter(Boolean).length<2&&e.jsx("p",{style:{fontSize:11.5,color:"#B45309",margin:"6px 2px 0"},children:"Para que se mueva, pon al menos dos beneficios separados con ·"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:10,margin:"10px 0 2px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Fondo del cintillo"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Ht=p.theme)==null?void 0:Ht.ann_bg)||"#eef4ff",onChange:r=>Pt({ann_bg:r.target.value}),style:{width:44,height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(nt=p.theme)!=null&&nt.ann_bg?e.jsx("button",{type:"button",onClick:()=>Pt({ann_bg:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Auto"})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginBottom:3},children:"Texto del cintillo"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Bt=p.theme)==null?void 0:Bt.ann_text)||"#0866FF",onChange:r=>Pt({ann_text:r.target.value}),style:{width:44,height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(ca=p.theme)!=null&&ca.ann_text?e.jsx("button",{type:"button",onClick:()=>Pt({ann_text:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Auto"})]})]})]})]}),e.jsxs(ht,{title:"Etiqueta y frase gancho",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Van encima del tÃtulo del producto."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx(Ea,{ai:{field:"Etiqueta / pill",instruction:"Etiqueta corta tipo categorÃa, 1 a 3 palabras, en mayúsculas",current:q.tagline||"",productName:q.name||"",images:q.images,onPick:r=>Zt({tagline:r})},children:"Etiqueta (pill sobre el tÃtulo)"}),e.jsx("input",{style:E,value:q.tagline||"",onChange:r=>Zt({tagline:r.target.value}),placeholder:"CABELLO DE SALÃN"})]}),e.jsxs("div",{children:[e.jsx(Ea,{ai:{field:"Frase gancho",instruction:"Frase gancho corta y emocional, 2 a 5 palabras",current:q.kicker||"",productName:q.name||"",images:q.images,onPick:r=>Zt({kicker:r})},children:"Frase gancho (debajo de la etiqueta)"}),e.jsx("input",{style:E,value:q.kicker||"",onChange:r=>Zt({kicker:r.target.value}),placeholder:"EN CASA, EN MINUTOS"})]})]})]}),e.jsxs(ht,{title:pt?"Textos del servicio":"Textos del producto",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Caja de oferta y tiempo de entrega."}),e.jsx(Ea,{ai:{field:"Caja de oferta",instruction:"Frase basada en una razón real de la oferta o en tranquilidad de compra, máximo 60 caracteres. Sin escasez, últimas unidades ni presión inventada",current:Lt,productName:q.name||"",onPick:r=>x(l=>({...l,offer_text:r}))},children:"Caja de oferta (recuadro bajo el tÃtulo)"}),e.jsx("input",{style:E,value:Lt,onChange:r=>x(l=>({...l,offer_text:r.target.value})),placeholder:"Pagas solo cuando lo tienes en tus manos"}),!!Lt&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Forma del recuadro"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Normal"},{v:"etiqueta",l:"Etiqueta"},{v:"cinta",l:"Cinta"},{v:"sello",l:"Sello"},{v:"nota",l:"Nota"},{v:"luz",l:"Borde de luz"},{v:"saten",l:"Satén"},{v:"orbe",l:"Orbe"},{v:"foco",l:"Foco"},{v:"burbuja",l:"Burbujas"},{v:"amano",l:"A mano"}],value:((Vt=p.offer_box)==null?void 0:Vt.style)||"",onPick:r=>x(l=>({...l,offer_box:{...l.offer_box||{},style:r||void 0}}))}),e.jsx("label",{style:D,children:"Latido"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Siempre"},{v:"dos",l:"Dos veces"},{v:"quieto",l:"Quieto"}],value:((va=p.offer_box)==null?void 0:va.pulse)==="siempre"?"":((qt=p.offer_box)==null?void 0:qt.pulse)||"",onPick:r=>x(l=>({...l,offer_box:{...l.offer_box||{},pulse:r||void 0}}))}),(((io=p.offer_box)==null?void 0:io.pulse)||"")!=="quieto"&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Velocidad del latido"}),e.jsx(jn,{small:!0,options:[{v:"lento",l:"Lento"},{v:"",l:"Normal"},{v:"vivo",l:"Vivo"}],value:((Uo=p.offer_box)==null?void 0:Uo.speed)||"",onPick:r=>x(l=>({...l,offer_box:{...l.offer_box||{},speed:r||void 0}}))})]}),e.jsx(mt,{children:'"A mano" quita el recuadro y deja la frase con un trazo debajo. Todos se apagan solos en los teléfonos que piden menos movimiento.'})]}),e.jsx(Ea,{ai:{field:"Tiempo de entrega",instruction:"Plazo realista para Colombia más el pago al recibir, separados con el punto medio (·). Máx 60 caracteres. Ej: Llega en 2 a 5 dÃas hábiles · Pago al recibir.",current:p.shipping_info||"",productName:q.name||"",onPick:r=>x(l=>({...l,shipping_info:r}))},children:"Tiempo de entrega (bajo el precio)"}),e.jsx("input",{style:E,value:p.shipping_info??"Llega en 2 a 5 dÃas hábiles · Pago al recibir",onCh
1113ange:r=>x(l=>({...l,shipping_info:r.target.value})),placeholder:"Llega en 2 a 5 dÃas hábiles · Pago al recibir"})]})]}),!te&&e.jsx(e.Fragment,{children:(bt||Nt)&&e.jsx(ht,{title:"Tu página advertorial",children:(()=>{const r=p.prelanding||{},l=r.byline||{},y=P=>Qa({byline:{...l,...P}}),R=r.ad_label==="";return e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:bt?"Esta es tu página advertorial (con su propia URL). Calienta el tráfico frÃo y, con el botón, lleva a tu landing de venta. Contenido publicitario honesto: la misma página la ve la persona y el revisor del anuncio.":"Una nota estilo artÃculo que calienta el tráfico frÃo y baja a tu oferta en la misma página. Contenido publicitario honesto (la misma página la ve la persona y el revisor), no engaño."}),bt&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"URL de tu landing de venta (a dónde lleva el botón)"}),e.jsx("input",{style:E,value:r.cta_url||"",onChange:P=>Qa({cta_url:P.target.value}),placeholder:"https://tu-tienda.com/l/mi-producto"}),!r.cta_url&&e.jsx("p",{style:{fontSize:11.5,color:"#B45309",margin:"5px 2px 0",fontWeight:600},children:"Pon la URL de tu landing de venta: es a donde lleva el botón del advertorial."})]}),e.jsx("label",{style:D,children:"Plantilla (rellena un borrador editable)"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,marginBottom:4},children:[["nota","Nota informativa"],["transformacion","GuÃa de uso"],["listicle","Lista de aspectos"],["resena","GuÃa de evaluación"]].map(([P,re])=>e.jsx("button",{type:"button",onClick:()=>Qa(Q2[P]),style:{textAlign:"left",border:r.template===P?`2px solid ${me}`:"1.5px solid var(--border, #dde)",background:r.template===P?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",borderRadius:10,padding:"9px 11px",cursor:"pointer",fontSize:13,fontWeight:700,color:"var(--text, #111)"},children:re},P))}),e.jsx("label",{style:D,children:"Etiqueta de publicidad (recomendada, va arriba de todo)"}),e.jsx("input",{style:E,value:r.ad_label??Jl,onChange:P=>Qa({ad_label:P.target.value}),placeholder:Jl}),R&&e.jsx("p",{style:{fontSize:11.5,color:"#B45309",margin:"5px 2px 0",fontWeight:600},children:"Sin la etiqueta de publicidad aumenta el riesgo de que rechacen el anuncio."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"CategorÃa (kicker)"}),e.jsx("input",{style:E,value:r.kicker||"",onChange:P=>Qa({kicker:P.target.value}),placeholder:"BIENESTAR Y CUIDADO"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Nicho (define el aviso legal)"}),e.jsxs("select",{style:E,value:r.niche||"general",onChange:P=>Qa({niche:P.target.value}),children:[e.jsx("option",{value:"general",children:"General"}),e.jsx("option",{value:"salud",children:"Salud / bienestar"}),e.jsx("option",{value:"belleza",children:"Belleza"})]})]})]}),e.jsx(Ea,{ai:{field:"Titular del advertorial",instruction:"Titular estilo nota informativa, curioso pero SIN prometer curas ni resultados garantizados, máx 90 caracteres",current:r.headline||"",productName:q.name||"",onPick:P=>Qa({headline:P})},children:"Titular (estilo nota)"}),e.jsx("input",{style:E,value:r.headline||"",onChange:P=>Qa({headline:P.target.value}),placeholder:"Por qué más personas en Colombia buscan esta alternativa"}),e.jsx("label",{style:D,children:"Bajada (subtÃtulo)"}),e.jsx("input",{style:E,value:r.subheadline||"",onChange:P=>Qa({subheadline:P.target.value}),placeholder:"Revisamos qué es y cómo se usa, en pago contraentrega."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:10},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Autor"}),e.jsx("input",{style:E,value:l.author||"",onChange:P=>y({author:P.target.value}),placeholder:"Equipo Editorial"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Sección/fuente"}),e.jsx("input",{style:E,value:l.source||"",onChange:P=>y({source:P.target.value}),placeholder:"Sección Bienestar"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fecha real (opcional)"}),e.jsx("input",{style:E,value:l.date_relative||"",onChange:P=>y({date_relative:P.target.value}),placeholder:"Ej: 1 de agosto de 2026"})]})]}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 2px 0"},children:'Usa un autor propio (ej: "Equipo Editorial de tu marca"). NO uses nombres de medios ni periodistas reales: eso es engaño y te banean.'}),e.jsx("label",{style:D,children:"Imagen principal"}
1113),e.jsx(Rn,{label:"Imagen del advertorial",value:r.image,onChange:P=>Qa({image:P||""}),uploadsEnabled:Ia,compact:!0}),e.jsx("input",{style:{...E,marginTop:6,padding:"7px 10px",fontSize:12.5},value:r.image_caption||"",onChange:P=>Qa({image_caption:P.target.value}),placeholder:"Pie de foto (ej: Producto en uso. Imagen del fabricante.)"}),e.jsx(Ea,{ai:{field:"Cuerpo del advertorial",instruction:'Cuerpo de nota publicitaria honesta, SIN testimonios inventados, escasez, fechas relativas ni claims de cura, milagro o garantÃa. Usa "## " para subtÃtulos y "[CTA]" en una lÃnea para botón. 4 párrafos cortos, cada uno de máximo 2 frases.',current:r.content||"",productName:q.name||"",context:q.description||"",onPick:P=>Qa({content:P})},children:"Cuerpo de la nota"}),e.jsx("textarea",{style:{...E,minHeight:160,resize:"vertical",fontFamily:"inherit",lineHeight:1.5},value:r.content||"",onChange:P=>Qa({content:P.target.value}),placeholder:`Párrafo normal. 1114## SubtÃtulo 1115Otro párrafo con información verificable. 1116[CTA: Ver la oferta]`}),e.jsxs(mt,{children:["En el cuerpo: ",e.jsx("b",{children:"## "})," = subtÃtulo · ",e.jsx("b",{children:"[CTA]"})," o ",e.jsx("b",{children:"[CTA: texto]"})," = botón que baja a la oferta. Incluye testimonios solo cuando provengan de una fuente real y verificable."]}),e.jsx("label",{style:D,children:"Texto del botón final"}),e.jsx("input",{style:E,value:r.cta_text||"",onChange:P=>Qa({cta_text:P.target.value}),placeholder:"Conocer la oferta y pedir con pago contraentrega"}),e.jsx("label",{style:D,children:"Aviso legal de cierre (recomendado)"}),e.jsx("textarea",{style:{...E,minHeight:56,resize:"vertical",fontFamily:"inherit",fontSize:13},value:r.disclaimer??"",onChange:P=>Qa({disclaimer:P.target.value}),placeholder:"Contenido publicitario. Los resultados pueden variar de una persona a otra."})]})})()})}),(Sr||hs)&&e.jsxs(e.Fragment,{children:[e.jsx(Ei,{children:"Confianza verificable"}),e.jsxs(ht,{title:"Compra con información clara",right:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:Sr,onChange:r=>x(l=>{var y;return{...l,trust_facts:r.target.checked?Array.isArray((y=l.trust_facts)==null?void 0:y.items)?{...l.trust_facts,enabled:!0}:MC(l.page_type):{...l.trust_facts||{},enabled:!1}}})})," Mostrar"]}),children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px",lineHeight:1.5},children:"Franja sobria junto al botón de pedir y al formulario. Elige hasta dos hechos que puedas cumplir."}),e.jsxs("div",{style:{opacity:Sr?1:.45,pointerEvents:Sr?"auto":"none"},children:[wn.map((r,l)=>{var xe,Le;const y=Bi.some(Ee=>Ee.key===(r==null?void 0:r.key))?r.key:"cod",R=Bi.find(Ee=>Ee.key===y)||Io[0]||Bi[0],P=Io.some(Ee=>Ee.key===y)?Io:[R,...Io],re=!!((xe=p.urgency)!=null&&xe.enabled)&&((Le=p.urgency)==null?void 0:Le.mode)==="corte";return e.jsxs("div",{style:{border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:9,marginBottom:8,background:"var(--input-bg, #fafbff)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(150px, .7fr) minmax(0, 1.3fr) auto",gap:7,alignItems:"center"},children:[e.jsx("select",{style:{...E,margin:0},value:y,onChange:Ee=>{const Oe=Bi.find(St=>St.key===Ee.target.value)||Bi[0];Fo(l,{key:Oe.key,text:Oe.text})},children:P.map(Ee=>e.jsx("option",{value:Ee.key,disabled:wn.some((Oe,St)=>St!==l&&(Oe==null?void 0:Oe.key)===Ee.key),children:Ee.label},Ee.key))}),e.jsx("input",{style:{...E,margin:0,minWidth:0},value:(r==null?void 0:r.text)??R.text,onChange:Ee=>Fo(l,{text:Ee.target.value}),maxLength:100}),e.jsx("button",{type:"button",onClick:()=>Vi(l),title:"Quitar",style:{...ee,padding:"7px 9px",color:"var(--danger)"},children:"â"})]}),y==="cutoff"&&e.jsxs("p",{style:{fontSize:11.5,color:re?"var(--text-muted)":"#a16207",margin:"7px 2px 0",lineHeight:1.45},children:["Usa ",e.jsx("code",{children:"{hora}"})," para insertar la hora configurada. ",!re&&e.jsx(e.Fragment,{children:"Activa primero la hora de corte real en Impulso; mientras no esté activa, este hecho no se publica."})]})]},l)}),wn.length<2&&e.jsx("button",{type:"button",style:ee,onClick:Vs,children:"+ Agregar hecho"})]}),e.jsx(mt,{children:"La landing solo muestra las dos primeras selecciones. Si desactivas pago contraentrega o la hora de corte real, el hecho incompatible se oculta automáticamente."})]})]}),e.jsx(Ei,{children:"Confianza y cierre"}),e.jsxs(ht,{title:"Reseñas y testimonios",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:p.reviews_off!==!0,onChange:r=>x(l=>({...l,reviews_off:!r.target.checked}))})," Activar"]})}),children:[e.jsx(mt,{children:"Publica únicamente reseñas reales de tus clientes o importadas desde una fuente verificable. Si aún no tienes, deja esta sección desactivada."}),e.jsx(Va,{que:"tus reseñas"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12,opacity:p.reviews_off?.45:1,pointerEvents:p.reviews_off?"none":"auto"},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Calificación real (1-5)"}),e.jsx("input",{style:E,type:"number",min:1,max:5,step:.1,value:Oo.rating??"",onChange:r=>cn({rating:An(r.target.value)}),placeholder:"Calificación real"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Nº real de reseñas"}),e.jsx("input",{style:E,type:"number",value:Oo.count??"",onChange:r=>cn({count:An(r.target.value)}),placeholder:"Cantidad real"})]})]}),e.jsx(Ea,{ai:{field:"TÃtulo de las reseñas",instruction:"Encabezado de la sección de reseñas, máx 45 caracteres. Ej: Lo que dicen quienes lo compraron.",current:Oo.title||"",productName:q.name||"",onPick:r=>cn({title:r})},children:"TÃtulo (opcional)"}),e.jsx("input",{style:E,value:Oo.title||"",onChange:r=>cn({title:r.target.value}),placeholder:"Lo que dicen nuestros clientes"}),e.jsx("label",{style:D,children:"Fuente real de las reseñas (sale junto a las estrellas)"}),e.jsx("input",{style:E,value:Oo.source||"",onChange:r=>cn({source:r.target.value}),placeholder:"Ej: Google o Judge.me, solo si aplica"}),To.map((r,l)=>e.jsxs("div",{style:{border:"1px solid var(--border, #eee)",borderRadius:10,padding:8,marginTop:8,background:"var(--input-bg, #fafbff)"},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{style:{...E,padding:"8px 10px",flex:1,minWidth:0},value:r.name||"",onChange:y=>Ho(l,{name:y.target.value}),placeholder:"Nombre"}),e.jsx("input",{style:{...E,padding:"8px 10px",flex:1,minWidth:0},value:r.city||"",onChange:y=>Ho(l,{city:y.target.value}),placeholder:"Ciudad"}),e.jsx("button",{onClick:()=>Y(l),title:"Quitar",style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]}),e.jsx("textarea",{style:{...E,minWidth:0,minHeight:48,resize:"vertical",marginTop:6},value:r.text||"",onChange:y=>Ho(l,{text:y.target.value}),placeholder:"Pega aquà el texto real de la reseña"}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[e.jsxs("label",{style:{fontSize:12,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5},children:["Estrellas",e.jsxs("select",{style:{...E,padding:"6px",width:"auto"},value:r.stars??"",onChange:y=>Ho(l,{stars:y.target.value?Number(y.target.value):void 0}),children:[e.jsx("option",{value:"",children:"Sin dato"}),[5,4,3,2,1].map(y=>e.jsx("option",{value:y,children:y},y))]})]}),e.jsxs("label",{style:{fontSize:12,color:"var(--text-muted)",display:"flex",alignItems:"center",gap:5},children:[e.jsx("input",{type:"checkbox",checked:r.verified===!0,onChange:y=>Ho(l,{verified:y.target.checked})})," Compra verificada"]}),e.jsx("input",{style:{...E,padding:"6px 8px",width:150,fontSize:12},value:r.date||"",onChange:y=>Ho(l,{date:y.target.value||void 0}),placeholder:"Fecha (si existe)"})]}),e.jsx("div",{style:{marginTop:8},children:e.jsx(Rn,{label:"Foto de la reseña (opcional): sube la foto del cliente o del producto",value:r.
1116image,onChange:y=>Ho(l,{image:y||void 0}),uploadsEnabled:Ia,compact:!0})})]},l)),e.jsx("button",{style:{...ee,marginTop:8},onClick:k,children:"+ Agregar reseña"}),e.jsx(N8,{existentes:To.map(r=>String((r==null?void 0:r.text)||"")),onAgregar:r=>x(l=>({...l,reviews:{...l.reviews||{},items:[...l.reviews&&l.reviews.items||[],...r]}}))})]}),e.jsx(ht,{title:"Antes / Después",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((Se=p.before_after)!=null&&Se.enabled),onChange:r=>Fr({enabled:r.target.checked})})," Activar"]})}),children:((It=p.before_after)==null?void 0:It.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"¿Dónde va en la página?"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Donde está hoy"},{v:"price",l:"Más arriba (junto al precio)"},{v:"ofertas",l:"Con las ofertas"},{v:"cta",l:"Junto al botón"},{v:"end",l:"Más abajo (al final)"}],value:String(((_t=p.sec_pos)==null?void 0:_t.antesdespues)||""),onPick:r=>x(l=>{const y={...l.sec_pos||{}};return r?y.antesdespues=r:delete y.antesdespues,{...l,sec_pos:y}})}),e.jsx(mt,{children:"Si la dejas en «donde está hoy», se queda exactamente como está ahora."}),e.jsx("label",{style:D,children:"Presentación"}),e.jsxs("select",{style:E,value:((Dt=p.before_after)==null?void 0:Dt.mode)||"",onChange:r=>Fr({mode:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Dos fotos lado a lado"}),e.jsx("option",{value:"slider",children:"Deslizador arrastrable (el cliente compara con el dedo)"})]}),e.jsx("label",{style:D,children:"TÃtulo (opcional)"}),e.jsx("input",{style:E,value:((Ce=p.before_after)==null?void 0:Ce.title)||"",onChange:r=>Fr({title:r.target.value}),placeholder:"El resultado habla solo"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:'Foto "Antes"'}),e.jsx(Rn,{label:"Antes",value:(Kt=p.before_after)==null?void 0:Kt.before,onChange:r=>Fr({before:r}),uploadsEnabled:Ia,compact:!0}),e.jsx("input",{style:{...E,marginTop:6,padding:"7px 10px",fontSize:12.5},value:((pa=p.before_after)==null?void 0:pa.before_label)||"",onChange:r=>Fr({before_label:r.target.value}),placeholder:"Antes"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:'Foto "Después"'}),e.jsx(Rn,{label:"Después",value:(_a=p.before_after)==null?void 0:_a.after,onChange:r=>Fr({after:r}),uploadsEnabled:Ia,compact:!0}),e.jsx("input",{style:{...E,marginTop:6,padding:"7px 10px",fontSize:12.5},value:((tn=p.before_after)==null?void 0:tn.after_label)||"",onChange:r=>Fr({after_label:r.target.value}),placeholder:"Después"})]})]})]})}),e.jsx(ht,{title:"Preguntas frecuentes (FAQ)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:Or,onChange:r=>Nc(r.target.checked)})," Activar"]})}),children:Or&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"6px 0 8px"},children:"Responde dudas comunes (entrega, pago al recibir, tallas). Sube confianza y baja objeciones. Ya viene armada con 7 preguntas."}),e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((an=p.faq)==null?void 0:an.title)??"Preguntas frecuentes",onChange:r=>tl({title:r.target.value}),placeholder:"Preguntas frecuentes"}),Go.map((r,l)=>e.jsxs("div",{style:{border:"1px solid var(--border, #eee)",borderRadius:10,padding:8,marginTop:8,background:"var(--input-bg, #fafbff)"},children:[e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0,padding:"8px 10px",fontWeight:700},value:r.q||"",onChange:y=>Hr(l,{q:y.target.value}),placeholder:"¿Cuándo llega mi pedido?"}),e.jsx(So,{field:"Pregunta frecuente",instruction:"Pregunta frecuente real de quien compra contraentrega (entrega, pago al recibir, tallas, garantÃa), máximo 60 caracteres",current:r.q||"",productName:q.name||"",onPick:y=>Hr(l,{q:y})}),e.jsx("button",{onClick:()=>Rc(l),title:"Quitar",style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start",marginTop:6},children:[e.jsx("textarea",{style:{...E,flex:1,minWidth:0,minHeight:48,resize:"vertical"},value:r.a||"",onChange:y=>Hr(l,{a:y.target.value}),placeholder:"Llega en 2 a 5 dÃas hábiles y pagas al recibir."}),e.jsx(So,{field:"Respuesta de la pregunta",instruction:"Respuesta corta y tranquilizadora a esa pregunta, refuerza el pago al recibir, máximo 160 caracteres",current:r.a||"",productName:q.name||"",context:r.q||"",onPick:y=>Hr(l,{a:y})})]})]},l)),e.jsx("button",{style:{...ee,marginTop:8},onClick:ld,children:"+ Agregar pregunta"})]})}),e.jsxs(ht,{title:"Sellos encima del precio",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:p.badges_off!==!0,onChange:r=>x(l=>({...l,badges_off:!r.target.checked}))})," Mostrar"]})}),children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"Van encima del precio, en una sola lÃnea. Ya vienen incluidos. EdÃtalos o quÃtalos."}),Mr.map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginBottom:6},children:[e.jsx("input",{style:{...E,width:56,textAlign:"center",padding:"8px 6px"}
1116,value:r.icon||"",onChange:y=>Ar(l,{icon:y.target.value}),placeholder:"â"}),e.jsx("input",{style:{...E,flex:1,minWidth:0,padding:"8px 10px"},value:r.text||"",onChange:y=>Ar(l,{text:y.target.value}),placeholder:"EnvÃo gratis"}),e.jsx(So,{field:"Sello de confianza",instruction:"Beneficio corto que da confianza para comprar contraentrega, 2 a 4 palabras, sin emojis",current:r.text||"",productName:q.name||"",onPick:y=>Ar(l,{text:y})}),e.jsx("button",{onClick:()=>ms(l),title:"Quitar",style:{...ee,padding:"6px 9px",color:"var(--danger)"},children:"â"})]},l)),e.jsx("div",{style:{display:"flex",gap:8,marginTop:4,flexWrap:"wrap"},children:e.jsx("button",{style:ee,onClick:gs,children:"+ Agregar sello"})})]}),e.jsxs(ht,{title:pt?"GarantÃa de satisfacción":"GarantÃa",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:p.guarantee_off!==!0,onChange:r=>x(l=>{const y=l,R=y.delivery_off===void 0?y.guarantee_off!==!0:y.delivery_off!==!0,P=y.guar_seals_off===void 0?y.guarantee_off!==!0:y.guar_seals_off!==!0;return{...y,guarantee_off:!r.target.checked,delivery_off:!R,guar_seals_off:!P}})})," Mostrar"]})}),children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:"Aparecen debajo del botón de pedir. Ya vienen armadas. EdÃtalas o vacÃalas para ocultar."}),e.jsx(Ea,{ai:{field:"TÃtulo de la garantÃa",instruction:"TÃtulo corto (máx 40 caracteres) que da seguridad con el pago contraentrega. Ej: Compra 100% segura, GarantÃa sin riesgos.",current:Ke.title||"",productName:q.name||"",onPick:r=>ea({title:r})},children:"TÃtulo de la garantÃa"}),e.jsx("input",{style:E,value:Ke.title||"",onChange:r=>ea({title:r.target.value}),placeholder:"Compra 100% segura"}),e.jsx(Ea,{ai:{field:"Texto de la garantÃa",instruction:"1 o 2 frases (máx 120 caracteres) que tranquilizan: recibe primero, revisa y paga en efectivo al recibir, sin adelantos.",current:Ke.text||"",productName:q.name||"",onPick:r=>ea({text:r})},children:"Texto de la garantÃa"}),e.jsx("textarea",{style:{...E,minHeight:56,resize:"vertical"},value:Ke.text||"",onChange:r=>ea({text:r.target.value}),placeholder:"Pagas al recibir en la puerta de tu casaâ¦"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginTop:4},children:[e.jsx("label",{style:D,children:"Pastillas dentro de esta tarjeta (3 â vacÃa para quitar)"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12.5,cursor:"pointer",whiteSpace:"nowrap"},children:[e.jsx("input",{type:"checkbox",checked:p.guar_seals_off===void 0?p.guarantee_off!==!0:p.guar_seals_off!==!0,onChange:r=>x(l=>({...l,guar_seals_off:!r.target.checked}))})," Mostrar"]})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 6px"},children:"Si apagas la GarantÃa pero dejas esto encendido, las pastillas salen solas en su propia tarjeta."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:8},children:[0,1,2].map(r=>e.jsx("input",{style:E,value:et[r]||"",onChange:l=>Aa(r,l.target.value),placeholder:Eo[r]},r))})]}),!pt&&e.jsxs(ht,{title:"Asà llega tu pedido",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:Xt,onChange:r=>x(l=>({...l,delivery_off:!r.target.checked}))})," Mostrar"]})}),children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:"Los pasos del envÃo, debajo de la garantÃa. Ya vienen armados. EdÃtalos o vacÃalos para ocultar."}),e.jsx("label",{style:D,children:"LÃnea pequeña sobre la entrega"}),e.jsx("input",{style:E,value:p.delivery_kicker??"Seguimiento de tu pedido",onChange:r=>x(l=>({...l,delivery_kicker:r.target.value})),placeholder:"Seguimiento de tu pedido"}),e.jsx(Ea,{ai:{field:"TÃtulo de la sección de envÃo",instruction:"TÃtulo de sección corto (máx 40 caracteres) sobre cómo llega el pedido. Ej: Asà llega tu pedido.",current:p.delivery_title||"",productName:q.name||"",onPick:r=>x(l=>({...l,delivery_title:r}))},children:"TÃtulo de la lÃnea de entrega"}),e.jsx("input",{style:E,value:p.delivery_title??"Asà llega tu pedido",onChange:r=>x(l=>({...l,delivery_title:r.target.value})),placeholder:"Asà llega tu pedido"}),ft.map((r,l)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Paso ",l+1]}),e.jsx("input",{style:E,value:r.label||"",onChange:y=>Ys(l,{label:y.target.value}),placeholder:"Pedido"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Detalle"}),e.jsx("input",{style:E,value:r.sub||"",onChange:y=>Ys(l,{sub:y.target.value}),placeholder:"Mismo dÃa"})]})]},l)),ft.length<4&&e.jsx("button",{type:"button",onClick:()=>x(r=>{const l=r.delivery_steps===void 0?vu:r.delivery_steps||[];return{...r,delivery_steps:[...l,{label:"Entregado",sub:"En tu puerta"}]}}),style:{...E,cursor:"pointer",fontWeight:700,textAlign:"center",background:"transparent",border:"1px dashed var(--border, #d7dce6)",color:"var(--text-secondary, #475569)",marginTop:8},children:"+ Agregar un cuarto paso"}),ft.length>1&&e.jsx("button",{type:"button",onClick:()=>x(r=>{const l=r.delivery_steps===void 0?vu:r.delivery_steps||[];return{...r,delivery_steps:l.slice(0,-1)}}),style:{...E,cursor:"pointer",fontWeight:600,textAlign:"center",background:"transparent",border:"none",color:"var(--text-muted)",fontSize:12.5,marginTop:2}
1116,children:"Quitar el último paso"})]})]}),Oa==="formulario"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Formulario y pedido"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"Lo que el cliente llena para comprarte y lo que pasa después: campos, textos del botón, envÃo y extras del pedido."})]}),!ke&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Bloquear pedidos repetidos",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:((vo=p.anti_duplicate)==null?void 0:vo.enabled)===!0,onChange:r=>x(l=>({...l,anti_duplicate:{...l.anti_duplicate,enabled:r.target.checked}}))})," Activo"]})}),children:[e.jsx(mt,{children:"Si el mismo teléfono vuelve a pedir en esta landing dentro de la ventana, no se duplica en el CRM (el cliente igual ve su confirmación)."}),e.jsx("label",{style:D,children:"Ventana (horas)"}),e.jsx("input",{style:{...E,maxWidth:140},type:"number",min:1,max:720,value:((so=p.anti_duplicate)==null?void 0:so.hours)??"",onChange:r=>x(l=>({...l,anti_duplicate:{...l.anti_duplicate,hours:An(r.target.value)}})),placeholder:"24"})]})}),!ke&&e.jsx(ev,{cfg:p,setCfg:x,moneda:br(Ro).currency,conectadas:o}),e.jsxs(ht,{title:"Botón de WhatsApp",children:[e.jsx(mt,{children:ke?"Es el botón principal de esta página: todo lleva al chat. El mensaje incluye el código del clic de TikTok (ttclid) para medir la venta real.":"Dos formas de cerrar por chat (se suman al formulario, no lo reemplazan). Ambas llevan el código de TikTok (ttclid) para medir la venta."}),!ke&&e.jsxs("div",{style:{display:"grid",gap:8,marginBottom:($i=p.whatsapp)!=null&&$i.enabled||(wl=p.whatsapp)!=null&&wl.form_order?14:0},children:[e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,cursor:"pointer",padding:"10px 12px",border:"1px solid var(--border, #e6e8ee)",borderRadius:12,background:(_e=p.whatsapp)!=null&&_e.enabled?"rgba(37,211,102,.06)":"transparent"},children:[e.jsx("input",{type:"checkbox",style:{marginTop:2},checked:!!((ua=p.whatsapp)!=null&&ua.enabled),onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,enabled:r.target.checked}}))}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:700,display:"block"},children:"Botón flotante en la página"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"El botón verde que sigue al cliente mientras navega."})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,cursor:"pointer",padding:"10px 12px",border:"1px solid var(--border, #e6e8ee)",borderRadius:12,background:(Mt=p.whatsapp)!=null&&Mt.form_order?"rgba(37,211,102,.06)":"transparent"},children:[e.jsx("input",{type:"checkbox",style:{marginTop:2},checked:!!((Tn=p.whatsapp)!=null&&Tn.form_order),onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_order:r.target.checked}}))}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:700,display:"block"},children:'"Pedir por WhatsApp" en el formulario'}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Botón al final del form: arma el pedido con los datos del cliente y te lo manda al chat."})]})]})]}),(ke||((es=p.whatsapp)==null?void 0:es.enabled)||((ym=p.whatsapp)==null?void 0:ym.form_order))&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Número de WhatsApp (con indicativo, solo números)"}),e.jsx("input",{style:E,value:((vm=p.whatsapp)==null?void 0:vm.number)||"",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,number:r.target.value.replace(/[^\d]/g,"")}})),placeholder:`${((jm=rn[String(p.country||"CO").toUpperCase()])==null?void 0:jm.phoneCc)||"57"}3001234567`,inputMode:"numeric"}),e.jsx(PA,{activo:((Am=p.whatsapp)==null?void 0:Am.agente)===!0,numero:String(((Sm=p.whatsapp)==null?void 0:Sm.number)||""),disenos:[...(p.content_blocks||[]).filter(r=>(r==null?void 0:r.type)==="codigo"&&String(r.html||"").trim()).map(r=>String(r.html||"")),...p.hero_style==="libre"&&String(p.hero_libre_html||"").trim()?[String(p.hero_libre_html)]:[]],onActivo:r=>x(l=>({...l,whatsapp:{...l.whatsapp,agente:r||void 0}})),onNumero:r=>x(l=>({...l,whatsapp:{...l.whatsapp,number:r}}))}),(ke||((wm=p.whatsapp)==null?void 0:wm.enabled))&&e.jsxs(e.Fragment,{children:[e.jsx(Ea,{ai:{field:"texto del botón de WhatsApp",instruction:'Texto corto y vendedor para un botón que abre WhatsApp. Máximo 4 palabras. Ej: "PÃdelo por WhatsApp", "EscrÃbeme ahora".',current:((km=p.whatsapp)==null?void 0:km.label)??"",productName:((Cm=p.product)==null?void 0:Cm.name)||"",onPick:r=>x(l=>({...l,whatsapp:{...l.whatsapp,label:r}}))},children:"Texto del botón flotante"}),e.jsx("input",{style:E,value:((_m=p.whatsapp)==null?void 0:_m.label)??"PÃdelo por WhatsApp",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,label:r.target.value}})),placeholder:"PÃdelo por WhatsApp"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0"},children:ke?"Es el texto del botón principal de esta página. Si lo de
1116jas vacÃo, el botón queda sin palabras.":"Déjalo vacÃo para mostrar solo el Ãcono (botón redondo, como antes)."}),e.jsx(Ea,{ai:{field:"mensaje de WhatsApp",instruction:"Mensaje corto y amable que el COMPRADOR envÃa por WhatsApp para pedir el producto con pago contraentrega. En primera persona, natural, máximo 2 frases.",current:(($m=p.whatsapp)==null?void 0:$m.message)||"",productName:((Im=p.product)==null?void 0:Im.name)||"",context:String(((Tm=p.product)==null?void 0:Tm.description)||""),onPick:r=>x(l=>({...l,whatsapp:{...l.whatsapp,message:r}}))},children:"Mensaje pre-escrito (botón flotante)"}),e.jsx("textarea",{style:{...E,minHeight:56,resize:"vertical"},value:((Em=p.whatsapp)==null?void 0:Em.message)||"",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,message:r.target.value}})),placeholder:"Hola, quiero pedir este producto (pago contraentrega)."}),!ke&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginTop:10},children:[e.jsx("input",{type:"checkbox",checked:!!((zm=p.whatsapp)!=null&&zm.hero_button),onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,hero_button:r.target.checked||void 0}}))})," Botón de WhatsApp ",e.jsx("b",{children:"al lado"})," del de comprar"]}),e.jsx(mt,{children:"Los dos juntos, como en las tiendas de tenis. Ojo: le parte la atención al comprador justo cuando iba a pedir, y el que se va a WhatsApp muchas veces no vuelve. Ãsalo si de verdad cierras por ahÃ. Al prenderlo se apaga el botón flotante, para no tener dos WhatsApp en la misma pantalla."}),!!((Rm=p.whatsapp)!=null&&Rm.hero_button)&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:{...D,marginTop:8},children:"Texto de ese botón"}),e.jsx("input",{style:E,maxLength:22,placeholder:"WhatsApp",value:((Nm=p.whatsapp)==null?void 0:Nm.hero_button_label)||"",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,hero_button_label:r.target.value||void 0}}))}),e.jsx(mt,{children:"Corto: cabe al lado del otro. VacÃo dice «WhatsApp»."})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginTop:10},children:[e.jsx("input",{type:"checkbox",checked:!!((Lm=p.whatsapp)!=null&&Lm.float_online),onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,float_online:r.target.checked||void 0}}))}),' Punto verde "en lÃnea" sobre el botón']}),e.jsx(mt,{children:"Un punto verde que late sobre el botón flotante: transmite que hay alguien atendiendo ahora."}),e.jsx("label",{style:{...D,marginTop:8},children:"Burbuja de invitación (aparece a los 30 segundos)"}),e.jsx("input",{style:E,maxLength:80,value:((Pm=p.whatsapp)==null?void 0:Pm.float_invite)||"",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,float_invite:r.target.value||void 0}})),placeholder:"¿Tienes dudas? EscrÃbenos, respondemos ya"}),e.jsx(mt,{children:"Sale una sola vez por visita junto al botón flotante y se puede cerrar. VacÃa, no aparece."})]}),ke&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"TÃtulo de la hoja de pedido"}),e.jsx("input",{style:E,value:((Dm=p.wa_sheet)==null?void 0:Dm.title)||"",onChange:r=>x(l=>({...l,wa_sheet:{...l.wa_sheet||{},title:r.target.value}})),placeholder:"Completa tu pedido"}),e.jsx(mt,{children:"Es el tÃtulo de la hoja que se abre al pulsar el botón (donde el cliente escoge color, talla y combo)."})]})]}),((Bm=p.whatsapp)==null?void 0:Bm.form_order)&&!ke&&e.jsxs(e.Fragment,{children:[e.jsx(Ea,{ai:{field:"Botón de pedir por WhatsApp",instruction:"Texto corto para el botón alternativo de pedir por WhatsApp al final del formulario, máximo 30 caracteres. Ej: Prefiero pedir por WhatsApp",current:((Wm=p.whatsapp)==null?void 0:Wm.form_label)??"",productName:((qm=p.product)==null?void 0:qm.name)||"",onPick:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_label:r}}))},children:"Texto del botón en el formulario"}),e.jsx("input",{style:E,value:((Mm=p.whatsapp)==null?void 0:Mm.form_label)??"Prefiero pedir por WhatsApp",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_label:r.target.value}})),placeholder:"Prefiero pedir por WhatsApp"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,marginTop:8},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Estilo del botón"}),e.jsxs("select",{style:E,value:((Fm=p.whatsapp)==null?void 0:Fm.form_style)||"contorno",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_style:r.target.value==="contorno"?void 0:r.target.value}})),children:[e.jsx("option",{value:"contorno",children:"Contorno verde (clásico)"}),e.jsx("option",{value:"relleno",children:"Relleno verde"}),e.jsx("option",{value:"tema",children:"Del color de tu tema"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tamaño de letra"}),e.jsxs("select",{style:E,value:((Om=p.whatsapp)==null?void 0:Om.form_size)||"normal",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_size:r.target.value==="normal"?void 0:r.target.value}})),children:[e.jsx("option",{value:"chica",children:"Chica"}),e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"grande",children:"Grande"})]})]})]}),e.jsx("label",{style:{...D,marginTop:8},children:"Texto debajo del botón"}),e.jsx("input",{style:E,maxLength:90,value:((Hm=p.whatsapp)==null?void 0:Hm.form_sub)??"Te atendemos y confirmamos tu pedido por chat",onChange:r=>x(l=>({...l,whatsapp:{...l.whatsapp,form_sub:r.target.value}})),placeholder:"Déjalo vacÃo para ocultarlo"}),e.jsx(mt,{children:"El mensaje se arma solo con lo que el cliente escriba (producto, cantidad, nombre, teléfono, dirección, total)."})]})]})]}),!ke&&e.jsxs(e.Fragment,{children:[!pt&&e.jsx(aj,{value:p.shipping,onChange:r=>x(l=>({...l,shipping:r}
1116)),country:rr}),!pt&&e.jsx(w8,{country:rr,excluded:p.geo_excluded||[],excludedL2:p.geo_excluded_l2||[],onChange:r=>x(l=>({...l,geo_excluded:r})),onChangeL2:r=>x(l=>({...l,geo_excluded_l2:r}))}),e.jsxs(ht,{title:"Formulario",children:[pt?e.jsxs(mt,{children:["Define qué pide tu formulario. Un servicio no pide dirección de envÃo: con ",e.jsx("b",{children:"nombre y WhatsApp"})," basta para responderle."]}):e.jsxs(mt,{children:["Define qué pide tu formulario. Los campos ",e.jsx("b",{children:"nombre, teléfono, dirección, departamento y ciudad"})," son los que Dropi necesita si luego activas el envÃo automático."]}),e.jsx(ej,{natLen:br(qo).natLen,fields:Oi,onChange:Hs,onRestore:Wa,uploadsEnabled:Ia,productName:q.name||""}),rr!=="CO"&&e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,cursor:"pointer",marginTop:10,padding:"11px 13px",border:"1px solid var(--border)",borderRadius:12},children:[e.jsx("input",{type:"checkbox",style:{marginTop:2,width:16,height:16,flexShrink:0},checked:!((Gm=p.form)!=null&&Gm.no_document),onChange:r=>x(l=>({...l,form:{...l.form,no_document:!r.target.checked}}))}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:700,display:"block"},children:"Pedir documento (DNI / CE) en el formulario"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Fuera de Colombia se pide para la boleta. Desmárcalo para quitarlo del formulario."})]})]})}),te?e.jsxs(mt,{children:["En la landing simple el formulario siempre se abre en ",e.jsx("b",{children:"popup"})," centrado, sobre la pila de imágenes."]}):e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,cursor:"pointer",marginTop:10,padding:"11px 13px",border:"1px solid var(--border)",borderRadius:12},children:[e.jsx("input",{type:"checkbox",style:{marginTop:2,width:16,height:16,flexShrink:0},checked:((Vm=p.form)==null?void 0:Vm.layout)!=="embedded",onChange:r=>x(l=>({...l,form:{...l.form,layout:r.target.checked?"popup":"embedded"}}))}),e.jsxs("span",{children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:700,display:"block"},children:"Abrir el formulario en popup centrado"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Es lo recomendado: convierte mejor. Desmárcalo para mostrarlo fijo dentro de la página."})]})]})]}),e.jsxs(ht,{title:"Textos y botones del formulario",children:[e.jsx(Ea,{ai:{field:"TÃtulo de la sección del formulario",instruction:"Encabezado corto que invita a llenar el formulario para pedir contraentrega, máximo 35 caracteres. Ej: Completa tus datos y paga al recibir",current:((Um=p.form)==null?void 0:Um.section_title)??"",productName:q.name||"",onPick:r=>x(l=>({...l,form:{...l.form,section_title:r}}))},children:"Banner de sección principal (déjalo vacÃo para ocultarlo)"}),e.jsx("input",{style:E,value:((Qm=p.form)==null?void 0:Qm.section_title)??"Completa tus datos",onChange:r=>x(l=>({...l,form:{...l.form,section_title:r.target.value}})),placeholder:"Completa tus datos"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",marginTop:8,fontSize:13},children:[e.jsx("input",{type:"checkbox",checked:((Km=p.form)==null?void 0:Km.head_align)==="center",onChange:r=>x(l=>({...l,form:{...l.form,head_align:r.target.checked?"center":"left"}}))})," Centrar los tÃtulos del formulario"]}),e.jsx(Ea,{ai:{field:"Texto del botón de envÃo",instruction:"Botón final de pedido, claro y de baja fricción, máx 38 caracteres, refuerza el pago al recibir. Ej: Confirmar pedido contraentrega.",current:((Ym=p.form)==null?void 0:Ym.submit_text)||"",productName:q.name||"",onPick:r=>x(l=>({...l,form:{...l.form,submit_text:r}}))},children:"Texto del botón de envÃo"}),e.jsx("input",{style:E,value:((Jm=p.form)==null?void 0:Jm.submit_text)||"",onChange:r=>x(l=>({...l,form:{...l.form,submit_text:r.target.value}})),placeholder:"Confirmar pedido contraentrega"}),e.jsx(Ea,{ai:{field:"Texto pequeño dentro del botón",instruction:"Refuerzo de 3 a 6 palabras bajo el texto del botón, separadas con punto medio (·), sobre envÃo y pago al recibir. Sin emojis. Ej: EnvÃo gratis · Pagas al recibir",current:((Zm=p.form)==null?void 0:Zm.button_sub)??"",productName:q.name||"",onPick:r=>x(l=>({...l,form:{...l.form,button_sub:r}}))},children:"Texto pequeño dentro del botón (vacÃo lo oculta)"}),e.jsx("input",{style:E,value:((Xm=p.form)==null?void 0:Xm.button_sub)??
1116(pt?"Sin compromiso · Te respondemos por WhatsApp":"EnvÃo gratis · Pagas al recibir"),onChange:r=>x(l=>({...l,form:{...l.form,button_sub:r.target.value}})),placeholder:"EnvÃo gratis · Pagas al recibir"}),(()=>{const r=Vb(p.form,{pagoEnLinea:!1,servicio:pt}),l=(P,re)=>{const xe=(Array.isArray(P==null?void 0:P.consents)?P.consents:[]).find(Le=>Le&&Le.key===re);return xe?xe.text:re==="datos"?P==null?void 0:P.confirm_text:void 0},y=P=>x(re=>{const xe=Vb(re.form,{pagoEnLinea:!1,servicio:pt}).map(Ee=>{const Oe=l(re.form,Ee.key);return{key:Ee.key,on:Ee.on,...Oe!==void 0?{text:Oe}:{},...Ee.key==="datos"?{required:Ee.obligatoria}:{}}}),Le=P(xe);return{...re,form:{...re.form,consents:Le,confirm_check:Le.some(Ee=>Ee.on)}}}),R={datos:k2(!1),voz:S2,mkt:w2};return e.jsxs("div",{style:{marginTop:12},children:[e.jsx("label",{style:D,children:"Casillas antes del botón de pedir"}),r.map((P,re)=>{const xe=l(p.form,P.key)??"",Le=xe.trim()?P.key==="voz"?C2(xe):P.key==="mkt"?_2(xe):[]:[],Ee=St=>y(rt=>{const Ft=re+St;if(Ft<0||Ft>=rt.length)return rt;const Tt=[...rt];return[Tt[re],Tt[Ft]]=[Tt[Ft],Tt[re]],Tt}),Oe=(St,rt)=>e.jsx("button",{type:"button",onClick:()=>Ee(St),disabled:rt,title:St<0?"Subir":"Bajar",style:{width:22,height:17,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border, #e5e7eb)",borderRadius:6,background:"var(--card-bg, #fff)",color:rt?"var(--text-muted, #cbd2dd)":"var(--text-secondary, #64748b)",cursor:rt?"default":"pointer",padding:0},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:St<0?"M18 15l-6-6-6 6":"M6 9l6 6 6-6"})})});return e.jsxs("div",{style:{border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:10,marginBottom:8,background:"var(--input-bg, #fafbff)",opacity:P.on?1:.7},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:2,flex:"none"},children:[Oe(-1,re===0),Oe(1,re===r.length-1)]}),e.jsx("span",{style:{flex:1,minWidth:120,fontSize:13,fontWeight:700},children:Hk[P.key]}),P.key==="datos"&&P.on&&e.jsx("span",{style:{fontSize:11,fontWeight:700,color:"var(--text-muted)",border:"1px solid var(--border, #e5e7eb)",borderRadius:999,padding:"2px 8px"},children:"Obligatoria"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:P.on,onChange:St=>y(rt=>rt.map(Ft=>Ft.key===P.key?{...Ft,on:St.target.checked}:Ft))})," Mostrar"]})]}),P.on&&e.jsx("textarea",{style:{...E,marginTop:8,minHeight:48,resize:"vertical",fontSize:12.5},maxLength:P.key==="datos"?160:300,value:xe,placeholder:R[P.key],onChange:St=>{const rt=St.target.value;y(Ft=>Ft.map(Tt=>Tt.key===P.key?{...Tt,text:rt}:Tt))}}),P.on&&Le.length>0&&e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"4px 2px 0"},children:["Tiene que decir ",Le.join(", "),". Mientras no lo diga, sale el texto de siempre."]})]},P.key)}),e.jsxs(mt,{children:["A la casilla de datos se le añade siempre ",e.jsx("b",{children:"«Autorizo el tratamiento de mis datos según la polÃtica de privacidad.»"})," Por eso, si la muestras, es obligatoria. La de llamada y la de WhatsApp nunca son obligatorias, porque un permiso exigido para comprar no vale ante la SIC, y su texto se guarda como prueba de lo que aceptó el comprador. Si apagas la de llamada no se le podrá llamar; si apagas la de WhatsApp, Crecimiento no podrá escribirle. VacÃo = el texto de siempre."]})]})})()]})]}),!pt&&e.jsx(ht,{title:"Order bump (envÃo express)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:at,onChange:r=>dt(r.target.checked)})," Activar"]})}),children:at&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:"Una casilla para sumar una oferta antes de pedir. Aparece en el formulario y, en las landings de WhatsApp, dentro de la hoja de pedido (se suma al total y va en el mensaje del chat)."}),e.jsx(Ol,{mechanic:"order_bump",product:p.product,bullets:(eh=p.product)==null?void 0:eh.bullets,onApply:r=>Wn(r)}),e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((th=p.order_bump)==null?void 0:th.label)||"",onChange:r=>Wn({label:r.target.value}),placeholder:"Agrega protección extra"}),e.jsx("label",{style:D,children:"Texto"}),e.jsx("input",{style:E,value:((ah=p.order_bump)==null?void 0:ah.text)||"",onChange:r=>Wn({text:r.target.value}),placeholder:"GarantÃa de 1 año por soloâ¦"}
1116),e.jsxs("label",{style:D,children:["Precio extra (",vr,")"]}),e.jsx("input",{style:{...E,maxWidth:180},type:"number",value:((nh=p.order_bump)==null?void 0:nh.price)??"",onChange:r=>Wn({price:An(r.target.value)}),placeholder:"4000"}),e.jsx(mt,{children:"Este valor se suma al cobro contraentrega de la misma guÃa en Dropi. No es otro producto."}),!(Number((oh=p.order_bump)==null?void 0:oh.price)>0)&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,marginTop:8,padding:"9px 11px",background:"var(--notice-danger-bg, #FEF2F2)",border:"1px solid var(--notice-danger-border, #FECACA)",borderRadius:9,fontSize:12.5,color:"var(--danger, #991B1B)"},children:[e.jsx("span",{style:{fontWeight:800,flex:"none"},children:"!"}),e.jsxs("span",{children:[e.jsx("b",{children:"Sin precio no le cobras nada al cliente."})," El extra se le va a mostrar y lo va a poder marcar, pero el transportador no le cobrará ni un peso de más. Ponle el valor y vuelve a publicar."]})]}),e.jsx("label",{style:D,children:"Imagen (opcional, sale a la derecha)"}),e.jsx(Rn,{label:"Imagen del extra",value:(rh=p.order_bump)==null?void 0:rh.image,onChange:r=>Wn({image:r||void 0}),uploadsEnabled:Ia,compact:!0}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:10},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fondo"}),e.jsx("input",{type:"color",value:((ih=p.order_bump)==null?void 0:ih.bg_color)||"#fdfaf0",onChange:r=>Wn({bg_color:r.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Borde"}),e.jsx("input",{type:"color",value:((sh=p.order_bump)==null?void 0:sh.border_color)||((lh=p.theme)==null?void 0:lh.accent)||me,onChange:r=>Wn({border_color:r.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto"}),e.jsx("input",{type:"color",value:((dh=p.order_bump)==null?void 0:dh.text_color)||"#1a1a2e",onChange:r=>Wn({text_color:r.target.value}),style:{width:"100%",height:36,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]}),e.jsxs("div",{style:{display:"flex",gap:16,marginTop:10,flexWrap:"wrap"},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((ch=p.order_bump)!=null&&ch.preselected),onChange:r=>Wn({preselected:r.target.checked})})," Preseleccionado"]}),e.jsx("span",{style:{display:"none"}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:((uh=p.order_bump)==null?void 0:uh.text_align)==="center",onChange:r=>Wn({text_align:r.target.checked?"center":"left"})})," Texto centrado"]})]}),!ke&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Efecto"}),e.jsx(jn,{small:!0,options:[{v:"borde",l:"Borde vivo"},{v:"aurora",l:"Aurora"},{v:"destello",l:"Destello"},{v:"latido",l:"Latido"},{v:"entrada",l:"Entrada"},{v:"marco",l:"Marco de recorte"},{v:"flecha",l:"Señal que apunta"},{v:"ninguno",l:"Ninguno"}],value:((ph=p.order_bump)==null?void 0:ph.fx)||(((gh=p.order_bump)==null?void 0:gh.animated)===!1?"ninguno":"borde"),onPick:r=>Wn({fx:r,animated:r!=="ninguno"})}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,margin:"9px 2px 0",cursor:"pointer",color:"var(--text-secondary,#475569)"},children:[e.jsx("input",{type:"checkbox",checked:((mh=p.order_bump)==null?void 0:mh.reward)===!0,onChange:r=>Wn({reward:r.target.checked})})," Premio al marcar (se combina con el efecto de arriba)"]}),((hh=p.order_bump)==null?void 0:hh.reward)===!0&&e.jsx("input",{style:{...E,marginTop:7},maxLength:60,value:((fh=p.order_bump)==null?void 0:fh.reward_text)||"",onChange:r=>Wn({reward_text:r.target.value}),placeholder:"Listo, queda incluido en tu pedido"}),e.jsx(mt,{children:"Todos se apagan solos en los teléfonos que piden menos movimiento, y ninguno mueve nada de sitio: no te empujan el botón de compra fuera de la pantalla."})]}),e.jsxs("label",{style:D,children:["Tamaño del texto: ",((xh=p.order_bump)==null?void 0:xh.text_px)??14,"px"]}),e.jsx("input",{type:"range",min:10,max:20,value:((bh=p.order_bump)==null?void 0:bh.text_px)??14,onChange:r=>Wn({text_px:Number(r.target.value)}),style:{width:"100%",accentColor:me}})]})}),e.jsxs(ht,{title:"Botón de compra",children:[e.jsx(Va,{que:"tu botón"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:ke?"El botón que abre el chat. Su color es el verde de WhatsApp y no se cambia, pero la forma, el tamaño y la animación sÃ.":"El mismo botón del formulario. También lo encuentras tocándolo en la vista previa."}),e.jsx(Ea,{ai:{field:"Texto del botón de compra",instruction:'Texto corto del botón de COMPRA que el cliente toca para pedir. Baja fricción y deseo en primera persona. PROHIBIDO el genérico "Pedir ah
1116ora". Ej: Lo quiero, Quiero el mÃo, PÃdelo ahora, Sà lo quiero. Máximo 24 caracteres, sin emoji.',current:((yh=p.form)==null?void 0:yh.cta_text)||"",productName:((vh=p.product)==null?void 0:vh.name)||"",onPick:r=>x(l=>({...l,form:{...l.form,cta_text:r}}))},children:"Texto del botón"}),e.jsx("input",{style:E,value:((jh=p.form)==null?void 0:jh.cta_text)||"",onChange:r=>x(l=>({...l,form:{...l.form,cta_text:r.target.value}})),placeholder:"Pedir ahora",maxLength:40}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12,marginTop:10},children:[!ke&&e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color del botón"}),e.jsx("input",{type:"color",value:((Ah=p.theme)==null?void 0:Ah.button_color)||((Sh=p.theme)==null?void 0:Sh.accent)||me,onChange:r=>Pt({button_color:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color del texto"}),e.jsx("input",{type:"color",value:((wh=p.theme)==null?void 0:wh.button_text_color)||"#ffffff",onChange:r=>Pt({button_text_color:r.target.value,button_text_manual:!0}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}}),(kh=p.theme)!=null&&kh.button_text_manual?e.jsx("button",{type:"button",onClick:()=>Pt({button_text_color:"",button_text_manual:!1}),style:{...ee,fontSize:11,padding:"4px 8px",marginTop:4},children:"Volver a automático"}):null]})]}),e.jsxs("label",{style:D,children:["Redondez: ",((Ch=p.theme)==null?void 0:Ch.button_radius)??13,"px"]}),e.jsx("input",{type:"range",min:0,max:40,value:((_h=p.theme)==null?void 0:_h.button_radius)??13,onChange:r=>Pt({button_radius:Number(r.target.value)}),style:{width:"100%",accentColor:me}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tamaño"}),e.jsx("select",{style:E,value:(($h=p.theme)==null?void 0:$h.button_size)||"m",onChange:r=>Pt({button_size:r.target.value}),children:CC.map(r=>e.jsx("option",{value:r.v,children:r.l},r.v))})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Animación"}),e.jsxs("select",{style:E,value:((Ih=p.theme)==null?void 0:Ih.button_animation)||"shine",onChange:r=>Pt({button_animation:r.target.value}),children:[e.jsx("option",{value:"shine",children:"Brillo"}),e.jsx("option",{value:"pulse",children:"Pulso"}),e.jsx("option",{value:"none",children:"Ninguna"})]})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,marginTop:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:((Th=p.theme)==null?void 0:Th.animations)!==!1,onChange:r=>Pt({animations:r.target.checked}),style:{marginTop:2}}),e.jsxs("span",{style:{fontSize:12.5,lineHeight:1.45},children:["Animaciones al hacer scroll ",e.jsx("span",{style:{color:"var(--text-muted)"},children:"â las secciones (reseñas, garantÃa, imágenes, videoâ¦) aparecen suave conforme el cliente baja. Se ve premium. Respeta a quien pidió menos movimiento."})]})]})]}),!ke&&e.jsx(e.Fragment,{children:!pt&&e.jsxs(ht,{title:"Cámara del recibo, sellos y nota de pago",children:[rr==="CO"&&Oi.some(r=>r.key==="address")&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:4},children:[e.jsx("input",{type:"checkbox",checked:((Eh=p.form)==null?void 0:Eh.hide_vivienda)!==!0,onChange:r=>x(l=>({...l,form:{...l.form,hide_vivienda:r.target.checked?void 0:!0}}))}),' Mostrar "¿Dónde lo recibes?" en la dirección']}),e.jsx(mt,{children:"Muestra las opciones Casa, Apto / Conjunto y Oficina debajo de la dirección."})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:8},children:[e.jsx("input",{type:"checkbox",checked:((zh=p.form)==null?void 0:zh.addr_photo)!==!1,onChange:r=>x(l=>({...l,form:{...l.form,addr_photo:r.target.checked}}))})," Botón de foto del recibo (cámara) en la dirección"]}),((Rh=p.form)==null?void 0:Rh.addr_photo)!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("input",{style:E,value:((Nh=p.form)==null?void 0:Nh.addr_photo_title)??"",onChange:r=>x(l=>({...l,form:{...l.form,addr_photo_title:r.target.value.slice(0,80)}})),placeholder:"Toca aquà y toma una foto de un recibo"}),e.jsx("input",{style:E,value:((Lh=p.form)==null?void 0:Lh.addr_photo_sub)??"",onChange:r=>x(l=>({...l,form:{...l.form,addr_photo_sub:r.target.value.slice(0,100)}})),placeholder:"Asegura tu entrega aunque no sepas tu dirección exacta"}),e.jsx("input",{style:E,value:((Ph=p.form)==null?void 0:Ph.addr_photo_hint)??"",onChange:r=>x(l=>({...l,form:{...l.form,addr_photo_hint:r.target.value.slice(0,120)}})),placeholder:"Leemos tu dirección, ciudad y barrio. La foto no se guarda."}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 10px"},children:"VacÃos = los textos de siempre."})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",margin:"4px 0 8px"},children:[e.jsx("input",{type:"checkbox",checked:((Dh=p.form)==null?void 0:Dh.chips)!==!1,onChange:r=>x(l=>({...l,form:{...l.form,chips:r.target.checked}}))})," Mini sellos bajo el botón (Compra segura, Datos protegidos, EnvÃo express)"]}),((Bh=p.form)==null?void 0:Bh.chips)!==!1&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("input",{style:{...E,flex:1,minWidth:110},value:((Wh=p.form)==null?void 0:Wh.chip1)??"Compra segura",onChange:r=>x(l=>({...l,form:{...l.form,chip1:r.target.value.slice(0,30)}})),placeholder:"Compra segura"}),e.jsx("input",{style:{...E,flex:1,minWidth:110},value:((qh=p.form)==null?void 0:qh.chip2)??"Datos protegidos",onChange:r=>x(l=>({...l,form:{...l.form,chip2:r.target.value.slice(0,30)}})),placeholder:"Datos protegidos"}),e.jsx("input",{style:{...E,flex:1,minWidth:110},value:((Mh=p.form)==null?void 0:Mh.chip3)??"EnvÃo express",onChange:r=>x(l=>({...l,form:{...l.form,chip3:r.target.value.slice(0,30)}})),placeholder:"EnvÃo express"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 10px"},children:"VacÃa un sello para quitarlo."})]}),e.jsx(Ea,{ai:{field:"Nota de pago del formulario",instruction:"Frase corta que tranquiliza sobre el pago contraentrega (no pagas nada ahora, pagas al recibir), máximo 90 caracteres, sin emojis",current:((Fh=p.form)==null?void 0:Fh.pay_reassure)??"",productName:q.name||"",onPick:r=>x(l=>({...l,form:{...l.form,pay_reassure:r}}))},children:"Nota de pago (tÃtulo y texto; vacÃos = se ocultan)"}),e.jsx("input",{style:E,value:((Oh=p.form)==null?void 0:Oh.pay_title)??"Pago contraentrega",onChange:r=>x(l=>({...l,form:{...l.form,pay_title:r.target.value.slice(0,40)}})),placeholder:"Pago contraentrega"}),e.jsx("input",{style:E,value:((Hh=p.form)==null?void 0:Hh.pay_reassure)??"No pagas nada ahora. Pagas en efectivo cuando recibas tu pedido.",onCh
1116ange:r=>x(l=>({...l,form:{...l.form,pay_reassure:r.target.value.slice(0,120)}})),placeholder:"No pagas nada ahora. Pagas en efectivo cuando recibas tu pedido."}),e.jsx("label",{style:D,children:"Estilo de la nota de pago"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Simple"},{v:"caja",l:"Caja"},{v:"capsula",l:"Cápsula"},{v:"borde",l:"Borde"}],value:((Gh=p.form)==null?void 0:Gh.pay_style)||"",onPick:r=>x(l=>({...l,form:{...l.form,pay_style:r||void 0}}))}),!!((Vh=p.form)!=null&&Vh.pay_style)&&e.jsxs("div",{style:{display:"flex",gap:14,flexWrap:"wrap",margin:"8px 2px 4px"},children:[p.form.pay_style!=="borde"&&e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Fondo"}),e.jsx("input",{type:"color",value:((Uh=p.form)==null?void 0:Uh.pay_bg)||"#eef4ff",onChange:r=>x(l=>({...l,form:{...l.form,pay_bg:r.target.value}})),style:{width:40,height:30,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}}),(Qh=p.form)!=null&&Qh.pay_bg?e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,form:{...r.form,pay_bg:void 0}})),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]}),p.form.pay_style!=="capsula"&&e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Borde"}),e.jsx("input",{type:"color",value:((Kh=p.form)==null?void 0:Kh.pay_line)||"#c7d7fe",onChange:r=>x(l=>({...l,form:{...l.form,pay_line:r.target.value}})),style:{width:40,height:30,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}}),(Yh=p.form)!=null&&Yh.pay_line?e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,form:{...r.form,pay_line:void 0}})),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]})]})})]}),Oa==="diseno"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Diseño"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"El aspecto de tu página: estilo, forma, plantillas y colores. Los cambios se ven al instante en la vista previa."})]}),e.jsx(Ei,{children:"Aplicar diseño (elige una forma)"}),e.jsx("div",{style:{marginBottom:4},children:e.jsx(by,{config:p,mode:"design",renderPreview:ll,onApply:async r=>sl(r)})}),e.jsxs(ht,{title:"Diseño de la landing",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"Nueve looks completos. Compáralos sin tocar tu página o aplÃcalos de forma explÃcita."}),e.jsx(Va,{que:"los colores y el estilo"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:10},children:wy.map(r=>{const l=(p.style||"classic")===r.v,y=zp(p,{style:r.v});return e.jsxs("div",{style:{textAlign:"left",border:l?`2px solid ${me}`:"1.5px solid var(--border, #e5e7eb)",background:l?"rgba(8,102,255,.05)":"var(--card-bg, #fff)",borderRadius:12,padding:9},children:[e.jsx(Iy,{config:y}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{width:14,height:14,borderRadius:r.v==="brutal"?3:"50%",background:r.chip,border:"1px solid var(--border, #ddd)",flex:"none"}}),e.jsx("span",{style:{fontWeight:800,fontSize:13.5,color:"var(--text, #111)"},children:r.name})]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:5,lineHeight:1.45},children:r.desc}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6,marginTop:8},children:[e.jsx("button",{type:"button",onClick:()=>{gr(),x(y)},style:{...xa,padding:"7px 8px",fontSize:11.5},children:l?"Aplicado":"Aplicar"}),e.jsx("button",{type:"button",onClick:()=>G({name:r.name,candidate:y}),style:{...ee,padding:"7px 8px",fontSize:11.5},children:"Ver sin aplicar"})]})]},r.v)})}),e.jsxs("div",{style:{marginTop:18,paddingTop:14,borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:800,marginBottom:8},children:"Plantillas listas"}),e.jsx(mt,{children:"Aplica un estilo completo de un clic (fuente + colores + botón). Después ajustas lo que quieras abajo."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:10,alignItems:"stretch"},children:_C.map(r=>{var y,R,P;const l=zp(p,{theme:r.theme,style:r.style,hero_style:r.hero_style,reviews_style:r.reviews_style,form_style:r.form_style,animations:r.animations!==!1});return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",border:"1.5px solid var(--border, #e5e7eb)",borderRadius:12,padding:8,background:"var(--card-bg, #fff)",textAlign:"center"},children:[e.jsx(Iy,{config:l}),e.jsx("div",{style:{fontSize:12.5,fontWeight:700,marginTop:7,color:"var(--text, #222)"},children:r.name}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)"},children:r.style?`${((y=wy.find(re=>re.v===r.style))==null?void 0:y.name)||""} · ${Sy((R=r.theme)==null?void 0:R.font)}`:Sy((P=r.theme)==null?void 0:P.font)}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:5,marginTop:"auto",paddingTop:7},children:[e.jsx("button",{type:"button",onClick:()=>ps(r),title:`Aplicar ${r.name}`,style:{...xa,padding:"6px 5px",fontSize:10.5},children:"Aplicar"}),e.jsx("button",{type:"button",onClick:()=>G({name:r.name,candidate:l}),style:{...ee,padding:"6px 5px",fontSize:10.5},children:"Ver sin aplicar"})]})]},r.id)})})]})]}),e.jsxs(ht,{title:"Fondo animado de la página",children:[e.jsx(mt,{children:"Un movimiento suave detrás del contenido, como en las tiendas premium. Elegà uno de la lista."}),e.jsx(Va,{que:"una animación propia"}),e.jsx("label",{style:D,children:"Fondo animado de la página (premium, como la tienda)"}),e.jsx("select",{style:E,value:((Jh=p.theme)==null?void 0:Jh.bg_anim)||"",onChange:r=>Pt({bg_anim:r.target.value||void 0}),children:vC.map(r=>
1116e.jsx("option",{value:r.id,children:r.nombre},r.id||"ninguno"))}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 2px 0"},children:"Un movimiento detrás del contenido. Se apaga solo si el celular pide menos animación."}),!!((Zh=p.theme)!=null&&Zh.bg_anim)&&e.jsxs("div",{style:{marginTop:12},children:[e.jsx(U2,{kind:p.theme.bg_anim,intensity:p.theme.bg_anim_intensity||"sutil",color:p.theme.bg_anim_color||p.theme.accent||""}),e.jsx("label",{style:{...D,marginTop:12},children:"Qué tanto se nota"}),e.jsx(Ko,{options:V2,value:p.theme.bg_anim_intensity||"sutil",onPick:r=>Pt({bg_anim_intensity:r||"sutil"})}),e.jsx("label",{style:{...D,marginTop:12},children:"Color del fondo (opcional)"}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{type:"color",value:/^#[0-9a-fA-F]{6}$/.test(p.theme.bg_anim_color||"")?p.theme.bg_anim_color:p.theme.accent||"#0866ff",onChange:r=>Pt({bg_anim_color:r.target.value}),style:{width:44,height:34,padding:0,border:"1.5px solid var(--border, #e5e7eb)",borderRadius:8,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:p.theme.bg_anim_color?"Color propio":"Deriva de tu color de acento"}),p.theme.bg_anim_color&&e.jsx("button",{type:"button",onClick:()=>Pt({bg_anim_color:void 0}),style:{border:"1px solid var(--border, #e5e7eb)",background:"var(--card-bg, #fff)",borderRadius:8,fontSize:12,padding:"5px 10px",cursor:"pointer",color:"var(--text-muted)"},children:"Quitar"})]})]})]}),te&&!bt&&e.jsxs(ht,{title:"Forma de la página",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 4px"},children:"Cambia cómo se presentan tus campos y tus reseñas. Los datos y la validación quedan igual."}),!ke&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Formulario"}),e.jsx(ns,{options:ky,value:p.form_style||"clasico",onPick:r=>x(l=>({...l,form_style:r})),render:r=>e.jsx(Ty,{v:r})})]}),e.jsx("label",{style:D,children:"Reseñas"}),e.jsx(ns,{options:Cy,value:p.reviews_style||"lista",onPick:r=>x(l=>({...l,reviews_style:r})),render:r=>e.jsx(Ey,{v:r})})]}),!te&&!bt&&e.jsxs(ht,{title:"Forma de la página",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 4px"},children:"Cambia cómo se presenta lo mismo: tus fotos, textos y campos no se tocan."}),e.jsx(Va,{que:"una portada única"}),!pt&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Parte de arriba (hero)"}),e.jsx(ns,{options:$C,value:p.hero_style||"clasico",onPick:r=>x(l=>({...l,hero_style:r})),render:r=>e.jsx(G2,{v:r})}),e.jsx(mt,{children:"Inmersivo y Diagonal ponen tu primera foto a pantalla completa: piden una foto de calida
1116d. Collage necesita 2 o más fotos."}),p.hero_style==="libre"&&e.jsxs("div",{style:{marginTop:12,padding:"12px 14px",border:"1px solid var(--border)",borderRadius:12},children:[e.jsx("label",{style:D,children:"Tu HTML de la parte de arriba"}),e.jsx("textarea",{value:p.hero_libre_html||"",onChange:r=>x(l=>({...l,hero_libre_html:r.target.value||void 0})),placeholder:`<style>.mi-hero{...}</style> 1117<div class="mi-hero">...</div> 1118<script>/* tu JS corre encerrado */<\/script>`,spellCheck:!1,style:{width:"100%",minHeight:180,boxSizing:"border-box",fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:12.5,lineHeight:1.5,padding:"10px 12px",borderRadius:9,border:"1px solid var(--border)",resize:"vertical"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:8,flexWrap:"wrap"},children:[e.jsx("label",{style:{fontSize:12.5,fontWeight:700},children:"Alto de arranque"}),e.jsx("input",{type:"number",min:240,max:1600,value:Number(p.hero_libre_alto)||480,onChange:r=>x(l=>({...l,hero_libre_alto:Math.max(240,Math.min(1600,Number(r.target.value)||480))})),style:{width:90,padding:"6px 8px",borderRadius:8,border:"1px solid var(--border)",fontSize:13}})," px"]}),e.jsxs(mt,{children:["Tu código corre ",e.jsx("b",{children:"encerrado"})," (no puede tocar la sesión, el formulario ni los pÃxeles) y el recuadro ajusta su alto solo. La galerÃa estándar se oculta â tu diseño manda arriba; el precio, el botón y el formulario de Lumy siguen debajo, intactos. Sin HTML, la página vuelve a Clásico."]}),e.jsxs(mt,{children:["¿Un botón de WhatsApp? Ponle ",e.jsx("code",{children:"data-lumy-whatsapp"})," (y si quieres ",e.jsx("code",{children:'data-texto="â¦"'}),"), o en tu JavaScript usa ",e.jsx("code",{children:"lumyWhatsApp('tu mensaje')"}),". Se abre con el número de esta página y, si ese número está conectado a Lumy, llega al agente sabiendo de qué página viene."]}),e.jsx(M1,{html:String(p.hero_libre_html||""),tipo:"bloque",numeroDelBoton:String(((Xh=p.whatsapp)==null?void 0:Xh.number)||"")}),e.jsx(ng,{pruebas:Dr.pruebas,tipo:"bloque",html:String(p.hero_libre_html||""),agenteEncendido:Ba?Ba.agente:void 0}),e.jsx(og,{landingId:Number(g==null?void 0:g.id)||0,parte:"hero",html:String(p.hero_libre_html||""),capturas:Dr.capturas})]}),p.hero_style==="tipografico"&&(q.name||"").trim().length>22&&e.jsxs(mt,{children:[e.jsx("b",{children:"Tipográfico luce con nombres cortos."})," El tuyo tiene ",(q.name||"").trim().length," letras y el titular ocupa varios renglones, asà que el precio queda fuera de la primera pantalla en el celular. Con 22 letras o menos entra completo. Prueba algo como âReloj Casio AE-1500â en vez del nombre largo: el detalle va en la descripción, que es donde el comprador lo busca."]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:20,marginTop:12,padding:"10px 12px",border:"1px dashed var(--border)",borderRadius:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fuerza del color"}),e.jsx(Ko,{options:[{v:"suave",name:"Suave"},{v:"",name:"Normal"},{v:"fuerte",name:"Fuerte"}],value:p.hero_fuerza||"",onPick:r=>x(l=>({...l,hero_fuerza:r||void 0})),allowClear:!0})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Alto de la foto"}),e.jsx(Ko,{options:[{v:"compacta",name:"Compacta"},{v:"",name:"Normal"},{v:"alta",name:"Alta"}],value:p.hero_alto||"",onPick:r=>x(l=>({...l,hero_alto:r||void 0})),allowClear:!0})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Esquinas del marco"}),e.jsx(Ko,{options:[{v:"recto",name:"Rectas"},{v:"",name:"Como viene"},{v:"redondo",name:"Redondas"}],value:p.hero_marco||"",onPick:r=>x(l=>({...l,hero_marco:r||void 0})),allowClear:!0})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Sombra sobre la foto"}),e.jsx(Ko,{options:[{v:"sin",name:"Quitarla"},{v:"suave",name:"Suave"},{v:"",name:"Normal"},{v:"fuerte",name:"Fuerte"}],value:p.hero_sombra||"",onPick:r=>x(l=>({...l,hero_sombra:r||void 0})),allowClear:!0})]}),p.hero_sombra!=="sin"&&e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color de la sombra"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:p.hero_sombra_color||"#08080e",onChange:r=>x(l=>({...l,hero_sombra_color:r.target.value})),style:{width:52,height:34,border:"1px solid var(--border)",borderRadius:9,background:"var(--bg-card)",cursor:"pointer",padding:2}}),p.hero_sombra_color?e.jsx("button",{type:"button",onClick:()=>x(r=>{const l={...r};return delete l.hero_sombra_color,l}),style:{border:0,background:"transparent",color:"var(--text-muted)",textDecoration:"underline",cursor:"pointer",fontFamily:"inherit",fontSize:12},children:"Volver al negro"}):e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Negro (el de siempre)"})]})]})]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:20,marginTop:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Alineación del titular"}),e.jsx(Ko,{options:IC,value:p.hero_align||"",onPick:r=>x(l=>({...l,hero_align:r||void 0})),allowClear:!0})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tamaño del precio"}),e.jsx(Ko,{options:[{v:"",name:"Normal"},{v:"xs",name:"Muy pequeño"},{v:"s",name:"Pequeño"},{v:"l",name:"Grande"},{v:"xl",name:"Muy grande"}],value:String(p.price_size||""),onPick:r=>x(l=>({...l,price_size:r||void 0})),allowClear:!0})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Avance solo de la galerÃa"}),e.jsx(Ko,{options:[{v:"",name:"4 seg"},{v:"0",name:"Quieta"},{v:"3000",name:"3 seg"},{v:"6000",name:"6 seg"},{v:"9000",name:"9 seg"}],value:String(p.gallery_autoplay??""),onPick:r=>x(l=>({...l,gallery_autoplay:r===""?void 0:Number(r)})),allowClear:!0})]}),e.jsx("div",{style:{flexBasis:"100%"},children:e.jsx(Va,{que:"el precio o cualquier pieza"})}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tamaño del titular"}),e.jsx(Ko,{options:TC,value:p.hero_title_size||"",onPick:r=>x(l=>({...l,hero_title_size:r||void 0})),allowClear:!0})]})]}),e.jsx(mt,{children:"Sin elegir, cada hero usa su alineación y tamaño de siempre. Toca de nuevo para volver al automático."}),e.jsx("label",{style:D,children:"Cómo termina la foto"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Corte recto"},{v:"fade",l:"Desvanecido"},{v:"curva",l:"Curva"},{v:"diagonal",l:"Diagonal"},{v:"onda",l:"Onda"},{v:"tarjeta",l:"Tarjeta que sube"},{v:"mix",l:"Desvanecido y tarjeta"}],value:p.hero_cut||"",onPick:r=>x(l=>({...l,hero_cut:r||void 0}))}),e.jsx(mt,{children:'"Desvanecido y tarjeta" es la más limpia: la foto se apaga sola y el contenido entra montado encima. Curva, Diagonal y Onda recortan la foto, asà que revisa que el producto no quede pegado al borde de abajo.'}),e.jsxs("div",{style:{marginTop:10},children:[e.jsx("label",{style:D,children:"Aire arriba del texto"}),e.jsx(Ko,{options:[{v:"",name:"Normal"},{v:"poco",name:"Poco"},{v:"nada",name:"Nada"}],value:p.hero_aire||"",onPick:r=>x(l=>({...l,hero_aire:r||void 0})),allowClear:!0}),e.jsx(mt,{children:"Es el espacio entre la foto y la caja de oferta. «Nada» la pega al borde de la tarjeta."})]}),["tarjeta","mix"].includes(String(p.hero_cut||""))&&e.jsxs("div",{style:{marginTop:10},children:[e.jsx("label",{style:D,children:"Cuánto sube la tarjeta"}),e.jsx(Ko,{options:[{v:"sin",name:"Quitarla"},{v:"suave",name:"Suave"},{v:"",name:"Normal"},{v:"fuerte",name:"Fuerte"}],value:p.hero_cut_fuerza||"",onPick:r=>x(l=>({...l,hero_cut_fuerza:r||void 0})),allowClear:!0}),e.jsx(mt,{children:"Es la franja en blanco que queda bajo el tÃtulo. Con «Quitarla» la foto se apaga y el contenido entra pegado, sin franja."})]}),e.jsx("label",{style:D,children:"Desvanecer la ÃLTIMA foto de abajo"}),e.jsx(jn,{small:!0,options:[{v:"",l:"No, se ve completa"}
1118,{v:"1",l:"SÃ, que se funda"}],value:p.img_fade_end?"1":"",onPick:r=>x(l=>({...l,img_fade_end:r?!0:void 0}))}),e.jsx(mt,{children:'Suaviza el corte recto de la última foto contra el fondo. Déjalo en "se ve completa" si armas tu oferta dentro de la imagen: el desvanecido se comerÃa el precio y las garantÃas de abajo.'})]}),!ke&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Formulario"}),e.jsx(ns,{options:ky,value:p.form_style||"clasico",onPick:r=>x(l=>({...l,form_style:r})),render:r=>e.jsx(Ty,{v:r})})]}),e.jsx("label",{style:D,children:"Reseñas"}),e.jsx(ns,{options:Cy,value:p.reviews_style||"lista",onPick:r=>x(l=>({...l,reviews_style:r})),render:r=>e.jsx(Ey,{v:r})}),e.jsx("label",{style:D,children:"Cuántas reseñas mostrar"}),e.jsx(Ko,{options:[{v:"",name:"Todas"},{v:"2",name:"2"},{v:"3",name:"3"},{v:"4",name:"4"},{v:"6",name:"6"},{v:"8",name:"8"}],value:String(p.reviews_max||""),onPick:r=>x(l=>({...l,reviews_max:r?Number(r):void 0})),allowClear:!0}),e.jsx(mt,{children:"Cuatro reseñas buenas convencen más que doce repetidas, y la página pesa menos en el celular."}),e.jsx("label",{style:D,children:"Efecto del titular"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 6px"},children:"El resaltado, subrayado o degradado que va sobre el nombre del producto."}),e.jsx(ns,{options:_y,value:p.headline_fx||"",onPick:r=>x(l=>({...l,headline_fx:r||void 0})),render:r=>e.jsx($y,{value:r,color:ii})}),!!p.headline_fx&&p.headline_fx!=="relieve"&&e.jsxs("div",{style:{marginTop:10},children:[e.jsx("label",{style:{...D,marginTop:0},children:"Color del efecto"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((ef=p.theme)==null?void 0:ef.headline_fx_color)||((tf=p.theme)==null?void 0:tf.accent)||me,onChange:r=>Pt({headline_fx_color:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(af=p.theme)!=null&&af.headline_fx_color?e.jsx("button",{type:"button",onClick:()=>Pt({headline_fx_color:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null,e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Sin elegir, usa el color de tu marca."})]})]})]}),e.jsxs(ht,{title:"Franja animada",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer"},onClick:r=>r.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:or,onChange:r=>Zn({on:r.target.checked})})," Activar"]})}),children:[e.jsx(mt,{children:"Un brillo que cruza por encima de la landing (sin barra de color): elige el efecto, la velocidad y qué tanto se nota.evo sin robarle atención al producto."}),or&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Efecto"}),e.jsx(jn,{options:[{v:"shine",l:"Brillo"},{v:"pulso",l:"Pulso"},{v:"aurora",l:"Aurora"},{v:"float",l:"Flotar"},{v:"slide",l:"Entrada"}],value:si,onPick:r=>Zn({anim:r}),small:!0}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:12,marginTop:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Color"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((nf=p.promo_banner)==null?void 0:nf.color)||((of=p.theme)==null?void 0:of.accent)||me,onChange:r=>Zn({color:r.target.value}),style:{width:40,height:30,padding:0,border:"1px solid var(--border,#e6e8ee)",borderRadius:7,background:"none",cursor:"pointer",flex:"none"}}),(rf=p.promo_banner)!=null&&rf.color?e.jsx("button",{type:"button",onClick:()=>Zn({color:""}),style:{...ee,fontSize:11,padding:"4px 8px"},children:"Auto"}):null]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Alto"}),e.jsx(jn,{small:!0,options:[{v:"fina",l:"Fina"},{v:"media",l:"Media"},{v:"alta",l:"Alta"}],value:((sf=p.promo_banner)==null?void 0:sf.size)||"media",onPick:r=>Zn({size:r})})]})]}),e.jsx("label",{style:D,children:"Velocidad"}),e.jsx(jn,{small:!0,options:[{v:"lenta",l:"Lenta"},{v:"normal",l:"Normal"},{v:"rapida",l:"Rápida"}],value:((lf=p.promo_banner)==null?void 0:lf.speed)||"normal",onPick:r=>Zn({speed:r})}),(si==="shine"||si==="pulso"||si==="aurora")&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Cada cuánto se repite"}),e.jsx(jn,{small:!0,options:[{v:"seguido",l:"Seguido"},{v:"normal",l:"Normal"},{v:"espaciado",l:"Espaciado"}],value:((df=p.promo_banner)==null?void 0:df.every)||"normal",onPick:r=>Zn({every:r})})]}),e.jsx("label",{style:D,children:"Intensidad"}),e.jsx(jn,{small:!0,options:[{v:"suave",l:"Suave"},{v:"media",l:"Media"},{v:"fuerte",l:"Fuerte"}],value:((cf=p.promo_banner)==null?void 0:cf.intensity)||"media",onPick:r=>Zn({intensity:r})}),e.jsx(mt,{children:"Los efectos se apagan solos en los teléfonos que piden menos movimiento."})]})]}),!bt&&e.jsxs(ht,{title:"Bloques extra",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Secciones sueltas que puedes encender, ordenar y colocar donde quieras dentro de la página."}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[["confianza","Tira de confianza","Pago contraentrega, envÃo nacional y garantÃa, debajo del hero"],["como_funciona","Cómo funciona (3 pasos)","Tres pasos: haz tu pedido, te llega, pagas al recibir; antes del formulario"],["comparativa","Comparativa (vs otros)",'Tabla "por qué pedir aquÃ" con las ventajas de la contraentrega'],["garantia","Sello de garantÃa","Sello grande con los dÃas de garantÃa y un texto que quita el miedo; cerca de la decisión"],["ficha","Ficha técnica","Tabla sobria con los datos clave del producto (contenido, medidas, materiales); ideal tecnologÃa y hogar"]].filter(([r])=>p.trust_mode!=="real_only"||r!=="confianza").map(([r,l,y])=>{const R=(p.section_blocks||[]).includes(r);return e.jsx("button",{type:"button",title:y,onClick:()=>x(P=>{const re=new Set(P.section_blocks||[]);return R?re.delete(r):re.add(r),{...P,section_blocks:Array.from(re)}}),className:R?"lk-sel-aurora":void 0,style:{border:`1.5px solid ${R?"transparent":"var(--border)"}`,background:"var(--bg-card)",color:R?"#fff":"var(--text)",borderRadius:999,padding:"7px 14px",fontSize:13,fontWeight:700,cursor:"pointer"},children:l},r)})}),(p.section_blocks||[]).length>0&&e.jsxs("div",{"data-sblist":!0,style:{marginTop:12,border:"1px solid var(--border, #e8eaf0)",borderRadius:11,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:11.5,fontWeight:800,color:"var(--text-muted)",padding:"8px 11px",background:"var(--bg-soft, #f4f6fb)",lineHeight:1.45},children:"Dónde va cada uno y en qué orden. Las flechas ordenan los que caen en la misma parte."}),(p.section_blocks||[]).map((r,l,y)=>e.jsxs("div",{"data-sbrow":l,style:{display:"flex",alignItems:"center",gap:8,padding:"8px 11px",borderTop:l?"1px solid var(--border, #eef0f5)":"none",flexWrap:"wrap",background:vs===l?"var(--bg-hover, #eef2ff)":"transparent",transition:"background .12s"},children:[e.jsx("span",{title:"Arrastra para reordenar",onPointerDown:R=>{var Le,Ee,Oe;(Ee=(Le=R.target).setPointerCapture)==null||Ee.call(Le,R.pointerId),gi(l);const P=Array.from(((Oe=R.currentTarget.closest("[data-sblist]"))==null?void 0:Oe.querySelectorAll("[data-sbrow]"))||[]),re=St=>{const rt=St.clientY;let Ft=-1;P.forEach((Tt,fa)=>{const Ha=Tt.getBoundingClientRect();rt>Ha.top&&rt<Ha.bottom&&(Ft=fa)}),gi(Tt=>Tt===null||Ft<0||Ft===Tt?Tt:(x(fa=>{const Ha=[...fa.section_blocks||[]],[Fn]=Ha.splice(Tt,1);return Ha.splice(Ft,0,Fn),{...fa,section_blocks:Ha}}),Ft))},xe=()=>{gi(null),window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",xe)};window.addEventListener("pointermove",re),window.addEventListener("pointerup",xe)},style:{cursor:"grab",color:"var(--text-muted)",fontSize:15,lineHeight:1,padding:"2px 3px",touchAction:"none",userSelect:"none"},children:"â ¿"}),e.jsx("span",{style:{fontSize:11.5,fontWeight:800,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums",minWidth:16},children:l+1}),e.jsx("span",{onClick:()=>ip(R=>R===r?"":r),title:"Tocar para editar este bloque",style:{cursor:"pointer",fontSize:13,fontWeight:700,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:GC[r]||r}),e.jsxs("select",{value:(p.section_blocks_pos||{})[r]||"desc",onChange:R=>x(P=>({...P,section_blocks_pos:{...P.section_blocks_pos||{},[r]:R.target.value}})),style:{...E,width:"auto",minWidth:0,maxWidth:190,marginBottom:0,padding:"5px 8px",fontSize:12},children:[e.jsx("option",{value:"desc",children:"Debajo de la descripción"}),e.jsx("option",{value:"oferta",children:"Debajo de la caja de oferta"}),e.jsx("option",{value:"offers",children:"Debajo de las ofertas"}),e.jsx("option",{value:"cta",children:"Debajo del botón de compra"}),e.jsx("option",{value:"end",children:"Al final de la página"}),e.jsx("option",{value:"fin",children:"Al final del contenido"})]}),e.jsx("button",{type:"button",title:"Subir",disabled:l===0,onClick:()=>x(R=>{const P=[...R.section_blocks||[]],re=P[l-1];return P[l-1]=P[l],P[l]=re,{...R,section_blocks:P}}),style:{...ee,padding:"4px 9px",lineHeight:1,opacity:l===0?.35:1},children:"â"}),e.jsx("button",{type:"button",title:"Bajar",disabled:l===y.length-1,onClick:()=>x(R=>{const P=[...R.section_blocks||[]],re=P[l+1];return P[l+1]=P[l],P[l]=re,{...R,section_blocks:P}}),style:{...ee,padding:"4px 9px",lineHeight:1,opacity:l===y.length-1?.35:1},children:"â"}),e.jsx("button",{type:"button",title:"Quitar este bloque","aria-label":"Quitar",onClick:()=>x(R=>({...R,section_blocks:(R.section_blocks||[]).filter(P=>P!==r)})),style:{border:"1px solid var(--border,#e5e7eb)",background:"var(--bg-card,#fff)",color:"var(--danger)",borderRadius:8,width:28,height:28,fontSize:15,lineHeight:1,cursor:"pointer",flex:"none"},children:"Ã"})]},r))]}),p.trust_mode!=="real_only"&&(p.section_blocks||[]).includes("confianza")&&mi==="confianza"&&e.jsxs("div",{style:{marginTop:10,padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Tira de confianza: los 3 textos (deja vacÃo para el default)"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:8},children:[0,1,2].map(r=>{var l,y,R;return e.jsx("input",{style:E,maxLength:40,value:((R=(y=(l=p.blocks_content)==null?void 0:l.confianza)==null?void 0:y.items)==null?void 0:R[r])??"",placeholder:["Pago contraentrega","EnvÃo a todo el paÃs","Camb
1118ios y garantÃa"][r],onChange:P=>x(re=>{var Le,Ee;const xe=[...((Ee=(Le=re.blocks_content)==null?void 0:Le.confianza)==null?void 0:Ee.items)||["","",""]];for(;xe.length<3;)xe.push("");return xe[r]=P.target.value,{...re,blocks_content:{...re.blocks_content,confianza:{items:xe}}}})},r)})})]}),(p.section_blocks||[]).includes("como_funciona")&&mi==="como_funciona"&&e.jsxs("div",{style:{marginTop:10,padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Cómo funciona: tÃtulo y 3 pasos (deja vacÃo para el default)"}),e.jsx("input",{style:{...E,marginBottom:8},maxLength:50,value:((pf=(uf=p.blocks_content)==null?void 0:uf.como_funciona)==null?void 0:pf.title)??"",placeholder:"Cómo funciona",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,como_funciona:{...(y=l.blocks_content)==null?void 0:y.como_funciona,title:r.target.value}}}})}),[0,1,2].map(r=>{var l,y,R,P,re,xe,Le,Ee;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(120px, 38%) minmax(0, 1fr)",gap:8,marginBottom:6},children:[e.jsx("input",{style:E,maxLength:40,value:((P=(R=(y=(l=p.blocks_content)==null?void 0:l.como_funciona)==null?void 0:y.steps)==null?void 0:R[r])==null?void 0:P.label)??"",placeholder:["Haz tu pedido","Te llega a casa","Pagas al recibir"][r],onChange:Oe=>x(St=>{var Ft,Tt,fa;const rt=[...((Tt=(Ft=St.blocks_content)==null?void 0:Ft.como_funciona)==null?void 0:Tt.steps)||[{},{},{}]];for(;rt.length<3;)rt.push({});return rt[r]={...rt[r],label:Oe.target.value},{...St,blocks_content:{...St.blocks_content,como_funciona:{...(fa=St.blocks_content)==null?void 0:fa.como_funciona,steps:rt}}}})}),e.jsx("input",{style:E,maxLength:90,value:((Ee=(Le=(xe=(re=p.blocks_content)==null?void 0:re.como_funciona)==null?void 0:xe.steps)==null?void 0:Le[r])==null?void 0:Ee.desc)??"",placeholder:["Llena tus datos aquÃ. No pagas nada ahora.","Lo despachamos y te avisamos por WhatsApp.","Revisas tu pedido y pagas contraentrega."][r],onChange:Oe=>x(St=>{var Ft,Tt,fa;const rt=[...((Tt=(Ft=St.blocks_content)==null?void 0:Ft.como_funciona)==null?void 0:Tt.steps)||[{},{},{}]];for(;rt.length<3;)rt.push({});return rt[r]={...rt[r],desc:Oe.target.value},{...St,blocks_content:{...St.blocks_content,como_funciona:{...(fa=St.blocks_content)==null?void 0:fa.como_funciona,steps:rt}}}})})]},r)})]}),(p.section_blocks||[]).includes("comparativa")&&mi==="comparativa"&&e.jsxs("div",{style:{marginTop:10,padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Comparativa: tÃtulo, columnas y filas (deja vacÃo para el default)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 90px 90px",gap:8,marginBottom:8},children:[e.jsx("input",{style:E,maxLength:50,value:((mf=(gf=p.blocks_content)==null?void 0:gf.comparativa)==null?void 0:mf.title)??"",placeholder:"Por qué pedir aquÃ",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,comparativa:{...(y=l.blocks_content)==null?void 0:y.comparativa,title:r.target.value}}}})}),e.jsx("input",{style:E,maxLength:16,value:((ff=(hf=p.blocks_content)==null?void 0:hf.comparativa)==null?void 0:ff.us)??"",placeholder:"AquÃ",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,comparativa:{...(y=l.blocks_content)==null?void 0:y.comparativa,us:r.target.value}}}})}),e.jsx("input",{style:E,maxLength:16,value:((bf=(xf=p.blocks_content)==null?void 0:xf.comparativa)==null?void 0:bf.them)??"",placeholder:"Otros",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,comparativa:{...(y=l.blocks_content)==null?void 0:y.comparativa,them:r.target.value}}}})})]}),e.jsx("label",{style:D,children:"Filas (una por lÃnea, máximo 6)"}),e.jsx("textarea",{style:{...E,minHeight:84,resize:"vertical"},value:(((vf=(yf=p.blocks_content)==null?void 0:yf.comparativa)==null?void 0:vf.rows)||[]).join(` 1119`),placeholder:`Pagas al recibir, no por adelantado 1120EnvÃo a todo el paÃs 1121Cambios y garantÃa 1122Te atendemos por WhatsApp`,onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,comparativa:{...(y=l.blocks_content)==null?void 0:y.comparativa,rows:r.target.value.split(` 1123`).map(R=>R.slice(0,80)).slice(0,6)}}}})})]}),(p.section_blocks||[]).includes("garantia")&&mi==="garantia"&&e.jsxs("div",{style:{marginTop:10,padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Sello de garantÃa (deja vacÃo para el default)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"90px minmax(0, 1fr)",gap:8,marginBottom:8},children:[e.jsx("input",{style:E,type:"number",min:1,max:365,value:((Af=(jf=p.blocks_content)==null?void 0:jf.garantia)==null?void 0:Af.dias)??"",placeholder:"7",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,garantia:{...(y=l.blocks_content)==null?void 0:y.garantia,dias:An(r.target.value)}}}})}),e.jsx("input",{style:E,maxLength:50,value:((wf=(Sf=p.blocks_content)==null?void 0:Sf.garantia)==null?void 0:wf.title)??"",placeholder:"GarantÃa de satisfacción",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,garantia:{...(y=l.blocks_content)==null?void 0:y.garantia,title:r.target.value}}}})})]}),e.jsx("input",{style:E,maxLength:160,value:((Cf=(kf=p.blocks_content)==null?void 0:kf.garantia)==null?void 0:Cf.text)??"",placeholder:"Si tu producto llega con algún defecto, te lo cambiamos sin costo. Revisas tu pedido al recibirlo.",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,garantia:{...(y=l.blocks_content)==null?void 0:y.garantia,text:r.target.value}}}})}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 0 0"},children:"El número de dÃas sale gigante en el sello: pon solo lo que de verdad cumples."})]}),(p.section_blocks||[]).includes("ficha")&&mi==="ficha"&&e.jsxs("div",{style:{marginTop:10,padding:"10px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:D,children:"Ficha técnica (deja vacÃo para el default)"}),e.jsx("input",{style:{...E,marginBottom:8},maxLength:50,value:(($f=(_f=p.blocks_content)==null?void 0:_f.ficha)==null?void 0:$f.title)??"",placeholder:"Ficha técnica",onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,ficha:{...(y=l.blocks_content)==null?void 0:y.ficha,title:r.target.value}}}})}),e.jsx("label",{style:D,children:'Filas dato: valor (una por lÃnea, máximo 8; ejemplo "Material: acero inoxidable")'}),e.jsx("textarea",{style:{...E,minHeight:96,resize:"vertical"},value:(((Tf=(If=p.blocks_content)==null?void 0:If.ficha)==null?void 0:Tf.rows)||[]).map(r=>`${r.k||""}: ${r.v||""}`.replace(/^: $/,"")).join(` 1124`),placeholder:`Contenido: 1 unidad 1125EnvÃo: 2 a 5 dÃas hábiles, a todo el paÃs 1126Pago: Contraentrega, pagas al recibir
1127GarantÃa: Cambio por defecto de fábrica`,onChange:r=>x(l=>{var y;return{...l,blocks_content:{...l.blocks_content,ficha:{...(y=l.blocks_content)==null?void 0:y.ficha,rows:r.target.value.split(` 1128`).slice(0,8).map(R=>{const P=R.indexOf(":");return P>0?{k:R.slice(0,P).trim().slice(0,28),v:R.slice(P+1).trim().slice(0,60)}:{k:R.trim().slice(0,28),v:""}})}}}})})]})]}),!ke&&e.jsxs(ht,{title:"Estilo del botón",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"La forma del botón de compra, con tu color actual. El efecto se ve aquà mismo."}),e.jsx(Va,{que:"un botón único"}),e.jsxs("div",{style:{"--db":((Ef=p.theme)==null?void 0:Ef.button_color)||((zf=p.theme)==null?void 0:zf.accent)||me,"--dt":((Rf=p.theme)==null?void 0:Rf.button_text_color)||"#ffffff"},children:[e.jsx("style",{children:RC}),e.jsx(ns,{options:zC,value:((Nf=p.theme)==null?void 0:Nf.button_style)||"plano",onPick:r=>Pt({button_style:r}),render:r=>e.jsx("span",{className:"lbsd lbsd-"+r,children:"Pedir ahora"})})]}),e.jsx(mt,{children:"Brutal va con el estilo Mercado Brutal. Destello garantiza el brillo aunque la animación esté en Ninguna."})]}),e.jsxs(ht,{title:"Microinteracciones de decisión",children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,fontWeight:750,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:((Lf=p.microinteractions)==null?void 0:Lf.enabled)===!0,onChange:r=>x(l=>({...l,microinteractions:{...l.microinteractions,enabled:r.target.checked}}))})," Activar el conjunto"]}),e.jsx(mt,{children:"Movimientos cortos al elegir o avanzar. No usa pulsos permanentes y respeta la preferencia de movimiento reducido."}),((Pf=p.microinteractions)==null?void 0:Pf.enabled)===!0&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr))",gap:7,marginTop:9},children:[["total_transition","Transición del total"],["cta_press","Respuesta al presionar el botón"],["image_crossfade","Fundido al cambiar color"],["scene_reveal","Entrada de escenas al bajar"],["parallax","Profundidad sutil, máximo 8 px"]].map(([r,l])=>{var y;return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,padding:"8px 9px",border:"1px solid var(--border,#e5e7eb)",borderRadius:9,fontSize:12,cursor:"pointer",background:"var(--card-bg,#fff)"},children:[e.jsx("input",{type:"checkbox",checked:((y=p.microinteractions)==null?void 0:y[r])!==!1,onChange:R=>x(P=>({...P,microinteractions:{...P.microinteractions,enabled:!0,[r]:R.target.checked}}))}),l]},r)})})]}),e.jsxs(ht,{title:"Barra del total (abajo de la página)",children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:8},children:[e.jsx("input",{type:"checkbox",checked:p.sticky_bar!==!1,onChange:r=>x(l=>({...l,sticky_bar:r.target.checked}))})," Mostrar la barra"]}),p.sticky_bar!==!1&&e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!p.sticky_smart,onChange:r=>x(l=>({...l,sticky_smart:r.target.checked}))})," Aparición inteligente"]}),e.jsx(mt,{children:"Aparece después de bajar media pantalla y se esconde cuando el formulario ya está a la vista."})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:10,alignItems:"end"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Fondo de la barra"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Df=p.theme)==null?void 0:Df.sticky_bg)||"#ffffff",onChange:r=>Pt({sticky_bg:r.target.value}),style:{width:44,height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(Bf=p.theme)!=null&&Bf.sticky_bg?e.jsx("button",{type:"button",onClick:()=>Pt({sticky_bg:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Auto"})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:3},children:"Color del precio"}),e.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[e.jsx("input",{type:"color",value:((Wf=p.theme)==null?void 0:Wf.sticky_price_color)||"#16a34a",onChange:r=>Pt({sticky_price_color:r.target.value}),style:{width:44,height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flexShrink:0}}),(qf=p.theme)!=null&&qf.sticky_price_color?e.jsx("button",{type:"button",onClick:()=>Pt({sticky_price_color:""}),style:{...ee,fontSize:11,padding:"5px 7px"},children:"Auto"}):e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Auto"})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",paddingBottom:8},children:[e.jsx("input",{type:"checkbox",checked:!!((Mf=p.theme)!=null&&Mf.sticky_anim),onChange:r=>Pt({sticky_anim:r.target.checked})})," Brillo animado"]})]})]}),e.jsx(Ei,{children:"Colores"}),e.jsxs(ht,{title:"Diseño general",children:[e.jsxs("div",{style:{marginBottom:14,padding:"11px 12px",background:"var(--accent-soft, rgba(8,102,255,.07))",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:{...D,fontWeight:800,marginBottom:6},children:"Color de tu marca"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("input",{type:"color",value:((Ff=p.theme)==null?void 0:Ff.accent)||me,onChange:r=>{const l=r.target.value,y=l.replace("#",""),R=y.length>=6?(.2126*parseInt(y.slice(0,2),16)+.7152*parseInt(y.slice(2,4),16)+.0722*parseInt(y.slice(4,6),16))/255:1;Pt({accent:l,button_color:l,offers_color:l,form_focus_border:l,button_text_color:R>.6?"#111111":"#ffffff"})},style:{width:64,height:40,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer",flex:"none"}}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.4},children:"Pinta de un golpe el botón, los acentos y las ofertas. El precio (verde) y el tachado (rojo) no se tocan. Abajo puedes afinar cada color por separado."})]})]}),e.jsxs("div",{style:{marginBottom:14,padding:"11px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:{...D,fontWeight:800,marginBottom:6},children:"Kit de marca"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:Pc,style:{padding:"8px 14px",borderRadius:9,border:"1px solid var(--border)",background:"var(--bg-card)",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",color:"var(--text-primary)"},children:"Guardar esta marca como mi kit"}),e.jsx("span",{style:{fontSize:12,color:cd.startsWith("Kit")?"#16a34a":"var(--text-muted)",lineHeight:1.4,flex:1,minWidth:180},children:cd||"Colores, tipografÃa y estilo de esta landing se vuelven la base de toda landing nueva que crees."})]})]}),e.jsxs("div",{style:{marginBottom:14,padding:"11px 12px",background:"var(--bg-secondary)",borderRadius:10,border:"1px solid var(--border)"},children:[e.jsx("label",{style:{...D,fontWeight:800,marginBottom:6},children:"Historial de versiones"}),Gr===null?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{type:"button",onClick:pd,style:{padding:"8px 14px",borderRadius:9,border:"1px solid var(--border)",background:"var(--bg-card)",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",color:"var(--text-primary)"},children:"Ver versiones guardadas"}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.4,flex:1,minWidth:180},children:"Guardamos una copia al publicar y mientras editas. Si algo queda mal, vuelves atrás en un clic."})]}):Gr.length===0?e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Aún no hay versiones guardadas: se crean al publicar y al editar."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,maxHeight:220,overflowY:"auto"},children:Gr.map(r=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,padding:"6px 8px",background:"var(--bg-card)",borderRadius:8,border:"1px solid var(--border)"},children:[e.jsx("span",{style:{flex:1},children:new Date(String(r.created_at).replace(" ","T")+"Z").toLocaleStr
1128ing("es-CO",{timeZone:"America/Bogota",day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}),e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:r.origin==="publicado"?"#16a34a":"var(--text-muted)",textTransform:"uppercase",letterSpacing:".03em"},children:r.origin==="antes_de_restaurar"?"antes de restaurar":r.origin==="antes_de_deshacer"?"antes de deshacer":r.origin}),e.jsx("button",{type:"button",disabled:rl,onClick:()=>Dc(r.id),style:{padding:"5px 10px",borderRadius:7,border:"1px solid var(--border)",background:"transparent",fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",color:"var(--text-primary)",opacity:rl?.5:1},children:"Restaurar"})]},r.id))})]}),e.jsx("label",{style:D,children:"Pareja tipográfica"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"-2px 0 7px",lineHeight:1.45},children:"Combina una fuente para tÃtulos con otra para lectura. Solo se activa al elegir una."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(155px, 1fr))",gap:7,marginBottom:8},children:ap.map(r=>{var R;const l=((R=p.theme)==null?void 0:R.font_pair)===r.id,y=fC(p.style)===r.id;return e.jsxs("button",{type:"button",onClick:()=>Pt({font_pair:r.id}),style:{textAlign:"left",padding:"9px 10px",borderRadius:10,border:l?`2px solid ${me}`:"1px solid var(--border,#e5e7eb)",background:l?"rgba(8,102,255,.06)":"var(--card-bg,#fff)",color:"var(--text,#111)",cursor:"pointer",fontFamily:"inherit"},children:[e.jsxs("div",{style:{fontSize:12.5,fontWeight:850},children:[r.label,y?e.jsx("span",{style:{color:me,fontSize:9.5,marginLeft:5},children:"Recomendada"}):null]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)",marginTop:2},children:r.description})]},r.id)})}),e.jsx("button",{type:"button",onClick:()=>Pt({font_pair:void 0}),disabled:!((Of=p.theme)!=null&&Of.font_pair),style:{...ee,padding:"6px 10px",fontSize:11.5,marginBottom:10,opacity:(Hf=p.theme)!=null&&Hf.font_pair?1:.5},children:"Usar una sola fuente"}),!!((Gf=p.theme)!=null&&Gf.font_pair)&&e.jsx(mt,{children:"La escala fluida, el ancho de lectura y el interlineado se ajustan de forma automática en móvil y escritorio."}),e.jsxs("label",{style:D,children:["TipografÃa simple",(Vf=p.theme)!=null&&Vf.font_pair?" (en pausa)":""]}),e.jsx("select",{style:{...E,opacity:(Uf=p.theme)!=null&&Uf.font_pair?.62:1},disabled:!!((Qf=p.theme)!=null&&Qf.font_pair),value:((Kf=p.theme)==null?void 0:Kf.font)||"system",onCh
1128ange:r=>Pt({font:r.target.value}),children:H2.map(r=>e.jsx("option",{value:r.v,children:r.l},r.v))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Esquinas (tarjetas y cajas)"}),e.jsxs("select",{style:E,value:((Yf=p.theme)==null?void 0:Yf.radius_level)??"",onChange:r=>Pt({radius_level:r.target.value===""?void 0:Number(r.target.value)}),children:[e.jsx("option",{value:"",children:"Como el estilo (auto)"}),e.jsx("option",{value:"0",children:"Rectas (0)"}),e.jsx("option",{value:"1",children:"Sutiles (6)"}),e.jsx("option",{value:"2",children:"Suaves (12)"}),e.jsx("option",{value:"3",children:"Redondas (18)"}),e.jsx("option",{value:"4",children:"PÃldora (26)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Densidad (aire entre secciones)"}),e.jsxs("select",{style:E,value:((Jf=p.theme)==null?void 0:Jf.density)||"",onChange:r=>Pt({density:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Normal"}),e.jsx("option",{value:"compact",children:"Compacta"}),e.jsx("option",{value:"airy",children:"Aireada"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Textura del fondo"}),e.jsxs("select",{style:E,value:((Zf=p.theme)==null?void 0:Zf.texture)||"",onChange:r=>Pt({texture:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Lisa"}),e.jsx("option",{value:"grain",children:"Grano de pelÃcula"}),e.jsx("option",{value:"paper",children:"Papel"}),e.jsx("option",{value:"dots",children:"Puntos finos"}),e.jsx("option",{value:"lines",children:"LÃneas finas"}),e.jsx("option",{value:"mesh",children:"Malla de color"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Borde bajo la galerÃa"}),e.jsxs("select",{style:E,value:((Xf=p.theme)==null?void 0:Xf.divider)||"",onChange:r=>Pt({divider:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Recto"}),e.jsx("option",{value:"diagonal",children:"Diagonal"}),e.jsx("option",{value:"curva",children:"Curva"}),e.jsx("option",{value:"zigzag",children:"Zigzag"})]})]}),e.jsxs("div",{id:"lk-imgmask",style:{borderRadius:10},children:[e.jsx("label",{style:D,children:"Marco de fotos del contenido"}),e.jsxs("select",{style:E,value:((ex=p.theme)==null?void 0:ex.img_mask)||"",onChange:r=>Pt({img_mask:r.target.value||void 0}),children:[e.jsx("option",{value:"",children:"Normal (a lo ancho)"}),e.jsx("option",{value:"arch",children:"Arco"}),e.jsx("option",{value:"blob",children:"Orgánico"}),e.jsx("option",{value:"capsule",children:"Cápsula"})]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color principal (acentos)"}),e.jsx("input",{type:"color",value:((tx=p.theme)==null?void 0:tx.accent)||me,onChange:r=>Pt({accent:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fondo de la página"}),e.jsx("input",{type:"color",value:((ax=p.theme)==null?void 0:ax.page_bg)||"#f7f8fc",onChange:r=>Pt({page_bg:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginTop:12},children:[e.jsx("input",{type:"checkbox",checked:p.animations!==!1,onChange:r=>x(l=>({...l,animations:r.target.checked}))}),"Animaciones de entrada"]})]}),e.jsxs(ht,{title:"Colores de venta",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:"Precio en verde y tachado en rojo convierten mejor. Cada uno va por su lado."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Precio"}),e.jsx("input",{type:"color",value:((nx=p.theme)==null?void 0:nx.price_color)||"#16a34a",onChange:r=>Pt({price_color:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Precio tachado"}),e.jsx("input",{type:"color",value:((ox=p.theme)==null?void 0:ox.compare_color)||"#e11d48",onCh
1128ange:r=>Pt({compare_color:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Ofertas (destacado)"}),e.jsx("input",{type:"color",value:((rx=p.theme)==null?void 0:rx.offers_color)||((ix=p.theme)==null?void 0:ix.accent)||me,onChange:r=>Pt({offers_color:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]})]}),!ke&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Colores del formulario",children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 6px"},children:"Personaliza el formulario de pedido. Si no tocas nada, usa el look por defecto."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fondo del formulario"}),e.jsx("input",{type:"color",value:((sx=p.theme)==null?void 0:sx.form_bg)||"#ffffff",onChange:r=>Pt({form_bg:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Fondo de las casillas"}),e.jsx("input",{type:"color",value:((lx=p.theme)==null?void 0:lx.form_input_bg)||"#ffffff",onChange:r=>Pt({form_input_bg:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Borde de las casillas"}),e.jsx("input",{type:"color",value:((dx=p.theme)==null?void 0:dx.form_input_border)||"#dddeee",onChange:r=>Pt({form_input_border:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Ãcono de las casillas"}),e.jsx("input",{type:"color",value:((cx=p.theme)==null?void 0:cx.form_input_icon_bg)||"#F1F5F9",onChange:r=>Pt({form_input_icon_bg:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Borde al escribir"}),e.jsx("input",{type:"color",value:((ux=p.theme)==null?void 0:ux.form_focus_border)||((px=p.theme)==null?void 0:px.accent)||me,onChange:r=>Pt({form_focus_border:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]})]})}),e.jsx("div",{id:"seccion-codigo-libre",children:e.jsxs(ht,{title:"CSS y JavaScript personalizados (avanzado)",children:[e.jsx("label",{style:D,children:"Tu CSS â restyla cualquier pieza de la página"}),e.jsx("textarea",{style:{...E,minHeight:90,resize:"vertical",fontFamily:"monospace",fontSize:12.5},value:p.custom_css||"",onChange:r=>x(l=>({...l,custom_css:r.target.value})),placeholder:`.cta { border-radius: 30px; } 1129.price { color: #e11d48; animation: latido 1.4s infinite; } 1130@keyframes latido { 50% { transform: scale(1.06); } }`}),e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",marginTop:6},children:["Clases útiles: ",e.jsx("code",{children:".cta"}),", ",e.jsx("code",{children:".price"}),", ",e.jsx("code",{children:"h1"}),", ",e.jsx("code",{children:".galshell"}),", ",e.jsx("code",{children:"input"}),", ",e.jsx("code",{children:"body"}),". Tu CSS gana sobre el predeterminado â animaciones incluidas."]}),e.jsxs("div",{style:{marginTop:14,paddingTop:12,borderTop:"1px dashed var(--border)"},children:[e.jsx("label",{style:D,children:"Tu JavaScript â dale movimiento y efectos a tu página"}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 6px",lineHeight:1.5},children:["Funciona sobre tu página tal como está. ¿Prefieres diseñarla completa desde cero? Crea una ",e.jsx("b",{children:"Página en código"})," (Nueva landing â Página en código)."]}),e.jsx("textarea",{style:{...E,minHeight:110,resize:"vertical",fontFamily:"monospace",fontSize:12.5,opacity:Je?1:.6},value:p.custom_js||"",onChange:r=>x(l=>({...l,custom_js:r.target.value||void 0})),placeholder:`// Corre sobre la página real: puedes animar el precio, el botón, lo que quieras.
1131// Puedes cargar librerÃas: const s=document.createElement("script"); s.src="https://cdn.../gsap.min.js"; document.head.appendChild(s); 1132document.querySelector(".price")?.animate([{transform:"scale(1)"},{transform:"scale(1.05)"},{transform:"scale(1)"}],{duration:1200,iterations:Infinity})`}),!!String(p.custom_js||"").trim()&&!Je&&e.jsxs("div",{role:"alert",style:{fontSize:12.5,fontWeight:600,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1.5px solid var(--notice-warning-border)",borderRadius:10,padding:"10px 12px",marginTop:8,lineHeight:1.55},children:["â Para usar tu JavaScript es necesario que ",e.jsx("b",{children:"conectes tu dominio a Lumy"}),". Cuando lo hagas, todo funcionará como quieres.",e.jsx(_n,{})]}),!!String(p.custom_js||"").trim()&&Je&&!p.js_libre&&e.jsx("div",{role:"status",style:{fontSize:12.5,fontWeight:600,color:"var(--notice-info-text)",background:"var(--notice-info-bg)",border:"1.5px solid var(--notice-info-border)",borderRadius:10,padding:"10px 12px",marginTop:8,lineHeight:1.55},children:"ð¡ Enciende el interruptor de abajo para que tu JavaScript funcione."}),e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:9,fontSize:12.5,lineHeight:1.5,cursor:Je?"pointer":"not-allowed",opacity:Je?1:.65,marginTop:8},children:[e.jsx("input",{type:"checkbox",disabled:!Je,checked:!!p.js_libre&&Je,onChange:r=>x(l=>({...l,js_libre:r.target.checked})),style:{marginTop:3}}),e.jsxs("span",{children:[e.jsx("b",{children:"Permitir mi JavaScript en esta landing."})," ",Je?e.jsxs(e.Fragment,{children:["Corre cuando la abren por ",e.jsx("b",{children:"tu dominio"}),"."]}):e.jsxs(e.Fragment,{children:["Para activarlo, ",e.jsx("b",{children:"conecta tu propio dominio"})," a esta landing."]})]})]}),!!p.js_libre&&Je&&!!String(p.custom_js||"").trim()&&e.jsx("div",{role:"status",style:{fontSize:11.5,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:8,padding:"8px 10px",marginTop:9,lineHeight:1.5},children:"Tu código manda en la página â incluido el formulario del pedido. Pega solo código que entiendas o que venga de una fuente en la que confÃes."})]})]})})]}),Oa==="ajustes"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Ajustes"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"PaÃs y moneda de esta landing, tipo de página y las acciones para borrarla o guardarla."})]}),e.jsxs(ht,{title:"PaÃs y moneda de esta landing",defaultOpen:!0,children:[e.jsxs(mt,{children:["Aplica ",e.jsx("b",{children:"solo a esta landing"}),": moneda, prefijo del teléfono, validación de la dirección y textos legales. Las demás landings y tu panel no cambian. El paÃs de toda tu cuenta se cambia en Ajustes."]}),e.jsx("p",{style:{fontSize:12,color:"var(--warning, #b45309)",fontWeight:700,margin:"2px 0 9px",lineHeight:1.45},children:"Al cambiarlo, los pedidos que esta landing ya tiene pasan también a ese paÃs, y su valor pasa a contarse en la moneda de ese paÃs sin convertirlo. Se quedan como están los pagados en lÃnea, los de tu tienda, los que están a medio despachar y los de una bodega de otro paÃs."}),e.jsxs("select",{style:E,value:p.country||"",onChange:r=>x(l=>({...l,country:r.target.value||void 0})),children:[e.jsx("option",{value:"",children:"El de mi cuenta (predeterminado)"}),Object.values(rn).map(r=>e.jsxs("option",{value:r.code,children:[r.name," (",r.currency,")"]},r.code))]})]}),e.jsxs(ht,{title:"Tipo de página",children:[e.jsxs("select",{style:E,value:p.page_type||"product",onChange:r=>{const l=r.target.value,y=new Set(Ny(l).map(R=>R.key));x(R=>{const P=R.page_type==="advertorial"&&l!=="advertorial",re={...R,page_type:l,copy_length:l==="advertorial"?"explicativa":P?"equilibrada":R.copy_length,trust_facts:R.trust_facts?{...R.trust_facts,items:(R.trust_facts.items||[]).filter(xe=>!!xe.key&&y.has(xe.key))}
1132:void 0,urgency:l==="whatsapp"||l==="servicio"||l==="advertorial"?{...R.urgency||{},enabled:!1}:R.urgency};return P?hy(re,"equilibrada"):re})},children:[e.jsx("option",{value:"product",children:"Página de producto: completa (variantes, ofertas, reseñasâ¦)"}),e.jsx("option",{value:"simple",children:"Landing simple: imágenes apiladas + botón + formulario"}),e.jsx("option",{value:"whatsapp",children:"Landing de WhatsApp: página puente + botón que abre el chat"}),(!m||p.page_type==="servicio")&&e.jsx("option",{value:"servicio",children:"Página de servicios: capta clientes (sin envÃo ni dirección) â optimiza LEADS"}),u&&e.jsx("option",{value:"advertorial",children:"Advertorial: nota aparte + botón a tu landing de venta"})]}),p.page_type==="servicio"&&e.jsxs(mt,{children:["Para servicios (lavado, estética, reparacionesâ¦). El formulario pide solo ",e.jsx("b",{children:"nombre y teléfono"})," (sin dirección ni envÃo) y NO se manda a Dropi. Usa las ",e.jsx("b",{children:"Variantes"})," como opciones (Tipo de servicio, Fecha, Horario). El formulario puede ir ",e.jsx("b",{children:"abajo o en popup"})," (ver Formulario). Se reporta a Meta/TikTok como ",e.jsx("b",{children:"Lead"})," para que la pauta traiga contactos."]})]})]}),Oa==="upsell"&&!ke&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Impulso"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"Ajusta el movimiento visual y las ofertas complementarias de tu página."})]}),e.jsxs(ht,{title:"Ritmo visual",children:[e.jsx(mt,{children:"Elige cuánto movimiento tendrá el diseño. Solo cambia animaciones y transiciones; no activa presión, avisos ni prueba social."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},children:[{k:"sobrio",n:"Sobrio",d:"Botones quietos y sin animaciones recurrentes."},{k:"guiado",n:"Guiado",d:"Transiciones suaves y barra inteligente para orientar la lectura."},{k:"expresivo",n:"Expresivo",d:"Más movimiento en fondos y botones, sin presión inventada."}].map(r=>e.jsxs("button",{type:"button",onClick:()=>{x(l=>{const y={...l.theme};return r.k==="sobrio"||r.k==="guiado"?(y.button_animation="none",y.sticky_anim=!1):(y.button_animation="shine",y.sticky_anim=!0),{...l,theme:y,animations:r.k!=="sobrio",sticky_smart:r.k!=="sobrio"}}),ue(`Ritmo visual "${r.n}" aplicado`),setTimeout(()=>ue(""),2500)},style:{border:"1.5px solid var(--border, #e5e7eb)",borderRadius:12,padding:"10px 8px",background:"var(--card-bg, #fff)",cursor:"pointer",textAlign:"left"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,display:"block",marginBottom:3},children:r.n}),e.jsx("span",{style:{fontSize:10.5,color:"var(--text-muted)",lineHeight:1.35,display:"block"},children:r.d})]},r.k))})]}),(!!((gx=p.scarcity)!=null&&gx.enabled)||!!((mx=p.social_proof)!=null&&mx.enabled))&&e.jsxs(ht,{title:"Avisos heredados (escasez y compras recientes)",children:[e.jsx(mt,{children:"Esta landing todavÃa muestra avisos de presión que ya no se usan en Lumy. Puedes apagarlos aquÃ; los quitamos de las páginas nuevas porque restan credibilidad."}),!!((hx=p.scarcity)!=null&&hx.enabled)&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer",marginBottom:8},children:[e.jsx("input",{type:"checkbox",checked:!!((fx=p.scarcity)!=null&&fx.enabled),onChange:r=>x(l=>({...l,scarcity:{...l.scarcity,enabled:r.target.checked}}))}),' Mostrar el aviso de "pocas unidades" ',e.jsx("span",{style:{color:"var(--text-muted)"},children:"(desmarcado = se quita)"})]}),!!((xx=p.social_proof)!=null&&xx.enabled)&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((bx=p.social_proof)!=null&&bx.enabled),onChange:r=>x(l=>({...l,social_proof:{...l.social_proof,enabled:r.target.checked}}))}),' Mostrar los avisos de "alguien acaba de pedir"']})]}),!ke&&!pt&&!bt&&e.jsxs(e.Fragment,{children:[e.jsx(Ei,{children:"Entrega y disponibilidad"}),e.jsxs(ht,{title:"Hora de corte de despacho",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((yx=p.urgency)!=null&&yx.enabled)&&((vx=p.urgency)==null?void 0:vx.mode)==="corte",onChange:r=>be(r.target.checked?{enabled:!0,mode:"corte",text:void 0}:{enabled:!1})})," Activar"]})}),children:[!!((jx=p.urgency)!=null&&jx.enabled)&&((Ax=p.urgency)==null?void 0:Ax.mode)!=="corte"&&e.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,padding:10,marginBottom:10},children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Esta landing conserva un temporizador heredado. Puedes retirarlo; las landings nuevas ya no ofrecen contadores por visitante."}),e.jsx("button",{type:"button",style:ee,onClick:()=>be({enabled:!1}),children:"Retirar temporizador heredado"})]}),!!((Sx=p.urgency)!=null&&Sx.enabled)&&((wx=p.urgency)==null?void 0:wx.mode)==="corte"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 8px"},children:"Cuenta el tiempo real hasta tu hora de corte. Pasada la hora, cambia al mensaje del siguiente dÃa hábil."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"110px minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Hora de corte"}),e.jsx("input",{style:E,type:"time",value:((kx=p.urgency)==null?void 0:kx.cutoff)||"16:00",onChange:r=>be({cutoff:r.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Cierre de la frase"}),e.jsx("input",{style:E,value:((Cx=p.urgency)==null?void 0:Cx.cutoff_pos)||"",onChange:r=>be({cutoff_pos:r.target.value}),placeholder:"y tu pedido se despacha hoy",maxLength:60})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Mensaje pasada la hora"}),e.jsx("input",{style:E,value:((_x=p.urgency)==null?void 0:_x.cutoff_late)||"",onChange:r=>be({cutoff_late:r.target.value}),placeholder:"Pide ahora y tu pedido se despacha el próximo dÃa hábil",maxLength:90})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer",margin:"2px 0 4px"},children:[e.jsx("input",{type:"checkbox",checked:(($x=p.urgency)==null?void 0:$x.cutoff_festivos)!==!1,onChange:r=>be({cutoff_festivos:r.target.checked?void 0:!1})})," No prometer despacho en festivos de Colombia"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,cursor:"pointer",margin:"0 0 4px"},children:[e.jsx("input",{type:"checkbox",checked:!(Array.isArray((Ix=p.urgency)==null?void 0:Ix.cutoff_days)&&!p.urgency.cutoff_days.includes(6)),onChange:r=>be({cutoff_days:r.target.checked?void 0:[1,2,3,4,5]})})," Despacho los sábados"]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:"Cuenta de lunes a sábado; los domingos nunca se promete despacho."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Forma"}),e.jsxs("select",{style:E,value:((Tx=p.urgency)==null?void 0:Tx.style)||"bar",onChange:r=>be({style:r.target.value}),children:[e.jsx("option",{value:"bar",children:"Banda (texto y reloj en lÃnea)"}),e.jsx("option",{value:"card",children:"Tarjeta (reloj grande debajo del texto)"}),e.jsx("option",{value:"minimal",children:"Minimal (solo texto, sin fondo)"}),e.jsx("option",{value:"cajas",children:"Cajas de dÃgitos (tipo aeropuerto)"}),e.jsx("option",{value:"anillo",children:"Anillo de progreso"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color"}),e.jsx("input",{type:"color",value:((Ex=p.urgency)==null?void 0:Ex.color)||"#b45309",onChange:r=>be({color:r.target.value}),style:{width:"100%",height:38,border:"1px solid var(--border)",borderRadius:8,background:"none",cursor:"pointer"}})]})]})]})]}),!bt&&e.jsx(ht,{title:"Cierre oscuro (remate final)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((zx=p.dark_close)!=null&&zx.enabled),onChange:r=>x(l=>({...l,dark_close:{...l.dark_close,enabled:r.target.checked}}))})," Activar"]})}),children:((Rx=p.dark_close)==null?void 0:Rx.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"6px 0 8px"},children:"Bloque oscuro al final de la página, con un brillo del color de tu marca detrás del botón. El remate premium donde se decide la compra."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((Nx=p.dark_close)==null?void 0:Nx.title)||"",onChange:r=>x(l=>({...l,dark_close:{...l.dark_close,title:r.target.value}})),placeholder:"Pide hoy y paga cuando lo recibas",maxLength:70})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto de apoyo"}),e.jsx("input",{style:E,value:((Lx=p.dark_close)==null?void 0:Lx.sub)||"",onChange:r=>x(l=>({...l,dark_close:{...l.dark_close,sub:r.target.value}})),placeholder:"Sin pagos por adelantado: recibes tu pedido, lo revisas y ahà sà pagas.",maxLength:140})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto del botón (opcional)"}),e.jsx("input",{style:E,value:((Px=p.dark_close)==null?void 0:Px.cta)||"",onChange:r=>x(l=>({...l,dark_close:{...l.dark_close,cta:r.target.value}})),placeholder:"Igual al botón principal",maxLength:40})]})]})]})})]}),!pt&&e.jsx(ht,{title:"Regalo por monto",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((Dx=p.gift_reward)!=null&&Dx.enabled),onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,enabled:r.target.checked}}))})," Activar"]})}),children:((Bx=p.gift_reward)==null?void 0:Bx.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:'Una barra "te faltan $X para tu regalo" que empuja al cliente a sumar otra unidad. El regalo va incluido GRATIS, no suma al cobro contraentrega. Truco: pon el monto justo por encima de tu pedido promedio.'}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Monto para desbloquear (",vr,")"]}),e.jsx("input",{style:E,type:"number",value:((Wx=p.gift_reward)==null?void 0:Wx.threshold)??"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,threshold:An(r.target.value)}})),placeholder:"120000"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Valor del regalo (tachado, opcional)"}),e.jsx("input",{style:E,type:"number",value:((qx=p.gift_reward)==null?void 0:qx.value_display)??"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,value_display:An(r.target.value)}})),placeholder:"30000"})]})]}),e.jsx("label",{style:D,children:"Nombre del regalo"}),e.jsx("input",{style:E,value:((Mx=p.gift_reward)==null?void 0:Mx.label)||"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,label:r.target.value}})),placeholder:"Un labial de regalo"}),e.jsx("label",{style:D,children:"Imagen del regalo (opcional)"}),e.jsx(Rn,{label:"Imagen del regalo",value:(Fx=p.gift_reward)==null?void 0:Fx.image,onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,image:r||void 0}})),uploadsEnabled:Ia,compact:!0}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Texto mientras falta (usa ","{falta}",")"]}),e.jsx("input",{style:E,value:((Ox=p.gift_reward)==null?void 0:Ox.progress_text)||"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,progress_text:r.target.value}})),placeholder:"Te faltan {falta} para tu regalo gratis"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto al desbloquear"}),e.jsx("input",{style:E,value:((Hx=p.gift_reward)==null?void 0:Hx.unlocked_text)||"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,unlocked_text:r.target.value}})),placeholder:"Regalo desbloqueado, va incluido gratis"})]})]}),e.jsx("label",{style:D,children:"ID producto Dropi del regalo (opcional)"}),e.jsx("input",{style:E,value:((Gx=p.gift_reward)==null?void 0:Gx.dropi_product_id)??"",onChange:r=>x(l=>({...l,gift_reward:{...l.gift_reward,dropi_product_id:r.target.value,...id}})),placeholder:"Solo si quieres que entre como lÃnea en Dropi (a $0)"}),Zs("gift_reward",p.gift_reward)]})}),!pt&&e.jsxs(e.Fragment,{children:[e.jsx(Ei,{children:"El embudo: durante y después de la compra"}),e.jsxs(ht,{title:"Upsell (oferta extra)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:He,onChange:r=>ut(r.target.checked)})," Activar"]})}),children:[He&&e.jsxs(e.Fragment,{children:[e.jsx(Ol,{mechanic:"upsell",product:p.product,bullets:(Vx=p.product)==null?void 0:Vx.bullets,onApply:r=>bo(r)}),e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((Ux=p.upsell)==null?void 0:Ux.headline)||"",onChange:r=>bo({headline:r.target.value}),placeholder:"¡Espera! Lleva 2 y ahorra"}),e.jsx("label",{style:D,children:"Texto"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:((Qx=p.upsell)==null?void 0:Qx.text)||"",onChange:r=>bo({text:r.target.value}),placeholder:"Agrega una segunda unidad con descuentoâ¦"}),e.jsx("label",{style:D,children:"Imagen del upsell"}),e.jsx(Rn,{label:"Imagen del upsell",value:(Kx=p.upsell)==null?void 0:Kx.image,onChange:r=>bo({image:r}),uploadsEnabled:Ia}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Pre
1132cio extra (",vr,")"]}),e.jsx("input",{style:E,type:"number",value:((Yx=p.upsell)==null?void 0:Yx.price)??"",onChange:r=>bo({price:An(r.target.value)}),placeholder:"49000"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"ID producto Dropi"}),e.jsx("input",{style:E,value:((Jx=p.upsell)==null?void 0:Jx.dropi_product_id)??"",onChange:r=>bo({dropi_product_id:r.target.value,...id}),placeholder:"Ej: 12346"}),Zs("upsell",p.upsell)]})]}),e.jsx("label",{style:D,children:"Temporizador real (minutos, opcional)"}),e.jsx("input",{style:{...E,maxWidth:120},type:"number",min:0,max:180,value:((Zx=p.upsell)==null?void 0:Zx.timer_minutes)??"",onChange:r=>bo({timer_minutes:An(r.target.value)}),placeholder:"0"}),e.jsx(mt,{children:"Cuenta regresiva de verdad dentro de la oferta: no se reinicia al recargar y al llegar a cero la oferta se cierra sola (el pedido continúa sin el extra). VacÃo o 0 = sin temporizador."})]}),Jn("upsell")]}),e.jsxs(ht,{title:"Downsell (si rechaza el upsell)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:Ge,onChange:r=>vt(r.target.checked)})," Activar"]})}),children:[Ge&&e.jsxs(e.Fragment,{children:[e.jsx(Ol,{mechanic:"downsell",product:p.product,bullets:(Xx=p.product)==null?void 0:Xx.bullets,onApply:r=>Un(r)}),e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((e0=p.downsell)==null?void 0:e0.headline)||"",onChange:r=>Un({headline:r.target.value}),placeholder:"¿Y si llevas 1 a mitad de precio?"}),e.jsx("label",{style:D,children:"Texto"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},value:((t0=p.downsell)==null?void 0:t0.text)||"",onChange:r=>Un({text:r.target.value}),placeholder:"Ãltima oportunidadâ¦"}),e.jsx("label",{style:D,children:"Imagen del downsell"}),e.jsx(Rn,{label:"Imagen del downsell",value:(a0=p.downsell)==null?void 0:a0.image,onChange:r=>Un({image:r}),uploadsEnabled:Ia}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Precio extra (",vr,")"]}),e.jsx("input",{style:E,type:"number",value:((n0=p.downsell)==null?void 0:n0.price)??"",onChange:r=>Un({price:An(r.target.value)}),placeholder:"29000"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"ID producto Dropi"}),e.jsx("input",{style:E,value:((o0=p.downsell)==null?void 0:o0.dropi_product_id)??"",onChange:r=>Un({dropi_product_id:r.target.value,...id}),placeholder:"Opcional"}),Zs("downsell",p.downsell)]})]}),e.jsx("label",{style:D,children:"Temporizador real (minutos, opcional)"}),e.jsx("input",{style:{...E,maxWidth:120},type:"number",min:0,max:180,value:((r0=p.downsell)==null?void 0:r0.timer_minutes)??"",onChange:r=>Un({timer_minutes:An(r.target.value)}),placeholder:"0"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:"Igual que en el upsell."})]}),Jn("downsell")]}),e.jsxs(ht,{title:"Oferta de salida (descuento si intenta cerrar)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((i0=p.exit_offer)!=null&&i0.enabled),onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,enabled:r.target.checked}}))})," Activar"]})}),children:[((s0=p.exit_offer)==null?void 0:s0.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:"Cuando el cliente toca la X del formulario, se le ofrece un descuento por completar el pedido (una vez por visita). El servidor aplica el descuento."}),e.jsx(Ol,{mechanic:"exit_offer",product:p.product,bullets:(l0=p.product)==null?void 0:l0.bullets,onApply:r=>x(l=>({...l,exit_offer:{...l.exit_offer,...r}}))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Descuento (%)"}),e.jsx("input",{style:E,type:"number",min:1,max:90,value:((d0=p.exit_offer)==null?void 0:d0.percent)??10,onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,percent:An(r.target.value)}})),placeholder:"10"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Temporizador real (min, opcional)"}),e.jsx("input",{style:E,type:"number",min:0,max:180,value:((c0=p.exit_offer)==null?void 0:c0.timer_minutes)??"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,timer_minutes:An(r.target.value)}})),placeholder:"0"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((u0=p.exit_offer)==null?void 0:u0.title)||"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,title:r.target.value}})),placeholder:"¡Espera!"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"SubtÃtulo"}),e.jsx("input",{style:E,value:((p0=p.exit_offer)==null?void 0:p0.subtitle)||"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,subtitle:r.target.value}})),placeholder:"¡Tenemos una oferta para ti!"})]})]}),e.jsx("label",{style:D,children:"Etiqueta superior (pÃldora)"}),e.jsx("input",{style:E,value:((g0=p.exit_offer)==null?void 0:g0.badge_text)||"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,badge_text:r.target.value}})),placeholder:"Oferta exclusiva por salir"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Botón aceptar (usa ","{discount}",")"]}),e.jsx("input",{style:E,value:((m0=p.exit_offer)==null?void 0:m0.accept_text)||"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,accept_text:r.target.value}})),placeholder:"Completa tu pedido con {discount}% de descuento"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Botón rechazar"}),e.jsx("input",{style:E,value:((h0=p.exit_offer)==null?void 0:h0.decline_text)||"",onChange:r=>x(l=>({...l,exit_offer:{...l.exit_offer,decline_text:r.target.value}})),placeholder:"No gracias"})]})]})]}),Jn("exit")]}),e.jsxs(ht,{title:"Quiz de bienvenida (desbloquea descuento)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((f0=p.entry_quiz)!=null&&f0.enabled),onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,enabled:r.target.checked}}))})," Activar"]})}),children:[((x0=p.entry_quiz)==null?void 0:x0.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:"Al entrar, una pregunta corta de
1132sbloquea un descuento (una vez por sesión). El servidor aplica el descuento y guarda el interés elegido en las notas del pedido (sirve para segmentar tus campañas)."}),e.jsx(Ol,{mechanic:"entry_quiz",product:p.product,bullets:(b0=p.product)==null?void 0:b0.bullets,onApply:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,...r}}))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Descuento que desbloquea (%)"}),e.jsx("input",{style:E,type:"number",min:0,max:90,value:((y0=p.entry_quiz)==null?void 0:y0.percent)??0,onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,percent:An(r.target.value)}})),placeholder:"10"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Cuándo mostrar"}),e.jsxs("select",{style:E,value:((v0=p.entry_quiz)==null?void 0:v0.trigger)||"load",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,trigger:r.target.value}})),children:[e.jsx("option",{value:"load",children:"Al entrar (tras unos segundos)"}),e.jsx("option",{value:"exit",children:"Cuando intenta salir"}),e.jsx("option",{value:"off",children:"Solo en la vista previa"})]})]})]}),e.jsx("label",{style:D,children:"Cinta superior animada"}),e.jsx("input",{style:E,value:((j0=p.entry_quiz)==null?void 0:j0.eyebrow)||"",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,eyebrow:r.target.value}})),placeholder:"Regalo especial"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((A0=p.entry_quiz)==null?void 0:A0.headline)||"",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,headline:r.target.value}})),placeholder:"¡Espera! Tenemos algo para ti"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Recompensa (pÃldora)"}),e.jsx("input",{style:E,value:((S0=p.entry_quiz)==null?void 0:S0.reward_text)||"",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,reward_text:r.target.value}})),placeholder:"10% de descuento"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:12,margin:"6px 0 2px",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("label",{style:{...D,margin:0},children:"Color del quiz"}),e.jsx("input",{type:"color",value:((w0=p.entry_quiz)==null?void 0:w0.color)||"#0866FF",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,color:r.target.value}})),style:{width:40,height:34,padding:2,border:"1px solid var(--border)",borderRadius:8,background:"transparent",cursor:"pointer"}}),((k0=p.entry_quiz)==null?void 0:k0.color)&&e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,entry_quiz:{...r.entry_quiz,color:""}})),style:{...ee,padding:"4px 8px",fontSize:11},children:"Auto"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Animación de la placa"}),e.jsxs("select",{style:{...E,maxWidth:160},value:((C0=p.entry_quiz)==null?void 0:C0.anim)||"none",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,anim:r.target.value}})),children:[e.jsx("option",{value:"none",children:"Ninguna"}),e.jsx("option",{value:"shine",children:"Brillo"}),e.jsx("option",{value:"pulse",children:"Latido"})]})]})]}),e.jsx("label",{style:D,children:"Imagen del quiz (opcional, mejor cuadrada)"}),e.jsx(Rn,{label:"Imagen del quiz",value:(_0=p.entry_quiz)==null?void 0:_0.image,onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,image:r||void 0}})),uploadsEnabled:Ia,compact:!0}),($0=p.entry_quiz)!=null&&$0.steps&&p.entry_quiz.steps.length?e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Pasos del quiz (máx 3 preguntas encadenadas)"}),(p.entry_quiz.steps||[]).map((r,l)=>e.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,padding:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:6},children:[e.jsxs("b",{style:{fontSize:12.5},children:["Paso ",l+1]}),e.jsx("button",{style:{...ee,padding:"2px 8px",fontSize:11,color:"var(--danger)"},onClick:()=>x(y=>{var R;return{...y,entry_quiz:{...y.entry_quiz,steps:(((R=y.entry_quiz)==null?void 0:R.steps)||[]).filter((P,re)=>re!==l)}}}
1132),children:"Quitar paso"})]}),e.jsx("input",{style:E,value:r.question||"",onChange:y=>x(R=>{var re;const P=[...((re=R.entry_quiz)==null?void 0:re.steps)||[]];return P[l]={...P[l],question:y.target.value},{...R,entry_quiz:{...R.entry_quiz,steps:P}}}),placeholder:"¿Para qué lo quieres?"}),(r.options||[]).map((y,R)=>e.jsxs("div",{style:{display:"flex",gap:8,marginTop:6},children:[e.jsx("input",{style:{...E,flex:3},value:y.label||"",onChange:P=>x(re=>{var Ee;const xe=[...((Ee=re.entry_quiz)==null?void 0:Ee.steps)||[]],Le=[...xe[l].options||[]];return Le[R]={...Le[R],label:P.target.value},xe[l]={...xe[l],options:Le},{...re,entry_quiz:{...re.entry_quiz,steps:xe}}}),placeholder:"Para mÃ"}),e.jsx("input",{style:{...E,flex:2},value:y.tag||"",onChange:P=>x(re=>{var Ee;const xe=[...((Ee=re.entry_quiz)==null?void 0:Ee.steps)||[]],Le=[...xe[l].options||[]];return Le[R]={...Le[R],tag:P.target.value},xe[l]={...xe[l],options:Le},{...re,entry_quiz:{...re.entry_quiz,steps:xe}}}),placeholder:"etiqueta"}),e.jsx("button",{style:{...ee,padding:"0 12px",color:"var(--danger)"},onClick:()=>x(P=>{var xe;const re=[...((xe=P.entry_quiz)==null?void 0:xe.steps)||[]];return re[l]={...re[l],options:(re[l].options||[]).filter((Le,Ee)=>Ee!==R)},{...P,entry_quiz:{...P.entry_quiz,steps:re}}}),children:"â"})]},R)),e.jsx("button",{style:{...ee,padding:"6px 10px",fontSize:12,marginTop:6},onClick:()=>x(y=>{var P;const R=[...((P=y.entry_quiz)==null?void 0:P.steps)||[]];return R[l]={...R[l],options:[...R[l].options||[],{label:""}]},{...y,entry_quiz:{...y.entry_quiz,steps:R}}}),children:"+ Agregar opción"})]},l)),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[p.entry_quiz.steps.length<3&&e.jsx("button",{style:{...ee,padding:"7px 12px",fontSize:12.5},onClick:()=>x(r=>{var l;return{...r,entry_quiz:{...r.entry_quiz,steps:[...((l=r.entry_quiz)==null?void 0:l.steps)||[],{question:"",options:[{label:""}]}]}}}),children:"+ Agregar paso"}),e.jsx("button",{style:{...ee,padding:"7px 12px",fontSize:12.5},onClick:()=>x(r=>({...r,entry_quiz:{...r.entry_quiz,steps:void 0}})),children:"Volver a una sola pregunta"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Pregunta"}),e.jsx("input",{style:E,value:((I0=p.entry_quiz)==null?void 0:I0.question)||"",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,question:r.target.value}})),placeholder:"¿Para qué lo quieres?"}),e.jsx("label",{style:D,children:"Opciones de respuesta (la etiqueta queda en el pedido)"}),(((T0=p.entry_quiz)==null?void 0:T0.options)||[]).map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:6},children:[e.jsx("input",{style:{...E,flex:3},value:r.label||"",onChange:y=>x(R=>{var re;const P=[...((re=R.entry_quiz)==null?void 0:re.options)||[]];return P[l]={...P[l],label:y.target.value},{...R,entry_quiz:{...R.entry_quiz,options:P}}}),placeholder:"Para mÃ"}),e.jsx("input",{style:{...E,flex:2},value:r.tag||"",onChange:y=>x(R=>{var re;const P=[...((re=R.entry_quiz)==null?void 0:re.options)||[]];return P[l]={...P[l],tag:y.target.value},{...R,entry_quiz:{...R.entry_quiz,options:P}}}),placeholder:"etiqueta"}),e.jsx("button",{style:{...ee,padding:"0 12px",color:"var(--danger)"},onClick:()=>x(y=>{var R;return{...y,entry_quiz:{...y.entry_quiz,options:(((R=y.entry_quiz)==null?void 0:R.options)||[]).filter((P,re)=>re!==l)}}}),children:"â"})]},l)),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("button",{style:{...ee,padding:"7px 12px",fontSize:12.5},onClick:()=>x(r=>{var l;return{...r,entry_quiz:{...r.entry_quiz,options:[...((l=r.entry_quiz)==null?void 0:l.options)||[],{label:""}]}}}),children:"+ Agregar opción"}),e.jsx("button",{style:{...ee,padding:"7px 12px",fontSize:12.5},onClick:()=>x(r=>{var R,P;const l=((R=r.entry_quiz)==null?void 0:R.question)||"",y=((P=r.entry_quiz)==null?void 0:P.options)||[];return{...r,entry_quiz:{...r.entry_quiz,steps:[{question:l,options:y.length?y:[{label:""}]},{question:"",options:[{label:""}]}]}}}),children:"+ Convertir en quiz de varios pasos"})]})]}),e.jsx("label",{style:D,children:"Texto de rechazar"}),e.jsx("input",{style:E,value:((E0=p.entry_quiz)==null?void 0:E0.decline_text)||"",onChange:r=>x(l=>({...l,entry_quiz:{...l.entry_quiz,decline_text:r.target.value}})),placeholder:"No, gracias"})]}),Jn("quiz")]}),e.jsxs(ht,{title:"Ruleta de descuento (gira y gana)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((z0=p.wheel)!=null&&z0.enabled),onChange:r=>x(l=>({...l,wheel:{...l.wheel,enabled:r.target.checked}}))})," Activar"]})}),children:[((R0=p.wheel)==null?void 0:R0.enabled)&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:"La ruleta siempre termina en tu descuento, que va en el gajo de arriba; los demás gajos son decorativos. Con dos giros, el primero cae en «Otra vez» y el segundo en el premio. El descuento lo a
1132plica el servidor, asà que nadie puede cobrarse uno distinto. Consejo: no la actives junto al quiz de bienvenida, son dos ventanas de entrada y cansan."}),e.jsx("label",{style:D,children:"Giros"}),e.jsx(jn,{small:!0,options:[{v:"",l:"Un giro"},{v:"2",l:"Dos giros (el primero en «Otra vez»)"}],value:((N0=p.wheel)==null?void 0:N0.spins)===2?"2":"",onPick:r=>x(l=>({...l,wheel:{...l.wheel,spins:r==="2"?2:void 0}}))}),((L0=p.wheel)==null?void 0:L0.spins)===2&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto del gajo «Otra vez»"}),e.jsx("input",{style:E,maxLength:12,value:((P0=p.wheel)==null?void 0:P0.retry_label)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,retry_label:r.target.value}})),placeholder:"Otra vez"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Mensaje tras el primer giro"}),e.jsx("input",{style:E,maxLength:80,value:((D0=p.wheel)==null?void 0:D0.retry_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,retry_text:r.target.value}})),placeholder:"¡Casi! Tienes un giro más"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Botón del segundo giro"}),e.jsx("input",{style:E,maxLength:40,value:((B0=p.wheel)==null?void 0:B0.button2_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,button2_text:r.target.value}})),placeholder:"Girar otra vez"})]})]}),(()=>{var rt,Ft,Tt,fa,Ha,Fn;const r=Math.max(1,Math.min(90,Number((rt=p.wheel)==null?void 0:rt.percent)||10)),l=[`${Math.max(1,Math.floor(r/3))}%`,`${Math.max(1,Math.floor(r/2))}%`,"Casi",`${Math.max(1,Math.floor(r/5))}%`,`${Math.max(1,Math.floor(r/3))}%`],y=Array.isArray((Ft=p.wheel)==null?void 0:Ft.segments)&&p.wheel.segments.length?p.wheel.segments:l,R=Ya=>x(Xn=>({...Xn,wheel:{...Xn.wheel,segments:Ya}})),P=((Tt=p.wheel)==null?void 0:Tt.spins)===2,re=y.filter(Ya=>String(Ya||"").trim()).length,xe=Array.isArray((fa=p.wheel)==null?void 0:fa.segments)&&re>=3,Le=P?6:7,Ee=y.length+1+(P&&xe?1:0),Oe=Ee<=5?12:Ee===6?9:7,St=y.filter(Ya=>{const Xn=String(Ya).match(/(\d{1,3})\s*%/);return!!Xn&&Number(Xn[1])>r});return e.jsxs(e.Fragment,{children:[e.jsx("label",{style:D,children:"Gajos de la ruleta (el primero es tu premio)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(110px, 1fr))",gap:8},children:[e.jsxs("div",{style:{...E,marginTop:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,background:"var(--input-bg, #f4f6fb)"},children:[r,"% (premio)"]}),y.map((Ya,Xn)=>e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("input",{style:{...E,marginTop:0,minWidth:0},maxLength:Oe,value:Ya,onChange:Es=>R(y.map((Xe,$t)=>$t===Xn?Es.target.value:Xe))}),y.length>3&&e.jsx("button",{type:"button",onClick:()=>R(y.filter((Es,Xe)=>Xe!==Xn)),title:"Quitar gajo",style:{...ee,padding:"4px 8px",color:"var(--danger)"},children:"â"})]},Xn))]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:8,flexWrap:"wrap"},children:[y.length<Le&&e.jsx("button",{type:"button",onClick:()=>R([...y,"Casi"]),style:{...ee,padding:"6px 11px",fontSize:12.5},children:"+ Agregar gajo"}),Array.isArray((Ha=p.wheel)==null?void 0:Ha.segments)&&e.jsx("button",{type:"button",onClick:()=>x(Ya=>({...Ya,wheel:{...Ya.wheel,segments:void 0}})),style:{...ee,padding:"6px 11px",fontSize:12.5},children:"Volver a los de siempre"})]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"6px 2px 0"},children:["Con ",Ee," gajos caben ",Oe," letras por gajo.",P&&xe?" Con dos giros se agrega el gajo «Otra vez» frente al premio.":""]}),Array.isArray((Fn=p.wheel)==null?void 0:Fn.segments)&&re<3&&e.jsx("p",{style:{fontSize:11.5,color:"#B45309",margin:"4px 2px 0"},children:"Escribe al menos 3 gajos; con menos se usan los de siempre."}),St.length>0&&e.jsxs("p",{style:{fontSize:11.5,color:"#B45309",margin:"6px 2px 0"},children:[St.join(", ")," es más que tu premio y la ruleta nunca cae ahÃ. Si parece que se puede ganar, la SIC lo puede leer como publicidad engañosa."]})]})})(),e.jsxs("label",{style:D,children:["Texto al ganar (usa ","{discount}",")"]}),e.jsx("input",{style:E,maxLength:80,value:((W0=p.wheel)==null?void 0:W0.win_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,win_text:r.target.value}})),placeholder:"¡Ganaste {discount}% de descuento!"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Descuento que gana (%)"}),e.jsx("input",{style:E,type:"number",min:1,max:90,value:((q0=p.wheel)==null?void 0:q0.percent)??10,onChange:r=>x(l=>({...l,wheel:{...l.wheel,percent:An(r.target.value)}})),placeholder:"10"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Cuándo mostrar"}),e.jsxs("select",{style:E,value:((M0=p.wheel)==null?void 0:M0.trigger)||"load",onChange:r=>x(l=>({...l,wheel:{...l.wheel,trigger:r.target.value}})),children:[e.jsx("option",{value:"load",children:"Al entrar (tras unos segundos)"}),e.jsx("option",{value:"exit",children:"Cuando intenta salir"})]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo"}),e.jsx("input",{style:E,value:((F0=p.wheel)==null?void 0:F0.title)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,title:r.target.value}})),placeholder:"¡Gira y gana tu descuento!"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"SubtÃtulo"}),e.jsx("input",{style:E,value:((O0=p.wheel)==null?void 0:O0.subtitle)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,subtitle:r.target.value}})),placeholder:"Toca el botón y mira qué te toca"})]})]}),e.jsx("label",{style:D,children:"Etiqueta superior (pÃldora)"}
1132),e.jsx("input",{style:E,value:((H0=p.wheel)==null?void 0:H0.badge_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,badge_text:r.target.value}})),placeholder:"Tienes un giro gratis"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Botón de girar"}),e.jsx("input",{style:E,value:((G0=p.wheel)==null?void 0:G0.button_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,button_text:r.target.value}})),placeholder:"Girar la ruleta"})]}),e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Botón al ganar (usa ","{discount}",")"]}),e.jsx("input",{style:E,value:((V0=p.wheel)==null?void 0:V0.accept_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,accept_text:r.target.value}})),placeholder:"Usar mi {discount}% de descuento"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:1,minWidth:160},children:[e.jsx("label",{style:D,children:"Botón rechazar"}),e.jsx("input",{style:E,value:((U0=p.wheel)==null?void 0:U0.decline_text)||"",onChange:r=>x(l=>({...l,wheel:{...l.wheel,decline_text:r.target.value}})),placeholder:"No, gracias"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingBottom:2},children:[e.jsx("label",{style:{...D,margin:0},children:"Color de la ruleta"}),e.jsx("input",{type:"color",value:((Q0=p.wheel)==null?void 0:Q0.color)||((K0=p.theme)==null?void 0:K0.button_color)||((Y0=p.theme)==null?void 0:Y0.accent)||"#0866FF",onChange:r=>x(l=>({...l,wheel:{...l.wheel,color:r.target.value}})),style:{width:40,height:34,padding:2,border:"1px solid var(--border)",borderRadius:8,background:"transparent",cursor:"pointer"}}),((J0=p.wheel)==null?void 0:J0.color)&&e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,wheel:{...r.wheel,color:""}})),style:{...ee,padding:"4px 8px",fontSize:11},children:"Auto"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingBottom:2},children:[e.jsx("label",{style:{...D,margin:0},children:"Segundo color"}),e.jsx("input",{type:"color",value:((Z0=p.wheel)==null?void 0:Z0.color2)||"#ffffff",onChange:r=>x(l=>({...l,wheel:{...l.wheel,color2:r.target.value}})),style:{width:40,height:34,padding:2,border:"1px solid var(--border)",borderRadius:8,background:"transparent",cursor:"pointer"}}),((X0=p.wheel)==null?void 0:X0.color2)&&e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,wheel:{...r.wheel,color2:""}})),style:{...ee,padding:"4px 8px",fontSize:11},children:"Blanco"})]})]})]}),Jn("ruleta")]})]})]}),Oa==="upsell"&&!ke&&e.jsx(e.Fragment,{children:e.jsxs(ht,{title:"Descuento por referido (se muestra en la página de gracias)",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!((e1=p.referral)!=null&&e1.enabled),onChange:r=>x(l=>({...l,referral:{...l.referral,enabled:r.target.checked}}))})," Activar"]})}),children:[((t1=p.referral)==null?void 0:t1.enabled)&&e.jsxs(e.Fragment,{children:[e.jsxs(mt,{children:["Tras comprar, el cliente puede compartir tu tienda. Su link lleva un código y, cuando otra persona entra por ahÃ, le aparece un popup con tu descuento de cortesÃa. El servidor aplica el descuento y permite ",e.jsx("b",{children:"un solo descuento por cliente"})," (un mismo teléfono no lo puede usar dos veces)."]}),e.jsx(Ol,{mechanic:"referral",product:p.product,bullets:(a1=p.product)==null?void 0:a1.bullets,onApply:r=>x(l=>({...l,referral:{...l.referral,...r}}))}),e.jsx("label",{style:D,children:"Descuento de cortesÃa (%)"}),e.jsx("input",{style:{...E,maxWidth:120},type:"number",min:1,max:90,value:((n1=p.referral)==null?void 0:n1.percent)??5,onChange:r=>x(l=>({...l,referral:{...l.referral,percent:An(r.target.value)}})),placeholder:"5"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Etiqueta superior (pÃldora)"}),e.jsx("input",{style:E,value:((o1=p.referral)==null?void 0:o1.badge_text)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,badge_text:r.target.value}})),placeholder:"Te recomendaron esta tienda"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo del popup"}),e.jsx("input",{style:E,value:((r1=p.referral)==null?void 0:r1.title)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,title:r.target.value}})),placeholder:"Tienes un descuento de cortesÃa"})]})]}),e.jsx("label",{style:D,children:"SubtÃtulo del popup"}),e.jsx("input",{style:E,value:((i1=p.referral)==null?void 0:i1.subtitle)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,subtitle:r.target.value}})),placeholder:"Un cliente te compartió este producto. Aprovecha tu descuento, pagando contraentrega."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:D,children:["Botón aceptar (usa ","{discount}",")"]}),e.jsx("input",{style:E,value:((s1=p.referral)==null?void 0:s1.accept_text)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,accept_text:r.target.value}})),placeholder:"Aplicar mi {discount}% de descuento"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Botón rechazar"}),e.jsx("input",{style:E,value:((l1=p.referral)==null?void 0:l1.decline_text)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,decline_text:r.target.value}})),placeholder:"No, gracias"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"TÃtulo en página de gracias"}),e.jsx("input",{style:E,value:((d1=p.referral)==null?void 0:d1.share_title)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,share_title:r.target.value}})),placeholder:"Compártelo con un amigo"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Texto en página de gracias"}),e.jsx("input",{style:E,value:((c1=p.referral)==null?void 0:c1.share_subtitle)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,share_subtitle:r.target.value}})),placeholder:`Si conoces a alguien a quien le sirva, pásale tu link. Se lleva un ${((u1=p.referral)==null?void 0:u1.percent)??5}% de descuento.`})]})]}),e.jsx("label",{style:D,children:"Texto del botón (en la página de gracias)"}),e.jsx("input",{style:E,value:((p1=p.referral)==null?void 0:p1.button_text)||"",onChange:r=>x(l=>({...l,referral:{...l.referral,button_text:r.target.value}})),placeholder:"Compartir mi link"}),e.jsx("label",{style:{...D,marginTop:12,fontWeight:700},children:"Apariencia de la tarjeta"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) minmax(0, 1fr)",gap:12,alignItems:"end"},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Color"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("input",{type:"color",value:((g1=p.referral)==null?void 0:g1.color)||"#16a34a",onChange:r=>x(l=>({...l,referral:{...l.referral,color:r.target.value}})),style:{width:40,height:38,padding:2,border:"1px solid var(--border)",borderRadius:8,background:"transparent",curs
1132or:"pointer"}}),((m1=p.referral)==null?void 0:m1.color)&&e.jsx("button",{type:"button",onClick:()=>x(r=>({...r,referral:{...r.referral,color:""}})),style:{...ee,padding:"4px 8px",fontSize:11},children:"Auto"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Tamaño"}),e.jsxs("select",{style:E,value:((h1=p.referral)==null?void 0:h1.size)||"md",onChange:r=>x(l=>({...l,referral:{...l.referral,size:r.target.value}})),children:[e.jsx("option",{value:"sm",children:"Pequeño"}),e.jsx("option",{value:"md",children:"Mediano"}),e.jsx("option",{value:"lg",children:"Grande"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Animación"}),e.jsxs("select",{style:E,value:((f1=p.referral)==null?void 0:f1.anim)||"pulse",onChange:r=>x(l=>({...l,referral:{...l.referral,anim:r.target.value}})),children:[e.jsx("option",{value:"none",children:"Ninguna"}),e.jsx("option",{value:"pulse",children:"Latido suave"}),e.jsx("option",{value:"shine",children:"Brillo"})]})]})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 8px"},children:'Color en "Auto" = el color de tu marca.'})]}),Jn("gracias")]})}),Oa==="landing"&&e.jsx(e.Fragment,{children:e.jsx(ht,{title:"Pie de página",right:e.jsx(e.Fragment,{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:Cr,onChange:r=>xn({enabled:r.target.checked})})," Activar"]})}),children:Cr&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{children:"Aparece al final de la landing. Las polÃticas se abren en una ventana al tocarlas â no necesitas páginas aparte. Vienen listas (incluyen privacidad y derecho de retracto, obligatorias en Colombia); revisa y reemplaza los textos entre [corchetes] con tus datos. Si llenas tu contacto aquÃ, las polÃticas se completan solas."}),e.jsx(Ea,{ai:{field:"Franja de reaseguro del pie",instruction:"Una frase de máximo 110 caracteres que reafirma el pago contraentrega: recibe, revisa y paga en efectivo. Sin emojis",current:kn.reassurance??"",productName:q.name||"",onPick:r=>xn({reassurance:r})},children:"Franja de reaseguro"}),e.jsx("input",{style:E,value:kn.reassurance??"Pago 100% contraentrega: pagas cuando recibes tu pedido en la puerta de tu casa.",onChange:r=>xn({reassurance:r.target.value}),placeholder:"Pago 100% contraentrega: pagas cuando recibes tu pedido en la puerta de tu casa."}),e.jsx("label",{style:D,children:"Nombre del negocio"}),e.jsx("input",{style:E,value:kn.business_name||"",onChange:r=>xn({business_name:r.target.value}),placeholder:"Tu tienda"}),e.jsx("label",{style:D,children:"NIT / Cédula"}),e.jsx("input",{style:E,value:kn.nit||"",onChange:r=>xn({nit:r.target.value}),placeholder:"900.123.456-7 (opcional)"}),e.jsx("label",{style:D,children:"Dirección"}),e.jsx("input",{style:E,value:kn.address||"",onChange:r=>xn({address:r.target.value}),placeholder:"Cra 00 #00-00, Ciudad"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,1fr) minmax(0,1fr)",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Correo"}),e.jsx("input",{style:E,value:kn.email||"",onChange:r=>xn({email:r.target.value}),placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx("label",{style:D,children:"Teléfono / WhatsApp"}),e.jsx("input",{style:E,value:kn.phone||"",onChange:r=>xn({phone:r.target.value}),placeholder:"3001234567"})]})]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0"},children:["El nombre del negocio y un contacto real son obligatorios por ley para vender contraentrega y suben la conversión.",Cr&&!kn.email&&!kn.phone?e.jsx("span",{style:{color:"var(--warning)",fontWeight:600},children:" Agrega al menos un correo o WhatsApp."}):null]}),e.jsx("label",{style:{...D,marginTop:14},children:"Pruebas de autoridad"}),ui.map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[e.jsx("input",{style:{...E,flex:1},value:r||"",onChange:y=>Us(l,y.target.value),placeholder:"Pago contraentrega"}),e.jsx("button",{style:{...ee,padding:"0 12px",color:"var(--danger)"},onClick:()=>Ui(l),title:"Quitar",children:"â"})]},l)),e.jsx("button",{style:{...ee,padding:"7px 13px",fontSize:12.5,opacity:ui.length>=6?.5:1},disabled:ui.length>=6,onClick:Qs,children:"+ Agregar prueba"}),ui.length>=6&&e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0"},children:"Máximo 6 para que se vean bien en móvil."}),e.jsx("label",{style:{...D,marginTop:14},children:"PolÃticas (se abren al tocarlas)"}),fs.map((r,l)=>e.jsxs("div",{style:{border:"1px solid var(--border, #e6e8ee)",borderRadius:10,padding:10,marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:6},children:[e.jsx("input",{style:{...E,flex:1,fontWeight:700},value:r.title||"",onChange:y=>_c(l,{title:y.target.value}),placeholder:"TÃtulo de la polÃtica"}),e.jsx("button",{style:{...ee,padding:"0 12px",color:"var(--danger)"},onClick:()=>$c(l),title:"Quitar",children:"â"})]}),e.jsx("textarea",{style:{...E,minHeight:72,resize:"vertical"},value:r.content||"",onChange:y=>_c(l,{content:y.target.value}),placeholder:"Texto de la polÃticaâ¦"})]},l)),e.jsx("button",{style:{...ee,padding:"7px 13px",fontSize:12.5},onClick:Ze,children:"+ Agregar polÃtica"}),e.jsx("label",{style:{...D,marginTop:14},children:"Enlaces externos (opcional)"}),pi.map((r,l)=>e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[e.jsx("input",{style:{...E,flex:1,minWidth:0},value:r.label||"",onChange:y=>
1132dr(l,{label:y.target.value}),placeholder:"Nombre"}),e.jsx("input",{style:{...E,flex:1.5,minWidth:0},value:r.url||"",onChange:y=>dr(l,{url:y.target.value}),placeholder:"https://â¦"}),e.jsx("button",{style:{...ee,padding:"0 12px",color:"var(--danger)"},onClick:()=>Ic(l),title:"Quitar",children:"â"})]},l)),e.jsx("button",{style:{...ee,padding:"7px 13px",fontSize:12.5},onClick:Ks,children:"+ Agregar enlace"}),e.jsx("label",{style:{...D,marginTop:14},children:"LÃnea legal"}),e.jsx("input",{style:E,value:kn.legal||"",onChange:r=>xn({legal:r.target.value}),placeholder:`© ${new Date().getFullYear()} Tu tienda. Todos los derechos reservados. (automático)`})]})})}),Oa==="pixeles"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{margin:"2px 2px 12px"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:800,letterSpacing:"-.015em"},children:"Dominio y medición"}),e.jsx("p",{style:{fontSize:12.5,color:"var(--text-muted)",margin:"3px 0 0",lineHeight:1.5,maxWidth:640},children:"Tu dirección propia y los pÃxeles de Meta y TikTok, para que tus anuncios midan bien las ventas."})]}),e.jsxs(ht,{title:pt?"¿Qué cuenta como lead? (optimización de anuncios)":"¿Qué cuenta como venta? (optimización de anuncios)",children:[pt?e.jsxs(mt,{children:["Cuando muevas una solicitud a esta etapa en el CRM, le avisamos a TikTok que fue una ",e.jsx("b",{children:"venta real"})," (con el código del clic, ttclid). Elige la etapa en que cierras la venta de tu servicio."]}):e.jsxs(mt,{children:["Los pedidos del ",e.jsx("b",{children:"formulario"})," y los que se ",e.jsx("b",{children:"cierran por WhatsApp"})," (los cierra tu agente o pasas la tarjeta del contacto a pedido) le llegan a Meta y TikTok como compra en el momento en que se crean, con el clic del anuncio. Esta etapa es para los demás pedidos, los que registras a mano."]}),e.jsxs("select",{style:E,value:p.conversion_stage||"entregado",onChange:r=>x(l=>({...l,conversion_stage:r.target.value})),children:[e.jsx("option",{value:"confirmado",children:'Cuando lo marco "confirmado" (ideal para asesorÃas / servicios)'}),e.jsx("option",{value:"despachado",children:'Cuando lo marco "despachado"'}),e.jsx("option",{value:"entregado",children:'Cuando lo marco "entregado" (ideal para Dropi / contraentrega)'})]})]}),e.jsx("div",{id:"seccion-dominio",children:e.jsx(ht,{title:"Dominio de la landing",children:we&&g.use_lumy_domain?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"Esta landing vive en tu dominio de marca (estilo Shopify):"}),e.jsxs("div",{style:{border:"1px solid rgba(22,163,74,.3)",background:"rgba(22,163,74,.06)",borderRadius:12,padding:"13px 15px"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".4px"},children:"Tu dirección"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:5,flexWrap:"wrap"},children:[e.jsxs("span",{style:{color:"#16a34a",fontFamily:"monospace",fontSize:14,fontWeight:800},children:[we,"/"]}),e.jsx("input",{value:st,onChange:r=>la(r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:g.slug,style:{...E,width:150,fontFamily:"monospace",fontSize:14,padding:"5px 9px",margin:0}}),ha&&e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12},onClick:ia,children:"Guardar ruta"}),xt==="published"&&ha&&e.jsx("p",{role:"status",style:{width:"100%",fontSize:12,color:"var(--warning, #b45309)",fontWeight:700,margin:"6px 0 0",lineHeight:1.45},children:"La dirección vieja deja de funcionar de una vez. Si tienes anuncios apuntando ahÃ, cámbiales el enlace."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:8,fontSize:12.5},children:[xt==="published"&&e.jsx("a",{href:`https://${we}/${g.slug}`,target:"_blank",rel:"noreferrer",style:{color:me},children:"Abrir â"}),e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12},onClick:()=>{var r;try{(r=navigator.clipboard)==null||r.writeText(`https://${we}/${g.slug}`),Gt(!0),setTimeout(()=>Gt(!1),1500)}catch{}},children:La?"Copiado â":"Copiar"})]}),e.jsxs(mt,{children:["Todas tus páginas nuevas usan tu dominio de marca (",e.jsx("b",{children:we}),"), cada una con su nombre. El dominio se conecta una sola vez en tu ",e.jsx("b",{children:"Tienda"}),"."]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"13px 15px",marginBottom:14},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".4px"},children:"Dirección de esta página"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:5,flexWrap:"wrap"},children:[e.jsx("span",{style:{color:"var(--text-muted)",fontFamily:"monospace",fontSize:13.5},children:da}),e.jsx("input",{value:st,onChange:r=>la(r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:g.slug,style:{...E,width:170,fontFamily:"monospace",fontSize:14,padding:"5px 9px",margin:0}}),ha&&e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12},onClick:ia,children:"Guardar"})]}),xt==="published"&&ha&&e.jsx("p",{role:"status",style:{fontSize:12,color:"var(--warning, #b45309)",fontWeight:700,margin:"7px 0 0",lineHeight:1.45},children:"La dirección vieja deja de funcionar de una vez. Si tienes anuncios apuntando ahÃ, cámbiales el enlace."}),!!st&&st.length<3&&st!==g.slug&&e.jsx("p",{role:"status",style:{fontSize:12,color:"var(--danger)",fontWeight:700,margin:"7px 0 0"},children:"La dirección necesita al menos 3 letras."})]}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"Una dirección propia, más bonita que el enlace /l/."}),g.custom_domain&&!qi(g.custom_domain)?e.jsxs("div",{style:{border:`1px solid ${F!=null&&F.active?"rgba(22,163,74,.3)":"var(--border, #e8eaf0)"}`,background:F!=null&&F.active?"rgba(22,163,74,.06)":"var(--input-bg, #fafbff)",borderRadius:12,padding:"13px 15px"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".4px"},children:"Dominio propio"}),e.jsxs("div",{style:{marginTop:3,fontSize:14,fontWeight:800},children:["Abre en ",e.jsx("span",{style:{color:me,fontFamily:"monospace"},children:g.custom_domain})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:8,fontSize:12.5},children:[F!=null&&F.active?e.jsx("span",{style:{color:"var(--success)",fontWeight:800},children:"Candado listo â"}):(F==null?void 0:F.mode)==="cloudflare"?e.jsx("span",{style:{color:"var(--warning)",fontWeight:700},children:F.found===!1?"Registrandoâ¦":`Esperando el candado (${F.ssl_status||F.status||"pendiente"}).`}):e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:"Crea el CNAME y dale Verificar."}),e.jsx("button",{style:{...ee,padding:"5px 10px",fontSize:12},onClick:ct,children:"Verificar"}),xt==="published"&&e.jsx("a",{href:`https://${g.custom_domain}/`,target:"_blank",rel:"noreferrer",style:{color:me},children:"Abrir â"})]}),e.jsx("a",{href:"/landing/pixeles",target:"_blank",rel:"noreferrer",style:{display:"inline-block",marginTop:9,fontSize:12,fontWeight:700,color:me,textDecoration:"none"},children:"Gestionar dominios â"})]}):e.jsxs("a",{href:"/landing/pixeles",target:"_blank",rel:"noreferrer",style:{display:"flex",alignItems:"center",gap:11,textDecoration:"none",border:`1.5px solid ${me}`,background:me+"0c",borderRadius:12,padding:"13px 15px"},children:[e.jsx("span",{style:{flex:"none",width:30,height:30,borderRadius:8,background:me,color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3 12h18M12 3c2.5 2.5 2.5 16 0 18M12 3c-2.5 2.5-2.5 16 0 18"})]})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",fontWeight:800,fontSize:13.5,color:me},children:"Conecta tu dominio propio"}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:"Una sola vez en Pixeles â Dominio propio (se abre en otra pestaña)."})]}),e.jsx("span",{style:{flex:"none",color:me,fontWeight:800,fontSize:16},children:"â"})]}),(()=>{var re;const r=String(g.custom_domain||""),l=Array.isArray((re=g.config)==null?void 0:re.custom_domains)?g.config.custom_domains:[],y=Array.from(new Set([...l,r].filter(xe=>xe&&!qi(xe))));if(y.length<2)return null;const R=async xe=>{if(confirm(`¿Quitar ${xe}? Se desconectará de Cloudflare (puedes volver a conectarlo después).`)&&await Ai(!0))try{const Ee=await(await n(`/api/landing/pages/${t}/domain-remove`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:xe,expected_updated_at:un.current||void 0})})).json();Ee.ok?(un.current=String(Ee.page.updated_at||un.current),f(Ee.page),V(os(Ee.page.config||{})),Fe(Ee.page.custom_domain||"")):ue(Ee.message||"No se pudo quitar el dominio. Actualiza e intenta de nuevo.")}catch{}finally{zt()}},P=yt?y.filter(xe=>xe!==r&&!yt.has(xe)).length:0;return e.jsx("div",{style:{marginTop:14,paddingTop:10,borderTop:"1px solid var(--border, #eef0f5)"},children:e.jsxs(xg,{clave:"dominios-editor-conectados",titulo:`Dominios conectados (${y.length})`,resumen:P>0?e.jsxs("span",{style:{color:"var(--warning)"},children:["· ",P," activándose"]}):void 0,children:[e.jsx(mt,{children:"Puedes tener varios conectados y elegir cuál abre esta página. El activo es el que se muestra; los demás quedan listos para cambiar al instante."}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:7},children:y.map(xe=>{const Le=xe===r;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,border:`1px solid ${Le?"rgba(22,163,74,.3)":"var(--border, #e8eaf0)"}`,background:Le?"rgba(22,163,74,.06)":"var(--card-bg, #fff)",borderRadius:10,padding:"8px 11px"},children:[e.jsx("span",{style:{flex:1,minWidth:0,fontFamily:"monospace",fontSize:12.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:xe}),Le?e.jsx("span",{style:{flex:"none",fontSize:11,fontWeight:800,color:"#16a34a",whiteSpace:"nowrap"},children:"En uso"}
1132):!yt||yt.has(xe)?e.jsx("button",{type:"button",onClick:()=>{Fe(xe),ue("Cambiando dominioâ¦")},style:{flex:"none",...ee,padding:"5px 12px",fontSize:12,fontWeight:700,color:me,borderColor:me},children:"Usar"}):e.jsx("span",{title:"TodavÃa se está activando. Cuando quede listo lo podrás usar aquÃ.",style:{flex:"none",fontSize:11,fontWeight:800,color:"var(--warning, #b45309)",whiteSpace:"nowrap"},children:"Activandoâ¦"}),e.jsx("button",{type:"button",onClick:()=>R(xe),title:"Quitar",style:{flex:"none",background:"none",border:"none",color:"var(--danger)",fontSize:12,fontWeight:700,cursor:"pointer",padding:"2px 4px"},children:"Quitar"})]},xe)})})]})})})(),!(g.custom_domain&&!qi(g.custom_domain))&&e.jsxs("div",{style:{marginTop:14,paddingTop:14,borderTop:"1px solid var(--border, #eef0f5)"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".4px",marginBottom:8},children:"O usa la dirección gratis de Lumy"}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",border:"1.5px solid var(--border, #dde)",borderRadius:10,overflow:"hidden"},children:[e.jsx("input",{style:{...E,border:"none",borderRadius:0,fontFamily:"monospace",flex:1,minWidth:0},value:he,onChange:r=>Me(r.target.value),placeholder:I||"dulcebrillo"}),e.jsx("span",{style:{display:"flex",alignItems:"center",padding:"0 10px",background:"var(--input-bg, #f2f4f9)",color:"var(--text-muted)",fontFamily:"monospace",fontSize:13,whiteSpace:"nowrap"},children:".lumycol.com"})]}),e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"6px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Cargará en ",e.jsxs("code",{children:["https://",he||"tunombre",".lumycol.com/"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:8,minHeight:30},children:[e.jsx("button",{style:{...ee,padding:"6px 11px",fontSize:12.5,opacity:he?1:.5,cursor:he?"pointer":"default"},disabled:!he,onClick:async()=>{try{(await(await n("/api/landing/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({default_subdomain:he})})).json()).ok&&(H(he),De("Guardado como tu marca â"),setTimeout(()=>De(""),3e3))}catch{}},children:"Usar como mi marca por defecto"}),ye&&e.jsx("span",{role:"status",style:{fontSize:12.5,color:"var(--success)"},children:ye})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"2px 0 0",minHeight:16},children:I?e.jsxs(e.Fragment,{children:["Tu marca: ",e.jsx("b",{children:I}),". Cada landing puede tener su propio nombre (ej: ",I,"-collar)."]}):"Escribe solo un nombre y se arma la dirección."})]})]})})}),Cs]}),e.jsxs("div",{className:"lk-editor-foot",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:8},children:[e.jsx("button",{style:{...ee,color:"var(--danger)",borderColor:"var(--notice-danger-border)"},onClick:ws,children:"Borrar landing"}),e.jsx("button",{style:xa,onClick:()=>fr(),disabled:Qt,children:Qt?"Guardandoâ¦":"Guardar cambios"})]})]})]})]})]})}function N8({existentes:t,onAgregar:a}){const n=$a(),o=np(),[i,s]=h.useState(!1),[u,m]=h.useState(""),[c,g]=h.useState(!1),[f,b]=h.useState(null),v=async()=>{if(u.trim().length<15){b({ok:!1,t:"Pega primero las reseñas reales que te dejaron tus clientes."});return}g(!0),b(null);try{const S=await(await n("/api/landing/ordenar-resenas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({texto:u,existentes:t,provider:o})})).json().catch(()=>null);if(!(S!=null&&S.ok)){b({ok:!1,t:(S==null?void 0:S.message)||"No se pudieron ordenar. Intenta de nuevo."});return}const $=Array.isArray(S.items)?S.items:[],C=Number(S.descartadas)>0?` ${S.descartadas} no estaban tal cual en tu texto y quedaron por fuera.`:"";if(!$.length){b({ok:!1,t:(Number(S.repetidas)>0?"Esas reseñas ya están en tu lista.":"No encontré reseñas en lo que pegaste.")+C});return}a($.map(_=>({name:String(_.name||""),city:String(_.city||""),text:String(_.text||""),..._.stars?{stars:Number(_.stars)}:{},verified:!1}))),m(""),b({ok:!0,t:`Agregué ${$.length} ${$.length===1?"reseña":"reseñas"} al final de la lista. RevÃsalas antes de guardar.${C}`})}catch{b({ok:!1,t:"Error de conexión. Intenta de nuevo."})}finally{g(!1)}};return e.jsxs("div",{style:{marginTop:10},children:[i?e.jsxs("div",{style:{border:"1.5px dashed var(--border, #dde)",borderRadius:12,padding:10},children:[e.jsx("label",{style:{...D,marginTop:0},children:"Pega tus reseñas reales"}),e.jsx("textarea",{style:{...E,minHeight:110,resize:"vertical"},value:u,onChange:j=>m(j.target.value),maxLength:12e3,placeholder:"Copia y pega los comentarios de tus clientes tal como te llegaron: WhatsApp, Google, Instagram u otra tienda."}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:8,flexWrap:"wrap"},children:[e.jsx("button",{type:"button",style:{...xa,padding:"9px 14px",opacity:c?.6:1},disabled:c,onClick:v,children:c?"Ordenandoâ¦":"Ordenar y agregar"}),e.jsx("button",{type:"button",style:ee,disabled:c,onClick:()=>{s(!1),b(null)},children:"Cerrar"})]}),e.jsx(mt,{children:"La IA solo las separa en nombre, ciudad, texto y estrellas; no escribe reseñas."})]}):e.jsxs("button",{type:"button",style:{...ee,display:"inline-flex",alignItems:"center",gap:6},onClick:()=>{s(!0),b(null)},children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"13",height:"13",fill:me,children:e.jsx("path",{d:"M11 2l1.6 5L18 8.6l-5.4 1.6L11 16l-1.6-
11325.8L4 8.6 9.4 7 11 2zm7 10l.85 2.65L21.5 15l-2.65.85L18 18.5l-.85-2.65L14.5 15l2.65-.85L18 12z"})}),"Ordenar reseñas con IA"]}),f&&e.jsx("div",{role:"status",style:{fontSize:12.5,marginTop:8,lineHeight:1.45,color:f.ok?"var(--success)":"var(--danger)"},children:f.t})]})}function So({field:t,instruction:a,current:n,productName:o,context:i,images:s,multiline:u,listMax:m,onPick:c}){const g=$a(),f=np(),[b,v]=h.useState(!1),[j,S]=h.useState(!1),[$,C]=h.useState([]),[_,N]=h.useState(""),w=h.useRef([]),M=h.useCallback(async()=>{S(!0),N("");try{const L=await(await g("/api/landing/suggest-field",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:t,instruction:a,current:n,product_name:o,context:i,images:(s||[]).filter(z=>typeof z=="string"&&/^https:\/\//i.test(z)).slice(0,4),list:!!u,list_max:m,provider:f,avoid:w.current.slice(-12)})})).json();if(!L.ok){N(L.message||"No se pudo generar."),C([]);return}const x=Array.isArray(L.suggestions)?L.suggestions:[];C(x),w.current=[...w.current,...x]}catch{N("Error de conexión. Intenta de nuevo.")}finally{S(!1)}},[g,t,a,n,o,i,f,s,u,m]),p=()=>{w.current=[],v(!0),C([]),N(""),M()};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",title:"Sugerir con IA",onClick:p,style:Y2,children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"currentColor",children:e.jsx("path",{d:"M11 2l1.6 5L18 8.6l-5.4 1.6L11 16l-1.6-5.8L4 8.6 9.4 7 11 2zm7 10l.85 2.65L21.5 15l-2.65.85L18 18.5l-.85-2.65L14.5 15l2.65-.85L18 12z"})}),"IA"]}),b&&e.jsx("div",{style:J2,onClick:()=>v(!1),children:e.jsxs("div",{style:Z2,onClick:V=>V.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:800},children:["Ideas para ",e.jsx("span",{style:{color:me},children:t})]}),e.jsx("button",{type:"button",style:{...ee,padding:"3px 10px"},onClick:()=>v(!1),children:"â"})]}),j&&e.jsx("div",{style:{padding:"22px 4px",fontSize:13,color:"var(--text-muted)",textAlign:"center"},children:"Generando 3 ideasâ¦"}),!j&&_&&e.jsx("div",{role:"alert",style:{color:"var(--danger)",fontSize:13,padding:"6px 0 10px"},children:_}),!j&&!_&&$.map((V,L)=>e.jsx("button",{type:"button",style:u?{...Tg,whiteSpace:"pre-line",textAlign:"left"}:Tg,onClick:()=>{c(V),v(!1)},children:V},L)),e.jsx("div",{style:{display:"flex",gap:8,marginTop:4},children:e.jsx("button",{type:"button",style:{...ee,flex:1,fontSize:12.5},onClick:M,disabled:j,children:"⺠Otras ideas"})}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"9px 0 0"},children:"Toca una idea para usarla. Reemplaza el texto del campo (puedes seguir editándolo)."})]})})]})}function Ea({children:t,ai:a}){return e.jsxs("div",{style:JC,children:[e.jsx("label",{style:{...D,margin:0},children:t}),e.jsx(So,{...a})]})}function L8({value:t,onChange:a,style:n,placeholder:o}){const[i,s]=h.useState((t||[]).join(` 1133`)),u=(t||[]).join(` 1134`);return h.useEffect(()=>{s(m=>u!==m.split(` 1135`).map(c=>c.trim()).filter(Boolean).join(` 1136`)?u:m)},[u]),e.jsx("textarea",{style:n,value:i,placeholder:o,onChange:m=>{const c=m.target.value;s(c),a(c.split(` 1137`).map(g=>g.trim()).filter(Boolean))}})}function P8({platform:t}){const a=$a(),[n,o]=h.useState(!1),[i,s]=h.useState(""),u=async()=>{o(!0),s("");try{const c=await(await a("/api/landing/prime-url?platform="+t)).json();c.ok&&c.url?window.open(c.url,"_blank","noopener"):s("Primero crea y publica una landing para poder activar el evento.")}catch{s("No se pudo abrir. Intenta de nuevo.")}finally{o(!1)}};return e.jsxs("div",{style:{marginTop:14,paddingTop:14,borderTop:"1px dashed var(--border, #e3e6ee)"},children:[e.jsxs("button",{type:"button",onClick:u,disabled:n,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:9,width:"100%",background:"#000",color:"#fff",border:"none",borderRadius:11,padding:"11px 14px",fontSize:13.5,fontWeight:800,cursor:n?"default":"pointer",opacity:n?.7:1},children:[e.jsx("img",{src:"/logos/tiktok.svg",alt:"",width:17,height:17,style:{display:"block"}}),n?"Abriendoâ¦":"Activar evento de compra en TikTok"]}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"8px 0 0",lineHeight:1.5},children:["Abre tu última landing publicada como si vinieras de un anuncio. Haz un ",e.jsx("b",{children:"pedido de prueba"})," ahà para que TikTok registre el evento de compra y lo puedas elegir en la optimización. Luego borra ese pedido en tu CRM."]}),i&&e.jsx("p",{role:"status",style:{fontSize:12,color:"var(--warning)",margin:"6px 0 0"},children:i})]})}function D8({qty:t,price:a,productName:n,context:o,onPick:i}){const s=$a(),u=np(),[m,c]=h.useState(!1),[g,f]=h.useState(!1),[b,v]=h.useState([]),[j,S]=h.useState(""),$=h.useRef([]),C=h.useCallback(async()=>{f(!0),S("");try{const w=await(await s("/api/landing/suggest-bundle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product_name:n,context:o,qty:t,price:a,provider:u,avoid:$.current.slice(-12)})})).json();if(!w.ok){S(w.message||"No se pudo generar."),v([]);return}const M=Array.isArray(w.options)?w.options:[];
1137v(M),$.current=[...$.current,...M.map(p=>String((p==null?void 0:p.label)||"")).filter(Boolean)]}catch{S("Error de conexión. Intenta de nuevo.")}finally{f(!1)}},[s,n,o,t,a,u]),_=()=>{$.current=[],c(!0),v([]),S(""),C()};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",title:"Sugerir texto de compra + insignia con IA",onClick:_,style:Y2,children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"12",height:"12",fill:"currentColor",children:e.jsx("path",{d:"M11 2l1.6 5L18 8.6l-5.4 1.6L11 16l-1.6-5.8L4 8.6 9.4 7 11 2zm7 10l.85 2.65L21.5 15l-2.65.85L18 18.5l-.85-2.65L14.5 15l2.65-.85L18 12z"})}),"IA"]}),m&&e.jsx("div",{style:J2,onClick:()=>c(!1),children:e.jsxs("div",{style:Z2,onClick:N=>N.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:10},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:800},children:["Compra + insignia para ",e.jsxs("span",{style:{color:me},children:[t," unidad",t>1?"es":""]})]}),e.jsx("button",{type:"button",style:{...ee,padding:"3px 10px"},onClick:()=>c(!1),children:"â"})]}),g&&e.jsx("div",{style:{padding:"22px 4px",fontSize:13,color:"var(--text-muted)",textAlign:"center"},children:"Generando 3 ideasâ¦"}),!g&&j&&e.jsx("div",{role:"alert",style:{color:"var(--danger)",fontSize:13,padding:"6px 0 10px"},children:j}),!g&&!j&&b.map((N,w)=>e.jsxs("button",{type:"button",style:{...Tg,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3},onClick:()=>{i(N),c(!1)},children:[e.jsx("span",{style:{fontWeight:700},children:N.label}),N.badge&&e.jsx("span",{style:{fontSize:11,fontWeight:800,letterSpacing:".4px",color:me},children:N.badge})]},w)),e.jsx("div",{style:{display:"flex",gap:8,marginTop:4},children:e.jsx("button",{type:"button",style:{...ee,flex:1,fontSize:12.5},onClick:C,disabled:g,children:"⺠Otras ideas"})}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"9px 0 0"},children:"Toca una idea para usar el texto de compra y la insignia juntos."})]})})]})}function Ol({mechanic:t,product:a,bullets:n,onApply:o}){const i=$a(),s=np(),[u,m]=h.useState(!1),[c,g]=h.useState(""),[f,b]=h.useState(null),v=h.useRef([]),j=h.useCallback(async()=>{m(!0),g("");try{const S=[a==null?void 0:a.description,...n||[]].filter(Boolean).join(" · ").slice(0,700),C=await(await i("/api/landing/suggest-offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mechanic:t,product_name:(a==null?void 0:a.name)||"",price:Number(a==null?void 0:a.price)||0,context:S,provider:s,avoid:v.current.slice(-8)})})).json();if(!C.ok){g(C.message||"No se pudo generar.");return}if(C.fields&&Object.keys(C.fields).length){o(C.fields);const _=Object.values(C.fields).filter(N=>typeof N=="string").join(" | ").slice(0,160);_&&v.current.push(_)}b(C.rationale||null)}catch{g("Error de conexión. Intenta de nuevo.")}finally{m(!1)}},[i,t,a,n,o,s]);return e.jsxs("div",{style:{margin:"2px 0 12px"},children:[e.jsxs("button",{type:"button",onClick:j,disabled:u,style:{...ZC,opacity:u?.7:1},children:[e.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"currentColor",children:e.jsx("path",{d:"M11 2l1.6 5L18 8.6l-5.4 1.6L11 16l-1.6-5.8L4 8.6 9.4 7 11 2zm7 10l.85 2.65L21.5 15l-2.65.85L18 18.5l-.85-2.65L14.5 15l2.65-.85L18 12z"})}),u?"Generandoâ¦":"Generar con IA"]}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",marginLeft:10},children:"Rellena los textos con buenas prácticas de ventas."}),c&&e.jsx("div",{role:"alert",style:{color:"var(--danger)",fontSize:12.5,marginTop:6},children:c}),f&&(f.why||f.forWhom)&&e.jsxs("div",{style:XC,children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,textTransform:"uppercase",letterSpacing:.5,opacity:.55,marginBottom:5},children:"Por qué la IA lo escribió asÃ"}),f.why&&e.jsxs("p",{style:{margin:"0 0 6px",fontSize:12.5,lineHeight:1.5},children:[e.jsx("b",{style:{color:me},children:"Táctica:"})," ",f.why]}),f.forWhom&&e.jsxs("p",{style:{margin:0,fontSize:12.5,lineHeight:1.5},children:[e.jsx("b",{style:{color:me},children:"Para quién:"})," ",f.forWhom]})]})]})}function av(t){if(!t)return"";const a=Number(t),n=Number.isFinite(a)&&a>0?new Date(a<1e12?a*1e3:a):new Date(String(t));if(isNaN(n.getTime()))return"";try{return n.toLocaleDateString("es-CO",{day:"numeric",month:"short",year:"numeric"})}catch{return""}}function B8({events:t}){if(!t||!t.length)return null;const a={PageView:"PageView",ON_WEB_DETAIL:"Ver detalle",InitiateCheckout:"Initiate Checkout",Order:"Order",CompletePayment:"Compra",Purchase:"Purchase",ENGAGED_SESSION:"Sesión activa",Landing_PV:"Landing PV"};return e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted, #9ca3af)",textTransform:"uppercase",letterSpacing:".03em",marginBottom:6},children:["Eventos configurados (",t.length,")"]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:t.map((n,o)=>e.jsx("span",{style:{fontSize:11,fontWeight:700,color:"var(--text, #374151)",background:"var(--input-bg, #eef1f6)",borderRadius:7,padding:"3px 8px"},children:a[n]||n},o))})]})}function W8({pixelId:t}){const a=$a(),[n,o]=h.useState(!1),[i,s]=h.useState(!1),[u,m]=h.useState(!1),[c,g]=h.useState(null),f=async()=>{const v=!n;if(o(v),!(!v||u||i)){s(!0);try{const S=await(await a(`/api/meta/pixels/${encodeURIComponent(t)}/stats?days=7`)).json();g(Array.isArray(S==null?void 0:S.stats)&&S.stats.length?S.stats:null)}catch{g(null)}finally{s(!1),m(!0)}}},b=v=>
1137Number(v||0).toLocaleString("es-CO");return e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid var(--border, #e8eaf0)"},children:[e.jsxs("button",{type:"button",onClick:f,style:{background:"transparent",border:"none",padding:0,color:me,fontSize:11.5,fontWeight:700,fontFamily:"inherit",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:5},children:[n?"Ocultar diagnóstico":"Ver eventos de los últimos 7 dÃas",e.jsx("span",{style:{display:"inline-flex",transform:n?"rotate(180deg)":"none",transition:"transform .18s"},children:e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),n&&e.jsxs("div",{style:{marginTop:10},children:[i&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Consultando a Metaâ¦"}),!i&&!c&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",lineHeight:1.5},children:"Meta no devolvió datos para este pixel. Puede ser que no haya disparado nada en los últimos 7 dÃas, o que tu token no tenga permiso para leer sus estadÃsticas."}),!i&&c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gap:7},children:c.slice(0,8).map((v,j)=>{const S=v.server===0&&v.web>0;return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,minWidth:0,flex:"1 1 120px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.event}),e.jsx("b",{style:{fontSize:12.5,fontVariantNumeric:"tabular-nums"},children:b(v.total)}),e.jsxs("span",{style:{fontSize:10.5,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums",flex:"none"},children:["navegador ",b(v.web)," · servidor ",b(v.server)]}),S&&e.jsx("span",{style:{fontSize:9.5,fontWeight:800,color:"var(--warning)",background:"var(--notice-warning-bg)",borderRadius:999,padding:"1px 6px",flex:"none"},children:"sin servidor"})]},j)})}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"10px 0 0",lineHeight:1.5},children:"Meta solo guarda 7 dÃas de este detalle. Si un evento sale con servidor en 0 y tú ya pusiste el token de CAPI, ese envÃo no está llegando."})]})]})]})}function Rg({platform:t,match:a}){const[n,o]=h.useState(!1);if(!a)return null;const i=t==="tiktok"?String(a.activity_status||"").toUpperCase()==="ACTIVE":a.is_unavailable!==!0,s=t==="tiktok"?av(a.create_time):a.last_fired_time?`último evento ${av(a.last_fired_time)}
1137`:"",u=t==="tiktok"?a.advertiser_name:a.ad_account_name;return e.jsxs("div",{style:{marginTop:8,borderRadius:12,border:"1px solid var(--border, #e8eaf0)",background:"var(--bg-soft, #f7f8fb)",overflow:"hidden"},children:[e.jsxs("button",{type:"button",onClick:()=>o(m=>!m),style:{display:"flex",alignItems:"center",gap:8,width:"100%",background:"transparent",border:"none",padding:"11px 12px",cursor:"pointer",fontFamily:"inherit",textAlign:"left"},children:[e.jsx("b",{style:{fontSize:13,letterSpacing:"-.01em",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.pixel_name}),e.jsx(oi,{on:i,onLabel:"Activo",offLabel:t==="meta"?"No disponible":"Inactivo"}),e.jsx("span",{style:{flex:1}}),e.jsx("span",{style:{flex:"none",fontSize:11,fontWeight:700,color:"var(--text-muted)"},children:n?"Ocultar":"Ver detalle"}),e.jsx("span",{style:{flex:"none",color:"var(--text-muted)",display:"inline-flex",transform:n?"rotate(180deg)":"none",transition:"transform .18s"},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),n&&e.jsxs("div",{style:{padding:"0 12px 12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[!!u&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:u}),!!s&&e.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)"},children:["· ",t==="tiktok"?"creado ":"",s]}),t==="tiktok"&&!!a.setup_mode&&e.jsx("span",{style:{fontSize:10,fontWeight:800,color:"var(--text-muted)",background:"var(--input-bg, #eef1f6)",borderRadius:6,padding:"2px 7px",textTransform:"uppercase"},children:String(a.setup_mode).replace(/_/g," ")})]}),t==="tiktok"&&e.jsx(B8,{events:a.configured_events}),t==="meta"&&!!a.pixel_id&&e.jsx(W8,{pixelId:String(a.pixel_id)})]})]})}function Ng({platform:t,pixels:a,value:n,onPick:o}){const i=String(n||"").trim();if(!a||!a.length)return null;const s=m=>t==="tiktok"&&m.pixel_code||String(m.pixel_id);return a.some(m=>s(m)===i)?null:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"O elige uno de tus conectados:"}),e.jsxs("select",{value:"",onChange:m=>{m.target.value&&o(m.target.value)},style:{...E,width:"auto",minWidth:200,padding:"7px 10px",fontSize:12.5,marginBottom:0},children:[e.jsxs("option",{value:"",children:["Tus pixeles de ",t==="tiktok"?"TikTok":"Meta","â¦"]}),a.map((m,c)=>e.jsxs("option",{value:s(m),children:[m.pixel_name,t==="tiktok"?` · ${m.pixel_code||m.pixel_id}`:`${m.ad_account_name?` · ${m.ad_account_name}`:""}${m.de_otra_conexion?" · otra conexión de Meta":""}`]},c))]})]})}function q8(t){const a=String(t||"").trim().toLowerCase(),n={lastname:"Apellido",apellido:"Apellido",referencia:"Referencia",reference:"Referencia",barrio:"Barrio",neighborhood:"Barrio",email:"Correo",correo:"Correo",phone2:"Otro teléfono",documento:"Documento",cedula:"Cédula",talla:"Talla",color:"Color",variante:"Variante",colonia:"Colonia",distrito:"Distrito",corregimiento:"Corregimiento",parroquia:"Parroquia",zona:"Zona",codigo_postal:"Código postal",mensaje:"Notas",notas:"Notas"};return n[a]?n[a]:/^campo_\d+_\d+$/.test(a)?"Campo del formulario":String(t).replace(/_/g," ").replace(/^\S/,o=>o.toUpperCase())}function M8(){const t=$a(),[a,n]=h.useState({ready:!1,cname_target:"landings.lumycol.com"}),[o,i]=h.useState([]),s=h.useMemo(()=>lv(o),[o]),[u,m]=h.useState(null),[c,g]=h.useState(!1),[f,b]=h.useState(1),[v,j]=h.useState(""),[S,$]=h.useState(""),[C,_]=h.useState(!1),[N,w]=h.useState(""),[M,p]=h.useState(null),[V,L]=h.useState(!1),[x,z]=h.useState(!1),G=h.useCallback(()=>{t("/api/landing/pages").then(F=>F.json()).then(F=>{Array.isArray(F==null?void 0:F.pages)&&i(F.pages)}).catch(()=>{}),t("/api/landing/store").then(F=>F.json()).then(F=>{F!=null&&F.ok&&F.store&&m(F.store)}).catch(()=>{})},[t]);h.useEffect(()=>{t("/api/landing/saas-status").then(F=>F.json()).then(F=>{F!=null&&F.ok&&n({ready:!!F.ready,cname_target:F.cname_target||"landings.lumycol.com"})}).catch(()=>{}),G()},[t,G]);const B=K2(v),U=!!(u&&u.slug),ne=[...u!=null&&u.store_domain&&!qi(u.store_domain)?[{key:"store",domain:u.store_domain,label:"Tu tienda"}]:[],...o.filter(F=>F.custom_domain&&!qi(F.custom_domain)).map(F=>({key:"l"+F.id,domain:F.custom_domain,label:s.get(F.id)||Gl(F)}))],[Q,de]=h.useState({}),[pe,ce]=h.useState([]),ve=h.useCallback(()=>{t("/api/landing/domains").then(F=>F.json()).then(F=>{F!=null&&F.ok&&ce(F.dominios||[])}).catch(()=>{})},[t]);h.useEffect(()=>{ve()},[ve]),h.useEffect(()=>{ne.forEach(F=>{t("/api/landing/domain-status?domain="+encodeURIComponent(F.domain)).then(Re=>Re.json()).then(Re=>de(K=>({...K,[F.domain]:Re}))).catch(()=>{})})},[ne.map(F=>F.domain).join(",")]);const[ge,Te]=h.useState(""),ie=async F=>{if(confirm(`¿Quitar el dominio ${F.domain}? La página seguirá funcionando en su dirección gratis de Lumy y puedes volver a conectarlo cuando quieras.`)){Te(F.key);try{F.key==="store"?await t("/api/landing/store",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({store_domain:"",expected_revision:Number(u==null?void 0:u.revision)||0})}):await t(`/api/landing/pages/${F.key.slice(1)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({custom_domain:""})}),G()}catch{}finally{Te("")}}},fe={border:"1px solid var(--border, #e8eaf0)",borderRadius:14,background:"var(--card-bg, #fff)"},Be={width:"100%",boxSizing:"border-box",border:"1.5px solid var(--border, #dde)",borderRadius:10,padding:"11px 13px",fontSize:14,fontFamily:"monospace",background:"var(--input-bg, #fff)",color:"var(--text, #111)"};function We(){j(""),$("store"),p(null),w(""),b(1),g(!0)}function ze(){L(!0),t("/api/landing/domain-status?domain="+encodeURIComponent(v.trim())).then(F=>F.json()).then(F=>p(F)).catch(()=>{}).finally(()=>L(!1))}async function tt(){_(!0),w(""),p(null);try{const Re=await(await t("/api/landing/domains",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:v.trim()})})).json();if(!Re.ok)throw new Error(Re.message||"No se pudo empezar a activar el dominio.");ve(),b(2),setTimeout(ze,400)}catch(F){w(String((F==null?void 0:F.message)||F))}finally{_(!1)}}async function Fe(){_(!0),w("");try{if(S==="store"){const F={store_domain:v.trim(),expected_revision:Number(u==null?void 0:u.revision)||0};if(!U){const I=v.trim().toLowerCase().replace(/^www\./,"").split(".")[0].replace(/[^a-z0-9-]/g,"").slice(0,40);F.slug=I||"mitienda",F.enabled=1,F.name=I?I.charAt(0).toUpperCase()+I.slice(1):"Mi tienda"}const K=await(await t("/api/landing/store",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)})).json();if(!K.ok)throw new Error(K.message||"No se pudo guardar el dominio.")}else{const Re=await(await t(`/api/landing/pages/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({custom_domain:v.trim()})})).json();if(!(Re.ok||Re.page))throw new Error(Re.message||"No se pudo guardar el dominio.")}G(),ve(),g(!1)}catch(F){w(String((F==null?void 0:F.message)||F))}finally{_(!1)}}return e.jsxs("div",{"data-guia":"landing.dominio",style:{...fe,padding:"clamp(14px, 2vw, 20px)",marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,fontSize:16,fontWeight:800},children:"Dominio propio"}),e.jsx("p",{style:{margin:"3px 0 0",fontSize:12.5,color:"var(--text-muted)"},children:"Conecta tu dirección (ej: tumarca.com) y elige qué abre: tu tienda o una landing."})]}),!c&&e.jsx("button",{style:{...xa,whiteSpace:"nowrap"},onClick:We,children:"+ Conectar dominio"})]}),!c&&ne.length>0&&(()=>{const F=ne.filter(Re=>{const K=Q[Re.domain];return!!K&&!(K.active||String(K.ssl_status||"").toLowerCase()==="active")}).length;return e.jsx("div",{style:{marginTop:12},children:e.jsx(xg,{clave:"dominios-pixeles-conectados",titulo:`Dominios conectados (${ne.length})`,resumen:F>0?e.jsxs("span",{style:{color:"var(--warning)"},children:["· ",F," esperando candado"]}):void 0,children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:8},children:ne.map(Re=>e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:10,rowGap:8,padding:"11px 13px",border:"1px solid var(--border, #eef)",borderRadius:11,background:"var(--input-bg, #fafbff)"},children:[e.jsx("span",{style:{flex:"none",width:30,height:30,borderRadius:8,background:"rgba(8,102,255,.1)",color:me,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3 12h18M12 3c2.5 2.5 2.5 16 0 18M12 3c-2.5 2.5-2.5 16 0 18"})]})}),e.jsxs("span",{style:{flex:"1 1 170px",minWidth:0},children:[e.jsx("a",{href:`https://${Re.domain}/`,target:"_blank",rel:"noreferrer",style:{display:"block",fontWeight:800,fontSize:13.5,color:me,textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Re.domain}),e.jsxs("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:["Abre: ",Re.label]})]}),(()=>{const K=Q[Re.domain],I=!!(K&&(K.active||String(K.ssl_status||"").toLowerCase()==="active")),H=!!(K&&!I);return e.jsx("span",{title:I?"SSL activo: el dominio ya sirve tu página con candado":H?"Registrado: esperando que el candado (SSL) se active (minutos u horas tras crear el CNAME)":"Consultando estadoâ¦",style:{flex:"none",marginLeft:"auto",fontSize:10.5,fontWeight:800,padding:"3px 9px",borderRadius:999,background:I?"var(--notice-success-bg)":H?"var(--notice-warning-bg)":"var(--bg-secondary, #eef1f6)",color:I?"var(--success)":H?"var(--warning)":"var(--text-muted, #8a90a2)"},children:I?"Candado listo â":H?"Esperando candadoâ¦":"â¦"})})(),e.jsx("button",{onClick:()=>ie(Re),disabled:ge===Re.key,title:"Quitar este dominio (la página vuelve a su dirección gratis de Lumy)",style:{flex:"none",border:"1px solid var(--notice-danger-border)",background:"transparent",color:"var(--danger)",borderRadius:8,padding:"4px 10px",fontSize:11,fontWeight:800,cursor:ge===Re.key?"default":"pointer",fontFamily:"inherit",opacity:ge===Re.key?.5:1},children:ge===Re.key?"â¦":"Quitar"})]},Re.key))})})})})(),!c&&(()=>{const F=new Set(ne.map(De=>De.domain)),Re=pe.filter(De=>!F.has(De.dominio));if(!Re.length)return null;const K=Re.filter(De=>De.estado==="listo").length,I=async De=>{if(confirm(`¿Quitar ${De}? Puedes volver a conectarlo cuando quieras.`)){try{await t("/api/landing/domains",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:De})})}catch{}ve()}},H=De=>{j(De),$("store"),p(null),w(""),b(3),g(!0)},ye=De=>{j(De),$("store"),p(null),w(""),b(2),g(!0),setTimeout(ze,200)};return e.jsx("div",{style:{marginTop:ne.length?4:12},children:e.jsx(xg,{clave:"dominios-pixeles-sin-asignar",titulo:`Sin asignar (${Re.length})`,resumen:K>0?e.jsxs("span",{style:{color:me},children:["· ",K===1?"1 listo, falta decir qué abre":`${K} listos, falta decir qué abren`]}):e.jsx("span",{children:"· activándose"}),children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:8},children:Re.map(De=>{const Ue=De.estado==="listo";return e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:10,rowGap:8,padding:"11px 13px",borderRadius:11,border:`1px dashed ${Ue?"rgba(22,163,74,.35)":"var(--notice-warning-border, #fed7aa)"}`,background:Ue?"rgba(22,163,74,.06)":"var(--notice-warning-bg, #fff7ed)"},children:[e.jsxs("span",{style:{flex:"1 1 190px",minWidth:0},children:[e.jsx("span",{style:{display:"block",fontWeight:800,fontSize:13.5,fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:De.dominio}),e.jsx("span",{style:{display:"block",fontSize:11.5,fontWeight:700,color:Ue?"#15803d":"var(--warning, #b45309)"},children:Ue?"Listo â falta decir qué abre":"Activándose â todavÃa no se puede usar"})]}),e.jsx("button",{style:{...ee,flex:"none",marginLeft:"auto",padding:"6px 12px",fontSize:12.5,fontWeight:700},onClick:()=>Ue?H(De.dominio):ye(De.dominio),children:Ue?"Elegir qué abre":"Continuar"}),e.jsx("button",{onClick:()=>I(De.dominio),title:"Quitar este dominio",style:{flex:"none",background:"none",border:"none",color:"var(--danger)",fontSize:12,fontWeight:700,cursor:"pointer"}
1137,children:"Quitar"})]},De.dominio)})})})})})(),!c&&ne.length===0&&pe.length===0&&e.jsx("p",{style:{margin:"14px 0 0",fontSize:12.5,color:"var(--text-muted)"},children:"Aún no tienes un dominio propio conectado. Tus páginas usan la dirección gratis de Lumy (.lumycol.com) mientras tanto."}),c&&e.jsxs("div",{style:{marginTop:16,border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"clamp(13px, 2vw, 18px)",background:"var(--input-bg, #fafbff)"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16},children:[["1","Dominio"],["2","Activar"],["3","¿Qué abre?"]].map(([F,Re],K)=>{const I=K+1,H=f>I,ye=f===I;return e.jsxs(h.Fragment,{children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{...Mp,width:22,height:22,fontSize:11.5,background:H||ye?me:"var(--border, #cbd5e1)"},children:H?"â":F}),e.jsx("span",{style:{fontSize:11.5,fontWeight:800,color:ye?me:"var(--text-muted)",whiteSpace:"nowrap"},children:Re})]}),K<2&&e.jsx("span",{style:{flex:1,height:2,background:f>I?me:"var(--border, #e3e6ee)",borderRadius:2}})]},F)})}),f===1&&e.jsxs(e.Fragment,{children:[e.jsx("label",{style:{fontSize:12.5,fontWeight:700,display:"block",marginBottom:6},children:"Tu dominio (sin https://)"}),e.jsx("input",{style:Be,value:v,onChange:F=>j(F.target.value),placeholder:"www.tumarca.com"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"6px 0 0"},children:["Usa un subdominio: ",e.jsx("code",{children:"www.tumarca.com"})," o ",e.jsx("code",{children:"tienda.tumarca.com"}),"."]}),v.trim()&&B.isApex&&e.jsxs("div",{style:{marginTop:10,fontSize:12.5,lineHeight:1.5,background:"var(--notice-warning-bg, #fff7ed)",border:"1px solid var(--notice-warning-border, #fed7aa)",borderRadius:11,padding:"11px 13px",color:"var(--notice-warning-text, #9a3412)"},children:[e.jsx("b",{children:"Ojo: ese es un dominio raÃz."})," ",e.jsx("b",{children:B.root})," a secas no se puede conectar directo. Usa un subdominio:",e.jsxs("button",{style:{marginTop:8,padding:"7px 12px",fontSize:12.5,fontWeight:800,borderRadius:9,border:"1px solid var(--notice-warning-border, #fb923c)",background:"var(--bg-card, #fff)",color:"var(--notice-warning-text, #9a3412)",cursor:"pointer"},onClick:()=>j("www."+B.root),children:["Usar www.",B.root]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},children:[e.jsx("button",{style:ee,onClick:()=>g(!1),children:"Cancelar"}),e.jsx("button",{style:{...xa,opacity:C||!(B.ok&&!B.isApex)?.5:1},disabled:C||!(B.ok&&!B.isApex),onClick:tt,children:C?"Empezandoâ¦":"Continuar"})]})]}),f===3&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{fontSize:12.5,fontWeight:700,display:"block",marginBottom:8},children:["¿Qué quieres que abra ",e.jsx("span",{style:{fontFamily:"monospace",color:me},children:v.trim()}),"?"]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[(()=>{const F=S==="store";return e.jsxs("button",{className:F?"lk-ring-aurora":void 0,onClick:()=>$("store"),style:{textAlign:"left",display:"flex",alignItems:"center",gap:10,padding:"12px 13px",borderRadius:11,cursor:"pointer",border:`1.6px solid ${F?"transparent":"var(--border, #e3e6ee)"}`,background:F?"transparent":"var(--bg-card, #fff)"},children:[e.jsx("span",{style:{flex:"none",width:17,height:17,borderRadius:"50%",border:`2px solid ${F?me:"#cbd5e1"}`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:F&&e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:me}})}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"block",fontWeight:800,fontSize:13.5,color:F?me:"var(--text,#111)"},children:"Mi tienda"}),e.jsxs("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:["Todos tus productos, cada uno en ",v.trim()||"tudominio.com","/producto."]})]})]})})(),(()=>{const F=S!=="store";return e.jsxs("div",{className:F?"lk-ring-aurora":void 0,style:{padding:"12px 13px",borderRadius:11,border:`1.6px solid ${F?"transparent":"var(--border, #e3e6ee)"}`,background:F?"transparent":"var(--bg-card, #fff)"},children:[e.jsxs("button",{onClick:()=>$(o[0]?String(o[0].id):""),style:{all:"unset",cursor:"pointer",display:"flex",alignItems:"center",gap:10,width:"100%"},children:[e.jsx("span",{style:{flex:"none",width:17,height:17,borderRadius:"50%",border:`2px solid ${F?me:"#cbd5e1"}`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:F&&e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:me}})}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"block",fontWeight:800,fontSize:13.5,color:F?me:"var(--text,#111)"},children:"Una landing"}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-muted)"},children:"Una página de un solo producto."})]})]}),F&&o.length>0&&e.jsx("select",{value:S==="store"?"":S,onChange:Re=>$(Re.target.value),style:{...Be,marginTop:10,fontFamily:"inherit",curs
1137or:"pointer"},children:o.map(Re=>e.jsx("option",{value:Re.id,children:s.get(Re.id)},Re.id))}),F&&o.length===0&&e.jsx("p",{style:{margin:"8px 0 0",fontSize:11.5,color:"var(--warning, #b45309)"},children:"No tienes landings todavÃa. Crea una primero."})]})})()]}),N&&e.jsx("p",{style:{color:"var(--danger, #dc2626)",fontSize:12.5,margin:"10px 0 0",fontWeight:600},children:N}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,marginTop:16},children:[e.jsx("button",{style:ee,onClick:()=>b(2),children:"â Atrás"}),e.jsx("button",{style:{...xa,opacity:C||S!=="store"&&!S?.6:1},disabled:C||S!=="store"&&!S,onClick:Fe,children:C?"Conectandoâ¦":"Conectar"})]})]}),f===2&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:13,fontWeight:800,margin:"0 0 10px"},children:"Crea este registro en tu proveedor de dominio (GoDaddy, etc.)"}),e.jsxs("div",{style:{display:"grid",gap:13},children:[e.jsxs("div",{style:{display:"flex",gap:11},children:[e.jsx("span",{style:Mp,children:"1"}),e.jsxs("div",{style:{flex:1,minWidth:0,paddingTop:3,fontSize:12.5,lineHeight:1.5},children:["En tu proveedor, sección ",e.jsx("b",{children:"DNS"}),", crea un ",e.jsx("b",{children:"CNAME"}),":",e.jsxs("div",{style:{marginTop:7},children:[e.jsx("span",{style:{fontWeight:700,color:"var(--text-secondary, #334155)",fontSize:12},children:"Nombre / Host:"})," ",e.jsx("code",{style:{background:"var(--bg-tertiary, #fff)",border:"1px solid var(--border,#dde)",borderRadius:6,padding:"2px 8px"},children:B.host||"www"})]}),e.jsx("div",{style:{fontWeight:700,color:"var(--text-secondary, #334155)",fontSize:12,margin:"8px 0 4px"},children:"Destino:"}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",border:"1.5px solid var(--border, #dde)",borderRadius:9,overflow:"hidden"},children:[e.jsx("code",{style:{flex:1,padding:"8px 11px",fontSize:13,background:"var(--bg-tertiary, #fff)",color:"var(--text-primary, #0f172a)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.cname_target}),e.jsx("button",{style:{...ee,borderRadius:0,border:"none",borderLeft:"1px solid var(--border,#dde)",padding:"0 14px",fontSize:12.5,fontWeight:700},onClick:()=>{try{navigator.clipboard.writeText(a.cname_target),z(!0),setTimeout(()=>z(!1),1600)}catch{}},children:x?"Copiado â":"Copiar"})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:11},children:[e.jsx("span",{style:Mp,children:"2"}),e.jsxs("div",{style:{flex:1,minWidth:0,paddingTop:3,fontSize:12.5,lineHeight:1.5},children:["Cuando lo crees, dale ",e.jsx("b",{children:"Verificar conexión"}),". El candado de seguridad sale solo (puede tardar unos minutos)."]})]})]}),e.jsx("div",{style:{marginTop:14,padding:"11px 13px",borderRadius:11,background:M!=null&&M.active?"rgba(22,163,74,.08)":"#fff",border:`1px solid ${M!=null&&M.active?"rgba(22,163,74,.3)":"var(--border,#e8eaf0)"}`},children:M!=null&&M.active?e.jsx("span",{style:{color:"#15803d",fontWeight:800,fontSize:13},children:"Listo: dominio conectado y con candado â"}):e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600,fontSize:12.5},children:V?"Revisandoâ¦":M?M.found===!1?"Aún no detectamos el CNAME. Créalo y vuelve a verificar.":`Esperando el candado (${M.ssl_status||M.status||"pendiente"}). Es automático, verifica en un rato.`:"Crea el CNAME y dale Verificar conexión."})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,marginTop:14,flexWrap:"wrap"},children:[e.jsx("button",{style:ee,onClick:()=>{g(!1),G()},children:"Terminar luego"}),M!=null&&M.active||(M==null?void 0:M.mode)==="manual"||(M==null?void 0:M.mode)==="subdomain"?e.jsx("button",{style:xa,onClick:()=>b(3),children:"Continuar â"}):e.jsx("button",{style:{...xa,opacity:V?.6:1},disabled:V,onClick:ze,children:V?"Verificandoâ¦":"Verificar conexión"})]})]})]})]})}function nv({n:t,platform:a,p:n,pixels:o,match:i,upd:s,del:u,tokenLabel:m}){const[c,g]=h.useState(!String(n.id||"").trim()),f=a==="tiktok"?"Ej: CABC123DEF456GHI789":"Ej: 1234567890123456",b=!!String(n.id||"").trim(),v=!!String(n.token||"").trim();return e.jsxs("div",{style:{border:"1px solid var(--border, #e3e6ee)",borderRadius:12,overflow:"hidden",background:"var(--input-bg, #fafbff)",transition:"border-color .18s"},children:[e.jsxs("div",{onClick:()=>g(j=>!j),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 8px 9px 12px",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:800,color:"var(--text-muted)",width:14,flexShrink:0,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:t}),e.jsxs("span",{style:{minWidth:0,flex:1},children:[b?e.jsx("span",{style:{display:"block",fontSize:13,fontFamily:"monospace",fontVariantNumeric:"tabular-nums",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.id}):e.jsx("span",{style:{display:"block",fontSize:12.5,color:"#b54708",fontWeight:700},children:"Sin configurar"}),b&&e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginTop:3,fontSize:10,fontWeight:700,padding:"2px 7px",borderRadius:999,...v?{background:"rgba(22,163,74,.09)",color:"#16a34a",border:"1px solid rgba(22,163,74,.26)"}:{background:"var(--card-bg, #fff)",color:"var(--text-muted)",border:"1px solid var(--border, #e3e6ee)"}},children:v?"Con token":"Sin token"})]}),e.jsx("span",{style:{transform:c?"rotate(180deg)":"none",transition:"transform .18s",color:"var(--text-muted)",fontSize:11,flexShrink:0},children:"â¾"}),e.jsx("button",{onClick:j=>{j.stopPropagation(),u()},title:`Quitar pixel ${t}`,"aria-label":`Quitar pixel ${t}`,style:{width:28,height:28,flexShrink:0,background:"none",border:"none",color:"var(--text-muted)",borderRadius:8,cursor:"pointer",display:"grid",placeItems:"center",fontSize:15,lineHeight:1,transition:"background .18s, color .18s"},onMouseEnter:j=>{j.currentTarget.style.background="var(--notice-danger-bg)",j.currentTarget.style.color="var(--danger)"},onMouseLeave:j=>{j.currentTarget.style.background="none",j.currentTarget.style.color="var(--text-muted)"},children:"Ã"})]}),c&&e.jsxs("div",{style:{padding:"2px 12px 12px",background:"var(--card-bg, #fff)",borderTop:"1px solid var(--border, #e3e6ee)"},children:[e.jsx("label",{style:{...D,marginTop:10},children:"ID del pixel"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:n.id,onChange:j=>s({id:j.target.value}),placeholder:f}),e.jsx(Ng,{platform:a,pixels:o,value:n.id,onPick:j=>s({id:j})}),e.jsx(Rg,{platform:a,match:i}),e.jsx("label",{style:D,children:m}),e.jsx("input",{style:{...E,fontFamily:"monospace",fontSize:12.5},value:n.token,onChange:j=>s({token:j.target.value}),placeholder:"Token de este pixel (opcional)"})]})]})}function F8({elegido:t,onElegir:a,mios:n,deLaCuenta:o}){return e.jsxs(e.Fragment,{children:[n.length===0&&!t?e.jsxs("p",{role:"status",style:{fontSize:12.5,color:"var(--warning)",margin:"4px 0 0"},children:["No tienes pÃxeles de Meta en ","Pixeles & dominios",". Agrégalos (con su token) para que las ventas se reporten."]}):(()=>{const i=u=>String(((o||[]).find(m=>String((m==null?void 0:m.pixel_id)||"")===u)||{}).pixel_name||""),s=[{id:"",label:"Todos mis pÃxeles de Meta",sub:"Lo normal: cada venta se reporta a todos. Recomendado.",token:null},...n.map((u,m)=>({id:u.id,label:i(u.id)||(m===0?"PÃxel principal":`PÃxel ${m+1}`),sub:"ID: "+u.id,token:u.hasToken})),...t&&!n.some(u=>u.id===t)?[{id:t,label:"El que tenÃas elegido",sub:"ID: "+t,token:null}]:[]];return e.jsx("div",{style:{display:"grid",gap:8},children:s.map(u=>{const m=t===u.id;return e.jsxs("button",{type:"button",onClick:()=>a(u.id),className:`lk-act ${m?"lk-ring-aurora":""}`,style:{textAlign:"left",display:"flex",alignItems:"center",gap:11,padding:"12px 13px",borderRadius:12,cursor:"pointer",border:`1.6px solid ${m?"transparent":"var(--border, #e3e6ee)"}`,background:m?"transparent":"var(--card-bg, #fff)",boxShadow:m?`0 8px 22px -14px ${me}`:"none"},children:[e.jsx("span",{style:{flex:"none",width:18,height:18,borderRadius:"50%",border:`2px solid ${m?me:"var(--border, #cbd5e1)"}`,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"border-color .15s"},children:m&&e.jsx("span",{style:{width:9,height:9,borderRadius:"50%",background:me}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:800,fontSize:13.5,color:m?me:"var(--text, #111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:u.label}),u.token!==null&&e.jsx("span",{style:{fontSize:10.5,fontWeight:800,padding:"2px 7px",borderRadius:999,background:u.token?"var(--notice-success-bg)":"var(--notice-warning-bg)",color:u.token?"var(--success)":"var(--warning)"},children:u.token?"Con token":"Sin token"})]}),e.jsx("span",{style:{display:"block",fontFamily:u.id?"monospace":"inherit",fontSize:u.id?12:11.5,color:"var(--text-muted)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.sub})]})]},u.id||"__todos_meta")})})})(),t&&(()=>{const i=n.find(s=>s.id===t);return i?i.hasToken?e.jsx("p",{role:"status",style:{fontSize:11.5,color:"var(--success)",margin:"6px 0 0"},children:"Conectado con token. Las ventas de esta página se reportan solo a este pÃxel."}):e.jsxs("p",{role:"status",style:{fontSize:11.5,color:"var(--warning)",margin:"6px 0 0"},children:["Este pÃxel no tiene token de la API de conversiones. Agrégalo en ","Pixeles & dominios"," para que todas las ventas de esta página le lleguen seguro."]}):e.jsxs("p",{role:"alert",style:{fontSize:11.5,color:"var(--danger)",margin:"6px 0 0",fontWeight:700},children:["Este pÃxel ya no está en tus pÃxeles de Meta. Mientras tanto, esta página reporta a todos tus pÃxeles de Meta. Elige otro o vuelve a agregarlo en ","Pixeles & dominios","."]})})(),(()=>{const i=(o||[]).filter(u=>{const m=String((u==null?void 0:u.pixel_id)||"").replace(/[^0-9]/g,"");return!!m&&!n.some(c=>c.id===m)});if(!i.length)return null;const s=i.slice(0,3).map(u=>String((u==null?void 0:u.pixel_name)||(u==null?void 0:u.pixel_id)||"")).join(", ")+(i.length>3?"â¦":"");return e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"8px 0 0",lineHeight:1.45},children:["Tu cuenta de Meta tiene ",i.length===1?"otro pÃxel":`${i.length} pÃxeles más`," que no ",i.length===1?"está":"están"," en ","Pixeles & dominios"," (",s,"). Para elegirlo aquÃ, agrégalo allá con su token."," ",e.jsx("a",{href:"/landing/pixeles",target:"_blank",rel:"noreferrer",style:{fontWeight:700,color:me},children:"Abrir Pixeles & dominios"})]})})()]})}function O8({onBack:t}){const a=$a(),{token:n}=ni(),[o,i]=h.useState(null),[s,u]=h.useState(!1),[m,c]=h.useState([]),g=h.useRef(new Map),f=Wg({esperaMs:1200,preparar:()=>s?{cuerpo:jk(o||{},g.current.keys())}
1137:{falta:"Tus pixeles no cargaron. Recarga la página para que se guarde lo que cambies."},sesion:()=>Pg()?null:n,enviar:(I,H)=>qg(a,"/api/landing/settings","PUT",I,H),alGuardar:(I,{cuerpo:H,secuencia:ye,ultima:De})=>{const Ue=(I==null?void 0:I.settings)||{},se=Ak(H,Ue);for(const we of Object.keys(H))(g.current.get(we)??0)<=ye&&!se.claves.includes(we)&&g.current.delete(we);return c(we=>we.filter(Ye=>g.current.has(Ye))),De&&i(we=>we&&Sk(we,H,Ue)),se.mensaje||void 0}}),b=I=>{N(I);const H=f.marcarEdicion();for(const ye of Object.keys(I))g.current.set(ye,H)},[v,j]=h.useState([]),[S,$]=h.useState([]),[C,_]=h.useState([]);h.useEffect(()=>{a("/api/landing/settings").then(I=>I.json()).then(I=>{I.ok&&(i(I.settings),u(!0),_(Array.isArray(I.landings_con_pixel_meta)?I.landings_con_pixel_meta:[]))}).catch(()=>i({tiktok_pixel_id:"",meta_pixel_id:"",meta_capi_token:"",tiktok_events_token:"",tiktok_pixels_extra:[],meta_pixels_extra:[]})),a("/api/tiktok/pixels").then(I=>I.json()).then(I=>{Array.isArray(I==null?void 0:I.pixels)&&j(I.pixels)}).catch(()=>{}),a("/api/meta/pixels").then(I=>I.json()).then(I=>{Array.isArray(I==null?void 0:I.pixels)&&$(I.pixels)}).catch(()=>{})},[a]);const N=I=>i(H=>({...H,...I})),w=h.useRef({tt:!1,meta:!1}),M=I=>{N(I);const H=Object.keys(I).filter(ye=>!g.current.has(ye));for(const ye of H)g.current.set(ye,0);H.length&&c(ye=>[...ye,...H.filter(De=>!ye.includes(De))])};h.useEffect(()=>{if(!o)return;if(!w.current.tt&&v.length===1&&!String(o.tiktok_pixel_id||"").trim()){w.current.tt=!0;const H=String(v[0].pixel_code||v[0].pixel_id||"").trim();H&&M({tiktok_pixel_id:H})}const I=S.filter(H=>!(H!=null&&H.de_otra_conexion));if(!w.current.meta&&I.length===1&&!String(o.meta_pixel_id||"").trim()){w.current.meta=!0;const H=String(I[0].pixel_id||"").replace(/[^0-9]/g,"");H&&M({meta_pixel_id:H})}},[o,v,S]);const p=o!=null&&o.tiktok_pixels_extra&&Array.isArray(o.tiktok_pixels_extra)?o.tiktok_pixels_extra:[],V=I=>b({tiktok_pixels_extra:I}),L=()=>{p.length<5&&V([...p,{id:"",token:""}])},x=(I,H)=>V(p.map((ye,De)=>De===I?{...ye,...H}:ye)),z=I=>V(p.filter((H,ye)=>ye!==I)),G=o!=null&&o.meta_pixels_extra&&Array.isArray(o.meta_pixels_extra)?o.meta_pixels_extra:[],B=I=>b({meta_pixels_extra:I}),U=()=>{G.length<5&&B([...G,{id:"",token:""}])},ne=(I,H)=>B(G.map((ye,De)=>De===I?{...ye,...H}:ye)),Q=I=>B(G.filter((H,ye)=>ye!==I)),de=(o==null?void 0:o.web_analytics)||{},pe={ga4:String(de.ga4||""),ads:String(de.ads||""),ads_label:String(de.ads_label||""),gtm:String(de.gtm||""),clarity:String(de.clarity||""),hotjar:String(de.hotjar||"")},ce=I=>b({web_analytics:{...pe,...I}}),ve={fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0",lineHeight:1.45},ge=I=>{const H=String(I||"").trim();return H?v.find(ye=>ye.pixel_code===H||String(ye.pixel_id)===H):null},Te=I=>{const H=String(I||"").trim();return H?S.find(ye=>String(ye.pixel_id)===H):null},ie=s&&m.length>0&&f.estado.tipo!=="guardando"&&f.estado.tipo!=="pendiente",fe={...Jt,padding:0,overflow:"hidden",marginBottom:14},Be={display:"flex",alignItems:"center",gap:12,padding:"14px 16px",borderBottom:"1px solid var(--border, #e8eaf0)"},We={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(280px, 100%), 1fr))",gap:"14px 16px",alignItems:"start"},ze={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(300px, 100%), 1fr))",gap:9,alignItems:"start"},tt={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,margin:"18px 0 9px",paddingTop:14,borderTop:"1px solid var(--border, #e8eaf0)"},Fe={fontSize:11.5,fontWeight:800,letterSpacing:".03em",textTransform:"uppercase",color:"var(--text-muted)"},F={fontSize:12,fontWeight:700,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums"},Re={marginTop:10,background:"rgba(8,102,255,.07)",border:"1px dashed rgba(8,102,255,.4)",color:me,fontSize:12.5,fontWeight:700,cursor:"pointer",padding:"11px 12px",borderRadius:12,width:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:9,fontFamily:"inherit"},K=e.jsx("span",{style:{flex:"none",width:20,height:20,borderRadius:"50%",background:me,color:"#fff",display:"grid",placeItems:"center"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})});return e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)"},children:[e.jsx(Kp,{platform:"landing"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,margin:"14px 0 6px"},children:[e.jsx("button",{style:ee,onClick:t,children:"â Volver"}),e.jsx("h2",{style:{fontSize:20,margin:0,fontWeight:800,letterSpacing:"-.02em"},children:"Pixeles"})]}),o?e.jsxs(e.Fragment,{children:[e.jsx(M8,{}),e.jsxs("div",{style:fe,children:[e.jsx("div",{style:{height:4,background:"linear-gradient(90deg,#25F4EE 0%, #000 50%, #FE2C55 100%)"}}),e.jsxs("div",{style:Be,children:[e.jsx(gc,{src:"/logos/tiktok.svg",bg:"#000",fit:"contain",size:42,pad:7}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.02em"},children:"TikTok"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Pixel + Events API"})]}),e.jsx(oi,{on:!!String(o.tiktok_pixel_id||"").trim(),onLabel:"Configurado",offLabel:"Sin pixel"})]}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:We,children:[e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Pixel principal"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:o.tiktok_pixel_id,onChange:I=>b({tiktok_pixel_id:I.target.value}),placeholder:"Ej: CABC123DEF456GHI789"}),e.jsx(Ng,{platform:"tiktok",pixels:v,value:o.tiktok_pixel_id,onPick:I=>b({tiktok_pixel_id:I})}),e.jsx(Rg,{platform:"tiktok",match:ge(o.tiktok_pixel_id)})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{...D,marginTop:0},children:["Token de eventos ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(mejora la atribución)"})]}),e.jsx("input",{style:{...E,fontFamily:"monospace",fontSize:12.5},value:o.tiktok_events_token,onChange:I=>b({tiktok_events_token:I.target.value}),placeholder:"TikTok Ads â Activos â Eventos web â tu pixel â Generar token"})]})]}),e.jsxs("div",{style:tt,children:[e.jsx("span",{style:Fe,children:"Pixeles adicionales"}),e.jsxs("span",{style:F,children:[p.length," de 5"]})]}),p.length>0&&e.jsx("div",{style:ze,children:p.map((I,H)=>e.jsx(nv,{n:H+2,platform:"tiktok",p:I,pixels:v,match:ge(I.id),upd:ye
1137=>x(H,ye),del:()=>z(H),tokenLabel:`Token de eventos #${H+2} (opcional)`},H))}),p.length<5&&e.jsxs("button",{onClick:L,style:Re,children:[K,"Agregar otro pixel de TikTok"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",padding:"12px 16px",background:"var(--input-bg, #fafbff)",borderTop:"1px solid var(--border, #e8eaf0)"},children:[e.jsx("p",{style:{margin:0,flex:1,minWidth:220,fontSize:12,color:"var(--text-muted)",lineHeight:1.5},children:"TikTok solo deja optimizar por compra cuando ya registró una. Haz un pedido de prueba desde tu landing y luego bórralo en el CRM."}),e.jsx(P8,{platform:"tiktok"})]})]}),e.jsxs("div",{style:fe,children:[e.jsx("div",{style:{height:4,background:"linear-gradient(90deg,#0866FF,#7C3AED)"}}),e.jsxs("div",{style:Be,children:[e.jsx(gc,{src:"/logos/meta.svg",bg:"#EEF3FF",fit:"contain",size:42,pad:7}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.02em"},children:"Meta"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Facebook · Instagram (Pixel + CAPI)"})]}),e.jsx(oi,{on:!!String(o.meta_pixel_id||"").trim(),onLabel:"Configurado",offLabel:"Sin pixel"})]}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:We,children:[e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Pixel principal"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:o.meta_pixel_id,onChange:I=>b({meta_pixel_id:I.target.value}),placeholder:"Ej: 1234567890123456"}),e.jsx(Ng,{platform:"meta",pixels:S,value:o.meta_pixel_id,onPick:I=>b({meta_pixel_id:I})}),e.jsx(Rg,{platform:"meta",match:Te(o.meta_pixel_id)})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{...D,marginTop:0},children:["Token de CAPI ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(mejora la atribución)"})]}),e.jsx("input",{style:{...E,fontFamily:"monospace",fontSize:12.5},value:o.meta_capi_token,onChange:I=>b({meta_capi_token:I.target.value}),placeholder:"Events Manager â tu pixel â Configuración â Generar token"})]})]}),e.jsxs("div",{style:tt,children:[e.jsx("span",{style:Fe,children:"Pixeles adicionales"}),e.jsxs("span",{style:F,children:[G.length," de 5"]})]}),G.length>0&&e.jsx("div",{style:ze,children:G.map((I,H)=>e.jsx(nv,{n:H+2,platform:"meta",p:I,pixels:S,match:Te(I.id),upd:ye=>ne(H,ye),del:()=>Q(H),tokenLabel:`Token de CAPI #${H+2} (opcional)`},H))}),G.length<5&&e.jsxs("button",{onClick:U,style:Re,children:[K,"Agregar otro pixel de Meta"]}),(G.length>0||!!String(o.meta_pixel_id||"").trim())&&e.jsx("p",{style:ve,children:"Cada landing reporta a todos. Para que una reporte solo a uno, elÃgelo en esa landing, pestaña Dominio."}),(()=>{const I=new Set([o.meta_pixel_id,...G.map(De=>De.id)].map(De=>String(De||"").replace(/[^0-9]/g,"").slice(0,20)).filter(Boolean)),H=C.filter(De=>!I.has(String(De.meta_pixel_id||"").replace(/[^0-9]/g,"").slice(0,20)));if(!H.length)return null;const ye=H.slice(0,3).map(De=>`«${De.name}»`).join(", ")+(H.length>3?` y ${H.length-3} más`:"");return e.jsx("p",{role:"alert",style:{...ve,color:"var(--warning)",fontWeight:700},children:H.length===1?`La landing ${ye} tiene elegido un pÃxel que no está en esta lista: reporta a todos tus pÃxeles de Meta hasta que le elijas otro en su pestaña Dominio.`:`Las landings ${ye} tienen elegido un pÃxel que no está en esta lista: reportan a todos tus pÃxeles de Meta hasta que les elijas otro en su pestaña Dominio.`})})()]})]}),e.jsxs("div",{style:fe,children:[e.jsx("div",{style:{height:4,background:"linear-gradient(90deg,#4285F4,#EA4335 45%,#FBBC05 72%,#34A853)"}}),e.jsxs("div",{style:Be,children:[e.jsx(gc,{src:"/logos/google.svg",bg:"#F1F5FF",fit:"contain",size:42,pad:7}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:800,letterSpacing:"-.02em"},children:"Google y mapas de calor"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1},children:"Analytics · Ads · Tag Manager · Clarity · Hotjar"})]}),e.jsx(oi,{on:!!(pe.ga4||pe.ads||pe.gtm||pe.clarity||pe.hotjar),onLabel:pe.ads.trim()&&!pe.ads_label.trim()?"Falta la etiqueta de Ads":"Configurado",offLabel:"Sin conectar"})]}),e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:We,children:[e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Google Analytics 4"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:pe.ga4,onChange:I=>ce({ga4:I.target.value}),placeholder:"G-XXXXXXXXXX"}),e.jsx("p",{style:ve,children:"Analytics â Administrar â Flujos de datos. Al confirmarse un pedido, Lumy le manda la venta con su valor."})]}),e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Google Ads"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:pe.ads,onChange:I=>ce({ads:I.target.value}),placeholder:"AW-123456789"}),e.jsx("input",{style:{...E,fontFamily:"monospace",marginTop:7},value:pe.ads_label,onChange:I=>ce({ads_label:I.target.value}),placeholder:"Etiqueta de conversión"}),!!pe.ads.trim()&&!pe.ads_label.trim()&&e.jsxs("div",{style:{marginTop:8,padding:"9px 11px",background:"var(--notice-warning-bg, #FEF3C7)",border:"1px solid var(--notice-warning-border, #FDE68A)",borderRadius:9,fontSize:12.5,lineHeight:1.5,color:"var(--notice-warning-text, #78350F)"},children:[e.jsx("b",{children:"Asà no se cuenta ni una venta."}
1137)," Sin la etiqueta de conversión, Google Ads recibe tus visitas pero ninguna compra, y la puja automática optimiza a ciegas."]}),e.jsxs("p",{style:ve,children:["Ads solo ",e.jsx("b",{children:"cuenta la venta"}),' si pones también la etiqueta de conversión. La copias en Ads â Objetivos â Conversiones â tu conversión â "Etiqueta de conversión".']})]}),e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Google Tag Manager"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:pe.gtm,onChange:I=>ce({gtm:I.target.value}),placeholder:"GTM-XXXXXXX"}),e.jsx("p",{style:ve,children:"Si manejas tus etiquetas desde GTM, con esto queda instalado."})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{...D,marginTop:0},children:["Microsoft Clarity ",e.jsx("span",{style:{fontWeight:600,color:"var(--text-muted)"},children:"(gratis)"})]}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:pe.clarity,onChange:I=>ce({clarity:I.target.value}),placeholder:"abc123xyz"}),e.jsx("p",{style:ve,children:"Grabaciones y mapa de calor: ves hasta dónde bajan y dónde se van."})]}),e.jsxs("div",{children:[e.jsx("label",{style:{...D,marginTop:0},children:"Hotjar"}),e.jsx("input",{style:{...E,fontFamily:"monospace"},value:pe.hotjar,onChange:I=>ce({hotjar:I.target.value}),placeholder:"1234567"}),e.jsx("p",{style:ve,children:"El número de tu sitio en Hotjar (Site ID)."})]})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"14px 0 0",paddingTop:12,borderTop:"1px solid var(--border, #e8eaf0)",lineHeight:1.5},children:"Solo se pide el identificador, nunca código. Lumy instala el código oficial de cada herramienta. Asà nadie puede meter un script que lea los datos que tu comprador escribe en el formulario."})]})]}),e.jsxs("div",{className:"lk-sticky-save",style:{position:"sticky",bottom:0,zIndex:5,display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px 12px",minHeight:46,padding:"12px 80px 14px 0",background:"var(--bg-primary, #F0F2F8)",borderTop:"1px solid var(--border, #e8eaf0)"},children:[!(ie&&f.estado.tipo==="quieto")&&e.jsx(Wu,{estado:f.estado,enReposo:s?"Se guardan solos y aplican a todas tus landings":"Tus pixeles no cargaron. Recarga la página antes de cambiarlos.",style:{flex:"1 1 220px",...s?{}:{color:"var(--warning)"}}}),ie&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10,flexWrap:"wrap",fontSize:12.5,fontWeight:600,color:"var(--text, #111)"},children:[m.length===1?`Pusimos el pixel de ${m[0]==="meta_pixel_id"?"Meta":"TikTok"} de tu cuenta conectada.`:"Pusimos los pixeles de TikTok y Meta de tu cuenta conectada.",e.jsx("button",{type:"button",style:{...xa,padding:"7px 14px",fontSize:13},onClick:()=>{f.marcarEdicion(),f.guardarYa()},children:m.length===1?"Guardarlo":"Guardarlos"})]})]})]}):e.jsx("div",{style:{...Jt,textAlign:"center",color:"var(--text-muted)"},children:"Cargandoâ¦"})]})}function H8({landing:t,onBack:a}){var M,p;const n=$a(),[o,i]=h.useState("30d"),[s,u]=h.useState(""),[m,c]=h.useState(""),g=o==="today"?`from=${On()}&to=${On()}`:o==="7d"?`from=${Yo(On(),6)}&to=${On()}`:o==="30d"?`from=${Yo(On(),29)}&to=${On()}`:o==="custom"&&s&&m?`from=${s}&to=${m}`:"days=0",[f,b]=h.useState(null),[v,j]=h.useState(0),[S,$]=h.useState(!1);h.useEffect(()=>{b(null),n(`/api/landing/pages/${t.id}/analytics?${g}`).then(V=>V.json()).then(V=>{V.ok&&b(V)}).catch(()=>{})},[n,t.id,g,v]);async function C(){if(window.confirm(`¿Poner en cero las visitas de "${t.name}"? 1138 1139Borra TODAS las visitas de esta página, de todas las fechas, no solo las del periodo que estás viendo. Es útil si inflaste el contador probando tu propia página. 1140 1141No se puede deshacer. NO toca pedidos ni abandonos.`)){$(!0);try{(await(await n(`/api/landing/pages/${t.id}/reset-views`,{method:"POST"})).json()).ok?j(x=>x+1):alert("No se pudo reiniciar. Intenta de nuevo.")}catch{alert("No se pudo reiniciar. Intenta de nuevo.")}finally{$(!1)}}}const _=f==null?void 0:f.totals,N={textAlign:"left",fontSize:11.5,fontWeight:700,color:"var(--text-muted, #777)",padding:"8px 10px",borderBottom:"1px solid var(--border, #eee)",whiteSpace:"nowrap"},w={fontSize:13,padding:"9px 10px",borderBottom:"1px solid var(--border, #f0f0f4)",whiteSpace:"nowrap"};return e.jsxs("div",{style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:4,flexWrap:"wrap"},children:[e.jsx("button",{style:ee,onClick:a,children:"â Volver"}),e.jsxs("h2",{style:{fontSize:18,margin:0},children:["Visión general · ",t.name]}),e.jsx("div",{className:"date-filter-pill",style:{marginLeft:"auto"},children:[["today","Hoy"],["7d","7 dÃas"],["30d","30 dÃas"],["all","Todo"],["custom","Personalizado"]].map(([V,L])=>e.jsx("button",{onClick:()=>i(V),className:`date-pill-btn${o===V?" active":""}`,children:L},V))})]}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 14px",lineHeight:1.5},children:"Visitas y aperturas del formulario van por la fecha en que ocurrieron. Pedidos, facturación y entregas van por la fecha en que se creó el pedido."}),o==="custom"&&e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:14},children:[e.jsxs("label",{style:{fontSize:12.5,color:"var(--text-muted)",display:"inline-flex",gap:6,alignItems:"center"},children:["Desde ",e.jsx("input",{type:"date",value:s,max:On(),onChange:V=>u(V.target.value),style:{padding:"6px 9px",borderRadius:8,border:"1px solid var(--border,#e6e8ee)",fontFamily:"inherit",fontSize:12.5}})]}),e.jsxs("label",{style:{fontSize:12.5,color:"var(--text-muted)",display:"inline-flex",gap:6,alignItems:"center"},children:["Hasta ",e.jsx("input",{type:"date",value:m,max:On(),onChange:V=>c(V.target.value),style:{padding:"6px 9px",borderRadius:8,border:"1px solid var(--border,#e6e8ee)",fontFamily:"inherit",fontSize:12.5}})]})]}),f?e.jsxs(e.Fragment,{children:[(((M=f.tracking)==null?void 0:M.rechazos)||[]).length>0&&e.jsxs("div",{role:"alert",style:{background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:12,padding:"12px 14px",marginBottom:14,fontSize:13,lineHeight:1.5},children:[e.jsx("b",{style:{color:"var(--danger)"},children:"Hay ventas que no se están reportando."}),e.jsx("ul",{style:{margin:"7px 0 0",paddingLeft:18},children:(f.tracking.rechazos||[]).map((V,L)=>e.jsx("li",{style:{marginTop:L?5:0},children:V.motivo},L))}),e.jsx("div",{style:{marginTop:8,color:"var(--text-muted)",fontSize:12},children:"Este aviso se apaga solo cuando la siguiente venta salga bien. No tienes que marcar nada."})]}),((p=f.tracking)==null?void 0:p.metaPixelNoEsta)&&e.jsxs("div",{role:"alert",style:{background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:12,padding:"12px 14px",marginBottom:14,fontSize:13,lineHeight:1.5},children:[e.jsx("b",{style:{color:"var(--warning)"},children:"El pÃxel de Meta que elegiste para esta landing ya no está en tus pÃxeles."})," Mientras tanto, sus ventas se reportan a todos tus pÃxeles de Meta. Elige otro en la pestaña Dominio de esta landing."]}),f.tracking&&!f.tracking.healthy&&Number(_.orders)>0&&e.jsxs("div",{role:"alert",style:{background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:12,padding:"12px 14px",marginBottom:14,fontSize:13,lineHeight:1.5},children:[e.jsx("b",{style:{color:"var(--danger)"},children:"Tus ventas no le están llegando a Meta ni a TikTok."})," Tienes ",Number(_.orders)," venta(s) reales y tus campañas marcan ",e.jsx("b",{children:"0 conversiones"}),", asà que el algoritmo está optimizando a ciegas. Esto es distinto de conectar tu cuenta en Integraciones: eso sirve para leer tus campañas. Lo que falta aquà es el ",e.jsx("b",{children:"pÃxel de esta página"}),", en la pestaña Impulso. Si ya conectaste tu cuenta, ahà te aparece para elegirlo con un clic."]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(168px, 1fr))",gap:13,marginBottom:18},children:[e.jsx(xr,{idx:0,label:"Visitas",value:Number(_.views).toLocaleStr
1141ing("es-CO"),num:Number(_.views)||0,fmt:V=>Math.round(V).toLocaleString("es-CO"),trend:(f.series||[]).map(V=>Number(V.visits)||0)}),e.jsx(xr,{idx:1,label:"Pedidos",value:Number(_.orders).toLocaleString("es-CO"),num:Number(_.orders)||0,fmt:V=>Math.round(V).toLocaleString("es-CO"),sub:Eg(_.eliminados),trend:(f.series||[]).map(V=>Number(V.orders)||0)}),e.jsx(xr,{idx:2,hero:!0,label:"Facturación",value:Nr(_.revenue),num:Number(_.revenue)||0,fmt:Nr,accent:"#16a34a",sub:"pedidos generados, aún no cobrados",trend:(f.series||[]).map(V=>Number(V.revenue)||0)}),e.jsx(xr,{idx:3,label:"Ticket promedio",value:Nr(_.aov),num:Number(_.aov)||0,fmt:Nr,sub:"promedio de los que no se cancelaron",trend:(f.series||[]).map(V=>Number(V.revenue)||0),trendDenom:(f.series||[]).map(V=>Number(V.orders)||0)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:10,flexWrap:"wrap",marginTop:-2,marginBottom:14},children:[e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Las flechas comparan la segunda mitad del periodo elegido contra la primera."}),e.jsx("button",{onClick:C,disabled:S,style:{...ee,padding:"5px 10px",fontSize:11.5,color:"var(--text-muted)"},children:S?"Poniendo en ceroâ¦":"Poner las visitas en cero"})]}),(()=>{var Q;const V=Number(_.views)||0,L=Number(_.opens)||0,x=Number(_.orders)||0,z=Number((Q=f.cod)==null?void 0:Q.delivered)||0,G=(de,pe)=>pe>0?Math.min(100,Math.round(de/pe*1e3)/10):null,B=[{label:"Visitas",val:V,color:"#0866FF"},{label:"Abrió el formulario",val:L,color:"#6366f1"},{label:"Pedidos",val:x,color:"#0ea5e9"},{label:"Entregados",val:z,color:"#16a34a"}],U=Math.max(1,V,L,x,z),ne=[{lab:"Visitas â Pedidos",val:G(x,V),c:"#0ea5e9"},{lab:"Visitas â Formulario",val:G(L,V),c:"#6366f1"},{lab:"Formulario â Pedido",val:G(x,L),c:"#16a34a"}];return e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",marginBottom:18,alignItems:"stretch"},children:[e.jsxs("div",{style:{...Jt,flex:"2 1 420px",minWidth:0},children:[e.jsx("h3",{style:{margin:"0 0 3px",fontSize:15},children:"Comportamiento de los visitantes"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 14px"},children:"De la visita al pedido entregado. Donde más se acorta la barra, ahà pierdes clientes."}),B.map(de=>e.jsxs("div",{style:{marginBottom:11},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12.5,marginBottom:5},children:[e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:de.label}),e.jsx("b",{style:{fontVariantNumeric:"tabular-nums"},children:de.val.toLocaleString("es-CO")})]}),e.jsx("div",{style:{height:12,borderRadius:7,background:"var(--input-bg, #eef1f6)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:(de.val>0?Math.max(2,Math.min(100,de.val/U*100)):0)+"%",background:de.color,borderRadius:7,transition:"width .55s cubic-bezier(.22,.61,.36,1)"}})})]},de.label))]}),e.jsx("div",{style:{flex:"1 1 280px",minWidth:0,display:"flex",flexDirection:"column",gap:12},children:ne.map(de=>e.jsxs("div",{style:{...Jt,padding:"14px 16px",flex:1,display:"flex",flexDirection:"column",justifyContent:"center"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".03em"},children:de.lab}),e.jsx("div",{style:{fontSize:"clamp(23px,5vw,29px)",fontWeight:800,color:de.val==null?"var(--text-muted)":de.c,letterSpacing:"-.02em",marginTop:4,fontVariantNumeric:"tabular-nums"},children:de.val==null?"â":de.val+"%"})]},de.lab))})]})})(),e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",marginBottom:18,alignItems:"stretch"},children:[f.formFunnel&&(()=>{const V=f.formFunnel,L=[{k:"Celular",n:Number(V.phone)||0},{k:"Departamento",n:Number(V.department)||0},{k:"Ciudad",n:Number(V.city)||0},{k:"Dirección",n:Number(V.address)||0},{k:"Pedido",n:Number(V.order)||0}],x=Math.max(1,...L.map(G=>G.n)),z=L.some(G=>G.n>0);return e.jsxs("div",{style:{...Jt,flex:"2 1 420px",minWidth:0},children:[e.jsx("h3",{style:{margin:"0 0 3px",fontSize:15},children:"Comportamiento en el formulario"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 14px",lineHeight:1.5},children:'Cuántos llegaron a llenar cada campo. Aquà solo aparece quien alcanzó a escribir su nombre o su celular: por eso el número es menor que "Abrió el formulario".'}),z?L.map((G,B)=>e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12.5,marginBottom:5},children:[e.jsx("span",{style:{color:"var(--text-muted)",fontWeight:600},children:G.k}),e.jsx("b",{style:{fontVariantNumeric:"tabular-nums"}
1141,children:G.n.toLocaleString("es-CO")})]}),e.jsx("div",{style:{height:12,borderRadius:7,background:"var(--input-bg, #eef1f6)",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:(G.n>0?Math.max(2,Math.min(100,G.n/x*100)):0)+"%",background:B===L.length-1?"#16a34a":"#f59e0b",borderRadius:7}})})]},G.k)):e.jsx("p",{style:{fontSize:13,color:"var(--text-muted)",textAlign:"center",padding:"8px 0"},children:"Aún sin datos. Se llena con los abandonos nuevos (medición activada el 22/06)."})]})})(),f.cod&&(()=>{const V=Number(f.cod.delivered)||0,L=Number(f.cod.returned)||0,x=Number(_.orders)||0,z=V+L,G=ei(V,L),B=G==null?null:Math.round(G*100),U=Number(f.cod.shipped)||0,ne=Number(f.cod.pending)||0,Q=Number(f.cod.issue)||0,de=(pe,ce,ve)=>e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".02em"},children:pe}),e.jsx("div",{style:{fontSize:24,fontWeight:800,color:ve||"var(--text,#171717)",fontVariantNumeric:"tabular-nums",lineHeight:1.1,marginTop:2},children:ce.toLocaleString("es-CO")})]},pe);return e.jsxs("div",{style:{...Jt,flex:"1 1 280px",minWidth:0},children:[e.jsx("h3",{style:{margin:"0 0 3px",fontSize:15},children:"Contraentrega"}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"0 0 14px",lineHeight:1.5},children:"Lo que de verdad importa: si la plata llegó. Según el estado de tus pedidos en el CRM. Si tienes Dropi conectado, se actualiza solo."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[de("Entregados",V,"#16a34a"),de("Devueltos o rechazados al recibir",L,"#dc2626"),de("En camino",U,"#0ea5e9"),de("Por confirmar",ne,"#b45309"),Q>0?de("Con novedad",Q,"#dc2626"):null]}),e.jsx("div",{style:{marginTop:13,paddingTop:12,borderTop:"1px solid var(--border,#eef1f6)",fontSize:12.5,color:"var(--text-muted)",lineHeight:1.5},children:B!=null?e.jsxs(e.Fragment,{children:["Tasa de entrega ",e.jsxs("b",{style:{color:"var(--text,#171717)",fontSize:16,marginLeft:4},children:[B,"%"]}),e.jsxs("div",{style:{fontSize:11.5,marginTop:3},children:["Sobre ",z.toLocaleString("es-CO")," pedido",z===1?"":"s"," ya resuelto",z===1?"":"s",U>0?`. Quedan ${U.toLocaleString("es-CO")} en camino.`:"."]})]}):x>0?e.jsx(e.Fragment,{children:"TodavÃa ningún pedido se entregó ni se devolvió, asà que aún no hay tasa de entrega. Aparece con el primero que se resuelva."}):e.jsx(e.Fragment,{children:"Aún no hay pedidos en este periodo."})})]})})()]}),e.jsxs("div",{style:{...Jt,padding:0,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 14px 8px"},children:[e.jsx("h3",{style:{margin:0,fontSize:15},children:"Por campaña (UTM)"}),e.jsxs("p",{style:{fontSize:11.5,color:"var(--text-muted)",margin:"4px 0 0"},children:["Agrega ",e.jsx("code",{children:"?utm_source=tiktok&utm_medium=paid&utm_campaign=mi-campana"})," a la URL de tus anuncios para ver cada campaña aquÃ."]})]}),(f.utm||[]).length===0?e.jsx("p",{style:{color:"var(--text-muted)",fontSize:13,textAlign:"center",padding:"18px 14px 22px"},children:"Aún no hay tráfico con UTM en este rango."}):e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{borderCollapse:"collapse",width:"100%",minWidth:620},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:N,children:"Fuente"}),e.jsx("th",{style:N,children:"Medio"}),e.jsx("th",{style:N,children:"Campaña"}),e.jsx("th",{style:{...N,textAlign:"right"},children:"Aperturas"}),e.jsx("th",{style:{...N,textAlign:"right"},children:"Pedidos"}),e.jsx("th",{style:{...N,textAlign:"right"},children:"Tasa"}),e.jsx("th",{style:{...N,textAlign:"right"},children:"Ingresos"})]})}),e.jsx("tbody",{children:f.utm.map((V,L)=>e.jsxs("tr",{children:[e.jsx("td",{style:w,children:V.source}),e.jsx("td",{style:w,children:V.medium}),e.jsx("td",{style:{...w,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},title:V.campaign,children:V.campaign}),e.jsx("td",{style:{...w,textAlign:"right"},children:V.opens.toLocaleString("es-CO")}),e.jsxs("td",{style:{...w,textAlign:"right",fontWeight:700}
1141,children:[V.orders.toLocaleString("es-CO"),Number(V.eliminados)>0&&e.jsx("div",{style:{fontSize:10.5,fontWeight:500,color:"var(--text-muted)",whiteSpace:"nowrap"},children:Eg(V.eliminados)})]}),e.jsx("td",{style:{...w,textAlign:"right",fontWeight:700,color:V.conv!=null&&V.conv>=15?"#16a34a":void 0},children:V.conv==null?"â":V.conv+"%"}),e.jsx("td",{style:{...w,textAlign:"right"},children:Nr(V.revenue)})]},L))})]})})]})]}):e.jsx("div",{style:{...Jt,textAlign:"center",color:"var(--text-muted)"},children:"Cargandoâ¦"})]})}function G8({q:t,range:a,cFrom:n,cTo:o}){const i=$a(),[s,u]=h.useState(null),[m,c]=h.useState(!1),[g,f]=h.useState(!1),[b,v]=h.useState(""),[j,S]=h.useState(""),[$,C]=h.useState(!1),[_,N]=h.useState(!1),[w,M]=h.useState(""),[p,V]=h.useState(!1),[L,x]=h.useState(""),[z,G]=h.useState(""),B=()=>{c(!0),i("/api/landing/event-leads").then(I=>I.ok?I.json():null).then(I=>{I&&I.ok&&u(I)}).catch(()=>{}).finally(()=>c(!1))};if(h.useEffect(()=>{B()},[]),!s)return e.jsx("div",{style:{padding:30,textAlign:"center",color:"var(--text-secondary,#64748b)",fontSize:13},children:m?"Cargando leads del eventoâ¦":"Sin acceso a los leads del evento."});const U=Array.isArray(s.leads)?s.leads:[],ne=I=>{try{return new Date(String(I||"").replace(" ","T")+"Z").toLocaleDateString("en-CA",{timeZone:"America/Bogota"})}catch{return""}};let Q="",de="";if(a!=="all"){const I=On();Q=de=I,a==="yesterday"?Q=de=Yo(I,1):a==="3d"?Q=Yo(I,2):a==="7d"?Q=Yo(I,6):a==="15d"?Q=Yo(I,14):a==="custom"&&(Q=n,de=o)}const pe=String(t||"").trim().toLowerCase(),ce=U.filter(I=>{if(a!=="all"){const H=ne(I.created_at);if(!H||Q&&H<Q||de&&H>de)return!1}return!(pe&&![I.name,I.whatsapp,I.email,I.city].map(ye=>String(ye||"").toLowerCase()).join(" ").includes(pe))}),ve=I=>I==="sent"?{t:"Enviado a Meta",bg:"var(--notice-success-bg)",c:"var(--success)"}:I==="failed"?{t:"Falló en Meta",bg:"var(--notice-danger-bg)",c:"var(--danger)"}:I==="skipped"?{t:"CAPI apagado",bg:"rgba(100,116,139,.12)",c:"#64748b"}:I==="skipped_frio"?{t:"FrÃo: no va a Meta",bg:"rgba(100,116,139,.12)",c:"#64748b"}:{t:"Enviandoâ¦",bg:"var(--notice-warning-bg)",c:"var(--warning)"},ge={dropi:"Dropshipping (Dropi)",propio:"Marca propia",frenado:"Vendió, frenado",empezar:"Quiere empezar"},Te={mensual:"Pauta mensual",aveces:"Pauta a veces",no:"No pauta aún"},ie={lt300:"<$300k","300a1m":"$300k-1M","1a5m":"$1M-5M",gt5m:">$5M"},fe={0:"Sin pedidos aún","1a30":"1â30 pedidos/mes","30a150":"30â150 pedidos/mes",gt150:"+150 pedidos/mes"},Be={nada:"Sin herramienta",whatsapp:"Solo WhatsApp",plataforma:"Otra plataforma",shopify:"Shopify"},We={...Te,lt100:"Pauta <$100","100a500":"Pauta $100â500",gt500:"Pauta +$500"},ze=()=>{const I=["Nombre","WhatsApp","Correo","Ciudad","Modalidad","Calidad","Demo pedida","Vende","Pauta","Gasto","Fuente","Meta","Fecha"],H=se=>'"'+String(se??"").replace(/"/g,'""')+'"',ye=U.map(se=>[se.name,se.whatsapp,se.email,se.city,se.format,se.band,se.demo_texto||"",ge[se.vende]||se.vende,Te[se.pauta]||se.pauta,ie[se.gasto]||se.gasto,se.source,se.capi_status,se.created_at].map(H).join(",")).join(` 1142`),De=new Blob(["\uFEFF"+I.map(H).join(",")+` 1143`+ye],{type:"text/csv;charset=utf-8"}),Ue=document.createElement("a");Ue.href=URL.createObjectURL(De),Ue.download="leads-evento.csv",Ue.click(),setTimeout(()=>URL.revokeObjectURL(Ue.href),1e3)},tt=()=>{C(!0),G(""),i("/api/admin/whatsapp/create-registro-template",{method:"POST"}).then(I=>I.json().catch(()=>null)).then(I=>{var ye;const H=(ye=I==null?void 0:I.results)==null?void 0:ye[0];H!=null&&H.ok?G(H.status==="ya existe"?"La plantilla ya existe en Meta.":"Plantilla de registro enviada a revisión de Meta. Suele aprobarse en minutos a unas horas."):G((I==null?void 0:I.error)||(H==null?void 0:H.error)||"No se pudo enviar. Revisa la configuración de WhatsApp en Railway.")}).catch(()=>G("Error de red al llamar al servidor.")).finally(()=>C(!1))},Fe=()=>{window.confirm("Enviar la invitación de registro a TODOS los inscritos del evento que aún no la han recibido?")&&(V(!0),x(""),i("/api/admin/whatsapp/send-registro-event",{method:"POST"}).then(I=>I.json().catch(()=>null)).then(I=>{var H;(I==null?void 0:I.ok)!==void 0?x(`Enviados ${I.sent} de ${I.total}${I.failed?` · ${I.failed} fallaron${(H=I.errors)!=null&&H.length?" ("+I.errors[0]+"â¦)":""}`:""}. Reintentar solo envÃa a quienes faltan.`):x("No se pudo enviar. Revisa que la plantilla esté aprobada en Meta.")}
1143).catch(()=>x("Error de red al llamar al servidor.")).finally(()=>V(!1)))},F=(I,H)=>{window.confirm(`¿Borrar el lead "${H||I}"? Esto no se puede deshacer.`)&&i(`/api/landing/event-leads/${I}`,{method:"DELETE"}).then(ye=>ye.json()).then(()=>B()).catch(()=>{})},Re=(I,H)=>{j||(S(I+":"+H),i(`/api/landing/event-leads/${I}/resend`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:H})}).then(ye=>ye.json()).then(ye=>{ye.ok?B():window.alert(ye.message||"No se pudo enviar.")}).catch(()=>window.alert("Error de conexión.")).finally(()=>S("")))},K=()=>{window.confirm(`¿Borrar TODOS los ${U.length} leads del evento? Ãsalo solo para limpiar pruebas. No se puede deshacer.`)&&i("/api/landing/event-leads",{method:"DELETE"}).then(I=>I.json()).then(()=>B()).catch(()=>{})};return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,flexWrap:"wrap",marginBottom:10},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)"},children:[e.jsx("b",{style:{color:"var(--text,#111)"},children:ce.length})," en vista · ",e.jsx("b",{style:{color:"var(--danger)"},children:ce.filter(I=>I.band==="caliente").length})," calientes · ",e.jsx("b",{style:{color:"var(--warning)"},children:ce.filter(I=>I.band==="tibio").length})," tibios · ",ce.filter(I=>(I.band||"frio")==="frio").length," frÃos · ",e.jsx("b",{style:{color:"var(--success)"},children:s.sent})," a Meta",ce.length!==U.length?` · de ${s.total} inscritos en total`:""]}),e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:2},children:["WhatsApp: Invitación registro ",e.jsx("b",{style:{color:"var(--success)"},children:s.wa_registro??0}),"/",s.con_whatsapp??0,(s.registro_pendientes??0)>0?e.jsxs(e.Fragment,{children:[" · ",e.jsx("b",{style:{color:"var(--warning)"},children:s.registro_pendientes})," pendientes"]}):null]})]}),e.jsx("button",{onClick:B,disabled:m,style:{flex:"none",fontSize:11.5,fontWeight:700,padding:"6px 11px",borderRadius:8,border:"1px solid var(--border,#e8eaf0)",background:"var(--card-bg,#fff)",color:"var(--text-secondary,#64748b)",cursor:"pointer",fontFamily:"inherit"},children:m?"â¦":"Actualizar"}),U.length>0&&e.jsx("button",{onClick:ze,style:{flex:"none",fontSize:11.5,fontWeight:700,padding:"6px 11px",borderRadius:8,border:"1px solid var(--border,#e8eaf0)",background:"var(--card-bg,#fff)",color:"var(--text-secondary,#64748b)",cursor:"pointer",fontFamily:"inherit"},children:"Excel"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",marginBottom:10},children:[e.jsx("button",{onClick:tt,disabled:$,title:"Manda el texto del mensaje a Meta para que lo apruebe. No le escribe a nadie.",style:{flex:"none",fontSize:11.5,fontWeight:700,padding:"6px 12px",borderRadius:8,border:"1px solid rgba(37,211,102,.45)",background:"rgba(37,211,102,.08)",color:"#128C7E",cursor:$?"default":"pointer",fontFamily:"inherit",opacity:$?.6:1},children:$?"Enviandoâ¦":"Actualizar el mensaje de invitación"}),e.jsx("button",{onClick:Fe,disabled:p,title:"Le manda la invitación a crear su cuenta a los inscritos que aún no la han recibido. Salta a los frÃos: no han vendido nada y escribirles quema el número.",style:{flex:"none",fontSize:11.5,fontWeight:700,padding:"6px 12px",borderRadius:8,border:"1px solid rgba(8,102,255,.4)",background:"rgba(8,102,255,.08)",color:"#0866FF",cursor:p?"default":"pointer",fontFamily:"inherit",opacity:p?.6:1},children:p?"Enviandoâ¦":"Invitar a los que faltan"}),U.length>0&&e.jsx("button",{onClick:K,style:{flex:"none",marginLeft:"auto",fontSize:11.5,fontWeight:700,padding:"6px 12px",borderRadius:8,border:"1px solid var(--notice-danger-border)",background:"var(--notice-danger-bg)",color:"var(--danger)",cursor:"pointer",fontFamily:"inherit"},children:"Borrar todos"})]}),(b||L||z||w)&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginBottom:10,lineHeight:1.5},children:[b,L,z,w].filter(Boolean).join(" · ")}),U.length===0?e.jsx("div",{style:{padding:24,fontSize:12.5,color:"var(--text-secondary,#64748b)",textAlign:"center"},children:"Aún no hay inscritos. Cuando alguien se registre en /evento, aparece aquÃ."}):ce.length===0?e.jsx("div",{style:{padding:24,fontSize:12.5,color:"var(--text-secondary,#64748b)",textAlign:"center"},children:'Ningún lead en este rango de fechas o búsqueda. Prueba con "Todos".'}):e.jsx("div",{className:"lk-board",style:{display:"flex",alignItems:"stretch",gap:10,overflowX:"auto",overflowY:"hidden",padding:"2px 2px 12px"},children:[["caliente","Calientes","#dc2626"],["tibio","Tibios","#b45309"],["frio","FrÃos","#64748b"]].map(([I,H,ye])=>{const De=ce.filter(Ue=>(Ue.band||"frio")===I);return e.jsxs("div",{style:{flex:"1 1 0",minWidth:244,maxWidth:400,display:"flex",flexDirection:"column",borderRadius:14,background:`linear-gradient(180deg, ${ye}0d 0%, var(--bg-soft, #f4f6fa) 92px)`,border:"1px solid var(--border, #e8eaf0)",maxHeight:"calc(100vh - 250px)",minHeight:120},children:[e.jsxs("div",{style:{padding:"11px 12px 9px",flex:"0 0 auto",borderBottom:"1px solid var(--border, #e8eaf0)",display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:ye,flex:"none",boxShadow:`0 0 0 3px ${ye}22`}}),e.jsx("b",{style:{fontSize:11,fontWeight:800,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text, #111)"},children:H}),e.jsx("span",{style:{marginLeft:"auto",fontSize:11,fontWeight:800,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)",background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:999,padding:"1px 8px"},children:De.length})]}),e.jsx("div",{style:{overflowY:"auto",padding:9,display:"flex",flexDirection:"column",gap:8},children:De.length===0?e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #9aa0b0)",textAlign:"center",padding:"16px 4px"},children:"Sin leads aquÃ"}):De.map(Ue=>{const se=ve(Ue.capi_status),we=!!String(Ue.whatsapp||"").trim(),Ye=(lt,jt)=>e.jsx("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-secondary,#475569)",background:"var(--bg-soft,#f4f6fa)",border:"1px solid var(--border,#e8eaf0)",borderRadius:999,padding:"2px 8px"},children:lt});return e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"10px 11px",boxShadow:"0 1px 2px rgba(16,24,40,.04)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",ga
1143p:6},children:[e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:700,color:"var(--text, #111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ue.name||"â"}),Ue.email&&e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #9aa0b0)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ue.email})]}),e.jsx("button",{onClick:()=>F(Ue.id,Ue.name),title:"Borrar lead",style:{flex:"none",border:"none",background:"none",cursor:"pointer",padding:3,color:"var(--text-muted, #b3b9c6)",display:"inline-flex"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),e.jsx("path",{d:"M10 11v6M14 11v6"})]})})]}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:5,marginTop:8},children:[Ue.whatsapp&&Ye(Ue.whatsapp),Ue.city&&Ye(Ue.city)]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",marginTop:7,lineHeight:1.4},children:[fe[Ue.pedidos],ge[Ue.vende],We[Ue.pauta],Be[Ue.herramienta],ie[Ue.gasto]].filter(Boolean).join(" · ")||"Sin datos del cuestionario"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginTop:8},children:[e.jsx(Lu,{source:Ue.source,s:9.5}),e.jsx("span",{style:{fontSize:10,fontWeight:800,color:se.c,background:se.bg,borderRadius:999,padding:"2px 8px"},children:se.t})]}),e.jsx("div",{style:{marginTop:8,display:"flex",gap:4,flexWrap:"wrap"},title:"Invitación a crear su cuenta (clic para enviar o reenviar)",children:["Inv"].map((lt,jt)=>{const Je=Ue.wa_registro,Ct="registro",st=j===Ue.id+":"+Ct;return e.jsx("button",{disabled:st||!we,onClick:()=>Re(Ue.id,Ct),title:we?Je?"Invitación enviada. Clic para reenviar":"Invitación pendiente. Clic para enviarla":"Sin WhatsApp",style:{fontSize:10,fontWeight:800,color:Je?"#128C7E":"var(--text-muted, #b3b9c6)",background:Je?"rgba(37,211,102,.15)":"rgba(100,116,139,.08)",border:Je?"1px solid rgba(37,211,102,.3)":"1px solid transparent",borderRadius:999,padding:"2px 8px",cursor:we?"pointer":"default",opacity:st?.5:1,fontFamily:"inherit"},children:st?"â¦":lt+(Je?"â":"")},lt)})})]},Ue.id)})})]},I)})})]})}function V8({landingId:t,onBack:a,onNavLandings:n,onNavPagos:o,shopifyOnly:i=!1}){var Ed,zd,Rd,Nd,Ld,Pd,Dd,Bd,Wd,qd,Md,Fd,Od,Hd,Gd,Vd,Ud;const s=$a(),[u,m]=h.useState([]),[c,g]=h.useState([]),[f,b]=h.useState(0),[v,j]=h.useState({}),[S,$]=h.useState({}),[C,_]=h.useState([]),[N,w]=h.useState({}),[M,p]=h.useState(null),[V,L]=h.useState(0),[x,z]=h.useState(null),[G,B]=h.useState(!1),[U,ne]=h.useState({}),[Q,de]=h.useState(null),[pe,ce]=h.useState(null),ve=d=>ce(d),[ge,Te]=h.useState(null),[ie,fe]=h.useState(null),[Be,We]=h.useState([]),[ze,tt]=h.useState(""),[Fe,F]=h.useState(!1),[Re,K]=h.useState(!1),[I,H]=h.useState(null),ye=async d=>{try{const T=await(await s(`/api/whatsapp/inbox/conversations/${d}/messages?limit=60`)).json();(T.ok||Array.isArray(T.messages))&&We((T.messages||T.items||[]).slice(-60))}catch{}try{await s(`/api/whatsapp/inbox/conversations/${d}/read`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}),Et()}catch{}},De=async d=>{Te(d),fe(null),We([]),tt("");try{const T=await(await s(`/api/whatsapp/inbox/conversation-by-phone?phone=${encodeURIComponent(String(d.phone||""))}&pais=${encodeURIComponent(String(d.country||""))}`)).json();T.ok&&T.conversation?(fe(T.conversation),ye(T.conversation.id),H({}),Lj(s,Number(T.conversation.id)).then(H).catch(()=>{})):fe(!1)}catch{fe(!1)}},[Ue,se]=h.useState(null),we=()=>se(d=>(d&&URL.revokeObjectURL(d.url),null));h.useEffect(()=>()=>{Ue&&URL.revokeObjectURL(Ue.url)},[Ue]);const Ye=d=>{var O;const A=Array.from(((O=d.clipboardData)==null?void 0:O.items)||[]).find(W=>W.kind==="file"&&/^image\//.test(W.type)),T=A==null?void 0:A.getAsFile();T&&(d.preventDefault(),Dj(T).then(W=>{we(),se({file:W,url:URL.createObjectURL(W)})}))},lt=async()=>{if(!(!(ie!=null&&ie.id)||!Ue||Fe)){F(!0);try{const d=new URLSearchParams({filename:Ue.file.name,caption:ze.trim().slice(0,1024)}),T=await(await s(`/api/whatsapp/inbox/conversations/${ie.id}/send-media?`+d.toString(),{method:"POST",headers:{"Content-Type":Ue.file.type||"application/octet-stream"},body:Ue.file})).json().catch(()=>({}));T.ok?(tt(""),we(),ye(ie.id)):alert(T.message||"No se pudo enviar la imagen.")}catch{alert("Sin conexión.")}finally{F(!1)}}},jt=async()=>
1143{if(!(!(ie!=null&&ie.id)||!ze.trim()||Fe)){F(!0);try{const A=await(await s(`/api/whatsapp/inbox/conversations/${ie.id}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:ze.trim()})})).json();if(A.ok){tt(""),ye(ie.id);try{const T=document.querySelector('textarea[placeholder^="EscrÃbele aquÃ"]');T&&(T.style.height="auto")}catch{}}else alert(A.message||"No se pudo enviar.")}catch{alert("Sin conexión.")}finally{F(!1)}}};h.useEffect(()=>{const d=A=>{A.key==="Escape"&&(st?la(null):Vn?ar(null):Ln?ho(!1):Wa?Pn(null):wn?Io(null):Re?K(!1):ge?Te(null):Q?de(null):pe&&ce(null))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)});const Je={flex:"none",width:32,height:32,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--bg-soft, #f1f3f8)",border:"1px solid var(--border, #e4e7f0)",borderRadius:9,fontSize:15,cursor:"pointer",color:"var(--text, #333)"},Ct=["Muy caro / precio","Ya no lo quiere","Compró en otro lado","No contesta","Zona sin cobertura","Datos malos o incompletos","Pedido repetido / error","Otro"],[st,la]=h.useState(null),ia=d=>la({ids:d,motivo:"",otro:""}),ha=d=>
1143{if(!d||!String(d.phone||"").trim())return null;const A=Number(d.conf_entregados)||0,T=Number(d.conf_devueltos)||0;if(A===0&&T===0)return{label:"Primera vez",color:"var(--text-secondary)",bg:"var(--bg-tertiary)",detalle:"Sin entregas ni devoluciones previas con este teléfono."};const O=`${A} ${A===1?"entrega":"entregas"} · ${T} ${T===1?"devolución/rechazo":"devoluciones/rechazos"} contigo.`;return T===0?{label:"Confiable",color:"var(--success)",bg:"var(--notice-success-bg)",detalle:O}:T>A?{label:"Riesgosa",color:"var(--danger)",bg:"var(--notice-danger-bg)",detalle:O}:{label:"Media",color:"var(--warning)",bg:"var(--notice-warning-bg)",detalle:O}},[da,Na]=h.useState(!0),[wa,La]=h.useState(!1),[Gt,he]=h.useState(""),[Me,yt]=h.useState(null),[kt,ct]=h.useState(""),[xt,Ut]=h.useState(""),[Qt,$e]=h.useState(""),[Pe,ue]=h.useState(""),[oe,Ae]=fv(),[He,ut]=h.useState(new Set),at=h.useRef(null),[dt,Ge]=h.useState(null),[vt,Nt]=h.useState(null),[sa,Pa]=h.useState(null),[Ot,Ia]=h.useState("board"),[za,sn]=h.useState(""),ba=!!((Ed=ni().user)!=null&&Ed.es_miembro),[Ga,Ie]=h.useState("today"),[ka,Zo]=h.useState(Yo(On(),7)),[Cn,Xo]=h.useState(On()),[Nn,er]=h.useState(!0),[Oa,Xa]=h.useState(null),Kn=h.useRef(null),[qa,_n]=h.useState({cc:"57",nat:10});h.useEffect(()=>{s("/api/me/country").then(d=>d.json()).then(d=>{const A=rn[d==null?void 0:d.country];A&&_n({cc:A.phoneCc,nat:A.natLen})}).catch(()=>{})},[]);const Va=h.useRef(!1),[mn,po]=h.useState(null),[hn,Co]=h.useState(!1),[go,fn]=h.useState(null),[Da,Hn]=h.useState(!1),Ra=((zd=ni().user)==null?void 0:zd.role)==="admin",ln=ni().user,mo=dv().limits,X=(ln==null?void 0:ln.role)==="admin"||gj(mo,"shopify"),[ae,ot]=h.useState("nuestros"),[it,ma]=h.useState([]),ta=async()=>{try{const A=await(await s("/api/whatsapp/labels")).json();ma(Array.isArray(A.labels)?A.labels:Array.isArray(A.items)?A.items:[])}catch{}};h.useEffect(()=>{ta()},[]);const[pn,Gn]=h.useState([]),[Ln,ho]=h.useState(!1),[tr,fo]=h.useState(""),[Dr,Ba]=h.useState([]),[_o,Yn]=h.useState("");h.useEffect(()=>{Ln&&(s("/api/landing/crm/local-cities-options").then(d=>d.json()).then(d=>{d.ok&&Array.isArray(d.options)&&Ba(d.options)}).catch(()=>{}),s("/api/landing/crm/local-export-key",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(d=>d.json()).then(d=>{d.ok&&d.key&&Yn(d.key)}).catch(()=>{}))},[Ln]);const yr=async()=>{const d=zt.filter(J=>ao(J)&&!J.repetido_de&&!cn(J).length&&!J.local_exported_at&&!["nuevo","contactado","pendiente_confirmar","cancelado","rechazado","abandonado","lead_wa","pago_pendiente"].includes(J.crm_status));if(!d.length){alert("No hay pedidos confirmados sin exportar entre los que estás viendo. Revisa los filtros, o confirma primero (o arrastra a Confirmado).");return}const A=J=>'"'+String(J??"").replace(/"/g,'""')+'"',O=[["id","nombre","telefono","direccion","ciudad","departamento","total","producto","etapa"].join(","),...d.map(J=>{var le;return[J.id,J.customer_name,J.phone,Nj(J.address,(()=>{try{const Ve=typeof J.fields=="string"?JSON.parse(J.fields):J.fields;return Ve&&typeof Ve=="object"?Ve:{}}catch{return{}}})()),J.city,J.department,J.total_cop,Array.isArray(J.products)&&((le=J.products[0])==null?void 0:le.name)||J.landing_name||"",J.crm_status].map(A).join(",")})].join(`\r 1144`),W=document.createElement("a");W.href=URL.createObjectURL(new Blob(["\uFEFF"+O],{type:"text/csv;charset=utf-8"})),W.download="pedidos-local.csv",W.click();for(const J of d)await zo(J.id,{local_exported:!0,local_exported_at:new Date().toISOString()})};h.useEffect(()=>{s("/api/landing/crm/local-config").then(d=>d.json()).then(d=>{d.ok&&Array.isArray(d.cities)&&Gn(d.cities)}).catch(()=>{})},[]);const $o=async d=>{Gn(d);try{await s("/api/landing/crm/local-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cities:d})})}catch{}},ja=d=>String(d||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g," ").trim().replace(/ d c$/,""),dn=d=>!!(d!=null&&d.id)&&pn.some(A=>ja(A)===ja(d.city)),ao=d=>dn(d)&&!d.dropi_order_id&&!d.mastershop_order_id&&!d.envios99_order_id,[Vn,ar]=h.useState(null),q=(d,A,T)=>{ao(d)?ar({s:d,nombre:A,continuar:T}):T()},[te,ke]=h.useState({}),[bt,oa]=h.useState({}
1144),[wt,pt]=h.useState({}),[Zt,At]=h.useState(0),Et=async()=>{try{const A=await(await s("/api/landing/crm/wa-estado")).json();A.ok&&A.estados&&ke(A.estados),A.ok&&oa(A.no_enviados||{}),A.ok&&pt(A.numero_por_pais||{}),A.ok&&At(Number(A.numeros)||0)}catch{}};h.useEffect(()=>{Et();const d=setInterval(()=>{document.hidden||Et()},15e3);return()=>clearInterval(d)},[]);const xo=d=>{const A=Dn(d==null?void 0:d.phone,d==null?void 0:d.country);if(A.length<7)return null;const T=wt[String((d==null?void 0:d.country)||"").toUpperCase()]||"";return T&&te[A+"|"+T]||te[A]||null},[Ma,en]=h.useState(null),[bo,Os]=h.useState(!1),[Jn,ii]=h.useState(!1),[nr,or]=h.useState(""),si=async()=>{if(!Jn){ii(!0),or("");try{const A=await(await s("/api/landing/crm/sincronizar",{method:"POST"})).json();if(!(A!=null&&A.ok)){or((A==null?void 0:A.error)||"No se pudo sincronizar.");return}if(A.ninguna){or("No tienes una logÃstica conectada.");return}or((A.logisticas||[]).map(T=>T.ok?`${T.logistica}: ${T.pedidos} pedido${T.pedidos===1?"":"s"} al dÃa${T.detalle?" · "+T.detalle:""}`:`${T.logistica}: no respondió (${T.detalle})`).join(" · ")),Ca(!0)}catch{or("Sin conexión.")}finally{ii(!1),setTimeout(()=>or(""),12e3)}}};h.useEffect(()=>{Ot!=="producto"&&en(null)},[Ot]),h.useEffect(()=>{if(!Ma)return;const d=T=>{const O=T.target;!O||O.closest('button, a, input, select, textarea, [role="dialog"], .lk-bcard, .lk-pauta-embudo td, .lk-filtro-producto')||en(null)},A=T=>{T.key==="Escape"&&en(null)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",A)}},[Ma]);const[Zn,rr]=h.useState(()=>{try{return localStorage.getItem("lk_crm_orden")||"urgencia"}catch{return"urgencia"}}),vr=d=>{rr(d);try{localStorage.setItem("lk_crm_orden",d)}catch{}},li=d=>{const A=[...d];if(Zn==="plata")return A.sort((W,J)=>(Number(J.total_cop)||0)-(Number(W.total_cop)||0));if(Zn==="recientes")return A.sort((W,J)=>String(J.created_at||"").localeCompare(String(W.created_at||"")));const T=W=>{const J=String(W.crm_status_changed_at||W.created_at||""),le=String(W.crm_gestion_at||"");return is(le>J?le:J).hours},O=W=>{const J=Mo(W);return J==="vencido"?0:J==="futuro"?2:1};return A.sort((W,J)=>{const le=O(W),Ve=O(J);if(le!==Ve)return le-Ve;const gt=(Number(W.buyer_risk_pct)||0)>=40?1:0,Qe=(Number(J.buyer_risk_pct)||0)>=40?1:0;if(gt!==Qe)return Qe-gt;const Z=T(W),Rt=T(J);return Math.abs(Z-Rt)>.5?Rt-Z:(Number(J.total_cop)||0)-(Number(W.total_cop)||0)})},[Br,qo]=h.useState(null),di=async(d,A)=>{if(d){m(T=>T.map(O=>O.id!==d?O:{...O,...A.intento?{crm_gestiones:(Number(O.crm_gestiones)||0)+1,crm_gestion_at:new Date().toISOString().slice(0,19).replace("T"," ")}:{},...Object.prototype.hasOwnProperty.call(A,"posponer_hasta")?{crm_snooze_until:A.posponer_hasta}:{}}));try{await s("/api/landing/submissions/"+d+"/gestion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)})}catch{}}},Mo=d=>{const A=Date.parse(String(d.crm_snooze_until||"").replace(" ","T")+"Z");return isNaN(A)?"no":A>Date.now()?"futuro":"vencido"},Oi=d=>{try{return new Date(String(d.crm_snooze_until).replace(" ","T")+"Z").toLocaleString("es-CO",{timeZone:"America/Bogota",day:"2-digit",month:"short",hour:"numeric",minute:"2-digit"})}catch{return""}},Hs=()=>{const d=new Date(Date.now()-18e6),A=J=>new Date(J.getTime()+5*36e5).toISOString().slice(0,19).replace("T"," "),T=J=>{const le=new Date(d);return le.setUTCHours(J,0,0,0),le},O=(J,le)=>{const Ve=T(le);return Ve.setUTCDate(Ve.getUTCDate()+J),Ve},W=[{l:"En 1 hora",utc:A(new Date(d.getTime()+36e5))}];return d.getUTCHours()<17?W.push({l:"Hoy a las 6:00 p. m.",utc:A(T(18))}):d.getUTCHours()<19&&W.push({l:"Hoy a las 8:00 p. m.",utc:A(T(20))}),W.push({l:"Mañana a las 9:00 a. m.",utc:A(O(1,9))}),W.push({l:"En 3 dÃas, 9:00 a. m.",utc:A(O(3,9))}),W},[Wa,Pn]=h.useState(null),[Wr,ir]=h.useState([]),[ci,qr]=h.useState("nuevos"),Dn=(d,A)=>{const T=String(d||"").replace(/[^\d+]/g,"");if(!T)return"";try{return String(hj(T,br(String(A||"")||Rr().code||void 0))||"").replace(/\D/g,"")}catch{return T.replace(/\D/g,"")}},us=d=>Dn(d),Bn=()=>
1144{if(!Wa)return{tels:[],subPorTel:void 0};if(ci==="todos"||!Wa.alerta||!Wr.length)return{tels:Wa.tels,subPorTel:Wa.subPorTel};const d=new Set(Wr),A=Wa.tels.filter(O=>!d.has(us(O))),T={};for(const[O,W]of Object.entries(Wa.subPorTel||{}))d.has(O)||(T[O]=W);return{tels:A,subPorTel:Object.keys(T).length?T:void 0}},[$n,sr]=h.useState(null),[no,Hi]=h.useState("plantilla"),[Gi,Wn]=h.useState([]),[Un,Pt]=h.useState(""),[yo,lr]=h.useState(""),[Qa,ps]=h.useState(!1),[Mr,jr]=h.useState(""),[Ar,gs]=h.useState(""),[ms,Sr]=h.useState([]),hs=async(d,A,T="",O,W="",J=[])=>{Pn({etq:d,tels:A,subPorTel:O,alerta:W}),sr(null),jr(""),gs(""),lr(T),ir([]),qr("nuevos");const le=[...new Set(J.map(gt=>String(gt||"").trim().toUpperCase()).filter(Boolean))];Sr(le);const Ve={tipo:"lista",texto:A.join(` 1145`)};try{const Qe=await(await s("/api/whatsapp/seller/masivos/previo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmento:Ve,cuerpo:T,sub_por_tel:O||void 0,alerta:W||void 0})})).json();Qe.ok&&(sr(Qe),ir(Array.isArray(Qe.yaAvisados)?Qe.yaAvisados:[]),Qe.fueraDeVentana?Hi("plantilla"):Hi("texto"))}catch{}try{const Qe=await(await s("/api/whatsapp/seller/templates"+(le.length===1?"?pais="+encodeURIComponent(le[0]):""))).json(),Z=((Qe==null?void 0:Qe.templates)||(Qe==null?void 0:Qe.items)||[]).filter(Rt=>String(Rt.status||"").toUpperCase()==="APPROVED");Wn(Z),Z.length&&!Z.some(Rt=>Rt.name===Un)&&Pt(Z[0].name)}catch{}},Gs=async()=>{var d,A;if(!(!Wa||Qa)){ps(!0),jr("");try{const T=Gi.find(J=>J.name===Un),W=await(await s("/api/whatsapp/seller/masivos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({segmento:{tipo:"lista",texto:Bn().tels.join(` 1146`)},sub_por_tel:Bn().subPorTel,alerta:Wa.alerta||void 0,modo:no,plantilla:no==="plantilla"?Un:"",plantillaIdioma:no==="plantilla"?String((T==null?void 0:T.language)||""):"",cuerpo:no==="texto"?yo.trim():"",nombre:`Etiqueta ${String(((d=Wa.etq)==null?void 0:d.nombre)||"")}`.slice(0,80),idempotencyKey:`crm-etq-${Number((A=Wa.etq)==null?void 0:A.id)||0}-${Date.now()}`})})).json();W.ok?gs(`Listo: va saliendo a ${Wa.tels.length} ${Wa.tels.length===1?"persona":"personas"} por detrás. El avance queda en WhatsApp â Masivos â Tus envÃos.`):jr(W.message||"No se pudo crear el envÃo.")}catch{jr("Sin conexión para enviar.")}finally{ps(!1)}}},[wn,Io]=h.useState(null),[qn,Fo]=h.useState(""),[Vi,Vs]=h.useState(""),Oo=["#2563EB","#0D9488","#16A34A","#B45309","#DC2626","#7C3AED","#DB2777","#64748B"],cn=d=>Array.isArray(d==null?void 0:d.etiquetas)?d.etiquetas:[],To=async(d,A,T)=>{const O=T?cn(d).filter(W=>W.id!==A.id):[...cn(d),{id:A.id,nombre:A.nombre,color:A.color}];m(W=>W.map(J=>J.id===d.id?{...J,etiquetas:O}:J)),Io(W=>W&&W.id===d.id?{...W,etiquetas:O}:W);try{if(!(await s(`/api/landing/submissions/${d.id}/etiquetas/${A.id}`,{method:T?"DELETE":"POST"})).ok)throw new Error}catch{Ca(!0)}},wr=async d=>{const A=d.trim().slice(0,30);if(!A)return null;try{const T=await s("/api/whatsapp/labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nombre:A,color:Vi||Oo[it.length%Oo.length]})}),O=await T.json();return!T.ok||O.ok===!1?(alert(O.message||"No se pudo crear la etiqueta."),null):(await ta(),O.label||O.item||(Array.isArray(O.labels)?O.labels.find(W=>W.nombre===A):null))}catch{return alert("Sin conexión para crear la etiqueta."),null}},Ho=e.jsx("div",{style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap"},children:Oo.map(d=>e.jsx("button",{type:"button",onClick:()=>Vs(d===Vi?"":d),title:"Color de la etiqueta",style:{width:20,height:20,borderRadius:99,background:d,border:0,padding:0,cursor:"pointer",outline:Vi===d?"2.5px solid var(--text, #111)":"2px solid transparent",outlineOffset:2}},d))}),[k,Y]=h.useState("all"),[be,je]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches),[Ne,Lt]=h.useState(null),[Ke,ft]=h.useState(null),[Xt,ea]=h.useState(null),[Ta,Eo]=h.useState(null),[et,Aa]=h.useState(null),[ya,kr]=h.useState(null);h.useEffect(()=>{if(!Ta||Xt)return;const d=Rr().code.toUpperCase();(d==="CO"?window.fetch("/l-assets/co-geo.json").then(T=>T.json()):s("/api/landing/my-geo?c="+encodeURIComponent(d)).then(T=>T.json())).then(T=>{T&&typeof T=="object"&&Object.keys(T).length&&ea(T)}).catch(()=>{})},[Ta,Xt,s]);const kn=jj(Ke==null?void 0:Ke.pais),Cr=Aj(kn),{zonas:xn,estado:fs,reintentar:ui}=Sj(kn,!!Ke,Ke==null?void 0:Ke.pedido),[pi,_c]=h.useState({}),[Ze,$c]=h.useState(""),Us=h.useRef(null),Qs=d=>{$c(""),d&&Us.current&&Ie(Us.current),Us.current=null},Ui=d=>{Ze&&Qs(!0),ot(d)},dr=(d,A)=>{if(A){Qs(!0);return}$c(d),Ga!=="all"&&(Us.current=Ga,Ie("all")),Gt&&he("")},{user:Ks}=ni(),Ic=String((Ks==null?void 0:Ks.role)||"")==="admin";h.useEffect(()=>{const d=A=>{const T=A.detail;if((T==null?void 0:T.tipo)==="crm-alerta"&&!da){dr(T.alerta,!1),T.consumido=!0;return}(T==null?void 0:T.tipo)!=="crm-vista"||da||T.vista==="leads"&&!Ic||(Qs(!0),ot(T.vista),he(T.estado||""),Ia(T.estado?"list":"board"),T.consumido=!0)};return window.addEventListener("lumy:guia-ir",d),()=>window.removeEventListener("lumy:guia-ir",d)},[Ic,Ga,Gt,Ze,da]);const Ys=async(d,A)=>{var T,O;Eo({sub:d,data:null}),kr(null);try{const W=A==="sucursal"?{origen_sucursal:!0}:A&&A.city?{origen_ciudad:A.city,origen_departamento:A.dep}:{},J=await s(`/api/landing/submissions/${d.id}/comparar-fletes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),le=await J.json().catch(()=>null);!J.ok||!(le!=null&&le.ok)?Eo(Ve=>Ve&&Ve.sub.id===d.id?{...Ve,error:le&&le.message||"No se pudo comparar. Intenta de nuevo."}:Ve):(Eo(Ve=>Ve&&Ve.sub.id===d.id?{...Ve,data:le}:Ve),A===void 0&&Aa((O=(T=le==null?void 0:le.e99)==null?void 0:T.origen_pref)!=null&&O.city?le.e99.origen_pref:null))}catch{Eo(W=>W&&W.sub.id===d.id?{...W,error:"Error de conexión."}:W)}};h.useEffect(()=>{const d=u.filter(A=>!A.dropi_order_id&&!A.mastershop_order_id&&!A.envios99_order_id&&!A.repetido_de&&!["cancelado","entregado","abandonado","lead_wa"].includes(String(A.crm_status||""))&&pi[A.id]===void 0).slice(0,12).map(A=>A.id);d.length&&s("/api/landing/crm/fletes-avisos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:d})}).then(A=>A.json()).then(A=>{A!=null&&A.ok&&A.avisos&&_c(T=>({...T,...A.avisos}))}).catch(()=>{})},[u]),h.useEffect(()=>{ft(null)},[Ne]);const[cr,Js]=h.useState(!1),[ur,Tc]=h.useState(null),[fm,op]=h.useState(!1);h.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia("(max-width: 767px)"),A=()=>je(d.matches);return d.addEventListener("change",A),()=>d.removeEventListener("change",A)},[]);const rp=async d=>{if(window.confirm(`Este pedido está marcado como repetido y no cuenta en tus números. 1147 1148¿Convertirlo en pedido real? Desde ahora contará como pedido, venta y conversión.`))try{const T=await(await s(`/api/landing/submissions/${d}
1148/convertir-en-pedido`,{method:"POST"})).json();T.ok?(m(O=>O.map(W=>W.id===d?{...W,repetido_de:null}:W)),Ca(!0)):alert(T.message||"No se pudo convertir.")}catch{alert("No se pudo convertir.")}},xs=async(d,A,T={},O,W)=>{const J=A==="dropi"?"push-dropi":A==="mastershop"?"push-mastershop":"push-envios99",le=O||u.find(Yt=>Yt.id===d),Ve=async Yt=>(await s(`/api/landing/submissions/${d}/${J}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...T,expected_revision:Yt})})).json(),gt=await Ve(W!=null?Number(W):Number(le==null?void 0:le.crm_revision)||0);if(gt!=null&>.ok||(gt==null?void 0:gt.error)!=="revision_conflict")return gt;const Qe=await s(`/api/landing/submissions/${d}/para-despacho`).then(Yt=>Yt.json()).catch(()=>null),Z=Qe!=null&&Qe.ok?Qe.pedido:null;Z&&m(Yt=>Yt.map(Ht=>Ht.id===d?{...Ht,...Z}:Ht));const Rt=Bj(le,Z,A);return Rt.reintentar?Ve(Rt.revision):{ok:!1,error:"revision_conflict",message:Rt.mensaje}},Qi=async(d,A,T,O,W,J)=>{Ge(d);try{const le=await xs(d,"dropi",{...A?{shipping_company:A}:{},...O?{notas:O}:{},...Number(T)>0?{distribution_company_id:Number(T)}:{},...J&&Object.keys(J).length?{variaciones:J}:{}},void 0,W);if(le.ok&&le.routed_own){alert(le.message||'Este pedido cae en tu logÃstica propia. AsÃgnalo en "Pedidos por despachar" de Mi logÃstica.'),Ge(null),Ca(!0);return}if(le.ok){le.dropi_order_id?(m(Ve=>Ve.map(gt=>gt.id===d?{...gt,dropi_order_id:String(le.dropi_order_id),status:"created",crm_status:le.crm_status||"pendiente_confirmar"}:gt)),In(`Subido a Dropi â (#${le.dropi_order_id}) â lo ves en la pestaña LogÃstica`),setTimeout(()=>In(""),6e3)):(m(Ve=>Ve.map(gt=>gt.id===d?{...gt,status:"created",crm_status:le.crm_status||"pendiente_confirmar"}:gt)),alert(le.message||"Dropi recibió el pedido, pero no devolvió el identificador. Lumy lo mantuvo visible. RevÃsalo en Dropi antes de intentar subirlo otra vez.")),Ge(null),Ca(!0);return}alert(le.message||"No se pudo subir a Dropi. Revisa que tengas Dropi conectado y que el pedido tenga producto con ID de Dropi, nombre, teléfono, dirección, ciudad y departamento.")}catch{alert("Error de conexión. Intenta de nuevo.")}Ge(null)},[bs,ys]=h.useState(null),[Ki,rd]=h.useState(!1);h.useEffect(()=>{if(i){rd(!1);return}Promise.all([s("/api/mastershop/connection").then(d=>d.json()).catch(()=>({})),s("/api/plan/limits").then(d=>d.json()).catch(()=>({}))]).then(([d,A])=>{var J;const T=!!(d!=null&&d.connected),O=(A==null?void 0:A.limits)||{},W=!!((J=O==null?void 0:O.mastershop)!=null&&J.enabled)||(O==null?void 0:O.source)==="legacy"||(O==null?void 0:O.source)==="courtesy";rd(T&&W)}).catch(()=>rd(!1))},[i]);const id=async(d,A)=>{ys(d);try{const T=await xs(d,"mastershop",{},void 0,A);if(T.ok&&T.routed_own){alert(T.message||"Este pedido cae en tu logÃstica propia."),ys(null),Ca(!0);return}if(T.ok){m(O=>O.map(W=>W.id===d?{...W,...T.mastershop_order_id?{mastershop_order_id:T.mastershop_order_id}:{},crm_status:T.crm_status||"pendiente_confirmar"}:W)),ys(null),Ca(!0);return}alert(T.message||"No se pudo enviar a Mastershop. Revisa que tengas Mastershop conectado + comprado, y que el pedido tenga ID de producto en Mastershop, nombre, teléfono, dirección, ciudad y departamento.")}catch{alert("Error de conexión. Intenta de nuevo.")}ys(null)},[Zs,vs]=h.useState(null),[gi,mi]=h.useState(!1),[ip,Xs]=h.useState("ninguno");h.useEffect(()=>{if(i){mi(!1);return}Promise.all([s("/api/envios99/connection").then(d=>d.json()).catch(()=>({})),s("/api/plan/limits").then(d=>d.json()).catch(()=>({}))]).then(([d,A])=>{var W;const T=(A==null?void 0:A.limits)||{},O=!!((W=T==null?void 0:T.envios99)!=null&&W.enabled)||(T==null?void 0:T.source)==="legacy"||(T==null?void 0:T.source)==="courtesy";mi(!!(d!=null&&d.connected)&&O)}).catch(()=>mi(!1))},[i]);const oo=Da?"Dropi":Ki?"Mastershop":gi?"99envÃos":"Dropi",Ec=[!!Da,Ki,gi].filter(Boolean).length>1,[xm,bm]=h.useState({}),[Yi,sp]=h.useState({});h.useEffect(()=>{s("/api/landing/pages").then(d=>d.json()).then(d=>{const A={},T={};for(const O of(d==null?void 0:d.pages)||[]){let W=O==null?void 0:O.config;if(typeof W=="string")try{W=JSON.parse(W)}catch{W={}}const J=(W==null?void 0:W.product)||{};String(J.dropi_product_id??"").trim()?A[Number(O.id)]="dropi":String(J.mastershop_product_id??"").trim()?A[Number(O.id)]="mastershop":String(J.envios99_product_id??"").trim()&&(A[Number(O.id)]="envios99"),T[
1148Number(O.id)]=String(J.name||"").trim()||Gl(O)}bm(A),sp(T)}).catch(()=>{})},[s]);const el=d=>fj(d,Yi),Ji=d=>xm[Number(d==null?void 0:d.landing_id)]||null,hi={dropi:{nombre:"Dropi",color:me,logo:"/logos/adropi.png"},mastershop:{nombre:"Mastershop",color:"#0d9488",logo:"/logos/amastershop.jpg"},envios99:{nombre:"99envÃos",color:"#ea580c",logo:"/logos/a99envios.png"}},js=d=>{if(i||d!=null&&d.repetido_de)return[];if((d==null?void 0:d.origin)==="shopify"&&!X)return[];const A=[];return Da&&Mn(d,"dropi")&&!d.dropi_order_id&&A.push("dropi"),Ki&&Mn(d,"mastershop")&&!(d.mastershop_order_id&&d.mastershop_order_id!=="PUSHING")&&A.push("mastershop"),gi&&Mn(d,"envios99")&&!String(d.envios99_order_id||"").trim()&&A.push("envios99"),A},[Zi,sd]=h.useState(null),[ro,fi]=h.useState(null),[zc,Fr]=h.useState(!1),Xi=d=>up(d==null?void 0:d.mastershop_order_id)||up(d==null?void 0:d.envios99_order_id),Or=d=>up(d==null?void 0:d.mastershop_order_id)?"Mastershop":"99envÃos",[Go,tl]=h.useState(null),[Hr,ld]=h.useState(!1),Rc=async(d,A)=>{ld(!0);try{const T=A==="buscar"?"reconciliar-logistica":"liberar-logistica";let W=await(await s(`/api/landing/submissions/${d.id}/${T}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A==="liberar"?{confirmar:!0}:{})})).json().catch(()=>({}));if(A==="liberar"&&(W==null?void 0:W.reason)==="proveedor_desconectado"){if(!confirm(`${W.message} 1149 1150¿Lo revisaste en ${Or(d)} y NO está, o solo aparece cancelado?`)){ld(!1);return}W=await(await s(`/api/landing/submissions/${d.id}/liberar-logistica`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmar:!0,sin_conexion:!0})})).json().catch(()=>({}))}alert((W==null?void 0:W.message)||(W!=null&&W.ok?A==="buscar"?`Encontrado y enlazado: ${W.identidad}`:"Pedido desbloqueado.":"No se pudo completar.")),(W!=null&&W.ok||(W==null?void 0:W.reason)==="existe_en_proveedor")&&(tl(null),Ca(!0))}catch{alert("Error de conexión. Intenta de nuevo.")}ld(!1)},Nc=(d,A)=>{A==="dropi"?q(d,"Dropi",()=>ve(d)):A==="mastershop"?q(d,"Mastershop",()=>fi({sub:d,logistica:"mastershop"})):q(d,"99envÃos",()=>fi({sub:d,logistica:"envios99"}))},al=({s:d,chico:A,ancho:T})=>{const O=js(d);if(!O.length)return null;const W=dt===d.id||bs===d.id||Zs===d.id,J=O.length===1?hi[O[0]]:null,le={display:T?"flex":"inline-flex",width:T?"100%":void 0,alignItems:"center",justifyContent:"center",gap:6,background:W?"var(--input-bg, #eef1f6)":J?J.color:me,color:W?"var(--text-secondary, #64748b)":"#fff",border:0,borderRadius:A?8:10,padding:A?"5px 10px":"8px 14px",fontSize:A?11.5:12.5,fontWeight:800,cursor:W?"default":"pointer",fontFamily:"inherit"};return e.jsxs("button",{onClick:()=>{W||(J?Nc(d,O[0]):sd(d))},disabled:W,title:J?`Enviar este pedido a ${J.nombre}`:"Tienes varias logÃsticas conectadas: elige a cuál va este pedido",style:le,children:[J?e.jsx("img",{src:J.logo,alt:"",width:A?13:15,height:A?13:15,style:{borderRadius:3,objectFit:"contain"}}):e.jsxs("svg",{width:A?13:15,height:A?13:15,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 17h4V5H2v12h3M20 17h2v-3.34a4 4 0 0 0-1.17-2.83L19 9h-5v8h2"}),e.jsx("circle",{cx:"7.5",cy:"17.5",r:"2.5"}),e.jsx("circle",{cx:"17.5",cy:"17.5",r:"2.5"})]}),W?"Enviandoâ¦":J?`Enviar a ${J.nombre}`:"Enviar a mi logÃstica"]})},Mn=(d,A)=>{const T=Ji(d);return T?T===A:!0},As=async(d,A,T,O)=>{vs(d);try{const W=O||ip,J=await xs(d,"envios99",{...A?{transportadora:A}:{},...W?{seguro:W}:{}},void 0,T);if((J==null?void 0:J.error)==="transportadora_requerida"){fi({sub:u.find(le=>le.id===d)||{id:d},logistica:"envios99"}),vs(null);return}if(J.ok&&J.routed_own){alert(J.message||"Este pedido cae en tu logÃstica propia."),vs(null),Ca(!0);return}if(J.ok&&J.solicitud&&alert(J.message||"Quedó como solicitud en 99envÃos: allá la ajustas y confirmas."),J.ok){m(le=>le.map(Ve=>Ve.id===d?{...Ve,...J.envios99_order_id?{envios99_order_id:J.envios99_order_id}:{},crm_status:J.crm_status||"pendiente_confirmar"}:Ve)),vs(null),Ca(!0);return}alert(J.message||"No se pudo enviar a 99envÃos. Revisa que tengas 99envÃos conectado y comprado, y que el pedido tenga nombre, teléfono, dirección y ciudad.")}catch{alert("Error de conexión. Intenta de nuevo.")}vs(null)},xi=async d=>{Pa(d),Nt(null);try{const T=await(await s(`/api/landing/submissions/${d}
1150/dropi-diag`)).json();T.ok?Nt({...T,_id:d}):alert(T.message||"No pudimos consultar el inventario en Dropi.")}catch{alert("Error de conexión. Intenta de nuevo.")}Pa(null)},Ca=h.useCallback((d=!1)=>{d||Na(!0);const A=new URLSearchParams;if(Gt&&Ot==="list"&&A.set("status",Gt),t&&A.set("landing_id",String(t)),Ga!=="all"){const T=On();let O=T,W=T;Ga==="yesterday"?O=W=Yo(T,1):Ga==="3d"?O=Yo(T,2):Ga==="7d"?O=Yo(T,6):Ga==="15d"?O=Yo(T,14):Ga==="custom"&&(O=ka,W=Cn),A.set("from",O),A.set("until",W)}i?A.set("source","shopify"):A.set("include_dropi","1"),La(!1),(async()=>{try{const T=[],O={};let W=0,J=!1;for(let le=0;le<8;le++){const Ve=new URLSearchParams(A);W>0&&Ve.set("before_id",String(W));const Qe=await(await s(`/api/landing/crm?${Ve.toString()}`)).json();if(!Qe.ok){La(!0),z(null);return}if(T.push(...Qe.submissions||[]),Qe.variantes_por_landing&&typeof Qe.variantes_por_landing=="object"&&Object.assign(O,Qe.variantes_por_landing),le===0){g(Array.isArray(Qe.eliminados)?Qe.eliminados:[]),b(Number(Qe.eliminados_total)||(Array.isArray(Qe.eliminados)?Qe.eliminados.length:0));const Z={};(Qe.counts||[]).forEach(Yt=>{Z[Yt.crm_status]=Yt.n}),j(Z);const Rt=Yt=>Yt&&typeof Yt=="object"&&!Array.isArray(Yt)?Yt:null;$(Rt(Qe.counts_por_pais)||{}),w(Rt(Qe.stalled_por_pais)||{}),p(Rt(Qe.guias_estancadas_por_pais)),_(Array.isArray(Qe.paises_vendedor)?Qe.paises_vendedor.filter(Yt=>typeof Yt=="string"):[]),ne(Qe.variantes_por_landing&&typeof Qe.variantes_por_landing=="object"?Qe.variantes_por_landing:{}),Hn(i?!1:!!Qe.dropi_connected),L(Number(Qe.stalled_count)||0),z(typeof Qe.guias_estancadas_count=="number"&&Number.isFinite(Qe.guias_estancadas_count)?Qe.guias_estancadas_count:null)}if(le===0&&Qe.directos_truncados&&(J=!0),!Qe.truncated||!Qe.next_before_id){B(J);break}W=Number(Qe.next_before_id),le===7&&B(!0),J&&B(!0)}ne(O),m(T)}catch{La(!0),z(null)}finally{Na(!1)}})()},[s,Gt,t,Ot,Ga,ka,Cn,Nn,i]);h.useEffect(()=>{Ca()},[Ca]),h.useEffect(()=>{const d=setInterval(()=>{document.hidden||ge||wn||Q||pe||st||Wa||Ne||He.size>0||mn!==null||Ca(!0)},6e4);return()=>clearInterval(d)},[Ca,ge,wn,Q,pe,st,Wa,Ne,He,mn]),h.useEffect(()=>{const d=u.filter(T=>T&&T.paid_at).map(T=>Number(T.id));if(at.current===null){at.current=new Set(d);return}const A=d.filter(T=>!at.current.has(T));A.forEach(T=>at.current.add(T)),A.length>0&&Yp(()=>import("./index-D_T1XJ3U.js").then(T=>T.b3),__vite__mapDeps([0,1,2])).then(T=>{const O=T.default,W=["#f7d774","#d4a017","#fff6c9","#b8860b","#ffe9a8"];O({particleCount:70,spread:78,startVelocity:42,origin:{y:.25},colors:W,scalar:.95,ticks:160}),setTimeout(()=>O({particleCount:40,spread:110,decay:.92,origin:{y:.2},colors:W,scalar:.8}),160)}).catch(()=>{})},[u]);const zo=async(d,A)=>{const T=u.find(gt=>gt.id===d);m(gt=>gt.map(Qe=>Qe.id===d?{...Qe,...A}:Qe));const O=gt=>s(`/api/landing/submissions/${d}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...A,expected_revision:gt})}).catch(()=>null);let W=await O(Number(T==null?void 0:T.crm_revision)||0),J=!!W&&W.ok,le=null;try{W&&(le=await W.json())}catch{}const Ve=A&&Object.keys(A).every(gt=>["crm_status","from_board","local_exported","local_exported_at","notes"].includes(gt));if(!J&&Ve&&(le==null?void 0:le.error)==="revision_conflict"){const gt=await s(`/api/landing/submissions/${d}/para-despacho`).then(Yt=>Yt.json()).catch(()=>null),Qe=gt!=null&>.ok?gt.pedido:null,Z=!!Qe&&["dropi_order_id","mastershop_order_id","envios99_order_id"].every(Yt=>String(Qe[Yt]??"")===String((T==null?void 0:T[Yt])??"")),Rt=!("notes"in A)||String((Qe==null?void 0:Qe.notes)??"")===String((T==null?void 0:T.notes)??"");if(Qe&&Z&&Rt&&String(Qe.crm_status)===String(T==null?void 0:T.crm_status)){W=await O(Number(Qe.crm_revision)||0),J=!!W&&W.ok,le=null;try{W&&(le=await W.json())}catch{}}else Qe&&(m(Yt=>Yt.map(Ht=>Ht.id===d?{...Ht,...Qe}:Ht)),le={...le,message:Z?Rt?"Este pedido ya se habÃa movido mientras lo tenÃas abierto. Ya lo ves en su columna de verdad.":"Alguien cambió la nota de este pedido mientras escribÃas. Ya ves la de ahora: vuelve a guardar la tuya si hace falta.":"Este pedido ya se subió a una logÃstica mientras lo tenÃas abierto. Ya lo ves actualizado."})}if(J&&Number.isInteger(Number(le==null?void 0:le.revision))&&m(gt=>gt.map(Qe=>Qe.id===d?{...Qe,crm_revision:Number(le.revision)}:Qe)),A.crm_status){if(!J){const gt=(le==null?void 0:le.message)||"No se pudo mover el pedido. Intenta de nuevo.";alert(gt)}Ca(!0)}else J||(alert((le==null?void 0:le.message)||"No se pudo guardar. Revisa tu conexión e intenta de nuevo."),Ca(!0))},nl=async(d,A)=>{var J,le;const T=u.find(Ve=>Ve.id===d),O=Ve=>s(`/api/landing/submissions/${d}
1150`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...A,expected_revision:Ve})}).then(async gt=>({ok:gt.ok,j:await gt.json().catch(()=>null)})).catch(()=>({ok:!1,j:null}));let W=await O(Number(T==null?void 0:T.crm_revision)||0);if(!W.ok&&((J=W.j)==null?void 0:J.error)==="revision_conflict"){const Ve=await s(`/api/landing/submissions/${d}/para-despacho`).then(Z=>Z.json()).catch(()=>null),gt=Ve!=null&&Ve.ok?Ve.pedido:null;if(!!gt&&String(gt.crm_status)===String(T==null?void 0:T.crm_status)&&["dropi_order_id","mastershop_order_id","envios99_order_id"].every(Z=>String(gt[Z]??"")===String((T==null?void 0:T[Z])??"")))W=await O(Number(gt.crm_revision)||0);else return`${(T==null?void 0:T.customer_name)||d}: cambió mientras lo tenÃas seleccionado`}return W.ok?null:`${(T==null?void 0:T.customer_name)||d}: ${((le=W.j)==null?void 0:le.message)||"no se pudo"}`},Lc=async d=>{if(!window.confirm("¿Eliminar este pedido del tablero? Queda archivado (no se borra de Dropi)."))return;const A=u.find(W=>W.id===d);Xa(d),m(W=>W.filter(J=>J.id!==d));const T=Number(A==null?void 0:A.crm_revision)||0,O=await s(`/api/landing/submissions/${d}?revision=${T}`,{method:"DELETE"}).catch(()=>null);Xa(null),O&&O.ok||(A&&m(W=>W.some(J=>J.id===d)?W:[...W,A].sort((J,le)=>le.id-J.id)),alert("No se pudo archivar el pedido. Intenta de nuevo."),Ca(!0))},ol=h.useRef(null),dd=(d,A,T)=>{A.stopPropagation(),Kn.current=d,Va.current=!1,po(d),ol.current=T||null;try{A.currentTarget.setPointerCapture(A.pointerId)}catch{}},un=d=>
1150{if(Kn.current==null)return;Va.current=!0;const A=document.elementFromPoint(d.clientX,d.clientY),T=A?A.closest("[data-col]"):null,O=T?T.getAttribute("data-col"):null;fn(O&&(Dy.has(O)||O.startsWith("et:")||O==="local_exportado")?O:null)},cd=d=>{try{d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const A=Kn.current,T=go,O=ol.current;if(Kn.current=null,po(null),fn(null),ol.current=null,!(A==null||!T||!Va.current)){if(T.startsWith("et:")){if(O===T)return;const W=u.find(Z=>Z.id===A);if(!W)return;const J=Number(String(O||"et:0").slice(3))||0,le=Number(T.slice(3))||0,Ve=J?it.find(Z=>Z.id===J):null,gt=le?it.find(Z=>Z.id===le):null,Qe=cn(W).some(Z=>Z.id===le);gt&&!Qe&&To(W,gt,!1),Ve&&To({...W,etiquetas:gt&&!Qe?[...cn(W),gt]:cn(W)},Ve,!0);return}if(T==="local_exportado"){const W=u.find(J=>J.id===A);W&&!W.local_exported_at&&zo(A,{local_exported:!0,local_exported_at:new Date().toISOString(),...["nuevo","contactado","pendiente_confirmar"].includes(W.crm_status)?{crm_status:"confirmado"}:{}});return}if(Dy.has(T)){const W=u.find(J=>J.id===A);W&&W.crm_status!==T&&(T==="cancelado"?ia([A]):zo(A,{crm_status:T,...W.local_exported_at?{local_exported:!1,local_exported_at:null}:{}}))}}},Vo=kt.trim().toLowerCase(),Gr=d=>String(d||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),bi=Gr(Vo),rl=d=>{try{const A=Array.isArray(d.products)?d.products:JSON.parse(d.products||"[]");return Array.isArray(A)?A.map(T=>typeof T=="string"?T:(T==null?void 0:T.name)||(T==null?void 0:T.title)||(T==null?void 0:T.product_name)||"").join(" "):""}catch{return""}},il=Vo?u.filter(d=>Gr(d.customer_name).includes(bi)||Vo.replace(/\D/g,"").length>=3&&String(d.phone||"").replace(/\D/g,"").includes(Vo.replace(/\D/g,""))||Gr([rl(d),d.product,d.product_name,d.landing_name].filter(Boolean).join(" ")).includes(bi)):u,Ss=d=>String(d.country||"").trim().toUpperCase(),pr=u.reduce((d,A)=>{const T=Ss(A);return T&&d.set(T,(d.get(T)||0)+1),d},new Map),_r=[...new Set([...pr.keys(),...C.length>1?C:[]])].sort((d,A)=>(pr.get(A)||0)-(pr.get(d)||0)||d.localeCompare(A)),bn=_r.length>1&&_r.includes(oe)?oe:"",Vr=bn?u.filter(d=>Ss(d)===bn):u,gr=bn?S[bn]||{}:v,yi=bn?N[bn]||0:V,vi=bn&&M&&bn in M?M[bn]:x,Ur=Vr.filter(d=>Yr(d)&&!ws(d)&&Wl(d)).length,ji=[...new Set(Vr.map(d=>String(d.department||"").trim()).filter(Boolean))].sort(),mr=[...new Set(Vr.map(d=>String(d.dropi_carrier||"").trim()).filter(Boolean))].sort();let zt=bn?il.filter(d=>Ss(d)===bn):il;xt&&(zt=zt.filter(d=>String(d.department||"").trim()===xt)),Qt&&(zt=zt.filter(d=>String(d.dropi_carrier||"").trim()===Qt)),Pe&&(zt=zt.filter(d=>Pe==="tienda"?!!d.de_tienda:!d.de_tienda&&d.origin==="lumy"));let hr=Vo?c.filter(d=>Gr(d.customer_name).includes(bi)||Vo.replace(/\D/g,"").length>=3&&String(d.phone||"").replace(/\D/g,"").includes(Vo.replace(/\D/g,""))||Gr([rl(d),d.landing_name].filter(Boolean).join(" ")).includes(bi)):c;bn&&(hr=hr.filter(d=>Ss(d)===bn)),xt&&(hr=hr.filter(d=>String(d.department||"").trim()===xt)),(Qt||Pe)&&(hr=[]);const ud=FA({total:f,cargados:c.length,visibles:hr.length,filtrando:!!(Vo||bn||xt)}),Ai=Vr.some(d=>!!d.de_tienda),Pc=d=>!d.dropi_order_id&&!d.mastershop_order_id&&!d.envios99_order_id,pd=d=>{if(!Yr(d))return!1;const A=xo(d);return!!A&&A.dir!=="in"&&String(A.out_status||"")==="failed"},Dc=d=>{var A;return Yr(d)&&Pc(d)&&((A=pi[d.id])==null?void 0:A.cobertura)===!1},Bc=d=>{if(!Yr(d))return!1;const A=pi[d.id];return Pc(d)&&!!A&&A.cobertura!==!1&&Number(A.flete)>25e3},Wc=d=>d.crm_status==="novedad",sl=d=>d.crm_status==="reclamar_oficina"&&is(String(Du(d)||"")).hours>72,ll=d=>Yr(d)&&Fk(d)&&!d.payment_attempt_failed&&!ws(d),qc=/BODEGA DESTINO|EN TERMINAL DESTINO|ADMITID|ESPERA DE RUTA|REEXPEDICI/i,gd=["reclamar_oficina","novedad","entregado","devuelto","cancelado","rechazado"],md=d=>!Yr(d)||gd.includes(String(d.crm_status||""))||!qc.test(String(d.dropi_status||""))?!1:is(String(d.dropi_last_movement_at||Du(d)||"")).hours>72,fr={wa_error:zt.filter(pd).length,sin_cobertura:zt.filter(Dc).length,flete_caro:zt.filter(Bc).length,novedad:zt.filter(Wc).length,reclamar_oficina:zt.filter(sl).length};Ze==="wa_error"?zt=zt.filter(pd):Ze==="sin_cobertura"?zt=zt.filter(Dc):Ze==="flete_caro"?zt=zt.filter(Bc):Ze==="novedad"?zt=zt.filter(Wc):Ze==="reclamar_oficina"?zt=zt.filter(sl):Ze==="estancados"?zt
1150=zt.filter(d=>!!d.stalled&&Yr(d)):Ze==="direccion"?zt=zt.filter(d=>Yr(d)&&!ws(d)&&Wl(d)):Ze==="pago_fallido"?zt=zt.filter(d=>d.payment_attempt_failed&&Yr(d)):Ze==="guia_estancada"?zt=zt.filter(Gy):Ze==="no_subio"?zt=zt.filter(ll):Ze==="puede_oficina"?zt=zt.filter(md):Ze==="por_confirmar"&&(zt=zt.filter(d=>["nuevo","contactado","pendiente_confirmar"].includes(String(d.crm_status||""))));function ws(d){return d.origin==="dropi"||!!d.dropi_order_id||ts(d.mastershop_order_id)||ts(d.envios99_order_id)&&!String(d.envios99_order_id).startsWith("SOL-")}Ot==="list"&&Gt&&["nuevo","contactado","pendiente_confirmar","confirmado"].includes(Gt)&&(zt=zt.filter(d=>!ws(d)));const hd=Vr.filter(d=>d.payment_attempt_failed&&Yr(d)).length,fd=Vr.filter(ll).length,Mc=Vr.filter(md).length,dl=d=>ut(A=>{const T=new Set(A);return T.has(d)?T.delete(d):T.add(d),T}),Qr=d=>d.origin==="dropi"||d.origin==="envios99"||d.origin==="mastershop",xd=zt.filter(d=>!Qr(d)).length>0&&zt.every(d=>Qr(d)||He.has(d.id)),Ro=()=>ut(()=>{if(xd)return new Set;const d=new Set;return zt.forEach(A=>{!Qr(A)&&Number(A.id)>0&&d.add(Number(A.id))}),d}),Fc=async d=>{const A=new Set(zt.filter(J=>!Qr(J)).map(J=>Number(J.id))),T=[...He].filter(J=>A.has(Number(J)));if(!T.length)return;if(d==="cancelado"){ia(T);return}const O=new Set(T);m(J=>J.map(le=>O.has(le.id)?{...le,crm_status:d}:le));const W=(await Promise.all(T.map(J=>nl(J,{crm_status:d})))).filter(Boolean);W.length&&alert(`${W.length===1?"Un pedido no se movió":`${W.length} pedidos no se movieron`}: 1151 1152`+W.slice(0,10).join(` 1153`)+` 1154 1155Ya los ves en su columna de verdad.`),ut(new Set),Ca(!0)},[ks,In]=h.useState(""),[Ka,Cs]=h.useState(!1),cl=d=>zt.filter(A=>He.has(A.id)&&!A.repetido_de&&!["dropi","shopify"].includes(A.origin)&&!["abandonado","lead_wa","pago_pendiente"].includes(A.crm_status)&&js(A).includes(d)),lp=()=>cl("dropi"),Oc=async d=>{const A=hi[d].nombre,T=cl(d);if(!T.length){In(`Ninguno de los seleccionados puede subir a ${A}`),setTimeout(()=>In(""),4e3);return}if(!confirm(`Se van a subir ${T.length} ${T.length===1?"pedido":"pedidos"} a ${A}. ¿Seguir?`))return;Cs(!0);let O=0;const W=[];for(let J=0;J<T.length;J++){const le=T[J];In(`Subiendo ${J+1} de ${T.length}â¦`);try{const Ve=await xs(le.id,d,{},le);Ve.ok?O++:W.push(`${le.customer_name||le.id}: ${Ve.message||"no se pudo"}`)}catch{W.push(`${le.customer_name||le.id}: sin conexión`)}}Cs(!1),In([O?`${O} ${O===1?"subido":"subidos"}`:"",W.length?`${W.length} con problema`:""].filter(Boolean).join(" · ")),W.length&&alert(`No se pudieron subir a ${A}: 1156 1157`+W.slice(0,10).join(` 1158`)+(W.length>10?` 1159 1160y ${W.length-10} más`:"")),setTimeout(()=>In(""),6e3),ut(new Set),Ca(!0)},ul=()=>["dropi","mastershop","envios99"].filter(d=>cl(d).length>0),bd=d=>{d==="dropi"?Hc():Oc(d)},Hc=async()=>{const d=lp();if(!d.length){In("Ninguno de los seleccionados puede subir a Dropi"),setTimeout(()=>In(""),4e3);return}if(!confirm(`Se van a subir ${d.length} ${d.length===1?"pedido":"pedidos"} a Dropi. ¿Seguir?`))return;Cs(!0);let A=0,T=0;const O=[];for(let W=0;W<d.length;W++){const J=d[W];In(`Subiendo ${W+1} de ${d.length}â¦`);try{const le=await xs(J.id,"dropi",{},J);le.ok&&!le.routed_own&&le.dropi_order_id?A++:le.ok&&!le.routed_own?T++:O.push(`${J.customer_name||J.id}: ${le.message||(le.routed_own?"va a tu logÃstica propia":"no se pudo")}`)}catch{O.push(`${J.customer_name||J.id}: sin conexión`)}}Cs(!1),In([A?`${A} ${A===1?"subido":"subidos"}`:"",T?`${T} por conciliar`:"",O.length?`${O.length} sin subir`:""].filter(Boolean).join(", ")),T>0&&alert(`${T===1?"Un pedido quedó":`${T} pedidos quedaron`} por conciliar porque Dropi no devolvió el identificador. Lumy los mantuvo visibles. RevÃsalos en Dropi antes de intentar subirlos otra vez.`),O.length&&alert(`No se pudieron subir: 1161 1162`+O.slice(0,10).join(` 1163`)+(O.length>10?` 1164 1165y ${O.length-10} más`:"")),setTimeout(()=>In(""),6e3),ut(new Set),Ca(!0)},Gc=()=>{const d=zt.filter(J=>He.has(J.id));if(!d.length)return;const A=["Fecha","Nombre","Teléfono","Dirección","Ciudad","Departamento","Total","Estado","GuÃa"],T=J=>{const le=String(J??"").replace(/"/g,'""');return/[";\n]/.test(le)?`"${le}"`:le}
1165,O=d.map(J=>[String(J.created_at||"").slice(0,16),J.customer_name||"",J.phone||"",J.address||"",J.city||"",J.department||"",Number(J.total_cop)||0,to(String(J.crm_status)),J.dropi_tracking||""].map(T).join(";")),W="\uFEFF"+[A.join(";"),...O].join(` 1166`);try{const J=URL.createObjectURL(new Blob([W],{type:"text/csv;charset=utf-8;"})),le=document.createElement("a");le.href=J,le.download=`pedidos-${On()}.csv`,document.body.appendChild(le),le.click(),le.remove(),setTimeout(()=>URL.revokeObjectURL(J),1e3),In(`${d.length} ${d.length===1?"pedido exportado":"pedidos exportados"}`),setTimeout(()=>In(""),4e3)}catch{In("No se pudo exportar"),setTimeout(()=>In(""),4e3)}};Object.values(v).reduce((d,A)=>d+A,0);const yd=d=>["cancelado","rechazado"].includes(d),Si=d=>/^[A-Z]{3}$/.test(String((d==null?void 0:d.currency)||"").toUpperCase())?String(d.currency).toUpperCase():"COP",pl=(d,A)=>{const T=Math.max(0,Number(A)||0),O=rn[String((d==null?void 0:d.country)||"").toUpperCase()];return(O?O.noDecimals:["COP","CLP","PYG","ARS","CRC"].includes(Si(d)))?Math.round(T):Math.round(T*100)/100},$r=(d,A)=>d.reduce((T,O)=>{if(!A(O))return T;const W=Number(O.total_cop)||0;if(W<=0)return T;const J=/^[A-Z]{3}$/.test(String(O.currency||"").toUpperCase())?String(O.currency).toUpperCase():"COP";return T[J]=(T[J]||0)+W,T},{}),Vc=bn&&((Rd=rn[bn])==null?void 0:Rd.currency)||"COP",wi=d=>Object.entries(d).map(([A,T])=>`${A} $${T.toLocaleString("es-CO")}`).join(" · ")||`${Vc} $0`,ki=d=>Object.values(d).some(A=>A>0),No=zt.filter(d=>!d.repetido_de),gl="Sin nombre de producto",vd=d=>String(d||"").replace(/\s*[Ãx]\s*\d+(?:[.,]\d+)?\s*$/i,"").replace(/\s+/g," ").trim(),Uc=d=>Gr(d).toLowerCase(),ml=new Map,_s=d=>{let A="";try{const O=Array.isArray(d.products)?d.products:JSON.parse(d.products||"[]"),W=Array.isArray(O)?O[0]:null;A=vd(String((typeof W=="string"?W:(W==null?void 0:W.name)||(W==null?void 0:W.title)||(W==null?void 0:W.product_name))||""))}catch{}if(A||(A=vd(String(d.product||d.product_name||d.landing_name||""))),!A)return"pr:"+gl;const T=Uc(A);return ml.has(T)||ml.set(T,A),"pr:"+T},jd=d=>{const A=String(d).slice(3);return A===gl?gl:ml.get(A)||A},Kr=[["sin_contactar","Sin contactar","#cbd5e1","Entró y nadie lo ha contactado todavÃa: nuevo, pago pendiente, abandonadoâ¦"],["contactado","Contactado sin confirmar","#93c5fd","Ya se le escribió o llamó y aún no confirma"],["cancelado","Cancelaron","#f87171","Cancelado a mano o por la logÃstica, con el pago en lÃnea fallido, o rechazado sin guÃa: nunca salió"],["confirmado","Confirmado sin guÃa","#60a5fa","Confirmó y aún no sale: falta subirlo a la logÃstica o generar la guÃa"],["camino","En camino","#a78bfa","Despachado o en tránsito"],["novedad","Con novedad","#f59e0b","Con novedad de la transportadora"],["oficina","Reclamar en oficina","#f97316","Para reclamar en la oficina de la transportadora"],["devuelto","Devueltos","#e11d48","Salió con guÃa y volvió: devuelto por la transportadora o rechazado por el cliente al recibir"],["entregado","Entregados","#22c55e","Entregado"]],Ad=d=>{const A=String(d.crm_status||"");return A==="entregado"?"entregado":Wj(d)?"devuelto":qj(d)?"cancelado":A==="reclamar_oficina"?"oficina":A==="novedad"?"novedad":A==="despachado"||A==="en_transito"||A==="local_exportado"?"camino":A==="confirmado"?"confirmado":A==="contactado"||A==="pendiente_confirmar"?"contactado":"sin_contactar"},Qc=d=>{const A=String(d.crm_status||""),T=A==="cancelado"||A==="devuelto"||A==="rechazado";return{confirmo:["confirmado","despachado","en_transito","novedad","reclamar_oficina","entregado","devuelto","local_exportado"].includes(A),perdido:T}},hl=d=>!d.repetido_de&&d.crm_status!=="lead_wa"&&d.crm_status!=="abandonado",fl=(d,A)=>({col:d,nombre:A,pedidos:0,ventas:0,confirmaron:0,sin_contactar:0,contactado:0,cancelado:0,confirmado:0,camino:0,novedad:0,oficina:0,devuelto:0,entregado:0}),Ci=(()=>{const d=new Map;for(const A of No){if(!hl(A))continue;const T=_s(A);d.has(T)||d.set(T,fl(T,jd(T)));const O=d.get(T),W=Qc(A);O.pedidos++,O[Ad(A)]++,W.confirmo&&O.confirmaron++,W.perdido||(O.ventas+=Number(A.total_cop)||0)}return[...d.values()].sort((A,T)=>T.pedidos-A.pedidos||T.ventas-A.ventas)})(),xl=Ci.map(d=>d.col),Sd=d=>
1166!Ma||(!Ma.cols||Ma.cols.includes(_s(d)))&&(Ma.cubo==="todos"||Ad(d)===Ma.cubo),Kc=Ma?xl.filter(d=>No.some(A=>hl(A)&&_s(A)===d&&Sd(A))):xl,$s=d=>ws(d)?"logistica":"nuestros",Is=d=>!!d.repetido_de&&d.crm_status!=="pago_pendiente",wd=d=>{if(Is(d))return"repetido";const A=String(d.crm_status||"").trim();return(i?Bp:$s(d)==="logistica"?Wp:Pp).includes(A)?A:"otro"},Yc=d=>!!(d.dropi_order_id||d.mastershop_order_id||d.envios99_order_id),kd=["cancelado","rechazado","abandonado","lead_wa","pago_pendiente"],bl=d=>{if(d.local_exported_at&&!Yc(d))return"local_exportado";const A=String(d.crm_status||"");return A==="nuevo"||A==="contactado"?"nuevo":["pendiente_confirmar","confirmado","despachado","en_transito","entregado","novedad","reclamar_oficina","devuelto"].includes(A)?A:"otro"},yl=d=>dn(d)&&!d.repetido_de&&!cn(d).length&&!kd.includes(String(d.crm_status||"")),Cd=["nuevo","pendiente_confirmar","confirmado","local_exportado","despachado","en_transito","entregado"],Jc=ae!=="local"?Cd:[...Cd,...["novedad","reclamar_oficina","devuelto","otro"].filter(d=>zt.some(A=>yl(A)&&bl(A)===d))],_d=d=>{if(Is(d))return"repetido";const A=d.id?cn(d):[];return A.length?"et:"+A[0].id:dn(d)&&!kd.includes(String(d.crm_status||""))?bl(d):String(d.crm_status||"").trim()||"otro"},Zc=Ze?(()=>{const d=new Set(zt.map(_d)),A=it.map(O=>"et:"+O.id).filter(O=>d.has(O)),T=[...d].filter(O=>!Py.includes(O)&&!String(O).startsWith("et:"));return[...Py.filter(O=>d.has(O)),...A,...T]})():[],Xc=d=>No.filter(A=>$s(A)===d&&wd(A)!=="repetido"&&!(A.id&&cn(A).length)&&!ao(A)).length,eu=$r(No,d=>d.origin!=="dropi"&&!yd(String(d.crm_status))&&!["abandonado","lead_wa"].includes(String(d.crm_status))),$d=$r(No,d=>d.origin!=="dropi"&&yd(String(d.crm_status))),Id=$r(No,d=>d.origin!=="dropi"&&["abandonado","lead_wa"].includes(String(d.crm_status))),vl=(gr.nuevo||0)+(gr.contactado||0)+(gr.pendiente_confirmar||0),tu=(d,A)=>({background:d?"rgba(255,255,255,.28)":A+"22",color:d?"#fff":A,borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800,lineHeight:"16px"}),Ts=Ot==="producto"?Kc:Ze?Zc:ae==="nuestros"?i?Bp:Pp:ae==="logistica"?Wp:ae==="etiquetas"?it.map(d=>"et:"+d.id):ae==="local"?Jc:[],jl=d=>{const A=String(d).startsWith("et:"),T=A&&Number(String(d).slice(3))||0;return li(zt.filter(O=>{if(Ot==="producto")return hl(O)&&_s(O)===d&&Sd(O);if(Ze)return _d(O)===d;if(A)return!O.id||Is(O)?!1:cn(O).some(W=>W.id===T);if(ae==="local")return yl(O)&&bl(O)===d;if(O.id&&!Is(O)&&(cn(O).length||ao(O))||wd(O)!==d)return!1;if(ae==="logistica"){if($s(O)!=="logistica")return!1;const W=O.origin==="dropi"&&!O.from_lumy||O.origin==="envios99"||O.origin==="mastershop";return k==="lumy"?!W:k==="dropi"?W:!0}return $s(O)==="nuestros"}))},Al=!Ze&&Ot!=="producto"&&ae!=="etiquetas",Td=Al?Ts.filter(d=>jl(d).length>0):Ts,_i=Al&&!hn&&mn===null&&Td.length>0?Td:Ts,Sl=Ts.length-_i.length;return e.jsxs("div",{"data-guia-crm-vista":Ot==="list"?"list":ae,"data-guia-crm-etapa":Gt,"data-guia-crm-alerta":Ze,style:{width:"100%",margin:"0 auto",padding:"8px clamp(12px, 2vw, 24px)"},children:[e.jsx(gm,{}),e.jsxs("div",{className:"lk-crm-head",style:{display:"flex",alignItems:"center",gap:12,marginBottom:14,flexWrap:"wrap"},children:[!i&&e.jsx("button",{style:ee,onClick:a,children:"â Volver"}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("h2",{style:{fontSize:"clamp(18px, 5vw, 22px)",fontWeight:800,margin:0,letterSpacing:"-.02em",color:"var(--text, #171717)"},children:[i?"CRM de Shopify":"CRM de pedidos",t?" (esta landing)":""]}),e.jsx("p",{className:"lk-crm-desc",style:{fontSize:12.5,color:"var(--text-muted, #777)",margin:"2px 0 0"},children:i?"Confirma y sigue cada pedido importado desde tu tienda.":Ot==="producto"?"Una columna por producto con todos sus pedidos, de todas las pestañas, y arriba cómo va cada uno.":Ot==="board"?`Arrastra cada pedido entre columnas. Con ${oo} conectado, se mueven solos.`:'Sigue cada pedido contraentrega de "nuevo" a "entregado".'})]}),!i&&(Da||Ki||gi)&&e.jsxs("div",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[nr&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",maxWidth:420},children:nr}),e.jsxs("button",{type:"button",onClick:si,disabled:Jn,title:"Trae ahora mismo los pedidos y estados de tu logÃstica y actualiza el tablero",style:{display:"inline-flex",alignItems:"center",gap:6,border:"1px solid var(--border, #e8eaf0)",background:"var(--card-bg, #fff)",color:"var(--text, #111)",borderRadius:999,padding:"7px 13px",fontSize:12.5,fontWeight:800,cursor:Jn?"wait":"pointer",fontFamily:"inherit",opacity:Jn?.7:1},children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:Jn?"lk-spin 1s linear infinite":"none"},children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-2.6-6.4"}),e.jsx("path",{d:"M21 3v6h-6"})]}),e.jsx("span",{className:"lk-crm-sync-txt",children:Jn?"Sincronizandoâ¦":"Sincronizar"})]})]}),e.jsx("div",{className:"lk-crm-views",style:{marginLeft:!i&&(Da||Ki||gi)?0:"auto",display:"inline-flex",background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:11,padding:3,gap:2},children:["board","producto","list"].filter(d=>d!=="producto"||!ba).map(d=>e.jsx("button",{onClick:()=>Ia(d),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 13px",borderRadius:9,border:0,cursor:"pointer",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:Ot===d?"var(--card-bg, #fff)":"transparent",color:Ot===d?me:"var(--text-muted, #8a90a2)",boxShadow:Ot===d?"0 1px 2px rgba(16,24,40,.08)":"none"},children:d==="producto"?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 8 12 3 3 8v8l9 5 9-5V8z"}),e.jsx("path",{d:"M3.3 8.2 12 13l8.7-4.8"}),e.jsx("path",{d:"M12 13v9"})]}),"Por producto"]}):d==="board"?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"6",height:"18",rx:"1.5"}),e.jsx("rect",{x:"10",y:"3",width:"6",height:"11",rx:"1.5"}),e.jsx("rect",{x:"17",y:"3",width:"4",height:"7",rx:"1.5"})]}),"Tablero"]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Lista"]})},d))})]}),e.jsxs("div",{style:{position:"relative",marginBottom:12},children:[e.jsx("span",{style:{position:"absolute",left:13,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted, #9aa0b0)",pointerEvents:"none"},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"M21 21l-4.3-4.3"})]})}),e.jsx("input",{value:kt,onChange:d=>ct(d.target.value),placeholder:"Buscar por nombre, teléfono o productoâ¦",style:{...E,paddingLeft:38,fontSize:14}}),kt&&e.jsx("button",{onClick:()=>ct(""),style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",fontSize:17,padding:6,lineHeight:1},"aria-label":"Limpiar",children:"Ã"})]}),e.jsxs("div",{className:"lk-scroll-x lk-crm-dates",style:{display:"flex",gap:6,marginBottom:12,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("div",{className:"date-filter-pill",children:[["all","Todos"],["today","Hoy"],["yesterday","Ayer"],["3d","3 dÃas"],["7d","7 dÃas"],["15d","15 dÃas"],["custom","Personalizado"]].map(([d,A])=>e.jsx("button",{onClick:()=>{Qs(!1),Ie(d)},className:`date-pill-btn${Ga===d?" active":""}`,children:A},d))}),Ga==="custom"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:{fontSize:12.5,color:"var(--text-muted)",display:"inline-flex",gap:6,alignItems:"center"},children:["Desde ",e.jsx("input",{type:"date",value:ka,max:On(),onChange:d=>Zo(d.target.value),style:{padding:"6px 9px",borderRadius:8,border:"1px solid var(--border,#e6e8ee)",fontFamily:"inherit",fontSize:12.5}})]}),e.jsxs("label",{style:{fontSize:12.5,color:"var(--text-muted)",display:"inline-flex",gap:6,alignItems:"center"},children:["Hasta ",e.jsx("input",{type:"date",value:Cn,min:ka,max:On(),onChange:d=>Xo(d.target.value),style:{padding:"6px 9px",borderRadius:8,border:"1px solid var(--border,#e6e8ee)",fontFamily:"inherit",fontSize:12.5}})]})]}),_r.length>1&&e.jsxs("select",{className:"lk-crm-filtro","aria-label":"Filtrar por paÃs",value:bn,onChange:d=>{Ae(d.target.value),Ut(""),$e("")},style:{...E,width:"auto",padding:"7px 12px",fontSize:12.5,marginBottom:0,fontWeight:600,color:bn?"var(--text, #171717)":"var(--text-muted, #6b7280)"},children:[e.jsx("option",{value:"",children:"Todos los paÃses"}),_r.map(d=>{var A,T;return e.jsxs("option",{value:d,children:[((A=rn[d])==null?void 0:A.name)||d," · ",((T=rn[d])==null?void 0:T.currency)||""," (",pr.get(d)||0,")"]},d)})]}),ji.length>0&&e.jsxs("select",{className:"lk-crm-filtro","aria-label":"Filtrar por departamento",value:xt,onChange:d=>Ut(d.target.value),style:{...E,width:"auto",padding:"7px 12px",fontSize:12.5,marginBottom:0,fontWeight:600,color:xt?"var(--text, #171717)":"var(--text-muted, #6b7280)"},children:[e.jsx("option",{value:"",children:"Todo departamento"}),ji.map(d=>e.jsx("option",{value:d,children:d},d))]}),mr.length>0&&e.jsxs("select",{className:"lk-crm-filtro","aria-label":"Filtrar por transportadora",value:Qt,onChange:d=>$e(d.target.value),style:{...E,width:"auto",padding:"7px 12px",fontSize:12.5,marginBottom:0,fontWeight:600,color:Qt?"var(--text, #171717)":"var(--text-muted, #6b7280)"},children:[e.jsx("option",{value:"",children:"Toda transportadora"}),mr.map(d=>e.jsx("option",{value:d,children:d},d))]}),(Ai||Pe)&&e.jsxs("select",{className:"lk-crm-filtro","aria-label":"Filtrar por origen: tienda o landings",value:Pe,onChange:d=>ue(d.target.value),style:{...E,width:"auto",padding:"7px 12px",fontSize:12.5,marginBottom:0,fontWeight:600,color:Pe?"var(--text, #171717)":"var(--text-muted, #6b7280)"},children:[e.jsx("option",{value:"",children:"Tienda y landings"}),e.jsx("option",{value:"tienda",children:"Solo de la tienda"}),e.jsx("option",{value:"landing",children:"Solo de las landings"})]}),(xt||Qt||Pe)&&e.jsx("button",{className:"lk-crm-filtro",onClick:()=>{Ut(""),$e(""),ue("")},style:{...ee,padding:"7px 12px",fontSize:12.5},children:"Limpiar"})]}),(Ot==="list"||ae!=="leads")&&((vi??0)>0||yi>0||Ur>0||hd>0||fd>0||Mc>0||["estancados","direccion","pago_fallido","guia_estancada","no_subio","puede_oficina"].includes(Ze))&&e.jsxs("div",{className:"lk-crm-alertas",style:{display:"flex",gap:8,marginBottom:12,flexWrap:"wrap",alignItems:"center"},children:[((vi??0)>0||Ze==="guia_estancada")&&e.jsxs("button",{"data-guia":"crm.alerta.guia_estancada",className:"lk-alerta",onClick:()=>dr("guia_estancada",Ze==="guia_estancada"),title:Ze==="guia_estancada"?"Quitar el filtro":"GuÃas y pedidos clavados: más de 7 dÃas en el mismo estado sin moverse. Tócalo para verlos, de cualquier fecha.",style:{display:"inline-flex",alignItems:"center",gap:7,fontFamily:"inherit",background:Ze==="guia_estancada"?"#dc2626":"var(--notice-danger-bg)",color:Ze==="guia_estancada"?"#fff":"var(--danger)",border:`1px solid ${Ze==="guia_estancada"?"#dc2626":"var(--notice-danger-border)"}`,borderRadius:999,padding:"5px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",transition:"background .16s, color .16s"},children:[e.jsx(Ls,{s:12}),Ze==="guia_estancada"?"Mostrando guÃas estancadas":"GuÃas estancadas"," ",e.jsx("span",{style:{background:Ze==="guia_estancada"?"rgba(255,255,255,.28)":"rgba(220,38,38,.14)",borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800},children:vi===null?"Sin dato":vi})]}),(yi>0||Ze==="estancados")&&e.jsxs("button",{"data-guia":"crm.alerta.estancados",onClick:()=>dr("estancados",Ze==="estancados"),title:Ze==="estancados"?"Quitar el filtro":"Pedidos que llevan demasiado tiempo en su etapa sin avanzar. Tócalo para ver solo esos, de cualquier fecha.",style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12.5,fontWeight:700,cursor:"pointer",fontFamily:"inherit",color:Ze==="estancados"?"#fff":"var(--warning)",background:Ze==="estancados"?"#b45309":"var(--notice-warning-bg)",border:`1px solid ${Ze==="estancados"?"#b45309":"var(--notice-warning-border)"}`,borderRadius:999,padding:"5px 12px",boxShadow:Ze==="estancados"?"0 6px 16px -6px rgba(180,83,9,.5)":"none",transition:"all .16s"},children:[e.jsx(Ls,{s:12}),yi," ",yi===1?"pedido estancado":"pedidos estancados"]}),(Ur>0||Ze==="direccion")&&e.jsxs("button",{"data-guia":"crm.alerta.direccion",onClick:()=>dr("direccion",Ze==="direccion"),title:Ze==="direccion"?"Quitar el filtro":"Direcciones que el mensajero puede no encontrar. Tócalo para ver solo esos pedidos, de cualquier fecha.",style:{display:"inline-flex",alignItems:"center",gap:7,fontFamily:"inherit",background:Ze==="direccion"?"#b45309":"var(--notice-warning-bg)",color:Ze==="direccion"?"#fff":"var(--warning)",border:`1px solid ${Ze==="direccion"?"#b45309":"var(--notice-warning-border)"}`,borderRadius:999,padding:"5px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",boxShadow:Ze==="direccion"?"0 6px 16px -6px rgba(180,83,9,.5)":"0 1px 2px rgba(16,24,40,0.03)",transition:"all .16s"},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"})}),Ze==="direccion"?"Mostrando dirección a revisar":"Dirección a revisar"," ",e.jsx("span",{style:{background:Ze==="direccion"?"rgba(255,255,255,.28)":"rgba(180,83,9,.18)",borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800},children:Ur})]}),(hd>0||Ze==="pago_fallido")&&e.jsxs("button",{"data-guia":"crm.alerta.pago_fallido",onClick:()=>dr("pago_fallido",Ze==="pago_fallido"),title:Ze==="pago_fallido"?"Quitar el filtro":"Intentaron pagar en lÃnea y falló; siguen contraentrega. Tócalo para ver solo esos pedidos, de cualquier fecha.",style:{display:"inline-flex",alignItems:"center",gap:7,fontFamily:"inherit",background:Ze==="pago_fallido"?"#be123c":"rgba(225,29,72,.1)",color:Ze==="pago_fallido"?"#fff":"#be123c",border:`1px solid ${Ze==="pago_fallido"?"#be123c":"rgba(225,29,72,.28)"}`,borderRadius:999,padding:"5px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",boxShadow:Ze==="pago_fallido"?"0 6px 16px -6px rgba(190,18,60,.5)":"0 1px 2px rgba(16,24,40,0.03)",transition:"all .16s"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M2 10h20M7 15h.01"})]}),Ze==="pago_fallido"?"Mostrando pago fallido":"Pago fallido"," ",e.jsx("span",{style:{background:Ze==="pago_fallido"?"rgba(255,255,255,.28)":"rgba(190,18,60,.16)",borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800},children:hd})]}),(fd>0||Ze==="no_subio")&&e.jsxs("button",{"data-guia":"crm.alerta.no_subio",onClick:()=>dr("no_subio",Ze==="no_subio"),title:Ze==="no_subio"?"Quitar el filtro":"Los confirmaste y la logÃstica no los recibió: quedaron vendidos y sin guÃa. Cada tarjeta dice por qué. Tócalo para ver solo esos, de cualquier fecha.",style:{display:"inline-flex",alignItems:"center",gap:7,fontFamily:"inherit",background:Ze==="no_subio"?"#dc2626":"var(--notice-danger-bg)",color:Ze==="no_subio"?"#fff":"var(--danger)",border:`1px solid ${Ze==="no_subio"?"#dc2626":"var(--notice-danger-border)"}`,borderRadius:999,padding:"5px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",boxShadow:Ze==="no_subio"?"0 6px 16px -6px rgba(220,3
11668,38,.5)":"0 1px 2px rgba(16,24,40,0.03)",transition:"all .16s"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 7h13v10H3zM16 10h3.5l2.5 3v4h-6"}),e.jsx("circle",{cx:"7",cy:"19",r:"1.6"}),e.jsx("circle",{cx:"18",cy:"19",r:"1.6"}),e.jsx("path",{d:"M2 2l20 20"})]}),Ze==="no_subio"?"Mostrando los que no subieron":"No subieron a la logÃstica"," ",e.jsx("span",{style:{background:Ze==="no_subio"?"rgba(255,255,255,.28)":"rgba(220,38,38,.16)",borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800},children:fd})]}),(Mc>0||Ze==="puede_oficina")&&e.jsxs("button",{"data-guia":"crm.alerta.puede_oficina",onClick:()=>dr("puede_oficina",Ze==="puede_oficina"),title:Ze==="puede_oficina"?"Quitar el filtro":"Llevan más de 3 dÃas quietos en la bodega de destino. Hay transportadoras que nunca reportan «reclame en oficina», asà que el aviso automático no sale: confirma si ya está para recoger y pásalo a «Reclamar en oficina» para que le llegue el mensaje.",style:{display:"inline-flex",alignItems:"center",gap:7,fontFamily:"inherit",background:Ze==="puede_oficina"?"#0369a1":"rgba(2,132,199,.1)",color:Ze==="puede_oficina"?"#fff":"#0369a1",border:`1px solid ${Ze==="puede_oficina"?"#0369a1":"rgba(2,132,199,.3)"}`,borderRadius:999,padding:"5px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",boxShadow:Ze==="puede_oficina"?"0 6px 16px -6px rgba(3,105,161,.5)":"0 1px 2px rgba(16,24,40,0.03)",transition:"all .16s"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 21h18M5 21V8l7-5 7 5v13"}),e.jsx("path",{d:"M10 21v-6h4v6"})]}),Ze==="puede_oficina"?"Mostrando los que pueden estar en oficina":"¿Ya está en la oficina?"," ",e.jsx("span",{style:{background:Ze==="puede_oficina"?"rgba(255,255,255,.28)":"rgba(3,105,161,.16)",borderRadius:999,padding:"1px 7px",fontSize:11,fontWeight:800},children:Mc})]})]}),Ot==="list"&&e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:ac.map(d=>e.jsxs("button",{onClick:()=>he(Gt===d?"":d),style:U8(Gt===d,Bl[d]),children:[to(d)," ",gr[d]?e.jsx("span",{style:tu(Gt===d,Bl[d]),children:gr[d]}):null]},d))}),!da&&!wa&&(zt.length>0||!!Ze)&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"stretch",flexWrap:"wrap",marginBottom:12,background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,boxShadow:"0 1px 2px rgba(16,24,40,.04)",overflow:"hidden"},children:[[{l:G?"En vista (hay más)":"En vista",v:No.length.toLocaleString("es-CO"),u:G?"pedidos · acorta las fechas para ver el resto":No.length===1?"pedido":"pedidos",c:G?"var(--warning)":"var(--text, #111)"},{l:"Total visible",v:wi(eu),u:"",c:"var(--text, #111)"},...ki(Id)?[{l:"Por recuperar",v:wi(Id),u:"",c:"var(--warning)"}]:[],...ki($d)?[{l:"Perdido",v:wi($d),u:"",c:"var(--danger)"}]:[]].map((d,A)=>e.jsxs("div",{style:{padding:"7px 14px 8px",borderLeft:A>0?"1px solid var(--border, #eef0f5)":"none",minWidth:0},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:"var(--text-muted, #8a90a2)",whiteSpace:"nowrap"},children:d.l}),e.jsxs("div",{style:{fontSize:14,fontWeight:800,color:d.c,fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em",whiteSpace:"nowrap",marginTop:1},children:[d.v," ",e.jsx("span",{style:{fontSize:9.5,fontWeight:700,color:"var(--text-muted, #9aa0b0)",letterSpacing:".05em"},children:d.u})]})]},d.l)),(vl>0||Ze==="por_confirmar")&&(()=>{const d=Ze==="por_confirmar";return e.jsxs("button",{"data-guia":"crm.alerta.por_confirmar",onClick:()=>dr("por_confirmar",d),title:d?"Quitar el filtro":"Ver solo los pedidos por confirmar (nuevos, contactados y pendientes), de cualquier fecha",style:{border:"none",padding:"7px 14px 8px",borderLeft:"1px solid var(--border, #eef0f5)",minWidth:0,cursor:"pointer",background:d?"var(--notice-warning-bg)":"transparent",fontFamily:"inherit",textAlign:"left",boxShadow:d?"inset 0 -2px 0 var(--warning)":"none"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:d?"var(--warning)":"var(--text-muted, #8a90a2)",whiteSpace:"nowrap"},children:"Por confirmar"}),e.jsxs("div",{style:{fontSize:14,fontWeight:800,color:"var(--warning)",fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em",whiteSpace:"nowrap",marginTop:1}
1166,children:[vl.toLocaleString("es-CO")," ",e.jsx("span",{style:{fontSize:9.5,fontWeight:700,color:"var(--text-muted, #9aa0b0)",letterSpacing:".05em"},children:vl===1?"pedido":"pedidos"})]})]})})(),[{k:"wa_error",guia:"crm.alerta.wa_error",l:"WhatsApp con error",n:fr.wa_error,c:"#dc2626"},{k:"sin_cobertura",guia:"crm.alerta.sin_cobertura",l:"Sin cobertura",n:fr.sin_cobertura,c:"#dc2626"},{k:"flete_caro",guia:"crm.alerta.flete_caro",l:"Flete costoso",n:fr.flete_caro,c:"#dc2626"},{k:"novedad",guia:"crm.alerta.novedad",l:"Novedad",n:fr.novedad,c:"#dc2626"},{k:"reclamar_oficina",guia:"crm.alerta.reclamar_oficina",l:"Reclamar en oficina",n:fr.reclamar_oficina,c:"#dc2626"}].filter(d=>d.n>0||Ze===d.k).map(d=>{const A=Ze===d.k;return e.jsxs("button",{"data-guia":d.guia,onClick:()=>dr(d.k,A),title:A?"Quitar el filtro":"Ver solo esos pedidos, de cualquier fecha, en su columna",style:{padding:"7px 14px 8px",borderLeft:"1px solid var(--border, #eef0f5)",minWidth:0,cursor:"pointer",border:"none",background:A?"rgba(220,38,38,.08)":"transparent",fontFamily:"inherit",textAlign:"left",boxShadow:A?"inset 0 -2px 0 "+d.c:"none"},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".07em",textTransform:"uppercase",color:A?d.c:"var(--text-muted, #8a90a2)",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:5},children:[e.jsx("span",{className:"lk-alerta",style:{width:7,height:7,borderRadius:99,background:d.c,flex:"none"}}),d.l]}),e.jsxs("div",{style:{fontSize:14,fontWeight:800,color:d.c,fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em",whiteSpace:"nowrap",marginTop:1},children:[d.n.toLocaleString("es-CO")," ",e.jsx("span",{style:{fontSize:9.5,fontWeight:700,color:"var(--text-muted, #9aa0b0)",letterSpacing:".05em"},children:d.n===1?"pedido":"pedidos"})]})]},d.k)})]}),da?Ot==="board"||Ot==="producto"?e.jsx("div",{style:{display:"flex",gap:10,alignItems:"flex-start",overflow:"hidden",paddingBottom:10},children:[0,1,2,3,4].slice(0,be?2:5).map(d=>e.jsxs("div",{style:{flex:be?"0 0 auto":"1 1 0",width:be?"min(86vw, 340px)":void 0,minWidth:be?void 0:200,maxWidth:340,borderRadius:14,border:"1px solid var(--border, #e8eaf0)",background:"var(--bg-soft, #f4f6fa)",padding:"11px 10px"},children:[e.jsx("span",{className:"lk-skel",style:{width:"55%",height:11,borderRadius:6,marginBottom:7,animationDelay:`${d*120}ms`}}),e.jsx("span",{className:"lk-skel",style:{width:"35%",height:9,borderRadius:6,marginBottom:12,animationDelay:`${d*120}ms`}}),[0,1,2].slice(0,3-d%2).map(A=>e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"11px 11px",marginBottom:8},children:[e.jsx("span",{className:"lk-skel",style:{width:"68%",height:11,borderRadius:6,marginBottom:8,animationDelay:`${d*120+A*70}ms`}}),e.jsx("span",{className:"lk-skel",style:{width:"44%",height:9,borderRadius:6,animationDelay:`${d*120+A*70}ms`}})]},A))]},d))}):e.jsx("div",{style:{display:"grid",gap:10},children:[0,1,2].map(d=>e.jsxs("div",{style:{...Jt,padding:"16px 16px"},children:[e.jsx("span",{className:"lk-skel",style:{width:"38%",height:13,borderRadius:7,marginBottom:9,animationDelay:`${d*100}ms`}}),e.jsx("span",{className:"lk-skel",style:{width:"60%",height:10,borderRadius:6,animationDelay:`${d*100}ms`}})]},d))}):Ot==="board"||Ot==="producto"?e.jsxs("div",{children:[e.jsxs("div",{className:"lk-scroll-x",style:{display:"flex",gap:10,marginBottom:12,flexWrap:"wrap",alignItems:"center"},children:[Ot!=="producto"&&e.jsxs("div",{className:"lk-crm-pages"+(be?" lumy-scroll-fade":""),style:{display:"inline-flex",background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:3,gap:2,flex:"none"},children:[(i?[["nuestros","Pedidos Shopify",Bp]]:[["nuestros","Nuestros pedidos",Pp],["logistica",Ec?"LogÃstica":`LogÃstica (${oo})`,Wp]]).map(([d,A,T])=>{const O=Xc(d),W=ae===d;return e.jsxs("button",{onClick:()=>Ui(d),style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:W?"var(--card-bg, #fff)":"transparent",color:W?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:W?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsx("img",{src:d==="nuestros"||Ec?"/logos/iconoF.png":oo==="99envÃos"?"/logos/a99envios.png":oo==="Mastershop"?"/logos/amastershop.jpg":"/logos/adropi.png",alt:"",width:16,height:16,style:{flex:"none",borderRadius:4,objectFit:"contain",background:"#fff",padding:1,opacity:W?1:.75}}),A,e.jsx("span",{style:{fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",background:W?me+"14":"transparent",color:W?me:"var(--text-secondary, #94a3b8)",borderRadius:999,padding:"1px 7px"},children:O})]},d)}),X&&e.jsxs("button",{onClick:()=>Ui("shopify"),title:"Qué producto de Dropi es cada producto tuyo de Shopify",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:ae==="shopify"?"var(--card-bg, #fff)":"transparent",color:ae==="shopify"?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ae==="shopify"?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsx(wA,{size:15}),"Shopify"]}),e.jsxs("button",{onClick:()=>Ui("cancelados"),title:"Por qué te cancelan: motivos, plata y los pedidos uno a uno",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:ae==="cancelados"?"var(--card-bg, #fff)":"transparent",color:ae==="cancelados"?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ae==="cancelados"?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m4.9 4.9 14.2 14.2"})]}),"Cancelaciones",(()=>{const d=No.filter(A=>A.crm_status==="cancelado").length;return d>0?e.jsx("span",{style:{fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",background:ae==="cancelados"?"var(--notice-danger-bg)":"transparent",color:ae==="cancelados"?"var(--danger)":"var(--text-secondary, #94a3b8)",borderRadius:999,padding:"1px 7px"},children:d}):null})()]}),e.jsxs("button",{onClick:()=>Ui("etiquetas"),title:"Organiza tus pedidos en columnas por etiqueta, a tu gusto",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:ae==="etiquetas"?"var(--card-bg, #fff)":"transparent",color:ae==="etiquetas"?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ae==="etiquetas"?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M20.59 13.41 11 3.83A2 2 0 0 0 9.59 3H4a1 1 0 0 0-1 1v5.59A2 2 0 0 0 3.59 11l9.58 9.59a2 2 0 0 0 2.83 0l4.59-4.59a2 2 0 0 0 0-2.83z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]}),"Etiquetas",(()=>{const d=No.filter(A=>A.id&&cn(A).length).length;return d>0?e.jsx("span",{style:{fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",background:ae==="etiquetas"?me+"14":"transparent",color:ae==="etiquetas"?me:"var(--text-secondary, #94a3b8)",borderRadius:999,padding:"1px 7px"},children:d}):null})()]}),e.jsxs("button",{onClick:()=>{Ui("local"),pn.length||ho(!0)},title:"Pedidos de tus ciudades de entrega propia: no se suben a la logÃstica",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:ae==="local"?"var(--card-bg, #fff)":"transparent",color:ae==="local"?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ae==="local"?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]}),"Local",(()=>{const d=No.filter(A=>yl(A)).length;return d>0?e.jsx("span",{style:{fontSize:10.5,fontWeight:800,fontVariantNumeric:"tabular-nums",background:ae==="local"?"rgba(13,148,136,.12)":"transparent",color:ae==="local"?"#0d9488":"var(--text-secondary, #94a3b8)",borderRadius:999,padding:"1px 7px"},children:d}):null})()]}),Ra&&!i&&e.jsxs("button",{onClick:()=>Ui("leads"),title:"Leads del evento (solo admin)",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:9,border:0,cursor:"pointer",whiteSpace:"nowrap",fontSize:12.5,fontWeight:800,fontFamily:"inherit",background:ae==="leads"?"var(--card-bg, #fff)":"transparent",color:ae==="leads"?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ae==="leads"?"0 1px 3px rgba(16,24,40,.10)":"none",transition:"background .15s ease, color .15s ease, box-shadow .15s ease"},children:[e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]}),"Leads"]})]}),Ot==="producto"&&Ma&&e.jsxs("button",{className:"lk-filtro-producto",onClick:()=>en(null),title:"Quitar el filtro y volver a ver todos",children:["Viendo solo: ",e.jsx("b",{children:Ma.etiqueta}
1166)," ",e.jsx("span",{"aria-hidden":!0,children:"â"})]}),Ze&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",fontWeight:500},children:"Viendo solo los pedidos de esa alerta, de cualquier fecha y de todas las pestañas. Tócala de nuevo para volver."}),Ze&&(()=>{const d=VC[Ze],A=[...new Set(zt.filter(O=>O.phone).map(O=>Dn(O.phone,O.country)).filter(Boolean))];if(!d||!A.length)return null;const T={};for(const O of zt){const W=Dn(O.phone,O.country);W&&O.id&&!T[W]&&(T[W]=O.id)}return e.jsxs("button",{onClick:()=>hs({nombre:d.quienes,deTexto:`de ${d.quienes}`},A,d.borrador,T,Ze,zt.map(O=>String(O.country||""))),title:`Abre el mensaje masivo SOLO para ${d.quienes} que ves aquÃ, con un borrador ya escrito. Lo revisas antes de enviar.`,style:{display:"inline-flex",alignItems:"center",gap:7,marginLeft:"auto",border:0,background:"#25D366",color:"#fff",borderRadius:999,padding:"6px 14px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit",boxShadow:"0 2px 10px -2px rgba(37,211,102,.55)",whiteSpace:"nowrap"},children:[e.jsx(Bo,{s:13}),d.boton," · ",A.length]})})(),!Ze&&Ot!=="producto"&&ae==="logistica"&&!Da&&oo==="Dropi"&&e.jsx("span",{role:"status",style:{fontSize:11.5,color:"var(--warning)",fontWeight:600},children:"Conecta Dropi (pestaña Dropi) para que estos se muevan solos."}),!Ze&&Ot!=="producto"&&ae==="leads"&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",fontWeight:500},children:"Inscritos del evento por calidad. Usa la fecha y la búsqueda de arriba para filtrar."}),!Ze&&Ot!=="producto"&&ae==="etiquetas"&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",fontWeight:500},children:"El pedido etiquetado vive SOLO aquÃ, en un solo lugar. QuÃtale la etiqueta (botón ð·) y vuelve a su etapa."}),!Ze&&Ot!=="producto"&&ae==="local"&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,fontSize:11.5,color:"var(--text-muted)",fontWeight:500},children:[pn.length?e.jsxs(e.Fragment,{children:["Entrega propia en ",e.jsx("b",{style:{color:"var(--text, #374151)"},children:pn.join(", ")}),": estos pedidos no se suben a tu logÃstica."]}):"Elige las ciudades que quieres apartar para entrega propia.",e.jsx("button",{onClick:()=>ho(!0),style:{border:"1px solid rgba(13,148,136,.35)",background:"rgba(13,148,136,.08)",color:"#0d9488",borderRadius:999,padding:"3px 11px",fontSize:11,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Ciudades"}),e.jsxs("button",{onClick:yr,style:{display:"inline-flex",alignItems:"center",gap:6,border:0,background:"#0d9488",color:"#fff",borderRadius:999,padding:"5px 13px",fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",boxShadow:"0 2px 8px -2px rgba(13,148,136,.5)"},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Exportar confirmados (CSV)"]})]}),!Ze&&Ot!=="producto"&&ae==="nuestros"&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)",fontWeight:500},children:i?"Los pedidos nuevos aparecen aquà automáticamente.":oo==="Dropi"?'Sube a Dropi con el botón del camión; pasa solo a "Pendiente confirmación".':`EnvÃa a ${oo} con el botón naranja; pasa solo a "Pendiente confirmación".`}),ae!=="shopify"&&e.jsx("div",{title:"El orden de las tarjetas dentro de cada columna. Urgencia: riesgo primero, luego el que más lleva esperando; a igual espera, más plata primero.",style:{display:"inline-flex",alignItems:"center",gap:2,marginLeft:"auto",background:"var(--bg-soft, #eef1f6)",borderRadius:999,padding:3},children:[["urgencia","Urgencia"],["plata","Plata"],["recientes","Recientes"]].map(([d,A])=>e.jsx("button",{onClick:()=>vr(d),style:{border:0,borderRadius:999,padding:"5px 11px",fontSize:11.5,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",fontFamily:"inherit",background:Zn===d?"var(--card-bg, #fff)":"transparent",color:Zn===d?"var(--text, #111)":"var(--text-secondary, #64748b)",boxShadow:Zn===d?"0 1px 3px rgba(16,24,40,.12)":"none"},children:A},d))}),!Ze&&Ot!=="producto"&&ae==="logistica"&&e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,marginLeft:"auto",background:"var(--bg-soft, #eef1f6)",borderRadius:999,padding:3},children:[["all","Todos",null],["lumy","De Lumy","/logos/iconoF.png"],...oo==="Dropi"?[["dropi","Directos de Dropi","/logos/adropi.png"]]:[]].map(([d,A,T])=>{const O=k===d;return e.jsxs("button",{onClick:()=>Y(d),style:{display:"inline-flex",alignItems:"center",gap:5,border:0,borderRadius:999,padding:"5px 11px",fontSize:11.5,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",background:O?"var(--card-bg, #fff)":"transparent",color:O?"var(--text, #111)":"var(--text-secondary, #64748b)",boxShadow:O?"0 1px 3px rgba(16,24,40,.12)":"none"},children:[T&&e.jsx("img",{src:T,alt:"",width:13,height:13,style:{borderRadius:3,objectFit:"contain"}}),A]},d)})})]}),Ot==="producto"&&Ci.length>0&&(()=>{const d=Ci.slice(0,8),A=Ci.slice(8),T=["pedidos","ventas","confirmaron",...Kr.map(nt=>nt[0])],O=(nt,Bt)=>{const ca={...nt};for(const Vt of T)ca[Vt]+=Bt[Vt];return ca},W=A.length?A.reduce(O,fl("pr:otros",`Los demás (${A.length})`)):null,J=Ci.reduce(O,fl("pr:total","Todos")),le=(nt,Bt)=>Bt>0?Math.round(nt/Bt*100):null,Ve=(nt,Bt,ca)=>{const Vt=le(nt,Bt);return e.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:3,minWidth:46,width:"100%"},children:[e.jsxs("span",{style:{fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",color:nt>0?"var(--text, #111)":"var(--text-muted, #b3b9c6)"}
1166,children:[e.jsx("b",{children:nt.toLocaleString("es-CO")}),nt>0&&Vt!=null&&e.jsxs("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted, #8a90a2)",marginLeft:4},children:[Vt,"%"]})]}),e.jsx("span",{style:{display:"block",width:"100%",height:3,borderRadius:2,background:ca+"26"},children:e.jsx("span",{style:{display:"block",width:`${Vt||0}%`,height:"100%",borderRadius:2,background:ca}})})]})},gt=nt=>{const Bt=le(nt.confirmaron,nt.pedidos),ca=ei(nt.entregado,nt.devuelto),Vt=ca==null?null:Math.round(ca*100);if(Bt==null&&Vt==null)return null;const va=qt=>qt==null?"var(--text-muted, #9aa0b0)":qt>=75?"var(--success)":qt>=55?"var(--warning)":"var(--danger)";return e.jsx("span",{className:"lk-pauta-tot",title:"Confirma: llegaron a confirmado (o más allá) entre los que entraron. Entrega: entregados entre los que ya llegaron a la puerta (entregados + devueltos).",children:e.jsxs("span",{children:[Bt!=null&&e.jsxs(e.Fragment,{children:["Confirma ",e.jsxs("b",{style:{color:va(Bt)},children:[Bt,"%"]})]}),Bt!=null&&Vt!=null&&" · ",Vt!=null&&e.jsxs(e.Fragment,{children:["Entrega ",e.jsxs("b",{style:{color:va(Vt)},children:[Vt,"%"]})]})]})})},Qe=nt=>nt.col==="pr:total"?null:nt.col==="pr:otros"?A.map(Bt=>Bt.col):[nt.col],Z=(nt,Bt)=>!!Ma&&Ma.cubo===Bt&&JSON.stringify(Ma.cols)===JSON.stringify(Qe(nt)),Rt=(nt,Bt,ca)=>{var Vt;if(ca>0){if(Z(nt,Bt)){en(null);return}en({cols:Qe(nt),cubo:Bt,etiqueta:`${nt.nombre} · ${Bt==="todos"?"todos los que entraron":((Vt=Kr.find(va=>va[0]===Bt))==null?void 0:Vt[1])||Bt} · ${ca.toLocaleString("es-CO")}`})}},Yt=(nt,Bt,ca,Vt)=>e.jsx("td",{className:"lk-pauta-num"+(ca>0?" lk-pauta-celda-filtro":"")+(Z(nt,Bt)?" on":""),onClick:()=>Rt(nt,Bt,ca),title:ca>
11660?Z(nt,Bt)?"Quitar el filtro":"Toca para ver abajo solo estos pedidos":void 0,children:Vt},Bt),Ht=(nt,Bt,ca=!1,Vt)=>e.jsxs("tr",{className:(ca?"lk-pauta-total":"")+(Vt!=null&&Vt.dentro?" lk-pauta-dentro":""),children:[e.jsxs("td",{className:"lk-pauta-nombre",style:{fontWeight:ca?800:700,paddingLeft:Vt!=null&&Vt.dentro?26:void 0},children:[e.jsxs("span",{className:"lk-pauta-fila",children:[!ca&&!(Vt!=null&&Vt.desplegable)&&e.jsx("span",{style:{width:8,height:8,borderRadius:99,background:ju[Bt%ju.length],flex:"none"}}),Vt!=null&&Vt.desplegable?e.jsxs("button",{type:"button",onClick:va=>{va.stopPropagation(),Os(qt=>!qt)},title:bo?"Ocultar la lista":"Ver qué productos agrupa",style:{display:"inline-flex",alignItems:"center",gap:6,border:0,background:"transparent",padding:0,font:"inherit",fontWeight:800,color:"var(--text, #111)",cursor:"pointer"},children:[e.jsx("span",{style:{display:"inline-block",transition:"transform .15s",transform:bo?"rotate(90deg)":"none",fontSize:10},children:"â¶"}),nt.nombre]}):e.jsx("span",{className:"txt",children:nt.nombre})]}),nt.pedidos>0&&e.jsx("span",{className:"lk-pauta-reparto",title:Kr.filter(([va])=>nt[va]>0).map(([va,qt])=>`${qt}: ${nt[va]}`).join(" · "),children:Kr.map(([va,,qt])=>nt[va]>0?e.jsx("span",{style:{width:`${nt[va]/nt.pedidos*100}%`,background:qt}},va):null)}),gt(nt)]}),Yt(nt,"todos",nt.pedidos,e.jsx("b",{children:nt.pedidos.toLocaleString("es-CO")})),Kr.map(([va,,qt])=>Yt(nt,va,nt[va],Ve(nt[va],nt.pedidos,qt))),e.jsx("td",{className:"lk-pauta-num",style:{color:"var(--success)",fontWeight:800},children:Nr(nt.ventas)})]},nt.col);return e.jsxs("div",{style:{...Jt,padding:"14px 16px 12px",marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[e.jsx("div",{style:{fontSize:13.5,fontWeight:800,letterSpacing:"-.01em"},children:"Cómo va cada producto"}),e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted, #8a90a2)"},children:"Dónde está hoy cada pedido del rango, de todas las pestañas, en el orden del camino del cliente. Las ventas no cuentan cancelados ni devueltos."})]}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginTop:6,fontSize:10.5,fontWeight:700,color:"var(--text-secondary, #64748b)"},children:Kr.map(([nt,Bt,ca,Vt])=>e.jsxs("span",{title:Vt,style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:ca}}),Bt]},nt))}),e.jsx("div",{className:"lk-tabla-premium",style:{marginTop:10},children:e.jsxs("table",{className:"lk-pauta lk-pauta-compacta lk-pauta-embudo",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Producto"}),e.jsx("th",{className:"lk-pauta-num",title:"Todos los pedidos del rango con ese producto, de todas las pestañas",children:"Entraron"}),Kr.map(([nt,Bt,,ca])=>e.jsx("th",{className:"lk-pauta-num",title:ca+". % sobre los que entraron",children:Bt},nt)),e.jsx("th",{className:"lk-pauta-num",title:"Sin contar cancelados ni devueltos",children:"Ventas"})]})}),e.jsxs("tbody",{children:[d.map((nt,Bt)=>Ht(nt,Bt)),W&&Ht(W,8,!1,{desplegable:!0}),W&&bo&&A.map((nt,Bt)=>Ht(nt,8+Bt,!1,{dentro:!0})),Ci.length>1&&Ht(J,0,!0)]})]})})]})})(),ae==="leads"&&!Ze&&Ot!=="producto"&&e.jsx(G8,{q:kt,range:Ga,cFrom:ka,cTo:Cn}),Sl>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,fontSize:11.5,color:"var(--text-muted)",flexWrap:"wrap"},children:[e.jsxs("span",{children:[Sl===1?"1 columna vacÃa se ocultó":`${Sl} columnas vacÃas se ocultaron`,". Vuelven solas cuando les caiga un pedido."]}),e.jsx("button",{onClick:()=>Co(!0),style:{border:0,background:"transparent",color:me,fontWeight:700,fontSize:11.5,fontFamily:"inherit",cursor:"pointer",padding:0},children:"Ver todas"})]}),hn&&Al&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,fontSize:11.5,color:"var(--text-muted)",flexWrap:"wrap"},children:[e.jsx("span",{children:"Viendo todas las columnas, incluidas las vacÃas."}),e.jsx("button",{onClick:()=>Co(!1),style:{border:0,background:"transparent",color:me,fontWeight:700,fontSize:11.5,fontFamily:"inherit",curs
1166or:"pointer",padding:0},children:"Ocultar las vacÃas"})]}),be&&_i.length>1&&!(Ot==="producto"&&Ma)&&e.jsx("div",{className:"lk-scroll-x lumy-scroll-fade lk-crm-cols",style:{display:"flex",gap:6,marginBottom:8},children:_i.map(d=>{var W;const A=(_i.includes(za)?za:_i[0])===d,T=jl(d).length,O=String(d).startsWith("et:")?((W=it.find(J=>J.id===Number(String(d).slice(3))))==null?void 0:W.nombre)||"Etiqueta":String(d).startsWith("pr:")?String(d).slice(3):d==="local_exportado"?"Exportado":to(d);return e.jsxs("button",{type:"button",onClick:()=>{const J=document.querySelector(`.lk-board [data-col="${CSS.escape(String(d))}"]`);J==null||J.scrollIntoView({behavior:"smooth",inline:"start",block:"nearest"}),sn(String(d))},style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${A?me:"var(--border, #e8eaf0)"}`,background:A?me+"12":"var(--card-bg, #fff)",color:A?me:"var(--text-secondary, #64748b)",borderRadius:999,padding:"6px 11px",fontSize:12,fontWeight:800,whiteSpace:"nowrap",cursor:"pointer",fontFamily:"inherit",flex:"none"},children:[O,e.jsx("span",{style:{fontVariantNumeric:"tabular-nums",background:A?me+"1f":"var(--bg-soft, #f3f5f9)",borderRadius:999,padding:"1px 7px",fontSize:11},children:T})]},d)})}),e.jsxs("div",{className:"lk-board"+(Ot==="producto"&&Ma?" lk-board-horizontal":""),onScroll:be?d=>{const A=d.currentTarget,T=A.scrollLeft+A.clientWidth/2;let O="",W=1/0;A.querySelectorAll("[data-col]").forEach(J=>{const le=Math.abs(J.offsetLeft+J.offsetWidth/2-T);le<W&&(W=le,O=J.dataset.col||"")}),O&&O!==za&&sn(O)}:void 0,style:{display:(ae==="leads"||ae==="cancelados")&&!Ze&&Ot!=="producto"||ae==="shopify"&&!Ze?"none":"flex",alignItems:"stretch",justifyContent:"flex-start",gap:10,overflowX:"auto",overflowY:"hidden",padding:"2px 2px 12px",scrollSnapType:be?"x mandatory":"x proximity"},children:[_i.map(d=>{const A=String(d).startsWith("et:"),T=A&&Number(String(d).slice(3))||0,O=T?it.find(Z=>Z.id===T):null,W=jl(d),J=String(d).startsWith("pr:"),le=J?ju[Math.max(0,xl.indexOf(d))%ju.length]:A?(O==null?void 0:O.color)||"#94a3b8":d==="local_exportado"?"#0d9488":Bl[d]||"#64748b",Ve=go===d,gt=d==="lead_wa"?{}:$r(W,()=>!0),Qe=be?{flex:"0 0 100%",width:"100%",maxWidth:"100%"}:Ze||ae==="nuestros"||Ot==="producto"?{flex:"1 1 0",minWidth:308,maxWidth:356}:{flex:"0 0 auto",width:308};return e.jsxs("div",{"data-col":d,style:{...Qe,scrollSnapAlign:"start",display:"flex",flexDirection:"column",borderRadius:14,background:Ve?le+"14":`linear-gradient(180deg, ${le}0a 0%, var(--bg-soft, #f4f6fa) 96px)`,border:`1px solid ${Ve?le:"var(--border, #e8eaf0)"}`,boxShadow:Ve?`0 0 0 3px ${le}21, 0 10px 24px -14px ${le}59`:"0 1px 2px rgba(16,24,40,.03)",transition:"background .18s ease, border-color .18s ease, box-shadow .18s ease",maxHeight:"calc(100vh - 220px)",minHeight:128},children:[e.jsxs("div",{style:{padding:"11px 12px 9px",flex:"0 0 auto",borderBottom:`1px solid ${Ve?le+"40":"var(--border, #e8eaf0)"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:le,flex:"none",boxShadow:`0 0 0 3px ${le}22`}}),e.jsx("b",{style:{fontSize:11,fontWeight:800,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text, #111)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:J?jd(d):A?(O==null?void 0:O.nombre)||"Sin etiqueta":d==="local_exportado"?"Exportado":ae==="local"&&d==="despachado"?"Despachado":ae==="local"&&d==="en_transito"?"En camino":to(d)}),e.jsx("span",{style:{marginLeft:"auto",flex:"none",fontSize:11,fontWeight:800,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)",background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:999,padding:"1px 8px",boxShadow:"0 1px 2px rgba(16,24,40,.04)"},children:W.length}),A&&W.some(Z=>Z.phone)&&e.jsx("button",{onClick:()=>hs(O,W.filter(Z=>Z.phone).map(Z=>Dn(Z.phone,Z.country)).filter(Boolean),"",(()=>{const Z={};for(const Rt of W){const Yt=Dn(Rt.phone,Rt.country);Yt&&Rt.id&&!Z[Yt]&&(Z[Yt]=Rt.id)}return Z})(),"",W.map(Z=>
1166String(Z.country||""))),title:"EscrÃbeles SOLO a los de esta columna, desde aquà mismo",style:{flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:7,background:"#25D366",color:"#fff",border:0,cursor:"pointer"},children:e.jsx(Bo,{s:13})})]}),ki(gt)&&e.jsx("div",{style:{marginTop:5,fontSize:12,fontWeight:800,color:"var(--text, #111)",fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em"},children:wi(gt)}),ae!=="local"&&(i?Ly[d]:Ni[d])&&e.jsx("div",{style:{fontSize:10.5,color:"var(--text-secondary, #64748b)",marginTop:ki(gt)?3:5,lineHeight:1.35},children:i?Ly[d]:(Ni[d]||"").replace(/Dropi/g,oo)})]}),e.jsxs("div",{className:"lk-bcol-body",style:{flex:1,overflowY:"auto",padding:"10px 8px",display:"flex",flexDirection:"column",gap:8},children:[Ve&&e.jsx("div",{className:"lk-bdrop",style:{flex:"none",border:`1.5px dashed ${le}`,background:le+"0d",color:le,borderRadius:10,padding:"12px 8px",fontSize:10.5,fontWeight:800,textAlign:"center",letterSpacing:".05em",textTransform:"uppercase"},children:"Suelta aquÃ"}),W.length===0&&!Ve&&e.jsxs("div",{style:{padding:"16px 10px 20px",textAlign:"center"},children:[e.jsxs("div",{"aria-hidden":"true",style:{width:58,margin:"0 auto 9px",border:"1.5px dashed var(--border, #d7dce6)",borderRadius:9,padding:"7px 8px",background:"var(--card-bg, #fff)",opacity:.85},children:[e.jsx("div",{style:{height:5,borderRadius:3,background:le+"30",width:"75%",marginBottom:4}}),e.jsx("div",{style:{height:5,borderRadius:3,background:"var(--border, #e8eaf0)",width:"50%"}})]}),e.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-secondary, #94a3b8)",lineHeight:1.45,maxWidth:200,margin:"0 auto"},children:ae==="local"?d==="local_exportado"?"Arrastra aquà los que ya pasaste a tu sistema de entregas.":"Sin pedidos en este paso.":A?"Ponle esta etiqueta a un pedido (botón ð· de su tarjeta) o arrástralo desde otra columna.":(i?HC[d]:(Jr[d]||"").replace(/Dropi/g,oo))||"Sin pedidos en esta etapa."})]}),W.map((Z,Rt)=>{var _t,Dt;const Yt=!!Z.paid_at,Ht=Yt&&!!(Z.fields&&Z.fields._ship_prepay),nt=Number((_t=Z.fields)==null?void 0:_t._recaudo_cop)||0,Bt=pl(Z,(Dt=Z.fields)==null?void 0:Dt._anticipo_cop),ca=mn===Z.id,Vt=Z.origin==="dropi"||Z.origin==="envios99"||Z.origin==="mastershop"||(ae==="logistica"||Ot==="producto")&&!!Z.dropi_order_id;(ae==="nuestros"||A||ae==="local"||Ot==="producto")&&!Z.repetido_de&&(Z.origin!=="shopify"||X)&&!Z.dropi_order_id&&Da&&Mn(Z,"dropi")&&["abandonado","lead_wa","pago_pendiente"].includes(Z.crm_status);const va=is(Z.created_at),qt=!!Z.stalled,io=Z.fields&&typeof Z.fields=="object"?Z.fields:{},Uo=Array.isArray(io._cart_items)&&io._cart_items.length?io._cart_items:null,Se=Hy(Z.products),It=Z.tienda_general?"Escribió desde tu tienda, sin elegir producto":Uo?Uo.map(Ce=>`${el(Ce)}${(Number(Ce.qty)||1)>1?` Ã${Number(Ce.qty)}`:""}`).join(" · "):(()=>{var Kt;const Ce=String(Array.isArray(Z.products)&&((Kt=Z.products[0])==null?void 0:Kt.name)||Z.landing_name||"").trim();return Ce?Ce+(Se.qty>1?` Ã${Se.qty}`:"")+(Se.extra>0?` +${Se.extra}`:""):""})();return e.jsxs("div",{className:"lk-bcard",onClick:()=>{Vt||Lt(Z.id)},title:Vt?"Pedido directo de Dropi · solo lectura":"Ver detalle del cliente",style:{...KC(le),flex:"none",animationDelay:`${Math.min(Rt,8)*40}ms`,borderRadius:12,background:"var(--card-bg, #fff)",padding:"10px 11px",display:"flex",flexDirection:"column",gap:7,opacity:ca?.5:1,cursor:Vt?"default":"pointer",...ca?{transform:"scale(.98)",boxShadow:YC(le)}:null},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[!Vt&&e.jsx("input",{type:"checkbox",checked:He.has(Z.id),onClick:Ce=>Ce.stopPropagation(),onChange:()=>dl(Z.id),style:{width:17,height:17,flex:"none",accentColor:me,cursor:"pointer"}}),Ot!=="producto"&&(!Vt||A&&!!Z.id)&&e.jsx("span",{className:"lk-grip",title:"Arrastra para mover",onClick:Ce=>Ce.stopPropagation(),onPointerDown:Ce=>dd(Z.id,Ce,A?String(d):void 0),onPointerMove:un,onPointerUp:cd,onPointerCancel:cd,style:{flex:"none",cursor:"grab",touchAction:"none",color:"var(--text-muted, #b3b9c6)",display:"inline-flex",padding:"3px 2px"},children:e.jsxs("svg",{width:"10",height:"15",viewBox:"0 0 10 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2.5",cy:"3",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"3",r:"1.4"}),e.jsx("circle",{cx:"2.5",cy:"8",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"8",r:"1.4"}),e.jsx("circle",{cx:"2.5",cy:"13",r:"1.4"}),e.jsx("circle",{cx:"7.5",cy:"13",r:"1.4"})]})}),e.jsx("b",{style:{fontSize:13,fontWeight:700,letterSpacing:"-.01em",color:"var(--text, #111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:Z.customer_name||"(sin nombre)"}
1166),Z.crm_status!=="lead_wa"&&Number(Z.total_cop)>0&&e.jsxs("span",{style:{fontSize:12.5,fontWeight:800,color:me,flex:"none",fontVariantNumeric:"tabular-nums",letterSpacing:"-.01em"},children:["$",Number(Z.total_cop).toLocaleString("es-CO"),e.jsx("span",{style:{fontSize:9,fontWeight:800,letterSpacing:".05em",opacity:.65,marginLeft:3},children:Si(Z)})]})]}),(()=>{const Ce=ha(Z);return Ce&&Ce.label!=="Primera vez"?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:-3},children:e.jsxs("span",{title:Ce.detalle,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10,fontWeight:800,color:Ce.color,background:Ce.bg,borderRadius:999,padding:"2px 8px"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:99,background:Ce.color}}),Ce.label," · ",Number(Z.conf_entregados)||0,"â ",Number(Z.conf_devueltos)||0,"â"]})}):null})(),It&&e.jsx("div",{style:{fontSize:11.5,fontWeight:600,color:"var(--text-secondary, #475569)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.35},children:It}),(Z.city||va.txt||Z.phone)&&e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"2px 5px",fontSize:11,fontWeight:600,color:"var(--text-secondary, #94a3b8)",lineHeight:1.35,minWidth:0},children:[Z.city&&e.jsxs("span",{style:{...qp,maxWidth:130},children:[e.jsx(Hl,{s:10}),Z.city]}),va.txt&&e.jsxs(e.Fragment,{children:[Z.city&&e.jsx("span",{style:{opacity:.5},children:"·"}),e.jsxs("span",{title:qt?"Lleva más de 48 h sin avanzar":"",style:{...qp,...qt?{color:"var(--warning)",fontWeight:700}:null},children:[e.jsx(Ls,{s:10}),va.txt,qt?" · sin confirmar":""]})]}),Z.phone&&e.jsxs(e.Fragment,{children:[(Z.city||va.txt)&&e.jsx("span",{style:{opacity:.5},children:"·"}),e.jsxs(Np,{phone:Z.phone,cc:(rn[String(Z.country||"").toUpperCase()]||{phoneCc:qa.cc}).phoneCc,natLen:(rn[String(Z.country||"").toUpperCase()]||{natLen:qa.nat}).natLen,style:qp,children:[e.jsx(wu,{s:10}),Z.phone]})]})]}),e.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap",alignItems:"center"},children:[Z.source&&e.jsx(Lu,{source:Z.source}),Z.origin==="shopify"?e.jsxs("span",{title:"Pedido importado automáticamente desde Shopify.",style:{...zn,color:"#4f7d32",background:"rgba(149,191,71,.16)"},children:[e.jsx(y1,{size:11}),"Shopify"]}):Z.origin!=="dropi"&&!!Z.dropi_order_id||Z.origin==="dropi"&&Z.from_lumy?e.jsxs("span",{title:"Pedido que salió de Lumy y ya está en Dropi.",style:{...zn,color:me,background:me+"12"},children:[e.jsx("img",{src:"/logos/iconoF.png",alt:"",width:11,height:11,style:{borderRadius:2,objectFit:"contain"}}),"Lumy"]}):Z.origin==="dropi"?e.jsxs("span",{title:"Pedido creado directo en Dropi, no por Lumy.",style:{...zn,color:"#6d28d9",background:"rgba(124,58,237,.12)"},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:11,height:11,style:{borderRadius:2,objectFit:"contain"}}),"Directo en Dropi"]}):Z.origin==="envios99"?e.jsxs("span",{title:"EnvÃo creado directo en 99envÃos, no por Lumy.",style:{...zn,color:"#ea580c",background:"rgba(234,88,12,.12)"},children:[e.jsx("img",{src:"/logos/a99envios.png",alt:"",width:11,height:11,style:{borderRadius:2,objectFit:"contain"}}),"Directo en 99envÃos"]}):Z.origin==="mastershop"?e.jsxs("span",{title:"Pedido creado directo en Mastershop, no por Lumy.",style:{...zn,color:"#0d9488",background:"rgba(13,148,136,.12)"},children:[e.jsx("img",{src:"/logos/amastershop.jpg",alt:"",width:11,height:11,style:{borderRadius:2,objectFit:"contain"}}),"Directo en Mastershop"]}):null,Z.de_tienda&&e.jsx(Rp,{general:!!Z.tienda_general}),Yt?Ht?e.jsx("span",{style:{...zn,color:"#a9750f",background:"rgba(200,144,26,.14)"},title:"El cliente pagó el ENVÃO en lÃnea. La guÃa va CON RECAUDO: cóbrale el producto"+(nt>0?" ($"+nt.toLocaleString("es-CO")+")":"")+" al entregar.",children:"EnvÃo pagado · recauda producto"}):e.jsx("span",{className:"lk-gold-badge",style:{...zn},children:e.jsx("span",{style:{position:"relative",zIndex:1},children:"Pagado · sin recaudo"})}):Bt>0?e.jsxs("span",{style:{...zn,color:"#0b7a4b",background:"rgba(11,122,75,.13)"},title:"El cliente ya te abonó "+Sn(Bt,Si(Z),!1)+". La guÃa sale cobrando el saldo.",children:["Abonó ",Sn(Bt,Si(Z),!1)," · cobra ",Sn(Math.max(0,(Number(Z.total_cop)||0)-Bt),Si(Z),!1)]}):Z.crm_status==="pago_pendiente"?null:e.jsx("span",{style:{...zn,color:"var(--text-secondary)",background:"var(--bg-tertiary)"},children:"Con recaudo"}),Number((Z.fields&&typeof Z.fields=="object"?Z.fields:{})._auto_promoted)===1&&!Z.dropi_order_id&&!Z.confirmed_at&&!["confirmado","despachado","en_transito","entregado","devuelto","reclamar_oficina"].includes(String(Z.crm_status||""))&&e.jsx("span",{style:{...zn,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)"},title:"Llenó todos sus datos y escogió la oferta, pero no alcanzó a tocar «Confirmar». ConfÃrmalo antes de enviarlo.",children:"No tocó Confirmar"}),!!Z.id&&cn(Z).map(Ce=>e.jsxs("span",{style:{...zn,color:Ce.color,background:Ce.color+"1a",display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:99,background:Ce.color,flex:"none"}}
1166),Ce.nombre]},"etq"+Ce.id)),Number(Z.crm_gestiones)>0&&e.jsxs("span",{title:"Veces que lo has gestionado por WhatsApp desde Lumy"+(Z.crm_gestion_at?". Ãltima: "+is(String(Z.crm_gestion_at)).txt:""),style:{...zn,color:"var(--text-secondary)",background:"var(--bg-tertiary)"},children:["â ",Z.crm_gestiones]}),Mo(Z)!=="no"&&e.jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),qo(Z)},className:Mo(Z)==="vencido"?"lk-alerta":void 0,title:Mo(Z)==="vencido"?"Te pediste este recordatorio y ya venció: gestiónalo o pospónlo otra vez.":"Recordatorio puesto. Tócalo para cambiarlo o quitarlo.",style:{...zn,border:0,cursor:"pointer",fontFamily:"inherit",color:Mo(Z)==="vencido"?"var(--danger)":"var(--warning)",background:Mo(Z)==="vencido"?"var(--notice-danger-bg)":"var(--notice-warning-bg)"},children:["â° ",Mo(Z)==="vencido"?"¡recuérdalo!":Oi(Z)]}),Z.payment_attempt_failed&&e.jsx("span",{style:{...zn,color:"#be123c",background:"rgba(225,29,72,.09)"},children:"Intentó pagar"}),!!Z.atencion_tipo&&!Z.atencion_resuelta_at&&e.jsxs("span",{title:"El cliente pidió cambiar "+(Z.atencion_cambio?Z.atencion_cambio+" ":"")+"â hay que corregirlo en Dropi, Lumy no puede hacerlo.",style:{...zn,color:"var(--danger)",background:"var(--notice-danger-bg)"},children:["Pidió cambio",Z.atencion_cambio?": "+Z.atencion_cambio:""]}),Wl(Z)&&e.jsx("span",{style:{...zn,color:"var(--warning)",background:"var(--notice-warning-bg)"},children:"Dirección"}),Z.buyer_risk_pct!=null&&Z.buyer_risk_pct>=40&&e.jsxs("span",{title:Z.buyer_risk_flag||"Este comprador ha devuelto el "+Z.buyer_risk_pct+"% de sus pedidos anteriores. Revisa antes de despachar.",style:{...zn,color:"var(--danger)",background:"var(--notice-danger-bg)"},children:["Riesgo ",Z.buyer_risk_pct,"%"]}),Z.dropi_status&&e.jsxs("span",{style:{...zn,color:ql(Z.dropi_status),background:`${ql(Z.dropi_status)}1f`,display:"inline-flex",alignItems:"center",gap:5},children:[(()=>{const Ce=Kd(Z.dropi_carrier);return Ce?e.jsx("img",{src:Ce,alt:"",title:String(Z.dropi_carrier||""),style:{height:11,maxWidth:52,objectFit:"contain"}}):null})(),Hp(Z.dropi_status)]}),(()=>{const Ce=String(Z.crm_status||"");if(["lead_wa","abandonado","pago_pendiente","nuevo","entregado","cancelado"].includes(Ce))return null;const Kt=Du(Z),pa=Kt?is(String(Kt)).txt:"",_a=String(Z.dropi_novedad||"").trim(),tn=Gy(Z);return e.jsxs(e.Fragment,{children:[pa&&e.jsxs("span",{title:`En «${to(Ce)}» desde ${new Date(String(Kt).replace(" ","T")+(String(Kt).endsWith("Z")?"":"Z")).toLocaleString("es-CO",{timeZone:"America/Bogota"})}`,style:{...zn,color:tn?"var(--danger)":"var(--text-secondary)",background:tn?"var(--notice-danger-bg)":"var(--bg-tertiary)"},children:["â± ",pa.replace(/^hace /,"")," ",{contactado:"contactado",pendiente_confirmar:"por confirmar",confirmado:"confirmado",despachado:"despachado",en_transito:"en camino",novedad:"con novedad",reclamar_oficina:"en oficina",devuelto:"devuelto",rechazado:"rechazado",local_exportado:"exportado",repetido:"repetido"}[Ce]||`en ${to(Ce).toLowerCase()}`]}),_a&&(Ce==="novedad"||Ce==="reclamar_oficina"||Ce==="devuelto")&&e.jsx("span",{title:_a,style:{...zn,color:"var(--warning)",background:"var(--notice-warning-bg)",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block"},children:_a})]})})()]}),e.jsx(Oy,{s:Z,fetch:s,onSaved:(Ce,Kt)=>m(pa=>pa.map(_a=>_a.id===Ce?{..._a,...Kt}:_a)),compacta:!0}),Vt?e.jsxs("div",{style:{marginTop:2,paddingTop:8,borderTop:"1px solid var(--border, #f0f2f7)",display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:le+"1a",color:le,border:`1px solid ${le}45`,borderRadius:999,padding:"4px 11px",fontSize:11,fontWeight:800},children:to(Z.crm_status)}),e.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"var(--text-secondary, #94a3b8)"},children:["lo mueve ",Z.origin==="envios99"||Z.envios99_order_id?"99envÃos":Z.origin==="mastershop"||Z.mastershop_order_id?"Mastershop":"Dropi"]})]}):e.jsx("div",{onClick:Ce=>Ce.stopPropagation(),style:{marginTop:2,paddingTop:8,borderTop:"1px solid var(--border, #f0f2f7)"},children:e.jsx("select",{value:Z.crm_status,title:"Cambiar etapa del pedido",onChange:Ce=>{Ce.target.value==="cancelado"?ia([Z.id]):zo(Z.id,{crm_status:Ce.target.value})},style:{width:"100%",fontSize:11,fontWeight:700,padding:"6px 9px",borderRadius:8,border:"1px solid var(--border, #e3e6ee)",background:"var(--input-bg, #fff)",color:"var(--text, #111)",cursor:"pointer",fontFamily:"inherit",transition:"border-color .15s ease"},children:ac.filter(Ce=>Dp(Ce,Z.crm_status,ae==="local")).map(Ce=>e.jsx("option",{value:Ce,children:to(Ce)},Ce))})}),e.jsxs("div",{onClick:Ce=>Ce.stopPropagation(),style:{display:"flex",flexDirection:"column",gap:6,marginTop:1},children:[e.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center",flexWrap:"wrap"},children:[tc(Z.phone)&&e.jsx(yu,{sub:{id:Z.id,name:Z.customer_name,stage:Z.crm_status,country:Z.country},href:`https://wa.me/${ic(Z,qa.cc,qa.nat)}?text=${encodeURIComponent("Hola "+(Z.customer_name||"").split(" ")[0]+", te escribo por tu pedido.")}`,title:"WhatsApp",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"#25D366",color:"#fff",textDecoration:"none",flex:"none"},children:e.jsx(Bo,{s:14})}),tc(Z.phone)&&e.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),De(Z)},title:"Ver el chat y escribirle desde aquÃ",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"var(--notice-success-bg)",color:"var(--success)",border:"1px solid var(--notice-success-border)",cursor:"pointer",flex:"none"},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),!!Z.id&&e.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),Fo(""),Io(Z)}
1166,title:"Etiquetas del pedido: agrúpalo a tu gusto (pestaña Etiquetas)",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"var(--ai-note-bg)",color:"var(--ai-note-muted)",border:"1px solid var(--ai-note-border)",cursor:"pointer",flex:"none"},children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20.59 13.41 11 3.83A2 2 0 0 0 9.59 3H4a1 1 0 0 0-1 1v5.59A2 2 0 0 0 3.59 11l9.58 9.59a2 2 0 0 0 2.83 0l4.59-4.59a2 2 0 0 0 0-2.83z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]})}),(Z.origin==="dropi"||Z.dropi_order_id)&&e.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),de(Z)},title:"Vista rápida de los datos del cliente",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"rgba(8,102,255,.08)",color:me,border:"1px solid "+me+"33",cursor:"pointer",flex:"none"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),!Vt&&!!Z.id&&e.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),qo(Z)},title:"Recordarme este pedido más tarde",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"transparent",color:"#92650a",border:"1px solid rgba(245,158,11,.35)",cursor:"pointer",flex:"none"},children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 2"})]})}),!Vt&&e.jsx("button",{onClick:()=>Lc(Z.id),disabled:Oa===Z.id,title:"Eliminar",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"transparent",color:"var(--danger)",border:"1px solid var(--notice-danger-border)",cursor:"pointer",flex:"none"},children:e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"})})}),!Z.dropi_order_id&&!Z.mastershop_order_id&&!Z.envios99_order_id&&!Z.repetido_de&&e.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),Ys(Z)},title:"Comparar fletes entre Dropi y 99envÃos (solo comparativo, no sube nada)",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"var(--notice-success-bg)",color:"var(--success)",border:"1px solid var(--notice-success-border)",cursor:"pointer",flex:"none"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 3h5v5"}),e.jsx("path",{d:"M8 21H3v-5"}),e.jsx("path",{d:"M21 3l-7 7"}),e.jsx("path",{d:"M3 21l7-7"})]})}),(()=>{const Ce=pi[Z.id];return!Ce||Z.dropi_order_id||Z.mastershop_order_id||Z.envios99_order_id?null:Ce.cobertura===!1?e.jsx("span",{title:`Ninguna transportadora de Dropi cubre ${Z.city||"esa ciudad"}. Revisa la ciudad del pedido o usa otra logÃstica.`,className:"lk-alerta",style:{display:"inline-flex",alignItems:"center",height:28,borderRadius:8,padding:"0 7px",fontSize:10,fontWeight:800,color:"#fff",background:"#dc2626",flex:"none",letterSpacing:".01em"},children:"Sin cobertura"}):Number(Ce.flete)>25e3?e.jsx("span",{title:"El flete más barato que cotizó Dropi para este pedido: revisa que no se coma la ganancia.",className:"lk-alerta",style:{display:"inline-flex",alignItems:"center",height:28,borderRadius:8,padding:"0 7px",fontSize:10,fontWeight:800,color:"#fff",background:"#dc2626",flex:"none",letterSpacing:".01em",fontVariantNumeric:"tabular-nums"}
1166,children:`Flete $${Number(Ce.flete).toLocaleString("es-CO")}`}):Ce.cobertura&&Ce.flete!=null?e.jsx("span",{title:`Sà hay transportadora para ${Z.city||"esa ciudad"}: el flete más barato cotizó $ ${Number(Ce.flete).toLocaleString("es-CO")}.`,style:{display:"inline-flex",alignItems:"center",height:28,borderRadius:8,padding:"0 7px",fontSize:10,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",flex:"none",letterSpacing:".01em"},children:"Cobertura"}):null})()]}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[(()=>{const Ce=bt[String(Z.id)];if(!Ce)return null;const Kt=Ce.pais_nombre||"ese paÃs";return e.jsxs("span",{title:`Este pedido es de ${Kt} y todavÃa no tienes un WhatsApp de ${Kt} conectado, asà que no le escribimos nada. Conéctalo en la pestaña WhatsApp y el mensaje sale solo.`,style:{display:"inline-flex",alignItems:"center",gap:6,height:28,borderRadius:8,padding:"0 12px 0 9px",fontSize:11,fontWeight:800,color:"#fff",background:"#dc2626",border:"1px solid transparent",flex:"none",letterSpacing:".01em"},children:[e.jsx(Bo,{s:12}),"No enviado",Ce.pais_nombre?" · "+Ce.pais_nombre:""]})})(),(()=>{const Ce=xo(Z);if(!Ce||!Ce.dir)return null;const Kt=!!bt[String(Z.id)],pa=Ce.dir==="in"&&Ce.unread>0;if(Kt&&!pa)return null;const _a=Ce.dir==="in"&&Ce.unread>0,an=Ce.dir!=="in"&&Ce.out_status==="failed"?{txt:"Error · no llegó",c:"#fff",bg:"#dc2626",bd:"transparent",ti:"Tu último mensaje NO le llegó"+(Ce.out_error?": "+String(Ce.out_error).slice(0,160):".")+" Ãbrelo con el botón del chat para reintentar."}:_a?{txt:Ce.unread>1?`Nuevo mensaje · ${Ce.unread}`:"Nuevo mensaje",c:"#fff",bg:"#25D366",bd:"transparent",ti:"Te escribió y no lo has leÃdo: ábrelo con el botón del chat."}:Ce.dir==="in"?{txt:Number(Ce.msgs)>0?`Respondió · ${Ce.msgs}`:"Respondió",c:"#128C4B",bg:"rgba(37,211,102,.13)",bd:"rgba(37,211,102,.45)",ti:"Su último mensaje es del cliente (ya lo leÃste)."+(Number(Ce.msgs)>0?` Te ha mandado ${Ce.msgs} mensaje${Number(Ce.msgs)===1?"":"s"} desde tu última respuesta.`:"")}:Ce.out_status==="read"?{txt:"No respondió · Visto",c:"#92650a",bg:"rgba(245,158,11,.13)",bd:"rgba(245,158,11,.4)",ti:"Leyó tu último mensaje y aún no contesta."}:{txt:"No respondió",c:"#92650a",bg:"rgba(245,158,11,.13)",bd:"rgba(245,158,11,.4)",ti:"El último mensaje es tuyo y el cliente aún no contesta."};return e.jsxs("span",{title:an.ti,style:{display:"inline-flex",alignItems:"center",gap:6,height:28,borderRadius:8,padding:"0 12px 0 9px",fontSize:11,fontWeight:800,color:an.c,background:an.bg,border:"1px solid "+an.bd,flex:"none",letterSpacing:".01em"},children:[e.jsx(Bo,{s:12}),an.txt]})})(),d==="repetido"&&e.jsx("button",{onClick:()=>rp(Z.id),title:"Quita la marca de repetido: desde ahà cuenta como pedido, venta y conversión",style:{display:"inline-flex",alignItems:"center",gap:5,height:28,borderRadius:8,padding:"0 9px",background:"var(--notice-success-bg)",color:"var(--success)",border:"1px solid var(--notice-success-border)",cursor:"pointer",flex:"none",fontSize:11,fontWeight:800,fontFamily:"inherit"},children:"Convertir en pedido real"}),(ae==="nuestros"||A||ae==="local"||Ot==="producto")&&!Z.repetido_de&&(Z.origin!=="shopify"||X)&&!["abandonado","lead_wa","pago_pendiente"].includes(Z.crm_status)?e.jsx(al,{s:Z,chico:!0}):null,(()=>{const Ce=Z.landing_slug&&Z.lead_id?`https://lumycol.com/l/${Z.landing_slug}/estado?lead=${encodeURIComponent(String(Z.lead_id))}`:null;return Z.dropi_tracking&&Ce?e.jsxs("a",{href:Ce,target:"_blank",rel:"noreferrer",title:"Ver la guÃa y el estado del envÃo"+(Z.dropi_carrier?" · "+Z.dropi_carrier:""),style:{display:"inline-flex",alignItems:"center",gap:5,height:28,borderRadius:8,padding:"0 9px",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",color:"var(--success)",textDecoration:"none",flex:"none",fontSize:10.5,fontWeight:800},children:[(()=>{const Kt=Kd(Z.dropi_carrier);return Kt?e.jsx("img",{src:Kt,alt:"",style:{height:13,maxWidth:58,objectFit:"contain"}}):e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 17h4V5H2v12h3"}),e.jsx("path",{d:"M20 17h2v-3.34a4 4 0 0 0-1.17-2.83L19 9h-5v8h1"}),e.jsx("circle",{cx:"7.5",cy:"17.5",r:"2.5"}),e.jsx("circle",{cx:"17.5",cy:"17.5",r:"2.5"})]})}
1166)(),Z.dropi_carrier?String(Z.dropi_carrier).slice(0,14):"Ver guÃa"]}):Z.dropi_order_id?e.jsxs("span",{title:"Dropi #"+Z.dropi_order_id,style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",borderRadius:8,padding:"4px 8px"},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:12,height:12,style:{borderRadius:2,objectFit:"contain"}}),"Dropi â"]}):null})()]})]})]},Vt?"d"+(Z.dropi_identity||`${Z.dropi_account_id||0}:${Z.dropi_order_id}`):Z.id)})]})]},d)}),ae==="nuestros"&&!i&&Ot!=="producto"&&!Ze&&hr.length>0&&e.jsxs("div",{"data-col":"eliminado",style:{...be?{flex:"0 0 100%",width:"100%",maxWidth:"100%"}:{flex:"1 1 0",minWidth:308,maxWidth:356},scrollSnapAlign:"start",display:"flex",flexDirection:"column",borderRadius:14,background:"var(--bg-soft, #f4f6fa)",border:"1px dashed var(--border, #d8dce6)"},children:[e.jsxs("div",{style:{padding:"11px 12px 9px",flex:"0 0 auto",borderBottom:"1px solid var(--border, #e8eaf0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#94a3b8",flex:"none"}}),e.jsx("b",{style:{fontSize:11,fontWeight:800,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text, #111)"},children:"Eliminados"}),e.jsx("span",{style:{marginLeft:"auto",flex:"none",fontSize:11,fontWeight:800,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)",background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:999,padding:"1px 8px"},children:ud.numero.toLocaleString("es-CO")})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #94a3b8)",marginTop:4,lineHeight:1.35},children:"Los que eliminaste del tablero. No cuentan en ningún número."}),ud.nota&&e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #94a3b8)",marginTop:3,lineHeight:1.35},children:ud.nota})]}),e.jsx("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:7,overflowY:"auto",minHeight:0},children:hr.map(d=>e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:10,padding:"9px 10px"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"baseline"},children:[e.jsx("b",{style:{fontSize:12.5,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text, #111)"},children:d.customer_name||"Sin nombre"}),Number(d.total_cop)>0&&e.jsxs("span",{style:{marginLeft:"auto",flex:"none",fontSize:12,fontWeight:800,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)"},children:["$",Number(d.total_cop).toLocaleString("es-CO"),e.jsx("span",{style:{fontSize:9,fontWeight:800,letterSpacing:".05em",opacity:.65,marginLeft:3},children:Si(d)})]})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #94a3b8)",marginTop:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[d.landing_name,to(d.crm_status)].filter(Boolean).join(" · ")}),d.eliminado_at&&e.jsxs("div",{style:{fontSize:10.5,color:"var(--text-muted, #94a3b8)",marginTop:2},children:["Eliminado el ",(()=>{try{return new Date(String(d.eliminado_at).replace(" ","T")+(String(d.eliminado_at).endsWith("Z")?"":"Z")).toLocaleString("es-CO",{timeZone:"America/Bogota",day:"numeric",month:"short",hour:"numeric",minute:"2-digit"})}catch{return String(d.eliminado_at)}})()]})]},"eliminado-"+d.id))})]}),ae==="etiquetas"&&!Ze&&e.jsxs("div",{style:{flex:"0 0 auto",width:be?"min(86vw, 340px)":264,scrollSnapAlign:be?"center":"start",display:"flex",flexDirection:"column",gap:9,borderRadius:14,border:"1.5px dashed var(--border, #cbd2e0)",background:"var(--bg-soft, #f7f8fb)",padding:"14px 12px",alignSelf:"flex-start"},children:[e.jsx("b",{style:{fontSize:11,fontWeight:800,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text-secondary, #64748b)"},children:"+ Nueva etiqueta"}),e.jsx("input",{value:qn,onChange:d=>Fo(d.target.value),maxLength:30,placeholder:"Ej: Mayoristas",onKeyDown:async d=>{d.key==="Enter"&&await wr(qn)&&Fo("")},style:{padding:"8px 11px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:12.5,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"}}),Ho,e.jsx("button",{onClick:async()=>{await wr(qn)&&Fo("")},disabled:!qn.trim(),style:{background:me,color:"#fff",border:0,borderRadius:9,padding:"8px 12px",fontSize:12,fontWeight:800,cursor:qn.trim()?"pointer":"default",opacity:qn.trim()?1:.5,fontFamily:"inherit"},children:"Crear columna"}),e.jsx("span",{style:{fontSize:10.5,color:"var(--text-secondary, #94a3b8)",lineHeight:1.45},children:"La etiqueta también te sirve en WhatsApp: filtra esos chats y mándales un mensaje o plantilla a todos desde Masivos."})]})]}),ae==="shopify"&&!Ze&&X&&e.jsx("div",{style:{...Jt,marginTop:14,padding:"15px 16px 13px"},children:e.jsx(kA,{})}),ae==="cancelados"&&!Ze&&Ot!=="producto"&&(()=>{const d=zt.filter(J=>J.crm_status==="cancelado"&&!J.repetido_de),A=wi($r(d,()=>!0)),T=new Map;for(const J of d){const le=String(J.cancel_reason||"").trim()||"Sin motivo registrado",Ve=T.get(le)||[];Ve.push(J),T.set(le,Ve)}const O=[...T.entries()].sort((J,le)=>le[1].length-J[1].length),W=O.length?O[0][1].length:1;return e.jsxs("div",{style:{...Jt,marginTop:14,padding:"15px 16px 13px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:9,flexWrap:"wrap",marginBottom:
1166d.length?12:0},children:[e.jsx("b",{style:{fontSize:14,fontWeight:800,color:"var(--text, #111)"},children:"¿Por qué te cancelan?"}),d.length>0&&e.jsxs("span",{style:{fontSize:12,fontWeight:700,color:"var(--danger)",fontVariantNumeric:"tabular-nums"},children:[d.length.toLocaleString("es-CO")," cancelado",d.length===1?"":"s"," en el rango",ki($r(d,()=>!0))?` · ${A} que no entraron`:""]}),d.length===0&&e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"Ningún pedido cancelado en el rango que estás viendo. Cuando canceles uno, aquà verás el motivo y lo que suma cada causa."})]}),d.length>0&&e.jsx("div",{style:{display:"grid",gap:7,marginBottom:12},children:O.map(([J,le])=>{const Ve=J==="Sin motivo registrado",gt=Math.round(le.length*100/d.length),Qe=wi($r(le,()=>!0));return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[e.jsx("span",{style:{flex:"0 0 max(150px, 26%)",fontSize:12,fontWeight:700,color:Ve?"var(--text-muted, #94a3b8)":"var(--text, #26314a)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:J}),e.jsx("span",{style:{flex:1,minWidth:40,height:9,borderRadius:99,background:"var(--bg-soft, #f0f2f7)",overflow:"hidden"},children:e.jsx("span",{style:{display:"block",height:"100%",borderRadius:99,width:`${Math.max(6,Math.round(le.length*100/W))}%`,background:Ve?"#cbd2e0":"linear-gradient(90deg, #f87171, #dc2626)"}})}),e.jsxs("span",{style:{flex:"none",fontSize:12,fontWeight:800,fontVariantNumeric:"tabular-nums",color:Ve?"var(--text-muted)":"var(--danger)"},children:[le.length," · ",gt,"%"]}),ki($r(le,()=>!0))&&e.jsx("span",{style:{flex:"none",fontSize:11.5,fontWeight:700,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)"},children:Qe})]},J)})}),d.length>0&&e.jsxs("div",{style:{borderTop:"1px solid var(--border, #eef0f5)",paddingTop:9},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,letterSpacing:".05em",textTransform:"uppercase",color:"var(--text-muted, #94a3b8)",marginBottom:6},children:"Cancelado por cancelado"}),e.jsx("div",{style:{display:"grid",gap:4,maxHeight:380,overflowY:"auto"},children:d.map(J=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,minWidth:0},children:[e.jsx("b",{style:{fontWeight:700,color:"var(--text, #26314a)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"34%"},children:J.customer_name||"(sin nombre)"}),Number(J.total_cop)>0&&e.jsxs("span",{style:{flex:"none",fontWeight:800,fontVariantNumeric:"tabular-nums",color:"var(--text-secondary, #64748b)"},children:["$",Number(J.total_cop).toLocaleString("es-CO")]}),e.jsx("span",{style:{color:String(J.cancel_reason||"").trim()?"var(--danger)":"var(--text-muted, #94a3b8)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:String(J.cancel_reason||"").trim()||"sin motivo"}),!!J.id&&!["dropi","envios99","mastershop"].includes(String(J.origin))&&e.jsx("button",{onClick:()=>Lt(J.id),title:"Ver el detalle",style:{marginLeft:"auto",flex:"none",border:0,background:"transparent",color:me,fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"ver"})]},J.id||J.dropi_order_id))}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:6},children:"Estos mismos pedidos siguen en la columna Cancelado del tablero. Usa la fecha de arriba para cambiar el rango."})]})]})})()]}):wa?e.jsxs("div",{style:{...Jt,textAlign:"center",padding:"44px 20px"},children:[e.jsx("div",{style:{fontWeight:800,fontSize:15.5,color:"var(--text, #111)"},children:"No pudimos cargar tus pedidos"}),e.jsx("p",{style:{color:"var(--text-muted, #777)",fontSize:13,margin:"6px auto 0",maxWidth:420},children:"Tus pedidos están a salvo: fue un problema al traerlos, no que no existan. Vuelve a intentar en un momento."}),e.jsx("button",{style:{...ee,marginTop:14},onClick:()=>Ca(),children:"Reintentar"})]}):zt.length===0?e.jsxs("div",{style:{...Jt,textAlign:"center",padding:"44px 20px"},children:[e.jsx("div",{style:{marginBottom:12,display:"flex",justifyContent:"center",color:"var(--text-muted, #c2c7d4)"},children:e.jsxs("svg",{width:"44",height:"44",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),e.jsx("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]})}),e.jsx("div",{style:{fontWeight:800,fontSize:15.5,color:"var(--text, #111)"},children:Vo?e.jsxs(e.Fragment,{children:['Sin resultados para "',kt,'"']}):Gt?e.jsxs(e.Fragment,{children:['Sin pedidos en "',e.jsx("span",{style:{color:Bl[Gt]||"inherit"},children:to(Gt)}),'"']}):"Aún no hay pedidos"}),e.jsx("p",{style:{color:"var(--text-muted, #777)",fontSize:13,margin:"6px auto 0",maxWidth:400},children:Gt?"Cuando muevas un pedido a esta etapa, lo verás aquÃ.":"Cuando alguien complete tu formulario, su pedido aparece aquà listo para gestionar."}),Gt&&e.jsx("button",{style:{...ee,marginTop:14},onClick:()=>he(""),children:"Ver todos"})]}):e.jsx("div",{style:{display:"grid",gap:10},children:zt.map((d,A)=>{var va;const T=Bl[d.crm_status]||"#64748b",O=d.origin==="dropi"||d.origin==="envios99"||d.origin==="mastershop",W=!O&&Me===d.id,J=is(d.created_at),le=Hy(d.products),Ve=d.crm_status==="lead_w
1166a",gt=!!d.stalled,Qe=d.status==="failed",Z=!!d.paid_at,Rt=Z&&!!(d.fields&&d.fields._ship_prepay),Yt=Number((va=d.fields)==null?void 0:va._recaudo_cop)||0,Ht=!Z&&(d.payment_attempt_failed||d.crm_status==="pago_fallido"||d.status==="failed"&&/cobro en l[iÃ]nea|pago en l[iÃ]nea|monto es muy bajo|createcharge|pasarela/i.test(String(d.error||""))),nt=d.crm_status==="pago_pendiente",Bt=d.crm_status==="entregado",ca=Z?"lk-paid":Bt?"lk-done":"",Vt=Z||Bt;return e.jsxs("div",{className:`lk-row${ca?" "+ca:""}`,style:{...Jt,padding:"14px 16px",position:"relative",...ca?{border:"1px solid transparent"}:QC(T),animationDelay:`${A*40}ms`},children:[Vt&&e.jsxs("span",{"aria-hidden":"true",children:[e.jsx("i",{className:"lk-spk lk-spk1"}),e.jsx("i",{className:"lk-spk lk-spk2"}),e.jsx("i",{className:"lk-spk lk-spk3"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:10,flexWrap:"wrap",position:"relative",zIndex:1},children:[e.jsxs("div",{style:{display:"flex",gap:11,alignItems:"center",flex:"1 1 200px",minWidth:0},children:[!O&&e.jsx("input",{type:"checkbox",checked:He.has(d.id),onChange:()=>dl(d.id),style:{width:18,height:18,flex:"none",accentColor:me,cursor:"pointer"}}),e.jsx("div",{style:{width:38,height:38,borderRadius:11,background:(Z?"#c8901a":T)+"1c",color:Z?"#a9750f":T,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,fontSize:16,flexShrink:0},children:(d.customer_name||"?").trim().charAt(0).toUpperCase()||"?"}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontWeight:800,fontSize:15,color:"var(--text, #111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.customer_name||"(sin nombre)"}),e.jsxs("div",{style:{fontSize:12.5,fontWeight:600,color:"var(--text-secondary, #475569)",marginTop:2,display:"flex",gap:10,flexWrap:"wrap"},children:[d.phone?e.jsxs(Np,{phone:d.phone,cc:(rn[String(d.country||"").toUpperCase()]||{phoneCc:qa.cc}).phoneCc,natLen:(rn[String(d.country||"").toUpperCase()]||{natLen:qa.nat}).natLen,style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(wu,{})," ",d.phone]}):e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(wu,{})," â"]}),!Ve&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(Hl,{})," ",d.city||"â",d.department?`, ${d.department}`:""]}),(le.qty>1||le.extra>0)&&e.jsxs("span",{children:[le.qty," ",le.qty===1?"unidad":"unidades",le.extra>0?` · +${le.extra}`:""]}),J.txt&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,...gt?{color:"var(--warning)",fontWeight:700}:null},children:[e.jsx(Ls,{})," ",J.txt,gt?" · sin confirmar":""]}),Wl(d)&&e.jsxs("span",{title:`La dirección del comprador es "${String(d.address||"").trim()}". RevÃsala antes de despachar: el mensajero puede no encontrarla y el pedido se devuelve. No tiene que ver con el teléfono.`,style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--warning)",fontWeight:700,background:"var(--notice-warning-bg)",borderRadius:999,padding:"1px 9px"},children:[e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"})}),Wl(d)]}),d.buyer_risk_pct!=null&&d.buyer_risk_pct>=40&&e.jsxs("span",{title:d.buyer_risk_flag||"Este comprador ha devuelto el "+d.buyer_risk_pct+"% de sus pedidos anteriores. Revisa antes de despachar.",style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--danger)",fontWeight:700,background:"var(--notice-danger-bg)",borderRadius:999,padding:"1px 9px"},children:["Riesgo ",d.buyer_risk_pct,"%"]})]}),d.dropi_status&&e.jsx("div",{style:{marginTop:6},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:800,color:ql(d.dropi_status),background:`${ql(d.dropi_status)}2b`,borderRadius:999,padding:"3px 10px"},children:[(()=>{const qt=Kd(d.dropi_carrier);return qt?e.jsx("img",{src:qt,alt:"",style:{height:12,maxWidth:56,objectFit:"contain"}}):e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 17h4V5H2v12h3"}),e.jsx("path",{d:"M20 17h2v-3.34a4 4 0 0 0-1.17-2.83L19 9h-5v8h1"}),e.jsx("circle",{cx:"7.5",cy:"17.5",r:"2.5"}),e.jsx("circle",{cx:"17.5",cy:"17.5",r:"2.5"})]})})(),d.dropi_carrier?`${d.dropi_carrier} · `:"",Hp(d.dropi_status)]})}),!t&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary, #475569)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.tienda_general?"Escribió desde tu tienda, sin elegir producto":d.landing_name})]})]}),e.jsxs("div",{style:{textAlign:"right",flexShrink:0,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:5},children:[Ve?e.jsx("span",{style:{fontSize:11,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",borderRadius:999,padding:"3px 11px"},children:"Lead WhatsApp"}):e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:800,fontSize:17,color:me,lineHeight:1.2,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums"}
1166,children:["$",Number(d.total_cop).toLocaleString("es-CO")]}),e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted, #999)",letterSpacing:.5},children:d.currency||"COP"})]}),d.origin==="shopify"?e.jsxs("span",{title:"Pedido importado automáticamente desde Shopify.",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:800,color:"#4f7d32",background:"rgba(149,191,71,.18)",borderRadius:999,padding:"2px 9px"},children:[e.jsx(y1,{size:12}),"Shopify"]}):d.origin!=="dropi"&&!!d.dropi_order_id||d.origin==="dropi"&&d.from_lumy?e.jsxs("span",{title:"Pedido que salió de Lumy y ya está en Dropi.",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:800,color:me,background:me+"14",borderRadius:999,padding:"2px 9px"},children:[e.jsx("img",{src:"/logos/iconoF.png",alt:"",width:12,height:12,style:{borderRadius:2,objectFit:"contain"}}),"Lumy"]}):d.origin==="dropi"?e.jsxs("span",{title:"Pedido creado directo en Dropi, no por Lumy.",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:800,color:"#6d28d9",background:"rgba(124,58,237,.16)",borderRadius:999,padding:"2px 9px"},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:12,height:12,style:{borderRadius:2,objectFit:"contain"}}),"Directo en Dropi"]}):null,d.de_tienda&&e.jsx(Rp,{s:10,general:!!d.tienda_general,style:{padding:"2px 9px"}}),e.jsx(Lu,{source:d.source,s:10.5}),!Ve&&!nt&&(Z?Rt?e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"#a9750f",background:"rgba(200,144,26,.16)",borderRadius:999,padding:"2px 9px"},title:"El cliente pagó el ENVÃO en lÃnea. La guÃa va CON RECAUDO: cóbrale el producto"+(Yt>0?" ($"+Yt.toLocaleString("es-CO")+")":"")+" al entregar.",children:"EnvÃo pagado · recauda producto"}):e.jsxs("span",{className:"lk-gold-badge",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:800,borderRadius:999,padding:"2px 10px"},children:[e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",style:{position:"relative",zIndex:1},children:e.jsx("path",{d:"M12 2l1.7 6.1L20 10l-6.3 1.9L12 18l-1.7-6.1L4 10l6.3-1.9z"})}),e.jsx("span",{style:{position:"relative",zIndex:1},children:"Pagado · sin recaudo"})]}):e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary)",background:"var(--bg-tertiary)",borderRadius:999,padding:"2px 9px"},children:"Con recaudo"})),Ht&&e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"#be123c",background:"rgba(225,29,72,.1)",borderRadius:999,padding:"2px 9px"},title:"El cliente intentó pagar en lÃnea y falló; sigue siendo contraentrega.",children:"Intentó pagar"}),Qe&&!Ht&&e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"var(--danger)",background:"var(--notice-danger-bg)",borderRadius:999,padding:"2px 9px"},children:Ap(d.error)?"Sin subir":"Dropi falló"})]})]}),e.jsx(Oy,{s:d,fetch:s,onSaved:(qt,io)=>m(Uo=>Uo.map(Se=>Se.id===qt?{...Se,...io}:Se))}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",marginTop:12},children:[e.jsx("div",{style:{position:"relative",display:"inline-flex"},children:O?e.jsx("span",{title:`Lo mueve ${oo} solo`,style:{background:T+"16",color:T,border:`1.5px solid ${T}45`,borderRadius:999,padding:"7px 14px",fontSize:12.5,fontWeight:800,textTransform:"capitalize"},children:to(d.crm_status)}):e.jsxs(e.Fragment,{children:[e.jsx("select",{value:d.crm_status,onChange:qt=>{qt.target.value==="cancelado"?ia([d.id]):zo(d.id,{crm_status:qt.target.value})},style:{appearance:"none",WebkitAppearance:"none",background:T+"16",color:T,border:`1.5px solid ${T}45`,borderRadius:999,padding:"7px 27px 7px 14px",fontSize:12.5,fontWeight:800,cursor:"pointer",textTransform:"capitalize"},children:ac.filter(qt=>Dp(qt,d.crm_status,ae==="local")).map(qt=>e.jsx("option",{value:qt,children:to(qt)},qt))}),e.jsx("span",{style:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",fontSize:9,color:T},children:"â¼"})]})}),e.jsxs("div",{style:{display:"inline-flex",gap:8,alignItems:"center"},children:[tc(d.phone)&&e.jsxs(yu,{sub:{id:d.id,name:d.customer_name,stage:d.crm_status,country:d.country},href:`https://wa.me/${ic(d,qa.cc,qa.nat)}?text=${encodeURIComponent("Hola "+(d.customer_name||"").split(" ")[0]+", te escribo por tu pedido.")}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"#25D366",color:"#fff",borderRadius:999,padding:"7px 13px",fontSize:12.5,fontWeight:800,textDecoration:"none"},children:[e.jsx(Bo,{s:14})," WhatsApp"]}),!O&&e.jsx("button",{style:{...ee,padding:"7px 13px",fontSize:12.5},onClick:()=>yt(W?null:d.id),children:W?"Cerrar â´":"Detalle â¾"})]})]}),W&&e.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:"1px dashed var(--border, #e5e7eb)"},children:[e.jsxs("div",{style:{fontSize:13,color:"var(--text, #111)",background:"var(--input-bg, #fafbff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"8px 11px",marginBottom:10},children:[e.jsx("b",{children:"Dirección:"})," ",(()=>{const qt=Pu(d);return qt.texto?qt.texto:"â"})()]}),d.fields&&zy(d.fields).length>0&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))",gap:6,marginBottom:10},children:zy(d.fields).map(([qt,io])=>e.jsxs("div",{style:{background:"var(--input-bg,#f7f8fc)",border:"1px solid var(--border, #e5e7eb)",borderRadius:10,padding:"7px 10px",minWidth:0},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted, #999)",textTransform:"uppercase",letterSpacing:.4,marginBottom:2},children:DC(qt)}),e.jsx("div",{style:{fontSize:12.5,fontWeight:600,color:"var(--text, #111)",wordBreak:"break-word"},children:String(io)})]},qt))}),(()=>{const qt=jp(d);return qt?e.jsxs("div",{style:{marginBottom:10,background:"rgba(220,38,38,.07)",border:"1px solid rgba(220,38,38,.25)",borderRadius:10,padding:"9px 11px"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,color:"var(--danger)",textTransform:"uppercase",letterSpacing:".04em"},children:qt.titulo}),e.jsx("div",{style:{fontSize:12.5,color:"var(--danger)",lineHeight:1.45,marginTop:2},children:qt.tipo==="pago"?By(d.error):String(d.error).slice(0,320)}),qt.tipo==="pago"&&e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #8a90a2)",lineHeight:1.4,marginTop:3,wordBreak:"break-word"},children:String(d.error).slice(0,240)})]}):null})(),e.jsx("label",{style:D,children:"Notas internas"}),e.jsx("textarea",{style:{...E,minHeight:60,resize:"vertical"},defaultValue:d.notes||"",onBlur:qt=>{qt.target.value!==(d.notes||"")&&zo(d.id,{notes:qt.target.value})},placeholder:"Llamé, confirma mañanaâ¦"}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10,fontSize:12,color:"var(--text-muted, #777)",alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx(Ls,{})," ",A1(d.created_at)]}),d.dropi_order_id&&e.jsxs("span",{style:{background:"var(--notice-success-bg)",color:"var(--success)",fontWeight:700,borderRadius:999,padding:"3px 10px",fontSize:11.5},children:["Dropi #",d.dropi_order_id]}),ts(d.mastershop_order_id)&&e.jsxs("span",{style:{background:"rgba(13,148,136,.12)",color:"#0d9488",fontWeight:700,borderRadius:999,padding:"3px 10px",fontSize:11.5},children:["Mastershop #",d.mastershop_order_id]}),d.status==="failed"&&e.jsx("span",{style:{background:"var(--notice-danger-bg)",color:"var(--danger)",fontWeight:700,borderRadius:999,padding:"3px 10px",fontSize:11.5},children:Ht?"Pago falló":Ap(d.error)?"Sin subir":"Dropi falló"}),(()=>{const qt=jp(d);return qt&&e.jsx("span",{style:{color:"var(--danger)",fontSize:11.5,fontWeight:600},title:String(d.error),children:qt.tipo==="pago"?By(d.error):`Motivo: ${String(d.error).slice(0,110)}`})})(),ts(d.envios99_order_id)&&e.jsx("span",{style:{background:"rgba(234,88,12,.12)",color:"#ea580c",fontWeight:700,borderRadius:999,padding:"3px 10px",fontSize:11.5},children:String(d.envios99_order_id).startsWith("SOL-")?"Solicitud 99envÃos (editable allá)":`99envÃos #${d.envios99_order_id}`}),Xi(d)&&e.jsxs("button",{type:"button",onClick:()=>tl(d),style:{background:"rgba(217,119,6,.14)",color:"#b45309",fontWeight:800,borderRadius:999,padding:"3px 10px",fontSize:11.5,border:"none",cursor:"pointer",fontFamily:"inherit"},children:[Or(d),": por revisar"]}),!i&&!Ve&&!nt&&d.crm_status!=="abandonado"?e.jsx(al,{s:d}):null,tc(d.phone)&&e.jsxs(yu,{sub:{id:d.id,name:d.customer_name,stage:d.crm_status,country:d.country},href:`https://wa.me/${ic(d,qa.cc,qa.nat)}?text=${encodeURIComponent("Hola "+(d.customer_name||"").split(" ")[0]+", te escribo por tu pedido.")}`,style:{marginLeft:"auto",background:"var(--notice-success-bg)",color:"var(--success)",fontWeight:800,borderRadius:999,padding:"6px 13px",fontSize:12.5,textDecoration:"none",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(Bo,{})," WhatsApp"]})]})]})]},O?"d"+(d.dropi_identity||`${d.dropi_account_id||0}:${d.dropi_order_id}`):d.id)})}),Go&&Wo.createPortal(e.jsx("div",{onClick:()=>!Hr&&tl(null),style:{position:"fixed",inset:0,background:"rgba(15,23,42,.45)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card, #fff)",borderRadius:16,maxWidth:460,width:"100%",padding:22,boxShadow:"0 20px 60px rgba(0,0,0,.25)"},children:[e.jsxs("div",{style:{fontWeight:800,fontSize:16,marginBottom:8},children:["Este pedido quedó por revisar en ",Or(Go)]}),e.jsxs("p",{style:{fontSize:13.5,lineHeight:1.5,color:"var(--muted, #667)",margin:"0 0 14px"},children:["No sabemos si la guÃa quedó creada allá, asà que Lumy frenó los reintentos para que no te salgan dos guÃas y te cobren dos fletes. Abre tu panel de"," ",Or(Go)," y mira si el pedido está."]}),!!(Go.error||Go.envios99_operation_error)&&e.jsx("p",{style:{fontSize:12.5,lineHeight:1.45,color:"var(--muted, #889)",margin:"0 0 14px",padding:"9px 11px",background:"var(--notice-bg, #f6f7f9)",borderRadius:9},children:String(Go.envios99_operation_error||Go.error).slice(0,220)}),e.jsxs("button",{type:"button",disabled:Hr,onClick:()=>Rc(Go,"buscar"),style:{width:"100%",padding:"11px 14px",borderRadius:10,border:"none",background:me,color:"#fff",fontWeight:800,fontSize:13.5,cursor:Hr?"default":"pointer",fontFamily:"inherit",marginBottom:9},children:["Buscarlo en ",Or(Go)]}),e.jsx("button",{type:"button",disabled:Hr,onClick:()=>{confirm(`¿Confirmas que miraste tu panel de ${Or(Go)} y este pedido NO está allá, o solo aparece cancelado? Si está vivo, se crearÃa una segunda guÃa.`)&&Rc(Go,"liberar")},style:{width:"100%",padding:"11px 14px",borderRadius:10,border:"1px solid var(--border, #e5e7eb)",background:"transparent",color:"var(--text, #111)",fontWeight:700,fontSize:13.5,cursor:Hr?"default":"pointer",fontFamily:"inherit"},children:"No quedó creado: desbloquear el pedido"})]})}),document.body),!!ks&&!(He.size>0)&&e.jsx("div",{style:{position:"fixed",left:"50%",bottom:24,transform:"translateX(-50%)",zIndex:130,background:"#15803d",color:"#fff",borderRadius:999,padding:"10px 18px",fontSize:13,fontWeight:800,boxShadow:"0 12px 30px -10px rgba(21,128,61,.6)",maxWidth:"min(92vw, 520px)",textAlign:"center"},children:ks}),Ln&&e.jsx("div",{onClick:()=>ho(!1),style:{position:"fixed",inset:0,zIndex:121,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 15px",width:"min(430px, 100%)",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,marginBottom:10}
1166,children:[e.jsx("span",{style:{flex:"none",width:42,height:42,borderRadius:13,background:"linear-gradient(135deg, #2dd4bf, #0d9488)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 14px -6px rgba(13,148,136,.55)"},children:e.jsxs("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("b",{style:{display:"block",fontSize:14.5,letterSpacing:"-.01em"},children:"¿De qué ciudades quieres apartar tus pedidos?"}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-secondary, #64748b)",fontWeight:600,marginTop:1},children:"Para cuando entregas con transportadora propia."})]}),e.jsx("button",{type:"button",onClick:()=>ho(!1),title:"Cerrar",style:Je,children:"â"})]}),e.jsx("input",{value:tr,onChange:d=>fo(d.target.value),placeholder:"Buscar en tus ciudadesâ¦",style:{width:"100%",boxSizing:"border-box",padding:"8px 11px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:12.5,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)",marginBottom:8}}),e.jsx("div",{style:{maxHeight:240,overflowY:"auto",border:"1px solid var(--border, #eef0f5)",borderRadius:11,marginBottom:10},children:(()=>{const d=ja(tr),A=Dr.filter(T=>!d||ja(T.city).includes(d)||ja(T.dept).includes(d)).sort((T,O)=>Number(pn.some(W=>ja(W)===ja(O.city)))-Number(pn.some(W=>ja(W)===ja(T.city))));return Dr.length?A.length?A.slice(0,400).map((T,O)=>{const W=pn.some(J=>ja(J)===ja(T.city));return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderTop:O?"1px solid var(--border, #f3f4f8)":"none",cursor:"pointer",background:W?"rgba(13,148,136,.07)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:W,onChange:()=>$o(W?pn.filter(J=>ja(J)!==ja(T.city)):[...pn,T.city]),style:{width:16,height:16,accentColor:"#0d9488",flex:"none",cursor:"pointer"}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:13,fontWeight:W?800:600,color:W?"#0d9488":"var(--text, #26314a)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.city}),T.dept&&e.jsx("span",{style:{flex:"none",fontSize:10.5,color:"var(--text-muted, #9aa0b0)",fontWeight:600,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:T.dept}),T.n>0&&e.jsx("span",{style:{flex:"none",fontSize:10.5,fontVariantNumeric:"tabular-nums",color:"#0d9488",background:"rgba(13,148,136,.1)",borderRadius:999,padding:"1px 7px",fontWeight:800},children:T.n})]},T.city+"|"+(T.dept||""))}):e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:"var(--text-muted)"},children:"Ninguna ciudad del catálogo coincide con la búsqueda."}):e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:"var(--text-muted)",lineHeight:1.5},children:"Cargando el catálogo de ciudadesâ¦"})})()}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",margin:0,lineHeight:1.55},children:"Los pedidos de las ciudades marcadas llegan a la pestaña Local y NO se suben a tu logÃstica (ni la subida automática ni la confirmación por WhatsApp los tocan). Si quieres mandar alguno igual, su botón de envÃo te pregunta antes."}),_o&&e.jsxs("div",{style:{marginTop:12,borderTop:"1px solid var(--border, #eef0f5)",paddingTop:10},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,letterSpacing:".05em",textTransform:"uppercase",color:"var(--text-muted, #94a3b8)",marginBottom:6},children:"Conexión con tu sistema de entregas"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("code",{style:{flex:1,minWidth:0,fontSize:10.5,background:"var(--bg-soft, #f4f6fa)",border:"1px solid var(--border, #e8eaf0)",borderRadius:8,padding:"7px 9px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-secondary, #475569)"},children:`${window.location.origin}/api/landing/local-feed?key=${_o}`}),e.jsx("button",{onClick:()=>{try{navigator.clipboard.writeText(`${window.location.origin}/api/landing/local-feed?key=${_o}`)}catch{}},style:{flex:"none",border:"1px solid rgba(13,148,136,.35)",background:"rgba(13,148,136,.08)",color:"#0d9488",borderRadius:8,padding:"6px 11px",fontSize:11,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Copiar"})]}),e.jsx("p",{style:{fontSize:10.5,color:"var(--text-muted, #9aa0b0)",margin:"6px 0 0",lineHeight:1.5},children:"Tu aplicativo abre ese enlace y recibe los pedidos apartados (agrega &format=csv para archivo, y &nuevos=1 para llevarte SOLO los que no te has llevado â quedan marcados como exportados). Para marcarlos como enviados: POST a /api/landing/local-feed/estado con la llave, los ids y el estado (despachado, en_transito o entregado). Trata la llave como una contraseña."})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{onClick:()=>ho(!1),style:{background:me,color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Listo"})})]})}),Vn&&e.jsx("div",{onClick:()=>ar(null),style:{position:"fixed",inset:0,zIndex:122,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 14px",width:"min(400px, 100%)",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsx("b",{style:{fontSize:14.5,display:"block",marginBottom:6},children:"Este pedido es de tu zona de entrega propia"}),e.jsxs("p",{style:{fontSize:12.5,color:"var(--text-secondary, #64748b)",margin:"0 0 12px",lineHeight:1.55},children:["Apartaste ",e.jsx("b",{style:{color:"var(--text, #111)"},children:Vn.s.city||"esta ciudad"})," para entregar con tu propia transportadora. ¿Lo mandas igual a ",Vn.nombre,"? Deja de aparecer en Local y sigue el flujo de ",Vn.nombre,"."]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>ar(null),style:{...ee,padding:"8px 14px",fontSize:12.5},children:"Volver"}),e.jsx("button",{onClick:()=>{const d=Vn;ar(null),d==null||d.continuar()},style:{background:"#b45309",color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Enviar de todas formas"})]})]})}),Br&&e.jsx("div",{onClick:()=>qo(null),style:{position:"fixed",inset:0,zIndex:121,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px",width:"min(360px, 100%)",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:6},children:[e.jsx("span",{style:{display:"inline-flex",width:30,height:30,borderRadius:99,background:"rgba(245,158,11,.18)",alignItems:"center",justifyContent:"center",flex:"none",fontSize:15},children:"â°"}),e.jsxs("b",{style:{flex:1,fontSize:14,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["¿Cuándo te recuerdo a ",String(Br.customer_name||"este pedido").split(" ")[0],"?"]}),e.jsx("button",{type:"button",onClick:()=>qo(null),title:"Cerrar",style:Je,children:"â"})]}),e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",margin:"0 0 12px",lineHeight:1.5},children:"Mientras tanto, la tarjeta baja al fondo de su columna (en orden Urgencia). Cuando llegue la hora, sube de primera con su alarma roja."}),e.jsxs("div",{style:{display:"grid",gap:7},children:[Hs().map(d=>e.jsx("button",{onClick:()=>{di(Br.id,{posponer_hasta:d.utc}),qo(null)},style:{textAlign:"left",border:"1px solid var(--border, #e3e6ee)",background:"var(--card-bg, #fff)",borderRadius:11,padding:"10px 13px",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"inherit",color:"var(--text, #111)"},children:d.l},d.l)),Br.crm_snooze_until&&e.jsx("button",{onClick:()=>{di(Br.id,{posponer_hasta:null}),qo(null)},style:{textAlign:"left",border:"1px solid var(--notice-danger-border)",background:"var(--notice-danger-bg)",borderRadius:11,padding:"10px 13px",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"inherit",color:"var(--danger)"}
1166,children:"Quitar el recordatorio"})]})]})}),Wa&&e.jsx("div",{onClick:()=>{Qa||Pn(null)},style:{position:"fixed",inset:0,zIndex:121,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 15px",width:"min(430px, 100%)",maxHeight:"86vh",overflowY:"auto",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,marginBottom:4},children:[e.jsx("span",{style:{display:"inline-flex",width:30,height:30,borderRadius:99,background:"#25D366",color:"#fff",alignItems:"center",justifyContent:"center",flex:"none"},children:e.jsx(Bo,{s:16})}),e.jsxs("b",{style:{flex:1,fontSize:14.5,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Mensaje a «",String(((Nd=Wa.etq)==null?void 0:Nd.nombre)||"la columna"),"»"]}),e.jsx("button",{type:"button",onClick:()=>Pn(null),title:"Cerrar",style:Je,children:"â"})]}),e.jsxs("p",{style:{fontSize:12,color:"var(--text-secondary, #64748b)",margin:"0 0 10px",lineHeight:1.5},children:["Va SOLO a ",Wa.tels.length===1?"la persona":`las ${Wa.tels.length} personas`," ",((Ld=Wa.etq)==null?void 0:Ld.deTexto)||"de esta columna",", nadie más."]}),!Ar&&!!Wa.alerta&&Wr.length>0&&(()=>{const d=Wa.tels.filter(A=>!Wr.includes(us(A))).length;return e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("div",{style:{display:"inline-flex",background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:10,padding:3,gap:2},children:[["nuevos",`Solo a los nuevos (${d})`],["todos",`A todos (${Wa.tels.length})`]].map(([A,T])=>e.jsx("button",{onClick:()=>qr(A),style:{border:0,borderRadius:8,padding:"6px 12px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit",background:ci===A?"var(--card-bg, #fff)":"transparent",color:ci===A?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:ci===A?"0 1px 3px rgba(16,24,40,.10)":"none"},children:T},A))}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:5,lineHeight:1.45},children:["A ",Wr.length===1?"1 persona ya le escribiste":`${Wr.length} personas ya les escribiste`," por esta alerta en el último mes: «solo a los nuevos» los salta para no gastar tu cupo de plantillas ni cansar el número."]})]})})(),$n&&!Ar&&e.jsxs("div",{style:{display:"flex",gap:7,flexWrap:"wrap",marginBottom:10},children:[Number($n.enVentana)>0&&e.jsxs("span",{style:{fontSize:11.5,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",borderRadius:999,padding:"4px 11px"},children:[$n.enVentana," ",Number($n.enVentana)===1?"recibe":"reciben"," cualquier mensaje ya mismo"]}),Number($n.fueraDeVentana)>0&&e.jsxs("span",{style:{fontSize:11.5,fontWeight:800,color:"#92650a",background:"rgba(245,158,11,.14)",borderRadius:999,padding:"4px 11px"},children:[$n.fueraDeVentana," solo con plantilla aprobada (más de 24 h sin escribirte)"]})]}),($n==null?void 0:$n.avisoCupo)&&e.jsx("div",{role:"status",style:{fontSize:12,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:10,padding:"8px 11px",marginBottom:10,lineHeight:1.5},children:$n.avisoCupo}),Ar?e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"status",style:{fontSize:13,fontWeight:700,color:"var(--success)",background:"var(--notice-success-bg)",borderRadius:10,padding:"10px 12px",lineHeight:1.5},children:Ar}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:12},children:e.jsx("button",{onClick:()=>Pn(null),style:{background:me,color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Listo"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"inline-flex",background:"var(--bg-soft, #f3f5f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:10,padding:3,gap:2,marginBottom:10},children:[["plantilla","Plantilla aprobada"],["texto","Mensaje normal"]].map(([d,A])=>e.jsx("button",{onClick:()=>Hi(d),style:{border:0,borderRadius:8,padding:"6px 12px",fontSize:12,fontWeight:800,cursor:"pointer",fontFamily:"inherit",background:no===d?"var(--card-bg, #fff)":"transparent",color:no===d?"var(--text, #111)":"var(--text-secondary, #8a90a2)",boxShadow:no===d?"0 1px 3px rgba(16,24,40,.10)":"none"},children:A},d))}),no==="plantilla"&&ms.length>1&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",marginBottom:8,lineHeight:1.5},children:["Aquà hay pedidos de ",ms.map(d=>{var A;return((A=rn[d])==null?void 0:A.name)||d}).join(", "),". A cada quien le escribe el WhatsApp de su paÃs, asà que esta plantilla tiene que estar creada en todos ellos; al que le falte, ese mensaje no sale y te decimos cuál es."]}),no==="plantilla"?Gi.length?e.jsx("select",{value:Un,onChange:d=>Pt(d.target.value),style:{width:"100%",boxSizing:"border-box",padding:"9px 11px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:13,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)",marginBottom:10},children:Gi.map(d=>e.jsx("option",{value:d.name,children:d.name},d.name+String(d.language||"")))}):e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginBottom:10,lineHeight:1.5},children:"Aún no tienes plantillas aprobadas. Créalas en WhatsApp â Crear plantillas y aquà aparecen."}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:yo,onChange:d=>lr(d.target.value),rows:3,maxLength:900,placeholder:"Hola {nombre}, te cuento queâ¦",style:{width:"100%",boxSizing:"border-box",padding:"9px 11px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:13,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)",resize:"vertical",marginBottom:4}}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:Wa.subPorTel?6:10},children:["{nombre}"," se cambia por el nombre de cada persona. Solo llega a quien te escribió en las últimas 24 h."]}),Wa.subPorTel&&e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:8},children:["Y estos se llenan con el pedido de CADA quien: ","{producto} {total} {guia} {transportadora} {novedad} {ciudad} {direccion}"]}),((Pd=$n==null?void 0:$n.muestraTexto)==null?void 0:Pd.texto)&&e.jsxs("div",{style:{fontSize:12,background:"rgba(37,211,102,.07)",border:"1px solid rgba(37,211,102,.3)",borderRadius:10,padding:"9px 12px",marginBottom:10,lineHeight:1.55},children:[e.jsxs("b",{style:{fontSize:10.5,letterSpacing:".05em",textTransform:"uppercase",color:"var(--success)",display:"block",marginBottom:3},children:["Asà le llegará a ",$n.muestraTexto.nombre]}),e.jsx("span",{style:{color:"var(--text, #333)",whiteSpace:"pre-wrap"},children:$n.muestraTexto.texto})]})]}),Mr&&e.jsx("div",{role:"alert",style:{fontSize:12.5,fontWeight:700,color:"var(--danger)",background:"var(--notice-danger-bg)",borderRadius:9,padding:"8px 11px",marginBottom:10,lineHeight:1.5},children:Mr}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>Pn(null),disabled:Qa,style:{...ee,padding:"8px 14px",fontSize:12.5},children:"Volver"}),e.jsx("button",{onClick:Gs,disabled:Qa||!Bn().tels.length||(no==="plantilla"?!Un:!yo.trim()),style:{background:"#25D366",color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:12.5,fontWeight:800,cursor:Qa?"default":"pointer",opacity:Qa||!Bn().tels.length||(no==="plantilla"?!Un:!yo.trim())?.55:1,fontFamily:"inherit"},children:Qa?"Enviandoâ¦":Bn().tels.length?`Enviar a ${Bn().tels.length}`:"Ya les escribiste a todos"})]})]})]})}),wn&&e.jsx("div",{onClick:()=>Io(null),style:{position:"fixed",inset:0,zIndex:121,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 15px",width:"min(400px, 100%)",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,marginBottom:10}
1166,children:[e.jsx("span",{style:{flex:"none",width:42,height:42,borderRadius:13,background:"linear-gradient(135deg, #a78bfa, #7c3aed)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 14px -6px rgba(124,58,237,.55)"},children:e.jsxs("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20.59 13.41 11 3.83A2 2 0 0 0 9.59 3H4a1 1 0 0 0-1 1v5.59A2 2 0 0 0 3.59 11l9.58 9.59a2 2 0 0 0 2.83 0l4.59-4.59a2 2 0 0 0 0-2.83z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("b",{style:{display:"block",fontSize:14.5,letterSpacing:"-.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Etiquetas de ",String(wn.customer_name||"este pedido").split(" ")[0]]}),e.jsx("span",{style:{display:"block",fontSize:11.5,color:"var(--text-secondary, #64748b)",fontWeight:600,marginTop:1},children:"Cada etiqueta es una columna en la pestaña Etiquetas: agrupa tus pedidos como quieras."})]}),e.jsx("button",{type:"button",onClick:()=>Io(null),title:"Cerrar",style:Je,children:"â"})]}),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:[it.map(d=>{const A=cn(wn).some(T=>T.id===d.id);return e.jsxs("button",{onClick:()=>To(wn,d,A),style:{fontSize:11.5,fontWeight:700,borderRadius:999,padding:"5px 12px",cursor:"pointer",fontFamily:"inherit",border:"1.5px solid "+(d.color||"#94a3b8"),background:A?d.color||"#94a3b8":"transparent",color:A?"#fff":d.color||"#64748b"},children:[A?"â ":"+ ",d.nombre]},d.id)}),!it.length&&e.jsx("span",{style:{fontSize:11.5,color:"var(--text-muted)"},children:"Aún no tienes etiquetas: crea la primera aquà abajo."})]}),e.jsx("div",{style:{marginBottom:9},children:Ho}),e.jsxs("div",{style:{display:"flex",gap:7},children:[e.jsx("input",{value:qn,onChange:d=>Fo(d.target.value),maxLength:30,placeholder:"Nueva etiquetaâ¦",onKeyDown:async d=>{if(d.key==="Enter"){const A=await wr(qn);A&&(Fo(""),To(wn,A,!1))}},style:{flex:1,padding:"8px 11px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:12.5,fontFamily:"inherit",background:"var(--input-bg, #fff)",color:"var(--text, #111)"}}),e.jsx("button",{onClick:async()=>{const d=await wr(qn);d&&(Fo(""),To(wn,d,!1))},disabled:!qn.trim(),style:{background:me,color:"#fff",border:0,borderRadius:9,padding:"8px 13px",fontSize:12,fontWeight:800,cursor:qn.trim()?"pointer":"default",opacity:qn.trim()?1:.5,fontFamily:"inherit"},children:"Crear y poner"})]})]})}),ge&&e.jsx("div",{onClick:()=>Te(null),style:{position:"fixed",inset:0,zIndex:121,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,width:"min(480px, 100%)",height:"min(640px, 90vh)",display:"flex",flexDirection:"column",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,padding:"13px 14px",borderBottom:"1px solid var(--border, #eef0f5)",background:"linear-gradient(180deg, rgba(37,211,102,.10), rgba(37,211,102,.03))"},children:[e.jsxs("span",{style:{flex:"none",position:"relative",width:42,he
1166ight:42},children:[e.jsx("span",{style:{width:42,height:42,borderRadius:99,background:"linear-gradient(135deg, #25D366, #128C4B)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:17,fontWeight:800,boxShadow:"0 6px 14px -6px rgba(18,140,75,.55)"},children:String(ge.customer_name||ge.phone||"C").trim().charAt(0).toUpperCase()}),e.jsx("span",{style:{position:"absolute",right:-3,bottom:-3,width:19,height:19,borderRadius:99,background:"#25D366",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",border:"2px solid var(--card-bg, #fff)"},children:e.jsx(Bo,{s:11})})]}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("b",{style:{display:"block",fontSize:14.5,letterSpacing:"-.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ge.customer_name||ge.phone}),ie&&ie!==!1&&e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginTop:3},children:[!!ie.numero_pais&&Zt>1&&e.jsxs("span",{title:`Le escribes desde tu WhatsApp ${ie.numero_etiqueta||v1(ie.numero_pais)}${ie.numero_display?" ("+ie.numero_display+")":""}`,style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:800,borderRadius:999,padding:"2px 9px",color:"var(--text-secondary, #475569)",background:"var(--bg-soft, #eef1f6)"},children:[e.jsx("span",{"aria-hidden":!0,children:mj(ie.numero_pais)}),v1(ie.numero_pais)]}),e.jsxs("span",{title:ie.en_ventana?"Dentro de las 24 h â puedes escribirle libre":"Fuera de 24 h â mándale una plantilla (botón verde de abajo)",style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10.5,fontWeight:800,borderRadius:999,padding:"2px 9px",color:ie.en_ventana?"#128C4B":"#92650a",background:ie.en_ventana?"rgba(37,211,102,.14)":"rgba(245,158,11,.14)"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:99,background:ie.en_ventana?"#25D366":"#f59e0b",flex:"none"}}),ie.en_ventana?"Dentro de las 24 h":"Fuera de 24 h · plantilla"]}),ie.last_out_status==="failed"&&e.jsx("span",{title:ie.last_out_error||"",style:{color:"#fff",background:"#dc2626",borderRadius:999,padding:"2px 8px",fontSize:9.5,fontWeight:800},children:"ÃLTIMO MENSAJE: ERROR"}),["delivered","read"].includes(String(ie.last_out_status||""))&&e.jsxs("span",{style:{color:"#15803d",fontWeight:800,fontSize:10.5},children:["ââ ",ie.last_out_status==="read"?"leÃdo":"entregado"]})]})]}),ie&&ie!==!1&&e.jsx("a",{href:`/whatsapp?conversation=${ie.id}`,title:"Abrir la conversación completa en WhatsApp",style:{flex:"none",display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:800,color:"#128C4B",textDecoration:"none",background:"var(--card-bg, #fff)",border:"1px solid rgba(37,211,102,.4)",borderRadius:9,padding:"6px 10px"},children:"Abrir completo â"}),e.jsx("button",{type:"button",onClick:()=>Te(null),title:"Cerrar",style:Je,children:"â"})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"12px 14px",display:"flex",flexDirection:"column",gap:7,background:"var(--support-bg)",backgroundImage:Mj},children:[ie===null&&e.jsx("span",{style:{fontSize:12.5,color:"var(--text-muted)"},children:"Buscando el chatâ¦"}),ie!==null&&Be.length===0&&e.jsxs("div",{style:{margin:"auto",textAlign:"center",maxWidth:300,padding:"10px 0"},children:[e.jsx("div",{style:{width:52,height:52,borderRadius:99,background:"rgba(37,211,102,.13)",color:"#128C4B",display:"inline-flex",alignItems:"center",justifyContent:"center",marginBottom:10},children:e.jsx(Bo,{s:24})}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"12px 14px",textAlign:"left",boxShadow:"0 1px 3px rgba(16,24,40,.06)",marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("b",{style:{flex:1,fontSize:13,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(ge.products)&&((Dd=ge.products[0])==null?void 0:Dd.name)||ge.landing_name||"Pedido"}),Number(ge.total_cop)>0&&e.jsxs("span",{style:{flex:"none",fontSize:13,fontWeight:800,color:me,fontVariantNumeric:"tabular-nums"}
1166,children:["$",Number(ge.total_cop).toLocaleString("es-CO")]})]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)",fontWeight:600,marginTop:3},children:[ge.city,to(ge.crm_status)].filter(Boolean).join(" · ")})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary, #64748b)",lineHeight:1.55},children:ie===!1?"Aún no han hablado por tu lÃnea. EscrÃbele con el botón verde de WhatsApp de la tarjeta y, cuando responda, la conversación vive aquÃ.":ie.en_ventana?"Aún no hay mensajes. EscrÃbele aquà abajo.":"Aún no hay mensajes. Mándale una plantilla con el botón verde de abajo."})]}),e.jsx(wj,{msgs:Be,tplBtns:I||void 0,submissionId:Number(ge==null?void 0:ge.id)||void 0,onReenviado:()=>{ie&&ie!==!1&&ye(ie.id)}})]}),ie&&ie!==!1&&Ue&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderTop:"1px solid var(--border, #eef0f5)",background:"var(--bg-soft, #f8fafc)"},children:[e.jsx("img",{src:Ue.url,alt:"Captura pegada, lista para enviar",style:{width:42,he
1166ight:42,objectFit:"cover",borderRadius:8,border:"1px solid var(--border, #eef0f5)",flex:"none"}}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:"var(--text, #111)"},children:"Imagen pegada"}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary, #64748b)"},children:"Sale al tocar enviar. Lo que escribas va de pie de foto."})]}),e.jsx("button",{onClick:we,title:"Quitar la imagen",style:{width:26,height:26,flex:"none",border:0,borderRadius:"50%",background:"var(--bg-tertiary)",color:"var(--text-secondary)",cursor:"pointer",fontSize:12,fontWeight:800,fontFamily:"inherit"},children:"â"})]}),ie&&ie!==!1&&e.jsxs("div",{style:{display:"flex",gap:8,padding:"10px 12px",borderTop:"1px solid var(--border, #eef0f5)",alignItems:"flex-end"},children:[e.jsx("button",{onClick:()=>K(!0),title:"Mándale una plantilla aprobada (funciona aunque la ventana de 24 h esté cerrada)",style:{flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:38,height:38,borderRadius:999,background:"rgba(37,211,102,.12)",color:"#128C4B",border:"1px solid rgba(37,211,102,.4)",cursor:"pointer"},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 2v6h6M16 13H8M16 17H8M10 9H8"})]})}),e.jsx("textarea",{value:ze,rows:1,onChange:d=>{tt(d.target.value);const A=d.currentTarget;A.style.height="auto",A.style.height=Math.min(A.scrollHeight,132)+"px"},onPaste:Ye,onKeyDown:d=>{d.key!=="Enter"||d.shiftKey||typeof window<"u"&&window.matchMedia&&window.matchMedia("(pointer: coarse)").matches||(d.preventDefault(),Ue?lt():jt())},placeholder:ie.en_ventana?"EscrÃbele aquÃ⦠(Shift+Enter baja de renglón)":"Fuera de 24 h: mándale una plantilla con el botón verde",disabled:!ie.en_ventana||Fe,style:{flex:1,padding:"9px 12px",borderRadius:18,border:"1px solid var(--border, #dfe3ec)",fontSize:13,lineHeight:"22px",resize:"none",overflowY:"auto",maxHeight:132,fontFamily:"inherit",opacity:ie.en_ventana?1:.6}}),e.jsx("button",{onClick:()=>{Ue?lt():jt()},disabled:!ie.en_ventana||Fe||!ze.trim()&&!Ue,style:{background:"#25D366",color:"#fff",border:0,borderRadius:999,padding:"9px 16px",fontSize:13,fontWeight:800,cursor:"pointer",opacity:!ie.en_ventana||!ze.trim()?.5:1},children:Fe?"â¦":"Enviar"})]}),Re&&ie&&ie!==!1&&e.jsx(kj,{fetch:(d,A)=>s(d,A),conv:{id:ie.id,customer_name:ge.customer_name||"",product_name:Array.isArray(ge.products)&&((Bd=ge.products[0])==null?void 0:Bd.name)||ge.landing_name||"",total_cop:Number(ge.total_cop)||0,city:ge.city||""},onClose:()=>K(!1),onSent:()=>ye(ie.id)})]})}),st&&e.jsx("div",{onClick:()=>la(null),style:{position:"fixed",inset:0,zIndex:122,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 14px",width:"min(420px, 100%)",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("b",{style:{fontSize:14.5,display:"block",marginBottom:4},children:["¿Por qué se cancela",st.ids.length>1?`n estos ${st.ids.length} pedidos`:"","?"]}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"Con esto sabrás por cuáles causas te cancelan."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:Ct.map(d=>e.jsx("button",{onClick:()=>la(A=>A&&{...A,motivo:d}),style:{fontSize:12,fontWeight:700,borderRadius:999,padding:"6px 12px",cursor:"pointer",border:"1.5px solid "+(st.motivo===d?"var(--notice-danger-border)":"var(--border, #dfe3ec)"),background:st.motivo===d?"var(--notice-danger-bg)":"transparent",color:st.motivo===d?"var(--danger)":"var(--text, #333)"},children:d},d))}),(()=>{const d=[...new Set(u.map(A=>String(A.cancel_reason||"").trim()).filter(A=>A&&!Ct.includes(A)))].slice(0,8);return d.length?e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:800,letterSpacing:".05em",textTransform:"uppercase",color:"var(--text-muted, #94a3b8)",marginBottom:5},children:"Los que ya has escrito"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:d.map(A=>e.jsx("button",{onClick:()=>la(T=>T&&{...T,motivo:A}),style:{fontSize:12,fontWeight:700,borderRadius:999,padding:"6px 12px",cursor:"pointer",fontFamily:"inherit",border:"1.5px dashed "+(st.motivo===A?"var(--notice-danger-border)":"var(--border, #dfe3ec)"),background:st.motivo===A?"var(--notice-danger-bg)":"transparent",color:st.motivo===A?"var(--danger)":"var(--text-secondary, #64748b)"},children:A},A))})]}):null})(),st.motivo==="Otro"&&e.jsx("input",{value:st.otro,onChange:d=>la(A=>A&&{...A,otro:d.target.value}),placeholder:"Cuéntame el motivoâ¦",maxLength:100,style:{width:"100%",boxSizing:"border-box",padding:"9px 12px",borderRadius:9,border:"1px solid var(--border, #dfe3ec)",fontSize:13,marginBottom:10}}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>la(null),style:{...ee,padding:"8px 14px",fontSize:12.5},children:"Volver"}),e.jsxs("button",{disabled:!st.motivo||st.motivo==="Otro"&&!st.otro.trim(),onClick:async()=>{const d=st.motivo==="Otro"?st.otro.trim():st.motivo,A=st.ids;la(null);const T=[];for(const O of A){const W=await nl(O,{crm_status:"cancelado",cancel_reason:d});W&&T.push(W)}T.length&&alert(`${T.length===1?"Un pedido no se canceló":`${T.length} pedidos no se cancelaron`}: 1167 1168`+T.slice(0,10).join(` 1169`)+` 1170 1171Ya los ves actualizados: revÃsalos antes de cancelarlos otra vez.`),ut(new Set),Ca(!0)},style:{background:"#dc2626",color:"#fff",border:0,borderRadius:10,padding:"8px 16px",fontSize:12.5,fontWeight:800,cursor:"pointer",opacity:!st.motivo||st.motivo==="Otro"&&!st.otro.trim()?.5:1},children:["Cancelar pedido",st.ids.length>
11711?"s":""]})]})]})}),Ta&&e.jsx("div",{onClick:()=>Eo(null),style:{position:"fixed",inset:0,background:"rgba(15,23,42,.45)",zIndex:999,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:18,padding:"18px 20px",width:(qd=(Wd=Ta.data)==null?void 0:Wd.otras)!=null&&qd.length?"min(1064px, 97vw)":"min(680px, 96vw)",maxHeight:"86vh",overflowY:"auto",boxShadow:"0 24px 60px rgba(16,24,40,.22)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:13},children:[e.jsx("span",{style:{width:38,height:38,borderRadius:12,background:"linear-gradient(135deg, #0f766e, #0866ff)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#fff",flex:"none",boxShadow:"0 4px 12px rgba(8,102,255,.28)"},children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 3h5v5"}),e.jsx("path",{d:"M8 21H3v-5"}),e.jsx("path",{d:"M21 3l-7 7"}),e.jsx("path",{d:"M3 21l7-7"})]})}),e.jsxs("span",{style:{minWidth:0,flex:1},children:[e.jsx("span",{style:{display:"block",fontSize:17,fontWeight:800,letterSpacing:"-.02em",lineHeight:1.15},children:"Comparar fletes"}),e.jsxs("span",{style:{display:"block",fontSize:12,color:"var(--text-secondary, #64748b)",fontWeight:600,marginTop:2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[Ta.sub.customer_name," · ",((Md=Ta.data)==null?void 0:Md.ciudad)||`${Ta.sub.city||""}${Ta.sub.department?", "+Ta.sub.department:""}`,Number(Ta.sub.total_cop)>0?` · $ ${Number(Ta.sub.total_cop).toLocaleString("es-CO")}`:""]})]}),e.jsx("button",{onClick:()=>{Eo(null),Aa(null),kr(null)},style:{border:0,background:"var(--bg-tertiary, #f2f4f8)",width:30,height:30,borderRadius:10,fontSize:17,cursor:"pointer",color:"var(--text-muted, #8a90a2)",fontFamily:"inherit",flex:"none"},children:"Ã"})]}),Xt&&(()=>{var W,J;const d=Object.keys(Xt).sort((le,Ve)=>le.localeCompare(Ve,"es")),A=et!=null&&et.dep?(Xt[et.dep]||[]).slice().sort((le,Ve)=>le.localeCompare(Ve,"es")):[],T={padding:"6px 9px",borderRadius:9,border:"1px solid var(--border,#e8eaf0)",background:"var(--card-bg,#fff)",color:"inherit",fontSize:12,fontWeight:600,maxWidth:155,boxShadow:"0 1px 2px rgba(16,24,40,.05)"},O=le=>String(le||"").toLowerCase().replace(/(^|[ .(])([a-záéÃóúñ])/g,(Ve,gt,Qe)=>gt+Qe.toUpperCase());return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",background:"var(--bg-tertiary, #f6f7f9)",border:"1px solid var(--border, #e8eaf0)",borderRadius:12,padding:"9px 12px",margin:"0 0 11px"},children:[e.jsx("span",{title:"Desde dónde saldrÃa el paquete. Aplica a 99envÃos y Aveonline; Dropi siempre cotiza desde la bodega del proveedor y Mastershop es histórico.",style:{fontSize:10,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".06em",cursor:"help"},children:"Origen de cotización"}),e.jsxs("select",{style:T,value:(et==null?void 0:et.dep)||"",onChange:le=>{const Ve=le.target.value;if(!Ve){Aa(null),Ys(Ta.sub,"sucursal");return}Aa({dep:Ve,city:""})},children:[e.jsx("option",{value:"",children:"Tu sucursal (como está en 99envÃos)"}),d.map(le=>e.jsx("option",{value:le,children:le},le))]}),(et==null?void 0:et.dep)&&e.jsxs("select",{style:T,value:et.city,onChange:le=>{const Ve={dep:et.dep,city:le.target.value};Aa(Ve),Ve.city&&Ys(Ta.sub,Ve)},children:[e.jsx("option",{value:"",disabled:!0,children:"Elige la ciudad"}),A.map(le=>e.jsx("option",{value:le,children:le},le))]}),((J=(W=Ta.data)==null?void 0:W.e99)==null?void 0:J.origen_usado)&&e.jsxs("span",{title:`99envÃos está cotizando desde ${O(Ta.data.e99.origen_usado)}`,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10.5,fontWeight:700,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:999,padding:"3px 10px",marginLeft:"auto",maxWidth:190,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:99,background:"var(--success)",flex:"none"}}),"desde ",O(Ta.data.e99.origen_usado)]})]})})(),Ta.error&&e.jsx("div",{role:"alert",style:{fontSize:12.5,fontWeight:700,color:"var(--danger)",background:"var(--notice-danger-bg)",border:"1px solid var(--notice-danger-border)",borderRadius:10,padding:"9px 12px"},children:Ta.error}),!Ta.error&&!Ta.data&&e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",padding:"14px 0"},children:"Cotizando en Dropi y 99envÃosâ¦"}),Ta.data&&(()=>{var va,qt,io,Uo,Se,It,_t,Dt,Ce,Kt,pa,_a,tn,an,vo,so,$i,wl;const d=Ta.data,A=_e=>String(_e||"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]/g,""),T=Array.isArray(d.otras)?d.otras:[],O=new Map,W=_e=>{const ua=A(_e);return O.has(ua)||O.set(ua,{nombre:String(_e||"").toUpperCase(),dropi:{v:null},e99:{v:null},s99:{v:null},s99p:{v:null},ms:{v:null},otros:T.map(()=>({v:null}))}),O.get(ua)};if(((va=d.dropi)==null?void 0:va.ok)!==!1&&Array.isArray((qt=d.dropi)==null?void 0:qt.carriers))for(const _e of d.dropi.carriers){if(!(_e!=null&&_e.nombre))continue;const ua=W(_e.nombre);ua.dropi=_e.flete!=null?{v:Number(_e.flete),t:_e.seguro?`+ $ ${Number(_e.seguro).toLocaleStr
1171ing("es-CO")} de seguro aparte`:void 0}:{v:null,t:_e.sin_cotizar||void 0}}const J=((io=d.e99)==null?void 0:io.ok)===!1?null:(Uo=d.e99)==null?void 0:Uo.variantes,le=(_e,ua)=>{if(Array.isArray(_e==null?void 0:_e.filas))for(const Mt of _e.filas){if(!(Mt!=null&&Mt.transportadora))continue;const Tn=W(Mt.transportadora);Tn[ua]={v:Mt.valor!=null?Number(Mt.valor):null,t:Mt.desglose||Mt.error||void 0},Mt.dias&&!Tn.dias&&(Tn.dias=String(Mt.dias)),Mt.entrega&&!Tn.entrega&&(Tn.entrega=String(Mt.entrega))}};if(J&&(le(J.ninguno,"e99"),le(J.seguro99,"s99"),le(J.seguro99plus,"s99p")),(Se=d.e99)!=null&&Se.efectividad)for(const[_e,ua]of Object.entries(d.e99.efectividad)){const Mt=O.get(A(_e));Mt&&(Mt.ef=Number(ua))}if((It=d.historia)!=null&&It.transportadoras)for(const[_e,ua]of Object.entries(d.historia.transportadoras)){const Mt=O.get(A(_e));Mt&&(Mt.hist=ua)}if(T.forEach((_e,ua)=>{for(const Mt of _e.filas||[])!(Mt!=null&&Mt.transportadora)||Mt.valor==null||(W(Mt.transportadora).otros[ua]={v:Number(Mt.valor),t:[Mt.desglose,Mt.dias?`entrega en ${Mt.dias} dÃa${String(Mt.dias)==="1"?"":"s"}`:""].filter(Boolean).join(" · ")||(_e.ejemplo?"Cifra de MUESTRA: la integración real de "+_e.proveedor+" aún no está conectada.":void 0)})}),((_t=d.ms)==null?void 0:_t.ok)!==!1&&Array.isArray((Dt=d.ms)==null?void 0:Dt.historico)){const _e=new Map;for(const ua of d.ms.historico){const Mt=A(ua.transportadora);_e.has(Mt)||_e.set(Mt,[]),_e.get(Mt).push(ua)}for(const ua of _e.values()){const Mt=ua[0];W(Mt.transportadora).ms={v:Number(Mt.valor),t:`HISTÃRICO, no cotización (Mastershop no cotiza antes de crear la orden): tu envÃo del ${Mt.cuando} a esta ciudad costó esto${ua.length>1?` â y tienes ${ua.length-1} más de referencia`:""}.`}}}const Ve=_e=>Math.min(...[_e.dropi.v,_e.e99.v,_e.s99.v,_e.s99p.v,_e.ms.v,...(_e.otros||[]).map(ua=>ua.v)].filter(ua=>ua!=null).map(Number),1/0),gt=[...O.values()].sort((_e,ua)=>Ve(_e)-Ve(ua)),Qe=Math.min(...gt.map(Ve),1/0),Z=_e=>{const ua=gt.find(Mt=>Mt[_e].v!=null&&Mt.e99.v!=null&&Mt[_e].v>Mt.e99.v);return ua&&ua.e99.v!=null?ua[_e].v-ua.e99.v:null},Rt=Z("s99"),Yt=Z("s99p"),Ht="1px solid var(--border, #e8eaf0)",nt=(_e,ua,Mt,Tn)=>e.jsxs("td",{title:_e.t,style:{padding:"9px 10px",textAlign:"right",fontSize:12.5,fontWeight:ua?800:600,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",borderLeft:Ht,borderTop:Ht,color:_e.v==null?"var(--text-muted,#c2c6d1)":_e.v===Qe?"#0f7a3d":ua?"var(--text,#111)":"var(--text-secondary,#5b6472)",background:_e.v!=null&&_e.v===Qe?"rgba(34,197,94,.14)":void 0,cursor:_e.t?"help":void 0,borderRight:void 0},children:[_e.v!=null?`$ ${Number(_e.v).toLocaleString("es-CO")}`:_e.t?"â":"â",_e.v!=null&&Tn?e.jsx("span",{style:{display:"block",fontSize:8.5,fontWeight:700,color:"var(--text-muted,#9aa0ad)",letterSpacing:".01em"}
1171,children:Tn}):null]}),Bt=(_e,ua,Mt)=>e.jsx("button",{title:Mt,onClick:Tn=>{Tn.stopPropagation(),kr(es=>(es==null?void 0:es.k)===_e?null:{k:_e,titulo:ua,texto:Mt})},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:13,height:13,borderRadius:99,border:"1px solid currentColor",fontSize:8,fontWeight:800,marginLeft:4,cursor:"pointer",opacity:(ya==null?void 0:ya.k)===_e?1:.7,verticalAlign:"middle",background:(ya==null?void 0:ya.k)===_e?"currentColor":"transparent",padding:0,fontFamily:"inherit"},children:e.jsx("span",{style:{color:(ya==null?void 0:ya.k)===_e?"var(--card-bg, #fff)":"inherit"},children:"i"})}),ca={padding:"9px 10px",fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".06em",background:"var(--bg-tertiary, #f6f7f9)",borderLeft:Ht,whiteSpace:"nowrap"},Vt={padding:"6px 10px",fontSize:9.5,fontWeight:800,color:"var(--text-muted,#8a90a2)",textTransform:"uppercase",letterSpacing:".05em",textAlign:"right",background:"var(--bg-tertiary, #f6f7f9)",borderLeft:Ht,borderTop:Ht,whiteSpace:"nowrap"};return e.jsxs(e.Fragment,{children:[d.ejemplo&&e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1px dashed var(--notice-warning-border)",borderRadius:10,padding:"7px 10px",marginBottom:10},children:"VISTA DE EJEMPLO â cifras de muestra del pedido DEMO."}),ya&&e.jsxs("div",{onClick:()=>kr(null),style:{fontSize:11.5,lineHeight:1.5,color:"var(--text, #333)",background:"rgba(8,102,255,.06)",border:"1px solid rgba(8,102,255,.22)",borderRadius:10,padding:"8px 11px",marginBottom:9,cursor:"pointer"},children:[e.jsxs("b",{children:[ya.titulo,":"]})," ",ya.texto," ",e.jsx("span",{style:{color:"var(--text-muted,#8a90a2)",fontWeight:700},children:"(toca para cerrar)"})]}),gt.length?e.jsx("div",{style:{overflowX:"auto",border:Ht,borderRadius:14,boxShadow:"0 1px 2px rgba(16,24,40,.05)"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{rowSpan:2,style:{...ca,textAlign:"left",borderLeft:"none"},children:"Transportadora"}),e.jsx("th",{rowSpan:2,style:{...ca,textAlign:"right",verticalAlign:"middle"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:15,height:15,style:{borderRadius:4,objectFit:"contain"}}),"Dropi",Bt("dropi","Dropi",`OJO con el peso: el cotizador de Dropi no conoce el producto (cotiza un paquete estándar); si tu producto es pesado o voluminoso, el flete real de la guÃa sube. Y con Dropi no hay seguro anti-devolución: si el pedido se devuelve, pagas el flete de la vuelta${Number((Ce=d.historia)==null?void 0:Ce.dropi_devolucion_prom)>0?` â a ti te ha costado ~$ ${Number(d.historia.dropi_devolucion_prom).toLocaleString("es-CO")} en promedio`:""}.`)]})}),e.jsx("th",{colSpan:3,style:{...ca,textAlign:"center"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("img",{src:"/logos/a99envios.png",alt:"",width:15,height:15,style:{borderRadius:4,objectFit:"contain"}}),"99envÃos"]})}),e.jsx("th",{style:{...ca,textAlign:"right"},title:"Mastershop no cotiza antes de crear la orden: esta columna es el flete REAL de tus envÃos anteriores a esta misma ciudad.",children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx("img",{src:"/logos/amastershop.jpg",alt:"",width:15,height:15,style:{borderRadius:4,objectFit:"contain"}}),"Mastershop"]})}),T.map(_e=>e.jsxs("th",{style:{...ca,textAlign:"right"},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:_e.proveedor}),_e.ejemplo&&e.jsx("span",{style:{display:"block",fontSize:7.5,fontWeight:800,color:"var(--warning)",letterSpacing:".05em"},children:"EJEMPLO"})]},_e.proveedor))]}),e.jsx("tr",{children:e.jsxs(e.Fragment,{children:[e.jsxs("th",{style:Vt,children:["Sin seguro",Bt("sin","Sin seguro","Si el pedido se devuelve, pagas los DOS fletes completos (ida y vuelta).")]}),e.jsxs("th",{style:Vt,children:["+Seg99",Bt("s99","+Seg99",`Si el pedido se devuelve, pagas solo el valor del seguro${Rt?`: $ ${Rt.toLocaleStr
1171ing("es-CO")}`:""}. Los dos fletes corren por cuenta de 99envÃos. El precio grande ya lo trae sumado.`)]}),e.jsxs("th",{style:Vt,children:["+Seg99+",Bt("s99p","+Seg99+",`Si el pedido se devuelve, no pagas NADA: ni fletes ni seguro${Yt?` (los $ ${Yt.toLocaleString("es-CO")} ya van dentro del precio)`:""}. Tu ganancia queda intacta.`)]}),e.jsxs("th",{style:Vt,children:["Histórico",Bt("hist","Histórico (Mastershop)","No es cotización: es lo que te cobró Mastershop de verdad en tus envÃos anteriores a esta misma ciudad.")]}),T.map(_e=>e.jsx("th",{style:Vt,children:_e.ejemplo?"Muestra":"Cotización"},_e.proveedor))]})})]}),e.jsx("tbody",{children:gt.map((_e,ua)=>{const Mt=Ve(_e);return e.jsxs("tr",{style:{background:ua%2?"var(--bg-tertiary, #fafbfc)":void 0},children:[e.jsxs("td",{style:{padding:"9px 10px",fontSize:12,fontWeight:800,letterSpacing:".01em",whiteSpace:"nowrap",borderTop:Ht},children:[(()=>{const Tn=Kd(_e.nombre);return Tn?e.jsx("img",{src:Tn,alt:"",style:{height:14,maxWidth:64,objectFit:"contain",verticalAlign:"middle",marginRight:6}}):null})(),_e.nombre,Mt===Qe&&Number.isFinite(Qe)?e.jsx("span",{style:{marginLeft:7,fontSize:8.5,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:999,padding:"2px 7px",letterSpacing:".04em",verticalAlign:"middle"},children:"MÃS BARATO"}):null,_e.hist&&e.jsxs("span",{title:`De tus envÃos ya cerrados a esta ciudad con esta transportadora (Dropi + 99envÃos + Mastershop juntos): ${_e.hist.entregados} entregados y ${_e.hist.devueltos} devueltos${_e.hist.dias!=null?`, con demora real promedio de ${_e.hist.dias} dÃa${_e.hist.dias===1?"":"s"}`:""}.`,style:{display:"block",fontSize:9,fontWeight:800,color:"#0866ff",marginTop:2,letterSpacing:".01em",cursor:"help"},children:["tuyos: ",_e.hist.entregados,"/",_e.hist.entregados+_e.hist.devueltos," entregados",_e.hist.dias!=null?` · ~${_e.hist.dias} d`:""]}),(_e.ef!=null||_e.entrega||_e.dias)&&e.jsxs("span",{style:{display:"block",fontSize:9,fontWeight:700,color:"var(--text-muted,#8a90a2)",marginTop:2,letterSpacing:".01em"},children:[_e.ef!=null&&e.jsxs("span",{title:"De cada 100 envÃos de 99envÃos a esta ciudad con esta transportadora, cuántos Sà se entregan (dato de 99envÃos).",style:{color:_e.ef>=.85?"var(--success)":_e.ef>=.7?"var(--warning)":"var(--danger)",fontWeight:800,cursor:"help"},children:[Math.round(_e.ef*100),"% entregas"]}),_e.ef!=null&&(_e.entrega||_e.dias)?" · ":"",_e.entrega?`llega ~${_e.entrega.slice(8,10)}/${_e.entrega.slice(5,7)}`:_e.dias?`${_e.dias} dÃa${_e.dias==="1"?"":"s"}`:""]})]}),nt(_e.dropi,_e.dropi.v!=null&&_e.dropi.v===Mt,!1),nt(_e.e99,_e.e99.v!=null&&_e.e99.v===Mt,!1),nt(_e.s99,_e.s99.v!=null&&_e.s99.v===Mt,!1,_e.s99.v!=null&&_e.e99.v!=null&&_e.s99.v>_e.e99.v?`seguro $ ${(_e.s99.v-_e.e99.v).toLocaleString("es-CO")}`:null),nt(_e.s99p,_e.s99p.v!=null&&_e.s99p.v===Mt,!1,_e.s99p.v!=null&&_e.e99.v!=null&&_e.s99p.v>_e.e99.v?`seguro $ ${(_e.s99p.v-_e.e99.v).toLocaleString("es-CO")}`:null),nt(_e.ms,_e.ms.v!=null&&_e.ms.v===Mt,!1),(_e.otros||[]).map((Tn,es)=>nt(Tn,Tn.v!=null&&Tn.v===Mt,es===(_e.otros||[]).length-1))]},_e.nombre)})})]})}):e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",padding:"8px 0"},children:"Ninguna de las dos logÃsticas dio precios para este pedido."}),((Kt=d.dropi)==null?void 0:Kt.ok)===!1&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:8},children:["Dropi: ",((pa=d.dropi)==null?void 0:pa.message)||"no cotizó."]}),((_a=d.e99)==null?void 0:_a.ok)===!1&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:4},children:["99envÃos: ",((tn=d.e99)==null?void 0:tn.message)||"no cotizó."]}),((an=d.ms)==null?void 0:an.ok)===!1&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:4},children:["Mastershop: ",((vo=d.ms)==null?void 0:vo.message)||"sin datos."]}),((so=d.ms)==null?void 0:so.ok)!==!1&&(($i=d.ms)==null?void 0:$i.nota)&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:4},children:["Mastershop: ",d.ms.nota]}),J&&["ninguno","seguro99","seguro99plus"].map(_e=>{var ua;return(ua=J[_e])!=null&&ua.error?e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",marginTop:4},children:["99envÃos (",_e==="ninguno"?"sin seguro":_e==="seguro99"?"Seguro99":"Seguro99+","): ",J[_e].error]},_e):null}),((wl=d.e99)==null?void 0:wl.muestra)&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"var(--notice-warning-text)"},children:"99envÃos respondió pero el precio no se pudo leer; esta es su respuesta cruda (nos sirve para corregir el lector):"}),e.jsx("pre",{style:{fontSize:10,background:"var(--bg-tertiary, #f6f7f9)",borderRadius:8,padding:8,overflowX:"auto",maxHeight:160},children:JSON.stringify(d.e99.muestra,null,1).slice(0,2e3)})]}),e.jsx("div",{style:{fontSize:10.5,color:"var(--text-muted)",marginTop:11,fontWeight:600,textAlign:"center"}
1171,children:"Solo comparativo â desde aquà no se sube nada · â = no cotizó · pasa el mouse sobre un precio para ver su desglose"})]})})()]})}),(Zi||zc)&&(()=>{const d=!!zc,A=d?ul():js(Zi),T=()=>{sd(null),Fr(!1)},O=d?new Set(Array.from(He)).size:0;return e.jsx("div",{onClick:T,style:{position:"fixed",inset:0,zIndex:1000050,background:"rgba(12,18,28,.42)",display:"flex",alignItems:"center",justifyContent:"center",padding:18},children:e.jsxs("div",{onClick:W=>W.stopPropagation(),style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:18,width:"100%",maxWidth:420,boxShadow:"0 24px 60px -24px rgba(12,18,28,.4)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"20px 22px 16px"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,letterSpacing:".09em",textTransform:"uppercase",color:"var(--text-muted, #8a90a2)",marginBottom:6},children:"Despachar"}),e.jsx("div",{style:{fontSize:19,fontWeight:800,letterSpacing:"-.02em",color:"var(--text, #111)",lineHeight:1.2},children:"¿Por cuál logÃstica sale?"}),e.jsx("div",{style:{fontSize:13,color:"var(--text-secondary, #64748b)",marginTop:5,lineHeight:1.5},children:d?`Tienes ${O} ${O===1?"pedido seleccionado":"pedidos seleccionados"}.`:"Tienes varias conectadas."})]}),e.jsx("div",{style:{borderTop:"1px solid var(--border, #eef0f5)"},children:A.map(W=>{const J=hi[W],le=d?cl(W).length:0;return e.jsxs("button",{onClick:()=>{const Ve=Zi;T(),d?bd(W):Nc(Ve,W)},style:{display:"flex",alignItems:"center",gap:13,width:"100%",background:"transparent",border:0,borderBottom:"1px solid var(--border, #eef0f5)",borderLeft:`3px solid ${J.color}`,padding:"15px 20px 15px 17px",cursor:"pointer",fontFamily:"inherit",textAlign:"left"},children:[e.jsx("span",{style:{width:36,height:36,borderRadius:10,background:"var(--bg-soft, #f6f7fa)",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"none"},children:e.jsx("img",{src:J.logo,alt:"",width:21,height:21,style:{borderRadius:4,objectFit:"contain"}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",fontSize:14.5,fontWeight:700,color:"var(--text, #111)",letterSpacing:"-.01em"},children:J.nombre}),d&&e.jsxs("span",{style:{display:"block",fontSize:12,color:"var(--text-secondary, #64748b)",marginTop:1},children:[le," de los seleccionados ",le===1?"puede":"pueden"," subir"]})]}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted, #8a90a2)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:e.jsx("path",{d:"M9 18l6-6-6-6"})})]},W)})}),e.jsx("button",{onClick:T,style:{width:"100%",background:"transparent",border:0,color:"var(--text-secondary, #64748b)",padding:"14px",fontSize:13.5,fontWeight:700,cursor:"pointer",fontFamily:"inherit"},children:"Cancelar"})]})})})(),ro&&e.jsx(Cj,{sub:{...ro.sub,anticipo_cop:pl(ro.sub,(Od=(Fd=ro.sub)==null?void 0:Fd.fields)==null?void 0:Od._anticipo_cop),ship_prepay:!!((Gd=(Hd=ro.sub)==null?void 0:Hd.fields)!=null&&Gd._ship_prepay)},logistica:ro.logistica,pushing:(ro.logistica==="mastershop"?bs:Zs)===ro.sub.id,onClose:()=>fi(null),onSubir:async(d,A,T)=>{const O=ro.sub,W=ro.logistica;fi(null),T&&Xs(T),W==="mastershop"?await id(O.id,d):await As(O.id,A,d,T)},onDireccionGuardada:({address:d,revision:A})=>m(T=>T.map(O=>O.id===ro.sub.id?{...O,address:d,...A!=null?{crm_revision:A}:{}}:O)),onAnticipoGuardado:({anticipo:d,revision:A})=>m(T=>T.map(O=>{if(O.id!==ro.sub.id)return O;const W=(()=>{try{const J=typeof O.fields=="string"?JSON.parse(O.fields):O.fields;return J&&typeof J=="object"&&!Array.isArray(J)?{...J}:{}}catch{return{}}})();return d>0?W._anticipo_cop=d:(delete W._anticipo_cop,delete W._anticipo_at,delete W._anticipo_por),{...O,fields:W,...A!=null?{crm_revision:A}:{}}}))}),pe&&e.jsx(_j,{sub:{...pe,anticipo_cop:pl(pe,(Vd=pe==null?void 0:pe.fields)==null?void 0:Vd._anticipo_cop),ship_prepay:!!((Ud=pe==null?void 0:pe.fields)!=null&&Ud._ship_prepay)},pushing:dt===pe.id,onClose:()=>ce(null),onSubir:async(d,A,T,O,W)=>{const J=pe;O!=null&&m(le=>le.map(Ve=>Ve.id===J.id?{...Ve,crm_revision:O}:Ve)),await Qi(J.id,d,A,T,O,W),ce(null)},onDireccionGuardada:({address:d,revision:A})=>m(T=>T.map(O=>{if(O.id!==pe.id)return O;const W=(()=>{try{const J=typeof O.fields=="string"?JSON.parse(O.fields):O.fields;return J&&typeof J=="object"&&!Array.isArray(J)?{...J}:{}}catch{return{}}})();return"barrio"in W&&(W.barrio=""),"referencia"in W&&(W.referencia=""),{...O,address:d,fields:W,...A!=null?{crm_revision:A}:{}}})),onAnticipoGuardado:({anticipo:d,revision:A})=>m(T=>T.map(O=>{if(O.id!==pe.id)return O;const W=(()=>{try{const J=typeof O.fields=="string"?JSON.parse(O.fields):O.fields;return J&&typeof J=="object"&&!Array.isArray(J)?{...J}:{}}catch{return{}}})();return d>0?W._anticipo_cop=d:(delete W._anticipo_cop,delete W._anticipo_at,delete W._anticipo_por),{...O,fields:W,...A!=null?{crm_revision:A}:{}}}))}),Q&&e.jsx("div",{onClick:()=>de(null),style:{position:"fixed",inset:0,zIndex:120,background:"rgba(10,15,32,.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg, #fff)",borderRadius:16,padding:"16px 18px 14px",width:"min(440px, 100%)",maxHeight:"84vh",overflowY:"auto",boxShadow:"0 24px 60px -20px rgba(10,15,32,.5)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,marginBottom:12}
1171,children:[e.jsx("span",{style:{flex:"none",width:42,height:42,borderRadius:13,background:`linear-gradient(135deg, ${me}, #7c3aed)`,color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:17,fontWeight:800,letterSpacing:".02em",boxShadow:"0 6px 14px -6px rgba(8,102,255,.55)"},children:String(Q.customer_name||"C").trim().charAt(0).toUpperCase()}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("b",{style:{display:"block",fontSize:15,letterSpacing:"-.01em",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Q.customer_name||"Cliente"}),Q.dropi_order_id&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,marginTop:2,fontSize:11,fontWeight:800,color:"var(--success)",background:"var(--notice-success-bg)",borderRadius:999,padding:"2px 9px"},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:12,height:12,style:{borderRadius:3,objectFit:"contain"}}),"Dropi #",Q.dropi_order_id]})]}),e.jsx("button",{type:"button",onClick:()=>de(null),title:"Cerrar",style:Je,children:"â"})]}),(()=>{const d=ha(Q);return d?e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:7,background:d.bg,color:d.color,borderRadius:999,padding:"5px 12px",fontSize:12,fontWeight:800,marginBottom:10},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:99,background:d.color}}),"Comprador: ",d.label,e.jsxs("span",{style:{fontWeight:600,opacity:.85},children:["· ",d.detalle]})]}):null})(),(()=>{var Yt;const d=Q.fields||{},A=Array.isArray(d._cart_items)&&d._cart_items.length?d._cart_items:null,T=(A?A.map(Ht=>`${el(Ht)}${(Number(Ht.qty)||1)>1?` Ã${Ht.qty}`:""}`).join(" · "):String(Array.isArray(Q.products)&&((Yt=Q.products[0])==null?void 0:Yt.name)||Q.product||Q.landing_name||""))||"â (Dropi no lo entregó)",O=Number(Q.total_cop||Q.total)||0,W=String(Q.dropi_carrier||Q.carrier||"").trim(),J=String(Q.dropi_tracking||Q.tracking_number||"").trim(),le=String(Q.dropi_status||(Q.origin==="dropi"?Q.status:"")||"").trim(),Ve=String(Q.dropi_last_movement||Q.last_movement||"").trim(),gt=Ht=>{const nt=Ht.toUpperCase();return/ENTREGAD/.test(nt)?["var(--success)","var(--notice-success-bg)"]:/DEVOL|RECHAZ|CANCEL|NO ENTREG/.test(nt)?["var(--danger)","var(--notice-danger-bg)"]:/TRANSITO|REPARTO|CAMINO|DESPACH/.test(nt)?["#1d4ed8","rgba(37,99,235,.1)"]:/GUIA|IMPRES|PREPARA|PENDIENTE|CONFIRM|BODEGA/.test(nt)?["#92650a","rgba(245,158,11,.12)"]:["var(--text-secondary)","var(--bg-tertiary)"]},Qe={border:"1px solid var(--border, #e8eaf0)",borderRadius:13,padding:"10px 12px",marginBottom:9,background:"var(--card-bg, #fff)",boxShadow:"0 1px 2px rgba(16,24,40,.04)"},Z=Ht=>e.jsx("div",{style:{fontSize:10,fontWeight:800,color:"var(--text-muted, #8a90a2)",textTransform:"uppercase",letterSpacing:".07em",marginBottom:6},children:Ht}),Rt=(Ht,nt)=>e.jsxs("div",{style:{display:"flex",gap:10,padding:"4px 0",fontSize:13,lineHeight:1.45,alignItems:"baseline"},children:[e.jsx("span",{style:{flex:"none",width:126,fontWeight:700,color:"var(--text-muted)",fontSize:10,textTransform:"uppercase",letterSpacing:".04em",whiteSpace:"nowrap"},children:Ht}),e.jsx("span",{style:{flex:1,minWidth:0,overflowWrap:"anywhere",fontWeight:600},children:nt})]});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:Qe,children:[Z("Contacto"),Rt("Teléfono",String(Q.phone||"â")),(()=>{const Ht=Pu(Q);return Rt("Dirección",Ht.texto?Ht.texto:"â (Dropi no la entregó)")}
1171)(),Rt("Ciudad",[Q.city,Q.department].filter(Boolean).join(", ")||"â"),(()=>{const Ht=String((Q.fields||{})._vivienda||"").toLowerCase(),nt=Ht==="casa"?"Casa":Ht==="apto"?"Apartamento":Ht==="oficina"?"Oficina":"";return nt?Rt("Recibe en",nt):null})()]}),e.jsxs("div",{style:Qe,children:[Z("El pedido"),Rt("Producto",T),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:6,paddingTop:8,borderTop:"1px dashed var(--border, #e8eaf0)"},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".04em"},children:Q.paid_at?"Pagado en lÃnea":"Total a recaudar"}),e.jsx("b",{style:{fontSize:19,fontWeight:800,letterSpacing:"-.02em",fontVariantNumeric:"tabular-nums",color:Q.paid_at?"var(--success)":"var(--text, #111)"},children:O>0?`$ ${O.toLocaleString("es-CO")}`:"â"})]})]}),e.jsxs("div",{style:Qe,children:[Z("EnvÃo"),Rt("Transportadora",W?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:7},children:[(()=>{const Ht=Kd(W);return Ht?e.jsx("img",{src:Ht,alt:"",style:{height:15,maxWidth:78,objectFit:"contain"}}):null})(),W]}):"â (aún sin asignar)"),Rt("GuÃa",J?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12.5,letterSpacing:".03em"},className:"censor-blur",children:J}),e.jsx("button",{type:"button",onClick:Ht=>{var Bt;(Bt=navigator.clipboard)==null||Bt.writeText(J).catch(()=>{});const nt=Ht.currentTarget;nt.textContent="â Copiada",setTimeout(()=>{nt.textContent="Copiar"},1400)},style:{border:"1px solid var(--border, #e8eaf0)",background:"var(--bg-soft, #f4f6fa)",color:"var(--text-secondary, #475569)",borderRadius:7,padding:"2px 9px",fontSize:10.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},children:"Copiar"})]}):"â (aún sin generar)"),le&&(()=>{const[Ht,nt]=gt(le);return Rt("Estado Dropi",e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:Ht,background:nt,borderRadius:999,padding:"3px 10px",fontSize:11.5,fontWeight:800},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:99,background:Ht}}),le]}))})(),Ve&&Ve.toUpperCase()!==le.toUpperCase()&&Rt("Ãltimo mov.",Ve)]})]})})()]})}),He.size>0&&e.jsx("div",{style:{position:"fixed",left:0,right:0,bottom:0,zIndex:90,background:"var(--card-bg, #fff)",borderTop:"1px solid var(--border, #e8eaf0)",boxShadow:"0 -8px 24px -8px rgba(16,24,40,.14)",padding:"12px 16px calc(12px + env(safe-area-inset-bottom))"},children:e.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:13,fontWeight:800,fontVariantNumeric:"tabular-nums"},children:[He.size," ",He.size===1?"seleccionado":"seleccionados"]}),e.jsx("button",{onClick:Ro,disabled:Ka,style:{...ee,padding:"7px 12px",fontSize:12.5,opacity:Ka?.5:1},children:xd?"Quitar todos":"Todos los visibles"}),e.jsx("button",{onClick:()=>ut(new Set),disabled:Ka,title:"Desmarcar y cerrar esta barra",style:{...ee,padding:"7px 12px",fontSize:12.5,opacity:Ka?.5:1},children:"Quitar selección"}),!!ks&&e.jsx("span",{style:{fontSize:12,fontWeight:700,color:Ka?"var(--text-muted)":me},children:ks}),e.jsx("span",{style:{flex:1}}),e.jsx("button",{onClick:()=>Fc("confirmado"),disabled:Ka,style:{background:me,color:"#fff",border:0,borderRadius:10,padding:"8px 14px",fontSize:12.5,fontWeight:700,cursor:Ka?"default":"pointer",fontFamily:"inherit",opacity:Ka?.5:1},children:"Confirmar"}),ae==="nuestros"&&ul().length>0&&(()=>{const d=ul(),A=d.length===1?hi[d[0]]:null;return e.jsxs("button",{onClick:()=>{Ka||(A?bd(d[0]):Fr(!0))},disabled:Ka,title:A?`Sube a ${A.nombre} los que puedan de la selección`:"Elige a cuál logÃstica suben los seleccionados",style:{display:"inline-flex",alignItems:"center",gap:6,background:Ka?"var(--input-bg, #eef1f6)":A?A.color:me,color:Ka?"var(--text-secondary, #64748b)":"#fff",border:0,borderRadius:10,padding:"8px 14px",fontSize:12.5,fontWeight:800,cursor:Ka?"default":"pointer",fontFamily:"inherit"},children:[A&&e.jsx("img",{src:A.logo,alt:"",width:14,height:14,style:{borderRadius:3,objectFit:"contain"}}),Ka?"Subiendoâ¦":A?`Enviar a ${A.nombre}`:"Enviar a mi logÃstica"]})})(),(()=>{const d=zt.filter(A=>He.has(A.id)&&A.phone).map(A=>String(A.phone));return d.length>0?e.jsx("button",{onClick:()=>{try{sessionStorage.setItem("lumy_masivo_handoff",JSON.stringify({telefonos:d,at:Date.now()}))}catch{}window.location.href="/whatsapp"},disabled:Ka,title:"Mándales una plantilla aprobada de WhatsApp a los seleccionados",style:{display:"inline-flex",alignItems:"center",gap:6,background:"rgba(37,211,102,.12)",color:"#128C4B",border:"1px solid rgba(37,211,102,.4)",borderRadius:10,padding:"8px 13px",fontSize:12.5,fontWeight:700,cursor:Ka?"default":"pointer",fontFamily:"inherit",opacity:Ka?.5:1},children:"Plantilla de WhatsApp"}):null})(),e.jsx("button",{onClick:Gc,disabled:Ka,style:{...ee,padding:"7px 12px",fontSize:12.5,opacity:Ka?.5:1},children:"Exportar"}),ae==="local"&&e.jsx("button",{disabled:Ka,onClick:async()=>{const d=[...He];for(const A of d){const T=u.find(O=>O.id===A);T&&!T.local_exported_at&&await zo(A,{local_exported:!0,local_exported_at:new Date().toISOString(),...["nuevo","contactado","pendiente_confirmar"].includes(T.crm_status)?{crm_status:"confirmado"}:{}})}ut(new Set)},style:{background:"rgba(13,148,136,.1)",color:"#0d9488",border:"1px solid rgba(13,148,136,.35)",borderRadius:10,padding:"8px 14px",fontSize:12.5,fontWeight:700,cursor:Ka?"default":"pointer",fontFamily:"inherit",opacity:Ka?.5:1},children:"Marcar como exportados"}),e.jsxs("select",{onChange:d=>{d.target.value&&Fc(d.target.value)},value:"",disabled:Ka,style:{...E,width:"auto",padding:"8px 14px",fontSize:12.5,marginBottom:0,fontWeight:700,opacity:Ka?.5:1},children:[e.jsx("option",{value:"",children:"Mover a etapaâ¦"}),ac.filter(d=>
1171d!=="lead_wa"&&d!=="abandonado"&&d!=="pago_pendiente"&&(ae==="local"?!["novedad","reclamar_oficina","devuelto","rechazado"].includes(d):!UC.includes(d))).map(d=>e.jsx("option",{value:d,children:to(d)},d))]})]})}),(()=>{var Uo;const d=Ne!=null?u.find(Se=>Se.id===Ne):null;if(!d)return null;const A=$j(Ks,d),T=tc(d.phone)?ic(d,qa.cc,qa.nat):"";!i&&(d.origin!=="shopify"||X)&&!d.dropi_order_id&&Da&&["abandonado","lead_wa","pago_pendiente"].includes(d.crm_status);const O=Bl[d.crm_status]||"#64748b",W=(d.customer_name||"?").trim().charAt(0).toUpperCase()||"?",J={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:48,borderRadius:13,fontSize:13.5,fontWeight:800,border:"none",cursor:"pointer",textDecoration:"none",fontFamily:"inherit"},le=(Se,It)=>({fontSize:10.5,fontWeight:800,color:It,background:Se,borderRadius:999,padding:"3px 9px"}),Ve={fontSize:11,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em",marginBottom:6,display:"block"},gt=A1(d.created_at,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}),Qe=(Se,It,_t,Dt)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderBottom:Dt?"none":"1px solid var(--border, #eef0f5)"},children:[e.jsx("span",{style:{flex:"none",width:26,height:26,borderRadius:8,background:"var(--bg-soft, #f4f6fa)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-secondary, #64748b)"},children:Se}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:10,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em"},children:It}),e.jsx("div",{style:{fontSize:13.5,fontWeight:600,color:"var(--text, #111)",lineHeight:1.35,wordBreak:"break-word"},children:_t})]})]}),Z=new Set(["name","nombre","phone","telefono","teléfono","phone2","celular","address","direccion","dirección","city","ciudad","department","departamento","email","correo","e-mail","lastname","apellido","apellidos","referencia","colonia","distrito","parroquia","corregimiento","zona","barrio","codigo_postal","cp","vivienda","lk_hp","notes"]),Rt=d.fields&&typeof d.fields=="object"?d.fields:{},Yt=Array.isArray(Rt._cart_items)?Rt._cart_items:null,Ht=String(Rt._cart_notes||"").trim(),Bt=(Array.isArray(d.products)?d.products:[]).reduce((Se,It)=>Se+(Number(It==null?void 0:It.quantity)||0),0),ca=Object.keys(Rt).filter(Se=>Se&&Se[0]!=="_"&&!Z.has(String(Se).toLowerCase())&&String(Rt[Se]??"").trim()!=="").map(Se=>({k:Se,v:String(Rt[Se]).slice(0,60)})).slice(0,8),Vt=["abandonado","lead_wa","pago_pendiente"].includes(d.crm_status),va=[{lbl:"Nombre",ok:!!String(d.customer_name||"").trim()},{lbl:"Teléfono",ok:!!String(d.phone||"").trim()},{lbl:"Dirección",ok:!!String(d.address||"").trim()},{lbl:"Ciudad",ok:!!String(d.city||"").trim()},{lbl:"Departamento",ok:!!String(d.department||"").trim()}],qt=va.filter(Se=>!Se.ok),io=va.length-qt.length;return e.jsx("div",{onClick:()=>{Lt(null),Nt(null)},style:{position:"fixed",inset:0,background:"rgba(10,15,32,.5)",zIndex:1e6,display:"flex",justifyContent:"flex-end"},children:e.jsxs("div",{onClick:Se=>Se.stopPropagation(),style:{background:"var(--bg-soft, #f4f6fa)",width:"min(440px, 100%)",maxWidth:"100%",height:"100%",display:"flex",flexDirection:"column",boxShadow:"-16px 0 50px rgba(10,15,32,.3)"},children:[e.jsxs("div",{style:{flex:"none",background:"var(--card-bg, #fff)",borderBottom:"1px solid var(--border, #e8eaf0)"},children:[e.jsx("div",{style:{height:4,background:O}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:11,padding:"13px 14px"},children:[e.jsx("div",{style:{flex:"none",width:44,height:44,borderRadius:13,background:O+"1c",color:O,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,fontSize:19},children:W}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:17,fontWeight:800,color:"var(--text, #111)",lineHeight:1.2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.customer_name||"(sin nombre)"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,fontWeight:800,color:O,background:O+"1c",borderRadius:999,padding:"2px 10px"},children:to(d.crm_status)}),Number(d.total_cop)>0&&e.jsxs("span",{style:{fontSize:14.5,fontWeight:800,color:me,fontVariantNumeric:"tabular-nums"}
1171,children:["$",Number(d.total_cop).toLocaleString("es-CO")]})]})]}),e.jsx("button",{onClick:()=>{Lt(null),Nt(null)},title:"Cerrar",style:{flex:"none",width:38,height:38,borderRadius:11,border:"1px solid var(--border, #e8eaf0)",background:"var(--card-bg, #fff)",color:"var(--text-secondary, #64748b)",fontSize:21,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"Ã"})]})]}),e.jsxs("div",{className:"lk-drawer-body",style:{flex:1,overflowY:"auto",padding:"14px 14px 16px",display:"flex",flexDirection:"column",gap:13,WebkitOverflowScrolling:"touch"},children:[e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.jsx(Lu,{source:d.source,s:11}),d.de_tienda&&e.jsx(Rp,{s:10.5,general:!!d.tienda_general,style:{padding:"3px 9px"}}),d.paid_at?d.fields&&d.fields._ship_prepay?e.jsx("span",{style:le("rgba(200,144,26,.16)","#a9750f"),title:"El cliente pagó el ENVÃO en lÃnea. Cóbrale el producto"+(Number((Uo=d.fields)==null?void 0:Uo._recaudo_cop)>0?" ($"+Number(d.fields._recaudo_cop).toLocaleString("es-CO")+")":"")+" al entregar.",children:"EnvÃo pagado · recauda producto"}):e.jsx("span",{style:le("var(--notice-warning-bg)","var(--warning)"),children:"Pagado · sin recaudo"}):d.crm_status==="pago_pendiente"?e.jsx("span",{style:le("rgba(217,119,6,.13)","#b45309"),title:"El comprador fue a pagar en lÃnea. Si no paga, pasa solo a Nuevo Pedido con «Intentó pagar».",children:"Esperando pago en lÃnea"}):e.jsx("span",{style:le("var(--bg-tertiary)","var(--text-secondary)"),children:"Con recaudo"}),d.payment_attempt_failed&&e.jsx("span",{style:le("rgba(225,29,72,.12)","#be123c"),children:"Intentó pagar"}),Wl(d)&&e.jsx("span",{style:le("var(--notice-warning-bg)","var(--warning)"),children:"Dirección incompleta"}),d.dropi_status&&e.jsx("span",{style:le(ql(d.dropi_status)+"2b",ql(d.dropi_status)),children:Hp(d.dropi_status)})]}),Ke?e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:`1.5px solid ${me}55`,borderRadius:14,padding:"12px 13px",display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em"},children:"Editar datos del cliente"}),A.datosDelComprador?e.jsxs(e.Fragment,{children:[[["customer_name","Nombre"],["phone","Teléfono"],["address","Dirección"]].map(([Se,It])=>e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:3},children:It}),e.jsx("input",{style:{...E,marginBottom:0,padding:"9px 11px",fontSize:13.5},value:Ke[Se]||"",onChange:_t=>ft(Dt=>Dt&&{...Dt,[Se]:_t.target.value})})]},Se)),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:3},children:"Recibe en"}),e.jsx("div",{style:{display:"flex",gap:6},children:[["casa","ð Casa"],["apto","ð¢ Apartamento"],["oficina","ð¬ Oficina"]].map(([Se,It])=>{const _t=Ke.vivienda===Se;return e.jsx("button",{type:"button",onClick:()=>ft(Dt=>Dt&&{...Dt,vivienda:_t?"":Se}),style:{flex:1,height:34,borderRadius:9,border:`1.5px solid ${_t?me:"var(--border,#e8eaf0)"}`,background:_t?me+"1a":"var(--card-bg,#fff)",color:_t?me:"var(--text,#111)",fontWeight:800,fontSize:12,cursor:"pointer",fontFamily:"inherit"},children:It},Se)})})]})]}):e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",margin:0,lineHeight:1.45},children:Ij}),(()=>{const Se={fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:3},It={...E,marginBottom:0,padding:"9px 11px",fontSize:13.5};if(!xn)return e.jsxs(e.Fragment,{children:[["department","city"].map(pa=>e.jsxs("div",{children:[e.jsx("label",{style:Se,children:pa==="city"?Cr.l2:Cr.l1}),e.jsx("select",{style:It,disabled:!0,children:e.jsx("option",{children:fs==="error"?"Sin lista":"Cargandoâ¦"})})]},pa)),fs==="error"&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--danger)",fontWeight:600,lineHeight:1.4},children:["No se pudo cargar la lista."," ",e.jsx("button",{type:"button",onClick:ui,style:{background:"none",border:0,padding:0,color:me,fontSize:11.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit",textDecoration:"underline"},children:"Reintentar"})]})]});const _t=Object.keys(xn).sort((pa,_a)=>pa.localeCompare(_a,"es")),Dt=_t.find(pa=>pa===Ke.department)||_t.find(pa=>ja(pa)===ja(Ke.department))||"",Ce=Dt?(xn[Dt]||[]).slice().sort((pa,_a)=>pa.localeCompare(_a,"es")):[],Kt=Ce.find(pa=>pa===Ke.city)||Ce.find(pa=>ja(pa)===ja(Ke.city))||"";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{style:Se,children:Cr.l1}),e.jsxs("select",{style:It,value:Dt,onChange:pa=>ft(_a=>_a&&{..._a,department:pa.target.value,city:""}),children:[e.jsx("option",{value:"",disabled:!0,children:Ke.department?`${Ke.department} (no está en el catálogo)`:`Elige ${cp(Cr.l1)}`}),_t.map(pa=>e.jsx("option",{value:pa,children:pa},pa))]})]}),e.jsxs("div",{children:[e.jsx("label",{style:Se,children:Cr.l2}),e.jsxs("select",{style:It,value:Kt,disabled:!Dt,onChange:pa=>ft(_a=>_a&&{..._a,city:pa.target.value,department:Dt}),children:[e.jsx("option",{value:"",disabled:!0,children:Ke.city?`${Ke.city} (no está en el catálogo)`:Dt?`Elige ${cp(Cr.l2)}`:`Primero ${cp(Cr.l1)}`}),Ce.map(pa=>e.jsx("option",{value:pa,children:pa},pa))]})]})]})})(),A.datosDelComprador&&Object.keys(Ke.campos||{}).length>0&&e.jsx("div",{style:{borderTop:"1px dashed var(--border, #e8eaf0)",paddingTop:10,marginTop:2,display:"flex",flexDirection:"column",gap:9},children:Object.keys(Ke.campos||{}).map(Se=>e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:4},children:q8(Se)}),e.jsx("input",{style:{...E,marginBottom:0,padding:"9px 11px",fontSize:13.5},value:(Ke.campos||{})[Se]||"",onChange:It=>ft(_t=>_t&&{..._t,campos:{..._t.campos||{},[Se]:It.target.value}})})]},Se))}),e.jsxs("div",{style:{borderTop:"1px solid var(--border, #eef0f5)",marginTop:4,paddingTop:8},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em",marginBottom:6},children:"El pedido"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[A.productos&&e.jsxs("div",{style:{flex:"0 0 84px"},children:[e.jsx("label",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:3},children:"Cantidad"}),e.jsx("input",{type:"number",min:1,max:99,style:{...E,marginBottom:0,padding:"9px 11px",fontSize:13.5},value:Ke.cantidad??"",onChange:Se=>ft(It=>It&&{...It,cantidad:Se.target.value})})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:3},children:"Valor a cobrar"}),e.jsx("input",{type:"number",min:0,style:{...E,marginBottom:0,padding:"9px 11px",fontSize:13.5},value:Ke.total_cop??"",onChange:Se=>ft(It=>It&&{...It,total_cop:Se.target.value})})]})]}),(()=>{if(!A.productos)return e.jsx("p",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",margin:"8px 0 0",lineHeight:1.45}
1171,children:Tj});const Se=Math.max(1,Math.min(99,Math.round(Number(Ke.cantidad)||1))),It=U[String(d.landing_id)]||[],_t={fontSize:10.5,fontWeight:800,color:"var(--text-secondary,#64748b)",textTransform:"uppercase",letterSpacing:".03em",display:"block",marginBottom:4},Dt={...E,marginBottom:0,padding:"9px 11px",fontSize:13.5},Ce=Array.from({length:Se},(tn,an)=>(Ke.unidades||[])[an]||{}),Kt=(tn,an,vo)=>ft(so=>{if(!so)return so;const $i=Array.from({length:Se},(wl,_e)=>({...(so.unidades||[])[_e]||{}}));return vo?$i[tn][an]=vo:delete $i[tn][an],{...so,unidades:$i}}),pa=e.jsx("div",{style:{marginTop:8},children:e.jsxs("button",{type:"button",onClick:()=>ft(tn=>tn&&{...tn,udsCerradas:!1}),style:{border:"1px dashed var(--border, #d8dce6)",background:"transparent",color:"var(--text-secondary, #64748b)",borderRadius:10,padding:"8px 12px",fontSize:12.5,fontWeight:700,cursor:"pointer",fontFamily:"inherit"},children:["+ Talla / color",Se>1?" por unidad":""]})});if(Ke.udsCerradas)return pa;const _a=e.jsx("button",{type:"button",title:"Quitar la talla/color",onClick:()=>ft(tn=>tn&&{...tn,udsCerradas:!0,unidades:[],variante:""}),style:{flex:"none",border:0,background:"transparent",color:"var(--text-muted, #8a90a2)",fontSize:16,lineHeight:1,cursor:"pointer",fontFamily:"inherit",padding:"0 2px"},children:"Ã"});return It.length?e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("label",{style:{..._t,marginBottom:0,flex:1},children:Se>1?"Talla / color de cada unidad":"Talla / color"}),_a]}),e.jsx("div",{style:{display:"grid",gap:6,marginTop:5},children:Ce.map((tn,an)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[Se>1&&e.jsxs("span",{style:{flex:"none",width:26,fontSize:11.5,fontWeight:800,color:"var(--text-muted)"},children:["#",an+1]}),It.map(vo=>e.jsxs("select",{"aria-label":`${vo.name} de la unidad ${an+1}`,style:{...Dt,flex:1,minWidth:0},value:tn[vo.name]||"",onChange:so=>Kt(an,vo.name,so.target.value),children:[e.jsxs("option",{value:"",children:[vo.name,"â¦"]}),vo.options.map(so=>e.jsx("option",{value:so,children:so},so))]},vo.name))]},an))}),e.jsxs("p",{style:{fontSize:10.5,color:"var(--text-secondary,#64748b)",margin:"5px 0 0",lineHeight:1.4},children:[Se>1?"O las llenas todas o las dejas todas vacÃas. ":"","Son las mismas opciones de tu página."]})]}):e.jsxs("div",{style:{marginTop:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("label",{style:{..._t,marginBottom:0,flex:1},children:"Talla / color"}),_a]}),e.jsx("input",{style:{...Dt,marginTop:5},placeholder:"Ej: M · Negro",value:Ke.variante??"",onChange:tn=>ft(an=>an&&{...an,variante:tn.target.value})})]})})(),e.jsx("p",{style:{fontSize:11,color:"var(--text-secondary,#64748b)",margin:"6px 0 0",lineHeight:1.45},children:"El flete se vuelve a cotizar con el valor nuevo cuando toques «Subir a Dropi»."})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:3},children:[e.jsx("button",{disabled:!!Ke.saving,onClick:async()=>{ft(Se=>Se&&{...Se,saving:!0});try{const Se=Dt=>s(`/api/landing/submissions/${d.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ej({...Ke.cantidad!==void 0&&Ke.cantidad!==""?{cantidad:Number(Ke.cantidad)}:{},...Ke.total_cop!==void 0&&Ke.total_cop!==""?{total_cop:Number(Ke.total_cop)}:{},...!Ke.udsCerradas&&Ke.cantidad!==""&&(U[String(d.landing_id)]||[]).length?{unidades:Array.from({length:Math.max(1,Math.min(99,Math.round(Number(Ke.cantidad)||1)))},(Ce,Kt)=>(Ke.unidades||[])[Kt]??{})}:{},...Ke.udsCerradas?Ke.cantidad!==""?{unidades:Array.from({length:Math.max(1,Math.min(99,Math.round(Number(Ke.cantidad)||1)))},()=>({})),variante:""}:{}:!(U[String(d.landing_id)]||[]).length&&Ke.variante!==void 0?{variante:Ke.variante??""}:{},customer_name:Ke.customer_name,phone:Ke.phone,address:Ke.address,city:Ke.city,department:Ke.department,campos:Ke.campos||{},...Ke.vivienda!==void 0?{vivienda:Ke.vivienda}:{},expected_revision:Dt},A))});let It=await Se(Number(d.crm_revision)||0),_t=await It.json().catch(()=>null);if(!It.ok&&(_t==null?void 0:_t.error)==="revision_conflict"){const Dt=await s(`/api/landing/submissions/${d.id}
1171/para-despacho`).then(Kt=>Kt.json()).catch(()=>null),Ce=Dt!=null&&Dt.ok?Dt.pedido:null;if(Ce){m(pa=>pa.map(_a=>_a.id===d.id?{..._a,...Ce}:_a));const Kt=zj(d,Ce);if(!Kt.length&&!String(Ce.dropi_order_id||Ce.mastershop_order_id||Ce.envios99_order_id||"").trim())It=await Se(Number(Ce.crm_revision)||0),_t=await It.json().catch(()=>null);else{alert(Kt.length?`Mientras editabas cambió ${Kt.join(", ")}. Ãbrelo otra vez para ver lo que hay ahora antes de guardar.`:"Este pedido ya está en una logÃstica: el cambio hay que hacerlo allá."),ft(null);return}}}It.ok&&(_t==null?void 0:_t.ok)!==!1?(Number.isInteger(Number(_t==null?void 0:_t.revision))&&m(Dt=>Dt.map(Ce=>Ce.id===d.id?{...Ce,crm_revision:Number(_t.revision)}:Ce)),ft(null),Ca(!0)):(alert(_t&&_t.message||"No se pudo guardar. Intenta de nuevo."),ft(Dt=>Dt&&{...Dt,saving:!1}))}catch{alert("Error de conexión. Intenta de nuevo."),ft(Se=>Se&&{...Se,saving:!1})}},style:{flex:1,height:40,borderRadius:11,border:"none",background:me,color:"#fff",fontWeight:800,fontSize:13,cursor:"pointer",fontFamily:"inherit"},children:Ke.saving?"Guardandoâ¦":"Guardar cambios"}),e.jsx("button",{disabled:!!Ke.saving,onClick:()=>ft(null),style:{flex:"none",height:40,padding:"0 14px",borderRadius:11,border:"1px solid var(--border, #e8eaf0)",background:"var(--card-bg, #fff)",color:"var(--text, #222)",fontWeight:700,fontSize:13,cursor:"pointer",fontFamily:"inherit"},children:"Cancelar"})]}),e.jsx("p",{style:{fontSize:11,color:"var(--text-secondary,#64748b)",margin:0,lineHeight:1.45},children:'Al guardar se limpia el error del intento anterior: toca "Enviar a Dropi" para reintentar con los datos corregidos.'})]}):e.jsxs(e.Fragment,{children:[(()=>{const Se=ha(d);return Se?e.jsx("div",{style:{display:"flex",gap:10,alignItems:"center",padding:"11px 13px",marginBottom:9,background:Se.bg,border:`1px solid ${Se.color}33`,borderRadius:14},children:e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:10,fontWeight:800,color:Se.color,textTransform:"uppercase",letterSpacing:".05em"},children:"Comprador"}),e.jsx("div",{style:{fontSize:15,fontWeight:800,color:Se.color,lineHeight:1.25,marginTop:1},children:Se.label}),e.jsx("div",{style:{fontSize:12,fontWeight:600,color:Se.color,opacity:.85,lineHeight:1.4,marginTop:2},children:Se.detalle})]})}):null})(),e.jsx(K1,{submissionId:Number(d.id),phone:String(d.phone||""),parte:"historial"}),e.jsx("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"11px 13px",marginBottom:9},children:e.jsxs("div",{children:[e.jsx("label",{style:Ve,children:"Pedido"}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"11px 13px",display:"flex",flexDirection:"column",gap:8},children:[Yt?e.jsxs(e.Fragment,{children:[Yt.map((Se,It)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,fontSize:13.5},children:[e.jsxs("span",{style:{color:"var(--text, #111)",fontWeight:600,minWidth:0},children:[el(Se)," ",e.jsxs("span",{style:{color:"var(--text-secondary,#64748b)",fontWeight:700},children:["Ã",Number(Se.qty)||1]}),Se.needsVariant?e.jsx("span",{style:{color:"var(--warning)",fontWeight:700,fontSize:11.5},children:" · confirmar talla/color"}):null]}),e.jsx("b",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:Nr(Number(Se.lineTotal)||0)})]},It)),Ht&&e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary,#64748b)",lineHeight:1.4,borderTop:"1px dashed var(--border,#eef0f5)",paddingTop:7},children:Ht})]}):e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,fontSize:13.5},children:[e.jsxs("span",{style:{color:"var(--text, #111)",fontWeight:600,minWidth:0},children:[d.tienda_general?"Escribió desde tu tienda, sin elegir producto":d.landing_name||"Producto",String(Rt._offer||"").trim()?e.jsxs("span",{style:{color:"var(--text-secondary,#64748b)",fontWeight:700},children:[" · ",String(Rt._offer).slice(0,90)]}):Bt>0?e.jsxs("span",{style:{color:"var(--text-secondary,#64748b)",fontWeight:700},children:[" Ã",Bt]}):null]}),!d.tienda_general&&e.jsx("b",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:Nr(Number(d.total_cop)||0)})]}),!Yt&&String(Rt._bump||"").trim()&&e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",fontWeight:600},children:["+ Extra que tomó: ",e.jsx("b",{style:{color:"var(--text,#111)"},children:String(Rt._bump).slice(0,70)})," ",e.jsx("span",{style:{fontSize:11},children:"(ya sumado al total)"})]}),!Yt&&[["_regalo_variante","Regalo"],["_upsell_variante","Oferta extra"],["_downsell_variante","Segunda oferta"]].filter(([Se])=>String(Rt[Se]||"").trim()).map(([Se,It])=>e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",fontWeight:600},children:[It,": ",e.jsx("b",{style:{color:"var(--text,#111)"},children:String(Rt[Se]).slice(0,120)})]},Se)),Number(Rt._auto_promoted)===1&&!d.dropi_order_id&&!d.confirmed_at&&!["confirmado","despachado","en_transito","entregado","devuelto","reclamar_oficina"].includes(String(d.crm_status||""))&&e.jsx("div",{role:"status",style:{fontSize:12,color:"var(--notice-warning-text)",background:"var(--notice-warning-bg)",border:"1px solid var(--notice-warning-border)",borderRadius:9,padding:"7px 10px",lineHeight:1.4},children:'El cliente llenó todos sus datos y escogió la oferta, pero no alcanzó a tocar "Confirmar". ConfÃrmalo por WhatsApp o llamada antes de enviarlo a Dropi.'}),ca.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:ca.map((Se,It)=>e.jsxs("span",{style:{fontSize:11.5,fontWeight:600,color:"var(--text, #111)",background:"var(--bg-soft, #f4f6fa)",border:"1px solid var(--border, #e8eaf0)",borderRadius:999,padding:"3px 10px"},children:[Se.k,": ",e.jsx("b",{children:Se.v})]},It))}),!Yt&&ca.length===0&&e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary,#64748b)",lineHeight:1.4},children:"No se registró talla/color. Si el producto tiene variantes, confÃrmalas con el cliente antes de despachar."})]})]})}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,overflow:"hidden"},children:[Qe(e.jsx(wu,{s:15}),"Teléfono",d.phone?e.jsx(Np,{phone:d.phone,cc:(rn[String(d.country||"").toUpperCase()]||{phoneCc:qa.cc}).phoneCc,natLen:(rn[String(d.country||"").toUpperCase()]||{natLen:qa.nat}).natLen,style:{display:"inline-block"},children:d.phone}):"â"),(()=>{const Se=Pu(d);return Qe(e.jsx(Hl,{s:15}),"Dirección",Se.texto?Se.texto:"â")})(),(()=>{const Se=String(Rt._vivienda||"").toLowerCase(),It=Se==="casa"?"Casa":Se==="apto"?"Apartamento / conjunto":Se==="oficina"?"Oficina":"";return It?Qe(e.jsx(Hl,{s:15}),"Recibe en",It):null})(),Qe(e.jsx(Hl,{s:15}),"Ciudad",(d.city||"â")+(d.department?`, ${d.department}`:"")),Qe(e.jsx(Ls,{s:15}),"Fecha",gt,!d.dropi_order_id&&!ts(d.mastershop_order_id)),d.dropi_order_id&&Qe(e.jsx("img",{src:"/logos/adropi.png",alt:"",width:16,height:16,style:{borderRadius:3,objectFit:"contain"}}),"Dropi","#"+d.dropi_order_id,!ts(d.mastershop_order_id)),ts(d.mastershop_order_id)&&Qe(e.jsx("img",{src:"/logos/amastershop.jpg",alt:"",width:16,height:16,style:{borderRadius:3,objectFit:"contain"}}),"Mastershop","#"+d.mastershop_order_id,!0),Xi(d)&&Qe(e.jsx(Ls,{s:15}),Or(d),e.jsx("button",{type:"button",onClick:()=>tl(d),style:{background:"none",border:"none",padding:0,color:"#b45309",fontWeight:800,fontSize:12.5,cursor:"pointer",fontFamily:"inherit",textDecoration:"underline"},children:"Por revisar: resuélvelo"}),!0),!d.dropi_order_id&&!ts(d.mastershop_order_id)&&!Xi(d)&&!String(d.envios99_order_id||"").trim()&&e.jsx("button",{onClick:()=>{var Se,It,_t,Dt;return ft({cantidad:String(Number(Array.isArray(d.products)?((Se=d.products[0])==null?void 0:Se.quantity)??((It=d.products[0])==null?void 0:It.qty):0)||1),total_cop:String(Number(d.total_cop??d.total)||0),variante:String(Rt._variante||""),unidades:Rj(Rt,U[String(d.landing_id)]||[],Number(Array.isArray(d.products)?((_t=d.products[0])==null?void 0:_t.quantity)??((Dt=d.products[0])==null?void 0:Dt.qty):0)||1),udsCerradas:!(U[String(d.landing_id)]||[]).length&&!String(Rt._variante||"").trim(),campos:Object.fromEntries(ca.filter(Ce=>!(U[String(d.landing_id)]||[]).some(Kt=>String(Kt.name).trim().toLowerCase()===String(Ce.k).trim().toLowerCase())).map(Ce=>[Ce.k,String(Rt[Ce.k]??"")])),customer_name:String(d.customer_name||""),phone:String(d.phone||""),address:String(d.address||""),city:String(d.city||""),department:String(d.department||""),vivienda:String(Rt._vivienda||""),pais:String(d.pais_despacho||d.country||""),pedido:Number(d.id)||void 0})},style:{display:"block",width:"100%",border:"none",borderTop:"1px solid var(--border, #eef0f5)",background:"transparent",color:me,fontWeight:800,fontSize:12.5,padding:"10px 13px",cursor:"pointer",textAlign:"center",fontFamily:"inherit"},children:"Editar datos del cliente"})]}),e.jsxs("div",{children:[e.jsx("label",{style:Ve,children:"Estado del pedido"}),e.jsx("select",{style:{...E,marginBottom:0,fontWeight:700},value:d.crm_status,onChange:Se=>
1171{Se.target.value==="cancelado"?ia([d.id]):zo(d.id,{crm_status:Se.target.value})},children:ac.filter(Se=>Dp(Se,d.crm_status,ae==="local")).map(Se=>e.jsx("option",{value:Se,children:to(Se)},Se))})]}),Vt&&e.jsxs("div",{children:[e.jsx("label",{style:Ve,children:"Recuperar este pedido"}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"12px 13px",display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",lineHeight:1.45},children:[e.jsxs("span",{children:["El cliente ",d.crm_status==="pago_pendiente"?"empezó a pagar en lÃnea pero no completó el pago":d.crm_status==="lead_wa"?"escribió por WhatsApp pero aún no confirmó el pedido":"empezó el pedido pero no lo confirmó","."]})," ",Number(d.total_cop)>0?e.jsxs("span",{children:["Su oferta en la página: hay ",e.jsx("b",{style:{color:"var(--success)"},children:Nr(d.total_cop)})," en juego."]}):e.jsxs("span",{children:["Se fue antes de escoger la oferta, por eso aparece en ",e.jsx("b",{style:{color:"var(--text,#111)"},children:"$0"}),"."]})," ",qt.length===0?e.jsxs("span",{children:[e.jsx("b",{style:{color:"var(--success)"},children:"No le faltó ningún dato"}),': dejó todo completo, solo no tocó "Confirmar pedido". Llámalo o escrÃbele por WhatsApp y cierra la venta (puedes corregir sus datos con "Editar datos del cliente" arriba).']}):e.jsxs("span",{children:["Le faltan datos de contacto (",e.jsxs("b",{style:{color:"var(--text,#111)"},children:[io," de ",va.length]}),"): pÃdeselos cuando lo contactes para poder despacharlo."]})]}),qt.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:7},children:qt.map((Se,It)=>e.jsxs("span",{className:"lk-miss",style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:12,fontWeight:800,color:"var(--danger)",background:"var(--notice-danger-bg)",border:"1.5px solid var(--notice-danger-border)",borderRadius:999,padding:"4px 11px"},children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("path",{d:"M12 8v5M12 16.5v.5"}),e.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:"2"})]}),"Falta: ",Se.lbl]},It))}),io>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:va.filter(Se=>Se.ok).map((Se,It)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:700,color:"var(--success)",background:"var(--notice-success-bg)",border:"1px solid var(--notice-success-border)",borderRadius:999,padding:"3px 10px"},children:[e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}),Se.lbl]},It))})]})]}),vt&&vt._id===d.id&&e.jsxs("div",{children:[e.jsx("label",{style:Ve,children:"Inventario en Dropi (en vivo)"}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"11px 13px",display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",lineHeight:1.4},children:[e.jsx("b",{style:{color:"var(--text,#111)"},children:vt.product_name||"Producto "+vt.product_id})," · ",vt.type==="VARIABLE"?"variable":"simple"," · stock total en Dropi: ",vt.all_stock_unknown?e.jsx("b",{style:{color:"var(--text-secondary,#64748b)"},children:"sin dato"}):e.jsx("b",{style:{color:(vt.type==="VARIABLE"?Number(vt.total_stock):Number(vt.product_stock))>0?"var(--success)":"var(--danger)"},children:vt.type==="VARIABLE"?Number(vt.total_stock)+" und":vt.product_stock==null?"sin dato":Number(vt.product_stock)+" und"})]}),Array.isArray(vt.variations)&&vt.variations.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:vt.variations.map((Se,It)=>{const _t=Se.stock==null?null:Number(Se.stock),Dt=Number(Se.id)===Number(vt.picks_variation_id);return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,alignItems:"center",fontSize:13,padding:"6px 9px",borderRadius:9,background:Dt?me+"10":"var(--bg-soft,#f4f6fa)",border:Dt?`1px solid ${me}44`:"1px solid transparent"},children:[e.jsxs("span",{style:{color:"var(--text,#111)",fontWeight:600,minWidth:0},children:[Object.entries(Se.attrs||{}).map(([Ce,Kt])=>`${Ce}: ${Kt}`).join(" · ")||"Variación "+Se.id,Dt&&e.jsx("span",{style:{color:me,fontWeight:800,fontSize:11},children:" · la que envÃa Lumy"})]}),e.jsx("b",{style:{flex:"none",color:_t==null?"var(--text-secondary,#64748b)":_t>0?"var(--success)":"var(--danger)",fontVariantNumeric:"tabular-nums"},children:_t==null?"sin dato":`${_t} und`})]},It)})}):e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)"},children:["Producto sin variantes. Stock en Dropi: ",e.jsx("b",{style:{color:Number(vt.product_stock)>0?"var(--success)":"var(--danger)"},children:vt.product_stock==null?"sin dato":Number(vt.product_stock)+" und"}),"."]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-secondary,#64748b)",lineHeight:1.4,borderTop:"1px dashed var(--border,#eef0f5)",paddingTop:7},children:vt.all_stock_unknown?'Dropi no reportó el stock de este producto. Es dato desconocido, no necesariamente agotado. Reintenta "Enviar a Dropi"; si sigue fallando por stock, revisa el inventario directamente en Dropi.':Number(vt.total_stock)>0||Number(vt.product_stock)>0?'Hay stock en Dropi. Si el pedido falló por "sin stock", la talla/color que se intenta despachar está en cero: elige o confirma una CON stock y toca "Enviar a Dropi".':"Dropi reporta cero en todas las bodegas de tu cuenta. Repón el inventario en Dropi y reintenta."})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:Ve,children:"Notas"}),e.jsx("textarea",{style:{...E,minHeight:84,resize:"vertical",marginBottom:0,lineHeight:1.4},defaultValue:d.notes||"",onBlur:Se=>{Se.target.value!==(d.notes||"")&&zo(d.id,{notes:Se.target.value})},placeholder:"Llamé, confirma mañanaâ¦"})]})]}),e.jsx(K1,{submissionId:Number(d.id),phone:String(d.phone||""),parte:"llamada"}),e.jsxs("div",{style:{background:"var(--card-bg, #fff)",border:"1px solid var(--border, #e8eaf0)",borderRadius:14,padding:"11px 13px",display:"flex",flexDirection:"column",gap:6},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:"var(--text-secondary, #64748b)",textTransform:"uppercase",letterSpacing:".04em"},children:"Rastreo (pixel)"}),(()=>{const Se=d.attr_tt?"TikTok":d.attr_fb?"Meta":null;if(!Se)return e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",lineHeight:1.45},children:["Este pedido llegó ",e.jsx("b",{style:{color:"var(--text,#111)"},children:"sin clic de anuncio"})," (orgánico, WhatsApp o directo). Por eso NO cuenta como conversión en TikTok ni Meta: es correcto, no toda venta viene de pauta."]});const It=!!d.payment_provider&&!d.paid_at;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary,#64748b)",lineHeight:1.45},children:["Vino de ",e.jsx("b",{style:{color:Se==="TikTok"?"#111":"#1877F2"},children:Se}),", se le reporta la conversión SOLO a ",Se,"."]}),e.jsx("div",{style:{fontSize:12.5,fontWeight:700},children:d.conversion_sent?e.jsxs("span",{style:{color:"var(--success)"},children:["â Evento enviado a ",Se]}):It?e.jsx("span",{style:{color:"var(--warning)"},children:"Pendiente: pago en lÃnea sin confirmar (el evento se manda al pagar)"}):e.jsx("span",{style:{color:"var(--warning)"},children:"Aún sin enviar (se envÃa al crear/confirmar el pedido)"})})]})})()]}),(()=>{const Se=(_t,Dt,Ce,Kt)=>
1171e.jsx("div",{style:{display:"flex",alignItems:"flex-start",gap:8,background:_t,border:`1px solid ${Dt}`,color:Ce,borderRadius:12,padding:"10px 12px",fontSize:12.5,fontWeight:600,lineHeight:1.4},children:Kt}),It=d.fields&&typeof d.fields=="object"?d.fields:{};if(Number(It._dropi_dudoso)===1){const _t=(Array.isArray(d.dropi_ordenes_dudosas)?d.dropi_ordenes_dudosas:[]).map(Kt=>`#${String((Kt==null?void 0:Kt.id)||"")}`).filter(Kt=>Kt!=="#"),Dt=_t.length>=2?`Hay más de una orden posible en Dropi: ${_t.join(" y ")}`:"Dropi no confirmó si creó la orden",Ce=_t.length>=2?"Revisa cuál corresponde y cancela la sobrante":"Revisa Dropi antes de volver a enviar";return Se("var(--notice-warning-bg)","var(--notice-warning-border)","var(--notice-warning-text)",e.jsxs("span",{children:[e.jsxs("b",{children:[Dt,"."]})," ",Ce,", para evitar una segunda guÃa con recaudo."]}))}if(d.dropi_order_id)return Se("var(--notice-success-bg)","var(--notice-success-border)","var(--success)",e.jsxs(e.Fragment,{children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:16,height:16,style:{borderRadius:3,objectFit:"contain",flex:"none",marginTop:1}}),e.jsxs("span",{children:["En Dropi ",e.jsxs("b",{children:["#",d.dropi_order_id]}),". Su estado se actualiza solo (cada ~20 min)."]})]}));if(d.status==="failed"&&d.error){const _t=String(d.error).trim(),Dt=_t.length<=320?_t:(()=>{const Kt=_t.lastIndexOf(" ",320);return _t.slice(0,Kt>120?Kt:320).trimEnd()+"â¦"})(),Ce=/enviar a dropi/i.test(Dt);return Ap(_t)?Se("var(--notice-danger-bg)","var(--notice-danger-border)","var(--danger)",e.jsxs("span",{children:[e.jsx("b",{children:"No se subió a la logÃstica."})," ",Dt]})):Se("var(--notice-danger-bg)","var(--notice-danger-border)","var(--danger)",e.jsxs("span",{children:[e.jsx("b",{children:"No subió a Dropi."})," ",Dt,Ce?null:e.jsxs(e.Fragment,{children:[e.jsx("br",{}),'Revisa los datos y toca "Enviar a Dropi".']})]}))}{const _t=jp(d);if(_t&&_t.tipo==="despacho"){const Dt=String(d.error).trim(),Ce=Dt.length<=320?Dt:(()=>{const Kt=Dt.lastIndexOf(" ",320);return Dt.slice(0,Kt>120?Kt:320).trimEnd()+"â¦"})();return Se("var(--notice-danger-bg)","var(--notice-danger-border)","var(--danger)",e.jsxs("span",{children:[e.jsxs("b",{children:[_t.titulo,"."]})," ",Ce]}))}}return d.status==="created"?Se("var(--notice-warning-bg)","var(--notice-warning-border)","var(--notice-warning-text)",e.jsxs("span",{children:["Se creó en Dropi pero quedó ",e.jsx("b",{children:"sin enlace"}),'. Lo estamos re-enlazando solo; si en unos minutos no toma su estado, toca "Enviar a Dropi".']})):Se("var(--bg-tertiary)","var(--border, #e8eaf0)","var(--text-secondary)",e.jsxs("span",{children:[e.jsx("b",{children:"Aún no enviado a Dropi."}),' ConfÃrmalo y toca "Enviar a Dropi" para que Dropi lo despache.']}))})()]}),e.jsxs("div",{style:{flex:"none",background:"var(--card-bg, #fff)",borderTop:"1px solid var(--border, #e8eaf0)",padding:"10px 14px calc(12px + env(safe-area-inset-bottom))",display:"grid",gridTemplateColumns:T?"1fr 1fr":"1fr",gap:9},children:[T&&e.jsxs(yu,{sub:{id:d.id,name:d.customer_name,stage:d.crm_status,country:d.country},href:`https://wa.me/${T}?text=${encodeURIComponent("Hola "+(d.customer_name||"").split(" ")[0]+", te escribo por tu pedido.")}`,style:{...J,background:"#25D366",color:"#fff"},children:[e.jsx(Bo,{s:17})," WhatsApp"]}),e.jsx("button",{onClick:()=>{var Se;try{(Se=navigator.clipboard)==null||Se.writeText(String(d.phone||"")),Js(!0),setTimeout(()=>Js(!1),1500)}catch{}},style:{...J,background:"var(--card-bg, #fff)",color:"var(--text, #222)",border:"1px solid var(--border, #e8eaf0)"},children:cr?"¡Copiado!":"Copiar teléfono"}),!i&&(d.origin!=="shopify"||X)&&!d.repetido_de&&!["abandonado","lead_wa","pago_pendiente"].includes(d.crm_status)&&e.jsx("div",{style:{gridColumn:"1 / -1"},children:e.jsx(al,{s:d,ancho:!0})}),d.status==="failed"&&Da&&!d.dropi_order_id&&e.jsxs("button",{onClick:()=>xi(d.id),disabled:sa===d.id,style:{...J,gridColumn:"1 / -1",height:42,background:"var(--card-bg, #fff)",color:"var(--text, #222)",border:"1px solid var(--border, #e8eaf0)",opacity:sa===d.id?.6:1},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:15,height:15,style:{borderRadius:3,objectFit:"contain"}}),sa===d.id?"Consultandoâ¦":"Ver inventario en Dropi"]}),e.jsxs("button",{onClick:()=>{Lc(d.id),Lt(null),Nt(null)},disabled:Oa===d.id,style:{...J,gridColumn:"1 / -1",height:42,background:"transparent",color:"var(--danger)",border:"1px solid var(--notice-danger-border)",fontWeight:700},children:[e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.1",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"})})," Eliminar"]})]})]})})})(),ur&&e.jsx("div",{onClick:()=>Tc(null),style:{position:"fixed",inset:0,background:"rgba(10,15,32,.5)",zIndex:1e6,display:"flex",alignItems:"center",justifyContent:"center",padding:16},children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:"var(--card-bg,#fff)",borderRadius:16,width:"min(560px,100%)",maxHeight:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 60px rgba(10,15,32,.35)"},children:[e.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--border,#e8eaf0)",display:"flex",alignItems:"center",gap:10},children:[e.jsx("img",{src:"/logos/adropi.png",alt:"",width:22,height:22,style:{borderRadius:5,objectFit:"contain",flex:"none"}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:800,fontSize:15,color:"var(--text,#111)"},children:"Estado real de Dropi vs el tablero"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary,#64748b)"},children:[ur.checked," verificados en vivo",ur.fixed>0?` · ${ur.fixed} corregidos`:""]})]}),e.jsx("button",{onClick:()=>Tc(null),style:{...ee,padding:"6px 11px",flex:"none"},children:"â"})]}),e.jsxs("div",{style:{overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:8},children:[(ur.rows||[]).length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-secondary,#64748b)",fontSize:13,padding:22},children:"No hay pedidos activos de Dropi para verificar."}),(ur.rows||[]).map((d,A)=>{const T=!d.reachable;return e.jsxs("div",{style:{border:`1px solid ${d.match?"var(--border,#e8eaf0)":"rgba(245,158,11,.45)"}`,background:d.match?"var(--bg-soft,#f7f8fc)":"rgba(245,158,11,.07)",borderRadius:12,padding:"10px 12px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,alignItems:"center"},children:[e.jsx("b",{style:{fontSize:13,color:"var(--text,#111)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.customer_name||"Pedido #"+d.order_id}),e.jsx("span",{style:{fontSize:11,fontWeight:800,flex:"none",color:T?"var(--notice-warning-text)":d.match?"var(--success)":"var(--warning)"},children:T?"Dropi no respondió":d.match?"â Coincide":"Estaba viejo · corregido"})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary,#475569)",marginTop:4,lineHeight:1.4},children:["Tablero: ",e.jsx("b",{children:d.lumy_status||"â"}),!d.match&&d.dropi_status?e.jsxs(e.Fragment,{children:["  · Dropi en vivo: ",e.jsx("b",{style:{color:"var(--success)"},children:d.dropi_status})]}):null]})]},A)})]}),e.jsx("div",{style:{padding:"11px 16px",borderTop:"1px solid var(--border,#e8eaf0)",fontSize:11.5,color:"var(--text-secondary,#64748b)",lineHeight:1.45},children:ur.fixed>0?"Corregimos los que estaban viejos; el tablero ya se recargó con el estado real de Dropi.":"Todos coinciden con Dropi: el tablero ya muestra el estado real (esos pedidos siguen en ese estado en Dropi)."})]})})]})}function U8(t,a){return{display:"inline-flex",alignItems:"center",gap:6,background:t?a:"var(--card-bg, #fff)",color:t?"#fff":"var(--text-muted, #6b7280)",border:`1px solid ${t?a:"var(--border, #e8eaf0)"}`,borderRadius:999,padding:"7px 14px",whiteSpace:"nowrap",fontSize:12.5,fontWeight:700,cursor:"pointer",textTransform:"capitalize",boxShadow:t?`0 1px 2px ${a}30, 0 6px 16px -6px ${a}66`:"0 1px 2px rgba(16,24,40,0.03)",transition:"background .16s cubic-bezier(.4,0,.2,1), color .16s, border-color .16s, box-shadow .16s"}}export{S8 as AnalyticsModule,Vy as LandingAlerts,u_ as LandingPageTab,O8 as PixelsSett
1171ings,Yy as ProductoRapidoForm,c_ as RecipeMiniLanding,Iy as RecipeSilhouette,F8 as SelectorPixelMetaDeLanding,zy as camposVisibles,j8 as computeWeakPoints};
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.