1import{a0 as D,j as e,aX as F,aY as I,aZ as M,a_ as $,a$ as k,B as x,eN as Be,J as A,iK as He,P as se,f as B,eI as re,fC as Oe,eT as Ue,aE as Qe,d9 as H,bO as ze,bP as Ke,bQ as te,bR as ne,fh as oe,fi as ie,fj as O,fk as g,fl as le,fm as h,A as de,F as ce,G as me,H as ue,I as xe,aU as j,aV as R,g8 as Ve,O as ge,dp as Ge,aG as he,aH as pe,aI as _e,aJ as be,aK as je,aL as fe,aM as ve,aN as Ne,cz as o,s as J,p as U}from"./index-SeSEDYyk.js";import{b as c}from"./charts-ytYDs0Yq.js";import{l as Je}from"./paginacao-BcubQNeu.js";import{A as Xe}from"./AdminLayout-DqNPU-Oz.js";import"./collapsible-DqQ-pJ1f.js";import"./categorias-de-parceiro-hIbo3PEn.js";const f=(w,m)=>J.rpc(w,m),ye=async w=>{var C;const m=await f("kiosk_upsert_device",w),r=((C=m.error)==null?void 0:C.message)??"";if(!(!!m.error&&/schema cache|does not exist|not unique/i.test(r)))return{...m,degraded:!1};const{p_require_serial_match:Q,...E}=w,p=await f("kiosk_upsert_device",E);return{...p,degraded:!p.error}},ke={id:null,label:"",booking_agency_id:"",partner_slug:"",region_slug:"serra-gaucha",is_active:!0,idle_timeout_seconds:"240",checkout_idle_timeout_seconds:"90",exit_pin:""},We={waiting:{label:"QR na tela",variant:"outline"},claimed:{label:"Celular conectado",variant:"secondary"},ordered:{label:"Pedido criado",variant:"secondary"},paid:{label:"Pago",variant:"default"},expired:{label:"Expirado",variant:"outline"},cancelled:{label:"Cancelado",variant:"outline"},failed:{label:"Falhou",variant:"destructive"}},Ye={activate:"Ativação",serial_mismatch:"Serial divergente",serial_unbound:"Serial desvinculado",reload_new_build:"Recarregou (build novo)",reset:"Reset manual",idle_reset:"Reset por inatividade",exit_dialog_opened:"Diálogo de saÃda aberto",exit_attempt:"PIN incorreto",exit_ok:"SaÃda liberada",cart_created:"Carrinho criado",qr_shown:"QR exibido",claimed:"Celular conectado",ordered:"Pedido criado",paid:"Pago"},na=()=>{const[w,m]=c.useState(!1),[r,l]=c.useState(ke),[Q,E]=c.useState(!1),[p,C]=c.useState(null),[u,z]=c.useState(null),[v,we]=c.useState("all"),[K,Ce]=c.useState("30"),[n,q]=c.useState(null),N=D({queryKey:["kiosk-devices"],queryFn:async()=>{const{data:a,error:s}=await f("kiosk_list_devices");if(s)throw s;return a??[]}}),L=D({queryKey:["kiosk-events",v],queryFn:async()=>{const{data:a,error:s}=await f("kiosk_recent_events",{p_device_id:v==="all"?null:v,p_limit:100});if(s)throw s;return a??[]}}),X=D({queryKey:["kiosk-funnel",K],queryFn:async()=>{const{data:a,error:s}=await f("kiosk_funnel_by_device",{p_days:Number(K)||30});if(s)throw s;return a??[]}}),V=D({queryKey:["kiosk-carts",v],queryFn:async()=>{const{data:a,error:s}=await f("kiosk_recent_carts",{p_device_id:v==="all"?null:v,p_limit:50});if(s)throw s;return a??[]}}),W=D({queryKey:["kiosk-partner-options"],queryFn:()=>Je(async(a,s)=>{const{data:t,error:i}=await J.from("partner_branding").select("booking_agency_id, partner_name, url_slug, logo_url, button_color, header_color, background_color, disable_branding").eq("is_active",!0).order("partner_name").order("id").range(a,s);if(i)throw i;return t??[]})}),Se=D({queryKey:["kiosk-region-options"],queryFn:async()=>{const{data:a,error:s}=await J.from("regions").select("slug, name").order("name");if(s)throw s;return a??[]}}),b=N.data??[],Y=L.data??[],Z=V.data??[],De=X.data??[],y=c.useMemo(()=>W.data??[],[W.data]),Ae=Se.data??[],ee=c.useMemo(()=>(a,s)=>`https://parksnet.com.br${a.partner_slug?`/${a.partner_slug}/destino/${a.region_slug}`:`/destino/${a.region_slug}`}?kiosk=${s}`,[]),ae=()=>{l(ke),m(!0)},Re=a=>{l({id:a.id,label:a.label,booking_agency_id:a.booking_agency_id,partner_slug:a.partner_slug??"",region_slug:a.region_slug,is_active:a.is_active,idle_timeout_seconds:String(a.idle_timeout_seconds),checkout_idle_timeout_seconds:String(a.checkout_idle_timeout_seconds),exit_pin:""}),m(!0)},P=c.useMemo(()=>{const a=r.booking_agency_id.trim();if(!a)return null;const s=y.find(t=>String(t.booking_agency_id)===a);return s?s.partner_name:"unknown"},[r.booking_agency_id,y]),_=c.useMemo(()=>{const a=r.partner_slug.trim();if(!a)return null;const s=y.find(t=>(t.url_slug??"")===a);return s?String(s.booking_agency_id)!==r.booking_agency_id.trim()?{c
1onflict:s.partner_name}:{ok:s.partner_name}:"unknown"},[r.partner_slug,r.booking_agency_id,y]),Te=a=>{const s=y.find(i=>String(i.booking_agency_id)===String(a));if(!s)return null;if(s.disable_branding)return{disabled:!0};const t=[s.logo_url?"logo":null,s.button_color||s.header_color||s.background_color?"cores":null].filter(Boolean);return{name:s.partner_name,paints:t}},Ee=a=>{var i;const s=y.find(S=>String(S.booking_agency_id)===a),t=(i=s==null?void 0:s.partner_name)==null?void 0:i.trim();l(S=>({...S,booking_agency_id:a,partner_slug:(s==null?void 0:s.url_slug)??"",label:S.label||(t?`${t} â recepção`:"")}))},qe=async()=>{if(!r.label.trim())return o.error("Dê um nome ao totem.");if(!r.booking_agency_id.trim())return o.error("Escolha o parceiro (agência afiliada).");if(!r.region_slug.trim())return o.error("Escolha a região travada.");if(r.exit_pin&&!/^\d{4,8}$/.test(r.exit_pin))return o.error("O PIN de saÃda precisa ter de 4 a 8 dÃgitos.");E(!0);try{const{data:a,error:s,degraded:t}=await ye({p_id:r.id,p_label:r.label.trim(),p_booking_agency_id:r.booking_agency_id.trim(),p_partner_slug:r.partner_slug.trim()||null,p_region_slug:r.region_slug.trim(),p_is_active:r.is_active,p_idle_timeout_seconds:Number(r.idle_timeout_seconds)||240,p_checkout_idle_timeout_seconds:Number(r.checkout_idle_timeout_seconds)||90,p_exit_pin:r.exit_pin?r.exit_pin:null,p_require_serial_match:!1});if(s)throw s;const i=a;m(!1),await N.refetch(),i!=null&&i.token?(q({label:r.label.trim(),agency:r.booking_agency_id.trim(),region:r.region_slug.trim(),url:ee({partner_slug:r.partner_slug.trim()||null,region_slug:r.region_slug.trim()},i.token)}),o.success("Totem criado. Copie a URL de ativação agora.")):o.success("Totem atualizado."),t&&o.warning("Salvo, mas a migration do rastreio de aparelho ainda não foi aplicada neste banco.")}catch(a){o.error("Erro ao salvar: "+((a==null?void 0:a.message)??String(a)))}finally{E(!1)}},Le=async(a,s)=>{try{const{error:t}=await ye({p_id:a.id,p_label:a.label,p_booking_agency_id:a.booking_agency_id,p_partner_slug:a.partner_slug,p_region_slug:a.region_slug,p_is_active:s,p_idle_timeout_seconds:a.idle_timeout_seconds,p_checkout_idle_timeout_seconds:a.checkout_idle_timeout_seconds,p_exit_pin:null,p_require_serial_match:!1});if(t)throw t;o.success(s?"Totem reativado.":"Totem desativado â o tablet exibe o aviso na próxima revalidação (até 15 min)."),N.refetch()}catch(t){o.error("Erro: "+((t==null?void 0:t.message)??String(t)))}},Pe=async()=>{if(u)try{const{data:a,error:s}=await f("kiosk_rotate_token",{p_id:u.id});if(s)throw s;q({label:u.label,agency:u.booking_agency_id,region:u.region_slug,url:ee(u,a)}),z(null),N.refetch()}catch(a){o.error("Erro ao rotacionar: "+((a==null?void 0:a.message)??String(a)))}},Fe=async()=>{if(p)try{const{error:a}=await f("kiosk_delete_device",{p_id:p.id});if(a)throw a;o.success("Totem removido."),C(null),N.refetch(),L.refetch()}catch(a){o.error("Erro ao remover: "+((a==null?void 0:a.message)??String(a)))}},Ie=async a=>{try{await navigator.clipboard.writeText(a),o.success("Copiado.")}catch{o.error("Não foi possÃvel copiar â selecione e copie manualmente.")}};return e.jsxs(Xe,{title:"Totens (modo tablet)",subtitle:"Tablets de balcão travados em kiosk: sem login, região travada e afiliado fixo",actions:e.jsxs(x,{onClick:ae,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Novo totem"]}),children:[e.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:b.length===0?"Nenhum totem cadastrado":`${b.length} ${b.length===1?"totem":"totens"} · ${b.filter(a=>a.is_active).length} ativo${b.filter(a=>a.is_active).length===1?"":"s"}`}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(F,{value:K,onValueChange:Ce,children:[e.jsx(I,{className:"w-[168px]",children:e.jsx(M,{})}),e.jsxs($,{children:[e.jsx(k,{value:"7",children:"Ãltimos 7 dias"}),e.jsx(k,{value:"30",children:"Ãltimos 30 dias"}),e.jsx(k,{value:"90",children:"Ãltimos 90 dias"})]})]}),e.jsx(x,{variant:"outline",size:"icon",className:"h-11 w-11",onClick:()=>{N.refetch(),X.refetch(),V.refetch(),L.refetch()},"aria-label":"Atualizar dados",children:e.jsx(Be,{className:"h-4 w-4"})})]})]}),N.isLoading?e.jsx("div",{className:"grid gap-5 lg:grid-cols-2",children:[0,1].map(a=>e.jsxs("div",{className:"rounded-xl border border-border p-5",children:[e.jsx(A,{className:"h-5 w-40"}),e.jsx(A,{className:"mt-2 h-4 w-24"}),e.jsx(A,{className:"mt-5 h-16 w-full"}),e.jsx(A,{className:"mt-4 h-32 w-full"})]},a))}):b.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-border px-6 py-14 text-center",children:[e.jsx(He,{className:"mx-auto h-10 w-10 text-muted-foreground"}),e.jsx("h2",{className:"mt-4 text-lg font-semibold",children:"Nenhum totem cadastrado"}),e.jsxs("p",{className:"mx-auto mt-2 max-w-md text-sm text-muted-foreground",children:["Um totem é um tablet de balcão travado em kiosk: sem login, região travada e a venda sempre atribuÃda ao afiliado do parceiro. Ao criar, você recebe uma URL de ativação â ela vai na configuração de URL inicial do navegador kiosk do tablet, e aparece"," ",e.jsx("strong",{className:"font-medium text-foreground",children:"uma única vez"}),"."]}),e.jsxs(x,{className:"mt-6",onClick:ae,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Criar o primeiro totem"]})]}):e.jsx("div",{className:"grid gap-5 lg:grid-cols-2",children:b.map(a=>{const s=a.device_info,t=De.find(d=>d.device_id===a.id),i=(s==null?void 0:s.model)||(s==null?void 0:s.ua_model),S=[s!=null&&s.android||s!=null&&s.ua_android?`Android ${s.android||s.ua_android}`:null,s!=null&&s.ua_webview?`WebView ${s.ua_webview}
1`:null].filter(Boolean).join(" · "),T=a.last_seen_at?Math.round((Date.now()-new Date(a.last_seen_at).getTime())/6e4):null,Me=T===null||T>40;return e.jsxs("section",{className:"flex min-w-0 flex-col rounded-xl border border-border bg-card",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-border p-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full ${a.is_active?Me?"bg-warning":"bg-primary":"bg-muted-foreground"}`}),e.jsx("h2",{className:"truncate text-base font-semibold",children:a.label})]}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["afiliado ",e.jsx("span",{className:"font-medium text-foreground",children:a.booking_agency_id})," · ",a.region_slug,a.partner_slug?` · /${a.partner_slug}`:""]}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[a.last_seen_at?`Visto ${T!==null&&T<60?`${T} min atrás`:B(new Date(a.last_seen_at),"dd/MM 'à s' HH:mm",{locale:U})}`:"Nunca acessou",!a.is_active&&" · desativado"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(re,{checked:a.is_active,onCheckedChange:d=>Le(a,d),"aria-label":a.is_active?"Desativar totem":"Ativar totem"}),e.jsx(x,{variant:"ghost",size:"icon",className:"h-11 w-11",onClick:()=>Re(a),"aria-label":"Editar totem",children:e.jsx(Oe,{className:"h-4 w-4"})}),e.jsx(x,{variant:"ghost",size:"icon",className:"h-11 w-11",onClick:()=>z(a),"aria-label":"Gerar novo token de ativação",children:e.jsx(Ue,{className:"h-4 w-4"})}),e.jsx(x,{variant:"ghost",size:"icon",className:"h-11 w-11",onClick:()=>C(a),"aria-label":"Remover totem",children:e.jsx(Qe,{className:"h-4 w-4 text-destructive-ink"})})]})]}),e.jsx("div",{className:"grid grid-cols-2 border-b border-border sm:grid-cols-4 sm:divide-x sm:divide-border",children:[["QR exibido",(t==null?void 0:t.carts)??0],["Conectou",(t==null?void 0:t.claimed)??0],["Pedido",(t==null?void 0:t.ordered)??0],["Pago",(t==null?void 0:t.paid)??0]].map(([d,G],$e)=>e.jsxs("div",{className:"px-3 py-4 text-center",children:[e.jsx("p",{className:`text-2xl font-semibold tabular-nums ${$e===3&&G>0?"text-foreground":""} ${G===0?"text-muted-foreground":""}`,children:G}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:d})]},d))}),t&&t.paid>0&&e.jsxs("div",{className:"flex items-baseline justify-between border-b border-border px-5 py-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Receita paga no perÃodo"}),e.jsx("span",{className:"text-lg font-semibold tabular-nums",children:(t.paid_cents/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})})]}),e.jsxs("dl",{className:"flex-1 divide-y divide-border px-5 text-sm",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Aparelho"}),e.jsx("dd",{className:"min-w-0 break-words text-right font-medium",children:i??e.jsx("span",{className:"font-normal text-muted-foreground",children:"â"})})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sistema"}),e.jsx("dd",{className:"min-w-0 break-words text-right text-xs",children:S||e.jsx("span",{className:"text-muted-foreground",children:"â"})})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Bateria e rede"}),e.jsx("dd",{className:"min-w-0 break-words text-right text-xs",children:typeof(s==null?void 0:s.battery)=="number"||s!=null&&s.ip?e.jsxs(e.Fragment,{children:[typeof(s==null?void 0:s.battery)=="number"?`${s.battery}%`:"",typeof(s==null?void 0:s.battery)=="number"&&(s!=null&&s.ip)?" · ":"",(s==null?void 0:s.ip)??""]}):e.jsx("span",{className:"text-muted-foreground",children:"â"})})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Reinicia após"}),e.jsxs("dd",{className:"min-w-0 break-words text-right text-xs",children:[a.checkout_idle_timeout_seconds,"s parado no checkout ·"," ",a.idle_timeout_seconds,"s n
1avegando"]})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Branding do parceiro"}),e.jsx("dd",{className:"min-w-0 break-words text-right text-xs",children:(()=>{const d=Te(a.booking_agency_id);return d?"disabled"in d?e.jsx("span",{className:"text-muted-foreground",children:"desligada no parceiro"}):d.paints.length===0?e.jsx("span",{className:"text-muted-foreground",children:"cadastrada, sem cores nem logo"}):e.jsxs("span",{children:[d.name," · ",d.paints.join(" e ")]}):e.jsx("span",{className:"text-muted-foreground",children:"não cadastrada â totem usa as cores da Parksnet"})})()})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 py-2.5",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Travas"}),e.jsx("dd",{className:"flex flex-wrap justify-end gap-1.5",children:a.has_pin?e.jsx(H,{variant:"secondary",children:"PIN de saÃda"}):e.jsx(H,{variant:"outline",children:"sem PIN"})})]})]}),s&&s.fully_available===!1&&e.jsx("p",{className:"border-t border-border px-5 py-3 text-xs text-warning-ink",children:'O Fully Kiosk está sem "Enable JavaScript Interface" habilitado â sem isso só chega o que o user agent informa (modelo e versão), sem bateria nem IP.'}),(s==null?void 0:s.collected_at)&&e.jsxs("p",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:["Bateria, rede e sistema são a leitura de"," ",B(new Date(s.collected_at),"dd/MM 'à s' HH:mm",{locale:U})," â o tablet reporta a cada 15 min, não ao vivo."]}),!s&&e.jsx("p",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:"O aparelho ainda não reportou identificação. Ela chega no próximo acesso do tablet."})]},a.id)})}),e.jsx("section",{className:"mt-10",children:e.jsxs(ze,{defaultValue:"carrinhos",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Atividade"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sem dado pessoal de hóspede: só produto, estado e horário."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(F,{value:v,onValueChange:we,children:[e.jsx(I,{className:"w-[190px]",children:e.jsx(M,{})}),e.jsxs($,{children:[e.jsx(k,{value:"all",children:"Todos os totens"}),b.map(a=>e.jsx(k,{value:a.id,children:a.label},a.id))]})]}),e.jsxs(Ke,{children:[e.jsx(te,{value:"carrinhos",children:"Carrinhos"}),e.jsx(te,{value:"eventos",children:"Eventos"})]})]})]}),e.jsx(ne,{value:"carrinhos",className:"mt-0",children:V.isLoading?e.jsx(A,{className:"h-48 w-full rounded-xl"}):Z.length===0?e.jsx("p",{className:"rounded-xl border border-dashed border-border px-6 py-10 text-center text-sm text-muted-foreground",children:"Nenhum carrinho montado neste totem ainda. A primeira linha aparece quando o hóspede chega na tela de Finalizar Compra."}):e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsxs(O,{children:[e.jsx(g,{children:"Quando"}),e.jsx(g,{children:"Totem"}),e.jsx(g,{className:"text-right",children:"Itens"}),e.jsx(g,{className:"text-right",children:"Total"}),e.jsx(g,{children:"Estado"}),e.jsx(g,{children:"Pedido"})]})}),e.jsx(le,{children:Z.map(a=>{const s=We[a.status]??{label:a.status,variant:"outline"};return e.jsxs(O,{children:[e.jsx(h,{className:"whitespace-nowrap text-sm text-muted-foreground",children:B(new Date(a.created_at),"dd/MM HH:mm",{locale:U})}),e.jsx(h,{children:a.device_label??"â"}),e.jsx(h,{className:"text-right tabular-nums",children:a.item_count}),e.jsx(h,{className:"whitespace-nowrap text-right tabular-nums",children:(a.total_cents/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})}),e.jsx(h,{children:e.jsx(H,{variant:s.variant,children:s.label})}),e.jsx(h,{className:"font-mono text-xs",children:a.order_number??"â"})]},a.id)})})]})})}),e.jsx(ne,{value:"eventos",className:"mt-0",children:L.isLoading?e.jsx(A,{className:"h-48 w-full rounded-xl"}):Y.length===0?e.jsx("p",{className:"rounded-xl border border-dashed border-border px-6 py-10 text-center text-sm text-muted-foreground",children:"Nenhum evento registrado. Ativações, resets e tentativas de saÃda aparecem aqui."}):e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:e.jsxs(oe,{children:[e.jsx(ie,{children:e.jsxs(O,{children:[e.jsx(g,{children:"Quando"}),e.jsx(g,{children:"Totem"}),e.jsx(g,{children:"Evento"}),e.jsx(g,{children:"Pedido"})]})}),e.jsx(le,{children:Y.map(a=>e.jsxs(O,{children:[e.jsx(h,{className:"whitespace-nowrap text-sm text-muted-foreground",children:B(new Date(a.created_at),"dd/MM HH:mm:ss",{locale:U}
1)}),e.jsx(h,{children:a.device_label??"â"}),e.jsx(h,{children:e.jsx(H,{variant:a.type==="exit_attempt"||a.type==="serial_mismatch"?"destructive":"secondary",children:Ye[a.type]??a.type})}),e.jsx(h,{className:"font-mono text-xs",children:a.order_number??"â"})]},a.id))})]})})})]})}),e.jsx(de,{open:w,onOpenChange:m,children:e.jsxs(ce,{className:"sm:max-w-lg",children:[e.jsxs(me,{children:[e.jsx(ue,{children:r.id?"Editar totem":"Novo totem"}),e.jsx(xe,{children:"Cada tablet é um totem separado, com token próprio â é assim que se sabe qual balcão vendeu."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-label",children:"Nome"}),e.jsx(R,{id:"totem-label",value:r.label,placeholder:"Hotel X â recepção 1",onChange:a=>l(s=>({...s,label:a.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-agency",children:"ID do afiliado (bookingAgency)"}),e.jsx(R,{id:"totem-agency",value:r.booking_agency_id,placeholder:"ex.: 9999",onChange:a=>l(s=>({...s,booking_agency_id:a.target.value.trim()}))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Toda venda feita neste tablet é atribuÃda a este afiliado, e nem um"," ",e.jsx("code",{children:"?bookingAgency="})," na URL sobrepõe."]}),P==="unknown"&&e.jsx("p",{className:"text-xs text-warning-ink",children:"Nenhum parceiro ativo cadastrado com este ID. Confira antes de instalar o tablet â ID errado significa comissão indo para o lugar errado."}),P&&P!=="unknown"&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Parceiro: ",P]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Preencher a partir de um parceiro cadastrado (opcional)"}),e.jsxs(F,{value:"",onValueChange:Ee,children:[e.jsx(I,{children:e.jsx(M,{placeholder:"Escolha para preencher ID, slug e nome"})}),e.jsx($,{children:y.map(a=>e.jsxs(k,{value:String(a.booking_agency_id),children:[a.partner_name,"
1(",a.booking_agency_id,")"]},String(a.booking_agency_id)))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-slug",children:"Slug do parceiro (opcional)"}),e.jsx(R,{id:"totem-slug",value:r.partner_slug,placeholder:"hotel-x",onChange:a=>l(s=>({...s,partner_slug:a.target.value.trim()}))}),_==="unknown"&&e.jsx("p",{className:"text-xs text-warning-ink",children:"Nenhum parceiro ativo tem este slug. Deixe vazio: slug inválido impede a branding do parceiro de aparecer no totem, porque o site resolve por slug antes da agência."}),_&&_!=="unknown"&&"conflict"in _&&e.jsxs("p",{className:"text-xs text-destructive-ink",children:["Este slug é de ",_.conflict,". Usá-lo levaria o totem para o contexto de outro parceiro."]}),_&&_!=="unknown"&&"ok"in _&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Slug de ",_.ok,"."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Região travada"}),e.jsxs(F,{value:r.region_slug,onValueChange:a=>l(s=>({...s,region_slug:a})),children:[e.jsx(I,{children:e.jsx(M,{})}),e.jsx($,{children:Ae.map(a=>e.jsx(k,{value:a.slug,children:a.name},a.slug))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-idle",children:"Inatividade navegando (s)"}),e.jsx(R,{id:"totem-idle",inputMode:"numeric",value:r.idle_timeout_seconds,onChange:a=>l(s=>({...s,idle_timeout_seconds:a.target.value.replace(/\D/g,"")}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-idle-checkout",children:"Inatividade no checkout (s)"}),e.jsx(R,{id:"totem-idle-checkout",inputMode:"numeric",value:r.checkout_idle_timeout_seconds,onChange:a=>l(s=>({...s,checkout_idle_timeout_seconds:a.target.value.replace(/\D/g,"")}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"totem-pin",children:"PIN de saÃda do modo totem"}),e.jsx(R,{id:"totem-pin",inputMode:"numeric",maxLength:8,autoComplete:"off",value:r.exit_pin,placeholder:r.id?"deixe vazio para manter o atual":"4 a 8 dÃgitos",onChange:a=>l(s=>({...s,exit_pin:a.target.value.replace(/\D/g,"")}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Libera o site normal no tablet (toque longo de 3s no canto inferior direito). Não é o PIN do navegador kiosk, que continua com a gerência."})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:"Totem ativo"})]}),e.jsx(re,{checked:r.is_active,onCheckedChange:a=>l(s=>({...s,is_active:a}))})]})]}),e.jsxs(ge,{children:[e.jsx(x,{variant:"outline",onClick:()=>m(!1),children:"Cancelar"}),e.jsx(x,{onClick:()=>void qe(),disabled:Q,children:Q?"Salvando...":"Salvar"})]})]})}),e.jsx(de,{open:!!n,onOpenChange:a=>!a&&q(null),children:e.jsxs(ce,{className:"sm:max-w-xl",children:[e.jsxs(me,{children:[e.jsx(ue,{children:"URL de ativação"}),e.jsx(xe,{children:"Configure isto como URL inicial do navegador kiosk do tablet. Assim todo boot reativa o modo totem sozinho. Esta URL não será exibida novamente."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:n==null?void 0:n.label}),e.jsxs("div",{className:"text-muted-foreground",children:["Afiliado ",e.jsx("span",{className:"font-mono",children:n==null?void 0:n.agency})," · região"," ",e.jsx("span",{className:"font-mono",children:n==null?void 0:n.region})]})]}),e.jsx("div",{className:"break-all rounded-lg border border-border bg-muted p-3 font-mono text-xs",children:n==null?void 0:n.url}),e.jsxs(x,{onClick:()=>n&&void Ie(n.url),className:"w-full",children:[e.jsx(Ge,{className:"mr-2 h-4 w-4"}),"Copiar URL"]})]}),e.jsx(ge,{children:e.jsx(x,{variant:"outline",onClick:()=>q(null),children:"Já copiei"})})]})}),e.jsx(he,{open:!!u,onOpenChange:a=>!a&&z(null),children:e.jsxs(pe,{children:[e.jsxs(_e,{children:[e.jsx(be,{children:"Gerar novo token?"}),e.jsxs(je,{children:['O token atual de "',u==null?void 0:u.label,'" deixa de valer na hora. O tablet sai do modo totem na próxima revalidação e precisa ser reapontado para a nova URL.']})]}),e.jsxs(fe,{children:[e.jsx(ve,{children:"Cancelar"}),e.jsx(Ne,{onClick:()=>void Pe(),children:"Gerar novo token"})]})]})}),e.jsx(he,{open:!!p,onOpenChange:a=>!a&&C(null),children:e.jsxs(pe,{children:[e.jsxs(_e,{children:[e.jsx(be,{children:"Remover totem?"}),e.jsxs(je,{children:['"',p==null?void 0:p.label,'" e o histórico dele serão apagados. O tablet sai do modo totem na próxima revalidação.']})]}),e.jsxs(fe,{children:[e.jsx(ve,{children:"Cancelar"}),e.jsx(Ne,{onClick:()=>void Fe(),children:"Remover"})]})]})})]})};export{na as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.